@unbrained/pm-cli 2026.8.22 → 2026.8.24

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 (229) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +42 -1
  3. package/dist/cli/description-stdin.js +5 -4
  4. package/dist/cli/error-guidance.d.ts +13 -0
  5. package/dist/cli/error-guidance.js +62 -6
  6. package/dist/cli/extension-command-help.d.ts +5 -0
  7. package/dist/cli/extension-command-help.js +6 -2
  8. package/dist/cli/help-content.d.ts +5 -0
  9. package/dist/cli/help-content.js +56 -3
  10. package/dist/cli/help-json-payload.d.ts +5 -2
  11. package/dist/cli/help-json-payload.js +57 -17
  12. package/dist/cli/main.d.ts +3 -0
  13. package/dist/cli/main.js +39 -5
  14. package/dist/cli/register-annotations.js +5 -5
  15. package/dist/cli/register-mutation.js +77 -31
  16. package/dist/cli/register-operations.d.ts +73 -0
  17. package/dist/cli/register-operations.js +39 -14
  18. package/dist/cli/register-setup.js +3 -3
  19. package/dist/cli/schema-registration-helpers.d.ts +8 -1
  20. package/dist/cli/schema-registration-helpers.js +14 -5
  21. package/dist/cli-bundle/bundle-manifest.json +155 -155
  22. package/dist/cli-bundle/chunks/chunk-AGUL3HUT.js +3 -0
  23. package/dist/cli-bundle/chunks/{chunk-WG4STC36.js → chunk-DJNJBWAQ.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-MYYI3ZOA.js → chunk-I5Q7QSZX.js} +2 -2
  25. package/dist/cli-bundle/chunks/chunk-IW72J5FW.js +2 -0
  26. package/dist/cli-bundle/chunks/{chunk-BWX4SK46.js → chunk-L22NP5MA.js} +66 -66
  27. package/dist/cli-bundle/chunks/chunk-MKE6MD2K.js +36 -0
  28. package/dist/cli-bundle/chunks/{chunk-MZTZQTMS.js → chunk-NXBFO63A.js} +2 -2
  29. package/dist/cli-bundle/chunks/chunk-TEQDR5KI.js +202 -0
  30. package/dist/cli-bundle/chunks/chunk-X7WWQDYQ.js +2 -0
  31. package/dist/cli-bundle/chunks/chunk-YOLLRCLY.js +13 -0
  32. package/dist/cli-bundle/chunks/{chunk-U6GQ4VMV.js → chunk-ZAVCS2GH.js} +4 -4
  33. package/dist/cli-bundle/chunks/{register-list-query-HZKBQNWW.js → register-list-query-37A4P6O4.js} +2 -2
  34. package/dist/cli-bundle/chunks/register-mutation-TBJDHYIT.js +20 -0
  35. package/dist/cli-bundle/chunks/register-operations-WRZNEBUM.js +2 -0
  36. package/dist/cli-bundle/chunks/{register-setup-QK4OTOXN.js → register-setup-H4PDLACD.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-GMYPD4FX.js → chunk-4WP7LNE3.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-6MUTDXMP.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-6Z24ZMU3.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-2ARQGDDW.js → chunk-BFA6KKCI.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-CWCN5RLO.js +26 -0
  42. package/dist/cli-bundle/focused-chunks/chunk-FCTT4CZU.js +5 -0
  43. package/dist/cli-bundle/focused-chunks/chunk-GJR6YEMR.js +156 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-2POVTNLY.js → chunk-IMWTYKII.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-D6RBZEJJ.js → chunk-IZNRRCU3.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-PMGJUFNQ.js → chunk-MNPECIRL.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-A2BC5PQL.js → chunk-O4ZXNJMT.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/chunk-Q63PSLO4.js +2 -0
  49. package/dist/cli-bundle/focused-chunks/chunk-QBP5FSBX.js +4 -0
  50. package/dist/cli-bundle/focused-chunks/{chunk-R6SR45XU.js → chunk-QV5UP27O.js} +48 -47
  51. package/dist/cli-bundle/focused-chunks/chunk-RASVBJX5.js +8 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-E2EWYPY6.js → chunk-RPRLENVA.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/chunk-TOFVXBWA.js +19 -0
  54. package/dist/cli-bundle/focused-chunks/{chunk-6S2MO3Q3.js → chunk-WZLSSGEU.js} +2 -2
  55. package/dist/cli-bundle/main.js +18 -17
  56. package/dist/cli-bundle/sdk-authoring.js +1 -1
  57. package/dist/cli-bundle/sdk-contracts.js +2 -2
  58. package/dist/cli-bundle/sdk-core.js +41 -41
  59. package/dist/cli-bundle/sdk-governance.js +1 -1
  60. package/dist/cli-bundle/sdk-graph.js +1 -1
  61. package/dist/cli-bundle/sdk-merge.js +33 -32
  62. package/dist/cli-bundle/sdk-query.js +1 -1
  63. package/dist/cli-bundle/sdk-runtime.js +1 -1
  64. package/dist/cli-bundle/sdk-testing.js +1 -1
  65. package/dist/cli-bundle/sdk.js +6 -5
  66. package/dist/core/config/nested-settings.js +8 -2
  67. package/dist/core/config/positional-value.d.ts +1 -1
  68. package/dist/core/config/positional-value.js +5 -2
  69. package/dist/core/extensions/command-metadata-contract.d.ts +10 -0
  70. package/dist/core/extensions/command-metadata-contract.js +23 -0
  71. package/dist/core/extensions/command-visibility-tier.js +12 -2
  72. package/dist/core/extensions/extension-types.d.ts +6 -0
  73. package/dist/core/extensions/extension-types.js +2 -2
  74. package/dist/core/extensions/loader.js +4 -3
  75. package/dist/core/history/history.js +3 -3
  76. package/dist/core/io/body-file.js +7 -2
  77. package/dist/core/io/bulk-ids-input.d.ts +24 -0
  78. package/dist/core/io/bulk-ids-input.js +113 -0
  79. package/dist/core/item/item-format.js +66 -12
  80. package/dist/core/item/parse.d.ts +22 -2
  81. package/dist/core/item/parse.js +97 -4
  82. package/dist/core/reproducibility/context.d.ts +4 -0
  83. package/dist/core/reproducibility/context.js +14 -8
  84. package/dist/core/shared/author.d.ts +55 -1
  85. package/dist/core/shared/author.js +333 -16
  86. package/dist/core/shared/constants.js +3 -2
  87. package/dist/core/store/settings-validator.d.ts +1 -0
  88. package/dist/core/store/settings-validator.js +6 -3
  89. package/dist/core/store/settings.js +5 -2
  90. package/dist/mcp/server.d.ts +4 -3
  91. package/dist/mcp/server.js +44 -16
  92. package/dist/sdk/agent/identity-config.d.ts +63 -0
  93. package/dist/sdk/agent/identity-config.js +107 -0
  94. package/dist/sdk/agent/refusal-closure-census.d.ts +66 -0
  95. package/dist/sdk/agent/refusal-closure-census.js +144 -0
  96. package/dist/sdk/agent/refusal-corpus-contracts.d.ts +76 -0
  97. package/dist/sdk/agent/refusal-corpus-contracts.js +194 -0
  98. package/dist/sdk/agent-capability-contracts.d.ts +34 -1
  99. package/dist/sdk/agent-capability-contracts.js +104 -6
  100. package/dist/sdk/annotations.d.ts +2 -0
  101. package/dist/sdk/annotations.js +25 -7
  102. package/dist/sdk/cli-contracts/agent-output-contracts.js +6 -4
  103. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -0
  104. package/dist/sdk/cli-contracts/enum-contracts.js +9 -2
  105. package/dist/sdk/cli-contracts/flag-contracts.js +9 -2
  106. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +4 -4
  107. package/dist/sdk/cli-contracts/registration-helpers.js +5 -2
  108. package/dist/sdk/cli-contracts/tool-parameter-tables.js +58 -2
  109. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  110. package/dist/sdk/cli-contracts/tool-schema.js +14 -3
  111. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +4 -1
  112. package/dist/sdk/cli-contracts/typed-action-inputs.js +2 -2
  113. package/dist/sdk/cli-contracts.d.ts +3 -3
  114. package/dist/sdk/cli-contracts.js +4 -4
  115. package/dist/sdk/comments.js +15 -7
  116. package/dist/sdk/config.d.ts +6 -1
  117. package/dist/sdk/config.js +119 -14
  118. package/dist/sdk/context-intent-contracts.js +4 -2
  119. package/dist/sdk/core-governance.d.ts +1 -1
  120. package/dist/sdk/core-governance.js +3 -3
  121. package/dist/sdk/extension/scaffold.js +11 -5
  122. package/dist/sdk/flag-invocation-contracts.d.ts +2 -0
  123. package/dist/sdk/flag-invocation-contracts.js +30 -3
  124. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +83 -2
  125. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +87 -2
  126. package/dist/sdk/governance/assurance-action.js +30 -10
  127. package/dist/sdk/governance/validate.d.ts +2 -2
  128. package/dist/sdk/governance/validate.js +39 -14
  129. package/dist/sdk/guide-topics.d.ts +0 -5
  130. package/dist/sdk/guide-topics.js +28 -2
  131. package/dist/sdk/history-compact.d.ts +2 -1
  132. package/dist/sdk/history-compact.js +24 -5
  133. package/dist/sdk/history-mcp.js +11 -10
  134. package/dist/sdk/index.d.ts +8 -2
  135. package/dist/sdk/index.js +9 -3
  136. package/dist/sdk/item-transaction.js +19 -12
  137. package/dist/sdk/lifecycle/append.js +4 -4
  138. package/dist/sdk/lifecycle/close-many.js +16 -7
  139. package/dist/sdk/lifecycle/create.js +33 -22
  140. package/dist/sdk/lifecycle/plan.js +24 -6
  141. package/dist/sdk/lifecycle/update-many.js +15 -8
  142. package/dist/sdk/lifecycle/update.d.ts +2 -0
  143. package/dist/sdk/lifecycle/update.js +37 -25
  144. package/dist/sdk/merge/three-way.js +105 -26
  145. package/dist/sdk/read-output-budget.d.ts +21 -0
  146. package/dist/sdk/read-output-budget.js +39 -2
  147. package/dist/sdk/read-output-contracts.d.ts +5 -3
  148. package/dist/sdk/read-output-contracts.js +20 -12
  149. package/dist/sdk/reproducibility/process.d.ts +19 -0
  150. package/dist/sdk/reproducibility/process.js +88 -0
  151. package/dist/sdk/runtime-extended-actions.js +5 -3
  152. package/dist/sdk/runtime-input.d.ts +4 -0
  153. package/dist/sdk/runtime-input.js +98 -23
  154. package/dist/sdk/runtime-primitives.d.ts +3 -2
  155. package/dist/sdk/runtime-primitives.js +5 -4
  156. package/dist/sdk/runtime.js +11 -23
  157. package/dist/sdk/scheduling-shortcuts.js +5 -3
  158. package/dist/sdk/structured-mutations.js +10 -3
  159. package/dist/sdk/test/batch.d.ts +6 -0
  160. package/dist/sdk/test/batch.js +15 -3
  161. package/dist/sdk/test/entry.d.ts +1 -1
  162. package/dist/sdk/test/entry.js +3 -2
  163. package/dist/sdk/test/execution.d.ts +28 -3
  164. package/dist/sdk/test/execution.js +193 -34
  165. package/dist/sdk/test/parsers.d.ts +6 -0
  166. package/dist/sdk/test/parsers.js +21 -2
  167. package/dist/sdk/test/trust.d.ts +33 -0
  168. package/dist/sdk/test/trust.js +207 -0
  169. package/dist/sdk/workspace-contracts.d.ts +3 -0
  170. package/dist/sdk/workspace-contracts.js +3 -2
  171. package/dist/types.d.ts +23 -0
  172. package/dist/types.js +2 -2
  173. package/docs/AGENT_PROVENANCE_ADR.md +41 -5
  174. package/docs/CONFIGURATION.md +4 -0
  175. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +19 -2
  176. package/docs/MERGE_SAFETY.md +15 -1
  177. package/docs/README.md +2 -0
  178. package/docs/READ_OUTPUT_CONTRACTS.md +11 -1
  179. package/docs/RELEASING.md +40 -21
  180. package/docs/REPRODUCIBLE_WORKSPACES.md +42 -8
  181. package/docs/SCRIPTING.md +62 -3
  182. package/docs/SDK.md +17 -0
  183. package/docs/SDK_AGENT_SESSION_CONTEXT.md +6 -4
  184. package/docs/SDK_EVIDENCE_TRACEABILITY.md +1 -1
  185. package/docs/TESTING.md +75 -8
  186. package/docs/agent-task-token-baseline.json +2 -2
  187. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +17 -0
  188. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
  189. package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
  190. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +355 -0
  191. package/marketplace.json +2 -2
  192. package/package.json +2 -2
  193. package/packages/pm-beads/package.json +1 -1
  194. package/packages/pm-calendar/package.json +1 -1
  195. package/packages/pm-command-kit/README.md +9 -11
  196. package/packages/pm-command-kit/extensions/command-kit/index.ts +3 -1
  197. package/packages/pm-command-kit/package.json +1 -1
  198. package/packages/pm-digital-twin/package.json +1 -1
  199. package/packages/pm-governance-audit/package.json +1 -1
  200. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +10 -0
  201. package/packages/pm-guide-shell/package.json +1 -1
  202. package/packages/pm-kanban/package.json +1 -1
  203. package/packages/pm-lifecycle-hooks/package.json +1 -1
  204. package/packages/pm-linked-test-adapters/package.json +1 -1
  205. package/packages/pm-search-advanced/package.json +1 -1
  206. package/packages/pm-templates/package.json +1 -1
  207. package/packages/pm-todos/package.json +1 -1
  208. package/packages/pm-vcs/package.json +1 -1
  209. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  210. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  211. package/scripts/generate-agent-capability-surfaces.mjs +27 -1
  212. package/sdk/public-surface.json +642 -28
  213. package/dist/cli-bundle/chunks/chunk-EMWDM5FI.js +0 -13
  214. package/dist/cli-bundle/chunks/chunk-HYG6LRL4.js +0 -200
  215. package/dist/cli-bundle/chunks/chunk-QI2CT3IX.js +0 -2
  216. package/dist/cli-bundle/chunks/chunk-SMWXHMVB.js +0 -35
  217. package/dist/cli-bundle/chunks/chunk-VMMIL3SI.js +0 -2
  218. package/dist/cli-bundle/chunks/chunk-YBPJAOQQ.js +0 -3
  219. package/dist/cli-bundle/chunks/register-mutation-HTKEEGRD.js +0 -20
  220. package/dist/cli-bundle/chunks/register-operations-6EMRWJJY.js +0 -2
  221. package/dist/cli-bundle/focused-chunks/chunk-2AZT5WXZ.js +0 -2
  222. package/dist/cli-bundle/focused-chunks/chunk-3LKU6PTJ.js +0 -4
  223. package/dist/cli-bundle/focused-chunks/chunk-5SHSBMX2.js +0 -2
  224. package/dist/cli-bundle/focused-chunks/chunk-C4S4A4JJ.js +0 -5
  225. package/dist/cli-bundle/focused-chunks/chunk-L5LDSRO2.js +0 -155
  226. package/dist/cli-bundle/focused-chunks/chunk-MB37AYN6.js +0 -26
  227. package/dist/cli-bundle/focused-chunks/chunk-MCOR37QK.js +0 -2
  228. package/dist/cli-bundle/focused-chunks/chunk-PH2OXXVZ.js +0 -18
  229. package/dist/cli-bundle/focused-chunks/chunk-WZE4LIPW.js +0 -8
@@ -0,0 +1,194 @@
1
+ /**
2
+ * @module sdk/agent/refusal-corpus-contracts
3
+ *
4
+ * Derives executable refusal probes from the public CLI grammar. The corpus is
5
+ * fail-closed: adding a required positional slot or action-dispatching command
6
+ * automatically adds a probe, while an action family without an authoritative
7
+ * value domain throws during contract construction.
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]="2e90ea29-2708-5af8-b390-599be97718e7")}catch(e){}}();
11
+ import { PLAN_SUBCOMMANDS } from "../lifecycle/plan.js";
12
+ import { PROFILE_SUBCOMMANDS } from "../profile.js";
13
+ import { SCHEMA_SUBCOMMANDS } from "../schema.js";
14
+ import { GRAPH_SUBCOMMAND_VALUES, MERGE_SUBCOMMAND_VALUES, } from "../cli-contracts/enum-contracts.js";
15
+ import { PM_COMMAND_DESTINATION_CONTRACTS, PM_COMMAND_POSITIONAL_CONTRACTS, PM_POSITIONAL_ACTION_CONTRACTS, } from "../cli-contracts/grammar-contracts.js";
16
+ import { resolveSubcommandFlagContractsForCommand } from "../cli-contracts/flag-contracts.js";
17
+ const REJECTED_ACTION = "not-a-declared-action";
18
+ function positionalPlaceholder(command, slot) {
19
+ if (command.startsWith("assurance ") && slot.name === "kind") {
20
+ return "measurement";
21
+ }
22
+ switch (slot.value_kind) {
23
+ case "integer":
24
+ return "1";
25
+ case "item_id":
26
+ return "pm-domain";
27
+ case "action":
28
+ throw new Error(`Cannot synthesize a preceding action value for positional slot ${slot.name}.`);
29
+ default:
30
+ return "example";
31
+ }
32
+ }
33
+ function probeSlug(value) {
34
+ return value.replaceAll(/[^a-z0-9]+/gu, "-").replaceAll(/^-|-$/gu, "");
35
+ }
36
+ /**
37
+ * Return one omission probe for every required slot in the declared grammar.
38
+ * Earlier positionals receive deterministic, non-mutating placeholder values.
39
+ */
40
+ export function listPmRequiredArgumentRefusalContracts(contracts = PM_COMMAND_POSITIONAL_CONTRACTS.filter((contract) => PM_COMMAND_DESTINATION_CONTRACTS.some((destination) => destination.command === contract.command &&
41
+ destination.disposition !== "package_owned"))) {
42
+ return contracts
43
+ .flatMap((contract) => contract.slots.flatMap((slot, index) => {
44
+ if (!slot.required)
45
+ return [];
46
+ const commandArguments = contract.command.split(" ");
47
+ const requiredFlagArguments = resolveSubcommandFlagContractsForCommand(contract.command).flatMap((flagContract) => flagContract.required
48
+ ? [
49
+ flagContract.flag,
50
+ ...(flagContract.value_name ? ["example"] : []),
51
+ ]
52
+ : []);
53
+ const isVirtualAction = PM_POSITIONAL_ACTION_CONTRACTS.some((actionContract) => actionContract.command === contract.command);
54
+ return [
55
+ {
56
+ probe_id: `required-argument-${probeSlug(contract.command)}-${probeSlug(slot.name)}`,
57
+ command: contract.command,
58
+ refusal_args: [
59
+ ...commandArguments,
60
+ ...contract.slots
61
+ .slice(0, index)
62
+ .map((priorSlot) => positionalPlaceholder(contract.command, priorSlot)),
63
+ ...requiredFlagArguments,
64
+ ],
65
+ recovery_args: [...commandArguments, "--help"],
66
+ error_code: isVirtualAction && !contract.command.startsWith("assurance ")
67
+ ? "invalid_argument_value"
68
+ : /^extension (?:activate|adopt|deactivate|uninstall)$/u.test(contract.command)
69
+ ? "missing_lifecycle_target"
70
+ : "missing_required_argument",
71
+ missing_argument: slot.name,
72
+ missing_argument_index: index,
73
+ },
74
+ ];
75
+ }))
76
+ .sort((left, right) => left.probe_id.localeCompare(right.probe_id));
77
+ }
78
+ function positionalActionValues(command) {
79
+ switch (command) {
80
+ case "assurance":
81
+ case "workspace snapshot":
82
+ return PM_POSITIONAL_ACTION_CONTRACTS.filter(({ parent }) => parent === command).map(({ action }) => action);
83
+ case "graph":
84
+ return GRAPH_SUBCOMMAND_VALUES;
85
+ case "merge":
86
+ return MERGE_SUBCOMMAND_VALUES;
87
+ case "plan":
88
+ return PLAN_SUBCOMMANDS;
89
+ case "profile":
90
+ return PROFILE_SUBCOMMANDS;
91
+ case "schema":
92
+ return SCHEMA_SUBCOMMANDS;
93
+ default:
94
+ throw new Error(`Required positional action family ${command} has no authoritative value domain.`);
95
+ }
96
+ }
97
+ /** Return one invalid-action probe for every required positional action family. */
98
+ export function listPmSubcommandRefusalContracts(contracts = PM_COMMAND_POSITIONAL_CONTRACTS) {
99
+ return contracts
100
+ .filter(({ slots }) => slots[0]?.required === true && slots[0].value_kind === "action")
101
+ .map(({ command }) => {
102
+ const commandArguments = command.split(" ");
103
+ return {
104
+ probe_id: `unknown-subcommand-${probeSlug(command)}`,
105
+ command,
106
+ refusal_args: [...commandArguments, REJECTED_ACTION],
107
+ recovery_args: [...commandArguments, "--help"],
108
+ error_code: "unknown_subcommand",
109
+ rejected_value: REJECTED_ACTION,
110
+ allowed_values: [...positionalActionValues(command)].sort(),
111
+ };
112
+ })
113
+ .sort((left, right) => left.probe_id.localeCompare(right.probe_id));
114
+ }
115
+ function sameValues(left, right) {
116
+ const sortedRight = [...right].sort();
117
+ return (left.length === right.length &&
118
+ [...left].sort().every((value, index) => value === sortedRight[index]));
119
+ }
120
+ function scoreGrammarRefusalObservation(contract, observation) {
121
+ if (!observation) {
122
+ return [
123
+ {
124
+ code: "refusal_probe_missing",
125
+ probe_id: contract.probe_id,
126
+ detail: `${contract.probe_id} has no runtime observation.`,
127
+ },
128
+ ];
129
+ }
130
+ const findings = [];
131
+ if (observation.error_code !== contract.error_code) {
132
+ findings.push({
133
+ code: "refusal_error_code_mismatch",
134
+ probe_id: contract.probe_id,
135
+ detail: `${contract.probe_id} emitted ${observation.error_code || "<none>"}; expected ${contract.error_code}.`,
136
+ });
137
+ }
138
+ if (observation.exit_code !== 2) {
139
+ findings.push({
140
+ code: "refusal_exit_code_mismatch",
141
+ probe_id: contract.probe_id,
142
+ detail: `${contract.probe_id} exited ${observation.exit_code}; expected usage exit 2.`,
143
+ });
144
+ }
145
+ if ("allowed_values" in contract &&
146
+ !sameValues(observation.allowed_values, contract.allowed_values)) {
147
+ findings.push({
148
+ code: "refusal_allowed_values_mismatch",
149
+ probe_id: contract.probe_id,
150
+ detail: `${contract.probe_id} did not expose its complete action domain.`,
151
+ });
152
+ }
153
+ if (!observation.recovery_succeeded) {
154
+ findings.push({
155
+ code: "refusal_recovery_failed",
156
+ probe_id: contract.probe_id,
157
+ detail: `${contract.probe_id} help recovery did not succeed.`,
158
+ });
159
+ }
160
+ if (observation.refusal_mutated_state) {
161
+ findings.push({
162
+ code: "refusal_mutated_state",
163
+ probe_id: contract.probe_id,
164
+ detail: `${contract.probe_id} changed tracker state while refusing input${observation.mutated_paths?.length ? `: ${observation.mutated_paths.join(", ")}` : "."}`,
165
+ });
166
+ }
167
+ return findings;
168
+ }
169
+ /** Score exact code, exit, domain, state-safety, and recovery closure. */
170
+ export function scorePmGrammarRefusalClosure(contracts, observations) {
171
+ const contractsById = new Map(contracts.map((contract) => [contract.probe_id, contract]));
172
+ const observationsById = new Map(observations.map((observation) => [observation.probe_id, observation]));
173
+ const findings = [
174
+ ...contracts.flatMap((contract) => scoreGrammarRefusalObservation(contract, observationsById.get(contract.probe_id))),
175
+ ...observations
176
+ .filter((observation) => !contractsById.has(observation.probe_id))
177
+ .map((observation) => ({
178
+ code: "unexpected_refusal_probe",
179
+ probe_id: observation.probe_id,
180
+ detail: `${observation.probe_id} has no declared grammar refusal contract.`,
181
+ })),
182
+ ];
183
+ findings.sort((left, right) => left.probe_id.localeCompare(right.probe_id) ||
184
+ left.code.localeCompare(right.code));
185
+ const failedProbeIds = new Set(findings.map(({ probe_id: probeId }) => probeId));
186
+ return {
187
+ ok: findings.length === 0,
188
+ probe_count: contracts.length,
189
+ closed_probe_count: contracts.filter(({ probe_id: probeId }) => !failedProbeIds.has(probeId)).length,
190
+ findings,
191
+ };
192
+ }
193
+ //# sourceMappingURL=refusal-corpus-contracts.js.map
194
+ //# debugId=2e90ea29-2708-5af8-b390-599be97718e7
@@ -1,7 +1,8 @@
1
+ import type { ExtensionCommandCapabilityFamily } from "../core/extensions/command-metadata-contract.js";
1
2
  /** Visibility tiers shared by CLI help, completions, docs, extensions, and MCP. */
2
3
  export type PmCommandVisibilityTier = "core" | "standard" | "full" | "internal";
3
4
  /** Stable capability families shared by every agent-facing command surface. */
4
- export type PmCommandCapabilityFamily = "workspace" | "intake" | "context" | "lifecycle" | "evidence" | "graph" | "quality" | "automation" | "extensions" | "internal";
5
+ export type PmCommandCapabilityFamily = ExtensionCommandCapabilityFamily;
5
6
  /** One command's canonical agent-surface visibility declaration. */
6
7
  export interface PmCommandVisibilityContract {
7
8
  /** Canonical command path. */
@@ -14,6 +15,13 @@ export interface PmCommandCapabilityContract extends PmCommandVisibilityContract
14
15
  /** Exactly one stable capability family used to group the command. */
15
16
  family: PmCommandCapabilityFamily;
16
17
  }
18
+ /** One generated family route shared by guides, skills, and documentation. */
19
+ export interface PmCommandCapabilityGroup {
20
+ /** Stable capability family. */
21
+ family: PmCommandCapabilityFamily;
22
+ /** Non-internal commands owned by the family. */
23
+ commands: readonly string[];
24
+ }
17
25
  /** Resolve one command's stable capability family. */
18
26
  export declare function resolvePmCommandCapabilityFamily(command: string): PmCommandCapabilityFamily;
19
27
  /**
@@ -26,18 +34,39 @@ export declare function resolvePmCommandCapabilityFamily(command: string): PmCom
26
34
  export declare const PM_COMMAND_CAPABILITY_CONTRACTS: readonly PmCommandCapabilityContract[];
27
35
  /** Backward-compatible tier-only projection of the capability contract. */
28
36
  export declare const PM_COMMAND_VISIBILITY_CONTRACTS: readonly PmCommandVisibilityContract[];
37
+ /** Bounded compact-help contract: one conventional terminal screen. */
38
+ export declare const PM_CORE_HELP_BUDGET: Readonly<{
39
+ max_lines: 50;
40
+ max_utf8_bytes: 6000;
41
+ }>;
42
+ /** Root options retained in the compact progressive-disclosure help screen. */
43
+ export declare const PM_CORE_HELP_OPTION_FLAGS: readonly string[];
44
+ /** Measure rendered core help against its line and byte ceilings. */
45
+ export declare function measurePmCoreHelp(text: string): {
46
+ lines: number;
47
+ utf8_bytes: number;
48
+ within_budget: boolean;
49
+ };
29
50
  /** Resolve one command's declared tier; extension commands default to standard. */
30
51
  export declare function resolvePmCommandVisibilityTier(command: string, extensionTier?: PmCommandVisibilityTier): PmCommandVisibilityTier;
31
52
  /** Return commands visible at a requested tier, preserving contract order. */
32
53
  export declare function listPmCommandsForTier(tier: Exclude<PmCommandVisibilityTier, "internal">): string[];
54
+ /** Project an explicit command registry into one visibility tier. */
55
+ export declare function listPmCommandsForTierFromContracts(tier: Exclude<PmCommandVisibilityTier, "internal">, contracts: readonly PmCommandCapabilityContract[]): string[];
33
56
  /** Return commands in one capability family, preserving contract order. */
34
57
  export declare function listPmCommandsForFamily(family: PmCommandCapabilityFamily): string[];
58
+ /** Project an explicit command registry into one capability family. */
59
+ export declare function listPmCommandsForFamilyFromContracts(family: PmCommandCapabilityFamily, contracts: readonly PmCommandCapabilityContract[]): string[];
60
+ /** Group the command registry for progressive-disclosure routing surfaces. */
61
+ export declare function listPmCommandCapabilityGroups(contracts?: readonly PmCommandCapabilityContract[]): PmCommandCapabilityGroup[];
35
62
  /** MCP profile names accepted by the server and embedding hosts. */
36
63
  export type PmMcpToolProfile = "core" | "standard" | "full" | "custom";
37
64
  /** Mapping from one narrow MCP tool to the command contract that tiers it. */
38
65
  export declare const PM_MCP_TOOL_COMMAND_CONTRACTS: Readonly<Record<string, string>>;
39
66
  /** Resolve the tools visible in a named MCP profile from command tiers. */
40
67
  export declare function listPmMcpToolsForProfile(availableTools: readonly string[], profile: Exclude<PmMcpToolProfile, "custom">): string[];
68
+ /** Project an explicit command registry into one MCP tool profile. */
69
+ export declare function listPmMcpToolsForProfileFromContracts(availableTools: readonly string[], profile: Exclude<PmMcpToolProfile, "custom">, contracts: readonly PmCommandCapabilityContract[]): string[];
41
70
  /** Stable MCP resource contract generated from the same agent surface table. */
42
71
  export interface PmMcpResourceContract {
43
72
  /** Stable resource URI. */
@@ -75,3 +104,7 @@ export interface PmMcpPromptContract {
75
104
  export declare const PM_MCP_PROMPT_CONTRACTS: readonly PmMcpPromptContract[];
76
105
  /** Render the generated command visibility reference used by docs drift gates. */
77
106
  export declare function renderPmCommandVisibilityMarkdown(): string;
107
+ /** Render an explicit registry for mutation-sensitivity and host tooling. */
108
+ export declare function renderPmCommandVisibilityMarkdownFromContracts(contracts: readonly PmCommandCapabilityContract[]): string;
109
+ /** Render family routing for generated docs and skill progressive disclosure. */
110
+ export declare function renderPmCapabilityRoutingMarkdown(contracts?: readonly PmCommandCapabilityContract[]): string;
@@ -5,7 +5,7 @@
5
5
  * surfaces from one public SDK contract.
6
6
  */
7
7
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5e77c121-35a2-57d1-9a3e-f33447535c03")}catch(e){}}();
8
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="51e187c6-d48f-59e8-ad23-c72670ade3cc")}catch(e){}}();
9
9
  import { PM_CORE_COMMAND_NAMES } from "./cli-contracts/enum-contracts.js";
