@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
@@ -0,0 +1,36 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cd7acf28-cb93-516e-9058-54c32625ec26")}catch(e){}}();
3
+ import { normalizeStatusInputWithRegistry, } from "../../core/schema/runtime-schema.js";
4
+ /** Inspect role registration and affected items without mutating the tracker. */
5
+ export function inspectStatusRoleAssignments(statusRegistry, items, itemLimit = 25) {
6
+ const rolelessStatuses = statusRegistry.definitions
7
+ .filter((definition) => definition.roles.length === 0)
8
+ .map((definition) => definition.id)
9
+ .sort((left, right) => left.localeCompare(right));
10
+ const rolelessSet = new Set(rolelessStatuses);
11
+ const affectedItemIds = items
12
+ .filter((item) => {
13
+ const resolved = normalizeStatusInputWithRegistry(item.status, statusRegistry);
14
+ return resolved !== undefined && rolelessSet.has(resolved);
15
+ })
16
+ .map((item) => item.id)
17
+ .sort((left, right) => left.localeCompare(right));
18
+ return {
19
+ roleless_status_count: rolelessStatuses.length,
20
+ roleless_statuses: rolelessStatuses.slice(0, itemLimit),
21
+ roleless_statuses_truncated: rolelessStatuses.length > itemLimit,
22
+ affected_item_count: affectedItemIds.length,
23
+ affected_item_ids: affectedItemIds.slice(0, itemLimit),
24
+ affected_item_ids_truncated: affectedItemIds.length > itemLimit,
25
+ };
26
+ }
27
+ /** Convert role diagnostics into the stable health/validate warning token. */
28
+ export function buildStatusRoleWarnings(diagnostics) {
29
+ return diagnostics.roleless_status_count === 0
30
+ ? []
31
+ : [
32
+ `schema_status_missing_lifecycle_role:${diagnostics.roleless_status_count}`,
33
+ ];
34
+ }
35
+ //# sourceMappingURL=status-role-diagnostics.js.map
36
+ //# debugId=cd7acf28-cb93-516e-9058-54c32625ec26
@@ -0,0 +1,6 @@
1
+ /** Normalize a repository-relative path to stable forward-slash form. */
2
+ export declare function normalizeRelativePath(value: string): string;
3
+ /** Normalize a repository-relative directory without trailing separators. */
4
+ export declare function normalizeRelativeDirectoryPath(value: string): string;
5
+ /** Treat blank and legacy null-like metadata tokens as absent values. */
6
+ export declare function toMeaningfulString(value: unknown): string | undefined;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @module sdk/governance/validate-normalization
3
+ *
4
+ * Provides shared path and meaningful-value normalization for validation
5
+ * diagnostics without coupling the helpers to the command orchestration.
6
+ */
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]="de2cc648-965a-59c9-b688-0fe12edeec82")}catch(e){}}();
9
+ import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
10
+ /** Normalize a repository-relative path to stable forward-slash form. */
11
+ export function normalizeRelativePath(value) {
12
+ return value
13
+ .replaceAll("\\", "/")
14
+ .replace(/^\.\/+/, "")
15
+ .replace(/^\/+/, "");
16
+ }
17
+ /** Normalize a repository-relative directory without trailing separators. */
18
+ export function normalizeRelativeDirectoryPath(value) {
19
+ return normalizeRelativePath(value).replace(/\/+$/, "");
20
+ }
21
+ /** Treat blank and legacy null-like metadata tokens as absent values. */
22
+ export function toMeaningfulString(value) {
23
+ const normalized = toNonEmptyStringOrUndefined(value);
24
+ if (!normalized) {
25
+ return undefined;
26
+ }
27
+ const lowered = normalized.toLowerCase();
28
+ if (lowered === "none" ||
29
+ lowered === "null" ||
30
+ lowered === "n/a" ||
31
+ lowered === "na") {
32
+ return undefined;
33
+ }
34
+ return normalized;
35
+ }
36
+ //# sourceMappingURL=validate-normalization.js.map
37
+ //# debugId=de2cc648-965a-59c9-b688-0fe12edeec82
@@ -8,6 +8,7 @@ import { type OutputProjectionDeclaration } from "../output-projection.js";
8
8
  import { type RelationshipKindRegistry } from "../relationships.js";
9
9
  import { type ValidateItem } from "./validate-item-reader.js";
10
10
  import { buildLifecycleParentGraph, detectLifecycleParentCycles, resolveLifecycleDependencyCycleSamplePath } from "./hierarchy-validation.js";
11
+ import { toMeaningfulString } from "./validate-normalization.js";
11
12
  type ValidateCheckName = "metadata" | "resolution" | "lifecycle" | "dependency_references" | "files" | "command_references" | "history_drift" | "format_version" | "storage_integrity";
12
13
  type ValidateStatus = "ok" | "warn" | "error";
13
14
  type ValidateDependencyCycleSeverity = "off" | "warn" | "error";
