@unbrained/pm-cli 2026.8.29 → 2026.8.31

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 (136) hide show
  1. package/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
  2. package/.agents/skills/README.md +1 -1
  3. package/.agents/skills/pm-developer/SKILL.md +1 -1
  4. package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +2 -2
  5. package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +1 -1
  6. package/.agents/skills/pm-developer/references/TOKEN_BUDGETS.md +1 -1
  7. package/.agents/skills/pm-extensions/SKILL.md +2 -2
  8. package/.agents/skills/pm-extensions/references/AUTHORING.md +1 -1
  9. package/.agents/skills/pm-extensions/references/LIFECYCLE.md +1 -1
  10. package/.agents/skills/pm-sdk/SKILL.md +1 -1
  11. package/.agents/skills/pm-user/SKILL.md +2 -2
  12. package/.agents/skills/pm-user/references/WORKFLOWS.md +2 -2
  13. package/.claude-plugin/marketplace.json +2 -2
  14. package/AGENTS.md +1 -1
  15. package/CHANGELOG.md +24 -0
  16. package/dist/cli/register-list-query.js +32 -17
  17. package/dist/cli/register-operations.d.ts +2 -0
  18. package/dist/cli/register-operations.js +20 -9
  19. package/dist/cli-bundle/bundle-manifest.json +137 -137
  20. package/dist/cli-bundle/chunks/chunk-2XVV45NJ.js +35 -0
  21. package/dist/cli-bundle/chunks/{chunk-N6OR6FAR.js → chunk-3FCSFWZT.js} +12 -12
  22. package/dist/cli-bundle/chunks/{chunk-WS2GJQVG.js → chunk-52JXYSDW.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-TGNAA66W.js → chunk-5DH5XCJL.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-2UETTHY6.js → chunk-IEFJ3ZEB.js} +29 -29
  25. package/dist/cli-bundle/chunks/{chunk-MTTKAUBX.js → chunk-JIFYOJF7.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-3TEF3HM5.js → chunk-MWIN6OH2.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-GNWPTEBW.js → chunk-NW6LV3TU.js} +64 -64
  28. package/dist/cli-bundle/chunks/{chunk-7SKMLSMX.js → chunk-OUGDA7NR.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-2MKLQL2E.js → chunk-QZCIBZR3.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-CMIEDWAY.js → chunk-SXMHPK4V.js} +41 -41
  31. package/dist/cli-bundle/chunks/{register-list-query-OMKJ5ONN.js → register-list-query-7C7DKZ2U.js} +11 -11
  32. package/dist/cli-bundle/chunks/{register-mutation-QBSNCOY3.js → register-mutation-OI4BJLUX.js} +2 -2
  33. package/dist/cli-bundle/chunks/register-operations-IIMA5OKO.js +2 -0
  34. package/dist/cli-bundle/chunks/{register-setup-GLQ5SYV3.js → register-setup-52H36QCB.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-HVQ22RC4.js → chunk-2FEZ5SKM.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-Y3JJXRVK.js → chunk-4O4CJAR6.js} +5 -5
  37. package/dist/cli-bundle/focused-chunks/{chunk-RKOKG43G.js → chunk-APN4QN6R.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-LYFWQMVC.js → chunk-BEVHCEWG.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-3UMBF26I.js → chunk-BMD42PUG.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-XXOWRJZ5.js → chunk-BPWJ4QM5.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-G6PATS5E.js → chunk-EUTABA4M.js} +15 -15
  42. package/dist/cli-bundle/focused-chunks/{chunk-73EDXGYE.js → chunk-FOMZ6NG5.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-JCOOAUHK.js +51 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-JEFKLWMM.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-JZYPPMXF.js → chunk-KB5OFSFD.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-AD6ULRAF.js → chunk-QDFJIRKN.js} +4 -4
  47. package/dist/cli-bundle/focused-chunks/{chunk-THEPQMLX.js → chunk-SVXJYD6G.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-3AVAWVZA.js → chunk-UN34D63M.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-TDK3OCX3.js → chunk-VJ7EFMFL.js} +2 -2
  50. package/dist/cli-bundle/main.js +2 -2
  51. package/dist/cli-bundle/sdk-authoring.js +1 -1
  52. package/dist/cli-bundle/sdk-contracts.js +1 -1
  53. package/dist/cli-bundle/sdk-core.js +29 -29
  54. package/dist/cli-bundle/sdk-governance.js +1 -1
  55. package/dist/cli-bundle/sdk-graph.js +1 -1
  56. package/dist/cli-bundle/sdk-merge.js +33 -33
  57. package/dist/cli-bundle/sdk-query.js +1 -1
  58. package/dist/cli-bundle/sdk-runtime.js +1 -1
  59. package/dist/cli-bundle/sdk-testing.js +1 -1
  60. package/dist/cli-bundle/sdk.js +9 -9
  61. package/dist/core/schema/runtime-schema.d.ts +4 -0
  62. package/dist/core/schema/runtime-schema.js +60 -48
  63. package/dist/core/schema/status-defs-file.js +5 -2
  64. package/dist/mcp/legacy-adapter.d.ts +11 -2
  65. package/dist/mcp/legacy-adapter.js +26 -12
  66. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  67. package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
  68. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +1 -1
  69. package/dist/sdk/cli-contracts/grammar-contracts.js +12 -2
  70. package/dist/sdk/cli-contracts/runtime-contracts.js +3 -2
  71. package/dist/sdk/cli-contracts/tool-schema.js +11 -3
  72. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +14 -2
  73. package/dist/sdk/governance/health.js +17 -6
  74. package/dist/sdk/governance/status-role-diagnostics.d.ts +27 -0
  75. package/dist/sdk/governance/status-role-diagnostics.js +36 -0
  76. package/dist/sdk/governance/validate-normalization.d.ts +6 -0
  77. package/dist/sdk/governance/validate-normalization.js +37 -0
  78. package/dist/sdk/governance/validate.d.ts +1 -1
  79. package/dist/sdk/governance/validate.js +20 -35
  80. package/dist/sdk/governance/workspace-position.d.ts +69 -0
  81. package/dist/sdk/governance/workspace-position.js +164 -0
  82. package/dist/sdk/governance.d.ts +2 -0
  83. package/dist/sdk/governance.js +4 -2
  84. package/dist/sdk/index.d.ts +1 -1
  85. package/dist/sdk/index.js +3 -3
  86. package/dist/sdk/mcp/protocol.d.ts +10 -2
  87. package/dist/sdk/mcp/protocol.js +15 -4
  88. package/dist/sdk/query/context.js +11 -14
  89. package/dist/sdk/query/list.d.ts +2 -0
  90. package/dist/sdk/query/list.js +33 -12
  91. package/dist/sdk/runtime-extended-actions.js +8 -4
  92. package/dist/sdk/schema.js +12 -2
  93. package/dist/sdk/test/execution.d.ts +15 -0
  94. package/dist/sdk/test/execution.js +35 -27
  95. package/docs/AGENT_GUIDE.md +1 -1
  96. package/docs/AGENT_PROVENANCE_ADR.md +1 -1
  97. package/docs/AGENT_RUNTIME_PRIMITIVES.md +2 -2
  98. package/docs/CLAUDE_CODE_PLUGIN.md +3 -3
  99. package/docs/COMMANDS.md +12 -12
  100. package/docs/CONFIGURATION.md +1 -1
  101. package/docs/DEFECT_RECURRENCE.md +2 -0
  102. package/docs/MCP_2026_07_28.md +28 -8
  103. package/docs/MCP_2026_07_28_CONFORMANCE.md +1 -0
  104. package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +4 -2
  105. package/docs/ONBOARDING.md +1 -1
  106. package/docs/README.md +2 -1
  107. package/docs/READ_OUTPUT_CONTRACTS.md +1 -1
  108. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +1 -1
  109. package/docs/SDK.md +3 -3
  110. package/docs/TESTING.md +23 -14
  111. package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +113 -0
  112. package/docs/examples/policy-restricted-extension/README.md +2 -2
  113. package/docs/examples/starter-extension/README.md +1 -1
  114. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
  115. package/marketplace.json +2 -2
  116. package/package.json +4 -4
  117. package/packages/pm-beads/package.json +1 -1
  118. package/packages/pm-calendar/package.json +1 -1
  119. package/packages/pm-command-kit/package.json +1 -1
  120. package/packages/pm-digital-twin/package.json +1 -1
  121. package/packages/pm-governance-audit/package.json +1 -1
  122. package/packages/pm-guide-shell/package.json +1 -1
  123. package/packages/pm-kanban/package.json +1 -1
  124. package/packages/pm-lifecycle-hooks/package.json +1 -1
  125. package/packages/pm-linked-test-adapters/package.json +1 -1
  126. package/packages/pm-search-advanced/package.json +1 -1
  127. package/packages/pm-templates/package.json +1 -1
  128. package/packages/pm-todos/package.json +1 -1
  129. package/packages/pm-vcs/package.json +1 -1
  130. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  131. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  132. package/sdk/public-surface.json +171 -10
  133. package/dist/cli-bundle/chunks/chunk-7X6OZEIV.js +0 -34
  134. package/dist/cli-bundle/chunks/register-operations-UC77FQZC.js +0 -2
  135. package/dist/cli-bundle/focused-chunks/chunk-AXZ5AJAF.js +0 -50
  136. package/dist/cli-bundle/focused-chunks/chunk-LLNTHF5X.js +0 -2
