@unbrained/pm-cli 2026.11.28 → 2026.11.30

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 (196) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/commander-usage.js +4 -4
  3. package/dist/cli/error-guidance.js +5 -5
  4. package/dist/cli/linked-resource-value-list.js +2 -0
  5. package/dist/cli-bundle/bundle-manifest.json +1 -1
  6. package/dist/cli-bundle/chunks/{chunk-O2WNNIKK.js → chunk-2SBTXR6C.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-YEMFOKFG.js → chunk-3AZOATC2.js} +2 -2
  8. package/dist/cli-bundle/chunks/{chunk-CATRDGAB.js → chunk-3TXEWHQX.js} +2 -2
  9. package/dist/cli-bundle/chunks/chunk-47ZS6RPL.js +2 -0
  10. package/dist/cli-bundle/chunks/{chunk-MGJMQSN4.js → chunk-4QA5O64H.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-5EFS7K7Y.js +1 -0
  12. package/dist/cli-bundle/chunks/{chunk-E2LQ6LCJ.js → chunk-5PNOVDVO.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-OFIYA3PI.js → chunk-AOTI76Q6.js} +3 -3
  14. package/dist/cli-bundle/chunks/{chunk-TWRUA2NH.js → chunk-CCKM5YQM.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-CTM26LUE.js → chunk-DCWGM7CY.js} +2 -2
  16. package/dist/cli-bundle/chunks/chunk-FECZV72T.js +2 -0
  17. package/dist/cli-bundle/chunks/{chunk-O2SWNEBW.js → chunk-FR7ULTM4.js} +2 -2
  18. package/dist/cli-bundle/chunks/chunk-GSLOAEY2.js +2 -0
  19. package/dist/cli-bundle/chunks/{chunk-ZXERHBMA.js → chunk-HXQ3OHQR.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-T7RZPIOB.js → chunk-IGEFPHV7.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-FG4TNQQM.js → chunk-JPJNJHQW.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-6OIHST4I.js → chunk-K672XXGQ.js} +3 -3
  23. package/dist/cli-bundle/chunks/{chunk-CDUV7DFD.js → chunk-KCVSSONY.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-LMDIKSDZ.js → chunk-KXTKLDKD.js} +8 -8
  25. package/dist/cli-bundle/chunks/chunk-NHBG5ET3.js +2 -0
  26. package/dist/cli-bundle/chunks/chunk-NVYDPNQP.js +2 -0
  27. package/dist/cli-bundle/chunks/{chunk-C4O5TZY3.js → chunk-NZSXWIX7.js} +60 -60
  28. package/dist/cli-bundle/chunks/{chunk-KHFUHGL3.js → chunk-OGVSGXQX.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-LRGYV6QQ.js → chunk-Q4VZSMUL.js} +2 -2
  30. package/dist/cli-bundle/chunks/chunk-SJWIPGZW.js +113 -0
  31. package/dist/cli-bundle/chunks/chunk-TE6FBDHP.js +4 -0
  32. package/dist/cli-bundle/chunks/{chunk-Q6BGQRCB.js → chunk-TX74QJ4W.js} +2 -2
  33. package/dist/cli-bundle/chunks/chunk-TY55UX6M.js +10 -0
  34. package/dist/cli-bundle/chunks/chunk-USBTXMKS.js +2 -0
  35. package/dist/cli-bundle/chunks/chunk-VCXQ6A35.js +3 -0
  36. package/dist/cli-bundle/chunks/chunk-WFYE34TO.js +23 -0
  37. package/dist/cli-bundle/chunks/chunk-X5D5YUHR.js +2 -0
  38. package/dist/cli-bundle/chunks/chunk-YPMNXG2C.js +2 -0
  39. package/dist/cli-bundle/chunks/chunk-YVTALIN3.js +2 -0
  40. package/dist/cli-bundle/chunks/{chunk-JQYPSABI.js → chunk-Z7YL2SUM.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-T7UTG56V.js → chunk-ZA5NS3PL.js} +3 -3
  42. package/dist/cli-bundle/chunks/field-definition-losses-XKE4DRUA.js +2 -0
  43. package/dist/cli-bundle/chunks/{field-option-collisions-G4LQ2646.js → field-option-collisions-2F2Z7R7B.js} +2 -2
  44. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-H3MMNXXG.js → indexed-receipt-blobs-DR3FDHND.js} +2 -2
  45. package/dist/cli-bundle/chunks/{item-revision-O7L3AA2W.js → item-revision-UAF6L47R.js} +2 -2
  46. package/dist/cli-bundle/chunks/item-transaction-RJECL53Y.js +2 -0
  47. package/dist/cli-bundle/chunks/linked-resource-value-list-WXPPYUVQ.js +2 -0
  48. package/dist/cli-bundle/chunks/{mutation-actor-A45DFDEO.js → mutation-actor-UK3QNEEB.js} +2 -2
  49. package/dist/cli-bundle/chunks/mutation-admission-UTDYPFWP.js +2 -0
  50. package/dist/cli-bundle/chunks/{register-list-query-FCPGG2UT.js → register-list-query-DRA3CWHI.js} +2 -2
  51. package/dist/cli-bundle/chunks/{register-mutation-VD3JX23I.js → register-mutation-WO74VLEQ.js} +2 -2
  52. package/dist/cli-bundle/chunks/register-operations-CRBKH7WN.js +2 -0
  53. package/dist/cli-bundle/chunks/{register-setup-EWAZZWPL.js → register-setup-6V6NQB5C.js} +2 -2
  54. package/dist/cli-bundle/chunks/runtime-schema-OAIUNQRL.js +2 -0
  55. package/dist/cli-bundle/chunks/{settlement-hook-KWBOSRDZ.js → settlement-hook-BIVNGBZF.js} +2 -2
  56. package/dist/cli-bundle/chunks/{stage-UIDZMTE5.js → stage-DYEHGASU.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/chunk-26P6C6OO.js +2 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-2UUBS4BG.js +2 -0
  59. package/dist/cli-bundle/focused-chunks/{chunk-J4V3J5MC.js → chunk-4ER3VMST.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/chunk-4YBMHMBJ.js +2 -0
  61. package/dist/cli-bundle/focused-chunks/{chunk-Y7EC2L2G.js → chunk-62AMZMR4.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{chunk-OEMI52ZS.js → chunk-7G7JIXLL.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{chunk-YC3PFFDE.js → chunk-A3DORTXS.js} +57 -57
  64. package/dist/cli-bundle/focused-chunks/{chunk-AHCOSTL7.js → chunk-CWQLW4ZO.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-CQLOYNJY.js → chunk-FM5WQ6ZU.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/chunk-HXM7K6VH.js +100 -0
  67. package/dist/cli-bundle/focused-chunks/{chunk-7EKKUYN5.js → chunk-IIVDBAJM.js} +3 -3
  68. package/dist/cli-bundle/focused-chunks/{chunk-ZYHGQIQ7.js → chunk-IJ3T3W4U.js} +2 -2
  69. package/dist/cli-bundle/focused-chunks/{chunk-NGFDPEP7.js → chunk-IRYNVGKH.js} +3 -3
  70. package/dist/cli-bundle/focused-chunks/chunk-JFICNN4T.js +4 -0
  71. package/dist/cli-bundle/focused-chunks/chunk-KPASZGBL.js +2 -0
  72. package/dist/cli-bundle/focused-chunks/{chunk-YX75PQFO.js → chunk-L357ZAES.js} +2 -2
  73. package/dist/cli-bundle/focused-chunks/{chunk-HCWDMFWA.js → chunk-LWBZ7UGG.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/{chunk-JD45Y2BR.js → chunk-M57KDG7I.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/chunk-MZNV26XE.js +8 -0
  76. package/dist/cli-bundle/focused-chunks/chunk-NGHT2LNG.js +3 -0
  77. package/dist/cli-bundle/focused-chunks/chunk-NJTKGBSK.js +2 -0
  78. package/dist/cli-bundle/focused-chunks/{chunk-7P6OGPEG.js → chunk-P55AZPFN.js} +2 -2
  79. package/dist/cli-bundle/focused-chunks/chunk-RQYVX2T6.js +2 -0
  80. package/dist/cli-bundle/focused-chunks/{chunk-Q6JCMFGU.js → chunk-SXC3NVZI.js} +2 -2
  81. package/dist/cli-bundle/focused-chunks/chunk-TQQO42C2.js +44 -0
  82. package/dist/cli-bundle/focused-chunks/{chunk-VNU3IFBL.js → chunk-U35K7FSE.js} +2 -2
  83. package/dist/cli-bundle/focused-chunks/chunk-UQJ4PY2Y.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/{chunk-XVCMYFQU.js → chunk-WAP3DF4B.js} +2 -2
  85. package/dist/cli-bundle/focused-chunks/{chunk-4SX2BN4V.js → chunk-XR6MLUVW.js} +2 -2
  86. package/dist/cli-bundle/focused-chunks/chunk-XR745UGE.js +4 -0
  87. package/dist/cli-bundle/focused-chunks/field-definition-losses-GGA6FUHD.js +2 -0
  88. package/dist/cli-bundle/focused-chunks/{field-option-collisions-63YQ2J3N.js → field-option-collisions-7TG7STO7.js} +2 -2
  89. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-PG2VJ3MB.js → indexed-receipt-blobs-EUYZJR5R.js} +2 -2
  90. package/dist/cli-bundle/focused-chunks/{item-revision-PV5O6F5Y.js → item-revision-J7EUGCHR.js} +2 -2
  91. package/dist/cli-bundle/focused-chunks/item-transaction-2IC2MLML.js +2 -0
  92. package/dist/cli-bundle/focused-chunks/{mutation-actor-2AAUJG2Z.js → mutation-actor-LJVF2HVD.js} +2 -2
  93. package/dist/cli-bundle/focused-chunks/mutation-admission-SLFAUONA.js +2 -0
  94. package/dist/cli-bundle/focused-chunks/runtime-schema-IDRXWCC4.js +2 -0
  95. package/dist/cli-bundle/focused-chunks/{settlement-hook-4MGRERCT.js → settlement-hook-Q6MJQKIE.js} +2 -2
  96. package/dist/cli-bundle/focused-chunks/{stage-56RYPMBK.js → stage-MWR73LTZ.js} +2 -2
  97. package/dist/cli-bundle/main.js +26 -26
  98. package/dist/cli-bundle/sdk-authoring.js +1 -1
  99. package/dist/cli-bundle/sdk-contracts.js +1 -1
  100. package/dist/cli-bundle/sdk-core.js +1 -1
  101. package/dist/cli-bundle/sdk-governance.js +1 -1
  102. package/dist/cli-bundle/sdk-graph.js +1 -1
  103. package/dist/cli-bundle/sdk-merge.js +63 -63
  104. package/dist/cli-bundle/sdk-query.js +1 -1
  105. package/dist/cli-bundle/sdk-runtime.js +1 -1
  106. package/dist/cli-bundle/sdk-testing.js +1 -1
  107. package/dist/cli-bundle/sdk.js +1 -1
  108. package/dist/core/extensions/item-fields.d.ts +18 -1
  109. package/dist/core/extensions/item-fields.js +1 -1
  110. package/dist/core/extensions/loader.js +1 -1
  111. package/dist/core/fs/fs-utils.d.ts +8 -0
  112. package/dist/core/fs/fs-utils.js +2 -2
  113. package/dist/core/item/item-type-inspection.js +2 -0
  114. package/dist/core/item/type-registry.js +1 -1
  115. package/dist/core/schema/runtime-schema.d.ts +19 -0
  116. package/dist/core/schema/runtime-schema.js +2 -2
  117. package/dist/core/shared/url-credentials.d.ts +4 -2
  118. package/dist/core/shared/url-credentials.js +1 -1
  119. package/dist/core/store/settings.d.ts +7 -0
  120. package/dist/core/store/settings.js +5 -5
  121. package/dist/sdk/context-intent-contracts.js +1 -1
  122. package/dist/sdk/extension-command-context.js +2 -2
  123. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  124. package/dist/sdk/governance/validate.js +1 -1
  125. package/dist/sdk/public-surface.json +1 -1
  126. package/dist/sdk/runtime/schema.js +1 -1
  127. package/dist/sdk/schema/field-definition-losses.js +1 -1
  128. package/dist/sdk/schema/schema-file-entry-losses.js +2 -0
  129. package/dist/sdk/test/execution.d.ts +9 -1
  130. package/dist/sdk/test/execution.js +4 -4
  131. package/docs/COMMANDS.md +3 -1
  132. package/docs/CONFIGURATION.md +23 -4
  133. package/docs/EXTENSIONS.md +1 -1
  134. package/docs/READ_OUTPUT_CONTRACTS.md +5 -0
  135. package/docs/SDK.md +19 -3
  136. package/docs/SDK_AUDITED_MUTATIONS.md +9 -0
  137. package/marketplace.json +1 -1
  138. package/node_modules/fast-json-patch/README.md +2 -2
  139. package/node_modules/fast-json-patch/dist/fast-json-patch.js +604 -818
  140. package/node_modules/fast-json-patch/dist/fast-json-patch.min.js +4 -8
  141. package/node_modules/fast-json-patch/package.json +14 -17
  142. package/package.json +2 -2
  143. package/packages/pm-beads/package.json +1 -1
  144. package/packages/pm-calendar/package.json +1 -1
  145. package/packages/pm-command-kit/package.json +1 -1
  146. package/packages/pm-digital-twin/package.json +1 -1
  147. package/packages/pm-governance-audit/package.json +1 -1
  148. package/packages/pm-guide-shell/package.json +1 -1
  149. package/packages/pm-kanban/package.json +1 -1
  150. package/packages/pm-lifecycle-hooks/package.json +1 -1
  151. package/packages/pm-linked-test-adapters/package.json +1 -1
  152. package/packages/pm-search-advanced/package.json +1 -1
  153. package/packages/pm-templates/package.json +1 -1
  154. package/packages/pm-todos/package.json +1 -1
  155. package/packages/pm-vcs/package.json +1 -1
  156. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  157. package/plugins/pm-claude/package.json +1 -1
  158. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  159. package/plugins/pm-codex/package.json +1 -1
  160. package/plugins/pm-codex/plugin.json +1 -1
  161. package/runtime-dependencies.json +1 -1
  162. package/dist/cli-bundle/chunks/chunk-2YD2AERA.js +0 -2
  163. package/dist/cli-bundle/chunks/chunk-54AQJTUH.js +0 -3
  164. package/dist/cli-bundle/chunks/chunk-56DKWGHE.js +0 -2
  165. package/dist/cli-bundle/chunks/chunk-56GUDMXN.js +0 -113
  166. package/dist/cli-bundle/chunks/chunk-5ECCMDSU.js +0 -2
  167. package/dist/cli-bundle/chunks/chunk-6RBD2AKU.js +0 -2
  168. package/dist/cli-bundle/chunks/chunk-D3I5AHNN.js +0 -2
  169. package/dist/cli-bundle/chunks/chunk-MO6PPUI6.js +0 -2
  170. package/dist/cli-bundle/chunks/chunk-RGE3XW3A.js +0 -2
  171. package/dist/cli-bundle/chunks/chunk-SP6CDM6B.js +0 -31
  172. package/dist/cli-bundle/chunks/chunk-WKDKBS4P.js +0 -4
  173. package/dist/cli-bundle/chunks/chunk-YLS2N4SN.js +0 -2
  174. package/dist/cli-bundle/chunks/field-definition-losses-JFMMMVTV.js +0 -2
  175. package/dist/cli-bundle/chunks/item-transaction-4XC74ULD.js +0 -2
  176. package/dist/cli-bundle/chunks/mutation-admission-SIUIMAEO.js +0 -2
  177. package/dist/cli-bundle/chunks/register-operations-KHJD4GFZ.js +0 -2
  178. package/dist/cli-bundle/chunks/runtime-schema-3RAXYNG5.js +0 -2
  179. package/dist/cli-bundle/focused-chunks/chunk-5MZXU6HB.js +0 -2
  180. package/dist/cli-bundle/focused-chunks/chunk-64DSKZJN.js +0 -100
  181. package/dist/cli-bundle/focused-chunks/chunk-A5B43EWU.js +0 -2
  182. package/dist/cli-bundle/focused-chunks/chunk-E4C6T3NL.js +0 -2
  183. package/dist/cli-bundle/focused-chunks/chunk-KMGI5GZP.js +0 -2
  184. package/dist/cli-bundle/focused-chunks/chunk-MSLRDKWL.js +0 -4
  185. package/dist/cli-bundle/focused-chunks/chunk-O33WUEAF.js +0 -3
  186. package/dist/cli-bundle/focused-chunks/chunk-RBOWKXFV.js +0 -8
  187. package/dist/cli-bundle/focused-chunks/chunk-TF57RHS2.js +0 -2
  188. package/dist/cli-bundle/focused-chunks/chunk-X5ZVPFK7.js +0 -4
  189. package/dist/cli-bundle/focused-chunks/chunk-Z4FWJGQG.js +0 -2
  190. package/dist/cli-bundle/focused-chunks/chunk-ZHHFOQSL.js +0 -44
  191. package/dist/cli-bundle/focused-chunks/chunk-ZUAPUBJK.js +0 -2
  192. package/dist/cli-bundle/focused-chunks/field-definition-losses-NUZO3JCP.js +0 -2
  193. package/dist/cli-bundle/focused-chunks/item-transaction-S5QXBGAT.js +0 -2
  194. package/dist/cli-bundle/focused-chunks/mutation-admission-X7HHNERR.js +0 -2
  195. package/dist/cli-bundle/focused-chunks/runtime-schema-5J2ONRNV.js +0 -2
  196. package/node_modules/fast-json-patch/webpack.config.js +0 -63
@@ -1,2 +1,2 @@
1
- import{$ as ge,$a as T,Aa as Me,Ba as Ae,C as t,Ca as he,D as x,Da as Pe,E as Ko,Ea as _e,F as Qo,Fa as be,G as Yo,Ga as Be,H as Zo,Ha as Oe,I as $o,Ia as Ue,J as oe,Ja as We,K as ee,Ka as je,L as re,La as we,M as te,Ma as De,N as xe,Na as Le,O as me,Oa as Ne,P as pe,Pa as Ve,Q as ae,Qa as ze,R as ne,Ra as Xe,S as fe,Sa as qe,T as se,Ta as Ge,U as ce,Ua as He,V as ie,Va as Je,W as Ce,Wa as Ke,X as ue,Xa as Qe,Y as le,Ya as Ye,Z as de,Za as R,_ as ye,_a as S,a as Uo,aa as ke,b as Wo,ba as Ee,c as jo,ca as Fe,d as wo,da as Ie,e as Do,ea as m,f as Lo,fa as p,g as No,ga as a,h as Vo,ha as n,i as zo,ia as f,ja as s,ka as c,la as i,ma as C,na as u,oa as l,pa as d,qa as y,ra as g,s as Xo,sa as k,t as qo,ta as E,u as Go,ua as F,v as Ho,va as I,w as Jo,wa as Re,xa as Se,ya as Te,za as ve}from"./focused-chunks/chunk-YX75PQFO.js";import{W as r,a as ko,b as Eo,c as Fo,d as Io,e as Ro,f as So,g as To,p as vo,q as Mo,r as Ao,s as ho,t as Po,u as _o,v as bo,w as Bo,x as Oo}from"./focused-chunks/chunk-MSLRDKWL.js";import"./focused-chunks/chunk-TF57RHS2.js";import{Ja as e,ua as eo}from"./focused-chunks/chunk-XVCMYFQU.js";import{b as v,c as M,d as A,e as h,g as P,h as _,j as b}from"./focused-chunks/chunk-J4V3J5MC.js";import"./focused-chunks/chunk-5MZXU6HB.js";import{a as fo,b as so,c as co,d as io,e as Co,f as uo,g as lo,h as yo,i as go}from"./focused-chunks/chunk-CQLOYNJY.js";import"./focused-chunks/chunk-BKPUUW5O.js";import{A as ao,B as no,s as o,u as ro,v as to,w as xo,x as mo,z as po}from"./focused-chunks/chunk-JD45Y2BR.js";import"./focused-chunks/chunk-RBOWKXFV.js";import"./focused-chunks/chunk-AHCOSTL7.js";import"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{Af as $,Bf as oo,Ic as O,if as U,jf as W,kf as j,lf as w,mf as D,nf as L,of as N,pf as V,qf as z,rf as X,sc as B,sf as q,tf as G,uf as H,vf as J,wf as K,xf as Q,yf as Y,zf as Z}from"./focused-chunks/chunk-64DSKZJN.js";import"./focused-chunks/chunk-O33WUEAF.js";import"./focused-chunks/chunk-A5B43EWU.js";import"./focused-chunks/chunk-X5ZVPFK7.js";import"./focused-chunks/chunk-NGFDPEP7.js";export{so as ACTIONABILITY_ORDERING_KINDS,M as BRIEF_LIST_FIELDS,ee as CONTEXT_EVALUATION_METRIC_NAMES,m as CONTEXT_OUTPUT_VALUES,pe as CONTEXT_PACKING_PROFILES,Yo as CONTEXT_RELEVANCE_SERVICE,Ko as CONTEXT_RELEVANCE_SIGNAL_NAMES,fe as CONTEXT_SIGNAL_SET_VERSION,ne as CONTEXT_SIGNAL_STORE_FORMAT_VERSION,se as CONTEXT_SIGNAL_STORE_WARNING_DETAILS,X as CONTEXT_USAGE_LIMITS,ue as ContextSignalStore,q as ContextUsageValidationError,be as DEFAULT_CHILD_SAMPLE_LIMIT,v as DEFAULT_COMPACT_LIST_FIELDS,mo as DEFAULT_DERIVED_INDEX_MINIMUM_ITEMS,de as DEFAULT_WORKSPACE_MEMORY_MINIMUM_ITEMS,R as EVAL_METRIC_NAMES,_ as GET_DEPTH_INPUT_VALUES,P as GET_DEPTH_VALUES,Ce as JsonFileContextSignalStoreAdapter,A as LIST_COMMAND_DEFAULT_PROJECTIONS,Ao as LIST_SORT_FIELDS,ho as LIST_SORT_ORDER_VALUES,_e as MAX_CHILD_PROJECTION_ITEMS,Re as NEXT_OUTPUT_VALUES,Xo as NEXT_RANKING_POLICIES,Uo as OutputEnvelopeFitError,jo as PM_COMPLETE_LIST_FINDING_CODES,wo as PmCompleteListValidationError,z as QUERY_CURSOR_CONTRACT,Oo as _testOnly,Pe as _testOnlyAggregateCommand,Ue as _testOnlyGetCommand,Te as _testOnlyNextCommand,Qe as _testOnlySearchCommand,po as acquireItemMetadataDerivedIndexLock,r as analyzeDuplicateItems,F as applyContextTagProjection,Po as applyFilterValueEcho,Vo as assertCompleteListResult,G as attachContextUsageServingReceipt,y as buildChildrenByParent,Xe as buildCompactSearchFilterSummary,_o as buildContentFilterEcho,ie as buildContextSignalSnapshot,bo as buildGovernanceMissingFilterEcho,Be as buildItemChildrenRollup,Qo as buildItemContextRelevanceCandidates,qe as buildVerboseSearchFilters,ye as buildWorkspaceMemorySnapshot,No as certifyCompleteListResult,He as classifyImplicitSemanticFallbackReason,co as collectBlockedByIds,Co as collectBlockedByIdsFromCorpus,J as collectContextUsageDeliveredItemIds,lo as collectDependencyBlockedIds,Ge as collectErrorCauseCodes,i as collectSubtreeIds,C as compareCriticalItems,go as computeActionabilityReport,Do as createCompleteListOptions,W as createQueryFingerprint,Ve as createSearchCursorFingerprint,L as decodeQueryCursor,w as decodeQueryCursorEnvelope,D as decodeQueryCursorState,Zo as defaultScoreContextCandidates,j as encodeQueryCursor,re as evaluateContextRanking,T as evaluateMetricFloors,e as executeEmbeddingBatchesWithRetry,K as finalizeContextUsageDelivery,Wo as fitOutputEnvelope,Ke as formatVectorIndexRecoveryWarnings,io as indexBlockedByIds,Lo as inspectCompleteListResult,b as listGetProjectionFields,h as listListProjectionFields,o as measureItemMetadataReadWork,k as mergeSortedWarnings,ae as packContextCandidates,u as packRankedContextItems,V as paginateQueryRows,s as parseContextDepth,p as parseContextFocusFields,c as parseContextSections,ce as parseContextSignalSnapshot,S as parseEvalMetricFloors,ko as parseIntegerLimit,eo as parseLimit,Io as parseMultiValueFilter,Eo as parsePriority,To as parsePriorityFilterSet,Ro as parseStringFilterSet,Fo as parseType,So as parseTypeFilterSet,ve as partitionDecisionEntries,a as projectContextFocusRows,H as propagateContextUsageServingReceipt,ro as queryItemMetadataIndex,to as queryLinkedFileMetadataIndex,xo as querySimilarItemMetadataIndex,oo as readContextUsageAffinity,B as readHistoryEntries,ao as readItemMetadataDerivedIndexState,x as readRecentActivity,le as readWorkspaceContextSignals,ge as readWorkspaceMemory,Y as recordContextUsageDelivery,Q as recordContextUsageServing,Z as recordContextUsageTouch,$ as recordContextUsageTouches,no as refreshItemMetadataDerivedIndex,Go as renderCalendarMarkdown,Ho as renderCalendarToon,E as renderContextMarkdown,Ae as renderNextMarkdown,qo as resolveCalendarOutputFormat,Mo as resolveContentFieldFilters,n as resolveContextOutputFormat,f as resolveContextTokenBudget,we as resolveEffectiveSearchMode,Le as resolveHybridSemanticWeight,uo as resolveItemBlockers,fo as resolveItemExecutionRole,vo as resolveMissingMetadataFilters,Se as resolveNextOutputFormat,N as resolveQueryCursorStart,je as resolveSearchMaxResults,ze as resolveSearchPage,De as resolveSearchScoreThreshold,Ne as resolveSearchTuning,Je as resolveVectorIndexRecovery,t as runActivity,he as runAggregate,Jo as runCalendar,I as runContext,me as runContextEvaluationCorpus,te as runContextEvaluationScenario,zo as runDuplicates,Oe as runGet,We as runHistory,Bo as runList,Me as runNext,Ye as runSearch,$o as scoreContextCandidates,oe as scoreContextCandidatesWithActiveExtensions,Fe as searchWorkspaceMemory,Ie as searchWorkspaceMemoryReadResult,yo as selectActionableEntries,U as selectCursorSemanticOptions,Ee as selectWorkspaceMemory,ke as selectWorkspaceMemoryRollups,xe as summarizeContextEvaluationReports,g as toContextFocusItem,l as toContextPackingSummary,d as toContextRankingSummary,O as verifyHistoryChain};
1
+ import{$ as ge,$a as T,Aa as Me,Ba as Ae,C as t,Ca as he,D as x,Da as Pe,E as Ko,Ea as _e,F as Qo,Fa as be,G as Yo,Ga as Be,H as Zo,Ha as Oe,I as $o,Ia as Ue,J as oe,Ja as We,K as ee,Ka as je,L as re,La as we,M as te,Ma as De,N as xe,Na as Le,O as me,Oa as Ne,P as pe,Pa as Ve,Q as ae,Qa as ze,R as ne,Ra as Xe,S as fe,Sa as qe,T as se,Ta as Ge,U as ce,Ua as He,V as ie,Va as Je,W as Ce,Wa as Ke,X as ue,Xa as Qe,Y as le,Ya as Ye,Z as de,Za as R,_ as ye,_a as S,a as Uo,aa as ke,b as Wo,ba as Ee,c as jo,ca as Fe,d as wo,da as Ie,e as Do,ea as m,f as Lo,fa as p,g as No,ga as a,h as Vo,ha as n,i as zo,ia as f,ja as s,ka as c,la as i,ma as C,na as u,oa as l,pa as d,qa as y,ra as g,s as Xo,sa as k,t as qo,ta as E,u as Go,ua as F,v as Ho,va as I,w as Jo,wa as Re,xa as Se,ya as Te,za as ve}from"./focused-chunks/chunk-L357ZAES.js";import{W as r,a as ko,b as Eo,c as Fo,d as Io,e as Ro,f as So,g as To,p as vo,q as Mo,r as Ao,s as ho,t as Po,u as _o,v as bo,w as Bo,x as Oo}from"./focused-chunks/chunk-XR745UGE.js";import"./focused-chunks/chunk-RQYVX2T6.js";import{Ja as e,ua as eo}from"./focused-chunks/chunk-WAP3DF4B.js";import{b as v,c as M,d as A,e as h,g as P,h as _,j as b}from"./focused-chunks/chunk-4ER3VMST.js";import"./focused-chunks/chunk-UQJ4PY2Y.js";import{a as fo,b as so,c as co,d as io,e as Co,f as uo,g as lo,h as yo,i as go}from"./focused-chunks/chunk-FM5WQ6ZU.js";import"./focused-chunks/chunk-BKPUUW5O.js";import{A as ao,B as no,s as o,u as ro,v as to,w as xo,x as mo,z as po}from"./focused-chunks/chunk-M57KDG7I.js";import"./focused-chunks/chunk-MZNV26XE.js";import"./focused-chunks/chunk-CWQLW4ZO.js";import"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{Af as $,Bf as oo,Ic as O,if as U,jf as W,kf as j,lf as w,mf as D,nf as L,of as N,pf as V,qf as z,rf as X,sc as B,sf as q,tf as G,uf as H,vf as J,wf as K,xf as Q,yf as Y,zf as Z}from"./focused-chunks/chunk-HXM7K6VH.js";import"./focused-chunks/chunk-NGHT2LNG.js";import"./focused-chunks/chunk-26P6C6OO.js";import"./focused-chunks/chunk-JFICNN4T.js";import"./focused-chunks/chunk-IRYNVGKH.js";export{so as ACTIONABILITY_ORDERING_KINDS,M as BRIEF_LIST_FIELDS,ee as CONTEXT_EVALUATION_METRIC_NAMES,m as CONTEXT_OUTPUT_VALUES,pe as CONTEXT_PACKING_PROFILES,Yo as CONTEXT_RELEVANCE_SERVICE,Ko as CONTEXT_RELEVANCE_SIGNAL_NAMES,fe as CONTEXT_SIGNAL_SET_VERSION,ne as CONTEXT_SIGNAL_STORE_FORMAT_VERSION,se as CONTEXT_SIGNAL_STORE_WARNING_DETAILS,X as CONTEXT_USAGE_LIMITS,ue as ContextSignalStore,q as ContextUsageValidationError,be as DEFAULT_CHILD_SAMPLE_LIMIT,v as DEFAULT_COMPACT_LIST_FIELDS,mo as DEFAULT_DERIVED_INDEX_MINIMUM_ITEMS,de as DEFAULT_WORKSPACE_MEMORY_MINIMUM_ITEMS,R as EVAL_METRIC_NAMES,_ as GET_DEPTH_INPUT_VALUES,P as GET_DEPTH_VALUES,Ce as JsonFileContextSignalStoreAdapter,A as LIST_COMMAND_DEFAULT_PROJECTIONS,Ao as LIST_SORT_FIELDS,ho as LIST_SORT_ORDER_VALUES,_e as MAX_CHILD_PROJECTION_ITEMS,Re as NEXT_OUTPUT_VALUES,Xo as NEXT_RANKING_POLICIES,Uo as OutputEnvelopeFitError,jo as PM_COMPLETE_LIST_FINDING_CODES,wo as PmCompleteListValidationError,z as QUERY_CURSOR_CONTRACT,Oo as _testOnly,Pe as _testOnlyAggregateCommand,Ue as _testOnlyGetCommand,Te as _testOnlyNextCommand,Qe as _testOnlySearchCommand,po as acquireItemMetadataDerivedIndexLock,r as analyzeDuplicateItems,F as applyContextTagProjection,Po as applyFilterValueEcho,Vo as assertCompleteListResult,G as attachContextUsageServingReceipt,y as buildChildrenByParent,Xe as buildCompactSearchFilterSummary,_o as buildContentFilterEcho,ie as buildContextSignalSnapshot,bo as buildGovernanceMissingFilterEcho,Be as buildItemChildrenRollup,Qo as buildItemContextRelevanceCandidates,qe as buildVerboseSearchFilters,ye as buildWorkspaceMemorySnapshot,No as certifyCompleteListResult,He as classifyImplicitSemanticFallbackReason,co as collectBlockedByIds,Co as collectBlockedByIdsFromCorpus,J as collectContextUsageDeliveredItemIds,lo as collectDependencyBlockedIds,Ge as collectErrorCauseCodes,i as collectSubtreeIds,C as compareCriticalItems,go as computeActionabilityReport,Do as createCompleteListOptions,W as createQueryFingerprint,Ve as createSearchCursorFingerprint,L as decodeQueryCursor,w as decodeQueryCursorEnvelope,D as decodeQueryCursorState,Zo as defaultScoreContextCandidates,j as encodeQueryCursor,re as evaluateContextRanking,T as evaluateMetricFloors,e as executeEmbeddingBatchesWithRetry,K as finalizeContextUsageDelivery,Wo as fitOutputEnvelope,Ke as formatVectorIndexRecoveryWarnings,io as indexBlockedByIds,Lo as inspectCompleteListResult,b as listGetProjectionFields,h as listListProjectionFields,o as measureItemMetadataReadWork,k as mergeSortedWarnings,ae as packContextCandidates,u as packRankedContextItems,V as paginateQueryRows,s as parseContextDepth,p as parseContextFocusFields,c as parseContextSections,ce as parseContextSignalSnapshot,S as parseEvalMetricFloors,ko as parseIntegerLimit,eo as parseLimit,Io as parseMultiValueFilter,Eo as parsePriority,To as parsePriorityFilterSet,Ro as parseStringFilterSet,Fo as parseType,So as parseTypeFilterSet,ve as partitionDecisionEntries,a as projectContextFocusRows,H as propagateContextUsageServingReceipt,ro as queryItemMetadataIndex,to as queryLinkedFileMetadataIndex,xo as querySimilarItemMetadataIndex,oo as readContextUsageAffinity,B as readHistoryEntries,ao as readItemMetadataDerivedIndexState,x as readRecentActivity,le as readWorkspaceContextSignals,ge as readWorkspaceMemory,Y as recordContextUsageDelivery,Q as recordContextUsageServing,Z as recordContextUsageTouch,$ as recordContextUsageTouches,no as refreshItemMetadataDerivedIndex,Go as renderCalendarMarkdown,Ho as renderCalendarToon,E as renderContextMarkdown,Ae as renderNextMarkdown,qo as resolveCalendarOutputFormat,Mo as resolveContentFieldFilters,n as resolveContextOutputFormat,f as resolveContextTokenBudget,we as resolveEffectiveSearchMode,Le as resolveHybridSemanticWeight,uo as resolveItemBlockers,fo as resolveItemExecutionRole,vo as resolveMissingMetadataFilters,Se as resolveNextOutputFormat,N as resolveQueryCursorStart,je as resolveSearchMaxResults,ze as resolveSearchPage,De as resolveSearchScoreThreshold,Ne as resolveSearchTuning,Je as resolveVectorIndexRecovery,t as runActivity,he as runAggregate,Jo as runCalendar,I as runContext,me as runContextEvaluationCorpus,te as runContextEvaluationScenario,zo as runDuplicates,Oe as runGet,We as runHistory,Bo as runList,Me as runNext,Ye as runSearch,$o as scoreContextCandidates,oe as scoreContextCandidatesWithActiveExtensions,Fe as searchWorkspaceMemory,Ie as searchWorkspaceMemoryReadResult,yo as selectActionableEntries,U as selectCursorSemanticOptions,Ee as selectWorkspaceMemory,ke as selectWorkspaceMemoryRollups,xe as summarizeContextEvaluationReports,g as toContextFocusItem,l as toContextPackingSummary,d as toContextRankingSummary,O as verifyHistoryChain};
2
2
  //# sourceMappingURL=sdk-query.js.map
@@ -1,2 +1,2 @@
1
- import{$a as Dc,$b as Dd,Aa as Zb,Ab as cd,Ac as ce,Ba as _b,Bb as dd,Ca as $b,Cb as ed,Da as ac,Db as fd,Ea as bc,Eb as gd,Fa as cc,Fb as hd,Ga as dc,Gb as id,Ha as ec,Hb as jd,Ia as fc,Ib as kd,Ja as gc,Jb as ld,Ka as hc,Kb as md,La as ic,Lb as nd,Ma as jc,Mb as od,Na as kc,Nb as pd,Oa as lc,Ob as qd,Pa as mc,Pb as rd,Qa as nc,Qb as sd,R as Gb,Ra as oc,Rb as td,S as Hb,Sa as pc,Sb as ud,T as Ib,Ta as qc,Tb as vd,U as Jb,Ua as rc,Ub as wd,Va as sc,Vb as xd,Wa as yc,Wb as yd,Xa as zc,Xb as zd,Ya as Ac,Yb as Ad,Za as Bc,Zb as Bd,_a as Cc,_b as Cd,ab as Ec,ac as Ed,bb as Fc,bc as Fd,cb as Gc,cc as Gd,db as Hc,dc as Hd,eb as Ic,ec as Id,fb as Jc,fc as Jd,gb as Kc,gc as Kd,hb as Lc,hc as Ld,ia as Ob,ib as Mc,ic as Md,ja as Pb,jb as Nc,jc as Nd,kb as Oc,kc as Od,lb as Pc,lc as Pd,mb as Qc,mc as Qd,n as db,nb as Rc,nc as Rd,o as eb,ob as Sc,oc as Sd,p as fb,pb as Tc,pc as Td,q as gb,qb as Uc,qc as Ud,r as hb,ra as Qb,rb as Vc,rc as Vd,sa as Rb,sb as Wc,sc as Wd,ta as Sb,tb as Xc,tc as Xd,ua as Tb,ub as Yc,uc as Yd,va as Ub,vb as Zc,vc as Zd,w as pb,wa as Vb,wb as _c,wc as _d,x as qb,xa as Wb,xb as $c,xc as $d,y as rb,ya as Xb,yb as ad,yc as ae,z as tb,za as Yb,zb as bd,zc as be}from"./chunks/chunk-C4O5TZY3.js";import{L as Mb,m as Fb,n as Kb,u as Lb}from"./chunks/chunk-O2WNNIKK.js";import{Pd as Nb,ad as sb,be as tc,ce as uc,de as vc,ee as wc,fe as xc,id as Cb,jd as Db,kd as Eb,oc as jb,pb as ib,pc as kb,qc as lb,sc as mb,uc as nb,vc as ob}from"./chunks/chunk-SP6CDM6B.js";import{Ab as ub,Bb as vb,Cb as wb,Db as xb,Jc as zb,Kc as Ab,Oc as Bb,U as Va,sc as yb}from"./chunks/chunk-T7UTG56V.js";import"./chunks/chunk-MO6PPUI6.js";import"./chunks/chunk-6H36ZHMI.js";import"./chunks/chunk-MGJMQSN4.js";import"./chunks/chunk-LRGYV6QQ.js";import"./chunks/chunk-TWRUA2NH.js";import{s as _a,t as $a,v as ab,w as bb,x as cb}from"./chunks/chunk-T7RZPIOB.js";import"./chunks/chunk-CTM26LUE.js";import"./chunks/chunk-OFIYA3PI.js";import{a as Wa,b as Xa,e as Ya,f as Za}from"./chunks/chunk-KHFUHGL3.js";import"./chunks/chunk-AA52P34H.js";import"./chunks/chunk-CDUV7DFD.js";import"./chunks/chunk-56DKWGHE.js";import"./chunks/chunk-E2LQ6LCJ.js";import"./chunks/chunk-PZA7QECY.js";import{Mc as Sa,Nc as Ta,Pc as Ua,Za as Fa,bc as Ka,cc as La,dc as Ma,ec as Na,fa as za,ga as Aa,gc as Oa,ha as Ba,i as n,ic as Pa,kc as Qa,lc as Ra,mb as Ga,nb as Ha,oa as Ca,pa as Da,pb as Ia,qb as Ja}from"./chunks/chunk-CATRDGAB.js";import{t as Ea}from"./chunks/chunk-LMDIKSDZ.js";import"./chunks/chunk-YEMFOKFG.js";import{Aa as L,Ba as M,Ca as N,Da as O,Ea as P,Ga as Q,Sa as R,Ta as S,Va as T,Wa as U,a as c,ah as wa,b as d,bd as aa,c as e,cd as ba,d as f,dd as ca,e as g,ed as da,f as h,fb as V,fd as ea,g as i,gb as W,gd as fa,h as j,hd as ga,i as k,id as ha,j as l,jc as X,jd as ia,k as m,kc as Y,kd as ja,lc as Z,ld as ka,lh as xa,mc as _,md as la,mf as ua,nd as ma,nf as va,od as na,pd as oa,ph as ya,qd as pa,rd as qa,sd as ra,td as sa,ud as ta,xa as J,ya as K,yc as $}from"./chunks/chunk-56GUDMXN.js";import{h as z,n as A,p as B,s as C,t as D,v as E}from"./chunks/chunk-D3I5AHNN.js";import"./chunks/chunk-5ECCMDSU.js";import"./chunks/chunk-FG4TNQQM.js";import{Q as F,R as G}from"./chunks/chunk-54AQJTUH.js";import{W as H,Y as I,a as s,b as t,c as u,h as v,j as w,k as x,l as y}from"./chunks/chunk-WKDKBS4P.js";import{A as a,C as b,E as o,H as p,K as q,M as r}from"./chunks/chunk-6OIHST4I.js";import"./chunks/chunk-XAWE4EAK.js";export{J as BASELINE_ITEM_FORMAT_VERSION,s as BUILTIN_ITEM_TYPE_VALUES,y as CONFIDENCE_TEXT_VALUES,yb as CONTEXT_OUTPUT_VALUES,K as CURRENT_ITEM_FORMAT_VERSION,jb as DEFAULT_TERMINAL_TRANSITION_POLICY,v as DEPENDENCY_KIND_VALUES,a as EXIT_CODE,X as HISTORY_EVENT_CLASSIFICATION_VERSION,x as ISSUE_SEVERITY_VALUES,t as ITEM_TYPE_VALUES,Y as MAINTENANCE_HISTORY_OPERATIONS,d as MAX_WORKFLOW_POLICIES,e as MAX_WORKFLOW_POLICY_TERMS,Ab as NEXT_OUTPUT_VALUES,Ka as PM_CLI_ERROR_DETAILS_LIMITS,Pa as PM_CLI_EXPECTED_ERROR_NAME,ia as PM_COMMAND_OUTPUT_BUDGET_CONTRACTS,da as PM_DIAGNOSTIC_DEGRADATION_STEPS,ea as PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS,ca as PM_DIAGNOSTIC_OUTPUT_CLASSES,oa as PM_GENERIC_REFUSAL_GUIDANCE,Xa as PM_GITIGNORE_END,Wa as PM_GITIGNORE_START,ba as PM_OUTPUT_BUDGET_CLASSES,aa as PM_OUTPUT_DEGRADATION_STEPS,sa as PM_RECOVERY_ECHO_FIELDS,b as PmCliError,yc as PmClient,db as PmCompleteListValidationError,w as RISK_VALUES,Qb as SEARCH_EXTENSION_FLAG_DEFINITIONS,u as STATUS_VALUES,Z as SUBSTANTIVE_HISTORY_OPERATIONS,c as WORKFLOW_POLICY_ACTIONS,$a as WORKFLOW_POLICY_DOCUMENT_SCHEMA,_a as WORKFLOW_POLICY_SCHEMA,V as acquireLock,W as acquireLockLease,Fc as aggregate,ce as analyzeSdkActionCoverage,Rc as append,va as appendHistoryEntry,mb as applyTerminalOrderingPolicy,hb as assertCompleteListResult,ab as buildWorkflowCompletenessCheck,U as canonicalDocument,gb as certifyCompleteListResult,Ad as claim,Bd as claimNext,_ as classifyHistoryEvent,N as classifyItemFormatVersion,Pb as clearWorkspaceContractsCache,zd as close,nb as closeItem,Jd as closeTask,Ic as comments,nc as commitImportedItem,Tc as config,zc as context,Dd as copy,wd as create,eb as createCompleteListOptions,ua as createHistoryEntry,bb as createLifecycleCompletenessPolicies,Qa as createPmCliExpectedError,ga as createPmCommandOutputBudget,m as createWorkflowPolicyEvaluator,ha as definePmCommandOutputBudget,Ed as deleteItem,Pc as deps,Oc as docs,Hc as duplicates,L as effectiveItemFormatVersion,mc as emptyImportedDocument,Za as ensurePmGitignore,lc as ensureTrackerInitialized,ka as estimatePmOutputTokens,l as evaluateWorkflowPolicies,Kd as extension,Md as extensionActivate,Nd as extensionDeactivate,Ld as extensionList,Lc as files,Mc as filesDiscover,Nc as filesLookup,Gd as focus,qd as gc,Ba as generateItemId,Dc as get,wa as getActiveExtensionRegistrations,_d as getContracts,E as getHistoryPath,D as getItemPath,Ya as getPmGitignoreBlock,C as getSettingsPath,Rb as getWorkspaceContracts,Qc as graph,pd as health,ud as historyCompact,vd as historyCompactBulk,rd as historyRedact,sd as historyRepair,td as historyRepairAll,fa as inferPmOutputBudgetClass,Sc as init,fb as inspectCompleteListResult,pa as isGenericRefusalRequired,qa as isGenericRefusalWhy,La as isPmCliErrorDetails,Ra as isPmCliExpectedError,Q as isTerminalStatus,G as isTimestampLiteral,$ as jaccardSimilarity,Kc as learnings,Ac as list,Bc as listAllComplete,Ia as listAllItemMetadata,Ja as listAllItemMetadataLight,Gb as loadCreateTemplateOptions,Ga as locateItem,Ec as next,M as normalizeItemFormatVersion,Aa as normalizeItemId,R as normalizeItemMetadata,za as normalizeRawItemId,Sa as normalizeSimilarityText,P as normalizeStatusInput,Jc as notes,F as nowIso,Xd as packageActivate,Wd as packageCatalog,Yd as packageDeactivate,Ud as packageDescribe,Sd as packageDoctor,Qd as packageInstall,Od as packageLifecycle,Pd as packageList,Td as packageManage,Vd as packageReload,Rd as packageUninstall,n as parseTags,f as parseWorkflowPolicy,g as parseWorkflowPolicyDocument,o as pathExists,Id as pauseTask,jd as profile,md as profileApply,nd as profileLint,kd as profileList,ld as profileShow,ta as projectLeanRecoveryPayload,Oa as projectPmCliErrorContextDetails,Ma as projectPmCliErrorDetails,ma as projectPmDiagnosticOutput,na as projectPmDiagnosticText,Tb as readBooleanOption,Ub as readCsvListOption,p as readFileIfExists,Ha as readLocatedItem,Ob as readRequiredString,Ea as readSettings,Sb as readStringOption,Fa as readWorkflowPolicies,h as readWorkflowPolicyField,Cd as release,r as removeFileIfExists,vb as renderCalendarMarkdown,wb as renderCalendarToon,qc as renderGuideMarkdown,yd as reopen,lb as requireTerminalReason,ub as resolveCalendarOutputFormat,oc as resolveGuideOutputFormat,A as resolveImplicitPmRoot,z as resolveItemTypeRegistry,ja as resolvePmCommandOutputBudget,la as resolvePmDiagnosticOutputBudget,B as resolvePmRoot,I as resolveRuntimeFieldRegistry,H as resolveRuntimeStatusRegistry,kb as resolveTerminalReason,Fd as restore,be as runAction,ya as runActiveOnReadHooks,xa as runActiveOnWriteHooks,Kb as runAggregate,xb as runCalendar,ob as runClose,Eb as runCloseTask,rc as runCompletion,zb as runContext,pb as runCopy,qb as runDelete,ib as runDuplicates,rb as runFocus,Lb as runGet,pc as runGuide,ae as runInActiveExtensionScope,Va as runList,Bb as runNext,Db as runPauseTask,sc as runReindex,tb as runReopen,Fb as runRestore,Mb as runSearch,Cb as runStartTask,Nb as runStats,Ib as runTemplatesList,Hb as runTemplatesSave,Jb as runTemplatesShow,tc as runTestRunsList,vc as runTestRunsLogs,xc as runTestRunsResume,uc as runTestRunsStatus,wc as runTestRunsStop,sb as runUpdate,$d as runWithActiveExtensions,cb as runWorkflowPolicyAction,O as scanItemFormatVersions,Uc as schema,$c as schemaAddField,Zc as schemaAddStatus,Xc as schemaAddType,dd as schemaApplyPreset,ed as schemaInferTypes,Vc as schemaList,bd as schemaListFields,hd as schemaRemapStatus,ad as schemaRemoveField,_c as schemaRemoveStatus,Yc as schemaRemoveType,gd as schemaRenameField,fd as schemaRenameType,Wc as schemaShow,cd as schemaShowField,id as schemaShowStatus,Ua as scoreItemSimilarity,Cc as search,kc as selectImportAuthor,T as serializeItemDocument,Na as snapshotPmCliErrorContext,S as splitFrontMatter,Hd as startTask,Gc as stats,Wb as toEstimatedMinutesValue,$b as toImportBoolean,dc as toImportConfidence,ic as toImportDeferredFields,_b as toImportInteger,hc as toImportLinkedDocs,gc as toImportLinkedFiles,jc as toImportLinkedTests,fc as toImportLogEntries,ec as toImportNormalizedEnum,cc as toImportNumberMap,Xb as toImportPriority,Zb as toImportStatus,ac as toImportStringList,bc as toImportStringMap,Yb as toImportTags,Vb as toNonEmptyImportString,Ta as tokenizeSimilarityText,xd as update,Zd as upgrade,od as validate,Ca as withCliMutationInput,Da as withLiteralMutationInput,ra as withoutGenericRefusalExamples,j as workflowApprovalFingerprint,k as workflowPolicyApplies,i as workflowPolicyFingerprint,q as writeFileAtomic};
1
+ import{$a as Dc,$b as Dd,Aa as Zb,Ab as cd,Ac as ce,Ba as _b,Bb as dd,Ca as $b,Cb as ed,Da as ac,Db as fd,Ea as bc,Eb as gd,Fa as cc,Fb as hd,Ga as dc,Gb as id,Ha as ec,Hb as jd,Ia as fc,Ib as kd,Ja as gc,Jb as ld,Ka as hc,Kb as md,La as ic,Lb as nd,Ma as jc,Mb as od,Na as kc,Nb as pd,Oa as lc,Ob as qd,Pa as mc,Pb as rd,Qa as nc,Qb as sd,R as Gb,Ra as oc,Rb as td,S as Hb,Sa as pc,Sb as ud,T as Ib,Ta as qc,Tb as vd,U as Jb,Ua as rc,Ub as wd,Va as sc,Vb as xd,Wa as yc,Wb as yd,Xa as zc,Xb as zd,Ya as Ac,Yb as Ad,Za as Bc,Zb as Bd,_a as Cc,_b as Cd,ab as Ec,ac as Ed,bb as Fc,bc as Fd,cb as Gc,cc as Gd,db as Hc,dc as Hd,eb as Ic,ec as Id,fb as Jc,fc as Jd,gb as Kc,gc as Kd,hb as Lc,hc as Ld,ia as Ob,ib as Mc,ic as Md,ja as Pb,jb as Nc,jc as Nd,kb as Oc,kc as Od,lb as Pc,lc as Pd,mb as Qc,mc as Qd,n as db,nb as Rc,nc as Rd,o as eb,ob as Sc,oc as Sd,p as fb,pb as Tc,pc as Td,q as gb,qb as Uc,qc as Ud,r as hb,ra as Qb,rb as Vc,rc as Vd,sa as Rb,sb as Wc,sc as Wd,ta as Sb,tb as Xc,tc as Xd,ua as Tb,ub as Yc,uc as Yd,va as Ub,vb as Zc,vc as Zd,w as pb,wa as Vb,wb as _c,wc as _d,x as qb,xa as Wb,xb as $c,xc as $d,y as rb,ya as Xb,yb as ad,yc as ae,z as tb,za as Yb,zb as bd,zc as be}from"./chunks/chunk-NZSXWIX7.js";import"./chunks/chunk-CCKM5YQM.js";import{L as Mb,m as Fb,n as Kb,u as Lb}from"./chunks/chunk-2SBTXR6C.js";import{$c as uc,Nb as jb,Ob as kb,Pb as lb,Rb as mb,Tb as nb,Ub as ob,Uc as Nb,Xa as ib,_c as tc,ad as vc,bd as wc,cd as xc,jc as sb,rc as Cb,sc as Db,tc as Eb}from"./chunks/chunk-WFYE34TO.js";import{Ab as ub,Bb as vb,Cb as wb,Db as xb,Jc as zb,Kc as Ab,Oc as Bb,U as Va,sc as yb}from"./chunks/chunk-ZA5NS3PL.js";import"./chunks/chunk-X5D5YUHR.js";import"./chunks/chunk-4QA5O64H.js";import"./chunks/chunk-Q4VZSMUL.js";import"./chunks/chunk-TY55UX6M.js";import{s as _a,t as $a,v as ab,w as bb,x as cb}from"./chunks/chunk-IGEFPHV7.js";import"./chunks/chunk-DCWGM7CY.js";import"./chunks/chunk-6H36ZHMI.js";import"./chunks/chunk-AOTI76Q6.js";import{a as Wa,b as Xa,e as Ya,f as Za}from"./chunks/chunk-OGVSGXQX.js";import"./chunks/chunk-AA52P34H.js";import"./chunks/chunk-KCVSSONY.js";import"./chunks/chunk-USBTXMKS.js";import"./chunks/chunk-5PNOVDVO.js";import"./chunks/chunk-PZA7QECY.js";import{Mc as Sa,Nc as Ta,Pc as Ua,Za as Fa,bc as Ka,cc as La,dc as Ma,ec as Na,fa as za,ga as Aa,gc as Oa,ha as Ba,i as n,ic as Pa,kc as Qa,lc as Ra,mb as Ga,nb as Ha,oa as Ca,pa as Da,pb as Ia,qb as Ja}from"./chunks/chunk-3TXEWHQX.js";import{u as Ea}from"./chunks/chunk-KXTKLDKD.js";import"./chunks/chunk-3AZOATC2.js";import{Aa as L,Ba as M,Ca as N,Da as O,Ea as P,Ga as Q,Sa as R,Ta as S,Va as T,Wa as U,a as c,ah as wa,b as d,bd as aa,c as e,cd as ba,d as f,dd as ca,e as g,ed as da,f as h,fb as V,fd as ea,g as i,gb as W,gd as fa,h as j,hd as ga,i as k,id as ha,j as l,jc as X,jd as ia,k as m,kc as Y,kd as ja,lc as Z,ld as ka,lh as xa,mc as _,md as la,mf as ua,nd as ma,nf as va,od as na,pd as oa,ph as ya,qd as pa,rd as qa,sd as ra,td as sa,ud as ta,xa as J,ya as K,yc as $}from"./chunks/chunk-SJWIPGZW.js";import{g as z,m as A,o as B,r as C,s as D,u as E}from"./chunks/chunk-GSLOAEY2.js";import"./chunks/chunk-NVYDPNQP.js";import"./chunks/chunk-JPJNJHQW.js";import{Q as F,R as G}from"./chunks/chunk-VCXQ6A35.js";import{a as s,b as t,ba as H,c as u,da as I,h as v,j as w,k as x,l as y}from"./chunks/chunk-TE6FBDHP.js";import{A as a,C as b,E as o,H as p,L as q,N as r}from"./chunks/chunk-K672XXGQ.js";import"./chunks/chunk-XAWE4EAK.js";export{J as BASELINE_ITEM_FORMAT_VERSION,s as BUILTIN_ITEM_TYPE_VALUES,y as CONFIDENCE_TEXT_VALUES,yb as CONTEXT_OUTPUT_VALUES,K as CURRENT_ITEM_FORMAT_VERSION,jb as DEFAULT_TERMINAL_TRANSITION_POLICY,v as DEPENDENCY_KIND_VALUES,a as EXIT_CODE,X as HISTORY_EVENT_CLASSIFICATION_VERSION,x as ISSUE_SEVERITY_VALUES,t as ITEM_TYPE_VALUES,Y as MAINTENANCE_HISTORY_OPERATIONS,d as MAX_WORKFLOW_POLICIES,e as MAX_WORKFLOW_POLICY_TERMS,Ab as NEXT_OUTPUT_VALUES,Ka as PM_CLI_ERROR_DETAILS_LIMITS,Pa as PM_CLI_EXPECTED_ERROR_NAME,ia as PM_COMMAND_OUTPUT_BUDGET_CONTRACTS,da as PM_DIAGNOSTIC_DEGRADATION_STEPS,ea as PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS,ca as PM_DIAGNOSTIC_OUTPUT_CLASSES,oa as PM_GENERIC_REFUSAL_GUIDANCE,Xa as PM_GITIGNORE_END,Wa as PM_GITIGNORE_START,ba as PM_OUTPUT_BUDGET_CLASSES,aa as PM_OUTPUT_DEGRADATION_STEPS,sa as PM_RECOVERY_ECHO_FIELDS,b as PmCliError,yc as PmClient,db as PmCompleteListValidationError,w as RISK_VALUES,Qb as SEARCH_EXTENSION_FLAG_DEFINITIONS,u as STATUS_VALUES,Z as SUBSTANTIVE_HISTORY_OPERATIONS,c as WORKFLOW_POLICY_ACTIONS,$a as WORKFLOW_POLICY_DOCUMENT_SCHEMA,_a as WORKFLOW_POLICY_SCHEMA,V as acquireLock,W as acquireLockLease,Fc as aggregate,ce as analyzeSdkActionCoverage,Rc as append,va as appendHistoryEntry,mb as applyTerminalOrderingPolicy,hb as assertCompleteListResult,ab as buildWorkflowCompletenessCheck,U as canonicalDocument,gb as certifyCompleteListResult,Ad as claim,Bd as claimNext,_ as classifyHistoryEvent,N as classifyItemFormatVersion,Pb as clearWorkspaceContractsCache,zd as close,nb as closeItem,Jd as closeTask,Ic as comments,nc as commitImportedItem,Tc as config,zc as context,Dd as copy,wd as create,eb as createCompleteListOptions,ua as createHistoryEntry,bb as createLifecycleCompletenessPolicies,Qa as createPmCliExpectedError,ga as createPmCommandOutputBudget,m as createWorkflowPolicyEvaluator,ha as definePmCommandOutputBudget,Ed as deleteItem,Pc as deps,Oc as docs,Hc as duplicates,L as effectiveItemFormatVersion,mc as emptyImportedDocument,Za as ensurePmGitignore,lc as ensureTrackerInitialized,ka as estimatePmOutputTokens,l as evaluateWorkflowPolicies,Kd as extension,Md as extensionActivate,Nd as extensionDeactivate,Ld as extensionList,Lc as files,Mc as filesDiscover,Nc as filesLookup,Gd as focus,qd as gc,Ba as generateItemId,Dc as get,wa as getActiveExtensionRegistrations,_d as getContracts,E as getHistoryPath,D as getItemPath,Ya as getPmGitignoreBlock,C as getSettingsPath,Rb as getWorkspaceContracts,Qc as graph,pd as health,ud as historyCompact,vd as historyCompactBulk,rd as historyRedact,sd as historyRepair,td as historyRepairAll,fa as inferPmOutputBudgetClass,Sc as init,fb as inspectCompleteListResult,pa as isGenericRefusalRequired,qa as isGenericRefusalWhy,La as isPmCliErrorDetails,Ra as isPmCliExpectedError,Q as isTerminalStatus,G as isTimestampLiteral,$ as jaccardSimilarity,Kc as learnings,Ac as list,Bc as listAllComplete,Ia as listAllItemMetadata,Ja as listAllItemMetadataLight,Gb as loadCreateTemplateOptions,Ga as locateItem,Ec as next,M as normalizeItemFormatVersion,Aa as normalizeItemId,R as normalizeItemMetadata,za as normalizeRawItemId,Sa as normalizeSimilarityText,P as normalizeStatusInput,Jc as notes,F as nowIso,Xd as packageActivate,Wd as packageCatalog,Yd as packageDeactivate,Ud as packageDescribe,Sd as packageDoctor,Qd as packageInstall,Od as packageLifecycle,Pd as packageList,Td as packageManage,Vd as packageReload,Rd as packageUninstall,n as parseTags,f as parseWorkflowPolicy,g as parseWorkflowPolicyDocument,o as pathExists,Id as pauseTask,jd as profile,md as profileApply,nd as profileLint,kd as profileList,ld as profileShow,ta as projectLeanRecoveryPayload,Oa as projectPmCliErrorContextDetails,Ma as projectPmCliErrorDetails,ma as projectPmDiagnosticOutput,na as projectPmDiagnosticText,Tb as readBooleanOption,Ub as readCsvListOption,p as readFileIfExists,Ha as readLocatedItem,Ob as readRequiredString,Ea as readSettings,Sb as readStringOption,Fa as readWorkflowPolicies,h as readWorkflowPolicyField,Cd as release,r as removeFileIfExists,vb as renderCalendarMarkdown,wb as renderCalendarToon,qc as renderGuideMarkdown,yd as reopen,lb as requireTerminalReason,ub as resolveCalendarOutputFormat,oc as resolveGuideOutputFormat,A as resolveImplicitPmRoot,z as resolveItemTypeRegistry,ja as resolvePmCommandOutputBudget,la as resolvePmDiagnosticOutputBudget,B as resolvePmRoot,I as resolveRuntimeFieldRegistry,H as resolveRuntimeStatusRegistry,kb as resolveTerminalReason,Fd as restore,be as runAction,ya as runActiveOnReadHooks,xa as runActiveOnWriteHooks,Kb as runAggregate,xb as runCalendar,ob as runClose,Eb as runCloseTask,rc as runCompletion,zb as runContext,pb as runCopy,qb as runDelete,ib as runDuplicates,rb as runFocus,Lb as runGet,pc as runGuide,ae as runInActiveExtensionScope,Va as runList,Bb as runNext,Db as runPauseTask,sc as runReindex,tb as runReopen,Fb as runRestore,Mb as runSearch,Cb as runStartTask,Nb as runStats,Ib as runTemplatesList,Hb as runTemplatesSave,Jb as runTemplatesShow,tc as runTestRunsList,vc as runTestRunsLogs,xc as runTestRunsResume,uc as runTestRunsStatus,wc as runTestRunsStop,sb as runUpdate,$d as runWithActiveExtensions,cb as runWorkflowPolicyAction,O as scanItemFormatVersions,Uc as schema,$c as schemaAddField,Zc as schemaAddStatus,Xc as schemaAddType,dd as schemaApplyPreset,ed as schemaInferTypes,Vc as schemaList,bd as schemaListFields,hd as schemaRemapStatus,ad as schemaRemoveField,_c as schemaRemoveStatus,Yc as schemaRemoveType,gd as schemaRenameField,fd as schemaRenameType,Wc as schemaShow,cd as schemaShowField,id as schemaShowStatus,Ua as scoreItemSimilarity,Cc as search,kc as selectImportAuthor,T as serializeItemDocument,Na as snapshotPmCliErrorContext,S as splitFrontMatter,Hd as startTask,Gc as stats,Wb as toEstimatedMinutesValue,$b as toImportBoolean,dc as toImportConfidence,ic as toImportDeferredFields,_b as toImportInteger,hc as toImportLinkedDocs,gc as toImportLinkedFiles,jc as toImportLinkedTests,fc as toImportLogEntries,ec as toImportNormalizedEnum,cc as toImportNumberMap,Xb as toImportPriority,Zb as toImportStatus,ac as toImportStringList,bc as toImportStringMap,Yb as toImportTags,Vb as toNonEmptyImportString,Ta as tokenizeSimilarityText,xd as update,Zd as upgrade,od as validate,Ca as withCliMutationInput,Da as withLiteralMutationInput,ra as withoutGenericRefusalExamples,j as workflowApprovalFingerprint,k as workflowPolicyApplies,i as workflowPolicyFingerprint,q as writeFileAtomic};
2
2
  //# sourceMappingURL=sdk-runtime.js.map
@@ -1,2 +1,2 @@
1
- import{A as t,B as u,C as v,D as w,E as x,F as y,G as z,H as A,I as B,J as C,K as D,L as E,M as F,N as G,O as H,P as I,Q as J,R as K,S as L,T as M,U as N,V as O,W as P,X as Q,Y as R,Z as S,_ as T,f as c,g as d,l as e,m as f,n as g,o as h,p as i,q as j,r as k,s as l,t as m,u as n,v as o,w as p,x as q,y as r,z as s}from"./chunks/chunk-O2SWNEBW.js";import"./chunks/chunk-C4O5TZY3.js";import"./chunks/chunk-O2WNNIKK.js";import"./chunks/chunk-SP6CDM6B.js";import"./chunks/chunk-T7UTG56V.js";import"./chunks/chunk-MO6PPUI6.js";import"./chunks/chunk-6H36ZHMI.js";import"./chunks/chunk-MGJMQSN4.js";import"./chunks/chunk-LRGYV6QQ.js";import"./chunks/chunk-TWRUA2NH.js";import{la as b,n as a}from"./chunks/chunk-T7RZPIOB.js";import"./chunks/chunk-CTM26LUE.js";import"./chunks/chunk-OFIYA3PI.js";import"./chunks/chunk-KHFUHGL3.js";import"./chunks/chunk-AA52P34H.js";import"./chunks/chunk-CDUV7DFD.js";import"./chunks/chunk-56DKWGHE.js";import"./chunks/chunk-E2LQ6LCJ.js";import"./chunks/chunk-PZA7QECY.js";import"./chunks/chunk-CATRDGAB.js";import"./chunks/chunk-LMDIKSDZ.js";import"./chunks/chunk-YEMFOKFG.js";import"./chunks/chunk-56GUDMXN.js";import"./chunks/chunk-D3I5AHNN.js";import"./chunks/chunk-5ECCMDSU.js";import"./chunks/chunk-FG4TNQQM.js";import"./chunks/chunk-54AQJTUH.js";import"./chunks/chunk-WKDKBS4P.js";import"./chunks/chunk-6OIHST4I.js";import"./chunks/chunk-XAWE4EAK.js";export{e as activateExtensionForTest,M as assertExtensionBlueprint,L as assertExtensionCapabilityUsage,t as assertExtensionDeactivated,P as assertExtensionManifestCompatible,O as assertExtensionManifestMatchesBlueprint,Q as assertExtensionPreflight,u as assertPackageManifest,N as assertProjectProfile,v as assertRegisteredCommandContract,F as assertRegisteredCommandOverride,B as assertRegisteredExporter,w as assertRegisteredFlags,x as assertRegisteredHook,A as assertRegisteredImporter,C as assertRegisteredItemField,D as assertRegisteredItemType,K as assertRegisteredMigration,G as assertRegisteredParserOverride,H as assertRegisteredPreflightOverride,E as assertRegisteredProfile,I as assertRegisteredRendererOverride,y as assertRegisteredSearchProvider,J as assertRegisteredServiceOverride,z as assertRegisteredVectorStoreAdapter,R as createExtensionTestHarness,f as deactivateExtensionForTest,S as decodeToon,a as describeExtensionActivation,c as describeExtensionBlueprint,T as encodeToon,d as lintExtensionBlueprint,b as renderExtensionSurfaceMarkdown,g as runRegisteredCommandForTest,l as runRegisteredCommandOverrideForTest,s as runRegisteredExporterForTest,i as runRegisteredHookForTest,r as runRegisteredImporterForTest,q as runRegisteredMigrationForTest,h as runRegisteredMutationGuardForTest,j as runRegisteredParserOverrideForTest,k as runRegisteredPreflightOverrideForTest,m as runRegisteredRendererOverrideForTest,o as runRegisteredSearchProviderForTest,n as runRegisteredServiceOverrideForTest,p as runRegisteredVectorStoreAdapterForTest};
1
+ import{A as t,B as u,C as v,D as w,E as x,F as y,G as z,H as A,I as B,J as C,K as D,L as E,M as F,N as G,O as H,P as I,Q as J,R as K,S as L,T as M,U as N,V as O,W as P,X as Q,Y as R,Z as S,_ as T,f as c,g as d,l as e,m as f,n as g,o as h,p as i,q as j,r as k,s as l,t as m,u as n,v as o,w as p,x as q,y as r,z as s}from"./chunks/chunk-FR7ULTM4.js";import"./chunks/chunk-NZSXWIX7.js";import"./chunks/chunk-CCKM5YQM.js";import"./chunks/chunk-2SBTXR6C.js";import"./chunks/chunk-WFYE34TO.js";import"./chunks/chunk-ZA5NS3PL.js";import"./chunks/chunk-X5D5YUHR.js";import"./chunks/chunk-4QA5O64H.js";import"./chunks/chunk-Q4VZSMUL.js";import"./chunks/chunk-TY55UX6M.js";import{la as b,n as a}from"./chunks/chunk-IGEFPHV7.js";import"./chunks/chunk-DCWGM7CY.js";import"./chunks/chunk-6H36ZHMI.js";import"./chunks/chunk-AOTI76Q6.js";import"./chunks/chunk-OGVSGXQX.js";import"./chunks/chunk-AA52P34H.js";import"./chunks/chunk-KCVSSONY.js";import"./chunks/chunk-USBTXMKS.js";import"./chunks/chunk-5PNOVDVO.js";import"./chunks/chunk-PZA7QECY.js";import"./chunks/chunk-3TXEWHQX.js";import"./chunks/chunk-KXTKLDKD.js";import"./chunks/chunk-3AZOATC2.js";import"./chunks/chunk-SJWIPGZW.js";import"./chunks/chunk-GSLOAEY2.js";import"./chunks/chunk-NVYDPNQP.js";import"./chunks/chunk-JPJNJHQW.js";import"./chunks/chunk-VCXQ6A35.js";import"./chunks/chunk-TE6FBDHP.js";import"./chunks/chunk-K672XXGQ.js";import"./chunks/chunk-XAWE4EAK.js";export{e as activateExtensionForTest,M as assertExtensionBlueprint,L as assertExtensionCapabilityUsage,t as assertExtensionDeactivated,P as assertExtensionManifestCompatible,O as assertExtensionManifestMatchesBlueprint,Q as assertExtensionPreflight,u as assertPackageManifest,N as assertProjectProfile,v as assertRegisteredCommandContract,F as assertRegisteredCommandOverride,B as assertRegisteredExporter,w as assertRegisteredFlags,x as assertRegisteredHook,A as assertRegisteredImporter,C as assertRegisteredItemField,D as assertRegisteredItemType,K as assertRegisteredMigration,G as assertRegisteredParserOverride,H as assertRegisteredPreflightOverride,E as assertRegisteredProfile,I as assertRegisteredRendererOverride,y as assertRegisteredSearchProvider,J as assertRegisteredServiceOverride,z as assertRegisteredVectorStoreAdapter,R as createExtensionTestHarness,f as deactivateExtensionForTest,S as decodeToon,a as describeExtensionActivation,c as describeExtensionBlueprint,T as encodeToon,d as lintExtensionBlueprint,b as renderExtensionSurfaceMarkdown,g as runRegisteredCommandForTest,l as runRegisteredCommandOverrideForTest,s as runRegisteredExporterForTest,i as runRegisteredHookForTest,r as runRegisteredImporterForTest,q as runRegisteredMigrationForTest,h as runRegisteredMutationGuardForTest,j as runRegisteredParserOverrideForTest,k as runRegisteredPreflightOverrideForTest,m as runRegisteredRendererOverrideForTest,o as runRegisteredSearchProviderForTest,n as runRegisteredServiceOverrideForTest,p as runRegisteredVectorStoreAdapterForTest};
2
2
  //# sourceMappingURL=sdk-testing.js.map
@@ -1,4 +1,4 @@
1
- import{a as vN,b as kN,c as NN,d as LN}from"./chunks/chunk-Q6BGQRCB.js";import{a as $N,b as DN}from"./chunks/chunk-YLS2N4SN.js";import{b as rN,c as nN,d as oN,e as iN,f as sN,g as aN,h as cN,i as dN,j as pN,k as lN,l as uN,m as mN,n as fN,o as _N,p as hN,q as gN,r as CN}from"./chunks/chunk-6RBD2AKU.js";import{f as Bg}from"./chunks/chunk-JQYPSABI.js";import{A as AN,B as xN,C as bN,D as wN,E as ON,F as RN,G as PN,H as MN,I as IN,a as Ys,b as aP,c as cP,d as Uc,e as jc,f as Bc,h as qc,i as zc,j as Hc,k as Vc,l as Kc,m as Wc,n as Yc,q as Xc,r as _d,s as hd,t as gd,u as Cd,v as yd,w as yN,x as SN,y as TN,z as EN}from"./chunks/chunk-2YD2AERA.js";import{A as p0,B as l0,C as u0,D as m0,E as f0,F as _0,G as h0,H as g0,I as C0,J as y0,K as S0,L as T0,M as E0,N as A0,O as x0,P as b0,Q as w0,R as O0,S as R0,T as P0,U as M0,V as I0,W as v0,X as k0,Y as N0,Z as L0,_ as $0,a as FN,b as GN,c as UN,d as jN,e as BN,f as qN,g as zN,h as HN,i as VN,j as KN,k as WN,l as YN,m as XN,n as JN,o as QN,p as ZN,q as e0,r as t0,s as r0,t as n0,u as o0,v as i0,w as s0,x as a0,y as c0,z as d0}from"./chunks/chunk-O2SWNEBW.js";import{$ as Af,$a as fh,$b as fg,A as Ke,Aa as $_,Ab as jh,Ac as jg,B as cf,Ba as D_,Bb as Bh,C as df,Ca as F_,Cb as qh,D as lf,Da as G_,Db as zh,E as uf,Ea as U_,Eb as Hh,F as Ht,Fa as j_,Fb as Vh,G as Vt,Ga as B_,Gb as Kh,H as Kt,Ha as q_,Hb as Wh,I as Wt,Ia as z_,Ib as Yh,J as Yt,Ja as H_,Jb as Xh,K as Xt,Ka as V_,Kb as Jh,L as Jt,La as K_,Lb as Qh,M as Qt,Ma as W_,Mb as Zh,N as Zt,Na as Y_,Nb as eg,O as er,Oa as X_,Ob as tg,P as tr,Pa as J_,Pb as rg,Q as mf,Qa as Q_,Qb as ng,R as ff,Ra as Z_,Rb as og,S as _f,Sa as eh,Sb as ig,T as hf,Ta as th,Tb as sg,U as gf,Ua as rh,Ub as ag,V as We,Va as rr,Vb as cg,W as Cf,Wa as _e,Wb as dg,X as yf,Xa as ph,Xb as pg,Y as Sf,Ya as lh,Yb as lg,Z as Tf,Za as uh,Zb as ug,_ as Ef,_a as mh,_b as mg,a as SR,aa as xf,ab as _h,ac as _g,b as TR,ba as bf,bb as hh,bc as hg,c as ER,ca as Dk,cb as gh,cc as gg,d as AR,da as Fk,db as Ch,dc as Cg,e as xR,ea as Gk,eb as yh,ec as yg,f as bR,fa as Ff,fb as Sh,fc as Sg,g as RR,ga as Gf,gb as Th,gc as Tg,h as PR,ha as Uf,hb as Eh,hc as Eg,i as MR,ia as w_,ib as Ah,ic as Ag,j as IR,ja as O_,jb as xh,jc as xg,k as Nc,ka as Wk,kb as bh,kc as bg,la as Yk,lb as wh,lc as wg,m as VM,ma as Xk,mb as Oh,mc as Og,n as KM,na as Jk,nb as Rh,nc as Rg,o as WM,oa as Qk,ob as Ph,oc as Pg,p as YM,pa as Zk,pb as Mh,pc as Mg,q as XM,qa as eN,qb as Ih,qc as Ig,r as JM,ra as tN,rb as vh,rc as vg,s as ol,sa as R_,sb as kh,sc as kg,t as Gu,ta as P_,tb as Nh,tc as Ng,u as Uu,ua as M_,ub as Lh,uc as Lg,v as qu,va as I_,vb as $h,vc as $g,w as zu,wa as v_,wb as Dh,wc as Dg,x as pm,xa as k_,xb as Fh,xc as Fg,y as gm,ya as N_,yb as Gh,yc as Gg,z as xv,za as L_,zb as Uh,zc as Ug}from"./chunks/chunk-C4O5TZY3.js";import{A as wk,B as Ok,C as Rk,D as Pk,E as Mk,F as Ik,G as vk,H as kk,I as Nk,J as Lk,K as $k,L as Rf,M as Pf,N as Mf,O as If,P as vf,Q as kf,R as Nf,S as Lf,T as $f,U as Df,a as av,b as cv,c as dv,d as pv,e as lv,f as Fu,g as uv,h as mv,i as fv,j as _v,k as hv,m as pf,n as wf,o as _k,p as hk,q as gk,r as Ck,s as yk,t as Sk,u as Of,v as Tk,w as Ek,x as Ak,y as xk,z as bk}from"./chunks/chunk-O2WNNIKK.js";import{$ as rM,$a as Al,$b as Iu,$d as b_,Aa as OM,Ab as lI,Ac as Wu,Ad as Zf,Ba as RM,Bb as uI,Bc as Yu,Bd as e_,C as ze,Ca as PM,Cb as hI,Cc as Xu,Cd as t_,D as ee,Da as MM,Db as Eu,Dc as Ju,Dd as r_,E as fp,Ea as IM,Eb as gI,Ec as Qu,Ed as n_,Fb as NI,Fc as Zu,Fd as o_,Gb as LI,Gc as em,Gd as i_,H as He,Ha as QM,Hb as $I,Hc as tm,Hd as s_,I as _p,Ia as ZM,Ib as DI,Ic as rm,Id as a_,J as hp,Ja as Jp,Jb as FI,Jc as nm,Jd as c_,Ka as Qp,Kb as GI,Kc as om,Kd as d_,L as fe,La as Zp,Lb as UI,Lc as im,Ld as p_,M as gp,Ma as el,Mb as VI,Mc as sm,Md as l_,N as Cp,Na as tl,Nb as KI,Nc as am,Nd as u_,O as yp,Oa as rl,Ob as Au,Oc as cm,Od as m_,P as Sp,Pa as nl,Pb as xu,Pd as f_,Q as KP,Qa as ul,Qb as WI,Qc as Ev,Qd as __,R as WP,Ra as ml,Rb as YI,Rc as Av,S as YP,Sa as fl,Sb as XI,Sc as dm,Sd as h_,T as XP,Ta as _l,Tb as JI,Tc as Cm,Td as g_,U as JP,Ua as hl,Ub as QI,Uc as ym,Ud as C_,V as Nt,Va as gl,Vb as bu,Vc as Sm,Vd as y_,W as QP,Wa as Cl,Wb as wu,Wc as Tm,Wd as S_,X as ZP,Xa as yl,Xb as Ou,Xc as Em,Xd as T_,Y as Lt,Ya as Sl,Yb as Ru,Yd as E_,Z as eM,Za as Tl,Zb as Pu,Zd as A_,_ as tM,_a as El,_b as Mu,_d as x_,a as dP,aa as nM,ab as xl,ac as vu,ad as Am,ae as nh,b as Mt,ba as oM,bb as bl,bc as ku,be as oh,c as pP,ca as Ve,cb as wl,cc as Nu,cd as Zm,ce as ih,d as sd,da as iM,db as Ol,dc as Lu,dd as ef,de as sh,e as ad,ea as $t,eb as Rl,ec as $u,ed as tf,ee as ah,f as cd,fa as sM,fb as Pl,fc as ZI,fe as ch,g as dd,ga as aM,gb as Ml,gc as ev,gd as rf,ge as dh,h as pd,ha as cM,hb as Il,hc as tv,hd as nf,ia as dM,ib as vl,ic as rv,id as of,j as ld,ja as pM,jb as kl,jc as nv,jd as sf,k as ud,ka as lM,kb as oI,kc as ov,kd as af,la as uM,lb as Nl,lc as iv,ld as jf,ma as mM,mb as Ll,mc as sv,md as Bf,na as fM,nb as $l,nc as Du,nd as qf,o as md,oa as _M,ob as Dl,oc as gv,od as zf,p as fd,pa as hM,pb as iI,pc as Cv,pd as Hf,qa as gM,qb as Fl,qc as yv,qd as Vf,ra as CM,rb as Gl,rc as Sv,rd as Kf,sa as yM,sb as Ul,sc as Tv,sd as Wf,ta as SM,tb as jl,td as Yf,ua as TM,ub as Bl,uc as ju,ud as Hk,va as EM,vb as sI,vc as Bu,vd as Vk,w as vt,wa as AM,wb as aI,wc as Hu,wd as Kk,xa as xM,xb as cI,xc as Vu,xd as Xf,y as kt,ya as bM,yb as dI,yd as Jf,za as wM,zb as pI,zc as Ku,zd as Qf}from"./chunks/chunk-SP6CDM6B.js";import{$a as RI,$b as Vv,A as GP,Aa as fu,Ab as Pm,Ac as Bm,B as rp,Ba as _u,Bb as Mm,Bc as qm,C as np,Ca as hu,Cb as Im,Cc as zm,D as op,Da as gu,Db as vm,Dc as Hm,E as ip,Ea as Cu,Eb as wv,Ec as Vm,F as sp,Fa as yu,Fb as Ov,Fc as Km,G as ap,Ga as Su,Gb as Rv,Gc as Wm,H as cp,Ha as Tu,Hb as Pv,Hc as Ym,I as dp,Ib as Mv,Ic as Xm,J as pp,Jb as Iv,Jc as zt,K as lp,Kb as vv,Kc as Jm,L as up,La as mI,Lc as lk,M as qe,Ma as fI,Mb as km,Mc as uk,N as UP,Na as _I,Nb as Nm,Nc as mk,O as jP,Oa as CI,Ob as kv,Oc as Qm,P as BP,Pa as yI,Pb as Nv,Pc as fk,Q as qP,Qa as SI,Qb as Lv,Qc as Uk,R as zP,Ra as TI,Rb as $v,Rc as jk,S as HP,Sa as EI,Sb as Dv,Sc as Bk,T as VP,Ta as AI,Tb as Fv,Tc as qk,U as mp,Ua as xI,Ub as Gv,Uc as zk,V as al,Va as bI,Vb as Uv,W as cl,Wa as wI,Wb as jv,X as dl,Xa as OI,Xb as Bv,Y as pl,Yb as qv,Z as rI,Zb as zv,_ as nI,_b as Hv,a as vR,aa as ll,ac as Kv,b as kR,ba as ql,bb as PI,bc as Wv,c as NR,ca as zl,cb as MI,cc as Yv,d as LR,da as Hl,dc as Xv,e as bP,ea as Vl,ec as Jv,f as wP,fa as Kl,fb as II,fc as Qv,g as OP,ga as Wl,gb as vI,gc as Zv,h as RP,ha as Yl,hb as kI,hc as ek,i as PP,ia as Xl,ic as tk,j as MP,ja as Jl,jb as jI,jc as rk,k as IP,ka as Ql,kb as BI,kc as nk,la as Zl,lb as qI,lc as ok,ma as eu,mb as zI,mc as ik,na as tu,nb as HI,nc as sk,oa as ru,ob as lm,oc as ak,pa as nu,pb as um,pc as ck,qa as ou,qb as mm,qc as dk,ra as iu,rb as fm,rc as pk,sa as su,sb as _m,sc as qt,t as vP,ta as au,tb as hm,tc as Lm,u as kP,ua as cu,ub as xm,uc as $m,v as NP,va as du,vb as bm,vc as Dm,w as LP,wa as pu,wb as wm,wc as Fm,x as $P,xa as lu,xb as Om,xc as Gm,y as DP,ya as uu,yb as Rm,yc as Um,z as FP,za as mu,zb as bv,zc as jm}from"./chunks/chunk-T7UTG56V.js";import"./chunks/chunk-MO6PPUI6.js";import"./chunks/chunk-6H36ZHMI.js";import"./chunks/chunk-MGJMQSN4.js";import{x as tp}from"./chunks/chunk-LRGYV6QQ.js";import{e as eI,f as tI,g as il,h as sl,i as Bt}from"./chunks/chunk-TWRUA2NH.js";import{A as Lp,Aa as Kp,B as $p,C as Dt,Ca as Wp,Da as Yp,Ea as Xp,b as $R,c as DR,d as FR,da as Ft,e as GR,ea as Gt,f as UR,fa as Ut,g as jR,ga as jt,h as Lc,i as $c,j as Dc,ja as Dp,k as Fc,l as Gc,la as Fp,ma as Gp,n as vM,na as Up,s as jM,t as BM,ta as jp,ua as Bp,v as qM,w as zM,wa as qp,x as HM,xa as zp,y as kp,ya as Hp,z as Np,za as Vp}from"./chunks/chunk-T7RZPIOB.js";import{a as wR,b as OR}from"./chunks/chunk-CTM26LUE.js";import{a as kM,b as NM,c as LM,d as $M,e as DM,f as FM,g as GM,h as bp,i as wp,j as Op,k as Rp,l as Pp,m as UM,n as Mp,o as Ip,p as vp}from"./chunks/chunk-OFIYA3PI.js";import{a as Tp,b as Ep,e as Ap,f as xp}from"./chunks/chunk-KHFUHGL3.js";import"./chunks/chunk-AA52P34H.js";import{$ as Vd,A as Dd,B as Fd,C as Gd,D as Ud,E as jd,F as Bd,G as qd,H as lP,I as uP,J as mP,K as fP,L as _P,M as hP,Q as gP,R as CP,S as yP,T as SP,U as TP,V as EP,W as AP,X as xP,Z as zd,_ as Hd,a as Jc,aa as Kd,b as Qc,ba as Wd,c as Zc,ca as Yd,d as ed,da as Xd,e as td,ea as Jd,f as rd,fa as Qd,g as nd,ga as Zd,h as od,ha as ep,i as id,ia as It,j as Sd,k as Td,l as Ed,m as Ad,n as xd,o as bd,p as wd,q as Od,r as Rd,s as Pd,t as Md,u as Id,v as vd,w as kd,x as Nd,y as Ld,z as $d}from"./chunks/chunk-CDUV7DFD.js";import{a as lR,b as uR,c as mR,d as fR,e as _R,f as hR,g as gR,h as CR,i as yR,j as Us,k as js,l as Bs,m as qs,n as zs,o as Hs,q as Vs,s as Ks,y as Ws}from"./chunks/chunk-56DKWGHE.js";import{b as cR}from"./chunks/chunk-E2LQ6LCJ.js";import"./chunks/chunk-PZA7QECY.js";import{$ as jb,$c as BO,A as ST,Ac as NO,Ad as pR,B as TT,Bb as nO,Bc as LO,C as ET,Cc as $O,Dc as Ss,Ec as Ts,Fb as oO,Fc as Es,Gb as iO,Gc as As,Ha as fw,Hb as sO,Hc as xs,Ia as _w,Ib as ds,Ic as bs,Ja as hw,Jb as aO,Jc as ws,K as vT,Ka as gw,Kc as Os,La as Cw,Lb as cO,Lc as Rs,M as jT,Ma as yw,Mb as dO,Mc as Ps,N as BT,Na as bw,Nb as pO,Nc as Ms,O as qT,Oa as ww,Ob as lO,Oc as Is,P as zT,Pa as Ow,Pb as uO,Pc as vs,Q as XT,Qa as wt,Qb as mO,Qc as ks,R as JT,Rb as fO,Sa as Rw,Sb as _O,Sc as Ns,T as Lb,Ta as Pw,Tb as hO,Tc as DO,Ua as Mw,Ub as gO,Uc as FO,V as $b,Va as Iw,Vb as Ot,Vc as Ls,W as Db,Wa as vw,Wb as CO,Wc as GO,Xb as yO,Xc as UO,Y as Fb,Yc as $s,Z as Gb,Za as kw,Zc as Ds,_ as Ub,_c as jO,a as aT,aa as Bb,ad as qO,ba as qb,bb as rs,bc as ps,bd as zO,ca as zb,cc as ls,cd as HO,da as ew,db as qw,dc as us,dd as VO,eb as zw,ec as ms,ed as KO,fa as Qi,fb as Hw,fd as Fs,ga as Zi,gb as Vw,gc as fs,gd as Gs,ha as es,hc as _s,hd as WO,i as io,ib as Kw,ic as hs,id as YO,j as cT,ja as tw,jb as Ww,jc as gs,jd as XO,k as dT,ka as rw,kb as Yw,kc as Cs,kd as JO,l as pT,la as nw,lb as Xw,lc as ys,ld as QO,m as lT,ma as ow,mb as ss,mc as SO,md as ZO,na as iw,nb as as,nc as TO,nd as eR,o as uT,oa as sw,oc as EO,od as tR,p as mT,pa as aw,pb as cs,pc as AO,pd as rR,qb as Jw,qc as xO,qd as nR,r as fT,ra as cw,rc as bO,rd as oR,sb as Qw,sc as wO,t as _T,ta as dw,tb as Zw,tc as OO,u as hT,ua as pw,ub as eO,uc as RO,v as gT,va as lw,vc as PO,vd as Rt,wa as uw,wb as tO,wc as MO,wd as iR,x as CT,xa as mw,xc as IO,xd as sR,y as yT,yc as vO,yd as aR,zb as rO,zc as kO,zd as dR}from"./chunks/chunk-CATRDGAB.js";import{A as Gw,B as Uw,C as jw,D as Bw,E as ns,F as os,G as is,a as Hb,b as Vb,c as Kb,d as Wb,e as Yb,f as Xb,g as Jb,h as Qb,i as Zb,l as Sw,o as Tw,p as Ew,s as Aw,t as ts,u as xw,v as Nw,w as Lw,x as $w,y as Dw,z as Fw}from"./chunks/chunk-LMDIKSDZ.js";import"./chunks/chunk-YEMFOKFG.js";import{$a as Zo,$c as aA,$d as FA,$e as Ix,$g as Sb,A as Qn,Aa as Bo,Ab as li,Ad as mA,Ae as lx,B as Zn,Ba as qo,Bb as ui,Bd as fA,Be as ux,C as eo,Ca as zo,Cb as mi,Cc as FE,Cd as _A,Ce as mx,D as to,Da as Ho,Db as fi,Dc as GE,Dd as hA,De as fx,E as ro,Ea as Vo,Eb as _i,Ec as UE,Ee as _x,F as no,Fa as gE,Fc as jE,Fe as hx,G as oo,Ga as CE,Gc as BE,Gd as gA,Ge as gx,Hb as xE,Hc as qE,Hd as CA,Hg as cb,Ib as bE,Ic as zE,Id as yA,If as Bx,Ig as db,Jb as hi,Jc as HE,Jd as SA,Je as Cx,Jf as Ge,Jg as pb,Kc as VE,Kd as TA,Ke as yx,Kf as xt,Lc as KE,Ld as EA,Le as Sx,Lf as qx,Lg as lb,M as Ct,Mc as WE,Md as AA,Me as Tx,Mf as zx,Mg as ub,N as yt,Nb as wE,Nc as YE,Nd as xA,Ne as Ex,Nf as Hx,Ob as OE,Od as bA,Oe as Ax,Of as Vx,Og as mb,Pd as wA,Pe as xx,Pf as q,Pg as Vi,Q as No,Qc as XE,Qd as OA,Qe as bx,Qf as Kx,Rc as JE,Rd as RA,Rf as Wx,Rg as Ki,S as kT,Sa as Ko,Sc as QE,Sd as PA,Sf as Yx,Sg as Wi,T as NT,Ta as Wo,Tc as ZE,Td as MA,Tf as Xx,Ua as yE,Uc as eA,Ud as IA,Ue as wx,Va as Yo,Vc as tA,Vd as vA,Ve as Ox,Vf as zi,Vg as fb,Wa as Xo,Wc as rA,Wd as kA,Wf as Hi,Wg as _b,X as LT,Xa as SE,Xb as RE,Xc as nA,Xd as NA,Xg as hb,Ya as Jo,Yb as PE,Yc as oA,Yd as LA,Ye as Rx,Yg as gb,Za as Qo,Zb as ME,Zc as iA,Zd as $A,Ze as Px,Zg as Cb,_ as $T,_a as L,_b as IE,_c as sA,_d as DA,_e as Mx,_g as yb,a as XS,ac as vE,ae as GA,af as vx,ah as Yi,b as JS,ba as DT,bc as kE,bd as Ei,be as UA,bf as kx,bh as Tb,c as QS,cd as Ai,ce as jA,cf as Nx,ch as Eb,d as ZS,dd as xi,de as BA,df as Lx,e as eT,ea as FT,ed as bi,ee as qA,f as tT,fa as HT,fb as Fe,fd as wi,fe as zA,ff as $x,fg as Jx,fh as Ab,g as rT,ga as VT,gb as ei,gd as Oi,ge as HA,gf as Dx,gg as bt,gh as xb,h as nT,ha as KT,hc as NE,hd as Ri,he as VA,hf as Fx,hg as Qx,hh as bb,i as oT,ia as WT,id as Pi,ie as KA,if as Gx,ig as Zx,ih as wb,j as iT,ja as YT,jc as gi,jd as Mi,je as WA,jf as Ux,jg as eb,jh as Ob,k as sT,ka as QT,kc as Ci,kd as Ii,ke as YA,kh as Rb,l as Gn,la as ZT,lc as yi,ld as vi,le as XA,lf as jx,lh as Xi,m as Un,ma as eE,mc as Si,md as ki,me as JA,mf as Bi,mg as tb,n as jn,na as tE,nb as TE,nd as Ni,ne as QA,nf as qi,ng as rb,o as Bn,oa as rE,ob as EE,od as Li,oe as ZA,og as nb,oh as Pb,p as qn,pa as nE,pb as AE,pd as $i,pe as ex,pg as ob,ph as Ji,q as zn,qa as oE,qb as ti,qd as Di,qe as tx,qg as ib,r as Hn,ra as iE,rb as ri,rd as Fi,re as rx,s as Ne,sa as sE,sb as ni,sc as LE,sd as Gi,se as nx,sh as Mb,t as Le,ta as aE,tb as oi,tc as $E,td as Ui,te as ox,tg as sb,th as Ib,u as Vn,ua as cE,ub as ii,uc as DE,ud as ji,ue as ix,uh as vb,v as Kn,va as dE,vb as si,vd as cA,ve as sx,vg as ab,vh as kb,w as Wn,wa as pE,wb as ai,wd as dA,we as ax,wh as Nb,x as Yn,xa as Uo,xb as ci,xd as pA,xe as cx,y as Xn,ya as jo,yb as di,yc as Ti,yd as lA,ye as dx,z as Jn,zb as pi,zd as uA,ze as px}from"./chunks/chunk-56GUDMXN.js";import{c as AT,d as xT,e as bT,h as go,i as wT,j as OT,k as RT,l as PT,n as Co,o as yo,p as De,q as MT,r as IT,s as So,t as To,v as Eo}from"./chunks/chunk-D3I5AHNN.js";import"./chunks/chunk-5ECCMDSU.js";import{$ as Ta,$a as Tc,A as sP,Aa as Wa,B as Js,Ba as Ya,C as Qs,Ca as Xa,D as Zs,Da as Ja,Ea as Qa,F as ea,Fa as Za,G as ta,Ga as ec,H as ra,Ha as tc,I as na,Ia as rc,J as oa,Ja as nc,K as ia,Ka as oc,L as sa,La as ic,M as aa,Ma as sc,N as ca,Na as ac,O as da,Oa as cc,P as pa,Pa as dc,Q as la,Qa as pc,R as ua,Ra as lc,S as ma,Sa as uc,Ta as mc,U as fa,Ua as fc,V as _a,Va as _c,W as ha,Wa as hc,X as ga,Xa as gc,Y as Ca,Ya as Cc,Z as ya,Za as yc,_ as Sa,_a as Sc,aa as Ea,ab as Ec,b as BR,ba as Aa,bb as Ac,c as qR,ca as xa,cb as xc,d as zR,da as ba,db as bc,e as HR,ea as wa,eb as wc,f as VR,fa as Oa,fb as Oc,ga as Ra,gb as Rc,h as KR,ha as Pa,hb as Pc,i as WR,ia as Ma,ib as Mc,j as Xs,ja as Ia,jb as Ic,k as YR,ka as va,kb as vc,la as ka,ma as Na,mb as Be,n as XR,na as La,nb as Z,o as JR,oa as $a,ob as kc,p as Ue,pa as Da,q as QR,qa as Fa,r as ZR,ra as Ga,s as eP,sa as Ua,t as Pt,ta as ja,u as je,ua as Ba,v as tP,va as qa,w as rP,wa as za,x as nP,xa as Ha,y as oP,ya as Va,z as iP,za as Ka}from"./chunks/chunk-FG4TNQQM.js";import{I as ko,L as Tt,N as Et,Q as Lo,R as $o,S as At,U as GT,W as UT,Y as Go,a as R,b as YS,c as gt,da as fE,e as Mn,f as In,g as vn,ga as _E,h as kn,ha as hE,i as ve,j as Nn,k as N,l as ke,m as Ln,n as $n,o as Dn,p as Fn,q as Ao,r as xo,s as bo,t as wo,u as Oo,v as Ro,w as Po,x as Mo,y as Io,z as vo}from"./chunks/chunk-54AQJTUH.js";import{T as lE,W as Do,X as uE,Y as Fo,_ as mE,a as po,b as lo,c as uo,h as mo,j as fo,k as _o,l as ho}from"./chunks/chunk-WKDKBS4P.js";import{A as ue,B as WS,C as S,E as so,F as St,G as me,H as ao,K as $e,M as co,b as jS,c as BS,d as qS,m as zS,r as HS,u as VS,y as KS}from"./chunks/chunk-6OIHST4I.js";import"./chunks/chunk-XAWE4EAK.js";var z="2026-07-28",or=["2025-11-25","2025-06-18"],te=[z],m={headerMismatch:-32020,missingRequiredClientCapability:-32021,unsupportedProtocolVersion:-32022,invalidParams:-32602},x={clientCapabilities:"io.modelcontextprotocol/clientCapabilities",clientInfo:"io.modelcontextprotocol/clientInfo",logLevel:"io.modelcontextprotocol/logLevel",protocolVersion:"io.modelcontextprotocol/protocolVersion",serverInfo:"io.modelcontextprotocol/serverInfo"},nr=["debug","info","notice","warning","error","critical","alert","emergency"],u=class extends Error{code;data;constructor(t,r,n={}){super(t),this.name="PmMcpProtocolError",this.code=r,this.data=n}};function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qg(e){if(e===void 0)return;if(!h(e))throw new u("Invalid MCP clientInfo metadata",m.invalidParams,{field:x.clientInfo,expected:"object"});let t=typeof e.name=="string"?e.name.trim():"",r=typeof e.version=="string"?e.version.trim():"";if(t.length===0||r.length===0)throw new u("Invalid MCP clientInfo metadata",m.invalidParams,{field:x.clientInfo,required:["name","version"]});let n={name:t.slice(0,128),version:r.slice(0,128)};return typeof e.description=="string"&&e.description.trim()&&(n.description=e.description.trim().slice(0,1024)),typeof e.websiteUrl=="string"&&e.websiteUrl.trim()&&(n.websiteUrl=e.websiteUrl.trim().slice(0,2048)),n}function zg(e){if(e!==void 0){if(typeof e!="string"||!nr.includes(e))throw new u("Invalid MCP logLevel metadata",m.invalidParams,{field:x.logLevel,allowed:[...nr]});return e}}function Ye(e){let t=h(e)?e._meta:void 0;if(!h(t))throw new u("Missing required MCP request metadata",m.invalidParams,{required:[x.protocolVersion,x.clientCapabilities]});let r=t[x.protocolVersion];if(typeof r!="string"||!te.includes(r))throw new u("Unsupported protocol version",m.unsupportedProtocolVersion,{supported:[...te],requested:typeof r=="string"?r:null});let n=t[x.clientCapabilities];if(!h(n))throw new u("Invalid MCP client capabilities metadata",m.invalidParams,{field:x.clientCapabilities,expected:"object"});let o=qg(t[x.clientInfo]),i=zg(t[x.logLevel]);return{protocolVersion:z,clientCapabilities:n,...o?{clientInfo:o}:{},...i?{logLevel:i}:{}}}function D0(e,t){if(t!==e.protocolVersion)throw new u("MCP protocol header does not match request metadata",m.headerMismatch,{header:t??null,metadata:e.protocolVersion})}function F0(e,t){let r=t.filter(n=>!Object.prototype.hasOwnProperty.call(e.clientCapabilities,n));if(r.length>0)throw new u("Missing required client capability",m.missingRequiredClientCapability,{requiredCapabilities:Object.fromEntries(r.map(n=>[n,{}]))})}function G0(e,t){let r=e.clientCapabilities.extensions;return h(r)&&h(r[t])}function Xe(e,t){let r=h(e._meta)?e._meta:{};return{...e,_meta:{...r,[x.serverInfo]:{...t}}}}function Hg(e,t){return Xe({...e,resultType:"complete"},t)}function U0(e){let t=e.ttlMs??6e4;if(!Number.isFinite(t)||t<0)throw new u("Invalid MCP discovery cache TTL",m.invalidParams,{ttlMs:t});return Hg({supportedVersions:[...te],capabilities:structuredClone(e.capabilities),ttlMs:t,cacheScope:"public",...e.instructions?{instructions:e.instructions}:{}},e.serverInfo)}function j0(e,t){if(h(e)&&typeof e.resultType=="string")return e.resultType;if(t==="legacy")return"complete";throw new u("Modern MCP result is missing resultType",m.invalidParams,{required:"resultType"})}var Vg=new Set(["--help","-h","--version","-V"]);function Kg(e,t){let n=[`Usage: ${e==="stdio"?"pm-mcp":"pm-mcp-http"} [--help | --version]`,"",e==="stdio"?"JSON-RPC over stdin/stdout. With no arguments, starts the stdio server.":"Streamable HTTP POST /mcp. With no arguments, starts the HTTP server.","","Options:"," -h, --help Print help and exit before transport startup."," -V, --version Print the package version and exit.","","Environment:"," PM_PATH Tracker root (otherwise discovered from cwd)."," PM_GLOBAL_PATH Global settings root."," PM_MCP_PROFILE core (default), standard, full, or custom."," PM_MCP_TOOLS Comma-separated tool allowlist for custom profile."," PM_MCP_DISCOVERY_CURSOR_KEY Shared discovery cursor secret, at least 32 UTF-8 bytes."," PM_MCP_BAGGAGE_ALLOWLIST Comma-separated permitted trace baggage keys."];return e==="http"&&n.push(" PM_MCP_HTTP_HOST Bind host (default 127.0.0.1)."," PM_MCP_HTTP_PORT Bind port, 0..65535 (default 3000)."," PM_MCP_HTTP_ALLOWED_ORIGINS Comma-separated exact browser origins (default none)."," PM_MCP_HTTP_BEARER_TOKEN Deployment token for the bundled verifier."," PM_MCP_HTTP_AUTH_ISSUER Exact HTTPS authorization-server issuer."," PM_MCP_HTTP_RESOURCE Canonical resource/audience URI."," PM_MCP_HTTP_SCOPES Space-separated scopes (default pm:read pm:write).","","Non-loopback HTTP requires bearer token, issuer, and resource together."),n.push("",`MCP protocol: ${te.join(", ")}.`,e==="stdio"?`Legacy initialize compatibility: ${or.join(", ")}.`:"HTTP requires modern per-request metadata; legacy initialize is stdio-only.","",e==="stdio"?"Client configuration:":"Example loopback server:",e==="stdio"?JSON.stringify({mcpServers:{pm:{command:"npx",args:["--yes","--package",`@unbrained/pm-cli@${t}`,"pm-mcp"]}}}):`PM_MCP_HTTP_PORT=3000 npx --yes --package @unbrained/pm-cli@${t} pm-mcp-http`,...e==="http"?["HTTP client configuration:",JSON.stringify({mcpServers:{pm:{url:"http://127.0.0.1:3000/mcp"}}})]:[],"","Configuration: https://github.com/unbraind/pm-cli/blob/main/docs/MCP_REMOTE_TRANSPORT_SECURITY.md",""),n.join(`
1
+ import{f as Bg}from"./chunks/chunk-Z7YL2SUM.js";import{a as vN,b as kN,c as NN,d as LN}from"./chunks/chunk-TX74QJ4W.js";import{a as $N,b as DN}from"./chunks/chunk-47ZS6RPL.js";import{b as rN,c as nN,d as oN,e as iN,f as sN,g as aN,h as cN,i as dN,j as pN,k as lN,l as uN,m as mN,n as fN,o as _N,p as hN,q as gN,r as CN}from"./chunks/chunk-FECZV72T.js";import{a as Ys,b as _d,c as hd,d as gd,e as Cd,f as yd,g as yN,h as SN,i as TN,j as EN,k as AN,l as xN,m as bN,n as wN,o as ON,p as RN,q as PN,r as MN,s as IN}from"./chunks/chunk-YVTALIN3.js";import{a as aP,b as cP,c as Uc,d as jc,e as Bc,g as qc,h as zc,i as Hc,j as Vc,k as Kc,l as Wc,m as Yc,p as Xc}from"./chunks/chunk-NHBG5ET3.js";import{A as p0,B as l0,C as u0,D as m0,E as f0,F as _0,G as h0,H as g0,I as C0,J as y0,K as S0,L as T0,M as E0,N as A0,O as x0,P as b0,Q as w0,R as O0,S as R0,T as P0,U as M0,V as I0,W as v0,X as k0,Y as N0,Z as L0,_ as $0,a as FN,b as GN,c as UN,d as jN,e as BN,f as qN,g as zN,h as HN,i as VN,j as KN,k as WN,l as YN,m as XN,n as JN,o as QN,p as ZN,q as e0,r as t0,s as r0,t as n0,u as o0,v as i0,w as s0,x as a0,y as c0,z as d0}from"./chunks/chunk-FR7ULTM4.js";import{$ as Af,$a as fh,$b as fg,A as Ke,Aa as $_,Ab as jh,Ac as jg,B as cf,Ba as D_,Bb as Bh,C as df,Ca as F_,Cb as qh,D as lf,Da as G_,Db as zh,E as uf,Ea as U_,Eb as Hh,F as Ht,Fa as j_,Fb as Vh,G as Vt,Ga as B_,Gb as Kh,H as Kt,Ha as q_,Hb as Wh,I as Wt,Ia as z_,Ib as Yh,J as Yt,Ja as H_,Jb as Xh,K as Xt,Ka as V_,Kb as Jh,L as Jt,La as K_,Lb as Qh,M as Qt,Ma as W_,Mb as Zh,N as Zt,Na as Y_,Nb as eg,O as er,Oa as X_,Ob as tg,P as tr,Pa as J_,Pb as rg,Q as mf,Qa as Q_,Qb as ng,R as ff,Ra as Z_,Rb as og,S as _f,Sa as eh,Sb as ig,T as hf,Ta as th,Tb as sg,U as gf,Ua as rh,Ub as ag,V as We,Va as rr,Vb as cg,W as Cf,Wa as _e,Wb as dg,X as yf,Xa as ph,Xb as pg,Y as Sf,Ya as lh,Yb as lg,Z as Tf,Za as uh,Zb as ug,_ as Ef,_a as mh,_b as mg,a as SR,aa as xf,ab as _h,ac as _g,b as TR,ba as bf,bb as hh,bc as hg,c as ER,ca as Dk,cb as gh,cc as gg,d as AR,da as Fk,db as Ch,dc as Cg,e as xR,ea as Gk,eb as yh,ec as yg,f as bR,fa as Ff,fb as Sh,fc as Sg,g as RR,ga as Gf,gb as Th,gc as Tg,h as PR,ha as Uf,hb as Eh,hc as Eg,i as MR,ia as w_,ib as Ah,ic as Ag,j as IR,ja as O_,jb as xh,jc as xg,k as Nc,ka as Wk,kb as bh,kc as bg,la as Yk,lb as wh,lc as wg,m as VM,ma as Xk,mb as Oh,mc as Og,n as KM,na as Jk,nb as Rh,nc as Rg,o as WM,oa as Qk,ob as Ph,oc as Pg,p as YM,pa as Zk,pb as Mh,pc as Mg,q as XM,qa as eN,qb as Ih,qc as Ig,r as JM,ra as tN,rb as vh,rc as vg,s as ol,sa as R_,sb as kh,sc as kg,t as Gu,ta as P_,tb as Nh,tc as Ng,u as Uu,ua as M_,ub as Lh,uc as Lg,v as qu,va as I_,vb as $h,vc as $g,w as zu,wa as v_,wb as Dh,wc as Dg,x as pm,xa as k_,xb as Fh,xc as Fg,y as gm,ya as N_,yb as Gh,yc as Gg,z as xv,za as L_,zb as Uh,zc as Ug}from"./chunks/chunk-NZSXWIX7.js";import{e as eI,f as tI,g as il,h as sl,i as Bt}from"./chunks/chunk-CCKM5YQM.js";import{A as wk,B as Ok,C as Rk,D as Pk,E as Mk,F as Ik,G as vk,H as kk,I as Nk,J as Lk,K as $k,L as Rf,M as Pf,N as Mf,O as If,P as vf,Q as kf,R as Nf,S as Lf,T as $f,U as Df,a as av,b as cv,c as dv,d as pv,e as lv,f as Fu,g as uv,h as mv,i as fv,j as _v,k as hv,m as pf,n as wf,o as _k,p as hk,q as gk,r as Ck,s as yk,t as Sk,u as Of,v as Tk,w as Ek,x as Ak,y as xk,z as bk}from"./chunks/chunk-2SBTXR6C.js";import{$ as rM,$a as jl,$b as dm,$c as ih,Aa as OM,Ab as QI,Ac as Kf,Ba as RM,Bb as Nu,Bc as Wf,C as ze,Ca as PM,Cb as Lu,Cc as Yf,D as ee,Da as MM,Db as $u,Dc as Hk,E as fp,Ea as IM,Eb as ZI,Ec as Vk,Fb as ev,Fc as Kk,Gb as tv,Gc as Xf,H as He,Ha as QM,Hb as rv,Hc as Jf,I as _p,Ia as ZM,Ib as nv,Ic as Qf,J as hp,Ja as Jp,Jb as ov,Jc as Zf,Ka as Qp,Kb as iv,Kc as e_,L as fe,La as Zp,Lb as sv,Lc as t_,M as gp,Ma as el,Mb as Du,Mc as r_,N as Cp,Na as tl,Nb as gv,Nc as n_,O as yp,Oa as rl,Ob as Cv,Oc as o_,P as Sp,Pa as nl,Pb as yv,Pc as i_,Q as KP,Qa as vl,Qb as Sv,Qc as s_,R as WP,Ra as kl,Rb as Tv,Rc as a_,S as YP,Sa as oI,Sc as c_,T as XP,Ta as Nl,Tb as ju,Tc as d_,U as JP,Ua as Ll,Ub as Bu,Uc as f_,V as Nt,Va as $l,Vb as Hu,Vc as __,W as QP,Wa as Dl,Wb as Vu,X as ZP,Xa as iI,Xc as h_,Y as Lt,Ya as Fl,Yc as b_,Z as eM,Za as Gl,Zb as Ev,Zc as nh,_ as tM,_a as Ul,_b as Av,_c as oh,a as dP,aa as nM,ab as Bl,ac as Cm,ad as sh,b as Mt,ba as oM,bb as sI,bc as ym,bd as ah,c as pP,ca as Ve,cb as aI,cc as Sm,cd as ch,d as sd,da as iM,db as cI,dc as Tm,dd as dh,e as ad,ea as $t,eb as dI,ec as Em,f as cd,fa as sM,fb as pI,g as dd,ga as aM,gb as lI,h as pd,ha as cM,hb as uI,ia as dM,ib as hI,j as ld,ja as pM,jb as Eu,jc as Am,k as ud,ka as lM,kb as gI,la as uM,lb as NI,lc as Zm,ma as mM,mb as LI,mc as ef,na as fM,nb as $I,nc as tf,o as md,oa as _M,ob as DI,p as fd,pa as hM,pb as FI,pc as rf,qa as gM,qb as GI,qc as nf,ra as CM,rb as UI,rc as of,sa as yM,sb as VI,sc as sf,ta as SM,tb as KI,tc as af,ua as TM,ub as Au,uc as jf,va as EM,vb as xu,vc as Bf,w as vt,wa as AM,wb as WI,wc as qf,xa as xM,xb as YI,xc as zf,y as kt,ya as bM,yb as XI,yc as Hf,za as wM,zb as JI,zc as Vf}from"./chunks/chunk-WFYE34TO.js";import{$a as RI,$b as Vv,A as GP,Aa as fu,Ab as Pm,Ac as Bm,B as rp,Ba as _u,Bb as Mm,Bc as qm,C as np,Ca as hu,Cb as Im,Cc as zm,D as op,Da as gu,Db as vm,Dc as Hm,E as ip,Ea as Cu,Eb as wv,Ec as Vm,F as sp,Fa as yu,Fb as Ov,Fc as Km,G as ap,Ga as Su,Gb as Rv,Gc as Wm,H as cp,Ha as Tu,Hb as Pv,Hc as Ym,I as dp,Ib as Mv,Ic as Xm,J as pp,Jb as Iv,Jc as zt,K as lp,Kb as vv,Kc as Jm,L as up,La as mI,Lc as lk,M as qe,Ma as fI,Mb as km,Mc as uk,N as UP,Na as _I,Nb as Nm,Nc as mk,O as jP,Oa as CI,Ob as kv,Oc as Qm,P as BP,Pa as yI,Pb as Nv,Pc as fk,Q as qP,Qa as SI,Qb as Lv,Qc as Uk,R as zP,Ra as TI,Rb as $v,Rc as jk,S as HP,Sa as EI,Sb as Dv,Sc as Bk,T as VP,Ta as AI,Tb as Fv,Tc as qk,U as mp,Ua as xI,Ub as Gv,Uc as zk,V as al,Va as bI,Vb as Uv,W as cl,Wa as wI,Wb as jv,X as dl,Xa as OI,Xb as Bv,Y as pl,Yb as qv,Z as rI,Zb as zv,_ as nI,_b as Hv,a as vR,aa as ll,ac as Kv,b as kR,ba as ql,bb as PI,bc as Wv,c as NR,ca as zl,cb as MI,cc as Yv,d as LR,da as Hl,dc as Xv,e as bP,ea as Vl,ec as Jv,f as wP,fa as Kl,fb as II,fc as Qv,g as OP,ga as Wl,gb as vI,gc as Zv,h as RP,ha as Yl,hb as kI,hc as ek,i as PP,ia as Xl,ic as tk,j as MP,ja as Jl,jb as jI,jc as rk,k as IP,ka as Ql,kb as BI,kc as nk,la as Zl,lb as qI,lc as ok,ma as eu,mb as zI,mc as ik,na as tu,nb as HI,nc as sk,oa as ru,ob as lm,oc as ak,pa as nu,pb as um,pc as ck,qa as ou,qb as mm,qc as dk,ra as iu,rb as fm,rc as pk,sa as su,sb as _m,sc as qt,t as vP,ta as au,tb as hm,tc as Lm,u as kP,ua as cu,ub as xm,uc as $m,v as NP,va as du,vb as bm,vc as Dm,w as LP,wa as pu,wb as wm,wc as Fm,x as $P,xa as lu,xb as Om,xc as Gm,y as DP,ya as uu,yb as Rm,yc as Um,z as FP,za as mu,zb as bv,zc as jm}from"./chunks/chunk-ZA5NS3PL.js";import"./chunks/chunk-X5D5YUHR.js";import"./chunks/chunk-4QA5O64H.js";import{x as tp}from"./chunks/chunk-Q4VZSMUL.js";import{$ as m_,A as Mu,B as Iu,C as vu,D as ku,I as Ku,J as Wu,K as Yu,L as Xu,M as Ju,N as Qu,O as Zu,P as em,Q as tm,R as rm,S as nm,T as om,U as im,V as sm,W as am,X as cm,Y as p_,Z as l_,_ as u_,b as ul,ba as g_,c as ml,ca as C_,d as fl,da as y_,e as _l,ea as S_,f as hl,g as gl,ga as T_,h as Cl,ha as E_,i as yl,ia as A_,j as Sl,ja as x_,k as Tl,l as El,m as Al,n as xl,o as bl,p as wl,q as Ol,r as Rl,s as Pl,t as Ml,u as Il,v as bu,w as wu,x as Ou,y as Ru,z as Pu}from"./chunks/chunk-TY55UX6M.js";import{A as Lp,Aa as Kp,B as $p,C as Dt,Ca as Wp,Da as Yp,Ea as Xp,b as $R,c as DR,d as FR,da as Ft,e as GR,ea as Gt,f as UR,fa as Ut,g as jR,ga as jt,h as Lc,i as $c,j as Dc,ja as Dp,k as Fc,l as Gc,la as Fp,ma as Gp,n as vM,na as Up,s as jM,t as BM,ta as jp,ua as Bp,v as qM,w as zM,wa as qp,x as HM,xa as zp,y as kp,ya as Hp,z as Np,za as Vp}from"./chunks/chunk-IGEFPHV7.js";import{a as wR,b as OR}from"./chunks/chunk-DCWGM7CY.js";import"./chunks/chunk-6H36ZHMI.js";import{a as kM,b as NM,c as LM,d as $M,e as DM,f as FM,g as GM,h as bp,i as wp,j as Op,k as Rp,l as Pp,m as UM,n as Mp,o as Ip,p as vp}from"./chunks/chunk-AOTI76Q6.js";import{a as Tp,b as Ep,e as Ap,f as xp}from"./chunks/chunk-OGVSGXQX.js";import"./chunks/chunk-AA52P34H.js";import{$ as Vd,A as Dd,B as Fd,C as Gd,D as Ud,E as jd,F as Bd,G as qd,H as lP,I as uP,J as mP,K as fP,L as _P,M as hP,Q as gP,R as CP,S as yP,T as SP,U as TP,V as EP,W as AP,X as xP,Z as zd,_ as Hd,a as Jc,aa as Kd,b as Qc,ba as Wd,c as Zc,ca as Yd,d as ed,da as Xd,e as td,ea as Jd,f as rd,fa as Qd,g as nd,ga as Zd,h as od,ha as ep,i as id,ia as It,j as Sd,k as Td,l as Ed,m as Ad,n as xd,o as bd,p as wd,q as Od,r as Rd,s as Pd,t as Md,u as Id,v as vd,w as kd,x as Nd,y as Ld,z as $d}from"./chunks/chunk-KCVSSONY.js";import{a as lR,b as uR,c as mR,d as fR,e as _R,f as hR,g as gR,h as CR,i as yR,j as Us,k as js,l as Bs,m as qs,n as zs,o as Hs,q as Vs,s as Ks,y as Ws}from"./chunks/chunk-USBTXMKS.js";import{b as cR}from"./chunks/chunk-5PNOVDVO.js";import"./chunks/chunk-PZA7QECY.js";import{$ as jb,$c as BO,A as ST,Ac as NO,Ad as pR,B as TT,Bb as nO,Bc as LO,C as ET,Cc as $O,Dc as Ss,Ec as Ts,Fb as oO,Fc as Es,Gb as iO,Gc as As,Ha as fw,Hb as sO,Hc as xs,Ia as _w,Ib as ds,Ic as bs,Ja as hw,Jb as aO,Jc as ws,K as vT,Ka as gw,Kc as Os,La as Cw,Lb as cO,Lc as Rs,M as jT,Ma as yw,Mb as dO,Mc as Ps,N as BT,Na as bw,Nb as pO,Nc as Ms,O as qT,Oa as ww,Ob as lO,Oc as Is,P as zT,Pa as Ow,Pb as uO,Pc as vs,Q as XT,Qa as wt,Qb as mO,Qc as ks,R as JT,Rb as fO,Sa as Rw,Sb as _O,Sc as Ns,T as Lb,Ta as Pw,Tb as hO,Tc as DO,Ua as Mw,Ub as gO,Uc as FO,V as $b,Va as Iw,Vb as Ot,Vc as Ls,W as Db,Wa as vw,Wb as CO,Wc as GO,Xb as yO,Xc as UO,Y as Fb,Yc as $s,Z as Gb,Za as kw,Zc as Ds,_ as Ub,_c as jO,a as aT,aa as Bb,ad as qO,ba as qb,bb as rs,bc as ps,bd as zO,ca as zb,cc as ls,cd as HO,da as ew,db as qw,dc as us,dd as VO,eb as zw,ec as ms,ed as KO,fa as Qi,fb as Hw,fd as Fs,ga as Zi,gb as Vw,gc as fs,gd as Gs,ha as es,hc as _s,hd as WO,i as io,ib as Kw,ic as hs,id as YO,j as cT,ja as tw,jb as Ww,jc as gs,jd as XO,k as dT,ka as rw,kb as Yw,kc as Cs,kd as JO,l as pT,la as nw,lb as Xw,lc as ys,ld as QO,m as lT,ma as ow,mb as ss,mc as SO,md as ZO,na as iw,nb as as,nc as TO,nd as eR,o as uT,oa as sw,oc as EO,od as tR,p as mT,pa as aw,pb as cs,pc as AO,pd as rR,qb as Jw,qc as xO,qd as nR,r as fT,ra as cw,rc as bO,rd as oR,sb as Qw,sc as wO,t as _T,ta as dw,tb as Zw,tc as OO,u as hT,ua as pw,ub as eO,uc as RO,v as gT,va as lw,vc as PO,vd as Rt,wa as uw,wb as tO,wc as MO,wd as iR,x as CT,xa as mw,xc as IO,xd as sR,y as yT,yc as vO,yd as aR,zb as rO,zc as kO,zd as dR}from"./chunks/chunk-3TXEWHQX.js";import{A as Fw,B as Gw,C as Uw,D as jw,E as Bw,F as ns,G as os,H as is,a as Hb,b as Vb,c as Kb,d as Wb,e as Yb,f as Xb,g as Jb,h as Qb,i as Zb,l as Sw,o as Tw,p as Ew,t as Aw,u as ts,v as xw,w as Nw,x as Lw,y as $w,z as Dw}from"./chunks/chunk-KXTKLDKD.js";import"./chunks/chunk-3AZOATC2.js";import{$a as Zo,$c as aA,$d as FA,$e as Ix,$g as Sb,A as Qn,Aa as Bo,Ab as li,Ad as mA,Ae as lx,B as Zn,Ba as qo,Bb as ui,Bd as fA,Be as ux,C as eo,Ca as zo,Cb as mi,Cc as FE,Cd as _A,Ce as mx,D as to,Da as Ho,Db as fi,Dc as GE,Dd as hA,De as fx,E as ro,Ea as Vo,Eb as _i,Ec as UE,Ee as _x,F as no,Fa as gE,Fc as jE,Fe as hx,G as oo,Ga as CE,Gc as BE,Gd as gA,Ge as gx,Hb as xE,Hc as qE,Hd as CA,Hg as cb,Ib as bE,Ic as zE,Id as yA,If as Bx,Ig as db,Jb as hi,Jc as HE,Jd as SA,Je as Cx,Jf as Ge,Jg as pb,Kc as VE,Kd as TA,Ke as yx,Kf as xt,Lc as KE,Ld as EA,Le as Sx,Lf as qx,Lg as lb,M as Ct,Mc as WE,Md as AA,Me as Tx,Mf as zx,Mg as ub,N as yt,Nb as wE,Nc as YE,Nd as xA,Ne as Ex,Nf as Hx,Ob as OE,Od as bA,Oe as Ax,Of as Vx,Og as mb,Pd as wA,Pe as xx,Pf as q,Pg as Vi,Q as No,Qc as XE,Qd as OA,Qe as bx,Qf as Kx,Rc as JE,Rd as RA,Rf as Wx,Rg as Ki,S as kT,Sa as Ko,Sc as QE,Sd as PA,Sf as Yx,Sg as Wi,T as NT,Ta as Wo,Tc as ZE,Td as MA,Tf as Xx,Ua as yE,Uc as eA,Ud as IA,Ue as wx,Va as Yo,Vc as tA,Vd as vA,Ve as Ox,Vf as zi,Vg as fb,Wa as Xo,Wc as rA,Wd as kA,Wf as Hi,Wg as _b,X as LT,Xa as SE,Xb as RE,Xc as nA,Xd as NA,Xg as hb,Ya as Jo,Yb as PE,Yc as oA,Yd as LA,Ye as Rx,Yg as gb,Za as Qo,Zb as ME,Zc as iA,Zd as $A,Ze as Px,Zg as Cb,_ as $T,_a as L,_b as IE,_c as sA,_d as DA,_e as Mx,_g as yb,a as XS,ac as vE,ae as GA,af as vx,ah as Yi,b as JS,ba as DT,bc as kE,bd as Ei,be as UA,bf as kx,bh as Tb,c as QS,cd as Ai,ce as jA,cf as Nx,ch as Eb,d as ZS,dd as xi,de as BA,df as Lx,e as eT,ea as FT,ed as bi,ee as qA,f as tT,fa as HT,fb as Fe,fd as wi,fe as zA,ff as $x,fg as Jx,fh as Ab,g as rT,ga as VT,gb as ei,gd as Oi,ge as HA,gf as Dx,gg as bt,gh as xb,h as nT,ha as KT,hc as NE,hd as Ri,he as VA,hf as Fx,hg as Qx,hh as bb,i as oT,ia as WT,id as Pi,ie as KA,if as Gx,ig as Zx,ih as wb,j as iT,ja as YT,jc as gi,jd as Mi,je as WA,jf as Ux,jg as eb,jh as Ob,k as sT,ka as QT,kc as Ci,kd as Ii,ke as YA,kh as Rb,l as Gn,la as ZT,lc as yi,ld as vi,le as XA,lf as jx,lh as Xi,m as Un,ma as eE,mc as Si,md as ki,me as JA,mf as Bi,mg as tb,n as jn,na as tE,nb as TE,nd as Ni,ne as QA,nf as qi,ng as rb,o as Bn,oa as rE,ob as EE,od as Li,oe as ZA,og as nb,oh as Pb,p as qn,pa as nE,pb as AE,pd as $i,pe as ex,pg as ob,ph as Ji,q as zn,qa as oE,qb as ti,qd as Di,qe as tx,qg as ib,r as Hn,ra as iE,rb as ri,rd as Fi,re as rx,s as Ne,sa as sE,sb as ni,sc as LE,sd as Gi,se as nx,sh as Mb,t as Le,ta as aE,tb as oi,tc as $E,td as Ui,te as ox,tg as sb,th as Ib,u as Vn,ua as cE,ub as ii,uc as DE,ud as ji,ue as ix,uh as vb,v as Kn,va as dE,vb as si,vd as cA,ve as sx,vg as ab,vh as kb,w as Wn,wa as pE,wb as ai,wd as dA,we as ax,wh as Nb,x as Yn,xa as Uo,xb as ci,xd as pA,xe as cx,y as Xn,ya as jo,yb as di,yc as Ti,yd as lA,ye as dx,z as Jn,zb as pi,zd as uA,ze as px}from"./chunks/chunk-SJWIPGZW.js";import{b as AT,c as xT,d as bT,g as go,h as wT,i as OT,j as RT,k as PT,m as Co,n as yo,o as De,p as MT,q as IT,r as So,s as To,u as Eo}from"./chunks/chunk-GSLOAEY2.js";import"./chunks/chunk-NVYDPNQP.js";import{$ as Ta,$a as Tc,A as sP,Aa as Wa,B as Js,Ba as Ya,C as Qs,Ca as Xa,D as Zs,Da as Ja,Ea as Qa,F as ea,Fa as Za,G as ta,Ga as ec,H as ra,Ha as tc,I as na,Ia as rc,J as oa,Ja as nc,K as ia,Ka as oc,L as sa,La as ic,M as aa,Ma as sc,N as ca,Na as ac,O as da,Oa as cc,P as pa,Pa as dc,Q as la,Qa as pc,R as ua,Ra as lc,S as ma,Sa as uc,Ta as mc,U as fa,Ua as fc,V as _a,Va as _c,W as ha,Wa as hc,X as ga,Xa as gc,Y as Ca,Ya as Cc,Z as ya,Za as yc,_ as Sa,_a as Sc,aa as Ea,ab as Ec,b as BR,ba as Aa,bb as Ac,c as qR,ca as xa,cb as xc,d as zR,da as ba,db as bc,e as HR,ea as wa,eb as wc,f as VR,fa as Oa,fb as Oc,ga as Ra,gb as Rc,h as KR,ha as Pa,hb as Pc,i as WR,ia as Ma,ib as Mc,j as Xs,ja as Ia,jb as Ic,k as YR,ka as va,kb as vc,la as ka,ma as Na,mb as Be,n as XR,na as La,nb as Z,o as JR,oa as $a,ob as kc,p as Ue,pa as Da,q as QR,qa as Fa,r as ZR,ra as Ga,s as eP,sa as Ua,t as Pt,ta as ja,u as je,ua as Ba,v as tP,va as qa,w as rP,wa as za,x as nP,xa as Ha,y as oP,ya as Va,z as iP,za as Ka}from"./chunks/chunk-JPJNJHQW.js";import{I as ko,L as Tt,N as Et,Q as Lo,R as $o,S as At,U as GT,W as UT,Y as Go,a as R,b as YS,c as gt,da as fE,e as Mn,f as In,g as vn,ga as _E,h as kn,ha as hE,i as ve,j as Nn,k as N,l as ke,m as Ln,n as $n,o as Dn,p as Fn,q as Ao,r as xo,s as bo,t as wo,u as Oo,v as Ro,w as Po,x as Mo,y as Io,z as vo}from"./chunks/chunk-VCXQ6A35.js";import{_ as lE,a as po,b as lo,ba as Do,c as uo,ca as uE,da as Fo,fa as mE,h as mo,j as fo,k as _o,l as ho}from"./chunks/chunk-TE6FBDHP.js";import{A as ue,B as WS,C as S,E as so,F as St,G as me,H as ao,L as $e,N as co,b as jS,c as BS,d as qS,m as zS,r as HS,u as VS,y as KS}from"./chunks/chunk-K672XXGQ.js";import"./chunks/chunk-XAWE4EAK.js";var z="2026-07-28",or=["2025-11-25","2025-06-18"],te=[z],m={headerMismatch:-32020,missingRequiredClientCapability:-32021,unsupportedProtocolVersion:-32022,invalidParams:-32602},x={clientCapabilities:"io.modelcontextprotocol/clientCapabilities",clientInfo:"io.modelcontextprotocol/clientInfo",logLevel:"io.modelcontextprotocol/logLevel",protocolVersion:"io.modelcontextprotocol/protocolVersion",serverInfo:"io.modelcontextprotocol/serverInfo"},nr=["debug","info","notice","warning","error","critical","alert","emergency"],u=class extends Error{code;data;constructor(t,r,n={}){super(t),this.name="PmMcpProtocolError",this.code=r,this.data=n}};function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qg(e){if(e===void 0)return;if(!h(e))throw new u("Invalid MCP clientInfo metadata",m.invalidParams,{field:x.clientInfo,expected:"object"});let t=typeof e.name=="string"?e.name.trim():"",r=typeof e.version=="string"?e.version.trim():"";if(t.length===0||r.length===0)throw new u("Invalid MCP clientInfo metadata",m.invalidParams,{field:x.clientInfo,required:["name","version"]});let n={name:t.slice(0,128),version:r.slice(0,128)};return typeof e.description=="string"&&e.description.trim()&&(n.description=e.description.trim().slice(0,1024)),typeof e.websiteUrl=="string"&&e.websiteUrl.trim()&&(n.websiteUrl=e.websiteUrl.trim().slice(0,2048)),n}function zg(e){if(e!==void 0){if(typeof e!="string"||!nr.includes(e))throw new u("Invalid MCP logLevel metadata",m.invalidParams,{field:x.logLevel,allowed:[...nr]});return e}}function Ye(e){let t=h(e)?e._meta:void 0;if(!h(t))throw new u("Missing required MCP request metadata",m.invalidParams,{required:[x.protocolVersion,x.clientCapabilities]});let r=t[x.protocolVersion];if(typeof r!="string"||!te.includes(r))throw new u("Unsupported protocol version",m.unsupportedProtocolVersion,{supported:[...te],requested:typeof r=="string"?r:null});let n=t[x.clientCapabilities];if(!h(n))throw new u("Invalid MCP client capabilities metadata",m.invalidParams,{field:x.clientCapabilities,expected:"object"});let o=qg(t[x.clientInfo]),i=zg(t[x.logLevel]);return{protocolVersion:z,clientCapabilities:n,...o?{clientInfo:o}:{},...i?{logLevel:i}:{}}}function D0(e,t){if(t!==e.protocolVersion)throw new u("MCP protocol header does not match request metadata",m.headerMismatch,{header:t??null,metadata:e.protocolVersion})}function F0(e,t){let r=t.filter(n=>!Object.prototype.hasOwnProperty.call(e.clientCapabilities,n));if(r.length>0)throw new u("Missing required client capability",m.missingRequiredClientCapability,{requiredCapabilities:Object.fromEntries(r.map(n=>[n,{}]))})}function G0(e,t){let r=e.clientCapabilities.extensions;return h(r)&&h(r[t])}function Xe(e,t){let r=h(e._meta)?e._meta:{};return{...e,_meta:{...r,[x.serverInfo]:{...t}}}}function Hg(e,t){return Xe({...e,resultType:"complete"},t)}function U0(e){let t=e.ttlMs??6e4;if(!Number.isFinite(t)||t<0)throw new u("Invalid MCP discovery cache TTL",m.invalidParams,{ttlMs:t});return Hg({supportedVersions:[...te],capabilities:structuredClone(e.capabilities),ttlMs:t,cacheScope:"public",...e.instructions?{instructions:e.instructions}:{}},e.serverInfo)}function j0(e,t){if(h(e)&&typeof e.resultType=="string")return e.resultType;if(t==="legacy")return"complete";throw new u("Modern MCP result is missing resultType",m.invalidParams,{required:"resultType"})}var Vg=new Set(["--help","-h","--version","-V"]);function Kg(e,t){let n=[`Usage: ${e==="stdio"?"pm-mcp":"pm-mcp-http"} [--help | --version]`,"",e==="stdio"?"JSON-RPC over stdin/stdout. With no arguments, starts the stdio server.":"Streamable HTTP POST /mcp. With no arguments, starts the HTTP server.","","Options:"," -h, --help Print help and exit before transport startup."," -V, --version Print the package version and exit.","","Environment:"," PM_PATH Tracker root (otherwise discovered from cwd)."," PM_GLOBAL_PATH Global settings root."," PM_MCP_PROFILE core (default), standard, full, or custom."," PM_MCP_TOOLS Comma-separated tool allowlist for custom profile."," PM_MCP_DISCOVERY_CURSOR_KEY Shared discovery cursor secret, at least 32 UTF-8 bytes."," PM_MCP_BAGGAGE_ALLOWLIST Comma-separated permitted trace baggage keys."];return e==="http"&&n.push(" PM_MCP_HTTP_HOST Bind host (default 127.0.0.1)."," PM_MCP_HTTP_PORT Bind port, 0..65535 (default 3000)."," PM_MCP_HTTP_ALLOWED_ORIGINS Comma-separated exact browser origins (default none)."," PM_MCP_HTTP_BEARER_TOKEN Deployment token for the bundled verifier."," PM_MCP_HTTP_AUTH_ISSUER Exact HTTPS authorization-server issuer."," PM_MCP_HTTP_RESOURCE Canonical resource/audience URI."," PM_MCP_HTTP_SCOPES Space-separated scopes (default pm:read pm:write).","","Non-loopback HTTP requires bearer token, issuer, and resource together."),n.push("",`MCP protocol: ${te.join(", ")}.`,e==="stdio"?`Legacy initialize compatibility: ${or.join(", ")}.`:"HTTP requires modern per-request metadata; legacy initialize is stdio-only.","",e==="stdio"?"Client configuration:":"Example loopback server:",e==="stdio"?JSON.stringify({mcpServers:{pm:{command:"npx",args:["--yes","--package",`@unbrained/pm-cli@${t}`,"pm-mcp"]}}}):`PM_MCP_HTTP_PORT=3000 npx --yes --package @unbrained/pm-cli@${t} pm-mcp-http`,...e==="http"?["HTTP client configuration:",JSON.stringify({mcpServers:{pm:{url:"http://127.0.0.1:3000/mcp"}}})]:[],"","Configuration: https://github.com/unbraind/pm-cli/blob/main/docs/MCP_REMOTE_TRANSPORT_SECURITY.md",""),n.join(`
2
2
  `)}function z0(e,t,r){if(e.length===0)return{kind:"serve"};let n=e.find(i=>!Vg.has(i));if(n!==void 0){let i=t==="stdio"?"pm-mcp":"pm-mcp-http";return{kind:"exit",exitCode:64,stdout:"",stderr:`Unsupported argument ${JSON.stringify(n)}. Run ${i} --help.
3
3
  `}}return{kind:"exit",exitCode:0,stdout:e.includes("--help")||e.includes("-h")?Kg(t,r):`${r}
4
4
  `,stderr:""}}import{createHash as ar,createHmac as cr,timingSafeEqual as Wg}from"node:crypto";var Yg=["elicitation/create","roots/list","sampling/createMessage"],ir=class extends Error{inputRequests;requestState;constructor(t){super("MCP operation requires additional input"),this.name="PmMcpInputRequiredError",this.inputRequests=t.inputRequests,this.requestState=t.requestState}},dr=/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/u,he=32,Qe=64*1024,ge=16*1024,Je={maxBytes:256*1024,maxDepth:32,maxNodes:4096};function Xg(e){return e==="elicitation/create"?"elicitation":e==="sampling/createMessage"?"sampling":"roots"}function Ce(e,t,r){let n;try{n=JSON.stringify(e)}catch{throw new u(`Invalid ${r}: value is not JSON serializable`,m.invalidParams,{field:r})}if(Buffer.byteLength(n,"utf8")>t)throw new u(`Invalid ${r}: payload exceeds the protocol bound`,m.invalidParams,{field:r,maximumBytes:t})}function Ze(e,t){if(!h(e))throw new u("Invalid MCP inputRequests",m.invalidParams,{field:"inputRequests",expected:"object"});let r=Object.entries(e);if(r.length===0||r.length>he)throw new u("Invalid MCP inputRequests count",m.invalidParams,{minimum:1,maximum:he,observed:r.length});let n={};for(let[o,i]of r){if(!dr.test(o)||!h(i))throw new u("Invalid MCP input request entry",m.invalidParams,{field:`inputRequests.${o}`});let s=i.method;if(typeof s!="string"||!Yg.includes(s))throw new u("Unsupported MCP input request method",m.invalidParams,{field:`inputRequests.${o}.method`,method:s??null});let a=Xg(s);if(!Object.prototype.hasOwnProperty.call(t.clientCapabilities,a))throw new u("Missing required client capability",m.missingRequiredClientCapability,{requiredCapabilities:{[a]:{}}});if(!h(i.params))throw new u("Invalid MCP input request parameters",m.invalidParams,{field:`inputRequests.${o}.params`,expected:"object"});n[o]={method:s,params:structuredClone(i.params)}}return Ce(n,Qe,"inputRequests"),n}function pr(e){if(!h(e))throw new u("Invalid MCP inputResponses",m.invalidParams,{field:"inputResponses",expected:"object"});let t=Object.entries(e);if(t.length>he)throw new u("Invalid MCP inputResponses count",m.invalidParams,{maximum:he,observed:t.length});let r={};for(let[n,o]of t){if(!dr.test(n)||!h(o))throw new u("Invalid MCP input response entry",m.invalidParams,{field:`inputResponses.${n}`});r[n]=structuredClone(o)}return Ce(r,Qe,"inputResponses"),r}function W0(e){let t=e.requestState?.trim();if(t&&Buffer.byteLength(t,"utf8")>ge)throw new u("Invalid MCP requestState: payload exceeds the protocol bound",m.invalidParams,{field:"requestState",maximumBytes:ge});let r=e.inputRequests===void 0?void 0:Ze(e.inputRequests,e.requestContext);if(r===void 0&&!t)throw new u("InputRequiredResult requires inputRequests or requestState",m.invalidParams,{requiredAnyOf:["inputRequests","requestState"]});return{resultType:"input_required",...r?{inputRequests:r}:{},...t?{requestState:t}:{},_meta:{[x.serverInfo]:{...e.serverInfo}}}}function lr(e){let t=Buffer.from(e);if(t.byteLength<32)throw new u("MCP requestState signing key must contain at least 32 bytes",m.invalidParams,{minimumBytes:32});return t}function Y0(e,t){if(!Number.isSafeInteger(e.expiresAt)||e.expiresAt<=0||e.method.trim().length===0||e.parameterDigest.trim().length===0||e.principal.trim().length===0)throw new u("Invalid MCP requestState payload",m.invalidParams);let r=Buffer.from(JSON.stringify({version:1,...e}),"utf8");if(r.byteLength>ge/2)throw new u("MCP requestState payload exceeds the protocol bound",m.invalidParams,{maximumBytes:ge/2});let n=r.toString("base64url"),o=cr("sha256",lr(t)).update(n).digest("base64url");return`${n}.${o}`}function Jg(e){if(!h(e)||e.version!==1)throw new u("Invalid MCP requestState payload",m.invalidParams,{field:"requestState"});let{expiresAt:t,method:r,parameterDigest:n,principal:o,state:i}=e;if(typeof t!="number"||!Number.isSafeInteger(t))throw new u("Invalid MCP requestState payload",m.invalidParams,{field:"requestState"});if(typeof r!="string"||typeof n!="string"||typeof o!="string")throw new u("Invalid MCP requestState payload",m.invalidParams,{field:"requestState"});return{expiresAt:t,method:r,parameterDigest:n,principal:o,state:i}}function X0(e,t,r){let[n,o,i]=e.split(".");if(!n||!o||i!==void 0)throw new u("Invalid MCP requestState encoding",m.invalidParams,{field:"requestState"});let s=Buffer.from(o,"base64url"),a=cr("sha256",lr(t)).update(n).digest();if(s.byteLength!==a.byteLength||!Wg(s,a))throw new u("Invalid MCP requestState signature",m.invalidParams,{field:"requestState"});let c;try{c=JSON.parse(Buffer.from(n,"base64url").toString("utf8"))}catch{c=null}let d=Jg(c),{expiresAt:p,method:l,parameterDigest:f,principal:g}=d;if(p<(r.nowMs??Date.now()))throw new u("Expired MCP requestState",m.invalidParams,{field:"requestState",expiredAt:p});if(l!==r.method||f!==r.parameterDigest||g!==r.principal)throw new u("MCP requestState binding mismatch",m.invalidParams,{field:"requestState"});return d}function J0(e){return Ce(e,Qe,"request parameters"),ar("sha256").update(JSON.stringify(e)).digest("hex")}var sr=class{#e=new Set;#t;constructor(t=4096){if(!Number.isSafeInteger(t)||t<1)throw new u("Invalid MCP replay guard capacity",m.invalidParams,{maximumEntries:t});this.#t=t}consume(t){let r=ar("sha256").update(t).digest("hex");if(this.#e.has(r))throw new u("MCP requestState replay detected",m.invalidParams,{field:"requestState"});if(this.#e.size>=this.#t){let n=this.#e.values().next().value;this.#e.delete(n)}this.#e.add(r)}};function Qg(e){if(!Number.isSafeInteger(e.ttlMs)||e.ttlMs<0||e.cacheScope!=="public"&&e.cacheScope!=="private")throw new u("Invalid MCP cache policy",m.invalidParams,{ttlMs:e.ttlMs,cacheScope:e.cacheScope});return{ttlMs:e.ttlMs,cacheScope:e.cacheScope}}function Q0(e,t){return{...e,...Qg(t)}}function Zg(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function eC(e,t){if(t==="#")return e;if(!t.startsWith("#/"))return;let r=e;for(let n of t.slice(2).split("/").map(Zg)){if(!h(r)&&!Array.isArray(r)||!Object.prototype.hasOwnProperty.call(r,n))return;r=r[n]}return r}function tC(e){let t=e.maxBytes??Je.maxBytes,r=e.maxDepth??Je.maxDepth,n=e.maxNodes??Je.maxNodes;if(!Number.isSafeInteger(t)||t<2)throw new u("Invalid MCP JSON Schema work bounds",m.invalidParams);if(!Number.isSafeInteger(r)||r<1)throw new u("Invalid MCP JSON Schema work bounds",m.invalidParams);if(!Number.isSafeInteger(n)||n<1)throw new u("Invalid MCP JSON Schema work bounds",m.invalidParams);return{maximumBytes:t,maximumDepth:r,maximumNodes:n}}function rC(e,t){let r=Array.isArray(e.value)?e.value:h(e.value)?Object.values(e.value):[];for(let n of r)t.push({value:n,depth:e.depth+1})}function nC(e,t){if(!h(t)||typeof t.$ref!="string")return;let r=t.$ref;if(r.startsWith("#")&&eC(e,r)===void 0)throw new u("MCP JSON Schema contains an unresolved local reference",m.invalidParams,{reference:r})}function Z0(e,t={}){let{maximumBytes:r,maximumDepth:n,maximumNodes:o}=tC(t);if(typeof e!="boolean"&&!h(e))throw new u("Invalid MCP JSON Schema root",m.invalidParams,{expected:"object or boolean"});Ce(e,r,"JSON Schema");let i=[{value:e,depth:0}],s=0;for(;i.length>0;){let a=i.pop();if(s+=1,s>o||a.depth>n)throw new u("MCP JSON Schema exceeds validation work bounds",m.invalidParams,{maximumDepth:n,maximumNodes:o});nC(e,a.value),rC(a,i)}return structuredClone(e)}import{randomUUID as oC}from"node:crypto";import{readFile as iC}from"node:fs/promises";import ur from"node:path";var aL="io.modelcontextprotocol/tasks",sC=["working","input_required","completed","failed","cancelled"],aC=/^mcp-task-[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,cC=3600*1e3,dC=1e3,Se=1024,pC=30,lC=2e3;function et(e){return new u(e,m.invalidParams,{code:"mcp_task_not_found_or_not_authorized"})}function ye(e){let t=e.trim();if(!aC.test(t))throw et("Unknown MCP task");return t}function mr(e,t){if(typeof e!="string"||!Number.isFinite(Date.parse(e)))throw new u("Corrupt MCP task record",m.invalidParams,{field:t});return e}function fr(e){if(!h(e)||typeof e.code!="number"||!Number.isFinite(e.code)||typeof e.message!="string")throw new u("Corrupt MCP task error",m.invalidParams);return{code:e.code,message:e.message.slice(0,Se),...h(e.data)?{data:structuredClone(e.data)}:{}}}function uC(e){if(!sC.includes(e))throw new u("Corrupt MCP task record",m.invalidParams);return e}function mC(e){if(typeof e!="string"||e.length===0)throw new u("Corrupt MCP task record",m.invalidParams);return e}function fC(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<1)throw new u("Corrupt MCP task record",m.invalidParams);return e}function _C(e){if(e!==null&&(typeof e!="number"||!Number.isSafeInteger(e)||e<0))throw new u("Corrupt MCP task record",m.invalidParams);return e}function hC(e){if(e!==void 0){if(typeof e!="number"||!Number.isSafeInteger(e)||e<0)throw new u("Corrupt MCP task record",m.invalidParams);return e}}function gC(e){if(!Array.isArray(e)||e.some(t=>typeof t!="string"))throw new u("Corrupt MCP task record",m.invalidParams);return[...e]}function CC(e){if(!h(e)||e.version!==1)throw new u("Corrupt MCP task record",m.invalidParams);let t=typeof e.taskId=="string"?ye(e.taskId):"",r=uC(e.status),n=mC(e.principal),o=fC(e.workerPid),i=_C(e.ttlMs),s=hC(e.pollIntervalMs),a={version:1,taskId:t,status:r,principal:n,workerPid:o,createdAt:mr(e.createdAt,"createdAt"),lastUpdatedAt:mr(e.lastUpdatedAt,"lastUpdatedAt"),ttlMs:i,consumedInputKeys:gC(e.consumedInputKeys),...typeof e.statusMessage=="string"?{statusMessage:e.statusMessage.slice(0,Se)}:{},...typeof s=="number"?{pollIntervalMs:s}:{}};if(h(e.inputRequests)&&(a.inputRequests=structuredClone(e.inputRequests)),h(e.inputResponses)&&(a.inputResponses=structuredClone(e.inputResponses)),h(e.result)&&(a.result=structuredClone(e.result)),e.error!==void 0&&(a.error=fr(e.error)),a.status==="input_required"&&!a.inputRequests||a.status==="completed"&&!a.result||a.status==="failed"&&!a.error)throw new u("Corrupt MCP task status payload",m.invalidParams,{status:a.status});return a}function H(e){let t={taskId:e.taskId,status:e.status,createdAt:e.createdAt,lastUpdatedAt:e.lastUpdatedAt,ttlMs:e.ttlMs,...e.statusMessage?{statusMessage:e.statusMessage}:{},...e.pollIntervalMs===void 0?{}:{pollIntervalMs:e.pollIntervalMs}};return e.status==="input_required"?{...t,status:"input_required",inputRequests:structuredClone(e.inputRequests)}:e.status==="completed"?{...t,status:"completed",result:structuredClone(e.result)}:e.status==="failed"?{...t,status:"failed",error:structuredClone(e.error)}:e.status==="cancelled"?{...t,status:"cancelled"}:{...t,status:"working"}}function re(e){return e==="completed"||e==="failed"||e==="cancelled"}function yC(e){try{return process.kill(e,0),!0}catch(t){return!(typeof t=="object"&&t!==null&&"code"in t&&t.code==="ESRCH")}}var tt=class{#e;#t;#r;#n;#i;constructor(t){this.#e=ur.resolve(t.pmRoot),this.#t=t.owner?.trim()||"pm-mcp",this.#r=t.now??(()=>new Date),this.#n=t.taskIdFactory??(()=>`mcp-task-${oC()}`),this.#i=t.workerPid??process.pid}#s(t){return ur.join(this.#e,"runtime","mcp-tasks","records",`${ye(t)}.json`)}async#c(t){try{return CC(JSON.parse(await iC(this.#s(t),"utf8")))}catch(r){throw me(r)||r instanceof SyntaxError?et("Unknown MCP task"):r}}async#a(t){await $e(this.#s(t.taskId),`${JSON.stringify(t,null,2)}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Implements extension runtime contracts and governance for Item Fields.
5
5
  */
6
- import type{ExtensionRegistrationRegistry}from "./loader.js";import{type PmCliErrorContext}from "../shared/errors.js";
6
+ import type{ExtensionRegistrationRegistry}from "./loader.js";import{type KnownItemFieldType}from "./item-field-types.js";import{type PmCliErrorContext}from "../shared/errors.js";
7
7
  /** Item metadata keys extension-provided fields may never shadow, exposed without mutation methods. */
8
8
  export declare const RESERVED_ITEM_FIELD_NAMES:ReadonlySet<string>;
9
9
  /**
@@ -13,6 +13,23 @@ export declare const RESERVED_ITEM_FIELD_NAMES:ReadonlySet<string>;
13
13
  * health carry this warning, which names the package, the field and a rename.
14
14
  */
15
15
  export declare function formatReservedItemFieldWarning(layer:string,extension:string,field:string):string;
16
+ /** An admitted item field declaration, as activation and the write path read it. */
17
+ export interface ItemFieldDeclaration{
18
+ /** Layer of the package that declared the field. */
19
+ layer:string;
20
+ /** Package that declared the field. */
21
+ name:string;
22
+ /** The declared field type. */
23
+ type:KnownItemFieldType;}
24
+ /**
25
+ * The admitted declaration that gives a field another type, judged with the
26
+ * write path's own name and type rules (pm-2ze9nt). Activation keeps the first
27
+ * declaration and drops a later one with another type, so two packages that
28
+ * disagree on one field no longer stop every create and update.
29
+ */
30
+ export declare function findConflictingItemFieldDeclaration(registrations:ExtensionRegistrationRegistry["item_fields"],field:{name?:unknown;type?:unknown;}):ItemFieldDeclaration|undefined;
31
+ /** Activation warning for a dropped declaration: the field, both packages and both types (pm-2ze9nt). */
32
+ export declare function formatItemFieldTypeConflictWarning(layer:string,extension:string,field:{name?:unknown;type?:unknown;},kept:ItemFieldDeclaration):string;
16
33
  /** Implements collect registered item field names for the public runtime surface of this module. */
17
34
  export declare function collectRegisteredItemFieldNames(registrations:ExtensionRegistrationRegistry|null):string[];
18
35
  /**
@@ -1,2 +1,2 @@
1
- import{normalizeItemFieldType as _}from"./item-field-types.js";import{EXIT_CODE as l,ITEM_METADATA_KEY_ORDER as A}from"../shared/constants.js";import{PmCliError as f}from"../shared/errors.js";const c=new Set(A),u=Object.freeze({get size(){return c.size},has(e){return c.has(e)},entries(){return c.entries()},keys(){return c.keys()},values(){return c.values()},forEach(e,t){c.forEach(n=>e.call(t,n,n,u))},[Symbol.iterator](){return c.values()}});function h(e){if(typeof e!="string")return null;const t=e.trim();return t.length>0?t:null}function g(e){return typeof e!="string"?null:_(e)}function w(e){try{return structuredClone(e)}catch{return e}}function E(e){const t=e.trim(),n=t.indexOf("=");if(n<=0)throw new f(`--field entries must use name=value syntax, received: ${e}`,l.USAGE);const r=t.slice(0,n).trim(),i=t.slice(n+1);return{key:r,value:i}}function b(e,t,n){try{const r=JSON.parse(e);if(n==="array"&&Array.isArray(r)||n==="object"&&typeof r=="object"&&r!==null&&!Array.isArray(r))return r}catch{}throw new f(`--field ${t}=... must be valid JSON ${n}`,l.USAGE)}function x(e,t,n){if(t==="string")return n;if(t==="number"){const r=n.trim();if(r.length===0)throw new f(`--field ${e}=... must be a number`,l.USAGE);const i=Number(r);if(!Number.isFinite(i))throw new f(`--field ${e}=... must be a number`,l.USAGE);return i}if(t==="boolean"){const r=n.trim().toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1;throw new f(`--field ${e}=... must be one of true|false|1|0|yes|no`,l.USAGE)}return t==="string_array"?n.split(/[\n,|]/u).map(r=>r.trim()).filter(r=>r.length>0):b(n,e,t)}function p(e){const t=new Map;if(!e)return t;for(const n of e.item_fields)for(const r of n.fields){const i=h(r.name),o=g(r.type);if(!i||!o)continue;const s=t.get(i);if(s&&s.type!==o)throw new f(`Extension item field "${i}" is declared with conflicting types: ${s.type}, ${o}`,l.USAGE,{code:"extension_item_field_type_conflict",nextSteps:["Make every active extension declaration for this field use the same type."]});t.set(i,{name:i,type:o})}return t}function y(e){if(u.has(e))throw new f(`Extension item field "${e}" collides with built-in item metadata "${e}"; rename the extension field with an extension-specific prefix. Reserved fields: ${[...u].sort((t,n)=>t.localeCompare(n)).join(", ")}.`,l.USAGE,{code:"extension_item_field_reserved",nextSteps:["Rename the extension item field, preferably with an extension-specific prefix."]})}function G(e,t,n){const r=t.replace(/^@[^/]+\//u,"").replaceAll(/[^A-Za-z0-9]+/gu,"_").toLowerCase();return`extension_item_field_reserved:${e}:${t}:${n}:rename=${r}_${n}`}function j(e){return[...p(e).keys()].sort((t,n)=>t.localeCompare(n))}function z(e,t,n,r){if(!e||e.length===0)return{};const i=p(t),o={};for(const s of e){const{key:a,value:m}=E(s),d=i.get(a);if(!d)throw $(a,i,n,r);y(d.name),o[d.name]=x(d.name,d.type,m)}return o}function $(e,t,n,r){if(u.has(e)){const s=n?.(e)??{recovery:{provided_fields:[e]},nextSteps:["Core metadata has no generic --field mutation path. Use the owning lifecycle, evidence, or importer API; inspect pm update <id> --help for declared mutation flags."]};return new f(`--field ${e} is a core item field, not an extension field`,l.USAGE,{code:"core_item_field_requires_dedicated_flag",field:e,...s})}const i=r?.(e);if(i!==void 0){const s=i.recovery?.suggested_flags?.[0];return new f(s===void 0?`--field ${e} is a project-schema field, not an extension field`:`--field ${e} is a project-schema field; set it with its declared flag ${s}`,l.USAGE,{code:"project_schema_field_requires_declared_flag",field:e,changed:!1,...i})}const o=[...t.keys()].sort((s,a)=>s.localeCompare(a));return new f(`--field ${e} is not declared by an active extension item-field registration`,l.USAGE,{code:"extension_item_field_unknown",field:e,recovery:{provided_fields:[e]},nextSteps:o.length>0?[`Use one of the declared fields: ${o.join(", ")}`]:["Activate an extension that calls registerItemFields before setting extension fields."]})}function F(e,t){return t==="string"?typeof e=="string":t==="number"?typeof e=="number"&&Number.isFinite(e):t==="boolean"?typeof e=="boolean":t==="array"?Array.isArray(e):t==="string_array"?Array.isArray(e)&&e.every(n=>typeof n=="string"):typeof e=="object"&&e!==null&&!Array.isArray(e)}function S(e,t){return!t||t.length===0?!0:t.some(n=>Object.is(n,e))}function I(e,t,n={}){if(t){p(t);for(const r of t.item_fields)for(const i of r.fields){const o=h(i.name);if(!o)continue;y(o),!(o in e)&&!n.skipDefaultFields?.has(o)&&Object.prototype.hasOwnProperty.call(i,"default")&&(e[o]=w(i.default));const s=e[o];if(s===void 0)continue;const a=g(i.type);if(a&&!F(s,a))throw new TypeError(`Item field "${o}" must be of type ${a}`);const m=Array.isArray(i.values)?i.values:void 0;if(!S(s,m))throw new TypeError(`Item field "${o}" must match one of the configured allowed values`)}}}function C(e,t,n={}){try{I(e,t,n)}catch(r){throw r instanceof f?r:new f(r.message,l.USAGE)}}export{u as RESERVED_ITEM_FIELD_NAMES,I as applyRegisteredItemFieldDefaultsAndValidation,C as applyRegisteredItemFieldDefaultsForWrite,j as collectRegisteredItemFieldNames,G as formatReservedItemFieldWarning,z as parseRegisteredItemFieldAssignments};
1
+ import{normalizeItemFieldType as _}from"./item-field-types.js";import{EXIT_CODE as l,ITEM_METADATA_KEY_ORDER as A}from"../shared/constants.js";import{PmCliError as f}from"../shared/errors.js";const c=new Set(A),p=Object.freeze({get size(){return c.size},has(e){return c.has(e)},entries(){return c.entries()},keys(){return c.keys()},values(){return c.values()},forEach(e,t){c.forEach(r=>e.call(t,r,r,p))},[Symbol.iterator](){return c.values()}});function u(e){if(typeof e!="string")return null;const t=e.trim();return t.length>0?t:null}function m(e){return typeof e!="string"?null:_(e)}function w(e){try{return structuredClone(e)}catch{return e}}function $(e){const t=e.trim(),r=t.indexOf("=");if(r<=0)throw new f(`--field entries must use name=value syntax, received: ${e}`,l.USAGE);const n=t.slice(0,r).trim(),i=t.slice(r+1);return{key:n,value:i}}function x(e,t,r){try{const n=JSON.parse(e);if(r==="array"&&Array.isArray(n)||r==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n}catch{}throw new f(`--field ${t}=... must be valid JSON ${r}`,l.USAGE)}function E(e,t,r){if(t==="string")return r;if(t==="number"){const n=r.trim();if(n.length===0)throw new f(`--field ${e}=... must be a number`,l.USAGE);const i=Number(n);if(!Number.isFinite(i))throw new f(`--field ${e}=... must be a number`,l.USAGE);return i}if(t==="boolean"){const n=r.trim().toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no")return!1;throw new f(`--field ${e}=... must be one of true|false|1|0|yes|no`,l.USAGE)}return t==="string_array"?r.split(/[\n,|]/u).map(n=>n.trim()).filter(n=>n.length>0):x(r,e,t)}function h(e){const t=new Map;if(!e)return t;for(const r of e.item_fields)for(const n of r.fields){const i=u(n.name),o=m(n.type);if(!i||!o)continue;const s=t.get(i);if(s&&s.type!==o)throw new f(`Extension item field "${i}" is declared with conflicting types: ${s.type}, ${o}`,l.USAGE,{code:"extension_item_field_type_conflict",nextSteps:["Make every active extension declaration for this field use the same type."]});t.set(i,{name:i,type:o})}return t}function g(e){if(p.has(e))throw new f(`Extension item field "${e}" collides with built-in item metadata "${e}"; rename the extension field with an extension-specific prefix. Reserved fields: ${[...p].sort((t,r)=>t.localeCompare(r)).join(", ")}.`,l.USAGE,{code:"extension_item_field_reserved",nextSteps:["Rename the extension item field, preferably with an extension-specific prefix."]})}function G(e,t,r){const n=t.replace(/^@[^/]+\//u,"").replaceAll(/[^A-Za-z0-9]+/gu,"_").toLowerCase();return`extension_item_field_reserved:${e}:${t}:${r}:rename=${n}_${r}`}function j(e,t){const r=u(t.name),n=m(t.type);if(!(!r||!n))for(const i of e)for(const o of i.fields){const s=m(o.type);if(!(u(o.name)!==r||!s))return s===n?void 0:{layer:i.layer,name:i.name,type:s}}}function C(e,t,r,n){return`extension_item_field_type_conflict:${e}:${t}:${u(r.name)}:${m(r.type)}:kept=${n.layer}:${n.name}:${n.type}`}function D(e){return[...h(e).keys()].sort((t,r)=>t.localeCompare(r))}function z(e,t,r,n){if(!e||e.length===0)return{};const i=h(t),o={};for(const s of e){const{key:a,value:y}=$(s),d=i.get(a);if(!d)throw b(a,i,r,n);g(d.name),o[d.name]=E(d.name,d.type,y)}return o}function b(e,t,r,n){if(p.has(e)){const s=r?.(e)??{recovery:{provided_fields:[e]},nextSteps:["Core metadata has no generic --field mutation path. Use the owning lifecycle, evidence, or importer API; inspect pm update <id> --help for declared mutation flags."]};return new f(`--field ${e} is a core item field, not an extension field`,l.USAGE,{code:"core_item_field_requires_dedicated_flag",field:e,...s})}const i=n?.(e);if(i!==void 0){const s=i.recovery?.suggested_flags?.[0];return new f(s===void 0?`--field ${e} is a project-schema field, not an extension field`:`--field ${e} is a project-schema field; set it with its declared flag ${s}`,l.USAGE,{code:"project_schema_field_requires_declared_flag",field:e,changed:!1,...i})}const o=[...t.keys()].sort((s,a)=>s.localeCompare(a));return new f(`--field ${e} is not declared by an active extension item-field registration`,l.USAGE,{code:"extension_item_field_unknown",field:e,recovery:{provided_fields:[e]},nextSteps:o.length>0?[`Use one of the declared fields: ${o.join(", ")}`]:["Activate an extension that calls registerItemFields before setting extension fields."]})}function F(e,t){return t==="string"?typeof e=="string":t==="number"?typeof e=="number"&&Number.isFinite(e):t==="boolean"?typeof e=="boolean":t==="array"?Array.isArray(e):t==="string_array"?Array.isArray(e)&&e.every(r=>typeof r=="string"):typeof e=="object"&&e!==null&&!Array.isArray(e)}function S(e,t){return!t||t.length===0?!0:t.some(r=>Object.is(r,e))}function I(e,t,r={}){if(t){h(t);for(const n of t.item_fields)for(const i of n.fields){const o=u(i.name);if(!o)continue;g(o),!(o in e)&&!r.skipDefaultFields?.has(o)&&Object.prototype.hasOwnProperty.call(i,"default")&&(e[o]=w(i.default));const s=e[o];if(s===void 0)continue;const a=m(i.type);if(a&&!F(s,a))throw new TypeError(`Item field "${o}" must be of type ${a}`);const y=Array.isArray(i.values)?i.values:void 0;if(!S(s,y))throw new TypeError(`Item field "${o}" must match one of the configured allowed values`)}}}function N(e,t,r={}){try{I(e,t,r)}catch(n){throw n instanceof f?n:new f(n.message,l.USAGE)}}export{p as RESERVED_ITEM_FIELD_NAMES,I as applyRegisteredItemFieldDefaultsAndValidation,N as applyRegisteredItemFieldDefaultsForWrite,D as collectRegisteredItemFieldNames,j as findConflictingItemFieldDeclaration,C as formatItemFieldTypeConflictWarning,G as formatReservedItemFieldWarning,z as parseRegisteredItemFieldAssignments};
2
2
  //# sourceMappingURL=item-fields.js.map
@@ -1,2 +1,2 @@
1
- import w from"node:fs/promises";import x from"node:path";import{pathToFileURL as xe}from"node:url";import{createRelationshipKindRegistry as Ee}from"../../sdk/relationships.js";import{pathExists as H}from"../fs/fs-utils.js";import{isPathWithinDirectory as L}from"../fs/path-utils.js";import{isHostOutputSuppressed as be,suppressHostOutput as Ce}from"../output/output-control.js";import{resolvePmPackageRootFromModule as Re}from"../packages/root.js";import{asRecordLoose as B,resolveActivatablePropertyRecord as ke}from"../shared/primitives.js";import{resolveGlobalPmRoot as $e}from"../store/paths.js";import{captureExtensionActivationRollback as Pe}from"./activation-transaction.js";import{assertCommandDefinitionMetadataStrings as Se}from"./command-visibility-tier.js";import{normalizeExtensionReadOutput as Ie}from"./read-output-contract.js";import{normalizeExtensionContributionInventory as Me}from"./contribution-inventory.js";import{buildImportExportContext as U,resolveImportExportArtifactOutput as Ae}from"./exporter-output-contract.js";import{buildReadyExtensionCandidate as Te}from"./extension-candidate.js";import{collectUnknownExtensionCapabilities as De,formatLegacyExtensionCapabilityAliasWarning as Fe,formatUnknownExtensionCapabilityWarning as Oe,isKnownExtensionCapability as ze,normalizeNames as K}from"./extension-capability-aliases.js";import{evaluateExtensionPolicyForCapability as We,evaluateExtensionPolicyForExtension as Ne,evaluateExtensionPolicyForRegistration as je,hydrateExtensionPolicy as Ve,normalizeExtensionPolicy as qe,serializeExtensionPolicy as He}from"./extension-policy.js";import{createEmptyExtensionCommandRegistry as Le,createEmptyExtensionHookRegistry as Be,createEmptyExtensionParserRegistry as Ue,createEmptyExtensionPreflightRegistry as Ke,createEmptyExtensionRegistrationRegistry as Xe,createEmptyExtensionRendererRegistry as Ge,createEmptyExtensionServiceRegistry as Je}from"./extension-registries.js";import{normalizeCommandName as b}from"./extension-runtime-helpers.js";import{KNOWN_EXTENSION_CAPABILITIES as Ye,KNOWN_EXTENSION_SERVICE_NAMES as Qe,createDefaultExtensionGovernancePolicy as Ze}from"./extension-types.js";import{formatReservedItemFieldWarning as er,RESERVED_ITEM_FIELD_NAMES as rr}from"./item-fields.js";import{parseExtensionManifestDocument as X}from"./manifest-parser.js";import{formatExtensionManifestSchemaWarnings as tr}from"./manifest-schema.js";import{snapshotExtensionModuleGraph as nr}from"./module-graph-snapshot.js";import{collectPreflightCollisionWarnings as ir,normalizePreflightOverride as sr}from"./preflight-ownership.js";import{applyProjectProfileDefaults as or,assertFlagValueTypeAndDefault as ar,normalizeCommandDefinitionArguments as T,normalizeFlagDefinitions as D,resolveCommandDefinitionAction as F,validateFlagDefinitions as O,validateItemFieldDefinitions as G,validateItemTypeDefinitions as mr,validateMigrationDefinition as cr,validateProjectProfileDefinition as lr}from"./registration-contracts.js";import{assertOptionalStringField as $,normalizeOptionalStringArrayField as C}from"./registration-validation.js";import{assertHookHandler as E,assertNonEmptyRegistrationString as P,assertRegistrationFunction as S,attachRuntimeDefinition as I,cloneRuntimeRegistrationValue as dr,createRegistrationValidationError as y,extractRegistrationValidationTrace as J,isExtensionServiceName as ur,isOutputRendererFormat as hr,normalizeRegistrationName as Y,normalizeRegistrationRecord as R,normalizeRegistrationRecordList as z,normalizeRuntimeRegistrationRecord as k,sanitizeRegistrationValue as Q,toRegistrationCommandPath as Z,validateAssuranceMeasurementProviderDefinition as pr}from"./registration-values.js";import{normalizeServiceOverrideOwnership as fr}from"./service-ownership.js";import{compareComparableVersions as gr,evaluatePmMaxVersionBound as yr,evaluatePmMinVersionBound as _r,parseComparableVersion as vr}from"./version-compat.js";import{parseLegacyExtensionCapabilityAliasWarning as bt,parseUnknownExtensionCapabilityWarning as Ct}from"./extension-capability-aliases.js";import{createEmptyExtensionCommandRegistry as kt,createEmptyExtensionHookRegistry as $t,createEmptyExtensionParserRegistry as Pt,createEmptyExtensionPreflightRegistry as St,createEmptyExtensionRegistrationRegistry as It,createEmptyExtensionRendererRegistry as Mt,createEmptyExtensionServiceRegistry as At}from"./extension-registries.js";import{runAfterCommandHooks as Dt,runBeforeCommandHooks as Ft,runBeforeMutationHooks as Ot,runCommandHandler as zt,runCommandOverride as Wt,runOnIndexHooks as Nt,runOnReadHooks as jt,runOnWriteHooks as Vt,runParserOverride as qt,runPreflightOverride as Ht,runRendererOverride as Lt,runServiceOverride as Bt,runServiceOverrideSync as Ut}from"./extension-hook-runtime.js";export*from"./extension-types.js";import{DEFAULT_EXTENSION_PRIORITY as Gt,parseExtensionManifestDocument as Jt}from"./manifest-parser.js";let W=null;const wr=Object.freeze(Ze());let ee=0;function xr(r=Date.now()){return ee+=1,`${ee}-${r}`}function Er(r,e,t){return t.has(r)?!1:e.size===0?!0:e.has(r)}async function br(r,e){const[t,n]=await Promise.all([w.realpath(r),w.realpath(e)]);return L(t,n)}function Cr(r,e=process.cwd()){return{global:x.join($e(e),"extensions"),project:x.join(r,"extensions")}}async function Rr(r){try{return(await w.readdir(r,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,n)=>t.localeCompare(n))}catch{return[]}}function kr(r){const e={layer:r.layer,directory:r.directory,manifest_path:r.manifest_path,name:r.manifest.name,version:r.manifest.version,entry:r.manifest.entry,priority:r.manifest.priority,entry_path:r.entry_path,manifest_version:r.manifest.manifest_version,pm_min_version:r.manifest.pm_min_version,pm_max_version:r.manifest.pm_max_version,engines:r.manifest.engines,trusted:r.manifest.trusted,provenance:r.manifest.provenance,sandbox_profile:r.manifest.sandbox_profile,permissions:r.manifest.permissions,capabilities:[...r.manifest.capabilities],activation:r.manifest.activation?{commands:[...r.manifest.activation.commands]}:void 0,contributions:r.manifest.contributions??r.contributions};return r.source_package&&(e.source_package=r.source_package),r.source_aliases&&(e.source_aliases=[...r.source_aliases]),e}function re(r){return typeof r=="string"&&r.trim().length>0?r.trim():void 0}async function te(r){const e=new Map;try{const t=JSON.parse(await w.readFile(x.join(r,".managed-extensions.json"),"utf8")),i=B(t)?.entries;if(!Array.isArray(i))return e;for(const o of i){if(typeof o!="object"||o===null)continue;const s=o,a=re(s.source?.package),m=[s.source?.input,s.source?.name,a].map(d=>re(d)).filter(d=>d!==void 0),c=Me(s.contributions),l={aliases:[...new Set(m)],...a?{package_name:a}:{},...c?{contributions:c}:{}};typeof s.directory=="string"&&s.directory.trim().length>0&&e.set(`directory:${s.directory.trim()}`,l),typeof s.name=="string"&&s.name.trim().length>0&&e.set(`name:${s.name.trim()}`,l)}}catch{return e}return e}function ne(r){return[...r].sort((e,t)=>{if(e.manifest.priority!==t.manifest.priority)return e.manifest.priority-t.manifest.priority;const n=e.manifest.name.localeCompare(t.manifest.name);return n!==0?n:e.directory.localeCompare(t.directory)})}function $r(r,e){const t=[...ne(r),...ne(e)],n=[];for(const i of t){const o=n.findIndex(s=>s.manifest.name===i.manifest.name);o>=0&&n.splice(o,1),n.push(i)}return n}async function ie(r,e,t,n,i){const o=[],s=[],a=[],m=await Rr(e),c=await te(e);for(const l of m){const d=await Ir(r,e,l,t,n,c,i);o.push(d.diagnostic),s.push(...d.warnings),d.candidate&&a.push(d.candidate)}return{diagnostics:o,warnings:s,candidates:a}}function Pr(){return{diagnostics:[],warnings:[],candidates:[]}}function se(r,e,t,n){return{diagnostic:{layer:r,directory:e,manifest_path:t,name:null,version:null,entry:null,priority:null,entry_path:null,enabled:null,status:"warn"},warnings:[n],candidate:null}}function Sr(r,e,t,n,i,o,s,a){const m=tr(r,e,t);Array.isArray(e.legacy_capability_aliases)&&e.legacy_capability_aliases.length>0&&m.push(Fe(r,e.name,e.legacy_capability_aliases));for(const c of De(e.capabilities))m.push(Oe(r,e.name,c));return n?i||m.push(`extension_entry_missing:${r}:${e.name}`):m.push(`extension_entry_outside_extension:${r}:${e.name}`),o.warning&&m.push(a?o.warning:o.warning.replace("extension_pm_","extension_disabled_pm_")),s.warning&&m.push(a?s.warning:s.warning.replace("extension_pm_","extension_disabled_pm_")),m}async function Ir(r,e,t,n,i,o,s){const a=x.join(e,t),m=x.join(a,"manifest.json");if(!await H(m))return se(r,t,m,`extension_manifest_missing:${r}:${t}`);let c,l;try{const q=JSON.parse(await w.readFile(m,"utf8"));l=B(q),c=X(q)}catch{l=null,c=null}if(!c||!l)return se(r,t,m,`extension_manifest_invalid:${r}:${t}`);const d=x.resolve(a,c.entry),h=L(a,d),u=h?await H(d):!1,f=h&&u?await br(a,d):h,g=Er(c.name,n,i),v=await me(r,c),_=await ce(r,c,s),A=Sr(r,c,l,f,u,v,_,g),V=f&&u&&v.allowed&&_.allowed,we=o.get(`directory:${t}`)??o.get(`name:${c.name}`);return{diagnostic:{layer:r,directory:t,manifest_path:m,name:c.name,version:c.version,entry:c.entry,priority:c.priority,entry_path:d,enabled:g,status:V?"ok":"warn"},warnings:A,candidate:Te({layer:r,directory:t,manifestPath:m,entryPath:d,manifest:c,sourceIdentity:we,extensionReady:V,enabledForLoad:g})}}async function Mr(r){const e=Cr(r.pmRoot,r.cwd??process.cwd()),t=K(r.settings.extensions.enabled),n=K(r.settings.extensions.disabled),i=qe(r.settings),o=He(i);if(r.noExtensions)return{disabled_by_flag:!0,roots:e,configured_enabled:t,configured_disabled:n,discovered:[],effective:[],warnings:[...i.warnings],policy:o};const s=new Set(t),a=new Set(n),m=r.ignoreGlobalExtensions===!0?Pr():await ie("global",e.global,s,a,i.pmMaxVersionExceededMode.global),c=await ie("project",e.project,s,a,i.pmMaxVersionExceededMode.project),l=[...i.warnings],d=$r(m.candidates,c.candidates),h=[];for(const u of d){const f={layer:u.layer,name:u.manifest.name,trusted:u.manifest.trusted===!0,provenanceVerified:u.manifest.provenance?.verified===!0,sandboxProfile:u.manifest.sandbox_profile,permissions:u.manifest.permissions&&typeof u.manifest.permissions=="object"?{fs_read:u.manifest.permissions.fs_read,fs_write:u.manifest.permissions.fs_write,network:u.manifest.permissions.network,env_read:u.manifest.permissions.env_read,env_write:u.manifest.permissions.env_write,process_spawn:u.manifest.permissions.process_spawn}:void 0},g=Ne(i,f);if(g.warning&&l.push(g.warning),!!g.allowed){for(const v of u.manifest.capabilities){const _=We(i,f,v);_.warning&&l.push(_.warning)}h.push(kr(u))}}return{disabled_by_flag:!1,roots:e,configured_enabled:t,configured_disabled:n,discovered:[...m.diagnostics,...c.diagnostics],effective:h,warnings:[...new Set([...m.warnings,...c.warnings,...l])],policy:o}}function M(r){return r instanceof Error&&r.message.trim().length>0?r.message:String(r)}async function oe(){try{const r=Re(import.meta.url,["../../.."]),e=await w.readFile(x.join(r,"package.json"),"utf8"),t=JSON.parse(e);return typeof t.version=="string"&&t.version.trim().length>0?t.version.trim():null}catch{return null}}function N(){return W??=oe(),W}function ae(r,e,t){const n=t.current??"unknown";if(t.kind==="pm_min_version")switch(t.status){case"invalid":return`extension_pm_min_version_invalid:${r}:${e.name}:required=${t.required}`;case"unchecked":return`extension_pm_min_version_unchecked:${r}:${e.name}:required=${t.required}:current=${n}`;case"unmet":return`extension_pm_min_version_unmet:${r}:${e.name}:required=${t.required}:current=${n}`;default:return}switch(t.status){case"invalid":return`extension_pm_max_version_invalid:${r}:${e.name}:allowed=${t.required}`;case"unchecked":return`extension_pm_max_version_unchecked:${r}:${e.name}:allowed=${t.required}:current=${n}`;case"exceeded_warn":return`extension_pm_max_version_exceeded_warn:${r}:${e.name}:allowed=${t.required}:current=${n}`;case"exceeded":return`extension_pm_max_version_exceeded:${r}:${e.name}:allowed=${t.required}:current=${n}`;default:return}}async function me(r,e){if(e.pm_min_version===void 0)return{allowed:!0};const t=_r(e.pm_min_version,await N()),n=ae(r,e,t);return n?{allowed:t.allowed,warning:n}:{allowed:t.allowed}}async function ce(r,e,t){if(e.pm_max_version===void 0)return{allowed:!0};const n=yr(e.pm_max_version,await N(),t),i=ae(r,e,n);return i?{allowed:n.allowed,warning:i}:{allowed:n.allowed}}async function j(r){try{const e=await w.stat(r);return`${Math.trunc(e.mtimeMs)}-${e.size}`}catch{return"missing"}}async function le(r,e){let t=r.entry_path;e.module_graph_snapshot_root&&(t=await nr(e.module_graph_snapshot_root,r));const n=new URL(xe(t).href);if(!(e.cache_bust===!0||typeof e.reload_token=="string"))return n.href;const[o,s]=await Promise.all([j(r.entry_path),j(r.manifest_path)]),a=e.reload_token??xr();return n.searchParams.set("pm_ext_reload",a),n.searchParams.set("pm_ext_entry",o),n.searchParams.set("pm_ext_manifest",s),n.href}async function yt(r){const e=await Mr(r),t=[],n=[],i=[...e.warnings];if(e.disabled_by_flag)return{...e,warnings:i,loaded:t,failed:n};const o=typeof r.extensionFilter=="function"?e.effective.filter(r.extensionFilter):e.effective;for(const s of o)try{const m=await import(await le(s,r));t.push({...s,module:m})}catch(a){i.push(`extension_load_failed:${s.layer}:${s.name}`),n.push({layer:s.layer,name:s.name,entry_path:s.entry_path,error:M(a)})}return{...e,warnings:i,loaded:t,failed:n}}const de=5e3,Ar=2147483647;function Tr(r){const t={activate:r.activate.bind(r)};if(typeof r.deactivate=="function"){const n=r.deactivate;t.deactivate=n.bind(r)}return t}function ue(r){const e=ke(r);return e?Tr(e):null}async function _t(r,e,t={}){const n=he(t?.deactivate_timeout_ms),i=new Set((e?.failed??[]).map(l=>`${l.layer}:${l.name}`)),o=[];for(const l of r.loaded){if(i.has(`${l.layer}:${l.name}`))continue;const d=ue(l.module);!d||typeof d.deactivate!="function"||o.push({extension:l,deactivate:d.deactivate})}const s=await Promise.all(o.map(async({extension:l,deactivate:d})=>{try{return await Dr(d,n),{ok:!0}}catch(h){return{ok:!1,layer:l.layer,name:l.name,error:M(h)}}})),a=[],m=[];let c=0;for(const l of s){if(l.ok){c+=1;continue}a.push(`extension_deactivate_failed:${l.layer}:${l.name}`),m.push({layer:l.layer,name:l.name,error:l.error})}return{deactivated:c,warnings:a,failed:m}}function he(r){return typeof r!="number"||r<0?de:r===0||r===1/0?0:Number.isFinite(r)?Math.min(Ar,Math.max(1,Math.floor(r))):de}async function Dr(r,e){if(e===0){await r();return}let t;try{const n=Promise.resolve().then(()=>r());n.catch(()=>{}),await Promise.race([n,new Promise((i,o)=>{t=setTimeout(()=>{o(new Error(`extension deactivate timed out after ${e}ms`))},e),t.unref?.()})])}finally{clearTimeout(t)}}function Fr(r){if(!Array.isArray(r.capabilities))return null;const e=new Set;for(const t of r.capabilities){const n=t.trim().toLowerCase();ze(n)&&e.add(n)}return e}function p(r,e,t){const n=Fr(r);if(n!==null&&!n.has(e))throw y(`${t} requires capability '${e}' in extension manifest capabilities`,{method:t,registration_index:-1,capability:e,missing_capability:e,expected_schema:`"capabilities": [..., "${e}"]`,received:r.capabilities,hint:`Add "${e}" to ${r.name} manifest capabilities, or remove the ${t} registration call.`})}function Or(r){return Object.freeze({name:r.name,layer:r.layer,version:r.version,capabilities:Object.freeze((r.capabilities??[]).filter(e=>Ye.includes(e))),pm_min_version:r.pm_min_version,pm_max_version:r.pm_max_version,source_package:r.source_package})}function zr(r){return{layer:r.layer,name:r.name,trusted:r.trusted===!0,provenanceVerified:r.provenance?.verified===!0,sandboxProfile:r.sandbox_profile,permissions:r.permissions&&typeof r.permissions=="object"?{fs_read:r.permissions.fs_read,fs_write:r.permissions.fs_write,network:r.permissions.network,env_read:r.permissions.env_read,env_write:r.permissions.env_write,process_spawn:r.permissions.process_spawn}:void 0}}class Wr{extension;hooks;#e;#s;#t;#n;#o;#a;#m;#c;#r;#i;#l;#d;constructor(e,t,n,i,o,s,a,m,c,l,d){this.#e=e,this.extension=Or(e),this.#s=zr(e),this.#t=t,this.#n=n,this.#o=i,this.#a=o,this.#m=s,this.#c=a,this.#r=m,this.#i=c,this.#l=l,this.#d=d,this.registerCommand=this.registerCommand.bind(this),this.registerParser=this.registerParser.bind(this),this.registerPreflight=this.registerPreflight.bind(this),this.registerService=this.registerService.bind(this),this.registerFlags=this.registerFlags.bind(this),this.registerItemFields=this.registerItemFields.bind(this),this.registerItemTypes=this.registerItemTypes.bind(this),this.registerRelationshipKinds=this.registerRelationshipKinds.bind(this),this.registerMigration=this.registerMigration.bind(this),this.registerProfile=this.registerProfile.bind(this),this.registerRenderer=this.registerRenderer.bind(this),this.registerImporter=this.registerImporter.bind(this),this.registerExporter=this.registerExporter.bind(this),this.registerSearchProvider=this.registerSearchProvider.bind(this),this.registerVectorStoreAdapter=this.registerVectorStoreAdapter.bind(this),this.registerAssuranceMeasurementProvider=this.registerAssuranceMeasurementProvider.bind(this),this.hooks={beforeCommand:h=>this.registerBeforeCommand(h),beforeMutation:h=>this.registerBeforeMutation(h),afterCommand:h=>this.registerAfterCommand(h),onWrite:h=>this.registerOnWrite(h),onRead:h=>this.registerOnRead(h),onIndex:h=>this.registerOnIndex(h)}}allowRegistration(e,t,n,i){const o=je(this.#d,this.#s,e,t,n,i);return o.warning&&this.#i.push(o.warning),o.allowed}registerCommandTrace(e,t,n,i,o){return{method:"registerCommand",registration_index:e==="override"?this.#n.overrides.length:this.#n.handlers.length,command:t,expected_schema:n,received:Q(i),hint:o}}registerCommandOverride(e,t){const n=b(e);if(n.length===0)throw y("registerCommand requires a non-empty command name",this.registerCommandTrace("override",e,'registerCommand("<command>", (context) => unknown)',e,"Provide a non-empty command path as the first argument."));if(typeof t!="function"){const i=this.registerCommandTrace("override",n,'registerCommand("<command>", (context) => unknown)',t,"Provide a function as the second registerCommand argument.");throw y(`registerCommand requires an override function when command name is provided (command="${n}", registration_index=${i.registration_index})`,i)}this.allowRegistration("commands.override","registerCommand","commands",{command:n})&&this.#n.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:t})}resolveCommandDefinitionRunHandler(e,t){const n=typeof e.run=="function"?e.run:void 0,i=typeof e.handler=="function"?e.handler:void 0;return!n&&i&&this.#i.push(`extension_command_definition_legacy_handler_alias:${this.#e.layer}:${this.#e.name}:${t}`),n??i}registerCommandDefinition(e){if(typeof e!="object"||e===null)throw y("registerCommand requires a command definition object",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",e,'Use registerCommand({ name: "command path", run: (context) => ... }).'));if(typeof e.name!="string")throw y("registerCommand requires a command definition name",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",e,"Set command definition.name to a non-empty string command path."));const t=b(e.name);if(t.length===0)throw y("registerCommand requires a non-empty command definition name",this.registerCommandTrace("definition",e.name,"{ name: string; run: (context) => unknown; }",e,"Ensure command definition.name contains a non-empty command path."));const n=this.resolveCommandDefinitionRunHandler(e,t);if(typeof n!="function"){const i=this.registerCommandTrace("definition",t,"{ name: string; run: (context) => unknown; }",n,"Define command definition.run as a function.");throw y(`registerCommand requires a command definition run handler (command="${t}", registration_index=${i.registration_index})`,i)}try{Se(e);const i=F(t,e.action),o=Ie(e.read_output,t,i);if(!this.allowRegistration("commands.handler","registerCommand","commands",{command:t,action:i}))return;const s=e.description?.trim(),a=e.intent?.trim(),m=C("registerCommand definition.examples",e.examples),c=C("registerCommand definition.failure_hints",e.failure_hints),l=T(e.arguments);e.flags!==void 0&&(p(this.#e,"schema","registerCommand flags"),this.allowRegistration("schema.flags","registerCommand flags","schema")&&(O(e.flags),this.#r.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:t,flags:D("registerCommand definition.flags",e.flags)})));const d={source_version:this.#e.version,read_output:o,layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:t,action:i,examples:m,failure_hints:c,arguments:l,tier:e.tier??"standard",family:e.family??"extensions"};s&&(d.description=s),a&&(d.intent=a),this.#r.commands.push(d)}catch(i){const o=M(i),s=this.registerCommandTrace("definition",t,"{ name: string; run: (context) => unknown; action?: string; arguments?: object[]; flags?: object[]; }",e,o),a=y(`registerCommand definition metadata invalid (command="${t}", registration_index=${s.registration_index}): ${o}`,s);this.#i.push(`extension_command_quarantined:${this.#e.layer}:${this.#e.name}:${t}`),this.#l.push({layer:this.#e.layer,name:this.#e.name,entry_path:this.#e.entry_path,error:a.message,trace:s});return}this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:t,run:n})}registerCommand(e,t){if(p(this.#e,"commands","registerCommand"),typeof e=="string"){this.registerCommandOverride(e,t);return}this.registerCommandDefinition(e)}registerParser(e,t){if(p(this.#e,"parser","registerParser"),!this.allowRegistration("parser.override","registerParser","parser"))return;const n=b(P("registerParser command",e));S("registerParser override",t),this.#o.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:t})}registerPreflight(e){if(p(this.#e,"preflight","registerPreflight"),!this.allowRegistration("preflight.override","registerPreflight","preflight"))return;const t=sr(e);this.#a.overrides.push({layer:this.#e.layer,name:this.#e.name,...t})}registerService(e,t,n={}){p(this.#e,"services","registerService");const i=String(e).trim().toLowerCase();if(!ur(i))throw new TypeError(`registerService service must be one of: ${Qe.join(", ")}`);this.allowRegistration("services.override","registerService","services",{service:i})&&(S("registerService override",t),this.#m.overrides.push({layer:this.#e.layer,name:this.#e.name,service:i,run:t,...fr(n)?{passThrough:!0}:{}}))}registerRenderer(e,t,n={}){if(p(this.#e,"renderers","registerRenderer"),!this.allowRegistration("renderers.override","registerRenderer","renderers"))return;if(typeof t!="function")throw new TypeError("registerRenderer requires a renderer function");const i=String(e).trim().toLowerCase();if(!hr(i))throw new Error(`registerRenderer format must be toon|json, received: ${String(e)}`);if(n.resultDiscriminator!==void 0&&typeof n.resultDiscriminator!="function")throw new TypeError("registerRenderer ownership.resultDiscriminator must be a function when provided");const o=[...new Set((n.commands??[]).map(s=>{if(typeof s!="string"||s.trim().length===0)throw new TypeError("registerRenderer ownership.commands must contain non-empty command paths");return b(s)}))];this.#c.overrides.push({layer:this.#e.layer,name:this.#e.name,format:i,run:t,commands:o,...n.resultDiscriminator?{resultDiscriminator:n.resultDiscriminator}:{}})}registerFlags(e,t){if(p(this.#e,"schema","registerFlags"),!this.allowRegistration("schema.flags","registerFlags","schema"))return;const n=b(P("registerFlags targetCommand",e));O(t);const i=D("registerFlags flags",t);if(i.length===0)throw new TypeError("registerFlags requires at least one flag definition");this.#r.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:n,flags:i})}registerItemFields(e){if(p(this.#e,"schema","registerItemFields"),!this.allowRegistration("schema.itemfields","registerItemFields","schema"))return;G(e);const t=z("registerItemFields fields",e);if(t.length===0)throw new TypeError("registerItemFields requires at least one field definition");const{layer:n,name:i}=this.#e,o=t.filter(s=>{const a=typeof s.name=="string"?s.name.trim():"";return rr.has(a)?(this.#i.push(er(n,i,a)),!1):!0});this.#r.item_fields.push({layer:n,name:i,fields:o})}registerItemTypes(e){if(p(this.#e,"schema","registerItemTypes"),!this.allowRegistration("schema.itemtypes","registerItemTypes","schema"))return;mr(e);const t=z("registerItemTypes types",e);if(t.length===0)throw new TypeError("registerItemTypes requires at least one type definition");this.#r.item_types.push({layer:this.#e.layer,name:this.#e.name,types:t})}registerRelationshipKinds(e){if(p(this.#e,"schema","registerRelationshipKinds"),!this.allowRegistration("schema.relationshipkinds","registerRelationshipKinds","schema"))return;if(!Array.isArray(e))throw new TypeError("registerRelationshipKinds definitions requires an array of object definitions");if(e.length===0)throw new TypeError("registerRelationshipKinds requires at least one definition");const t=Ee();for(const i of this.#r.relationship_kinds)for(const o of i.definitions)t.register(o);const n=e.map(i=>(t.register(i),t.require(i.kind)));this.#r.relationship_kinds.push({layer:this.#e.layer,name:this.#e.name,definitions:n})}registerMigration(e){if(p(this.#e,"schema","registerMigration"),!this.allowRegistration("schema.migrations","registerMigration","schema"))return;cr(e);const t=k("registerMigration definition",e);this.#r.migrations.push(I({layer:this.#e.layer,name:this.#e.name,definition:R("registerMigration definition",e)},t))}registerProfile(e){if(p(this.#e,"schema","registerProfile"),!this.allowRegistration("schema.profiles","registerProfile","schema"))return;const t=dr(e);lr(t),this.#r.profiles.push({layer:this.#e.layer,name:this.#e.name,profile:or(t)})}registerImportExportCommandFlags(e,t,n){n.flags!==void 0&&(p(this.#e,"schema",`${e} options.flags`),this.allowRegistration("schema.flags",`${e} options.flags`,"schema")&&(O(n.flags),this.#r.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:t,flags:D(`${e} options.flags`,n.flags)})))}applyImportExportCommandMetadata(e,t,n){if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))throw new TypeError(`${e} options must be an object when provided`);const i=`${e==="registerImporter"?"Import":"Export"} items with the registered extension adapter.`,o=[{name:"file",required:!1,description:"Optional input or output file path."}],s={...n,description:n?.description??i,arguments:n?.arguments??o},a=Ae(e,s,n?.description!==void 0);$(`${e} options.action`,s.action),$(`${e} options.description`,s.description),$(`${e} options.intent`,s.intent);const m=F(t,s.action),c=C(`${e} options.examples`,s.examples),l=C(`${e} options.failure_hints`,s.failure_hints),d=T(s.arguments);this.registerImportExportCommandFlags(e,t,s);const h={source_version:this.#e.version,layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:t,action:m,examples:c,failure_hints:l,arguments:d},u=s.description?.trim();u&&(h.description=u);const f=s.intent?.trim();return f&&(h.intent=f),this.#r.commands.push(h),a}registerImporter(e,t,n){if(p(this.#e,"importers","registerImporter"),!this.allowRegistration("importers.importer","registerImporter","importers"))return;const i=Y(P("registerImporter name",e));S("registerImporter importer",t);const o=Z(i,"import");this.applyImportExportCommandMetadata("registerImporter",o,n),this.#r.importers.push({layer:this.#e.layer,name:this.#e.name,importer:i}),this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:o,run:async s=>t(U(s,i,"import"))})}registerExporter(e,t,n){if(p(this.#e,"importers","registerExporter"),!this.allowRegistration("importers.exporter","registerExporter","importers"))return;const i=Y(P("registerExporter name",e));S("registerExporter exporter",t);const o=Z(i,"export"),s=this.applyImportExportCommandMetadata("registerExporter",o,n);this.#r.exporters.push({layer:this.#e.layer,name:this.#e.name,exporter:i,...s===void 0?{}:{output:s}}),this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:o,run:async a=>{const m=await t(U(a,i,"export"));return s?.receipt==="suppress"&&!be(m)?Ce(m):m}})}registerSearchProvider(e){if(p(this.#e,"search","registerSearchProvider"),!this.allowRegistration("search.provider","registerSearchProvider","search"))return;const t=k("registerSearchProvider provider",e);this.#r.search_providers.push(I({layer:this.#e.layer,name:this.#e.name,definition:R("registerSearchProvider provider",e)},t))}registerVectorStoreAdapter(e){if(p(this.#e,"search","registerVectorStoreAdapter"),!this.allowRegistration("search.vectorstore","registerVectorStoreAdapter","search"))return;const t=k("registerVectorStoreAdapter adapter",e);this.#r.vector_store_adapters.push(I({layer:this.#e.layer,name:this.#e.name,definition:R("registerVectorStoreAdapter adapter",e)},t))}registerAssuranceMeasurementProvider(e){if(p(this.#e,"services","registerAssuranceMeasurementProvider"),!this.allowRegistration("services.assuranceprovider","registerAssuranceMeasurementProvider","services"))return;if(pr(e),e.network&&this.#e.permissions?.network!==!0)throw new TypeError("registerAssuranceMeasurementProvider network provider requires permissions.network=true");const t=k("registerAssuranceMeasurementProvider provider",e);this.#r.assurance_providers.push(I({layer:this.#e.layer,name:this.#e.name,network_permission:this.#e.permissions?.network===!0,definition:R("registerAssuranceMeasurementProvider provider",e)},t))}registerBeforeCommand(e){p(this.#e,"hooks","api.hooks.beforeCommand"),this.allowRegistration("hooks.beforecommand","api.hooks.beforeCommand","hooks")&&(E("beforeCommand",e),this.#t.beforeCommand.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerBeforeMutation(e){p(this.#e,"hooks","api.hooks.beforeMutation"),this.allowRegistration("hooks.beforemutation","api.hooks.beforeMutation","hooks")&&(E("beforeMutation",e),this.#t.beforeMutation.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerAfterCommand(e){p(this.#e,"hooks","api.hooks.afterCommand"),this.allowRegistration("hooks.aftercommand","api.hooks.afterCommand","hooks")&&(E("afterCommand",e),this.#t.afterCommand.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerOnWrite(e){p(this.#e,"hooks","api.hooks.onWrite"),this.allowRegistration("hooks.onwrite","api.hooks.onWrite","hooks")&&(E("onWrite",e),this.#t.onWrite.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerOnRead(e){p(this.#e,"hooks","api.hooks.onRead"),this.allowRegistration("hooks.onread","api.hooks.onRead","hooks")&&(E("onRead",e),this.#t.onRead.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerOnIndex(e){p(this.#e,"hooks","api.hooks.onIndex"),this.allowRegistration("hooks.onindex","api.hooks.onIndex","hooks")&&(E("onIndex",e),this.#t.onIndex.push({layer:this.#e.layer,name:this.#e.name,run:e}))}}function pe(r,e,t,n,i,o,s,a,m,c,l){return new Wr(r,e,t,n,i,o,s,a,m,c,l)}function fe(r){const e=r.commands.length,t=r.flags.reduce((s,a)=>s+a.flags.length,0),n=r.item_fields.reduce((s,a)=>s+a.fields.length,0),i=r.item_types.reduce((s,a)=>s+a.types.length,0),o=(r.relationship_kinds??[]).reduce((s,a)=>s+a.definitions.length,0);return{commands:e,flags:t,item_fields:n,item_types:i,...o>0?{relationship_kinds:o}:{},migrations:r.migrations.length,profiles:r.profiles.length,importers:r.importers.length,exporters:r.exporters.length,search_providers:r.search_providers.length,vector_store_adapters:r.vector_store_adapters.length,...(r.assurance_providers?.length??0)>0?{assurance_providers:r.assurance_providers.length}:{}}}function ge(r){const e=[],t=(o,s)=>{const a=new Map;for(const m of o){const c=a.get(m.command)??[];c.push(m),a.set(m.command,c)}for(const m of[...a.keys()].sort((c,l)=>c.localeCompare(l))){const c=a.get(m);if(c.length<=1)continue;const l=c[c.length-1];for(const d of c.slice(0,-1))e.push(`${s}:${m}:${l.layer}:${l.name}:${d.layer}:${d.name}`)}};t(r.handlers,"extension_command_handler_collision"),t(r.overrides,"extension_command_override_collision");const n=new Set(r.handlers.map(o=>o.command)),i=[...new Set(r.overrides.map(o=>o.command))].filter(o=>n.has(o));i.sort((o,s)=>o.localeCompare(s));for(const o of i){const s=r.handlers.filter(m=>m.command===o),a=r.overrides.filter(m=>m.command===o);for(const m of a)for(const c of s)e.push(`extension_command_override_handler_overlap:${o}:${m.layer}:${m.name}:${c.layer}:${c.name}`)}return e}function ye(r){const e=new Map;for(const n of r.overrides){const i=e.get(n.format)??[];i.push(n),e.set(n.format,i)}const t=[];for(const n of[...e.keys()].sort((i,o)=>i.localeCompare(o))){const i=e.get(n);if(i.length<=1)continue;const o=i[i.length-1];for(const s of i.slice(0,-1))o.commands?.length&&s.commands?.length&&!s.commands.some(a=>o.commands?.includes(a))||t.push(`extension_renderer_collision:${n}:${o.layer}:${o.name}:${s.layer}:${s.name}`)}return t}function _e(r){const e=[],t=new Map;for(const n of r.overrides){const i=t.get(n.command)??[];i.push(n),t.set(n.command,i)}for(const n of[...t.keys()].sort((i,o)=>i.localeCompare(o))){const i=t.get(n);if(i.length<=1)continue;const o=i[i.length-1];for(const s of i.slice(0,-1))e.push(`extension_parser_override_collision:${n}:${o.layer}:${o.name}:${s.layer}:${s.name}`)}return e}const Nr=new Set(["output_format"]);function ve(r){const e=[],t=new Map;for(const n of r.overrides){const i=t.get(n.service)??[];i.push(n),t.set(n.service,i)}for(const n of[...t.keys()].sort((i,o)=>i.localeCompare(o))){const i=t.get(n);if(i.length<=1||Nr.has(n))continue;const o=i[i.length-1];for(const s of i.slice(0,-1))e.push(`extension_service_override_collision:${n}:${o.layer}:${o.name}:${s.layer}:${s.name}`)}return e}async function vt(r){const e=Ve(r.policy??wr),t=Be(),n=Le(),i=Ue(),o=Ke(),s=Je(),a=Ge(),m=Xe(),c=[],l=[];for(const u of r.loaded){const f=ue(u.module);if(!f)continue;const g=c.length,v=Pe({hooks:t,commands:n,parsers:i,preflight:o,services:s,renderers:a,registrations:m});try{await f.activate(pe(u,t,n,i,o,s,a,m,l,c,e)),c.length>g&&(v(),l.push(`extension_activation_rolled_back:${u.layer}:${u.name}`))}catch(_){v(),l.push(`extension_activate_failed:${u.layer}:${u.name}`);const A=J(_);c.push({layer:u.layer,name:u.name,entry_path:u.entry_path,error:M(_),trace:A})}}const d=[...ge(n),..._e(i),...ir(o),...ve(s),...ye(a)],h=[...new Set([...l,...d])];return{hooks:t,commands:n,parsers:i,preflight:o,services:s,renderers:a,registrations:m,failed:c,warnings:h,hook_counts:{before_command:t.beforeCommand.length,before_mutation:t.beforeMutation.length,after_command:t.afterCommand.length,on_write:t.onWrite.length,on_read:t.onRead.length,on_index:t.onIndex.length},command_override_count:n.overrides.length,command_handler_count:n.handlers.length,parser_override_count:i.overrides.length,preflight_override_count:o.overrides.length,service_override_count:s.overrides.length,renderer_override_count:a.overrides.length,registration_counts:fe(m)}}const wt={assertFlagValueTypeAndDefault:ar,assertOptionalStringField:$,compareComparableVersions:gr,collectCommandCollisionWarnings:ge,collectParserCollisionWarnings:_e,collectRendererCollisionWarnings:ye,collectServiceCollisionWarnings:ve,createExtensionApi:pe,createRegistrationValidationError:y,evaluatePmMaxVersionCompatibility:ce,evaluatePmMinVersionCompatibility:me,extractRegistrationValidationTrace:J,fingerprintPath:j,getRegistrationCounts:fe,normalizeCommandDefinitionArguments:T,normalizeExtensionDeactivateTimeout:he,normalizeOptionalStringArrayField:C,normalizeRegistrationRecord:R,normalizeRegistrationRecordList:z,normalizeRuntimeRegistrationRecord:k,parseComparableVersion:vr,parseManifest:X,readCurrentPmCliVersion:oe,readManagedExtensionSourcePackages:async r=>new Map([...await te(r)].filter(e=>typeof e[1].package_name=="string").map(([e,t])=>[e,t.package_name])),resolveExtensionImportHref:le,resolveCurrentPmCliVersion:N,resolveCommandDefinitionAction:F,sanitizeRegistrationValue:Q,validateItemFieldDefinitions:G,resetCurrentPmCliVersionCacheForTest:()=>{W=null}};export{Gt as DEFAULT_EXTENSION_PRIORITY,wt as _testOnlyLoader,vt as activateExtensions,kt as createEmptyExtensionCommandRegistry,$t as createEmptyExtensionHookRegistry,Pt as createEmptyExtensionParserRegistry,St as createEmptyExtensionPreflightRegistry,It as createEmptyExtensionRegistrationRegistry,Mt as createEmptyExtensionRendererRegistry,At as createEmptyExtensionServiceRegistry,_t as deactivateExtensions,Mr as discoverExtensions,br as isCanonicalPathWithinDirectory,yt as loadExtensions,xr as nextExtensionReloadToken,Jt as parseExtensionManifestDocument,bt as parseLegacyExtensionCapabilityAliasWarning,Ct as parseUnknownExtensionCapabilityWarning,Cr as resolveExtensionRoots,Dt as runAfterCommandHooks,Ft as runBeforeCommandHooks,Ot as runBeforeMutationHooks,zt as runCommandHandler,Wt as runCommandOverride,Nt as runOnIndexHooks,jt as runOnReadHooks,Vt as runOnWriteHooks,qt as runParserOverride,Ht as runPreflightOverride,Lt as runRendererOverride,Bt as runServiceOverride,Ut as runServiceOverrideSync};
1
+ import w from"node:fs/promises";import x from"node:path";import{pathToFileURL as xe}from"node:url";import{createRelationshipKindRegistry as Ee}from"../../sdk/relationships.js";import{pathExists as H}from"../fs/fs-utils.js";import{isPathWithinDirectory as L}from"../fs/path-utils.js";import{isHostOutputSuppressed as be,suppressHostOutput as Ce}from"../output/output-control.js";import{resolvePmPackageRootFromModule as Re}from"../packages/root.js";import{asRecordLoose as B,resolveActivatablePropertyRecord as ke}from"../shared/primitives.js";import{resolveGlobalPmRoot as $e}from"../store/paths.js";import{captureExtensionActivationRollback as Pe}from"./activation-transaction.js";import{assertCommandDefinitionMetadataStrings as Se}from"./command-visibility-tier.js";import{normalizeExtensionReadOutput as Ie}from"./read-output-contract.js";import{normalizeExtensionContributionInventory as Me}from"./contribution-inventory.js";import{buildImportExportContext as U,resolveImportExportArtifactOutput as Ae}from"./exporter-output-contract.js";import{buildReadyExtensionCandidate as Te}from"./extension-candidate.js";import{collectUnknownExtensionCapabilities as De,formatLegacyExtensionCapabilityAliasWarning as Fe,formatUnknownExtensionCapabilityWarning as Oe,isKnownExtensionCapability as ze,normalizeNames as K}from"./extension-capability-aliases.js";import{evaluateExtensionPolicyForCapability as We,evaluateExtensionPolicyForExtension as Ne,evaluateExtensionPolicyForRegistration as je,hydrateExtensionPolicy as Ve,normalizeExtensionPolicy as qe,serializeExtensionPolicy as He}from"./extension-policy.js";import{createEmptyExtensionCommandRegistry as Le,createEmptyExtensionHookRegistry as Be,createEmptyExtensionParserRegistry as Ue,createEmptyExtensionPreflightRegistry as Ke,createEmptyExtensionRegistrationRegistry as Xe,createEmptyExtensionRendererRegistry as Ge,createEmptyExtensionServiceRegistry as Je}from"./extension-registries.js";import{normalizeCommandName as b}from"./extension-runtime-helpers.js";import{KNOWN_EXTENSION_CAPABILITIES as Ye,KNOWN_EXTENSION_SERVICE_NAMES as Qe,createDefaultExtensionGovernancePolicy as Ze}from"./extension-types.js";import{findConflictingItemFieldDeclaration as er,formatItemFieldTypeConflictWarning as rr,formatReservedItemFieldWarning as tr,RESERVED_ITEM_FIELD_NAMES as nr}from"./item-fields.js";import{parseExtensionManifestDocument as X}from"./manifest-parser.js";import{formatExtensionManifestSchemaWarnings as ir}from"./manifest-schema.js";import{snapshotExtensionModuleGraph as sr}from"./module-graph-snapshot.js";import{collectPreflightCollisionWarnings as or,normalizePreflightOverride as ar}from"./preflight-ownership.js";import{applyProjectProfileDefaults as mr,assertFlagValueTypeAndDefault as cr,normalizeCommandDefinitionArguments as T,normalizeFlagDefinitions as D,resolveCommandDefinitionAction as F,validateFlagDefinitions as O,validateItemFieldDefinitions as G,validateItemTypeDefinitions as lr,validateMigrationDefinition as dr,validateProjectProfileDefinition as ur}from"./registration-contracts.js";import{assertOptionalStringField as $,normalizeOptionalStringArrayField as C}from"./registration-validation.js";import{assertHookHandler as E,assertNonEmptyRegistrationString as P,assertRegistrationFunction as S,attachRuntimeDefinition as I,cloneRuntimeRegistrationValue as hr,createRegistrationValidationError as y,extractRegistrationValidationTrace as J,isExtensionServiceName as pr,isOutputRendererFormat as fr,normalizeRegistrationName as Y,normalizeRegistrationRecord as R,normalizeRegistrationRecordList as z,normalizeRuntimeRegistrationRecord as k,sanitizeRegistrationValue as Q,toRegistrationCommandPath as Z,validateAssuranceMeasurementProviderDefinition as gr}from"./registration-values.js";import{normalizeServiceOverrideOwnership as yr}from"./service-ownership.js";import{compareComparableVersions as _r,evaluatePmMaxVersionBound as vr,evaluatePmMinVersionBound as wr,parseComparableVersion as xr}from"./version-compat.js";import{parseLegacyExtensionCapabilityAliasWarning as Rt,parseUnknownExtensionCapabilityWarning as kt}from"./extension-capability-aliases.js";import{createEmptyExtensionCommandRegistry as Pt,createEmptyExtensionHookRegistry as St,createEmptyExtensionParserRegistry as It,createEmptyExtensionPreflightRegistry as Mt,createEmptyExtensionRegistrationRegistry as At,createEmptyExtensionRendererRegistry as Tt,createEmptyExtensionServiceRegistry as Dt}from"./extension-registries.js";import{runAfterCommandHooks as Ot,runBeforeCommandHooks as zt,runBeforeMutationHooks as Wt,runCommandHandler as Nt,runCommandOverride as jt,runOnIndexHooks as Vt,runOnReadHooks as qt,runOnWriteHooks as Ht,runParserOverride as Lt,runPreflightOverride as Bt,runRendererOverride as Ut,runServiceOverride as Kt,runServiceOverrideSync as Xt}from"./extension-hook-runtime.js";export*from"./extension-types.js";import{DEFAULT_EXTENSION_PRIORITY as Yt,parseExtensionManifestDocument as Qt}from"./manifest-parser.js";let W=null;const Er=Object.freeze(Ze());let ee=0;function br(r=Date.now()){return ee+=1,`${ee}-${r}`}function Cr(r,e,t){return t.has(r)?!1:e.size===0?!0:e.has(r)}async function Rr(r,e){const[t,n]=await Promise.all([w.realpath(r),w.realpath(e)]);return L(t,n)}function kr(r,e=process.cwd()){return{global:x.join($e(e),"extensions"),project:x.join(r,"extensions")}}async function $r(r){try{return(await w.readdir(r,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,n)=>t.localeCompare(n))}catch{return[]}}function Pr(r){const e={layer:r.layer,directory:r.directory,manifest_path:r.manifest_path,name:r.manifest.name,version:r.manifest.version,entry:r.manifest.entry,priority:r.manifest.priority,entry_path:r.entry_path,manifest_version:r.manifest.manifest_version,pm_min_version:r.manifest.pm_min_version,pm_max_version:r.manifest.pm_max_version,engines:r.manifest.engines,trusted:r.manifest.trusted,provenance:r.manifest.provenance,sandbox_profile:r.manifest.sandbox_profile,permissions:r.manifest.permissions,capabilities:[...r.manifest.capabilities],activation:r.manifest.activation?{commands:[...r.manifest.activation.commands]}:void 0,contributions:r.manifest.contributions??r.contributions};return r.source_package&&(e.source_package=r.source_package),r.source_aliases&&(e.source_aliases=[...r.source_aliases]),e}function re(r){return typeof r=="string"&&r.trim().length>0?r.trim():void 0}async function te(r){const e=new Map;try{const t=JSON.parse(await w.readFile(x.join(r,".managed-extensions.json"),"utf8")),i=B(t)?.entries;if(!Array.isArray(i))return e;for(const o of i){if(typeof o!="object"||o===null)continue;const s=o,a=re(s.source?.package),m=[s.source?.input,s.source?.name,a].map(d=>re(d)).filter(d=>d!==void 0),c=Me(s.contributions),l={aliases:[...new Set(m)],...a?{package_name:a}:{},...c?{contributions:c}:{}};typeof s.directory=="string"&&s.directory.trim().length>0&&e.set(`directory:${s.directory.trim()}`,l),typeof s.name=="string"&&s.name.trim().length>0&&e.set(`name:${s.name.trim()}`,l)}}catch{return e}return e}function ne(r){return[...r].sort((e,t)=>{if(e.manifest.priority!==t.manifest.priority)return e.manifest.priority-t.manifest.priority;const n=e.manifest.name.localeCompare(t.manifest.name);return n!==0?n:e.directory.localeCompare(t.directory)})}function Sr(r,e){const t=[...ne(r),...ne(e)],n=[];for(const i of t){const o=n.findIndex(s=>s.manifest.name===i.manifest.name);o>=0&&n.splice(o,1),n.push(i)}return n}async function ie(r,e,t,n,i){const o=[],s=[],a=[],m=await $r(e),c=await te(e);for(const l of m){const d=await Ar(r,e,l,t,n,c,i);o.push(d.diagnostic),s.push(...d.warnings),d.candidate&&a.push(d.candidate)}return{diagnostics:o,warnings:s,candidates:a}}function Ir(){return{diagnostics:[],warnings:[],candidates:[]}}function se(r,e,t,n){return{diagnostic:{layer:r,directory:e,manifest_path:t,name:null,version:null,entry:null,priority:null,entry_path:null,enabled:null,status:"warn"},warnings:[n],candidate:null}}function Mr(r,e,t,n,i,o,s,a){const m=ir(r,e,t);Array.isArray(e.legacy_capability_aliases)&&e.legacy_capability_aliases.length>0&&m.push(Fe(r,e.name,e.legacy_capability_aliases));for(const c of De(e.capabilities))m.push(Oe(r,e.name,c));return n?i||m.push(`extension_entry_missing:${r}:${e.name}`):m.push(`extension_entry_outside_extension:${r}:${e.name}`),o.warning&&m.push(a?o.warning:o.warning.replace("extension_pm_","extension_disabled_pm_")),s.warning&&m.push(a?s.warning:s.warning.replace("extension_pm_","extension_disabled_pm_")),m}async function Ar(r,e,t,n,i,o,s){const a=x.join(e,t),m=x.join(a,"manifest.json");if(!await H(m))return se(r,t,m,`extension_manifest_missing:${r}:${t}`);let c,l;try{const q=JSON.parse(await w.readFile(m,"utf8"));l=B(q),c=X(q)}catch{l=null,c=null}if(!c||!l)return se(r,t,m,`extension_manifest_invalid:${r}:${t}`);const d=x.resolve(a,c.entry),h=L(a,d),u=h?await H(d):!1,f=h&&u?await Rr(a,d):h,g=Cr(c.name,n,i),v=await me(r,c),_=await ce(r,c,s),A=Mr(r,c,l,f,u,v,_,g),V=f&&u&&v.allowed&&_.allowed,we=o.get(`directory:${t}`)??o.get(`name:${c.name}`);return{diagnostic:{layer:r,directory:t,manifest_path:m,name:c.name,version:c.version,entry:c.entry,priority:c.priority,entry_path:d,enabled:g,status:V?"ok":"warn"},warnings:A,candidate:Te({layer:r,directory:t,manifestPath:m,entryPath:d,manifest:c,sourceIdentity:we,extensionReady:V,enabledForLoad:g})}}async function Tr(r){const e=kr(r.pmRoot,r.cwd??process.cwd()),t=K(r.settings.extensions.enabled),n=K(r.settings.extensions.disabled),i=qe(r.settings),o=He(i);if(r.noExtensions)return{disabled_by_flag:!0,roots:e,configured_enabled:t,configured_disabled:n,discovered:[],effective:[],warnings:[...i.warnings],policy:o};const s=new Set(t),a=new Set(n),m=r.ignoreGlobalExtensions===!0?Ir():await ie("global",e.global,s,a,i.pmMaxVersionExceededMode.global),c=await ie("project",e.project,s,a,i.pmMaxVersionExceededMode.project),l=[...i.warnings],d=Sr(m.candidates,c.candidates),h=[];for(const u of d){const f={layer:u.layer,name:u.manifest.name,trusted:u.manifest.trusted===!0,provenanceVerified:u.manifest.provenance?.verified===!0,sandboxProfile:u.manifest.sandbox_profile,permissions:u.manifest.permissions&&typeof u.manifest.permissions=="object"?{fs_read:u.manifest.permissions.fs_read,fs_write:u.manifest.permissions.fs_write,network:u.manifest.permissions.network,env_read:u.manifest.permissions.env_read,env_write:u.manifest.permissions.env_write,process_spawn:u.manifest.permissions.process_spawn}:void 0},g=Ne(i,f);if(g.warning&&l.push(g.warning),!!g.allowed){for(const v of u.manifest.capabilities){const _=We(i,f,v);_.warning&&l.push(_.warning)}h.push(Pr(u))}}return{disabled_by_flag:!1,roots:e,configured_enabled:t,configured_disabled:n,discovered:[...m.diagnostics,...c.diagnostics],effective:h,warnings:[...new Set([...m.warnings,...c.warnings,...l])],policy:o}}function M(r){return r instanceof Error&&r.message.trim().length>0?r.message:String(r)}async function oe(){try{const r=Re(import.meta.url,["../../.."]),e=await w.readFile(x.join(r,"package.json"),"utf8"),t=JSON.parse(e);return typeof t.version=="string"&&t.version.trim().length>0?t.version.trim():null}catch{return null}}function N(){return W??=oe(),W}function ae(r,e,t){const n=t.current??"unknown";if(t.kind==="pm_min_version")switch(t.status){case"invalid":return`extension_pm_min_version_invalid:${r}:${e.name}:required=${t.required}`;case"unchecked":return`extension_pm_min_version_unchecked:${r}:${e.name}:required=${t.required}:current=${n}`;case"unmet":return`extension_pm_min_version_unmet:${r}:${e.name}:required=${t.required}:current=${n}`;default:return}switch(t.status){case"invalid":return`extension_pm_max_version_invalid:${r}:${e.name}:allowed=${t.required}`;case"unchecked":return`extension_pm_max_version_unchecked:${r}:${e.name}:allowed=${t.required}:current=${n}`;case"exceeded_warn":return`extension_pm_max_version_exceeded_warn:${r}:${e.name}:allowed=${t.required}:current=${n}`;case"exceeded":return`extension_pm_max_version_exceeded:${r}:${e.name}:allowed=${t.required}:current=${n}`;default:return}}async function me(r,e){if(e.pm_min_version===void 0)return{allowed:!0};const t=wr(e.pm_min_version,await N()),n=ae(r,e,t);return n?{allowed:t.allowed,warning:n}:{allowed:t.allowed}}async function ce(r,e,t){if(e.pm_max_version===void 0)return{allowed:!0};const n=vr(e.pm_max_version,await N(),t),i=ae(r,e,n);return i?{allowed:n.allowed,warning:i}:{allowed:n.allowed}}async function j(r){try{const e=await w.stat(r);return`${Math.trunc(e.mtimeMs)}-${e.size}`}catch{return"missing"}}async function le(r,e){let t=r.entry_path;e.module_graph_snapshot_root&&(t=await sr(e.module_graph_snapshot_root,r));const n=new URL(xe(t).href);if(!(e.cache_bust===!0||typeof e.reload_token=="string"))return n.href;const[o,s]=await Promise.all([j(r.entry_path),j(r.manifest_path)]),a=e.reload_token??br();return n.searchParams.set("pm_ext_reload",a),n.searchParams.set("pm_ext_entry",o),n.searchParams.set("pm_ext_manifest",s),n.href}async function vt(r){const e=await Tr(r),t=[],n=[],i=[...e.warnings];if(e.disabled_by_flag)return{...e,warnings:i,loaded:t,failed:n};const o=typeof r.extensionFilter=="function"?e.effective.filter(r.extensionFilter):e.effective;for(const s of o)try{const m=await import(await le(s,r));t.push({...s,module:m})}catch(a){i.push(`extension_load_failed:${s.layer}:${s.name}`),n.push({layer:s.layer,name:s.name,entry_path:s.entry_path,error:M(a)})}return{...e,warnings:i,loaded:t,failed:n}}const de=5e3,Dr=2147483647;function Fr(r){const t={activate:r.activate.bind(r)};if(typeof r.deactivate=="function"){const n=r.deactivate;t.deactivate=n.bind(r)}return t}function ue(r){const e=ke(r);return e?Fr(e):null}async function wt(r,e,t={}){const n=he(t?.deactivate_timeout_ms),i=new Set((e?.failed??[]).map(l=>`${l.layer}:${l.name}`)),o=[];for(const l of r.loaded){if(i.has(`${l.layer}:${l.name}`))continue;const d=ue(l.module);!d||typeof d.deactivate!="function"||o.push({extension:l,deactivate:d.deactivate})}const s=await Promise.all(o.map(async({extension:l,deactivate:d})=>{try{return await Or(d,n),{ok:!0}}catch(h){return{ok:!1,layer:l.layer,name:l.name,error:M(h)}}})),a=[],m=[];let c=0;for(const l of s){if(l.ok){c+=1;continue}a.push(`extension_deactivate_failed:${l.layer}:${l.name}`),m.push({layer:l.layer,name:l.name,error:l.error})}return{deactivated:c,warnings:a,failed:m}}function he(r){return typeof r!="number"||r<0?de:r===0||r===1/0?0:Number.isFinite(r)?Math.min(Dr,Math.max(1,Math.floor(r))):de}async function Or(r,e){if(e===0){await r();return}let t;try{const n=Promise.resolve().then(()=>r());n.catch(()=>{}),await Promise.race([n,new Promise((i,o)=>{t=setTimeout(()=>{o(new Error(`extension deactivate timed out after ${e}ms`))},e),t.unref?.()})])}finally{clearTimeout(t)}}function zr(r){if(!Array.isArray(r.capabilities))return null;const e=new Set;for(const t of r.capabilities){const n=t.trim().toLowerCase();ze(n)&&e.add(n)}return e}function p(r,e,t){const n=zr(r);if(n!==null&&!n.has(e))throw y(`${t} requires capability '${e}' in extension manifest capabilities`,{method:t,registration_index:-1,capability:e,missing_capability:e,expected_schema:`"capabilities": [..., "${e}"]`,received:r.capabilities,hint:`Add "${e}" to ${r.name} manifest capabilities, or remove the ${t} registration call.`})}function Wr(r){return Object.freeze({name:r.name,layer:r.layer,version:r.version,capabilities:Object.freeze((r.capabilities??[]).filter(e=>Ye.includes(e))),pm_min_version:r.pm_min_version,pm_max_version:r.pm_max_version,source_package:r.source_package})}function Nr(r){return{layer:r.layer,name:r.name,trusted:r.trusted===!0,provenanceVerified:r.provenance?.verified===!0,sandboxProfile:r.sandbox_profile,permissions:r.permissions&&typeof r.permissions=="object"?{fs_read:r.permissions.fs_read,fs_write:r.permissions.fs_write,network:r.permissions.network,env_read:r.permissions.env_read,env_write:r.permissions.env_write,process_spawn:r.permissions.process_spawn}:void 0}}class jr{extension;hooks;#e;#s;#t;#n;#o;#a;#m;#c;#r;#i;#l;#d;constructor(e,t,n,i,o,s,a,m,c,l,d){this.#e=e,this.extension=Wr(e),this.#s=Nr(e),this.#t=t,this.#n=n,this.#o=i,this.#a=o,this.#m=s,this.#c=a,this.#r=m,this.#i=c,this.#l=l,this.#d=d,this.registerCommand=this.registerCommand.bind(this),this.registerParser=this.registerParser.bind(this),this.registerPreflight=this.registerPreflight.bind(this),this.registerService=this.registerService.bind(this),this.registerFlags=this.registerFlags.bind(this),this.registerItemFields=this.registerItemFields.bind(this),this.registerItemTypes=this.registerItemTypes.bind(this),this.registerRelationshipKinds=this.registerRelationshipKinds.bind(this),this.registerMigration=this.registerMigration.bind(this),this.registerProfile=this.registerProfile.bind(this),this.registerRenderer=this.registerRenderer.bind(this),this.registerImporter=this.registerImporter.bind(this),this.registerExporter=this.registerExporter.bind(this),this.registerSearchProvider=this.registerSearchProvider.bind(this),this.registerVectorStoreAdapter=this.registerVectorStoreAdapter.bind(this),this.registerAssuranceMeasurementProvider=this.registerAssuranceMeasurementProvider.bind(this),this.hooks={beforeCommand:h=>this.registerBeforeCommand(h),beforeMutation:h=>this.registerBeforeMutation(h),afterCommand:h=>this.registerAfterCommand(h),onWrite:h=>this.registerOnWrite(h),onRead:h=>this.registerOnRead(h),onIndex:h=>this.registerOnIndex(h)}}allowRegistration(e,t,n,i){const o=je(this.#d,this.#s,e,t,n,i);return o.warning&&this.#i.push(o.warning),o.allowed}registerCommandTrace(e,t,n,i,o){return{method:"registerCommand",registration_index:e==="override"?this.#n.overrides.length:this.#n.handlers.length,command:t,expected_schema:n,received:Q(i),hint:o}}registerCommandOverride(e,t){const n=b(e);if(n.length===0)throw y("registerCommand requires a non-empty command name",this.registerCommandTrace("override",e,'registerCommand("<command>", (context) => unknown)',e,"Provide a non-empty command path as the first argument."));if(typeof t!="function"){const i=this.registerCommandTrace("override",n,'registerCommand("<command>", (context) => unknown)',t,"Provide a function as the second registerCommand argument.");throw y(`registerCommand requires an override function when command name is provided (command="${n}", registration_index=${i.registration_index})`,i)}this.allowRegistration("commands.override","registerCommand","commands",{command:n})&&this.#n.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:t})}resolveCommandDefinitionRunHandler(e,t){const n=typeof e.run=="function"?e.run:void 0,i=typeof e.handler=="function"?e.handler:void 0;return!n&&i&&this.#i.push(`extension_command_definition_legacy_handler_alias:${this.#e.layer}:${this.#e.name}:${t}`),n??i}registerCommandDefinition(e){if(typeof e!="object"||e===null)throw y("registerCommand requires a command definition object",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",e,'Use registerCommand({ name: "command path", run: (context) => ... }).'));if(typeof e.name!="string")throw y("registerCommand requires a command definition name",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",e,"Set command definition.name to a non-empty string command path."));const t=b(e.name);if(t.length===0)throw y("registerCommand requires a non-empty command definition name",this.registerCommandTrace("definition",e.name,"{ name: string; run: (context) => unknown; }",e,"Ensure command definition.name contains a non-empty command path."));const n=this.resolveCommandDefinitionRunHandler(e,t);if(typeof n!="function"){const i=this.registerCommandTrace("definition",t,"{ name: string; run: (context) => unknown; }",n,"Define command definition.run as a function.");throw y(`registerCommand requires a command definition run handler (command="${t}", registration_index=${i.registration_index})`,i)}try{Se(e);const i=F(t,e.action),o=Ie(e.read_output,t,i);if(!this.allowRegistration("commands.handler","registerCommand","commands",{command:t,action:i}))return;const s=e.description?.trim(),a=e.intent?.trim(),m=C("registerCommand definition.examples",e.examples),c=C("registerCommand definition.failure_hints",e.failure_hints),l=T(e.arguments);e.flags!==void 0&&(p(this.#e,"schema","registerCommand flags"),this.allowRegistration("schema.flags","registerCommand flags","schema")&&(O(e.flags),this.#r.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:t,flags:D("registerCommand definition.flags",e.flags)})));const d={source_version:this.#e.version,read_output:o,layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:t,action:i,examples:m,failure_hints:c,arguments:l,tier:e.tier??"standard",family:e.family??"extensions"};s&&(d.description=s),a&&(d.intent=a),this.#r.commands.push(d)}catch(i){const o=M(i),s=this.registerCommandTrace("definition",t,"{ name: string; run: (context) => unknown; action?: string; arguments?: object[]; flags?: object[]; }",e,o),a=y(`registerCommand definition metadata invalid (command="${t}", registration_index=${s.registration_index}): ${o}`,s);this.#i.push(`extension_command_quarantined:${this.#e.layer}:${this.#e.name}:${t}`),this.#l.push({layer:this.#e.layer,name:this.#e.name,entry_path:this.#e.entry_path,error:a.message,trace:s});return}this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:t,run:n})}registerCommand(e,t){if(p(this.#e,"commands","registerCommand"),typeof e=="string"){this.registerCommandOverride(e,t);return}this.registerCommandDefinition(e)}registerParser(e,t){if(p(this.#e,"parser","registerParser"),!this.allowRegistration("parser.override","registerParser","parser"))return;const n=b(P("registerParser command",e));S("registerParser override",t),this.#o.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:t})}registerPreflight(e){if(p(this.#e,"preflight","registerPreflight"),!this.allowRegistration("preflight.override","registerPreflight","preflight"))return;const t=ar(e);this.#a.overrides.push({layer:this.#e.layer,name:this.#e.name,...t})}registerService(e,t,n={}){p(this.#e,"services","registerService");const i=String(e).trim().toLowerCase();if(!pr(i))throw new TypeError(`registerService service must be one of: ${Qe.join(", ")}`);this.allowRegistration("services.override","registerService","services",{service:i})&&(S("registerService override",t),this.#m.overrides.push({layer:this.#e.layer,name:this.#e.name,service:i,run:t,...yr(n)?{passThrough:!0}:{}}))}registerRenderer(e,t,n={}){if(p(this.#e,"renderers","registerRenderer"),!this.allowRegistration("renderers.override","registerRenderer","renderers"))return;if(typeof t!="function")throw new TypeError("registerRenderer requires a renderer function");const i=String(e).trim().toLowerCase();if(!fr(i))throw new Error(`registerRenderer format must be toon|json, received: ${String(e)}`);if(n.resultDiscriminator!==void 0&&typeof n.resultDiscriminator!="function")throw new TypeError("registerRenderer ownership.resultDiscriminator must be a function when provided");const o=[...new Set((n.commands??[]).map(s=>{if(typeof s!="string"||s.trim().length===0)throw new TypeError("registerRenderer ownership.commands must contain non-empty command paths");return b(s)}))];this.#c.overrides.push({layer:this.#e.layer,name:this.#e.name,format:i,run:t,commands:o,...n.resultDiscriminator?{resultDiscriminator:n.resultDiscriminator}:{}})}registerFlags(e,t){if(p(this.#e,"schema","registerFlags"),!this.allowRegistration("schema.flags","registerFlags","schema"))return;const n=b(P("registerFlags targetCommand",e));O(t);const i=D("registerFlags flags",t);if(i.length===0)throw new TypeError("registerFlags requires at least one flag definition");this.#r.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:n,flags:i})}registerItemFields(e){if(p(this.#e,"schema","registerItemFields"),!this.allowRegistration("schema.itemfields","registerItemFields","schema"))return;G(e);const t=z("registerItemFields fields",e);if(t.length===0)throw new TypeError("registerItemFields requires at least one field definition");const{layer:n,name:i}=this.#e,o={layer:n,name:i,fields:[]};for(const s of t){const a=typeof s.name=="string"?s.name.trim():"";if(nr.has(a)){this.#i.push(tr(n,i,a));continue}const m=er([...this.#r.item_fields,o],s);if(m){this.#i.push(rr(n,i,s,m));continue}o.fields.push(s)}this.#r.item_fields.push(o)}registerItemTypes(e){if(p(this.#e,"schema","registerItemTypes"),!this.allowRegistration("schema.itemtypes","registerItemTypes","schema"))return;lr(e);const t=z("registerItemTypes types",e);if(t.length===0)throw new TypeError("registerItemTypes requires at least one type definition");this.#r.item_types.push({layer:this.#e.layer,name:this.#e.name,types:t})}registerRelationshipKinds(e){if(p(this.#e,"schema","registerRelationshipKinds"),!this.allowRegistration("schema.relationshipkinds","registerRelationshipKinds","schema"))return;if(!Array.isArray(e))throw new TypeError("registerRelationshipKinds definitions requires an array of object definitions");if(e.length===0)throw new TypeError("registerRelationshipKinds requires at least one definition");const t=Ee();for(const i of this.#r.relationship_kinds)for(const o of i.definitions)t.register(o);const n=e.map(i=>(t.register(i),t.require(i.kind)));this.#r.relationship_kinds.push({layer:this.#e.layer,name:this.#e.name,definitions:n})}registerMigration(e){if(p(this.#e,"schema","registerMigration"),!this.allowRegistration("schema.migrations","registerMigration","schema"))return;dr(e);const t=k("registerMigration definition",e);this.#r.migrations.push(I({layer:this.#e.layer,name:this.#e.name,definition:R("registerMigration definition",e)},t))}registerProfile(e){if(p(this.#e,"schema","registerProfile"),!this.allowRegistration("schema.profiles","registerProfile","schema"))return;const t=hr(e);ur(t),this.#r.profiles.push({layer:this.#e.layer,name:this.#e.name,profile:mr(t)})}registerImportExportCommandFlags(e,t,n){n.flags!==void 0&&(p(this.#e,"schema",`${e} options.flags`),this.allowRegistration("schema.flags",`${e} options.flags`,"schema")&&(O(n.flags),this.#r.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:t,flags:D(`${e} options.flags`,n.flags)})))}applyImportExportCommandMetadata(e,t,n){if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))throw new TypeError(`${e} options must be an object when provided`);const i=`${e==="registerImporter"?"Import":"Export"} items with the registered extension adapter.`,o=[{name:"file",required:!1,description:"Optional input or output file path."}],s={...n,description:n?.description??i,arguments:n?.arguments??o},a=Ae(e,s,n?.description!==void 0);$(`${e} options.action`,s.action),$(`${e} options.description`,s.description),$(`${e} options.intent`,s.intent);const m=F(t,s.action),c=C(`${e} options.examples`,s.examples),l=C(`${e} options.failure_hints`,s.failure_hints),d=T(s.arguments);this.registerImportExportCommandFlags(e,t,s);const h={source_version:this.#e.version,layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:t,action:m,examples:c,failure_hints:l,arguments:d},u=s.description?.trim();u&&(h.description=u);const f=s.intent?.trim();return f&&(h.intent=f),this.#r.commands.push(h),a}registerImporter(e,t,n){if(p(this.#e,"importers","registerImporter"),!this.allowRegistration("importers.importer","registerImporter","importers"))return;const i=Y(P("registerImporter name",e));S("registerImporter importer",t);const o=Z(i,"import");this.applyImportExportCommandMetadata("registerImporter",o,n),this.#r.importers.push({layer:this.#e.layer,name:this.#e.name,importer:i}),this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:o,run:async s=>t(U(s,i,"import"))})}registerExporter(e,t,n){if(p(this.#e,"importers","registerExporter"),!this.allowRegistration("importers.exporter","registerExporter","importers"))return;const i=Y(P("registerExporter name",e));S("registerExporter exporter",t);const o=Z(i,"export"),s=this.applyImportExportCommandMetadata("registerExporter",o,n);this.#r.exporters.push({layer:this.#e.layer,name:this.#e.name,exporter:i,...s===void 0?{}:{output:s}}),this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:o,run:async a=>{const m=await t(U(a,i,"export"));return s?.receipt==="suppress"&&!be(m)?Ce(m):m}})}registerSearchProvider(e){if(p(this.#e,"search","registerSearchProvider"),!this.allowRegistration("search.provider","registerSearchProvider","search"))return;const t=k("registerSearchProvider provider",e);this.#r.search_providers.push(I({layer:this.#e.layer,name:this.#e.name,definition:R("registerSearchProvider provider",e)},t))}registerVectorStoreAdapter(e){if(p(this.#e,"search","registerVectorStoreAdapter"),!this.allowRegistration("search.vectorstore","registerVectorStoreAdapter","search"))return;const t=k("registerVectorStoreAdapter adapter",e);this.#r.vector_store_adapters.push(I({layer:this.#e.layer,name:this.#e.name,definition:R("registerVectorStoreAdapter adapter",e)},t))}registerAssuranceMeasurementProvider(e){if(p(this.#e,"services","registerAssuranceMeasurementProvider"),!this.allowRegistration("services.assuranceprovider","registerAssuranceMeasurementProvider","services"))return;if(gr(e),e.network&&this.#e.permissions?.network!==!0)throw new TypeError("registerAssuranceMeasurementProvider network provider requires permissions.network=true");const t=k("registerAssuranceMeasurementProvider provider",e);this.#r.assurance_providers.push(I({layer:this.#e.layer,name:this.#e.name,network_permission:this.#e.permissions?.network===!0,definition:R("registerAssuranceMeasurementProvider provider",e)},t))}registerBeforeCommand(e){p(this.#e,"hooks","api.hooks.beforeCommand"),this.allowRegistration("hooks.beforecommand","api.hooks.beforeCommand","hooks")&&(E("beforeCommand",e),this.#t.beforeCommand.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerBeforeMutation(e){p(this.#e,"hooks","api.hooks.beforeMutation"),this.allowRegistration("hooks.beforemutation","api.hooks.beforeMutation","hooks")&&(E("beforeMutation",e),this.#t.beforeMutation.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerAfterCommand(e){p(this.#e,"hooks","api.hooks.afterCommand"),this.allowRegistration("hooks.aftercommand","api.hooks.afterCommand","hooks")&&(E("afterCommand",e),this.#t.afterCommand.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerOnWrite(e){p(this.#e,"hooks","api.hooks.onWrite"),this.allowRegistration("hooks.onwrite","api.hooks.onWrite","hooks")&&(E("onWrite",e),this.#t.onWrite.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerOnRead(e){p(this.#e,"hooks","api.hooks.onRead"),this.allowRegistration("hooks.onread","api.hooks.onRead","hooks")&&(E("onRead",e),this.#t.onRead.push({layer:this.#e.layer,name:this.#e.name,run:e}))}registerOnIndex(e){p(this.#e,"hooks","api.hooks.onIndex"),this.allowRegistration("hooks.onindex","api.hooks.onIndex","hooks")&&(E("onIndex",e),this.#t.onIndex.push({layer:this.#e.layer,name:this.#e.name,run:e}))}}function pe(r,e,t,n,i,o,s,a,m,c,l){return new jr(r,e,t,n,i,o,s,a,m,c,l)}function fe(r){const e=r.commands.length,t=r.flags.reduce((s,a)=>s+a.flags.length,0),n=r.item_fields.reduce((s,a)=>s+a.fields.length,0),i=r.item_types.reduce((s,a)=>s+a.types.length,0),o=(r.relationship_kinds??[]).reduce((s,a)=>s+a.definitions.length,0);return{commands:e,flags:t,item_fields:n,item_types:i,...o>0?{relationship_kinds:o}:{},migrations:r.migrations.length,profiles:r.profiles.length,importers:r.importers.length,exporters:r.exporters.length,search_providers:r.search_providers.length,vector_store_adapters:r.vector_store_adapters.length,...(r.assurance_providers?.length??0)>0?{assurance_providers:r.assurance_providers.length}:{}}}function ge(r){const e=[],t=(o,s)=>{const a=new Map;for(const m of o){const c=a.get(m.command)??[];c.push(m),a.set(m.command,c)}for(const m of[...a.keys()].sort((c,l)=>c.localeCompare(l))){const c=a.get(m);if(c.length<=1)continue;const l=c[c.length-1];for(const d of c.slice(0,-1))e.push(`${s}:${m}:${l.layer}:${l.name}:${d.layer}:${d.name}`)}};t(r.handlers,"extension_command_handler_collision"),t(r.overrides,"extension_command_override_collision");const n=new Set(r.handlers.map(o=>o.command)),i=[...new Set(r.overrides.map(o=>o.command))].filter(o=>n.has(o));i.sort((o,s)=>o.localeCompare(s));for(const o of i){const s=r.handlers.filter(m=>m.command===o),a=r.overrides.filter(m=>m.command===o);for(const m of a)for(const c of s)e.push(`extension_command_override_handler_overlap:${o}:${m.layer}:${m.name}:${c.layer}:${c.name}`)}return e}function ye(r){const e=new Map;for(const n of r.overrides){const i=e.get(n.format)??[];i.push(n),e.set(n.format,i)}const t=[];for(const n of[...e.keys()].sort((i,o)=>i.localeCompare(o))){const i=e.get(n);if(i.length<=1)continue;const o=i[i.length-1];for(const s of i.slice(0,-1))o.commands?.length&&s.commands?.length&&!s.commands.some(a=>o.commands?.includes(a))||t.push(`extension_renderer_collision:${n}:${o.layer}:${o.name}:${s.layer}:${s.name}`)}return t}function _e(r){const e=[],t=new Map;for(const n of r.overrides){const i=t.get(n.command)??[];i.push(n),t.set(n.command,i)}for(const n of[...t.keys()].sort((i,o)=>i.localeCompare(o))){const i=t.get(n);if(i.length<=1)continue;const o=i[i.length-1];for(const s of i.slice(0,-1))e.push(`extension_parser_override_collision:${n}:${o.layer}:${o.name}:${s.layer}:${s.name}`)}return e}const Vr=new Set(["output_format"]);function ve(r){const e=[],t=new Map;for(const n of r.overrides){const i=t.get(n.service)??[];i.push(n),t.set(n.service,i)}for(const n of[...t.keys()].sort((i,o)=>i.localeCompare(o))){const i=t.get(n);if(i.length<=1||Vr.has(n))continue;const o=i[i.length-1];for(const s of i.slice(0,-1))e.push(`extension_service_override_collision:${n}:${o.layer}:${o.name}:${s.layer}:${s.name}`)}return e}async function xt(r){const e=Ve(r.policy??Er),t=Be(),n=Le(),i=Ue(),o=Ke(),s=Je(),a=Ge(),m=Xe(),c=[],l=[];for(const u of r.loaded){const f=ue(u.module);if(!f)continue;const g=c.length,v=Pe({hooks:t,commands:n,parsers:i,preflight:o,services:s,renderers:a,registrations:m});try{await f.activate(pe(u,t,n,i,o,s,a,m,l,c,e)),c.length>g&&(v(),l.push(`extension_activation_rolled_back:${u.layer}:${u.name}`))}catch(_){v(),l.push(`extension_activate_failed:${u.layer}:${u.name}`);const A=J(_);c.push({layer:u.layer,name:u.name,entry_path:u.entry_path,error:M(_),trace:A})}}const d=[...ge(n),..._e(i),...or(o),...ve(s),...ye(a)],h=[...new Set([...l,...d])];return{hooks:t,commands:n,parsers:i,preflight:o,services:s,renderers:a,registrations:m,failed:c,warnings:h,hook_counts:{before_command:t.beforeCommand.length,before_mutation:t.beforeMutation.length,after_command:t.afterCommand.length,on_write:t.onWrite.length,on_read:t.onRead.length,on_index:t.onIndex.length},command_override_count:n.overrides.length,command_handler_count:n.handlers.length,parser_override_count:i.overrides.length,preflight_override_count:o.overrides.length,service_override_count:s.overrides.length,renderer_override_count:a.overrides.length,registration_counts:fe(m)}}const Et={assertFlagValueTypeAndDefault:cr,assertOptionalStringField:$,compareComparableVersions:_r,collectCommandCollisionWarnings:ge,collectParserCollisionWarnings:_e,collectRendererCollisionWarnings:ye,collectServiceCollisionWarnings:ve,createExtensionApi:pe,createRegistrationValidationError:y,evaluatePmMaxVersionCompatibility:ce,evaluatePmMinVersionCompatibility:me,extractRegistrationValidationTrace:J,fingerprintPath:j,getRegistrationCounts:fe,normalizeCommandDefinitionArguments:T,normalizeExtensionDeactivateTimeout:he,normalizeOptionalStringArrayField:C,normalizeRegistrationRecord:R,normalizeRegistrationRecordList:z,normalizeRuntimeRegistrationRecord:k,parseComparableVersion:xr,parseManifest:X,readCurrentPmCliVersion:oe,readManagedExtensionSourcePackages:async r=>new Map([...await te(r)].filter(e=>typeof e[1].package_name=="string").map(([e,t])=>[e,t.package_name])),resolveExtensionImportHref:le,resolveCurrentPmCliVersion:N,resolveCommandDefinitionAction:F,sanitizeRegistrationValue:Q,validateItemFieldDefinitions:G,resetCurrentPmCliVersionCacheForTest:()=>{W=null}};export{Yt as DEFAULT_EXTENSION_PRIORITY,Et as _testOnlyLoader,xt as activateExtensions,Pt as createEmptyExtensionCommandRegistry,St as createEmptyExtensionHookRegistry,It as createEmptyExtensionParserRegistry,Mt as createEmptyExtensionPreflightRegistry,At as createEmptyExtensionRegistrationRegistry,Tt as createEmptyExtensionRendererRegistry,Dt as createEmptyExtensionServiceRegistry,wt as deactivateExtensions,Tr as discoverExtensions,Rr as isCanonicalPathWithinDirectory,vt as loadExtensions,br as nextExtensionReloadToken,Qt as parseExtensionManifestDocument,Rt as parseLegacyExtensionCapabilityAliasWarning,kt as parseUnknownExtensionCapabilityWarning,kr as resolveExtensionRoots,Ot as runAfterCommandHooks,zt as runBeforeCommandHooks,Wt as runBeforeMutationHooks,Nt as runCommandHandler,jt as runCommandOverride,Vt as runOnIndexHooks,qt as runOnReadHooks,Ht as runOnWriteHooks,Lt as runParserOverride,Bt as runPreflightOverride,Ut as runRendererOverride,Kt as runServiceOverride,Xt as runServiceOverrideSync};
2
2
  //# sourceMappingURL=loader.js.map
@@ -17,6 +17,14 @@ export declare function isFileAbsentError(error:unknown):boolean;
17
17
  export declare function isFileMissingError(error:unknown):boolean;
18
18
  /** Implements read file if exists for the public runtime surface of this module. */
19
19
  export declare function readFileIfExists(targetPath:string):Promise<string|null>;
20
+ /**
21
+ * Read an optional file without blocking on a special one: null when it is
22
+ * absent, its UTF-8 text when it is a regular file, and a thrown error for
23
+ * anything else. The open is non-blocking where Node exposes O_NONBLOCK, so a
24
+ * named pipe with no writer fails like a directory instead of stalling the
25
+ * read. Links are followed.
26
+ */
27
+ export declare function readOptionalRegularFile(targetPath:string):Promise<string|null>;
20
28
  /**
21
29
  * Read UTF-8 bytes after checking that the opened descriptor is a regular file.
22
30
  * Callers validate entries, ancestors and optional-file absence before opening.
@@ -1,3 +1,3 @@
1
- import*as n from"node:fs/promises";import{constants as w}from"node:fs";import c from"node:path";import y from"node:crypto";import{EXIT_CODE as h}from"../shared/constants.js";import{PmCliError as E}from"../shared/errors.js";const _=[10,25,50,100];async function p(e){await n.mkdir(e,{recursive:!0})}async function A(e){try{return await n.access(e),!0}catch{return!1}}function m(e){return g(e)||l(e,"ENOTDIR")}function g(e){return l(e,"ENOENT")}async function N(e){try{return await n.readFile(e,"utf8")}catch(t){if(m(t))return null;throw t}}async function R(e,t){const r=await n.open(e,w.O_RDONLY|w.O_NOFOLLOW|w.O_NONBLOCK);try{if(!(await r.stat()).isFile())throw t;return await r.readFile("utf8")}finally{await r.close()}}function D(e){const t=e?.replaceAll(c.sep,"/"),r=t!==void 0&&!c.posix.isAbsolute(t)&&!c.win32.isAbsolute(t)&&!t.split("/").includes(".."),o=r?t.split("/")[0]:void 0,i={"settings.json":"settings",runtime:"runtime",schema:"schema",history:"history",transactions:"transactions"},a=o===void 0?"tracker_storage":Object.hasOwn(i,o)?i[o]:"tracker_storage",u=r&&t.length>0&&t.length<=160&&t.split("/").every(s=>s!=="."&&/^[a-zA-Z0-9_.-]+$/u.test(s)),f=u?t:`${a} (entry name redacted)`;return new E(`Transaction preview requires regular files and directories. Inspect ${f} relative to the selected tracker root.`,h.USAGE,{code:"transaction_preview_non_regular_file",preview_storage:{storage_area:a,...u?{relative_entry:t}:{},entry_redacted:!u},required:"regular files and directories within the configured tracker storage",why:"Preview does not follow linked entries or read special files.",nextSteps:[`Inspect ${f} within the selected tracker for links, directories used as files, or special files; do not follow link targets.`,"Restore the intended regular files and directories, then retry the original dry-run command."]})}async function d(e){try{await n.unlink(e)}catch{}}async function $(e,t,r={}){const o=c.dirname(e);r.createParentDirectories!==!1&&await p(o);const i=c.join(o,`.${c.basename(e)}.${process.pid}.${Date.now()}.${y.randomBytes(4).toString("hex")}.tmp`);try{await n.writeFile(i,t,r.mode===void 0?"utf8":{encoding:"utf8",mode:r.mode})}catch(a){throw await d(i),a}try{await n.rename(i,e)}catch(a){if(process.platform==="win32"&&(l(a,"EPERM")||l(a,"EBUSY"))){let u=a;for(const f of _){await new Promise(s=>setTimeout(s,f));try{await n.rename(i,e);return}catch(s){if(u=s,!l(s,"EPERM")&&!l(s,"EBUSY"))break}}throw await d(i),u}if(l(a,"EXDEV")){try{await n.copyFile(i,e)}finally{await d(i)}return}throw await d(i),a}}async function S(e,t){const r=c.dirname(e);await p(r);const o=await n.open(e,"a");try{await o.writeFile(`${t}
2
- `,"utf8")}finally{await o.close()}}async function b(e){try{await n.unlink(e)}catch(t){if(!m(t))throw t}}function l(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}export{S as appendLineAtomic,p as ensureDir,m as isFileAbsentError,g as isFileMissingError,A as pathExists,N as readFileIfExists,R as readRegularFile,b as removeFileIfExists,D as transactionPreviewNonRegularFileError,$ as writeFileAtomic};
1
+ import*as i from"node:fs/promises";import{constants as f}from"node:fs";import c from"node:path";import m from"node:crypto";import{EXIT_CODE as h}from"../shared/constants.js";import{PmCliError as E}from"../shared/errors.js";const O=[10,25,50,100];async function y(e){await i.mkdir(e,{recursive:!0})}async function R(e){try{return await i.access(e),!0}catch{return!1}}function p(e){return _(e)||l(e,"ENOTDIR")}function _(e){return l(e,"ENOENT")}async function v(e){try{return await i.readFile(e,"utf8")}catch(t){if(p(t))return null;throw t}}async function A(e){let t;try{t=await i.open(e,f.O_RDONLY|f.O_NONBLOCK)}catch(r){if(p(r))return null;throw r}try{if(!(await t.stat()).isFile())throw new Error(`Not a regular file: ${e}`);return await t.readFile("utf8")}finally{await t.close()}}async function D(e,t){const r=await i.open(e,f.O_RDONLY|f.O_NOFOLLOW|f.O_NONBLOCK);try{if(!(await r.stat()).isFile())throw t;return await r.readFile("utf8")}finally{await r.close()}}function $(e){const t=e?.replaceAll(c.sep,"/"),r=t!==void 0&&!c.posix.isAbsolute(t)&&!c.win32.isAbsolute(t)&&!t.split("/").includes(".."),o=r?t.split("/")[0]:void 0,n={"settings.json":"settings",runtime:"runtime",schema:"schema",history:"history",transactions:"transactions"},a=o===void 0?"tracker_storage":Object.hasOwn(n,o)?n[o]:"tracker_storage",u=r&&t.length>0&&t.length<=160&&t.split("/").every(s=>s!=="."&&/^[a-zA-Z0-9_.-]+$/u.test(s)),d=u?t:`${a} (entry name redacted)`;return new E(`Transaction preview requires regular files and directories. Inspect ${d} relative to the selected tracker root.`,h.USAGE,{code:"transaction_preview_non_regular_file",preview_storage:{storage_area:a,...u?{relative_entry:t}:{},entry_redacted:!u},required:"regular files and directories within the configured tracker storage",why:"Preview does not follow linked entries or read special files.",nextSteps:[`Inspect ${d} within the selected tracker for links, directories used as files, or special files; do not follow link targets.`,"Restore the intended regular files and directories, then retry the original dry-run command."]})}async function w(e){try{await i.unlink(e)}catch{}}async function L(e,t,r={}){const o=c.dirname(e);r.createParentDirectories!==!1&&await y(o);const n=c.join(o,`.${c.basename(e)}.${process.pid}.${Date.now()}.${m.randomBytes(4).toString("hex")}.tmp`);try{await i.writeFile(n,t,r.mode===void 0?"utf8":{encoding:"utf8",mode:r.mode})}catch(a){throw await w(n),a}try{await i.rename(n,e)}catch(a){if(process.platform==="win32"&&(l(a,"EPERM")||l(a,"EBUSY"))){let u=a;for(const d of O){await new Promise(s=>setTimeout(s,d));try{await i.rename(n,e);return}catch(s){if(u=s,!l(s,"EPERM")&&!l(s,"EBUSY"))break}}throw await w(n),u}if(l(a,"EXDEV")){try{await i.copyFile(n,e)}finally{await w(n)}return}throw await w(n),a}}async function S(e,t){const r=c.dirname(e);await y(r);const o=await i.open(e,"a");try{await o.writeFile(`${t}
2
+ `,"utf8")}finally{await o.close()}}async function b(e){try{await i.unlink(e)}catch(t){if(!p(t))throw t}}function l(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}export{S as appendLineAtomic,y as ensureDir,p as isFileAbsentError,_ as isFileMissingError,R as pathExists,v as readFileIfExists,A as readOptionalRegularFile,D as readRegularFile,b as removeFileIfExists,$ as transactionPreviewNonRegularFileError,L as writeFileAtomic};
3
3
  //# sourceMappingURL=fs-utils.js.map
@@ -0,0 +1,2 @@
1
+ import{parseItemExecutionRole as $}from"./item-type-definition.js";function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function r(e){try{return JSON.stringify(e)??String(e)}catch{return"a value that cannot be shown"}}function d(e,t,n,i){const o=e[t];if(o===void 0)return;if(!Array.isArray(o)){i.push(`${n}${t}: is not a list`);return}for(const u of o)typeof u!="string"?i.push(`${n}${t}: ${r(u)} is not a string`):u.trim().length===0&&i.push(`${n}${t}: ${r(u)} is blank`);const s=o.filter(u=>typeof u=="string"&&u.trim().length>0);return s.length===0&&o.length>0?void 0:s}function f(e,t,n,i){const o=e[t];if(o===void 0||typeof o=="string")return o;i.push(`${n}${t}: is not a string`)}function a(e,t,n,i,o){const s=e[t];if(s===void 0||typeof s=="boolean")return s;const u=o==="extension"?!!s:void 0;return i.push(`${n}${t}: ${r(s)} is not a boolean, so ${u===void 0?"it is ignored":`it reads as ${String(u)}`}`),u}function p(e){return typeof e=="string"&&e.trim().length>0}function _(e,t,n,i){if(!l(e)||!p(e.key))return n.push(`${t}: ${r(e)} is not an option with a key`),null;const o=`${t}.`,s=d(e,"values",o,n);return e.values!==void 0&&s===void 0?(n.push(`${t}: values has no usable value, so the option is dropped`),null):{key:e.key,values:s??[],required:a(e,"required",o,n,i),aliases:d(e,"aliases",o,n),description:f(e,"description",o,n)}}function g(e,t,n,i){const o=l(e)&&typeof e.command=="string"?e.command.trim().toLowerCase():void 0;if(!l(e)||o!=="create"&&o!=="update"||!p(e.option))return n.push(`${t}: ${r(e)} is not a create or update policy with an option`),null;const s=`${t}.`,u=n.length,c={command:o,option:e.option,required:a(e,"required",s,n,i),visible:a(e,"visible",s,n,i),enabled:a(e,"enabled",s,n,i)};return i==="schema_file"&&n.length>u?(n.push(`${t}: has a switch that is not a boolean, so the policy is dropped`),null):c}function h(e,t,n,i,o){const s=e[t];if(s===void 0)return;if(!Array.isArray(s)){n.push(`${t}: is not a list`);return}const u=s.flatMap((c,y)=>o(c,`${t}[${y}]`,n,i)??[]);return u.length===0&&s.length>0?void 0:u}function m(e,t,n){const i=e.execution_role;return t==="extension"||i===void 0||i==="agent"||i==="human"||i==="gate"?$(i):(n.push(`execution_role: ${r(i)} is not agent, human or gate, so the type reads as human and is never offered for agent dispatch`),"human")}function b(e,t){if(!l(e))return{definition:null,loss:{dropped:"not_an_object",ignored:[]}};if(typeof e.name!="string"||e.name.trim().length===0)return{definition:null,loss:{dropped:"name_empty",ignored:[]}};const n=[];return{definition:{name:e.name,description:f(e,"description","",n),default_status:f(e,"default_status","",n),execution_role:m(e,t,n),folder:f(e,"folder","",n),aliases:d(e,"aliases","",n),required_create_fields:d(e,"required_create_fields","",n),required_create_repeatables:d(e,"required_create_repeatables","",n),options:h(e,"options",n,t,_),command_option_policies:h(e,"command_option_policies",n,t,g)},loss:{ignored:n}}}export{b as inspectItemTypeDefinition};
2
+ //# sourceMappingURL=item-type-inspection.js.map