@@ -153,7 +154,6 @@ export interface ValidateCountsResult extends Omit<ValidateResult, "fixes"> {
153
154
  * totals, statuses, and truncation markers are preserved.
154
155
  */
155
156
  export declare function projectValidateCounts(result: ValidateResult): ValidateCountsResult;
156
- declare function toMeaningfulString(value: unknown): string | undefined;
157
157
  interface ValidateMetadataPolicy {
158
158
  profile: ValidateMetadataProfile;
159
159
  profile_source: "default" | "settings" | "option";
@@ -4,7 +4,7 @@
4
4
  * Implements the pm validate 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]="e7a231e7-0546-5d5f-b0c8-59629ad4d731")}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]="cde10e58-cfeb-5718-a471-3e4acf46cfe7")}catch(e){}}();
8
8
  import { assertInitializedTracker } from "../environment/tracker-preflight.js";
9
9
  import fs from "node:fs/promises";
10
10
  import { realpathSync } from "node:fs";
@@ -46,6 +46,8 @@ import { resolveLinkedTestSourceRef, resolveLinkedTestSourceWorkspaceRoot, resol
46
46
  import { readValidateItems, } from "./validate-item-reader.js";
47
47
  import { buildValidateHistoryDriftCheck } from "./validate-history-drift.js";
48
48
  import { buildLifecycleParentGraph, detectLifecycleParentCycles, resolveLifecycleDependencyCycleSamplePath, } from "./hierarchy-validation.js";
49
+ import { buildStatusRoleWarnings, inspectStatusRoleAssignments, } from "./status-role-diagnostics.js";
50
+ import { normalizeRelativeDirectoryPath, normalizeRelativePath, toMeaningfulString, } from "./validate-normalization.js";
49
51
  const FILE_SCAN_DIRECTORIES = ["src", "tests", "docs"];
50
52
  const FILE_SCAN_ROOT_FILES = [
51
53
  "README.md",
@@ -205,30 +207,6 @@ export function projectValidateCounts(result) {
205
207
  : {}),
206
208
  };
207
209
  }
208
- function normalizeRelativePath(value) {
209
- return value
210
- .replaceAll("\\", "/")
211
- .replace(/^\.\/+/, "")
212
- .replace(/^\/+/, "");
213
- }
214
- function normalizeRelativeDirectoryPath(value) {
215
- const normalized = normalizeRelativePath(value);
216
- return normalized.replace(/\/+$/, "");
217
- }
218
- function toMeaningfulString(value) {
219
- const normalized = toNonEmptyStringOrUndefined(value);
220
- if (!normalized) {
221
- return undefined;
222
- }
223
- const lowered = normalized.toLowerCase();
224
- if (lowered === "none" ||
225
- lowered === "null" ||
226
- lowered === "n/a" ||
227
- lowered === "na") {
228
- return undefined;
229
- }
230
- return normalized;
231
- }
232
210
  /* c8 ignore start -- runtime-status alias normalization is covered by status-registry integration tests */