@@ -75,6 +75,10 @@ export interface RuntimeStatusRegistry {
75
75
  draft_statuses: Set<string>;
76
76
  /** Configured status id representing the open lifecycle state. */
77
77
  open_status: string;
78
+ /** Configured status id representing the in-progress lifecycle state. */
79
+ in_progress_status: string;
80
+ /** Configured status id representing the blocked lifecycle state. */
81
+ blocked_status: string;
78
82
  /** Configured status id representing the closed lifecycle state. */
79
83
  close_status: string;
80
84
  /** Configured status id representing the canceled lifecycle state. */
@@ -4,7 +4,7 @@
4
4
  * Resolves configurable schema, fields, statuses, and workflows for Runtime Schema.
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]="88b9179f-569e-5cd6-b67c-c27431961554")}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]="633ef301-42a3-5b73-a4ed-7af0e0e40371")}catch(e){}}();
8
8
  import path from "node:path";
9
9
  import { pathExists, readFileIfExists, writeFileAtomic, } from "../fs/fs-utils.js";
10
10
  import { DEFAULT_STATUS_DEFINITIONS, DEFAULT_WORKFLOW_DEFINITION, } from "../shared/constants.js";
@@ -52,8 +52,7 @@ const RUNTIME_FIELD_VALUE_SCHEMA_SHAPE_VALIDATORS = [
52
52
  (Array.isArray(schema.enum) &&
53
53
  schema.enum.every((entry) => isStructuredJsonValue(entry))),
54
54
  (schema) => schema.min_length === undefined ||
55
- (Number.isInteger(schema.min_length) &&
56
- schema.min_length >= 0),
55
+ (Number.isInteger(schema.min_length) && schema.min_length >= 0),
57
56
  (schema) => schema.min_items === undefined ||
58
57
  (Number.isInteger(schema.min_items) && schema.min_items >= 0),
59
58
  (schema) => schema.format === undefined || schema.format === "date-time",
@@ -62,8 +61,7 @@ const RUNTIME_FIELD_VALUE_SCHEMA_SHAPE_VALIDATORS = [
62
61
  schema.required.every((entry) => typeof entry === "string" && entry.length > 0)),
63
62
  (schema) => schema.additional_properties === undefined ||
64
63
  typeof schema.additional_properties === "boolean",
65
- (schema) => schema.properties === undefined ||
66
- isPlainObject(schema.properties),
64
+ (schema) => schema.properties === undefined || isPlainObject(schema.properties),
67
65
  (schema) => schema.one_of === undefined ||
68
66
  (Array.isArray(schema.one_of) && schema.one_of.length > 0),
69
67
  ];
