@unbrained/pm-cli 2026.8.18 → 2026.8.19

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 (139) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +16 -2
  3. package/dist/cli/error-guidance.js +3 -2
  4. package/dist/cli/help-content.js +32 -13
  5. package/dist/cli/help-json-payload.d.ts +15 -0
  6. package/dist/cli/help-json-payload.js +101 -23
  7. package/dist/cli/main.js +6 -2
  8. package/dist/cli/register-list-query.js +8 -5
  9. package/dist/cli/register-mutation.js +8 -8
  10. package/dist/cli/register-operations.js +6 -6
  11. package/dist/cli-bundle/bundle-manifest.json +139 -139
  12. package/dist/cli-bundle/chunks/chunk-4NRRH7AM.js +2 -0
  13. package/dist/cli-bundle/chunks/{chunk-UYCLQVL2.js → chunk-4THEB6PD.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-BSK2IN3C.js → chunk-BHYMXLAE.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +197 -0
  16. package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +35 -0
  17. package/dist/cli-bundle/chunks/chunk-OI4XI562.js +5 -0
  18. package/dist/cli-bundle/chunks/{chunk-YRGOLZA7.js → chunk-OIOKV6NO.js} +3 -3
  19. package/dist/cli-bundle/chunks/{chunk-5UZZAJKR.js → chunk-QXSH7BLM.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-RZQTVMRQ.js → chunk-TOXJM4WA.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-GNFAFIJI.js → chunk-YBMRWW4E.js} +44 -44
  22. package/dist/cli-bundle/chunks/{register-list-query-I23LALEE.js → register-list-query-Y56KINDU.js} +11 -11
  23. package/dist/cli-bundle/chunks/register-mutation-AUWVCW4M.js +20 -0
  24. package/dist/cli-bundle/chunks/register-operations-PZQPHXW5.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-setup-PPPEF3SN.js → register-setup-I4LUHGVW.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-5AF3ZBNB.js → chunk-34QBIYZI.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-V5XTGLK7.js → chunk-BJRYFVSH.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-DKPLYW3L.js +2 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-ODOVCP45.js → chunk-EF6ZS5GH.js} +44 -44
  30. package/dist/cli-bundle/focused-chunks/{chunk-EX6MKP2X.js → chunk-ESISGDAY.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-EUEGXZ2A.js → chunk-EXBCLIBU.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-UI6AJ5TD.js → chunk-JDOMQ7VQ.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-MCZXYZAF.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-ODHQEECS.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-3TKWMNKF.js → chunk-PRHY2IMX.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-M62NO7EI.js → chunk-US7VEYZG.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-TN4AE665.js → chunk-VXDSU5MC.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +16 -0
  41. package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-K43KKAFS.js → chunk-ZBIQQYMI.js} +2 -2
  43. package/dist/cli-bundle/main.js +13 -13
  44. package/dist/cli-bundle/sdk-authoring.js +1 -1
  45. package/dist/cli-bundle/sdk-contracts.js +2 -1
  46. package/dist/cli-bundle/sdk-core.js +31 -31
  47. package/dist/cli-bundle/sdk-governance.js +1 -1
  48. package/dist/cli-bundle/sdk-graph.js +1 -1
  49. package/dist/cli-bundle/sdk-merge.js +32 -32
  50. package/dist/cli-bundle/sdk-query.js +1 -1
  51. package/dist/cli-bundle/sdk-runtime.js +1 -1
  52. package/dist/cli-bundle/sdk-testing.js +1 -1
  53. package/dist/cli-bundle/sdk.js +5 -4
  54. package/dist/core/shared/errors.d.ts +2 -0
  55. package/dist/core/shared/errors.js +2 -2
  56. package/dist/sdk/agent/refusal-closure.d.ts +41 -0
  57. package/dist/sdk/agent/refusal-closure.js +92 -0
  58. package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
  59. package/dist/sdk/agent-capability-contracts.d.ts +13 -0
  60. package/dist/sdk/agent-capability-contracts.js +104 -7
  61. package/dist/sdk/cli-contracts/command-aliases.js +18 -2
  62. package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
  63. package/dist/sdk/cli-contracts/commander-types.js +5 -4
  64. package/dist/sdk/cli-contracts/flag-contracts.d.ts +5 -0
  65. package/dist/sdk/cli-contracts/flag-contracts.js +75 -8
  66. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +55 -0
  67. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +240 -0
  68. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +81 -0
  69. package/dist/sdk/cli-contracts/grammar-contracts.js +615 -2
  70. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +15 -4
  71. package/dist/sdk/cli-contracts/runtime-contracts.js +42 -12
  72. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
  73. package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
  74. package/dist/sdk/cli-contracts.d.ts +3 -2
  75. package/dist/sdk/cli-contracts.js +5 -4
  76. package/dist/sdk/context-intent-contracts.d.ts +2 -2
  77. package/dist/sdk/context-intent-contracts.js +22 -7
  78. package/dist/sdk/contracts.d.ts +2 -0
  79. package/dist/sdk/contracts.js +4 -2
  80. package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
  81. package/dist/sdk/flag-invocation-contracts.js +218 -9
  82. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +134 -2
  83. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +154 -22
  84. package/dist/sdk/index.d.ts +7 -5
  85. package/dist/sdk/index.js +7 -5
  86. package/dist/sdk/output-projection.d.ts +2 -0
  87. package/dist/sdk/output-projection.js +11 -5
  88. package/dist/sdk/query/get.js +25 -6
  89. package/dist/sdk/query/list.js +16 -2
  90. package/dist/sdk/query/search-contracts.d.ts +1 -1
  91. package/dist/sdk/query/search-contracts.js +23 -9
  92. package/dist/sdk/query/search.js +3 -3
  93. package/dist/sdk/read-output/continuation.d.ts +1 -1
  94. package/dist/sdk/read-output/continuation.js +7 -24
  95. package/dist/sdk/read-output-contracts.js +55 -6
  96. package/dist/sdk/read-output-rows.d.ts +4 -0
  97. package/dist/sdk/read-output-rows.js +47 -18
  98. package/dist/sdk/runtime.js +9 -5
  99. package/dist/sdk/workspace-snapshot.d.ts +2 -0
  100. package/dist/sdk/workspace-snapshot.js +10 -2
  101. package/docs/COMMANDS.md +16 -4
  102. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
  103. package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
  104. package/docs/SDK.md +6 -0
  105. package/docs/TESTING.md +14 -1
  106. package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
  107. package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
  108. package/marketplace.json +2 -2
  109. package/package.json +5 -3
  110. package/packages/pm-beads/package.json +1 -1
  111. package/packages/pm-calendar/package.json +1 -1
  112. package/packages/pm-command-kit/package.json +1 -1
  113. package/packages/pm-digital-twin/package.json +1 -1
  114. package/packages/pm-governance-audit/package.json +1 -1
  115. package/packages/pm-guide-shell/package.json +1 -1
  116. package/packages/pm-kanban/package.json +1 -1
  117. package/packages/pm-lifecycle-hooks/package.json +1 -1
  118. package/packages/pm-linked-test-adapters/package.json +1 -1
  119. package/packages/pm-search-advanced/package.json +1 -1
  120. package/packages/pm-templates/package.json +1 -1
  121. package/packages/pm-todos/package.json +1 -1
  122. package/packages/pm-vcs/package.json +1 -1
  123. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  124. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  125. package/scripts/generate-agent-capability-surfaces.mjs +20 -14
  126. package/sdk/public-surface.json +576 -12
  127. package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +0 -2
  128. package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +0 -197
  129. package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +0 -35
  130. package/dist/cli-bundle/chunks/chunk-PVRUN5ZS.js +0 -5
  131. package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +0 -20
  132. package/dist/cli-bundle/chunks/register-operations-4HTFC6J7.js +0 -2
  133. package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +0 -2
  134. package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +0 -2
  135. package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +0 -16
  136. package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +0 -2
  137. package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +0 -2
  138. package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +0 -2
  139. package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +0 -2