233
211
  function normalizeStatusForRegistry(status, statusRegistry) {
234
212
  return normalizeStatusInput(status, statusRegistry) ?? status;
@@ -1484,15 +1462,21 @@ function buildLifecycleCheck(items, includeStaleBlockers, dependencyCycleSeverit
1484
1462
  sortLifecycleScanRows(rows);
1485
1463
  const dependencyCycleDiagnostics = detectLifecycleDependencyCycles(rows.activeItems, idPrefix);
1486
1464
  const parentCycleDiagnostics = detectLifecycleParentCycles(items, statusRegistry);
1487
- const warnings = buildLifecycleWarnings(rows, includeStaleBlockers, dependencyCycleSeverity, parentCycleSeverity, {
1488
- dependencyCycles: dependencyCycleDiagnostics.cycle_count,
1489
- activeHierarchyCycles: parentCycleDiagnostics.active_cycle_count,
1490
- activeHierarchyCardinality: parentCycleDiagnostics.active_cardinality_violation_count,
1491
- activeHierarchyDivergence: parentCycleDiagnostics.active_parent_divergence_count,
1492
- legacyHierarchyCycles: parentCycleDiagnostics.legacy_cycle_count,
1493
- legacyHierarchyCardinality: parentCycleDiagnostics.legacy_cardinality_violation_count,
1494
- legacyHierarchyDivergence: parentCycleDiagnostics.legacy_parent_divergence_count,
1495
- });
1465
+ const statusRoleDiagnostics = inspectStatusRoleAssignments(statusRegistry, items, verboseDiagnostics
1466
+ ? Number.POSITIVE_INFINITY
1467
+ : DIAGNOSTIC_LIST_SUMMARY_LIMIT);
1468
+ const warnings = [
1469
+ ...buildLifecycleWarnings(rows, includeStaleBlockers, dependencyCycleSeverity, parentCycleSeverity, {
1470
+ dependencyCycles: dependencyCycleDiagnostics.cycle_count,
1471
+ activeHierarchyCycles: parentCycleDiagnostics.active_cycle_count,
1472
+ activeHierarchyCardinality: parentCycleDiagnostics.active_cardinality_violation_count,
1473
+ activeHierarchyDivergence: parentCycleDiagnostics.active_parent_divergence_count,
1474
+ legacyHierarchyCycles: parentCycleDiagnostics.legacy_cycle_count,
1475
+ legacyHierarchyCardinality: parentCycleDiagnostics.legacy_cardinality_violation_count,
1476
+ legacyHierarchyDivergence: parentCycleDiagnostics.legacy_parent_divergence_count,
1477
+ }),
1478
+ ...buildStatusRoleWarnings(statusRoleDiagnostics),
1479
+ ];
1496
1480
  const diagnosticLimit = verboseDiagnostics
1497
1481
  ? Number.POSITIVE_INFINITY
1498
1482
  : DIAGNOSTIC_LIST_SUMMARY_LIMIT;
@@ -1522,6 +1506,7 @@ function buildLifecycleCheck(items, includeStaleBlockers, dependencyCycleSeverit
1522
1506
  ok: !hasErrorSeverityCycle && warnings.length === 0,
1523
1507
  details: {
1524
1508
  checked_active_items: rows.activeItems.length,
1509
+ lifecycle_status_roles: statusRoleDiagnostics,
1525
1510
  active_closure_like_metadata_items: rows.closureLikeRows.length,
1526
1511
  active_closure_like_metadata_rows: summarizedClosureLikeRows.values,
1527
1512
  active_closure_like_metadata_rows_truncated: summarizedClosureLikeRows.truncated,
@@ -2288,4 +2273,4 @@ export async function runValidate(options, global, services = {}) {
2288
2273
  }
2289
2274
  /* c8 ignore stop */
2290
2275
  //# sourceMappingURL=validate.js.map
2291
- //# debugId=e7a231e7-0546-5d5f-b0c8-59629ad4d731
2276
+ //# debugId=cde10e58-cfeb-5718-a471-3e4acf46cfe7
@@ -0,0 +1,69 @@
1
+ import type { GlobalOptions } from "../../core/shared/command-types.js";
2
+ import { type MergeDriverConfigurationAuditResult, type MergeFenceAuditResult } from "../merge/install.js";
3
+ /** Stable readiness classifications returned by the workspace-position read. */
4
+ export type WorkspacePositionState = "ready" | "merge_evidence_invalid" | "history_evidence_invalid" | "merge_reconciliation_required" | "history_repair_required" | "merge_fence_unprepared";
5
+ /** One deterministic recovery action selected from aggregate workspace evidence. */
6
+ export interface WorkspacePositionNextAction {
7
+ /** Executable pm command, or null when the workspace is ready. */
8
+ command: string | null;
9
+ /** Stable reason code explaining why this action takes precedence. */
10
+ reason: WorkspacePositionState;
11
+ }
12
+ /** Bounded SDK result shared by CLI, MCP, and package consumers. */
13
+ export interface WorkspacePositionResult {
14
+ /** Whether all readiness evidence is clean. */
15
+ ok: boolean;
16
+ /** Highest-priority workspace readiness classification. */
17
+ state: WorkspacePositionState;
18
+ /** Committed merge-fence and clone-local driver evidence. */
19
+ merge_fence: {
20
+ committed: MergeFenceAuditResult;
21
+ clone_local_drivers: MergeDriverConfigurationAuditResult | null;
22
+ };
23
+ /** Bounded pending receipt evidence without private merge values. */
24
+ merge_receipts: {
25
+ pending_decision_count: number;
26
+ pending_item_ids: string[];
27
+ pending_item_ids_truncated: boolean;
28
+ lossless_count: number;
29
+ invalid_evidence_count: number;
30
+ };
31
+ /** Bounded append-only history drift evidence. */
32
+ history_drift: {
33
+ /** Whether the required history-drift evidence has its expected shape. */
34
+ evidence_valid: boolean;
35
+ drifted_item_count: number;
36
+ drifted_item_ids: string[];
37
+ drifted_item_ids_truncated: boolean;
38
+ counts: Record<string, unknown>;
39
+ };
40
+ /** One deterministic next action, avoiding multi-command guesswork. */
41
+ next_action: WorkspacePositionNextAction;
42
+ /** Non-fatal read warnings retained from the authoritative item scan. */
43
+ warnings: string[];
44
+ /** ISO timestamp for this aggregate read. */
45
+ generated_at: string;
46
+ }
47
+ declare function selectWorkspacePositionState(params: {
48
+ invalidEvidenceCount: number;
49
+ pendingDecisionCount: number;
50
+ losslessCount: number;
51
+ historyEvidenceValid: boolean;
52
+ driftedItemCount: number;
53
+ fence: MergeFenceAuditResult;
54
+ drivers: MergeDriverConfigurationAuditResult | null;
55
+ }): WorkspacePositionState;
56
+ declare function commandForWorkspacePositionState(state: WorkspacePositionState, pmRoot: string, platform?: NodeJS.Platform): string | null;
57
+ /** Normalize defensive history-check evidence into the bounded position shape. */
58
+ declare function normalizeWorkspaceHistoryDrift(details: Record<string, unknown>): WorkspacePositionResult["history_drift"];
59
+ /** Read aggregate workspace position without flags, session state, or mutation. */
60
+ export declare function readWorkspacePosition(global: GlobalOptions): Promise<WorkspacePositionResult>;
61
+ /** Render the bounded workspace position for human CLI output. */
62
+ export declare function formatWorkspacePositionHuman(result: WorkspacePositionResult): string;
63
+ /** Public contract for focused unit verification. */
64
+ export declare const _testOnlyWorkspacePosition: {
65
+ commandForWorkspacePositionState: typeof commandForWorkspacePositionState;
66
+ normalizeWorkspaceHistoryDrift: typeof normalizeWorkspaceHistoryDrift;
67
+ selectWorkspacePositionState: typeof selectWorkspacePositionState;
68
+ };
69
+ export {};
@@ -0,0 +1,164 @@
1
+ /**
2
+ * @module sdk/governance/workspace-position
3
+ *
4
+ * Produces one bounded, read-only workspace readiness answer from merge-fence,
5
+ * merge-receipt, and append-only history evidence.
6
+ */
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]="e900c117-6d8d-55d3-86df-f543dc499930")}catch(e){}}();
9
+ import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
10
+ import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
11
+ import { nowIso } from "../../core/shared/time.js";
12
+ import { resolvePmRoot } from "../../core/store/paths.js";
13
+ import { readSettings } from "../../core/store/settings.js";
14
+ import { renderPmCommand } from "../command-line.js";
15
+ import { assertInitializedTracker } from "../environment/tracker-preflight.js";
16
+ import { auditMergeAttributeFence, auditMergeDriverConfiguration, findGitWorkspaceRoot, resolveProjectMergeTypeFolders, } from "../merge/install.js";
17
+ import { inspectMergeReceiptEvidence, partitionMergeReceipts, } from "../merge/receipts.js";
18
+ import { buildValidateHistoryDriftCheck } from "./validate-history-drift.js";
19
+ import { readValidateItems } from "./validate-item-reader.js";
20
+ function selectWorkspacePositionState(params) {
21
+ if (params.invalidEvidenceCount > 0)
22
+ return "merge_evidence_invalid";
23
+ if (!params.historyEvidenceValid)
24
+ return "history_evidence_invalid";
25
+ if (params.pendingDecisionCount > 0 || params.losslessCount > 0) {
26
+ return "merge_reconciliation_required";
27
+ }
28
+ if (params.driftedItemCount > 0)
29
+ return "history_repair_required";
30
+ if (params.fence.status !== "ok" ||
31
+ params.drivers === null ||
32
+ params.drivers.status !== "ok") {
33
+ return "merge_fence_unprepared";
34
+ }
35
+ return "ready";
36
+ }
37
+ function commandForWorkspacePositionState(state, pmRoot, platform = process.platform) {
38
+ const commandArgs = ["--pm-path", pmRoot];
39
+ if (state === "merge_evidence_invalid")
40
+ return renderPmCommand([...commandArgs, "merge", "report"], platform);
41
+ if (state === "history_evidence_invalid") {
42
+ return renderPmCommand([...commandArgs, "validate", "--check-history-drift", "--full"], platform);
43
+ }
44
+ if (state === "merge_reconciliation_required") {
45
+ return renderPmCommand([...commandArgs, "merge", "reconcile"], platform);
46
+ }
47
+ if (state === "history_repair_required") {
48
+ return renderPmCommand([...commandArgs, "history-repair", "--all"], platform);
49
+ }
50
+ if (state === "merge_fence_unprepared") {
51
+ return renderPmCommand([...commandArgs, "merge", "install"], platform);
52
+ }
53
+ return null;
54
+ }
55
+ /** Normalize defensive history-check evidence into the bounded position shape. */
56
+ function normalizeWorkspaceHistoryDrift(details) {
57
+ const driftedItemIds = Array.isArray(details.drifted_items)
58
+ ? details.drifted_items.filter((entry) => typeof entry === "string")
59
+ : [];
60
+ const evidenceValid = Array.isArray(details.drifted_items) &&
61
+ details.drifted_items.every((entry) => typeof entry === "string") &&
62
+ typeof details.drifted_items_count === "number" &&
63
+ Number.isInteger(details.drifted_items_count) &&
64
+ details.drifted_items_count >= 0 &&
65
+ typeof details.drifted_items_truncated === "boolean" &&
66
+ typeof details.counts === "object" &&
67
+ details.counts !== null &&
68
+ !Array.isArray(details.counts);
69
+ return {
70
+ evidence_valid: evidenceValid,
71
+ drifted_item_count: typeof details.drifted_items_count === "number"
72
+ ? details.drifted_items_count
73
+ : driftedItemIds.length,
74
+ drifted_item_ids: driftedItemIds,
75
+ drifted_item_ids_truncated: details.drifted_items_truncated === true,
76
+ counts: typeof details.counts === "object" && details.counts !== null
77
+ ? details.counts
78
+ : {},
79
+ };
80
+ }
81
+ /** Read aggregate workspace position without flags, session state, or mutation. */
82
+ export async function readWorkspacePosition(global) {
83
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
84
+ await assertInitializedTracker(pmRoot);
85
+ const settings = await readSettings(pmRoot);
86
+ const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
87
+ const itemReadWarnings = [];
88
+ const items = await readValidateItems({
89
+ includeBody: true,
90
+ pmRoot,
91
+ settings,
92
+ typeToFolder: typeRegistry.type_to_folder,
93
+ warnings: itemReadWarnings,
94
+ });
95
+ const gitWorkspaceRoot = await findGitWorkspaceRoot(pmRoot);
96
+ const [fence, drivers, receiptEvidence, drift] = await Promise.all([
97
+ auditMergeAttributeFence(pmRoot, resolveProjectMergeTypeFolders(settings)),
98
+ gitWorkspaceRoot === null
99
+ ? Promise.resolve(null)
100
+ : auditMergeDriverConfiguration(gitWorkspaceRoot),
101
+ inspectMergeReceiptEvidence(gitWorkspaceRoot ?? pmRoot, {
102
+ includeLossless: true,
103
+ pmRoot,
104
+ }),
105
+ buildValidateHistoryDriftCheck(pmRoot, items, false),
106
+ ]);
107
+ const { pendingDecisions, lossless } = partitionMergeReceipts(receiptEvidence.receipts);
108
+ const pendingItemIds = [
109
+ ...new Set(pendingDecisions.map((receipt) => receipt.item_id)),
110
+ ].sort((left, right) => left.localeCompare(right));
111
+ const driftDetails = drift.check.details;
112
+ const historyDrift = normalizeWorkspaceHistoryDrift(driftDetails);
113
+ const state = selectWorkspacePositionState({
114
+ invalidEvidenceCount: receiptEvidence.invalid_evidence_count,
115
+ pendingDecisionCount: pendingDecisions.length,
116
+ losslessCount: lossless.length,
117
+ historyEvidenceValid: historyDrift.evidence_valid,
118
+ driftedItemCount: historyDrift.drifted_item_count,
119
+ fence,
120
+ drivers,
121
+ });
122
+ return {
123
+ ok: state === "ready",
124
+ state,
125
+ merge_fence: {
126
+ committed: fence,
127
+ clone_local_drivers: drivers,
128
+ },
129
+ merge_receipts: {
130
+ pending_decision_count: pendingDecisions.length,
131
+ pending_item_ids: pendingItemIds.slice(0, 25),
132
+ pending_item_ids_truncated: pendingItemIds.length > 25,
133
+ lossless_count: lossless.length,
134
+ invalid_evidence_count: receiptEvidence.invalid_evidence_count,
135
+ },
136
+ history_drift: historyDrift,
137
+ next_action: {
138
+ command: commandForWorkspacePositionState(state, pmRoot),
139
+ reason: state,
140
+ },
141
+ warnings: [...new Set(itemReadWarnings)].sort((left, right) => left.localeCompare(right)),
142
+ generated_at: nowIso(),
143
+ };
144
+ }
145
+ /** Render the bounded workspace position for human CLI output. */
146
+ export function formatWorkspacePositionHuman(result) {
147
+ const action = result.next_action.command ?? "none";
148
+ return [
149
+ `workspace_position: ${result.state}`,
150
+ `merge_fence: ${result.merge_fence.committed.status}`,
151
+ `clone_local_drivers: ${result.merge_fence.clone_local_drivers?.status ?? "unavailable"}`,
152
+ `pending_merge_decisions: ${result.merge_receipts.pending_decision_count}`,
153
+ `history_drifted_items: ${result.history_drift.drifted_item_count}`,
154
+ `next_action: ${action}`,
155
+ ].join("\n");
156
+ }
157
+ /** Public contract for focused unit verification. */
158
+ export const _testOnlyWorkspacePosition = {
159
+ commandForWorkspacePositionState,
160
+ normalizeWorkspaceHistoryDrift,
161
+ selectWorkspacePositionState,
162
+ };
163
+ //# sourceMappingURL=workspace-position.js.map
164
+ //# debugId=e900c117-6d8d-55d3-86df-f543dc499930
@@ -16,6 +16,8 @@ export * from "./governance/defect-recurrence.js";
16
16
  export { runReindex, type ReindexOptions, type ReindexResult, } from "./governance/reindex.js";
