@unbrained/pm-cli 2026.11.14 → 2026.11.15

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 (234) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +1 -1
  3. package/dist/cli/extension-command-help.js +2 -2
  4. package/dist/cli-bundle/bundle-manifest.json +1 -1
  5. package/dist/cli-bundle/chunks/chunk-6UTBX62V.js +2 -0
  6. package/dist/cli-bundle/chunks/{chunk-65SBMIK6.js → chunk-7AODVNHX.js} +2 -2
  7. package/dist/cli-bundle/chunks/chunk-ASGAELBQ.js +9 -0
  8. package/dist/cli-bundle/chunks/{chunk-V2OAXGHK.js → chunk-DBUBX4DL.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-547OEGDR.js → chunk-E4B2HWH7.js} +13 -13
  10. package/dist/cli-bundle/chunks/chunk-E74OMFBZ.js +6 -0
  11. package/dist/cli-bundle/chunks/chunk-FSE624WQ.js +2 -0
  12. package/dist/cli-bundle/chunks/chunk-FYOIH56R.js +20 -0
  13. package/dist/cli-bundle/chunks/chunk-GAFALSR2.js +8 -0
  14. package/dist/cli-bundle/chunks/{chunk-AXTUB74T.js → chunk-GCSKHCYK.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-HMVZSXB4.js +8 -0
  16. package/dist/cli-bundle/chunks/chunk-IXV5UM4U.js +31 -0
  17. package/dist/cli-bundle/chunks/chunk-J6L3Q5J4.js +3 -0
  18. package/dist/cli-bundle/chunks/chunk-KLWGIEDC.js +114 -0
  19. package/dist/cli-bundle/chunks/chunk-KSLPRST2.js +10 -0
  20. package/dist/cli-bundle/chunks/chunk-LC6DL446.js +3 -0
  21. package/dist/cli-bundle/chunks/{chunk-MELSYAFE.js → chunk-NAX554KY.js} +35 -35
  22. package/dist/cli-bundle/chunks/chunk-PMIGRSNZ.js +2 -0
  23. package/dist/cli-bundle/chunks/chunk-Q6GBRK27.js +3 -0
  24. package/dist/cli-bundle/chunks/chunk-QZNDEZYI.js +2 -0
  25. package/dist/cli-bundle/chunks/chunk-S5UXBECQ.js +2 -0
  26. package/dist/cli-bundle/chunks/{chunk-UJMQP2HP.js → chunk-TESRFVGF.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-EXO4PM5J.js → chunk-VWKLTHYQ.js} +74 -70
  28. package/dist/cli-bundle/chunks/chunk-YJNY5MKP.js +2 -0
  29. package/dist/cli-bundle/chunks/chunk-YLPZE2TK.js +2 -0
  30. package/dist/cli-bundle/chunks/{chunk-RSAN2YUU.js → chunk-ZVDXGAYV.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-ZWUS65LN.js +2 -0
  32. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-I6RQGD6Y.js → indexed-receipt-blobs-42Y2CSEQ.js} +2 -2
  33. package/dist/cli-bundle/chunks/item-revision-JCEDTAVX.js +2 -0
  34. package/dist/cli-bundle/chunks/item-transaction-BSMGKZ4S.js +2 -0
  35. package/dist/cli-bundle/chunks/mutation-actor-IQHBRFAJ.js +2 -0
  36. package/dist/cli-bundle/chunks/mutation-admission-DF6BFGG6.js +2 -0
  37. package/dist/cli-bundle/chunks/{register-list-query-MCNOV6ML.js → register-list-query-DNKPQB76.js} +2 -2
  38. package/dist/cli-bundle/chunks/{register-mutation-KYXLYHOK.js → register-mutation-WVTDFLEF.js} +3 -3
  39. package/dist/cli-bundle/chunks/register-operations-NR5MTT5T.js +2 -0
  40. package/dist/cli-bundle/chunks/register-setup-2RTG3LII.js +2 -0
  41. package/dist/cli-bundle/chunks/{settlement-hook-JHXLUBEN.js → settlement-hook-W5ULPKIE.js} +2 -2
  42. package/dist/cli-bundle/chunks/stage-YFNK7U26.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-EAYRYXA6.js → chunk-2UQFFVQK.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-52H6AELE.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-YNYO7PMT.js → chunk-63FM3TIG.js} +6 -6
  46. package/dist/cli-bundle/focused-chunks/{chunk-EH7JKGDH.js → chunk-7GCAZJT4.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-BSY6FZ3Y.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/chunk-CZZKAGHE.js +91 -0
  49. package/dist/cli-bundle/focused-chunks/chunk-DRBXOAGY.js +2 -0
  50. package/dist/cli-bundle/focused-chunks/chunk-DXMQ32EH.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/chunk-EALGFJRP.js +78 -0
  52. package/dist/cli-bundle/focused-chunks/chunk-FK2X6MJY.js +44 -0
  53. package/dist/cli-bundle/focused-chunks/{chunk-IDAYTYNN.js → chunk-JE3MFEQZ.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-7KNF6RCV.js → chunk-JRRHN2PZ.js} +12 -12
  55. package/dist/cli-bundle/focused-chunks/chunk-JXA77YIV.js +2 -0
  56. package/dist/cli-bundle/focused-chunks/chunk-LQZ5F6LE.js +3 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-LSWUTTE6.js +6 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-QXOFSZR6.js +3 -0
  59. package/dist/cli-bundle/focused-chunks/{chunk-I7A5VP5E.js → chunk-RMCODWHZ.js} +52 -52
  60. package/dist/cli-bundle/focused-chunks/chunk-S6GTALM4.js +24 -0
  61. package/dist/cli-bundle/focused-chunks/chunk-UPUIDGNJ.js +2 -0
  62. package/dist/cli-bundle/focused-chunks/{chunk-TA4EGVE6.js → chunk-W2KIQ7RF.js} +3 -3
  63. package/dist/cli-bundle/focused-chunks/chunk-WGYR3X6O.js +26 -0
  64. package/dist/cli-bundle/focused-chunks/chunk-WVYXR3YX.js +2 -0
  65. package/dist/cli-bundle/focused-chunks/{chunk-EXCVUBAE.js → chunk-XQZKGTZV.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{chunk-3SUKWYR2.js → chunk-YTNUUEY6.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/chunk-YZUBG4W2.js +6 -0
  68. package/dist/cli-bundle/focused-chunks/chunk-Z6HCQYSW.js +8 -0
  69. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-7XGVHYAO.js → indexed-receipt-blobs-LSBWMXKS.js} +2 -2
  70. package/dist/cli-bundle/focused-chunks/item-revision-YO7YGQYE.js +2 -0
  71. package/dist/cli-bundle/focused-chunks/item-transaction-7A3Q4CAJ.js +2 -0
  72. package/dist/cli-bundle/focused-chunks/mutation-actor-UQHBNHOF.js +2 -0
  73. package/dist/cli-bundle/focused-chunks/mutation-admission-G565NLPE.js +2 -0
  74. package/dist/cli-bundle/focused-chunks/{settlement-hook-H56537UV.js → settlement-hook-UXN76GMA.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/stage-F3YJGNRK.js +2 -0
  76. package/dist/cli-bundle/main.js +7 -7
  77. package/dist/cli-bundle/sdk-authoring.js +1 -1
  78. package/dist/cli-bundle/sdk-contracts.js +3 -3
  79. package/dist/cli-bundle/sdk-core.js +1 -1
  80. package/dist/cli-bundle/sdk-governance.js +1 -1
  81. package/dist/cli-bundle/sdk-graph.js +1 -1
  82. package/dist/cli-bundle/sdk-merge.js +57 -57
  83. package/dist/cli-bundle/sdk-query.js +1 -1
  84. package/dist/cli-bundle/sdk-runtime.js +1 -1
  85. package/dist/cli-bundle/sdk-testing.js +1 -1
  86. package/dist/cli-bundle/sdk.js +11 -11
  87. package/dist/core/extensions/extension-hook-runtime.js +1 -1
  88. package/dist/core/extensions/extension-types.d.ts +30 -0
  89. package/dist/core/extensions/extension-types.js +1 -1
  90. package/dist/core/extensions/index.d.ts +21 -1
  91. package/dist/core/extensions/index.js +1 -1
  92. package/dist/core/extensions/mutation-actor-snapshot.js +2 -0
  93. package/dist/core/extensions/mutation-actor.js +2 -0
  94. package/dist/core/item/deferred-fields.js +2 -0
  95. package/dist/core/item/item-format-version.d.ts +8 -7
  96. package/dist/core/item/item-format-version.js +1 -1
  97. package/dist/core/item/item-format.js +2 -2
  98. package/dist/core/output/output.d.ts +7 -0
  99. package/dist/core/output/output.js +3 -3
  100. package/dist/core/schema/runtime-field-values.d.ts +4 -0
  101. package/dist/core/schema/runtime-field-values.js +1 -1
  102. package/dist/core/shared/item-metadata-contract.js +1 -1
  103. package/dist/core/store/item-store.js +1 -1
  104. package/dist/sdk/agent/closed-domain-contracts.js +1 -1
  105. package/dist/sdk/authoring.d.ts +1 -1
  106. package/dist/sdk/authoring.js +1 -1
  107. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
  108. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  109. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  110. package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
  111. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +1 -1
  112. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  113. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -1
  114. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
  115. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  116. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  117. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  118. package/dist/sdk/completion/fish.js +3 -1
  119. package/dist/sdk/completion/zsh.js +3 -1
  120. package/dist/sdk/extension/command-options.d.ts +23 -4
  121. package/dist/sdk/extension/command-options.js +1 -1
  122. package/dist/sdk/extension/native-command-options.js +2 -0
  123. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  124. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  125. package/dist/sdk/governance/health.js +1 -1
  126. package/dist/sdk/governance/lifecycle-dependency-cycles.d.ts +12 -0
  127. package/dist/sdk/governance/lifecycle-dependency-cycles.js +2 -0
  128. package/dist/sdk/governance/validate-deferred-fields.js +2 -0
  129. package/dist/sdk/governance/validate.d.ts +2 -2
  130. package/dist/sdk/governance/validate.js +1 -1
  131. package/dist/sdk/index.d.ts +1 -1
  132. package/dist/sdk/index.js +1 -1
  133. package/dist/sdk/item-transaction.d.ts +2 -2
  134. package/dist/sdk/item-transaction.js +1 -1
  135. package/dist/sdk/lifecycle/close.js +1 -1
  136. package/dist/sdk/lifecycle/copy.js +1 -1
  137. package/dist/sdk/lifecycle/create-deferrals.js +2 -0
  138. package/dist/sdk/lifecycle/create.d.ts +6 -2
  139. package/dist/sdk/lifecycle/create.js +1 -1
  140. package/dist/sdk/lifecycle/restore.js +1 -1
  141. package/dist/sdk/lifecycle/shared-unset-fields.d.ts +7 -1
  142. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
  143. package/dist/sdk/merge/three-way.d.ts +1 -1
  144. package/dist/sdk/merge/three-way.js +2 -2
  145. package/dist/sdk/package-import-adapters.d.ts +9 -1
  146. package/dist/sdk/package-import-adapters.js +1 -1
  147. package/dist/sdk/public-surface.json +1 -1
  148. package/dist/sdk/query/complete-list.d.ts +14 -5
  149. package/dist/sdk/query/complete-list.js +1 -1
  150. package/dist/sdk/query/list.js +1 -1
  151. package/dist/sdk/query/projection-contracts.d.ts +6 -0
  152. package/dist/sdk/query/projection-contracts.js +1 -1
  153. package/dist/sdk/read-output/extension.js +1 -1
  154. package/dist/sdk/runtime-input.d.ts +6 -2
  155. package/dist/sdk/runtime-input.js +1 -1
  156. package/dist/sdk/runtime-primitives.d.ts +1 -1
  157. package/dist/sdk/runtime-primitives.js +1 -1
  158. package/dist/sdk/runtime.d.ts +2 -2
  159. package/dist/sdk/runtime.js +1 -1
  160. package/dist/sdk/structured-mutations.js +1 -1
  161. package/dist/sdk/testing.d.ts +15 -2
  162. package/dist/sdk/testing.js +1 -1
  163. package/dist/types.d.ts +8 -0
  164. package/dist/types.js +1 -1
  165. package/docs/COMMANDS.md +9 -0
  166. package/docs/EXTENSIONS.md +1 -1
  167. package/docs/SDK.md +111 -5
  168. package/docs/generated/FLAG_LEXICON_BUDGETS.md +1 -1
  169. package/marketplace.json +1 -1
  170. package/package.json +6 -3
  171. package/packages/pm-beads/package.json +1 -1
  172. package/packages/pm-calendar/extensions/calendar/command-definitions.ts +2 -0
  173. package/packages/pm-calendar/package.json +1 -1
  174. package/packages/pm-command-kit/package.json +1 -1
  175. package/packages/pm-digital-twin/package.json +1 -1
  176. package/packages/pm-governance-audit/package.json +1 -1
  177. package/packages/pm-guide-shell/package.json +1 -1
  178. package/packages/pm-kanban/package.json +1 -1
  179. package/packages/pm-lifecycle-hooks/package.json +1 -1
  180. package/packages/pm-linked-test-adapters/package.json +1 -1
  181. package/packages/pm-search-advanced/package.json +1 -1
  182. package/packages/pm-templates/package.json +1 -1
  183. package/packages/pm-todos/extensions/todos/runtime.ts +3 -0
  184. package/packages/pm-todos/package.json +1 -1
  185. package/packages/pm-vcs/package.json +1 -1
  186. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  187. package/plugins/pm-claude/package.json +1 -1
  188. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  189. package/plugins/pm-codex/package.json +1 -1
  190. package/plugins/pm-codex/plugin.json +1 -1
  191. package/runtime-dependencies.json +1 -1
  192. package/dist/cli-bundle/chunks/chunk-25BUKX4W.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-27FG6ROB.js +0 -2
  194. package/dist/cli-bundle/chunks/chunk-5TGFB34A.js +0 -2
  195. package/dist/cli-bundle/chunks/chunk-BHH65KLL.js +0 -2
  196. package/dist/cli-bundle/chunks/chunk-C7M54YV6.js +0 -122
  197. package/dist/cli-bundle/chunks/chunk-DMWL3K4A.js +0 -20
  198. package/dist/cli-bundle/chunks/chunk-DVN7CD5B.js +0 -2
  199. package/dist/cli-bundle/chunks/chunk-DZ7CWUVM.js +0 -8
  200. package/dist/cli-bundle/chunks/chunk-FRCNYOTG.js +0 -9
  201. package/dist/cli-bundle/chunks/chunk-HXECILIE.js +0 -31
  202. package/dist/cli-bundle/chunks/chunk-IDFRGH4X.js +0 -3
  203. package/dist/cli-bundle/chunks/chunk-JSTBYDLL.js +0 -3
  204. package/dist/cli-bundle/chunks/chunk-O4ZLEN4T.js +0 -3
  205. package/dist/cli-bundle/chunks/chunk-OTM6PXZQ.js +0 -8
  206. package/dist/cli-bundle/chunks/chunk-PC5DGK3C.js +0 -6
  207. package/dist/cli-bundle/chunks/chunk-PF3V443A.js +0 -2
  208. package/dist/cli-bundle/chunks/chunk-U2HVJVA5.js +0 -2
  209. package/dist/cli-bundle/chunks/chunk-VERRDW3Q.js +0 -2
  210. package/dist/cli-bundle/chunks/item-revision-VGIHIWZM.js +0 -2
  211. package/dist/cli-bundle/chunks/item-transaction-6OB6BGTD.js +0 -2
  212. package/dist/cli-bundle/chunks/mutation-admission-LL6SGQYU.js +0 -2
  213. package/dist/cli-bundle/chunks/register-operations-6RQF6IAE.js +0 -2
  214. package/dist/cli-bundle/chunks/register-setup-XGPOFFD3.js +0 -2
  215. package/dist/cli-bundle/chunks/stage-ZS7WNUD4.js +0 -2
  216. package/dist/cli-bundle/focused-chunks/chunk-2A4JCFMI.js +0 -2
  217. package/dist/cli-bundle/focused-chunks/chunk-2T6MQ7NP.js +0 -3
  218. package/dist/cli-bundle/focused-chunks/chunk-32QYILXW.js +0 -82
  219. package/dist/cli-bundle/focused-chunks/chunk-4WOF3Q6R.js +0 -2
  220. package/dist/cli-bundle/focused-chunks/chunk-5IQPFV4Y.js +0 -2
  221. package/dist/cli-bundle/focused-chunks/chunk-6C7NBJ7A.js +0 -26
  222. package/dist/cli-bundle/focused-chunks/chunk-FNLOLNPQ.js +0 -2
  223. package/dist/cli-bundle/focused-chunks/chunk-G6ERMFJ5.js +0 -3
  224. package/dist/cli-bundle/focused-chunks/chunk-HRLGC3P7.js +0 -28
  225. package/dist/cli-bundle/focused-chunks/chunk-JHC3X43E.js +0 -2
  226. package/dist/cli-bundle/focused-chunks/chunk-MKYNDWT3.js +0 -91
  227. package/dist/cli-bundle/focused-chunks/chunk-RDTHL44U.js +0 -2
  228. package/dist/cli-bundle/focused-chunks/chunk-UCCLV5GJ.js +0 -8
  229. package/dist/cli-bundle/focused-chunks/chunk-W3RWCLEU.js +0 -2
  230. package/dist/cli-bundle/focused-chunks/chunk-W57DSFSU.js +0 -44
  231. package/dist/cli-bundle/focused-chunks/item-revision-7J7WSCPC.js +0 -2
  232. package/dist/cli-bundle/focused-chunks/item-transaction-F5YMCPRB.js +0 -2
  233. package/dist/cli-bundle/focused-chunks/mutation-admission-2NRQEAOG.js +0 -2
  234. package/dist/cli-bundle/focused-chunks/stage-2KVCKOGC.js +0 -2
@@ -0,0 +1,6 @@
1
+ import{Ha as se,Kc as ie,Pc as D}from"./chunk-YZUBG4W2.js";import{D as M,I as oe,x as L}from"./chunk-QXOFSZR6.js";import{AsyncLocalStorage as Ae}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1fbb183b-c6d8-5834-b4cb-e4fb515572b9")}catch{}})();var z=new Ae,ae=/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,127})$/u;function k(e,n){let t=typeof e=="string"?e.trim():"";return t.length>0?t.slice(0,n):void 0}function E(e,n){if(e===void 0)return;let t=typeof e=="object"&&e!==null?e:{},o=k(t.id,128),r=k(t.parent_id,128);if(o===void 0||!ae.test(o)||r!==void 0&&!ae.test(r)){if(n)throw new Error("Agent episode ids must be 1-128 letters, digits, dots, underscores, colons, or hyphens.");return}let s=k(t.label,256);return{id:o,...s===void 0?{}:{label:s},...r===void 0?{}:{parent_id:r}}}function A(e){let n={};for(let[t,o]of Object.entries(e??{}).slice(0,32)){let r=t.trim().toLowerCase().slice(0,64),s=k(o,256);/^[a-z][a-z0-9_-]{0,63}$/u.test(r)&&s!==void 0&&(n[r]=s)}return n}function we(e,n,t){let o=z.getStore(),r=A({role:n.PM_AGENT_SESSION_ROLE,topic:n.PM_AGENT_SESSION_TOPIC}),s=E(n.PM_AGENT_EPISODE_ID===void 0?void 0:{id:n.PM_AGENT_EPISODE_ID,label:n.PM_AGENT_EPISODE_LABEL,parent_id:n.PM_AGENT_EPISODE_PARENT_ID},!1),i={...A(o?.provenance),...r,...A(e?.provenance)},a=E(e?.episode,!1)??E(t,!1)??s??E(o?.episode,!1);return Object.keys(i).length===0&&a===void 0?void 0:{...Object.keys(i).length===0?{}:{provenance:i},...a===void 0?{}:{episode:a}}}function $(e,n){return we(e.session_context,n,e.client_info?.episode)??{}}function on(e,n){let t=z.getStore(),o=E(e.episode,!0),r=E(t?.episode,!1),s=o!==void 0&&o.parent_id===void 0&&r!==void 0?{...o,parent_id:r.id}:o,i={...A(t?.provenance),...A(e.provenance)};return z.run({...Object.keys(i).length===0?{}:{provenance:i},...s===void 0?r===void 0?{}:{episode:r}:{episode:s}},n)}function sn(e){let n=A(e.provenance),t=E(e.episode,!0);return{...t===void 0?{}:{PM_AGENT_EPISODE_ID:t.id,...t.label===void 0?{}:{PM_AGENT_EPISODE_LABEL:t.label},...t.parent_id===void 0?{}:{PM_AGENT_EPISODE_PARENT_ID:t.parent_id}},...n.role===void 0?{}:{PM_AGENT_SESSION_ROLE:n.role},...n.topic===void 0?{}:{PM_AGENT_SESSION_TOPIC:n.topic}}}import{createHash as ce}from"node:crypto";import{existsSync as x,promises as le,readFileSync as Ie}from"node:fs";import v from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b86f3679-07fa-5566-b8cb-fb05ab89dd31")}catch{}})();var Pe="session.json";function H(e,n){return typeof e=="string"&&e.length>0&&e.length<=n}function de(e){if(e===null||typeof e!="object"||Array.isArray(e))return;let n=e,t=["implementer","planner","release-operator"].includes(String(n.role)),o=["high","medium"].includes(String(n.confidence)),r=H(n.topic,256),s=Array.isArray(n.evidence)&&n.evidence.length<=32&&n.evidence.every(c=>typeof c=="string"&&c.length<=128),i=Array.isArray(n.active_item_ids)&&n.active_item_ids.length<=64&&n.active_item_ids.every(c=>H(c,128)),a=n.focused_item_id===void 0||H(n.focused_item_id,128);if([t,o,r,s,i,a,n.rule_version==="v2"].every(Boolean))return n}function Ce(e){if(e===null||typeof e!="object"||Array.isArray(e))return;let n=Object.entries(e).slice(0,128).flatMap(([t,o])=>{let r=de(o);return r&&t.length<=128?[[t,r]]:[]});return n.length>0?Object.fromEntries(n):void 0}function G(e){return v.join(se(e),Pe)}async function ue(e){try{let n=await le.readFile(G(e),"utf8"),t=JSON.parse(n);if(t===null||typeof t!="object"||Array.isArray(t))return{};let o=t,r=o.focused_item,s=Ce(o.semantic_attribution);return typeof r=="string"&&r.trim().length>0?{focused_item:r,...s?{semantic_attribution:s}:{}}:s?{semantic_attribution:s}:{}}catch{return{}}}async function F(e,n){let t=await ie(e,"session-state",L.locks.ttl_seconds,"session-state",!1,!1,L.locks.wait_ms);try{let o=await ue(e);n(o);let r=G(e);await t.fence(async()=>{await le.mkdir(v.dirname(r),{recursive:!0}),await oe(r,JSON.stringify(o))})}finally{await t.release()}}function U(e){return/#([a-f0-9]{24})$/u.exec(e.trim())?.[1]??`author-${ce("sha256").update(e).digest("hex").slice(0,24)}`}function B(e){return[...new Set(e.map(n=>n.trim()).filter(Boolean))].slice(0,32).map(n=>n.slice(0,128))}function V(e){let n=[...new Set(e)].sort((o,r)=>o.localeCompare(r));if(n.length===1)return n[0];let t=`workset:${n.join("+")}`;return t.length<=256?t:`workset:${n.join("+").slice(0,230)}+${ce("sha256").update(n.join("\0")).digest("hex").slice(0,12)}`}async function W(e,n,t){await F(e,o=>{let r={...o.semantic_attribution},s=t(r[n]);s===void 0?delete r[n]:r[n]=s,Object.keys(r).length===0?delete o.semantic_attribution:o.semantic_attribution=r})}async function mn(e){let n=U(e.principal);await W(e.pmRoot,n,t=>{let o=[...new Set([...t?.active_item_ids??[],e.itemId])].slice(-64).sort((s,i)=>s.localeCompare(i)),r=t?.focused_item_id;return{role:"implementer",topic:r??V(o),confidence:r?"high":"medium",rule_version:"v2",evidence:B([...o.map(s=>`claim:${s}`),...r?[`focus:${r}`]:[],...(e.lineageIds??[]).map(s=>`lineage:${s}`)]),active_item_ids:o,...r?{focused_item_id:r}:{}}})}async function pn(e){let n=U(e.principal);await W(e.pmRoot,n,t=>{if(!t)return;let o=t.active_item_ids.filter(s=>s!==e.itemId);if(o.length===0&&!t.focused_item_id)return;let r=t.focused_item_id;return{...t,role:"release-operator",topic:r??V(o),confidence:r?"high":"medium",evidence:B([...o.map(s=>`claim:${s}`),...r?[`focus:${r}`]:[],`release:${e.itemId}`]),active_item_ids:o}})}async function hn(e){let n=U(e.principal);await W(e.pmRoot,n,t=>{let o=t?.active_item_ids??[];if(!e.itemId&&o.length===0)return;let r=e.itemId;return{role:r?"planner":t.role,topic:r??V(o),confidence:r?"high":"medium",rule_version:"v2",evidence:B([...o.map(s=>`claim:${s}`),...r?[`focus:${r}`]:[],...(e.lineageIds??[]).map(s=>`lineage:${s}`)]),active_item_ids:o,...r?{focused_item_id:r}:{}}})}function De(e,n){let t=n.PM_PATH?.trim();if(t){let r=v.resolve(e,t);if(x(v.join(r,"settings.json")))return r;let s=v.join(r,".agents","pm");if(x(v.join(s,"settings.json")))return s}let o=v.resolve(e);for(let r=0;r<32;r+=1){let s=v.join(o,".agents","pm");if(x(v.join(s,"settings.json")))return s;let i=v.dirname(o);if(i===o)break;o=i}}function fe(e){if(!e.key)return;let n=De(e.cwd,e.env);if(n)try{let t=JSON.parse(Ie(G(n),"utf8"));return de(t.semantic_attribution?.[e.key])}catch{return}}async function gn(e){return(await ue(e)).focused_item}async function yn(e,n){await F(e,t=>{t.focused_item=n})}async function En(e){await F(e,n=>{delete n.focused_item})}import{AsyncLocalStorage as Y}from"node:async_hooks";import{createHash as ke}from"node:crypto";import f from"node:fs";import pe from"node:os";import O from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1ea9ada3-1c97-5787-9b6c-08aeaf825394")}catch{}})();var Z=["model","effort","role","topic","version"],j=new Y,he=new Y,R=new Y,Q=[{harness:"claude-code",environment_keys:["CLAUDE_CODE","CLAUDECODE"],model_environment_keys:["ANTHROPIC_MODEL","CLAUDE_MODEL"],session_environment_keys:["CLAUDE_CODE_SESSION_ID"],provenance_environment_keys:{effort:["CLAUDE_EFFORT"]},provenance_resolvers:{model:"claude_session_file",version:"claude_session_file"},provenance_unavailable_dimensions:["role","topic"],argv_markers:["claude","claude-code"],client_names:["claude","claude-code","claude code"]},{harness:"codex",environment_keys:["CODEX_HOME","CODEX_CI","CODEX_THREAD_ID"],model_environment_keys:["CODEX_MODEL"],session_environment_keys:["CODEX_THREAD_ID"],provenance_environment_keys:{effort:["CODEX_REASONING_EFFORT","CODEX_EFFORT"],role:["CODEX_SESSION_ROLE"]},provenance_resolvers:{model:"codex_session_file",effort:"codex_session_file",version:"ai_agent_version"},provenance_unavailable_dimensions:["topic"],argv_markers:["codex"],client_names:["codex"]},{harness:"pi",environment_keys:["PI_AGENT","PI_CODING_AGENT"],model_environment_keys:["PI_MODEL"],session_environment_keys:["PI_SESSION_ID"],provenance_unavailable_dimensions:["effort","role","topic"],argv_markers:["pi"],client_names:["pi"]},{harness:"opencode",environment_keys:["OPENCODE","OPENCODE_SESSION_ID"],model_environment_keys:["OPENCODE_MODEL"],session_environment_keys:["OPENCODE_SESSION_ID"],provenance_unavailable_dimensions:["effort","role","topic"],argv_markers:["opencode"],client_names:["opencode"]},{harness:"cursor",environment_keys:["CURSOR_AGENT","CURSOR_TRACE_ID"],model_environment_keys:["CURSOR_MODEL"],session_environment_keys:["CURSOR_TRACE_ID"],provenance_unavailable_dimensions:["effort","role","topic"],argv_markers:["cursor"],client_names:["cursor"]},{harness:"aider",environment_keys:["AIDER","AIDER_MODEL"],model_environment_keys:["AIDER_MODEL"],session_environment_keys:["AIDER_SESSION_ID"],provenance_unavailable_dimensions:["effort","role","topic"],argv_markers:["aider"],client_names:["aider"]},{harness:"gemini-cli",environment_keys:["GEMINI_CLI","GEMINI_CLI_HOME"],model_environment_keys:["GEMINI_MODEL"],session_environment_keys:["GEMINI_CLI_SESSION_ID"],provenance_unavailable_dimensions:["effort","role","topic"],argv_markers:["gemini","gemini-cli"],client_names:["gemini","gemini-cli","gemini cli"]},{harness:"ci",environment_keys:["CI","GITHUB_ACTIONS","BUILDKITE","GITLAB_CI"],provenance_unavailable_dimensions:["model","effort","role","topic"],argv_markers:[],client_names:[]}],ge=Object.freeze({max_bytes:1048576,max_lines:4096,network_access:!1,subprocess_access:!1}),Ne=Object.freeze({...ge,max_bytes:4194304}),X=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u;function Te(e){let n=y(e).provenance_unavailable_dimensions,t=new Set(["model","version",...Object.keys(e.provenance_environment_keys??{}),...Object.keys(e.provenance_resolvers??{})]);return Object.freeze({contract_version:1,adapter_version:"v1",priority:0,harness:e.harness,descriptor:e,supported_dimensions:Object.freeze([...t].sort()),native_sources:Object.freeze(["environment","argv","mcp_client",...Object.values(e.provenance_resolvers??{}).some(o=>o?.endsWith("session_file"))?["session_file"]:[]]),probe_policy:e.harness==="codex"?Ne:ge,normalization:Object.freeze({model_family:"v1",effort:"v1",preserve_raw:!0}),confidence:"high",waivers:Object.freeze(Object.fromEntries(n.map(o=>[o,"Harness does not expose this dimension."])))})}var ye=Object.freeze(Q.filter(e=>e.harness!=="ci").map(Te).sort((e,n)=>e.harness.localeCompare(n.harness))),S=new Map,w=new Map;function d(e){let n=typeof e=="string"?e.trim():void 0;return n&&n.length>0?n:void 0}function g(e){return[...new Set((e??[]).slice(0,64).map(n=>n.trim()).filter(n=>n.length>0).map(n=>n.slice(0,128)))]}function y(e){let n=e.harness.trim().toLowerCase();if(!X.test(n))throw new Error(`Invalid harness signal descriptor namespace: ${e.harness}`);return{harness:n,environment_keys:g(e.environment_keys),model_environment_keys:g(e.model_environment_keys),session_environment_keys:g(e.session_environment_keys),provenance_environment_keys:Object.fromEntries(Object.entries(e.provenance_environment_keys??{}).slice(0,32).map(([t,o])=>[t.trim().toLowerCase().slice(0,64),g(o)]).filter(([t])=>X.test(t))),provenance_resolvers:Object.fromEntries(Object.entries(e.provenance_resolvers??{}).slice(0,32).map(([t,o])=>[t.trim().toLowerCase().slice(0,64),o]).filter(t=>typeof t[0]=="string"&&X.test(t[0])&&(t[1]==="ai_agent_version"||t[1]==="claude_session_file"||t[1]==="codex_session_file"))),provenance_unavailable_dimensions:g(e.provenance_unavailable_dimensions).map(t=>t.toLowerCase()),argv_markers:g(e.argv_markers).map(t=>t.toLowerCase()),client_names:g(e.client_names).map(t=>t.toLowerCase())}}var Ee=Q.map(y);function je(e,n){return JSON.stringify(e)===JSON.stringify(n)}function T(e,n){return e.toLowerCase().slice(0,512).split(/[/\\\s:=]+/u).filter(t=>t.length>0).includes(n)||e.trim().toLowerCase()===n}function ee(e=[]){let n=new Map(Q.filter(r=>r.harness!=="ci").map(r=>[r.harness,y(r)]));for(let{adapter:r}of S.values())n.set(r.harness,y(r.descriptor));let t=[...n.values(),...Ee.filter(r=>r.harness==="ci"),...[...w.values()].map(r=>r.descriptor),...R.getStore()?.descriptors??[],...e.map(y)],o=new Set;for(let r of t){if(o.has(r.harness))throw new Error(`Harness signal descriptor collision for "${r.harness}"`);o.add(r.harness)}return t}function ne(e,n){for(let t of n??[]){let o=d(e[t]);if(o)return o.slice(0,256)}}function Re(e,n){if(n==="role"){let t=e.slice(0,8).map(o=>o.trim().toLowerCase()).find(o=>["claim","create","update","close","release","review"].includes(o));if(t==="review")return"reviewer";if(t)return"implementer"}}function be(e,n){let t=n==="model"?["--model","--agent-model"]:[`--agent-${n}`],o=e.slice(0,8);for(let r=0;r<o.length;r+=1){let s=o[r].slice(0,512);if(t.includes(s))return d(o[r+1])?.slice(0,256);let i=t.find(a=>s.startsWith(`${a}=`));if(i)return d(s.slice(i.length+1))?.slice(0,256)}}var Le=new Set(["implementation","implementer","investigator","orchestrator","planner","release-operator","reviewer"]);function b(e,n){if(e!=="role"||n===void 0)return n;let t=n.trim().toLowerCase().replaceAll(/[_\s]+/gu,"-");return Le.has(t)?t:void 0}function J(e,n){return d(e?.[n])?.slice(0,256)}var Me=1048576,K=4194304,N=new Map,_e=Object.freeze({}),q=new Map,ve=Object.freeze({});function me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function ze(e){let n;try{n=JSON.parse(e)}catch{return ve}let t=me(n);if(!t)return ve;let o=[{value:t,depth:0}],r=0,s,i;for(;o.length>0&&r<64;){let a=o.shift();if(r+=1,s??=d(a.value.model)?.slice(0,256),i??=d(a.value.version)?.slice(0,256),s&&i)break;if(!(a.depth>=4))for(let c of Object.values(a.value)){let l=me(c);l&&o.push({value:l,depth:a.depth+1})}}return Object.freeze({model:s,version:i})}function Se(e){try{return f.lstatSync(e).isFile()?"available":"missing"}catch(n){return M(n)?"missing":"failed"}}function $e(e,n){let t;try{t=f.readdirSync(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).sort((r,s)=>r.name.localeCompare(s.name)).slice(0,512).map(r=>{let s=O.join(e,r.name,`${n}.jsonl`);return{candidate:s,status:Se(s)}})}catch(r){return{status:M(r)?"missing":"failed"}}let o=t.filter(({status:r})=>r==="available").map(({candidate:r})=>r);return o.length===0?{status:t.some(({status:r})=>r==="failed")?"failed":"missing"}:o.length>1?{status:"ambiguous"}:{status:"available",path:o[0]}}function Oe(e,n){let t=d(n.CLAUDE_CODE_SESSION_ID);if(!t||!/^[A-Za-z0-9_-]{1,128}$/u.test(t))return{status:"unavailable"};let o=O.resolve(e.cwd??process.cwd()).replaceAll(/[^A-Za-z0-9-]/gu,"-"),r=O.join(e.home_dir??pe.homedir(),".claude","projects"),s=O.join(r,o,`${t}.jsonl`),i=d(e.session_file),a=i&&O.basename(i)===`${t}.jsonl`?i:void 0;for(let c of[a,s]){if(!c)continue;let l=Se(c);if(l==="available")return{status:l,path:c};if(l==="failed")return{status:l}}return $e(r,t)}function xe(e,n,t){let o=Oe(n,t);if(o.status==="available")try{let r=f.openSync(o.path,f.constants.O_RDONLY|f.constants.O_NOFOLLOW);try{let s=f.fstatSync(r),i=`${o.path}\0${s.size}\0${s.mtimeMs}`,a=q.get(i);if(a)return a[e];let c=Math.min(s.size,Me),l=Math.min(c,Math.ceil(c/2)),u=Math.min(c-l,s.size-l),m=Buffer.alloc(l);f.readSync(r,m,0,l,0);let h=Buffer.alloc(u);u>0&&f.readSync(r,h,0,u,s.size-u);let p={},_=s.size<=c?Buffer.concat([m,h]).toString("utf8").split(`
2
+ `):[...m.toString("utf8").split(`
3
+ `).slice(0,4096),...h.toString("utf8").split(`
4
+ `).slice(-4096)];for(let I of _){if(I.length===0||I.length>262144)continue;let C=ze(I);if(p.model??=C.model,p.version??=C.version,p.model&&p.version)break}let P=Object.freeze(p);return q.clear(),q.set(i,P),P[e]}finally{f.closeSync(r)}}catch{return}}function He(e,n){let t=0,o=(r,s)=>{if(s>4||t>=512)return;let i;try{i=f.readdirSync(r,{withFileTypes:!0}).sort((a,c)=>c.name.localeCompare(a.name))}catch{return}for(let a of i){if(t+=1,t>512)return;let c=O.join(r,a.name);if(a.isFile()&&a.name.endsWith(`-${n}.jsonl`))return c;if(a.isDirectory()){let l=o(c,s+1);if(l)return l}}};return o(e,0)}function Ge(e){if(e<=K)return[{offset:0,length:e}];let n=Math.floor(K/2);return[{offset:e-n,length:n},{offset:0,length:n}]}function Fe(e,n){if(n.length===0||n.length>262144)return;let t;try{t=JSON.parse(n)}catch{return}if(typeof t!="object"||t===null||Array.isArray(t))return;let o=t;if(o.type!=="turn_context")return;let r=typeof o.payload=="object"&&o.payload!==null?o.payload:void 0;e.model??=d(r?.model)?.slice(0,256),e.effort??=d(r?.effort)?.slice(0,256)}function Ue(e,n){let t={},o=4096;for(let r of Ge(n)){let s=Buffer.alloc(r.length);f.readSync(e,s,0,r.length,r.offset);let i=s.toString("utf8").split(`
5
+ `).reverse().slice(0,o);o-=i.length;for(let a of i)if(Fe(t,a),t.model&&t.effort)break;if(t.model&&t.effort||o<=0)break}return t}function Be(e,n,t){let o=d(t.CODEX_THREAD_ID);if(!o||!/^[A-Za-z0-9_-]{1,128}$/u.test(o))return;let r=O.join(n.home_dir??pe.homedir(),".codex","sessions"),s=`${r}\0${o}`,i=N.get(s);if(i)return i[e];let a=He(r,o);if(!a){N.set(s,_e);return}try{let c=f.openSync(a,"r");try{let l=f.fstatSync(c).size,u=Ue(c,l);return N.set(s,u),u[e]}finally{f.closeSync(c)}}catch{N.set(s,_e);return}}function Ve(e,n,t,o){let r=R.getStore();if(!(n.probes_enabled!==!1&&r?.probesEnabled!==!1&&!["0","false","off"].includes(d(t.PM_AGENT_PROBES)?.toLowerCase()??"")))return;let s=o?.provenance_resolvers[e];if(s==="claude_session_file")return xe(e,n,t);if(s==="codex_session_file")return Be(e,n,t);if(s==="ai_agent_version"){let i=d(t.AI_AGENT);return!i||!o||!T(i,o.harness)?void 0:/(?:^|[@/\s])v?(\d+\.\d+(?:\.\d+)?(?:[-+][A-Za-z0-9.-]+)?)$/u.exec(i)?.[1]?.slice(0,256)}}function We(e,n,t,o){if(e==="ai_agent_version"){let r=d(o.AI_AGENT);return r!==void 0&&T(r,n.harness)?"available":"unavailable"}return e==="codex_session_file"?d(o.CODEX_THREAD_ID)!==void 0?"available":"unavailable":Oe(t,o).status}function te(e){return e||(he.getStore()??{env:process.env,argv:process.argv})}function Xe(e,n,t,o){let r=e.environment_keys.some(a=>d(n[a])!==void 0),s=e.argv_markers.some(a=>t.some(c=>{let l=c.replaceAll("\\","/");return T(l.slice(l.lastIndexOf("/")+1),a)})),i=e.client_names.some(a=>o===a||T(o,a));return r||s||i}function Je(e,n){if(!n)return;let t;if(e==="topic"&&(t=n.topic),e==="role"&&(t=n.role),!!t)return{value:t,source:"inferred",confidence:n.confidence,rule_version:n.rule_version,evidence:n.evidence}}function qe(e){let n=e.find(([t])=>t!==void 0);return n?.[0]?{value:n[0],source:n[1]}:void 0}function Ke(e,n,t,o,r,s){let i=`PM_AGENT_${e.toUpperCase().replaceAll("-","_")}`,a=new Set([...Z,...Object.keys(o?.provenance_environment_keys??{})]),c,l,u;a.has(e)&&(c=b(e,d(t[i])?.slice(0,256)),u=b(e,be(n.argv??[],e)),l=b(e,Re(n.argv??[],e)));let m={...o?.provenance_environment_keys,model:o?.model_environment_keys},h={...n.client_info?.provenance,model:n.client_info?.model},p=J(r?.provenance,e),_=b(e,ne(t,m[e])),P=b(e,J(h,e)),I=b(e,J(n.provenance,e)),C=Ve(e,n,t,o);return qe([[c,"override"],[p,"session"],[u,"argv"],[_,"environment"],[P,"mcp_client"],[I,"host"],[C,"probe"]])??Je(e,s)??(l?{value:l,source:"argv"}:void 0)}function Ye(e,n){if(!(!e||!n))return ke("sha256").update(`pm-agent-instance:v1\0${e}\0${n}`).digest("hex").slice(0,24)}function Ze(e,n,t,o,r){let s=Object.keys(t?.provenance_environment_keys??{}),i=new Set([...Z,...s,...Object.keys(t?.provenance_resolvers??{}),...Object.keys(e.provenance??{}),...Object.keys(e.client_info?.provenance??{}),...Object.keys(o?.provenance??{})]),a={};for(let c of i){let l=Ke(c,e,n,t,o,r);l?a[c]=l:t&&(c!=="version"||t.provenance_unavailable_dimensions.includes(c))&&(a[c]=null)}return a}function Nn(e){let n=e.map(y),t=new Map(Ee.map(s=>[s.harness,s])),o=new Set;for(let s of n){if(o.has(s.harness)||t.has(s.harness))throw new Error(`Harness signal descriptor collision for "${s.harness}"`);let i=w.get(s.harness);if(i&&!je(i.descriptor,s))throw new Error(`Harness signal descriptor collision for "${s.harness}"`);o.add(s.harness)}for(let s of n){let i=w.get(s.harness);w.set(s.harness,{descriptor:s,registrations:(i?.registrations??0)+1})}let r=!0;return()=>{if(r){r=!1;for(let s of n){let i=w.get(s.harness);!i||i.registrations<=1?w.delete(s.harness):i.registrations-=1}}}}function Qe(e){let n=y(e.descriptor),t=e.harness.trim().toLowerCase();if(e.contract_version!==1)throw new Error(`Unsupported provenance adapter contract for "${t}": ${e.contract_version}`);if(n.harness!==t)throw new Error(`Provenance adapter harness "${t}" does not match descriptor "${n.harness}".`);let o=d(e.adapter_version)?.slice(0,64);if(!o)throw new Error(`Provenance adapter "${t}" requires a version.`);if(!Number.isSafeInteger(e.priority))throw new Error(`Provenance adapter "${t}" requires an integer priority.`);if(e.probe_policy.network_access!==!1||e.probe_policy.subprocess_access!==!1||e.probe_policy.max_bytes>K||e.probe_policy.max_lines>4096)throw new Error(`Provenance adapter "${t}" exceeds the bounded local probe policy.`);return Object.freeze({...e,adapter_version:o,harness:t,descriptor:n,supported_dimensions:Object.freeze(g(e.supported_dimensions).map(r=>r.toLowerCase()).sort()),native_sources:Object.freeze([...new Set(e.native_sources)]),probe_policy:Object.freeze({...e.probe_policy}),normalization:Object.freeze({...e.normalization}),...e.waivers?{waivers:Object.freeze(Object.fromEntries(Object.entries(e.waivers).slice(0,32).map(([r,s])=>[r.slice(0,64),s.slice(0,256)])))}:{}})}function Tn(){let e=new Map(ye.map(n=>[n.harness,n]));for(let{adapter:n}of S.values())e.set(n.harness,n);return Object.freeze([...e.values()].sort((n,t)=>n.harness.localeCompare(t.harness)))}function jn(e){let n=e.map(Qe),t=new Map(ye.map(s=>[s.harness,s])),o=new Set;for(let s of n){if(o.has(s.harness))throw new Error(`Provenance adapter collision for "${s.harness}".`);let i=t.get(s.harness);if(i&&s.priority<=i.priority)throw new Error(`Provenance adapter override for "${s.harness}" requires priority greater than ${i.priority}.`);let a=S.get(s.harness);if(a&&JSON.stringify(a.adapter)!==JSON.stringify(s))throw new Error(`Provenance adapter collision for "${s.harness}".`);o.add(s.harness)}for(let s of n){let i=S.get(s.harness);S.set(s.harness,{adapter:s,registrations:(i?.registrations??0)+1})}let r=!0;return()=>{if(r){r=!1;for(let s of n){let i=S.get(s.harness);!i||i.registrations<=1?S.delete(s.harness):i.registrations-=1}}}}function Rn(e,n){let t=n.trim().slice(0,256),o=t.toLowerCase();if(e==="model"){let r=/^(gpt-\d+(?:\.\d+)?)/u.exec(o)?.[1];r&&(o=r)}else o=o.replaceAll(/[_\s-]+/gu,""),o={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max",ultra:"ultra"}[o]??o;return{raw:t,normalized:o,vocabulary:"v1"}}function Ln(e,n){return he.run(e,n)}function Mn(e,n,t={}){let o=e.map(y);return ee(o),R.run({descriptors:o,probesEnabled:t.probesEnabled!==!1},n)}function re(e){let n=te(e),t=n.env??{},o=ee(n.descriptors),r=[...(n.argv??[]).slice(0,3),...n.process_labels??[]].slice(0,64).map(_=>_.slice(0,512)),s=n.client_info?.name.trim().toLowerCase()??"",i=o.find(_=>Xe(_,t,r,s)),a=$(n,t),c=[ne(t,i?.session_environment_keys),d(n.client_info?.session)?.slice(0,256)].find(_=>_!==void 0),l=Ye(i?.harness,c),u=fe({cwd:n.cwd??process.cwd(),env:t,key:l}),m=Ze(n,t,i,a,u),h=m.model,p=[["harness",i?.harness],["model",h?.value],["model_source",h?.source],["session",c],["instance",l],["provenance",Object.keys(m).length>0?m:void 0],["episode",a.episode]];return Object.fromEntries(p.filter(_=>_[1]!==void 0))}function en(e){return e==="unavailable"?{status:"unavailable",reason:"harness_unavailable"}:e==="missing"?{status:"unavailable",reason:"resolver_input_missing"}:{status:"failed",reason:"resolver_failed"}}function nn(e,n,t,o,r,s,i){let a=t?.provenance_resolvers[e];if(n.provenance?.[e])return{status:"resolved",...a?{resolver:a}:{},rule_version:"v1"};if(i)return{status:"unavailable",reason:"invalid_value",rule_version:"v1"};if(a){if(!s)return{status:"unavailable",reason:"probes_disabled",resolver:a,rule_version:"v1"};let c=We(a,t,o,r);return{...en(c),resolver:a,rule_version:"v1"}}return{status:t?.provenance_unavailable_dimensions.includes(e)?"unavailable":"not_configured",reason:t?.provenance_unavailable_dimensions.includes(e)?"harness_unavailable":"resolver_not_configured",rule_version:"v1"}}function zn(e){let n=te(e),t=re(n),o=ee(n.descriptors).find(l=>l.harness===t.harness),r=n.env??{},s=n.probes_enabled!==!1&&R.getStore()?.probesEnabled!==!1&&!["0","false","off"].includes(d(r.PM_AGENT_PROBES)?.toLowerCase()??""),i=$(n,r),a=[r.PM_AGENT_ROLE,i.provenance?.role,ne(r,o?.provenance_environment_keys.role),n.client_info?.provenance?.role,n.provenance?.role,be(n.argv??[],"role")].some(l=>{let u=d(l)?.slice(0,256);return u!==void 0&&b("role",u)===void 0}),c=Object.fromEntries(Z.map(l=>[l,nn(l,t,o,n,r,s,l==="role"&&a)]));return{...t,provenance_outcomes:c}}function $n(){return process.env.PM_AUTHOR}function xn(e){e===void 0?delete process.env.PM_AUTHOR:process.env.PM_AUTHOR=e}function Hn(e){return re(e).harness}function tn(e,n,t){let o=te(t),r=re(o);if(e!==void 0){let i=d(e);return D(i,"--author"),i?{author:i,source:"asserted",...r}:{author:"unknown",source:"unknown",...r}}if(o.env?.PM_AUTHOR!==void 0){let i=d(o.env.PM_AUTHOR);return D(i,"PM_AUTHOR"),i?{author:i,source:"asserted",...r}:{author:"unknown",source:"unknown",...r}}let s=d(n);return s?(D(s,"default_author"),{author:s,source:"configured",...r}):r.harness?{author:`harness:${r.harness}`,source:"detected",...r}:{author:"unknown",source:"unknown",...r}}function Gn(e){let n=j.getStore();return n?.author===e?n.source:e.startsWith("harness:")?"detected":e==="unknown"?"unknown":"asserted"}function Fn(e){let n=j.getStore();return n?.author!==e?e.startsWith("harness:")?{harness:e.slice(8)}:{}:{...n.harness?{harness:n.harness}:{},...n.model?{model:n.model}:{},...n.model_source?{model_source:n.model_source}:{},...n.session?{session:n.session}:{},...n.instance?{instance:n.instance}:{},...n.provenance?{provenance:n.provenance}:{},...n.episode?{episode:n.episode}:{}}}function Un(e){let n=j.getStore();return n?.author===e&&n.source==="detected"&&n.instance?`${e}#${n.instance}`:e}function Bn(e,n){let t=tn(e,n);return j.enterWith(t),t.author}export{E as a,$ as b,on as c,sn as d,G as e,ue as f,U as g,mn as h,pn as i,hn as j,gn as k,yn as l,En as m,Z as n,Q as o,ye as p,Nn as q,Tn as r,jn as s,Rn as t,Ln as u,Mn as v,re as w,zn as x,$n as y,xn as z,Hn as A,tn as B,Gn as C,Fn as D,Un as E,Bn as F};
6
+ //# sourceMappingURL=chunk-LSWUTTE6.js.map
@@ -0,0 +1,3 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1a939ceb-fa6a-5a95-a82a-e09c8e5cf5d7")}catch{}})();var b=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],x=2,v=Object.freeze({migration:"schema",validation:"schema"}),F=Object.freeze({version:2,capabilities:[...b],legacy_aliases:{...v}}),M=["off","warn","enforce"],P=["off","warn","enforce"],U=["none","restricted","strict"],Y=["block","warn"],q=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore","services.assuranceprovider"],W=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function m(){return{mode:"off",trust_mode:"off",require_provenance:!1,trusted_extensions:[],default_sandbox_profile:"none",allowed_extensions:[],blocked_extensions:[],allowed_capabilities:[],blocked_capabilities:[],allowed_surfaces:[],blocked_surfaces:[],allowed_commands:[],blocked_commands:[],allowed_actions:[],blocked_actions:[],allowed_services:[],blocked_services:[],extension_overrides:[]}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="58db2e8f-05e5-5ffc-a8dd-a73966142f47")}catch{}})();var E=["goal","objective","value","impact","outcome","why_now","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","unblock_note","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result"],T=["id","title","description","type","pm_format_version","source_type","type_options","status","priority","tags","created_at","updated_at","deadline","reminders","events","closed_at","completed_at","assignee","claim_principal","source_owner","author","estimated_minutes","acceptance_criteria","deferred_fields","design","external_ref","definition_of_ready","order",...E,"affected_version","fixed_version","component","regression","customer_impact","dependencies","comments","notes","learnings","files","tests","test_runs","docs","close_reason","duplicate_of","plan_mode","plan_scope","plan_harness","plan_resume_context","plan_validation","plan_decisions","plan_discoveries","plan_steps"],k=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]="426ae308-83c5-5c99-bb0d-c63e9c890570")}catch{}})();var I=Object.freeze([{id:"draft",roles:["draft"]},{id:"open",roles:["active","default_open"]},{id:"in_progress",aliases:["in-progress"],roles:["active"]},{id:"blocked",roles:["blocked"]},{id:"closed",roles:["terminal","terminal_done","default_close"]},{id:"canceled",aliases:["cancelled"],roles:["terminal","terminal_canceled","default_cancel"]}]),O=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),G=".agents/pm",z="settings.json";var N=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],A=["decisions","events","reminders","milestones","meetings","plans"],$=[...N,...A],V={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},D={minimal:{ownership_enforcement:"none",create_mode_default:"progressive",close_validation_default:"off",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!1,duplicate_detection_mode:"off",duplicate_detection_threshold:.8,duplicate_detection_limit:3},default:{ownership_enforcement:"warn",create_mode_default:"progressive",close_validation_default:"warn",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3},strict:{ownership_enforcement:"strict",create_mode_default:"strict",close_validation_default:"strict",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"strict",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3}},S=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],u={blocked_reason:["no active blocker because work is closed","work is closed"],resolution:["closed with implementation evidence","closed with verification evidence","work completed and recorded","work is closed"],actual_result:["closed and recorded","work completed","work completed and recorded"]};function h(e){return e?[...e]:void 0}var J={version:1,id_prefix:"pm-",ids:{token_length:4},author_default:"",agent_identity:{probes_enabled:!0,identity_vocabulary:{version:1,aliases:{}},harness_signals:[]},mutation_guard:{require_attributed_author:!1,secret_guard:"advise",stale_in_progress_hours:72},item_format:"toon",locks:{ttl_seconds:1800,wait_ms:3e3},checkpoints:{retention_days:14},output:{default_format:"toon"},ux:{deprecation_hints:!0},history:{missing_stream:"auto_create",compact_policy:{enabled:!1,max_entries:500,trigger:"health_warn"}},validation:{sprint_release_format:"warn",parent_reference:"warn",metadata_profile:"core",metadata_required_fields:[],lifecycle_stale_blocker_reason_patterns:[...S],lifecycle_closure_like_blocked_reason_patterns:[...u.blocked_reason],lifecycle_closure_like_resolution_patterns:[...u.resolution],lifecycle_closure_like_actual_result_patterns:[...u.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...D.minimal},workflow:{definition_of_done:[]},testing:{record_results_to_items:!1,allow_untrusted_linked_tests:!1},telemetry:{enabled:!0,first_run_prompt_completed:!1,capture_level:"redacted",endpoint:"https://pm-cli.unbrained.dev/v1/events",installation_id:"",retention_days:365},agent_guidance:{prompt_completed:!1,declined:!1,declined_at:"",template_version:1,last_checked_files:[]},item_types:{definitions:[]},schema:{version:1,files:{types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"},statuses:I.map(e=>({...e,aliases:h(e.aliases),roles:h(e.roles)})),fields:[],workflow:{...O},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:m()},search:{score_threshold:0,hybrid_semantic_weight:.7,max_results:50,embedding_model:"",embedding_batch_size:32,embedding_timeout_ms:3e4,scanner_max_batch_retries:3,provider:"",default_mode:"auto",mutation_refresh_policy:"semantic_configured",query_expansion:{enabled:!1,provider:""},rerank:{enabled:!1,model:"",top_k:20}},providers:{openai:{base_url:"",api_key:"",model:""},ollama:{base_url:"",model:""}},context:{default_depth:"brief",activity_limit:10,stale_threshold_days:7,next_ranking_policy:"priority_floor",sections:{hierarchy:!0,activity:!0,progress:!0,recently_created:!0,unparented:!0,blockers:!0,files:!0,workload:!0,staleness:!0,tests:!0}},vector_store:{adapter:"",collection_name:"pm_items",qdrant:{url:"",api_key:""},lancedb:{path:""}}},Q={metadata:{},body:""},y={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},Z=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",init_gitignore_unwritable:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9896afd0-b833-5b30-b047-4881891d3976")}catch{}})();var f=class extends Error{exitCode;code;context;constructor(t,i,o={}){super(t),this.name="PmCliError",this.exitCode=i,this.context=o,this.code=o.code}};import*as r from"node:fs/promises";import{constants as p}from"node:fs";import c from"node:path";import R 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]="3792f1fd-ed9d-5252-887d-e4517a55fb9c")}catch{}})();var C=[10,25,50,100];async function w(e){await r.mkdir(e,{recursive:!0})}async function ne(e){try{return await r.access(e),!0}catch{return!1}}function g(e){return L(e)||l(e,"ENOTDIR")}function L(e){return l(e,"ENOENT")}async function ae(e){try{return await r.readFile(e,"utf8")}catch(t){if(g(t))return null;throw t}}async function le(e,t){let i=await r.open(e,p.O_RDONLY|p.O_NOFOLLOW|p.O_NONBLOCK);try{if(!(await i.stat()).isFile())throw t;return await i.readFile("utf8")}finally{await i.close()}}function ce(e){let t=e?.replaceAll(c.sep,"/"),i=t!==void 0&&!c.posix.isAbsolute(t)&&!c.win32.isAbsolute(t)&&!t.split("/").includes(".."),o=i?t.split("/")[0]:void 0,s={"settings.json":"settings",runtime:"runtime",schema:"schema",history:"history",transactions:"transactions"},n=o===void 0?"tracker_storage":Object.hasOwn(s,o)?s[o]:"tracker_storage",d=i&&t.length>0&&t.length<=160&&t.split("/").every(a=>a!=="."&&/^[a-zA-Z0-9_.-]+$/u.test(a)),_=d?t:`${n} (entry name redacted)`;return new f(`Transaction preview requires regular files and directories. Inspect ${_} relative to the selected tracker root.`,y.USAGE,{code:"transaction_preview_non_regular_file",preview_storage:{storage_area:n,...d?{relative_entry:t}:{},entry_redacted:!d},required:"regular files and directories within the configured tracker storage",why:"Preview does not follow linked entries or read special files.",nextSteps:[`Inspect ${_} within the selected tracker for links, directories used as files, or special files; do not follow link targets.`,"Restore the intended regular files and directories, then retry the original dry-run command."]})}async function de(e,t,i={}){let o=c.dirname(e);i.createParentDirectories!==!1&&await w(o);let s=c.join(o,`.${c.basename(e)}.${process.pid}.${Date.now()}.${R.randomBytes(4).toString("hex")}.tmp`);await r.writeFile(s,t,"utf8");try{await r.rename(s,e)}catch(n){if(process.platform==="win32"&&(l(n,"EPERM")||l(n,"EBUSY"))){let d=n;for(let _ of C){await new Promise(a=>setTimeout(a,_));try{await r.rename(s,e);return}catch(a){if(d=a,!l(a,"EPERM")&&!l(a,"EBUSY"))break}}try{await r.unlink(s)}catch{}throw d}if(l(n,"EXDEV")){try{await r.copyFile(s,e)}finally{try{await r.unlink(s)}catch{}}return}try{await r.unlink(s)}catch{}throw n}}async function _e(e,t){let i=c.dirname(e);await w(i);let o=await r.open(e,"a");try{await o.writeFile(`${t}
2
+ `,"utf8")}finally{await o.close()}}async function fe(e){try{await r.unlink(e)}catch(t){if(!g(t))throw t}}function l(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}export{b as a,x as b,v as c,F as d,M as e,P as f,U as g,Y as h,q as i,W as j,m as k,E as l,k as m,I as n,O as o,G as p,z as q,N as r,$ as s,V as t,D as u,S as v,u as w,J as x,Q as y,y as z,f as A,w as B,ne as C,g as D,L as E,ae as F,le as G,ce as H,de as I,_e as J,fe as K};
3
+ //# sourceMappingURL=chunk-QXOFSZR6.js.map