@@ -137,9 +135,7 @@ function normalizeRuntimeFieldValueSchema(value, depth = 0, ancestors = new Set(
137
135
  min_items: minItems,
138
136
  format: format,
139
137
  properties: normalizedProperties,
140
- required: required === undefined
141
- ? undefined
142
- : [...new Set(required)],
138
+ required: required === undefined ? undefined : [...new Set(required)],
143
139
  additional_properties: additionalProperties,
144
140
  items: normalizedItems,
145
141
  one_of: normalizedOneOf,
@@ -329,7 +325,10 @@ function normalizeRuntimeFieldDefinition(definition) {
329
325
  description: description && description.length > 0 ? description : undefined,
330
326
  type,
331
327
  commands,
332
- repeatable: [definition.repeatable === true, type === "string_array"].includes(true),
328
+ repeatable: [
329
+ definition.repeatable === true,
330
+ type === "string_array",
331
+ ].includes(true),
333
332
  required: definition.required === true,
334
333
  required_on_create: definition.required_on_create === true,
335
334
  required_types: requiredTypes,
@@ -658,27 +657,22 @@ export async function loadRuntimeSchemaFromOptionalFiles(pmRoot, schema) {
658
657
  created_paths: [],
659
658
  };
660
659
  }
661
- function preferredStatusForRole(definitions, role, fallbackValues) {
662
- const withRole = definitions.filter((definition) => definition.roles.includes(role));
663
- if (withRole.length > 0) {
664
- return withRole[0].id;
665
- }
660
+ function preferredStatusForRole(definitions, role, fallbackValues, fallbackFirst = false) {
666
661
  const normalizedFallbacks = fallbackValues
667
662
  .map((value) => normalizeStatusId(value))
668
663
  .filter((value) => typeof value === "string");
669
- for (const normalized of normalizedFallbacks) {
670
- if (definitions.some((definition) => definition.id === normalized)) {
671
- return normalized;
672
- }
664
+ const fallbackMatch = normalizedFallbacks.find((normalized) => definitions.some((definition) => definition.id === normalized));
665
+ if (fallbackFirst && fallbackMatch !== undefined) {
666
+ return fallbackMatch;
673
667
  }
674
- return definitions[0]?.id;
668
+ const withRole = definitions.find((definition) => definition.roles.includes(role));
669
+ if (withRole !== undefined) {
670
+ return withRole.id;
671
+ }
672
+ return fallbackMatch ?? definitions[0]?.id;
675
673
  }
676
- /** Implements resolve runtime status registry for the public runtime surface of this module. */
677
- export function resolveRuntimeStatusRegistry(schema) {
678
- const normalizedSchema = normalizeRuntimeSchemaSettings(schema);
679
- const definitions = normalizedSchema.statuses
680
- .map((definition, index) => normalizeRuntimeStatusDefinition(definition, index))
681
- .filter((definition) => definition !== null);
674
+ /** Build normalized identifier and alias indexes for runtime status lookup. */
675
+ function buildRuntimeStatusIndexes(definitions) {
682
676
  const aliasToId = new Map();
683
677
  const byId = new Map();
684
678
  for (const definition of definitions) {
@@ -692,42 +686,58 @@ export function resolveRuntimeStatusRegistry(schema) {
692
686
  aliasToId.set(alias.replaceAll("_", " "), definition.id);
693
687
  }
694
688
  }
695
- const terminalStatuses = new Set();
696
- const terminalDoneStatuses = new Set();
697
- const terminalCanceledStatuses = new Set();
698
- const activeStatuses = new Set();
699
- const blockedStatuses = new Set();
700
- const draftStatuses = new Set();
689
+ return { aliasToId, byId };
690
+ }
691
+ /** Classify runtime statuses into lifecycle role sets used by all consumers. */
692
+ function buildRuntimeStatusRoleSets(definitions) {
693
+ const result = {
694
+ activeStatuses: new Set(),
695
+ blockedStatuses: new Set(),
696
+ draftStatuses: new Set(),
697
+ terminalCanceledStatuses: new Set(),
698
+ terminalDoneStatuses: new Set(),
699
+ terminalStatuses: new Set(),
700
+ };
701
701
  for (const definition of definitions) {
702
702
  const roles = new Set(definition.roles);
703
703
  if (roles.has("terminal") ||
704
704
  roles.has("terminal_done") ||
705
705
  roles.has("terminal_canceled")) {
706
- terminalStatuses.add(definition.id);
707
- }
708
- if (roles.has("terminal_done")) {
709
- terminalDoneStatuses.add(definition.id);
706
+ result.terminalStatuses.add(definition.id);
710
707
  }
708
+ if (roles.has("terminal_done"))
709
+ result.terminalDoneStatuses.add(definition.id);
711
710
  if (roles.has("terminal_canceled")) {
712
- terminalCanceledStatuses.add(definition.id);
713
- }
714
- if (roles.has("active")) {
715
- activeStatuses.add(definition.id);
716
- }
717
- if (roles.has("blocked")) {
718
- blockedStatuses.add(definition.id);
719
- }
720
- if (roles.has("draft")) {
721
- draftStatuses.add(definition.id);
711
+ result.terminalCanceledStatuses.add(definition.id);
722
712
  }
713
+ if (roles.has("active"))
714
+ result.activeStatuses.add(definition.id);
715
+ if (roles.has("blocked"))
716
+ result.blockedStatuses.add(definition.id);
717
+ if (roles.has("draft"))
718
+ result.draftStatuses.add(definition.id);
723
719
  }
720
+ return result;
721
+ }
722
+ /** Implements resolve runtime status registry for the public runtime surface of this module. */
723
+ export function resolveRuntimeStatusRegistry(schema) {
724
+ const normalizedSchema = normalizeRuntimeSchemaSettings(schema);
725
+ const definitions = normalizedSchema.statuses
726
+ .map((definition, index) => normalizeRuntimeStatusDefinition(definition, index))
727
+ .filter((definition) => definition !== null);
728
+ const { aliasToId, byId } = buildRuntimeStatusIndexes(definitions);
729
+ const { activeStatuses, blockedStatuses, draftStatuses, terminalCanceledStatuses, terminalDoneStatuses, terminalStatuses, } = buildRuntimeStatusRoleSets(definitions);
724
730
  const workflow = normalizedSchema.workflow;
725
- const openStatus = normalizeStatusId(workflow.open_status) ??
731
+ const openStatus = (normalizeStatusId(workflow.open_status) ??
726
732
  preferredStatusForRole(definitions, "default_open", [
727
733
  "open",
728
734
  "in_progress",
729
735
  STATUS_VALUES[0],
730
- ]);
736
+ ]));
737
+ const inProgressStatus = normalizeStatusId(workflow.in_progress_status) ??
738
+ preferredStatusForRole(definitions, "active", ["in_progress", "in-progress", openStatus], true);
739
+ const blockedStatus = normalizeStatusId(workflow.blocked_status) ??
740
+ preferredStatusForRole(definitions, "blocked", ["blocked"]);
731
741
  const closeStatus = normalizeStatusId(workflow.close_status) ??
732
742
  preferredStatusForRole(definitions, "default_close", [
733
743
  "closed",
@@ -750,6 +760,8 @@ export function resolveRuntimeStatusRegistry(schema) {
750
760
  blocked_statuses: blockedStatuses,
751
761
  draft_statuses: draftStatuses,
752
762
  open_status: openStatus,
763
+ in_progress_status: inProgressStatus,
764
+ blocked_status: blockedStatus,
753
765
  close_status: closeStatus,
754
766
  canceled_status: canceledStatus,
755
767
  };
@@ -812,4 +824,4 @@ export function statusIsTerminal(status, registry) {
812
824
  return registry.terminal_statuses.has(normalized);
813
825
  }
814
826
  //# sourceMappingURL=runtime-schema.js.map
815
- //# debugId=88b9179f-569e-5cd6-b67c-c27431961554
827
+ //# debugId=633ef301-42a3-5b73-a4ed-7af0e0e40371
@@ -4,7 +4,7 @@
4
4
  * Resolves configurable schema, fields, statuses, and workflows for Status Defs File.
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]="3eac0218-43c9-5bd2-8eaf-589d02d2c8ad")}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]="ec456832-5120-5171-93fd-861ea4125acb")}catch(e){}}();
8
8
  import { RUNTIME_STATUS_ROLE_VALUES } from "../../types/index.js";
