@unbrained/pm-cli 2026.8.4 → 2026.8.5

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 (214) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +39 -13
  3. package/dist/cli/error-guidance.js +4 -4
  4. package/dist/cli/register-structured-mutation.d.ts +2 -0
  5. package/dist/cli/register-structured-mutation.js +124 -12
  6. package/dist/cli-bundle/bundle-manifest.json +407 -407
  7. package/dist/cli-bundle/chunks/append-VXXGOXSG.js +2 -0
  8. package/dist/cli-bundle/chunks/{chunk-QVO3VTA4.js → chunk-2WFXWAYX.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-NM5G7RLU.js → chunk-3FTILRJ2.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-VH2EAGUG.js → chunk-42E7YPLG.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-RB65T4RX.js → chunk-43HQQI6S.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-J4EPW4GT.js → chunk-45G53IU4.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-PQXEB7W4.js → chunk-4VN6GS4U.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-4YUBDMQM.js +2 -0
  15. package/dist/cli-bundle/chunks/{chunk-D2MBVMVE.js → chunk-54FNT7U2.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-NRDKVOUE.js → chunk-5ZBOIPGP.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-3XZYTRPC.js → chunk-6MSQJOTG.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-GOICHIX4.js → chunk-7A5OT5J2.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-HTYC76A4.js → chunk-7C4PTJG6.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-BKMZTZYL.js → chunk-A62CYISG.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-5H47J5FG.js → chunk-BPELKUQD.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-HE3DZFN4.js → chunk-BXQLRKWF.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-BLINBTMX.js → chunk-CSI3WS5I.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-KH4GVBMC.js → chunk-DXDREUXT.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-KIKLF2W4.js → chunk-E2RKBKWB.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-377OOXUF.js → chunk-EGJ4JTUG.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-SULWTPQO.js → chunk-FPBQHMFT.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-V5K52PYW.js → chunk-GE4KCSZP.js} +35 -35
  29. package/dist/cli-bundle/chunks/{chunk-NPUJ7OLK.js → chunk-HNFD72UK.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-QMWUL66F.js → chunk-HWRRMBJO.js} +5 -5
  31. package/dist/cli-bundle/chunks/chunk-L3AZOELJ.js +2 -0
  32. package/dist/cli-bundle/chunks/{chunk-CGY5I2GO.js → chunk-LKDGK44W.js} +2 -2
  33. package/dist/cli-bundle/chunks/chunk-LN2WFEU4.js +2 -0
  34. package/dist/cli-bundle/chunks/{chunk-ZSH4GNBH.js → chunk-M72BKL5Q.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-HQ2WU7OY.js → chunk-MHK6LIWE.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-H6FITE7D.js → chunk-NE5VRDAI.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-NY4T3JWN.js +2 -0
  38. package/dist/cli-bundle/chunks/{chunk-DCJ6CM6F.js → chunk-OMXVBQ2N.js} +2 -2
  39. package/dist/cli-bundle/chunks/chunk-OPVH7SKD.js +8 -0
  40. package/dist/cli-bundle/chunks/{chunk-CU5ENFNP.js → chunk-OTHLDSFP.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-NH35JNK5.js → chunk-PMXJEU3F.js} +2 -2
  42. package/dist/cli-bundle/chunks/{chunk-SVDH5CHC.js → chunk-Q35VBGOQ.js} +4 -4
  43. package/dist/cli-bundle/chunks/{chunk-5PZGZMPG.js → chunk-R546TPDE.js} +2 -2
  44. package/dist/cli-bundle/chunks/{chunk-Q5F6OI7C.js → chunk-RKAVWO3O.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-JMKVCQSE.js → chunk-SSF4PIUR.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-PA5XRN2A.js → chunk-UN66FZRO.js} +3 -3
  47. package/dist/cli-bundle/chunks/{chunk-FQ4EFFDU.js → chunk-UP7DTVMD.js} +2 -2
  48. package/dist/cli-bundle/chunks/{chunk-NFF3JAQR.js → chunk-UZBWIUYD.js} +2 -2
  49. package/dist/cli-bundle/chunks/{chunk-2POYGY53.js → chunk-V3774P7D.js} +2 -2
  50. package/dist/cli-bundle/chunks/{chunk-B5ZLCD5Z.js → chunk-V3EUXXOF.js} +2 -2
  51. package/dist/cli-bundle/chunks/{chunk-6S7I3UKV.js → chunk-VCKLFEUN.js} +19 -19
  52. package/dist/cli-bundle/chunks/{chunk-PYYPQLHC.js → chunk-VN5VITU3.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-WRL4KNDL.js +20 -0
  54. package/dist/cli-bundle/chunks/{chunk-UJHUR3LZ.js → chunk-XCEZYMNI.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-JDPKBV5P.js → chunk-YEWNL576.js} +2 -2
  56. package/dist/cli-bundle/chunks/{chunk-OB7TRZ2G.js → chunk-YSO3YFZ4.js} +2 -2
  57. package/dist/cli-bundle/chunks/{chunk-UVZREFZU.js → chunk-ZYHOB3SN.js} +2 -2
  58. package/dist/cli-bundle/chunks/close-VZ3OQPN5.js +2 -0
  59. package/dist/cli-bundle/chunks/close-many-SB4TI27P.js +2 -0
  60. package/dist/cli-bundle/chunks/comments-BIF3Q4KY.js +2 -0
  61. package/dist/cli-bundle/chunks/copy-6AI5Z57X.js +2 -0
  62. package/dist/cli-bundle/chunks/{create-RLLCBCXM.js → create-XLKTXTUF.js} +2 -2
  63. package/dist/cli-bundle/chunks/delete-ZY2VHQTP.js +2 -0
  64. package/dist/cli-bundle/chunks/{deps-J4ONTF4X.js → deps-ITTY3GIC.js} +2 -2
  65. package/dist/cli-bundle/chunks/{docs-YL2DJ4WD.js → docs-W4OSRTYR.js} +2 -2
  66. package/dist/cli-bundle/chunks/{files-NGNAIYKK.js → files-EOK4AZI4.js} +2 -2
  67. package/dist/cli-bundle/chunks/focus-DLBNWL7L.js +2 -0
  68. package/dist/cli-bundle/chunks/{history-compact-HW62K5XP.js → history-compact-7UGTMLL3.js} +2 -2
  69. package/dist/cli-bundle/chunks/{history-redact-HVBKUJOW.js → history-redact-4DZRMD6Z.js} +2 -2
  70. package/dist/cli-bundle/chunks/{history-repair-OPNBH5JJ.js → history-repair-UPOSZW5R.js} +2 -2
  71. package/dist/cli-bundle/chunks/{learnings-F36PZXT6.js → learnings-GMRNCBS3.js} +2 -2
  72. package/dist/cli-bundle/chunks/{profile-N3XMWBM7.js → profile-2MUUMHRE.js} +2 -2
  73. package/dist/cli-bundle/chunks/{register-list-query-BKGHBI7Y.js → register-list-query-LR3SQ5ZF.js} +2 -2
  74. package/dist/cli-bundle/chunks/register-mutation-SUOHFVWM.js +20 -0
  75. package/dist/cli-bundle/chunks/register-operations-ARRRKOVN.js +2 -0
  76. package/dist/cli-bundle/chunks/{register-setup-KWV6UD77.js → register-setup-O6AYP6NP.js} +2 -2
  77. package/dist/cli-bundle/chunks/restore-ZVCVHTB5.js +2 -0
  78. package/dist/cli-bundle/chunks/{schema-4PJQMGUY.js → schema-FJ4EA3XF.js} +2 -2
  79. package/dist/cli-bundle/chunks/update-YHV52CSS.js +2 -0
  80. package/dist/cli-bundle/chunks/update-many-M6YHVNXM.js +2 -0
  81. package/dist/cli-bundle/focused-chunks/chunk-7J5TUBUJ.js +153 -0
  82. package/dist/cli-bundle/focused-chunks/{chunk-ONIX2KKW.js → chunk-A7BJ5SS6.js} +2 -2
  83. package/dist/cli-bundle/focused-chunks/chunk-B7LJWAZE.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/{chunk-QM2BIVK7.js → chunk-BIMTMOS7.js} +3 -3
  85. package/dist/cli-bundle/focused-chunks/{chunk-BOGRY7M6.js → chunk-FGKY4MBE.js} +10 -10
  86. package/dist/cli-bundle/focused-chunks/chunk-G6ETT4QK.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/{chunk-C2QSL62X.js → chunk-GJ2TG2CW.js} +2 -2
  88. package/dist/cli-bundle/focused-chunks/{chunk-RO5BQFG3.js → chunk-IPWSFADF.js} +2 -2
  89. package/dist/cli-bundle/focused-chunks/{chunk-UFCPSWIL.js → chunk-MJ7HWSFK.js} +2 -2
  90. package/dist/cli-bundle/focused-chunks/{chunk-2VIIXOAD.js → chunk-N5XU5UVK.js} +2 -2
  91. package/dist/cli-bundle/focused-chunks/chunk-PG2RIZBX.js +2 -0
  92. package/dist/cli-bundle/focused-chunks/{chunk-OYTK4VNH.js → chunk-PIMMYG7Q.js} +2 -2
  93. package/dist/cli-bundle/focused-chunks/{chunk-K37BB4JL.js → chunk-QVHKCI4T.js} +2 -2
  94. package/dist/cli-bundle/focused-chunks/{chunk-SQXVGHMH.js → chunk-RUR5I3TK.js} +2 -2
  95. package/dist/cli-bundle/focused-chunks/chunk-SV3O7TSH.js +8 -0
  96. package/dist/cli-bundle/focused-chunks/{chunk-L6A4NVQC.js → chunk-UIL2M2NA.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-WVGJAD7L.js → chunk-VLYOEYML.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/chunk-W7BJEWHX.js +2 -0
  99. package/dist/cli-bundle/focused-chunks/{chunk-DQ4PLKEE.js → chunk-WEM2E2PE.js} +2 -2
  100. package/dist/cli-bundle/focused-chunks/chunk-WVIVUWVL.js +5 -0
  101. package/dist/cli-bundle/focused-chunks/chunk-Y4LDYLLT.js +2 -0
  102. package/dist/cli-bundle/main.js +4 -4
  103. package/dist/cli-bundle/sdk-authoring.js +1 -1
  104. package/dist/cli-bundle/sdk-contracts.js +1 -1
  105. package/dist/cli-bundle/sdk-core.js +28 -28
  106. package/dist/cli-bundle/sdk-governance.js +1 -1
  107. package/dist/cli-bundle/sdk-graph.js +1 -1
  108. package/dist/cli-bundle/sdk-merge.js +1 -1
  109. package/dist/cli-bundle/sdk-query.js +1 -1
  110. package/dist/cli-bundle/sdk-runtime.js +1 -1
  111. package/dist/cli-bundle/sdk-testing.js +1 -1
  112. package/dist/cli-bundle/sdk.js +1 -1
  113. package/dist/core/extensions/loader.js +5 -2
  114. package/dist/core/item/item-format.js +14 -20
  115. package/dist/core/shared/constants.js +3 -2
  116. package/dist/core/store/item-store.js +2 -2
  117. package/dist/core/store/settings.js +2 -2
  118. package/dist/mcp/server.js +12 -6
  119. package/dist/mcp/tool-definitions.js +14 -7
  120. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +18 -18
  121. package/dist/sdk/cli-contracts/agent-output-contracts.js +51 -23
  122. package/dist/sdk/cli-contracts/commander-mutation-options.js +26 -2
  123. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  124. package/dist/sdk/cli-contracts/flag-contracts.js +28 -2
  125. package/dist/sdk/cli-contracts/registration-helpers.js +4 -2
  126. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +10 -2
  127. package/dist/sdk/cli-contracts/runtime-contracts.js +20 -5
  128. package/dist/sdk/cli-contracts/tool-schema.js +4 -2
  129. package/dist/sdk/cli-contracts.d.ts +2 -2
  130. package/dist/sdk/cli-contracts.js +4 -4
  131. package/dist/sdk/cli-program.js +3 -3
  132. package/dist/sdk/contracts.d.ts +1 -0
  133. package/dist/sdk/contracts.js +3 -2
  134. package/dist/sdk/dependency-provenance.d.ts +2 -0
  135. package/dist/sdk/dependency-provenance.js +7 -3
  136. package/dist/sdk/error-code-catalog.d.ts +23 -0
  137. package/dist/sdk/error-code-catalog.js +25 -5
  138. package/dist/sdk/generated-error-code-catalog.js +499 -3
  139. package/dist/sdk/graph/governance.js +3 -3
  140. package/dist/sdk/graph/remediation.js +3 -3
  141. package/dist/sdk/graph/run.js +4 -8
  142. package/dist/sdk/index.d.ts +2 -1
  143. package/dist/sdk/index.js +4 -3
  144. package/dist/sdk/item-transaction.d.ts +51 -6
  145. package/dist/sdk/item-transaction.js +132 -22
  146. package/dist/sdk/lifecycle/create.d.ts +4 -0
  147. package/dist/sdk/lifecycle/create.js +26 -10
  148. package/dist/sdk/lifecycle-policy.d.ts +9 -0
  149. package/dist/sdk/lifecycle-policy.js +22 -9
  150. package/dist/sdk/merge/driver.js +6 -3
  151. package/dist/sdk/output-contracts.d.ts +67 -0
  152. package/dist/sdk/output-contracts.js +173 -0
  153. package/dist/sdk/package-import-adapters.js +2 -2
  154. package/dist/sdk/structured-mutations.d.ts +23 -0
  155. package/dist/sdk/structured-mutations.js +219 -10
  156. package/dist/sdk/workspace-snapshot.js +58 -12
  157. package/dist/sdk/workspace.js +30 -4
  158. package/docs/COMMANDS.md +40 -10
  159. package/docs/EXTENSIONS.md +1 -1
  160. package/docs/MERGE_SAFETY.md +2 -0
  161. package/docs/PR_REVIEW_LOOP.md +10 -4
  162. package/docs/README.md +22 -22
  163. package/docs/RELEASING.md +3 -3
  164. package/docs/SCRIPTING.md +32 -9
  165. package/docs/SDK.md +91 -11
  166. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  167. package/docs/TESTING.md +25 -0
  168. package/docs/examples/sdk-contract-consumer/README.md +11 -1
  169. package/docs/examples/sdk-contract-consumer/package.json +2 -1
  170. package/docs/examples/sdk-contract-consumer/parse-receipt.mjs +22 -0
  171. package/marketplace.json +2 -2
  172. package/package.json +3 -2
  173. package/packages/pm-beads/package.json +1 -1
  174. package/packages/pm-calendar/package.json +1 -1
  175. package/packages/pm-command-kit/package.json +1 -1
  176. package/packages/pm-digital-twin/package.json +1 -1
  177. package/packages/pm-governance-audit/package.json +1 -1
  178. package/packages/pm-guide-shell/package.json +1 -1
  179. package/packages/pm-kanban/package.json +1 -1
  180. package/packages/pm-lifecycle-hooks/package.json +1 -1
  181. package/packages/pm-linked-test-adapters/package.json +1 -1
  182. package/packages/pm-search-advanced/package.json +1 -1
  183. package/packages/pm-templates/package.json +1 -1
  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-codex/.codex-plugin/plugin.json +1 -1
  188. package/sdk/public-surface.json +292 -14
  189. package/dist/cli-bundle/chunks/append-DHBRLHHS.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-2INN52SU.js +0 -8
  191. package/dist/cli-bundle/chunks/chunk-6RSK4IFN.js +0 -20
  192. package/dist/cli-bundle/chunks/chunk-ASJJKA57.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-IYAVULRN.js +0 -2
  194. package/dist/cli-bundle/chunks/chunk-RRQBHQOV.js +0 -2
  195. package/dist/cli-bundle/chunks/chunk-XBLOD5TZ.js +0 -2
  196. package/dist/cli-bundle/chunks/close-VLHNN6YB.js +0 -2
  197. package/dist/cli-bundle/chunks/close-many-LSJNZKU6.js +0 -2
  198. package/dist/cli-bundle/chunks/comments-AAIA6A6X.js +0 -2
  199. package/dist/cli-bundle/chunks/copy-Z7YMLEHN.js +0 -2
  200. package/dist/cli-bundle/chunks/delete-KNOHHQJM.js +0 -2
  201. package/dist/cli-bundle/chunks/focus-LFRCGALV.js +0 -2
  202. package/dist/cli-bundle/chunks/register-mutation-GU3DCECN.js +0 -20
  203. package/dist/cli-bundle/chunks/register-operations-PTWH727R.js +0 -2
  204. package/dist/cli-bundle/chunks/restore-4HZSLILR.js +0 -2
  205. package/dist/cli-bundle/chunks/update-E6LPS5IV.js +0 -2
  206. package/dist/cli-bundle/chunks/update-many-OSIC6KRO.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/chunk-5MTKO7TV.js +0 -153
  208. package/dist/cli-bundle/focused-chunks/chunk-6GIZK7VQ.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/chunk-AOP2WIZZ.js +0 -2
  210. package/dist/cli-bundle/focused-chunks/chunk-CL75YW32.js +0 -2
  211. package/dist/cli-bundle/focused-chunks/chunk-E7OFMWGT.js +0 -8
  212. package/dist/cli-bundle/focused-chunks/chunk-I5F5UK3Q.js +0 -2
  213. package/dist/cli-bundle/focused-chunks/chunk-T5TSY36R.js +0 -5
  214. package/dist/cli-bundle/focused-chunks/chunk-VT6BF2IX.js +0 -2
@@ -4,7 +4,7 @@
4
4
  * Defines item parsing, formatting, and lifecycle helpers for Item Format.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c9225594-bc3b-5b07-8703-1debd1a98693")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a4c22692-fe27-5178-bba2-190ac3f80628")}catch(e){}}();
8
8
  import { encode as encodeToon } from "@toon-format/toon";
9
9
  import { isDeepStrictEqual } from "node:util";
10
10
  import { CONFIDENCE_TEXT_VALUES, ISSUE_SEVERITY_VALUES, PLAN_STEP_STATUS_VALUES, RECURRENCE_FREQUENCY_VALUES, RECURRENCE_WEEKDAY_VALUES, STATUS_VALUES, weekdayOrderIndex, } from "../../types/index.js";
@@ -116,6 +116,12 @@ function assertItemMetadataCondition(condition, message) {
116
116
  validationError(message);
117
117
  }
118
118
  }
