@unbrained/pm-cli 2026.9.2 → 2026.9.3

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 (123) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +17 -0
  3. package/dist/cli/after-command-context-usage.js +16 -3
  4. package/dist/cli-bundle/bundle-manifest.json +154 -154
  5. package/dist/cli-bundle/chunks/{chunk-T6H5BZCP.js → chunk-34HASX3S.js} +2 -2
  6. package/dist/cli-bundle/chunks/chunk-AY324UJ5.js +9 -0
  7. package/dist/cli-bundle/chunks/{chunk-TAG4VC22.js → chunk-DKGP3QLE.js} +27 -27
  8. package/dist/cli-bundle/chunks/chunk-E5RBBCXO.js +230 -0
  9. package/dist/cli-bundle/chunks/{chunk-DTGWEL23.js → chunk-EDPIS7EB.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-X4RCGLTX.js → chunk-IEHHE6GA.js} +5 -5
  11. package/dist/cli-bundle/chunks/{chunk-UDW64J2W.js → chunk-L7B7343B.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-FZ4Z2J4F.js → chunk-LENC656S.js} +41 -41
  13. package/dist/cli-bundle/chunks/{chunk-ZLJIFSOE.js → chunk-LISESA7W.js} +33 -33
  14. package/dist/cli-bundle/chunks/{chunk-3WICXLVT.js → chunk-UPPM2FOZ.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-Y7VOMSZT.js → chunk-Y4PJ6HPK.js} +2 -2
  16. package/dist/cli-bundle/chunks/{register-list-query-XYNX4ASQ.js → register-list-query-W2ZTOMKP.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-mutation-WFQ7MJTX.js → register-mutation-RVND5NCG.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-operations-JVTI7JPP.js → register-operations-TTROIVC4.js} +2 -2
  19. package/dist/cli-bundle/chunks/{register-setup-KVNC5KPL.js → register-setup-D3ZFHY3L.js} +2 -2
  20. package/dist/cli-bundle/focused-chunks/chunk-3ZBI35HU.js +176 -0
  21. package/dist/cli-bundle/focused-chunks/{chunk-SVXJYD6G.js → chunk-4HJFY4MB.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/chunk-4RRHC3S4.js +6 -0
  23. package/dist/cli-bundle/focused-chunks/chunk-4WR46RMG.js +9 -0
  24. package/dist/cli-bundle/focused-chunks/chunk-5RFXUPN5.js +3 -0
  25. package/dist/cli-bundle/focused-chunks/chunk-BWKHEIVF.js +2 -0
  26. package/dist/cli-bundle/focused-chunks/{chunk-4O4CJAR6.js → chunk-D7KXFBXV.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-MKHG3T76.js → chunk-GHCZ3YFR.js} +3 -3
  28. package/dist/cli-bundle/focused-chunks/{chunk-KB5OFSFD.js → chunk-GT7MXDLW.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-KBLZRU62.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-KZ2NB3ET.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-M5M6SVHS.js +3 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-BEVHCEWG.js → chunk-OL5EH6I3.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-MEASX544.js → chunk-Q45NHPF2.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-O67VDLOT.js → chunk-QKHCSUGJ.js} +42 -42
  35. package/dist/cli-bundle/focused-chunks/chunk-S27XMBIN.js +8 -0
  36. package/dist/cli-bundle/focused-chunks/chunk-TXE4TSHM.js +12 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-UCLO3XDU.js +2 -0
  38. package/dist/cli-bundle/main.js +15 -15
  39. package/dist/cli-bundle/sdk-authoring.js +1 -1
  40. package/dist/cli-bundle/sdk-contracts.js +1 -1
  41. package/dist/cli-bundle/sdk-core.js +28 -28
  42. package/dist/cli-bundle/sdk-governance.js +1 -1
  43. package/dist/cli-bundle/sdk-graph.js +1 -1
  44. package/dist/cli-bundle/sdk-merge.js +35 -33
  45. package/dist/cli-bundle/sdk-query.js +1 -1
  46. package/dist/cli-bundle/sdk-runtime.js +1 -1
  47. package/dist/cli-bundle/sdk-testing.js +1 -1
  48. package/dist/cli-bundle/sdk.js +9 -9
  49. package/dist/core/history/event-classification.d.ts +21 -0
  50. package/dist/core/history/event-classification.js +109 -0
  51. package/dist/core/history/event-index.d.ts +14 -3
  52. package/dist/core/history/event-index.js +543 -88
  53. package/dist/core/history/history.js +47 -18
  54. package/dist/core/history/workspace-history.js +7 -6
  55. package/dist/core/lock/lock.d.ts +22 -2
  56. package/dist/core/lock/lock.js +121 -19
  57. package/dist/core/output/output.js +31 -7
  58. package/dist/core/shared/time.d.ts +2 -0
  59. package/dist/core/shared/time.js +8 -2
  60. package/dist/core/store/item-metadata-query-index.js +5 -5
  61. package/dist/sdk/context/recency.d.ts +9 -0
  62. package/dist/sdk/context/recency.js +34 -0
  63. package/dist/sdk/context/usage-egress.d.ts +9 -0
  64. package/dist/sdk/context/usage-egress.js +30 -0
  65. package/dist/sdk/context-intent-contracts.js +7 -3
  66. package/dist/sdk/context-relevance.d.ts +23 -0
  67. package/dist/sdk/context-relevance.js +94 -23
  68. package/dist/sdk/context-signal-store.d.ts +7 -3
  69. package/dist/sdk/context-signal-store.js +155 -42
  70. package/dist/sdk/context-usage.d.ts +54 -0
  71. package/dist/sdk/context-usage.js +245 -16
  72. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -14
  73. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +14 -2
  74. package/dist/sdk/index.d.ts +2 -0
  75. package/dist/sdk/index.js +4 -2
  76. package/dist/sdk/init.d.ts +2 -0
  77. package/dist/sdk/init.js +18 -9
  78. package/dist/sdk/query/context.d.ts +3 -1
  79. package/dist/sdk/query/context.js +21 -9
  80. package/dist/sdk/query/next.js +18 -9
  81. package/dist/sdk/runtime-input.d.ts +2 -0
  82. package/dist/sdk/runtime-input.js +25 -2
  83. package/dist/sdk/runtime.d.ts +1 -0
  84. package/dist/sdk/runtime.js +17 -26
  85. package/dist/types.d.ts +2 -0
  86. package/dist/types.js +2 -2
  87. package/docs/CONTEXT_RELEVANCE.md +44 -1
  88. package/docs/PERFORMANCE.md +6 -3
  89. package/docs/READ_OUTPUT_CONTRACTS.md +9 -1
  90. package/docs/SDK.md +11 -8
  91. package/docs/SDK_CONTEXT.md +7 -0
  92. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
  93. package/marketplace.json +2 -2
  94. package/package.json +4 -4
  95. package/packages/pm-beads/package.json +1 -1
  96. package/packages/pm-calendar/package.json +1 -1
  97. package/packages/pm-command-kit/package.json +1 -1
  98. package/packages/pm-digital-twin/package.json +1 -1
  99. package/packages/pm-governance-audit/package.json +1 -1
  100. package/packages/pm-guide-shell/package.json +1 -1
  101. package/packages/pm-kanban/package.json +1 -1
  102. package/packages/pm-lifecycle-hooks/package.json +1 -1
  103. package/packages/pm-linked-test-adapters/package.json +1 -1
  104. package/packages/pm-search-advanced/package.json +1 -1
  105. package/packages/pm-templates/package.json +1 -1
  106. package/packages/pm-todos/package.json +1 -1
  107. package/packages/pm-vcs/package.json +1 -1
  108. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  109. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  110. package/sdk/public-surface.json +241 -24
  111. package/dist/cli-bundle/chunks/chunk-GOACULJW.js +0 -13
  112. package/dist/cli-bundle/chunks/chunk-NOPL37X4.js +0 -205
  113. package/dist/cli-bundle/focused-chunks/chunk-242AXYB2.js +0 -2
  114. package/dist/cli-bundle/focused-chunks/chunk-2FEZ5SKM.js +0 -3
  115. package/dist/cli-bundle/focused-chunks/chunk-6GCRSLPG.js +0 -2
  116. package/dist/cli-bundle/focused-chunks/chunk-7VATS5QY.js +0 -16
  117. package/dist/cli-bundle/focused-chunks/chunk-JEFKLWMM.js +0 -2
  118. package/dist/cli-bundle/focused-chunks/chunk-PF3E6Q36.js +0 -8
  119. package/dist/cli-bundle/focused-chunks/chunk-QDFJIRKN.js +0 -4
  120. package/dist/cli-bundle/focused-chunks/chunk-RMRCQPWU.js +0 -2
  121. package/dist/cli-bundle/focused-chunks/chunk-S4U5CN5Q.js +0 -2
  122. package/dist/cli-bundle/focused-chunks/chunk-T2LXXSOD.js +0 -158
  123. package/dist/cli-bundle/focused-chunks/chunk-Z2USIBR2.js +0 -5
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @module core/history/event-classification
3
+ *
4
+ * Declares the stable semantic boundary between history events that advance
5
+ * project work and maintenance events that only preserve tracker governance.
6
+ */
7
+ import type { HistoryEntry } from "../../types/index.js";
8
+ /** Current version of the public history-event classification policy. */
9
+ export declare const HISTORY_EVENT_CLASSIFICATION_VERSION: 1;
10
+ /** Semantic effect of an immutable history event on project recency. */
11
+ export type HistoryEventClass = "substantive" | "maintenance";
12
+ /** Operations whose meaning is always governance or storage maintenance. */
13
+ export declare const MAINTENANCE_HISTORY_OPERATIONS: readonly ["docs_add", "files_add", "history:author-acknowledge", "history_author_acknowledge", "history_compact", "history_compact_baseline", "history_redact", "history_repair", "normalize", "release", "test_run_track", "tests_add", "tests_remove", "update_audit", "update_ownership_bypass"];
14
+ /** Operations whose meaning always advances lifecycle or working context. */
15
+ export declare const SUBSTANTIVE_HISTORY_OPERATIONS: readonly ["append", "cancel", "claim", "close", "comment_add", "create", "learning_add", "note_add", "reopen"];
16
+ /**
17
+ * Classify an immutable event using its declared class when present, then the
18
+ * versioned operation/path contract. Unknown events fail closed as substantive
19
+ * so new work cannot silently disappear from temporal relevance.
20
+ */
21
+ export declare function classifyHistoryEvent(entry: Pick<HistoryEntry, "op" | "patch" | "event_class">): HistoryEventClass;
@@ -0,0 +1,109 @@
1
+ /** Current version of the public history-event classification policy. */
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]="6398c65d-fb5c-5479-93c2-0be963352a92")}catch(e){}}();
4
+ export const HISTORY_EVENT_CLASSIFICATION_VERSION = 1;
5
+ /** Operations whose meaning is always governance or storage maintenance. */
6
+ export const MAINTENANCE_HISTORY_OPERATIONS = [
7
+ "docs_add",
8
+ "files_add",
9
+ "history:author-acknowledge",
10
+ "history_author_acknowledge",
11
+ "history_compact",
12
+ "history_compact_baseline",
13
+ "history_redact",
14
+ "history_repair",
15
+ "normalize",
16
+ "release",
17
+ "test_run_track",
18
+ "tests_add",
19
+ "tests_remove",
20
+ "update_audit",
21
+ "update_ownership_bypass",
22
+ ];
23
+ /** Operations whose meaning always advances lifecycle or working context. */
24
+ export const SUBSTANTIVE_HISTORY_OPERATIONS = [
25
+ "append",
26
+ "cancel",
27
+ "claim",
28
+ "close",
29
+ "comment_add",
30
+ "create",
31
+ "learning_add",
32
+ "note_add",
33
+ "reopen",
34
+ ];
35
+ const MAINTENANCE_OPERATIONS = new Set(MAINTENANCE_HISTORY_OPERATIONS);
36
+ const SUBSTANTIVE_OPERATIONS = new Set(SUBSTANTIVE_HISTORY_OPERATIONS);
37
+ const MAINTENANCE_UPDATE_FIELDS = new Set([
38
+ "actual_result",
39
+ "affected_version",
40
+ "assignee",
41
+ "blocked_by",
42
+ "blocked_reason",
43
+ "close_reason",
44
+ "confidence",
45
+ "customer_impact",
46
+ "definition_of_ready",
47
+ "dependencies",
48
+ "docs",
49
+ "environment",
50
+ "expected_result",
51
+ "files",
52
+ "fixed_version",
53
+ "goal",
54
+ "impact",
55
+ "learnings",
56
+ "notes",
57
+ "objective",
58
+ "order",
59
+ "outcome",
60
+ "parent",
61
+ "release",
62
+ "reminders",
63
+ "reporter",
64
+ "repro_steps",
65
+ "resolution",
66
+ "reviewer",
67
+ "severity",
68
+ "sprint",
69
+ "tests",
70
+ "test_runs",
71
+ "unblock_note",
72
+ "updated_at",
73
+ "value",
74
+ "why_now",
75
+ ]);
76
+ function topLevelPatchField(operation) {
77
+ const segments = operation.path.split("/").filter(Boolean);
78
+ if (segments[0] === "metadata" || segments[0] === "front_matter") {
79
+ return segments[1];
80
+ }
81
+ return segments[0] === "body" ? "body" : undefined;
82
+ }
83
+ /**
84
+ * Classify an immutable event using its declared class when present, then the
85
+ * versioned operation/path contract. Unknown events fail closed as substantive
86
+ * so new work cannot silently disappear from temporal relevance.
87
+ */
88
+ export function classifyHistoryEvent(entry) {
89
+ if (entry.event_class === "substantive" ||
90
+ entry.event_class === "maintenance") {
91
+ return entry.event_class;
92
+ }
93
+ if (MAINTENANCE_OPERATIONS.has(entry.op))
94
+ return "maintenance";
95
+ if (SUBSTANTIVE_OPERATIONS.has(entry.op))
96
+ return "substantive";
97
+ if (entry.op !== "update")
98
+ return "substantive";
99
+ return Array.isArray(entry.patch) &&
100
+ entry.patch.length > 0 &&
101
+ entry.patch.every((operation) => {
102
+ const field = topLevelPatchField(operation);
103
+ return field !== undefined && MAINTENANCE_UPDATE_FIELDS.has(field);
104
+ })
105
+ ? "maintenance"
106
+ : "substantive";
107
+ }
108
+ //# sourceMappingURL=event-classification.js.map
109
+ //# debugId=6398c65d-fb5c-5479-93c2-0be963352a92
@@ -47,6 +47,8 @@ export interface HistoryEventIndexQueryResult {
47
47
  /** Whether another matching event exists. */
48
48
  has_more: boolean;
49
49
  }