9
9
  import { DEFAULT_RUNTIME_STATUS_DEFINITIONS } from "./runtime-schema.js";
10
10
  import { normalizeStatusToken } from "./status-token.js";
@@ -72,6 +72,9 @@ export function normalizeAddStatusInput(raw) {
72
72
  roles.push(role);
73
73
  }
74
74
  }
75
+ if (roles.length === 0) {
76
+ throw new Error(`Status role must include at least one lifecycle role. Allowed roles: ${RUNTIME_STATUS_ROLE_VALUES.join(", ")}.`);
77
+ }
75
78
  }
76
79
  const aliases = raw.aliases === undefined
77
80
  ? undefined
@@ -222,4 +225,4 @@ export function assertStatusTokensAvailable(input, resolvedAliasToId) {
222
225
  }
223
226
  }
224
227
  //# sourceMappingURL=status-defs-file.js.map
225
- //# debugId=3eac0218-43c9-5bd2-8eaf-589d02d2c8ad
228
+ //# debugId=ec456832-5120-5171-93fd-861ea4125acb
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @module mcp/legacy-adapter
3
3
  *
4
- * Isolates the bounded MCP 2025-06-18 stdio compatibility surface from the
4
+ * Isolates the bounded initialize-era stdio compatibility surface from the
5
5
  * canonical stateless dispatcher. No modern transport imports policy from it.
6
6
  */
7
7
  import { type AgentClientInfo } from "../sdk/runtime-primitives.js";
8
- import { type PmMcpImplementation, type PmMcpServerCapabilities } from "../sdk/mcp/protocol.js";
8
+ import { PM_MCP_LEGACY_PROTOCOL_VERSIONS, type PmMcpImplementation, type PmMcpServerCapabilities } from "../sdk/mcp/protocol.js";
9
9
  /** Minimal request shape consumed by the compatibility adapter. */
