@unbrained/pm-cli 2026.9.7 → 2026.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (746) hide show
  1. package/.agents/skills/pm-developer/SKILL.md +12 -4
  2. package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +19 -10
  3. package/.agents/skills/pm-extensions/SKILL.md +6 -0
  4. package/.agents/skills/pm-sdk/SKILL.md +11 -2
  5. package/.agents/skills/pm-user/SKILL.md +7 -2
  6. package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +95 -0
  7. package/.claude-plugin/marketplace.json +2 -2
  8. package/CHANGELOG.md +231 -182
  9. package/dist/cli/after-command-context-usage.js +1 -48
  10. package/dist/cli/argv-utils.js +1 -40
  11. package/dist/cli/bootstrap-args.js +1 -9
  12. package/dist/cli/bundle-integrity.js +2 -110
  13. package/dist/cli/commander-usage.js +11 -771
  14. package/dist/cli/commands/activity.js +1 -9
  15. package/dist/cli/commands/aggregate.js +1 -5
  16. package/dist/cli/commands/append.js +1 -5
  17. package/dist/cli/commands/claim.js +1 -5
  18. package/dist/cli/commands/close-many.js +1 -5
  19. package/dist/cli/commands/close.js +1 -9
  20. package/dist/cli/commands/comments.js +1 -5
  21. package/dist/cli/commands/config.js +1 -9
  22. package/dist/cli/commands/context.js +1 -9
  23. package/dist/cli/commands/contracts.js +1 -5
  24. package/dist/cli/commands/copy.js +1 -9
  25. package/dist/cli/commands/create.js +1 -9
  26. package/dist/cli/commands/delete.js +1 -9
  27. package/dist/cli/commands/deps.js +1 -9
  28. package/dist/cli/commands/docs.js +1 -9
  29. package/dist/cli/commands/duplicates.js +1 -9
  30. package/dist/cli/commands/eval.js +1 -9
  31. package/dist/cli/commands/extension/describe.js +1 -5
  32. package/dist/cli/commands/extension/scaffold.js +1 -5
  33. package/dist/cli/commands/extension/shared.js +1 -5
  34. package/dist/cli/commands/extension.js +1 -9
  35. package/dist/cli/commands/files.js +1 -9
  36. package/dist/cli/commands/focus.js +1 -9
  37. package/dist/cli/commands/gc.js +1 -9
  38. package/dist/cli/commands/get.js +1 -9
  39. package/dist/cli/commands/graph.js +1 -10
  40. package/dist/cli/commands/health.js +1 -9
  41. package/dist/cli/commands/history-compact.js +1 -10
  42. package/dist/cli/commands/history-redact.js +1 -11
  43. package/dist/cli/commands/history-repair.js +1 -10
  44. package/dist/cli/commands/history.js +1 -5
  45. package/dist/cli/commands/index.js +1 -58
  46. package/dist/cli/commands/init-agent-guidance.js +1 -9
  47. package/dist/cli/commands/init.js +1 -9
  48. package/dist/cli/commands/learnings.js +1 -5
  49. package/dist/cli/commands/lifecycle-transitions.js +1 -5
  50. package/dist/cli/commands/list.js +1 -9
  51. package/dist/cli/commands/merge.js +1 -11
  52. package/dist/cli/commands/next.js +1 -9
  53. package/dist/cli/commands/notes.js +1 -5
  54. package/dist/cli/commands/plan.js +1 -9
  55. package/dist/cli/commands/profile.js +1 -9
  56. package/dist/cli/commands/restore.js +1 -9
  57. package/dist/cli/commands/scheduling-shortcuts.js +1 -9
  58. package/dist/cli/commands/schema.js +1 -10
  59. package/dist/cli/commands/search.js +1 -9
  60. package/dist/cli/commands/stats.js +1 -9
  61. package/dist/cli/commands/telemetry.js +1 -9
  62. package/dist/cli/commands/test-all.js +1 -9
  63. package/dist/cli/commands/test-runs.js +1 -9
  64. package/dist/cli/commands/test.js +1 -9
  65. package/dist/cli/commands/update-many.js +1 -5
  66. package/dist/cli/commands/update.js +1 -9
  67. package/dist/cli/commands/upgrade.js +1 -5
  68. package/dist/cli/commands/validate.js +1 -15
  69. package/dist/cli/context-intent-invocation.js +1 -20
  70. package/dist/cli/description-stdin.js +1 -17
  71. package/dist/cli/error-guidance.js +1 -1353
  72. package/dist/cli/extension-command-help.js +5 -636
  73. package/dist/cli/extension-command-options.js +1 -427
  74. package/dist/cli/extension-recovery.js +1 -126
  75. package/dist/cli/help-content.js +2 -1001
  76. package/dist/cli/help-json-payload.js +4 -570
  77. package/dist/cli/main.d.ts +4 -0
  78. package/dist/cli/main.js +5 -2573
  79. package/dist/cli/migration-gates.js +1 -289
  80. package/dist/cli/public.js +1 -20
  81. package/dist/cli/register-annotations.js +1 -270
  82. package/dist/cli/register-assurance.js +1 -62
  83. package/dist/cli/register-files-lookup.js +1 -56
  84. package/dist/cli/register-history-activity.d.ts +8 -0
  85. package/dist/cli/register-history-activity.js +2 -0
  86. package/dist/cli/register-history-author.js +1 -38
  87. package/dist/cli/register-history-maintenance.d.ts +9 -0
  88. package/dist/cli/register-history-maintenance.js +2 -0
  89. package/dist/cli/register-list-query.js +10 -943
  90. package/dist/cli/register-mutation-options.js +1 -9
  91. package/dist/cli/register-mutation.d.ts +0 -5
  92. package/dist/cli/register-mutation.js +19 -1893
  93. package/dist/cli/register-operations.js +1 -920
  94. package/dist/cli/register-setup.js +1 -716
  95. package/dist/cli/register-structured-mutation.js +1 -196
  96. package/dist/cli/registration-helpers.js +1 -5
  97. package/dist/cli/runtime-compatibility-boundary.js +4 -42
  98. package/dist/cli/schema-registration-helpers.js +1 -73
  99. package/dist/cli/search-refresh.js +1 -13
  100. package/dist/cli/stats-analytics-json.js +1 -68
  101. package/dist/cli/telemetry-flush.js +1 -10
  102. package/dist/cli-bundle/bundle-manifest.json +164 -156
  103. package/dist/cli-bundle/chunks/{chunk-NPN5I67J.js → chunk-3IPRM75M.js} +3 -3
  104. package/dist/cli-bundle/chunks/chunk-4VL5P22L.js +2 -0
  105. package/dist/cli-bundle/chunks/chunk-AAFBV3U3.js +29 -0
  106. package/dist/cli-bundle/chunks/chunk-D3YVILJJ.js +20 -0
  107. package/dist/cli-bundle/chunks/{chunk-WYRZZ5ZE.js → chunk-DEZPZOQ7.js} +2 -2
  108. package/dist/cli-bundle/chunks/chunk-ECBLPN7B.js +3 -0
  109. package/dist/cli-bundle/chunks/chunk-J6ERHBV2.js +235 -0
  110. package/dist/cli-bundle/chunks/chunk-JUNJ5EKI.js +2 -0
  111. package/dist/cli-bundle/chunks/chunk-L5RCDKQ2.js +2 -0
  112. package/dist/cli-bundle/chunks/chunk-NSAPNEYH.js +2 -0
  113. package/dist/cli-bundle/chunks/chunk-OHNLSGGV.js +79 -0
  114. package/dist/cli-bundle/chunks/chunk-WQKMSFBV.js +5 -0
  115. package/dist/cli-bundle/chunks/{chunk-BAX2BYUW.js → chunk-XZ6T7YPP.js} +256 -150
  116. package/dist/cli-bundle/chunks/{chunk-JT6XF6GE.js → chunk-Z3XVXUVF.js} +4 -4
  117. package/dist/cli-bundle/chunks/register-list-query-UIHRCS6D.js +11 -0
  118. package/dist/cli-bundle/chunks/register-mutation-WHWMGRVX.js +20 -0
  119. package/dist/cli-bundle/chunks/register-operations-64YZYTC5.js +2 -0
  120. package/dist/cli-bundle/chunks/register-setup-PERI45EM.js +2 -0
  121. package/dist/cli-bundle/focused-chunks/chunk-2W4XIYOB.js +2 -0
  122. package/dist/cli-bundle/focused-chunks/chunk-2WSBXIGF.js +12 -0
  123. package/dist/cli-bundle/focused-chunks/chunk-5FHTCOHS.js +3 -0
  124. package/dist/cli-bundle/focused-chunks/chunk-7N6DOREF.js +26 -0
  125. package/dist/cli-bundle/focused-chunks/{chunk-3BZEOXLT.js → chunk-7PC4R5QB.js} +2 -2
  126. package/dist/cli-bundle/focused-chunks/chunk-BUCJUZVG.js +6 -0
  127. package/dist/cli-bundle/focused-chunks/chunk-FE3BABLJ.js +2 -0
  128. package/dist/cli-bundle/focused-chunks/chunk-IWITF53W.js +2 -0
  129. package/dist/cli-bundle/focused-chunks/chunk-OQUGRHKV.js +10 -0
  130. package/dist/cli-bundle/focused-chunks/{chunk-M6PBRFSH.js → chunk-PNKIANFZ.js} +2 -2
  131. package/dist/cli-bundle/focused-chunks/{chunk-LIJIA4TY.js → chunk-QQQ4SAUO.js} +3 -3
  132. package/dist/cli-bundle/focused-chunks/chunk-TTYXF5YD.js +177 -0
  133. package/dist/cli-bundle/focused-chunks/chunk-XNR3DM6J.js +2 -0
  134. package/dist/cli-bundle/focused-chunks/chunk-XSS3APUF.js +9 -0
  135. package/dist/cli-bundle/focused-chunks/chunk-YCDQ2N23.js +8 -0
  136. package/dist/cli-bundle/focused-chunks/chunk-YJUXGS57.js +20 -0
  137. package/dist/cli-bundle/focused-chunks/chunk-ZTCE4UO6.js +58 -0
  138. package/dist/cli-bundle/main.js +20 -20
  139. package/dist/cli-bundle/sdk-authoring.js +1 -1
  140. package/dist/cli-bundle/sdk-contracts.js +2 -2
  141. package/dist/cli-bundle/sdk-core.js +37 -37
  142. package/dist/cli-bundle/sdk-governance.js +1 -1
  143. package/dist/cli-bundle/sdk-graph.js +1 -1
  144. package/dist/cli-bundle/sdk-merge.js +42 -42
  145. package/dist/cli-bundle/sdk-query.js +1 -1
  146. package/dist/cli-bundle/sdk-runtime.js +1 -1
  147. package/dist/cli-bundle/sdk-testing.js +1 -1
  148. package/dist/cli-bundle/sdk.js +11 -11
  149. package/dist/cli.js +1 -104
  150. package/dist/core/checkpoint/checkpoint-gc.js +1 -169
  151. package/dist/core/checkpoint/mutation-checkpoint.js +2 -133
  152. package/dist/core/config/nested-settings.js +1 -534
  153. package/dist/core/config/positional-value.js +1 -109
  154. package/dist/core/diagnostics/remediation.js +1 -506
  155. package/dist/core/extensions/activation-summary-markdown.js +2 -145
  156. package/dist/core/extensions/activation-summary.js +1 -92
  157. package/dist/core/extensions/activation-transaction.js +1 -46
  158. package/dist/core/extensions/capability-usage.js +1 -173
  159. package/dist/core/extensions/command-hook-context.js +1 -13
  160. package/dist/core/extensions/command-metadata-contract.js +1 -22
  161. package/dist/core/extensions/command-visibility-tier.js +1 -29
  162. package/dist/core/extensions/contribution-inventory.js +1 -173
  163. package/dist/core/extensions/exporter-output-contract.js +1 -66
  164. package/dist/core/extensions/extension-candidate.js +1 -18
  165. package/dist/core/extensions/extension-capability-aliases.js +1 -158
  166. package/dist/core/extensions/extension-hook-runtime.js +1 -699
  167. package/dist/core/extensions/extension-policy.js +1 -599
  168. package/dist/core/extensions/extension-registries.js +1 -62
  169. package/dist/core/extensions/extension-runtime-helpers.js +1 -33
  170. package/dist/core/extensions/extension-types.js +1 -102
  171. package/dist/core/extensions/flag-definition-validation.js +1 -52
  172. package/dist/core/extensions/flag-value-types.js +1 -64
  173. package/dist/core/extensions/index.js +1 -526
  174. package/dist/core/extensions/item-field-types.js +1 -39
  175. package/dist/core/extensions/item-fields.js +1 -261
  176. package/dist/core/extensions/loader.js +1 -2223
  177. package/dist/core/extensions/manifest-schema.js +1 -69
  178. package/dist/core/extensions/module-graph-snapshot.js +1 -33
  179. package/dist/core/extensions/preflight-ownership.js +1 -41
  180. package/dist/core/extensions/registration-validation.js +1 -82
  181. package/dist/core/extensions/registration-values.js +1 -209
  182. package/dist/core/extensions/reserved-host-flags.js +1 -36
  183. package/dist/core/extensions/runtime-registrations.js +1 -67
  184. package/dist/core/extensions/service-ownership.js +1 -19
  185. package/dist/core/extensions/version-compat.js +1 -216
  186. package/dist/core/fs/fs-utils.js +2 -158
  187. package/dist/core/fs/host-environment-errors.js +1 -141
  188. package/dist/core/fs/index.js +1 -9
  189. package/dist/core/fs/path-utils.js +1 -17
  190. package/dist/core/governance/content-fields.js +1 -160
  191. package/dist/core/governance/issue-codes.js +1 -151
  192. package/dist/core/governance/metadata-coverage.js +1 -358
  193. package/dist/core/history/drift-cache.js +3 -72
  194. package/dist/core/history/drift-scan.js +1 -342
  195. package/dist/core/history/event-classification.js +1 -109
  196. package/dist/core/history/event-index.js +8 -784
  197. package/dist/core/history/history-compact-bulk.js +1 -104
  198. package/dist/core/history/history-diff.js +1 -158
  199. package/dist/core/history/history-rewrite.d.ts +6 -1
  200. package/dist/core/history/history-rewrite.js +1 -107
  201. package/dist/core/history/history-storage-stats.js +1 -102
  202. package/dist/core/history/history-stream-policy.js +1 -62
  203. package/dist/core/history/history.js +2 -617
  204. package/dist/core/history/identity.js +1 -30
  205. package/dist/core/history/index.js +1 -9
  206. package/dist/core/history/projection.js +1 -196
  207. package/dist/core/history/read.d.ts +9 -0
  208. package/dist/core/history/read.js +1 -57
  209. package/dist/core/history/replay.js +2 -439
  210. package/dist/core/history/version-address.js +1 -32
  211. package/dist/core/history/workspace-history.js +2 -433
  212. package/dist/core/io/body-file.js +1 -62
  213. package/dist/core/io/bulk-ids-input.js +1 -112
  214. package/dist/core/item/actionability.js +1 -327
  215. package/dist/core/item/dependency-reference.js +1 -20
  216. package/dist/core/item/id.js +1 -112
  217. package/dist/core/item/index.js +1 -12
  218. package/dist/core/item/item-format-version.js +1 -78
  219. package/dist/core/item/item-format.js +5 -1473
  220. package/dist/core/item/item-record.js +1 -23
  221. package/dist/core/item/item-type-definition.js +1 -133
  222. package/dist/core/item/parent-reference-policy.js +1 -57
  223. package/dist/core/item/parse.js +2 -603
  224. package/dist/core/item/plan-lifecycle.js +1 -19
  225. package/dist/core/item/priority.js +1 -61
  226. package/dist/core/item/sprint-release-format.js +1 -38
  227. package/dist/core/item/status-filter.js +1 -115
  228. package/dist/core/item/status.js +1 -43
  229. package/dist/core/item/toon-decode.js +1 -29
  230. package/dist/core/item/type-registry.js +1 -715
  231. package/dist/core/item/type-synonyms.js +1 -38
  232. package/dist/core/lock/index.js +1 -9
  233. package/dist/core/lock/lock-gc.js +1 -240
  234. package/dist/core/lock/lock.js +3 -590
  235. package/dist/core/output/mutation-projection.js +1 -217
  236. package/dist/core/output/output-control.js +1 -25
  237. package/dist/core/output/output.js +11 -494
  238. package/dist/core/output/query-summary.js +1 -58
  239. package/dist/core/output/tabular.js +1 -77
  240. package/dist/core/packages/manifest.js +1 -244
  241. package/dist/core/packages/root.js +1 -84
  242. package/dist/core/policy/workflow-policy-schema.d.ts +312 -0
  243. package/dist/core/policy/workflow-policy-schema.js +2 -0
  244. package/dist/core/policy/workflow-policy-store.d.ts +24 -0
  245. package/dist/core/policy/workflow-policy-store.js +2 -0
  246. package/dist/core/policy/workflow-policy.d.ts +139 -0
  247. package/dist/core/policy/workflow-policy.js +2 -0
  248. package/dist/core/profile/profile-describe.js +1 -83
  249. package/dist/core/profile/profile-lint.js +1 -415
  250. package/dist/core/profile/profile-plan.js +0 -0
  251. package/dist/core/profile/profile-presets.js +1 -370
  252. package/dist/core/reproducibility/context.js +1 -82
  253. package/dist/core/schema/fields-file.js +2 -288
  254. package/dist/core/schema/item-types-file.js +2 -296
  255. package/dist/core/schema/runtime-field-filters.js +1 -49
  256. package/dist/core/schema/runtime-field-values.js +1 -313
  257. package/dist/core/schema/runtime-schema.js +2 -826
  258. package/dist/core/schema/status-defs-file.js +2 -227
  259. package/dist/core/schema/status-token.js +1 -31
  260. package/dist/core/schema/type-inference.js +1 -95
  261. package/dist/core/schema/type-presets.js +1 -87
  262. package/dist/core/schema/type-workflows.js +1 -104
  263. package/dist/core/search/background-refresh.js +2 -286
  264. package/dist/core/search/bm25.js +1 -146
  265. package/dist/core/search/cache.js +2 -534
  266. package/dist/core/search/corpus.js +1 -311
  267. package/dist/core/search/embedding-batches.js +1 -163
  268. package/dist/core/search/eval.js +1 -225
  269. package/dist/core/search/http-client.js +1 -75
  270. package/dist/core/search/providers.js +1 -242
  271. package/dist/core/search/relevance.js +1 -244
  272. package/dist/core/search/semantic-defaults.js +1 -199
  273. package/dist/core/search/staleness.js +1 -30
  274. package/dist/core/search/vector-stores.js +2 -664
  275. package/dist/core/search/vectorization-metadata.js +1 -81
  276. package/dist/core/sentry/helpers.js +1 -272
  277. package/dist/core/sentry/instrument.js +1 -387
  278. package/dist/core/session/session-state.js +1 -260
  279. package/dist/core/shared/agent-session-context.js +1 -133
  280. package/dist/core/shared/author.js +1 -1172
  281. package/dist/core/shared/command-types.js +1 -4
  282. package/dist/core/shared/conflict-markers.js +1 -31
  283. package/dist/core/shared/constants.js +1 -405
  284. package/dist/core/shared/errors.js +1 -20
  285. package/dist/core/shared/html-entity-decode.js +1 -131
  286. package/dist/core/shared/index.js +1 -12
  287. package/dist/core/shared/item-metadata-contract.js +1 -89
  288. package/dist/core/shared/lazy-module.js +1 -16
  289. package/dist/core/shared/levenshtein.js +1 -61
  290. package/dist/core/shared/memo.js +1 -19
  291. package/dist/core/shared/numeric-parsers.js +1 -20
  292. package/dist/core/shared/option-alias-visibility.js +1 -67
  293. package/dist/core/shared/primitives.js +1 -127
  294. package/dist/core/shared/serial-queue.js +1 -79
  295. package/dist/core/shared/serialization.js +1 -210
  296. package/dist/core/shared/split-comma-list.js +1 -30
  297. package/dist/core/shared/text-normalization.js +1 -38
  298. package/dist/core/shared/time.js +1 -306
  299. package/dist/core/store/index.js +1 -12
  300. package/dist/core/store/item-format-migration.js +1 -125
  301. package/dist/core/store/item-metadata-cache.js +1 -1116
  302. package/dist/core/store/item-metadata-query-index.js +9 -394
  303. package/dist/core/store/item-metadata-read-work.js +1 -43
  304. package/dist/core/store/item-store.js +1 -693
  305. package/dist/core/store/paths.d.ts +1 -1
  306. package/dist/core/store/paths.js +1 -214
  307. package/dist/core/store/settings-read-cache.js +1 -85
  308. package/dist/core/store/settings-validator.d.ts +1 -0
  309. package/dist/core/store/settings-validator.js +1 -421
  310. package/dist/core/store/settings.js +3 -1309
  311. package/dist/core/store/tracker-preflight.js +1 -141
  312. package/dist/core/telemetry/consent.js +5 -108
  313. package/dist/core/telemetry/observability.js +1 -246
  314. package/dist/core/telemetry/runtime.js +4 -1988
  315. package/dist/core/test/background-runs.js +4 -945
  316. package/dist/core/test/item-test-run-tracking.js +1 -63
  317. package/dist/core/test/run-selectors.js +1 -120
  318. package/dist/core/validate/estimate-defaults.js +1 -89
  319. package/dist/core/validate/fix-planning.js +1 -189
  320. package/dist/core/validate/linked-artifact-reference.js +1 -36
  321. package/dist/core/validate/missing-by-type.js +1 -34
  322. package/dist/core/validate/missing-link-owners.js +1 -95
  323. package/dist/core/validate/stale-file-classification.js +1 -82
  324. package/dist/mcp/http-server.js +5 -448
  325. package/dist/mcp/legacy-adapter.js +1 -77
  326. package/dist/mcp/runtime-capabilities.js +1 -200
  327. package/dist/mcp/server.js +4 -1233
  328. package/dist/mcp/tool-definitions.js +1 -804
  329. package/dist/sdk/actionability.js +1 -13
  330. package/dist/sdk/agent/closed-domain-contracts.js +1 -161
  331. package/dist/sdk/agent/command-recovery.js +1 -59
  332. package/dist/sdk/agent/command-suggestions.js +1 -66
  333. package/dist/sdk/agent/create-option-policy.js +1 -31
  334. package/dist/sdk/agent/identity-config.js +1 -106
  335. package/dist/sdk/agent/item-addressing.js +1 -207
  336. package/dist/sdk/agent/refusal-closure-census.js +1 -151
  337. package/dist/sdk/agent/refusal-closure.js +1 -133
  338. package/dist/sdk/agent/refusal-corpus-contracts.js +1 -193
  339. package/dist/sdk/agent/refusal-reachability.js +1 -593
  340. package/dist/sdk/agent/subcommand-recovery.js +1 -83
  341. package/dist/sdk/agent/task-transcript-contracts.js +1 -197
  342. package/dist/sdk/agent/tracker-preflight-contracts.js +1 -126
  343. package/dist/sdk/agent-capability-contracts.js +1 -428
  344. package/dist/sdk/agent-session-context.js +1 -9
  345. package/dist/sdk/annotations.js +1 -448
  346. package/dist/sdk/author-attribution.js +1 -468
  347. package/dist/sdk/authoring.js +1 -20
  348. package/dist/sdk/cli-bootstrap.js +1 -838
  349. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +1 -1
  350. package/dist/sdk/cli-contracts/agent-output-contracts.js +4 -476
  351. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -79
  352. package/dist/sdk/cli-contracts/command-aliases.d.ts +4 -0
  353. package/dist/sdk/cli-contracts/command-aliases.js +1 -107
  354. package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -151
  355. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1081
  356. package/dist/sdk/cli-contracts/commander-types.js +1 -159
  357. package/dist/sdk/cli-contracts/completeness.js +1 -393
  358. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  359. package/dist/sdk/cli-contracts/enum-contracts.js +1 -222
  360. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1947
  361. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -347
  362. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -986
  363. package/dist/sdk/cli-contracts/registration-helpers.js +7 -990
  364. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +5 -0
  365. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -2090
  366. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -324
  367. package/dist/sdk/cli-contracts/string-lists.js +1 -16
  368. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -461
  369. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -2167
  370. package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -1
  371. package/dist/sdk/cli-contracts/tool-schema.js +1 -1664
  372. package/dist/sdk/cli-contracts/typed-action-inputs.js +1 -4
  373. package/dist/sdk/cli-contracts.d.ts +1 -1
  374. package/dist/sdk/cli-contracts.js +1 -17
  375. package/dist/sdk/cli-program.js +1 -49
  376. package/dist/sdk/command-line.d.ts +2 -5
  377. package/dist/sdk/command-line.js +1 -78
  378. package/dist/sdk/comments.js +1 -133
  379. package/dist/sdk/compile-cache.js +1 -73
  380. package/dist/sdk/completion.js +174 -839
  381. package/dist/sdk/compose.js +1 -1090
  382. package/dist/sdk/config.js +1 -1204
  383. package/dist/sdk/context/recency.js +1 -33
  384. package/dist/sdk/context/semantic-session-attribution.js +1 -82
  385. package/dist/sdk/context/usage-egress.js +1 -29
  386. package/dist/sdk/context/usage-ledger.js +3 -185
  387. package/dist/sdk/context-intent-contracts.js +1 -709
  388. package/dist/sdk/context-intent-runtime.js +1 -115
  389. package/dist/sdk/context-packing.js +1 -218
  390. package/dist/sdk/context-relevance.js +1 -503
  391. package/dist/sdk/context-signal-store.js +2 -426
  392. package/dist/sdk/context-usage.js +1 -367
  393. package/dist/sdk/contracts.js +1 -23
  394. package/dist/sdk/core-governance.js +1 -14
  395. package/dist/sdk/core.js +1 -14
  396. package/dist/sdk/corpus-shape.js +1 -401
  397. package/dist/sdk/define.js +1 -220
  398. package/dist/sdk/dependencies.js +1 -718
  399. package/dist/sdk/dependency-flag-validation.js +1 -156
  400. package/dist/sdk/dependency-provenance.js +1 -135
  401. package/dist/sdk/docs.js +1 -14
  402. package/dist/sdk/duplicates.js +1 -40
  403. package/dist/sdk/environment/agent-environment.js +1 -466
  404. package/dist/sdk/environment/host-environment-errors.js +1 -8
  405. package/dist/sdk/environment/project-runtime-compatibility.js +1 -481
  406. package/dist/sdk/environment/source-context.js +1 -28
  407. package/dist/sdk/environment/tracker-preflight.js +1 -9
  408. package/dist/sdk/error-code-catalog.js +1 -153
  409. package/dist/sdk/error-runtime.js +1 -58
  410. package/dist/sdk/errors.js +1 -58
  411. package/dist/sdk/eval.js +1 -190
  412. package/dist/sdk/extension/author-manifest.js +1 -92
  413. package/dist/sdk/extension/bundled-catalog.js +1 -332
  414. package/dist/sdk/extension/concurrency.js +1 -25
  415. package/dist/sdk/extension/copy-scope.d.ts +2 -0
  416. package/dist/sdk/extension/copy-scope.js +2 -0
  417. package/dist/sdk/extension/custom-field-collisions.js +1 -30
  418. package/dist/sdk/extension/describe.js +3 -189
  419. package/dist/sdk/extension/doctor.js +1 -606
  420. package/dist/sdk/extension/install-plan.d.ts +69 -0
  421. package/dist/sdk/extension/install-plan.js +2 -0
  422. package/dist/sdk/extension/install-receipts.d.ts +7 -0
  423. package/dist/sdk/extension/install-receipts.js +2 -0
  424. package/dist/sdk/extension/install-runtime.js +3 -313
  425. package/dist/sdk/extension/install-snapshot.js +1 -66
  426. package/dist/sdk/extension/install-sources.js +5 -1057
  427. package/dist/sdk/extension/managed-state.js +2 -252
  428. package/dist/sdk/extension/migrations.js +2 -174
  429. package/dist/sdk/extension/output-ownership.js +1 -25
  430. package/dist/sdk/extension/runtime-summary.js +1 -18
  431. package/dist/sdk/extension/scaffold.js +4 -2308
  432. package/dist/sdk/extension/shared.js +1 -147
  433. package/dist/sdk/extension/source-resolution.js +1 -65
  434. package/dist/sdk/extension/update-check.js +1 -67
  435. package/dist/sdk/extension-command-context.js +1 -44
  436. package/dist/sdk/extension-contracts.js +1 -73
  437. package/dist/sdk/extension.d.ts +7 -2
  438. package/dist/sdk/extension.js +1 -2196
  439. package/dist/sdk/files.js +1 -535
  440. package/dist/sdk/flag-invocation-contracts.d.ts +0 -5
  441. package/dist/sdk/flag-invocation-contracts.js +1 -344
  442. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -2224
  443. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -2236
  444. package/dist/sdk/generated-error-code-catalog.js +1 -16
  445. package/dist/sdk/governance/assurance-action-contracts.js +1 -4
  446. package/dist/sdk/governance/assurance-action.js +1 -411
  447. package/dist/sdk/governance/assurance-limits.js +1 -10
  448. package/dist/sdk/governance/assurance-mutation-error.js +1 -81
  449. package/dist/sdk/governance/assurance-presets.js +1 -135
  450. package/dist/sdk/governance/assurance-runtime.js +1 -238
  451. package/dist/sdk/governance/assurance.js +4 -1182
  452. package/dist/sdk/governance/boundary-fixtures.js +1 -200
  453. package/dist/sdk/governance/coverage-assurance.js +1 -60
  454. package/dist/sdk/governance/defect-recurrence-coverage.js +1 -188
  455. package/dist/sdk/governance/defect-recurrence-graph.js +1 -120
  456. package/dist/sdk/governance/defect-recurrence-signals.js +1 -24
  457. package/dist/sdk/governance/defect-recurrence.js +1 -623
  458. package/dist/sdk/governance/extension-host-version.js +1 -115
  459. package/dist/sdk/governance/gc.js +1 -368
  460. package/dist/sdk/governance/health.js +1 -2367
  461. package/dist/sdk/governance/hierarchy-validation.js +1 -108
  462. package/dist/sdk/governance/linked-file-report.js +1 -71
  463. package/dist/sdk/governance/merge-receipt-history.js +1 -206
  464. package/dist/sdk/governance/provenance-health.js +1 -282
  465. package/dist/sdk/governance/reindex.js +4 -761
  466. package/dist/sdk/governance/stale-work.js +1 -82
  467. package/dist/sdk/governance/status-role-diagnostics.js +1 -35
  468. package/dist/sdk/governance/storage-integrity.js +1 -280
  469. package/dist/sdk/governance/tracked-runtime-cache.js +1 -106
  470. package/dist/sdk/governance/upgrade.js +2 -327
  471. package/dist/sdk/governance/validate-history-drift.js +1 -81
  472. package/dist/sdk/governance/validate-item-reader.js +1 -17
  473. package/dist/sdk/governance/validate-normalization.js +1 -36
  474. package/dist/sdk/governance/validate.d.ts +3 -1
  475. package/dist/sdk/governance/validate.js +1 -2261
  476. package/dist/sdk/governance/workflow-completeness.d.ts +32 -0
  477. package/dist/sdk/governance/workflow-completeness.js +2 -0
  478. package/dist/sdk/governance/workflow-policy.d.ts +47 -0
  479. package/dist/sdk/governance/workflow-policy.js +4 -0
  480. package/dist/sdk/governance/workspace-position.js +1 -163
  481. package/dist/sdk/governance.d.ts +2 -0
  482. package/dist/sdk/governance.js +1 -31
  483. package/dist/sdk/graph/adapter.js +1 -181
  484. package/dist/sdk/graph/analytics.js +1 -474
  485. package/dist/sdk/graph/assembly.js +1 -377
  486. package/dist/sdk/graph/cache.js +1 -160
  487. package/dist/sdk/graph/centrality.js +1 -258
  488. package/dist/sdk/graph/conformance.js +1 -130
  489. package/dist/sdk/graph/deadline-scheduling.d.ts +90 -0
  490. package/dist/sdk/graph/deadline-scheduling.js +2 -0
  491. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  492. package/dist/sdk/graph/durable-cache.js +1 -361
  493. package/dist/sdk/graph/governance-contracts.js +1 -34
  494. package/dist/sdk/graph/governance.d.ts +13 -1
  495. package/dist/sdk/graph/governance.js +1 -735
  496. package/dist/sdk/graph/hierarchy-integrity.js +1 -310
  497. package/dist/sdk/graph/index.d.ts +3 -2
  498. package/dist/sdk/graph/index.js +1 -26
  499. package/dist/sdk/graph/lifecycle-coverage.d.ts +32 -0
  500. package/dist/sdk/graph/lifecycle-coverage.js +2 -0
  501. package/dist/sdk/graph/mutation-advisory.js +1 -176
  502. package/dist/sdk/graph/remediation.js +1 -197
  503. package/dist/sdk/graph/run.d.ts +15 -1
  504. package/dist/sdk/graph/run.js +1 -768
  505. package/dist/sdk/graph/scheduling.js +1 -124
  506. package/dist/sdk/graph/traversal.js +1 -284
  507. package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -27
  508. package/dist/sdk/graph.js +1 -15
  509. package/dist/sdk/guide-topics.js +1 -707
  510. package/dist/sdk/guide.js +1 -279
  511. package/dist/sdk/history/maintenance.d.ts +71 -0
  512. package/dist/sdk/history/maintenance.js +2 -0
  513. package/dist/sdk/history/salvage.js +2 -247
  514. package/dist/sdk/history/subject.d.ts +19 -0
  515. package/dist/sdk/history/subject.js +2 -0
  516. package/dist/sdk/history-analytics.js +1 -282
  517. package/dist/sdk/history-compact.js +1 -527
  518. package/dist/sdk/history-mcp.js +1 -68
  519. package/dist/sdk/history-provenance.js +1 -182
  520. package/dist/sdk/history-read.js +1 -96
  521. package/dist/sdk/history-redact.d.ts +1 -14
  522. package/dist/sdk/history-redact.js +1 -643
  523. package/dist/sdk/history-repair.d.ts +5 -0
  524. package/dist/sdk/history-repair.js +1 -657
  525. package/dist/sdk/improvement-ledger-validation.js +1 -62
  526. package/dist/sdk/improvement-ledger.js +2 -257
  527. package/dist/sdk/index.d.ts +4 -1
  528. package/dist/sdk/index.js +1 -183
  529. package/dist/sdk/init-agent-guidance.js +2 -496
  530. package/dist/sdk/init.js +2 -820
  531. package/dist/sdk/invocation-author.js +1 -39
  532. package/dist/sdk/item-children.js +1 -90
  533. package/dist/sdk/item-metadata-index.js +1 -15
  534. package/dist/sdk/item-schedule.js +1 -27
  535. package/dist/sdk/item-transaction.js +1 -396
  536. package/dist/sdk/learnings.js +1 -29
  537. package/dist/sdk/lifecycle/append.js +2 -53
  538. package/dist/sdk/lifecycle/claim.d.ts +2 -0
  539. package/dist/sdk/lifecycle/claim.js +1 -242
  540. package/dist/sdk/lifecycle/close-many.js +1 -438
  541. package/dist/sdk/lifecycle/close.js +1 -468
  542. package/dist/sdk/lifecycle/copy.js +1 -212
  543. package/dist/sdk/lifecycle/create.js +1 -1949
  544. package/dist/sdk/lifecycle/delete.js +1 -45
  545. package/dist/sdk/lifecycle/event-validation-messages.js +1 -91
  546. package/dist/sdk/lifecycle/focus.js +1 -91
  547. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -24
  548. package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -149
  549. package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -40
  550. package/dist/sdk/lifecycle/mcp-actions.d.ts +2 -0
  551. package/dist/sdk/lifecycle/mcp-actions.js +1 -51
  552. package/dist/sdk/lifecycle/metadata-normalizers.js +1 -46
  553. package/dist/sdk/lifecycle/mutation-command-options.js +1 -9
  554. package/dist/sdk/lifecycle/plan.js +1 -1606
  555. package/dist/sdk/lifecycle/recurrence-parsers.d.ts +1 -1
  556. package/dist/sdk/lifecycle/recurrence-parsers.js +1 -147
  557. package/dist/sdk/lifecycle/reopen.js +1 -68
  558. package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +1 -143
  559. package/dist/sdk/lifecycle/restore.d.ts +1 -0
  560. package/dist/sdk/lifecycle/restore.js +1 -330
  561. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -295
  562. package/dist/sdk/lifecycle/update-many.js +1 -861
  563. package/dist/sdk/lifecycle/update.js +1 -2136
  564. package/dist/sdk/lifecycle-completion.js +1 -92
  565. package/dist/sdk/lifecycle-policy.js +1 -120
  566. package/dist/sdk/linked-artifacts.js +1 -530
  567. package/dist/sdk/mcp/apps.js +4 -133
  568. package/dist/sdk/mcp/authorization.js +1 -404
  569. package/dist/sdk/mcp/discovery.js +1 -494
  570. package/dist/sdk/mcp/interactions.js +1 -336
  571. package/dist/sdk/mcp/protocol.d.ts +7 -0
  572. package/dist/sdk/mcp/protocol.js +1 -184
  573. package/dist/sdk/mcp/skills.js +1 -389
  574. package/dist/sdk/mcp/subscriptions.js +1 -211
  575. package/dist/sdk/mcp/tasks.js +2 -430
  576. package/dist/sdk/mcp/transport.js +1 -260
  577. package/dist/sdk/merge/abandoned-receipts.js +1 -46
  578. package/dist/sdk/merge/driver.js +1 -212
  579. package/dist/sdk/merge/index.js +1 -16
  580. package/dist/sdk/merge/install.js +3 -561
  581. package/dist/sdk/merge/receipt-file-boundary.js +1 -46
  582. package/dist/sdk/merge/receipt-operation.js +1 -96
  583. package/dist/sdk/merge/receipt-schema.js +1 -397
  584. package/dist/sdk/merge/receipts.js +4 -525
  585. package/dist/sdk/merge/reconcile.js +1 -352
  586. package/dist/sdk/merge/three-way.js +3 -775
  587. package/dist/sdk/merge.js +1 -10
  588. package/dist/sdk/mutation-events.js +1 -292
  589. package/dist/sdk/mutation-guard.js +1 -216
  590. package/dist/sdk/notes.js +1 -139
  591. package/dist/sdk/output-contracts.js +1 -172
  592. package/dist/sdk/output-projection.js +1 -430
  593. package/dist/sdk/output-token-accounting.js +1 -140
  594. package/dist/sdk/output.js +1 -64
  595. package/dist/sdk/ownership-source.js +1 -21
  596. package/dist/sdk/package-import-adapters.js +1 -442
  597. package/dist/sdk/package-migrations.js +1 -20
  598. package/dist/sdk/package-runtime-options.js +1 -80
  599. package/dist/sdk/pagination.js +1 -162
  600. package/dist/sdk/profile.js +1 -454
  601. package/dist/sdk/provenance.js +1 -258
  602. package/dist/sdk/public-surface.json +1 -1
  603. package/dist/sdk/query/activity.js +1 -401
  604. package/dist/sdk/query/aggregate.d.ts +16 -0
  605. package/dist/sdk/query/aggregate.js +1 -390
  606. package/dist/sdk/query/calendar.js +1 -964
  607. package/dist/sdk/query/complete-list.js +1 -215
  608. package/dist/sdk/query/context.js +1 -1702
  609. package/dist/sdk/query/duplicate-candidates.js +1 -70
  610. package/dist/sdk/query/get.js +1 -450
  611. package/dist/sdk/query/history.js +1 -186
  612. package/dist/sdk/query/item-filter-options.js +1 -9
  613. package/dist/sdk/query/light-metadata.js +1 -18
  614. package/dist/sdk/query/list-filter-shared.js +1 -81
  615. package/dist/sdk/query/list.js +1 -1304
  616. package/dist/sdk/query/multi-value-filters.js +1 -78
  617. package/dist/sdk/query/next.js +1 -513
  618. package/dist/sdk/query/parsers.js +1 -44
  619. package/dist/sdk/query/projection-contracts.js +1 -184
  620. package/dist/sdk/query/search-contracts.d.ts +27 -0
  621. package/dist/sdk/query/search-contracts.js +1 -230
  622. package/dist/sdk/query/search-pagination.js +1 -35
  623. package/dist/sdk/query/search-rendering.js +1 -105
  624. package/dist/sdk/query/search.d.ts +6 -4
  625. package/dist/sdk/query/search.js +2 -1987
  626. package/dist/sdk/query.js +1 -35
  627. package/dist/sdk/read-output/continuation.js +1 -194
  628. package/dist/sdk/read-output-budget.js +1 -135
  629. package/dist/sdk/read-output-contracts.d.ts +1 -1
  630. package/dist/sdk/read-output-contracts.js +1 -1225
  631. package/dist/sdk/read-output-rows.js +1 -186
  632. package/dist/sdk/read-output-session.js +1 -208
  633. package/dist/sdk/relationship-analytics.js +1 -410
  634. package/dist/sdk/relationship-context.js +1 -284
  635. package/dist/sdk/relationship-history.js +4 -519
  636. package/dist/sdk/relationship-kinds/contract.js +1 -22
  637. package/dist/sdk/relationship-migration.js +1 -77
  638. package/dist/sdk/relationships.js +1 -579
  639. package/dist/sdk/reproducibility/process.js +1 -87
  640. package/dist/sdk/runtime-action-aliases.js +1 -59
  641. package/dist/sdk/runtime-extended-actions.js +1 -177
  642. package/dist/sdk/runtime-input.js +1 -614
  643. package/dist/sdk/runtime-primitives.js +1 -84
  644. package/dist/sdk/runtime-public-contracts.d.ts +2 -1
  645. package/dist/sdk/runtime-public-contracts.js +1 -4
  646. package/dist/sdk/runtime-stats-options.js +1 -38
  647. package/dist/sdk/runtime.d.ts +4 -0
  648. package/dist/sdk/runtime.js +1 -1928
  649. package/dist/sdk/scheduling-shortcuts.js +1 -63
  650. package/dist/sdk/schema-migration.js +3 -856
  651. package/dist/sdk/schema.d.ts +2 -1
  652. package/dist/sdk/schema.js +1 -1376
  653. package/dist/sdk/search-refresh-worker.js +1 -18
  654. package/dist/sdk/similarity-scoring.js +1 -53
  655. package/dist/sdk/similarity.js +1 -326
  656. package/dist/sdk/start-task-status.js +1 -14
  657. package/dist/sdk/stats.js +1 -270
  658. package/dist/sdk/structured-mutations.js +1 -580
  659. package/dist/sdk/telemetry-flush.js +1 -13
  660. package/dist/sdk/telemetry.js +1 -405
  661. package/dist/sdk/templates.js +2 -292
  662. package/dist/sdk/test/batch.js +2 -509
  663. package/dist/sdk/test/entry.js +1 -70
  664. package/dist/sdk/test/execution.js +6 -2211
  665. package/dist/sdk/test/linked-command-detection.js +1 -546
  666. package/dist/sdk/test/measurements.js +1 -91
  667. package/dist/sdk/test/parsers.js +1 -545
  668. package/dist/sdk/test/runs.js +1 -193
  669. package/dist/sdk/test/trust.js +2 -206
  670. package/dist/sdk/testing.js +4 -1391
  671. package/dist/sdk/traceability/runtime-files-lookup.js +1 -32
  672. package/dist/sdk/traceability/source-traceability.js +1 -292
  673. package/dist/sdk/tracker-root-discovery.js +1 -9
  674. package/dist/sdk/workspace-contracts-cache.js +1 -28
  675. package/dist/sdk/workspace-contracts.js +1 -33
  676. package/dist/sdk/workspace-memory.js +2 -318
  677. package/dist/sdk/workspace-recipe.js +1 -71
  678. package/dist/sdk/workspace-snapshot.js +4 -613
  679. package/dist/sdk/workspace-transaction-gc.js +1 -149
  680. package/dist/sdk/workspace-transaction.js +2 -363
  681. package/dist/sdk/workspace.js +3 -127
  682. package/dist/types/index.js +1 -9
  683. package/dist/types.d.ts +4 -0
  684. package/dist/types.js +1 -245
  685. package/docs/AGENT_GUIDE.md +1 -1
  686. package/docs/COMMANDS.md +10 -0
  687. package/docs/CONFIGURATION.md +12 -1
  688. package/docs/CONTEXT_ALGORITHM_PORTFOLIO.md +167 -0
  689. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +9 -3
  690. package/docs/EXTENSIONS.md +1 -0
  691. package/docs/HISTORY_MAINTENANCE.md +125 -0
  692. package/docs/MCP_2026_07_28_CONFORMANCE.md +20 -10
  693. package/docs/PACKAGE_EVIDENCE.md +92 -0
  694. package/docs/PLANNING_MEASUREMENTS.md +183 -0
  695. package/docs/README.md +4 -0
  696. package/docs/READ_OUTPUT_CONTRACTS.md +5 -0
  697. package/docs/SCRIPTING.md +21 -0
  698. package/docs/TESTING.md +33 -0
  699. package/docs/WORKFLOW_POLICIES.md +129 -0
  700. package/docs/generated/FLAG_LEXICON_BUDGETS.md +7 -7
  701. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -5
  702. package/marketplace.json +2 -2
  703. package/package.json +5 -5
  704. package/packages/pm-beads/package.json +1 -1
  705. package/packages/pm-calendar/package.json +1 -1
  706. package/packages/pm-command-kit/package.json +1 -1
  707. package/packages/pm-digital-twin/package.json +1 -1
  708. package/packages/pm-governance-audit/package.json +1 -1
  709. package/packages/pm-guide-shell/package.json +1 -1
  710. package/packages/pm-kanban/package.json +1 -1
  711. package/packages/pm-lifecycle-hooks/package.json +1 -1
  712. package/packages/pm-linked-test-adapters/package.json +1 -1
  713. package/packages/pm-search-advanced/package.json +1 -1
  714. package/packages/pm-templates/package.json +1 -1
  715. package/packages/pm-todos/package.json +1 -1
  716. package/packages/pm-vcs/package.json +1 -1
  717. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  718. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  719. package/scripts/finalize-build.mjs +45 -3
  720. package/dist/cli-bundle/chunks/chunk-AZDFJGH6.js +0 -9
  721. package/dist/cli-bundle/chunks/chunk-CKOL5U7J.js +0 -77
  722. package/dist/cli-bundle/chunks/chunk-JX4DH4WC.js +0 -3
  723. package/dist/cli-bundle/chunks/chunk-OF76PSDQ.js +0 -5
  724. package/dist/cli-bundle/chunks/chunk-QUWFABDM.js +0 -232
  725. package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +0 -2
  726. package/dist/cli-bundle/chunks/chunk-RWWBOWJ5.js +0 -2
  727. package/dist/cli-bundle/chunks/chunk-WGAOYSYH.js +0 -40
  728. package/dist/cli-bundle/chunks/chunk-WI2AYPA7.js +0 -2
  729. package/dist/cli-bundle/chunks/register-list-query-5JL52D33.js +0 -11
  730. package/dist/cli-bundle/chunks/register-mutation-ZPG7KMVP.js +0 -20
  731. package/dist/cli-bundle/chunks/register-operations-I5W3KMGB.js +0 -2
  732. package/dist/cli-bundle/chunks/register-setup-H4SVAVX7.js +0 -2
  733. package/dist/cli-bundle/focused-chunks/chunk-AL5ON6K6.js +0 -2
  734. package/dist/cli-bundle/focused-chunks/chunk-CHC2IDXA.js +0 -6
  735. package/dist/cli-bundle/focused-chunks/chunk-CK6QFAPZ.js +0 -20
  736. package/dist/cli-bundle/focused-chunks/chunk-EZR3GHFE.js +0 -2
  737. package/dist/cli-bundle/focused-chunks/chunk-H2WJWK7L.js +0 -56
  738. package/dist/cli-bundle/focused-chunks/chunk-NTPY5GSO.js +0 -3
  739. package/dist/cli-bundle/focused-chunks/chunk-P5O7MP5Y.js +0 -2
  740. package/dist/cli-bundle/focused-chunks/chunk-PDMW2E36.js +0 -177
  741. package/dist/cli-bundle/focused-chunks/chunk-PEFABF7E.js +0 -26
  742. package/dist/cli-bundle/focused-chunks/chunk-QTVCLMSZ.js +0 -6
  743. package/dist/cli-bundle/focused-chunks/chunk-QTZRBUYA.js +0 -8
  744. package/dist/cli-bundle/focused-chunks/chunk-SGQST3PQ.js +0 -12
  745. package/dist/cli-bundle/focused-chunks/chunk-UKHASMMP.js +0 -10
  746. package/dist/cli-bundle/focused-chunks/chunk-ZPEKQHOC.js +0 -2
