@unbrained/pm-cli 2026.8.11 → 2026.8.13

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 (250) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +74 -21
  3. package/dist/cli/commander-usage.js +37 -11
  4. package/dist/cli/error-guidance.d.ts +2 -0
  5. package/dist/cli/error-guidance.js +82 -19
  6. package/dist/cli/main.js +35 -19
  7. package/dist/cli/register-annotations.js +56 -3
  8. package/dist/cli/register-assurance.js +28 -17
  9. package/dist/cli/register-list-query.js +10 -7
  10. package/dist/cli/register-operations.js +16 -6
  11. package/dist/cli-bundle/bundle-manifest.json +163 -163
  12. package/dist/cli-bundle/chunks/chunk-3ZMOWAFM.js +2 -0
  13. package/dist/cli-bundle/chunks/chunk-DEDU3DG7.js +196 -0
  14. package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +13 -0
  15. package/dist/cli-bundle/chunks/chunk-F7FJYGK3.js +8 -0
  16. package/dist/cli-bundle/chunks/chunk-HIUZVCMN.js +5 -0
  17. package/dist/cli-bundle/chunks/chunk-IMGIN7R6.js +2 -0
  18. package/dist/cli-bundle/chunks/{chunk-A2SJGHSI.js → chunk-Q47C67TQ.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-WMEZHCFI.js → chunk-QGTUPEU5.js} +62 -54
  20. package/dist/cli-bundle/chunks/chunk-TF3TPKPR.js +34 -0
  21. package/dist/cli-bundle/chunks/{chunk-ZU34C3LH.js → chunk-YLBAPY22.js} +50 -50
  22. package/dist/cli-bundle/chunks/register-list-query-4HIZ7EA3.js +10 -0
  23. package/dist/cli-bundle/chunks/register-mutation-W64FZ5HN.js +20 -0
  24. package/dist/cli-bundle/chunks/register-operations-C44ET7R5.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-setup-NOCOOWQY.js → register-setup-634MFRXU.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +31 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-4H5IA6AV.js → chunk-2JP7W7GO.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-2RI2FESN.js +4 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +8 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-2DL3MRTD.js → chunk-3DJSGWVB.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-6MLIRBLV.js +5 -0
  32. package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +155 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-TL5M2PAY.js → chunk-E3AVJ655.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-EBTNSFYE.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-J5EKAIVD.js → chunk-HC2OL2H2.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-BKPIY34S.js → chunk-I75MANL7.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-IIS2FRKL.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-NFHFZH2Z.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +17 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-UDAZWT25.js → chunk-OOYYKQWX.js} +4 -4
  42. package/dist/cli-bundle/focused-chunks/{chunk-23FTGO3W.js → chunk-PKPOZXLL.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-QDZUABWL.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +16 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-55BIB6DV.js → chunk-TEZIXMTH.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +18 -0
  47. package/dist/cli-bundle/main.js +13 -13
  48. package/dist/cli-bundle/sdk-authoring.js +1 -1
  49. package/dist/cli-bundle/sdk-contracts.js +1 -1
  50. package/dist/cli-bundle/sdk-core.js +42 -41
  51. package/dist/cli-bundle/sdk-governance.js +1 -1
  52. package/dist/cli-bundle/sdk-graph.js +1 -1
  53. package/dist/cli-bundle/sdk-merge.js +1 -1
  54. package/dist/cli-bundle/sdk-query.js +1 -1
  55. package/dist/cli-bundle/sdk-runtime.js +1 -1
  56. package/dist/cli-bundle/sdk-testing.js +1 -1
  57. package/dist/cli-bundle/sdk.js +2 -2
  58. package/dist/core/checkpoint/checkpoint-gc.js +7 -12
  59. package/dist/core/extensions/activation-summary-markdown.js +5 -4
  60. package/dist/core/extensions/activation-summary.d.ts +2 -0
  61. package/dist/core/extensions/activation-summary.js +6 -2
  62. package/dist/core/extensions/capability-usage.d.ts +1 -1
  63. package/dist/core/extensions/capability-usage.js +4 -3
  64. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  65. package/dist/core/extensions/contribution-inventory.js +6 -2
  66. package/dist/core/extensions/extension-registries.js +3 -2
  67. package/dist/core/extensions/extension-types.d.ts +83 -1
  68. package/dist/core/extensions/extension-types.js +3 -2
  69. package/dist/core/extensions/loader.d.ts +2 -8
  70. package/dist/core/extensions/loader.js +53 -144
  71. package/dist/core/extensions/registration-values.d.ts +43 -0
  72. package/dist/core/extensions/registration-values.js +210 -0
  73. package/dist/core/extensions/reserved-host-flags.js +3 -2
  74. package/dist/core/extensions/runtime-registrations.d.ts +3 -1
  75. package/dist/core/extensions/runtime-registrations.js +12 -2
  76. package/dist/core/fs/fs-utils.d.ts +2 -0
  77. package/dist/core/fs/fs-utils.js +7 -3
  78. package/dist/core/history/drift-cache.js +4 -3
  79. package/dist/core/history/drift-scan.js +16 -17
  80. package/dist/core/history/history.d.ts +8 -0
  81. package/dist/core/history/history.js +57 -7
  82. package/dist/core/history/replay.d.ts +9 -1
  83. package/dist/core/history/replay.js +48 -13
  84. package/dist/core/lock/lock-gc.js +8 -13
  85. package/dist/core/lock/lock.js +5 -4
  86. package/dist/core/output/output.d.ts +2 -0
  87. package/dist/core/output/output.js +46 -14
  88. package/dist/core/search/vector-stores.js +6 -11
  89. package/dist/core/shared/command-types.d.ts +2 -0
  90. package/dist/core/shared/command-types.js +2 -2
  91. package/dist/core/shared/errors.d.ts +5 -0
  92. package/dist/core/shared/errors.js +2 -2
  93. package/dist/core/store/item-metadata-cache.d.ts +1 -1
  94. package/dist/core/store/item-metadata-cache.js +16 -9
  95. package/dist/core/telemetry/runtime.d.ts +6 -0
  96. package/dist/core/telemetry/runtime.js +101 -30
  97. package/dist/sdk/agent/command-recovery.d.ts +2 -0
  98. package/dist/sdk/agent/command-recovery.js +10 -2
  99. package/dist/sdk/annotations.js +4 -4
  100. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  101. package/dist/sdk/cli-bootstrap.js +6 -2
  102. package/dist/sdk/cli-contracts/completeness.js +10 -3
  103. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  104. package/dist/sdk/cli-contracts/flag-contracts.js +9 -3
  105. package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
  106. package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
  107. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +40 -6
  108. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +27 -3
  109. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  110. package/dist/sdk/cli-contracts/tool-parameter-tables.js +55 -5
  111. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  112. package/dist/sdk/cli-contracts/tool-schema.js +22 -4
  113. package/dist/sdk/cli-program.js +3 -2
  114. package/dist/sdk/comments.js +4 -3
  115. package/dist/sdk/compile-cache.js +4 -3
  116. package/dist/sdk/completion.js +16 -7
  117. package/dist/sdk/compose.d.ts +3 -1
  118. package/dist/sdk/compose.js +16 -2
  119. package/dist/sdk/context-intent-contracts.js +45 -4
  120. package/dist/sdk/context-signal-store.js +4 -3
  121. package/dist/sdk/core.d.ts +1 -0
  122. package/dist/sdk/core.js +3 -2
  123. package/dist/sdk/extension/install-runtime.js +4 -4
  124. package/dist/sdk/extension/managed-state.js +4 -3
  125. package/dist/sdk/extension-contracts.d.ts +1 -1
  126. package/dist/sdk/flag-invocation-contracts.js +5 -6
  127. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
  128. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1597 -0
  129. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
  130. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
  131. package/dist/sdk/generated-error-code-catalog.js +6 -3140
  132. package/dist/sdk/governance/assurance-action.d.ts +27 -3
  133. package/dist/sdk/governance/assurance-action.js +117 -31
  134. package/dist/sdk/governance/assurance-mutation-error.d.ts +14 -0
  135. package/dist/sdk/governance/assurance-mutation-error.js +58 -0
  136. package/dist/sdk/governance/assurance-presets.d.ts +54 -0
  137. package/dist/sdk/governance/assurance-presets.js +136 -0
  138. package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
  139. package/dist/sdk/governance/assurance-runtime.js +118 -14
  140. package/dist/sdk/governance/assurance.d.ts +51 -6
  141. package/dist/sdk/governance/assurance.js +321 -67
  142. package/dist/sdk/governance/gc.js +5 -11
  143. package/dist/sdk/governance/health.d.ts +3 -1
  144. package/dist/sdk/governance/health.js +24 -7
  145. package/dist/sdk/governance/validate-item-reader.js +3 -3
  146. package/dist/sdk/governance/validate.d.ts +2 -0
  147. package/dist/sdk/governance/validate.js +15 -5
  148. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  149. package/dist/sdk/graph/durable-cache.js +156 -29
  150. package/dist/sdk/graph/governance-contracts.d.ts +12 -0
  151. package/dist/sdk/graph/governance-contracts.js +27 -0
  152. package/dist/sdk/graph/governance.d.ts +44 -2
  153. package/dist/sdk/graph/governance.js +156 -12
  154. package/dist/sdk/guide.js +4 -4
  155. package/dist/sdk/index.d.ts +3 -2
  156. package/dist/sdk/index.js +5 -4
  157. package/dist/sdk/lifecycle/claim.js +10 -3
  158. package/dist/sdk/linked-artifacts.d.ts +2 -0
  159. package/dist/sdk/linked-artifacts.js +29 -4
  160. package/dist/sdk/merge/driver.d.ts +2 -2
  161. package/dist/sdk/merge/driver.js +3 -3
  162. package/dist/sdk/merge/install.js +5 -4
  163. package/dist/sdk/merge/receipts.d.ts +6 -4
  164. package/dist/sdk/merge/receipts.js +7 -5
  165. package/dist/sdk/merge/three-way.d.ts +2 -2
  166. package/dist/sdk/merge/three-way.js +3 -3
  167. package/dist/sdk/output-projection.d.ts +9 -1
  168. package/dist/sdk/output-projection.js +45 -9
  169. package/dist/sdk/query/activity.d.ts +49 -2
  170. package/dist/sdk/query/activity.js +185 -38
  171. package/dist/sdk/query/get.js +19 -2
  172. package/dist/sdk/read-output-contracts.d.ts +5 -1
  173. package/dist/sdk/read-output-contracts.js +17 -2
  174. package/dist/sdk/read-output-session.d.ts +2 -0
  175. package/dist/sdk/read-output-session.js +12 -5
  176. package/dist/sdk/relationship-history.js +5 -5
  177. package/dist/sdk/runtime-primitives.d.ts +3 -3
  178. package/dist/sdk/runtime-primitives.js +5 -5
  179. package/dist/sdk/runtime-stats-options.js +3 -2
  180. package/dist/sdk/runtime.js +5 -9
  181. package/dist/sdk/schema-migration.js +4 -4
  182. package/dist/sdk/stats.d.ts +36 -3
  183. package/dist/sdk/stats.js +55 -15
  184. package/dist/sdk/test/execution.d.ts +4 -0
  185. package/dist/sdk/test/execution.js +88 -23
  186. package/dist/sdk/workspace-memory.js +4 -4
  187. package/dist/sdk/workspace-snapshot.js +8 -14
  188. package/dist/sdk/workspace-transaction-gc.js +4 -9
  189. package/dist/sdk/workspace-transaction.js +4 -4
  190. package/dist/sdk/workspace.js +4 -3
  191. package/dist/types.d.ts +2 -0
  192. package/dist/types.js +2 -2
  193. package/docs/ASSURANCE.md +170 -14
  194. package/docs/COMMANDS.md +29 -8
  195. package/docs/CONFIGURATION.md +9 -0
  196. package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
  197. package/docs/EXTENSIONS.md +11 -12
  198. package/docs/MERGE_SAFETY.md +3 -1
  199. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
  200. package/docs/README.md +2 -0
  201. package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
  202. package/docs/RELATIONSHIP_GRAPH.md +15 -0
  203. package/docs/SDK.md +17 -3
  204. package/docs/SDK_AGENT_SESSION_CONTEXT.md +12 -1
  205. package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
  206. package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
  207. package/docs/TESTING.md +24 -15
  208. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
  209. package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
  210. package/marketplace.json +2 -2
  211. package/package.json +6 -6
  212. package/packages/pm-beads/package.json +1 -1
  213. package/packages/pm-calendar/package.json +1 -1
  214. package/packages/pm-command-kit/package.json +1 -1
  215. package/packages/pm-digital-twin/package.json +1 -1
  216. package/packages/pm-governance-audit/package.json +1 -1
  217. package/packages/pm-guide-shell/package.json +1 -1
  218. package/packages/pm-kanban/package.json +1 -1
  219. package/packages/pm-lifecycle-hooks/package.json +1 -1
  220. package/packages/pm-linked-test-adapters/package.json +1 -1
  221. package/packages/pm-search-advanced/package.json +1 -1
  222. package/packages/pm-templates/package.json +1 -1
  223. package/packages/pm-todos/package.json +1 -1
  224. package/packages/pm-vcs/package.json +1 -1
  225. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  226. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  227. package/sdk/public-surface.json +384 -83
  228. package/dist/cli-bundle/chunks/chunk-2OOU2AFH.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +0 -33
  230. package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +0 -13
  231. package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +0 -194
  232. package/dist/cli-bundle/chunks/chunk-IUNRVDAI.js +0 -2
  233. package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +0 -2
  234. package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +0 -5
  235. package/dist/cli-bundle/chunks/register-list-query-HAUXVUPY.js +0 -10
  236. package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +0 -20
  237. package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +0 -2
  238. package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +0 -2
  239. package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +0 -2
  240. package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +0 -16
  241. package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +0 -8
  242. package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +0 -2
  243. package/dist/cli-bundle/focused-chunks/chunk-DPO7TEFX.js +0 -31
  244. package/dist/cli-bundle/focused-chunks/chunk-E3KCL7AY.js +0 -5
  245. package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +0 -153
  246. package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +0 -2
  247. package/dist/cli-bundle/focused-chunks/chunk-FPSYO5ZG.js +0 -18
  248. package/dist/cli-bundle/focused-chunks/chunk-KDH5OX3D.js +0 -4
  249. package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +0 -2
  250. package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +0 -17
@@ -4,15 +4,17 @@
4
4
  * Captures consent-aware telemetry and observability events for Runtime.
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]="fea9d81b-3deb-51f4-9ec3-76396ae1307d")}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]="26ea62d9-874d-5826-9822-83c5523b673b")}catch(e){}}();
8
8
  import crypto from "node:crypto";