119
+ function requireItemMetadataRecord(value, message) {
120
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
121
+ validationError(message);
122
+ }
123
+ return value;
124
+ }
119
125
  function assertTimestampField(record, fieldName) {
120
126
  const rawValue = record[fieldName];
121
127
  assertItemMetadataCondition(typeof rawValue === "string", `${fieldName} must be a string`);
@@ -168,10 +174,7 @@ function assertRecurrenceExdates(value) {
168
174
  }
169
175
  }
170
176
  function assertValidRecurrenceRule(recurrence) {
171
- assertItemMetadataCondition(typeof recurrence === "object" &&
172
- recurrence !== null &&
173
- !Array.isArray(recurrence), "event.recurrence must be an object");
174
- const recurrenceRecord = recurrence;
177
+ const recurrenceRecord = requireItemMetadataRecord(recurrence, "event.recurrence must be an object");
175
178
  assertItemMetadataCondition(typeof recurrenceRecord.freq === "string", "event.recurrence.freq must be a string");
176
179
  const frequency = recurrenceRecord.freq.trim().toLowerCase();
177
180
  assertItemMetadataCondition(RECURRENCE_FREQUENCY_VALUES.includes(frequency), `event.recurrence.freq must be one of: ${RECURRENCE_FREQUENCY_VALUES.join(", ")}`);
@@ -261,10 +264,7 @@ function assertReminderEntries(record) {
261
264
  }
262
265
  assertItemMetadataCondition(Array.isArray(reminders), "reminders must be an array");
263
266
  for (const reminder of reminders) {
264
- assertItemMetadataCondition(typeof reminder === "object" &&
265
- reminder !== null &&
266
- !Array.isArray(reminder), "reminders entries must be objects");
267
- const reminderRecord = reminder;
267
+ const reminderRecord = requireItemMetadataRecord(reminder, "reminders entries must be objects");
268
268
  assertItemMetadataCondition(typeof reminderRecord.at === "string", "reminder.at must be a string");
269
269
  assertItemMetadataCondition(isTimestampLiteral(reminderRecord.at), "reminder.at must be a valid ISO timestamp");
270
270
  assertItemMetadataCondition(typeof reminderRecord.text === "string", "reminder.text must be a string");
@@ -294,8 +294,7 @@ function assertEventRecurrence(eventRecord) {
294
294
  }
295
295
  }
296
296
  function assertCalendarEventEntry(event) {
297
- assertItemMetadataCondition(typeof event === "object" && event !== null && !Array.isArray(event), "events entries must be objects");
298
- const eventRecord = event;
297
+ const eventRecord = requireItemMetadataRecord(event, "events entries must be objects");
299
298
  assertItemMetadataCondition(typeof eventRecord.start_at === "string", "event.start_at must be a string");
300
299
  assertItemMetadataCondition(isTimestampLiteral(eventRecord.start_at), "event.start_at must be a valid ISO timestamp");
301
300
  if (eventRecord.end_at !== undefined) {
@@ -337,10 +336,8 @@ function assertTypeOptionsField(record) {
337
336
  if (typeOptions === undefined) {
338
337
  return;
339
338
  }
340
- assertItemMetadataCondition(typeof typeOptions === "object" &&
341
- typeOptions !== null &&
342
- !Array.isArray(typeOptions), "type_options must be an object");
343
- for (const [optionKey, optionValue] of Object.entries(typeOptions)) {
339
+ const typeOptionsRecord = requireItemMetadataRecord(typeOptions, "type_options must be an object");
340
+ for (const [optionKey, optionValue] of Object.entries(typeOptionsRecord)) {
344
341
  assertItemMetadataCondition(optionKey.trim().length > 0, "type_options keys must be non-empty");
345
342
  assertItemMetadataCondition(typeof optionValue === "string", "type_options values must be strings");
346
343
  const optionText = optionValue;
@@ -386,10 +383,7 @@ function assertRuntimeUnknownItemMetadataFields(record, runtimeContext) {
386
383
  }
387
384
  }
388
385
  function assertValidItemMetadata(itemMetadata, runtimeContext) {
389
- assertItemMetadataCondition(typeof itemMetadata === "object" &&
390
- itemMetadata !== null &&
391
- !Array.isArray(itemMetadata), "item metadata must be an object");
392
- const record = itemMetadata;
386
+ const record = requireItemMetadataRecord(itemMetadata, "item metadata must be an object");
393
387
  const itemType = assertRequiredItemMetadataFields(record);
394
388
  assertStatusItemMetadataField(record, runtimeContext);
395
389
  assertPriorityAndTags(record);
@@ -1428,4 +1422,4 @@ export const _testOnlyItemFormat = {
1428
1422
  sortTests,
1429
1423
  };
1430
1424
  //# sourceMappingURL=item-format.js.map
1431
- //# debugId=c9225594-bc3b-5b07-8703-1debd1a98693
1425
+ //# debugId=a4c22692-fe27-5178-bba2-190ac3f80628
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8a44d44d-70c7-5321-b436-08aa6505a854")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="46d7e58b-d1b6-5f9d-86cb-76ca671ed127")}catch(e){}}();
3
3
  import { createDefaultExtensionGovernancePolicy } from "../extensions/extension-types.js";
4
4
  /**
5
5
  * Canonical default lifecycle status model and workflow role mapping.
@@ -442,6 +442,7 @@ export const TELEMETRY_ERROR_CATEGORY_BY_CODE = Object.freeze({
442
442
  lock_conflict: "conflict",
443
443
  terminal_state_conflict: "conflict",
444
444
  dependency_failed: "runtime",
445
+ init_gitignore_unwritable: "runtime",
445
446
  merge_git_config_unwritable: "runtime",
446
447
  command_failed: "runtime",
447
448
  unknown_error: "runtime",
@@ -474,4 +475,4 @@ export function resolveTelemetryErrorCategory(errorCode) {
474
475
  return "unknown";
475
476
  }
476
477
  //# sourceMappingURL=constants.js.map
477
- //# debugId=8a44d44d-70c7-5321-b436-08aa6505a854
478
+ //# debugId=46d7e58b-d1b6-5f9d-86cb-76ca671ed127
@@ -4,7 +4,7 @@
4
4
  * Reads and writes tracker storage with format-aware helpers for Item Store.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="827bddce-74c6-5b36-ae56-bf3b14625f82")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f43e1170-e797-5a0c-b02e-d31e002ab275")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveOnReadHooks, runActiveBeforeMutationHooks, runActiveOnWriteHooks, runActiveServiceOverride, } from "../extensions/index.js";
@@ -684,4 +684,4 @@ export async function deleteItem(params) {
684
684
  }
685
685
  }
686
686
  //# sourceMappingURL=item-store.js.map
687
- //# debugId=827bddce-74c6-5b36-ae56-bf3b14625f82
687
+ //# debugId=f43e1170-e797-5a0c-b02e-d31e002ab275
@@ -4,7 +4,7 @@
4
4
  * Reads and writes tracker storage with format-aware helpers for Settings.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9381a512-7436-5d2c-9667-3845b777b901")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a434b9ea-4692-51c5-8761-0f1759fff394")}catch(e){}}();
8
8
  import { validateSettings } from "./settings-validator.js";
9
9
  import { runActiveOnReadHooks, runActiveOnWriteHooks, } from "../extensions/index.js";
10
10
  import { GOVERNANCE_PRESET_DEFAULTS, SETTINGS_DEFAULTS, } from "../shared/constants.js";
@@ -1298,4 +1298,4 @@ export const settingsStoreTestOnly = {
1298
1298
  selectedSettingsReadCacheSignaturesEqual,
1299
1299
  };
1300
1300
  //# sourceMappingURL=settings.js.map
1301
- //# debugId=9381a512-7436-5d2c-9667-3845b777b901
1301
+ //# debugId=a434b9ea-4692-51c5-8761-0f1759fff394
@@ -5,7 +5,7 @@
5
5
  * Runs the MCP server adapter that exposes pm actions and contracts to external agents.
6
6
  */
7
7
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fdff0dd1-1651-5f01-b822-60c075d14ad2")}catch(e){}}();
8
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="561c51e0-d7d9-5303-b116-443ad5037943")}catch(e){}}();
9
9
  import { realpathSync } from "node:fs";
10
10
  import { readFile } from "node:fs/promises";
11
11
  import path from "node:path";
@@ -20,7 +20,7 @@ import { PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, } from "../sdk/agen
20
20
  import { commitItemMutations } from "../sdk/item-transaction.js";
21
21
  import { isRuntimeRecord } from "../sdk/runtime-input.js";
22
22
  import { attachOutputTokenAccounting } from "../sdk/output-token-accounting.js";
23
- import { parseAtomicMutationControls, validateItemMutationRows, } from "../sdk/structured-mutations.js";
23
+ import { parseAtomicMutationControls, resolveItemMutationDocument, } from "../sdk/structured-mutations.js";
24
24
  import { resolveAuthor, resolvePmRoot } from "../sdk/runtime-primitives.js";
25
25
  const PM_PACKAGE_ROOT_ENV = "PM_CLI_PACKAGE_ROOT";
26
26
  function resolvePmPackageRoot() {
@@ -99,18 +99,23 @@ const HANDLERS = {
99
99
  pm_run: (args) => runAction(args),
100
100
  pm_mutate: async (args) => {
101
101
  const transactionId = readRequiredString(args, "transactionId");
102
- const mutations = validateItemMutationRows(args.mutations);
103
102
  const controls = parseAtomicMutationControls(args);
103
+ const cwd = typeof args.cwd === "string" ? args.cwd : process.cwd();
104
+ const pmRoot = resolvePmRoot(cwd, typeof args.path === "string" ? args.path : undefined);
105
+ const resolved = resolveItemMutationDocument(JSON.stringify({ schema_version: 1, mutations: args.mutations }), {
106
+ transactionId,
107
+ idPrefix: (await readSettings(pmRoot)).id_prefix,
108
+ });
109
+ const { mutations, references } = resolved;
104
110
  if (args.dryRun === true) {
105
111
  return {
106
112
  transaction_id: transactionId,
107
113
  dry_run: true,
108
114
  mutation_count: mutations.length,
109
115
  mutations,
116
+ references,
110
117
  };
111
118
  }
112
- const cwd = typeof args.cwd === "string" ? args.cwd : process.cwd();
113
- const pmRoot = resolvePmRoot(cwd, typeof args.path === "string" ? args.path : undefined);
114
119
  const result = await runWithActiveExtensions({
115
120
  cwd: typeof args.cwd === "string" ? args.cwd : undefined,
116
121
  path: typeof args.path === "string" ? args.path : undefined,
@@ -127,6 +132,7 @@ const HANDLERS = {
127
132
  ...commitResult,
128
133
  transaction_id: committedTransactionId,
129
134
  mutation_count: mutations.length,
135
+ references,
130
136
  };
131
137
  },
132
138
  ...Object.fromEntries(Object.entries(NARROW_TOOL_ACTIONS).map(([tool, action]) => [
@@ -615,4 +621,4 @@ if (isInvokedAsMcpMainModule(process.argv[1], import.meta.url)) {
615
621
  }
616
622
  /* c8 ignore stop */
617
623
  //# sourceMappingURL=server.js.map
618
- //# debugId=fdff0dd1-1651-5f01-b822-60c075d14ad2
624
+ //# debugId=561c51e0-d7d9-5303-b116-443ad5037943
@@ -4,7 +4,7 @@
4
4
  * Defines the Tool Definitions module for pm CLI source.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ade687e6-6547-5a2f-818f-0ed06dce9de5")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="89c1ac6d-c217-54ea-8728-5a58762f86d9")}catch(e){}}();
8
8
  import { GRAPH_SUBCOMMAND_VALUES, PM_TOOL_ACTIONS, } from "../sdk/cli-contracts/enum-contracts.js";
9
9
  import { buildPmActionToolInputSchema } from "../sdk/cli-contracts/tool-schema.js";
10
10
  import { RUNTIME_STATUS_ROLE_VALUES } from "../types.js";
@@ -254,8 +254,8 @@ const RAW_TOOLS = [
254
254
  },
255
255
  {
256
256
  name: "pm_mutate",
257
- description: "Apply an ordered create/update/close batch atomically through the public pm SDK. " +
258
- "Use a stable transactionId to resume interrupted work; set dryRun=true to validate and preview without writes.",
257
+ description: "Apply an ordered create/update/close/release batch atomically through the public pm SDK. " +
258
+ "Create rows may declare ref and omit id; @ref forward references resolve deterministically from the stable transactionId. Set dryRun=true to validate and preview without writes.",
259
259
  inputSchema: objectSchema({
260
260
  transactionId: {
261
261
  type: "string",
@@ -264,16 +264,23 @@ const RAW_TOOLS = [
264
264
  mutations: {
265
265
  type: "array",
266
266
  minItems: 1,
267
- description: "Ordered rows shaped as {op:create|update|close,id,options?,reason?}.",
267
+ description: "Ordered rows shaped as {op:create|update|close|release,id?,ref?,options?,reason?}.",
268
268
  items: {
269
269
  type: "object",
270
270
  properties: {
271
- op: { type: "string", enum: ["create", "update", "close"] },
271
+ op: {
272
+ type: "string",
273
+ enum: ["create", "update", "close", "release"],
274
+ },
272
275
  id: idSchema,
276
+ ref: {
277
+ type: "string",
278
+ description: "Batch-local create alias; its deterministic id can be referenced as @alias by any row.",
279
+ },
273
280
  reason: { type: "string" },
274
281
  options: { type: "object" },
275
282
  },
276
- required: ["op", "id"],
283
+ required: ["op"],
277
284
  additionalProperties: false,
278
285
  },
279
286
  },
@@ -728,4 +735,4 @@ export function buildMcpToolContracts() {
728
735
  }).sort((left, right) => left.name.localeCompare(right.name));
729
736
  }
730
737
  //# sourceMappingURL=tool-definitions.js.map
731
- //# debugId=ade687e6-6547-5a2f-818f-0ed06dce9de5
738
+ //# debugId=89c1ac6d-c217-54ea-8728-5a58762f86d9
@@ -1,11 +1,3 @@
1
- /**
2
- * @module sdk/cli-contracts/agent-output-contracts
3
- *
4
- * Declares the agent-facing output budget vocabulary shared by CLI, SDK,
5
- * packages, contract discovery, and regression gates. The contracts describe
6
- * output policy without coupling package authors to pm's renderer.
7
- */
8
- import { PM_CORE_COMMAND_NAMES } from "./enum-contracts.js";
9
1
  /** Stable degradation stages applied when an output exceeds its token budget. */
10
2
  export declare const PM_OUTPUT_DEGRADATION_STEPS: readonly ["full", "compact", "brief", "summary", "counts"];
11
3
  /** Restricts deterministic output degradation stages. */
@@ -17,11 +9,16 @@ export type PmOutputBudgetClass = (typeof PM_OUTPUT_BUDGET_CLASSES)[number];
17
9
  /** Describes one command's default agent-output budget and degradation policy. */
18
10
  export interface PmCommandOutputBudgetContract {
19
11
  /** Canonical or compatibility command name. */
20
- command: (typeof PM_CORE_COMMAND_NAMES)[number];
12
+ command: string;
21
13
  /** Workload class that selected the default ceiling. */
22
14
  budget_class: PmOutputBudgetClass;
23
15
  /** Default estimated-token ceiling for representative output. */
24
16
  default_max_estimated_tokens: number;
17
+ /** Encoding-specific ceilings generated from the workload-class default. */
18
+ default_max_estimated_tokens_by_format: Readonly<{
19
+ toon: number;
20
+ json: number;
21
+ }>;
25
22
  /** Ordered fallback projections, from richest to smallest. */
26
23
  degradation_ladder: readonly PmOutputDegradationStep[];
27
24
  /** Whether callers may explicitly request an unbounded result. */
@@ -29,6 +26,10 @@ export interface PmCommandOutputBudgetContract {
29
26
  /** Stable estimate used by gates and SDK consumers. */
30
27
  token_estimate: "ceil(utf8_bytes / 4)";
31
28
  }
29
+ /** Infer the conservative workload class for a core or package command. */
30
+ export declare function inferPmOutputBudgetClass(command: string): PmOutputBudgetClass;
31
+ /** Build the generated default budget for a core or package command. */
32
+ export declare function createPmCommandOutputBudget(command: string, budgetClass?: PmOutputBudgetClass): PmCommandOutputBudgetContract;
32
33
  /**
33
34
  * Declares one budget contract while preserving literal command metadata for
34
35
  * package-authored registries and test fixtures. Rejects ceilings that cannot
@@ -36,15 +37,14 @@ export interface PmCommandOutputBudgetContract {
36
37
  */
37
38
  export declare function definePmCommandOutputBudget<TContract extends PmCommandOutputBudgetContract>(contract: TContract): TContract;
38
39
  /** Public default budget contract for every built-in pm command. */
39
- export declare const PM_COMMAND_OUTPUT_BUDGET_CONTRACTS: {
40
- command: "search" | "create" | "update" | "list" | "context" | "release" | "schema" | "test" | "test-all" | "events" | "comments" | "notes" | "learnings" | "files" | "docs" | "copy" | "activity" | "history" | "item" | "extension" | "package" | "config" | "packages" | "event" | "list-all" | "list-draft" | "list-open" | "list-in-progress" | "list-blocked" | "list-closed" | "list-canceled" | "ctx" | "init" | "install" | "upgrade" | "focus" | "aggregate" | "get" | "next" | "eval" | "workspace" | "history-redact" | "history-repair" | "history-author-acknowledge" | "history-compact" | "merge" | "profile" | "plan" | "restore" | "update-many" | "close" | "close-many" | "delete" | "append" | "deps" | "graph" | "telemetry" | "health" | "validate" | "gc" | "stats" | "duplicates" | "contracts" | "claim" | "start-task" | "pause-task" | "close-task" | "meet" | "remind" | "help";
41
- budget_class: "governance" | "mutation" | "read" | "discovery";
42
- default_max_estimated_tokens: number;
43
- degradation_ladder: readonly ["full", "compact", "brief", "summary", "counts"];
44
- allows_unbounded_opt_out: true;
45
- token_estimate: "ceil(utf8_bytes / 4)";
46
- }[];
40
+ export declare const PM_COMMAND_OUTPUT_BUDGET_CONTRACTS: PmCommandOutputBudgetContract[];
47
41
  /** Resolve the declared output budget for one built-in command. */
48
- export declare function resolvePmCommandOutputBudget(command: string): PmCommandOutputBudgetContract | null;
42
+ export declare function resolvePmCommandOutputBudget(command: string, options: {
43
+ generateFallback: true;
44
+ }): PmCommandOutputBudgetContract;
45
+ /** Resolve a declared output budget without generating a package fallback. */
46
+ export declare function resolvePmCommandOutputBudget(command: string, options?: {
47
+ generateFallback?: false;
48
+ }): PmCommandOutputBudgetContract | null;
49
49
  /** Estimate conservative token usage from UTF-8 output bytes. */
50
50
  export declare function estimatePmOutputTokens(utf8Bytes: number): number;
@@ -6,7 +6,7 @@
6
6
  * output policy without coupling package authors to pm's renderer.
7
7
  */
8
8
 
9
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7db1cef2-4ff1-5f62-ad68-88933e25d59b")}catch(e){}}();
9
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="23b3a820-f205-506b-9507-dbd60087f62e")}catch(e){}}();
10
10
  import { PM_CORE_COMMAND_NAMES } from "./enum-contracts.js";
11
11
  /** Stable degradation stages applied when an output exceeds its token budget. */
12
12
  export const PM_OUTPUT_DEGRADATION_STEPS = [
@@ -82,6 +82,39 @@ const DEFAULT_MAX_ESTIMATED_TOKENS = {
82
82
  discovery: 3_000,
83
83
  governance: 6_000,
84
84
  };
85
+ const JSON_BUDGET_NUMERATOR = 3;
86
+ const JSON_BUDGET_DENOMINATOR = 2;
87
+ /** Infer the conservative workload class for a core or package command. */
88
+ export function inferPmOutputBudgetClass(command) {
89
+ const [rootCommand = ""] = command.trim().split(/\s+/u);
90
+ return MUTATION_COMMANDS.has(rootCommand)
91
+ ? "mutation"
92
+ : DISCOVERY_COMMANDS.has(rootCommand)
93
+ ? "discovery"
94
+ : GOVERNANCE_COMMANDS.has(rootCommand)
95
+ ? "governance"
96
+ : "read";
97
+ }
98
+ /** Build the generated default budget for a core or package command. */
99
+ export function createPmCommandOutputBudget(command, budgetClass = inferPmOutputBudgetClass(command)) {
100
+ const normalizedCommand = command.trim().replace(/\s+/gu, " ");
101
+ if (normalizedCommand.length === 0) {
102
+ throw new TypeError("command must be a non-empty command path");
103
+ }
104
+ const toonBudget = DEFAULT_MAX_ESTIMATED_TOKENS[budgetClass];
105
+ return definePmCommandOutputBudget({
106
+ command: normalizedCommand,
107
+ budget_class: budgetClass,
108
+ default_max_estimated_tokens: toonBudget,
109
+ default_max_estimated_tokens_by_format: {
110
+ toon: toonBudget,
111
+ json: Math.ceil((toonBudget * JSON_BUDGET_NUMERATOR) / JSON_BUDGET_DENOMINATOR),
112
+ },
113
+ degradation_ladder: PM_OUTPUT_DEGRADATION_STEPS,
114
+ allows_unbounded_opt_out: true,
115
+ token_estimate: "ceil(utf8_bytes / 4)",
116
+ });
117
+ }
85
118
  /**
86
119
  * Declares one budget contract while preserving literal command metadata for
87
120
  * package-authored registries and test fixtures. Rejects ceilings that cannot
@@ -92,35 +125,30 @@ export function definePmCommandOutputBudget(contract) {
92
125
  contract.default_max_estimated_tokens <= 0) {
93
126
  throw new RangeError("default_max_estimated_tokens must be a positive safe integer");
94
127
  }
128
+ for (const [format, ceiling] of Object.entries(contract.default_max_estimated_tokens_by_format)) {
129
+ if (!Number.isSafeInteger(ceiling) || ceiling <= 0) {
130
+ throw new RangeError(`default_max_estimated_tokens_by_format.${format} must be a positive safe integer`);
131
+ }
132
+ }
95
133
  return contract;
96
134
  }
97
135
  /** Public default budget contract for every built-in pm command. */
98
- export const PM_COMMAND_OUTPUT_BUDGET_CONTRACTS = PM_CORE_COMMAND_NAMES.map((command) => {
99
- const budgetClass = MUTATION_COMMANDS.has(command)
100
- ? "mutation"
101
- : DISCOVERY_COMMANDS.has(command)
102
- ? "discovery"
103
- : GOVERNANCE_COMMANDS.has(command)
104
- ? "governance"
105
- : "read";
106
- return definePmCommandOutputBudget({
107
- command,
108
- budget_class: budgetClass,
109
- default_max_estimated_tokens: DEFAULT_MAX_ESTIMATED_TOKENS[budgetClass],
110
- degradation_ladder: PM_OUTPUT_DEGRADATION_STEPS,
111
- allows_unbounded_opt_out: true,
112
- token_estimate: "ceil(utf8_bytes / 4)",
113
- });
114
- });
136
+ export const PM_COMMAND_OUTPUT_BUDGET_CONTRACTS = PM_CORE_COMMAND_NAMES.map((command) => createPmCommandOutputBudget(command));
115
137
  const OUTPUT_BUDGET_BY_COMMAND = new Map(PM_COMMAND_OUTPUT_BUDGET_CONTRACTS.map((contract) => [contract.command, contract]));
116
- /** Resolve the declared output budget for one built-in command. */
117
- export function resolvePmCommandOutputBudget(command) {
118
- const [rootCommand] = command.trim().split(/\s+/u);
119
- return OUTPUT_BUDGET_BY_COMMAND.get(rootCommand) ?? null;
138
+ /** Implement built-in lookup with an opt-in generated package fallback. */
139
+ export function resolvePmCommandOutputBudget(command, options = {}) {
140
+ const normalizedCommand = command.trim().replace(/\s+/gu, " ");
141
+ const [rootCommand] = normalizedCommand.split(" ");
142
+ const declared = OUTPUT_BUDGET_BY_COMMAND.get(rootCommand);
143
+ if (declared)
144
+ return { ...declared, command: normalizedCommand };
145
+ return options.generateFallback
146
+ ? createPmCommandOutputBudget(normalizedCommand)
147
+ : null;
120
148
  }
121
149
  /** Estimate conservative token usage from UTF-8 output bytes. */
122
150
  export function estimatePmOutputTokens(utf8Bytes) {
123
151
  return Math.ceil(Math.max(0, utf8Bytes) / 4);
124
152
  }
125
153
  //# sourceMappingURL=agent-output-contracts.js.map
126
- //# debugId=7db1cef2-4ff1-5f62-ad68-88933e25d59b
154
+ //# debugId=23b3a820-f205-506b-9507-dbd60087f62e
@@ -1,6 +1,6 @@
1
1
  /** Creates commander option registration contracts using the validated operation inputs. */
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c3f8fd9b-05f4-55b4-bceb-9300efac2cdb")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b0f52c3d-091d-51db-a4c1-bb177414dd7f")}catch(e){}}();
4
4
  export const CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS = [
5
5
  {
6
6
  target: "title",
@@ -62,6 +62,30 @@ export const CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS = [
62
62
  option: "--status, -s <value>",
63
63
  description: "Item status",
64
64
  },
65
+ {
66
+ target: "closeReason",
67
+ keys: ["closeReason", "close_reason"],
68
+ option: "--close-reason <value>",
69
+ description: "Close reason when creating directly in a terminal status",
70
+ aliasOptions: [
71
+ {
72
+ option: "--close_reason <value>",
73
+ description: "Alias for --close-reason",
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ target: "completedAt",
79
+ keys: ["completedAt", "completed_at"],
80
+ option: "--completed-at <value>",
81
+ description: "Actual completion time for a terminal imported item",
82
+ aliasOptions: [
83
+ {
84
+ option: "--completed_at <value>",
85
+ description: "Alias for --completed-at",
86
+ },
87
+ ],
88
+ },
65
89
  {
66
90
  target: "priority",
67
91
  keys: ["priority"],
@@ -1019,4 +1043,4 @@ export const UPDATE_COMMANDER_STRING_OPTION_CONTRACTS = UPDATE_COMMANDER_OPTION_
1019
1043
  /** Public contract for update commander repeatable option contracts, shared by SDK and presentation-layer consumers. */
1020
1044
  export const UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS = UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS.filter((entry) => entry.repeatable === true).map((entry) => ({ target: entry.target, keys: entry.keys }));
1021
1045
  //# sourceMappingURL=commander-mutation-options.js.map
1022
- //# debugId=c3f8fd9b-05f4-55b4-bceb-9300efac2cdb
1046
+ //# debugId=b0f52c3d-091d-51db-a4c1-bb177414dd7f
@@ -170,6 +170,8 @@ export declare const VALIDATE_FLAG_CONTRACTS: CliFlagContract[];
170
170
  export declare const CREATE_FLAG_CONTRACTS: CliFlagContract[];
171
171
  /** Atomic item-batch flags shared by contracts, help, and completions. */
172
172
  export declare const ITEM_MUTATE_FLAG_CONTRACTS: CliFlagContract[];
173
+ /** Atomic item-completion flags shared by contracts, help, and completions. */
174
+ export declare const ITEM_COMPLETE_FLAG_CONTRACTS: CliFlagContract[];
173
175
  /** Public contract for copy flag contracts, shared by SDK and presentation-layer consumers. */
174
176
  export declare const COPY_FLAG_CONTRACTS: CliFlagContract[];
175
177
  /** Public contract for focus flag contracts, shared by SDK and presentation-layer consumers. */
@@ -7,7 +7,7 @@
7
7
  * flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
8
8
  */
9
9
 
10
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="768719fa-ae75-58fe-aa49-69da213c5eee")}catch(e){}}();
10
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="59bc9f68-0b43-5701-b3cf-1c1693a06d3a")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
13
13
  function normalizeFlagAliasKey(flag) {
@@ -1032,6 +1032,10 @@ export const CREATE_FLAG_CONTRACTS = [
1032
1032
  { flag: "--schedule-preset" },
1033
1033
  { flag: "--schedule_preset" },
1034
1034
  { short: "-s", flag: "--status" },
1035
+ { flag: "--close-reason" },
1036
+ { flag: "--close_reason" },
1037
+ { flag: "--completed-at" },
1038
+ { flag: "--completed_at" },
1035
1039
  { short: "-p", flag: "--priority" },
1036
1040
  { flag: "--tags", aliases: ["--tag"], list: true },
1037
1041
  // NOT list:true — these use Commander's repeatable collector. Marking them
@@ -1097,6 +1101,27 @@ export const ITEM_MUTATE_FLAG_CONTRACTS = [
1097
1101
  { flag: "--lock-wait-ms", value_name: "n" },
1098
1102
  { flag: "--author", value_name: "value" },
1099
1103
  ];
1104
+ /** Atomic item-completion flags shared by contracts, help, and completions. */
1105
+ export const ITEM_COMPLETE_FLAG_CONTRACTS = [
1106
+ { flag: "--transaction-id", value_name: "value", required: true },
1107
+ { flag: "--reason", value_name: "value" },
1108
+ { flag: "--file", value_name: "value", repeatable: true },
1109
+ { flag: "--doc", value_name: "value", repeatable: true },
1110
+ { flag: "--test", value_name: "value", repeatable: true },
1111
+ { flag: "--comment", value_name: "value", repeatable: true },
1112
+ { flag: "--note", value_name: "value", repeatable: true },
1113
+ { flag: "--learning", value_name: "value", repeatable: true },
1114
+ { flag: "--resolution", value_name: "value" },
1115
+ { flag: "--expected-result", value_name: "value" },
1116
+ { flag: "--actual-result", value_name: "value" },
1117
+ { flag: "--completed-at", value_name: "value" },
1118
+ { flag: "--validate-close", value_name: "mode" },
1119
+ { flag: "--lock-ttl-seconds", value_name: "n" },
1120
+ { flag: "--lock-wait-ms", value_name: "n" },
1121
+ { flag: "--dry-run" },
1122
+ { flag: "--force" },
1123
+ { flag: "--author", value_name: "value" },
1124
+ ];
1100
1125
  /** Public contract for copy flag contracts, shared by SDK and presentation-layer consumers. */
1101
1126
  export const COPY_FLAG_CONTRACTS = [
1102
1127
  { flag: "--title" },
@@ -1573,6 +1598,7 @@ const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND = new Map([
1573
1598
  ["upgrade", UPGRADE_FLAG_CONTRACTS],
1574
1599
  ["create", CREATE_FLAG_CONTRACTS],
1575
1600
  ["item mutate", ITEM_MUTATE_FLAG_CONTRACTS],
1601
+ ["item complete", ITEM_COMPLETE_FLAG_CONTRACTS],
1576
1602
  ["copy", COPY_FLAG_CONTRACTS],
1577
1603
  ["focus", FOCUS_FLAG_CONTRACTS],
1578
1604
  ["aggregate", AGGREGATE_FLAG_CONTRACTS],
@@ -1719,4 +1745,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1719
1745
  return normalizeUniqueStringList(all).join(" ");
1720
1746
  }
1721
1747
  //# sourceMappingURL=flag-contracts.js.map
1722
- //# debugId=768719fa-ae75-58fe-aa49-69da213c5eee
1748
+ //# debugId=59bc9f68-0b43-5701-b3cf-1c1693a06d3a
@@ -4,7 +4,7 @@
4
4
  * Provides CLI runtime support for Registration Helpers.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b10305d7-7272-56a5-9178-3083e7cead7d")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e520de00-0810-5356-9290-324cf1d3c133")}catch(e){}}();
8
8
  import { Option } from "commander";
9
9
  import { pathExists, refreshSearchArtifactsForMutation, shouldRunSearchRefreshInForeground, EXIT_CODE, PmCliError, printError, printResult, writeStdout, getSettingsPath, resolvePmRoot, readSettings, runActiveServiceOverride, setActiveCommandResult, } from "../runtime-primitives.js";
10
10
  import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, NEXT_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, readFirstValueFromCommanderOptions, readFirstStringFromCommanderOptions, readStringArrayFromCommanderOptions, } from "../cli-contracts.js";
@@ -293,6 +293,8 @@ export function normalizeCreateOptions(commandOptions, options = {}) {
293
293
  createMode: readCreateString("createMode"),
294
294
  schedulePreset: readCreateString("schedulePreset"),
295
295
  status: readCreateString("status"),
296
+ closeReason: readCreateString("closeReason"),
297
+ completedAt: readCreateString("completedAt"),
296
298
  priority: readCreateString("priority"),
297
299
  tags: readCreateString("tags"),
298
300
  addTags: readCreateList("addTags"),
@@ -967,4 +969,4 @@ export const _testOnly = {
967
969
  collectMutationItemIds,
968
970
  };
969
971
  //# sourceMappingURL=registration-helpers.js.map
970
- //# debugId=b10305d7-7272-56a5-9178-3083e7cead7d
972
+ //# debugId=e520de00-0810-5356-9290-324cf1d3c133
@@ -5,13 +5,14 @@
5
5
  */
6
6
  import { type GlobalOptions, type ExtensionRegistrationRegistry, type RegisteredExtensionCommandDefinition, type RegisteredExtensionFlagDefinitions, type RuntimeFieldRegistry, readSettings } from "../runtime-primitives.js";
7
7
  import { type McpToolContract } from "../../mcp/tool-definitions.js";
8
- import { PM_TOOL_ACTIONS, type CliFlagContract, type CommanderOptionAliasContract } from "../cli-contracts.js";
8
+ import { PM_TOOL_ACTIONS, type CliFlagContract, type CommanderOptionAliasContract, type PmCommandOutputBudgetContract } from "../cli-contracts.js";
9
9
  import { type ListCommandName, type ListProjectionMode } from "../query/list.js";
10
10
  import { type PmContextIntentContract } from "../context-intent-contracts.js";
11
11
  import { type PmReadOutputSurfaceContract } from "../read-output-contracts.js";
12
12
  import { type CliFlagInvocationContract } from "../flag-invocation-contracts.js";
13
13
  import { type PmCommandVisibilityTier } from "../agent-capability-contracts.js";
14
14
  import type { PmErrorCodeContract } from "../error-code-catalog.js";
15
+ import { type PmCommandOutputEnvelopeContract } from "../output-contracts.js";
15
16
  /** Documents the contracts command options payload exchanged by command, SDK, and package integrations. */
16
17
  export interface ContractsCommandOptions {
17
18
  /** Value that configures or reports action for this contract. */
@@ -146,6 +147,11 @@ export interface ContractsResult {
146
147
  read_output_dimensions?: readonly PmReadOutputSurfaceContract[];
147
148
  /** Exhaustive stable and provisional machine-readable failure vocabulary. */
148
149
  error_codes?: readonly PmErrorCodeContract[];
150
+ /** Format-aware budgets and envelope families for every active command. */
151
+ command_output_contracts?: Array<{
152
+ budget: PmCommandOutputBudgetContract;
153
+ envelope: PmCommandOutputEnvelopeContract;
154
+ }>;
149
155
  }
150
156
  type PmToolAction = (typeof PM_TOOL_ACTIONS)[number];
151
157
  /** Documents the contracts action availability payload exchanged by command, SDK, and package integrations. */
@@ -209,7 +215,7 @@ interface CommandSummarySurface {
209
215
  aliases?: string[];
210
216
  intent: string;
211
217
  flags?: string[];
212
- default_max_estimated_tokens: number | null;
218
+ default_max_estimated_tokens: number;
213
219
  }
214
220
  declare function packageOwnedActionForCommand(command: string): string;
215
221
  declare function resolveActionCommandPath(action: PmToolAction): string | null;
@@ -253,6 +259,7 @@ declare function buildRuntimeFieldFlagContracts(fieldRegistry: RuntimeFieldRegis
253
259
  declare function attachCreateRequiredOptionContracts(schema: Record<string, unknown>, metadata: Record<string, unknown>): Record<string, unknown>;
254
260
  declare function readContractsSettings(pmRoot: string, readSettingsFn?: typeof readSettings): Promise<Awaited<ReturnType<typeof readSettings>>>;
255
261
  declare function buildCommandSummarySurface(commands: readonly string[]): CommandSummarySurface[];
262
+ declare function buildCommandOutputContracts(commands: readonly string[]): NonNullable<ContractsResult["command_output_contracts"]>;
256
263
  /** Implements run contracts for the public runtime surface of this module. */
257
264
  export declare function runContracts(options: ContractsCommandOptions, global: GlobalOptions): Promise<ContractsResult>;
258
265
  /** Public contract for test only contracts command, shared by SDK and presentation-layer consumers. */
@@ -261,6 +268,7 @@ export declare const _testOnlyContractsCommand: {
261
268
  attachCreateRequiredOptionContracts: typeof attachCreateRequiredOptionContracts;
262
269
  buildExtensionActionSchemaBranch: typeof buildExtensionActionSchemaBranch;
263
270
  buildCommandSummarySurface: typeof buildCommandSummarySurface;
271
+ buildCommandOutputContracts: typeof buildCommandOutputContracts;
264
272
  buildRuntimeFieldFlagContracts: typeof buildRuntimeFieldFlagContracts;
265
273
  collectActionContractDescriptors: typeof collectActionContractDescriptors;
266
274
  collectExtensionCommandContracts: typeof collectExtensionCommandContracts;