10
10
  export interface LegacyMcpRequest {
11
11
  /** Legacy method name. */
@@ -36,6 +36,15 @@ export interface LegacyMcpAdapterOptions {
36
36
  /** Render one legacy prompt. */
37
37
  getPrompt: (params: Record<string, unknown> | undefined) => Record<string, unknown>;
38
38
  }
39
+ /**
40
+ * Resolve the legacy revision a handshake negotiates, or refuse with the full
41
+ * supported set.
42
+ *
43
+ * A legacy client has no fall-forward mechanism, so the refusal names every
44
+ * accepted legacy revision alongside the canonical modern one: the error text
45
+ * is the only diagnostic such a client can surface.
46
+ */
47
+ export declare function resolveLegacyProtocolVersion(requestedVersion: unknown): (typeof PM_MCP_LEGACY_PROTOCOL_VERSIONS)[number];
39
48
  /** Explicit compatibility adapter with no cross-process or modern-session role. */
40
49
  export declare class LegacyMcpAdapter {
41
50
  #private;
@@ -1,13 +1,34 @@
1
1
  /**
2
2
  * @module mcp/legacy-adapter
3
3
  *
4
- * Isolates the bounded MCP 2025-06-18 stdio compatibility surface from the
4
+ * Isolates the bounded initialize-era stdio compatibility surface from the
5
5
  * canonical stateless dispatcher. No modern transport imports policy from it.
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]="6a1d9bca-7dac-5537-9930-a12d8049c8b8")}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]="75228af6-d015-596d-ac32-4f5e78cb3916")}catch(e){}}();
9
9
  import { PmCliError } from "../sdk/runtime-primitives.js";
10
10
  import { PM_MCP_ERROR_CODES, PM_MCP_LEGACY_PROTOCOL_VERSIONS, PM_MCP_PROTOCOL_VERSION, PmMcpProtocolError, } from "../sdk/mcp/protocol.js";
11
+ /**
12
+ * Resolve the legacy revision a handshake negotiates, or refuse with the full
13
+ * supported set.
14
+ *
15
+ * A legacy client has no fall-forward mechanism, so the refusal names every
16
+ * accepted legacy revision alongside the canonical modern one: the error text
17
+ * is the only diagnostic such a client can surface.
18
+ */
19
+ export function resolveLegacyProtocolVersion(requestedVersion) {
20
+ if (requestedVersion === undefined || requestedVersion === null) {
21
+ return PM_MCP_LEGACY_PROTOCOL_VERSIONS[0];
22
+ }
23
+ const accepted = PM_MCP_LEGACY_PROTOCOL_VERSIONS.find((candidate) => candidate === requestedVersion);
24
+ if (accepted)
25
+ return accepted;
26
+ throw new PmMcpProtocolError("Unsupported legacy MCP protocol version", PM_MCP_ERROR_CODES.unsupportedProtocolVersion, {
27
+ supported: [...PM_MCP_LEGACY_PROTOCOL_VERSIONS],
28
+ requested: requestedVersion,
29
+ modern: PM_MCP_PROTOCOL_VERSION,
30
+ });
31
+ }
11
32
  /** Explicit compatibility adapter with no cross-process or modern-session role. */
12
33
  export class LegacyMcpAdapter {
13
34
  #options;
@@ -23,17 +44,10 @@ export class LegacyMcpAdapter {
23
44
  /** Validate and answer the historical initialize handshake. */
24
45
  initialize(params) {
25
46
  const requestedVersion = params?.protocolVersion;
26
- if (typeof requestedVersion === "string" &&
27
- !PM_MCP_LEGACY_PROTOCOL_VERSIONS.includes(requestedVersion)) {
28
- throw new PmMcpProtocolError("Unsupported legacy MCP protocol version", PM_MCP_ERROR_CODES.unsupportedProtocolVersion, {
29
- supported: [...PM_MCP_LEGACY_PROTOCOL_VERSIONS],
30
- requested: requestedVersion,
31
- modern: PM_MCP_PROTOCOL_VERSION,
32
- });
33
- }
47
+ const negotiatedVersion = resolveLegacyProtocolVersion(requestedVersion);
34
48
  this.#clientInfo = this.#options.parseClientInfo(params?.clientInfo);
35
49
  return {
36
- protocolVersion: PM_MCP_LEGACY_PROTOCOL_VERSIONS[0],
50
+ protocolVersion: negotiatedVersion,
37
51
  capabilities: structuredClone(this.#options.capabilities),
38
52
  serverInfo: { ...this.#options.serverInfo },
39
53
  instructions: this.#options.instructions,
@@ -61,4 +75,4 @@ export class LegacyMcpAdapter {
61
75
  }
62
76
  }
63
77
  //# sourceMappingURL=legacy-adapter.js.map
64
- //# debugId=6a1d9bca-7dac-5537-9930-a12d8049c8b8
78
+ //# debugId=75228af6-d015-596d-ac32-4f5e78cb3916
@@ -207,6 +207,8 @@ export declare const GRAPH_FLAG_CONTRACTS: CliFlagContract[];
207
207
  export declare const EVAL_FLAG_CONTRACTS: CliFlagContract[];
208
208
  /** Public contract for guarded portable workspace snapshot command paths. */
209
209
  export declare const WORKSPACE_FLAG_CONTRACTS: CliFlagContract[];
210
+ /** Flagless bounded workspace position read. */
211
+ export declare const WORKSPACE_POSITION_FLAG_CONTRACTS: CliFlagContract[];
210
212
  /** Public contract for next flag contracts, shared by SDK and presentation-layer consumers. */
211
213
  export declare const NEXT_FLAG_CONTRACTS: CliFlagContract[];
212
214
  /** Public contract for search flag contracts, shared by SDK and presentation-layer consumers. */
@@ -7,7 +7,7 @@
7
7
  * flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
8
8
  */
9
9
 
10
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bd6c497f-9fb0-5c47-a677-9dd6636dba02")}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]="789faf62-dfbf-56ff-9412-55adc5c12d3d")}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";
@@ -1555,6 +1555,8 @@ export const WORKSPACE_FLAG_CONTRACTS = [
1555
1555
  { flag: "--author" },
1556
1556
  { flag: "--message" },
1557
1557
  ];
1558
+ /** Flagless bounded workspace position read. */
1559
+ export const WORKSPACE_POSITION_FLAG_CONTRACTS = [];
1558
1560
  /** Public contract for next flag contracts, shared by SDK and presentation-layer consumers. */
1559
1561
  export const NEXT_FLAG_CONTRACTS = [
1560
1562
  { flag: "--for", value_name: "intent" },
@@ -1709,6 +1711,7 @@ const ASSURANCE_FLAG_CONTRACT_INDEX = indexCliFlagContracts(ASSURANCE_FLAG_CONTR
1709
1711
  const POSITIONAL_ACTION_FLAG_INDEX_BY_PARENT = new Map([
1710
1712
  ["assurance", ASSURANCE_FLAG_CONTRACT_INDEX],
1711
1713
  ["plan", PLAN_FLAG_CONTRACT_INDEX],
1714
+ ["workspace", indexCliFlagContracts(WORKSPACE_POSITION_FLAG_CONTRACTS)],
1712
1715
  ["workspace snapshot", indexCliFlagContracts(WORKSPACE_FLAG_CONTRACTS)],
1713
1716
  ]);
1714
1717
  /** Resolve every positional action's accepted flags against one parent contract. */
@@ -1770,6 +1773,7 @@ const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND = new Map([
1770
1773
  ["next", NEXT_FLAG_CONTRACTS],
1771
1774
  ["eval", EVAL_FLAG_CONTRACTS],
1772
1775
  ["workspace", WORKSPACE_FLAG_CONTRACTS],
1776
+ ["workspace position", WORKSPACE_POSITION_FLAG_CONTRACTS],
1773
1777
  ["workspace snapshot", WORKSPACE_FLAG_CONTRACTS],
1774
1778
  ["workspace snapshot create", WORKSPACE_FLAG_CONTRACTS],
1775
1779
  ["workspace snapshot list", WORKSPACE_FLAG_CONTRACTS],
@@ -1915,4 +1919,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1915
1919
  return normalizeUniqueStringList(all).join(" ");
1916
1920
  }
1917
1921
  //# sourceMappingURL=flag-contracts.js.map
1918
- //# debugId=bd6c497f-9fb0-5c47-a677-9dd6636dba02
1922
+ //# debugId=789faf62-dfbf-56ff-9412-55adc5c12d3d
@@ -53,7 +53,7 @@ export interface PmCommandPositionalContract {
53
53
  /** Discoverable positional action projected through help, contracts, and completion. */
54
54
  export interface PmPositionalActionContract extends PmCommandPositionalContract {
55
55
  /** Commander command that dispatches the action positionally. */
56
- parent: "assurance" | "plan" | "workspace snapshot";
56
+ parent: "assurance" | "plan" | "workspace" | "workspace snapshot";
57
57
  /** Literal action token accepted in the parent's first positional slot. */
58
58
  action: string;
59
59
  /** Canonical flags applicable to this action-specific view. */
@@ -7,7 +7,7 @@
7
7
  * cannot silently bypass the architecture decision.
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]="d0f4c030-0028-5acb-a438-210666118074")}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]="4efc5934-7d1b-517b-8b5e-eb2fe14379f2")}catch(e){}}();
11
11
  import { resolvePmCommandAlias, } from "./command-aliases.js";
12
12
  /** Canonical top-level domains an agent must retain to route pm operations. */
13
13
  export const PM_CLI_GRAMMAR_NOUNS = [
@@ -314,6 +314,15 @@ export const PM_POSITIONAL_ACTION_CONTRACTS = [
314
314
  description: "Analyze bounded defect-recurrence risk for a proposed change.",
315
315
  example: 'pm assurance risk --definition \'{"change":{"files":[]}}\'',
316
316
  },
317
+ {
318
+ command: "workspace position",
319
+ parent: "workspace",
320
+ action: "position",
321
+ slots: [],
322
+ accepted_flags: [],
323
+ description: "Read bounded merge-fence, receipt, history-drift, and next-action readiness.",
324
+ example: "pm workspace position",
325
+ },
317
326
  {
318
327
  command: "workspace snapshot create",
319
328
  parent: "workspace snapshot",
@@ -638,6 +647,7 @@ export const PM_COMMAND_DESTINATION_CONTRACTS = [
638
647
  ]),
639
648
  ...destinationRows("workspace", "workspace", "target_noun", "pm-pbyu", [
640
649
  "workspace",
650
+ "workspace position",
641
651
  "workspace snapshot",
642
652
  "workspace snapshot create",
643
653
  "workspace snapshot delete",
@@ -965,4 +975,4 @@ export function verifyPmCliGrammar(commands, aliases = [], destinations = PM_COM
965
975
  };
966
976
  }
967
977
  //# sourceMappingURL=grammar-contracts.js.map
968
- //# debugId=d0f4c030-0028-5acb-a438-210666118074
978
+ //# debugId=4efc5934-7d1b-517b-8b5e-eb2fe14379f2
@@ -4,7 +4,7 @@
4
4
  * Implements the pm contracts 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]="a4c43fa6-9f2e-515c-ab47-d21ef5d7878e")}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]="1506e8bc-3350-5ef5-a40a-44509eb59317")}catch(e){}}();