17
17
  export * from "./governance/stale-work.js";
18
18
  export * from "./governance/storage-integrity.js";
19
+ export * from "./governance/status-role-diagnostics.js";
20
+ export * from "./governance/workspace-position.js";
19
21
  export { runUpgrade, type UpgradeCliResult, type UpgradeCommandOptions, type UpgradeCommandRunner, type UpgradeCommandRunnerResult, type UpgradePackageResult, type UpgradeResult, } from "./governance/upgrade.js";
20
22
  export * from "./governance/validate.js";
21
23
  export * from "./author-attribution.js";
@@ -4,7 +4,7 @@
4
4
  * Provides validation, health, integrity, and mutation-policy primitives.
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]="c2063b82-58b6-54c9-baff-ca252cadf463")}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]="ff251826-36f0-5b92-bee8-ca71d265986c")}catch(e){}}();
8
8
  export * from "./governance/gc.js";
9
9
  export * from "./governance/health.js";
10
10
  export * from "./governance/extension-host-version.js";
@@ -18,6 +18,8 @@ export * from "./governance/defect-recurrence.js";
18
18
  export { runReindex, } from "./governance/reindex.js";
19
19
  export * from "./governance/stale-work.js";
20
20
  export * from "./governance/storage-integrity.js";
21
+ export * from "./governance/status-role-diagnostics.js";
22
+ export * from "./governance/workspace-position.js";
21
23
  export { runUpgrade, } from "./governance/upgrade.js";
