@unbrained/pm-cli 2026.11.22 → 2026.11.23

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 (892) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/after-command-context-usage.js +1 -1
  3. package/dist/cli/argv-utils.js +1 -1
  4. package/dist/cli/bootstrap-args.js +1 -1
  5. package/dist/cli/bundle-integrity.js +2 -2
  6. package/dist/cli/command-namespaces.js +1 -1
  7. package/dist/cli/commander-usage.js +11 -11
  8. package/dist/cli/commands/annotations/comments.js +1 -1
  9. package/dist/cli/commands/annotations/docs.js +1 -1
  10. package/dist/cli/commands/annotations/files.js +1 -1
  11. package/dist/cli/commands/annotations/learnings.js +1 -1
  12. package/dist/cli/commands/annotations/notes.js +1 -1
  13. package/dist/cli/commands/extension/describe.js +1 -1
  14. package/dist/cli/commands/extension/extension.js +1 -1
  15. package/dist/cli/commands/extension/scaffold.js +1 -1
  16. package/dist/cli/commands/extension/shared.js +1 -1
  17. package/dist/cli/commands/governance/gc.js +1 -1
  18. package/dist/cli/commands/governance/health.js +1 -1
  19. package/dist/cli/commands/governance/telemetry.js +1 -1
  20. package/dist/cli/commands/governance/validate.js +1 -1
  21. package/dist/cli/commands/history/activity.js +1 -1
  22. package/dist/cli/commands/history/history-compact.js +1 -1
  23. package/dist/cli/commands/history/history-redact.js +1 -1
  24. package/dist/cli/commands/history/history-repair.js +1 -1
  25. package/dist/cli/commands/history/history.js +1 -1
  26. package/dist/cli/commands/history/restore.js +1 -1
  27. package/dist/cli/commands/lifecycle/append.js +1 -1
  28. package/dist/cli/commands/lifecycle/claim.js +1 -1
  29. package/dist/cli/commands/lifecycle/close-many.js +1 -1
  30. package/dist/cli/commands/lifecycle/close.js +1 -1
  31. package/dist/cli/commands/lifecycle/copy.js +1 -1
  32. package/dist/cli/commands/lifecycle/create.js +1 -1
  33. package/dist/cli/commands/lifecycle/delete.js +1 -1
  34. package/dist/cli/commands/lifecycle/focus.js +1 -1
  35. package/dist/cli/commands/lifecycle/plan.js +1 -1
  36. package/dist/cli/commands/lifecycle/update-many.js +1 -1
  37. package/dist/cli/commands/lifecycle/update.js +1 -1
  38. package/dist/cli/commands/query/aggregate.js +1 -1
  39. package/dist/cli/commands/query/context.js +1 -1
  40. package/dist/cli/commands/query/deps.js +1 -1
  41. package/dist/cli/commands/query/duplicates.js +1 -1
  42. package/dist/cli/commands/query/eval.js +1 -1
  43. package/dist/cli/commands/query/get.js +1 -1
  44. package/dist/cli/commands/query/graph.js +1 -1
  45. package/dist/cli/commands/query/list.js +1 -1
  46. package/dist/cli/commands/query/next.js +1 -1
  47. package/dist/cli/commands/query/search.js +1 -1
  48. package/dist/cli/commands/query/stats.js +1 -1
  49. package/dist/cli/commands/test/test-all.js +1 -1
  50. package/dist/cli/commands/test/test-runs.js +1 -1
  51. package/dist/cli/commands/test/test.js +1 -1
  52. package/dist/cli/commands/workspace/config.js +1 -1
  53. package/dist/cli/commands/workspace/contracts.js +1 -1
  54. package/dist/cli/commands/workspace/init.js +1 -1
  55. package/dist/cli/commands/workspace/merge.js +1 -1
  56. package/dist/cli/commands/workspace/profile.js +1 -1
  57. package/dist/cli/commands/workspace/schema.js +1 -1
  58. package/dist/cli/commands/workspace/upgrade.js +1 -1
  59. package/dist/cli/context-intent-invocation.js +1 -1
  60. package/dist/cli/description-stdin.js +1 -1
  61. package/dist/cli/error-guidance.js +5 -5
  62. package/dist/cli/expected-revisions.js +1 -1
  63. package/dist/cli/extension-command-help.js +6 -6
  64. package/dist/cli/extension-recovery.js +1 -1
  65. package/dist/cli/help-content.js +5 -5
  66. package/dist/cli/help-json-payload.js +7 -7
  67. package/dist/cli/invocation-profile.js +2 -2
  68. package/dist/cli/main.js +5 -5
  69. package/dist/cli/migration-gates.js +1 -1
  70. package/dist/cli/option-values.js +1 -1
  71. package/dist/cli/preflight-warnings.js +3 -3
  72. package/dist/cli/public.js +1 -1
  73. package/dist/cli/register-annotations.js +1 -1
  74. package/dist/cli/register-assurance.js +1 -1
  75. package/dist/cli/register-files-lookup.js +1 -1
  76. package/dist/cli/register-history-activity.js +1 -1
  77. package/dist/cli/register-history-author.js +1 -1
  78. package/dist/cli/register-history-maintenance.js +2 -2
  79. package/dist/cli/register-list-query.js +10 -10
  80. package/dist/cli/register-mutation-options.js +0 -1
  81. package/dist/cli/register-mutation.js +6 -6
  82. package/dist/cli/register-operations.js +1 -1
  83. package/dist/cli/register-setup.js +1 -1
  84. package/dist/cli/register-structured-mutation.js +1 -1
  85. package/dist/cli/registration-helpers.js +1 -1
  86. package/dist/cli/runtime/activation.js +1 -1
  87. package/dist/cli/runtime/annotation-option-retry.js +1 -1
  88. package/dist/cli/runtime/close-fields-retry.js +1 -1
  89. package/dist/cli/runtime/field-route-retry.js +1 -1
  90. package/dist/cli/runtime/invocation-options.js +1 -1
  91. package/dist/cli/runtime/invocation-rewrites.js +1 -1
  92. package/dist/cli/runtime/projection-retry.js +1 -1
  93. package/dist/cli/runtime/read-output-mutation-retry.js +1 -1
  94. package/dist/cli/runtime/refusal-credential-redaction.js +1 -1
  95. package/dist/cli/runtime/selection.js +1 -1
  96. package/dist/cli/runtime/telemetry-outcome.js +1 -1
  97. package/dist/cli/runtime-compatibility-boundary.js +4 -4
  98. package/dist/cli/schema/registration.js +15 -15
  99. package/dist/cli/schema-registration-helpers.js +1 -1
  100. package/dist/cli/search-refresh.js +1 -1
  101. package/dist/cli/stats-analytics-json.js +1 -1
  102. package/dist/cli/telemetry-flush.js +1 -1
  103. package/dist/cli-bundle/bundle-manifest.json +1 -1
  104. package/dist/cli-bundle/chunks/chunk-2UQU7HRR.js +9 -0
  105. package/dist/cli-bundle/chunks/chunk-5DUP4AZA.js +2 -0
  106. package/dist/cli-bundle/chunks/chunk-5WZZ5XEN.js +3 -0
  107. package/dist/cli-bundle/chunks/chunk-6H36ZHMI.js +2 -0
  108. package/dist/cli-bundle/chunks/chunk-6MYJLOSG.js +2 -0
  109. package/dist/cli-bundle/chunks/chunk-AA52P34H.js +3 -0
  110. package/dist/cli-bundle/chunks/{chunk-B76TFRO2.js → chunk-AEOHUSUI.js} +101 -101
  111. package/dist/cli-bundle/chunks/chunk-BSRIVYTM.js +8 -0
  112. package/dist/cli-bundle/chunks/chunk-CFWLQFJM.js +71 -0
  113. package/dist/cli-bundle/chunks/chunk-D6PDUKUG.js +9 -0
  114. package/dist/cli-bundle/chunks/chunk-ENKXRSFZ.js +31 -0
  115. package/dist/cli-bundle/chunks/chunk-F2Z6XLZB.js +3 -0
  116. package/dist/cli-bundle/chunks/chunk-FJOEL75F.js +2 -0
  117. package/dist/cli-bundle/chunks/chunk-GDXCAC52.js +2 -0
  118. package/dist/cli-bundle/chunks/chunk-H7JEXRIN.js +6 -0
  119. package/dist/cli-bundle/chunks/chunk-J2PDAVBC.js +2 -0
  120. package/dist/cli-bundle/chunks/chunk-KE7HMBEW.js +2 -0
  121. package/dist/cli-bundle/chunks/chunk-KZHIBEJL.js +33 -0
  122. package/dist/cli-bundle/chunks/chunk-NGJ5ERBF.js +115 -0
  123. package/dist/cli-bundle/chunks/chunk-NQ54T7T2.js +2 -0
  124. package/dist/cli-bundle/chunks/chunk-O7JHS64G.js +3 -0
  125. package/dist/cli-bundle/chunks/chunk-OKEZF7HU.js +2 -0
  126. package/dist/cli-bundle/chunks/chunk-OKIKF4FD.js +2 -0
  127. package/dist/cli-bundle/chunks/chunk-OPJF254V.js +9 -0
  128. package/dist/cli-bundle/chunks/chunk-PZA7QECY.js +1 -0
  129. package/dist/cli-bundle/chunks/chunk-RWA5YZ5X.js +2 -0
  130. package/dist/cli-bundle/chunks/chunk-S32NGRQM.js +2 -0
  131. package/dist/cli-bundle/chunks/chunk-SLFRSZK6.js +1 -0
  132. package/dist/cli-bundle/chunks/chunk-TZY5MVJF.js +125 -0
  133. package/dist/cli-bundle/chunks/chunk-YYT3MIRF.js +3 -0
  134. package/dist/cli-bundle/chunks/chunk-ZPS4B6SI.js +8 -0
  135. package/dist/cli-bundle/chunks/context-budget-recovery-M5RFUEFG.js +2 -0
  136. package/dist/cli-bundle/chunks/indexed-receipt-blobs-BPYKN5Q7.js +4 -0
  137. package/dist/cli-bundle/chunks/{item-revision-4QBMZXKX.js → item-revision-FMD4KWBB.js} +2 -2
  138. package/dist/cli-bundle/chunks/item-transaction-SEHTH7N2.js +2 -0
  139. package/dist/cli-bundle/chunks/mutation-actor-SFGYIRPW.js +2 -0
  140. package/dist/cli-bundle/chunks/mutation-admission-57LBSKQI.js +2 -0
  141. package/dist/cli-bundle/chunks/{register-list-query-RR5KACJ3.js → register-list-query-L4IBU64P.js} +11 -11
  142. package/dist/cli-bundle/chunks/register-mutation-6NUOPHZ3.js +21 -0
  143. package/dist/cli-bundle/chunks/register-operations-JGYVORNN.js +2 -0
  144. package/dist/cli-bundle/chunks/register-setup-C44SIXEH.js +2 -0
  145. package/dist/cli-bundle/chunks/settlement-hook-6MR32OOC.js +7 -0
  146. package/dist/cli-bundle/chunks/stage-PQ7AB63N.js +2 -0
  147. package/dist/cli-bundle/focused-chunks/chunk-6LKTEKHS.js +6 -0
  148. package/dist/cli-bundle/focused-chunks/chunk-6LPXMFLM.js +2 -0
  149. package/dist/cli-bundle/focused-chunks/chunk-A6VEMCRR.js +3 -0
  150. package/dist/cli-bundle/focused-chunks/chunk-AIDL2ZNT.js +3 -0
  151. package/dist/cli-bundle/focused-chunks/chunk-BKPUUW5O.js +1 -0
  152. package/dist/cli-bundle/focused-chunks/chunk-BWOVFE5B.js +2 -0
  153. package/dist/cli-bundle/focused-chunks/chunk-HMDQDRV2.js +8 -0
  154. package/dist/cli-bundle/focused-chunks/chunk-I66IKYKP.js +2 -0
  155. package/dist/cli-bundle/focused-chunks/chunk-IIP6LZ5E.js +2 -0
  156. package/dist/cli-bundle/focused-chunks/chunk-IR2J3NOT.js +2 -0
  157. package/dist/cli-bundle/focused-chunks/chunk-IROZDIDX.js +3 -0
  158. package/dist/cli-bundle/focused-chunks/chunk-ITKDHSBR.js +2 -0
  159. package/dist/cli-bundle/focused-chunks/chunk-K53OIT5J.js +2 -0
  160. package/dist/cli-bundle/focused-chunks/chunk-LQYYPXUK.js +26 -0
  161. package/dist/cli-bundle/focused-chunks/chunk-NQTEE66P.js +13 -0
  162. package/dist/cli-bundle/focused-chunks/chunk-O7Z73ALG.js +2 -0
  163. package/dist/cli-bundle/focused-chunks/chunk-OTMMOKPM.js +91 -0
  164. package/dist/cli-bundle/focused-chunks/chunk-OXOCZJC6.js +2 -0
  165. package/dist/cli-bundle/focused-chunks/chunk-QLAHEDT6.js +2 -0
  166. package/dist/cli-bundle/focused-chunks/chunk-QQIIMMFU.js +2 -0
  167. package/dist/cli-bundle/focused-chunks/chunk-RIE3SJSE.js +9 -0
  168. package/dist/cli-bundle/focused-chunks/chunk-TD544C74.js +8 -0
  169. package/dist/cli-bundle/focused-chunks/chunk-UFTUNBMY.js +27 -0
  170. package/dist/cli-bundle/focused-chunks/chunk-X6CXWWNB.js +2 -0
  171. package/dist/cli-bundle/focused-chunks/chunk-XRS3VNC6.js +44 -0
  172. package/dist/cli-bundle/focused-chunks/chunk-XYPEZGTR.js +2 -0
  173. package/dist/cli-bundle/focused-chunks/chunk-Y2ESLKCF.js +8 -0
  174. package/dist/cli-bundle/focused-chunks/chunk-YSJKQLFR.js +2 -0
  175. package/dist/cli-bundle/focused-chunks/chunk-Z2X7HH3C.js +102 -0
  176. package/dist/cli-bundle/focused-chunks/chunk-ZHWPCVQL.js +78 -0
  177. package/dist/cli-bundle/focused-chunks/context-budget-recovery-CSJV3TY3.js +2 -0
  178. package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-EGEJMG3G.js +4 -0
  179. package/dist/cli-bundle/focused-chunks/{item-revision-2O6MLPEX.js → item-revision-YDACCDVY.js} +2 -2
  180. package/dist/cli-bundle/focused-chunks/item-transaction-UKEQCTKB.js +2 -0
  181. package/dist/cli-bundle/focused-chunks/mutation-actor-AS465LRX.js +2 -0
  182. package/dist/cli-bundle/focused-chunks/mutation-admission-E5UHJZFE.js +2 -0
  183. package/dist/cli-bundle/focused-chunks/settlement-hook-FMLGKG7J.js +7 -0
  184. package/dist/cli-bundle/focused-chunks/stage-36J7YLGI.js +2 -0
  185. package/dist/cli-bundle/main.js +27 -27
  186. package/dist/cli-bundle/sdk-authoring.js +1 -1
  187. package/dist/cli-bundle/sdk-contracts.js +5 -5
  188. package/dist/cli-bundle/sdk-core.js +1 -1
  189. package/dist/cli-bundle/sdk-governance.js +1 -1
  190. package/dist/cli-bundle/sdk-graph.js +1 -1
  191. package/dist/cli-bundle/sdk-merge.js +66 -66
  192. package/dist/cli-bundle/sdk-query.js +1 -1
  193. package/dist/cli-bundle/sdk-runtime.js +1 -1
  194. package/dist/cli-bundle/sdk-testing.js +1 -1
  195. package/dist/cli-bundle/sdk.js +12 -12
  196. package/dist/cli.js +1 -1
  197. package/dist/core/checkpoint/checkpoint-gc.js +1 -1
  198. package/dist/core/checkpoint/mutation-checkpoint.js +2 -2
  199. package/dist/core/checkpoint/mutation-context.js +1 -1
  200. package/dist/core/config/nested-settings.js +1 -1
  201. package/dist/core/config/positional-value.js +1 -1
  202. package/dist/core/diagnostics/remediation.js +1 -1
  203. package/dist/core/extensions/activation-summary-markdown.js +2 -2
  204. package/dist/core/extensions/activation-summary.js +1 -1
  205. package/dist/core/extensions/activation-transaction.js +1 -1
  206. package/dist/core/extensions/capability-usage.js +1 -1
  207. package/dist/core/extensions/command-hook-context.js +1 -1
  208. package/dist/core/extensions/command-metadata-contract.js +1 -1
  209. package/dist/core/extensions/command-visibility-tier.js +1 -1
  210. package/dist/core/extensions/contribution-inventory.js +1 -1
  211. package/dist/core/extensions/exporter-output-contract.js +1 -1
  212. package/dist/core/extensions/extension-candidate.js +1 -1
  213. package/dist/core/extensions/extension-capability-aliases.js +1 -1
  214. package/dist/core/extensions/extension-hook-runtime.js +1 -1
  215. package/dist/core/extensions/extension-policy.js +1 -1
  216. package/dist/core/extensions/extension-registries.js +1 -1
  217. package/dist/core/extensions/extension-runtime-helpers.js +1 -1
  218. package/dist/core/extensions/extension-types.js +1 -1
  219. package/dist/core/extensions/flag-definition-validation.js +1 -1
  220. package/dist/core/extensions/flag-value-types.js +1 -1
  221. package/dist/core/extensions/index.js +1 -1
  222. package/dist/core/extensions/item-field-types.js +1 -1
  223. package/dist/core/extensions/item-fields.js +1 -1
  224. package/dist/core/extensions/loader.js +1 -1
  225. package/dist/core/extensions/manifest-parser.js +1 -1
  226. package/dist/core/extensions/manifest-schema.js +1 -1
  227. package/dist/core/extensions/module-graph-snapshot.js +1 -1
  228. package/dist/core/extensions/mutation-actor-snapshot.js +1 -1
  229. package/dist/core/extensions/mutation-actor.js +1 -1
  230. package/dist/core/extensions/preflight-ownership.js +1 -1
  231. package/dist/core/extensions/read-output-contract.js +1 -1
  232. package/dist/core/extensions/registration-contracts.js +1 -1
  233. package/dist/core/extensions/registration-validation.js +1 -1
  234. package/dist/core/extensions/registration-values.js +1 -1
  235. package/dist/core/extensions/reserved-host-flags.js +1 -1
  236. package/dist/core/extensions/runtime-registrations.js +1 -1
  237. package/dist/core/extensions/service-ownership.js +1 -1
  238. package/dist/core/extensions/version-compat.js +1 -1
  239. package/dist/core/extensions/version-diagnostics.js +1 -1
  240. package/dist/core/fs/atomic-create.js +1 -1
  241. package/dist/core/fs/file-glob.js +1 -1
  242. package/dist/core/fs/fs-utils.js +2 -2
  243. package/dist/core/fs/host-environment-errors.js +1 -1
  244. package/dist/core/fs/index.js +1 -1
  245. package/dist/core/fs/path-utils.js +1 -1
  246. package/dist/core/governance/content-fields.js +1 -1
  247. package/dist/core/governance/issue-codes.js +1 -1
  248. package/dist/core/governance/metadata-coverage.js +1 -1
  249. package/dist/core/history/bridge.js +1 -1
  250. package/dist/core/history/digest.js +1 -1
  251. package/dist/core/history/drift-cache.js +3 -3
  252. package/dist/core/history/drift-scan.js +1 -1
  253. package/dist/core/history/event-classification.js +1 -1
  254. package/dist/core/history/event-index.js +11 -11
  255. package/dist/core/history/history-compact-bulk.js +1 -1
  256. package/dist/core/history/history-diff.js +1 -1
  257. package/dist/core/history/history-rewrite.js +1 -1
  258. package/dist/core/history/history-storage-stats.js +1 -1
  259. package/dist/core/history/history-stream-policy.js +1 -1
  260. package/dist/core/history/history.js +2 -2
  261. package/dist/core/history/identity.js +1 -1
  262. package/dist/core/history/index.js +1 -1
  263. package/dist/core/history/operation-contract.js +1 -1
  264. package/dist/core/history/projection.js +1 -1
  265. package/dist/core/history/read.js +1 -1
  266. package/dist/core/history/replay.js +2 -2
  267. package/dist/core/history/stream-summary.js +2 -2
  268. package/dist/core/history/tombstone.js +1 -1
  269. package/dist/core/history/version-address.js +1 -1
  270. package/dist/core/history/workspace-history.js +2 -2
  271. package/dist/core/io/body-file.js +1 -1
  272. package/dist/core/io/bulk-ids-input.js +2 -2
  273. package/dist/core/item/actionability.js +1 -1
  274. package/dist/core/item/deferred-fields.js +1 -1
  275. package/dist/core/item/dependency-reference.js +1 -1
  276. package/dist/core/item/id.js +1 -1
  277. package/dist/core/item/index.js +1 -1
  278. package/dist/core/item/item-format-version.js +1 -1
  279. package/dist/core/item/item-format.js +7 -7
  280. package/dist/core/item/item-record.js +1 -1
  281. package/dist/core/item/item-type-definition.js +1 -1
  282. package/dist/core/item/literal-mutation-input.js +1 -1
  283. package/dist/core/item/parent-reference-policy.js +1 -1
  284. package/dist/core/item/parse.js +8 -8
  285. package/dist/core/item/plan-lifecycle.js +1 -1
  286. package/dist/core/item/priority.js +1 -1
  287. package/dist/core/item/sprint-release-format.js +1 -1
  288. package/dist/core/item/status-filter.js +1 -1
  289. package/dist/core/item/status.js +1 -1
  290. package/dist/core/item/toon-decode.js +1 -1
  291. package/dist/core/item/type-registry.js +1 -1
  292. package/dist/core/item/type-synonyms.js +1 -1
  293. package/dist/core/lock/index.js +1 -1
  294. package/dist/core/lock/lock-confinement.js +1 -1
  295. package/dist/core/lock/lock-gc.js +1 -1
  296. package/dist/core/lock/lock-owner.js +1 -1
  297. package/dist/core/lock/lock.js +4 -4
  298. package/dist/core/output/linked-test-projection.js +5 -5
  299. package/dist/core/output/mutation-projection.js +1 -1
  300. package/dist/core/output/output-control.js +1 -1
  301. package/dist/core/output/output.js +19 -19
  302. package/dist/core/output/query-summary.js +1 -1
  303. package/dist/core/output/tabular.js +3 -3
  304. package/dist/core/packages/manifest.js +1 -1
  305. package/dist/core/packages/root.js +1 -1
  306. package/dist/core/policy/workflow-policy-schema.js +1 -1
  307. package/dist/core/policy/workflow-policy-store.js +1 -1
  308. package/dist/core/policy/workflow-policy.js +1 -1
  309. package/dist/core/profile/profile-describe.js +1 -1
  310. package/dist/core/profile/profile-lint.d.ts +1 -1
  311. package/dist/core/profile/profile-lint.js +1 -1
  312. package/dist/core/profile/profile-plan.js +1 -1
  313. package/dist/core/profile/profile-presets.js +4 -4
  314. package/dist/core/reproducibility/context.js +1 -1
  315. package/dist/core/schema/fields-file.js +2 -2
  316. package/dist/core/schema/item-types-file.js +2 -2
  317. package/dist/core/schema/runtime-field-filters.js +1 -1
  318. package/dist/core/schema/runtime-field-values.js +1 -1
  319. package/dist/core/schema/runtime-schema.js +2 -2
  320. package/dist/core/schema/status-defs-file.js +2 -2
  321. package/dist/core/schema/status-token.js +1 -1
  322. package/dist/core/schema/type-inference.js +1 -1
  323. package/dist/core/schema/type-presets.js +1 -1
  324. package/dist/core/schema/type-workflows.js +1 -1
  325. package/dist/core/search/background-refresh.js +2 -2
  326. package/dist/core/search/bm25.js +1 -1
  327. package/dist/core/search/cache.js +2 -2
  328. package/dist/core/search/corpus.js +1 -1
  329. package/dist/core/search/embedding-batches.js +1 -1
  330. package/dist/core/search/eval-thresholds.js +1 -1
  331. package/dist/core/search/eval.js +1 -1
  332. package/dist/core/search/http-client.js +1 -1
  333. package/dist/core/search/providers.js +1 -1
  334. package/dist/core/search/relevance.js +1 -1
  335. package/dist/core/search/semantic-defaults.js +1 -1
  336. package/dist/core/search/staleness.js +1 -1
  337. package/dist/core/search/vector-stores.js +2 -2
  338. package/dist/core/search/vectorization-metadata.js +1 -1
  339. package/dist/core/sentry/helpers.js +1 -1
  340. package/dist/core/sentry/instrument.js +1 -1
  341. package/dist/core/sentry/sensitive-assignments.js +1 -1
  342. package/dist/core/session/session-state.js +1 -1
  343. package/dist/core/shared/agent-session-context.js +1 -1
  344. package/dist/core/shared/author.js +5 -5
  345. package/dist/core/shared/command-line.js +1 -1
  346. package/dist/core/shared/command-types.js +0 -1
  347. package/dist/core/shared/conflict-markers.js +1 -1
  348. package/dist/core/shared/constants.js +1 -1
  349. package/dist/core/shared/error-details.js +1 -1
  350. package/dist/core/shared/errors.js +1 -1
  351. package/dist/core/shared/html-entity-decode.js +1 -1
  352. package/dist/core/shared/index.js +1 -1
  353. package/dist/core/shared/item-metadata-contract.js +1 -1
  354. package/dist/core/shared/lazy-module.js +1 -1
  355. package/dist/core/shared/levenshtein.js +1 -1
  356. package/dist/core/shared/memo.js +1 -1
  357. package/dist/core/shared/numeric-parsers.js +1 -1
  358. package/dist/core/shared/option-alias-visibility.js +1 -1
  359. package/dist/core/shared/output-unicode.js +1 -1
  360. package/dist/core/shared/primitives.js +1 -1
  361. package/dist/core/shared/process-tree.js +2 -2
  362. package/dist/core/shared/secret-rules.js +5 -5
  363. package/dist/core/shared/serial-queue.js +1 -1
  364. package/dist/core/shared/serialization.js +1 -1
  365. package/dist/core/shared/split-comma-list.js +1 -1
  366. package/dist/core/shared/text-normalization.js +1 -1
  367. package/dist/core/shared/time.js +2 -2
  368. package/dist/core/shared/url-credentials.js +1 -1
  369. package/dist/core/store/index.js +1 -1
  370. package/dist/core/store/item-format-migration.js +1 -1
  371. package/dist/core/store/item-metadata-cache.js +1 -1
  372. package/dist/core/store/item-metadata-query-index.js +11 -11
  373. package/dist/core/store/item-metadata-read-work.js +1 -1
  374. package/dist/core/store/item-mutation-precondition.js +1 -1
  375. package/dist/core/store/item-store.js +1 -1
  376. package/dist/core/store/paths.js +1 -1
  377. package/dist/core/store/settings-concurrency.js +1 -1
  378. package/dist/core/store/settings-read-cache.js +1 -1
  379. package/dist/core/store/settings-sections.js +2 -2
  380. package/dist/core/store/settings-validator.js +1 -1
  381. package/dist/core/store/settings.d.ts +3 -1
  382. package/dist/core/store/settings.js +6 -6
  383. package/dist/core/store/sqlite-runtime.js +1 -1
  384. package/dist/core/store/tracker-preflight.js +1 -1
  385. package/dist/core/store/transaction-coordinator-scope.js +1 -1
  386. package/dist/core/telemetry/consent.js +3 -3
  387. package/dist/core/telemetry/observability.js +1 -1
  388. package/dist/core/telemetry/policy.js +1 -1
  389. package/dist/core/telemetry/read-sampling.js +2 -2
  390. package/dist/core/telemetry/runtime.js +9 -9
  391. package/dist/core/test/background-runs.js +4 -4
  392. package/dist/core/test/item-test-run-tracking.js +1 -1
  393. package/dist/core/test/run-selectors.js +1 -1
  394. package/dist/core/validate/estimate-defaults.js +1 -1
  395. package/dist/core/validate/fix-planning.js +1 -1
  396. package/dist/core/validate/linked-artifact-reference.js +1 -1
  397. package/dist/core/validate/missing-by-type.js +1 -1
  398. package/dist/core/validate/missing-link-owners.js +1 -1
  399. package/dist/core/validate/stale-file-classification.js +1 -1
  400. package/dist/mcp/http-server.js +5 -5
  401. package/dist/mcp/legacy-adapter.js +1 -1
  402. package/dist/mcp/runtime-capabilities.js +1 -1
  403. package/dist/mcp/server.js +4 -4
  404. package/dist/mcp/tool-definitions.js +1 -1
  405. package/dist/sdk/actionability.js +1 -1
  406. package/dist/sdk/agent/closed-domain-contracts.js +1 -1
  407. package/dist/sdk/agent/command-recovery.js +1 -1
  408. package/dist/sdk/agent/command-suggestions.js +1 -1
  409. package/dist/sdk/agent/create-option-policy.js +1 -1
  410. package/dist/sdk/agent/identity-config.js +1 -1
  411. package/dist/sdk/agent/item-addressing.js +1 -1
  412. package/dist/sdk/agent/linked-resource-recovery.js +1 -1
  413. package/dist/sdk/agent/refusal-closure-census.js +2 -2
  414. package/dist/sdk/agent/refusal-corpus-contracts.js +1 -1
  415. package/dist/sdk/agent/subcommand-recovery.js +1 -1
  416. package/dist/sdk/agent-capability-contracts.js +3 -3
  417. package/dist/sdk/agent-session-context.js +1 -1
  418. package/dist/sdk/annotations.js +1 -1
  419. package/dist/sdk/author-attribution.js +1 -1
  420. package/dist/sdk/cli-bootstrap.js +1 -1
  421. package/dist/sdk/cli-contracts/agent-output-contracts.js +5 -5
  422. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
  423. package/dist/sdk/cli-contracts/command-aliases.js +1 -1
  424. package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -1
  425. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
  426. package/dist/sdk/cli-contracts/commander-types.js +1 -1
  427. package/dist/sdk/cli-contracts/completeness.js +1 -1
  428. package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
  429. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  430. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +2 -2
  431. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  432. package/dist/sdk/cli-contracts/registration-helpers.js +7 -7
  433. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  434. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -1
  435. package/dist/sdk/cli-contracts/string-lists.js +1 -1
  436. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
  437. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  438. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  439. package/dist/sdk/cli-contracts/typed-action-inputs.js +0 -1
  440. package/dist/sdk/cli-contracts.js +1 -1
  441. package/dist/sdk/cli-program.js +1 -1
  442. package/dist/sdk/command-line.js +1 -1
  443. package/dist/sdk/comments.js +1 -1
  444. package/dist/sdk/compile-cache.js +1 -1
  445. package/dist/sdk/completion/bash.js +2 -2
  446. package/dist/sdk/completion/fish.js +72 -72
  447. package/dist/sdk/completion/shared.js +1 -1
  448. package/dist/sdk/completion/zsh.js +75 -75
  449. package/dist/sdk/completion.js +1 -1
  450. package/dist/sdk/config.js +1 -1
  451. package/dist/sdk/context/recency.js +1 -1
  452. package/dist/sdk/context/semantic-session-attribution.js +1 -1
  453. package/dist/sdk/context/usage-egress.js +1 -1
  454. package/dist/sdk/context/usage-ledger.js +6 -6
  455. package/dist/sdk/context-intent-contracts.js +1 -1
  456. package/dist/sdk/context-intent-runtime.js +1 -1
  457. package/dist/sdk/context-packing.js +1 -1
  458. package/dist/sdk/context-relevance.js +1 -1
  459. package/dist/sdk/context-signal-store.js +2 -2
  460. package/dist/sdk/context-usage.js +1 -1
  461. package/dist/sdk/dependencies/context-budget-recovery.js +1 -1
  462. package/dist/sdk/dependencies.js +1 -1
  463. package/dist/sdk/dependency-flag-validation.js +1 -1
  464. package/dist/sdk/dependency-provenance.js +1 -1
  465. package/dist/sdk/docs.js +1 -1
  466. package/dist/sdk/duplicates.js +1 -1
  467. package/dist/sdk/environment/host-environment-errors.js +1 -1
  468. package/dist/sdk/environment/project-runtime-compatibility.js +2 -2
  469. package/dist/sdk/environment/source-context.js +1 -1
  470. package/dist/sdk/environment/tracker-preflight.js +1 -1
  471. package/dist/sdk/error-code-catalog.js +1 -1
  472. package/dist/sdk/error-runtime.js +1 -1
  473. package/dist/sdk/errors.js +1 -1
  474. package/dist/sdk/eval.js +1 -1
  475. package/dist/sdk/extension/author-manifest.js +1 -1
  476. package/dist/sdk/extension/bundled-catalog.js +1 -1
  477. package/dist/sdk/extension/command-options.js +1 -1
  478. package/dist/sdk/extension/concurrency.js +1 -1
  479. package/dist/sdk/extension/copy-scope.js +1 -1
  480. package/dist/sdk/extension/custom-field-collisions.js +1 -1
  481. package/dist/sdk/extension/describe.js +3 -3
  482. package/dist/sdk/extension/doctor.js +1 -1
  483. package/dist/sdk/extension/install-plan.js +1 -1
  484. package/dist/sdk/extension/install-receipts.js +1 -1
  485. package/dist/sdk/extension/install-runtime.js +3 -3
  486. package/dist/sdk/extension/install-snapshot.js +1 -1
  487. package/dist/sdk/extension/install-sources.js +5 -5
  488. package/dist/sdk/extension/managed-state.js +2 -2
  489. package/dist/sdk/extension/managed-update-status.js +1 -1
  490. package/dist/sdk/extension/migrations.js +2 -2
  491. package/dist/sdk/extension/native-command-options.js +1 -1
  492. package/dist/sdk/extension/output-ownership.js +1 -1
  493. package/dist/sdk/extension/runtime-summary.js +1 -1
  494. package/dist/sdk/extension/scaffold.js +11 -11
  495. package/dist/sdk/extension/shared.js +1 -1
  496. package/dist/sdk/extension/source-resolution.js +1 -1
  497. package/dist/sdk/extension/static-inventory.js +1 -1
  498. package/dist/sdk/extension/update-check.js +1 -1
  499. package/dist/sdk/extension-command-context.js +2 -2
  500. package/dist/sdk/extension-contracts.js +1 -1
  501. package/dist/sdk/extension.js +1 -1
  502. package/dist/sdk/files.js +1 -1
  503. package/dist/sdk/flag-invocation-contracts.js +1 -1
  504. package/dist/sdk/generated/error-code-catalog-rows.js +1 -1
  505. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  506. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  507. package/dist/sdk/generated-error-code-catalog.js +1 -1
  508. package/dist/sdk/governance/assurance-action-contracts.js +0 -1
  509. package/dist/sdk/governance/assurance-action.js +1 -1
  510. package/dist/sdk/governance/assurance-limits.js +1 -1
  511. package/dist/sdk/governance/assurance-mutation-error.js +1 -1
  512. package/dist/sdk/governance/assurance-presets.js +1 -1
  513. package/dist/sdk/governance/assurance-runtime.js +1 -1
  514. package/dist/sdk/governance/assurance.js +4 -4
  515. package/dist/sdk/governance/boundary-fixtures.js +1 -1
  516. package/dist/sdk/governance/closure-timestamps.js +1 -1
  517. package/dist/sdk/governance/defect-recurrence-coverage.js +1 -1
  518. package/dist/sdk/governance/defect-recurrence-graph.js +1 -1
  519. package/dist/sdk/governance/defect-recurrence-signals.js +1 -1
  520. package/dist/sdk/governance/defect-recurrence.js +2 -2
  521. package/dist/sdk/governance/extension-host-version.js +1 -1
  522. package/dist/sdk/governance/gc.js +1 -1
  523. package/dist/sdk/governance/health/history-drift-remedies.js +1 -1
  524. package/dist/sdk/governance/health/projection.js +1 -1
  525. package/dist/sdk/governance/health-merge-evidence.js +1 -1
  526. package/dist/sdk/governance/health.js +2 -2
  527. package/dist/sdk/governance/hierarchy-validation.js +1 -1
  528. package/dist/sdk/governance/in-progress-work-health.js +1 -1
  529. package/dist/sdk/governance/lifecycle-dependency-cycles.js +1 -1
  530. package/dist/sdk/governance/linked-file-report.js +1 -1
  531. package/dist/sdk/governance/merge-receipt-history.js +1 -1
  532. package/dist/sdk/governance/provenance-health.js +4 -4
  533. package/dist/sdk/governance/reindex.js +5 -5
  534. package/dist/sdk/governance/stale-work.js +1 -1
  535. package/dist/sdk/governance/status-role-diagnostics.js +1 -1
  536. package/dist/sdk/governance/storage-integrity.js +1 -1
  537. package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
  538. package/dist/sdk/governance/upgrade.js +2 -2
  539. package/dist/sdk/governance/validate-deferred-fields.js +1 -1
  540. package/dist/sdk/governance/validate-history-drift.js +1 -1
  541. package/dist/sdk/governance/validate-item-reader.js +1 -1
  542. package/dist/sdk/governance/validate-normalization.js +1 -1
  543. package/dist/sdk/governance/validate.js +1 -1
  544. package/dist/sdk/governance/workflow-completeness.js +1 -1
  545. package/dist/sdk/governance/workflow-policy.js +3 -3
  546. package/dist/sdk/governance/workspace-position.js +2 -2
  547. package/dist/sdk/graph/analytics.js +1 -1
  548. package/dist/sdk/graph/assembly.js +1 -1
  549. package/dist/sdk/graph/cache.js +1 -1
  550. package/dist/sdk/graph/cardinality-integrity.js +1 -1
  551. package/dist/sdk/graph/centrality.js +1 -1
  552. package/dist/sdk/graph/deadline-scheduling.js +1 -1
  553. package/dist/sdk/graph/durable-cache.js +1 -1
  554. package/dist/sdk/graph/governance-contracts.js +1 -1
  555. package/dist/sdk/graph/governance.js +1 -1
  556. package/dist/sdk/graph/hierarchy-integrity.js +1 -1
  557. package/dist/sdk/graph/lifecycle-coverage.js +1 -1
  558. package/dist/sdk/graph/mutation-advisory.js +1 -1
  559. package/dist/sdk/graph/query-contracts.js +1 -1
  560. package/dist/sdk/graph/remediation.js +1 -1
  561. package/dist/sdk/graph/run.js +1 -1
  562. package/dist/sdk/graph/scheduling.js +1 -1
  563. package/dist/sdk/graph/traversal.js +1 -1
  564. package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -1
  565. package/dist/sdk/guide-topics.js +1 -1
  566. package/dist/sdk/guide.js +7 -7
  567. package/dist/sdk/history/append-only-repair.js +4 -4
  568. package/dist/sdk/history/attestation-command.js +2 -2
  569. package/dist/sdk/history/attestation-contract.js +1 -1
  570. package/dist/sdk/history/attestation-scan.js +1 -1
  571. package/dist/sdk/history/attestation.js +1 -1
  572. package/dist/sdk/history/maintenance.js +1 -1
  573. package/dist/sdk/history/reanchor-refusal.js +1 -1
  574. package/dist/sdk/history/reseed.js +1 -1
  575. package/dist/sdk/history/salvage.js +5 -5
  576. package/dist/sdk/history/subject.js +1 -1
  577. package/dist/sdk/history-analytics.js +1 -1
  578. package/dist/sdk/history-compact.js +1 -1
  579. package/dist/sdk/history-mcp.js +1 -1
  580. package/dist/sdk/history-provenance.js +1 -1
  581. package/dist/sdk/history-read.js +1 -1
  582. package/dist/sdk/history-redact.js +1 -1
  583. package/dist/sdk/history-repair.js +1 -1
  584. package/dist/sdk/improvement-ledger-validation.js +1 -1
  585. package/dist/sdk/improvement-ledger.js +2 -2
  586. package/dist/sdk/init-agent-guidance.js +10 -10
  587. package/dist/sdk/init.js +14 -14
  588. package/dist/sdk/invocation-author.js +1 -1
  589. package/dist/sdk/item-children.js +1 -1
  590. package/dist/sdk/item-metadata-index.js +1 -1
  591. package/dist/sdk/item-schedule.js +1 -1
  592. package/dist/sdk/item-transaction.js +1 -1
  593. package/dist/sdk/learnings.js +1 -1
  594. package/dist/sdk/lifecycle/append.js +3 -3
  595. package/dist/sdk/lifecycle/checkpoint-rollback.js +1 -1
  596. package/dist/sdk/lifecycle/claim.js +1 -1
  597. package/dist/sdk/lifecycle/cli-input.js +1 -1
  598. package/dist/sdk/lifecycle/close-many.js +1 -1
  599. package/dist/sdk/lifecycle/close.js +1 -1
  600. package/dist/sdk/lifecycle/copy.js +1 -1
  601. package/dist/sdk/lifecycle/core-field-recovery.js +1 -1
  602. package/dist/sdk/lifecycle/core-item-fields.js +1 -1
  603. package/dist/sdk/lifecycle/create-deferrals.js +1 -1
  604. package/dist/sdk/lifecycle/create.js +1 -1
  605. package/dist/sdk/lifecycle/delete.js +1 -1
  606. package/dist/sdk/lifecycle/dependency-removal.js +1 -1
  607. package/dist/sdk/lifecycle/event-validation-messages.js +1 -1
  608. package/dist/sdk/lifecycle/focus.js +1 -1
  609. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -1
  610. package/dist/sdk/lifecycle/item-revision.js +1 -1
  611. package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -1
  612. package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -1
  613. package/dist/sdk/lifecycle/mcp-actions.js +1 -1
  614. package/dist/sdk/lifecycle/metadata-normalizers.js +1 -1
  615. package/dist/sdk/lifecycle/mutation-command-options.js +0 -1
  616. package/dist/sdk/lifecycle/mutation-facet-contracts.js +1 -1
  617. package/dist/sdk/lifecycle/mutation-option-validation.js +1 -1
  618. package/dist/sdk/lifecycle/plan-mutation-receipt.js +1 -1
  619. package/dist/sdk/lifecycle/plan.js +1 -1
  620. package/dist/sdk/lifecycle/recurrence-parsers.js +1 -1
  621. package/dist/sdk/lifecycle/release-handoff.js +1 -1
  622. package/dist/sdk/lifecycle/reopen.js +1 -1
  623. package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +2 -2
  624. package/dist/sdk/lifecycle/repeated-terminal-state.js +1 -1
  625. package/dist/sdk/lifecycle/restore.js +1 -1
  626. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
  627. package/dist/sdk/lifecycle/start-blockers.js +1 -1
  628. package/dist/sdk/lifecycle/structured-mutation-plan.js +1 -1
  629. package/dist/sdk/lifecycle/task-composition.js +1 -1
  630. package/dist/sdk/lifecycle/update-many.js +1 -1
  631. package/dist/sdk/lifecycle/update.js +2 -2
  632. package/dist/sdk/lifecycle/workflow-transition.js +1 -1
  633. package/dist/sdk/lifecycle-completion.js +1 -1
  634. package/dist/sdk/lifecycle-policy.js +1 -1
  635. package/dist/sdk/linked-artifacts.js +2 -2
  636. package/dist/sdk/mcp/apps.js +5 -5
  637. package/dist/sdk/mcp/authorization.js +1 -1
  638. package/dist/sdk/mcp/discovery.js +1 -1
  639. package/dist/sdk/mcp/executable.js +4 -4
  640. package/dist/sdk/mcp/interactions.js +1 -1
  641. package/dist/sdk/mcp/protocol.js +1 -1
  642. package/dist/sdk/mcp/skills.js +3 -3
  643. package/dist/sdk/mcp/subscriptions.js +1 -1
  644. package/dist/sdk/mcp/tasks.js +2 -2
  645. package/dist/sdk/mcp/transport.js +1 -1
  646. package/dist/sdk/merge/abandoned-receipts.js +1 -1
  647. package/dist/sdk/merge/driver.js +7 -7
  648. package/dist/sdk/merge/history-scalar-rebase.js +1 -1
  649. package/dist/sdk/merge/ignored-artifacts.js +1 -1
  650. package/dist/sdk/merge/index.js +1 -1
  651. package/dist/sdk/merge/indexed-receipt-blobs.js +2 -2
  652. package/dist/sdk/merge/install.js +6 -6
  653. package/dist/sdk/merge/receipt-file-boundary.js +1 -1
  654. package/dist/sdk/merge/receipt-operation.js +1 -1
  655. package/dist/sdk/merge/receipt-schema.js +1 -1
  656. package/dist/sdk/merge/receipts.js +4 -4
  657. package/dist/sdk/merge/reconcile.js +1 -1
  658. package/dist/sdk/merge/settlement-hook.js +4 -4
  659. package/dist/sdk/merge/stage.js +1 -1
  660. package/dist/sdk/merge/three-way.js +9 -9
  661. package/dist/sdk/merge/worktree-config.js +2 -2
  662. package/dist/sdk/merge.js +1 -1
  663. package/dist/sdk/mutation-events.js +1 -1
  664. package/dist/sdk/mutation-guard.js +1 -1
  665. package/dist/sdk/notes.js +1 -1
  666. package/dist/sdk/output/fit-envelope.js +1 -1
  667. package/dist/sdk/output/list-envelope.js +1 -1
  668. package/dist/sdk/output/table-rows.js +1 -1
  669. package/dist/sdk/output-contracts.js +1 -1
  670. package/dist/sdk/output-projection.js +1 -1
  671. package/dist/sdk/output-token-accounting.js +1 -1
  672. package/dist/sdk/output.js +2 -2
  673. package/dist/sdk/ownership-source.js +1 -1
  674. package/dist/sdk/package-import-adapters.js +1 -1
  675. package/dist/sdk/package-migrations.js +1 -1
  676. package/dist/sdk/package-runtime-options.js +1 -1
  677. package/dist/sdk/pagination.js +1 -1
  678. package/dist/sdk/profile.js +5 -5
  679. package/dist/sdk/provenance.js +1 -1
  680. package/dist/sdk/public-surface.json +1 -1
  681. package/dist/sdk/query/activity.js +1 -1
  682. package/dist/sdk/query/aggregate.js +1 -1
  683. package/dist/sdk/query/calendar.js +4 -4
  684. package/dist/sdk/query/complete-list.js +1 -1
  685. package/dist/sdk/query/context.js +2 -2
  686. package/dist/sdk/query/declared-blockers.js +1 -1
  687. package/dist/sdk/query/duplicate-candidates.js +1 -1
  688. package/dist/sdk/query/get-facet-roots.js +1 -1
  689. package/dist/sdk/query/get.js +1 -1
  690. package/dist/sdk/query/history.js +1 -1
  691. package/dist/sdk/query/item-filter-options.js +0 -1
  692. package/dist/sdk/query/light-metadata.js +1 -1
  693. package/dist/sdk/query/list-filter-shared.js +1 -1
  694. package/dist/sdk/query/list.js +1 -1
  695. package/dist/sdk/query/multi-value-filters.js +1 -1
  696. package/dist/sdk/query/next-ranking-policy.js +1 -1
  697. package/dist/sdk/query/next-ready-budget.js +1 -1
  698. package/dist/sdk/query/next.js +2 -2
  699. package/dist/sdk/query/parsers.js +1 -1
  700. package/dist/sdk/query/projection-contracts.js +1 -1
  701. package/dist/sdk/query/search/corpus.js +2 -2
  702. package/dist/sdk/query/search/filters.js +1 -1
  703. package/dist/sdk/query/search/input.js +1 -1
  704. package/dist/sdk/query/search/lexical.js +1 -1
  705. package/dist/sdk/query/search/response.js +1 -1
  706. package/dist/sdk/query/search/semantic.js +3 -3
  707. package/dist/sdk/query/search/types.js +0 -1
  708. package/dist/sdk/query/search-contracts.js +1 -1
  709. package/dist/sdk/query/search-pagination.js +1 -1
  710. package/dist/sdk/query/search-rendering.js +1 -1
  711. package/dist/sdk/query/search.js +1 -1
  712. package/dist/sdk/query/window-pagination.js +1 -1
  713. package/dist/sdk/query/workspace-contracts.js +1 -1
  714. package/dist/sdk/read-output/continuation.js +1 -1
  715. package/dist/sdk/read-output/extension.js +1 -1
  716. package/dist/sdk/read-output/options.js +1 -1
  717. package/dist/sdk/read-output/positional-rows.js +1 -1
  718. package/dist/sdk/read-output/provenance.js +1 -1
  719. package/dist/sdk/read-output/session-result.js +0 -1
  720. package/dist/sdk/read-output/surfaces.js +1 -1
  721. package/dist/sdk/read-output/tail-retention.js +1 -1
  722. package/dist/sdk/read-output-budget.js +1 -1
  723. package/dist/sdk/read-output-contracts.js +1 -1
  724. package/dist/sdk/read-output-rows.js +1 -1
  725. package/dist/sdk/read-output-session.js +1 -1
  726. package/dist/sdk/relationship-analytics.js +1 -1
  727. package/dist/sdk/relationship-context.js +1 -1
  728. package/dist/sdk/relationship-history.js +6 -6
  729. package/dist/sdk/relationship-kinds/contract.js +1 -1
  730. package/dist/sdk/relationships.js +1 -1
  731. package/dist/sdk/reproducibility/process.js +1 -1
  732. package/dist/sdk/runtime/actions.js +1 -1
  733. package/dist/sdk/runtime/context.js +1 -1
  734. package/dist/sdk/runtime/mutation-admission.js +1 -1
  735. package/dist/sdk/runtime/mutation-value-validation.js +1 -1
  736. package/dist/sdk/runtime/schema-preview.js +1 -1
  737. package/dist/sdk/runtime/schema.js +1 -1
  738. package/dist/sdk/runtime-action-aliases.js +1 -1
  739. package/dist/sdk/runtime-extended-actions.js +1 -1
  740. package/dist/sdk/runtime-input.d.ts +2 -0
  741. package/dist/sdk/runtime-input.js +1 -1
  742. package/dist/sdk/runtime-primitives.js +1 -1
  743. package/dist/sdk/runtime-public-contracts.js +0 -1
  744. package/dist/sdk/runtime-stats-options.js +1 -1
  745. package/dist/sdk/runtime.d.ts +5 -3
  746. package/dist/sdk/runtime.js +1 -1
  747. package/dist/sdk/scheduling-shortcuts.js +1 -1
  748. package/dist/sdk/schema/field-option-collisions.js +2 -0
  749. package/dist/sdk/schema-migration.js +4 -4
  750. package/dist/sdk/schema.js +7 -7
  751. package/dist/sdk/search-refresh-worker.js +1 -1
  752. package/dist/sdk/similarity-scoring.js +1 -1
  753. package/dist/sdk/similarity.js +1 -1
  754. package/dist/sdk/start-task-status.js +1 -1
  755. package/dist/sdk/stats.js +1 -1
  756. package/dist/sdk/structured-mutations.js +1 -1
  757. package/dist/sdk/telemetry-flush.js +1 -1
  758. package/dist/sdk/telemetry.js +4 -4
  759. package/dist/sdk/templates.js +3 -3
  760. package/dist/sdk/test/batch.js +2 -2
  761. package/dist/sdk/test/command-args.js +1 -1
  762. package/dist/sdk/test/command-resolution.js +2 -2
  763. package/dist/sdk/test/entry.js +2 -2
  764. package/dist/sdk/test/execution-receipts.js +2 -2
  765. package/dist/sdk/test/execution.js +5 -5
  766. package/dist/sdk/test/json-path.js +1 -1
  767. package/dist/sdk/test/linked-command-detection.js +1 -1
  768. package/dist/sdk/test/measurements.js +1 -1
  769. package/dist/sdk/test/parsers.js +1 -1
  770. package/dist/sdk/test/prerequisites.js +1 -1
  771. package/dist/sdk/test/receipt-index-snapshot.js +1 -1
  772. package/dist/sdk/test/run-phases.js +1 -1
  773. package/dist/sdk/test/runs.js +1 -1
  774. package/dist/sdk/test/trust.js +2 -2
  775. package/dist/sdk/test/update.js +1 -1
  776. package/dist/sdk/test/workspace-snapshot.js +1 -1
  777. package/dist/sdk/traceability/runtime-files-lookup.js +1 -1
  778. package/dist/sdk/traceability/source-traceability.js +2 -2
  779. package/dist/sdk/tracker-root-discovery.js +1 -1
  780. package/dist/sdk/transactions/item-finalization.js +1 -1
  781. package/dist/sdk/workspace-contracts-cache.js +1 -1
  782. package/dist/sdk/workspace-contracts.js +1 -1
  783. package/dist/sdk/workspace-memory.js +2 -2
  784. package/dist/sdk/workspace-snapshot.js +5 -5
  785. package/dist/sdk/workspace-transaction-gc.js +1 -1
  786. package/dist/sdk/workspace-transaction.js +2 -2
  787. package/dist/sdk/workspace.js +6 -6
  788. package/dist/types/index.js +1 -1
  789. package/dist/types.js +1 -1
  790. package/docs/COMMANDS.md +1 -1
  791. package/docs/EXTENSIONS.md +1 -1
  792. package/docs/SDK.md +74 -4
  793. package/marketplace.json +1 -1
  794. package/package.json +2 -1
  795. package/packages/pm-beads/package.json +1 -1
  796. package/packages/pm-calendar/package.json +1 -1
  797. package/packages/pm-command-kit/package.json +1 -1
  798. package/packages/pm-digital-twin/package.json +1 -1
  799. package/packages/pm-governance-audit/package.json +1 -1
  800. package/packages/pm-guide-shell/package.json +1 -1
  801. package/packages/pm-kanban/package.json +1 -1
  802. package/packages/pm-lifecycle-hooks/package.json +1 -1
  803. package/packages/pm-linked-test-adapters/package.json +1 -1
  804. package/packages/pm-search-advanced/package.json +1 -1
  805. package/packages/pm-templates/package.json +1 -1
  806. package/packages/pm-todos/package.json +1 -1
  807. package/packages/pm-vcs/package.json +1 -1
  808. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  809. package/plugins/pm-claude/package.json +1 -1
  810. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  811. package/plugins/pm-codex/package.json +1 -1
  812. package/plugins/pm-codex/plugin.json +1 -1
  813. package/runtime-dependencies.json +1 -1
  814. package/scripts/finalize-build.mjs +63 -24
  815. package/scripts/prepare-build-cache.mjs +28 -1
  816. package/dist/cli-bundle/chunks/chunk-3W47ZZ5T.js +0 -9
  817. package/dist/cli-bundle/chunks/chunk-4TB5D6HL.js +0 -125
  818. package/dist/cli-bundle/chunks/chunk-5ZMVLWE3.js +0 -2
  819. package/dist/cli-bundle/chunks/chunk-6BBDEIKC.js +0 -33
  820. package/dist/cli-bundle/chunks/chunk-AR4NP5HI.js +0 -3
  821. package/dist/cli-bundle/chunks/chunk-B4PPFOPY.js +0 -3
  822. package/dist/cli-bundle/chunks/chunk-CAR2L5NW.js +0 -8
  823. package/dist/cli-bundle/chunks/chunk-DEZPZOQ7.js +0 -2
  824. package/dist/cli-bundle/chunks/chunk-EIGUKEV6.js +0 -2
  825. package/dist/cli-bundle/chunks/chunk-GTPCAJMZ.js +0 -8
  826. package/dist/cli-bundle/chunks/chunk-GYP24M7W.js +0 -2
  827. package/dist/cli-bundle/chunks/chunk-HC2OPETM.js +0 -2
  828. package/dist/cli-bundle/chunks/chunk-HKUV74K3.js +0 -2
  829. package/dist/cli-bundle/chunks/chunk-HXHYDO2R.js +0 -115
  830. package/dist/cli-bundle/chunks/chunk-IB7UB5TE.js +0 -2
  831. package/dist/cli-bundle/chunks/chunk-J2LABXBL.js +0 -2
  832. package/dist/cli-bundle/chunks/chunk-J52BEBSS.js +0 -2
  833. package/dist/cli-bundle/chunks/chunk-KQIZ34SF.js +0 -3
  834. package/dist/cli-bundle/chunks/chunk-LQBWLNZJ.js +0 -3
  835. package/dist/cli-bundle/chunks/chunk-OJTMGDON.js +0 -31
  836. package/dist/cli-bundle/chunks/chunk-SPPHDVZE.js +0 -2
  837. package/dist/cli-bundle/chunks/chunk-TC6XLIYO.js +0 -2
  838. package/dist/cli-bundle/chunks/chunk-U7EL3AYA.js +0 -3
  839. package/dist/cli-bundle/chunks/chunk-VQFWW4EF.js +0 -6
  840. package/dist/cli-bundle/chunks/chunk-X6MIWTTT.js +0 -2
  841. package/dist/cli-bundle/chunks/chunk-XC5Q2ZV7.js +0 -2
  842. package/dist/cli-bundle/chunks/chunk-XFHPKXAE.js +0 -71
  843. package/dist/cli-bundle/chunks/chunk-YHVLVSEZ.js +0 -9
  844. package/dist/cli-bundle/chunks/chunk-YMUSRWV4.js +0 -9
  845. package/dist/cli-bundle/chunks/chunk-YR2KEBHP.js +0 -2
  846. package/dist/cli-bundle/chunks/context-budget-recovery-L2WP5S26.js +0 -2
  847. package/dist/cli-bundle/chunks/indexed-receipt-blobs-ITTXIN4K.js +0 -4
  848. package/dist/cli-bundle/chunks/item-transaction-QY3PUHEI.js +0 -2
  849. package/dist/cli-bundle/chunks/mutation-actor-FWLYWJ37.js +0 -2
  850. package/dist/cli-bundle/chunks/mutation-admission-7ZDCK3G2.js +0 -2
  851. package/dist/cli-bundle/chunks/register-mutation-57AJQWFV.js +0 -21
  852. package/dist/cli-bundle/chunks/register-operations-RKWST7CU.js +0 -2
  853. package/dist/cli-bundle/chunks/register-setup-CMI23PC5.js +0 -2
  854. package/dist/cli-bundle/chunks/settlement-hook-BXN5LEQD.js +0 -7
  855. package/dist/cli-bundle/chunks/stage-4KDVXC5Z.js +0 -2
  856. package/dist/cli-bundle/focused-chunks/chunk-2ZD7275J.js +0 -2
  857. package/dist/cli-bundle/focused-chunks/chunk-324AHXJO.js +0 -2
  858. package/dist/cli-bundle/focused-chunks/chunk-3IRCYJI5.js +0 -3
  859. package/dist/cli-bundle/focused-chunks/chunk-3V53UBHN.js +0 -9
  860. package/dist/cli-bundle/focused-chunks/chunk-3XSWH6QC.js +0 -91
  861. package/dist/cli-bundle/focused-chunks/chunk-4JZITIJB.js +0 -2
  862. package/dist/cli-bundle/focused-chunks/chunk-4KTFKSS3.js +0 -2
  863. package/dist/cli-bundle/focused-chunks/chunk-5C5TK3ET.js +0 -78
  864. package/dist/cli-bundle/focused-chunks/chunk-AKJYOZZP.js +0 -2
  865. package/dist/cli-bundle/focused-chunks/chunk-BRZV7BFV.js +0 -8
  866. package/dist/cli-bundle/focused-chunks/chunk-C3O6JJPO.js +0 -2
  867. package/dist/cli-bundle/focused-chunks/chunk-CR7CGEB2.js +0 -3
  868. package/dist/cli-bundle/focused-chunks/chunk-EGN2HFRU.js +0 -2
  869. package/dist/cli-bundle/focused-chunks/chunk-GHQVM6K6.js +0 -2
  870. package/dist/cli-bundle/focused-chunks/chunk-HDEKFSOK.js +0 -2
  871. package/dist/cli-bundle/focused-chunks/chunk-I5LGPUWH.js +0 -2
  872. package/dist/cli-bundle/focused-chunks/chunk-IWOXAUDU.js +0 -2
  873. package/dist/cli-bundle/focused-chunks/chunk-ML3JHCC6.js +0 -6
  874. package/dist/cli-bundle/focused-chunks/chunk-OPGOOP25.js +0 -2
  875. package/dist/cli-bundle/focused-chunks/chunk-RE7ZWT7D.js +0 -27
  876. package/dist/cli-bundle/focused-chunks/chunk-RKQNVYGF.js +0 -3
  877. package/dist/cli-bundle/focused-chunks/chunk-RQ252B6V.js +0 -8
  878. package/dist/cli-bundle/focused-chunks/chunk-SVOOGGAK.js +0 -2
  879. package/dist/cli-bundle/focused-chunks/chunk-URGHTTT3.js +0 -8
  880. package/dist/cli-bundle/focused-chunks/chunk-USPYKWQG.js +0 -13
  881. package/dist/cli-bundle/focused-chunks/chunk-UWS3FC4D.js +0 -102
  882. package/dist/cli-bundle/focused-chunks/chunk-UXQGFGAT.js +0 -44
  883. package/dist/cli-bundle/focused-chunks/chunk-WZWXGDYY.js +0 -26
  884. package/dist/cli-bundle/focused-chunks/chunk-YKSLZPLT.js +0 -2
  885. package/dist/cli-bundle/focused-chunks/chunk-ZWJTY4ID.js +0 -2
  886. package/dist/cli-bundle/focused-chunks/context-budget-recovery-5MKOCGY5.js +0 -2
  887. package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-AF4U3F3D.js +0 -4
  888. package/dist/cli-bundle/focused-chunks/item-transaction-GLACUTPL.js +0 -2
  889. package/dist/cli-bundle/focused-chunks/mutation-actor-TCYDPUGG.js +0 -2
  890. package/dist/cli-bundle/focused-chunks/mutation-admission-LY73EJWM.js +0 -2
  891. package/dist/cli-bundle/focused-chunks/settlement-hook-ARYCZQY4.js +0 -7
  892. package/dist/cli-bundle/focused-chunks/stage-DQ7RQQ52.js +0 -2
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9e8ad404-2f8d-5d9b-9046-60178a70e5b2")}catch{}})();import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";class ExtensionCommandError extends PmCliError{constructor(message,context,cause){super(message,EXIT_CODE.GENERIC_FAILURE,context),this.name="ExtensionCommandError",Object.defineProperty(this,"cause",{value:cause,configurable:!0,writable:!0})}}function createExtensionCommandError(command,result){const warning=result.warnings[0]??"extension_command_handler_failed",message=result.errorMessage?.trim();return new ExtensionCommandError(`Command "${command}" failed in extension handler (${warning}).${message?` ${message}`:""}`,{code:result.errorCode??"command_failed",nextSteps:result.remediation?[result.remediation]:void 0},result.cause)}function describeUnknownError(error){return error instanceof PmCliError||error instanceof Error?error.message:"Unknown failure"}function readThrownExitCode(error){if(typeof error!="object"||error===null||!("exitCode"in error))return;const exitCode=error.exitCode;return typeof exitCode=="number"&&Number.isFinite(exitCode)?exitCode:void 0}function normalizeThrownExitCode(exitCode){const normalized=Math.trunc(exitCode);return normalized>EXIT_CODE.SUCCESS?normalized:EXIT_CODE.GENERIC_FAILURE}function isCommanderError(error){return typeof error=="object"&&error!==null&&"code"in error&&typeof error.code=="string"&&error.code.startsWith("commander.")}function wrapThrownErrorForSentry(error,message){if(error instanceof Error)return error;const wrapped=new Error(message),exitCode=readThrownExitCode(error);return exitCode!==void 0&&(wrapped.exitCode=normalizeThrownExitCode(exitCode)),wrapped}export{ExtensionCommandError,createExtensionCommandError,describeUnknownError,isCommanderError,normalizeThrownExitCode,readThrownExitCode,wrapThrownErrorForSentry};
1
+ import{EXIT_CODE as r}from"../core/shared/constants.js";import{PmCliError as i}from"../core/shared/errors.js";class d extends i{constructor(e,t,o){super(e,r.GENERIC_FAILURE,t),this.name="ExtensionCommandError",Object.defineProperty(this,"cause",{value:o,configurable:!0,writable:!0})}}function f(n,e){const t=e.warnings[0]??"extension_command_handler_failed",o=e.errorMessage?.trim();return new d(`Command "${n}" failed in extension handler (${t}).${o?` ${o}`:""}`,{code:e.errorCode??"command_failed",nextSteps:e.remediation?[e.remediation]:void 0},e.cause)}function u(n){return n instanceof i||n instanceof Error?n.message:"Unknown failure"}function a(n){if(typeof n!="object"||n===null||!("exitCode"in n))return;const e=n.exitCode;return typeof e=="number"&&Number.isFinite(e)?e:void 0}function c(n){const e=Math.trunc(n);return e>r.SUCCESS?e:r.GENERIC_FAILURE}function E(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="string"&&n.code.startsWith("commander.")}function x(n,e){if(n instanceof Error)return n;const t=new Error(e),o=a(n);return o!==void 0&&(t.exitCode=c(o)),t}export{d as ExtensionCommandError,f as createExtensionCommandError,u as describeUnknownError,E as isCommanderError,c as normalizeThrownExitCode,a as readThrownExitCode,x as wrapThrownErrorForSentry};
2
2
  //# sourceMappingURL=error-runtime.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e82bc812-181f-57ab-a29a-61703e8bec1b")}catch{}})();import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{admitPmCliErrorDetails}from"../core/shared/error-details.js";import{PM_CLI_ERROR_DETAILS_LIMITS,isPmCliErrorDetails,projectPmCliErrorContextDetails,projectPmCliErrorContextDetailsSlot,projectPmCliErrorDetails,snapshotPmCliErrorContext}from"../core/shared/error-details.js";function isPositiveSafeTokenCount(value){return typeof value=="number"&&Number.isSafeInteger(value)&&value>0}function isPmTokenBudgetRecovery(value){if(typeof value!="object"||value===null||Array.isArray(value))return!1;const candidate=value;if(!isPositiveSafeTokenCount(candidate.requested_tokens)||candidate.basis!=="canonical_retry")return!1;switch(candidate.minimum_status){case"exact":return isPositiveSafeTokenCount(candidate.minimum_feasible_tokens)&&candidate.feasible_tokens===candidate.minimum_feasible_tokens&&candidate.reason===void 0;case"feasible_only":return candidate.minimum_feasible_tokens===null&&isPositiveSafeTokenCount(candidate.feasible_tokens)&&candidate.reason===void 0;case"unavailable":return candidate.minimum_feasible_tokens===null&&candidate.feasible_tokens===null&&["query_cost_limit","search_limit","output_constraints"].includes(candidate.reason);default:return!1}}const PM_CLI_EXPECTED_ERROR_NAME="PmCliError";function isItemAlreadyExistsError(error){if(!isPmCliExpectedError(error)||error.code!=="item_already_exists"||error.exitCode!==EXIT_CODE.CONFLICT)return!1;const context=error.context;return typeof context=="object"&&context!==null&&context.code==="item_already_exists"&&typeof context.id=="string"&&context.id.trim().length>0&&typeof context.path=="string"&&context.path.trim().length>0}function normalizeExpectedErrorExitCode(value){if(!Number.isFinite(value))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");const normalized=Math.trunc(value);if(normalized<=EXIT_CODE.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return normalized}function admitExpectedErrorContext(context){if(context==null)return{};if(!Object.hasOwn(context,"details"))return context;const descriptor=Object.getOwnPropertyDescriptor(context,"details");if(!("value"in descriptor))throw detailsShapeTypeError("unsupported_value","details");if(descriptor.value===void 0)return context;const admission=admitPmCliErrorDetails(descriptor.value);if(admission.ok)return{...context,details:admission.details};if(admission.omission.reason==="byte_limit"){const{details:_oversized,...rest}=context;return{...rest,details_omitted:admission.omission}}throw detailsShapeTypeError(admission.omission.reason,admission.omission.path)}function detailsShapeTypeError(reason,path){const error=new TypeError(`createPmCliExpectedError options.context.details must be plain JSON (${reason})`);return Object.defineProperty(error,"path",{value:path,enumerable:!1}),error}function createPmCliExpectedError(message,options={}){if(typeof message!="string"||message.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");const error=new PmCliError(message,normalizeExpectedErrorExitCode(options.exitCode??EXIT_CODE.USAGE),admitExpectedErrorContext(options.context));return"cause"in options&&Object.defineProperty(error,"cause",{value:options.cause,enumerable:!1,configurable:!0,writable:!0}),error}function isPmCliExpectedError(error){try{if(!(error instanceof Error)||error.name!==PM_CLI_EXPECTED_ERROR_NAME)return!1;const candidate=error;return typeof candidate.exitCode=="number"&&Number.isFinite(candidate.exitCode)&&typeof candidate.context=="object"&&candidate.context!==null&&!Array.isArray(candidate.context)}catch{return!1}}export{PM_CLI_ERROR_DETAILS_LIMITS,PM_CLI_EXPECTED_ERROR_NAME,createPmCliExpectedError,isItemAlreadyExistsError,isPmCliErrorDetails,isPmCliExpectedError,isPmTokenBudgetRecovery,projectPmCliErrorContextDetails,projectPmCliErrorContextDetailsSlot,projectPmCliErrorDetails,snapshotPmCliErrorContext};