@@ -1,1665 +1,2 @@
1
- /**
2
- * @module sdk/cli-contracts/tool-schema
3
- *
4
- * MCP tool-parameter schema contracts: the per-action required/optional key sets
5
- * and the lazily-built strict (action-scoped) and provider-compatible (flat)
6
- * JSON Schemas served to MCP clients, the `pm contracts` command, and SDK
7
- * consumers from a single source of truth.
8
- */
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]="e72f4ab4-5bf7-53fb-a3a3-174c4064f6a4")}catch(e){}}();
11
- import { normalizeUniqueStringList } from "./string-lists.js";
12
- import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
13
- import { TOOL_CREATE_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CONTEXT_OPTION_CONTRACTS, TOOL_ACTIVITY_OPTION_CONTRACTS, TOOL_LIST_FILTER_OPTION_CONTRACTS, TOOL_AGGREGATE_OPTION_CONTRACTS, TOOL_SEARCH_FILTER_OPTION_CONTRACTS, TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS, } from "./tool-option-contracts.js";
14
- import { PM_TOOL_PARAMETER_PROPERTIES, PM_TOOL_PARAMETER_METADATA, PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES, PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA, PLAN_ACTION_PARAMETER_PROPERTIES, PLAN_ACTION_PARAMETER_METADATA, } from "./tool-parameter-tables.js";
15
- import { toUniqueFlagContracts, withFlagAliasMetadata, } from "./flag-contracts.js";
16
- import { resolveReadOutputSurface } from "../read-output-contracts.js";
17
- const PM_TOOL_GLOBAL_PARAMETER_KEYS = [
18
- "json",
19
- "quiet",
20
- "profile",
21
- "noExtensions",
22
- "noPager",
23
- "tokenAccounting",
24
- "path",
25
- "pmExecutable",
26
- "timeoutMs",
27
- ];
28
- const PM_TOOL_READ_OUTPUT_PARAMETER_KEYS = [
29
- "outputInclude",
30
- "outputLimit",
31
- "outputBudget",
32
- "outputFormat",
33
- "outputSession",
34
- "outputCursor",
35
- "outputRowContract",
36
- ];
37
- /** Canonical top-level MCP properties that take precedence over runtime custom fields. */
38
- export const PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES = new Set([
39
- "action",
40
- "cwd",
41
- "options",
42
- ...Object.keys(PM_TOOL_PARAMETER_PROPERTIES).filter((property) => property !== "severity"),
43
- ]);
44
- /** Resolve a runtime custom-field collision without changing dispatch semantics. */
45
- export function resolvePmToolCustomFieldCollision(field) {
46
- const normalized = field.trim().toLowerCase();
47
- let property = "";
48
- for (let index = 0; index < normalized.length; index += 1) {
49
- const character = normalized[index];
50
- if (character !== "-" && character !== "_") {
51
- property += character;
52
- continue;
53
- }
54
- let nextIndex = index + 1;
55
- while (normalized[nextIndex] === "-" || normalized[nextIndex] === "_") {
56
- nextIndex += 1;
57
- }
58
- const nextCharacter = normalized[nextIndex];
59
- if (nextCharacter !== undefined &&
60
- ((nextCharacter >= "a" && nextCharacter <= "z") ||
61
- (nextCharacter >= "0" && nextCharacter <= "9"))) {
62
- property += nextCharacter.toUpperCase();
63
- index = nextIndex;
64
- continue;
65
- }
66
- property += normalized.slice(index, nextIndex);
67
- index = nextIndex - 1;
68
- }
69
- return PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES.has(property)
70
- ? {
71
- field,
72
- property,
73
- owner: "mcp_tool_input",
74
- nested_path: `options.${property}`,
75
- }
76
- : undefined;
77
- }
78
- const PM_TOOL_ACTION_MUTATION_PARAMETER_KEYS = {
79
- create: ["fullChangedFields", "idOnly"],
80
- copy: ["fullChangedFields", "idOnly"],
81
- update: ["fullChangedFields", "idOnly"],
82
- "item-reopen": ["fullChangedFields", "idOnly"],
83
- close: ["fullChangedFields", "idOnly"],
84
- restore: ["fullChangedFields", "idOnly"],
85
- append: ["fullChangedFields"],
86
- "update-many": ["fullChangedFields"],
87
- "close-many": ["fullChangedFields"],
88
- assurance: ["fullChangedFields", "idOnly"],
89
- };
90
- /** Create-compatible metadata parameters reused by Plan materialization and CLI registration. */
91
- export const PLAN_CREATE_METADATA_PARAMETER_KEYS = [
92
- "createMode",
93
- "status",
94
- "deadline",
95
- "estimate",
96
- "acceptanceCriteria",
97
- "definitionOfReady",
98
- "order",
99
- "rank",
100
- "goal",
101
- "objective",
102
- "value",
103
- "impact",
104
- "outcome",
105
- "whyNow",
106
- "assignee",
107
- "reviewer",
108
- "risk",
109
- "confidence",
110
- "sprint",
111
- "release",
112
- "blockedReason",
113
- "unblockNote",
114
- "reporter",
115
- "severity",
116
- "environment",
117
- "reproSteps",
118
- "resolution",
119
- "expectedResult",
120
- "actualResult",
121
- "affectedVersion",
122
- "fixedVersion",
123
- "component",
124
- "regression",
125
- "customerImpact",
126
- "comment",
127
- "note",
128
- "learning",
129
- "reminder",
130
- "event",
131
- "typeOption",
132
- ];
133
- /** Runtime-consumed nested compatibility keys that intentionally sit outside the canonical strict schema. */
134
- const PM_TOOL_ACTION_NESTED_OPTION_COMPATIBILITY_KEYS = Object.freeze({
135
- "close-many": [
136
- "list",
137
- "expected_result",
138
- "expected",
139
- "actual_result",
140
- "actual",
141
- "validate_close",
142
- "dry_run",
143
- "checkpoint",
144
- "no_checkpoint",
145
- "filterAssignee_filter",
146
- ],
147
- "update-many": [
148
- "list",
149
- "update",
150
- "dry_run",
151
- "checkpoint",
152
- "no_checkpoint",
153
- "filterAssignee_filter",
154
- ],
155
- ...Object.fromEntries(PM_TOOL_ACTIONS.filter((action) => action === "upgrade" ||
156
- action === "install" ||
157
- action === "extension" ||
158
- action === "package" ||
159
- action.startsWith("extension-") ||
160
- action.startsWith("package-")).map((action) => [action, ["project", "local", "global"]])),
161
- });
162
- function toSchemaKeyList(values) {
163
- return normalizeUniqueStringList(values);
164
- }
165
- const CREATE_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
166
- ...TOOL_CREATE_OPTION_CONTRACTS.map((entry) => entry.param),
167
- ...TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS.map((entry) => entry.param),
168
- "assignee",
169
- "closeReason",
170
- "completedAt",
171
- ]);
172
- const UPDATE_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
173
- ...TOOL_UPDATE_OPTION_CONTRACTS.map((entry) => entry.param),
174
- ...TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS.map((entry) => entry.param),
175
- "force",
176
- ]);
177
- const UPDATE_MANY_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
178
- ...TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS.map((entry) => entry.param),
179
- ...UPDATE_CONTRACT_PARAMETER_KEYS.filter((key) => key !== "allowMissingParent" && key !== "completedAt"),
180
- "dryRun",
181
- "rollback",
182
- "noCheckpoint",
183
- ]);
184
- const CLOSE_MANY_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
185
- ...TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS.map((entry) => entry.param),
186
- "reason",
187
- "completedAt",
188
- "resolution",
189
- "expectedResult",
190
- "actualResult",
191
- "validateClose",
192
- "dryRun",
193
- "rollback",
194
- "noCheckpoint",
195
- "author",
196
- "message",
197
- "force",
198
- ]);
199
- const CONTEXT_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
200
- ...TOOL_CONTEXT_OPTION_CONTRACTS.map((entry) => entry.param),
201
- "past",
202
- "section",
203
- ]);
204
- const ACTIVITY_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
205
- ...TOOL_ACTIVITY_OPTION_CONTRACTS.map((entry) => entry.param),
206
- "stream",
207
- ]);
208
- const LIST_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
209
- ...TOOL_LIST_FILTER_OPTION_CONTRACTS.map((entry) => entry.param),
210
- "all",
211
- "includeBody",
212
- "noTruncate",
213
- "strictRead",
214
- "compact",
215
- "brief",
216
- "full",
217
- ]);
218
- const FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS = LIST_CONTRACT_PARAMETER_KEYS.filter((parameter) => parameter !== "all" && parameter !== "status");
219
- const LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS = [
220
- [
221
- { property: "today", schema: { const: true } },
222
- { property: "recent", schema: { const: true } },
223
- ],
224
- [
225
- { property: "today", schema: { const: true } },
226
- { property: "updatedAfter", schema: { type: "string", pattern: "\\S" } },
227
- ],
228
- [
229
- { property: "recent", schema: { const: true } },
230
- { property: "updatedAfter", schema: { type: "string", pattern: "\\S" } },
231
- ],
232
- ];
233
- const CONTRACTS_PROJECTION_MUTUALLY_EXCLUSIVE_GROUPS = [
234
- [
235
- { property: "summary", schema: { const: true } },
236
- { property: "schemaOnly", schema: { const: true } },
237
- ],
238
- [
239
- { property: "summary", schema: { const: true } },
240
- { property: "flagsOnly", schema: { const: true } },
241
- ],
242
- [
243
- { property: "summary", schema: { const: true } },
244
- { property: "availabilityOnly", schema: { const: true } },
245
- ],
246
- [
247
- { property: "schemaOnly", schema: { const: true } },
248
- { property: "flagsOnly", schema: { const: true } },
249
- ],
250
- [
251
- { property: "schemaOnly", schema: { const: true } },
252
- { property: "availabilityOnly", schema: { const: true } },
253
- ],
254
- [
255
- { property: "flagsOnly", schema: { const: true } },
256
- { property: "availabilityOnly", schema: { const: true } },
257
- ],
258
- ];
259
- const AGGREGATE_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
260
- ...TOOL_AGGREGATE_OPTION_CONTRACTS.map((entry) => entry.param),
261
- "count",
262
- "completion",
263
- "includeUnparented",
264
- ]);
265
- const SEARCH_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
266
- "query",
267
- "keywords",
268
- "mode",
269
- "semantic",
270
- "hybrid",
271
- "includeLinked",
272
- "titleExact",
273
- "phraseExact",
274
- "highlight",
275
- "compact",
276
- "full",
277
- ...TOOL_SEARCH_FILTER_OPTION_CONTRACTS.map((entry) => entry.param),
278
- ]);
279
- const NEXT_CONTRACT_PARAMETER_KEYS = toSchemaKeyList([
280
- "type",
281
- "tag",
282
- "priority",
283
- "assignee",
284
- "assigneeFilter",
285
- "sprint",
286
- "release",
287
- "parent",
288
- "limit",
289
- "blockedLimit",
290
- "readyOnly",
291
- "format",
292
- "includeDecisions",
293
- "includeGates",
294
- "includeContainers",
295
- "tokenBudget",
296
- "explainRanking",
297
- ]);
298
- const AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS = ["author", "message", "force"];
299
- /** Close-action option keys shared by the strict tool schema and the typed SDK close input (pm-x29o); the author/message/force triple is appended separately by the schema contract. */
300
- export const CLOSE_ACTION_OPTION_KEYS = [
301
- "text",
302
- "reason",
303
- "closeReason",
304
- "completedAt",
305
- "duplicateOf",
306
- "validateClose",
307
- "resolution",
308
- "expectedResult",
309
- "actualResult",
310
- ];
311
- const LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS = [
312
- "author",
313
- "assignee",
314
- "message",
315
- "force",
316
- ];
317
- const MANAGED_EXTENSION_PACKAGE_OPTION_KEYS = [
318
- "target",
319
- "scope",
320
- "capability",
321
- "declarative",
322
- "github",
323
- "ref",
324
- "init",
325
- "install",
326
- "uninstall",
327
- "explore",
328
- "manage",
329
- "describe",
330
- "markdown",
331
- "output",
332
- "reload",
333
- "doctor",
334
- "catalog",
335
- "list",
336
- "adopt",
337
- "adoptAll",
338
- "activate",
339
- "deactivate",
340
- "runtimeProbe",
341
- "fixManagedState",
342
- "isolated",
343
- "ignoreGlobal",
344
- "detail",
345
- "trace",
346
- "watch",
347
- "strictExit",
348
- "failOnWarn",
349
- ];
350
- function managedLifecycleSchemaContracts(prefix) {
351
- return {
352
- [`${prefix}-init`]: {
353
- required: ["target"],
354
- optional: [
355
- "scope",
356
- "capability",
357
- ...(prefix === "package" ? ["declarative"] : []),
358
- ],
359
- },
360
- [`${prefix}-install`]: {
361
- optional: ["target", "github", "scope", "ref"],
362
- anyOfRequired: [["target"], ["github"]],
363
- },
364
- [`${prefix}-uninstall`]: { required: ["target"], optional: ["scope"] },
365
- [`${prefix}-explore`]: { optional: ["scope"] },
366
- [`${prefix}-manage`]: {
367
- optional: ["scope", "runtimeProbe", "fixManagedState"],
368
- },
369
- [`${prefix}-describe`]: {
370
- optional: ["target", "scope", "markdown", "output"],
371
- },
372
- [`${prefix}-reload`]: { optional: ["scope", "watch"] },
373
- [`${prefix}-doctor`]: {
374
- optional: [
375
- "scope",
376
- "detail",
377
- "trace",
378
- "fixManagedState",
379
- "isolated",
380
- "ignoreGlobal",
381
- "strictExit",
382
- "failOnWarn",
383
- ],
384
- },
385
- [`${prefix}-catalog`]: { optional: ["scope", "fields"] },
386
- [`${prefix}-adopt`]: {
387
- required: ["target"],
388
- optional: ["scope", "github", "ref"],
389
- },
390
- [`${prefix}-adopt-all`]: { optional: ["scope"] },
391
- [`${prefix}-activate`]: { required: ["target"], optional: ["scope"] },
392
- [`${prefix}-deactivate`]: { required: ["target"], optional: ["scope"] },
393
- [prefix]: {
394
- optional: MANAGED_EXTENSION_PACKAGE_OPTION_KEYS,
395
- },
396
- };
397
- }
398
- const SCHEDULING_ACTION_SCHEMA_CONTRACT = {
399
- required: ["title"],
400
- optional: [
401
- "start",
402
- "duration",
403
- "end",
404
- "location",
405
- "timezone",
406
- "allDay",
407
- "parent",
408
- "allowMissingParent",
409
- "tags",
410
- "priority",
411
- "body",
412
- "description",
413
- "author",
414
- "message",
415
- ],
416
- };
417
- const UPGRADE_ACTION_SCHEMA_CONTRACT = {
418
- optional: [
419
- "target",
420
- "scope",
421
- "dryRun",
422
- "cliOnly",
423
- "packagesOnly",
424
- "repair",
425
- "tag",
426
- "packageName",
427
- ],
428
- };
429
- const PM_TOOL_ACTION_SCHEMA_CONTRACTS = {
430
- init: {
431
- optional: [
432
- "prefix",
433
- "idPrefix",
434
- "workspace",
435
- "preset",
436
- "typePreset",
437
- "defaults",
438
- "author",
439
- "agentGuidance",
440
- "withPackages",
441
- "mergeFence",
442
- "force",
443
- "verbose",
444
- ],
445
- },
446
- config: {
447
- required: ["scope", "configAction"],
448
- optional: [
449
- "key",
450
- "value",
451
- "criterion",
452
- "clearCriteria",
453
- "format",
454
- "policy",
455
- ],
456
- },
457
- ...managedLifecycleSchemaContracts("extension"),
458
- ...managedLifecycleSchemaContracts("package"),
459
- "package-upgrade": UPGRADE_ACTION_SCHEMA_CONTRACT,
460
- install: {
461
- optional: ["target", "github", "scope", "ref"],
462
- anyOfRequired: [["target"], ["github"]],
463
- },
464
- upgrade: UPGRADE_ACTION_SCHEMA_CONTRACT,
465
- create: {
466
- required: [
467
- "title",
468
- "description",
469
- "type",
470
- "status",
471
- "priority",
472
- "message",
473
- ],
474
- optional: CREATE_CONTRACT_PARAMETER_KEYS,
475
- },
476
- copy: {
477
- required: ["id"],
478
- optional: ["title", "author", "message", "allowDuplicate"],
479
- },
480
- focus: { optional: ["id", "clear"], mutuallyExclusive: [["id", "clear"]] },
481
- list: {
482
- optional: LIST_CONTRACT_PARAMETER_KEYS,
483
- mutuallyExclusiveWhen: LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS,
484
- },
485
- "list-all": {
486
- optional: LIST_CONTRACT_PARAMETER_KEYS,
487
- mutuallyExclusiveWhen: LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS,
488
- },
489
- "list-draft": {
490
- optional: FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,
491
- mutuallyExclusiveWhen: LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS,
492
- },
493
- "list-open": {
494
- optional: FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,
495
- mutuallyExclusiveWhen: LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS,
496
- },
497
- "list-in-progress": {
498
- optional: FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,
499
- mutuallyExclusiveWhen: LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS,
500
- },
501
- "list-blocked": {
502
- optional: FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,
503
- mutuallyExclusiveWhen: LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS,
504
- },
505
- "list-closed": {
506
- optional: FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,
507
- mutuallyExclusiveWhen: LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS,
508
- },
509
- "list-canceled": {
510
- optional: FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,
511
- mutuallyExclusiveWhen: LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS,
512
- },
513
- aggregate: { optional: AGGREGATE_CONTRACT_PARAMETER_KEYS },
514
- guide: { optional: ["list", "format", "depth"] },
515
- context: { optional: CONTEXT_CONTRACT_PARAMETER_KEYS },
516
- ctx: { optional: CONTEXT_CONTRACT_PARAMETER_KEYS },
517
- get: {
518
- required: ["id"],
519
- optional: [
520
- "for",
521
- "tokenBudget",
522
- "at",
523
- "depth",
524
- "full",
525
- "fields",
526
- "tree",
527
- "treeDepth",
528
- "format",
529
- ],
530
- },
531
- search: {
532
- optional: SEARCH_CONTRACT_PARAMETER_KEYS,
533
- anyOfRequired: [["query"], ["keywords"]],
534
- },
535
- eval: { optional: ["mode", "k", "failUnder", "queries", "format"] },
536
- events: {
537
- optional: [
538
- "since",
539
- "type",
540
- "author",
541
- "item",
542
- "limit",
543
- "full",
544
- "provenance",
545
- "provenanceSummary",
546
- "harness",
547
- "agentInstance",
548
- "provenanceFilter",
549
- "cursorMode",
550
- ],
551
- },
552
- merge: {
553
- required: ["subcommand"],
554
- optional: [
555
- "dryRun",
556
- "author",
557
- "message",
558
- "force",
559
- "includeReconciled",
560
- "artifact",
561
- "basePath",
562
- "oursPath",
563
- "theirsPath",
564
- "output",
565
- "outputPath",
566
- "itemPath",
567
- "prefer",
568
- ],
569
- },
570
- workspace: {
571
- required: ["subcommand"],
572
- optional: [
573
- "snapshotAction",
574
- "name",
575
- "target",
576
- "dryRun",
577
- "force",
578
- "author",
579
- "message",
580
- "lockTtlSeconds",
581
- "lockWaitMs",
582
- ],
583
- conditionalRequired: [
584
- {
585
- property: "subcommand",
586
- value: "snapshot",
587
- required: ["snapshotAction"],
588
- },
589
- ],
590
- },
591
- meet: SCHEDULING_ACTION_SCHEMA_CONTRACT,
592
- event: SCHEDULING_ACTION_SCHEMA_CONTRACT,
593
- remind: {
594
- required: ["title"],
595
- optional: [
596
- "at",
597
- "text",
598
- "parent",
599
- "allowMissingParent",
600
- "tags",
601
- "priority",
602
- "body",
603
- "description",
604
- "author",
605
- "message",
606
- ],
607
- },
608
- next: { optional: [...NEXT_CONTRACT_PARAMETER_KEYS, "for"] },
609
- reindex: { optional: ["mode", "progress"] },
610
- history: {
611
- required: ["id"],
612
- optional: [
613
- "limit",
614
- "compact",
615
- "full",
616
- "provenance",
617
- "provenanceSummary",
618
- "harness",
619
- "agentInstance",
620
- "provenanceFilter",
621
- "diff",
622
- "verify",
623
- "field",
624
- "strictExit",
625
- "failOnWarn",
626
- "format",
627
- ],
628
- },
629
- "history-redact": {
630
- required: ["id"],
631
- optional: [
632
- "literal",
633
- "regex",
634
- "replacement",
635
- "dryRun",
636
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
637
- ],
638
- anyOfRequired: [["literal"], ["regex"]],
639
- },
640
- "history-repair": {
641
- // Exactly one of `id` (single stream) or `all` (bulk drift repair) is required.
642
- optional: [
643
- "id",
644
- "all",
645
- "dryRun",
646
- "normalizeProvenance",
647
- "salvageTail",
648
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
649
- ],
650
- oneOfRequired: [["id"], ["all"]],
651
- mutuallyExclusiveWhen: [
652
- [
653
- { property: "salvageTail", schema: { const: true } },
654
- { property: "all", schema: { const: true } },
655
- ],
656
- [
657
- { property: "salvageTail", schema: { const: true } },
658
- { property: "normalizeProvenance", schema: { const: true } },
659
- ],
660
- ],
661
- },
662
- "history-author-acknowledge": {
663
- optional: [
664
- "historyEvent",
665
- "allActionable",
666
- "dryRun",
667
- "planFingerprint",
668
- "limit",
669
- "attributedAuthor",
670
- "reviewer",
671
- "reason",
672
- ],
673
- oneOfRequired: [["historyEvent"], ["allActionable"]],
674
- },
675
- "history-compact": {
676
- // Single-id mode (`id` + optional `before`) or bulk mode (any of `ids` /
677
- // `allOver` / `closed` / `allStreams`, with optional `minEntries`). Scan
678
- // selectors (`allOver` + `closed`/`allStreams`) legitimately combine, so the
679
- // mode/exclusivity contract is enforced at runtime by assertHistoryCompactTarget
680
- // rather than a one-of schema rule.
681
- optional: [
682
- "id",
683
- "before",
684
- "ids",
685
- "allOver",
686
- "closed",
687
- "allStreams",
688
- "minEntries",
689
- "dryRun",
690
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
691
- ],
692
- },
693
- schema: {
694
- required: ["subcommand"],
695
- // No --message: schema mutations write config files, not item history.
696
- optional: [
697
- "name",
698
- "description",
699
- "defaultStatus",
700
- "folder",
701
- "alias",
702
- "role",
703
- "order",
704
- "fieldType",
705
- "commands",
706
- "cliFlag",
707
- "required",
708
- "requiredOnCreate",
709
- "allowUnset",
710
- "requiredTypes",
711
- "typePreset",
712
- "infer",
713
- "minCount",
714
- "apply",
715
- "to",
716
- "migrationId",
717
- "fieldTypeScope",
718
- "dryRun",
719
- "author",
720
- "force",
721
- ],
722
- conditionalRequired: [
723
- { property: "subcommand", value: "show", required: ["name"] },
724
- { property: "subcommand", value: "show-status", required: ["name"] },
725
- { property: "subcommand", value: "add-type", required: ["name"] },
726
- { property: "subcommand", value: "remove-type", required: ["name"] },
727
- // show-status/add-status/remove-status pass the status id as `name`.
728
- { property: "subcommand", value: "add-status", required: ["name"] },
729
- { property: "subcommand", value: "remove-status", required: ["name"] },
730
- // field subcommands pass the field key as `name`.
731
- { property: "subcommand", value: "add-field", required: ["name"] },
732
- { property: "subcommand", value: "remove-field", required: ["name"] },
733
- { property: "subcommand", value: "show-field", required: ["name"] },
734
- {
735
- property: "subcommand",
736
- value: "rename-type",
737
- required: ["name", "to"],
738
- },
739
- {
740
- property: "subcommand",
741
- value: "rename-field",
742
- required: ["name", "to"],
743
- },
744
- {
745
- property: "subcommand",
746
- value: "remap-status",
747
- required: ["name", "to"],
748
- },
749
- // apply-preset passes the preset name as `typePreset`.
750
- {
751
- property: "subcommand",
752
- value: "apply-preset",
753
- required: ["typePreset"],
754
- },
755
- ],
756
- },
757
- profile: {
758
- required: ["subcommand"],
759
- // No --message: profile staging writes config/schema files, not item history.
760
- optional: ["name", "dryRun", "author", "force"],
761
- conditionalRequired: [
762
- { property: "subcommand", value: "show", required: ["name"] },
763
- { property: "subcommand", value: "apply", required: ["name"] },
764
- { property: "subcommand", value: "lint", required: ["name"] },
765
- ],
766
- },
767
- plan: {
768
- required: ["subcommand"],
769
- optional: [
770
- "id",
771
- "stepRef",
772
- "reorderTo",
773
- "title",
774
- "description",
775
- "template",
776
- "scope",
777
- "parent",
778
- "related",
779
- "blocks",
780
- "blockedBy",
781
- "harness",
782
- "mode",
783
- "resumeContext",
784
- "tags",
785
- "priority",
786
- ...PLAN_CREATE_METADATA_PARAMETER_KEYS,
787
- "body",
788
- "claim",
789
- "fromSearch",
790
- "stepTitle",
791
- "step",
792
- "stepBody",
793
- "stepOwner",
794
- "stepStatus",
795
- "stepEvidence",
796
- "stepBlockedReason",
797
- "stepReplacement",
798
- "dependsOn",
799
- "link",
800
- "linkKind",
801
- "linkNote",
802
- "promoteToItemDep",
803
- "allowMultipleActive",
804
- "file",
805
- "test",
806
- "doc",
807
- "decisionText",
808
- "decision",
809
- "decisionRationale",
810
- "decisionEvidence",
811
- "discoveryText",
812
- "discovery",
813
- "validationText",
814
- "validation",
815
- "validationCommand",
816
- "validationExpected",
817
- "depth",
818
- "fields",
819
- "steps",
820
- "materializeType",
821
- "materializeParent",
822
- "materializeTags",
823
- "field",
824
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
825
- ],
826
- },
827
- activity: { optional: ACTIVITY_CONTRACT_PARAMETER_KEYS },
828
- restore: {
829
- required: ["id", "target"],
830
- optional: AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
831
- },
832
- update: {
833
- required: ["id"],
834
- optional: UPDATE_CONTRACT_PARAMETER_KEYS,
835
- mutuallyExclusive: [
836
- ["acceptanceCriteria", "addAc"],
837
- ["acceptanceCriteria", "removeAc"],
838
- ],
839
- },
840
- "update-many": {
841
- optional: UPDATE_MANY_CONTRACT_PARAMETER_KEYS,
842
- mutuallyExclusive: [
843
- ["acceptanceCriteria", "addAc"],
844
- ["acceptanceCriteria", "removeAc"],
845
- ],
846
- },
847
- close: {
848
- required: ["id"],
849
- optional: [
850
- ...CLOSE_ACTION_OPTION_KEYS,
851
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
852
- ],
853
- },
854
- "close-many": { optional: CLOSE_MANY_CONTRACT_PARAMETER_KEYS },
855
- delete: {
856
- required: ["id"],
857
- optional: ["dryRun", ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],
858
- },
859
- append: {
860
- required: ["id", "body"],
861
- optional: AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
862
- },
863
- comments: {
864
- required: ["id"],
865
- optional: [
866
- "text",
867
- "add",
868
- "stdin",
869
- "edit",
870
- "delete",
871
- "limit",
872
- "full",
873
- "ifAbsent",
874
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
875
- ],
876
- mutuallyExclusive: [
877
- ["edit", "ifAbsent"],
878
- ["delete", "ifAbsent"],
879
- ],
880
- },
881
- notes: {
882
- required: ["id"],
883
- optional: [
884
- "text",
885
- "add",
886
- "addJson",
887
- "stdin",
888
- "edit",
889
- "delete",
890
- "limit",
891
- "since",
892
- "eventType",
893
- "includeMeta",
894
- "full",
895
- "ifAbsent",
896
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
897
- ],
898
- mutuallyExclusive: [
899
- ["addJson", "add"],
900
- ["addJson", "stdin"],
901
- ["addJson", "file"],
902
- ["addJson", "edit"],
903
- ["addJson", "delete"],
904
- ["edit", "ifAbsent"],
905
- ["delete", "ifAbsent"],
906
- ],
907
- },
908
- learnings: {
909
- required: ["id"],
910
- optional: [
911
- "text",
912
- "add",
913
- "stdin",
914
- "edit",
915
- "delete",
916
- "limit",
917
- "full",
918
- "ifAbsent",
919
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
920
- ],
921
- mutuallyExclusive: [
922
- ["edit", "ifAbsent"],
923
- ["delete", "ifAbsent"],
924
- ],
925
- },
926
- files: {
927
- required: [],
928
- optional: [
929
- "id",
930
- "add",
931
- "addGlob",
932
- "remove",
933
- "migrate",
934
- "list",
935
- // GH-170 (pm-pfnx): `addNote` is the MCP spelling of the CLI --note flag
936
- // (the shared `note` parameter is the array-typed create/update note
937
- // seed, so files/docs use a distinct single-string key).
938
- "addNote",
939
- "discover",
940
- "apply",
941
- "discoveryNote",
942
- "appendStable",
943
- "validatePaths",
944
- "lookupPath",
945
- "scope",
946
- "limit",
947
- "offset",
948
- "noTruncate",
949
- "strictRead",
950
- "explain",
951
- "lines",
952
- "decisionDepth",
953
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
954
- ],
955
- anyOfRequired: [["id"], ["lookupPath"]],
956
- dependentAnyOfRequired: [
957
- { property: "addNote", anyOfRequired: [["add"], ["addGlob"]] },
958
- ],
959
- },
960
- docs: {
961
- required: ["id"],
962
- optional: [
963
- "add",
964
- "addGlob",
965
- "remove",
966
- "migrate",
967
- "addNote",
968
- "list",
969
- "validatePaths",
970
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
971
- ],
972
- dependentAnyOfRequired: [
973
- { property: "addNote", anyOfRequired: [["add"], ["addGlob"]] },
974
- ],
975
- },
976
- deps: {
977
- required: ["id"],
978
- optional: [
979
- "format",
980
- "maxDepth",
981
- "collapse",
982
- "summary",
983
- "full",
984
- "nodeLimit",
985
- "edgeLimit",
986
- "tokenBudget",
987
- "cursor",
988
- "direction",
989
- "kind",
990
- ],
991
- },
992
- graph: {
993
- required: ["subcommand"],
994
- optional: [
995
- "id",
996
- "target",
997
- "kind",
998
- "maxDepth",
999
- "limit",
1000
- "after",
1001
- "direction",
1002
- "maxPaths",
1003
- "sample",
1004
- "exemptIsolate",
1005
- "exemptIsolateType",
1006
- "saveBaseline",
1007
- "rebuild",
1008
- "clear",
1009
- "summary",
1010
- "full",
1011
- ],
1012
- },
1013
- test: {
1014
- required: ["id"],
1015
- optional: [
1016
- "list",
1017
- "add",
1018
- "addJson",
1019
- "remove",
1020
- "removeIndex",
1021
- "run",
1022
- "match",
1023
- "onlyIndex",
1024
- "onlyLast",
1025
- "background",
1026
- "timeout",
1027
- "progress",
1028
- "envSet",
1029
- "envClear",
1030
- "sharedHostSafe",
1031
- "pmContext",
1032
- "overrideLinkedPmContext",
1033
- "workspaceContext",
1034
- "overrideLinkedWorkspaceContext",
1035
- "allowUntrustedLinkedTests",
1036
- "acknowledgeLinkedTests",
1037
- "failOnContextMismatch",
1038
- "failOnSkipped",
1039
- "failOnEmptyTestRun",
1040
- "requireAssertionsForPm",
1041
- "checkContext",
1042
- "autoPmContext",
1043
- "measure",
1044
- "metricBelow",
1045
- "metricDiff",
1046
- ...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
1047
- ],
1048
- mutuallyExclusive: [
1049
- ["acknowledgeLinkedTests", "run"],
1050
- ["acknowledgeLinkedTests", "background"],
1051
- ],
1052
- },
1053
- "test-all": {
1054
- optional: [
1055
- "status",
1056
- "limit",
1057
- "offset",
1058
- "background",
1059
- "timeout",
1060
- "progress",
1061
- "envSet",
1062
- "envClear",
1063
- "sharedHostSafe",
1064
- "pmContext",
1065
- "overrideLinkedPmContext",
1066
- "workspaceContext",
1067
- "overrideLinkedWorkspaceContext",
1068
- "allowUntrustedLinkedTests",
1069
- "failOnContextMismatch",
1070
- "failOnSkipped",
1071
- "failOnEmptyTestRun",
1072
- "requireAssertionsForPm",
1073
- "checkContext",
1074
- "autoPmContext",
1075
- ],
1076
- },
1077
- telemetry: {
1078
- optional: ["subcommand", "limit"],
1079
- },
1080
- "test-runs-list": {
1081
- optional: ["status", "limit"],
1082
- },
1083
- "test-runs-status": {
1084
- required: ["runId"],
1085
- },
1086
- "test-runs-logs": {
1087
- required: ["runId"],
1088
- optional: ["stream", "tail"],
1089
- },
1090
- "test-runs-stop": {
1091
- required: ["runId"],
1092
- optional: ["force"],
1093
- },
1094
- "test-runs-resume": {
1095
- required: ["runId"],
1096
- optional: ["author"],
1097
- },
1098
- stats: {
1099
- optional: [
1100
- "includeEmpty",
1101
- "storage",
1102
- "metadataCoverage",
1103
- "fieldUtilization",
1104
- "byAssignee",
1105
- "byTag",
1106
- "byPriority",
1107
- "tagPrefix",
1108
- "measurements",
1109
- "metric",
1110
- "measurementLimit",
1111
- "observe",
1112
- "improvementDirection",
1113
- "measurementSource",
1114
- "measurementItem",
1115
- "measurementRevision",
1116
- "author",
1117
- "message",
1118
- "provenanceCoverage",
1119
- "fleetAttribution",
1120
- "since",
1121
- "eventLimit",
1122
- "minimumSample",
1123
- ],
1124
- },
1125
- duplicates: {
1126
- optional: ["status", "since", "threshold", "limit", "exhaustive"],
1127
- },
1128
- health: {
1129
- optional: [
1130
- "strictDirectories",
1131
- "requireMergeDrivers",
1132
- "strictExit",
1133
- "failOnWarn",
1134
- "checkOnly",
1135
- "checkTelemetry",
1136
- "noRefresh",
1137
- "refreshVectors",
1138
- "verboseStaleItems",
1139
- "verboseAuthorEvents",
1140
- "brief",
1141
- "summary",
1142
- "skipVectors",
1143
- "skipIntegrity",
1144
- "skipDrift",
1145
- "full",
1146
- ],
1147
- },
1148
- validate: {
1149
- optional: [
1150
- "checkStorageIntegrity",
1151
- "checkMetadata",
1152
- "metadataProfile",
1153
- "checkResolution",
1154
- "checkLifecycle",
1155
- "checkStaleBlockers",
1156
- "dependencyCycleSeverity",
1157
- "parentCycleSeverity",
1158
- "checkFiles",
1159
- "scanMode",
1160
- "includePmInternals",
1161
- "verboseFileLists",
1162
- "verboseDiagnostics",
1163
- "allAffectedIds",
1164
- "strictExit",
1165
- "failOnWarn",
1166
- "fixHints",
1167
- "autoFix",
1168
- "dryRun",
1169
- "fixScope",
1170
- "pruneMissing",
1171
- "checkHistoryDrift",
1172
- "checkCommandReferences",
1173
- "counts",
1174
- "full",
1175
- ],
1176
- },
1177
- assurance: {
1178
- required: ["subcommand"],
1179
- optional: [
1180
- "kind",
1181
- "id",
1182
- "definition",
1183
- "trigger",
1184
- "treeId",
1185
- "gate",
1186
- "limit",
1187
- "dryRun",
1188
- "author",
1189
- "message",
1190
- "preset",
1191
- "owner",
1192
- "apply",
1193
- "enforcement",
1194
- ],
1195
- conditionalRequired: [
1196
- { property: "subcommand", value: "list", required: ["kind"] },
1197
- { property: "subcommand", value: "show", required: ["kind", "id"] },
1198
- {
1199
- property: "subcommand",
1200
- value: "put",
1201
- required: ["kind", "id", "definition"],
1202
- },
1203
- { property: "subcommand", value: "remove", required: ["kind", "id"] },
1204
- { property: "subcommand", value: "run", required: ["id", "trigger"] },
1205
- {
1206
- property: "subcommand",
1207
- value: "apply",
1208
- required: ["preset", "owner"],
1209
- },
1210
- { property: "subcommand", value: "derive", required: ["owner"] },
1211
- { property: "subcommand", value: "risk", required: ["definition"] },
1212
- { property: "subcommand", value: "lineages", required: ["definition"] },
1213
- {
1214
- property: "subcommand",
1215
- value: "promote",
1216
- required: ["id", "enforcement"],
1217
- },
1218
- ],
1219
- mutuallyExclusiveWhen: [
1220
- [
1221
- { property: "subcommand", schema: { const: "risk" } },
1222
- { property: "definition", schema: { not: { required: ["policy", "change"] } } },
1223
- ],
1224
- [
1225
- { property: "subcommand", schema: { const: "lineages" } },
1226
- { property: "definition", schema: { anyOf: [{ required: ["change"] }, { not: { required: ["policy"] } }] } },
1227
- ],
1228
- ],
1229
- },
1230
- gc: { optional: ["dryRun", "gcScope"] },
1231
- contracts: {
1232
- optional: [
1233
- "contractAction",
1234
- "command",
1235
- "summary",
1236
- "schemaOnly",
1237
- "flagsOnly",
1238
- "availabilityOnly",
1239
- "runtimeOnly",
1240
- "activeOnly",
1241
- "full",
1242
- ],
1243
- mutuallyExclusiveWhen: CONTRACTS_PROJECTION_MUTUALLY_EXCLUSIVE_GROUPS,
1244
- },
1245
- completion: { required: ["shell"], optional: ["eagerTags"] },
1246
- claim: {
1247
- optional: [
1248
- "id",
1249
- "next",
1250
- "ifAvailable",
1251
- "maxAttempts",
1252
- "includeDecisions",
1253
- ...NEXT_CONTRACT_PARAMETER_KEYS,
1254
- ...LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
1255
- ],
1256
- oneOfRequired: [["id"], ["next"]],
1257
- },
1258
- release: {
1259
- required: ["id"],
1260
- optional: LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
1261
- },
1262
- "start-task": {
1263
- required: ["id"],
1264
- optional: LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
1265
- },
1266
- "pause-task": {
1267
- required: ["id"],
1268
- optional: LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
1269
- },
1270
- "close-task": {
1271
- required: ["id"],
1272
- optional: [
1273
- "text",
1274
- "validateClose",
1275
- ...LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS,
1276
- ],
1277
- },
1278
- "item-reopen": {
1279
- required: ["id", "reason"],
1280
- optional: ["status", "author", "message", "force"],
1281
- },
1282
- };
1283
- /** Public contract for pm tool action parameter contracts, shared by SDK and presentation-layer consumers. */
1284
- export const PM_TOOL_ACTION_PARAMETER_CONTRACTS = Object.freeze(Object.fromEntries(PM_TOOL_ACTIONS.map((action) => [
1285
- action,
1286
- PM_TOOL_ACTION_SCHEMA_CONTRACTS[action],
1287
- ])));
1288
- function fallbackToolParameterDescription(key) {
1289
- return key
1290
- .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
1291
- .replace(/[_-]/g, " ")
1292
- .trim()
1293
- .replace(/^./, (value) => value.toUpperCase())
1294
- .concat(".");
1295
- }
1296
- function decorateToolParameterDefinition(key, definition) {
1297
- const baseDefinition = typeof definition === "object" && definition !== null
1298
- ? { ...definition }
1299
- : {};
1300
- const metadata = PM_TOOL_PARAMETER_METADATA[key];
1301
- return {
1302
- ...baseDefinition,
1303
- description: metadata?.description ?? fallbackToolParameterDescription(key),
1304
- ...(metadata?.examples ? { examples: metadata.examples } : {}),
1305
- };
1306
- }
1307
- function actionScopedToolParameterMetadata(action, key) {
1308
- if ((action === "list" || action.startsWith("list-")) && key === "all") {
1309
- return {
1310
- description: "Return items from every lifecycle status instead of the default active-status set.",
1311
- };
1312
- }
1313
- if (action === "plan" &&
1314
- Object.prototype.hasOwnProperty.call(PLAN_ACTION_PARAMETER_METADATA, key)) {
1315
- return PLAN_ACTION_PARAMETER_METADATA[key];
1316
- }
1317
- const actionOverrides = PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA[action];
1318
- if (actionOverrides &&
1319
- Object.prototype.hasOwnProperty.call(actionOverrides, key)) {
1320
- return actionOverrides[key];
1321
- }
1322
- return PM_TOOL_PARAMETER_METADATA[key];
1323
- }
1324
- function decorateActionScopedToolParameterDefinition(action, key, definition) {
1325
- const baseDefinition = typeof definition === "object" && definition !== null
1326
- ? { ...definition }
1327
- : {};
1328
- const metadata = actionScopedToolParameterMetadata(action, key);
1329
- return {
1330
- ...baseDefinition,
1331
- description: metadata?.description ?? fallbackToolParameterDescription(key),
1332
- ...(metadata?.examples ? { examples: metadata.examples } : {}),
1333
- };
1334
- }
1335
- function actionScopedToolParameterDefinition(action, key) {
1336
- const actionProperties = PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES[action];
1337
- if (actionProperties &&
1338
- Object.prototype.hasOwnProperty.call(actionProperties, key)) {
1339
- return actionProperties[key];
1340
- }
1341
- if (action === "plan" &&
1342
- Object.prototype.hasOwnProperty.call(PLAN_ACTION_PARAMETER_PROPERTIES, key)) {
1343
- return PLAN_ACTION_PARAMETER_PROPERTIES[key];
1344
- }
1345
- if ((action === "get" || action === "history" || action === "search") &&
1346
- key === "format") {
1347
- return { type: "string", enum: ["json", "toon"] };
1348
- }
1349
- return PM_TOOL_PARAMETER_PROPERTIES[key];
1350
- }
1351
- /** Build the `properties` map for one action-scoped schema: the fixed `action` literal followed by every allowed parameter that resolves to a concrete definition, each decorated with its action-scoped description and examples. */
1352
- function buildActionScopedSchemaProperties(action, allowedKeys) {
1353
- const properties = {
1354
- action: {
1355
- const: action,
1356
- description: PM_TOOL_PARAMETER_METADATA.action?.description ??
1357
- "Tool action to execute.",
1358
- },
1359
- };
1360
- for (const key of allowedKeys) {
1361
- if (key === "action") {
1362
- continue;
1363
- }
1364
- const definition = actionScopedToolParameterDefinition(action, key);
1365
- if (definition) {
1366
- properties[key] = decorateActionScopedToolParameterDefinition(action, key, definition);
1367
- }
1368
- }
1369
- return properties;
1370
- }
1371
- /** Build the `oneOf` branches for an action whose contract requires exactly one of several field groups. Each branch requires its own group and — when sibling groups exist — forbids any field drawn from them, so the schema rejects the same overlapping combinations the runtime rejects; `history-repair`'s `all` branch additionally pins `all` to the literal `true`. */
1372
- function buildOneOfSchemaEntries(action, oneOfRequiredGroups) {
1373
- const allOneOfFields = oneOfRequiredGroups.flat();
1374
- return oneOfRequiredGroups.map((requiredFields) => {
1375
- const otherFields = allOneOfFields.filter((field) => !requiredFields.includes(field));
1376
- return {
1377
- required: [...requiredFields],
1378
- ...(otherFields.length > 0
1379
- ? {
1380
- not: { anyOf: otherFields.map((field) => ({ required: [field] })) },
1381
- }
1382
- : {}),
1383
- ...(action === "history-repair" && requiredFields.includes("all")
1384
- ? { properties: { all: { const: true } } }
1385
- : action === "claim" && requiredFields.includes("next")
1386
- ? { properties: { next: { const: true } } }
1387
- : {}),
1388
- };
1389
- });
1390
- }
1391
- /** Build the consolidated `allOf` constraint list for an action's contract, appending branches in a fixed order — conditional-required (`if`/`then`), then dependent any-of-required, then mutually-exclusive (`not`/`required`) — so a given contract always serializes to a byte-identical schema. Returns an empty array when the contract declares none of these constraints, letting the caller omit the `allOf` key entirely. */
1392
- function buildActionScopedAllOf(contract) {
1393
- const allOf = [];
1394
- if (contract.conditionalRequired && contract.conditionalRequired.length > 0) {
1395
- for (const entry of contract.conditionalRequired) {
1396
- allOf.push({
1397
- if: {
1398
- properties: {
1399
- [entry.property]: { const: entry.value },
1400
- },
1401
- required: [entry.property],
1402
- },
1403
- // eslint-disable-next-line unicorn/no-thenable -- JSON Schema conditional keyword, not a Promise-like object.
1404
- then: {
1405
- required: entry.required,
1406
- },
1407
- });
1408
- }
1409
- }
1410
- if (contract.dependentAnyOfRequired &&
1411
- contract.dependentAnyOfRequired.length > 0) {
1412
- for (const entry of contract.dependentAnyOfRequired) {
1413
- allOf.push({
1414
- if: { required: [entry.property] },
1415
- // eslint-disable-next-line unicorn/no-thenable -- JSON Schema conditional keyword, not a Promise-like object.
1416
- then: {
1417
- anyOf: entry.anyOfRequired.map((requiredFields) => ({
1418
- required: [...requiredFields],
1419
- })),
1420
- },
1421
- });
1422
- }
1423
- }
1424
- if (contract.mutuallyExclusive && contract.mutuallyExclusive.length > 0) {
1425
- for (const group of contract.mutuallyExclusive) {
1426
- allOf.push({ not: { required: toSchemaKeyList(group) } });
1427
- }
1428
- }
1429
- if (contract.mutuallyExclusiveWhen &&
1430
- contract.mutuallyExclusiveWhen.length > 0) {
1431
- for (const group of contract.mutuallyExclusiveWhen) {
1432
- allOf.push({
1433
- not: {
1434
- allOf: group.map((condition) => ({
1435
- properties: { [condition.property]: condition.schema },
1436
- required: [condition.property],
1437
- })),
1438
- },
1439
- });
1440
- }
1441
- }
1442
- return allOf;
1443
- }
1444
- /**
1445
- * Return the complete allowed parameter-key set for one pm action — the fixed
1446
- * `action` selector, global transport parameters, mutation projection keys,
1447
- * and the action contract's required and optional keys — or `undefined` for
1448
- * an action the contract tables do not describe (extension- and package-owned
1449
- * actions accept arbitrary passthrough keys by design). This is the single
1450
- * source of truth shared by the strict action-scoped schema builder and the
1451
- * MCP server's unknown-option detection.
1452
- */
1453
- export function pmToolActionParameterKeys(action) {
1454
- if (!Object.prototype.hasOwnProperty.call(PM_TOOL_ACTION_SCHEMA_CONTRACTS, action)) {
1455
- return undefined;
1456
- }
1457
- const contract = PM_TOOL_ACTION_SCHEMA_CONTRACTS[action];
1458
- const mutationParameterKeys = PM_TOOL_ACTION_MUTATION_PARAMETER_KEYS[action] ?? [];
1459
- return toSchemaKeyList([
1460
- "action",
1461
- ...PM_TOOL_GLOBAL_PARAMETER_KEYS,
1462
- ...(resolveReadOutputSurface(action) !== undefined
1463
- ? PM_TOOL_READ_OUTPUT_PARAMETER_KEYS
1464
- : []),
1465
- ...mutationParameterKeys,
1466
- ...(contract.required ?? []),
1467
- ...(contract.optional ?? []),
1468
- ]);
1469
- }
1470
- /**
1471
- * Return every key the runtime consumes from a nested MCP `options` object.
1472
- * Canonical action parameters remain the baseline; this adds only the
1473
- * action-scoped compatibility grammar that is intentionally normalized before
1474
- * dispatch (bulk list/update wrappers, legacy bulk aliases, and managed
1475
- * extension/package scope aliases). Keeping these keys beside the strict
1476
- * contracts prevents typo warnings from describing valid compatibility input
1477
- * as a no-op without weakening detection on unrelated actions.
1478
- */
1479
- export function pmToolActionNestedOptionKeys(action) {
1480
- const parameterKeys = pmToolActionParameterKeys(action);
1481
- if (parameterKeys === undefined)
1482
- return undefined;
1483
- return toSchemaKeyList([
1484
- ...parameterKeys,
1485
- ...(PM_TOOL_ACTION_NESTED_OPTION_COMPATIBILITY_KEYS[action] ?? []),
1486
- ]);
1487
- }
1488
- function buildActionScopedToolSchema(action) {
1489
- const contract = PM_TOOL_ACTION_SCHEMA_CONTRACTS[action];
1490
- const required = toSchemaKeyList(contract.required ?? []);
1491
- const allowedKeys = pmToolActionParameterKeys(action);
1492
- const schema = {
1493
- type: "object",
1494
- additionalProperties: false,
1495
- required: ["action", ...required],
1496
- title: `pm action "${action}" parameters`,
1497
- properties: buildActionScopedSchemaProperties(action, allowedKeys),
1498
- };
1499
- if (contract.anyOfRequired && contract.anyOfRequired.length > 0) {
1500
- schema.anyOf = contract.anyOfRequired.map((requiredFields) => ({
1501
- required: [...requiredFields],
1502
- }));
1503
- }
1504
- if (contract.oneOfRequired && contract.oneOfRequired.length > 0) {
1505
- schema.oneOf = buildOneOfSchemaEntries(action, contract.oneOfRequired);
1506
- }
1507
- const allOf = buildActionScopedAllOf(contract);
1508
- if (allOf.length > 0) {
1509
- schema.allOf = allOf;
1510
- }
1511
- return schema;
1512
- }
1513
- /**
1514
- * Build a narrow MCP tool schema from the canonical action contract.
1515
- *
1516
- * The action selector is fixed by the narrow tool and therefore removed. The
1517
- * resulting flat camelCase properties remain the same definitions used by
1518
- * `PM_TOOL_PARAMETERS_SCHEMA`, eliminating a hand-maintained MCP schema table.
1519
- */
1520
- export function buildPmActionToolInputSchema(action, options = {}) {
1521
- const actionSchema = buildActionScopedToolSchema(action);
1522
- const actionProperties = {
1523
- ...actionSchema.properties,
1524
- };
1525
- delete actionProperties.action;
1526
- const conditionalBranches = [
1527
- ...(actionSchema.anyOf ??
1528
- []),
1529
- ...(actionSchema.oneOf ??
1530
- []),
1531
- ];
1532
- const required = (options.required ?? actionSchema.required.map(String)).filter((key) => {
1533
- if (key === "action")
1534
- return false;
1535
- if (options.required === undefined)
1536
- return true;
1537
- return !conditionalBranches.some((branch) => branch.required?.map(String).includes(key));
1538
- });
1539
- const schema = {
1540
- type: "object",
1541
- additionalProperties: options.additionalProperties ?? true,
1542
- properties: {
1543
- ...actionProperties,
1544
- options: {
1545
- type: "object",
1546
- additionalProperties: true,
1547
- description: "Advanced command options forwarded to the selected pm action.",
1548
- },
1549
- ...options.properties,
1550
- },
1551
- required,
1552
- };
1553
- if (actionSchema.anyOf !== undefined)
1554
- schema.anyOf = actionSchema.anyOf;
1555
- if (actionSchema.oneOf !== undefined)
1556
- schema.oneOf = actionSchema.oneOf;
1557
- if (actionSchema.allOf !== undefined)
1558
- schema.allOf = actionSchema.allOf;
1559
- return schema;
1560
- }
1561
- // Building the full MCP tool-parameter schemas (one variant per action) is only
1562
- // needed by the MCP server, the `pm contracts` command, and SDK consumers — never
1563
- // on the hot CLI path that imports this module for flag contracts. Wrap them in a
1564
- // memoized lazy Proxy so the build is deferred until first property access and the
1565
- // object API (`.type`, `.oneOf`, spread, JSON.stringify) stays identical.
1566
- function createLazyContractSchema(build) {
1567
- let value;
1568
- const resolve = () => (value ??= build());
1569
- return new Proxy({}, {
1570
- get: (_target, prop) => resolve()[prop],
1571
- has: (_target, prop) => prop in resolve(),
1572
- ownKeys: () => Reflect.ownKeys(resolve()),
1573
- getOwnPropertyDescriptor: (_target, prop) => {
1574
- const descriptor = Reflect.getOwnPropertyDescriptor(resolve(), prop);
1575
- if (descriptor) {
1576
- descriptor.configurable = true;
1577
- }
1578
- return descriptor;
1579
- },
1580
- });
1581
- }
1582
- /** Canonical version of the action-scoped strict MCP tool-parameters schema (`PM_TOOL_PARAMETERS_SCHEMA`). Exported as the single source of truth so the MCP server, the `pm contracts` command, SDK consumers, and contract tests bind to one version constant. Bump the patch/minor for additive, backward-compatible schema changes; bump the MAJOR for breaking changes — the major also drives the `$id` `tool-parameters-v{major}` slug, so the two never drift. */
1583
- export const PM_TOOL_PARAMETERS_SCHEMA_VERSION = "4.14.0";
1584
- /**
1585
- * Major component of {@link PM_TOOL_PARAMETERS_SCHEMA_VERSION}, used to build the
1586
- * schema `$id` slug so a breaking version bump renames the document in lockstep.
1587
- */
1588
- export const PM_TOOL_PARAMETERS_SCHEMA_MAJOR = PM_TOOL_PARAMETERS_SCHEMA_VERSION.split(".")[0];
1589
- /** Version of the provider-compatible flat tool-parameters schema (`PM_PROVIDER_TOOL_PARAMETERS_SCHEMA`). Tracked separately from the strict schema because the flat projection evolves independently. */
1590
- export const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION = "1.7.0";
1591
- /** Public contract for pm tool parameters schema, shared by SDK and presentation-layer consumers. */
1592
- export const PM_TOOL_PARAMETERS_SCHEMA = createLazyContractSchema(() => ({
1593
- $schema: "https://json-schema.org/draft/2020-12/schema",
1594
- $id: `https://schema.unbrained.dev/pm-cli/tool-parameters-v${PM_TOOL_PARAMETERS_SCHEMA_MAJOR}.schema.json`,
1595
- title: "pm-cli tool parameters (action-scoped strict schema)",
1596
- "x-schema-version": PM_TOOL_PARAMETERS_SCHEMA_VERSION,
1597
- type: "object",
1598
- oneOf: PM_TOOL_ACTIONS.map((action) => buildActionScopedToolSchema(action)),
1599
- }));
1600
- function toProviderCompatibleParameterDefinition(key, definition) {
1601
- const decorated = decorateToolParameterDefinition(key, definition);
1602
- if (typeof decorated.type === "string") {
1603
- return decorated;
1604
- }
1605
- const anyOf = Array.isArray(decorated.anyOf)
1606
- ? decorated.anyOf
1607
- : [];
1608
- const firstTypedVariant = anyOf.find((variant) => typeof variant.type === "string");
1609
- if (firstTypedVariant) {
1610
- const { anyOf: _anyOf, ...rest } = decorated;
1611
- // Spread the whole typed variant (type plus any enum/minimum/maximum/pattern
1612
- // constraints) so the flat provider schema keeps the variant's validation,
1613
- // then let the decorated top-level fields (description, examples) win.
1614
- return {
1615
- ...firstTypedVariant,
1616
- ...rest,
1617
- };
1618
- }
1619
- const { anyOf: _anyOf, ...rest } = decorated;
1620
- return {
1621
- ...rest,
1622
- type: "string",
1623
- };
1624
- }
1625
- function buildProviderCompatibleToolSchema() {
1626
- const properties = {
1627
- action: {
1628
- type: "string",
1629
- description: PM_TOOL_PARAMETER_METADATA.action?.description ??
1630
- "Tool action to execute.",
1631
- },
1632
- options: {
1633
- type: "object",
1634
- additionalProperties: true,
1635
- description: "Advanced command options object forwarded to the selected pm action.",
1636
- },
1637
- };
1638
- for (const key of Object.keys(PM_TOOL_PARAMETER_PROPERTIES).sort()) {
1639
- properties[key] = toProviderCompatibleParameterDefinition(key, PM_TOOL_PARAMETER_PROPERTIES[key]);
1640
- }
1641
- return {
1642
- title: "pm-cli tool parameters (provider-compatible flat schema)",
1643
- "x-schema-version": PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,
1644
- type: "object",
1645
- additionalProperties: false,
1646
- required: ["action"],
1647
- properties,
1648
- };
1649
- }
1650
- /** Public contract for pm provider tool parameters schema, shared by SDK and presentation-layer consumers. */
1651
- export const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA = createLazyContractSchema(buildProviderCompatibleToolSchema);
1652
- /** Public contract for test only cli contracts, shared by SDK and presentation-layer consumers. */
1653
- export const _testOnlyCliContracts = {
1654
- buildActionScopedToolSchema,
1655
- buildProviderCompatibleToolSchema,
1656
- decorateActionScopedToolParameterDefinition,
1657
- decorateToolParameterDefinition,
1658
- toolActionSchemaContracts: PM_TOOL_ACTION_SCHEMA_CONTRACTS,
1659
- toolParameterMetadata: PM_TOOL_PARAMETER_METADATA,
1660
- toProviderCompatibleParameterDefinition,
1661
- toUniqueFlagContracts,
1662
- withFlagAliasMetadata,
1663
- };
1
+ !(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]="75c2f9b6-7145-58d8-9db0-58ba696bc6ab")}catch(e2){}})();import{normalizeUniqueStringList}from"./string-lists.js";import{PM_TOOL_ACTIONS}from"./enum-contracts.js";import{TOOL_CREATE_OPTION_CONTRACTS,TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_OPTION_CONTRACTS,TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,TOOL_CONTEXT_OPTION_CONTRACTS,TOOL_ACTIVITY_OPTION_CONTRACTS,TOOL_LIST_FILTER_OPTION_CONTRACTS,TOOL_AGGREGATE_OPTION_CONTRACTS,TOOL_SEARCH_FILTER_OPTION_CONTRACTS,TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS}from"./tool-option-contracts.js";import{PM_TOOL_PARAMETER_PROPERTIES,PM_TOOL_PARAMETER_METADATA,PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES,PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA,PLAN_ACTION_PARAMETER_PROPERTIES,PLAN_ACTION_PARAMETER_METADATA}from"./tool-parameter-tables.js";import{toUniqueFlagContracts,withFlagAliasMetadata}from"./flag-contracts.js";import{resolveReadOutputSurface}from"../read-output-contracts.js";const PM_TOOL_GLOBAL_PARAMETER_KEYS=["json","quiet","profile","noExtensions","noPager","tokenAccounting","path","pmExecutable","timeoutMs"];const PM_TOOL_READ_OUTPUT_PARAMETER_KEYS=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor","outputRowContract"];const PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES=new Set(["action","cwd","options",...Object.keys(PM_TOOL_PARAMETER_PROPERTIES).filter(property=>property!=="severity")]);function resolvePmToolCustomFieldCollision(field){const normalized=field.trim().toLowerCase();let property="";for(let index=0;index<normalized.length;index+=1){const character=normalized[index];if(character!=="-"&&character!=="_"){property+=character;continue}let nextIndex=index+1;while(normalized[nextIndex]==="-"||normalized[nextIndex]==="_"){nextIndex+=1}const nextCharacter=normalized[nextIndex];if(nextCharacter!==void 0&&(nextCharacter>="a"&&nextCharacter<="z"||nextCharacter>="0"&&nextCharacter<="9")){property+=nextCharacter.toUpperCase();index=nextIndex;continue}property+=normalized.slice(index,nextIndex);index=nextIndex-1}return PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES.has(property)?{field,property,owner:"mcp_tool_input",nested_path:`options.${property}`}:void 0}const PM_TOOL_ACTION_MUTATION_PARAMETER_KEYS={create:["fullChangedFields","idOnly"],copy:["fullChangedFields","idOnly"],update:["fullChangedFields","idOnly"],"item-reopen":["fullChangedFields","idOnly"],close:["fullChangedFields","idOnly"],claim:["fullChangedFields","idOnly"],restore:["fullChangedFields","idOnly"],append:["fullChangedFields"],"update-many":["fullChangedFields"],"close-many":["fullChangedFields"],assurance:["fullChangedFields","idOnly"]};const PLAN_CREATE_METADATA_PARAMETER_KEYS=["createMode","status","deadline","estimate","acceptanceCriteria","definitionOfReady","order","rank","goal","objective","value","impact","outcome","whyNow","assignee","reviewer","risk","confidence","sprint","release","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact","comment","note","learning","reminder","event","typeOption"];const PM_TOOL_ACTION_NESTED_OPTION_COMPATIBILITY_KEYS=Object.freeze({"close-many":["list","expected_result","expected","actual_result","actual","validate_close","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],"update-many":["list","update","dry_run","checkpoint","no_checkpoint","filterAssignee_filter"],...Object.fromEntries(PM_TOOL_ACTIONS.filter(action=>action==="upgrade"||action==="install"||action==="extension"||action==="package"||action.startsWith("extension-")||action.startsWith("package-")).map(action=>[action,["project","local","global"]]))});function toSchemaKeyList(values){return normalizeUniqueStringList(values)}const CREATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CREATE_OPTION_CONTRACTS.map(entry=>entry.param),...TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),"assignee","closeReason","completedAt"]);const UPDATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),...TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS.map(entry=>entry.param),"force"]);const UPDATE_MANY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),...UPDATE_CONTRACT_PARAMETER_KEYS.filter(key=>key!=="allowMissingParent"&&key!=="completedAt"),"dryRun","rollback","noCheckpoint"]);const CLOSE_MANY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),"reason","completedAt","resolution","expectedResult","actualResult","validateClose","dryRun","rollback","noCheckpoint","author","message","force"]);const CONTEXT_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_CONTEXT_OPTION_CONTRACTS.map(entry=>entry.param),"past","section"]);const ACTIVITY_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_ACTIVITY_OPTION_CONTRACTS.map(entry=>entry.param),"stream"]);const LIST_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_LIST_FILTER_OPTION_CONTRACTS.map(entry=>entry.param),"all","includeBody","noTruncate","strictRead","compact","brief","full"]);const FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS=LIST_CONTRACT_PARAMETER_KEYS.filter(parameter=>parameter!=="all"&&parameter!=="status");const LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS=[[{property:"today",schema:{const:true}},{property:"recent",schema:{const:true}}],[{property:"today",schema:{const:true}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}],[{property:"recent",schema:{const:true}},{property:"updatedAfter",schema:{type:"string",pattern:"\\S"}}]];const CONTRACTS_PROJECTION_MUTUALLY_EXCLUSIVE_GROUPS=[[{property:"summary",schema:{const:true}},{property:"schemaOnly",schema:{const:true}}],[{property:"summary",schema:{const:true}},{property:"flagsOnly",schema:{const:true}}],[{property:"summary",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}],[{property:"schemaOnly",schema:{const:true}},{property:"flagsOnly",schema:{const:true}}],[{property:"schemaOnly",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}],[{property:"flagsOnly",schema:{const:true}},{property:"availabilityOnly",schema:{const:true}}]];const AGGREGATE_CONTRACT_PARAMETER_KEYS=toSchemaKeyList([...TOOL_AGGREGATE_OPTION_CONTRACTS.map(entry=>entry.param),"count","completion","includeUnparented"]);const SEARCH_CONTRACT_PARAMETER_KEYS=toSchemaKeyList(["query","keywords","mode","semantic","hybrid","includeLinked","titleExact","phraseExact","highlight","compact","full",...TOOL_SEARCH_FILTER_OPTION_CONTRACTS.map(entry=>entry.param)]);const NEXT_CONTRACT_PARAMETER_KEYS=toSchemaKeyList(["type","tag","priority","assignee","assigneeFilter","sprint","release","parent","limit","blockedLimit","readyOnly","format","includeDecisions","includeGates","includeContainers","tokenBudget","explainRanking"]);const AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS=["author","message","force"];const CLOSE_ACTION_OPTION_KEYS=["text","reason","closeReason","completedAt","duplicateOf","validateClose","resolution","expectedResult","actualResult"];const LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS=["author","assignee","message","force"];const MANAGED_EXTENSION_PACKAGE_OPTION_KEYS=["dryRun","target","scope","capability","declarative","github","ref","init","install","uninstall","explore","manage","describe","markdown","output","reload","doctor","catalog","list","adopt","adoptAll","activate","deactivate","runtimeProbe","fixManagedState","isolated","ignoreGlobal","detail","trace","watch","strictExit","failOnWarn"];function managedLifecycleSchemaContracts(prefix){return{[`${prefix}-init`]:{required:["target"],optional:["scope","capability",...prefix==="package"?["declarative"]:[]]},[`${prefix}-install`]:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},[`${prefix}-uninstall`]:{required:["target"],optional:["scope"]},[`${prefix}-explore`]:{optional:["scope"]},[`${prefix}-manage`]:{optional:["scope","runtimeProbe","fixManagedState"]},[`${prefix}-describe`]:{optional:["target","scope","markdown","output"]},[`${prefix}-reload`]:{optional:["scope","watch"]},[`${prefix}-doctor`]:{optional:["scope","detail","trace","fixManagedState","isolated","ignoreGlobal","strictExit","failOnWarn"]},[`${prefix}-catalog`]:{optional:["scope","fields"]},[`${prefix}-adopt`]:{required:["target"],optional:["scope","github","ref"]},[`${prefix}-adopt-all`]:{optional:["scope"]},[`${prefix}-activate`]:{required:["target"],optional:["scope"]},[`${prefix}-deactivate`]:{required:["target"],optional:["scope"]},[prefix]:{optional:MANAGED_EXTENSION_PACKAGE_OPTION_KEYS,dependentAnyOfRequired:[{property:"dryRun",value:true,anyOfRequired:[["install","target"],["install","github"]]}],mutuallyExclusiveWhen:[[{property:"dryRun",schema:{const:true}},{property:"install",schema:{const:false}}]]}}}const SCHEDULING_ACTION_SCHEMA_CONTRACT={required:["title"],optional:["start","duration","end","location","timezone","allDay","parent","allowMissingParent","tags","priority","body","description","author","message"]};const UPGRADE_ACTION_SCHEMA_CONTRACT={optional:["target","scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"]};const PM_TOOL_ACTION_SCHEMA_CONTRACTS={init:{optional:["prefix","idPrefix","workspace","preset","typePreset","defaults","author","agentGuidance","withPackages","mergeFence","force","verbose"]},config:{required:["scope","configAction"],optional:["key","value","criterion","clearCriteria","format","policy"]},...managedLifecycleSchemaContracts("extension"),...managedLifecycleSchemaContracts("package"),"package-upgrade":UPGRADE_ACTION_SCHEMA_CONTRACT,install:{optional:["target","github","scope","ref","dryRun"],anyOfRequired:[["target"],["github"]]},upgrade:UPGRADE_ACTION_SCHEMA_CONTRACT,create:{required:["title","description","type","status","priority","message"],optional:CREATE_CONTRACT_PARAMETER_KEYS},copy:{required:["id"],optional:["title","author","message","allowDuplicate"]},focus:{optional:["id","clear"],mutuallyExclusive:[["id","clear"]]},list:{optional:LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-all":{optional:LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-draft":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-open":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-in-progress":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-blocked":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-closed":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},"list-canceled":{optional:FIXED_STATUS_LIST_CONTRACT_PARAMETER_KEYS,mutuallyExclusiveWhen:LIST_WINDOW_MUTUALLY_EXCLUSIVE_GROUPS},aggregate:{optional:AGGREGATE_CONTRACT_PARAMETER_KEYS},guide:{optional:["list","format","depth"]},context:{optional:CONTEXT_CONTRACT_PARAMETER_KEYS},ctx:{optional:CONTEXT_CONTRACT_PARAMETER_KEYS},get:{required:["id"],optional:["for","tokenBudget","at","depth","full","fields","tree","treeDepth","format"]},search:{optional:SEARCH_CONTRACT_PARAMETER_KEYS,anyOfRequired:[["query"],["keywords"]]},eval:{optional:["mode","k","failUnder","queries","format"]},events:{optional:["since","type","author","item","limit","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","cursorMode"]},merge:{required:["subcommand"],optional:["dryRun","author","message","force","includeReconciled","artifact","basePath","oursPath","theirsPath","output","outputPath","itemPath","prefer"]},workspace:{required:["subcommand"],optional:["snapshotAction","name","target","dryRun","force","author","message","lockTtlSeconds","lockWaitMs"],conditionalRequired:[{property:"subcommand",value:"snapshot",required:["snapshotAction"]}]},meet:SCHEDULING_ACTION_SCHEMA_CONTRACT,event:SCHEDULING_ACTION_SCHEMA_CONTRACT,remind:{required:["title"],optional:["at","text","parent","allowMissingParent","tags","priority","body","description","author","message"]},next:{optional:[...NEXT_CONTRACT_PARAMETER_KEYS,"for"]},reindex:{optional:["mode","progress"]},history:{required:["id"],optional:["limit","compact","full","provenance","provenanceSummary","harness","agentInstance","provenanceFilter","diff","verify","field","strictExit","failOnWarn","format"]},"history-redact":{required:["id"],optional:["literal","regex","replacement","dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],anyOfRequired:[["literal"],["regex"]]},"history-repair":{optional:["id","all","dryRun","normalizeProvenance","salvageTail",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],oneOfRequired:[["id"],["all"]],mutuallyExclusiveWhen:[[{property:"salvageTail",schema:{const:true}},{property:"all",schema:{const:true}}],[{property:"salvageTail",schema:{const:true}},{property:"normalizeProvenance",schema:{const:true}}]]},"history-author-acknowledge":{optional:["historyEvent","allActionable","dryRun","planFingerprint","limit","attributedAuthor","reviewer","reason"],oneOfRequired:[["historyEvent"],["allActionable"]]},"history-compact":{optional:["id","before","ids","allOver","closed","allStreams","minEntries","dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},schema:{mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"policy-mode"}},{property:"name",schema:{not:{enum:["advise","refuse"]}}}]],required:["subcommand"],optional:["definition","policy","message","name","description","defaultStatus","folder","alias","role","order","fieldType","commands","cliFlag","required","requiredOnCreate","allowUnset","requiredTypes","typePreset","infer","minCount","apply","to","migrationId","fieldTypeScope","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"policy-put",required:["name","definition"]},{property:"subcommand",value:"policy-remove",required:["name"]},{property:"subcommand",value:"policy-mode",required:["name"]},{property:"subcommand",value:"policy-check",required:["name"]},{property:"subcommand",value:"policy-approve",required:["name","policy"]},{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"show-status",required:["name"]},{property:"subcommand",value:"add-type",required:["name"]},{property:"subcommand",value:"remove-type",required:["name"]},{property:"subcommand",value:"add-status",required:["name"]},{property:"subcommand",value:"remove-status",required:["name"]},{property:"subcommand",value:"add-field",required:["name"]},{property:"subcommand",value:"remove-field",required:["name"]},{property:"subcommand",value:"show-field",required:["name"]},{property:"subcommand",value:"rename-type",required:["name","to"]},{property:"subcommand",value:"rename-field",required:["name","to"]},{property:"subcommand",value:"remap-status",required:["name","to"]},{property:"subcommand",value:"apply-preset",required:["typePreset"]}]},profile:{required:["subcommand"],optional:["name","dryRun","author","force"],conditionalRequired:[{property:"subcommand",value:"show",required:["name"]},{property:"subcommand",value:"apply",required:["name"]},{property:"subcommand",value:"lint",required:["name"]}]},plan:{required:["subcommand"],optional:["id","stepRef","reorderTo","title","description","template","scope","parent","related","blocks","blockedBy","harness","mode","resumeContext","tags","priority",...PLAN_CREATE_METADATA_PARAMETER_KEYS,"body","claim","fromSearch","stepTitle","step","stepBody","stepOwner","stepStatus","stepEvidence","stepBlockedReason","stepReplacement","dependsOn","link","linkKind","linkNote","promoteToItemDep","allowMultipleActive","file","test","doc","decisionText","decision","decisionRationale","decisionEvidence","discoveryText","discovery","validationText","validation","validationCommand","validationExpected","depth","fields","steps","materializeType","materializeParent","materializeTags","field",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},activity:{optional:ACTIVITY_CONTRACT_PARAMETER_KEYS},restore:{required:["id","target"],optional:AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},update:{required:["id"],optional:UPDATE_CONTRACT_PARAMETER_KEYS,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},"update-many":{optional:UPDATE_MANY_CONTRACT_PARAMETER_KEYS,mutuallyExclusive:[["acceptanceCriteria","addAc"],["acceptanceCriteria","removeAc"]]},close:{required:["id"],optional:[...CLOSE_ACTION_OPTION_KEYS,...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},"close-many":{optional:CLOSE_MANY_CONTRACT_PARAMETER_KEYS},delete:{required:["id"],optional:["dryRun",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},append:{required:["id","body"],optional:AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},comments:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},notes:{required:["id"],optional:["text","add","addJson","stdin","edit","delete","limit","since","eventType","includeMeta","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["addJson","add"],["addJson","stdin"],["addJson","file"],["addJson","edit"],["addJson","delete"],["edit","ifAbsent"],["delete","ifAbsent"]]},learnings:{required:["id"],optional:["text","add","stdin","edit","delete","limit","full","ifAbsent",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["edit","ifAbsent"],["delete","ifAbsent"]]},files:{required:[],optional:["id","add","addGlob","remove","migrate","list","addNote","discover","apply","discoveryNote","appendStable","validatePaths","lookupPath","scope","limit","offset","noTruncate","strictRead","explain","lines","decisionDepth",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],anyOfRequired:[["id"],["lookupPath"]],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},docs:{required:["id"],optional:["add","addGlob","remove","migrate","addNote","list","validatePaths",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],dependentAnyOfRequired:[{property:"addNote",anyOfRequired:[["add"],["addGlob"]]}]},deps:{required:["id"],optional:["format","maxDepth","collapse","summary","full","nodeLimit","edgeLimit","tokenBudget","cursor","direction","kind"]},graph:{required:["subcommand"],optional:["id","target","kind","maxDepth","limit","after","direction","maxPaths","sample","exemptIsolate","exemptIsolateType","saveBaseline","rebuild","clear","summary","full"]},test:{required:["id"],optional:["list","add","addJson","remove","removeIndex","run","match","onlyIndex","onlyLast","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","acknowledgeLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext","measure","metricBelow","metricDiff",...AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],mutuallyExclusive:[["acknowledgeLinkedTests","run"],["acknowledgeLinkedTests","background"]]},"test-all":{optional:["status","limit","offset","background","timeout","progress","envSet","envClear","sharedHostSafe","pmContext","overrideLinkedPmContext","workspaceContext","overrideLinkedWorkspaceContext","allowUntrustedLinkedTests","failOnContextMismatch","failOnSkipped","failOnEmptyTestRun","requireAssertionsForPm","checkContext","autoPmContext"]},telemetry:{optional:["subcommand","limit"]},"test-runs-list":{optional:["status","limit"]},"test-runs-status":{required:["runId"]},"test-runs-logs":{required:["runId"],optional:["stream","tail"]},"test-runs-stop":{required:["runId"],optional:["force"]},"test-runs-resume":{required:["runId"],optional:["author"]},stats:{optional:["includeEmpty","storage","metadataCoverage","fieldUtilization","byAssignee","byTag","byPriority","tagPrefix","measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]},duplicates:{optional:["status","since","threshold","limit","exhaustive"]},health:{optional:["strictDirectories","requireMergeDrivers","strictExit","failOnWarn","checkOnly","checkTelemetry","noRefresh","refreshVectors","verboseStaleItems","verboseAuthorEvents","brief","summary","skipVectors","skipIntegrity","skipDrift","full"]},validate:{optional:["checkCompleteness","checkStorageIntegrity","checkMetadata","metadataProfile","checkResolution","checkLifecycle","checkStaleBlockers","dependencyCycleSeverity","parentCycleSeverity","checkFiles","scanMode","includePmInternals","verboseFileLists","verboseDiagnostics","allAffectedIds","strictExit","failOnWarn","fixHints","autoFix","dryRun","fixScope","pruneMissing","checkHistoryDrift","checkCommandReferences","counts","full"]},assurance:{required:["subcommand"],optional:["kind","id","definition","trigger","treeId","gate","limit","dryRun","author","message","preset","owner","apply","enforcement"],conditionalRequired:[{property:"subcommand",value:"list",required:["kind"]},{property:"subcommand",value:"show",required:["kind","id"]},{property:"subcommand",value:"put",required:["kind","id","definition"]},{property:"subcommand",value:"remove",required:["kind","id"]},{property:"subcommand",value:"run",required:["id","trigger"]},{property:"subcommand",value:"apply",required:["preset","owner"]},{property:"subcommand",value:"derive",required:["owner"]},{property:"subcommand",value:"risk",required:["definition"]},{property:"subcommand",value:"lineages",required:["definition"]},{property:"subcommand",value:"promote",required:["id","enforcement"]}],mutuallyExclusiveWhen:[[{property:"subcommand",schema:{const:"risk"}},{property:"definition",schema:{not:{required:["policy","change"]}}}],[{property:"subcommand",schema:{const:"lineages"}},{property:"definition",schema:{anyOf:[{required:["change"]},{not:{required:["policy"]}}]}}]]},gc:{optional:["dryRun","gcScope"]},contracts:{optional:["contractAction","command","summary","schemaOnly","flagsOnly","availabilityOnly","runtimeOnly","activeOnly","full"],mutuallyExclusiveWhen:CONTRACTS_PROJECTION_MUTUALLY_EXCLUSIVE_GROUPS},completion:{required:["shell"],optional:["eagerTags"]},claim:{optional:["id","next","ifAvailable","maxAttempts","includeDecisions",...NEXT_CONTRACT_PARAMETER_KEYS,...LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS],oneOfRequired:[["id"],["next"]]},release:{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"start-task":{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"pause-task":{required:["id"],optional:LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS},"close-task":{required:["id"],optional:["text","validateClose",...LIFECYCLE_AUTHOR_MESSAGE_FORCE_PARAMETER_KEYS]},"item-reopen":{required:["id","reason"],optional:["status","author","message","force"]}};const PM_TOOL_ACTION_PARAMETER_CONTRACTS=Object.freeze(Object.fromEntries(PM_TOOL_ACTIONS.map(action=>[action,PM_TOOL_ACTION_SCHEMA_CONTRACTS[action]])));function fallbackToolParameterDescription(key){return key.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").trim().replace(/^./,value=>value.toUpperCase()).concat(".")}function decorateToolParameterDefinition(key,definition){const baseDefinition=typeof definition==="object"&&definition!==null?{...definition}:{};const metadata=PM_TOOL_PARAMETER_METADATA[key];return{...baseDefinition,description:metadata?.description??fallbackToolParameterDescription(key),...metadata?.examples?{examples:metadata.examples}:{}}}function actionScopedToolParameterMetadata(action,key){if((action==="list"||action.startsWith("list-"))&&key==="all"){return{description:"Return items from every lifecycle status instead of the default active-status set."}}if(action==="plan"&&Object.prototype.hasOwnProperty.call(PLAN_ACTION_PARAMETER_METADATA,key)){return PLAN_ACTION_PARAMETER_METADATA[key]}const actionOverrides=PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA[action];if(actionOverrides&&Object.prototype.hasOwnProperty.call(actionOverrides,key)){return actionOverrides[key]}return PM_TOOL_PARAMETER_METADATA[key]}function decorateActionScopedToolParameterDefinition(action,key,definition){const baseDefinition=typeof definition==="object"&&definition!==null?{...definition}:{};const metadata=actionScopedToolParameterMetadata(action,key);return{...baseDefinition,description:metadata?.description??fallbackToolParameterDescription(key),...metadata?.examples?{examples:metadata.examples}:{}}}function actionScopedToolParameterDefinition(action,key){const actionProperties=PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES[action];if(actionProperties&&Object.prototype.hasOwnProperty.call(actionProperties,key)){return actionProperties[key]}if(action==="plan"&&Object.prototype.hasOwnProperty.call(PLAN_ACTION_PARAMETER_PROPERTIES,key)){return PLAN_ACTION_PARAMETER_PROPERTIES[key]}if((action==="get"||action==="history"||action==="search")&&key==="format"){return{type:"string",enum:["json","toon"]}}return PM_TOOL_PARAMETER_PROPERTIES[key]}function buildActionScopedSchemaProperties(action,allowedKeys){const properties={action:{const:action,description:PM_TOOL_PARAMETER_METADATA.action?.description??"Tool action to execute."}};for(const key of allowedKeys){if(key==="action"){continue}const definition=actionScopedToolParameterDefinition(action,key);if(definition){properties[key]=decorateActionScopedToolParameterDefinition(action,key,definition)}}return properties}function buildOneOfSchemaEntries(action,oneOfRequiredGroups){const allOneOfFields=oneOfRequiredGroups.flat();return oneOfRequiredGroups.map(requiredFields=>{const otherFields=allOneOfFields.filter(field=>!requiredFields.includes(field));return{required:[...requiredFields],...otherFields.length>0?{not:{anyOf:otherFields.map(field=>({required:[field]}))}}:{},...action==="history-repair"&&requiredFields.includes("all")?{properties:{all:{const:true}}}:action==="claim"&&requiredFields.includes("next")?{properties:{next:{const:true}}}:{}}})}function schemaPropertyCondition(property,value){return{...value===void 0?{}:{properties:{[property]:{const:value}}},required:[property]}}function buildActionScopedAllOf(contract){const allOf=[];if(contract.conditionalRequired&&contract.conditionalRequired.length>0){for(const entry of contract.conditionalRequired){allOf.push({if:schemaPropertyCondition(entry.property,entry.value),then:{required:entry.required}})}}if(contract.dependentAnyOfRequired&&contract.dependentAnyOfRequired.length>0){for(const entry of contract.dependentAnyOfRequired){allOf.push({if:schemaPropertyCondition(entry.property,entry.value),then:{anyOf:entry.anyOfRequired.map(requiredFields=>({required:[...requiredFields]}))}})}}if(contract.mutuallyExclusive&&contract.mutuallyExclusive.length>0){for(const group of contract.mutuallyExclusive){allOf.push({not:{required:toSchemaKeyList(group)}})}}if(contract.mutuallyExclusiveWhen&&contract.mutuallyExclusiveWhen.length>0){for(const group of contract.mutuallyExclusiveWhen){allOf.push({not:{allOf:group.map(condition=>({properties:{[condition.property]:condition.schema},required:[condition.property]}))}})}}return allOf}function pmToolActionParameterKeys(action){if(!Object.prototype.hasOwnProperty.call(PM_TOOL_ACTION_SCHEMA_CONTRACTS,action)){return void 0}const contract=PM_TOOL_ACTION_SCHEMA_CONTRACTS[action];const mutationParameterKeys=PM_TOOL_ACTION_MUTATION_PARAMETER_KEYS[action]??[];return toSchemaKeyList(["action",...PM_TOOL_GLOBAL_PARAMETER_KEYS,...resolveReadOutputSurface(action)!==void 0?PM_TOOL_READ_OUTPUT_PARAMETER_KEYS:[],...mutationParameterKeys,...contract.required??[],...contract.optional??[]])}function pmToolActionNestedOptionKeys(action){const parameterKeys=pmToolActionParameterKeys(action);if(parameterKeys===void 0)return void 0;return toSchemaKeyList([...parameterKeys,...PM_TOOL_ACTION_NESTED_OPTION_COMPATIBILITY_KEYS[action]??[]])}function buildActionScopedToolSchema(action){const contract=PM_TOOL_ACTION_SCHEMA_CONTRACTS[action];const required=toSchemaKeyList(contract.required??[]);const allowedKeys=pmToolActionParameterKeys(action);const schema={type:"object",additionalProperties:false,required:["action",...required],title:`pm action "${action}" parameters`,properties:buildActionScopedSchemaProperties(action,allowedKeys)};if(contract.anyOfRequired&&contract.anyOfRequired.length>0){schema.anyOf=contract.anyOfRequired.map(requiredFields=>({required:[...requiredFields]}))}if(contract.oneOfRequired&&contract.oneOfRequired.length>0){schema.oneOf=buildOneOfSchemaEntries(action,contract.oneOfRequired)}const allOf=buildActionScopedAllOf(contract);if(allOf.length>0){schema.allOf=allOf}return schema}function buildPmActionToolInputSchema(action,options={}){const actionSchema=buildActionScopedToolSchema(action);const actionProperties={...actionSchema.properties};delete actionProperties.action;const conditionalBranches=[...actionSchema.anyOf??[],...actionSchema.oneOf??[]];const required=(options.required??actionSchema.required.map(String)).filter(key=>{if(key==="action")return false;if(options.required===void 0)return true;return!conditionalBranches.some(branch=>branch.required?.map(String).includes(key))});const schema={type:"object",additionalProperties:options.additionalProperties??true,properties:{...actionProperties,options:{type:"object",additionalProperties:true,description:"Advanced command options forwarded to the selected pm action."},...options.properties},required};if(actionSchema.anyOf!==void 0)schema.anyOf=actionSchema.anyOf;if(actionSchema.oneOf!==void 0)schema.oneOf=actionSchema.oneOf;if(actionSchema.allOf!==void 0)schema.allOf=actionSchema.allOf;return schema}function createLazyContractSchema(build){let value;const resolve=()=>value??=build();return new Proxy({},{get:(_target,prop)=>resolve()[prop],has:(_target,prop)=>prop in resolve(),ownKeys:()=>Reflect.ownKeys(resolve()),getOwnPropertyDescriptor:(_target,prop)=>{const descriptor=Reflect.getOwnPropertyDescriptor(resolve(),prop);if(descriptor){descriptor.configurable=true}return descriptor}})}const PM_TOOL_PARAMETERS_SCHEMA_VERSION="4.16.0";const PM_TOOL_PARAMETERS_SCHEMA_MAJOR=PM_TOOL_PARAMETERS_SCHEMA_VERSION.split(".")[0];const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION="1.7.0";const PM_TOOL_PARAMETERS_SCHEMA=createLazyContractSchema(()=>({$schema:"https://json-schema.org/draft/2020-12/schema",$id:`https://schema.unbrained.dev/pm-cli/tool-parameters-v${PM_TOOL_PARAMETERS_SCHEMA_MAJOR}.schema.json`,title:"pm-cli tool parameters (action-scoped strict schema)","x-schema-version":PM_TOOL_PARAMETERS_SCHEMA_VERSION,type:"object",oneOf:PM_TOOL_ACTIONS.map(action=>buildActionScopedToolSchema(action))}));function toProviderCompatibleParameterDefinition(key,definition){const decorated=decorateToolParameterDefinition(key,definition);if(typeof decorated.type==="string"){return decorated}const anyOf=Array.isArray(decorated.anyOf)?decorated.anyOf:[];const firstTypedVariant=anyOf.find(variant=>typeof variant.type==="string");if(firstTypedVariant){const{anyOf:_anyOf2,...rest2}=decorated;return{...firstTypedVariant,...rest2}}const{anyOf:_anyOf,...rest}=decorated;return{...rest,type:"string"}}function buildProviderCompatibleToolSchema(){const properties={action:{type:"string",description:PM_TOOL_PARAMETER_METADATA.action?.description??"Tool action to execute."},options:{type:"object",additionalProperties:true,description:"Advanced command options object forwarded to the selected pm action."}};for(const key of Object.keys(PM_TOOL_PARAMETER_PROPERTIES).sort()){properties[key]=toProviderCompatibleParameterDefinition(key,PM_TOOL_PARAMETER_PROPERTIES[key])}return{title:"pm-cli tool parameters (provider-compatible flat schema)","x-schema-version":PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,type:"object",additionalProperties:false,required:["action"],properties}}const PM_PROVIDER_TOOL_PARAMETERS_SCHEMA=createLazyContractSchema(buildProviderCompatibleToolSchema);const _testOnlyCliContracts={buildActionScopedToolSchema,buildProviderCompatibleToolSchema,decorateActionScopedToolParameterDefinition,decorateToolParameterDefinition,toolActionSchemaContracts:PM_TOOL_ACTION_SCHEMA_CONTRACTS,toolParameterMetadata:PM_TOOL_PARAMETER_METADATA,toProviderCompatibleParameterDefinition,toUniqueFlagContracts,withFlagAliasMetadata};export{CLOSE_ACTION_OPTION_KEYS,PLAN_CREATE_METADATA_PARAMETER_KEYS,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_ACTION_PARAMETER_CONTRACTS,PM_TOOL_PARAMETERS_SCHEMA,PM_TOOL_PARAMETERS_SCHEMA_MAJOR,PM_TOOL_PARAMETERS_SCHEMA_VERSION,PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,_testOnlyCliContracts,buildPmActionToolInputSchema,pmToolActionNestedOptionKeys,pmToolActionParameterKeys,resolvePmToolCustomFieldCollision};
1664
2
  //# sourceMappingURL=tool-schema.js.map
1665
- //# debugId=e72f4ab4-5bf7-53fb-a3a3-174c4064f6a4