@unbrained/pm-cli 2026.11.11 → 2026.11.12

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 (155) hide show
  1. package/.agents/skills/pm-test-audit/SKILL.md +2 -1
  2. package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +2 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/AGENTS.md +2 -2
  5. package/CHANGELOG.md +19 -0
  6. package/CONTRIBUTING.md +1 -1
  7. package/README.md +1 -1
  8. package/dist/cli/register-mutation.js +2 -2
  9. package/dist/cli/register-operations.js +1 -1
  10. package/dist/cli-bundle/bundle-manifest.json +1 -1
  11. package/dist/cli-bundle/chunks/{chunk-FM375BHH.js → chunk-2DUUL53Z.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-5N3JMGXU.js → chunk-2K6GJUW7.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-DIWTFDU7.js → chunk-3DWEBVIK.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-XN2BRWDD.js → chunk-5NGGI7JC.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-NIOOJ3AG.js → chunk-5NY6EQSX.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-XJUYJXHZ.js → chunk-6ESY4Y2B.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-JLQ7O6UV.js → chunk-A7L5IEYV.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-WEAF3OY4.js → chunk-EALO2FPM.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-ZJDYBXMC.js → chunk-FJNHTBJ2.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-GZ52WAY2.js → chunk-FOT5K5OM.js} +36 -36
  21. package/dist/cli-bundle/chunks/{chunk-GOLQYO6M.js → chunk-GDS4DC5A.js} +47 -43
  22. package/dist/cli-bundle/chunks/{chunk-EBAHNZJT.js → chunk-GLPUIQDB.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-SPERPX27.js → chunk-KJL42AN5.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-Z4YEH7VQ.js → chunk-MR3CRLA7.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-QCTA2UFR.js → chunk-OBTU2BHJ.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-ZSL6U53K.js → chunk-OFIXSWJS.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-PS2YAPXC.js +9 -0
  28. package/dist/cli-bundle/chunks/{chunk-4RHXGQMK.js → chunk-T4UC3ZKL.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-JESMEJTD.js → chunk-U7MZIX3D.js} +2 -2
  30. package/dist/cli-bundle/chunks/chunk-UTNPDAID.js +31 -0
  31. package/dist/cli-bundle/chunks/{chunk-DV7WBAKQ.js → chunk-UY7Z3ZHQ.js} +2 -2
  32. package/dist/cli-bundle/chunks/{item-revision-LNIHK36Q.js → item-revision-SYJT6TVZ.js} +2 -2
  33. package/dist/cli-bundle/chunks/item-transaction-YXZ27UC6.js +2 -0
  34. package/dist/cli-bundle/chunks/{mutation-admission-WZY22LVH.js → mutation-admission-T57TAVWI.js} +2 -2
  35. package/dist/cli-bundle/chunks/{register-list-query-DYGPLVRL.js → register-list-query-5XZXTPNG.js} +2 -2
  36. package/dist/cli-bundle/chunks/register-mutation-V6WJFL77.js +20 -0
  37. package/dist/cli-bundle/chunks/register-operations-5RAWXY2F.js +2 -0
  38. package/dist/cli-bundle/chunks/{register-setup-G66U2WFV.js → register-setup-HCKCSQWQ.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-M5FZTPFA.js → chunk-5OCUNAQN.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/chunk-AIYJHVKV.js +44 -0
  41. package/dist/cli-bundle/focused-chunks/chunk-BB2GMKRB.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-JYWVRXLD.js → chunk-BHYGUVAU.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-GAXO2UQX.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-VVGXPF4W.js → chunk-GB2N4OM7.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/chunk-IPIFI4NT.js +3 -0
  46. package/dist/cli-bundle/focused-chunks/chunk-KN7RBRRH.js +26 -0
  47. package/dist/cli-bundle/focused-chunks/{chunk-3SH3L3DB.js → chunk-LAIN47EJ.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/chunk-RXY6BFRW.js +2 -0
  49. package/dist/cli-bundle/focused-chunks/{chunk-NMU3QFAU.js → chunk-SPAEZKVA.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/chunk-TZO6L523.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/{chunk-3A6XMQZJ.js → chunk-VUNX6NBR.js} +53 -53
  52. package/dist/cli-bundle/focused-chunks/{item-revision-B3BIG66B.js → item-revision-PWJNBW3F.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{item-transaction-4JDWOXNB.js → item-transaction-T6HXC3NS.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{mutation-admission-577MXOGD.js → mutation-admission-CLPOLSXZ.js} +2 -2
  55. package/dist/cli-bundle/main.js +2 -2
  56. package/dist/cli-bundle/sdk-authoring.js +1 -1
  57. package/dist/cli-bundle/sdk-contracts.js +2 -2
  58. package/dist/cli-bundle/sdk-core.js +1 -1
  59. package/dist/cli-bundle/sdk-governance.js +1 -1
  60. package/dist/cli-bundle/sdk-merge.js +57 -57
  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 +12 -12
  65. package/dist/core/item/parse.d.ts +13 -1
  66. package/dist/core/item/parse.js +4 -4
  67. package/dist/sdk/agent/command-recovery.js +1 -1
  68. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
  69. package/dist/sdk/cli-contracts/completeness.js +1 -1
  70. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  71. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  72. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  73. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  74. package/dist/sdk/completion/bash.js +1 -1
  75. package/dist/sdk/completion/fish.js +3 -1
  76. package/dist/sdk/completion/zsh.js +3 -1
  77. package/dist/sdk/docs.d.ts +14 -2
  78. package/dist/sdk/docs.js +1 -1
  79. package/dist/sdk/files.d.ts +14 -2
  80. package/dist/sdk/files.js +1 -1
  81. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  82. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  83. package/dist/sdk/governance/boundary-fixtures.d.ts +25 -0
  84. package/dist/sdk/governance/boundary-fixtures.js +1 -1
  85. package/dist/sdk/governance/defect-recurrence.d.ts +8 -1
  86. package/dist/sdk/governance/defect-recurrence.js +2 -2
  87. package/dist/sdk/guide-topics.js +1 -1
  88. package/dist/sdk/index.d.ts +1 -1
  89. package/dist/sdk/index.js +1 -1
  90. package/dist/sdk/lifecycle/dependency-removal.js +2 -0
  91. package/dist/sdk/lifecycle/start-blockers.d.ts +9 -0
  92. package/dist/sdk/lifecycle/start-blockers.js +1 -1
  93. package/dist/sdk/lifecycle/update.d.ts +10 -4
  94. package/dist/sdk/lifecycle/update.js +2 -2
  95. package/dist/sdk/linked-artifacts.d.ts +73 -3
  96. package/dist/sdk/linked-artifacts.js +2 -2
  97. package/dist/sdk/public-surface.json +1 -1
  98. package/dist/sdk/runtime/actions.js +1 -1
  99. package/dist/sdk/test/command-args.js +1 -1
  100. package/dist/sdk/test/execution.d.ts +15 -3
  101. package/dist/sdk/test/execution.js +2 -2
  102. package/docs/AGENT_GUIDE.md +2 -2
  103. package/docs/AGENT_UX_CONTRACTS.md +7 -1
  104. package/docs/BUILD_AND_RELEASE_ACCEPTANCE.md +1 -1
  105. package/docs/COMMANDS.md +16 -9
  106. package/docs/CORPUS_SHAPES.md +1 -1
  107. package/docs/DEFECT_RECURRENCE.md +20 -1
  108. package/docs/ONBOARDING.md +1 -1
  109. package/docs/README.md +6 -6
  110. package/docs/SDK.md +30 -0
  111. package/docs/SDK_CONTEXT_INTEGRITY.md +2 -0
  112. package/docs/TESTING.md +1 -1
  113. package/docs/generated/FLAG_LEXICON_BUDGETS.md +6 -6
  114. package/marketplace.json +1 -1
  115. package/package.json +8 -1
  116. package/packages/pm-beads/package.json +1 -1
  117. package/packages/pm-calendar/package.json +1 -1
  118. package/packages/pm-command-kit/package.json +1 -1
  119. package/packages/pm-digital-twin/package.json +1 -1
  120. package/packages/pm-governance-audit/package.json +1 -1
  121. package/packages/pm-guide-shell/package.json +1 -1
  122. package/packages/pm-kanban/package.json +1 -1
  123. package/packages/pm-lifecycle-hooks/package.json +1 -1
  124. package/packages/pm-linked-test-adapters/package.json +1 -1
  125. package/packages/pm-search-advanced/package.json +1 -1
  126. package/packages/pm-templates/package.json +1 -1
  127. package/packages/pm-todos/package.json +1 -1
  128. package/packages/pm-vcs/package.json +1 -1
  129. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  130. package/plugins/pm-claude/package.json +1 -1
  131. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  132. package/plugins/pm-codex/package.json +1 -1
  133. package/plugins/pm-codex/plugin.json +1 -1
  134. package/runtime-dependencies.json +1 -1
  135. package/dist/cli-bundle/chunks/chunk-SVVFJPNW.js +0 -9
  136. package/dist/cli-bundle/chunks/chunk-WWW5WHHJ.js +0 -31
  137. package/dist/cli-bundle/chunks/item-transaction-TMUYPSMR.js +0 -2
  138. package/dist/cli-bundle/chunks/register-mutation-MP5JCBAJ.js +0 -20
  139. package/dist/cli-bundle/chunks/register-operations-QEASK3EF.js +0 -2
  140. package/dist/cli-bundle/focused-chunks/chunk-2ZS3I5ZP.js +0 -2
  141. package/dist/cli-bundle/focused-chunks/chunk-33EK522E.js +0 -26
  142. package/dist/cli-bundle/focused-chunks/chunk-6ICHSVEY.js +0 -2
  143. package/dist/cli-bundle/focused-chunks/chunk-6TJXTKZD.js +0 -44
  144. package/dist/cli-bundle/focused-chunks/chunk-DW5S67LO.js +0 -2
  145. package/dist/cli-bundle/focused-chunks/chunk-UCUESVFW.js +0 -2
  146. package/dist/cli-bundle/focused-chunks/chunk-V27M5UQH.js +0 -3
  147. package/docs/CONTEXT_ALGORITHM_PORTFOLIO.md +0 -167
  148. package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +0 -246
  149. package/docs/PR_REVIEW_LOOP.md +0 -96
  150. package/docs/RELEASE_LEDGER_RECONCILIATION.md +0 -148
  151. package/docs/RELEASE_RELIABILITY.md +0 -147
  152. package/docs/RELEASING.md +0 -805
  153. package/docs/performance/corpus-shape-comparison.json +0 -1
  154. package/docs/performance/latest-scale-report.json +0 -1
  155. package/docs/performance/scale-100k-report.json +0 -1
@@ -0,0 +1,26 @@
1
+ import{Y as bt,Z as Et,j as Te}from"./chunk-NY65XTX7.js";import{J as _t,R as Ee,S as ht,Sa as vn,Za as An,a as se,b as bn,ib as gt,kb as In,nb as ve,ob as wt,pb as Cn,rb as Ae,ub as Ie,va as Se,vb as P,wb as Ce,xa as yt,y as pt,z as Tn}from"./chunk-HIKZYZ26.js";import{Aa as X,Ba as lt,Ca as gn,Ha as ie,Jc as Sn,Ka as wn,Mc as ft,Sd as M,Ub as we,a as st,aa as b,ca as re,da as J,ea as E,fe as be,g as ne,ga as hn,hc as En,pa as yn,qa as ct,qc as ut,ra as dt,uc as Q,wc as mt,za as oe}from"./chunk-MK7UQEE5.js";import{A as m,C as G,E as K,F as T,I,K as ge,t as at,z as u}from"./chunk-G6ERMFJ5.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]="8dd367eb-617e-5645-8f8a-57862f8385f7")}catch{}})();var xe=new WeakSet,St=new WeakMap,kn=new WeakSet;function Rn(e){return kn.add(e),e}function Tt(e){return kn.has(e)}function ae(e){xe.add(e);for(let[t,n]of Object.entries(e)){if(!Array.isArray(n))continue;let r=[...n];Reflect.set(e,t,r),xe.add(r)}return e}function On(e,t){return xe.has(e)||t!==void 0&&St.get(e)?.has(t)===!0}function zo(e,t){let n=new Set(t);St.set(e,n);for(let r of n){let o=Reflect.get(e,r);if(!Array.isArray(o))continue;let i=[...o];Reflect.set(e,r,i),xe.add(i)}return e}function Ln(e,t){if(Tt(e)&&Rn(t),On(e))return ae(t);let n=St.get(e);return n?zo(t,n):t}function qd(e){return On(e)?"sdk":"cli"}function xn(e,t){return e==="cli"?`--${t}`:t.replace(/-([a-z])/gu,(n,r)=>r.toUpperCase())}function ce(e){return`Pass unset: ["${e}"] to clear it`}function ke(e,t,n=""){return e==="cli"?`--${t} must not be empty${n}`:`${xn("sdk",t)} must not be empty. ${ce(t)}, or omit ${xn("sdk",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]="f7bc7fa8-c356-5c92-a03d-82275ba47edd")}catch{}})();var D="-",Mn=/^[A-Za-z0-9_.-]+$/u,vt=new Set(["actual_result","body","cmd","command","customer_impact","description","environment","expected_result","impact","location","message","note","outcome","repro_steps","resolution","text","title","unblock_note","value","why_now"]);function Nn(e,t){if(e.startsWith("```")||e.includes(`
2
+ `))return!0;let n=t.map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return new RegExp(`^(?:[-*+]\\s+)?(?:${n})\\s*[:=]`,"i").test(e)}function Pn(e){let t=e.trim();if(t==="")return[];let n=(qo(t)??t.split(",")).map(r=>r.trim()).filter(Boolean).map(r=>r.toLowerCase());return Array.from(new Set(n)).sort((r,o)=>r.localeCompare(o))}function $n(e){if(!Array.isArray(e)||e.length===0)return[];let t=[];for(let n of e)if(typeof n=="string")for(let r of Pn(n))t.push(r);return Array.from(new Set(t)).sort((n,r)=>n.localeCompare(r))}function zn(e){return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function Fo(e){return typeof e!="string"?[]:e.split(";").map(t=>t.trim()).filter(Boolean)}function Uo(e,t,n){let r=e.map(s=>s.trim()).filter(Boolean);for(let s of t??[]){let a=s.trim();if(a.includes(";"))throw new m('Acceptance criteria added with --add-ac cannot contain ";" because semicolons delimit stored criteria',u.USAGE,{code:"acceptance_criteria_semicolon_forbidden",required:"Pass one semicolon-free criterion per --add-ac value",why:"A semicolon inside one criterion would be re-read as multiple criteria",nextSteps:["Split the text into repeated --add-ac values, or replace the semicolon with punctuation that is not the storage delimiter"]});a.length>0&&!r.includes(a)&&r.push(a)}let o=[],i=r;for(let s of n??[]){let a=s.trim();if(a.length!==0){if(!i.includes(a)){o.push(a);continue}i=i.filter(c=>c!==a)}}return{criteria:i,unmatchedRemovals:o}}function jo(e,t){let n=zn(e);if(!t||t.length===0)return Array.from(new Set(n)).sort((o,i)=>o.localeCompare(i));let r=new Set(n);for(let o of $n(t))r.add(o);return Array.from(r).sort((o,i)=>o.localeCompare(i))}function Vo(e,t){let n=Array.from(new Set(zn(e))).sort((o,i)=>o.localeCompare(i));if(!t||t.length===0)return n;let r=new Set($n(t));return r.size===0?n:n.filter(o=>!r.has(o))}function qo(e){if(!e.startsWith("["))return null;let t;try{t=JSON.parse(e)}catch{return null}return t.map(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean"?String(n):"").filter(n=>n.length>0)}function At(e){return e.replace(/\r\n/g,`
3
+ `)}function Fn(e){let t=At(e).trim();if(!t.startsWith("```"))return e;let n=t.split(`
4
+ `);return n.length<2||n.at(-1)?.trim()!=="```"?e:n.slice(1,-1).join(`
5
+ `)}function Un(e){let t=[],n="",r=0,o=!1;for(let i=0;i<e.length;i+=1){let s=e[i];if(s==="\\"&&e[i+1]===","){n+=",",i+=1;continue}if(s==="\\"&&e[i+1]!==void 0){n+=`${s}${e[i+1]}`,i+=1;continue}if(s==='"'){o=!o,n+=s;continue}if(s===","&&!o){t.push({text:n,raw:e.slice(r,i)}),n="",r=i+1;continue}n+=s}return n.trim()&&t.push({text:n,raw:e.slice(r)}),t}function Ho(e){return Un(e).map(t=>t.text)}function Gd(e){return Un(e.trim()).map(({text:t,raw:n})=>{let r=jn(t),o=t.slice(0,Math.max(r,0)).trim();return Mn.test(o)?{text:t,raw:n,key:o,value:It(t.slice(r+1).trim())}:{text:t,raw:n}})}function It(e){let t=e.trim();if(t.startsWith('"')&&t.endsWith('"')){try{let n=JSON.parse(t);if(typeof n=="string")return n}catch{}return t.slice(1,-1).replace(/\\"/g,'"')}return e}function jn(e){let t=e.indexOf("="),n=e.indexOf(":"),r=t>=0,o=n>=0;return r&&o?Math.min(t,n):r?t:o?n:-1}function Yo(e,t){if((t==="--add"||t==="--add-glob")&&(/[./\\]/.test(e)||/\.[a-z]{1,6}$/i.test(e.trim())))return"For file/doc paths use: path=<file-path>[,scope=project|global]. The scope field is optional and defaults to project (example: path=src/api.ts or path=README.md,scope=project). ";if(t!=="--event")return"";let n=e.toLowerCase(),r=n.includes("recur_")||n.includes("recurrence")?' Recurrence list values must stay in one field and use "|" delimiters (for example recur_by_weekday=mon|wed or recur_by_month_day=1|15).':"",o=n.includes("recur_byweekday")?" Use recur_by_weekday (with underscores) for weekday recurrence filters.":"";return`${r}${o}`}function Dn(e,t){let n=e.replaceAll(/\s+/g," ").trim(),r=n.length>160?`${n.slice(0,157)}...`:n,o=Yo(e,t);return`Invalid ${t} value "${r}". Expected key=value entries separated by commas. `+o+`Also accepts markdown-style key/value lines (for example "- path: README.md"). Use ${t} ${D} to read piped stdin input.`}function Vn(e,t,n,r){let o=Object.keys(e).find(i=>i.toLowerCase()===t.toLowerCase());if(o!==void 0)throw new m(`${r} sets key "${t}" more than once in one entry, so the later value would silently replace the earlier one.`,u.USAGE,{code:"structured_entry_key_repeated",flag:r,value:n,required:`Give each key once per ${r} entry. Repeat ${r} for another entry; if the repeated key belongs to prose, quote that value or pass it through its standalone flag.`,why:"A structured entry keeps one value per key, so accepting a repeat would store data the author did not intend without any refusal.",details:{repeated_key:t,first_key:o}})}function Bo(e,t){let n=Fn(e).trim();if(n.length===0||!n.includes(`
6
+ `)&&!n.startsWith("-")&&!n.startsWith("*")&&!n.startsWith("+"))return null;let r={},o,i=At(n).split(`
7
+ `).map(s=>s.trim()).filter(s=>s.length>0);for(let s of i){let a=s.match(/^(?:[-*+]\s+)?([a-zA-Z0-9_.-]+)\s*(=|:)\s*(.*)$/);if(a){let c=a[1].trim();Vn(r,c,e,t),r[c]=It(a[3].trim()),o=c;continue}if(o&&vt.has(o.toLowerCase())){r[o]=`${r[o]}
8
+ ${s}`;continue}return null}return r}function qn(e,t){let n=Fn(e).trim();if(!n)throw new m(`${t} cannot be empty`,u.USAGE);let r=Bo(n,t);if(r)return r;let o={},i,s=Ho(n);for(let a of s){let c=jn(a),d=a.slice(0,Math.max(c,0)).trim();if(d!==""&&i!==void 0&&vt.has(i.toLowerCase())&&!Mn.test(d)){o[i]=`${o[i]},${a}`;continue}if(c>=0){let l=a.slice(0,c).trim();if(!l)throw new m(Dn(e,t),u.USAGE);let f=It(a.slice(c+1).trim());Vn(o,l,e,t),o[l]=f,i=l;continue}if(i&&vt.has(i.toLowerCase())){o[i]=`${o[i]},${a}`;continue}throw new m(Dn(e,t),u.USAGE)}return o}var Wo=/^[A-Za-z]:[\\/]/,Go=/^(?:[-*+]\s+)?[A-Za-z_][A-Za-z0-9_.-]*\s*=/;function Ko(e){let t=e.trim();return Wo.test(t)?!1:Go.test(t)}function Kd(e,t,n,r){if(!(r||!e.includes(",")))throw new m(`${t} received an ambiguous comma-bearing bare ${n}. Repeat ${t} for multiple values, or quote or escape literal commas in a structured key=<value> entry.`,u.USAGE,{code:"bare_comma_entry_ambiguous",required:`Use one ${t} per bare ${n}, or quote or escape literal commas in a structured key=<value> entry.`})}function Jo(e,t,n){let r=new Set(n.map(i=>i.toLowerCase())),o=Object.keys(e).filter(i=>!r.has(i.toLowerCase()));if(o.length>0)throw new m(`${t} does not recognize key${o.length>1?"s":""} ${o.map(i=>`"${i}"`).join(", ")}. Allowed keys: ${n.join(", ")}.`,u.USAGE);for(let i of Object.keys(e)){let s=i.toLowerCase();if(s!==i){if(Object.hasOwn(e,s))throw new m(`${t} provides key "${i}" more than once after case normalization.`,u.USAGE);e[s]=e[i],delete e[i]}}}async function Xo(e){if(process.stdin.isTTY===!0)throw new m(`${e} value "${D}" requires piped stdin input. Pipe content into the command, or end manual stdin with Ctrl+D (Unix/macOS) or Ctrl+Z then Enter (Windows).`,u.USAGE);return process.stdin.setEncoding("utf8"),await new Promise((t,n)=>{let r="";process.stdin.on("data",o=>{r+=o}),process.stdin.on("end",()=>{t(At(r))}),process.stdin.on("error",o=>{n(o)})})}var $=Symbol("all-mutation-stdin-fields"),x=new WeakMap;function Jd(e){return Tt(e)?e:ae(de({...e}))}function de(e){return x.set(e,$),e}function Qo(e,t){let n=x.get(e);return n===$||x.set(e,new Set([...n??[],...t])),e}function Oe(e,t){Ln(e,t);let n=x.get(e);return n===void 0||x.set(t,n===$?n:new Set(n)),t}function Xd(e,t){let n=x.get(e),r=x.get(t);return n===void 0||r===$?t:n===$?(x.set(t,n),t):(x.set(t,new Set([...r??[],...n])),t)}function Zo(e){return x.get(e)!==$}function Re(e,t){let n=x.get(e);return n!==$&&!n?.has(t)}function ei(e){let t;for(let n of e){if(n.resolveToken===!1||n.value===void 0)continue;let r=(Array.isArray(n.value)?n.value:[n.value]).filter(o=>o.trim()===D).length;if(r>1)throw new m(`${n.optionName} accepts "${D}" stdin token at most once per command invocation`,u.USAGE);if(r!==0){if(t!==void 0&&t!==n.optionName)throw new m(`Only one option may use "${D}" stdin token per command invocation. Already used by ${t}.`,u.USAGE);t=n.optionName}}}async function Qd(e,t,n){let r=e,o=[...t,...n];ei(o.map(([a,c])=>({value:r[a],optionName:c,resolveToken:Re(e,a)})));let i=Le(),s={...r};for(let[a,c]of t)s[a]=await i.resolveValue(r[a],c,Re(e,a));for(let[a,c]of n)s[a]=await i.resolveList(r[a],c,Re(e,a));return de(Oe(e,s))}function Le(){let e,t,n=async r=>{if(t&&t!==r)throw new m(`Only one option may use "${D}" stdin token per command invocation. Already used by ${t}.`,u.USAGE);return t=r,e||(e=Xo(r)),await e};return{resolveValue:async(r,o,i=!0)=>{if(!i)return r;if(r!==void 0)return r.trim()!==D?r:await n(o)},resolveList:async(r,o,i=!0)=>{if(!i)return r;if(!r)return;let s=r.map((d,l)=>d.trim()===D?l:-1).filter(d=>d>=0);if(s.length===0)return r;if(s.length>1)throw new m(`${o} accepts "${D}" stdin token at most once per command invocation`,u.USAGE);let a=await n(o),c=[...r];return c[s[0]]=a,c}}}function ti(e,t){let n=Number(e);if(!Number.isFinite(n))throw new m(`Invalid ${t} value "${e}"`,u.USAGE);return n}function ni(e,t){let n=e.trim(),r=Number(n);if(n===""||!Number.isInteger(r)||r<0)throw new m(`Invalid ${t} value "${e}". Expected a non-negative integer.`,u.USAGE);return r}(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]="b84fee06-5bbd-57f9-9643-f283d6c87afa")}catch{}})();function ri(e,t="--limit"){if(e===void 0)return;let n=Number(e);if(!Number.isFinite(n)||n<0)throw new m(`${t} must be a non-negative number`,u.USAGE);return Math.floor(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]="9b58b44d-819c-5115-b011-f9dfa8e2ab41")}catch{}})();var oi=3e4,le=class extends Error{status;constructor(t,n){super(t),this.name="SearchHttpError",this.status=n}};function z(e,t,n=oi){let r=e??n;if(!Number.isFinite(r)||r<=0)throw new Error(`${t} timeout must be a positive finite number`);return Math.floor(r)}function F(e,t){if(e)return e;if(typeof globalThis.fetch=="function")return globalThis.fetch.bind(globalThis);throw new Error(`${t} execution requires a fetch implementation`)}async function ii(e){try{return(await e.text()).replaceAll(/\s+/g," ").trim()}catch(t){return`(failed to read response body: ${E(t)})`}}async function De(e){let t=new AbortController,n=setTimeout(()=>{t.abort()},e.timeoutMs);try{let r;try{r=await e.fetcher(e.endpoint,{method:e.method,headers:e.headers,body:JSON.stringify(e.body),signal:t.signal})}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error(`${e.requestLabel} timed out after ${e.timeoutMs}ms`):new Error(`${e.requestLabel} execution failed: ${E(o)}`)}if(!r.ok){let o=await ii(r),i=o.length>0?`: ${o}`:"";throw new le(`${e.requestLabel} failed with status ${r.status} ${r.statusText}${i}`,r.status)}try{return await r.json()}catch(o){throw new Error(`${e.responseLabel} JSON parse failed: ${E(o)}`)}}finally{clearTimeout(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]="5452a392-2477-5028-8aa8-521c6b245f52")}catch{}})();function al(e,t){let n=b(e);if(!n)return"unconfigured";let r=b(t);return r&&r.toLowerCase()===n.toLowerCase()?"configured":"auto-detected"}function si(e){let t=re(e),n=t.toLowerCase();return n.endsWith("/embeddings")?t:n.endsWith("/v1")?`${t}/embeddings`:`${t}/v1/embeddings`}function Yn(e){let t=e.search?.embedding_model;return b(t)||null}function ai(e){let t=b(e.providers?.openai?.base_url),n=b(e.providers?.openai?.model);if(!t||!n)return null;let r=Yn(e),o=b(e.providers?.openai?.api_key);return{name:"openai",base_url:t,model:r??n,...o?{api_key:o}:{}}}function ci(e){let t=b(e.providers?.ollama?.base_url),n=b(e.providers?.ollama?.model);if(!t||!n)return null;let r=Yn(e);return{name:"ollama",base_url:t,model:r??n}}function Bn(e){let t=(Array.isArray(e)?e:[e]).map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new Error("Embedding input must include at least one non-empty string");return t}function di(e){let t=[],n=[],r=new Map;for(let o of e){let i=r.get(o);if(i===void 0){let s=t.length;t.push(o),r.set(o,s),n.push(s);continue}n.push(i)}return{uniqueInputs:t,originalToUniqueIndex:n}}function li(e){let t=e.map((n,r)=>({embedding:n.embedding,index:n.index,position:r}));if(t.some(n=>n.index!==void 0)){for(let n of t)if(!Number.isInteger(n.index))throw new TypeError(`OpenAI embedding response entry at position ${n.position} is missing a valid integer index`);return[...t].sort((n,r)=>{let o=n.index-r.index;return o!==0?o:n.position-r.position})}return t}function Ct(e){let t=ai(e),n=ci(e),r=[t,n].filter(s=>s!==null),o=b(e.search?.provider),i=o?o.toLowerCase():null;return{active:(i?r.find(s=>s.name===i):void 0)??r[0]??null,available:r}}function Hn(e){let t=re(e.base_url);return e.name==="openai"?{provider:"openai",endpoint:si(t),model:e.model}:{provider:"ollama",endpoint:`${t}/api/embed`,model:e.model}}function ui(e,t){let n=Bn(t);return e.name==="openai"?{target:Hn(e),method:"POST",headers:{"content-type":"application/json",...e.api_key?{authorization:`Bearer ${e.api_key}`}:{}},body:{model:e.model,input:n.length===1?n[0]:n}}:{target:Hn(e),method:"POST",headers:{"content-type":"application/json"},body:{model:e.model,input:n}}}function mi(e,t){if(e.name==="openai"){let o=t.data;if(!Array.isArray(o)||o.length===0)throw new Error("OpenAI embedding response must include a non-empty data array");return li(o).map((i,s)=>{let a=i.embedding;if(!J(a))throw new Error(`OpenAI embedding response entry at index ${s} is missing a numeric embedding vector`);return[...a]})}let n=t.embedding;if(J(n))return[[...n]];let r=t.embeddings;if(Array.isArray(r)&&r.length>0)return r.map((o,i)=>{if(!J(o))throw new Error(`Ollama embedding response entry at index ${i} is missing a numeric embedding vector`);return[...o]});throw new Error("Ollama embedding response must include embedding or embeddings vectors")}async function Wn(e,t,n={}){let r=z(n.timeout_ms,"Embedding request"),o=F(n.fetcher,"Embedding request"),i=Bn(t),s=di(i),a=ui(e,s.uniqueInputs),c=await De({endpoint:a.target.endpoint,method:a.method,headers:a.headers,body:a.body,timeoutMs:r,fetcher:o,requestLabel:"Embedding request",responseLabel:"Embedding response"}),d=mi(e,c);if(d.length!==s.uniqueInputs.length)throw new Error(`Embedding response cardinality mismatch: expected ${s.uniqueInputs.length} vector(s), received ${d.length}`);return s.originalToUniqueIndex.map(l=>[...d[l]])}(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]="4d563454-0999-5df5-afb9-58503b409436")}catch{}})();var Me=["title","description","tags","status","type","priority","assignee","parent","goal","value","why_now","risk","confidence","estimated_minutes","acceptance_criteria","resolution","expected_result","actual_result","body","comments","notes","learnings","reminders","events","dependencies","plan"];function kt(e){let t=e?.search?.corpus_fields;if(!Array.isArray(t))return[...Me];let n=new Set(Me),r=Array.from(new Set(t.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0&&n.has(o))));return r.length>0?r:[...Me]}var fi=8e3,pi=3200,U="...[semantic corpus truncated]",_i="search_embedding_corpus_max_characters_invalid:using_provider_default";function R(e){return e.map(t=>t==null?"":String(t).trim()).filter(t=>t.length>0).join(" ")}function hi(e){return(e.reminders??[]).map(t=>R([t.at,t.text]))}function yi(e){return(e.events??[]).map(t=>R([t.start_at,t.end_at,t.title,t.description,t.location,t.all_day===!0?"all day":void 0,t.timezone,t.recurrence?.freq,t.recurrence?.interval,t.recurrence?.count,t.recurrence?.until,t.recurrence?.by_weekday?.join(" "),t.recurrence?.by_month_day?.join(" "),t.recurrence?.exdates?.join(" ")]))}function gi(e,t){e.push(t.title,t.body,t.status,t.owner,t.evidence,t.blocked_reason,t.superseded_by);for(let n of t.linked_items??[])e.push(`${n.kind} ${n.id}`,n.note);for(let n of t.files??[])e.push(n.path,n.note);for(let n of t.tests??[])e.push(n.command,n.path,n.note);for(let n of t.docs??[])e.push(n.path,n.note)}function wi(e,t){for(let n of t.plan_decisions??[])e.push(n.decision,n.rationale,n.evidence);for(let n of t.plan_discoveries??[])e.push(n.text);for(let n of t.plan_validation??[])e.push(n.text,n.command,n.expected)}function ll(e){let t=[];t.push(e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context);for(let n of e.plan_steps??[])gi(t,n);return wi(t,e),t.filter(n=>typeof n=="string"&&n.length>0).join(" ")}function bi(e){let t=(e.plan_steps??[]).map(i=>R([i.order,i.id,i.title,i.body,i.status,i.owner,i.evidence,i.blocked_reason,i.superseded_by,(i.linked_items??[]).map(s=>R([s.kind,s.id,s.note])).join(" "),(i.files??[]).map(s=>R([s.path,s.note])).join(" "),(i.tests??[]).map(s=>R([s.command,s.path,s.note])).join(" "),(i.docs??[]).map(s=>R([s.path,s.note])).join(" ")])),n=(e.plan_decisions??[]).map(i=>R([i.decision,i.rationale,i.evidence,i.step_id])),r=(e.plan_discoveries??[]).map(i=>R([i.text,i.step_id])),o=(e.plan_validation??[]).map(i=>R([i.text,i.command,i.expected]));if([e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context,...t,...n,...r,...o].some(i=>i!==void 0))return{mode:e.plan_mode,scope:e.plan_scope,harness:e.plan_harness,resume_context:e.plan_resume_context,steps:t,decisions:n,discoveries:r,validation:o}}function xt(e){return(e??[]).flatMap(t=>Object.prototype.toString.call(t)==="[object Object]"&&typeof t.text=="string"?[t.text]:[])}function k(e){return typeof e=="string"&&e.trim().length>0}var Ei={title:e=>e.metadata.title,description:e=>e.metadata.description,tags:e=>e.metadata.tags,status:e=>e.metadata.status,type:e=>e.metadata.type,priority:e=>typeof e.metadata.priority=="number"?e.metadata.priority:void 0,assignee:e=>k(e.metadata.assignee)?e.metadata.assignee:void 0,parent:e=>k(e.metadata.parent)?e.metadata.parent:void 0,goal:e=>k(e.metadata.goal)?e.metadata.goal:void 0,value:e=>k(e.metadata.value)?e.metadata.value:void 0,why_now:e=>k(e.metadata.why_now)?e.metadata.why_now:void 0,risk:e=>k(e.metadata.risk)?e.metadata.risk:void 0,confidence:e=>e.metadata.confidence!==void 0&&e.metadata.confidence!==null?e.metadata.confidence:void 0,estimated_minutes:e=>typeof e.metadata.estimated_minutes=="number"?e.metadata.estimated_minutes:void 0,acceptance_criteria:e=>k(e.metadata.acceptance_criteria)?e.metadata.acceptance_criteria:void 0,resolution:e=>k(e.metadata.resolution)?e.metadata.resolution:void 0,expected_result:e=>k(e.metadata.expected_result)?e.metadata.expected_result:void 0,actual_result:e=>k(e.metadata.actual_result)?e.metadata.actual_result:void 0,body:e=>e.body,comments:e=>xt(e.metadata.comments),notes:e=>xt(e.metadata.notes),learnings:e=>xt(e.metadata.learnings),reminders:e=>hi(e.metadata),events:e=>yi(e.metadata),dependencies:e=>(e.metadata.dependencies??[]).map(t=>({id:t.id,kind:t.kind})),plan:e=>bi(e.metadata)};function Gn(e,t={}){let n=t.fields??Me,r={};for(let o of n){let i=Ei[o];if(!i)continue;let s=i(e);s!==void 0&&(r[o]=s)}return r}function Si(e){return e?.trim().toLowerCase()==="ollama"?pi:fi}function Z(e,t){let n=Si(e),r=hn(t);return r!==null?{maxCharacters:r,warning:null}:{maxCharacters:n,warning:t==null?null:_i}}function Rt(e,t={}){let n=JSON.stringify(Gn(e,{fields:t.fields})),r=Z(t.providerName,t.maxCharacters).maxCharacters;if(n.length<=r)return n;if(r<=U.length)return U.slice(0,r);let o=Math.max(0,r-U.length);return`${n.slice(0,o)}${U}`}(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]="67bae1a1-19d1-50ea-816f-4b68e6bb69d9")}catch{}})();function Ti(e,t,n){let r=e.search.embedding_batch_size,o=e.search.embedding_timeout_ms,i=e.search.scanner_max_batch_retries,s=Number.isFinite(r)&&r>0?Math.max(1,Math.floor(r)):1,a=Number.isFinite(o)&&o>0?Math.max(1,Math.floor(o)):3e4,c=Number.isFinite(i)&&i>=0?Math.floor(i):0;return{batchSize:s,timeoutMs:a,maxRetries:c,maxRequestBytes:n,maxInputCharacters:t}}function vi(e,t,n,r){let o=[],i=[],s=Buffer.byteLength(JSON.stringify({model:e.model,input:[]})),a=s;for(let c of t){let d=Buffer.byteLength(JSON.stringify(c.trim()));if(s+d>r)throw new RangeError(`Embedding input exceeds request byte ceiling ${r}; lower search.embedding_corpus_max_characters or raise maxRequestBytes`);let l=i.length>0?1:0;(i.length>=n||a+l+d>r)&&(o.push(i),i=[],a=s),a+=d+(i.length>0?1:0),i.push(c)}return o.push(i),o}function Ai(e,t){if(!Number.isFinite(t)||t<=0||e.length<=t)return e;let n=Math.max(0,t-U.length);return`${e.slice(0,n)}${U}`.slice(0,t)}function Kn(e){let t=E(e).toLowerCase();return t.includes("timed out")||t.includes("timeout")}function Ii(e,t,n,r,o,i){let s=`Embedding batch ${t} failed after ${o} attempt(s): ${E(i)}`,a=`provider=${e.name} model=${e.model} batch_size=${n} timeout_ms=${r}`;return Kn(i)?`${s} (${a}; guidance=check provider availability or lower search.embedding_batch_size, raise search.embedding_timeout_ms, or run keyword search while semantic indexing catches up)`:`${s} (${a})`}function Ci(e){return e instanceof le?e.status===413?"payload_too_large":null:Kn(e)?"timeout":null}async function Ot(e,t,n,r,o,i,s){let a=null;for(let c=0;c<=o;c+=1)try{s.requests+=1;let d=await Wn(e,t,{timeout_ms:r});return c>0&&i.push(`search_embedding_batch_retry_succeeded:batch=${n}:attempt=${c+1}:size=${t.length}`),s.successful_batches+=1,s.batch_size_histogram[t.length]=(s.batch_size_histogram[t.length]??0)+1,d}catch(d){a=d;let l=Ci(d);if(l!==null&&t.length>1){s.split_batches+=1;let f=Math.ceil(t.length/2),_=t.slice(0,f),h=t.slice(f);return i.push(`search_embedding_batch_split_after_${l}:batch=${n}:size=${t.length}:parts=${_.length}|${h.length}`),[...await Ot(e,_,`${n}.1`,r,o,i,s),...await Ot(e,h,`${n}.2`,r,o,i,s)]}if(c<o){s.retries+=1;let f=Math.min(1e3*2**c,8e3);await new Promise(_=>setTimeout(_,f))}}throw new Error(Ii(e,n,t.length,r,o+1,a))}async function Lt(e,t,n,r={}){if(n.length===0)return{vectors:[],warnings:[]};let o=performance.now(),i=r.maxRequestBytes??262144;if(!Number.isSafeInteger(i)||i<=0)throw new RangeError("maxRequestBytes must be a positive safe integer");let s={provider:e.name,model:e.model,max_request_bytes:i,limit_source:r.maxRequestBytes===void 0?"default":"caller",planned_batches:0,requests:0,successful_batches:0,split_batches:0,retries:0,batch_size_histogram:{},elapsed_ms:0,inputs_per_second:0},a=[],c=Z(e.name,t.search.embedding_corpus_max_characters);c.warning&&a.push(c.warning);let d=Ti(t,c.maxCharacters,i),l=0,f=n.map(y=>{if(y.trim().length===0)throw new TypeError("Embedding inputs must be non-empty strings");let p=Ai(y,d.maxInputCharacters);return p.length<y.length&&(l+=1),p});l>0&&a.push(`search_embedding_input_truncated:count=${l}:max_characters=${d.maxInputCharacters}`);let _=vi(e,f,d.batchSize,d.maxRequestBytes);s.planned_batches=_.length;let h=[],g=0;for(let y=0;y<_.length;y+=1){let p=_[y];r.onProgress?.({batch_index:y+1,batch_total:_.length,batch_size:p.length,completed_inputs:g,total_inputs:f.length,phase:"start"}),h.push(...await Ot(e,p,String(y+1),d.timeoutMs,d.maxRetries,a,s)),g+=p.length,r.onProgress?.({batch_index:y+1,batch_total:_.length,batch_size:p.length,completed_inputs:g,total_inputs:f.length,phase:"complete"})}return s.elapsed_ms=Math.max(1,performance.now()-o),s.inputs_per_second=n.length*1e3/s.elapsed_ms,{vectors:h,warnings:a,receipt: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]="bab18354-8e62-57c2-872b-f7ef47fcf6d6")}catch{}})();var j=`[^\\s/\\\\<>"'\\x60()\\[\\]{},;?=:#*]+`,S="[/\\\\]+",xi="[\\p{L}\\p{N}._@-]+",V=xi+"(?:"+S+j+")*",Ne="(?:(?:home|users)"+S+V+"|root"+S+V+")",ki="[/\\\\]"+Ne,Ri="[/\\\\]{2,}"+Ne,Oi="/?[a-z]:"+S+"users"+S+V,Li=j+"(?: +"+j+")*",Dt="(?:"+Li+S+")?users"+S+V,Di="[/\\\\]{2,}"+j+S+Dt,Mi="(?:[a-z]:|volume\\{[a-f0-9-]+\\}|"+j+")",or="[/\\\\]{2}[?.]"+S+"(?:unc"+S+j+S+Dt+"|"+Mi+S+"users"+S+V+")",Ni="file:(?:"+or+"|(?:[/\\\\](?![/\\\\])|[/\\\\]{3,}|[/\\\\]{2}localhost"+S+")(?:"+Ne+"|[a-z]:"+S+"users"+S+V+")|[/\\\\]{2}(?:[a-z]:"+S+"users"+S+V+"|"+j+S+"(?:"+Ne+"|"+Dt+")))",Pi=new RegExp("(?:^|[^\\p{L}\\p{N}_./\\\\~])(?:"+ki+"|"+Oi+"|"+Ni+")|(?:^|[^\\p{L}\\p{N}_:./\\\\~])(?:"+Ri+"|"+Di+"|"+or+")","giu"),Jn=4,$i=/%[a-f0-9]{2}|\\(?:u[a-f0-9]{4}|x[a-f0-9]{2}|\/)/iu,zi=new TextDecoder("utf-8");function Fi(e){return e.replace(/(?:%[a-f0-9]{2})+/giu,t=>zi.decode(Uint8Array.from(t.matchAll(/%([a-f0-9]{2})/giu),n=>Number.parseInt(n[1],16)))).replace(/%(?![a-f0-9]{2})[a-z0-9]{0,2}/giu,"\uFFFD")}function Ui(e){return e.replace(/\\+(?:u([a-f0-9]{4})|x([a-f0-9]{2})|(\/))?/giu,(t,n,r,o)=>{let i=n??r;return i===void 0?o??t:String.fromCharCode(Number.parseInt(i,16))})}function ji(e){return e.normalize("NFKC").replace(/[\p{Bidi_Control}\u200b-\u200f\u2060-\u206f\ufeff]/gu,"").replace(/[\u2215\u2044]/gu,"/").replace(/[\u043e\u041e]/gu,"o").replace(/[\u0455\u0405]/gu,"s")}function Vi(e,t){for(let[n,r]of[["percent_decode",Fi],["json_unescape",Ui],["unicode_fold",ji]]){let o=r(e);o!==e&&!t.includes(n)&&t.push(n),e=o}return e}function*qi(e,t,n){let r=e,o=[];for(let i=0;i<Jn;i+=1){let s=r;if(r=Vi(r,o),!n){t.lastIndex=0;for(let a of r.matchAll(t))n=!0,yield{index:0,normalizations:[...o]}}if(r===s)break;i===Jn-1&&$i.test(r)&&(yield{index:0,normalizations:[...o],normalization_incomplete:!0})}}function*Hi(e,t){let n=0;for(let r of e.split(`
9
+ `)){t.lastIndex=0;let o=!1;for(let i of r.matchAll(t))o=!0,yield{index:n+i.index};for(let i of qi(r,t,o))yield{...i,index:n};n+=r.length+1}}var Xn="password|passphrase",Qn=/(?:(?!<|\$\{|\$\(|config\.auth\.password\s*(?:\|\|\s*(?:''|"")|\?\s*unescape\(encodeURIComponent\(config\.auth\.password\)\)\s*:\s*(?:''|""))(?=[ \t]*(?:\/\*(?:[^*]|\*(?!\/))*\*\/[ \t]*)*(?:;|$|\/\/[^\r\n\u2028\u2029]*(?:\r\n)?$)))[A-Za-z0-9!@#$%^&*._+\-=]{8,}|"(?!<|\$\{|\$\()[^"]{8,}"|'(?!<|\$\{|\$\()[^']{8,}')/,Zn="token|secret|password|passwd|api[_-]?key",er=/["']?([A-Za-z0-9+/=_-]{24,})/,ir=[{name:"private-key",mutationRule:"private_key",regex:/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/g},{name:"github-token",mutationRule:"github_token",regex:/\b(?:gh[opsru]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g},{name:"npm-token",mutationRule:"npm_token",regex:/\bnpm_[A-Za-z0-9]{20,}\b/g},{name:"aws-access-key",mutationRule:"aws_access_key",regex:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g},{name:"google-api-key",mutationRule:"google_api_key",regex:/\bAIza[0-9A-Za-z_-]{35}\b/g},{name:"slack-token",mutationRule:"slack_token",regex:/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g},{name:"anthropic-api-key",mutationRule:"anthropic_api_key",regex:/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g},{name:"openai-api-key",mutationRule:"openai_api_key",regex:/\bsk-(?!ant-)[A-Za-z0-9_-]{20,}\b/g},{name:"gitlab-token",mutationRule:"gitlab_token",regex:/\bglpat-[A-Za-z0-9_.-]{20,}\b/g},{name:"jwt-like-token",mutationRule:"jwt_like_token",regex:/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g},{name:"npm-auth-token-assignment",mutationRule:"npm_auth_token_assignment",regex:/_authToken\s*=\s*\S+/g},{name:"sentry-user-token",mutationRule:"sentry_user_token",regex:/\bsntryu_[A-Za-z0-9]{20,}\b/g},{name:"sentry-org-token",mutationRule:"sentry_org_token",regex:/\bsntrys_[A-Za-z0-9_-]{20,}\b/g},{name:"private-ip",mutationRule:"private_ip",regex:/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"private-ssh-target",mutationRule:"private_ssh_target",regex:/\b(?:ssh|scp|rsync)\s+[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"sshpass-inline-password",mutationRule:"sshpass_inline_password",regex:/\bsshpass\s+-p\s+["'][^"']{6,}["']/g},{name:"password-assignment",mutationRule:"password_assignment",regex:new RegExp(String.raw`\b(?:${Xn})\s*[:=]\s*`+Qn.source,"gi"),structured:{keys:Xn,value:Qn.source,element:!0}},{name:"absolute-home-path",mutationRule:"absolute_home_path",regex:Pi,excludeFiles:/^(?:tests\/|examples\/)/},{name:"user-at-private-host",mutationRule:"user_at_private_host",regex:/\b[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"high-entropy-assignment",mutationRule:"high_entropy_assignment",regex:new RegExp(String.raw`\b(?:${Zn})\s*[:=]\s*`+er.source,"gi"),structured:{keys:Zn,value:er.source},mutationOnlyReason:"Generic assignments in source code are not credentials; preserve the existing mutation heuristic without treating source identifiers as secrets.",minimumEntropy:3.5}];function*sr(e,t){if(e.mutationRule==="absolute_home_path"){yield*Hi(t,e.regex);return}e.regex.lastIndex=0;for(let n of t.matchAll(e.regex))cr(e,n)&&(yield{index:n.index});e.structured&&(yield*rs(e,e.structured,t))}var tr=new Map,nr=/[\r\n\u2028\u2029]/u;function Yi(e){let t=`${e.keys}\0${e.value}\0${e.element===!0}`,n=tr.get(t);return n||(n={key:new RegExp(String.raw`\b(?:${e.keys})(["']?)\s*[:=]\s*`,"gi"),value:new RegExp(e.value,"iy"),...e.element?{element:new RegExp(String.raw`<(?:${e.keys})(?:\s[^<>]*)?>([^<]*)<\/(?:${e.keys})\s*>`,"gi")}:{}},tr.set(t,n)),n}function ar(e,t){let n=e[t];for(let r=t+1;r<e.length;r+=1){let o=e[r];if(o==="\\")r+=1;else if(o===n)return{end:r+1,terminated:!0}}return{end:e.length,terminated:!1}}function Bi(e,t){return ar(e,t).end}function Wi(e,t,n){return e.at(-1)==="}"?n:t}function Gi(e,t,n,r=n){let o=[],i=!1;for(let s=t;s<e.length;s+=1){let a=e[s];switch(a){case"[":case"{":o.push(a==="["?"]":"}"),i=a==="{";break;case"]":case"}":if(o.pop()!==a||o.length===0)return{found:!1,end:s+1};i=!1;break;case",":i=o.at(-1)==="}";break;case":":i=!1;break;case'"':case"'":if(!i&&Wi(o,n,r)(s))return{found:!0,end:s};s=Bi(e,s)-1;break;default:break}}return{found:!1,end:e.length}}var Ki=/\\(?:U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|[0-7]{1,3}|[\s\S])/gu,Ji={n:`
10
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"};function rr(e,t){let n=e[0],r=e.slice(1,t?-1:void 0).replaceAll(Ki,o=>{let i=o[1];if((i==="u"||i==="x")&&o.length>2)return String.fromCharCode(Number.parseInt(o.slice(2),16));if(/^[0-7]$/u.test(i))return String.fromCharCode(Number.parseInt(o.slice(1),8));if(i==="U"&&o.length===10){let s=Number.parseInt(o.slice(2),16);return s<=1114111?String.fromCodePoint(s):"\uFFFD"}return Ji[i]??i}).replaceAll(n,n==='"'?"'":'"').replaceAll(/[\r\n\u2028\u2029]/gu," ");return`${n}${r}${t?n:""}`}var Xi=64;function Qi(e,t,n){let r=e[t-1];if(!n)return r!==void 0&&/[\p{L}\p{N}_.-]/u.test(r)?"prefixed":"exact";if(r===n)return"exact";let o=Math.max(0,t-Xi);for(let i=t-1;i>=o;i-=1){let s=e[i];if(s===n)return"prefixed";if(s===`
11
+ `||s==="\r"||s==='"'||s==="'")return"malformed"}return"malformed"}function Zi(e,t,n){let r=(s,a)=>{t.lastIndex=a;let c=t.exec(s);return c!==null&&!nr.test(c[0])&&cr(e,c)?c:null},o=s=>{if(n[s]!=='"'&&n[s]!=="'")return;let{end:a,terminated:c}=ar(n,s),d=n.slice(s,a);return d.includes("\\")?nr.test(d)?[]:(n[s]==="'"?[rr(d,c),d]:[rr(d,c)]).map(l=>r(l,0)).filter(l=>l!==null):void 0},i=s=>{let a=o(s);if(a!==void 0)return a;let c=r(n,s);return c===null?[]:[c]};return{direct:s=>r(n,s)!==null,escaped:s=>(o(s)?.length??0)>0,accepts:s=>a=>i(a).some(c=>!(s&&/\s/u.test(c[0])))}}function*es(e,t){e.lastIndex=0;for(let n of t.matchAll(e)){let r=n[1].trim();r.length>=8&&!r.startsWith("${")&&!r.startsWith("$(")&&(yield{index:n.index})}}function ts(e,t,n){return t<e.exact||n&&t<e.compact}function ns(e,t,n,r){return(n||e.escaped(r)&&!e.direct(r))&&t(r)}function*rs(e,t,n){let r=Yi(t),o=Zi(e,r.value,n),i=new RegExp(r.key),s={exact:0,compact:0};for(let a=i.exec(n);a;a=i.exec(n)){let c=a[1],d=Qi(n,a.index,c);if(d==="malformed")continue;let l=d==="prefixed",f=o.accepts(l),_=a.index+a[0].length,h=n[_];if(h==="["||h==="{"){if(ts(s,_,l))continue;let g=Gi(n,_,f,o.accepts(!0));s[l?"compact":"exact"]=g.end,g.found&&(yield{index:a.index})}else ns(o,f,c,_)&&(yield{index:a.index})}r.element&&(yield*es(r.element,n))}function cr(e,t){if(e.minimumEntropy===void 0)return!0;let n=t[1],r=new Map;for(let i of n)r.set(i,(r.get(i)??0)+1);let o=0;for(let i of r.values()){let s=i/n.length;o-=s*Math.log2(s)}return o>=e.minimumEntropy}(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]="d6059407-bf03-5ae8-8b01-e3e7c5b28030")}catch{}})();var os=[{action:"append",history_scope:"item"},{action:"claim",history_scope:"item"},{action:"close",history_scope:"item"},{action:"close-many",history_scope:"item"},{action:"close-task",history_scope:"item"},{action:"comments",history_scope:"conditional"},{action:"config",history_scope:"conditional"},{action:"copy",history_scope:"item"},{action:"create",history_scope:"item"},{action:"delete",history_scope:"item"},{action:"deps",history_scope:"conditional"},{action:"discover",history_scope:"item"},{action:"docs",history_scope:"conditional"},{action:"files",history_scope:"conditional"},{action:"focus",history_scope:"conditional"},{action:"gc",history_scope:"conditional"},{action:"history-compact",history_scope:"history"},{action:"history-author-acknowledge",history_scope:"workspace"},{action:"history-redact",history_scope:"history"},{action:"history-repair",history_scope:"history"},{action:"init",history_scope:"workspace"},{action:"install",history_scope:"conditional"},{action:"learnings",history_scope:"conditional"},{action:"notes",history_scope:"conditional"},{action:"package",history_scope:"conditional"},{action:"pause-task",history_scope:"item"},{action:"plan",history_scope:"conditional"},{action:"profile",history_scope:"conditional"},{action:"release",history_scope:"item"},{action:"restore",history_scope:"item"},{action:"schema",history_scope:"conditional"},{action:"start-task",history_scope:"item"},{action:"templates",history_scope:"conditional"},{action:"test",history_scope:"conditional"},{action:"test-all",history_scope:"conditional"},{action:"update",history_scope:"item"},{action:"update-many",history_scope:"item"},{action:"upgrade",history_scope:"conditional"}],Nt=new Map(os.map(e=>[e.action,e]));function Mt(e,t="$",n=new WeakSet){return typeof e=="string"?[{path:t,value:e}]:typeof e!="object"||e===null?[]:n.has(e)?[]:(n.add(e),Array.isArray(e)?e.flatMap((r,o)=>Mt(r,`${t}[${o}]`,n)):Object.entries(e).flatMap(([r,o])=>Mt(o,`${t}.${r}`,n)))}function is(e,t){let n=sr(e,t),r=n.next().value;if(!r||e.mutationRule!=="absolute_home_path"||r.normalization_incomplete)return r;for(let o of n)if(o.normalization_incomplete)return{...r,normalizations:[...new Set([r.normalizations,o.normalizations].flatMap(i=>i??[]))],normalization_incomplete:!0};return r}function dr(e){let t=[];for(let n of Mt(e))for(let r of ir){let o=is(r,n.value);if(o){let i={rule:r.mutationRule,path:n.path};o.normalizations&&(i.normalizations=o.normalizations),o.normalization_incomplete&&(i.normalization_incomplete=!0),t.push(i)}}return t.filter((n,r,o)=>o.findIndex(i=>i.rule===n.rule&&i.path===n.path)===r)}function ss(e){let t=e.author.trim()||"unknown";if(e.settings.require_attributed_author&&t.toLowerCase()==="unknown")throw new m("Mutation author is required by workspace policy.",u.USAGE,{code:"mutation_author_required",required:"Pass --author <id>, set PM_AUTHOR, or configure author_default.",nextSteps:["Retry with --author <stable-agent-id>.","Set PM_AUTHOR for this agent session."]});if(e.settings.secret_guard==="off")return{author:t,findings:[],warnings:[],override_applied:!1};let n;try{n=dr(e.payload)}catch{return{author:t,findings:[],warnings:["secret_guard_scan_failed_open"],override_applied:!1}}if(n.length===0)return{author:t,findings:n,warnings:[],override_applied:!1};let r=[...new Set(n.map(o=>o.rule))].sort().join(",");if(e.settings.secret_guard==="block"&&e.force!==!0)throw new m(`Mutation blocked by secret guard (${r}). No detected value was logged.`,u.CONFLICT,{code:"mutation_secret_guard_blocked",required:"Remove the credential-shaped content or retry with --force after explicit review.",nextSteps:["Replace the value with a secret-manager reference.","Use pm history-redact if equivalent content already entered history."],recovery:{recovery_mode:"compact",attempted_command:"pm <mutation> [REDACTED]",normalized_args:["[REDACTED]"],suggested_retry:"Remove credential-shaped content, then retry the mutation."}});return{author:t,findings:n,warnings:[`secret_guard_detected:${n.length}:rules=${r}`,...e.settings.secret_guard==="block"&&e.force===!0?["secret_guard_force_override"]:[]],override_applied:e.settings.secret_guard==="block"&&e.force===!0}}function as(e){return Nt.has(e.trim().toLowerCase())}function cs(){return[...Nt.keys()].sort((e,t)=>e.localeCompare(t))}function El(e){return Nt.get(e.trim().toLowerCase())}(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]="5767332d-8094-55cd-96e9-47c5d20cd7df")}catch{}})();var ds=/\b([a-z][a-z0-9]*)-(\d+)(?:-[a-z0-9]+)*\b/giu,ls=/^(?:utf|iso|sha|tls|http|covid|match)$/iu;function Pt(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function ur(e){return[...new Set(Pt(e).match(/[\p{L}\p{N}]+/gu)??[])]}function lr(e){let t=Pt(e);return{normalized:t,tokens:ur(t),issueCodes:[...new Set([...e.matchAll(ds)].filter(n=>{let r=n[1],o=n.index,i=e.slice(o+n[0].length);return!ls.test(r)&&(r===r.toUpperCase()||r.length<=2||o===0&&/^\s*(?::|—|–|\])/u.test(i))}).map(n=>n[0].toLowerCase()))]}}function us(e,t){return ms(lr(e),lr(t))}function ms(e,t){if(e.normalized===t.normalized)return{score:1,reason:"exact_title"};let n=new Set(e.issueCodes);return t.issueCodes.some(r=>n.has(r))?{score:.99,reason:"issue_code"}:{score:we(e.tokens,t.tokens),reason:"title_token_jaccard"}}import fs 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]="a7cd1d62-16fe-5e5b-b382-64335fc5e403")}catch{}})();function Pe(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function ps(e,t){return[e.updated_at,t].map(n=>({value:n,time:Date.parse(n??"")})).filter(n=>typeof n.value=="string"&&Number.isFinite(n.time)).sort((n,r)=>r.time-n.time)[0]?.value??e.updated_at}function mr(e,t){let n=Math.max(1,Math.trunc(t.threshold_hours)),r=(t.now??new Date).getTime(),o=Pe(t.in_progress_status),i=[];for(let s of e){if(Pe(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=ps(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let d=Math.max(0,Math.floor((r-c)/36e5));d>=n&&i.push({id:s.id,last_activity_at:a,age_hours:d})}return i.sort((s,a)=>a.age_hours-s.age_hours||s.id.localeCompare(a.id)),{threshold_hours:n,count:i.length,items:i,remediation:"Claim active work with `pm claim <id>` or return abandoned work to open with `pm update <id> --status open`."}}async function _s(e,t,n){let r=new Map;return await Promise.all(t.filter(o=>Pe(String(o.status))===Pe(n.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await yt(fs.join(e,"history",`${o.id}.jsonl`),o.id)}catch{return}let s=i.map(a=>a.ts).filter(a=>Number.isFinite(Date.parse(a))).sort((a,c)=>Date.parse(c)-Date.parse(a))[0];s&&r.set(o.id,s)})),mr(t,{...n,last_history_activity:o=>r.get(o.id)})}(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]="42b217a3-31c0-561a-b7cb-b1a584b2edd5")}catch{}})();var hs=new Set(["rename-type","rename-field","remap-status",...wn]);function ys(e,t){if(t&&!hs.has(e))throw new m(`schema ${e} does not support --dry-run. Preview is supported for rename-type, rename-field, remap-status and workflow-policy actions. Remove --dry-run only when you intend to apply changes.`,u.USAGE,{code:"invalid_argument_value",examples:["pm schema rename-type Spike --to Experiment --dry-run"]})}(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]="ccb1b39b-3dde-511b-8133-d4747bb6e55e")}catch{}})();function $l(e){try{return e()}catch(t){throw!(t instanceof m)||t.exitCode!==u.USAGE?t:new m(`${t.message} No changes were made.`,u.USAGE,{...t.context,code:t.code==="linked_test_command_not_executable"?t.code:"invalid_argument_value",reason:"test_option_invalid",changed:!1,required:t.context.required??t.message})}}function gs(e,t){if(e[t]==="'"){let n=e.indexOf("'",t+1);return n<0?void 0:n+1}for(let n=t+1;n<e.length;n+=1){if(e[n]==='"')return n+1;if(e[n]==="\\"){n+=1;continue}if(e[n]==="`"||e.startsWith("$(",n))return}}function ws(e,t){let n=t;for(;n<e.length;){let r=e[n];if(/\s/u.test(r)||";&|".includes(r))return n;if(r==="\\"){n+=2;continue}if(r==="'"||r==='"'){let o=gs(e,n);if(o===void 0)return;n=o;continue}if("<>()`".includes(r))return;n+=1}return n===e.length?n:void 0}function $t(e,t){let n=t;for(;n<e.length;){if(/\s/u.test(e[n])){n+=1;continue}if(e[n]!=="#")return n;let r=e.indexOf(`
12
+ `,n);if(r<0)return e.length;n=r+1}return n}function bs(e,t){let n=$t(e,t),r=e[n];return r===void 0||!";&|".includes(r)?n:(n+=1,r!==";"&&e[n]===r&&(n+=1),$t(e,n))}function Es(e){let t=e.trim(),n=$t(t,0);if(t.length===0)return!1;for(;n<t.length;){if(!/[A-Za-z_]/u.test(t[n]))return!1;let r=n+1;for(;r<t.length&&/[A-Za-z0-9_]/u.test(t[r]);)r+=1;if(t[r]!=="=")return!1;let o=ws(t,r+1);if(o===void 0)return!1;n=bs(t,o)}return!0}function fr(e){if(!(e===void 0||!Es(e)))throw new m("Linked-test command contains only variable assignments or comments and has no executable command.",u.USAGE,{code:"linked_test_command_not_executable",required:'Supply an actual test command with --add "command=<actual command>" or --add-json. Environment assignments may precede that command.',examples:['pm test <id> --add "command=node --version"'],nextSteps:["Remove any already-stored assignment-only entry with --remove-index, then register the actual test command."]})}function zl(e){if(fr(e.command),!(e.pm_context_mode!=="none"||e.workspace_context_mode==="isolated"||e.workspace_context_mode==="snapshot"))throw new m("pm_context_mode=none requires workspace_context_mode=isolated or snapshot so implicit tracker discovery cannot reach the source workspace.",u.USAGE,{code:"linked_test_context_invalid",required:"Set workspace_context_mode to isolated or snapshot when pm_context_mode is none.",examples:[Sn(["test","<id>","--add-json",JSON.stringify({command:e.command,pm_context_mode:"none",workspace_context_mode:"isolated"})])]})}function Fl(e,t){return e.command===t.command&&e.path===t.path&&e.scope===t.scope&&e.pm_context_mode===t.pm_context_mode&&e.workspace_context_mode===t.workspace_context_mode}var $e=["command","cmd","path","scope","timeout","timeout_seconds","pm_context_mode","workspace_context_mode","env_set","env_clear","shared_host_safe","assert_stdout_contains","assert_stdout_regex","assert_stderr_contains","assert_stderr_regex","assert_stdout_min_lines","assert_json_field_equals","assert_json_field_gte","note"],Ss=new Set($e);function Ul(e){return Nn(e,$e)}function Ts(e,t){let n={},r=[];for(let[o,i]of Object.entries(e)){let s=o.toLowerCase();if(!Ss.has(s)){r.push(o);continue}if(Object.hasOwn(n,s))throw new m(`${t} provides key "${o}" more than once after case normalization`,u.USAGE);n[s]=i}if(r.length>0)throw new m(`${t} does not recognize key${r.length>1?"s":""} ${r.map(o=>`"${o}"`).join(", ")}. Allowed keys: ${$e.join(", ")}.`,u.USAGE);if(n.cmd!==void 0){if(n.command!==void 0&&n.command.trim()!==n.cmd.trim())throw new m(`${t} command and cmd must match when both are provided`,u.USAGE);let{cmd:o,...i}=n;return{...i,command:i.command??o}}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]="b58016fa-9817-5421-a4a3-78d1b1d22937")}catch{}})();import{readFile as vs}from"node:fs/promises";import pr 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]="7cc00705-c03e-5a18-9bec-af2585939ed8")}catch{}})();function iu(e){if(e!==void 0){if(typeof e!="string")throw new m("--rollback requires a non-empty checkpoint ID string",u.USAGE);return _r(e)}}function _r(e){let t=e.trim();if(!t)throw new m("--rollback requires a non-empty checkpoint ID",u.USAGE);if(!/^[a-zA-Z0-9._-]+$/.test(t))throw new m("--rollback checkpoint ID must match [a-zA-Z0-9._-]+",u.USAGE);return t}function As(e,t){let n=t.replace(/[-:.TZ]/g,"").slice(0,14),r=Math.random().toString(36).slice(2,8);return`${e}-${n}-${r}`}function Is(e,t){return pr.join(e,"checkpoints",t)}function hr(e,t,n){return pr.join(Is(e,t),`${n}.json`)}async function Cs(e,t,n,r){let o=hr(e,t,n),i=`${JSON.stringify(r,null,2)}
13
+ `;if(!await bn(o,i)&&await T(o)!==i)throw new m(`Checkpoint ${n} already exists with different contents; use a new checkpoint ID.`,u.CONFLICT);return o}function xs(e,t){if(!Array.isArray(e.items))throw new m(`Checkpoint ${t} is missing items`,u.GENERIC_FAILURE);return e.items.map(n=>{if(!n||typeof n!="object")throw new m(`Checkpoint ${t} contains an invalid item entry`,u.GENERIC_FAILURE);let r=n;if(typeof r.id!="string"||r.id.trim().length===0)throw new m(`Checkpoint ${t} contains an item entry without ID`,u.GENERIC_FAILURE);if(typeof r.target_updated_at!="string"||r.target_updated_at.trim().length===0)throw new m(`Checkpoint ${t} contains an item entry without target_updated_at`,u.GENERIC_FAILURE);return{id:r.id.trim(),target_updated_at:r.target_updated_at.trim()}})}async function ks(e,t,n,r){let o=_r(n),i=hr(e,t,o);if(!await G(i))throw new m(`Checkpoint ${o} not found`,u.NOT_FOUND);let s=await vs(i,"utf8"),a;try{a=JSON.parse(s)}catch(l){throw new m(`Checkpoint ${o} contains invalid JSON: ${E(l)}`,u.GENERIC_FAILURE)}if(!a||typeof a!="object")throw new m(`Checkpoint ${o} is invalid`,u.GENERIC_FAILURE);let c=a;if(c.schema_version!==r)throw new m(`Checkpoint ${o} has unsupported schema version. Inspect pm history and use an explicit pm restore only after reviewing later edits.`,u.GENERIC_FAILURE);let d=xs(c,o);return{record:c,items:d,path:i,id:typeof c.id=="string"?c.id:o,created_at:typeof c.created_at=="string"?c.created_at:M(),author:typeof c.author=="string"?c.author:"unknown"}}async function Rs(e,t){let n=[],r=[];for(let o of e)try{let i=await t(o.id,o.target_updated_at);n.push({id:o.id,status:i.skipped?"skipped":"restored",changed_fields:i.changed_fields,warnings:i.warnings}),i.skipped||r.push(o.id)}catch(i){n.push({id:o.id,status:"failed",error:E(i)})}return{rows:n,restored_ids:r,failed_count:n.filter(o=>o.status==="failed").length}}(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]="a95f85c5-ca4a-5156-8ce4-3dc9070ea468")}catch{}})();var yr=new Set(["item_format"]),gr=new Set(["definition_of_done","metadata_required_fields","lifecycle_stale_blocker_reason_patterns","lifecycle_closure_like_blocked_reason_patterns","lifecycle_closure_like_resolution_patterns","lifecycle_closure_like_actual_result_patterns"]),Os=new Set(["history_missing_stream_policy","sprint_release_format_policy","parent_reference_policy","metadata_validation_profile","governance_preset","governance_ownership_enforcement","governance_create_mode_default","governance_close_validation_default","governance_require_close_reason","governance_create_default_type","governance_workflow_enforcement","governance_start_blocker_enforcement","governance_parent_reference_policy","governance_metadata_validation_profile","governance_force_required_for_stale_lock","test_result_tracking","untrusted_linked_test_execution","telemetry_tracking","agent_identity_vocabulary"]),Ls=new Set(["governance_require_close_reason","governance_force_required_for_stale_lock","test_result_tracking","untrusted_linked_test_execution","telemetry_tracking"]),Ds={off:"disabled",on:"enabled",true:"enabled",false:"disabled",enabled:"enabled",disabled:"disabled"};function Ms(e){let t=e.trim().toLowerCase().replaceAll("-","_");if(yr.has(t)||gr.has(t)||Os.has(t)||t==="context")return t}function Ns(e){let t=e.trim().toLowerCase();return Ds[t]??e}function au(e,t){let n=Ms(e);return n===void 0?{routable:!1,reason:`Unknown config key "${e}" cannot route a positional value.`}:n==="context"?{routable:!1,reason:"Config set context does not accept a positional value. Use --default-depth, --activity-limit, --stale-threshold-days, or --section-<name> flags."}:yr.has(n)?{routable:!0,flag:"format",value:t}:gr.has(n)?{routable:!0,flag:"criterion",values:[t]}:{routable:!0,flag:"policy",value:Ls.has(n)?Ns(t):t}}function Ps(e){return e==="telemetry.enabled"||/^telemetry[-_]tracking$/u.test(e??"")?"global":"project"}(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]="cb883ffc-c431-5bf9-a973-931a8a0a940c")}catch{}})();function N(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t.length>0?t:null}function du(e,t){let n=N(t);return!e||!n?null:[...e.assurance_providers??[]].reverse().find(r=>N(r.definition.id)===n)??null}function $s(e,t){let n=N(t);return!e||!n?null:[...e.search_providers].reverse().find(r=>(N(r.runtime_definition?.name)??N(r.definition?.name))===n)??null}function zs(e,t){let n=N(t);return!e||!n?null:[...e.vector_store_adapters].reverse().find(r=>(N(r.runtime_definition?.name)??N(r.definition?.name))===n)??null}(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]="4441095d-0acd-5780-8758-7df94396cb8e")}catch{}})();function zt(e){return[...new Set(e.split(/[,\r\n]+/).map(t=>t.trim()).filter(t=>t.length>0))]}function Fs(e){let t=[];for(let r of e)if(typeof r=="string")t.push(r);else if(typeof r=="number"&&Number.isFinite(r))t.push(String(r));else return"";let n=zt(t.join(`
14
+ `));return n.length>0?n.join(","):""}function Us(e){if(e===void 0)return;if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(Array.isArray(e))return Fs(e);if(typeof e!="string")return"";let t=zt(e);return t.length>0?t.join(","):""}(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]="1dcf0d72-10da-51b6-b9f6-ab47bebcbf64")}catch{}})();function wr(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Ft(e){if(e==="/body"||e.startsWith("/body/"))return"body";if(e==="/metadata"||e.startsWith("/metadata/")||e==="/front_matter"||e.startsWith("/front_matter/")){let n=e.replace(/^\/(?:metadata|front_matter)\/?/,"").split("/")[0];return n?wr(n):"metadata"}let t=e.replace(/^\//,"").split("/")[0];return t?wr(t):"root"}function ze(e,t){return t==="body"?e.body:t==="metadata"?e.metadata:t==="root"?e:e.metadata[t]}function js(e,t){let n=t?.windowStartIndex??0,r=t?.field;if(e.length===0||n>=e.length)return[];let o=vn(),i=[];for(let s=0;s<e.length;s+=1){let a=e[s],c=o,d=An(o,a.patch),l;d.ok?(l=d.document,o=l):l=c;let f=new Set;for(let h of a.patch)f.add(Ft(h.path)),h.from!==void 0&&f.add(Ft(h.from));let _=[...f].sort((h,g)=>h.localeCompare(g));if(s>=n)if(r!==void 0){if(!f.has(r))continue;let h={field:r,before:ze(c,r),after:ze(l,r)};i.push({index:s+1,ts:a.ts,op:a.op,author:a.author,patch_ops:a.patch.length,changed_fields:[r],changes:[h]})}else{let h=_.map(g=>({field:g,before:ze(c,g),after:ze(l,g)}));i.push({index:s+1,ts:a.ts,op:a.op,author:a.author,patch_ops:a.patch.length,changed_fields:_,changes:h})}}return i}(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]="80805c6b-9b9a-5dad-b94b-d7dbd365fe5e")}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]="0394e0c1-ff68-5553-b022-1e8b6fff04f0")}catch{}})();var Vs=new Set(["none","null","undefined"]);function Au(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="warn"||t==="strict_error")return t;if(t==="strict")return"strict_error";throw new m("Config set parent-reference-policy requires --policy with one of: warn, strict_error (alias: strict)",u.USAGE)}function qs(e,t="cli"){let n=t==="sdk";if(typeof e!="string")throw new m(n?`parent must be a string. ${ce("parent")}.`:"--parent must be a string. Use --unset parent to clear this field.",u.USAGE);let r=e.trim();if(r.length===0)throw new m(ke(t,"parent",". Use --parent none to unset."),u.USAGE);if(br(r))throw new m(n?`parent must not be the placeholder "${r}". ${ce("parent")}, or omit parent.`:`--parent must not use placeholder token "${r}". Use --unset parent to clear this field.`,u.USAGE);return r}function br(e){return Vs.has(e.trim().toLowerCase())}function Hs(e,t,n="cli"){if(t==="strict_error")throw new m(`Parent item "${e}" was not found. Create it first or ${n==="sdk"?"omit parent":"use --parent none"}.`,u.USAGE);return{warnings:[`validation_warning:parent_reference_missing:${e}`]}}function Ys(e,t,n,r="cli"){let o=Te(e,n),i=Te(t,n);if(o!==i)return;let s=t!==i||e!==o?` (normalized from parent "${t}" and item "${e}")`:"";throw new m(`Parent item "${i}" cannot be the same as item "${o}"${s}. ${r==="sdk"?`${ce("parent")}.`:"Use --unset parent to clear this field."}`,u.USAGE)}(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]="a59d5b7f-9764-53c5-a014-1119868be8ea")}catch{}})();var Ut={critical:0,high:1,medium:2,low:3,minimal:4},Er=Object.keys(Ut),Bs=`numbers 0..4 (0=critical, 1=high, 2=medium, 3=low, 4=minimal) or names (${Er.join(", ")}), case-insensitive`;function Fe(e){return new m(`Invalid priority "${e}". Accepted values: ${Bs}.`,u.USAGE,{code:"invalid_argument_value",field:"priority",value:e,allowed:["0","1","2","3","4",...Er]})}function Ws(e){if(typeof e=="number"){if(Number.isInteger(e)&&e>=0&&e<=4)return e;throw Fe(String(e))}if(typeof e!="string")throw Fe(String(e));let t=e.trim();if(t.length===0)throw Fe(e);let n=t.toLowerCase();if(Object.prototype.hasOwnProperty.call(Ut,n))return Ut[n];if(/^[0-4]$/.test(t))return Number(t);throw Fe(e)}(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]="e363ee89-b438-5c8e-bb06-f4d05cc814cc")}catch{}})();function Gs(e){return ae(de(Oe(e,{...e})))}(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]="6012e77b-7cdd-5496-a668-c9240a811b1a")}catch{}})();var Ks=/^[A-Za-z0-9][A-Za-z0-9._/-]*$/,Js=64;function Pu(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="warn"||t==="strict_error")return t;if(t==="strict")return"strict_error";throw new m("Config set sprint-release-format-policy requires --policy with one of: warn, strict_error (alias: strict)",u.USAGE)}function Xs(e,t,n,r="cli"){let o=t.trim();if(o.length===0)throw new m(ke(r,e,`. Use --${e} none to unset.`),u.USAGE);if(o.length<=Js&&Ks.test(o))return{value:o,warnings:[]};let i="Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._/-]* (no spaces).";if(n==="strict_error")throw new m(`Invalid ${r==="sdk"?e:`--${e}`} value "${o}". ${i}`,u.USAGE);return{value:o,warnings:[`validation_warning:${e}_format:${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]="14e6c7b4-3161-5f82-b797-f06a879d1370")}catch{}})();var Sr={open:"open_status",closed:"close_status",canceled:"canceled_status",cancelled:"canceled_status"},Tr="all";function Vu(e){if(typeof e!="string")return!1;let t=e.split(",").map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return t.length===1&&t[0]===Tr}function Qs(e,t){let n=e.trim().toLowerCase();if(n.length===0)return;let r=Sr[n];return r?t[r]:_t(e,t)}function Zs(e){let t=new Set(Object.keys(Sr));for(let n of e.definitions){t.add(n.id);for(let r of n.aliases)t.add(r)}return[...t]}function ea(e,t){let n=e.trim().toLowerCase(),r,o=Number.POSITIVE_INFINITY;for(let i of Zs(t)){let s=st(n,i.toLowerCase(),2);s!==null&&s<o&&(r=i,o=s)}return r}function ta(e,t,n){if(typeof e!="string")return;let r=n?.strict===!0,o=n?.flagLabel??"--status",i=e.split(",").map(a=>a.trim()).filter(a=>a.length>0);if(i.length===0)return;if(i.filter(a=>a.trim().toLowerCase()===Tr).length>0){if(i.length===1)return;throw new m(`Invalid ${o} value "all". Use it by itself, or omit ${o} to search every status.`,u.USAGE)}let s=[];for(let a of i){let c=Qs(a,t);if(c===void 0){if(r){let d=ea(a,t);throw new m(`Invalid ${o} value "${a}". Use open|closed|canceled or a configured status id${d?`. Did you mean "${d}"?`:"."}`,u.USAGE)}s.push(a);continue}s.push(c)}return[...new Set(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]="50f77f3f-b2b0-5ae2-b669-6ed50bbdd530")}catch{}})();var na={bug:"Issue",bugfix:"Issue",defect:"Issue",incident:"Issue",enhancement:"Feature",story:"Feature",userstory:"Feature","user-story":"Feature","user story":"Feature",change:"Chore",ticket:"Task",todo:"Task"};function ra(e){if(e!==void 0)return na[e.trim().toLowerCase()]}(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]="c628dcf9-d98f-566e-9f93-cc81e737691c")}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]="158d5065-075c-5355-a65c-f3edc9c5f1f0")}catch{}})();var oa=new Map(ne.map(e=>[e.toLowerCase(),e])),ia=/^[A-Za-z][A-Za-z0-9_-]*$/;function vr(e,t){if(!ia.test(e))throw new Error(`${t} "${e}" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. "Spike" or "code-review").`)}function jt(e){return oa.get(e.trim().toLowerCase())}function Cr(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function sa(e){return e.replace(/[\\"`$]/g,t=>`\\${t}`)}function xr(e){let t=new Map;for(let n of e){let r=n.trim();if(r.length===0)continue;let o=r.toLowerCase();t.has(o)||t.set(o,r)}return[...t.values()].sort((n,r)=>n.localeCompare(r))}function Gu(e){let t=(e.name??"").trim();if(t.length===0)throw new Error("Type name must not be empty.");vr(t,"Type name");let n=jt(t);if(n)throw new Error(`Cannot redefine built-in item type "${n}". Built-in types are reserved: ${ne.join(", ")}.`);let r=e.description?.trim(),o=e.defaultStatus?.trim(),i=e.folder?.trim(),s=i&&i.length>0?ct(i):void 0,a=xr(e.aliases??[]);for(let c of a){vr(c,"Alias");let d=jt(c);if(d)throw new Error(`Alias "${c}" collides with built-in item type "${d}". Built-in types are reserved: ${ne.join(", ")}.`)}return{name:t,description:r&&r.length>0?r:void 0,defaultStatus:o&&o.length>0?o:void 0,folder:s,aliases:a}}function Ku(e,t){let n=e.name.toLowerCase(),r=new Map;for(let i of t.definitions){if(typeof i.name!="string")continue;let s=i.name.trim();if(!(s.length===0||s.toLowerCase()===n)){r.set(s.toLowerCase(),s);for(let a of Cr(i.aliases))a.trim().length>0&&r.set(a.trim().toLowerCase(),s)}}let o=r.get(n);if(o)throw new Error(`Type name "${e.name}" collides with an alias of existing item type "${o}".`);for(let i of e.aliases){let s=r.get(i.toLowerCase());if(s)throw new Error(`Alias "${i}" already maps to existing item type "${s}".`)}}function Ar(e,t){return typeof t=="string"&&t.trim().length>0?ct(t).toLowerCase():yn(e).toLowerCase()}function Ju(e,t,n){let r=e.name.toLowerCase(),o=Ar(e.name,e.folder),i=a=>{throw new Error(`Item type "${e.name}" would store items in folder "${o}", which already belongs to existing item type "${a}". Pass a distinct --folder to keep their storage separate.`)};for(let a of t.definitions){if(typeof a.name!="string")continue;let c=a.name.trim();c.length===0||c.toLowerCase()===r||Ar(c,a.folder)===o&&i(c)}let s=n?.get(o);s!==void 0&&s.toLowerCase()!==r&&i(s)}function Xu(e){if(e==null||e.trim().length===0)return{definitions:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/types.json contains invalid JSON.")}return{definitions:aa(t)}}function aa(e){let t=ca(e);if(!t)return[];let n=[];for(let r of t){if(typeof r!="object"||r===null||Array.isArray(r))continue;let o=r;typeof o.name!="string"||o.name.trim().length===0||n.push(o)}return n}function ca(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let n=t.item_types;if(Array.isArray(n.definitions))return n.definitions}}function Qu(e,t){let n=t.name.toLowerCase(),r=e.definitions.slice(),o=r.findIndex(c=>typeof c.name=="string"&&c.name.trim().toLowerCase()===n),i=o>=0?r[o]:void 0,s=xr([...Cr(i?.aliases),...t.aliases]),a={...i,name:t.name};return t.folder!==void 0&&(a.folder=t.folder),s.length>0?a.aliases=s:a.aliases!==void 0&&delete a.aliases,Ir(a,"description",t.description),Ir(a,"default_status",t.defaultStatus),o>=0?r[o]=a:r.push(a),r.sort((c,d)=>c.name.localeCompare(d.name)),{file:{definitions:r},definition:a,replaced:o>=0,...i&&typeof i.name=="string"?{previousName:i.name}:{}}}function Zu(e,t){let n=(t??"").trim();if(n.length===0)throw new Error("Type name must not be empty.");let r=jt(n);if(r)throw new Error(`Cannot remove built-in item type "${r}". Built-in types are reserved: ${ne.join(", ")}.`);let o=n.toLowerCase(),i=e.definitions.slice(),s=i.findIndex(c=>typeof c.name=="string"&&c.name.trim().toLowerCase()===o);if(s<0)return{file:{definitions:i},removed:!1};let[a]=i.splice(s,1);return{file:{definitions:i},removed:!0,definition:a}}function Ir(e,t,n){let r=e;n!==void 0&&(r[t]=n)}function em(e){return`${JSON.stringify({definitions:e.definitions},null,2)}
15
+ `}function da(e,t){let n=e.trim().length>0?e.trim():e,r=t?.trim()||".agents/pm/schema/types.json";return`To register a custom type, run: pm schema add-type "${sa(n)}" (writes ${r}).`}function la(e,t,n){return`Invalid type value "${e}". Allowed: ${t.join(", ")}. ${da(e,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]="4b79bd02-51ae-5c46-be4c-2f41dd8c9486")}catch{}})();function kr(e,t){return ie(e,t)}function ua(e,t,n){let r={};for(let o of t.command_to_fields.get(n)??[]){let i=pt(e,o);i!==void 0&&(r[o.metadata_key]=Tn(o,i))}return r}function ma(e,t){for(let[n,r]of Object.entries(t)){let o=e[n];if(Array.isArray(r)){if(Array.isArray(o)){let i=o.map(s=>String(s));if(!r.map(s=>String(s)).every(s=>i.includes(s)))return!1;continue}if(!kr(o,r[r.length-1]))return!1;continue}if(!kr(o,r))return!1}return!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]="77a7b77a-907c-541d-ac55-e06174dbbf11")}catch{}})();function Rr(e){return typeof e=="string"?e.trim().toLowerCase():""}function Ue(e,t){let n=se(e);return n.length===0?"":t?.alias_to_id?.get(n)??n}function fa(e){let t=Array.isArray(e?.type_workflows)?e.type_workflows:[],n=new Map;for(let r of t){let o=Rr(r?.type);if(o.length===0||!Array.isArray(r?.allowed_transitions))continue;let i=r.allowed_transitions,s=n.get(o)??{pairs:[],denyAll:!1};i.length===0&&(s.denyAll=!0);for(let a of i){if(!Array.isArray(a)||a.length!==2)continue;let c=se(a[0]),d=se(a[1]);c.length===0||d.length===0||s.pairs.some(l=>l[0]===c&&l[1]===d)||s.pairs.push([c,d])}n.set(o,s)}return[...n.entries()].filter(([,r])=>r.pairs.length>0||r.denyAll).map(([r,o])=>({type:r,allowed_transitions:o.pairs})).sort((r,o)=>r.type.localeCompare(o.type))}function pa(e){let t=Rr(e.typeName),n=e.typeWorkflows.find(i=>i.type===t);if(!n)return{allowed:!0,hasRule:!1,allowedTransitions:[]};let r=Ue(e.fromStatus,e.statusRegistry),o=Ue(e.toStatus,e.statusRegistry);return r.length>0&&r===o?{allowed:!0,hasRule:!0,allowedTransitions:n.allowed_transitions}:{allowed:n.allowed_transitions.some(i=>{let s=Ue(i[0],e.statusRegistry),a=Ue(i[1],e.statusRegistry);return s===r&&a===o}),hasRule:!0,allowedTransitions:n.allowed_transitions}}function _a(e){return e.length===0?"(no transitions allowed)":e.map(t=>`${t[0]} -> ${t[1]}`).join(", ")}import{spawnSync as Lr}from"node:child_process";(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]="7889f11f-36f9-5384-8429-58d951c342da")}catch{}})();var ha="PM_DISABLE_OLLAMA_AUTO_DEFAULTS",ya="PM_OLLAMA_MODEL",ga="http://localhost:11434",wa="qwen3-embedding:0.6b",ba=".agents/pm/search/lancedb/",Ea=1500,Sa=2500,Ta=/qwen.*(?:embed|embedding)|(?:embed|embedding).*qwen/i,va=/embed|embedding/i,O=b;function Aa(){let e=O(process.env[ha]);if(!e)return!1;let t=e.toLowerCase();return t==="1"||t==="true"||t==="yes"}function Or(e){return e.some(t=>O(t)!==null)}function Ia(e){let t=O(e);return!!(t&&t.toLowerCase()!=="ollama")}function Ca(e){let t=O(e);return!!(t&&t.toLowerCase()!=="lancedb")}function xa(e){return Ia(e.search?.provider)||Ca(e.vector_store?.adapter)||Or([e.providers?.openai?.base_url,e.providers?.openai?.model,e.providers?.openai?.api_key])?!0:Or([e.vector_store?.qdrant?.url,e.vector_store?.qdrant?.api_key])}function ka(){let e=Lr("ollama",["--version"],{encoding:"utf8",timeout:Ea});return e.error?!1:e.status===0}function Ra(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)return null;let n=t.map(r=>r.split(/\s+/)[0]?.trim()).filter(r=>!!(r&&r.length>0)).filter(r=>r.toUpperCase()!=="NAME");return n.length===0?null:n.find(r=>Ta.test(r))||(n.find(r=>va.test(r))??null)}function Oa(e){let t=O(e.providers?.ollama?.model);if(t)return t;let n=O(process.env[ya]);if(n)return n;let r=Lr("ollama",["list"],{encoding:"utf8",timeout:Sa});if(!r.error&&r.status===0){let o=Ra(typeof r.stdout=="string"?r.stdout:"");if(o)return o}return null}function La(e){return{baseUrl:O(e.providers?.ollama?.base_url)===null,model:O(e.providers?.ollama?.model)===null,lancedbPath:O(e.vector_store?.lancedb?.path)===null,embeddingModel:O(e.search?.embedding_model)===null}}function Da(e){return e.baseUrl||e.model||e.lancedbPath||e.embeddingModel}function Ma(e,t,n){if(!t.baseUrl&&!t.model)return;let r=e.providers??={},o=r.ollama??={};t.baseUrl&&(o.base_url=ga),t.model&&(o.model=n)}function Na(e,t){if(!t.lancedbPath)return;let n=e.vector_store??={},r=n.lancedb??={};r.path=ba}function Pa(e,t,n){if(!t.embeddingModel)return;let r=e.search??={};r.embedding_model=n}function je(e){let t={settings:e,auto_ollama_defaults_applied:!1};if(Aa()||xa(e))return t;let n=La(e);if(!Da(n)||n.model&&!ka())return t;let r=structuredClone(e),o=Oa(r);return o?(Ma(r,n,o),Na(r,n),Pa(r,n,o),{settings:r,auto_ollama_defaults_applied:!0}):{...t,auto_ollama_defaults_skipped_reason:"no_installed_embedding_model",auto_ollama_defaults_remediation:`Run ollama pull ${wa} or configure providers.ollama.model explicitly (and search.embedding_model if you need an override).`}}(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]="9ecff496-8afa-5cfc-9178-2be8bd403978")}catch{}})();var $a="reindex";import jr from"node:path";import{mkdir as za,readFile as Fa,stat as Ht,unlink as Ua}from"node:fs/promises";import{basename as Mr,dirname as Vt,isAbsolute as ja,join as Va,resolve as Yt}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]="4f917418-051d-5458-9080-fa23cd36c4d1")}catch{}})();var Bt="pm_items",qa=/[^a-zA-Z0-9_-]/g,Ha=128,Ya=".pm-cli-local-vectors",qt=1,q=new Map;function me(e){return(b(e.collection_name)??Bt).replaceAll(qa,"_").slice(0,Ha)}function Ve(e){if(!J(e)||e.length===0)throw new Error("Vector values must be a non-empty numeric array");return[...e]}function Pr(e){if(!Number.isFinite(e)||e<=0)throw new Error("Vector query limit must be a positive number");return Math.floor(e)}function Ba(e){let t=e.result;if(!Array.isArray(t))throw new TypeError("Qdrant query response must include a result array");let n=t.map((r,o)=>{let i=r.id,s=typeof i=="number"?String(i):i,a=b(s);if(!a)throw new Error(`Qdrant query response entry at index ${o} is missing a non-empty id`);let c=r.score;if(typeof c!="number"||!Number.isFinite(c))throw new TypeError(`Qdrant query response entry at index ${o} is missing a finite numeric score`);let d=r.payload;if(d!==void 0&&(typeof d!="object"||d===null||Array.isArray(d)))throw new Error(`Qdrant query response entry at index ${o} must provide payload as an object when set`);return{id:a,score:c,...d?{payload:d}:{}}});return n.sort((r,o)=>r.score!==o.score?o.score-r.score:r.id.localeCompare(o.id)),n}function Wt(e){let t=b(e.result?.status);if(t)return{status:t};let n=b(e.status);if(n)return{status:n};throw new Error("Qdrant upsert response must include status metadata")}async function ue(e,t,n,r,o){return await De({endpoint:e,method:t.method,headers:t.headers,body:t.body,timeoutMs:n,fetcher:r,requestLabel:`Vector ${o} request`,responseLabel:`Vector ${o} response`})}function Wa(e){let t=b(e.vector_store?.qdrant?.url);if(!t)return null;let n=b(e.vector_store?.collection_name),r=b(e.vector_store?.qdrant?.api_key);return{name:"qdrant",url:t,...n&&n!==Bt?{collection_name:n}:{},...r?{api_key:r}:{}}}function Ga(e){let t=Yt(e),n=Vt(t);return Mr(t)==="pm"&&Mr(n)===".agents"?Vt(n):t}function Ka(e,t){return!t||ja(e)?e:Yt(Ga(t),e)}function Ja(e,t){let n=b(e.vector_store?.lancedb?.path);if(!n)return null;let r=b(e.vector_store?.collection_name);return{name:"lancedb",path:Ka(n,t),...r&&r!==Bt?{collection_name:r}:{}}}function Xa(e){if(!Array.isArray(e)||e.length===0)throw new Error("Vector upsert records must include at least one entry");return e.map((t,n)=>{let r=b(t.id);if(!r)throw new Error(`Vector upsert record at index ${n} is missing a non-empty id`);let o=Ve(t.vector),i=t.payload;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error(`Vector upsert record at index ${n} must provide payload as an object when set`);return{id:r,vector:o,...i?{payload:i}:{}}})}function Qa(e){if(!Array.isArray(e)||e.length===0)throw new Error("Vector delete ids must include at least one entry");let t=e.map((r,o)=>{let i=b(r);if(!i)throw new Error(`Vector delete id at index ${o} is missing a non-empty value`);return i}).sort((r,o)=>r.localeCompare(o)),n=[];for(let r of t)n.at(-1)!==r&&n.push(r);return n}function Za(e){return e.replace(/\/points\?wait=true$/,"/points/delete?wait=true")}function ec(e){return e.replace(/\/points\?wait=true$/,"")}function qe(e){return{"content-type":"application/json",...e.api_key?{"api-key":e.api_key}:{}}}function He(e,t){return ee(e,t)}function ee(e,t){return Va(Yt(e),Ya,`${t}.json`)}function tc(e,t,n){let r=b(e.id);if(!r)throw new Error(`LanceDB local snapshot '${n}' record at index ${t} is missing a non-empty id`);let o=Ve(e.vector),i=e.payload;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error(`LanceDB local snapshot '${n}' record '${r}' must provide payload as an object when set`);return{id:r,vector:o,...i?{payload:i}:{}}}function nc(e,t,n){let r;try{r=JSON.parse(n)}catch(a){throw new Error(`LanceDB local snapshot at '${e}' is not valid JSON: ${E(a)}`)}if(typeof r!="object"||r===null||Array.isArray(r))throw new Error(`LanceDB local snapshot at '${e}' must be a JSON object`);if(r.version!==qt)throw new Error(`LanceDB local snapshot at '${e}' must include version=${qt}`);let o=b(r.table);if(!o)throw new Error(`LanceDB local snapshot at '${e}' must include a non-empty table value`);if(o!==t)throw new Error(`LanceDB local snapshot at '${e}' table mismatch: expected '${t}', received '${o}'`);let i=r.records;if(!Array.isArray(i))throw new TypeError(`LanceDB local snapshot at '${e}' must include a records array`);let s=new Map;for(let a=0;a<i.length;a+=1){let c=tc(i[a],a,e);s.set(c.id,c)}return s}async function rc(e){try{let t=await Ht(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch(t){if(!K(t))throw t;return null}}function oc(e,t){if(!t)return null;if(t.mtimeMs===null&&t.size===null&&t.records.size===0)return t.records;let n=new Map;return q.set(e,{records:n,mtimeMs:null,size:null}),n}function ic(e,t){return e!==void 0&&t!==null&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function Gt(e,t){let n=He(e,t),r=ee(e,t),o=await rc(r),i=q.get(n);if(!o){let a=oc(n,i);if(a)return a}if(ic(i,o))return i.records;let s=new Map;try{let a=await Fa(r,"utf8");s=nc(r,t,a)}catch(a){if(!K(a))throw a}return q.set(n,{records:s,mtimeMs:o?.mtimeMs??null,size:o?.size??null}),s}function sc(e){let t=[...e.values()];return t.sort((n,r)=>n.id.localeCompare(r.id)),t.map(n=>({id:n.id,vector:[...n.vector],...n.payload?{payload:n.payload}:{}}))}async function $r(e){try{await Ua(e)}catch(t){if(!K(t))throw new Error(`LanceDB local snapshot delete failed at '${e}': ${E(t)}`)}}async function zr(e,t,n){let r=ee(e,t);if(n.size===0){await $r(r);return}let o=Vt(r);try{await za(o,{recursive:!0})}catch(s){throw new Error(`LanceDB local snapshot directory create failed at '${o}': ${E(s)}`)}let i=`${JSON.stringify({version:qt,table:t,records:sc(n)})}
16
+ `;try{await I(r,i)}catch(s){throw new Error(`LanceDB local snapshot write failed at '${r}': ${E(s)}`)}}async function ac(e,t){let n=He(e,t),r=ee(e,t);await $r(r),q.delete(n)}function Nr(e){let t=0;for(let n=0;n<e.length;n+=1)t+=e[n]*e[n];return Math.sqrt(t)}function cc(e,t){let n=0;for(let i=0;i<e.length;i+=1)n+=e[i]*t[i];let r=Nr(e),o=Nr(t);return r===0||o===0?0:n/(r*o)}function Kt(e,t){let n=Wa(e),r=Ja(e,t),o=[n,r].filter(a=>a!==null),i=b(e.vector_store?.adapter),s=i?i.toLowerCase():null;return{active:(s?o.find(a=>a.name===s):void 0)??o[0]??null,available:o}}function Ye(e){let t=me(e);if(e.name==="qdrant"){let o=re(e.url),i=encodeURIComponent(t);return{store:"qdrant",query_target:`${o}/collections/${i}/points/search`,upsert_target:`${o}/collections/${i}/points?wait=true`}}let n=encodeURIComponent(e.path),r=encodeURIComponent(t);return{store:"lancedb",query_target:`lancedb://${n}#${r}`,upsert_target:`lancedb://${n}#${r}`}}function dc(e,t,n){let r=Ye(e),o=Ve(t),i=Pr(n);return e.name==="qdrant"?{target:r,method:"POST",headers:qe(e),body:{vector:o,limit:i,with_payload:!0}}:{target:r,method:"LOCAL",headers:{},body:{table:me(e),vector:o,limit:i}}}function lc(e,t){let n=Ye(e),r=Xa(t);return e.name==="qdrant"?{target:n,method:"POST",headers:qe(e),body:{points:r}}:{target:n,method:"LOCAL",headers:{},body:{table:me(e),records:r}}}function uc(e,t){let n=Ye(e),r=Qa(t);return e.name==="qdrant"?{target:n,method:"POST",headers:qe(e),body:{points:r}}:{target:n,method:"LOCAL",headers:{},body:{table:me(e),ids:r}}}async function vm(e,t,n,r={}){let o=dc(e,t,n);if(o.method==="LOCAL"){let c=e,d=o.body,l=await Gt(c.path,d.table);if(l.size===0)return[];let f=Ve(d.vector),_=Pr(d.limit),h=[],g=0;for(let y of l.values()){if(y.vector.length!==f.length){g++;continue}h.push({id:y.id,score:cc(f,y.vector),...y.payload?{payload:y.payload}:{}})}return g>0&&r.warnings&&r.warnings.push(`vector_dimension_mismatch:${g} records skipped (expected ${f.length} dimensions)`),h.sort((y,p)=>y.score!==p.score?p.score-y.score:y.id.localeCompare(p.id)),h.slice(0,_)}let i=z(r.timeout_ms,"Vector request"),s=F(r.fetcher,"Vector request"),a=await ue(o.target.query_target,{method:"POST",headers:o.headers,body:o.body},i,s,"query");return Ba(a)}async function Jt(e,t,n={}){let r=lc(e,t);if(r.method==="LOCAL"){let a=e,c=r.body,d=He(a.path,c.table),l=await Gt(a.path,c.table);for(let h of c.records)l.set(h.id,h);await zr(a.path,c.table,l);let f=ee(a.path,c.table),_=await Ht(f);return q.set(d,{records:l,mtimeMs:_.mtimeMs,size:_.size}),{status:"ok"}}let o=z(n.timeout_ms,"Vector request"),i=F(n.fetcher,"Vector request"),s=await ue(r.target.upsert_target,{method:"POST",headers:r.headers,body:r.body},o,i,"upsert");return Wt(s)}async function Be(e,t,n={}){let r=uc(e,t);if(r.method==="LOCAL"){let a=e,c=r.body,d=He(a.path,c.table),l=await Gt(a.path,c.table);if(l.size===0)return{status:"ok"};for(let f of c.ids)l.delete(f);if(await zr(a.path,c.table,l),l.size===0)q.delete(d);else{let f=ee(a.path,c.table),_=await Ht(f);q.set(d,{records:l,mtimeMs:_.mtimeMs,size:_.size})}return{status:"ok"}}let o=z(n.timeout_ms,"Vector request"),i=F(n.fetcher,"Vector request"),s=await ue(Za(r.target.upsert_target),{method:"POST",headers:r.headers,body:r.body},o,i,"delete");return Wt(s)}async function Fr(e,t=[],n={},r){if(e.name==="lancedb")return await ac(e.path,me(e)),{status:"ok"};if(r!==void 0){if(!Number.isInteger(r)||r<=0)throw new Error("Vector reset dimension must be a positive integer when provided");let i=Ye(e),s=ec(i.upsert_target),a=z(n.timeout_ms,"Vector request"),c=F(n.fetcher,"Vector request"),d=qe(e);try{await ue(s,{method:"DELETE",headers:d,body:{}},a,c,"delete")}catch(f){if(!E(f).includes("failed with status 404"))throw f}let l=await ue(s,{method:"PUT",headers:d,body:{vectors:{size:r,distance:"Cosine"}}},a,c,"upsert");return Wt(l)}let o=t.map(i=>i.trim()).filter(i=>i.length>0);return o.length===0?{status:"ok"}:await Be(e,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]="f8acaac5-64f7-5e22-987e-4eb12a1aa1cf")}catch{}})();function We(e,t){let n=b(e),r=b(t);return!n||!r?null:{provider:n,model:r}}function Ur(e){if(e==null)return null;if(typeof e!="object"||Array.isArray(e))throw new Error("Vectorization embedding metadata must be an object when set");let t=We(e.provider,e.model),n=e.vector_dimension;if(!t||typeof n!="number"||!Number.isInteger(n)||n<=0)throw new Error("Vectorization embedding metadata must include provider, model, and positive vector_dimension");return{...t,vector_dimension:n}}function Xt(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("Vectorization embedding metadata requires a positive vector dimension");return{provider:e.provider,model:e.model,vector_dimension:t}}function Qt(e,t){return!e||e.provider!==t.provider||e.model!==t.model}function Zt(e,t){return!!(e&&e.vector_dimension!==t)}function en(e,t){if(e.length===0)throw new Error(`${t} returned no vectors`);let n=e[0].length;if(!Number.isInteger(n)||n<=0)throw new Error(`${t} returned an empty vector`);for(let r=1;r<e.length;r+=1)if(e[r]?.length!==n)throw new Error(`${t} returned mixed vector dimensions`);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]="7113dff5-c8e0-5ba6-b0ae-2ff849ed94df")}catch{}})();var Vr="search/vectorization-status.json";function pe(e){return[...new Set([...e].map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function qr(e){return typeof e=="string"&&e.trim().length>0&&Number.isFinite(Date.parse(e))}function Hr(e){let t=new Map;for(let[n,r]of Object.entries(e)){let o=n.trim();o.length===0||!qr(r)||t.set(o,r)}return Object.fromEntries([...t.entries()].sort((n,r)=>n[0].localeCompare(r[0])))}async function Yr(e){let t=jr.join(e,Vr),n=await T(t);if(n===null||n.trim().length===0)return{entries:{},embedding:null,warnings:[]};let r;try{r=JSON.parse(n)}catch{return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]}}if(typeof r!="object"||r===null||r.version!==1||!Array.isArray(r.items))return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};let o=new Map;for(let s of r.items){if(typeof s!="object"||s===null)return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};let a=s.id,c=s.updated_at;if(typeof a!="string"||a.trim().length===0||!qr(c))return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};o.set(a.trim(),c)}let i=null;try{i=Ur(r.embedding)}catch{return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]}}return{entries:Object.fromEntries([...o.entries()].sort((s,a)=>s[0].localeCompare(a[0]))),embedding:i,warnings:[]}}async function Br(e,t,n){let r=Hr(t),o=jr.join(e,Vr),i=`${JSON.stringify({version:1,generated_at:M(),...n?{embedding:n}:{},items:Object.entries(r).map(([s,a])=>({id:s,updated_at:a}))},null,2)}
17
+ `;await I(o,i)}function mc(e){return{id:e.id,type:e.type,status:e.status,priority:e.priority,updated_at:e.updated_at}}function fc(e){let t=We(e.name,e.model);if(!t)throw new Error("Embedding provider must include a provider name and model");return t}function fe(e,t){return{refreshed:[],skipped:e,warnings:[t]}}async function pc(e,t,n){if(!n.settings&&!await G(X(e)))return fe(t,"search_semantic_refresh_skipped:settings_not_initialized");let r;try{if(n.settings)r=n.settings;else{let a=await Ie(e),c=a.warnings.find(d=>d.startsWith("settings_read_"));if(c)return fe(t,`search_semantic_refresh_skipped:settings_read_failed:${c}`);r=a.settings}}catch(a){return fe(t,`search_semantic_refresh_skipped:settings_read_failed:${E(a)}`)}let o=n.apply_runtime_defaults?je(r).settings:r,i=Ct(o).active;if(!i)return fe(t,"search_semantic_refresh_skipped:provider_unconfigured");let s=Kt(o,e).active;return s?{settings:o,provider:i,vectorStore:s}:fe(t,"search_semantic_refresh_skipped:vector_store_unconfigured")}async function _c(e,t,n,r,o,i){let s=[],a=new Set,c=new Set,d=[];for(let l of r){let f=await bt(e,l,t,n,o);if(!f){c.add(l);continue}try{let _=await Et(f,{schema:i});d.push({id:_.document.metadata.id,document:_.document})}catch(_){a.add(f.id),s.push(`search_semantic_refresh_item_read_failed:${f.id}:${E(_)}`)}}return d.sort((l,f)=>l.id.localeCompare(f.id)),{documents:d,missingIds:pe(c),skippedIds:pe(a),warnings:s}}async function hc(e,t,n){let r=Z(t.name,e.search.embedding_corpus_max_characters).maxCharacters,o=kt(e),i=n.map(a=>Rt(a.document,{providerName:t.name,maxCharacters:r,fields:o})),s=await Lt(t,e,i);return{vectors:s.vectors,vector_dimension:en(s.vectors,"Semantic refresh embedding"),warnings:s.warnings}}async function yc(e,t,n){return await Jt(e,t.map((r,o)=>({id:r.id,vector:n[o],payload:mc(r.document.metadata)}))),{refreshed:t.map(r=>r.id),skipped:[],warnings:[]}}async function gc(e,t){if(t.length===0)return{refreshed:[],skipped:[],warnings:[]};try{return await Be(e,t),{refreshed:[],skipped:[],warnings:[]}}catch(n){return{refreshed:[],skipped:t,warnings:[`search_semantic_refresh_delete_failed:${E(n)}`]}}}async function Ym(e,t,n={}){let r=pe(t);if(r.length===0)return{refreshed:[],skipped:[],warnings:[]};let o=await pc(e,r,n);if(!("settings"in o))return o;let i=dt(o.settings,ut()),s=await _c(e,o.settings.id_prefix,o.settings.item_format,r,i.type_to_folder,o.settings.schema),a=s.documents.length>0||s.missingIds.length>0?await Yr(e):{entries:{},embedding:null,warnings:[]},c=fc(o.provider),d=a.entries,l={refreshed:[],skipped:[],warnings:[]},f=a.embedding;if(s.documents.length>0)if(a.embedding&&Qt(a.embedding,c))l={refreshed:[],skipped:s.documents.map(p=>p.id),warnings:["search_semantic_refresh_requires_reindex:embedding_identity_changed"]};else try{let p=await hc(o.settings,o.provider,s.documents);if(Zt(a.embedding,p.vector_dimension))l={refreshed:[],skipped:s.documents.map(w=>w.id),warnings:[...p.warnings,"search_semantic_refresh_requires_reindex:vector_dimension_changed"]};else{f=Xt(c,p.vector_dimension);let w=await yc(o.vectorStore,s.documents,p.vectors);l={refreshed:w.refreshed,skipped:w.skipped,warnings:[...p.warnings,...w.warnings]}}}catch(p){l={refreshed:[],skipped:s.documents.map(w=>w.id),warnings:[`search_semantic_refresh_failed:${E(p)}`]}}let _=await gc(o.vectorStore,s.missingIds),h=new Set(l.refreshed),g=Object.fromEntries(s.documents.filter(p=>h.has(p.id)).map(p=>[p.id,p.document.metadata.updated_at])),y=[];if(Object.keys(g).length>0||s.missingIds.length>0){let p={...d,...Hr(g)};for(let w of s.missingIds)delete p[w];try{await Br(e,p,f)}catch(w){y.push(`search_vectorization_status_ledger_write_failed:${E(w)}`)}y.push(...a.warnings)}return{refreshed:pe([...l.refreshed,..._.refreshed]),skipped:pe([...s.skippedIds,...l.skipped,..._.skipped]),warnings:[...s.warnings,...l.warnings,..._.warnings,...y]}}import{createRequire as Ic}from"node:module";import{createHash as wc}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]="225abd7e-ddd7-5597-818d-efadc974b7e3")}catch{}})();var bc=new Set(["1","true","yes","on"]),tn=["user","automation","test","dogfood"],Ec=new Set(tn);function Wr(e=process.env){return typeof e.VITEST=="string"||typeof e.VITEST_WORKER_ID=="string"||typeof e.NODE_TEST_CONTEXT=="string"||(e.NODE_ENV??"").trim().toLowerCase()==="test"}function Ge(e,t){return bc.has((t[e]??"").trim().toLowerCase())}function A(e=process.env){let t=(e.PM_TELEMETRY_ENDPOINT??"").trim(),n=URL.canParse(t)?new URL(t).protocol:"";return n==="http:"||n==="https:"?{endpoint:t,invalid:!1}:{endpoint:null,invalid:t.length>0}}function _e(e,t=A().endpoint){if(t===null)return e;let n=wc("sha256").update(t).digest("hex").slice(0,16);return e.replace(/\.(jsonl|json)$/u,`.${n}.$1`)}function Sc(e){return e.replaceAll(/(\/\/)[^/?#\s]*@/gu,"$1")}function Ke(e){let t=e.trim();if(!URL.canParse(t))return Sc(t).replace(/[?#].*$/su,"");let n=new URL(t);return n.username="",n.password="",n.search="",n.hash="",n.toString()}function Je(e){return e.replaceAll(/\b[a-z][a-z\d+.-]*:\/\/[^\s"'<>]+/giu,t=>Ke(t))}function Gm(e,t=process.env){return A(t).endpoint??e}function he(e=process.env){let t=Ge("DO_NOT_TRACK",e),n=A(e),r=(e.PM_TELEMETRY_SOURCE_CONTEXT??"").trim().toLowerCase(),o=Wr(e)&&!Ec.has(r)&&!Ge("PM_TELEMETRY_SEND_TEST_EVENTS",e);return{telemetry_disabled:t||o||n.invalid||Ge("PM_TELEMETRY_DISABLED",e)||Ge("PM_NO_TELEMETRY",e),do_not_track:t,test_suppressed:o,endpoint_override:n.endpoint===null?null:Ke(n.endpoint),endpoint_override_invalid:n.invalid}}(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]="64589e00-25ef-5d74-a94a-7d40455e1929")}catch{}})();var Kr=/(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|credentials|bearer|dsn)/i,Jm=new RegExp(`(?:\\b|(?<=_))(${Kr.source})\\s*[:=]\\s*([^\\s,;]+)`,"giu");var Gr="(?:\\s|\\\\+u(?:0009|000a|000d|0020))*",Xm=new RegExp("^"+Gr+"(?::|=|\\\\+u(?:003a|003d))"+Gr,"iu");(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]="85813255-48e1-5b53-913e-27d433c3ff45")}catch{}})();var df=Ic(import.meta.url);(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]="9e8ad404-2f8d-5d9b-9046-60178a70e5b2")}catch{}})();var Xe=class extends m{constructor(t,n,r){super(t,u.GENERIC_FAILURE,n),this.name="ExtensionCommandError",Object.defineProperty(this,"cause",{value:r,configurable:!0,writable:!0})}};function ff(e,t){let n=t.warnings[0]??"extension_command_handler_failed",r=t.errorMessage?.trim();return new Xe(`Command "${e}" failed in extension handler (${n}).${r?` ${r}`:""}`,{code:t.errorCode??"command_failed",nextSteps:t.remediation?[t.remediation]:void 0},t.cause)}function pf(e){return e instanceof m||e instanceof Error?e.message:"Unknown failure"}(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]="bd65294f-dfa5-53d2-9691-c630884f2a5f")}catch{}})();var yf=new Map([[u.USAGE,"invalid_command_usage"],[u.NOT_FOUND,"item_not_found"],[u.CONFLICT,"lock_conflict"],[u.DEPENDENCY_FAILED,"dependency_failed"]]);(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]="10325dfb-128f-5d83-9163-061d8d8b29b6")}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]="ab644545-f072-53c0-9ebf-72a62c237a2f")}catch{}})();var xf=Object.freeze({"&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&amp;":"&"});(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]="e7deff0d-d9c9-5250-b172-ab752ddd64a4")}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]="bc9e1b59-21cb-5dda-91c0-36e123734cd3")}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]="4b566486-120f-5aed-8d92-9e62ed996210")}catch{}})();function xc(e,t){if(e==null)return[];let n=t?.separators??/,/,r=e.split(n).map(i=>i.trim()).filter(i=>i.length>0),o=t?.unique!==!1?Array.from(new Set(r)):r;return t?.sort===!0?[...o].sort():o}import nn from"node:fs/promises";import Qe 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]="12ee7de1-dff4-53f1-8d0d-d8b1c1ebea42")}catch{}})();function kc(e){return"json_markdown"}function Qr(e,t){return Qe.relative(e,t).replaceAll("\\","/")}function Rc(e){return String(e).replaceAll(/[^a-zA-Z0-9._-]+/g,"_").slice(0,120)}async function Oc(e,t,n){e!==t&&Ee(await nn.readFile(t,"utf8"),{format:"json_markdown",requireSupportedFormat:!0,schema:n})}async function Lc(e,t,n="item_format:migrate",r=at,o){if(t!=="toon")throw new Error("Only toon item-format migration targets are supported. Markdown item files are legacy read-only input.");let i=new Set,s=new Set,a=[],c=0,d=kc(t),l=Object.entries(r);for(let[f,_]of l){let h=Qe.join(e,_),g=[];try{g=await nn.readdir(h)}catch{continue}let y=new Map;for(let w of g){let C=Qe.join(h,w),L=gn(C);if(!L)continue;let B=Qe.extname(w),te=w.slice(0,w.length-B.length).trim();if(te.length===0)continue;let W=y.get(te)??{};W[L]=C,y.set(te,W)}let p=[...y.keys()].sort((w,C)=>w.localeCompare(C));for(let w of p){let C=y.get(w);c+=1;let L=C[d];if(!L)continue;let B=C[t]??L,te=B===C[t]?t:d;try{let W=await nn.readFile(B,"utf8"),Po=Ee(W,{format:te,requireSupportedFormat:!0,schema:o,onWarning:$o=>a.push(`item_format_migration_parse_warning:${w}:${$o}`)});await Oc(B,L,o);let it=lt(e,f,w,t,r),_n=ht(Po,{format:t,schema:o});await T(it)!==_n&&(await I(it,_n),a.push(...await Q({path:it,scope:"project",op:n})),i.add(w)),await ge(L),s.add(Qr(e,L)),a.push(...await Q({path:L,scope:"project",op:`${n}:remove`})),i.add(w)}catch(W){a.push(`item_format_migration_skipped:${Qr(e,B)}:${Rc(W)}`)}}}return{target_format:t,scanned:c,migrated:[...i].sort((f,_)=>f.localeCompare(_)),removed:[...s].sort((f,_)=>f.localeCompare(_)),warnings:a}}(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]="12c59406-7e00-5fe1-bd93-c1f9d8537f01")}catch{}})();var Dc=new Set(["completed","superseded"]);function Mc(e){return e!==void 0&&Dc.has(e)}function Nc(e){if(e.type.trim().toLowerCase()!=="plan")return!1;let t=e.plan_steps??[];return t.length>0&&t.every(n=>n.status==="completed")}import{createHash as Pc}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]="7cbbb50d-e9bc-5940-9ae6-6270e9c2fcbf")}catch{}})();var $c=/^[a-z][a-z0-9_-]{0,63}$/u,zc=new Set(["constructor","prototype"]),Zr="settings:section:write",Fc=240;function Ze(e){return`sha256:${Pc("sha256").update(rn(e)).digest("hex")}`}function rn(e){return Array.isArray(e)?`[${e.map(t=>rn(t)).join(",")}]`:typeof e=="object"&&e!==null?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${rn(Object.getOwnPropertyDescriptor(e,t)?.value)}`).join(",")}}`:String(JSON.stringify(e))}function to(e){if(!$c.test(e)||zc.has(e))throw new m(`Invalid settings section name "${e.slice(0,80)}". Use 1-64 lowercase letters, digits, underscores or hyphens, starting with a letter.`,u.USAGE,{code:"settings_section_name_invalid",field:"section",required:"Name the section after the package, for example lint or jev."});if(In.includes(e))throw new m(`Settings section "${e}" is owned by core settings; extension sections must use another name.`,u.USAGE,{code:"settings_section_reserved",field:"section",value:e,required:"Read core settings with readSettings and change them with writeSettings or pm config."})}function no(e){let t;try{t=JSON.parse(e)}catch{t=void 0}if(typeof t!="object"||t===null||Array.isArray(t))throw new m("settings.json is not a JSON object, so no settings section can be read or written.",u.USAGE,{code:"settings_section_document_malformed",reason:t===void 0?"settings_json_malformed":"settings_json_not_object",nextSteps:["Repair .agents/pm/settings.json so it is a JSON object, then retry.","Run pm health to confirm the settings warning has cleared."]});return t}function on(e,t,n){let r;try{r=n===void 0?t:n(t)}catch(o){throw new m(`Settings section "${e}" is invalid: ${E(o).slice(0,Fc)}`,u.USAGE,{code:"settings_section_invalid",field:e,required:`Fix the "${e}" section of .agents/pm/settings.json so the owning package accepts it, then retry.`})}return r}function ro(e){return typeof Reflect.get(e,"toJSON")=="function"}function sn(e){return e.length===0?"the value":e.join(".")}function oo(e,t){return Object.values(Object.getOwnPropertyDescriptors(e)).every(n=>"value"in n&&(!t||n.enumerable===!0))}function Uc(e){if(Object.getPrototypeOf(e)!==Array.prototype||!oo(e,!1))return!1;let t=Object.keys(e);return t.length===e.length&&t.every((n,r)=>n===String(r))&&Object.getOwnPropertyNames(e).length===e.length+1&&Object.getOwnPropertySymbols(e).length===0&&!ro(e)}function jc(e){let t=Object.getPrototypeOf(e);return(t===Object.prototype||t===null)&&oo(e,!0)&&Object.getOwnPropertySymbols(e).length===0&&!ro(e)}function Vc(e,t){if(e===null||typeof e=="string"||typeof e=="boolean")return null;let n=sn(t);return typeof e=="number"?Number.isFinite(e)?null:{detail:`${n} is a non-finite number`,representable:!0}:{detail:`${n} is ${typeof e}`,representable:typeof e!="bigint"&&t.length>0}}function io(e,t=[],n=new Set){if(typeof e!="object"||e===null)return Vc(e,t);let r=sn(t);if(n.has(e))return{detail:`${r} is a circular reference`,representable:!1};if(!(Array.isArray(e)?Uc(e):jc(e)))return{detail:`${r} is not a plain JSON ${Array.isArray(e)?"array":"object"}`,representable:!0};n.add(e);for(let[o,i]of Object.entries(e)){let s=io(i,[...t,o],n);if(s!==null)return s}return n.delete(e),null}function so(e,t=[]){if(typeof e!="object"||e===null)return null;for(let[n,r]of Object.entries(e)){let o=[...t,n];if(n==="__proto__"||n==="prototype"&&t.at(-1)==="constructor")return sn(o);let i=so(r,o);if(i!==null)return i}return null}function eo(e,t,n){return on(e,t,()=>{throw new Error(n)})}function qc(e,t){let n=io(t);if(n!==null){let o=n.representable?`the value would change when stored as JSON: ${n.detail}`:`the value is not representable as JSON: ${n.detail}`;return eo(e,t,o)}let r=so(t);return r!==null?eo(e,t,`${r} is a reserved key that settings history cannot record`):JSON.parse(JSON.stringify(t))}function ao(e,t){return Object.hasOwn(e,t)?e[t]:void 0}async function Hc(e,t,n={}){to(t);let r=X(e);await mt({path:r,scope:"project"});let o=await T(r),i=o===null?void 0:ao(no(o),t);if(i===void 0)return{section:t,source:"default",value:n.defaultValue,revision:null};let s=Ze(i);return{section:t,source:"stored",value:on(t,structuredClone(i),n.validate),revision:s}}async function Yc(e,t,n,r={}){to(t);let o=n===void 0?void 0:qc(t,on(t,n,r.validate)),i=X(e),s=await P(e);try{let a=await gt({pmRoot:e,filePath:i,op:Zr,author:Se(r.author,s.author_default),lockTtlSeconds:s.locks.ttl_seconds,lockWaitMs:s.locks.wait_ms,recordCreation:!1,mutate:c=>{if(c===null)throw new m("settings.json does not exist, so no settings section can be written.",u.NOT_FOUND,{code:"settings_section_document_missing",required:"Initialize the tracker with pm init, then retry."});let d=no(c),l=ao(d,t),f=l===void 0?null:Ze(l);if(r.expectedRevision!==void 0&&r.expectedRevision!==f)throw new m(`Settings section "${t}" changed since it was read; read it again and reapply the change.`,u.CONFLICT,{code:"settings_section_revision_conflict",field:t,expected_revision:r.expectedRevision,current_revision:f,required:"Read the section again with readSettingsSection, then retry with its current revision."});let _={section:t,changed:!1,previous_revision:f,revision:o===void 0?null:Ze(o)};return ie(l,o)?{raw:c,result:_}:(o===void 0?delete d[t]:d[t]=o,{raw:`${JSON.stringify(d,null,2)}
18
+ `,result:{..._,changed:!0}})}});return a.changed&&await Q({path:i,scope:"project",op:Zr}),a.result}finally{ve(e)}}import rp from"node:readline/promises";(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]="88db9929-8e1d-56ad-9a5f-6cc0febadfb3")}catch{}})();import ln from"node:crypto";import{mkdirSync as Ep,rmSync as Gc,statSync as Sp}from"node:fs";import{mkdir as an,readdir as Kc,rm as un,stat as _o}from"node:fs/promises";import{request as Jc}from"node:http";import{request as Xc}from"node:https";import v 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]="4f455b67-536a-59be-8f25-1dc9c9c0b917")}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]="6ca73b84-5485-515a-a836-7fcce9851fb6")}catch{}})();var Qc=v.join("runtime","telemetry","events.jsonl"),Zc=v.join("runtime","telemetry","state.json"),ed=v.join("runtime","telemetry","otel-spans.jsonl"),td=8,co=500,nd=1;var rd=100,od=36e5,id=3e4,lo=2e4,sd=1e3,ad=25e3;var cd=864e5,ho=65536;var yo=15;var go=[25,50,100,200],dd=3600*1e3,ld=1440*60*1e3,ud=6e4;var H="PM_TELEMETRY_FLUSH_CHILD",md="PM_TELEMETRY_HTTP_TIMEOUT_MS",fd=globalThis.fetch;var Vp=Promise.resolve(),uo=Promise.resolve();var pd=new Set(["1","true","yes","on"]);var qp=ln.randomUUID();var wo="(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|session|credentials|bearer|literals?|regex(?:es)?|replacements?)",_d=new RegExp(`\\b(${wo})\\s*([:=])\\s*([^\\s,;]+)`,"giu"),hd=new RegExp(`(--${wo})(=|\\s+)([^\\s,;]+)`,"giu"),yd=/(^|[\s"'`(=])\/(?:[^\s"'`),;]+)/g,gd=/bearer\s+[a-z0-9._=-]+/giu,wd=/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g;function tt(e,t=A().endpoint){return v.join(v.dirname(v.join(e,Qc)),_e("events.jsonl",t))}function nt(e){return v.join(e,ed)}function bd(e){return v.dirname(tt(e,null))}function bo(e,t=A().endpoint){return v.join(v.dirname(v.join(e,Zc)),_e("state.json",t))}function Eo(e){return v.join(e,"runtime","telemetry","flush.lock")}function Ed(e){return v.join(e,"runtime","telemetry","flush.spawn.lock")}async function Sd(e,t=A().endpoint){let n=await T(bo(e,t));if(!n||n.trim().length===0)return{};try{let r=JSON.parse(n);return typeof r!="object"||r===null||Array.isArray(r)?{}:r}catch{return{}}}async function et(e,t,n=A().endpoint){try{await ye(async()=>{let r={...await Sd(e,n),...t},o=Object.fromEntries(Object.entries(r).filter(([,i])=>i!==void 0).sort((i,s)=>i[0].localeCompare(s[0])));await I(bo(e,n),`${JSON.stringify(o,null,2)}
19
+ `,{createParentDirectories:!Y(process.env[H])})},e)}catch{}}function So(e){return e.replaceAll(_d,(t,n,r)=>`${n}${r}[redacted]`).replaceAll(hd,(t,n,r)=>`${n}${r}[redacted]`)}function To(e){return e.replaceAll(yd,(t,n)=>`${n}[redacted_path]`)}function vo(e){let t=e>=65&&e<=90,n=e>=97&&e<=122,r=e>=48&&e<=57;return t||n||r}function Ao(e){if(!e)return!1;let t=e.charCodeAt(0);return vo(t)?!0:e==="."||e==="_"||e==="%"||e==="+"||e==="-"}function Io(e){if(!e)return!1;let t=e.charCodeAt(0);return vo(t)?!0:e==="."||e==="-"}function Td(e){let t=e.indexOf("@");if(t<=0||t!==e.lastIndexOf("@")||t===e.length-1)return!1;let n=e.slice(0,t),r=e.slice(t+1),o=r.lastIndexOf(".");if(o<=0||o===r.length-1||r.length-(o+1)<2)return!1;for(let i of n)if(!Ao(i))return!1;for(let i of r)if(!Io(i))return!1;return!0}function vd(e){let t="",n=0;for(;n<e.length;){let r=e.indexOf("@",n);if(r<0){t+=e.slice(n);break}let o=r-1;for(;o>=n&&Ao(e[o]);)o-=1;o+=1;let i=r+1;for(;i<e.length&&Io(e[i]);)i+=1;let s=e.slice(o,i);if(Td(s)){t+=e.slice(n,o),t+="[redacted_email]",n=i;continue}t+=e.slice(n,r+1),n=r+1}return t}function Co(e){return vd(ft(e)).replaceAll(gd,"bearer [redacted_token]").replaceAll(wd,"[redacted_ip]")}function Ad(e){let t=Co(e),n=So(t),r=To(n),o=r.trim();return o.startsWith("/")&&o.length>1?"[redacted_path]":r.length>512?`${r.slice(0,509)}...`:r}function Id(e){let t=Co(e),n=So(t),r=To(n),o=r.trim();return o.startsWith("/")&&o.length>1?"[redacted_path]":r.length>2048?`${r.slice(0,2045)}...`:r}function dn(e,t="redacted"){return t==="max"?Id(e):Ad(e)}function Cd(e){let t=e?.trim().toLowerCase();return t==="minimal"||t==="redacted"||t==="max"?t:"redacted"}function Y(e){return pd.has((e??"").trim().toLowerCase())}function mo(){let e=process.env[md]?.trim();if(!e)return lo;let t=Number(e);return Number.isFinite(t)?Math.min(ad,Math.max(sd,Math.trunc(t))):lo}async function xo(e,t,n){let r=new URL(e);if(globalThis.fetch!==fd){let i=new AbortController,s,a=new Promise((c,d)=>{s=setTimeout(()=>{i.abort(),d(new Error("telemetry_http_timeout"))},mo())});try{return(await Promise.race([globalThis.fetch(e,{method:"POST",headers:t,body:n,signal:i.signal}),a])).status}finally{clearTimeout(s)}}let o=r.protocol==="https:"?Xc:r.protocol==="http:"?Jc:void 0;if(!o)throw new Error(`telemetry_http_protocol_unsupported_${r.protocol}`);return new Promise((i,s)=>{let a=mo(),c={method:"POST",headers:{...t,"content-length":Buffer.byteLength(n)},signal:AbortSignal.timeout(a),autoSelectFamilyAttemptTimeout:Math.min(5e3,a)},d=o(r,c,l=>{l.once("error",s),l.once("end",()=>i(l.statusCode)),l.resume()});d.once("error",s),d.end(n)})}async function xd(e){let t=await P(e);if(!t.telemetry.enabled||he().telemetry_disabled)return null;if(t.telemetry.installation_id.trim().length===0){if(Cn(e)||Ae(t))return null;t.telemetry.installation_id=ln.randomUUID(),await Ce(e,t,"telemetry:install_id")}return{installationId:t.telemetry.installation_id,endpoint:t.telemetry.endpoint,retentionDays:Math.max(1,Math.trunc(t.telemetry.retention_days)),captureLevel:Cd(t.telemetry.capture_level)}}function ko(e){let t=[];for(let n of e.split(`
20
+ `)){let r=n.trim();if(r.length!==0)try{let o=JSON.parse(r);o&&typeof o=="object"&&o.event&&typeof o.event=="object"&&typeof o.attempts=="number"&&(o.client_schema_version===void 0||typeof o.client_schema_version=="number"&&Number.isFinite(o.client_schema_version))&&t.push(o)}catch{}}return t}function Ro(e){let t=Math.min(id*2**Math.max(e-1,0),od);return new Date(Date.now()+t).toISOString()}function mn(e){if(typeof e!="string"||e.trim().length===0)return!0;let t=Date.parse(e);return Number.isNaN(t)?!0:t<=Date.now()}function Oo(e){return mn(e.next_attempt_after)}function Lo(e){let t=Number.isFinite(e)?Math.max(1,Math.trunc(e)):1;return Date.now()-t*cd}function kd(e,t){let n=e.event?.occurred_at;if(typeof n!="string"||n.trim().length===0)return!1;let r=Date.parse(n);return Number.isNaN(r)?!1:r<t}function rt(e,t){let n=Lo(t),r=[],o=0;for(let i of e){if(JSON.stringify(i).length>ho||kd(i,n)||i.attempts>=yo){o+=1;continue}r.push(i)}return{entries:r,prunedCount:o}}async function Do(e,t,n=A().endpoint){let r=t.map(i=>JSON.stringify(i)).join(`
21
+ `),o=r.length>0?`${r}
22
+ `:"";for(let i=0;;i+=1)try{await I(tt(e,n),o,{createParentDirectories:!Y(process.env[H])});return}catch(s){let a=go[i];if(a===void 0||!Mo(s))throw s;await No(a)}}function Mo(e){if(typeof e!="object"||e===null||!("code"in e))return!1;let t=e.code;return t==="EACCES"||t==="EBUSY"||t==="EPERM"}function No(e){return new Promise(t=>{setTimeout(t,e)})}function Rd(e){let t=JSON.stringify([e.endpoint,e.enqueued_at,e.payload]);return ln.createHash("sha256").update(t).digest("hex").slice(0,32)}function fn(e){let t=[];for(let n of e.split(`
23
+ `)){let r=n.trim();if(r.length!==0)try{let o=JSON.parse(r);o&&typeof o=="object"&&typeof o.endpoint=="string"&&o.endpoint.trim().length>0&&"payload"in o&&typeof o.attempts=="number"&&Number.isFinite(o.attempts)&&((typeof o.id!="string"||o.id.length===0)&&(o.id=Rd(o)),t.push(o))}catch{}}return t}function Od(e,t){if(typeof e.enqueued_at!="string"||e.enqueued_at.trim().length===0)return!1;let n=Date.parse(e.enqueued_at);return Number.isNaN(n)?!1:n<t}function pn(e,t){let n=Lo(t),r=[],o=0;for(let i of e){if(JSON.stringify(i).length>ho||Od(i,n)||i.attempts>=yo){o+=1;continue}r.push(i)}if(r.length>co){let i=r.length-co;return o+=i,{entries:r.slice(i),prunedCount:o}}return{entries:r,prunedCount:o}}async function Ld(e,t){let n=t.map(o=>JSON.stringify(o)).join(`
24
+ `),r=n.length>0?`${n}
25
+ `:"";for(let o=0;;o+=1)try{await I(nt(e),r,{createParentDirectories:!Y(process.env[H])});return}catch(i){let s=go[o];if(s===void 0||!Mo(i))throw i;await No(s)}}async function fo(e,t,n,r){return ye(async()=>{let o=await T(nt(e)),i=o===null?[]:fn(o),s=[];for(let c of i){if(n.has(c.id))continue;let d=r.get(c.id);s.push(d?{...c,attempts:d.attempts,next_attempt_after:d.next_attempt_after}:c)}let{entries:a}=pn(s,t);return await Ld(e,a),a.length},e)}async function Dd(e,t){let n=await T(nt(e));if(n===null||n.trim().length===0){await et(e,{pending_otel_spans:0},null);return}let r=fn(n),{entries:o,prunedCount:i}=pn(r,t),s=o.filter(g=>mn(g.next_attempt_after)).slice(0,td);if(s.length===0){let g=i>0?await fo(e,t,new Set,new Map):o.length;await et(e,{pending_otel_spans:g},null);return}let a=M(),c=new Set,d=new Map,l=0,f;await Promise.all(s.map(async g=>{try{let y=await xo(g.endpoint,{"content-type":"application/json"},JSON.stringify(g.payload));if(y<200||y>=300)throw new Error(`local_otel_export_http_${y}`);c.add(g.id),l+=1}catch(y){f=y instanceof Error?dn(Je(y.message),"redacted"):"local_otel_export_failed";let p=g.attempts+1;d.set(g.id,{attempts:p,next_attempt_after:Ro(p)})}}));let _=await fo(e,t,c,d),h={pending_otel_spans:_,last_otel_attempt_at:a};l>0&&(h.last_otel_success_at=a),f!==void 0?(h.last_otel_failure_at=a,h.last_otel_failure_error=f):_===0&&(h.last_otel_failure_at=void 0,h.last_otel_failure_error=void 0),await et(e,h,null)}async function Md(e,t,n){try{await zd(e,t,n)}catch{}try{await Dd(e,n)}catch{}}async function Nd(e,t=dd,n=A().endpoint){try{let r=bd(e),o=await Kc(r,{withFileTypes:!0}),i=Date.now(),s=new Set([_e("events.jsonl",n),_e("state.json",n)]),a=c=>{if(!s.has(c))return/^\.events(?:\.[a-f0-9]{16})?\.jsonl\.\d+\.\d+\.[a-f0-9]+\.tmp$/.test(c)?i-Math.max(0,t):/^(?:events\.[a-f0-9]{16}\.jsonl|state\.[a-f0-9]{16}\.json)$/.test(c)?i-ld:void 0};await Promise.all(o.map(async c=>{let d=c.isFile()?a(c.name):void 0;if(d===void 0)return;let l=v.join(r,c.name);(await _o(l)).mtimeMs<d&&await un(l,{force:!0})}))}catch{}}async function ye(e,t=oe(process.cwd()),n=5e3){let r=uo.catch(()=>{}).then(()=>En(async()=>{let o=await be(t,"telemetry-queue",60,"telemetry",!1,!1,n,{createParentDirectories:!Y(process.env[H])});try{return ve(t),await e()}finally{await o()}}));return uo=r.catch(()=>{}),r}async function ot(e,t=A().endpoint){let n=await T(tt(e,t));return n===null||n.trim().length===0?[]:ko(n)}async function cn(e,t,n,r=A().endpoint){return ye(async()=>{let o=await ot(e,r),{entries:i}=rt(o,n),s=i.filter(a=>!t.has(a.event.event_id));return await Do(e,s,r),s},e)}async function Pd(e,t,n,r,o=A().endpoint){return ye(async()=>{let i=await ot(e,o),{entries:s}=rt(i,r),a=s.map(c=>{if(!t.has(c.event.event_id))return c;let d=c.attempts+1;return{...c,attempts:d,last_attempt_at:n,next_attempt_after:Ro(d)}});return await Do(e,a,o),a},e)}function $d(e,t){return t===null?e:Ke(e)}async function zd(e,t,n){let r=A().endpoint;await Nd(e,void 0,r);let o=(r??t).trim(),i=$d(o,r),s=p=>et(e,p,r);if(o.length===0)return;let a=await T(tt(e,r));if(a===null||a.trim().length===0){await s({endpoint:i,queue_entries:0});return}let c=ko(a);if(c.length===0){await s({endpoint:i,queue_entries:0});return}let{entries:d,prunedCount:l}=rt(c,n);if(d.length===0){let p=await cn(e,new Set,n,r);await s({endpoint:i,queue_entries:p.length});return}let f=d.filter(p=>Oo(p)).slice(0,rd);if(f.length===0){let p=l>0?await cn(e,new Set,n,r):d;await s({endpoint:i,queue_entries:p.length});return}let _=new Set(f.map(p=>p.event.event_id)),h=M(),g={"content-type":"application/json"},y=process.env.PM_TELEMETRY_INGEST_KEY?.trim();y&&(g["x-pm-telemetry-key"]=y);try{let p=await xo(o,g,JSON.stringify({schema_version:nd,events:f.map(w=>w.event)}));if(p<200||p>=300)throw new Error(`telemetry_flush_http_${p}`)}catch(p){let w=await Pd(e,_,h,n,r),C=p instanceof Error?dn(Je(p.message),"redacted"):"telemetry_flush_failed";await s({endpoint:i,queue_entries:w.length,last_attempted_flush_at:h,last_failed_flush_at:h,last_failed_flush_error:C});return}try{let p=await cn(e,_,n,r);await s({endpoint:i,queue_entries:p.length,last_attempted_flush_at:h,last_successful_flush_at:h,last_failed_flush_at:void 0,last_failed_flush_error:void 0})}catch(p){let w=p instanceof Error?dn(Je(p.message),"redacted"):"telemetry_flush_failed",C=await ot(e,r).catch(()=>d);await s({endpoint:i,queue_entries:C.length,last_attempted_flush_at:h,last_failed_flush_at:h,last_failed_flush_error:w})}}async function Fd(e){let t=Eo(e);Y(process.env[H])||await an(v.dirname(t),{recursive:!0});try{return await an(t),!0}catch(n){if(typeof n!="object"||n===null||!("code"in n)||n.code!=="EEXIST")throw n}try{let n=await _o(t);return Date.now()-n.mtimeMs<ud?!1:(await un(t,{recursive:!0,force:!0}),await an(t),!0)}catch{return!1}}function Ud(e){try{Gc(e,{recursive:!0,force:!0})}catch{}}function jd(e){Ud(Ed(e))}async function Vd(e,t,n){let r=await Fd(e);if(jd(e),!r)return!1;try{await Md(e,t,n)}finally{try{await un(Eo(e),{recursive:!0,force:!0})}catch{}}return!0}async function po(e,t){let n=new Set;try{let{entries:r}=rt(await ot(e),t);for(let o of r.filter(Oo))n.add(`event:${o.event.event_id}`)}catch{}try{let r=await T(nt(e));if(r!==null)for(let o of pn(fn(r),t).entries)mn(o.next_attempt_after)&&n.add(`span:${o.id}`)}catch{}return n}async function Hp(e=oe(process.cwd())){if(!he().telemetry_disabled)try{await wt(e,async()=>{let t=Y(process.env[H]),n=!0;for(;n;){if(!(await P(e)).telemetry.enabled)return;let r=await ye(()=>xd(e),e);if(!r)return;let o=t?await po(e,r.retentionDays):new Set;if(!await Vd(e,r.endpoint,r.retentionDays)||!t)return;let i=await po(e,r.retentionDays);n=i.size>0&&(i.size!==o.size||[...i].some(s=>!o.has(s)))}},()=>Y(process.env[H]))}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]="79bb744c-f468-5333-b39a-552bf8639096")}catch{}})();export{jt as a,sa as b,Gu as c,Ku as d,Ju as e,Xu as f,Qu as g,Zu as h,em as i,la as j,fa as k,pa as l,_a as m,ys as n,Tt as o,On as p,qd as q,xn as r,ke as s,Nn as t,Pn as u,Fo as v,Uo as w,jo as x,Vo as y,Gd as z,qn as A,Ko as B,Kd as C,Jo as D,Jd as E,de as F,Qo as G,Oe as H,Xd as I,Zo as J,Re as K,Qd as L,Le as M,ti as N,ni as O,$l as P,fr as Q,zl as R,Fl as S,$e as T,Ul as U,Ts as V,iu as W,As as X,Cs as Y,ks as Z,Rs as _,au as $,Ps as aa,du as ba,$s as ca,zs as da,zt as ea,Us as fa,Ft as ga,js as ha,Au as ia,qs as ja,br as ka,Hs as la,Ys as ma,Ws as na,Gs as oa,Pu as pa,Xs as qa,Vu as ra,ta as sa,ra as ta,ri as ua,ua as va,ma as wa,je as xa,$a as ya,al as za,Ct as Aa,Wn as Ba,kt as Ca,hi as Da,yi as Ea,ll as Fa,Gn as Ga,Z as Ha,Rt as Ia,Lt as Ja,Kt as Ka,vm as La,Jt as Ma,Be as Na,Fr as Oa,We as Pa,Xt as Qa,Qt as Ra,Zt as Sa,en as Ta,Yr as Ua,Br as Va,Ym as Wa,tn as Xa,_e as Ya,Sc as Za,Ke as _a,Gm as $a,he as ab,ff as bb,pf as cb,os as db,dr as eb,ss as fb,as as gb,cs as hb,El as ib,Pt as jb,ur as kb,lr as lb,us as mb,ms as nb,mr as ob,_s as pb,xc as qb,Lc as rb,Mc as sb,Nc as tb,Hc as ub,Yc as vb,nd as wb,yo as xb,ye as yb,Hp as zb};
26
+ //# sourceMappingURL=chunk-KN7RBRRH.js.map
@@ -1,6 +1,6 @@
1
- import{c as T}from"./chunk-33EK522E.js";import{a,d as I}from"./chunk-HIKZYZ26.js";import{Z as w,j as g,k as v,l as E}from"./chunk-MK7UQEE5.js";import{A as u,C as m,m as k,z as f}from"./chunk-G6ERMFJ5.js";import C from"node:fs/promises";import p 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]="74b72dd8-0877-55a4-9c80-d043f19e1f96")}catch{}})();var P=["extensions","docs","examples","assets","prompts"],U=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});function R(e){return P.includes(e)}function q(e,t){if(t==null)return[];let n=Array.isArray(t)?t:[t],r=[];for(let o of n){if(typeof o!="string"||o.trim().length===0)throw new u(`Package manifest field pm.${e} must contain string paths.`,f.USAGE);r.push(o.trim())}return[...new Set(r)].sort((o,i)=>o.localeCompare(i))}function G(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new u("Package manifest field pm must be an object.",f.USAGE);let t={},n=e;for(let[r,o]of Object.entries(n)){if(!R(r))continue;let i=q(r,o);i.length>0&&(t[r]=i)}return t}function c(e,t){let n=e[t];return typeof n=="string"&&n.trim().length>0?n.trim():void 0}function S(e){if(!Array.isArray(e))return;let t=e.map(n=>typeof n=="string"?n.trim():"").filter(n=>n.length>0);return t.length>0?[...new Set(t)].sort((n,r)=>n.localeCompare(r)):void 0}function x(e){if(typeof e=="string"&&e.trim().length>0)return e.trim();if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let t=e.url;return typeof t=="string"&&t.trim().length>0?t.trim():void 0}}function J(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={docs:c(t,"docs"),npm:c(t,"npm"),repository:c(t,"repository"),report:c(t,"report")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={image:c(t,"image"),video:c(t,"video")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function V(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={display_name:c(t,"display_name")??c(t,"displayName"),category:c(t,"category"),summary:c(t,"summary"),links:J(t.links),media:K(t.media),tags:S(t.tags)};return Object.values(n).some(r=>r!==void 0)?n:void 0}async function Y(e){let t=p.join(e,"package.json");if(!await m(t))return{source:"convention",resources:{}};let n;try{n=JSON.parse(await C.readFile(t,"utf8"))}catch(l){throw new u(`Failed to parse package manifest at "${t}": ${String(l)}`,f.USAGE)}if(typeof n!="object"||n===null||Array.isArray(n))throw new u(`Package manifest at "${t}" must be a JSON object.`,f.USAGE);let r=n,o=r.pm,i=o!=null,s=typeof o=="object"&&o!==null&&!Array.isArray(o)?o:{};return{source:i?"pm":"convention",package_json_path:t,package_name:typeof r.name=="string"?r.name:void 0,package_version:typeof r.version=="string"?r.version:void 0,package_private:r.private===!0,package_description:typeof r.description=="string"?r.description:void 0,package_keywords:S(r.keywords),package_homepage:typeof r.homepage=="string"?r.homepage:void 0,package_repository_url:x(r.repository),package_bugs_url:x(r.bugs),aliases:S(s.aliases),resources:G(o),catalog:V(s.catalog)}}async function j(e){if(!await m(e))return[];let t=await C.readdir(e,{withFileTypes:!0}),n=[];for(let r of t){if(!r.isDirectory())continue;let o=p.join(e,r.name);await m(p.join(o,"manifest.json"))&&n.push(o)}return n.sort((r,o)=>r.localeCompare(o))}async function he(e){if(await m(p.join(e,"manifest.json")))return[e];let t=(await Y(e)).resources.extensions??[],n=new Set;for(let r of t){if(r.includes("*")||r.startsWith("!"))throw new u(`Package extension entry "${r}" uses a glob/exclusion pattern. pm package installs currently require concrete extension paths or directories.`,f.USAGE);let o=p.resolve(e,r);if(!w(e,o))throw new u(`Package extension entry "${r}" resolves outside package root.`,f.USAGE);if(await m(p.join(o,"manifest.json"))){n.add(o);continue}for(let i of await j(o))n.add(i)}if(t.length===0)for(let r of U.extensions)for(let o of await j(p.join(e,r)))n.add(o);return[...n].sort((r,o)=>r.localeCompare(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]="3984f1ef-1703-5a83-a4fa-ec1cdc738572")}catch{}})();var D=[["commands","Commands"],["command_overrides","Command overrides"],["flag_commands","Flag commands"],["item_types","Item types"],["item_fields","Item fields"],["migrations","Migrations"],["profiles","Profiles"],["importers","Importers"],["exporters","Exporters"],["search_providers","Search providers"],["vector_store_adapters","Vector store adapters"],["assurance_providers","Assurance measurement providers"],["hooks","Lifecycle hooks"],["parser_overrides","Parser overrides"],["service_overrides","Service overrides"],["renderer_overrides","Renderer overrides"]];function A(e){return"#".repeat(e)}function $(e){if(!e.includes("`"))return`\`${e}\``;let t=0,n=0;for(let i of e)n=i==="`"?n+1:0,t=Math.max(t,n);let r="`".repeat(t+1),o=e.startsWith("`")||e.endsWith("`")?" ":"";return`${r}${o}${e}${o}${r}`}function B(e){return e.length===0?"Capabilities: _none registered_":`Capabilities: ${e.map($).join(", ")}`}function W(e,t,n){let r=[`${A(t)} ${e}`,""];return n.length===0?(r.push("_None._",""),r):(r.push(...n.map(o=>`- ${$(o)}`),""),r)}function H(e,t,n){return e===0&&!n?[]:[`${A(t)} Preflight overrides`,"",e>0?`- ${e} registered (this surface carries no per-entry identifier)`:"_None._",""]}function be(e,t={}){let n=t.headingLevel??2;if(!Number.isInteger(n)||n<1||n>6)throw new RangeError(`headingLevel must be an integer in [1, 6], received ${String(t.headingLevel)}`);let r=Math.min(n+1,6),o=t.includeEmpty===!0,i=t.title??"Extension surfaces",s=[`${A(n)} ${i}`,""];(o||e.capabilities.length>0)&&s.push(B(e.capabilities),"");for(let[l,d]of D){let y=e[l]??[];y.length===0&&!o||s.push(...W(d,r,y))}return s.push(...H(e.preflight_overrides,r,o)),!(e.preflight_overrides>0||D.some(([l])=>(e[l]?.length??0)>0))&&!o&&s.push("_This extension registers no surfaces._",""),`${s.join(`
1
+ import{c as T}from"./chunk-KN7RBRRH.js";import{a,d as I}from"./chunk-HIKZYZ26.js";import{Z as w,j as g,k as v,l as E}from"./chunk-MK7UQEE5.js";import{A as u,C as m,m as k,z as f}from"./chunk-G6ERMFJ5.js";import C from"node:fs/promises";import p 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]="74b72dd8-0877-55a4-9c80-d043f19e1f96")}catch{}})();var P=["extensions","docs","examples","assets","prompts"],U=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});function R(e){return P.includes(e)}function q(e,t){if(t==null)return[];let n=Array.isArray(t)?t:[t],r=[];for(let o of n){if(typeof o!="string"||o.trim().length===0)throw new u(`Package manifest field pm.${e} must contain string paths.`,f.USAGE);r.push(o.trim())}return[...new Set(r)].sort((o,i)=>o.localeCompare(i))}function G(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new u("Package manifest field pm must be an object.",f.USAGE);let t={},n=e;for(let[r,o]of Object.entries(n)){if(!R(r))continue;let i=q(r,o);i.length>0&&(t[r]=i)}return t}function c(e,t){let n=e[t];return typeof n=="string"&&n.trim().length>0?n.trim():void 0}function S(e){if(!Array.isArray(e))return;let t=e.map(n=>typeof n=="string"?n.trim():"").filter(n=>n.length>0);return t.length>0?[...new Set(t)].sort((n,r)=>n.localeCompare(r)):void 0}function x(e){if(typeof e=="string"&&e.trim().length>0)return e.trim();if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let t=e.url;return typeof t=="string"&&t.trim().length>0?t.trim():void 0}}function J(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={docs:c(t,"docs"),npm:c(t,"npm"),repository:c(t,"repository"),report:c(t,"report")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={image:c(t,"image"),video:c(t,"video")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function V(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={display_name:c(t,"display_name")??c(t,"displayName"),category:c(t,"category"),summary:c(t,"summary"),links:J(t.links),media:K(t.media),tags:S(t.tags)};return Object.values(n).some(r=>r!==void 0)?n:void 0}async function Y(e){let t=p.join(e,"package.json");if(!await m(t))return{source:"convention",resources:{}};let n;try{n=JSON.parse(await C.readFile(t,"utf8"))}catch(l){throw new u(`Failed to parse package manifest at "${t}": ${String(l)}`,f.USAGE)}if(typeof n!="object"||n===null||Array.isArray(n))throw new u(`Package manifest at "${t}" must be a JSON object.`,f.USAGE);let r=n,o=r.pm,i=o!=null,s=typeof o=="object"&&o!==null&&!Array.isArray(o)?o:{};return{source:i?"pm":"convention",package_json_path:t,package_name:typeof r.name=="string"?r.name:void 0,package_version:typeof r.version=="string"?r.version:void 0,package_private:r.private===!0,package_description:typeof r.description=="string"?r.description:void 0,package_keywords:S(r.keywords),package_homepage:typeof r.homepage=="string"?r.homepage:void 0,package_repository_url:x(r.repository),package_bugs_url:x(r.bugs),aliases:S(s.aliases),resources:G(o),catalog:V(s.catalog)}}async function j(e){if(!await m(e))return[];let t=await C.readdir(e,{withFileTypes:!0}),n=[];for(let r of t){if(!r.isDirectory())continue;let o=p.join(e,r.name);await m(p.join(o,"manifest.json"))&&n.push(o)}return n.sort((r,o)=>r.localeCompare(o))}async function he(e){if(await m(p.join(e,"manifest.json")))return[e];let t=(await Y(e)).resources.extensions??[],n=new Set;for(let r of t){if(r.includes("*")||r.startsWith("!"))throw new u(`Package extension entry "${r}" uses a glob/exclusion pattern. pm package installs currently require concrete extension paths or directories.`,f.USAGE);let o=p.resolve(e,r);if(!w(e,o))throw new u(`Package extension entry "${r}" resolves outside package root.`,f.USAGE);if(await m(p.join(o,"manifest.json"))){n.add(o);continue}for(let i of await j(o))n.add(i)}if(t.length===0)for(let r of U.extensions)for(let o of await j(p.join(e,r)))n.add(o);return[...n].sort((r,o)=>r.localeCompare(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]="3984f1ef-1703-5a83-a4fa-ec1cdc738572")}catch{}})();var D=[["commands","Commands"],["command_overrides","Command overrides"],["flag_commands","Flag commands"],["item_types","Item types"],["item_fields","Item fields"],["migrations","Migrations"],["profiles","Profiles"],["importers","Importers"],["exporters","Exporters"],["search_providers","Search providers"],["vector_store_adapters","Vector store adapters"],["assurance_providers","Assurance measurement providers"],["hooks","Lifecycle hooks"],["parser_overrides","Parser overrides"],["service_overrides","Service overrides"],["renderer_overrides","Renderer overrides"]];function A(e){return"#".repeat(e)}function $(e){if(!e.includes("`"))return`\`${e}\``;let t=0,n=0;for(let i of e)n=i==="`"?n+1:0,t=Math.max(t,n);let r="`".repeat(t+1),o=e.startsWith("`")||e.endsWith("`")?" ":"";return`${r}${o}${e}${o}${r}`}function B(e){return e.length===0?"Capabilities: _none registered_":`Capabilities: ${e.map($).join(", ")}`}function W(e,t,n){let r=[`${A(t)} ${e}`,""];return n.length===0?(r.push("_None._",""),r):(r.push(...n.map(o=>`- ${$(o)}`),""),r)}function H(e,t,n){return e===0&&!n?[]:[`${A(t)} Preflight overrides`,"",e>0?`- ${e} registered (this surface carries no per-entry identifier)`:"_None._",""]}function be(e,t={}){let n=t.headingLevel??2;if(!Number.isInteger(n)||n<1||n>6)throw new RangeError(`headingLevel must be an integer in [1, 6], received ${String(t.headingLevel)}`);let r=Math.min(n+1,6),o=t.includeEmpty===!0,i=t.title??"Extension surfaces",s=[`${A(n)} ${i}`,""];(o||e.capabilities.length>0)&&s.push(B(e.capabilities),"");for(let[l,d]of D){let y=e[l]??[];y.length===0&&!o||s.push(...W(d,r,y))}return s.push(...H(e.preflight_overrides,r,o)),!(e.preflight_overrides>0||D.some(([l])=>(e[l]?.length??0)>0))&&!o&&s.push("_This extension registers no surfaces._",""),`${s.join(`
2
2
  `).trimEnd()}
3
3
  `}(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]="abb182c9-6d6c-5be4-a2ad-c91b00a098d0")}catch{}})();var X=["agile","ops","research"],Q={agile:[{name:"Story",description:"User-facing outcome or capability slice expressed from a stakeholder perspective.",defaultStatus:"open",folder:"stories",aliases:["user-story"]},{name:"Spike",description:"Time-boxed investigation used to reduce uncertainty before implementation.",defaultStatus:"open",folder:"spikes",aliases:["research-spike"]}],ops:[{name:"Incident",description:"Operational disruption, degradation, or support escalation with recovery tracking.",defaultStatus:"open",folder:"incidents",aliases:["outage"]},{name:"Runbook",description:"Repeatable operational procedure, diagnostic path, or response playbook.",defaultStatus:"open",folder:"runbooks",aliases:["playbook"]}],research:[{name:"Experiment",description:"Validated-learning activity with hypothesis, method, and outcome tracking.",defaultStatus:"open",folder:"experiments",aliases:["study"]},{name:"Hypothesis",description:"Testable claim or assumption that should be supported, rejected, or refined.",defaultStatus:"open",folder:"hypotheses",aliases:["assumption"]}]};function Se(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new Error("Type preset name must not be empty.");if(t==="agile"||t==="ops"||t==="research")return t;throw new Error(`Invalid type preset "${e}". Allowed: ${X.join(", ")}.`)}function Ae(e){return Q[e].map(t=>T(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]="1abceae0-299e-5fff-aa8c-46c015115571")}catch{}})();var Z=new Set(v),ee=new Set(E),F=new Set([...k.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),te=["create","update"];function z(e){if(typeof e!="string")return"";let t=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return t.startsWith("--")?t.slice(2):t}function N(e){return e.replaceAll("_","-")}function re(e,t){let n=new Set;for(let r of e){let o=z(r);o.length>0&&o!==t&&n.add(o)}return[...n].sort((r,o)=>r.localeCompare(o))}function ne(e){let t=new Set;for(let n of e??[]){let r=n.trim();r.length>0&&t.add(r)}return[...t].sort((n,r)=>n.localeCompare(r))}function oe(e){let t=new Set,n=[];for(let r of e??[]){let o=r.trim().toLowerCase();if(o.length!==0){if(!ee.has(o))throw new Error(`Invalid field command "${r}". Allowed: ${E.join(", ")}.`);t.has(o)||(t.add(o),n.push(o))}}return e===void 0||n.length===0?[...te]:n}function je(e){let t=a(e.key);if(t.length===0)throw new Error("Field key must not be empty.");if(t.includes(","))throw new Error(`Field key "${t}" must not contain commas: commas separate field names in list flags such as --unset and --fields.`);if(F.has(t))throw new Error(`Cannot define custom field "${t}": custom schema field "${t}" collides with built-in item metadata "${t}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...F].sort((b,M)=>b.localeCompare(M)).join(", ")}.`);let n=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!Z.has(n))throw new Error(`Invalid field type "${e.type}". Allowed: ${v.join(", ")}.`);let r=n,o=oe(e.commands),i=z(e.cliFlag),s=i.length>0&&i!==N(t)?i:void 0,l=s??N(t),d=re(e.aliases??[],l),y=[l,...d].find(b=>b.includes(","));if(y!==void 0)throw new Error(`Field flag "${y}" must not contain commas.`);let _=e.description?.trim();return{key:t,type:r,commands:o,description:_&&_.length>0?_:void 0,cliFlag:s,cliAliases:d,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:ne(e.requiredTypes)}}function ie(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function se(e){let t=ie(e);if(!t)return[];let n=[];for(let r of t){if(typeof r!="object"||r===null||Array.isArray(r))continue;let o=r;typeof o.key!="string"||o.key.trim().length===0||n.push(o)}return n}function Ce(e){if(e==null||e.trim().length===0)return{fields:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:se(t)}}function De(e){return`${JSON.stringify({fields:e.fields},null,2)}
4
4
  `}function $e(e,t){let n=e.fields.find(s=>a(s.key)===t.key),r=n!==void 0,o=e.fields.filter(s=>a(s.key)!==t.key),i={...n,key:t.key,type:t.type,commands:[...t.commands]};return O(i,"description",t.description),O(i,"cli_flag",t.cliFlag),t.cliAliases.length>0?i.cli_aliases=[...t.cliAliases]:delete i.cli_aliases,L(i,"required",t.required),L(i,"required_on_create",t.requiredOnCreate),t.allowUnset===!1?i.allow_unset=!1:delete i.allow_unset,t.requiredTypes.length>0?i.required_types=[...t.requiredTypes]:delete i.required_types,o.push(i),o.sort((s,l)=>a(s.key).localeCompare(a(l.key))),{file:{fields:o},definition:i,replaced:r}}function Fe(e,t){let n=a(t);if(n.length===0)throw new Error("Field key must not be empty.");let r=[],o=e.fields.filter(i=>a(i.key)===n?(r.push(i),!1):!0);return r.length===0?{file:{fields:o},removed:!1}:{file:{fields:o},removed:!0,definition:r[0]}}function O(e,t,n){let r=e;n!==void 0&&n.length>0?r[t]=n:delete r[t]}function L(e,t,n){let r=e;n?r[t]=!0:delete r[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]="b1e4c04e-0ade-5d24-95e3-b8dca3832c5a")}catch{}})();var ae=new Set(g),h=new Set(I.map(e=>a(e.id)).filter(e=>e.length>0));function le(e){let t=new Set;for(let n of e){let r=a(n);r.length>0&&t.add(r)}return[...t].sort((n,r)=>n.localeCompare(r))}function Pe(e){let t=a(e.id);if(t.length===0)throw new Error("Status id must not be empty.");if(h.has(t))throw new Error(`Cannot add-status the built-in status "${t}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let n;if(e.roles!==void 0){n=[];let s=new Set;for(let l of e.roles){let d=typeof l=="string"?l.trim().toLowerCase():"";if(d.length!==0){if(!ae.has(d))throw new Error(`Invalid status role "${l}". Allowed roles: ${g.join(", ")}.`);s.has(d)||(s.add(d),n.push(d))}}if(n.length===0)throw new Error(`Status role must include at least one lifecycle role. Allowed roles: ${g.join(", ")}.`)}let r=e.aliases===void 0?void 0:le(e.aliases).filter(s=>s!==t),o=e.description?.trim(),i=typeof e.order=="number"&&Number.isFinite(e.order)?Math.trunc(e.order):void 0;return{id:t,roles:n,aliases:r,description:o&&o.length>0?o:void 0,order:i}}function de(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function ce(e){let t=de(e);if(!t)return[];let n=[];for(let r of t){if(typeof r!="object"||r===null||Array.isArray(r))continue;let o=r;typeof o.id!="string"||o.id.trim().length===0||n.push(o)}return n}function Ue(e){if(e==null||e.trim().length===0)return{statuses:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/statuses.json contains invalid JSON.")}return{statuses:ce(t)}}function Re(e){return`${JSON.stringify({statuses:e.statuses},null,2)}
5
5
  `}function qe(e,t,n){let r=e.statuses.slice(),o=r.findIndex(l=>a(l.id)===t.id),i=o>=0?r[o]:n,s={...i,id:t.id};return t.roles!==void 0&&(t.roles.length>0?s.roles=[...t.roles]:s.roles!==void 0&&delete s.roles),t.aliases!==void 0&&(t.aliases.length>0?s.aliases=[...t.aliases]:s.aliases!==void 0&&delete s.aliases),t.description!==void 0&&(s.description=t.description),t.order!==void 0&&(s.order=t.order),o>=0?r[o]=s:r.push(s),{file:{statuses:r},definition:s,replaced:i!==void 0}}function Ge(e,t){let n=a(t);if(n.length===0)throw new Error("Status id must not be empty.");if(h.has(n))throw new Error(`Cannot remove built-in status "${n}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let r=e.statuses.slice(),o=r.findIndex(s=>a(s.id)===n);if(o<0)return{file:{statuses:r},removed:!1};let[i]=r.splice(o,1);return{file:{statuses:r},removed:!0,definition:i}}function Je(e,t){let n=[e.id,...e.aliases??[]];for(let r of n){let o=a(r);if(o.length===0)continue;let i=t.get(o);if(i!==void 0&&i!==e.id)throw new Error(`Status token "${o}" already belongs to status "${i}". Choose a different id/alias to avoid shadowing it.`)}}export{P as a,U as b,Y as c,he as d,X as e,Q as f,Se as g,Ae as h,je as i,Ce as j,De as k,$e as l,Fe as m,h as n,Pe as o,Ue as p,Re as q,qe as r,Ge as s,Je as t,be as u};
6
- //# sourceMappingURL=chunk-3SH3L3DB.js.map
6
+ //# sourceMappingURL=chunk-LAIN47EJ.js.map
@@ -0,0 +1,2 @@
1
+ import{ca as l}from"./chunk-IPIFI4NT.js";import{lb as r}from"./chunk-GAXO2UQX.js";import{od as S,pd as N,rd as E,sb as n}from"./chunk-MK7UQEE5.js";(function(){try{var T=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new T.Error().stack;e&&(T._sentryDebugIds=T._sentryDebugIds||{},T._sentryDebugIds[e]="0f5adf98-dc8e-5fa6-a14a-5c9b588b5569")}catch{}})();var u=new Set(["--author","--expect-hash","--follow","--help","--lean","--token-accounting","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor","--output-row-contract","--no-changed-fields","--no-extensions","--no-pager","--pm-path","--profile","--quiet","--interval-ms"]),p=new Set([...S,...N]),I=new Set(["--brief","--format","--full","--full-changed-fields","--id-only","--no-truncate","--stream"]),d=new Set(["--body-file","--file","--stdin-json"]),m=new Set(["--global","--local","--project"]),P=new Set(["--activity-limit","--default-depth","--section-activity","--section-blockers","--section-files","--section-hierarchy","--section-progress","--section-staleness","--section-tests","--section-workload","--stale-threshold-days"]),f=new Set(["action","fullChangedFields","idOnly","path","pmExecutable","timeoutMs"]),M=new Set(["configAction","id","name","query","reason","subcommand","target","text"]),G={assurance:{id:"<id>",kind:"<kind>",preset:"[kind]|[id]",subcommand:"<action>"},event:{title:"<title>"},files:{lookupPath:"lookup <path...>"},meet:{title:"<title>"},"item-reopen":{id:"<id>",reason:"<reason>"},merge:{subcommand:"<subcommand>"},remind:{title:"<title>"},workspace:{name:"<name>",subcommand:"snapshot",snapshotAction:"<snapshot-action>",target:"<target>"}},F={append:{"--text":"body"},assurance:{"--tree":"treeId","--owner":"owner","--apply":"apply","--enforcement":"enforcement"},init:{"--id-prefix":"idPrefix","--no-merge-fence":"mergeFence","--workspace":"workspace"},create:{"--no-inherit-focus":"inheritFocus","--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},plan:{"--no-inherit-focus":"inheritFocus"},update:{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},"update-many":{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},files:{"--note":"addNote","--full-history":"full"},docs:{"--note":"addNote","--full-history":"full"},test:{"--full-history":"full"},comments:{"--full-history":"full"},notes:{"--file":"text","--full-history":"full"},learnings:{"--file":"text","--full-history":"full"},gc:{"--scope":"gcScope"},contracts:{"--action":"contractAction"},schema:{"--no-allow-unset":"allowUnset","--type":"fieldTypeScope"},"history-author-acknowledge":{"--event":"historyEvent","--all-actionable":"allActionable"},"extension-init":{"--capability":"capability"},"package-init":{"--capability":"capability"},"extension-install":{"--gh":"github"},"package-install":{"--gh":"github"},"extension-adopt":{"--gh":"github"},"package-adopt":{"--gh":"github"},extension:{"--gh":"github","--scaffold":"init"},package:{"--gh":"github","--scaffold":"init"},install:{"--gh":"github"}},D={"--pm-path":"path"},c={stats:{"--analytics":["measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]}};function h(T){return T.startsWith("extension-")?`extension ${T.slice(10)}`:T.startsWith("package-")?`package ${T.slice(8)}`:T.startsWith("item-")?`item ${T.slice(5)}`:T}function R(T,e){let t=F[T]?.[e]??D[e];return t!==void 0?t:e.replace(/^--/,"").replaceAll("_","-").replace(/-([a-z])/g,(i,_)=>_.toUpperCase())}function g(T){let e=new Set;return T.filter(({flag:t})=>!t.startsWith("--")||e.has(t)?!1:(e.add(t),!0))}function y(T,e){return e.find(({aliases:t})=>t?.includes(T))?.flag}function U(T,e,t,i){let _=c[T]?.[e.flag];if(_!==void 0&&_.every(A=>i.has(A)))return{surface:"cli",input:e.flag,counterpart:_[0],disposition:"shared",reason:"The validated CLI JSON object fans out across strict SDK parameters."};let O=R(T,e.flag);if(i.has(O))return{surface:"cli",input:e.flag,counterpart:O,disposition:"shared",reason:"The CLI flag maps directly to a strict SDK action parameter."};let C=y(e.flag,t);if(C!==void 0){let A=R(T,C);if(i.has(A))return{surface:"cli",input:e.flag,counterpart:A,disposition:"compatibility_alias",reason:`Compatibility spelling for ${C}.`}}return u.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_transport",reason:"CLI process transport is supplied by the in-process SDK host."}:I.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_presentation",reason:"CLI rendering or mutation projection does not alter the SDK result envelope."}:d.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_adapter",reason:"Local file or stdin adaptation is a CLI boundary concern."}:P.has(e.flag)?{surface:"cli",input:e.flag,counterpart:"key",disposition:"compatibility_alias",reason:"CLI config shorthand normalizes to the SDK configAction/key/value contract."}:m.has(e.flag)?{surface:"cli",input:e.flag,counterpart:"scope",disposition:"cli_scope_selector",reason:"Mutually exclusive CLI scope switches normalize to the SDK scope parameter."}:{surface:"cli",input:e.flag,counterpart:O,disposition:"unclassified",reason:"The CLI flag has no strict SDK parameter or approved boundary classification."}}function b(T,e,t){let i=Object.entries(c[T]??{}).find(([C,A])=>A.includes(e)&&t.some(({input:o,disposition:s})=>o===C&&s==="shared"));if(i!==void 0)return{surface:"sdk",input:e,counterpart:i[0],disposition:"shared",reason:"The strict SDK parameter is reachable through the validated CLI JSON object."};let _=t.find(({counterpart:C,disposition:A})=>C===e&&(A==="shared"||A==="compatibility_alias"||A==="cli_scope_selector"));if(_!==void 0)return{surface:"sdk",input:e,counterpart:_.input,disposition:"shared",reason:"The strict SDK parameter is reachable from the CLI contract."};let O=G[T]?.[e];return O!==void 0?{surface:"sdk",input:e,counterpart:O,disposition:"shared",reason:"The strict SDK parameter maps to a canonical CLI positional argument."}:f.has(e)?{surface:"sdk",input:e,disposition:"sdk_transport",reason:"The SDK host supplies in-process transport and workspace selection."}:M.has(e)?{surface:"sdk",input:e,disposition:"cli_positional",reason:"The CLI accepts this SDK parameter as a positional command argument."}:{surface:"sdk",input:e,disposition:"sdk_native",reason:"The typed SDK exposes this structured input without a canonical CLI long flag."}}function v(T={}){let e=T.actions??n,t=T.resolveFlags??r,i=T.resolveParameters??l;return e.map(_=>{let O=h(_),C=g(t(O)).filter(({flag:a})=>E(_)!==void 0||!p.has(a)),A=new Set(i(_)??[]),o=C.map(a=>U(_,a,C,A)),s=[...A].sort((a,L)=>a.localeCompare(L)).map(a=>b(_,a,o));return{action:_,command:O,cli:o,sdk:s,unclassified:[...o,...s].filter(({disposition:a})=>a==="unclassified")}})}(function(){try{var T=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new T.Error().stack;e&&(T._sentryDebugIds=T._sentryDebugIds||{},T._sentryDebugIds[e]="62489699-d1d6-505e-8a23-53922081c6e7")}catch{}})();export{v as a};
2
+ //# sourceMappingURL=chunk-RXY6BFRW.js.map