@@ -1,4 +1,4 @@
1
- import{$ as It,$a as se,Ga as Ct,Ma as vt,V as R,aa as At,ab as M,bb as ae,gb as ce,ja as K,kb as Ue,l as Pe,o as ie,oa as ze,ob as Ve,pa as $e,ra as Fe,rb as qe,sb as je,ub as de}from"./chunk-5AF3ZBNB.js";import{$ as xt,G as U,M as oe,O as Re,P as Me,Q as ke,R as St,Sa as Oe,V as g,X as W,Y as V,Z as b,a as Le,q as F,s as G,t as S,u as T,w as ne}from"./chunk-UI6AJ5TD.js";import{R as De,Y as f,Z as m,ba as Ne}from"./chunk-2PN4TJXH.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]="b9581c92-5e8a-589d-9681-d4d014e6902b")}catch{}})();function en(e,t="--limit"){if(e===void 0)return;let r=Number(e);if(!Number.isFinite(r)||r<0)throw new m(`${t} must be a non-negative number`,f.USAGE);return Math.floor(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]="7775a1f2-5167-5853-a2c5-a44d46f8e80e")}catch{}})();var tn=/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/,rn=/\bnpm_[A-Za-z0-9]{36}\b/,nn=/\bxox[baprs]-(?=[A-Za-z0-9-]{20,80}\b)(?=[A-Za-z0-9-]*\d)[A-Za-z0-9-]{20,80}\b/,on=/-----BEGIN (?:[A-Z0-9]+ )?PRIVATE KEY-----/,sn=/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/,Lt=/\b(?:token|secret|password|passwd|api[_-]?key)\s*[:=]\s*["']?([A-Za-z0-9+/=_-]{24,})/gi,an=[{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"}],Ye=new Map(an.map(e=>[e.action,e]));function cn(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);let r=0;for(let n of t.values()){let o=n/e.length;r-=o*Math.log2(o)}return r}function He(e,t="$",r=new WeakSet){return typeof e=="string"?[{path:t,value:e}]:typeof e!="object"||e===null?[]:r.has(e)?[]:(r.add(e),Array.isArray(e)?e.flatMap((n,o)=>He(n,`${t}[${o}]`,r)):Object.entries(e).flatMap(([n,o])=>He(o,`${t}.${n}`,r)))}function Dt(e){let t=[];for(let r of He(e)){tn.test(r.value)&&t.push({rule:"github_token",path:r.path}),rn.test(r.value)&&t.push({rule:"npm_token",path:r.path}),nn.test(r.value)&&t.push({rule:"slack_token",path:r.path}),on.test(r.value)&&t.push({rule:"private_key",path:r.path}),sn.test(r.value)&&t.push({rule:"aws_access_key",path:r.path}),Lt.lastIndex=0;for(let n of r.value.matchAll(Lt)){let o=n[1];if(cn(o)>=3.5){t.push({rule:"high_entropy_assignment",path:r.path});break}}}return t.filter((r,n,o)=>o.findIndex(i=>i.rule===r.rule&&i.path===r.path)===n)}function dn(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.",f.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 r;try{r=Dt(e.payload)}catch{return{author:t,findings:[],warnings:["secret_guard_scan_failed_open"],override_applied:!1}}if(r.length===0)return{author:t,findings:r,warnings:[],override_applied:!1};let n=[...new Set(r.map(o=>o.rule))].sort().join(",");if(e.settings.secret_guard==="block"&&e.force!==!0)throw new m(`Mutation blocked by secret guard (${n}). No detected value was logged.`,f.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:r,warnings:[`secret_guard_detected:${r.length}:rules=${n}`,...e.settings.secret_guard==="block"&&e.force===!0?["secret_guard_force_override"]:[]],override_applied:e.settings.secret_guard==="block"&&e.force===!0}}function ln(e){return Ye.has(e.trim().toLowerCase())}function un(){return[...Ye.keys()].sort((e,t)=>e.localeCompare(t))}function la(e){return Ye.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]="3ad30a32-0f83-5473-b0a3-349e271d8378")}catch{}})();function fn(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function fa(e){return fn(e).split(/[^a-z0-9]+/).filter(t=>t.length>0)}function Q(e,t){if(e.length===0&&t.length===0)return 1;if(e.length===0||t.length===0)return 0;let r=new Set(e),n=new Set(t),o=0;for(let s of r)n.has(s)&&(o+=1);let i=new Set([...r,...n]).size;return o/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]="dff9b113-2b29-5154-afbf-f191f2f556a6")}catch{}})();var mn=/\b[a-z][a-z0-9]*-\d+(?:-[a-z0-9]+)*\b/giu;function le(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function J(e){return[...new Set(le(e).match(/[\p{L}\p{N}]+/gu)??[])]}function X(e){let t=le(e);return{normalized:t,tokens:J(t),issueCodes:[...new Set(t.match(mn)?.map(r=>r.toLowerCase())??[])]}}function ue(e,t){return fe(X(e),X(t))}function fe(e,t){if(e.normalized===t.normalized)return{score:1,reason:"exact_title"};let r=new Set(e.issueCodes);return t.issueCodes.some(n=>r.has(n))?{score:.99,reason:"issue_code"}:{score:Q(e.tokens,t.tokens),reason:"title_token_jaccard"}}import pn 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]="376bb9d2-e202-57e7-86c8-d70a7d3fa7ab")}catch{}})();function me(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function _n(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,o)=>o.time-n.time)[0]?.value??e.updated_at}function Rt(e,t){let r=Math.max(1,Math.trunc(t.threshold_hours)),n=(t.now??new Date).getTime(),o=me(t.in_progress_status),i=[];for(let s of e){if(me(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=_n(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let d=Math.max(0,Math.floor((n-c)/36e5));d>=r&&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:r,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 hn(e,t,r){let n=new Map;return await Promise.all(t.filter(o=>me(String(o.status))===me(r.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await Fe(pn.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&&n.set(o.id,s)})),Rt(t,{...r,last_history_activity:o=>n.get(o.id)})}import{mkdir as gn,readFile as yn}from"node:fs/promises";import Mt 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]="71a8cd89-54fc-5f8a-b93b-9e4a79bb34b6")}catch{}})();function wn(e){let t=e.trim();if(!t)throw new m("--rollback requires a non-empty checkpoint ID",f.USAGE);if(!/^[a-zA-Z0-9._-]+$/.test(t))throw new m("--rollback checkpoint ID must match [a-zA-Z0-9._-]+",f.USAGE);return t}function En(e,t){let r=t.replace(/[-:.TZ]/g,"").slice(0,14),n=Math.random().toString(36).slice(2,8);return`${e}-${r}-${n}`}function kt(e,t){return Mt.join(e,"checkpoints",t)}function Nt(e,t,r){return Mt.join(kt(e,t),`${r}.json`)}async function bn(e,t,r,n){let o=kt(e,t);await gn(o,{recursive:!0});let i=Nt(e,t,r);return await T(i,`${JSON.stringify(n,null,2)}
1
+ import{$ as It,$a as se,Ga as Ct,Ma as vt,V as R,aa as At,ab as M,bb as ae,gb as ce,ja as K,kb as Ue,l as Pe,o as ie,oa as ze,ob as Ve,pa as $e,ra as Fe,rb as qe,sb as je,ub as de}from"./chunk-34QBIYZI.js";import{$ as xt,G as U,M as oe,O as Re,P as Me,Q as ke,R as St,Sa as Oe,V as g,X as W,Y as V,Z as b,a as Le,q as F,s as G,t as S,u as T,w as ne}from"./chunk-JDOMQ7VQ.js";import{R as De,Y as f,Z as m,ba as Ne}from"./chunk-RZU5U6Q7.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]="b9581c92-5e8a-589d-9681-d4d014e6902b")}catch{}})();function en(e,t="--limit"){if(e===void 0)return;let r=Number(e);if(!Number.isFinite(r)||r<0)throw new m(`${t} must be a non-negative number`,f.USAGE);return Math.floor(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]="7775a1f2-5167-5853-a2c5-a44d46f8e80e")}catch{}})();var tn=/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/,rn=/\bnpm_[A-Za-z0-9]{36}\b/,nn=/\bxox[baprs]-(?=[A-Za-z0-9-]{20,80}\b)(?=[A-Za-z0-9-]*\d)[A-Za-z0-9-]{20,80}\b/,on=/-----BEGIN (?:[A-Z0-9]+ )?PRIVATE KEY-----/,sn=/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/,Lt=/\b(?:token|secret|password|passwd|api[_-]?key)\s*[:=]\s*["']?([A-Za-z0-9+/=_-]{24,})/gi,an=[{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"}],Ye=new Map(an.map(e=>[e.action,e]));function cn(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);let r=0;for(let n of t.values()){let o=n/e.length;r-=o*Math.log2(o)}return r}function He(e,t="$",r=new WeakSet){return typeof e=="string"?[{path:t,value:e}]:typeof e!="object"||e===null?[]:r.has(e)?[]:(r.add(e),Array.isArray(e)?e.flatMap((n,o)=>He(n,`${t}[${o}]`,r)):Object.entries(e).flatMap(([n,o])=>He(o,`${t}.${n}`,r)))}function Dt(e){let t=[];for(let r of He(e)){tn.test(r.value)&&t.push({rule:"github_token",path:r.path}),rn.test(r.value)&&t.push({rule:"npm_token",path:r.path}),nn.test(r.value)&&t.push({rule:"slack_token",path:r.path}),on.test(r.value)&&t.push({rule:"private_key",path:r.path}),sn.test(r.value)&&t.push({rule:"aws_access_key",path:r.path}),Lt.lastIndex=0;for(let n of r.value.matchAll(Lt)){let o=n[1];if(cn(o)>=3.5){t.push({rule:"high_entropy_assignment",path:r.path});break}}}return t.filter((r,n,o)=>o.findIndex(i=>i.rule===r.rule&&i.path===r.path)===n)}function dn(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.",f.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 r;try{r=Dt(e.payload)}catch{return{author:t,findings:[],warnings:["secret_guard_scan_failed_open"],override_applied:!1}}if(r.length===0)return{author:t,findings:r,warnings:[],override_applied:!1};let n=[...new Set(r.map(o=>o.rule))].sort().join(",");if(e.settings.secret_guard==="block"&&e.force!==!0)throw new m(`Mutation blocked by secret guard (${n}). No detected value was logged.`,f.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:r,warnings:[`secret_guard_detected:${r.length}:rules=${n}`,...e.settings.secret_guard==="block"&&e.force===!0?["secret_guard_force_override"]:[]],override_applied:e.settings.secret_guard==="block"&&e.force===!0}}function ln(e){return Ye.has(e.trim().toLowerCase())}function un(){return[...Ye.keys()].sort((e,t)=>e.localeCompare(t))}function la(e){return Ye.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]="3ad30a32-0f83-5473-b0a3-349e271d8378")}catch{}})();function fn(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function fa(e){return fn(e).split(/[^a-z0-9]+/).filter(t=>t.length>0)}function Q(e,t){if(e.length===0&&t.length===0)return 1;if(e.length===0||t.length===0)return 0;let r=new Set(e),n=new Set(t),o=0;for(let s of r)n.has(s)&&(o+=1);let i=new Set([...r,...n]).size;return o/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]="dff9b113-2b29-5154-afbf-f191f2f556a6")}catch{}})();var mn=/\b[a-z][a-z0-9]*-\d+(?:-[a-z0-9]+)*\b/giu;function le(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function J(e){return[...new Set(le(e).match(/[\p{L}\p{N}]+/gu)??[])]}function X(e){let t=le(e);return{normalized:t,tokens:J(t),issueCodes:[...new Set(t.match(mn)?.map(r=>r.toLowerCase())??[])]}}function ue(e,t){return fe(X(e),X(t))}function fe(e,t){if(e.normalized===t.normalized)return{score:1,reason:"exact_title"};let r=new Set(e.issueCodes);return t.issueCodes.some(n=>r.has(n))?{score:.99,reason:"issue_code"}:{score:Q(e.tokens,t.tokens),reason:"title_token_jaccard"}}import pn 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]="376bb9d2-e202-57e7-86c8-d70a7d3fa7ab")}catch{}})();function me(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function _n(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,o)=>o.time-n.time)[0]?.value??e.updated_at}function Rt(e,t){let r=Math.max(1,Math.trunc(t.threshold_hours)),n=(t.now??new Date).getTime(),o=me(t.in_progress_status),i=[];for(let s of e){if(me(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=_n(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let d=Math.max(0,Math.floor((n-c)/36e5));d>=r&&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:r,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 hn(e,t,r){let n=new Map;return await Promise.all(t.filter(o=>me(String(o.status))===me(r.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await Fe(pn.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&&n.set(o.id,s)})),Rt(t,{...r,last_history_activity:o=>n.get(o.id)})}import{mkdir as gn,readFile as yn}from"node:fs/promises";import Mt 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]="71a8cd89-54fc-5f8a-b93b-9e4a79bb34b6")}catch{}})();function wn(e){let t=e.trim();if(!t)throw new m("--rollback requires a non-empty checkpoint ID",f.USAGE);if(!/^[a-zA-Z0-9._-]+$/.test(t))throw new m("--rollback checkpoint ID must match [a-zA-Z0-9._-]+",f.USAGE);return t}function En(e,t){let r=t.replace(/[-:.TZ]/g,"").slice(0,14),n=Math.random().toString(36).slice(2,8);return`${e}-${r}-${n}`}function kt(e,t){return Mt.join(e,"checkpoints",t)}function Nt(e,t,r){return Mt.join(kt(e,t),`${r}.json`)}async function bn(e,t,r,n){let o=kt(e,t);await gn(o,{recursive:!0});let i=Nt(e,t,r);return await T(i,`${JSON.stringify(n,null,2)}
2
2
  `),i}function Tn(e,t){if(!Array.isArray(e.items))throw new m(`Checkpoint ${t} is missing items`,f.GENERIC_FAILURE);return e.items.map(r=>{if(!r||typeof r!="object")throw new m(`Checkpoint ${t} contains an invalid item entry`,f.GENERIC_FAILURE);let n=r;if(typeof n.id!="string"||n.id.trim().length===0)throw new m(`Checkpoint ${t} contains an item entry without ID`,f.GENERIC_FAILURE);if(typeof n.target_updated_at!="string"||n.target_updated_at.trim().length===0)throw new m(`Checkpoint ${t} contains an item entry without target_updated_at`,f.GENERIC_FAILURE);return{id:n.id.trim(),target_updated_at:n.target_updated_at.trim()}})}async function Sn(e,t,r,n){let o=wn(r),i=Nt(e,t,o);if(!await F(i))throw new m(`Checkpoint ${o} not found`,f.NOT_FOUND);let s=await yn(i,"utf8"),a;try{a=JSON.parse(s)}catch(l){throw new m(`Checkpoint ${o} contains invalid JSON: ${b(l)}`,f.GENERIC_FAILURE)}if(!a||typeof a!="object")throw new m(`Checkpoint ${o} is invalid`,f.GENERIC_FAILURE);let c=a;if(c.schema_version!==n)throw new m(`Checkpoint ${o} has unsupported schema version`,f.GENERIC_FAILURE);let d=Tn(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:R(),author:typeof c.author=="string"?c.author:"unknown"}}async function xn(e,t){let r=[],n=[];for(let o of e)try{let i=await t(o.id,o.target_updated_at);r.push({id:o.id,status:"restored",changed_fields:i.changed_fields,warnings:i.warnings}),n.push(o.id)}catch(i){r.push({id:o.id,status:"failed",error:b(i)})}return{rows:r,restored_ids:n,failed_count:r.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]="ab276268-7a98-5f97-b3f5-300dfd1b5ed5")}catch{}})();function k(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t.length>0?t:null}function va(e,t){let r=k(t);return!e||!r?null:[...e.assurance_providers??[]].reverse().find(n=>k(n.definition.id)===r)??null}function In(e,t){let r=k(t);return!e||!r?null:[...e.search_providers].reverse().find(o=>(k(o.runtime_definition?.name)??k(o.definition?.name))===r)??null}function An(e,t){let r=k(t);return!e||!r?null:[...e.vector_store_adapters].reverse().find(o=>(k(o.runtime_definition?.name)??k(o.definition?.name))===r)??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]="19ff592c-0746-54e8-a304-2006f4845da2")}catch{}})();function Ot(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Be(e){if(e==="/body"||e.startsWith("/body/"))return"body";if(e==="/metadata"||e.startsWith("/metadata/")||e==="/front_matter"||e.startsWith("/front_matter/")){let r=e.replace(/^\/(?:metadata|front_matter)\/?/,"").split("/")[0];return r?Ot(r):"metadata"}let t=e.replace(/^\//,"").split("/")[0];return t?Ot(t):"root"}function pe(e,t){return t==="body"?e.body:t==="metadata"?e.metadata:t==="root"?e:e.metadata[t]}function Cn(e,t){let r=t?.windowStartIndex??0,n=t?.field;if(e.length===0||r>=e.length)return[];let o=Ct(),i=[];for(let s=0;s<e.length;s+=1){let a=e[s],c=o,d=vt(o,a.patch),l;d.ok?(l=d.document,o=l):l=c;let u=new Set;for(let p of a.patch)u.add(Be(p.path)),p.from!==void 0&&u.add(Be(p.from));let _=[...u].sort((p,h)=>p.localeCompare(h));if(s>=r)if(n!==void 0){if(!u.has(n))continue;let p={field:n,before:pe(c,n),after:pe(l,n)};i.push({index:s+1,ts:a.ts,op:a.op,author:a.author,patch_ops:a.patch.length,changed_fields:[n],changes:[p]})}else{let p=_.map(h=>({field:h,before:pe(c,h),after:pe(l,h)}));i.push({index:s+1,ts:a.ts,op:a.op,author:a.author,patch_ops:a.patch.length,changed_fields:_,changes:p})}}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]="7426082f-94a6-5b4e-9748-d3faab2fe1d4")}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]="4a376062-2e23-5991-80a5-27183909caf3")}catch{}})();var vn=new Set(["none","null","undefined"]);function $a(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)",f.USAGE)}function Ln(e){if(typeof e!="string")throw new m("--parent must be a string. Use --unset parent to clear this field.",f.USAGE);let t=e.trim();if(t.length===0)throw new m("--parent must not be empty. Use --parent none to unset.",f.USAGE);if(Pt(t))throw new m(`--parent must not use placeholder token "${t}". Use --unset parent to clear this field.`,f.USAGE);return t}function Pt(e){return vn.has(e.trim().toLowerCase())}function Dn(e,t){if(t==="strict_error")throw new m(`Parent item "${e}" was not found. Create it first or use --parent none.`,f.USAGE);return{warnings:[`validation_warning:parent_reference_missing:${e}`]}}function Rn(e,t,r){let n=ce(e,r),o=ce(t,r);if(n!==o)return;let i=t!==o||e!==n?` (normalized from parent "${t}" and item "${e}")`:"";throw new m(`Parent item "${o}" cannot be the same as item "${n}"${i}. Use --unset parent to clear this field.`,f.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]="d5003dd5-f208-5734-9711-dff935d8c851")}catch{}})();var q="-",zt=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 $t(e){let t=e.trim();if(t==="")return[];let n=(Pn(t)??t.split(",")).map(o=>o.trim()).filter(Boolean).map(o=>o.toLowerCase());return Array.from(new Set(n)).sort((o,i)=>o.localeCompare(i))}function Ft(e){if(!Array.isArray(e)||e.length===0)return[];let t=[];for(let r of e)if(typeof r=="string")for(let n of $t(r))t.push(n);return Array.from(new Set(t)).sort((r,n)=>r.localeCompare(n))}function Ut(e){return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function Mn(e){return typeof e!="string"?[]:e.split(";").map(t=>t.trim()).filter(Boolean)}function kn(e,t,r){let n=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',f.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&&!n.includes(a)&&n.push(a)}let o=[],i=n;for(let s of r??[]){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 Nn(e,t){let r=Ut(e);if(!t||t.length===0)return Array.from(new Set(r)).sort((o,i)=>o.localeCompare(i));let n=new Set(r);for(let o of Ft(t))n.add(o);return Array.from(n).sort((o,i)=>o.localeCompare(i))}function On(e,t){let r=Array.from(new Set(Ut(e))).sort((o,i)=>o.localeCompare(i));if(!t||t.length===0)return r;let n=new Set(Ft(t));return n.size===0?r:r.filter(o=>!n.has(o))}function Pn(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 Ge(e){return e.replace(/\r\n/g,`
3
3
  `)}function Vt(e){let t=Ge(e).trim();if(!t.startsWith("```"))return e;let r=t.split(`
4
4
  `);return r.length<2||r.at(-1)?.trim()!=="```"?e:r.slice(1,-1).join(`