22
24
  export * from "./governance/validate.js";
23
25
  export * from "./author-attribution.js";
@@ -25,4 +27,4 @@ export * from "./mutation-guard.js";
25
27
  export * from "./governance/provenance-health.js";
26
28
  export * from "./similarity.js";
27
29
  //# sourceMappingURL=governance.js.map
28
- //# debugId=c2063b82-58b6-54c9-baff-ca252cadf463
30
+ //# debugId=ff251826-36f0-5b92-bee8-ca71d265986c
@@ -170,7 +170,7 @@ export { readImprovementLedger, recordImprovementObservation, type ImprovementDi
170
170
  export { evaluateProvenanceCoverage, projectFleetAttributionAnalytics, projectProvenanceCoverageAnalytics, readHistoryAnalyticsWindow, runFleetAttributionAnalytics, runProvenanceCoverageAnalytics, type FleetAttributionAnalytics, type FleetAttributionDimension, type FleetAttributionRow, type HistoryAnalyticsWindowOptions, type HistoryAnalyticsWindowReceipt, type HistoryAnalyticsEvent, type HistoryAnalyticsWindow, type ProvenanceCoverageAnalytics, } from "./history-analytics.js";
171
171
  export { DEFAULT_EVAL_QUERIES_RELATIVE_PATH, EVAL_QUERY_SET_CONTRACT, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, parseEvalQuerySet, runEval, type EvalOptions, type EvalQueryReport, type EvalResult, } from "./eval.js";
172
172
  export { runTelemetry, TELEMETRY_SUBCOMMANDS, type TelemetryCommandOptions, type TelemetryFlushResult, type TelemetryStatusSummary, type TelemetrySubcommand, } from "./telemetry.js";
173
- export { classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, type LinkedTestFailureCategory, type TestCommandOptions, type TestResult, type TestRunResult, } from "./test/execution.js";
173
+ export { classifyLinkedTestCommandSafety, classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, type LinkedTestFailureCategory, type LinkedTestCommandSafetyClassification, type TestCommandOptions, type TestResult, type TestRunResult, } from "./test/execution.js";
174
174
  export { TEST_RUN_MEASUREMENT_LIMIT, diffTestRunMeasurements, parseTestRunMeasurements, queryTestRunMeasurementsBelow, type TestRunMeasurementDiff, } from "./test/measurements.js";
175
175
  export { runTestAll, type TestAllCommandOptions, type TestAllItemResult, type TestAllResult, } from "./test/batch.js";
176
176
  export { LINKED_TEST_ENV_NAME_PATTERN, LINKED_TEST_PM_CONTEXT_MODE_VALUES, LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES, LINKED_TEST_PROTECTED_ENV_KEYS, parseLinkedTestAssertionEqualsMap, parseLinkedTestAssertionGteMap, parseLinkedTestBoolean, parseLinkedTestContextMode, parseLinkedTestEnvClear, parseLinkedTestEnvSet, parseLinkedTestJsonEntries, parseLinkedTestMinLines, parseLinkedTestRegexList, parseLinkedTestStringList, parseLinkedTestWorkspaceContextMode, type LinkedTestPmContextMode, type LinkedTestWorkspaceContextMode, } from "./test/parsers.js";
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Defines public SDK APIs and package-author helpers for Index.
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]="ea1845ab-34f5-5a1c-ad49-ac81495c1840")}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]="a903cbbb-e8b7-57d2-8f60-48885c6261a1")}catch(e){}}();
8
8
  export { PM_COMMAND_CAPABILITY_CONTRACTS, PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForFamily, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandCapabilityFamily, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
9
9
  export * from "./mcp/protocol.js";
10
10
  export * from "./mcp/interactions.js";
@@ -161,7 +161,7 @@ export { readImprovementLedger, recordImprovementObservation, } from "./improvem
161
161
  export { evaluateProvenanceCoverage, projectFleetAttributionAnalytics, projectProvenanceCoverageAnalytics, readHistoryAnalyticsWindow, runFleetAttributionAnalytics, runProvenanceCoverageAnalytics, } from "./history-analytics.js";
162
162
  export { DEFAULT_EVAL_QUERIES_RELATIVE_PATH, EVAL_QUERY_SET_CONTRACT, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, parseEvalQuerySet, runEval, } from "./eval.js";
163
163
  export { runTelemetry, TELEMETRY_SUBCOMMANDS, } from "./telemetry.js";
164
- export { classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, } from "./test/execution.js";
164
+ export { classifyLinkedTestCommandSafety, classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, } from "./test/execution.js";
165
165
  export { TEST_RUN_MEASUREMENT_LIMIT, diffTestRunMeasurements, parseTestRunMeasurements, queryTestRunMeasurementsBelow, } from "./test/measurements.js";
166
166
  export { runTestAll, } from "./test/batch.js";
167
167
  export { LINKED_TEST_ENV_NAME_PATTERN, LINKED_TEST_PM_CONTEXT_MODE_VALUES, LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES, LINKED_TEST_PROTECTED_ENV_KEYS, parseLinkedTestAssertionEqualsMap, parseLinkedTestAssertionGteMap, parseLinkedTestBoolean, parseLinkedTestContextMode, parseLinkedTestEnvClear, parseLinkedTestEnvSet, parseLinkedTestJsonEntries, parseLinkedTestMinLines, parseLinkedTestRegexList, parseLinkedTestStringList, parseLinkedTestWorkspaceContextMode, } from "./test/parsers.js";
@@ -176,4 +176,4 @@ export * from "./governance.js";
176
176
  export * from "./query.js";
177
177
  export * from "./testing.js";
178
178
  //# sourceMappingURL=index.js.map
179
- //# debugId=ea1845ab-34f5-5a1c-ad49-ac81495c1840
179
+ //# debugId=a903cbbb-e8b7-57d2-8f60-48885c6261a1
@@ -6,8 +6,16 @@
6
6
  */
7
7
  /** Canonical stateless MCP revision implemented by pm. */
8
8
  export declare const PM_MCP_PROTOCOL_VERSION: "2026-07-28";
9
- /** Legacy initialize-era revisions accepted only by the bounded stdio adapter. */
10
- export declare const PM_MCP_LEGACY_PROTOCOL_VERSIONS: readonly ["2025-06-18"];
9
+ /**
10
+ * Legacy initialize-era revisions accepted only by the bounded stdio adapter.
11
+ *
12
+ * The canonical revision defines legacy as every version that establishes a
13
+ * session with the handshake method, which is `2025-11-25` and earlier, so this
14
+ * set tracks that boundary rather than a single historical revision.
15
+ * Ordered newest first: element zero is the revision offered to a client that
16
+ * omits `protocolVersion`.
17
+ */
18
+ export declare const PM_MCP_LEGACY_PROTOCOL_VERSIONS: readonly ["2025-11-25", "2025-06-18"];
11
19
  /** Modern per-request protocol versions accepted by the stateless core. */
12
20
  export declare const PM_MCP_SUPPORTED_PROTOCOL_VERSIONS: readonly ["2026-07-28"];
13
21
  /** Allocated MCP 2026-07-28 protocol error codes. */
@@ -6,10 +6,21 @@
6
6
  */
7
7
  /** Canonical stateless MCP revision implemented by pm. */
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]="9cb05a78-f95d-5211-a35a-03756f66c812")}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]="0ec82581-c626-544c-9deb-ec5e810fd7e9")}catch(e){}}();
10
10
  export const PM_MCP_PROTOCOL_VERSION = "2026-07-28";