9
9
  import { spawn } from "node:child_process";
10
10
  import { mkdirSync, rmSync, statSync } from "node:fs";
11
11
  import { mkdir, readdir, rm, stat } from "node:fs/promises";
12
+ import { request as httpRequest } from "node:http";
13
+ import { request as httpsRequest } from "node:https";
12
14
  import os from "node:os";
13
15
  import path from "node:path";
14
16
  import { resolvePmPackageRootFromModule } from "../packages/root.js";
15
- import { appendLineAtomic, readFileIfExists, writeFileAtomic, } from "../fs/fs-utils.js";
17
+ import { isFileMissingError, appendLineAtomic, readFileIfExists, writeFileAtomic, } from "../fs/fs-utils.js";
16
18
  import { resolveTelemetryErrorCategory, } from "../shared/constants.js";
17
19
  import { nowIso } from "../shared/time.js";
18
20
  import { detectAgentIdentity, readAuthorEnvironment, } from "../shared/author.js";
@@ -22,11 +24,10 @@ import { deriveTelemetryCommandResolution, deriveTelemetryCommandTaxonomy, infer
22
24
  const TELEMETRY_QUEUE_RELATIVE_PATH = path.join("runtime", "telemetry", "events.jsonl");
23
25
  const TELEMETRY_STATE_RELATIVE_PATH = path.join("runtime", "telemetry", "state.json");
24
26
  const TELEMETRY_OTEL_SPANS_RELATIVE_PATH = path.join("runtime", "telemetry", "otel-spans.jsonl");
25
- // Kept small so a worst-case batch against a blackholed collector
26
- // (TELEMETRY_OTEL_SPANS_FLUSH_BATCH_SIZE * TELEMETRY_HTTP_TIMEOUT_MS plus the
27
- // preceding event flush) stays well under TELEMETRY_FLUSH_LOCK_STALE_MS (60s).
28
- // Otherwise a later command could treat the still-held flush lock as stale and
29
- // start a second concurrent worker.
27
+ // OTLP requests run concurrently, while event and OTLP phases run sequentially.
28
+ // The maximum configurable HTTP timeout therefore keeps two worst-case network
29
+ // phases below TELEMETRY_FLUSH_LOCK_STALE_MS (60s), preventing a later command
30
+ // from treating a live worker's lock as stale and starting a second worker.
30
31
  const TELEMETRY_OTEL_SPANS_FLUSH_BATCH_SIZE = 8;
31
32
  const TELEMETRY_OTEL_SPANS_MAX_PENDING = 500;
32
33
  /** Public contract for telemetry schema version, shared by SDK and presentation-layer consumers. */
@@ -35,7 +36,9 @@ const TELEMETRY_CLIENT_SCHEMA_VERSION = 1;
35
36
  const TELEMETRY_FLUSH_BATCH_SIZE = 100;
36
37
  const TELEMETRY_MAX_RETRY_DELAY_MS = 3_600_000;
37
38
  const TELEMETRY_RETRY_BASE_DELAY_MS = 30_000;
38
- const TELEMETRY_HTTP_TIMEOUT_MS = 5_000;
39
+ const TELEMETRY_HTTP_TIMEOUT_DEFAULT_MS = 20_000;
40
+ const TELEMETRY_HTTP_TIMEOUT_MIN_MS = 1_000;
41
+ const TELEMETRY_HTTP_TIMEOUT_MAX_MS = 25_000;
39
42
  const MILLISECONDS_PER_DAY = 86_400_000;
40
43
  const TELEMETRY_MAX_EVENT_BYTES = 65_536;
41
44
  const TELEMETRY_SANITIZE_MAX_DEPTH = 6;
@@ -58,6 +61,8 @@ const PM_TELEMETRY_OTEL_DISABLED_VALUES = new Set(["1", "true", "yes", "on"]);
58
61
  const PM_TELEMETRY_INLINE_FLUSH_ENV = "PM_TELEMETRY_INLINE_FLUSH";
59
62
  const PM_TELEMETRY_FLUSH_CHILD_ENV = "PM_TELEMETRY_FLUSH_CHILD";
60
63
  const PM_TELEMETRY_SOURCE_CONTEXT_ENV = "PM_TELEMETRY_SOURCE_CONTEXT";
64
+ const PM_TELEMETRY_HTTP_TIMEOUT_MS_ENV = "PM_TELEMETRY_HTTP_TIMEOUT_MS";
65
+ const NATIVE_FETCH = globalThis.fetch;
61
66
  /** Supported values accepted by the pm telemetry source context contract. */
62
67
  export const PM_TELEMETRY_SOURCE_CONTEXT_VALUES = [
63
68
  "user",
@@ -390,6 +395,80 @@ function normalizeCaptureLevel(value) {
390
395
  function parseBooleanTrueLike(value) {
391
396
  return BOOLEAN_TRUE_VALUES.has((value ?? "").trim().toLowerCase());
392
397
  }
398
+ /** Resolve the background event and OTLP request timeout within the flush-lock safety envelope. */
399
+ function resolveTelemetryHttpTimeoutMs() {
400
+ const rawConfigured = process.env[PM_TELEMETRY_HTTP_TIMEOUT_MS_ENV]?.trim();
401
+ if (!rawConfigured) {
402
+ return TELEMETRY_HTTP_TIMEOUT_DEFAULT_MS;
403
+ }
404
+ const configured = Number(rawConfigured);
405
+ if (!Number.isFinite(configured)) {
406
+ return TELEMETRY_HTTP_TIMEOUT_DEFAULT_MS;
407
+ }
408
+ return Math.min(TELEMETRY_HTTP_TIMEOUT_MAX_MS, Math.max(TELEMETRY_HTTP_TIMEOUT_MIN_MS, Math.trunc(configured)));
409
+ }
410
+ /** POST a JSON payload with one total timeout that covers DNS, connection, TLS, and response completion. */
411
+ async function postTelemetryJson(endpoint, headers, body) {
412
+ const url = new URL(endpoint);
413
+ // A replaced global fetch is an intentional runtime adapter used by the
414
+ // repository's deterministic tests and by embedders that instrument network
415
+ // traffic. Production retains the native HTTP transport below so Node's
416
+ // independent built-in-fetch connect timeout cannot preempt our bound.
417
+ if (globalThis.fetch !== NATIVE_FETCH) {
418
+ const controller = new AbortController();
419
+ let timeout;
420
+ const deadline = new Promise((_resolve, reject) => {
421
+ timeout = setTimeout(() => {
422
+ controller.abort();
423
+ reject(new Error("telemetry_http_timeout"));
424
+ }, resolveTelemetryHttpTimeoutMs());
425
+ });
426
+ try {
427
+ const response = await Promise.race([
428
+ globalThis.fetch(endpoint, {
429
+ method: "POST",
430
+ headers,
431
+ body,
432
+ signal: controller.signal,
433
+ }),
434
+ deadline,
435
+ ]);
436
+ return response.status;
437
+ }
438
+ finally {
439
+ clearTimeout(timeout);
440
+ }
441
+ }
442
+ const request = url.protocol === "https:"
443
+ ? httpsRequest
444
+ : url.protocol === "http:"
445
+ ? httpRequest
446
+ : undefined;
447
+ if (!request) {
448
+ throw new Error(`telemetry_http_protocol_unsupported_${url.protocol}`);
449
+ }
450
+ return new Promise((resolve, reject) => {
451
+ const timeoutMs = resolveTelemetryHttpTimeoutMs();
452
+ const requestOptions = {
453
+ method: "POST",
454
+ headers: {
455
+ ...headers,
456
+ "content-length": Buffer.byteLength(body),
457
+ },
458
+ signal: AbortSignal.timeout(timeoutMs),
459
+ autoSelectFamilyAttemptTimeout: Math.min(5_000, timeoutMs),
460
+ };
461
+ const clientRequest = request(url, requestOptions, (response) => {
462
+ response.once("error", reject);
463
+ // Client responses always carry an HTTP status code; Node's shared
464
+ // IncomingMessage type is also used for server requests where it is absent.
465
+ response.once("end", () => resolve(response.statusCode));
466
+ response.resume();
467
+ });
468
+ clientRequest.once("error", reject);
469
+ clientRequest.end(body);
470
+ });
471
+ }
393
472
  function normalizePmVersion(value) {
394
473
  const trimmed = typeof value === "string" ? value.trim() : "";
395
474
  return trimmed.length > 0 ? trimmed : "0.0.0";
@@ -1214,14 +1293,9 @@ async function flushPendingOtelSpans(globalPmRoot, retentionDays) {
1214
1293
  // and safe under Node's single-threaded event loop.
1215
1294
  await Promise.all(due.map(async (span) => {
1216
1295
  try {
1217
- const response = await fetch(span.endpoint, {
1218
- method: "POST",
1219
- headers: { "content-type": "application/json" },
1220
- body: JSON.stringify(span.payload),
1221
- signal: AbortSignal.timeout(TELEMETRY_HTTP_TIMEOUT_MS),
1222
- });
1223
- if (!response.ok) {
1224
- throw new Error(`local_otel_export_http_${response.status}`);
1296
+ const status = await postTelemetryJson(span.endpoint, { "content-type": "application/json" }, JSON.stringify(span.payload));
1297
+ if (status < 200 || status >= 300) {
1298
+ throw new Error(`local_otel_export_http_${status}`);
1225
1299
  }
1226
1300
  succeededIds.add(span.id);
1227
1301
  succeededCount += 1;
@@ -1398,17 +1472,12 @@ async function flushQueue(globalPmRoot, endpoint, retentionDays) {
1398
1472
  requestHeaders["x-pm-telemetry-key"] = ingestKey;
1399
1473
  }
1400
1474
  try {
1401
- const response = await fetch(normalizedEndpoint, {
1402
- method: "POST",
1403
- headers: requestHeaders,
1404
- body: JSON.stringify({
1405
- schema_version: TELEMETRY_SCHEMA_VERSION,
1406
- events: dueEntries.map((entry) => entry.event),
1407
- }),
1408
- signal: AbortSignal.timeout(TELEMETRY_HTTP_TIMEOUT_MS),
1409
- });
1410
- if (!response.ok) {
1411
- throw new Error(`telemetry_flush_http_${response.status}`);
1475
+ const status = await postTelemetryJson(normalizedEndpoint, requestHeaders, JSON.stringify({
1476
+ schema_version: TELEMETRY_SCHEMA_VERSION,
1477
+ events: dueEntries.map((entry) => entry.event),
1478
+ }));
1479
+ if (status < 200 || status >= 300) {
1480
+ throw new Error(`telemetry_flush_http_${status}`);
1412
1481
  }
1413
1482
  }
1414
1483
  catch (error) {
@@ -1519,7 +1588,7 @@ function createDirectoryLock(lockPath) {
1519
1588
  if (code === "EEXIST") {
1520
1589
  return false;
1521
1590
  }
1522
- if (code !== "ENOENT") {
1591
+ if (!isFileMissingError(error)) {
1523
1592
  return false;
1524
1593
  }
1525
1594
  }
@@ -1547,7 +1616,7 @@ function acquireTelemetryFlushSpawnGate(globalPmRoot) {
1547
1616
  removeDirectoryLockBestEffort(lockPath);
1548
1617
  }
1549
1618
  catch (error) {
1550
- if (errorCode(error) !== "ENOENT") {
1619
+ if (!isFileMissingError(error)) {
1551
1620
  return false;
1552
1621
  }
1553
1622
  }
@@ -1586,11 +1655,13 @@ export const _testOnly = {
1586
1655
  looksLikeEmailToken,
1587
1656
  otelSpansQueuePath,
1588
1657
  parseBooleanTrueLike,
1658
+ postTelemetryJson,
1589
1659
  parsePendingOtelSpanLines,
1590
1660
  prunePendingOtelSpans,
1591
1661
  reconcilePendingOtelSpansAfterFlush,
1592
1662
  retentionCutoffMs,
1593
1663
  resolveOtelTracesEndpoint,
1664
+ resolveTelemetryHttpTimeoutMs,
1594
1665
  rewritePendingOtelSpans,
1595
1666
  normalizeForHash,
1596
1667
  normalizeCaptureLevel,
@@ -1915,4 +1986,4 @@ export async function emitTelemetryErrorEvent(context) {
1915
1986
  }
1916
1987
  }
1917
1988
  //# sourceMappingURL=runtime.js.map
1918
- //# debugId=fea9d81b-3deb-51f4-9ec3-76396ae1307d
1989
+ //# debugId=26ea62d9-874d-5826-9822-83c5523b673b
@@ -1,3 +1,5 @@
1
+ /** Resolve a recovery command without interpreting global option values as command tokens. */
2
+ export declare function resolveRecoveryCommandName(invocationArgv: string[] | undefined): string | undefined;
1
3
  /** Resolve the truthful placeholder for a missing flag from its contract. */
2
4
  export declare function resolveMissingOptionPlaceholder(commandName: string, missingLabel: string): string | null | undefined;
3
5
  /** Preserve an attempted argv vector and insert each missing option before `--`. */
@@ -6,13 +6,21 @@
6
6
  * supplied arguments are preserved byte-for-token.
7
7
  */
8
8
 
9
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ab87f46c-c9b4-51d1-a712-fbce7c79fca9")}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]="4973a995-60f0-5990-9927-371dc6716063")}catch(e){}}();
10
10
  import { renderPmCommand } from "../command-line.js";
11
11
  import { resolveSubcommandFlagContractsForCommand } from "../cli-contracts.js";
12
+ import { parseBootstrapCommandName } from "../cli-bootstrap.js";
12
13
  function normalizeMissingFlag(label) {
13
14
  const match = label.trim().match(/--[a-z0-9][a-z0-9_-]*/i);
14
15
  return match?.[0]?.replaceAll("_", "-").toLowerCase();
15
16
  }
17
+ /** Resolve a recovery command without interpreting global option values as command tokens. */
18
+ export function resolveRecoveryCommandName(invocationArgv) {
19
+ if (!Array.isArray(invocationArgv) || invocationArgv.length === 0) {
20
+ return undefined;
21
+ }
22
+ return parseBootstrapCommandName(invocationArgv);
23
+ }
16
24
  /** Resolve the truthful placeholder for a missing flag from its contract. */
17
25
  export function resolveMissingOptionPlaceholder(commandName, missingLabel) {
18
26
  const flag = normalizeMissingFlag(missingLabel);
@@ -49,4 +57,4 @@ export function renderMissingOptionRetry(invocationArgv, commandName, missingLab
49
57
  : renderPmCommand(retry);
50
58
  }
51
59
  //# sourceMappingURL=command-recovery.js.map
52
- //# debugId=ab87f46c-c9b4-51d1-a712-fbce7c79fca9
60
+ //# debugId=4973a995-60f0-5990-9927-371dc6716063
@@ -4,9 +4,9 @@
4
4
  * Implements the pm annotation command command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="13cf8bd9-0aee-5838-a6eb-de9f87ddfac7")}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]="0af9967c-ca72-563a-9518-2e68da0c0fe0")}catch(e){}}();
8
8
  import { readFile } from "node:fs/promises";
9
- import { pathExists } from "../core/fs/fs-utils.js";
9
+ import { isFileAbsentError, pathExists } from "../core/fs/fs-utils.js";
10
10
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
11
11
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
12
12
  import { createStdinTokenResolver, parseCsvKv } from "../core/item/parse.js";
@@ -114,7 +114,7 @@ async function resolveAnnotationTextSource(options, noun) {
114
114
  return { value: await readFile(filePath, "utf8"), emptyFlag: "--file" };
115
115
  }
116
116
  catch (error) {
117
- if (isErrnoError(error) && error.code === "ENOENT") {
117
+ if (isErrnoError(error) && isFileAbsentError(error)) {
118
118
  throw new PmCliError(`--file path not found: ${filePath}`, EXIT_CODE.USAGE);
119
119
  }
120
120
  const detail = error instanceof Error ? error.message : String(error);
@@ -399,4 +399,4 @@ function renderAnnotationResult(id, collectionKey, allEntries, limit, includeMet
399
399
  };
400
400
  }
401
401
  //# sourceMappingURL=annotations.js.map
402
- //# debugId=13cf8bd9-0aee-5838-a6eb-de9f87ddfac7
402
+ //# debugId=0af9967c-ca72-563a-9518-2e68da0c0fe0
@@ -31,6 +31,8 @@ export interface BootstrapGlobalOptions {
31
31
  outputFormat?: "toon" | "json";
32
32
  /** Caller-carried cross-call budget and served-item state. */
33
33
  outputSession?: string;
34
+ /** Whether machine-readable row discovery metadata is requested. */
35
+ outputRowContract?: boolean;
34
36
  /** Invocation-wide mutation author override. */
35
37
  author?: string;
36
38
  /** Whether `--author` was present without its required value. */
@@ -4,7 +4,7 @@
4
4
  * Provides public bootstrap argument normalization for embedded CLI hosts.
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]="eac8ed6b-43c4-54fa-820a-220154001a6b")}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]="7b3209a8-8580-542c-9e80-21d04df3f61f")}catch(e){}}();
8
8
  import { EXECUTABLE_COMMAND_ALIASES, resolveSubcommandFlagContractsForCommand, } from "./cli-contracts.js";
9
9
  export { EXECUTABLE_COMMAND_ALIASES };
10
10
  import { levenshteinDistanceWithinLimit } from "../core/shared/levenshtein.js";
@@ -47,6 +47,7 @@ const BOOTSTRAP_BOOLEAN_FLAGS = new Set([
47
47
  "--quiet",
48
48
  "--lean",
49
49
  "--token-accounting",
50
+ "--output-row-contract",
50
51
  ]);
51
52
  /** Consume one bootstrap-global token and update the accumulated parse state. */
52
53
  function consumeBootstrapGlobalToken(argv, index, state) {
@@ -95,6 +96,9 @@ export function parseBootstrapGlobalOptions(argv) {
95
96
  quiet: state.booleanFlags.has("--quiet"),
96
97
  lean: state.booleanFlags.has("--lean"),
97
98
  tokenAccounting: state.booleanFlags.has("--token-accounting"),
99
+ ...(state.booleanFlags.has("--output-row-contract")
100
+ ? { outputRowContract: true }
101
+ : {}),
98
102
  ...(state.outputValues.get("--output-include") === undefined
99
103
  ? {}
100
104
  : { outputInclude: state.outputValues.get("--output-include") }),
@@ -886,4 +890,4 @@ export const _testOnly = {
886
890
  resolveCanonicalFlag,
887
891
  };
888
892
  //# sourceMappingURL=cli-bootstrap.js.map
889
- //# debugId=eac8ed6b-43c4-54fa-820a-220154001a6b
893
+ //# debugId=7b3209a8-8580-542c-9e80-21d04df3f61f
@@ -7,7 +7,7 @@
7
7
  * a hand-picked test list.
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]="11dade38-a681-599f-b3b7-8d121418366d")}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]="cf238c71-1626-5e48-9207-7acf22c0d680")}catch(e){}}();
11
11
  import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