8
8
  import { EXIT_CODE, SETTINGS_DEFAULTS, PmCliError, activateExtensions, getActiveExtensionRegistrations, loadExtensions, pathExists, commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
9
9
  import { buildMcpToolContracts, } from "../../mcp/tool-definitions.js";
10
10
  import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, ASSURANCE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, ITEM_REOPEN_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_OUTPUT_DEGRADATION_STEPS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_DEPRECATED_TOOL_ACTIONS, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, PROFILE_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, EVAL_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, PM_COMMAND_ALIAS_CONTRACTS, PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS, resolvePmCommandOutputBudget, } from "../cli-contracts.js";
@@ -367,6 +367,7 @@ const CORE_COMMAND_FLAG_CONTRACT_ENTRIES = [
367
367
  ["search", SEARCH_FLAG_CONTRACTS],
368
368
  ["eval", EVAL_FLAG_CONTRACTS],
369
369
  ["workspace", WORKSPACE_FLAG_CONTRACTS],
370
+ ["workspace position", []],
370
371
  ["workspace snapshot", WORKSPACE_FLAG_CONTRACTS],
371
372
  ["workspace snapshot create", WORKSPACE_FLAG_CONTRACTS],
372
373
  ["workspace snapshot list", WORKSPACE_FLAG_CONTRACTS],
@@ -2084,4 +2085,4 @@ export const _testOnlyContractsCommand = {
2084
2085
  toRuntimeShortFlagToken,
2085
2086
  };
2086
2087
  //# sourceMappingURL=runtime-contracts.js.map
2087
- //# debugId=a4c43fa6-9f2e-515c-ab47-d21ef5d7878e
2088
+ //# debugId=1506e8bc-3350-5ef5-a40a-44509eb59317
@@ -7,7 +7,7 @@
7
7
  * consumers from a single source of truth.
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]="91de08b8-ad0b-5c61-a272-3c18cd3f083b")}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]="b81a68c1-565d-56f6-a0eb-35d2c737bdb7")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
13
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";
@@ -567,8 +567,9 @@ const PM_TOOL_ACTION_SCHEMA_CONTRACTS = {
567
567
  ],