11
- /** Legacy initialize-era revisions accepted only by the bounded stdio adapter. */
12
- export const PM_MCP_LEGACY_PROTOCOL_VERSIONS = ["2025-06-18"];
11
+ /**
12
+ * Legacy initialize-era revisions accepted only by the bounded stdio adapter.
13
+ *
14
+ * The canonical revision defines legacy as every version that establishes a
15
+ * session with the handshake method, which is `2025-11-25` and earlier, so this
16
+ * set tracks that boundary rather than a single historical revision.
17
+ * Ordered newest first: element zero is the revision offered to a client that
18
+ * omits `protocolVersion`.
19
+ */
20
+ export const PM_MCP_LEGACY_PROTOCOL_VERSIONS = [
21
+ "2025-11-25",
22
+ "2025-06-18",
23
+ ];
13
24
  /** Modern per-request protocol versions accepted by the stateless core. */
14
25
  export const PM_MCP_SUPPORTED_PROTOCOL_VERSIONS = [
15
26
  PM_MCP_PROTOCOL_VERSION,
@@ -171,4 +182,4 @@ export function interpretMcpResultType(result, era) {
171
182
  throw new PmMcpProtocolError("Modern MCP result is missing resultType", PM_MCP_ERROR_CODES.invalidParams, { required: "resultType" });
172
183
  }
173
184
  //# sourceMappingURL=protocol.js.map
174
- //# debugId=9cb05a78-f95d-5211-a35a-03756f66c812
185
+ //# debugId=0ec82581-c626-544c-9deb-ec5e810fd7e9
@@ -4,7 +4,7 @@
4
4
  * Implements the pm context 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]="ee5279f2-7489-59fb-8f96-f2e035434cce")}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]="a870e3ac-f731-5cbf-a66e-38d1d5b1d0aa")}catch(e){}}();