1
+ import{EXIT_CODE as i}from"../core/shared/constants.js";import{PmCliError as a}from"../core/shared/errors.js";import{admitPmCliErrorDetails as l}from"../core/shared/error-details.js";import{PM_CLI_ERROR_DETAILS_LIMITS as h,isPmCliErrorDetails as w,projectPmCliErrorContextDetails as T,projectPmCliErrorContextDetailsSlot as k,projectPmCliErrorDetails as O,snapshotPmCliErrorContext as S}from"../core/shared/error-details.js";function n(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>0}function C(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;const e=t;if(!n(e.requested_tokens)||e.basis!=="canonical_retry")return!1;switch(e.minimum_status){case"exact":return n(e.minimum_feasible_tokens)&&e.feasible_tokens===e.minimum_feasible_tokens&&e.reason===void 0;case"feasible_only":return e.minimum_feasible_tokens===null&&n(e.feasible_tokens)&&e.reason===void 0;case"unavailable":return e.minimum_feasible_tokens===null&&e.feasible_tokens===null&&["query_cost_limit","search_limit","output_constraints"].includes(e.reason);default:return!1}}const u="PmCliError";function b(t){if(!f(t)||t.code!=="item_already_exists"||t.exitCode!==i.CONFLICT)return!1;const e=t.context;return typeof e=="object"&&e!==null&&e.code==="item_already_exists"&&typeof e.id=="string"&&e.id.trim().length>0&&typeof e.path=="string"&&e.path.trim().length>0}function m(t){if(!Number.isFinite(t))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");const e=Math.trunc(t);if(e<=i.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return e}function c(t){if(t==null)return{};if(!Object.hasOwn(t,"details"))return t;const e=Object.getOwnPropertyDescriptor(t,"details");if(!("value"in e))throw o("unsupported_value","details");if(e.value===void 0)return t;const r=l(e.value);if(r.ok)return{...t,details:r.details};if(r.omission.reason==="byte_limit"){const{details:d,...s}=t;return{...s,details_omitted:r.omission}}throw o(r.omission.reason,r.omission.path)}function o(t,e){const r=new TypeError(`createPmCliExpectedError options.context.details must be plain JSON (${t})`);return Object.defineProperty(r,"path",{value:e,enumerable:!1}),r}function x(t,e={}){if(typeof t!="string"||t.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");const r=new a(t,m(e.exitCode??i.USAGE),c(e.context));return"cause"in e&&Object.defineProperty(r,"cause",{value:e.cause,enumerable:!1,configurable:!0,writable:!0}),r}function f(t){try{if(!(t instanceof Error)||t.name!==u)return!1;const e=t;return typeof e.exitCode=="number"&&Number.isFinite(e.exitCode)&&typeof e.context=="object"&&e.context!==null&&!Array.isArray(e.context)}catch{return!1}}export{h as PM_CLI_ERROR_DETAILS_LIMITS,u as PM_CLI_EXPECTED_ERROR_NAME,x as createPmCliExpectedError,b as isItemAlreadyExistsError,w as isPmCliErrorDetails,f as isPmCliExpectedError,C as isPmTokenBudgetRecovery,T as projectPmCliErrorContextDetails,k as projectPmCliErrorContextDetailsSlot,O as projectPmCliErrorDetails,S as snapshotPmCliErrorContext};
2
2
  //# sourceMappingURL=errors.js.map