12
12
  import { resolveSubcommandFlagContractsForCommand, } from "./flag-contracts.js";
13
13
  import { pmToolActionParameterKeys } from "./tool-schema.js";
@@ -23,6 +23,7 @@ const CLI_TRANSPORT_FLAGS = new Set([
23
23
  "--output-budget",
24
24
  "--output-format",
25
25
  "--output-session",
26
+ "--output-row-contract",
26
27
  "--no-changed-fields",
27
28
  "--no-extensions",
28
29
  "--no-pager",
@@ -79,6 +80,7 @@ const ACTION_POSITIONAL_PARAMETERS = {
79
80
  assurance: {
80
81
  id: "<id>",
81
82
  kind: "<kind>",
83
+ preset: "[kind]|[id]",
82
84
  subcommand: "<action>",
83
85
  },
84
86
  event: { title: "<title>" },
@@ -94,7 +96,12 @@ const ACTION_POSITIONAL_PARAMETERS = {
94
96
  },
95
97
  };
96
98
  const ACTION_FLAG_PARAMETER_OVERRIDES = {
97
- assurance: { "--tree": "treeId" },
99
+ assurance: {
100
+ "--tree": "treeId",
101
+ "--owner": "owner",
102
+ "--apply": "apply",
103
+ "--enforcement": "enforcement",
104
+ },
98
105
  init: {
99
106
  "--id-prefix": "idPrefix",
100
107
  "--no-merge-fence": "mergeFence",
@@ -376,4 +383,4 @@ export function analyzeSdkCliParameterCompleteness(source = {}) {
376
383
  });
377
384
  }
378
385
  //# sourceMappingURL=completeness.js.map
379
- //# debugId=11dade38-a681-599f-b3b7-8d121418366d
386
+ //# debugId=cf238c71-1626-5e48-9207-7acf22c0d680
@@ -19,7 +19,7 @@ export declare const PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS: readonly ["none", "
19
19
  /** Restricts pm extension sandbox profile contract values accepted by command, SDK, and storage contracts. */
20
20
  export type PmExtensionSandboxProfileContract = (typeof PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS)[number];
21
21
  /** Public contract for pm extension policy surface contracts, shared by SDK and presentation-layer consumers. */
22
- export declare const PM_EXTENSION_POLICY_SURFACE_CONTRACTS: readonly ["commands.override", "commands.handler", "hooks.beforecommand", "hooks.beforemutation", "hooks.aftercommand", "hooks.onwrite", "hooks.onread", "hooks.onindex", "schema.flags", "schema.itemfields", "schema.itemtypes", "schema.relationshipkinds", "schema.migrations", "schema.profiles", "parser.override", "preflight.override", "services.override", "renderers.override", "importers.importer", "importers.exporter", "search.provider", "search.vectorstore"];
22
+ export declare const PM_EXTENSION_POLICY_SURFACE_CONTRACTS: readonly ["commands.override", "commands.handler", "hooks.beforecommand", "hooks.beforemutation", "hooks.aftercommand", "hooks.onwrite", "hooks.onread", "hooks.onindex", "schema.flags", "schema.itemfields", "schema.itemtypes", "schema.relationshipkinds", "schema.migrations", "schema.profiles", "parser.override", "preflight.override", "services.override", "renderers.override", "importers.importer", "importers.exporter", "search.provider", "search.vectorstore", "services.assuranceprovider"];
23
23
  /** Restricts pm extension policy surface contract values accepted by command, SDK, and storage contracts. */
24
24
  export type PmExtensionPolicySurfaceContract = (typeof PM_EXTENSION_POLICY_SURFACE_CONTRACTS)[number];
25
25
  /** Public contract for pm core command names, 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]="48d9a5c7-f747-5fac-a534-01a4b3b7af2c")}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]="a5a2c81f-8870-5111-b13c-74c362098d54")}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
  function normalizeFlagAliasKey(flag) {
@@ -392,7 +392,7 @@ export const SCHEMA_FLAG_CONTRACTS = [
392
392
  // add-type --infer flags (title-prefix type inference).
393
393
  { flag: "--infer" },
394
394
  { flag: "--min-count" },
395
- { flag: "--apply" },
395
+ { flag: "--apply", value_type: "boolean" },
396
396
  // Lossless schema evolution flags.
397
397
  { flag: "--to" },
398
398
  { flag: "--migration-id", aliases: ["--migration_id"] },
@@ -875,6 +875,7 @@ export const TEST_FLAG_CONTRACTS = [
875
875
  { flag: "--add" },
876
876
  { flag: "--add-json" },
877
877
  { flag: "--remove" },
878
+ { flag: "--remove-index", repeatable: true },
878
879
  { flag: "--run" },
879
880
  { flag: "--match" },
880
881
  { flag: "--only-index" },
@@ -940,6 +941,7 @@ export const GC_FLAG_CONTRACTS = [
940
941
  ];
941
942
  /** Public contract for stats flag contracts, shared by SDK and presentation-layer consumers. */
942
943
  export const STATS_FLAG_CONTRACTS = [
944
+ { flag: "--include-empty" },
943
945
  { flag: "--storage" },
944
946
  { flag: "--metadata-coverage" },
945
947
  { flag: "--field-utilization" },
@@ -1016,6 +1018,9 @@ export const ASSURANCE_FLAG_CONTRACTS = [
1016
1018
  { flag: "--dry-run" },
1017
1019
  { flag: "--author", value_name: "value" },
1018
1020
  { flag: "--message", value_name: "value" },
1021
+ { flag: "--owner", value_name: "item-id" },
1022
+ { flag: "--apply", value_type: "boolean" },
1023
+ { flag: "--enforcement", value_name: "level" },
1019
1024
  ];
1020
1025
  const ITEM_OWNERSHIP_AND_ISSUE_FLAG_CONTRACTS = [
1021
1026
  { flag: "--assignee" },
@@ -1391,6 +1396,7 @@ export const ACTIVITY_FLAG_CONTRACTS = [
1391
1396
  { flag: "--limit" },
1392
1397
  { flag: "--unbounded" },
1393
1398
  { flag: "--compact" },
1399
+ { flag: "--raw" },
1394
1400
  { flag: "--full" },
1395
1401
  { flag: "--provenance" },
1396
1402
  { flag: "--provenance-summary" },
@@ -1811,4 +1817,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1811
1817
  return normalizeUniqueStringList(all).join(" ");
1812
1818
  }
1813
1819
  //# sourceMappingURL=flag-contracts.js.map
1814
- //# debugId=48d9a5c7-f747-5fac-a534-01a4b3b7af2c
1820
+ //# debugId=a5a2c81f-8870-5111-b13c-74c362098d54
@@ -70,22 +70,39 @@ export declare function printActivityJsonStream(result: ActivityCommandResult, o
70
70
  export declare function normalizeSearchOptions(options: Record<string, unknown>): Record<string, unknown>;
71
71
  /** Implements normalize search keywords input for the public runtime surface of this module. */
72
72
  export declare function normalizeSearchKeywordsInput(keywords: string[]): string;
73
- /** Implements normalize activity options for the public runtime surface of this module. */
74
- export declare function normalizeActivityOptions(options: Record<string, unknown>): {
73
+ /** Canonical Commander-normalized activity query options. */
74
+ export interface NormalizedActivityOptions {
75
+ /** Exact item identifier filter. */
75
76
  id?: string;
77
+ /** Exact immutable history operation filter. */
76
78
  op?: string;
79
+ /** Exact recorded author filter. */
77
80
  author?: string;
81
+ /** Inclusive activity window lower bound. */
78
82
  from?: string;
83
+ /** Inclusive activity window upper bound. */
79
84
  to?: string;
85
+ /** Maximum projected row count encoded as Commander text. */
80
86
  limit?: string;
87
+ /** Select the compact raw-event projection. */
81
88
  compact?: boolean;
89
+ /** Select a raw event projection instead of the item digest. */
90
+ raw?: boolean;
91
+ /** Disable the default projection row bound. */
82
92
  unbounded?: boolean;
93
+ /** Select privacy-safe provenance event rows. */
83
94
  provenance?: boolean;
95
+ /** Include constant-size provenance completeness metrics. */
84
96
  provenanceSummary?: boolean;
97
+ /** Canonical harness filters supplied by Commander. */
85
98
  harness?: string[];
99
+ /** Privacy-safe agent invocation fingerprint filters. */
86
100
  agentInstance?: string[];
101
+ /** Exact provenance dimension predicates. */
87
102
  provenanceFilter?: string[];
88
- };
103
+ }
104
+ /** Implements normalize activity options for the public runtime surface of this module. */
105
+ export declare function normalizeActivityOptions(options: Record<string, unknown>): NormalizedActivityOptions;
89
106
  /** Implements resolve activity stream mode for the public runtime surface of this module. */
90
107
  export declare function resolveActivityStreamMode(raw: unknown): boolean;
91
108
  /** Implements normalize context options for the public runtime surface of this module. */
@@ -4,7 +4,7 @@
4
4
  * Provides CLI runtime support for Registration Helpers.
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]="5f92dd0d-4eb1-5a7b-8891-931dd15deb81")}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]="daefefd1-3b0b-513d-8b8c-ab17f90b995a")}catch(e){}}();
8
8
  import { Option } from "commander";