@@ -15,4 +15,4 @@ ${i}`;continue}return null}return r}function qn(e,t){let r=Vt(e).trim();if(!r)th
15
15
  `)){let n=r.trim();if(n.length!==0)try{let o=JSON.parse(n);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=zs(o)),t.push(o))}catch{}}return t}function $s(e,t){if(typeof e.enqueued_at!="string"||e.enqueued_at.trim().length===0)return!1;let r=Date.parse(e.enqueued_at);return Number.isNaN(r)?!1:r<t}function Hr(e,t){let r=Ur(t),n=[],o=0;for(let i of e){if(JSON.stringify(i).length>xr||$s(i,r)||i.attempts>=Ir){o+=1;continue}n.push(i)}if(n.length>gr){let i=n.length-gr;return o+=i,{entries:n.slice(i),prunedCount:o}}return{entries:n,prunedCount:o}}async function Fs(e,t){let r=t.map(o=>JSON.stringify(o)).join(`
16
16
  `),n=r.length>0?`${r}
17
17
  `:"";for(let o=0;;o+=1)try{await T(yt(e),n);return}catch(i){let s=Ar[o];if(s===void 0||!Vr(i))throw i;await qr(s)}}async function Tr(e,t,r,n){return Et(async()=>{let o=await S(yt(e)),i=o===null?[]:jr(o),s=[];for(let c of i){if(r.has(c.id))continue;let d=n.get(c.id);s.push(d?{...c,attempts:d.attempts,next_attempt_after:d.next_attempt_after}:c)}let{entries:a}=Hr(s,t);return await Fs(e,a),a.length})}async function Us(e,t){let r=await S(yt(e));if(r===null||r.trim().length===0){await v(e,{pending_otel_spans:0});return}let n=jr(r),{entries:o,prunedCount:i}=Hr(n,t),s=o.filter(h=>Fr(h.next_attempt_after)).slice(0,ss);if(s.length===0){let h=i>0?await Tr(e,t,new Set,new Map):o.length;await v(e,{pending_otel_spans:h});return}let a=R(),c=new Set,d=new Map,l=0,u;await Promise.all(s.map(async h=>{try{let y=await Pr(h.endpoint,{"content-type":"application/json"},JSON.stringify(h.payload));if(y<200||y>=300)throw new Error(`local_otel_export_http_${y}`);c.add(h.id),l+=1}catch(y){u=y instanceof Error?_t(y.message,"redacted"):"local_otel_export_failed";let w=h.attempts+1;d.set(h.id,{attempts:w,next_attempt_after:$r(w)})}}));let _=await Tr(e,t,c,d),p={pending_otel_spans:_,last_otel_attempt_at:a};l>0&&(p.last_otel_success_at=a),u!==void 0?(p.last_otel_failure_at=a,p.last_otel_failure_error=u):_===0&&(p.last_otel_failure_at=void 0,p.last_otel_failure_error=void 0),await v(e,p)}async function Vs(e,t,r){try{await Ys(e,t,r)}catch{}try{await Us(e,r)}catch{}}async function qs(e,t=ps){try{let r=As(e),n=await es(r,{withFileTypes:!0}),o=Date.now()-Math.max(0,t);await Promise.all(n.filter(i=>i.isFile()&&/^\.events\.jsonl\.\d+\.\d+\.[a-f0-9]+\.tmp$/.test(i.name)).map(async i=>{let s=x.join(r,i.name);(await Sr(s)).mtimeMs<o&&await gt(s,{force:!0})}))}catch{}}async function Et(e){let t=Er.catch(()=>{}).then(e);return Er=t.catch(()=>{}),t}async function bt(e){let t=await S(Ce(e));return t===null||t.trim().length===0?[]:zr(t)}async function js(e,t,r){return Et(async()=>{let n=await bt(e),{entries:o}=wt(n,r),i=o.filter(s=>!t.has(s.event.event_id));return await Ae(e,i),i})}async function Hs(e,t,r,n){return Et(async()=>{let o=await bt(e),{entries:i}=wt(o,n),s=i.map(a=>{if(!t.has(a.event.event_id))return a;let c=a.attempts+1;return{...a,attempts:c,last_attempt_at:r,next_attempt_after:$r(c)}});return await Ae(e,s),s})}async function Ys(e,t,r){await qs(e);let n=t.trim();if(n.length===0)return;let o=await S(Ce(e));if(o===null||o.trim().length===0){await v(e,{endpoint:n,queue_entries:0});return}let i=zr(o);if(i.length===0){await v(e,{endpoint:n,queue_entries:0});return}let{entries:s,prunedCount:a}=wt(i,r);if(s.length===0){await Ae(e,[]),await v(e,{endpoint:n,queue_entries:0});return}let c=s.filter(p=>Os(p)).slice(0,cs);if(c.length===0){a>0&&await Ae(e,s),await v(e,{endpoint:n,queue_entries:s.length});return}let d=new Set(c.map(p=>p.event.event_id)),l=R(),u={"content-type":"application/json"},_=process.env.PM_TELEMETRY_INGEST_KEY?.trim();_&&(u["x-pm-telemetry-key"]=_);try{let p=await Pr(n,u,JSON.stringify({schema_version:as,events:c.map(h=>h.event)}));if(p<200||p>=300)throw new Error(`telemetry_flush_http_${p}`)}catch(p){let h=await Hs(e,d,l,r),y=p instanceof Error?_t(p.message,"redacted"):"telemetry_flush_failed";await v(e,{endpoint:n,queue_entries:h.length,last_attempted_flush_at:l,last_failed_flush_at:l,last_failed_flush_error:y});return}try{let p=await js(e,d,r);await v(e,{endpoint:n,queue_entries:p.length,last_attempted_flush_at:l,last_successful_flush_at:l,last_failed_flush_at:void 0,last_failed_flush_error:void 0})}catch(p){let h=p instanceof Error?_t(p.message,"redacted"):"telemetry_flush_failed",y=await bt(e).catch(()=>s);await v(e,{endpoint:n,queue_entries:y.length,last_attempted_flush_at:l,last_failed_flush_at:l,last_failed_flush_error:h})}}async function Bs(e){let t=Lr(e);await pt(x.dirname(t),{recursive:!0});try{return await pt(t),!0}catch(r){if(typeof r!="object"||r===null||!("code"in r)||r.code!=="EEXIST")throw r}try{let r=await Sr(t);return Date.now()-r.mtimeMs<_s?!1:(await gt(t,{recursive:!0,force:!0}),await pt(t),!0)}catch{return!1}}function Gs(e){try{Zi(e,{recursive:!0,force:!0})}catch{}}function Ws(e){Gs(Cs(e))}async function Ks(e,t,r){let n=await Bs(e);if(Ws(e),!!n)try{await Vs(e,t,r)}finally{try{await gt(Lr(e),{recursive:!0,force:!0})}catch{}}}async function sl(e=Re(process.cwd())){if(!ks())try{if(!(await M(e)).telemetry.enabled)return;let{endpoint:r,retentionDays:n}=await Ns(e);await Ks(e,r,n)}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]="a678b9f8-ba36-5127-877f-96bb4acc38c5")}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]="13c02696-29a7-598e-888a-3502fd88bfbe")}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]="a2fad90a-3575-5f3e-8cbe-ac380ac45591")}catch{}})();var Qs=3,Yr=20,Xs=.8,Js=100,Br=1e3,Gr=1e6;function Sp(e){return e===void 0?[]:[`likely_duplicates:${e.result.items.map(t=>t.id).join(",")}`]}function Wr(e){let t=e.limit??Qs,r=e.threshold??Xs;if(!Number.isSafeInteger(t)||t<0||t>Yr)throw new m(`Similarity limit must be an integer from 0 to ${Yr}.`,f.USAGE);if(!Number.isFinite(r)||r<0||r>1)throw new m("Similarity threshold must be a number from 0 to 1.",f.USAGE);return{limit:t,threshold:r}}function Zs(e){let t=e.limit??Js;if(!Number.isSafeInteger(t)||t<0||t>Br)throw new m(`Duplicate cluster limit must be an integer from 0 to ${Br}.`,f.USAGE);let r=e.since===void 0?void 0:new Date(e.since);if(r&&Number.isNaN(r.getTime()))throw new m("Duplicate cluster --since must be a valid ISO timestamp.",f.USAGE);return{limit:t,since:r}}async function ea(e,t){let r=oe(e.cwd??process.cwd(),e.pmRoot),n=await M(r),o=U(n),i=e.statuses?.map(u=>u.trim().toLowerCase()).filter(Boolean);if(e.statuses!==void 0&&i?.length===0)throw new m("Duplicate cluster statuses must include at least one lifecycle status or all.",f.USAGE);let s=Oe(n.schema),a=i?.map(u=>{if(u==="all")return u;let _=K(u,s);if(!_)throw new m(`Unknown duplicate-cluster status "${u}". Allowed: all, ${s.definitions.map(p=>p.id).join(", ")}.`,f.USAGE);return _}),c=a?.includes("all")===!0;if(c&&a?.some(u=>u!=="all"))throw new m('The "all" status cannot be combined with other statuses.',f.USAGE);let d=c?void 0:a,l=d?new Set(d):void 0;return{items:(await de(r,n.item_format,o.type_to_folder,void 0,n.schema)).filter(u=>(!l||l.has(u.status))&&(!t||new Date(u.created_at).getTime()>=t.getTime())).sort((u,_)=>u.id.localeCompare(_.id)).map(u=>({item:u,prepared:X(u.title)})),statuses:d}}function Kr(e,t=Gr){let r=new Set,n=[new Map,new Map,new Map];for(let[o,i]of e.entries()){let s=[[i.prepared.normalized],i.prepared.issueCodes,i.prepared.tokens];for(let[a,c]of s.entries())for(let d of c){let l=n[a].get(d)??[];for(let u of l)r.add(`${u}:${o}`);if(r.size>t)throw new m(`Duplicate sweep exceeded ${Gr} candidate pairs; narrow it with statuses or since.`,f.CONFLICT,{code:"duplicate_sweep_cost_limit",required:"Narrow the batch duplicate query until its deterministic candidate set fits the disclosed safety bound."});l.push(o),n[a].set(d,l)}}return r}var xp={buildDuplicateClusters:Xr,collectDuplicateCandidatePairs:Kr,createDuplicateUnionFind:Qr};function Qr(e){let t=Array.from({length:e},(n,o)=>o);return{parent:t,findRoot:n=>{let o=n;for(;t[o]!==o;)o=t[o];for(;t[n]!==n;){let i=t[n];t[n]=o,n=i}return o}}}function ta(e,t,r,n){let o=[];for(let i of t){let[s,a]=i.split(":").map(u=>Number.parseInt(u,10)),c=fe(e[s].prepared,e[a].prepared);if(c.score<r)continue;let d=n.findRoot(s),l=n.findRoot(a);d!==l&&(n.parent[l]=d),o.push({left_id:e[s].item.id,right_id:e[a].item.id,...c})}return o}function Xr(e,t,r,n){let o=new Map;for(let i of e.keys()){let s=r.findRoot(i),a=o.get(s)??[];a.push(i),o.set(s,a)}return[...o.values()].filter(i=>i.length>1).map(i=>{let s=new Set(i.map(c=>e[c].item.id)),a=t.filter(c=>s.has(c.left_id)&&s.has(c.right_id)).sort((c,d)=>d.score-c.score||c.left_id.localeCompare(d.left_id)||c.right_id.localeCompare(d.right_id));return{id:e[i[0]].item.id,items:i.map(c=>{let d=e[c].item;return{id:d.id,title:d.title,status:d.status,type:d.type}}),matches:a,max_score:a[0]?.score??0}}).sort((i,s)=>s.max_score-i.max_score||i.id.localeCompare(s.id)).slice(0,n)}function ra(e,t,r,n,o){return t.filter(i=>!r.has(i.id)).map(i=>({id:i.id,title:i.title,status:i.status,type:i.type,...ue(e,i.title)})).filter(i=>i.score>=n).sort((i,s)=>s.score-i.score||i.id.localeCompare(s.id)).slice(0,o)}async function na(e,t={}){let r=e.title.trim();if(r.length===0)throw new m("Similarity candidate title must not be empty.",f.USAGE);let{limit:n,threshold:o}=Wr(t),i=oe(t.cwd??process.cwd(),t.pmRoot),s=await M(i),a=U(s),c=await Ve(i,Object.values(a.type_to_folder)),d=J(r),l=c&&d.length>0?await Ue({pmRoot:i,expectedSourceCursor:c.source_cursor,query:d.map(p=>`"${p.replaceAll('"','""')}"`).join(" OR "),limit:Math.max(n*10,50)}):null,u=l===null?await de(i,s.item_format,a.type_to_folder,void 0,s.schema):l.items,_=ra(r,u,new Set(e.excludeIds??[]),o,n);return{items:_,count:_.length,threshold:o,source:l?"persistent_index":"metadata_fallback"}}async function Ip(e={}){let{threshold:t}=Wr({...e,limit:void 0}),{limit:r,since:n}=Zs(e),{items:o,statuses:i}=await ea(e,n),s=Kr(o),a=Qr(o.length),c=ta(o,s,t,a),d=Xr(o,c,a,r);return{clusters:d,count:d.length,threshold:t,source:"metadata_scan",filters:{statuses:i??null,since:e.since??null},cost:{item_count:o.length,candidate_pairs:s.size,scored_pairs:s.size}}}async function Ap(e,t){if(t.mode==="off")return;let r=await na(e,t);if(r.count===0)return;let n=t.mode==="strict"&&t.allowDuplicate===!0;if(t.mode==="strict"&&!n){let o=r.items.map(i=>`${i.id} (${i.status}): ${i.title}`).join("; ");throw new m(`Likely duplicate item(s) found: ${o}. Reuse the canonical item or pass --allow-duplicate with explicit intent.`,f.CONFLICT,{code:"likely_duplicate",required:"Reuse an existing item, or explicitly acknowledge the duplicate with --allow-duplicate.",recovery:{suggested_flags:["--allow-duplicate"]}})}return{mode:t.mode,bypassed:n,result: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]="412fc2d2-daee-5d87-82ab-5411a1503087")}catch{}})();function Lp(e,t){let r=t??{};return e.filter(n=>r[n.id]!==n.updated_at).map(n=>n.id).sort((n,o)=>n.localeCompare(o))}export{En as a,bn as b,Sn as c,xn as d,va as e,In as f,An as g,Be as h,Cn as i,$a as j,Ln as k,Pt as l,Dn as m,Rn as n,$t as o,Mn as p,kn as q,Nn as r,On as s,qn as t,Yn as u,Bn as v,Wn as w,Kn as x,Qn as y,Zn as z,Wa as A,ro as B,ec as C,so as D,co as E,en as F,lo as G,uo as H,he as I,Oo as J,Tc as K,Ke as L,Jt as M,Qe as N,Go as O,Wo as P,Ic as Q,Zt as R,j as S,Je as T,et as U,ct as V,Pc as W,dt as X,Se as Y,sr as Z,xe as _,lt as $,ut as aa,ft as ba,mt as ca,fr as da,mr as ea,nd as fa,an as ga,Dt as ha,dn as ia,ln as ja,un as ka,la,fa as ma,Q as na,le as oa,J as pa,X as qa,ue as ra,fe as sa,Rt as ta,hn as ua,Hi as va,Gi as wa,Ki as xa,Qi as ya,as as za,Ir as Aa,Es as Ba,sl as Ca,Lp as Da,Sp as Ea,xp as Fa,na as Ga,Ip as Ha,Ap as Ia};