package/dist/sdk/eval.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5d26721c-719a-5c7e-8baf-72cbf1088988")}catch{}})();import{evaluateMetricFloors}from"../core/search/eval-thresholds.js";import{assertInitializedTracker}from"./environment/tracker-preflight.js";import fs from"node:fs/promises";import path from"node:path";import{aggregateEvalMetrics,DEFAULT_EVAL_K,EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID,evaluateRanking,parseEvalQuerySet}from"../core/search/eval.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{coercePositiveInteger}from"../core/shared/primitives.js";import{resolvePmRoot}from"../core/store/paths.js";import{runSearch}from"./query/search.js";import{EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE as EVAL_QUERY_SET_EXAMPLE2,EVAL_QUERY_SET_SCHEMA_ID as EVAL_QUERY_SET_SCHEMA_ID2,parseEvalQuerySet as parseEvalQuerySet2}from"../core/search/eval.js";const DEFAULT_EVAL_QUERIES_RELATIVE_PATH=path.join("search","eval-queries.json"),EVAL_QUERY_SET_ERROR_CONTEXT={schema:EVAL_QUERY_SET_SCHEMA_ID,examples:[JSON.stringify(EVAL_QUERY_SET_EXAMPLE)],nextSteps:["Create a git-tracked golden-query JSON file that follows the schema, then re-run pm eval."]},VALID_EVAL_MODES=new Set(["keyword","semantic","hybrid"]),parseEvalMode=raw=>{if(raw===void 0)return"keyword";const normalized=raw.trim().toLowerCase();if(!VALID_EVAL_MODES.has(normalized))throw new PmCliError("Eval --mode must be one of keyword|semantic|hybrid",EXIT_CODE.USAGE);return normalized},parseEvalK=raw=>{if(raw===void 0||raw==="")return DEFAULT_EVAL_K;const parsed=coercePositiveInteger(raw);if(parsed===null)throw new PmCliError("Eval --k must be a positive integer",EXIT_CODE.USAGE);return parsed},parseFailUnder=raw=>{if(raw===void 0||raw==="")return;const normalized=String(raw).trim(),parsed=Number(normalized);if([normalized.length===0,!Number.isFinite(parsed),parsed<0,parsed>1].includes(!0))throw new PmCliError("Eval --fail-under must be a number in the range [0, 1]",EXIT_CODE.USAGE);return parsed},roundMetric=value=>Math.round(value*1e4)/1e4,readEvalQuerySetFile=async queriesPath=>{try{return await fs.readFile(queriesPath,"utf8")}catch{throw new PmCliError(`Eval query set not found at ${queriesPath}`,EXIT_CODE.NOT_FOUND,{...EVAL_QUERY_SET_ERROR_CONTEXT,examples:[`echo '${JSON.stringify(EVAL_QUERY_SET_EXAMPLE)}' > ${queriesPath}`,"pm eval --queries ./my-eval.json"]})}},parseEvalQuerySetJson=(raw,queriesPath)=>{try{return JSON.parse(raw)}catch(error){throw new PmCliError(`Eval query set at ${queriesPath} is not valid JSON: ${error instanceof Error?error.message:String(error)}`,EXIT_CODE.USAGE,EVAL_QUERY_SET_ERROR_CONTEXT)}},validateEvalQuerySet=parsed=>{try{return parseEvalQuerySet(parsed)}catch(error){throw new PmCliError(error instanceof Error?error.message:String(error),EXIT_CODE.USAGE,EVAL_QUERY_SET_ERROR_CONTEXT)}},loadEvalQuerySet=async queriesPath=>validateEvalQuerySet(parseEvalQuerySetJson(await readEvalQuerySetFile(queriesPath),queriesPath)),evaluateEvalQuery=async(evalQuery,defaultMode,k,global2)=>{const mode=evalQuery.mode??defaultMode,rankedIds=(await runSearch(evalQuery.query,{mode,limit:String(k),fields:"id"},global2)).items.map(item=>item.id).filter(id=>typeof id=="string"),metrics=evaluateRanking(rankedIds,new Set(evalQuery.relevant_ids),k);return{metrics,report:{query:evalQuery.query,...evalQuery.minimum===void 0?{}:{violations:evaluateMetricFloors(metrics,evalQuery.minimum)},mode,relevant_total:metrics.relevant_total,retrieved_relevant:metrics.retrieved_relevant,ndcg:roundMetric(metrics.ndcg),mrr:roundMetric(metrics.mrr),precision:roundMetric(metrics.precision),recall:roundMetric(metrics.recall)}}},buildEvalResult=(k,reports,rawMetrics,failUnder)=>{const aggregate=aggregateEvalMetrics(rawMetrics);return{k,query_count:reports.length,aggregate:{ndcg:roundMetric(aggregate.ndcg),mrr:roundMetric(aggregate.mrr),precision:roundMetric(aggregate.precision),recall:roundMetric(aggregate.recall)},queries:reports,...failUnder!==void 0?{fail_under:failUnder}:{},passed:(failUnder===void 0||aggregate.ndcg>=failUnder)&&reports.every(report=>(report.violations?.length??0)===0)}},runEval=async(options,global2)=>{const pmRoot=resolvePmRoot(process.cwd(),global2.path);await assertInitializedTracker(pmRoot);const k=parseEvalK(options.k),defaultMode=parseEvalMode(options.mode),failUnder=parseFailUnder(options.failUnder),queriesPath=options.queries?path.resolve(process.cwd(),options.queries):path.join(pmRoot,DEFAULT_EVAL_QUERIES_RELATIVE_PATH),querySet=await loadEvalQuerySet(queriesPath),reports=[],rawMetrics=[];for(const evalQuery of querySet.queries){const{report,metrics}=await evaluateEvalQuery(evalQuery,defaultMode,k,global2);rawMetrics.push(metrics),reports.push(report)}return buildEvalResult(k,reports,rawMetrics,failUnder)};export{DEFAULT_EVAL_QUERIES_RELATIVE_PATH,EVAL_QUERY_SET_CONTRACT,EVAL_QUERY_SET_EXAMPLE2 as EVAL_QUERY_SET_EXAMPLE,EVAL_QUERY_SET_SCHEMA_ID2 as EVAL_QUERY_SET_SCHEMA_ID,parseEvalQuerySet2 as parseEvalQuerySet,runEval};
1
+ import{evaluateMetricFloors as g}from"../core/search/eval-thresholds.js";import{assertInitializedTracker as h}from"./environment/tracker-preflight.js";import y from"node:fs/promises";import E from"node:path";import{aggregateEvalMetrics as A,DEFAULT_EVAL_K as w,EVAL_QUERY_SET_EXAMPLE as _,EVAL_QUERY_SET_SCHEMA_ID as R,evaluateRanking as T,parseEvalQuerySet as L}from"../core/search/eval.js";import{EXIT_CODE as c}from"../core/shared/constants.js";import{PmCliError as l}from"../core/shared/errors.js";import{coercePositiveInteger as U}from"../core/shared/primitives.js";import{resolvePmRoot as q}from"../core/store/paths.js";import{runSearch as M}from"./query/search.js";import{EVAL_QUERY_SET_CONTRACT as ee,EVAL_QUERY_SET_EXAMPLE as re,EVAL_QUERY_SET_SCHEMA_ID as te,parseEvalQuerySet as ne}from"../core/search/eval.js";const O=E.join("search","eval-queries.json"),d={schema:R,examples:[JSON.stringify(_)],nextSteps:["Create a git-tracked golden-query JSON file that follows the schema, then re-run pm eval."]},N=new Set(["keyword","semantic","hybrid"]),V=e=>{if(e===void 0)return"keyword";const r=e.trim().toLowerCase();if(!N.has(r))throw new l("Eval --mode must be one of keyword|semantic|hybrid",c.USAGE);return r},Q=e=>{if(e===void 0||e==="")return w;const r=U(e);if(r===null)throw new l("Eval --k must be a positive integer",c.USAGE);return r},k=e=>{if(e===void 0||e==="")return;const r=String(e).trim(),t=Number(r);if([r.length===0,!Number.isFinite(t),t<0,t>1].includes(!0))throw new l("Eval --fail-under must be a number in the range [0, 1]",c.USAGE);return t},a=e=>Math.round(e*1e4)/1e4,C=async e=>{try{return await y.readFile(e,"utf8")}catch{throw new l(`Eval query set not found at ${e}`,c.NOT_FOUND,{...d,examples:[`echo '${JSON.stringify(_)}' > ${e}`,"pm eval --queries ./my-eval.json"]})}},I=(e,r)=>{try{return JSON.parse(e)}catch(t){throw new l(`Eval query set at ${r} is not valid JSON: ${t instanceof Error?t.message:String(t)}`,c.USAGE,d)}},b=e=>{try{return L(e)}catch(r){throw new l(r instanceof Error?r.message:String(r),c.USAGE,d)}},D=async e=>b(I(await C(e),e)),F=async(e,r,t,s)=>{const n=e.mode??r,m=(await M(e.query,{mode:n,limit:String(t),fields:"id"},s)).items.map(i=>i.id).filter(i=>typeof i=="string"),o=T(m,new Set(e.relevant_ids),t);return{metrics:o,report:{query:e.query,...e.minimum===void 0?{}:{violations:g(o,e.minimum)},mode:n,relevant_total:o.relevant_total,retrieved_relevant:o.retrieved_relevant,ndcg:a(o.ndcg),mrr:a(o.mrr),precision:a(o.precision),recall:a(o.recall)}}},x=(e,r,t,s)=>{const n=A(t);return{k:e,query_count:r.length,aggregate:{ndcg:a(n.ndcg),mrr:a(n.mrr),precision:a(n.precision),recall:a(n.recall)},queries:r,...s!==void 0?{fail_under:s}:{},passed:(s===void 0||n.ndcg>=s)&&r.every(u=>(u.violations?.length??0)===0)}},B=async(e,r)=>{const t=q(process.cwd(),r.path);await h(t);const s=Q(e.k),n=V(e.mode),u=k(e.failUnder),m=e.queries?E.resolve(process.cwd(),e.queries):E.join(t,O),o=await D(m),i=[],f=[];for(const p of o.queries){const{report:v,metrics:S}=await F(p,n,s,r);f.push(S),i.push(v)}return x(s,i,f,u)};export{O as DEFAULT_EVAL_QUERIES_RELATIVE_PATH,ee as EVAL_QUERY_SET_CONTRACT,re as EVAL_QUERY_SET_EXAMPLE,te as EVAL_QUERY_SET_SCHEMA_ID,ne as parseEvalQuerySet,B as runEval};
2
2
  //# sourceMappingURL=eval.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="955d33c5-8c96-5ed6-bbd1-fc8a26801df4")}catch{}})();import fs from"node:fs/promises";import path from"node:path";import{isFileAbsentError}from"../../core/fs/fs-utils.js";import{lintExtensionManifestSchema}from"../../core/extensions/manifest-schema.js";import{resolveWorkspaceRoot}from"../../core/store/paths.js";function manifestName(raw){return typeof raw.name=="string"&&raw.name.trim().length>0?raw.name.trim():"workspace-manifest"}function authorManifestWarning(name,finding){return finding.code==="manifest_unknown_key"?`extension_manifest_unknown_key:author:${name}:key=${finding.path}${finding.suggested_key?`:suggested=${finding.suggested_key}`:""}`:`extension_manifest_no_version_bounds:author:${name}:suggested=pm_min_version`}async function inspectExtensionAuthorManifest(workspaceRoot){const manifestPath=path.join(workspaceRoot,"manifest.json");let content;try{content=await fs.readFile(manifestPath,"utf8")}catch(error){if(isFileAbsentError(error))return{path:manifestPath,present:!1,parse_status:"absent",package_metadata_location:"package.json#pm",schema_findings:[],warnings:[],remediation:[]};throw error}let parsed;try{parsed=JSON.parse(content)}catch{return{path:manifestPath,present:!0,parse_status:"invalid_json",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_json:manifest.json"],remediation:["Repair manifest.json so it contains one valid JSON object, then rerun pm package doctor --project."]}}if(typeof parsed!="object"||parsed===null||Array.isArray(parsed))return{path:manifestPath,present:!0,parse_status:"invalid_shape",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_shape:manifest.json"],remediation:["Replace manifest.json with one JSON object, then rerun pm package doctor --project."]};const raw=parsed,lint=lintExtensionManifestSchema(raw),name=manifestName(raw);return{path:manifestPath,present:!0,parse_status:"valid",package_metadata_location:"package.json#pm",schema_findings:lint.findings,warnings:lint.findings.map(finding=>authorManifestWarning(name,finding)),remediation:lint.findings.map(finding=>finding.message)}}function inspectExtensionAuthorManifestAtPmRoot(pmRoot){return inspectExtensionAuthorManifest(resolveWorkspaceRoot(pmRoot))}export{inspectExtensionAuthorManifest,inspectExtensionAuthorManifestAtPmRoot};