9
9
  import { pathExists, refreshSearchArtifactsForMutation, shouldRunSearchRefreshInForeground, EXIT_CODE, PmCliError, printError, printResult, writeStdout, getSettingsPath, resolvePmRoot, readSettings, runActiveServiceOverride, setActiveCommandResult, } from "../runtime-primitives.js";
10
10
  import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, NEXT_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, readFirstValueFromCommanderOptions, readFirstStringFromCommanderOptions, readStringArrayFromCommanderOptions, } from "../cli-contracts.js";
@@ -100,7 +100,7 @@ export function getGlobalOptions(command) {
100
100
  : typeof reader.opts === "function"
101
101
  ? reader.opts()
102
102
  : {};
103
- return {
103
+ const normalized = {
104
104
  json: opts.json === true ? true : undefined,
105
105
  quiet: Boolean(opts.quiet),
106
106
  noChangedFields: opts.changedFields === false,
@@ -112,20 +112,19 @@ export function getGlobalOptions(command) {
112
112
  outputLimit: readStringCommandOption(opts, "outputLimit"),
113
113
  outputBudget: readStringCommandOption(opts, "outputBudget"),
114
114
  outputSession: readStringCommandOption(opts, "outputSession"),
115
+ ...(opts.outputRowContract === true ? { outputRowContract: true } : {}),
115
116
  ...(opts.outputFormat === "toon" || opts.outputFormat === "json"
116
117
  ? { outputFormat: opts.outputFormat }
117
118
  : {}),
118
- path: typeof opts.pmPath === "string"
119
- ? opts.pmPath
120
- : typeof opts.path === "string"
121
- ? opts.path
122
- : undefined,
119
+ path: readStringCommandOption(opts, "pmPath") ??
120
+ readStringCommandOption(opts, "path"),
123
121
  noExtensions: opts.extensions === false,
124
122
  noPager: Boolean(opts.noPager),
125
123
  profile: Boolean(opts.profile),
126
124
  ...(commandPath.length > 0 ? { command: commandPath } : {}),
127
125
  ...(typeof opts.author === "string" ? { author: opts.author } : {}),
128
126
  };
127
+ return normalized;
129
128
  }
130
129
  /** Implements get command path for the public runtime surface of this module. */
131
130
  export function getCommandPath(command) {
@@ -239,6 +238,7 @@ export function buildBackgroundTestCommandArgs(id, options) {
239
238
  pushRepeatableValueFlag(args, "--add", options.add);
240
239
  pushRepeatableValueFlag(args, "--add-json", options.addJson);
241
240
  pushRepeatableValueFlag(args, "--remove", options.remove);
241
+ pushRepeatableValueFlag(args, "--remove-index", options.removeIndex);
242
242
  pushOptionalValueFlag(args, "--match", options.match);
243
243
  pushOptionalValueFlag(args, "--only-index", options.onlyIndex);
244
244
  pushOptionalBooleanFlag(args, "--only-last", options.onlyLast);
@@ -792,7 +792,7 @@ export function normalizeSearchKeywordsInput(keywords) {
792
792
  /** Implements normalize activity options for the public runtime surface of this module. */
793
793
  export function normalizeActivityOptions(options) {
794
794
  const readActivityString = (target) => readFirstStringFromCommanderOptions(options, resolveCommanderContract(ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, target));
795
- return {
795
+ const normalized = {
796
796
  id: readActivityString("id"),
797
797
  op: readActivityString("op"),
798
798
  author: readActivityString("author"),
@@ -801,9 +801,14 @@ export function normalizeActivityOptions(options) {
801
801
  limit: readActivityString("limit"),
802
802
  compact: options.full === true || options.provenance === true
803
803
  ? false
804
- : options.compact === false
805
- ? false
806
- : true,
804
+ : options.compact === true || options.raw === true
805
+ ? true
806
+ : undefined,
807
+ ...(options.raw === true ||
808
+ options.compact === true ||
809
+ options.full === true
810
+ ? { raw: true }
811
+ : {}),
807
812
  unbounded: optionTrue(options, "unbounded"),
808
813
  provenance: optionTrue(options, "provenance"),
809
814
  provenanceSummary: optionTrue(options, "provenanceSummary"),
@@ -817,6 +822,7 @@ export function normalizeActivityOptions(options) {
817
822
  ? options.provenanceFilter
818
823
  : undefined,
819
824
  };
825
+ return Object.fromEntries(Object.entries(normalized).filter(([, value]) => value !== undefined));
820
826
  }
821
827
  const ACTIVITY_STREAM_ENABLED_VALUES = new Set([
822
828
  "",
@@ -978,4 +984,4 @@ export const _testOnly = {
978
984
  collectMutationItemIds,
979
985
  };
980
986
  //# sourceMappingURL=registration-helpers.js.map
981
- //# debugId=5f92dd0d-4eb1-5a7b-8891-931dd15deb81
987
+ //# debugId=daefefd1-3b0b-513d-8b8c-ab17f90b995a