18
- //# sourceMappingURL=chunk-3TKWMNKF.js.map
18
+ //# sourceMappingURL=chunk-PRHY2IMX.js.map
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a54549aa-2f6c-5092-a3eb-5b36ee698ea4")}catch{}})();var G=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],ze=2,$e=Object.freeze({migration:"schema",validation:"schema"}),On=Object.freeze({version:ze,capabilities:[...G],legacy_aliases:{...$e}}),ae=["off","warn","enforce"],ce=["off","warn","enforce"],ue=["none","restricted","strict"],An=["block","warn"],de=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore","services.assuranceprovider"],le=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function fe(){return{mode:"off",trust_mode:"off",require_provenance:!1,trusted_extensions:[],default_sandbox_profile:"none",allowed_extensions:[],blocked_extensions:[],allowed_capabilities:[],blocked_capabilities:[],allowed_surfaces:[],blocked_surfaces:[],allowed_commands:[],blocked_commands:[],allowed_actions:[],blocked_actions:[],allowed_services:[],blocked_services:[],extension_overrides:[]}}(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]="f6ab5bae-53b3-5feb-b89f-46e64afe7058")}catch{}})();var Xe=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],wn=Xe,Tn=["draft","open","in_progress","blocked","closed","canceled"],kn=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],xn=["string","number","boolean","string_array","array","object"],Rn=["create","update","update_many","list","search","calendar","context"],Nn=["allow","warn","reject"],In=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],Cn=["project","global"],vn=["low","medium","high","critical"],Dn=["low","medium","high","critical"],Mn=["low","medium","high"];var Un=["minimal","default","strict","custom"],Ln=["none","warn","strict"],Pn=["progressive","strict"],jn=["off","warn","strict"],Vn=["off","warn","strict"];var Fn=["daily","weekly","monthly","yearly"],Ye=["mon","tue","wed","thu","fri","sat","sun"];function Bn(e){return Ye.indexOf(e)}var Gn=["draft","research","review","approved","executing","paused","completed","superseded"],Kn=["pending","in_progress","completed","blocked","skipped","superseded"],zn=["codex","claude-code","cursor","generic"],$n=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],Xn=["brief","standard","deep","full"],Yn=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];(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]="45e1dcb9-d2d6-52d7-b0b0-a57556a3fb03")}catch{}})();var qe=Object.freeze([{id:"draft",roles:["draft"]},{id:"open",roles:["active","default_open"]},{id:"in_progress",aliases:["in-progress"],roles:["active"]},{id:"blocked",roles:["blocked"]},{id:"closed",roles:["terminal","terminal_done","default_close"]},{id:"canceled",aliases:["cancelled"],roles:["terminal","terminal_canceled","default_cancel"]}]),We=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),Qn=".agents/pm",Jn="settings.json";var Qe=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],Je=["decisions","events","reminders","milestones","meetings","plans"],Hn=[...Qe,...Je],Zn={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},He=["goal","objective","value","impact","outcome","why_now","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","unblock_note","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result"],eo=["id","title","description","type","pm_format_version","source_type","type_options","status","priority","tags","created_at","updated_at","deadline","reminders","events","closed_at","completed_at","assignee","claim_principal","source_owner","author","estimated_minutes","acceptance_criteria","design","external_ref","definition_of_ready","order",...He,"affected_version","fixed_version","component","regression","customer_impact","dependencies","comments","notes","learnings","files","tests","test_runs","docs","close_reason","duplicate_of","plan_mode","plan_scope","plan_harness","plan_resume_context","plan_validation","plan_decisions","plan_discoveries","plan_steps"],Ze={minimal:{ownership_enforcement:"none",create_mode_default:"progressive",close_validation_default:"off",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!1,duplicate_detection_mode:"off",duplicate_detection_threshold:.8,duplicate_detection_limit:3},default:{ownership_enforcement:"warn",create_mode_default:"progressive",close_validation_default:"warn",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3},strict:{ownership_enforcement:"strict",create_mode_default:"strict",close_validation_default:"strict",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"strict",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3}},et=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],K={blocked_reason:["no active blocker because work is closed","work is closed"],resolution:["closed with implementation evidence","closed with verification evidence","work completed and recorded","work is closed"],actual_result:["closed and recorded","work completed","work completed and recorded"]};function _e(e){return e?[...e]:void 0}var to={version:1,id_prefix:"pm-",ids:{token_length:4},author_default:"",agent_identity:{probes_enabled:!0,identity_vocabulary:{version:1,aliases:{}},harness_signals:[]},mutation_guard:{require_attributed_author:!1,secret_guard:"advise",stale_in_progress_hours:72},item_format:"toon",locks:{ttl_seconds:1800,wait_ms:3e3},checkpoints:{retention_days:14},output:{default_format:"toon"},ux:{deprecation_hints:!0},history:{missing_stream:"auto_create",compact_policy:{enabled:!1,max_entries:500,trigger:"health_warn"}},validation:{sprint_release_format:"warn",parent_reference:"warn",metadata_profile:"core",metadata_required_fields:[],lifecycle_stale_blocker_reason_patterns:[...et],lifecycle_closure_like_blocked_reason_patterns:[...K.blocked_reason],lifecycle_closure_like_resolution_patterns:[...K.resolution],lifecycle_closure_like_actual_result_patterns:[...K.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...Ze.minimal},workflow:{definition_of_done:[]},testing:{record_results_to_items:!1},telemetry:{enabled:!0,first_run_prompt_completed:!1,capture_level:"redacted",endpoint:"https://pm-cli.unbrained.dev/v1/events",installation_id:"",retention_days:365},agent_guidance:{prompt_completed:!1,declined:!1,declined_at:"",template_version:1,last_checked_files:[]},item_types:{definitions:[]},schema:{version:1,files:{types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"},statuses:qe.map(e=>({...e,aliases:_e(e.aliases),roles:_e(e.roles)})),fields:[],workflow:{...We},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:fe()},search:{score_threshold:0,hybrid_semantic_weight:.7,max_results:50,embedding_model:"",embedding_batch_size:32,embedding_timeout_ms:3e4,scanner_max_batch_retries:3,provider:"",mutation_refresh_policy:"semantic_configured",query_expansion:{enabled:!1,provider:""},rerank:{enabled:!1,model:"",top_k:20}},providers:{openai:{base_url:"",api_key:"",model:""},ollama:{base_url:"",model:""}},context:{default_depth:"brief",activity_limit:10,stale_threshold_days:7,sections:{hierarchy:!0,activity:!0,progress:!0,recently_created:!0,unparented:!0,blockers:!0,files:!0,workload:!0,staleness:!0,tests:!0}},vector_store:{adapter:"",collection_name:"pm_items",qdrant:{url:"",api_key:""},lancedb:{path:""}}},no={metadata:{},body:""},m={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},oo=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",init_gitignore_unwritable:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(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]="a19ff5c0-2c4d-5576-a551-cab35276fdc3")}catch{}})();var p=class extends Error{exitCode;code;context;constructor(t,n,o={}){super(t),this.name="PmCliError",this.exitCode=n,this.context=o,this.code=o.code}};(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]="9afc5057-afcd-5d6c-a4c1-c2883640fc50")}catch{}})();var N=[...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-pbyu"})),...[["extension list","extension catalog"],["extension scaffold","extension init"],["package list","package catalog"],["package scaffold","package init"],["packages list","packages catalog"],["packages scaffold","packages init"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-ya7x55"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([e,t])=>({alias:e,canonical:"list",canonical_argv:["list","--status",t],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"}))],io=Object.fromEntries(N.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function ao(e){let t=e.trim().toLowerCase();return N.find(n=>n.alias===t)}function co(e){return`Deprecated command \`${e.alias}\`; use \`pm ${e.canonical_argv.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]="d05ce92b-bee8-5cce-afc2-8c7901306a30")}catch{}})();var tt=[...G],nt=[...le],ot=[...ae],_o=[...ce],po=[...ue],rt=[...de],I=["init","config","extension","package","packages","install","upgrade","create","item","copy","focus","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","aggregate","context","ctx","get","graph","search","duplicates","eval","next","history","events","history-redact","history-repair","history-compact","history-author-acknowledge","merge","schema","profile","activity","restore","update","update-many","close","close-many","delete","append","comments","notes","learnings","files","docs","deps","plan","test","test-all","telemetry","stats","health","validate","assurance","gc","workspace","contracts","claim","release","start-task","pause-task","close-task","meet","event","remind","help"],mo=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],st=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],pe={help:"Commander help rendering has no SDK operation result.",item:"The item namespace only groups lifecycle subcommands already exposed as actions.",packages:"The plural package alias only renders package-oriented help."},C=Object.freeze(I.flatMap(e=>e in pe?[]:e==="extension"||e==="package"?[...st.map(t=>`${e}-${t}`),e]:[e])),it=Object.freeze(N.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&C.includes(e.alias)).map(e=>e.alias)),go=Object.freeze(C.filter(e=>!it.includes(e)));function yo(e=I,t=C,n=pe){let o=new Set(t),r=new Set(e);return{missing_cli_actions:e.filter(s=>!o.has(s)&&n[s]===void 0),waived_cli_actions:e.filter(s=>!o.has(s)&&n[s]!==void 0),stale_waivers:Object.keys(n).filter(s=>!r.has(s)||o.has(s))}}function ho(e){return C.includes(e)}function bo(e){return tt.includes(e)}function Eo(e){return nt.includes(e)}function Oo(e){return ot.includes(e)}function Ao(e){return rt.includes(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]="810d42b5-98f4-57a7-bdd9-2dfa1b2b1c03")}catch{}})();var at=new Set(["applied_bound","completeness","budget_retention_policy","continuation_contract","continuation_kind","continuation_path","filters","omission_receipt","output_budget_truncation","projection","read_output","read_session","row_contract","sorting"]);function E(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function me(e,t){let n=e;for(let o of t.split("."))if(Array.isArray(n)){if(!/^\d+$/u.test(o))return;n=n[Number(o)]}else{if(!E(n))return;n=n[o]}return n}function z(e,t,n){let o=t.split("."),r=(s,a)=>{if(a===o.length)return n;let i=o[a];if(Array.isArray(s)){let u=Number(i),l=[...s];return l[u]=r(s[u],a+1),l}let d=s;return{...d,[i]:r(d[i],a+1)}};return r(e,0)}function ge(e,t,n){let o=A(e).find(s=>s.path===t);if(!o)return e;let r=Array.isArray(o.value)?o.value.slice(n):Object.fromEntries(Object.entries(o.value).slice(n));return z(e,t,r)}function v(e){let t=e.row_contract;return E(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):Object.entries(e).filter(([,n])=>Array.isArray(n)).map(([n])=>n)}function ct(e){let t=e.row_contract;return E(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):v(e)}function O(e){return v(e).flatMap(t=>{let n=me(e,t);return Array.isArray(n)||E(n)?[{path:t,value:n}]:[]})}function A(e){return ct(e).flatMap(t=>{let n=me(e,t);return Array.isArray(n)||E(n)?[{path:t,value:n}]:[]})}function D(e){let t=O(e),n=new Set(t.map(r=>r.path)),o=(r,s)=>{if(Array.isArray(r)){n.has(s)||t.push({path:s,value:r}),r.forEach((a,i)=>o(a,`${s}.${i}`));return}if(E(r))for(let[a,i]of Object.entries(r))s.length===0&&at.has(a)||o(i,s.length===0?a:`${s}.${a}`)};return o(e,""),t}function M(e){return O(e).reduce((t,n)=>t+(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length),0)}function T(e,t){let n=e;for(let o of O(n)){let r=Array.isArray(o.value)?o.value.map((s,a)=>t(s,o.path,a)):Object.fromEntries(Object.entries(o.value).map(([s,a],i)=>[s,t(a,o.path,i)]));n=z(n,o.path,r)}return n}function ye(e,t){let n=e,o=!1;for(let r of O(n)){let s=Array.isArray(r.value)?r.value:Object.entries(r.value);if(s.length<=t)continue;o=!0;let a=Array.isArray(r.value)?s.slice(0,t):Object.fromEntries(s.slice(0,t));n=z(n,r.path,a)}return{result:n,truncated: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]="642f6dec-c0b2-5377-a401-dfa4f8ef6a2a")}catch{}})();var $=256,X=1e4,ut=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,dt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u,lt=new Set(["version","id","token_budget","spent_tokens","seen_item_ids"]),ft=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&ut.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=$,reason:`token_budget must be a safe integer of at least ${$}.`},{valid:e=>Number.isSafeInteger(e.spent_tokens)&&e.spent_tokens>=0&&e.spent_tokens<=e.token_budget,reason:"spent_tokens must be a non-negative safe integer no larger than token_budget."},{valid:e=>Array.isArray(e.seen_item_ids)&&e.seen_item_ids.length<=X&&e.seen_item_ids.every(t=>typeof t=="string"&&dt.test(t)),reason:`seen_item_ids must contain at most ${X} portable item identifiers.`}];function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function U(e){throw new p(`--output-session ${e}`,m.USAGE,{code:"invalid_read_output_session",field:"outputSession"})}function P(e){if(e===void 0)return;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{U("must be a valid JSON object.")}L(t)||U("must be a JSON object.");let n=Object.keys(t).filter(s=>!lt.has(s));n.length>0&&U(`contains unknown field "${n.sort()[0]}".`);let o=ft.find(s=>!s.valid(t));o!==void 0&&U(o.reason);let r=[...new Set(t.seen_item_ids)].sort();return{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:r}}function he(e){if(L(e))return typeof e.id=="string"?e.id:typeof e.item_id=="string"?e.item_id:L(e.item)&&typeof e.item.id=="string"?e.item.id:void 0}function _t(e){let t=new Set,n=0;for(let o of O(e)){let r=Array.isArray(o.value)?o.value:Object.values(o.value);for(let s of r){if(!L(s))continue;if(typeof s.context_ref=="string"){n+=1;continue}let a=he(s);a!==void 0&&t.add(a)}}return{deliveredIds:t,suppressedRepeatCount:n}}function be(e,t){let n=new Set(t.seen_item_ids);return T(e,o=>{let r=he(o);return r!==void 0&&n.has(r)?{id:r,context_ref:`session:${t.id}:${r}`}:o})}function Y(e,t){let{deliveredIds:n,suppressedRepeatCount:o}=_t(e),r=new Set(t.seen_item_ids),s=[...n].filter(g=>!r.has(g)).sort(),a=s.slice(0,X-t.seen_item_ids.length),i=[...t.seen_item_ids,...a].sort(),d=s.length-a.length,u={contract_version:1,id:t.id,measurement_scope:"complete_read_envelope",estimator:"ceil(utf8_bytes / 4)",token_budget:t.token_budget,spent_before_tokens:t.spent_tokens,spent_this_call_tokens:0,charged_this_call_tokens:0,spent_total_tokens:t.spent_tokens,remaining_tokens:t.token_budget-t.spent_tokens,exhausted:!1,seen_before_count:t.seen_item_ids.length,new_item_count:n.size,...d===0?{}:{seen_item_overflow_count:d},suppressed_repeat_count:o,reference_format:"session:<session-id>:<item-id>",restore_reference_with:"pm get <item-id> --brief",next_state:{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:i}},l={...e,read_session:u},c=g=>{u.spent_this_call_tokens=g,u.charged_this_call_tokens=Math.min(t.token_budget-t.spent_tokens,g),u.spent_total_tokens=Math.min(t.token_budget,t.spent_tokens+u.charged_this_call_tokens),u.remaining_tokens=Math.max(0,t.token_budget-u.spent_total_tokens),u.exhausted=u.remaining_tokens<$,u.next_state.spent_tokens=u.spent_total_tokens},_=0,f=0;for(let g=0;g<8;g+=1){c(_);let R=Math.ceil(Buffer.byteLength(JSON.stringify(l),"utf8")/4);if(R===_)return l;f=Math.max(f,R),_=R}return c(f),l}function Ee(e){return Math.max(0,e.token_budget-e.spent_tokens)}(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]="23b3a820-f205-506b-9507-dbd60087f62e")}catch{}})();var pt=["full","compact","brief","summary","counts"],Io=["mutation","read","discovery","governance"],mt=new Set(["append","claim","close","close-many","close-task","comments","config","copy","create","delete","docs","event","files","focus","history-author-acknowledge","history-compact","history-redact","history-repair","init","item","learnings","meet","notes","pause-task","release","remind","restore","schema","start-task","update","update-many"]),gt=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),yt=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),ht={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},bt=3,Et=2;function Ot(e){let[t=""]=e.trim().split(/\s+/u);return mt.has(t)?"mutation":gt.has(t)?"discovery":yt.has(t)?"governance":"read"}function Oe(e,t=Ot(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let o=ht[t];return At({command:n,budget_class:t,default_max_estimated_tokens:o,default_max_estimated_tokens_by_format:{toon:o,json:Math.ceil(o*bt/Et)},degradation_ladder:pt,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function At(e){if(!Number.isSafeInteger(e.default_max_estimated_tokens)||e.default_max_estimated_tokens<=0)throw new RangeError("default_max_estimated_tokens must be a positive safe integer");for(let[t,n]of Object.entries(e.default_max_estimated_tokens_by_format))if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`default_max_estimated_tokens_by_format.${t} must be a positive safe integer`);return e}var St=I.map(e=>Oe(e)),wt=new Map(St.map(e=>[e.command,e]));function Ae(e,t={}){let n=e.trim().replace(/\s+/gu," "),[o]=n.split(" "),r=wt.get(o);return r?{...r,command:n}:t.generateFallback?Oe(n):null}function Co(e){return Math.ceil(Math.max(0,e)/4)}import{createHash as hn}from"node:crypto";import Tt 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]="83232698-197a-5aef-be7c-aa37f3c56822")}catch{}})();function kt(e){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return e.toString();if(e===void 0)return"undefined";if(typeof e=="symbol")return e.toString();if(typeof e=="function")return`[function:${e.name||"anonymous"}]`}function xt(e){let t=Object.keys(e).sort(),n={};for(let o of t){let r=e[o];r!==void 0&&(n[o]=j(r))}return n}function j(e){let t=kt(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(o=>j(o));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let o=n.toJSON();if(o!==e)return j(o)}return xt(e)}function V(e){return JSON.stringify(j(e))}function Se(e,t,n,o){for(let r=0;r<t.length;r+=1)if(!n.has(r)&&o(e,t[r]))return n.add(r),!0;return!1}function Rt(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function Nt(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function It(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let n=[...t],o=new Set;for(let r of e)if(!Se(r,n,o,k))return!1;return!0}function Ct(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let n=[...t.entries()],o=new Set;for(let[r,s]of e.entries())if(!Se([r,s],n,o,([i,d],[u,l])=>k(i,u)&&k(d,l)))return!1;return!0}function vt(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,o)=>k(n,t[o]))}function Dt(e,t){let n=Object.keys(e).sort((r,s)=>r.localeCompare(s)),o=Object.keys(t).sort((r,s)=>r.localeCompare(s));if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1){let s=n[r];if(s!==o[r]||!k(e[s],t[s]))return!1}return!0}var Mt=[Rt,Nt,It,Ct,vt];function k(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let n of Mt){let o=n(e,t);if(o!==void 0)return o}return Dt(e,t)}function Mo(e){return Tt.createHash("sha256").update(e,"utf8").digest("hex")}function Uo(e,t){let n={};for(let r of t){let s=e[r];s!==void 0&&(n[r]=s)}let o=Object.keys(e).filter(r=>!t.includes(r)).sort((r,s)=>r.localeCompare(s));for(let r of o){let s=e[r];s!==void 0&&(n[r]=s)}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]="737ac274-c165-5d1a-8b8e-cb5d57a81c46")}catch{}})();var Ut=8,Lt=64;function W(e){return Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4)}function Pt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function q(e,t){return typeof e=="string"?e.length<=240?e:(t.compacted=!0,`${e.slice(0,240)}\u2026`):Array.isArray(e)?e.map(n=>q(n,t)):Pt(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>[n,q(o,t)])):e}function h(e,t){let n=t.estimated_tokens;for(let o=0;o<Ut;o+=1){t.estimated_tokens=n;let r=W(e);if(r===n)return;n=r}t.estimated_tokens=n}function jt(e,t,n,o){for(let r=0;r<Lt;r+=1){if(h(e,t),t.estimated_tokens<=n)return;let s=D(e).filter(i=>(Array.isArray(i.value)?i.value.length:Object.keys(i.value).length)>Math.max(1,o.get(i.path)??0)).map(i=>({collection:i,length:Array.isArray(i.value)?i.value.length:Object.keys(i.value).length})).sort((i,d)=>d.length-i.length||i.collection.path.localeCompare(d.collection.path))[0]?.collection;if(!s)return;let a=Math.max(1,o.get(s.path)??0);if(Array.isArray(s.value))s.value.splice(-Math.min(s.value.length-a,Math.max(1,Math.ceil(s.value.length/2))));else{let i=Object.keys(s.value);for(let d of i.slice(-Math.min(i.length-a,Math.max(1,Math.ceil(i.length/2)))))delete s.value[d]}t.rows_compacted=!0,t.compacted_row_paths=[...new Set([...t.compacted_row_paths??[],s.path])].sort((i,d)=>i.localeCompare(d)),e.has_more=!0,e.truncated=!0,typeof e.count=="number"&&(e.count=M(e))}}function we(e,t,n,o=new Map){let r={compacted:!1},s=q(e,r);return t.strings_compacted=r.compacted,s.read_output=t,jt(s,t,n,o),h(s,t),s}import{createHash as Vt}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]="d3329fac-693d-566c-a30a-43f8fb37938f")}catch{}})();var Q=1,ke=4096,Ft=/^[A-Za-z0-9_-]+$/;function Te(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function Ko(e,t){let n=new Set;for(let o of t)if(o.cursor_semantics==="presentation"){n.add(Te(o.flag));for(let r of o.aliases??[])n.add(Te(r))}return Object.fromEntries(Object.entries(e).filter(([o])=>!n.has(o)))}function zo(e,t){return Vt("sha256").update(e).update("\0").update(V(t)).digest("hex").slice(0,24)}function J(e,t,n,o){return Buffer.from(JSON.stringify({version:Q,fingerprint:e,after_id:t,...n===void 0?{}:{after_index:n},...o===void 0?{}:{snapshot:o}})).toString("base64url")}function b(e){return new p(e,m.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function Bt(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===Q&&typeof t.fingerprint=="string"&&typeof t.after_id=="string"&&t.after_id.length>0&&(t.after_index===void 0||Number.isSafeInteger(t.after_index)&&t.after_index>=0)&&(t.snapshot===void 0||typeof t.snapshot=="string"&&t.snapshot.length>0)}function H(e){if(typeof e!="string")throw b("Query cursor is malformed.");let t=e.trim();if(t.length===0||t.length>ke||!Ft.test(t))throw b("Query cursor is malformed.");let n;try{n=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw b("Query cursor is malformed.")}if(!Bt(n))throw b("Query cursor version or payload is unsupported.");return n}function Z(e,t){let n=H(e);if(n.fingerprint!==t)throw b(`Query cursor does not match the current filters, sort, or query (${n.fingerprint} != ${t}).`);return{after_id:n.after_id,...n.after_index===void 0?{}:{after_index:n.after_index},...n.snapshot===void 0?{}:{snapshot:n.snapshot}}}function $o(e,t){return Z(e,t).after_id}function Gt(e,t,n,o){if(t===void 0)return 0;let r=Z(t,n),s=e.findIndex(a=>o(a)===r.after_id);if(s<0){if(r.after_index!==void 0)return Math.min(r.after_index,e.length);throw b(`Query cursor item ${r.after_id} is no longer present in this result set.`)}return s+1}function Xo(e,t){if(t.cursor!==void 0&&Z(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw b("Query cursor does not match the requested snapshot.");let n=Gt(e,t.cursor,t.fingerprint,t.readId),o=e.slice(n,n+t.limit),r=o.length>0&&n+o.length<e.length,s=o.at(-1);return{rows:o,has_more:r,...r&&s!==void 0?{next_cursor:J(t.fingerprint,t.readId(s),n+o.length-1,t.snapshot)}:{}}}var Yo=Object.freeze({version:Q,max_length:ke});(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]="b3c001df-9891-5cf7-990b-8d9da7b51801")}catch{}})();var S=["include","amount","cost","encoding"],Me=["list","context","search","get","next","health","deps","graph","history","activity","validate","events","contracts","comments","notes","files","docs","stats","aggregate","package-catalog","package-manage","comments-audit","assurance"],Ue=["canonical","legacy","intent","default"],oe={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},or=Object.freeze(S.map(e=>oe[e])),rr=Object.freeze(["--output-session","--output-cursor","--output-row-contract"]),Le={list:{include:["--brief","--compact","--fields","--full"],amount:["--after","--limit","--no-truncate"],cost:["--token-budget"],encoding:["--format","--stream"]},context:{include:["--fields","--section"],amount:["--after","--depth","--limit"],cost:["--token-budget"],encoding:["--format"]},search:{include:["--compact","--fields","--full"],amount:["--after","--limit"],cost:["--token-budget"],encoding:["--format"]},get:{include:["--fields","--full"],amount:["--depth"],cost:["--token-budget"],encoding:["--format"]},next:{amount:["--blocked-limit","--limit"],cost:["--token-budget"],encoding:["--format"]},health:{include:["--brief","--check-only","--full","--summary"]},deps:{include:["--collapse","--full","--summary"],amount:["--edge-limit","--max-depth","--node-limit"],cost:["--token-budget"],encoding:["--format"]},graph:{include:["--full","--summary"],amount:["--after","--limit","--max-depth","--max-paths"]},history:{include:["--compact","--full"],amount:["--limit"],encoding:["--format"]},activity:{include:["--compact","--full"],amount:["--limit","--unbounded"],encoding:["--stream"]},validate:{include:["--counts","--full"]},events:{include:["--full"],amount:["--limit"],encoding:["--follow"]},contracts:{include:["--full","--summary"]},comments:{amount:["--limit"]},notes:{amount:["--limit"]},files:{amount:["--limit","--no-truncate","--offset"]},docs:{},stats:{},aggregate:{},"package-catalog":{},"package-manage":{},"comments-audit":{},assurance:{}},Pe=new Set(["--collapse","--fields","--section"]),re=Object.freeze({"--after":"--after retains cursor-position semantics; use --output-limit <n> separately to bound returned rows.","--check-only":"--check-only retains health side-effect semantics; --output-include does not suppress vector refresh.","--collapse":"--collapse retains dependency grouping semantics; --output-include does not replace it.","--depth":"--depth retains traversal or detail-depth semantics; --output-limit does not replace it.","--follow":"--follow retains event-tail semantics; --output-format does not enable following.","--max-depth":"--max-depth retains graph traversal-depth semantics; --output-limit does not replace it.","--max-paths":"--max-paths retains graph path-search semantics; use --output-limit separately to bound returned rows.","--no-truncate":"--no-truncate is a compatibility alias; prefer --output-limit unbounded.","--offset":"--offset retains positional pagination semantics; use --output-limit separately to bound returned rows.","--stream":"--stream retains command streaming semantics; --output-format selects only static result encoding.","--unbounded":"--unbounded is a compatibility alias; prefer --output-limit unbounded."});function se(e){return e.slice(2).replaceAll("-","_")}function Kt(e,t){let n=re[e];if(n!==void 0)return n;let o=t==="include"?Pe.has(e)?"<csv>":se(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${oe[t]} ${o}.`}function zt(e){let t=Le[e],n=Object.freeze(Object.fromEntries(S.map(o=>[o,Object.freeze({dimension:o,canonical_option:oe[o],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[o]??[]).map(r=>Object.freeze({flag:r,semantics:re[r]===void 0?"replacement":"behavior_preserving",migration_hint:Kt(r,o),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:Ue,budget_retention_policy:e==="assurance"?"verdict_priority":"ordered_prefix"})}var $t=Object.freeze(Me.map(zt)),Xt=new Map($t.map(e=>[e.command,e]));function x(e,t={}){let n=e.trim().toLowerCase().replaceAll(/\s+/gu," "),r=n==="package catalog"||n==="packages catalog"||n==="package-catalog"||(n==="package"||n==="packages"||n==="extension")&&(t.catalog===!0||t.target==="catalog"||t.action==="catalog")?"package-catalog":n==="package manage"||n==="package-manage"?"package-manage":n.split(" ")[0],s=r.startsWith("list-")?"list":r==="ctx"?"context":r;return Me.includes(s)?s:void 0}var Yt=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],qt={comments:["add","body","stdin","file","edit","delete"],notes:["add","addJson","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"],"package-catalog":["activate","adopt","adoptAll","deactivate","doctor","init","install","manage","migrate","reload","scaffold","uninstall"]};function Wt(e){return Yt.some(t=>e[t]!==void 0)}var Qt=[{keys:["outputInclude","output_include"],valid:e=>F(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||w(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>e==="unbounded"||w(e)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputFormat","output_format"],valid:e=>e==="toon"||e==="json",message:"--output-format must be toon or json."},{keys:["outputSession","output_session"],valid:e=>(P(e),!0),message:"--output-session must be a valid session-state object."},{keys:["outputCursor","output_cursor"],valid:e=>typeof e=="string"&&e.trim().length>0,message:"--output-cursor requires a non-empty continuation cursor."}];function sr(e,t){if(!Wt(t))return;let n=x(e,t);if(!n)throw new p(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,m.USAGE);if((qt[n]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new p(`Universal output controls cannot be combined with a ${n} mutation.`,m.USAGE);for(let o of Qt){let r=o.keys.map(s=>t[s]).find(s=>s!==void 0);if(r!==void 0&&!o.valid(r))throw new p(o.message,m.USAGE)}}function je(e){let t=x(e);return t?new Map((Le[t].include??[]).filter(n=>!Pe.has(n)&&re[n]===void 0).map(n=>[se(n),Ve(n)])):new Map}function Jt(e,t,n){let o=F(t)??[],r=je(e),s=[],a=[];for(let i of o){let d=r.get(i);if(d===void 0){s.push(i);continue}n[d]=!0,a.push(i)}return{selectors:s,modes:a}}function ir(e,t){let n=t.outputInclude??t.output_include;if(n===void 0)return;let{selectors:o,modes:r}=Jt(e,n,t);if(r.length===0)return;let s=o.length>0?o.join(","):void 0;t.outputInclude=s,Object.hasOwn(t,"output_include")&&(t.output_include=s)}function Ve(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}function Ht(e,t){let n=Ve(t);if(Object.hasOwn(e,n))return e[n];let o=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,o))return e[o];if(t==="--no-truncate"&&e.truncate===!1)return!0}function Zt(e){return e!==void 0&&e!==!1&&e!==null}function F(e){let n=(Array.isArray(e)?e:[e]).flatMap(o=>typeof o=="string"?o.split(","):[]).map(o=>o.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function w(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function en(e,t,n){for(let o of e.legacy_aliases){let r=Ht(t,o.flag),s={value:r,flag:o.flag};if(Zt(r)&&n(s))return s}}function xe(e,t){let n=F(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:F(t.value)??[se(t.flag)]}}function Re(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=w(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;if(t.flag==="--no-truncate"||t.flag==="--unbounded")return{source:"legacy",value:"unbounded"};let o=w(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function Ne(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=w(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;let o=w(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function Ie(e,t){if(e==="json"||e==="toon")return{source:"canonical",value:e};if(t)return t.flag==="--stream"||t.flag==="--follow"?{source:"legacy",value:"stream"}:t.value==="json"||t.value==="toon"?{source:"legacy",value:t.value}:void 0}function Fe(e,t){let n=x(e,t);if(!n)return;let o=Xt.get(n),r={include:f=>xe(void 0,f),amount:f=>Re(void 0,f),cost:f=>Ne(void 0,f),encoding:f=>Ie(void 0,f)},s=Object.fromEntries(S.map(f=>[f,en(o.dimensions[f],t,g=>r[f](g)!==void 0)])),a=S.flatMap(f=>{let g=s[f];return g?[g.flag]:[]}),i=S.flatMap(f=>{let g=s[f];return g?[o.dimensions[f].legacy_aliases.find(Ke=>Ke.flag===g.flag).migration_hint]:[]}),d=Ie(t.outputFormat??t.output_format,s.encoding),u=Ne(t.outputBudget??t.output_budget,s.cost),l=e.trim().toLowerCase().replaceAll(/\s+/gu," ").split(" ")[0]==="list-all"||s.amount?.flag==="--no-truncate"||s.include?.flag==="--full",c=Ae(e,{generateFallback:!0}),_=d?.value==="json"||t.resolvedOutputFormat==="json"?"json":"toon";return{command:n,include:xe(t.outputInclude??t.output_include,s.include),amount:Re(t.outputLimit??t.output_limit,s.amount),cost:u??(l?{source:"intent",value:"unbounded"}:{source:"default",value:c.default_max_estimated_tokens_by_format[_]}),encoding:d,legacy_aliases_used:a,migration_hints:i,precedence:Ue}}function y(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var ie=new Set(["applied_bound","applied_limit","completeness","continuation_kind","continuation_path","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","budget_retention_policy","row_contract","sorting","total","truncated"]),tn=["collection_counts","notes_count","tests_count"];function Be(e,t){let n=new Set(t.map(o=>o.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([o])=>n.has(o)))}function nn(e){let t=y(e.item)?e.item:{},n=[...new Set([...Object.keys(t),...tn.filter(r=>Object.hasOwn(t,r))])].sort((r,s)=>r.localeCompare(s)),o=Object.keys(e).filter(r=>r!=="item"&&r!=="read_output"&&!ie.has(r)).sort((r,s)=>r.localeCompare(s));return{item:t,itemFields:n,sections:o,valid:[...n,"item",...n.map(r=>`item.${r}`),...o]}}function on(e,t){let n=nn(e),o=t.filter(c=>!n.valid.includes(c));if(o.length>0)throw new p(`Unknown --output-include selector(s) for get: ${o.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,m.USAGE);let r=t.includes("item"),s=t.flatMap(c=>c.startsWith("item.")?[c.slice(5)]:n.itemFields.includes(c)?[c]:[]).filter((c,_,f)=>f.indexOf(c)===_);if(r&&s.length>0)throw new p("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.",m.USAGE);let a=new Set(t.filter(c=>n.sections.includes(c))),i=Object.fromEntries(Object.entries(e).filter(([c])=>ie.has(c)||a.has(c)));r?i.item=n.item:s.length>0&&(i.item=Be(n.item,s));let d=[...r?[]:s.length>0?n.itemFields.filter(c=>!s.includes(c)).map(c=>({name:`item.${c}`,restore_with:`--output-include item.${c}`})):[{name:"item",restore_with:"--output-include item"}],...n.sections.filter(c=>!a.has(c)).map(c=>({name:c,restore_with:`--output-include ${c}`}))],l=[...y(i.omission_receipt)&&Array.isArray(i.omission_receipt.omitted_field_groups)?i.omission_receipt.omitted_field_groups:[],...d];return i.omission_receipt={has_omissions:l.length>0,omitted_field_group_count:l.length,omitted_field_groups:l},i}function Ce(e){let t=0;return T({...e},n=>(y(n)&&Object.keys(n).length>0&&(t+=1),n)),t}function rn(e,t,n,o){if(Ce(t)===0||Ce(n)>0)return;let r=[...je(e).keys()],s=r.length>0?` Declared ${e} projection modes: ${r.join(", ")}.`:` The ${e} surface declares no projection modes; name row fields instead.`;throw new p(`Unknown --output-include selector(s) for ${e}: ${o.join(", ")}. No selector matched any returned row field.${s}`,m.USAGE)}function sn(e,t,n){if(e==="get")return on(t,n);let o=v(t),r=n.flatMap(a=>o.flatMap(i=>a.startsWith(`${i}.`)?[a.slice(i.length+1)]:[])),s=n.some(a=>Object.hasOwn(t,a.split(".")[0])&&!o.some(i=>a.startsWith(`${i}.`)));if(o.length>0&&(!s||r.length>0)){let a={...t},i=r.length>0?r:n,d=T(a,u=>y(u)?Be(u,i):u);return rn(e,t,d,i),d}return Object.fromEntries(Object.entries(t).filter(([a])=>n.some(i=>i.split(".")[0]===a)||ie.has(a)))}function an(e,t){if(t==="unbounded")return e;let{result:n,truncated:o}=ye(e,t);return o&&(n.has_more=!0,n.truncated=!0,typeof n.count=="number"&&(n.count=M(n)),n.applied_bound={kind:"output_limit",source:"explicit",value:t}),n}function cn(e){return S.filter(t=>e[t]!==void 0&&e[t]?.source!=="default")}function B(e,t,n){let o=Y(e,t);for(let r=0;r<8;r+=1){let s=n.estimated_tokens,a=o.read_session.spent_this_call_tokens;h(o,n),o=Y(o,t);let i=o.read_session.spent_this_call_tokens;if(n.estimated_tokens===s&&i===a)return o}return o}function ar(e,t){if(!y(e.read_output))return e;let n=e.read_output,o=P(t.outputSession??t.output_session);return o===void 0?(h(e,n),e):B(e,o,n)}function un(e,t){if(e!=="validate")return t;let n=y(t.projection)?t.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(c=>y(c)&&c.name==="diagnostic_rows"))return t;let r=[...new Set(D(t).map(({path:c})=>c).filter(c=>/^checks\.\d+\.details\./u.test(c)))],s=r.filter(c=>!r.some(_=>_!==c&&c.startsWith(`${_}.`)));if(s.length===0)return t;let a=y(t.row_contract)?t.row_contract:{},i=Array.isArray(a.row_keys)?a.row_keys.filter(c=>typeof c=="string"):[],d=Array.isArray(a.continuation_row_keys)?a.continuation_row_keys.filter(c=>typeof c=="string"):[],u=i.length>0?i:s,l=[...new Set(s)];return JSON.stringify(u)===JSON.stringify(i)&&JSON.stringify(l)===JSON.stringify(d)?t:{...t,row_contract:{...a,row_keys:u,continuation_row_keys:l,jq_selector:typeof a.jq_selector=="string"?a.jq_selector:".checks[].details"}}}function dn(e,t,n,o){let r={...e};return t.include?.source==="canonical"&&(r=sn(t.command,r,t.include.value)),t.command==="assurance"&&(r=ve(r)),r=De(r,t.command,o),t.amount?.source==="canonical"&&(r=an(r,t.amount.value)),n===void 0?r:be(r,n)}function ln(e,t){return[...e.cost!==void 0&&e.cost.value!=="unbounded"&&(e.cost.source==="canonical"||e.cost.source==="default")?[{source:e.cost.source,tokens:e.cost.value}]:[],...t===void 0?[]:[{source:"session",tokens:Ee(t)}]].sort((o,r)=>o.tokens-r.tokens)[0]}function fn(e,t,n,o,r){let s={contract_version:1,command:e.command,requested_dimensions:t,...o.source==="default"?{budget_source:o.source,budget_tokens:o.tokens}:{},precedence:e.precedence,legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0,...n===void 0?{omitted_result_estimated_tokens:r}:{}},a={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:s},i=n===void 0?a:B(a,n,s);if(n===void 0&&h(i,s),n!==void 0&&s.estimated_tokens>o.tokens)throw new p("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",m.USAGE);return i}function _n(e,t,n,o){if(n!==void 0)return!1;let r=t.filter(s=>e[s]?.source==="canonical").length;return e.cost?.value==="unbounded"?r===(e.cost.source==="canonical"?1:0):e.cost?.source==="legacy"&&r===0?!0:r===0&&(e.cost===void 0||W(o)<=e.cost.value)}function pn(e,t,n,o,r,s){if(!n.rows_compacted)return;let a=t.amount?.value==="unbounded"?["amount"]:[],i=new Map(A(e).map(l=>[l.path,Array.isArray(l.value)?l.value.length:Object.keys(l.value).length])),d=[...s.entries()].flatMap(([l,c])=>{let _=i.get(l);if(_>=c.rows)return[];let f=c.baseOffset+_;return[{path:l,cursor:te({command:t.command,path:l,offset:f,total_rows:c.totalRows,fingerprint:c.fingerprint}),retained_rows:_,remaining_rows:c.totalRows-f,total_rows:c.totalRows}]}),u=d[0];u&&typeof e.next_cursor!="string"&&(e.next_cursor=u.cursor),e.continuation_kind=r?"producer_cursor":u?"output_cursor":"none",e.output_budget_truncation={reason:"output_budget_reached",budget_source:o.source,budget_tokens:o.tokens,overridden_dimensions:a,compacted_row_paths:n.compacted_row_paths,continuation_cursor_rebased:r,continuation_available:d.length>0,recovery_budget_multiplier:1,continuations:d,restore_with:u?"Use recovery binding.":"Increase --output-budget because no declared row collection can be continued.",recovery:u?{cursor:u.cursor,cli:"--output-cursor",sdk:"outputCursor",mcp:"outputCursor"}:{cli:"--output-budget 1200",sdk:{outputBudget:1200},mcp:{outputBudget:1200}}}}function mn(e,t,n,o){if(typeof n!="string"||!Array.isArray(e.items))return!1;let r=e.items.length;if(r===0||r>=t)return!1;let s;try{s=H(n)}catch{return!1}let a=s.after_index;if(a===void 0)return!1;let i=e.items.at(-1);if(Object.prototype.toString.call(i)!=="[object Object]")return!1;let d=Reflect.get(i,"id");if(typeof d!="string"||d.length===0)return!1;let u=o?a-(t-r):a+r;return u<0?!1:(e.next_cursor=J(s.fingerprint,d,u,s.snapshot),typeof e.applied_limit=="number"&&(e.applied_limit=r),!0)}function gn(e,t,n){let o=new Map(A(e).map(s=>{let a=Array.isArray(s.value)?s.value.length:Object.keys(s.value).length,i=t?.path===s.path;return[s.path,{rows:a,totalRows:i?t.total_rows:a,baseOffset:i?t.offset:0,fingerprint:i?t.fingerprint:ee(s.path,s.value)}]})),r=typeof e.next_cursor=="string";return{collectionsBeforeBudget:o,originalItemCount:Array.isArray(e.items)?e.items.length:0,cursorContinuesExistingPage:r,cursorSource:r?e.next_cursor:n.after}}function yn(e,t,n,o,r,s){let a=t.command==="assurance"&&Array.isArray(e.assertions)?e.assertions.filter(u=>y(u)&&u.verdict!=="pass").length:0,i=we(e,n,o.tokens,a>0?new Map([["assertions",a]]):new Map),d=mn(i,s.originalItemCount,s.cursorSource,s.cursorContinuesExistingPage);return pn(i,t,n,o,d,s.collectionsBeforeBudget),r!==void 0&&(i=B(i,r,n)),i}function cr(e,t,n){let o=Fe(e,t);if(!o)return n;let r=P(t.outputSession??t.output_session),s=t.outputCursor??t.output_cursor,a=typeof s=="string"?ne(s):void 0,i=cn(o);if(a===void 0&&_n(o,i,r,n))return n;let d=un(o.command,n),u=ln(o,r),l=dn(d,o,r,a),c=gn(l,a,t),_={contract_version:1,command:o.command,requested_dimensions:i,...u?.source==="default"?{budget_source:u.source,budget_tokens:u.tokens}:{},precedence:o.precedence,legacy_aliases_used:o.legacy_aliases_used,migration_hints:o.migration_hints,estimated_tokens:0,within_budget:!0,strings_compacted:!1,rows_compacted:!1,result_omitted:!1};return l.read_output=_,l=r===void 0?l:B(l,r,_),h(l,_),u!==void 0&&_.estimated_tokens>u.tokens&&(l=yn(l,o,_,u,r,c)),u!==void 0&&_.estimated_tokens>u.tokens?fn(o,i,r,u,_.estimated_tokens):l}function ur(e){return y(e)&&y(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function dr(e,t){let n=Fe(e,t)?.encoding;return n?.value==="json"||n?.value==="toon"?n.value:void 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]="1c73c31e-6246-5730-8c8a-d3ba7c9ec112")}catch{}})();var bn=4096;function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ee(e,t){return hn("sha256").update(V({path:e,value:t})).digest("base64url").slice(0,16)}function te(e){return Buffer.from(JSON.stringify({v:1,c:e.command,p:e.path,o:e.offset,n:e.total_rows,f:e.fingerprint}),"utf8").toString("base64url")}function ne(e){if(e.length>bn)throw new p("The read-output continuation cursor is malformed or unsupported.",m.USAGE,{code:"read_output_cursor_invalid"});let t;try{t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{t=null}if(!Ge(t)||t.v!==1||x(String(t.c??""))!==t.c||typeof t.p!="string"||t.p.length===0||!Number.isSafeInteger(t.o)||t.o<0||!Number.isSafeInteger(t.n)||t.n<1||typeof t.f!="string"||t.f.length===0)throw new p("The read-output continuation cursor is malformed or unsupported.",m.USAGE,{code:"read_output_cursor_invalid"});return{version:1,command:t.c,path:t.p,offset:t.o,total_rows:t.n,fingerprint:t.f}}function ve(e){if(!Array.isArray(e.assertions))return e;let t=n=>!Ge(n)||n.verdict==="pass"?4:n.verdict==="retired"?3:n.enforcement==="block"?0:n.enforcement==="warn"?1:2;return{...e,assertions:e.assertions.map((n,o)=>({row:n,index:o})).sort((n,o)=>t(n.row)-t(o.row)||n.index-o.index).map(({row:n})=>n),budget_retention_policy:"verdict_priority"}}function De(e,t,n){if(!n)return e;if(n.command!==t)throw new p(`The read-output cursor belongs to ${n.command}, not ${t}.`,m.USAGE,{code:"read_output_cursor_command_mismatch"});let o=A(e).find(s=>s.path===n.path),r=o?Array.isArray(o.value)?o.value.length:Object.keys(o.value).length:0;if(!o||r!==n.total_rows||n.offset>r||ee(n.path,o.value)!==n.fingerprint)throw new p("The read-output continuation no longer matches the declared row collection; restart the bounded read.",m.USAGE,{code:"read_output_cursor_stale"});return ge(e,n.path,n.offset)}(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]="f6e82c93-54e8-53a7-94df-10a573aae933")}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]="08ee7e43-8811-57ed-8bfe-0345ee5d3308")}catch{}})();var En=Object.freeze([{flag:"--json"},{flag:"--lean"},{flag:"--token-accounting"},{flag:"--output-include",value_name:"fields"},{flag:"--output-limit",value_name:"count"},{flag:"--output-budget",value_name:"tokens"},{flag:"--output-format",value_name:"toon|json"},{flag:"--output-session",value_name:"state"},{flag:"--output-cursor",value_name:"cursor"},{flag:"--output-row-contract"},{flag:"--quiet"},{flag:"--no-changed-fields"},{flag:"--full-changed-fields"},{flag:"--id-only"},{flag:"--pm-path",aliases:["--path"]},{flag:"--no-extensions"},{flag:"--no-pager"},{flag:"--profile"},{flag:"--help"},{flag:"--author",value_name:"id"}]),Ar=new Set(En.flatMap(e=>[e.flag,...e.aliases??[]]));export{G as a,ze as b,$e as c,On as d,ae as e,ce as f,ue as g,An as h,de as i,le as j,fe as k,Xe as l,wn as m,Tn as n,kn as o,xn as p,Rn as q,Nn as r,In as s,Cn as t,vn as u,Dn as v,Mn as w,Un as x,Ln as y,Pn as z,jn as A,Vn as B,Fn as C,Ye as D,Bn as E,Gn as F,Kn as G,zn as H,$n as I,Xn as J,Yn as K,qe as L,We as M,Qn as N,Jn as O,Qe as P,Hn as Q,Zn as R,eo as S,Ze as T,et as U,K as V,to as W,no as X,m as Y,p as Z,En as _,Ar as $,V as aa,k as ba,Mo as ca,Uo as da,N as ea,io as fa,ao as ga,co as ha,tt as ia,nt as ja,ot as ka,_o as la,po as ma,rt as na,I as oa,mo as pa,st as qa,pe as ra,C as sa,it as ta,go as ua,yo as va,ho as wa,bo as xa,Eo as ya,Oo as za,Ao as Aa,X as Ba,P as Ca,be as Da,Y as Ea,Ee as Fa,pt as Ga,Io as Ha,Ot as Ia,Oe as Ja,At as Ka,St as La,Ae as Ma,Co as Na,te as Oa,ne as Pa,Ko as Qa,zo as Ra,J as Sa,H as Ta,Z as Ua,$o as Va,Gt as Wa,Xo as Xa,Yo as Ya,S as Za,Me as _a,or as $a,rr as ab,$t as bb,x as cb,sr as db,je as eb,Jt as fb,ir as gb,Fe as hb,ar as ib,cr as jb,ur as kb,dr as lb};
2
+ //# sourceMappingURL=chunk-RZU5U6Q7.js.map
@@ -1,2 +1,2 @@
1
- import{ka as I,la as b}from"./chunk-5AF3ZBNB.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="de8a82e1-0b02-5d5a-9086-686529a1ccab")}catch{}})();var v="blocked_by",D="blocks",T=Object.freeze([v,D]),y="no-active-blocker";function l(e){return e.trim().toLowerCase()}function p(e){let n=new Set,t=typeof e.blocked_by=="string"?l(e.blocked_by):"";t.length>0&&t!==y&&n.add(t);for(let o of e.dependencies??[]){let c=typeof o.id=="string"?l(o.id):"";o.kind===v&&c.length>0&&c!==y&&n.add(c)}return[...n].sort((o,c)=>o.localeCompare(c))}function k(e){let n=new Map;for(let t of e){let o=l(t.id);o.length!==0&&n.set(o,new Set(p(t)))}for(let t of e){let o=l(t.id);if(o.length!==0)for(let c of t.dependencies??[]){let s=c.kind===D&&typeof c.id=="string"?l(c.id):"";if(s.length===0||s===y)continue;let d=n.get(s)??new Set;d.add(o),n.set(s,d)}}return new Map([...n].map(([t,o])=>[t,[...o].sort((c,s)=>c.localeCompare(s))]))}function S(e,n){let t=l(e.id);return t.length>0?k(n).get(t)??p(e):p(e)}function B(e,n,t,o){let c=e;return(typeof c.id=="string"?o?.get(l(c.id))??S(c,[...n.values()]):p(e)).map(d=>{let r=n.get(l(d));return r?{id:d,title:r.title,status:r.status,resolved:b(r.status,t)}:{id:d,title:null,status:null,resolved:!1}})}function O(e,n,t){return B(e,n,t)}function K(e,n){let t=new Map(e.map(d=>[l(d.id),d])),o=k(e),c=new Set([...C(n),...n.blocked_statuses]),s=new Set;for(let d of e){let r=I(d.status,n);if(!c.has(r))continue;(n.blocked_statuses.has(r)||B(d,t,n,o).some(f=>!f.resolved))&&s.add(l(d.id))}return s}function C(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function A(e,n,t){let o=[l(e)],c=new Set;for(;o.length>0;){let s=o.pop();if(!c.has(s)){c.add(s);for(let d of n.get(s)??[]){if(!b(d.status,t))return!0;o.push(l(d.id))}}}return!1}function L(e){let n=new Map,t=new Map,o=new Map,c=k(e);for(let s of e){n.set(l(s.id),s);let d=typeof s.parent=="string"?s.parent.trim():"";if(d.length>0){let r=l(d),a=t.get(r)??[];a.push(s),t.set(r,a)}for(let r of c.get(l(s.id))){let a=l(r),f=o.get(a)??[];f.push(s.id),o.set(a,f)}}return{itemsById:n,childrenByParent:t,blockedByReverse:o,blockerIdsByItem:c}}function M(e,n,t){let{itemsById:o,childrenByParent:c,blockedByReverse:s,blockerIdsByItem:d}=L(n),r=new Set([...C(t),...t.blocked_statuses]),a=new Set(n.filter(i=>!b(i.status,t)).map(i=>l(i.id))),f=[],h=[],m=0,_=0;for(let i of e){if(!r.has(I(i.status,t)))continue;if(m+=1,A(i.id,c,t)){_+=1;continue}let g=B(i,o,t,d).filter(u=>!u.resolved),E=(s.get(l(i.id))??[]).filter(u=>a.has(l(u))).sort((u,x)=>u.localeCompare(x)),w={item:i,open_blockers:g,unblocks:E},N=t.blocked_statuses.has(I(i.status,t));g.length===0&&!N?f.push(w):h.push(w)}return{ready:f,blocked:h,active_count:m,container_count:_}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cc271a73-9767-54bb-a142-d4d4569e3c6a")}catch{}})();export{T as a,p as b,k as c,S as d,O as e,K as f,M as g};
2
- //# sourceMappingURL=chunk-M62NO7EI.js.map
1
+ import{ka as I,la as b}from"./chunk-34QBIYZI.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="de8a82e1-0b02-5d5a-9086-686529a1ccab")}catch{}})();var v="blocked_by",D="blocks",T=Object.freeze([v,D]),y="no-active-blocker";function l(e){return e.trim().toLowerCase()}function p(e){let n=new Set,t=typeof e.blocked_by=="string"?l(e.blocked_by):"";t.length>0&&t!==y&&n.add(t);for(let o of e.dependencies??[]){let c=typeof o.id=="string"?l(o.id):"";o.kind===v&&c.length>0&&c!==y&&n.add(c)}return[...n].sort((o,c)=>o.localeCompare(c))}function k(e){let n=new Map;for(let t of e){let o=l(t.id);o.length!==0&&n.set(o,new Set(p(t)))}for(let t of e){let o=l(t.id);if(o.length!==0)for(let c of t.dependencies??[]){let s=c.kind===D&&typeof c.id=="string"?l(c.id):"";if(s.length===0||s===y)continue;let d=n.get(s)??new Set;d.add(o),n.set(s,d)}}return new Map([...n].map(([t,o])=>[t,[...o].sort((c,s)=>c.localeCompare(s))]))}function S(e,n){let t=l(e.id);return t.length>0?k(n).get(t)??p(e):p(e)}function B(e,n,t,o){let c=e;return(typeof c.id=="string"?o?.get(l(c.id))??S(c,[...n.values()]):p(e)).map(d=>{let r=n.get(l(d));return r?{id:d,title:r.title,status:r.status,resolved:b(r.status,t)}:{id:d,title:null,status:null,resolved:!1}})}function O(e,n,t){return B(e,n,t)}function K(e,n){let t=new Map(e.map(d=>[l(d.id),d])),o=k(e),c=new Set([...C(n),...n.blocked_statuses]),s=new Set;for(let d of e){let r=I(d.status,n);if(!c.has(r))continue;(n.blocked_statuses.has(r)||B(d,t,n,o).some(f=>!f.resolved))&&s.add(l(d.id))}return s}function C(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function A(e,n,t){let o=[l(e)],c=new Set;for(;o.length>0;){let s=o.pop();if(!c.has(s)){c.add(s);for(let d of n.get(s)??[]){if(!b(d.status,t))return!0;o.push(l(d.id))}}}return!1}function L(e){let n=new Map,t=new Map,o=new Map,c=k(e);for(let s of e){n.set(l(s.id),s);let d=typeof s.parent=="string"?s.parent.trim():"";if(d.length>0){let r=l(d),a=t.get(r)??[];a.push(s),t.set(r,a)}for(let r of c.get(l(s.id))){let a=l(r),f=o.get(a)??[];f.push(s.id),o.set(a,f)}}return{itemsById:n,childrenByParent:t,blockedByReverse:o,blockerIdsByItem:c}}function M(e,n,t){let{itemsById:o,childrenByParent:c,blockedByReverse:s,blockerIdsByItem:d}=L(n),r=new Set([...C(t),...t.blocked_statuses]),a=new Set(n.filter(i=>!b(i.status,t)).map(i=>l(i.id))),f=[],h=[],m=0,_=0;for(let i of e){if(!r.has(I(i.status,t)))continue;if(m+=1,A(i.id,c,t)){_+=1;continue}let g=B(i,o,t,d).filter(u=>!u.resolved),E=(s.get(l(i.id))??[]).filter(u=>a.has(l(u))).sort((u,x)=>u.localeCompare(x)),w={item:i,open_blockers:g,unblocks:E},N=t.blocked_statuses.has(I(i.status,t));g.length===0&&!N?f.push(w):h.push(w)}return{ready:f,blocked:h,active_count:m,container_count:_}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cc271a73-9767-54bb-a142-d4d4569e3c6a")}catch{}})();export{T as a,p as b,k as c,S as d,O as e,K as f,M as g};
2
+ //# sourceMappingURL=chunk-US7VEYZG.js.map
@@ -1,4 +1,4 @@
1
- import{f as w,i as f,j as B,k as j,l as U,o as y,p as X,q as W,r as Y}from"./chunk-EUEGXZ2A.js";import{B as H,a as P,b as D}from"./chunk-C5IW2NDA.js";import{c as u,f as M,g as z,i as q}from"./chunk-EX6MKP2X.js";import{Fa as F,c as L,f as R}from"./chunk-TVV2DONO.js";import{Ka as g,Ma as K,Z as k}from"./chunk-UI6AJ5TD.js";import{a as N,e as x,f as O,g as A,i as C,l as $}from"./chunk-2PN4TJXH.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]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var Ce=N,$e=x,Pe=C,De=O,Le=A;function G(e,t,n,s){let r=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),o=n.has(r);return{long:t,...s?{short:s}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:o?"string":"boolean",...o?{value_name:e.value_name??"value"}:{}}}function Q(e,t=[]){let n=new Set(t.flatMap(r=>r.keys)),s=[];for(let r of L(e.map(o=>({...o})))){s.push(G(r,r.flag,n,r.short));for(let o of r.aliases??[])s.push(G(r,o,n))}return s}var Re=Q(R,P),Fe=Q(F,D);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bed1d1d4-0c1d-59e5-8267-fbe800dfd83b")}catch{}})();var _=["agile","ops","research"],I={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:w.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
1
+ import{f as w,i as f,j as B,k as j,l as U,o as y,p as X,q as W,r as Y}from"./chunk-EXBCLIBU.js";import{C as H,a as P,b as D}from"./chunk-MCZXYZAF.js";import{c as u,f as M,g as z,i as q}from"./chunk-ESISGDAY.js";import{Ta as F,q as L,t as R}from"./chunk-L623ZPNK.js";import{Ka as g,Ma as K,Z as k}from"./chunk-JDOMQ7VQ.js";import{a as N,e as x,f as O,g as A,i as C,l as $}from"./chunk-RZU5U6Q7.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]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var Ce=N,$e=x,Pe=C,De=O,Le=A;function G(e,t,n,s){let r=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),o=n.has(r);return{long:t,...s?{short:s}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:o?"string":"boolean",...o?{value_name:e.value_name??"value"}:{}}}function Q(e,t=[]){let n=new Set(t.flatMap(r=>r.keys)),s=[];for(let r of L(e.map(o=>({...o})))){s.push(G(r,r.flag,n,r.short));for(let o of r.aliases??[])s.push(G(r,o,n))}return s}var Re=Q(R,P),Fe=Q(F,D);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bed1d1d4-0c1d-59e5-8267-fbe800dfd83b")}catch{}})();var _=["agile","ops","research"],I={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:w.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
2
2
 
3
3
  ## I want
4
4
 
@@ -23,4 +23,4 @@ import{f as w,i as f,j as B,k as j,l as U,o as y,p as X,q as W,r as Y}from"./chu
23
23
 
24
24
  ## Conclusion
25
25
  `}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function ne(e){if(e===void 0)return;let t=p(e);if(t.length===0)throw new Error("Profile name must not be empty.");if(_.includes(t))return t;throw new Error(`Invalid profile "${e}". Allowed: ${_.join(", ")}.`)}function qe(e){let t=ne(e);if(t===void 0)throw new Error(`Profile name is required. Allowed: ${_.join(", ")}.`);return I[t]}function Be(){return _.map(e=>I[e])}function p(e){return e.trim().toLowerCase().replaceAll("-","_")}function J(e){return e.map(t=>t.definition.name).join(", ")}function se(e=[]){let t=_.map(o=>({definition:I[o],source:"builtin"})),n=new Set(_.map(o=>p(o))),s=new Set(n),r=[];for(let o of e){let i=p(o.profile.name);if(n.has(i)){r.push(`Extension "${o.name}" profile "${o.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(s.has(i)){r.push(`Profile "${o.profile.name}" from extension "${o.name}" duplicates an already-registered profile and was ignored.`);continue}s.add(i),t.push({definition:o.profile,source:"extension",package:o.name})}return{profiles:t,warnings:r}}function je(e,t=[]){let{profiles:n,warnings:s}=se(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${J(n)}.`);let r=p(e),o=n.find(i=>p(i.definition.name)===r);if(o===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${J(n)}.`);return{resolved:o,warnings: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]="933d8f74-c4aa-58d0-bd3b-8932a35d3702")}catch{}})();function re(e){return{types:e.types.length,statuses:e.statuses.length,fields:e.fields.length,workflows:e.workflows.length,config:e.config.length,templates:e.templates.length,packages:e.packages.length}}function Ye(e){return{name:e.name,title:e.title,summary:e.summary,composition:re(e),types:e.types.map(t=>S(()=>u(t).name,()=>String(t.name??""))),statuses:e.statuses.map(t=>S(()=>y(t).id,()=>String(t.id??""))),fields:e.fields.map(t=>S(()=>f(t).key,()=>String(t.key??""))),workflows:e.workflows.map(t=>t.type),config:e.config.map(t=>`${t.key}=${t.value}`),templates:e.templates.map(t=>t.name),packages:e.packages.map(t=>({spec:t.spec,reason:t.reason}))}}function S(e,t){try{return e()}catch{return t()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be95f220-5f66-5e8c-8447-996696d02e43")}catch{}})();var oe=[{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Bounded jittered wait in milliseconds before a contended item mutation fails with lock_conflict; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],ie=new Map(oe.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function b(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return ie.get(t)}function ae(e,t){let n=t.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"||n==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:n==="false"||n==="0"||n==="no"||n==="off"?{ok:!0,parsed:{descriptor:e,value:!1}}:{ok:!1,error:{message:`Config set ${e.key} requires a boolean value (true|false), got "${t}"`}}}function le(e,t,n){return e.non_empty===!0&&n.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(n)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function de(e,t,n){if(n.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let s=Number(n);return Number.isFinite(s)?{ok:!0,value:s}:{ok:!1,error:{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function ce(e,t,n){return!Number.isInteger(n)||n<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires an integer >= ${e.min}, got "${t}" (the runtime silently ignores 0 here and falls back to the default)`}}:e.max!==void 0&&n>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function me(e,t,n){return n<0||n>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function pe(e,t,n){return e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function v(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let n=t.trim();if(e.kind==="boolean")return ae(e,t);if(e.kind==="string")return le(e,t,n);let s=de(e,t,n);return s.ok?e.kind==="integer"?ce(e,t,s.value):e.kind==="ratio"?me(e,t,s.value):pe(e,t,s.value):{ok:!1,error:s.error}}function V(e,t){let n=t.path.split("."),s=e;for(let r of n){if(typeof s!="object"||s===null)return null;s=s[r]}return typeof s=="string"||typeof s=="number"||typeof s=="boolean"?s:null}function Ge(e,t,n){let s=t.path.split("."),r=e;for(let a=0;a<s.length-1;a+=1){let c=s[a],d=r[c];if(typeof d!="object"||d===null||Array.isArray(d)){let l={};r[c]=l,r=l}else r=d}let o=s[s.length-1];return r[o]===n?!1:(r[o]=n,!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]="f9b22df0-7ec2-5d72-bc88-3eb7201a6051")}catch{}})();var at=["profile","types","statuses","fields","workflows","config","templates","packages"],lt=["profile_name_empty","profile_name_not_normalized","profile_title_empty","profile_summary_empty","type_invalid","type_duplicate","status_invalid","status_duplicate","field_invalid","field_duplicate","field_mcp_input_collision","workflow_type_empty","workflow_type_unknown","workflow_duplicate_type","workflow_transition_malformed","workflow_status_unknown","config_key_unknown","config_value_invalid","config_duplicate","template_type_unknown","package_spec_empty"],ue=new Set(K.flatMap(e=>[g(e.id),...(e.aliases??[]).map(t=>g(t))]).filter(e=>e.length>0)),Z=new Set($.map(e=>e.toLowerCase()));function fe(e,t){e.name.trim().length===0?t.push({severity:"error",code:"profile_name_empty",dimension:"profile",message:"Profile name must not be empty; profile resolution requires a non-blank name."}):e.name!==p(e.name)&&t.push({severity:"warning",code:"profile_name_not_normalized",dimension:"profile",target:e.name,message:`Profile name "${e.name}" is not in canonical form; resolution folds it to "${p(e.name)}" (lowercase, hyphens as underscores).`}),e.title.trim().length===0&&t.push({severity:"warning",code:"profile_title_empty",dimension:"profile",message:"Profile title is empty; list and show surfaces will render a blank title."}),e.summary.trim().length===0&&t.push({severity:"warning",code:"profile_summary_empty",dimension:"profile",message:"Profile summary is empty; list and show surfaces will render a blank archetype description."})}function ye(e,t){let n=new Set,s=new Set;for(let[r,o]of e.types.entries()){let i;try{i=u(o).name}catch(c){t.push({severity:"error",code:"type_invalid",dimension:"types",target:typeof o.name=="string"?o.name:`#${r}`,message:k(c)});continue}let a=i.toLowerCase();if(s.has(a)){t.push({severity:"error",code:"type_duplicate",dimension:"types",target:i,message:`Item type "${i}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}s.add(a),n.add(a)}return n}function he(e,t){let n=new Set,s=new Set;for(let[r,o]of e.statuses.entries()){let i;try{i=y(o)}catch(a){t.push({severity:"error",code:"status_invalid",dimension:"statuses",target:typeof o.id=="string"?o.id:`#${r}`,message:k(a)});continue}if(s.has(i.id)){t.push({severity:"error",code:"status_duplicate",dimension:"statuses",target:i.id,message:`Status "${i.id}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}s.add(i.id),n.add(i.id);for(let a of i.aliases??[])n.add(g(a))}return n}function ge(e,t){let n=new Set;for(let[s,r]of e.fields.entries()){let o;try{o=f(r).key}catch(a){t.push({severity:"error",code:"field_invalid",dimension:"fields",target:typeof r.key=="string"?r.key:`#${s}`,message:k(a)});continue}if(n.has(o)){t.push({severity:"error",code:"field_duplicate",dimension:"fields",target:o,message:`Field "${o}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}n.add(o);let i=H(o);i&&t.push({severity:"warning",code:"field_mcp_input_collision",dimension:"fields",target:o,message:`Field "${o}" collides with canonical MCP property "${i.property}" owned by ${i.owner}; callers must pass the custom value through ${i.nested_path}.`})}}function _e(e,t,n,s){let r=new Set;for(let[o,i]of e.workflows.entries()){let a=i.type.trim().toLowerCase();if(a.length===0){s.push({severity:"error",code:"workflow_type_empty",dimension:"workflows",target:`#${o}`,message:"Workflow has an empty type; the workflow resolver drops entries without a type."});continue}let c=r.has(a);r.add(a),c?s.push({severity:"warning",code:"workflow_duplicate_type",dimension:"workflows",target:i.type,message:`Workflow type "${i.type}" is declared more than once; the later transition set wins.`}):!Z.has(a)&&!t.has(a)&&s.push({severity:"warning",code:"workflow_type_unknown",dimension:"workflows",target:i.type,message:`Workflow governs type "${i.type}" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`});let d=new Set;for(let l of i.allowed_transitions){let m=g(l[0]),T=g(l[1]);if(m.length===0||T.length===0){s.push({severity:"error",code:"workflow_transition_malformed",dimension:"workflows",target:i.type,message:`Workflow "${i.type}" has a transition with an empty status; the workflow resolver silently drops it.`});continue}for(let h of[m,T])ue.has(h)||n.has(h)||d.has(h)||(d.add(h),s.push({severity:"warning",code:"workflow_status_unknown",dimension:"workflows",target:h,message:`Workflow "${i.type}" references status "${h}" which is neither a built-in status nor declared by this profile; transitions to or from it are unreachable.`}))}}}function ke(e,t){let n=new Set;for(let s of e.config){let r=b(s.key);if(r===void 0){t.push({severity:"error",code:"config_key_unknown",dimension:"config",target:s.key,message:`Config knob "${s.key}" is not a recognized setting; apply rejects it with a usage error.`});continue}n.has(r.key)?t.push({severity:"error",code:"config_duplicate",dimension:"config",target:r.key,message:`Config knob "${r.key}" is set more than once; the later value silently overwrites the earlier one.`}):n.add(r.key);let o=v(r,s.value);o.ok||t.push({severity:"error",code:"config_value_invalid",dimension:"config",target:s.key,message:o.error.message})}}function we(e,t,n){for(let s of e.templates){let r=s.options.type;if(typeof r!="string"||r.trim().length===0)continue;let o=r.trim().toLowerCase();!Z.has(o)&&!t.has(o)&&n.push({severity:"warning",code:"template_type_unknown",dimension:"templates",target:s.name,message:`Template "${s.name}" creates type "${r}" which is neither a built-in type nor declared by this profile.`})}}function be(e,t){for(let[n,s]of e.packages.entries())s.spec.trim().length===0&&t.push({severity:"warning",code:"package_spec_empty",dimension:"packages",target:`#${n}`,message:"Package recommendation has an empty spec; it cannot be surfaced as an install hint."})}function dt(e){let t=[];fe(e,t);let n=ye(e,t),s=he(e,t);ge(e,t),_e(e,n,s,t),ke(e,t),we(e,n,t),be(e,t);let r=t.filter(i=>i.severity==="error").length,o=t.length-r;return{profile:e.name,ok:r===0,findings:t,errorCount:r,warningCount: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]="ead1caea-8e8b-5208-9fba-23fb114044b5")}catch{}})();function E(e,t,n,s,r){let o=e,i=[];for(let a of t){let c=s(o),d=r(o,a),l=s(d.file);o=d.file;let m=c===l?"unchanged":d.replaced?"update":"add";i.push({key:n(a),status:m})}return{file:o,changes:i,changed:i.some(a=>a.status!=="unchanged")}}function ee(e){return JSON.stringify(e.map(t=>t.join("\0")).sort())}function ve(e,t){let n=e.map(r=>({...r})),s=[];for(let r of t){let o=n.findIndex(a=>a.type===r.type),i={type:r.type,allowed_transitions:r.allowed_transitions};o<0?(n.push(i),s.push({type:r.type,status:"add"})):ee(n[o].allowed_transitions)===ee(r.allowed_transitions)?s.push({type:r.type,status:"unchanged"}):(n[o]=i,s.push({type:r.type,status:"update"}))}return{changes:s,result:n,changed:s.some(r=>r.status!=="unchanged")}}function Ie(e,t){let n=[];for(let s of e.config){let r=b(s.key);if(r===void 0)throw new Error(`Profile "${e.name}" references unknown config key "${s.key}".`);let o=v(r,s.value);if(!o.ok)throw new Error(`Profile "${e.name}" config ${s.key}: ${o.error.message}`);let i=V(t,r),a=i===null?"add":i===o.parsed.value?"unchanged":"update";n.push({key:r.key,path:r.path,value:o.parsed.value,status:a})}return{changes:n,changed:n.some(s=>s.status!=="unchanged")}}function te(e){let t=Object.entries(e).sort(([n],[s])=>n.localeCompare(s));return JSON.stringify(t)}function Se(e,t){let n=[];for(let s of e.templates){let r=t.get(s.name),o;r===void 0?o="add":te(r)===te(s.options)?o="unchanged":o="update",n.push({name:s.name,options:s.options,status:o})}return{changes:n,changed:n.some(s=>s.status!=="unchanged")}}function yt(e,t){let n=E(M(t.typesRaw),e.types,l=>u(l).name,q,(l,m)=>z(l,u(m))),s=E(X(t.statusesRaw),e.statuses,l=>y(l).id,W,(l,m)=>Y(l,y(m))),r=E(B(t.fieldsRaw),e.fields,l=>f(l).key,j,(l,m)=>U(l,f(m))),o=ve(t.workflows,e.workflows),i=Ie(e,t.settings),a=Se(e,t.templates),c=e.packages.map(l=>({spec:l.spec,reason:l.reason,status:t.installedPackages.has(l.spec)?"installed":"recommended"})),d=n.changed||s.changed||r.changed||o.changed||i.changed||a.changed;return{profile:{name:e.name,title:e.title,summary:e.summary},types:n,statuses:s,fields:r,workflows:o,config:i,templates:a,packages:c,changed:d}}export{Ce as a,$e as b,Pe as c,De as d,Le as e,Q as f,Re as g,Fe as h,_ as i,I as j,ne as k,qe as l,Be as m,se as n,je as o,re as p,Ye as q,oe as r,b as s,v as t,V as u,Ge as v,at as w,lt as x,dt as y,yt as z};
26
- //# sourceMappingURL=chunk-TN4AE665.js.map
26
+ //# sourceMappingURL=chunk-VXDSU5MC.js.map