8
8
  import { SETTINGS_DEFAULTS, EXIT_CODE, PmCliError, compareTimestampStrings, nowIso, isTerminalStatus, normalizeStatusForRegistry, normalizeStatusInput, resolveRuntimeStatusRegistry, resolvePmRoot, readSettings, resolveAuthor, discoverExtensions, } from "../runtime-primitives.js";
9
9
  import { collectDependencyBlockedIds, resolveItemBlockers, } from "../actionability.js";
10
10
  import { CONTEXT_DEPTH_VALUES, CONTEXT_SECTION_VALUES, } from "../../types/index.js";
@@ -221,20 +221,16 @@ function parseStaleThresholdDays(raw, settings) {
221
221
  // ---------------------------------------------------------------------------
222
222
  function statusRank(status, statusRegistry) {
223
223
  const normalizedStatus = normalizeStatusForRegistry(status, statusRegistry);
224
- const inProgressStatus = normalizeStatusInput("in_progress", statusRegistry);
225
- const openStatus = normalizeStatusInput("open", statusRegistry);
226
224
  const blockedStatus = normalizeStatusInput("blocked", statusRegistry);
227
225
  const draftStatus = normalizeStatusInput("draft", statusRegistry);
228
- if (inProgressStatus && normalizedStatus === inProgressStatus)
226
+ if (normalizedStatus === statusRegistry.in_progress_status)
229
227
  return 0;
230
- if (openStatus && normalizedStatus === openStatus)
228
+ if (statusRegistry.active_statuses.has(normalizedStatus))
231
229
  return 1;
232
230
  if (blockedStatus && normalizedStatus === blockedStatus)
233
231
  return 2;
234
232
  if (draftStatus && normalizedStatus === draftStatus)
235
233
  return 3;
236
- if (statusRegistry.active_statuses.has(normalizedStatus))
237
- return 4;
238
234
  if (statusRegistry.blocked_statuses.has(normalizedStatus))
239
235
  return 5;
240
236
  if (statusRegistry.terminal_statuses.has(normalizedStatus))
@@ -246,12 +242,13 @@ function isClosedStatus(status, statusRegistry) {
246
242
  return normalizeStatusForRegistry(status, statusRegistry) === closeStatus;
247
243
  }
248
244
  function isInProgressStatus(status, statusRegistry) {
249
- const inProgressStatus = normalizeStatusInput("in_progress", statusRegistry);
250
- return (normalizeStatusForRegistry(status, statusRegistry) === inProgressStatus);
245
+ return (normalizeStatusForRegistry(status, statusRegistry) ===
246
+ statusRegistry.in_progress_status);
251
247
  }
252
248
  function isOpenStatus(status, statusRegistry) {
253
- const openStatus = normalizeStatusInput("open", statusRegistry);
254
- return normalizeStatusForRegistry(status, statusRegistry) === openStatus;
249
+ const normalizedStatus = normalizeStatusForRegistry(status, statusRegistry);
250
+ return (normalizedStatus !== statusRegistry.in_progress_status &&
251
+ statusRegistry.active_statuses.has(normalizedStatus));
255
252
  }
256
253
  function isBlockedStatus(status, statusRegistry) {
257
254
  return statusRegistry.blocked_statuses.has(normalizeStatusForRegistry(status, statusRegistry));
@@ -1598,8 +1595,8 @@ export async function runContext(options, global) {
1598
1595
  now: agendaContext.agenda.now,
1599
1596
  });
1600
1597
  const warnings = mergeSortedWarnings(corpus.listed.warnings, agendaContext.agenda.warnings, focusGroups.ranking.warnings, [...focusGroups.featureStore.warnings], workspaceMemory.warnings);
1601
- const inProgressCount = countContextStatus(focusGroups.activeItems, normalizeStatusInput("in_progress", runtime.statusRegistry), runtime.statusRegistry);
1602
- const openCount = countContextStatus(focusGroups.activeItems, normalizeStatusInput("open", runtime.statusRegistry), runtime.statusRegistry);
1598
+ const inProgressCount = countContextStatus(focusGroups.activeItems, runtime.statusRegistry.in_progress_status, runtime.statusRegistry);
1599
+ const openCount = focusGroups.activeItems.length - inProgressCount;
1603
1600
  const sections = await buildOptionalContextSections({
1604
1601
  runtime,
1605
1602
  allItems: corpus.allItems,
@@ -1679,4 +1676,4 @@ export async function runContext(options, global) {
1679
1676
  return result;
1680
1677
  }
1681
1678
  //# sourceMappingURL=context.js.map
1682
- //# debugId=ee5279f2-7489-59fb-8f96-f2e035434cce
1679
+ //# debugId=a870e3ac-f731-5cbf-a66e-38d1d5b1d0aa
@@ -56,6 +56,8 @@ export interface ListOptions extends SharedItemFilterOptions {
56
56
  * lifecycle-status filter.
57
57
  */
58
58
  dependencyBlocked?: boolean;
59
+ /** Select a role-derived active lifecycle bucket instead of one literal status id. */
60
+ lifecycleBucket?: "open" | "in_progress";
59
61
  /** Value that configures or reports filter ac missing for this contract. */
60
62
  filterAcMissing?: boolean;
61
63
  /** Value that configures or reports filter estimates missing for this contract. */