@unbrained/pm-cli 2026.10.10 → 2026.10.12

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 (180) hide show
  1. package/.claude-plugin/marketplace.json +1 -36
  2. package/CHANGELOG.md +31 -4
  3. package/dist/cli/commander-usage.d.ts +5 -5
  4. package/dist/cli/commander-usage.js +3 -3
  5. package/dist/cli/error-guidance.d.ts +2 -0
  6. package/dist/cli/error-guidance.js +2 -2
  7. package/dist/cli/help-json-payload.js +1 -1
  8. package/dist/cli/main.d.ts +1 -0
  9. package/dist/cli/main.js +4 -4
  10. package/dist/cli/register-operations.d.ts +9 -4
  11. package/dist/cli/register-operations.js +1 -1
  12. package/dist/cli-bundle/bundle-manifest.json +1 -382
  13. package/dist/cli-bundle/chunks/{chunk-2JYTSTQP.js → chunk-3LQTJN4J.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-YMLF6QT7.js → chunk-6PZPUJW3.js} +28 -28
  15. package/dist/cli-bundle/chunks/{chunk-RUT3CCAG.js → chunk-B465HPS5.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-ESRACL6K.js → chunk-DT3KUUKY.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-SSY4OSJR.js → chunk-GUVKPOY6.js} +2 -2
  18. package/dist/cli-bundle/chunks/chunk-ILQEZ4Y6.js +2 -0
  19. package/dist/cli-bundle/chunks/{chunk-RBPOO46D.js → chunk-JRRXWH5B.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-MEWBSWE3.js → chunk-LH5QDBMN.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-KNW3RSLS.js → chunk-M5NDSW6E.js} +30 -30
  22. package/dist/cli-bundle/chunks/{chunk-K2UTE75T.js → chunk-MHPU2LDF.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-OBLO45UM.js → chunk-QM3M7GB5.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-S445XEYT.js → chunk-UABZJXIS.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-ZWRLAOA4.js → chunk-X2I2EEAS.js} +2 -2
  26. package/dist/cli-bundle/chunks/{register-list-query-T6BOR67M.js → register-list-query-OR33UEML.js} +2 -2
  27. package/dist/cli-bundle/chunks/{register-mutation-6NXR7SAJ.js → register-mutation-R34EJ3NH.js} +2 -2
  28. package/dist/cli-bundle/chunks/register-operations-UHSMEHSF.js +2 -0
  29. package/dist/cli-bundle/chunks/{register-setup-MAYFPKBX.js → register-setup-5E3PT22L.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-SIEGIPNT.js → chunk-7QIZB2F2.js} +7 -7
  31. package/dist/cli-bundle/focused-chunks/{chunk-PLTTMQAW.js → chunk-AJG3DBXR.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-AXBO53EQ.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-W5AE7GKZ.js → chunk-CYEZLKLL.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-PBCYGO7X.js → chunk-FXRWJEQ5.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-GVGFUD52.js → chunk-IKJFAU32.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-DMSADMEU.js → chunk-OGOLIS5R.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-PPH5N26M.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-WAOXID5J.js → chunk-RNAWRTQV.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-B3YW6H2I.js → chunk-RZVNGUT7.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-52UJEHEV.js → chunk-SV6YYZLR.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-EIOQNLBQ.js → chunk-TS46OZD5.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-KNJR2WUO.js → chunk-VBTLX5SN.js} +62 -62
  43. package/dist/cli-bundle/focused-chunks/{chunk-JGFSSR3G.js → chunk-YCOJLIDI.js} +3 -3
  44. package/dist/cli-bundle/focused-chunks/chunk-YDJT33JU.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-AU6VJGTY.js → chunk-Z4T3637Y.js} +2 -2
  46. package/dist/cli-bundle/main.js +22 -22
  47. package/dist/cli-bundle/sdk-authoring.js +1 -1
  48. package/dist/cli-bundle/sdk-contracts.js +1 -1
  49. package/dist/cli-bundle/sdk-core.js +31 -31
  50. package/dist/cli-bundle/sdk-governance.js +1 -1
  51. package/dist/cli-bundle/sdk-graph.js +1 -1
  52. package/dist/cli-bundle/sdk-merge.js +24 -24
  53. package/dist/cli-bundle/sdk-query.js +1 -1
  54. package/dist/cli-bundle/sdk-runtime.js +1 -1
  55. package/dist/cli-bundle/sdk-testing.js +1 -1
  56. package/dist/cli-bundle/sdk.js +9 -9
  57. package/dist/core/history/event-classification.d.ts +1 -1
  58. package/dist/core/history/event-classification.js +1 -1
  59. package/dist/core/item/item-format.d.ts +2 -0
  60. package/dist/core/item/item-format.js +2 -2
  61. package/dist/core/telemetry/runtime.d.ts +1 -1
  62. package/dist/core/telemetry/runtime.js +2 -2
  63. package/dist/core/test/background-runs.d.ts +1 -0
  64. package/dist/core/test/background-runs.js +2 -2
  65. package/dist/sdk/agent/command-suggestions.d.ts +2 -0
  66. package/dist/sdk/agent/command-suggestions.js +1 -1
  67. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  68. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  69. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  70. package/dist/sdk/cli-contracts/registration-helpers.d.ts +1 -4
  71. package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
  72. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  73. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  74. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  75. package/dist/sdk/core.d.ts +1 -0
  76. package/dist/sdk/core.js +1 -1
  77. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  78. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  79. package/dist/sdk/governance/artifact-ledgers.d.ts +59 -0
  80. package/dist/sdk/governance/artifact-ledgers.js +2 -0
  81. package/dist/sdk/governance.d.ts +1 -0
  82. package/dist/sdk/governance.js +1 -1
  83. package/dist/sdk/index.d.ts +2 -0
  84. package/dist/sdk/index.js +1 -1
  85. package/dist/sdk/public-surface.json +1 -1
  86. package/dist/sdk/test/batch.js +1 -1
  87. package/dist/sdk/test/command-args.d.ts +4 -0
  88. package/dist/sdk/test/command-args.js +2 -0
  89. package/dist/sdk/test/entry.d.ts +3 -0
  90. package/dist/sdk/test/entry.js +1 -1
  91. package/dist/sdk/test/execution.d.ts +15 -4
  92. package/dist/sdk/test/execution.js +2 -2
  93. package/dist/sdk/test/prerequisites.d.ts +6 -0
  94. package/dist/sdk/test/prerequisites.js +2 -0
  95. package/dist/sdk/test/trust.js +1 -1
  96. package/dist/sdk/test/update.d.ts +55 -0
  97. package/dist/sdk/test/update.js +2 -0
  98. package/dist/types.d.ts +4 -0
  99. package/dist/types.js +1 -1
  100. package/docs/LINKED_TEST_EDITS.md +79 -0
  101. package/docs/RELEASE_LEDGER_RECONCILIATION.md +148 -0
  102. package/docs/RELEASE_RELIABILITY.md +4 -0
  103. package/docs/RELEASING.md +53 -13
  104. package/docs/SDK.md +178 -636
  105. package/docs/SDK_EVIDENCE_TRACEABILITY.md +4 -0
  106. package/docs/TESTING.md +13 -0
  107. package/docs/agent-task-token-baseline.json +1 -292
  108. package/docs/agent-task-transcripts.json +1 -478
  109. package/docs/ecosystem-review-2026-09-28.json +1 -2866
  110. package/docs/examples/policy-restricted-extension/manifest.json +1 -22
  111. package/docs/examples/policy-restricted-extension/package.json +1 -8
  112. package/docs/examples/sdk-agent-environment/package.json +1 -8
  113. package/docs/examples/sdk-app-embedding/package.json +1 -9
  114. package/docs/examples/sdk-contract-consumer/package.json +1 -11
  115. package/docs/examples/sdk-custom-tool/package.json +1 -13
  116. package/docs/examples/starter-extension/manifest.json +1 -33
  117. package/docs/examples/starter-extension/package.json +1 -10
  118. package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
  119. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +8 -3
  120. package/docs/performance/corpus-shape-comparison.json +1 -108
  121. package/docs/performance/latest-scale-report.json +1 -418
  122. package/docs/performance/runner-qualification.md +36 -0
  123. package/docs/performance/scale-100k-report.json +1 -418
  124. package/docs/schemas/extension-manifest.schema.json +1 -165
  125. package/marketplace.json +1 -36
  126. package/package.json +1 -1
  127. package/packages/pm-beads/extensions/beads/manifest.json +1 -28
  128. package/packages/pm-beads/extensions/beads/package.json +1 -3
  129. package/packages/pm-beads/package.json +1 -50
  130. package/packages/pm-calendar/extensions/calendar/manifest.json +1 -22
  131. package/packages/pm-calendar/extensions/calendar/package.json +1 -3
  132. package/packages/pm-calendar/package.json +1 -51
  133. package/packages/pm-command-kit/extensions/command-kit/manifest.json +1 -22
  134. package/packages/pm-command-kit/extensions/command-kit/package.json +1 -3
  135. package/packages/pm-command-kit/package.json +1 -53
  136. package/packages/pm-digital-twin/extensions/digital-twin/manifest.json +1 -19
  137. package/packages/pm-digital-twin/extensions/digital-twin/package.json +1 -3
  138. package/packages/pm-digital-twin/package.json +1 -58
  139. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +1 -19
  140. package/packages/pm-governance-audit/extensions/governance-audit/package.json +1 -3
  141. package/packages/pm-governance-audit/package.json +1 -55
  142. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +1 -22
  143. package/packages/pm-guide-shell/extensions/guide-shell/package.json +1 -3
  144. package/packages/pm-guide-shell/package.json +1 -52
  145. package/packages/pm-kanban/extensions/kanban/manifest.json +1 -19
  146. package/packages/pm-kanban/extensions/kanban/package.json +1 -3
  147. package/packages/pm-kanban/package.json +1 -57
  148. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +1 -19
  149. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/package.json +1 -3
  150. package/packages/pm-lifecycle-hooks/package.json +1 -52
  151. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +1 -29
  152. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/package.json +1 -3
  153. package/packages/pm-linked-test-adapters/package.json +1 -53
  154. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +1 -29
  155. package/packages/pm-search-advanced/extensions/search-advanced/package.json +1 -3
  156. package/packages/pm-search-advanced/package.json +1 -54
  157. package/packages/pm-templates/extensions/templates/manifest.json +1 -22
  158. package/packages/pm-templates/extensions/templates/package.json +1 -3
  159. package/packages/pm-templates/package.json +1 -50
  160. package/packages/pm-todos/extensions/todos/manifest.json +1 -29
  161. package/packages/pm-todos/extensions/todos/package.json +1 -3
  162. package/packages/pm-todos/package.json +1 -51
  163. package/packages/pm-vcs/extensions/vcs/manifest.json +1 -19
  164. package/packages/pm-vcs/extensions/vcs/package.json +1 -3
  165. package/packages/pm-vcs/package.json +1 -55
  166. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -25
  167. package/plugins/pm-claude/.mcp.json +1 -8
  168. package/plugins/pm-claude/hooks/hooks.json +1 -17
  169. package/plugins/pm-claude/package.json +1 -9
  170. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -45
  171. package/plugins/pm-codex/.mcp.json +1 -11
  172. package/plugins/pm-codex/mcp.json +1 -11
  173. package/plugins/pm-codex/package.json +1 -9
  174. package/plugins/pm-codex/plugin.json +1 -45
  175. package/runtime-dependencies.json +1 -512
  176. package/dist/cli-bundle/chunks/chunk-BXSXT5Z6.js +0 -2
  177. package/dist/cli-bundle/chunks/register-operations-PDOBQZUJ.js +0 -2
  178. package/dist/cli-bundle/focused-chunks/chunk-2CJWTLQG.js +0 -2
  179. package/dist/cli-bundle/focused-chunks/chunk-MJQ253F3.js +0 -2
  180. package/dist/cli-bundle/focused-chunks/chunk-WOEZJUA2.js +0 -2