10
10
  const CORE_COMMANDS = new Set([
11
11
  "claim",
@@ -14,6 +14,7 @@ const CORE_COMMANDS = new Set([
14
14
  "create",
15
15
  "get",
16
16
  "help",
17
+ "init",
17
18
  "list",
18
19
  "next",
19
20
  "plan",
@@ -167,6 +168,36 @@ export const PM_COMMAND_CAPABILITY_CONTRACTS = Object.freeze([
167
168
  ]);
168
169
  /** Backward-compatible tier-only projection of the capability contract. */
169
170
  export const PM_COMMAND_VISIBILITY_CONTRACTS = PM_COMMAND_CAPABILITY_CONTRACTS;
171
+ /** Bounded compact-help contract: one conventional terminal screen. */
172
+ export const PM_CORE_HELP_BUDGET = Object.freeze({
173
+ max_lines: 50,
174
+ max_utf8_bytes: 6000,
175
+ });
176
+ /** Root options retained in the compact progressive-disclosure help screen. */
177
+ export const PM_CORE_HELP_OPTION_FLAGS = Object.freeze([
178
+ "-V, --version",
179
+ "--json",
180
+ "--output-include <fields>",
181
+ "--output-limit <count>",
182
+ "--output-budget <tokens|unbounded>",
183
+ "--output-cursor <cursor>",
184
+ "--pm-path <dir>",
185
+ "--no-extensions",
186
+ "--no-pager",
187
+ "--explain",
188
+ "-h, --help",
189
+ ]);
190
+ /** Measure rendered core help against its line and byte ceilings. */
191
+ export function measurePmCoreHelp(text) {
192
+ const lines = text === "" ? 0 : text.split(/\r?\n/).length;
193
+ const utf8Bytes = Buffer.byteLength(text, "utf8");
194
+ return {
195
+ lines,
196
+ utf8_bytes: utf8Bytes,
197
+ within_budget: lines <= PM_CORE_HELP_BUDGET.max_lines &&
198
+ utf8Bytes <= PM_CORE_HELP_BUDGET.max_utf8_bytes,
199
+ };
200
+ }
170
201
  const TIER_ORDER = {
171
202
  core: 0,
172
203
  standard: 1,
@@ -180,12 +211,55 @@ export function resolvePmCommandVisibilityTier(command, extensionTier = "standar
180
211
  }
181
212
  /** Return commands visible at a requested tier, preserving contract order. */
182
213
  export function listPmCommandsForTier(tier) {
214
+ return listPmCommandsForTierFromContracts(tier, PM_COMMAND_CAPABILITY_CONTRACTS);
215
+ }
216
+ /** Project an explicit command registry into one visibility tier. */
217
+ export function listPmCommandsForTierFromContracts(tier, contracts) {
183
218
  const maximum = TIER_ORDER[tier];
184
- return PM_COMMAND_VISIBILITY_CONTRACTS.filter((entry) => entry.tier !== "internal" && TIER_ORDER[entry.tier] <= maximum).map((entry) => entry.command);
219
+ return contracts
220
+ .filter((entry) => entry.tier !== "internal" && TIER_ORDER[entry.tier] <= maximum)
221
+ .map((entry) => entry.command);
185
222
  }
186
223
  /** Return commands in one capability family, preserving contract order. */
187
224
  export function listPmCommandsForFamily(family) {
188
- return PM_COMMAND_CAPABILITY_CONTRACTS.filter((entry) => entry.family === family).map((entry) => entry.command);
225
+ return listPmCommandsForFamilyFromContracts(family, PM_COMMAND_CAPABILITY_CONTRACTS);
226
+ }
227
+ /** Project an explicit command registry into one capability family. */
228
+ export function listPmCommandsForFamilyFromContracts(family, contracts) {
229
+ return contracts
230
+ .filter((entry) => entry.family === family)
231
+ .map((entry) => entry.command);
232
+ }
233
+ const CAPABILITY_FAMILY_ORDER = [
234
+ "workspace",
235
+ "intake",
236
+ "context",
237
+ "lifecycle",
238
+ "evidence",
239
+ "graph",
240
+ "quality",
241
+ "automation",
242
+ "extensions",
243
+ "internal",
244
+ ];
245
+ const CAPABILITY_ROUTING_EXCLUDED_ALIASES = new Set([
246
+ "ctx",
247
+ "item-reopen",
248
+ "list-all",
249
+ "list-blocked",
250
+ "list-canceled",
251
+ "list-closed",
252
+ "list-draft",
253
+ "list-in-progress",
254
+ "list-open",
255
+ ]);
256
+ /** Group the command registry for progressive-disclosure routing surfaces. */
257
+ export function listPmCommandCapabilityGroups(contracts = PM_COMMAND_CAPABILITY_CONTRACTS) {
258
+ return CAPABILITY_FAMILY_ORDER.map((family) => ({
259
+ family,
260
+ commands: listPmCommandsForFamilyFromContracts(family, contracts).filter((command) => contracts.find((entry) => entry.command === command)?.tier !==
261
+ "internal" && !CAPABILITY_ROUTING_EXCLUDED_ALIASES.has(command)),
262
+ })).filter(({ commands }) => commands.length > 0);
189
263
  }
190
264
  /** Mapping from one narrow MCP tool to the command contract that tiers it. */
191
265
  export const PM_MCP_TOOL_COMMAND_CONTRACTS = Object.freeze({
@@ -223,9 +297,13 @@ export const PM_MCP_TOOL_COMMAND_CONTRACTS = Object.freeze({
223
297
  });
224
298
  /** Resolve the tools visible in a named MCP profile from command tiers. */
225
299
  export function listPmMcpToolsForProfile(availableTools, profile) {
300
+ return listPmMcpToolsForProfileFromContracts(availableTools, profile, PM_COMMAND_CAPABILITY_CONTRACTS);
301
+ }
302
+ /** Project an explicit command registry into one MCP tool profile. */
303
+ export function listPmMcpToolsForProfileFromContracts(availableTools, profile, contracts) {
226
304
  if (profile === "full")
227
305
  return [...availableTools];
228
- const visibleCommands = new Set(listPmCommandsForTier(profile));
306
+ const visibleCommands = new Set(listPmCommandsForTierFromContracts(profile, contracts));
229
307
  return availableTools.filter((tool) => {
230
308
  const command = PM_MCP_TOOL_COMMAND_CONTRACTS[tool];
231
309
  return command !== undefined && visibleCommands.has(command);
@@ -309,7 +387,11 @@ export const PM_MCP_PROMPT_CONTRACTS = Object.freeze([
309
387
  ]);
310
388
  /** Render the generated command visibility reference used by docs drift gates. */
311
389
  export function renderPmCommandVisibilityMarkdown() {
312
- const rows = PM_COMMAND_CAPABILITY_CONTRACTS.map(({ command, tier, family }) => `| \`${command}\` | ${tier} | ${family} |`);
390
+ return renderPmCommandVisibilityMarkdownFromContracts(PM_COMMAND_CAPABILITY_CONTRACTS);
391
+ }
392
+ /** Render an explicit registry for mutation-sensitivity and host tooling. */
393
+ export function renderPmCommandVisibilityMarkdownFromContracts(contracts) {
394
+ const rows = contracts.map(({ command, tier, family }) => `| \`${command}\` | ${tier} | ${family} |`);
313
395
  return [
314
396
  "# Generated agent command surface",
315
397
  "",
@@ -321,5 +403,21 @@ export function renderPmCommandVisibilityMarkdown() {
321
403
  "",
322
404
  ].join("\n");
323
405
  }
406
+ /** Render family routing for generated docs and skill progressive disclosure. */
407
+ export function renderPmCapabilityRoutingMarkdown(contracts = PM_COMMAND_CAPABILITY_CONTRACTS) {
408
+ const rows = listPmCommandCapabilityGroups(contracts).map(({ family, commands }) => `| ${family} | ${commands.map((command) => `\`${command}\``).join(", ")} |`);
409
+ return [
410
+ "# Generated agent capability routing",
411
+ "",
412
+ "Tracker: `pm-kxci8x`.",
413
+ "",
414
+ "This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.",
415
+ "",
416
+ "| Capability family | Commands |",
417
+ "| --- | --- |",
418
+ ...rows,
419
+ "",
420
+ ].join("\n");
421
+ }
324
422
  //# sourceMappingURL=agent-capability-contracts.js.map
325
- //# debugId=5e77c121-35a2-57d1-9a3e-f33447535c03
423
+ //# debugId=51e187c6-d48f-59e8-ad23-c72670ade3cc
@@ -146,6 +146,8 @@ export declare function parseAnnotationTextInput(raw: string, options?: {
146
146
  export declare function isErrnoError(error: unknown): error is {
147
147
  code?: unknown;
148
148
  };
149
+ /** Refuse presentation-level stdin directives when JSON-RPC owns the process stream. */
150
+ export declare function assertAnnotationStdinTransportAvailable(options: AnnotationSourceOptions, optionName: string): void;
149
151
  /** Resolves mutually exclusive annotation input flags into one normalized SDK operation. */
150
152
  export declare function resolveAnnotationInput(options: AnnotationSourceOptions, noun: string): Promise<AnnotationInput>;
151
153
  /** Implements wrap ownership conflict for the public runtime surface of this module. */
@@ -4,13 +4,13 @@
4
4
  * Implements the pm annotation command command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="eac75dc5-80b4-50d2-b615-4f96edca7346")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="39acab93-f9ad-5b95-871e-625d912f1322")}catch(e){}}();
8
8
  import { assertInitializedTracker } from "./environment/tracker-preflight.js";
9
9
  import { readFile } from "node:fs/promises";
10
10
  import { isFileAbsentError } from "../core/fs/fs-utils.js";
11
11
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
12
12
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
13
- import { createStdinTokenResolver, parseCsvKv } from "../core/item/parse.js";
13
+ import { createStdinTokenResolver, parseCsvKv, shouldResolveMutationStdinTokens, transferMutationStdinTokenPolicy, } from "../core/item/parse.js";
14
14
  import { EXIT_CODE } from "../core/shared/constants.js";
15
15
  import { PmCliError } from "../core/shared/errors.js";
16
16
  import { parseLimit } from "../core/shared/numeric-parsers.js";
@@ -26,7 +26,7 @@ export function normalizeAnnotationTransportOptions(options) {
26
26
  ...(options.full === true ? { fullHistory: true } : {}),
27
27
  };
28
28
  delete normalized.full;
29
- return normalized;
29
+ return transferMutationStdinTokenPolicy(options, normalized);
30
30
  }
31
31
  /** Reject mutation of canonical structured events while allowing ordinary annotations. */
32
32
  function assertAnnotationEntryMutable(entry, operation) {
@@ -84,6 +84,15 @@ export function parseAnnotationTextInput(raw, options = {}) {
84
84
  export function isErrnoError(error) {
85
85
  return typeof error === "object" && error !== null && "code" in error;
86
86
  }
87
+ /** Refuse presentation-level stdin directives when JSON-RPC owns the process stream. */
88
+ export function assertAnnotationStdinTransportAvailable(options, optionName) {
89
+ if (shouldResolveMutationStdinTokens(options))
90
+ return;
91
+ throw new PmCliError(`${optionName} cannot read process stdin through the MCP JSON-RPC transport. Pass annotation text in options.add instead.`, EXIT_CODE.USAGE, {
92
+ code: "mcp_stdin_unavailable",
93
+ required: "Pass annotation text as JSON data; the MCP protocol already owns process stdin.",
94
+ });
95
+ }
87
96
  async function resolveAnnotationTextSource(options, noun) {
88
97
  const sourceCount = Number(options.add !== undefined) +
89
98
  Number(options.stdin === true) +
@@ -92,14 +101,16 @@ async function resolveAnnotationTextSource(options, noun) {
92
101
  throw new PmCliError(`Specify ${noun} text using only one input source: --add, --stdin, or --file`, EXIT_CODE.USAGE);
93
102
  }
94
103
  const stdinResolver = createStdinTokenResolver();
104
+ const resolveStdinTokens = shouldResolveMutationStdinTokens(options);
95
105
  if (options.add !== undefined) {
96
106
  return {
97
- value: (await stdinResolver.resolveValue(options.add, "--add")) ?? "",
107
+ value: (await stdinResolver.resolveValue(options.add, "--add", resolveStdinTokens)) ?? "",
98
108
  rawValue: options.add,
99
109
  emptyFlag: "--add",
100
110
  };
101
111
  }
102
112
  if (options.stdin === true) {
113
+ assertAnnotationStdinTransportAvailable(options, "--stdin");
103
114
  return {
104
115
  value: (await stdinResolver.resolveValue("-", "--stdin")) ?? "",
105
116
  emptyFlag: "--stdin",
@@ -111,15 +122,22 @@ async function resolveAnnotationTextSource(options, noun) {
111
122
  if (!filePath) {
112
123
  throw new PmCliError("--file path cannot be empty", EXIT_CODE.USAGE);
113
124
  }
125
+ if (filePath === "-") {
126
+ assertAnnotationStdinTransportAvailable(options, "--file -");
127
+ return {
128
+ value: (await stdinResolver.resolveValue("-", "--file")) ?? "",
129
+ emptyFlag: "--file",
130
+ };
131
+ }
114
132
  try {
115
133
  return { value: await readFile(filePath, "utf8"), emptyFlag: "--file" };
116
134
  }
117
135
  catch (error) {
118
136
  if (isErrnoError(error) && isFileAbsentError(error)) {
119
- throw new PmCliError(`--file path not found: ${filePath}`, EXIT_CODE.USAGE);
137
+ throw new PmCliError(`--file path not found: ${filePath}. Use --file - to read stdin.`, EXIT_CODE.USAGE);
120
138
  }
121
139
  const detail = error instanceof Error ? error.message : String(error);
122
- throw new PmCliError(`Failed to read --file path "${filePath}": ${detail}`, EXIT_CODE.USAGE);
140
+ throw new PmCliError(`Failed to read --file path "${filePath}": ${detail}. Use --file - to read stdin.`, EXIT_CODE.USAGE);
123
141
  }
124
142
  }
125
143
  /** Resolves mutually exclusive annotation input flags into one normalized SDK operation. */
@@ -398,4 +416,4 @@ function renderAnnotationResult(id, collectionKey, allEntries, limit, includeMet
398
416
  };
399
417
  }
400
418
  //# sourceMappingURL=annotations.js.map
401
- //# debugId=eac75dc5-80b4-50d2-b615-4f96edca7346
419
+ //# debugId=39acab93-f9ad-5b95-871e-625d912f1322
@@ -6,7 +6,7 @@
6
6
  * output policy without coupling package authors to pm's renderer.
7
7
  */
8
8
 
9
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b3f5a4bc-d853-530e-8f5e-d682d8b93c9d")}catch(e){}}();
9
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1d338971-5a60-5b4e-b4c8-0705c8e8c98c")}catch(e){}}();
10
10
  import { PM_CORE_COMMAND_NAMES } from "./enum-contracts.js";
11
11
  /** Stable degradation stages applied when an output exceeds its token budget. */
12
12
  export const PM_OUTPUT_DEGRADATION_STEPS = [
@@ -218,8 +218,10 @@ function compactDiagnosticRecovery(value) {
218
218
  "retry_after_ms",
219
219
  ]) {
220
220
  const candidate = value[key];
221
- if (Array.isArray(candidate))
222
- compact[key] = candidate.slice(0, 3);
221
+ if (Array.isArray(candidate)) {
222
+ compact[key] =
223
+ key === "suggested_retry_args" ? candidate : candidate.slice(0, 3);
224
+ }
223
225
  else if (candidate !== undefined)
224
226
  compact[key] = candidate;
225
227
  }
@@ -473,4 +475,4 @@ export function projectPmDiagnosticText(output, correctiveAction, options = {})
473
475
  };
474
476
  }
475
477
  //# sourceMappingURL=agent-output-contracts.js.map
476
- //# debugId=b3f5a4bc-d853-530e-8f5e-d682d8b93c9d
478
+ //# debugId=1d338971-5a60-5b4e-b4c8-0705c8e8c98c
@@ -28,6 +28,10 @@ export declare const PM_CORE_COMMAND_NAMES: readonly ["init", "config", "extensi
28
28
  export declare const GRAPH_SUBCOMMAND_VALUES: readonly ["ancestors", "descendants", "predecessors", "successors", "paths", "impact", "analyze", "audit", "communities", "redundancy", "dominators", "slack", "centrality", "articulation", "plan", "index"];
29
29
  /** Restricts graph subcommand values accepted by command, SDK, and MCP contracts. */
30
30
  export type GraphSubcommand = (typeof GRAPH_SUBCOMMAND_VALUES)[number];
31
+ /** Supported values accepted by the merge subcommand contract across CLI and SDK surfaces. */
32
+ export declare const MERGE_SUBCOMMAND_VALUES: readonly ["install", "reconcile", "report", "driver"];
33
+ /** Restricts merge subcommand values accepted by command and SDK contracts. */
34
+ export type MergeSubcommand = (typeof MERGE_SUBCOMMAND_VALUES)[number];
31
35
  /** Nested lifecycle verbs flattened by SDK and MCP package actions. */
32
36
  export declare const PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS: readonly ["init", "install", "uninstall", "explore", "manage", "describe", "reload", "doctor", "catalog", "adopt", "adopt-all", "activate", "deactivate"];
33
37
  /** Noun-first item lifecycle verbs flattened for SDK and MCP dispatch. */
@@ -4,7 +4,7 @@
4
4
  * Defines SDK command-contract metadata for Enum Contracts.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8b8b6b8e-5061-5da4-a369-eca379c0090b")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3935bae8-0a40-59ea-aca6-64e238d1f318")}catch(e){}}();
8
8
  import { KNOWN_EXTENSION_CAPABILITIES, KNOWN_EXTENSION_POLICY_MODES, KNOWN_EXTENSION_POLICY_SURFACES, KNOWN_EXTENSION_SANDBOX_PROFILES, KNOWN_EXTENSION_SERVICE_NAMES, KNOWN_EXTENSION_TRUST_MODES, } from "../../core/extensions/extension-types.js";
9
9
  import { PM_COMMAND_ALIAS_CONTRACTS } from "./command-aliases.js";
10
10
  /** Public contract for pm extension capability contracts, shared by SDK and presentation-layer consumers. */
@@ -124,6 +124,13 @@ export const GRAPH_SUBCOMMAND_VALUES = [
124
124
  "plan",
125
125
  "index",
126
126
  ];
127
+ /** Supported values accepted by the merge subcommand contract across CLI and SDK surfaces. */
128
+ export const MERGE_SUBCOMMAND_VALUES = [
129
+ "install",
130
+ "reconcile",
131
+ "report",
132
+ "driver",
133
+ ];
127
134
  /** Nested lifecycle verbs flattened by SDK and MCP package actions. */
128
135
  export const PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS = [
129
136
  "init",
@@ -208,4 +215,4 @@ export function isPmExtensionPolicySurfaceContract(value) {
208
215
  return PM_EXTENSION_POLICY_SURFACE_CONTRACTS.includes(value);
209
216
  }
210
217
  //# sourceMappingURL=enum-contracts.js.map
211
- //# debugId=8b8b6b8e-5061-5da4-a369-eca379c0090b
218
+ //# debugId=3935bae8-0a40-59ea-aca6-64e238d1f318
@@ -7,7 +7,7 @@
7
7
  * flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
8
8
  */
9
9
 
10
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e302f519-aa51-503b-bd1a-f3155338f133")}catch(e){}}();
10
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6664bc8f-e5da-5593-a2df-ac45f1cef09e")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
13
13
  import { PM_POSITIONAL_ACTION_CONTRACTS, } from "./grammar-contracts.js";
@@ -894,6 +894,10 @@ export const TEST_FLAG_CONTRACTS = [
894
894
  { flag: "--shared-host-safe" },
895
895
  { flag: "--pm-context" },
896
896
  { flag: "--override-linked-pm-context" },
897
+ { flag: "--workspace-context" },
898
+ { flag: "--override-linked-workspace-context" },
899
+ { flag: "--allow-untrusted-linked-tests" },
900
+ { flag: "--acknowledge-linked-tests" },
897
901
  { flag: "--fail-on-context-mismatch" },
898
902
  { flag: "--fail-on-skipped" },
899
903
  { flag: "--fail-on-empty-test-run" },
@@ -920,6 +924,9 @@ export const TEST_ALL_FLAG_CONTRACTS = [
920
924
  { flag: "--shared-host-safe" },
921
925
  { flag: "--pm-context" },
922
926
  { flag: "--override-linked-pm-context" },
927
+ { flag: "--workspace-context" },
928
+ { flag: "--override-linked-workspace-context" },
929
+ { flag: "--allow-untrusted-linked-tests" },
923
930
  { flag: "--fail-on-context-mismatch" },
924
931
  { flag: "--fail-on-skipped" },
925
932
  { flag: "--fail-on-empty-test-run" },
@@ -1901,4 +1908,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1901
1908
  return normalizeUniqueStringList(all).join(" ");
1902
1909
  }
1903
1910
  //# sourceMappingURL=flag-contracts.js.map
1904
- //# debugId=e302f519-aa51-503b-bd1a-f3155338f133
1911
+ //# debugId=6664bc8f-e5da-5593-a2df-ac45f1cef09e