568
568
  },
569
569
  workspace: {
570
- required: ["subcommand", "snapshotAction"],
570
+ required: ["subcommand"],
571
571
  optional: [
572
+ "snapshotAction",
572
573
  "name",
573
574
  "target",
574
575
  "dryRun",
@@ -578,6 +579,13 @@ const PM_TOOL_ACTION_SCHEMA_CONTRACTS = {
578
579
  "lockTtlSeconds",
579
580
  "lockWaitMs",
580
581
  ],
582
+ conditionalRequired: [
583
+ {
584
+ property: "subcommand",
585
+ value: "snapshot",
586
+ required: ["snapshotAction"],
587
+ },
588
+ ],
581
589
  },
582
590
  meet: SCHEDULING_ACTION_SCHEMA_CONTRACT,
583
591
  event: SCHEDULING_ACTION_SCHEMA_CONTRACT,
@@ -1629,4 +1637,4 @@ export const _testOnlyCliContracts = {
1629
1637
  withFlagAliasMetadata,
1630
1638
  };
1631
1639
  //# sourceMappingURL=tool-schema.js.map
1632
- //# debugId=91de08b8-ad0b-5c61-a272-3c18cd3f083b
1640
+ //# debugId=b81a68c1-565d-56f6-a0eb-35d2c737bdb7
@@ -1,6 +1,6 @@
1
1
  /** Generated partition 2 of the exhaustive error-code catalog. */
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="015f826a-6490-56d1-8e26-131e5503d8f1")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="41e6f81d-ccb5-546c-9b26-3b78027528b5")}catch(e){}}();
4
4
  export const PM_ERROR_CODE_CATALOG_PART_2 = [
5
5
  {
6
6
  code: "missing_destination",
@@ -919,6 +919,18 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
919
919
  canonical_code: "status_invalid",
920
920
  aliases: [],
921
921
  },
922
+ {
923
+ code: "status_lifecycle_role_required",
924
+ meaning: "Status lifecycle role required condition.",
925
+ stability: "provisional",
926
+ exit_code: 2,
927
+ class: "usage",
928
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
929
+ sources: ["sdk/schema.ts"],
930
+ emitting_commands: ["*"],
931
+ canonical_code: "status_lifecycle_role_required",
932
+ aliases: [],
933
+ },
922
934
  {
923
935
  code: "stdin_json_invalid",
924
936
  meaning: "Stdin json invalid condition.",
@@ -2162,4 +2174,4 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
2162
2174
  },
2163
2175
  ];
2164
2176
  //# sourceMappingURL=generated-error-code-catalog-part-2.js.map
2165
- //# debugId=015f826a-6490-56d1-8e26-131e5503d8f1
2177
+ //# debugId=41e6f81d-ccb5-546c-9b26-3b78027528b5
@@ -4,7 +4,7 @@
4
4
  * Implements the pm health 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]="3c68e4be-fd09-560c-9654-f270e5d7ba73")}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]="76693c03-9395-5bbf-bcc8-fa15e408f30f")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { assertInitializedTracker } from "../environment/tracker-preflight.js";
@@ -50,6 +50,7 @@ import { inspectMergeReceiptEvidence, partitionMergeReceipts, } from "../merge/r
50
50
  import { runHistoryRepair } from "../history-repair.js";
51
51
  import { resolveWorkspaceRelationshipKindRegistry } from "../graph/assembly.js";
52
52
  import { analyzeHierarchyIntegrity, } from "../graph/hierarchy-integrity.js";