50
+ /** Latest substantive immutable event for each requested history stream. */
51
+ export type LatestSubstantiveHistoryEvents = Readonly<Record<string, IndexedHistoryEvent>>;
50
52
  declare function loadDatabaseSync(loadModule: (specifier: string) => unknown): DatabaseSyncConstructor | null;
51
53
  declare function loadStableDatabaseSync(nodeVersion: string, loadModule: (specifier: string) => unknown): DatabaseSyncConstructor | null;
52
54
  /** Rebuild the complete optional event projection from authoritative streams. */
@@ -57,16 +59,25 @@ export declare function rebuildHistoryEventIndex(pmRoot: string): Promise<boolea
57
59
  */
58
60
  export declare function queryHistoryEventStreams(pmRoot: string, query: HistoryEventIndexQuery): Promise<HistoryEventIndexQueryResult>;
59
61
  /**
60
- * Update an already-built event projection after one authoritative append.
61
- * Absence is a cheap no-op; corrupt projections are removed for lazy rebuild.
62
+ * Serialize an authoritative append with its optional SQLite projection.
63
+ * The database write lock spans the file append and size capture, so compliant
64
+ * cross-process writers cannot certify a newer stream size with older rows.
62
65
  */
63
- export declare function updateHistoryEventIndexAfterAppend(historyPath: string, entry: HistoryEntry): Promise<void>;
66
+ export declare function appendHistoryEntryWithEventIndex(historyPath: string, entry: HistoryEntry, append: () => Promise<void>): Promise<void>;
64
67
  /** Invalidate the optional event projection after a non-append rewrite. */