1
+ import m from"node:fs/promises";import p from"node:path";import{isFileAbsentError as c}from"../../core/fs/fs-utils.js";import{lintExtensionManifestSchema as _}from"../../core/extensions/manifest-schema.js";import{resolveWorkspaceRoot as f}from"../../core/store/paths.js";function u(e){return typeof e.name=="string"&&e.name.trim().length>0?e.name.trim():"workspace-manifest"}function g(e,t){return t.code==="manifest_unknown_key"?`extension_manifest_unknown_key:author:${e}:key=${t.path}${t.suggested_key?`:suggested=${t.suggested_key}`:""}`:`extension_manifest_no_version_bounds:author:${e}:suggested=pm_min_version`}async function d(e){const t=p.join(e,"manifest.json");let o;try{o=await m.readFile(t,"utf8")}catch(n){if(c(n))return{path:t,present:!1,parse_status:"absent",package_metadata_location:"package.json#pm",schema_findings:[],warnings:[],remediation:[]};throw n}let a;try{a=JSON.parse(o)}catch{return{path:t,present:!0,parse_status:"invalid_json",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_json:manifest.json"],remediation:["Repair manifest.json so it contains one valid JSON object, then rerun pm package doctor --project."]}}if(typeof a!="object"||a===null||Array.isArray(a))return{path:t,present:!0,parse_status:"invalid_shape",package_metadata_location:"package.json#pm",schema_findings:[],warnings:["extension_author_manifest_invalid_shape:manifest.json"],remediation:["Replace manifest.json with one JSON object, then rerun pm package doctor --project."]};const i=a,s=_(i),r=u(i);return{path:t,present:!0,parse_status:"valid",package_metadata_location:"package.json#pm",schema_findings:s.findings,warnings:s.findings.map(n=>g(r,n)),remediation:s.findings.map(n=>n.message)}}function v(e){return d(f(e))}export{d as inspectExtensionAuthorManifest,v as inspectExtensionAuthorManifestAtPmRoot};
2
2
  //# sourceMappingURL=author-manifest.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c9a362e5-6eb5-52dc-aa74-6c6c0df2c291")}catch{}})();import fs from"node:fs/promises";import path from"node:path";import{collectPackageExtensionDirectories,PM_PACKAGE_RESOURCE_KINDS,readPmPackageManifest}from"../../core/packages/manifest.js";import{resolvePmPackageRootFromModule}from"../../core/packages/root.js";import{pathExists}from"../../core/fs/fs-utils.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{splitCommaList}from"../../core/shared/split-comma-list.js";import{resolveExtensionRoots}from"../../core/extensions/loader.js";import{resolvePmRoot}from"../../core/store/paths.js";import{validateExtensionDirectory}from"./shared.js";import{readManagedExtensionState}from"./managed-state.js";const PM_PACKAGE_ROOT_ENV="PM_CLI_PACKAGE_ROOT",LEGACY_BUNDLED_PACKAGE_ALIASES={beads:{package_directory:"pm-beads",legacy_extension_directory:"beads"},todos:{package_directory:"pm-todos",legacy_extension_directory:"todos"}},BUNDLED_PACKAGE_INSTALL_ALL_TARGETS=new Set(["*","all"]);function resolvePackageRootCandidates(){const candidates=[],envRoot=process.env[PM_PACKAGE_ROOT_ENV];return typeof envRoot=="string"&&envRoot.trim().length>0&&candidates.push(path.resolve(envRoot.trim())),candidates.push(resolvePmPackageRootFromModule(import.meta.url,["../../.."])),[...new Set(candidates)]}async function resolveBundledExtensionAliasSource(input){const normalized=input.trim().toLowerCase(),packageRoot=await resolveBundledPackageRoot(normalized);if(packageRoot)return packageRoot;const alias=LEGACY_BUNDLED_PACKAGE_ALIASES[normalized];if(!alias)return null;for(const packageRoot2 of resolvePackageRootCandidates()){const legacyExtensionPath=path.join(packageRoot2,".agents","pm","extensions",alias.legacy_extension_directory);if(await pathExists(path.join(legacyExtensionPath,"manifest.json")))return legacyExtensionPath}return null}function isBundledPackageInstallAllTarget(input){return BUNDLED_PACKAGE_INSTALL_ALL_TARGETS.has(input.trim().toLowerCase())}function derivePackageAlias(packageDirectory){return packageDirectory.replace(/^pm-/i,"").trim().toLowerCase()}async function collectManifestPackageEntries(packagesRoot,entriesByAlias){const entries=await fs.readdir(packagesRoot,{withFileTypes:!0});for(const entry of entries){if(!entry.isDirectory()||!entry.name.startsWith("pm-"))continue;const candidateRoot=path.join(packagesRoot,entry.name);if(!await pathExists(path.join(candidateRoot,"package.json")))continue;const manifest=await readPmPackageManifest(candidateRoot),aliases=manifest.aliases&&manifest.aliases.length>0?manifest.aliases:[derivePackageAlias(entry.name)];for(const alias of aliases){const normalizedAlias=alias.trim().toLowerCase();normalizedAlias.length===0||entriesByAlias.has(normalizedAlias)||entriesByAlias.set(normalizedAlias,{alias:normalizedAlias,package_directory:entry.name,package_root:candidateRoot,package_name:manifest.package_name??null})}}}async function collectBundledPackageEntries(){const entriesByAlias=new Map;for(const packageRoot of resolvePackageRootCandidates()){const packagesRoot=path.join(packageRoot,"packages");await pathExists(packagesRoot)&&await collectManifestPackageEntries(packagesRoot,entriesByAlias)}for(const[alias,legacy]of Object.entries(LEGACY_BUNDLED_PACKAGE_ALIASES))if(!entriesByAlias.has(alias))for(const packageRoot of resolvePackageRootCandidates()){const packagePath=path.join(packageRoot,"packages",legacy.package_directory);if(await pathExists(path.join(packagePath,"package.json"))){entriesByAlias.set(alias,{alias,package_directory:legacy.package_directory,package_root:packagePath,package_name:null});break}}return[...entriesByAlias.values()].sort((left,right)=>left.alias.localeCompare(right.alias))}async function listBundledPackageAliases(){return(await collectBundledPackageEntries()).map(entry=>entry.alias)}async function resolveBundledPackageRoot(alias){const normalized=alias.trim().toLowerCase();return(await collectBundledPackageEntries()).find(candidate=>candidate.alias===normalized||candidate.package_directory.toLowerCase()===normalized||candidate.package_name?.toLowerCase()===normalized)?.package_root??null}async function resolveBundledPackageNpmName(alias){const packageRoot=await resolveBundledPackageRoot(alias);return packageRoot?(await readPmPackageManifest(packageRoot)).package_name??null:null}async function resolveBundledAliasManifestName(input){const bundledAliasSource=await resolveBundledExtensionAliasSource(input);if(!bundledAliasSource)return null;try{const extensionDirectories=await collectPackageExtensionDirectories(bundledAliasSource);return extensionDirectories.length!==1?null:(await validateExtensionDirectory(extensionDirectories[0])).manifest.name}catch{return null}}function buildBundledCatalogLinks(manifest){return{docs:manifest.catalog?.links?.docs??manifest.package_homepage,npm:manifest.catalog?.links?.npm??(manifest.package_name&&manifest.package_private!==!0?`https://www.npmjs.com/package/${encodeURIComponent(manifest.package_name)}`:void 0),repository:manifest.catalog?.links?.repository??manifest.package_repository_url,report:manifest.catalog?.links?.report??manifest.package_bugs_url}}function buildBundledCatalogPackageEntry(manifest,bundledEntry,aliases,scope,installedBuiltinAliases,installedLocations){const installScopeFlag=scope==="global"?"--global":"--project",metadataOnlyResources=Object.fromEntries(PM_PACKAGE_RESOURCE_KINDS.filter(resourceKind=>resourceKind!=="extensions").map(resourceKind=>[resourceKind,manifest.resources[resourceKind]??[]]).filter(([,entries])=>Array.isArray(entries)&&entries.length>0));return{alias:bundledEntry.alias,aliases,bundled:!0,available:!0,installed:aliases.some(alias=>installedBuiltinAliases.has(alias))||installedLocations.has(path.resolve(bundledEntry.package_root)),install_target:bundledEntry.alias,install_command:`pm install ${bundledEntry.alias} ${installScopeFlag}`,package_name:manifest.package_name,package_version:manifest.package_version,description:manifest.catalog?.summary??manifest.package_description,keywords:manifest.package_keywords??[],resources:manifest.resources,installable_resources:{extensions:manifest.resources.extensions??[]},metadata_only_resources:metadataOnlyResources,catalog:{display_name:manifest.catalog?.display_name,category:manifest.catalog?.category,tags:manifest.catalog?.tags??manifest.package_keywords??[],links:buildBundledCatalogLinks(manifest),media:manifest.catalog?.media}}}async function buildBundledPackageCatalog(scope,global2,options={}){const roots=resolveExtensionRoots(resolvePmRoot(process.cwd(),global2.path),process.cwd()),selectedRoot=scope==="global"?roots.global:roots.project,managedStateRead=await readManagedExtensionState(selectedRoot),installedLocations=new Set(managedStateRead.state.entries.filter(entry=>entry.scope===scope).filter(entry=>entry.source.kind!=="builtin").map(entry=>path.resolve(entry.source.location))),installedBuiltinAliases=new Set(managedStateRead.state.entries.filter(entry=>entry.scope===scope&&entry.source.kind==="builtin").flatMap(entry=>[entry.source.name,entry.source.input,entry.source.location]).filter(value=>typeof value=="string"&&value.trim().length>0).map(value=>value.trim().toLowerCase())),packages=[],bundledEntriesByRoot=new Map;for(const entry of await collectBundledPackageEntries()){const packageRoot=path.resolve(entry.package_root),groupedEntries=bundledEntriesByRoot.get(packageRoot)??[];groupedEntries.push(entry),bundledEntriesByRoot.set(packageRoot,groupedEntries)}for(const bundledEntries of bundledEntriesByRoot.values()){const bundledEntry=bundledEntries[0],aliases=bundledEntries.map(entry=>entry.alias).sort((left,right)=>left.localeCompare(right)),manifest=await readPmPackageManifest(bundledEntry.package_root);packages.push(buildBundledCatalogPackageEntry(manifest,bundledEntry,aliases,scope,installedBuiltinAliases,installedLocations))}const fields=parsePackageCatalogFields(options.fields),outputPackages=fields?packages.map(entry=>projectPackageCatalogEntry(entry,fields)):packages;return{total:outputPackages.length,scope,installable_resource_kinds:["extensions"],metadata_only_resource_kinds:PM_PACKAGE_RESOURCE_KINDS.filter(resourceKind=>resourceKind!=="extensions"),packages:outputPackages}}const PACKAGE_CATALOG_FIELD_KEYS=new Set(["alias","aliases","bundled","available","installed","install_target","install_command","package_name","package_version","description","keywords","resources","installable_resources","metadata_only_resources","catalog","category","display_name"]);function parsePackageCatalogFields(raw){if(raw===void 0)return;const fields=splitCommaList(raw);if(fields.length===0)throw new PmCliError("Package catalog --fields requires a comma-separated list of field names",EXIT_CODE.USAGE);const unknown=fields.filter(field=>!PACKAGE_CATALOG_FIELD_KEYS.has(field));if(unknown.length>0)throw new PmCliError(`Unknown package catalog --fields value(s): ${unknown.join(", ")}`,EXIT_CODE.USAGE,{examples:["pm package list --project --fields alias,installed,install_command","pm package catalog --project --fields alias,package_name,category"]});return fields}function projectPackageCatalogEntry(entry,fields){const projected={};for(const field of fields)field==="category"?projected[field]=entry.catalog?.category??null:field==="display_name"?projected[field]=entry.catalog?.display_name??null:projected[field]=entry[field]??null;return projected}const _testOnlyBundledCatalog={parsePackageCatalogFields,projectPackageCatalogEntry};export{_testOnlyBundledCatalog,buildBundledPackageCatalog,isBundledPackageInstallAllTarget,listBundledPackageAliases,resolveBundledAliasManifestName,resolveBundledExtensionAliasSource,resolveBundledPackageNpmName,resolveBundledPackageRoot};
1
+ import j from"node:fs/promises";import c from"node:path";import{collectPackageExtensionDirectories as S,PM_PACKAGE_RESOURCE_KINDS as A,readPmPackageManifest as _}from"../../core/packages/manifest.js";import{resolvePmPackageRootFromModule as B}from"../../core/packages/root.js";import{pathExists as u}from"../../core/fs/fs-utils.js";import{EXIT_CODE as P}from"../../core/shared/constants.js";import{PmCliError as h}from"../../core/shared/errors.js";import{splitCommaList as D}from"../../core/shared/split-comma-list.js";import{resolveExtensionRoots as G}from"../../core/extensions/loader.js";import{resolvePmRoot as M}from"../../core/store/paths.js";import{validateExtensionDirectory as O}from"./shared.js";import{readManagedExtensionState as T}from"./managed-state.js";const I="PM_CLI_PACKAGE_ROOT",C={beads:{package_directory:"pm-beads",legacy_extension_directory:"beads"},todos:{package_directory:"pm-todos",legacy_extension_directory:"todos"}},N=new Set(["*","all"]);function f(){const a=[],e=process.env[I];return typeof e=="string"&&e.trim().length>0&&a.push(c.resolve(e.trim())),a.push(B(import.meta.url,["../../.."])),[...new Set(a)]}async function K(a){const e=a.trim().toLowerCase(),o=await v(e);if(o)return o;const t=C[e];if(!t)return null;for(const r of f()){const i=c.join(r,".agents","pm","extensions",t.legacy_extension_directory);if(await u(c.join(i,"manifest.json")))return i}return null}function na(a){return N.has(a.trim().toLowerCase())}function U(a){return a.replace(/^pm-/i,"").trim().toLowerCase()}async function F(a,e){const o=await j.readdir(a,{withFileTypes:!0});for(const t of o){if(!t.isDirectory()||!t.name.startsWith("pm-"))continue;const r=c.join(a,t.name);if(!await u(c.join(r,"package.json")))continue;const i=await _(r),l=i.aliases&&i.aliases.length>0?i.aliases:[U(t.name)];for(const p of l){const s=p.trim().toLowerCase();s.length===0||e.has(s)||e.set(s,{alias:s,package_directory:t.name,package_root:r,package_name:i.package_name??null})}}}async function y(){const a=new Map;for(const e of f()){const o=c.join(e,"packages");await u(o)&&await F(o,a)}for(const[e,o]of Object.entries(C))if(!a.has(e))for(const t of f()){const r=c.join(t,"packages",o.package_directory);if(await u(c.join(r,"package.json"))){a.set(e,{alias:e,package_directory:o.package_directory,package_root:r,package_name:null});break}}return[...a.values()].sort((e,o)=>e.alias.localeCompare(o.alias))}async function sa(){return(await y()).map(a=>a.alias)}async function v(a){const e=a.trim().toLowerCase();return(await y()).find(t=>t.alias===e||t.package_directory.toLowerCase()===e||t.package_name?.toLowerCase()===e)?.package_root??null}async function ra(a){const e=await v(a);return e?(await _(e)).package_name??null:null}async function ia(a){const e=await K(a);if(!e)return null;try{const o=await S(e);return o.length!==1?null:(await O(o[0])).manifest.name}catch{return null}}function $(a){return{docs:a.catalog?.links?.docs??a.package_homepage,npm:a.catalog?.links?.npm??(a.package_name&&a.package_private!==!0?`https://www.npmjs.com/package/${encodeURIComponent(a.package_name)}`:void 0),repository:a.catalog?.links?.repository??a.package_repository_url,report:a.catalog?.links?.report??a.package_bugs_url}}function z(a,e,o,t,r,i){const l=t==="global"?"--global":"--project",p=Object.fromEntries(A.filter(s=>s!=="extensions").map(s=>[s,a.resources[s]??[]]).filter(([,s])=>Array.isArray(s)&&s.length>0));return{alias:e.alias,aliases:o,bundled:!0,available:!0,installed:o.some(s=>r.has(s))||i.has(c.resolve(e.package_root)),install_target:e.alias,install_command:`pm install ${e.alias} ${l}`,package_name:a.package_name,package_version:a.package_version,description:a.catalog?.summary??a.package_description,keywords:a.package_keywords??[],resources:a.resources,installable_resources:{extensions:a.resources.extensions??[]},metadata_only_resources:p,catalog:{display_name:a.catalog?.display_name,category:a.catalog?.category,tags:a.catalog?.tags??a.package_keywords??[],links:$(a),media:a.catalog?.media}}}async function ca(a,e,o={}){const t=G(M(process.cwd(),e.path),process.cwd()),r=a==="global"?t.global:t.project,i=await T(r),l=new Set(i.state.entries.filter(n=>n.scope===a).filter(n=>n.source.kind!=="builtin").map(n=>c.resolve(n.source.location))),p=new Set(i.state.entries.filter(n=>n.scope===a&&n.source.kind==="builtin").flatMap(n=>[n.source.name,n.source.input,n.source.location]).filter(n=>typeof n=="string"&&n.trim().length>0).map(n=>n.trim().toLowerCase())),s=[],m=new Map;for(const n of await y()){const g=c.resolve(n.package_root),d=m.get(g)??[];d.push(n),m.set(g,d)}for(const n of m.values()){const g=n[0],d=n.map(k=>k.alias).sort((k,L)=>k.localeCompare(L)),R=await _(g.package_root);s.push(z(R,g,d,a,p,l))}const w=x(o.fields),E=w?s.map(n=>b(n,w)):s;return{total:E.length,scope:a,installable_resource_kinds:["extensions"],metadata_only_resource_kinds:A.filter(n=>n!=="extensions"),packages:E}}const Y=new Set(["alias","aliases","bundled","available","installed","install_target","install_command","package_name","package_version","description","keywords","resources","installable_resources","metadata_only_resources","catalog","category","display_name"]);function x(a){if(a===void 0)return;const e=D(a);if(e.length===0)throw new h("Package catalog --fields requires a comma-separated list of field names",P.USAGE);const o=e.filter(t=>!Y.has(t));if(o.length>0)throw new h(`Unknown package catalog --fields value(s): ${o.join(", ")}`,P.USAGE,{examples:["pm package list --project --fields alias,installed,install_command","pm package catalog --project --fields alias,package_name,category"]});return e}function b(a,e){const o={};for(const t of e)t==="category"?o[t]=a.catalog?.category??null:t==="display_name"?o[t]=a.catalog?.display_name??null:o[t]=a[t]??null;return o}const la={parsePackageCatalogFields:x,projectPackageCatalogEntry:b};export{la as _testOnlyBundledCatalog,ca as buildBundledPackageCatalog,na as isBundledPackageInstallAllTarget,sa as listBundledPackageAliases,ia as resolveBundledAliasManifestName,K as resolveBundledExtensionAliasSource,ra as resolveBundledPackageNpmName,v as resolveBundledPackageRoot};
2
2
  //# sourceMappingURL=bundled-catalog.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ab4e2ed3-e7e8-5a7a-a13e-7b8dce750dc4")}catch{}})();import{isDeepStrictEqual}from"node:util";import{resolvePmCommandOperation}from"../cli-contracts/command-aliases.js";import{describeFlagScalarValueFailure,resolveExtensionFlagValueContract,resolveExtensionLongFlagName,EXIT_CODE,PmCliError,flattenFlagListValue,resolveFlagValueKind}from"../runtime-primitives.js";import{RESERVED_EXTENSION_HOST_FLAG_NAMES}from"../../core/extensions/reserved-host-flags.js";const UNSAFE_LOOSE_OPTION_KEYS=new Set(["__proto__","prototype","constructor"]),LOOSE_OPTION_OCCURRENCES=Symbol("looseOptionOccurrences");function toLooseOptionKey(rawKey){return rawKey.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(_match,group)=>group.toUpperCase())}function setLooseOptionValue(options,key,value){const existing=options[key];if(existing===void 0){options[key]=value;return}if(Array.isArray(existing)){existing.push(value),options[key]=existing;return}options[key]=[existing,value]}function parseLooseOptionToken(args,index){const token=args[index];if(!token.startsWith("-")||token==="-"||token==="--")return null;if(!token.startsWith("--")){const equalsIndex2=token.indexOf("=");if(equalsIndex2>=0)return{consumed:1,key:token.slice(1,equalsIndex2).trim(),value:token.slice(equalsIndex2+1),attached:!0};const key2=token.slice(1).trim(),next2=args[index+1];return typeof next2=="string"&&!next2.startsWith("-")?{consumed:2,key:key2,value:next2}:{consumed:1,key:key2,value:!0}}const equalsIndex=token.indexOf("=");if(equalsIndex>=0)return{consumed:1,key:token.slice(2,equalsIndex).trim(),value:token.slice(equalsIndex+1),attached:!0};if(token.startsWith("--no-"))return{consumed:1,key:token.slice(5).trim(),value:!1};const key=token.slice(2).trim(),next=args[index+1];return typeof next=="string"&&!next.startsWith("-")?{consumed:2,key,value:next}:{consumed:1,key,value:!0}}function isUnsafeLooseOptionKey(key){return UNSAFE_LOOSE_OPTION_KEYS.has(key)}function resolveLooseOptionCoercionKind(definition){const raw=(typeof definition.value_type=="string"?definition.value_type:void 0)??(typeof definition.type=="string"?definition.type:void 0);return resolveFlagValueKind(raw)}function collectLooseOptionKeys(definition){const keys=[],long=resolveExtensionLongFlagName(definition.long)??"",short=typeof definition.short=="string"?definition.short.trim():"";if(long.startsWith("--")){const normalized=toLooseOptionKey(long.slice(2));normalized.length>0&&!isUnsafeLooseOptionKey(normalized)&&keys.push(normalized)}if(short.startsWith("-")&&!short.startsWith("--")){const normalized=toLooseOptionKey(short.slice(1));normalized.length>0&&!isUnsafeLooseOptionKey(normalized)&&keys.push(normalized)}return[...new Set(keys)]}function collectLooseCommandOptionKeysForDefinitions(definitions){const keys=new Set;for(const definition of definitions)for(const key of collectLooseOptionKeys(definition))keys.add(key);return keys}function resolveCanonicalLooseOptionKey(definition){const long=resolveExtensionLongFlagName(definition.long)??"";if(long.startsWith("--")){const normalized=toLooseOptionKey(long.slice(2));if(normalized.length>0&&!isUnsafeLooseOptionKey(normalized))return normalized}return collectLooseOptionKeys(definition)[0]??null}function formatLooseOptionLabel(definition){const long=resolveExtensionLongFlagName(definition.long)??"";if(long.startsWith("--")&&long.length>2)return long;const short=typeof definition.short=="string"?definition.short.trim():"";return short.startsWith("-")&&!short.startsWith("--")&&short.length>1?short:null}function collectRefusalListingLabels(definitions,listing){return[...(listing.definitions??definitions).map(definition=>formatLooseOptionLabel(definition)).filter(label=>label!==null),...listing.inheritedFlags??[]]}function validateLooseCommandOptionsWithFlagDefinitions(options,definitions,commandPath,listing={}){if(definitions.length===0)return;const allowed=new Set,disabled=new Map,required=[],labels=collectRefusalListingLabels(definitions,listing);for(const definition of definitions){const keys=collectLooseOptionKeys(definition),normalizedLabel=formatLooseOptionLabel(definition);for(const key of keys)allowed.add(key),definition.enabled===!1&&disabled.set(key,normalizedLabel);definition.required===!0&&definition.enabled!==!1&&keys.length>0&&required.push({keys,label:normalizedLabel,definition})}for(const key of Object.keys(options)){allowed.has(key)||refuseUnknownExtensionOption(`--${key}`,`--${key}`,commandPath,labels);const disabledLabel=disabled.get(key);disabledLabel&&refuseDisabledExtensionOption(disabledLabel,commandPath)}for(const entry of required){const present=key=>Object.hasOwn(options,key)&&(entry.definition.list!==!0||hasLooseListEntries(entry.definition,options[key]));entry.keys.some(present)||refuseMissingRequiredExtensionOption(entry.definition,entry.keys[0],entry.label,commandPath)}}function refuseUnknownExtensionOption(supplied,flag,commandPath,labels){const expected=labels.length>0?` Expected one of: ${[...new Set(labels)].join(", ")}.`:"";throw new PmCliError(`Unknown option '${supplied}' for extension command '${commandPath}'.${expected}`,EXIT_CODE.USAGE,{code:"unknown_option",flag,required:`Use a flag the command accepts; run pm contracts --command ${commandPath} --flags-only --json to list them.`})}function refuseDisabledExtensionOption(label,commandPath){throw new PmCliError(`Option '${label}' is disabled for extension command '${commandPath}'.`,EXIT_CODE.USAGE,{code:"extension_option_disabled",flag:label,required:`Remove ${label}; the command declares it with enabled: false.`,why:"A disabled declaration keeps the flag in the contract while refusing every value for it.",examples:[`pm ${commandPath} --help`],nextSteps:[`Run pm contracts --command ${commandPath} --flags-only --json to list the flags this command accepts.`]})}function refuseMissingRequiredExtensionOption(definition,handlerKey,label,commandPath){const value=resolveExtensionFlagValueContract(definition),usage=value.value_arity==="none"?label:value.value_arity==="optional"?`${label} [${value.value_name}]`:`${label} <${value.value_name}>`;throw new PmCliError(`Missing required option '${label}' for extension command '${commandPath}'.`,EXIT_CODE.USAGE,{code:"missing_required_option",flag:label,field:handlerKey,required:`Pass ${usage}.`,why:"The command declares this flag as required, so pm refuses the invocation before the extension handler runs.",examples:[`pm ${commandPath} ${usage}`],nextSteps:[`Run pm contracts --command ${commandPath} --flags-only --json to read each flag's sdk_option key.`],recovery:{missing:[label]}})}function coerceLooseStringOptionValue(value){return typeof value=="string"||value==null?value:String(value)}function coerceLooseNumberOptionValue(value){if(typeof value=="number")return value;if(typeof value=="string"&&value.trim().length>0){const parsed=Number(value);return Number.isFinite(parsed)?parsed:value}return value}function coerceLooseBooleanOptionValue(value){if(typeof value=="boolean")return value;if(typeof value=="string"){const normalized=value.trim().toLowerCase();if(normalized==="true"||normalized==="1")return!0;if(normalized==="false"||normalized==="0")return!1}return value}const LOOSE_OPTION_VALUE_COERCERS={string:coerceLooseStringOptionValue,number:coerceLooseNumberOptionValue,boolean:coerceLooseBooleanOptionValue};function coerceLooseOptionValue(value,kind){return Array.isArray(value)?value.map(entry=>coerceLooseOptionValue(entry,kind)):LOOSE_OPTION_VALUE_COERCERS[kind](value)}function normalizeAccumulatedFlagValue(value,kind,preserveOccurrenceCommas){const entries=preserveOccurrenceCommas?(Array.isArray(value)?value.flat(1/0):[value]).filter(entry=>entry!=null&&entry!==""):flattenFlagListValue(value);return kind?entries.map(entry=>coerceLooseOptionValue(entry,kind)):entries}function hasLooseListEntries(definition,value){return normalizeAccumulatedFlagValue(value,null,definition.repeatable===!0).length>0}function applyFlagDefault(defaultValue,kind,isListFlag,preserveOccurrenceCommas){return isListFlag?normalizeAccumulatedFlagValue(defaultValue,kind,preserveOccurrenceCommas):kind?coerceLooseOptionValue(defaultValue,kind):defaultValue}function readOrderedLooseListValues(occurrenceSource,optionKeys,fallback){const matching=readLooseOccurrences(occurrenceSource,optionKeys);return matching.length===0?fallback:matching.map(occurrence=>occurrence.value)}function isBooleanSwitchDefinition(definition){return resolveExtensionFlagValueContract(definition).value_arity==="none"}function refuseStrictScalarValue(definition,kind,entry,expected,commandPath){const label=formatLooseOptionLabel(definition),scope=commandPath?` for extension command '${commandPath}'`:"",received=entry===!0?"no value":JSON.stringify(entry);throw new PmCliError(`Option '${label}'${scope} expects ${expected}; received ${received}.`,EXIT_CODE.USAGE,{code:"extension_flag_value_invalid",flag:label,required:`Pass ${label} ${kind==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${kind} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${kind} value for ${label}.`,`Run pm ${commandPath??"<command>"} --help to review the declared flag contract.`]})}function isStrictTypedDefinition(definition,kind){return definition.value_validation==="strict"&&kind!=="string"}function readLooseOccurrences(occurrenceSource,optionKeys){const occurrences=occurrenceSource[LOOSE_OPTION_OCCURRENCES];if(!occurrences)return[];const acceptedKeys=new Set(optionKeys);return occurrences.filter(occurrence=>acceptedKeys.has(occurrence.key))}function refuseMalformedAttachedSwitchValues(definition,optionKeys,occurrenceSource,commandPath){if(isBooleanSwitchDefinition(definition))for(const occurrence of readLooseOccurrences(occurrenceSource,optionKeys)){if(occurrence.attached!==!0)continue;const values=definition.list===!0&&definition.repeatable!==!0?flattenFlagListValue(occurrence.value):[occurrence.value];for(const value of values){const failure=describeFlagScalarValueFailure(coerceLooseOptionValue(value,"boolean"),"boolean");failure!==null&&refuseStrictScalarValue(definition,"boolean",value,failure.expected,commandPath)}}}function refuseEmptyStrictListEntries(definition,kind,rawValue,preserveOccurrenceCommas,commandPath){const occurrences=Array.isArray(rawValue)?rawValue.flat(1/0):[rawValue],entries=preserveOccurrenceCommas?occurrences:occurrences.flatMap(entry=>typeof entry=="string"?entry.split(","):[entry]);for(const entry of entries)if(typeof entry=="string"&&entry.trim().length===0){const failure=describeFlagScalarValueFailure(entry,kind);refuseStrictScalarValue(definition,kind,entry,failure.expected,commandPath)}}function validateStrictScalarOptionValue(definition,value,kind,commandPath){if(!isStrictTypedDefinition(definition,kind))return value;const isSwitch=kind==="boolean"&&isBooleanSwitchDefinition(definition),normalizeEntry=entry=>{const failure=describeFlagScalarValueFailure(entry,kind);return failure===null?entry:isSwitch&&typeof entry=="string"?!0:refuseStrictScalarValue(definition,kind,entry,failure.expected,commandPath)};return Array.isArray(value)?value.map(normalizeEntry):normalizeEntry(value)}function mergeAliasOptionKeys(coerced,canonical,optionKeys,isListFlag){for(const key of optionKeys)if(!(key===canonical||!Object.hasOwn(coerced,key))){if(Object.hasOwn(coerced,canonical)){if(isListFlag){const canonicalValue=coerced[canonical],aliasValue=coerced[key];coerced[canonical]=[...Array.isArray(canonicalValue)?canonicalValue:[canonicalValue],...Array.isArray(aliasValue)?aliasValue:[aliasValue]].filter(value=>value!=null)}delete coerced[key];continue}coerced[canonical]=coerced[key],delete coerced[key]}}function coerceLooseCommandOptionsWithFlagDefinitions(options,definitions,occurrenceSource=options,commandPath){if(definitions.length===0)return options;const coerced=Object.create(null);for(const[key,value]of Object.entries(options))coerced[key]=value;const canonicalKeys=new Set(definitions.map(definition=>resolveCanonicalLooseOptionKey(definition)).filter(key=>key!==null));for(const definition of definitions){const canonical=resolveCanonicalLooseOptionKey(definition);if(canonical){const optionKeys=collectLooseOptionKeys(definition).filter(key=>key===canonical||!canonicalKeys.has(key));coerceDefinedLooseOption(coerced,definition,canonical,optionKeys,occurrenceSource,commandPath)}}return coerced}function coerceDefinedLooseOption(coerced,definition,canonical,optionKeys,occurrenceSource,commandPath){const isListFlag=definition.list===!0,kind=resolveLooseOptionCoercionKind(definition);kind&&!isListFlag&&refuseMalformedScalarAliasValues(coerced,definition,canonical,optionKeys,kind,commandPath),mergeAliasOptionKeys(coerced,canonical,optionKeys,isListFlag);const preserveOccurrenceCommas=definition.repeatable===!0;if(!Object.hasOwn(coerced,canonical)){definition.default!==void 0&&(coerced[canonical]=applyFlagDefault(definition.default,kind,isListFlag,preserveOccurrenceCommas));return}if(kind==="boolean"&&isStrictTypedDefinition(definition,kind)&&refuseMalformedAttachedSwitchValues(definition,optionKeys,occurrenceSource,commandPath),isListFlag){coerced[canonical]=coerceAccumulatedLooseOption(definition,optionKeys,occurrenceSource,coerced[canonical],kind,preserveOccurrenceCommas,commandPath);return}kind&&(coerced[canonical]=validateStrictScalarOptionValue(definition,coerceLooseOptionValue(coerced[canonical],kind),kind,commandPath))}function refuseMalformedScalarAliasValues(coerced,definition,canonical,optionKeys,kind,commandPath){for(const key of optionKeys)key!==canonical&&Object.hasOwn(coerced,key)&&validateStrictScalarOptionValue(definition,coerceLooseOptionValue(coerced[key],kind),kind,commandPath)}function coerceAccumulatedLooseOption(definition,optionKeys,occurrenceSource,current,kind,preserveOccurrenceCommas,commandPath){const ordered=readOrderedLooseListValues(occurrenceSource,optionKeys,current);kind&&isStrictTypedDefinition(definition,kind)&&refuseEmptyStrictListEntries(definition,kind,ordered,preserveOccurrenceCommas,commandPath);const normalized=normalizeAccumulatedFlagValue(ordered,kind,preserveOccurrenceCommas);return kind?validateStrictScalarOptionValue(definition,normalized,kind,commandPath):normalized}function parseLooseCommandOptions(args){const options=Object.create(null),occurrences=[];Object.defineProperty(options,LOOSE_OPTION_OCCURRENCES,{value:occurrences});let index=0;for(;index<args.length;){const parsed=parseLooseOptionToken(args,index);if(!parsed){index+=1;continue}const normalizedKey=toLooseOptionKey(parsed.key);if(normalizedKey.length===0||isUnsafeLooseOptionKey(normalizedKey)){index+=parsed.consumed;continue}setLooseOptionValue(options,normalizedKey,parsed.value),occurrences.push({...parsed,key:normalizedKey}),index+=parsed.consumed}return options}function collectLoosePositionalArgs(args){const positionals=[];let index=0;for(;index<args.length;){if(args[index]==="--"){positionals.push(...args.slice(index+1));break}const parsed=parseLooseOptionToken(args,index);if(parsed){index+=Math.max(1,parsed.consumed);continue}positionals.push(args[index]),index+=1}return positionals}function stripLooseCommandOptionTokens(args,definitions){if(definitions.length===0)return[...args];const knownKeys=new Set,booleanKeys=new Set;for(const definition of definitions){const valueKind=resolveLooseOptionCoercionKind(definition);for(const key of collectLooseOptionKeys(definition))knownKeys.add(key),valueKind==="boolean"&&booleanKeys.add(key)}if(knownKeys.size===0)return[...args];const stripped=[];let index=0;for(;index<args.length;){if(args[index]==="--"){stripped.push(...args.slice(index+1));break}const parsed=parseLooseOptionToken(args,index);if(parsed){const normalizedKey=toLooseOptionKey(parsed.key);if(knownKeys.has(normalizedKey)){const token=args[index],consumed=booleanKeys.has(normalizedKey)&&!token.includes("=")?1:parsed.consumed;index+=consumed;continue}}stripped.push(args[index]),index+=1}return stripped}function resolveExtensionFlagOptionKey(definition){return resolveCanonicalLooseOptionKey(definition)}function normalizeFlagTargetCommandPath(commandPath){return commandPath.trim().toLowerCase().split(/\s+/u).filter(part=>part.length>0).join(" ")}function collectExtensionFlagDefinitionsForCommand(registrations,commandPath){const normalizedCommandPath=normalizeFlagTargetCommandPath(commandPath);if(normalizedCommandPath.length===0)return[];const operation=resolvePmCommandOperation(normalizedCommandPath);return registrations.flags.filter(entry=>resolvePmCommandOperation(normalizeFlagTargetCommandPath(entry.target_command))===operation).flatMap(entry=>[...entry.flags])}function refuseConflictingOptionSpellings(definition,handlerKey,spellings,commandPath){const label=formatLooseOptionLabel(definition),[first,second]=spellings;throw new PmCliError(`Options '${first}' and '${second}' both set ${label} for extension command '${commandPath}' with different values.`,EXIT_CODE.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${label} once, under the handler key '${handlerKey}'.`,why:`'${first}' and '${second}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${first}' or '${second}' and pass one value as '${handlerKey}'.`,`Run pm contracts --command ${commandPath} --flags-only --json to read each flag's sdk_option key.`]})}function normalizeDirectExtensionCommandOptions(options,declaredDefinitions,commandPath,policy={}){if(declaredDefinitions.length===0)return options;const definitions=declaredDefinitions.map(definition=>definition.repeatable===!0&&definition.list!==!0?{...definition,list:!0}:definition),index=indexDeclaredOptionSpellings(definitions),folded=foldDirectOptionSpellings(options,index,commandPath),handlerKeys=new Set([...index.long.values()].map(({handlerKey})=>handlerKey)),declared=Object.create(null),passthrough=Object.create(null);for(const[key,value]of Object.entries(folded))handlerKeys.has(key)?declared[key]=value:value===void 0||policy.undeclaredKeys==="pass"||isDirectHostOptionKey(key)?passthrough[key]=value:refuseUnknownExtensionOption(key,toDashedOptionFlag(key),commandPath,collectRefusalListingLabels(definitions,{}));return refuseDirectDeclarationViolations(declared,definitions,commandPath),Object.assign(passthrough,coerceLooseCommandOptionsWithFlagDefinitions(declared,definitions,recordDirectOptionOccurrences(declared,index),commandPath))}function recordDirectOptionOccurrences(folded,index){const handlerKeys=new Set([...index.long.values()].map(({handlerKey})=>handlerKey)),occurrences=Object.entries(folded).filter(([key])=>handlerKeys.has(key)).flatMap(([key,value])=>(Array.isArray(value)?value.flat(1/0):[value]).map(entry=>({consumed:1,key,value:entry,attached:!0}))),occurrenceSource=Object.create(null);return Object.defineProperty(occurrenceSource,LOOSE_OPTION_OCCURRENCES,{value:occurrences}),occurrenceSource}function refuseDirectDeclarationViolations(declared,definitions,commandPath){for(const definition of definitions){const handlerKey=resolveCanonicalLooseOptionKey(definition);if(handlerKey===null)continue;const label=formatLooseOptionLabel(definition),value=declared[handlerKey],supplied=Object.hasOwn(declared,handlerKey);definition.enabled===!1&&supplied&&refuseDisabledExtensionOption(label,commandPath);const present=supplied&&(definition.list!==!0||hasLooseListEntries(definition,value));definition.required===!0&&definition.enabled!==!1&&!present&&refuseMissingRequiredExtensionOption(definition,handlerKey,label,commandPath),definition.list!==!0&&Array.isArray(value)&&refuseDirectArrayForSingleValueFlag(label,commandPath)}}function refuseDirectArrayForSingleValueFlag(label,commandPath){throw new PmCliError(`Option '${label}' for extension command '${commandPath}' takes one value; received an array.`,EXIT_CODE.USAGE,{code:"extension_flag_value_invalid",flag:label,required:`Pass one value for ${label}, or ask the package to declare it with list: true or repeatable: true.`,why:"The flag is not declared list or repeatable, so pm refuses an array before the extension handler runs instead of handing it a value of the wrong shape.",nextSteps:[`Run pm contracts --command ${commandPath} --flags-only --json to read each flag's value contract.`]})}const DIRECT_HOST_OPTION_KEYS=new Set([...[...RESERVED_EXTENSION_HOST_FLAG_NAMES].flatMap(flag=>{const body=flag.replace(/^--/u,"");return[body,...body.startsWith("no-")?[body.slice(3)]:[]].flatMap(spelling=>[toLooseOptionKey(spelling),spelling.replaceAll("-","_")])}),"force","subcommand","inputResponses","requestState"]);function isDirectHostOptionKey(key){return DIRECT_HOST_OPTION_KEYS.has(key)||DIRECT_HOST_OPTION_KEYS.has(toLooseOptionKey(key.replace(/^-{1,2}/u,"")))}function toDashedOptionFlag(key){return`--${key.replace(/^-+/u,"").replace(/([a-z0-9])([A-Z])/gu,"$1-$2").replaceAll("_","-").toLowerCase()}`}function indexDeclaredOptionSpellings(definitions){const index={long:new Map,short:new Map},claim=(map,spelling,entry)=>{spelling.length>0&&!map.has(spelling)&&map.set(spelling,entry)};for(const definition of definitions){const handlerKey=resolveCanonicalLooseOptionKey(definition);if(handlerKey===null)continue;const entry={handlerKey,definition};claim(index.long,handlerKey,entry);const short=typeof definition.short=="string"?definition.short.trim():"";short.startsWith("-")&&!short.startsWith("--")&&claim(index.short,short.slice(1),entry)}return index}function resolveDeclaredOptionSpelling(index,spelling){return index.long.get(spelling)??index.short.get(spelling.replace(/^-(?!-)/u,""))??index.long.get(toLooseOptionKey(spelling.replace(/^-{1,2}/u,"")))}function resolveNegatedBooleanSpelling(index,spelling,value,commandPath){const negated=/^(?:--)?no-(.+)$/u.exec(spelling)?.[1];if(negated===void 0||resolveDeclaredOptionSpelling(index,spelling)!==void 0)return{spelling,value};const declared=resolveDeclaredOptionSpelling(index,negated);return declared===void 0||resolveLooseOptionCoercionKind(declared.definition)!=="boolean"?{spelling,value}:(declared.definition.list===!0||declared.definition.repeatable===!0)&&Array.isArray(value)?{spelling:negated,value:value.flat(1/0).map(entry=>invertNegatedListEntry(spelling,declared.definition,entry,commandPath))}:declared.definition.list===!0&&value!==void 0?{spelling:negated,value:invertNegatedListEntry(spelling,declared.definition,value,commandPath)}:{spelling:negated,value:value===void 0?value:invertNegatedBooleanEntry(spelling,declared.definition,value,commandPath)}}function invertNegatedListEntry(spelling,definition,entry,commandPath){const invertToken=token=>token.trim().length===0?token:String(invertNegatedBooleanEntry(spelling,definition,token.trim(),commandPath));return entry==null?entry:typeof entry!="string"?invertNegatedBooleanEntry(spelling,definition,entry,commandPath):entry.trim().length===0?entry:definition.repeatable===!0||!entry.includes(",")?invertNegatedBooleanEntry(spelling,definition,entry,commandPath):entry.split(",").map(invertToken).join(",")}function invertNegatedBooleanEntry(spelling,definition,value,commandPath){const flag=coerceLooseBooleanOptionValue(value);return typeof flag=="boolean"?!flag:refuseNegatedBooleanValue(spelling,definition,value,commandPath)}function refuseNegatedBooleanValue(spelling,definition,value,commandPath){const label=formatLooseOptionLabel(definition);throw new PmCliError(`Option '${spelling}' for extension command '${commandPath}' negates ${label} and expects true, false, 1, or 0; received ${JSON.stringify(value)}.`,EXIT_CODE.USAGE,{code:"extension_flag_value_invalid",flag:label,required:`Pass ${label} as true or false, or '${spelling}' as true.`,why:`'${spelling}' is the negated spelling of the boolean ${label}, so only a boolean value can be inverted before the extension handler runs.`,nextSteps:[`Run pm contracts --command ${commandPath} --flags-only --json to read each flag's value contract.`]})}function foldDirectOptionSpellings(options,index,commandPath){const folded=Object.create(null),suppliedBy=new Map;for(const[rawSpelling,rawValue]of Object.entries(options)){const{spelling,value}=resolveNegatedBooleanSpelling(index,rawSpelling,rawValue,commandPath),declared=resolveDeclaredOptionSpelling(index,spelling);if(declared===void 0)folded[spelling]=value;else if(value!==void 0){const prior=suppliedBy.get(declared.handlerKey);prior===void 0?(suppliedBy.set(declared.handlerKey,spelling),folded[declared.handlerKey]=value):isDeepStrictEqual(deliverDirectOptionValue(declared.definition,declared.handlerKey,folded[declared.handlerKey],index,commandPath),deliverDirectOptionValue(declared.definition,declared.handlerKey,value,index,commandPath))||refuseConflictingOptionSpellings(declared.definition,declared.handlerKey,[prior,spelling],commandPath)}}return folded}function deliverDirectOptionValue(definition,handlerKey,value,index,commandPath){const single={[handlerKey]:value};return refuseDirectDeclarationViolations(single,[definition],commandPath),coerceLooseCommandOptionsWithFlagDefinitions(single,[definition],recordDirectOptionOccurrences(single,index),commandPath)[handlerKey]}function indexDeclaredArgvSpellings(definitions){const index=new Map;for(const definition of definitions){const handlerKey=resolveCanonicalLooseOptionKey(definition);if(handlerKey===null)continue;const entry={definition,handlerKey,kind:resolveLooseOptionCoercionKind(definition),arity:resolveExtensionFlagValueContract(definition).value_arity,scalar:definition.list!==!0},spellings=[resolveExtensionLongFlagName(definition.long),typeof definition.short=="string"?definition.short.trim():""];for(const spelling of spellings.filter(candidate=>candidate?.startsWith("-")===!0))index.has(spelling)||index.set(spelling,entry)}return index}function resolveArgvSpelling(scope,index,spelling){const registered=scope.optionOf(spelling),declared=index.get(spelling),settable=declared?.scalar===!0?declared:void 0;if(registered!==void 0){const base={arity:registered.arity,...registered.variadic===!0?{variadic:!0}:{}};if(settable?.handlerKey===registered.key)return{...base,declared:settable};const positive=declared===void 0&&spelling.startsWith("--no-")?index.get(`--${spelling.slice(5)}`):void 0;return positive?.scalar===!0&&positive.kind==="boolean"&&positive.handlerKey===registered.key?{...base,declared:positive,negates:!0}:base}if(!(!scope.includesLooseFlags||declared===void 0))return settable===void 0?{arity:declared.arity,loose:!0}:{arity:declared.arity,declared:settable,loose:!0}}function isArgvOptionToken(token){return token.length>1&&token.startsWith("-")}const NEGATIVE_NUMBER_ARGV_TOKEN=/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/u;function scanArgvScope(scope,resolve,record){const{tokens}=scope;let position=0,group,unrecognizedSeen=!1,variadic=!1;for(;position<tokens.length||group!==void 0;){const token=group??tokens[position++];if(token==="--")return;if(variadic&&group===void 0&&isArgvVariadicValue(scope,token))continue;const step=isArgvOptionToken(token)?scanArgvOptionToken(scope,token,tokens[position],resolve,record):{consumedByCommander:!1,consumed:0};if(position+=step.consumed,group=step.group,variadic=step.variadic===!0,!step.consumedByCommander){if(stopsArgvScope(scope.stop,token,unrecognizedSeen))return;unrecognizedSeen=!0}}}function isArgvVariadicValue(scope,token){return!isArgvOptionToken(token)||scope.negativeNumbersAreValues&&NEGATIVE_NUMBER_ARGV_TOKEN.test(token)}function stopsArgvScope(stop,token,unrecognizedSeen){return stop!==void 0&&(stop.atFirstUnrecognized||!unrecognizedSeen&&stop.atSubcommand(token))}function scanArgvOptionToken(scope,token,next,resolve,record){const loose=readLooseArgvOccurrence(token,next,resolve);if(loose!==void 0)return record(loose.spelling,loose.entry,loose.value),{consumedByCommander:!1,consumed:loose.consumed};const exact=resolve(token);if(exact!==void 0){const takesNext=exact.arity==="required"||exact.arity==="optional"&&next!==void 0&&(!isArgvOptionToken(next)||scope.negativeNumbersAreValues&&NEGATIVE_NUMBER_ARGV_TOKEN.test(next));return record(token,exact,exact.negates===!0?!1:takesNext?next:!0),{consumedByCommander:!0,consumed:takesNext?1:0,variadic:exact.variadic===!0}}return token[1]!=="-"?{consumed:0,...scanShortGroup(token,resolve,record)}:{consumedByCommander:scanLongToken(token,resolve,record,scope.includesLooseFlags?record:()=>{}),consumed:0}}function readLooseArgvOccurrence(token,next,resolve){const equals=token.indexOf("="),spelling=equals>1?token.slice(0,equals):token,entry=resolve(spelling);if(entry?.loose===!0)return equals>1?{spelling,entry,value:token.slice(equals+1),consumed:0}:next!==void 0&&!next.startsWith("-")?{spelling,entry,value:next,consumed:1}:{spelling,entry,value:!0,consumed:0};const negated=equals<0&&token.startsWith("--no-")?resolve(`--${token.slice(5)}`):void 0;return negated?.loose===!0&&negated.declared?.kind==="boolean"?{spelling:token,entry:negated,value:!1,consumed:0}:void 0}function scanShortGroup(token,resolve,record){const spelling=token.slice(0,2),entry=token.length>2?resolve(spelling):void 0;return entry===void 0||entry.loose===!0?{consumedByCommander:!1}:entry.arity!=="none"?(record(spelling,entry,token.slice(2)),{consumedByCommander:!0}):(record(spelling,entry,!0),{consumedByCommander:!0,group:`-${token.slice(2)}`})}function scanLongToken(token,resolve,record,recordUnparsed){const equals=token.indexOf("=");if(equals>2){const spelling=token.slice(0,equals),entry=resolve(spelling);return entry!==void 0&&entry.arity!=="none"?(record(spelling,entry,token.slice(equals+1)),!0):(entry?.declared?.kind==="boolean"&&recordUnparsed(spelling,entry,token.slice(equals+1)),!1)}const negated=token.startsWith("--no-")?resolve(`--${token.slice(5)}`):void 0;return negated?.declared?.kind==="boolean"&&recordUnparsed(token,negated,!1),!1}function refuseConflictingArgvOptionSpellings(scopes,definitions,commandPath){const index=indexDeclaredArgvSpellings(definitions),latest=new Map;for(const scope of scopes)scanArgvScope(scope,spelling=>resolveArgvSpelling(scope,index,spelling),(spelling,entry,value)=>{entry.declared!==void 0&&recordArgvSpellingValue(latest,entry.declared,spelling,value,commandPath)})}function recordArgvSpellingValue(latest,declared,spelling,value,commandPath){const{definition,handlerKey,kind}=declared,coerced=kind?coerceLooseOptionValue(value,kind):value,spellings=latest.get(handlerKey)??new Map,conflicting=[...spellings].find(([other,otherValue])=>other!==spelling&&!isDeepStrictEqual(otherValue,coerced));conflicting!==void 0&&refuseConflictingOptionSpellings(definition,handlerKey,[conflicting[0],spelling],commandPath),spellings.set(spelling,coerced),latest.set(handlerKey,spellings)}export{coerceLooseCommandOptionsWithFlagDefinitions,collectExtensionFlagDefinitionsForCommand,collectLooseCommandOptionKeysForDefinitions,collectLoosePositionalArgs,normalizeDirectExtensionCommandOptions,parseLooseCommandOptions,refuseConflictingArgvOptionSpellings,resolveExtensionFlagOptionKey,stripLooseCommandOptionTokens,validateLooseCommandOptionsWithFlagDefinitions};
1
+ import{isDeepStrictEqual as V}from"node:util";import{resolvePmCommandOperation as F}from"../cli-contracts/command-aliases.js";import{describeFlagScalarValueFailure as $,resolveExtensionFlagValueContract as x,resolveExtensionLongFlagName as b,EXIT_CODE as p,PmCliError as g,flattenFlagListValue as D,resolveFlagValueKind as ee}from"../runtime-primitives.js";import{RESERVED_EXTENSION_HOST_FLAG_NAMES as ne}from"../../core/extensions/reserved-host-flags.js";const te=new Set(["__proto__","prototype","constructor"]),A=Symbol("looseOptionOccurrences");function d(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(t,o)=>o.toUpperCase())}function re(e,n,t){const o=e[n];if(o===void 0){e[n]=t;return}if(Array.isArray(o)){o.push(t),e[n]=o;return}e[n]=[o,t]}function _(e,n){const t=e[n];if(!t.startsWith("-")||t==="-"||t==="--")return null;if(!t.startsWith("--")){const i=t.indexOf("=");if(i>=0)return{consumed:1,key:t.slice(1,i).trim(),value:t.slice(i+1),attached:!0};const a=t.slice(1).trim(),u=e[n+1];return typeof u=="string"&&!u.startsWith("-")?{consumed:2,key:a,value:u}:{consumed:1,key:a,value:!0}}const o=t.indexOf("=");if(o>=0)return{consumed:1,key:t.slice(2,o).trim(),value:t.slice(o+1),attached:!0};if(t.startsWith("--no-"))return{consumed:1,key:t.slice(5).trim(),value:!1};const r=t.slice(2).trim(),s=e[n+1];return typeof s=="string"&&!s.startsWith("-")?{consumed:2,key:r,value:s}:{consumed:1,key:r,value:!0}}function S(e){return te.has(e)}function w(e){const n=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return ee(n)}function O(e){const n=[],t=b(e.long)??"",o=typeof e.short=="string"?e.short.trim():"";if(t.startsWith("--")){const r=d(t.slice(2));r.length>0&&!S(r)&&n.push(r)}if(o.startsWith("-")&&!o.startsWith("--")){const r=d(o.slice(1));r.length>0&&!S(r)&&n.push(r)}return[...new Set(n)]}function We(e){const n=new Set;for(const t of e)for(const o of O(t))n.add(o);return n}function m(e){const n=b(e.long)??"";if(n.startsWith("--")){const t=d(n.slice(2));if(t.length>0&&!S(t))return t}return O(e)[0]??null}function y(e){const n=b(e.long)??"";if(n.startsWith("--")&&n.length>2)return n;const t=typeof e.short=="string"?e.short.trim():"";return t.startsWith("-")&&!t.startsWith("--")&&t.length>1?t:null}function W(e,n){return[...(n.definitions??e).map(o=>y(o)).filter(o=>o!==null),...n.inheritedFlags??[]]}function Te(e,n,t,o={}){if(n.length===0)return;const r=new Set,s=new Map,i=[],a=W(n,o);for(const u of n){const l=O(u),c=y(u);for(const f of l)r.add(f),u.enabled===!1&&s.set(f,c);u.required===!0&&u.enabled!==!1&&l.length>0&&i.push({keys:l,label:c,definition:u})}for(const u of Object.keys(e)){r.has(u)||T(`--${u}`,`--${u}`,t,a);const l=s.get(u);l&&q(l,t)}for(const u of i){const l=c=>Object.hasOwn(e,c)&&(u.definition.list!==!0||z(u.definition,e[c]));u.keys.some(l)||R(u.definition,u.keys[0],u.label,t)}}function T(e,n,t,o){const r=o.length>0?` Expected one of: ${[...new Set(o)].join(", ")}.`:"";throw new g(`Unknown option '${e}' for extension command '${t}'.${r}`,p.USAGE,{code:"unknown_option",flag:n,required:`Use a flag the command accepts; run pm contracts --command ${t} --flags-only --json to list them.`})}function q(e,n){throw new g(`Option '${e}' is disabled for extension command '${n}'.`,p.USAGE,{code:"extension_option_disabled",flag:e,required:`Remove ${e}; the command declares it with enabled: false.`,why:"A disabled declaration keeps the flag in the contract while refusing every value for it.",examples:[`pm ${n} --help`],nextSteps:[`Run pm contracts --command ${n} --flags-only --json to list the flags this command accepts.`]})}function R(e,n,t,o){const r=x(e),s=r.value_arity==="none"?t:r.value_arity==="optional"?`${t} [${r.value_name}]`:`${t} <${r.value_name}>`;throw new g(`Missing required option '${t}' for extension command '${o}'.`,p.USAGE,{code:"missing_required_option",flag:t,field:n,required:`Pass ${s}.`,why:"The command declares this flag as required, so pm refuses the invocation before the extension handler runs.",examples:[`pm ${o} ${s}`],nextSteps:[`Run pm contracts --command ${o} --flags-only --json to read each flag's sdk_option key.`],recovery:{missing:[t]}})}function oe(e){return typeof e=="string"||e==null?e:String(e)}function se(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){const n=Number(e);return Number.isFinite(n)?n:e}return e}function M(e){if(typeof e=="boolean")return e;if(typeof e=="string"){const n=e.trim().toLowerCase();if(n==="true"||n==="1")return!0;if(n==="false"||n==="0")return!1}return e}const ie={string:oe,number:se,boolean:M};function h(e,n){return Array.isArray(e)?e.map(t=>h(t,n)):ie[n](e)}function E(e,n,t){const o=t?(Array.isArray(e)?e.flat(1/0):[e]).filter(r=>r!=null&&r!==""):D(e);return n?o.map(r=>h(r,n)):o}function z(e,n){return E(n,null,e.repeatable===!0).length>0}function ae(e,n,t,o){return t?E(e,n,o):n?h(e,n):e}function ue(e,n,t){const o=U(e,n);return o.length===0?t:o.map(r=>r.value)}function k(e){return x(e).value_arity==="none"}function L(e,n,t,o,r){const s=y(e),i=r?` for extension command '${r}'`:"",a=t===!0?"no value":JSON.stringify(t);throw new g(`Option '${s}'${i} expects ${o}; received ${a}.`,p.USAGE,{code:"extension_flag_value_invalid",flag:s,required:`Pass ${s} ${n==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${n} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${n} value for ${s}.`,`Run pm ${r??"<command>"} --help to review the declared flag contract.`]})}function C(e,n){return e.value_validation==="strict"&&n!=="string"}function U(e,n){const t=e[A];if(!t)return[];const o=new Set(n);return t.filter(r=>o.has(r.key))}function le(e,n,t,o){if(k(e))for(const r of U(t,n)){if(r.attached!==!0)continue;const s=e.list===!0&&e.repeatable!==!0?D(r.value):[r.value];for(const i of s){const a=$(h(i,"boolean"),"boolean");a!==null&&L(e,"boolean",i,a.expected,o)}}}function ce(e,n,t,o,r){const s=Array.isArray(t)?t.flat(1/0):[t],i=o?s:s.flatMap(a=>typeof a=="string"?a.split(","):[a]);for(const a of i)if(typeof a=="string"&&a.trim().length===0){const u=$(a,n);L(e,n,a,u.expected,r)}}function K(e,n,t,o){if(!C(e,t))return n;const r=t==="boolean"&&k(e),s=i=>{const a=$(i,t);return a===null?i:r&&typeof i=="string"?!0:L(e,t,i,a.expected,o)};return Array.isArray(n)?n.map(s):s(n)}function fe(e,n,t,o){for(const r of t)if(!(r===n||!Object.hasOwn(e,r))){if(Object.hasOwn(e,n)){if(o){const s=e[n],i=e[r];e[n]=[...Array.isArray(s)?s:[s],...Array.isArray(i)?i:[i]].filter(a=>a!=null)}delete e[r];continue}e[n]=e[r],delete e[r]}}function B(e,n,t=e,o){if(n.length===0)return e;const r=Object.create(null);for(const[i,a]of Object.entries(e))r[i]=a;const s=new Set(n.map(i=>m(i)).filter(i=>i!==null));for(const i of n){const a=m(i);if(a){const u=O(i).filter(l=>l===a||!s.has(l));de(r,i,a,u,t,o)}}return r}function de(e,n,t,o,r,s){const i=n.list===!0,a=w(n);a&&!i&&pe(e,n,t,o,a,s),fe(e,t,o,i);const u=n.repeatable===!0;if(!Object.hasOwn(e,t)){n.default!==void 0&&(e[t]=ae(n.default,a,i,u));return}if(a==="boolean"&&C(n,a)&&le(n,o,r,s),i){e[t]=ge(n,o,r,e[t],a,u,s);return}a&&(e[t]=K(n,h(e[t],a),a,s))}function pe(e,n,t,o,r,s){for(const i of o)i!==t&&Object.hasOwn(e,i)&&K(n,h(e[i],r),r,s)}function ge(e,n,t,o,r,s,i){const a=ue(t,n,o);r&&C(e,r)&&ce(e,r,a,s,i);const u=E(a,r,s);return r?K(e,u,r,i):u}function qe(e){const n=Object.create(null),t=[];Object.defineProperty(n,A,{value:t});let o=0;for(;o<e.length;){const r=_(e,o);if(!r){o+=1;continue}const s=d(r.key);if(s.length===0||S(s)){o+=r.consumed;continue}re(n,s,r.value),t.push({...r,key:s}),o+=r.consumed}return n}function Re(e){const n=[];let t=0;for(;t<e.length;){if(e[t]==="--"){n.push(...e.slice(t+1));break}const o=_(e,t);if(o){t+=Math.max(1,o.consumed);continue}n.push(e[t]),t+=1}return n}function Me(e,n){if(n.length===0)return[...e];const t=new Set,o=new Set;for(const i of n){const a=w(i);for(const u of O(i))t.add(u),a==="boolean"&&o.add(u)}if(t.size===0)return[...e];const r=[];let s=0;for(;s<e.length;){if(e[s]==="--"){r.push(...e.slice(s+1));break}const i=_(e,s);if(i){const a=d(i.key);if(t.has(a)){const u=e[s],l=o.has(a)&&!u.includes("=")?1:i.consumed;s+=l;continue}}r.push(e[s]),s+=1}return r}function ze(e){return m(e)}function I(e){return e.trim().toLowerCase().split(/\s+/u).filter(n=>n.length>0).join(" ")}function ke(e,n){const t=I(n);if(t.length===0)return[];const o=F(t);return e.flags.filter(r=>F(I(r.target_command))===o).flatMap(r=>[...r.flags])}function G(e,n,t,o){const r=y(e),[s,i]=t;throw new g(`Options '${s}' and '${i}' both set ${r} for extension command '${o}' with different values.`,p.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${r} once, under the handler key '${n}'.`,why:`'${s}' and '${i}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${s}' or '${i}' and pass one value as '${n}'.`,`Run pm contracts --command ${o} --flags-only --json to read each flag's sdk_option key.`]})}function Ue(e,n,t,o={}){if(n.length===0)return e;const r=n.map(c=>c.repeatable===!0&&c.list!==!0?{...c,list:!0}:c),s=Oe(r),i=we(e,s,t),a=new Set([...s.long.values()].map(({handlerKey:c})=>c)),u=Object.create(null),l=Object.create(null);for(const[c,f]of Object.entries(i))a.has(c)?u[c]=f:f===void 0||o.undeclaredKeys==="pass"||me(c)?l[c]=f:T(c,ye(c),t,W(r,{}));return J(u,r,t),Object.assign(l,B(u,r,H(u,s),t))}function H(e,n){const t=new Set([...n.long.values()].map(({handlerKey:s})=>s)),o=Object.entries(e).filter(([s])=>t.has(s)).flatMap(([s,i])=>(Array.isArray(i)?i.flat(1/0):[i]).map(a=>({consumed:1,key:s,value:a,attached:!0}))),r=Object.create(null);return Object.defineProperty(r,A,{value:o}),r}function J(e,n,t){for(const o of n){const r=m(o);if(r===null)continue;const s=y(o),i=e[r],a=Object.hasOwn(e,r);o.enabled===!1&&a&&q(s,t);const u=a&&(o.list!==!0||z(o,i));o.required===!0&&o.enabled!==!1&&!u&&R(o,r,s,t),o.list!==!0&&Array.isArray(i)&&he(s,t)}}function he(e,n){throw new g(`Option '${e}' for extension command '${n}' takes one value; received an array.`,p.USAGE,{code:"extension_flag_value_invalid",flag:e,required:`Pass one value for ${e}, or ask the package to declare it with list: true or repeatable: true.`,why:"The flag is not declared list or repeatable, so pm refuses an array before the extension handler runs instead of handing it a value of the wrong shape.",nextSteps:[`Run pm contracts --command ${n} --flags-only --json to read each flag's value contract.`]})}const X=new Set([...[...ne].flatMap(e=>{const n=e.replace(/^--/u,"");return[n,...n.startsWith("no-")?[n.slice(3)]:[]].flatMap(o=>[d(o),o.replaceAll("-","_")])}),"force","subcommand","inputResponses","requestState"]);function me(e){return X.has(e)||X.has(d(e.replace(/^-{1,2}/u,"")))}function ye(e){return`--${e.replace(/^-+/u,"").replace(/([a-z0-9])([A-Z])/gu,"$1-$2").replaceAll("_","-").toLowerCase()}`}function Oe(e){const n={long:new Map,short:new Map},t=(o,r,s)=>{r.length>0&&!o.has(r)&&o.set(r,s)};for(const o of e){const r=m(o);if(r===null)continue;const s={handlerKey:r,definition:o};t(n.long,r,s);const i=typeof o.short=="string"?o.short.trim():"";i.startsWith("-")&&!i.startsWith("--")&&t(n.short,i.slice(1),s)}return n}function j(e,n){return e.long.get(n)??e.short.get(n.replace(/^-(?!-)/u,""))??e.long.get(d(n.replace(/^-{1,2}/u,"")))}function be(e,n,t,o){const r=/^(?:--)?no-(.+)$/u.exec(n)?.[1];if(r===void 0||j(e,n)!==void 0)return{spelling:n,value:t};const s=j(e,r);return s===void 0||w(s.definition)!=="boolean"?{spelling:n,value:t}:(s.definition.list===!0||s.definition.repeatable===!0)&&Array.isArray(t)?{spelling:r,value:t.flat(1/0).map(i=>Y(n,s.definition,i,o))}:s.definition.list===!0&&t!==void 0?{spelling:r,value:Y(n,s.definition,t,o)}:{spelling:r,value:t===void 0?t:v(n,s.definition,t,o)}}function Y(e,n,t,o){const r=s=>s.trim().length===0?s:String(v(e,n,s.trim(),o));return t==null?t:typeof t!="string"?v(e,n,t,o):t.trim().length===0?t:n.repeatable===!0||!t.includes(",")?v(e,n,t,o):t.split(",").map(r).join(",")}function v(e,n,t,o){const r=M(t);return typeof r=="boolean"?!r:Se(e,n,t,o)}function Se(e,n,t,o){const r=y(n);throw new g(`Option '${e}' for extension command '${o}' negates ${r} and expects true, false, 1, or 0; received ${JSON.stringify(t)}.`,p.USAGE,{code:"extension_flag_value_invalid",flag:r,required:`Pass ${r} as true or false, or '${e}' as true.`,why:`'${e}' is the negated spelling of the boolean ${r}, so only a boolean value can be inverted before the extension handler runs.`,nextSteps:[`Run pm contracts --command ${o} --flags-only --json to read each flag's value contract.`]})}function we(e,n,t){const o=Object.create(null),r=new Map;for(const[s,i]of Object.entries(e)){const{spelling:a,value:u}=be(n,s,i,t),l=j(n,a);if(l===void 0)o[a]=u;else if(u!==void 0){const c=r.get(l.handlerKey);c===void 0?(r.set(l.handlerKey,a),o[l.handlerKey]=u):V(Z(l.definition,l.handlerKey,o[l.handlerKey],n,t),Z(l.definition,l.handlerKey,u,n,t))||G(l.definition,l.handlerKey,[c,a],t)}}return o}function Z(e,n,t,o,r){const s={[n]:t};return J(s,[e],r),B(s,[e],H(s,o),r)[n]}function ve(e){const n=new Map;for(const t of e){const o=m(t);if(o===null)continue;const r={definition:t,handlerKey:o,kind:w(t),arity:x(t).value_arity,scalar:t.list!==!0},s=[b(t.long),typeof t.short=="string"?t.short.trim():""];for(const i of s.filter(a=>a?.startsWith("-")===!0))n.has(i)||n.set(i,r)}return n}function $e(e,n,t){const o=e.optionOf(t),r=n.get(t),s=r?.scalar===!0?r:void 0;if(o!==void 0){const i={arity:o.arity,...o.variadic===!0?{variadic:!0}:{}};if(s?.handlerKey===o.key)return{...i,declared:s};const a=r===void 0&&t.startsWith("--no-")?n.get(`--${t.slice(5)}`):void 0;return a?.scalar===!0&&a.kind==="boolean"&&a.handlerKey===o.key?{...i,declared:a,negates:!0}:i}if(!(!e.includesLooseFlags||r===void 0))return s===void 0?{arity:r.arity,loose:!0}:{arity:r.arity,declared:s,loose:!0}}function N(e){return e.length>1&&e.startsWith("-")}const Q=/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/u;function xe(e,n,t){const{tokens:o}=e;let r=0,s,i=!1,a=!1;for(;r<o.length||s!==void 0;){const u=s??o[r++];if(u==="--")return;if(a&&s===void 0&&Ae(e,u))continue;const l=N(u)?Ee(e,u,o[r],n,t):{consumedByCommander:!1,consumed:0};if(r+=l.consumed,s=l.group,a=l.variadic===!0,!l.consumedByCommander){if(_e(e.stop,u,i))return;i=!0}}}function Ae(e,n){return!N(n)||e.negativeNumbersAreValues&&Q.test(n)}function _e(e,n,t){return e!==void 0&&(e.atFirstUnrecognized||!t&&e.atSubcommand(n))}function Ee(e,n,t,o,r){const s=Le(n,t,o);if(s!==void 0)return r(s.spelling,s.entry,s.value),{consumedByCommander:!1,consumed:s.consumed};const i=o(n);if(i!==void 0){const a=i.arity==="required"||i.arity==="optional"&&t!==void 0&&(!N(t)||e.negativeNumbersAreValues&&Q.test(t));return r(n,i,i.negates===!0?!1:a?t:!0),{consumedByCommander:!0,consumed:a?1:0,variadic:i.variadic===!0}}return n[1]!=="-"?{consumed:0,...Ce(n,o,r)}:{consumedByCommander:Ke(n,o,r,e.includesLooseFlags?r:()=>{}),consumed:0}}function Le(e,n,t){const o=e.indexOf("="),r=o>1?e.slice(0,o):e,s=t(r);if(s?.loose===!0)return o>1?{spelling:r,entry:s,value:e.slice(o+1),consumed:0}:n!==void 0&&!n.startsWith("-")?{spelling:r,entry:s,value:n,consumed:1}:{spelling:r,entry:s,value:!0,consumed:0};const i=o<0&&e.startsWith("--no-")?t(`--${e.slice(5)}`):void 0;return i?.loose===!0&&i.declared?.kind==="boolean"?{spelling:e,entry:i,value:!1,consumed:0}:void 0}function Ce(e,n,t){const o=e.slice(0,2),r=e.length>2?n(o):void 0;return r===void 0||r.loose===!0?{consumedByCommander:!1}:r.arity!=="none"?(t(o,r,e.slice(2)),{consumedByCommander:!0}):(t(o,r,!0),{consumedByCommander:!0,group:`-${e.slice(2)}`})}function Ke(e,n,t,o){const r=e.indexOf("=");if(r>2){const i=e.slice(0,r),a=n(i);return a!==void 0&&a.arity!=="none"?(t(i,a,e.slice(r+1)),!0):(a?.declared?.kind==="boolean"&&o(i,a,e.slice(r+1)),!1)}const s=e.startsWith("--no-")?n(`--${e.slice(5)}`):void 0;return s?.declared?.kind==="boolean"&&o(e,s,!1),!1}function Be(e,n,t){const o=ve(n),r=new Map;for(const s of e)xe(s,i=>$e(s,o,i),(i,a,u)=>{a.declared!==void 0&&je(r,a.declared,i,u,t)})}function je(e,n,t,o,r){const{definition:s,handlerKey:i,kind:a}=n,u=a?h(o,a):o,l=e.get(i)??new Map,c=[...l].find(([f,P])=>f!==t&&!V(P,u));c!==void 0&&G(s,i,[c[0],t],r),l.set(t,u),e.set(i,l)}export{B as coerceLooseCommandOptionsWithFlagDefinitions,ke as collectExtensionFlagDefinitionsForCommand,We as collectLooseCommandOptionKeysForDefinitions,Re as collectLoosePositionalArgs,Ue as normalizeDirectExtensionCommandOptions,qe as parseLooseCommandOptions,Be as refuseConflictingArgvOptionSpellings,ze as resolveExtensionFlagOptionKey,Me as stripLooseCommandOptionTokens,Te as validateLooseCommandOptionsWithFlagDefinitions};
2
2
  //# sourceMappingURL=command-options.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="eb830963-f036-5f98-ab26-786240b3e0fd")}catch{}})();const mapWithFixedConcurrency=async(inputs,concurrency,mapper)=>{if(!Number.isInteger(concurrency)||concurrency<1)throw new RangeError("concurrency must be a positive integer");const results=new Array(inputs.length);let nextIndex=0;const workers=Array.from({length:Math.min(concurrency,inputs.length)},async()=>{for(;nextIndex<inputs.length;){const index=nextIndex;nextIndex+=1,results[index]=await mapper(inputs[index])}});return await Promise.all(workers),results};export{mapWithFixedConcurrency};
1
+ const s=async(e,r,o)=>{if(!Number.isInteger(r)||r<1)throw new RangeError("concurrency must be a positive integer");const n=new Array(e.length);let t=0;const i=Array.from({length:Math.min(r,e.length)},async()=>{for(;t<e.length;){const a=t;t+=1,n[a]=await o(e[a])}});return await Promise.all(i),n};export{s as mapWithFixedConcurrency};
2
2
  //# sourceMappingURL=concurrency.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="147fb29e-ad06-5850-b0b1-f643e32e9b1f")}catch{}})();import path from"node:path";import{isPathWithinDirectory}from"../../core/fs/path-utils.js";function includesExtensionCopyPath(source,destination,candidate,nestedDestination){const relative=path.relative(source,candidate);if(relative!==""&&!isPathWithinDirectory(source,candidate)||candidate===destination||isPathWithinDirectory(destination,candidate))return!1;const segments=relative.split(path.sep);return segments.includes(".git")?!1:nestedDestination?!segments.some(segment=>segment===".agents"||segment==="node_modules"||segment.startsWith(".pm-extension-install-backup-")):!0}export{includesExtensionCopyPath};
1
+ import o from"node:path";import{isPathWithinDirectory as l}from"../../core/fs/path-utils.js";function m(e,i,t,f){const s=o.relative(e,t);if(s!==""&&!l(e,t)||t===i||l(i,t))return!1;const n=s.split(o.sep);return n.includes(".git")?!1:f?!n.some(r=>r===".agents"||r==="node_modules"||r.startsWith(".pm-extension-install-backup-")):!0}export{m as includesExtensionCopyPath};
2
2
  //# sourceMappingURL=copy-scope.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a1803149-25ca-5bb0-a178-afa2d85d2ec9")}catch{}})();import{resolvePmToolCustomFieldCollision}from"../cli-contracts/tool-schema.js";const collectMcpCustomFieldCollisionDoctorWarnings=activationResult=>[...activationResult.registrations.item_fields.flatMap(registration=>registration.fields.map(field=>({layer:registration.layer,extension:registration.name,field:field.name}))),...activationResult.registrations.profiles.flatMap(registration=>registration.profile.fields.map(field=>({layer:registration.layer,extension:registration.name,field:field.key??""})))].flatMap(entry=>{const collision=resolvePmToolCustomFieldCollision(entry.field);return collision?[`extension_custom_field_mcp_input_collision:${entry.layer}:${entry.extension}:${collision.field}:${collision.property}:${collision.owner}:use=${collision.nested_path}`]:[]}).filter((warning,index,warnings)=>warnings.indexOf(warning)===index).sort((left,right)=>left.localeCompare(right));export{collectMcpCustomFieldCollisionDoctorWarnings};
1
+ import{resolvePmToolCustomFieldCollision as s}from"../cli-contracts/tool-schema.js";const a=o=>[...o.registrations.item_fields.flatMap(e=>e.fields.map(l=>({layer:e.layer,extension:e.name,field:l.name}))),...o.registrations.profiles.flatMap(e=>e.profile.fields.map(l=>({layer:e.layer,extension:e.name,field:l.key??""})))].flatMap(e=>{const l=s(e.field);return l?[`extension_custom_field_mcp_input_collision:${e.layer}:${e.extension}:${l.field}:${l.property}:${l.owner}:use=${l.nested_path}`]:[]}).filter((e,l,i)=>i.indexOf(e)===l).sort((e,l)=>e.localeCompare(l));export{a as collectMcpCustomFieldCollisionDoctorWarnings};
2
2
  //# sourceMappingURL=custom-field-collisions.js.map
@@ -1,6 +1,6 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6d50733c-ced5-5ec8-b82e-2391a974ad0f")}catch{}})();import{describeExtensionActivation}from"../../core/extensions/activation-summary.js";import{renderExtensionSurfaceMarkdown}from"../../core/extensions/activation-summary-markdown.js";import{normalizeExtensionNameForMatch}from"./shared.js";function layerNameKey(layer,name){return`${layer}:${normalizeExtensionNameForMatch(name)}`}function buildExtensionCommandOwnership(activationResult,matchedNames){const rows=[];for(const[surface,entries]of[["handler",activationResult.commands.handlers],["override",activationResult.commands.overrides]]){const byCommand=new Map;for(const entry of entries){const bucket=byCommand.get(entry.command)??[];byCommand.set(entry.command,[...bucket,entry])}for(const[command,claimants]of byCommand){if(matchedNames!==null&&!claimants.some(entry=>matchedNames.has(normalizeExtensionNameForMatch(entry.name))))continue;const winner=claimants.at(-1);rows.push({command,surface,policy:"last_activated_wins",collision:claimants.length>1,claimants:claimants.map(entry=>({name:entry.name,layer:entry.layer,winner:entry===winner}))})}}return rows.sort((left,right)=>left.command.localeCompare(right.command)||left.surface.localeCompare(right.surface))}function buildExtensionDescribeResult(target,loadResult,activationResult){const activationFailedKeys=new Set(activationResult.failed.map(entry=>layerNameKey(entry.layer,entry.name))),candidates=[...loadResult.loaded.map(entry=>({name:entry.name,layer:entry.layer,version:entry.version,activation_status:activationFailedKeys.has(layerNameKey(entry.layer,entry.name))?"failed":"ok",surfaces:describeExtensionActivation(activationResult,{extensionName:entry.name})})),...loadResult.failed.map(entry=>({name:entry.name,layer:entry.layer,version:"unknown",activation_status:"not_loaded",surfaces:describeExtensionActivation(activationResult,{extensionName:entry.name})}))].sort((left,right)=>left.name.localeCompare(right.name)||left.layer.localeCompare(right.layer)),normalizedTarget=typeof target=="string"?normalizeExtensionNameForMatch(target):null,matchedNames=normalizedTarget===null?null:new Set(loadResult.loaded.filter(entry=>normalizeExtensionNameForMatch(entry.name)===normalizedTarget||typeof entry.source_package=="string"&&normalizeExtensionNameForMatch(entry.source_package)===normalizedTarget||(entry.source_aliases??[]).some(alias=>normalizeExtensionNameForMatch(alias)===normalizedTarget)).map(entry=>normalizeExtensionNameForMatch(entry.name)).concat(normalizedTarget)),extensions=matchedNames===null?candidates:candidates.filter(entry=>matchedNames.has(normalizeExtensionNameForMatch(entry.name))),unionOptions=matchedNames===null?{}:{extensionNames:[...matchedNames]};return{target:typeof target=="string"?target.trim():null,total:extensions.length,extensions,union:describeExtensionActivation(activationResult,unionOptions),command_ownership:buildExtensionCommandOwnership(activationResult,matchedNames)}}const ACTIVATION_STATUS_LABELS={ok:"loaded",failed:"activation failed",not_loaded:"not loaded"};function renderExtensionDescribeMarkdown(result,noun){const lines=[`# ${`${noun[0].toUpperCase()}${noun.slice(1)}`} surface reference`,""];if(lines.push(result.target===null?`Scope: all loaded ${noun}s`:`Scope: \`${result.target}\``),lines.push(`Described: ${result.total} ${noun}${result.total===1?"":"s"}`,""),(result.command_ownership?.length??0)>0){lines.push("## Command ownership","");for(const ownership of result.command_ownership){const winner=ownership.claimants.find(claimant=>claimant.winner),claimantNames=ownership.claimants.map(claimant=>`${claimant.layer}:${claimant.name}`).join(", ");lines.push(`- \`${ownership.command}\` (${ownership.surface}): ${winner.layer}:${winner.name}; policy=${ownership.policy}; collision=${String(ownership.collision)}; claimants=${claimantNames}`)}lines.push("")}if(result.extensions.length===0)return lines.push(`_No ${noun}s are loaded._`,""),`${lines.join(`
1
+ import{describeExtensionActivation as p}from"../../core/extensions/activation-summary.js";import{renderExtensionSurfaceMarkdown as f}from"../../core/extensions/activation-summary-markdown.js";import{normalizeExtensionNameForMatch as m}from"./shared.js";function u(e,s){return`${e}:${m(s)}`}function $(e,s){const c=[];for(const[a,o]of[["handler",e.commands.handlers],["override",e.commands.overrides]]){const i=new Map;for(const t of o){const r=i.get(t.command)??[];i.set(t.command,[...r,t])}for(const[t,r]of i){if(s!==null&&!r.some(n=>s.has(m(n.name))))continue;const d=r.at(-1);c.push({command:t,surface:a,policy:"last_activated_wins",collision:r.length>1,claimants:r.map(n=>({name:n.name,layer:n.layer,winner:n===d}))})}}return c.sort((a,o)=>a.command.localeCompare(o.command)||a.surface.localeCompare(o.surface))}function g(e,s,c){const a=new Set(c.failed.map(n=>u(n.layer,n.name))),o=[...s.loaded.map(n=>({name:n.name,layer:n.layer,version:n.version,activation_status:a.has(u(n.layer,n.name))?"failed":"ok",surfaces:p(c,{extensionName:n.name})})),...s.failed.map(n=>({name:n.name,layer:n.layer,version:"unknown",activation_status:"not_loaded",surfaces:p(c,{extensionName:n.name})}))].sort((n,l)=>n.name.localeCompare(l.name)||n.layer.localeCompare(l.layer)),i=typeof e=="string"?m(e):null,t=i===null?null:new Set(s.loaded.filter(n=>m(n.name)===i||typeof n.source_package=="string"&&m(n.source_package)===i||(n.source_aliases??[]).some(l=>m(l)===i)).map(n=>m(n.name)).concat(i)),r=t===null?o:o.filter(n=>t.has(m(n.name))),d=t===null?{}:{extensionNames:[...t]};return{target:typeof e=="string"?e.trim():null,total:r.length,extensions:r,union:p(c,d),command_ownership:$(c,t)}}const h={ok:"loaded",failed:"activation failed",not_loaded:"not loaded"};function y(e,s){const a=[`# ${`${s[0].toUpperCase()}${s.slice(1)}`} surface reference`,""];if(a.push(e.target===null?`Scope: all loaded ${s}s`:`Scope: \`${e.target}\``),a.push(`Described: ${e.total} ${s}${e.total===1?"":"s"}`,""),(e.command_ownership?.length??0)>0){a.push("## Command ownership","");for(const o of e.command_ownership){const i=o.claimants.find(r=>r.winner),t=o.claimants.map(r=>`${r.layer}:${r.name}`).join(", ");a.push(`- \`${o.command}\` (${o.surface}): ${i.layer}:${i.name}; policy=${o.policy}; collision=${String(o.collision)}; claimants=${t}`)}a.push("")}if(e.extensions.length===0)return a.push(`_No ${s}s are loaded._`,""),`${a.join(`
2
2
  `).trimEnd()}
3
- `;for(const entry of result.extensions){const title=`${entry.name} (${entry.layer} v${entry.version}, ${ACTIVATION_STATUS_LABELS[entry.activation_status]})`;lines.push(renderExtensionSurfaceMarkdown(entry.surfaces,{title,headingLevel:2}))}return result.extensions.length>1&&lines.push(renderExtensionSurfaceMarkdown(result.union,{title:`Union across all described ${noun}s`,headingLevel:2})),`${lines.join(`
3
+ `;for(const o of e.extensions){const i=`${o.name} (${o.layer} v${o.version}, ${h[o.activation_status]})`;a.push(f(o.surfaces,{title:i,headingLevel:2}))}return e.extensions.length>1&&a.push(f(e.union,{title:`Union across all described ${s}s`,headingLevel:2})),`${a.join(`
4
4
  `).trimEnd()}
5
- `}export{buildExtensionDescribeResult,renderExtensionDescribeMarkdown};
5
+ `}export{g as buildExtensionDescribeResult,y as renderExtensionDescribeMarkdown};
6
6
  //# sourceMappingURL=describe.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="573b0fd6-f003-55d8-8f49-c2a5e81cbc31")}catch{}})();import{reconcileExtensionCapabilityUsage}from"../../core/extensions/index.js";import{EXTENSION_CAPABILITY_CONTRACT,KNOWN_EXTENSION_CAPABILITIES,parseLegacyExtensionCapabilityAliasWarning,parseUnknownExtensionCapabilityWarning}from"../../core/extensions/loader.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{normalizeExtensionNameForMatch}from"./shared.js";import{extensionVersionRemediation}from"../../core/extensions/version-diagnostics.js";function summarizeExtensionFailures(failures){return failures.map(({layer,name,error})=>({layer,name,error}))}function addRuntimePath(pathsByExtension,extensionName,pathValue){const normalizedName=normalizeExtensionNameForMatch(extensionName),normalizedPath=pathValue.trim();if(normalizedName.length===0||normalizedPath.length===0)return;const existing=pathsByExtension.get(normalizedName)??new Set;existing.add(normalizedPath),pathsByExtension.set(normalizedName,existing)}function collectRuntimeActivationPaths(activationResult){const commandPathsByExtension=new Map,actionPathsByExtension=new Map;for(const registration of activationResult.registrations.commands)addRuntimePath(commandPathsByExtension,registration.name,registration.command),addRuntimePath(actionPathsByExtension,registration.name,registration.action);for(const handler of activationResult.commands.handlers)addRuntimePath(commandPathsByExtension,handler.name,handler.command);for(const override of activationResult.commands.overrides)addRuntimePath(commandPathsByExtension,override.name,override.command);return{commandPathsByExtension,actionPathsByExtension}}function sortedRuntimePaths(values){if(!(!values||values.size===0))return[...values].sort((left,right)=>left.localeCompare(right))}function resolveDoctorActivationStatus(params){const{enabled,normalizedName,loadedNames,loadFailedNames,activationFailedNames}=params;return enabled?loadFailedNames.has(normalizedName)||activationFailedNames.has(normalizedName)?{runtime_active:!1,activation_status:"failed"}:loadedNames.has(normalizedName)?{runtime_active:!0,activation_status:"ok"}:{runtime_active:!1,activation_status:"not_loaded"}:{runtime_active:!1,activation_status:"not_loaded"}}function applyDoctorRuntimeActivationState(extensions,loadResult,activationResult){const loadedNames=new Set(loadResult.loaded.map(entry=>normalizeExtensionNameForMatch(entry.name))),loadFailedNames=new Set(loadResult.failed.map(entry=>normalizeExtensionNameForMatch(entry.name))),activationFailedNames=new Set(activationResult.failed.map(entry=>normalizeExtensionNameForMatch(entry.name))),{commandPathsByExtension,actionPathsByExtension}=collectRuntimeActivationPaths(activationResult);return extensions.map(entry=>{const normalizedName=normalizeExtensionNameForMatch(entry.name),commandPaths=sortedRuntimePaths(commandPathsByExtension.get(normalizedName)),actionPaths=sortedRuntimePaths(actionPathsByExtension.get(normalizedName)),runtimeMetadata={...commandPaths?{command_paths:commandPaths}:{},...actionPaths?{action_paths:actionPaths}:{}},activationStatus=resolveDoctorActivationStatus({enabled:entry.enabled,normalizedName,loadedNames,loadFailedNames,activationFailedNames});return{...entry,...activationStatus,...runtimeMetadata}})}function summarizePolicyWarnings(warnings){let warningCount=0,violationCount=0,blockedCount=0;for(const warning of warnings)if(warning.startsWith("extension_policy_")){if(warningCount+=1,warning.startsWith("extension_policy_violation_")){violationCount+=1;continue}warning.startsWith("extension_policy_blocked_")&&(blockedCount+=1)}return{warning_count:warningCount,violation_count:violationCount,blocked_count:blockedCount}}function lifecycleFlagCommand(options,action){return options.vocabulary==="package"?`pm package --${action}`:`pm extension --${action}`}const REGISTRATION_COLLISION_WARNING_CODES=new Set(["extension_command_handler_collision","extension_command_override_collision","extension_command_override_handler_overlap","extension_parser_override_collision","extension_preflight_override_collision","extension_renderer_collision","extension_service_override_collision"]);function isRegistrationCollisionWarning(warning){return REGISTRATION_COLLISION_WARNING_CODES.has(warningCode(warning))}function isExtensionLayer(value){return value==="project"||value==="global"}function parseRegistrationCollisionWarning(warning){const parts=warning.split(":"),code=parts[0];if(!code||!REGISTRATION_COLLISION_WARNING_CODES.has(code))return null;const winnerLayer=parts.at(-4),winnerName=parts.at(-3)?.trim(),displacedLayer=parts.at(-2),displacedName=parts.at(-1)?.trim();return!isExtensionLayer(winnerLayer)||!isExtensionLayer(displacedLayer)||!winnerName||!displacedName?null:{code,surface:parts.slice(1,-4).join(":")||"global",winner:{layer:winnerLayer,name:winnerName},displaced:{layer:displacedLayer,name:displacedName}}}function collectRegistrationCollisionExtensionNames(warnings){const names=new Set;for(const warning of warnings){const parsed=parseRegistrationCollisionWarning(warning);parsed&&(names.add(parsed.winner.name),names.add(parsed.displaced.name))}return[...names].sort((left,right)=>left.localeCompare(right))}function buildRegistrationCollisionRemediation(warnings,commands){const registrationCollisionWarnings=warnings.filter(isRegistrationCollisionWarning);if(registrationCollisionWarnings.length===0)return null;const collisionNames=collectRegistrationCollisionExtensionNames(registrationCollisionWarnings);return`Extension registration collisions or handler/override overlaps detected.${collisionNames.length>0?` Conflicting extensions: ${collisionNames.join(", ")}.`:""} Single-winner surfaces can hide earlier package behavior. Deactivate one conflicting package with ${commands.deactivate}, or scope registration surfaces in extensions.policy.extension_overrides, then rerun ${commands.doctor}.`}function buildRegistrationCollisionPlan(scope,warnings,extensions,options){const collisions=warnings.map(warning=>parseRegistrationCollisionWarning(warning)).filter(entry=>entry!==null).sort((left,right)=>`${left.code}:${left.surface}:${left.winner.name}:${left.displaced.name}`.localeCompare(`${right.code}:${right.surface}:${right.winner.name}:${right.displaced.name}`));if(collisions.length===0)return;const scopeFlag=scope==="global"?"--global":"--project",deactivatePrefix=lifecycleFlagCommand(options,"deactivate"),doctorCommand=`${lifecycleFlagCommand(options,"doctor")} ${scopeFlag} --detail deep --trace`,extensionByName=new Map(extensions.map(entry=>[normalizeExtensionNameForMatch(entry.name),entry])),affectedByName=new Map;for(const collision of collisions)for(const name of[collision.winner.name,collision.displaced.name]){const normalizedName=normalizeExtensionNameForMatch(name);affectedByName.set(normalizedName,(affectedByName.get(normalizedName)??0)+1)}const remediationCandidates=[...affectedByName.entries()].map(([normalizedName,affectedCollisions])=>{const extension=extensionByName.get(normalizedName),extensionName=extension?.name??normalizedName,commandPaths=extension?.command_paths??[],actionPaths=extension?.action_paths??[];return{action:"deactivate",extension:extensionName,command:`${deactivatePrefix} ${extensionName} ${scopeFlag}`,affected_collisions:affectedCollisions,feature_loss:{command_paths:[...commandPaths].sort((left,right)=>left.localeCompare(right)),action_paths:[...actionPaths].sort((left,right)=>left.localeCompare(right))}}}).sort((left,right)=>{const affectedDelta=right.affected_collisions-left.affected_collisions;if(affectedDelta!==0)return affectedDelta;const leftSurfaceCount=left.feature_loss.command_paths.length+left.feature_loss.action_paths.length,rightSurfaceCount=right.feature_loss.command_paths.length+right.feature_loss.action_paths.length;return leftSurfaceCount!==rightSurfaceCount?leftSurfaceCount-rightSurfaceCount:left.extension.localeCompare(right.extension)});return{status:"conflicts_detected",collision_count:collisions.length,extension_count:affectedByName.size,next_best_command:doctorCommand,collisions,remediation_candidates:remediationCandidates}}function classifyDoctorLoadFailureWarnings(loadFailures){const warnings=[];for(const failure of loadFailures){const normalizedError=failure.error.toLowerCase();(normalizedError.includes("cannot find package '@unbrained/pm-cli'")||normalizedError.includes('cannot find module "@unbrained/pm-cli"')||normalizedError.includes("cannot find module '@unbrained/pm-cli'"))&&warnings.push(`extension_load_failed_sdk_dependency_missing:${failure.name}`),(normalizedError.includes("cannot use import statement outside a module")||normalizedError.includes("to load an es module")||normalizedError.includes("must use import to load es module"))&&warnings.push(`extension_load_failed_module_mode_mismatch:${failure.name}`)}return[...new Set(warnings)].sort((left,right)=>left.localeCompare(right))}function classifyDoctorActivationFailureWarnings(activationFailures=[]){const failures=Array.isArray(activationFailures)?activationFailures:[],warnings=[];for(const failure of failures){if(!failure||typeof failure.name!="string")continue;const missingCapability=failure.trace?.missing_capability??failure.trace?.capability;typeof missingCapability=="string"&&missingCapability.trim().length>0&&warnings.push(`extension_capability_missing:${failure.name}:${missingCapability.trim().toLowerCase()}`)}return[...new Set(warnings)].sort((left,right)=>left.localeCompare(right))}function classifyUnusedCapabilityWarnings(loadResult,activationResult){const warnings=[];for(const entry of reconcileExtensionCapabilityUsage(loadResult.loaded,activationResult))for(const capability of entry.unused)warnings.push(`extension_capability_unused:${entry.layer}:${entry.name}:${capability}`);return[...new Set(warnings)].sort((left,right)=>left.localeCompare(right))}const TRIAGE_REMEDIATION_RULES=[{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_manifest_")),build:ctx=>`Run ${lifecycleFlagCommand(ctx.options,"explore")} ${ctx.scopeFlag} to inspect discovered manifests and directories.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_capability_unknown:")),build:()=>`Unknown extension capabilities detected. Allowed capabilities: ${KNOWN_EXTENSION_CAPABILITIES.join(", ")}. Review extension_capability_unknown warning details for suggested replacements.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_capability_legacy_alias:")),build:()=>"Legacy extension capability aliases were auto-remapped to canonical capabilities. Update manifests to canonical names (migration/validation -> schema)."},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_capability_missing:")),build:ctx=>`Extension activation failed because code registered a surface missing from manifest capabilities. Run ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag} --detail deep --trace and add the reported missing_capability to manifest.json before publishing.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_capability_unused:")),build:ctx=>`Extension manifests declare capabilities that are never registered against. Remove each reported unused capability from manifest.json to keep least privilege, or add the matching registration. Run ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag} --detail deep --trace for per-extension registration counts.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_command_definition_legacy_handler_alias:")),build:()=>"Extension command definitions using legacy handler were auto-remapped. Update command definitions to use run: (context) => ... for forward compatibility."},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_output_service_override_global:")||warning.startsWith("extension_output_renderer_override_global:")),build:()=>"Global output service/renderer overrides are active. For output_format, return context.payload/null/undefined unless the extension owns the command. For renderers, return null for unrelated payloads so pm falls back to native rendering."},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_schema_narrow_activation:")),build:()=>"A package registers custom item types/fields (a GLOBAL schema contribution) but also declares narrow activation.commands, so it never activates for built-in commands like pm create <type> and the custom type silently fails to register. Remove activation.commands from manifest.json so pm activates the package for every command, or \u2014 if the schema is intentionally command-scoped \u2014 knowingly ignore this advisory."},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_load_failed_sdk_dependency_missing:")),build:ctx=>`Detected extension load failures caused by missing SDK dependency resolution. Ensure extension package dependencies include "@unbrained/pm-cli" and reinstall dependencies before running ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag}.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_load_failed_module_mode_mismatch:")),build:ctx=>`Detected extension module-mode mismatches. For ESM-based extension entries/imports, set package.json "type": "module" or use an explicit .mjs entry and rerun ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag}.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_pm_min_version_")||warning.startsWith("extension_pm_max_version_")),build:ctx=>`Extension pm version-bound warnings detected. Align each package manifest's pm_min_version/pm_max_version with the installed pm CLI version (see the warning's required/allowed=...:current=... details), or upgrade/downgrade the pm CLI to satisfy the declared bounds, then rerun ${lifecycleFlagCommand(ctx.options,"doctor")} ${ctx.scopeFlag}.`},{matches:(_warnings,ctx)=>ctx.updateCheckFailedTotal>0,build:ctx=>`Run ${lifecycleFlagCommand(ctx.options,"manage")} ${ctx.scopeFlag} after validating network and repository access.`},{matches:warnings=>warnings.some(warning=>warning.startsWith("extension_manager_state_")),build:ctx=>`Review and repair ${ctx.scope} managed extension state file if schema/read warnings persist.`},{matches:(_warnings,ctx)=>ctx.policyWarningCount>0,build:()=>"Extension governance policy warnings detected. Review settings.extensions.policy mode and allow/block lists to confirm intended capabilities and registration surfaces."}];function buildExtensionTriageRemediation(params){const{normalizedWarnings,options,scope,scopeFlag,updateCheckFailedTotal,policyWarningCount,unmanagedActionRequiredTotal,notCheckedTotal,skippedNonGithubTotal,updateAvailableTotal}=params,remediation=normalizedWarnings.map(extensionVersionRemediation).filter(guidance=>guidance!==void 0),ctx={options,scope,scopeFlag,updateCheckFailedTotal,policyWarningCount};if(normalizedWarnings.length>0){const registrationCollisionRemediation=buildRegistrationCollisionRemediation(normalizedWarnings,{deactivate:`${lifecycleFlagCommand(options,"deactivate")} <name> ${scopeFlag}`,doctor:`${lifecycleFlagCommand(options,"doctor")} ${scopeFlag} --detail deep --trace`});registrationCollisionRemediation&&remediation.push(registrationCollisionRemediation);for(const rule of TRIAGE_REMEDIATION_RULES)rule.matches(normalizedWarnings,ctx)&&remediation.push(rule.build(ctx))}return unmanagedActionRequiredTotal>0&&remediation.push(`Update-check coverage is partial because unmanaged extensions need adoption. Adopt existing installs via ${lifecycleFlagCommand(options,"manage")} ${scopeFlag} --fix-managed-state (or ${lifecycleFlagCommand(options,"adopt-all")} ${scopeFlag}, ${lifecycleFlagCommand(options,"adopt")} <name> ${scopeFlag}, or reinstall via ${lifecycleFlagCommand(options,"install")} ${scopeFlag} <source>).`),skippedNonGithubTotal>0&&remediation.push("Update-check coverage is partial: non-GitHub managed sources were not checked. Inspect their registry or source directly; zero detected updates does not mean these packages are current. Runtime activation health is independent."),notCheckedTotal>0&&remediation.push(`Update-check coverage is partial: some sources have no completed check. Run ${lifecycleFlagCommand(options,"manage")} ${scopeFlag} to request update checks.`),updateAvailableTotal>0&&remediation.push(`Update available managed extensions via ${lifecycleFlagCommand(options,"install")} ${scopeFlag} <source>.`),remediation.length===0&&remediation.push(`No immediate action required. Re-run ${lifecycleFlagCommand(options,"manage")} ${scopeFlag} after extension changes.`),remediation}function buildExtensionTriageSummary(scope,warnings,extensions,options={}){const normalizedWarnings=[...new Set(warnings)].sort((left,right)=>left.localeCompare(right)),managedTotal=extensions.filter(entry=>entry.managed).length,enabledTotal=extensions.filter(entry=>entry.enabled).length,activeTotal=extensions.filter(entry=>entry.active).length,updateAvailableTotal=extensions.filter(entry=>entry.update_check_status==="checked"&&entry.update_available===!0).length,unmanagedExtensions=extensions.filter(entry=>entry.managed===!1),unmanagedExpectedExtensions=unmanagedExtensions.filter(entry=>isExpectedUnmanagedExtension(entry)).map(entry=>entry.name).sort((left,right)=>left.localeCompare(right)),unmanagedActionRequiredExtensions=unmanagedExtensions.filter(entry=>!isExpectedUnmanagedExtension(entry)).map(entry=>entry.name).sort((left,right)=>left.localeCompare(right)),updateCheckStatusTotals={checked:0,skipped_unmanaged:0,skipped_non_github:0,failed:0,not_checked:0};for(const entry of extensions)updateCheckStatusTotals[entry.update_check_status]+=1;const updateCheckFailedTotal=updateCheckStatusTotals.failed,skippedNonGithubTotal=extensions.filter(entry=>entry.update_check_status==="skipped_non_github"&&entry.source?.kind!=="builtin").length,partialCoverageWarnings=Object.entries({skipped_unmanaged:unmanagedActionRequiredExtensions.length,skipped_non_github:skippedNonGithubTotal,failed:updateCheckFailedTotal,not_checked:updateCheckStatusTotals.not_checked}).filter(([,count])=>count>0).map(([status,count])=>`extension_update_health_partial_coverage:${status}:${count}`),updateHealthPartial=partialCoverageWarnings.length>0,updateHealthCoverage=updateHealthPartial?"partial":"full",effectiveWarnings=[...new Set([...normalizedWarnings,...partialCoverageWarnings])].sort((left,right)=>left.localeCompare(right)),warningCodes=[...new Set(effectiveWarnings.map(value=>warningCode(value)))].sort((left,right)=>left.localeCompare(right)),policyWarnings=summarizePolicyWarnings(effectiveWarnings),scopeFlag=scope==="global"?"--global":"--project",collisionPlan=buildRegistrationCollisionPlan(scope,normalizedWarnings,extensions,options),remediation=buildExtensionTriageRemediation({normalizedWarnings:effectiveWarnings,options,scope,scopeFlag,updateCheckFailedTotal,policyWarningCount:policyWarnings.warning_count,unmanagedActionRequiredTotal:unmanagedActionRequiredExtensions.length,notCheckedTotal:updateCheckStatusTotals.not_checked,skippedNonGithubTotal,updateAvailableTotal});return{status:effectiveWarnings.length===0?"ok":"warn",warning_count:effectiveWarnings.length,warning_codes:warningCodes,warnings:effectiveWarnings,policy_warning_count:policyWarnings.warning_count,policy_violation_count:policyWarnings.violation_count,policy_blocked_count:policyWarnings.blocked_count,total_extensions:extensions.length,managed_total:managedTotal,enabled_total:enabledTotal,active_total:activeTotal,update_available_total:updateAvailableTotal,update_health_coverage:updateHealthCoverage,update_health_partial:updateHealthPartial,unmanaged_loaded_extension_count:unmanagedExtensions.length,unmanaged_loaded_extensions:unmanagedExtensions.map(entry=>entry.name).sort((left,right)=>left.localeCompare(right)),unmanaged_expected_extension_count:unmanagedExpectedExtensions.length,unmanaged_expected_extensions:unmanagedExpectedExtensions,unmanaged_action_required_extension_count:unmanagedActionRequiredExtensions.length,unmanaged_action_required_extensions:unmanagedActionRequiredExtensions,update_check_status_totals:updateCheckStatusTotals,update_check_failed_total:updateCheckFailedTotal,top_warnings:effectiveWarnings.slice(0,8),remediation,...collisionPlan?{collision_plan:collisionPlan}:{}}}function parseDoctorDetailMode(raw){if(!raw||raw.trim().length===0)return"summary";const normalized=raw.trim().toLowerCase();if(normalized==="summary"||normalized==="deep")return normalized;throw new PmCliError(`Invalid --detail value "${raw}". Expected summary or deep.`,EXIT_CODE.USAGE)}function warningCode(value){const normalized=value.trim(),separator=normalized.indexOf(":");return separator===-1?normalized:normalized.slice(0,separator)}function collectUnknownCapabilityGuidance(warnings){const seen=new Set,guidance=[];for(const warning of warnings){const parsedDetails=(()=>{const unknownWarning=parseUnknownExtensionCapabilityWarning(warning);return unknownWarning?[unknownWarning]:parseLegacyExtensionCapabilityAliasWarning(warning)})();for(const parsed of parsedDetails){const key=`${parsed.layer}:${parsed.name}:${parsed.capability}`;seen.has(key)||(seen.add(key),guidance.push(parsed))}}return guidance}function buildCapabilityContractMetadata(){return{version:EXTENSION_CAPABILITY_CONTRACT.version,capabilities:[...EXTENSION_CAPABILITY_CONTRACT.capabilities],legacy_aliases:{...EXTENSION_CAPABILITY_CONTRACT.legacy_aliases}}}function isExpectedUnmanagedExtension(entry){const normalizedName=normalizeExtensionNameForMatch(entry.name),normalizedDirectory=normalizeExtensionNameForMatch(entry.directory);return normalizedName.startsWith("builtin-")?!0:normalizedDirectory==="beads"||normalizedDirectory==="todos"}function buildDoctorConsistencySummary(scope,installedExtensions,loadedExtensions,failedLoads,disabledByFlag){if(scope!=="project"||disabledByFlag)return{warnings:[],summary:{active_project_count:0,loaded_project_count:0,active_project_names:[],loaded_project_names:[],missing_active_project_names:[]}};const activeProjectNames=[...new Set(installedExtensions.filter(entry=>entry.active).map(entry=>normalizeExtensionNameForMatch(entry.name)))].sort((left,right)=>left.localeCompare(right)),loadedProjectNames=[...new Set(loadedExtensions.filter(entry=>entry.layer==="project").map(entry=>normalizeExtensionNameForMatch(entry.name)))].sort((left,right)=>left.localeCompare(right)),failedLoadNames=new Set(failedLoads.map(entry=>normalizeExtensionNameForMatch(entry.name))),missingActiveProjectNames=activeProjectNames.filter(name=>!loadedProjectNames.includes(name)&&!failedLoadNames.has(name)).sort((left,right)=>left.localeCompare(right));return{warnings:missingActiveProjectNames.length>0?[`extension_doctor_consistency_active_not_loaded:${missingActiveProjectNames.join(",")}`]:[],summary:{active_project_count:activeProjectNames.length,loaded_project_count:loadedProjectNames.length,active_project_names:activeProjectNames,loaded_project_names:loadedProjectNames,missing_active_project_names:missingActiveProjectNames}}}export{applyDoctorRuntimeActivationState,buildCapabilityContractMetadata,buildDoctorConsistencySummary,buildExtensionTriageSummary,buildRegistrationCollisionRemediation,classifyDoctorActivationFailureWarnings,classifyDoctorLoadFailureWarnings,classifyUnusedCapabilityWarnings,collectUnknownCapabilityGuidance,parseDoctorDetailMode,summarizeExtensionFailures};
1
+ import{reconcileExtensionCapabilityUsage as I}from"../../core/extensions/index.js";import{EXTENSION_CAPABILITY_CONTRACT as k,KNOWN_EXTENSION_CAPABILITIES as L,parseLegacyExtensionCapabilityAliasWarning as z,parseUnknownExtensionCapabilityWarning as D}from"../../core/extensions/loader.js";import{EXIT_CODE as U}from"../../core/shared/constants.js";import{PmCliError as O}from"../../core/shared/errors.js";import{normalizeExtensionNameForMatch as f}from"./shared.js";import{extensionVersionRemediation as G}from"../../core/extensions/version-diagnostics.js";function oe(e){return e.map(({layer:n,name:t,error:a})=>({layer:n,name:t,error:a}))}function $(e,n,t){const a=f(n),o=t.trim();if(a.length===0||o.length===0)return;const r=e.get(a)??new Set;r.add(o),e.set(a,r)}function M(e){const n=new Map,t=new Map;for(const a of e.registrations.commands)$(n,a.name,a.command),$(t,a.name,a.action);for(const a of e.commands.handlers)$(n,a.name,a.command);for(const a of e.commands.overrides)$(n,a.name,a.command);return{commandPathsByExtension:n,actionPathsByExtension:t}}function N(e){if(!(!e||e.size===0))return[...e].sort((n,t)=>n.localeCompare(t))}function q(e){const{enabled:n,normalizedName:t,loadedNames:a,loadFailedNames:o,activationFailedNames:r}=e;return n?o.has(t)||r.has(t)?{runtime_active:!1,activation_status:"failed"}:a.has(t)?{runtime_active:!0,activation_status:"ok"}:{runtime_active:!1,activation_status:"not_loaded"}:{runtime_active:!1,activation_status:"not_loaded"}}function ie(e,n,t){const a=new Set(n.loaded.map(d=>f(d.name))),o=new Set(n.failed.map(d=>f(d.name))),r=new Set(t.failed.map(d=>f(d.name))),{commandPathsByExtension:p,actionPathsByExtension:v}=M(t);return e.map(d=>{const _=f(d.name),c=N(p.get(_)),i=N(v.get(_)),l={...c?{command_paths:c}:{},...i?{action_paths:i}:{}},m=q({enabled:d.enabled,normalizedName:_,loadedNames:a,loadFailedNames:o,activationFailedNames:r});return{...d,...m,...l}})}function B(e){let n=0,t=0,a=0;for(const o of e)if(o.startsWith("extension_policy_")){if(n+=1,o.startsWith("extension_policy_violation_")){t+=1;continue}o.startsWith("extension_policy_blocked_")&&(a+=1)}return{warning_count:n,violation_count:t,blocked_count:a}}function u(e,n){return e.vocabulary==="package"?`pm package --${n}`:`pm extension --${n}`}const W=new Set(["extension_command_handler_collision","extension_command_override_collision","extension_command_override_handler_overlap","extension_parser_override_collision","extension_preflight_override_collision","extension_renderer_collision","extension_service_override_collision"]);function H(e){return W.has(T(e))}function S(e){return e==="project"||e==="global"}function R(e){const n=e.split(":"),t=n[0];if(!t||!W.has(t))return null;const a=n.at(-4),o=n.at(-3)?.trim(),r=n.at(-2),p=n.at(-1)?.trim();return!S(a)||!S(r)||!o||!p?null:{code:t,surface:n.slice(1,-4).join(":")||"global",winner:{layer:a,name:o},displaced:{layer:r,name:p}}}function X(e){const n=new Set;for(const t of e){const a=R(t);a&&(n.add(a.winner.name),n.add(a.displaced.name))}return[...n].sort((t,a)=>t.localeCompare(a))}function K(e,n){const t=e.filter(H);if(t.length===0)return null;const a=X(t);return`Extension registration collisions or handler/override overlaps detected.${a.length>0?` Conflicting extensions: ${a.join(", ")}.`:""} Single-winner surfaces can hide earlier package behavior. Deactivate one conflicting package with ${n.deactivate}, or scope registration surfaces in extensions.policy.extension_overrides, then rerun ${n.doctor}.`}function V(e,n,t,a){const o=n.map(i=>R(i)).filter(i=>i!==null).sort((i,l)=>`${i.code}:${i.surface}:${i.winner.name}:${i.displaced.name}`.localeCompare(`${l.code}:${l.surface}:${l.winner.name}:${l.displaced.name}`));if(o.length===0)return;const r=e==="global"?"--global":"--project",p=u(a,"deactivate"),v=`${u(a,"doctor")} ${r} --detail deep --trace`,d=new Map(t.map(i=>[f(i.name),i])),_=new Map;for(const i of o)for(const l of[i.winner.name,i.displaced.name]){const m=f(l);_.set(m,(_.get(m)??0)+1)}const c=[..._.entries()].map(([i,l])=>{const m=d.get(i),h=m?.name??i,x=m?.command_paths??[],w=m?.action_paths??[];return{action:"deactivate",extension:h,command:`${p} ${h} ${r}`,affected_collisions:l,feature_loss:{command_paths:[...x].sort((y,b)=>y.localeCompare(b)),action_paths:[...w].sort((y,b)=>y.localeCompare(b))}}}).sort((i,l)=>{const m=l.affected_collisions-i.affected_collisions;if(m!==0)return m;const h=i.feature_loss.command_paths.length+i.feature_loss.action_paths.length,x=l.feature_loss.command_paths.length+l.feature_loss.action_paths.length;return h!==x?h-x:i.extension.localeCompare(l.extension)});return{status:"conflicts_detected",collision_count:o.length,extension_count:_.size,next_best_command:v,collisions:o,remediation_candidates:c}}function se(e){const n=[];for(const t of e){const a=t.error.toLowerCase();(a.includes("cannot find package '@unbrained/pm-cli'")||a.includes('cannot find module "@unbrained/pm-cli"')||a.includes("cannot find module '@unbrained/pm-cli'"))&&n.push(`extension_load_failed_sdk_dependency_missing:${t.name}`),(a.includes("cannot use import statement outside a module")||a.includes("to load an es module")||a.includes("must use import to load es module"))&&n.push(`extension_load_failed_module_mode_mismatch:${t.name}`)}return[...new Set(n)].sort((t,a)=>t.localeCompare(a))}function re(e=[]){const n=Array.isArray(e)?e:[],t=[];for(const a of n){if(!a||typeof a.name!="string")continue;const o=a.trace?.missing_capability??a.trace?.capability;typeof o=="string"&&o.trim().length>0&&t.push(`extension_capability_missing:${a.name}:${o.trim().toLowerCase()}`)}return[...new Set(t)].sort((a,o)=>a.localeCompare(o))}function ce(e,n){const t=[];for(const a of I(e.loaded,n))for(const o of a.unused)t.push(`extension_capability_unused:${a.layer}:${a.name}:${o}`);return[...new Set(t)].sort((a,o)=>a.localeCompare(o))}const Y=[{matches:e=>e.some(n=>n.startsWith("extension_manifest_")),build:e=>`Run ${u(e.options,"explore")} ${e.scopeFlag} to inspect discovered manifests and directories.`},{matches:e=>e.some(n=>n.startsWith("extension_capability_unknown:")),build:()=>`Unknown extension capabilities detected. Allowed capabilities: ${L.join(", ")}. Review extension_capability_unknown warning details for suggested replacements.`},{matches:e=>e.some(n=>n.startsWith("extension_capability_legacy_alias:")),build:()=>"Legacy extension capability aliases were auto-remapped to canonical capabilities. Update manifests to canonical names (migration/validation -> schema)."},{matches:e=>e.some(n=>n.startsWith("extension_capability_missing:")),build:e=>`Extension activation failed because code registered a surface missing from manifest capabilities. Run ${u(e.options,"doctor")} ${e.scopeFlag} --detail deep --trace and add the reported missing_capability to manifest.json before publishing.`},{matches:e=>e.some(n=>n.startsWith("extension_capability_unused:")),build:e=>`Extension manifests declare capabilities that are never registered against. Remove each reported unused capability from manifest.json to keep least privilege, or add the matching registration. Run ${u(e.options,"doctor")} ${e.scopeFlag} --detail deep --trace for per-extension registration counts.`},{matches:e=>e.some(n=>n.startsWith("extension_command_definition_legacy_handler_alias:")),build:()=>"Extension command definitions using legacy handler were auto-remapped. Update command definitions to use run: (context) => ... for forward compatibility."},{matches:e=>e.some(n=>n.startsWith("extension_output_service_override_global:")||n.startsWith("extension_output_renderer_override_global:")),build:()=>"Global output service/renderer overrides are active. For output_format, return context.payload/null/undefined unless the extension owns the command. For renderers, return null for unrelated payloads so pm falls back to native rendering."},{matches:e=>e.some(n=>n.startsWith("extension_schema_narrow_activation:")),build:()=>"A package registers custom item types/fields (a GLOBAL schema contribution) but also declares narrow activation.commands, so it never activates for built-in commands like pm create <type> and the custom type silently fails to register. Remove activation.commands from manifest.json so pm activates the package for every command, or \u2014 if the schema is intentionally command-scoped \u2014 knowingly ignore this advisory."},{matches:e=>e.some(n=>n.startsWith("extension_load_failed_sdk_dependency_missing:")),build:e=>`Detected extension load failures caused by missing SDK dependency resolution. Ensure extension package dependencies include "@unbrained/pm-cli" and reinstall dependencies before running ${u(e.options,"doctor")} ${e.scopeFlag}.`},{matches:e=>e.some(n=>n.startsWith("extension_load_failed_module_mode_mismatch:")),build:e=>`Detected extension module-mode mismatches. For ESM-based extension entries/imports, set package.json "type": "module" or use an explicit .mjs entry and rerun ${u(e.options,"doctor")} ${e.scopeFlag}.`},{matches:e=>e.some(n=>n.startsWith("extension_pm_min_version_")||n.startsWith("extension_pm_max_version_")),build:e=>`Extension pm version-bound warnings detected. Align each package manifest's pm_min_version/pm_max_version with the installed pm CLI version (see the warning's required/allowed=...:current=... details), or upgrade/downgrade the pm CLI to satisfy the declared bounds, then rerun ${u(e.options,"doctor")} ${e.scopeFlag}.`},{matches:(e,n)=>n.updateCheckFailedTotal>0,build:e=>`Run ${u(e.options,"manage")} ${e.scopeFlag} after validating network and repository access.`},{matches:e=>e.some(n=>n.startsWith("extension_manager_state_")),build:e=>`Review and repair ${e.scope} managed extension state file if schema/read warnings persist.`},{matches:(e,n)=>n.policyWarningCount>0,build:()=>"Extension governance policy warnings detected. Review settings.extensions.policy mode and allow/block lists to confirm intended capabilities and registration surfaces."}];function J(e){const{normalizedWarnings:n,options:t,scope:a,scopeFlag:o,updateCheckFailedTotal:r,policyWarningCount:p,unmanagedActionRequiredTotal:v,notCheckedTotal:d,skippedNonGithubTotal:_,updateAvailableTotal:c}=e,i=n.map(G).filter(m=>m!==void 0),l={options:t,scope:a,scopeFlag:o,updateCheckFailedTotal:r,policyWarningCount:p};if(n.length>0){const m=K(n,{deactivate:`${u(t,"deactivate")} <name> ${o}`,doctor:`${u(t,"doctor")} ${o} --detail deep --trace`});m&&i.push(m);for(const h of Y)h.matches(n,l)&&i.push(h.build(l))}return v>0&&i.push(`Update-check coverage is partial because unmanaged extensions need adoption. Adopt existing installs via ${u(t,"manage")} ${o} --fix-managed-state (or ${u(t,"adopt-all")} ${o}, ${u(t,"adopt")} <name> ${o}, or reinstall via ${u(t,"install")} ${o} <source>).`),_>0&&i.push("Update-check coverage is partial: non-GitHub managed sources were not checked. Inspect their registry or source directly; zero detected updates does not mean these packages are current. Runtime activation health is independent."),d>0&&i.push(`Update-check coverage is partial: some sources have no completed check. Run ${u(t,"manage")} ${o} to request update checks.`),c>0&&i.push(`Update available managed extensions via ${u(t,"install")} ${o} <source>.`),i.length===0&&i.push(`No immediate action required. Re-run ${u(t,"manage")} ${o} after extension changes.`),i}function le(e,n,t,a={}){const o=[...new Set(n)].sort((s,g)=>s.localeCompare(g)),r=t.filter(s=>s.managed).length,p=t.filter(s=>s.enabled).length,v=t.filter(s=>s.active).length,d=t.filter(s=>s.update_check_status==="checked"&&s.update_available===!0).length,_=t.filter(s=>s.managed===!1),c=_.filter(s=>j(s)).map(s=>s.name).sort((s,g)=>s.localeCompare(g)),i=_.filter(s=>!j(s)).map(s=>s.name).sort((s,g)=>s.localeCompare(g)),l={checked:0,skipped_unmanaged:0,skipped_non_github:0,failed:0,not_checked:0};for(const s of t)l[s.update_check_status]+=1;const m=l.failed,h=t.filter(s=>s.update_check_status==="skipped_non_github"&&s.source?.kind!=="builtin").length,x=Object.entries({skipped_unmanaged:i.length,skipped_non_github:h,failed:m,not_checked:l.not_checked}).filter(([,s])=>s>0).map(([s,g])=>`extension_update_health_partial_coverage:${s}:${g}`),w=x.length>0,y=w?"partial":"full",b=[...new Set([...o,...x])].sort((s,g)=>s.localeCompare(g)),A=[...new Set(b.map(s=>T(s)))].sort((s,g)=>s.localeCompare(g)),C=B(b),F=e==="global"?"--global":"--project",E=V(e,o,t,a),P=J({normalizedWarnings:b,options:a,scope:e,scopeFlag:F,updateCheckFailedTotal:m,policyWarningCount:C.warning_count,unmanagedActionRequiredTotal:i.length,notCheckedTotal:l.not_checked,skippedNonGithubTotal:h,updateAvailableTotal:d});return{status:b.length===0?"ok":"warn",warning_count:b.length,warning_codes:A,warnings:b,policy_warning_count:C.warning_count,policy_violation_count:C.violation_count,policy_blocked_count:C.blocked_count,total_extensions:t.length,managed_total:r,enabled_total:p,active_total:v,update_available_total:d,update_health_coverage:y,update_health_partial:w,unmanaged_loaded_extension_count:_.length,unmanaged_loaded_extensions:_.map(s=>s.name).sort((s,g)=>s.localeCompare(g)),unmanaged_expected_extension_count:c.length,unmanaged_expected_extensions:c,unmanaged_action_required_extension_count:i.length,unmanaged_action_required_extensions:i,update_check_status_totals:l,update_check_failed_total:m,top_warnings:b.slice(0,8),remediation:P,...E?{collision_plan:E}:{}}}function de(e){if(!e||e.trim().length===0)return"summary";const n=e.trim().toLowerCase();if(n==="summary"||n==="deep")return n;throw new O(`Invalid --detail value "${e}". Expected summary or deep.`,U.USAGE)}function T(e){const n=e.trim(),t=n.indexOf(":");return t===-1?n:n.slice(0,t)}function me(e){const n=new Set,t=[];for(const a of e){const o=(()=>{const r=D(a);return r?[r]:z(a)})();for(const r of o){const p=`${r.layer}:${r.name}:${r.capability}`;n.has(p)||(n.add(p),t.push(r))}}return t}function ue(){return{version:k.version,capabilities:[...k.capabilities],legacy_aliases:{...k.legacy_aliases}}}function j(e){const n=f(e.name),t=f(e.directory);return n.startsWith("builtin-")?!0:t==="beads"||t==="todos"}function pe(e,n,t,a,o){if(e!=="project"||o)return{warnings:[],summary:{active_project_count:0,loaded_project_count:0,active_project_names:[],loaded_project_names:[],missing_active_project_names:[]}};const r=[...new Set(n.filter(c=>c.active).map(c=>f(c.name)))].sort((c,i)=>c.localeCompare(i)),p=[...new Set(t.filter(c=>c.layer==="project").map(c=>f(c.name)))].sort((c,i)=>c.localeCompare(i)),v=new Set(a.map(c=>f(c.name))),d=r.filter(c=>!p.includes(c)&&!v.has(c)).sort((c,i)=>c.localeCompare(i));return{warnings:d.length>0?[`extension_doctor_consistency_active_not_loaded:${d.join(",")}`]:[],summary:{active_project_count:r.length,loaded_project_count:p.length,active_project_names:r,loaded_project_names:p,missing_active_project_names:d}}}export{ie as applyDoctorRuntimeActivationState,ue as buildCapabilityContractMetadata,pe as buildDoctorConsistencySummary,le as buildExtensionTriageSummary,K as buildRegistrationCollisionRemediation,re as classifyDoctorActivationFailureWarnings,se as classifyDoctorLoadFailureWarnings,ce as classifyUnusedCapabilityWarnings,me as collectUnknownCapabilityGuidance,de as parseDoctorDetailMode,oe as summarizeExtensionFailures};
2
2
  //# sourceMappingURL=doctor.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="18bf1015-c2c8-5530-a3ce-1531a8a1d0e2")}catch{}})();import fs from"node:fs/promises";import path from"node:path";import{isPathWithinDirectory}from"../../core/fs/path-utils.js";import{PmCliError}from"../../core/shared/errors.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{includesExtensionCopyPath}from"./copy-scope.js";import{resolveCanonicalExtensionInstallDestination}from"./install-runtime.js";import{pathExists}from"../../core/fs/fs-utils.js";import{areDirectoriesEquivalent}from"./install-sources.js";const DEVELOPMENT_DIRECTORIES=new Set(["node_modules",".git","dist","build","coverage"]);async function buildExtensionInstallPlan(resolved,destination,scope,options){const localStat=resolved.source.kind==="local"?await fs.stat(resolved.source.absolute_path):void 0,sourceMode=resolved.source.kind==="local"?localStat.isDirectory()?"directory":"archive":resolved.source.kind,copy=await planExtensionDirectoryCopy(resolved.directory,destination,options),plan={source_mode:sourceMode,...sourceMode==="archive"?{archive_bytes:localStat.size}:{},copy},packageRoot=resolved.source_root??resolved.directory;if(sourceMode==="directory"&&(!copy.complete||copy.development_entries>0||copy.bytes>=16*1024*1024)&&await pathExists(path.join(packageRoot,"package.json"))&&(plan.packed_alternative={cwd:packageRoot,pack:{command:"npm",args:["pack","--ignore-scripts","--json"]},install:{command:"pm",args:["package","install","<archive-filename>",`--${scope}`]},archive_argument:"pack_result[0].filename"}),sourceMode==="directory"&&!copy.complete){const limit=copy.stop_reason==="entry_limit"?`${copy.max_entries} entries`:`${copy.max_depth} directory levels`;throw new PmCliError(`Local extension source scan stopped at ${limit}; the directory snapshot is incomplete and installation was refused. ${plan.packed_alternative?"Pack the package with npm pack --ignore-scripts --json, then install its archive.":"Install a smaller source directory or a packed archive."}`,EXIT_CODE.USAGE,{code:"extension_install_incomplete_source_scan",reason:copy.stop_reason,nextSteps:plan.packed_alternative?[`Run npm pack --ignore-scripts --json from the package root, then pm package install <archive-filename> --${scope}.`]:["Choose a smaller source directory or install a packed archive."]})}return plan}async function planExtensionDirectoryCopy(sourceDirectory,destinationDirectory,options={}){const{maxEntries=1e4,maxDepth=64,signal}=options;if(![maxEntries,maxDepth].every(value=>Number.isSafeInteger(value)&&value>0))throw new PmCliError("maxEntries and maxDepth must be positive safe integers.",EXIT_CODE.USAGE);signal?.throwIfAborted();const source=await fs.realpath(sourceDirectory),destination=await resolveCanonicalExtensionInstallDestination(destinationDirectory),installInPlace=await areDirectoriesEquivalent(source,destination);signal?.throwIfAborted();const scope=installInPlace?"in_place":isPathWithinDirectory(source,destination)?"nested_filtered_snapshot":"directory_snapshot",plan={copy_scope:scope,source_directory:source,destination_directory:destination,files:0,bytes:0,directories:0,symlinks:0,other_entries:0,scanned_entries:0,excluded_entries:0,development_entries:0,complete:!0,stop_reason:"complete",max_entries:maxEntries,max_depth:maxDepth};return scope==="in_place"||await scanExtensionCopyDirectory(source,0,plan,signal),plan}async function scanExtensionCopyDirectory(directory,depth,plan,signal){signal?.throwIfAborted();const handle=await fs.opendir(directory);for await(const entry of handle){if(signal?.throwIfAborted(),plan.scanned_entries>=plan.max_entries){plan.complete=!1,plan.stop_reason="entry_limit";return}plan.scanned_entries+=1;const candidate=path.join(directory,entry.name);if(!includesExtensionCopyPath(plan.source_directory,plan.destination_directory,candidate,plan.copy_scope==="nested_filtered_snapshot")){plan.excluded_entries+=1;continue}if(path.relative(plan.source_directory,candidate).split(path.sep).some(segment=>DEVELOPMENT_DIRECTORIES.has(segment))&&(plan.development_entries+=1),await countExtensionCopyEntry(candidate,depth,plan,signal),!plan.complete)return}}async function countExtensionCopyEntry(candidate,depth,plan,signal){const stat=await fs.lstat(candidate);if(signal?.throwIfAborted(),stat.isDirectory()){if(plan.directories+=1,depth+1>=plan.max_depth){plan.complete=!1,plan.stop_reason="depth_limit";return}await scanExtensionCopyDirectory(candidate,depth+1,plan,signal)}else stat.isFile()?(plan.files+=1,plan.bytes+=stat.size):stat.isSymbolicLink()?plan.symlinks+=1:plan.other_entries+=1}export{buildExtensionInstallPlan,planExtensionDirectoryCopy};
1
+ import p from"node:fs/promises";import l from"node:path";import{isPathWithinDirectory as y}from"../../core/fs/path-utils.js";import{PmCliError as f}from"../../core/shared/errors.js";import{EXIT_CODE as h}from"../../core/shared/constants.js";import{includesExtensionCopyPath as w}from"./copy-scope.js";import{resolveCanonicalExtensionInstallDestination as x}from"./install-runtime.js";import{pathExists as k}from"../../core/fs/fs-utils.js";import{areDirectoriesEquivalent as E}from"./install-sources.js";const b=new Set(["node_modules",".git","dist","build","coverage"]);async function L(o,a,e,r){const i=o.source.kind==="local"?await p.stat(o.source.absolute_path):void 0,s=o.source.kind==="local"?i.isDirectory()?"directory":"archive":o.source.kind,t=await v(o.directory,a,r),n={source_mode:s,...s==="archive"?{archive_bytes:i.size}:{},copy:t},c=o.source_root??o.directory;if(s==="directory"&&(!t.complete||t.development_entries>0||t.bytes>=16*1024*1024)&&await k(l.join(c,"package.json"))&&(n.packed_alternative={cwd:c,pack:{command:"npm",args:["pack","--ignore-scripts","--json"]},install:{command:"pm",args:["package","install","<archive-filename>",`--${e}`]},archive_argument:"pack_result[0].filename"}),s==="directory"&&!t.complete){const m=t.stop_reason==="entry_limit"?`${t.max_entries} entries`:`${t.max_depth} directory levels`;throw new f(`Local extension source scan stopped at ${m}; the directory snapshot is incomplete and installation was refused. ${n.packed_alternative?"Pack the package with npm pack --ignore-scripts --json, then install its archive.":"Install a smaller source directory or a packed archive."}`,h.USAGE,{code:"extension_install_incomplete_source_scan",reason:t.stop_reason,nextSteps:n.packed_alternative?[`Run npm pack --ignore-scripts --json from the package root, then pm package install <archive-filename> --${e}.`]:["Choose a smaller source directory or install a packed archive."]})}return n}async function v(o,a,e={}){const{maxEntries:r=1e4,maxDepth:i=64,signal:s}=e;if(![r,i].every(_=>Number.isSafeInteger(_)&&_>0))throw new f("maxEntries and maxDepth must be positive safe integers.",h.USAGE);s?.throwIfAborted();const t=await p.realpath(o),n=await x(a),c=await E(t,n);s?.throwIfAborted();const m=c?"in_place":y(t,n)?"nested_filtered_snapshot":"directory_snapshot",d={copy_scope:m,source_directory:t,destination_directory:n,files:0,bytes:0,directories:0,symlinks:0,other_entries:0,scanned_entries:0,excluded_entries:0,development_entries:0,complete:!0,stop_reason:"complete",max_entries:r,max_depth:i};return m==="in_place"||await u(t,0,d,s),d}async function u(o,a,e,r){r?.throwIfAborted();const i=await p.opendir(o);for await(const s of i){if(r?.throwIfAborted(),e.scanned_entries>=e.max_entries){e.complete=!1,e.stop_reason="entry_limit";return}e.scanned_entries+=1;const t=l.join(o,s.name);if(!w(e.source_directory,e.destination_directory,t,e.copy_scope==="nested_filtered_snapshot")){e.excluded_entries+=1;continue}if(l.relative(e.source_directory,t).split(l.sep).some(n=>b.has(n))&&(e.development_entries+=1),await g(t,a,e,r),!e.complete)return}}async function g(o,a,e,r){const i=await p.lstat(o);if(r?.throwIfAborted(),i.isDirectory()){if(e.directories+=1,a+1>=e.max_depth){e.complete=!1,e.stop_reason="depth_limit";return}await u(o,a+1,e,r)}else i.isFile()?(e.files+=1,e.bytes+=i.size):i.isSymbolicLink()?e.symlinks+=1:e.other_entries+=1}export{L as buildExtensionInstallPlan,v as planExtensionDirectoryCopy};
2
2
  //# sourceMappingURL=install-plan.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="17cca82e-e9f9-5633-8d91-bc6c2b560d5f")}catch{}})();function buildBundledInstallReceipt(packages,dryRun){const succeeded=packages.filter(entry=>entry.result.ok).length;return{installed_all:!dryRun&&succeeded===packages.length,installed_count:dryRun?0:succeeded,...dryRun?{dry_run:!0,planned_count:succeeded}:{},failed_count:packages.length-succeeded,packages:packages.map(({alias,result})=>{const details=result.details;return{alias,ok:result.ok,extension:details.extension,source:details.source,source_resolution:details.source_resolution,install_plan:details.install_plan,dry_run:details.dry_run,destination_path:details.destination_path,activated:details.activated,settings_changed:details.settings_changed,previous_state_preserved:details.previous_state_preserved,rollback:details.rollback,command_paths:details.command_paths,action_paths:details.action_paths,command_discovery:details.command_discovery,verification:details.verification,runtime_activation_status:details.runtime_activation_status,activation_diagnostics:details.activation_diagnostics,warnings:result.warnings}})}}export{buildBundledInstallReceipt};
1
+ function o(n,i){const e=n.filter(a=>a.result.ok).length;return{installed_all:!i&&e===n.length,installed_count:i?0:e,...i?{dry_run:!0,planned_count:e}:{},failed_count:n.length-e,packages:n.map(({alias:a,result:s})=>{const t=s.details;return{alias:a,ok:s.ok,extension:t.extension,source:t.source,source_resolution:t.source_resolution,install_plan:t.install_plan,dry_run:t.dry_run,destination_path:t.destination_path,activated:t.activated,settings_changed:t.settings_changed,previous_state_preserved:t.previous_state_preserved,rollback:t.rollback,command_paths:t.command_paths,action_paths:t.action_paths,command_discovery:t.command_discovery,verification:t.verification,runtime_activation_status:t.runtime_activation_status,activation_diagnostics:t.activation_diagnostics,warnings:s.warnings}})}}export{o as buildBundledInstallReceipt};
2
2
  //# sourceMappingURL=install-receipts.js.map
@@ -1,4 +1,4 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cefb224d-a18f-599a-9cf9-3d3a22616440")}catch{}})();import{withHostEnvironmentBoundary}from"../../core/fs/host-environment-errors.js";import{includesExtensionCopyPath}from"./copy-scope.js";import{randomUUID}from"node:crypto";import fs from"node:fs/promises";import os from"node:os";import path from"node:path";import{isFileAbsentError,pathExists}from"../../core/fs/fs-utils.js";import{isPathWithinDirectory}from"../../core/fs/path-utils.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{PmCliError}from"../../core/shared/errors.js";import{resolvePmPackageRootFromModule}from"../../core/packages/root.js";import{nowIso}from"../../core/shared/time.js";const EXTENSION_INSTALL_COPY_ATTEMPTS=3,EXTENSION_INSTALL_LOCK_ATTEMPTS=120,EXTENSION_INSTALL_LOCK_DELAY_MS=250,EXTENSION_INSTALL_LOCK_STALE_MS=12e4,RETRIABLE_EXTENSION_INSTALL_COPY_CODES=new Set(["EEXIST","ENOTEMPTY","ENOENT"]),errnoCode=error=>typeof error=="object"&&error!==null&&"code"in error?error.code:void 0,isRetriableExtensionInstallCopyError=error=>RETRIABLE_EXTENSION_INSTALL_COPY_CODES.has(String(errnoCode(error))),isErrnoCode=(error,code)=>errnoCode(error)===code,sleep=ms=>new Promise(resolve=>{setTimeout(resolve,ms)}),ensureExtensionModuleTypeMarker=async destinationDirectory=>{const markerPath=path.join(destinationDirectory,"package.json");await pathExists(markerPath)||await fs.writeFile(markerPath,`${JSON.stringify({type:"module"},null,2)}
2
- `,"utf8")},ensureInstalledExtensionSdkLink=async destinationDirectory=>{const hostPackageRoot=resolvePmPackageRootFromModule(import.meta.url,["../../.."]),scopedDirectory=path.join(destinationDirectory,"node_modules","@unbrained"),linkPath=path.join(scopedDirectory,"pm-cli");await fs.mkdir(scopedDirectory,{recursive:!0}),await fs.rm(linkPath,{recursive:!0,force:!0}),await fs.symlink(hostPackageRoot,linkPath,process.platform==="win32"?"junction":"dir")},resolveCanonicalExtensionInstallDestination=async destinationDirectory=>{const resolvedDestination=path.resolve(destinationDirectory),destinationParent=path.dirname(resolvedDestination),destinationRoot=path.parse(destinationParent).root;let canonicalDestinationParent=await fs.realpath(destinationRoot).catch(()=>destinationRoot);const relativeDestinationParent=path.relative(destinationRoot,destinationParent),destinationSegments=relativeDestinationParent===""?[]:relativeDestinationParent.split(path.sep);for(const[index,segment]of destinationSegments.entries()){const candidate=path.join(canonicalDestinationParent,segment);try{canonicalDestinationParent=await fs.realpath(candidate)}catch{canonicalDestinationParent=path.join(canonicalDestinationParent,...destinationSegments.slice(index));break}}return path.join(canonicalDestinationParent,path.basename(resolvedDestination))},copyExtensionDirectoryWithoutSelfNesting=async(sourceDirectory,destinationDirectory,copyDirectory,temporaryDirectory=os.tmpdir())=>withHostEnvironmentBoundary("extension_install_copy",async()=>{const resolvedSource=path.resolve(sourceDirectory),canonicalSource=await fs.realpath(resolvedSource).catch(()=>resolvedSource),canonicalDestination=await resolveCanonicalExtensionInstallDestination(destinationDirectory);if(canonicalSource===canonicalDestination)return;if(!isPathWithinDirectory(canonicalSource,canonicalDestination)){await copyDirectory(canonicalSource,destinationDirectory,{recursive:!0,force:!0,filter:sourcePath=>includesExtensionCopyPath(canonicalSource,canonicalDestination,path.resolve(sourcePath),!1)});return}const systemTempDirectory=await fs.realpath(path.resolve(temporaryDirectory)).catch(()=>resolveCanonicalExtensionInstallDestination(temporaryDirectory)),stagingBase=isPathWithinDirectory(canonicalSource,systemTempDirectory)?path.dirname(canonicalSource):systemTempDirectory;if(isPathWithinDirectory(canonicalSource,stagingBase))throw new PmCliError(`Extension source "${sourceDirectory}" contains its install destination and no external staging directory is available. Install a narrower package directory instead.`,EXIT_CODE.USAGE,{code:"extension_install_source_contains_destination"});const stagingRoot=await fs.mkdtemp(path.join(stagingBase,"pm-extension-copy-")),stagedDirectory=path.join(stagingRoot,"extension");try{await copyDirectory(canonicalSource,stagedDirectory,{recursive:!0,force:!0,filter:sourcePath=>includesExtensionCopyPath(canonicalSource,canonicalDestination,path.resolve(sourcePath),!0)}),await copyDirectory(stagedDirectory,destinationDirectory,{recursive:!0,force:!0})}finally{await fs.rm(stagingRoot,{recursive:!0,force:!0})}}),copyExtensionDirectoryForInstall=async(sourceDirectory,destinationDirectory,copyDirectory=fs.cp)=>{for(let attempt=1;attempt<=EXTENSION_INSTALL_COPY_ATTEMPTS;attempt+=1)try{await withHostEnvironmentBoundary("extension_install_copy",async()=>{await fs.rm(destinationDirectory,{recursive:!0,force:!0}),await copyExtensionDirectoryWithoutSelfNesting(sourceDirectory,destinationDirectory,copyDirectory)});return}catch(error){if(!isRetriableExtensionInstallCopyError(error)||attempt===EXTENSION_INSTALL_COPY_ATTEMPTS)throw error;await sleep(EXTENSION_INSTALL_LOCK_DELAY_MS)}},readExtensionInstallLockOwnerToken=async lockPath=>{let ownerContents;try{ownerContents=await fs.readFile(path.join(lockPath,"owner.json"),"utf8")}catch(error){if(!isFileAbsentError(error))throw error;return null}let parsed;try{parsed=JSON.parse(ownerContents)}catch{return null}if(typeof parsed!="object"||parsed===null||!("token"in parsed))return null;const token=parsed.token;return typeof token=="string"&&token.length>0?token:null},removeExtensionInstallLockIfOwned=async(lockPath,ownerToken)=>await readExtensionInstallLockOwnerToken(lockPath)!==ownerToken?!1:(await fs.rm(lockPath,{recursive:!0,force:!0}),!0),reclaimStaleExtensionInstallLock=async(lockPath,staleMs)=>{let stat;try{stat=await fs.stat(lockPath)}catch{return!1}if(Date.now()-stat.mtimeMs<=staleMs)return!1;const staleOwnerToken=await readExtensionInstallLockOwnerToken(lockPath);return staleOwnerToken===null?(await fs.rm(lockPath,{recursive:!0,force:!0}),!0):removeExtensionInstallLockIfOwned(lockPath,staleOwnerToken)},startExtensionInstallLockHeartbeat=(lockPath,ownerToken,intervalMs)=>{let heartbeat=Promise.resolve();const timer=setInterval(()=>{heartbeat=heartbeat.then(async()=>{if(await readExtensionInstallLockOwnerToken(lockPath)!==ownerToken)return;const heartbeatAt=new Date;await fs.utimes(lockPath,heartbeatAt,heartbeatAt)}).catch(()=>{})},intervalMs);return timer.unref(),async()=>{clearInterval(timer),await heartbeat}},createExtensionInstallLock=async(lockPath,owner)=>{await fs.mkdir(lockPath);try{await fs.writeFile(path.join(lockPath,"owner.json"),`${JSON.stringify(owner,null,2)}
3
- `,"utf8")}catch(error){throw await fs.rm(lockPath,{recursive:!0,force:!0}).catch(()=>{}),error}},acquireExtensionInstallLock=async(lockPath,owner,attempts,delayMs,staleMs)=>{for(let attempt=1;attempt<=attempts;attempt+=1)try{return await createExtensionInstallLock(lockPath,owner),!0}catch(error){if(!isErrnoCode(error,"EEXIST"))throw error;await reclaimStaleExtensionInstallLock(lockPath,staleMs)?attempt-=1:await sleep(delayMs)}return!1},withExtensionInstallLock=async(settingsRoot,destinationDirectoryName,run,options)=>withHostEnvironmentBoundary("extension_install",async()=>{const lockRoot=path.join(settingsRoot,"runtime","extension-install-locks"),lockPath=path.join(lockRoot,"scope.lock");await fs.mkdir(lockRoot,{recursive:!0});const{attempts:rawAttempts=EXTENSION_INSTALL_LOCK_ATTEMPTS,delay_ms:rawDelayMs=EXTENSION_INSTALL_LOCK_DELAY_MS,stale_ms:rawStaleMs=EXTENSION_INSTALL_LOCK_STALE_MS,heartbeat_ms:rawHeartbeatMs}=options??{};if(![rawAttempts,rawDelayMs,rawStaleMs,rawHeartbeatMs].filter(value=>value!==void 0).every(Number.isFinite))throw new PmCliError("Extension install lock timings must be finite numbers.",EXIT_CODE.USAGE);const attempts=Math.max(1,Math.floor(rawAttempts)),delayMs=Math.max(0,Math.floor(rawDelayMs)),staleMs=Math.floor(rawStaleMs),heartbeatMs=Math.floor(rawHeartbeatMs??staleMs/3);if(staleMs<=0||heartbeatMs<=0||heartbeatMs>=staleMs)throw new PmCliError("Extension install lock timings require stale_ms > 0 and 0 < heartbeat_ms < stale_ms.",EXIT_CODE.USAGE);const owner={pid:process.pid,token:randomUUID(),created_at:nowIso(),destination:destinationDirectoryName};if(!await acquireExtensionInstallLock(lockPath,owner,attempts,delayMs,staleMs))throw new PmCliError(`Timed out waiting for extension install lock for "${destinationDirectoryName}".`,EXIT_CODE.CONFLICT);const stopHeartbeat=startExtensionInstallLockHeartbeat(lockPath,owner.token,heartbeatMs);let operationSucceeded=!1;try{const result=await run();return operationSucceeded=!0,result}finally{await stopHeartbeat(),await removeExtensionInstallLockIfOwned(lockPath,owner.token).catch(error=>{if(operationSucceeded)throw error})}});export{copyExtensionDirectoryForInstall,copyExtensionDirectoryWithoutSelfNesting,ensureExtensionModuleTypeMarker,ensureInstalledExtensionSdkLink,isErrnoCode,isRetriableExtensionInstallCopyError,resolveCanonicalExtensionInstallDestination,withExtensionInstallLock};
1
+ import{withHostEnvironmentBoundary as _}from"../../core/fs/host-environment-errors.js";import{includesExtensionCopyPath as k}from"./copy-scope.js";import{randomUUID as j}from"node:crypto";import i from"node:fs/promises";import A from"node:os";import a from"node:path";import{isFileAbsentError as C,pathExists as P}from"../../core/fs/fs-utils.js";import{isPathWithinDirectory as S}from"../../core/fs/path-utils.js";import{EXIT_CODE as E}from"../../core/shared/constants.js";import{PmCliError as y}from"../../core/shared/errors.js";import{resolvePmPackageRootFromModule as D}from"../../core/packages/root.js";import{nowIso as F}from"../../core/shared/time.js";const v=3,R=120,L=250,X=12e4,U=new Set(["EEXIST","ENOTEMPTY","ENOENT"]),N=t=>typeof t=="object"&&t!==null&&"code"in t?t.code:void 0,q=t=>U.has(String(N(t))),H=(t,e)=>N(t)===e,O=t=>new Promise(e=>{setTimeout(e,t)}),it=async t=>{const e=a.join(t,"package.json");await P(e)||await i.writeFile(e,`${JSON.stringify({type:"module"},null,2)}
2
+ `,"utf8")},ct=async t=>{const e=D(import.meta.url,["../../.."]),n=a.join(t,"node_modules","@unbrained"),r=a.join(n,"pm-cli");await i.mkdir(n,{recursive:!0}),await i.rm(r,{recursive:!0,force:!0}),await i.symlink(e,r,process.platform==="win32"?"junction":"dir")},g=async t=>{const e=a.resolve(t),n=a.dirname(e),r=a.parse(n).root;let s=await i.realpath(r).catch(()=>r);const o=a.relative(r,n),c=o===""?[]:o.split(a.sep);for(const[l,u]of c.entries()){const m=a.join(s,u);try{s=await i.realpath(m)}catch{s=a.join(s,...c.slice(l));break}}return a.join(s,a.basename(e))},Y=async(t,e,n,r=A.tmpdir())=>_("extension_install_copy",async()=>{const s=a.resolve(t),o=await i.realpath(s).catch(()=>s),c=await g(e);if(o===c)return;if(!S(o,c)){await n(o,e,{recursive:!0,force:!0,filter:w=>k(o,c,a.resolve(w),!1)});return}const l=await i.realpath(a.resolve(r)).catch(()=>g(r)),u=S(o,l)?a.dirname(o):l;if(S(o,u))throw new y(`Extension source "${t}" contains its install destination and no external staging directory is available. Install a narrower package directory instead.`,E.USAGE,{code:"extension_install_source_contains_destination"});const m=await i.mkdtemp(a.join(u,"pm-extension-copy-")),p=a.join(m,"extension");try{await n(o,p,{recursive:!0,force:!0,filter:w=>k(o,c,a.resolve(w),!0)}),await n(p,e,{recursive:!0,force:!0})}finally{await i.rm(m,{recursive:!0,force:!0})}}),lt=async(t,e,n=i.cp)=>{for(let r=1;r<=v;r+=1)try{await _("extension_install_copy",async()=>{await i.rm(e,{recursive:!0,force:!0}),await Y(t,e,n)});return}catch(s){if(!q(s)||r===v)throw s;await O(L)}},T=async t=>{let e;try{e=await i.readFile(a.join(t,"owner.json"),"utf8")}catch(s){if(!C(s))throw s;return null}let n;try{n=JSON.parse(e)}catch{return null}if(typeof n!="object"||n===null||!("token"in n))return null;const r=n.token;return typeof r=="string"&&r.length>0?r:null},M=async(t,e)=>await T(t)!==e?!1:(await i.rm(t,{recursive:!0,force:!0}),!0),$=async(t,e)=>{let n;try{n=await i.stat(t)}catch{return!1}if(Date.now()-n.mtimeMs<=e)return!1;const r=await T(t);return r===null?(await i.rm(t,{recursive:!0,force:!0}),!0):M(t,r)},B=(t,e,n)=>{let r=Promise.resolve();const s=setInterval(()=>{r=r.then(async()=>{if(await T(t)!==e)return;const o=new Date;await i.utimes(t,o,o)}).catch(()=>{})},n);return s.unref(),async()=>{clearInterval(s),await r}},G=async(t,e)=>{await i.mkdir(t);try{await i.writeFile(a.join(t,"owner.json"),`${JSON.stringify(e,null,2)}
3
+ `,"utf8")}catch(n){throw await i.rm(t,{recursive:!0,force:!0}).catch(()=>{}),n}},J=async(t,e,n,r,s)=>{for(let o=1;o<=n;o+=1)try{return await G(t,e),!0}catch(c){if(!H(c,"EEXIST"))throw c;await $(t,s)?o-=1:await O(r)}return!1},ut=async(t,e,n,r)=>_("extension_install",async()=>{const s=a.join(t,"runtime","extension-install-locks"),o=a.join(s,"scope.lock");await i.mkdir(s,{recursive:!0});const{attempts:c=R,delay_ms:l=L,stale_ms:u=X,heartbeat_ms:m}=r??{};if(![c,l,u,m].filter(f=>f!==void 0).every(Number.isFinite))throw new y("Extension install lock timings must be finite numbers.",E.USAGE);const p=Math.max(1,Math.floor(c)),w=Math.max(0,Math.floor(l)),d=Math.floor(u),h=Math.floor(m??d/3);if(d<=0||h<=0||h>=d)throw new y("Extension install lock timings require stale_ms > 0 and 0 < heartbeat_ms < stale_ms.",E.USAGE);const x={pid:process.pid,token:j(),created_at:F(),destination:e};if(!await J(o,x,p,w,d))throw new y(`Timed out waiting for extension install lock for "${e}".`,E.CONFLICT);const b=B(o,x.token,h);let I=!1;try{const f=await n();return I=!0,f}finally{await b(),await M(o,x.token).catch(f=>{if(I)throw f})}});export{lt as copyExtensionDirectoryForInstall,Y as copyExtensionDirectoryWithoutSelfNesting,it as ensureExtensionModuleTypeMarker,ct as ensureInstalledExtensionSdkLink,H as isErrnoCode,q as isRetriableExtensionInstallCopyError,g as resolveCanonicalExtensionInstallDestination,ut as withExtensionInstallLock};
4
4
  //# sourceMappingURL=install-runtime.js.map