@unbrained/pm-cli 2026.11.7 → 2026.11.9

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 (259) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +84 -48
  3. package/dist/cli/extension-command-help.js +4 -3
  4. package/dist/cli/help-json-payload.js +1 -1
  5. package/dist/cli/main.js +1 -1
  6. package/dist/cli/register-annotations.js +1 -1
  7. package/dist/cli/register-list-query.js +5 -5
  8. package/dist/cli/runtime/annotation-option-retry.js +2 -0
  9. package/dist/cli/runtime/invocation-options.js +1 -1
  10. package/dist/cli/runtime/projection-retry.js +1 -1
  11. package/dist/cli/runtime/read-output-mutation-retry.js +2 -0
  12. package/dist/cli-bundle/bundle-manifest.json +1 -1
  13. package/dist/cli-bundle/chunks/chunk-3BMIAI4P.js +8 -0
  14. package/dist/cli-bundle/chunks/chunk-5VRJPPUC.js +2 -0
  15. package/dist/cli-bundle/chunks/{chunk-WXVMPLBY.js → chunk-6V4PGJBZ.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-F3B2ULHB.js → chunk-ASJZMYKM.js} +33 -33
  17. package/dist/cli-bundle/chunks/chunk-BLUCQ4T4.js +2 -0
  18. package/dist/cli-bundle/chunks/chunk-ELNWRSGZ.js +9 -0
  19. package/dist/cli-bundle/chunks/{chunk-RFI4O6NU.js → chunk-EZRLW4R6.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-OJZG7Y6S.js → chunk-G6Q4VQSI.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-GCPP37N6.js +116 -0
  22. package/dist/cli-bundle/chunks/{chunk-OIBSKKCO.js → chunk-GDQ2T2OR.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-KPAVZILX.js → chunk-GZVOOHTO.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-3DI6CEF3.js → chunk-IGT252ES.js} +2 -2
  25. package/dist/cli-bundle/chunks/chunk-JK7O7MFO.js +31 -0
  26. package/dist/cli-bundle/chunks/{chunk-MQOZNGPS.js → chunk-JYQXIC6C.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-XSEDESNW.js → chunk-LVDFPGD7.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-QG6FLDM4.js → chunk-MSJ7IHMJ.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-BQ5O3CBF.js → chunk-O2M3TNFY.js} +69 -65
  30. package/dist/cli-bundle/chunks/chunk-UFIM5ZC5.js +6 -0
  31. package/dist/cli-bundle/chunks/chunk-VATZTJE3.js +2 -0
  32. package/dist/cli-bundle/chunks/{chunk-WS2N4TQW.js → chunk-XKY4LUXN.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-VM6OGNQC.js → chunk-YK5GAWOT.js} +2 -2
  34. package/dist/cli-bundle/chunks/{chunk-TGQPCNAD.js → chunk-YV5ALMG2.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-ETHAZC3F.js → chunk-Z3QEEOAM.js} +2 -2
  36. package/dist/cli-bundle/chunks/item-revision-Y5CE3EIN.js +2 -0
  37. package/dist/cli-bundle/chunks/item-transaction-XBIN4KYM.js +2 -0
  38. package/dist/cli-bundle/chunks/{mutation-admission-LUXUKISJ.js → mutation-admission-TAQN2AKK.js} +2 -2
  39. package/dist/cli-bundle/chunks/register-list-query-XMQYFUFI.js +11 -0
  40. package/dist/cli-bundle/chunks/register-mutation-OBVCFLDK.js +20 -0
  41. package/dist/cli-bundle/chunks/{register-operations-AHDWE2G3.js → register-operations-CGNFZ6DR.js} +2 -2
  42. package/dist/cli-bundle/chunks/{register-setup-7BGG3CI3.js → register-setup-LFB5ERXH.js} +2 -2
  43. package/dist/cli-bundle/chunks/{stage-S5BYWLGY.js → stage-NQHF6JPC.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-2SQUWQP3.js +26 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-4FWMXQN3.js +12 -0
  46. package/dist/cli-bundle/focused-chunks/chunk-AH5IST3V.js +2 -0
  47. package/dist/cli-bundle/focused-chunks/{chunk-4EXRRSDS.js → chunk-ALLOWZSH.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-IYJRFJHT.js → chunk-C3DO4ZGZ.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-CUGJ2DY2.js +24 -0
  50. package/dist/cli-bundle/focused-chunks/chunk-HLQOGAWG.js +26 -0
  51. package/dist/cli-bundle/focused-chunks/chunk-HNFY3XLC.js +2 -0
  52. package/dist/cli-bundle/focused-chunks/chunk-IB6TCE7N.js +2 -0
  53. package/dist/cli-bundle/focused-chunks/{chunk-LW4TN5ZM.js → chunk-IS5FLEZW.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/chunk-J7PWHKZK.js +91 -0
  55. package/dist/cli-bundle/focused-chunks/chunk-JU62TKJP.js +82 -0
  56. package/dist/cli-bundle/focused-chunks/chunk-LDMBNTOG.js +2 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-LWMPQRJT.js +2 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-MYBKRV5R.js +2 -0
  59. package/dist/cli-bundle/focused-chunks/chunk-NUFO3OR6.js +44 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-NZQYHPUN.js +3 -0
  61. package/dist/cli-bundle/focused-chunks/{chunk-JRJOFMI7.js → chunk-Q45LDP7P.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/chunk-QWUWNFQO.js +2 -0
  63. package/dist/cli-bundle/focused-chunks/chunk-RNZUORGI.js +2 -0
  64. package/dist/cli-bundle/focused-chunks/{chunk-G2VIY6XA.js → chunk-UIKLNSW3.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-BIDF4KO7.js → chunk-XLSTFUXM.js} +8 -8
  66. package/dist/cli-bundle/focused-chunks/item-revision-M6FOLME2.js +2 -0
  67. package/dist/cli-bundle/focused-chunks/item-transaction-H6VA5JGB.js +2 -0
  68. package/dist/cli-bundle/focused-chunks/mutation-admission-PRTQWQK6.js +2 -0
  69. package/dist/cli-bundle/focused-chunks/stage-7T77PSJD.js +2 -0
  70. package/dist/cli-bundle/main.js +32 -31
  71. package/dist/cli-bundle/sdk-authoring.js +1 -1
  72. package/dist/cli-bundle/sdk-contracts.js +4 -4
  73. package/dist/cli-bundle/sdk-core.js +1 -1
  74. package/dist/cli-bundle/sdk-governance.js +1 -1
  75. package/dist/cli-bundle/sdk-graph.js +1 -1
  76. package/dist/cli-bundle/sdk-merge.js +57 -57
  77. package/dist/cli-bundle/sdk-query.js +1 -1
  78. package/dist/cli-bundle/sdk-runtime.js +1 -1
  79. package/dist/cli-bundle/sdk-testing.js +1 -1
  80. package/dist/cli-bundle/sdk.js +12 -12
  81. package/dist/core/extensions/flag-definition-validation.js +1 -1
  82. package/dist/core/extensions/reserved-host-flags.js +1 -1
  83. package/dist/core/history/history-stream-policy.d.ts +12 -3
  84. package/dist/core/history/history-stream-policy.js +1 -1
  85. package/dist/core/history/projection.d.ts +7 -2
  86. package/dist/core/history/projection.js +1 -1
  87. package/dist/core/item/item-format.d.ts +13 -1
  88. package/dist/core/item/item-format.js +2 -2
  89. package/dist/core/lock/lock.d.ts +1 -1
  90. package/dist/core/lock/lock.js +1 -1
  91. package/dist/core/output/output.d.ts +17 -1
  92. package/dist/core/output/output.js +7 -7
  93. package/dist/core/search/corpus.js +1 -1
  94. package/dist/core/search/providers.d.ts +3 -2
  95. package/dist/core/search/providers.js +1 -1
  96. package/dist/core/search/vector-stores.d.ts +3 -2
  97. package/dist/core/search/vector-stores.js +1 -1
  98. package/dist/core/sentry/instrument.d.ts +2 -1
  99. package/dist/core/sentry/instrument.js +1 -1
  100. package/dist/mcp/tool-definitions.js +1 -1
  101. package/dist/sdk/annotations.d.ts +44 -1
  102. package/dist/sdk/annotations.js +1 -1
  103. package/dist/sdk/authoring.d.ts +6 -0
  104. package/dist/sdk/authoring.js +1 -1
  105. package/dist/sdk/cli-contracts/flag-contracts.d.ts +15 -0
  106. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  107. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  108. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +6 -0
  109. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  110. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  111. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  112. package/dist/sdk/command-line.d.ts +2 -1
  113. package/dist/sdk/command-line.js +1 -1
  114. package/dist/sdk/comments.d.ts +4 -2
  115. package/dist/sdk/comments.js +1 -1
  116. package/dist/sdk/completion/bash.js +1 -1
  117. package/dist/sdk/completion/fish.js +2 -1
  118. package/dist/sdk/completion/zsh.js +4 -1
  119. package/dist/sdk/context-intent-contracts.d.ts +5 -1
  120. package/dist/sdk/context-intent-contracts.js +1 -1
  121. package/dist/sdk/contracts.d.ts +3 -0
  122. package/dist/sdk/contracts.js +1 -1
  123. package/dist/sdk/core.d.ts +14 -0
  124. package/dist/sdk/core.js +1 -1
  125. package/dist/sdk/corpus-shape.d.ts +2 -2
  126. package/dist/sdk/corpus-shape.js +1 -1
  127. package/dist/sdk/define.d.ts +14 -8
  128. package/dist/sdk/define.js +1 -1
  129. package/dist/sdk/extension/command-options.d.ts +123 -0
  130. package/dist/sdk/extension/command-options.js +2 -0
  131. package/dist/sdk/extension-contracts.d.ts +1 -2
  132. package/dist/sdk/extension-contracts.js +1 -1
  133. package/dist/sdk/generated/error-code-catalog-rows.js +1 -1
  134. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  135. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  136. package/dist/sdk/governance.d.ts +8 -0
  137. package/dist/sdk/governance.js +1 -1
  138. package/dist/sdk/graph.d.ts +5 -0
  139. package/dist/sdk/graph.js +1 -1
  140. package/dist/sdk/index.d.ts +61 -1
  141. package/dist/sdk/index.js +1 -1
  142. package/dist/sdk/learnings.d.ts +4 -2
  143. package/dist/sdk/learnings.js +1 -1
  144. package/dist/sdk/lifecycle/item-revision.d.ts +6 -0
  145. package/dist/sdk/lifecycle/item-revision.js +1 -1
  146. package/dist/sdk/lifecycle/restore.d.ts +1 -1
  147. package/dist/sdk/merge.d.ts +3 -0
  148. package/dist/sdk/merge.js +1 -1
  149. package/dist/sdk/notes.d.ts +4 -2
  150. package/dist/sdk/notes.js +1 -1
  151. package/dist/sdk/public-surface.json +1 -1
  152. package/dist/sdk/query/get-facet-roots.js +2 -0
  153. package/dist/sdk/query/get.js +1 -1
  154. package/dist/sdk/query/list.d.ts +5 -1
  155. package/dist/sdk/query/list.js +1 -1
  156. package/dist/sdk/query/search/semantic.d.ts +11 -3
  157. package/dist/sdk/query/search/semantic.js +1 -1
  158. package/dist/sdk/query/search-rendering.d.ts +9 -3
  159. package/dist/sdk/query/search-rendering.js +1 -1
  160. package/dist/sdk/query.d.ts +11 -0
  161. package/dist/sdk/query.js +1 -1
  162. package/dist/sdk/read-output/continuation.d.ts +8 -0
  163. package/dist/sdk/read-output/continuation.js +1 -1
  164. package/dist/sdk/read-output/options.d.ts +1 -1
  165. package/dist/sdk/read-output/options.js +1 -1
  166. package/dist/sdk/read-output/positional-rows.js +2 -0
  167. package/dist/sdk/read-output/surfaces.js +1 -1
  168. package/dist/sdk/read-output/tail-retention.d.ts +34 -0
  169. package/dist/sdk/read-output/tail-retention.js +2 -0
  170. package/dist/sdk/read-output-budget.d.ts +14 -2
  171. package/dist/sdk/read-output-budget.js +1 -1
  172. package/dist/sdk/read-output-contracts.d.ts +24 -4
  173. package/dist/sdk/read-output-contracts.js +1 -1
  174. package/dist/sdk/read-output-rows.d.ts +7 -3
  175. package/dist/sdk/read-output-rows.js +1 -1
  176. package/dist/sdk/runtime/actions.js +1 -1
  177. package/dist/sdk/runtime-input.js +1 -1
  178. package/dist/sdk/runtime.d.ts +26 -3
  179. package/dist/sdk/runtime.js +1 -1
  180. package/dist/sdk/test/execution.d.ts +29 -2
  181. package/dist/sdk/test/execution.js +1 -1
  182. package/dist/sdk/testing.d.ts +14 -1
  183. package/dist/sdk/testing.js +1 -1
  184. package/dist/sdk/traceability/source-traceability.d.ts +4 -1
  185. package/dist/sdk/traceability/source-traceability.js +1 -1
  186. package/dist/sdk/workspace-recipe.d.ts +2 -2
  187. package/dist/sdk/workspace-recipe.js +1 -1
  188. package/docs/AGENT_OUTPUT_ENCODINGS.md +16 -0
  189. package/docs/ARCHITECTURE.md +2 -1
  190. package/docs/COMMANDS.md +4 -1
  191. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +1 -1
  192. package/docs/EXTENSIONS.md +1 -1
  193. package/docs/MCP_OPTION_CONFORMANCE.md +13 -0
  194. package/docs/README.md +2 -2
  195. package/docs/READ_OUTPUT_CONTRACTS.md +99 -0
  196. package/docs/RELEASING.md +27 -5
  197. package/docs/SDK.md +100 -2
  198. package/docs/SDK_CONTEXT_INTEGRITY.md +2 -0
  199. package/docs/agent-task-token-baseline.json +1 -1
  200. package/docs/generated/FLAG_LEXICON_BUDGETS.md +6 -6
  201. package/marketplace.json +1 -1
  202. package/package.json +3 -1
  203. package/packages/pm-beads/package.json +1 -1
  204. package/packages/pm-calendar/package.json +1 -1
  205. package/packages/pm-command-kit/package.json +1 -1
  206. package/packages/pm-digital-twin/package.json +1 -1
  207. package/packages/pm-governance-audit/package.json +1 -1
  208. package/packages/pm-guide-shell/package.json +1 -1
  209. package/packages/pm-kanban/package.json +1 -1
  210. package/packages/pm-lifecycle-hooks/package.json +1 -1
  211. package/packages/pm-linked-test-adapters/package.json +1 -1
  212. package/packages/pm-search-advanced/package.json +1 -1
  213. package/packages/pm-templates/package.json +1 -1
  214. package/packages/pm-todos/package.json +1 -1
  215. package/packages/pm-vcs/package.json +1 -1
  216. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  217. package/plugins/pm-claude/package.json +1 -1
  218. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  219. package/plugins/pm-codex/package.json +1 -1
  220. package/plugins/pm-codex/plugin.json +1 -1
  221. package/runtime-dependencies.json +1 -1
  222. package/dist/cli/extension-command-options.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-4PPWVIIT.js +0 -2
  224. package/dist/cli-bundle/chunks/chunk-5KHLV7JU.js +0 -116
  225. package/dist/cli-bundle/chunks/chunk-COKKWMSC.js +0 -8
  226. package/dist/cli-bundle/chunks/chunk-D53G3NOE.js +0 -6
  227. package/dist/cli-bundle/chunks/chunk-JZWFZH2K.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-O6TIOKCM.js +0 -9
  229. package/dist/cli-bundle/chunks/chunk-WYIDX67P.js +0 -31
  230. package/dist/cli-bundle/chunks/item-revision-SPEKTFBB.js +0 -2
  231. package/dist/cli-bundle/chunks/item-transaction-BT55TQXE.js +0 -2
  232. package/dist/cli-bundle/chunks/register-list-query-DU4W7VJU.js +0 -11
  233. package/dist/cli-bundle/chunks/register-mutation-IC2C53QK.js +0 -20
  234. package/dist/cli-bundle/focused-chunks/chunk-4LDOL6U7.js +0 -26
  235. package/dist/cli-bundle/focused-chunks/chunk-4PW5XWVI.js +0 -2
  236. package/dist/cli-bundle/focused-chunks/chunk-A46YSPRF.js +0 -2
  237. package/dist/cli-bundle/focused-chunks/chunk-AI2PYNFI.js +0 -2
  238. package/dist/cli-bundle/focused-chunks/chunk-AJ2I377F.js +0 -44
  239. package/dist/cli-bundle/focused-chunks/chunk-CWFNQQZE.js +0 -3
  240. package/dist/cli-bundle/focused-chunks/chunk-D3U7FOZR.js +0 -2
  241. package/dist/cli-bundle/focused-chunks/chunk-GFF6BITP.js +0 -2
  242. package/dist/cli-bundle/focused-chunks/chunk-IIBWXNW3.js +0 -3
  243. package/dist/cli-bundle/focused-chunks/chunk-J5N42SKC.js +0 -3
  244. package/dist/cli-bundle/focused-chunks/chunk-KL33JMPC.js +0 -2
  245. package/dist/cli-bundle/focused-chunks/chunk-LH4C7BLB.js +0 -2
  246. package/dist/cli-bundle/focused-chunks/chunk-LTQEYE2L.js +0 -81
  247. package/dist/cli-bundle/focused-chunks/chunk-LTTMERPN.js +0 -12
  248. package/dist/cli-bundle/focused-chunks/chunk-MESFDQ3H.js +0 -26
  249. package/dist/cli-bundle/focused-chunks/chunk-MWTBAI3V.js +0 -2
  250. package/dist/cli-bundle/focused-chunks/chunk-TWULNB3N.js +0 -2
  251. package/dist/cli-bundle/focused-chunks/chunk-XAC6NP7U.js +0 -2
  252. package/dist/cli-bundle/focused-chunks/chunk-XG3TBYQK.js +0 -23
  253. package/dist/cli-bundle/focused-chunks/chunk-XMZAFKVP.js +0 -91
  254. package/dist/cli-bundle/focused-chunks/item-revision-ELI6NGMY.js +0 -2
  255. package/dist/cli-bundle/focused-chunks/item-transaction-GUGAUY77.js +0 -2
  256. package/dist/cli-bundle/focused-chunks/mutation-admission-54FI37AA.js +0 -2
  257. package/dist/cli-bundle/focused-chunks/stage-OHDJ43T2.js +0 -2
  258. package/docs/ECOSYSTEM_PLANNING_REVIEW.md +0 -274
  259. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +0 -472
@@ -0,0 +1,2 @@
1
+ import{b as ye}from"./chunk-G6Q4VQSI.js";import{$c as ge,Bd as g,Cd as v,Fc as pe,Gb as x,Gc as _e,Hb as k,Nb as he,gb as T,hb as re,ib as B,jb as se,kb as ce,nb as ae,ob as de,pb as le,qb as fe,rb as ue,sb as me,tb as N}from"./chunk-ASJZMYKM.js";import{Fa as X,Ha as J,N as V,Na as Q,Ta as Z,Ui as oe,W as Y,Wb as p,Xd as te,fi as ie,pd as ee,qe as I,re as b,uf as ne,za as j}from"./chunk-GCPP37N6.js";import{A as u,C as l,z as W}from"./chunk-O4ZLEN4T.js";import{readdir as Pe}from"node:fs/promises";import H 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]="a319e7d9-e248-573b-bf1f-35217ce49fd0")}catch{}})();function D(e,t){return(t===void 0?void 0:J(e,t))?.execution_role??j[e.trim().toLowerCase()]??"agent"}var O="blocked_by",Ie="blocks",Ae=Object.freeze([O,Ie]),A="no-active-blocker";function a(e){return e.trim().toLowerCase()}function E(e,t){return t?`external:${e}`:`local:${a(e)}`}function _(e){let t=new Map,n=typeof e.blocked_by=="string"?e.blocked_by.trim():"";if(n.length>0&&a(n)!==A){let i=g(n);t.set(E(n,i),i?n:a(n))}for(let i of e.dependencies??[]){let o=typeof i.id=="string"?i.id.trim():"";if(p(i.kind)===O&&o.length>0&&a(o)!==A){let r=g(o)||v(i.source_kind);t.set(E(o,r),r?o:a(o))}}return[...t.values()].sort((i,o)=>i.localeCompare(o))}function C(e){let t=new Map;for(let n of e){let i=a(n.id);i.length!==0&&t.set(i,new Set(_(n)))}for(let n of e){let i=a(n.id);if(i.length!==0)for(let o of n.dependencies??[]){let r=p(o.kind)===Ie&&typeof o.id=="string"?a(o.id):"";if(r.length===0||r===A)continue;let s=t.get(r)??new Set;s.add(i),t.set(r,s)}}return new Map([...t].map(([n,i])=>[n,[...i].sort((o,r)=>o.localeCompare(r))]))}function ve(e,t){let n=a(e.id);return n.length>0?C(t).get(n)??_(e):_(e)}function L(e,t,n,i){let o=e,r=typeof o.id=="string"?i?.get(a(o.id))??ve(o,[...t.values()]):_(e),s=new Set((e.dependencies??[]).filter(c=>p(c.kind)===O&&v(c.source_kind)&&typeof c.id=="string"&&c.id.trim().length>0).map(c=>E(c.id.trim(),!0)));return r.map(c=>{if(g(c)||s.has(E(c,!0)))return{id:c,title:null,status:null,resolved:!1,external:!0,...typeof e.updated_at=="string"?{blocked_since:e.updated_at}:{},resolver:null};let d=t.get(a(c));return d?{id:c,title:d.title,status:d.status,resolved:b(d.status,n)}:{id:c,title:null,status:null,resolved:!1}})}function M(e,t,n){return L(e,t,n)}function De(e,t){let n=new Map(e.map(s=>[a(s.id),s])),i=C(e),o=new Set([...we(t),...t.blocked_statuses]),r=new Set;for(let s of e){let c=I(s.status,t);o.has(c)&&(t.blocked_statuses.has(c)||L(s,n,t,i).some(d=>!d.resolved))&&r.add(a(s.id))}return r}function Oe(e,t,n={},i){let o=[...e.ready,...e.decisions,...e.gates];n.includeContainers===!0&&o.push(...e.containers.filter(s=>s.open_blockers.length===0&&!t.blocked_statuses.has(I(s.item.status,t))));let r={ready:[],decisions:[],gates:[]};for(let s of o){let c=D(s.item.type,i);c==="human"&&n.includeDecisions!==!0?r.decisions.push(s):c==="gate"&&n.includeGates!==!0?r.gates.push(s):r.ready.push(s)}return r}function we(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function Le(e,t,n){let i=[a(e)],o=new Set;for(;i.length>0;){let r=i.pop();if(!o.has(r)){o.add(r);for(let s of t.get(r)??[]){if(!b(s.status,n))return!0;i.push(a(s.id))}}}return!1}function Me(e){let t=new Map,n=new Map,i=new Map,o=C(e);for(let r of e){t.set(a(r.id),r);let s=typeof r.parent=="string"?r.parent.trim():"";if(s.length>0){let c=a(s),d=n.get(c)??[];d.push(r),n.set(c,d)}for(let c of o.get(a(r.id))){let d=a(c),m=i.get(d)??[];m.push(r.id),i.set(d,m)}}return{itemsById:t,childrenByParent:n,blockedByReverse:i,blockerIdsByItem:o}}function He(e,t,n,i){let{itemsById:o,childrenByParent:r,blockedByReverse:s,blockerIdsByItem:c}=Me(t),d=new Set([...we(n),...n.blocked_statuses]),m=new Set(t.filter(f=>!b(f.status,n)).map(f=>a(f.id))),F=[],K=[],S=[],G=[],U=[],q=0;for(let f of e){if(!d.has(I(f.status,n)))continue;q+=1;let z=L(f,o,n,c).filter(h=>!h.resolved),Te=(s.get(a(f.id))??[]).filter(h=>m.has(a(h))).sort((h,Ne)=>h.localeCompare(Ne)),y={item:f,open_blockers:z,unblocks:Te};if(Le(f.id,r,n)){S.push(y);continue}let Be=n.blocked_statuses.has(I(f.status,n));if(z.length===0&&!Be){let h=D(f.type,i);h==="human"?G.push(y):h==="gate"?U.push(y):F.push(y)}else K.push(y)}return{ready:F,blocked:K,containers:S,decisions:G,gates:U,active_count:q,container_count:S.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]="ae1c56b3-148d-502d-9450-e807fdfab4da")}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]="e9b7731d-e6f5-51a8-970b-462c0b728a9c")}catch{}})();function $e(e,t){let n=new Map;for(let i of e){let o=i.external?i.id:t.get(i.id.toLowerCase())?.id??i.id;n.set(i.external?`external:${o}`:`local:${o.toLowerCase()}`,{...i,id:o})}return[...n.values()]}async function P(e,t){let n=H.basename(e),i=(await Pe(H.dirname(e)).catch(o=>{throw pe("Cannot verify the blocker's physical file identity",{exitCode:u.GENERIC_FAILURE,context:{code:"blocker_identity_read_failed",required:"Restore access to the blocker item directory, then retry the item read."},cause:o})})).filter(o=>o.toLowerCase()===n.toLowerCase()).sort((o,r)=>+(r===n)-+(o===n)||o.localeCompare(r)).map(o=>H.parse(o).name)[0];if(i===void 0)throw new l(`Blocker canonical file disappeared during identity verification: ${t}`,u.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker file and validate storage integrity before retrying the item read."});return i}async function ut(e){let t=_(e.metadata);if(t.length===0)return[];let n=new Map([e.metadata.blocked_by,...(e.metadata.dependencies??[]).filter(o=>p(o.kind)==="blocked_by").map(o=>o.id)].filter(o=>typeof o=="string").map(o=>[o.trim().toLowerCase(),o.trim()])),i=new Map;for(let o of t){if(g(o)||!/^(?!\.{1,2}$)[^/\\:\0]+$/u.test(o)||e.metadata.dependencies?.some(c=>c.id.trim()===o&&p(c.kind)==="blocked_by"&&v(c.source_kind)))continue;let r=await x(e.pmRoot,n.get(o),e.settings.id_prefix,e.settings.item_format,e.typeToFolder);if(r===null)continue;let s=await k(r,{schema:e.settings.schema});if(r.id=await P(r.itemPath,r.id),s.document.metadata.id!==r.id)throw new l(`Blocker identity differs from its canonical file: ${r.id}`,u.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker identity and validate storage integrity before retrying the item read."});i.set(o.toLowerCase(),s.document.metadata)}return $e(M({blocked_by:e.metadata.blocked_by,dependencies:e.metadata.dependencies,updated_at:e.metadata.updated_at},i,te(e.settings.schema)),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]="2ad03a1e-c9fc-5f69-8391-97c1e845ba28")}catch{}})();var xe="item_revision_conflict",Fe=10,Ke=/^[0-9a-f]{64}$/u;function w(e,t){return new l(`Invalid expected revision ${JSON.stringify(e)}: ${t}.`,u.USAGE,{code:"expect_hash_invalid",value:e,required:"Pass the 64-character item_hash from pm get <id> --json, optionally as <id>=<item_hash>.",examples:["--expect-hash <item_hash>","--expect-hash pm-a1b2=<item_hash>"]})}function ke(e){let t=typeof e=="string"?e.trim().toLowerCase():"";if(!Ke.test(t))throw w(String(e),"the revision is not a 64-character hexadecimal item_hash");return t}function Ge(e){return(e===void 0?[]:typeof e=="string"?[e]:e).flatMap(t=>{if(typeof t!="string")throw w(String(t),"expected a string");let n=t.split(",").map(i=>i.trim()).filter(i=>i.length>0);if(n.length===0)throw w(t,"the value is empty");return n.map(i=>{let o=i.lastIndexOf("="),r=o===-1?void 0:i.slice(0,o).trim();if(r!==void 0&&r.length===0)throw w(i,"the item id before = is empty");let s=ke(o===-1?i:i.slice(o+1));return r===void 0?{itemHash:s}:{id:r,itemHash:s}})})}async function Ee(e,t){let n=await oe(e),i=X(n,ee()).type_to_folder,o=await x(e,t,n.id_prefix,n.item_format,i);if(o){let{document:r}=await k(o,{schema:n.schema});if(r.metadata.id!==await P(o.itemPath,o.id))throw new l(`Item file ${o.id} embeds the id ${r.metadata.id}; no revision can be bound to an item whose identity is in conflict.`,u.CONFLICT,{code:"item_identity_conflict",item_id:o.id,required:`Repair ${o.id}'s identity first (pm validate reports it; pm restore ${o.id} <version> recovers a recorded state), then read its item_hash again.`});return{id:r.metadata.id,document:r}}try{return{id:(await ye(e,t,n,i)).id,document:W}}catch{throw await he(e,t,n.id_prefix,i)}}function $(e){return Q(e.cwd??process.cwd(),e.pmRoot)}async function Bt(e,t={}){let n=await Ee($(t),e);return{id:n.id,item_hash:ie(n.document)}}async function Ce(e,t,n){let i=[];for(let o of t){let r=o.id??n;if(r===void 0||r.trim().length===0)throw new l("A bare expected revision needs an item to bind to.",u.USAGE,{code:"expect_hash_target_required",required:"This command has no single item argument; name each target as --expect-hash <id>=<item_hash>.",examples:["--expect-hash pm-a1b2=<item_hash>"]});i.push({id:(await Ee(e,r)).id,itemHash:o.itemHash})}return i}function Ue(e){return[...new Set(e.patch.map(t=>{let n=t.path.split("/");return String(n[1]==="metadata"?n[2]:n[1])}))].sort()}async function qe(e,t,n){let i;try{i=await ne(Z(e,t),t)}catch{return}let o=-1;for(let c=i.length-1;c>=0;c-=1){let d=i[c];if(d.after_hash===n){o=c+1;break}if(d.before_hash===n){o=c;break}}if(o===-1)return{expected_revision_recorded:!1,changes_since:[],changes_since_omitted:0};let r=i.slice(o),s=r.slice(-Fe);return{expected_revision_recorded:!0,changes_since:s.map(c=>({ts:c.ts,op:c.op,author:c.author,fields:Ue(c)})),changes_since_omitted:r.length-s.length}}async function Nt(e,t){if(!R(e))return{};let n=await Re(e,t);return{error_code:xe,expected_revision:String(n.context.expected_revision),current_revision:String(n.context.current_revision),details:n.context.details}}function R(e){return _e(e)&&e.context.code===xe}function At(e){let t=e.find(n=>R(n));if(t!==void 0)throw t}function Dt(){return new l("--expect-hash cannot guard an invocation an extension override rewrote: which item it writes is not provable.",u.USAGE,{code:"expect_hash_invocation_rewritten",required:"Run the command without the rewriting extension (--no-extensions), or drop --expect-hash.",why:"An extension parser or preflight override changed this invocation's tracker or arguments, and final dispatch, the extension SDK client and the guard do not share one rewritten view."})}function ze(e,t){if(t===void 0||!R(e)||typeof e.context.item_id!="string"||ue(e))return e;let n=e.context.reason===de;if(!n&&e.context.reason!==ae)return e;let i=me(N(e,new l(e.message,e.exitCode,{...e.context,...le(e.context.item_id,n,t)})));return i.stack=e.stack,i}async function Re(e,t,n){if(!fe(e,t))return e;let i=ze(e,n);if(!R(i)||i.context.details!==void 0)return i;let o=i.context.item_id,r=i.context.expected_revision;if(typeof o!="string"||typeof r!="string")return i;let s;try{s=await qe(t,o,r)}catch{return i}if(s===void 0)return i;let c={expected_revision_recorded:s.expected_revision_recorded,changes_since:s.changes_since.map(m=>({ts:m.ts,op:m.op,author:m.author,fields:[...m.fields]})),changes_since_omitted:s.changes_since_omitted},d=N(i,new l(i.message,i.exitCode,{...i.context,details:c}));return d.stack=i.stack,d}async function Se(e,t,n){try{return{result:await re(e,t),...se(e)}}catch(i){throw e.pmRoot===void 0?i:await Re(i,e.pmRoot,n)}}function We(e){return e.cwd===void 0&&e.pmRoot===void 0?void 0:{scopeArgs:["--pm-path",$(e)]}}async function Ot(e,t,n={}){return Se(await Ve(e,n),t,We(n))}async function Ve(e,t={}){let n=$(t),i=e.map(({id:r,itemHash:s})=>({id:r,itemHash:ke(s)})),o=T();return B(o,n,await Ce(n,i)),o}function Lt(e){let t=ce(e);return t===void 0||t.length>0}function Ye(e){return`expect_hash_unchecked:${e}:no_locked_write_reached_this_item`}var be=new Set(V);function je(e,t={}){let n=e.trim().replace(/\s+/gu,"-"),i=be.has(n)?n:e;if(be.has(i)&&(!ge(i)||i==="deps")&&!Y.has(i))throw Xe(i);if((i==="test"||i==="test-all")&&t.background===!0)throw new l(`--expect-hash cannot guard ${i} --background: the worker runs in another process.`,u.USAGE,{code:"expect_hash_background_unsupported",required:`Run ${i} in the foreground to guard its result recording, or drop --expect-hash for a background run.`})}function Xe(e){return new l(`--expect-hash guards item writes, and ${e} is not a mutation.`,u.USAGE,{code:"expect_hash_requires_mutation",required:"Use --expect-hash (MCP/SDK expectHash) only on a command or action that writes items."})}function Je(e,t){if(t.length===0||typeof e!="object"||e===null||Array.isArray(e))return e;let n=e,i=Array.isArray(n.warnings)?n.warnings:[];return{...n,warnings:[...i,...t.map(Ye)]}}async function Mt(e){let t=e.expectHash;if(t!==void 0&&typeof t!="string"&&!(Array.isArray(t)&&t.every(r=>typeof r=="string")))throw w(JSON.stringify(t)??String(t),"expected a string or an array of strings");let n=Ge(t);if(n.length===0)return e.run();je(e.action,{background:e.background===!0||e.options?.background===!0});let i=T();B(i,e.pmRoot,await Ce(e.pmRoot,n,e.defaultId));let o=await Se(i,e.run,e.invocation);return Je(o.result,o.unchecked)}export{D as a,Ae as b,_ as c,C as d,ve as e,M as f,De as g,Oe as h,He as i,ut as j,xe as k,Fe as l,ke as m,Ge as n,Bt as o,Ce as p,qe as q,Nt as r,R as s,At as t,Dt as u,ze as v,Re as w,Se as x,Ot as y,Ve as z,Lt as A,Ye as B,je as C,Xe as D,Mt as E};
2
+ //# sourceMappingURL=chunk-BLUCQ4T4.js.map