53
+ import { buildStatusRoleWarnings, inspectStatusRoleAssignments, } from "./status-role-diagnostics.js";
53
54
  const PM_TELEMETRY_SOURCE_CONTEXT_SET = new Set(PM_TELEMETRY_SOURCE_CONTEXT_VALUES);
54
55
  const STALE_VECTORIZATION_SUMMARY_LIMIT = 25;
55
56
  const BRIEF_HEALTH_DETAIL_LIMIT = 8;
@@ -1834,12 +1835,17 @@ function buildDirectoriesHealthCheck(directoryState, strictDirectories) {
1834
1835
  },
1835
1836
  };
1836
1837
  }
1837
- function buildSettingsValuesHealthCheck(settingWarnings) {
1838
+ function buildSettingsValuesHealthCheck(settingWarnings, statusRoleDiagnostics) {
1838
1839
  return {
1839
1840
  name: "settings_values",
1840
1841
  status: settingWarnings.length === 0 ? "ok" : "warn",
1841
1842
  ok: settingWarnings.length === 0,
1842
- details: { warnings: settingWarnings },
1843
+ details: {
1844
+ warnings: settingWarnings,
1845
+ ...(statusRoleDiagnostics.roleless_status_count > 0
1846
+ ? { lifecycle_status_roles: statusRoleDiagnostics }
1847
+ : {}),
1848
+ },
1843
1849
  };
1844
1850
  }
1845
1851
  /** Preserve unknown-author totals for current and legacy scan payloads. */
@@ -2129,7 +2135,7 @@ export async function runHealth(global, options = {}) {
2129
2135
  const strictDirectories = options.strictDirectories === true;
2130
2136
  const refreshPolicy = resolveVectorRefreshPolicy(options);
2131
2137
  const directoryState = await scanHealthDirectories(pmRoot, typeRegistry, strictDirectories);
2132
- const settingWarnings = validateSettingsValues(settings);
2138
+ const settingsValueWarnings = validateSettingsValues(settings);
2133
2139
  const telemetryCheck = await buildTelemetryCheck(settings, {
2134
2140
  checkTelemetry: options.checkTelemetry === true,
2135
2141
  });
@@ -2144,6 +2150,11 @@ export async function runHealth(global, options = {}) {
2144
2150
  itemReadWarnings,
2145
2151
  });
2146
2152
  const itemsWithBody = items;
2153
+ const statusRoleDiagnostics = inspectStatusRoleAssignments(resolveRuntimeStatusRegistry(settings.schema), items);
2154
+ const settingWarnings = [
2155
+ ...settingsValueWarnings,
2156
+ ...buildStatusRoleWarnings(statusRoleDiagnostics),
2157
+ ];
2147
2158
  const historyPolicy = skipPolicy.skipDrift
2148
2159
  ? { warnings: [] }
2149
2160
  : await enforceHistoryStreamPolicyForItems({
@@ -2197,7 +2208,7 @@ export async function runHealth(global, options = {}) {
2197
2208
  const checks = [
2198
2209
  buildSettingsHealthCheck(settingsPath, settings, normalizedSettingsReadWarnings),
2199
2210
  buildDirectoriesHealthCheck(directoryState, strictDirectories),
2200
- buildSettingsValuesHealthCheck(settingWarnings),
2211
+ buildSettingsValuesHealthCheck(settingWarnings, statusRoleDiagnostics),
2201
2212
  telemetryCheck.check,
2202
2213
  extensionCheck.check,
2203
2214
  buildStorageHealthCheck(items, settings, historySummary, authorAttribution, staleInProgress.scan, provenanceResolverOutcomes, provenanceInvalidValues),
@@ -2298,4 +2309,4 @@ export const _testOnlyHealthCommand = {
2298
2309
  warningCode,
2299
2310
  };
2300
2311
  //# sourceMappingURL=health.js.map
2301
- //# debugId=3c68e4be-fd09-560c-9654-f270e5d7ba73
2312
+ //# debugId=76693c03-9395-5bbf-bcc8-fa15e408f30f
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @module sdk/governance/status-role-diagnostics
3
+ *
4
+ * Diagnoses lifecycle statuses that cannot participate in role-derived project
5
+ * management views because they have no registered lifecycle role.
6
+ */
7
+ import type { ItemMetadata } from "../../types/index.js";
8
+ import { type RuntimeStatusRegistry } from "../../core/schema/runtime-schema.js";
9
+ /** Bounded evidence describing roleless status definitions and affected items. */
10
+ export interface StatusRoleDiagnostics {
11
+ /** Total number of registered status ids that have no lifecycle role. */
12
+ roleless_status_count: number;
13
+ /** Registered status ids that have no lifecycle role. */
14
+ roleless_statuses: string[];
15
+ /** Whether roleless status ids were omitted from the bounded sample. */
16
+ roleless_statuses_truncated: boolean;
17
+ /** Number of items whose status resolves to a roleless definition. */
18
+ affected_item_count: number;
19
+ /** Bounded, deterministic sample of affected item ids. */
20
+ affected_item_ids: string[];
21
+ /** Whether affected item ids were omitted from the bounded sample. */
22
+ affected_item_ids_truncated: boolean;
23
+ }
24
+ /** Inspect role registration and affected items without mutating the tracker. */
25
+ export declare function inspectStatusRoleAssignments(statusRegistry: RuntimeStatusRegistry, items: readonly ItemMetadata[], itemLimit?: number): StatusRoleDiagnostics;
26
+ /** Convert role diagnostics into the stable health/validate warning token. */
27
+ export declare function buildStatusRoleWarnings(diagnostics: StatusRoleDiagnostics): string[];