@unbrained/pm-cli 2026.9.22 → 2026.9.23

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 (68) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +6 -0
  3. package/dist/cli-bundle/bundle-manifest.json +147 -147
  4. package/dist/cli-bundle/chunks/{chunk-AVWHZUNC.js → chunk-6WBR6GMW.js} +2 -2
  5. package/dist/cli-bundle/chunks/{chunk-CM57QHVK.js → chunk-7IABMUB6.js} +3 -3
  6. package/dist/cli-bundle/chunks/{chunk-UDNYAMCM.js → chunk-E6ZES2X7.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-BJBBOUYQ.js → chunk-KOUT5SAA.js} +2 -2
  8. package/dist/cli-bundle/chunks/{chunk-D2OV2UBV.js → chunk-NBGSRFZE.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-ZSPZJOMK.js → chunk-OBTHQ6UX.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-3OFFMS2N.js → chunk-PFWCAI4X.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-JSW33Q6R.js → chunk-SXRMM72R.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-SBTT42A4.js → chunk-VO7DHENB.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-4XOV7Q5R.js → chunk-WBB5B7G5.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-ML42DLI3.js → chunk-ZSVINTXT.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-GFTN5OS4.js → chunk-ZWSWR2GX.js} +2 -2
  16. package/dist/cli-bundle/chunks/{register-list-query-VOS5CBX4.js → register-list-query-IFPQ4YRD.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-mutation-LWZH6UFJ.js → register-mutation-C3O7OSXW.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-operations-YJK4DNFZ.js → register-operations-LGO7DBZ7.js} +2 -2
  19. package/dist/cli-bundle/chunks/{register-setup-Q3CYF67Q.js → register-setup-4EW2PPZD.js} +2 -2
  20. package/dist/cli-bundle/focused-chunks/{chunk-QYN77MQP.js → chunk-3JAEZ7WI.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-LH24XUPJ.js → chunk-6CWR2QFM.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/{chunk-V2NARGRH.js → chunk-BKXYQQDT.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-JCD5YESL.js → chunk-BQSKFRL2.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-UAU4DJSR.js → chunk-BULUJEOL.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-AO5FR7PN.js → chunk-E5AOEXF5.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-PRMQTT7X.js → chunk-FIQYVDLL.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-FKYUTTFL.js → chunk-HJA6OHWT.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/{chunk-IOL25GKH.js → chunk-KMNH4G6Y.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-URH727T5.js → chunk-L554BKFH.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-QFEDRPPI.js → chunk-LZOEUNHR.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-UT7VS4X2.js → chunk-N2JYYEHM.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-TSI73EEM.js → chunk-PIHQNL32.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-MXESHALQ.js → chunk-QREDJ77O.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-XR5EBU3B.js → chunk-S5JYIFFS.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-CASXNCNQ.js → chunk-YE6F5HGF.js} +2 -2
  36. package/dist/cli-bundle/main.js +2 -2
  37. package/dist/cli-bundle/sdk-authoring.js +1 -1
  38. package/dist/cli-bundle/sdk-contracts.js +1 -1
  39. package/dist/cli-bundle/sdk-core.js +1 -1
  40. package/dist/cli-bundle/sdk-governance.js +1 -1
  41. package/dist/cli-bundle/sdk-graph.js +1 -1
  42. package/dist/cli-bundle/sdk-merge.js +2 -2
  43. package/dist/cli-bundle/sdk-query.js +1 -1
  44. package/dist/cli-bundle/sdk-runtime.js +1 -1
  45. package/dist/cli-bundle/sdk-testing.js +1 -1
  46. package/dist/cli-bundle/sdk.js +1 -1
  47. package/dist/sdk/cli-contracts/commander-types.d.ts +11 -11
  48. package/dist/sdk/cli-contracts/commander-types.js +1 -1
  49. package/dist/sdk/pagination.js +1 -1
  50. package/docs/QUALITY_EVIDENCE.md +70 -0
  51. package/docs/TESTING.md +8 -0
  52. package/marketplace.json +2 -2
  53. package/package.json +8 -3
  54. package/packages/pm-beads/package.json +1 -1
  55. package/packages/pm-calendar/package.json +1 -1
  56. package/packages/pm-command-kit/package.json +1 -1
  57. package/packages/pm-digital-twin/package.json +1 -1
  58. package/packages/pm-governance-audit/package.json +1 -1
  59. package/packages/pm-guide-shell/package.json +1 -1
  60. package/packages/pm-kanban/package.json +1 -1
  61. package/packages/pm-lifecycle-hooks/package.json +1 -1
  62. package/packages/pm-linked-test-adapters/package.json +1 -1
  63. package/packages/pm-search-advanced/package.json +1 -1
  64. package/packages/pm-templates/package.json +1 -1
  65. package/packages/pm-todos/package.json +1 -1
  66. package/packages/pm-vcs/package.json +1 -1
  67. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  68. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
@@ -18,7 +18,7 @@ ${i}
18
18
  stream_id, stream_offset, ts, author, agent_harness,
19
19
  agent_instance, op, event_class, entry_json
20
20
  ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(t.stream_id,t.stream_offset,n.ts,n.author,n.agent_harness??null,n.agent_instance??null,n.op,Xn(n),JSON.stringify(n))}function HO(e,t,n){e.prepare(`INSERT INTO streams(stream_id, byte_size) VALUES (?, ?)
21
- ON CONFLICT(stream_id) DO UPDATE SET byte_size = excluded.byte_size`).run(t,n)}async function X_(e,t,n){let r=Yt.dirname(Yt.dirname(e)),o=UO();if(!o){await n();return}let i=!1;try{await $O(r,async()=>{let s=Ql(r);try{await Nt.access(s)}catch{await n();return}let a;try{if(a=new o(s),a.prepare("SELECT value FROM metadata WHERE key = 'version'").get()?.value!==xO)throw new TypeError("Unsupported history event index version")}catch{a?.close(),await Nt.rm(s,{force:!0}),await n();return}try{a.exec("PRAGMA busy_timeout = 5000"),a.exec("BEGIN IMMEDIATE")}catch(l){throw a.close(),l}let c=!1;try{await n(),c=!0,i=!0;let l=Yt.basename(e,".jsonl"),d=a.prepare("SELECT COALESCE(MAX(stream_offset), -1) + 1 AS value FROM events WHERE stream_id = ?").get(l);zO(a,{stream_id:l,stream_offset:Number(d.value),entry:t}),HO(a,l,(await Nt.stat(e)).size),a.exec("COMMIT"),a.close()}catch(l){if(a?.close(),!c)throw l;await Bs(r)}})}catch(s){if(i){await Bs(r);return}if(!(s instanceof g)||s.code!=="lock_conflict")throw s;let a;try{await LO(r,async()=>{let c=await MO(r);a=c.pendingPath;try{await n(),i=!0}catch(l){throw await Nt.rm(c.pendingPath,{force:!0}),l}await Nt.rename(c.pendingPath,c.committedPath),await Bs(r)})}catch(c){if(i){await Bs(r);try{await Nt.rm(a,{force:!0})}catch{}return}throw c}}}async function ed(e){await Nt.rm(Ql(Yt.dirname(Yt.dirname(e))),{force:!0})}import ud from"node:fs/promises";import jr 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]="6e88d6b7-aa5f-5515-8ea4-481916b12ef1")}catch{}})();import{AsyncLocalStorage as j0}from"node:async_hooks";(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]="b18eefc1-0d1d-5c9c-b98a-b96771070301")}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]="4f014bd9-39b6-5017-93ed-f0e7fba8497a")}catch{}})();var Z_=e=>{let t='"',n=0;for(let r of e){if(r==="\\"){n+=1;continue}t+="\\".repeat(r==='"'?n*2+1:n),t+=r,n=0}return`${t}${"\\".repeat(n*2)}"`},td=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?Z_(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,vn=(e,t=process.platform)=>{let n=e.map(r=>td(r,t)).join(" ");return n.length>0?`pm ${n}`:"pm"};(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]="49de148c-3c60-547b-b3bc-d0a71e013dc6")}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]="6c87b004-3647-531a-9599-d37fd91c2807")}catch{}})();function Q_(e,t,n){if(e&&t)throw new g(`${n} cannot be combined with --full`,_.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]="15037266-75b7-5f8d-9565-e7848e720a49")}catch{}})();var qO=1,BO=4096;var rV=Object.freeze({version:qO,max_length:BO});(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]="c7018240-2680-597f-9e71-e4b3f46ef91d")}catch{}})();var Ws=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-tqel"})),eg=[...["next","focus"].map(e=>({alias:e,canonical:`context ${e}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-6apl"})),...["normalize","reindex"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(e=>({...e,canonical_argv:e.canonical.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap"})),tg=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-ik19"})),Vs=[...eg,...tg,...[...["comments","notes","learnings","files","docs","deps","append","test"].map(e=>[e,`item ${e}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(e=>[`completion-${e}`,`completion ${e}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(e=>[e,`calendar ${e}`,"pm-o3fh"])].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:n}))],nd=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-3z0k"},...Ws,...Vs,...["discover","lookup"].map(e=>({alias:`files ${e}`,canonical:`item files ${e}`,canonical_argv:["item","files",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-yql1"}))];function ng(e){let t=e.trim().replace(/\s+/gu," ");return nd.find(n=>n.canonical===t.replace(/^ctx /u,"context "))?.alias??t}function Jt(e){return ng(e)}var Ks=[...nd,...[["ctx","context"],["packages","package"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-pbyu"})),...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:[t,n],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:["comments","notes","learnings"].includes(t)?`item ${t}`:t,canonical_argv:["comments","notes","learnings"].includes(t)?["item",t]:[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"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-tnud"}))],rd=Object.fromEntries(Ks.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));(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]="85bc6b10-700a-5d06-970f-d544833dd059")}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]="be0a8071-52f7-56a6-9830-a60e0d2cf29d")}catch{}})();import{createHash as rg}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]="8b0d8654-211b-57bf-852f-8a153849e8fd")}catch{}})();var Js=["policies","policy-put","policy-remove","policy-mode","policy-check","policy-approve","policy-presets"],od=256,$r=64;function Ke(e){throw new g(`Invalid workflow policy: ${e}`,_.USAGE,{code:"workflow_policy_invalid",nextSteps:["Inspect pm schema policies and correct the declaration using pm schema policy-put."]})}function Xt(e,t,n){if(typeof e!="object"||e===null||Array.isArray(e))return Ke(`${n} must be an object`);let r=e;return Object.keys(r).some(o=>!t.includes(o))?Ke(`${n} contains an unknown key`):r}function Zn(e,t,n=128){return typeof e!="string"||!e.trim()||e.length>n?Ke(`${t} must be nonempty text of at most ${n} characters`):e.trim()}function jo(e,t){if(!Array.isArray(e)||e.length===0||e.length>$r)return Ke(`${t} requires 1-${$r} terms`);let n=e.map(r=>Zn(r,t));return t==="fields"&&n.some(r=>!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$/.test(r)||r.split(".").some(o=>["__proto__","constructor","prototype"].includes(o)))?Ke("fields must be safe metadata paths of at most eight segments"):[...new Set(n)]}function VO(e){let t=Xt(e,["kind","fields","authors","allowed"],"rule");return t.kind==="transition"?(Xt(t,["kind","allowed"],"transition rule"),!Array.isArray(t.allowed)||t.allowed.length>$r?Ke("transition.allowed must be a bounded array"):{kind:"transition",allowed:t.allowed.map(n=>!Array.isArray(n)||n.length!==2?Ke("transition pairs need two statuses"):[Zn(n[0],"from"),Zn(n[1],"to")])}):t.kind==="authors"?(Xt(t,["kind","authors"],"authors rule"),{kind:"authors",authors:jo(t.authors,"authors")}):t.kind==="require_fields"?(Xt(t,["kind","fields"],"require_fields rule"),{kind:"require_fields",fields:jo(t.fields,"fields")}):t.kind==="field_writers"||t.kind==="approval"?(Xt(t,["kind","fields","authors"],"field rule"),{kind:t.kind,fields:jo(t.fields,"fields"),authors:jo(t.authors,"authors")}):Ke("unknown rule kind")}function KO(e){let t={},n=Xt(e,["types","tags","statuses","operations","parents","dependency"],"subject");for(let r of["types","tags","statuses","operations","parents"])n[r]!==void 0&&(t[r]=jo(n[r],r));if(n.dependency!==void 0){let r=Xt(n.dependency,["kind","id"],"dependency");t.dependency={kind:Zn(r.kind,"dependency kind"),...r.id===void 0?{}:{id:Zn(r.id,"dependency id")}}}return t}function og(e){let t=Xt(e,["id","description","subject","effect","rule"],"policy"),n=Zn(t.id,"id");return/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(n)?t.effect!==void 0&&(typeof t.effect!="string"||!["advise","warn","refuse"].includes(t.effect))?Ke("effect must be advise, warn, or refuse"):{id:n,rule:VO(t.rule),...t.subject===void 0?{}:{subject:KO(t.subject)},...t.description===void 0?{}:{description:Zn(t.description,"description",500)},...t.effect===void 0?{}:{effect:t.effect}}:Ke("id must be a stable token")}function Xs(e){let t=Xt(e,["version","enforcement","policies"],"document");if(t.version!==1)return Ke("unsupported version");if(t.enforcement!==void 0&&t.enforcement!=="advise"&&t.enforcement!=="refuse")return Ke("enforcement must be advise or refuse");if(!Array.isArray(t.policies)||t.policies.length>od)return Ke(`policies must contain at most ${od} declarations`);let n=t.policies.map(og);return new Set(n.map(r=>r.id)).size!==n.length?Ke("duplicate policy id"):{version:1,enforcement:t.enforcement??"advise",policies:n}}function Ys(e,t){let n=e;for(let r of t.split(".")){if(typeof n!="object"||n===null||!Object.hasOwn(n,r))return;n=n[r]}return n}function YO(e){return e==null?!1:typeof e=="string"?e.trim().length>0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.length>0:typeof e=="object"?Object.keys(e).length>0:!0}function id(e){return rg("sha256").update(O(e)).digest("hex")}function ig(e,t){let n=e.rule.kind==="approval"?e.rule.fields:[];return rg("sha256").update(O({id:t.id,fields:n.map(r=>[r,Ys(t,r)])})).digest("hex")}function JO(e,t){return Array.isArray(t)&&t.some(n=>typeof n=="object"&&n!==null&&"kind"in n&&n.kind===e.kind&&(e.id===void 0||"id"in n&&n.id===e.id))}function XO(e,t,n){return!(e.types&&!e.types.some(r=>r.toLowerCase()===String(t.type).toLowerCase())||e.statuses&&!e.statuses.includes(String(t.status))||e.operations&&!e.operations.includes(n)||e.parents&&!e.parents.includes(String(t.parent))||e.tags&&(!Array.isArray(t.tags)||!e.tags.some(r=>t.tags.includes(r)))||e.dependency&&!JO(e.dependency,t.dependencies))}function sd(e,t){if(t.completeness_only&&(e.rule.kind!=="require_fields"||e.subject?.operations!==void 0)||e.rule.kind==="approval"&&t.before===null)return!1;let n=e.subject??{},r=t.after?.status??t.before?.status;return[t.before,t.after].some(o=>o!==null&&XO(n,{...o,status:r},t.operation))}function ZO(e,t,n,r){let o=["type","tags","parent","dependencies"].some(s=>!xe(t.before?.[s],t.after?.[s]));return t.after&&(t.completeness_only||n||r||o)?e.filter(s=>!YO(Ys(t.after,s))):[]}function QO(e,t,n,r){let o=t.after??t.before,i=ig(e,o);return t.approvals?.some(s=>s.policy_fingerprint===r&&s.content_fingerprint===i&&s.author!==t.author&&n.includes(s.author))??!1}function e0(e,t,n){let r=e.rule,o=t.before?.status!==t.after?.status,i="fields"in r&&r.fields.some(s=>!xe(Ys(t.before,s),Ys(t.after,s)));switch(r.kind){case"require_fields":{let s=ZO(r.fields,t,o,i);return{satisfied:s.length===0,missing_fields:s,remediation:"Supply the declared required fields before this lifecycle transition."}}case"transition":return{satisfied:!o||r.allowed.some(([s,a])=>s===String(t.before?.status??"$create")&&a===String(t.after?.status??"$delete")),missing_fields:[],remediation:"Choose a declared allowed transition; inspect pm schema policies."};case"authors":return{satisfied:r.authors.includes(t.author),missing_fields:[],remediation:"Have a declared workflow actor perform this operation."};case"field_writers":return{satisfied:!i||r.authors.includes(t.author),missing_fields:[],remediation:"Have a declared field writer change the protected fields."};case"approval":return{satisfied:!o||QO(e,t,r.authors,n),missing_fields:[],remediation:`Record an independent approval with pm schema policy-approve <item-id> --policy ${e.id} after preparing the reviewed fields.`}}}function sg(e,t,n){let r=e.policies.filter(o=>sd(o,t)).map(o=>{let i=o.effect??"advise",s=n(o);return{policy_id:o.id,policy_fingerprint:s,rule:o.rule.kind,effect:i==="refuse"&&e.enforcement!=="refuse"?"warn":i,...e0(o,t,s)}});return{allowed:!r.some(o=>!o.satisfied&&o.effect==="refuse"),decisions:r,warnings:r.filter(o=>!o.satisfied).map(o=>`workflow_policy:${o.effect}:${o.policy_id}:${o.rule}`)}}function ag(e,t){return sg(e,t,id)}function cg(e){let t=Xs(e),n=new Map(t.policies.map(r=>[r,id(r)]));return r=>sg(t,r,o=>n.get(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]="1dd71b26-fc38-5304-9156-f32b57cc1cc0")}catch{}})();var t0=[...Qe],n0=[...wr],r0=[...Gi],o0=[...Wi],i0=[...Vi],s0=[...Ki],Fr=["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-attest","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"];var lg=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],dg=["upgrade"],ug=["reopen"],fg={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},kn=Object.freeze(Fr.flatMap(e=>e in fg?[]:e==="extension"||e==="package"?[...lg.map(t=>`${e}-${t}`),...e==="package"?dg.map(t=>`package-${t}`):[],e]:e==="item"?ug.map(t=>`item-${t}`):[e])),mg=Object.freeze(Ks.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&kn.includes(e.alias)).map(e=>e.alias)),a0=Object.freeze(kn.filter(e=>!mg.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]="b4036040-c0b8-5d01-b490-3405722fd1c5")}catch{}})();var pg=["full","compact","brief","summary","counts"];var _g=["error","warning","validation_summary","recovery_bundle"],gg=["full","omit_explanation","limit_collections","compact_recovery","action_only"],c0=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"]),l0=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),d0=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),u0={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},f0=3,m0=2,p0=192,_0={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},hg=_g.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:_0[e],minimum_max_estimated_tokens:p0,degradation_ladder:gg,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),kV=new Map(hg.map(e=>[e.diagnostic_class,e]));function yg(e){let[t=""]=Jt(e).split(/\s+/u);return c0.has(t)?"mutation":l0.has(t)?"discovery":d0.has(t)?"governance":"read"}function wg(e,t=yg(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let r=u0[t];return bg({command:n,budget_class:t,default_max_estimated_tokens:r,default_max_estimated_tokens_by_format:{toon:r,json:Math.ceil(r*f0/m0)},degradation_ladder:pg,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function bg(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 vg=Fr.map(e=>wg(e)),EV=new Map(vg.map(e=>[e.command,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]="de370088-9285-5b33-8c7f-da8e9bb88286")}catch{}})();var h0=Object.freeze(["queue_draining","queue_entries","queue_exists","queue_high_retry_entries","queue_invalid_rows","queue_max_attempts","queue_rows_total","queue_size_bytes","pending_otel_spans","last_attempted_flush_at","last_failed_flush_at","last_otel_attempt_at","last_otel_failure_at","last_otel_success_at","last_successful_flush_at"]),y0=Object.freeze({health:Object.freeze({version:3,paths:Object.freeze(["checks"]),ignored_detail_field_names_by_row:Object.freeze({telemetry:h0}),guarantee:"nonvolatile_snapshot_and_stable_configuration"})});(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]="999accf0-d4e1-5dc4-92a0-4ea7d745ac48")}catch{}})();var kg=256,Zs=1e4,k0=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,E0=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;var MV=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&k0.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=kg,reason:`token_budget must be a safe integer of at least ${kg}.`},{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<=Zs&&e.seen_item_ids.every(t=>typeof t=="string"&&E0.test(t)),reason:`seen_item_ids must contain at most ${Zs} portable item identifiers.`}];(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]="8a044fa0-4028-5527-b6ff-43ec995e8830")}catch{}})();var Eg=["include","amount","cost","encoding"],Sg=["list","context","search","get","next","health","deps","graph","history","activity","validate","events","contracts","comments","notes","files","docs","stats","aggregate","duplicates","package-catalog","package-manage","comments-audit","assurance"],x0=["canonical","legacy","intent","default"],ad={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"};var Tg=Object.freeze(Eg.map(e=>ad[e])),Ag=Object.freeze(["--output-session","--output-cursor","--output-row-contract"]),Ig={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:{},duplicates:{amount:["--limit"]},"package-catalog":{},"package-manage":{},"comments-audit":{},assurance:{}},Cg=new Set(["--collapse","--fields","--section"]),cd=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 Og(e){return e.slice(2).replaceAll("-","_")}function R0(e,t){let n=cd[e];if(n!==void 0)return n;let r=t==="include"?Cg.has(e)?"<csv>":Og(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${ad[t]} ${r}.`}function N0(e){let t=Ig[e],n=Object.freeze(Object.fromEntries(Eg.map(r=>[r,Object.freeze({dimension:r,canonical_option:ad[r],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[r]??[]).map(o=>Object.freeze({flag:o,semantics:cd[o]===void 0?"replacement":"behavior_preserving",migration_hint:R0(o,r),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:x0,budget_retention_policy:e==="assurance"?"verdict_priority":"ordered_prefix",projection_modes:Object.freeze([...P0(e).keys()])})}var D0=Object.freeze(Sg.map(N0)),c5=new Map(D0.map(e=>[e.command,e]));function Uo(e,t={}){let n=Jt(e.trim().toLowerCase()),o=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],i=o.startsWith("list-")?"list":o==="ctx"?"context":o;return Sg.includes(i)?i:void 0}function P0(e){let t=Uo(e);return t?new Map((Ig[t].include??[]).filter(n=>!Cg.has(n)&&cd[n]===void 0).map(n=>[Og(n),L0(n)])):new Map}function L0(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}(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]="72eb01a9-e8b8-59cd-b178-3c594d3faff9")}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]="3b38d564-6034-54ae-ad24-eddba01a2c5c")}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]="8bf25242-1b7a-501d-9540-7559cb97bcc6")}catch{}})();var x5=Object.freeze([{command:"context",intent:"orient",description:"Bounded active hierarchy, ownership, blockers, and recent progress.",included_field_groups:["summary","focus","hierarchy","blockers","activity"],token_budget:3e3,source:"core"},{command:"context",intent:"handoff",description:"Active ownership, evidence, decisions, and immediate continuation context.",included_field_groups:["summary","focus","in_progress","decisions","activity"],token_budget:2200,source:"core"},{command:"get",intent:"inspect",description:"Standard-depth item metadata, relationships, evidence, and lifecycle state.",included_field_groups:["item","children","claim_state","linked"],token_budget:3200,source:"core"},{command:"list",intent:"triage",description:"A budget-derived page of compact governance, ownership, priority, and blocker rows for triage.",included_field_groups:["identity","governance","ownership","dependencies"],token_budget:3200,source:"core"},{command:"next",intent:"execute",description:"The highest-ranked actionable work with concise ranking evidence.",included_field_groups:["recommended"],token_budget:1200,source:"core"},{command:"search",intent:"discover",description:"A budget-derived page of ranked canonical lineage candidates with compact match evidence.",included_field_groups:["identity","status","lineage","match"],token_budget:1800,source:"core"}]),R5=new j0;(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]="83c82348-64f8-5f10-9396-b03add0b7932")}catch{}})();import{encode as Q5}from"@toon-format/toon";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ca9480d-0ae4-50e8-887e-c4183501d92c")}catch{}})();var e4=new Set(Object.values(_));var xg=!1;function ld(e){return typeof e=="object"&&e!==null&&e.code==="EPIPE"}function z0(){(process.exitCode===void 0||process.exitCode===_.SUCCESS)&&(process.exitCode=_.SUCCESS)}function H0(){(process.exitCode===void 0||process.exitCode===_.SUCCESS)&&(process.exitCode=_.GENERIC_FAILURE)}function dd(e){if(e==="stdout"){z0();return}H0()}function Rg(e){let t=e instanceof Error?e:new Error(String(e));setImmediate(()=>{throw t})}function q0(){xg||(xg=!0,process.stdout.on("error",e=>{if(ld(e)){dd("stdout");return}Rg(e)}),process.stderr.on("error",e=>{if(ld(e)){dd("stderr");return}Rg(e)}))}function B0(e,t){q0();try{return e==="stdout"?process.stdout.write(t):process.stderr.write(t),!0}catch(n){if(ld(n))return dd(e),!1;throw n}}function Qs(e){return B0("stderr",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]="979782f5-f4ee-5df5-a68a-0c51ab0548ae")}catch{}})();var G0=jr.join("runtime","history-drift-cache.json"),Dg={EINVAL:"invalid_cache_path",EISDIR:"cache_path_is_directory",ENOENT:"invalid_cache_path",ENOTDIR:"invalid_cache_path",ERR_FS_EISDIR:"cache_path_is_directory"};function Pg(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"?e.code:void 0}async function fd(e){let t=jr.join(e,G0),n=!1,r="invalid_cache_path";try{n=(await ud.stat(await ud.realpath(e))).isDirectory()}catch(o){let i=Pg(o);r=i===void 0?"unknown":Dg[i]??"filesystem_error"}if(!n){Qs(`[pm] warning: history_drift_cache_invalidation_failed:${r}
21
+ ON CONFLICT(stream_id) DO UPDATE SET byte_size = excluded.byte_size`).run(t,n)}async function X_(e,t,n){let r=Yt.dirname(Yt.dirname(e)),o=UO();if(!o){await n();return}let i=!1;try{await $O(r,async()=>{let s=Ql(r);try{await Nt.access(s)}catch{await n();return}let a;try{if(a=new o(s),a.prepare("SELECT value FROM metadata WHERE key = 'version'").get()?.value!==xO)throw new TypeError("Unsupported history event index version")}catch{a?.close(),await Nt.rm(s,{force:!0}),await n();return}try{a.exec("PRAGMA busy_timeout = 5000"),a.exec("BEGIN IMMEDIATE")}catch(l){throw a.close(),l}let c=!1;try{await n(),c=!0,i=!0;let l=Yt.basename(e,".jsonl"),d=a.prepare("SELECT COALESCE(MAX(stream_offset), -1) + 1 AS value FROM events WHERE stream_id = ?").get(l);zO(a,{stream_id:l,stream_offset:Number(d.value),entry:t}),HO(a,l,(await Nt.stat(e)).size),a.exec("COMMIT"),a.close()}catch(l){if(a?.close(),!c)throw l;await Bs(r)}})}catch(s){if(i){await Bs(r);return}if(!(s instanceof g)||s.code!=="lock_conflict")throw s;let a;try{await LO(r,async()=>{let c=await MO(r);a=c.pendingPath;try{await n(),i=!0}catch(l){throw await Nt.rm(c.pendingPath,{force:!0}),l}await Nt.rename(c.pendingPath,c.committedPath),await Bs(r)})}catch(c){if(i){await Bs(r);try{await Nt.rm(a,{force:!0})}catch{}return}throw c}}}async function ed(e){await Nt.rm(Ql(Yt.dirname(Yt.dirname(e))),{force:!0})}import ud from"node:fs/promises";import jr 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]="6e88d6b7-aa5f-5515-8ea4-481916b12ef1")}catch{}})();import{AsyncLocalStorage as j0}from"node:async_hooks";(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]="b18eefc1-0d1d-5c9c-b98a-b96771070301")}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]="4f014bd9-39b6-5017-93ed-f0e7fba8497a")}catch{}})();var Z_=e=>{let t='"',n=0;for(let r of e){if(r==="\\"){n+=1;continue}t+="\\".repeat(r==='"'?n*2+1:n),t+=r,n=0}return`${t}${"\\".repeat(n*2)}"`},td=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?Z_(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,vn=(e,t=process.platform)=>{let n=e.map(r=>td(r,t)).join(" ");return n.length>0?`pm ${n}`:"pm"};(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]="49de148c-3c60-547b-b3bc-d0a71e013dc6")}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]="6c87b004-3647-531a-9599-d37fd91c2807")}catch{}})();function Q_(e,t,n){if(e&&t)throw new g(`${n} cannot be combined with --full`,_.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]="4b085328-0791-58f5-872a-f796f9087ab4")}catch{}})();var qO=1,BO=4096;var rV=Object.freeze({version:qO,max_length:BO});(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]="c7018240-2680-597f-9e71-e4b3f46ef91d")}catch{}})();var Ws=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-tqel"})),eg=[...["next","focus"].map(e=>({alias:e,canonical:`context ${e}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-6apl"})),...["normalize","reindex"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(e=>({...e,canonical_argv:e.canonical.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap"})),tg=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-ik19"})),Vs=[...eg,...tg,...[...["comments","notes","learnings","files","docs","deps","append","test"].map(e=>[e,`item ${e}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(e=>[`completion-${e}`,`completion ${e}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(e=>[e,`calendar ${e}`,"pm-o3fh"])].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:n}))],nd=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-3z0k"},...Ws,...Vs,...["discover","lookup"].map(e=>({alias:`files ${e}`,canonical:`item files ${e}`,canonical_argv:["item","files",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-yql1"}))];function ng(e){let t=e.trim().replace(/\s+/gu," ");return nd.find(n=>n.canonical===t.replace(/^ctx /u,"context "))?.alias??t}function Jt(e){return ng(e)}var Ks=[...nd,...[["ctx","context"],["packages","package"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-pbyu"})),...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:[t,n],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:["comments","notes","learnings"].includes(t)?`item ${t}`:t,canonical_argv:["comments","notes","learnings"].includes(t)?["item",t]:[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"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-tnud"}))],rd=Object.fromEntries(Ks.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));(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]="85bc6b10-700a-5d06-970f-d544833dd059")}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]="be0a8071-52f7-56a6-9830-a60e0d2cf29d")}catch{}})();import{createHash as rg}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]="8b0d8654-211b-57bf-852f-8a153849e8fd")}catch{}})();var Js=["policies","policy-put","policy-remove","policy-mode","policy-check","policy-approve","policy-presets"],od=256,$r=64;function Ke(e){throw new g(`Invalid workflow policy: ${e}`,_.USAGE,{code:"workflow_policy_invalid",nextSteps:["Inspect pm schema policies and correct the declaration using pm schema policy-put."]})}function Xt(e,t,n){if(typeof e!="object"||e===null||Array.isArray(e))return Ke(`${n} must be an object`);let r=e;return Object.keys(r).some(o=>!t.includes(o))?Ke(`${n} contains an unknown key`):r}function Zn(e,t,n=128){return typeof e!="string"||!e.trim()||e.length>n?Ke(`${t} must be nonempty text of at most ${n} characters`):e.trim()}function jo(e,t){if(!Array.isArray(e)||e.length===0||e.length>$r)return Ke(`${t} requires 1-${$r} terms`);let n=e.map(r=>Zn(r,t));return t==="fields"&&n.some(r=>!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$/.test(r)||r.split(".").some(o=>["__proto__","constructor","prototype"].includes(o)))?Ke("fields must be safe metadata paths of at most eight segments"):[...new Set(n)]}function VO(e){let t=Xt(e,["kind","fields","authors","allowed"],"rule");return t.kind==="transition"?(Xt(t,["kind","allowed"],"transition rule"),!Array.isArray(t.allowed)||t.allowed.length>$r?Ke("transition.allowed must be a bounded array"):{kind:"transition",allowed:t.allowed.map(n=>!Array.isArray(n)||n.length!==2?Ke("transition pairs need two statuses"):[Zn(n[0],"from"),Zn(n[1],"to")])}):t.kind==="authors"?(Xt(t,["kind","authors"],"authors rule"),{kind:"authors",authors:jo(t.authors,"authors")}):t.kind==="require_fields"?(Xt(t,["kind","fields"],"require_fields rule"),{kind:"require_fields",fields:jo(t.fields,"fields")}):t.kind==="field_writers"||t.kind==="approval"?(Xt(t,["kind","fields","authors"],"field rule"),{kind:t.kind,fields:jo(t.fields,"fields"),authors:jo(t.authors,"authors")}):Ke("unknown rule kind")}function KO(e){let t={},n=Xt(e,["types","tags","statuses","operations","parents","dependency"],"subject");for(let r of["types","tags","statuses","operations","parents"])n[r]!==void 0&&(t[r]=jo(n[r],r));if(n.dependency!==void 0){let r=Xt(n.dependency,["kind","id"],"dependency");t.dependency={kind:Zn(r.kind,"dependency kind"),...r.id===void 0?{}:{id:Zn(r.id,"dependency id")}}}return t}function og(e){let t=Xt(e,["id","description","subject","effect","rule"],"policy"),n=Zn(t.id,"id");return/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(n)?t.effect!==void 0&&(typeof t.effect!="string"||!["advise","warn","refuse"].includes(t.effect))?Ke("effect must be advise, warn, or refuse"):{id:n,rule:VO(t.rule),...t.subject===void 0?{}:{subject:KO(t.subject)},...t.description===void 0?{}:{description:Zn(t.description,"description",500)},...t.effect===void 0?{}:{effect:t.effect}}:Ke("id must be a stable token")}function Xs(e){let t=Xt(e,["version","enforcement","policies"],"document");if(t.version!==1)return Ke("unsupported version");if(t.enforcement!==void 0&&t.enforcement!=="advise"&&t.enforcement!=="refuse")return Ke("enforcement must be advise or refuse");if(!Array.isArray(t.policies)||t.policies.length>od)return Ke(`policies must contain at most ${od} declarations`);let n=t.policies.map(og);return new Set(n.map(r=>r.id)).size!==n.length?Ke("duplicate policy id"):{version:1,enforcement:t.enforcement??"advise",policies:n}}function Ys(e,t){let n=e;for(let r of t.split(".")){if(typeof n!="object"||n===null||!Object.hasOwn(n,r))return;n=n[r]}return n}function YO(e){return e==null?!1:typeof e=="string"?e.trim().length>0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.length>0:typeof e=="object"?Object.keys(e).length>0:!0}function id(e){return rg("sha256").update(O(e)).digest("hex")}function ig(e,t){let n=e.rule.kind==="approval"?e.rule.fields:[];return rg("sha256").update(O({id:t.id,fields:n.map(r=>[r,Ys(t,r)])})).digest("hex")}function JO(e,t){return Array.isArray(t)&&t.some(n=>typeof n=="object"&&n!==null&&"kind"in n&&n.kind===e.kind&&(e.id===void 0||"id"in n&&n.id===e.id))}function XO(e,t,n){return!(e.types&&!e.types.some(r=>r.toLowerCase()===String(t.type).toLowerCase())||e.statuses&&!e.statuses.includes(String(t.status))||e.operations&&!e.operations.includes(n)||e.parents&&!e.parents.includes(String(t.parent))||e.tags&&(!Array.isArray(t.tags)||!e.tags.some(r=>t.tags.includes(r)))||e.dependency&&!JO(e.dependency,t.dependencies))}function sd(e,t){if(t.completeness_only&&(e.rule.kind!=="require_fields"||e.subject?.operations!==void 0)||e.rule.kind==="approval"&&t.before===null)return!1;let n=e.subject??{},r=t.after?.status??t.before?.status;return[t.before,t.after].some(o=>o!==null&&XO(n,{...o,status:r},t.operation))}function ZO(e,t,n,r){let o=["type","tags","parent","dependencies"].some(s=>!xe(t.before?.[s],t.after?.[s]));return t.after&&(t.completeness_only||n||r||o)?e.filter(s=>!YO(Ys(t.after,s))):[]}function QO(e,t,n,r){let o=t.after??t.before,i=ig(e,o);return t.approvals?.some(s=>s.policy_fingerprint===r&&s.content_fingerprint===i&&s.author!==t.author&&n.includes(s.author))??!1}function e0(e,t,n){let r=e.rule,o=t.before?.status!==t.after?.status,i="fields"in r&&r.fields.some(s=>!xe(Ys(t.before,s),Ys(t.after,s)));switch(r.kind){case"require_fields":{let s=ZO(r.fields,t,o,i);return{satisfied:s.length===0,missing_fields:s,remediation:"Supply the declared required fields before this lifecycle transition."}}case"transition":return{satisfied:!o||r.allowed.some(([s,a])=>s===String(t.before?.status??"$create")&&a===String(t.after?.status??"$delete")),missing_fields:[],remediation:"Choose a declared allowed transition; inspect pm schema policies."};case"authors":return{satisfied:r.authors.includes(t.author),missing_fields:[],remediation:"Have a declared workflow actor perform this operation."};case"field_writers":return{satisfied:!i||r.authors.includes(t.author),missing_fields:[],remediation:"Have a declared field writer change the protected fields."};case"approval":return{satisfied:!o||QO(e,t,r.authors,n),missing_fields:[],remediation:`Record an independent approval with pm schema policy-approve <item-id> --policy ${e.id} after preparing the reviewed fields.`}}}function sg(e,t,n){let r=e.policies.filter(o=>sd(o,t)).map(o=>{let i=o.effect??"advise",s=n(o);return{policy_id:o.id,policy_fingerprint:s,rule:o.rule.kind,effect:i==="refuse"&&e.enforcement!=="refuse"?"warn":i,...e0(o,t,s)}});return{allowed:!r.some(o=>!o.satisfied&&o.effect==="refuse"),decisions:r,warnings:r.filter(o=>!o.satisfied).map(o=>`workflow_policy:${o.effect}:${o.policy_id}:${o.rule}`)}}function ag(e,t){return sg(e,t,id)}function cg(e){let t=Xs(e),n=new Map(t.policies.map(r=>[r,id(r)]));return r=>sg(t,r,o=>n.get(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]="1dd71b26-fc38-5304-9156-f32b57cc1cc0")}catch{}})();var t0=[...Qe],n0=[...wr],r0=[...Gi],o0=[...Wi],i0=[...Vi],s0=[...Ki],Fr=["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-attest","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"];var lg=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],dg=["upgrade"],ug=["reopen"],fg={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},kn=Object.freeze(Fr.flatMap(e=>e in fg?[]:e==="extension"||e==="package"?[...lg.map(t=>`${e}-${t}`),...e==="package"?dg.map(t=>`package-${t}`):[],e]:e==="item"?ug.map(t=>`item-${t}`):[e])),mg=Object.freeze(Ks.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&kn.includes(e.alias)).map(e=>e.alias)),a0=Object.freeze(kn.filter(e=>!mg.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]="b4036040-c0b8-5d01-b490-3405722fd1c5")}catch{}})();var pg=["full","compact","brief","summary","counts"];var _g=["error","warning","validation_summary","recovery_bundle"],gg=["full","omit_explanation","limit_collections","compact_recovery","action_only"],c0=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"]),l0=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),d0=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),u0={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},f0=3,m0=2,p0=192,_0={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},hg=_g.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:_0[e],minimum_max_estimated_tokens:p0,degradation_ladder:gg,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),kV=new Map(hg.map(e=>[e.diagnostic_class,e]));function yg(e){let[t=""]=Jt(e).split(/\s+/u);return c0.has(t)?"mutation":l0.has(t)?"discovery":d0.has(t)?"governance":"read"}function wg(e,t=yg(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let r=u0[t];return bg({command:n,budget_class:t,default_max_estimated_tokens:r,default_max_estimated_tokens_by_format:{toon:r,json:Math.ceil(r*f0/m0)},degradation_ladder:pg,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function bg(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 vg=Fr.map(e=>wg(e)),EV=new Map(vg.map(e=>[e.command,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]="de370088-9285-5b33-8c7f-da8e9bb88286")}catch{}})();var h0=Object.freeze(["queue_draining","queue_entries","queue_exists","queue_high_retry_entries","queue_invalid_rows","queue_max_attempts","queue_rows_total","queue_size_bytes","pending_otel_spans","last_attempted_flush_at","last_failed_flush_at","last_otel_attempt_at","last_otel_failure_at","last_otel_success_at","last_successful_flush_at"]),y0=Object.freeze({health:Object.freeze({version:3,paths:Object.freeze(["checks"]),ignored_detail_field_names_by_row:Object.freeze({telemetry:h0}),guarantee:"nonvolatile_snapshot_and_stable_configuration"})});(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]="999accf0-d4e1-5dc4-92a0-4ea7d745ac48")}catch{}})();var kg=256,Zs=1e4,k0=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,E0=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;var MV=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&k0.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=kg,reason:`token_budget must be a safe integer of at least ${kg}.`},{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<=Zs&&e.seen_item_ids.every(t=>typeof t=="string"&&E0.test(t)),reason:`seen_item_ids must contain at most ${Zs} portable item identifiers.`}];(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]="8a044fa0-4028-5527-b6ff-43ec995e8830")}catch{}})();var Eg=["include","amount","cost","encoding"],Sg=["list","context","search","get","next","health","deps","graph","history","activity","validate","events","contracts","comments","notes","files","docs","stats","aggregate","duplicates","package-catalog","package-manage","comments-audit","assurance"],x0=["canonical","legacy","intent","default"],ad={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"};var Tg=Object.freeze(Eg.map(e=>ad[e])),Ag=Object.freeze(["--output-session","--output-cursor","--output-row-contract"]),Ig={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:{},duplicates:{amount:["--limit"]},"package-catalog":{},"package-manage":{},"comments-audit":{},assurance:{}},Cg=new Set(["--collapse","--fields","--section"]),cd=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 Og(e){return e.slice(2).replaceAll("-","_")}function R0(e,t){let n=cd[e];if(n!==void 0)return n;let r=t==="include"?Cg.has(e)?"<csv>":Og(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${ad[t]} ${r}.`}function N0(e){let t=Ig[e],n=Object.freeze(Object.fromEntries(Eg.map(r=>[r,Object.freeze({dimension:r,canonical_option:ad[r],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[r]??[]).map(o=>Object.freeze({flag:o,semantics:cd[o]===void 0?"replacement":"behavior_preserving",migration_hint:R0(o,r),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:x0,budget_retention_policy:e==="assurance"?"verdict_priority":"ordered_prefix",projection_modes:Object.freeze([...P0(e).keys()])})}var D0=Object.freeze(Sg.map(N0)),c5=new Map(D0.map(e=>[e.command,e]));function Uo(e,t={}){let n=Jt(e.trim().toLowerCase()),o=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],i=o.startsWith("list-")?"list":o==="ctx"?"context":o;return Sg.includes(i)?i:void 0}function P0(e){let t=Uo(e);return t?new Map((Ig[t].include??[]).filter(n=>!Cg.has(n)&&cd[n]===void 0).map(n=>[Og(n),L0(n)])):new Map}function L0(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}(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]="72eb01a9-e8b8-59cd-b178-3c594d3faff9")}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]="3b38d564-6034-54ae-ad24-eddba01a2c5c")}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]="8bf25242-1b7a-501d-9540-7559cb97bcc6")}catch{}})();var x5=Object.freeze([{command:"context",intent:"orient",description:"Bounded active hierarchy, ownership, blockers, and recent progress.",included_field_groups:["summary","focus","hierarchy","blockers","activity"],token_budget:3e3,source:"core"},{command:"context",intent:"handoff",description:"Active ownership, evidence, decisions, and immediate continuation context.",included_field_groups:["summary","focus","in_progress","decisions","activity"],token_budget:2200,source:"core"},{command:"get",intent:"inspect",description:"Standard-depth item metadata, relationships, evidence, and lifecycle state.",included_field_groups:["item","children","claim_state","linked"],token_budget:3200,source:"core"},{command:"list",intent:"triage",description:"A budget-derived page of compact governance, ownership, priority, and blocker rows for triage.",included_field_groups:["identity","governance","ownership","dependencies"],token_budget:3200,source:"core"},{command:"next",intent:"execute",description:"The highest-ranked actionable work with concise ranking evidence.",included_field_groups:["recommended"],token_budget:1200,source:"core"},{command:"search",intent:"discover",description:"A budget-derived page of ranked canonical lineage candidates with compact match evidence.",included_field_groups:["identity","status","lineage","match"],token_budget:1800,source:"core"}]),R5=new j0;(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]="83c82348-64f8-5f10-9396-b03add0b7932")}catch{}})();import{encode as Q5}from"@toon-format/toon";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ca9480d-0ae4-50e8-887e-c4183501d92c")}catch{}})();var e4=new Set(Object.values(_));var xg=!1;function ld(e){return typeof e=="object"&&e!==null&&e.code==="EPIPE"}function z0(){(process.exitCode===void 0||process.exitCode===_.SUCCESS)&&(process.exitCode=_.SUCCESS)}function H0(){(process.exitCode===void 0||process.exitCode===_.SUCCESS)&&(process.exitCode=_.GENERIC_FAILURE)}function dd(e){if(e==="stdout"){z0();return}H0()}function Rg(e){let t=e instanceof Error?e:new Error(String(e));setImmediate(()=>{throw t})}function q0(){xg||(xg=!0,process.stdout.on("error",e=>{if(ld(e)){dd("stdout");return}Rg(e)}),process.stderr.on("error",e=>{if(ld(e)){dd("stderr");return}Rg(e)}))}function B0(e,t){q0();try{return e==="stdout"?process.stdout.write(t):process.stderr.write(t),!0}catch(n){if(ld(n))return dd(e),!1;throw n}}function Qs(e){return B0("stderr",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]="979782f5-f4ee-5df5-a68a-0c51ab0548ae")}catch{}})();var G0=jr.join("runtime","history-drift-cache.json"),Dg={EINVAL:"invalid_cache_path",EISDIR:"cache_path_is_directory",ENOENT:"invalid_cache_path",ENOTDIR:"invalid_cache_path",ERR_FS_EISDIR:"cache_path_is_directory"};function Pg(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"?e.code:void 0}async function fd(e){let t=jr.join(e,G0),n=!1,r="invalid_cache_path";try{n=(await ud.stat(await ud.realpath(e))).isDirectory()}catch(o){let i=Pg(o);r=i===void 0?"unknown":Dg[i]??"filesystem_error"}if(!n){Qs(`[pm] warning: history_drift_cache_invalidation_failed:${r}
22
22
  `);return}try{await ud.rm(t,{force:!0})}catch(o){let i=Pg(o);if(L(o))return;let s=i===void 0?"unknown":Dg[i]??"filesystem_error";Qs(`[pm] warning: history_drift_cache_invalidation_failed:${s}
23
23
  `)}}async function Qn(e){let t=jr.dirname(jr.resolve(e));jr.basename(t)==="history"&&await fd(jr.dirname(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]="8c02324c-231c-54ae-8edb-256ac7e04b50")}catch{}})();var V0={front_matter:{},body:""},ht=3,ft=[1,2,3],zg=1,Hg=[1];function gd(e){return ln(O(e),e.hash_algorithm)}function er(e){return Re(O(e))}function Sn(e){let t={...e,record_hash_version:zg},{record_hash:n,...r}=t;return{...t,record_hash:gd(r)}}function nr(e){try{Oe(e.hash_algorithm)}catch{return{ok:!1,error:"unsupported_history_hash_algorithm"}}if(e.record_hash_version===void 0&&e.record_hash===void 0)return{ok:!0,coverage:"item_state_only"};if(e.record_hash_version===void 0||e.record_hash===void 0)return{ok:!1,error:"incomplete_record_hash_envelope"};if(!Hg.includes(e.record_hash_version))return{ok:!1,error:"unsupported_record_hash_version"};let{record_hash:t,...n}=e;return gd(n)===e.record_hash?{ok:!0,coverage:"record_and_item_state"}:{ok:!1,error:"record_hash_mismatch"}}function K0(e,t){let n={before_hash:e.before_hash,after_hash:e.after_hash,patch_hash:er(e.patch)};return e.hash_algorithm!==void 0&&(n.hash_algorithm=e.hash_algorithm),e.item_hash_version!==void 0&&(n.item_hash_version=e.item_hash_version),t.retainOriginalPatch&&(n.patch=structuredClone(e.patch)),t.retainPriorRecordHash!==!1&&e.record_hash_version!==void 0&&e.record_hash!==void 0&&(n.record_hash_version=e.record_hash_version,n.record_hash=e.record_hash,n.record=structuredClone(e)),n}function zo(e,t,n={}){let r=nr(e);if(!r.ok)throw new TypeError(r.error);let o=er(e.patch),i=n.retainPriorRecord===!0||e.before_hash!==t.before_hash||e.after_hash!==t.after_hash||e.item_hash_version!==t.item_hash_version||e.hash_algorithm!==t.hash_algorithm||o!==er(t.patch),s=Sn({...t,...i?{reanchor_evidence:[...t.reanchor_evidence??[],K0(e,n)]}:{}}),a=na(s);if(!a.ok)throw new TypeError(a.error);return s}function qg(e){return!Array.isArray(e)||Object.keys(e).length!==e.length?!1:e.every(t=>!tr(t)||typeof t.path!="string"?!1:t.op==="move"||t.op==="copy"?typeof t.from=="string":["add","replace","test"].includes(t.op)?Object.hasOwn(t,"value"):t.op==="remove")}function Y0(e){return tr(e)&&typeof e.ts=="string"&&typeof e.author=="string"&&typeof e.op=="string"&&typeof e.before_hash=="string"&&typeof e.after_hash=="string"&&qg(e.patch)}function J0(e){let t=e.record_hash_version!==void 0,n=e.record_hash!==void 0;return t===n}function X0(e){return!tr(e)||!J0(e)||typeof e.before_hash!="string"||typeof e.after_hash!="string"||typeof e.patch_hash!="string"||!/^[a-f0-9]{64}$/u.test(e.patch_hash)||e.patch!==void 0&&!qg(e.patch)||e.record_hash_version!==void 0&&typeof e.record_hash_version!="number"||e.record_hash!==void 0&&(typeof e.record_hash!="string"||!/^(?:[a-f0-9]{64}|[a-f0-9]{128})$/u.test(e.record_hash))?!1:e.record===void 0||Y0(e.record)}function Z0(e){try{for(let t of e){if(!X0(t))return!1;Oe(t.hash_algorithm)}return!0}catch{return!1}}function Q0(e){let t=e.record;return t!==void 0&&t.before_hash===e.before_hash&&t.after_hash===e.after_hash&&t.item_hash_version===e.item_hash_version&&t.hash_algorithm===e.hash_algorithm&&t.record_hash_version===e.record_hash_version&&t.record_hash===e.record_hash&&er(t.patch)===e.patch_hash}function ex(e,t,n){if(t.patch&&er(t.patch)!==t.patch_hash)return{kind:"patch_hash_mismatch"};if(t.record)return Q0(t)?{kind:"record",entry:t.record}:{kind:"record_hash_mismatch"};let r=t.patch??e.patch;if(er(r)!==t.patch_hash)return{kind:"digest_only"};let o={...e,before_hash:t.before_hash,after_hash:t.after_hash,patch:r,hash_algorithm:t.hash_algorithm,...t.item_hash_version===void 0?{}:{item_hash_version:t.item_hash_version},...t.record_hash_version===void 0?{}:{record_hash_version:t.record_hash_version},...t.record_hash===void 0?{}:{record_hash:t.record_hash},...n.length===0?{}:{reanchor_evidence:n}};return t.hash_algorithm===void 0&&delete o.hash_algorithm,n.length===0&&delete o.reanchor_evidence,t.item_hash_version===void 0&&delete o.item_hash_version,t.record_hash_version===void 0||t.record_hash===void 0?{kind:"legacy",entry:o}:{kind:"record",entry:o}}function na(e){let t=e.reanchor_evidence;if(t===void 0)return{ok:!0,coverage:"none"};if(!Array.isArray(t)||!Z0(t))return{ok:!1,error:"rewrite_evidence_invalid"};if(t.length===0)return{ok:!0,coverage:"none"};let n=e;for(let r=t.length-1;r>=0;r-=1){let o=t[r],i=ex(n,o,t.slice(0,r));if(i.kind==="patch_hash_mismatch")return{ok:!1,error:"rewrite_evidence_patch_hash_mismatch"};if(i.kind==="record_hash_mismatch")return{ok:!1,error:"rewrite_evidence_record_hash_mismatch"};if(i.kind==="digest_only")return{ok:!0,coverage:"digest_only"};if(i.kind==="legacy")return{ok:!0,coverage:"legacy_anchor_only"};if(!nr(i.entry).ok)return{ok:!1,error:"rewrite_evidence_record_hash_mismatch"};n=i.entry}return{ok:!0,coverage:"complete"}}function ea(e,t){return(e??"").localeCompare(t??"")}function Mg(e,t){return(e??0)-(t??0)}function En(e,t,n){return JSON.stringify(e??n).localeCompare(JSON.stringify(t??n))}function tx(e,t){return[e.scope.localeCompare(t.scope),ea(e.path,t.path),ea(e.command,t.command),Mg(e.timeout_seconds,t.timeout_seconds),ea(e.pm_context_mode,t.pm_context_mode),+!!e.shared_host_safe-+!!t.shared_host_safe,En(e.env_clear,t.env_clear,[]),En(e.env_set,t.env_set,{}),En(e.assert_stdout_contains,t.assert_stdout_contains,[]),En(e.assert_stdout_regex,t.assert_stdout_regex,[]),En(e.assert_stderr_contains,t.assert_stderr_contains,[]),En(e.assert_stderr_regex,t.assert_stderr_regex,[]),Mg(e.assert_stdout_min_lines,t.assert_stdout_min_lines),En(e.assert_json_field_equals,t.assert_json_field_equals,{}),En(e.assert_json_field_gte,t.assert_json_field_gte,{}),ea(e.note,t.note)].find(r=>r!==0)??0}function nx(e){return!e||e==="/"?[]:e.startsWith("/")?e.slice(1).split("/").map(t=>t.replaceAll("~1","/").replaceAll("~0","~")):[]}function rx(e,t){let n=nx(t);if(n.length===0)return!0;let r=e;for(let o of n){let i=/^(0|[1-9]\d*)$/.test(o)?Number(o):-1,s=Array.isArray(r)?i>=0&&i<r.length?r[i]:void 0:tr(r)&&Object.prototype.hasOwnProperty.call(r,o)?r[o]:void 0;if(s===void 0)return!1;r=s}return!0}function ox(e,t){let n=[],r=structuredClone(e);for(let o of t){let i=o.op==="replace"&&!rx(r,o.path)?{...o,op:"add"}:o;n.push(i),r=Ug.applyPatch(r,[i],!0,!0).newDocument}return n}function ta(e,t,n=!1){if(!(e.metadata&&Object.keys(e.metadata).length>0))return{front_matter:{},body:e.body??""};let o=ct(e),s=t===1||t===2&&n?{...o.metadata,...o.metadata.dependencies===void 0?{}:{dependencies:o.metadata.dependencies.map(l=>({...l,id:l.id.toLowerCase()}))},...o.metadata.tests===void 0?{}:{tests:o.metadata.tests.map(({workspace_context_mode:l,provenance:d,provenance_invalid:u,...f})=>f)},...o.metadata.test_runs===void 0?{}:{test_runs:o.metadata.test_runs.map(({executions:l,...d})=>d)}}:o.metadata,a=t===1&&s.tests?{...s,tests:[...s.tests].sort(tx)}:s;return{front_matter:un(a,Ge),body:o.body}}function $g(e){if(!(e.metadata&&Object.keys(e.metadata).length>0))return{metadata:{},body:e.body??""};let n=ct(e);return{metadata:un(n.metadata,Ge),body:n.body}}function hd(e){return yd(e,ht)}function yd(e,t,n){if(!ft.some(r=>r===t))throw new TypeError(`unsupported_item_hash_version:${String(t)}`);return ln(O(ta(e,t)),n)}function Ur(e,t,n){let r=yd(e,t,n);return t===2?[r,ln(O(ta(e,t,!0)),n)]:[r]}function wd(){return Re(O(V0))}function rr(e){let t=hs(e.op),n=ta(e.before,ht),r=ta(e.after,ht),o=$g(e.before),i=$g(e.after),s=Ug.compare(o,i),a=ox(o,s),c=Y_(e.author),l=c.harness?Object.fromEntries(Object.entries(Yl().provenance_outcomes).filter(([m,p])=>p.resolver!==void 0&&(p.status!=="resolved"||c.provenance?.[m]?.source==="probe"))):void 0,d=l===void 0||Object.keys(l).length===0?e.context:{...e.context,agent_provenance_outcomes:l},u=e.hashAlgorithm??pm,f={hash_algorithm:u,ts:e.nowIso,author:e.author,author_source:e.authorSource??K_(e.author),...c.harness?{agent_harness:c.harness}:{},...c.model?{agent_model:c.model}:{},...c.model_source?{agent_model_source:c.model_source}:{},...c.instance?{agent_instance:c.instance}:{},...c.provenance?{agent_provenance:c.provenance}:{},...c.episode?{agent_episode:c.episode}:{},op:t,patch:a,before_hash:ln(O(n),u),after_hash:ln(O(r),u),item_hash_version:ht,message:e.message===void 0?void 0:e.message,...d===void 0?{}:{context:d}};return Sn({...f,event_class:Xn(f)})}function tr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function md(e){return new g(e,_.GENERIC_FAILURE,{code:"history_timestamp_invalid"})}function Bg(e){let t=e.ts.trim();if(t.length===0)return $();if(!fn(t))throw md("History timestamp must be a valid RFC 3339 date-time with millisecond precision");if(t!==e.ts)throw md("History timestamp must not contain surrounding whitespace");return e.ts}function Fg(e,t){let n=e.ts;if(typeof n=="string"&&n.trim().length>0){if(!fn(n))throw md("History timestamp must be a valid RFC 3339 date-time with millisecond precision");return e}return{...e,ts:t}}function pd(e,t){let n=Bg(t);if(typeof e=="string"){let r;try{r=JSON.parse(e)}catch{return e}return tr(r)?JSON.stringify(Fg(r,n)):e}return tr(e)?JSON.stringify(Fg(e,n)):JSON.stringify(e)}async function ix(e,t,n){if(n===!1)return!0;if(typeof n=="string"){let s=pd(n,t);return await _d(e,s),await Qn(e),await ed(e),!0}if(typeof n!="object"||n===null)return!1;let r=n;if(r.skip===!0)return!0;let o=typeof r.history_path=="string"?r.history_path:e,i=pd(typeof r.line=="string"?r.line:r.entry??t,t);return await _d(o,i),await Qn(o),await ed(o),!0}async function _d(e,t){let n;try{n=JSON.parse(t)}catch{n=null}if(!tr(n)||n.op!=="create"){await Ic(e,t);return}await Lg.mkdir(W0.dirname(e),{recursive:!0});try{await Lg.writeFile(e,`${t}
24
24
  `,{encoding:"utf8",flag:"wx"})}catch(r){throw r.code!=="EEXIST"?r:new g("This item identity is reserved by an existing history stream.",_.CONFLICT,{code:"item_identity_reserved",required:"Choose a new item ID or restore the original item from its history.",nextSteps:["Run pm history <id> --full, then pm restore <id> <version> to recover the original item."]})}}async function Ho(e,t){let n=await Rt("history_append",{history_path:e,entry:t});if(n.handled&&await ix(e,t,n.result))return;let r=t.ts.trim().length>0?t:{...t,ts:Bg(t)},o=Sn({...r,hash_algorithm:Oe(r.hash_algorithm),event_class:Xn(r)});await X_(e,o,async()=>{await _d(e,pd(o,o))}),await Qn(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]="7a0fa585-7e3c-57fd-b29c-c26e9c522cb1")}catch{}})();var zr={metadata:{},body:""};function or(){return structuredClone(zr)}function Tn(e,t,n){if(Object.keys(e.metadata).length===0||Array.isArray(e.metadata.tags))try{return Ur(Hr(e),t,n)}catch{}let r=ln(O({replay_fallback:!0,metadata:e.metadata,body:e.body}),n);return t===2?[r,r]:[r]}function Vg(e,t,n,r){let o=Oe(r.hash_algorithm),i=Tn(e,n,o),s=Tn(t,n,o);return{beforeHashes:i,afterHashes:s,pairIndex:i.findIndex((a,c)=>a===r.before_hash&&s[c]===r.after_hash),beforeIndex:i.indexOf(r.before_hash),afterIndex:s.indexOf(r.after_hash)}}function Hr(e){return{metadata:e.metadata,body:e.body}}function vd(e){if(!e.metadata||Object.keys(e.metadata).length===0)return{metadata:{},body:e.body??""};let t=ct(e);return{metadata:un(t.metadata,Ge),body:t.body}}function Gg(e){return e==="/front_matter"?"/metadata":e.startsWith("/front_matter/")?`/metadata/${e.slice(14)}`:e}function sx(e){return typeof e=="object"&&e!==null&&typeof e.op=="string"&&typeof e.path=="string"}function qo(e){return Array.isArray(e)?e.filter(sx).map(t=>({...t,path:Gg(t.path),from:typeof t.from=="string"?Gg(t.from):void 0})):[]}function ax(e){return typeof e=="object"&&e!==null&&"metadata"in e&&"body"in e&&typeof e.body=="string"&&typeof e.metadata=="object"&&e.metadata!==null}function An(e,t){try{let n=qo(t),r=bd.applyPatch(structuredClone(e),n,!0,!1).newDocument;return ax(r)?{ok:!0,document:{metadata:r.metadata,body:r.body}}:{ok:!1,error:new Error("history_replay_invalid_document_shape")}}catch(n){return{ok:!1,error:n}}}function cx(e){return[...new Set(e.map(t=>t.item_hash_version).filter(t=>t!==void 0&&ft.includes(t)))]}function Kg(e){return e!==void 0&&!ft.includes(e)}function lx(e,t){return e!==void 0?[e]:t===void 0?[...ft]:[t]}function Yg(e){let t=nr(e);if(!t.ok)return t.error;let n=na(e);return n.ok?void 0:n.error}function dx(e,t){let n=Yg(e);if(n)return{ok:!1,error:n};let r=An(t,e.patch);return r.ok?{ok:!0,document:r.document}:{ok:!1,error:"patch_apply_failed"}}function ux(e,t){let n=Yg(e);if(n)throw new TypeError(`${n}:entry_${t+1}`)}function yt(e){let t=or(),n,r,o=lo(e).map(i=>`verify_failed:duplicate_create:entry_${i.repeated_create_index}:prior_${i.prior_genesis_index}`);for(let i=0;i<e.length;i+=1){let s=e[i],a=s.item_hash_version,c=Kg(a);c&&o.push(`verify_failed:unsupported_item_hash_version:${String(a)}:entry_${i+1}`);let l=dx(s,t);if(!l.ok)return{ok:!1,errors:[...o,`verify_failed:${l.error}:entry_${i+1}`]};if(c){t=l.document,n=void 0,r=void 0;continue}let u=lx(a,r).map(p=>({version:p,match:Vg(t,l.document,p,s)})),f=u.find(({match:p})=>p.pairIndex>=0);if(f===void 0){let p=u.some(({match:w})=>w.beforeIndex>=0);return{ok:!1,errors:[...o,`verify_failed:${p?"after":"before"}_hash_mismatch:entry_${i+1}`]}}let m=f.version;t=l.document,n=m,r=a??r}return o.length>0?{ok:!1,errors:o,...n===void 0?{}:{item_hash_version:n}}:{ok:!0,errors:[],...n===void 0?{}:{item_hash_version:n}}}function wt(e){let t=yt(e);return{ok:t.ok,errors:t.errors}}function Wg(e,t){try{return{ok:!0,document:bd.applyPatch(structuredClone(e),[t],!0,!1).newDocument}}catch{return{ok:!1}}}function fx(e,t){let n=structuredClone(e),r=0,o=0;for(let a of qo(t)){let c=Wg(n,a);if(c.ok){n=c.document;continue}if(a.op==="replace"){let l=Wg(n,{...a,op:"add"});if(l.ok){n=l.document,r+=1;continue}}o+=1}let i=n;return{document:{metadata:typeof i.metadata=="object"&&i.metadata!==null?i.metadata:{},body:typeof i.body=="string"?i.body:e.body},convertedReplaceToAdd:r,skippedOps:o}}function kd(e){let t=cx(e);if(t.length===1)return t[0];let n=yt(e);return n.ok&&n.item_hash_version!==void 0?n.item_hash_version:t.length===0?1:ht}function mx(e,t){let n=An(e,t.patch);if(n.ok)return{next:n.document,patch:t.patch,repaired:!1,converted:0,skipped:0};let r=fx(e,t.patch);return{next:r.document,patch:bd.compare(e,r.document),repaired:!0,converted:r.convertedReplaceToAdd,skipped:r.skippedOps}}function Bo(e,t=kd(e),n={}){let r=e.findIndex(m=>Kg(m.item_hash_version));if(r>=0)throw new TypeError(`unsupported_item_hash_version:${String(e[r]?.item_hash_version)}:entry_${r+1}`);let o=or(),i=[],s=[],a=0,c=0,l=0,d=0,u,f=t!==1||e.some(m=>m.item_hash_version!==void 0);for(let m=0;m<e.length;m+=1){let p=e[m];ux(p,m);let w=mx(o,p),{next:y,patch:b,repaired:v,converted:I,skipped:A}=w;l+=I,d+=A,c+=Number(v);let C=Vg(o,y,t,p);u===void 0||n.continuousHashSurface!==!0?u=[C.pairIndex,C.beforeIndex,C.afterIndex,Math.min(u??0,C.beforeHashes.length-1)].find(q=>q>=0):u=Math.min(u,C.beforeHashes.length-1);let P=C.beforeHashes[u],S=C.afterHashes[u],E=P!==p.before_hash||S!==p.after_hash;E&&(a+=1);let z={...p,patch:b,before_hash:P,after_hash:S};f?z.item_hash_version=t:delete z.item_hash_version;let H=z.item_hash_version!==p.item_hash_version;(E||v||H)&&(z=zo(p,z,{retainOriginalPatch:v})),i.push(z),s.push({index:m+1,rehashed:E,patch_repaired:v,converted_replace_to_add:I,skipped_ops:A}),o=y}return{entries:i,finalDocument:o,entriesRehashed:a,entriesPatchRepaired:c,convertedReplaceToAdd:l,skippedOps:d,details:s,itemHashVersion:t,explicitItemHashVersion:f}}function ir(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
@@ -117,7 +117,7 @@ ${i}`;continue}return null}return n}function Br(e,t){let n=Zg(e).trim();if(!n)th
117
117
  `),u=c;return l||(u=d===-1?"":c.slice(0,d+1)),{content:u,bytesRead:a,complete:l}}catch{return null}finally{await r?.close()}}function zy(e){try{let t=JSON.parse(e);return Ft(t)?t:null}catch{return null}}function RP(e,t,n){let r=typeof e.agent_harness=="string"?e.agent_harness:void 0;if(r===void 0)return;let o=Ft(e.agent_provenance)?e.agent_provenance:{};if(Object.entries(o).forEach(([s,a])=>{if(!Ft(a))return;let c=Su(a.value);if(!c)return;let l=`${r}\0${s}\0${c}`,d=n.get(l)??{harness:r,dimension:s,kind:c,count:0};d.count+=1,n.set(l,d)}),!Ft(e.context))return;let i=e.context.agent_provenance_outcomes;Ft(i)&&Object.entries(i).forEach(([s,a])=>{if(!Ft(a)||typeof a.resolver!="string"||!CP.has(String(a.status)))return;let c=`${r}\0${s}\0${a.resolver}`,l=t.get(c)??{harness:r,dimension:s,resolver:a.resolver,attempts:0,successes:0};l.attempts+=1,a.status==="resolved"&&(l.successes+=1),t.set(c,l)})}function NP(e,t,n,r,o,i){let s=o;for(let a of e.split(`
118
118
  `)){if(a.trim().length===0)continue;if(s>=r)return{eventsRead:s,truncated:!0};s+=1;let c=zy(a);if(c===null){i.malformed_events+=1;continue}if(typeof c.ts=="string"&&fn(c.ts)){let l=new Date(c.ts).toISOString();(i.earliest_event_at===null||l<i.earliest_event_at)&&(i.earliest_event_at=l),(i.latest_event_at===null||l>i.latest_event_at)&&(i.latest_event_at=l)}RP(c,t,n)}return{eventsRead:s,truncated:!1}}function DP(e,t,n){return n?[...e.filter(r=>r.attempts>0&&r.successes===0).map(r=>`provenance_resolver_zero_success:${r.harness}:${r.dimension}:${r.resolver}:${String(r.attempts)}`),...t.map(r=>`provenance_value_domain_invalid:${r.harness}:${r.dimension}:${r.kind}:${String(r.count)}`)]:[]}async function Hy(e,t=1e4){if(!Number.isSafeInteger(t)||t<0)throw new RangeError("Provenance event limit must be a non-negative safe integer.");let n={scope:"history_prefix",event_limit:t,byte_limit:$y,bytes_read:0,events_read:0,truncated:!1,unreadable_sources:0,malformed_events:0,earliest_event_at:null,latest_event_at:null,complete:!1},r=new Map,o=new Map,i=0,s=0,a=!1,c=await Uy(e);c===null&&(n.unreadable_sources+=1);for(let u of c??[]){let f=await xP(e,u,Math.max(0,$y-s));if(f===null){n.unreadable_sources+=1;continue}s+=f.bytesRead;let m=NP(f.content,r,o,t,i,n);if(i=m.eventsRead,m.truncated){a=!0;break}if(!f.complete){a=!0;break}}let l=[...r.values()].sort((u,f)=>u.harness.localeCompare(f.harness)||u.dimension.localeCompare(f.dimension)||u.resolver.localeCompare(f.resolver)),d=[...o.values()].sort((u,f)=>u.harness.localeCompare(f.harness)||u.dimension.localeCompare(f.dimension)||u.kind.localeCompare(f.kind));return n.bytes_read=s,n.events_read=i,n.truncated=a,n.complete=!a&&n.unreadable_sources===0&&n.malformed_events===0,{outcomes:l,sample:n,invalid_values:d,warnings:DP(l,d,n.complete),events_read:i,truncated:a}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="55e22181-7bbf-5fed-965c-219fe465ed72")}catch{}})();function qy(e,t){return t==="body"?e.body:e.metadata[t]}function Au(e,t){if(e===void 0||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=new Set;return e.every(o=>{let i=t.findIndex((s,a)=>!r.has(a)&&Au(o,s));return i<0?!1:(r.add(i),!0)})}if(e===null||t===null||typeof e!="object"||typeof t!="object"||Array.isArray(t))return!1;let n=t;return Object.entries(e).every(([r,o])=>Object.hasOwn(n,r)&&Au(o,n[r]))}function By(e,t){let n=new Set(t),r=[];for(let o=e.length-1;o>=0&&n.size>0;o-=1){let i=e[o],s=new Set;for(let c of qo(i.patch))s.add(_i(c.path)),c.from&&s.add(_i(c.from));let a=[...n].filter(c=>s.has(c));if(a.length!==0){for(let c of a)n.delete(c);r.push({index:o+1,ts:i.ts,author:i.author,op:i.op,fields:a.sort((c,l)=>c.localeCompare(l))})}}return r.reverse()}function PP(e,t,n){let r=Vy.compare(t,n);if(r.length===0)return;let o=new Set;for(let p of r)o.add(_i(p.path));let i=new Set([...o].filter(p=>Au(qy(t,p),qy(n,p)))),s=new Set([...o].filter(p=>!i.has(p))),a=By(e,s),c=By(e,i),l=[...o].sort((p,w)=>p.localeCompare(w)),d=[...s].sort((p,w)=>p.localeCompare(w)),u=[...i].sort((p,w)=>p.localeCompare(w)),f=[...new Set(a.map(p=>p.author))].sort((p,w)=>p.localeCompare(w)),m=[...new Set(c.map(p=>p.author))].sort((p,w)=>p.localeCompare(w));return{reconciled_field_count:o.size,reconciled_fields:l,reverted_field_count:s.size,reverted_fields:d,discarded_events:a,discarded_authors:f,preserved_field_count:i.size,preserved_fields:u,preserved_events:c,preserved_authors:m,recovery_hint:a.length>0?"Reconciliation keeps the on-disk item and overwrites these replayed mutations. To recover one, inspect it with pm history <id> --diff --field <field>, then re-apply the lost value with pm update.":null}}async function LP(e){try{return await Wy(e)}catch{return null}}async function MP(e){if(await LP(Tu.resolve(e.gitWorkspaceRoot,e.receipt.item_path))!==e.currentPath)return null;let n=[...new Set([...e.receipt.fields_from_theirs,...e.receipt.union_fields,...e.receipt.decisions.map(a=>a.field)])].sort(),r=e.receipt.merged_field_hashes;if(!r||n.length===0)return null;let o=Object.keys(r).sort();if(n.length!==o.length||n.some((a,c)=>a!==o[c]))return null;let i=e.currentItemReplay.metadata;return n.every(a=>{let c=a==="body"?e.currentItemReplay.body:i[a];return[bt(c),Re(O(Q(c)))].includes(r[a])})?{receipt:e.receipt,declaredFields:n}:null}async function $P(e){if(e.proof.gitWorkspaceRoot===null)return{trusted:!1,reason:"git_workspace_unavailable",receipt_ids:[]};if(e.itemPath===null||e.currentItemReplay===null)return{trusted:!1,reason:"item_path_unavailable",receipt_ids:[]};let t=e.proof.receipts.filter(s=>s.item_id===e.id);if(t.length===0)return{trusted:!1,reason:"no_item_receipts",receipt_ids:[]};let n=await Wy(e.itemPath),r=[];for(let s of t){let a=await MP({receipt:s,gitWorkspaceRoot:e.proof.gitWorkspaceRoot,currentPath:n,currentItemReplay:e.currentItemReplay});a&&r.push(a)}let o=new Set(r.flatMap(({declaredFields:s})=>s)),i=e.reconciliation?.reconciled_fields;return r.length>0&&(i===void 0||i.length>0&&i.every(s=>o.has(s)))?{trusted:!0,reason:"trusted_merge_driver_hash_evidence",receipt_ids:r.map(({receipt:s})=>s.id)}:{trusted:!1,reason:"no_receipt_set_proves_snapshot",receipt_ids:[]}}async function Gy(e,t,n,r){if(e===void 0)return;let{receipt:o,gitWorkspaceRoot:i}=e,s=t.currentItemPath===null?null:Tu.relative(i,t.currentItemPath).split(Tu.sep).join("/");if(!n||r.entriesRehashed!==0||r.entriesPatchRepaired!==0||t.matchedChainBefore!==!0||t.currentItemRawBeforeLock===null||s!==o.item_path||o.operation===void 0||!await oa(i,o.item_path,o.operation,t.currentItemRawBeforeLock))throw new g("Restored-origin receipt evidence no longer proves the exact clean item snapshot.",_.CONFLICT,{code:"merge_reconcile_receipt_evidence_untrusted",recovery:{suggested_retry:"pm merge reconcile --dry-run"}})}async function FP(e){let t=new Set(e.options.mergeReceiptProof?.receipts.filter(s=>s.item_id===e.subjectId).map(s=>s.id)??[]),r=(e.options.mergeReceiptProof?await kt(e.options.mergeReceiptProof.gitWorkspaceRoot??process.cwd(),{includeReconciled:!0,includeLossless:!0,pmRoot:e.pmRoot}):void 0)?.receipts.filter(s=>s.item_id===e.subjectId&&t.has(s.id))??[],o=e.options.mergeReceiptProof?await $P({proof:{...e.options.mergeReceiptProof,receipts:r},id:e.subjectId,itemPath:e.itemReplayContext.currentItemPath,currentItemReplay:e.itemReplayContext.currentItemReplay,reconciliation:e.reconciliation}):void 0;if(o&&!o.trusted&&e.options.force!==!0)throw new g(`Merge receipt evidence for ${e.subjectId} does not prove the exact item snapshot (${o.reason}).`,_.CONFLICT,{code:"merge_reconcile_receipt_evidence_untrusted",required:"Use authoritative clone-local or durable receipt evidence whose canonical path, declared fields, and merged-value hashes match the current item, or review the mismatch and rerun with --force.",recovery:{suggested_retry:"pm merge reconcile --dry-run"}});let i=o?.trusted?r.filter(s=>o.receipt_ids.includes(s.id)):[];return{mergeReceiptProof:o,effectiveAuditContext:i.length>0&&e.options.force!==!0?{...e.options.auditContext,merge:{receipts:i.map(vt)}}:e.options.auditContext}}function jP(e,t,n){let r=e.located?.itemPath??null,o=t.loadedItem,i=t.entries;if(!o)return{currentItemReplay:null,currentItemPath:r,matchedChainBefore:null,currentItemRawBeforeLock:null,loadedItem:null};let s=vd(o.document),a=i[i.length-1].after_hash;return{currentItemReplay:s,currentItemPath:r,matchedChainBefore:Tn(s,n,Oe(i.at(-1)?.hash_algorithm)).includes(a),currentItemRawBeforeLock:o.raw,loadedItem:o}}function UP(e){return typeof e.message=="string"&&e.message.trim().length>0?e.message:`history-repair re-anchored ${e.entriesRehashed} entr${e.entriesRehashed===1?"y":"ies"}${e.entriesPatchRepaired>0?`, repaired ${e.entriesPatchRepaired} patch(es)`:""}${e.reconcileNeeded?", reconciled chain with on-disk item":""}.`}function zP(e){let t=[...e.reanchorEntries];if(!e.changed)return{rewrittenEntries:t,auditEntryAdded:!1};let n=e.reconcileNeeded&&e.currentItemReplay?e.currentItemReplay:e.finalReplay,r=Oe(e.reanchorEntries.at(-1)?.hash_algorithm),o=Tn(e.finalReplay,e.itemHashVersion,r),i=e.reanchorEntries[e.reanchorEntries.length-1].after_hash,s=o.indexOf(i),a=Tn(n,e.itemHashVersion,r),c={hash_algorithm:r,ts:$(),author:e.author,op:e.auditOperation,patch:e.reconcileNeeded&&e.currentItemReplay?Vy.compare(e.finalReplay,e.currentItemReplay):[],before_hash:o[s],after_hash:a[s],message:e.message,...e.explicitItemHashVersion?{item_hash_version:e.itemHashVersion}:{},...e.auditContext===void 0?{}:{context:e.auditContext}};return t.push(Sn({...c,event_class:Xn(c)})),{rewrittenEntries:t,auditEntryAdded:!0}}function HP(e,t,n){let r=[];return e||r.push("history_repair_no_changes"),t>0&&r.push(`history_repair_skipped_unresolvable_ops:${t}`),n&&n.discarded_events.length>0&&r.push(`history_repair_reconcile_discards_events:${n.discarded_events.length}`,`history_repair_discarded_authors:${n.discarded_authors.join(",")}`),r}async function tn(e,t,n){let{pmRoot:r,settings:o,typeRegistry:i}=await bu(n.path),s=await vu(r,e,o,i.type_to_folder);return t.salvageTail===!0?Oy({pmRoot:r,subject:s,settings:o,typeRegistry:i,options:t,author:Te(t.author,o.author_default)}):My({pmRoot:r,subject:s,settings:o,typeRegistry:i,operation:"history-repair",options:t,transform:a=>BP({pmRoot:r,subject:s,options:t},a)})}function qP(e,t){let n=e.mergeAbandonmentProof!==void 0&&e.auditContext!==void 0&&t.some(r=>r.op==="merge_reconcile"&&O(r.context)===O(e.auditContext));return e.forceAuditEntry===!0&&!n}async function BP(e,t){let{pmRoot:n,subject:r,options:o}=e,i=t.entries,s=t.verification,a=yt(i),c=o.normalizeProvenance?Fy(i):{entries:i,receipt:{changed:!1,events_changed:0,observations_removed:0,invalid_values:[]}},l=kd(c.entries),d=new Set(c.entries.map(H=>H.item_hash_version).filter(H=>H!==void 0)),u=Bo(c.entries,l),f=jP(r,t,l);await Gy(o.mergeAbandonmentProof,f,s.ok,u);let m=u.finalDocument,p=Tn(m,l),w=!1;if(f.currentItemReplay!==null){let H=Tn(f.currentItemReplay,l);w=!p.some((q,N)=>q===H[N])}let y=w&&f.currentItemReplay?PP(u.entries,m,f.currentItemReplay):void 0,{mergeReceiptProof:b,effectiveAuditContext:v}=await FP({options:o,pmRoot:n,subjectId:r.id,itemReplayContext:f,reconciliation:y}),I=[u.entriesRehashed>0,u.entriesPatchRepaired>0,w,qP(o,i),c.receipt.changed].some(Boolean),A=t.author,C=!!o.dryRun,P=UP({message:o.message,entriesRehashed:u.entriesRehashed,entriesPatchRepaired:u.entriesPatchRepaired,reconcileNeeded:w}),{rewrittenEntries:S,auditEntryAdded:E}=zP({reanchorEntries:u.entries,changed:I,reconcileNeeded:w,currentItemReplay:f.currentItemReplay,finalReplay:m,author:A,message:P,auditOperation:o.auditOperation??"history_repair",auditContext:c.receipt.changed?{...v,provenance_normalization:c.receipt}:v,itemHashVersion:l,explicitItemHashVersion:u.explicitItemHashVersion}),z=HP(I,u.skippedOps,y);return{changed:I,rewrittenEntries:S,beforeWrite:async()=>Gy(o.mergeAbandonmentProof,f,s.ok,u),report:({verification:H,warnings:q})=>({id:r.id,dry_run:C,changed:I,history:{path:r.historyPath,entries_scanned:i.length,chain_drift_before:!s.ok,entries_rehashed:u.entriesRehashed,entries_patch_repaired:u.entriesPatchRepaired,converted_replace_to_add:u.convertedReplaceToAdd,skipped_ops:u.skippedOps,reconciled_with_item:w,audit_entry_added:E,verify_ok:H.ok,verify_errors:H.errors,item_hash_version_before:a.item_hash_version??null,item_hash_version_after:l,version_disposition:d.size>1?"selected_for_ambiguous_stream":"preserved"},item:{exists:f.currentItemPath!==null,path:f.currentItemPath,matched_chain_before:f.matchedChainBefore},provenance_normalization:{requested:o.normalizeProvenance===!0,...c.receipt},...y?{reconciliation:y}:{},...b?{merge_receipt_proof:b}:{},warnings:[...new Set([...z,...q])].sort((N,pe)=>N.localeCompare(pe)),generated_at:$()})}}async function Ky(e,t){if(e.salvageTail===!0)throw new g("Tail salvage requires one explicit item ID; --all is not supported.",_.USAGE);let{pmRoot:n,settings:r,typeRegistry:o}=await bu(t.path),i=[],s=await mr(n,r.item_format,o.type_to_folder,i,r.schema,{forceSourceScan:!0}),a=await _r(n,s),c=e.normalizeProvenance?await jy(n):[],l=[...new Set([...a.driftedItems,...c])].sort((m,p)=>m.localeCompare(p)),d=[],u=[],f={repaired:0,skipped_clean:0,failed:0};for(let m of l)try{let p=await tn(m,{...e,auditContext:e.auditContextById?.[m],auditContextById:void 0,mergeReceiptProof:e.mergeReceiptProofById?.[m]??e.mergeReceiptProof,mergeReceiptProofById:void 0},t),w=p.changed?"repaired":"skipped_clean";f[w]+=1,u.push(...p.warnings.map(y=>`${m}:${y}`)),d.push({id:m,outcome:w,entries_rehashed:p.history.entries_rehashed,entries_patch_repaired:p.history.entries_patch_repaired,reconciled_with_item:p.history.reconciled_with_item,...p.reconciliation?{reconciliation:p.reconciliation}:{},...p.merge_receipt_proof?{merge_receipt_proof:p.merge_receipt_proof}:{},warnings:p.warnings})}catch(p){f.failed+=1,d.push({id:m,outcome:"failed",error:p instanceof Error?p.message:String(p)})}return e.dryRun||await fd(n),{all:!0,dry_run:!!e.dryRun,scanned_streams:s.length,drifted_streams:a.driftedItems.length,provenance_invalid_streams:c.length,streams:d,totals:f,warnings:[...new Set([...i,...u])].sort((m,p)=>m.localeCompare(p)),generated_at:$()}}(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]="5fd3624a-d36b-58e6-8053-f2c0626e0c10")}catch{}})();async function Yy(e){if(e.cwd===null)return[];let t=[];for(let n of e.receipts){if(n.operation===void 0||!await oa(e.cwd,n.item_path,n.operation))continue;let r={gitWorkspaceRoot:e.cwd,receipt:n};await tn(n.item_id,{dryRun:!0,mergeAbandonmentProof:r},e.global),e.dryRun||(await tn(n.item_id,{author:e.author??e.global.author,mergeAbandonmentProof:r,message:e.message??"Settle rebase receipt after exact original Git state restoration",auditOperation:"merge_reconcile",forceAuditEntry:!0,auditContext:{merge:{abandoned_receipts:[{...vt(n),reason:"original_git_state_restored",operation:n.operation}]}}},e.global),await Xo(e.cwd,n,{requireExisting:!0,settlement:"original_git_state_restored"})),t.push(n.id)}return t}import{readFile as $2}from"node:fs/promises";import F2 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]="96a05fa4-b833-56ca-b501-40a427d03201")}catch{}})();var Iu=async(e,t,n)=>{if(!Number.isInteger(t)||t<1)throw new RangeError("concurrency must be a positive integer");let r=new Array(e.length),o=0,i=Array.from({length:Math.min(t,e.length)},async()=>{for(;o<e.length;){let s=o;o+=1,r[s]=await n(e[s])}});return await Promise.all(i),r};import cn from"node:fs/promises";import Xe 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]="c4fba032-7cda-53a2-b518-fa13a60a76d5")}catch{}})();var GP=new Set(["1","true","yes","on"]),Jr=["user","automation","test","dogfood"],WP=new Set(Jr);function ja(e,t){return GP.has((t[e]??"").trim().toLowerCase())}function Xr(e=process.env){let t=ja("DO_NOT_TRACK",e),n=(e.PM_TELEMETRY_SOURCE_CONTEXT??"").trim().toLowerCase(),o=(typeof e.VITEST=="string"||typeof e.VITEST_WORKER_ID=="string"||(e.NODE_ENV??"").trim().toLowerCase()==="test")&&!WP.has(n)&&!ja("PM_TELEMETRY_SEND_TEST_EVENTS",e);return{telemetry_disabled:t||o||ja("PM_TELEMETRY_DISABLED",e)||ja("PM_NO_TELEMETRY",e),do_not_track:t,test_suppressed:o}}import Jy from"node:fs/promises";import Xy 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]="84aca8e9-b9a8-59dd-8e11-aa9f67184ec4")}catch{}})();function VP(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!="object"||t===null||Array.isArray(t))return null;let n=t,{id:r,owner:o,created_at:i,ttl_seconds:s}=n;return typeof r!="string"||typeof o!="string"||typeof i!="string"||typeof s!="number"||!Number.isFinite(s)?null:{id:r,owner:o,created_at:i,ttl_seconds:s}}function KP(e,t,n){let r=VP(t);if(r===null)return{detail:"unparseable_json",entry:{file:e,id:null,owner:null,created_at:null,ttl_seconds:null,age_seconds:null,stale:!1,reason:"unparseable"}};let o=Date.parse(r.created_at);if(!Number.isFinite(o))return{detail:"invalid_timestamp",entry:{file:e,id:r.id,owner:r.owner,created_at:r.created_at,ttl_seconds:r.ttl_seconds,age_seconds:null,stale:!1,reason:"unparseable"}};let i=n-o,s=Math.floor(i/1e3),a=i>r.ttl_seconds*1e3;return{detail:a?"expired":"active",entry:{file:e,id:r.id,owner:r.owner,created_at:r.created_at,ttl_seconds:r.ttl_seconds,age_seconds:s,stale:a,reason:a?"expired":"active"}}}async function Zy(e,t){let n=t??Date.now(),r=Xy.join(e,"locks"),o={scanned:0,active_lock_count:0,stale_lock_count:0,unreadable_lock_count:0,unparseable_lock_count:0},i;try{i=(await Jy.readdir(r)).filter(a=>a.endsWith(".lock")).sort()}catch(s){if(L(s))return o;throw s}for(let s of i){let a;try{a=await Jy.readFile(Xy.join(r,s),"utf8")}catch(l){if(L(l))continue;o.scanned+=1,o.unreadable_lock_count+=1;continue}o.scanned+=1;let{detail:c}=KP(s,a,n);c==="active"?o.active_lock_count+=1:c==="expired"?o.stale_lock_count+=1:o.unparseable_lock_count+=1}return o}import hw 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]="74cee8e6-1785-50f4-94d8-fc0b29055dc2")}catch{}})();var YP=3e4;function hi(e,t,n=YP){let r=e??n;if(!Number.isFinite(r)||r<=0)throw new Error(`${t} timeout must be a positive finite number`);return Math.floor(r)}function yi(e,t){if(e)return e;if(typeof globalThis.fetch=="function")return globalThis.fetch.bind(globalThis);throw new Error(`${t} execution requires a fetch implementation`)}async function JP(e){try{return(await e.text()).replaceAll(/\s+/g," ").trim()}catch(t){return`(failed to read response body: ${ie(t)})`}}async function Ua(e){let t=new AbortController,n=setTimeout(()=>{t.abort()},e.timeoutMs);try{let r;try{r=await e.fetcher(e.endpoint,{method:e.method,headers:e.headers,body:JSON.stringify(e.body),signal:t.signal})}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error(`${e.requestLabel} timed out after ${e.timeoutMs}ms`):new Error(`${e.requestLabel} execution failed: ${ie(o)}`)}if(!r.ok){let o=await JP(r),i=o.length>0?`: ${o}`:"";throw new Error(`${e.requestLabel} failed with status ${r.status} ${r.statusText}${i}`)}try{return await r.json()}catch(o){throw new Error(`${e.responseLabel} JSON parse failed: ${ie(o)}`)}}finally{clearTimeout(n)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2c36f008-53c4-5ee7-bc87-6bfb7aeb8f42")}catch{}})();function Cu(e,t){let n=G(e);if(!n)return"unconfigured";let r=G(t);return r&&r.toLowerCase()===n.toLowerCase()?"configured":"auto-detected"}function XP(e){let t=_o(e),n=t.toLowerCase();return n.endsWith("/embeddings")?t:n.endsWith("/v1")?`${t}/embeddings`:`${t}/v1/embeddings`}function ew(e){let t=e.search?.embedding_model;return G(t)||null}function ZP(e){let t=G(e.providers?.openai?.base_url),n=G(e.providers?.openai?.model);if(!t||!n)return null;let r=ew(e),o=G(e.providers?.openai?.api_key);return{name:"openai",base_url:t,model:r??n,...o?{api_key:o}:{}}}function QP(e){let t=G(e.providers?.ollama?.base_url),n=G(e.providers?.ollama?.model);if(!t||!n)return null;let r=ew(e);return{name:"ollama",base_url:t,model:r??n}}function tw(e){let t=(Array.isArray(e)?e:[e]).map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new Error("Embedding input must include at least one non-empty string");return t}function eL(e){let t=[],n=[],r=new Map;for(let o of e){let i=r.get(o);if(i===void 0){let s=t.length;t.push(o),r.set(o,s),n.push(s);continue}n.push(i)}return{uniqueInputs:t,originalToUniqueIndex:n}}function tL(e){let t=e.map((r,o)=>({embedding:r.embedding,index:r.index,position:o}));if(t.some(r=>r.index!==void 0)){for(let r of t)if(!Number.isInteger(r.index))throw new TypeError(`OpenAI embedding response entry at position ${r.position} is missing a valid integer index`);return[...t].sort((r,o)=>{let i=r.index-o.index;return i!==0?i:r.position-o.position})}return t}function wi(e){let t=ZP(e),n=QP(e),r=[t,n].filter(a=>a!==null),o=G(e.search?.provider),i=o?o.toLowerCase():null;return{active:(i?r.find(a=>a.name===i):void 0)??r[0]??null,available:r}}function Qy(e){let t=_o(e.base_url);return e.name==="openai"?{provider:"openai",endpoint:XP(t),model:e.model}:{provider:"ollama",endpoint:`${t}/api/embed`,model:e.model}}function nL(e,t){let n=tw(t);return e.name==="openai"?{target:Qy(e),method:"POST",headers:{"content-type":"application/json",...e.api_key?{authorization:`Bearer ${e.api_key}`}:{}},body:{model:e.model,input:n.length===1?n[0]:n}}:{target:Qy(e),method:"POST",headers:{"content-type":"application/json"},body:{model:e.model,input:n}}}function rL(e,t){if(e.name==="openai"){let o=t.data;if(!Array.isArray(o)||o.length===0)throw new Error("OpenAI embedding response must include a non-empty data array");return tL(o).map((s,a)=>{let c=s.embedding;if(!Ir(c))throw new Error(`OpenAI embedding response entry at index ${a} is missing a numeric embedding vector`);return[...c]})}let n=t.embedding;if(Ir(n))return[[...n]];let r=t.embeddings;if(Array.isArray(r)&&r.length>0)return r.map((o,i)=>{if(!Ir(o))throw new Error(`Ollama embedding response entry at index ${i} is missing a numeric embedding vector`);return[...o]});throw new Error("Ollama embedding response must include embedding or embeddings vectors")}async function nw(e,t,n={}){let r=hi(n.timeout_ms,"Embedding request"),o=yi(n.fetcher,"Embedding request"),i=tw(t),s=eL(i),a=nL(e,s.uniqueInputs),c=await Ua({endpoint:a.target.endpoint,method:a.method,headers:a.headers,body:a.body,timeoutMs:r,fetcher:o,requestLabel:"Embedding request",responseLabel:"Embedding response"}),l=rL(e,c);if(l.length!==s.uniqueInputs.length)throw new Error(`Embedding response cardinality mismatch: expected ${s.uniqueInputs.length} vector(s), received ${l.length}`);return s.originalToUniqueIndex.map(d=>[...l[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]="16c567d7-0065-5401-a768-0913cec6d5f4")}catch{}})();var za=["title","description","tags","status","type","priority","assignee","parent","goal","value","why_now","risk","confidence","estimated_minutes","acceptance_criteria","resolution","expected_result","actual_result","body","comments","notes","learnings","reminders","events","dependencies","plan"];function Ou(e){let t=e?.search?.corpus_fields;if(!Array.isArray(t))return[...za];let n=new Set(za),r=Array.from(new Set(t.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0&&n.has(o))));return r.length>0?r:[...za]}var oL=8e3,xu=3200,gr="...[semantic corpus truncated]",iL="search_embedding_corpus_max_characters_invalid:using_provider_default";function Ut(e){return e.map(t=>t==null?"":String(t).trim()).filter(t=>t.length>0).join(" ")}function sL(e){return(e.reminders??[]).map(t=>Ut([t.at,t.text]))}function aL(e){return(e.events??[]).map(t=>Ut([t.start_at,t.end_at,t.title,t.description,t.location,t.all_day===!0?"all day":void 0,t.timezone,t.recurrence?.freq,t.recurrence?.interval,t.recurrence?.count,t.recurrence?.until,t.recurrence?.by_weekday?.join(" "),t.recurrence?.by_month_day?.join(" "),t.recurrence?.exdates?.join(" ")]))}function cL(e){let t=(e.plan_steps??[]).map(s=>Ut([s.order,s.id,s.title,s.body,s.status,s.owner,s.evidence,s.blocked_reason,s.superseded_by,(s.linked_items??[]).map(a=>Ut([a.kind,a.id,a.note])).join(" "),(s.files??[]).map(a=>Ut([a.path,a.note])).join(" "),(s.tests??[]).map(a=>Ut([a.command,a.path,a.note])).join(" "),(s.docs??[]).map(a=>Ut([a.path,a.note])).join(" ")])),n=(e.plan_decisions??[]).map(s=>Ut([s.decision,s.rationale,s.evidence,s.step_id])),r=(e.plan_discoveries??[]).map(s=>Ut([s.text,s.step_id])),o=(e.plan_validation??[]).map(s=>Ut([s.text,s.command,s.expected]));if([e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context,...t,...n,...r,...o].some(s=>s!==void 0))return{mode:e.plan_mode,scope:e.plan_scope,harness:e.plan_harness,resume_context:e.plan_resume_context,steps:t,decisions:n,discoveries:r,validation:o}}function jt(e){return typeof e=="string"&&e.trim().length>0}var lL={title:e=>e.metadata.title,description:e=>e.metadata.description,tags:e=>e.metadata.tags,status:e=>e.metadata.status,type:e=>e.metadata.type,priority:e=>typeof e.metadata.priority=="number"?e.metadata.priority:void 0,assignee:e=>jt(e.metadata.assignee)?e.metadata.assignee:void 0,parent:e=>jt(e.metadata.parent)?e.metadata.parent:void 0,goal:e=>jt(e.metadata.goal)?e.metadata.goal:void 0,value:e=>jt(e.metadata.value)?e.metadata.value:void 0,why_now:e=>jt(e.metadata.why_now)?e.metadata.why_now:void 0,risk:e=>jt(e.metadata.risk)?e.metadata.risk:void 0,confidence:e=>e.metadata.confidence!==void 0&&e.metadata.confidence!==null?e.metadata.confidence:void 0,estimated_minutes:e=>typeof e.metadata.estimated_minutes=="number"?e.metadata.estimated_minutes:void 0,acceptance_criteria:e=>jt(e.metadata.acceptance_criteria)?e.metadata.acceptance_criteria:void 0,resolution:e=>jt(e.metadata.resolution)?e.metadata.resolution:void 0,expected_result:e=>jt(e.metadata.expected_result)?e.metadata.expected_result:void 0,actual_result:e=>jt(e.metadata.actual_result)?e.metadata.actual_result:void 0,body:e=>e.body,comments:e=>(e.metadata.comments??[]).map(t=>t.text),notes:e=>(e.metadata.notes??[]).map(t=>t.text),learnings:e=>(e.metadata.learnings??[]).map(t=>t.text),reminders:e=>sL(e.metadata),events:e=>aL(e.metadata),dependencies:e=>(e.metadata.dependencies??[]).map(t=>({id:t.id,kind:t.kind})),plan:e=>cL(e.metadata)};function rw(e,t={}){let n=t.fields??za,r={};for(let o of n){let i=lL[o];if(!i)continue;let s=i(e);s!==void 0&&(r[o]=s)}return r}function dL(e){return e?.trim().toLowerCase()==="ollama"?xu:oL}function Zr(e,t){let n=dL(e),r=Hm(t);return r!==null?{maxCharacters:r,warning:null}:{maxCharacters:n,warning:t==null?null:iL}}function Ru(e,t={}){let n=JSON.stringify(rw(e,{fields:t.fields})),r=Zr(t.providerName,t.maxCharacters).maxCharacters;if(n.length<=r)return n;if(r<=gr.length)return gr.slice(0,r);let o=Math.max(0,r-gr.length);return`${n.slice(0,o)}${gr}`}(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]="f0edf7da-87cc-5e66-9f9f-c9a25e21808e")}catch{}})();function uL(e,t){let n=e.search.embedding_batch_size,r=e.search.embedding_timeout_ms,o=e.search.scanner_max_batch_retries,i=Number.isFinite(n)&&n>0?Math.floor(n):1,s=Number.isFinite(r)&&r>0?Math.floor(r):3e4,a=Number.isFinite(o)&&o>=0?Math.floor(o):0;return{batchSize:i,timeoutMs:s,maxRetries:a,maxBatchInputCharacters:Number.POSITIVE_INFINITY,maxInputCharacters:t}}function fL(e,t,n){let r=[],o=[],i=0;for(let s of e){let a=o.length>=t,c=o.length>0&&Number.isFinite(n)&&i+s.length>n;(a||c)&&(r.push(o),o=[],i=0),o.push(s),i+=s.length}return r.push(o),r}function mL(e,t){return e.name!=="ollama"?t:{...t,maxBatchInputCharacters:xu}}function pL(e,t){if(!Number.isFinite(t)||t<=0||e.length<=t)return e;let n=Math.max(0,t-gr.length);return`${e.slice(0,n)}${gr}`.slice(0,t)}function ow(e){let t=ie(e).toLowerCase();return t.includes("timed out")||t.includes("timeout")}function _L(e,t,n,r,o,i){let s=`Embedding batch ${t} failed after ${o} attempt(s): ${ie(i)}`,a=`provider=${e.name} model=${e.model} batch_size=${n} timeout_ms=${r}`;return ow(i)?`${s} (${a}; guidance=check provider availability or lower search.embedding_batch_size, raise search.embedding_timeout_ms, or run keyword search while semantic indexing catches up)`:`${s} (${a})`}async function Nu(e,t,n,r,o,i){let s=null;for(let a=0;a<=o;a+=1)try{let c=await nw(e,t,{timeout_ms:r});return a>0&&i.push(`search_embedding_batch_retry_succeeded:batch=${n}:attempt=${a+1}:size=${t.length}`),c}catch(c){if(s=c,ow(c)&&t.length>1){let l=Math.ceil(t.length/2),d=t.slice(0,l),u=t.slice(l);return i.push(`search_embedding_batch_split_after_timeout:batch=${n}:size=${t.length}:parts=${d.length}|${u.length}`),[...await Nu(e,d,`${n}.1`,r,o,i),...await Nu(e,u,`${n}.2`,r,o,i)]}if(a<o){let l=Math.min(1e3*2**a,8e3);await new Promise(d=>setTimeout(d,l))}}throw new Error(_L(e,n,t.length,r,o+1,s))}async function Du(e,t,n,r={}){if(n.length===0)return{vectors:[],warnings:[]};let o=[],i=Zr(e.name,t.search.embedding_corpus_max_characters);i.warning&&o.push(i.warning);let s=mL(e,uL(t,i.maxCharacters)),a=0,c=n.map(f=>{let m=pL(f,s.maxInputCharacters);return m.length<f.length&&(a+=1),m});a>0&&o.push(`search_embedding_input_truncated:count=${a}:max_characters=${s.maxInputCharacters}`);let l=fL(c,s.batchSize,s.maxBatchInputCharacters),d=[],u=0;for(let f=0;f<l.length;f+=1){let m=l[f];r.onProgress?.({batch_index:f+1,batch_total:l.length,batch_size:m.length,completed_inputs:u,total_inputs:c.length,phase:"start"}),d.push(...await Nu(e,m,String(f+1),s.timeoutMs,s.maxRetries,o)),u+=m.length,r.onProgress?.({batch_index:f+1,batch_total:l.length,batch_size:m.length,completed_inputs:u,total_inputs:c.length,phase:"complete"})}return{vectors:d,warnings:o}}import{spawnSync as sw}from"node:child_process";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="02a573c3-251d-5f42-abcc-63b5aa263aa1")}catch{}})();var gL="PM_DISABLE_OLLAMA_AUTO_DEFAULTS",hL="PM_OLLAMA_MODEL",yL="http://localhost:11434",wL="qwen3-embedding:0.6b",bL=".agents/pm/search/lancedb/",vL=1500,kL=2500,EL=/qwen.*(?:embed|embedding)|(?:embed|embedding).*qwen/i,SL=/embed|embedding/i,zt=G;function TL(){let e=zt(process.env[gL]);if(!e)return!1;let t=e.toLowerCase();return t==="1"||t==="true"||t==="yes"}function iw(e){return e.some(t=>zt(t)!==null)}function AL(e){let t=zt(e);return!!(t&&t.toLowerCase()!=="ollama")}function IL(e){let t=zt(e);return!!(t&&t.toLowerCase()!=="lancedb")}function CL(e){return AL(e.search?.provider)||IL(e.vector_store?.adapter)||iw([e.providers?.openai?.base_url,e.providers?.openai?.model,e.providers?.openai?.api_key])?!0:iw([e.vector_store?.qdrant?.url,e.vector_store?.qdrant?.api_key])}function OL(){let e=sw("ollama",["--version"],{encoding:"utf8",timeout:vL});return e.error?!1:e.status===0}function xL(e){let t=e.split(/\r?\n/).map(i=>i.trim()).filter(i=>i.length>0);if(t.length===0)return null;let n=t.map(i=>i.split(/\s+/)[0]?.trim()).filter(i=>!!(i&&i.length>0)).filter(i=>i.toUpperCase()!=="NAME");if(n.length===0)return null;let r=n.find(i=>EL.test(i));return r||(n.find(i=>SL.test(i))??null)}function RL(e){let t=zt(e.providers?.ollama?.model);if(t)return t;let n=zt(process.env[hL]);if(n)return n;let r=sw("ollama",["list"],{encoding:"utf8",timeout:kL});if(!r.error&&r.status===0){let o=xL(typeof r.stdout=="string"?r.stdout:"");if(o)return o}return null}function NL(e){return{baseUrl:zt(e.providers?.ollama?.base_url)===null,model:zt(e.providers?.ollama?.model)===null,lancedbPath:zt(e.vector_store?.lancedb?.path)===null,embeddingModel:zt(e.search?.embedding_model)===null}}function DL(e){return e.baseUrl||e.model||e.lancedbPath||e.embeddingModel}function PL(e,t,n){if(!t.baseUrl&&!t.model)return;let r=e.providers??={},o=r.ollama??={};t.baseUrl&&(o.base_url=yL),t.model&&(o.model=n)}function LL(e,t){if(!t.lancedbPath)return;let n=e.vector_store??={},r=n.lancedb??={};r.path=bL}function ML(e,t,n){if(!t.embeddingModel)return;let r=e.search??={};r.embedding_model=n}function Qr(e){let t={settings:e,auto_ollama_defaults_applied:!1};if(TL()||CL(e))return t;let n=NL(e);if(!DL(n)||n.model&&!OL())return t;let r=structuredClone(e),o=RL(r);return o?(PL(r,n,o),LL(r,n),ML(r,n,o),{settings:r,auto_ollama_defaults_applied:!0}):{...t,auto_ollama_defaults_skipped_reason:"no_installed_embedding_model",auto_ollama_defaults_remediation:`Run ollama pull ${wL} or configure providers.ollama.model explicitly (and search.embedding_model if you need an override).`}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="22112449-f1ab-5b6b-a9bb-37e5d3c5b83a")}catch{}})();import{mkdir as $L,readFile as FL,stat as Mu,unlink as jL}from"node:fs/promises";import{basename as aw,dirname as Pu,isAbsolute as UL,join as zL,resolve as $u}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]="887ac66e-679f-5a07-a6a2-8a19a4007198")}catch{}})();var Fu="pm_items",HL=/[^a-zA-Z0-9_-]/g,qL=128,BL=".pm-cli-local-vectors",Lu=1,eo=new Map;function ju(e){return(G(e.collection_name)??Fu).replaceAll(HL,"_").slice(0,qL)}function cw(e){if(!Ir(e)||e.length===0)throw new Error("Vector values must be a non-empty numeric array");return[...e]}function lw(e){let t=G(e.result?.status);if(t)return{status:t};let n=G(e.status);if(n)return{status:n};throw new Error("Qdrant upsert response must include status metadata")}async function dw(e,t,n,r,o){return await Ua({endpoint:e,method:t.method,headers:t.headers,body:t.body,timeoutMs:n,fetcher:r,requestLabel:`Vector ${o} request`,responseLabel:`Vector ${o} response`})}function GL(e){let t=G(e.vector_store?.qdrant?.url);if(!t)return null;let n=G(e.vector_store?.collection_name),r=G(e.vector_store?.qdrant?.api_key);return{name:"qdrant",url:t,...n&&n!==Fu?{collection_name:n}:{},...r?{api_key:r}:{}}}function WL(e){let t=$u(e),n=Pu(t);return aw(t)==="pm"&&aw(n)===".agents"?Pu(n):t}function VL(e,t){return!t||UL(e)?e:$u(WL(t),e)}function KL(e,t){let n=G(e.vector_store?.lancedb?.path);if(!n)return null;let r=G(e.vector_store?.collection_name);return{name:"lancedb",path:VL(n,t),...r&&r!==Fu?{collection_name:r}:{}}}function YL(e){if(!Array.isArray(e)||e.length===0)throw new Error("Vector upsert records must include at least one entry");return e.map((t,n)=>{let r=G(t.id);if(!r)throw new Error(`Vector upsert record at index ${n} is missing a non-empty id`);let o=cw(t.vector),i=t.payload;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error(`Vector upsert record at index ${n} must provide payload as an object when set`);return{id:r,vector:o,...i?{payload:i}:{}}})}function JL(e){if(!Array.isArray(e)||e.length===0)throw new Error("Vector delete ids must include at least one entry");let t=e.map((r,o)=>{let i=G(r);if(!i)throw new Error(`Vector delete id at index ${o} is missing a non-empty value`);return i}).sort((r,o)=>r.localeCompare(o)),n=[];for(let r of t)n.at(-1)!==r&&n.push(r);return n}function XL(e){return e.replace(/\/points\?wait=true$/,"/points/delete?wait=true")}function uw(e){return{"content-type":"application/json",...e.api_key?{"api-key":e.api_key}:{}}}function Uu(e,t){return bi(e,t)}function bi(e,t){return zL($u(e),BL,`${t}.json`)}function ZL(e,t,n){let r=G(e.id);if(!r)throw new Error(`LanceDB local snapshot '${n}' record at index ${t} is missing a non-empty id`);let o=cw(e.vector),i=e.payload;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error(`LanceDB local snapshot '${n}' record '${r}' must provide payload as an object when set`);return{id:r,vector:o,...i?{payload:i}:{}}}function QL(e,t,n){let r;try{r=JSON.parse(n)}catch(c){throw new Error(`LanceDB local snapshot at '${e}' is not valid JSON: ${ie(c)}`)}if(typeof r!="object"||r===null||Array.isArray(r))throw new Error(`LanceDB local snapshot at '${e}' must be a JSON object`);if(r.version!==Lu)throw new Error(`LanceDB local snapshot at '${e}' must include version=${Lu}`);let i=G(r.table);if(!i)throw new Error(`LanceDB local snapshot at '${e}' must include a non-empty table value`);if(i!==t)throw new Error(`LanceDB local snapshot at '${e}' table mismatch: expected '${t}', received '${i}'`);let s=r.records;if(!Array.isArray(s))throw new TypeError(`LanceDB local snapshot at '${e}' must include a records array`);let a=new Map;for(let c=0;c<s.length;c+=1){let l=ZL(s[c],c,e);a.set(l.id,l)}return a}async function eM(e){try{let t=await Mu(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch(t){if(!L(t))throw t;return null}}function tM(e,t){if(!t)return null;if(t.mtimeMs===null&&t.size===null&&t.records.size===0)return t.records;let n=new Map;return eo.set(e,{records:n,mtimeMs:null,size:null}),n}function nM(e,t){return e!==void 0&&t!==null&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function fw(e,t){let n=Uu(e,t),r=bi(e,t),o=await eM(r),i=eo.get(n);if(!o){let a=tM(n,i);if(a)return a}if(nM(i,o))return i.records;let s=new Map;try{let a=await FL(r,"utf8");s=QL(r,t,a)}catch(a){if(!L(a))throw a}return eo.set(n,{records:s,mtimeMs:o?.mtimeMs??null,size:o?.size??null}),s}function rM(e){let t=[...e.values()];return t.sort((n,r)=>n.id.localeCompare(r.id)),t.map(n=>({id:n.id,vector:[...n.vector],...n.payload?{payload:n.payload}:{}}))}async function oM(e){try{await jL(e)}catch(t){if(!L(t))throw new Error(`LanceDB local snapshot delete failed at '${e}': ${ie(t)}`)}}async function mw(e,t,n){let r=bi(e,t);if(n.size===0){await oM(r);return}let o=Pu(r);try{await $L(o,{recursive:!0})}catch(s){throw new Error(`LanceDB local snapshot directory create failed at '${o}': ${ie(s)}`)}let i=`${JSON.stringify({version:Lu,table:t,records:rM(n)})}
119
119
  `;try{await V(r,i)}catch(s){throw new Error(`LanceDB local snapshot write failed at '${r}': ${ie(s)}`)}}function vi(e,t){let n=GL(e),r=KL(e,t),o=[n,r].filter(c=>c!==null),i=G(e.vector_store?.adapter),s=i?i.toLowerCase():null;return{active:(s?o.find(c=>c.name===s):void 0)??o[0]??null,available:o}}function pw(e){let t=ju(e);if(e.name==="qdrant"){let o=_o(e.url),i=encodeURIComponent(t);return{store:"qdrant",query_target:`${o}/collections/${i}/points/search`,upsert_target:`${o}/collections/${i}/points?wait=true`}}let n=encodeURIComponent(e.path),r=encodeURIComponent(t);return{store:"lancedb",query_target:`lancedb://${n}#${r}`,upsert_target:`lancedb://${n}#${r}`}}function iM(e,t){let n=pw(e),r=YL(t);return e.name==="qdrant"?{target:n,method:"POST",headers:uw(e),body:{points:r}}:{target:n,method:"LOCAL",headers:{},body:{table:ju(e),records:r}}}function sM(e,t){let n=pw(e),r=JL(t);return e.name==="qdrant"?{target:n,method:"POST",headers:uw(e),body:{points:r}}:{target:n,method:"LOCAL",headers:{},body:{table:ju(e),ids:r}}}async function zu(e,t,n={}){let r=iM(e,t);if(r.method==="LOCAL"){let a=e,c=r.body,l=Uu(a.path,c.table),d=await fw(a.path,c.table);for(let m of c.records)d.set(m.id,m);await mw(a.path,c.table,d);let u=bi(a.path,c.table),f=await Mu(u);return eo.set(l,{records:d,mtimeMs:f.mtimeMs,size:f.size}),{status:"ok"}}let o=hi(n.timeout_ms,"Vector request"),i=yi(n.fetcher,"Vector request"),s=await dw(r.target.upsert_target,{method:"POST",headers:r.headers,body:r.body},o,i,"upsert");return lw(s)}async function Hu(e,t,n={}){let r=sM(e,t);if(r.method==="LOCAL"){let a=e,c=r.body,l=Uu(a.path,c.table),d=await fw(a.path,c.table);if(d.size===0)return{status:"ok"};for(let u of c.ids)d.delete(u);if(await mw(a.path,c.table,d),d.size===0)eo.delete(l);else{let u=bi(a.path,c.table),f=await Mu(u);eo.set(l,{records:d,mtimeMs:f.mtimeMs,size:f.size})}return{status:"ok"}}let o=hi(n.timeout_ms,"Vector request"),i=yi(n.fetcher,"Vector request"),s=await dw(XL(r.target.upsert_target),{method:"POST",headers:r.headers,body:r.body},o,i,"delete");return lw(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]="f4a214b6-02f4-5fc4-bfcd-90c0ca940842")}catch{}})();function to(e,t){let n=G(e),r=G(t);return!n||!r?null:{provider:n,model:r}}function _w(e){if(e==null)return null;if(typeof e!="object"||Array.isArray(e))throw new Error("Vectorization embedding metadata must be an object when set");let t=to(e.provider,e.model),n=e.vector_dimension;if(!t||typeof n!="number"||!Number.isInteger(n)||n<=0)throw new Error("Vectorization embedding metadata must include provider, model, and positive vector_dimension");return{...t,vector_dimension:n}}function qu(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("Vectorization embedding metadata requires a positive vector dimension");return{provider:e.provider,model:e.model,vector_dimension:t}}function ki(e,t){return!e||e.provider!==t.provider||e.model!==t.model}function Bu(e,t){return!!(e&&e.vector_dimension!==t)}function Gu(e,t){if(e.length===0)throw new Error(`${t} returned no vectors`);let r=e[0].length;if(!Number.isInteger(r)||r<=0)throw new Error(`${t} returned an empty vector`);for(let o=1;o<e.length;o+=1)if(e[o]?.length!==r)throw new Error(`${t} returned mixed vector dimensions`);return r}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b382ab50-682e-5e53-a32d-277c5ccf8bef")}catch{}})();var yw="search/vectorization-status.json";function Si(e){return[...new Set([...e].map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function ww(e){return typeof e=="string"&&e.trim().length>0&&Number.isFinite(Date.parse(e))}function bw(e){let t=new Map;for(let[n,r]of Object.entries(e)){let o=n.trim();o.length===0||!ww(r)||t.set(o,r)}return Object.fromEntries([...t.entries()].sort((n,r)=>n[0].localeCompare(r[0])))}async function Ti(e){let t=hw.join(e,yw),n=await J(t);if(n===null||n.trim().length===0)return{entries:{},embedding:null,warnings:[]};let r;try{r=JSON.parse(n)}catch{return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]}}if(typeof r!="object"||r===null||r.version!==1||!Array.isArray(r.items))return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};let o=new Map;for(let s of r.items){if(typeof s!="object"||s===null)return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};let a=s.id,c=s.updated_at;if(typeof a!="string"||a.trim().length===0||!ww(c))return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};o.set(a.trim(),c)}let i=null;try{i=_w(r.embedding)}catch{return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]}}return{entries:Object.fromEntries([...o.entries()].sort((s,a)=>s[0].localeCompare(a[0]))),embedding:i,warnings:[]}}async function vw(e,t,n){let r=bw(t),o=hw.join(e,yw),i=`${JSON.stringify({version:1,generated_at:$(),...n?{embedding:n}:{},items:Object.entries(r).map(([s,a])=>({id:s,updated_at:a}))},null,2)}
120
- `;await V(o,i)}function cM(e){return{id:e.id,type:e.type,status:e.status,priority:e.priority,updated_at:e.updated_at}}function lM(e){let t=to(e.name,e.model);if(!t)throw new Error("Embedding provider must include a provider name and model");return t}function Ei(e,t){return{refreshed:[],skipped:e,warnings:[t]}}async function dM(e,t,n){if(!n.settings&&!await j(Ee(e)))return Ei(t,"search_semantic_refresh_skipped:settings_not_initialized");let r;try{if(n.settings)r=n.settings;else{let a=await xn(e),c=a.warnings.find(l=>l.startsWith("settings_read_"));if(c)return Ei(t,`search_semantic_refresh_skipped:settings_read_failed:${c}`);r=a.settings}}catch(a){return Ei(t,`search_semantic_refresh_skipped:settings_read_failed:${ie(a)}`)}let o=n.apply_runtime_defaults?Qr(r).settings:r,i=wi(o).active;if(!i)return Ei(t,"search_semantic_refresh_skipped:provider_unconfigured");let s=vi(o,e).active;return s?{settings:o,provider:i,vectorStore:s}:Ei(t,"search_semantic_refresh_skipped:vector_store_unconfigured")}async function uM(e,t,n,r,o,i){let s=[],a=new Set,c=new Set,l=[];for(let d of r){let u=await Fe(e,d,t,n,o);if(!u){c.add(d);continue}try{let f=await Ye(u,{schema:i});l.push({id:f.document.metadata.id,document:f.document})}catch(f){a.add(u.id),s.push(`search_semantic_refresh_item_read_failed:${u.id}:${ie(f)}`)}}return l.sort((d,u)=>d.id.localeCompare(u.id)),{documents:l,missingIds:Si(c),skippedIds:Si(a),warnings:s}}async function fM(e,t,n){let r=Zr(t.name,e.search.embedding_corpus_max_characters).maxCharacters,o=Ou(e),i=n.map(a=>Ru(a.document,{providerName:t.name,maxCharacters:r,fields:o})),s=await Du(t,e,i);return{vectors:s.vectors,vector_dimension:Gu(s.vectors,"Semantic refresh embedding"),warnings:s.warnings}}async function mM(e,t,n){return await zu(e,t.map((r,o)=>({id:r.id,vector:n[o],payload:cM(r.document.metadata)}))),{refreshed:t.map(r=>r.id),skipped:[],warnings:[]}}async function pM(e,t){if(t.length===0)return{refreshed:[],skipped:[],warnings:[]};try{return await Hu(e,t),{refreshed:[],skipped:[],warnings:[]}}catch(n){return{refreshed:[],skipped:t,warnings:[`search_semantic_refresh_delete_failed:${ie(n)}`]}}}async function kw(e,t,n={}){let r=Si(t);if(r.length===0)return{refreshed:[],skipped:[],warnings:[]};let o=await dM(e,r,n);if(!("settings"in o))return o;let i=ge(o.settings,Y()),s=await uM(e,o.settings.id_prefix,o.settings.item_format,r,i.type_to_folder,o.settings.schema),a=s.documents.length>0||s.missingIds.length>0?await Ti(e):{entries:{},embedding:null,warnings:[]},c=lM(o.provider),l=a.entries,d={refreshed:[],skipped:[],warnings:[]},u=a.embedding;if(s.documents.length>0)if(a.embedding&&ki(a.embedding,c))d={refreshed:[],skipped:s.documents.map(y=>y.id),warnings:["search_semantic_refresh_requires_reindex:embedding_identity_changed"]};else try{let y=await fM(o.settings,o.provider,s.documents);if(Bu(a.embedding,y.vector_dimension))d={refreshed:[],skipped:s.documents.map(b=>b.id),warnings:[...y.warnings,"search_semantic_refresh_requires_reindex:vector_dimension_changed"]};else{u=qu(c,y.vector_dimension);let b=await mM(o.vectorStore,s.documents,y.vectors);d={refreshed:b.refreshed,skipped:b.skipped,warnings:[...y.warnings,...b.warnings]}}}catch(y){d={refreshed:[],skipped:s.documents.map(b=>b.id),warnings:[`search_semantic_refresh_failed:${ie(y)}`]}}let f=await pM(o.vectorStore,s.missingIds),m=new Set(d.refreshed),p=Object.fromEntries(s.documents.filter(y=>m.has(y.id)).map(y=>[y.id,y.document.metadata.updated_at])),w=[];if(Object.keys(p).length>0||s.missingIds.length>0){let y={...l,...bw(p)};for(let b of s.missingIds)delete y[b];try{await vw(e,y,u)}catch(b){w.push(`search_vectorization_status_ledger_write_failed:${ie(b)}`)}w.push(...a.warnings)}return{refreshed:Si([...d.refreshed,...f.refreshed]),skipped:Si([...s.skippedIds,...d.skipped,...f.skipped]),warnings:[...s.warnings,...d.warnings,...f.warnings,...w]}}(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]="e15abc24-c46a-512b-b859-015186c960df")}catch{}})();function Wu(e,t){let n=t??{};return e.filter(r=>n[r.id]!==r.updated_at).map(r=>r.id).sort((r,o)=>r.localeCompare(o))}import yM from"node:crypto";import Ku 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]="9d949852-abfe-5fbd-88c5-5da0cfbaf7de")}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]="4e329152-7e9e-5cf2-a4cf-35260a599360")}catch{}})();var RJ=new Map([[_.USAGE,"invalid_command_usage"],[_.NOT_FOUND,"item_not_found"],[_.CONFLICT,"lock_conflict"],[_.DEPENDENCY_FAILED,"dependency_failed"]]);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9d073708-29b1-56b5-bcff-b964bfdcb43d")}catch{}})();var ZJ=Ku.join("runtime","telemetry","events.jsonl"),QJ=Ku.join("runtime","telemetry","state.json"),e7=Ku.join("runtime","telemetry","otel-spans.jsonl");var Sw=1;var Tw=15;var t7=3600*1e3;var n7=globalThis.fetch;var o7=Promise.resolve(),i7=Promise.resolve();var s7=new Set(Jr);var a7=yM.randomUUID();var Aw="(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|session|credentials|bearer|literals?|regex(?:es)?|replacements?)",c7=new RegExp(`\\b(${Aw})\\s*([:=])\\s*([^\\s,;]+)`,"giu"),l7=new RegExp(`(--${Aw})(=|\\s+)([^\\s,;]+)`,"giu");(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]="a236314b-1a3b-5499-bed3-364a2cb034a5")}catch{}})();var wM=Object.freeze([{code:"missing_directory",command:"pm init",summary:"Recreate missing tracker directories (pm init is idempotent and restores the scaffold)."},{code:"settings_read_fs_error",command:"pm config list --json",summary:"settings.json could not be read as a regular file and pm fell back to defaults; repair the reported path or permissions, then re-run."},{code:"settings_read_invalid_json",command:"pm config list --json",summary:"settings.json is not valid JSON and pm fell back to defaults; fix the syntax error in the reported path, then re-run."},{code:"settings_read_invalid_schema",command:"pm config list --json",summary:"settings.json failed schema validation and pm fell back to defaults; correct the reported key in the file, then re-run."},{code:"settings_read_merge_failed",command:"pm config list --json",summary:"Global/project settings could not be merged; reconcile the conflicting keys in the reported settings files."},{code:"settings:id_prefix_empty",command:"pm config list --json",summary:'id_prefix is empty; set a non-empty "id_prefix" in settings.json so generated item ids are well-formed.'},{code:"settings:locks_ttl_non_positive",command:"pm config list --json",summary:'locks.ttl_seconds must be positive; set a positive "locks.ttl_seconds" in settings.json.'},{code:"telemetry_state_invalid_json",command:"pm health --check-telemetry",summary:"Local telemetry state file is corrupt; pm recreates it on the next flush. Advisory only."},{code:"telemetry_queue_invalid_rows",command:"pm health --check-telemetry",summary:"The telemetry queue has unparseable rows; they are skipped on the next flush. Advisory only."},{code:"telemetry_queue_pending",command:"pm health --check-telemetry",summary:"Telemetry events are queued; they flush automatically on the next reachable command. Advisory only."},{code:"telemetry_queue_high_retries",command:"pm telemetry flush",summary:"Some queued telemetry events are near retry exhaustion; flush now and verify endpoint reachability before entries are dropped."},{code:"telemetry_endpoint_probe_failed",command:"pm health --check-telemetry",summary:"The telemetry endpoint is unreachable; events stay queued until it recovers. Advisory only."},{code:"telemetry_endpoint_probe_http_status",command:"pm health --check-telemetry",summary:"The telemetry endpoint returned a non-success status; events stay queued until it recovers. Advisory only."},{code:"telemetry_schema_version_behind",command:"pm health --check-telemetry",summary:"Client schema is behind server; upgrade pm-cli to emit the latest event shape."},{code:"telemetry_otel_export_failing",command:"pm health --check-telemetry",summary:"OTLP trace spans are queued but the traces endpoint export is failing; spans retry automatically on the next reachable command, or set PM_TELEMETRY_OTEL_DISABLED=1 to skip OTLP export. Advisory only."},{code:"merge_driver_configuration_missing",command:"pm merge install",summary:"Install the clone-local Git drivers required by the tracker merge fence."},{code:"merge_driver_configuration_drift",command:"pm merge install",summary:"Reinstall clone-local Git drivers after runtime or package paths change."},{code:"validate_merge_driver_configuration",command:"pm merge install",summary:"Restore missing or drifted clone-local Git merge driver commands."},{code:"integrity_item_unreadable",command:"pm validate --check-files --verbose-diagnostics",summary:"An item file could not be read; restore or repair the file at the reported path."},{code:"integrity_item_parse_failed",command:"pm validate --check-files --verbose-diagnostics",summary:"An item file failed to parse; fix the malformed item metadata at the reported path."},{code:"integrity_item_conflict_marker",command:"pm validate --check-files --verbose-diagnostics",summary:"An item file contains Git conflict markers; resolve the <<<<<<< / >>>>>>> markers at the reported line."},{code:"integrity_history_unreadable",command:"pm history-repair <id>",summary:"A history stream could not be read; re-anchor the affected item's history chain."},{code:"integrity_history_invalid_json",command:"pm history-repair <id>",summary:"A history stream contains invalid JSON; re-anchor the affected item's history chain."},{code:"integrity_history_conflict_marker",command:"pm history-repair <id>",summary:"A history stream contains Git conflict markers; resolve the markers, then re-anchor the chain."},{code:"validate_storage_unreadable_items",command:"pm validate --check-storage-integrity --verbose-diagnostics",summary:"An on-disk item file cannot be parsed (for example a botched merge resolution with stale TOON count headers); repair or restore the file at the reported path \u2014 list commands silently skip it while pm get hard-errors."},{code:"validate_storage_duplicate_item_ids",command:"pm validate --check-storage-integrity --verbose-diagnostics",summary:"One item id is claimed by multiple item documents \u2014 usually two branches minting the same id for different items before merging (GH-600). Keep one document, recreate the other item under a fresh id (pm copy, then delete the colliding file), and consider raising ids.token_length for concurrent multi-agent work."},{code:"validate_storage_history_conflict_markers",command:"pm merge driver history <base> <ours> <theirs>",summary:"A history stream contains unresolved Git conflict markers; re-merge it with the pm history merge driver (or resolve the markers by hand), then run pm history-repair for the item."},{code:"validate_storage_unparseable_history",command:"pm history-repair <id>",summary:"A history stream's newest line is not valid JSONL; repair or restore the stream before further mutations."},{code:"validate_storage_resurrected_items",command:"pm delete <id>",summary:"A live item's newest history operation is a delete: a delete/modify merge silently resurrected it. Decide the winner \u2014 re-delete the item, or keep it and append a mutation documenting the revival."},{code:"validate_storage_unparseable_config",command:"pm merge driver json <base> <ours> <theirs>",summary:"settings.json or a schema file cannot be parsed, so pm silently falls back to defaults; re-merge it with the pm JSON merge driver or fix the file by hand, then rerun pm validate."},{code:"validate_merge_fence_drift",command:"pm merge install",summary:"The committed .gitattributes merge fence no longer matches the active schema's type folders or tracker JSONL stores; rerun pm merge install (and commit .gitattributes) so every tracker artifact keeps its field-aware merge driver."},{code:"validate_storage_tracked_runtime_cache_files",command:"git rm --cached -r -- <tracked-runtime-directories>",summary:"Clone-local tracker runtime artifacts are committed. Run the exact tracked_runtime_cache.remediation_command, commit the index-only removals and managed .gitignore fence, then rerun validation."},{code:"integrity_item_outdated_format_version",command:"pm validate --verbose-diagnostics",summary:"An item predates the current storage format version; a pm storage migration rewrites it. Use --verbose-diagnostics to list the affected items."},{code:"integrity_item_ahead_format_version",command:"npm install -g @unbrained/pm-cli@latest",summary:"An item was written by a newer pm format version than this runtime supports; upgrade pm to read and validate it safely."},{code:"tracked_runtime_cache_files",command:"git rm --cached -r -- <tracked-runtime-directories>",summary:"Clone-local tracker runtime artifacts are committed. Run the exact tracked_runtime_cache.remediation_command from the integrity check, commit the index-only removals, and keep the managed .gitignore fence."},{code:"merge_decisions_unreviewed",command:"pm merge reconcile --dry-run",summary:"Review the pending merge receipts, re-apply any intended discarded values, then run pm merge reconcile; lossy receipts require explicit --force acceptance."},{code:"merge_receipts_pending",command:"pm merge reconcile",summary:"A lossless merge receipt is still pending; run pm merge reconcile to settle it (optionally preview first with --dry-run) so a green health gate certifies receipt settlement, not only intact data."},{code:"merge_receipt_evidence_invalid",command:"pm merge report --include-reconciled --json",summary:"One or more receipt candidates failed bounded-file, schema, identity, or copy-consistency validation; inspect the report's privacy-safe source, receipt id, and reason before repairing only the named evidence."},{code:"merge_receipt_history_reference_missing",command:"pm merge reconcile --dry-run",summary:"Review the bounded coordinates and recover available evidence first; for exact pre-durable clone-local-only references, rerun with --force so pm appends an audited disposition and proves the health finding is cleared without rewriting history."},{code:"validate_merge_decisions_unreviewed",command:"pm merge reconcile --dry-run",summary:"Review the pending merge receipts before reconciliation; history-repair alone does not settle them, and lossy receipts require explicit --force acceptance."},{code:"history_drift_missing_stream",command:"pm history-repair <id>",summary:"The item has no history stream; re-anchor the chain to rebuild it (pm history-repair --all repairs every drifted stream in one pass)."},{code:"history_drift_unreadable_stream",command:"pm history-repair <id>",summary:"The item's history stream is unreadable; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass)."},{code:"history_drift_hash_mismatch",command:"pm history-repair <id>",summary:"The item's content hash no longer matches its history; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass)."},{code:"history_drift_chain_mismatch",command:"pm history-repair <id>",summary:"The item's history chain is broken; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass)."},{code:"history_drift_version_skew",command:"npm install -g @unbrained/pm-cli@latest",summary:"A history stream declares an item hash version this runtime does not support; upgrade pm to verify the chain instead of re-anchoring it."},{code:"history_drift_merge_receipt",command:"pm merge reconcile",summary:"Canonical path, changed-field, and merged-value hash evidence attributes this drift to a pending receipt; run reconciliation (optionally preview first with --dry-run) instead of repairing history directly."},{code:"history_stream_over_compact_threshold",command:"pm history-compact <id>",summary:"The history stream exceeds the configured compaction threshold; compact it (pm history-compact --all-streams sweeps every over-threshold stream in one pass)."},{code:"history_unknown_author_events",command:'pm history-author-acknowledge --all-actionable --attributed-author "<principal>" --reviewer "<reviewer>" --reason "<evidence>"',summary:"Review the actionable coordinates, then record an append-only attribution disposition for the complete current set."},{code:"provenance_value_domain_invalid",command:"pm history-repair --all --normalize-provenance",summary:"Remove invalid bounded provenance observations from affected streams and append privacy-safe aggregate repair receipts."},{code:"validate_history_unknown_author_events",command:'pm history-author-acknowledge --all-actionable --attributed-author "<principal>" --reviewer "<reviewer>" --reason "<evidence>"',summary:"Review the actionable coordinates, then record an append-only attribution disposition for the complete current set."},{code:"locks_stale_count",command:"pm gc --scope locks",summary:"Stale item-claim locks (embedded ttl elapsed) can block mutations; sweep them \u2014 gc retains active and unparseable locks."},{code:"locks_unreadable",command:"pm gc --scope locks --dry-run",summary:"Some lock files could not be read; preview the sweep and inspect the unreadable files manually \u2014 gc never deletes what it cannot read."},{code:"extension_update_health_partial_coverage",command:"pm extension --adopt-all --project",summary:"Update-health coverage is partial because unmanaged extensions were skipped; adopt the existing installs into managed metadata so the update scan covers them (use --global for global-scope extensions, or pm package --adopt-all when working with packages)."},{code:"vectorization_stale_items_remaining",command:"pm health --refresh-vectors",summary:"Some items have stale embeddings; refresh vectors so semantic search results stay current."},{code:"vectorization_embedding_identity_changed",command:"pm reindex --mode semantic",summary:"Embedding provider/model changed since the last index; run a semantic reindex to rebuild vectors."},{code:"validate_metadata_missing_closed_at",command:"pm validate --check-metadata --auto-fix --fix-scope timestamps --dry-run",summary:"Preview closure dates proven by verified lifecycle history; inspect residuals and omit --dry-run to apply only proven dates."},{code:"validate_metadata_missing_acceptance_criteria",command:'pm update <id> --acceptance-criteria "<criteria>"',summary:"Backfill the missing acceptance criteria on the reported item(s)."},{code:"validate_metadata_missing_estimate",command:'pm update <id> --estimate "<estimate>"',summary:"Backfill the missing estimate on the reported item(s)."},{code:"validate_metadata_missing_close_reason",command:'pm update <id> --close-reason "<reason>"',summary:"Backfill the missing close reason on the reported closed item(s)."},{code:"validate_metadata_missing_reviewer",command:'pm update <id> --reviewer "<name>"',summary:"Backfill the missing reviewer on the reported item(s)."},{code:"validate_metadata_missing_risk",command:'pm update <id> --risk "<level>"',summary:"Backfill the missing risk on the reported item(s)."},{code:"validate_metadata_missing_confidence",command:'pm update <id> --confidence "<level>"',summary:"Backfill the missing confidence on the reported item(s)."},{code:"validate_metadata_missing_sprint",command:'pm update <id> --sprint "<sprint>"',summary:"Backfill the missing sprint on the reported item(s)."},{code:"validate_metadata_missing_release",command:'pm update <id> --release "<release>"',summary:"Backfill the missing release on the reported item(s)."},{code:"validate_metadata_custom_profile_missing_required_fields",command:'pm config set metadata-required-fields --criterion "<field>"',summary:"Config-driven finding: the custom metadata profile has no required fields configured and falls back to core, so configure the fields rather than mutating items."},{code:"validate_metadata_duplicate_issue_codes",command:'pm update <id> --title "<distinct title>"',summary:"Two or more items share one logical issue code (GH-235); give each a distinct title so the derived code is unique, or close the redundant item with pm close <id> --duplicate-of <canonical-id> (closed-as-duplicate items are excluded from the check)."},{code:"validate_resolution_missing_fields",command:'pm update <id> --resolution "<how resolved>"',summary:"Backfill resolution / expected_result / actual_result on the reported closed item(s)."},{code:"validate_lifecycle_active_closure_like_metadata",command:"pm update <id> --unset <closure-like-field>",summary:"Clear the closure-like field the validator flags on this active item \u2014 the detail row names it (resolution / actual-result / blocked-reason) \u2014 or close the item if it is actually done."},{code:"validate_lifecycle_active_terminal_parent",command:"pm update <id> --parent <active-parent-id>",summary:"Reopen the terminal parent or move the active child under a non-terminal parent."},{code:"validate_lifecycle_stale_blockers",command:"pm update <id> --unset blocked-by --unset blocked-reason",summary:"Resolve the stale blocker the validator flags: clear blocked-by/blocked-reason when they linger on a non-blocked item or report a resolved blocker; if instead a blocked item is missing blocker context, add the context or move it out of a blocked status."},{code:"validate_lifecycle_dependency_cycles_error",command:"pm update <id> --dep-remove <dep-id>",summary:"Break the dependency cycle by removing one edge from the reported cycle."},{code:"validate_lifecycle_dependency_cycles",command:"pm update <id> --dep-remove <dep-id>",summary:"Break the dependency cycle by removing one edge from the reported cycle."},{code:"validate_hierarchy_parent_cycle_error",command:"pm update <id> --parent <other-id>",summary:"Break the parent-hierarchy cycle by reparenting one item in the reported cycle to a non-cyclic parent (or clear it with pm update <id> --unset parent)."},{code:"validate_hierarchy_parent_cycle",command:"pm update <id> --parent <other-id>",summary:"Break the parent-hierarchy cycle by reparenting one item in the reported cycle to a non-cyclic parent (or clear it with pm update <id> --unset parent)."},{code:"validate_files_missing_linked_paths",command:"pm <files|docs> <id> --remove <path>",summary:"The check spans both item.files and item.docs under one code: restore the missing linked artifact, or unlink it with pm files (linked file) or pm docs (linked doc)."},{code:"validate_files_orphaned_paths",command:"pm <files|docs> <id> --add <path>",summary:"Link the orphaned artifact with pm files (file) or pm docs (doc), or remove it from the workspace."},{code:"validate_files_tracked_all_strict_forces_pm_internals",command:"pm validate --check-files --include-pm-internals",summary:"tracked-all-strict scan flagged pm internals; re-run with --include-pm-internals or a softer --scan-mode."},{code:"validate_history_drift_missing_streams",command:"pm history-repair <id>",summary:"Re-anchor the history chains of the items missing a history stream."},{code:"validate_history_drift_unreadable_streams",command:"pm history-repair <id>",summary:"Re-anchor the history chains of the items with an unreadable history stream."},{code:"validate_history_drift_hash_mismatches",command:"pm history-repair <id>",summary:"Re-anchor the history chains of the items whose content hash drifted."},{code:"validate_history_drift_chain_mismatches",command:"pm history-repair <id>",summary:"Re-anchor the history chains of the items with a broken history chain."},{code:"validate_history_drift_version_skews",command:"npm install -g @unbrained/pm-cli@latest",summary:"One or more history streams declare an item hash version this runtime does not support; upgrade pm to verify the chains instead of re-anchoring them."},{code:"validate_command_references_stale_pm_ids",command:'pm update <id> --replace-tests --test "command=<corrected-command>" [--test ...]',summary:"Correct the stale pm-ID inside the item's linked test command (the check scans tests[].command, not the body). --replace-tests overwrites the entire tests list, so re-include the item's other linked tests in the same call."},{code:"validate_format_version_outdated_items",command:"pm validate --verbose-diagnostics",summary:"One or more items predate the current storage format version; a pm storage migration rewrites them. Use --verbose-diagnostics to list the affected items."},{code:"validate_format_version_ahead_items",command:"npm install -g @unbrained/pm-cli@latest",summary:"One or more items were written by a newer pm format version than this runtime supports; upgrade pm to read and validate them safely."}]);function Yu(e){if(typeof e!="string")return;let t=e.trim();for(let n of wM)if(t===n.code||t.startsWith(`${n.code}:`))return n}function Ju(e){let t={};for(let n of e){let r=Yu(n);r!==void 0&&!Object.prototype.hasOwnProperty.call(t,r.code)&&(t[r.code]=r.command)}return t}function Iw(e){return Object.values(Ju(e))}import xw from"node:fs/promises";import{createRequire as bM}from"node:module";import ot 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]="a0014621-9e3d-5620-8f36-081811054843")}catch{}})();function Cw(e,t){let n=ot.relative(t,e);if(n.length>0&&n!==".."&&!n.startsWith(`..${ot.sep}`)&&!ot.isAbsolute(n))return n.split(ot.sep).join("/");let r=ot.resolve(e),o=0xcbf29ce484222325n;for(let s=0;s<r.length;s+=1)o^=BigInt(r.charCodeAt(s)),o=BigInt.asUintN(64,o*0x100000001b3n);return`<external>/${o.toString(16).padStart(16,"0")}/${ot.basename(ot.dirname(e))}/package.json`}function vM(e){return e.includes(`${ot.sep}.pnpm${ot.sep}`)?"pnpm":e.includes(`${ot.sep}node_modules${ot.sep}`)?"npm":"other"}async function Ow(e){try{let t=JSON.parse(await xw.readFile(e,"utf8"));return t.name==="@unbrained/pm-cli"&&typeof t.version=="string"&&t.version.trim().length>0?t.version.trim():void 0}catch{return}}async function Xu(e){try{return await xw.realpath(e)}catch{return ot.resolve(e)}}async function Rw(e,t,n=tt(import.meta.url,["../../.."])){let r=await Xu(t),o=await Xu(ot.join(n,"package.json")),i=await Ow(o),s=new Map;i!==void 0&&s.set(o,{version:i,path:Cw(o,r),layout:"host",consumers:["pm-cli-host"]});for(let l of e)try{let d=bM(l.entry_path).resolve("@unbrained/pm-cli/package.json"),u=await Xu(d),f=await Ow(u);if(f===void 0)continue;let m=u,p=s.get(m);if(p){p.consumers.includes(l.name)||(p.consumers.push(l.name),p.consumers.sort((w,y)=>w.localeCompare(y)));continue}s.set(m,{version:f,path:Cw(u,r),layout:vM(u),consumers:[l.name]})}catch{}let a=[...s.values()].sort((l,d)=>l.path.localeCompare(d.path)),c=i===void 0?[]:a.filter(l=>l.version!==i);return{host_version:i??null,copies:a,mismatches:c,warnings:c.map(l=>`extension_host_pm_cli_version_skew:${i}:${l.version}:${l.consumers.join("+")}`)}}import Rf from"node:fs/promises";import Nf from"node:path";import{Option as ure}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="93b04081-a71a-5987-8fb6-09a8d045c1da")}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]="8ed4af4c-40cf-5902-930b-78a4758871b2")}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]="fdacd8ac-787a-5639-84d5-a32b6ce79d41")}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]="854a0596-b0ec-5d2e-85b1-5444d8d7b622")}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]="e6571e4b-c436-5af7-be01-c3fce3a9c5d3")}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]="91874535-458b-5a33-a68a-96f44bd2e1f8")}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]="b0306587-b3bb-5f82-bb56-7939d1976870")}catch{}})();var kM={critical:0,high:1,medium:2,low:3,minimal:4},EM=Object.keys(kM),q7=`numbers 0..4 (0=critical, 1=high, 2=medium, 3=low, 4=minimal) or names (${EM.join(", ")}), case-insensitive`;(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]="bfb46357-04de-55a0-b132-779c153314de")}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]="0eff4d63-2691-5130-bc12-4957218393b5")}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]="eb151177-d326-5ce4-9624-87f6393046e0")}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]="41196e9d-00c2-5473-848d-7563463c42a7")}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]="df9abedd-6e84-5712-8e5e-4e510ec3ed60")}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]="24688724-53cd-5375-ae7e-cfe098cd0dc8")}catch{}})();var sX=new Map(Sc.map(e=>[e.toLowerCase(),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]="7778b388-1b28-53e7-a06e-ef6441b0ed68")}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]="ef20c613-623c-5a11-8384-ccf4ee3addde")}catch{}})();import{createRequire as TM}from"node:module";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="12bf6794-9410-5683-bb83-a0da8d2614a7")}catch{}})();var AM=/(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|credentials|bearer|dsn)/i,yX=new RegExp(`\\b(${AM.source})\\s*[:=]\\s*([^\\s,;]+)`,"giu");var wX=TM(import.meta.url);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="199c4791-6ca7-50c4-b2cd-aa96c0ab2408")}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]="d7a68072-168d-509a-95ec-145635d71d46")}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]="eed441f0-e2b5-51e9-b9bf-0f4882a9eeea")}catch{}})();var IM=[{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"}],DX=new Map(IM.map(e=>[e.action,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]="c18e4dfc-d3e3-5185-9470-9d46b4dca893")}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]="54784ad1-36bd-5a10-aa00-ad0b09e935a7")}catch{}})();import CM 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]="cdae67c6-8316-5e97-84ca-0be4460ffd57")}catch{}})();function Ha(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function OM(e,t){return[e.updated_at,t].map(r=>({value:r,time:Date.parse(r??"")})).filter(r=>typeof r.value=="string"&&Number.isFinite(r.time)).sort((r,o)=>o.time-r.time)[0]?.value??e.updated_at}function Dw(e,t){let n=Math.max(1,Math.trunc(t.threshold_hours)),r=(t.now??new Date).getTime(),o=Ha(t.in_progress_status),i=[];for(let s of e){if(Ha(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=OM(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let l=Math.max(0,Math.floor((r-c)/36e5));l>=n&&i.push({id:s.id,last_activity_at:a,age_hours:l})}return i.sort((s,a)=>a.age_hours-s.age_hours||s.id.localeCompare(a.id)),{threshold_hours:n,count:i.length,items:i,remediation:"Claim active work with `pm claim <id>` or return abandoned work to open with `pm update <id> --status open`."}}async function Zu(e,t,n){let r=new Map;return await Promise.all(t.filter(o=>Ha(String(o.status))===Ha(n.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await nt(CM.join(e,"history",`${o.id}.jsonl`),o.id)}catch{return}let s=i.map(a=>a.ts).filter(a=>Number.isFinite(Date.parse(a))).sort((a,c)=>Date.parse(c)-Date.parse(a))[0];s&&r.set(o.id,s)})),Dw(t,{...n,last_history_activity:o=>r.get(o.id)})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eb1afbe5-eb0a-56d2-bb94-80fd427325f7")}catch{}})();var HX=Object.freeze({"&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&amp;":"&"});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4873876d-67b4-5f79-a984-756b7e539e9b")}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]="3940f646-f84d-5eb0-8db1-de64ca0a5985")}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]="f3edff87-6ea5-5108-a749-eeb380870601")}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]="1ad4a739-f29d-5b50-b1cf-f8590804e32b")}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]="d2940263-a7b4-5d29-b1e5-631fe1072a5b")}catch{}})();import tZ from"node:readline/promises";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="91cfc9cf-9ab1-5c9f-803d-f378e9963c4a")}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]="d27383c3-03c8-51ff-98c5-700cc6c2c114")}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]="4426de97-62fc-594c-8ebf-39975ed5ed50")}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]="76a156ee-aebd-547e-b4c2-1ed1b172fd6b")}catch{}})();var Qu=[{target:"title",keys:["title"],option:"--title, -t <value>",description:"Item title [required] (or pass title as the first positional argument)"},{target:"id",keys:["id"],option:"--id <value>",description:"Explicit item id (normalized with the configured id_prefix)"},{target:"description",keys:["description"],option:"--description, -d <value>",description:"Item description (allow empty string)"},{target:"type",keys:["type"],option:"--type <value>",description:"Item type (built-ins plus any configured custom types)"},{target:"template",keys:["template"],option:"--template <value>",description:"Apply named create template defaults before explicit flags"},{target:"createMode",keys:["createMode","create_mode"],option:"--create-mode <value>",description:"Create required-option policy mode: strict|progressive",aliasOptions:[{option:"--create_mode <value>",description:"Alias for --create-mode"}]},{target:"schedulePreset",keys:["schedulePreset","schedule_preset"],option:"--schedule-preset <value>",description:"Scheduling preset for Reminder|Meeting|Event: lightweight",aliasOptions:[{option:"--schedule_preset <value>",description:"Alias for --schedule-preset"}]},{target:"status",keys:["status"],option:"--status, -s <value>",description:"Item status"},{target:"closeReason",keys:["closeReason","close_reason"],option:"--close-reason <value>",description:"Close reason when creating directly in a terminal status",aliasOptions:[{option:"--close_reason <value>",description:"Alias for --close-reason"}]},{target:"completedAt",keys:["completedAt","completed_at"],option:"--completed-at <value>",description:"Actual completion time for a terminal imported item",aliasOptions:[{option:"--completed_at <value>",description:"Alias for --completed-at"}]},{target:"priority",keys:["priority"],option:"--priority, -p <value>",description:"Priority 0..4"},{target:"tags",keys:["tags"],option:"--tags <value>",description:"Comma-separated tags"},{target:"addTags",keys:["addTags","add_tags"],option:"--add-tags <value>",description:"Add tags additively on top of --tags (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--add_tags <value>",description:"Alias for --add-tags"}]},{target:"body",keys:["body"],option:"--body, -b <value>",description:"Item markdown body (allow empty string)"},{target:"deadline",keys:["deadline"],option:"--deadline <value>",description:"Deadline (ISO/date string or relative +6h/+1d/+2w/+6m)"},{target:"estimatedMinutes",keys:["estimate","estimatedMinutes","estimated_minutes"],option:"--estimate, --estimated-minutes <value>",description:"Estimated minutes",aliasOptions:[{option:"--estimated_minutes <value>",description:"Alias for --estimated-minutes"}]},{target:"acceptanceCriteria",keys:["acceptanceCriteria","acceptance_criteria","ac"],option:"--acceptance-criteria <value>",description:"Acceptance criteria (repeatable; values join with '; '; allow empty string)",repeatable:!0,aliasOptions:[{option:"--acceptance_criteria <value>",description:"Alias for --acceptance-criteria"},{option:"--ac <value>",description:"Alias for --acceptance-criteria"}]},{target:"definitionOfReady",keys:["definitionOfReady","definition_of_ready"],option:"--definition-of-ready <value>",description:"Definition of ready (allow empty string)",aliasOptions:[{option:"--definition_of_ready <value>",description:"Alias for --definition-of-ready"}]},{target:"order",keys:["order"],option:"--order <value>",description:"Planning order/rank integer"},{target:"rank",keys:["rank"],option:"--rank <value>",description:"Alias for --order"},{target:"goal",keys:["goal"],option:"--goal <value>",description:"Goal identifier"},{target:"objective",keys:["objective"],option:"--objective <value>",description:"Objective identifier"},{target:"value",keys:["value"],option:"--value <value>",description:"Business value summary"},{target:"impact",keys:["impact"],option:"--impact <value>",description:"Business impact summary"},{target:"outcome",keys:["outcome"],option:"--outcome <value>",description:"Expected outcome summary"},{target:"whyNow",keys:["whyNow","why_now"],option:"--why-now <value>",description:"Why-now rationale",aliasOptions:[{option:"--why_now <value>",description:"Alias for --why-now"}]},{target:"author",keys:["author"],option:"--author <value>",description:"Mutation author"},{target:"message",keys:["message"],option:"--message <value>",description:"History message (allow empty string)"},{target:"assignee",keys:["assignee"],option:"--assignee <value>",description:"Item assignee"},{target:"parent",keys:["parent"],option:"--parent <value>",description:"Parent item ID"},{target:"allowMissingParent",keys:["allowMissingParent","allow_missing_parent"],option:"--allow-missing-parent",description:"Allow creating with an unresolved parent reference and emit a validation warning"},{target:"allowUnresolvedDeps",keys:["allowUnresolvedDeps","allow_unresolved_deps"],option:"--allow-unresolved-deps",description:"Allow unresolved local dependency targets and emit explicit warning receipts"},{target:"reviewer",keys:["reviewer"],option:"--reviewer <value>",description:"Reviewer"},{target:"risk",keys:["risk"],option:"--risk <value>",description:"Risk level: low|med|medium|high|critical (med persists as medium)"},{target:"confidence",keys:["confidence"],option:"--confidence <value>",description:"Confidence level: 0..100|low|med|medium|high (med persists as medium)"},{target:"sprint",keys:["sprint"],option:"--sprint <value>",description:"Sprint identifier"},{target:"release",keys:["release"],option:"--release <value>",description:"Release identifier"},{target:"blockedBy",keys:["blockedBy","blocked_by"],option:"--blocked-by <value>",description:"Set latest blocked-by item ID or reason; resolved item IDs append a blocked_by dependency edge",aliasOptions:[{option:"--blocked_by <value>",description:"Alias for --blocked-by"}]},{target:"blockedReason",keys:["blockedReason","blocked_reason"],option:"--blocked-reason <value>",description:"Blocked reason",aliasOptions:[{option:"--blocked_reason <value>",description:"Alias for --blocked-reason"}]},{target:"unblockNote",keys:["unblockNote","unblock_note"],option:"--unblock-note <value>",description:"Unblock rationale note",aliasOptions:[{option:"--unblock_note <value>",description:"Alias for --unblock-note"}]},{target:"reporter",keys:["reporter"],option:"--reporter <value>",description:"Issue reporter"},{target:"severity",keys:["severity"],option:"--severity <value>",description:"Issue severity: low|med|medium|high|critical (med persists as medium)"},{target:"environment",keys:["environment"],option:"--environment <value>",description:"Issue environment context"},{target:"reproSteps",keys:["reproSteps","repro_steps"],option:"--repro-steps <value>",description:"Issue reproduction steps",aliasOptions:[{option:"--repro_steps <value>",description:"Alias for --repro-steps"}]},{target:"resolution",keys:["resolution"],option:"--resolution <value>",description:"Issue resolution summary"},{target:"expectedResult",keys:["expectedResult","expected_result","expected"],option:"--expected-result <value>",description:"Issue expected behavior",aliasOptions:[{option:"--expected_result <value>",description:"Alias for --expected-result"},{option:"--expected <value>",description:"Short alias for --expected-result"}]},{target:"actualResult",keys:["actualResult","actual_result","actual"],option:"--actual-result <value>",description:"Issue observed behavior",aliasOptions:[{option:"--actual_result <value>",description:"Alias for --actual-result"},{option:"--actual <value>",description:"Short alias for --actual-result"}]},{target:"affectedVersion",keys:["affectedVersion","affected_version"],option:"--affected-version <value>",description:"Affected version identifier",aliasOptions:[{option:"--affected_version <value>",description:"Alias for --affected-version"}]},{target:"fixedVersion",keys:["fixedVersion","fixed_version"],option:"--fixed-version <value>",description:"Fixed version identifier",aliasOptions:[{option:"--fixed_version <value>",description:"Alias for --fixed-version"}]},{target:"component",keys:["component"],option:"--component <value>",description:"Issue component ownership"},{target:"regression",keys:["regression"],option:"--regression [value]",description:"Regression marker; bare flag means true, or pass true|false|1|0"},{target:"customerImpact",keys:["customerImpact","customer_impact"],option:"--customer-impact <value>",description:"Customer impact summary",aliasOptions:[{option:"--customer_impact <value>",description:"Alias for --customer-impact"}]},{target:"dep",keys:["dep"],option:"--dep <value>",description:"Seed dependency entry (key=value CSV, markdown key:value lines, or - for stdin; repeatable)",repeatable:!0},{target:"typeOption",keys:["typeOption","type_option"],option:"--type-option <value>",description:"Type option key=value or key=<name>,value=<value> (also accepts key:value and markdown pairs; use - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--type_option <value>",description:"Alias for --type-option"}]},{target:"field",keys:["field"],option:"--field <name=value>",description:"Set a field declared by an active extension registerItemFields registration (repeatable)",repeatable:!0},{target:"unset",keys:["unset"],option:"--unset <field>",description:"Clear scalar metadata field by name (repeatable)",repeatable:!0},{target:"reminder",keys:["reminder"],option:"--reminder <value>",description:"Seed reminder entry at=<iso|relative>,text=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"event",keys:["event"],option:"--event <value>",description:"Seed event entry start=<iso|relative>,end=<iso|relative>,duration=<relative|30min|PT30M>,title=<text>,all_day=<true|false>,recur_* fields (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"comment",keys:["comment"],option:"--comment <value>",description:"Seed comment entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"note",keys:["note"],option:"--note <value>",description:"Seed note entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"learning",keys:["learning"],option:"--learning <value>",description:"Seed learning entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"file",keys:["file","linkedFile"],option:"--file <value>",description:"Seed linked file entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--linked-file <value>",description:"Alias for --file (cross-surface name)"}]},{target:"test",keys:["test","linkedTest"],option:"--test <value>",description:"Seed linked test entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--linked-test <value>",description:"Alias for --test (cross-surface name)"}]},{target:"doc",keys:["doc"],option:"--doc <value>",description:"Seed linked doc entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0}],Lw=Qu.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),Mw=Qu.filter(e=>e.repeatable===!0).map(e=>({target:e.target,keys:e.keys})),ef=[{target:"title",keys:["title"],option:"--title, -t <value>",description:"Set title"},{target:"description",keys:["description"],option:"--description, -d <value>",description:"Set description"},{target:"body",keys:["body"],option:"--body, -b <value>",description:"Set body (allow empty string)"},{target:"status",keys:["status"],option:"--status, -s <value>",description:"Set status (use close command for closed)"},{target:"closeReason",keys:["closeReason","close_reason"],option:"--close-reason <value>",description:"Set close reason",aliasOptions:[{option:"--close_reason <value>",description:"Alias for --close-reason"}]},{target:"priority",keys:["priority"],option:"--priority, -p <value>",description:"Set priority"},{target:"type",keys:["type"],option:"--type <value>",description:"Set type"},{target:"tags",keys:["tags"],option:"--tags <value>",description:"Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively."},{target:"addTags",keys:["addTags","add_tags"],option:"--add-tags <value>",description:"Add tags to the existing list without replacing it (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--add_tags <value>",description:"Alias for --add-tags"}]},{target:"removeTags",keys:["removeTags","remove_tags"],option:"--remove-tags <value>",description:"Remove tags from the existing list (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--remove_tags <value>",description:"Alias for --remove-tags"}]},{target:"deadline",keys:["deadline"],option:"--deadline <value>",description:"Set deadline (ISO/date string or relative)"},{target:"estimatedMinutes",keys:["estimate","estimatedMinutes","estimated_minutes"],option:"--estimate, --estimated-minutes <value>",description:"Set estimated minutes",aliasOptions:[{option:"--estimated_minutes <value>",description:"Alias for --estimated-minutes"}]},{target:"acceptanceCriteria",keys:["acceptanceCriteria","acceptance_criteria","ac"],option:"--acceptance-criteria <value>",description:"Replace the complete acceptance-criteria list (repeatable values join with '; '); use --remove-ac plus --add-ac for one-entry repair",repeatable:!0,aliasOptions:[{option:"--acceptance_criteria <value>",description:"Alias for --acceptance-criteria"},{option:"--ac <value>",description:"Alias for --acceptance-criteria"}]},{target:"addAc",keys:["addAc","add_ac"],option:"--add-ac <value>",description:"Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",repeatable:!0,aliasOptions:[{option:"--add_ac <value>",description:"Alias for --add-ac"}]},{target:"removeAc",keys:["removeAc","remove_ac"],option:"--remove-ac <value>",description:"Remove one semicolon-free acceptance criterion by exact text match; fails if any selector is unmatched (repeatable)",repeatable:!0,aliasOptions:[{option:"--remove_ac <value>",description:"Alias for --remove-ac"}]},{target:"definitionOfReady",keys:["definitionOfReady","definition_of_ready"],option:"--definition-of-ready <value>",description:"Set definition of ready",aliasOptions:[{option:"--definition_of_ready <value>",description:"Alias for --definition-of-ready"}]},{target:"order",keys:["order"],option:"--order <value>",description:"Set planning order/rank integer"},{target:"rank",keys:["rank"],option:"--rank <value>",description:"Alias for --order"},{target:"goal",keys:["goal"],option:"--goal <value>",description:"Set goal identifier"},{target:"objective",keys:["objective"],option:"--objective <value>",description:"Set objective identifier"},{target:"value",keys:["value"],option:"--value <value>",description:"Set business value summary"},{target:"impact",keys:["impact"],option:"--impact <value>",description:"Set business impact summary"},{target:"outcome",keys:["outcome"],option:"--outcome <value>",description:"Set expected outcome summary"},{target:"whyNow",keys:["whyNow","why_now"],option:"--why-now <value>",description:"Set why-now rationale",aliasOptions:[{option:"--why_now <value>",description:"Alias for --why-now"}]},{target:"author",keys:["author"],option:"--author <value>",description:"Mutation author"},{target:"message",keys:["message"],option:"--message <value>",description:"Mutation message"},{target:"assignee",keys:["assignee"],option:"--assignee <value>",description:"Set assignee"},{target:"parent",keys:["parent"],option:"--parent <value>",description:"Set parent item ID"},{target:"allowMissingParent",keys:["allowMissingParent","allow_missing_parent"],option:"--allow-missing-parent",description:"Allow updating to an unresolved parent reference and emit a validation warning"},{target:"allowUnresolvedDeps",keys:["allowUnresolvedDeps","allow_unresolved_deps"],option:"--allow-unresolved-deps",description:"Allow unresolved local dependency targets and emit explicit warning receipts"},{target:"completedAt",keys:["completedAt","completed_at"],option:"--completed-at <value>",description:"Correct the actual completion timestamp on a terminal item"},{target:"reviewer",keys:["reviewer"],option:"--reviewer <value>",description:"Set reviewer"},{target:"risk",keys:["risk"],option:"--risk <value>",description:"Set risk level: low|med|medium|high|critical (med persists as medium)"},{target:"confidence",keys:["confidence"],option:"--confidence <value>",description:"Set confidence level: 0..100|low|med|medium|high (med persists as medium)"},{target:"sprint",keys:["sprint"],option:"--sprint <value>",description:"Set sprint identifier"},{target:"release",keys:["release"],option:"--release <value>",description:"Set release identifier"},{target:"blockedBy",keys:["blockedBy","blocked_by"],option:"--blocked-by <value>",description:"Set latest blocked-by item ID or reason; resolved item IDs append a blocked_by dependency edge",aliasOptions:[{option:"--blocked_by <value>",description:"Alias for --blocked-by"}]},{target:"blockedReason",keys:["blockedReason","blocked_reason"],option:"--blocked-reason <value>",description:"Set blocked reason",aliasOptions:[{option:"--blocked_reason <value>",description:"Alias for --blocked-reason"}]},{target:"unblockNote",keys:["unblockNote","unblock_note"],option:"--unblock-note <value>",description:"Set unblock rationale note",aliasOptions:[{option:"--unblock_note <value>",description:"Alias for --unblock-note"}]},{target:"reporter",keys:["reporter"],option:"--reporter <value>",description:"Set issue reporter"},{target:"severity",keys:["severity"],option:"--severity <value>",description:"Set issue severity: low|med|medium|high|critical (med persists as medium)"},{target:"environment",keys:["environment"],option:"--environment <value>",description:"Set issue environment context"},{target:"reproSteps",keys:["reproSteps","repro_steps"],option:"--repro-steps <value>",description:"Set issue reproduction steps",aliasOptions:[{option:"--repro_steps <value>",description:"Alias for --repro-steps"}]},{target:"resolution",keys:["resolution"],option:"--resolution <value>",description:"Set issue resolution summary"},{target:"expectedResult",keys:["expectedResult","expected_result","expected"],option:"--expected-result <value>",description:"Set issue expected behavior",aliasOptions:[{option:"--expected_result <value>",description:"Alias for --expected-result"},{option:"--expected <value>",description:"Short alias for --expected-result"}]},{target:"actualResult",keys:["actualResult","actual_result","actual"],option:"--actual-result <value>",description:"Set issue observed behavior",aliasOptions:[{option:"--actual_result <value>",description:"Alias for --actual-result"},{option:"--actual <value>",description:"Short alias for --actual-result"}]},{target:"affectedVersion",keys:["affectedVersion","affected_version"],option:"--affected-version <value>",description:"Set affected version identifier",aliasOptions:[{option:"--affected_version <value>",description:"Alias for --affected-version"}]},{target:"fixedVersion",keys:["fixedVersion","fixed_version"],option:"--fixed-version <value>",description:"Set fixed version identifier",aliasOptions:[{option:"--fixed_version <value>",description:"Alias for --fixed-version"}]},{target:"component",keys:["component"],option:"--component <value>",description:"Set issue component ownership"},{target:"regression",keys:["regression"],option:"--regression [value]",description:"Set regression marker; bare flag means true, or pass true|false|1|0"},{target:"customerImpact",keys:["customerImpact","customer_impact"],option:"--customer-impact <value>",description:"Set customer impact summary",aliasOptions:[{option:"--customer_impact <value>",description:"Alias for --customer-impact"}]},{target:"dep",keys:["dep"],option:"--dep <value>",description:"Add dependency entries id=<id>,kind=<value>,author=<value>,created_at=<iso|now>,source_kind=<value> (repeatable)",repeatable:!0},{target:"depRemove",keys:["depRemove","dep_remove"],option:"--dep-remove <value>",description:"Remove by dependency id or exact row signature (repeatable)",repeatable:!0,aliasOptions:[{option:"--dep_remove <value>",description:"Alias for --dep-remove"}]},{target:"comment",keys:["comment"],option:"--comment <value>",description:"Append comment seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"note",keys:["note"],option:"--note <value>",description:"Append note seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"learning",keys:["learning"],option:"--learning <value>",description:"Append learning seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"file",keys:["file","linkedFile"],option:"--file <value>",description:"Append linked file path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--linked-file <value>",description:"Alias for --file (cross-surface name)"}]},{target:"test",keys:["test","linkedTest"],option:"--test <value>",description:"Append linked test command=<value>,path=<value>,scope=<project|global>,timeout_seconds=<n>,pm_context_mode=<schema|tracker|auto> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--linked-test <value>",description:"Alias for --test (cross-surface name)"}]},{target:"doc",keys:["doc"],option:"--doc <value>",description:"Append linked doc path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"reminder",keys:["reminder"],option:"--reminder <value>",description:"Set reminders at=<iso|relative>,text=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"event",keys:["event"],option:"--event <value>",description:"Set events start=<iso|relative>,end=<iso|relative>,duration=<relative|30min|PT30M>,title=<text>,all_day=<true|false>,recur_* fields (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"typeOption",keys:["typeOption","type_option"],option:"--type-option <value>",description:"Set type options key=value or key=<name>,value=<value> (also accepts key:value and markdown pairs; use - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--type_option <value>",description:"Alias for --type-option"}]},{target:"field",keys:["field"],option:"--field <name=value>",description:"Set a field declared by an active extension registerItemFields registration (repeatable)",repeatable:!0},{target:"unset",keys:["unset"],option:"--unset <field>",description:"Clear scalar metadata field by name (repeatable)",repeatable:!0}],tf=ef.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),$w=ef.filter(e=>e.repeatable===!0).map(e=>({target:e.target,keys:e.keys}));(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]="35c88fec-b8c2-5478-b9a6-ecaebb736b2e")}catch{}})();function Ce(e){return e.map(t=>({...t}))}var nf=[{param:"status",flag:"--status"},{param:"type",flag:"--type"},{param:"tag",flag:"--tag"},{param:"priority",flag:"--priority"},{param:"deadlineBefore",flag:"--deadline-before"},{param:"deadlineAfter",flag:"--deadline-after"}],Fw=[{param:"updatedAfter",flag:"--updated-after"},{param:"updatedBefore",flag:"--updated-before"},{param:"createdAfter",flag:"--created-after"},{param:"createdBefore",flag:"--created-before"}],qM=[{param:"today",flag:"--today",booleanish:!0},{param:"recent",flag:"--recent",booleanish:!0},...Fw],jw=[{param:"assignee",flag:"--assignee"},{param:"assigneeFilter",flag:"--assignee-filter"},{param:"parent",flag:"--parent"},{param:"sprint",flag:"--sprint"},{param:"release",flag:"--release"}],BM=[{param:"assignee",flag:"--assignee"},{param:"sprint",flag:"--sprint"},{param:"release",flag:"--release"},{param:"parent",flag:"--parent"}],GM=[...nf,...jw],Uw=[{param:"filterReviewerMissing",flag:"--filter-reviewer-missing"},{param:"filterRiskMissing",flag:"--filter-risk-missing"},{param:"filterConfidenceMissing",flag:"--filter-confidence-missing"},{param:"filterSprintMissing",flag:"--filter-sprint-missing"},{param:"filterReleaseMissing",flag:"--filter-release-missing"}],WM=[{param:"filterAcMissing",flag:"--filter-ac-missing"},{param:"filterEstimatesMissing",flag:"--filter-estimates-missing"},{param:"filterResolutionMissing",flag:"--filter-resolution-missing"},{param:"filterMetadataMissing",flag:"--filter-metadata-missing"}],zw=[{param:"hasNotes",flag:"--has-notes"},{param:"noNotes",flag:"--no-notes"},{param:"hasLearnings",flag:"--has-learnings"},{param:"noLearnings",flag:"--no-learnings"},{param:"hasFiles",flag:"--has-files"},{param:"noFiles",flag:"--no-files"},{param:"filterFilesMissing",flag:"--filter-files-missing"},{param:"hasDocs",flag:"--has-docs"},{param:"noDocs",flag:"--no-docs"},{param:"filterDocsMissing",flag:"--filter-docs-missing"},{param:"hasTests",flag:"--has-tests"},{param:"noTests",flag:"--no-tests"},{param:"hasComments",flag:"--has-comments"},{param:"noComments",flag:"--no-comments"},{param:"hasDeps",flag:"--has-deps"},{param:"noDeps",flag:"--no-deps"},{param:"hasBody",flag:"--has-body"},{param:"emptyBody",flag:"--empty-body"},{param:"hasLinkedCommand",flag:"--has-linked-command"},{param:"noLinkedCommand",flag:"--no-linked-command"}],rf=[{param:"for",flag:"--for"},{param:"tokenBudget",flag:"--token-budget"},...Ce(nf),...Ce(qM),{param:"ids",flag:"--ids"},...Ce(jw),...Ce(WM),...Ce(Uw),...Ce(zw),{param:"limit",flag:"--limit"},{param:"offset",flag:"--offset"},{param:"after",flag:"--after"},{param:"fields",flag:"--fields"},{param:"sort",flag:"--sort"},{param:"order",flag:"--order"},{param:"tree",flag:"--tree"},{param:"treeDepth",flag:"--tree-depth"}],of=[{param:"groupBy",flag:"--group-by"},{param:"setMode",flag:"--set-mode"},{param:"limit",flag:"--limit"},{param:"after",flag:"--after"},{param:"sum",flag:"--sum"},{param:"avg",flag:"--avg"},...Ce(GM)],sf=[{param:"for",flag:"--for"},{param:"tokenBudget",flag:"--token-budget"},{param:"matchMode",flag:"--match-mode"},{param:"minScore",flag:"--min-score"},{param:"count",flag:"--count",booleanish:!0},{param:"semanticWeight",flag:"--semantic-weight"},...Ce(nf),...Ce(Fw),...Ce(BM),...Ce(Uw),...Ce(zw),{param:"fields",flag:"--fields"},{param:"limit",flag:"--limit"},{param:"after",flag:"--after"}],Hw=[{param:"parent",flag:"--parent"},{param:"reviewer",flag:"--reviewer"},{param:"risk",flag:"--risk"},{param:"confidence",flag:"--confidence"},{param:"sprint",flag:"--sprint"},{param:"release",flag:"--release"},{param:"blockedBy",flag:"--blocked-by"},{param:"blockedReason",flag:"--blocked-reason"},{param:"unblockNote",flag:"--unblock-note"},{param:"reporter",flag:"--reporter"},{param:"severity",flag:"--severity"},{param:"environment",flag:"--environment"},{param:"reproSteps",flag:"--repro-steps"},{param:"resolution",flag:"--resolution"},{param:"expectedResult",flag:"--expected-result"},{param:"actualResult",flag:"--actual-result"},{param:"affectedVersion",flag:"--affected-version"},{param:"fixedVersion",flag:"--fixed-version"},{param:"component",flag:"--component"},{param:"regression",flag:"--regression",booleanish:!0},{param:"customerImpact",flag:"--customer-impact"},{param:"definitionOfReady",flag:"--definition-of-ready",allowEmpty:!0},{param:"order",flag:"--order"},{param:"rank",flag:"--rank"},{param:"goal",flag:"--goal"},{param:"objective",flag:"--objective"},{param:"value",flag:"--value"},{param:"impact",flag:"--impact"},{param:"outcome",flag:"--outcome"},{param:"whyNow",flag:"--why-now"}],qa=Ce(Hw),qw=[{param:"id",flag:"--id"},{param:"title",flag:"--title"},{param:"description",flag:"--description",allowEmpty:!0},{param:"type",flag:"--type"},{param:"template",flag:"--template"},{param:"createMode",flag:"--create-mode"},{param:"schedulePreset",flag:"--schedule-preset"},{param:"status",flag:"--status"},{param:"priority",flag:"--priority"},{param:"tags",flag:"--tags",allowEmpty:!0},{param:"addTags",flag:"--add-tags",repeatable:!0},{param:"body",flag:"--body",allowEmpty:!0},{param:"deadline",flag:"--deadline"},{param:"estimate",flag:"--estimate"},{param:"acceptanceCriteria",flag:"--acceptance-criteria",allowEmpty:!0},{param:"author",flag:"--author"},{param:"message",flag:"--message",allowEmpty:!0},{param:"assignee",flag:"--assignee"},{param:"allowMissingParent",flag:"--allow-missing-parent"},{param:"allowUnresolvedDeps",flag:"--allow-unresolved-deps"},{param:"allowDuplicate",flag:"--allow-duplicate",booleanish:!0},{param:"reminder",flag:"--reminder",repeatable:!0},{param:"event",flag:"--event",repeatable:!0},{param:"typeOption",flag:"--type-option",repeatable:!0},{param:"field",flag:"--field",repeatable:!0},{param:"dep",flag:"--dep",repeatable:!0},{param:"comment",flag:"--comment",repeatable:!0},{param:"note",flag:"--note",repeatable:!0},{param:"learning",flag:"--learning",repeatable:!0},{param:"linkedFile",flag:"--file",repeatable:!0},{param:"linkedTest",flag:"--test",repeatable:!0},{param:"doc",flag:"--doc",repeatable:!0},{param:"unset",flag:"--unset",repeatable:!0},{param:"clearDeps",flag:"--clear-deps"},{param:"clearComments",flag:"--clear-comments"},{param:"clearNotes",flag:"--clear-notes"},{param:"clearLearnings",flag:"--clear-learnings"},{param:"clearFiles",flag:"--clear-files"},{param:"clearTests",flag:"--clear-tests"},{param:"clearDocs",flag:"--clear-docs"},{param:"clearReminders",flag:"--clear-reminders"},{param:"clearEvents",flag:"--clear-events"},{param:"clearTypeOptions",flag:"--clear-type-options"}],af=Ce(qw),Bw=[{param:"title",flag:"--title"},{param:"description",flag:"--description",allowEmpty:!0},{param:"body",flag:"--body",allowEmpty:!0},{param:"status",flag:"--status"},{param:"closeReason",flag:"--close-reason"},{param:"completedAt",flag:"--completed-at"},{param:"priority",flag:"--priority"},{param:"type",flag:"--type"},{param:"tags",flag:"--tags",allowEmpty:!0},{param:"addTags",flag:"--add-tags",repeatable:!0},{param:"removeTags",flag:"--remove-tags",repeatable:!0},{param:"deadline",flag:"--deadline"},{param:"estimate",flag:"--estimate"},{param:"acceptanceCriteria",flag:"--acceptance-criteria",allowEmpty:!0},{param:"addAc",flag:"--add-ac",repeatable:!0},{param:"removeAc",flag:"--remove-ac",repeatable:!0},{param:"author",flag:"--author"},{param:"message",flag:"--message",allowEmpty:!0},{param:"assignee",flag:"--assignee"},{param:"allowMissingParent",flag:"--allow-missing-parent"},{param:"allowUnresolvedDeps",flag:"--allow-unresolved-deps"},{param:"dep",flag:"--dep",repeatable:!0},{param:"depRemove",flag:"--dep-remove",repeatable:!0},{param:"replaceDeps",flag:"--replace-deps"},{param:"replaceTests",flag:"--replace-tests"},{param:"replaceFiles",flag:"--replace-files"},{param:"replaceDocs",flag:"--replace-docs"},{param:"comment",flag:"--comment",repeatable:!0},{param:"note",flag:"--note",repeatable:!0},{param:"learning",flag:"--learning",repeatable:!0},{param:"linkedFile",flag:"--file",repeatable:!0},{param:"linkedTest",flag:"--test",repeatable:!0},{param:"doc",flag:"--doc",repeatable:!0},{param:"reminder",flag:"--reminder",repeatable:!0},{param:"event",flag:"--event",repeatable:!0},{param:"typeOption",flag:"--type-option",repeatable:!0},{param:"field",flag:"--field",repeatable:!0},{param:"unset",flag:"--unset",repeatable:!0},{param:"clearDeps",flag:"--clear-deps"},{param:"clearComments",flag:"--clear-comments"},{param:"clearNotes",flag:"--clear-notes"},{param:"clearLearnings",flag:"--clear-learnings"},{param:"clearFiles",flag:"--clear-files"},{param:"clearTests",flag:"--clear-tests"},{param:"clearDocs",flag:"--clear-docs"},{param:"clearReminders",flag:"--clear-reminders"},{param:"clearEvents",flag:"--clear-events"},{param:"clearTypeOptions",flag:"--clear-type-options"}],cf=Ce(Bw),lf=[{param:"filterStatus",flag:"--filter-status"},{param:"filterType",flag:"--filter-type"},{param:"filterTag",flag:"--filter-tag"},{param:"filterPriority",flag:"--filter-priority"},{param:"filterDeadlineBefore",flag:"--filter-deadline-before"},{param:"filterDeadlineAfter",flag:"--filter-deadline-after"},{param:"filterUpdatedAfter",flag:"--filter-updated-after"},{param:"filterUpdatedBefore",flag:"--filter-updated-before"},{param:"filterCreatedAfter",flag:"--filter-created-after"},{param:"filterCreatedBefore",flag:"--filter-created-before"},{param:"filterAssignee",flag:"--filter-assignee"},{param:"filterAssigneeFilter",flag:"--filter-assignee-filter"},{param:"filterParent",flag:"--filter-parent"},{param:"filterSprint",flag:"--filter-sprint"},{param:"filterRelease",flag:"--filter-release"},{param:"filterAcMissing",flag:"--filter-ac-missing"},{param:"filterEstimatesMissing",flag:"--filter-estimates-missing"},{param:"filterResolutionMissing",flag:"--filter-resolution-missing"},{param:"filterMetadataMissing",flag:"--filter-metadata-missing"},{param:"filterReviewerMissing",flag:"--filter-reviewer-missing"},{param:"filterRiskMissing",flag:"--filter-risk-missing"},{param:"filterConfidenceMissing",flag:"--filter-confidence-missing"},{param:"filterSprintMissing",flag:"--filter-sprint-missing"},{param:"filterReleaseMissing",flag:"--filter-release-missing"},{param:"filterHasNotes",flag:"--filter-has-notes"},{param:"filterNoNotes",flag:"--filter-no-notes"},{param:"filterHasLearnings",flag:"--filter-has-learnings"},{param:"filterNoLearnings",flag:"--filter-no-learnings"},{param:"filterHasFiles",flag:"--filter-has-files"},{param:"filterNoFiles",flag:"--filter-no-files"},{param:"filterHasDocs",flag:"--filter-has-docs"},{param:"filterNoDocs",flag:"--filter-no-docs"},{param:"filterHasTests",flag:"--filter-has-tests"},{param:"filterNoTests",flag:"--filter-no-tests"},{param:"filterHasComments",flag:"--filter-has-comments"},{param:"filterNoComments",flag:"--filter-no-comments"},{param:"filterHasDeps",flag:"--filter-has-deps"},{param:"filterNoDeps",flag:"--filter-no-deps"},{param:"filterHasBody",flag:"--filter-has-body"},{param:"filterEmptyBody",flag:"--filter-empty-body"},{param:"filterHasLinkedCommand",flag:"--filter-has-linked-command"},{param:"filterNoLinkedCommand",flag:"--filter-no-linked-command"},{param:"ids",flag:"--ids"},{param:"limit",flag:"--limit"},{param:"offset",flag:"--offset"}],df=Ce(lf),uf=Ce(lf);var ff=[{param:"id",flag:"--id"},{param:"op",flag:"--op"},{param:"author",flag:"--author"},{param:"from",flag:"--from"},{param:"to",flag:"--to"},{param:"limit",flag:"--limit"},{param:"unbounded",flag:"--unbounded"},{param:"compact",flag:"--compact"},{param:"raw",flag:"--raw"},{param:"full",flag:"--full"},{param:"provenance",flag:"--provenance"},{param:"provenanceSummary",flag:"--provenance-summary"},{param:"harness",flag:"--harness",repeatable:!0},{param:"agentInstance",flag:"--agent-instance",repeatable:!0},{param:"provenanceFilter",flag:"--provenance-filter",repeatable:!0}],mf=[{param:"for",flag:"--for"},{param:"date",flag:"--date"},{param:"from",flag:"--from"},{param:"to",flag:"--to"},{param:"type",flag:"--type"},{param:"tag",flag:"--tag"},{param:"priority",flag:"--priority"},{param:"assignee",flag:"--assignee"},{param:"assigneeFilter",flag:"--assignee-filter"},{param:"sprint",flag:"--sprint"},{param:"release",flag:"--release"},{param:"parent",flag:"--parent"},{param:"limit",flag:"--limit"},{param:"after",flag:"--after"},{param:"format",flag:"--format"},{param:"depth",flag:"--depth"},{param:"fields",flag:"--fields"},{param:"section",flag:"--section",repeatable:!0},{param:"activityLimit",flag:"--activity-limit"},{param:"staleThreshold",flag:"--stale-threshold"},{param:"tokenBudget",flag:"--token-budget"},{param:"explainRanking",flag:"--explain-ranking"},{param:"noTags",flag:"--no-tags"},{param:"noExtensionHealth",flag:"--no-extension-health"}];(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]="733ce7b1-de7b-53b9-83bb-deefd930d8ec")}catch{}})();var KM=["item","list","context","search","graph","history","workspace","package","ops","plan","contracts","help"];function T(e,t,n,r={}){return{name:e,required:n,variadic:r.variadic===!0,value_kind:t,polymorphic:r.polymorphic===!0}}function Gw(e){let t=e.replaceAll("-"," ");return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}var te=T("id","item_id",!0),Ai=T("id","item_id",!1),Ii=T("text","string",!1),Ci=T("plan-id","item_id",!0),Ww=T("step","string",!0),YM=["--acceptance-criteria","--actual-result","--affected-version","--assignee","--blocked-by","--blocked-reason","--blocks","--body","--claim","--comment","--component","--confidence","--create-mode","--customer-impact","--deadline","--definition-of-ready","--description","--doc","--environment","--estimate","--event","--expected-result","--fixed-version","--file","--from-search","--goal","--harness","--impact","--learning","--message","--mode","--note","--objective","--order","--outcome","--parent","--priority","--rank","--related","--release","--reminder","--reporter","--repro-steps","--resolution","--resume-context","--reviewer","--risk","--scope","--severity","--sprint","--status","--step","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-replacement","--step-status","--step-title","--tags","--template","--test","--title","--type-option","--unblock-note","--value","--why-now"],pf=["--allow-multiple-active","--depends-on","--file","--force","--message","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-status","--step-title","--test"],JM={"update-step":"Update one declared Plan step.","complete-step":"Complete one declared Plan step.","block-step":"Block one declared Plan step.","remove-step":"Remove one declared Plan step.",link:"Link one dependency to a declared Plan step.",unlink:"Unlink one dependency from a declared Plan step."},no=[{command:"plan create",parent:"plan",action:"create",slots:[T("title","string",!1,{polymorphic:!0})],accepted_flags:YM,description:"Create a Plan item and optionally seed its ordered steps.",example:'pm plan create --title "Refactor lock retry"'},{command:"plan show",parent:"plan",action:"show",slots:[Ci],accepted_flags:["--depth","--fields"],description:"Read one Plan item with a bounded plan projection.",example:"pm plan show pm-a1b2 --depth standard"},{command:"plan add-step",parent:"plan",action:"add-step",slots:[Ci],accepted_flags:pf,description:"Append one ordered step to a Plan item.",example:'pm plan add-step pm-a1b2 --step-title "Run tests"'},...Object.entries(JM).map(([e,t])=>({command:`plan ${e}`,parent:"plan",action:e,slots:[Ci,Ww],accepted_flags:pf,description:t,example:`pm plan ${e} pm-a1b2 plan-step-001`})),{command:"plan reorder-step",parent:"plan",action:"reorder-step",slots:[Ci,Ww,T("new-order","integer",!0)],accepted_flags:["--force","--message"],description:"Move one Plan step to a declared integer order.",example:"pm plan reorder-step pm-a1b2 plan-step-001 2"},...["decision","discovery","validation","resume","approve","materialize"].map(e=>({command:`plan ${e}`,parent:"plan",action:e,slots:[Ci],accepted_flags:pf,description:`${Gw(e)} for one Plan item.`,example:`pm plan ${e} pm-a1b2`})),...["list","show","put","remove"].map(e=>({command:`assurance ${e}`,parent:"assurance",action:e,slots:[T("kind","string",!0),...e==="list"?[]:[T("id","string",!0)]],accepted_flags:e==="put"?["--author","--definition","--message"]:e==="remove"?["--author","--message"]:[],description:`${Gw(e)} assurance declarations by kind.`,example:e==="list"?"pm assurance list measurement":`pm assurance ${e} measurement example-id`})),{command:"assurance run",parent:"assurance",action:"run",slots:[T("gate-id","string",!0)],accepted_flags:["--dry-run","--trigger","--tree"],description:"Evaluate one assurance gate for a lifecycle trigger.",example:"pm assurance run tracker-context-quality --trigger ci --dry-run"},{command:"assurance verdicts",parent:"assurance",action:"verdicts",slots:[T("gate-id","string",!1)],accepted_flags:["--gate","--limit"],description:"List bounded assurance verdict history.",example:"pm assurance verdicts --limit 20"},...["presets","apply"].map(e=>({command:`assurance ${e}`,parent:"assurance",action:e,slots:[T("preset","string",e==="apply")],accepted_flags:["--author","--message","--owner"],description:e==="apply"?"Apply one assurance adoption preset.":"List available assurance adoption presets.",example:e==="apply"?"pm assurance apply software-delivery --owner <pm-item-id>":"pm assurance presets"})),{command:"assurance derive",parent:"assurance",action:"derive",slots:[],accepted_flags:["--apply","--author","--message","--owner"],description:"Derive assurance proposals from current project context.",example:"pm assurance derive --owner pm-a1b2"},{command:"assurance promote",parent:"assurance",action:"promote",slots:[T("assertion-id","string",!0)],accepted_flags:["--author","--enforcement","--message"],description:"Promote one assertion into a warning or blocking gate.",example:"pm assurance promote assertion-id --enforcement warn"},{command:"assurance risk",parent:"assurance",action:"risk",slots:[],accepted_flags:["--definition"],description:"Analyze bounded defect-recurrence risk for a proposed change.",example:`pm assurance risk --definition '{"change":{"files":[]}}'`},{command:"assurance lineages",parent:"assurance",action:"lineages",slots:[],accepted_flags:["--definition"],description:"Measure all recorded recurrence lineages with bounded evidence rows.",example:`pm assurance lineages --definition '{"policy":{"version":1,"evidence_epoch":"2026-01-01T00:00:00.000Z","families":[]}}'`},{command:"workspace position",parent:"workspace",action:"position",slots:[],accepted_flags:[],description:"Read bounded merge-fence, receipt, history-drift, and next-action readiness.",example:"pm workspace position"},{command:"workspace snapshot create",parent:"workspace snapshot",action:"create",slots:[T("name","string",!1)],accepted_flags:[],description:"Capture authoritative tracker state as an immutable snapshot.",example:"pm workspace snapshot create before-migration"},{command:"workspace snapshot list",parent:"workspace snapshot",action:"list",slots:[],accepted_flags:[],description:"List immutable workspace snapshots and named references.",example:"pm workspace snapshot list"},{command:"workspace snapshot inspect",parent:"workspace snapshot",action:"inspect",slots:[T("target","string",!0)],accepted_flags:[],description:"Inspect one workspace snapshot target.",example:"pm workspace snapshot inspect before-migration"},{command:"workspace snapshot restore",parent:"workspace snapshot",action:"restore",slots:[T("target","string",!0)],accepted_flags:["--author","--dry-run","--force","--message"],description:"Restore an immutable workspace snapshot with explicit recovery controls.",example:"pm workspace snapshot restore before-migration --dry-run"},{command:"workspace snapshot delete",parent:"workspace snapshot",action:"delete",slots:[T("target","string",!0)],accepted_flags:[],description:"Delete one workspace snapshot target.",example:"pm workspace snapshot delete before-migration"}],XM=[...no].sort((e,t)=>t.command.length-e.command.length),ZM=new Map([["append",[te,Ii]],["assurance",[T("action","action",!0),T("kind","string",!1),T("id","string",!1)]],["beads import",[T("file","string",!1)]],["changelog export",[T("file","string",!1)]],["claim",[Ai]],["close",[te,Ii]],["close-task",[te,T("reason","string",!1)]],["comments",[te,Ii]],["completion",[T("shell","string",!1)]],["config",[T("scope","string",!1,{polymorphic:!0}),T("action","action",!1),T("key","string",!1),T("value","string",!1,{polymorphic:!0})]],["copy",[te]],["create",[T("type-or-title","string",!1,{polymorphic:!0}),T("title","string",!1)]],["delete",[te]],["deps",[te]],["docs",[te]],["event",[T("title","string",!0)]],["files",[te]],["files discover",[te]],["files lookup",[T("paths","string",!0,{variadic:!0})]],["focus",[Ai]],["get",[te]],["graph",[T("subcommand","action",!0),Ai,T("target","item_id",!1)]],["guide",[T("topic","string",!1)]],["history",[te]],["history-compact",[Ai]],["history-redact",[te]],["history-repair",[Ai]],["init",[T("prefix-or-path","string",!1,{polymorphic:!0})]],["item complete",[te,T("reason","string",!1)]],["item reopen",[te,T("reason","string",!0)]],["learnings",[te,Ii]],["meet",[T("title","string",!0)]],["merge",[T("subcommand","action",!0),T("artifact","string",!1),T("base","string",!1),T("ours","string",!1),T("theirs","string",!1)]],["notes",[te,Ii]],["package",[T("target","string",!1,{polymorphic:!0})]],["package list",[]],["package scaffold",[T("target","string",!0)]],["package upgrade",[T("target","string",!1)]],["packages",[T("target","string",!1,{polymorphic:!0})]],["packages list",[]],["packages scaffold",[T("target","string",!0)]],["packages upgrade",[T("target","string",!1)]],["pause-task",[te]],["plan",[T("subcommand","action",!0),T("id","item_id",!1,{polymorphic:!0}),T("step","string",!1),T("new-order","integer",!1)]],["profile",[T("subcommand","action",!0),T("name","string",!1)]],["release",[te]],["remind",[T("title","string",!0)]],["restore",[te,T("target","string",!0)]],["schema",[T("subcommand","action",!0),T("name","string",!1)]],["search-advanced",[T("keywords","string",!0,{variadic:!0})]],["search",[T("keywords","string",!0,{variadic:!0})]],["start-task",[te]],["telemetry",[T("namespace-or-subcommand","action",!1,{polymorphic:!0}),T("subcommand","action",!1)]],["test",[te]],["test-runs-worker",[T("runId","string",!0)]],["update",[te]],["workspace snapshot",[T("action","action",!0),T("target","string",!1)]],...["activate","adopt","deactivate","init","uninstall"].flatMap(e=>["extension","package","packages"].map(t=>[`${t} ${e}`,[T("target","string",!0)]])),...["describe"].flatMap(e=>["extension","package","packages"].map(t=>[`${t} ${e}`,[T("target","string",!1)]])),...["install"].flatMap(e=>["extension","package","packages"].map(t=>[`${t} ${e}`,[T("targets","string",!1,{variadic:!0})]])),["vcs abandon",[te]],["vcs create",[T("title","string",!0)]],["vcs merge",[te]],["vcs propose",[te]],["vcs ref-create",[T("name","string",!0)]],["vcs show",[te]]]);function QM(e){return e.trim().toLowerCase().replace(/\s+/gu," ")}function e$(e){let t=QM(e);return XM.find(n=>n.command===t||t.startsWith(`${n.command} `))}function F(e,t,n,r,o){return o.map(i=>({command:i,noun:e,target:t,disposition:n,owner:r}))}var t$=[...F("item","item","target_noun","pm-pbyu",["item","item complete","item mutate","item reopen"]),...F("item","item","consolidation","pm-yql1",["append","close-many","close-task","comments","copy","delete","deps","docs","files","learnings","notes","pause-task","start-task","test","update-many"]),...["claim","close","create","get","release","update"].map(e=>({command:e,noun:"item",target:e,disposition:"keep_as_is",owner:"pm-pbyu",reason:"Permanent high-frequency item operations retain concise root spellings under the accepted hot-path grammar policy."})),...F("item","item files","target_noun","pm-yql1",["files discover","files lookup","item files discover","item files lookup"]),...F("item","item test worker","consolidation","pm-lp4j",["test-runs-worker"]),...F("list","list","target_noun","pm-pfqi",["list"]),...F("list","list --group-by","consolidation","pm-xkgq",["aggregate"]),...F("context","context","target_noun","pm-pbyu",["context"]),...F("context","context","consolidation","pm-kcs4",["ctx","focus","next"]),...F("context","context next","consolidation","pm-kcs4",["ctx next"]),...F("context","context focus","consolidation","pm-kcs4",["ctx focus"]),...F("search","search","target_noun","pm-pbyu",["search"]),...F("search","search","package_owned","package:search-advanced",["reindex","search-advanced"]),...F("item","item duplicates","consolidation","pm-fmy9ih",["duplicates"]),...F("item","item duplicates","package_owned","pm-fmy9ih",["dedupe-audit","dedupe-merge","comments-audit"]),...F("graph","graph","target_noun","pm-pbyu",["graph"]),...F("history","history","target_noun","pm-pbyu",["history"]),...F("history","history attest","target_noun","pm-3z0k",["history attest"]),...F("history","history attest","consolidation","pm-3z0k",["history-attest"]),...Ws.flatMap(({alias:e,canonical:t})=>[...F("history",t,"target_noun","pm-tqel",[t]),...F("history",t,"consolidation","pm-tqel",[e])]),...F("history","history","consolidation","pm-tqel",["events","merge"]),...F("history","history acknowledge","consolidation","pm-djyvbk",["history-author-acknowledge"]),...F("history","history","package_owned","package:builtin-vcs-exemplar",["vcs abandon","vcs create","vcs log","vcs merge","vcs propose","vcs ref-create","vcs show"]),...F("workspace","workspace","target_noun","pm-pbyu",["workspace","workspace position","workspace snapshot","workspace snapshot create","workspace snapshot delete","workspace snapshot inspect","workspace snapshot list","workspace snapshot restore"]),...F("workspace","workspace init","consolidation","pm-npr3",["init"]),...F("package","package","target_noun","pm-pbyu",["package","package activate","package adopt","package adopt-all","package catalog","package deactivate","package describe","package doctor","package explore","package init","package install","package list","package manage","package migrate","package reload","package scaffold","package uninstall","package upgrade"]),...F("package","package","consolidation","pm-tnud",["extension activate","extension adopt","extension adopt-all","extension catalog","extension deactivate","extension describe","extension doctor","extension explore","extension init","extension install","extension manage","extension migrate","extension reload","extension uninstall","packages","packages activate","packages adopt","packages adopt-all","packages catalog","packages deactivate","packages describe","packages doctor","packages explore","packages init","packages install","packages list","packages manage","packages migrate","packages reload","packages scaffold","packages uninstall","packages upgrade"]),...F("package","package","package_owned","package:beads",["beads import"]),...F("package","package","package_owned","package:pm-changelog",["changelog export","changelog generate"]),...F("package","package calendar","package_owned","pm-o3fh",["event","meet","remind"]),...F("ops","ops","target_noun","pm-6apl",["ops"]),...F("ops","ops normalize","package_owned","package:pm-governance-audit",["normalize"]),...F("ops","ops","consolidation","pm-6apl",["eval","gc","health","stats","telemetry","test-all","validate"]),...F("ops","ops","consolidation","pm-npr3",["config","profile","schema"]),...["assurance",...no.filter(({parent:e})=>e==="assurance").map(({command:e})=>e)].map(e=>({command:e,noun:"ops",target:e,disposition:"keep_as_is",owner:"pm-djyvbk",reason:"Assurance manages durable measurement, assertion, gate, and verdict data; retain its established domain surface independently of operational diagnostics."})),...F("plan","plan","target_noun","pm-pbyu",["plan"]),...F("plan","plan","target_noun","pm-2tan",no.filter(({parent:e})=>e==="plan").map(({command:e})=>e)),...F("contracts","contracts","target_noun","pm-pbyu",["contracts"]),...F("help","help","target_noun","pm-pbyu",["help"]),...F("help","help","package_owned","package:builtin-guide-shell",["completion","completion-statuses","completion-tags","completion-types","guide"])].flatMap(e=>{let t=Vs.find(r=>r.alias===e.command);if(!t)return[e];let n=KM.find(r=>r===t.canonical_argv[0])??e.noun;return[{...e,noun:n,target:t.canonical,owner:t.owner},{...e,command:t.canonical,noun:n,target:t.canonical,owner:t.owner,disposition:e.disposition==="package_owned"?"package_owned":"target_noun"}]}),n$=[...new Set(t$.map(({command:e})=>e))].map(e=>({command:e,slots:e$(e)?.slots??ZM.get(Jt(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]="4e1e3ef4-cdf3-5d4c-88fe-d23f6fc171d1")}catch{}})();function _f(e){return[...new Set(Array.from(e,t=>t.trim()).filter(t=>t.length>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]="bfaa3455-3237-5c98-8ef4-b353ce9530fe")}catch{}})();var Oi=Object.freeze({rows:10,paths:5,samples:10,path_depth:8,visited_paths:1e4});(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]="4c3fb594-00bc-5625-aeaa-692e7ac01437")}catch{}})();var Vw=ml.map(e=>({flag:e.flag,reservation_scope:"inherited",...e.aliases?{aliases:[...e.aliases]}:{},...e.value_name?{value_name:e.value_name}:{}})),r$=[...Vw,{flag:"--version",value_type:"boolean",reservation_scope:"root_only"},{flag:"--all",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help to every command."},{flag:"--explain",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help with command guidance."}],Kw=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--has-notes"},{flag:"--no-notes"},{flag:"--has-learnings"},{flag:"--no-learnings"},{flag:"--has-files"},{flag:"--no-files"},{flag:"--filter-files-missing"},{flag:"--has-docs"},{flag:"--no-docs"},{flag:"--filter-docs-missing"},{flag:"--has-tests"},{flag:"--no-tests"},{flag:"--has-comments"},{flag:"--no-comments"},{flag:"--has-deps"},{flag:"--no-deps"},{flag:"--has-body"},{flag:"--empty-body"},{flag:"--has-linked-command"},{flag:"--no-linked-command"}],Yw=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--filter-has-notes"},{flag:"--filter-no-notes"},{flag:"--filter-has-learnings"},{flag:"--filter-no-learnings"},{flag:"--filter-has-files"},{flag:"--filter-no-files"},{flag:"--filter-has-docs"},{flag:"--filter-no-docs"},{flag:"--filter-has-tests"},{flag:"--filter-no-tests"},{flag:"--filter-has-comments"},{flag:"--filter-no-comments"},{flag:"--filter-has-deps"},{flag:"--filter-no-deps"},{flag:"--filter-has-body"},{flag:"--filter-empty-body"},{flag:"--filter-has-linked-command"},{flag:"--filter-no-linked-command"},{flag:"--ids",list:!0},{flag:"--limit"},{flag:"--offset"}],Ba=bf([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--status",list:!0},{flag:"--all",value_type:"boolean"},{flag:"--type",list:!0},{flag:"--tag",aliases:["--tags"],list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--today"},{flag:"--recent"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--ids",list:!0},{flag:"--assignee",list:!0},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:!0},{flag:"--release",list:!0},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...Kw,{flag:"--limit"},{flag:"--offset"},{flag:"--after"},{flag:"--no-truncate"},{flag:"--compact"},{flag:"--brief"},{flag:"--full"},{flag:"--fields",list:!0},{flag:"--sort"},{flag:"--order"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--include-body"},{flag:"--strict-read"},{flag:"--format"},{flag:"--stream"}],new Set(["--limit","--token-budget","--offset","--after","--no-truncate","--compact","--brief","--full","--fields","--include-body","--strict-read"])),Jw=[{flag:"--group-by",list:!0},{flag:"--set-mode"},{flag:"--limit"},{flag:"--after"},{flag:"--count"},{flag:"--completion"},{flag:"--sum"},{flag:"--avg"},{flag:"--include-unparented"},{flag:"--include_unparented"},{flag:"--status",list:!0},{flag:"--type",list:!0},{flag:"--tag",list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--assignee",list:!0},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:!0},{flag:"--release",list:!0}],Xw=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--comment","--body","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];function bf(e,t){return e.map(n=>t.has(n.flag)?{...n,cursor_semantics:"presentation"}:n)}var Zw=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--note","--text"]},{flag:"--add-json"},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--since"},{flag:"--event-type"},{flag:"--include-meta"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Qw=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--learning","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],eb=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--append-stable"},{flag:"--validate-paths"},{flag:"--scope"},{flag:"--limit"},{flag:"--offset"},{flag:"--no-truncate"},{flag:"--strict-read"},{flag:"--explain"},{flag:"--lines",value_name:"start:end"},{flag:"--decision-depth",value_name:"n",value_type:"number"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],tb=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--validate-paths"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],nb=[{flag:"--id",value_name:"item-id"},{flag:"--limit"},{flag:"--compact"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--diff"},{flag:"--field"},{flag:"--verify"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--format"}],rb=[{flag:"--dry-run"},{flag:"--message"},{flag:"--force"},{flag:"--include-reconciled"},{flag:"--output"},{flag:"--item-path"},{flag:"--prefer"}],ob=[{flag:"--id",value_name:"item-id"},{flag:"--literal"},{flag:"--regex"},{flag:"--replacement"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],ib=[{flag:"--id",value_name:"item-id"},{flag:"--all"},{flag:"--dry-run"},{flag:"--normalize-provenance"},{flag:"--salvage-tail",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],sb=[{flag:"--event",repeatable:!0},{flag:"--all-actionable"},{flag:"--dry-run"},{flag:"--plan-fingerprint"},{flag:"--limit",value_type:"number"},{flag:"--attributed-author",aliases:["--attributed_author"]},{flag:"--reviewer"},{flag:"--reason"}],ab=[{flag:"--id",value_name:"item-id"},{flag:"--before"},{flag:"--ids",list:!0},{flag:"--all-over",value_type:"number"},{flag:"--closed"},{flag:"--all-streams"},{flag:"--min-entries",value_type:"number"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],o$=[{flag:"--verify",value_name:"file",value_type:"string"},{flag:"--output",value_name:"file",value_type:"string"},{flag:"--hash-algorithm",value_name:"name",value_type:"string"}],cb=[{flag:"--definition",value_name:"json"},{flag:"--policy",value_name:"id"},{flag:"--message",value_name:"value"},{flag:"--description"},{flag:"--default-status",aliases:["--default_status"]},{flag:"--folder"},{flag:"--alias"},{flag:"--role"},{flag:"--order"},{flag:"--type"},{flag:"--commands"},{flag:"--cli-flag"},{flag:"--required"},{flag:"--required-on-create"},{flag:"--no-allow-unset"},{flag:"--required-types"},{flag:"--infer"},{flag:"--min-count"},{flag:"--apply",value_type:"boolean"},{flag:"--to"},{flag:"--migration-id",aliases:["--migration_id"]},{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}],lb=[{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}],vf=[{flag:"--title"},{flag:"--description"},{flag:"--scope"},{flag:"--parent"},{flag:"--related"},{flag:"--blocks"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--harness"},{flag:"--mode"},{flag:"--resume-context",aliases:["--resume_context"]},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--priority"},{flag:"--status",short:"-s"},{flag:"--create-mode",aliases:["--create_mode"]},{flag:"--deadline"},{flag:"--estimate",aliases:["--estimated-minutes","--estimated_minutes"]},{flag:"--acceptance-criteria",aliases:["--acceptance_criteria","--ac"],repeatable:!0},{flag:"--definition-of-ready",aliases:["--definition_of_ready"]},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now",aliases:["--why_now"]},{flag:"--assignee"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps",aliases:["--repro_steps"]},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--affected-version",aliases:["--affected_version"]},{flag:"--fixed-version",aliases:["--fixed_version"]},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact",aliases:["--customer_impact"]},{flag:"--comment",repeatable:!0},{flag:"--note",repeatable:!0},{flag:"--learning",repeatable:!0},{flag:"--reminder",repeatable:!0},{flag:"--event",repeatable:!0},{flag:"--type-option",aliases:["--type_option"],repeatable:!0},{flag:"--body"},{flag:"--claim"},{flag:"--from-search",aliases:["--from_search"]},{flag:"--template"},{flag:"--step-title",aliases:["--step_title"]},{flag:"--step"},{flag:"--step-body",aliases:["--step_body"]},{flag:"--step-owner",aliases:["--step_owner"]},{flag:"--step-status",aliases:["--step_status"]},{flag:"--step-evidence",aliases:["--step_evidence"]},{flag:"--step-blocked-reason",aliases:["--step_blocked_reason"]},{flag:"--step-replacement",aliases:["--step_replacement"]},{flag:"--depends-on",aliases:["--depends_on"]},{flag:"--link"},{flag:"--link-kind",aliases:["--link_kind"]},{flag:"--link-note",aliases:["--link_note"]},{flag:"--promote-to-item-dep",aliases:["--promote_to_item_dep"]},{flag:"--allow-multiple-active",aliases:["--allow_multiple_active"]},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--decision-text",aliases:["--decision_text","--decision"]},{flag:"--decision-rationale",aliases:["--decision_rationale"]},{flag:"--decision-evidence",aliases:["--decision_evidence"]},{flag:"--discovery-text",aliases:["--discovery_text","--discovery"]},{flag:"--validation-text",aliases:["--validation_text","--validation"]},{flag:"--validation-command",aliases:["--validation_command"]},{flag:"--validation-expected",aliases:["--validation_expected"]},{flag:"--depth"},{flag:"--field"},{flag:"--fields",list:!0},{flag:"--steps"},{flag:"--materialize-type",aliases:["--materialize_type"]},{flag:"--materialize-parent",aliases:["--materialize_parent"]},{flag:"--materialize-tags",aliases:["--materialize_tags"]},{flag:"--author"},{flag:"--message"},{flag:"--force"}],db=[{flag:"--id-prefix",aliases:["--prefix"]},{flag:"--preset"},{flag:"--type-preset"},{flag:"--defaults",short:"-y",aliases:["--yes"]},{flag:"--author"},{flag:"--agent-guidance"},{flag:"--with-packages"},{flag:"--no-merge-fence"},{flag:"--workspace"},{flag:"--force"},{flag:"--verbose"}],ub=[{flag:"--value",value_name:"value"},{flag:"--criterion"},{flag:"--clear-criteria"},{flag:"--format"},{flag:"--policy"},{flag:"--default-depth"},{flag:"--activity-limit"},{flag:"--stale-threshold-days"},{flag:"--section-hierarchy"},{flag:"--section-activity"},{flag:"--section-progress"},{flag:"--section-blockers"},{flag:"--section-files"},{flag:"--section-workload"},{flag:"--section-staleness"},{flag:"--section-tests"}],kf=[{flag:"--dry-run"},{flag:"--init"},{flag:"--scaffold"},{flag:"--capability"},{flag:"--install"},{flag:"--uninstall"},{flag:"--explore"},{flag:"--list"},{flag:"--manage"},{flag:"--describe"},{flag:"--markdown"},{flag:"--output"},{flag:"--reload"},{flag:"--watch"},{flag:"--doctor"},{flag:"--catalog"},{flag:"--adopt"},{flag:"--adopt-all"},{flag:"--activate"},{flag:"--deactivate"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"},{flag:"--detail"},{flag:"--trace"},{flag:"--runtime-probe"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}],rn=[{flag:"--project"},{flag:"--local"},{flag:"--global"}],fb=[...rn,{flag:"--capability"}],gf=[...kf,{flag:"--declarative"}],i$=[...fb,{flag:"--declarative"}];var s$=[...rn,{flag:"--markdown"},{flag:"--output"}];var a$=[...rn,{flag:"--dry-run"}],c$=[...rn,{flag:"--runtime-probe"},{flag:"--fix-managed-state"}],l$=[...rn,{flag:"--watch"}],d$=[...rn,{flag:"--detail"},{flag:"--trace"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}],u$=[...rn,{flag:"--fields",list:!0}],f$=[...rn,{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],mb=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],pb=[{flag:"--dry-run"},{flag:"--cli-only"},{flag:"--packages-only"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--repair"},{flag:"--tag"},{flag:"--package-name"}];var _b=[{flag:"--release-assignment",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--reason",value_name:"value"},{flag:"--close-reason",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--duplicate-of",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",aliases:["--expected_result","--expected"],value_name:"value"},{flag:"--actual-result",aliases:["--actual_result","--actual"],value_name:"value"},{flag:"--force",value_type:"boolean"}],gb=[{flag:"--filter-status",list:!0},{flag:"--filter-type"},{flag:"--filter-tag"},{flag:"--filter-priority"},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee"},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint"},{flag:"--filter-release"},...Yw,{flag:"--reason"},{flag:"--completed-at"},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--validate-close"},{flag:"--author"},{flag:"--message"},{flag:"--force"},{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"}],hb=[{flag:"--id",value_name:"item-id"},{flag:"--body",short:"-b"},{flag:"--text"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],yb=[{flag:"--start",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"},{flag:"--if-available"},{flag:"--next"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee-filter"},{flag:"--parent"},{flag:"--sprint"},{flag:"--release"},{flag:"--max-attempts"},{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--explain-ranking",aliases:["--explain_ranking"]}],wb=[{flag:"--id",value_name:"item-id"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],bb=[{flag:"--id",value_name:"item-id"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],vb=[{flag:"--pause",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],kb=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],Eb=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],Sb=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--force"}],Tb=[{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--tags"},{flag:"--priority"},{flag:"--body"},{flag:"--description"},{flag:"--author"},{flag:"--message"}],Ef=[{flag:"--start"},{flag:"--duration"},{flag:"--end"},{flag:"--location"},{flag:"--timezone"},{flag:"--all-day"},...Tb],Ab=Ef,Ib=[{flag:"--at"},{flag:"--text"},...Tb],Cb=[{flag:"--list"},{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-json"},{flag:"--remove"},{flag:"--remove-index",repeatable:!0},{flag:"--run"},{flag:"--match"},{flag:"--only-index"},{flag:"--only-last"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--acknowledge-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"},{flag:"--measure",list:!0},{flag:"--metric-below"},{flag:"--metric-diff"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ob=[{flag:"--status"},{flag:"--limit"},{flag:"--offset"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"}],xb=[{flag:"--limit"}];var Rb=[{flag:"--dry-run"},{flag:"--scope"}],Nb=[{flag:"--include-empty"},{flag:"--storage"},{flag:"--metadata-coverage"},{flag:"--field-utilization"},{flag:"--by-assignee"},{flag:"--by-tag"},{flag:"--by-priority"},{flag:"--tag-prefix"},{flag:"--analytics"}],Db=[{flag:"--exhaustive",value_type:"boolean"},{flag:"--status",repeatable:!0,list:!0},{flag:"--since"},{flag:"--threshold"},{flag:"--limit"}],Pb=[{flag:"--strict-directories"},{flag:"--require-merge-drivers"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--check-only"},{flag:"--check-telemetry"},{flag:"--no-refresh"},{flag:"--refresh-vectors"},{flag:"--verbose-stale-items"},{flag:"--verbose-author-events"},{flag:"--brief"},{flag:"--summary"},{flag:"--skip-vectors"},{flag:"--skip-integrity"},{flag:"--skip-drift"},{flag:"--full"}],Lb=[{flag:"--check-completeness",value_type:"boolean"},{flag:"--check-metadata"},{flag:"--metadata-profile"},{flag:"--check-resolution"},{flag:"--check-lifecycle"},{flag:"--check-stale-blockers"},{flag:"--dependency-cycle-severity"},{flag:"--parent-cycle-severity"},{flag:"--check-files"},{flag:"--scan-mode"},{flag:"--include-pm-internals"},{flag:"--verbose-file-lists"},{flag:"--verbose-diagnostics"},{flag:"--all-affected-ids"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--fix-hints"},{flag:"--auto-fix"},{flag:"--dry-run"},{flag:"--fix-scope"},{flag:"--prune-missing"},{flag:"--check-history-drift"},{flag:"--check-command-references"},{flag:"--check-storage-integrity"},{flag:"--counts"},{flag:"--full"}],Sf=[{flag:"--definition",value_name:"json"},{flag:"--trigger",value_name:"value"},{flag:"--tree",value_name:"value"},{flag:"--gate",value_name:"id"},{flag:"--limit",value_name:"number"},{flag:"--dry-run"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--owner",value_name:"item-id"},{flag:"--apply",value_type:"boolean"},{flag:"--enforcement",value_name:"level"}],Mb=[{flag:"--assignee"},{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--allow-unresolved-deps"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-by"},{flag:"--blocked-reason"},{flag:"--unblock-note"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--actual-result"},{flag:"--affected-version"},{flag:"--fixed-version"}],$b=[{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"}],Fb=[{short:"-p",flag:"--priority"},{flag:"--type"},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--add-tags",aliases:["--add_tags"]},{flag:"--remove-tags",aliases:["--remove_tags"]},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--add-ac",aliases:["--add_ac"]},{flag:"--remove-ac",aliases:["--remove_ac"]}],hf=[{flag:"--stdin-json"},{short:"-t",flag:"--title"},{flag:"--id"},{short:"-d",flag:"--description"},{flag:"--type"},{flag:"--template"},{flag:"--create-mode"},{flag:"--create_mode"},{flag:"--schedule-preset"},{flag:"--schedule_preset"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},{flag:"--completed_at"},{short:"-p",flag:"--priority"},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--add-tags",aliases:["--add_tags"]},{short:"-b",flag:"--body"},{flag:"--body-file"},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--author"},{flag:"--message"},...Mb,...$b,{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--fixed_version"},{flag:"--dep"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--reminder"},{flag:"--event"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--allow-duplicate",value_type:"boolean"}],jb=[{flag:"--transaction-id",value_name:"value"},{flag:"--stdin-json"},{flag:"--dry-run"},{flag:"--create-compensation",value_name:"mode"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--author",value_name:"value"}],Ub=[{flag:"--id",value_name:"item-id"},{flag:"--transaction-id",value_name:"value",required:!0},{flag:"--reason",value_name:"value"},{flag:"--file",value_name:"value",repeatable:!0},{flag:"--doc",value_name:"value",repeatable:!0},{flag:"--test",value_name:"value",repeatable:!0},{flag:"--comment",value_name:"value",repeatable:!0},{flag:"--note",value_name:"value",repeatable:!0},{flag:"--learning",value_name:"value",repeatable:!0},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",value_name:"value"},{flag:"--actual-result",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--dry-run"},{flag:"--force"},{flag:"--author",value_name:"value"}],zb=[{flag:"--id",value_name:"item-id"},{flag:"--status",value_name:"open|in_progress"},{flag:"--message",value_name:"value"},{flag:"--force"},{flag:"--author",value_name:"value"}],Hb=[{flag:"--id",value_name:"item-id"},{flag:"--title",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--allow-duplicate",value_type:"boolean"}],qb=[{flag:"--id",value_name:"item-id"},{flag:"--clear"}],Bb=[{flag:"--id",value_name:"item-id"},{flag:"--stdin-json"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},{flag:"--body-file"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},...Fb,...Mb,{flag:"--fixed_version"},...$b,{flag:"--author"},{flag:"--message"},{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--force"}],Gb=[{flag:"--status",short:"-s"},{flag:"--assignee"},{flag:"--parent"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--filter-status",list:!0},{flag:"--filter-type",list:!0},{flag:"--filter-tag",list:!0},{flag:"--filter-priority",list:!0},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee",list:!0},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint",list:!0},{flag:"--filter-release",list:!0},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...Yw,{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},...Fb,{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--repro_steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--expected_result"},{flag:"--expected"},{flag:"--actual-result"},{flag:"--actual_result"},{flag:"--actual"},{flag:"--affected-version"},{flag:"--affected_version"},{flag:"--fixed-version"},{flag:"--fixed_version"},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--allow-unresolved-deps"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],yf=[{flag:"--view"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--full-period"},{flag:"--full_period"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--status"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--include"},{flag:"--recurrence-lookahead-days"},{flag:"--recurrence-lookback-days"},{flag:"--occurrence-limit"},{flag:"--limit"},{flag:"--format"}],Wb=[{flag:"--id"},{flag:"--op"},{flag:"--author"},{flag:"--from"},{flag:"--to"},{flag:"--limit"},{flag:"--unbounded"},{flag:"--compact"},{flag:"--raw"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--stream"}],Vb=[{flag:"--since"},{flag:"--type",repeatable:!0},{flag:"--author",repeatable:!0},{flag:"--item",repeatable:!0},{flag:"--limit",value_type:"number"},{flag:"--cursor-mode",value_name:"batch|row"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--follow"},{flag:"--interval-ms",value_type:"number"}],wf=bf([{flag:"--for",value_name:"intent"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit",aliases:["--max-items"]},{flag:"--after"},{flag:"--format"},{flag:"--depth"},{flag:"--fields",list:!0},{flag:"--section"},{flag:"--activity-limit"},{flag:"--stale-threshold"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--no-extension-health"},{flag:"--no-tags"}],new Set(["--limit","--after","--format","--fields","--section","--activity-limit","--stale-threshold","--explain-ranking","--explain_ranking","--no-extension-health","--no-tags"])),Kb=[{flag:"--id",value_name:"item-id"},{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--depth"},{flag:"--full",value_type:"boolean"},{flag:"--fields",list:!0},{flag:"--at"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--format"}],Yb=[{flag:"--list"},{flag:"--format"},{flag:"--depth"}],Jb=[{flag:"--id",value_name:"item-id"},{flag:"--format"},{flag:"--max-depth"},{flag:"--collapse"},{flag:"--summary"},{flag:"--full"},{flag:"--node-limit"},{flag:"--edge-limit"},{flag:"--token-budget"},{flag:"--cursor"},{flag:"--direction"},{flag:"--kind",list:!0}],Xb=[{flag:"--kind",list:!0},{flag:"--max-depth",description:`Maximum traversal depth; paths default to ${Oi.path_depth}.`},{flag:"--limit",description:`Maximum rows per collection; default ${Oi.rows}. Use --full to remove the row cap.`},{flag:"--after"},{flag:"--direction"},{flag:"--max-paths",description:`Maximum enumerated paths; default ${Oi.paths}.`},{flag:"--sample",description:`Maximum evidence examples per audit finding; default ${Oi.samples}.`},{flag:"--exempt-isolate",list:!0},{flag:"--exempt-isolate-type",list:!0},{flag:"--save-baseline"},{flag:"--rebuild"},{flag:"--clear"},{flag:"--summary"},{flag:"--full"}],Zb=[{flag:"--mode"},{flag:"--k"},{flag:"--fail-under"},{flag:"--queries"},{flag:"--format"}],nn=[{flag:"--dry-run"},{flag:"--force"},{flag:"--author"},{flag:"--message"}],Qb=[],ev=[{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--for",value_name:"intent"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit"},{flag:"--blocked-limit"},{flag:"--blocked_limit"},{flag:"--ready-only"},{flag:"--ready_only"},{flag:"--format"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]}],tv=bf([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--mode"},{flag:"--semantic"},{flag:"--hybrid"},{flag:"--match-mode"},{flag:"--min-score"},{flag:"--count"},{flag:"--semantic-weight"},{flag:"--include-linked"},{flag:"--title-exact"},{flag:"--phrase-exact"},{flag:"--highlight"},{flag:"--compact"},{flag:"--full"},{flag:"--fields",list:!0},{flag:"--format"},{flag:"--limit"},{flag:"--after"},{flag:"--status",list:!0},{flag:"--type",list:!0},{flag:"--tag",aliases:["--tags"],list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--assignee",list:!0},{flag:"--sprint",list:!0},{flag:"--release",list:!0},{flag:"--parent"},...Kw],new Set(["--highlight","--compact","--full","--fields","--format","--limit","--token-budget","--after"])),nv=[{flag:"--action"},{flag:"--command"},{flag:"--summary"},{flag:"--schema-only"},{flag:"--flags-only"},{flag:"--availability-only"},{flag:"--runtime-only"},{flag:"--active-only"},{flag:"--full"}],rv=[{flag:"--eager-tags"}];var m$=["list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"],p$=Ba.filter(e=>e.flag!=="--status"&&e.flag!=="--all");function Ga(e){let t=new Map;for(let n of e)for(let r of[n.flag,...n.aliases??[]]){let o=t.get(r)??[];o.push(n),t.set(r,o)}return t}var _$=Ga(vf),g$=Ga(Sf),h$=new Map([["assurance",g$],["plan",_$],["workspace",Ga(Qb)],["workspace snapshot",Ga(nn)]]);function ov(e=no){return e.map(({command:t,parent:n,accepted_flags:r})=>{let o=h$.get(n);if(!o)throw new Error(`Positional action ${t} has no flag-contract index for ${n}.`);let i=r.map(s=>{let a=o.get(s)??[];if(a.length!==1)throw new Error(`Positional action ${t} accepted flag ${s} does not resolve to exactly one ${n} flag contract.`);return a[0]});return[t,i]})}var y$=ov(),zte=new Map([["list",Ba],["list-all",Ba],...m$.map(e=>[e,p$]),["templates",hf],["cal",yf],["ctx",wf],["test-runs-worker",[]],["init",db],["config",ub],["extension",kf],["package",gf],["packages",gf],["install",mb],["upgrade",pb],["create",hf],["item",[]],["item mutate",jb],["item complete",Ub],["item reopen",zb],["copy",Hb],["focus",qb],["aggregate",Jw],["calendar",yf],["context",wf],["get",Kb],["guide",Yb],["search",tv],["next",ev],["eval",Zb],["workspace",nn],["workspace position",Qb],["workspace snapshot",nn],["workspace snapshot create",nn],["workspace snapshot list",nn],["workspace snapshot inspect",nn],["workspace snapshot restore",nn],["workspace snapshot delete",nn],["history",nb],["history-redact",ob],["history-repair",ib],["history-author-acknowledge",sb],["history-compact",ab],["history-attest",o$],["merge",rb],["schema",cb],["profile",lb],["plan",vf],["activity",Wb],["events",Vb],["restore",wb],["update",Bb],["update-many",Gb],["close",_b],["close-many",gb],["delete",bb],["append",hb],["comments",Xw],["notes",Zw],["learnings",Qw],["files",eb],["docs",tb],["deps",Jb],["graph",Xb],["test",Cb],["test-all",Ob],["telemetry",xb],["health",Pb],["assurance",Sf],...y$,["validate",Lb],["gc",Rb],["stats",Nb],["duplicates",Db],["contracts",nv],["completion",rv],["claim",yb],["release",vb],["start-task",kb],["pause-task",Eb],["close-task",Sb],["meet",Ef],["event",Ab],["remind",Ib]]);(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]="a14011f9-67eb-5cd6-b520-8e938ada4f1b")}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]="e216fd39-09ee-5a04-b0b5-44f518db4f93")}catch{}})();function xi(e){let t=e?.trim()??"";return/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(t)||/^(?:github|gitlab|jira|linear):/iu.test(t)}function ro(e){let t=e?.trim().toLowerCase();return t==="global"||t==="external"}(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]="8d87a4e8-5853-52ca-8fdf-1433e2a9e75d")}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]="12a0ee7f-508d-5e6e-b59d-24bc0aba22aa")}catch{}})();var iv=["production_defect","nightly_regression","scanner_finding","review_caught_late"];(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]="06f5d0fa-6f34-5e3e-990b-2e3bc00364ca")}catch{}})();var Wa={type:"string",pattern:"\\S"},Tf={type:"array",minItems:1,items:Wa},av={type:"object",properties:Object.fromEntries(["files","package_names","item_ids","tags","error_codes"].map(e=>[e,{type:"array",items:{type:"string"}}]))},w$={type:"object",required:["id","version","title","owner_item_id","escape_class","triggers","checks","negative_control","historical_item_ids","budget"],properties:{id:Wa,version:{type:"integer",minimum:1},title:Wa,owner_item_id:Wa,escape_class:{enum:iv},triggers:{type:"object",properties:{...Object.fromEntries(["package_names","item_ids","tags","error_codes"].map(e=>[e,{type:"array",items:{type:"string"}}])),file_patterns:{type:"array",items:{type:"string",maxLength:256}}}},checks:{type:"object",required:["local","hosted"],properties:{local:Tf,hosted:Tf}},negative_control:{...av,minProperties:1},historical_item_ids:Tf,budget:{type:"object",required:["max_escape_rate","max_false_positive_rate"],properties:Object.fromEntries(["max_escape_rate","max_false_positive_rate"].map(e=>[e,{type:"number",minimum:0,maximum:1}]))}}},sv={oneOf:[{type:"number"},{type:"array",items:{type:"string"}}]},cv={if:{required:["field"]}};Reflect.set(cv,"then",{oneOf:[{required:["equals"]},{required:["state"]}]});var lv={oneOf:[...[!0,!1].map(e=>({type:"object",additionalProperties:!1,required:e?["policy","change"]:["policy"],properties:{policy:{type:"object",required:["version","evidence_epoch","families"],properties:{version:{const:1},evidence_epoch:{type:"string",format:"date-time"},families:{type:"array",items:w$}},additionalProperties:!1},...e?{change:{...av,additionalProperties:!1}}:{uncoveredOnly:{type:"boolean"}},limit:{type:"integer",minimum:1,maximum:100},cursor:{type:"string",minLength:1}}})),{type:"object",additionalProperties:!1,required:["id","source"],properties:{id:{type:"string",minLength:1},description:{type:"string"},max_cost:{type:"number",minimum:0},source:{oneOf:[{type:"object",additionalProperties:!1,required:["kind"],allOf:[cv],properties:{kind:{const:"items"},statuses:{type:"array",items:{type:"string"}},types:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}},field:{type:"string"},equals:{type:["string","number","boolean","null"]},state:{enum:["present","missing"]}}},{type:"object",additionalProperties:!1,required:["kind","dependency_kind"],properties:{kind:{const:"dependency_kind"},dependency_kind:{type:"string",minLength:1}}},{type:"object",required:["kind","operation","field"],properties:{kind:{const:"graph"},operation:{type:"string",minLength:1},field:{type:"string",minLength:1},parameters:{type:"object"}},additionalProperties:!1},...["validate","health"].map(e=>({type:"object",required:["kind","check","field"],properties:{kind:{const:e},check:{type:"string",minLength:1},field:{type:"string",minLength:1}},additionalProperties:!1})),{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{const:"history"},op:{type:"string"},author:{type:"string"},harness:{type:"string"},model:{type:"string"}}},{type:"object",additionalProperties:!1,required:["kind","link","state"],properties:{kind:{const:"links"},link:{enum:["files","tests","docs"]},state:{enum:["present","missing"]}}},{type:"object",additionalProperties:!1,required:["kind","provider","key"],properties:{kind:{const:"provider"},provider:{type:"string",minLength:1},key:{type:"string",minLength:1},parameters:{type:"object"}}},{type:"object",additionalProperties:!1,required:["kind","expression"],properties:{kind:{const:"derived"},expression:{type:"object",minProperties:1}}}]}}},{type:"object",additionalProperties:!1,required:["id","measurement_id","owner_item_id","scope","enforcement","negative_control"],oneOf:[{required:["ceiling"]},{required:["floor"]},{required:["equals"]},{required:["zero"]},{required:["monotone_nondecreasing"]},{required:["monotone_nonincreasing"]},{required:["subset_of"]}],allOf:[{oneOf:[{not:{required:["lifetime"],properties:{lifetime:{const:"retire"}}}},{required:["lifetime","retire_reason"],properties:{lifetime:{const:"retire"},retire_reason:{type:"string",minLength:1}}}]}],properties:{id:{type:"string",minLength:1},measurement_id:{type:"string",minLength:1},owner_item_id:{type:"string",minLength:1},scope:{oneOf:[{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["all","active"]}}},{type:"object",additionalProperties:!1,required:["kind","measurement_id"],properties:{kind:{const:"filter"},measurement_id:{type:"string",minLength:1}}}]},ceiling:{type:"number"},floor:{type:"number"},equals:sv,zero:{const:!0},monotone_nondecreasing:{type:"number"},monotone_nonincreasing:{type:"number"},subset_of:{type:"array",items:{type:"string"}},lifetime:{enum:["hold","retire"]},retire_reason:{type:"string",minLength:1},enforcement:{enum:["block","warn","observe"]},authorization_decision:{type:"string",minLength:1},negative_control:{type:"object",additionalProperties:!1,required:["cases"],properties:{cases:{type:"array",minItems:2,items:{type:"object",additionalProperties:!1,required:["observed","expected"],properties:{observed:sv,expected:{enum:["pass","fail"]}}}}}}}},{type:"object",additionalProperties:!1,required:["id","assertion_ids","triggers"],properties:{id:{type:"string",minLength:1},description:{type:"string"},assertion_ids:{type:"array",minItems:1,items:{type:"string",minLength:1}},triggers:{type:"array",minItems:1,items:{enum:["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"]}},provider_policy:{type:"object",additionalProperties:!1,required:["allowed_providers","triggers"],properties:{allowed_providers:{type:"array",items:{type:"string",minLength:1}},triggers:{type:"object",additionalProperties:{type:"object",additionalProperties:!1,required:["max_cost_class","allow_network"],properties:{max_cost_class:{enum:["low","medium","high"]},allow_network:{type:"boolean"}}}}}}}}]};(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]="13afdd63-c264-5e19-a574-4067594b535b")}catch{}})();var Af={json:{type:"boolean",default:!0},quiet:{type:"boolean"},profile:{type:"boolean"},noExtensions:{type:"boolean"},noPager:{type:"boolean"},tokenAccounting:{type:"boolean"},outputInclude:{type:"string",minLength:1},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}]},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}]},outputFormat:{type:"string",enum:["json","toon"]},outputSession:{anyOf:[{type:"string",minLength:1},{type:"object",additionalProperties:!1,required:["version","id","token_budget","spent_tokens","seen_item_ids"],properties:{version:{const:1},id:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$"},token_budget:{type:"integer",minimum:256},spent_tokens:{type:"integer",minimum:0},seen_item_ids:{type:"array",maxItems:Zs,items:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"}}}}]},outputCursor:{type:"string",minLength:1},outputRowContract:{type:"boolean"},path:{type:"string"},pmExecutable:{type:"string"},timeoutMs:{type:"number"},id:{type:"string"},target:{type:"string"},snapshotAction:{type:"string",enum:["create","list","inspect","restore","delete"]},artifact:{type:"string",enum:["item","history","relationship","json"]},basePath:{type:"string"},oursPath:{type:"string"},theirsPath:{type:"string"},outputPath:{type:"string"},itemPath:{type:"string"},prefer:{type:"string",enum:["ours","theirs"]},includeReconciled:{type:"boolean"},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"},capability:{type:"string",minLength:1},declarative:{type:"boolean"},output:{type:"string",minLength:1},markdown:{type:"boolean"},init:{type:"boolean"},install:{type:"boolean"},uninstall:{type:"boolean"},explore:{type:"boolean"},manage:{type:"boolean"},describe:{type:"boolean"},doctor:{type:"boolean"},catalog:{type:"boolean"},adopt:{type:"boolean"},adoptAll:{type:"boolean"},activate:{type:"boolean"},deactivate:{type:"boolean"},filterFilesMissing:{type:"boolean"},filterDocsMissing:{type:"boolean"},matchMode:{type:"string",enum:["all","any","phrase"]},minScore:{anyOf:[{type:"number"},{type:"string",pattern:"^\\d+(\\.\\d+)?$"}]},rank:{anyOf:[{type:"number"},{type:"string",pattern:"^-?\\d+$"}]},exemptIsolateType:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},saveBaseline:{type:"boolean"},rebuild:{type:"boolean"},github:{type:"string"},ref:{type:"string"},query:{type:"string"},queries:{type:"string"},k:{anyOf:[{type:"number"},{type:"string"}]},failUnder:{anyOf:[{type:"number"},{type:"string"}]},for:{type:"string",minLength:1},keywords:{type:"string"},fields:{type:"string"},sort:{type:"string",enum:["priority","deadline","updated_at","created_at","title","parent"]},prefix:{type:"string"},idPrefix:{type:"string"},workspace:{type:"string"},preset:{type:"string",enum:["minimal","default","strict","custom"]},typePreset:{type:"string",enum:["agile","ops","research"]},defaults:{type:"boolean"},verbose:{type:"boolean"},agentGuidance:{type:"string",enum:["ask","add","skip","status"]},withPackages:{type:"boolean"},mergeFence:{type:"boolean"},scope:{type:"string",enum:["project","global"]},allOver:{type:"number"},minEntries:{type:"number"},closed:{type:"boolean"},allStreams:{type:"boolean"},contractAction:{type:"string"},command:{type:"string"},summary:{type:"boolean"},schemaOnly:{type:"boolean"},flagsOnly:{type:"boolean"},availabilityOnly:{type:"boolean"},runtimeOnly:{type:"boolean"},activeOnly:{type:"boolean"},eagerTags:{type:"boolean"},fullChangedFields:{type:"boolean"},provenance:{type:"boolean"},provenanceSummary:{type:"boolean"},agentInstance:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},provenanceFilter:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},idOnly:{type:"boolean"},allowMissingParent:{type:"boolean"},allowUnresolvedDeps:{type:"boolean"},allowDuplicate:{type:"boolean"},duplicateOf:{type:"string"},configAction:{type:"string",enum:["get","set","list","export"]},key:{type:"string"},title:{type:"string"},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},start:{type:"string"},duration:{type:"string"},end:{type:"string"},location:{type:"string"},timezone:{type:"string"},allDay:{type:"boolean"},description:{type:"string"},type:{type:"string"},template:{type:"string"},createMode:{type:"string",enum:["strict","progressive"]},schedulePreset:{type:"string",enum:["lightweight"]},status:{type:"string"},since:{type:"string",format:"date-time"},cursorMode:{type:"string",enum:["batch","row"]},exhaustive:{type:"boolean"},threshold:{type:"number",minimum:0,maximum:1},filterStatus:{type:"string"},filterType:{type:"string"},filterTag:{type:"string"},filterPriority:{anyOf:[{type:"string"},{type:"number"}]},filterDeadlineBefore:{type:"string"},filterDeadlineAfter:{type:"string"},filterUpdatedAfter:{type:"string"},filterUpdatedBefore:{type:"string"},filterCreatedAfter:{type:"string"},filterCreatedBefore:{type:"string"},filterAssignee:{type:"string"},filterAssigneeFilter:{type:"string",enum:["assigned","unassigned"]},filterParent:{type:"string"},filterSprint:{type:"string"},filterRelease:{type:"string"},closeReason:{type:"string"},completedAt:{type:"string",format:"date-time"},reason:{type:"string"},priority:{anyOf:[{type:"string"},{type:"number"}]},tags:{type:"string"},addTags:{type:"array",items:{type:"string"}},removeTags:{type:"array",items:{type:"string"}},addAc:{type:"array",items:{type:"string"}},removeAc:{type:"array",items:{type:"string"}},body:{type:"string"},deadline:{type:"string"},estimate:{anyOf:[{type:"string"},{type:"number"}]},acceptanceCriteria:{type:"string"},author:{type:"string"},message:{type:"string"},owner:{type:"string"},enforcement:{type:"string"},assignee:{type:"string"},assigneeFilter:{type:"string",enum:["assigned","unassigned"]},parent:{type:"string"},reviewer:{type:"string"},attributedAuthor:{type:"string"},planFingerprint:{type:"string",pattern:"^[a-f0-9]{64}$"},historyEvent:{type:"array",items:{type:"string"}},risk:{type:"string"},confidence:{anyOf:[{type:"string"},{type:"number"}]},sprint:{type:"string"},release:{type:"string"},blockedBy:{type:"string"},blockedReason:{type:"string"},unblockNote:{type:"string"},reporter:{type:"string"},severity:{type:"string"},environment:{type:"string"},reproSteps:{type:"string"},resolution:{type:"string"},expectedResult:{type:"string"},actualResult:{type:"string"},affectedVersion:{type:"string"},fixedVersion:{type:"string"},component:{type:"string"},regression:{anyOf:[{type:"boolean"},{type:"string"},{type:"number"}]},customerImpact:{type:"string"},definitionOfReady:{type:"string"},order:{anyOf:[{type:"string"},{type:"number"}]},goal:{type:"string"},objective:{type:"string"},value:{type:"string"},impact:{type:"string"},outcome:{type:"string"},whyNow:{type:"string"},mode:{type:"string",enum:["keyword","semantic","hybrid"]},semanticWeight:{anyOf:[{type:"string"},{type:"number"}]},op:{type:"string"},compact:{type:"boolean"},raw:{type:"boolean"},brief:{type:"boolean"},full:{type:"boolean"},includeEmpty:{type:"boolean"},view:{type:"string",enum:["agenda","day","week","month"]},date:{type:"string"},from:{type:"string"},before:{type:"string"},at:{type:"string"},to:{type:"string"},migrationId:{type:"string"},fieldTypeScope:{type:"string"},past:{type:"boolean"},fullPeriod:{type:"boolean"},include:{type:"string"},recurrenceLookaheadDays:{anyOf:[{type:"string"},{type:"number"}]},recurrenceLookbackDays:{anyOf:[{type:"string"},{type:"number"}]},occurrenceLimit:{anyOf:[{type:"string"},{type:"number"}]},includeLinked:{type:"boolean"},semantic:{type:"boolean"},hybrid:{type:"boolean"},titleExact:{type:"boolean"},phraseExact:{type:"boolean"},highlight:{type:"boolean"},includeBody:{type:"boolean"},noTruncate:{type:"boolean"},strictRead:{type:"boolean"},tag:{type:"string"},deadlineBefore:{type:"string"},deadlineAfter:{type:"string"},today:{type:"boolean"},recent:{type:"boolean"},updatedAfter:{type:"string"},updatedBefore:{type:"string"},createdAfter:{type:"string"},createdBefore:{type:"string"},filterAcMissing:{type:"boolean"},filterEstimatesMissing:{type:"boolean"},filterResolutionMissing:{type:"boolean"},filterMetadataMissing:{type:"boolean"},filterReviewerMissing:{type:"boolean"},filterRiskMissing:{type:"boolean"},filterConfidenceMissing:{type:"boolean"},filterSprintMissing:{type:"boolean"},filterReleaseMissing:{type:"boolean"},hasNotes:{type:"boolean"},noNotes:{type:"boolean"},hasLearnings:{type:"boolean"},noLearnings:{type:"boolean"},hasFiles:{type:"boolean"},noFiles:{type:"boolean"},hasDocs:{type:"boolean"},noDocs:{type:"boolean"},hasTests:{type:"boolean"},noTests:{type:"boolean"},hasComments:{type:"boolean"},noComments:{type:"boolean"},hasDeps:{type:"boolean"},noDeps:{type:"boolean"},hasBody:{type:"boolean"},emptyBody:{type:"boolean"},hasLinkedCommand:{type:"boolean"},noLinkedCommand:{type:"boolean"},filterHasNotes:{type:"boolean"},filterNoNotes:{type:"boolean"},filterHasLearnings:{type:"boolean"},filterNoLearnings:{type:"boolean"},filterHasFiles:{type:"boolean"},filterNoFiles:{type:"boolean"},filterHasDocs:{type:"boolean"},filterNoDocs:{type:"boolean"},filterHasTests:{type:"boolean"},filterNoTests:{type:"boolean"},filterHasComments:{type:"boolean"},filterNoComments:{type:"boolean"},filterHasDeps:{type:"boolean"},filterNoDeps:{type:"boolean"},filterHasBody:{type:"boolean"},filterEmptyBody:{type:"boolean"},filterHasLinkedCommand:{type:"boolean"},filterNoLinkedCommand:{type:"boolean"},ids:{type:"string"},limit:{anyOf:[{type:"string"},{type:"number"}]},blockedLimit:{anyOf:[{type:"string"},{type:"number"}]},readyOnly:{type:"boolean"},offset:{anyOf:[{type:"string"},{type:"number"}]},progress:{type:"boolean"},background:{type:"boolean"},runId:{type:"string"},stream:{anyOf:[{type:"boolean"},{type:"string",enum:["stdout","stderr","both","rows","ndjson","jsonl"]}]},tail:{anyOf:[{type:"string"},{type:"number"}]},addJson:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},eventType:{type:"string"},includeMeta:{type:"boolean"},allActionable:{type:"boolean"},verboseAuthorEvents:{type:"boolean"},match:{type:"string"},onlyIndex:{anyOf:[{type:"string"},{type:"number"}]},removeIndex:{type:"array",items:{anyOf:[{type:"string"},{type:"number"}]}},onlyLast:{type:"boolean"},envSet:{type:"array",items:{type:"string"}},envClear:{type:"array",items:{type:"string"}},sharedHostSafe:{type:"boolean"},detail:{type:"string",enum:["summary","deep"]},trace:{type:"boolean"},reload:{type:"boolean"},watch:{type:"boolean"},runtimeProbe:{type:"boolean"},fixManagedState:{type:"boolean"},isolated:{type:"boolean"},ignoreGlobal:{type:"boolean"},pmContext:{type:"string",enum:["schema","tracker","auto"]},overrideLinkedPmContext:{type:"boolean"},workspaceContext:{type:"string",enum:["source","isolated","snapshot"]},overrideLinkedWorkspaceContext:{type:"boolean"},allowUntrustedLinkedTests:{type:"boolean"},acknowledgeLinkedTests:{type:"boolean"},failOnContextMismatch:{type:"boolean"},failOnSkipped:{type:"boolean"},failOnEmptyTestRun:{type:"boolean"},requireAssertionsForPm:{type:"boolean"},checkContext:{type:"boolean"},autoPmContext:{type:"boolean"},measure:{type:"array",items:{type:"string"}},metricBelow:{type:"string"},metricDiff:{type:"string"},diff:{type:"boolean"},storage:{type:"boolean"},metadataCoverage:{type:"boolean"},fieldUtilization:{type:"boolean"},byAssignee:{type:"boolean"},byTag:{type:"boolean"},byPriority:{type:"boolean"},tagPrefix:{type:"string"},measurements:{type:"boolean"},metric:{type:"string"},measurementLimit:{type:"integer",minimum:0,maximum:1e3},observe:{type:"array",items:{type:"string"}},improvementDirection:{type:"string",enum:["higher","lower","target"]},measurementSource:{type:"string"},measurementItem:{type:"string"},measurementRevision:{type:"string"},provenanceCoverage:{type:"boolean"},fleetAttribution:{type:"boolean"},eventLimit:{type:"integer",minimum:1,maximum:1e5},minimumSample:{type:"integer",minimum:1,maximum:1e4},verify:{type:"boolean"},literal:{type:"array",items:{type:"string"}},regex:{type:"array",items:{type:"string"}},replacement:{type:"string"},timeout:{anyOf:[{type:"string"},{type:"number"}]},validateClose:{type:"string",enum:["off","warn","strict"]},checkMetadata:{type:"boolean"},metadataProfile:{type:"string",enum:["core","strict","custom"]},checkResolution:{type:"boolean"},checkCompleteness:{type:"boolean"},checkLifecycle:{type:"boolean"},checkStaleBlockers:{type:"boolean"},dependencyCycleSeverity:{type:"string",enum:["off","warn","error"]},parentCycleSeverity:{type:"string",enum:["off","warn","error"]},checkFiles:{type:"boolean"},checkStorageIntegrity:{type:"boolean"},strictDirectories:{type:"boolean"},requireMergeDrivers:{type:"boolean"},checkOnly:{type:"boolean"},checkTelemetry:{type:"boolean"},noRefresh:{type:"boolean"},refreshVectors:{type:"boolean"},verboseStaleItems:{type:"boolean"},skipVectors:{type:"boolean"},skipIntegrity:{type:"boolean"},skipDrift:{type:"boolean"},verboseDiagnostics:{type:"boolean"},allAffectedIds:{type:"boolean"},scanMode:{type:"string",enum:["default","tracked-all","tracked-all-strict"]},includePmInternals:{type:"boolean"},verboseFileLists:{type:"boolean"},strictExit:{type:"boolean"},failOnWarn:{type:"boolean"},fixHints:{type:"boolean"},autoFix:{type:"boolean"},fixScope:{type:"array",items:{type:"string",enum:["metadata","resolution","estimates","lifecycle"]}},pruneMissing:{type:"boolean"},checkHistoryDrift:{type:"boolean"},checkCommandReferences:{type:"boolean"},counts:{type:"boolean"},edit:{type:"integer",minimum:1},delete:{type:"integer",minimum:1},dryRun:{type:"boolean"},normalizeProvenance:{type:"boolean"},salvageTail:{type:"boolean"},all:{type:"boolean"},clear:{type:"boolean"},cliOnly:{type:"boolean"},packagesOnly:{type:"boolean"},repair:{type:"boolean"},packageName:{type:"string"},rollback:{type:"string"},noCheckpoint:{type:"boolean"},force:{type:"boolean"},ifAvailable:{type:"boolean"},ifAbsent:{type:"boolean"},next:{type:"boolean"},maxAttempts:{anyOf:[{type:"integer",minimum:1,maximum:100},{type:"string",pattern:"^(?:[1-9]|[1-9][0-9]|100)$"}]},includeDecisions:{type:"boolean"},includeGates:{type:"boolean"},includeContainers:{type:"boolean"},explainRanking:{type:"boolean"},noTags:{type:"boolean"},noExtensionHealth:{type:"boolean"},run:{type:"boolean"},count:{type:"boolean"},sum:{type:"string"},avg:{type:"string"},tree:{type:"boolean"},treeId:{type:"string",minLength:1},definition:{type:"object"},trigger:{type:"string",enum:["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"]},gate:{type:"string",minLength:1},treeDepth:{anyOf:[{type:"string"},{type:"number"}]},includeUnparented:{type:"boolean"},gcScope:{type:"array",items:{type:"string",enum:["index","embeddings","runtime","locks"]}},maxDepth:{anyOf:[{type:"string"},{type:"number"}]},nodeLimit:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},edgeLimit:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},tokenBudget:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},cursor:{type:"string"},direction:{type:"string",enum:["outgoing","incoming","both"]},kind:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},after:{type:"string"},maxPaths:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},sample:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},exemptIsolate:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},collapse:{type:"string",enum:["none","repeated"]},shell:{type:"string",enum:["bash","zsh","fish"]},stdin:{type:"boolean"},file:{type:"string"},preserveSourceIds:{type:"boolean"},folder:{type:"string"},subcommand:{type:"string"},name:{type:"string"},defaultStatus:{type:"string"},alias:{type:"array",items:{type:"string"}},role:{type:"array",items:{type:"string"}},fieldType:{type:"string",enum:["string","number","boolean","string_array"]},commands:{type:"array",items:{type:"string"}},cliFlag:{type:"string"},required:{type:"boolean"},requiredOnCreate:{type:"boolean"},allowUnset:{type:"boolean"},requiredTypes:{type:"array",items:{type:"string"}},infer:{type:"boolean"},minCount:{type:"number"},text:{type:"string"},add:{type:"array",items:{type:"string"}},addGlob:{type:"array",items:{type:"string"}},remove:{type:"array",items:{type:"string"}},migrate:{type:"array",items:{type:"string"}},discover:{type:"boolean"},apply:{type:"boolean"},discoveryNote:{type:"string"},lookupPath:{type:"array",items:{type:"string"}},explain:{type:"boolean"},lines:{type:"string",pattern:"^[1-9]\\d*:[1-9]\\d*$"},decisionDepth:{type:"integer",minimum:1,maximum:32},addNote:{type:"string"},list:{type:"boolean"},appendStable:{type:"boolean"},validatePaths:{type:"boolean"},dep:{type:"array",items:{type:"string"}},depRemove:{type:"array",items:{type:"string"}},replaceDeps:{type:"boolean"},replaceTests:{type:"boolean"},replaceFiles:{type:"boolean"},replaceDocs:{type:"boolean"},comment:{type:"array",items:{type:"string"}},note:{type:"array",items:{type:"string"}},learning:{type:"array",items:{type:"string"}},linkedFile:{type:"array",items:{type:"string"}},linkedTest:{type:"array",items:{type:"string"}},doc:{type:"array",items:{type:"string"}},reminder:{type:"array",items:{type:"string"}},event:{type:"array",items:{type:"string"}},typeOption:{type:"array",items:{type:"string"}},field:{type:"array",items:{type:"string"}},unset:{type:"array",items:{type:"string"}},clearDeps:{type:"boolean"},clearComments:{type:"boolean"},clearNotes:{type:"boolean"},clearLearnings:{type:"boolean"},clearFiles:{type:"boolean"},clearTests:{type:"boolean"},clearDocs:{type:"boolean"},clearReminders:{type:"boolean"},clearEvents:{type:"boolean"},clearTypeOptions:{type:"boolean"},criterion:{type:"array",items:{type:"string"}},clearCriteria:{type:"boolean"},groupBy:{type:"string"},setMode:{type:"string",enum:["element","tuple"]},completion:{type:"boolean"},format:{type:"string"},unbounded:{type:"boolean"},depth:{type:"string",enum:["brief","standard","deep","full"]},section:{type:"array",items:{type:"string",enum:["hierarchy","activity","progress","blockers","files","workload","staleness","tests"]}},activityLimit:{anyOf:[{type:"string"},{type:"number"}]},staleThreshold:{type:"string"},policy:{type:"string"}},dv={schema:{definition:{type:["object","string"]}},assurance:{definition:lv,kind:{type:"string",enum:["measurement","assertion","gate"]},subcommand:{type:"string",enum:["list","show","put","remove","run","verdicts","presets","apply","derive","promote","risk","lineages"]},preset:{type:"string",enum:["software-delivery","research","agent-evaluation","operations"]},enforcement:{type:"string",enum:["warn","block"]},limit:{type:"integer",minimum:1,maximum:1e3}},activity:{harness:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},"update-many":{ids:{anyOf:[{type:"string"},{type:"number"},{type:"array",items:{anyOf:[{type:"string"},{type:"number"}]}}]}},"close-many":{ids:{anyOf:[{type:"string"},{type:"number"},{type:"array",items:{anyOf:[{type:"string"},{type:"number"}]}}]}},"history-compact":{ids:{anyOf:[{type:"string"},{type:"number"},{type:"array",items:{anyOf:[{type:"string"},{type:"number"}]}}]}},events:{since:{type:"string",minLength:1},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},harness:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},history:{harness:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},remind:{at:{type:"string",minLength:1}}},b$=["create","show","add-step","update-step","complete-step","block-step","reorder-step","remove-step","link","unlink","decision","discovery","validation","resume","approve","materialize"],If={subcommand:{type:"string",enum:[...b$]},stepRef:{type:"string"},reorderTo:{anyOf:[{type:"string"},{type:"number"}]},scope:{type:"string"},harness:{type:"string",enum:[...vm]},mode:{type:"string",enum:[...bm]},resumeContext:{type:"string"},related:{type:"string"},blocks:{type:"string"},claim:{type:"boolean"},fromSearch:{type:"string"},stepTitle:{type:"string"},step:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},stepBody:{type:"string"},stepOwner:{type:"string"},stepStatus:{type:"string",enum:[...ns]},stepEvidence:{type:"string"},stepBlockedReason:{type:"string"},stepReplacement:{type:"string"},dependsOn:{type:"string"},link:{type:"string"},linkKind:{type:"string",enum:[...km]},linkNote:{type:"string"},promoteToItemDep:{type:"boolean"},allowMultipleActive:{type:"boolean"},file:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},test:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},doc:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},decisionText:{type:"string"},decision:{type:"string"},decisionRationale:{type:"string"},decisionEvidence:{type:"string"},discoveryText:{type:"string"},discovery:{type:"string"},validationText:{type:"string"},validation:{type:"string"},validationCommand:{type:"string"},validationExpected:{type:"string"},steps:{type:"array",items:{type:"string"}},materializeType:{type:"string"},materializeParent:{type:"string"},materializeTags:{type:"string"},field:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},Cf={subcommand:{description:"Plan workflow operation to run.",examples:["create","show","add-step","approve"]},stepRef:{description:"Plan step id or order for step lifecycle subcommands.",examples:["plan-step-001","1"]},reorderTo:{description:"New integer order for reorder-step.",examples:[1,"2"]},scope:{description:"Short free-text scope statement describing what the Plan covers.",examples:["Release readiness audit","Search package migration"]},mode:{description:"Plan lifecycle mode.",examples:["draft","research","approved"]},step:{description:"Ordered initial step titles for create (string or array, never comma-split; stepTitle, when also set, becomes the first step). For step subcommands a single value aliases stepTitle.",examples:[["Read the code","Write the fix","Run the tests"]]},file:{description:"File link to attach while creating or materializing a Plan.",examples:["path=src/cli.ts,note=implementation surface"]},test:{description:"Test command link to attach while creating or materializing a Plan.",examples:["command=pnpm build,timeout_seconds=300"]},doc:{description:"Documentation link to attach while creating or materializing a Plan.",examples:["path=docs/SDK.md,note=public API reference"]}},uv={includeGates:{description:"Opt next or claim-next into outcome gates. Blocker and ownership restrictions still apply."},includeContainers:{description:"Opt next or claim-next into containers with unfinished descendants. Blocker and ownership restrictions still apply."},action:{description:"Tool action to execute."},pmExecutable:{description:"Override the pm executable used by actions that invoke or verify an external CLI process.",examples:["pm","node dist/cli.js"]},force:{description:"Allow the selected action to override its supported ownership, terminal-state, or destructive-operation guard."},limit:{description:"Maximum number of rows returned by the selected action.",examples:[10,"25"]},text:{description:"Text payload used by append, comment, note, or learning mutations."},path:{description:"Optional PM data root override for this invocation.",examples:[".agents/pm"]},scope:{description:"Scope selector for commands that operate on project or global state. Linked files, docs, and tests default to project scope when omitted.",examples:["project","global"]},detail:{description:"Detail mode for commands that support concise and deep diagnostics.",examples:["summary","deep"]},trace:{description:"When true for extension-doctor, include actionable registration traces in deep diagnostics."},reload:{description:"When true for extension action payloads, trigger cache-busted extension module reload."},watch:{description:"When true for extension-reload/extension action payloads, enable watch mode semantics."},runtimeProbe:{description:"When true for extension-manage, run a doctor-like runtime activation probe for parity fields."},fixManagedState:{description:"When true for extension-manage/extension-doctor, adopt unmanaged extensions before diagnostics/update checks."},isolated:{description:"When true for extension-doctor/package-doctor, ignore global registrations for hermetic project diagnostics."},ignoreGlobal:{description:"Alias for isolated on extension-doctor/package-doctor action payloads."},target:{description:"Positional target argument for the selected action (ID, source, package source, or extension name).",examples:["pm-a1b2",".agents/pm/extensions/sample","sample-extension"]},capability:{description:"Starter capability selected by extension-init or package-init scaffolding.",examples:["commands","hooks","search","schema"]},declarative:{description:"Generate the package composeExtension declarative blueprint starter."},output:{description:"File path for commands that write generated output, such as package/extension describe Markdown references.",examples:["docs/pm-package-reference.md"]},markdown:{description:"Render the package or extension description as Markdown instead of structured output.",examples:[!0]},github:{description:"GitHub shorthand owner/repo[/path] source for package/extension install actions.",examples:["org/repo/extensions/sample"]},ref:{description:"Git ref/branch/tag used when installing from GitHub shorthand/URL sources.",examples:["main","v1.0.0"]},cliOnly:{description:"Restrict upgrade to the pm CLI/SDK npm package."},packagesOnly:{description:"Restrict upgrade to managed installable pm packages."},repair:{description:"Force npm global reinstall semantics when upgrading the pm CLI/SDK."},tag:{description:"npm version or dist-tag used for CLI and registry package upgrades.",examples:["latest","next","2026.5.11"]},today:{description:"When true for list actions, include only items updated since local midnight today."},recent:{description:"When true for list actions, include only items updated in the last seven days."},packageName:{description:"Override the pm CLI package name for self-upgrade automation and tests.",examples:["@unbrained/pm-cli"]},json:{description:"Emit machine-readable JSON output."},quiet:{description:"Suppress stdout payload output."},noExtensions:{description:"Disable extension loading for this invocation."},noPager:{description:"Disable pager integration for help and long output."},tokenAccounting:{description:"Request a bounded transport-level receipt for output emitted by a compatible CLI or MCP host."},outputInclude:{description:"Comma-separated fields or sections retained by any built-in read action.",examples:["id,title,status","summary,counts"]},outputLimit:{description:"Universal read row ceiling, or unbounded to disable the shared ceiling.",examples:[10,"unbounded"]},outputBudget:{description:"Universal estimated-token ceiling for a read result, or unbounded to disable the shared ceiling.",examples:[600,1200,"unbounded"]},outputFormat:{description:"Universal read-result encoding selector.",examples:["toon","json"]},outputSession:{description:"Caller-carried JSON session state that enforces a token ceiling across read calls and replaces repeated item facts with resolvable context references.",examples:[{version:1,id:"orientation",token_budget:4e3,spent_tokens:0,seen_item_ids:[]}]},outputCursor:{description:"Opaque continuation cursor returned when a declared row collection is compacted by the output budget."},outputRowContract:{description:"Include the row selector and TOON row-encoding contract on a read result."},profile:{description:"Emit deterministic timing diagnostics to stderr."},timeoutMs:{description:"Tool execution timeout in milliseconds.",examples:[12e4]},id:{description:"Item identifier for read or mutation actions.",examples:["pm-a1b2"]},treeId:{description:"Commit, tree, snapshot, or immutable workspace identity judged by an assurance gate.",examples:["0123456789abcdef","release-candidate-3"]},definition:{description:"Structured measurement, assertion, or gate declaration used by assurance put."},trigger:{description:"Lifecycle trigger used to evaluate an assurance gate.",examples:["ci","pre-release"]},gate:{description:"Stable assurance gate id used to filter durable verdict history.",examples:["release-readiness"]},owner:{description:"pm item that owns preset or observation-derived assurance assertions.",examples:["pm-a1b2"]},enforcement:{description:"Explicit next assurance enforcement level.",examples:["warn","block"]},runId:{description:"Background test run identifier.",examples:["tr-kq9x3f-93acde"]},title:{description:"Item title text."},description:{description:"Item description text."},type:{description:"Item type name from the active runtime type registry.",examples:["Task","Feature"]},subcommand:{description:"Subcommand selector for schema, profile, telemetry, and graph actions."},name:{description:"Custom definition name, schema migration source name, or profile name.",examples:["Spike","review","component"]},defaultStatus:{description:"Default status hint recorded for a custom item type.",examples:["open"]},alias:{description:"Aliases for the custom item type or status (repeatable).",examples:[["spike","research"]]},role:{description:"Lifecycle roles for a custom status (schema add-status): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel.",examples:[["active"],["terminal","terminal_done"]]},fieldType:{description:"Value type for a custom field (schema add-field): string, number, boolean, or string_array.",examples:["string","number","string_array"]},fieldTypeScope:{description:"Optional item type restricting which records participate in schema rename-field.",examples:["Issue","Feature"]},migrationId:{description:"Optional stable idempotency override used to persist and resume a schema migration plan; omitted values are derived from the workspace and normalized request.",examples:["severity-to-impact-v2"]},commands:{description:"Commands a custom field is wired onto (schema add-field): create, update, update_many, list, search, calendar, context.",examples:[["create","update"],["create","update","list"]]},cliFlag:{description:"Override the auto-derived CLI flag for a custom field (schema add-field).",examples:["--owner"]},required:{description:"Mark a custom field as always required (schema add-field)."},requiredOnCreate:{description:"Mark a custom field as required at create time (schema add-field)."},allowUnset:{description:"Whether a custom field may be cleared via --unset (schema add-field); defaults to true."},allowDuplicate:{description:"Explicitly proceed when strict similarity governance finds likely duplicate items."},allowUnresolvedDeps:{description:"Permit unresolved local dependency targets while returning dependency_target_unresolved warning receipts. Cross-workspace references should use source_kind=external instead.",examples:[!0]},requiredTypes:{description:"Restrict a custom field's requirement to specific item types (schema add-field).",examples:[["Bug"],["Story","Spike"]]},infer:{description:"Infer custom item types from title-prefix conventions (schema add-type); previews unless apply is true."},minCount:{description:"Minimum number of items sharing a title prefix for schema add-type inference (default 10).",examples:[10,25]},preset:{description:"Governance preset for initialization flows.",examples:["minimal","default","strict"]},idPrefix:{description:"Tracker item identifier prefix used by initialization; overrides the positional compatibility prefix.",examples:["pm","work"]},workspace:{description:"Workspace directory where initialization resolves or creates the tracker.",examples:[".","packages/app"]},typePreset:{description:"Domain item-type preset registered during initialization.",examples:["agile","ops","research"]},defaults:{description:"Use non-interactive setup defaults during initialization."},verbose:{description:"Include the full resolved settings tree in init output."},agentGuidance:{description:"Control AGENTS.md/CLAUDE.md guidance behavior during init: ask, add, skip, or status.",examples:["ask","add","skip","status"]},withPackages:{description:"Install all bundled first-party pm packages during initialization."},mergeFence:{description:"Install the repository merge-driver fence for a fresh Git-backed tracker; set false to opt out."},createMode:{description:"Create required-option policy mode.",examples:["strict","progressive"]},schedulePreset:{description:"Schedule-centric create preset for Reminder, Meeting, and Event types.",examples:["lightweight"]},status:{description:"Item status value. Statuses are project-configurable via .agents/pm/settings.json (schema block); the built-in defaults are draft, open, in_progress, blocked, closed, canceled. Custom statuses defined for the project are accepted \u2014 discover the active set with the pm_contracts tool (workspace.statuses) or `pm contracts`. Unknown statuses are rejected at runtime with a did-you-mean hint rather than blocked by a fixed schema enum.",examples:["open","in_progress"]},since:{description:"Inclusive ISO 8601 creation timestamp lower bound for duplicate discovery.",examples:["2026-01-01T00:00:00.000Z"]},exhaustive:{description:"Compare every duplicate pair within the disclosed safety bound; default prefix filtering preserves exact recall."},threshold:{description:"Minimum duplicate similarity score from zero through one.",examples:[.85]},priority:{description:"Priority value in range 0..4.",examples:[0,1,"2"]},order:{description:"Planning order/rank value for create/update, or sort direction (asc|desc) for list-family sorting.",examples:[0,1,"2","asc","desc"]},sort:{description:"List-family sort field selector.",examples:["priority","deadline","updated_at","created_at","title","parent"]},tags:{description:"Comma-delimited tag list.",examples:["pm-cli,agent-ux"]},addTags:{description:"Tags to add to the existing list without replacing it. Each entry may be CSV or a JSON array.",examples:[["agent-ux"],["fix","security"]]},addAc:{description:"Acceptance criteria appended individually without replacing the existing list (one criterion per entry).",examples:[["error path covered by a regression test"]]},removeAc:{description:"Acceptance criteria removed individually by exact text match; the mutation fails atomically if any selector is unmatched (one criterion per entry).",examples:[["superseded manual QA step"]]},removeTags:{description:"Tags to remove from the existing list. Each entry may be CSV or a JSON array.",examples:[["stale"],["legacy","wontfix"]]},deadline:{description:"ISO/date timestamp or relative offset (+6h/+1d/+2w/+6m).",examples:["2026-04-01T00:00:00.000Z","+1d"]},reminder:{description:"Repeatable reminder seed entries at=<iso|relative>,text=<text>.",examples:[["at=+2d,text=Review PR"]]},event:{description:"Repeatable event seed entries start=<iso|relative> with end=<iso|relative> or duration=<relative|30min|PT30M>. Bare `m` remains months for backward compatibility.",examples:[["start=2026-07-01T10:00:00Z,duration=2h,title=planning"],["start=2026-07-01T10:00:00Z,duration=30min,title=standup"],["start=2026-07-01T10:00:00Z,duration=PT30M,title=window"]]},historyEvent:{description:"Unknown-author history target in <item-id>:<one-based-line> form.",examples:[["pm-example:4","pm-example:5"]]},planFingerprint:{description:"Exact SHA-256 returned by a history-author-acknowledge dry-run preview; apply refuses stale or changed source coordinates.",examples:["0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"]},estimate:{description:"Estimated effort in minutes.",examples:[60,"120"]},acceptanceCriteria:{description:"Complete acceptance-criteria text supplied while creating or replacing an item field."},author:{description:"Intentional mutation-author override. Agent harness identity is automatic when omitted."},attributedAuthor:{description:"Principal attributed to the immutable unknown-author history events after review.",examples:["reviewed-principal"]},message:{description:"History message for mutation audit trail."},ifAbsent:{description:"For annotations, append only when no existing entry has the same resolved author and exact stored text; retries return changed false without a history event."},assignee:{description:"Assignee identity."},assigneeFilter:{description:"Assignee presence selector for list, calendar, and context filters.",examples:["assigned","unassigned"]},parent:{description:"Parent item ID filter for hierarchical list queries.",examples:["pm-epic01"]},blockedLimit:{description:"Cap blocked rows returned by the next action (defaults to the ready --limit).",examples:["3"]},readyOnly:{description:"When true, the next action omits the blocked companion list."},unset:{description:"Repeatable list of item-metadata fields to clear explicitly during create/update mutations.",examples:[["deadline","assignee"],["close-reason"]]},clearDeps:{description:"When true, clear linked dependencies."},replaceDeps:{description:"When true for update, atomically replace dependencies with the supplied --dep values."},replaceTests:{description:"When true for update, atomically replace linked tests with the supplied --test values."},replaceFiles:{description:"When true for update, atomically replace linked files with the supplied --file values."},replaceDocs:{description:"When true for update, atomically replace linked docs with the supplied --doc values."},lookupPath:{description:"One or more source paths whose referencing pm items should be returned by files lookup.",examples:[["src/sdk/files.ts"],["README.md","docs/SDK.md"]]},explain:{description:"Include ranked linked-file, rationale, and governing-decision evidence for a files lookup."},lines:{description:"Inclusive start:end source-line range for Git contribution attribution; requires one lookup path.",examples:["10:24"]},decisionDepth:{description:"Maximum typed relationship depth searched for a governing Decision during files lookup.",examples:[8]},clearComments:{description:"When true, clear item comments."},clearNotes:{description:"When true, clear item notes."},clearLearnings:{description:"When true, clear item learnings."},clearFiles:{description:"When true, clear linked files."},clearTests:{description:"When true, clear linked tests."},clearDocs:{description:"When true, clear linked docs."},clearReminders:{description:"When true, clear reminders."},clearEvents:{description:"When true, clear events."},clearTypeOptions:{description:"When true, clear type option metadata."},clearCriteria:{description:"When true for config set criteria-list keys (definition-of-done, metadata-required-fields, lifecycle pattern lists), clear the criteria list."},mode:{description:"Mode selector for search and reindex (keyword|semantic|hybrid).",examples:["keyword","hybrid"]},semanticWeight:{description:"Per-query hybrid semantic weight override in [0,1] for search action; invalid values fall back to settings.",examples:[.2,"0.7"]},op:{description:"History operation filter for activity output.",examples:["create","update","close","update_ownership_bypass"]},fullPeriod:{description:"For day/week/month calendar views, include the full anchored period instead of clipping the start to now."},progress:{description:"Emit progress diagnostics to stderr for long-running operations."},background:{description:"Run linked tests in managed background mode."},addJson:{description:"JSON input: one structured context event for notes, or repeatable linked-test entries for test.",examples:[['{"command":"node scripts/run-tests.mjs test -- tests/unit/output.spec.ts","timeout_seconds":240}']]},eventType:{description:"For notes action, return structured context events whose top-level type matches this value."},includeMeta:{description:"Include structured-event counts for notes reads; filtered reads also include total, returned, limit, and has-more metadata."},allActionable:{description:"For history-author-acknowledge, select every currently actionable undispositioned event."},match:{description:"Run only linked tests whose command or path contains this case-insensitive substring.",examples:["output.spec.ts","coverage"]},onlyIndex:{description:"Run only the 1-based linked-test index from pm test <id> --list order.",examples:[1,"2"]},removeIndex:{description:"Remove linked tests by their 1-based positions from pm test <id> --list order; repeatable and lossless for commands containing commas or equals signs.",examples:[[1],["2","4"]]},onlyLast:{description:"Run only the most recently added linked-test entry."},envSet:{description:"Repeatable runtime environment KEY=VALUE overrides for linked-test execution.",examples:[["PORT=0","PLAYWRIGHT_HTML_OPEN=never"]]},envClear:{description:"Repeatable runtime environment variable names to clear before linked-test execution.",examples:[["PLAYWRIGHT_BASE_URL"]]},sharedHostSafe:{description:"Apply additive shared-host-safe runtime defaults during linked-test execution."},pmContext:{description:"PM linked-test context mode (schema keeps isolated tracker data; tracker seeds source tracker data; auto uses tracker for PM tracker-read linked commands).",examples:["schema","tracker","auto"]},overrideLinkedPmContext:{description:"Force run-level --pm-context to override per-linked-test pm_context_mode metadata for all linked-test entries."},workspaceContext:{description:"Source-workspace mode: source preserves read-only source context, isolated omits it for self-sandboxing commands, and snapshot runs from a temporary workspace paired with the selected tracker sandbox.",examples:["source","isolated","snapshot"]},overrideLinkedWorkspaceContext:{description:"Force run-level --workspace-context over per-linked-test workspace_context_mode metadata."},allowUntrustedLinkedTests:{description:"Explicitly execute commands not yet trusted by this clone when testing.allow_untrusted_linked_tests is also enabled."},acknowledgeLinkedTests:{description:"Record clone-local trust for the item's current linked commands without executing them."},failOnContextMismatch:{description:"Fail linked PM command runs when source and sandbox tracker item counts differ."},failOnSkipped:{description:"Treat skipped linked tests as dependency-failed policy violations."},failOnEmptyTestRun:{description:"Treat successful linked-test commands that report zero executed tests as failures."},requireAssertionsForPm:{description:"Require assertion metadata for linked PM command test entries during run execution."},checkContext:{description:"Run linked PM command context preflight diagnostics before command execution."},autoPmContext:{description:"Auto-remediate PM tracker-read linked commands by routing those entries through tracker context regardless of linked-test pm_context_mode overrides."},measure:{description:"Repeatable numeric run evidence in name=value[,unit=...][,threshold=...] form.",examples:[["coverage=100,unit=percent,threshold=100"]]},metricBelow:{description:"Return recorded evidence below a name=value threshold.",examples:["coverage=100"]},metricDiff:{description:"Compare the latest and previous values for one metric.",examples:["coverage"]},dryRun:{description:"Preview command effects without mutating storage artifacts."},normalizeProvenance:{description:"For history-repair: remove invalid legacy provenance observations and emit only aggregate privacy-safe repair evidence."},salvageTail:{description:"For history-repair with one explicit id: remove an invalid trailing suffix after a verified prefix; refuses interior corruption."},all:{description:"For history-repair action: scan every stream for drift and repair each drifted stream in one audited pass (mutually exclusive with id)."},clear:{description:"For focus action: clear the session focused item instead of setting it (mutually exclusive with id)."},gcScope:{description:"Repeatable gc scope selector values (index, embeddings, runtime, locks, checkpoints, transactions).",examples:[["index","embeddings"],["runtime"],["locks"],["checkpoints"]]},storage:{description:"For stats action: include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries) for compaction and storage planning."},fieldUtilization:{description:"For stats action: include a field_utilization block reporting present/total/percent for content fields (notes, learnings, files, docs, tests, comments, deps, body, linked_command) across all items so under-documented dimensions are visible at a glance."},measurements:{description:"For stats action: include the audited append-only improvement ledger and baseline-to-latest trends."},metric:{description:"Exact improvement metric name used to filter ledger reads.",examples:["quality.coverage.lines"]},measurementLimit:{description:"Maximum newest improvement observations returned by stats.",examples:[50]},observe:{description:"Repeatable audited observation in name=value[,unit=...][,threshold=...] form.",examples:[["quality.coverage.lines=100,unit=percent,threshold=100"]]},improvementDirection:{description:"Improvement direction for newly recorded observations.",examples:["higher","lower","target"]},measurementSource:{description:"Producing gate or instrument for a new observation.",examples:["pnpm coverage"]},measurementItem:{description:"Tracked item that owns an improvement observation.",examples:["pm-123abc"]},measurementRevision:{description:"Explicit source revision for a new observation.",examples:["0123456789abcdef"]},provenanceCoverage:{description:"For stats action: compare configured provenance descriptors with bounded immutable-history observations."},fleetAttribution:{description:"For stats action: derive observational throughput, rework, and defect-escape rates by harness, model, and author source."},eventLimit:{description:"Maximum immutable history events consumed by an analytics projection.",examples:[1e4]},minimumSample:{description:"Minimum denominator before analytics rates are reported.",examples:[5]},offset:{description:"Number of matching rows to skip before limit is applied.",examples:[0,50,"100"]},provenance:{description:"Return patch-free immutable author, harness, instance, and extensible provenance rows."},provenanceSummary:{description:"Include bounded observed, unavailable, legacy-missing, and unresolved-author counts."},agentInstance:{description:"Privacy-safe agent invocation fingerprint filter, supplied once or as a list.",examples:["a1b2c3d4",["a1b2c3d4","e5f6g7h8"]]},provenanceFilter:{description:"Exact extensible provenance predicate in dimension=value form, supplied once or as a list.",examples:["model=gpt-5.6-sol",["effort=xhigh","role=reviewer"]]},before:{description:"For history-compact, compact entries strictly before this boundary (version number or ISO timestamp). Single-id mode only.",examples:["5","2026-06-01T00:00:00.000Z"]},at:{description:"Read-only historical projection boundary as an item version or ISO timestamp.",examples:["3","2026-07-01T12:00:00.000Z"]},allOver:{description:"For history-compact bulk mode, compact every stream with more than N entries. When history.compact_policy is enabled and this is omitted, the policy's max_entries is used.",examples:[200,"500"]},minEntries:{description:"For history-compact bulk mode, skip streams with at most N entries as already-compact (default 3).",examples:[3,"10"]},closed:{description:"For history-compact bulk mode, compact only closed (terminal) items' history streams."},allStreams:{description:"For history-compact bulk mode, compact every history stream regardless of lifecycle state."},literal:{description:"Repeatable literal matcher used by history-redact to scrub exact string values.",examples:["[redacted_path_prefix]/private/path"]},regex:{description:"Repeatable regex matcher used by history-redact. Accepts either /pattern/flags or a raw pattern (global mode is auto-enabled).",examples:["/192\\\\.168\\\\.[0-9.]+/g","token=[A-Za-z0-9_-]+"]},replacement:{description:'Replacement text used by history-redact (defaults to "[redacted]").',examples:["[scrubbed_path]"]},validateClose:{description:'Close-time metadata validation mode ("off", "warn", or "strict").',examples:["off","warn","strict"]},checkMetadata:{description:"Run metadata completeness checks."},metadataProfile:{description:"Select metadata validation profile for --check-metadata.",examples:["core","strict","custom"]},checkResolution:{description:"Run closed-item resolution metadata checks."},checkCompleteness:{description:"Evaluate declarative lifecycle field requirements, with per-type counts and bounded missing-field diagnostics."},checkLifecycle:{description:"Run active-item lifecycle governance drift checks."},checkStaleBlockers:{description:"Include stale blocker-pattern diagnostics in lifecycle checks."},dependencyCycleSeverity:{description:"Set dependency-cycle warning policy for lifecycle checks.",examples:["off","warn","error"]},parentCycleSeverity:{description:"Set parent-cycle warning policy for lifecycle checks.",examples:["off","warn","error"]},checkFiles:{description:"Run linked-file and orphaned-file checks."},checkStorageIntegrity:{description:"Run deep item, history, index, and vector storage integrity checks."},strictDirectories:{description:"Treat optional item-type directories as required health failures."},requireMergeDrivers:{description:"Treat never-installed clone-local semantic merge drivers as required health failures."},checkOnly:{description:"For health action, run read-only diagnostics without refreshing vectors."},checkTelemetry:{description:"For health action, probe telemetry endpoint health and include network diagnostics."},noRefresh:{description:"For health action, skip vector refresh while still running checks."},refreshVectors:{description:"For health action, explicitly refresh stale vectors."},verboseStaleItems:{description:"For health action, include full stale-item arrays in vectorization details."},verboseAuthorEvents:{description:"For health action, include every actionable unknown-author event coordinate."},skipVectors:{description:"For health action, skip vectorization checks for a faster diagnostic run."},skipIntegrity:{description:"For health action, skip item/history file integrity checks for a faster diagnostic run."},skipDrift:{description:"For health action, skip history drift hash checks for a faster diagnostic run."},scanMode:{description:"Select file candidate scan mode for --check-files.",examples:["default","tracked-all","tracked-all-strict"]},includePmInternals:{description:"Include PM storage internals in tracked-all candidate scans."},verboseFileLists:{description:"For validate action, include full file-path lists for --check-files details."},verboseDiagnostics:{description:"For validate action, include full diagnostic ID lists instead of compact summaries."},strictExit:{description:"Apply the selected capability's strict exit policy; health also requires merge drivers."},failOnWarn:{description:"Alias for strictExit in health, validation, history, and managed doctor actions."},fixHints:{description:"For validate action, add a machine-executable fix_hints[] of pm commands to each failing check's details."},autoFix:{description:"For validate action, apply the safe, deterministic subset of fix-hint remediations (field backfills) automatically; combine with dryRun to preview and fixScope to grant gated scopes."},fixScope:{description:"For validate action, grant --auto-fix scopes (metadata, resolution, estimates, lifecycle). Defaults to the safe scopes metadata and resolution; estimates (per-type default estimated_minutes backfill) and lifecycle must be named explicitly.",examples:[["estimates"],["lifecycle"],["metadata","resolution"]]},pruneMissing:{description:"For validate action, remove stale linked-file/doc LINKS whose paths classified as deleted (link removal only \u2014 never touches real files); honors dryRun."},checkHistoryDrift:{description:"Run item/history hash drift checks."},checkCommandReferences:{description:"Run linked-command PM-ID reference checks."},edit:{description:"For comments, notes, and learnings actions, replace the annotation at this 1-based index with supplied replacement text."},delete:{description:"For comments, notes, and learnings actions, delete the annotation at this 1-based index."},stdin:{description:"For comments, notes, and learnings actions, read annotation text from piped stdin (supports multiline markdown)."},file:{description:"CLI-only path to an input file for commands that read payload text; tool actions exclude host file access.",examples:["notes/comment.md"]},preserveSourceIds:{description:"Preserve explicit source IDs during Beads imports instead of normalizing to tracker prefix.",examples:[!0]},appendStable:{description:"When true for files action, preserve existing linked-file order and append new links without full-array resorting."},discover:{description:"When true for files action, use `pm files discover <id>` to scan item text for referenced file paths."},apply:{description:"Persist changes instead of returning a dry-run preview: for files discovery, add the missing discovered file links; for schema add-type --infer, register the inferred custom item types."},discoveryNote:{description:"Note attached to file links added by files discovery.",examples:["discovered from item text"]},addNote:{description:"Note attached to every link added by add/addGlob in this call (per-entry embedded note= wins; requires add or addGlob). Maps to the CLI --note flag on pm files/pm docs.",examples:["command wiring"]},list:{description:"When true, list command-specific entries without mutating state (for example linked paths for files/docs or topics for guide).",examples:[!0]},stream:{description:"Stream selector: test-runs logs accepts stdout|stderr|both; activity accepts boolean/rows|ndjson|jsonl for line-delimited output.",examples:["stderr","stdout","both","rows","ndjson","jsonl",!0]},tail:{description:"Number of lines to tail for background run logs.",examples:[100]},query:{description:"Search query text for search action."},for:{description:"Named context intent projection declared for the selected read action.",examples:["orient","inspect","triage","execute","discover"]},keywords:{description:"Alias for query in search action payloads."},includeLinked:{description:"Include readable linked docs/files/tests content in keyword and hybrid lexical scoring."},titleExact:{description:"For search action, require exact normalized title match for the full query string."},phraseExact:{description:"For search action, require exact normalized query phrase match in item text fields."},highlight:{description:"For search action, emit per-field matched-text snippets (wrapped in \xAB\u2026\xBB) on each hit. Off by default."},includeBody:{description:"When true for list-family actions, include item body text in projected rows."},noTruncate:{description:"When true for list-family actions, return every matched row, overriding any limit (surfaces total when rows were dropped)."},strictRead:{description:"When true for list-family actions, fail if any source item or item directory cannot be read."},compact:{description:"Render compact projection output for search and list-family actions."},raw:{description:"For activity, restore the compact per-event stream instead of the default item digest."},brief:{description:"Emit compact low-token output for commands that support terse projections or health details.",examples:[!0]},full:{description:"Enable command-specific full/detail output mode when supported, such as deep item reads for get or full payload mode for search/history."},includeEmpty:{description:"For stats, restore zero-count registered type and lifecycle-status buckets."},fields:{description:"Comma-separated projection fields for get, search, list-family, or context outputs. Valid field names are command-specific (e.g. score/matched_fields apply to search; context projects focus-row fields such as priority/deadline/completion_pct).",examples:["id,title,status,parent,type","id,title,score,matched_fields","id,title,priority,deadline"]},groupBy:{description:"Comma-separated aggregate grouping fields (supported: parent,type,priority,status,assignee,tags,sprint,release).",examples:["parent,type","type,status","priority,assignee","tags","sprint,release"]},setMode:{description:"Aggregate array dimensions by distinct element (default), or by the complete normalized tuple. Empty sets retain a null group.",examples:["element","tuple"]},count:{description:"Enable grouped count output for aggregate action."},completion:{description:"For aggregate action, add open/in_progress/closed/other counts and completion_pct per group."},sum:{description:"Numeric field to sum per aggregate group (count and null_count are still returned).",examples:["estimated_minutes","priority"]},avg:{description:"Numeric field to average per aggregate group (count and null_count are still returned).",examples:["estimated_minutes","priority"]},tree:{description:"When true for list/get actions, render recursive parent/child tree ordering."},treeDepth:{description:"Maximum recursion depth for tree output (0 keeps root rows only).",examples:[0,1,"2"]},includeUnparented:{description:"Include unparented rows when aggregate grouping includes parent."},maxDepth:{description:"Maximum dependency traversal depth for deps action (0 keeps only the root node).",examples:[0,1,"2"]},nodeLimit:{description:"Maximum related nodes returned by deps --format context.",examples:[10,"20"]},edgeLimit:{description:"Maximum related edges returned by deps --format context.",examples:[20,"40"]},tokenBudget:{description:"Maximum estimated output tokens for the command output.",examples:[600,"1200"]},cursor:{description:"Opaque continuation cursor returned by deps --format context."},direction:{description:'Graph-context traversal direction for deps action ("outgoing", "incoming", or "both").',examples:["both","incoming"]},kind:{description:"Registered relationship kinds narrowing deps --format context traversal (string, comma-separated, or array).",examples:["blocked_by",["parent","related"]]},after:{description:"Opaque action-specific continuation cursor returned by the preceding bounded query.",examples:["pm-x1y2"]},maxPaths:{description:"Maximum enumerated paths for graph paths queries.",examples:[5,"10"]},sample:{description:"Maximum evidence sample entries per graph audit finding.",examples:[10,"25"]},exemptIsolate:{description:"Item ids the graph audit treats as explicitly valid isolates (string, comma-separated, or array).",examples:["pm-x1y2",["pm-x1y2","pm-a3b4"]]},exemptIsolateType:{description:"Item types whose active isolates the graph audit treats as policy-valid (string, comma-separated, or array).",examples:["Reminder",["Reminder","Event"]]},saveBaseline:{description:"When true, persist the graph audit census as the change-since-baseline comparison point (audit only)."},rebuild:{description:"When true, rebuild and warm the durable graph index (graph index only)."},collapse:{description:'Dependency tree collapse mode for deps action ("none" or "repeated").',examples:["none","repeated"]},summary:{description:"When true, return the command's compact summary projection (deps counts, health rollup, or contracts command intents)."},shell:{description:"Shell target for completion generation.",examples:["bash"]},eagerTags:{description:"When true for completion, eagerly embed current tracker tags into generated scripts (legacy mode)."},contractAction:{description:"Filter contracts schema to one tool action.",examples:["create","update"]},command:{description:"Scope contracts output to one CLI command name; action/schema surfaces narrow by default.",examples:["create","search","list"]},schemaOnly:{description:"When true, contracts action returns schema-focused payloads (mutually exclusive with flagsOnly/availabilityOnly)."},flagsOnly:{description:"When true, contracts action returns only command flag surface payloads (mutually exclusive projection mode)."},availabilityOnly:{description:"When true, contracts action returns only action availability payloads (mutually exclusive projection mode)."},runtimeOnly:{description:"When true, contracts action only includes actions invocable in the current runtime."},activeOnly:{description:"Alias for runtimeOnly in contracts action payloads."},depth:{description:"Context depth level controlling how many sections are included (brief=focus+agenda, standard=+hierarchy/activity/progress/workload, deep=all sections, full=every section with no per-section row cap).",examples:["brief","standard","deep","full"]},section:{description:"Repeatable section selector for context; overrides --depth when provided.",examples:[["hierarchy","activity"],["blockers","files","staleness"]]},activityLimit:{description:"Maximum number of recent activity entries to include in context output.",examples:[5,10,"20"]},staleThreshold:{description:"Staleness cutoff in days for context staleness section (e.g. 7 or 7d).",examples:["7","14d","30"]}},fv={health:{strictExit:{description:"Return non-zero for a failing health verdict; also require merge drivers."}},validate:{strictExit:{description:"Return non-zero when validation reports warnings."}},"extension-doctor":{strictExit:{description:"Return non-zero when extension diagnostics report warnings or a non-ok summary."}},"package-doctor":{strictExit:{description:"Return non-zero when package diagnostics report warnings or a non-ok summary."}},history:{strictExit:{description:"Return non-zero for history verification failures when verify is enabled."}},extension:{strictExit:{description:"For doctor operations, return non-zero on warnings or a non-ok diagnostic summary."}},package:{strictExit:{description:"For doctor operations, return non-zero on warnings or a non-ok diagnostic summary."}},assurance:{subcommand:{description:"Assurance operation: list, show, put, remove, run, verdicts, presets, apply, derive, promote, risk, or lineages.",examples:["list","run","risk","lineages"]},kind:{description:"Assurance declaration kind for registry operations: measurement, assertion, or gate.",examples:["measurement","assertion","gate"]},id:{description:"Stable assurance declaration id or gate id, depending on subcommand.",examples:["active-issues","release-readiness"]},limit:{description:"Maximum number of newest assurance verdicts returned.",examples:[10,25]},preset:{description:"Built-in assurance project shape to preview or apply.",examples:["software-delivery","agent-evaluation"]}},update:{acceptanceCriteria:{description:"Complete acceptance-criteria replacement text. Use removeAc plus addAc together for an atomic one-entry repair that preserves unrelated criteria."}},"update-many":{acceptanceCriteria:{description:"Complete acceptance-criteria replacement text. Use removeAc plus addAc together for an atomic one-entry repair that preserves unrelated criteria."}},stats:{since:{description:"Inclusive ISO 8601 timestamp or negative duration lower bound for provenance and fleet analytics.",examples:["2026-08-01T00:00:00.000Z","-30d"]}},events:{since:{description:"Durable event cursor returned as next_cursor, or an inclusive event timestamp.",examples:["eyJmaW5nZXJwcmludCI6Ii4uLiJ9","2026-08-01T00:00:00.000Z"]},type:{description:"Mutation event type filter, supplied once or as a list.",examples:["create",["create","update"]]},author:{description:"Mutation author filter, supplied once or as a list.",examples:["agent-a",["agent-a","agent-b"]]},item:{description:"Tracked item id filter, supplied once or as a list.",examples:["pm-a1b2",["pm-a1b2","pm-c3d4"]]},limit:{description:"Maximum mutation events returned, from 0 through 1000.",examples:[0,100]},cursorMode:{description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event.",examples:["batch","row"]}},remind:{at:{description:"Reminder time as an ISO 8601 timestamp or supported relative expression.",examples:["2026-08-02T09:00:00+02:00","tomorrow 09:00"]}},deps:{tokenBudget:{description:"Maximum estimated output tokens for deps --format context.",examples:[600,"1200"]}},comments:{full:{description:"Return the complete post-mutation comment history instead of the bounded mutation receipt projection."},ifAbsent:{description:"Append a comment only when the resolved author and exact stored text are absent; a duplicate retry returns changed false without writing history."}},notes:{full:{description:"Return the complete post-mutation note history instead of the bounded mutation receipt projection."},ifAbsent:{description:"Append a note only when the resolved author and exact stored text are absent; a duplicate retry returns changed false without writing history."},since:{description:"Inclusive ISO 8601 creation timestamp lower bound for structured note event filtering.",examples:["2026-01-01T00:00:00.000Z"]}},learnings:{full:{description:"Return the complete post-mutation learning history instead of the bounded mutation receipt projection."},ifAbsent:{description:"Append a learning only when the resolved author and exact stored text are absent; a duplicate retry returns changed false without writing history."}},next:{tag:{description:"Only recommend items carrying this exact tag.",examples:["sdk","release"]},tokenBudget:{description:"Maximum estimated output tokens for the recommendation context.",examples:[600,"1200"]}},claim:{tag:{description:"When claiming the next item, only consider work carrying this exact tag.",examples:["sdk","release"]},tokenBudget:{description:"Maximum estimated output tokens for the next-item context returned with the claim.",examples:[600,"1200"]}},close:{text:{description:"Backward-compatible alias for the item close reason when reason is not provided."}},"close-task":{text:{description:"Close reason used before releasing the item's active assignment."}},schema:{definition:{description:"Workflow policy declaration for policy-put, or proposed item fields for policy-check."},policy:{description:"Declared approval rule id for policy-approve."},name:{description:"Custom item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse.",examples:["Spike","review","component"]}},profile:{name:{description:"Profile name for show/apply/lint. Built-in profiles are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too.",examples:["agile","ops","research"]}},graph:{subcommand:{description:"Graph query selector: ancestors|descendants|predecessors|successors|paths|impact|analyze|audit|communities|redundancy|dominators|slack|centrality|articulation|plan|index. Traversals, paths, impact, and dominators require id; paths also requires target; slack reports critical-path float, centrality ranks betweenness/closeness/degree, articulation reports cut points and bridges; plan derives dry-run remediation proposals from the governance audit; index reports, rebuilds, or clears the durable cross-process graph index.",examples:["successors","audit"]},clear:{description:"When true, delete the durable graph index (graph index only)."},id:{description:"Root item id for traversal, paths, impact, and dominators graph queries.",examples:["pm-x1y2"]},target:{description:"Target item id for graph paths queries.",examples:["pm-a3b4"]},direction:{description:'Edge orientation for graph paths/impact/dominators queries ("outgoing", "incoming", or "both"; default "both").',examples:["incoming"]},kind:{description:"Registered relationship kinds narrowing the graph query (string, comma-separated, or array).",examples:["blocked_by",["parent","related"]]},maxDepth:{description:"Maximum graph traversal depth (non-negative integer).",examples:[2,"4"]},after:{description:"Resume a hierarchy/ordering graph traversal after this previously returned node id.",examples:["pm-x1y2"]},limit:{description:"Maximum returned rows per bounded graph collection (traversal ids, impact rows, analyze/communities samples, redundancy rows, dominator bottlenecks).",examples:[10,"25"]},summary:{description:"When true, return counts-first graph envelopes without row collections."}}};(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]="415b46ad-d836-5593-8b6d-af08bbaba0c2")}catch{}})();var k$={...dv,"history-attest":{verify:{type:"object",additionalProperties:!0},output:{not:{}}}},Va={...Af,pause:{type:"boolean"},releaseAssignment:{type:"boolean"},hashAlgorithm:{type:"string",enum:["sha256","sha512"]}},Ya={...uv,pause:{description:"Return work to its configured open status before releasing ownership."},releaseAssignment:{description:"Release assignment after recording closure evidence."},hashAlgorithm:{description:"Digest for detached history bundles; defaults to sha256."}},E$=["json","quiet","profile","noExtensions","noPager","tokenAccounting","path","pmExecutable","timeoutMs"],S$=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor","outputRowContract"],T$=new Set(["action","cwd","options",...Object.keys(Va).filter(e=>e!=="severity")]);var A$={create:["fullChangedFields","idOnly"],copy:["fullChangedFields","idOnly"],update:["fullChangedFields","idOnly"],"item-reopen":["fullChangedFields","idOnly"],close:["fullChangedFields","idOnly"],claim:["fullChangedFields","idOnly"],release:["fullChangedFields","idOnly"],"start-task":["fullChangedFields","idOnly"],"pause-task":["fullChangedFields","idOnly"],"close-task":["fullChangedFields","idOnly"],restore:["fullChangedFields","idOnly"],append:["fullChangedFields"],"update-many":["fullChangedFields"],"close-many":["fullChangedFields"],assurance:["fullChangedFields","idOnly"]},wv=["createMode","status","deadline","estimate","acceptanceCriteria","definitionOfReady","order","rank","goal","objective","value","impact","outcome","whyNow","assignee","reviewer","risk","confidence","sprint","release","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact","comment","note","learning","reminder","event","typeOption"],mne=Object.freeze({"close-many":["list","expected_result","expected","actual_result","actual","validate_close","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],"update-many":["list","update","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],...Object.fromEntries(kn.filter(e=>e==="upgrade"||e==="install"||e==="extension"||e==="package"||e.startsWith("extension-")||e.startsWith("package-")).map(e=>[e,["project","local","global"]]))});function it(e){return _f(e)}var I$=it([...af.map(e=>e.param),...qa.map(e=>e.param),"assignee","closeReason","completedAt"]),bv=it([...cf.map(e=>e.param),...qa.map(e=>e.param),"force"]),C$=it([...df.map(e=>e.param),...bv.filter(e=>e!=="allowMissingParent"&&e!=="completedAt"),"dryRun","rollback","noCheckpoint"]),O$=it([...uf.map(e=>e.param),"reason","completedAt","resolution","expectedResult","actualResult","validateClose","dryRun","rollback","noCheckpoint","author","message","force"]),mv=it([...mf.map(e=>e.param),"past","section"]),x$=it([...ff.map(e=>e.param),"stream"]),Of=it([...rf.map(e=>e.param),"all","includeBody","noTruncate","strictRead","compact","brief","full"]),oo=Of.filter(e=>e!=="all"&&e!=="status"),Dn=[[{property:"today",schema:{const:!0}},{property:"recent",schema:{const:!0}}],[{property:"today",schema:{const:!0}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}],[{property:"recent",schema:{const:!0}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}]],R$=[[{property:"summary",schema:{const:!0}},{property:"schemaOnly",schema:{const:!0}}],[{property:"summary",schema:{const:!0}},{property:"flagsOnly",schema:{const:!0}}],[{property:"summary",schema:{const:!0}},{property:"availabilityOnly",schema:{const:!0}}],[{property:"schemaOnly",schema:{const:!0}},{property:"flagsOnly",schema:{const:!0}}],[{property:"schemaOnly",schema:{const:!0}},{property:"availabilityOnly",schema:{const:!0}}],[{property:"flagsOnly",schema:{const:!0}},{property:"availabilityOnly",schema:{const:!0}}]],N$=it([...of.map(e=>e.param),"count","completion","includeUnparented"]),D$=it(["query","keywords","mode","semantic","hybrid","includeLinked","titleExact","phraseExact","highlight","compact","full",...sf.map(e=>e.param)]),pv=it(["type","tag","priority","assignee","assigneeFilter","sprint","release","parent","limit","blockedLimit","readyOnly","format","includeDecisions","includeGates","includeContainers","tokenBudget","explainRanking"]),Je=["author","message","force"],vv=["releaseAssignment","text","reason","closeReason","completedAt","duplicateOf","validateClose","resolution","expectedResult","actualResult"],Ri=["author","assignee","message","force"],P$=["dryRun","target","scope","capability","declarative","github","ref","init","install","uninstall","explore","manage","describe","markdown","output","reload","doctor","catalog","list","adopt","adoptAll","activate","deactivate","runtimeProbe","fixManagedState","isolated","ignoreGlobal","detail","trace","watch","strictExit","failOnWarn"];function _v(e){return{[`${e}-init`]:{required:["target"],optional:["scope","capability",...e==="package"?["declarative"]:[]]},[`${e}-install`]:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},[`${e}-uninstall`]:{required:["target"],optional:["scope"]},[`${e}-explore`]:{optional:["scope"]},[`${e}-manage`]:{optional:["scope","runtimeProbe","fixManagedState"]},[`${e}-describe`]:{optional:["target","scope","markdown","output"]},[`${e}-reload`]:{optional:["scope","watch"]},[`${e}-doctor`]:{optional:["scope","detail","trace","fixManagedState","isolated","ignoreGlobal","strictExit","failOnWarn"]},[`${e}-catalog`]:{optional:["scope","fields"]},[`${e}-adopt`]:{required:["target"],optional:["scope","github","ref"]},[`${e}-adopt-all`]:{optional:["scope"]},[`${e}-activate`]:{required:["target"],optional:["scope"]},[`${e}-deactivate`]:{required:["target"],optional:["scope"]},[e]:{optional:P$,dependentAnyOfRequired:[{property:"dryRun",value:!0,anyOfRequired:[["install","target"],["install","github"]]}],mutuallyExclusiveWhen:[[{property:"dryRun",schema:{const:!0}},{property:"install",schema:{const:!1}}]]}}}var gv={required:["title"],optional:["start","duration","end","location","timezone","allDay","parent","allowMissingParent","tags","priority","body","description","author","message"]},hv={optional:["target","scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"]},Ka={init:{optional:["prefix","idPrefix","workspace","preset","typePreset","defaults","author","agentGuidance","withPackages","mergeFence","force","verbose"]},config:{required:["scope","configAction"],optional:["key","value","criterion","clearCriteria","format","policy"]},..._v("extension"),..._v("package"),"package-upgrade":hv,install:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},upgrade:hv,create:{required:["title","description","type","status","priority","message"],optional:I$},copy:{required:["id"],optional:["title","author","message","allowDuplicate"]},focus:{optional:["id","clear"],mutuallyExclusive:[["id","clear"]]},list:{optional:Of,mutuallyExclusiveWhen:Dn},"list-all":{optional:Of,mutuallyExclusiveWhen:Dn},"list-draft":{optional:oo,mutuallyExclusiveWhen:Dn},"list-open":{optional:oo,mutuallyExclusiveWhen:Dn},"list-in-progress":{optional:oo,mutuallyExclusiveWhen:Dn},"list-blocked":{optional:oo,mutuallyExclusiveWhen:Dn},"list-closed":{optional:oo,mutuallyExclusiveWhen:Dn},"list-canceled":{optional:oo,mutuallyExclusiveWhen:Dn},aggregate:{optional:N$},guide:{optional:["list","format","depth"]},context:{optional:mv},ctx:{optional:mv},get:{required:["id"],optional:["for","tokenBudget","at","depth","full","fields","tree","treeDepth","format"]},search:{optional:D$,anyOfRequired:[["query"],["keywords"]]},eval:{optional:["mode","k","failUnder","queries","format"]},events:{optional:["since","type","author","item","limit","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","cursorMode"]},merge:{required:["subcommand"],optional:["dryRun","author","message","force","includeReconciled","artifact","basePath","oursPath","theirsPath","output","outputPath","itemPath","prefer"]},workspace:{required:["subcommand"],optional:["snapshotAction","name","target","dryRun","force","author","message","lockTtlSeconds","lockWaitMs"],conditionalRequired:[{property:"subcommand",value:"snapshot",required:["snapshotAction"]}]},meet:gv,event:gv,remind:{required:["title"],optional:["at","text","parent","allowMissingParent","tags","priority","body","description","author","message"]},next:{optional:[...pv,"for"]},reindex:{optional:["mode","progress"]},history:{required:["id"],optional:["limit","compact","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","diff","verify","field","strictExit","failOnWarn","format"]},"history-attest":{optional:["verify","output","hashAlgorithm"],mutuallyExclusive:[["verify","hashAlgorithm"]]},"history-redact":{required:["id"],optional:["literal","regex","replacement","dryRun",...Je],anyOfRequired:[["literal"],["regex"]]},"history-repair":{optional:["id","all","dryRun","normalizeProvenance","salvageTail",...Je],oneOfRequired:[["id"],["all"]],mutuallyExclusiveWhen:[[{property:"salvageTail",schema:{const:!0}},{property:"all",schema:{const:!0}}],[{property:"salvageTail",schema:{const:!0}},{property:"normalizeProvenance",schema:{const:!0}}]]},"history-author-acknowledge":{optional:["historyEvent","allActionable","dryRun","planFingerprint","limit","attributedAuthor","reviewer","reason"],oneOfRequired:[["historyEvent"],["allActionable"]]},"history-compact":{optional:["id","before","ids","allOver","closed","allStreams","minEntries","dryRun",...Je]},schema:{mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"policy-mode"}},{property:"name",schema:{not:{enum:["advise","refuse"]}}}]],required:["subcommand"],optional:["definition","policy","message","name","description","defaultStatus","folder","alias","role","order","fieldType","commands","cliFlag","required","requiredOnCreate","allowUnset","requiredTypes","typePreset","infer","minCount","apply","to","migrationId","fieldTypeScope","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"policy-put",required:["definition"]},{property:"subcommand",value:"policy-remove",required:["name"]},{property:"subcommand",value:"policy-mode",required:["name"]},{property:"subcommand",value:"policy-check",required:["name"]},{property:"subcommand",value:"policy-approve",required:["name","policy"]},{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"show-status",required:["name"]},{property:"subcommand",value:"add-type",required:["name"]},{property:"subcommand",value:"remove-type",required:["name"]},{property:"subcommand",value:"add-status",required:["name"]},{property:"subcommand",value:"remove-status",required:["name"]},{property:"subcommand",value:"add-field",required:["name"]},{property:"subcommand",value:"remove-field",required:["name"]},{property:"subcommand",value:"show-field",required:["name"]},{property:"subcommand",value:"rename-type",required:["name","to"]},{property:"subcommand",value:"rename-field",required:["name","to"]},{property:"subcommand",value:"remap-status",required:["name","to"]},{property:"subcommand",value:"apply-preset",required:["typePreset"]}]},profile:{required:["subcommand"],optional:["name","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"apply",required:["name"]},{property:"subcommand",value:"lint",required:["name"]}]},plan:{required:["subcommand"],optional:["id","stepRef","reorderTo","title","description","template","scope","parent","related","blocks","blockedBy","harness","mode","resumeContext","tags","priority",...wv,"body","claim","fromSearch","stepTitle","step","stepBody","stepOwner","stepStatus","stepEvidence","stepBlockedReason","stepReplacement","dependsOn","link","linkKind","linkNote","promoteToItemDep","allowMultipleActive","file","test","doc","decisionText","decision","decisionRationale","decisionEvidence","discoveryText","discovery","validationText","validation","validationCommand","validationExpected","depth","fields","steps","materializeType","materializeParent","materializeTags","field",...Je]},activity:{optional:x$},restore:{required:["id","target"],optional:Je},update:{required:["id"],optional:bv,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},"update-many":{optional:C$,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},close:{required:["id"],optional:[...vv,...Je]},"close-many":{optional:O$},delete:{required:["id"],optional:["dryRun",...Je]},append:{required:["id","body"],optional:Je},comments:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...Je],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},notes:{required:["id"],optional:["text","add","addJson","stdin","edit","delete","limit","since","eventType","includeMeta","full","ifAbsent",...Je],mutuallyExclusive:[["addJson","add"],["addJson","stdin"],["addJson","file"],["addJson","edit"],["addJson","delete"],["edit","ifAbsent"],["delete","ifAbsent"]]},learnings:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...Je],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},files:{required:[],optional:["id","add","addGlob","remove","migrate","list","addNote","discover","apply","discoveryNote","appendStable","validatePaths","lookupPath","scope","limit","offset","noTruncate","strictRead","explain","lines","decisionDepth",...Je],anyOfRequired:[["id"],["lookupPath"]],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},docs:{required:["id"],optional:["add","addGlob","remove","migrate","addNote","list","validatePaths",...Je],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},deps:{required:["id"],optional:["format","maxDepth","collapse","summary","full","nodeLimit","edgeLimit","tokenBudget","cursor","direction","kind"]},graph:{required:["subcommand"],optional:["id","target","kind","maxDepth","limit","after","direction","maxPaths","sample","exemptIsolate","exemptIsolateType","saveBaseline","rebuild","clear","summary","full"]},test:{required:["id"],optional:["list","add","addJson","remove","removeIndex","run","match","onlyIndex","onlyLast","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","acknowledgeLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext","measure","metricBelow","metricDiff",...Je],mutuallyExclusive:[["acknowledgeLinkedTests","run"],["acknowledgeLinkedTests","background"]]},"test-all":{optional:["status","limit","offset","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext"]},telemetry:{optional:["subcommand","limit"]},"test-runs-list":{optional:["status","limit"]},"test-runs-status":{required:["runId"]},"test-runs-logs":{required:["runId"],optional:["stream","tail"]},"test-runs-stop":{required:["runId"],optional:["force"]},"test-runs-resume":{required:["runId"],optional:["author"]},stats:{optional:["includeEmpty","storage","metadataCoverage","fieldUtilization","byAssignee","byTag","byPriority","tagPrefix","measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]},duplicates:{optional:["status","since","threshold","limit","exhaustive"]},health:{optional:["strictDirectories","requireMergeDrivers","strictExit","failOnWarn","checkOnly","checkTelemetry","noRefresh","refreshVectors","verboseStaleItems","verboseAuthorEvents","brief","summary","skipVectors","skipIntegrity","skipDrift","full"]},validate:{optional:["checkCompleteness","checkStorageIntegrity","checkMetadata","metadataProfile","checkResolution","checkLifecycle","checkStaleBlockers","dependencyCycleSeverity","parentCycleSeverity","checkFiles","scanMode","includePmInternals","verboseFileLists","verboseDiagnostics","allAffectedIds","strictExit","failOnWarn","fixHints","autoFix","dryRun","fixScope","pruneMissing","checkHistoryDrift","checkCommandReferences","counts","full"]},assurance:{required:["subcommand"],optional:["kind","id","definition","trigger","treeId","gate","limit","dryRun","author","message","preset","owner","apply","enforcement"],conditionalRequired:[{property:"subcommand",value:"list",required:["kind"]},{property:"subcommand",value:"show",required:["kind","id"]},{property:"subcommand",value:"put",required:["kind","id","definition"]},{property:"subcommand",value:"remove",required:["kind","id"]},{property:"subcommand",value:"run",required:["id","trigger"]},{property:"subcommand",value:"apply",required:["preset","owner"]},{property:"subcommand",value:"derive",required:["owner"]},{property:"subcommand",value:"risk",required:["definition"]},{property:"subcommand",value:"lineages",required:["definition"]},{property:"subcommand",value:"promote",required:["id","enforcement"]}],mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"risk"}},{property:"definition",schema:{not:{required:["policy","change"]}}}],[{property:"subcommand",schema:{const:"lineages"}},{property:"definition",schema:{anyOf:[{required:["change"]},{not:{required:["policy"]}}]}}]]},gc:{optional:["dryRun","gcScope"]},contracts:{optional:["contractAction","command","summary","schemaOnly","flagsOnly","availabilityOnly","runtimeOnly","activeOnly","full"],mutuallyExclusiveWhen:R$},completion:{required:["shell"],optional:["eagerTags"]},claim:{optional:["start","id","next","ifAvailable","maxAttempts","includeDecisions",...pv,...Ri],oneOfRequired:[["id"],["next"]],mutuallyExclusiveWhen:[[{property:"start",schema:{const:!0}},{property:"next",schema:{const:!0}}],[{property:"start",schema:{const:!0}},{property:"ifAvailable",schema:{const:!0}}]]},release:{required:["id"],optional:["pause",...Ri]},"start-task":{required:["id"],optional:Ri},"pause-task":{required:["id"],optional:Ri},"close-task":{required:["id"],optional:["text","validateClose",...Ri]},"item-reopen":{required:["id","reason"],optional:["status","author","message","force"]}},L$=Object.freeze(Object.fromEntries(kn.map(e=>[e,Ka[e]])));function kv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").trim().replace(/^./,t=>t.toUpperCase()).concat(".")}function M$(e,t){let n=typeof t=="object"&&t!==null?{...t}:{},r=Ya[e];return{...n,description:r?.description??kv(e),...r?.examples?{examples:r.examples}:{}}}function $$(e,t){if(e==="history-attest"&&t==="verify")return{description:"Compare all retained history streams with a detached JSON proof object. Server-local proof paths are not accepted over MCP."};if(e==="history-attest"&&t==="output")return{description:"Local CLI/SDK only. MCP rejects this field; save the returned JSON bundle on the client."};if(e==="claim"&&t==="start")return{description:"Claim an explicit item and move it to its configured in-progress status."};if((e==="list"||e.startsWith("list-"))&&t==="all")return{description:"Return items from every lifecycle status instead of the default active-status set."};if(e==="plan"&&Object.prototype.hasOwnProperty.call(Cf,t))return Cf[t];let n=fv[e];return n&&Object.prototype.hasOwnProperty.call(n,t)?n[t]:Ya[t]}function F$(e,t,n){let r=typeof n=="object"&&n!==null?{...n}:{},o=$$(e,t);return{...r,description:o?.description??kv(t),...o?.examples?{examples:o.examples}:{}}}function j$(e,t){if(e==="claim"&&t==="start")return{type:"boolean"};let n=k$[e];return n&&Object.prototype.hasOwnProperty.call(n,t)?n[t]:e==="plan"&&Object.prototype.hasOwnProperty.call(If,t)?If[t]:(e==="get"||e==="history"||e==="search")&&t==="format"?{type:"string",enum:["json","toon"]}:t==="pause"||t==="releaseAssignment"||t==="hashAlgorithm"?Va[t]:Af[t]}function U$(e,t){let n={action:{const:e,description:Ya.action?.description??"Tool action to execute."}};for(let r of t){if(r==="action")continue;let o=j$(e,r);o&&(n[r]=F$(e,r,o))}return n}function z$(e,t){let n=t.flat();return t.map(r=>{let o=n.filter(i=>!r.includes(i));return{required:[...r],...o.length>0?{not:{anyOf:o.map(i=>({required:[i]}))}}:{},...e==="history-repair"&&r.includes("all")?{properties:{all:{const:!0}}}:e==="claim"&&r.includes("next")?{properties:{next:{const:!0}}}:{}}})}function yv(e,t){return{...t===void 0?{}:{properties:{[e]:{const:t}}},required:[e]}}function H$(e){let t=[];if(e.conditionalRequired&&e.conditionalRequired.length>0)for(let n of e.conditionalRequired)t.push({if:yv(n.property,n.value),then:{required:n.required}});if(e.dependentAnyOfRequired&&e.dependentAnyOfRequired.length>0)for(let n of e.dependentAnyOfRequired)t.push({if:yv(n.property,n.value),then:{anyOf:n.anyOfRequired.map(r=>({required:[...r]}))}});if(e.mutuallyExclusive&&e.mutuallyExclusive.length>0)for(let n of e.mutuallyExclusive)t.push({not:{required:it(n)}});if(e.mutuallyExclusiveWhen&&e.mutuallyExclusiveWhen.length>0)for(let n of e.mutuallyExclusiveWhen)t.push({not:{allOf:n.map(r=>({properties:{[r.property]:r.schema},required:[r.property]}))}});return t}function Ev(e){if(!Object.prototype.hasOwnProperty.call(Ka,e))return;let t=Ka[e],n=A$[e]??[];return it(["action",...E$,...Uo(e)!==void 0?S$:[],...n,...t.required??[],...t.optional??[]])}function q$(e){let t=Ka[e],n=it(t.required??[]),r=Ev(e),o={type:"object",additionalProperties:!1,required:["action",...n],title:`pm action "${e}" parameters`,properties:U$(e,r)};t.anyOfRequired&&t.anyOfRequired.length>0&&(o.anyOf=t.anyOfRequired.map(s=>({required:[...s]}))),t.oneOfRequired&&t.oneOfRequired.length>0&&(o.oneOf=z$(e,t.oneOfRequired));let i=H$(t);return i.length>0&&(o.allOf=i),o}function Sv(e){let t,n=()=>t??=e();return new Proxy({},{get:(r,o)=>n()[o],has:(r,o)=>o in n(),ownKeys:()=>Reflect.ownKeys(n()),getOwnPropertyDescriptor:(r,o)=>{let i=Reflect.getOwnPropertyDescriptor(n(),o);return i&&(i.configurable=!0),i}})}var xf="4.20.0",Tv=xf.split(".")[0],Av="1.9.0",B$=Sv(()=>({$schema:"https://json-schema.org/draft/2020-12/schema",$id:`https://schema.unbrained.dev/pm-cli/tool-parameters-v${Tv}.schema.json`,title:"pm-cli tool parameters (action-scoped strict schema)","x-schema-version":xf,type:"object",oneOf:kn.map(e=>q$(e))}));function G$(e,t){let n=M$(e,t);if(typeof n.type=="string")return n;let o=(Array.isArray(n.anyOf)?n.anyOf:[]).find(a=>typeof a.type=="string");if(o){let{anyOf:a,...c}=n;return{...o,...c}}let{anyOf:i,...s}=n;return{...s,type:"string"}}function W$(){let e={action:{type:"string",description:Ya.action?.description??"Tool action to execute."},options:{type:"object",additionalProperties:!0,description:"Advanced command options object forwarded to the selected pm action."}};for(let t of Object.keys(Va).sort())e[t]=G$(t,Va[t]);return{title:"pm-cli tool parameters (provider-compatible flat schema)","x-schema-version":Av,type:"object",additionalProperties:!1,required:["action"],properties:e}}var V$=Sv(W$);(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]="48efaa37-f28e-5f2a-a033-456bee15e294")}catch{}})();var wne=new Set([...Tg,...Ag]);(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]="92c17dbe-3868-5fa5-a873-0744d3e7ca8e")}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]="7ffd5046-9154-52e7-94ce-192b07b8ceae")}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]="fb87ff0c-88c8-52f9-9dc3-f37fec674425")}catch{}})();var rF=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),Are=new Set([...rF].filter(e=>e!=="file"));(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]="fd8c4c35-98bb-5f3b-927d-8696125af703")}catch{}})();var oF="2026-07-15T06:22:12.276Z",iF=Date.parse(oF),sF=[["attributed","attributed"],["legacy_unknown","actionable_unknown"]],Cv=e=>typeof e=="string"?e:"",aF=e=>{let t=e??{},n=Cv(t.author).trim().toLowerCase(),r=Number(["","unknown"].includes(n)),o=+(Date.parse(Cv(t.ts))>=iF);return sF[r][o]};function cF(e,t,n=20,r=new Set,o=!1){let i=[],s=[],a={legacy_unknown:0,actionable_unknown:0},c=Math.max(0,n),l=0,d=0,u=0;for(let[f,m]of t.split(/\r?\n/).entries()){let p;try{p=JSON.parse(m)}catch{continue}l+=1;let w=aF(p);if(w!=="attributed"){if(d+=1,w==="actionable_unknown"&&r.has(`${e}:${f+1}`)){u+=1;continue}a[w]+=1,o&&w==="actionable_unknown"&&s.push({item_id:e,line:f+1}),i.length<c&&i.push({item_id:e,line:f+1})}}return{checked_events:l,unknown_event_count:d,legacy_unknown_event_count:a.legacy_unknown,actionable_unknown_event_count:a.actionable_unknown,acknowledged_actionable_event_count:u,samples:i,samples_truncated:a.legacy_unknown+a.actionable_unknown>i.length,actionable_events:s}}function lF(e){let t=new Set;for(let n of e.split(/\r?\n/)){let r;try{r=JSON.parse(n)}catch{continue}let i=(typeof r=="object"&&r!==null&&typeof r.context=="object"&&r.context!==null?r.context:{}).author_acknowledgment;if(!(typeof i!="object"||i===null||!Array.isArray(i.events)))for(let s of i.events)typeof s=="object"&&s!==null&&typeof s.item_id=="string"&&Number.isSafeInteger(s.line)&&t.add(`${s.item_id}:${String(s.line)}`)}return t}var Ja=async(e,t=20,n=!1)=>{let r=Nf.join(e,"history"),o;try{o=(await Rf.readdir(r)).filter(b=>b.endsWith(".jsonl")).sort((b,v)=>b.localeCompare(v))}catch{o=[]}let i=new Set,s=[],a=[],c=0,l=0,d=0,u=0,f=0,m=0,p="_workspace.jsonl",w=new Set;if(o.includes(p))try{w=lF(await Rf.readFile(Nf.join(r,p),"utf8"))}catch{w=new Set}for(let b of o){let v;try{v=await Rf.readFile(Nf.join(r,b),"utf8")}catch{continue}let I=b.slice(0,-6),A=cF(I,v,t-s.length,w,n);c+=1,l+=A.checked_events,d+=A.unknown_event_count,u+=A.legacy_unknown_event_count,f+=A.actionable_unknown_event_count,m+=A.acknowledged_actionable_event_count,A.unknown_event_count>0&&i.add(I),s.push(...A.samples),n&&a.push(...A.actionable_events)}let y=u+f;return{checked_streams:c,checked_events:l,unknown_event_count:d,legacy_unknown_event_count:u,actionable_unknown_event_count:f,acknowledged_actionable_event_count:m,affected_item_ids:[...i].sort((b,v)=>b.localeCompare(v)),samples:s,samples_truncated:y>s.length,...n?{actionable_events:a}:{}}};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f7999053-cf48-5588-b8c8-570789086dac")}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]="e3a1e65b-55d7-5206-b3e7-cac3ac29745c")}catch{}})();var Gre=new Set(kr),dF=new Set(po.map(e=>ve(e.id)).filter(e=>e.length>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]="f9535c02-9214-5d5e-bac0-2dabbe5d395e")}catch{}})();var Xre=new Set(dn),Zre=new Set(Er),Qre=new Set([...Ge.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]);(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]="ebcb45a2-996a-5194-8086-efe882dbcacc")}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]="96cec314-edb6-5c51-abc4-d028bdc4f10c")}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]="0daf7c89-abc5-5c35-ba3f-9772a50408c0")}catch{}})();var Ni={type:"string",minLength:1,maxLength:128,pattern:"\\S"},Xa={type:"array",minItems:1,maxItems:$r,items:Ni},Ov={...Xa,items:{...Ni,pattern:"^(?!(?:.*\\.)?(?:__proto__|constructor|prototype)(?:\\.|$))[a-zA-Z_][a-zA-Z0-9_]*(?:\\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$"}},aoe={type:"object",additionalProperties:!1,required:["id","rule"],properties:{id:{type:"string",minLength:1,maxLength:128,pattern:"^[a-zA-Z0-9][a-zA-Z0-9._-]*$"},description:{type:"string",minLength:1,maxLength:500,pattern:"\\S"},effect:{enum:["advise","warn","refuse"]},subject:{type:"object",additionalProperties:!1,properties:{...Object.fromEntries(["types","tags","statuses","operations","parents"].map(e=>[e,Xa])),dependency:{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:Ni,id:Ni}}}},rule:{oneOf:[{type:"object",additionalProperties:!1,required:["kind","fields"],properties:{kind:{const:"require_fields"},fields:Ov}},{type:"object",additionalProperties:!1,required:["kind","authors"],properties:{kind:{const:"authors"},authors:Xa}},...["field_writers","approval"].map(e=>({type:"object",additionalProperties:!1,required:["kind","fields","authors"],properties:{kind:{const:e},fields:Ov,authors:Xa}})),{type:"object",additionalProperties:!1,required:["kind","allowed"],properties:{kind:{const:"transition"},allowed:{type:"array",maxItems:$r,items:{type:"array",minItems:2,maxItems:2,items:Ni}}}}]}}};(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]="42dee0a5-d003-5e44-8b2d-d74a23d3f2ce")}catch{}})();async function xv(e,t,n,r){let o=await si(e).catch(()=>null);return o===null?{check:{name:"completeness",status:"error",ok:!1,details:{policy_registry_readable:!1,policy_registry_path:"schema/policies.json",remediation_hint:"Repair schema/policies.json, then rerun pm validate."}},warnings:["validate_completeness_policy_registry_unreadable"]}:Rv(o,t,n,r)}function fF(e,t,n){return e===0?"undeclared":t===0?"empty":n===0?"inapplicable":n===t?"covered":"partial"}function Rv(e,t,n=5,r=!1){let o=[],i=new Map,s=e.policies.filter(y=>y.rule.kind==="require_fields"),a=s.filter(y=>y.subject?.operations===void 0),c=new Set,l=0,d=0,u=0,f=0,m=0,p=cg(e);for(let y of t){let b=p({operation:"",author:"",before:y,after:y,completeness_only:!0});l+=+(b.decisions.length>0),d+=b.decisions.length,b.decisions.forEach(A=>c.add(A.policy_id));let v=b.decisions.filter(A=>!A.satisfied);if(v.length===0)continue;f+=1;let I=i.get(y.type)??{items:0,violations:0,missing_fields:0};I.items+=1;for(let A of v)u+=1,I.violations+=1,I.missing_fields+=A.missing_fields.length,A.effect==="refuse"&&(m+=1),o.length<n&&o.push({id:y.id,type:y.type,status:y.status,decision:A});i.set(y.type,I)}let w=r||m>0?"error":u>0?"warn":"ok";return{check:{name:"completeness",status:w,ok:w==="ok",details:{scope:"operation_independent_require_fields",declared_requirement_count:s.length,state_requirement_count:a.length,applicable_requirement_count:c.size,requirement_application_count:d,governed_items:l,ungoverned_items:t.length-l,contract_status:fF(s.length,t.length,l),applied_policy_ids:[...c].sort().slice(0,Math.max(0,n)),applied_policy_ids_truncated:c.size>Math.max(0,n),checked_items:t.length,incomplete_items:f,violation_count:u,refused_violations:m,missing_by_type:Object.fromEntries(i),violations:o,violations_truncated:o.length<u,enforcement:e.enforcement}},warnings:[...u>0?[`validate_completeness_missing_fields:${u}`]:[],...r?["validate_completeness_source_incomplete"]:[]]}}(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]="f54fe358-8f4c-5bf4-ae2a-9c92cd08c953")}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]="e524f0ad-faad-5d89-b8f5-1283979919ad")}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]="4d7f490a-03a3-512c-ba3c-b19fcc9a1270")}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]="9052af10-ff8c-55db-8a35-b45e1e23a901")}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]="1805dfab-5dc5-5be4-ad32-cbd8b3e37f8c")}catch{}})();var Wie=[...Js,"add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset","list","show","show-status","rename-type","rename-field","remap-status"];(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="decec6f3-3795-5353-bf48-75aa61dd79d4")}catch{}})();function Df(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}import vF from"node:fs/promises";import kF 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]="33b7f318-cc64-55d6-8b57-19a618efe6c0")}catch{}})();var EF=".managed-extensions.json",Pf=1;function Lf(e){return kF.join(e,EF)}function SF(){return{version:Pf,updated_at:$(),entries:[]}}function Dv(e){return[...e].sort((t,n)=>{let r=t.scope.localeCompare(n.scope);if(r!==0)return r;let o=t.name.localeCompare(n.name);return o!==0?o:t.directory.localeCompare(n.directory)})}function st(e){return typeof e=="string"?e:void 0}function TF(e){return typeof e.name=="string"&&e.name.trim().length>0&&typeof e.directory=="string"&&e.directory.trim().length>0&&(e.scope==="project"||e.scope==="global")&&typeof e.manifest_version=="string"&&typeof e.manifest_entry=="string"&&Array.isArray(e.capabilities)&&e.capabilities.every(t=>typeof t=="string")&&typeof e.installed_at=="string"&&typeof e.updated_at=="string"}function AF(e){if(typeof e!="object"||e===null)return null;let t=e;return t.kind!=="local"&&t.kind!=="github"&&t.kind!=="npm"&&t.kind!=="builtin"||typeof t.input!="string"||typeof t.location!="string"?null:{kind:t.kind,input:t.input,location:t.location,name:st(t.name),package:st(t.package),version:st(t.version),repository:st(t.repository),owner:st(t.owner),repo:st(t.repo),ref:st(t.ref),subpath:st(t.subpath),commit:st(t.commit)}}function IF(e){if(typeof e!="object"||e===null)return null;let t=e;if(!TF(t))return null;let n=AF(t.source);if(!n)return null;let r=Dr(t.contributions);return r===null?null:{name:t.name.trim(),directory:t.directory.trim(),scope:t.scope,manifest_version:t.manifest_version,manifest_entry:t.manifest_entry,capabilities:Df(t.capabilities),contributions:r,installed_at:t.installed_at,updated_at:t.updated_at,source:n,last_update_check_at:st(t.last_update_check_at),last_update_remote_commit:st(t.last_update_remote_commit),update_available:typeof t.update_available=="boolean"||t.update_available===null?t.update_available:void 0,update_error:st(t.update_error)}}function CF(e){if(typeof e!="object"||e===null)return null;let t=e;if(t.version!==Pf||!Array.isArray(t.entries))return null;let n=[];for(let r of t.entries){let o=IF(r);o&&n.push(o)}return{version:Pf,updated_at:st(t.updated_at)??$(),entries:Dv(n)}}async function Pi(e){let t=Lf(e),n=SF();try{let r=await vF.readFile(t,"utf8"),o=JSON.parse(r),i=CF(o);if(!i)throw new g(`Managed extension state file "${t}" has an invalid schema. Repair or remove it before mutating extension state.`,_.GENERIC_FAILURE);return{path:t,state:i,warnings:[]}}catch(r){if(r instanceof g)throw r;if(typeof r=="object"&&r!==null&&"code"in r&&L(r))return{path:t,state:n,warnings:[]};throw new g(`Managed extension state file "${t}" could not be read. Repair or remove it before mutating extension state.`,_.GENERIC_FAILURE)}}import{execFile as NF}from"node:child_process";import{promisify as DF}from"node:util";import Pse from"npm-package-arg";import{extract as Mse,list as $se}from"tar";(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]="8269d712-f438-5f18-8137-ed9a0358e23b")}catch{}})();var gse=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});(function(){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]="96c5708d-1f4d-5f94-9945-7f8baa337106")}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]="68a37ea1-3571-59ab-b72c-0195efa84e3c")}catch{}})();var Gse=DF(NF);var Wse={maxArchiveBytes:64*1024*1024,maxEntries:4096,maxExpandedBytes:256*1024*1024,maxEntryBytes:64*1024*1024};(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]="60ab864f-43c5-512c-b33f-456de96f8090")}catch{}})();var Qse=new Set([...Fr.map(e=>e.split("-")[0].toLowerCase()),...Object.keys(rd).map(e=>e.toLowerCase()),"scaffold"]);(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]="2bc00b8e-0d9f-5af8-9667-d46136ff52b0")}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]="6c9e36f8-0f95-5768-8893-bf33bbb4d848")}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]="df60255d-fdd6-594a-9e17-547d53f7b3bb")}catch{}})();var Lv=new Set(["extension_command_handler_collision","extension_command_override_collision","extension_command_override_handler_overlap","extension_parser_override_collision","extension_preflight_override_collision","extension_renderer_collision","extension_service_override_collision"]);function MF(e){return Lv.has(jF(e))}function Pv(e){return e==="project"||e==="global"}function $F(e){let t=e.split(":"),n=t[0];if(!n||!Lv.has(n))return null;let r=t.at(-4),o=t.at(-3)?.trim(),i=t.at(-2),s=t.at(-1)?.trim();return!Pv(r)||!Pv(i)||!o||!s?null:{code:n,surface:t.slice(1,-4).join(":")||"global",winner:{layer:r,name:o},displaced:{layer:i,name:s}}}function FF(e){let t=new Set;for(let n of e){let r=$F(n);r&&(t.add(r.winner.name),t.add(r.displaced.name))}return[...t].sort((n,r)=>n.localeCompare(r))}function Mv(e,t){let n=e.filter(MF);if(n.length===0)return null;let r=FF(n);return`Extension registration collisions or handler/override overlaps detected.${r.length>0?` Conflicting extensions: ${r.join(", ")}.`:""} Single-winner surfaces can hide earlier package behavior. Deactivate one conflicting package with ${t.deactivate}, or scope registration surfaces in extensions.policy.extension_overrides, then rerun ${t.doctor}.`}function jF(e){let t=e.trim(),n=t.indexOf(":");return n===-1?t:t.slice(0,n)}function Mf(e){let t=new Set,n=[];for(let r of e){let o=(()=>{let i=nl(r);return i?[i]:rl(r)})();for(let i of o){let s=`${i.layer}:${i.name}:${i.capability}`;t.has(s)||(t.add(s),n.push(i))}}return n}function $f(){return{version:Bi.version,capabilities:[...Bi.capabilities],legacy_aliases:{...Bi.legacy_aliases}}}(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]="a77d8d8d-f429-5154-ab3a-2caddc44472e")}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]="9b04c14b-8049-52ef-b7e8-dc87a0fb7629")}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]="37f2dced-3b93-5c64-85ae-56e62c95e8eb")}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]="fcc97434-1ef5-5c47-b491-f00e9d19b2c6")}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]="a1803149-25ca-5bb0-a178-afa2d85d2ec9")}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]="8507f364-e079-5743-a54b-bb3a68ab66d0")}catch{}})();import zF from"node:fs/promises";import HF 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]="c4dc16d1-672a-5b1c-b681-97a7b3febd69")}catch{}})();function qF(e){return HF.join(e,"extension-migrations.json")}function BF(e,t){let n=e.definition.id;return typeof n=="string"&&n.trim().length>0?n.trim():`migration-${String(t+1).padStart(3,"0")}`}function GF(e,t){return`${e.layer}:${e.name}:${t}`}async function WF(e){let t=qF(e);if(!await j(t))return{version:1,updated_at:"",entries:[]};let n=JSON.parse(await zF.readFile(t,"utf8"));return{version:1,updated_at:typeof n.updated_at=="string"?n.updated_at:"",entries:Array.isArray(n.entries)?n.entries.filter(r=>typeof r?.key=="string"&&(r.status==="applied"||r.status==="failed")):[]}}async function $v(e,t){let n=await WF(e),r=new Map(n.entries.map(o=>[o.key,o]));return t.forEach((o,i)=>{let s=BF(o,i),a=r.get(GF(o,s));a&&(o.definition.status=a.status,a.status==="failed"?o.definition.reason=a.error:(delete o.definition.reason,delete o.definition.error,delete o.definition.message))}),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]="ee1bfa77-6687-578c-9cd6-639fc702c48c")}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]="f4b9502f-f742-5f11-b341-56763bbed7c2")}catch{}})();import YF from"node:fs/promises";import JF 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]="b1bf79a0-1f04-590f-b613-45ca1b534d5d")}catch{}})();function XF(e){return typeof e.name=="string"&&e.name.trim().length>0?e.name.trim():"workspace-manifest"}function ZF(e,t){return t.code==="manifest_unknown_key"?`extension_manifest_unknown_key:author:${e}:key=${t.path}${t.suggested_key?`:suggested=${t.suggested_key}`:""}`:`extension_manifest_no_version_bounds:author:${e}:suggested=pm_min_version`}async function Fv(e){let t=JF.join(e,"manifest.json"),n;try{n=await YF.readFile(t,"utf8")}catch(a){if(gt(a))return{path:t,present:!1,parse_status:"absent",package_metadata_location:"package.json#pm",schema_findings:[],warnings:[],remediation:[]};throw a}let r;try{r=JSON.parse(n)}catch{return{path:t,present:!0,parse_status:"invalid_json",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_json:manifest.json"],remediation:["Repair manifest.json so it contains one valid JSON object, then rerun pm package doctor --project."]}}if(typeof r!="object"||r===null||Array.isArray(r))return{path:t,present:!0,parse_status:"invalid_shape",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_shape:manifest.json"],remediation:["Replace manifest.json with one JSON object, then rerun pm package doctor --project."]};let o=r,i=fl(o),s=XF(o);return{path:t,present:!0,parse_status:"valid",package_metadata_location:"package.json#pm",schema_findings:i.findings,warnings:i.findings.map(a=>ZF(s,a)),remediation:i.findings.map(a=>a.message)}}(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]="dcdfdabd-8862-502f-8cd1-298c08825985")}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]="d7afb9a1-be35-5dfd-a52e-2525598b68d8")}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]="4f8fc1a7-748d-559d-9de8-835d0428c6a7")}catch{}})();var nj=[["install","install","--install"],["uninstall","uninstall","--uninstall"],["explore","explore","--explore"],["list","explore","--explore"],["manage","manage","--manage"],["describe","describe","--describe"],["reload","reload","--reload"],["doctor","doctor","--doctor"],["catalog","catalog","--catalog"],["init","init","--init"],["scaffold","init","--scaffold"],["adopt","adopt","--adopt"],["adopt-all","adopt-all","--adopt-all"],["activate","activate","--activate"],["deactivate","deactivate","--deactivate"],["migrate","migrate","--migrate"]],Rle=nj.map(([,,e])=>e).filter((e,t,n)=>n.indexOf(e)===t).join(", ");var Nle=Ds();import{execFile as rj}from"node:child_process";import{realpath as oj}from"node:fs/promises";import jv from"node:path";import{promisify as ij}from"node:util";(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]="be96ba6f-f848-58bf-8a3b-b6e3d6ab4b7a")}catch{}})();var sj=ij(rj),aj=32*1024*1024,cj=1e4,lj=["search/eval-queries.json"];function Ff(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function dj(e){return`'${e.replaceAll("'","'\\''")}'`}async function uj(e,t=oj){return t(e).catch(()=>jv.resolve(e))}async function Za(e){let t=await Lt(e);if(t===null)return{git_workspace_root:null,tracker_relative_root:null,tracked_paths:[],tracked_path_count:0,remediation_command:null};let n=await uj(e),r=Ff(jv.relative(t,n));if(r.length===0)return{git_workspace_root:t,tracker_relative_root:null,tracked_paths:[],tracked_path_count:0,remediation_command:null};let o=jh.map(i=>`${r}/${Ff(i)}`);try{let{stdout:i}=await sj("git",["ls-files","-z","--",...o.map(l=>`:(literal)${l}`)],{cwd:t,encoding:"utf8",maxBuffer:aj,windowsHide:!0,timeout:cj}),s=new Set(lj.map(l=>`${r}/${l}`)),a=[...new Set(i.split("\0").filter(l=>l.length>0&&!s.has(Ff(l))))].sort((l,d)=>l.localeCompare(d)),c=o.filter(l=>a.some(d=>d===l||d.startsWith(`${l}/`)));return{git_workspace_root:t,tracker_relative_root:r,tracked_paths:a,tracked_path_count:a.length,remediation_command:a.length===0?null:`git rm --cached -r -- ${c.map(l=>dj(`:(literal)${l}`)).join(" ")}`}}catch{return{git_workspace_root:t,tracker_relative_root:r,tracked_paths:[],tracked_path_count:0,remediation_command:null}}}import{createHash as fj}from"node:crypto";import Qa 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]="e5ba549f-1965-5c5e-98b3-bd0903210032")}catch{}})();var Uf="2026-08-09T16:15:18.000Z",zv=Symbol("pre-durable-disposition-eligible");function on(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function jf(e){if(!Array.isArray(e)||e.length>256)return!1;let t=new Set;for(let n=0;n<e.length;n+=1){let r=e[n];if(!(n in e)||typeof r!="string"||r.length===0||r.length>256||r.includes("\0")||t.has(r))return!1;t.add(r)}return!0}function Uv(e){return on(e)?typeof e.field=="string"&&e.field.length>0&&e.field.length<=256&&!e.field.includes("\0")&&typeof e.retained_hash=="string"&&/^[a-f0-9]{64}$/u.test(e.retained_hash)&&typeof e.discarded_hash=="string"&&/^[a-f0-9]{64}$/u.test(e.discarded_hash):!1}function Hv(e,t){if(typeof e!="string")return!1;let n=Qa.posix.normalize(e);return e.length<=4096&&!e.includes("\\")&&!e.includes("\0")&&!Qa.posix.isAbsolute(e)&&n===e&&!n.startsWith("../")&&(Qa.posix.basename(n)===`${t}.toon`||Qa.posix.basename(n)===`${t}.md`)}function mj(e,t){return typeof e.receipt_id=="string"&&Qt(e.receipt_id)&&(e.preferred==="ours"||e.preferred==="theirs")&&e.requested_preference===void 0&&e.conflict_resolution===void 0&&e.item_id===t&&Hv(e.item_path,t)}function qv(e){let t=e.conflict_fields,n=e.fields_from_theirs,r=e.union_fields,o=e.decisions,i=Array.isArray(o)?new Set(o.flatMap(s=>Uv(s)?[s.field]:[])):new Set;return jf(t)&&jf(n)&&jf(r)&&Array.isArray(o)&&o.length>0&&o.length<=256&&Object.keys(o).length===o.length&&o.every(Uv)&&i.size===o.length&&t.length===i.size&&t.every(s=>i.has(s))}function pj(e,t){return mj(e,t)&&qv(e)}function _j(e,t){return typeof e.receipt_id=="string"&&Qt(e.receipt_id)&&(e.preferred==="ours"||e.preferred==="theirs")&&e.requested_preference===void 0&&(e.conflict_resolution==="preferred_side"||e.conflict_resolution==="stable_value_order")&&e.item_id===t&&Hv(e.item_path,t)&&qv(e)}function zf(e){return e[zv]===!0}function ec(e,t){if(!on(e)||!on(e.context))return[];let n=e.context.merge;return!on(n)||!Array.isArray(n.receipts)?[]:n.receipts.flatMap(r=>!on(r)||typeof r.receipt_id!="string"||r.receipt_id.trim().length===0?[]:[{receiptId:r.receipt_id,legacySummaryAccepted:pj(r,t),[zv]:_j(r,t),...typeof e.ts=="string"&&Bt(e.ts)?{eventTimestamp:e.ts}:{}}])}function Bv(e,t,n){if(!on(e)||e.op!=="merge_reconcile")return[];if(!on(e.context)||!on(e.context.merge))return[];let r=e.context.merge.missing_receipt_dispositions;return!Array.isArray(r)||r.length>256?[]:r.flatMap(o=>!on(o)||typeof o.receipt_id!="string"||!Qt(o.receipt_id)||typeof o.original_history_line!="number"||!Number.isSafeInteger(o.original_history_line)||o.original_history_line<1||typeof o.original_event_ts!="string"||!Bt(o.original_event_ts)||o.reason!=="legacy_clone_local_only"?[]:[{itemId:t,receiptId:o.receipt_id,originalHistoryLine:o.original_history_line,originalEventTimestamp:o.original_event_ts,auditHistoryLine:n,reason:o.reason}])}function Gv(e,t,n=[]){let r=new Map;for(let s of n){let a=`${s.itemId}\0${s.originalHistoryLine}\0${s.receiptId}\0${s.originalEventTimestamp}`;r.set(a,Math.max(r.get(a)??0,s.auditHistoryLine))}let o=s=>zf(s)&&s.eventTimestamp!==void 0&&we(s.eventTimestamp,Uf)<0&&(r.get(`${s.itemId}\0${s.line}\0${s.receiptId}\0${s.eventTimestamp}`)??0)>s.line;return{missing:e.filter(s=>!s.legacySummaryAccepted&&!t.has(s.receiptId)&&!o(s)).map(s=>({item_id:s.itemId,history_line:s.line,...Qt(s.receiptId)?{receipt_id:s.receiptId}:{receipt_reference_hash:fj("sha256").update(s.receiptId).digest("hex")}})),acceptedLegacyCount:e.filter(s=>s.legacySummaryAccepted).length,acceptedDispositionCount:e.filter(o).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]="fdd874ad-e51d-5df2-9486-a0465ad65979")}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]="0a3dd0c1-2dea-5143-a2eb-65e758a0cc71")}catch{}})();function sn(){let e=jn();for(let t of Y()?.relationship_kinds??[])for(let n of t.definitions)e.register(n);return 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]="83d1acab-79a1-5e9f-b6a4-97dade07d74a")}catch{}})();function nc(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function tc(e){return[e.parent_id,e.child_id,e.source,e.kind,e.holder_id,e.target_id??""].join("\0")}function gj(e,t){let n=new Set,r=[];for(let o of[...e].sort()){if(n.has(o))continue;n.add(o);let i=[{nodeId:o,children:[...t.get(o)??[]].sort(),nextChild:0}];for(;i.length>0;){let s=i.at(-1),a=s.children[s.nextChild];a===void 0?(r.push(s.nodeId),i.pop()):(s.nextChild+=1,n.has(a)||(n.add(a),i.push({nodeId:a,children:[...t.get(a)??[]].sort(),nextChild:0})))}}return r}function hj(e,t){let n=[...e].sort(),r=gj(n,t),o=new Set,i=yj(n,t),s=[];for(let a of r.reverse()){if(o.has(a))continue;let c=wj(a,i,o);(c.length>1||t.get(c[0])?.has(c[0]))&&s.push(c)}return s.sort((a,c)=>a.join("\0").localeCompare(c.join("\0")))}function yj(e,t){let n=new Map(e.map(r=>[r,new Set]));for(let[r,o]of t)for(let i of o)n.get(i)?.add(r);return n}function wj(e,t,n){let r=[],o=[e];for(n.add(e);o.length>0;){let i=o.pop();r.push(i);for(let s of[...t.get(i)].sort())n.has(s)||(n.add(s),o.push(s))}return r.sort()}function bj(e){let t=new Map;for(let n of e){let r=nc(n?.id);r&&!t.has(r)&&t.set(r,n)}return t}function vj(e,t,n){let r=nc(t.parent);if(!(!r||!n.has(r)))return{parent_id:r,child_id:e,source:"scalar_parent",kind:"parent",holder_id:e,child_cardinality:"one"}}function kj(e,t,n,r){let o=nc(t?.id),i=r.resolve(t?.kind);if(!o||!n.has(o)||!i?.hierarchy)return;let s=i.hierarchyDirection==="source_parent";return{parent_id:s?e:o,child_id:s?o:e,source:"dependency",kind:i.kind,holder_id:e,target_id:o,child_cardinality:s?i.incoming:i.outgoing}}function Ej(e,t){let n=new Map;for(let[r,o]of e){let i=vj(r,o,e);i&&n.set(tc(i),i);for(let s of o.dependencies??[]){let a=kj(r,s,e,t);a&&n.set(tc(a),a)}}return[...n.values()].sort((r,o)=>tc(r).localeCompare(tc(o)))}function Sj(e,t,n){let r=new Set(e.filter(o=>o.child_cardinality==="one").map(o=>o.child_id));return[...t].filter(([o,i])=>i.length>1&&r.has(o)).map(([o,i])=>({child_id:o,parent_ids:[...i],legacy_terminal:n.has(o)&&i.every(s=>n.has(s))})).sort((o,i)=>o.child_id.localeCompare(i.child_id))}function Tj(e,t,n){let r=new Map;for(let i of t){if(i.source!=="dependency")continue;let s=r.get(i.child_id)??new Set;s.add(i.parent_id),r.set(i.child_id,s)}let o=[];for(let[i,s]of e){let a=nc(s.parent);if(!a||!e.has(a))continue;let c=[...r.get(i)??[]].filter(l=>l!==a).sort();c.length!==0&&o.push({child_id:i,scalar_parent_id:a,dependency_parent_ids:c,legacy_terminal:n.has(i)&&n.has(a)&&c.every(l=>n.has(l))})}return o.sort((i,s)=>i.child_id.localeCompare(s.child_id))}function Li(e,t=r=>r==="closed"||r==="canceled",n=sn()){let r=bj(e),o=Ej(r,n),i=Aj(o),s=new Set([...r].filter(([,c])=>t(c.status)).map(([c])=>c)),a=hj([...r.keys()],new Map([...i.children_by_parent].map(([c,l])=>[c,new Set(l)]))).map(c=>({item_ids:c,legacy_terminal:c.every(l=>s.has(l))}));return{relations:o,cycles:a,cardinality_violations:Sj(o,i.parents_by_child,s),divergences:Tj(r,o,s)}}function Aj(e){let t=new Map,n=new Map;for(let r of e){let o=t.get(r.child_id)??new Set;o.add(r.parent_id),t.set(r.child_id,o);let i=n.get(r.parent_id)??new Set;i.add(r.child_id),n.set(r.parent_id,i)}return{parents_by_child:new Map([...t].map(([r,o])=>[r,[...o].sort()])),children_by_parent:new Map([...n].map(([r,o])=>[r,[...o].sort()]))}}(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]="06ecc7a4-c593-5d99-89f5-714a4590d0a5")}catch{}})();function Wv(e){if(typeof e!="string")return;let t=e.trim();if(!(!t||["none","null","n/a","na"].includes(t.toLowerCase())))return t}function Ij(e,t,n=!0){let r=Wv(e);return n&&(ro(t)||r!==void 0&&xi(r))}function Vv(e,t=n=>n==="closed"||n==="canceled"){let n=e.filter(c=>typeof c?.id=="string"&&c.id.trim().length>0),r=new Set(n.map(c=>c.id.trim().toLowerCase())),o=new Map,i=(c,l,d,u,f)=>{let m=Wv(l);if(!m||r.has(m.toLowerCase())||Ij(m,void 0,f))return;let p={holder_id:c.id.trim(),target_id:m,kind:d,source:u,holder_status:c.status,legacy_terminal:t(c.status),no_active_blocker_sentinel:m.toLowerCase()==="no-active-blocker"};o.set(`${p.holder_id}::${p.target_id}::${p.kind}::${p.source}`,p)};for(let c of n){i(c,c.parent,"parent","parent",!1),i(c,c.blocked_by,"blocked_by","blocked_by",!0);for(let l of c.dependencies??[]){if(typeof l!="object"||l===null)continue;let d=l;ro(d.source_kind)||i(c,d.id,typeof d.kind=="string"?d.kind:"related","dependency",!0)}}let s=[...o.values()].sort((c,l)=>c.holder_id.localeCompare(l.holder_id)||c.target_id.localeCompare(l.target_id)||c.kind.localeCompare(l.kind)||c.source.localeCompare(l.source)),a=s.filter(c=>c.legacy_terminal);return{active:s.filter(c=>!c.legacy_terminal),legacy_terminal:a,no_active_blocker_sentinels:s.filter(c=>c.no_active_blocker_sentinel)}}(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]="77ccea6e-a118-53df-94b7-a740bb3d7681")}catch{}})();function rc(e,t,n=25){let r=e.definitions.filter(s=>s.roles.length===0).map(s=>s.id).sort((s,a)=>s.localeCompare(a)),o=new Set(r),i=t.filter(s=>{let a=Tr(s.status,e);return a!==void 0&&o.has(a)}).map(s=>s.id).sort((s,a)=>s.localeCompare(a));return{roleless_status_count:r.length,roleless_statuses:r.slice(0,n),roleless_statuses_truncated:r.length>n,affected_item_count:i.length,affected_item_ids:i.slice(0,n),affected_item_ids_truncated:i.length>n}}function oc(e){return e.roleless_status_count===0?[]:[`schema_status_missing_lifecycle_role:${e.roleless_status_count}`]}(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]="ccc95309-685b-5516-936f-74106af14c74")}catch{}})();var Cj=new Set(Jr),Xv=25,io=8,hr=100,Oj=Xe.join("runtime","telemetry","events.jsonl"),xj=Xe.join("runtime","telemetry","state.json"),Rj=2500,Nj=500,Zv=Tw-3,Dj=["x-pm-telemetry-max-schema-version","x-pm-telemetry-max-version"];function Qv(e,t=!1){return e.startsWith("telemetry_")||e.startsWith("history_stream_over_compact_threshold:")||e.startsWith("integrity_legacy_hierarchy_")||e.startsWith("stale_in_progress_items:")||e.startsWith("provenance_resolver_zero_success:")||e.startsWith("provenance_value_domain_invalid:")||!t&&e.startsWith("merge_driver_configuration_missing:")}function ek(e){let t=e.trim(),n=t.indexOf(":");return n===-1?t:t.slice(0,n)}function Mi(e){return e.trim().toLowerCase()}function Kv(e,t){let n=Mi(e),r=Mi(t);return n.startsWith("builtin-")?!0:r==="beads"||r==="todos"}async function tk(e){try{return(await cn.stat(e)).isDirectory()}catch{return!1}}async function Pj(e){let t=(await cn.readdir(e,{withFileTypes:!0})).filter(r=>r.isDirectory()),n=await Promise.all(t.map(r=>cn.readdir(Xe.join(e,r.name),{withFileTypes:!0})));return new Set(n.flatMap(r=>r.filter(o=>o.isFile()).filter(o=>Gt.some(i=>o.name.endsWith(i))).map(o=>Xe.parse(o.name).name)))}async function Lj(e,t,n,r){let o=await Le({path:e,scope:"project"}),i=t!=="_workspace"&&!r.has(t);if(!n.enabled&&!i)return{warnings:o,overThreshold:!1,classification:"live"};let s;try{s=await cn.readFile(e,"utf8")}catch{return{warnings:o,overThreshold:!1,classification:"unreadable"}}let a="live";if(i){let l=s.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).at(-1);try{a=JSON.parse(l??"{}").op==="delete"?"tombstone":"orphaned"}catch{a="orphaned"}}let c=n.enabled?s.split(/\r?\n/).filter(l=>l.trim().length>0).length:0;return{warnings:o,overThreshold:n.enabled&&c>n.max_entries,classification:a}}async function Mj(e,t,n){let r=Xe.join(e,"history");if(!await tk(r))return{count:0,warnings:[],over_threshold:[],max_entries:null,tombstones:[],orphaned:[]};let o=(await cn.readdir(r)).filter(u=>u.endsWith(".jsonl")).sort((u,f)=>u.localeCompare(f)),s=t.enabled?t.max_entries:null,a=[],c=[],l=[],d=[];for(let u of o){let f=Xe.join(r,u),m=u.slice(0,-6),p=await Lj(f,m,t,n);a.push(...p.warnings),p.classification==="tombstone"&&l.push(m),p.classification==="orphaned"&&d.push(m),p.overThreshold&&c.push(m)}return{count:o.length,warnings:[...a,...c.map(u=>`history_stream_over_compact_threshold:${u}`),...d.map(u=>`history_orphaned_stream:${u}`)],over_threshold:c,max_entries:s,tombstones:l,orphaned:d}}function Wf(e,t){return Xe.relative(e,t).replaceAll("\\","/")}async function $j(e,t){let n=[...new Set(Object.values(t))].sort((o,i)=>o.localeCompare(i)),r=[];for(let o of n){let i=Xe.join(e,o),s=[];try{s=await cn.readdir(i)}catch(a){if(typeof a=="object"&&a!==null&&"code"in a&&L(a))continue;continue}for(let a of s)Gt.some(c=>a.toLowerCase().endsWith(c))&&r.push(Xe.join(i,a))}return r.sort((o,i)=>Wf(e,o).localeCompare(Wf(e,i))),r}function Fj(e){return!(typeof e=="object"&&e!==null&&"code"in e&&L(e))}async function jj(e,t,n){let r=await $j(e,t),o=[],i=[],s=[],a=[],c=Et(Y());for(let l of r){let d=Wf(e,l),u;try{u=await cn.readFile(l,"utf8")}catch{o.push(d);continue}let f=De(u);if(f){i.push({path:d,...f});continue}try{let m=We(u,{format:Nr(l),schema:n,extensionFieldNames:c});a.push({ref:d,version:ms(m.metadata)})}catch{s.push(d)}}return{paths:r,unreadable:o,conflictMarkers:i,parseFailures:s,formatVersions:a}}async function Uj(e){let t=Xe.join(e,"history"),n=[],r=[],o=[],i=[],s=[],a=[];try{a=(await cn.readdir(t)).filter(c=>c.endsWith(".jsonl")).sort((c,l)=>c.localeCompare(l))}catch(c){Fj(c)&&n.push("history")}for(let c of a){let l=c.slice(0,-6),d;try{d=await cn.readFile(Xe.join(t,c),"utf8")}catch{n.push(l);continue}let u=De(d);if(u){r.push({id:l,...u});continue}d.split(/\r?\n/).forEach((f,m)=>{if(f.trim())try{let p=JSON.parse(f);i.push(...ec(p,l).map(w=>({itemId:l,line:m+1,...w}))),s.push(...Bv(p,l,m+1))}catch{o.push({id:l,line:m+1})}})}return{files:a,unreadable:n,conflictMarkers:r,invalidJson:o,mergeReceiptReferences:i,mergeReceiptDispositions:s}}function zj(e){return[...e.cycles.map(t=>t.legacy_terminal?`integrity_legacy_hierarchy_cycle:${t.item_ids.join(",")}`:`integrity_hierarchy_cycle:${t.item_ids.join(",")}`),...e.cardinality_violations.map(t=>t.legacy_terminal?`integrity_legacy_hierarchy_cardinality:${t.child_id}`:`integrity_hierarchy_cardinality:${t.child_id}`),...e.divergences.map(t=>t.legacy_terminal?`integrity_legacy_hierarchy_divergence:${t.child_id}`:`integrity_hierarchy_divergence:${t.child_id}`)]}function Hj(e){let t=[];return e.invalidEvidenceCount>0&&t.push(`merge_receipt_evidence_invalid:${e.invalidEvidenceCount}`),e.missingHistoryReferenceCount>0&&t.push(`merge_receipt_history_reference_missing:${e.missingHistoryReferenceCount}`),t}async function qj(e,t,n,r,o){let i=await jj(e,t,n),s=await Uj(e),a=ps(i.formatVersions),c=at(n),l=Li(o,E=>Nc(E,c),sn()),d=await Za(e),u=await Lt(e),f=u===null?null:await oi(u),m=await kt(u??e,{includeReconciled:!0,includeLossless:!0,pmRoot:e}),p=new Set(m.receipts.map(E=>E.id)),w=Gv(s.mergeReceiptReferences,p,s.mergeReceiptDispositions),y=w.missing,b=m.receipts.filter(E=>E.state==="pending"),{pendingDecisions:v,lossless:I}=ua(b),A=f?.status==="missing"&&f.missing_keys.length===5&&f.drifted_keys.length===0,C=[...i.unreadable.map(E=>`integrity_item_unreadable:${E}`),...i.conflictMarkers.map(E=>`integrity_item_conflict_marker:${E.path}:L${E.line}`),...i.parseFailures.map(E=>`integrity_item_parse_failed:${E}`),...s.unreadable.map(E=>`integrity_history_unreadable:${E}`),...s.conflictMarkers.map(E=>`integrity_history_conflict_marker:${E.id}:L${E.line}`),...s.invalidJson.map(E=>`integrity_history_invalid_json:${E.id}:L${E.line}`),...a.outdated.map(E=>`integrity_item_outdated_format_version:${E}`),...a.ahead.map(E=>`integrity_item_ahead_format_version:${E}`),...zj(l),...d.tracked_path_count>0?[`tracked_runtime_cache_files:${d.tracked_path_count}`]:[],...f!==null&&f.status!=="ok"?[`merge_driver_configuration_${A?"missing":"drift"}:${f.missing_keys.length+f.drifted_keys.length}`]:[],...v.length>0?[`merge_decisions_unreviewed:${v.length}`]:[],...I.length>0?[`merge_receipts_pending:${I.length}`]:[],...Hj({invalidEvidenceCount:m.invalid_evidence_count,missingHistoryReferenceCount:y.length})],P=[...new Set(C)].sort((E,z)=>E.localeCompare(z)),S=P.filter(E=>!E.startsWith("integrity_legacy_hierarchy_"));return{check:{name:"integrity",status:S.length===0?"ok":"warn",ok:S.length===0,details:{checked_item_files:i.paths.length,checked_history_streams:s.files.length,counts:{item_unreadable:i.unreadable.length,item_conflict_markers:i.conflictMarkers.length,item_parse_failures:i.parseFailures.length,history_unreadable:s.unreadable.length,history_conflict_markers:s.conflictMarkers.length,history_invalid_json:s.invalidJson.length,item_outdated_format_version:a.outdated.length,item_ahead_format_version:a.ahead.length,hierarchy_cycles:l.cycles.length,hierarchy_cardinality_violations:l.cardinality_violations.length,hierarchy_parent_divergences:l.divergences.length,tracked_runtime_cache_files:d.tracked_path_count,merge_driver_configuration:f===null||f.status==="ok"?0:f.missing_keys.length+f.drifted_keys.length,pending_merge_decisions:v.length,lossless_merge_receipts:I.length,invalid_merge_receipt_evidence:m.invalid_evidence_count,missing_merge_receipt_history_references:y.length,accepted_legacy_merge_receipt_references:w.acceptedLegacyCount,accepted_missing_merge_receipt_dispositions:w.acceptedDispositionCount},item_unreadable:i.unreadable,item_conflict_markers:i.conflictMarkers,item_parse_failures:i.parseFailures,item_outdated_format_version:a.outdated,item_ahead_format_version:a.ahead,hierarchy_integrity:{...l,relations:an(l.relations,io)},history_unreadable:s.unreadable,history_conflict_markers:s.conflictMarkers,history_invalid_json:s.invalidJson,tracked_runtime_cache:{tracker_relative_root:d.tracker_relative_root,tracked_paths:d.tracked_paths,tracked_path_count:d.tracked_path_count,remediation_command:d.remediation_command},merge_driver_configuration:f===null?null:{...f,required:r},pending_merge_decision_items:[...new Set(v.map(E=>E.item_id))].sort((E,z)=>E.localeCompare(z)),lossless_merge_receipt_items:[...new Set(I.map(E=>E.item_id))].sort((E,z)=>E.localeCompare(z)),invalid_merge_receipt_evidence_details:m.invalid_evidence,invalid_merge_receipt_evidence_details_truncated:m.invalid_evidence_truncated,missing_merge_receipt_history_reference_details:y.slice(0,hr),missing_merge_receipt_history_reference_details_truncated:y.length>hr}},warnings:P,gitWorkspaceRoot:u,pendingMergeReceipts:b}}function Bj(e){if(typeof e.activate=="function")return!0;let t=e.default;return typeof t!="object"||t===null?!1:typeof t.activate=="function"}function Gj(e){let t={layer:e.layer,directory:e.directory,manifest_path:e.manifest_path,name:e.name,version:e.version,entry:e.entry,priority:e.priority,entry_path:e.entry_path,has_activate:Bj(e.module)};return Array.isArray(e.capabilities)&&(t.capabilities=[...e.capabilities]),t}function Wj(e,t){let n=le(e.id);return n||`migration-${String(t+1).padStart(3,"0")}`}function Vj(e){let n=le(e.status)?.toLowerCase();return n==="failed"?"failed":n==="applied"?"applied":"pending"}function Kj(e){return le(e.reason)??le(e.error)??le(e.message)}function Hf(e,t){let n=(e.layer??"").localeCompare(t.layer??"");if(n!==0)return n;let r=(e.name??"").localeCompare(t.name??"");return r!==0?r:(e.id??"").localeCompare(t.id??"")}function Yj(e){let t=[],n=[],r=[];e.forEach((i,s)=>{let a=Wj(i.definition,s),c=Vj(i.definition);if(c==="applied"){t.push({layer:i.layer,name:i.name,id:a,status:c});return}if(c==="failed"){r.push({layer:i.layer,name:i.name,id:a,status:c,reason:Kj(i.definition)});return}n.push({layer:i.layer,name:i.name,id:a,status:c})}),t.sort(Hf),n.sort(Hf),r.sort(Hf);let o=[...r.map(i=>`extension_migration_failed:${i.layer}:${i.name}:${i.id}`),...n.map(i=>`extension_migration_pending:${i.layer}:${i.name}:${i.id}`)];return{summary:{applied:t,pending:n,failed:r,applied_count:t.length,pending_count:n.length,failed_count:r.length},warnings:o}}function Jj(e,t,n,r,o,i,s,a,c){let l=[...new Set(e)].sort((y,b)=>y.localeCompare(b)),d=[...new Set(l.map(y=>ek(y)))].sort((y,b)=>y.localeCompare(b)),u=l.filter(y=>y.startsWith("extension_capability_unknown:")).length,f=c.length>0,m=f?"partial":"full",p=[],w=Mv(l,{deactivate:"pm extension --deactivate <name> --project/--global",doctor:"pm extension --doctor --project/--global --detail deep --trace"});return w&&p.push(w),t>0&&p.push("Run pm extension --explore --project and pm extension --explore --global to inspect load failures."),n>0&&p.push("Review checks[name=extensions].details.activation.failed in pm health --json for activation error details."),(r.failed_count>0||r.pending_count>0)&&p.push("Resolve pending/failed extension migrations before write commands; use --force only when policy allows."),o>0&&p.push("Run pm extension --manage --project and pm extension --manage --global to refresh managed-state diagnostics."),u>0&&p.push(`Unknown extension capabilities detected. Allowed capabilities: ${Qe.join(", ")}. Review extension_capability_unknown warning details for suggested replacements.`),l.some(y=>y.startsWith("extension_capability_legacy_alias:"))&&p.push("Legacy extension capability aliases were auto-remapped to canonical capabilities. Update manifests to canonical names (migration/validation -> schema)."),l.some(y=>y.startsWith("extension_command_definition_legacy_handler_alias:"))&&p.push("Extension command definitions using legacy handler were auto-remapped. Update command definitions to use run: (context) => ... for forward compatibility."),f?p.push("Update-check coverage is partial because unmanaged extensions need adoption. Adopt existing installs via pm extension --manage --project/--global --fix-managed-state, pm extension --adopt-all --project/--global, or pm extension --adopt <name>."):s.length>0&&p.push("Loaded unmanaged extensions are currently treated as informational. Use pm extension --manage --project/--global --fix-managed-state to adopt them for update checks."),p.length===0&&p.push("No immediate action required. Re-run pm health after extension configuration changes."),{status:l.length===0?"ok":"warn",warning_count:l.length,warning_codes:d,load_failure_count:t,activation_failure_count:n,migration_failed_count:r.failed_count,migration_pending_count:r.pending_count,managed_state_warning_count:o,managed_extension_entries_count:i,unmanaged_loaded_extension_count:s.length,unmanaged_loaded_extensions:s,unmanaged_expected_extension_count:a.length,unmanaged_expected_extensions:a,unmanaged_action_required_extension_count:c.length,unmanaged_action_required_extensions:c,update_health_coverage:m,update_health_partial:f,unknown_capability_count:u,top_warnings:l.slice(0,8),remediation:p}}async function Xj(e,t,n){let r=await Fv(hn(e)),o=await Lo({pmRoot:e,settings:t,cwd:process.cwd(),noExtensions:n}),i=o.loaded.map(S=>Gj(S)),s=await Rw(o.loaded,hn(e)),a=await Mo({...o,loaded:o.loaded}),[c,l]=await Promise.all([Pi(o.roots.project),Pi(o.roots.global)]);await $v(e,a.registrations.migrations);let d=Yj(a.registrations.migrations),u={failed:a.failed,warnings:a.warnings,hook_counts:a.hook_counts,command_override_count:a.command_override_count,command_handler_count:a.command_handler_count,parser_override_count:a.parser_override_count,preflight_override_count:a.preflight_override_count,service_override_count:a.service_override_count,renderer_override_count:a.renderer_override_count,registration_counts:a.registration_counts,registrations:a.registrations,migration_status:d.summary,managed_extensions:{project:{path:c.path,count:c.state.entries.length,entries:c.state.entries},global:{path:l.path,count:l.state.entries.length,entries:l.state.entries}}},f=new Set(c.state.entries.map(S=>Mi(S.name))),m=new Set(l.state.entries.map(S=>Mi(S.name))),p=[...new Map(o.loaded.filter(S=>!(S.layer==="project"?f:m).has(Mi(S.name))).map(S=>[`${S.layer}:${S.name}`,{layer:S.layer,name:S.name,directory:S.directory}])).values()].sort((S,E)=>{let z=`${S.layer}:${S.name}`,H=`${E.layer}:${E.name}`;return z.localeCompare(H)}),w=p.map(S=>`${S.layer}:${S.name}`).sort((S,E)=>S.localeCompare(E)),y=p.filter(S=>Kv(S.name,S.directory)).map(S=>`${S.layer}:${S.name}`).sort((S,E)=>S.localeCompare(E)),b=p.filter(S=>!Kv(S.name,S.directory)).map(S=>`${S.layer}:${S.name}`).sort((S,E)=>S.localeCompare(E)),v=b.length>0?[`extension_update_health_partial_coverage:skipped_unmanaged:${b.length}`]:[],I=[...r.warnings,...o.warnings,...u.warnings,...d.warnings,...c.warnings,...l.warnings,...v,...s.warnings],A=Mf(I),C=$f(),P=Jj(I,o.failed.length,a.failed.length,d.summary,c.warnings.length+l.warnings.length,c.state.entries.length+l.state.entries.length,w,y,b);return{check:{name:"extensions",status:I.length===0?"ok":"warn",ok:I.length===0,details:{...o,loaded:i,warnings:I,activation:u,author_manifest:r,triage:P,...d.summary.pending_count>0?{remediation_map:{extension_migration_pending:"pm extension migrate --project"}}:{},capability_contract:C,capability_guidance:A,host_version_census:s}},warnings:I}}function Zj(e,t){return e.length<=t?{values:e,truncated:!1}:{values:e.slice(0,t),truncated:!0}}function an(e,t){return Array.isArray(e)?{count:e.length,sample:e.slice(0,t),truncated:e.length>t}:{count:0,sample:[],truncated:!1}}function Qj(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};let t=e;return{layer:t.layer,directory:t.directory,name:t.name,version:t.version,enabled:t.enabled,status:t.status,has_activate:t.has_activate,capabilities:t.capabilities}}function qf(e,t){let n=an(e,t);return{...n,sample:n.sample.map(r=>Qj(r))}}function K(e,t){if(!Array.isArray(e))return{count:0,sample:[],truncated:!1};let n=e.filter(r=>typeof r=="string");return{count:n.length,sample:n.slice(0,t),truncated:n.length>t}}function e1(e){if(typeof e!="object"||e===null)return null;let t=e;return{applied_count:t.applied_count,pending_count:t.pending_count,failed_count:t.failed_count}}var t1={settings:(e,t)=>({version:e.version,id_prefix:e.id_prefix,locks_ttl_seconds:e.locks_ttl_seconds,warnings:K(e.warnings,t)}),directories:(e,t)=>({required_count:Array.isArray(e.required)?e.required.length:0,optional_count:Array.isArray(e.optional)?e.optional.length:0,missing_required:K(e.missing_required,t),missing_optional:K(e.missing_optional,t),missing:K(e.missing,t),strict_directories:e.strict_directories}),settings_values:(e,t)=>({warnings:K(e.warnings,t)}),telemetry:e=>({enabled:e.enabled,capture_level:e.capture_level,endpoint:e.endpoint,queue_exists:e.queue_exists,queue_entries:e.queue_entries,queue_draining:e.queue_draining,queue_invalid_rows:e.queue_invalid_rows,queue_rows_total:e.queue_rows_total,last_successful_flush_at:e.last_successful_flush_at,last_failed_flush_at:e.last_failed_flush_at,endpoint_probe:e.endpoint_probe,env_overrides:e.env_overrides}),extensions:(e,t)=>{let n=typeof e.activation=="object"&&e.activation!==null?e.activation:{};return{disabled_by_flag:e.disabled_by_flag,discovered:qf(e.discovered,t),effective:qf(e.effective,t),loaded:qf(e.loaded,t),failed:an(e.failed,t),warnings:K(e.warnings,t),activation:{failed:an(n.failed,t),warnings:K(n.warnings,t),hook_counts:n.hook_counts,command_handler_count:n.command_handler_count,service_override_count:n.service_override_count,renderer_override_count:n.renderer_override_count,registration_counts:n.registration_counts,migration_status:e1(n.migration_status)},author_manifest:e.author_manifest,triage:e.triage,capability_contract:e.capability_contract,capability_guidance:an(e.capability_guidance,t),host_version_census:e.host_version_census}},storage:(e,t)=>{let n=typeof e.author_attribution=="object"&&e.author_attribution!==null?e.author_attribution:void 0;return{...e,...n?{author_attribution:{...n,affected_item_ids:K(n.affected_item_ids,t),samples:an(n.samples,t)}}:{}}},locks:e=>({active_lock_count:e.active_lock_count,stale_lock_count:e.stale_lock_count,unreadable_lock_count:e.unreadable_lock_count,unparseable_lock_count:e.unparseable_lock_count}),integrity:(e,t)=>{let n=typeof e.tracked_runtime_cache=="object"&&e.tracked_runtime_cache!==null?e.tracked_runtime_cache:void 0;return{checked_item_files:e.checked_item_files,checked_history_streams:e.checked_history_streams,counts:e.counts,item_unreadable:K(e.item_unreadable,t),item_conflict_markers:an(e.item_conflict_markers,t),item_parse_failures:K(e.item_parse_failures,t),tracked_runtime_cache:n===void 0?e.tracked_runtime_cache:{...n,tracked_paths:K(n.tracked_paths,t)},history_unreadable:K(e.history_unreadable,t),history_conflict_markers:an(e.history_conflict_markers,t),history_invalid_json:an(e.history_invalid_json,t),skipped:e.skipped}},history_drift:(e,t)=>{let n=typeof e.cache_confirmation=="object"&&e.cache_confirmation!==null?e.cache_confirmation:void 0;return{checked_items:e.checked_items,cache_hit_verification:e.cache_hit_verification,cache_confirmation:n===void 0?e.cache_confirmation:{...n,candidate_items:K(n.candidate_items,t),confirmed_items:K(n.confirmed_items,t),resolved_false_positive_items:K(n.resolved_false_positive_items,t)},counts:e.counts,drifted_items:K(e.drifted_items,t),merge_receipt_attributed_items:K(e.merge_receipt_attributed_items,t),missing_streams:K(e.missing_streams,t),unreadable_streams:K(e.unreadable_streams,t),hash_mismatches:K(e.hash_mismatches,t),chain_mismatches:K(e.chain_mismatches,t),version_skews:K(e.version_skews,t),workspace_state_mismatches:K(e.workspace_state_mismatches,t),workspace_state_missing:K(e.workspace_state_missing,t),workspace_state_unreadable:K(e.workspace_state_unreadable,t),skipped:e.skipped}},vectorization:(e,t)=>({semantic_runtime_available:e.semantic_runtime_available,compatibility_mode_auto_defaults:e.compatibility_mode_auto_defaults,auto_ollama_defaults_applied:e.auto_ollama_defaults_applied,auto_ollama_defaults_skipped_reason:e.auto_ollama_defaults_skipped_reason,auto_ollama_defaults_remediation:e.auto_ollama_defaults_remediation,refresh_policy:e.refresh_policy,provider_active:e.provider_active,vector_store_active:e.vector_store_active,items:e.items,ledger_entries_before:e.ledger_entries_before,stale_items_before_total:e.stale_items_before_total,stale_items_before:K(e.stale_items_before,t),refresh_attempted:e.refresh_attempted,refresh_skipped_reason:e.refresh_skipped_reason,refresh_result:e.refresh_result,ledger_entries_after:e.ledger_entries_after,stale_items_after_total:e.stale_items_after_total,stale_items_after:K(e.stale_items_after,t),skipped:e.skipped})};function n1(e,t){let n=t1[e.name];return n?n(e.details,t):e.details}function r1(e){let t=K(e.warnings,io);return{ok:e.ok,...e.verdict?{verdict:e.verdict}:{},checks:e.checks.map(n=>({name:n.name,status:n.status,ok:n.ok,details:n1(n,io)})),warnings:t.sample,findings:e.findings.filter(n=>t.sample.includes(n.warning)||e.failed_because.includes(n.warning)),failed_because:e.failed_because,projection:{mode:"brief",warning_count:t.count,warnings_truncated:t.truncated,detail_limit:io},generated_at:e.generated_at}}function Yv(e){return e.details.skipped===!0}function o1(e){let t=K(e.warnings,io),n=e.checks.filter(Yv).map(r=>r.name);return{ok:e.ok,...e.verdict?{verdict:e.verdict}:{},checks:e.checks.filter(r=>!Yv(r)).map(r=>({name:r.name,status:r.status,ok:r.ok,details:{}})),warning_count:t.count,warnings:t.sample,findings:e.findings.filter(r=>t.sample.includes(r.warning)||e.failed_because.includes(r.warning)),failed_because:e.failed_because,projection:{mode:"summary",warning_count:t.count,warnings_truncated:t.truncated,detail_limit:io,omitted_checks:n},generated_at:e.generated_at}}function Jv(e,t){if(t)return{values:e,truncated:!1,total:e.length};let n=Zj(e,Xv);return{values:n.values,truncated:n.truncated,total:e.length}}function Bf(e){let t=(process.env[e]??"").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function i1(){let e=(process.env.PM_TELEMETRY_SOURCE_CONTEXT??"").trim().toLowerCase();return Cj.has(e)?e:null}function Vf(e){let t=e.trim();if(t.length===0)return"";try{let n=new URL(t);return n.username="",n.password="",n.search="",n.hash="",n.toString()}catch{return t}}function s1(e){let t=0,n=0,r=0,o=0,i=0;for(let s of e.split(`
120
+ `;await V(o,i)}function cM(e){return{id:e.id,type:e.type,status:e.status,priority:e.priority,updated_at:e.updated_at}}function lM(e){let t=to(e.name,e.model);if(!t)throw new Error("Embedding provider must include a provider name and model");return t}function Ei(e,t){return{refreshed:[],skipped:e,warnings:[t]}}async function dM(e,t,n){if(!n.settings&&!await j(Ee(e)))return Ei(t,"search_semantic_refresh_skipped:settings_not_initialized");let r;try{if(n.settings)r=n.settings;else{let a=await xn(e),c=a.warnings.find(l=>l.startsWith("settings_read_"));if(c)return Ei(t,`search_semantic_refresh_skipped:settings_read_failed:${c}`);r=a.settings}}catch(a){return Ei(t,`search_semantic_refresh_skipped:settings_read_failed:${ie(a)}`)}let o=n.apply_runtime_defaults?Qr(r).settings:r,i=wi(o).active;if(!i)return Ei(t,"search_semantic_refresh_skipped:provider_unconfigured");let s=vi(o,e).active;return s?{settings:o,provider:i,vectorStore:s}:Ei(t,"search_semantic_refresh_skipped:vector_store_unconfigured")}async function uM(e,t,n,r,o,i){let s=[],a=new Set,c=new Set,l=[];for(let d of r){let u=await Fe(e,d,t,n,o);if(!u){c.add(d);continue}try{let f=await Ye(u,{schema:i});l.push({id:f.document.metadata.id,document:f.document})}catch(f){a.add(u.id),s.push(`search_semantic_refresh_item_read_failed:${u.id}:${ie(f)}`)}}return l.sort((d,u)=>d.id.localeCompare(u.id)),{documents:l,missingIds:Si(c),skippedIds:Si(a),warnings:s}}async function fM(e,t,n){let r=Zr(t.name,e.search.embedding_corpus_max_characters).maxCharacters,o=Ou(e),i=n.map(a=>Ru(a.document,{providerName:t.name,maxCharacters:r,fields:o})),s=await Du(t,e,i);return{vectors:s.vectors,vector_dimension:Gu(s.vectors,"Semantic refresh embedding"),warnings:s.warnings}}async function mM(e,t,n){return await zu(e,t.map((r,o)=>({id:r.id,vector:n[o],payload:cM(r.document.metadata)}))),{refreshed:t.map(r=>r.id),skipped:[],warnings:[]}}async function pM(e,t){if(t.length===0)return{refreshed:[],skipped:[],warnings:[]};try{return await Hu(e,t),{refreshed:[],skipped:[],warnings:[]}}catch(n){return{refreshed:[],skipped:t,warnings:[`search_semantic_refresh_delete_failed:${ie(n)}`]}}}async function kw(e,t,n={}){let r=Si(t);if(r.length===0)return{refreshed:[],skipped:[],warnings:[]};let o=await dM(e,r,n);if(!("settings"in o))return o;let i=ge(o.settings,Y()),s=await uM(e,o.settings.id_prefix,o.settings.item_format,r,i.type_to_folder,o.settings.schema),a=s.documents.length>0||s.missingIds.length>0?await Ti(e):{entries:{},embedding:null,warnings:[]},c=lM(o.provider),l=a.entries,d={refreshed:[],skipped:[],warnings:[]},u=a.embedding;if(s.documents.length>0)if(a.embedding&&ki(a.embedding,c))d={refreshed:[],skipped:s.documents.map(y=>y.id),warnings:["search_semantic_refresh_requires_reindex:embedding_identity_changed"]};else try{let y=await fM(o.settings,o.provider,s.documents);if(Bu(a.embedding,y.vector_dimension))d={refreshed:[],skipped:s.documents.map(b=>b.id),warnings:[...y.warnings,"search_semantic_refresh_requires_reindex:vector_dimension_changed"]};else{u=qu(c,y.vector_dimension);let b=await mM(o.vectorStore,s.documents,y.vectors);d={refreshed:b.refreshed,skipped:b.skipped,warnings:[...y.warnings,...b.warnings]}}}catch(y){d={refreshed:[],skipped:s.documents.map(b=>b.id),warnings:[`search_semantic_refresh_failed:${ie(y)}`]}}let f=await pM(o.vectorStore,s.missingIds),m=new Set(d.refreshed),p=Object.fromEntries(s.documents.filter(y=>m.has(y.id)).map(y=>[y.id,y.document.metadata.updated_at])),w=[];if(Object.keys(p).length>0||s.missingIds.length>0){let y={...l,...bw(p)};for(let b of s.missingIds)delete y[b];try{await vw(e,y,u)}catch(b){w.push(`search_vectorization_status_ledger_write_failed:${ie(b)}`)}w.push(...a.warnings)}return{refreshed:Si([...d.refreshed,...f.refreshed]),skipped:Si([...s.skippedIds,...d.skipped,...f.skipped]),warnings:[...s.warnings,...d.warnings,...f.warnings,...w]}}(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]="e15abc24-c46a-512b-b859-015186c960df")}catch{}})();function Wu(e,t){let n=t??{};return e.filter(r=>n[r.id]!==r.updated_at).map(r=>r.id).sort((r,o)=>r.localeCompare(o))}import yM from"node:crypto";import Ku 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]="9d949852-abfe-5fbd-88c5-5da0cfbaf7de")}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]="4e329152-7e9e-5cf2-a4cf-35260a599360")}catch{}})();var RJ=new Map([[_.USAGE,"invalid_command_usage"],[_.NOT_FOUND,"item_not_found"],[_.CONFLICT,"lock_conflict"],[_.DEPENDENCY_FAILED,"dependency_failed"]]);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9d073708-29b1-56b5-bcff-b964bfdcb43d")}catch{}})();var ZJ=Ku.join("runtime","telemetry","events.jsonl"),QJ=Ku.join("runtime","telemetry","state.json"),e7=Ku.join("runtime","telemetry","otel-spans.jsonl");var Sw=1;var Tw=15;var t7=3600*1e3;var n7=globalThis.fetch;var o7=Promise.resolve(),i7=Promise.resolve();var s7=new Set(Jr);var a7=yM.randomUUID();var Aw="(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|session|credentials|bearer|literals?|regex(?:es)?|replacements?)",c7=new RegExp(`\\b(${Aw})\\s*([:=])\\s*([^\\s,;]+)`,"giu"),l7=new RegExp(`(--${Aw})(=|\\s+)([^\\s,;]+)`,"giu");(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]="a236314b-1a3b-5499-bed3-364a2cb034a5")}catch{}})();var wM=Object.freeze([{code:"missing_directory",command:"pm init",summary:"Recreate missing tracker directories (pm init is idempotent and restores the scaffold)."},{code:"settings_read_fs_error",command:"pm config list --json",summary:"settings.json could not be read as a regular file and pm fell back to defaults; repair the reported path or permissions, then re-run."},{code:"settings_read_invalid_json",command:"pm config list --json",summary:"settings.json is not valid JSON and pm fell back to defaults; fix the syntax error in the reported path, then re-run."},{code:"settings_read_invalid_schema",command:"pm config list --json",summary:"settings.json failed schema validation and pm fell back to defaults; correct the reported key in the file, then re-run."},{code:"settings_read_merge_failed",command:"pm config list --json",summary:"Global/project settings could not be merged; reconcile the conflicting keys in the reported settings files."},{code:"settings:id_prefix_empty",command:"pm config list --json",summary:'id_prefix is empty; set a non-empty "id_prefix" in settings.json so generated item ids are well-formed.'},{code:"settings:locks_ttl_non_positive",command:"pm config list --json",summary:'locks.ttl_seconds must be positive; set a positive "locks.ttl_seconds" in settings.json.'},{code:"telemetry_state_invalid_json",command:"pm health --check-telemetry",summary:"Local telemetry state file is corrupt; pm recreates it on the next flush. Advisory only."},{code:"telemetry_queue_invalid_rows",command:"pm health --check-telemetry",summary:"The telemetry queue has unparseable rows; they are skipped on the next flush. Advisory only."},{code:"telemetry_queue_pending",command:"pm health --check-telemetry",summary:"Telemetry events are queued; they flush automatically on the next reachable command. Advisory only."},{code:"telemetry_queue_high_retries",command:"pm telemetry flush",summary:"Some queued telemetry events are near retry exhaustion; flush now and verify endpoint reachability before entries are dropped."},{code:"telemetry_endpoint_probe_failed",command:"pm health --check-telemetry",summary:"The telemetry endpoint is unreachable; events stay queued until it recovers. Advisory only."},{code:"telemetry_endpoint_probe_http_status",command:"pm health --check-telemetry",summary:"The telemetry endpoint returned a non-success status; events stay queued until it recovers. Advisory only."},{code:"telemetry_schema_version_behind",command:"pm health --check-telemetry",summary:"Client schema is behind server; upgrade pm-cli to emit the latest event shape."},{code:"telemetry_otel_export_failing",command:"pm health --check-telemetry",summary:"OTLP trace spans are queued but the traces endpoint export is failing; spans retry automatically on the next reachable command, or set PM_TELEMETRY_OTEL_DISABLED=1 to skip OTLP export. Advisory only."},{code:"merge_driver_configuration_missing",command:"pm merge install",summary:"Install the clone-local Git drivers required by the tracker merge fence."},{code:"merge_driver_configuration_drift",command:"pm merge install",summary:"Reinstall clone-local Git drivers after runtime or package paths change."},{code:"validate_merge_driver_configuration",command:"pm merge install",summary:"Restore missing or drifted clone-local Git merge driver commands."},{code:"integrity_item_unreadable",command:"pm validate --check-files --verbose-diagnostics",summary:"An item file could not be read; restore or repair the file at the reported path."},{code:"integrity_item_parse_failed",command:"pm validate --check-files --verbose-diagnostics",summary:"An item file failed to parse; fix the malformed item metadata at the reported path."},{code:"integrity_item_conflict_marker",command:"pm validate --check-files --verbose-diagnostics",summary:"An item file contains Git conflict markers; resolve the <<<<<<< / >>>>>>> markers at the reported line."},{code:"integrity_history_unreadable",command:"pm history-repair <id>",summary:"A history stream could not be read; re-anchor the affected item's history chain."},{code:"integrity_history_invalid_json",command:"pm history-repair <id>",summary:"A history stream contains invalid JSON; re-anchor the affected item's history chain."},{code:"integrity_history_conflict_marker",command:"pm history-repair <id>",summary:"A history stream contains Git conflict markers; resolve the markers, then re-anchor the chain."},{code:"validate_storage_unreadable_items",command:"pm validate --check-storage-integrity --verbose-diagnostics",summary:"An on-disk item file cannot be parsed (for example a botched merge resolution with stale TOON count headers); repair or restore the file at the reported path \u2014 list commands silently skip it while pm get hard-errors."},{code:"validate_storage_duplicate_item_ids",command:"pm validate --check-storage-integrity --verbose-diagnostics",summary:"One item id is claimed by multiple item documents \u2014 usually two branches minting the same id for different items before merging (GH-600). Keep one document, recreate the other item under a fresh id (pm copy, then delete the colliding file), and consider raising ids.token_length for concurrent multi-agent work."},{code:"validate_storage_history_conflict_markers",command:"pm merge driver history <base> <ours> <theirs>",summary:"A history stream contains unresolved Git conflict markers; re-merge it with the pm history merge driver (or resolve the markers by hand), then run pm history-repair for the item."},{code:"validate_storage_unparseable_history",command:"pm history-repair <id>",summary:"A history stream's newest line is not valid JSONL; repair or restore the stream before further mutations."},{code:"validate_storage_resurrected_items",command:"pm delete <id>",summary:"A live item's newest history operation is a delete: a delete/modify merge silently resurrected it. Decide the winner \u2014 re-delete the item, or keep it and append a mutation documenting the revival."},{code:"validate_storage_unparseable_config",command:"pm merge driver json <base> <ours> <theirs>",summary:"settings.json or a schema file cannot be parsed, so pm silently falls back to defaults; re-merge it with the pm JSON merge driver or fix the file by hand, then rerun pm validate."},{code:"validate_merge_fence_drift",command:"pm merge install",summary:"The committed .gitattributes merge fence no longer matches the active schema's type folders or tracker JSONL stores; rerun pm merge install (and commit .gitattributes) so every tracker artifact keeps its field-aware merge driver."},{code:"validate_storage_tracked_runtime_cache_files",command:"git rm --cached -r -- <tracked-runtime-directories>",summary:"Clone-local tracker runtime artifacts are committed. Run the exact tracked_runtime_cache.remediation_command, commit the index-only removals and managed .gitignore fence, then rerun validation."},{code:"integrity_item_outdated_format_version",command:"pm validate --verbose-diagnostics",summary:"An item predates the current storage format version; a pm storage migration rewrites it. Use --verbose-diagnostics to list the affected items."},{code:"integrity_item_ahead_format_version",command:"npm install -g @unbrained/pm-cli@latest",summary:"An item was written by a newer pm format version than this runtime supports; upgrade pm to read and validate it safely."},{code:"tracked_runtime_cache_files",command:"git rm --cached -r -- <tracked-runtime-directories>",summary:"Clone-local tracker runtime artifacts are committed. Run the exact tracked_runtime_cache.remediation_command from the integrity check, commit the index-only removals, and keep the managed .gitignore fence."},{code:"merge_decisions_unreviewed",command:"pm merge reconcile --dry-run",summary:"Review the pending merge receipts, re-apply any intended discarded values, then run pm merge reconcile; lossy receipts require explicit --force acceptance."},{code:"merge_receipts_pending",command:"pm merge reconcile",summary:"A lossless merge receipt is still pending; run pm merge reconcile to settle it (optionally preview first with --dry-run) so a green health gate certifies receipt settlement, not only intact data."},{code:"merge_receipt_evidence_invalid",command:"pm merge report --include-reconciled --json",summary:"One or more receipt candidates failed bounded-file, schema, identity, or copy-consistency validation; inspect the report's privacy-safe source, receipt id, and reason before repairing only the named evidence."},{code:"merge_receipt_history_reference_missing",command:"pm merge reconcile --dry-run",summary:"Review the bounded coordinates and recover available evidence first; for exact pre-durable clone-local-only references, rerun with --force so pm appends an audited disposition and proves the health finding is cleared without rewriting history."},{code:"validate_merge_decisions_unreviewed",command:"pm merge reconcile --dry-run",summary:"Review the pending merge receipts before reconciliation; history-repair alone does not settle them, and lossy receipts require explicit --force acceptance."},{code:"history_drift_missing_stream",command:"pm history-repair <id>",summary:"The item has no history stream; re-anchor the chain to rebuild it (pm history-repair --all repairs every drifted stream in one pass)."},{code:"history_drift_unreadable_stream",command:"pm history-repair <id>",summary:"The item's history stream is unreadable; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass)."},{code:"history_drift_hash_mismatch",command:"pm history-repair <id>",summary:"The item's content hash no longer matches its history; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass)."},{code:"history_drift_chain_mismatch",command:"pm history-repair <id>",summary:"The item's history chain is broken; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass)."},{code:"history_drift_version_skew",command:"npm install -g @unbrained/pm-cli@latest",summary:"A history stream declares an item hash version this runtime does not support; upgrade pm to verify the chain instead of re-anchoring it."},{code:"history_drift_merge_receipt",command:"pm merge reconcile",summary:"Canonical path, changed-field, and merged-value hash evidence attributes this drift to a pending receipt; run reconciliation (optionally preview first with --dry-run) instead of repairing history directly."},{code:"history_stream_over_compact_threshold",command:"pm history-compact <id>",summary:"The history stream exceeds the configured compaction threshold; compact it (pm history-compact --all-streams sweeps every over-threshold stream in one pass)."},{code:"history_unknown_author_events",command:'pm history-author-acknowledge --all-actionable --attributed-author "<principal>" --reviewer "<reviewer>" --reason "<evidence>"',summary:"Review the actionable coordinates, then record an append-only attribution disposition for the complete current set."},{code:"provenance_value_domain_invalid",command:"pm history-repair --all --normalize-provenance",summary:"Remove invalid bounded provenance observations from affected streams and append privacy-safe aggregate repair receipts."},{code:"validate_history_unknown_author_events",command:'pm history-author-acknowledge --all-actionable --attributed-author "<principal>" --reviewer "<reviewer>" --reason "<evidence>"',summary:"Review the actionable coordinates, then record an append-only attribution disposition for the complete current set."},{code:"locks_stale_count",command:"pm gc --scope locks",summary:"Stale item-claim locks (embedded ttl elapsed) can block mutations; sweep them \u2014 gc retains active and unparseable locks."},{code:"locks_unreadable",command:"pm gc --scope locks --dry-run",summary:"Some lock files could not be read; preview the sweep and inspect the unreadable files manually \u2014 gc never deletes what it cannot read."},{code:"extension_update_health_partial_coverage",command:"pm extension --adopt-all --project",summary:"Update-health coverage is partial because unmanaged extensions were skipped; adopt the existing installs into managed metadata so the update scan covers them (use --global for global-scope extensions, or pm package --adopt-all when working with packages)."},{code:"vectorization_stale_items_remaining",command:"pm health --refresh-vectors",summary:"Some items have stale embeddings; refresh vectors so semantic search results stay current."},{code:"vectorization_embedding_identity_changed",command:"pm reindex --mode semantic",summary:"Embedding provider/model changed since the last index; run a semantic reindex to rebuild vectors."},{code:"validate_metadata_missing_closed_at",command:"pm validate --check-metadata --auto-fix --fix-scope timestamps --dry-run",summary:"Preview closure dates proven by verified lifecycle history; inspect residuals and omit --dry-run to apply only proven dates."},{code:"validate_metadata_missing_acceptance_criteria",command:'pm update <id> --acceptance-criteria "<criteria>"',summary:"Backfill the missing acceptance criteria on the reported item(s)."},{code:"validate_metadata_missing_estimate",command:'pm update <id> --estimate "<estimate>"',summary:"Backfill the missing estimate on the reported item(s)."},{code:"validate_metadata_missing_close_reason",command:'pm update <id> --close-reason "<reason>"',summary:"Backfill the missing close reason on the reported closed item(s)."},{code:"validate_metadata_missing_reviewer",command:'pm update <id> --reviewer "<name>"',summary:"Backfill the missing reviewer on the reported item(s)."},{code:"validate_metadata_missing_risk",command:'pm update <id> --risk "<level>"',summary:"Backfill the missing risk on the reported item(s)."},{code:"validate_metadata_missing_confidence",command:'pm update <id> --confidence "<level>"',summary:"Backfill the missing confidence on the reported item(s)."},{code:"validate_metadata_missing_sprint",command:'pm update <id> --sprint "<sprint>"',summary:"Backfill the missing sprint on the reported item(s)."},{code:"validate_metadata_missing_release",command:'pm update <id> --release "<release>"',summary:"Backfill the missing release on the reported item(s)."},{code:"validate_metadata_custom_profile_missing_required_fields",command:'pm config set metadata-required-fields --criterion "<field>"',summary:"Config-driven finding: the custom metadata profile has no required fields configured and falls back to core, so configure the fields rather than mutating items."},{code:"validate_metadata_duplicate_issue_codes",command:'pm update <id> --title "<distinct title>"',summary:"Two or more items share one logical issue code (GH-235); give each a distinct title so the derived code is unique, or close the redundant item with pm close <id> --duplicate-of <canonical-id> (closed-as-duplicate items are excluded from the check)."},{code:"validate_resolution_missing_fields",command:'pm update <id> --resolution "<how resolved>"',summary:"Backfill resolution / expected_result / actual_result on the reported closed item(s)."},{code:"validate_lifecycle_active_closure_like_metadata",command:"pm update <id> --unset <closure-like-field>",summary:"Clear the closure-like field the validator flags on this active item \u2014 the detail row names it (resolution / actual-result / blocked-reason) \u2014 or close the item if it is actually done."},{code:"validate_lifecycle_active_terminal_parent",command:"pm update <id> --parent <active-parent-id>",summary:"Reopen the terminal parent or move the active child under a non-terminal parent."},{code:"validate_lifecycle_stale_blockers",command:"pm update <id> --unset blocked-by --unset blocked-reason",summary:"Resolve the stale blocker the validator flags: clear blocked-by/blocked-reason when they linger on a non-blocked item or report a resolved blocker; if instead a blocked item is missing blocker context, add the context or move it out of a blocked status."},{code:"validate_lifecycle_dependency_cycles_error",command:"pm update <id> --dep-remove <dep-id>",summary:"Break the dependency cycle by removing one edge from the reported cycle."},{code:"validate_lifecycle_dependency_cycles",command:"pm update <id> --dep-remove <dep-id>",summary:"Break the dependency cycle by removing one edge from the reported cycle."},{code:"validate_hierarchy_parent_cycle_error",command:"pm update <id> --parent <other-id>",summary:"Break the parent-hierarchy cycle by reparenting one item in the reported cycle to a non-cyclic parent (or clear it with pm update <id> --unset parent)."},{code:"validate_hierarchy_parent_cycle",command:"pm update <id> --parent <other-id>",summary:"Break the parent-hierarchy cycle by reparenting one item in the reported cycle to a non-cyclic parent (or clear it with pm update <id> --unset parent)."},{code:"validate_files_missing_linked_paths",command:"pm <files|docs> <id> --remove <path>",summary:"The check spans both item.files and item.docs under one code: restore the missing linked artifact, or unlink it with pm files (linked file) or pm docs (linked doc)."},{code:"validate_files_orphaned_paths",command:"pm <files|docs> <id> --add <path>",summary:"Link the orphaned artifact with pm files (file) or pm docs (doc), or remove it from the workspace."},{code:"validate_files_tracked_all_strict_forces_pm_internals",command:"pm validate --check-files --include-pm-internals",summary:"tracked-all-strict scan flagged pm internals; re-run with --include-pm-internals or a softer --scan-mode."},{code:"validate_history_drift_missing_streams",command:"pm history-repair <id>",summary:"Re-anchor the history chains of the items missing a history stream."},{code:"validate_history_drift_unreadable_streams",command:"pm history-repair <id>",summary:"Re-anchor the history chains of the items with an unreadable history stream."},{code:"validate_history_drift_hash_mismatches",command:"pm history-repair <id>",summary:"Re-anchor the history chains of the items whose content hash drifted."},{code:"validate_history_drift_chain_mismatches",command:"pm history-repair <id>",summary:"Re-anchor the history chains of the items with a broken history chain."},{code:"validate_history_drift_version_skews",command:"npm install -g @unbrained/pm-cli@latest",summary:"One or more history streams declare an item hash version this runtime does not support; upgrade pm to verify the chains instead of re-anchoring them."},{code:"validate_command_references_stale_pm_ids",command:'pm update <id> --replace-tests --test "command=<corrected-command>" [--test ...]',summary:"Correct the stale pm-ID inside the item's linked test command (the check scans tests[].command, not the body). --replace-tests overwrites the entire tests list, so re-include the item's other linked tests in the same call."},{code:"validate_format_version_outdated_items",command:"pm validate --verbose-diagnostics",summary:"One or more items predate the current storage format version; a pm storage migration rewrites them. Use --verbose-diagnostics to list the affected items."},{code:"validate_format_version_ahead_items",command:"npm install -g @unbrained/pm-cli@latest",summary:"One or more items were written by a newer pm format version than this runtime supports; upgrade pm to read and validate them safely."}]);function Yu(e){if(typeof e!="string")return;let t=e.trim();for(let n of wM)if(t===n.code||t.startsWith(`${n.code}:`))return n}function Ju(e){let t={};for(let n of e){let r=Yu(n);r!==void 0&&!Object.prototype.hasOwnProperty.call(t,r.code)&&(t[r.code]=r.command)}return t}function Iw(e){return Object.values(Ju(e))}import xw from"node:fs/promises";import{createRequire as bM}from"node:module";import ot 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]="a0014621-9e3d-5620-8f36-081811054843")}catch{}})();function Cw(e,t){let n=ot.relative(t,e);if(n.length>0&&n!==".."&&!n.startsWith(`..${ot.sep}`)&&!ot.isAbsolute(n))return n.split(ot.sep).join("/");let r=ot.resolve(e),o=0xcbf29ce484222325n;for(let s=0;s<r.length;s+=1)o^=BigInt(r.charCodeAt(s)),o=BigInt.asUintN(64,o*0x100000001b3n);return`<external>/${o.toString(16).padStart(16,"0")}/${ot.basename(ot.dirname(e))}/package.json`}function vM(e){return e.includes(`${ot.sep}.pnpm${ot.sep}`)?"pnpm":e.includes(`${ot.sep}node_modules${ot.sep}`)?"npm":"other"}async function Ow(e){try{let t=JSON.parse(await xw.readFile(e,"utf8"));return t.name==="@unbrained/pm-cli"&&typeof t.version=="string"&&t.version.trim().length>0?t.version.trim():void 0}catch{return}}async function Xu(e){try{return await xw.realpath(e)}catch{return ot.resolve(e)}}async function Rw(e,t,n=tt(import.meta.url,["../../.."])){let r=await Xu(t),o=await Xu(ot.join(n,"package.json")),i=await Ow(o),s=new Map;i!==void 0&&s.set(o,{version:i,path:Cw(o,r),layout:"host",consumers:["pm-cli-host"]});for(let l of e)try{let d=bM(l.entry_path).resolve("@unbrained/pm-cli/package.json"),u=await Xu(d),f=await Ow(u);if(f===void 0)continue;let m=u,p=s.get(m);if(p){p.consumers.includes(l.name)||(p.consumers.push(l.name),p.consumers.sort((w,y)=>w.localeCompare(y)));continue}s.set(m,{version:f,path:Cw(u,r),layout:vM(u),consumers:[l.name]})}catch{}let a=[...s.values()].sort((l,d)=>l.path.localeCompare(d.path)),c=i===void 0?[]:a.filter(l=>l.version!==i);return{host_version:i??null,copies:a,mismatches:c,warnings:c.map(l=>`extension_host_pm_cli_version_skew:${i}:${l.version}:${l.consumers.join("+")}`)}}import Rf from"node:fs/promises";import Nf from"node:path";import{Option as ure}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="93b04081-a71a-5987-8fb6-09a8d045c1da")}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]="8ed4af4c-40cf-5902-930b-78a4758871b2")}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]="fdacd8ac-787a-5639-84d5-a32b6ce79d41")}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]="854a0596-b0ec-5d2e-85b1-5444d8d7b622")}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]="e6571e4b-c436-5af7-be01-c3fce3a9c5d3")}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]="91874535-458b-5a33-a68a-96f44bd2e1f8")}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]="b0306587-b3bb-5f82-bb56-7939d1976870")}catch{}})();var kM={critical:0,high:1,medium:2,low:3,minimal:4},EM=Object.keys(kM),q7=`numbers 0..4 (0=critical, 1=high, 2=medium, 3=low, 4=minimal) or names (${EM.join(", ")}), case-insensitive`;(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]="bfb46357-04de-55a0-b132-779c153314de")}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]="0eff4d63-2691-5130-bc12-4957218393b5")}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]="eb151177-d326-5ce4-9624-87f6393046e0")}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]="41196e9d-00c2-5473-848d-7563463c42a7")}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]="df9abedd-6e84-5712-8e5e-4e510ec3ed60")}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]="24688724-53cd-5375-ae7e-cfe098cd0dc8")}catch{}})();var sX=new Map(Sc.map(e=>[e.toLowerCase(),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]="7778b388-1b28-53e7-a06e-ef6441b0ed68")}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]="ef20c613-623c-5a11-8384-ccf4ee3addde")}catch{}})();import{createRequire as TM}from"node:module";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="12bf6794-9410-5683-bb83-a0da8d2614a7")}catch{}})();var AM=/(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|credentials|bearer|dsn)/i,yX=new RegExp(`\\b(${AM.source})\\s*[:=]\\s*([^\\s,;]+)`,"giu");var wX=TM(import.meta.url);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="199c4791-6ca7-50c4-b2cd-aa96c0ab2408")}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]="d7a68072-168d-509a-95ec-145635d71d46")}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]="eed441f0-e2b5-51e9-b9bf-0f4882a9eeea")}catch{}})();var IM=[{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"}],DX=new Map(IM.map(e=>[e.action,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]="c18e4dfc-d3e3-5185-9470-9d46b4dca893")}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]="54784ad1-36bd-5a10-aa00-ad0b09e935a7")}catch{}})();import CM 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]="cdae67c6-8316-5e97-84ca-0be4460ffd57")}catch{}})();function Ha(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function OM(e,t){return[e.updated_at,t].map(r=>({value:r,time:Date.parse(r??"")})).filter(r=>typeof r.value=="string"&&Number.isFinite(r.time)).sort((r,o)=>o.time-r.time)[0]?.value??e.updated_at}function Dw(e,t){let n=Math.max(1,Math.trunc(t.threshold_hours)),r=(t.now??new Date).getTime(),o=Ha(t.in_progress_status),i=[];for(let s of e){if(Ha(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=OM(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let l=Math.max(0,Math.floor((r-c)/36e5));l>=n&&i.push({id:s.id,last_activity_at:a,age_hours:l})}return i.sort((s,a)=>a.age_hours-s.age_hours||s.id.localeCompare(a.id)),{threshold_hours:n,count:i.length,items:i,remediation:"Claim active work with `pm claim <id>` or return abandoned work to open with `pm update <id> --status open`."}}async function Zu(e,t,n){let r=new Map;return await Promise.all(t.filter(o=>Ha(String(o.status))===Ha(n.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await nt(CM.join(e,"history",`${o.id}.jsonl`),o.id)}catch{return}let s=i.map(a=>a.ts).filter(a=>Number.isFinite(Date.parse(a))).sort((a,c)=>Date.parse(c)-Date.parse(a))[0];s&&r.set(o.id,s)})),Dw(t,{...n,last_history_activity:o=>r.get(o.id)})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eb1afbe5-eb0a-56d2-bb94-80fd427325f7")}catch{}})();var HX=Object.freeze({"&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&amp;":"&"});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4873876d-67b4-5f79-a984-756b7e539e9b")}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]="3940f646-f84d-5eb0-8db1-de64ca0a5985")}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]="f3edff87-6ea5-5108-a749-eeb380870601")}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]="1ad4a739-f29d-5b50-b1cf-f8590804e32b")}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]="d2940263-a7b4-5d29-b1e5-631fe1072a5b")}catch{}})();import tZ from"node:readline/promises";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="91cfc9cf-9ab1-5c9f-803d-f378e9963c4a")}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]="d27383c3-03c8-51ff-98c5-700cc6c2c114")}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]="497e2b9b-39e8-57c6-a040-3bf8cbac0324")}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]="76a156ee-aebd-547e-b4c2-1ed1b172fd6b")}catch{}})();var Qu=[{target:"title",keys:["title"],option:"--title, -t <value>",description:"Item title [required] (or pass title as the first positional argument)"},{target:"id",keys:["id"],option:"--id <value>",description:"Explicit item id (normalized with the configured id_prefix)"},{target:"description",keys:["description"],option:"--description, -d <value>",description:"Item description (allow empty string)"},{target:"type",keys:["type"],option:"--type <value>",description:"Item type (built-ins plus any configured custom types)"},{target:"template",keys:["template"],option:"--template <value>",description:"Apply named create template defaults before explicit flags"},{target:"createMode",keys:["createMode","create_mode"],option:"--create-mode <value>",description:"Create required-option policy mode: strict|progressive",aliasOptions:[{option:"--create_mode <value>",description:"Alias for --create-mode"}]},{target:"schedulePreset",keys:["schedulePreset","schedule_preset"],option:"--schedule-preset <value>",description:"Scheduling preset for Reminder|Meeting|Event: lightweight",aliasOptions:[{option:"--schedule_preset <value>",description:"Alias for --schedule-preset"}]},{target:"status",keys:["status"],option:"--status, -s <value>",description:"Item status"},{target:"closeReason",keys:["closeReason","close_reason"],option:"--close-reason <value>",description:"Close reason when creating directly in a terminal status",aliasOptions:[{option:"--close_reason <value>",description:"Alias for --close-reason"}]},{target:"completedAt",keys:["completedAt","completed_at"],option:"--completed-at <value>",description:"Actual completion time for a terminal imported item",aliasOptions:[{option:"--completed_at <value>",description:"Alias for --completed-at"}]},{target:"priority",keys:["priority"],option:"--priority, -p <value>",description:"Priority 0..4"},{target:"tags",keys:["tags"],option:"--tags <value>",description:"Comma-separated tags"},{target:"addTags",keys:["addTags","add_tags"],option:"--add-tags <value>",description:"Add tags additively on top of --tags (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--add_tags <value>",description:"Alias for --add-tags"}]},{target:"body",keys:["body"],option:"--body, -b <value>",description:"Item markdown body (allow empty string)"},{target:"deadline",keys:["deadline"],option:"--deadline <value>",description:"Deadline (ISO/date string or relative +6h/+1d/+2w/+6m)"},{target:"estimatedMinutes",keys:["estimate","estimatedMinutes","estimated_minutes"],option:"--estimate, --estimated-minutes <value>",description:"Estimated minutes",aliasOptions:[{option:"--estimated_minutes <value>",description:"Alias for --estimated-minutes"}]},{target:"acceptanceCriteria",keys:["acceptanceCriteria","acceptance_criteria","ac"],option:"--acceptance-criteria <value>",description:"Acceptance criteria (repeatable; values join with '; '; allow empty string)",repeatable:!0,aliasOptions:[{option:"--acceptance_criteria <value>",description:"Alias for --acceptance-criteria"},{option:"--ac <value>",description:"Alias for --acceptance-criteria"}]},{target:"definitionOfReady",keys:["definitionOfReady","definition_of_ready"],option:"--definition-of-ready <value>",description:"Definition of ready (allow empty string)",aliasOptions:[{option:"--definition_of_ready <value>",description:"Alias for --definition-of-ready"}]},{target:"order",keys:["order"],option:"--order <value>",description:"Planning order/rank integer"},{target:"rank",keys:["rank"],option:"--rank <value>",description:"Alias for --order"},{target:"goal",keys:["goal"],option:"--goal <value>",description:"Goal identifier"},{target:"objective",keys:["objective"],option:"--objective <value>",description:"Objective identifier"},{target:"value",keys:["value"],option:"--value <value>",description:"Business value summary"},{target:"impact",keys:["impact"],option:"--impact <value>",description:"Business impact summary"},{target:"outcome",keys:["outcome"],option:"--outcome <value>",description:"Expected outcome summary"},{target:"whyNow",keys:["whyNow","why_now"],option:"--why-now <value>",description:"Why-now rationale",aliasOptions:[{option:"--why_now <value>",description:"Alias for --why-now"}]},{target:"author",keys:["author"],option:"--author <value>",description:"Mutation author"},{target:"message",keys:["message"],option:"--message <value>",description:"History message (allow empty string)"},{target:"assignee",keys:["assignee"],option:"--assignee <value>",description:"Item assignee"},{target:"parent",keys:["parent"],option:"--parent <value>",description:"Parent item ID"},{target:"allowMissingParent",keys:["allowMissingParent","allow_missing_parent"],option:"--allow-missing-parent",description:"Allow creating with an unresolved parent reference and emit a validation warning"},{target:"allowUnresolvedDeps",keys:["allowUnresolvedDeps","allow_unresolved_deps"],option:"--allow-unresolved-deps",description:"Allow unresolved local dependency targets and emit explicit warning receipts"},{target:"reviewer",keys:["reviewer"],option:"--reviewer <value>",description:"Reviewer"},{target:"risk",keys:["risk"],option:"--risk <value>",description:"Risk level: low|med|medium|high|critical (med persists as medium)"},{target:"confidence",keys:["confidence"],option:"--confidence <value>",description:"Confidence level: 0..100|low|med|medium|high (med persists as medium)"},{target:"sprint",keys:["sprint"],option:"--sprint <value>",description:"Sprint identifier"},{target:"release",keys:["release"],option:"--release <value>",description:"Release identifier"},{target:"blockedBy",keys:["blockedBy","blocked_by"],option:"--blocked-by <value>",description:"Set latest blocked-by item ID or reason; resolved item IDs append a blocked_by dependency edge",aliasOptions:[{option:"--blocked_by <value>",description:"Alias for --blocked-by"}]},{target:"blockedReason",keys:["blockedReason","blocked_reason"],option:"--blocked-reason <value>",description:"Blocked reason",aliasOptions:[{option:"--blocked_reason <value>",description:"Alias for --blocked-reason"}]},{target:"unblockNote",keys:["unblockNote","unblock_note"],option:"--unblock-note <value>",description:"Unblock rationale note",aliasOptions:[{option:"--unblock_note <value>",description:"Alias for --unblock-note"}]},{target:"reporter",keys:["reporter"],option:"--reporter <value>",description:"Issue reporter"},{target:"severity",keys:["severity"],option:"--severity <value>",description:"Issue severity: low|med|medium|high|critical (med persists as medium)"},{target:"environment",keys:["environment"],option:"--environment <value>",description:"Issue environment context"},{target:"reproSteps",keys:["reproSteps","repro_steps"],option:"--repro-steps <value>",description:"Issue reproduction steps",aliasOptions:[{option:"--repro_steps <value>",description:"Alias for --repro-steps"}]},{target:"resolution",keys:["resolution"],option:"--resolution <value>",description:"Issue resolution summary"},{target:"expectedResult",keys:["expectedResult","expected_result","expected"],option:"--expected-result <value>",description:"Issue expected behavior",aliasOptions:[{option:"--expected_result <value>",description:"Alias for --expected-result"},{option:"--expected <value>",description:"Short alias for --expected-result"}]},{target:"actualResult",keys:["actualResult","actual_result","actual"],option:"--actual-result <value>",description:"Issue observed behavior",aliasOptions:[{option:"--actual_result <value>",description:"Alias for --actual-result"},{option:"--actual <value>",description:"Short alias for --actual-result"}]},{target:"affectedVersion",keys:["affectedVersion","affected_version"],option:"--affected-version <value>",description:"Affected version identifier",aliasOptions:[{option:"--affected_version <value>",description:"Alias for --affected-version"}]},{target:"fixedVersion",keys:["fixedVersion","fixed_version"],option:"--fixed-version <value>",description:"Fixed version identifier",aliasOptions:[{option:"--fixed_version <value>",description:"Alias for --fixed-version"}]},{target:"component",keys:["component"],option:"--component <value>",description:"Issue component ownership"},{target:"regression",keys:["regression"],option:"--regression [value]",description:"Regression marker; bare flag means true, or pass true|false|1|0"},{target:"customerImpact",keys:["customerImpact","customer_impact"],option:"--customer-impact <value>",description:"Customer impact summary",aliasOptions:[{option:"--customer_impact <value>",description:"Alias for --customer-impact"}]},{target:"dep",keys:["dep"],option:"--dep <value>",description:"Seed dependency entry (key=value CSV, markdown key:value lines, or - for stdin; repeatable)",repeatable:!0},{target:"typeOption",keys:["typeOption","type_option"],option:"--type-option <value>",description:"Type option key=value or key=<name>,value=<value> (also accepts key:value and markdown pairs; use - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--type_option <value>",description:"Alias for --type-option"}]},{target:"field",keys:["field"],option:"--field <name=value>",description:"Set a field declared by an active extension registerItemFields registration (repeatable)",repeatable:!0},{target:"unset",keys:["unset"],option:"--unset <field>",description:"Clear scalar metadata field by name (repeatable)",repeatable:!0},{target:"reminder",keys:["reminder"],option:"--reminder <value>",description:"Seed reminder entry at=<iso|relative>,text=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"event",keys:["event"],option:"--event <value>",description:"Seed event entry start=<iso|relative>,end=<iso|relative>,duration=<relative|30min|PT30M>,title=<text>,all_day=<true|false>,recur_* fields (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"comment",keys:["comment"],option:"--comment <value>",description:"Seed comment entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"note",keys:["note"],option:"--note <value>",description:"Seed note entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"learning",keys:["learning"],option:"--learning <value>",description:"Seed learning entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"file",keys:["file","linkedFile"],option:"--file <value>",description:"Seed linked file entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--linked-file <value>",description:"Alias for --file (cross-surface name)"}]},{target:"test",keys:["test","linkedTest"],option:"--test <value>",description:"Seed linked test entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--linked-test <value>",description:"Alias for --test (cross-surface name)"}]},{target:"doc",keys:["doc"],option:"--doc <value>",description:"Seed linked doc entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0}],Lw=Qu.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),Mw=Qu.filter(e=>e.repeatable===!0).map(e=>({target:e.target,keys:e.keys})),ef=[{target:"title",keys:["title"],option:"--title, -t <value>",description:"Set title"},{target:"description",keys:["description"],option:"--description, -d <value>",description:"Set description"},{target:"body",keys:["body"],option:"--body, -b <value>",description:"Set body (allow empty string)"},{target:"status",keys:["status"],option:"--status, -s <value>",description:"Set status (use close command for closed)"},{target:"closeReason",keys:["closeReason","close_reason"],option:"--close-reason <value>",description:"Set close reason",aliasOptions:[{option:"--close_reason <value>",description:"Alias for --close-reason"}]},{target:"priority",keys:["priority"],option:"--priority, -p <value>",description:"Set priority"},{target:"type",keys:["type"],option:"--type <value>",description:"Set type"},{target:"tags",keys:["tags"],option:"--tags <value>",description:"Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively."},{target:"addTags",keys:["addTags","add_tags"],option:"--add-tags <value>",description:"Add tags to the existing list without replacing it (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--add_tags <value>",description:"Alias for --add-tags"}]},{target:"removeTags",keys:["removeTags","remove_tags"],option:"--remove-tags <value>",description:"Remove tags from the existing list (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--remove_tags <value>",description:"Alias for --remove-tags"}]},{target:"deadline",keys:["deadline"],option:"--deadline <value>",description:"Set deadline (ISO/date string or relative)"},{target:"estimatedMinutes",keys:["estimate","estimatedMinutes","estimated_minutes"],option:"--estimate, --estimated-minutes <value>",description:"Set estimated minutes",aliasOptions:[{option:"--estimated_minutes <value>",description:"Alias for --estimated-minutes"}]},{target:"acceptanceCriteria",keys:["acceptanceCriteria","acceptance_criteria","ac"],option:"--acceptance-criteria <value>",description:"Replace the complete acceptance-criteria list (repeatable values join with '; '); use --remove-ac plus --add-ac for one-entry repair",repeatable:!0,aliasOptions:[{option:"--acceptance_criteria <value>",description:"Alias for --acceptance-criteria"},{option:"--ac <value>",description:"Alias for --acceptance-criteria"}]},{target:"addAc",keys:["addAc","add_ac"],option:"--add-ac <value>",description:"Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",repeatable:!0,aliasOptions:[{option:"--add_ac <value>",description:"Alias for --add-ac"}]},{target:"removeAc",keys:["removeAc","remove_ac"],option:"--remove-ac <value>",description:"Remove one semicolon-free acceptance criterion by exact text match; fails if any selector is unmatched (repeatable)",repeatable:!0,aliasOptions:[{option:"--remove_ac <value>",description:"Alias for --remove-ac"}]},{target:"definitionOfReady",keys:["definitionOfReady","definition_of_ready"],option:"--definition-of-ready <value>",description:"Set definition of ready",aliasOptions:[{option:"--definition_of_ready <value>",description:"Alias for --definition-of-ready"}]},{target:"order",keys:["order"],option:"--order <value>",description:"Set planning order/rank integer"},{target:"rank",keys:["rank"],option:"--rank <value>",description:"Alias for --order"},{target:"goal",keys:["goal"],option:"--goal <value>",description:"Set goal identifier"},{target:"objective",keys:["objective"],option:"--objective <value>",description:"Set objective identifier"},{target:"value",keys:["value"],option:"--value <value>",description:"Set business value summary"},{target:"impact",keys:["impact"],option:"--impact <value>",description:"Set business impact summary"},{target:"outcome",keys:["outcome"],option:"--outcome <value>",description:"Set expected outcome summary"},{target:"whyNow",keys:["whyNow","why_now"],option:"--why-now <value>",description:"Set why-now rationale",aliasOptions:[{option:"--why_now <value>",description:"Alias for --why-now"}]},{target:"author",keys:["author"],option:"--author <value>",description:"Mutation author"},{target:"message",keys:["message"],option:"--message <value>",description:"Mutation message"},{target:"assignee",keys:["assignee"],option:"--assignee <value>",description:"Set assignee"},{target:"parent",keys:["parent"],option:"--parent <value>",description:"Set parent item ID"},{target:"allowMissingParent",keys:["allowMissingParent","allow_missing_parent"],option:"--allow-missing-parent",description:"Allow updating to an unresolved parent reference and emit a validation warning"},{target:"allowUnresolvedDeps",keys:["allowUnresolvedDeps","allow_unresolved_deps"],option:"--allow-unresolved-deps",description:"Allow unresolved local dependency targets and emit explicit warning receipts"},{target:"completedAt",keys:["completedAt","completed_at"],option:"--completed-at <value>",description:"Correct the actual completion timestamp on a terminal item"},{target:"reviewer",keys:["reviewer"],option:"--reviewer <value>",description:"Set reviewer"},{target:"risk",keys:["risk"],option:"--risk <value>",description:"Set risk level: low|med|medium|high|critical (med persists as medium)"},{target:"confidence",keys:["confidence"],option:"--confidence <value>",description:"Set confidence level: 0..100|low|med|medium|high (med persists as medium)"},{target:"sprint",keys:["sprint"],option:"--sprint <value>",description:"Set sprint identifier"},{target:"release",keys:["release"],option:"--release <value>",description:"Set release identifier"},{target:"blockedBy",keys:["blockedBy","blocked_by"],option:"--blocked-by <value>",description:"Set latest blocked-by item ID or reason; resolved item IDs append a blocked_by dependency edge",aliasOptions:[{option:"--blocked_by <value>",description:"Alias for --blocked-by"}]},{target:"blockedReason",keys:["blockedReason","blocked_reason"],option:"--blocked-reason <value>",description:"Set blocked reason",aliasOptions:[{option:"--blocked_reason <value>",description:"Alias for --blocked-reason"}]},{target:"unblockNote",keys:["unblockNote","unblock_note"],option:"--unblock-note <value>",description:"Set unblock rationale note",aliasOptions:[{option:"--unblock_note <value>",description:"Alias for --unblock-note"}]},{target:"reporter",keys:["reporter"],option:"--reporter <value>",description:"Set issue reporter"},{target:"severity",keys:["severity"],option:"--severity <value>",description:"Set issue severity: low|med|medium|high|critical (med persists as medium)"},{target:"environment",keys:["environment"],option:"--environment <value>",description:"Set issue environment context"},{target:"reproSteps",keys:["reproSteps","repro_steps"],option:"--repro-steps <value>",description:"Set issue reproduction steps",aliasOptions:[{option:"--repro_steps <value>",description:"Alias for --repro-steps"}]},{target:"resolution",keys:["resolution"],option:"--resolution <value>",description:"Set issue resolution summary"},{target:"expectedResult",keys:["expectedResult","expected_result","expected"],option:"--expected-result <value>",description:"Set issue expected behavior",aliasOptions:[{option:"--expected_result <value>",description:"Alias for --expected-result"},{option:"--expected <value>",description:"Short alias for --expected-result"}]},{target:"actualResult",keys:["actualResult","actual_result","actual"],option:"--actual-result <value>",description:"Set issue observed behavior",aliasOptions:[{option:"--actual_result <value>",description:"Alias for --actual-result"},{option:"--actual <value>",description:"Short alias for --actual-result"}]},{target:"affectedVersion",keys:["affectedVersion","affected_version"],option:"--affected-version <value>",description:"Set affected version identifier",aliasOptions:[{option:"--affected_version <value>",description:"Alias for --affected-version"}]},{target:"fixedVersion",keys:["fixedVersion","fixed_version"],option:"--fixed-version <value>",description:"Set fixed version identifier",aliasOptions:[{option:"--fixed_version <value>",description:"Alias for --fixed-version"}]},{target:"component",keys:["component"],option:"--component <value>",description:"Set issue component ownership"},{target:"regression",keys:["regression"],option:"--regression [value]",description:"Set regression marker; bare flag means true, or pass true|false|1|0"},{target:"customerImpact",keys:["customerImpact","customer_impact"],option:"--customer-impact <value>",description:"Set customer impact summary",aliasOptions:[{option:"--customer_impact <value>",description:"Alias for --customer-impact"}]},{target:"dep",keys:["dep"],option:"--dep <value>",description:"Add dependency entries id=<id>,kind=<value>,author=<value>,created_at=<iso|now>,source_kind=<value> (repeatable)",repeatable:!0},{target:"depRemove",keys:["depRemove","dep_remove"],option:"--dep-remove <value>",description:"Remove by dependency id or exact row signature (repeatable)",repeatable:!0,aliasOptions:[{option:"--dep_remove <value>",description:"Alias for --dep-remove"}]},{target:"comment",keys:["comment"],option:"--comment <value>",description:"Append comment seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"note",keys:["note"],option:"--note <value>",description:"Append note seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"learning",keys:["learning"],option:"--learning <value>",description:"Append learning seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"file",keys:["file","linkedFile"],option:"--file <value>",description:"Append linked file path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--linked-file <value>",description:"Alias for --file (cross-surface name)"}]},{target:"test",keys:["test","linkedTest"],option:"--test <value>",description:"Append linked test command=<value>,path=<value>,scope=<project|global>,timeout_seconds=<n>,pm_context_mode=<schema|tracker|auto> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--linked-test <value>",description:"Alias for --test (cross-surface name)"}]},{target:"doc",keys:["doc"],option:"--doc <value>",description:"Append linked doc path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"reminder",keys:["reminder"],option:"--reminder <value>",description:"Set reminders at=<iso|relative>,text=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"event",keys:["event"],option:"--event <value>",description:"Set events start=<iso|relative>,end=<iso|relative>,duration=<relative|30min|PT30M>,title=<text>,all_day=<true|false>,recur_* fields (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"typeOption",keys:["typeOption","type_option"],option:"--type-option <value>",description:"Set type options key=value or key=<name>,value=<value> (also accepts key:value and markdown pairs; use - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--type_option <value>",description:"Alias for --type-option"}]},{target:"field",keys:["field"],option:"--field <name=value>",description:"Set a field declared by an active extension registerItemFields registration (repeatable)",repeatable:!0},{target:"unset",keys:["unset"],option:"--unset <field>",description:"Clear scalar metadata field by name (repeatable)",repeatable:!0}],tf=ef.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),$w=ef.filter(e=>e.repeatable===!0).map(e=>({target:e.target,keys:e.keys}));(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]="35c88fec-b8c2-5478-b9a6-ecaebb736b2e")}catch{}})();function Ce(e){return e.map(t=>({...t}))}var nf=[{param:"status",flag:"--status"},{param:"type",flag:"--type"},{param:"tag",flag:"--tag"},{param:"priority",flag:"--priority"},{param:"deadlineBefore",flag:"--deadline-before"},{param:"deadlineAfter",flag:"--deadline-after"}],Fw=[{param:"updatedAfter",flag:"--updated-after"},{param:"updatedBefore",flag:"--updated-before"},{param:"createdAfter",flag:"--created-after"},{param:"createdBefore",flag:"--created-before"}],qM=[{param:"today",flag:"--today",booleanish:!0},{param:"recent",flag:"--recent",booleanish:!0},...Fw],jw=[{param:"assignee",flag:"--assignee"},{param:"assigneeFilter",flag:"--assignee-filter"},{param:"parent",flag:"--parent"},{param:"sprint",flag:"--sprint"},{param:"release",flag:"--release"}],BM=[{param:"assignee",flag:"--assignee"},{param:"sprint",flag:"--sprint"},{param:"release",flag:"--release"},{param:"parent",flag:"--parent"}],GM=[...nf,...jw],Uw=[{param:"filterReviewerMissing",flag:"--filter-reviewer-missing"},{param:"filterRiskMissing",flag:"--filter-risk-missing"},{param:"filterConfidenceMissing",flag:"--filter-confidence-missing"},{param:"filterSprintMissing",flag:"--filter-sprint-missing"},{param:"filterReleaseMissing",flag:"--filter-release-missing"}],WM=[{param:"filterAcMissing",flag:"--filter-ac-missing"},{param:"filterEstimatesMissing",flag:"--filter-estimates-missing"},{param:"filterResolutionMissing",flag:"--filter-resolution-missing"},{param:"filterMetadataMissing",flag:"--filter-metadata-missing"}],zw=[{param:"hasNotes",flag:"--has-notes"},{param:"noNotes",flag:"--no-notes"},{param:"hasLearnings",flag:"--has-learnings"},{param:"noLearnings",flag:"--no-learnings"},{param:"hasFiles",flag:"--has-files"},{param:"noFiles",flag:"--no-files"},{param:"filterFilesMissing",flag:"--filter-files-missing"},{param:"hasDocs",flag:"--has-docs"},{param:"noDocs",flag:"--no-docs"},{param:"filterDocsMissing",flag:"--filter-docs-missing"},{param:"hasTests",flag:"--has-tests"},{param:"noTests",flag:"--no-tests"},{param:"hasComments",flag:"--has-comments"},{param:"noComments",flag:"--no-comments"},{param:"hasDeps",flag:"--has-deps"},{param:"noDeps",flag:"--no-deps"},{param:"hasBody",flag:"--has-body"},{param:"emptyBody",flag:"--empty-body"},{param:"hasLinkedCommand",flag:"--has-linked-command"},{param:"noLinkedCommand",flag:"--no-linked-command"}],rf=[{param:"for",flag:"--for"},{param:"tokenBudget",flag:"--token-budget"},...Ce(nf),...Ce(qM),{param:"ids",flag:"--ids"},...Ce(jw),...Ce(WM),...Ce(Uw),...Ce(zw),{param:"limit",flag:"--limit"},{param:"offset",flag:"--offset"},{param:"after",flag:"--after"},{param:"fields",flag:"--fields"},{param:"sort",flag:"--sort"},{param:"order",flag:"--order"},{param:"tree",flag:"--tree"},{param:"treeDepth",flag:"--tree-depth"}],of=[{param:"groupBy",flag:"--group-by"},{param:"setMode",flag:"--set-mode"},{param:"limit",flag:"--limit"},{param:"after",flag:"--after"},{param:"sum",flag:"--sum"},{param:"avg",flag:"--avg"},...Ce(GM)],sf=[{param:"for",flag:"--for"},{param:"tokenBudget",flag:"--token-budget"},{param:"matchMode",flag:"--match-mode"},{param:"minScore",flag:"--min-score"},{param:"count",flag:"--count",booleanish:!0},{param:"semanticWeight",flag:"--semantic-weight"},...Ce(nf),...Ce(Fw),...Ce(BM),...Ce(Uw),...Ce(zw),{param:"fields",flag:"--fields"},{param:"limit",flag:"--limit"},{param:"after",flag:"--after"}],Hw=[{param:"parent",flag:"--parent"},{param:"reviewer",flag:"--reviewer"},{param:"risk",flag:"--risk"},{param:"confidence",flag:"--confidence"},{param:"sprint",flag:"--sprint"},{param:"release",flag:"--release"},{param:"blockedBy",flag:"--blocked-by"},{param:"blockedReason",flag:"--blocked-reason"},{param:"unblockNote",flag:"--unblock-note"},{param:"reporter",flag:"--reporter"},{param:"severity",flag:"--severity"},{param:"environment",flag:"--environment"},{param:"reproSteps",flag:"--repro-steps"},{param:"resolution",flag:"--resolution"},{param:"expectedResult",flag:"--expected-result"},{param:"actualResult",flag:"--actual-result"},{param:"affectedVersion",flag:"--affected-version"},{param:"fixedVersion",flag:"--fixed-version"},{param:"component",flag:"--component"},{param:"regression",flag:"--regression",booleanish:!0},{param:"customerImpact",flag:"--customer-impact"},{param:"definitionOfReady",flag:"--definition-of-ready",allowEmpty:!0},{param:"order",flag:"--order"},{param:"rank",flag:"--rank"},{param:"goal",flag:"--goal"},{param:"objective",flag:"--objective"},{param:"value",flag:"--value"},{param:"impact",flag:"--impact"},{param:"outcome",flag:"--outcome"},{param:"whyNow",flag:"--why-now"}],qa=Ce(Hw),qw=[{param:"id",flag:"--id"},{param:"title",flag:"--title"},{param:"description",flag:"--description",allowEmpty:!0},{param:"type",flag:"--type"},{param:"template",flag:"--template"},{param:"createMode",flag:"--create-mode"},{param:"schedulePreset",flag:"--schedule-preset"},{param:"status",flag:"--status"},{param:"priority",flag:"--priority"},{param:"tags",flag:"--tags",allowEmpty:!0},{param:"addTags",flag:"--add-tags",repeatable:!0},{param:"body",flag:"--body",allowEmpty:!0},{param:"deadline",flag:"--deadline"},{param:"estimate",flag:"--estimate"},{param:"acceptanceCriteria",flag:"--acceptance-criteria",allowEmpty:!0},{param:"author",flag:"--author"},{param:"message",flag:"--message",allowEmpty:!0},{param:"assignee",flag:"--assignee"},{param:"allowMissingParent",flag:"--allow-missing-parent"},{param:"allowUnresolvedDeps",flag:"--allow-unresolved-deps"},{param:"allowDuplicate",flag:"--allow-duplicate",booleanish:!0},{param:"reminder",flag:"--reminder",repeatable:!0},{param:"event",flag:"--event",repeatable:!0},{param:"typeOption",flag:"--type-option",repeatable:!0},{param:"field",flag:"--field",repeatable:!0},{param:"dep",flag:"--dep",repeatable:!0},{param:"comment",flag:"--comment",repeatable:!0},{param:"note",flag:"--note",repeatable:!0},{param:"learning",flag:"--learning",repeatable:!0},{param:"linkedFile",flag:"--file",repeatable:!0},{param:"linkedTest",flag:"--test",repeatable:!0},{param:"doc",flag:"--doc",repeatable:!0},{param:"unset",flag:"--unset",repeatable:!0},{param:"clearDeps",flag:"--clear-deps"},{param:"clearComments",flag:"--clear-comments"},{param:"clearNotes",flag:"--clear-notes"},{param:"clearLearnings",flag:"--clear-learnings"},{param:"clearFiles",flag:"--clear-files"},{param:"clearTests",flag:"--clear-tests"},{param:"clearDocs",flag:"--clear-docs"},{param:"clearReminders",flag:"--clear-reminders"},{param:"clearEvents",flag:"--clear-events"},{param:"clearTypeOptions",flag:"--clear-type-options"}],af=Ce(qw),Bw=[{param:"title",flag:"--title"},{param:"description",flag:"--description",allowEmpty:!0},{param:"body",flag:"--body",allowEmpty:!0},{param:"status",flag:"--status"},{param:"closeReason",flag:"--close-reason"},{param:"completedAt",flag:"--completed-at"},{param:"priority",flag:"--priority"},{param:"type",flag:"--type"},{param:"tags",flag:"--tags",allowEmpty:!0},{param:"addTags",flag:"--add-tags",repeatable:!0},{param:"removeTags",flag:"--remove-tags",repeatable:!0},{param:"deadline",flag:"--deadline"},{param:"estimate",flag:"--estimate"},{param:"acceptanceCriteria",flag:"--acceptance-criteria",allowEmpty:!0},{param:"addAc",flag:"--add-ac",repeatable:!0},{param:"removeAc",flag:"--remove-ac",repeatable:!0},{param:"author",flag:"--author"},{param:"message",flag:"--message",allowEmpty:!0},{param:"assignee",flag:"--assignee"},{param:"allowMissingParent",flag:"--allow-missing-parent"},{param:"allowUnresolvedDeps",flag:"--allow-unresolved-deps"},{param:"dep",flag:"--dep",repeatable:!0},{param:"depRemove",flag:"--dep-remove",repeatable:!0},{param:"replaceDeps",flag:"--replace-deps"},{param:"replaceTests",flag:"--replace-tests"},{param:"replaceFiles",flag:"--replace-files"},{param:"replaceDocs",flag:"--replace-docs"},{param:"comment",flag:"--comment",repeatable:!0},{param:"note",flag:"--note",repeatable:!0},{param:"learning",flag:"--learning",repeatable:!0},{param:"linkedFile",flag:"--file",repeatable:!0},{param:"linkedTest",flag:"--test",repeatable:!0},{param:"doc",flag:"--doc",repeatable:!0},{param:"reminder",flag:"--reminder",repeatable:!0},{param:"event",flag:"--event",repeatable:!0},{param:"typeOption",flag:"--type-option",repeatable:!0},{param:"field",flag:"--field",repeatable:!0},{param:"unset",flag:"--unset",repeatable:!0},{param:"clearDeps",flag:"--clear-deps"},{param:"clearComments",flag:"--clear-comments"},{param:"clearNotes",flag:"--clear-notes"},{param:"clearLearnings",flag:"--clear-learnings"},{param:"clearFiles",flag:"--clear-files"},{param:"clearTests",flag:"--clear-tests"},{param:"clearDocs",flag:"--clear-docs"},{param:"clearReminders",flag:"--clear-reminders"},{param:"clearEvents",flag:"--clear-events"},{param:"clearTypeOptions",flag:"--clear-type-options"}],cf=Ce(Bw),lf=[{param:"filterStatus",flag:"--filter-status"},{param:"filterType",flag:"--filter-type"},{param:"filterTag",flag:"--filter-tag"},{param:"filterPriority",flag:"--filter-priority"},{param:"filterDeadlineBefore",flag:"--filter-deadline-before"},{param:"filterDeadlineAfter",flag:"--filter-deadline-after"},{param:"filterUpdatedAfter",flag:"--filter-updated-after"},{param:"filterUpdatedBefore",flag:"--filter-updated-before"},{param:"filterCreatedAfter",flag:"--filter-created-after"},{param:"filterCreatedBefore",flag:"--filter-created-before"},{param:"filterAssignee",flag:"--filter-assignee"},{param:"filterAssigneeFilter",flag:"--filter-assignee-filter"},{param:"filterParent",flag:"--filter-parent"},{param:"filterSprint",flag:"--filter-sprint"},{param:"filterRelease",flag:"--filter-release"},{param:"filterAcMissing",flag:"--filter-ac-missing"},{param:"filterEstimatesMissing",flag:"--filter-estimates-missing"},{param:"filterResolutionMissing",flag:"--filter-resolution-missing"},{param:"filterMetadataMissing",flag:"--filter-metadata-missing"},{param:"filterReviewerMissing",flag:"--filter-reviewer-missing"},{param:"filterRiskMissing",flag:"--filter-risk-missing"},{param:"filterConfidenceMissing",flag:"--filter-confidence-missing"},{param:"filterSprintMissing",flag:"--filter-sprint-missing"},{param:"filterReleaseMissing",flag:"--filter-release-missing"},{param:"filterHasNotes",flag:"--filter-has-notes"},{param:"filterNoNotes",flag:"--filter-no-notes"},{param:"filterHasLearnings",flag:"--filter-has-learnings"},{param:"filterNoLearnings",flag:"--filter-no-learnings"},{param:"filterHasFiles",flag:"--filter-has-files"},{param:"filterNoFiles",flag:"--filter-no-files"},{param:"filterHasDocs",flag:"--filter-has-docs"},{param:"filterNoDocs",flag:"--filter-no-docs"},{param:"filterHasTests",flag:"--filter-has-tests"},{param:"filterNoTests",flag:"--filter-no-tests"},{param:"filterHasComments",flag:"--filter-has-comments"},{param:"filterNoComments",flag:"--filter-no-comments"},{param:"filterHasDeps",flag:"--filter-has-deps"},{param:"filterNoDeps",flag:"--filter-no-deps"},{param:"filterHasBody",flag:"--filter-has-body"},{param:"filterEmptyBody",flag:"--filter-empty-body"},{param:"filterHasLinkedCommand",flag:"--filter-has-linked-command"},{param:"filterNoLinkedCommand",flag:"--filter-no-linked-command"},{param:"ids",flag:"--ids"},{param:"limit",flag:"--limit"},{param:"offset",flag:"--offset"}],df=Ce(lf),uf=Ce(lf);var ff=[{param:"id",flag:"--id"},{param:"op",flag:"--op"},{param:"author",flag:"--author"},{param:"from",flag:"--from"},{param:"to",flag:"--to"},{param:"limit",flag:"--limit"},{param:"unbounded",flag:"--unbounded"},{param:"compact",flag:"--compact"},{param:"raw",flag:"--raw"},{param:"full",flag:"--full"},{param:"provenance",flag:"--provenance"},{param:"provenanceSummary",flag:"--provenance-summary"},{param:"harness",flag:"--harness",repeatable:!0},{param:"agentInstance",flag:"--agent-instance",repeatable:!0},{param:"provenanceFilter",flag:"--provenance-filter",repeatable:!0}],mf=[{param:"for",flag:"--for"},{param:"date",flag:"--date"},{param:"from",flag:"--from"},{param:"to",flag:"--to"},{param:"type",flag:"--type"},{param:"tag",flag:"--tag"},{param:"priority",flag:"--priority"},{param:"assignee",flag:"--assignee"},{param:"assigneeFilter",flag:"--assignee-filter"},{param:"sprint",flag:"--sprint"},{param:"release",flag:"--release"},{param:"parent",flag:"--parent"},{param:"limit",flag:"--limit"},{param:"after",flag:"--after"},{param:"format",flag:"--format"},{param:"depth",flag:"--depth"},{param:"fields",flag:"--fields"},{param:"section",flag:"--section",repeatable:!0},{param:"activityLimit",flag:"--activity-limit"},{param:"staleThreshold",flag:"--stale-threshold"},{param:"tokenBudget",flag:"--token-budget"},{param:"explainRanking",flag:"--explain-ranking"},{param:"noTags",flag:"--no-tags"},{param:"noExtensionHealth",flag:"--no-extension-health"}];(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]="733ce7b1-de7b-53b9-83bb-deefd930d8ec")}catch{}})();var KM=["item","list","context","search","graph","history","workspace","package","ops","plan","contracts","help"];function T(e,t,n,r={}){return{name:e,required:n,variadic:r.variadic===!0,value_kind:t,polymorphic:r.polymorphic===!0}}function Gw(e){let t=e.replaceAll("-"," ");return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}var te=T("id","item_id",!0),Ai=T("id","item_id",!1),Ii=T("text","string",!1),Ci=T("plan-id","item_id",!0),Ww=T("step","string",!0),YM=["--acceptance-criteria","--actual-result","--affected-version","--assignee","--blocked-by","--blocked-reason","--blocks","--body","--claim","--comment","--component","--confidence","--create-mode","--customer-impact","--deadline","--definition-of-ready","--description","--doc","--environment","--estimate","--event","--expected-result","--fixed-version","--file","--from-search","--goal","--harness","--impact","--learning","--message","--mode","--note","--objective","--order","--outcome","--parent","--priority","--rank","--related","--release","--reminder","--reporter","--repro-steps","--resolution","--resume-context","--reviewer","--risk","--scope","--severity","--sprint","--status","--step","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-replacement","--step-status","--step-title","--tags","--template","--test","--title","--type-option","--unblock-note","--value","--why-now"],pf=["--allow-multiple-active","--depends-on","--file","--force","--message","--step-blocked-reason","--step-body","--step-evidence","--step-owner","--step-status","--step-title","--test"],JM={"update-step":"Update one declared Plan step.","complete-step":"Complete one declared Plan step.","block-step":"Block one declared Plan step.","remove-step":"Remove one declared Plan step.",link:"Link one dependency to a declared Plan step.",unlink:"Unlink one dependency from a declared Plan step."},no=[{command:"plan create",parent:"plan",action:"create",slots:[T("title","string",!1,{polymorphic:!0})],accepted_flags:YM,description:"Create a Plan item and optionally seed its ordered steps.",example:'pm plan create --title "Refactor lock retry"'},{command:"plan show",parent:"plan",action:"show",slots:[Ci],accepted_flags:["--depth","--fields"],description:"Read one Plan item with a bounded plan projection.",example:"pm plan show pm-a1b2 --depth standard"},{command:"plan add-step",parent:"plan",action:"add-step",slots:[Ci],accepted_flags:pf,description:"Append one ordered step to a Plan item.",example:'pm plan add-step pm-a1b2 --step-title "Run tests"'},...Object.entries(JM).map(([e,t])=>({command:`plan ${e}`,parent:"plan",action:e,slots:[Ci,Ww],accepted_flags:pf,description:t,example:`pm plan ${e} pm-a1b2 plan-step-001`})),{command:"plan reorder-step",parent:"plan",action:"reorder-step",slots:[Ci,Ww,T("new-order","integer",!0)],accepted_flags:["--force","--message"],description:"Move one Plan step to a declared integer order.",example:"pm plan reorder-step pm-a1b2 plan-step-001 2"},...["decision","discovery","validation","resume","approve","materialize"].map(e=>({command:`plan ${e}`,parent:"plan",action:e,slots:[Ci],accepted_flags:pf,description:`${Gw(e)} for one Plan item.`,example:`pm plan ${e} pm-a1b2`})),...["list","show","put","remove"].map(e=>({command:`assurance ${e}`,parent:"assurance",action:e,slots:[T("kind","string",!0),...e==="list"?[]:[T("id","string",!0)]],accepted_flags:e==="put"?["--author","--definition","--message"]:e==="remove"?["--author","--message"]:[],description:`${Gw(e)} assurance declarations by kind.`,example:e==="list"?"pm assurance list measurement":`pm assurance ${e} measurement example-id`})),{command:"assurance run",parent:"assurance",action:"run",slots:[T("gate-id","string",!0)],accepted_flags:["--dry-run","--trigger","--tree"],description:"Evaluate one assurance gate for a lifecycle trigger.",example:"pm assurance run tracker-context-quality --trigger ci --dry-run"},{command:"assurance verdicts",parent:"assurance",action:"verdicts",slots:[T("gate-id","string",!1)],accepted_flags:["--gate","--limit"],description:"List bounded assurance verdict history.",example:"pm assurance verdicts --limit 20"},...["presets","apply"].map(e=>({command:`assurance ${e}`,parent:"assurance",action:e,slots:[T("preset","string",e==="apply")],accepted_flags:["--author","--message","--owner"],description:e==="apply"?"Apply one assurance adoption preset.":"List available assurance adoption presets.",example:e==="apply"?"pm assurance apply software-delivery --owner <pm-item-id>":"pm assurance presets"})),{command:"assurance derive",parent:"assurance",action:"derive",slots:[],accepted_flags:["--apply","--author","--message","--owner"],description:"Derive assurance proposals from current project context.",example:"pm assurance derive --owner pm-a1b2"},{command:"assurance promote",parent:"assurance",action:"promote",slots:[T("assertion-id","string",!0)],accepted_flags:["--author","--enforcement","--message"],description:"Promote one assertion into a warning or blocking gate.",example:"pm assurance promote assertion-id --enforcement warn"},{command:"assurance risk",parent:"assurance",action:"risk",slots:[],accepted_flags:["--definition"],description:"Analyze bounded defect-recurrence risk for a proposed change.",example:`pm assurance risk --definition '{"change":{"files":[]}}'`},{command:"assurance lineages",parent:"assurance",action:"lineages",slots:[],accepted_flags:["--definition"],description:"Measure all recorded recurrence lineages with bounded evidence rows.",example:`pm assurance lineages --definition '{"policy":{"version":1,"evidence_epoch":"2026-01-01T00:00:00.000Z","families":[]}}'`},{command:"workspace position",parent:"workspace",action:"position",slots:[],accepted_flags:[],description:"Read bounded merge-fence, receipt, history-drift, and next-action readiness.",example:"pm workspace position"},{command:"workspace snapshot create",parent:"workspace snapshot",action:"create",slots:[T("name","string",!1)],accepted_flags:[],description:"Capture authoritative tracker state as an immutable snapshot.",example:"pm workspace snapshot create before-migration"},{command:"workspace snapshot list",parent:"workspace snapshot",action:"list",slots:[],accepted_flags:[],description:"List immutable workspace snapshots and named references.",example:"pm workspace snapshot list"},{command:"workspace snapshot inspect",parent:"workspace snapshot",action:"inspect",slots:[T("target","string",!0)],accepted_flags:[],description:"Inspect one workspace snapshot target.",example:"pm workspace snapshot inspect before-migration"},{command:"workspace snapshot restore",parent:"workspace snapshot",action:"restore",slots:[T("target","string",!0)],accepted_flags:["--author","--dry-run","--force","--message"],description:"Restore an immutable workspace snapshot with explicit recovery controls.",example:"pm workspace snapshot restore before-migration --dry-run"},{command:"workspace snapshot delete",parent:"workspace snapshot",action:"delete",slots:[T("target","string",!0)],accepted_flags:[],description:"Delete one workspace snapshot target.",example:"pm workspace snapshot delete before-migration"}],XM=[...no].sort((e,t)=>t.command.length-e.command.length),ZM=new Map([["append",[te,Ii]],["assurance",[T("action","action",!0),T("kind","string",!1),T("id","string",!1)]],["beads import",[T("file","string",!1)]],["changelog export",[T("file","string",!1)]],["claim",[Ai]],["close",[te,Ii]],["close-task",[te,T("reason","string",!1)]],["comments",[te,Ii]],["completion",[T("shell","string",!1)]],["config",[T("scope","string",!1,{polymorphic:!0}),T("action","action",!1),T("key","string",!1),T("value","string",!1,{polymorphic:!0})]],["copy",[te]],["create",[T("type-or-title","string",!1,{polymorphic:!0}),T("title","string",!1)]],["delete",[te]],["deps",[te]],["docs",[te]],["event",[T("title","string",!0)]],["files",[te]],["files discover",[te]],["files lookup",[T("paths","string",!0,{variadic:!0})]],["focus",[Ai]],["get",[te]],["graph",[T("subcommand","action",!0),Ai,T("target","item_id",!1)]],["guide",[T("topic","string",!1)]],["history",[te]],["history-compact",[Ai]],["history-redact",[te]],["history-repair",[Ai]],["init",[T("prefix-or-path","string",!1,{polymorphic:!0})]],["item complete",[te,T("reason","string",!1)]],["item reopen",[te,T("reason","string",!0)]],["learnings",[te,Ii]],["meet",[T("title","string",!0)]],["merge",[T("subcommand","action",!0),T("artifact","string",!1),T("base","string",!1),T("ours","string",!1),T("theirs","string",!1)]],["notes",[te,Ii]],["package",[T("target","string",!1,{polymorphic:!0})]],["package list",[]],["package scaffold",[T("target","string",!0)]],["package upgrade",[T("target","string",!1)]],["packages",[T("target","string",!1,{polymorphic:!0})]],["packages list",[]],["packages scaffold",[T("target","string",!0)]],["packages upgrade",[T("target","string",!1)]],["pause-task",[te]],["plan",[T("subcommand","action",!0),T("id","item_id",!1,{polymorphic:!0}),T("step","string",!1),T("new-order","integer",!1)]],["profile",[T("subcommand","action",!0),T("name","string",!1)]],["release",[te]],["remind",[T("title","string",!0)]],["restore",[te,T("target","string",!0)]],["schema",[T("subcommand","action",!0),T("name","string",!1)]],["search-advanced",[T("keywords","string",!0,{variadic:!0})]],["search",[T("keywords","string",!0,{variadic:!0})]],["start-task",[te]],["telemetry",[T("namespace-or-subcommand","action",!1,{polymorphic:!0}),T("subcommand","action",!1)]],["test",[te]],["test-runs-worker",[T("runId","string",!0)]],["update",[te]],["workspace snapshot",[T("action","action",!0),T("target","string",!1)]],...["activate","adopt","deactivate","init","uninstall"].flatMap(e=>["extension","package","packages"].map(t=>[`${t} ${e}`,[T("target","string",!0)]])),...["describe"].flatMap(e=>["extension","package","packages"].map(t=>[`${t} ${e}`,[T("target","string",!1)]])),...["install"].flatMap(e=>["extension","package","packages"].map(t=>[`${t} ${e}`,[T("targets","string",!1,{variadic:!0})]])),["vcs abandon",[te]],["vcs create",[T("title","string",!0)]],["vcs merge",[te]],["vcs propose",[te]],["vcs ref-create",[T("name","string",!0)]],["vcs show",[te]]]);function QM(e){return e.trim().toLowerCase().replace(/\s+/gu," ")}function e$(e){let t=QM(e);return XM.find(n=>n.command===t||t.startsWith(`${n.command} `))}function F(e,t,n,r,o){return o.map(i=>({command:i,noun:e,target:t,disposition:n,owner:r}))}var t$=[...F("item","item","target_noun","pm-pbyu",["item","item complete","item mutate","item reopen"]),...F("item","item","consolidation","pm-yql1",["append","close-many","close-task","comments","copy","delete","deps","docs","files","learnings","notes","pause-task","start-task","test","update-many"]),...["claim","close","create","get","release","update"].map(e=>({command:e,noun:"item",target:e,disposition:"keep_as_is",owner:"pm-pbyu",reason:"Permanent high-frequency item operations retain concise root spellings under the accepted hot-path grammar policy."})),...F("item","item files","target_noun","pm-yql1",["files discover","files lookup","item files discover","item files lookup"]),...F("item","item test worker","consolidation","pm-lp4j",["test-runs-worker"]),...F("list","list","target_noun","pm-pfqi",["list"]),...F("list","list --group-by","consolidation","pm-xkgq",["aggregate"]),...F("context","context","target_noun","pm-pbyu",["context"]),...F("context","context","consolidation","pm-kcs4",["ctx","focus","next"]),...F("context","context next","consolidation","pm-kcs4",["ctx next"]),...F("context","context focus","consolidation","pm-kcs4",["ctx focus"]),...F("search","search","target_noun","pm-pbyu",["search"]),...F("search","search","package_owned","package:search-advanced",["reindex","search-advanced"]),...F("item","item duplicates","consolidation","pm-fmy9ih",["duplicates"]),...F("item","item duplicates","package_owned","pm-fmy9ih",["dedupe-audit","dedupe-merge","comments-audit"]),...F("graph","graph","target_noun","pm-pbyu",["graph"]),...F("history","history","target_noun","pm-pbyu",["history"]),...F("history","history attest","target_noun","pm-3z0k",["history attest"]),...F("history","history attest","consolidation","pm-3z0k",["history-attest"]),...Ws.flatMap(({alias:e,canonical:t})=>[...F("history",t,"target_noun","pm-tqel",[t]),...F("history",t,"consolidation","pm-tqel",[e])]),...F("history","history","consolidation","pm-tqel",["events","merge"]),...F("history","history acknowledge","consolidation","pm-djyvbk",["history-author-acknowledge"]),...F("history","history","package_owned","package:builtin-vcs-exemplar",["vcs abandon","vcs create","vcs log","vcs merge","vcs propose","vcs ref-create","vcs show"]),...F("workspace","workspace","target_noun","pm-pbyu",["workspace","workspace position","workspace snapshot","workspace snapshot create","workspace snapshot delete","workspace snapshot inspect","workspace snapshot list","workspace snapshot restore"]),...F("workspace","workspace init","consolidation","pm-npr3",["init"]),...F("package","package","target_noun","pm-pbyu",["package","package activate","package adopt","package adopt-all","package catalog","package deactivate","package describe","package doctor","package explore","package init","package install","package list","package manage","package migrate","package reload","package scaffold","package uninstall","package upgrade"]),...F("package","package","consolidation","pm-tnud",["extension activate","extension adopt","extension adopt-all","extension catalog","extension deactivate","extension describe","extension doctor","extension explore","extension init","extension install","extension manage","extension migrate","extension reload","extension uninstall","packages","packages activate","packages adopt","packages adopt-all","packages catalog","packages deactivate","packages describe","packages doctor","packages explore","packages init","packages install","packages list","packages manage","packages migrate","packages reload","packages scaffold","packages uninstall","packages upgrade"]),...F("package","package","package_owned","package:beads",["beads import"]),...F("package","package","package_owned","package:pm-changelog",["changelog export","changelog generate"]),...F("package","package calendar","package_owned","pm-o3fh",["event","meet","remind"]),...F("ops","ops","target_noun","pm-6apl",["ops"]),...F("ops","ops normalize","package_owned","package:pm-governance-audit",["normalize"]),...F("ops","ops","consolidation","pm-6apl",["eval","gc","health","stats","telemetry","test-all","validate"]),...F("ops","ops","consolidation","pm-npr3",["config","profile","schema"]),...["assurance",...no.filter(({parent:e})=>e==="assurance").map(({command:e})=>e)].map(e=>({command:e,noun:"ops",target:e,disposition:"keep_as_is",owner:"pm-djyvbk",reason:"Assurance manages durable measurement, assertion, gate, and verdict data; retain its established domain surface independently of operational diagnostics."})),...F("plan","plan","target_noun","pm-pbyu",["plan"]),...F("plan","plan","target_noun","pm-2tan",no.filter(({parent:e})=>e==="plan").map(({command:e})=>e)),...F("contracts","contracts","target_noun","pm-pbyu",["contracts"]),...F("help","help","target_noun","pm-pbyu",["help"]),...F("help","help","package_owned","package:builtin-guide-shell",["completion","completion-statuses","completion-tags","completion-types","guide"])].flatMap(e=>{let t=Vs.find(r=>r.alias===e.command);if(!t)return[e];let n=KM.find(r=>r===t.canonical_argv[0])??e.noun;return[{...e,noun:n,target:t.canonical,owner:t.owner},{...e,command:t.canonical,noun:n,target:t.canonical,owner:t.owner,disposition:e.disposition==="package_owned"?"package_owned":"target_noun"}]}),n$=[...new Set(t$.map(({command:e})=>e))].map(e=>({command:e,slots:e$(e)?.slots??ZM.get(Jt(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]="4e1e3ef4-cdf3-5d4c-88fe-d23f6fc171d1")}catch{}})();function _f(e){return[...new Set(Array.from(e,t=>t.trim()).filter(t=>t.length>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]="bfaa3455-3237-5c98-8ef4-b353ce9530fe")}catch{}})();var Oi=Object.freeze({rows:10,paths:5,samples:10,path_depth:8,visited_paths:1e4});(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]="4c3fb594-00bc-5625-aeaa-692e7ac01437")}catch{}})();var Vw=ml.map(e=>({flag:e.flag,reservation_scope:"inherited",...e.aliases?{aliases:[...e.aliases]}:{},...e.value_name?{value_name:e.value_name}:{}})),r$=[...Vw,{flag:"--version",value_type:"boolean",reservation_scope:"root_only"},{flag:"--all",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help to every command."},{flag:"--explain",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help with command guidance."}],Kw=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--has-notes"},{flag:"--no-notes"},{flag:"--has-learnings"},{flag:"--no-learnings"},{flag:"--has-files"},{flag:"--no-files"},{flag:"--filter-files-missing"},{flag:"--has-docs"},{flag:"--no-docs"},{flag:"--filter-docs-missing"},{flag:"--has-tests"},{flag:"--no-tests"},{flag:"--has-comments"},{flag:"--no-comments"},{flag:"--has-deps"},{flag:"--no-deps"},{flag:"--has-body"},{flag:"--empty-body"},{flag:"--has-linked-command"},{flag:"--no-linked-command"}],Yw=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--filter-has-notes"},{flag:"--filter-no-notes"},{flag:"--filter-has-learnings"},{flag:"--filter-no-learnings"},{flag:"--filter-has-files"},{flag:"--filter-no-files"},{flag:"--filter-has-docs"},{flag:"--filter-no-docs"},{flag:"--filter-has-tests"},{flag:"--filter-no-tests"},{flag:"--filter-has-comments"},{flag:"--filter-no-comments"},{flag:"--filter-has-deps"},{flag:"--filter-no-deps"},{flag:"--filter-has-body"},{flag:"--filter-empty-body"},{flag:"--filter-has-linked-command"},{flag:"--filter-no-linked-command"},{flag:"--ids",list:!0},{flag:"--limit"},{flag:"--offset"}],Ba=bf([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--status",list:!0},{flag:"--all",value_type:"boolean"},{flag:"--type",list:!0},{flag:"--tag",aliases:["--tags"],list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--today"},{flag:"--recent"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--ids",list:!0},{flag:"--assignee",list:!0},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:!0},{flag:"--release",list:!0},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...Kw,{flag:"--limit"},{flag:"--offset"},{flag:"--after"},{flag:"--no-truncate"},{flag:"--compact"},{flag:"--brief"},{flag:"--full"},{flag:"--fields",list:!0},{flag:"--sort"},{flag:"--order"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--include-body"},{flag:"--strict-read"},{flag:"--format"},{flag:"--stream"}],new Set(["--limit","--token-budget","--offset","--after","--no-truncate","--compact","--brief","--full","--fields","--include-body","--strict-read"])),Jw=[{flag:"--group-by",list:!0},{flag:"--set-mode"},{flag:"--limit"},{flag:"--after"},{flag:"--count"},{flag:"--completion"},{flag:"--sum"},{flag:"--avg"},{flag:"--include-unparented"},{flag:"--include_unparented"},{flag:"--status",list:!0},{flag:"--type",list:!0},{flag:"--tag",list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--assignee",list:!0},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:!0},{flag:"--release",list:!0}],Xw=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--comment","--body","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];function bf(e,t){return e.map(n=>t.has(n.flag)?{...n,cursor_semantics:"presentation"}:n)}var Zw=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--note","--text"]},{flag:"--add-json"},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--since"},{flag:"--event-type"},{flag:"--include-meta"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Qw=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--learning","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],eb=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--append-stable"},{flag:"--validate-paths"},{flag:"--scope"},{flag:"--limit"},{flag:"--offset"},{flag:"--no-truncate"},{flag:"--strict-read"},{flag:"--explain"},{flag:"--lines",value_name:"start:end"},{flag:"--decision-depth",value_name:"n",value_type:"number"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],tb=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--validate-paths"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],nb=[{flag:"--id",value_name:"item-id"},{flag:"--limit"},{flag:"--compact"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--diff"},{flag:"--field"},{flag:"--verify"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--format"}],rb=[{flag:"--dry-run"},{flag:"--message"},{flag:"--force"},{flag:"--include-reconciled"},{flag:"--output"},{flag:"--item-path"},{flag:"--prefer"}],ob=[{flag:"--id",value_name:"item-id"},{flag:"--literal"},{flag:"--regex"},{flag:"--replacement"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],ib=[{flag:"--id",value_name:"item-id"},{flag:"--all"},{flag:"--dry-run"},{flag:"--normalize-provenance"},{flag:"--salvage-tail",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],sb=[{flag:"--event",repeatable:!0},{flag:"--all-actionable"},{flag:"--dry-run"},{flag:"--plan-fingerprint"},{flag:"--limit",value_type:"number"},{flag:"--attributed-author",aliases:["--attributed_author"]},{flag:"--reviewer"},{flag:"--reason"}],ab=[{flag:"--id",value_name:"item-id"},{flag:"--before"},{flag:"--ids",list:!0},{flag:"--all-over",value_type:"number"},{flag:"--closed"},{flag:"--all-streams"},{flag:"--min-entries",value_type:"number"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],o$=[{flag:"--verify",value_name:"file",value_type:"string"},{flag:"--output",value_name:"file",value_type:"string"},{flag:"--hash-algorithm",value_name:"name",value_type:"string"}],cb=[{flag:"--definition",value_name:"json"},{flag:"--policy",value_name:"id"},{flag:"--message",value_name:"value"},{flag:"--description"},{flag:"--default-status",aliases:["--default_status"]},{flag:"--folder"},{flag:"--alias"},{flag:"--role"},{flag:"--order"},{flag:"--type"},{flag:"--commands"},{flag:"--cli-flag"},{flag:"--required"},{flag:"--required-on-create"},{flag:"--no-allow-unset"},{flag:"--required-types"},{flag:"--infer"},{flag:"--min-count"},{flag:"--apply",value_type:"boolean"},{flag:"--to"},{flag:"--migration-id",aliases:["--migration_id"]},{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}],lb=[{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}],vf=[{flag:"--title"},{flag:"--description"},{flag:"--scope"},{flag:"--parent"},{flag:"--related"},{flag:"--blocks"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--harness"},{flag:"--mode"},{flag:"--resume-context",aliases:["--resume_context"]},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--priority"},{flag:"--status",short:"-s"},{flag:"--create-mode",aliases:["--create_mode"]},{flag:"--deadline"},{flag:"--estimate",aliases:["--estimated-minutes","--estimated_minutes"]},{flag:"--acceptance-criteria",aliases:["--acceptance_criteria","--ac"],repeatable:!0},{flag:"--definition-of-ready",aliases:["--definition_of_ready"]},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now",aliases:["--why_now"]},{flag:"--assignee"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps",aliases:["--repro_steps"]},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--affected-version",aliases:["--affected_version"]},{flag:"--fixed-version",aliases:["--fixed_version"]},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact",aliases:["--customer_impact"]},{flag:"--comment",repeatable:!0},{flag:"--note",repeatable:!0},{flag:"--learning",repeatable:!0},{flag:"--reminder",repeatable:!0},{flag:"--event",repeatable:!0},{flag:"--type-option",aliases:["--type_option"],repeatable:!0},{flag:"--body"},{flag:"--claim"},{flag:"--from-search",aliases:["--from_search"]},{flag:"--template"},{flag:"--step-title",aliases:["--step_title"]},{flag:"--step"},{flag:"--step-body",aliases:["--step_body"]},{flag:"--step-owner",aliases:["--step_owner"]},{flag:"--step-status",aliases:["--step_status"]},{flag:"--step-evidence",aliases:["--step_evidence"]},{flag:"--step-blocked-reason",aliases:["--step_blocked_reason"]},{flag:"--step-replacement",aliases:["--step_replacement"]},{flag:"--depends-on",aliases:["--depends_on"]},{flag:"--link"},{flag:"--link-kind",aliases:["--link_kind"]},{flag:"--link-note",aliases:["--link_note"]},{flag:"--promote-to-item-dep",aliases:["--promote_to_item_dep"]},{flag:"--allow-multiple-active",aliases:["--allow_multiple_active"]},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--decision-text",aliases:["--decision_text","--decision"]},{flag:"--decision-rationale",aliases:["--decision_rationale"]},{flag:"--decision-evidence",aliases:["--decision_evidence"]},{flag:"--discovery-text",aliases:["--discovery_text","--discovery"]},{flag:"--validation-text",aliases:["--validation_text","--validation"]},{flag:"--validation-command",aliases:["--validation_command"]},{flag:"--validation-expected",aliases:["--validation_expected"]},{flag:"--depth"},{flag:"--field"},{flag:"--fields",list:!0},{flag:"--steps"},{flag:"--materialize-type",aliases:["--materialize_type"]},{flag:"--materialize-parent",aliases:["--materialize_parent"]},{flag:"--materialize-tags",aliases:["--materialize_tags"]},{flag:"--author"},{flag:"--message"},{flag:"--force"}],db=[{flag:"--id-prefix",aliases:["--prefix"]},{flag:"--preset"},{flag:"--type-preset"},{flag:"--defaults",short:"-y",aliases:["--yes"]},{flag:"--author"},{flag:"--agent-guidance"},{flag:"--with-packages"},{flag:"--no-merge-fence"},{flag:"--workspace"},{flag:"--force"},{flag:"--verbose"}],ub=[{flag:"--value",value_name:"value"},{flag:"--criterion"},{flag:"--clear-criteria"},{flag:"--format"},{flag:"--policy"},{flag:"--default-depth"},{flag:"--activity-limit"},{flag:"--stale-threshold-days"},{flag:"--section-hierarchy"},{flag:"--section-activity"},{flag:"--section-progress"},{flag:"--section-blockers"},{flag:"--section-files"},{flag:"--section-workload"},{flag:"--section-staleness"},{flag:"--section-tests"}],kf=[{flag:"--dry-run"},{flag:"--init"},{flag:"--scaffold"},{flag:"--capability"},{flag:"--install"},{flag:"--uninstall"},{flag:"--explore"},{flag:"--list"},{flag:"--manage"},{flag:"--describe"},{flag:"--markdown"},{flag:"--output"},{flag:"--reload"},{flag:"--watch"},{flag:"--doctor"},{flag:"--catalog"},{flag:"--adopt"},{flag:"--adopt-all"},{flag:"--activate"},{flag:"--deactivate"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"},{flag:"--detail"},{flag:"--trace"},{flag:"--runtime-probe"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}],rn=[{flag:"--project"},{flag:"--local"},{flag:"--global"}],fb=[...rn,{flag:"--capability"}],gf=[...kf,{flag:"--declarative"}],i$=[...fb,{flag:"--declarative"}];var s$=[...rn,{flag:"--markdown"},{flag:"--output"}];var a$=[...rn,{flag:"--dry-run"}],c$=[...rn,{flag:"--runtime-probe"},{flag:"--fix-managed-state"}],l$=[...rn,{flag:"--watch"}],d$=[...rn,{flag:"--detail"},{flag:"--trace"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}],u$=[...rn,{flag:"--fields",list:!0}],f$=[...rn,{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],mb=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}],pb=[{flag:"--dry-run"},{flag:"--cli-only"},{flag:"--packages-only"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--repair"},{flag:"--tag"},{flag:"--package-name"}];var _b=[{flag:"--release-assignment",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--reason",value_name:"value"},{flag:"--close-reason",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--duplicate-of",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",aliases:["--expected_result","--expected"],value_name:"value"},{flag:"--actual-result",aliases:["--actual_result","--actual"],value_name:"value"},{flag:"--force",value_type:"boolean"}],gb=[{flag:"--filter-status",list:!0},{flag:"--filter-type"},{flag:"--filter-tag"},{flag:"--filter-priority"},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee"},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint"},{flag:"--filter-release"},...Yw,{flag:"--reason"},{flag:"--completed-at"},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--validate-close"},{flag:"--author"},{flag:"--message"},{flag:"--force"},{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"}],hb=[{flag:"--id",value_name:"item-id"},{flag:"--body",short:"-b"},{flag:"--text"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],yb=[{flag:"--start",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"},{flag:"--if-available"},{flag:"--next"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee-filter"},{flag:"--parent"},{flag:"--sprint"},{flag:"--release"},{flag:"--max-attempts"},{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--explain-ranking",aliases:["--explain_ranking"]}],wb=[{flag:"--id",value_name:"item-id"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],bb=[{flag:"--id",value_name:"item-id"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],vb=[{flag:"--pause",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],kb=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],Eb=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}],Sb=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--force"}],Tb=[{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--tags"},{flag:"--priority"},{flag:"--body"},{flag:"--description"},{flag:"--author"},{flag:"--message"}],Ef=[{flag:"--start"},{flag:"--duration"},{flag:"--end"},{flag:"--location"},{flag:"--timezone"},{flag:"--all-day"},...Tb],Ab=Ef,Ib=[{flag:"--at"},{flag:"--text"},...Tb],Cb=[{flag:"--list"},{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-json"},{flag:"--remove"},{flag:"--remove-index",repeatable:!0},{flag:"--run"},{flag:"--match"},{flag:"--only-index"},{flag:"--only-last"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--acknowledge-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"},{flag:"--measure",list:!0},{flag:"--metric-below"},{flag:"--metric-diff"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],Ob=[{flag:"--status"},{flag:"--limit"},{flag:"--offset"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"}],xb=[{flag:"--limit"}];var Rb=[{flag:"--dry-run"},{flag:"--scope"}],Nb=[{flag:"--include-empty"},{flag:"--storage"},{flag:"--metadata-coverage"},{flag:"--field-utilization"},{flag:"--by-assignee"},{flag:"--by-tag"},{flag:"--by-priority"},{flag:"--tag-prefix"},{flag:"--analytics"}],Db=[{flag:"--exhaustive",value_type:"boolean"},{flag:"--status",repeatable:!0,list:!0},{flag:"--since"},{flag:"--threshold"},{flag:"--limit"}],Pb=[{flag:"--strict-directories"},{flag:"--require-merge-drivers"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--check-only"},{flag:"--check-telemetry"},{flag:"--no-refresh"},{flag:"--refresh-vectors"},{flag:"--verbose-stale-items"},{flag:"--verbose-author-events"},{flag:"--brief"},{flag:"--summary"},{flag:"--skip-vectors"},{flag:"--skip-integrity"},{flag:"--skip-drift"},{flag:"--full"}],Lb=[{flag:"--check-completeness",value_type:"boolean"},{flag:"--check-metadata"},{flag:"--metadata-profile"},{flag:"--check-resolution"},{flag:"--check-lifecycle"},{flag:"--check-stale-blockers"},{flag:"--dependency-cycle-severity"},{flag:"--parent-cycle-severity"},{flag:"--check-files"},{flag:"--scan-mode"},{flag:"--include-pm-internals"},{flag:"--verbose-file-lists"},{flag:"--verbose-diagnostics"},{flag:"--all-affected-ids"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--fix-hints"},{flag:"--auto-fix"},{flag:"--dry-run"},{flag:"--fix-scope"},{flag:"--prune-missing"},{flag:"--check-history-drift"},{flag:"--check-command-references"},{flag:"--check-storage-integrity"},{flag:"--counts"},{flag:"--full"}],Sf=[{flag:"--definition",value_name:"json"},{flag:"--trigger",value_name:"value"},{flag:"--tree",value_name:"value"},{flag:"--gate",value_name:"id"},{flag:"--limit",value_name:"number"},{flag:"--dry-run"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--owner",value_name:"item-id"},{flag:"--apply",value_type:"boolean"},{flag:"--enforcement",value_name:"level"}],Mb=[{flag:"--assignee"},{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--allow-unresolved-deps"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-by"},{flag:"--blocked-reason"},{flag:"--unblock-note"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--actual-result"},{flag:"--affected-version"},{flag:"--fixed-version"}],$b=[{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"}],Fb=[{short:"-p",flag:"--priority"},{flag:"--type"},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--add-tags",aliases:["--add_tags"]},{flag:"--remove-tags",aliases:["--remove_tags"]},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--add-ac",aliases:["--add_ac"]},{flag:"--remove-ac",aliases:["--remove_ac"]}],hf=[{flag:"--stdin-json"},{short:"-t",flag:"--title"},{flag:"--id"},{short:"-d",flag:"--description"},{flag:"--type"},{flag:"--template"},{flag:"--create-mode"},{flag:"--create_mode"},{flag:"--schedule-preset"},{flag:"--schedule_preset"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},{flag:"--completed_at"},{short:"-p",flag:"--priority"},{flag:"--tags",aliases:["--tag"],list:!0},{flag:"--add-tags",aliases:["--add_tags"]},{short:"-b",flag:"--body"},{flag:"--body-file"},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--author"},{flag:"--message"},...Mb,...$b,{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--fixed_version"},{flag:"--dep"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--reminder"},{flag:"--event"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--allow-duplicate",value_type:"boolean"}],jb=[{flag:"--transaction-id",value_name:"value"},{flag:"--stdin-json"},{flag:"--dry-run"},{flag:"--create-compensation",value_name:"mode"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--author",value_name:"value"}],Ub=[{flag:"--id",value_name:"item-id"},{flag:"--transaction-id",value_name:"value",required:!0},{flag:"--reason",value_name:"value"},{flag:"--file",value_name:"value",repeatable:!0},{flag:"--doc",value_name:"value",repeatable:!0},{flag:"--test",value_name:"value",repeatable:!0},{flag:"--comment",value_name:"value",repeatable:!0},{flag:"--note",value_name:"value",repeatable:!0},{flag:"--learning",value_name:"value",repeatable:!0},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",value_name:"value"},{flag:"--actual-result",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--dry-run"},{flag:"--force"},{flag:"--author",value_name:"value"}],zb=[{flag:"--id",value_name:"item-id"},{flag:"--status",value_name:"open|in_progress"},{flag:"--message",value_name:"value"},{flag:"--force"},{flag:"--author",value_name:"value"}],Hb=[{flag:"--id",value_name:"item-id"},{flag:"--title",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--allow-duplicate",value_type:"boolean"}],qb=[{flag:"--id",value_name:"item-id"},{flag:"--clear"}],Bb=[{flag:"--id",value_name:"item-id"},{flag:"--stdin-json"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},{flag:"--body-file"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},...Fb,...Mb,{flag:"--fixed_version"},...$b,{flag:"--author"},{flag:"--message"},{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--force"}],Gb=[{flag:"--status",short:"-s"},{flag:"--assignee"},{flag:"--parent"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--filter-status",list:!0},{flag:"--filter-type",list:!0},{flag:"--filter-tag",list:!0},{flag:"--filter-priority",list:!0},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee",list:!0},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint",list:!0},{flag:"--filter-release",list:!0},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...Yw,{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},...Fb,{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--repro_steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--expected_result"},{flag:"--expected"},{flag:"--actual-result"},{flag:"--actual_result"},{flag:"--actual"},{flag:"--affected-version"},{flag:"--affected_version"},{flag:"--fixed-version"},{flag:"--fixed_version"},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--allow-unresolved-deps"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--author"},{flag:"--message"},{flag:"--force"}],yf=[{flag:"--view"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--full-period"},{flag:"--full_period"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--status"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--include"},{flag:"--recurrence-lookahead-days"},{flag:"--recurrence-lookback-days"},{flag:"--occurrence-limit"},{flag:"--limit"},{flag:"--format"}],Wb=[{flag:"--id"},{flag:"--op"},{flag:"--author"},{flag:"--from"},{flag:"--to"},{flag:"--limit"},{flag:"--unbounded"},{flag:"--compact"},{flag:"--raw"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--stream"}],Vb=[{flag:"--since"},{flag:"--type",repeatable:!0},{flag:"--author",repeatable:!0},{flag:"--item",repeatable:!0},{flag:"--limit",value_type:"number"},{flag:"--cursor-mode",value_name:"batch|row"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:!0},{flag:"--agent-instance",repeatable:!0},{flag:"--provenance-filter",repeatable:!0},{flag:"--follow"},{flag:"--interval-ms",value_type:"number"}],wf=bf([{flag:"--for",value_name:"intent"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit",aliases:["--max-items"]},{flag:"--after"},{flag:"--format"},{flag:"--depth"},{flag:"--fields",list:!0},{flag:"--section"},{flag:"--activity-limit"},{flag:"--stale-threshold"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--no-extension-health"},{flag:"--no-tags"}],new Set(["--limit","--after","--format","--fields","--section","--activity-limit","--stale-threshold","--explain-ranking","--explain_ranking","--no-extension-health","--no-tags"])),Kb=[{flag:"--id",value_name:"item-id"},{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--depth"},{flag:"--full",value_type:"boolean"},{flag:"--fields",list:!0},{flag:"--at"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--format"}],Yb=[{flag:"--list"},{flag:"--format"},{flag:"--depth"}],Jb=[{flag:"--id",value_name:"item-id"},{flag:"--format"},{flag:"--max-depth"},{flag:"--collapse"},{flag:"--summary"},{flag:"--full"},{flag:"--node-limit"},{flag:"--edge-limit"},{flag:"--token-budget"},{flag:"--cursor"},{flag:"--direction"},{flag:"--kind",list:!0}],Xb=[{flag:"--kind",list:!0},{flag:"--max-depth",description:`Maximum traversal depth; paths default to ${Oi.path_depth}.`},{flag:"--limit",description:`Maximum rows per collection; default ${Oi.rows}. Use --full to remove the row cap.`},{flag:"--after"},{flag:"--direction"},{flag:"--max-paths",description:`Maximum enumerated paths; default ${Oi.paths}.`},{flag:"--sample",description:`Maximum evidence examples per audit finding; default ${Oi.samples}.`},{flag:"--exempt-isolate",list:!0},{flag:"--exempt-isolate-type",list:!0},{flag:"--save-baseline"},{flag:"--rebuild"},{flag:"--clear"},{flag:"--summary"},{flag:"--full"}],Zb=[{flag:"--mode"},{flag:"--k"},{flag:"--fail-under"},{flag:"--queries"},{flag:"--format"}],nn=[{flag:"--dry-run"},{flag:"--force"},{flag:"--author"},{flag:"--message"}],Qb=[],ev=[{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--for",value_name:"intent"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit"},{flag:"--blocked-limit"},{flag:"--blocked_limit"},{flag:"--ready-only"},{flag:"--ready_only"},{flag:"--format"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]}],tv=bf([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--mode"},{flag:"--semantic"},{flag:"--hybrid"},{flag:"--match-mode"},{flag:"--min-score"},{flag:"--count"},{flag:"--semantic-weight"},{flag:"--include-linked"},{flag:"--title-exact"},{flag:"--phrase-exact"},{flag:"--highlight"},{flag:"--compact"},{flag:"--full"},{flag:"--fields",list:!0},{flag:"--format"},{flag:"--limit"},{flag:"--after"},{flag:"--status",list:!0},{flag:"--type",list:!0},{flag:"--tag",aliases:["--tags"],list:!0},{flag:"--priority",list:!0},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--assignee",list:!0},{flag:"--sprint",list:!0},{flag:"--release",list:!0},{flag:"--parent"},...Kw],new Set(["--highlight","--compact","--full","--fields","--format","--limit","--token-budget","--after"])),nv=[{flag:"--action"},{flag:"--command"},{flag:"--summary"},{flag:"--schema-only"},{flag:"--flags-only"},{flag:"--availability-only"},{flag:"--runtime-only"},{flag:"--active-only"},{flag:"--full"}],rv=[{flag:"--eager-tags"}];var m$=["list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"],p$=Ba.filter(e=>e.flag!=="--status"&&e.flag!=="--all");function Ga(e){let t=new Map;for(let n of e)for(let r of[n.flag,...n.aliases??[]]){let o=t.get(r)??[];o.push(n),t.set(r,o)}return t}var _$=Ga(vf),g$=Ga(Sf),h$=new Map([["assurance",g$],["plan",_$],["workspace",Ga(Qb)],["workspace snapshot",Ga(nn)]]);function ov(e=no){return e.map(({command:t,parent:n,accepted_flags:r})=>{let o=h$.get(n);if(!o)throw new Error(`Positional action ${t} has no flag-contract index for ${n}.`);let i=r.map(s=>{let a=o.get(s)??[];if(a.length!==1)throw new Error(`Positional action ${t} accepted flag ${s} does not resolve to exactly one ${n} flag contract.`);return a[0]});return[t,i]})}var y$=ov(),zte=new Map([["list",Ba],["list-all",Ba],...m$.map(e=>[e,p$]),["templates",hf],["cal",yf],["ctx",wf],["test-runs-worker",[]],["init",db],["config",ub],["extension",kf],["package",gf],["packages",gf],["install",mb],["upgrade",pb],["create",hf],["item",[]],["item mutate",jb],["item complete",Ub],["item reopen",zb],["copy",Hb],["focus",qb],["aggregate",Jw],["calendar",yf],["context",wf],["get",Kb],["guide",Yb],["search",tv],["next",ev],["eval",Zb],["workspace",nn],["workspace position",Qb],["workspace snapshot",nn],["workspace snapshot create",nn],["workspace snapshot list",nn],["workspace snapshot inspect",nn],["workspace snapshot restore",nn],["workspace snapshot delete",nn],["history",nb],["history-redact",ob],["history-repair",ib],["history-author-acknowledge",sb],["history-compact",ab],["history-attest",o$],["merge",rb],["schema",cb],["profile",lb],["plan",vf],["activity",Wb],["events",Vb],["restore",wb],["update",Bb],["update-many",Gb],["close",_b],["close-many",gb],["delete",bb],["append",hb],["comments",Xw],["notes",Zw],["learnings",Qw],["files",eb],["docs",tb],["deps",Jb],["graph",Xb],["test",Cb],["test-all",Ob],["telemetry",xb],["health",Pb],["assurance",Sf],...y$,["validate",Lb],["gc",Rb],["stats",Nb],["duplicates",Db],["contracts",nv],["completion",rv],["claim",yb],["release",vb],["start-task",kb],["pause-task",Eb],["close-task",Sb],["meet",Ef],["event",Ab],["remind",Ib]]);(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]="a14011f9-67eb-5cd6-b520-8e938ada4f1b")}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]="e216fd39-09ee-5a04-b0b5-44f518db4f93")}catch{}})();function xi(e){let t=e?.trim()??"";return/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(t)||/^(?:github|gitlab|jira|linear):/iu.test(t)}function ro(e){let t=e?.trim().toLowerCase();return t==="global"||t==="external"}(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]="8d87a4e8-5853-52ca-8fdf-1433e2a9e75d")}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]="12a0ee7f-508d-5e6e-b59d-24bc0aba22aa")}catch{}})();var iv=["production_defect","nightly_regression","scanner_finding","review_caught_late"];(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]="06f5d0fa-6f34-5e3e-990b-2e3bc00364ca")}catch{}})();var Wa={type:"string",pattern:"\\S"},Tf={type:"array",minItems:1,items:Wa},av={type:"object",properties:Object.fromEntries(["files","package_names","item_ids","tags","error_codes"].map(e=>[e,{type:"array",items:{type:"string"}}]))},w$={type:"object",required:["id","version","title","owner_item_id","escape_class","triggers","checks","negative_control","historical_item_ids","budget"],properties:{id:Wa,version:{type:"integer",minimum:1},title:Wa,owner_item_id:Wa,escape_class:{enum:iv},triggers:{type:"object",properties:{...Object.fromEntries(["package_names","item_ids","tags","error_codes"].map(e=>[e,{type:"array",items:{type:"string"}}])),file_patterns:{type:"array",items:{type:"string",maxLength:256}}}},checks:{type:"object",required:["local","hosted"],properties:{local:Tf,hosted:Tf}},negative_control:{...av,minProperties:1},historical_item_ids:Tf,budget:{type:"object",required:["max_escape_rate","max_false_positive_rate"],properties:Object.fromEntries(["max_escape_rate","max_false_positive_rate"].map(e=>[e,{type:"number",minimum:0,maximum:1}]))}}},sv={oneOf:[{type:"number"},{type:"array",items:{type:"string"}}]},cv={if:{required:["field"]}};Reflect.set(cv,"then",{oneOf:[{required:["equals"]},{required:["state"]}]});var lv={oneOf:[...[!0,!1].map(e=>({type:"object",additionalProperties:!1,required:e?["policy","change"]:["policy"],properties:{policy:{type:"object",required:["version","evidence_epoch","families"],properties:{version:{const:1},evidence_epoch:{type:"string",format:"date-time"},families:{type:"array",items:w$}},additionalProperties:!1},...e?{change:{...av,additionalProperties:!1}}:{uncoveredOnly:{type:"boolean"}},limit:{type:"integer",minimum:1,maximum:100},cursor:{type:"string",minLength:1}}})),{type:"object",additionalProperties:!1,required:["id","source"],properties:{id:{type:"string",minLength:1},description:{type:"string"},max_cost:{type:"number",minimum:0},source:{oneOf:[{type:"object",additionalProperties:!1,required:["kind"],allOf:[cv],properties:{kind:{const:"items"},statuses:{type:"array",items:{type:"string"}},types:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}},field:{type:"string"},equals:{type:["string","number","boolean","null"]},state:{enum:["present","missing"]}}},{type:"object",additionalProperties:!1,required:["kind","dependency_kind"],properties:{kind:{const:"dependency_kind"},dependency_kind:{type:"string",minLength:1}}},{type:"object",required:["kind","operation","field"],properties:{kind:{const:"graph"},operation:{type:"string",minLength:1},field:{type:"string",minLength:1},parameters:{type:"object"}},additionalProperties:!1},...["validate","health"].map(e=>({type:"object",required:["kind","check","field"],properties:{kind:{const:e},check:{type:"string",minLength:1},field:{type:"string",minLength:1}},additionalProperties:!1})),{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{const:"history"},op:{type:"string"},author:{type:"string"},harness:{type:"string"},model:{type:"string"}}},{type:"object",additionalProperties:!1,required:["kind","link","state"],properties:{kind:{const:"links"},link:{enum:["files","tests","docs"]},state:{enum:["present","missing"]}}},{type:"object",additionalProperties:!1,required:["kind","provider","key"],properties:{kind:{const:"provider"},provider:{type:"string",minLength:1},key:{type:"string",minLength:1},parameters:{type:"object"}}},{type:"object",additionalProperties:!1,required:["kind","expression"],properties:{kind:{const:"derived"},expression:{type:"object",minProperties:1}}}]}}},{type:"object",additionalProperties:!1,required:["id","measurement_id","owner_item_id","scope","enforcement","negative_control"],oneOf:[{required:["ceiling"]},{required:["floor"]},{required:["equals"]},{required:["zero"]},{required:["monotone_nondecreasing"]},{required:["monotone_nonincreasing"]},{required:["subset_of"]}],allOf:[{oneOf:[{not:{required:["lifetime"],properties:{lifetime:{const:"retire"}}}},{required:["lifetime","retire_reason"],properties:{lifetime:{const:"retire"},retire_reason:{type:"string",minLength:1}}}]}],properties:{id:{type:"string",minLength:1},measurement_id:{type:"string",minLength:1},owner_item_id:{type:"string",minLength:1},scope:{oneOf:[{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["all","active"]}}},{type:"object",additionalProperties:!1,required:["kind","measurement_id"],properties:{kind:{const:"filter"},measurement_id:{type:"string",minLength:1}}}]},ceiling:{type:"number"},floor:{type:"number"},equals:sv,zero:{const:!0},monotone_nondecreasing:{type:"number"},monotone_nonincreasing:{type:"number"},subset_of:{type:"array",items:{type:"string"}},lifetime:{enum:["hold","retire"]},retire_reason:{type:"string",minLength:1},enforcement:{enum:["block","warn","observe"]},authorization_decision:{type:"string",minLength:1},negative_control:{type:"object",additionalProperties:!1,required:["cases"],properties:{cases:{type:"array",minItems:2,items:{type:"object",additionalProperties:!1,required:["observed","expected"],properties:{observed:sv,expected:{enum:["pass","fail"]}}}}}}}},{type:"object",additionalProperties:!1,required:["id","assertion_ids","triggers"],properties:{id:{type:"string",minLength:1},description:{type:"string"},assertion_ids:{type:"array",minItems:1,items:{type:"string",minLength:1}},triggers:{type:"array",minItems:1,items:{enum:["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"]}},provider_policy:{type:"object",additionalProperties:!1,required:["allowed_providers","triggers"],properties:{allowed_providers:{type:"array",items:{type:"string",minLength:1}},triggers:{type:"object",additionalProperties:{type:"object",additionalProperties:!1,required:["max_cost_class","allow_network"],properties:{max_cost_class:{enum:["low","medium","high"]},allow_network:{type:"boolean"}}}}}}}}]};(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]="13afdd63-c264-5e19-a574-4067594b535b")}catch{}})();var Af={json:{type:"boolean",default:!0},quiet:{type:"boolean"},profile:{type:"boolean"},noExtensions:{type:"boolean"},noPager:{type:"boolean"},tokenAccounting:{type:"boolean"},outputInclude:{type:"string",minLength:1},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}]},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}]},outputFormat:{type:"string",enum:["json","toon"]},outputSession:{anyOf:[{type:"string",minLength:1},{type:"object",additionalProperties:!1,required:["version","id","token_budget","spent_tokens","seen_item_ids"],properties:{version:{const:1},id:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$"},token_budget:{type:"integer",minimum:256},spent_tokens:{type:"integer",minimum:0},seen_item_ids:{type:"array",maxItems:Zs,items:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"}}}}]},outputCursor:{type:"string",minLength:1},outputRowContract:{type:"boolean"},path:{type:"string"},pmExecutable:{type:"string"},timeoutMs:{type:"number"},id:{type:"string"},target:{type:"string"},snapshotAction:{type:"string",enum:["create","list","inspect","restore","delete"]},artifact:{type:"string",enum:["item","history","relationship","json"]},basePath:{type:"string"},oursPath:{type:"string"},theirsPath:{type:"string"},outputPath:{type:"string"},itemPath:{type:"string"},prefer:{type:"string",enum:["ours","theirs"]},includeReconciled:{type:"boolean"},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"},capability:{type:"string",minLength:1},declarative:{type:"boolean"},output:{type:"string",minLength:1},markdown:{type:"boolean"},init:{type:"boolean"},install:{type:"boolean"},uninstall:{type:"boolean"},explore:{type:"boolean"},manage:{type:"boolean"},describe:{type:"boolean"},doctor:{type:"boolean"},catalog:{type:"boolean"},adopt:{type:"boolean"},adoptAll:{type:"boolean"},activate:{type:"boolean"},deactivate:{type:"boolean"},filterFilesMissing:{type:"boolean"},filterDocsMissing:{type:"boolean"},matchMode:{type:"string",enum:["all","any","phrase"]},minScore:{anyOf:[{type:"number"},{type:"string",pattern:"^\\d+(\\.\\d+)?$"}]},rank:{anyOf:[{type:"number"},{type:"string",pattern:"^-?\\d+$"}]},exemptIsolateType:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},saveBaseline:{type:"boolean"},rebuild:{type:"boolean"},github:{type:"string"},ref:{type:"string"},query:{type:"string"},queries:{type:"string"},k:{anyOf:[{type:"number"},{type:"string"}]},failUnder:{anyOf:[{type:"number"},{type:"string"}]},for:{type:"string",minLength:1},keywords:{type:"string"},fields:{type:"string"},sort:{type:"string",enum:["priority","deadline","updated_at","created_at","title","parent"]},prefix:{type:"string"},idPrefix:{type:"string"},workspace:{type:"string"},preset:{type:"string",enum:["minimal","default","strict","custom"]},typePreset:{type:"string",enum:["agile","ops","research"]},defaults:{type:"boolean"},verbose:{type:"boolean"},agentGuidance:{type:"string",enum:["ask","add","skip","status"]},withPackages:{type:"boolean"},mergeFence:{type:"boolean"},scope:{type:"string",enum:["project","global"]},allOver:{type:"number"},minEntries:{type:"number"},closed:{type:"boolean"},allStreams:{type:"boolean"},contractAction:{type:"string"},command:{type:"string"},summary:{type:"boolean"},schemaOnly:{type:"boolean"},flagsOnly:{type:"boolean"},availabilityOnly:{type:"boolean"},runtimeOnly:{type:"boolean"},activeOnly:{type:"boolean"},eagerTags:{type:"boolean"},fullChangedFields:{type:"boolean"},provenance:{type:"boolean"},provenanceSummary:{type:"boolean"},agentInstance:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},provenanceFilter:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},idOnly:{type:"boolean"},allowMissingParent:{type:"boolean"},allowUnresolvedDeps:{type:"boolean"},allowDuplicate:{type:"boolean"},duplicateOf:{type:"string"},configAction:{type:"string",enum:["get","set","list","export"]},key:{type:"string"},title:{type:"string"},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},start:{type:"string"},duration:{type:"string"},end:{type:"string"},location:{type:"string"},timezone:{type:"string"},allDay:{type:"boolean"},description:{type:"string"},type:{type:"string"},template:{type:"string"},createMode:{type:"string",enum:["strict","progressive"]},schedulePreset:{type:"string",enum:["lightweight"]},status:{type:"string"},since:{type:"string",format:"date-time"},cursorMode:{type:"string",enum:["batch","row"]},exhaustive:{type:"boolean"},threshold:{type:"number",minimum:0,maximum:1},filterStatus:{type:"string"},filterType:{type:"string"},filterTag:{type:"string"},filterPriority:{anyOf:[{type:"string"},{type:"number"}]},filterDeadlineBefore:{type:"string"},filterDeadlineAfter:{type:"string"},filterUpdatedAfter:{type:"string"},filterUpdatedBefore:{type:"string"},filterCreatedAfter:{type:"string"},filterCreatedBefore:{type:"string"},filterAssignee:{type:"string"},filterAssigneeFilter:{type:"string",enum:["assigned","unassigned"]},filterParent:{type:"string"},filterSprint:{type:"string"},filterRelease:{type:"string"},closeReason:{type:"string"},completedAt:{type:"string",format:"date-time"},reason:{type:"string"},priority:{anyOf:[{type:"string"},{type:"number"}]},tags:{type:"string"},addTags:{type:"array",items:{type:"string"}},removeTags:{type:"array",items:{type:"string"}},addAc:{type:"array",items:{type:"string"}},removeAc:{type:"array",items:{type:"string"}},body:{type:"string"},deadline:{type:"string"},estimate:{anyOf:[{type:"string"},{type:"number"}]},acceptanceCriteria:{type:"string"},author:{type:"string"},message:{type:"string"},owner:{type:"string"},enforcement:{type:"string"},assignee:{type:"string"},assigneeFilter:{type:"string",enum:["assigned","unassigned"]},parent:{type:"string"},reviewer:{type:"string"},attributedAuthor:{type:"string"},planFingerprint:{type:"string",pattern:"^[a-f0-9]{64}$"},historyEvent:{type:"array",items:{type:"string"}},risk:{type:"string"},confidence:{anyOf:[{type:"string"},{type:"number"}]},sprint:{type:"string"},release:{type:"string"},blockedBy:{type:"string"},blockedReason:{type:"string"},unblockNote:{type:"string"},reporter:{type:"string"},severity:{type:"string"},environment:{type:"string"},reproSteps:{type:"string"},resolution:{type:"string"},expectedResult:{type:"string"},actualResult:{type:"string"},affectedVersion:{type:"string"},fixedVersion:{type:"string"},component:{type:"string"},regression:{anyOf:[{type:"boolean"},{type:"string"},{type:"number"}]},customerImpact:{type:"string"},definitionOfReady:{type:"string"},order:{anyOf:[{type:"string"},{type:"number"}]},goal:{type:"string"},objective:{type:"string"},value:{type:"string"},impact:{type:"string"},outcome:{type:"string"},whyNow:{type:"string"},mode:{type:"string",enum:["keyword","semantic","hybrid"]},semanticWeight:{anyOf:[{type:"string"},{type:"number"}]},op:{type:"string"},compact:{type:"boolean"},raw:{type:"boolean"},brief:{type:"boolean"},full:{type:"boolean"},includeEmpty:{type:"boolean"},view:{type:"string",enum:["agenda","day","week","month"]},date:{type:"string"},from:{type:"string"},before:{type:"string"},at:{type:"string"},to:{type:"string"},migrationId:{type:"string"},fieldTypeScope:{type:"string"},past:{type:"boolean"},fullPeriod:{type:"boolean"},include:{type:"string"},recurrenceLookaheadDays:{anyOf:[{type:"string"},{type:"number"}]},recurrenceLookbackDays:{anyOf:[{type:"string"},{type:"number"}]},occurrenceLimit:{anyOf:[{type:"string"},{type:"number"}]},includeLinked:{type:"boolean"},semantic:{type:"boolean"},hybrid:{type:"boolean"},titleExact:{type:"boolean"},phraseExact:{type:"boolean"},highlight:{type:"boolean"},includeBody:{type:"boolean"},noTruncate:{type:"boolean"},strictRead:{type:"boolean"},tag:{type:"string"},deadlineBefore:{type:"string"},deadlineAfter:{type:"string"},today:{type:"boolean"},recent:{type:"boolean"},updatedAfter:{type:"string"},updatedBefore:{type:"string"},createdAfter:{type:"string"},createdBefore:{type:"string"},filterAcMissing:{type:"boolean"},filterEstimatesMissing:{type:"boolean"},filterResolutionMissing:{type:"boolean"},filterMetadataMissing:{type:"boolean"},filterReviewerMissing:{type:"boolean"},filterRiskMissing:{type:"boolean"},filterConfidenceMissing:{type:"boolean"},filterSprintMissing:{type:"boolean"},filterReleaseMissing:{type:"boolean"},hasNotes:{type:"boolean"},noNotes:{type:"boolean"},hasLearnings:{type:"boolean"},noLearnings:{type:"boolean"},hasFiles:{type:"boolean"},noFiles:{type:"boolean"},hasDocs:{type:"boolean"},noDocs:{type:"boolean"},hasTests:{type:"boolean"},noTests:{type:"boolean"},hasComments:{type:"boolean"},noComments:{type:"boolean"},hasDeps:{type:"boolean"},noDeps:{type:"boolean"},hasBody:{type:"boolean"},emptyBody:{type:"boolean"},hasLinkedCommand:{type:"boolean"},noLinkedCommand:{type:"boolean"},filterHasNotes:{type:"boolean"},filterNoNotes:{type:"boolean"},filterHasLearnings:{type:"boolean"},filterNoLearnings:{type:"boolean"},filterHasFiles:{type:"boolean"},filterNoFiles:{type:"boolean"},filterHasDocs:{type:"boolean"},filterNoDocs:{type:"boolean"},filterHasTests:{type:"boolean"},filterNoTests:{type:"boolean"},filterHasComments:{type:"boolean"},filterNoComments:{type:"boolean"},filterHasDeps:{type:"boolean"},filterNoDeps:{type:"boolean"},filterHasBody:{type:"boolean"},filterEmptyBody:{type:"boolean"},filterHasLinkedCommand:{type:"boolean"},filterNoLinkedCommand:{type:"boolean"},ids:{type:"string"},limit:{anyOf:[{type:"string"},{type:"number"}]},blockedLimit:{anyOf:[{type:"string"},{type:"number"}]},readyOnly:{type:"boolean"},offset:{anyOf:[{type:"string"},{type:"number"}]},progress:{type:"boolean"},background:{type:"boolean"},runId:{type:"string"},stream:{anyOf:[{type:"boolean"},{type:"string",enum:["stdout","stderr","both","rows","ndjson","jsonl"]}]},tail:{anyOf:[{type:"string"},{type:"number"}]},addJson:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},eventType:{type:"string"},includeMeta:{type:"boolean"},allActionable:{type:"boolean"},verboseAuthorEvents:{type:"boolean"},match:{type:"string"},onlyIndex:{anyOf:[{type:"string"},{type:"number"}]},removeIndex:{type:"array",items:{anyOf:[{type:"string"},{type:"number"}]}},onlyLast:{type:"boolean"},envSet:{type:"array",items:{type:"string"}},envClear:{type:"array",items:{type:"string"}},sharedHostSafe:{type:"boolean"},detail:{type:"string",enum:["summary","deep"]},trace:{type:"boolean"},reload:{type:"boolean"},watch:{type:"boolean"},runtimeProbe:{type:"boolean"},fixManagedState:{type:"boolean"},isolated:{type:"boolean"},ignoreGlobal:{type:"boolean"},pmContext:{type:"string",enum:["schema","tracker","auto"]},overrideLinkedPmContext:{type:"boolean"},workspaceContext:{type:"string",enum:["source","isolated","snapshot"]},overrideLinkedWorkspaceContext:{type:"boolean"},allowUntrustedLinkedTests:{type:"boolean"},acknowledgeLinkedTests:{type:"boolean"},failOnContextMismatch:{type:"boolean"},failOnSkipped:{type:"boolean"},failOnEmptyTestRun:{type:"boolean"},requireAssertionsForPm:{type:"boolean"},checkContext:{type:"boolean"},autoPmContext:{type:"boolean"},measure:{type:"array",items:{type:"string"}},metricBelow:{type:"string"},metricDiff:{type:"string"},diff:{type:"boolean"},storage:{type:"boolean"},metadataCoverage:{type:"boolean"},fieldUtilization:{type:"boolean"},byAssignee:{type:"boolean"},byTag:{type:"boolean"},byPriority:{type:"boolean"},tagPrefix:{type:"string"},measurements:{type:"boolean"},metric:{type:"string"},measurementLimit:{type:"integer",minimum:0,maximum:1e3},observe:{type:"array",items:{type:"string"}},improvementDirection:{type:"string",enum:["higher","lower","target"]},measurementSource:{type:"string"},measurementItem:{type:"string"},measurementRevision:{type:"string"},provenanceCoverage:{type:"boolean"},fleetAttribution:{type:"boolean"},eventLimit:{type:"integer",minimum:1,maximum:1e5},minimumSample:{type:"integer",minimum:1,maximum:1e4},verify:{type:"boolean"},literal:{type:"array",items:{type:"string"}},regex:{type:"array",items:{type:"string"}},replacement:{type:"string"},timeout:{anyOf:[{type:"string"},{type:"number"}]},validateClose:{type:"string",enum:["off","warn","strict"]},checkMetadata:{type:"boolean"},metadataProfile:{type:"string",enum:["core","strict","custom"]},checkResolution:{type:"boolean"},checkCompleteness:{type:"boolean"},checkLifecycle:{type:"boolean"},checkStaleBlockers:{type:"boolean"},dependencyCycleSeverity:{type:"string",enum:["off","warn","error"]},parentCycleSeverity:{type:"string",enum:["off","warn","error"]},checkFiles:{type:"boolean"},checkStorageIntegrity:{type:"boolean"},strictDirectories:{type:"boolean"},requireMergeDrivers:{type:"boolean"},checkOnly:{type:"boolean"},checkTelemetry:{type:"boolean"},noRefresh:{type:"boolean"},refreshVectors:{type:"boolean"},verboseStaleItems:{type:"boolean"},skipVectors:{type:"boolean"},skipIntegrity:{type:"boolean"},skipDrift:{type:"boolean"},verboseDiagnostics:{type:"boolean"},allAffectedIds:{type:"boolean"},scanMode:{type:"string",enum:["default","tracked-all","tracked-all-strict"]},includePmInternals:{type:"boolean"},verboseFileLists:{type:"boolean"},strictExit:{type:"boolean"},failOnWarn:{type:"boolean"},fixHints:{type:"boolean"},autoFix:{type:"boolean"},fixScope:{type:"array",items:{type:"string",enum:["metadata","resolution","estimates","lifecycle"]}},pruneMissing:{type:"boolean"},checkHistoryDrift:{type:"boolean"},checkCommandReferences:{type:"boolean"},counts:{type:"boolean"},edit:{type:"integer",minimum:1},delete:{type:"integer",minimum:1},dryRun:{type:"boolean"},normalizeProvenance:{type:"boolean"},salvageTail:{type:"boolean"},all:{type:"boolean"},clear:{type:"boolean"},cliOnly:{type:"boolean"},packagesOnly:{type:"boolean"},repair:{type:"boolean"},packageName:{type:"string"},rollback:{type:"string"},noCheckpoint:{type:"boolean"},force:{type:"boolean"},ifAvailable:{type:"boolean"},ifAbsent:{type:"boolean"},next:{type:"boolean"},maxAttempts:{anyOf:[{type:"integer",minimum:1,maximum:100},{type:"string",pattern:"^(?:[1-9]|[1-9][0-9]|100)$"}]},includeDecisions:{type:"boolean"},includeGates:{type:"boolean"},includeContainers:{type:"boolean"},explainRanking:{type:"boolean"},noTags:{type:"boolean"},noExtensionHealth:{type:"boolean"},run:{type:"boolean"},count:{type:"boolean"},sum:{type:"string"},avg:{type:"string"},tree:{type:"boolean"},treeId:{type:"string",minLength:1},definition:{type:"object"},trigger:{type:"string",enum:["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"]},gate:{type:"string",minLength:1},treeDepth:{anyOf:[{type:"string"},{type:"number"}]},includeUnparented:{type:"boolean"},gcScope:{type:"array",items:{type:"string",enum:["index","embeddings","runtime","locks"]}},maxDepth:{anyOf:[{type:"string"},{type:"number"}]},nodeLimit:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},edgeLimit:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},tokenBudget:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},cursor:{type:"string"},direction:{type:"string",enum:["outgoing","incoming","both"]},kind:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},after:{type:"string"},maxPaths:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},sample:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},exemptIsolate:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},collapse:{type:"string",enum:["none","repeated"]},shell:{type:"string",enum:["bash","zsh","fish"]},stdin:{type:"boolean"},file:{type:"string"},preserveSourceIds:{type:"boolean"},folder:{type:"string"},subcommand:{type:"string"},name:{type:"string"},defaultStatus:{type:"string"},alias:{type:"array",items:{type:"string"}},role:{type:"array",items:{type:"string"}},fieldType:{type:"string",enum:["string","number","boolean","string_array"]},commands:{type:"array",items:{type:"string"}},cliFlag:{type:"string"},required:{type:"boolean"},requiredOnCreate:{type:"boolean"},allowUnset:{type:"boolean"},requiredTypes:{type:"array",items:{type:"string"}},infer:{type:"boolean"},minCount:{type:"number"},text:{type:"string"},add:{type:"array",items:{type:"string"}},addGlob:{type:"array",items:{type:"string"}},remove:{type:"array",items:{type:"string"}},migrate:{type:"array",items:{type:"string"}},discover:{type:"boolean"},apply:{type:"boolean"},discoveryNote:{type:"string"},lookupPath:{type:"array",items:{type:"string"}},explain:{type:"boolean"},lines:{type:"string",pattern:"^[1-9]\\d*:[1-9]\\d*$"},decisionDepth:{type:"integer",minimum:1,maximum:32},addNote:{type:"string"},list:{type:"boolean"},appendStable:{type:"boolean"},validatePaths:{type:"boolean"},dep:{type:"array",items:{type:"string"}},depRemove:{type:"array",items:{type:"string"}},replaceDeps:{type:"boolean"},replaceTests:{type:"boolean"},replaceFiles:{type:"boolean"},replaceDocs:{type:"boolean"},comment:{type:"array",items:{type:"string"}},note:{type:"array",items:{type:"string"}},learning:{type:"array",items:{type:"string"}},linkedFile:{type:"array",items:{type:"string"}},linkedTest:{type:"array",items:{type:"string"}},doc:{type:"array",items:{type:"string"}},reminder:{type:"array",items:{type:"string"}},event:{type:"array",items:{type:"string"}},typeOption:{type:"array",items:{type:"string"}},field:{type:"array",items:{type:"string"}},unset:{type:"array",items:{type:"string"}},clearDeps:{type:"boolean"},clearComments:{type:"boolean"},clearNotes:{type:"boolean"},clearLearnings:{type:"boolean"},clearFiles:{type:"boolean"},clearTests:{type:"boolean"},clearDocs:{type:"boolean"},clearReminders:{type:"boolean"},clearEvents:{type:"boolean"},clearTypeOptions:{type:"boolean"},criterion:{type:"array",items:{type:"string"}},clearCriteria:{type:"boolean"},groupBy:{type:"string"},setMode:{type:"string",enum:["element","tuple"]},completion:{type:"boolean"},format:{type:"string"},unbounded:{type:"boolean"},depth:{type:"string",enum:["brief","standard","deep","full"]},section:{type:"array",items:{type:"string",enum:["hierarchy","activity","progress","blockers","files","workload","staleness","tests"]}},activityLimit:{anyOf:[{type:"string"},{type:"number"}]},staleThreshold:{type:"string"},policy:{type:"string"}},dv={schema:{definition:{type:["object","string"]}},assurance:{definition:lv,kind:{type:"string",enum:["measurement","assertion","gate"]},subcommand:{type:"string",enum:["list","show","put","remove","run","verdicts","presets","apply","derive","promote","risk","lineages"]},preset:{type:"string",enum:["software-delivery","research","agent-evaluation","operations"]},enforcement:{type:"string",enum:["warn","block"]},limit:{type:"integer",minimum:1,maximum:1e3}},activity:{harness:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},"update-many":{ids:{anyOf:[{type:"string"},{type:"number"},{type:"array",items:{anyOf:[{type:"string"},{type:"number"}]}}]}},"close-many":{ids:{anyOf:[{type:"string"},{type:"number"},{type:"array",items:{anyOf:[{type:"string"},{type:"number"}]}}]}},"history-compact":{ids:{anyOf:[{type:"string"},{type:"number"},{type:"array",items:{anyOf:[{type:"string"},{type:"number"}]}}]}},events:{since:{type:"string",minLength:1},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},harness:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},history:{harness:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},remind:{at:{type:"string",minLength:1}}},b$=["create","show","add-step","update-step","complete-step","block-step","reorder-step","remove-step","link","unlink","decision","discovery","validation","resume","approve","materialize"],If={subcommand:{type:"string",enum:[...b$]},stepRef:{type:"string"},reorderTo:{anyOf:[{type:"string"},{type:"number"}]},scope:{type:"string"},harness:{type:"string",enum:[...vm]},mode:{type:"string",enum:[...bm]},resumeContext:{type:"string"},related:{type:"string"},blocks:{type:"string"},claim:{type:"boolean"},fromSearch:{type:"string"},stepTitle:{type:"string"},step:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},stepBody:{type:"string"},stepOwner:{type:"string"},stepStatus:{type:"string",enum:[...ns]},stepEvidence:{type:"string"},stepBlockedReason:{type:"string"},stepReplacement:{type:"string"},dependsOn:{type:"string"},link:{type:"string"},linkKind:{type:"string",enum:[...km]},linkNote:{type:"string"},promoteToItemDep:{type:"boolean"},allowMultipleActive:{type:"boolean"},file:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},test:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},doc:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},decisionText:{type:"string"},decision:{type:"string"},decisionRationale:{type:"string"},decisionEvidence:{type:"string"},discoveryText:{type:"string"},discovery:{type:"string"},validationText:{type:"string"},validation:{type:"string"},validationCommand:{type:"string"},validationExpected:{type:"string"},steps:{type:"array",items:{type:"string"}},materializeType:{type:"string"},materializeParent:{type:"string"},materializeTags:{type:"string"},field:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},Cf={subcommand:{description:"Plan workflow operation to run.",examples:["create","show","add-step","approve"]},stepRef:{description:"Plan step id or order for step lifecycle subcommands.",examples:["plan-step-001","1"]},reorderTo:{description:"New integer order for reorder-step.",examples:[1,"2"]},scope:{description:"Short free-text scope statement describing what the Plan covers.",examples:["Release readiness audit","Search package migration"]},mode:{description:"Plan lifecycle mode.",examples:["draft","research","approved"]},step:{description:"Ordered initial step titles for create (string or array, never comma-split; stepTitle, when also set, becomes the first step). For step subcommands a single value aliases stepTitle.",examples:[["Read the code","Write the fix","Run the tests"]]},file:{description:"File link to attach while creating or materializing a Plan.",examples:["path=src/cli.ts,note=implementation surface"]},test:{description:"Test command link to attach while creating or materializing a Plan.",examples:["command=pnpm build,timeout_seconds=300"]},doc:{description:"Documentation link to attach while creating or materializing a Plan.",examples:["path=docs/SDK.md,note=public API reference"]}},uv={includeGates:{description:"Opt next or claim-next into outcome gates. Blocker and ownership restrictions still apply."},includeContainers:{description:"Opt next or claim-next into containers with unfinished descendants. Blocker and ownership restrictions still apply."},action:{description:"Tool action to execute."},pmExecutable:{description:"Override the pm executable used by actions that invoke or verify an external CLI process.",examples:["pm","node dist/cli.js"]},force:{description:"Allow the selected action to override its supported ownership, terminal-state, or destructive-operation guard."},limit:{description:"Maximum number of rows returned by the selected action.",examples:[10,"25"]},text:{description:"Text payload used by append, comment, note, or learning mutations."},path:{description:"Optional PM data root override for this invocation.",examples:[".agents/pm"]},scope:{description:"Scope selector for commands that operate on project or global state. Linked files, docs, and tests default to project scope when omitted.",examples:["project","global"]},detail:{description:"Detail mode for commands that support concise and deep diagnostics.",examples:["summary","deep"]},trace:{description:"When true for extension-doctor, include actionable registration traces in deep diagnostics."},reload:{description:"When true for extension action payloads, trigger cache-busted extension module reload."},watch:{description:"When true for extension-reload/extension action payloads, enable watch mode semantics."},runtimeProbe:{description:"When true for extension-manage, run a doctor-like runtime activation probe for parity fields."},fixManagedState:{description:"When true for extension-manage/extension-doctor, adopt unmanaged extensions before diagnostics/update checks."},isolated:{description:"When true for extension-doctor/package-doctor, ignore global registrations for hermetic project diagnostics."},ignoreGlobal:{description:"Alias for isolated on extension-doctor/package-doctor action payloads."},target:{description:"Positional target argument for the selected action (ID, source, package source, or extension name).",examples:["pm-a1b2",".agents/pm/extensions/sample","sample-extension"]},capability:{description:"Starter capability selected by extension-init or package-init scaffolding.",examples:["commands","hooks","search","schema"]},declarative:{description:"Generate the package composeExtension declarative blueprint starter."},output:{description:"File path for commands that write generated output, such as package/extension describe Markdown references.",examples:["docs/pm-package-reference.md"]},markdown:{description:"Render the package or extension description as Markdown instead of structured output.",examples:[!0]},github:{description:"GitHub shorthand owner/repo[/path] source for package/extension install actions.",examples:["org/repo/extensions/sample"]},ref:{description:"Git ref/branch/tag used when installing from GitHub shorthand/URL sources.",examples:["main","v1.0.0"]},cliOnly:{description:"Restrict upgrade to the pm CLI/SDK npm package."},packagesOnly:{description:"Restrict upgrade to managed installable pm packages."},repair:{description:"Force npm global reinstall semantics when upgrading the pm CLI/SDK."},tag:{description:"npm version or dist-tag used for CLI and registry package upgrades.",examples:["latest","next","2026.5.11"]},today:{description:"When true for list actions, include only items updated since local midnight today."},recent:{description:"When true for list actions, include only items updated in the last seven days."},packageName:{description:"Override the pm CLI package name for self-upgrade automation and tests.",examples:["@unbrained/pm-cli"]},json:{description:"Emit machine-readable JSON output."},quiet:{description:"Suppress stdout payload output."},noExtensions:{description:"Disable extension loading for this invocation."},noPager:{description:"Disable pager integration for help and long output."},tokenAccounting:{description:"Request a bounded transport-level receipt for output emitted by a compatible CLI or MCP host."},outputInclude:{description:"Comma-separated fields or sections retained by any built-in read action.",examples:["id,title,status","summary,counts"]},outputLimit:{description:"Universal read row ceiling, or unbounded to disable the shared ceiling.",examples:[10,"unbounded"]},outputBudget:{description:"Universal estimated-token ceiling for a read result, or unbounded to disable the shared ceiling.",examples:[600,1200,"unbounded"]},outputFormat:{description:"Universal read-result encoding selector.",examples:["toon","json"]},outputSession:{description:"Caller-carried JSON session state that enforces a token ceiling across read calls and replaces repeated item facts with resolvable context references.",examples:[{version:1,id:"orientation",token_budget:4e3,spent_tokens:0,seen_item_ids:[]}]},outputCursor:{description:"Opaque continuation cursor returned when a declared row collection is compacted by the output budget."},outputRowContract:{description:"Include the row selector and TOON row-encoding contract on a read result."},profile:{description:"Emit deterministic timing diagnostics to stderr."},timeoutMs:{description:"Tool execution timeout in milliseconds.",examples:[12e4]},id:{description:"Item identifier for read or mutation actions.",examples:["pm-a1b2"]},treeId:{description:"Commit, tree, snapshot, or immutable workspace identity judged by an assurance gate.",examples:["0123456789abcdef","release-candidate-3"]},definition:{description:"Structured measurement, assertion, or gate declaration used by assurance put."},trigger:{description:"Lifecycle trigger used to evaluate an assurance gate.",examples:["ci","pre-release"]},gate:{description:"Stable assurance gate id used to filter durable verdict history.",examples:["release-readiness"]},owner:{description:"pm item that owns preset or observation-derived assurance assertions.",examples:["pm-a1b2"]},enforcement:{description:"Explicit next assurance enforcement level.",examples:["warn","block"]},runId:{description:"Background test run identifier.",examples:["tr-kq9x3f-93acde"]},title:{description:"Item title text."},description:{description:"Item description text."},type:{description:"Item type name from the active runtime type registry.",examples:["Task","Feature"]},subcommand:{description:"Subcommand selector for schema, profile, telemetry, and graph actions."},name:{description:"Custom definition name, schema migration source name, or profile name.",examples:["Spike","review","component"]},defaultStatus:{description:"Default status hint recorded for a custom item type.",examples:["open"]},alias:{description:"Aliases for the custom item type or status (repeatable).",examples:[["spike","research"]]},role:{description:"Lifecycle roles for a custom status (schema add-status): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel.",examples:[["active"],["terminal","terminal_done"]]},fieldType:{description:"Value type for a custom field (schema add-field): string, number, boolean, or string_array.",examples:["string","number","string_array"]},fieldTypeScope:{description:"Optional item type restricting which records participate in schema rename-field.",examples:["Issue","Feature"]},migrationId:{description:"Optional stable idempotency override used to persist and resume a schema migration plan; omitted values are derived from the workspace and normalized request.",examples:["severity-to-impact-v2"]},commands:{description:"Commands a custom field is wired onto (schema add-field): create, update, update_many, list, search, calendar, context.",examples:[["create","update"],["create","update","list"]]},cliFlag:{description:"Override the auto-derived CLI flag for a custom field (schema add-field).",examples:["--owner"]},required:{description:"Mark a custom field as always required (schema add-field)."},requiredOnCreate:{description:"Mark a custom field as required at create time (schema add-field)."},allowUnset:{description:"Whether a custom field may be cleared via --unset (schema add-field); defaults to true."},allowDuplicate:{description:"Explicitly proceed when strict similarity governance finds likely duplicate items."},allowUnresolvedDeps:{description:"Permit unresolved local dependency targets while returning dependency_target_unresolved warning receipts. Cross-workspace references should use source_kind=external instead.",examples:[!0]},requiredTypes:{description:"Restrict a custom field's requirement to specific item types (schema add-field).",examples:[["Bug"],["Story","Spike"]]},infer:{description:"Infer custom item types from title-prefix conventions (schema add-type); previews unless apply is true."},minCount:{description:"Minimum number of items sharing a title prefix for schema add-type inference (default 10).",examples:[10,25]},preset:{description:"Governance preset for initialization flows.",examples:["minimal","default","strict"]},idPrefix:{description:"Tracker item identifier prefix used by initialization; overrides the positional compatibility prefix.",examples:["pm","work"]},workspace:{description:"Workspace directory where initialization resolves or creates the tracker.",examples:[".","packages/app"]},typePreset:{description:"Domain item-type preset registered during initialization.",examples:["agile","ops","research"]},defaults:{description:"Use non-interactive setup defaults during initialization."},verbose:{description:"Include the full resolved settings tree in init output."},agentGuidance:{description:"Control AGENTS.md/CLAUDE.md guidance behavior during init: ask, add, skip, or status.",examples:["ask","add","skip","status"]},withPackages:{description:"Install all bundled first-party pm packages during initialization."},mergeFence:{description:"Install the repository merge-driver fence for a fresh Git-backed tracker; set false to opt out."},createMode:{description:"Create required-option policy mode.",examples:["strict","progressive"]},schedulePreset:{description:"Schedule-centric create preset for Reminder, Meeting, and Event types.",examples:["lightweight"]},status:{description:"Item status value. Statuses are project-configurable via .agents/pm/settings.json (schema block); the built-in defaults are draft, open, in_progress, blocked, closed, canceled. Custom statuses defined for the project are accepted \u2014 discover the active set with the pm_contracts tool (workspace.statuses) or `pm contracts`. Unknown statuses are rejected at runtime with a did-you-mean hint rather than blocked by a fixed schema enum.",examples:["open","in_progress"]},since:{description:"Inclusive ISO 8601 creation timestamp lower bound for duplicate discovery.",examples:["2026-01-01T00:00:00.000Z"]},exhaustive:{description:"Compare every duplicate pair within the disclosed safety bound; default prefix filtering preserves exact recall."},threshold:{description:"Minimum duplicate similarity score from zero through one.",examples:[.85]},priority:{description:"Priority value in range 0..4.",examples:[0,1,"2"]},order:{description:"Planning order/rank value for create/update, or sort direction (asc|desc) for list-family sorting.",examples:[0,1,"2","asc","desc"]},sort:{description:"List-family sort field selector.",examples:["priority","deadline","updated_at","created_at","title","parent"]},tags:{description:"Comma-delimited tag list.",examples:["pm-cli,agent-ux"]},addTags:{description:"Tags to add to the existing list without replacing it. Each entry may be CSV or a JSON array.",examples:[["agent-ux"],["fix","security"]]},addAc:{description:"Acceptance criteria appended individually without replacing the existing list (one criterion per entry).",examples:[["error path covered by a regression test"]]},removeAc:{description:"Acceptance criteria removed individually by exact text match; the mutation fails atomically if any selector is unmatched (one criterion per entry).",examples:[["superseded manual QA step"]]},removeTags:{description:"Tags to remove from the existing list. Each entry may be CSV or a JSON array.",examples:[["stale"],["legacy","wontfix"]]},deadline:{description:"ISO/date timestamp or relative offset (+6h/+1d/+2w/+6m).",examples:["2026-04-01T00:00:00.000Z","+1d"]},reminder:{description:"Repeatable reminder seed entries at=<iso|relative>,text=<text>.",examples:[["at=+2d,text=Review PR"]]},event:{description:"Repeatable event seed entries start=<iso|relative> with end=<iso|relative> or duration=<relative|30min|PT30M>. Bare `m` remains months for backward compatibility.",examples:[["start=2026-07-01T10:00:00Z,duration=2h,title=planning"],["start=2026-07-01T10:00:00Z,duration=30min,title=standup"],["start=2026-07-01T10:00:00Z,duration=PT30M,title=window"]]},historyEvent:{description:"Unknown-author history target in <item-id>:<one-based-line> form.",examples:[["pm-example:4","pm-example:5"]]},planFingerprint:{description:"Exact SHA-256 returned by a history-author-acknowledge dry-run preview; apply refuses stale or changed source coordinates.",examples:["0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"]},estimate:{description:"Estimated effort in minutes.",examples:[60,"120"]},acceptanceCriteria:{description:"Complete acceptance-criteria text supplied while creating or replacing an item field."},author:{description:"Intentional mutation-author override. Agent harness identity is automatic when omitted."},attributedAuthor:{description:"Principal attributed to the immutable unknown-author history events after review.",examples:["reviewed-principal"]},message:{description:"History message for mutation audit trail."},ifAbsent:{description:"For annotations, append only when no existing entry has the same resolved author and exact stored text; retries return changed false without a history event."},assignee:{description:"Assignee identity."},assigneeFilter:{description:"Assignee presence selector for list, calendar, and context filters.",examples:["assigned","unassigned"]},parent:{description:"Parent item ID filter for hierarchical list queries.",examples:["pm-epic01"]},blockedLimit:{description:"Cap blocked rows returned by the next action (defaults to the ready --limit).",examples:["3"]},readyOnly:{description:"When true, the next action omits the blocked companion list."},unset:{description:"Repeatable list of item-metadata fields to clear explicitly during create/update mutations.",examples:[["deadline","assignee"],["close-reason"]]},clearDeps:{description:"When true, clear linked dependencies."},replaceDeps:{description:"When true for update, atomically replace dependencies with the supplied --dep values."},replaceTests:{description:"When true for update, atomically replace linked tests with the supplied --test values."},replaceFiles:{description:"When true for update, atomically replace linked files with the supplied --file values."},replaceDocs:{description:"When true for update, atomically replace linked docs with the supplied --doc values."},lookupPath:{description:"One or more source paths whose referencing pm items should be returned by files lookup.",examples:[["src/sdk/files.ts"],["README.md","docs/SDK.md"]]},explain:{description:"Include ranked linked-file, rationale, and governing-decision evidence for a files lookup."},lines:{description:"Inclusive start:end source-line range for Git contribution attribution; requires one lookup path.",examples:["10:24"]},decisionDepth:{description:"Maximum typed relationship depth searched for a governing Decision during files lookup.",examples:[8]},clearComments:{description:"When true, clear item comments."},clearNotes:{description:"When true, clear item notes."},clearLearnings:{description:"When true, clear item learnings."},clearFiles:{description:"When true, clear linked files."},clearTests:{description:"When true, clear linked tests."},clearDocs:{description:"When true, clear linked docs."},clearReminders:{description:"When true, clear reminders."},clearEvents:{description:"When true, clear events."},clearTypeOptions:{description:"When true, clear type option metadata."},clearCriteria:{description:"When true for config set criteria-list keys (definition-of-done, metadata-required-fields, lifecycle pattern lists), clear the criteria list."},mode:{description:"Mode selector for search and reindex (keyword|semantic|hybrid).",examples:["keyword","hybrid"]},semanticWeight:{description:"Per-query hybrid semantic weight override in [0,1] for search action; invalid values fall back to settings.",examples:[.2,"0.7"]},op:{description:"History operation filter for activity output.",examples:["create","update","close","update_ownership_bypass"]},fullPeriod:{description:"For day/week/month calendar views, include the full anchored period instead of clipping the start to now."},progress:{description:"Emit progress diagnostics to stderr for long-running operations."},background:{description:"Run linked tests in managed background mode."},addJson:{description:"JSON input: one structured context event for notes, or repeatable linked-test entries for test.",examples:[['{"command":"node scripts/run-tests.mjs test -- tests/unit/output.spec.ts","timeout_seconds":240}']]},eventType:{description:"For notes action, return structured context events whose top-level type matches this value."},includeMeta:{description:"Include structured-event counts for notes reads; filtered reads also include total, returned, limit, and has-more metadata."},allActionable:{description:"For history-author-acknowledge, select every currently actionable undispositioned event."},match:{description:"Run only linked tests whose command or path contains this case-insensitive substring.",examples:["output.spec.ts","coverage"]},onlyIndex:{description:"Run only the 1-based linked-test index from pm test <id> --list order.",examples:[1,"2"]},removeIndex:{description:"Remove linked tests by their 1-based positions from pm test <id> --list order; repeatable and lossless for commands containing commas or equals signs.",examples:[[1],["2","4"]]},onlyLast:{description:"Run only the most recently added linked-test entry."},envSet:{description:"Repeatable runtime environment KEY=VALUE overrides for linked-test execution.",examples:[["PORT=0","PLAYWRIGHT_HTML_OPEN=never"]]},envClear:{description:"Repeatable runtime environment variable names to clear before linked-test execution.",examples:[["PLAYWRIGHT_BASE_URL"]]},sharedHostSafe:{description:"Apply additive shared-host-safe runtime defaults during linked-test execution."},pmContext:{description:"PM linked-test context mode (schema keeps isolated tracker data; tracker seeds source tracker data; auto uses tracker for PM tracker-read linked commands).",examples:["schema","tracker","auto"]},overrideLinkedPmContext:{description:"Force run-level --pm-context to override per-linked-test pm_context_mode metadata for all linked-test entries."},workspaceContext:{description:"Source-workspace mode: source preserves read-only source context, isolated omits it for self-sandboxing commands, and snapshot runs from a temporary workspace paired with the selected tracker sandbox.",examples:["source","isolated","snapshot"]},overrideLinkedWorkspaceContext:{description:"Force run-level --workspace-context over per-linked-test workspace_context_mode metadata."},allowUntrustedLinkedTests:{description:"Explicitly execute commands not yet trusted by this clone when testing.allow_untrusted_linked_tests is also enabled."},acknowledgeLinkedTests:{description:"Record clone-local trust for the item's current linked commands without executing them."},failOnContextMismatch:{description:"Fail linked PM command runs when source and sandbox tracker item counts differ."},failOnSkipped:{description:"Treat skipped linked tests as dependency-failed policy violations."},failOnEmptyTestRun:{description:"Treat successful linked-test commands that report zero executed tests as failures."},requireAssertionsForPm:{description:"Require assertion metadata for linked PM command test entries during run execution."},checkContext:{description:"Run linked PM command context preflight diagnostics before command execution."},autoPmContext:{description:"Auto-remediate PM tracker-read linked commands by routing those entries through tracker context regardless of linked-test pm_context_mode overrides."},measure:{description:"Repeatable numeric run evidence in name=value[,unit=...][,threshold=...] form.",examples:[["coverage=100,unit=percent,threshold=100"]]},metricBelow:{description:"Return recorded evidence below a name=value threshold.",examples:["coverage=100"]},metricDiff:{description:"Compare the latest and previous values for one metric.",examples:["coverage"]},dryRun:{description:"Preview command effects without mutating storage artifacts."},normalizeProvenance:{description:"For history-repair: remove invalid legacy provenance observations and emit only aggregate privacy-safe repair evidence."},salvageTail:{description:"For history-repair with one explicit id: remove an invalid trailing suffix after a verified prefix; refuses interior corruption."},all:{description:"For history-repair action: scan every stream for drift and repair each drifted stream in one audited pass (mutually exclusive with id)."},clear:{description:"For focus action: clear the session focused item instead of setting it (mutually exclusive with id)."},gcScope:{description:"Repeatable gc scope selector values (index, embeddings, runtime, locks, checkpoints, transactions).",examples:[["index","embeddings"],["runtime"],["locks"],["checkpoints"]]},storage:{description:"For stats action: include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries) for compaction and storage planning."},fieldUtilization:{description:"For stats action: include a field_utilization block reporting present/total/percent for content fields (notes, learnings, files, docs, tests, comments, deps, body, linked_command) across all items so under-documented dimensions are visible at a glance."},measurements:{description:"For stats action: include the audited append-only improvement ledger and baseline-to-latest trends."},metric:{description:"Exact improvement metric name used to filter ledger reads.",examples:["quality.coverage.lines"]},measurementLimit:{description:"Maximum newest improvement observations returned by stats.",examples:[50]},observe:{description:"Repeatable audited observation in name=value[,unit=...][,threshold=...] form.",examples:[["quality.coverage.lines=100,unit=percent,threshold=100"]]},improvementDirection:{description:"Improvement direction for newly recorded observations.",examples:["higher","lower","target"]},measurementSource:{description:"Producing gate or instrument for a new observation.",examples:["pnpm coverage"]},measurementItem:{description:"Tracked item that owns an improvement observation.",examples:["pm-123abc"]},measurementRevision:{description:"Explicit source revision for a new observation.",examples:["0123456789abcdef"]},provenanceCoverage:{description:"For stats action: compare configured provenance descriptors with bounded immutable-history observations."},fleetAttribution:{description:"For stats action: derive observational throughput, rework, and defect-escape rates by harness, model, and author source."},eventLimit:{description:"Maximum immutable history events consumed by an analytics projection.",examples:[1e4]},minimumSample:{description:"Minimum denominator before analytics rates are reported.",examples:[5]},offset:{description:"Number of matching rows to skip before limit is applied.",examples:[0,50,"100"]},provenance:{description:"Return patch-free immutable author, harness, instance, and extensible provenance rows."},provenanceSummary:{description:"Include bounded observed, unavailable, legacy-missing, and unresolved-author counts."},agentInstance:{description:"Privacy-safe agent invocation fingerprint filter, supplied once or as a list.",examples:["a1b2c3d4",["a1b2c3d4","e5f6g7h8"]]},provenanceFilter:{description:"Exact extensible provenance predicate in dimension=value form, supplied once or as a list.",examples:["model=gpt-5.6-sol",["effort=xhigh","role=reviewer"]]},before:{description:"For history-compact, compact entries strictly before this boundary (version number or ISO timestamp). Single-id mode only.",examples:["5","2026-06-01T00:00:00.000Z"]},at:{description:"Read-only historical projection boundary as an item version or ISO timestamp.",examples:["3","2026-07-01T12:00:00.000Z"]},allOver:{description:"For history-compact bulk mode, compact every stream with more than N entries. When history.compact_policy is enabled and this is omitted, the policy's max_entries is used.",examples:[200,"500"]},minEntries:{description:"For history-compact bulk mode, skip streams with at most N entries as already-compact (default 3).",examples:[3,"10"]},closed:{description:"For history-compact bulk mode, compact only closed (terminal) items' history streams."},allStreams:{description:"For history-compact bulk mode, compact every history stream regardless of lifecycle state."},literal:{description:"Repeatable literal matcher used by history-redact to scrub exact string values.",examples:["[redacted_path_prefix]/private/path"]},regex:{description:"Repeatable regex matcher used by history-redact. Accepts either /pattern/flags or a raw pattern (global mode is auto-enabled).",examples:["/192\\\\.168\\\\.[0-9.]+/g","token=[A-Za-z0-9_-]+"]},replacement:{description:'Replacement text used by history-redact (defaults to "[redacted]").',examples:["[scrubbed_path]"]},validateClose:{description:'Close-time metadata validation mode ("off", "warn", or "strict").',examples:["off","warn","strict"]},checkMetadata:{description:"Run metadata completeness checks."},metadataProfile:{description:"Select metadata validation profile for --check-metadata.",examples:["core","strict","custom"]},checkResolution:{description:"Run closed-item resolution metadata checks."},checkCompleteness:{description:"Evaluate declarative lifecycle field requirements, with per-type counts and bounded missing-field diagnostics."},checkLifecycle:{description:"Run active-item lifecycle governance drift checks."},checkStaleBlockers:{description:"Include stale blocker-pattern diagnostics in lifecycle checks."},dependencyCycleSeverity:{description:"Set dependency-cycle warning policy for lifecycle checks.",examples:["off","warn","error"]},parentCycleSeverity:{description:"Set parent-cycle warning policy for lifecycle checks.",examples:["off","warn","error"]},checkFiles:{description:"Run linked-file and orphaned-file checks."},checkStorageIntegrity:{description:"Run deep item, history, index, and vector storage integrity checks."},strictDirectories:{description:"Treat optional item-type directories as required health failures."},requireMergeDrivers:{description:"Treat never-installed clone-local semantic merge drivers as required health failures."},checkOnly:{description:"For health action, run read-only diagnostics without refreshing vectors."},checkTelemetry:{description:"For health action, probe telemetry endpoint health and include network diagnostics."},noRefresh:{description:"For health action, skip vector refresh while still running checks."},refreshVectors:{description:"For health action, explicitly refresh stale vectors."},verboseStaleItems:{description:"For health action, include full stale-item arrays in vectorization details."},verboseAuthorEvents:{description:"For health action, include every actionable unknown-author event coordinate."},skipVectors:{description:"For health action, skip vectorization checks for a faster diagnostic run."},skipIntegrity:{description:"For health action, skip item/history file integrity checks for a faster diagnostic run."},skipDrift:{description:"For health action, skip history drift hash checks for a faster diagnostic run."},scanMode:{description:"Select file candidate scan mode for --check-files.",examples:["default","tracked-all","tracked-all-strict"]},includePmInternals:{description:"Include PM storage internals in tracked-all candidate scans."},verboseFileLists:{description:"For validate action, include full file-path lists for --check-files details."},verboseDiagnostics:{description:"For validate action, include full diagnostic ID lists instead of compact summaries."},strictExit:{description:"Apply the selected capability's strict exit policy; health also requires merge drivers."},failOnWarn:{description:"Alias for strictExit in health, validation, history, and managed doctor actions."},fixHints:{description:"For validate action, add a machine-executable fix_hints[] of pm commands to each failing check's details."},autoFix:{description:"For validate action, apply the safe, deterministic subset of fix-hint remediations (field backfills) automatically; combine with dryRun to preview and fixScope to grant gated scopes."},fixScope:{description:"For validate action, grant --auto-fix scopes (metadata, resolution, estimates, lifecycle). Defaults to the safe scopes metadata and resolution; estimates (per-type default estimated_minutes backfill) and lifecycle must be named explicitly.",examples:[["estimates"],["lifecycle"],["metadata","resolution"]]},pruneMissing:{description:"For validate action, remove stale linked-file/doc LINKS whose paths classified as deleted (link removal only \u2014 never touches real files); honors dryRun."},checkHistoryDrift:{description:"Run item/history hash drift checks."},checkCommandReferences:{description:"Run linked-command PM-ID reference checks."},edit:{description:"For comments, notes, and learnings actions, replace the annotation at this 1-based index with supplied replacement text."},delete:{description:"For comments, notes, and learnings actions, delete the annotation at this 1-based index."},stdin:{description:"For comments, notes, and learnings actions, read annotation text from piped stdin (supports multiline markdown)."},file:{description:"CLI-only path to an input file for commands that read payload text; tool actions exclude host file access.",examples:["notes/comment.md"]},preserveSourceIds:{description:"Preserve explicit source IDs during Beads imports instead of normalizing to tracker prefix.",examples:[!0]},appendStable:{description:"When true for files action, preserve existing linked-file order and append new links without full-array resorting."},discover:{description:"When true for files action, use `pm files discover <id>` to scan item text for referenced file paths."},apply:{description:"Persist changes instead of returning a dry-run preview: for files discovery, add the missing discovered file links; for schema add-type --infer, register the inferred custom item types."},discoveryNote:{description:"Note attached to file links added by files discovery.",examples:["discovered from item text"]},addNote:{description:"Note attached to every link added by add/addGlob in this call (per-entry embedded note= wins; requires add or addGlob). Maps to the CLI --note flag on pm files/pm docs.",examples:["command wiring"]},list:{description:"When true, list command-specific entries without mutating state (for example linked paths for files/docs or topics for guide).",examples:[!0]},stream:{description:"Stream selector: test-runs logs accepts stdout|stderr|both; activity accepts boolean/rows|ndjson|jsonl for line-delimited output.",examples:["stderr","stdout","both","rows","ndjson","jsonl",!0]},tail:{description:"Number of lines to tail for background run logs.",examples:[100]},query:{description:"Search query text for search action."},for:{description:"Named context intent projection declared for the selected read action.",examples:["orient","inspect","triage","execute","discover"]},keywords:{description:"Alias for query in search action payloads."},includeLinked:{description:"Include readable linked docs/files/tests content in keyword and hybrid lexical scoring."},titleExact:{description:"For search action, require exact normalized title match for the full query string."},phraseExact:{description:"For search action, require exact normalized query phrase match in item text fields."},highlight:{description:"For search action, emit per-field matched-text snippets (wrapped in \xAB\u2026\xBB) on each hit. Off by default."},includeBody:{description:"When true for list-family actions, include item body text in projected rows."},noTruncate:{description:"When true for list-family actions, return every matched row, overriding any limit (surfaces total when rows were dropped)."},strictRead:{description:"When true for list-family actions, fail if any source item or item directory cannot be read."},compact:{description:"Render compact projection output for search and list-family actions."},raw:{description:"For activity, restore the compact per-event stream instead of the default item digest."},brief:{description:"Emit compact low-token output for commands that support terse projections or health details.",examples:[!0]},full:{description:"Enable command-specific full/detail output mode when supported, such as deep item reads for get or full payload mode for search/history."},includeEmpty:{description:"For stats, restore zero-count registered type and lifecycle-status buckets."},fields:{description:"Comma-separated projection fields for get, search, list-family, or context outputs. Valid field names are command-specific (e.g. score/matched_fields apply to search; context projects focus-row fields such as priority/deadline/completion_pct).",examples:["id,title,status,parent,type","id,title,score,matched_fields","id,title,priority,deadline"]},groupBy:{description:"Comma-separated aggregate grouping fields (supported: parent,type,priority,status,assignee,tags,sprint,release).",examples:["parent,type","type,status","priority,assignee","tags","sprint,release"]},setMode:{description:"Aggregate array dimensions by distinct element (default), or by the complete normalized tuple. Empty sets retain a null group.",examples:["element","tuple"]},count:{description:"Enable grouped count output for aggregate action."},completion:{description:"For aggregate action, add open/in_progress/closed/other counts and completion_pct per group."},sum:{description:"Numeric field to sum per aggregate group (count and null_count are still returned).",examples:["estimated_minutes","priority"]},avg:{description:"Numeric field to average per aggregate group (count and null_count are still returned).",examples:["estimated_minutes","priority"]},tree:{description:"When true for list/get actions, render recursive parent/child tree ordering."},treeDepth:{description:"Maximum recursion depth for tree output (0 keeps root rows only).",examples:[0,1,"2"]},includeUnparented:{description:"Include unparented rows when aggregate grouping includes parent."},maxDepth:{description:"Maximum dependency traversal depth for deps action (0 keeps only the root node).",examples:[0,1,"2"]},nodeLimit:{description:"Maximum related nodes returned by deps --format context.",examples:[10,"20"]},edgeLimit:{description:"Maximum related edges returned by deps --format context.",examples:[20,"40"]},tokenBudget:{description:"Maximum estimated output tokens for the command output.",examples:[600,"1200"]},cursor:{description:"Opaque continuation cursor returned by deps --format context."},direction:{description:'Graph-context traversal direction for deps action ("outgoing", "incoming", or "both").',examples:["both","incoming"]},kind:{description:"Registered relationship kinds narrowing deps --format context traversal (string, comma-separated, or array).",examples:["blocked_by",["parent","related"]]},after:{description:"Opaque action-specific continuation cursor returned by the preceding bounded query.",examples:["pm-x1y2"]},maxPaths:{description:"Maximum enumerated paths for graph paths queries.",examples:[5,"10"]},sample:{description:"Maximum evidence sample entries per graph audit finding.",examples:[10,"25"]},exemptIsolate:{description:"Item ids the graph audit treats as explicitly valid isolates (string, comma-separated, or array).",examples:["pm-x1y2",["pm-x1y2","pm-a3b4"]]},exemptIsolateType:{description:"Item types whose active isolates the graph audit treats as policy-valid (string, comma-separated, or array).",examples:["Reminder",["Reminder","Event"]]},saveBaseline:{description:"When true, persist the graph audit census as the change-since-baseline comparison point (audit only)."},rebuild:{description:"When true, rebuild and warm the durable graph index (graph index only)."},collapse:{description:'Dependency tree collapse mode for deps action ("none" or "repeated").',examples:["none","repeated"]},summary:{description:"When true, return the command's compact summary projection (deps counts, health rollup, or contracts command intents)."},shell:{description:"Shell target for completion generation.",examples:["bash"]},eagerTags:{description:"When true for completion, eagerly embed current tracker tags into generated scripts (legacy mode)."},contractAction:{description:"Filter contracts schema to one tool action.",examples:["create","update"]},command:{description:"Scope contracts output to one CLI command name; action/schema surfaces narrow by default.",examples:["create","search","list"]},schemaOnly:{description:"When true, contracts action returns schema-focused payloads (mutually exclusive with flagsOnly/availabilityOnly)."},flagsOnly:{description:"When true, contracts action returns only command flag surface payloads (mutually exclusive projection mode)."},availabilityOnly:{description:"When true, contracts action returns only action availability payloads (mutually exclusive projection mode)."},runtimeOnly:{description:"When true, contracts action only includes actions invocable in the current runtime."},activeOnly:{description:"Alias for runtimeOnly in contracts action payloads."},depth:{description:"Context depth level controlling how many sections are included (brief=focus+agenda, standard=+hierarchy/activity/progress/workload, deep=all sections, full=every section with no per-section row cap).",examples:["brief","standard","deep","full"]},section:{description:"Repeatable section selector for context; overrides --depth when provided.",examples:[["hierarchy","activity"],["blockers","files","staleness"]]},activityLimit:{description:"Maximum number of recent activity entries to include in context output.",examples:[5,10,"20"]},staleThreshold:{description:"Staleness cutoff in days for context staleness section (e.g. 7 or 7d).",examples:["7","14d","30"]}},fv={health:{strictExit:{description:"Return non-zero for a failing health verdict; also require merge drivers."}},validate:{strictExit:{description:"Return non-zero when validation reports warnings."}},"extension-doctor":{strictExit:{description:"Return non-zero when extension diagnostics report warnings or a non-ok summary."}},"package-doctor":{strictExit:{description:"Return non-zero when package diagnostics report warnings or a non-ok summary."}},history:{strictExit:{description:"Return non-zero for history verification failures when verify is enabled."}},extension:{strictExit:{description:"For doctor operations, return non-zero on warnings or a non-ok diagnostic summary."}},package:{strictExit:{description:"For doctor operations, return non-zero on warnings or a non-ok diagnostic summary."}},assurance:{subcommand:{description:"Assurance operation: list, show, put, remove, run, verdicts, presets, apply, derive, promote, risk, or lineages.",examples:["list","run","risk","lineages"]},kind:{description:"Assurance declaration kind for registry operations: measurement, assertion, or gate.",examples:["measurement","assertion","gate"]},id:{description:"Stable assurance declaration id or gate id, depending on subcommand.",examples:["active-issues","release-readiness"]},limit:{description:"Maximum number of newest assurance verdicts returned.",examples:[10,25]},preset:{description:"Built-in assurance project shape to preview or apply.",examples:["software-delivery","agent-evaluation"]}},update:{acceptanceCriteria:{description:"Complete acceptance-criteria replacement text. Use removeAc plus addAc together for an atomic one-entry repair that preserves unrelated criteria."}},"update-many":{acceptanceCriteria:{description:"Complete acceptance-criteria replacement text. Use removeAc plus addAc together for an atomic one-entry repair that preserves unrelated criteria."}},stats:{since:{description:"Inclusive ISO 8601 timestamp or negative duration lower bound for provenance and fleet analytics.",examples:["2026-08-01T00:00:00.000Z","-30d"]}},events:{since:{description:"Durable event cursor returned as next_cursor, or an inclusive event timestamp.",examples:["eyJmaW5nZXJwcmludCI6Ii4uLiJ9","2026-08-01T00:00:00.000Z"]},type:{description:"Mutation event type filter, supplied once or as a list.",examples:["create",["create","update"]]},author:{description:"Mutation author filter, supplied once or as a list.",examples:["agent-a",["agent-a","agent-b"]]},item:{description:"Tracked item id filter, supplied once or as a list.",examples:["pm-a1b2",["pm-a1b2","pm-c3d4"]]},limit:{description:"Maximum mutation events returned, from 0 through 1000.",examples:[0,100]},cursorMode:{description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event.",examples:["batch","row"]}},remind:{at:{description:"Reminder time as an ISO 8601 timestamp or supported relative expression.",examples:["2026-08-02T09:00:00+02:00","tomorrow 09:00"]}},deps:{tokenBudget:{description:"Maximum estimated output tokens for deps --format context.",examples:[600,"1200"]}},comments:{full:{description:"Return the complete post-mutation comment history instead of the bounded mutation receipt projection."},ifAbsent:{description:"Append a comment only when the resolved author and exact stored text are absent; a duplicate retry returns changed false without writing history."}},notes:{full:{description:"Return the complete post-mutation note history instead of the bounded mutation receipt projection."},ifAbsent:{description:"Append a note only when the resolved author and exact stored text are absent; a duplicate retry returns changed false without writing history."},since:{description:"Inclusive ISO 8601 creation timestamp lower bound for structured note event filtering.",examples:["2026-01-01T00:00:00.000Z"]}},learnings:{full:{description:"Return the complete post-mutation learning history instead of the bounded mutation receipt projection."},ifAbsent:{description:"Append a learning only when the resolved author and exact stored text are absent; a duplicate retry returns changed false without writing history."}},next:{tag:{description:"Only recommend items carrying this exact tag.",examples:["sdk","release"]},tokenBudget:{description:"Maximum estimated output tokens for the recommendation context.",examples:[600,"1200"]}},claim:{tag:{description:"When claiming the next item, only consider work carrying this exact tag.",examples:["sdk","release"]},tokenBudget:{description:"Maximum estimated output tokens for the next-item context returned with the claim.",examples:[600,"1200"]}},close:{text:{description:"Backward-compatible alias for the item close reason when reason is not provided."}},"close-task":{text:{description:"Close reason used before releasing the item's active assignment."}},schema:{definition:{description:"Workflow policy declaration for policy-put, or proposed item fields for policy-check."},policy:{description:"Declared approval rule id for policy-approve."},name:{description:"Custom item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse.",examples:["Spike","review","component"]}},profile:{name:{description:"Profile name for show/apply/lint. Built-in profiles are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too.",examples:["agile","ops","research"]}},graph:{subcommand:{description:"Graph query selector: ancestors|descendants|predecessors|successors|paths|impact|analyze|audit|communities|redundancy|dominators|slack|centrality|articulation|plan|index. Traversals, paths, impact, and dominators require id; paths also requires target; slack reports critical-path float, centrality ranks betweenness/closeness/degree, articulation reports cut points and bridges; plan derives dry-run remediation proposals from the governance audit; index reports, rebuilds, or clears the durable cross-process graph index.",examples:["successors","audit"]},clear:{description:"When true, delete the durable graph index (graph index only)."},id:{description:"Root item id for traversal, paths, impact, and dominators graph queries.",examples:["pm-x1y2"]},target:{description:"Target item id for graph paths queries.",examples:["pm-a3b4"]},direction:{description:'Edge orientation for graph paths/impact/dominators queries ("outgoing", "incoming", or "both"; default "both").',examples:["incoming"]},kind:{description:"Registered relationship kinds narrowing the graph query (string, comma-separated, or array).",examples:["blocked_by",["parent","related"]]},maxDepth:{description:"Maximum graph traversal depth (non-negative integer).",examples:[2,"4"]},after:{description:"Resume a hierarchy/ordering graph traversal after this previously returned node id.",examples:["pm-x1y2"]},limit:{description:"Maximum returned rows per bounded graph collection (traversal ids, impact rows, analyze/communities samples, redundancy rows, dominator bottlenecks).",examples:[10,"25"]},summary:{description:"When true, return counts-first graph envelopes without row collections."}}};(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]="415b46ad-d836-5593-8b6d-af08bbaba0c2")}catch{}})();var k$={...dv,"history-attest":{verify:{type:"object",additionalProperties:!0},output:{not:{}}}},Va={...Af,pause:{type:"boolean"},releaseAssignment:{type:"boolean"},hashAlgorithm:{type:"string",enum:["sha256","sha512"]}},Ya={...uv,pause:{description:"Return work to its configured open status before releasing ownership."},releaseAssignment:{description:"Release assignment after recording closure evidence."},hashAlgorithm:{description:"Digest for detached history bundles; defaults to sha256."}},E$=["json","quiet","profile","noExtensions","noPager","tokenAccounting","path","pmExecutable","timeoutMs"],S$=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor","outputRowContract"],T$=new Set(["action","cwd","options",...Object.keys(Va).filter(e=>e!=="severity")]);var A$={create:["fullChangedFields","idOnly"],copy:["fullChangedFields","idOnly"],update:["fullChangedFields","idOnly"],"item-reopen":["fullChangedFields","idOnly"],close:["fullChangedFields","idOnly"],claim:["fullChangedFields","idOnly"],release:["fullChangedFields","idOnly"],"start-task":["fullChangedFields","idOnly"],"pause-task":["fullChangedFields","idOnly"],"close-task":["fullChangedFields","idOnly"],restore:["fullChangedFields","idOnly"],append:["fullChangedFields"],"update-many":["fullChangedFields"],"close-many":["fullChangedFields"],assurance:["fullChangedFields","idOnly"]},wv=["createMode","status","deadline","estimate","acceptanceCriteria","definitionOfReady","order","rank","goal","objective","value","impact","outcome","whyNow","assignee","reviewer","risk","confidence","sprint","release","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact","comment","note","learning","reminder","event","typeOption"],mne=Object.freeze({"close-many":["list","expected_result","expected","actual_result","actual","validate_close","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],"update-many":["list","update","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],...Object.fromEntries(kn.filter(e=>e==="upgrade"||e==="install"||e==="extension"||e==="package"||e.startsWith("extension-")||e.startsWith("package-")).map(e=>[e,["project","local","global"]]))});function it(e){return _f(e)}var I$=it([...af.map(e=>e.param),...qa.map(e=>e.param),"assignee","closeReason","completedAt"]),bv=it([...cf.map(e=>e.param),...qa.map(e=>e.param),"force"]),C$=it([...df.map(e=>e.param),...bv.filter(e=>e!=="allowMissingParent"&&e!=="completedAt"),"dryRun","rollback","noCheckpoint"]),O$=it([...uf.map(e=>e.param),"reason","completedAt","resolution","expectedResult","actualResult","validateClose","dryRun","rollback","noCheckpoint","author","message","force"]),mv=it([...mf.map(e=>e.param),"past","section"]),x$=it([...ff.map(e=>e.param),"stream"]),Of=it([...rf.map(e=>e.param),"all","includeBody","noTruncate","strictRead","compact","brief","full"]),oo=Of.filter(e=>e!=="all"&&e!=="status"),Dn=[[{property:"today",schema:{const:!0}},{property:"recent",schema:{const:!0}}],[{property:"today",schema:{const:!0}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}],[{property:"recent",schema:{const:!0}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}]],R$=[[{property:"summary",schema:{const:!0}},{property:"schemaOnly",schema:{const:!0}}],[{property:"summary",schema:{const:!0}},{property:"flagsOnly",schema:{const:!0}}],[{property:"summary",schema:{const:!0}},{property:"availabilityOnly",schema:{const:!0}}],[{property:"schemaOnly",schema:{const:!0}},{property:"flagsOnly",schema:{const:!0}}],[{property:"schemaOnly",schema:{const:!0}},{property:"availabilityOnly",schema:{const:!0}}],[{property:"flagsOnly",schema:{const:!0}},{property:"availabilityOnly",schema:{const:!0}}]],N$=it([...of.map(e=>e.param),"count","completion","includeUnparented"]),D$=it(["query","keywords","mode","semantic","hybrid","includeLinked","titleExact","phraseExact","highlight","compact","full",...sf.map(e=>e.param)]),pv=it(["type","tag","priority","assignee","assigneeFilter","sprint","release","parent","limit","blockedLimit","readyOnly","format","includeDecisions","includeGates","includeContainers","tokenBudget","explainRanking"]),Je=["author","message","force"],vv=["releaseAssignment","text","reason","closeReason","completedAt","duplicateOf","validateClose","resolution","expectedResult","actualResult"],Ri=["author","assignee","message","force"],P$=["dryRun","target","scope","capability","declarative","github","ref","init","install","uninstall","explore","manage","describe","markdown","output","reload","doctor","catalog","list","adopt","adoptAll","activate","deactivate","runtimeProbe","fixManagedState","isolated","ignoreGlobal","detail","trace","watch","strictExit","failOnWarn"];function _v(e){return{[`${e}-init`]:{required:["target"],optional:["scope","capability",...e==="package"?["declarative"]:[]]},[`${e}-install`]:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},[`${e}-uninstall`]:{required:["target"],optional:["scope"]},[`${e}-explore`]:{optional:["scope"]},[`${e}-manage`]:{optional:["scope","runtimeProbe","fixManagedState"]},[`${e}-describe`]:{optional:["target","scope","markdown","output"]},[`${e}-reload`]:{optional:["scope","watch"]},[`${e}-doctor`]:{optional:["scope","detail","trace","fixManagedState","isolated","ignoreGlobal","strictExit","failOnWarn"]},[`${e}-catalog`]:{optional:["scope","fields"]},[`${e}-adopt`]:{required:["target"],optional:["scope","github","ref"]},[`${e}-adopt-all`]:{optional:["scope"]},[`${e}-activate`]:{required:["target"],optional:["scope"]},[`${e}-deactivate`]:{required:["target"],optional:["scope"]},[e]:{optional:P$,dependentAnyOfRequired:[{property:"dryRun",value:!0,anyOfRequired:[["install","target"],["install","github"]]}],mutuallyExclusiveWhen:[[{property:"dryRun",schema:{const:!0}},{property:"install",schema:{const:!1}}]]}}}var gv={required:["title"],optional:["start","duration","end","location","timezone","allDay","parent","allowMissingParent","tags","priority","body","description","author","message"]},hv={optional:["target","scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"]},Ka={init:{optional:["prefix","idPrefix","workspace","preset","typePreset","defaults","author","agentGuidance","withPackages","mergeFence","force","verbose"]},config:{required:["scope","configAction"],optional:["key","value","criterion","clearCriteria","format","policy"]},..._v("extension"),..._v("package"),"package-upgrade":hv,install:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},upgrade:hv,create:{required:["title","description","type","status","priority","message"],optional:I$},copy:{required:["id"],optional:["title","author","message","allowDuplicate"]},focus:{optional:["id","clear"],mutuallyExclusive:[["id","clear"]]},list:{optional:Of,mutuallyExclusiveWhen:Dn},"list-all":{optional:Of,mutuallyExclusiveWhen:Dn},"list-draft":{optional:oo,mutuallyExclusiveWhen:Dn},"list-open":{optional:oo,mutuallyExclusiveWhen:Dn},"list-in-progress":{optional:oo,mutuallyExclusiveWhen:Dn},"list-blocked":{optional:oo,mutuallyExclusiveWhen:Dn},"list-closed":{optional:oo,mutuallyExclusiveWhen:Dn},"list-canceled":{optional:oo,mutuallyExclusiveWhen:Dn},aggregate:{optional:N$},guide:{optional:["list","format","depth"]},context:{optional:mv},ctx:{optional:mv},get:{required:["id"],optional:["for","tokenBudget","at","depth","full","fields","tree","treeDepth","format"]},search:{optional:D$,anyOfRequired:[["query"],["keywords"]]},eval:{optional:["mode","k","failUnder","queries","format"]},events:{optional:["since","type","author","item","limit","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","cursorMode"]},merge:{required:["subcommand"],optional:["dryRun","author","message","force","includeReconciled","artifact","basePath","oursPath","theirsPath","output","outputPath","itemPath","prefer"]},workspace:{required:["subcommand"],optional:["snapshotAction","name","target","dryRun","force","author","message","lockTtlSeconds","lockWaitMs"],conditionalRequired:[{property:"subcommand",value:"snapshot",required:["snapshotAction"]}]},meet:gv,event:gv,remind:{required:["title"],optional:["at","text","parent","allowMissingParent","tags","priority","body","description","author","message"]},next:{optional:[...pv,"for"]},reindex:{optional:["mode","progress"]},history:{required:["id"],optional:["limit","compact","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","diff","verify","field","strictExit","failOnWarn","format"]},"history-attest":{optional:["verify","output","hashAlgorithm"],mutuallyExclusive:[["verify","hashAlgorithm"]]},"history-redact":{required:["id"],optional:["literal","regex","replacement","dryRun",...Je],anyOfRequired:[["literal"],["regex"]]},"history-repair":{optional:["id","all","dryRun","normalizeProvenance","salvageTail",...Je],oneOfRequired:[["id"],["all"]],mutuallyExclusiveWhen:[[{property:"salvageTail",schema:{const:!0}},{property:"all",schema:{const:!0}}],[{property:"salvageTail",schema:{const:!0}},{property:"normalizeProvenance",schema:{const:!0}}]]},"history-author-acknowledge":{optional:["historyEvent","allActionable","dryRun","planFingerprint","limit","attributedAuthor","reviewer","reason"],oneOfRequired:[["historyEvent"],["allActionable"]]},"history-compact":{optional:["id","before","ids","allOver","closed","allStreams","minEntries","dryRun",...Je]},schema:{mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"policy-mode"}},{property:"name",schema:{not:{enum:["advise","refuse"]}}}]],required:["subcommand"],optional:["definition","policy","message","name","description","defaultStatus","folder","alias","role","order","fieldType","commands","cliFlag","required","requiredOnCreate","allowUnset","requiredTypes","typePreset","infer","minCount","apply","to","migrationId","fieldTypeScope","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"policy-put",required:["definition"]},{property:"subcommand",value:"policy-remove",required:["name"]},{property:"subcommand",value:"policy-mode",required:["name"]},{property:"subcommand",value:"policy-check",required:["name"]},{property:"subcommand",value:"policy-approve",required:["name","policy"]},{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"show-status",required:["name"]},{property:"subcommand",value:"add-type",required:["name"]},{property:"subcommand",value:"remove-type",required:["name"]},{property:"subcommand",value:"add-status",required:["name"]},{property:"subcommand",value:"remove-status",required:["name"]},{property:"subcommand",value:"add-field",required:["name"]},{property:"subcommand",value:"remove-field",required:["name"]},{property:"subcommand",value:"show-field",required:["name"]},{property:"subcommand",value:"rename-type",required:["name","to"]},{property:"subcommand",value:"rename-field",required:["name","to"]},{property:"subcommand",value:"remap-status",required:["name","to"]},{property:"subcommand",value:"apply-preset",required:["typePreset"]}]},profile:{required:["subcommand"],optional:["name","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"apply",required:["name"]},{property:"subcommand",value:"lint",required:["name"]}]},plan:{required:["subcommand"],optional:["id","stepRef","reorderTo","title","description","template","scope","parent","related","blocks","blockedBy","harness","mode","resumeContext","tags","priority",...wv,"body","claim","fromSearch","stepTitle","step","stepBody","stepOwner","stepStatus","stepEvidence","stepBlockedReason","stepReplacement","dependsOn","link","linkKind","linkNote","promoteToItemDep","allowMultipleActive","file","test","doc","decisionText","decision","decisionRationale","decisionEvidence","discoveryText","discovery","validationText","validation","validationCommand","validationExpected","depth","fields","steps","materializeType","materializeParent","materializeTags","field",...Je]},activity:{optional:x$},restore:{required:["id","target"],optional:Je},update:{required:["id"],optional:bv,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},"update-many":{optional:C$,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},close:{required:["id"],optional:[...vv,...Je]},"close-many":{optional:O$},delete:{required:["id"],optional:["dryRun",...Je]},append:{required:["id","body"],optional:Je},comments:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...Je],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},notes:{required:["id"],optional:["text","add","addJson","stdin","edit","delete","limit","since","eventType","includeMeta","full","ifAbsent",...Je],mutuallyExclusive:[["addJson","add"],["addJson","stdin"],["addJson","file"],["addJson","edit"],["addJson","delete"],["edit","ifAbsent"],["delete","ifAbsent"]]},learnings:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...Je],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},files:{required:[],optional:["id","add","addGlob","remove","migrate","list","addNote","discover","apply","discoveryNote","appendStable","validatePaths","lookupPath","scope","limit","offset","noTruncate","strictRead","explain","lines","decisionDepth",...Je],anyOfRequired:[["id"],["lookupPath"]],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},docs:{required:["id"],optional:["add","addGlob","remove","migrate","addNote","list","validatePaths",...Je],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},deps:{required:["id"],optional:["format","maxDepth","collapse","summary","full","nodeLimit","edgeLimit","tokenBudget","cursor","direction","kind"]},graph:{required:["subcommand"],optional:["id","target","kind","maxDepth","limit","after","direction","maxPaths","sample","exemptIsolate","exemptIsolateType","saveBaseline","rebuild","clear","summary","full"]},test:{required:["id"],optional:["list","add","addJson","remove","removeIndex","run","match","onlyIndex","onlyLast","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","acknowledgeLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext","measure","metricBelow","metricDiff",...Je],mutuallyExclusive:[["acknowledgeLinkedTests","run"],["acknowledgeLinkedTests","background"]]},"test-all":{optional:["status","limit","offset","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext"]},telemetry:{optional:["subcommand","limit"]},"test-runs-list":{optional:["status","limit"]},"test-runs-status":{required:["runId"]},"test-runs-logs":{required:["runId"],optional:["stream","tail"]},"test-runs-stop":{required:["runId"],optional:["force"]},"test-runs-resume":{required:["runId"],optional:["author"]},stats:{optional:["includeEmpty","storage","metadataCoverage","fieldUtilization","byAssignee","byTag","byPriority","tagPrefix","measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]},duplicates:{optional:["status","since","threshold","limit","exhaustive"]},health:{optional:["strictDirectories","requireMergeDrivers","strictExit","failOnWarn","checkOnly","checkTelemetry","noRefresh","refreshVectors","verboseStaleItems","verboseAuthorEvents","brief","summary","skipVectors","skipIntegrity","skipDrift","full"]},validate:{optional:["checkCompleteness","checkStorageIntegrity","checkMetadata","metadataProfile","checkResolution","checkLifecycle","checkStaleBlockers","dependencyCycleSeverity","parentCycleSeverity","checkFiles","scanMode","includePmInternals","verboseFileLists","verboseDiagnostics","allAffectedIds","strictExit","failOnWarn","fixHints","autoFix","dryRun","fixScope","pruneMissing","checkHistoryDrift","checkCommandReferences","counts","full"]},assurance:{required:["subcommand"],optional:["kind","id","definition","trigger","treeId","gate","limit","dryRun","author","message","preset","owner","apply","enforcement"],conditionalRequired:[{property:"subcommand",value:"list",required:["kind"]},{property:"subcommand",value:"show",required:["kind","id"]},{property:"subcommand",value:"put",required:["kind","id","definition"]},{property:"subcommand",value:"remove",required:["kind","id"]},{property:"subcommand",value:"run",required:["id","trigger"]},{property:"subcommand",value:"apply",required:["preset","owner"]},{property:"subcommand",value:"derive",required:["owner"]},{property:"subcommand",value:"risk",required:["definition"]},{property:"subcommand",value:"lineages",required:["definition"]},{property:"subcommand",value:"promote",required:["id","enforcement"]}],mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"risk"}},{property:"definition",schema:{not:{required:["policy","change"]}}}],[{property:"subcommand",schema:{const:"lineages"}},{property:"definition",schema:{anyOf:[{required:["change"]},{not:{required:["policy"]}}]}}]]},gc:{optional:["dryRun","gcScope"]},contracts:{optional:["contractAction","command","summary","schemaOnly","flagsOnly","availabilityOnly","runtimeOnly","activeOnly","full"],mutuallyExclusiveWhen:R$},completion:{required:["shell"],optional:["eagerTags"]},claim:{optional:["start","id","next","ifAvailable","maxAttempts","includeDecisions",...pv,...Ri],oneOfRequired:[["id"],["next"]],mutuallyExclusiveWhen:[[{property:"start",schema:{const:!0}},{property:"next",schema:{const:!0}}],[{property:"start",schema:{const:!0}},{property:"ifAvailable",schema:{const:!0}}]]},release:{required:["id"],optional:["pause",...Ri]},"start-task":{required:["id"],optional:Ri},"pause-task":{required:["id"],optional:Ri},"close-task":{required:["id"],optional:["text","validateClose",...Ri]},"item-reopen":{required:["id","reason"],optional:["status","author","message","force"]}},L$=Object.freeze(Object.fromEntries(kn.map(e=>[e,Ka[e]])));function kv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").trim().replace(/^./,t=>t.toUpperCase()).concat(".")}function M$(e,t){let n=typeof t=="object"&&t!==null?{...t}:{},r=Ya[e];return{...n,description:r?.description??kv(e),...r?.examples?{examples:r.examples}:{}}}function $$(e,t){if(e==="history-attest"&&t==="verify")return{description:"Compare all retained history streams with a detached JSON proof object. Server-local proof paths are not accepted over MCP."};if(e==="history-attest"&&t==="output")return{description:"Local CLI/SDK only. MCP rejects this field; save the returned JSON bundle on the client."};if(e==="claim"&&t==="start")return{description:"Claim an explicit item and move it to its configured in-progress status."};if((e==="list"||e.startsWith("list-"))&&t==="all")return{description:"Return items from every lifecycle status instead of the default active-status set."};if(e==="plan"&&Object.prototype.hasOwnProperty.call(Cf,t))return Cf[t];let n=fv[e];return n&&Object.prototype.hasOwnProperty.call(n,t)?n[t]:Ya[t]}function F$(e,t,n){let r=typeof n=="object"&&n!==null?{...n}:{},o=$$(e,t);return{...r,description:o?.description??kv(t),...o?.examples?{examples:o.examples}:{}}}function j$(e,t){if(e==="claim"&&t==="start")return{type:"boolean"};let n=k$[e];return n&&Object.prototype.hasOwnProperty.call(n,t)?n[t]:e==="plan"&&Object.prototype.hasOwnProperty.call(If,t)?If[t]:(e==="get"||e==="history"||e==="search")&&t==="format"?{type:"string",enum:["json","toon"]}:t==="pause"||t==="releaseAssignment"||t==="hashAlgorithm"?Va[t]:Af[t]}function U$(e,t){let n={action:{const:e,description:Ya.action?.description??"Tool action to execute."}};for(let r of t){if(r==="action")continue;let o=j$(e,r);o&&(n[r]=F$(e,r,o))}return n}function z$(e,t){let n=t.flat();return t.map(r=>{let o=n.filter(i=>!r.includes(i));return{required:[...r],...o.length>0?{not:{anyOf:o.map(i=>({required:[i]}))}}:{},...e==="history-repair"&&r.includes("all")?{properties:{all:{const:!0}}}:e==="claim"&&r.includes("next")?{properties:{next:{const:!0}}}:{}}})}function yv(e,t){return{...t===void 0?{}:{properties:{[e]:{const:t}}},required:[e]}}function H$(e){let t=[];if(e.conditionalRequired&&e.conditionalRequired.length>0)for(let n of e.conditionalRequired)t.push({if:yv(n.property,n.value),then:{required:n.required}});if(e.dependentAnyOfRequired&&e.dependentAnyOfRequired.length>0)for(let n of e.dependentAnyOfRequired)t.push({if:yv(n.property,n.value),then:{anyOf:n.anyOfRequired.map(r=>({required:[...r]}))}});if(e.mutuallyExclusive&&e.mutuallyExclusive.length>0)for(let n of e.mutuallyExclusive)t.push({not:{required:it(n)}});if(e.mutuallyExclusiveWhen&&e.mutuallyExclusiveWhen.length>0)for(let n of e.mutuallyExclusiveWhen)t.push({not:{allOf:n.map(r=>({properties:{[r.property]:r.schema},required:[r.property]}))}});return t}function Ev(e){if(!Object.prototype.hasOwnProperty.call(Ka,e))return;let t=Ka[e],n=A$[e]??[];return it(["action",...E$,...Uo(e)!==void 0?S$:[],...n,...t.required??[],...t.optional??[]])}function q$(e){let t=Ka[e],n=it(t.required??[]),r=Ev(e),o={type:"object",additionalProperties:!1,required:["action",...n],title:`pm action "${e}" parameters`,properties:U$(e,r)};t.anyOfRequired&&t.anyOfRequired.length>0&&(o.anyOf=t.anyOfRequired.map(s=>({required:[...s]}))),t.oneOfRequired&&t.oneOfRequired.length>0&&(o.oneOf=z$(e,t.oneOfRequired));let i=H$(t);return i.length>0&&(o.allOf=i),o}function Sv(e){let t,n=()=>t??=e();return new Proxy({},{get:(r,o)=>n()[o],has:(r,o)=>o in n(),ownKeys:()=>Reflect.ownKeys(n()),getOwnPropertyDescriptor:(r,o)=>{let i=Reflect.getOwnPropertyDescriptor(n(),o);return i&&(i.configurable=!0),i}})}var xf="4.20.0",Tv=xf.split(".")[0],Av="1.9.0",B$=Sv(()=>({$schema:"https://json-schema.org/draft/2020-12/schema",$id:`https://schema.unbrained.dev/pm-cli/tool-parameters-v${Tv}.schema.json`,title:"pm-cli tool parameters (action-scoped strict schema)","x-schema-version":xf,type:"object",oneOf:kn.map(e=>q$(e))}));function G$(e,t){let n=M$(e,t);if(typeof n.type=="string")return n;let o=(Array.isArray(n.anyOf)?n.anyOf:[]).find(a=>typeof a.type=="string");if(o){let{anyOf:a,...c}=n;return{...o,...c}}let{anyOf:i,...s}=n;return{...s,type:"string"}}function W$(){let e={action:{type:"string",description:Ya.action?.description??"Tool action to execute."},options:{type:"object",additionalProperties:!0,description:"Advanced command options object forwarded to the selected pm action."}};for(let t of Object.keys(Va).sort())e[t]=G$(t,Va[t]);return{title:"pm-cli tool parameters (provider-compatible flat schema)","x-schema-version":Av,type:"object",additionalProperties:!1,required:["action"],properties:e}}var V$=Sv(W$);(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]="48efaa37-f28e-5f2a-a033-456bee15e294")}catch{}})();var wne=new Set([...Tg,...Ag]);(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]="92c17dbe-3868-5fa5-a873-0744d3e7ca8e")}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]="7ffd5046-9154-52e7-94ce-192b07b8ceae")}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]="fb87ff0c-88c8-52f9-9dc3-f37fec674425")}catch{}})();var rF=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),Are=new Set([...rF].filter(e=>e!=="file"));(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]="fd8c4c35-98bb-5f3b-927d-8696125af703")}catch{}})();var oF="2026-07-15T06:22:12.276Z",iF=Date.parse(oF),sF=[["attributed","attributed"],["legacy_unknown","actionable_unknown"]],Cv=e=>typeof e=="string"?e:"",aF=e=>{let t=e??{},n=Cv(t.author).trim().toLowerCase(),r=Number(["","unknown"].includes(n)),o=+(Date.parse(Cv(t.ts))>=iF);return sF[r][o]};function cF(e,t,n=20,r=new Set,o=!1){let i=[],s=[],a={legacy_unknown:0,actionable_unknown:0},c=Math.max(0,n),l=0,d=0,u=0;for(let[f,m]of t.split(/\r?\n/).entries()){let p;try{p=JSON.parse(m)}catch{continue}l+=1;let w=aF(p);if(w!=="attributed"){if(d+=1,w==="actionable_unknown"&&r.has(`${e}:${f+1}`)){u+=1;continue}a[w]+=1,o&&w==="actionable_unknown"&&s.push({item_id:e,line:f+1}),i.length<c&&i.push({item_id:e,line:f+1})}}return{checked_events:l,unknown_event_count:d,legacy_unknown_event_count:a.legacy_unknown,actionable_unknown_event_count:a.actionable_unknown,acknowledged_actionable_event_count:u,samples:i,samples_truncated:a.legacy_unknown+a.actionable_unknown>i.length,actionable_events:s}}function lF(e){let t=new Set;for(let n of e.split(/\r?\n/)){let r;try{r=JSON.parse(n)}catch{continue}let i=(typeof r=="object"&&r!==null&&typeof r.context=="object"&&r.context!==null?r.context:{}).author_acknowledgment;if(!(typeof i!="object"||i===null||!Array.isArray(i.events)))for(let s of i.events)typeof s=="object"&&s!==null&&typeof s.item_id=="string"&&Number.isSafeInteger(s.line)&&t.add(`${s.item_id}:${String(s.line)}`)}return t}var Ja=async(e,t=20,n=!1)=>{let r=Nf.join(e,"history"),o;try{o=(await Rf.readdir(r)).filter(b=>b.endsWith(".jsonl")).sort((b,v)=>b.localeCompare(v))}catch{o=[]}let i=new Set,s=[],a=[],c=0,l=0,d=0,u=0,f=0,m=0,p="_workspace.jsonl",w=new Set;if(o.includes(p))try{w=lF(await Rf.readFile(Nf.join(r,p),"utf8"))}catch{w=new Set}for(let b of o){let v;try{v=await Rf.readFile(Nf.join(r,b),"utf8")}catch{continue}let I=b.slice(0,-6),A=cF(I,v,t-s.length,w,n);c+=1,l+=A.checked_events,d+=A.unknown_event_count,u+=A.legacy_unknown_event_count,f+=A.actionable_unknown_event_count,m+=A.acknowledged_actionable_event_count,A.unknown_event_count>0&&i.add(I),s.push(...A.samples),n&&a.push(...A.actionable_events)}let y=u+f;return{checked_streams:c,checked_events:l,unknown_event_count:d,legacy_unknown_event_count:u,actionable_unknown_event_count:f,acknowledged_actionable_event_count:m,affected_item_ids:[...i].sort((b,v)=>b.localeCompare(v)),samples:s,samples_truncated:y>s.length,...n?{actionable_events:a}:{}}};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f7999053-cf48-5588-b8c8-570789086dac")}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]="e3a1e65b-55d7-5206-b3e7-cac3ac29745c")}catch{}})();var Gre=new Set(kr),dF=new Set(po.map(e=>ve(e.id)).filter(e=>e.length>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]="f9535c02-9214-5d5e-bac0-2dabbe5d395e")}catch{}})();var Xre=new Set(dn),Zre=new Set(Er),Qre=new Set([...Ge.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]);(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]="ebcb45a2-996a-5194-8086-efe882dbcacc")}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]="96cec314-edb6-5c51-abc4-d028bdc4f10c")}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]="0daf7c89-abc5-5c35-ba3f-9772a50408c0")}catch{}})();var Ni={type:"string",minLength:1,maxLength:128,pattern:"\\S"},Xa={type:"array",minItems:1,maxItems:$r,items:Ni},Ov={...Xa,items:{...Ni,pattern:"^(?!(?:.*\\.)?(?:__proto__|constructor|prototype)(?:\\.|$))[a-zA-Z_][a-zA-Z0-9_]*(?:\\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$"}},aoe={type:"object",additionalProperties:!1,required:["id","rule"],properties:{id:{type:"string",minLength:1,maxLength:128,pattern:"^[a-zA-Z0-9][a-zA-Z0-9._-]*$"},description:{type:"string",minLength:1,maxLength:500,pattern:"\\S"},effect:{enum:["advise","warn","refuse"]},subject:{type:"object",additionalProperties:!1,properties:{...Object.fromEntries(["types","tags","statuses","operations","parents"].map(e=>[e,Xa])),dependency:{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:Ni,id:Ni}}}},rule:{oneOf:[{type:"object",additionalProperties:!1,required:["kind","fields"],properties:{kind:{const:"require_fields"},fields:Ov}},{type:"object",additionalProperties:!1,required:["kind","authors"],properties:{kind:{const:"authors"},authors:Xa}},...["field_writers","approval"].map(e=>({type:"object",additionalProperties:!1,required:["kind","fields","authors"],properties:{kind:{const:e},fields:Ov,authors:Xa}})),{type:"object",additionalProperties:!1,required:["kind","allowed"],properties:{kind:{const:"transition"},allowed:{type:"array",maxItems:$r,items:{type:"array",minItems:2,maxItems:2,items:Ni}}}}]}}};(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]="42dee0a5-d003-5e44-8b2d-d74a23d3f2ce")}catch{}})();async function xv(e,t,n,r){let o=await si(e).catch(()=>null);return o===null?{check:{name:"completeness",status:"error",ok:!1,details:{policy_registry_readable:!1,policy_registry_path:"schema/policies.json",remediation_hint:"Repair schema/policies.json, then rerun pm validate."}},warnings:["validate_completeness_policy_registry_unreadable"]}:Rv(o,t,n,r)}function fF(e,t,n){return e===0?"undeclared":t===0?"empty":n===0?"inapplicable":n===t?"covered":"partial"}function Rv(e,t,n=5,r=!1){let o=[],i=new Map,s=e.policies.filter(y=>y.rule.kind==="require_fields"),a=s.filter(y=>y.subject?.operations===void 0),c=new Set,l=0,d=0,u=0,f=0,m=0,p=cg(e);for(let y of t){let b=p({operation:"",author:"",before:y,after:y,completeness_only:!0});l+=+(b.decisions.length>0),d+=b.decisions.length,b.decisions.forEach(A=>c.add(A.policy_id));let v=b.decisions.filter(A=>!A.satisfied);if(v.length===0)continue;f+=1;let I=i.get(y.type)??{items:0,violations:0,missing_fields:0};I.items+=1;for(let A of v)u+=1,I.violations+=1,I.missing_fields+=A.missing_fields.length,A.effect==="refuse"&&(m+=1),o.length<n&&o.push({id:y.id,type:y.type,status:y.status,decision:A});i.set(y.type,I)}let w=r||m>0?"error":u>0?"warn":"ok";return{check:{name:"completeness",status:w,ok:w==="ok",details:{scope:"operation_independent_require_fields",declared_requirement_count:s.length,state_requirement_count:a.length,applicable_requirement_count:c.size,requirement_application_count:d,governed_items:l,ungoverned_items:t.length-l,contract_status:fF(s.length,t.length,l),applied_policy_ids:[...c].sort().slice(0,Math.max(0,n)),applied_policy_ids_truncated:c.size>Math.max(0,n),checked_items:t.length,incomplete_items:f,violation_count:u,refused_violations:m,missing_by_type:Object.fromEntries(i),violations:o,violations_truncated:o.length<u,enforcement:e.enforcement}},warnings:[...u>0?[`validate_completeness_missing_fields:${u}`]:[],...r?["validate_completeness_source_incomplete"]:[]]}}(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]="f54fe358-8f4c-5bf4-ae2a-9c92cd08c953")}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]="e524f0ad-faad-5d89-b8f5-1283979919ad")}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]="4d7f490a-03a3-512c-ba3c-b19fcc9a1270")}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]="9052af10-ff8c-55db-8a35-b45e1e23a901")}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]="1805dfab-5dc5-5be4-ad32-cbd8b3e37f8c")}catch{}})();var Wie=[...Js,"add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset","list","show","show-status","rename-type","rename-field","remap-status"];(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="decec6f3-3795-5353-bf48-75aa61dd79d4")}catch{}})();function Df(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}import vF from"node:fs/promises";import kF 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]="33b7f318-cc64-55d6-8b57-19a618efe6c0")}catch{}})();var EF=".managed-extensions.json",Pf=1;function Lf(e){return kF.join(e,EF)}function SF(){return{version:Pf,updated_at:$(),entries:[]}}function Dv(e){return[...e].sort((t,n)=>{let r=t.scope.localeCompare(n.scope);if(r!==0)return r;let o=t.name.localeCompare(n.name);return o!==0?o:t.directory.localeCompare(n.directory)})}function st(e){return typeof e=="string"?e:void 0}function TF(e){return typeof e.name=="string"&&e.name.trim().length>0&&typeof e.directory=="string"&&e.directory.trim().length>0&&(e.scope==="project"||e.scope==="global")&&typeof e.manifest_version=="string"&&typeof e.manifest_entry=="string"&&Array.isArray(e.capabilities)&&e.capabilities.every(t=>typeof t=="string")&&typeof e.installed_at=="string"&&typeof e.updated_at=="string"}function AF(e){if(typeof e!="object"||e===null)return null;let t=e;return t.kind!=="local"&&t.kind!=="github"&&t.kind!=="npm"&&t.kind!=="builtin"||typeof t.input!="string"||typeof t.location!="string"?null:{kind:t.kind,input:t.input,location:t.location,name:st(t.name),package:st(t.package),version:st(t.version),repository:st(t.repository),owner:st(t.owner),repo:st(t.repo),ref:st(t.ref),subpath:st(t.subpath),commit:st(t.commit)}}function IF(e){if(typeof e!="object"||e===null)return null;let t=e;if(!TF(t))return null;let n=AF(t.source);if(!n)return null;let r=Dr(t.contributions);return r===null?null:{name:t.name.trim(),directory:t.directory.trim(),scope:t.scope,manifest_version:t.manifest_version,manifest_entry:t.manifest_entry,capabilities:Df(t.capabilities),contributions:r,installed_at:t.installed_at,updated_at:t.updated_at,source:n,last_update_check_at:st(t.last_update_check_at),last_update_remote_commit:st(t.last_update_remote_commit),update_available:typeof t.update_available=="boolean"||t.update_available===null?t.update_available:void 0,update_error:st(t.update_error)}}function CF(e){if(typeof e!="object"||e===null)return null;let t=e;if(t.version!==Pf||!Array.isArray(t.entries))return null;let n=[];for(let r of t.entries){let o=IF(r);o&&n.push(o)}return{version:Pf,updated_at:st(t.updated_at)??$(),entries:Dv(n)}}async function Pi(e){let t=Lf(e),n=SF();try{let r=await vF.readFile(t,"utf8"),o=JSON.parse(r),i=CF(o);if(!i)throw new g(`Managed extension state file "${t}" has an invalid schema. Repair or remove it before mutating extension state.`,_.GENERIC_FAILURE);return{path:t,state:i,warnings:[]}}catch(r){if(r instanceof g)throw r;if(typeof r=="object"&&r!==null&&"code"in r&&L(r))return{path:t,state:n,warnings:[]};throw new g(`Managed extension state file "${t}" could not be read. Repair or remove it before mutating extension state.`,_.GENERIC_FAILURE)}}import{execFile as NF}from"node:child_process";import{promisify as DF}from"node:util";import Pse from"npm-package-arg";import{extract as Mse,list as $se}from"tar";(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]="8269d712-f438-5f18-8137-ed9a0358e23b")}catch{}})();var gse=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});(function(){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]="96c5708d-1f4d-5f94-9945-7f8baa337106")}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]="68a37ea1-3571-59ab-b72c-0195efa84e3c")}catch{}})();var Gse=DF(NF);var Wse={maxArchiveBytes:64*1024*1024,maxEntries:4096,maxExpandedBytes:256*1024*1024,maxEntryBytes:64*1024*1024};(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]="60ab864f-43c5-512c-b33f-456de96f8090")}catch{}})();var Qse=new Set([...Fr.map(e=>e.split("-")[0].toLowerCase()),...Object.keys(rd).map(e=>e.toLowerCase()),"scaffold"]);(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]="2bc00b8e-0d9f-5af8-9667-d46136ff52b0")}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]="6c9e36f8-0f95-5768-8893-bf33bbb4d848")}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]="df60255d-fdd6-594a-9e17-547d53f7b3bb")}catch{}})();var Lv=new Set(["extension_command_handler_collision","extension_command_override_collision","extension_command_override_handler_overlap","extension_parser_override_collision","extension_preflight_override_collision","extension_renderer_collision","extension_service_override_collision"]);function MF(e){return Lv.has(jF(e))}function Pv(e){return e==="project"||e==="global"}function $F(e){let t=e.split(":"),n=t[0];if(!n||!Lv.has(n))return null;let r=t.at(-4),o=t.at(-3)?.trim(),i=t.at(-2),s=t.at(-1)?.trim();return!Pv(r)||!Pv(i)||!o||!s?null:{code:n,surface:t.slice(1,-4).join(":")||"global",winner:{layer:r,name:o},displaced:{layer:i,name:s}}}function FF(e){let t=new Set;for(let n of e){let r=$F(n);r&&(t.add(r.winner.name),t.add(r.displaced.name))}return[...t].sort((n,r)=>n.localeCompare(r))}function Mv(e,t){let n=e.filter(MF);if(n.length===0)return null;let r=FF(n);return`Extension registration collisions or handler/override overlaps detected.${r.length>0?` Conflicting extensions: ${r.join(", ")}.`:""} Single-winner surfaces can hide earlier package behavior. Deactivate one conflicting package with ${t.deactivate}, or scope registration surfaces in extensions.policy.extension_overrides, then rerun ${t.doctor}.`}function jF(e){let t=e.trim(),n=t.indexOf(":");return n===-1?t:t.slice(0,n)}function Mf(e){let t=new Set,n=[];for(let r of e){let o=(()=>{let i=nl(r);return i?[i]:rl(r)})();for(let i of o){let s=`${i.layer}:${i.name}:${i.capability}`;t.has(s)||(t.add(s),n.push(i))}}return n}function $f(){return{version:Bi.version,capabilities:[...Bi.capabilities],legacy_aliases:{...Bi.legacy_aliases}}}(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]="a77d8d8d-f429-5154-ab3a-2caddc44472e")}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]="9b04c14b-8049-52ef-b7e8-dc87a0fb7629")}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]="37f2dced-3b93-5c64-85ae-56e62c95e8eb")}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]="fcc97434-1ef5-5c47-b491-f00e9d19b2c6")}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]="a1803149-25ca-5bb0-a178-afa2d85d2ec9")}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]="8507f364-e079-5743-a54b-bb3a68ab66d0")}catch{}})();import zF from"node:fs/promises";import HF 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]="c4dc16d1-672a-5b1c-b681-97a7b3febd69")}catch{}})();function qF(e){return HF.join(e,"extension-migrations.json")}function BF(e,t){let n=e.definition.id;return typeof n=="string"&&n.trim().length>0?n.trim():`migration-${String(t+1).padStart(3,"0")}`}function GF(e,t){return`${e.layer}:${e.name}:${t}`}async function WF(e){let t=qF(e);if(!await j(t))return{version:1,updated_at:"",entries:[]};let n=JSON.parse(await zF.readFile(t,"utf8"));return{version:1,updated_at:typeof n.updated_at=="string"?n.updated_at:"",entries:Array.isArray(n.entries)?n.entries.filter(r=>typeof r?.key=="string"&&(r.status==="applied"||r.status==="failed")):[]}}async function $v(e,t){let n=await WF(e),r=new Map(n.entries.map(o=>[o.key,o]));return t.forEach((o,i)=>{let s=BF(o,i),a=r.get(GF(o,s));a&&(o.definition.status=a.status,a.status==="failed"?o.definition.reason=a.error:(delete o.definition.reason,delete o.definition.error,delete o.definition.message))}),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]="ee1bfa77-6687-578c-9cd6-639fc702c48c")}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]="f4b9502f-f742-5f11-b341-56763bbed7c2")}catch{}})();import YF from"node:fs/promises";import JF 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]="b1bf79a0-1f04-590f-b613-45ca1b534d5d")}catch{}})();function XF(e){return typeof e.name=="string"&&e.name.trim().length>0?e.name.trim():"workspace-manifest"}function ZF(e,t){return t.code==="manifest_unknown_key"?`extension_manifest_unknown_key:author:${e}:key=${t.path}${t.suggested_key?`:suggested=${t.suggested_key}`:""}`:`extension_manifest_no_version_bounds:author:${e}:suggested=pm_min_version`}async function Fv(e){let t=JF.join(e,"manifest.json"),n;try{n=await YF.readFile(t,"utf8")}catch(a){if(gt(a))return{path:t,present:!1,parse_status:"absent",package_metadata_location:"package.json#pm",schema_findings:[],warnings:[],remediation:[]};throw a}let r;try{r=JSON.parse(n)}catch{return{path:t,present:!0,parse_status:"invalid_json",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_json:manifest.json"],remediation:["Repair manifest.json so it contains one valid JSON object, then rerun pm package doctor --project."]}}if(typeof r!="object"||r===null||Array.isArray(r))return{path:t,present:!0,parse_status:"invalid_shape",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_shape:manifest.json"],remediation:["Replace manifest.json with one JSON object, then rerun pm package doctor --project."]};let o=r,i=fl(o),s=XF(o);return{path:t,present:!0,parse_status:"valid",package_metadata_location:"package.json#pm",schema_findings:i.findings,warnings:i.findings.map(a=>ZF(s,a)),remediation:i.findings.map(a=>a.message)}}(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]="dcdfdabd-8862-502f-8cd1-298c08825985")}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]="d7afb9a1-be35-5dfd-a52e-2525598b68d8")}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]="4f8fc1a7-748d-559d-9de8-835d0428c6a7")}catch{}})();var nj=[["install","install","--install"],["uninstall","uninstall","--uninstall"],["explore","explore","--explore"],["list","explore","--explore"],["manage","manage","--manage"],["describe","describe","--describe"],["reload","reload","--reload"],["doctor","doctor","--doctor"],["catalog","catalog","--catalog"],["init","init","--init"],["scaffold","init","--scaffold"],["adopt","adopt","--adopt"],["adopt-all","adopt-all","--adopt-all"],["activate","activate","--activate"],["deactivate","deactivate","--deactivate"],["migrate","migrate","--migrate"]],Rle=nj.map(([,,e])=>e).filter((e,t,n)=>n.indexOf(e)===t).join(", ");var Nle=Ds();import{execFile as rj}from"node:child_process";import{realpath as oj}from"node:fs/promises";import jv from"node:path";import{promisify as ij}from"node:util";(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]="be96ba6f-f848-58bf-8a3b-b6e3d6ab4b7a")}catch{}})();var sj=ij(rj),aj=32*1024*1024,cj=1e4,lj=["search/eval-queries.json"];function Ff(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function dj(e){return`'${e.replaceAll("'","'\\''")}'`}async function uj(e,t=oj){return t(e).catch(()=>jv.resolve(e))}async function Za(e){let t=await Lt(e);if(t===null)return{git_workspace_root:null,tracker_relative_root:null,tracked_paths:[],tracked_path_count:0,remediation_command:null};let n=await uj(e),r=Ff(jv.relative(t,n));if(r.length===0)return{git_workspace_root:t,tracker_relative_root:null,tracked_paths:[],tracked_path_count:0,remediation_command:null};let o=jh.map(i=>`${r}/${Ff(i)}`);try{let{stdout:i}=await sj("git",["ls-files","-z","--",...o.map(l=>`:(literal)${l}`)],{cwd:t,encoding:"utf8",maxBuffer:aj,windowsHide:!0,timeout:cj}),s=new Set(lj.map(l=>`${r}/${l}`)),a=[...new Set(i.split("\0").filter(l=>l.length>0&&!s.has(Ff(l))))].sort((l,d)=>l.localeCompare(d)),c=o.filter(l=>a.some(d=>d===l||d.startsWith(`${l}/`)));return{git_workspace_root:t,tracker_relative_root:r,tracked_paths:a,tracked_path_count:a.length,remediation_command:a.length===0?null:`git rm --cached -r -- ${c.map(l=>dj(`:(literal)${l}`)).join(" ")}`}}catch{return{git_workspace_root:t,tracker_relative_root:r,tracked_paths:[],tracked_path_count:0,remediation_command:null}}}import{createHash as fj}from"node:crypto";import Qa 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]="e5ba549f-1965-5c5e-98b3-bd0903210032")}catch{}})();var Uf="2026-08-09T16:15:18.000Z",zv=Symbol("pre-durable-disposition-eligible");function on(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function jf(e){if(!Array.isArray(e)||e.length>256)return!1;let t=new Set;for(let n=0;n<e.length;n+=1){let r=e[n];if(!(n in e)||typeof r!="string"||r.length===0||r.length>256||r.includes("\0")||t.has(r))return!1;t.add(r)}return!0}function Uv(e){return on(e)?typeof e.field=="string"&&e.field.length>0&&e.field.length<=256&&!e.field.includes("\0")&&typeof e.retained_hash=="string"&&/^[a-f0-9]{64}$/u.test(e.retained_hash)&&typeof e.discarded_hash=="string"&&/^[a-f0-9]{64}$/u.test(e.discarded_hash):!1}function Hv(e,t){if(typeof e!="string")return!1;let n=Qa.posix.normalize(e);return e.length<=4096&&!e.includes("\\")&&!e.includes("\0")&&!Qa.posix.isAbsolute(e)&&n===e&&!n.startsWith("../")&&(Qa.posix.basename(n)===`${t}.toon`||Qa.posix.basename(n)===`${t}.md`)}function mj(e,t){return typeof e.receipt_id=="string"&&Qt(e.receipt_id)&&(e.preferred==="ours"||e.preferred==="theirs")&&e.requested_preference===void 0&&e.conflict_resolution===void 0&&e.item_id===t&&Hv(e.item_path,t)}function qv(e){let t=e.conflict_fields,n=e.fields_from_theirs,r=e.union_fields,o=e.decisions,i=Array.isArray(o)?new Set(o.flatMap(s=>Uv(s)?[s.field]:[])):new Set;return jf(t)&&jf(n)&&jf(r)&&Array.isArray(o)&&o.length>0&&o.length<=256&&Object.keys(o).length===o.length&&o.every(Uv)&&i.size===o.length&&t.length===i.size&&t.every(s=>i.has(s))}function pj(e,t){return mj(e,t)&&qv(e)}function _j(e,t){return typeof e.receipt_id=="string"&&Qt(e.receipt_id)&&(e.preferred==="ours"||e.preferred==="theirs")&&e.requested_preference===void 0&&(e.conflict_resolution==="preferred_side"||e.conflict_resolution==="stable_value_order")&&e.item_id===t&&Hv(e.item_path,t)&&qv(e)}function zf(e){return e[zv]===!0}function ec(e,t){if(!on(e)||!on(e.context))return[];let n=e.context.merge;return!on(n)||!Array.isArray(n.receipts)?[]:n.receipts.flatMap(r=>!on(r)||typeof r.receipt_id!="string"||r.receipt_id.trim().length===0?[]:[{receiptId:r.receipt_id,legacySummaryAccepted:pj(r,t),[zv]:_j(r,t),...typeof e.ts=="string"&&Bt(e.ts)?{eventTimestamp:e.ts}:{}}])}function Bv(e,t,n){if(!on(e)||e.op!=="merge_reconcile")return[];if(!on(e.context)||!on(e.context.merge))return[];let r=e.context.merge.missing_receipt_dispositions;return!Array.isArray(r)||r.length>256?[]:r.flatMap(o=>!on(o)||typeof o.receipt_id!="string"||!Qt(o.receipt_id)||typeof o.original_history_line!="number"||!Number.isSafeInteger(o.original_history_line)||o.original_history_line<1||typeof o.original_event_ts!="string"||!Bt(o.original_event_ts)||o.reason!=="legacy_clone_local_only"?[]:[{itemId:t,receiptId:o.receipt_id,originalHistoryLine:o.original_history_line,originalEventTimestamp:o.original_event_ts,auditHistoryLine:n,reason:o.reason}])}function Gv(e,t,n=[]){let r=new Map;for(let s of n){let a=`${s.itemId}\0${s.originalHistoryLine}\0${s.receiptId}\0${s.originalEventTimestamp}`;r.set(a,Math.max(r.get(a)??0,s.auditHistoryLine))}let o=s=>zf(s)&&s.eventTimestamp!==void 0&&we(s.eventTimestamp,Uf)<0&&(r.get(`${s.itemId}\0${s.line}\0${s.receiptId}\0${s.eventTimestamp}`)??0)>s.line;return{missing:e.filter(s=>!s.legacySummaryAccepted&&!t.has(s.receiptId)&&!o(s)).map(s=>({item_id:s.itemId,history_line:s.line,...Qt(s.receiptId)?{receipt_id:s.receiptId}:{receipt_reference_hash:fj("sha256").update(s.receiptId).digest("hex")}})),acceptedLegacyCount:e.filter(s=>s.legacySummaryAccepted).length,acceptedDispositionCount:e.filter(o).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]="fdd874ad-e51d-5df2-9486-a0465ad65979")}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]="0a3dd0c1-2dea-5143-a2eb-65e758a0cc71")}catch{}})();function sn(){let e=jn();for(let t of Y()?.relationship_kinds??[])for(let n of t.definitions)e.register(n);return 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]="83d1acab-79a1-5e9f-b6a4-97dade07d74a")}catch{}})();function nc(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function tc(e){return[e.parent_id,e.child_id,e.source,e.kind,e.holder_id,e.target_id??""].join("\0")}function gj(e,t){let n=new Set,r=[];for(let o of[...e].sort()){if(n.has(o))continue;n.add(o);let i=[{nodeId:o,children:[...t.get(o)??[]].sort(),nextChild:0}];for(;i.length>0;){let s=i.at(-1),a=s.children[s.nextChild];a===void 0?(r.push(s.nodeId),i.pop()):(s.nextChild+=1,n.has(a)||(n.add(a),i.push({nodeId:a,children:[...t.get(a)??[]].sort(),nextChild:0})))}}return r}function hj(e,t){let n=[...e].sort(),r=gj(n,t),o=new Set,i=yj(n,t),s=[];for(let a of r.reverse()){if(o.has(a))continue;let c=wj(a,i,o);(c.length>1||t.get(c[0])?.has(c[0]))&&s.push(c)}return s.sort((a,c)=>a.join("\0").localeCompare(c.join("\0")))}function yj(e,t){let n=new Map(e.map(r=>[r,new Set]));for(let[r,o]of t)for(let i of o)n.get(i)?.add(r);return n}function wj(e,t,n){let r=[],o=[e];for(n.add(e);o.length>0;){let i=o.pop();r.push(i);for(let s of[...t.get(i)].sort())n.has(s)||(n.add(s),o.push(s))}return r.sort()}function bj(e){let t=new Map;for(let n of e){let r=nc(n?.id);r&&!t.has(r)&&t.set(r,n)}return t}function vj(e,t,n){let r=nc(t.parent);if(!(!r||!n.has(r)))return{parent_id:r,child_id:e,source:"scalar_parent",kind:"parent",holder_id:e,child_cardinality:"one"}}function kj(e,t,n,r){let o=nc(t?.id),i=r.resolve(t?.kind);if(!o||!n.has(o)||!i?.hierarchy)return;let s=i.hierarchyDirection==="source_parent";return{parent_id:s?e:o,child_id:s?o:e,source:"dependency",kind:i.kind,holder_id:e,target_id:o,child_cardinality:s?i.incoming:i.outgoing}}function Ej(e,t){let n=new Map;for(let[r,o]of e){let i=vj(r,o,e);i&&n.set(tc(i),i);for(let s of o.dependencies??[]){let a=kj(r,s,e,t);a&&n.set(tc(a),a)}}return[...n.values()].sort((r,o)=>tc(r).localeCompare(tc(o)))}function Sj(e,t,n){let r=new Set(e.filter(o=>o.child_cardinality==="one").map(o=>o.child_id));return[...t].filter(([o,i])=>i.length>1&&r.has(o)).map(([o,i])=>({child_id:o,parent_ids:[...i],legacy_terminal:n.has(o)&&i.every(s=>n.has(s))})).sort((o,i)=>o.child_id.localeCompare(i.child_id))}function Tj(e,t,n){let r=new Map;for(let i of t){if(i.source!=="dependency")continue;let s=r.get(i.child_id)??new Set;s.add(i.parent_id),r.set(i.child_id,s)}let o=[];for(let[i,s]of e){let a=nc(s.parent);if(!a||!e.has(a))continue;let c=[...r.get(i)??[]].filter(l=>l!==a).sort();c.length!==0&&o.push({child_id:i,scalar_parent_id:a,dependency_parent_ids:c,legacy_terminal:n.has(i)&&n.has(a)&&c.every(l=>n.has(l))})}return o.sort((i,s)=>i.child_id.localeCompare(s.child_id))}function Li(e,t=r=>r==="closed"||r==="canceled",n=sn()){let r=bj(e),o=Ej(r,n),i=Aj(o),s=new Set([...r].filter(([,c])=>t(c.status)).map(([c])=>c)),a=hj([...r.keys()],new Map([...i.children_by_parent].map(([c,l])=>[c,new Set(l)]))).map(c=>({item_ids:c,legacy_terminal:c.every(l=>s.has(l))}));return{relations:o,cycles:a,cardinality_violations:Sj(o,i.parents_by_child,s),divergences:Tj(r,o,s)}}function Aj(e){let t=new Map,n=new Map;for(let r of e){let o=t.get(r.child_id)??new Set;o.add(r.parent_id),t.set(r.child_id,o);let i=n.get(r.parent_id)??new Set;i.add(r.child_id),n.set(r.parent_id,i)}return{parents_by_child:new Map([...t].map(([r,o])=>[r,[...o].sort()])),children_by_parent:new Map([...n].map(([r,o])=>[r,[...o].sort()]))}}(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]="06ecc7a4-c593-5d99-89f5-714a4590d0a5")}catch{}})();function Wv(e){if(typeof e!="string")return;let t=e.trim();if(!(!t||["none","null","n/a","na"].includes(t.toLowerCase())))return t}function Ij(e,t,n=!0){let r=Wv(e);return n&&(ro(t)||r!==void 0&&xi(r))}function Vv(e,t=n=>n==="closed"||n==="canceled"){let n=e.filter(c=>typeof c?.id=="string"&&c.id.trim().length>0),r=new Set(n.map(c=>c.id.trim().toLowerCase())),o=new Map,i=(c,l,d,u,f)=>{let m=Wv(l);if(!m||r.has(m.toLowerCase())||Ij(m,void 0,f))return;let p={holder_id:c.id.trim(),target_id:m,kind:d,source:u,holder_status:c.status,legacy_terminal:t(c.status),no_active_blocker_sentinel:m.toLowerCase()==="no-active-blocker"};o.set(`${p.holder_id}::${p.target_id}::${p.kind}::${p.source}`,p)};for(let c of n){i(c,c.parent,"parent","parent",!1),i(c,c.blocked_by,"blocked_by","blocked_by",!0);for(let l of c.dependencies??[]){if(typeof l!="object"||l===null)continue;let d=l;ro(d.source_kind)||i(c,d.id,typeof d.kind=="string"?d.kind:"related","dependency",!0)}}let s=[...o.values()].sort((c,l)=>c.holder_id.localeCompare(l.holder_id)||c.target_id.localeCompare(l.target_id)||c.kind.localeCompare(l.kind)||c.source.localeCompare(l.source)),a=s.filter(c=>c.legacy_terminal);return{active:s.filter(c=>!c.legacy_terminal),legacy_terminal:a,no_active_blocker_sentinels:s.filter(c=>c.no_active_blocker_sentinel)}}(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]="77ccea6e-a118-53df-94b7-a740bb3d7681")}catch{}})();function rc(e,t,n=25){let r=e.definitions.filter(s=>s.roles.length===0).map(s=>s.id).sort((s,a)=>s.localeCompare(a)),o=new Set(r),i=t.filter(s=>{let a=Tr(s.status,e);return a!==void 0&&o.has(a)}).map(s=>s.id).sort((s,a)=>s.localeCompare(a));return{roleless_status_count:r.length,roleless_statuses:r.slice(0,n),roleless_statuses_truncated:r.length>n,affected_item_count:i.length,affected_item_ids:i.slice(0,n),affected_item_ids_truncated:i.length>n}}function oc(e){return e.roleless_status_count===0?[]:[`schema_status_missing_lifecycle_role:${e.roleless_status_count}`]}(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]="ccc95309-685b-5516-936f-74106af14c74")}catch{}})();var Cj=new Set(Jr),Xv=25,io=8,hr=100,Oj=Xe.join("runtime","telemetry","events.jsonl"),xj=Xe.join("runtime","telemetry","state.json"),Rj=2500,Nj=500,Zv=Tw-3,Dj=["x-pm-telemetry-max-schema-version","x-pm-telemetry-max-version"];function Qv(e,t=!1){return e.startsWith("telemetry_")||e.startsWith("history_stream_over_compact_threshold:")||e.startsWith("integrity_legacy_hierarchy_")||e.startsWith("stale_in_progress_items:")||e.startsWith("provenance_resolver_zero_success:")||e.startsWith("provenance_value_domain_invalid:")||!t&&e.startsWith("merge_driver_configuration_missing:")}function ek(e){let t=e.trim(),n=t.indexOf(":");return n===-1?t:t.slice(0,n)}function Mi(e){return e.trim().toLowerCase()}function Kv(e,t){let n=Mi(e),r=Mi(t);return n.startsWith("builtin-")?!0:r==="beads"||r==="todos"}async function tk(e){try{return(await cn.stat(e)).isDirectory()}catch{return!1}}async function Pj(e){let t=(await cn.readdir(e,{withFileTypes:!0})).filter(r=>r.isDirectory()),n=await Promise.all(t.map(r=>cn.readdir(Xe.join(e,r.name),{withFileTypes:!0})));return new Set(n.flatMap(r=>r.filter(o=>o.isFile()).filter(o=>Gt.some(i=>o.name.endsWith(i))).map(o=>Xe.parse(o.name).name)))}async function Lj(e,t,n,r){let o=await Le({path:e,scope:"project"}),i=t!=="_workspace"&&!r.has(t);if(!n.enabled&&!i)return{warnings:o,overThreshold:!1,classification:"live"};let s;try{s=await cn.readFile(e,"utf8")}catch{return{warnings:o,overThreshold:!1,classification:"unreadable"}}let a="live";if(i){let l=s.split(/\r?\n/).map(d=>d.trim()).filter(Boolean).at(-1);try{a=JSON.parse(l??"{}").op==="delete"?"tombstone":"orphaned"}catch{a="orphaned"}}let c=n.enabled?s.split(/\r?\n/).filter(l=>l.trim().length>0).length:0;return{warnings:o,overThreshold:n.enabled&&c>n.max_entries,classification:a}}async function Mj(e,t,n){let r=Xe.join(e,"history");if(!await tk(r))return{count:0,warnings:[],over_threshold:[],max_entries:null,tombstones:[],orphaned:[]};let o=(await cn.readdir(r)).filter(u=>u.endsWith(".jsonl")).sort((u,f)=>u.localeCompare(f)),s=t.enabled?t.max_entries:null,a=[],c=[],l=[],d=[];for(let u of o){let f=Xe.join(r,u),m=u.slice(0,-6),p=await Lj(f,m,t,n);a.push(...p.warnings),p.classification==="tombstone"&&l.push(m),p.classification==="orphaned"&&d.push(m),p.overThreshold&&c.push(m)}return{count:o.length,warnings:[...a,...c.map(u=>`history_stream_over_compact_threshold:${u}`),...d.map(u=>`history_orphaned_stream:${u}`)],over_threshold:c,max_entries:s,tombstones:l,orphaned:d}}function Wf(e,t){return Xe.relative(e,t).replaceAll("\\","/")}async function $j(e,t){let n=[...new Set(Object.values(t))].sort((o,i)=>o.localeCompare(i)),r=[];for(let o of n){let i=Xe.join(e,o),s=[];try{s=await cn.readdir(i)}catch(a){if(typeof a=="object"&&a!==null&&"code"in a&&L(a))continue;continue}for(let a of s)Gt.some(c=>a.toLowerCase().endsWith(c))&&r.push(Xe.join(i,a))}return r.sort((o,i)=>Wf(e,o).localeCompare(Wf(e,i))),r}function Fj(e){return!(typeof e=="object"&&e!==null&&"code"in e&&L(e))}async function jj(e,t,n){let r=await $j(e,t),o=[],i=[],s=[],a=[],c=Et(Y());for(let l of r){let d=Wf(e,l),u;try{u=await cn.readFile(l,"utf8")}catch{o.push(d);continue}let f=De(u);if(f){i.push({path:d,...f});continue}try{let m=We(u,{format:Nr(l),schema:n,extensionFieldNames:c});a.push({ref:d,version:ms(m.metadata)})}catch{s.push(d)}}return{paths:r,unreadable:o,conflictMarkers:i,parseFailures:s,formatVersions:a}}async function Uj(e){let t=Xe.join(e,"history"),n=[],r=[],o=[],i=[],s=[],a=[];try{a=(await cn.readdir(t)).filter(c=>c.endsWith(".jsonl")).sort((c,l)=>c.localeCompare(l))}catch(c){Fj(c)&&n.push("history")}for(let c of a){let l=c.slice(0,-6),d;try{d=await cn.readFile(Xe.join(t,c),"utf8")}catch{n.push(l);continue}let u=De(d);if(u){r.push({id:l,...u});continue}d.split(/\r?\n/).forEach((f,m)=>{if(f.trim())try{let p=JSON.parse(f);i.push(...ec(p,l).map(w=>({itemId:l,line:m+1,...w}))),s.push(...Bv(p,l,m+1))}catch{o.push({id:l,line:m+1})}})}return{files:a,unreadable:n,conflictMarkers:r,invalidJson:o,mergeReceiptReferences:i,mergeReceiptDispositions:s}}function zj(e){return[...e.cycles.map(t=>t.legacy_terminal?`integrity_legacy_hierarchy_cycle:${t.item_ids.join(",")}`:`integrity_hierarchy_cycle:${t.item_ids.join(",")}`),...e.cardinality_violations.map(t=>t.legacy_terminal?`integrity_legacy_hierarchy_cardinality:${t.child_id}`:`integrity_hierarchy_cardinality:${t.child_id}`),...e.divergences.map(t=>t.legacy_terminal?`integrity_legacy_hierarchy_divergence:${t.child_id}`:`integrity_hierarchy_divergence:${t.child_id}`)]}function Hj(e){let t=[];return e.invalidEvidenceCount>0&&t.push(`merge_receipt_evidence_invalid:${e.invalidEvidenceCount}`),e.missingHistoryReferenceCount>0&&t.push(`merge_receipt_history_reference_missing:${e.missingHistoryReferenceCount}`),t}async function qj(e,t,n,r,o){let i=await jj(e,t,n),s=await Uj(e),a=ps(i.formatVersions),c=at(n),l=Li(o,E=>Nc(E,c),sn()),d=await Za(e),u=await Lt(e),f=u===null?null:await oi(u),m=await kt(u??e,{includeReconciled:!0,includeLossless:!0,pmRoot:e}),p=new Set(m.receipts.map(E=>E.id)),w=Gv(s.mergeReceiptReferences,p,s.mergeReceiptDispositions),y=w.missing,b=m.receipts.filter(E=>E.state==="pending"),{pendingDecisions:v,lossless:I}=ua(b),A=f?.status==="missing"&&f.missing_keys.length===5&&f.drifted_keys.length===0,C=[...i.unreadable.map(E=>`integrity_item_unreadable:${E}`),...i.conflictMarkers.map(E=>`integrity_item_conflict_marker:${E.path}:L${E.line}`),...i.parseFailures.map(E=>`integrity_item_parse_failed:${E}`),...s.unreadable.map(E=>`integrity_history_unreadable:${E}`),...s.conflictMarkers.map(E=>`integrity_history_conflict_marker:${E.id}:L${E.line}`),...s.invalidJson.map(E=>`integrity_history_invalid_json:${E.id}:L${E.line}`),...a.outdated.map(E=>`integrity_item_outdated_format_version:${E}`),...a.ahead.map(E=>`integrity_item_ahead_format_version:${E}`),...zj(l),...d.tracked_path_count>0?[`tracked_runtime_cache_files:${d.tracked_path_count}`]:[],...f!==null&&f.status!=="ok"?[`merge_driver_configuration_${A?"missing":"drift"}:${f.missing_keys.length+f.drifted_keys.length}`]:[],...v.length>0?[`merge_decisions_unreviewed:${v.length}`]:[],...I.length>0?[`merge_receipts_pending:${I.length}`]:[],...Hj({invalidEvidenceCount:m.invalid_evidence_count,missingHistoryReferenceCount:y.length})],P=[...new Set(C)].sort((E,z)=>E.localeCompare(z)),S=P.filter(E=>!E.startsWith("integrity_legacy_hierarchy_"));return{check:{name:"integrity",status:S.length===0?"ok":"warn",ok:S.length===0,details:{checked_item_files:i.paths.length,checked_history_streams:s.files.length,counts:{item_unreadable:i.unreadable.length,item_conflict_markers:i.conflictMarkers.length,item_parse_failures:i.parseFailures.length,history_unreadable:s.unreadable.length,history_conflict_markers:s.conflictMarkers.length,history_invalid_json:s.invalidJson.length,item_outdated_format_version:a.outdated.length,item_ahead_format_version:a.ahead.length,hierarchy_cycles:l.cycles.length,hierarchy_cardinality_violations:l.cardinality_violations.length,hierarchy_parent_divergences:l.divergences.length,tracked_runtime_cache_files:d.tracked_path_count,merge_driver_configuration:f===null||f.status==="ok"?0:f.missing_keys.length+f.drifted_keys.length,pending_merge_decisions:v.length,lossless_merge_receipts:I.length,invalid_merge_receipt_evidence:m.invalid_evidence_count,missing_merge_receipt_history_references:y.length,accepted_legacy_merge_receipt_references:w.acceptedLegacyCount,accepted_missing_merge_receipt_dispositions:w.acceptedDispositionCount},item_unreadable:i.unreadable,item_conflict_markers:i.conflictMarkers,item_parse_failures:i.parseFailures,item_outdated_format_version:a.outdated,item_ahead_format_version:a.ahead,hierarchy_integrity:{...l,relations:an(l.relations,io)},history_unreadable:s.unreadable,history_conflict_markers:s.conflictMarkers,history_invalid_json:s.invalidJson,tracked_runtime_cache:{tracker_relative_root:d.tracker_relative_root,tracked_paths:d.tracked_paths,tracked_path_count:d.tracked_path_count,remediation_command:d.remediation_command},merge_driver_configuration:f===null?null:{...f,required:r},pending_merge_decision_items:[...new Set(v.map(E=>E.item_id))].sort((E,z)=>E.localeCompare(z)),lossless_merge_receipt_items:[...new Set(I.map(E=>E.item_id))].sort((E,z)=>E.localeCompare(z)),invalid_merge_receipt_evidence_details:m.invalid_evidence,invalid_merge_receipt_evidence_details_truncated:m.invalid_evidence_truncated,missing_merge_receipt_history_reference_details:y.slice(0,hr),missing_merge_receipt_history_reference_details_truncated:y.length>hr}},warnings:P,gitWorkspaceRoot:u,pendingMergeReceipts:b}}function Bj(e){if(typeof e.activate=="function")return!0;let t=e.default;return typeof t!="object"||t===null?!1:typeof t.activate=="function"}function Gj(e){let t={layer:e.layer,directory:e.directory,manifest_path:e.manifest_path,name:e.name,version:e.version,entry:e.entry,priority:e.priority,entry_path:e.entry_path,has_activate:Bj(e.module)};return Array.isArray(e.capabilities)&&(t.capabilities=[...e.capabilities]),t}function Wj(e,t){let n=le(e.id);return n||`migration-${String(t+1).padStart(3,"0")}`}function Vj(e){let n=le(e.status)?.toLowerCase();return n==="failed"?"failed":n==="applied"?"applied":"pending"}function Kj(e){return le(e.reason)??le(e.error)??le(e.message)}function Hf(e,t){let n=(e.layer??"").localeCompare(t.layer??"");if(n!==0)return n;let r=(e.name??"").localeCompare(t.name??"");return r!==0?r:(e.id??"").localeCompare(t.id??"")}function Yj(e){let t=[],n=[],r=[];e.forEach((i,s)=>{let a=Wj(i.definition,s),c=Vj(i.definition);if(c==="applied"){t.push({layer:i.layer,name:i.name,id:a,status:c});return}if(c==="failed"){r.push({layer:i.layer,name:i.name,id:a,status:c,reason:Kj(i.definition)});return}n.push({layer:i.layer,name:i.name,id:a,status:c})}),t.sort(Hf),n.sort(Hf),r.sort(Hf);let o=[...r.map(i=>`extension_migration_failed:${i.layer}:${i.name}:${i.id}`),...n.map(i=>`extension_migration_pending:${i.layer}:${i.name}:${i.id}`)];return{summary:{applied:t,pending:n,failed:r,applied_count:t.length,pending_count:n.length,failed_count:r.length},warnings:o}}function Jj(e,t,n,r,o,i,s,a,c){let l=[...new Set(e)].sort((y,b)=>y.localeCompare(b)),d=[...new Set(l.map(y=>ek(y)))].sort((y,b)=>y.localeCompare(b)),u=l.filter(y=>y.startsWith("extension_capability_unknown:")).length,f=c.length>0,m=f?"partial":"full",p=[],w=Mv(l,{deactivate:"pm extension --deactivate <name> --project/--global",doctor:"pm extension --doctor --project/--global --detail deep --trace"});return w&&p.push(w),t>0&&p.push("Run pm extension --explore --project and pm extension --explore --global to inspect load failures."),n>0&&p.push("Review checks[name=extensions].details.activation.failed in pm health --json for activation error details."),(r.failed_count>0||r.pending_count>0)&&p.push("Resolve pending/failed extension migrations before write commands; use --force only when policy allows."),o>0&&p.push("Run pm extension --manage --project and pm extension --manage --global to refresh managed-state diagnostics."),u>0&&p.push(`Unknown extension capabilities detected. Allowed capabilities: ${Qe.join(", ")}. Review extension_capability_unknown warning details for suggested replacements.`),l.some(y=>y.startsWith("extension_capability_legacy_alias:"))&&p.push("Legacy extension capability aliases were auto-remapped to canonical capabilities. Update manifests to canonical names (migration/validation -> schema)."),l.some(y=>y.startsWith("extension_command_definition_legacy_handler_alias:"))&&p.push("Extension command definitions using legacy handler were auto-remapped. Update command definitions to use run: (context) => ... for forward compatibility."),f?p.push("Update-check coverage is partial because unmanaged extensions need adoption. Adopt existing installs via pm extension --manage --project/--global --fix-managed-state, pm extension --adopt-all --project/--global, or pm extension --adopt <name>."):s.length>0&&p.push("Loaded unmanaged extensions are currently treated as informational. Use pm extension --manage --project/--global --fix-managed-state to adopt them for update checks."),p.length===0&&p.push("No immediate action required. Re-run pm health after extension configuration changes."),{status:l.length===0?"ok":"warn",warning_count:l.length,warning_codes:d,load_failure_count:t,activation_failure_count:n,migration_failed_count:r.failed_count,migration_pending_count:r.pending_count,managed_state_warning_count:o,managed_extension_entries_count:i,unmanaged_loaded_extension_count:s.length,unmanaged_loaded_extensions:s,unmanaged_expected_extension_count:a.length,unmanaged_expected_extensions:a,unmanaged_action_required_extension_count:c.length,unmanaged_action_required_extensions:c,update_health_coverage:m,update_health_partial:f,unknown_capability_count:u,top_warnings:l.slice(0,8),remediation:p}}async function Xj(e,t,n){let r=await Fv(hn(e)),o=await Lo({pmRoot:e,settings:t,cwd:process.cwd(),noExtensions:n}),i=o.loaded.map(S=>Gj(S)),s=await Rw(o.loaded,hn(e)),a=await Mo({...o,loaded:o.loaded}),[c,l]=await Promise.all([Pi(o.roots.project),Pi(o.roots.global)]);await $v(e,a.registrations.migrations);let d=Yj(a.registrations.migrations),u={failed:a.failed,warnings:a.warnings,hook_counts:a.hook_counts,command_override_count:a.command_override_count,command_handler_count:a.command_handler_count,parser_override_count:a.parser_override_count,preflight_override_count:a.preflight_override_count,service_override_count:a.service_override_count,renderer_override_count:a.renderer_override_count,registration_counts:a.registration_counts,registrations:a.registrations,migration_status:d.summary,managed_extensions:{project:{path:c.path,count:c.state.entries.length,entries:c.state.entries},global:{path:l.path,count:l.state.entries.length,entries:l.state.entries}}},f=new Set(c.state.entries.map(S=>Mi(S.name))),m=new Set(l.state.entries.map(S=>Mi(S.name))),p=[...new Map(o.loaded.filter(S=>!(S.layer==="project"?f:m).has(Mi(S.name))).map(S=>[`${S.layer}:${S.name}`,{layer:S.layer,name:S.name,directory:S.directory}])).values()].sort((S,E)=>{let z=`${S.layer}:${S.name}`,H=`${E.layer}:${E.name}`;return z.localeCompare(H)}),w=p.map(S=>`${S.layer}:${S.name}`).sort((S,E)=>S.localeCompare(E)),y=p.filter(S=>Kv(S.name,S.directory)).map(S=>`${S.layer}:${S.name}`).sort((S,E)=>S.localeCompare(E)),b=p.filter(S=>!Kv(S.name,S.directory)).map(S=>`${S.layer}:${S.name}`).sort((S,E)=>S.localeCompare(E)),v=b.length>0?[`extension_update_health_partial_coverage:skipped_unmanaged:${b.length}`]:[],I=[...r.warnings,...o.warnings,...u.warnings,...d.warnings,...c.warnings,...l.warnings,...v,...s.warnings],A=Mf(I),C=$f(),P=Jj(I,o.failed.length,a.failed.length,d.summary,c.warnings.length+l.warnings.length,c.state.entries.length+l.state.entries.length,w,y,b);return{check:{name:"extensions",status:I.length===0?"ok":"warn",ok:I.length===0,details:{...o,loaded:i,warnings:I,activation:u,author_manifest:r,triage:P,...d.summary.pending_count>0?{remediation_map:{extension_migration_pending:"pm extension migrate --project"}}:{},capability_contract:C,capability_guidance:A,host_version_census:s}},warnings:I}}function Zj(e,t){return e.length<=t?{values:e,truncated:!1}:{values:e.slice(0,t),truncated:!0}}function an(e,t){return Array.isArray(e)?{count:e.length,sample:e.slice(0,t),truncated:e.length>t}:{count:0,sample:[],truncated:!1}}function Qj(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};let t=e;return{layer:t.layer,directory:t.directory,name:t.name,version:t.version,enabled:t.enabled,status:t.status,has_activate:t.has_activate,capabilities:t.capabilities}}function qf(e,t){let n=an(e,t);return{...n,sample:n.sample.map(r=>Qj(r))}}function K(e,t){if(!Array.isArray(e))return{count:0,sample:[],truncated:!1};let n=e.filter(r=>typeof r=="string");return{count:n.length,sample:n.slice(0,t),truncated:n.length>t}}function e1(e){if(typeof e!="object"||e===null)return null;let t=e;return{applied_count:t.applied_count,pending_count:t.pending_count,failed_count:t.failed_count}}var t1={settings:(e,t)=>({version:e.version,id_prefix:e.id_prefix,locks_ttl_seconds:e.locks_ttl_seconds,warnings:K(e.warnings,t)}),directories:(e,t)=>({required_count:Array.isArray(e.required)?e.required.length:0,optional_count:Array.isArray(e.optional)?e.optional.length:0,missing_required:K(e.missing_required,t),missing_optional:K(e.missing_optional,t),missing:K(e.missing,t),strict_directories:e.strict_directories}),settings_values:(e,t)=>({warnings:K(e.warnings,t)}),telemetry:e=>({enabled:e.enabled,capture_level:e.capture_level,endpoint:e.endpoint,queue_exists:e.queue_exists,queue_entries:e.queue_entries,queue_draining:e.queue_draining,queue_invalid_rows:e.queue_invalid_rows,queue_rows_total:e.queue_rows_total,last_successful_flush_at:e.last_successful_flush_at,last_failed_flush_at:e.last_failed_flush_at,endpoint_probe:e.endpoint_probe,env_overrides:e.env_overrides}),extensions:(e,t)=>{let n=typeof e.activation=="object"&&e.activation!==null?e.activation:{};return{disabled_by_flag:e.disabled_by_flag,discovered:qf(e.discovered,t),effective:qf(e.effective,t),loaded:qf(e.loaded,t),failed:an(e.failed,t),warnings:K(e.warnings,t),activation:{failed:an(n.failed,t),warnings:K(n.warnings,t),hook_counts:n.hook_counts,command_handler_count:n.command_handler_count,service_override_count:n.service_override_count,renderer_override_count:n.renderer_override_count,registration_counts:n.registration_counts,migration_status:e1(n.migration_status)},author_manifest:e.author_manifest,triage:e.triage,capability_contract:e.capability_contract,capability_guidance:an(e.capability_guidance,t),host_version_census:e.host_version_census}},storage:(e,t)=>{let n=typeof e.author_attribution=="object"&&e.author_attribution!==null?e.author_attribution:void 0;return{...e,...n?{author_attribution:{...n,affected_item_ids:K(n.affected_item_ids,t),samples:an(n.samples,t)}}:{}}},locks:e=>({active_lock_count:e.active_lock_count,stale_lock_count:e.stale_lock_count,unreadable_lock_count:e.unreadable_lock_count,unparseable_lock_count:e.unparseable_lock_count}),integrity:(e,t)=>{let n=typeof e.tracked_runtime_cache=="object"&&e.tracked_runtime_cache!==null?e.tracked_runtime_cache:void 0;return{checked_item_files:e.checked_item_files,checked_history_streams:e.checked_history_streams,counts:e.counts,item_unreadable:K(e.item_unreadable,t),item_conflict_markers:an(e.item_conflict_markers,t),item_parse_failures:K(e.item_parse_failures,t),tracked_runtime_cache:n===void 0?e.tracked_runtime_cache:{...n,tracked_paths:K(n.tracked_paths,t)},history_unreadable:K(e.history_unreadable,t),history_conflict_markers:an(e.history_conflict_markers,t),history_invalid_json:an(e.history_invalid_json,t),skipped:e.skipped}},history_drift:(e,t)=>{let n=typeof e.cache_confirmation=="object"&&e.cache_confirmation!==null?e.cache_confirmation:void 0;return{checked_items:e.checked_items,cache_hit_verification:e.cache_hit_verification,cache_confirmation:n===void 0?e.cache_confirmation:{...n,candidate_items:K(n.candidate_items,t),confirmed_items:K(n.confirmed_items,t),resolved_false_positive_items:K(n.resolved_false_positive_items,t)},counts:e.counts,drifted_items:K(e.drifted_items,t),merge_receipt_attributed_items:K(e.merge_receipt_attributed_items,t),missing_streams:K(e.missing_streams,t),unreadable_streams:K(e.unreadable_streams,t),hash_mismatches:K(e.hash_mismatches,t),chain_mismatches:K(e.chain_mismatches,t),version_skews:K(e.version_skews,t),workspace_state_mismatches:K(e.workspace_state_mismatches,t),workspace_state_missing:K(e.workspace_state_missing,t),workspace_state_unreadable:K(e.workspace_state_unreadable,t),skipped:e.skipped}},vectorization:(e,t)=>({semantic_runtime_available:e.semantic_runtime_available,compatibility_mode_auto_defaults:e.compatibility_mode_auto_defaults,auto_ollama_defaults_applied:e.auto_ollama_defaults_applied,auto_ollama_defaults_skipped_reason:e.auto_ollama_defaults_skipped_reason,auto_ollama_defaults_remediation:e.auto_ollama_defaults_remediation,refresh_policy:e.refresh_policy,provider_active:e.provider_active,vector_store_active:e.vector_store_active,items:e.items,ledger_entries_before:e.ledger_entries_before,stale_items_before_total:e.stale_items_before_total,stale_items_before:K(e.stale_items_before,t),refresh_attempted:e.refresh_attempted,refresh_skipped_reason:e.refresh_skipped_reason,refresh_result:e.refresh_result,ledger_entries_after:e.ledger_entries_after,stale_items_after_total:e.stale_items_after_total,stale_items_after:K(e.stale_items_after,t),skipped:e.skipped})};function n1(e,t){let n=t1[e.name];return n?n(e.details,t):e.details}function r1(e){let t=K(e.warnings,io);return{ok:e.ok,...e.verdict?{verdict:e.verdict}:{},checks:e.checks.map(n=>({name:n.name,status:n.status,ok:n.ok,details:n1(n,io)})),warnings:t.sample,findings:e.findings.filter(n=>t.sample.includes(n.warning)||e.failed_because.includes(n.warning)),failed_because:e.failed_because,projection:{mode:"brief",warning_count:t.count,warnings_truncated:t.truncated,detail_limit:io},generated_at:e.generated_at}}function Yv(e){return e.details.skipped===!0}function o1(e){let t=K(e.warnings,io),n=e.checks.filter(Yv).map(r=>r.name);return{ok:e.ok,...e.verdict?{verdict:e.verdict}:{},checks:e.checks.filter(r=>!Yv(r)).map(r=>({name:r.name,status:r.status,ok:r.ok,details:{}})),warning_count:t.count,warnings:t.sample,findings:e.findings.filter(r=>t.sample.includes(r.warning)||e.failed_because.includes(r.warning)),failed_because:e.failed_because,projection:{mode:"summary",warning_count:t.count,warnings_truncated:t.truncated,detail_limit:io,omitted_checks:n},generated_at:e.generated_at}}function Jv(e,t){if(t)return{values:e,truncated:!1,total:e.length};let n=Zj(e,Xv);return{values:n.values,truncated:n.truncated,total:e.length}}function Bf(e){let t=(process.env[e]??"").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function i1(){let e=(process.env.PM_TELEMETRY_SOURCE_CONTEXT??"").trim().toLowerCase();return Cj.has(e)?e:null}function Vf(e){let t=e.trim();if(t.length===0)return"";try{let n=new URL(t);return n.username="",n.password="",n.search="",n.hash="",n.toString()}catch{return t}}function s1(e){let t=0,n=0,r=0,o=0,i=0;for(let s of e.split(`
121
121
  `)){let a=s.trim();if(a.length!==0){r+=1;try{let c=JSON.parse(a);if(typeof c=="object"&&c!==null&&typeof c.attempts=="number"&&Number.isFinite(c.attempts)){let l=Math.max(0,Math.trunc(c.attempts));t+=1,i=Math.max(i,l),l>=Zv&&(o+=1)}else n+=1}catch{n+=1}}}return{validEntries:t,invalidRows:n,totalRows:r,highRetryEntries:o,maxAttempts:i}}function a1(){return{validEntries:0,invalidRows:0,totalRows:0,highRetryEntries:0,maxAttempts:0}}function c1(e){if(!e||e.trim().length===0)return{runtimeState:{},stateParseFailed:!1};try{let t=JSON.parse(e);return typeof t=="object"&&t!==null&&!Array.isArray(t)?{runtimeState:t,stateParseFailed:!1}:{runtimeState:{},stateParseFailed:!0}}catch{return{runtimeState:{},stateParseFailed:!0}}}async function l1(e,t){let n=e.telemetry.endpoint.trim();return!t||!e.telemetry.enabled||n.length===0||Xr().telemetry_disabled?void 0:{attempted:!0,...await h1(n)}}function d1(e,t,n){let r=[];if(t.invalidRows>0&&r.push(`telemetry_queue_invalid_rows:${t.invalidRows}`),!e.telemetry.enabled||t.validEntries===0)return r;let o=n.last_successful_flush_at,i=n.last_failed_flush_at,s=i&&(!o||i>o),a=!o,c=t.validEntries>=Nj;return(s||a||c)&&r.push(`telemetry_queue_pending:${t.validEntries}`),t.highRetryEntries>0&&r.push(`telemetry_queue_high_retries:${t.highRetryEntries}`),r}function u1(e){return!e||e.ok!==!1?[]:typeof e.status=="number"?[`telemetry_endpoint_probe_http_status:${e.status}`]:["telemetry_endpoint_probe_failed"]}function f1(e){let t=Number.parseInt(e?.max_schema_version??"",10);return e?.ok===!0&&Number.isInteger(t)&&t>Sw?[`telemetry_schema_version_behind:${t}`]:[]}function m1(e,t){let n=typeof t.pending_otel_spans=="number"?t.pending_otel_spans:0,r=t.last_otel_success_at,o=t.last_otel_failure_at;return e.telemetry.enabled&&n>0&&!!o&&(!r||o>=r)?[`telemetry_otel_export_failing:${n}`]:[]}function p1(){return{...Xr(),pm_no_telemetry:Bf("PM_NO_TELEMETRY"),telemetry_otel_disabled:Bf("PM_TELEMETRY_OTEL_DISABLED"),telemetry_inline_flush:Bf("PM_TELEMETRY_INLINE_FLUSH"),telemetry_source_context:i1()}}function _1(e,t){return e.telemetry.enabled&&t.validEntries>0}function g1(e,t){return e&&t.every(n=>!n.startsWith("telemetry_queue_pending:")&&!n.startsWith("telemetry_queue_high_retries:"))}async function h1(e){let t=e;try{let n=new URL(e);n.pathname="/healthz",n.search="",n.hash="",t=n.toString()}catch{}try{let n=await fetch(t,{method:"GET",signal:AbortSignal.timeout(Rj)});return{probe_url:Vf(t),ok:n.ok,status:n.status,max_schema_version:(()=>{for(let r of Dj){let o=n.headers.get(r)?.trim();if(o&&o.length>0)return o}})()}}catch(n){return{probe_url:Vf(t),ok:!1,error:n instanceof Error?n.message:"probe_failed"}}}async function y1(e,t){let n=zn(process.cwd()),r=Xe.join(n,Oj),o=Xe.join(n,xj),i=await J(r),s=i!==null,a=i?Buffer.byteLength(i,"utf8"):0,c=i?s1(i):a1(),l=await J(o),{runtimeState:d,stateParseFailed:u}=c1(l),f=e.telemetry.endpoint.trim(),m=Vf(f),p=await l1(e,t.checkTelemetry),w=[];u&&w.push("telemetry_state_invalid_json"),w.push(...d1(e,c,d),...u1(p),...f1(p),...m1(e,d));let y=_1(e,c),b=typeof d.pending_otel_spans=="number"?d.pending_otel_spans:0;return{check:{name:"telemetry",status:w.length===0?"ok":"warn",ok:w.length===0,details:{enabled:e.telemetry.enabled,capture_level:e.telemetry.capture_level,endpoint:m,global_pm_root:n,queue_path:r,queue_exists:s,queue_entries:c.validEntries,queue_draining:g1(y,w),queue_invalid_rows:c.invalidRows,queue_rows_total:c.totalRows,queue_size_bytes:a,queue_high_retry_entries:c.highRetryEntries,queue_high_retry_threshold:Zv,queue_max_attempts:c.maxAttempts,runtime_state_path:o,last_attempted_flush_at:d.last_attempted_flush_at??null,last_successful_flush_at:d.last_successful_flush_at??null,last_failed_flush_at:d.last_failed_flush_at??null,last_failed_flush_error:d.last_failed_flush_error??null,pending_otel_spans:b,last_otel_attempt_at:d.last_otel_attempt_at??null,last_otel_success_at:d.last_otel_success_at??null,last_otel_failure_at:d.last_otel_failure_at??null,last_otel_failure_error:d.last_otel_failure_error??null,endpoint_probe:p??{attempted:!1},env_overrides:p1()}},warnings:w}}async function w1(e){let t;try{t=await Zy(e)}catch(r){let o=r instanceof Error?r.message:String(r);return{check:{name:"locks",status:"warn",ok:!1,details:{active_lock_count:0,stale_lock_count:0,unreadable_lock_count:0,unparseable_lock_count:0,scan_failed:!0,error:o,pm_root:e}},warnings:[`locks_scan_failed:${o}`]}}let n=[];return t.stale_lock_count>0&&n.push(`locks_stale_count:${t.stale_lock_count}`),t.unreadable_lock_count>0&&n.push(`locks_unreadable:${t.unreadable_lock_count}`),{check:{name:"locks",status:n.length===0?"ok":"warn",ok:n.length===0,details:{active_lock_count:t.active_lock_count,stale_lock_count:t.stale_lock_count,unreadable_lock_count:t.unreadable_lock_count,unparseable_lock_count:t.unparseable_lock_count}},warnings:n}}async function b1(e){let t="metadata",n=e.items,r=await _r(e.pmRoot,n,{cacheHitVerification:t}),o=[...new Set([...r.hashMismatches,...r.chainMismatches,...r.versionSkews])].sort((b,v)=>b.localeCompare(v)),i=[],s=[];if(o.length>0){n=await mr(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,e.itemReadWarnings,e.settings.schema,{forceSourceScan:!0}),r=await _r(e.pmRoot,n),i=[...new Set([...r.hashMismatches,...r.chainMismatches,...r.versionSkews])].sort((v,I)=>v.localeCompare(I));let b=new Set(i);s=o.filter(v=>!b.has(v))}let{missingStreams:a,unreadableStreams:c,hashMismatches:l,chainMismatches:d,versionSkews:u,driftedItems:f,workspaceStateMismatches:m,workspaceStateMissing:p,workspaceStateUnreadable:w}=r,y=[...a.map(b=>`history_drift_missing_stream:${b}`),...c.map(b=>`history_drift_unreadable_stream:${b}`),...l.map(b=>`history_drift_hash_mismatch:${b}`),...d.map(b=>`history_drift_chain_mismatch:${b}`),...u.map(b=>`history_drift_version_skew:${b}`),...m.map(b=>`history_drift_workspace_state_mismatch:${b}`),...p.map(b=>`history_drift_workspace_state_missing:${b}`),...w.map(b=>`history_drift_workspace_state_unreadable:${b}`)];return{check:{name:"history_drift",status:y.length===0?"ok":"warn",ok:y.length===0,details:{checked_items:n.length,cache_hit_verification:o.length>0?"metadata_then_content_hash":t,cache_confirmation:{triggered:o.length>0,reason:o.length>0?"cached_corruption_candidate":null,candidate_items:o,confirmed_items:i,resolved_false_positive_items:s,authoritative_item_source:o.length>0},drifted_items:f,counts:{drifted:f.length,missing_streams:a.length,unreadable_streams:c.length,hash_mismatches:l.length,chain_mismatches:d.length,version_skews:u.length,workspace_state_mismatches:m.length,workspace_state_missing:p.length,workspace_state_unreadable:w.length},missing_streams:a,unreadable_streams:c,hash_mismatches:l,chain_mismatches:d,version_skews:u,workspace_state_mismatches:m,workspace_state_missing:p,workspace_state_unreadable:w}},warnings:y}}function v1(e,t){let n=Qr(e),r=wi(n.settings),o=vi(n.settings,t),i=r.active?to(r.active.name,r.active.model):null;return{runtimeDefaults:n,providerResolution:r,vectorStoreResolution:o,runtimeEmbeddingIdentity:i,semanticRuntimeAvailable:!!(r.active&&o.active)}}function k1(){return{refreshed:[],skipped:[],warnings:[]}}async function E1(e){return!e.refreshPolicy.enabled||!e.snapshot.semanticRuntimeAvailable||e.staleBefore.length===0?k1():kw(e.pmRoot,e.staleBefore,{settings:e.snapshot.runtimeDefaults.settings,apply_runtime_defaults:!1})}function S1(e){return e.strictVectorizationWarnings&&e.semanticRuntimeAvailable&&!!(e.ledgerBefore.embedding&&e.runtimeEmbeddingIdentity&&ki(e.ledgerBefore.embedding,e.runtimeEmbeddingIdentity))}function T1(e){let t=new Set([...e.ledgerBefore.warnings,...e.ledgerAfter.warnings]);if(e.strictVectorizationWarnings)for(let n of e.refreshResult.warnings)t.add(n);return e.embeddingIdentityChanged&&t.add("vectorization_embedding_identity_changed"),e.strictVectorizationWarnings&&e.semanticRuntimeAvailable&&e.staleAfter.length>0&&t.add(`vectorization_stale_items_remaining:${e.staleAfter.length}`),[...t].sort((n,r)=>n.localeCompare(r))}function A1(e,t,n){return e.enabled&&t&&n.length>0?null:e.enabled?t?"no_stale_items":"semantic_runtime_unavailable":"refresh_disabled"}function I1(e,t){let n=t.providerResolution.active?.name??null,r=t.vectorStoreResolution.active?.name??null;return{provider_active:n,provider_configured:typeof e.search?.provider=="string"?e.search.provider:null,provider_source:Cu(n,e.search?.provider??null),vector_store_active:r,vector_store_configured:typeof e.vector_store?.adapter=="string"?e.vector_store.adapter:null,vector_store_source:Cu(r,e.vector_store?.adapter??null)}}function C1(e){return{enabled:e.enabled,check_only:e.checkOnly,no_refresh:e.noRefresh,refresh_vectors:e.refreshVectors}}function O1(e,t,n){return e.enabled&&n.length>0&&t}async function x1(e,t,n,r,o){let i=v1(t,e),s=await Ti(e),a=i.semanticRuntimeAvailable?Wu(n,s.entries):[],c=await E1({pmRoot:e,snapshot:i,refreshPolicy:r,staleBefore:a}),l=await Ti(e),d=i.semanticRuntimeAvailable?Wu(n,l.entries):[],u=!i.runtimeDefaults.auto_ollama_defaults_applied,f=S1({strictVectorizationWarnings:u,semanticRuntimeAvailable:i.semanticRuntimeAvailable,ledgerBefore:s,runtimeEmbeddingIdentity:i.runtimeEmbeddingIdentity}),m=T1({ledgerBefore:s,ledgerAfter:l,refreshResult:c,strictVectorizationWarnings:u,semanticRuntimeAvailable:i.semanticRuntimeAvailable,embeddingIdentityChanged:f,staleAfter:d}),p=Jv(a,o),w=Jv(d,o),y=O1(r,i.semanticRuntimeAvailable,a);return{check:{name:"vectorization",status:m.length===0?"ok":"warn",ok:m.length===0,details:{semantic_runtime_available:i.semanticRuntimeAvailable,compatibility_mode_auto_defaults:i.runtimeDefaults.auto_ollama_defaults_applied,auto_ollama_defaults_applied:i.runtimeDefaults.auto_ollama_defaults_applied,auto_ollama_defaults_skipped_reason:i.runtimeDefaults.auto_ollama_defaults_skipped_reason??null,auto_ollama_defaults_remediation:i.runtimeDefaults.auto_ollama_defaults_remediation??null,refresh_policy:C1(r),...I1(t,i),embedding_identity_changed:f,embedding_identity_before:s.embedding??null,embedding_identity_runtime:i.runtimeEmbeddingIdentity??null,items:n.length,ledger_entries_before:Object.keys(s.entries).length,stale_items_detail_mode:o?"full":"summary",stale_items_summary_limit:Xv,stale_items_before_total:p.total,stale_items_before:p.values,stale_items_before_truncated:p.truncated,refresh_attempted:y,refresh_skipped_reason:A1(r,i.semanticRuntimeAvailable,a),refresh_result:c,ledger_entries_after:Object.keys(l.entries).length,stale_items_after_total:w.total,stale_items_after:w.values,stale_items_after_truncated:w.truncated}},warnings:m}}function R1(e){let t=[];return e.id_prefix.trim().length===0&&t.push("settings:id_prefix_empty"),e.locks.ttl_seconds<=0&&t.push("settings:locks_ttl_non_positive"),t}function N1(e){let t=e.checkOnly===!0,n=e.refreshVectors===!0;if(n&&t)throw new g("--check-only cannot be combined with --refresh-vectors",_.USAGE);if(n&&e.noRefresh===!0)throw new g("--no-refresh cannot be combined with --refresh-vectors",_.USAGE);return{enabled:n,checkOnly:t,noRefresh:!n,refreshVectors:n}}var D1=new Set(["extensions","locks","search"]);function P1(e){let t=new Set(vc.filter(o=>o.length>0)),n=new Set,r=new Set(Object.values(je));for(let o of e.folders)t.has(o)&&!r.has(o)||(t.delete(o),n.add(o));for(let o of D1)t.delete(o),n.add(o);return{requiredDirs:[...t].sort((o,i)=>o.localeCompare(i)),optionalDirs:[...n].sort((o,i)=>o.localeCompare(i)),optionalDirSet:n}}async function L1(e,t,n){let{requiredDirs:r,optionalDirs:o,optionalDirSet:i}=P1(t),s=[],a=[],c=[];for(let l of[...r,...o]){let d=Xe.join(e,l);c.push(...await Le({path:d,scope:"project"})),!await tk(d)&&(i.has(l)?a.push(l):s.push(l))}return{requiredDirs:r,optionalDirs:o,missingRequiredDirs:s,missingOptionalDirs:a,missingDirs:n?[...s,...a]:[...s],hookWarnings:c}}function M1(e){let t=e.checkOnly===!0&&e.brief!==!0&&e.summary!==!0&&e.full!==!0,n=(e.summary===!0||t)&&e.full!==!0,r=e.checkOnly===!0&&(e.brief===!0||e.summary===!0)&&e.full!==!0;return{summaryMode:n,skipIntegrity:(e.skipIntegrity===!0||r)&&e.full!==!0,skipDrift:(e.skipDrift===!0||r)&&e.full!==!0,skipVectors:(e.skipVectors===!0||r)&&e.full!==!0}}async function $1(e){return e.skipPolicy.skipDrift&&e.skipPolicy.skipVectors?pi(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,e.itemReadWarnings,e.settings.schema):mr(e.pmRoot,e.settings.item_format,e.typeRegistry.type_to_folder,e.itemReadWarnings,e.settings.schema)}function Gf(e){return{check:{name:e,status:"ok",ok:!0,details:{skipped:!0}},warnings:[]}}function F1(e,t,n){return{name:"settings",status:n.length===0?"ok":"warn",ok:n.length===0,details:{path:e,version:t.version,id_prefix:t.id_prefix,locks_ttl_seconds:t.locks.ttl_seconds,warnings:n}}}function j1(e,t){return{name:"directories",status:e.missingDirs.length===0?"ok":"warn",ok:e.missingDirs.length===0,details:{required:e.requiredDirs,optional:e.optionalDirs,missing_required:e.missingRequiredDirs,missing_optional:e.missingOptionalDirs,missing:e.missingDirs,strict_directories:t}}}function U1(e,t){return{name:"settings_values",status:e.length===0?"ok":"warn",ok:e.length===0,details:{warnings:e,...t.roleless_status_count>0?{lifecycle_status_roles:t}:{}}}}var nk=e=>e.unknown_event_count??0,rk=e=>e.actionable_unknown_event_count??nk(e);function z1(e,t,n,r,o,i){let s=nk(r),a=rk(r),c=s>0,l=a>0,d=o.count>0;return{name:"storage",status:n.over_threshold.length===0&&n.orphaned.length===0&&!l&&!d?"ok":"warn",ok:n.over_threshold.length===0&&n.orphaned.length===0&&!l&&!d,details:{items:e.length,history_streams:n.count,tombstones:{retention_policy:"retain_append_only",gc_enabled:!1,count:n.tombstones.length,ids:n.tombstones.slice(0,25),truncated:n.tombstones.length>25},orphaned_history_streams:{count:n.orphaned.length,ids:n.orphaned.slice(0,25),truncated:n.orphaned.length>25},...c?{author_attribution:r}:{},...d?{stale_in_progress:o}:{},...i.outcomes.length>0?{provenance_resolver_outcomes:i.outcomes}:{},...i.invalid_values.length>0?{provenance_invalid_values:i.invalid_values}:{},provenance_sample:i.sample,...n.max_entries!==null?{compact_policy:{enabled:t.history.compact_policy.enabled,max_entries:n.max_entries,trigger:t.history.compact_policy.trigger,over_threshold_count:n.over_threshold.length,over_threshold:n.over_threshold}}:{}}}}function H1(e){let t=e.count===0?[]:[`stale_in_progress_items:${e.count}`];return{scan:e,warnings:t}}function q1(e){let t=[...e.directoryState.missingDirs.map(n=>`missing_directory:${n}`),...e.normalizedSettingsReadWarnings,...e.settingWarnings,...e.normalizedItemReadWarnings,...e.telemetryCheck.warnings,...e.extensionCheck.warnings,...e.historyPolicyWarnings,...e.historySummary.warnings,...e.authorAttributionWarnings,...e.staleInProgressWarnings,...e.provenanceWarnings,...e.locksCheck.warnings,...e.integrityCheck.warnings,...e.historyDriftCheck.warnings,...e.vectorizationCheck.warnings,...e.directoryState.hookWarnings];return[...new Set(t)]}function B1(e){let t=e.check.details.counts;return typeof t?.drifted=="number"?t.drifted:0}function G1(e){return{settings:e.normalizedSettingsReadWarnings,directories:e.directoryState.missingDirs.map(t=>`missing_directory:${t}`).concat(e.directoryState.hookWarnings),settings_values:e.settingWarnings,telemetry:e.telemetryCheck.warnings,extensions:e.extensionCheck.warnings,storage:[...e.historyPolicyWarnings,...e.historySummary.warnings,...e.authorAttributionWarnings,...e.staleInProgressWarnings,...e.provenanceWarnings],locks:e.locksCheck.warnings,integrity:[...e.normalizedItemReadWarnings,...e.integrityCheck.warnings],history_drift:e.historyDriftCheck.warnings,vectorization:e.vectorizationCheck.warnings}}function W1(e){let t=new Map;for(let[o,i]of Object.entries(e.remediationSources))for(let s of i)t.has(s)||t.set(s,o);let n=new Map(e.checks.map(o=>[o.name,o]));return e.warnings.map(o=>{let i=t.get(o)??"integrity",s=Yu(o)?.code??ek(o),a=n.get(i)?.details,l=(typeof a?.remediation_map=="object"&&a.remediation_map!==null?a.remediation_map:{})[s],d=Qv(o,e.requireMergeDrivers)?"advisory":"gate_failing";return{warning:o,code:s,check:i,severity:d,...typeof l=="string"?{remediation:l}:d==="gate_failing"?{disposition:"no_safe_automatic_remediation"}:{}}})}function V1(e){if(e.check.name==="history_drift"&&e.historyDriftedCount>1)for(let t of Object.keys(e.remediationMap))t!=="history_drift_merge_receipt"&&t!=="history_drift_version_skew"&&(e.remediationMap[t]="pm history-repair --all");if(e.check.name==="storage"&&e.overThresholdCount>1)for(let t of Object.keys(e.remediationMap))e.remediationMap[t]="pm history-compact --all-streams"}function K1(e){for(let t of e.checks){let n=Ju(e.remediationSources[t.name]);V1({check:t,remediationMap:n,historyDriftedCount:e.historyDriftedCount,overThresholdCount:e.overThresholdCount}),Object.keys(n).length>0&&(t.details={...t.details,remediation_map:n})}}async function Y1(e){if(e.gitWorkspaceRoot===null||e.pendingMergeReceipts.length===0)return[];let t=e.historyDriftCheck.check.details,n=Array.isArray(t.hash_mismatches)?t.hash_mismatches.filter(s=>typeof s=="string"):[],r=new Set([t.missing_streams,t.unreadable_streams,t.chain_mismatches].flatMap(s=>Array.isArray(s)?s:[])),o=new Map;for(let s of e.pendingMergeReceipts){if(s.evidence_source!=="clone_local")continue;let a=o.get(s.item_id)??[];a.push(s),o.set(s.item_id,a)}let i=[];for(let s of n){if(r.has(s))continue;let a=o.get(s);if(!(!a||a.length===0))try{await tn(s,{dryRun:!0,mergeReceiptProof:{gitWorkspaceRoot:e.gitWorkspaceRoot,receipts:a}},e.global),i.push(s)}catch{}}return[...new Set(i)].sort((s,a)=>s.localeCompare(a))}function J1(e,t){let n=new Set(t);e.warnings=[...e.warnings.filter(r=>r.startsWith("history_drift_hash_mismatch:")?!n.has(r.slice(r.indexOf(":")+1)):!0),...t.map(r=>`history_drift_merge_receipt:${r}`)].sort((r,o)=>r.localeCompare(o)),e.check.details={...e.check.details,merge_receipt_attributed_items:t}}function X1(e,t,n){let r=e.warning_count??e.warnings.length,o={...e,warning_count:r,warning_limit:hr,warnings_truncated:r>hr,warnings:e.warnings.slice(0,hr),findings:(e.findings??[]).filter(s=>e.warnings.slice(0,hr).includes(s.warning)||e.failed_because.includes(s.warning))},i=n?o1(o):t.brief===!0?r1(o):o;return{...i,warning_count:r,warning_limit:hr,warnings_truncated:r>i.warnings.length,...i.projection?{projection:{...i.projection,warning_count:r,warnings_truncated:r>i.warnings.length}}:{}}}async function Kf(e,t={}){let n=X(process.cwd(),e.path);await Me(n);let r=Ee(n),{settings:o,warnings:i}=await xn(n),s=[...new Set(i)],a=ge(o,Y()),c=t.strictDirectories===!0,l=t.strictExit===!0||t.failOnWarn===!0,d=t.requireMergeDrivers===!0||l,u=N1(t),f=await L1(n,a,c),m=R1(o),p=await y1(o,{checkTelemetry:t.checkTelemetry===!0}),w=await Xj(n,o,!!e.noExtensions),y=M1(t),b=[],v=await $1({pmRoot:n,settings:o,typeRegistry:a,skipPolicy:y,itemReadWarnings:b}),I=v,A=rc(at(o.schema),v),C=[...m,...oc(A)],P=y.skipDrift?{warnings:[]}:await Ia({pmRoot:n,settings:o,itemIds:v.map(Be=>Be.id),commandLabel:"health"}),S=await Mj(n,o.history.compact_policy,await Pj(n)),E=await Ja(n,20,t.verboseAuthorEvents===!0),z=rk(E),H=z>0?[`history_unknown_author_events:${z}`]:[],q=H1(await Zu(n,v,{in_progress_status:o.schema.workflow.in_progress_status,threshold_hours:o.mutation_guard.stale_in_progress_hours})),N=await Hy(n),pe=N.warnings,ne=await w1(n),ye=y.skipIntegrity&&!d?{...Gf("integrity"),gitWorkspaceRoot:null,pendingMergeReceipts:[]}:await qj(n,a.type_to_folder,o.schema,d,v),At=y.skipDrift?Gf("history_drift"):await b1({pmRoot:n,items:I,settings:o,typeRegistry:a,itemReadWarnings:b}),co=[...new Set(b)],rE=await Y1({gitWorkspaceRoot:ye.gitWorkspaceRoot,pendingMergeReceipts:ye.pendingMergeReceipts,historyDriftCheck:At,global:e});J1(At,rE);let pc=y.skipVectors?Gf("vectorization"):await x1(n,o,I,u,t.verboseStaleItems===!0),Hi=[F1(r,o,s),j1(f,c),U1(C,A),p.check,w.check,z1(v,o,S,E,q.scan,N),ne.check,ye.check,At.check,pc.check],_c=q1({directoryState:f,normalizedSettingsReadWarnings:s,settingWarnings:C,normalizedItemReadWarnings:co,telemetryCheck:p,extensionCheck:w,historyPolicyWarnings:P.warnings,historySummary:S,authorAttributionWarnings:H,staleInProgressWarnings:q.warnings,provenanceWarnings:pe,locksCheck:ne,integrityCheck:ye,historyDriftCheck:At,vectorizationCheck:pc}),fm=G1({directoryState:f,normalizedSettingsReadWarnings:s,settingWarnings:C,normalizedItemReadWarnings:co,telemetryCheck:p,extensionCheck:w,historyPolicyWarnings:P.warnings,historySummary:S,authorAttributionWarnings:H,staleInProgressWarnings:q.warnings,provenanceWarnings:pe,locksCheck:ne,integrityCheck:ye,historyDriftCheck:At,vectorizationCheck:pc});K1({checks:Hi,remediationSources:fm,historyDriftedCount:B1(At),overThresholdCount:S.over_threshold.length});let gc=_c.filter(Be=>!Qv(Be,d)),hc=W1({warnings:_c,checks:Hi,remediationSources:fm,requireMergeDrivers:d}),oE=new Set(hc.filter(Be=>Be.severity==="gate_failing").map(Be=>Be.check)),iE=new Set(hc.map(Be=>Be.check));for(let Be of Hi)Be.ok=!oE.has(Be.name),iE.has(Be.name)&&(Be.status="warn");let sE={ok:gc.length===0,verdict:{authority:"ok",...l?{strict_exit:!0}:{},...d?{require_merge_drivers:!0}:{},exit_code:l&&gc.length>0?_.GENERIC_FAILURE:0},checks:Hi,warnings:_c,findings:hc,failed_because:gc,generated_at:$()};return X1(sE,t,y.summaryMode)}(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]="b6ef0b23-e861-50ec-b7b3-751863936631")}catch{}})();function ok(e,t){let n=yt(e),r=e.length>0?e[e.length-1].after_hash:wd(),o=t===void 0||n.item_hash_version===void 0?void 0:Ur(t,n.item_hash_version,Oe(e.at(-1)?.hash_algorithm)),i=t===void 0?void 0:o===void 0?hd(t):o[Math.max(0,o.indexOf(r))],s=i===void 0?void 0:i===r,a=[...n.errors];return s===!1&&a.push("verify_failed:current_item_hash_mismatch"),{ok:a.length===0,entries:e.length,errors:a,latest_after_hash:e.length>0?e[e.length-1].after_hash:void 0,current_item_hash:i,current_matches_latest: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]="1e1d8d86-3f4e-50eb-ae73-ca7c030f7c0a")}catch{}})();function ik(e,t,n){if(!n.has(t.metadata.status))return{reason:"not_terminal"};if(e.length===0)return{reason:"missing_history"};if(!ok(e,t).ok)return{reason:"unverified_history"};let r=or(),o={reason:"no_proven_transition"};for(let[i,s]of e.entries()){let a=n.has(String(r.metadata.status));r=Yr(r,s.patch,i+1,s.op),n.has(String(r.metadata.status))?a||(o=["create","close","cancel","update","update_audit"].includes(s.op)&&fn(s.ts)?{timestamp:s.ts,source_index:i+1}:{reason:"no_proven_transition"}):o={reason:"no_proven_transition"}}return o}function sk(e){return new Set([...e.terminal_statuses,...[...e.alias_to_id].filter(([,t])=>e.terminal_statuses.has(t)).map(([t])=>t)])}async function ak(e,t,n,r,o){let i=sk(n),s=t.filter(l=>i.has(l.status)&&!l.closed_at),a=[],c=[];for(let l of r?s:[]){let d;try{let u=await nt(ke(e,l.id),l.id),{body:f,...m}=l;d=ik(u,{metadata:m,body:f},i)}catch{c.push({id:l.id,reason:"unreadable_history"});continue}if("reason"in d){c.push({id:l.id,reason:d.reason});continue}a.push({item_id:l.id,check:"metadata",field:"closed_at",kind:"set_closed_at",value:d.timestamp,gate:"timestamps",command:"pm validate --check-metadata --auto-fix --fix-scope timestamps"})}return{details:{missing_closed_at_count:s.length,missing_closed_at_item_ids:s.slice(0,o).map(l=>l.id),missing_closed_at_item_ids_truncated:s.length>o,closure_history_inspected:r,closure_timestamp_derivable_count:a.length,closure_timestamp_residual_count:c.length,closure_timestamp_residual:c.slice(0,o),closure_timestamp_residual_truncated:c.length>o,...s.length>0?{closure_timestamp_fix_hint:"pm validate --check-metadata --auto-fix --fix-scope timestamps --dry-run"}:{}},fixes:a,warnings:s.length>0?[`validate_metadata_missing_closed_at:${s.length}`]:[]}}async function ck(e,t){let n=X(process.cwd(),t.path),r=await re(n),o=at(r.schema);await pr({pmRoot:n,settings:r,id:e.item_id,op:"update",author:Te(t.author,r.author_default),message:"Backfill closed_at from verified lifecycle history",skipNoop:!0,async mutate(i){if(i.metadata.closed_at)return{changedFields:[]};let s=await nt(ke(n,i.metadata.id),i.metadata.id),a=sk(o),c=ik(s,i,a);if(!("timestamp"in c)||c.timestamp!==e.value)throw new g("Closure timestamp evidence changed or cannot be verified; rerun the timestamp repair preview.",_.GENERIC_FAILURE);return i.metadata.closed_at=c.timestamp,{changedFields:["closed_at"]}}})}import um from"node:fs/promises";import{realpathSync as az}from"node:fs";import{execFile as cz}from"node:child_process";import Ze from"node:path";import{promisify as lz}from"node:util";(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]="c1b189d7-2939-5891-b936-5f208dc8f5ff")}catch{}})();var Z1=["metadata","resolution"],Yf=["metadata","resolution","estimates","timestamps","lifecycle"],Q1="completed";function Jf(e){return`"${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`}function lk(e){let t=e?.trim();return t!==void 0&&t.length>0?t:void 0}function dk(e){let t=[];for(let n of e){if(!n.missing_fields.includes("resolution"))continue;let r=lk(n.close_reason)??Q1;t.push({item_id:n.id,check:"resolution",field:"resolution",kind:"set_resolution",value:r,command:`pm update ${n.id} --resolution ${Jf(r)}`,gate:"resolution"})}return t}function uk(e){let t=[];for(let n of e){let r=lk(n.resolution);r!==void 0&&t.push({item_id:n.id,check:"metadata",field:"close_reason",kind:"set_close_reason",value:r,command:`pm update ${n.id} --close-reason ${Jf(r)}`,gate:"metadata"})}return t}function fk(e,t){return e.map(n=>{let r=Ch(n.type,t);return{item_id:n.id,check:"metadata",field:"estimated_minutes",kind:"set_estimate",value:String(r),command:`pm update ${n.id} --estimate ${r}`,gate:"estimates"}})}function mk(e){return e.map(t=>t.grandparent_id!==void 0&&t.grandparent_active===!0?{item_id:t.id,check:"lifecycle",field:"parent",kind:"reparent",parent_id:t.grandparent_id,command:`pm update ${t.id} --parent ${t.grandparent_id}`,gate:"lifecycle"}:{item_id:t.id,check:"lifecycle",field:"parent",kind:"unset_parent",command:`pm update ${t.id} --unset parent`,gate:"lifecycle"})}function pk(e){let t=[];for(let n of e){if(n.classification!=="deleted")continue;let r=n.link_kind==="files"?"files":"docs";t.push({item_id:n.item_id,check:"files",field:n.link_kind,kind:n.link_kind==="files"?"prune_file_link":"prune_doc_link",path:n.path,command:`pm ${r} ${n.item_id} --remove ${Jf(n.path)}`})}return t}function _k(e){let t=(e??[]).flatMap(r=>r.split(",")).map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0){if(e!==void 0&&e.length>0)throw new g(`--fix-scope values must not be empty. Supported values: ${Yf.join(", ")}.`,_.USAGE);return new Set(Z1)}let n=new Set;for(let r of t){let o=r.toLowerCase().replaceAll("-","_");if(Yf.includes(o)){n.add(o);continue}throw new g(`Unknown --fix-scope value "${r}". Supported values: ${Yf.join(", ")}.`,_.USAGE)}return n}function gk(e,t){let n=[],r=[];for(let o of e)o.gate!==void 0&&!t.has(o.gate)?r.push(o):n.push(o);return{applicable:n,gated:r}}function $i(e){return{item_id:e.item_id,check:e.check,field:e.field,command:e.command,...e.gate!==void 0?{gate:e.gate}:{}}}(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]="3b09b58f-2ec7-523e-87f3-8d828deb8480")}catch{}})();var eU=/^([A-Z][A-Z0-9]*-\d+)\b/iu;function tU(e,t={}){if(typeof e!="string")return null;let n=e.trim();if(n.length===0)return null;let r=eU.exec(n);if(!r)return null;let o=r[1],i=o.toUpperCase(),s=o.slice(0,o.lastIndexOf("-")),a=new Set((t.configuredPrefixes??[]).map(f=>f.trim().replace(/-+$/u,"").toUpperCase())),c=n.slice(o.length),l=t.evidenceText?.toUpperCase()??"",d=l.includes(`ISSUE CODE: ${i}`)||l.includes(`ISSUE CODE \`${i}\``)||l.includes(`\`${i}\``)||l.includes(`[${i}]`);return s===s.toUpperCase()||/^\s*(?::|—|–|\])/u.test(c)||a.has(s.toUpperCase())||d?i:null}function hk(e){return typeof e=="string"&&e.trim().length>0}function nU(e){let t=new Set(e.map(a=>a.id.toLowerCase())),n=new Map,r=new Map;for(let a of e){let c=a.id.toLowerCase(),l=new Set([...a.parent===null?[]:[a.parent.toLowerCase()],...a.derivations].filter(d=>d!==c&&t.has(d)));n.set(c,l);for(let d of l){let u=r.get(d)??[];u.push(c),r.set(d,u)}}let i=[...[...n].filter(([,a])=>a.size===0).map(([a])=>a)],s=new Set;for(let a=0;a<i.length;a+=1)for(let c of r.get(i[a])??[]){let l=n.get(c);l.delete(i[a]),l.size===0&&(s.add(c),i.push(c))}return e.filter(a=>!s.has(a.id.toLowerCase()))}function yk(e,t={}){let n=new Map;for(let o of e){if(typeof o.title!="string"||hk(o.duplicate_of))continue;let i=tU(o.title,{...t,evidenceText:o.body});if(i===null)continue;let s=n.get(i);s||(s=[],n.set(i,s)),s.some(a=>a.id===o.id)||s.push({id:o.id,title:o.title,parent:hk(o.parent)?o.parent.trim():null,derivations:(o.dependencies??[]).filter(a=>["discovered_from","supersedes","incident_from"].includes(a.kind)).map(a=>a.id.trim().toLowerCase()).filter(a=>a!==o.id.toLowerCase())})}let r=[];for(let[o,i]of n){if(i.length<2)continue;let s=nU(i);if(s.length<2)continue;let a=[...s].sort((c,l)=>c.id.localeCompare(l.id));r.push({code:o,count:a.length,ids:a.map(c=>c.id),titles:a.map(c=>c.title)})}return r.sort((o,i)=>o.code.localeCompare(i.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]="b51a9fba-7bbe-573b-a708-5ffea6fa040f")}catch{}})();function wk(e){let t=new Map;for(let r of e){let o=t.get(r.item_type);o||(o=new Map,t.set(r.item_type,o)),o.set(r.field,(o.get(r.field)??0)+1)}let n={};for(let r of[...t.keys()].sort((o,i)=>o.localeCompare(i))){let o=t.get(r),i={};for(let s of[...o.keys()].sort((a,c)=>a.localeCompare(c)))i[s]=o.get(s);n[r]=i}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]="ede22770-cb10-5054-85a7-89bb2758c25f")}catch{}})();var bk=3;function vk(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function kk(e,t,n=bk){let r=Number.isFinite(n)&&n>=1?Math.floor(n):bk,o=new Map;for(let i of t){let s=vk(i);if(s.length===0)continue;let a=o.get(s);a?a.push(i):o.set(s,[i])}return e.map(i=>{if(i.includes(",")||i.replace(/^[a-z]:[\\/]/i,"").includes(":"))return{path:i,classification:"malformed",candidates:[],candidates_truncated:!1};let s=(o.get(vk(i))??[]).filter(a=>a!==i).sort((a,c)=>a.localeCompare(c));return s.length===0?{path:i,classification:"deleted",candidates:[],candidates_truncated:!1}:{path:i,classification:"moved",candidates:s.slice(0,r),candidates_truncated:s.length>r}})}function Ek(e){return e.map(t=>t.classification==="moved"?`${t.path}:moved:${t.candidates[0]}`:`${t.path}:${t.classification}`)}(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]="6f94fb3c-3d6c-5543-a2f0-e12680459e71")}catch{}})();var rU=/^[a-z][a-z0-9+.-]+:\/\//i;function Fi(e){return rU.test(e.trim())}(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]="e2cd8850-491a-505c-8709-3dcdb758de75")}catch{}})();function oU(e,t){return e==="malformed"||t==="malformed"?"malformed":e==="moved"||t==="moved"?"moved":"deleted"}function Sk(e){return`${e.item_id} ${e.link_kind}`}function Tk(e,t){let n=new Map;for(let r of e){let o=n.get(r.path);o?(o.classification=oU(o.classification,r.classification),o.owners.set(Sk(r),r)):n.set(r.path,{classification:r.classification,owners:new Map([[Sk(r),r]])})}return[...n.entries()].sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>({path:r,classification:o.classification,items:[...o.owners.values()].map(i=>{let s=t(i.item_id);return{id:i.item_id,type:s?.type??"Unknown",title:s?.title??"",status:s?.status??"",field:i.link_kind}}).sort((i,s)=>{let a=i.id.localeCompare(s.id);return a!==0?a:i.field.localeCompare(s.field)})}))}(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]="ccb0d064-940b-5e14-ae63-2803aced4ee7")}catch{}})();function Ak(e,t,n,r,o=40){let i=o===1/0?1/0:Number.isFinite(o)?Math.max(0,Math.floor(o)):40,s=new Map(t.map(l=>[l.path,l])),a={missing_linked_path_rows_count:0,missing_linked_path_rows:[],missing_linked_path_rows_truncated:!1,missing_linked_links_count:0,active_missing_linked_links_count:0,legacy_closed_missing_linked_links_count:0,legacy_terminal_missing_linked_links_count:0,active_missing_linked_paths_count:0},c=Tk(e,n).map(l=>{let d=[],u=[];for(let m of l.items){let p=Ct(m.status,r)??m.status;r.terminal_statuses.has(p)?(u.push(m),p===r.close_status&&(a.legacy_closed_missing_linked_links_count+=1)):d.push(m)}a.missing_linked_links_count+=l.items.length,a.active_missing_linked_links_count+=d.length,a.legacy_terminal_missing_linked_links_count+=u.length,d.length>0&&(a.active_missing_linked_paths_count+=1);let f=s.get(l.path);return{...l,candidates:f?.candidates??[],candidates_truncated:f?.candidates_truncated??!1,link_count:l.items.length,active_link_count:d.length,items:[...d,...u].slice(0,i),items_truncated:l.items.length>i}});return c.sort((l,d)=>+(d.active_link_count>0)-+(l.active_link_count>0)||l.path.localeCompare(d.path)),a.missing_linked_path_rows_count=c.length,a.missing_linked_path_rows=c.slice(0,i),a.missing_linked_path_rows_truncated=c.length>i,a}import so from"node:fs/promises";import ao 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]="9bcae2f2-3739-5ef8-b080-daaaf7df2681")}catch{}})();async function iU(e,t){let n=[...new Set(Object.values(t))],r=[];return await Promise.all(n.map(async o=>{let i;try{i=await so.readdir(ao.join(e,o))}catch{return}for(let s of i)for(let a of Gt)if(s.toLowerCase().endsWith(a)){r.push({relativePath:`${o}/${s}`,id:s.slice(0,-a.length)});break}})),r.sort((o,i)=>o.relativePath.localeCompare(i.relativePath))}function sU(e,t){let{id:n,relativePath:r,liveItemIds:o,out:i}=e,s=De(t);if(s){i.conflictMarkers.push({id:n,path:r,line:s.line,detail:`unresolved merge conflict marker ${s.marker}`});return}let a=aU(e,t);a!==null&&(a.op==="delete"&&o.has(n)&&i.resurrected.push({id:n,deleted_at:typeof a.ts=="string"?a.ts:"",deleted_by:typeof a.author=="string"?a.author:""}),a.op==="history_repair"&&Array.isArray(a.patch)&&a.patch.length>0&&(i.repairReconciliations+=1))}function aU(e,t){let{id:n,relativePath:r,out:o}=e,i=null,s=!1,a=t.split(/\r?\n/).map((c,l)=>({content:c.trim(),number:l+1})).filter(c=>c.content.length>0);for(let c of a){try{let l=JSON.parse(c.content);if(typeof l!="object"||l===null||Array.isArray(l))throw new TypeError("history entry must be an object");i=l}catch{return o.unparseable.push({id:n,path:r,line:c.number,detail:"history line is not a valid JSON object"}),null}if(i.op==="create"){if(s)return o.unparseable.push({id:n,path:r,line:c.number,detail:"duplicate item identity: more than one create event in one history stream"}),null;s=!0}}return i}function Xf(e,t){let n=typeof t=="object"&&t!==null&&"code"in t&&typeof t.code=="string"?t.code:"UNKNOWN";return`${e} could not be read (error code: ${n})`}async function cU(e,t){let n={conflictMarkers:[],unparseable:[],resurrected:[],repairReconciliations:0,scanned:0},r;try{r=await so.readdir(ao.join(e,"history"))}catch{return n}for(let o of r.sort((i,s)=>i.localeCompare(s))){if(!o.endsWith(".jsonl"))continue;n.scanned+=1;let i;try{i=await so.readFile(ao.join(e,"history",o),"utf8")}catch(s){n.unparseable.push({id:o.slice(0,-6),path:`history/${o}`,detail:Xf("history stream",s)});continue}sU({id:o.slice(0,-6),relativePath:`history/${o}`,liveItemIds:t,out:n},i)}return n}function Ik(e){let t=De(e);if(t)return`unresolved merge conflict marker ${t.marker} at line ${t.line}`;try{return JSON.parse(e),null}catch(n){return`invalid JSON (${String(n)})`}}async function lU(e){let t=[],n=0,r=null;try{r=await J(Ee(e))}catch(i){n+=1,t.push({path:"settings.json",detail:Xf("configuration file",i)})}if(r!==null){n+=1;let i=Ik(r);i!==null&&t.push({path:"settings.json",detail:i})}let o;try{o=await so.readdir(ao.join(e,"schema"))}catch{return{scanned:n,unparseable:t}}for(let i of o.sort((s,a)=>s.localeCompare(a))){if(!i.endsWith(".json"))continue;n+=1;let s;try{s=await so.readFile(ao.join(e,"schema",i),"utf8")}catch(c){t.push({path:`schema/${i}`,detail:Xf("configuration file",c)});continue}let a=Ik(s);a!==null&&t.push({path:`schema/${i}`,detail:a})}return{scanned:n,unparseable:t}}async function Ck(e,t,n,r={}){let o=await iU(e,n),i=new Set(o.map(u=>u.id)),s=new Map;for(let u of o){let f=s.get(u.id);f===void 0?s.set(u.id,[u.relativePath]):f.push(u.relativePath)}let a=[...s.entries()].filter(([,u])=>u.length>1).map(([u,f])=>({id:u,paths:[...f].sort((m,p)=>m.localeCompare(p))})).sort((u,f)=>u.id.localeCompare(f.id)),c=(await Promise.all(o.map(async u=>{if(!t.has(u.id))return{path:u.relativePath,id:u.id};try{let f=ao.join(e,u.relativePath);return We(await so.readFile(f,"utf8"),{format:f.toLowerCase().endsWith(".md")?"json_markdown":"toon",schema:r.schema,extensionFieldNames:r.extensionFieldNames}),null}catch{return{path:u.relativePath,id:u.id}}}))).filter(u=>u!==null),l=await cU(e,i),d=await lU(e);return{item_files_on_disk:o.length,item_ids_on_disk:i.size,parsed_items:t.size,unreadable_item_files:c,duplicate_item_ids:a,history_streams_scanned:l.scanned,history_conflict_marker_streams:l.conflictMarkers,history_unparseable_streams:l.unparseable,resurrected_items:l.resurrected,history_repair_reconciliations:l.repairReconciliations,config_files_scanned:d.scanned,unparseable_config_files:d.unparseable}}import dU from"node:fs/promises";import pt from"node:path";import uU from"fast-glob";(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]="02743545-3a44-565d-932c-7fe736d17eb8")}catch{}})();var fU=["path","scope","note"],mU=["pattern","glob","path","scope","note"],pU=["path"],_U=["from","to"],gU=new Set(["note","scope"]);function xk(e){let t=e??"project";if(!Tc.includes(t))throw new g(`Invalid scope "${e}". Valid scopes: ${Tc.join(", ")} (default: project).`,_.USAGE);return t}function Zf(e){if(e.startsWith("```")||e.includes(`
122
122
  `)||/^(?:[-*+]\s+)?(?:path|scope|note)\s*[:=]/i.test(e))return!0;let t=e.indexOf(","),n=e.slice(0,t>=0?t:e.length),r=n.indexOf("=");return r>=0&&!/\s/u.test(e)&&(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e)||/^(?:[A-Za-z]:[\\/]|[\\/]{1,2}|\.\.?(?:[\\/]))/u.test(e)||[e.indexOf("/"),e.indexOf("\\")].some(o=>o>=0&&o<r))?!1:n.includes("=")||Sd(e)}function hU(e){let t=0;for(let n of e)if(n==="("&&(t+=1),n===")"&&(t-=1),t<0)return!1;return t===0}function yU(e){if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e)&&!Zf(e))return{path:e,scope:"project",note:void 0};let t=e.indexOf("](");if(e.startsWith("[")&&t>0&&e.endsWith(")")){let i=e.slice(t+2,-1).trim();if(i.length>0&&hU(i))return{path:i,scope:"project",note:e.slice(1,t).trim()||void 0}}let n=e.indexOf(",");if(n<0)return;let r=e.slice(0,n).trim(),o=e.slice(n+1).trim();if(!(r.length===0||!/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(o)))return{path:o,scope:"project",note:r}}function wU(e,t){return e?e.flatMap(n=>{let r=n.trim();if(t==="doc"){let i=yU(r);if(i!==void 0)return[i]}eh(r,"--add",`${t} path`,Zf(r));let o=Zf(r)?Br(n,"--add"):{path:r};if(Gr(o,"--add",fU),!o.path)throw new g(`--add requires path=<value> or a bare ${t} path`,_.USAGE);return[{path:o.path,scope:xk(o.scope),note:o.note?.trim()||void 0}]}):[]}function bU(e){return e?e.map(t=>{let n=t.trim();if(!n)throw new g("--add-glob requires a glob pattern value",_.USAGE);if(n.includes("=")||/^(?:[-*+]\s+)?(?:pattern|glob|path)\s*[:=]/i.test(n)||n.startsWith("```")){let r=Br(n,"--add-glob");Gr(r,"--add-glob",mU);let o=r.pattern?.trim()||r.glob?.trim()||r.path?.trim();if(!o)throw new g("--add-glob key/value form requires pattern=<glob>",_.USAGE);return{pattern:o,scope:xk(r.scope),note:r.note?.trim()||void 0}}return{pattern:n,scope:"project"}}):[]}function vU(e){return e?e.map(t=>{let n=t.trim();if(!n)throw new g("--remove requires a path value",_.USAGE);if(n.includes("=")||/^(?:[-*+]\s+)?path\s*[:=]/i.test(n)||n.startsWith("```")){let r=Br(n,"--remove"),o=Object.keys(r).filter(i=>gU.has(i.toLowerCase()));if(o.length>0)throw new g(`--remove identifies a linked artifact by path only and does not accept ${o.map(i=>`"${i}"`).join(", ")}. Pass just the path (path=<value>, path:<value>, or a bare path); record removal context with --message "<why removed>".`,_.USAGE);if(Gr(r,"--remove",pU),!r.path)throw new g("--remove key/value form requires path=<value>",_.USAGE);return r.path}return n}):[]}function kU(e){return e?e.map(t=>{let n=Br(t,"--migrate");Gr(n,"--migrate",_U);let r=n.from?.trim(),o=n.to?.trim();if(!r||!o)throw new g("--migrate requires from=<value> and to=<value>",_.USAGE);return{from:r,to:o}}):[]}function ji(e,t){let n=e;for(let r of t)n.startsWith(r.from)&&(n=`${r.to}${n.slice(r.from.length)}`);return n}function EU(e,t,n=[]){if(e.length===0||t.length===0)return;let r=new Set(e.map(i=>ji(i.path,n))),o=[...new Set(t.map(i=>ji(i,n)).filter(i=>r.has(i)))].sort((i,s)=>i.localeCompare(s));if(o.length!==0)throw new g(`Linked artifact mutation cannot add and remove the same normalized path in one transaction: ${o.join(", ")}. Split the replacement into separate commands so each history event has one unambiguous intent.`,_.USAGE,{code:"linked_artifact_mutation_conflict",reason:"same_path_added_and_removed",required:"Use distinct normalized paths for --add and --remove in one invocation.",why:"Conflicting batch intent cannot be applied deterministically without silently discarding metadata or a removal.",nextSteps:["Run the removal and addition as separate commands with a --message describing each intent."]})}function ic(e){return e.split(pt.sep).join("/")}function Qf(e,t,n=process.cwd()){let r=e.trim();if(Fi(r))return r;if(pt.isAbsolute(r)||/^[A-Za-z]:[\\/]/.test(r))return ic(r.replaceAll("\\",pt.sep));let o=pt.relative(t,n);return o.startsWith(`..${pt.sep}`)||o===".."||pt.isAbsolute(o)?ic(pt.normalize(r)):ic(pt.relative(t,pt.resolve(n,r)))}async function SU(e,t=process.cwd(),n=process.cwd()){let r=[];for(let o of e){let i=pt.isAbsolute(o.pattern),s=await uU(o.pattern,{cwd:n,absolute:i,onlyFiles:!0,dot:!0,unique:!0,followSymbolicLinks:!0}),a=[...new Set(s.map(c=>Qf(c,t,n)))].sort((c,l)=>c.localeCompare(l));for(let c of a)r.push({path:c,scope:o.scope,note:o.note})}return r}function TU(e,t,n){if(t===void 0)return e;if(!n)throw new g("--note requires --add or --add-glob in the same invocation (the note annotates the links being added)",_.USAGE);let r=t.trim();return r.length===0?e:e.map(o=>o.note===void 0?{...o,note:r}:o)}function AU(e){return`${e.path}::${e.scope}`}function Rk(e){return[...e].sort((t,n)=>{let r=t.path.localeCompare(n.path);return r!==0?r:t.scope.localeCompare(n.scope)})}function Nk(e){return[...new Map(e.map(t=>[AU(t),t])).values()].map(t=>({...t,note:t.note?.trim()||void 0}))}async function IU(e,t=process.cwd()){let n=[...new Set(e)].sort((a,c)=>a.localeCompare(c)),r=[],o=[],i=[],s=[];for(let a of n){if(Fi(a)){s.push(a.trim());continue}let c=pt.isAbsolute(a)?a:pt.resolve(t,a);try{(await dU.stat(c)).isFile()?r.push(a):i.push(a)}catch(l){if(typeof l=="object"&&l!==null&&"code"in l&&gt(l)){o.push(a);continue}i.push(a)}}return{checked:n.length,existing_files:r,missing_paths:o,non_file_paths:i,remote_references:s}}function CU(e,t,n,r){let o=0;for(let s=0;s<e.length;s+=1){let a=ji(e[s].path,r);a!==e[s].path&&(e[s]={...e[s],path:a},o+=1)}return{adds:t.map(s=>{let a=ji(s.path,r);return a!==s.path&&(o+=1),{...s,path:a}}),removes:n.map(s=>ji(s,r)),count:o}}function OU(e,t,n,r){for(let i of t)e.some(s=>s.path===i.path&&s.scope===i.scope)||e.push(i);if(n.length>0)for(let i=e.length-1;i>=0;i-=1)n.includes(e[i].path)&&e.splice(i,1);let o=Nk(e);return r?o:Rk(o)}async function Ok(e){let t=e.artifacts.map(n=>n.path);return{id:e.id,artifacts:e.artifacts,changed:e.changed,count:e.artifacts.length,migrations_applied:e.migrationsApplied&&e.migrationsApplied>0?e.migrationsApplied:void 0,validation:e.options.validatePaths||e.changed?await IU(t,e.workspaceRoot):void 0}}async function sc(e,t,n,r){let{metadataKey:o}=r,i=Wo(),s=X(process.cwd(),n.path),a=hn(s),c=process.cwd();await Me(s);let l=await re(s),d=ge(l,Y()),u=await i.resolveList(t.add,"--add"),f=await i.resolveList(t.addGlob,"--add-glob"),m=await i.resolveList(t.remove,"--remove"),p=await i.resolveList(t.migrate,"--migrate"),w=wU(u,r.bareNoun).map(q=>({...q,path:Qf(q.path,a,c)})),y=bU(f),b=await SU(y,a,c),v=TU([...w,...b],t.note,w.length>0||y.length>0),I=vU(m).map(q=>Qf(q,a,c)),A=kU(p);if(EU(v,I,A),!(v.length>0||I.length>0||A.length>0)){let q=await Fe(s,e,l.id_prefix,l.item_format,d.type_to_folder);if(!q)throw new g(`Item ${e} not found`,_.NOT_FOUND);let pe=(await Ye(q,{schema:l.schema})).document.metadata[o]??[];return Ok({id:q.id,artifacts:pe,changed:!1,options:t,workspaceRoot:a})}let P=Te(t.author,l.author_default),S=await pr({pmRoot:s,settings:l,id:e,op:r.op,author:P,message:t.message,force:t.force,skipNoop:!0,mutate(q){let N=q.metadata,pe=N[o]??[],ne=[...pe],ye=CU(ne,v,I,A),At=OU(ne,ye.adds,ye.removes,r.supportsAppendStable&&t.appendStable===!0);At.length>0?N[o]=At:delete N[o];let co=!xe(pe,At);return{changedFields:co?[o]:[],warnings:co&&ye.count>0?[`path_migrations_applied:${ye.count}`]:[]}}}),E=S.item[o]??[],z=S.warnings.find(q=>q.startsWith("path_migrations_applied:")),H=z?Number(z.slice(24)):0;return Ok({id:S.item.id,artifacts:E,changed:S.changedFields.includes(o),migrationsApplied:H,options:t,workspaceRoot:a})}function ac(e,t){let n={};for(let[r,o]of Object.entries(e))n[r==="artifacts"?t:r]=o;return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aef928ec-4a5b-5614-bb5c-cbf63f891845")}catch{}})();async function Dk(e,t,n){let r=await sc(e,t,n,{metadataKey:"docs",op:"docs_add",bareNoun:"doc",supportsAppendStable:!1});return ac(r,"docs")}(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]="1d4534aa-5a56-5a76-8971-aa3ba6c52e59")}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]="573da024-c791-5ff2-b3ee-3529804bab43")}catch{}})();async function Pk(e,t,n){let r=await sc(e,t,n,{metadataKey:"files",op:"files_add",bareNoun:"file",supportsAppendStable:!0});return ac(r,"files")}import{readFileSync as xU}from"node:fs";import cc 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]="e69d7d9b-9ae8-5337-9ea3-a8e40a62d3af")}catch{}})();var RU=new Set(["get","history","restore","update","close","delete","append","claim","release","comments","notes","learnings","files","docs","deps","test"]),$k=new Set(["--pm-path","--path","--author"]),NU={get:new Set(["--depth","--fields","--tree-depth","--tree_depth","--at","--format"]),history:new Set(["--limit","--field","--format"]),restore:new Set(["--message"]),update:new Set(["--title","-t","--description","-d","--body","-b","--status","-s","--close-reason","--close_reason","--priority","-p","--type","--tags","--add-tags","--add_tags","--remove-tags","--remove_tags","--deadline","--estimated-minutes","--estimate","--estimated_minutes","--acceptance-criteria","--ac","--acceptance_criteria","--definition-of-ready","--definition_of_ready","--order","--rank","--goal","--objective","--value","--impact","--outcome","--why-now","--why_now","--message","--assignee","--parent","--reviewer","--risk","--confidence","--sprint","--release","--blocked-by","--blocked_by","--blocked-reason","--blocked_reason","--unblock-note","--unblock_note","--reporter","--severity","--environment","--repro-steps","--repro_steps","--resolution","--expected-result","--expected_result","--expected","--actual-result","--actual_result","--actual","--affected-version","--affected_version","--fixed-version","--fixed_version","--component","--regression","--customer-impact","--customer_impact","--dep","--dep-remove","--dep_remove","--comment","--note","--learning","--file","--test","--doc","--reminder","--event","--type-option","--type_option","--field","--unset","--body-file"]),close:new Set(["--reason","-r","--close-reason","--duplicate-of","-d","--message","-m","--validate-close","--resolution","--expected-result","--expected_result","--expected","--actual-result","--actual_result","--actual"]),delete:new Set(["--message"]),append:new Set(["--body","--text","--message"]),claim:new Set(["--assignee","--message","--type","--tag","--priority","--assignee-filter","--parent","--sprint","--release","--max-attempts"]),release:new Set(["--assignee","--message"]),comments:new Set(["--add","--body","--comment","--file","--edit","--delete","--limit","--message"]),notes:new Set(["--add","--file","--edit","--delete","--limit","--message"]),learnings:new Set(["--add","--file","--edit","--delete","--limit","--message"]),files:new Set(["--add","--add-glob","--remove","--migrate","--note","--message"]),docs:new Set(["--add","--add-glob","--remove","--migrate","--note","--message"]),deps:new Set(["--format","--max-depth","--collapse","--node-limit","--edge-limit","--token-budget","--cursor","--direction","--kind"]),test:new Set(["--add","--add-json","--remove","--match","--only-index","--timeout","--env-set","--env-clear","--pm-context","--message"])},DU=new Set(["-p","--package"]),PU=new Set(["-c","--call"]),LU=new Set(["-c","-C","--config","--dir","--filter","--workspace-dir"]),MU=new Set(["-C","--prefix","--userconfig","--cache"]);var $U=new Set(["exec","x"]);function FU(e){return e.split(/&&|\|\||\||;/).map(t=>t.trim()).filter(t=>t.length>0)}function jU(e,t=process.cwd()){let n=UU(e.split(" ").filter(s=>s.length>0));if(n.length===0)return null;let[r,...o]=n;if(Lk(r)||Mk(r,t))return o;if(r==="node"&&o[0]&&Mk(o[0],t))return o.slice(1);let i=r==="npx"||r==="bunx"?em(o):r==="pnpm"?qU(o):r==="npm"?BU(o):null;return i&&(Lk(i.command)||HU(i.command))?i.args:null}var Fk=(e,t="pm")=>{let n=t.trim().toLowerCase(),r=n.length;for(;r>0&&n[r-1]==="-";)r-=1;let o=n.slice(0,r);if(o.length===0)return[];let i=e.trim().replaceAll("\\","/").replaceAll('"',"").replaceAll("'","").replaceAll(/\s+/g," ").toLowerCase(),s=new Set;for(let a of FU(i)){let c=jU(a),l=c?GU(c):null,d=l&&RU.has(l.subcommand)?WU(l.remaining,NU[l.subcommand]):void 0,u=d?.trim().toLowerCase();u?.startsWith(`${o}-`)===!0&&u.length>o.length+1&&s.add(d)}return[...s].sort((a,c)=>a.localeCompare(c))};function UU(e){let t=0;for(e[t]==="env"&&(t+=1);t<e.length;){let n=e[t];if(/^(?:[a-z_][a-z0-9_]*|\$env:[a-z_][a-z0-9_]*)=.*/.test(n)){t+=1;continue}break}return e.slice(t)}function Lk(e){return e==="pm"||e==="pm.cmd"||e==="pm.exe"||e.endsWith("/pm")||e.endsWith("/pm.cmd")||e.endsWith("/pm.exe")}function zU(e){let t=e.trim();if(!t.startsWith("@")){let o=t.indexOf("@");return o===-1?t:t.slice(0,o)}let n=t.indexOf("/");if(n===-1)return t;let r=t.indexOf("@",n+1);return r===-1?t:t.slice(0,r)}function HU(e){let t=zU(e);return t==="pm-cli"||t.endsWith("/pm-cli")||e==="pm-cli"||e.endsWith("/pm-cli")}function Mk(e,t=process.cwd()){let n=e.replaceAll("\\","/");if(n!=="dist/cli.js"&&n!=="./dist/cli.js"&&!n.endsWith("/dist/cli.js"))return!1;let r=cc.resolve(t,e);try{return JSON.parse(xU(cc.join(cc.dirname(cc.dirname(r)),"package.json"),"utf8")).name==="@unbrained/pm-cli"}catch{return!1}}function em(e){let t=0;for(;t<e.length;){let r=e[t];if(r==="--"){t+=1;break}if(!r.startsWith("-"))break;let o=/^(?:-c|--call)=(.*)$/.exec(r);if(o){let i=o[1];return i?{command:i,args:e.slice(t+1)}:null}if(PU.has(r)){t+=1;break}t+=DU.has(r)&&!r.includes("=")?2:1}let n=e[t];return n?{command:n,args:e.slice(t+1)}:null}function jk(e,t){let n=0;for(;n<e.length;){let r=e[n];if(r==="--"){n+=1;continue}if(r.startsWith("-")){if(r.includes("=")){n+=1;continue}if(t.has(r)){n+=2;continue}n+=1;continue}return{subcommand:r,args:e.slice(n+1)}}return null}function qU(e){let t=jk(e,LU);return t?.subcommand!=="dlx"?null:em(t.args)}function BU(e){let t=jk(e,MU);return!t||!$U.has(t.subcommand)?null:em(t.args)}function GU(e){let t=0;for(;t<e.length;){let n=e[t];if(n==="--"){t+=1;continue}if(n.startsWith("-")){if($k.has(n)){t+=2;continue}t+=1;continue}return{subcommand:n,remaining:e.slice(t+1)}}return null}function WU(e,t=new Set){for(let n=0;n<e.length;n+=1){let r=e[n];if(r==="--")return e[n+1];if(!r.startsWith("-"))return r;!r.includes("=")&&($k.has(r)||t.has(r))&&(n+=1)}}import{execFile as VU}from"node:child_process";import{readFile as KU}from"node:fs/promises";import YU from"node:path";import{promisify as JU}from"node:util";(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]="eeb9bc22-b9e1-5449-9ad0-fbb1a14fb09d")}catch{}})();var XU=JU(VU),tm=1,ZU="linked-test-trust.json";function QU(e){return YU.join(ks(e),ZU)}function Uk(){return{version:tm,acknowledged:{}}}async function ez(e){try{let t=JSON.parse(await KU(QU(e),"utf8"));return t.version!==tm||typeof t.acknowledged!="object"||t.acknowledged===null||Array.isArray(t.acknowledged)?Uk():{version:tm,acknowledged:t.acknowledged}}catch{return Uk()}}async function zk(e=process.cwd()){let t=process.env.GITHUB_HEAD_REF?.trim()||process.env.GITHUB_REF_NAME?.trim();if(t&&t!=="merge")return t;try{let{stdout:n}=await XU("git",["symbolic-ref","--quiet","--short","HEAD"],{cwd:e,encoding:"utf8",windowsHide:!0,timeout:1e4}),r=n.trim();return r.length===0?void 0:r}catch{return}}function Hk(e=process.cwd()){return process.env.PM_SOURCE_WORKSPACE_ROOT?.trim()||e}function tz(e){return e===null||typeof e!="object"?!1:typeof e.author=="string"&&e.author.trim().length>0&&typeof e.created_at=="string"&&_t(e.created_at)&&(e.source_kind==="local_mutation"||e.source_kind==="merge_union")}function Ui(e,t){return{...e?{source_ref:e}:{},...t?{current_source_ref:t}:{}}}function nz(e){return Re(O({command:e.command??null,path:e.path??null,scope:e.scope,pm_context_mode:e.pm_context_mode??null,workspace_context_mode:e.workspace_context_mode??null,env_set:e.env_set??null,env_clear:e.env_clear??null,shared_host_safe:e.shared_host_safe??null,provenance:e.provenance??null,provenance_invalid:e.provenance_invalid??null}))}function rz(e,t,n){let r=nz(e),o=e.provenance?.source_ref;if(e.provenance===void 0&&e.provenance_invalid!==!0)return{fingerprint:r,trusted:!0,reason:"legacy"};let i=Object.hasOwn(n.acknowledged,r);return e.provenance_invalid===!0||!tz(e.provenance)?i?{fingerprint:r,trusted:!0,reason:"acknowledged",...Ui(void 0,t)}:{fingerprint:r,trusted:!1,reason:"invalid_provenance",...Ui(void 0,t)}:e.provenance.source_kind==="local_mutation"&&o===void 0?{fingerprint:r,trusted:!0,reason:"local_mutation",...Ui(void 0,t)}:e.provenance.source_kind==="local_mutation"&&o!==void 0&&o===t?{fingerprint:r,trusted:!0,reason:"local_source_ref",source_ref:o,current_source_ref:t}:i?{fingerprint:r,trusted:!0,reason:"acknowledged",...Ui(o,t)}:{fingerprint:r,trusted:!1,reason:"foreign_source_ref",...Ui(o,t)}}async function qk(e,t,n){let r=await ez(e);return t.map(o=>rz(o,n,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]="3ae38c0a-7f43-5457-b9a5-d23491a371ea")}catch{}})();async function Bk(e){return e.includeBody?mr(e.pmRoot,e.settings.item_format,e.typeToFolder,e.warnings,e.settings.schema,{forceSourceScan:!0}):mi(e.pmRoot,e.settings.item_format,e.typeToFolder,e.warnings,e.settings.schema)}(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]="42402d5d-8074-591f-98b4-75f479509cb4")}catch{}})();var oz=5;async function Gk(e,t,n){let r=await _r(e,t),i=[["validate_history_drift_missing_streams",r.missingStreams.length],["validate_history_drift_unreadable_streams",r.unreadableStreams.length],["validate_history_drift_hash_mismatches",r.hashMismatches.length],["validate_history_drift_chain_mismatches",r.chainMismatches.length],["validate_history_drift_version_skews",r.versionSkews.length],["validate_history_drift_workspace_state_mismatches",r.workspaceStateMismatches.length],["validate_history_drift_workspace_state_missing",r.workspaceStateMissing.length],["validate_history_drift_workspace_state_unreadable",r.workspaceStateUnreadable.length]].filter(([,l])=>l>0).map(([l,d])=>`${l}:${d}`),s=n?Number.POSITIVE_INFINITY:oz,a=r.driftedItems.slice(0,s),c=r.identityDiscontinuities??[];return{check:{name:"history_drift",status:c.length>0?"error":i.length===0?"ok":"warn",ok:c.length===0&&i.length===0,details:{identity_discontinuities:c.slice(0,s),identity_discontinuities_count:c.length,identity_discontinuities_truncated:c.length>s,checked_items:t.length,drifted_items_count:r.driftedItems.length,drifted_items:a,drifted_items_truncated:a.length<r.driftedItems.length,counts:{missing_streams:r.missingStreams.length,unreadable_streams:r.unreadableStreams.length,hash_mismatches:r.hashMismatches.length,chain_mismatches:r.chainMismatches.length,version_skews:r.versionSkews.length,workspace_state_mismatches:r.workspaceStateMismatches.length,workspace_state_missing:r.workspaceStateMissing.length,workspace_state_unreadable:r.workspaceStateUnreadable.length},workspace_state_mismatches:r.workspaceStateMismatches,workspace_state_missing:r.workspaceStateMissing,workspace_state_unreadable:r.workspaceStateUnreadable,version_skews:r.versionSkews.slice(0,s)}},warnings: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]="c357729b-f316-51e7-9768-fc7bb4600e06")}catch{}})();function nm(e,t){let n=e[0];if(e.length===1)return[n,n];let r=new Set(e),o=[n],i=new Set([n]),s=a=>{for(let c of(t.get(a)??[]).filter(l=>r.has(l))){if(c===n&&o.length>1)return o.push(n),!0;if(!i.has(c)){if(i.add(c),o.push(c),s(c))return!0;o.pop(),i.delete(c)}}return!1};return s(n)?[...o]:[...e,n]}function iz(e,t){if(typeof e!="string")return;let n=e.trim().toLowerCase();return n.length>0?t.get(n):void 0}function sz(e,t,n,r){for(let o of e.dependencies??[]){if(typeof o!="object"||o===null||typeof o.id!="string")continue;let i=r.resolve(o.kind);if(!i?.hierarchy)continue;let s=n.get(o.id.toLowerCase());s&&(i.hierarchyDirection==="source_parent"?t.get(s).push(e.id):t.get(e.id).push(s))}}function Wk(e,t=sn()){let n=new Map(e.map(o=>[o.id.toLowerCase(),o.id])),r=new Map(e.map(o=>[o.id,[]]));for(let o of[...e].sort((i,s)=>i.id.localeCompare(s.id))){let i=r.get(o.id),s=iz(o.parent,n);s&&i.push(s),sz(o,r,n,t)}for(let[o,i]of r)r.set(o,[...new Set(i)].sort());return r}function Vk(e,t,n=sn()){let r=Li(e,s=>t?Rc(s,t):s==="closed"||s==="canceled",n),o=Wk(e,n),i=r.cycles.map(s=>s.item_ids);return{cycle_count:i.length,active_cycle_count:r.cycles.filter(s=>!s.legacy_terminal).length,legacy_cycle_count:r.cycles.filter(s=>s.legacy_terminal).length,cycle_item_ids:[...new Set(i.flat())].sort(),cycle_sample_paths:i.map(s=>nm(s,o).join("->")),cardinality_violation_count:r.cardinality_violations.length,active_cardinality_violation_count:r.cardinality_violations.filter(s=>!s.legacy_terminal).length,legacy_cardinality_violation_count:r.cardinality_violations.filter(s=>s.legacy_terminal).length,cardinality_violation_rows:r.cardinality_violations.map(s=>`${s.child_id}:${s.parent_ids.join(",")}:${s.legacy_terminal?"legacy":"active"}`),parent_divergence_count:r.divergences.length,active_parent_divergence_count:r.divergences.filter(s=>!s.legacy_terminal).length,legacy_parent_divergence_count:r.divergences.filter(s=>s.legacy_terminal).length,parent_divergence_rows:r.divergences.map(s=>`${s.child_id}:scalar=${s.scalar_parent_id}:dependencies=${s.dependency_parent_ids.join(",")}:${s.legacy_terminal?"legacy":"active"}`)}}(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]="b32d3476-3270-555f-a684-80318df96527")}catch{}})();function Pn(e){return e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/^\/+/,"")}function rm(e){return Pn(e).replace(/\/+$/,"")}function Ht(e){let t=le(e);if(!t)return;let n=t.toLowerCase();if(!(n==="none"||n==="null"||n==="n/a"||n==="na"))return t}function om(e){let t=e.trim().replaceAll(/\s+/g," ");return t.length>120?`${t.slice(0,117)}...`: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]="1ffaaceb-cc25-5d2f-a840-763ba8c7e81f")}catch{}})();var dz=["src","tests","docs"],uz=["README.md","PRD.md","CHANGELOG.md","AGENTS.md","CONTRIBUTING.md","SECURITY.md","CODE_OF_CONDUCT.md","LICENSE"],fz=new Set(["node_modules",".git",".cursor",".agents","dist","coverage"]),mz=["resolution","expected_result","actual_result"],pz=["default","tracked-all","tracked-all-strict"],Kk=["core","strict","custom"],uc=["off","warn","error"],am=["author","acceptance_criteria","estimated_minutes","close_reason"],Zk=[...am,"reviewer","risk","confidence","sprint","release"],cm=Array.from(new Set(Zk)),_z={author:"author",acceptance_criteria:"acceptance_criteria","acceptance-criteria":"acceptance_criteria",estimated_minutes:"estimated_minutes","estimated-minutes":"estimated_minutes",estimate:"estimated_minutes",close_reason:"close_reason","close-reason":"close_reason",reviewer:"reviewer",risk:"risk",confidence:"confidence",sprint:"sprint",release:"release"},gz={author:"validate_metadata_missing_author",acceptance_criteria:"validate_metadata_missing_acceptance_criteria",estimated_minutes:"validate_metadata_missing_estimate",close_reason:"validate_metadata_missing_close_reason",reviewer:"validate_metadata_missing_reviewer",risk:"validate_metadata_missing_risk",confidence:"validate_metadata_missing_confidence",sprint:"validate_metadata_missing_sprint",release:"validate_metadata_missing_release"},hz={author:"missing_author",acceptance_criteria:"missing_acceptance_criteria",estimated_minutes:"missing_estimated_minutes",close_reason:"closed_missing_close_reason",reviewer:"missing_reviewer",risk:"missing_risk",confidence:"missing_confidence",sprint:"missing_sprint",release:"missing_release"},yz={author:"missing_author_item_ids",acceptance_criteria:"missing_acceptance_criteria_item_ids",estimated_minutes:"missing_estimated_minutes_item_ids",close_reason:"closed_missing_close_reason_item_ids",reviewer:"missing_reviewer_item_ids",risk:"missing_risk_item_ids",confidence:"missing_confidence_item_ids",sprint:"missing_sprint_item_ids",release:"missing_release_item_ids"},wz={author:"missing_author_truncated",acceptance_criteria:"missing_acceptance_criteria_truncated",estimated_minutes:"missing_estimated_minutes_truncated",close_reason:"closed_missing_close_reason_truncated",reviewer:"missing_reviewer_truncated",risk:"missing_risk_truncated",confidence:"missing_confidence_truncated",sprint:"missing_sprint_truncated",release:"missing_release_truncated"},bz=32*1024*1024,vz=1e4,lm=40,Tt=5,kz=4096,Ez=255,Sz=lz(cz);function Qk(e){let t={};for(let[n,r]of Object.entries(e))Array.isArray(r)||r===!1&&n.endsWith("_truncated")||(t[n]=typeof r=="object"&&r!==null?Qk(r):r);return t}function Tz(e){return{...e,checks:e.checks.map(t=>({...t,details:Qk(t.details)})),...e.fixes?{fixes:{mode:e.fixes.mode,auto_fix:e.fixes.auto_fix,prune_missing:e.fixes.prune_missing,planned_count:e.fixes.planned_count,applied_count:e.fixes.applied_count,gated_count:e.fixes.gated_count,failed_count:e.fixes.failed_count}}:{}}}function mc(e,t){return Ct(e,t)??e}function zi(e,t){return t.terminal_statuses.has(mc(e,t))}function Ln(e){return[...new Set((e??[]).map(t=>t.trim().toLowerCase()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function lc(e,t){return e.length!==t.length?!1:e.every((n,r)=>n===t[r])}function Az(e){let t=Ln(Ec),n={blocked_reason:Ln(Mn.blocked_reason),resolution:Ln(Mn.resolution),actual_result:Ln(Mn.actual_result)},r=Ln(e.validation.lifecycle_stale_blocker_reason_patterns),o={blocked_reason:Ln(e.validation.lifecycle_closure_like_blocked_reason_patterns),resolution:Ln(e.validation.lifecycle_closure_like_resolution_patterns),actual_result:Ln(e.validation.lifecycle_closure_like_actual_result_patterns)};return{stale_blocker_reason_patterns:r,stale_blocker_reason_pattern_source:lc(r,t)?"default":"settings",closure_like_metadata_field_patterns:o,closure_like_metadata_field_pattern_sources:{blocked_reason:lc(o.blocked_reason,n.blocked_reason)?"default":"settings",resolution:lc(o.resolution,n.resolution)?"default":"settings",actual_result:lc(o.actual_result,n.actual_result)?"default":"settings"}}}function Iz(e){let t=e?.trim().toLowerCase();if(!t||t.length===0)return"core";if(Kk.includes(t))return t;throw new g(`Unknown --metadata-profile value "${e}". Supported values: ${Kk.join(", ")}.`,_.USAGE)}function Cz(e){let t=e?.trim().toLowerCase();if(!t||t.length===0)return"warn";if(uc.includes(t))return t;throw new g(`Unknown --dependency-cycle-severity value "${e}". Supported values: ${uc.join(", ")}.`,_.USAGE)}function Oz(e){let t=e?.trim().toLowerCase();if(!t||t.length===0)return"warn";if(uc.includes(t))return t;throw new g(`Unknown --parent-cycle-severity value "${e}". Supported values: ${uc.join(", ")}.`,_.USAGE)}function xz(e){return[...new Set((e??[]).map(n=>n.trim().toLowerCase().replaceAll("-","_")))].map(n=>_z[n]).filter(n=>n!==void 0).sort((n,r)=>n.localeCompare(r))}function Rz(e,t,n){let r=xz(n);return e==="core"?{profile:e,profile_source:t,required_fields:[...am],configured_custom_fields:r,fallback_to_core:!1,warnings:[]}:e==="strict"?{profile:e,profile_source:t,required_fields:[...Zk],configured_custom_fields:r,fallback_to_core:!1,warnings:[]}:r.length>0?{profile:e,profile_source:t,required_fields:r,configured_custom_fields:r,fallback_to_core:!1,warnings:[]}:{profile:e,profile_source:t,required_fields:[...am],configured_custom_fields:r,fallback_to_core:!0,warnings:["validate_metadata_custom_profile_missing_required_fields:0"]}}var Nz=new Set(["acceptance_criteria","estimated_minutes"]);function Dz(e,t,n,r){return!r&&Nz.has(t)&&zi(e.status,n)?!1:t==="author"?!le(e.author):t==="acceptance_criteria"?!le(e.acceptance_criteria):t==="estimated_minutes"?!Number.isFinite(e.estimated_minutes):t==="close_reason"?mc(e.status,n)===n.close_status&&!le(e.close_reason):t==="reviewer"?!le(e.reviewer):t==="risk"?!le(e.risk):t==="confidence"?typeof e.confidence=="number"?!Number.isFinite(e.confidence):!le(e.confidence):t==="sprint"?!le(e.sprint):!le(e.release)}function Pz(e){if(e===void 0)return"default";let t=e.trim().toLowerCase();if(t.length===0||t==="default")return"default";if(t==="tracked-all"||t==="tracked_all")return"tracked-all";if(t==="tracked-all-strict"||t==="tracked_all_strict")return"tracked-all-strict";throw new g(`Unknown --scan-mode value "${e}". Supported values: ${pz.join(", ")}.`,_.USAGE)}function Lz(e){let t=process.env.PM_SOURCE_WORKSPACE_ROOT?.trim();if(t)return Ze.resolve(t);let n=Ze.resolve(e);if(n.replaceAll("\\","/").endsWith("/.agents/pm"))return Ze.dirname(Ze.dirname(n));let o=Ze.resolve(process.cwd()),i=Yk(n),s=Yk(o),a=Ze.relative(i,s);return a.length===0||!a.startsWith("..")&&!Ze.isAbsolute(a)?n:o}function Yk(e){try{return az.native(e)}catch{return Ze.resolve(e)}}function Mz(e,t){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&t.includes(e.code)}async function eE(e,t,n){let r=t.length>0?Ze.join(e,t):e,o;try{o=await um.readdir(r,{withFileTypes:!0})}catch(i){if(L(i))return;throw i}for(let i of o){if(i.name.startsWith("."))continue;let s=t.length>0?Ze.join(t,i.name):i.name;if(i.isDirectory()){if(fz.has(i.name))continue;await eE(e,s,n);continue}i.isFile()&&n.push(Pn(s))}}async function Jk(e){let t=[];for(let n of dz)await eE(e,n,t);for(let n of uz){let r=Ze.join(e,n);try{(await um.stat(r)).isFile()&&t.push(Pn(n))}catch{}}return[...new Set(t)].sort((n,r)=>n.localeCompare(r))}async function $z(e){try{let{stdout:t}=await Sz("git",["ls-files","-z"],{cwd:e,encoding:"utf8",maxBuffer:bz,windowsHide:!0,timeout:vz}),n=t.split("\0").map(r=>Pn(r)).filter(r=>r.length>0);return[...new Set(n)].sort((r,o)=>r.localeCompare(o))}catch{return null}}function Fz(e,t){let n=new Set,r=rm(br);r.length>0&&n.add(r);let o=rm(Ze.relative(t,e));return o.length>0&&!o.startsWith("..")&&n.add(o),[...n].sort((i,s)=>i.localeCompare(s))}function Xk(e,t){for(let n of t)if(e===n||e.startsWith(`${n}/`))return!0;return!1}async function jz(e,t){if(t==="tracked-all"||t==="tracked-all-strict"){let r=await $z(e);if(r)return{requestedMode:t,appliedMode:t,source:"tracked-git",candidateFiles:r,candidateTotal:r.length,candidateScanned:r.length};let o=await Jk(e);return{requestedMode:t,appliedMode:"default",source:"tracked-all-fallback-default",candidateFiles:o,candidateTotal:o.length,candidateScanned:o.length}}let n=await Jk(e);return{requestedMode:t,appliedMode:"default",source:"default-curated",candidateFiles:n,candidateTotal:n.length,candidateScanned:n.length}}function me(e,t=Tt){return e.length<=t?{values:e,truncated:!1}:{values:e.slice(0,t),truncated:!0}}function yr(e,t){if(t)return{values:e,truncated:!1,total:e.length};let n=me(e,lm);return{values:n.values,truncated:n.truncated,total:e.length}}var Uz={resolution:"--resolution",expected_result:"--expected-result",actual_result:"--actual-result"},zz={resolution:"Describe how this item was resolved",expected_result:"Describe the expected result",actual_result:"Describe the actual result"};function Hz(e){let t=e.missing_fields.map(n=>`${Uz[n]} "${zz[n]}"`).join(" ");return`pm update ${e.id} ${t} --message "Backfill resolution metadata"`}function qz(e,t){let n=e.details?.missing_resolution_remediation_hints,r=Array.isArray(n)&&n.length>0,o=r?n.filter(s=>typeof s=="string"):Iw(t);if(o.length===0)return;let i=r&&e.details?.missing_resolution_remediation_hints_truncated===!0;e.details={...e.details,fix_hints:o,...i?{fix_hints_truncated:!0}:{}}}function Bz(e){let t=new Set;return e.checkCompleteness&&t.add("completeness"),e.checkMetadata&&t.add("metadata"),e.checkResolution&&t.add("resolution"),(e.checkLifecycle||e.checkStaleBlockers)&&t.add("lifecycle"),e.checkFiles&&t.add("files"),e.checkHistoryDrift&&t.add("history_drift"),e.checkCommandReferences&&t.add("command_references"),e.checkStorageIntegrity&&t.add("storage_integrity"),t.size===0?(e.autoFix&&(t.add("metadata"),t.add("resolution"),t.add("lifecycle")),e.pruneMissing&&t.add("files"),t.size===0&&(t.add("metadata"),t.add("resolution"),t.add("lifecycle"),t.add("files"),t.add("command_references"),t.add("history_drift"),t.add("format_version"),t.add("completeness"),t.add("storage_integrity")),t):(e.pruneMissing&&t.add("files"),t)}var Gz="validate_metadata_duplicate_issue_codes";function Wz(e,t){if(e.length===0)return{rows:[],truncated:!1,warnings:[]};let n=t?e.length:Tt,r=e.slice(0,n);return{rows:r.map(i=>({code:i.code,count:i.count,ids:i.ids,titles:i.titles,remediation_hint:`Items ${i.ids.join(", ")} share issue code "${i.code}"; rename or merge so each logical code maps to one item.`})),truncated:r.length<e.length,warnings:[`${Gz}:${e.length}`]}}function Vz(e,t,n){let r=Object.fromEntries(cm.map(o=>[o,[]]));for(let o of e)for(let i of cm)Dz(o,i,t,n)&&r[i].push(o.id);return r}function Kz(e,t,n){let r=[...e.warnings];for(let o of e.required_fields){let i=t[o];i.length>0&&r.push(`${gz[o]}:${i.length}`)}return r.push(...n),r}function Yz(e,t){let n={};for(let r of e.required_fields){let o=t[r],i=o?o.length:0,s=hz[r];n[s]=i}return n}function Jz(e,t,n){let r=[];for(let o of e.required_fields){let i=t[o];if(i)for(let s of i){let a=n.get(s)?.type,c=typeof a=="string"&&a.length>0?a:"Unknown";r.push({item_type:c,field:o})}}return r}function Xz(e,t,n,r){for(let o of t.required_fields){let i=n[o];if(!i||i.length===0)continue;let s=yz[o],a=wz[o];if(!s||!a)continue;let c=me(i,r?i.length:Tt);e[s]=c.values,e[a]=c.truncated}}function Zz(e,t,n){if(!e.required_fields.includes("close_reason"))return[];let r=t.close_reason;return r?r.map(o=>({id:o,resolution:le(n.get(o)?.resolution)})):[]}function Qz(e,t,n){if(!e.required_fields.includes("estimated_minutes"))return[];let r=t.estimated_minutes;return r?r.map(o=>({id:o,type:le(n.get(o)?.type)})):[]}function e2(e,t,n,r,o){let i=new Map(e.map(b=>[b.id,b])),s=t.profile==="strict",a=Vz(e,n,s),c=yk(e,{configuredPrefixes:o}),l=Wz(c,r),d=Kz(t,a,l.warnings),u=Yz(t,a),f=Jz(t,a,i),m=wk(f),p={checked_items:e.length,metadata_profile:t.profile,metadata_profile_source:t.profile_source,metadata_profile_fallback_to_core:t.fallback_to_core,required_fields:[...t.required_fields],supported_required_fields:[...cm],counts:u,missing_by_type:m,duplicate_issue_codes_count:c.length,duplicate_issue_codes:l.rows,duplicate_issue_codes_truncated:l.truncated};t.configured_custom_fields.length>0&&(p.configured_custom_required_fields=[...t.configured_custom_fields]),Xz(p,t,a,r);let w=Zz(t,a,i),y=Qz(t,a,i);return{check:{name:"metadata",status:d.length===0?"ok":"warn",ok:d.length===0,details:p},warnings:d,closeReasonBackfillRows:w,estimateBackfillRows:y}}function t2(e,t,n){let r=new Set(t.terminal_done_statuses);r.add(t.close_status);let o=e.filter(f=>r.has(mc(f.status,t))),i=[],s=[];for(let f of o){let m=mz.filter(p=>!le(f[p]));m.length!==0&&(i.push({id:f.id,missing_fields:m}),s.push({id:f.id,missing_fields:m,close_reason:le(f.close_reason)}))}let a=i.length>0?[`validate_resolution_missing_fields:${i.length}`]:[],c=n?Number.POSITIVE_INFINITY:Tt,l=me(i.map(f=>`${f.id}:${f.missing_fields.join(",")}`),c),d=i.map(f=>Hz(f)),u=me(d,c);return{check:{name:"resolution",status:a.length===0?"ok":"warn",ok:a.length===0,details:{checked_closed_items:o.length,missing_resolution_items:i.length,missing_resolution_rows:l.values,missing_resolution_rows_truncated:l.truncated,missing_resolution_remediation_hints:u.values,missing_resolution_remediation_hints_truncated:u.truncated}},warnings:a,resolutionBackfillRows:s}}function n2(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r2(e,t="pm",n=jn()){let r=new Set(e.map(i=>i.id)),o=[...e].sort((i,s)=>i.id.localeCompare(s.id));return new Map(o.map(i=>{let s=new Set,a=Ht(i.blocked_by);a&&r.has(a)&&s.add(a),(i.dependencies??[]).filter(l=>{let d=Ht(l.kind);return d!==void 0&&n.resolve(d)?.ordering===!0}).map(l=>Ht(l.id)).filter(l=>l!==void 0&&r.has(l)).forEach(l=>s.add(l));let c=Ht(i.definition_of_ready);return i2(c??"",t).filter(l=>r.has(l)).forEach(l=>s.add(l)),[i.id,[...s].sort((l,d)=>l.localeCompare(d))]}))}function o2(e,t,n){let r=Vv(e,n?d=>zi(d,n):void 0),o=r.active.map(d=>`${d.holder_id}:${d.target_id}:${d.kind}`),i=r.legacy_terminal.map(d=>`${d.holder_id}:${d.target_id}:${d.kind}:${d.holder_status}`),s=t?Number.POSITIVE_INFINITY:Tt,a=me(o,s),c=me(i,s),l=me(r.active.map(d=>d.source==="parent"?`pm update ${d.holder_id} --unset parent`:d.source==="blocked_by"?`pm update ${d.holder_id} --unset blocked_by`:`pm update ${d.holder_id} --replace-deps '<correct dependency edges>'`),s);return{check:{name:"dependency_references",status:o.length===0?"ok":"warn",ok:o.length===0,details:{checked_items:e.length,dangling_reference_count:o.length+i.length,active_dangling_reference_count:o.length,dangling_reference_rows:a.values,dangling_reference_rows_truncated:a.truncated,legacy_terminal_dangling_reference_count:i.length,legacy_closed_dangling_reference_count:r.legacy_terminal.filter(d=>d.holder_status==="closed").length,legacy_terminal_dangling_reference_rows:c.values,legacy_terminal_dangling_reference_rows_truncated:c.truncated,no_active_blocker_sentinel_count:r.no_active_blocker_sentinels.length,remediation_hints:l.values,remediation_hints_truncated:l.truncated}},warnings:o.length>0?[`validate_dangling_dependency_references:${o.length}`]:[]}}function i2(e,t="pm"){let n=(t.trim().toLowerCase()||"pm").replace(/-+$/g,""),r=new RegExp(`(?:^|[^a-z0-9-])(${n2(n)}-[a-z0-9][a-z0-9-]*)`,"gi");return[...new Set([...e.matchAll(r)].map(o=>o[1].toLowerCase()))].sort((o,i)=>o.localeCompare(i))}function s2(e){let t=0,n=new Map,r=new Map,o=[],i=new Set,s=[],a=d=>{n.set(d,t),r.set(d,t),t+=1,o.push(d),i.add(d);for(let f of e.get(d)??[])n.has(f)?i.has(f)&&r.set(d,Math.min(r.get(d),n.get(f))):(a(f),r.set(d,Math.min(r.get(d),r.get(f))));if(r.get(d)!==n.get(d))return;let u=[];for(;o.length>0;){let f=o.pop();if(i.delete(f),u.push(f),f===d)break}u.sort((f,m)=>f.localeCompare(m)),s.push(u)},c=[...e.keys()].sort((d,u)=>d.localeCompare(u));for(let d of c)n.has(d)||a(d);return s.filter(d=>{if(d.length>1)return!0;let u=d[0];return(e.get(u)??[]).includes(u)}).sort((d,u)=>d[0].localeCompare(u[0])||d.length-u.length||d.join(",").localeCompare(u.join(",")))}function a2(e,t="pm"){let n=r2(e,t),r=s2(n),o=[...new Set(r.flat())].sort((s,a)=>s.localeCompare(a)),i=r.map(s=>nm(s,n).join("->"));return{cycle_count:r.length,cycle_item_ids:o,cycle_sample_paths:i}}function c2(e){return e.startsWith("docs/")?"docs_unowned":e.startsWith("tests/")?"tests_unowned":e.startsWith("src/")?"source_unowned":e.endsWith(".md")?"docs_unowned":"unlinked_existing"}function fc(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function l2(e,t){let n=fc(e).split("/").filter(Boolean),r=fc(t).split("/").filter(Boolean),o=0;for(;o<n.length&&o<r.length&&n[o]===r[o];)o+=1;return o}function d2(e,t){let n=fc(t),r=fc(e),o=t.endsWith("/")?t:`${t}/`,i=e.startsWith(o),s=n.length>0&&n===r,a=l2(e,t);return!i&&!s&&a===0?null:i?{score:t.length+1e3,confidence:"path_prefix"}:s?{score:a+500,confidence:"same_directory"}:{score:a,confidence:"shared_directory"}}function u2(e,t,n){return e===void 0||n>e.score||n===e.score&&t.id.localeCompare(e.item.id)<0}function f2(e,t,n){let r=t==="docs_unowned"?"docs":"files",o;return n.flatMap(i=>(r==="docs"?i.docs??[]:i.files??[]).map(s=>({item:i,link:s}))).forEach(({item:i,link:s})=>{if(s.scope!=="project")return;let a=Pn(s.path);if(a.length===0||a===e)return;let c=d2(e,a);c!==null&&u2(o,i,c.score)&&(o={item:i,score:c.score,confidence:c.confidence})}),o?{id:o.item.id,type:o.item.type,title:o.item.title,status:o.item.status,confidence:o.confidence}:null}function m2(e,t){return e.map(n=>{let r=c2(n),o=r==="docs_unowned"?"docs":"files",i=f2(n,r,t),s=i?.id??"<id>";return{path:n,classification:r,owner_candidate:i,remediation_hint:`pm ${o} ${s} --add path=${n},scope=project,note="<why this artifact belongs to the item>"`}})}function p2(e){return e.map(t=>`${t.path}:${t.classification} owner_candidate=${t.owner_candidate?.id??"unowned"} hint=${JSON.stringify(t.remediation_hint)}`)}function _2(e,t){return Object.entries(t.closure_like_metadata_field_patterns).filter(([n,r])=>{let o=Ht(e[n]);return o?r.some(i=>o.toLowerCase().includes(i)):!1}).map(([n])=>n).sort((n,r)=>n.localeCompare(r))}function g2(e,t,n,r,o){let i=Ht(t.parent),s=i?n.get(r.get(i.toLowerCase())??i):void 0;return{id:e.id,parent_id:t.id,grandparent_id:s?.id,grandparent_active:s!==void 0&&!zi(s.status,o)}}function h2(e,t,n,r){let o=Ht(e.blocked_by),i=Ht(e.blocked_reason),s=i?.toLowerCase(),a=mc(e.status,n),c=[];return t.has(a)?(!o&&!i&&c.push("blocked_status_missing_blocker_context"),s?.includes("no active blocker")&&c.push("blocked_status_reason_reports_no_active_blocker"),s&&r.stale_blocker_reason_patterns.some(l=>s.includes(l))&&c.push("blocked_status_reason_matches_stale_pattern"),c):(o&&c.push("non_blocked_status_has_blocked_by"),i&&c.push("non_blocked_status_has_blocked_reason"),c)}function y2(e,t,n,r){let o=new Map(e.map(c=>[c.id,c])),i=new Map(e.map(c=>[c.id.toLowerCase(),c.id])),s=n.blocked_statuses.size>0?n.blocked_statuses:new Set(["blocked"]),a={activeItems:e.filter(c=>!zi(c.status,n)),closureLikeRows:[],terminalParentRows:[],terminalParentFixRows:[],staleBlockerRows:[]};for(let c of a.activeItems){let l=_2(c,r);l.length>0&&a.closureLikeRows.push({id:c.id,fields:l});let d=Ht(c.parent),u=d?o.get(i.get(d.toLowerCase())??d):void 0;if(u&&zi(u.status,n)&&(a.terminalParentRows.push({id:c.id,parent_id:u.id,parent_status:u.status}),a.terminalParentFixRows.push(g2(c,u,o,i,n))),t){let f=h2(c,s,n,r);f.length>0&&a.staleBlockerRows.push({id:c.id,status:c.status,reasons:[...new Set(f)].sort((m,p)=>m.localeCompare(p))})}}return a}function w2(e){e.closureLikeRows.sort((t,n)=>t.id.localeCompare(n.id)),e.terminalParentRows.sort((t,n)=>t.id.localeCompare(n.id)||t.parent_id.localeCompare(n.parent_id)),e.terminalParentFixRows.sort((t,n)=>t.id.localeCompare(n.id)||t.parent_id.localeCompare(n.parent_id)),e.staleBlockerRows.sort((t,n)=>t.id.localeCompare(n.id))}function dc(e,t,n){return n<=0||t==="off"?null:`${t==="error"?`${e}_error`:e}:${n}`}function im(e,t,n){return n>0&&t!=="off"?`${e}:${n}`:null}function b2(e,t,n,r,o){let i=[];e.closureLikeRows.length>0&&i.push(`validate_lifecycle_active_closure_like_metadata:${e.closureLikeRows.length}`),e.terminalParentRows.length>0&&i.push(`validate_lifecycle_active_terminal_parent:${e.terminalParentRows.length}`),t&&e.staleBlockerRows.length>0&&i.push(`validate_lifecycle_stale_blockers:${e.staleBlockerRows.length}`);let s=dc("validate_lifecycle_dependency_cycles",n,o.dependencyCycles),a=dc("validate_hierarchy_parent_cycle",r,o.activeHierarchyCycles),c=dc("validate_hierarchy_cardinality_violation",r,o.activeHierarchyCardinality),l=dc("validate_hierarchy_parent_divergence",r,o.activeHierarchyDivergence),d=im("validate_legacy_hierarchy_parent_cycle",r,o.legacyHierarchyCycles),u=im("validate_legacy_hierarchy_cardinality_violation",r,o.legacyHierarchyCardinality),f=im("validate_legacy_hierarchy_parent_divergence",r,o.legacyHierarchyDivergence);return[...i,...s?[s]:[],...a?[a]:[],...c?[c]:[],...l?[l]:[],...d?[d]:[],...u?[u]:[],...f?[f]:[]]}function v2(e){let t=Pn(e);return t.length>kz||t.split(/[\\/]/).some(n=>n.length>Ez)}async function k2(e,t){let n=Ze.isAbsolute(t)?t:Ze.resolve(e,t);if(v2(n))return!1;try{let r=await um.stat(n);return!r.isFile()&&!r.isDirectory()}catch(r){return Mz(r,["ENOENT","ENOTDIR"])}}async function E2(e,t){let n={linkedProjectPaths:new Set,remoteLinkedPaths:new Set,missingLinkedPaths:[],staleLinkRows:[]},r=e.flatMap(o=>[...(o.files??[]).map(i=>({item:o,artifact:i,link_kind:"files"})),...(o.docs??[]).map(i=>({item:o,artifact:i,link_kind:"docs"}))]);for(let{item:o,artifact:i,link_kind:s}of r){if(i.scope!=="project")continue;if(Fi(i.path)){n.remoteLinkedPaths.add(i.path.trim());continue}let a=Pn(i.path);a.length!==0&&(n.linkedProjectPaths.add(a),await k2(t,i.path)&&(n.missingLinkedPaths.push(a),n.staleLinkRows.push({item_id:o.id,path:a,link_kind:s})))}return n}function S2(e,t,n,r,o,i){let s=r==="tracked-all-strict",a=s&&!o,c=o||s,l=c?[]:Fz(t,n),d=l.length===0?[]:e.candidateFiles.filter(m=>Xk(m,l)),u=l.length===0?e.candidateFiles:e.candidateFiles.filter(m=>!Xk(m,l)),f={};if(d.length>0){let m=yr(d,i);f.pm_internals={count:d.length,paths:m.values,paths_truncated:m.truncated,paths_total:m.total}}return{strictTrackedAllMode:s,strictModeForcesPmInternals:a,includePmInternalsEffective:c,pmInternalCandidatePrefixes:l,excludedPmInternalPaths:d,candidateFiles:u,excludedByReason:f}}function T2(e,t,n,r,o,i,s,a="pm"){let c=y2(e,t,o,i);w2(c);let l=a2(c.activeItems,a),d=Vk(e,o),u=rc(o,e,s?Number.POSITIVE_INFINITY:Tt),f=[...b2(c,t,n,r,{dependencyCycles:l.cycle_count,activeHierarchyCycles:d.active_cycle_count,activeHierarchyCardinality:d.active_cardinality_violation_count,activeHierarchyDivergence:d.active_parent_divergence_count,legacyHierarchyCycles:d.legacy_cycle_count,legacyHierarchyCardinality:d.legacy_cardinality_violation_count,legacyHierarchyDivergence:d.legacy_parent_divergence_count}),...oc(u)],m=s?Number.POSITIVE_INFINITY:Tt,p=me(c.closureLikeRows.map(E=>`${E.id}:${E.fields.join(",")}`),m),w=me(c.terminalParentRows.map(E=>`${E.id}:${E.parent_id}:${E.parent_status}`),m),y=me(c.staleBlockerRows.map(E=>`${E.id}:${E.status}:${E.reasons.join(",")}`),m),b=me(l.cycle_item_ids,m),v=me(l.cycle_sample_paths,m),I=me(d.cycle_item_ids,m),A=me(d.cycle_sample_paths,m),C=me(d.cardinality_violation_rows,m),P=me(d.parent_divergence_rows,m),S=l.cycle_count>0&&n==="error"||(d.active_cycle_count>0||d.active_cardinality_violation_count>0||d.active_parent_divergence_count>0)&&r==="error";return{check:{name:"lifecycle",status:S?"error":f.length===0?"ok":"warn",ok:!S&&f.length===0,details:{checked_active_items:c.activeItems.length,lifecycle_status_roles:u,active_closure_like_metadata_items:c.closureLikeRows.length,active_closure_like_metadata_rows:p.values,active_closure_like_metadata_rows_truncated:p.truncated,active_terminal_parent_items:c.terminalParentRows.length,active_terminal_parent_rows:w.values,active_terminal_parent_rows_truncated:w.truncated,stale_blocker_checks_enabled:t,stale_blocker_items:c.staleBlockerRows.length,stale_blocker_rows:y.values,stale_blocker_rows_truncated:y.truncated,dependency_cycle_severity_policy:n,dependency_cycle_count:l.cycle_count,dependency_cycle_item_count:l.cycle_item_ids.length,dependency_cycle_item_ids:b.values,dependency_cycle_item_ids_truncated:b.truncated,dependency_cycle_sample_paths:v.values,dependency_cycle_sample_paths_truncated:v.truncated,parent_cycle_severity_policy:r,parent_cycle_count:d.cycle_count,active_parent_cycle_count:d.active_cycle_count,legacy_parent_cycle_count:d.legacy_cycle_count,parent_cycle_item_count:d.cycle_item_ids.length,parent_cycle_item_ids:I.values,parent_cycle_item_ids_truncated:I.truncated,parent_cycle_sample_paths:A.values,parent_cycle_sample_paths_truncated:A.truncated,hierarchy_cardinality_violation_count:d.cardinality_violation_count,active_hierarchy_cardinality_violation_count:d.active_cardinality_violation_count,legacy_hierarchy_cardinality_violation_count:d.legacy_cardinality_violation_count,hierarchy_cardinality_violation_rows:C.values,hierarchy_cardinality_violation_rows_truncated:C.truncated,hierarchy_parent_divergence_count:d.parent_divergence_count,active_hierarchy_parent_divergence_count:d.active_parent_divergence_count,legacy_hierarchy_parent_divergence_count:d.legacy_parent_divergence_count,hierarchy_parent_divergence_rows:P.values,hierarchy_parent_divergence_rows_truncated:P.truncated,stale_blocker_reason_patterns:[...i.stale_blocker_reason_patterns],stale_blocker_reason_pattern_source:i.stale_blocker_reason_pattern_source,closure_like_blocked_reason_patterns:[...i.closure_like_metadata_field_patterns.blocked_reason],closure_like_blocked_reason_pattern_source:i.closure_like_metadata_field_pattern_sources.blocked_reason,closure_like_resolution_patterns:[...i.closure_like_metadata_field_patterns.resolution],closure_like_resolution_pattern_source:i.closure_like_metadata_field_pattern_sources.resolution,closure_like_actual_result_patterns:[...i.closure_like_metadata_field_patterns.actual_result],closure_like_actual_result_pattern_source:i.closure_like_metadata_field_pattern_sources.actual_result}},warnings:f,terminalParentFixRows:c.terminalParentFixRows}}async function A2(e,t,n,r,o,i,s=at(_e.schema)){let a=await E2(e,t),c=new Map(e.map(N=>[N.id,N])),l=[...new Set(a.missingLinkedPaths)].sort((N,pe)=>N.localeCompare(pe)),d=await jz(t,r),u=S2(d,n,t,r,o,i),f=u.candidateFiles.filter(N=>!a.linkedProjectPaths.has(N)),m=m2(f,e),p=kk(l,u.candidateFiles),w=new Map(p.map(N=>[N.path,N.classification])),y=p.filter(N=>N.classification==="moved").length,b=a.staleLinkRows.map(N=>({...N,classification:w.get(N.path)??"deleted"})).sort((N,pe)=>N.item_id.localeCompare(pe.item_id)||N.path.localeCompare(pe.path)||N.link_kind.localeCompare(pe.link_kind)),v=[];u.strictModeForcesPmInternals&&v.push("validate_files_tracked_all_strict_forces_pm_internals"),f.length>0&&v.push(`validate_files_orphaned_paths:${f.length}`);let I=[...a.remoteLinkedPaths].sort((N,pe)=>N.localeCompare(pe)),A=yr(I,i),C=yr(l,i),P=yr(f,i),S=yr(m.map(N=>`${N.path}:${N.classification}:owner_candidate=${N.owner_candidate?.id??"unowned"}`),i),E=i?m:yr(p2(m),!1).values,z=yr(Ek(p),i),q=Ak(b,p,N=>c.get(N),s,i?1/0:lm);return q.active_missing_linked_paths_count>0&&v.push(`validate_files_missing_linked_paths:${q.active_missing_linked_paths_count}`),{check:{name:"files",status:v.length===0?"ok":"warn",ok:v.length===0,details:{workspace_root:t,scan_mode_requested:d.requestedMode,scan_mode_applied:d.appliedMode,strict_tracked_all_mode:u.strictTrackedAllMode,strict_mode_forces_pm_internals:u.strictModeForcesPmInternals,strict_mode_forces_pm_internals_notice:u.strictModeForcesPmInternals?"tracked-all-strict force-enables PM internals; pass --include-pm-internals to make inclusion explicit.":null,file_list_detail_mode:i?"full":"summary",file_list_summary_limit:lm,candidate_scan_source:d.source,include_pm_internals:u.includePmInternalsEffective,include_pm_internals_requested:o,pm_internal_candidate_prefixes:u.pmInternalCandidatePrefixes,pm_internal_excluded_count:u.excludedPmInternalPaths.length,excluded_total:u.excludedPmInternalPaths.length,excluded_by_reason:u.excludedByReason,linked_project_paths:a.linkedProjectPaths.size,remote_linked_paths_count:I.length,remote_linked_paths_total:A.total,remote_linked_paths:A.values,remote_linked_paths_truncated:A.truncated,candidate_total_raw:d.candidateTotal,candidate_scanned_raw:d.candidateScanned,candidate_total:u.candidateFiles.length,candidate_scanned:u.candidateFiles.length,scanned_candidate_files:u.candidateFiles.length,missing_linked_paths_count:l.length,missing_linked_paths_total:C.total,missing_linked_paths:C.values,missing_linked_paths_truncated:C.truncated,missing_linked_paths_moved_count:y,missing_linked_paths_deleted_count:p.filter(N=>N.classification==="deleted").length,missing_linked_paths_malformed_count:p.filter(N=>N.classification==="malformed").length,missing_linked_path_classifications:z.values,missing_linked_path_classifications_truncated:z.truncated,...q,orphaned_paths_count:f.length,orphaned_paths_total:P.total,orphaned_paths:P.values,orphaned_paths_truncated:P.truncated,orphaned_path_classifications:S.values,orphaned_path_classifications_truncated:S.truncated,orphaned_path_rows_count:m.length,orphaned_path_rows:E}},warnings:v,staleLinkPruneRows:b}}function I2(e,t){let n=[];return e.forEach(({item:r,linkedTest:o},i)=>{let s=t[i];if(s.trusted)return;let a=om(o.command??"");n.push(`${r.id}:${s.source_ref??"unknown"}->${s.current_source_ref??"unknown"}:${a}`)}),n}async function C2(e,t,n,r){let o=new Set(e.map(C=>C.id.toLowerCase())),i=0,s=0,a=new Set,c=[],l=e.flatMap(C=>(C.tests??[]).map(P=>({item:C,linkedTest:P}))),d=await zk(Hk()),u=await qk(r,l.map(({linkedTest:C})=>C),d),f=I2(l,u);for(let{item:C,linkedTest:P}of l){if(typeof P.command!="string"||P.command.trim().length===0)continue;i+=1;let S=Fk(P.command,t);if(S.length!==0){s+=S.length;for(let E of S)a.add(E),o.has(E.toLowerCase())||c.push(`${C.id}:${E}:${om(P.command)}`)}}let m=[...new Set(c)].sort((C,P)=>C.localeCompare(P)),p=[...new Set(m.map(C=>C.split(":")[1]??""))].filter(C=>C.length>0).sort((C,P)=>C.localeCompare(P)),w=[];m.length>0&&w.push(`validate_command_references_stale_pm_ids:${m.length}`),f.length>0&&w.push(`validate_linked_test_trust_unacknowledged:${f.length}`);let y=n?Number.POSITIVE_INFINITY:Tt,b=me(m,y),v=me(p,y),I=me([...a].sort((C,P)=>C.localeCompare(P)),y),A=me(f,y);return{check:{name:"command_references",status:w.length===0?"ok":"warn",ok:w.length===0,details:{checked_items:e.length,linked_commands_scanned:i,referenced_pm_ids_count:s,unique_referenced_pm_ids_count:a.size,unique_referenced_pm_ids:I.values,unique_referenced_pm_ids_truncated:I.truncated,linked_test_trust_current_source_ref:d??null,untrusted_linked_tests_count:f.length,untrusted_linked_tests:A.values,untrusted_linked_tests_truncated:A.truncated,stale_pm_id_references_count:m.length,stale_pm_ids_count:p.length,stale_pm_ids:v.values,stale_pm_ids_truncated:v.truncated,stale_pm_id_reference_rows:b.values,stale_pm_id_reference_rows_truncated:b.truncated}},warnings:w}}function O2(e,t){let n=ps(e.map(c=>({ref:c.id,version:ms(c)}))),r=[];n.outdated.length>0&&r.push(`validate_format_version_outdated_items:${n.outdated.length}`),n.ahead.length>0&&r.push(`validate_format_version_ahead_items:${n.ahead.length}`);let o=t?Number.POSITIVE_INFINITY:Tt,i=me(n.outdated,o),s=me(n.ahead,o),a=n.ahead.length>0?"error":n.outdated.length>0?"warn":"ok";return{check:{name:"format_version",status:a,ok:a==="ok",details:{checked_items:e.length,current_format_version:fs,outdated_items_count:n.outdated.length,outdated_items:i.values,outdated_items_truncated:i.truncated,ahead_items_count:n.ahead.length,ahead_items:s.values,ahead_items_truncated:s.truncated}},warnings:r}}var dm="pm validate auto-fix";async function x2(e,t,n){switch(e.kind){case"set_closed_at":await ck(e,t);return;case"set_resolution":case"set_close_reason":case"set_estimate":case"reparent":case"unset_parent":{let r={message:dm};if(e.kind==="set_resolution"?r.resolution=e.value:e.kind==="set_close_reason"?r.closeReason=e.value:e.kind==="set_estimate"?r.estimatedMinutes=e.value:e.kind==="reparent"?r.parent=e.parent_id:r.unset=["parent"],!n.runUpdate)throw new g("Applying validate metadata/lifecycle fixes requires a runUpdate mutation service.",_.USAGE);await n.runUpdate(e.item_id,r,t);return}case"prune_file_link":throw new Error(`Unsupported non-batched fix kind: ${e.kind}`);case"prune_doc_link":throw new Error(`Unsupported non-batched fix kind: ${e.kind}`)}}function sm(e){return e.kind!=="prune_file_link"&&e.kind!=="prune_doc_link"?null:`${e.kind}:${e.item_id}`}async function R2(e,t,n){let r=[],o=[],i=new Map;for(let s of e.filter(a=>sm(a)===null))try{await x2(s,t,n),r.push(s)}catch(a){o.push({fix:s,error:a})}for(let s of e.filter(a=>sm(a)!==null)){let a=sm(s),c=i.get(a);c?c.push(s):i.set(a,[s])}for(let s of i.values()){let a=s[0];if(!a)continue;let c=s.map(l=>l.path).filter(l=>typeof l=="string"&&l.length>0);try{a.kind==="prune_file_link"?await Pk(a.item_id,{remove:c,message:dm},t):await Dk(a.item_id,{remove:c,message:dm},t),r.push(...s)}catch(l){o.push(...s.map(d=>({fix:d,error:l})))}}return{applied:r,failed:o}}function N2(e,t){t>0&&e.push(`merge_receipt_evidence_invalid:${t}`)}async function D2(e,t,n,r){let o=await Ck(e,new Set(t.map(y=>y.id)),n,{schema:r.schema,extensionFieldNames:Et(Y())}),i=[];o.unreadable_item_files.length>0&&i.push(`validate_storage_unreadable_items:${o.unreadable_item_files.length}`),o.duplicate_item_ids.length>0&&i.push(`validate_storage_duplicate_item_ids:${o.duplicate_item_ids.length}`),o.history_conflict_marker_streams.length>0&&i.push(`validate_storage_history_conflict_markers:${o.history_conflict_marker_streams.length}`),o.history_unparseable_streams.length>0&&i.push(`validate_storage_unparseable_history:${o.history_unparseable_streams.length}`),o.resurrected_items.length>0&&i.push(`validate_storage_resurrected_items:${o.resurrected_items.length}`),o.unparseable_config_files.length>0&&i.push(`validate_storage_unparseable_config:${o.unparseable_config_files.length}`);let s=i.length,a=await Za(e);a.tracked_path_count>0&&i.push(`validate_storage_tracked_runtime_cache_files:${a.tracked_path_count}`);let c=await ou(e,Sa(r));c.status==="drift"&&i.push(`validate_merge_fence_drift:${c.missing_patterns.length+c.stale_patterns.length}`);let l=await Lt(e),d=l===null?null:await oi(l);d!==null&&d.status!=="ok"&&i.push(`validate_merge_driver_configuration:${d.missing_keys.length+d.drifted_keys.length}`);let u=await kt(l??e,{includeLossless:!0,pmRoot:e}),f=u.receipts,{pendingDecisions:m,lossless:p}=ua(f);m.length>0&&i.push(`validate_merge_decisions_unreviewed:${m.length}`),N2(i,u.invalid_evidence_count);let w=s>0?"error":i.length>0?"warn":"ok";return{check:{name:"storage_integrity",status:w,ok:w==="ok",details:{...o,merge_fence:c,merge_driver_configuration:d,pending_merge_decision_count:m.length,pending_merge_decision_items:[...new Set(m.map(y=>y.item_id))].sort((y,b)=>y.localeCompare(b)),lossless_merge_receipt_count:p.length,invalid_merge_receipt_evidence_count:u.invalid_evidence_count,invalid_merge_receipt_evidence_details:u.invalid_evidence,invalid_merge_receipt_evidence_details_truncated:u.invalid_evidence_truncated,lossless_merge_receipt_items:[...new Set(p.map(y=>y.item_id))].sort((y,b)=>y.localeCompare(b)),tracked_runtime_cache:{tracker_relative_root:a.tracker_relative_root,tracked_paths:a.tracked_paths,tracked_path_count:a.tracked_path_count,remediation_command:a.remediation_command}}},warnings:i}}function qt(e,t,n){n&&qz(t.check,t.warnings),e.checks.push(t.check),e.warnings.push(...t.warnings)}async function P2(e){let t={closureTimestampFixes:[],checks:[],warnings:[...e.initialWarnings],closeReasonBackfillRows:[],estimateBackfillRows:[],resolutionBackfillRows:[],terminalParentFixRows:[],staleLinkPruneRows:[]},n=e.options.fixHints===!0,r=e.options.verboseDiagnostics===!0||e.options.allAffectedIds===!0||e.global.json===!0;if(e.requestedChecks.has("completeness")){let o=await xv(e.pmRoot,e.items,r?1/0:Tt,e.sourceIncomplete);qt(t,o,n)}if(e.requestedChecks.has("metadata")){let o=e2(e.items,e.metadataPolicy,e.statusRegistry,r,[e.settings.id_prefix]);t.closeReasonBackfillRows=o.closeReasonBackfillRows,t.estimateBackfillRows=o.estimateBackfillRows;let i=await ak(e.pmRoot,e.items,e.statusRegistry,e.options.autoFix===!0||n,r?1/0:Tt);t.closureTimestampFixes=i.fixes,Object.assign(o.check.details,i.details),o.warnings.push(...i.warnings),o.check.ok=o.warnings.length===0,o.check.status=o.check.ok?"ok":"warn",qt(t,o,n)}if(e.requestedChecks.has("resolution")){let o=t2(e.items,e.statusRegistry,r);t.resolutionBackfillRows=o.resolutionBackfillRows,qt(t,o,n)}if(e.requestedChecks.has("lifecycle")){let o=T2(e.items,!!e.options.checkStaleBlockers,e.dependencyCycleSeverity,e.parentCycleSeverity,e.statusRegistry,e.lifecyclePatternPolicy,r,e.settings.id_prefix);t.terminalParentFixRows=o.terminalParentFixRows,qt(t,o,n),qt(t,o2(e.items,r,e.statusRegistry),n)}if(e.requestedChecks.has("files")){let o=await A2(e.items,e.workspaceRoot,e.pmRoot,e.fileScanMode,!!e.options.includePmInternals,!!e.options.verboseFileLists,e.statusRegistry);t.staleLinkPruneRows=o.staleLinkPruneRows,qt(t,o,n)}return e.requestedChecks.has("command_references")&&qt(t,await C2(e.items,e.settings.id_prefix,r,e.pmRoot),n),e.requestedChecks.has("history_drift")&&qt(t,await Gk(e.pmRoot,e.items,r),n),e.requestedChecks.has("format_version")&&qt(t,O2(e.items,r),n),e.requestedChecks.has("storage_integrity")&&qt(t,await D2(e.pmRoot,e.items,ge(e.settings,Y()).type_to_folder,e.settings),n),t}function L2(e,t,n){let r=[];return e.autoFix===!0&&(r.push(...t.closureTimestampFixes),r.push(...uk(t.closeReasonBackfillRows)),r.push(...dk(t.resolutionBackfillRows)),r.push(...fk(t.estimateBackfillRows,n.validation.estimate_defaults_by_type)),r.push(...mk(t.terminalParentFixRows))),e.pruneMissing===!0&&r.push(...pk(t.staleLinkPruneRows)),r}async function M2(e,t,n,r,o,i){if(e.autoFix!==!0&&e.pruneMissing!==!0)return;let s=L2(e,t,n),{applicable:a,gated:c}=gk(s,r),l=e.dryRun===!0,d=[],u=[];if(!l){let f=await R2(a,o,i);d.push(...f.applied.map($i)),u.push(...f.failed.map(({fix:m,error:p})=>({...$i(m),error:p instanceof Error?p.message:String(p)})))}return{mode:l?"dry_run":"apply",auto_fix:e.autoFix===!0,prune_missing:e.pruneMissing===!0,granted_fix_scopes:[...r].sort((f,m)=>f.localeCompare(m)),planned_count:s.length,applied_count:d.length,gated_count:c.length,failed_count:u.length,planned_fixes:s.map($i),applied_fixes:d,gated_fixes:c.map(f=>({...$i(f),gate_hint:`Withheld: re-run with --fix-scope ${f.gate} to apply.`})),failed_fixes:u}}async function tE(e,t,n={}){Q_(e.counts===!0,e.full===!0,"--counts");let r=e.autoFix===!0||e.pruneMissing===!0;if(e.dryRun===!0&&!r)throw new g("--dry-run requires --auto-fix or --prune-missing (there is nothing to preview otherwise).",_.USAGE);if(e.fixScope!==void 0&&e.fixScope.length>0&&e.autoFix!==!0)throw new g("--fix-scope requires --auto-fix.",_.USAGE);let o=_k(e.fixScope),i=X(process.cwd(),t.path);await Me(i);let s=await re(i),a=at(s.schema),c=ge(s,Y()),l=Bz(e),d=[],u=await Bk({includeBody:["history_drift","metadata","completeness"].some(H=>l.has(H)),pmRoot:i,settings:s,typeToFolder:c.type_to_folder,warnings:d}),f=d.length>0;if(l.has("history_drift")){let H=await Ja(i);H.actionable_unknown_event_count>0&&d.push(`validate_history_unknown_author_events:${H.actionable_unknown_event_count}`)}let m=typeof e.metadataProfile=="string"?"option":"settings",p=Iz(typeof e.metadataProfile=="string"?e.metadataProfile:s.validation.metadata_profile),w=Rz(p,m,s.validation.metadata_required_fields),y=Az(s),b=Cz(e.dependencyCycleSeverity),v=Oz(e.parentCycleSeverity),I=Pz(e.scanMode),A=Lz(i),C=await P2({requestedChecks:l,options:e,global:t,pmRoot:i,workspaceRoot:A,settings:s,items:u,statusRegistry:a,metadataPolicy:w,lifecyclePatternPolicy:y,dependencyCycleSeverity:b,parentCycleSeverity:v,fileScanMode:I,initialWarnings:[...new Set(d)],sourceIncomplete:f}),P=r?await M2(e,C,s,o,t,n):void 0,S=[...new Set(C.warnings)].sort((H,q)=>H.localeCompare(q)),z={ok:!C.checks.some(H=>H.status==="error"),has_warnings:S.length>0,checks:C.checks,warnings:S,...P!==void 0?{fixes:P}:{},generated_at:$(),projection:{mode:"full",declared_field_groups:[{name:"diagnostic_rows",restore_with:"--full"}],included_field_groups:["diagnostic_rows"]}};return e.counts!==!0?z:{...Tz(z),projection:{mode:"counts",declared_field_groups:[{name:"diagnostic_rows",restore_with:"--full"}],included_field_groups:[]}}}(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]="017ec565-4b8d-5da3-badc-e9f4ca3ec433")}catch{}})();var j2=4;function nE(e){let t=e.checks.find(a=>a.name==="integrity"),n=t?.details.counts,r=typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof n.missing_merge_receipt_history_references=="number"?n.missing_merge_receipt_history_references:0,o=t?.details.missing_merge_receipt_history_reference_details,i=t?.details.missing_merge_receipt_history_reference_details_truncated===!0,s=Array.isArray(o)?o.flatMap(a=>{if(typeof a!="object"||a===null||Array.isArray(a))return[];let c=a;return typeof c.item_id=="string"&&typeof c.history_line=="number"&&Number.isSafeInteger(c.history_line)&&typeof c.receipt_id=="string"?[{item_id:c.item_id,history_line:c.history_line,receipt_id:c.receipt_id}]:[]}):[];return{count:r,truncated:i,coordinates:s}}async function U2(e,t){let n=[];for(let r of t){let o;try{o=await $2(F2.join(e,"history",`${r.item_id}.jsonl`),"utf8")}catch{continue}let i=o.split(/\r?\n/)[r.history_line-1];if(i===void 0||i.trim().length===0)continue;let s;try{s=JSON.parse(i)}catch{continue}let a=ec(s,r.item_id).find(c=>c.receiptId===r.receipt_id);a===void 0||!zf(a)||a.eventTimestamp===void 0||we(a.eventTimestamp,Uf)>=0||n.push({...r,original_event_ts:a.eventTimestamp})}return n}async function z2(e){if(e.options.dryRun===!0||e.options.force!==!0||e.candidates.length===0)return 0;let t=new Map;for(let n of e.candidates){let r=t.get(n.item_id)??[];r.push(n),t.set(n.item_id,r)}for(let[n,r]of t)await tn(n,{author:e.options.author??e.global.author,message:e.options.message??"accept unrecoverable pre-durable merge receipt references",force:!0,auditOperation:"merge_reconcile",forceAuditEntry:!0,auditContext:{merge:{missing_receipt_dispositions:r.map(o=>({receipt_id:o.receipt_id,original_history_line:o.history_line,original_event_ts:o.original_event_ts,reason:"legacy_clone_local_only"}))}}},e.global);return e.candidates.length}async function H2(e){try{return{status:"fulfilled",value:await tn(e.id,{dryRun:e.dryRun,author:e.options.author??e.global.author,message:e.options.message??"record field-aware branch merge provenance",force:e.options.force,auditOperation:"merge_reconcile",auditContext:e.auditContext,forceAuditEntry:!0,mergeReceiptProof:e.mergeReceiptProof},e.global)}}catch(t){return{status:"rejected",reason:t}}}function q2(e){e.results.forEach((t,n)=>{let r=e.receiptOnlyIds[n];if(t.status==="fulfilled"){let o=t.value.changed?"repaired":"skipped_clean";e.repair.streams.push({id:r,outcome:o,entries_rehashed:t.value.history.entries_rehashed,entries_patch_repaired:t.value.history.entries_patch_repaired,reconciled_with_item:t.value.history.reconciled_with_item,...t.value.merge_receipt_proof?{merge_receipt_proof:t.value.merge_receipt_proof}:{},warnings:t.value.warnings}),e.repair.totals[o]+=1;return}e.repair.streams.push({id:r,outcome:"failed",error:t.reason instanceof Error?t.reason.message:String(t.reason)}),e.repair.totals.failed+=1})}async function B2(e){if(e.dryRun||e.repair.totals.failed>0)return 0;let t=new Set(e.repair.streams.flatMap(r=>r.merge_receipt_proof?.trusted?r.merge_receipt_proof.receipt_ids:[])),n=e.pendingReceipts.filter(r=>t.has(r.id));return await Promise.all(n.map(r=>Xo(e.receiptWorkspaceRoot,r,{requireExisting:!0}))),n.length}async function G2(e,t){let n=e.dryRun===!0,r=X(process.cwd(),t.path),o=await Kf(t,{checkOnly:!0,full:!0,skipVectors:!0,skipDrift:!0}),i=nE(o),s=await U2(r,i.coordinates),a=await Lt(r),c=a??r,l=await kt(c,{includeLossless:!0,pmRoot:r});if(l.invalid_evidence_count>0)throw new g(`Merge reconciliation refused ${l.invalid_evidence_count} invalid receipt evidence file(s).`,_.CONFLICT,{code:"merge_receipt_evidence_invalid",required:"Every clone-local and durable receipt candidate must pass bounded-file, schema, and identity validation.",recovery:{suggested_retry:"pm health --check-only --full"}});let d=await z2({candidates:s,options:e,global:t}),u=l.receipts,f=await Yy({cwd:a,receipts:u,dryRun:n,author:e.author,message:e.message,global:t}),m=new Set(f),p=new Map;for(let ne of u.filter(ye=>!m.has(ye.id))){let ye=p.get(ne.item_id)??[];ye.push(ne),p.set(ne.item_id,ye)}let w=Object.fromEntries([...p].map(([ne,ye])=>[ne,{merge:{receipts:ye.map(vt)}}])),y=Object.fromEntries([...p].map(([ne,ye])=>[ne,{gitWorkspaceRoot:a,receipts:ye}])),b=await Ky({dryRun:n,author:e.author??t.author,message:e.message??"post-merge reconciliation of field-aware tracker history",force:e.force,auditOperation:"merge_reconcile",auditContextById:w,...u.length>0?{mergeReceiptProofById:y}:{}},t),v=new Set(b.streams.map(ne=>ne.id)),I=[...p.keys()].filter(ne=>!v.has(ne)),A=await Iu(I,j2,ne=>H2({id:ne,dryRun:n,options:e,global:t,auditContext:w[ne],mergeReceiptProof:y[ne]}));q2({receiptOnlyIds:I,results:A,repair:b});let C=await B2({dryRun:n,pendingReceipts:u,repair:b,receiptWorkspaceRoot:c}),P=await tE({checkHistoryDrift:!0,checkStorageIntegrity:!0},t),S=d===0?o:await Kf(t,{checkOnly:!0,full:!0,skipVectors:!0,skipDrift:!0}),E=nE(S),z=P.checks.every(ne=>ne.status==="ok"),H=n?u.length===0:C+f.length===u.length,q=[b.totals.failed===0,z,H,E.count===0,!E.truncated].every(Boolean),N=i.truncated||E.truncated?"Missing receipt coordinates exceed the bounded detail response; each reviewed --force pass can disposition only the reported eligible batch. Repeat dry-run and --force passes until receipts.missing_history_references_after=0 and pm merge reconcile returns ok=true.":void 0,pe=(n?["Review repair.streams, then rerun pm merge reconcile without --dry-run to apply audited repairs.",N,"No Git hook is installed automatically; invoke this command from an explicit post-merge hook only when your repository policy opts in."]:q?["Reconciliation is complete; commit changed history streams with the merge result.","Rerun pm merge reconcile --dry-run after future tracker-data merges as a non-mutating integrity check."]:["Reconciliation remains incomplete; inspect repair failures and non-green validation checks before retrying.",N,...s.length>0&&d===0?["Pre-durable clone-local-only receipt references are eligible for an audited disposition; rerun with --force after reviewing receipts.legacy_disposition_eligible."]:[],"Do not commit repaired history streams as reconciled until pm merge reconcile returns ok=true."]).filter(ne=>ne!==void 0);return{ok:q,dry_run:n,repair:b,receipts:{pending_before:u.length,reconciled:C,abandoned:f.length,summaries:u.map(vt),missing_history_references_before:i.count,legacy_disposition_eligible:s.length,legacy_disposition_recorded:d,missing_history_references_after:E.count},validation:P,guidance:pe,generated_at:P.generated_at}}(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]="4175f7f5-a689-5d05-982a-f92e21bc83e7")}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]="682aba7b-ccef-5c63-969d-ef0c41fda653")}catch{}})();export{oh as ITEM_LATEST_TIMESTAMP_FIELDS,nh as ITEM_SCALAR_MISSING_VALUE,rh as ITEM_UNION_COLLECTION_FIELDS,Xd as MERGE_DRIVER_ARTIFACT_VALUES,nu as PM_GITATTRIBUTES_END,ri as PM_GITATTRIBUTES_START,va as PM_GITATTRIBUTES_V2_END,ur as PM_GITATTRIBUTES_V2_START,ou as auditMergeAttributeFence,oi as auditMergeDriverConfiguration,Ea as buildMergeAttributePatterns,Q as encodeItemScalarDecisionValue,Lt as findGitWorkspaceRoot,bt as hashItemScalarDecisionValue,kt as inspectMergeReceiptEvidence,BN as installMergeFence,ar as isItemScalarMissingValue,vh as listMergeReceipts,Xo as markMergeReceiptReconciled,Rd as mergeHistoryStreams,Dd as mergeItemDocuments,Pd as mergeJsonDocuments,Nd as mergeRelationshipEventStreams,Jh as refreshMergeAttributeFenceIfInstalled,Vh as resolveMergeInstallContext,Sa as resolveProjectMergeTypeFolders,RN as runMergeDriver,qN as runMergeInstall,_R as runMergeReceiptEvidenceReport,pR as runMergeReceiptReport,G2 as runMergeReconcile,vt as summarizeMergeReceipt};
123
123
  //# sourceMappingURL=sdk-merge.js.map