65
68
  export declare function removeHistoryEventIndexForHistoryPath(historyPath: string): Promise<void>;
66
69
  /** Query the optional event projection without scanning history streams. */
67
70
  export declare function queryHistoryEventIndex(pmRoot: string, query: HistoryEventIndexQuery): Promise<HistoryEventIndexQueryResult | null>;
71
+ declare function collectLatestSubstantiveEvents(events: readonly IndexedHistoryEvent[], requested: ReadonlySet<string>): Record<string, IndexedHistoryEvent>;
72
+ /**
73
+ * Read one latest substantive coordinate per requested stream. The optional
74
+ * SQLite projection is preferred; individual authoritative streams are the
75
+ * fail-closed fallback and remain the source of truth.
76
+ */
77
+ export declare function readLatestSubstantiveHistoryEvents(pmRoot: string, streamIds: readonly string[]): Promise<LatestSubstantiveHistoryEvents>;
68
78
  /** Test-only dependency seam for runtimes without `node:sqlite`. */
69
79
  export declare const _testOnly: {
80
+ collectLatestSubstantiveEvents: typeof collectLatestSubstantiveEvents;
70
81
  loadDatabaseSync: typeof loadDatabaseSync;
71
82
  loadStableDatabaseSync: typeof loadStableDatabaseSync;
72
83
  setDatabaseSync(databaseSync: DatabaseSyncConstructor | null): () => void;