@@ -1,8 +1,8 @@
1
- import{M as fe,Ta as pe,i as se}from"./chunk-ESRACL6K.js";import{Qa as le,o as R}from"./chunk-SSY4OSJR.js";import{$b as Y,E as C,El as de,Fl as me,Gl as ce,Kb as L,Ni as ae,Ob as H,Pb as K,Sb as q,Tb as U,Xb as V,Yb as z,Zb as W,_b as G,ac as X,bc as J,cc as Q,dc as Z,ec as ee,fc as re,gc as te,mc as ne,nc as oe,oa as w,pa as B,tb as v,tc as ie,xb as x,yb as D}from"./chunk-YMLF6QT7.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="52f6eff3-e226-56d9-893a-f16997d11c50")}catch{}})();function Ir(r){return r}function Mr(r){return r}function Ce(r,e){for(let t of e.commands??[])r.registerCommand(t);for(let[t,n]of Object.entries(e.commandOverrides??{}))r.registerCommand(t,n);for(let[t,n]of Object.entries(e.flags??{}))r.registerFlags(t,n);for(let[t,n]of Object.entries(e.parsers??{}))r.registerParser(t,n);for(let[t,n]of Object.entries(e.renderers??{}))if(typeof n=="function")r.registerRenderer(t,n);else{let{run:a,...i}=n;r.registerRenderer(t,a,i)}for(let[t,n]of Object.entries(e.services??{}))r.registerService(t,n)}function Re(r,e){for(let i of e.preflights??[])r.registerPreflight(i);let t=e.itemTypes??[];t.length>0&&r.registerItemTypes(t);let n=e.itemFields??[];n.length>0&&r.registerItemFields(n);let a=e.relationshipKinds??[];a.length>0&&r.registerRelationshipKinds(a);for(let i of e.migrations??[])r.registerMigration(i);for(let i of e.profiles??[])r.registerProfile(i)}function Ne(r,e){for(let t of e.searchProviders??[])r.registerSearchProvider(t);for(let t of e.vectorStoreAdapters??[])r.registerVectorStoreAdapter(t);for(let t of e.assuranceProviders??[])r.registerAssuranceMeasurementProvider(t);for(let t of e.importers??[])r.registerImporter(t.name,t.importer,t.options);for(let t of e.exporters??[])r.registerExporter(t.name,t.exporter,t.options)}function Se(r,e){for(let t of e.beforeCommand??[])r.hooks.beforeCommand(t);for(let t of e.beforeMutation??[])r.hooks.beforeMutation(t);for(let t of e.afterCommand??[])r.hooks.afterCommand(t);for(let t of e.onWrite??[])r.hooks.onWrite(t);for(let t of e.onRead??[])r.hooks.onRead(t);for(let t of e.onIndex??[])r.hooks.onIndex(t)}function Oe(r){let e={activate:async t=>{Ce(t,r),Re(t,r),Ne(t,r),Se(t,r.hooks??{}),await r.activate?.(t)}};return r.manifest&&(e.manifest=r.manifest),r.deactivate&&(e.deactivate=r.deactivate),e}function h(r){let e=r.flatMap(t=>t??[]);return e.length>0?e:void 0}function _(r){let e=Object.assign({},...r.map(t=>t??{}));return Object.keys(e).length>0?e:void 0}function Ae(r){let e={};for(let t of r)for(let[n,a]of Object.entries(t??{}))e[n]=[...e[n]??[],...a];return Object.keys(e).length>0?e:void 0}var Fe=["beforeCommand","beforeMutation","afterCommand","onWrite","onRead","onIndex"];function Pe(r,e,t){let n=e.map(i=>i?.[t]),a=h(n);if(a!==void 0){let i=r;i[t]=a}}function Te(r){let e={};for(let t of Fe)Pe(e,r,t);return Object.keys(e).length>0?e:void 0}function jr(...r){let e={},t=(o,s)=>{s!==void 0&&(e[o]=s)};t("commands",h(r.map(o=>o.commands))),t("commandOverrides",_(r.map(o=>o.commandOverrides))),t("flags",Ae(r.map(o=>o.flags))),t("parsers",_(r.map(o=>o.parsers))),t("renderers",_(r.map(o=>o.renderers))),t("services",_(r.map(o=>o.services))),t("preflights",h(r.map(o=>o.preflights))),t("itemTypes",h(r.map(o=>o.itemTypes))),t("itemFields",h(r.map(o=>o.itemFields))),t("relationshipKinds",h(r.map(o=>o.relationshipKinds))),t("migrations",h(r.map(o=>o.migrations))),t("profiles",h(r.map(o=>o.profiles))),t("searchProviders",h(r.map(o=>o.searchProviders))),t("vectorStoreAdapters",h(r.map(o=>o.vectorStoreAdapters))),t("assuranceProviders",h(r.map(o=>o.assuranceProviders))),t("importers",h(r.map(o=>o.importers))),t("exporters",h(r.map(o=>o.exporters))),t("hooks",Te(r.map(o=>o.hooks)));let n;for(let o of r)o.manifest&&(n=o.manifest);t("manifest",n);let a=r.some(o=>o.activate);t("activate",a?async o=>{for(let s of r)s.activate&&await s.activate(o)}:void 0);let i=r.some(o=>o.deactivate);return t("deactivate",i?async()=>{let o=[];for(let s of[...r].reverse())if(s.deactivate)try{await s.deactivate()}catch(d){o.push(d)}if(o.length>0)throw o.length>1?new AggregateError(o,"Multiple extension blueprint deactivate hooks failed."):o[0]}:void 0),e}var Ie=[["commands","commands"],["commandOverrides","commands"],["flags","schema"],["itemTypes","schema"],["itemFields","schema"],["relationshipKinds","schema"],["migrations","schema"],["profiles","schema"],["parsers","parser"],["renderers","renderers"],["services","services"],["preflights","preflight"],["searchProviders","search"],["vectorStoreAdapters","search"],["assuranceProviders","services"],["importers","importers"],["exporters","importers"]];function $(r){return r?Array.isArray(r)?r.length>0:Object.keys(r).length>0:!1}function N(r){let e=new Set;for(let[a,i]of Ie)$(r[a])&&e.add(i);(r.commands??[]).filter(E).some(a=>a.flags!==void 0)&&e.add("schema");let t=[...r.importers??[],...r.exporters??[]].filter(E);t.some(a=>a?.options?.flags!==void 0)&&e.add("schema"),t.some(a=>typeof a=="object")&&e.add("commands");let n=r.hooks??{};return[n.beforeCommand,n.beforeMutation,n.afterCommand,n.onWrite,n.onRead,n.onIndex].some($)&&e.add("hooks"),[...e].sort((a,i)=>a.localeCompare(i))}var Me=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function f(r){return[...new Set(r)].sort((e,t)=>e.localeCompare(t))}function E(r){return r!=null}function S(r){return v(`${r.name} import`)}function O(r){return v(`${r.name} export`)}function je(r,e,t){return[...r.map(n=>v(n.name)),...e.filter(n=>n.options!==void 0).map(S),...t.filter(n=>n.options!==void 0).map(O)]}function Be(r,e,t,n){return[...Object.keys(r.flags??{}).map(a=>v(a)),...e.filter(a=>a.flags!==void 0).map(a=>v(a.name)),...t.filter(a=>a.options?.flags!==void 0).map(S),...n.filter(a=>a.options?.flags!==void 0).map(O)]}function De(r){return Me.filter(([e])=>(r[e]?.length??0)>0).map(([,e])=>e)}function Le(r){let e=Object.entries(r??{}).filter(([,t])=>typeof t!="function"&&((t.commands?.length??0)>0||t.resultDiscriminator!==void 0)).map(([t,n])=>{let a=n;return{format:t,commands:f((a.commands??[]).map(i=>v(i))),result_discriminator:a.resultDiscriminator!==void 0}}).sort((t,n)=>t.format.localeCompare(n.format));return e.length>0?{renderer_ownership:e}:{}}function He(r){return!r||r.length===0?{}:{assurance_providers:f(r.map(e=>e.id))}}function Ke(r,e,t){return{item_types:f((r.itemTypes??[]).map(n=>n.name)),item_fields:f((r.itemFields??[]).map(n=>n.name)),...(r.relationshipKinds?.length??0)>0?{relationship_kinds:f(r.relationshipKinds.map(n=>n.kind))}:{},migrations:f((r.migrations??[]).flatMap(n=>typeof n.id=="string"?[n.id]:[])),profiles:f((r.profiles??[]).map(n=>n.name)),importers:f(e.map(n=>v(n.name))),exporters:f(t.map(n=>v(n.name))),search_providers:f((r.searchProviders??[]).map(n=>n.name)),vector_store_adapters:f((r.vectorStoreAdapters??[]).map(n=>n.name)),...He(r.assuranceProviders),parser_overrides:f(Object.keys(r.parsers??{}).map(n=>v(n))),service_overrides:f(Object.keys(r.services??{}).map(n=>String(n).trim().toLowerCase())),renderer_overrides:f(Object.keys(r.renderers??{}).map(n=>String(n).trim().toLowerCase())),...Le(r.renderers),preflight_overrides:(r.preflights??[]).length,preflight_ownership:(r.preflights??[]).map(n=>({commands:[...n.commands??[]]}))}}function qe(r){let e=(r.commands??[]).filter(E),t=(r.importers??[]).filter(E),n=(r.exporters??[]).filter(E),a=t.map(S),i=n.map(O),o=je(e,t,n),s=Be(r,e,t,n),d=r.hooks??{},l=Ke(r,t,n);return{capabilities:N(r),commands:f(o),command_overrides:f(Object.keys(r.commandOverrides??{}).map(b=>v(b))),command_handlers:f([...o,...a,...i]),hooks:De(d),flag_commands:f(s),...l}}var Ue=["commands","commandOverrides","flags","parsers","renderers","services","preflights","itemTypes","itemFields","relationshipKinds","migrations","profiles","searchProviders","vectorStoreAdapters","assuranceProviders","importers","exporters"];function Ve(r){return(r.itemFields??[]).filter(e=>typeof e?.name=="string"&&ae.has(e.name.trim())).map(e=>({code:"reserved_item_field",severity:"error",message:`Item field "${e.name}" collides with reserved item metadata; rename it with an extension-specific prefix before publishing.`,field:e.name}))}function ze(r){return[...Object.values(r.flags??{}).flat(),...(r.commands??[]).flatMap(e=>e.flags??[]),...(r.importers??[]).flatMap(e=>e.options?.flags??[]),...(r.exporters??[]).flatMap(e=>e.options?.flags??[])].flatMap(e=>{if(typeof e?.long!="string"&&typeof e?.short!="string")return[];let t=H(e.long,e.short);if(t===null)return[];let{token:n,failure:a}=t;return[{code:a,severity:"error",message:`Flag "${n}" ${K(n,a)}.`,field:n}]})}function ue(r){let e=new Set;for(let t of r){let n=D(t)??x(t);n!==null&&e.add(n)}return[...e].sort((t,n)=>t.localeCompare(n))}function We(r,e){let t=[];if(e===null)return r.length>0&&t.push({code:"manifest_capabilities_absent",severity:"warning",message:`Blueprint exercises ${r.length===1?"capability":"capabilities"} [${r.join(", ")}] but declares none; set capabilities to deriveExtensionCapabilities(blueprint) so the manifest grant matches.`}),t;let n=new Set(e),a=new Set(r);for(let i of r)n.has(i)||t.push({code:"capability_undeclared",severity:"error",message:`Blueprint exercises capability "${i}" but it is absent from the declared capabilities; activation throws extension_capability_missing \u2014 add "${i}" to the manifest capabilities.`,capability:i});for(let i of e)a.has(i)||t.push({code:"capability_unused",severity:"warning",message:`Capability "${i}" is declared but no blueprint surface exercises it; drop it to keep the manifest least-privilege (pm package doctor reports this as extension_capability_unused).`,capability:i});return t}function Ge(r){let e=[],t=new Map;for(let a of r.commands??[]){let i=v(a.name);t.set(i,(t.get(i)??0)+1)}for(let[a,i]of t)i>1&&e.push({code:"duplicate_command",severity:"warning",message:`Command "${a}" is declared ${i} times in commands; the later registration shadows the earlier one at dispatch.`,command:a});let n=new Set(Object.keys(r.commandOverrides??{}).map(a=>v(a)));for(let a of t.keys())n.has(a)&&e.push({code:"command_override_conflict",severity:"warning",message:`Command "${a}" is declared both as a new command definition and as a command override; register one or the other.`,command:a});return e}function Ye(r){let e=[];for(let t of Ue)t in r&&!$(r[t])&&e.push({code:"empty_surface",severity:"warning",message:`Blueprint field "${t}" is present but empty; remove it or populate it.`,field:t});if("hooks"in r){let t=r.hooks??{};[t.beforeCommand,t.beforeMutation,t.afterCommand,t.onWrite,t.onRead,t.onIndex].some($)||e.push({code:"empty_surface",severity:"warning",message:'Blueprint field "hooks" is present but registers no lifecycle hooks; remove it or populate it.',field:"hooks"})}return e}function k(r,e={}){let t=N(r),n=e.declaredCapabilities??r.manifest?.capabilities,a=Array.isArray(n)?ue(n):null,i=[...We(t,a),...Ge(r),...ze(r),...Ve(r),...Ye(r)];return{ok:i.every(o=>o.severity!=="error"),findings:i,used:t,declared:a}}function ve(r,e){let{additionalCapabilities:t,...n}=e,a=Array.isArray(t)?ue(t):[],i=[...new Set([...N(r),...a])].sort((o,s)=>o.localeCompare(s));return{...n,capabilities:i}}function Br(r,e){let t=ve(r,e);return{module:Oe({...r,manifest:t}),manifest:t}}function ge(r,e){if(r.status==="absent"||r.status==="ok")return null;let t=`${r.kind}_${r.status}`,n="";switch(t){case"pm_min_version_invalid":n=`pm_min_version "${r.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;break;case"pm_min_version_unchecked":n=`pm_min_version "${r.required}" could not be compared against pm ${e}; compatibility is unverified.`;break;case"pm_min_version_unmet":n=`Requires pm >= ${r.required} but the target is pm ${e}; the loader skips the extension.`;break;case"pm_max_version_invalid":n=`pm_max_version "${r.required}" is not a valid inclusive upper bound (version ranges are not allowed); the extension is treated as incompatible and the loader skips it.`;break;case"pm_max_version_unchecked":n=`pm_max_version "${r.required}" could not be compared against pm ${e}; compatibility is unverified.`;break;case"pm_max_version_exceeded":n=`Allows pm <= ${r.required} but the target is pm ${e}; the loader skips the extension.`;break;case"pm_max_version_exceeded_warn":n=`Target pm ${e} is newer than pm_max_version ${r.required}, but the "warn" exceeded mode lets it load with a warning.`;break}return{code:t,severity:r.allowed?"warning":"error",constraint:r.kind,required:r.required,current:e,message:n}}function A(r,e){let t=q(r.pm_min_version,e.pmVersion),n=U(r.pm_max_version,e.pmVersion,e.pmMaxVersionExceededMode??"block"),a=L(r).findings.map(d=>({code:d.code,severity:"warning",constraint:"manifest",required:d.code==="manifest_unknown_key"?d.path:"pm_min_version",current:e.pmVersion,path:d.path,...d.suggested_key?{suggested_key:d.suggested_key}:{},message:d.message})),i=[],o=ge(t,e.pmVersion);o!==null&&i.push(o);let s=ge(n,e.pmVersion);return s!==null&&i.push(s),{compatible:t.allowed&&n.allowed,findings:[...a,...i],pmVersion:e.pmVersion}}var Xe=new Set(["capability_undeclared","capability_unused","manifest_capabilities_absent"]);function he(r,e={}){let t=k(r,{declaredCapabilities:e.declaredCapabilities}),n=e.identity?ve(r,e.identity):null,a=e.target?A(n??r.manifest??{},e.target):null,i=[...(n!==null&&e.declaredCapabilities===void 0?t.findings.filter(o=>!Xe.has(o.code)):t.findings).map(o=>({source:"blueprint",severity:o.severity,code:o.code,message:o.message})),...(a?.findings??[]).map(o=>({source:"compatibility",severity:o.severity,code:o.code,message:o.message}))];return{ok:i.every(o=>o.severity!=="error"),capabilities:t.used,blueprint:t,manifest:n,compatibility:a,findings:i}}(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="2df3e178-3a2b-5a45-89d8-628eca782453")}catch{}})();function u(r,e){return r.name??e??""}var Je={before_command:"beforeCommand",before_mutation:"beforeMutation",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"},F={before_command:"beforeCommand",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"};function p(r){return r.trim().toLowerCase()}function ye(r){return p(r).replaceAll("-","_")}function g(r){return r?` from extension "${r}"`:""}function c(r){return[...new Set(r)].sort((e,t)=>e.localeCompare(t))}function y(r){if(typeof r!="string")throw new Error('A command name string is required. Pass it via the options object, e.g. runRegisteredCommandForTest(activation, { command: "my command" }) \u2014 positional command arguments are not supported.');return r.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0).join(" ")}function m(r){return r.length>0?r.join(", "):"(none)"}function we(r,e,t){let n=new Set(r??[]),a=c(e.filter(i=>!n.has(i)));if(a.length>0)throw new Error(`Expected package manifest ${t} to include ${a.join(", ")}; available: ${m(c(r??[]))}`)}function Ee(r){let e=new Set;for(let t of r)typeof t.long=="string"&&t.long.trim().length>0&&e.add(t.long.trim()),typeof t.short=="string"&&t.short.trim().length>0&&e.add(t.short.trim());return e}function P(r){let e=w(r);if(!e)return{};let t=w(e.manifest);if(t)return t;let n=w(e.default);return w(n?.manifest)||(n&&typeof e.default!="function"&&("name"in n||"capabilities"in n)?n:typeof r!="function"&&("name"in e||"capabilities"in e)?e:{})}function T(r,e){return e??(typeof r.name=="string"&&r.name.trim().length>0?r.name.trim():"test-extension")}function be(r,e){return Array.isArray(e.capabilities)?[...e.capabilities]:Array.isArray(r.capabilities)?r.capabilities.filter(t=>typeof t=="string"):[]}function xe(r,e,t){return{disabled_by_flag:!1,roots:{global:"",project:""},configured_enabled:[],configured_disabled:[],discovered:[],effective:[],warnings:[],policy:t.policy,failed:[],loaded:[{layer:t.layer,directory:"",manifest_path:"",name:t.name,version:typeof e.version=="string"?e.version:"0.0.0",entry:typeof e.entry=="string"?e.entry:"./index.js",priority:typeof e.priority=="number"?e.priority:0,entry_path:"",capabilities:t.capabilities,manifest_version:typeof e.manifest_version=="number"?e.manifest_version:void 0,pm_min_version:typeof e.pm_min_version=="string"?e.pm_min_version:void 0,pm_max_version:typeof e.pm_max_version=="string"?e.pm_max_version:void 0,engines:e.engines,trusted:e.trusted,provenance:e.provenance,sandbox_profile:e.sandbox_profile,permissions:e.permissions,activation:e.activation,module:r}]}}async function Qe(r,e={}){let t=P(r);return oe(xe(r,t,{name:T(t,e.name),layer:e.layer??"project",capabilities:be(t,e),policy:e.policy??C()}))}async function Ze(r,e={}){let t=P(r);return ne(xe(r,t,{name:T(t,e.name),layer:e.layer??"project",capabilities:be(t,{}),policy:C()}),e.activation,e.deactivateTimeoutMs===void 0?{}:{deactivate_timeout_ms:e.deactivateTimeoutMs})}async function I(r,e){let t=y(e.command);if(t.length===0)throw new Error("Expected command name must be a non-empty string");if(!r.handlers.some(o=>o.command===t)){let o=c(r.handlers.map(s=>s.command));throw new Error(`Expected a registered command handler for "${t}" to invoke. Available command handlers: ${m(o)}`)}if(e.sdk!==void 0&&e.sdkFactory!==void 0)throw new TypeError("runRegisteredCommandForTest accepts sdk or sdkFactory, not both");let n=e.pmRoot??"",a={json:!0,quiet:!0,noPager:!0,...e.global},i=e.sdk??e.sdkFactory?.({pmRoot:n,global:a})??(n.length>0?se(n,new pe({pmRoot:n}),void 0,t):void 0);return J(r,{command:t,args:e.args?[...e.args]:[],options:e.options?{...e.options}:{},global:a,pm_root:n,...i===void 0?{}:{sdk:i}})}async function er(r,e){if((r.beforeMutation?.length??0)===0)throw new Error("Expected a registered before_mutation hook to invoke");await z(r,e.context)}async function rr(r,e){let t=e.kind;if(t==="before_mutation")throw new Error("Invoke before_mutation hooks with runRegisteredMutationGuardForTest so denials and failures retain fail-closed semantics.");if((r[F[t]]?.length??0)===0){let n=c(Object.keys(F).filter(a=>(r[F[a]]?.length??0)>0));throw new Error(`Expected a registered "${t}" hook to invoke. Hook kinds with registrations: ${m(n)}`)}switch(e.kind){case"before_command":return V(r,e.context);case"after_command":return W(r,e.context);case"on_read":return Y(r,e.context);case"on_write":return G(r,e.context);case"on_index":return X(r,e.context)}}async function tr(r,e){let t=y(e.command);if(!r.overrides.some(n=>n.command===t))throw new Error(`Expected a registered parser override for command "${t}" to invoke. Available parser override commands: ${m(c(r.overrides.map(n=>n.command)))}`);return Q(r,e)}async function nr(r,e){if(r.overrides.length===0)throw new Error("Expected a registered preflight override to invoke, but none are registered.");return Z(r,e)}async function or(r,e){let t=y(e.command);if(!r.overrides.some(n=>n.command===t))throw new Error(`Expected a registered command override for command "${t}" to invoke. Available command override commands: ${m(c(r.overrides.map(n=>n.command)))}`);return re(r,e)}async function ir(r,e){if(!r.overrides.some(t=>t.format===e.format))throw new Error(`Expected a registered renderer override for format "${e.format}" to invoke. Available renderer override formats: ${m(c(r.overrides.map(t=>t.format)))}`);return te(r,e)}async function ar(r,e){if(!r.overrides.some(t=>t.service===e.service))throw new Error(`Expected a registered service override for service "${e.service}" to invoke. Available service override services: ${m(c(r.overrides.map(t=>t.service)))}`);return ee(r,e)}var sr={query:["query"],embed:["embed"],embedBatch:["embedBatch","embed_batch"],queryExpansion:["queryExpansion","query_expansion"],rerank:["rerank"]};async function dr(r,e){let t=de(r,e.provider);if(!t){let i=c(r.search_providers.map(o=>o.definition.name));throw new Error(`Expected a registered search provider "${e.provider}" to invoke. Available search providers: ${m(i)}`)}let n=t.runtime_definition,a=sr[e.operation].map(i=>n[i]).find(i=>typeof i=="function");if(typeof a!="function")throw new Error(`Registered search provider "${e.provider}" does not implement the "${e.operation}" operation.`);return await a(e.context)}async function mr(r,e){let t=me(r,e.adapter);if(!t){let a=c(r.vector_store_adapters.map(i=>i.definition.name));throw new Error(`Expected a registered vector store adapter "${e.adapter}" to invoke. Available vector store adapters: ${m(a)}`)}let n=t.runtime_definition[e.operation];if(typeof n!="function")throw new Error(`Registered vector store adapter "${e.adapter}" does not implement the "${e.operation}" operation.`);return await n(e.context)}async function cr(r,e){let t=ke(r,{migration:e.migration,extensionName:e.extensionName}),n=ce(t).run;if(typeof n!="function")throw new Error(`Registered migration "${e.migration}" does not implement a run function to invoke.`);let a=t.definition.status,i={id:t.definition.id,command:"migration",layer:t.layer,extension:t.name,pm_root:e.pmRoot??"",status:(typeof a=="string"?a.trim().toLowerCase():"")||"pending"};return await n(i)}async function lr(r,e){let t=_e(r.registrations,{importer:e.importer,extensionName:e.extensionName});return I(r.commands,{command:`${t.importer} import`,args:e.args,options:e.options,global:e.global,pmRoot:e.pmRoot})}async function fr(r,e){let t=$e(r.registrations,{exporter:e.exporter,extensionName:e.extensionName});return I(r.commands,{command:`${t.exporter} export`,args:e.args,options:e.options,global:e.global,pmRoot:e.pmRoot})}function Qr(r,e={}){let t=e.deactivated??1;if(r.deactivated!==t)throw new Error(`Expected ${t} extension${t===1?"":"s"} to deactivate cleanly, but ${r.deactivated} did.`);let n=e.failed??0;if(r.failed.length!==n){let a=r.failed.map(i=>`${i.layer}:${i.name} (${i.error})`).join(", ");throw new Error(`Expected ${n} teardown failure${n===1?"":"s"}, but observed ${r.failed.length}${a.length>0?`: ${a}`:""}.`)}return r}function Zr(r,e){if(e.packageName!==void 0&&r.package_name!==e.packageName)throw new Error(`Expected package manifest package_name to be "${e.packageName}"; received "${r.package_name??"(none)"}"`);if(e.aliases!==void 0&&we(r.aliases,e.aliases,"aliases"),e.resources!==void 0)for(let[t,n]of Object.entries(e.resources))we(r.resources[t],n,`pm.${t}`);return r}function pr(r,e){let t=y(u(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.commands.filter(o=>o.command===t),a=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!a){let o=r.commands.map(d=>d.command).sort((d,l)=>d.localeCompare(l)),s=e.extensionName?` from extension "${e.extensionName}"`:"";throw new Error(`Expected extension command "${t}"${s} to be registered. Available commands: ${m(o)}`)}if(e.action!==void 0&&a.action!==e.action)throw new Error(`Expected extension command "${t}" action "${e.action}", received "${a.action}"`);if(e.arguments!==void 0){let o=(a.arguments??[]).map(d=>d.name),s=e.arguments.filter(d=>!o.includes(d));if(s.length>0)throw new Error(`Expected extension command "${t}" arguments ${m(e.arguments)}; missing ${m(s)}; available ${m(o)}`)}let i=r.flags.filter(o=>o.target_command===t&&(e.extensionName===void 0||o.name===e.extensionName)).flatMap(o=>o.flags);if(e.flags!==void 0){let o=Ee(i),s=e.flags.filter(d=>!o.has(d));if(s.length>0)throw new Error(`Expected extension command "${t}" flags ${m(e.flags)}; missing ${m(s)}; available ${m([...o].sort((d,l)=>d.localeCompare(l)))}`)}return{command:a,flags:i}}function gr(r,e){let t=y(u(e,e.targetCommand));if(t.length===0)throw new Error("Expected target command name must be a non-empty string");let n=r.flags.filter(i=>i.target_command===t),a;if(e.extensionName)a=n.find(i=>i.name===e.extensionName);else if(n.length===1)a=n[0];else if(n.length>1){let i=c(n.map(o=>o.name));throw new Error(`Expected flags for target command "${t}" matched multiple extensions: ${m(i)}. Specify extensionName to choose one registration.`)}if(!a){let i=c(r.flags.map(s=>s.target_command)),o=c(n.map(s=>s.name));throw new Error(`Expected flags for target command "${t}"${g(e.extensionName)} to be registered. Available flag target commands: ${m(i)}; matching extensions: ${m(o)}`)}if(e.flags!==void 0){let i=Ee(a.flags),o=e.flags.filter(s=>!i.has(s));if(o.length>0)throw new Error(`Expected flags for target command "${t}" to include ${m(e.flags)}; missing ${m(o)}; available ${m([...i].sort((s,d)=>s.localeCompare(d)))}`)}return a}function ur(r,e){let t=Je[e.kind],n=r[t]??[],a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(n.map(o=>o.name));throw new Error(`Expected a "${e.kind}" hook${g(e.extensionName)} to be registered. Available "${e.kind}" hooks: ${m(i)}`)}return a}function vr(r,e){let t=p(u(e,e.provider));if(t.length===0)throw new Error("Expected search provider name must be a non-empty string");let n=r.search_providers.filter(i=>p(i.definition.name)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.search_providers.map(o=>o.definition.name));throw new Error(`Expected search provider "${t}"${g(e.extensionName)} to be registered. Available search providers: ${m(i)}`)}return a}function hr(r,e){let t=p(u(e,e.adapter));if(t.length===0)throw new Error("Expected vector store adapter name must be a non-empty string");let n=r.vector_store_adapters.filter(i=>p(i.definition.name)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.vector_store_adapters.map(o=>o.definition.name));throw new Error(`Expected vector store adapter "${t}"${g(e.extensionName)} to be registered. Available vector store adapters: ${m(i)}`)}return a}function _e(r,e){let t=p(u(e,e.importer));if(t.length===0)throw new Error("Expected importer name must be a non-empty string");let n=r.importers.filter(i=>p(i.importer)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.importers.map(o=>o.importer));throw new Error(`Expected importer "${t}"${g(e.extensionName)} to be registered. Available importers: ${m(i)}`)}return a}function $e(r,e){let t=p(u(e,e.exporter));if(t.length===0)throw new Error("Expected exporter name must be a non-empty string");let n=r.exporters.filter(i=>p(i.exporter)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.exporters.map(o=>o.exporter));throw new Error(`Expected exporter "${t}"${g(e.extensionName)} to be registered. Available exporters: ${m(i)}`)}return a}function yr(r,e){let t=p(u(e,e.field));if(t.length===0)throw new Error("Expected item field name must be a non-empty string");let n=r.item_fields.filter(a=>e.extensionName===void 0||a.name===e.extensionName).map(a=>({registration:a,field:a.fields.find(i=>p(i.name)===t)})).filter(a=>a.field!==void 0).find(a=>e.type===void 0||a.field.type===e.type);if(!n){let a=c(r.item_fields.flatMap(i=>i.fields.map(o=>`${o.name}:${o.type}`)));throw new Error(`Expected item field "${t}"${g(e.extensionName)} to be registered. Available item fields: ${m(a)}`)}return n}function wr(r,e){let t=p(u(e,e.itemType));if(t.length===0)throw new Error("Expected item type name must be a non-empty string");let n=r.item_types.filter(a=>e.extensionName===void 0||a.name===e.extensionName).map(a=>({registration:a,itemType:a.types.find(i=>p(i.name)===t)})).filter(a=>a.itemType!==void 0).find(a=>e.folder===void 0||a.itemType.folder===e.folder);if(!n){let a=c(r.item_types.flatMap(i=>i.types.map(o=>`${o.name}:${o.folder}`)));throw new Error(`Expected item type "${t}"${g(e.extensionName)} to be registered. Available item types: ${m(a)}`)}return n}function Er(r,e){let t=ye(u(e,e.profile));if(t.length===0)throw new Error("Expected profile name must be a non-empty string");let n=r.profiles.filter(a=>e.extensionName===void 0||a.name===e.extensionName).find(a=>ye(a.profile.name)===t);if(!n){let a=c(r.profiles.map(i=>i.profile.name));throw new Error(`Expected profile "${t}"${g(e.extensionName)} to be registered. Available profiles: ${m(a)}`)}return{registration:n,profile:n.profile}}function br(r,e){let t=y(u(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.overrides.filter(i=>i.command===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.overrides.map(o=>o.command));throw new Error(`Expected command override "${t}"${g(e.extensionName)} to be registered. Available command overrides: ${m(i)}`)}return a}function xr(r,e){let t=y(u(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.overrides.filter(i=>i.command===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.overrides.map(o=>o.command));throw new Error(`Expected parser override "${t}"${g(e.extensionName)} to be registered. Available parser overrides: ${m(i)}`)}return a}function _r(r,e={}){let t=e.extensionName?r.overrides.find(n=>n.name===e.extensionName):r.overrides[0];if(!t){let n=c(r.overrides.map(a=>a.name));throw new Error(`Expected a preflight override${g(e.extensionName)} to be registered. Available preflight overrides: ${m(n)}`)}return t}function $r(r,e){let t=p(u(e,e.format));if(t.length===0)throw new Error("Expected renderer format must be a non-empty string");let n=r.overrides.filter(i=>i.format===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.overrides.map(o=>o.format));throw new Error(`Expected renderer override "${t}"${g(e.extensionName)} to be registered. Available renderer overrides: ${m(i)}`)}return a}function kr(r,e){let t=p(u(e,e.service));if(t.length===0)throw new Error("Expected service name must be a non-empty string");let n=r.overrides.filter(i=>p(i.service)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.overrides.map(o=>o.service));throw new Error(`Expected service override "${t}"${g(e.extensionName)} to be registered. Available service overrides: ${m(i)}`)}return a}function ke(r,e){let t=p(u(e,e.migration));if(t.length===0)throw new Error("Expected migration id must be a non-empty string");let n=r.migrations.filter(s=>(e.extensionName===void 0||s.name===e.extensionName)&&typeof s.definition.id=="string"&&p(s.definition.id)===t),a=n.find(s=>e.mandatory===void 0||(s.definition.mandatory??!1)===e.mandatory);if(a)return a;let i=n[0];if(i!==void 0)throw new Error(`Expected migration "${t}"${g(e.extensionName)} to have mandatory=${e.mandatory}, but it is mandatory=${i.definition.mandatory??!1}.`);let o=c(r.migrations.map(s=>`${typeof s.definition.id=="string"&&s.definition.id.trim().length>0?s.definition.id.trim():"(unnamed)"}:${s.definition.mandatory===!0}`));throw new Error(`Expected migration "${t}"${g(e.extensionName)} to be registered. Available migrations: ${m(o)}`)}function Cr(r,e){let t=(d,l)=>{let b=new Set;for(let M of d){let j=x(M);if(j===null)throw new Error(`Expected ${l} capability "${M}" to be a known extension capability. Use canonical capability names (see manifest.capabilities).`);b.add(j)}return b},n=[...t(e.declared,"declared")].sort((d,l)=>d.localeCompare(l)),a=t(e.allowUnused??[],"allowUnused"),i=ie(r,{extensionName:e.extensionName}),o=new Set(i),s=n.filter(d=>!o.has(d)&&!a.has(d));if(s.length>0){let d=g(e.extensionName);throw new Error(`Expected every declared capability${d} to be exercised, but [${s.join(", ")}] ${s.length===1?"is":"are"} declared yet never registered against. Remove ${s.length===1?"it":"them"} from manifest.capabilities for least privilege, or pass allowUnused for capabilities registered only behind a runtime flag.`)}return{declared:n,used:i,unused:s}}function et(r,e={}){let t=k(r,e);if(!t.ok){let n=t.findings.filter(a=>a.severity==="error");throw new Error(`Extension blueprint failed preflight with ${n.length} ${n.length===1?"error":"errors"}:
1
+ import{M as fe,Ta as pe,i as se}from"./chunk-DT3KUUKY.js";import{Qa as le,o as R}from"./chunk-GUVKPOY6.js";import{$b as Y,E as C,Fl as de,Gl as me,Hl as ce,Kb as L,Ob as H,Oi as ae,Pb as K,Sb as q,Tb as U,Xb as V,Yb as z,Zb as W,_b as G,ac as X,bc as J,cc as Q,dc as Z,ec as ee,fc as re,gc as te,mc as ne,nc as oe,oa as w,pa as B,tb as v,tc as ie,xb as x,yb as D}from"./chunk-6PZPUJW3.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="52f6eff3-e226-56d9-893a-f16997d11c50")}catch{}})();function Ir(r){return r}function Mr(r){return r}function Ce(r,e){for(let t of e.commands??[])r.registerCommand(t);for(let[t,n]of Object.entries(e.commandOverrides??{}))r.registerCommand(t,n);for(let[t,n]of Object.entries(e.flags??{}))r.registerFlags(t,n);for(let[t,n]of Object.entries(e.parsers??{}))r.registerParser(t,n);for(let[t,n]of Object.entries(e.renderers??{}))if(typeof n=="function")r.registerRenderer(t,n);else{let{run:a,...i}=n;r.registerRenderer(t,a,i)}for(let[t,n]of Object.entries(e.services??{}))r.registerService(t,n)}function Re(r,e){for(let i of e.preflights??[])r.registerPreflight(i);let t=e.itemTypes??[];t.length>0&&r.registerItemTypes(t);let n=e.itemFields??[];n.length>0&&r.registerItemFields(n);let a=e.relationshipKinds??[];a.length>0&&r.registerRelationshipKinds(a);for(let i of e.migrations??[])r.registerMigration(i);for(let i of e.profiles??[])r.registerProfile(i)}function Ne(r,e){for(let t of e.searchProviders??[])r.registerSearchProvider(t);for(let t of e.vectorStoreAdapters??[])r.registerVectorStoreAdapter(t);for(let t of e.assuranceProviders??[])r.registerAssuranceMeasurementProvider(t);for(let t of e.importers??[])r.registerImporter(t.name,t.importer,t.options);for(let t of e.exporters??[])r.registerExporter(t.name,t.exporter,t.options)}function Se(r,e){for(let t of e.beforeCommand??[])r.hooks.beforeCommand(t);for(let t of e.beforeMutation??[])r.hooks.beforeMutation(t);for(let t of e.afterCommand??[])r.hooks.afterCommand(t);for(let t of e.onWrite??[])r.hooks.onWrite(t);for(let t of e.onRead??[])r.hooks.onRead(t);for(let t of e.onIndex??[])r.hooks.onIndex(t)}function Oe(r){let e={activate:async t=>{Ce(t,r),Re(t,r),Ne(t,r),Se(t,r.hooks??{}),await r.activate?.(t)}};return r.manifest&&(e.manifest=r.manifest),r.deactivate&&(e.deactivate=r.deactivate),e}function h(r){let e=r.flatMap(t=>t??[]);return e.length>0?e:void 0}function _(r){let e=Object.assign({},...r.map(t=>t??{}));return Object.keys(e).length>0?e:void 0}function Ae(r){let e={};for(let t of r)for(let[n,a]of Object.entries(t??{}))e[n]=[...e[n]??[],...a];return Object.keys(e).length>0?e:void 0}var Fe=["beforeCommand","beforeMutation","afterCommand","onWrite","onRead","onIndex"];function Pe(r,e,t){let n=e.map(i=>i?.[t]),a=h(n);if(a!==void 0){let i=r;i[t]=a}}function Te(r){let e={};for(let t of Fe)Pe(e,r,t);return Object.keys(e).length>0?e:void 0}function jr(...r){let e={},t=(o,s)=>{s!==void 0&&(e[o]=s)};t("commands",h(r.map(o=>o.commands))),t("commandOverrides",_(r.map(o=>o.commandOverrides))),t("flags",Ae(r.map(o=>o.flags))),t("parsers",_(r.map(o=>o.parsers))),t("renderers",_(r.map(o=>o.renderers))),t("services",_(r.map(o=>o.services))),t("preflights",h(r.map(o=>o.preflights))),t("itemTypes",h(r.map(o=>o.itemTypes))),t("itemFields",h(r.map(o=>o.itemFields))),t("relationshipKinds",h(r.map(o=>o.relationshipKinds))),t("migrations",h(r.map(o=>o.migrations))),t("profiles",h(r.map(o=>o.profiles))),t("searchProviders",h(r.map(o=>o.searchProviders))),t("vectorStoreAdapters",h(r.map(o=>o.vectorStoreAdapters))),t("assuranceProviders",h(r.map(o=>o.assuranceProviders))),t("importers",h(r.map(o=>o.importers))),t("exporters",h(r.map(o=>o.exporters))),t("hooks",Te(r.map(o=>o.hooks)));let n;for(let o of r)o.manifest&&(n=o.manifest);t("manifest",n);let a=r.some(o=>o.activate);t("activate",a?async o=>{for(let s of r)s.activate&&await s.activate(o)}:void 0);let i=r.some(o=>o.deactivate);return t("deactivate",i?async()=>{let o=[];for(let s of[...r].reverse())if(s.deactivate)try{await s.deactivate()}catch(d){o.push(d)}if(o.length>0)throw o.length>1?new AggregateError(o,"Multiple extension blueprint deactivate hooks failed."):o[0]}:void 0),e}var Ie=[["commands","commands"],["commandOverrides","commands"],["flags","schema"],["itemTypes","schema"],["itemFields","schema"],["relationshipKinds","schema"],["migrations","schema"],["profiles","schema"],["parsers","parser"],["renderers","renderers"],["services","services"],["preflights","preflight"],["searchProviders","search"],["vectorStoreAdapters","search"],["assuranceProviders","services"],["importers","importers"],["exporters","importers"]];function $(r){return r?Array.isArray(r)?r.length>0:Object.keys(r).length>0:!1}function N(r){let e=new Set;for(let[a,i]of Ie)$(r[a])&&e.add(i);(r.commands??[]).filter(E).some(a=>a.flags!==void 0)&&e.add("schema");let t=[...r.importers??[],...r.exporters??[]].filter(E);t.some(a=>a?.options?.flags!==void 0)&&e.add("schema"),t.some(a=>typeof a=="object")&&e.add("commands");let n=r.hooks??{};return[n.beforeCommand,n.beforeMutation,n.afterCommand,n.onWrite,n.onRead,n.onIndex].some($)&&e.add("hooks"),[...e].sort((a,i)=>a.localeCompare(i))}var Me=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function f(r){return[...new Set(r)].sort((e,t)=>e.localeCompare(t))}function E(r){return r!=null}function S(r){return v(`${r.name} import`)}function O(r){return v(`${r.name} export`)}function je(r,e,t){return[...r.map(n=>v(n.name)),...e.filter(n=>n.options!==void 0).map(S),...t.filter(n=>n.options!==void 0).map(O)]}function Be(r,e,t,n){return[...Object.keys(r.flags??{}).map(a=>v(a)),...e.filter(a=>a.flags!==void 0).map(a=>v(a.name)),...t.filter(a=>a.options?.flags!==void 0).map(S),...n.filter(a=>a.options?.flags!==void 0).map(O)]}function De(r){return Me.filter(([e])=>(r[e]?.length??0)>0).map(([,e])=>e)}function Le(r){let e=Object.entries(r??{}).filter(([,t])=>typeof t!="function"&&((t.commands?.length??0)>0||t.resultDiscriminator!==void 0)).map(([t,n])=>{let a=n;return{format:t,commands:f((a.commands??[]).map(i=>v(i))),result_discriminator:a.resultDiscriminator!==void 0}}).sort((t,n)=>t.format.localeCompare(n.format));return e.length>0?{renderer_ownership:e}:{}}function He(r){return!r||r.length===0?{}:{assurance_providers:f(r.map(e=>e.id))}}function Ke(r,e,t){return{item_types:f((r.itemTypes??[]).map(n=>n.name)),item_fields:f((r.itemFields??[]).map(n=>n.name)),...(r.relationshipKinds?.length??0)>0?{relationship_kinds:f(r.relationshipKinds.map(n=>n.kind))}:{},migrations:f((r.migrations??[]).flatMap(n=>typeof n.id=="string"?[n.id]:[])),profiles:f((r.profiles??[]).map(n=>n.name)),importers:f(e.map(n=>v(n.name))),exporters:f(t.map(n=>v(n.name))),search_providers:f((r.searchProviders??[]).map(n=>n.name)),vector_store_adapters:f((r.vectorStoreAdapters??[]).map(n=>n.name)),...He(r.assuranceProviders),parser_overrides:f(Object.keys(r.parsers??{}).map(n=>v(n))),service_overrides:f(Object.keys(r.services??{}).map(n=>String(n).trim().toLowerCase())),renderer_overrides:f(Object.keys(r.renderers??{}).map(n=>String(n).trim().toLowerCase())),...Le(r.renderers),preflight_overrides:(r.preflights??[]).length,preflight_ownership:(r.preflights??[]).map(n=>({commands:[...n.commands??[]]}))}}function qe(r){let e=(r.commands??[]).filter(E),t=(r.importers??[]).filter(E),n=(r.exporters??[]).filter(E),a=t.map(S),i=n.map(O),o=je(e,t,n),s=Be(r,e,t,n),d=r.hooks??{},l=Ke(r,t,n);return{capabilities:N(r),commands:f(o),command_overrides:f(Object.keys(r.commandOverrides??{}).map(b=>v(b))),command_handlers:f([...o,...a,...i]),hooks:De(d),flag_commands:f(s),...l}}var Ue=["commands","commandOverrides","flags","parsers","renderers","services","preflights","itemTypes","itemFields","relationshipKinds","migrations","profiles","searchProviders","vectorStoreAdapters","assuranceProviders","importers","exporters"];function Ve(r){return(r.itemFields??[]).filter(e=>typeof e?.name=="string"&&ae.has(e.name.trim())).map(e=>({code:"reserved_item_field",severity:"error",message:`Item field "${e.name}" collides with reserved item metadata; rename it with an extension-specific prefix before publishing.`,field:e.name}))}function ze(r){return[...Object.values(r.flags??{}).flat(),...(r.commands??[]).flatMap(e=>e.flags??[]),...(r.importers??[]).flatMap(e=>e.options?.flags??[]),...(r.exporters??[]).flatMap(e=>e.options?.flags??[])].flatMap(e=>{if(typeof e?.long!="string"&&typeof e?.short!="string")return[];let t=H(e.long,e.short);if(t===null)return[];let{token:n,failure:a}=t;return[{code:a,severity:"error",message:`Flag "${n}" ${K(n,a)}.`,field:n}]})}function ue(r){let e=new Set;for(let t of r){let n=D(t)??x(t);n!==null&&e.add(n)}return[...e].sort((t,n)=>t.localeCompare(n))}function We(r,e){let t=[];if(e===null)return r.length>0&&t.push({code:"manifest_capabilities_absent",severity:"warning",message:`Blueprint exercises ${r.length===1?"capability":"capabilities"} [${r.join(", ")}] but declares none; set capabilities to deriveExtensionCapabilities(blueprint) so the manifest grant matches.`}),t;let n=new Set(e),a=new Set(r);for(let i of r)n.has(i)||t.push({code:"capability_undeclared",severity:"error",message:`Blueprint exercises capability "${i}" but it is absent from the declared capabilities; activation throws extension_capability_missing \u2014 add "${i}" to the manifest capabilities.`,capability:i});for(let i of e)a.has(i)||t.push({code:"capability_unused",severity:"warning",message:`Capability "${i}" is declared but no blueprint surface exercises it; drop it to keep the manifest least-privilege (pm package doctor reports this as extension_capability_unused).`,capability:i});return t}function Ge(r){let e=[],t=new Map;for(let a of r.commands??[]){let i=v(a.name);t.set(i,(t.get(i)??0)+1)}for(let[a,i]of t)i>1&&e.push({code:"duplicate_command",severity:"warning",message:`Command "${a}" is declared ${i} times in commands; the later registration shadows the earlier one at dispatch.`,command:a});let n=new Set(Object.keys(r.commandOverrides??{}).map(a=>v(a)));for(let a of t.keys())n.has(a)&&e.push({code:"command_override_conflict",severity:"warning",message:`Command "${a}" is declared both as a new command definition and as a command override; register one or the other.`,command:a});return e}function Ye(r){let e=[];for(let t of Ue)t in r&&!$(r[t])&&e.push({code:"empty_surface",severity:"warning",message:`Blueprint field "${t}" is present but empty; remove it or populate it.`,field:t});if("hooks"in r){let t=r.hooks??{};[t.beforeCommand,t.beforeMutation,t.afterCommand,t.onWrite,t.onRead,t.onIndex].some($)||e.push({code:"empty_surface",severity:"warning",message:'Blueprint field "hooks" is present but registers no lifecycle hooks; remove it or populate it.',field:"hooks"})}return e}function k(r,e={}){let t=N(r),n=e.declaredCapabilities??r.manifest?.capabilities,a=Array.isArray(n)?ue(n):null,i=[...We(t,a),...Ge(r),...ze(r),...Ve(r),...Ye(r)];return{ok:i.every(o=>o.severity!=="error"),findings:i,used:t,declared:a}}function ve(r,e){let{additionalCapabilities:t,...n}=e,a=Array.isArray(t)?ue(t):[],i=[...new Set([...N(r),...a])].sort((o,s)=>o.localeCompare(s));return{...n,capabilities:i}}function Br(r,e){let t=ve(r,e);return{module:Oe({...r,manifest:t}),manifest:t}}function ge(r,e){if(r.status==="absent"||r.status==="ok")return null;let t=`${r.kind}_${r.status}`,n="";switch(t){case"pm_min_version_invalid":n=`pm_min_version "${r.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;break;case"pm_min_version_unchecked":n=`pm_min_version "${r.required}" could not be compared against pm ${e}; compatibility is unverified.`;break;case"pm_min_version_unmet":n=`Requires pm >= ${r.required} but the target is pm ${e}; the loader skips the extension.`;break;case"pm_max_version_invalid":n=`pm_max_version "${r.required}" is not a valid inclusive upper bound (version ranges are not allowed); the extension is treated as incompatible and the loader skips it.`;break;case"pm_max_version_unchecked":n=`pm_max_version "${r.required}" could not be compared against pm ${e}; compatibility is unverified.`;break;case"pm_max_version_exceeded":n=`Allows pm <= ${r.required} but the target is pm ${e}; the loader skips the extension.`;break;case"pm_max_version_exceeded_warn":n=`Target pm ${e} is newer than pm_max_version ${r.required}, but the "warn" exceeded mode lets it load with a warning.`;break}return{code:t,severity:r.allowed?"warning":"error",constraint:r.kind,required:r.required,current:e,message:n}}function A(r,e){let t=q(r.pm_min_version,e.pmVersion),n=U(r.pm_max_version,e.pmVersion,e.pmMaxVersionExceededMode??"block"),a=L(r).findings.map(d=>({code:d.code,severity:"warning",constraint:"manifest",required:d.code==="manifest_unknown_key"?d.path:"pm_min_version",current:e.pmVersion,path:d.path,...d.suggested_key?{suggested_key:d.suggested_key}:{},message:d.message})),i=[],o=ge(t,e.pmVersion);o!==null&&i.push(o);let s=ge(n,e.pmVersion);return s!==null&&i.push(s),{compatible:t.allowed&&n.allowed,findings:[...a,...i],pmVersion:e.pmVersion}}var Xe=new Set(["capability_undeclared","capability_unused","manifest_capabilities_absent"]);function he(r,e={}){let t=k(r,{declaredCapabilities:e.declaredCapabilities}),n=e.identity?ve(r,e.identity):null,a=e.target?A(n??r.manifest??{},e.target):null,i=[...(n!==null&&e.declaredCapabilities===void 0?t.findings.filter(o=>!Xe.has(o.code)):t.findings).map(o=>({source:"blueprint",severity:o.severity,code:o.code,message:o.message})),...(a?.findings??[]).map(o=>({source:"compatibility",severity:o.severity,code:o.code,message:o.message}))];return{ok:i.every(o=>o.severity!=="error"),capabilities:t.used,blueprint:t,manifest:n,compatibility:a,findings:i}}(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="2df3e178-3a2b-5a45-89d8-628eca782453")}catch{}})();function u(r,e){return r.name??e??""}var Je={before_command:"beforeCommand",before_mutation:"beforeMutation",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"},F={before_command:"beforeCommand",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"};function p(r){return r.trim().toLowerCase()}function ye(r){return p(r).replaceAll("-","_")}function g(r){return r?` from extension "${r}"`:""}function c(r){return[...new Set(r)].sort((e,t)=>e.localeCompare(t))}function y(r){if(typeof r!="string")throw new Error('A command name string is required. Pass it via the options object, e.g. runRegisteredCommandForTest(activation, { command: "my command" }) \u2014 positional command arguments are not supported.');return r.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0).join(" ")}function m(r){return r.length>0?r.join(", "):"(none)"}function we(r,e,t){let n=new Set(r??[]),a=c(e.filter(i=>!n.has(i)));if(a.length>0)throw new Error(`Expected package manifest ${t} to include ${a.join(", ")}; available: ${m(c(r??[]))}`)}function Ee(r){let e=new Set;for(let t of r)typeof t.long=="string"&&t.long.trim().length>0&&e.add(t.long.trim()),typeof t.short=="string"&&t.short.trim().length>0&&e.add(t.short.trim());return e}function P(r){let e=w(r);if(!e)return{};let t=w(e.manifest);if(t)return t;let n=w(e.default);return w(n?.manifest)||(n&&typeof e.default!="function"&&("name"in n||"capabilities"in n)?n:typeof r!="function"&&("name"in e||"capabilities"in e)?e:{})}function T(r,e){return e??(typeof r.name=="string"&&r.name.trim().length>0?r.name.trim():"test-extension")}function be(r,e){return Array.isArray(e.capabilities)?[...e.capabilities]:Array.isArray(r.capabilities)?r.capabilities.filter(t=>typeof t=="string"):[]}function xe(r,e,t){return{disabled_by_flag:!1,roots:{global:"",project:""},configured_enabled:[],configured_disabled:[],discovered:[],effective:[],warnings:[],policy:t.policy,failed:[],loaded:[{layer:t.layer,directory:"",manifest_path:"",name:t.name,version:typeof e.version=="string"?e.version:"0.0.0",entry:typeof e.entry=="string"?e.entry:"./index.js",priority:typeof e.priority=="number"?e.priority:0,entry_path:"",capabilities:t.capabilities,manifest_version:typeof e.manifest_version=="number"?e.manifest_version:void 0,pm_min_version:typeof e.pm_min_version=="string"?e.pm_min_version:void 0,pm_max_version:typeof e.pm_max_version=="string"?e.pm_max_version:void 0,engines:e.engines,trusted:e.trusted,provenance:e.provenance,sandbox_profile:e.sandbox_profile,permissions:e.permissions,activation:e.activation,module:r}]}}async function Qe(r,e={}){let t=P(r);return oe(xe(r,t,{name:T(t,e.name),layer:e.layer??"project",capabilities:be(t,e),policy:e.policy??C()}))}async function Ze(r,e={}){let t=P(r);return ne(xe(r,t,{name:T(t,e.name),layer:e.layer??"project",capabilities:be(t,{}),policy:C()}),e.activation,e.deactivateTimeoutMs===void 0?{}:{deactivate_timeout_ms:e.deactivateTimeoutMs})}async function I(r,e){let t=y(e.command);if(t.length===0)throw new Error("Expected command name must be a non-empty string");if(!r.handlers.some(o=>o.command===t)){let o=c(r.handlers.map(s=>s.command));throw new Error(`Expected a registered command handler for "${t}" to invoke. Available command handlers: ${m(o)}`)}if(e.sdk!==void 0&&e.sdkFactory!==void 0)throw new TypeError("runRegisteredCommandForTest accepts sdk or sdkFactory, not both");let n=e.pmRoot??"",a={json:!0,quiet:!0,noPager:!0,...e.global},i=e.sdk??e.sdkFactory?.({pmRoot:n,global:a})??(n.length>0?se(n,new pe({pmRoot:n}),void 0,t):void 0);return J(r,{command:t,args:e.args?[...e.args]:[],options:e.options?{...e.options}:{},global:a,pm_root:n,...i===void 0?{}:{sdk:i}})}async function er(r,e){if((r.beforeMutation?.length??0)===0)throw new Error("Expected a registered before_mutation hook to invoke");await z(r,e.context)}async function rr(r,e){let t=e.kind;if(t==="before_mutation")throw new Error("Invoke before_mutation hooks with runRegisteredMutationGuardForTest so denials and failures retain fail-closed semantics.");if((r[F[t]]?.length??0)===0){let n=c(Object.keys(F).filter(a=>(r[F[a]]?.length??0)>0));throw new Error(`Expected a registered "${t}" hook to invoke. Hook kinds with registrations: ${m(n)}`)}switch(e.kind){case"before_command":return V(r,e.context);case"after_command":return W(r,e.context);case"on_read":return Y(r,e.context);case"on_write":return G(r,e.context);case"on_index":return X(r,e.context)}}async function tr(r,e){let t=y(e.command);if(!r.overrides.some(n=>n.command===t))throw new Error(`Expected a registered parser override for command "${t}" to invoke. Available parser override commands: ${m(c(r.overrides.map(n=>n.command)))}`);return Q(r,e)}async function nr(r,e){if(r.overrides.length===0)throw new Error("Expected a registered preflight override to invoke, but none are registered.");return Z(r,e)}async function or(r,e){let t=y(e.command);if(!r.overrides.some(n=>n.command===t))throw new Error(`Expected a registered command override for command "${t}" to invoke. Available command override commands: ${m(c(r.overrides.map(n=>n.command)))}`);return re(r,e)}async function ir(r,e){if(!r.overrides.some(t=>t.format===e.format))throw new Error(`Expected a registered renderer override for format "${e.format}" to invoke. Available renderer override formats: ${m(c(r.overrides.map(t=>t.format)))}`);return te(r,e)}async function ar(r,e){if(!r.overrides.some(t=>t.service===e.service))throw new Error(`Expected a registered service override for service "${e.service}" to invoke. Available service override services: ${m(c(r.overrides.map(t=>t.service)))}`);return ee(r,e)}var sr={query:["query"],embed:["embed"],embedBatch:["embedBatch","embed_batch"],queryExpansion:["queryExpansion","query_expansion"],rerank:["rerank"]};async function dr(r,e){let t=de(r,e.provider);if(!t){let i=c(r.search_providers.map(o=>o.definition.name));throw new Error(`Expected a registered search provider "${e.provider}" to invoke. Available search providers: ${m(i)}`)}let n=t.runtime_definition,a=sr[e.operation].map(i=>n[i]).find(i=>typeof i=="function");if(typeof a!="function")throw new Error(`Registered search provider "${e.provider}" does not implement the "${e.operation}" operation.`);return await a(e.context)}async function mr(r,e){let t=me(r,e.adapter);if(!t){let a=c(r.vector_store_adapters.map(i=>i.definition.name));throw new Error(`Expected a registered vector store adapter "${e.adapter}" to invoke. Available vector store adapters: ${m(a)}`)}let n=t.runtime_definition[e.operation];if(typeof n!="function")throw new Error(`Registered vector store adapter "${e.adapter}" does not implement the "${e.operation}" operation.`);return await n(e.context)}async function cr(r,e){let t=ke(r,{migration:e.migration,extensionName:e.extensionName}),n=ce(t).run;if(typeof n!="function")throw new Error(`Registered migration "${e.migration}" does not implement a run function to invoke.`);let a=t.definition.status,i={id:t.definition.id,command:"migration",layer:t.layer,extension:t.name,pm_root:e.pmRoot??"",status:(typeof a=="string"?a.trim().toLowerCase():"")||"pending"};return await n(i)}async function lr(r,e){let t=_e(r.registrations,{importer:e.importer,extensionName:e.extensionName});return I(r.commands,{command:`${t.importer} import`,args:e.args,options:e.options,global:e.global,pmRoot:e.pmRoot})}async function fr(r,e){let t=$e(r.registrations,{exporter:e.exporter,extensionName:e.extensionName});return I(r.commands,{command:`${t.exporter} export`,args:e.args,options:e.options,global:e.global,pmRoot:e.pmRoot})}function Qr(r,e={}){let t=e.deactivated??1;if(r.deactivated!==t)throw new Error(`Expected ${t} extension${t===1?"":"s"} to deactivate cleanly, but ${r.deactivated} did.`);let n=e.failed??0;if(r.failed.length!==n){let a=r.failed.map(i=>`${i.layer}:${i.name} (${i.error})`).join(", ");throw new Error(`Expected ${n} teardown failure${n===1?"":"s"}, but observed ${r.failed.length}${a.length>0?`: ${a}`:""}.`)}return r}function Zr(r,e){if(e.packageName!==void 0&&r.package_name!==e.packageName)throw new Error(`Expected package manifest package_name to be "${e.packageName}"; received "${r.package_name??"(none)"}"`);if(e.aliases!==void 0&&we(r.aliases,e.aliases,"aliases"),e.resources!==void 0)for(let[t,n]of Object.entries(e.resources))we(r.resources[t],n,`pm.${t}`);return r}function pr(r,e){let t=y(u(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.commands.filter(o=>o.command===t),a=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!a){let o=r.commands.map(d=>d.command).sort((d,l)=>d.localeCompare(l)),s=e.extensionName?` from extension "${e.extensionName}"`:"";throw new Error(`Expected extension command "${t}"${s} to be registered. Available commands: ${m(o)}`)}if(e.action!==void 0&&a.action!==e.action)throw new Error(`Expected extension command "${t}" action "${e.action}", received "${a.action}"`);if(e.arguments!==void 0){let o=(a.arguments??[]).map(d=>d.name),s=e.arguments.filter(d=>!o.includes(d));if(s.length>0)throw new Error(`Expected extension command "${t}" arguments ${m(e.arguments)}; missing ${m(s)}; available ${m(o)}`)}let i=r.flags.filter(o=>o.target_command===t&&(e.extensionName===void 0||o.name===e.extensionName)).flatMap(o=>o.flags);if(e.flags!==void 0){let o=Ee(i),s=e.flags.filter(d=>!o.has(d));if(s.length>0)throw new Error(`Expected extension command "${t}" flags ${m(e.flags)}; missing ${m(s)}; available ${m([...o].sort((d,l)=>d.localeCompare(l)))}`)}return{command:a,flags:i}}function gr(r,e){let t=y(u(e,e.targetCommand));if(t.length===0)throw new Error("Expected target command name must be a non-empty string");let n=r.flags.filter(i=>i.target_command===t),a;if(e.extensionName)a=n.find(i=>i.name===e.extensionName);else if(n.length===1)a=n[0];else if(n.length>1){let i=c(n.map(o=>o.name));throw new Error(`Expected flags for target command "${t}" matched multiple extensions: ${m(i)}. Specify extensionName to choose one registration.`)}if(!a){let i=c(r.flags.map(s=>s.target_command)),o=c(n.map(s=>s.name));throw new Error(`Expected flags for target command "${t}"${g(e.extensionName)} to be registered. Available flag target commands: ${m(i)}; matching extensions: ${m(o)}`)}if(e.flags!==void 0){let i=Ee(a.flags),o=e.flags.filter(s=>!i.has(s));if(o.length>0)throw new Error(`Expected flags for target command "${t}" to include ${m(e.flags)}; missing ${m(o)}; available ${m([...i].sort((s,d)=>s.localeCompare(d)))}`)}return a}function ur(r,e){let t=Je[e.kind],n=r[t]??[],a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(n.map(o=>o.name));throw new Error(`Expected a "${e.kind}" hook${g(e.extensionName)} to be registered. Available "${e.kind}" hooks: ${m(i)}`)}return a}function vr(r,e){let t=p(u(e,e.provider));if(t.length===0)throw new Error("Expected search provider name must be a non-empty string");let n=r.search_providers.filter(i=>p(i.definition.name)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.search_providers.map(o=>o.definition.name));throw new Error(`Expected search provider "${t}"${g(e.extensionName)} to be registered. Available search providers: ${m(i)}`)}return a}function hr(r,e){let t=p(u(e,e.adapter));if(t.length===0)throw new Error("Expected vector store adapter name must be a non-empty string");let n=r.vector_store_adapters.filter(i=>p(i.definition.name)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.vector_store_adapters.map(o=>o.definition.name));throw new Error(`Expected vector store adapter "${t}"${g(e.extensionName)} to be registered. Available vector store adapters: ${m(i)}`)}return a}function _e(r,e){let t=p(u(e,e.importer));if(t.length===0)throw new Error("Expected importer name must be a non-empty string");let n=r.importers.filter(i=>p(i.importer)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.importers.map(o=>o.importer));throw new Error(`Expected importer "${t}"${g(e.extensionName)} to be registered. Available importers: ${m(i)}`)}return a}function $e(r,e){let t=p(u(e,e.exporter));if(t.length===0)throw new Error("Expected exporter name must be a non-empty string");let n=r.exporters.filter(i=>p(i.exporter)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.exporters.map(o=>o.exporter));throw new Error(`Expected exporter "${t}"${g(e.extensionName)} to be registered. Available exporters: ${m(i)}`)}return a}function yr(r,e){let t=p(u(e,e.field));if(t.length===0)throw new Error("Expected item field name must be a non-empty string");let n=r.item_fields.filter(a=>e.extensionName===void 0||a.name===e.extensionName).map(a=>({registration:a,field:a.fields.find(i=>p(i.name)===t)})).filter(a=>a.field!==void 0).find(a=>e.type===void 0||a.field.type===e.type);if(!n){let a=c(r.item_fields.flatMap(i=>i.fields.map(o=>`${o.name}:${o.type}`)));throw new Error(`Expected item field "${t}"${g(e.extensionName)} to be registered. Available item fields: ${m(a)}`)}return n}function wr(r,e){let t=p(u(e,e.itemType));if(t.length===0)throw new Error("Expected item type name must be a non-empty string");let n=r.item_types.filter(a=>e.extensionName===void 0||a.name===e.extensionName).map(a=>({registration:a,itemType:a.types.find(i=>p(i.name)===t)})).filter(a=>a.itemType!==void 0).find(a=>e.folder===void 0||a.itemType.folder===e.folder);if(!n){let a=c(r.item_types.flatMap(i=>i.types.map(o=>`${o.name}:${o.folder}`)));throw new Error(`Expected item type "${t}"${g(e.extensionName)} to be registered. Available item types: ${m(a)}`)}return n}function Er(r,e){let t=ye(u(e,e.profile));if(t.length===0)throw new Error("Expected profile name must be a non-empty string");let n=r.profiles.filter(a=>e.extensionName===void 0||a.name===e.extensionName).find(a=>ye(a.profile.name)===t);if(!n){let a=c(r.profiles.map(i=>i.profile.name));throw new Error(`Expected profile "${t}"${g(e.extensionName)} to be registered. Available profiles: ${m(a)}`)}return{registration:n,profile:n.profile}}function br(r,e){let t=y(u(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.overrides.filter(i=>i.command===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.overrides.map(o=>o.command));throw new Error(`Expected command override "${t}"${g(e.extensionName)} to be registered. Available command overrides: ${m(i)}`)}return a}function xr(r,e){let t=y(u(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.overrides.filter(i=>i.command===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.overrides.map(o=>o.command));throw new Error(`Expected parser override "${t}"${g(e.extensionName)} to be registered. Available parser overrides: ${m(i)}`)}return a}function _r(r,e={}){let t=e.extensionName?r.overrides.find(n=>n.name===e.extensionName):r.overrides[0];if(!t){let n=c(r.overrides.map(a=>a.name));throw new Error(`Expected a preflight override${g(e.extensionName)} to be registered. Available preflight overrides: ${m(n)}`)}return t}function $r(r,e){let t=p(u(e,e.format));if(t.length===0)throw new Error("Expected renderer format must be a non-empty string");let n=r.overrides.filter(i=>i.format===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.overrides.map(o=>o.format));throw new Error(`Expected renderer override "${t}"${g(e.extensionName)} to be registered. Available renderer overrides: ${m(i)}`)}return a}function kr(r,e){let t=p(u(e,e.service));if(t.length===0)throw new Error("Expected service name must be a non-empty string");let n=r.overrides.filter(i=>p(i.service)===t),a=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!a){let i=c(r.overrides.map(o=>o.service));throw new Error(`Expected service override "${t}"${g(e.extensionName)} to be registered. Available service overrides: ${m(i)}`)}return a}function ke(r,e){let t=p(u(e,e.migration));if(t.length===0)throw new Error("Expected migration id must be a non-empty string");let n=r.migrations.filter(s=>(e.extensionName===void 0||s.name===e.extensionName)&&typeof s.definition.id=="string"&&p(s.definition.id)===t),a=n.find(s=>e.mandatory===void 0||(s.definition.mandatory??!1)===e.mandatory);if(a)return a;let i=n[0];if(i!==void 0)throw new Error(`Expected migration "${t}"${g(e.extensionName)} to have mandatory=${e.mandatory}, but it is mandatory=${i.definition.mandatory??!1}.`);let o=c(r.migrations.map(s=>`${typeof s.definition.id=="string"&&s.definition.id.trim().length>0?s.definition.id.trim():"(unnamed)"}:${s.definition.mandatory===!0}`));throw new Error(`Expected migration "${t}"${g(e.extensionName)} to be registered. Available migrations: ${m(o)}`)}function Cr(r,e){let t=(d,l)=>{let b=new Set;for(let M of d){let j=x(M);if(j===null)throw new Error(`Expected ${l} capability "${M}" to be a known extension capability. Use canonical capability names (see manifest.capabilities).`);b.add(j)}return b},n=[...t(e.declared,"declared")].sort((d,l)=>d.localeCompare(l)),a=t(e.allowUnused??[],"allowUnused"),i=ie(r,{extensionName:e.extensionName}),o=new Set(i),s=n.filter(d=>!o.has(d)&&!a.has(d));if(s.length>0){let d=g(e.extensionName);throw new Error(`Expected every declared capability${d} to be exercised, but [${s.join(", ")}] ${s.length===1?"is":"are"} declared yet never registered against. Remove ${s.length===1?"it":"them"} from manifest.capabilities for least privilege, or pass allowUnused for capabilities registered only behind a runtime flag.`)}return{declared:n,used:i,unused:s}}function et(r,e={}){let t=k(r,e);if(!t.ok){let n=t.findings.filter(a=>a.severity==="error");throw new Error(`Extension blueprint failed preflight with ${n.length} ${n.length===1?"error":"errors"}:
2
2
  `+n.map(a=>` - [${a.code}] ${a.message}`).join(`
3
3
  `))}return t}function rt(r,e={}){let t=fe(r),n=t.findings.filter(a=>a.severity==="error"||e.strict===!0&&a.severity==="warning");if(n.length>0)throw new Error(`Project profile "${t.profile}" failed lint with ${n.length} ${n.length===1?"issue":"issues"}:
4
4
  `+n.map(a=>` - ${a.severity} [${a.code}] ${a.message}`).join(`
5
5
  `));return t}function tt(r,e){let t=Array.isArray(r.capabilities)?r.capabilities:[],n=k(e,{declaredCapabilities:t}),a=n.declared,i=new Set(a),o=new Set(n.used),s=n.used.filter(l=>!i.has(l)),d=a.filter(l=>!o.has(l));if(s.length>0||d.length>0){let l=[];throw s.length>0&&l.push(`missing [${s.join(", ")}] (the blueprint registers ${s.length===1?"a surface":"surfaces"} requiring ${s.length===1?"it":"them"}; activation throws extension_capability_missing)`),d.length>0&&l.push(`unused [${d.join(", ")}] (declared but no surface exercises ${d.length===1?"it":"them"}; drop for least privilege)`),new Error(`Manifest capabilities do not match the blueprint: ${l.join("; ")}. Set capabilities to synthesizeExtensionManifest(blueprint, identity).capabilities to stay in sync.`)}return{used:n.used,declared:a,missing:s,unused:d,findings:n.findings}}function nt(r,e){let t=A(r,e),n=t.findings.filter(a=>a.severity==="error");if(n.length>0)throw new Error(`Extension manifest is not compatible with pm ${t.pmVersion}: ${n.map(a=>a.message).join("; ")}`);return t}function ot(r,e={}){let t=he(r,e);if(!t.ok){let n=t.findings.filter(a=>a.severity==="error");throw new Error(`Extension failed preflight with ${n.length} ${n.length===1?"error":"errors"}:
6
6
  `+n.map(a=>` - [${a.source}:${a.code}] ${a.message}`).join(`
7
7
  `))}return t}function Rr(r){if(!B(r))throw new Error("createExtensionTestHarness received a module with no activate export. Pass the extension module (with an activate(api) function on the module or its default export) as the first argument, and options second.")}async function it(r,e={}){Rr(r);let t=P(r),n=T(t,e.name),a=e.layer??"project",i=await Qe(r,e);if(i.failed.length>0){let o=i.failed.map(s=>{let d=s.trace?.missing_capability,l=d?`${s.error}; missing capability "${d}"`:s.error;return`${s.layer}:${s.name} (${l})`}).join(", ");throw new Error(`createExtensionTestHarness could not activate the extension cleanly: ${o}. Declare the required capability in the manifest (or pass it via options.capabilities), or use activateExtensionForTest directly to inspect a failed activation.`)}return{module:r,name:n,layer:a,activation:i,activationSummary(o){return R(i,o)},renderMarkdown(o={}){let{extensionName:s,...d}=o??{};return le(R(i,{extensionName:s}),d)},assertCommandContract(o){return pr(i.registrations,o)},assertFlags(o){return gr(i.registrations,o)},assertItemField(o){return yr(i.registrations,o)},assertItemType(o){return wr(i.registrations,o)},assertProfile(o){return Er(i.registrations,o)},assertHook(o){return ur(i.hooks,o)},assertCommandOverride(o){return br(i.commands,o)},assertParserOverride(o){return xr(i.parsers,o)},assertPreflightOverride(o){return _r(i.preflight,o)},assertRendererOverride(o){return $r(i.renderers,o)},assertServiceOverride(o){return kr(i.services,o)},assertSearchProvider(o){return vr(i.registrations,o)},assertVectorStoreAdapter(o){return hr(i.registrations,o)},assertImporter(o){return _e(i.registrations,o)},assertExporter(o){return $e(i.registrations,o)},assertMigration(o){return ke(i.registrations,o)},assertCapabilityUsage(o){return Cr(i,o)},runCommand(o){return I(i.commands,o)},runHook(o){return rr(i.hooks,o)},runMutationGuard(o){return er(i.hooks,o)},runCommandOverride(o){return or(i.commands,o)},runParserOverride(o){return tr(i.parsers,o)},runPreflightOverride(o){return nr(i.preflight,o)},runRendererOverride(o){return ir(i.renderers,o)},runServiceOverride(o){return ar(i.services,o)},runSearchProvider(o){return dr(i.registrations,o)},runVectorStoreAdapter(o){return mr(i.registrations,o)},runMigration(o){return cr(i.registrations,o)},runImporter(o){return lr(i,o)},runExporter(o){return fr(i,o)},deactivate(o={}){return Ze(r,{name:n,layer:a,activation:i,deactivateTimeoutMs:o.deactivateTimeoutMs})}}}export{Ir as a,Mr as b,Oe as c,jr as d,N as e,qe as f,k as g,ve as h,Br as i,A as j,he as k,Qe as l,Ze as m,I as n,er as o,rr as p,tr as q,nr as r,or as s,ir as t,ar as u,dr as v,mr as w,cr as x,lr as y,fr as z,Qr as A,Zr as B,pr as C,gr as D,ur as E,vr as F,hr as G,_e as H,$e as I,yr as J,wr as K,Er as L,br as M,xr as N,_r as O,$r as P,kr as Q,ke as R,Cr as S,et as T,rt as U,tt as V,nt as W,ot as X,it as Y};
8
- //# sourceMappingURL=chunk-RUT3CCAG.js.map
8
+ //# sourceMappingURL=chunk-B465HPS5.js.map
@@ -1,4 +1,4 @@
1
- import{a as nt,b as Tn,c as gc,d as yc,g as bc,i as qc}from"./chunk-K2UTE75T.js";import{A as ol,P as Qo,Y as rl,d as Ao,e as zc,g as Hc,h as Wc,i as Vc,o as Bc,p as Mt,q as Ge,r as Xo,y as Zo}from"./chunk-2JYTSTQP.js";import{$c as Ko,Aa as mc,Ba as pc,Ca as Sn,Da as uc,Ea as In,Fa as An,Ga as _c,Gb as Nc,Gd as er,Ia as et,J as Le,Ja as fc,Jb as Dc,Jd as ul,Ka as Mo,Kb as Mc,La as En,Mc as zo,Na as tt,Pb as Nt,Pc as Ie,Qc as Kc,Qd as _l,Rc as Wo,Rd as fl,Sc as Jc,Tc as Yc,Uc as ot,Vc as Xc,Wa as hc,Yc as el,Zc as tl,_c as nl,ad as Jo,b as Lo,bd as Yo,ed as al,fc as xn,fd as sl,ga as fn,gd as cl,ha as ic,hd as ll,i as xs,ia as Pt,id as dl,j as Os,ja as h,ka as ac,kd as ml,l as $s,la as sc,ld as pl,mb as vc,mc as Gc,na as Y,nb as kc,oa as cc,oc as Uc,pa as wn,qa as lc,ra as No,sa as Lt,sb as jo,ta as vn,tb as Go,ua as Me,ub as Uo,va as dc,vc as Dt,wa as kn,wb as Sc,xa as U,xb as Ic,ya as Do,yb as qo,za as j}from"./chunk-KNW3RSLS.js";import{$a as bn,E as Fs,K as Ps,M as Ne,N as Ls,O as gn,P as Ns,Pa as Qe,Q as De,R as Ds,S as yn,T as Ms,Wa as nc,Z as js,aa as Gs,c as _a,ca as Us,da as qs,db as oc,ea as zs,fa as Hs,ga as Ws,gb as rc,ha as Vs,i as hn,ia as Bs,ja as Ks,ka as Js,la as Ys,ma as Xs,na as Zs,oa as Qs,pa as ec,qa as tc}from"./chunk-SSY4OSJR.js";import{$a as Ac,Ab as Lc,Eb as Se,Fb as jc,Gb as Rn,Kb as Ho,Vc as Vo,Yb as Zc,Zb as Qc,_c as Bo,bd as il,d as pa,f as ua,jb as Ec,kb as Tc,lb as Cc,na as de,ob as Rc,pb as xc,qb as Oc,rb as $c,tb as je,ua as wc,ub as Fc,vb as Pc,yb as Cn}from"./chunk-RBPOO46D.js";import{$ as oe,$i as da,$j as Ia,$k as qa,$l as ss,$m as Is,A as pi,Ac as go,Al as mn,Ao as Cs,B as ui,Bb as bi,Bc as yo,Bf as Wi,Bg as Fe,Bk as Ca,Bm as un,C as _i,Cb as wi,Cc as bo,Cj as ha,Cl as re,Cm as _s,D as fi,Db as vi,Dc as wo,Dg as Ye,Dk as Ra,Eb as ki,Ec as $,Ef as Ke,Ei as Eo,Ej as ga,El as Xa,Fb as Si,Fi as To,Fj as an,Fl as Za,G as hi,Gb as Ii,Gj as ya,Hb as Ai,Hg as nn,If as Vi,Ig as Tt,Il as $t,Im as fs,Ja as so,Jc as Ti,Jg as vo,Jk as xa,Jl as Qa,Jm as hs,Ka as co,Kc as Ci,Kk as Oa,Kl as es,La as lo,Li as sa,Lk as $a,Ll as ts,Ln as Fo,Ma as mo,Md as tn,Mj as ba,Ml as ns,Mo as Rs,Nc as G,Nm as Ro,Nn as Po,Oh as Ct,Oi as Ze,Ok as Fa,Pe as ji,Ph as Rt,Pm as xo,Qj as wa,R as u,Rc as Ri,Rl as Co,Sc as xi,Sf as Bi,Sk as Pa,Sl as os,T as p,Tf as F,Tk as La,Tl as Pe,Tm as gs,Ub as It,Uk as Na,Um as ys,V as ye,Va as P,Vb as At,Vg as Qi,Vj as va,Vk as Da,Vl as rs,Vm as bs,W as Be,Wa as Yt,Wc as H,We as Gi,Wg as ea,Wj as ka,Wk as Ma,Wl as is,Wm as ws,X as oo,Xc as en,Xg as ta,Xm as vs,Y as se,Yi as ca,Yj as Sa,Yk as ja,Yl as pn,Ze as Ui,Zk as Ga,Zm as ks,_i as la,_k as Ua,_l as as,_m as Ss,aa as kt,aj as ce,al as za,am as cs,an as Ft,bb as A,bj as ve,bl as Ha,bn as As,cd as Oi,cn as _n,dd as $i,dn as Es,eb as we,ee as Ni,ej as xt,el as Wa,en as Oo,f as J,fb as po,fe as Di,fg as Je,fl as sn,fn as $o,gf as S,gg as Oe,gl as Va,gn as Ts,h as no,ha as gi,hb as xe,hg as Ki,hi as na,hj as rn,hl as Ba,ie as Mi,ig as Ji,ii as Xe,j as di,ja as yi,jg as $e,ka as be,kf as qi,kg as Yi,kj as Ot,km as ls,lc as Xt,lh as ko,li as on,lj as ma,ll as ke,mc as Zt,mf as zi,mh as R,ml as E,na as ro,nc as Qt,nf as te,ng as V,ni as oa,nl as Ka,oi as ra,ol as Ja,om as ds,p as Jt,pc as Ei,pg as Et,pi as ia,pk as Aa,qa as io,qg as Xi,ra as St,rd as Fi,ri as So,si as Io,sk as Ea,sm as ms,ta as ao,tf as Hi,tj as fa,tk as Ta,u as Ve,ud as Pi,ug as Zi,ui as T,vc as uo,vi as aa,vm as le,w as mi,wl as Ya,xc as _o,xd as Li,xl as cn,yc as fo,yl as ln,ym as ps,zc as ho,zl as dn,zm as us}from"./chunk-YMLF6QT7.js";import{AsyncLocalStorage as Dg}from"node:async_hooks";import{readFile as _p}from"node:fs/promises";import fp from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="20a3a324-d176-5918-8167-5e548be4abc9")}catch{}})();var tr="context-intents.json";function On(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function hp(e,t,n){if(!On(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let o=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(o)||!o.every(r=>typeof r=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:o,token_budget:e.token_budget}}function hl(e,t){let n=Array.isArray(e)?e:On(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((o,r)=>hp(o,t,r))}async function gp(e){let t=fp.join(e,tr),n;try{n=await _p(t,"utf8")}catch(r){if(Be(r))return[];throw await Bi(e),r}let o;try{o=JSON.parse(n)}catch(r){let i=r instanceof Error?r.message:String(r);throw new TypeError(`Invalid ${tr}: ${i}`,{cause:r})}return hl(o,tr)}function yp(e){if(!On(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return On(n)?n.contextIntents??n.context_intents:void 0}function bp(e){return e.flatMap(t=>{let n=yp(t.module);return n===void 0?[]:hl(n,`package ${t.name}`)})}async function wp(e){let t=await gp(e.pmRoot),n=bp(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function $n(e,t){let n=await wp(e);return await Wi(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0a4abc17-0fcb-573f-8f89-6e505e112261")}catch{}})();async function gl(e,t,n=Hi){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let o=t,r=Array.isArray(o.warnings)?o.warnings.filter(i=>typeof i=="string"):[];o.warnings=[...new Set([...r,"context_usage_feedback_write_failed"])].sort()}}}import{createHash as Cp}from"node:crypto";import{constants as jt}from"node:fs";import{lstat as yl,mkdir as or,open as bl}from"node:fs/promises";import me from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function nr(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function rr(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function vp(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function kp(e,t,n,o){let r=n.require(e.kind),i=o.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let a=o.incomingOne.get(`${r.kind}\0${e.target}`);if(a!==void 0&&a!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let s=rr(e,n),c=o.identities.get(s);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${s}`)}function Sp(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function Ip(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=nr(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:nr(e.relationshipId,"relationshipId"),author:nr(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function Ap(e,t,n,o,r,i){let a=n.has(t);if(e.action==="add"&&a)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!a)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let s=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(s)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${s} -> ${c}`);let l=new Ve([s,c],[e.edge],r).edges()[0];return kp(l,t,r,i),vp(l)}var Gt=class{#t;#n;#o=[];#i=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Jt()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<o;i+=r)yield Object.freeze(this.#o.slice(i,Math.min(i+r,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,a;for(let s of this.stream({...o,batchSize:256}))for(let c of s)r=n(r,c),i+=1,a=c;return Object.freeze({state:r,version:a?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:i,...a===void 0?{}:{asOf:a.timestamp}})}#a(t,n){let o=this.#n.require(n.kind);this.#r.identities.set(rr(n,this.#n),t),o.outgoing==="one"&&this.#r.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#r.incomingOne.set(`${o.kind}\0${n.target}`,t)}#s(t){let n=this.#n.require(t.kind);this.#r.identities.delete(rr(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=Ip(t,this.version,this.#i),o=this.#e.get(n.relationshipId),r=Ap(t,n.relationshipId,this.#e,this.#t,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(i),this.#i.add(n.eventId),o&&this.#s(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,r),this.#a(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(a=>Date.parse(a.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#o.slice(0,i)}let o=Sp(n),r=new Ve(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Fi("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Pi(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=Li(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(o)});return{version:o,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},Ep="relationship-event-store",wl=jt.O_NOFOLLOW;function Fn(e){return te(e,Ep,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Ue(e,t="relationships/events.jsonl"){let n=me.resolve(e),o=me.resolve(n,t),r=me.relative(n,o);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${me.sep}`)||me.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await or(n,{recursive:!0}),(await yl(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of r.split(me.sep)){i=me.join(i,a);try{if((await yl(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(s){if(oo(s))break;throw s}}return o}async function Pn(e,t,n){let o=new Gt(t,{registry:n}),r,i;try{i=await bl(e,jt.O_RDONLY|wl),r=await i.readFile("utf8")}catch(s){if(oo(s))return{log:o,raw:""};throw s}finally{await i?.close()}let a=r.split(`
1
+ import{a as nt,b as Tn,c as gc,d as yc,g as bc,i as qc}from"./chunk-MHPU2LDF.js";import{A as ol,P as Qo,Y as rl,d as Ao,e as zc,g as Hc,h as Wc,i as Vc,o as Bc,p as Mt,q as Ge,r as Xo,y as Zo}from"./chunk-3LQTJN4J.js";import{$c as Ko,Aa as mc,Ba as pc,Ca as Sn,Da as uc,Ea as In,Fa as An,Ga as _c,Gb as Nc,Gd as er,Ia as et,J as Le,Ja as fc,Jb as Dc,Jd as ul,Ka as Mo,Kb as Mc,La as En,Mc as zo,Na as tt,Pb as Nt,Pc as Ie,Qc as Kc,Rc as Wo,Sc as Jc,Sd as _l,Tc as Yc,Td as fl,Uc as ot,Vc as Xc,Wa as hc,Yc as el,Zc as tl,_c as nl,ad as Jo,b as Lo,bd as Yo,ed as al,fc as xn,fd as sl,ga as fn,gd as cl,ha as ic,hd as ll,i as xs,ia as Pt,id as dl,j as Os,ja as h,ka as ac,kd as ml,l as $s,la as sc,ld as pl,mb as vc,mc as Gc,na as Y,nb as kc,oa as cc,oc as Uc,pa as wn,qa as lc,ra as No,sa as Lt,sb as jo,ta as vn,tb as Go,ua as Me,ub as Uo,va as dc,vc as Dt,wa as kn,wb as Sc,xa as U,xb as Ic,ya as Do,yb as qo,za as j}from"./chunk-M5NDSW6E.js";import{$a as bn,E as Fs,K as Ps,M as Ne,N as Ls,O as gn,P as Ns,Pa as Qe,Q as De,R as Ds,S as yn,T as Ms,Wa as nc,Z as js,aa as Gs,c as _a,ca as Us,da as qs,db as oc,ea as zs,fa as Hs,ga as Ws,gb as rc,ha as Vs,i as hn,ia as Bs,ja as Ks,ka as Js,la as Ys,ma as Xs,na as Zs,oa as Qs,pa as ec,qa as tc}from"./chunk-GUVKPOY6.js";import{$a as Ac,Ab as Lc,Eb as Se,Fb as jc,Gb as Rn,Kb as Ho,Vc as Vo,Yb as Zc,Zb as Qc,_c as Bo,bd as il,d as pa,f as ua,jb as Ec,kb as Tc,lb as Cc,na as de,ob as Rc,pb as xc,qb as Oc,rb as $c,tb as je,ua as wc,ub as Fc,vb as Pc,yb as Cn}from"./chunk-JRRXWH5B.js";import{$ as oe,$i as la,$k as Ua,$l as as,$m as Ss,A as pi,Ac as go,Al as dn,Am as us,B as ui,Bb as bi,Bc as yo,Bf as Wi,Bg as Fe,Bl as mn,Bo as Cs,C as _i,Cb as wi,Cc as bo,Ck as Ca,Cm as un,D as fi,Db as vi,Dc as wo,Dg as Ye,Dj as ha,Dl as re,Dm as _s,Eb as ki,Ec as $,Ef as Ke,Ek as Ra,Fb as Si,Fi as Eo,Fj as ga,Fl as Xa,G as hi,Gb as Ii,Gi as To,Gj as an,Gl as Za,Hb as Ai,Hj as ya,If as Vi,Ig as nn,Ja as so,Jc as Ti,Jg as Tt,Jl as $t,Jm as fs,Ka as co,Kc as Ci,Kg as vo,Kk as xa,Kl as Qa,Km as hs,La as lo,Lk as Oa,Ll as es,Ma as mo,Md as tn,Mi as sa,Mk as $a,Ml as ts,Mn as Fo,Nc as G,Nj as ba,Nl as ns,No as Rs,Om as Ro,On as Po,Pe as ji,Ph as Ct,Pi as Ze,Pk as Fa,Qh as Rt,Qm as xo,R as u,Rc as Ri,Rj as wa,Sc as xi,Sf as Bi,Sl as Co,T as p,Tf as F,Tk as Pa,Tl as os,Ub as It,Uk as La,Ul as Pe,Um as gs,V as ye,Va as P,Vb as At,Vk as Na,Vm as ys,W as Be,Wa as Yt,Wc as H,We as Gi,Wg as Qi,Wj as va,Wk as Da,Wl as rs,Wm as bs,X as oo,Xc as en,Xg as ea,Xj as ka,Xk as Ma,Xl as is,Xm as ws,Y as se,Yg as ta,Ym as vs,Ze as Ui,Zi as ca,Zj as Sa,Zk as ja,Zl as pn,_k as Ga,_m as ks,aa as kt,aj as da,ak as Ia,al as qa,am as ss,an as Is,bb as A,bj as ce,bl as za,bm as cs,bn as Ft,cd as Oi,cj as ve,cl as Ha,cn as As,dd as $i,dn as _n,eb as we,ee as Ni,en as Es,f as J,fb as po,fe as Di,fg as Je,fj as xt,fl as Wa,fn as Oo,gf as S,gg as Oe,gl as sn,gn as $o,h as no,ha as gi,hb as xe,hg as Ki,hl as Va,hn as Ts,ie as Mi,ig as Ji,ii as na,ij as rn,il as Ba,j as di,ja as yi,jg as $e,ji as Xe,ka as be,kf as qi,kg as Yi,lc as Xt,lj as Ot,lm as ls,mc as Zt,mf as zi,mh as ko,mi as on,mj as ma,ml as ke,na as ro,nc as Qt,nf as te,ng as V,nh as R,nl as E,oi as oa,ol as Ka,p as Jt,pc as Ei,pg as Et,pi as ra,pl as Ja,pm as ds,qa as io,qg as Xi,qi as ia,qk as Aa,ra as St,rd as Fi,si as So,ta as ao,tf as Hi,ti as Io,tk as Ea,tm as ms,u as Ve,ud as Pi,ug as Zi,uj as fa,uk as Ta,vc as uo,vi as T,w as mi,wi as aa,wm as le,xc as _o,xd as Li,xl as Ya,yc as fo,yl as cn,zc as ho,zl as ln,zm as ps}from"./chunk-6PZPUJW3.js";import{AsyncLocalStorage as Dg}from"node:async_hooks";import{readFile as _p}from"node:fs/promises";import fp from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="20a3a324-d176-5918-8167-5e548be4abc9")}catch{}})();var tr="context-intents.json";function On(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function hp(e,t,n){if(!On(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let o=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(o)||!o.every(r=>typeof r=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:o,token_budget:e.token_budget}}function hl(e,t){let n=Array.isArray(e)?e:On(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((o,r)=>hp(o,t,r))}async function gp(e){let t=fp.join(e,tr),n;try{n=await _p(t,"utf8")}catch(r){if(Be(r))return[];throw await Bi(e),r}let o;try{o=JSON.parse(n)}catch(r){let i=r instanceof Error?r.message:String(r);throw new TypeError(`Invalid ${tr}: ${i}`,{cause:r})}return hl(o,tr)}function yp(e){if(!On(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return On(n)?n.contextIntents??n.context_intents:void 0}function bp(e){return e.flatMap(t=>{let n=yp(t.module);return n===void 0?[]:hl(n,`package ${t.name}`)})}async function wp(e){let t=await gp(e.pmRoot),n=bp(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function $n(e,t){let n=await wp(e);return await Wi(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0a4abc17-0fcb-573f-8f89-6e505e112261")}catch{}})();async function gl(e,t,n=Hi){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let o=t,r=Array.isArray(o.warnings)?o.warnings.filter(i=>typeof i=="string"):[];o.warnings=[...new Set([...r,"context_usage_feedback_write_failed"])].sort()}}}import{createHash as Cp}from"node:crypto";import{constants as jt}from"node:fs";import{lstat as yl,mkdir as or,open as bl}from"node:fs/promises";import me from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function nr(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function rr(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function vp(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function kp(e,t,n,o){let r=n.require(e.kind),i=o.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let a=o.incomingOne.get(`${r.kind}\0${e.target}`);if(a!==void 0&&a!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let s=rr(e,n),c=o.identities.get(s);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${s}`)}function Sp(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function Ip(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=nr(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:nr(e.relationshipId,"relationshipId"),author:nr(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function Ap(e,t,n,o,r,i){let a=n.has(t);if(e.action==="add"&&a)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!a)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let s=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(s)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${s} -> ${c}`);let l=new Ve([s,c],[e.edge],r).edges()[0];return kp(l,t,r,i),vp(l)}var Gt=class{#t;#n;#o=[];#i=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Jt()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<o;i+=r)yield Object.freeze(this.#o.slice(i,Math.min(i+r,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,a;for(let s of this.stream({...o,batchSize:256}))for(let c of s)r=n(r,c),i+=1,a=c;return Object.freeze({state:r,version:a?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:i,...a===void 0?{}:{asOf:a.timestamp}})}#a(t,n){let o=this.#n.require(n.kind);this.#r.identities.set(rr(n,this.#n),t),o.outgoing==="one"&&this.#r.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#r.incomingOne.set(`${o.kind}\0${n.target}`,t)}#s(t){let n=this.#n.require(t.kind);this.#r.identities.delete(rr(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=Ip(t,this.version,this.#i),o=this.#e.get(n.relationshipId),r=Ap(t,n.relationshipId,this.#e,this.#t,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(i),this.#i.add(n.eventId),o&&this.#s(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,r),this.#a(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(a=>Date.parse(a.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#o.slice(0,i)}let o=Sp(n),r=new Ve(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Fi("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Pi(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=Li(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(o)});return{version:o,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},Ep="relationship-event-store",wl=jt.O_NOFOLLOW;function Fn(e){return te(e,Ep,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Ue(e,t="relationships/events.jsonl"){let n=me.resolve(e),o=me.resolve(n,t),r=me.relative(n,o);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${me.sep}`)||me.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await or(n,{recursive:!0}),(await yl(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of r.split(me.sep)){i=me.join(i,a);try{if((await yl(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(s){if(oo(s))break;throw s}}return o}async function Pn(e,t,n){let o=new Gt(t,{registry:n}),r,i;try{i=await bl(e,jt.O_RDONLY|wl),r=await i.readFile("utf8")}catch(s){if(oo(s))return{log:o,raw:""};throw s}finally{await i?.close()}let a=r.split(`
2
2
  `);for(let s=0;s<a.length;s+=1){let c=a[s].trim();if(!c)continue;let l;try{l=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${s+1}`)}if(l.sequence!==o.version+1)throw new TypeError(`Invalid relationship event sequence at line ${s+1}`);o.append({eventId:l.eventId,relationshipId:l.relationshipId,action:l.action,...l.edge===void 0?{}:{edge:l.edge},author:l.author,timestamp:l.timestamp,...l.reason===void 0?{}:{reason:l.reason},expectedVersion:o.version})}return{log:o,raw:r}}function Tp(e,t,n,o){let r=Date.parse(t.timestamp),i;return t.action!=="remove"&&t.edge!==void 0&&(i=new Ve(n,[t.edge],o).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(r)&&e.timestamp===new Date(r).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&It(e.edge)===It(i)}var Ln=class e{#t;#n;#o;#i;#e;constructor(t,n,o,r){this.#t=t.pmRoot,this.#n=n,this.#o=t.registry,this.#i=o,this.#e=r}static async open(t){let n=Object.freeze([...t.nodes]),o=await Ue(t.pmRoot,t.relativePath),r=await Fn(t.pmRoot);try{await Ue(t.pmRoot,o);let{log:i}=await Pn(o,n,t.registry);return new e(t,n,o,i)}finally{await r()}}get path(){return this.#i}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(t){let n=await Fn(this.#t);try{let o=await Ue(this.#t,this.#i),{log:r}=await Pn(o,this.#n,this.#o),i=r.append(t);await or(me.dirname(o),{recursive:!0}),await Ue(this.#t,o);let a=await bl(o,jt.O_APPEND|jt.O_CREAT|jt.O_WRONLY|wl);try{await a.appendFile(`${JSON.stringify(i)}
3
3
  `,"utf8")}finally{await a.close()}return this.#e=r,i}finally{await n()}}async appendBatch(t,n={}){let o=await Fn(this.#t);try{let r=await Ue(this.#t,this.#i),{log:i,raw:a}=await Pn(r,this.#n,this.#o),s=i.version,c=new Map(i.events().map(d=>[d.eventId,d])),l=[],m=[];for(let d of t){let _=d.eventId.trim(),f=c.get(_);if(f!==void 0){if(n.existingEventPolicy==="skip_identical"&&Tp(f,d,this.#n,this.#o)){m.push(f.eventId);continue}if(n.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${_}`)}let w=i.append(d);c.set(w.eventId,w),l.push(w)}if(l.length>0){let d=a.length===0||a.endsWith(`
4
4
  `)?a:`${a}
@@ -2245,4 +2245,4 @@ compdef _pm pm`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"
2245
2245
  `);M(e.progressEnabled,"writing keyword artifacts"),await oe(t,`${JSON.stringify(e.manifest,null,2)}
2246
2246
  `),await oe(n,`${r}
2247
2247
  `);let i=[];if(e.mode!=="keyword")try{M(e.progressEnabled,"writing vectorization status ledger"),await Ts(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(a){i.push(`search_vectorization_status_ledger_write_failed:${a instanceof Error?a.message:String(a)}`)}return i}async function Ng(e,t){let n=fg(e.mode),o=_g(e),r=e.full===!0;M(o,`start mode=${n}`);let i=A(process.cwd(),t.path);await F(i);let a=fs(await T(i)).settings,s=null;try{s=await te(i,hs,a.locks.ttl_seconds,R(void 0,"pm-reindex"),!1,a.governance.force_required_for_stale_lock,a.locks.wait_ms)}catch(c){throw c instanceof p&&c.exitCode===u.CONFLICT?new p("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",u.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=yg(a),l=bg(a),m=Ag({requestedMode:n,pmRoot:i,settings:a,extensionEmbedding:c,extensionVectorAdapter:l}),d=n;M(o,"loading item corpus");let _=await Eg({pmRoot:i,settings:a}),f=_.warnings,{documentCandidates:w,metadataDocuments:k}=_;M(o,`loaded_items=${k.length}`);let y=S(),v=Ig(d,y,k),g=Kt.join(i,oi),I=Kt.join(i,ri),x=d==="keyword"?await ai(i,w,a.schema,f):k,N=[],W={},O=null,C=Sg(d);if(d==="keyword"&&await Tg({pmRoot:i,settings:a,forceFullSemantic:r,extensionEmbedding:c,reindexWarnings:f}),d!=="keyword"){let ne=await Pg({pmRoot:i,settings:a,requestedMode:n,activeEmbeddingProvider:m.activeEmbeddingProvider,activeVectorStore:m.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:l,documentCandidates:w,metadataDocuments:k,documentsForKeywordArtifacts:x,forceFullSemantic:r,reindexWarnings:f,semanticWarnings:N,semanticSummary:C,progressEnabled:o});x=ne.documentsForKeywordArtifacts,W=ne.vectorizationLedgerEntries,O=ne.vectorizationEmbeddingMetadata}let ae=await Lg({pmRoot:i,mode:d,manifest:v,documentsForKeywordArtifacts:x,settings:a,vectorizationLedgerEntries:W,vectorizationEmbeddingMetadata:O,progressEnabled:o}),Re=[...await G({path:g,scope:"project",op:"reindex:manifest"}),...await G({path:I,scope:"project",op:"reindex:embeddings"}),...await Ri({mode:d,total_items:k.length})];return M(o,"done"),{ok:!0,mode:d,total_items:k.length,semantic:C,artifacts:{manifest:oi,embeddings:ri},warnings:[...f,...N,...ae,...Re],generated_at:y}}finally{await s?.()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c3e80fb-2ae7-5d3b-98bd-eacdabd2be6d")}catch{}})();var mp=Symbol("pm.active-extension-host-context");function Q(e){return{fullChangedFields:!0,options:e}}var b=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[mp]=!0,n}run(t,n={}){return Ug({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return Sl(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return Dn(await this.list(ar(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},o={}){return this.runTyped("graph",{subcommand:t,...n,options:o})}append(t,n,o={}){return this.runTyped("append",{id:t,...Q(Pt(o,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,r,i={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...r===void 0?{}:{value:r},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,o={}){return this.runTyped("schema",{name:n,options:{...o,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,r){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...r?{fieldTypeScope:r}:{}}})}schemaRemapStatus(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,o={},r,i){return this.runTyped("plan",{fullChangedFields:!0,...n===void 0?{}:{id:n},...r===void 0?{}:{stepRef:r},...i===void 0?{}:{reorderTo:i},options:Pt(o,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,o){return this.plan("update-step",t,o,n)}planCompleteStep(t,n,o={}){return this.plan("complete-step",t,o,n)}planBlockStep(t,n,o){return this.plan("block-step",t,o,n)}planReorderStep(t,n,o,r={}){return this.plan("reorder-step",t,r,n,o)}planRemoveStep(t,n,o={}){return this.plan("remove-step",t,o,n)}planLink(t,n,o){return this.plan("link",t,o,n)}planUnlink(t,n,o){return this.plan("unlink",t,o,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",Q(t))}update(t,n={}){return this.runTyped("update",{id:t,...Q(n)})}reopen(t,n,o={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:o})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...Q(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...Q(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...Q(t)})}release(t,n={}){return this.runTyped("release",{id:t,...Q(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...Q(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...Q(n)})}restore(t,n,o={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...o,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...Q(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...Q(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...Q(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...Q(o)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function AT(e={},t={}){return new b(t).context(e)}function ET(e={},t={}){return new b(t).list(e)}function TT(e={},t={}){return new b(t).listAllComplete(e)}function CT(e,t={},n={}){return new b(n).search(e,t)}function RT(e,t={},n={}){return new b(n).get(e,t)}function xT(e={},t={}){return new b(t).next(e)}function OT(e={},t={}){return new b(t).aggregate(e)}function $T(e={},t={}){return new b(t).stats(e)}function FT(e={},t={}){return new b(t).duplicates(e)}function PT(e,t={},n={}){return new b(n).comments(e,t)}function LT(e,t={},n={}){return new b(n).notes(e,t)}function NT(e,t={},n={}){return new b(n).learnings(e,t)}function DT(e,t={},n={}){return new b(n).files(e,t)}function MT(e,t={},n={}){return new b(n).filesDiscover(e,t)}function jT(e,t={}){return new b(t).filesLookup(e)}function GT(e,t={},n={}){return new b(n).docs(e,t)}function UT(e,t={},n={}){return new b(n).deps(e,t)}function qT(e,t={},n={},o={}){return new b(o).graph(e,t,n)}function zT(e,t,n={},o={}){return new b(o).append(e,t,n)}function HT(e,t={},n={}){return new b(n).init(e,t)}function WT(e,t,n,o,r={},i={}){return new b(i).config(e,t,n,o,r)}function VT(e,t={},n={}){return new b(n).schema(e,t)}function BT(e={}){return new b(e).schemaList()}function KT(e,t={}){return new b(t).schemaShow(e)}function JT(e,t={},n={}){return new b(n).schemaAddType(e,t)}function YT(e,t={},n={}){return new b(n).schemaRemoveType(e,t)}function XT(e,t={},n={}){return new b(n).schemaAddStatus(e,t)}function ZT(e,t={},n={}){return new b(n).schemaRemoveStatus(e,t)}function QT(e,t={},n={}){return new b(n).schemaAddField(e,t)}function eC(e,t={},n={}){return new b(n).schemaRemoveField(e,t)}function tC(e={}){return new b(e).schemaListFields()}function nC(e,t={}){return new b(t).schemaShowField(e)}function oC(e,t={},n={}){return new b(n).schemaApplyPreset(e,t)}function rC(e={},t={}){return new b(t).schemaInferTypes(e)}function iC(e,t,n,o={}){return new b(o).schemaRenameType(e,t,n)}function aC(e,t,n,o,r={}){return new b(r).schemaRenameField(e,t,n,o)}function sC(e,t,n,o={}){return new b(o).schemaRemapStatus(e,t,n)}function cC(e,t={}){return new b(t).schemaShowStatus(e)}function lC(e,t={},n={}){return new b(n).profile(e,t)}function dC(e={}){return new b(e).profileList()}function mC(e,t={}){return new b(t).profileShow(e)}function pC(e,t={},n={}){return new b(n).profileApply(e,t)}function uC(e,t={}){return new b(t).profileLint(e)}function _C(e={},t={}){return new b(t).validate(e)}function fC(e={},t={}){return new b(t).health(e)}function hC(e={},t={}){return new b(t).gc(e)}function gC(e,t,n={}){return new b(n).historyRedact(e,t)}function yC(e,t={},n={}){return new b(n).historyRepair(e,t)}function bC(e={},t={}){return new b(t).historyRepairAll(e)}function wC(e,t={},n={}){return new b(n).historyCompact(e,t)}function vC(e,t={}){return new b(t).historyCompactBulk(e)}function kC(e={},t={}){return new b(t).create(e)}function SC(e,t={},n={}){return new b(n).update(e,t)}function IC(e,t,n={},o={}){return new b(o).reopen(e,t,n)}function AC(e,t,n={},o={}){return new b(o).close(e,t,n)}function EC(e,t={},n={}){return new b(n).claim(e,t)}function TC(e={},t={}){return new b(t).claimNext(e)}function CC(e,t={},n={}){return new b(n).release(e,t)}function RC(e,t={},n={}){return new b(n).copy(e,t)}function xC(e,t={},n={}){return new b(n).delete(e,t)}function OC(e,t,n={},o={}){return new b(o).restore(e,t,n)}function $C(e,t={},n={}){return new b(n).focus(e,t)}function FC(e,t={},n={}){return new b(n).startTask(e,t)}function PC(e,t={},n={}){return new b(n).pauseTask(e,t)}function LC(e,t,n={},o={}){return new b(o).closeTask(e,t,n)}function NC(e,t={},n={}){return new b(n).extension(e,t)}function DC(e={},t={}){return new b(t).extensionList(e)}function MC(e,t={},n={}){return new b(n).extensionActivate(e,t)}function jC(e,t={},n={}){return new b(n).extensionDeactivate(e,t)}function GC(e,t={},n={}){return new b(n).package(e,t)}function UC(e={},t={}){return new b(t).packageList(e)}function qC(e,t={},n={}){return new b(n).packageInstall(e,t)}function zC(e,t={},n={}){return new b(n).packageUninstall(e,t)}function HC(e={},t={}){return new b(t).packageDoctor(e)}function WC(e,t={},n={}){return new b(n).packageManage(e,t)}function VC(e,t={},n={}){return new b(n).packageDescribe(e,t)}function BC(e={},t={}){return new b(t).packageReload(e)}function KC(e={},t={}){return new b(t).packageCatalog(e)}function JC(e,t={},n={}){return new b(n).packageActivate(e,t)}function YC(e,t={},n={}){return new b(n).packageDeactivate(e,t)}function XC(e,t={},n={}){return new b(n).upgrade(e,t)}async function ZC(e,t={}){let n=typeof e=="string"?{...t,pmRoot:e}:e??t,o={json:!0,quiet:n.quiet??!0,noExtensions:n.noExtensions??!1,noPager:!0,profile:n.profile??!1,path:n.pmRoot};return fn(n,o)}var lp=Ei(),ci=new Dg;function to(){_o(bi()),fo(wi()),ho(vi()),go(ki()),yo(Si()),bo(Ii()),wo(Ai())}async function pp(e,t,n,o){return uo(()=>t===void 0?lp.read(()=>dp(e,n,o)):lp.write(()=>jg(t,()=>dp(e,n,o))))}async function QC(e,t){let n=e.cwd;if(ci.getStore()===!0&&n===void 0&&e.noExtensions===!0){let r=A(process.cwd(),e.path);return uo(()=>$n({pmRoot:r},t))}let o=n??process.cwd();return pp(wn({path:e.path,noExtensions:e.noExtensions}),n,o,()=>ci.run(!0,t))}async function dp(e,t,n){let o=A(t,e.path);if(e.noExtensions)return to(),$n({pmRoot:o},()=>n(null));if(!await ye(we(o)))return to(),n(null);let r=null,i;try{let a=await T(o),s=await Xt({pmRoot:o,settings:a,cwd:t,noExtensions:!1}),c=await Qt({...s,loaded:s.loaded});i={loadResult:s,activationResult:c},_o(c.hooks),fo(c.commands),ho(c.parsers),go(c.preflight),yo(c.services),bo(c.renderers),wo(c.registrations),r={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:s.loaded}}catch(a){to(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",a)}try{return await $n({pmRoot:o,packages:r?.packages},()=>n(r))}finally{to(),i&&await Zt(i.loadResult,i.activationResult).catch(()=>{})}}async function Mg(e,t,n,o,r){if(!r)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let i=Me(e),a=r.registrations.commands.find(l=>Me(l.action)===i)?.command??r.commands.handlers.find(l=>Me(l.command)===i)?.command;if(!a)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let s=typeof o.author=="string"&&o.author.trim()?o.author.trim():"pm-extension",c=await xi({command:kn(a),args:U(n.args??t.args),options:Do(t,n),global:o,pm_root:r.pmRoot,sdk:vl(r.pmRoot,b.forActiveExtensionHost({pmRoot:r.pmRoot,author:s}),s,kn(a))});if(!c.handled){let l=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new p(`Unsupported native pm action: ${e}${l}`,u.USAGE)}return c.result}async function jg(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function Gg(e){let t=K(e,"action"),n=Me(t),o=fe(sr,n),r=o?.action??n,i={...e,action:r};return o?.options!==void 0&&(i.options={...o.options,...io(e.options)}),r==="package"&&(i.options={...io(i.options),vocabulary:"package"}),{action:r,args:i}}async function Ug(e){let t=Gg(e),n=wn(t.args),o=dc(t.action),r=h(t.args,"cwd"),i=r??process.cwd();t.action==="init"&&(n[oc]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=A(i,n.path));try{return t.action==="history-attest"?await si(t.action,t.args,n,null):e[mp]===!0||ci.getStore()===!0?await si(t.action,t.args,n,null):await pp(n,r,i,a=>si(t.action,t.args,n,a))}finally{o&&Hr()}}function eR(e=Mi){return e.map(t=>{let n=Me(t),o=fe(sr,n),r=o?.action??n,i=fe(zr,r)!==void 0;return{action:t,resolved_action:r,covered:i,route:i?o?"alias":"native":"missing"}})}async function si(e,t,n,o){let r=No(t,e);Gi(e,r),Ui(e,r);let i={action:e,args:t,options:r,id:h(t,"id"),force:t.force===!0||r.force===!0,global:n,activeExtensions:o},a=fe(zr,e),s=a?await a(i):await Mg(e,t,r,n,o);if(e==="history-attest")return s;{r.resolvedOutputFormat="json";let c=Vi(e,r,s);return await gl(A(process.cwd(),n.path),c),c}}var qg={closeManyOptionsFromFlat:Sn,extensionOptionsFromArgs:Do,globalOptions:wn,mutationListOptions:mc,normalizeActionName:Me,normalizeCommandPath:kn,normalizeMcpUpdateOptions:uc,normalizeMcpOptionsArrays:lc,optionsWithAuthor:No,readRequiredString:K,readScalarString:ac,readScalarStringAllowBlank:sc,readStringArray:U,updateManyOptionsFromFlat:In,withAddNoteOption:Lt,withFilesDiscoveryOptions:vn,withMutationCompaction:j};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=qg);export{tr as a,hl as b,gp as c,bp as d,wp as e,$n as f,Gt as g,Ln as h,vl as i,xp as j,Nn as k,ar as l,kl as m,Dn as n,Dp as o,El as p,Rl as q,Ol as r,Ll as s,mr as t,pr as u,ur as v,_r as w,mu as x,Ul as y,wr as z,Ql as A,rd as B,id as C,at as D,Or as E,q_ as F,iw as G,aw as H,Pr as I,sd as J,kw as K,Sw as L,ld as M,pd as N,qw as O,af as P,Ur as Q,cf as R,lf as S,Ad as T,Ed as U,Td as V,Cd as W,Rd as X,uv as Y,_v as Z,fv as _,hv as $,xd as aa,Od as ba,Pd as ca,Dd as da,Md as ea,jd as fa,K as ga,Hr as ha,HS as ia,WS as ja,VS as ka,BS as la,KS as ma,Yd as na,JS as oa,dh as pa,uh as qa,gh as ra,yh as sa,bh as ta,z as ua,wh as va,vh as wa,kh as xa,Sh as ya,Vr as za,em as Aa,lt as Ba,Wr as Ca,tm as Da,Ih as Ea,nm as Fa,Ah as Ga,Eh as Ha,Th as Ia,Ch as Ja,Rh as Ka,Nh as La,am as Ma,Dh as Na,Hh as Oa,Xh as Pa,Qh as Qa,mg as Ra,Ng as Sa,b as Ta,AT as Ua,ET as Va,TT as Wa,CT as Xa,RT as Ya,xT as Za,OT as _a,$T as $a,FT as ab,PT as bb,LT as cb,NT as db,DT as eb,MT as fb,jT as gb,GT as hb,UT as ib,qT as jb,zT as kb,HT as lb,WT as mb,VT as nb,BT as ob,KT as pb,JT as qb,YT as rb,XT as sb,ZT as tb,QT as ub,eC as vb,tC as wb,nC as xb,oC as yb,rC as zb,iC as Ab,aC as Bb,sC as Cb,cC as Db,lC as Eb,dC as Fb,mC as Gb,pC as Hb,uC as Ib,_C as Jb,fC as Kb,hC as Lb,gC as Mb,yC as Nb,bC as Ob,wC as Pb,vC as Qb,kC as Rb,SC as Sb,IC as Tb,AC as Ub,EC as Vb,TC as Wb,CC as Xb,RC as Yb,xC as Zb,OC as _b,$C as $b,FC as ac,PC as bc,LC as cc,NC as dc,DC as ec,MC as fc,jC as gc,GC as hc,UC as ic,qC as jc,zC as kc,HC as lc,WC as mc,VC as nc,BC as oc,KC as pc,JC as qc,YC as rc,XC as sc,ZC as tc,QC as uc,Ug as vc,eR as wc};
2248
- //# sourceMappingURL=chunk-ESRACL6K.js.map
2248
+ //# sourceMappingURL=chunk-DT3KUUKY.js.map
@@ -1,4 +1,4 @@
1
- import{$ as oe,Ab as Ki,Am as kr,Ao as Gt,Bm as me,Ci as $e,Cl as _r,Ec as W,G as ji,Gi as pr,Hi as mr,Ib as Vi,Ii as Ie,Ji as ur,Kb as Yi,Ki as fr,L as wn,Ln as xr,Md as jt,N as Li,Nb as De,Nc as H,Nd as nr,Od as Sn,Pd as En,Q as vn,Qd as $n,R as h,Sd as ir,T as f,Ta as Mi,Td as rr,Tf as Se,Ti as hr,Ua as Gi,V as k,Va as U,W as Pt,Wd as ar,X as ie,Y as G,Zi as gr,aj as Ft,ba as K,bb as N,be as or,bj as Mt,cb as Ui,cd as tr,db as zi,dd as st,eb as Ji,ej as je,fa as pe,fg as I,fi as In,gf as T,gg as Z,hc as xn,hg as sr,hh as lr,hi as dr,ic as Xi,ig as Y,ii as He,jc as Nt,jg as re,jj as yr,k as Ni,ka as Fi,kj as An,lc as ke,lg as cr,mh as B,nc as xe,nf as V,ng as ct,pg as Lt,pi as se,qc as Zi,sc as Dt,tc as Qi,tm as wr,ua as Rt,ub as qi,uc as er,ui as A,um as Le,va as bn,vb as Wi,vi as Ee,vm as lt,w as Di,wa as kn,wb as Bi,wm as vr,xm as br,ym as ce,z as Ct,zb as Hi,zm as Ke}from"./chunk-YMLF6QT7.js";import{mkdir as oc,readFile as sc}from"node:fs/promises";import Ar from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0bd9a904-c076-5c2a-a9d8-42a543625e33")}catch{}})();var Tn=class extends Error{constructor(t="Workspace transaction interrupted"){super(t),this.name="WorkspaceTransactionInterruptedError"}},cc="sdk-workspace-transaction",lc=/^[a-zA-Z0-9._-]+$/,dc=30,pc=3e3;function Tr(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n||!lc.test(n))throw new TypeError(`${t} must match [a-zA-Z0-9._-]+`);return n}function Sr(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n)throw new TypeError(`${t} must be non-empty`);return n}function mc(e){return{pmRoot:Sr(e.pmRoot,"Transaction pmRoot"),transactionId:Tr(e.transactionId,"Transaction id"),author:Sr(e.author,"Transaction author")}}function Er(e,t,n){let i=e??t;if(!Number.isInteger(i)||i<=0)throw new TypeError(`${n} must be a positive integer`);return i}function Or(e,t){return Ar.join(e,"transactions","sdk",`${t}.json`)}async function Ae(e,t){t.updatedAt=T();let n=Or(e,t.transactionId);await oc(Ar.dirname(n),{recursive:!0}),await oe(n,`${JSON.stringify(t,null,2)}
1
+ import{$ as oe,Ab as Ki,Am as Ke,Bm as kr,Bo as Gt,Cm as me,Di as $e,Dl as _r,Ec as W,G as ji,Hi as pr,Ib as Vi,Ii as mr,Ji as Ie,Kb as Yi,Ki as ur,L as wn,Li as fr,Md as jt,Mn as xr,N as Li,Nb as De,Nc as H,Nd as nr,Od as Sn,Pd as En,Q as vn,Qd as $n,R as h,Sd as ir,T as f,Ta as Mi,Td as rr,Tf as Se,Ua as Gi,Ui as hr,V as k,Va as U,W as Pt,Wd as ar,X as ie,Y as G,_i as gr,ba as K,bb as N,be as or,bj as Ft,cb as Ui,cd as tr,cj as Mt,db as zi,dd as st,eb as Ji,fa as pe,fg as I,fj as je,gf as T,gg as Z,gi as In,hc as xn,hg as sr,ic as Xi,ig as Y,ih as lr,ii as dr,jc as Nt,jg as re,ji as He,k as Ni,ka as Fi,kj as yr,lc as ke,lg as cr,lj as An,nc as xe,nf as V,ng as ct,nh as B,pg as Lt,qc as Zi,qi as se,sc as Dt,tc as Qi,ua as Rt,ub as qi,uc as er,um as wr,va as bn,vb as Wi,vi as A,vm as Le,w as Di,wa as kn,wb as Bi,wi as Ee,wm as lt,xm as vr,ym as br,z as Ct,zb as Hi,zm as ce}from"./chunk-6PZPUJW3.js";import{mkdir as oc,readFile as sc}from"node:fs/promises";import Ar from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0bd9a904-c076-5c2a-a9d8-42a543625e33")}catch{}})();var Tn=class extends Error{constructor(t="Workspace transaction interrupted"){super(t),this.name="WorkspaceTransactionInterruptedError"}},cc="sdk-workspace-transaction",lc=/^[a-zA-Z0-9._-]+$/,dc=30,pc=3e3;function Tr(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n||!lc.test(n))throw new TypeError(`${t} must match [a-zA-Z0-9._-]+`);return n}function Sr(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n)throw new TypeError(`${t} must be non-empty`);return n}function mc(e){return{pmRoot:Sr(e.pmRoot,"Transaction pmRoot"),transactionId:Tr(e.transactionId,"Transaction id"),author:Sr(e.author,"Transaction author")}}function Er(e,t,n){let i=e??t;if(!Number.isInteger(i)||i<=0)throw new TypeError(`${n} must be a positive integer`);return i}function Or(e,t){return Ar.join(e,"transactions","sdk",`${t}.json`)}async function Ae(e,t){t.updatedAt=T();let n=Or(e,t.transactionId);await oc(Ar.dirname(n),{recursive:!0}),await oe(n,`${JSON.stringify(t,null,2)}
2
2
  `)}function uc(e){return Number.isInteger(e.attempt)&&typeof e.author=="string"&&typeof e.createdAt=="string"&&typeof e.updatedAt=="string"}function Fe(e){return Object.assign(Object.create(null),e)}function fc(e,t){try{let n=JSON.stringify(e,(i,r)=>{if(typeof r=="number"&&!Number.isFinite(r))throw new TypeError(`${t} contains a non-finite number`);if(r===void 0||typeof r=="function"||typeof r=="symbol")throw new TypeError(`${t} contains a non-JSON value`);return r});return JSON.parse(n)}catch(n){throw new TypeError(`${t} must be JSON serializable`,{cause:n})}}function On(e,t){return e===void 0?void 0:fc(e,t)}function Cn(e,t,n,i){let r=On(n,i);r===void 0?delete e[t]:e[t]=r}function $r(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ir(e,t){return Array.isArray(e)&&new Set(e).size===e.length&&e.every(n=>typeof n=="string"&&t.includes(n))}function hc(e,t){if(!Ir(e.startedStepIds,t)||!Ir(e.completedStepIds,t)||!$r(e.results)||!$r(e.compensationData))return!1;let n=e.startedStepIds,i=new Set(n),r=e.completedStepIds,a=new Set(r);return Object.keys(e.compensationData).some(o=>!i.has(o))||Object.keys(e.results).some(o=>!a.has(o))?!1:e.status==="committed"?t.every(o=>a.has(o)):e.status!=="compensated"||a.size===0&&i.size===0}function gc(e,t,n){let i;try{i=JSON.parse(e)}catch{throw new TypeError(`Workspace transaction ${t} journal is invalid JSON`)}if(!i||typeof i!="object"||Array.isArray(i))throw new TypeError(`Workspace transaction ${t} journal is invalid`);let r=i,a=r.schemaVersion===1&&r.transactionId===t,o=Array.isArray(r.stepIds)&&r.stepIds.length===n.length&&r.stepIds.every((d,p)=>d===n[p]),s=hc(r,n),l=uc(r),c=["applying","compensating","compensated","committed"].includes(String(r.status));if(!a||!o||!s||!l||!c)throw new TypeError(`Workspace transaction ${t} journal does not match the supplied plan`);return{...r,results:Fe(r.results),compensationData:Fe(r.compensationData)}}async function yc(e,t,n,i,r){let a=r,o=a!==void 0;if(a?.status==="compensating"&&await Cr(e,a),a===void 0||a.status==="compensated"){let s=T();a={schemaVersion:1,transactionId:t,author:n,status:"applying",attempt:(a?.attempt??0)+1,createdAt:a?.createdAt??s,updatedAt:s,stepIds:i,startedStepIds:[],completedStepIds:[],results:Fe(),compensationData:Fe()},await Ae(e.pmRoot,a),await _e(e,a,"prepared")}return{journal:a,recovered:o}}async function _c(e,t,n){try{await vc(t,e.steps),await Ae(e.pmRoot,t);let i=new Set(t.completedStepIds),r=new Set(t.startedStepIds);for(let a of e.steps){if(i.has(a.id))continue;let o=await a.inspect(),s=On(o.result,`Step ${a.id} result`);if(o.state!=="applied"){let l=await a.prepareCompensation?.();Cn(t.compensationData,a.id,l,`Step ${a.id} compensation data`),r.add(a.id),t.startedStepIds=e.steps.map(d=>d.id).filter(d=>r.has(d)),await Ae(e.pmRoot,t);let c=await a.apply();s=On(c,`Step ${a.id} result`)}await _e(e,t,"step_applied",a.id),i.add(a.id),t.completedStepIds=e.steps.map(l=>l.id).filter(l=>i.has(l)),Cn(t.results,a.id,s,`Step ${a.id} result`),await Ae(e.pmRoot,t),await _e(e,t,"step_recorded",a.id)}return await _e(e,t,"committing"),t.status="committed",await Ae(e.pmRoot,t),await _e(e,t,"committed"),{transactionId:t.transactionId,status:"committed",recovered:n,results:Fe(t.results)}}catch(i){if(i instanceof Tn||t.status==="committed")throw i;try{await Cr(e,t)}catch(r){throw new AggregateError([i,r],`Workspace transaction failed and compensation failed: ${String(r)}`,{cause:r})}throw i}}async function wc(e,t,n){try{return gc(await sc(Or(e,t),"utf8"),t,n)}catch(i){if(i!==null&&typeof i=="object"&&"code"in i&&ie(i))return;throw i}}async function _e(e,t,n,i){await e.onTransition?.({transactionId:t.transactionId,attempt:t.attempt,transition:n,...i===void 0?{}:{stepId:i}})}async function vc(e,t){let n=new Set,i=Fe();for(let r of t){let a=await r.inspect();a.state==="applied"&&(n.add(r.id),Cn(i,r.id,a.result,`Step ${r.id} result`))}e.results=i,e.completedStepIds=t.map(r=>r.id).filter(r=>n.has(r))}async function Cr(e,t){t.status="compensating",await Ae(e.pmRoot,t),await _e(e,t,"compensating");let n=new Set(t.completedStepIds),i=new Set(t.startedStepIds);for(let r of[...e.steps].reverse()){if(!i.has(r.id)&&!n.has(r.id))continue;let a;try{a=i.has(r.id)&&(await r.inspect()).state==="applied"}catch{a=i.has(r.id)}a&&(await _e(e,t,"step_compensating",r.id),await r.compensate(t.compensationData[r.id])),n.delete(r.id),i.delete(r.id),t.completedStepIds=e.steps.map(o=>o.id).filter(o=>n.has(o)),t.startedStepIds=e.steps.map(o=>o.id).filter(o=>i.has(o)),delete t.results[r.id],delete t.compensationData[r.id],await Ae(e.pmRoot,t),await _e(e,t,"step_compensated",r.id)}t.status="compensated",await Ae(e.pmRoot,t),await _e(e,t,"compensated")}async function Pr(e){let{pmRoot:t,transactionId:n,author:i}=mc(e),r=Er(e.lockTtlSeconds,dc,"Transaction lock TTL"),a=Er(e.lockWaitMs,pc,"Transaction lock wait"),o=[...e.steps];if(o.length===0)throw new TypeError("Workspace transaction requires at least one step");let s=o.map(d=>{let p=Tr(d.id,"Transaction step id");if(p!==d.id)throw new TypeError("Transaction step id must not contain surrounding whitespace");return p});if(new Set(s).size!==s.length)throw new TypeError("Workspace transaction step ids must be unique");let l={...e,pmRoot:t,transactionId:n,author:i,steps:o,lockTtlSeconds:r,lockWaitMs:a},c=await V(t,cc,r,i,!1,!1,a);try{let d=await wc(t,n,s),p=d!==void 0;if(d?.status==="committed")return{transactionId:n,status:"committed",recovered:!0,results:Fe(d.results)};let m=await yc(l,n,i,s,d);return await _c(l,m.journal,p||m.recovered)}finally{await c()}}import bc from"node:fs/promises";import kc from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7be00b26-4a56-5399-94f6-f2f67cc5c1e6")}catch{}})();function Pn(e){return kc.join(e,"extension-migrations.json")}function Rr(e,t){let n=e.definition.id;return typeof n=="string"&&n.trim().length>0?n.trim():`migration-${String(t+1).padStart(3,"0")}`}function Nr(e,t){return`${e.layer}:${e.name}:${t}`}async function xc(e){let t=Pn(e);if(!await k(t))return{version:1,updated_at:"",entries:[]};let n=JSON.parse(await bc.readFile(t,"utf8"));return{version:1,updated_at:typeof n.updated_at=="string"?n.updated_at:"",entries:Array.isArray(n.entries)?n.entries.filter(i=>typeof i?.key=="string"&&(i.status==="applied"||i.status==="failed")):[]}}async function Sc(e,t){let n=await xc(e),i=new Map(n.entries.map(r=>[r.key,r]));return t.forEach((r,a)=>{let o=Rr(r,a),s=i.get(Nr(r,o));s&&(r.definition.status=s.status,s.status==="failed"?r.definition.reason=s.error:(delete r.definition.reason,delete r.definition.error,delete r.definition.message))}),n}async function Ec(e){let t=await Sc(e.pmRoot,e.migrations),n=new Map(t.entries.map(d=>[d.key,d])),i=[],r=!1,a=e.migrations.map((d,p)=>({migration:d,index:p})).filter(({migration:d})=>e.scope===void 0||d.layer===e.scope);for(let{migration:d,index:p}of a){let m=Rr(d,p),g=Nr(d,m),y=n.get(g),_=String(d.definition.status??"pending").toLowerCase(),u=y?.status??(_==="applied"||_==="failed"?_:"pending");if(u==="applied"){i.push({key:g,layer:d.layer,extension:d.name,id:m,before:u,outcome:"skipped"});continue}if(e.dryRun===!0){i.push({key:g,layer:d.layer,extension:d.name,id:m,before:u,outcome:"pending"});continue}let w=d.runtime_definition?.run??d.definition.run;if(typeof w!="function"){i.push({key:g,layer:d.layer,extension:d.name,id:m,before:u,outcome:"pending"});continue}let v=new Date().toISOString();try{await Promise.resolve(w({id:m,command:"migration",layer:d.layer,extension:d.name,pm_root:e.pmRoot,status:u}));let x={key:g,layer:d.layer,extension:d.name,id:m,status:"applied",attempted_at:v};n.set(g,x),d.definition.status="applied",delete d.definition.reason,delete d.definition.error,delete d.definition.message,i.push({key:g,layer:d.layer,extension:d.name,id:m,before:u,outcome:"applied"}),r=!0}catch(x){let S=x instanceof Error?x.message:String(x),O={key:g,layer:d.layer,extension:d.name,id:m,status:"failed",attempted_at:v,error:S};n.set(g,O),d.definition.status="failed",d.definition.reason=S,i.push({key:g,layer:d.layer,extension:d.name,id:m,before:u,outcome:"failed",error:S}),r=!0}}if(r){let d=await A(e.pmRoot),p={version:1,updated_at:new Date().toISOString(),entries:[...n.values()].sort((m,g)=>m.key.localeCompare(g.key))};await He({pmRoot:e.pmRoot,filePath:Pn(e.pmRoot),raw:`${JSON.stringify(p,null,2)}
3
3
  `,op:"extension_migrations_apply",author:e.author,lockTtlSeconds:d.locks.ttl_seconds,lockWaitMs:d.locks.wait_ms})}let o=i.filter(d=>d.outcome==="pending").length,s=i.filter(d=>d.outcome==="applied").length,l=i.filter(d=>d.outcome==="skipped").length,c=i.filter(d=>d.outcome==="failed").length;return{ok:c===0,dry_run:e.dryRun===!0,state_path:Pn(e.pmRoot),total:i.length,pending_count:o,applied_count:s,skipped_count:l,failed_count:c,migrations:i}}async function Dr(e){let t=await A(e.resolvedRoots.settings_root),n=await ke({pmRoot:e.resolvedRoots.pm_root,settings:t,cwd:process.cwd(),noExtensions:e.global.noExtensions===!0}),i=await xe(n);e.warnings.push(...n.warnings,...i.warnings);let r=await Ec({pmRoot:e.resolvedRoots.pm_root,migrations:i.registrations.migrations,author:typeof e.global.author=="string"&&e.global.author.trim().length>0?e.global.author.trim():"pm-extension-migration",dryRun:e.options.dryRun===!0,...e.scope==="global"?{scope:"global"}:{}});return e.withResult({migration:r,load_failure_count:n.failed.length,activation_failure_count:i.failed.length},r.ok)}import{readFile as $c,writeFile as Ic}from"node:fs/promises";import dt from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1de99e25-e132-5071-833e-37361b4cc7e6")}catch{}})();var Lr="# pm-cli:runtime-cache:start",Rn="# pm-cli:runtime-cache:end",Fr=".agents/pm",Ac=["runtime/","search/","locks/","transactions/","checkpoints/"],Tc=["search/eval-queries.json"];async function jr(e){try{return await e()}catch(t){throw t instanceof Error&&"code"in t&&typeof t.code=="string"&&["EACCES","EPERM","EROFS"].includes(t.code)?new f("The workspace .gitignore is not writable.",h.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:t.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):t}}function Mr(e){return e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"")}function Nn(e){let t=e.replaceAll("\\","/");return dt.isAbsolute(e)||t===".."||t.startsWith("../")}function Oc(e=Fr){let t=Mr(e);return[Lr,...Ac.map(n=>n==="search/"?`${t}/${n}*`:`${t}/${n}`),...Tc.map(n=>`!${t}/${n}`),Rn].join(`
4
4
  `)}async function Gr(e,t={}){let n=dt.join(e,".gitignore"),i=Fr;if(t.pmRoot!==void 0){let c=Mr(dt.relative(dt.resolve(e),dt.resolve(t.pmRoot)));if(Nn(c))return{path:n,changed:!1};c.length>0&&(i=c)}let r="";try{r=await jr(()=>$c(n,"utf8"))}catch(c){if(!(c instanceof Error&&"code"in c&&ie(c)))throw c}let a=r.indexOf(Lr),o=r.indexOf(Rn),s=(a>=0&&o>=a?`${r.slice(0,a)}${r.slice(o+Rn.length)}`:r).trimEnd(),l=`${s.length>0?`${s}
@@ -78,4 +78,4 @@ Agent guidance check
78
78
  `),ee.write(`Telemetry helps improve reliability and can be disabled anytime via pm config.
79
79
  `);let l=t?"Y/n":"y/N",c=await n.question(`Enable telemetry for this project? [${l}] `),d=Bs(c,t);return ee.write(`
80
80
  `),{prefix:r,preset:s,telemetry_enabled:d}}finally{n.close()}}function bf(e){return{presetFromOption:Oi(e.preset),useDefaults:e.defaults===!0,authorFromOption:zs(e.author),installBundledPackages:e.withPackages===!0,agentGuidanceMode:Ws(e.agentGuidance),typePreset:Us(e.typePreset)}}function kf(e){let t=[];return e.prefixArg!==void 0&&e.settings.id_prefix!==e.normalizedPrefix&&t.push("id_prefix"),e.presetFromOption!==void 0&&e.settings.governance.preset!==e.presetFromOption&&t.push("governance_preset"),e.authorFromOption!==void 0&&e.settings.author_default!==e.authorFromOption&&t.push("author_default"),t}function xf(e,t,n,i){if(t.length===0||n)return;let r=i.discovery==="ancestor";throw new f(`${r?`No tracker exists in ${i.requested_cwd}; pm init found an ancestor tracker at ${i.tracker_root}. `:""}Refusing to update existing tracker settings at ${e} without --force.`,h.USAGE,{code:"init_existing_settings_requires_force",type:"urn:pm-cli:error:init_existing_settings_requires_force",required:`--force for ${t.join(", ")}`,why:r?"Ancestor discovery is useful for normal commands, but init must make the selected existing workspace explicit before changing its identity or policy settings.":"pm init is safe to rerun, but changing id prefix, governance preset, or default author on an existing tracker can corrupt long-lived project context when an agent meant to initialize a sandbox path.",resolved_path:i.tracker_root,requested_path:i.requested_cwd,suggested_path:i.suggested_current_tracker_root,examples:["pm init --yes","pm init ./sandbox-pm --yes",...r?['pm init <name> --yes --pm-path "$PWD/.agents/pm"']:[],"pm init acme --yes --force"],nextSteps:[...r?['To create a new tracker in the current directory, rerun with --pm-path "$PWD/.agents/pm".']:[],"If you meant to initialize a sandbox tracker, pass a path-like positional such as ./sandbox-pm or /tmp/pm-test.","If you intentionally want to rewrite this existing tracker's init-managed settings, rerun with --force."]})}function Sf(e){let t=!1;return e.prefixArg!==void 0&&e.settings.id_prefix!==e.normalizedPrefix&&(e.settings.id_prefix=e.normalizedPrefix,e.warnings.push(`updated:id_prefix:${e.normalizedPrefix}`),t=!0),e.presetFromOption!==void 0&&e.settings.governance.preset!==e.presetFromOption&&(Ci(e.settings,e.presetFromOption),e.warnings.push(`updated:governance_preset:${e.presetFromOption}`),t=!0),e.authorFromOption!==void 0&&e.settings.author_default!==e.authorFromOption&&(e.settings.author_default=e.authorFromOption,e.warnings.push(`updated:author_default:${e.authorFromOption}`),t=!0),t}async function Ef(e){let t=await A(e.pmRoot);e.warnings.push(`already_exists:${e.settingsPath}`);let n=kf({settings:t,normalizedPrefix:e.normalizedPrefix,prefixArg:e.prefixArg,presetFromOption:e.normalizedOptions.presetFromOption,authorFromOption:e.normalizedOptions.authorFromOption});return xf(e.settingsPath,n,e.options.force===!0,e.target),Sf({settings:t,normalizedPrefix:e.normalizedPrefix,prefixArg:e.prefixArg,presetFromOption:e.normalizedOptions.presetFromOption,authorFromOption:e.normalizedOptions.authorFromOption,warnings:e.warnings})&&await Ee(e.pmRoot,t),{settings:t,normalizedPrefix:e.normalizedPrefix,chosenPreset:e.normalizedOptions.presetFromOption,wizardUsed:!1}}async function $f(e){let t=e.normalizedPrefix,n=e.normalizedOptions.presetFromOption,i,r=!1;if(e.normalizedOptions.presetFromOption===void 0&&!e.normalizedOptions.useDefaults&&process.stdin.isTTY===!0&&process.stdout.isTTY===!0){let l=await Zs(t,vn.telemetry.enabled);t=l.prefix,n=l.preset,i=l.telemetry_enabled,r=!0}let a=n??"minimal",o=_f();o.id_prefix=t,Ci(o,a);let s=lr()?.trim()||void 0;return o.author_default=e.normalizedOptions.authorFromOption??s??"",i!==void 0&&(o.telemetry.enabled=i,o.telemetry.first_run_prompt_completed=!0),await Ee(e.pmRoot,o),{settings:o,normalizedPrefix:t,chosenPreset:n,wizardUsed:r}}async function Ls(e){return e.settingsExists?await Ef(e):await $f({pmRoot:e.pmRoot,normalizedPrefix:e.normalizedPrefix,normalizedOptions:e.normalizedOptions})}async function If(e){let t=await js({pm_root:e.pmRoot,cwd:e.cwd,mode:e.agentGuidanceMode,interactive:process.stdin.isTTY===!0&&process.stdout.isTTY===!0,settings:e.settings});return e.warnings.push(...t.warnings),t.settings_changed&&await Ee(e.pmRoot,e.settings),{...t.summary,next_steps:t.next_steps}}async function Af(e,t){let n=[],i=[],r=await cr(e,t.schema);for(let a of r.created_paths)n.push(a),i.push(...await H({path:a,scope:"project",op:"init:runtime_schema_file"}));return{createdDirs:n,warnings:i}}async function Tf(e){if(e.typePreset===void 0)return;let t=await Ks(e.pmRoot,e.settings,e.typePreset);return e.warnings.push(`registered_type_preset:${e.typePreset}`),e.warnings.push(...await H({path:t.file,scope:"project",op:"init:type_preset"})),t}async function Of(e){let t=U(e.settings,W()).folders.filter(i=>!wn.includes(i)),n=await Xs(e.pmRoot,t);e.createdDirs.push(...n.createdDirs),e.warnings.push(...n.warnings)}function Cf(e){let t=F.resolve(e.tracker_root),n=F.dirname(t);return F.basename(t)==="pm"&&F.basename(n)===".agents"?F.dirname(n):e.workspace_root}async function Pf(e,t,n,i){if(!e)return;let r=await bi("all",{install:!0,project:!0},{...t,path:n});i.push(...r.warnings);let a=Hs(r),o=a.packages.filter(s=>!s.ok).map(s=>s.alias);if(!a.installed_all||o.length>0)throw new f(`pm init --with-packages did not install all bundled packages successfully${o.length>0?`: ${o.join(", ")}`:"."}`,h.GENERIC_FAILURE);return a}function Qs(e){let t=i=>st([...e.target.mode==="workspace-discovery"?[]:["--pm-path",e.target.tracker_root],...i]),n=[`Create your first item: ${t(["create","--type","Task","--title","<title>"])}`,`List active items: ${t(["list"])}`,`Get agent-friendly project context: ${t(["context"])}`];e.installBundledPackages?n.push(`Explore newly-available commands: ${t(["cal"])}, ${t(["templates"])}, ${t(["guide"])}`):(n.push(`Add optional packages for richer workflows: ${t(["install","calendar","--project"])}, ${t(["install","templates","--project"])}, ${t(["install","guide-shell","--project"])}`),n.push(`Or install everything bundled: ${t(["init","--with-packages"])} (idempotent on re-run)`)),e.registeredTypePreset&&n.push(`Inspect registered preset types: ${t(["schema","list"])}, ${t(["schema","show",e.registeredTypePreset.registered[0]??e.registeredTypePreset.updated[0]])}`),n.push("Supported agent harnesses are attributed automatically; use --author or PM_AUTHOR only when an explicit identity override is required.");for(let i of e.agentGuidanceNextSteps){let r=e.target.mode==="workspace-discovery"?i:i.replace(/\bpm (?=[a-z])/g,()=>`${t([])} `);n.includes(r)||n.push(r)}return n}async function ec(e,t,n,i=qn){if(t===null){n.push("merge_fence_skipped:not_git_repository:run pm merge install after moving the tracker into a Git repository");return}try{let r=await i({pmRoot:e,workspaceRoot:t});r.gitattributes.changed&&n.push(`updated:merge_fence:${r.gitattributes.path}`)}catch(r){if(!(r instanceof f))throw r;n.push(`merge_fence_skipped:install_failed:${r.context.code??"pm_error"}:${r.message}:run pm merge install after resolving the Git repository error`)}}async function Rf(e,t,n,i){if(e==null||n==="status")return;let r=await Gr(e,{pmRoot:t});r.changed&&i.push(`updated:gitignore:${r.path}`)}async function Gb(e,t,n={}){let i=t[gf],r=typeof i=="string"?i:process.cwd(),a=Js(r,t,e,n.workspace),o=a.pmRoot;e=qs(a.prefixArg,n.idPrefix);let s=bf(n);await Ys(o,a.target.mode==="tracker-path",n.force===!0);let l=[],c=[],d=F.join(o,"settings.json"),p=await k(d),m;p&&(m=await Ls({pmRoot:o,settingsPath:d,settingsExists:p,normalizedPrefix:$e(e),prefixArg:e,options:n,normalizedOptions:s,warnings:c,target:a.target}));let g=await Xs(o,wn);l.push(...g.createdDirs),c.push(...g.warnings),m??=await Ls({pmRoot:o,settingsPath:d,settingsExists:p,normalizedPrefix:$e(e),prefixArg:e,options:n,normalizedOptions:s,warnings:c,target:a.target});let{settings:y}=m,_=Cf(a.target),u=await Bt(_??F.dirname(o)),w=_??u,v=await If({pmRoot:o,cwd:w??r,agentGuidanceMode:s.agentGuidanceMode,settings:y,warnings:c}),x=await Af(o,y);l.push(...x.createdDirs),c.push(...x.warnings);let S=await Tf({pmRoot:o,settings:y,typePreset:s.typePreset,warnings:c});S&&(y=await A(o)),await Of({pmRoot:o,settings:y,createdDirs:l,warnings:c}),await Rf(w,o,s.agentGuidanceMode,c),!p&&n.mergeFence!==!1&&s.agentGuidanceMode!=="status"&&await ec(o,u,c);let O=await Pf(s.installBundledPackages,t,o,c),ae=Qs({installBundledPackages:s.installBundledPackages,registeredTypePreset:S,agentGuidanceNextSteps:v.next_steps,target:a.target});return{ok:!0,path:o,target:a.target,settings:y,created_dirs:l,warnings:c,governance_preset:y.governance.preset,wizard_used:m.wizardUsed,...S?{registered_type_preset:S}:{},...O?{installed_packages:O}:{},next_steps:ae,agent_guidance:v}}export{Tn as a,mc as b,Pr as c,Pn as d,xc as e,Sc as f,Ec as g,Dr as h,Yp as i,Lr as j,Rn as k,Ac as l,Oc as m,Gr as n,Ve as o,Pc as p,Rc as q,zr as r,qt as s,Me as t,Ut as u,Fn as v,zc as w,Jc as x,sh as y,Wt as z,Zc as A,mt as B,Vr as C,il as D,Bt as E,Jn as F,ta as G,Dh as H,jh as I,na as J,Lh as K,qn as L,ga as M,Qe as N,et as O,ya as P,ua as Q,Xe as R,Ze as S,fa as T,sl as U,Gh as V,qh as W,ra as X,dl as Y,sg as Z,xa as _,Ia as $,Vl as aa,Yl as ba,lw as ca,mw as da,uw as ea,$t as fa,fw as ga,hw as ha,gw as ia,yw as ja,_w as ka,ww as la,vw as ma,bw as na,kw as oa,xw as pa,Sw as qa,Ew as ra,$w as sa,Iw as ta,Aw as ua,Tw as va,Ow as wa,Cw as xa,Pw as ya,Rw as za,Nw as Aa,Dw as Ba,jw as Ca,Lw as Da,Fw as Ea,te as Fa,b as Ga,Xn as Ha,ud as Ia,he as Ja,Vt as Ka,Xl as La,ft as Ma,Yt as Na,za as Oa,Xa as Pa,di as Qa,po as Ra,t_ as Sa,_m as Ta,Wo as Ua,Bo as Va,gi as Wa,xo as Xa,Wp as Ya,Rm as Za,Eo as _a,bi as $a,Ss as ab,fb as bb,js as cb,gf as db,Fb as eb,Mb as fb,Gb as gb};
81
- //# sourceMappingURL=chunk-SSY4OSJR.js.map
81
+ //# sourceMappingURL=chunk-GUVKPOY6.js.map
@@ -0,0 +1,2 @@
1
+ import{$c as w,Mf as B,R as p,T as h,Xc as I,Yc as v,Zc as M,_c as O,ad as k,dd as D,df as F,ef as V,g as P,h as m,if as $,ih as R,j as A,jh as T,k as L,l as _,ml as y,wb as C}from"./chunk-6PZPUJW3.js";import{Command as ee}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="089f4ea0-a211-5e3e-87d3-c5693de8918d")}catch{}})();function Ue(e){return new ee().name("pm").description("Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.").version(e).showHelpAfterError(!1).allowExcessArguments(!1).allowUnknownOption(!1).configureOutput({writeOut:t=>{B(t)},writeErr:()=>{}}).option("--json","Output JSON instead of TOON; mutations emit a flat receipt with top-level id/status/changed_field_count while reads use documented entity or collection envelopes").option("--lean","Omit null and empty containers from JSON output").option("--token-accounting","Attach a bounded per-section token-cost receipt to command output").option("--output-include <fields>","Retain comma-separated fields or sections in read output").option("--output-limit <count>","Bound rows in read output").option("--output-budget <tokens|unbounded>","Bound estimated tokens in read output or explicitly disable the default ceiling").option("--output-format <toon|json>","Select the result encoding for reads and mutations").option("--output-session <state>","Carry a JSON session budget and served-item ledger across read calls").option("--output-cursor <cursor>","Resume a budget-compacted declared row collection").option("--output-row-contract","Include row selectors, encoding metadata, and read-output receipts").option("--quiet","Suppress stdout output").option("--no-changed-fields","Omit the changed_fields array from mutation output (keeps changed_field_count)").option("--full-changed-fields","Restore the legacy full mutation envelope and changed_fields array").option("--id-only","Print only id and status for single-item mutation output").option("--pm-path <dir>","Explicit tracker storage path for this command (preferred over --path)").option("--path <dir>","Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd").option("--no-extensions","Disable extension loading").option("--no-pager","Disable pager integration for help and long output").option("--explain","Render extended rationale and examples in help output").option("--all","Reveal every public command and compatibility alias").option("--profile","Print deterministic timing diagnostics").option("--author <id>","Override mutation author for this invocation").exitOverride()}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be9abae1-85ae-5a68-96bc-c738218ace5e")}catch{}})();function Ye(e){return e instanceof h||e instanceof Error?e.message:"Unknown failure"}function te(e){if(typeof e!="object"||e===null||!("exitCode"in e))return;let t=e.exitCode;return typeof t=="number"&&Number.isFinite(t)?t:void 0}function ne(e){let t=Math.trunc(e);return t>p.SUCCESS?t:p.GENERIC_FAILURE}function Xe(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("commander.")}function Ze(e,t){if(e instanceof Error)return e;let n=new Error(t),o=te(e);return o!==void 0&&(n.exitCode=ne(o)),n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8efedca0-725e-520f-ad06-825a0cccddaa")}catch{}})();var z=new Set(["append","claim","close","close-task","comments","copy","delete","deps","docs","files","focus","get","history","history-compact","history-redact","history-repair","learnings","notes","pause-task","release","restore","start-task","test","update"]),W=new Map([["files","discover"],["item","complete"]]),oe=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function G(e){let t=m(e?.trim().toLowerCase()??"");return z.has(t)||W.has(t)}function ie(e,t,n){let o=z.has(n)?t+1:void 0,i=w(e.slice(t+1));if(i===void 0)return o;let r=t+1+i,a=`${n} ${e[r]}`,s=m(a);return s===a?n==="item"&&e[r]==="complete"?r+1:o:G(s)?N(e,r,s):void 0}function N(e,t,n){if(["history","context","ctx","update","close","item"].includes(n))return ie(e,t,n);let o=W.get(n);if(o===void 0)return t+1;let i=e[t+1]?.toLowerCase()===o;return t+(i?2:1)}function se(e){let t=new Map;for(let n of y(e))for(let o of[n.flag,n.short,...n.aliases??[]])o&&t.set(o,n);return t}function re(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o==="--id"?(t.push({index:n,consumed:2,value:e[n+1]}),n+=1):o.startsWith("--id=")&&t.push({index:n,consumed:1,value:o.slice(5)})}return t}function ae(e,t,n){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let o=n.get(e);return o!==void 0&&o.value_type!=="boolean"}function le(e,t,n,o,i){let r=0;for(let a=t;a<e.length;a+=1){let s=e[a];if(s==="--")break;if(s==="--id"){a+=1;continue}if(!s.startsWith("--id=")){if(!s.startsWith("-")){if(a<o)return!0;r+=1;continue}ae(s,e[a+1],i)&&(a+=1)}}return r>(oe.get(m(n))??0)}function U(e){let t=w(e),n=t===void 0?void 0:e[t]?.toLowerCase();if(n!=="context"&&n!=="ctx"&&!G(n))return{argv:[...e],changed:!1,conflict:!1};let o=N(e,t,n);if(o===void 0)return{argv:[...e],changed:!1,conflict:!1};let i=o>t+1?`${m(e.slice(t,o-1).join(" "))} ${e[o-1]}`:n,r=se(i),a=re(e),s=a[0];if(!s||!s.value?.trim())return{argv:[...e],changed:!1,conflict:!1};if(a.length>1||le(e,o,i,s.index,r))return{argv:[...e],changed:!1,conflict:!0,itemId:s.value};let l=[...e.slice(0,s.index),...e.slice(s.index+s.consumed)],c=w(l),u=N(l,c,n);return l.splice(u,0,s.value),{argv:l,changed:!0,conflict:!1,itemId:s.value}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f05cec18-5e48-5151-8ada-577c9df5885d")}catch{}})();var ce=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),ue=new Set(["toon","json"]);function de(e,t,n){let o=e[t];if(v.has(o))return n.booleanFlags.add(o),1;let i=o.indexOf("="),r=i>0?o.slice(0,i):o;if(!I.has(r))return 1;let a=i>0?o.slice(i+1):void 0,s=a===void 0&&O(r,e[t+1]),l=a??(s?e[t+1]:void 0);return r==="--author"?n.author=l??"":typeof l=="string"&&l.length>0&&(ce.has(r)?n.outputValues:n.pathValues).set(r,l),s?2:1}function fe(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=de(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(Z(e)??""),noPager:t.booleanFlags.has("--no-pager"),json:t.booleanFlags.has("--json")?t.outputValues.get("--output-format")!=="toon":t.outputValues.get("--output-format")==="json",quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...ue.has(t.outputValues.get("--output-format"))?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:t.outputValues.get("--output-cursor")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function K(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(v.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(I.has(o)){n+=O(o,e[n+1])?2:1;continue}if(M(o)){n+=1;continue}t.push(o),n+=1}return t}function pe(e){let t=K(e);if(t[0]?.trim().toLowerCase()==="help"){let o=[];for(let i=1;i<t.length;i+=1){let r=t[i];if(r.startsWith("-"))break;o.push(r.trim().toLowerCase())}return{requested:!0,commandPathTokens:o}}if(t.findIndex(o=>o==="--help"||o==="-h")<0)return{requested:!1,commandPathTokens:[]};let n=[];for(let o of t){if(o.startsWith("-"))break;n.push(o.trim().toLowerCase())}return{requested:!0,commandPathTokens:n}}function x(e){return w(e)}function me(e){return k(e)}function he(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:pe(e).requested}function dt(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(r=>process.env[r]),o=()=>{for(let[r,a]of t.entries()){let s=n[r];s===void 0?delete process.env[a]:process.env[a]=s}},i=fe(e);return he(e,i)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}var ge=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function be(e){let t=x(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!ge.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];let o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}var ye=new Set(["pm","pm-cli"]);function we(e,t){let n=x(e);if(n===void 0)return e;let o=e[n];return ye.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function Ie(e,t){let n=x(e);if(n!==void 0&&e[n]==="help"){let s=x(e.slice(n+1));n=s===void 0?void 0:n+1+s}if(n===void 0)return e;let o=e[n],i=L[o.trim().toLowerCase()];if(!i)return e;let r=i.split(" "),a=[...e.slice(0,n),...r,...e.slice(n+1)];return t.push({from:o,to:r,reason:"command_alias",confidence:"high"}),a}function E(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function j(e){return E(e).replace(/-/g,"")}function q(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function _e(e){let t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(let o of e.aliases??[])n(o);return t}function Ce(e,t){let n=t??y(e),o=new Map,i=new Map,r=new Map,a=new Set;for(let s of n){let l=_e(s);if(l.length===0)continue;let c=`--${E(l[0])}`;for(let f of l)q(o,E(f),c),q(i,j(f),c);let u=j(c);r.has(c)||r.set(c,u),s.list===!0&&a.add(c)}return{canonicalByNormalized:o,canonicalByCompact:i,canonicalComparables:[...r.entries()].map(([s,l])=>({canonicalFlag:s,comparable:l})),listCanonicalFlags:a}}function Y(e,t){let n=E(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let i=n.replace(/-/g,""),r=t.canonicalByCompact.get(i);if(typeof r=="string")return{flag:r,reason:"flag_alias",confidence:"high"};let a=i.length>=8?2:1,s=Number.POSITIVE_INFINITY,l,c=!1;for(let u of t.canonicalComparables){let f=C(i,u.comparable,a);if(f!==null){if(f<s){s=f,l=u.canonicalFlag,c=!1;continue}f===s&&l!==u.canonicalFlag&&(c=!0)}}return!l||c||!Number.isFinite(s)||s<=0?null:{flag:l,reason:"flag_typo",confidence:s>=2?"medium":"high"}}function ft(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function ve(e,t=!1){if(t||e.includes("://"))return null;let n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;let o=n[1],i=n[3];return i.length===0?null:{key:o,value:i}}function ke(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),i=o>=0?e.slice(0,o):e,r=o>=0?e.slice(o+1):void 0,a=Y(i,t);if(!a)return{tokens:[e]};let s=r===void 0?a.flag:`${a.flag}=${r}`;return s===e?{tokens:[e]}:{tokens:[s],event:{from:e,to:[s],reason:a.reason,confidence:a.confidence}}}function Te(e){let t=new Set,n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}let i=e[o];n=i==="--path"||i==="--pm-path"}return t}function xe(e){if(!e.startsWith("--"))return null;let t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function Ee(e,t,n){n.push(e[t]);let o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function Se(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let i=[],r=t+1;for(;r<e.length&&e[r]!=="--"&&!e[r].startsWith("-")&&(i.length===0||o.has(n.flag));)i.push(e[r]),r+=1;let a=i.length===0?1:1+i.length;return{originalTokens:e.slice(t,t+a),value:i.length===0?void 0:i.join(","),consumed:a}}function Ae(e,t,n,o){let i=e.get(n);if(i){i.values.push(o.value),i.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function Oe(e,t){let n=[],o=[];for(let[i,r]of e){if(!(r.occurrences>=2||t.has(i)&&r.originalTokens.length>2)){o.push({outputIndex:r.outputIndex,tokens:r.originalTokens});continue}let a=`${i}=${r.values.join(",")}`;o.push({outputIndex:r.outputIndex,tokens:[a]}),n.push({from:`${i} (x${r.occurrences})`,to:[a],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function Ne(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function Pe(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let i=[],r=new Map,a=0;for(;a<e.length;){let c=e[a];if(c==="--"){i.push(...e.slice(a));break}if(n.has(c)){a=Ee(e,a,i);continue}let u=xe(c);if(!u||!t.has(u.flag)){i.push(c),a+=1;continue}let f=Se(e,a,u,o);if(f.value===void 0){i.push(c),a+=f.consumed;continue}Ae(r,i,u.flag,{originalTokens:f.originalTokens,value:f.value}),a+=f.consumed}let{events:s,splices:l}=Oe(r,o);return Ne(i,l),{argv:i,events:s}}var X=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function Le(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],i=X.get(o);return i!==void 0&&i.has(n)}function Me(e,t,n){if(t!=="test")return e;let o=[],i=0;for(;i<e.length;){let r=e[i];if(r==="--")return o.push(...e.slice(i)),o;let a=X.get(r),s=a?e[i+1]:void 0;if(!a||typeof s!="string"||!a.has(s)){o.push(r),i+=1;continue}let l=i+2;for(;l<e.length&&!e[l].startsWith("-");)l+=1;if(l-(i+2)!==1){o.push(r),i+=1;continue}let c=e[i+2],u=`${s}=${c}`;o.push(r,u),n.push({from:`${r} ${s} ${c}`,to:[r,u],reason:"bare_key_value",confidence:"high"}),i+=3}return o}function De(e,t,n,o){let i=[],r=Te(e);for(let a=0;a<e.length;a+=1){let s=e[a];if(s==="--"){i.push(...e.slice(a));break}let l=r.has(a),c=i[i.length-1];if(s.startsWith("--")){let b=ke(s,t,l);i.push(...b.tokens),b.event&&o.push(b.event);continue}let u=ve(s,l);if(!u||typeof c=="string"&&c.startsWith("-")&&!c.includes("=")||["search","comments","notes","learnings"].includes(n)||Le(n,i)){i.push(s);continue}let f=Y(u.key,t);if(!f){i.push(s);continue}let g=u.value.startsWith("-")?[`${f.flag}=${u.value}`]:[f.flag,u.value];i.push(...g),o.push({from:s,to:g,reason:"bare_key_value",confidence:f.confidence})}return i}function Fe(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--verify"){let o=e[t+1];if(o===void 0||o==="--")throw new h("history attest --verify requires a bundle file.",p.USAGE);e.splice(t,2,`--verify=${o}`)}else(I.has(n)||n==="--output"||n==="--hash-algorithm")&&(t+=1)}}function Ve(e,t){if(!e.some(o=>o==="--help"||o==="-h"))return;let n=new Set(y(t).flatMap(o=>[o.flag,...o.aliases??[],...o.short===void 0?[]:[o.short]]));for(let o=0;o<e.length;o+=1){let i=e[o];if(i==="--")break;i!=="--help"&&i!=="-h"||n.has(e[o-1])&&!v.has(e[o-1])&&(e[o-1]=i)}}function pt(e){let t=[],n=we(e,t),o=be(n);(o.length!==n.length||o.some((b,Q)=>b!==n[Q]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let i=Ie(o,t),r=U(i);if(r.conflict)throw new h("Provide the item id either positionally or with --id, not both.",p.USAGE);r.changed&&t.push({from:`--id ${r.itemId}`,to:[r.itemId],reason:"item_id_alias",confidence:"high"});let a=me(r.argv),s=Z(r.argv),l=m(s??a??""),c=Ce(s??a),u=De(r.argv,c,l,t),f=Me(u,l,t),g=Pe(f,c.listCanonicalFlags,I,a==="create"?new Set(["--tags"]):new Set);for(let b of g.events)t.push(b);return Ve(g.argv,s??a),s==="history attest"&&Fe(g.argv),{argv:g.argv,commandName:a,trace:t}}function Z(e){let t=K(e),n=t[0]?.trim().toLowerCase(),o=t[1]?.trim().toLowerCase(),i=P(t);return i?i.canonical:(n==="extension"||n==="package"||n==="packages")&&typeof o=="string"&&o.length>0&&!o.startsWith("-")?`${n} ${o}`:n}function mt(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--type"){let o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){let o=n.slice(7).trim();if(o.length>0)return o}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fb625cd9-f8a8-56cf-88ab-abef64051497")}catch{}})();function wt(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new h("--author requires a non-empty value.",p.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=R();T(t);let o=!1;return()=>{o||(o=!0,n===void 0?T(void 0):T(n))}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d0e60f7e-e0a8-5ef4-9af7-4a1f102ccb7d")}catch{}})();var d=Object.freeze({clock:"PM_CLOCK",tickMs:"PM_CLOCK_TICK_MS",seed:"PM_SEED"});function S(e,t,n,o){return new h(e,p.USAGE,{code:"invalid_reproducible_process_environment",reason:t,field:n,required:`${d.clock} and ${d.seed}; ${d.tickMs} is optional`,nextSteps:[`Set ${d.clock} to an ISO-8601 instant with Z or a numeric UTC offset and ${d.seed} to a non-empty reproducibility seed.`,`Optionally set ${d.tickMs} to a non-negative integer; it defaults to 1.`,"Unset all three variables to retain normal wall-clock and cryptographic-random behavior."],recovery:{recovery_mode:"compact",provided_fields:o,missing_required_fields:t==="incomplete"?[d.clock,d.seed].filter(i=>!o.includes(i)):void 0}})}function $e(e){let t=e[d.clock],n=e[d.tickMs],o=e[d.seed],i=[[d.clock,t],[d.tickMs,n],[d.seed,o]].filter(a=>a[1]!==void 0).map(([a])=>a);if(i.length===0)return;if(t===void 0||o===void 0)throw S("Reproducible process execution requires PM_CLOCK and PM_SEED together.","incomplete",t===void 0?d.clock:d.seed,i);if(o.trim().length===0)throw S(`${d.seed} must not be empty.`,"invalid_value",d.seed,i);if(!$(t))throw S(`${d.clock} must be a valid ISO-8601 instant with Z or a numeric UTC offset.`,"invalid_value",d.clock,i);let r=n===void 0?1:Number(n);if(n?.trim().length===0||!Number.isSafeInteger(r)||r<0)throw S(`${d.tickMs} must be a non-negative integer.`,"invalid_value",d.tickMs,i);return F({clock:t,seed:o,tickMs:r})}function Be(e){let t=$e(e);return t===void 0?n=>n():V(t)}async function Tt(e,t){return Be(e)(t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d5c48881-420f-5673-8696-e770db353cfc")}catch{}})();function H(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function Ot(e){if(!(!Array.isArray(e)||e.length===0))return k(e)}function Re(e,t){let n=H(t);if(!n)return;let o=y(e).find(i=>i.flag===n||i.aliases?.includes(n));return o?o.value_type==="boolean"?null:`<${o.value_name??"value"}>`:"<value>"}function Nt(e,t,n){let o=[...e],i=o.indexOf("--"),r=i<0?o.length:i;for(let a of n){let s=H(a);if(!s||o.slice(0,r).some(u=>u===s||u.startsWith(`${s}=`)))continue;let l=Re(t,s),c=l?[s,l]:[s];o.splice(r,0,...c),r+=c.length}return o.length===e.length?void 0:D(o)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bd9a8d3b-bc6f-5309-a3fb-7e5f41ef9dab")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="12066389-daef-5fce-b7a6-0ecffa926d66")}catch{}})();function $t(e,t){let n=e.trim().split(/\s+/u);if(!(n.length<2||t.includes(n.join(" "))))for(let o=1;o<n.length;o+=1){if(!t.includes(n.slice(0,o).join(" ")))return;let i=n.slice(o).join(" "),r=_(i),a=new Set(t.filter(s=>s===i||s.endsWith(` ${i}`)||s===r?.canonical).map(s=>_(s)?.canonical??s).filter(s=>t.includes(s)));if(a.size>0)return a.size===1?[...a][0]:void 0}}var ze={add:["create","append"],fetch:["get"],inspect:["get","health"],log:["history","comments","notes"],ls:["list"],pause:["release"],read:["get"],remove:["delete"],rm:["delete"],show:["get"],start:["start-task"]};function J(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let i=n.split(" "),r=ze[o]?.indexOf(m(n));if(r!==void 0&&r>=0)return r;if(n===o)return 10;if(i.includes(o))return 11;if(i.some(l=>l.startsWith(o)))return 12;let a=o.length>=5?2:1,s=Number.POSITIVE_INFINITY;for(let l of i){let c=C(l,o,a);c!==null&&(s=Math.min(s,c))}return Number.isFinite(s)?20+s:n.includes(o)?30:Number.POSITIVE_INFINITY}function Bt(e,t){return e.map(n=>({path:n,score:J(n,t)})).filter(n=>Number.isFinite(n.score)).sort((n,o)=>n.score!==o.score?n.score-o.score:n.path===o.path?0:n.path<o.path?-1:1).map(n=>n.path)}function Rt(e,t,n){let o=new Set(t),i=A.filter(s=>s.lifecycle==="deprecated").slice().sort((s,l)=>l.alias.length-s.alias.length),r=[],a=e.flatMap(s=>{let l=i.find(u=>s===u.alias||s.startsWith(`${u.alias} `)),c=s;if(l){let u=s.slice(l.alias.length);if(!o.has(`${l.canonical}${u}`))return[];c=`${l.canonical_argv.join(" ")}${u}`}return n!==void 0&&J(s,n)<10&&r.push(c),[c]});return[...new Set(r.length>0?r:a)]}export{Ue as a,Ye as b,te as c,ne as d,Xe as e,Ze as f,G as g,U as h,fe as i,K as j,pe as k,x as l,me as m,dt as n,be as o,ft as p,Pe as q,Me as r,pt as s,mt as t,wt as u,d as v,$e as w,Be as x,Tt as y,Ot as z,Re as A,Nt as B,$t as C,J as D,Bt as E,Rt as F};
2
+ //# sourceMappingURL=chunk-ILQEZ4Y6.js.map