@unbrained/pm-cli 2026.11.19 → 2026.11.20

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 (106) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/AGENTS.md +1 -1
  3. package/dist/cli-bundle/bundle-manifest.json +1 -1
  4. package/dist/cli-bundle/chunks/{chunk-IUTN67EB.js → chunk-2IZGNOGT.js} +2 -2
  5. package/dist/cli-bundle/chunks/{chunk-4FNMPZ7Y.js → chunk-3BOR22MC.js} +2 -2
  6. package/dist/cli-bundle/chunks/{chunk-CTOE26W4.js → chunk-4QQPM3IY.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-N2CPCFSN.js → chunk-4TZW4NLM.js} +2 -2
  8. package/dist/cli-bundle/chunks/{chunk-AMHD7WIV.js → chunk-5LF5QZT3.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-CNMGGAZO.js → chunk-6HRPGEBF.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-P4A5RFLX.js → chunk-6X2AGUOT.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-723PMYNX.js → chunk-7ESF676D.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-OESI2ETD.js → chunk-7EZZ4W7O.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-Z5LHCEXG.js → chunk-DG2EOOFX.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-O7IFAJ76.js → chunk-FF4TXJDH.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-7UUPLMCU.js → chunk-FOYRE23V.js} +46 -46
  16. package/dist/cli-bundle/chunks/{chunk-PRVT7ITI.js → chunk-GXGW6KHB.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-M76BEWTT.js → chunk-HJQ3XPS3.js} +28 -28
  18. package/dist/cli-bundle/chunks/{chunk-IQKCRLQP.js → chunk-KDDIHGAO.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-2UTJ5QIE.js → chunk-KEBLUTC3.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-GQCMICAL.js → chunk-KQSPKWFH.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-AOV5HG3Y.js → chunk-M5D3CEMY.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-XPBPGDFW.js → chunk-MGYAJONE.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-CR5GC3VO.js → chunk-OXG5XPC7.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-H64BNM4A.js → chunk-W4TLA5H3.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-AGPFANRX.js → chunk-XK25TAJZ.js} +4 -4
  26. package/dist/cli-bundle/chunks/{chunk-Q32Q3LRH.js → chunk-ZAO7VGX3.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-NMVPQTZI.js → chunk-ZVEHACE6.js} +2 -2
  28. package/dist/cli-bundle/chunks/{item-revision-YJKGOYBR.js → item-revision-GE2CQECR.js} +2 -2
  29. package/dist/cli-bundle/chunks/item-transaction-YSAWJRA2.js +2 -0
  30. package/dist/cli-bundle/chunks/{mutation-actor-DDYJW5B4.js → mutation-actor-5GYX7LP3.js} +2 -2
  31. package/dist/cli-bundle/chunks/{mutation-admission-JLMQJ2M5.js → mutation-admission-72TYKPGU.js} +2 -2
  32. package/dist/cli-bundle/chunks/{register-list-query-4AXLLXK7.js → register-list-query-OQZZEWEB.js} +2 -2
  33. package/dist/cli-bundle/chunks/{register-mutation-FJIXGGF4.js → register-mutation-YZEUZ6XT.js} +2 -2
  34. package/dist/cli-bundle/chunks/{register-operations-W4E2KEMA.js → register-operations-JNVCF7EW.js} +2 -2
  35. package/dist/cli-bundle/chunks/{register-setup-RYRIBNSN.js → register-setup-LDKULZSD.js} +2 -2
  36. package/dist/cli-bundle/chunks/{stage-XGWW3T64.js → stage-Q2QZ2IBG.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-7A4VIRIU.js → chunk-3LRSQXCN.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-EZXLY6S4.js → chunk-5VSXKA35.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-2XULTI5B.js → chunk-7SB6VKEI.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-MTBC32ZR.js → chunk-BZCLW5V7.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-ICEHI4SN.js → chunk-FPKVHC3Q.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-HO2YUD4P.js → chunk-I7XBR2RM.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/{chunk-XS2YZCT5.js → chunk-JUYJ7NXL.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/{chunk-ZFUZ4YYN.js → chunk-KQJNJZKP.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-7RF2YPZ5.js → chunk-MJP3TFVW.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-4S7I342K.js → chunk-O25KFLLA.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-7Z2NYAK4.js → chunk-PKMDWIP3.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-D72EQN7Z.js → chunk-PQXTZLK3.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-N64BUB63.js → chunk-PRFEOCNZ.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-A2CLYPDA.js → chunk-PZSTRYTA.js} +40 -40
  51. package/dist/cli-bundle/focused-chunks/{chunk-GAOWBALE.js → chunk-QNJQPJWO.js} +4 -4
  52. package/dist/cli-bundle/focused-chunks/{chunk-5JVB42Z7.js → chunk-SIPDQBJI.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-FPPYE6CY.js → chunk-SJE3PYPI.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-77CDWGBW.js → chunk-TNKI6WKG.js} +48 -48
  55. package/dist/cli-bundle/focused-chunks/{chunk-P4TG4VMJ.js → chunk-TRCXANRR.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-OF4UM5B6.js → chunk-UATP3RK3.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-OPY43DNJ.js → chunk-V55XZFOP.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-OAIAZHRG.js → chunk-ZKGGGU2K.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{item-revision-32HFGFYG.js → item-revision-OXDZHMJ7.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{item-transaction-C4VW3SHX.js → item-transaction-54VSTT6L.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{mutation-actor-2SVBO324.js → mutation-actor-6DYIF6NH.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{mutation-admission-PNK6ORZR.js → mutation-admission-2BYXANVJ.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{stage-LVAGKCEE.js → stage-FGHSB3QX.js} +2 -2
  64. package/dist/cli-bundle/main.js +2 -2
  65. package/dist/cli-bundle/sdk-authoring.js +1 -1
  66. package/dist/cli-bundle/sdk-contracts.js +1 -1
  67. package/dist/cli-bundle/sdk-core.js +1 -1
  68. package/dist/cli-bundle/sdk-governance.js +1 -1
  69. package/dist/cli-bundle/sdk-graph.js +1 -1
  70. package/dist/cli-bundle/sdk-merge.js +55 -55
  71. package/dist/cli-bundle/sdk-query.js +1 -1
  72. package/dist/cli-bundle/sdk-runtime.js +1 -1
  73. package/dist/cli-bundle/sdk-testing.js +1 -1
  74. package/dist/cli-bundle/sdk.js +1 -1
  75. package/dist/core/fs/file-glob.js +1 -1
  76. package/dist/core/shared/text-normalization.d.ts +9 -0
  77. package/dist/core/shared/text-normalization.js +1 -1
  78. package/dist/sdk/context-intent-contracts.js +1 -1
  79. package/dist/sdk/read-output/continuation.d.ts +9 -3
  80. package/dist/sdk/read-output/continuation.js +1 -1
  81. package/dist/sdk/read-output-budget.d.ts +44 -3
  82. package/dist/sdk/read-output-budget.js +1 -1
  83. package/dist/sdk/read-output-contracts.js +1 -1
  84. package/docs/READ_OUTPUT_CONTRACTS.md +16 -1
  85. package/marketplace.json +1 -1
  86. package/package.json +1 -1
  87. package/packages/pm-beads/package.json +1 -1
  88. package/packages/pm-calendar/package.json +1 -1
  89. package/packages/pm-command-kit/package.json +1 -1
  90. package/packages/pm-digital-twin/package.json +1 -1
  91. package/packages/pm-governance-audit/package.json +1 -1
  92. package/packages/pm-guide-shell/package.json +1 -1
  93. package/packages/pm-kanban/package.json +1 -1
  94. package/packages/pm-lifecycle-hooks/package.json +1 -1
  95. package/packages/pm-linked-test-adapters/package.json +1 -1
  96. package/packages/pm-search-advanced/package.json +1 -1
  97. package/packages/pm-templates/package.json +1 -1
  98. package/packages/pm-todos/package.json +1 -1
  99. package/packages/pm-vcs/package.json +1 -1
  100. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  101. package/plugins/pm-claude/package.json +1 -1
  102. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  103. package/plugins/pm-codex/package.json +1 -1
  104. package/plugins/pm-codex/plugin.json +1 -1
  105. package/runtime-dependencies.json +1 -1
  106. package/dist/cli-bundle/chunks/item-transaction-K4YZ7GWR.js +0 -2
@@ -1,2 +1,2 @@
1
- import{$ as To,Aa as Mo,B as p,Ba as Ro,C as Qe,Ca as Ao,D as Ye,Da as Po,E as Ze,Ea as Bo,F as $e,Fa as Oo,G as eo,Ga as Uo,H as oo,Ha as Wo,I as to,Ia as jo,J as ro,Ja as Lo,K as no,Ka as No,L as fo,La as Vo,M as po,Ma as zo,N as ao,Na as Xo,O as mo,Oa as qo,P as so,Pa as Go,Q as io,Qa as Ho,R as xo,Ra as Jo,S as lo,Sa as Ko,T as uo,Ta as Qo,U as co,Ua as Yo,V as yo,Va as Zo,W as go,Wa as $o,X as bo,Xa as k,Y as Co,Ya as E,Z as Io,Za as D,_ as wo,a as Oe,aa as ho,b as Ue,ba as _o,c as We,ca as a,d as je,da as m,e as Le,ea as d,f as Ne,fa as s,g as Ve,ga as i,h as ze,ha as x,i as Xe,ia as l,ja as u,ka as c,la as y,ma as g,na as b,oa as C,pa as I,qa as w,r as qe,ra as T,s as Ge,sa as h,t as He,ta as _,u as Je,ua as ko,v as Ke,va as Eo,wa as Do,xa as vo,ya as Fo,za as So}from"./focused-chunks/chunk-P4TG4VMJ.js";import{D as f,a as Ie,b as we,c as Te,d as he,e as _e,f as ke,g as Ee,p as De,q as ve,r as Fe,s as Se,t as Me,u as Re,v as Ae,w as Pe,x as Be}from"./focused-chunks/chunk-7A4VIRIU.js";import"./focused-chunks/chunk-OAIAZHRG.js";import{Ja as n,ua as re}from"./focused-chunks/chunk-N64BUB63.js";import{b as v,c as F,d as S,e as M,g as R,h as A,j as P}from"./focused-chunks/chunk-ICEHI4SN.js";import"./focused-chunks/chunk-7Z2NYAK4.js";import{a as ie,b as xe,c as le,d as ue,e as ce,f as ye,g as ge,h as be,i as Ce}from"./focused-chunks/chunk-OPY43DNJ.js";import"./focused-chunks/chunk-GHQVM6K6.js";import{A as pe,B as ae,D as me,E as de,F as se,w as r,y as ne,z as fe}from"./focused-chunks/chunk-HO2YUD4P.js";import"./focused-chunks/chunk-MTBC32ZR.js";import"./focused-chunks/chunk-I5LGPUWH.js";import"./focused-chunks/chunk-C3O6JJPO.js";import{$g as z,Be as O,Vg as U,Wg as W,Xg as j,Yg as L,Zg as N,_g as V,ah as X,bh as q,ch as G,dh as H,eh as J,fh as K,gh as Q,hh as Y,ih as Z,jh as $,kh as ee,lh as oe,mh as te,pe as B}from"./focused-chunks/chunk-A2CLYPDA.js";import"./focused-chunks/chunk-IXYBN6D2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="d45a8203-4501-5797-a6cc-a2e7844adec9")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="e02d896b-ffa2-5bfa-83dc-d567e1ecd8be")}catch{}})();export{xe as ACTIONABILITY_ORDERING_KINDS,F as BRIEF_LIST_FIELDS,to as CONTEXT_EVALUATION_METRIC_NAMES,a as CONTEXT_OUTPUT_VALUES,ao as CONTEXT_PACKING_PROFILES,Ze as CONTEXT_RELEVANCE_SERVICE,Qe as CONTEXT_RELEVANCE_SIGNAL_NAMES,io as CONTEXT_SIGNAL_SET_VERSION,so as CONTEXT_SIGNAL_STORE_FORMAT_VERSION,xo as CONTEXT_SIGNAL_STORE_WARNING_DETAILS,G as CONTEXT_USAGE_LIMITS,yo as ContextSignalStore,H as ContextUsageValidationError,Po as DEFAULT_CHILD_SAMPLE_LIMIT,v as DEFAULT_COMPACT_LIST_FIELDS,ae as DEFAULT_DERIVED_INDEX_MINIMUM_ITEMS,bo as DEFAULT_WORKSPACE_MEMORY_MINIMUM_ITEMS,k as EVAL_METRIC_NAMES,A as GET_DEPTH_INPUT_VALUES,R as GET_DEPTH_VALUES,co as JsonFileContextSignalStoreAdapter,S as LIST_COMMAND_DEFAULT_PROJECTIONS,Fe as LIST_SORT_FIELDS,Se as LIST_SORT_ORDER_VALUES,Ao as MAX_CHILD_PROJECTION_ITEMS,ko as NEXT_OUTPUT_VALUES,qe as NEXT_RANKING_POLICIES,Oe as OutputEnvelopeFitError,We as PM_COMPLETE_LIST_FINDING_CODES,je as PmCompleteListValidationError,q as QUERY_CURSOR_CONTRACT,Be as _testOnly,Ro as _testOnlyAggregateCommand,Uo as _testOnlyGetCommand,Do as _testOnlyNextCommand,Zo as _testOnlySearchCommand,me as acquireItemMetadataDerivedIndexLock,f as analyzeDuplicateItems,h as applyContextTagProjection,Me as applyFilterValueEcho,ze as assertCompleteListResult,J as attachContextUsageServingReceipt,C as buildChildrenByParent,Go as buildCompactSearchFilterSummary,Re as buildContentFilterEcho,uo as buildContextSignalSnapshot,Ae as buildGovernanceMissingFilterEcho,Bo as buildItemChildrenRollup,Ye as buildItemContextRelevanceCandidates,Ho as buildVerboseSearchFilters,Co as buildWorkspaceMemorySnapshot,Ve as certifyCompleteListResult,Ko as classifyImplicitSemanticFallbackReason,le as collectBlockedByIds,ce as collectBlockedByIdsFromCorpus,Q as collectContextUsageDeliveredItemIds,ge as collectDependencyBlockedIds,Jo as collectErrorCauseCodes,u as collectSubtreeIds,c as compareCriticalItems,Ce as computeActionabilityReport,Le as createCompleteListOptions,W as createQueryFingerprint,Xo as createSearchCursorFingerprint,V as decodeQueryCursor,L as decodeQueryCursorEnvelope,N as decodeQueryCursorState,$e as defaultScoreContextCandidates,j as encodeQueryCursor,ro as evaluateContextRanking,D as evaluateMetricFloors,n as executeEmbeddingBatchesWithRetry,Y as finalizeContextUsageDelivery,Ue as fitOutputEnvelope,Yo as formatVectorIndexRecoveryWarnings,ue as indexBlockedByIds,Ne as inspectCompleteListResult,P as listGetProjectionFields,M as listListProjectionFields,r as measureItemMetadataReadWork,w as mergeSortedWarnings,mo as packContextCandidates,y as packRankedContextItems,X as paginateQueryRows,x as parseContextDepth,m as parseContextFocusFields,l as parseContextSections,lo as parseContextSignalSnapshot,E as parseEvalMetricFloors,Ie as parseIntegerLimit,re as parseLimit,he as parseMultiValueFilter,we as parsePriority,Ee as parsePriorityFilterSet,_e as parseStringFilterSet,Te as parseType,ke as parseTypeFilterSet,vo as partitionDecisionEntries,d as projectContextFocusRows,K as propagateContextUsageServingReceipt,ne as queryItemMetadataIndex,fe as queryLinkedFileMetadataIndex,pe as querySimilarItemMetadataIndex,te as readContextUsageAffinity,B as readHistoryEntries,de as readItemMetadataDerivedIndexState,go as readWorkspaceContextSignals,Io as readWorkspaceMemory,$ as recordContextUsageDelivery,Z as recordContextUsageServing,ee as recordContextUsageTouch,oe as recordContextUsageTouches,se as refreshItemMetadataDerivedIndex,He as renderCalendarMarkdown,Je as renderCalendarToon,T as renderContextMarkdown,So as renderNextMarkdown,Ge as resolveCalendarOutputFormat,ve as resolveContentFieldFilters,s as resolveContextOutputFormat,i as resolveContextTokenBudget,Lo as resolveEffectiveSearchMode,Vo as resolveHybridSemanticWeight,ye as resolveItemBlockers,ie as resolveItemExecutionRole,De as resolveMissingMetadataFilters,Eo as resolveNextOutputFormat,z as resolveQueryCursorStart,jo as resolveSearchMaxResults,qo as resolveSearchPage,No as resolveSearchScoreThreshold,zo as resolveSearchTuning,Qo as resolveVectorIndexRecovery,p as runActivity,Mo as runAggregate,Ke as runCalendar,_ as runContext,po as runContextEvaluationCorpus,no as runContextEvaluationScenario,Xe as runDuplicates,Oo as runGet,Wo as runHistory,Pe as runList,Fo as runNext,$o as runSearch,eo as scoreContextCandidates,oo as scoreContextCandidatesWithActiveExtensions,ho as searchWorkspaceMemory,_o as searchWorkspaceMemoryReadResult,be as selectActionableEntries,U as selectCursorSemanticOptions,To as selectWorkspaceMemory,wo as selectWorkspaceMemoryRollups,fo as summarizeContextEvaluationReports,I as toContextFocusItem,g as toContextPackingSummary,b as toContextRankingSummary,O as verifyHistoryChain};
1
+ import{$ as To,Aa as Mo,B as p,Ba as Ro,C as Qe,Ca as Ao,D as Ye,Da as Po,E as Ze,Ea as Bo,F as $e,Fa as Oo,G as eo,Ga as Uo,H as oo,Ha as Wo,I as to,Ia as jo,J as ro,Ja as Lo,K as no,Ka as No,L as fo,La as Vo,M as po,Ma as zo,N as ao,Na as Xo,O as mo,Oa as qo,P as so,Pa as Go,Q as io,Qa as Ho,R as xo,Ra as Jo,S as lo,Sa as Ko,T as uo,Ta as Qo,U as co,Ua as Yo,V as yo,Va as Zo,W as go,Wa as $o,X as bo,Xa as k,Y as Co,Ya as E,Z as Io,Za as D,_ as wo,a as Oe,aa as ho,b as Ue,ba as _o,c as We,ca as a,d as je,da as m,e as Le,ea as d,f as Ne,fa as s,g as Ve,ga as i,h as ze,ha as x,i as Xe,ia as l,ja as u,ka as c,la as y,ma as g,na as b,oa as C,pa as I,qa as w,r as qe,ra as T,s as Ge,sa as h,t as He,ta as _,u as Je,ua as ko,v as Ke,va as Eo,wa as Do,xa as vo,ya as Fo,za as So}from"./focused-chunks/chunk-TRCXANRR.js";import{D as f,a as Ie,b as we,c as Te,d as he,e as _e,f as ke,g as Ee,p as De,q as ve,r as Fe,s as Se,t as Me,u as Re,v as Ae,w as Pe,x as Be}from"./focused-chunks/chunk-3LRSQXCN.js";import"./focused-chunks/chunk-ZKGGGU2K.js";import{Ja as n,ua as re}from"./focused-chunks/chunk-PRFEOCNZ.js";import{b as v,c as F,d as S,e as M,g as R,h as A,j as P}from"./focused-chunks/chunk-FPKVHC3Q.js";import"./focused-chunks/chunk-PKMDWIP3.js";import{a as ie,b as xe,c as le,d as ue,e as ce,f as ye,g as ge,h as be,i as Ce}from"./focused-chunks/chunk-V55XZFOP.js";import"./focused-chunks/chunk-GHQVM6K6.js";import{A as pe,B as ae,D as me,E as de,F as se,w as r,y as ne,z as fe}from"./focused-chunks/chunk-I7XBR2RM.js";import"./focused-chunks/chunk-BZCLW5V7.js";import"./focused-chunks/chunk-I5LGPUWH.js";import"./focused-chunks/chunk-C3O6JJPO.js";import{$g as z,Be as O,Vg as U,Wg as W,Xg as j,Yg as L,Zg as N,_g as V,ah as X,bh as q,ch as G,dh as H,eh as J,fh as K,gh as Q,hh as Y,ih as Z,jh as $,kh as ee,lh as oe,mh as te,pe as B}from"./focused-chunks/chunk-PZSTRYTA.js";import"./focused-chunks/chunk-IXYBN6D2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="d45a8203-4501-5797-a6cc-a2e7844adec9")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="e02d896b-ffa2-5bfa-83dc-d567e1ecd8be")}catch{}})();export{xe as ACTIONABILITY_ORDERING_KINDS,F as BRIEF_LIST_FIELDS,to as CONTEXT_EVALUATION_METRIC_NAMES,a as CONTEXT_OUTPUT_VALUES,ao as CONTEXT_PACKING_PROFILES,Ze as CONTEXT_RELEVANCE_SERVICE,Qe as CONTEXT_RELEVANCE_SIGNAL_NAMES,io as CONTEXT_SIGNAL_SET_VERSION,so as CONTEXT_SIGNAL_STORE_FORMAT_VERSION,xo as CONTEXT_SIGNAL_STORE_WARNING_DETAILS,G as CONTEXT_USAGE_LIMITS,yo as ContextSignalStore,H as ContextUsageValidationError,Po as DEFAULT_CHILD_SAMPLE_LIMIT,v as DEFAULT_COMPACT_LIST_FIELDS,ae as DEFAULT_DERIVED_INDEX_MINIMUM_ITEMS,bo as DEFAULT_WORKSPACE_MEMORY_MINIMUM_ITEMS,k as EVAL_METRIC_NAMES,A as GET_DEPTH_INPUT_VALUES,R as GET_DEPTH_VALUES,co as JsonFileContextSignalStoreAdapter,S as LIST_COMMAND_DEFAULT_PROJECTIONS,Fe as LIST_SORT_FIELDS,Se as LIST_SORT_ORDER_VALUES,Ao as MAX_CHILD_PROJECTION_ITEMS,ko as NEXT_OUTPUT_VALUES,qe as NEXT_RANKING_POLICIES,Oe as OutputEnvelopeFitError,We as PM_COMPLETE_LIST_FINDING_CODES,je as PmCompleteListValidationError,q as QUERY_CURSOR_CONTRACT,Be as _testOnly,Ro as _testOnlyAggregateCommand,Uo as _testOnlyGetCommand,Do as _testOnlyNextCommand,Zo as _testOnlySearchCommand,me as acquireItemMetadataDerivedIndexLock,f as analyzeDuplicateItems,h as applyContextTagProjection,Me as applyFilterValueEcho,ze as assertCompleteListResult,J as attachContextUsageServingReceipt,C as buildChildrenByParent,Go as buildCompactSearchFilterSummary,Re as buildContentFilterEcho,uo as buildContextSignalSnapshot,Ae as buildGovernanceMissingFilterEcho,Bo as buildItemChildrenRollup,Ye as buildItemContextRelevanceCandidates,Ho as buildVerboseSearchFilters,Co as buildWorkspaceMemorySnapshot,Ve as certifyCompleteListResult,Ko as classifyImplicitSemanticFallbackReason,le as collectBlockedByIds,ce as collectBlockedByIdsFromCorpus,Q as collectContextUsageDeliveredItemIds,ge as collectDependencyBlockedIds,Jo as collectErrorCauseCodes,u as collectSubtreeIds,c as compareCriticalItems,Ce as computeActionabilityReport,Le as createCompleteListOptions,W as createQueryFingerprint,Xo as createSearchCursorFingerprint,V as decodeQueryCursor,L as decodeQueryCursorEnvelope,N as decodeQueryCursorState,$e as defaultScoreContextCandidates,j as encodeQueryCursor,ro as evaluateContextRanking,D as evaluateMetricFloors,n as executeEmbeddingBatchesWithRetry,Y as finalizeContextUsageDelivery,Ue as fitOutputEnvelope,Yo as formatVectorIndexRecoveryWarnings,ue as indexBlockedByIds,Ne as inspectCompleteListResult,P as listGetProjectionFields,M as listListProjectionFields,r as measureItemMetadataReadWork,w as mergeSortedWarnings,mo as packContextCandidates,y as packRankedContextItems,X as paginateQueryRows,x as parseContextDepth,m as parseContextFocusFields,l as parseContextSections,lo as parseContextSignalSnapshot,E as parseEvalMetricFloors,Ie as parseIntegerLimit,re as parseLimit,he as parseMultiValueFilter,we as parsePriority,Ee as parsePriorityFilterSet,_e as parseStringFilterSet,Te as parseType,ke as parseTypeFilterSet,vo as partitionDecisionEntries,d as projectContextFocusRows,K as propagateContextUsageServingReceipt,ne as queryItemMetadataIndex,fe as queryLinkedFileMetadataIndex,pe as querySimilarItemMetadataIndex,te as readContextUsageAffinity,B as readHistoryEntries,de as readItemMetadataDerivedIndexState,go as readWorkspaceContextSignals,Io as readWorkspaceMemory,$ as recordContextUsageDelivery,Z as recordContextUsageServing,ee as recordContextUsageTouch,oe as recordContextUsageTouches,se as refreshItemMetadataDerivedIndex,He as renderCalendarMarkdown,Je as renderCalendarToon,T as renderContextMarkdown,So as renderNextMarkdown,Ge as resolveCalendarOutputFormat,ve as resolveContentFieldFilters,s as resolveContextOutputFormat,i as resolveContextTokenBudget,Lo as resolveEffectiveSearchMode,Vo as resolveHybridSemanticWeight,ye as resolveItemBlockers,ie as resolveItemExecutionRole,De as resolveMissingMetadataFilters,Eo as resolveNextOutputFormat,z as resolveQueryCursorStart,jo as resolveSearchMaxResults,qo as resolveSearchPage,No as resolveSearchScoreThreshold,zo as resolveSearchTuning,Qo as resolveVectorIndexRecovery,p as runActivity,Mo as runAggregate,Ke as runCalendar,_ as runContext,po as runContextEvaluationCorpus,no as runContextEvaluationScenario,Xe as runDuplicates,Oo as runGet,Wo as runHistory,Pe as runList,Fo as runNext,$o as runSearch,eo as scoreContextCandidates,oo as scoreContextCandidatesWithActiveExtensions,ho as searchWorkspaceMemory,_o as searchWorkspaceMemoryReadResult,be as selectActionableEntries,U as selectCursorSemanticOptions,To as selectWorkspaceMemory,wo as selectWorkspaceMemoryRollups,fo as summarizeContextEvaluationReports,I as toContextFocusItem,g as toContextPackingSummary,b as toContextRankingSummary,O as verifyHistoryChain};
2
2
  //# sourceMappingURL=sdk-query.js.map
@@ -1,2 +1,2 @@
1
- import{$a as Dc,$b as Dd,A as tb,Aa as Zb,Ab as cd,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,nb as Rc,nc as Rd,ob as Sc,oc as Sd,pb as Tc,pc as Td,q as db,qb as Uc,qc as Ud,r as eb,ra as Qb,rb as Vc,rc as Vd,s as fb,sa as Rb,sb as Wc,sc as Wd,t as gb,ta as Sb,tb as Xc,tc as Xd,u as hb,ua as Tb,ub as Yc,uc as Yd,va as Ub,vb as Zc,vc as Zd,wa as Vb,wb as _c,wc as _d,x as pb,xa as Wb,xb as $c,xc as $d,y as qb,ya as Xb,yb as ad,yc as ae,z as rb,za as Yb,zb as bd,zc as be}from"./chunks/chunk-AGPFANRX.js";import"./chunks/chunk-XPBPGDFW.js";import{L as Mb,m as Fb,n as Kb,u as Lb}from"./chunks/chunk-IUTN67EB.js";import{$d as tc,Nd as Nb,_c as sb,ae as uc,be as vc,ce as wc,de as xc,gd as Cb,hd as Db,id as Eb,mc as jb,nb as ib,nc as kb,oc as lb,qc as mb,sc as nb,tc as ob}from"./chunks/chunk-M76BEWTT.js";import"./chunks/chunk-HQYIKAC6.js";import"./chunks/chunk-CNMGGAZO.js";import{A as bb,B as cb,w as _a,x as $a,z as ab}from"./chunks/chunk-2UTJ5QIE.js";import"./chunks/chunk-H64BNM4A.js";import{a as Wa,b as Xa,e as Ya,f as Za}from"./chunks/chunk-Y4LXVPA5.js";import{Ab as vb,Bb as wb,Cb as xb,Hc as zb,Ic as Ab,Mc as Bb,U as Va,qc as yb,zb as ub}from"./chunks/chunk-OESI2ETD.js";import"./chunks/chunk-AMHD7WIV.js";import"./chunks/chunk-AOV5HG3Y.js";import"./chunks/chunk-4FNMPZ7Y.js";import"./chunks/chunk-Z5LHCEXG.js";import"./chunks/chunk-IB7UB5TE.js";import{Qc as Sa,Rc as Ta,Tc as Ua,bb as Fa,fc as Ka,gc as La,hc as Ma,i as n,ic as Na,ja as za,ka as Aa,kc as Oa,la as Ba,mc as Pa,oc as Qa,pc as Ra,qb as Ga,rb as Ha,sa as Ca,ta as Da,tb as Ia,ub as Ja}from"./chunks/chunk-723PMYNX.js";import{v as Ea}from"./chunks/chunk-CR5GC3VO.js";import{Ad as W,Af as qa,Bf as ra,Cc as H,Cf as sa,Df as ta,Ec as I,He as $,Ka as z,Qa as A,Rc as J,Sa as B,Sc as K,Uc as L,Va as C,Vc as M,Wa as D,Wc as N,Xb as F,Xc as O,Ya as E,Yb as G,Yc as P,_c as Q,ca as s,cj as wa,da as t,e as c,ea as u,f as d,g as e,h as f,i as g,j as h,ja as v,k as i,kd as R,kf as aa,l as j,la as w,ld as S,lf as ba,m as k,ma as x,mf as ca,n as l,na as y,nd as T,nf as da,nj as xa,o as m,od as U,of as ea,pf as fa,qf as ga,rf as ha,rj as ya,se as X,sf as ia,sh as ua,te as Y,tf as ja,th as va,ue as Z,uf as ka,ve as _,vf as la,wf as ma,xf as na,yf as oa,zd as V,zf as pa}from"./chunks/chunk-7UUPLMCU.js";import"./chunks/chunk-VS565KBX.js";import"./chunks/chunk-SPPHDVZE.js";import{A as a,C as b,E as o,H as p,K as q,M as r}from"./chunks/chunk-5OFMWP3Q.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,be 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,ae 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,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,A as tb,Aa as Zb,Ab as cd,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,nb as Rc,nc as Rd,ob as Sc,oc as Sd,pb as Tc,pc as Td,q as db,qb as Uc,qc as Ud,r as eb,ra as Qb,rb as Vc,rc as Vd,s as fb,sa as Rb,sb as Wc,sc as Wd,t as gb,ta as Sb,tb as Xc,tc as Xd,u as hb,ua as Tb,ub as Yc,uc as Yd,va as Ub,vb as Zc,vc as Zd,wa as Vb,wb as _c,wc as _d,x as pb,xa as Wb,xb as $c,xc as $d,y as qb,ya as Xb,yb as ad,yc as ae,z as rb,za as Yb,zb as bd,zc as be}from"./chunks/chunk-XK25TAJZ.js";import"./chunks/chunk-MGYAJONE.js";import{L as Mb,m as Fb,n as Kb,u as Lb}from"./chunks/chunk-2IZGNOGT.js";import{$d as tc,Nd as Nb,_c as sb,ae as uc,be as vc,ce as wc,de as xc,gd as Cb,hd as Db,id as Eb,mc as jb,nb as ib,nc as kb,oc as lb,qc as mb,sc as nb,tc as ob}from"./chunks/chunk-HJQ3XPS3.js";import"./chunks/chunk-HQYIKAC6.js";import"./chunks/chunk-6HRPGEBF.js";import{A as bb,B as cb,w as _a,x as $a,z as ab}from"./chunks/chunk-KEBLUTC3.js";import"./chunks/chunk-W4TLA5H3.js";import{a as Wa,b as Xa,e as Ya,f as Za}from"./chunks/chunk-Y4LXVPA5.js";import{Ab as vb,Bb as wb,Cb as xb,Hc as zb,Ic as Ab,Mc as Bb,U as Va,qc as yb,zb as ub}from"./chunks/chunk-7EZZ4W7O.js";import"./chunks/chunk-5LF5QZT3.js";import"./chunks/chunk-M5D3CEMY.js";import"./chunks/chunk-3BOR22MC.js";import"./chunks/chunk-DG2EOOFX.js";import"./chunks/chunk-IB7UB5TE.js";import{Qc as Sa,Rc as Ta,Tc as Ua,bb as Fa,fc as Ka,gc as La,hc as Ma,i as n,ic as Na,ja as za,ka as Aa,kc as Oa,la as Ba,mc as Pa,oc as Qa,pc as Ra,qb as Ga,rb as Ha,sa as Ca,ta as Da,tb as Ia,ub as Ja}from"./chunks/chunk-7ESF676D.js";import{v as Ea}from"./chunks/chunk-OXG5XPC7.js";import{Ad as W,Af as qa,Bf as ra,Cc as H,Cf as sa,Df as ta,Ec as I,He as $,Ka as z,Qa as A,Rc as J,Sa as B,Sc as K,Uc as L,Va as C,Vc as M,Wa as D,Wc as N,Xb as F,Xc as O,Ya as E,Yb as G,Yc as P,_c as Q,ca as s,cj as wa,da as t,e as c,ea as u,f as d,g as e,h as f,i as g,j as h,ja as v,k as i,kd as R,kf as aa,l as j,la as w,ld as S,lf as ba,m as k,ma as x,mf as ca,n as l,na as y,nd as T,nf as da,nj as xa,o as m,od as U,of as ea,pf as fa,qf as ga,rf as ha,rj as ya,se as X,sf as ia,sh as ua,te as Y,tf as ja,th as va,ue as Z,uf as ka,ve as _,vf as la,wf as ma,xf as na,yf as oa,zd as V,zf as pa}from"./chunks/chunk-FOYRE23V.js";import"./chunks/chunk-VS565KBX.js";import"./chunks/chunk-SPPHDVZE.js";import{A as a,C as b,E as o,H as p,K as q,M as r}from"./chunks/chunk-5OFMWP3Q.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,be 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,ae 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,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-Q32Q3LRH.js";import"./chunks/chunk-AGPFANRX.js";import"./chunks/chunk-XPBPGDFW.js";import"./chunks/chunk-IUTN67EB.js";import"./chunks/chunk-M76BEWTT.js";import"./chunks/chunk-HQYIKAC6.js";import"./chunks/chunk-CNMGGAZO.js";import{n as a,sa as b}from"./chunks/chunk-2UTJ5QIE.js";import"./chunks/chunk-H64BNM4A.js";import"./chunks/chunk-Y4LXVPA5.js";import"./chunks/chunk-OESI2ETD.js";import"./chunks/chunk-AMHD7WIV.js";import"./chunks/chunk-AOV5HG3Y.js";import"./chunks/chunk-4FNMPZ7Y.js";import"./chunks/chunk-Z5LHCEXG.js";import"./chunks/chunk-IB7UB5TE.js";import"./chunks/chunk-723PMYNX.js";import"./chunks/chunk-CR5GC3VO.js";import"./chunks/chunk-7UUPLMCU.js";import"./chunks/chunk-VS565KBX.js";import"./chunks/chunk-SPPHDVZE.js";import"./chunks/chunk-5OFMWP3Q.js";import"./chunks/chunk-XAWE4EAK.js";export{g as activateExtensionForTest,O as assertExtensionBlueprint,N as assertExtensionCapabilityUsage,v as assertExtensionDeactivated,R as assertExtensionManifestCompatible,Q as assertExtensionManifestMatchesBlueprint,S as assertExtensionPreflight,w as assertPackageManifest,P as assertProjectProfile,x as assertRegisteredCommandContract,H as assertRegisteredCommandOverride,D as assertRegisteredExporter,y as assertRegisteredFlags,z as assertRegisteredHook,C as assertRegisteredImporter,E as assertRegisteredItemField,F as assertRegisteredItemType,M as assertRegisteredMigration,I as assertRegisteredParserOverride,J as assertRegisteredPreflightOverride,G as assertRegisteredProfile,K as assertRegisteredRendererOverride,A as assertRegisteredSearchProvider,L as assertRegisteredServiceOverride,B as assertRegisteredVectorStoreAdapter,T as createExtensionTestHarness,h as deactivateExtensionForTest,e as decodeToon,a as describeExtensionActivation,c as describeExtensionBlueprint,f as encodeToon,d as lintExtensionBlueprint,b as renderExtensionSurfaceMarkdown,i as runRegisteredCommandForTest,n as runRegisteredCommandOverrideForTest,u as runRegisteredExporterForTest,k as runRegisteredHookForTest,t as runRegisteredImporterForTest,s as runRegisteredMigrationForTest,j as runRegisteredMutationGuardForTest,l as runRegisteredParserOverrideForTest,m as runRegisteredPreflightOverrideForTest,o as runRegisteredRendererOverrideForTest,q as runRegisteredSearchProviderForTest,p as runRegisteredServiceOverrideForTest,r 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-ZAO7VGX3.js";import"./chunks/chunk-XK25TAJZ.js";import"./chunks/chunk-MGYAJONE.js";import"./chunks/chunk-2IZGNOGT.js";import"./chunks/chunk-HJQ3XPS3.js";import"./chunks/chunk-HQYIKAC6.js";import"./chunks/chunk-6HRPGEBF.js";import{n as a,sa as b}from"./chunks/chunk-KEBLUTC3.js";import"./chunks/chunk-W4TLA5H3.js";import"./chunks/chunk-Y4LXVPA5.js";import"./chunks/chunk-7EZZ4W7O.js";import"./chunks/chunk-5LF5QZT3.js";import"./chunks/chunk-M5D3CEMY.js";import"./chunks/chunk-3BOR22MC.js";import"./chunks/chunk-DG2EOOFX.js";import"./chunks/chunk-IB7UB5TE.js";import"./chunks/chunk-7ESF676D.js";import"./chunks/chunk-OXG5XPC7.js";import"./chunks/chunk-FOYRE23V.js";import"./chunks/chunk-VS565KBX.js";import"./chunks/chunk-SPPHDVZE.js";import"./chunks/chunk-5OFMWP3Q.js";import"./chunks/chunk-XAWE4EAK.js";export{g as activateExtensionForTest,O as assertExtensionBlueprint,N as assertExtensionCapabilityUsage,v as assertExtensionDeactivated,R as assertExtensionManifestCompatible,Q as assertExtensionManifestMatchesBlueprint,S as assertExtensionPreflight,w as assertPackageManifest,P as assertProjectProfile,x as assertRegisteredCommandContract,H as assertRegisteredCommandOverride,D as assertRegisteredExporter,y as assertRegisteredFlags,z as assertRegisteredHook,C as assertRegisteredImporter,E as assertRegisteredItemField,F as assertRegisteredItemType,M as assertRegisteredMigration,I as assertRegisteredParserOverride,J as assertRegisteredPreflightOverride,G as assertRegisteredProfile,K as assertRegisteredRendererOverride,A as assertRegisteredSearchProvider,L as assertRegisteredServiceOverride,B as assertRegisteredVectorStoreAdapter,T as createExtensionTestHarness,h as deactivateExtensionForTest,e as decodeToon,a as describeExtensionActivation,c as describeExtensionBlueprint,f as encodeToon,d as lintExtensionBlueprint,b as renderExtensionSurfaceMarkdown,i as runRegisteredCommandForTest,n as runRegisteredCommandOverrideForTest,u as runRegisteredExporterForTest,k as runRegisteredHookForTest,t as runRegisteredImporterForTest,s as runRegisteredMigrationForTest,j as runRegisteredMutationGuardForTest,l as runRegisteredParserOverrideForTest,m as runRegisteredPreflightOverrideForTest,o as runRegisteredRendererOverrideForTest,q as runRegisteredSearchProviderForTest,p as runRegisteredServiceOverrideForTest,r as runRegisteredVectorStoreAdapterForTest};
2
2
  //# sourceMappingURL=sdk-testing.js.map
@@ -1,4 +1,4 @@
1
- import{a as kg}from"./chunks/chunk-NMVPQTZI.js";import{a as Tx,b as Cx,c as Ex,d as Sx}from"./chunks/chunk-PRVT7ITI.js";import{a as wx,b as Ax}from"./chunks/chunk-IQKCRLQP.js";import{b as zk,c as Hk,d as Vk,e as Kk,f as Wk,g as Yk,h as Xk,i as Jk,j as Qk,k as Zk,l as ex,m as tx,n as rx,o as ox,p as nx,q as ix,r as sx}from"./chunks/chunk-CTOE26W4.js";import{A as mx,B as fx,C as _x,D as hx,E as gx,F as yx,G as bx,a as qs,b as YR,c as XR,d as xc,e as Nc,f as Lc,h as Dc,i as $c,j as Fc,k as Gc,l as Uc,m as jc,n as Bc,o as qc,p as Vd,q as Kd,r as Wd,s as Yd,t as Xd,u as ax,v as cx,w as dx,x as lx,y as px,z as ux}from"./chunks/chunk-GQCMICAL.js";import{A as Qx,B as Zx,C as eN,D as tN,E as rN,F as oN,G as nN,H as iN,I as sN,J as aN,K as cN,L as dN,M as lN,N as pN,O as uN,P as mN,Q as fN,R as _N,S as hN,T as gN,U as yN,V as bN,W as TN,X as CN,Y as EN,Z as SN,_ as wN,a as Ox,b as vx,c as Rx,d as Ix,e as Px,f as Mx,g as kx,h as xx,i as Nx,j as Lx,k as Dx,l as $x,m as Fx,n as Gx,o as Ux,p as jx,q as Bx,r as qx,s as zx,t as Hx,u as Vx,v as Kx,w as Wx,x as Yx,y as Xx,z as Jx}from"./chunks/chunk-Q32Q3LRH.js";import{$ as ff,$a as ih,$b as ig,A as u0,Aa as v_,Ab as kh,B as Ke,Ba as R_,Bb as xh,C as Zm,Ca as I_,Cb as Nh,D as ef,Da as P_,Db as Lh,E as rf,Ea as M_,Eb as Dh,F as zt,Fa as k_,Fb as $h,G as Ht,Ga as x_,Gb as Fh,H as Vt,Ha as N_,Hb as Gh,I as Kt,Ia as L_,Ib as Uh,J as Wt,Ja as D_,Jb as jh,K as Yt,Ka as $_,Kb as Bh,L as Xt,La as F_,Lb as qh,M as Jt,Ma as G_,Mb as zh,N as Qt,Na as U_,Nb as Hh,O as Zt,Oa as j_,Ob as Vh,P as er,Pa as B_,Pb as Kh,Q as of,Qa as q_,Qb as Wh,R as nf,Ra as z_,Rb as Yh,S as sf,Sa as H_,Sb as Xh,T as af,Ta as V_,Tb as Jh,U as cf,Ua as K_,Ub as Qh,V as We,Va as tr,Vb as Zh,W as df,Wa as _e,Wb as eg,X as lf,Xa as th,Xb as tg,Y as pf,Ya as rh,Yb as rg,Z as uf,Za as oh,Zb as og,_ as mf,_a as nh,_b as ng,a as cR,aa as _f,ab as sh,ac as sg,b as dR,ba as hf,bb as ah,bc as ag,c as lR,ca as Ak,cb as ch,cc as cg,d as pR,da as Ok,db as dh,dc as dg,e as uR,ea as vk,eb as lh,ec as lg,f as mR,fa as If,fb as ph,fc as pg,g as hR,ga as Pf,gb as uh,gc as ug,h as gR,ha as Mf,hb as mh,hc as mg,i as yR,ia as g_,ib as fh,ic as fg,j as bR,ja as y_,jb as _h,jc as _g,k as zs,ka as Dk,kb as hh,kc as hg,l as cd,la as $k,lb as gh,lc as gg,m as dd,ma as Fk,mb as yh,mc as yg,n as ld,na as Gk,nb as bh,nc as bg,oa as Uk,ob as Th,oc as Tg,p as NP,pa as jk,pb as Ch,pc as Cg,q as LP,qa as Bk,qb as Eh,qc as Eg,r as DP,ra as qk,rb as Sh,rc as Sg,s as $P,sa as b_,sb as wh,sc as wg,t as FP,ta as T_,tb as Ah,tc as Ag,u as GP,ua as C_,ub as Oh,uc as Og,v as Nu,va as E_,vb as vh,vc as vg,w as $u,wa as S_,wb as Rh,wc as Rg,x as Fu,xa as w_,xb as Ih,xc as Ig,y as nm,ya as A_,yb as Ph,yc as Pg,z as pm,za as O_,zb as Mh,zc as Mg}from"./chunks/chunk-AGPFANRX.js";import{e as BP,f as qP,g as ep,h as tp,i as jt}from"./chunks/chunk-XPBPGDFW.js";import{A as fk,B as _k,C as hk,D as gk,E as yk,F as bk,G as Tk,H as Ck,I as Ek,J as Sk,K as wk,L as bf,M as Tf,N as Cf,O as Ef,P as Sf,Q as wf,R as Af,S as Of,T as vf,U as Rf,a as YM,b as XM,c as JM,d as QM,e as ZM,f as xu,g as e0,h as t0,i as r0,j as o0,k as n0,m as tf,n as gf,o as ok,p as nk,q as ik,r as sk,s as ak,t as ck,u as yf,v as dk,w as lk,x as pk,y as uk,z as mk}from"./chunks/chunk-IUTN67EB.js";import{$ as VI,$a as Tp,$b as Ru,$d as Y_,A as ze,Aa as gP,Ab as nM,Ac as zu,Ad as Vf,B as ee,Ba as yP,Bb as gu,Bc as Hu,Bd as Kf,C as ll,Ca as bP,Cb as iM,Cc as Vu,Cd as Wf,Db as EM,Dc as Ku,Dd as Yf,Eb as SM,Ec as Wu,Ed as Xf,F as He,Fa as UP,Fb as wM,Fc as Yu,Fd as Jf,G as pl,Ga as jP,Gb as AM,Gc as Xu,Gd as Qf,H as ul,Ha as Kl,Hb as OM,Hc as Ju,Hd as Zf,Ia as Wl,Ib as vM,Ic as Qu,Id as e_,J as fe,Ja as Yl,Jb as RM,Jc as Zu,Jd as t_,K as ml,Ka as Xl,Kb as NM,Kc as em,Kd as r_,L as fl,La as Jl,Lb as LM,Lc as tm,Ld as o_,M as _l,Ma as Ql,Mb as yu,Mc as rm,Md as n_,N as hl,Na as Zl,Nb as bu,Nd as i_,O as LI,Oa as ap,Ob as DM,Oc as l0,Od as s_,P as DI,Pa as cp,Pb as $M,Pc as p0,Q as $I,Qa as dp,Qb as FM,Qc as om,Qd as a_,R as FI,Ra as lp,Rb as GM,Rc as um,Rd as c_,S as GI,Sa as pp,Sb as UM,Sc as mm,Sd as d_,T as xt,Ta as up,Tb as Tu,Tc as fm,Td as l_,U as UI,Ua as mp,Ub as Cu,Uc as _m,Ud as p_,V as jI,Va as fp,Vb as Eu,Vc as hm,Vd as u_,W as Nt,Wa as _p,Wb as Su,Wd as m_,X as BI,Xa as hp,Xb as wu,Xd as f_,Y as qI,Ya as gp,Yb as Au,Yd as __,Z as zI,Za as yp,Zb as Ou,Zd as h_,_ as HI,_a as bp,_b as vu,_c as gm,_d as W_,a as JR,aa as Ve,ab as Cp,ac as Iu,ad as Hm,ae as X_,b as It,ba as KI,bb as Ep,bc as Pu,bd as Vm,be as J_,c as QR,ca as Lt,cb as Sp,cc as Mu,cd as Km,ce as Q_,d as Zc,da as WI,db as wp,dc as jM,de as Z_,e as ed,ea as YI,eb as Ap,ec as BM,ed as Wm,ee as eh,f as td,fa as XI,fb as Op,fc as qM,fd as Ym,g as rd,ga as JI,gb as vp,gc as zM,gd as Xm,h as od,ha as QI,hb as Rp,hc as HM,hd as Jm,ia as ZI,ib as VP,ic as VM,id as Qm,j as nd,ja as eP,jb as Ip,jc as KM,jd as kf,k as id,ka as tP,kb as Pp,kc as WM,kd as xf,la as rP,lb as Mp,lc as ku,ld as Nf,ma as oP,mb as kp,mc as i0,md as Lf,na as nP,nb as KP,nc as s0,nd as Df,o as sd,oa as iP,ob as xp,oc as a0,od as $f,p as ad,pa as sP,pb as Np,pc as c0,pd as Ff,qa as aP,qb as Lp,qc as d0,qd as Gf,ra as cP,rb as Dp,rd as Uf,sa as dP,sb as $p,sc as Lu,sd as xk,ta as lP,tb as WP,tc as Du,td as Nk,ua as pP,ub as YP,uc as Gu,ud as Lk,va as uP,vb as XP,vc as Uu,vd as jf,w as Mt,wa as mP,wb as JP,wd as Bf,xa as fP,xb as QP,xc as ju,xd as qf,y as kt,ya as _P,yb as ZP,yc as Bu,yd as zf,za as hP,zb as eM,zc as qu,zd as Hf}from"./chunks/chunk-M76BEWTT.js";import"./chunks/chunk-HQYIKAC6.js";import{x as Jd}from"./chunks/chunk-CNMGGAZO.js";import{A as kP,Aa as $l,B as xP,Ba as Fl,C as Il,D as Pl,Da as Gl,E as Ml,Ea as Ul,F as kl,Fa as jl,G as Dt,Ga as Bl,Ha as ql,Ja as zl,Ka as Hl,La as Vl,b as wR,c as AR,d as OR,e as vR,f as RR,g as IR,h as Hs,i as Vs,j as Ks,k as Ws,l as Ys,ma as $t,n as TP,na as Ft,oa as Gt,pa as Ut,qa as xl,sa as Nl,ta as Ll,ua as Dl,w as IP,x as PP,z as MP}from"./chunks/chunk-2UTJ5QIE.js";import{a as CP,b as EP,c as SP,d as wP,e as AP,f as OP,g as vP,h as Cl,i as El,j as Sl,k as wl,l as Al,m as RP,n as Ol,o as vl,p as Rl}from"./chunks/chunk-H64BNM4A.js";import{a as gl,b as yl,e as bl,f as Tl}from"./chunks/chunk-Y4LXVPA5.js";import{$a as hM,$b as D0,A as vI,Aa as du,Ab as Sm,Ac as Dm,B as Qd,Ba as lu,Bb as wm,Bc as $m,C as Zd,Ca as pu,Cb as Am,Cc as Fm,D as el,Da as uu,Db as f0,Dc as Gm,E as tl,Ea as mu,Eb as _0,Ec as Um,F as rl,Fa as fu,Fb as h0,Fc as jm,G as ol,Ga as _u,Gb as g0,Gc as Bm,H as nl,Ha as hu,Hb as y0,Hc as qt,I as il,Ib as b0,Ic as qm,J as sl,Jb as T0,Jc as Z0,K as al,Kc as ek,L as cl,La as tM,Lb as Om,Lc as tk,M as qe,Ma as rM,Mb as C0,Mc as zm,N as RI,Na as oM,Nb as E0,Nc as rk,O as II,Oa as sM,Ob as S0,Oc as Rk,P as PI,Pa as aM,Pb as w0,Pc as Ik,Q as MI,Qa as cM,Qb as A0,Qc as Pk,R as kI,Ra as dM,Rb as O0,Rc as Mk,S as xI,Sa as lM,Sb as v0,Sc as kk,T as NI,Ta as pM,Tb as R0,U as dl,Ua as uM,Ub as I0,V as rp,Va as mM,Vb as P0,W as op,Wa as fM,Wb as M0,X as np,Xa as _M,Xb as k0,Y as ip,Yb as x0,Z as zP,Zb as N0,_ as HP,_b as L0,a as TR,aa as sp,ac as $0,b as CR,ba as Fp,bb as gM,bc as F0,c as ER,ca as Gp,cb as yM,cc as G0,d as SR,da as Up,dc as U0,e as mI,ea as jp,ec as j0,f as fI,fa as Bp,fb as bM,fc as B0,g as _I,ga as qp,gb as TM,gc as q0,h as hI,ha as zp,hb as CM,hc as z0,i as gI,ia as Hp,ic as H0,j as yI,ja as Vp,jb as IM,jc as V0,k as bI,ka as Kp,kb as PM,kc as K0,la as Wp,lb as MM,lc as W0,ma as Yp,mb as kM,mc as Y0,na as Xp,nb as xM,nc as X0,oa as Jp,ob as im,oc as J0,pa as Qp,pb as sm,pc as Q0,qa as Zp,qb as am,qc as Bt,ra as eu,rb as cm,rc as vm,sa as tu,sb as dm,sc as Rm,t as TI,ta as ru,tb as lm,tc as Im,u as CI,ua as ou,ub as ym,uc as Pm,v as EI,va as nu,vb as bm,vc as Mm,w as SI,wa as iu,wb as Tm,wc as km,x as wI,xa as su,xb as Cm,xc as xm,y as AI,ya as au,yb as m0,yc as Nm,z as OI,za as cu,zb as Em,zc as Lm}from"./chunks/chunk-OESI2ETD.js";import{a as fR,b as _R}from"./chunks/chunk-AMHD7WIV.js";import{$ as Ea,$a as Ec,A as Js,Aa as Ya,Ab as _d,B as Qs,Ba as Xa,Bb as hd,C as Zs,Ca as Ja,Cb as gd,Da as Qa,Db as yd,E as ea,Ea as Za,Eb as bd,F as ta,Fa as ec,Fb as Td,G as ra,Ga as tc,Gb as Cd,H as oa,Ha as rc,Hb as Ed,I as na,Ia as oc,Ib as Sd,J as ia,Ja as nc,Jb as wd,K as sa,Ka as ic,Kb as Ad,L as aa,La as sc,Lb as Od,M as ca,Ma as ac,Mb as vd,N as da,Na as cc,Nb as Rd,O as la,Oa as dc,Ob as Id,P as pa,Pa as lc,Pb as Pd,Q as ua,Qa as pc,Qb as Md,R as ma,Ra as uc,Rb as kd,Sa as mc,Sb as xd,T as fa,Ta as fc,Tb as Nd,U as _a,Ua as _c,Ub as ZR,V as ha,Va as hc,Vb as eI,W as ga,Wa as gc,Wb as tI,X as ya,Xa as yc,Xb as rI,Y as ba,Ya as bc,Yb as oI,Z as Ta,Za as Tc,Zb as nI,_ as Ca,_a as Cc,a as PR,aa as Sa,ab as Sc,b as MR,ba as wa,bb as wc,bc as iI,c as kR,ca as Aa,cb as Ac,cc as sI,d as xR,da as Oa,db as Oc,dc as aI,e as NR,ea as va,eb as vc,ec as cI,fa as Ra,fb as Rc,fc as dI,g as LR,ga as Ia,gb as Ic,gc as lI,h as DR,ha as Pa,hb as Pc,hc as pI,i as Xs,ia as Ma,ib as Mc,ic as uI,j as $R,ja as ka,ka as xa,kb as Be,kc as Ld,la as Na,lb as Z,lc as Dd,m as FR,ma as La,mb as kc,mc as $d,n as GR,na as Da,nb as zc,nc as Fd,o as Ue,oa as $a,ob as Hc,oc as Gd,p as UR,pa as Fa,pb as Vc,pc as Ud,q as jR,qa as Ga,qb as Kc,qc as jd,r as BR,ra as Ua,rb as Wc,rc as Bd,s as Rt,sa as ja,sb as Yc,sc as qd,t as je,ta as Ba,tb as Xc,tc as zd,u as qR,ua as qa,ub as Jc,uc as Hd,v as zR,va as za,vb as Qc,vc as Pt,w as HR,wa as Ha,wb as pd,x as VR,xa as Va,xb as ud,y as KR,ya as Ka,yb as md,z as WR,za as Wa,zb as fd}from"./chunks/chunk-AOV5HG3Y.js";import{a as Zv,b as eR,c as tR,d as rR,e as oR,f as nR,g as iR,h as sR,i as aR,j as Ns,k as Ls,l as Ds,m as $s,n as Fs,o as Gs,q as Us,s as js,y as Bs}from"./chunks/chunk-4FNMPZ7Y.js";import{b as Xv}from"./chunks/chunk-Z5LHCEXG.js";import"./chunks/chunk-IB7UB5TE.js";import{$b as av,$c as Rv,A as lC,Aa as eO,Ab as qO,Ac as yv,Ad as Kv,B as pC,Ba as tO,Bc as bv,Bd as Wv,C as uC,Cc as Tv,Cd as Yv,Db as zO,Dc as Cv,Dd as Jv,Ec as Ev,Ed as Qv,Fb as HO,Fc as Sv,Gc as wv,Hc as fs,Ic as _s,Jb as VO,Jc as hs,K as EC,Kb as KO,Kc as gs,La as rO,Lb as WO,Lc as ys,M as MC,Ma as oO,Mb as os,Mc as bs,N as kC,Na as nO,Nb as YO,Nc as Ts,O as xC,Oa as iO,Oc as Cs,P as NC,Pa as sO,Pb as XO,Pc as Es,Q as UC,Qa as aO,Qb as JO,Qc as Ss,R as jC,Ra as mO,Rb as QO,Rc as ws,S as wt,Sa as fO,Sb as ZO,Sc as As,T as TA,Ta as _O,Tb as ev,Tc as Os,U as CA,Ua as At,Ub as tv,Uc as vs,V as EA,Vb as rv,Wa as hO,Wb as ov,Wc as Rs,X as SA,Xa as gO,Xb as nv,Xc as Av,Ya as yO,Yb as iv,Yc as Ov,Z as wA,Za as bO,Zb as Ot,Zc as Is,_ as AA,_a as TO,_b as sv,_c as vv,a as JT,aa as OA,ad as Ps,ba as vA,bb as CO,bd as Ms,ca as RA,cd as Iv,da as IA,dd as Pv,ea as PA,ed as Mv,fa as MA,fb as Xi,fc as ns,fd as kv,ga as kA,gc as is,gd as xv,ha as BA,hb as MO,hc as ss,hd as Nv,i as sn,ib as kO,ic as as,id as Lv,j as QT,ja as Vi,jb as xO,jd as ks,k as ZT,ka as Ki,kb as NO,kc as cs,kd as xs,l as eC,la as Wi,lc as ds,ld as Dv,m as tC,mb as LO,mc as ls,md as $v,na as qA,nb as DO,nc as ps,nd as Fv,o as rC,oa as zA,ob as $O,oc as us,od as Gv,p as oC,pa as HA,pb as FO,pc as ms,pd as Uv,qa as VA,qb as es,qc as cv,qd as jv,r as nC,ra as KA,rb as ts,rc as dv,rd as Bv,sa as WA,sc as lv,sd as qv,t as iC,ta as YA,tb as rs,tc as pv,td as zv,u as sC,ub as GO,uc as uv,ud as Hv,v as aC,va as XA,vc as mv,vd as Vv,wb as UO,wc as fv,x as cC,xa as JA,xb as jO,xc as _v,y as dC,ya as QA,yb as BO,yc as hv,za as ZA,zc as gv,zd as vt}from"./chunks/chunk-723PMYNX.js";import{A as AO,B as OO,C as vO,D as RO,E as IO,F as PO,G as Ji,H as Qi,I as Zi,a as xA,b as NA,c as LA,d as DA,e as $A,f as FA,g as GA,h as UA,i as jA,n as cO,q as dO,r as lO,u as pO,v as Yi,w as uO,x as EO,y as SO,z as wO}from"./chunks/chunk-CR5GC3VO.js";import{$b as IC,$d as fE,$e as BE,$f as bS,$g as fw,$h as Fi,$i as oA,A as Fo,Ad as Wn,Af as ki,Ag as VS,B as Go,Be as AE,Bf as xi,Bg as KS,C as Uo,Cb as SC,Cc as kn,Ce as OE,Cf as Ni,Cg as WS,D as jo,Db as wC,Dc as rE,De as vE,Df as Li,Dg as YS,E as Bo,Ec as xn,Ef as QE,Eg as XS,F as qo,Fa as mC,Ff as ZE,Fg as JS,G as zo,Ga as fC,Gc as oE,Gf as eS,Gg as QS,H as Ho,Ha as _C,Hd as pE,He as _i,Hf as tS,Hg as ZS,I as Ne,Ib as AC,Id as uE,If as rS,Ig as ew,J as Le,Jd as mE,Jf as oS,Jg as tw,Ji as Kw,K as Vo,Ka as gn,Kd as Yn,Kf as nS,Kg as rw,Ki as Ww,L as Ko,La as hC,Lb as OC,Ld as Xn,Le as RE,Lf as iS,Lg as ow,Li as Yw,M as Wo,Ma as gC,Mc as nE,Md as Jn,Me as IE,Mf as sS,Mg as nw,N as Yo,Na as yC,Nd as Qn,Ne as PE,Ng as iw,Ni as Xw,O as Xo,Oa as bC,Ob as vC,Od as Zn,Oe as ME,Oh as Pw,Oi as Jw,P as Jo,Pc as iE,Pd as ei,Pe as kE,Pf as aS,Ph as Ge,Q as Qo,Qa as yn,Qc as sE,Qd as ti,Qe as xE,Qf as cS,Qg as sw,Qh as St,Qi as Qw,R as Zo,Ra as bn,Rb as RC,Rc as Nn,Rd as ri,Re as NE,Rf as dS,Rg as aw,Rh as Mw,Ri as Ui,S as en,Sa as $e,Sc as Ln,Sd as oi,Se as LE,Sf as lS,Sg as cw,Sh as kw,T as tn,Ta as TC,Tb as Tt,Td as ni,Te as DE,Tf as pS,Tg as dw,Th as xw,Ti as ji,U as rn,Ua as CC,Uc as Dn,Ud as ii,Ue as $E,Uf as uS,Ug as lw,Uh as Nw,Ui as Bi,V as on,Va as Tn,Vb as Ct,Vc as $n,Vd as si,Ve as FE,Vf as mS,Vg as pw,Vh as q,W as nn,Wa as Cn,Wc as Fn,Wd as ai,We as GE,Wf as fS,Wg as uw,Wh as Lw,Xb as Pn,Xc as Gn,Xd as ci,Xf as _S,Xg as mw,Xh as Dw,Xi as Zw,Ya as En,Yb as Mn,Yc as Un,Yd as di,Yf as hS,Yh as $w,Yi as eA,Zb as Et,Zc as aE,Ze as UE,Zf as gS,Zh as Fw,Zi as tA,_c as cE,_e as jE,_f as yS,_i as rA,a as R,aa as gt,ae as _E,af as qE,ag as TS,ah as _w,ai as Gi,aj as nA,b as GT,ba as yt,bc as PC,be as li,bf as zE,bg as CS,bj as iA,c as ht,ca as ln,cc as LC,ce as hE,cf as HE,cg as ES,cj as qi,da as pn,dc as DC,de as gE,df as VE,dg as SS,dh as hw,dj as sA,e as UT,ea as un,ec as $C,ef as KE,eg as wS,eh as gw,ej as aA,f as jT,fc as FC,ff as WE,fg as AS,fh as yw,g as BT,gc as GC,gf as YE,gg as OS,gh as bw,h as qT,hc as BC,hf as XE,hg as vS,hh as Tw,hj as cA,i as zT,ic as qC,ie as yE,if as JE,ig as RS,ih as Cw,ij as dA,j as HT,ja as mn,jb as Sn,jc as zC,je as bE,jg as IS,jh as Ew,jj as lA,k as VT,kb as wn,kc as HC,kd as jn,ke as TE,kf as hi,kg as PS,kh as Sw,kj as pA,l as KT,la as fn,lb as An,lc as VC,ld as Bn,le as CE,lf as gi,lg as MS,lh as ww,li as Gw,lj as uA,m as WT,ma as _n,mb as On,mc as KC,md as dE,mf as yi,mg as kS,mh as Aw,mj as mA,n as YT,na as hn,nb as vn,nc as WC,nd as qn,ne as EE,nf as bi,ng as xS,nh as Ow,ni as Uw,nj as zi,o as XT,oc as YC,od as zn,oe as SE,of as Ti,og as NS,oh as vw,oi as jw,p as Po,pc as XC,pd as lE,pf as Ci,pg as LS,ph as Rw,pi as Bw,q as Mo,qc as JC,qd as Hn,qe as wE,qf as Ei,qg as DS,qi as qw,qj as fA,r as ko,rc as QC,rd as Vn,rf as Si,rg as $S,rh as Iw,ri as zw,rj as Hi,s as xo,sc as ZC,sd as L,se as pi,sf as wi,sg as FS,sh as Di,t as ke,tc as eE,td as Kn,te as ui,tf as Ai,tg as GS,th as $i,tj as _A,u as No,ue as mi,uf as Oi,ug as US,uj as hA,v as N,ve as fi,vf as vi,vg as jS,vi as Hw,vj as gA,w as xe,wb as Rn,wf as Ri,wg as BS,wj as yA,x as Lo,xf as Ii,xg as qS,xi as Vw,xj as bA,y as Do,yb as In,yf as Pi,yg as zS,z as $o,zc as tE,zd as Fe,zf as Mi,zg as HS}from"./chunks/chunk-7UUPLMCU.js";import"./chunks/chunk-VS565KBX.js";import"./chunks/chunk-SPPHDVZE.js";import{A as ue,B as FT,C as b,E as an,F as bt,G as me,H as cn,K as De,M as dn,b as MT,c as kT,d as xT,m as NT,r as LT,u as DT,y as $T}from"./chunks/chunk-5OFMWP3Q.js";import"./chunks/chunk-XAWE4EAK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8f11e0bf-4115-55a8-bd39-c360f43cdc09")}catch{}})();var z="2026-07-28",or=["2025-11-25","2025-06-18"],te=[z],m={headerMismatch:-32020,missingRequiredClientCapability:-32021,unsupportedProtocolVersion:-32022,invalidParams:-32602},w={clientCapabilities:"io.modelcontextprotocol/clientCapabilities",clientInfo:"io.modelcontextprotocol/clientInfo",logLevel:"io.modelcontextprotocol/logLevel",protocolVersion:"io.modelcontextprotocol/protocolVersion",serverInfo:"io.modelcontextprotocol/serverInfo"},rr=["debug","info","notice","warning","error","critical","alert","emergency"],u=class extends Error{code;data;constructor(t,r,o={}){super(t),this.name="PmMcpProtocolError",this.code=r,this.data=o}};function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function xg(e){if(e===void 0)return;if(!h(e))throw new u("Invalid MCP clientInfo metadata",m.invalidParams,{field:w.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:w.clientInfo,required:["name","version"]});let o={name:t.slice(0,128),version:r.slice(0,128)};return typeof e.description=="string"&&e.description.trim()&&(o.description=e.description.trim().slice(0,1024)),typeof e.websiteUrl=="string"&&e.websiteUrl.trim()&&(o.websiteUrl=e.websiteUrl.trim().slice(0,2048)),o}function Ng(e){if(e!==void 0){if(typeof e!="string"||!rr.includes(e))throw new u("Invalid MCP logLevel metadata",m.invalidParams,{field:w.logLevel,allowed:[...rr]});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:[w.protocolVersion,w.clientCapabilities]});let r=t[w.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 o=t[w.clientCapabilities];if(!h(o))throw new u("Invalid MCP client capabilities metadata",m.invalidParams,{field:w.clientCapabilities,expected:"object"});let n=xg(t[w.clientInfo]),s=Ng(t[w.logLevel]);return{protocolVersion:z,clientCapabilities:o,...n?{clientInfo:n}:{},...s?{logLevel:s}:{}}}function AN(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 ON(e,t){let r=t.filter(o=>!Object.prototype.hasOwnProperty.call(e.clientCapabilities,o));if(r.length>0)throw new u("Missing required client capability",m.missingRequiredClientCapability,{requiredCapabilities:Object.fromEntries(r.map(o=>[o,{}]))})}function vN(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,[w.serverInfo]:{...t}}}}function Lg(e,t){return Xe({...e,resultType:"complete"},t)}function RN(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 Lg({supportedVersions:[...te],capabilities:structuredClone(e.capabilities),ttlMs:t,cacheScope:"public",...e.instructions?{instructions:e.instructions}:{}},e.serverInfo)}function IN(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"})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d4a56906-c542-567e-9265-15184a5c330b")}catch{}})();var Dg=new Set(["--help","-h","--version","-V"]);function $g(e,t){let r=[`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"&&r.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."),r.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",""),r.join(`
1
+ import{a as kg}from"./chunks/chunk-ZVEHACE6.js";import{a as Tx,b as Cx,c as Ex,d as Sx}from"./chunks/chunk-GXGW6KHB.js";import{a as wx,b as Ax}from"./chunks/chunk-KDDIHGAO.js";import{b as zk,c as Hk,d as Vk,e as Kk,f as Wk,g as Yk,h as Xk,i as Jk,j as Qk,k as Zk,l as ex,m as tx,n as rx,o as ox,p as nx,q as ix,r as sx}from"./chunks/chunk-4QQPM3IY.js";import{A as mx,B as fx,C as _x,D as hx,E as gx,F as yx,G as bx,a as qs,b as YR,c as XR,d as xc,e as Nc,f as Lc,h as Dc,i as $c,j as Fc,k as Gc,l as Uc,m as jc,n as Bc,o as qc,p as Vd,q as Kd,r as Wd,s as Yd,t as Xd,u as ax,v as cx,w as dx,x as lx,y as px,z as ux}from"./chunks/chunk-KQSPKWFH.js";import{A as Qx,B as Zx,C as eN,D as tN,E as rN,F as oN,G as nN,H as iN,I as sN,J as aN,K as cN,L as dN,M as lN,N as pN,O as uN,P as mN,Q as fN,R as _N,S as hN,T as gN,U as yN,V as bN,W as TN,X as CN,Y as EN,Z as SN,_ as wN,a as Ox,b as vx,c as Rx,d as Ix,e as Px,f as Mx,g as kx,h as xx,i as Nx,j as Lx,k as Dx,l as $x,m as Fx,n as Gx,o as Ux,p as jx,q as Bx,r as qx,s as zx,t as Hx,u as Vx,v as Kx,w as Wx,x as Yx,y as Xx,z as Jx}from"./chunks/chunk-ZAO7VGX3.js";import{$ as ff,$a as ih,$b as ig,A as u0,Aa as v_,Ab as kh,B as Ke,Ba as R_,Bb as xh,C as Zm,Ca as I_,Cb as Nh,D as ef,Da as P_,Db as Lh,E as rf,Ea as M_,Eb as Dh,F as zt,Fa as k_,Fb as $h,G as Ht,Ga as x_,Gb as Fh,H as Vt,Ha as N_,Hb as Gh,I as Kt,Ia as L_,Ib as Uh,J as Wt,Ja as D_,Jb as jh,K as Yt,Ka as $_,Kb as Bh,L as Xt,La as F_,Lb as qh,M as Jt,Ma as G_,Mb as zh,N as Qt,Na as U_,Nb as Hh,O as Zt,Oa as j_,Ob as Vh,P as er,Pa as B_,Pb as Kh,Q as of,Qa as q_,Qb as Wh,R as nf,Ra as z_,Rb as Yh,S as sf,Sa as H_,Sb as Xh,T as af,Ta as V_,Tb as Jh,U as cf,Ua as K_,Ub as Qh,V as We,Va as tr,Vb as Zh,W as df,Wa as _e,Wb as eg,X as lf,Xa as th,Xb as tg,Y as pf,Ya as rh,Yb as rg,Z as uf,Za as oh,Zb as og,_ as mf,_a as nh,_b as ng,a as cR,aa as _f,ab as sh,ac as sg,b as dR,ba as hf,bb as ah,bc as ag,c as lR,ca as Ak,cb as ch,cc as cg,d as pR,da as Ok,db as dh,dc as dg,e as uR,ea as vk,eb as lh,ec as lg,f as mR,fa as If,fb as ph,fc as pg,g as hR,ga as Pf,gb as uh,gc as ug,h as gR,ha as Mf,hb as mh,hc as mg,i as yR,ia as g_,ib as fh,ic as fg,j as bR,ja as y_,jb as _h,jc as _g,k as zs,ka as Dk,kb as hh,kc as hg,l as cd,la as $k,lb as gh,lc as gg,m as dd,ma as Fk,mb as yh,mc as yg,n as ld,na as Gk,nb as bh,nc as bg,oa as Uk,ob as Th,oc as Tg,p as NP,pa as jk,pb as Ch,pc as Cg,q as LP,qa as Bk,qb as Eh,qc as Eg,r as DP,ra as qk,rb as Sh,rc as Sg,s as $P,sa as b_,sb as wh,sc as wg,t as FP,ta as T_,tb as Ah,tc as Ag,u as GP,ua as C_,ub as Oh,uc as Og,v as Nu,va as E_,vb as vh,vc as vg,w as $u,wa as S_,wb as Rh,wc as Rg,x as Fu,xa as w_,xb as Ih,xc as Ig,y as nm,ya as A_,yb as Ph,yc as Pg,z as pm,za as O_,zb as Mh,zc as Mg}from"./chunks/chunk-XK25TAJZ.js";import{e as BP,f as qP,g as ep,h as tp,i as jt}from"./chunks/chunk-MGYAJONE.js";import{A as fk,B as _k,C as hk,D as gk,E as yk,F as bk,G as Tk,H as Ck,I as Ek,J as Sk,K as wk,L as bf,M as Tf,N as Cf,O as Ef,P as Sf,Q as wf,R as Af,S as Of,T as vf,U as Rf,a as YM,b as XM,c as JM,d as QM,e as ZM,f as xu,g as e0,h as t0,i as r0,j as o0,k as n0,m as tf,n as gf,o as ok,p as nk,q as ik,r as sk,s as ak,t as ck,u as yf,v as dk,w as lk,x as pk,y as uk,z as mk}from"./chunks/chunk-2IZGNOGT.js";import{$ as VI,$a as Tp,$b as Ru,$d as Y_,A as ze,Aa as gP,Ab as nM,Ac as zu,Ad as Vf,B as ee,Ba as yP,Bb as gu,Bc as Hu,Bd as Kf,C as ll,Ca as bP,Cb as iM,Cc as Vu,Cd as Wf,Db as EM,Dc as Ku,Dd as Yf,Eb as SM,Ec as Wu,Ed as Xf,F as He,Fa as UP,Fb as wM,Fc as Yu,Fd as Jf,G as pl,Ga as jP,Gb as AM,Gc as Xu,Gd as Qf,H as ul,Ha as Kl,Hb as OM,Hc as Ju,Hd as Zf,Ia as Wl,Ib as vM,Ic as Qu,Id as e_,J as fe,Ja as Yl,Jb as RM,Jc as Zu,Jd as t_,K as ml,Ka as Xl,Kb as NM,Kc as em,Kd as r_,L as fl,La as Jl,Lb as LM,Lc as tm,Ld as o_,M as _l,Ma as Ql,Mb as yu,Mc as rm,Md as n_,N as hl,Na as Zl,Nb as bu,Nd as i_,O as LI,Oa as ap,Ob as DM,Oc as l0,Od as s_,P as DI,Pa as cp,Pb as $M,Pc as p0,Q as $I,Qa as dp,Qb as FM,Qc as om,Qd as a_,R as FI,Ra as lp,Rb as GM,Rc as um,Rd as c_,S as GI,Sa as pp,Sb as UM,Sc as mm,Sd as d_,T as xt,Ta as up,Tb as Tu,Tc as fm,Td as l_,U as UI,Ua as mp,Ub as Cu,Uc as _m,Ud as p_,V as jI,Va as fp,Vb as Eu,Vc as hm,Vd as u_,W as Nt,Wa as _p,Wb as Su,Wd as m_,X as BI,Xa as hp,Xb as wu,Xd as f_,Y as qI,Ya as gp,Yb as Au,Yd as __,Z as zI,Za as yp,Zb as Ou,Zd as h_,_ as HI,_a as bp,_b as vu,_c as gm,_d as W_,a as JR,aa as Ve,ab as Cp,ac as Iu,ad as Hm,ae as X_,b as It,ba as KI,bb as Ep,bc as Pu,bd as Vm,be as J_,c as QR,ca as Lt,cb as Sp,cc as Mu,cd as Km,ce as Q_,d as Zc,da as WI,db as wp,dc as jM,de as Z_,e as ed,ea as YI,eb as Ap,ec as BM,ed as Wm,ee as eh,f as td,fa as XI,fb as Op,fc as qM,fd as Ym,g as rd,ga as JI,gb as vp,gc as zM,gd as Xm,h as od,ha as QI,hb as Rp,hc as HM,hd as Jm,ia as ZI,ib as VP,ic as VM,id as Qm,j as nd,ja as eP,jb as Ip,jc as KM,jd as kf,k as id,ka as tP,kb as Pp,kc as WM,kd as xf,la as rP,lb as Mp,lc as ku,ld as Nf,ma as oP,mb as kp,mc as i0,md as Lf,na as nP,nb as KP,nc as s0,nd as Df,o as sd,oa as iP,ob as xp,oc as a0,od as $f,p as ad,pa as sP,pb as Np,pc as c0,pd as Ff,qa as aP,qb as Lp,qc as d0,qd as Gf,ra as cP,rb as Dp,rd as Uf,sa as dP,sb as $p,sc as Lu,sd as xk,ta as lP,tb as WP,tc as Du,td as Nk,ua as pP,ub as YP,uc as Gu,ud as Lk,va as uP,vb as XP,vc as Uu,vd as jf,w as Mt,wa as mP,wb as JP,wd as Bf,xa as fP,xb as QP,xc as ju,xd as qf,y as kt,ya as _P,yb as ZP,yc as Bu,yd as zf,za as hP,zb as eM,zc as qu,zd as Hf}from"./chunks/chunk-HJQ3XPS3.js";import"./chunks/chunk-HQYIKAC6.js";import{x as Jd}from"./chunks/chunk-6HRPGEBF.js";import{A as kP,Aa as $l,B as xP,Ba as Fl,C as Il,D as Pl,Da as Gl,E as Ml,Ea as Ul,F as kl,Fa as jl,G as Dt,Ga as Bl,Ha as ql,Ja as zl,Ka as Hl,La as Vl,b as wR,c as AR,d as OR,e as vR,f as RR,g as IR,h as Hs,i as Vs,j as Ks,k as Ws,l as Ys,ma as $t,n as TP,na as Ft,oa as Gt,pa as Ut,qa as xl,sa as Nl,ta as Ll,ua as Dl,w as IP,x as PP,z as MP}from"./chunks/chunk-KEBLUTC3.js";import{a as CP,b as EP,c as SP,d as wP,e as AP,f as OP,g as vP,h as Cl,i as El,j as Sl,k as wl,l as Al,m as RP,n as Ol,o as vl,p as Rl}from"./chunks/chunk-W4TLA5H3.js";import{a as gl,b as yl,e as bl,f as Tl}from"./chunks/chunk-Y4LXVPA5.js";import{$a as hM,$b as D0,A as vI,Aa as du,Ab as Sm,Ac as Dm,B as Qd,Ba as lu,Bb as wm,Bc as $m,C as Zd,Ca as pu,Cb as Am,Cc as Fm,D as el,Da as uu,Db as f0,Dc as Gm,E as tl,Ea as mu,Eb as _0,Ec as Um,F as rl,Fa as fu,Fb as h0,Fc as jm,G as ol,Ga as _u,Gb as g0,Gc as Bm,H as nl,Ha as hu,Hb as y0,Hc as qt,I as il,Ib as b0,Ic as qm,J as sl,Jb as T0,Jc as Z0,K as al,Kc as ek,L as cl,La as tM,Lb as Om,Lc as tk,M as qe,Ma as rM,Mb as C0,Mc as zm,N as RI,Na as oM,Nb as E0,Nc as rk,O as II,Oa as sM,Ob as S0,Oc as Rk,P as PI,Pa as aM,Pb as w0,Pc as Ik,Q as MI,Qa as cM,Qb as A0,Qc as Pk,R as kI,Ra as dM,Rb as O0,Rc as Mk,S as xI,Sa as lM,Sb as v0,Sc as kk,T as NI,Ta as pM,Tb as R0,U as dl,Ua as uM,Ub as I0,V as rp,Va as mM,Vb as P0,W as op,Wa as fM,Wb as M0,X as np,Xa as _M,Xb as k0,Y as ip,Yb as x0,Z as zP,Zb as N0,_ as HP,_b as L0,a as TR,aa as sp,ac as $0,b as CR,ba as Fp,bb as gM,bc as F0,c as ER,ca as Gp,cb as yM,cc as G0,d as SR,da as Up,dc as U0,e as mI,ea as jp,ec as j0,f as fI,fa as Bp,fb as bM,fc as B0,g as _I,ga as qp,gb as TM,gc as q0,h as hI,ha as zp,hb as CM,hc as z0,i as gI,ia as Hp,ic as H0,j as yI,ja as Vp,jb as IM,jc as V0,k as bI,ka as Kp,kb as PM,kc as K0,la as Wp,lb as MM,lc as W0,ma as Yp,mb as kM,mc as Y0,na as Xp,nb as xM,nc as X0,oa as Jp,ob as im,oc as J0,pa as Qp,pb as sm,pc as Q0,qa as Zp,qb as am,qc as Bt,ra as eu,rb as cm,rc as vm,sa as tu,sb as dm,sc as Rm,t as TI,ta as ru,tb as lm,tc as Im,u as CI,ua as ou,ub as ym,uc as Pm,v as EI,va as nu,vb as bm,vc as Mm,w as SI,wa as iu,wb as Tm,wc as km,x as wI,xa as su,xb as Cm,xc as xm,y as AI,ya as au,yb as m0,yc as Nm,z as OI,za as cu,zb as Em,zc as Lm}from"./chunks/chunk-7EZZ4W7O.js";import{a as fR,b as _R}from"./chunks/chunk-5LF5QZT3.js";import{$ as Ea,$a as Ec,A as Js,Aa as Ya,Ab as _d,B as Qs,Ba as Xa,Bb as hd,C as Zs,Ca as Ja,Cb as gd,Da as Qa,Db as yd,E as ea,Ea as Za,Eb as bd,F as ta,Fa as ec,Fb as Td,G as ra,Ga as tc,Gb as Cd,H as oa,Ha as rc,Hb as Ed,I as na,Ia as oc,Ib as Sd,J as ia,Ja as nc,Jb as wd,K as sa,Ka as ic,Kb as Ad,L as aa,La as sc,Lb as Od,M as ca,Ma as ac,Mb as vd,N as da,Na as cc,Nb as Rd,O as la,Oa as dc,Ob as Id,P as pa,Pa as lc,Pb as Pd,Q as ua,Qa as pc,Qb as Md,R as ma,Ra as uc,Rb as kd,Sa as mc,Sb as xd,T as fa,Ta as fc,Tb as Nd,U as _a,Ua as _c,Ub as ZR,V as ha,Va as hc,Vb as eI,W as ga,Wa as gc,Wb as tI,X as ya,Xa as yc,Xb as rI,Y as ba,Ya as bc,Yb as oI,Z as Ta,Za as Tc,Zb as nI,_ as Ca,_a as Cc,a as PR,aa as Sa,ab as Sc,b as MR,ba as wa,bb as wc,bc as iI,c as kR,ca as Aa,cb as Ac,cc as sI,d as xR,da as Oa,db as Oc,dc as aI,e as NR,ea as va,eb as vc,ec as cI,fa as Ra,fb as Rc,fc as dI,g as LR,ga as Ia,gb as Ic,gc as lI,h as DR,ha as Pa,hb as Pc,hc as pI,i as Xs,ia as Ma,ib as Mc,ic as uI,j as $R,ja as ka,ka as xa,kb as Be,kc as Ld,la as Na,lb as Z,lc as Dd,m as FR,ma as La,mb as kc,mc as $d,n as GR,na as Da,nb as zc,nc as Fd,o as Ue,oa as $a,ob as Hc,oc as Gd,p as UR,pa as Fa,pb as Vc,pc as Ud,q as jR,qa as Ga,qb as Kc,qc as jd,r as BR,ra as Ua,rb as Wc,rc as Bd,s as Rt,sa as ja,sb as Yc,sc as qd,t as je,ta as Ba,tb as Xc,tc as zd,u as qR,ua as qa,ub as Jc,uc as Hd,v as zR,va as za,vb as Qc,vc as Pt,w as HR,wa as Ha,wb as pd,x as VR,xa as Va,xb as ud,y as KR,ya as Ka,yb as md,z as WR,za as Wa,zb as fd}from"./chunks/chunk-M5D3CEMY.js";import{a as Zv,b as eR,c as tR,d as rR,e as oR,f as nR,g as iR,h as sR,i as aR,j as Ns,k as Ls,l as Ds,m as $s,n as Fs,o as Gs,q as Us,s as js,y as Bs}from"./chunks/chunk-3BOR22MC.js";import{b as Xv}from"./chunks/chunk-DG2EOOFX.js";import"./chunks/chunk-IB7UB5TE.js";import{$b as av,$c as Rv,A as lC,Aa as eO,Ab as qO,Ac as yv,Ad as Kv,B as pC,Ba as tO,Bc as bv,Bd as Wv,C as uC,Cc as Tv,Cd as Yv,Db as zO,Dc as Cv,Dd as Jv,Ec as Ev,Ed as Qv,Fb as HO,Fc as Sv,Gc as wv,Hc as fs,Ic as _s,Jb as VO,Jc as hs,K as EC,Kb as KO,Kc as gs,La as rO,Lb as WO,Lc as ys,M as MC,Ma as oO,Mb as os,Mc as bs,N as kC,Na as nO,Nb as YO,Nc as Ts,O as xC,Oa as iO,Oc as Cs,P as NC,Pa as sO,Pb as XO,Pc as Es,Q as UC,Qa as aO,Qb as JO,Qc as Ss,R as jC,Ra as mO,Rb as QO,Rc as ws,S as wt,Sa as fO,Sb as ZO,Sc as As,T as TA,Ta as _O,Tb as ev,Tc as Os,U as CA,Ua as At,Ub as tv,Uc as vs,V as EA,Vb as rv,Wa as hO,Wb as ov,Wc as Rs,X as SA,Xa as gO,Xb as nv,Xc as Av,Ya as yO,Yb as iv,Yc as Ov,Z as wA,Za as bO,Zb as Ot,Zc as Is,_ as AA,_a as TO,_b as sv,_c as vv,a as JT,aa as OA,ad as Ps,ba as vA,bb as CO,bd as Ms,ca as RA,cd as Iv,da as IA,dd as Pv,ea as PA,ed as Mv,fa as MA,fb as Xi,fc as ns,fd as kv,ga as kA,gc as is,gd as xv,ha as BA,hb as MO,hc as ss,hd as Nv,i as sn,ib as kO,ic as as,id as Lv,j as QT,ja as Vi,jb as xO,jd as ks,k as ZT,ka as Ki,kb as NO,kc as cs,kd as xs,l as eC,la as Wi,lc as ds,ld as Dv,m as tC,mb as LO,mc as ls,md as $v,na as qA,nb as DO,nc as ps,nd as Fv,o as rC,oa as zA,ob as $O,oc as us,od as Gv,p as oC,pa as HA,pb as FO,pc as ms,pd as Uv,qa as VA,qb as es,qc as cv,qd as jv,r as nC,ra as KA,rb as ts,rc as dv,rd as Bv,sa as WA,sc as lv,sd as qv,t as iC,ta as YA,tb as rs,tc as pv,td as zv,u as sC,ub as GO,uc as uv,ud as Hv,v as aC,va as XA,vc as mv,vd as Vv,wb as UO,wc as fv,x as cC,xa as JA,xb as jO,xc as _v,y as dC,ya as QA,yb as BO,yc as hv,za as ZA,zc as gv,zd as vt}from"./chunks/chunk-7ESF676D.js";import{A as AO,B as OO,C as vO,D as RO,E as IO,F as PO,G as Ji,H as Qi,I as Zi,a as xA,b as NA,c as LA,d as DA,e as $A,f as FA,g as GA,h as UA,i as jA,n as cO,q as dO,r as lO,u as pO,v as Yi,w as uO,x as EO,y as SO,z as wO}from"./chunks/chunk-OXG5XPC7.js";import{$b as IC,$d as fE,$e as BE,$f as bS,$g as fw,$h as Fi,$i as oA,A as Fo,Ad as Wn,Af as ki,Ag as VS,B as Go,Be as AE,Bf as xi,Bg as KS,C as Uo,Cb as SC,Cc as kn,Ce as OE,Cf as Ni,Cg as WS,D as jo,Db as wC,Dc as rE,De as vE,Df as Li,Dg as YS,E as Bo,Ec as xn,Ef as QE,Eg as XS,F as qo,Fa as mC,Ff as ZE,Fg as JS,G as zo,Ga as fC,Gc as oE,Gf as eS,Gg as QS,H as Ho,Ha as _C,Hd as pE,He as _i,Hf as tS,Hg as ZS,I as Ne,Ib as AC,Id as uE,If as rS,Ig as ew,J as Le,Jd as mE,Jf as oS,Jg as tw,Ji as Kw,K as Vo,Ka as gn,Kd as Yn,Kf as nS,Kg as rw,Ki as Ww,L as Ko,La as hC,Lb as OC,Ld as Xn,Le as RE,Lf as iS,Lg as ow,Li as Yw,M as Wo,Ma as gC,Mc as nE,Md as Jn,Me as IE,Mf as sS,Mg as nw,N as Yo,Na as yC,Nd as Qn,Ne as PE,Ng as iw,Ni as Xw,O as Xo,Oa as bC,Ob as vC,Od as Zn,Oe as ME,Oh as Pw,Oi as Jw,P as Jo,Pc as iE,Pd as ei,Pe as kE,Pf as aS,Ph as Ge,Q as Qo,Qa as yn,Qc as sE,Qd as ti,Qe as xE,Qf as cS,Qg as sw,Qh as St,Qi as Qw,R as Zo,Ra as bn,Rb as RC,Rc as Nn,Rd as ri,Re as NE,Rf as dS,Rg as aw,Rh as Mw,Ri as Ui,S as en,Sa as $e,Sc as Ln,Sd as oi,Se as LE,Sf as lS,Sg as cw,Sh as kw,T as tn,Ta as TC,Tb as Tt,Td as ni,Te as DE,Tf as pS,Tg as dw,Th as xw,Ti as ji,U as rn,Ua as CC,Uc as Dn,Ud as ii,Ue as $E,Uf as uS,Ug as lw,Uh as Nw,Ui as Bi,V as on,Va as Tn,Vb as Ct,Vc as $n,Vd as si,Ve as FE,Vf as mS,Vg as pw,Vh as q,W as nn,Wa as Cn,Wc as Fn,Wd as ai,We as GE,Wf as fS,Wg as uw,Wh as Lw,Xb as Pn,Xc as Gn,Xd as ci,Xf as _S,Xg as mw,Xh as Dw,Xi as Zw,Ya as En,Yb as Mn,Yc as Un,Yd as di,Yf as hS,Yh as $w,Yi as eA,Zb as Et,Zc as aE,Ze as UE,Zf as gS,Zh as Fw,Zi as tA,_c as cE,_e as jE,_f as yS,_i as rA,a as R,aa as gt,ae as _E,af as qE,ag as TS,ah as _w,ai as Gi,aj as nA,b as GT,ba as yt,bc as PC,be as li,bf as zE,bg as CS,bj as iA,c as ht,ca as ln,cc as LC,ce as hE,cf as HE,cg as ES,cj as qi,da as pn,dc as DC,de as gE,df as VE,dg as SS,dh as hw,dj as sA,e as UT,ea as un,ec as $C,ef as KE,eg as wS,eh as gw,ej as aA,f as jT,fc as FC,ff as WE,fg as AS,fh as yw,g as BT,gc as GC,gf as YE,gg as OS,gh as bw,h as qT,hc as BC,hf as XE,hg as vS,hh as Tw,hj as cA,i as zT,ic as qC,ie as yE,if as JE,ig as RS,ih as Cw,ij as dA,j as HT,ja as mn,jb as Sn,jc as zC,je as bE,jg as IS,jh as Ew,jj as lA,k as VT,kb as wn,kc as HC,kd as jn,ke as TE,kf as hi,kg as PS,kh as Sw,kj as pA,l as KT,la as fn,lb as An,lc as VC,ld as Bn,le as CE,lf as gi,lg as MS,lh as ww,li as Gw,lj as uA,m as WT,ma as _n,mb as On,mc as KC,md as dE,mf as yi,mg as kS,mh as Aw,mj as mA,n as YT,na as hn,nb as vn,nc as WC,nd as qn,ne as EE,nf as bi,ng as xS,nh as Ow,ni as Uw,nj as zi,o as XT,oc as YC,od as zn,oe as SE,of as Ti,og as NS,oh as vw,oi as jw,p as Po,pc as XC,pd as lE,pf as Ci,pg as LS,ph as Rw,pi as Bw,q as Mo,qc as JC,qd as Hn,qe as wE,qf as Ei,qg as DS,qi as qw,qj as fA,r as ko,rc as QC,rd as Vn,rf as Si,rg as $S,rh as Iw,ri as zw,rj as Hi,s as xo,sc as ZC,sd as L,se as pi,sf as wi,sg as FS,sh as Di,t as ke,tc as eE,td as Kn,te as ui,tf as Ai,tg as GS,th as $i,tj as _A,u as No,ue as mi,uf as Oi,ug as US,uj as hA,v as N,ve as fi,vf as vi,vg as jS,vi as Hw,vj as gA,w as xe,wb as Rn,wf as Ri,wg as BS,wj as yA,x as Lo,xf as Ii,xg as qS,xi as Vw,xj as bA,y as Do,yb as In,yf as Pi,yg as zS,z as $o,zc as tE,zd as Fe,zf as Mi,zg as HS}from"./chunks/chunk-FOYRE23V.js";import"./chunks/chunk-VS565KBX.js";import"./chunks/chunk-SPPHDVZE.js";import{A as ue,B as FT,C as b,E as an,F as bt,G as me,H as cn,K as De,M as dn,b as MT,c as kT,d as xT,m as NT,r as LT,u as DT,y as $T}from"./chunks/chunk-5OFMWP3Q.js";import"./chunks/chunk-XAWE4EAK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8f11e0bf-4115-55a8-bd39-c360f43cdc09")}catch{}})();var z="2026-07-28",or=["2025-11-25","2025-06-18"],te=[z],m={headerMismatch:-32020,missingRequiredClientCapability:-32021,unsupportedProtocolVersion:-32022,invalidParams:-32602},w={clientCapabilities:"io.modelcontextprotocol/clientCapabilities",clientInfo:"io.modelcontextprotocol/clientInfo",logLevel:"io.modelcontextprotocol/logLevel",protocolVersion:"io.modelcontextprotocol/protocolVersion",serverInfo:"io.modelcontextprotocol/serverInfo"},rr=["debug","info","notice","warning","error","critical","alert","emergency"],u=class extends Error{code;data;constructor(t,r,o={}){super(t),this.name="PmMcpProtocolError",this.code=r,this.data=o}};function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function xg(e){if(e===void 0)return;if(!h(e))throw new u("Invalid MCP clientInfo metadata",m.invalidParams,{field:w.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:w.clientInfo,required:["name","version"]});let o={name:t.slice(0,128),version:r.slice(0,128)};return typeof e.description=="string"&&e.description.trim()&&(o.description=e.description.trim().slice(0,1024)),typeof e.websiteUrl=="string"&&e.websiteUrl.trim()&&(o.websiteUrl=e.websiteUrl.trim().slice(0,2048)),o}function Ng(e){if(e!==void 0){if(typeof e!="string"||!rr.includes(e))throw new u("Invalid MCP logLevel metadata",m.invalidParams,{field:w.logLevel,allowed:[...rr]});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:[w.protocolVersion,w.clientCapabilities]});let r=t[w.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 o=t[w.clientCapabilities];if(!h(o))throw new u("Invalid MCP client capabilities metadata",m.invalidParams,{field:w.clientCapabilities,expected:"object"});let n=xg(t[w.clientInfo]),s=Ng(t[w.logLevel]);return{protocolVersion:z,clientCapabilities:o,...n?{clientInfo:n}:{},...s?{logLevel:s}:{}}}function AN(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 ON(e,t){let r=t.filter(o=>!Object.prototype.hasOwnProperty.call(e.clientCapabilities,o));if(r.length>0)throw new u("Missing required client capability",m.missingRequiredClientCapability,{requiredCapabilities:Object.fromEntries(r.map(o=>[o,{}]))})}function vN(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,[w.serverInfo]:{...t}}}}function Lg(e,t){return Xe({...e,resultType:"complete"},t)}function RN(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 Lg({supportedVersions:[...te],capabilities:structuredClone(e.capabilities),ttlMs:t,cacheScope:"public",...e.instructions?{instructions:e.instructions}:{}},e.serverInfo)}function IN(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"})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d4a56906-c542-567e-9265-15184a5c330b")}catch{}})();var Dg=new Set(["--help","-h","--version","-V"]);function $g(e,t){let r=[`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"&&r.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."),r.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",""),r.join(`
2
2
  `)}function kN(e,t,r){if(e.length===0)return{kind:"serve"};let o=e.find(n=>!Dg.has(n));if(o!==void 0){let n=t==="stdio"?"pm-mcp":"pm-mcp-http";return{kind:"exit",exitCode:64,stdout:"",stderr:`Unsupported argument ${JSON.stringify(o)}. Run ${n} --help.
3
3
  `}}return{kind:"exit",exitCode:0,stdout:e.includes("--help")||e.includes("-h")?$g(t,r):`${r}
4
4
  `,stderr:""}}import{createHash as sr,createHmac as ar,timingSafeEqual as Fg}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="15b81dd0-ef1a-58be-b6ee-5975b6778993")}catch{}})();var Gg=["elicitation/create","roots/list","sampling/createMessage"],nr=class extends Error{inputRequests;requestState;constructor(t){super("MCP operation requires additional input"),this.name="PmMcpInputRequiredError",this.inputRequests=t.inputRequests,this.requestState=t.requestState}},cr=/^[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 Ug(e){return e==="elicitation/create"?"elicitation":e==="sampling/createMessage"?"sampling":"roots"}function ye(e,t,r){let o;try{o=JSON.stringify(e)}catch{throw new u(`Invalid ${r}: value is not JSON serializable`,m.invalidParams,{field:r})}if(Buffer.byteLength(o,"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 o={};for(let[n,s]of r){if(!cr.test(n)||!h(s))throw new u("Invalid MCP input request entry",m.invalidParams,{field:`inputRequests.${n}`});let i=s.method;if(typeof i!="string"||!Gg.includes(i))throw new u("Unsupported MCP input request method",m.invalidParams,{field:`inputRequests.${n}.method`,method:i??null});let a=Ug(i);if(!Object.prototype.hasOwnProperty.call(t.clientCapabilities,a))throw new u("Missing required client capability",m.missingRequiredClientCapability,{requiredCapabilities:{[a]:{}}});if(!h(s.params))throw new u("Invalid MCP input request parameters",m.invalidParams,{field:`inputRequests.${n}.params`,expected:"object"});o[n]={method:i,params:structuredClone(s.params)}}return ye(o,Qe,"inputRequests"),o}function dr(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[o,n]of t){if(!cr.test(o)||!h(n))throw new u("Invalid MCP input response entry",m.invalidParams,{field:`inputResponses.${o}`});r[o]=structuredClone(n)}return ye(r,Qe,"inputResponses"),r}function DN(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:{[w.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 $N(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 o=r.toString("base64url"),n=ar("sha256",lr(t)).update(o).digest("base64url");return`${o}.${n}`}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:o,principal:n,state:s}=e;if(typeof t!="number"||!Number.isSafeInteger(t))throw new u("Invalid MCP requestState payload",m.invalidParams,{field:"requestState"});if(typeof r!="string"||typeof o!="string"||typeof n!="string")throw new u("Invalid MCP requestState payload",m.invalidParams,{field:"requestState"});return{expiresAt:t,method:r,parameterDigest:o,principal:n,state:s}}function FN(e,t,r){let[o,n,s]=e.split(".");if(!o||!n||s!==void 0)throw new u("Invalid MCP requestState encoding",m.invalidParams,{field:"requestState"});let i=Buffer.from(n,"base64url"),a=ar("sha256",lr(t)).update(o).digest();if(i.byteLength!==a.byteLength||!Fg(i,a))throw new u("Invalid MCP requestState signature",m.invalidParams,{field:"requestState"});let c;try{c=JSON.parse(Buffer.from(o,"base64url").toString("utf8"))}catch{c=null}let d=jg(c),{expiresAt:l,method:p,parameterDigest:f,principal:_}=d;if(l<(r.nowMs??Date.now()))throw new u("Expired MCP requestState",m.invalidParams,{field:"requestState",expiredAt:l});if(p!==r.method||f!==r.parameterDigest||_!==r.principal)throw new u("MCP requestState binding mismatch",m.invalidParams,{field:"requestState"});return d}function GN(e){return ye(e,Qe,"request parameters"),sr("sha256").update(JSON.stringify(e)).digest("hex")}var ir=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=sr("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 o=this.#e.values().next().value;this.#e.delete(o)}this.#e.add(r)}};function Bg(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 UN(e,t){return{...e,...Bg(t)}}function qg(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function zg(e,t){if(t==="#")return e;if(!t.startsWith("#/"))return;let r=e;for(let o of t.slice(2).split("/").map(qg)){if(!h(r)&&!Array.isArray(r)||!Object.prototype.hasOwnProperty.call(r,o))return;r=r[o]}return r}function Hg(e){let t=e.maxBytes??Je.maxBytes,r=e.maxDepth??Je.maxDepth,o=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(o)||o<1)throw new u("Invalid MCP JSON Schema work bounds",m.invalidParams);return{maximumBytes:t,maximumDepth:r,maximumNodes:o}}function Vg(e,t){let r=Array.isArray(e.value)?e.value:h(e.value)?Object.values(e.value):[];for(let o of r)t.push({value:o,depth:e.depth+1})}function Kg(e,t){if(!h(t)||typeof t.$ref!="string")return;let r=t.$ref;if(r.startsWith("#")&&zg(e,r)===void 0)throw new u("MCP JSON Schema contains an unresolved local reference",m.invalidParams,{reference:r})}function jN(e,t={}){let{maximumBytes:r,maximumDepth:o,maximumNodes:n}=Hg(t);if(typeof e!="boolean"&&!h(e))throw new u("Invalid MCP JSON Schema root",m.invalidParams,{expected:"object or boolean"});ye(e,r,"JSON Schema");let s=[{value:e,depth:0}],i=0;for(;s.length>0;){let a=s.pop();if(i+=1,i>n||a.depth>o)throw new u("MCP JSON Schema exceeds validation work bounds",m.invalidParams,{maximumDepth:o,maximumNodes:n});Kg(e,a.value),Vg(a,s)}return structuredClone(e)}import{randomUUID as Wg}from"node:crypto";import{readFile as Yg}from"node:fs/promises";import pr from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f3e94896-b2a0-561c-902b-71c28ddde2a1")}catch{}})();var YN="io.modelcontextprotocol/tasks",Xg=["working","input_required","completed","failed","cancelled"],Jg=/^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,Qg=3600*1e3,Zg=1e3,Te=1024,ey=30,ty=2e3;function et(e){return new u(e,m.invalidParams,{code:"mcp_task_not_found_or_not_authorized"})}function be(e){let t=e.trim();if(!Jg.test(t))throw et("Unknown MCP task");return t}function ur(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 mr(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,Te),...h(e.data)?{data:structuredClone(e.data)}:{}}}function ry(e){if(!Xg.includes(e))throw new u("Corrupt MCP task record",m.invalidParams);return e}function oy(e){if(typeof e!="string"||e.length===0)throw new u("Corrupt MCP task record",m.invalidParams);return e}function ny(e){if(typeof e!="number"||!Number.isSafeInteger(e)||e<1)throw new u("Corrupt MCP task record",m.invalidParams);return e}function iy(e){if(e!==null&&(typeof e!="number"||!Number.isSafeInteger(e)||e<0))throw new u("Corrupt MCP task record",m.invalidParams);return e}function sy(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 ay(e){if(!Array.isArray(e)||e.some(t=>typeof t!="string"))throw new u("Corrupt MCP task record",m.invalidParams);return[...e]}function cy(e){if(!h(e)||e.version!==1)throw new u("Corrupt MCP task record",m.invalidParams);let t=typeof e.taskId=="string"?be(e.taskId):"",r=ry(e.status),o=oy(e.principal),n=ny(e.workerPid),s=iy(e.ttlMs),i=sy(e.pollIntervalMs),a={version:1,taskId:t,status:r,principal:o,workerPid:n,createdAt:ur(e.createdAt,"createdAt"),lastUpdatedAt:ur(e.lastUpdatedAt,"lastUpdatedAt"),ttlMs:s,consumedInputKeys:ay(e.consumedInputKeys),...typeof e.statusMessage=="string"?{statusMessage:e.statusMessage.slice(0,Te)}:{},...typeof i=="number"?{pollIntervalMs:i}:{}};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=mr(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 dy(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;#o;#i;constructor(t){this.#e=pr.resolve(t.pmRoot),this.#t=t.owner?.trim()||"pm-mcp",this.#r=t.now??(()=>new Date),this.#o=t.taskIdFactory??(()=>`mcp-task-${Wg()}`),this.#i=t.workerPid??process.pid}#s(t){return pr.join(this.#e,"runtime","mcp-tasks","records",`${be(t)}.json`)}async#c(t){try{return cy(JSON.parse(await Yg(this.#s(t),"utf8")))}catch(r){throw me(r)||r instanceof SyntaxError?et("Unknown MCP task"):r}}async#a(t){await De(this.#s(t.taskId),`${JSON.stringify(t,null,2)}
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fa27dff5-0270-505f-bd5f-bc1eb0fe5ad8")}catch{}})();import{readdir,realpath,stat}from"node:fs/promises";import path from"node:path";import{EXIT_CODE}from"../shared/constants.js";import{PmCliError}from"../shared/errors.js";const MAX_PATTERN_LENGTH=4096,MAX_NESTING=32,MAX_RANGE_SIZE=1e3,MAX_STATES=5e4,DFA_LIMITS={nodes:1e4,edges:4e4,stateIds:2e6},SLASH=47;class GlobTooComplex extends Error{}const POSIX_CLASSES=new Map(Object.entries({alnum:[[48,57],[65,90],[97,122]],alpha:[[65,90],[97,122]],ascii:[[0,127]],blank:[[9,9],[32,32]],cntrl:[[0,31],[127,127]],digit:[[48,57]],graph:[[33,126]],lower:[[97,122]],print:[[32,126]],punct:[[33,47],[58,64],[91,96],[123,126]],space:[[9,13],[32,32]],upper:[[65,90]],word:[[48,57],[65,90],[95,95],[97,122]],xdigit:[[48,57],[65,70],[97,102]]}));function negationRefusal(){return new PmCliError("--add-glob does not support negated patterns (a leading ! or !(...)); list the files or patterns to link instead",EXIT_CODE.USAGE)}function bracketEnd(chars,start){let index=start+1;for((chars[index]==="!"||chars[index]==="^")&&(index+=1),chars[index]==="]"&&(index+=1);index<chars.length;){const char=chars[index];if(char==="\\")index+=2;else if(char==="["&&chars[index+1]===":"){const close=chars.indexOf(":",index+2);close===-1||chars[close+1]!=="]"?index+=1:index=close+2}else{if(char==="]")return index+1;index+=1}}return-1}function openerAt(chars,index,open){const char=chars[index];if(char==="{")return{index,kind:"{"};if(char!=="(")return;const operator=chars[index-1];return operator!==void 0&&"@?*+!".includes(operator)&&!isEscaped(chars,index-1)?{index:index-1,kind:"("}:open.some(opener=>opener.kind==="(")?{index,kind:"plain"}:void 0}function closeAt(chars,index,open,closers,groups){const char=chars[index],top=open.at(-1);if(char===")"&&top?.kind==="plain"){open.pop(),groups.set(top.index,index);return}const kind=char==="}"?"{":char===")"?"(":void 0;if(!(kind===void 0||top?.kind!==kind)&&(open.pop(),closers.set(top.index,index),chars[top.index]==="!"))throw negationRefusal()}function pairConstructs(chars){const closers=new Map,brackets=new Map,groups=new Map,open=[];let index=0;for(;index<chars.length;){if(chars[index]==="\\"){index+=2;continue}const end=chars[index]==="["?bracketEnd(chars,index):-1;if(end!==-1){brackets.set(index,end),index=end;continue}const opener=openerAt(chars,index,open);if(opener!==void 0?open.push(opener):closeAt(chars,index,open,closers,groups),open.length>MAX_NESTING)throw new GlobTooComplex;index+=1}return{closers,brackets,groups}}function isEscaped(chars,index){let count=0;for(let cursor=index-1;cursor>=0&&chars[cursor]==="\\";cursor-=1)count+=1;return count%2===1}function literalNodes(text){return Array.from(text,char=>({kind:"char",value:char.codePointAt(0)}))}function braceRange(content){const numeric=/^(-?(?:0|[1-9]\d{0,8}))\.\.(-?(?:0|[1-9]\d{0,8}))$/u.exec(content),alphabetic=/^([A-Za-z])\.\.([A-Za-z])$/u.exec(content);if(numeric===null&&alphabetic===null)return;const[from,to]=numeric!==null?[Number(numeric[1]),Number(numeric[2])]:[alphabetic[1].codePointAt(0),alphabetic[2].codePointAt(0)];if(Math.abs(to-from)+1>MAX_RANGE_SIZE)throw new GlobTooComplex;const step=from<=to?1:-1,values=[];for(let value=from;value!==to+step;value+=step)values.push(numeric!==null?String(value):String.fromCodePoint(value));return values}function posixClassAt(chars,index){if(chars[index]!=="["||chars[index+1]!==":")return;const colon=chars.indexOf(":",index+2);if(!(colon===-1||chars[colon+1]!=="]"))return{ranges:POSIX_CLASSES.get(chars.slice(index+2,colon).join(""))??[],next:colon+2}}function memberAt(chars,index,close){const escaped=chars[index]==="\\"&&index+1<close;return{codePoint:chars[escaped?index+1:index].codePointAt(0),next:index+(escaped?2:1)}}function bracketLiteral(chars,start,end){const literal=[];for(let cursor=start;cursor<end;cursor+=1)chars[cursor]==="\\"&&cursor+1<end&&(cursor+=1),literal.push(chars[cursor].codePointAt(0));return literal}function parseClass(chars,start,end){let index=start+1;const negated=chars[index]==="!"||chars[index]==="^";negated&&(index+=1);const ranges=[],close=end-1;for(;index<close;){const posix=posixClassAt(chars,index);if(posix!==void 0){ranges.push(...posix.ranges),index=posix.next;continue}const low=memberAt(chars,index,close);if(index=low.next,chars[index]!=="-"||index+1>=close){ranges.push([low.codePoint,low.codePoint]);continue}const high=memberAt(chars,index+1,close);index=high.next,low.codePoint<=high.codePoint&&ranges.push([low.codePoint,high.codePoint])}return{kind:"class",negated,ranges,literal:bracketLiteral(chars,start,end)}}class Parser{chars;closers;brackets;groups;constructor(chars,pairs){this.chars=chars,this.closers=pairs.closers,this.brackets=pairs.brackets,this.groups=pairs.groups}alternatives(start,end,separator){const options=[];let cursor=start;for(;;){const{nodes,stop}=this.sequence(cursor,end,separator);if(options.push(nodes),stop>=end)return options;cursor=stop+1}}sequence(start,end,separator){const nodes=[];let index=start;for(;index<end;){if(this.chars[index]===separator)return{nodes,stop:index};const token=this.token(index,end);nodes.push(...token.nodes),index=token.next}return{nodes,stop:end}}token(index,end){const char=this.chars[index];if(char==="\\")return{nodes:literalNodes(index+1<end?this.chars[index+1]:"\\"),next:index+2};const closer=this.closers.get(index);if(closer!==void 0)return{nodes:char==="{"?this.brace(index,closer):this.extglob(char,index,closer),next:closer+1};const group=this.groups.get(index);if(group!==void 0)return{nodes:[...literalNodes("("),...this.sequence(index+1,group,void 0).nodes,...literalNodes(")")],next:group+1};const bracket=this.brackets.get(index);return bracket!==void 0?{nodes:[parseClass(this.chars,index,bracket)],next:bracket}:char==="*"?this.stars(index,end):{nodes:char==="?"?[{kind:"any"}]:literalNodes(char),next:index+1}}extglob(operator,index,closer){const options=this.alternatives(index+2,closer,"|");return[operator==="@"?{kind:"alt",options}:{kind:"repeat",optional:operator!=="+",many:operator!=="?",options}]}brace(index,closer){const options=this.alternatives(index+1,closer,",");if(options.length>1)return[{kind:"alt",options}];const range=braceRange(this.chars.slice(index+1,closer).join(""));return range!==void 0?[{kind:"alt",options:range.map(literalNodes)}]:[...literalNodes("{"),...options[0],...literalNodes("}")]}stars(index,end){let run=1;for(;this.chars[index+run]==="*"&&index+run<end&&!this.closers.has(index+run);)run+=1;if(run!==2)return{nodes:[{kind:"star"}],next:index+run};const slash=index+run<end&&this.chars[index+run]==="/";return{nodes:[{kind:"globstar",slash}],next:index+run+(slash?1:0)}}}const END_KINDS=["segment","inside"],ANY={kind:"any"};function entriesOf(ends){return END_KINDS.flatMap(kind=>ends[kind]===void 0?[]:[ends[kind]])}class Nfa{states=[];add(){if(this.states.length>=MAX_STATES)throw new GlobTooComplex;return this.states.push({epsilon:[],syntactic:[],edges:[]}),this.states.length-1}epsilon(from,to,syntactic=!0){this.states[from].epsilon.push(to),syntactic&&this.states[from].syntactic.push(to)}consume(from,test,kind){const to=this.add();for(const entry of entriesOf(from))this.states[entry].edges.push({test,to});return{[kind]:to}}join(parts){const joined={};for(const kind of END_KINDS){const states=parts.flatMap(part=>part[kind]===void 0?[]:[part[kind]]);if(states.length===1&&(joined[kind]=states[0]),states.length>1){const merged=this.add();for(const state of states)this.epsilon(state,merged);joined[kind]=merged}}return joined}feed(ends,loop){for(const kind of END_KINDS)ends[kind]!==void 0&&this.epsilon(ends[kind],loop[kind])}build(nodes,from){let current=from;for(const node of nodes)current=this.node(node,current);return current}alternation(options,from){return this.join(options.map(option=>this.build(option,from)))}star(from){const loop=this.add();for(const entry of entriesOf(from))this.epsilon(entry,loop,!1);return this.states[loop].edges.push({test:ANY,to:loop}),{inside:loop}}segments(from){const between=this.add();this.epsilon(from,between,!1);const inside=this.add();return this.states[between].edges.push({test:ANY,to:inside}),this.states[inside].edges.push({test:ANY,to:inside},{test:{kind:"char",value:SLASH},to:between}),between}globstar(from,slash){if(slash){const parts=[];return from.segment!==void 0&&parts.push({segment:this.segments(from.segment)}),from.inside!==void 0&&parts.push(this.consume(this.star({inside:from.inside}),{kind:"char",value:SLASH},"segment")),this.join(parts)}const star=this.star(from);return from.segment!==void 0&&this.globstars.push({continuation:star.inside,entry:from.segment}),star}globstars=[];syntacticClosure(seed){const seen=new Set(seed),stack=[...seed];for(;stack.length>0;)for(const next of this.states[stack.pop()].syntactic)seen.has(next)||(seen.add(next),stack.push(next));return seen}resolveGlobstars(accept){for(const{continuation,entry}of this.globstars){const reachable=this.syntacticClosure([continuation]);if(reachable.has(accept)){const rest=this.add();this.epsilon(entry,rest,!1),this.states[rest].edges.push({test:{kind:"all"},to:rest}),this.epsilon(rest,accept,!1)}const targets=new Set;for(const state of reachable)for(const{test,to}of this.states[state].edges)accepts(test,SLASH)&&targets.add(to);if(targets.size===0)continue;const segments=this.segments(entry);for(const target of targets)this.epsilon(segments,target,!1)}}repeat(node,from){if(!node.many)return this.join([from,this.alternation(node.options,from)]);const loop={segment:this.add(),inside:this.add()};return this.feed(node.optional?from:this.alternation(node.options,from),loop),this.feed(this.alternation(node.options,loop),loop),loop}node(node,from){switch(node.kind){case"char":return this.consume(from,{kind:"char",value:node.value},node.value===SLASH?"segment":"inside");case"any":return this.consume(from,ANY,"inside");case"star":return this.star(from);case"globstar":return this.globstar(from,node.slash);case"class":return this.join([this.consume(from,{kind:"class",negated:node.negated,ranges:node.ranges},"inside"),this.build(node.literal.map(value=>({kind:"char",value})),from)]);case"alt":return this.alternation(node.options,from);case"repeat":return this.repeat(node,from)}}}function accepts(test,codePoint){switch(test.kind){case"char":return test.value===codePoint;case"any":return codePoint!==SLASH;case"all":return!0;case"class":return codePoint!==SLASH&&test.ranges.some(([low,high])=>codePoint>=low&&codePoint<=high)!==test.negated}}class PathMatcher{generation=0;nextId=0;nodes=new Map;edges=new Map;stateIds=0;nfa;acceptState;limits;start;constructor(nfa,startState,acceptState,limits){this.nfa=nfa,this.acceptState=acceptState,this.limits=limits,this.start=this.node(this.closure([startState]))}retained(){return{nodes:this.nodes.size,edges:this.edges.size,stateIds:this.stateIds}}reset(){this.generation+=1,this.nodes=new Map,this.edges=new Map,this.stateIds=0}closure(seed){const seen=new Set(seed),stack=[...seed];for(;stack.length>0;)for(const next of this.nfa.states[stack.pop()].epsilon)seen.has(next)||(seen.add(next),stack.push(next));return[...seen].sort((left,right)=>left-right)}node(states){const key=states.join(","),cached=this.nodes.get(key);if(cached!==void 0)return cached;(this.nodes.size>=this.limits.nodes||this.stateIds+states.length>this.limits.stateIds)&&this.reset();const created={id:this.nextId,generation:this.generation,states,accepting:states.includes(this.acceptState)};return this.nextId+=1,this.nodes.set(key,created),this.stateIds+=states.length,created}step(from,codePoint){const key=`${from.id}:${codePoint}`,known=from.generation===this.generation?this.edges.get(key):void 0;if(known!==void 0)return known;const reached=[];for(const state of from.states)for(const{test,to}of this.nfa.states[state].edges)accepts(test,codePoint)&&reached.push(to);const next=this.node(this.closure(reached));return this.edges.size>=this.limits.edges&&this.reset(),from.generation===this.generation&&this.edges.set(key,next),next}advance(from,text){let node=from;for(const char of text){if(node.states.length===0)return node;node=this.step(node,char.codePointAt(0))}return node}}function compile(text,limits=DFA_LIMITS){const chars=Array.from(text),nodes=new Parser(chars,pairConstructs(chars)).sequence(0,chars.length,void 0).nodes,nfa=new Nfa,start=nfa.add(),accept=nfa.add();for(const end of entriesOf(nfa.build(nodes,{segment:start})))nfa.epsilon(end,accept);return nfa.resolveGlobstars(accept),new PathMatcher(nfa,start,accept,limits)}function isStaticSegment(segment){return!/[*?[\]{}()!@+\\]/u.test(segment)}function kindOf(entry){return entry.isFile()?"file":entry.isDirectory()?"directory":"other"}async function resolveEntry(directory,real,entry){if(!entry.isSymbolicLink())return{kind:kindOf(entry),real:path.join(real,entry.name)};try{const target=await realpath(path.join(directory,entry.name));return{kind:kindOf(await stat(target)),real:target}}catch{return}}async function walk(matcher,directory,real,prefix,node,ancestors,out){let entries;try{entries=await readdir(directory,{withFileTypes:!0})}catch{return}for(const entry of entries){const afterName=matcher.advance(node,entry.name);if(afterName.states.length===0)continue;const resolved=await resolveEntry(directory,real,entry);if(resolved===void 0)continue;const relative=path.posix.join(prefix,entry.name);if(resolved.kind==="file"&&afterName.accepting&&out.push(relative),resolved.kind!=="directory")continue;const afterSlash=matcher.step(afterName,SLASH);afterSlash.states.length===0||ancestors.has(resolved.real)||(ancestors.add(resolved.real),await walk(matcher,path.join(directory,entry.name),resolved.real,relative,afterSlash,ancestors,out),ancestors.delete(resolved.real))}}function normalizePattern(pattern){const normalized=path.posix.normalize(pattern);return/^\/\/[^/]/u.test(pattern)?`/${normalized}`:normalized}function trimTrailingSeparators(pattern){let text=pattern;for(;text.length>1&&text.endsWith("/")&&!isEscaped(text,text.length-1);)text=text.slice(0,-1);return text}async function listed(directory,name){return(await readdir(directory).catch(()=>[])).includes(name)}async function exactCase(cwd,segments){let directory=cwd,index=0;for(;segments[index]==="..";)directory=path.dirname(directory),index+=1;for(;index<segments.length;index+=1){if(!await listed(directory,segments[index]))return!1;directory=path.join(directory,segments[index])}return!0}async function literalMatch(text,cwd){const target=path.resolve(cwd,text),found=await stat(target).catch(()=>{});if(found===void 0||!found.isFile())return[];const absolute=path.isAbsolute(text);return(absolute?await listed(path.dirname(target),path.basename(target)):await exactCase(cwd,text.split("/")))?[absolute?target.replaceAll("\\","/"):path.posix.normalize(text)]:[]}function splitStatic(text,cwd){const segments=text.split("/");let count=0;for(;count<segments.length&&isStaticSegment(segments[count]);)count+=1;if(count===segments.length)return;const prefix=count===0?"":`${segments.slice(0,count).join("/")}/`,root=path.resolve(cwd,prefix),rest=segments.slice(count).join("/");if(path.isAbsolute(text))return{root,base:root.replaceAll("\\","/"),rest,prefix:[]};const relative=path.posix.normalize(prefix===""?".":prefix).replace(/\/$/u,"");return{root,base:relative==="."?"":relative,rest,prefix:segments.slice(0,count)}}function compileWithinBounds(text){try{return compile(text)}catch(error){if(error instanceof GlobTooComplex)return;throw error}}async function expandFileGlob(pattern,cwd){if(pattern.startsWith("!"))throw negationRefusal();if(Array.from(pattern).length>MAX_PATTERN_LENGTH)return[];const text=trimTrailingSeparators(normalizePattern(pattern)),parts=splitStatic(text,cwd);if(parts===void 0)return literalMatch(text,cwd);const matcher=compileWithinBounds(parts.rest);if(matcher===void 0||!await exactCase(cwd,parts.prefix))return[];const real=await realpath(parts.root).catch(()=>{});if(real===void 0)return[];const out=[];return await walk(matcher,parts.root,real,"",matcher.start,new Set([real]),out),out.map(relative=>joinOutput(parts.base,relative))}function joinOutput(base,relative){return base.startsWith("//")?`/${path.posix.join(base.slice(1),relative)}`:path.posix.join(base,relative)}const _testOnly={compile,joinOutput,normalizePattern};export{_testOnly,expandFileGlob};
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="30379998-be47-5176-bfd4-a02bca99bd16")}catch{}})();import{readdir,realpath,stat}from"node:fs/promises";import path from"node:path";import{EXIT_CODE}from"../shared/constants.js";import{PmCliError}from"../shared/errors.js";const MAX_PATTERN_LENGTH=4096,MAX_NESTING=32,MAX_RANGE_SIZE=1e3,MAX_STATES=5e4,DFA_LIMITS={nodes:1e4,edges:4e4,stateIds:2e6},SLASH=47;class GlobTooComplex extends Error{}const POSIX_CLASSES=new Map(Object.entries({alnum:[[48,57],[65,90],[97,122]],alpha:[[65,90],[97,122]],ascii:[[0,127]],blank:[[9,9],[32,32]],cntrl:[[0,31],[127,127]],digit:[[48,57]],graph:[[33,126]],lower:[[97,122]],print:[[32,126]],punct:[[33,47],[58,64],[91,96],[123,126]],space:[[9,13],[32,32]],upper:[[65,90]],word:[[48,57],[65,90],[95,95],[97,122]],xdigit:[[48,57],[65,70],[97,102]]}));function negationRefusal(){return new PmCliError("--add-glob does not support negated patterns (a leading ! or !(...)); list the files or patterns to link instead",EXIT_CODE.USAGE)}function bracketEnd(chars,start){let index=start+1;for((chars[index]==="!"||chars[index]==="^")&&(index+=1),chars[index]==="]"&&(index+=1);index<chars.length;){const char=chars[index];if(char==="\\")index+=2;else if(char==="["&&chars[index+1]===":"){const close=chars.indexOf(":",index+2);close===-1||chars[close+1]!=="]"?index+=1:index=close+2}else{if(char==="]")return index+1;index+=1}}return-1}function openerAt(chars,index,open){const char=chars[index];if(char==="{")return{index,kind:"{"};if(char!=="(")return;const operator=chars[index-1];return operator!==void 0&&"@?*+!".includes(operator)&&!isEscaped(chars,index-1)?{index:index-1,kind:"("}:open.some(opener=>opener.kind==="(")?{index,kind:"plain"}:void 0}function closeAt(chars,index,open,closers,groups){const char=chars[index],top=open.at(-1);if(char===")"&&top?.kind==="plain"){open.pop(),groups.set(top.index,index);return}const kind=char==="}"?"{":char===")"?"(":void 0;if(!(kind===void 0||top?.kind!==kind)&&(open.pop(),closers.set(top.index,index),chars[top.index]==="!"))throw negationRefusal()}function pairConstructs(chars){const closers=new Map,brackets=new Map,groups=new Map,open=[];let index=0;for(;index<chars.length;){if(chars[index]==="\\"){index+=2;continue}const end=chars[index]==="["?bracketEnd(chars,index):-1;if(end!==-1){brackets.set(index,end),index=end;continue}const opener=openerAt(chars,index,open);if(opener!==void 0?open.push(opener):closeAt(chars,index,open,closers,groups),open.length>MAX_NESTING)throw new GlobTooComplex;index+=1}return{closers,brackets,groups}}function isEscaped(chars,index){let count=0;for(let cursor=index-1;cursor>=0&&chars[cursor]==="\\";cursor-=1)count+=1;return count%2===1}function literalNodes(text){return Array.from(text,char=>({kind:"char",value:char.codePointAt(0)}))}function braceRange(content){const numeric=/^(-?(?:0|[1-9]\d{0,8}))\.\.(-?(?:0|[1-9]\d{0,8}))$/u.exec(content),alphabetic=/^([A-Za-z])\.\.([A-Za-z])$/u.exec(content);if(numeric===null&&alphabetic===null)return;const[from,to]=numeric!==null?[Number(numeric[1]),Number(numeric[2])]:[alphabetic[1].codePointAt(0),alphabetic[2].codePointAt(0)];if(Math.abs(to-from)+1>MAX_RANGE_SIZE)throw new GlobTooComplex;const step=from<=to?1:-1,values=[];for(let value=from;value!==to+step;value+=step)values.push(numeric!==null?String(value):String.fromCodePoint(value));return values}function posixClassAt(chars,index){if(chars[index]!=="["||chars[index+1]!==":")return;const colon=chars.indexOf(":",index+2);if(!(colon===-1||chars[colon+1]!=="]"))return{ranges:POSIX_CLASSES.get(chars.slice(index+2,colon).join(""))??[],next:colon+2}}function memberAt(chars,index,close){const escaped=chars[index]==="\\"&&index+1<close;return{codePoint:chars[escaped?index+1:index].codePointAt(0),next:index+(escaped?2:1)}}function bracketLiteral(chars,start,end){const literal=[];for(let cursor=start;cursor<end;cursor+=1)chars[cursor]==="\\"&&cursor+1<end&&(cursor+=1),literal.push(chars[cursor].codePointAt(0));return literal}function parseClass(chars,start,end){let index=start+1;const negated=chars[index]==="!"||chars[index]==="^";negated&&(index+=1);const ranges=[],close=end-1;for(;index<close;){const posix=posixClassAt(chars,index);if(posix!==void 0){ranges.push(...posix.ranges),index=posix.next;continue}const low=memberAt(chars,index,close);if(index=low.next,chars[index]!=="-"||index+1>=close){ranges.push([low.codePoint,low.codePoint]);continue}const high=memberAt(chars,index+1,close);index=high.next,low.codePoint<=high.codePoint&&ranges.push([low.codePoint,high.codePoint])}return{kind:"class",negated,ranges,literal:bracketLiteral(chars,start,end)}}class Parser{chars;closers;brackets;groups;constructor(chars,pairs){this.chars=chars,this.closers=pairs.closers,this.brackets=pairs.brackets,this.groups=pairs.groups}alternatives(start,end,separator){const options=[];let cursor=start;for(;;){const{nodes,stop}=this.sequence(cursor,end,separator);if(options.push(nodes),stop>=end)return options;cursor=stop+1}}sequence(start,end,separator){const nodes=[];let index=start;for(;index<end;){if(this.chars[index]===separator)return{nodes,stop:index};const token=this.token(index,end);nodes.push(...token.nodes),index=token.next}return{nodes,stop:end}}token(index,end){const char=this.chars[index];if(char==="\\")return{nodes:literalNodes(index+1<end?this.chars[index+1]:"\\"),next:index+2};const closer=this.closers.get(index);if(closer!==void 0)return{nodes:char==="{"?this.brace(index,closer):this.extglob(char,index,closer),next:closer+1};const group=this.groups.get(index);if(group!==void 0)return{nodes:[...literalNodes("("),...this.sequence(index+1,group,void 0).nodes,...literalNodes(")")],next:group+1};const bracket=this.brackets.get(index);return bracket!==void 0?{nodes:[parseClass(this.chars,index,bracket)],next:bracket}:char==="*"?this.stars(index,end):{nodes:char==="?"?[{kind:"any"}]:literalNodes(char),next:index+1}}extglob(operator,index,closer){const options=this.alternatives(index+2,closer,"|");return[operator==="@"?{kind:"alt",options}:{kind:"repeat",optional:operator!=="+",many:operator!=="?",options}]}brace(index,closer){const options=this.alternatives(index+1,closer,",");if(options.length>1)return[{kind:"alt",options}];const range=braceRange(this.chars.slice(index+1,closer).join(""));return range!==void 0?[{kind:"alt",options:range.map(literalNodes)}]:[...literalNodes("{"),...options[0],...literalNodes("}")]}stars(index,end){let run=1;for(;this.chars[index+run]==="*"&&index+run<end&&!this.closers.has(index+run);)run+=1;if(run!==2)return{nodes:[{kind:"star"}],next:index+run};const slash=index+run<end&&this.chars[index+run]==="/";return{nodes:[{kind:"globstar",slash}],next:index+run+(slash?1:0)}}}const END_KINDS=["segment","inside"],ANY={kind:"any"};function entriesOf(ends){return END_KINDS.flatMap(kind=>ends[kind]===void 0?[]:[ends[kind]])}class Nfa{states=[];add(){if(this.states.length>=MAX_STATES)throw new GlobTooComplex;return this.states.push({epsilon:[],syntactic:[],edges:[]}),this.states.length-1}epsilon(from,to,syntactic=!0){this.states[from].epsilon.push(to),syntactic&&this.states[from].syntactic.push(to)}consume(from,test,kind){const to=this.add();for(const entry of entriesOf(from))this.states[entry].edges.push({test,to});return{[kind]:to}}join(parts){const joined={};for(const kind of END_KINDS){const states=parts.flatMap(part=>part[kind]===void 0?[]:[part[kind]]);if(states.length===1&&(joined[kind]=states[0]),states.length>1){const merged=this.add();for(const state of states)this.epsilon(state,merged);joined[kind]=merged}}return joined}feed(ends,loop){for(const kind of END_KINDS)ends[kind]!==void 0&&this.epsilon(ends[kind],loop[kind])}build(nodes,from){let current=from;for(const node of nodes)current=this.node(node,current);return current}alternation(options,from){return this.join(options.map(option=>this.build(option,from)))}star(from){const loop=this.add();for(const entry of entriesOf(from))this.epsilon(entry,loop,!1);return this.states[loop].edges.push({test:ANY,to:loop}),{inside:loop}}segments(from){const between=this.add();this.epsilon(from,between,!1);const inside=this.add();return this.states[between].edges.push({test:ANY,to:inside}),this.states[inside].edges.push({test:ANY,to:inside},{test:{kind:"char",value:SLASH},to:between}),between}globstar(from,slash){if(slash){const parts=[];return from.segment!==void 0&&parts.push({segment:this.segments(from.segment)}),from.inside!==void 0&&parts.push(this.consume(this.star({inside:from.inside}),{kind:"char",value:SLASH},"segment")),this.join(parts)}const star=this.star(from);return from.segment!==void 0&&this.globstars.push({continuation:star.inside,entry:from.segment}),star}globstars=[];syntacticClosure(seed){const seen=new Set(seed),stack=[...seed];for(;stack.length>0;)for(const next of this.states[stack.pop()].syntactic)seen.has(next)||(seen.add(next),stack.push(next));return seen}resolveGlobstars(accept){for(const{continuation,entry}of this.globstars){const reachable=this.syntacticClosure([continuation]);if(reachable.has(accept)){const rest=this.add();this.epsilon(entry,rest,!1),this.states[rest].edges.push({test:{kind:"all"},to:rest}),this.epsilon(rest,accept,!1)}const targets=new Set;for(const state of reachable)for(const{test,to}of this.states[state].edges)accepts(test,SLASH)&&targets.add(to);if(targets.size===0)continue;const segments=this.segments(entry);for(const target of targets)this.epsilon(segments,target,!1)}}repeat(node,from){if(!node.many)return this.join([from,this.alternation(node.options,from)]);const loop={segment:this.add(),inside:this.add()};return this.feed(node.optional?from:this.alternation(node.options,from),loop),this.feed(this.alternation(node.options,loop),loop),loop}node(node,from){switch(node.kind){case"char":return this.consume(from,{kind:"char",value:node.value},node.value===SLASH?"segment":"inside");case"any":return this.consume(from,ANY,"inside");case"star":return this.star(from);case"globstar":return this.globstar(from,node.slash);case"class":return this.join([this.consume(from,{kind:"class",negated:node.negated,ranges:node.ranges},"inside"),this.build(node.literal.map(value=>({kind:"char",value})),from)]);case"alt":return this.alternation(node.options,from);case"repeat":return this.repeat(node,from)}}}function accepts(test,codePoint){switch(test.kind){case"char":return test.value===codePoint;case"any":return codePoint!==SLASH;case"all":return!0;case"class":return codePoint!==SLASH&&test.ranges.some(([low,high])=>codePoint>=low&&codePoint<=high)!==test.negated}}class PathMatcher{generation=0;nextId=0;nodes=new Map;edges=new Map;stateIds=0;nfa;acceptState;limits;start;constructor(nfa,startState,acceptState,limits){this.nfa=nfa,this.acceptState=acceptState,this.limits=limits,this.start=this.node(this.closure([startState]))}retained(){return{nodes:this.nodes.size,edges:this.edges.size,stateIds:this.stateIds}}reset(){this.generation+=1,this.nodes=new Map,this.edges=new Map,this.stateIds=0}closure(seed){const seen=new Set(seed),stack=[...seed];for(;stack.length>0;)for(const next of this.nfa.states[stack.pop()].epsilon)seen.has(next)||(seen.add(next),stack.push(next));return[...seen].sort((left,right)=>left-right)}node(states){const key=states.join(","),cached=this.nodes.get(key);if(cached!==void 0)return cached;(this.nodes.size>=this.limits.nodes||this.stateIds+states.length>this.limits.stateIds)&&this.reset();const created={id:this.nextId,generation:this.generation,states,accepting:states.includes(this.acceptState)};return this.nextId+=1,this.nodes.set(key,created),this.stateIds+=states.length,created}step(from,codePoint){const key=`${from.id}:${codePoint}`,known=from.generation===this.generation?this.edges.get(key):void 0;if(known!==void 0)return known;const reached=[];for(const state of from.states)for(const{test,to}of this.nfa.states[state].edges)accepts(test,codePoint)&&reached.push(to);const next=this.node(this.closure(reached));return this.edges.size>=this.limits.edges&&this.reset(),from.generation===this.generation&&this.edges.set(key,next),next}advance(from,text){let node=from;for(const char of text){if(node.states.length===0)return node;node=this.step(node,char.codePointAt(0))}return node}}function compile(text,limits=DFA_LIMITS){const chars=Array.from(text),nodes=new Parser(chars,pairConstructs(chars)).sequence(0,chars.length,void 0).nodes,nfa=new Nfa,start=nfa.add(),accept=nfa.add();for(const end of entriesOf(nfa.build(nodes,{segment:start})))nfa.epsilon(end,accept);return nfa.resolveGlobstars(accept),new PathMatcher(nfa,start,accept,limits)}function isStaticSegment(segment){return!/[*?[\]{}()!@+\\]/u.test(segment)}function kindOf(entry){return entry.isFile()?"file":entry.isDirectory()?"directory":"other"}async function resolveEntry(directory,real,entry){if(!entry.isSymbolicLink())return{kind:kindOf(entry),real:path.join(real,entry.name)};try{const target=await realpath(path.join(directory,entry.name));return{kind:kindOf(await stat(target)),real:target}}catch{return}}async function walk(matcher,directory,real,prefix,node,ancestors,out){let entries;try{entries=await readdir(directory,{withFileTypes:!0})}catch{return}for(const entry of entries){const afterName=matcher.advance(node,entry.name);if(afterName.states.length===0)continue;const resolved=await resolveEntry(directory,real,entry);if(resolved===void 0)continue;const relative=path.posix.join(prefix,entry.name);if(resolved.kind==="file"&&afterName.accepting&&out.push(relative),resolved.kind!=="directory")continue;const afterSlash=matcher.step(afterName,SLASH);afterSlash.states.length===0||ancestors.has(resolved.real)||(ancestors.add(resolved.real),await walk(matcher,path.join(directory,entry.name),resolved.real,relative,afterSlash,ancestors,out),ancestors.delete(resolved.real))}}function normalizePattern(pattern){const normalized=path.posix.normalize(pattern);return/^\/\/[^/]/u.test(pattern)?`/${normalized}`:normalized}function trimTrailingSeparators(pattern){let text=pattern;for(;text.length>1&&text.endsWith("/")&&!isEscaped(text,text.length-1);)text=text.slice(0,-1);return text}async function listed(directory,name){return(await readdir(directory).catch(()=>[])).includes(name)}async function exactCase(cwd,segments){let directory=cwd,index=0;for(;segments[index]==="..";)directory=path.dirname(directory),index+=1;for(;index<segments.length;index+=1){if(!await listed(directory,segments[index]))return!1;directory=path.join(directory,segments[index])}return!0}function isAbsolutePattern(text,platform=process.platform){return text.startsWith("/")||platform==="win32"&&/^[A-Za-z]:\//u.test(text)}async function literalMatch(text,cwd){const target=path.resolve(cwd,text),found=await stat(target).catch(()=>{});if(found===void 0||!found.isFile())return[];const absolute=isAbsolutePattern(text);return(absolute?await listed(path.dirname(target),path.basename(target)):await exactCase(cwd,text.split("/")))?[absolute?target.replaceAll("\\","/"):path.posix.normalize(text)]:[]}function splitStatic(text,cwd){const segments=text.split("/");let count=0;for(;count<segments.length&&isStaticSegment(segments[count]);)count+=1;if(count===segments.length)return;const prefix=count===0?"":`${segments.slice(0,count).join("/")}/`,root=path.resolve(cwd,prefix),rest=segments.slice(count).join("/");if(isAbsolutePattern(text))return{root,base:root.replaceAll("\\","/"),rest,prefix:[]};const relative=path.posix.normalize(prefix===""?".":prefix).replace(/\/$/u,"");return{root,base:relative==="."?"":relative,rest,prefix:segments.slice(0,count)}}function compileWithinBounds(text){try{return compile(text)}catch(error){if(error instanceof GlobTooComplex)return;throw error}}async function expandFileGlob(pattern,cwd){if(pattern.startsWith("!"))throw negationRefusal();if(Array.from(pattern).length>MAX_PATTERN_LENGTH)return[];const text=trimTrailingSeparators(normalizePattern(pattern)),parts=splitStatic(text,cwd);if(parts===void 0)return literalMatch(text,cwd);const matcher=compileWithinBounds(parts.rest);if(matcher===void 0||!await exactCase(cwd,parts.prefix))return[];const real=await realpath(parts.root).catch(()=>{});if(real===void 0)return[];const out=[];return await walk(matcher,parts.root,real,"",matcher.start,new Set([real]),out),out.map(relative=>joinOutput(parts.base,relative))}function joinOutput(base,relative){return base.startsWith("//")?`/${path.posix.join(base.slice(1),relative)}`:path.posix.join(base,relative)}const _testOnly={compile,isAbsolutePattern,joinOutput,normalizePattern};export{_testOnly,expandFileGlob};
2
2
  //# sourceMappingURL=file-glob.js.map
@@ -26,6 +26,15 @@ export declare function readCompactionMarker(text:string):number|undefined;
26
26
  * next call, so compaction never shortens it (GH-1710).
27
27
  */
28
28
  export declare function isContinuationTokenKey(key:string):boolean;
29
+ /**
30
+ * Whether an envelope key of a read surface holds tracker item documents: the
31
+ * item `get` returns, or the rows of a `list` or `search` page. An item's
32
+ * fields are content, not continuation tokens, so a custom field named like
33
+ * one (`next_cursor`, `sync_cursor`) compacts like any other string
34
+ * (GH-1754). Any other surface, an extension's included, keeps the exemption
35
+ * for every key: its rows may carry genuine tokens.
36
+ */
37
+ export declare function isTrackerItemDocumentKey(surface:string|undefined,key:string):boolean;
29
38
  /**
30
39
  * Whether a cursor argument carries an ellipsis, which no encoder emits: the
31
40
  * caller pasted a value a compacted read shortened (GH-1710).
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="21f779fe-fa2c-50d1-893d-8c6d47fbc56a")}catch{}})();function normalizeLowercaseWhitespace(value){return value.trim().toLowerCase().replace(/\s+/g," ")}function unicodeSafePrefix(value,end){const prefix=value.slice(0,end),last=prefix.charCodeAt(prefix.length-1),next=value.charCodeAt(prefix.length);return last>=55296&&last<=56319&&next>=56320&&next<=57343?prefix.slice(0,-1):prefix}const COMPACTED_STRING_LENGTH=240,COMPACTION_MARKER_PATTERN=/\u2026\[\+([1-9]\d*) chars\]$/u;function compactExplanatoryString(value){if(value.length<=COMPACTED_STRING_LENGTH)return value;const marker=COMPACTION_MARKER_PATTERN.exec(value);if(marker!==null&&marker.index<=COMPACTED_STRING_LENGTH)return value;const prefix=unicodeSafePrefix(value,COMPACTED_STRING_LENGTH);return`${prefix}\u2026[+${value.length-prefix.length} chars]`}function readCompactionMarker(text){const match=COMPACTION_MARKER_PATTERN.exec(text.trimEnd());return match?Number(match[1]):void 0}function isContinuationTokenKey(key){return key==="cursor"||key.endsWith("_cursor")}function isCompactedCursorArgument(value){return value.includes("\u2026")}function tokenizeAlphaNumeric(value){return normalizeLowercaseWhitespace(value).split(/[^a-z0-9]+/).filter(token=>token.length>0)}function jaccardSimilarity(leftTokens,rightTokens){if(leftTokens.length===0&&rightTokens.length===0)return 1;if(leftTokens.length===0||rightTokens.length===0)return 0;const leftSet=new Set(leftTokens),rightSet=new Set(rightTokens);let intersection=0;for(const token of leftSet)rightSet.has(token)&&(intersection+=1);const union=new Set([...leftSet,...rightSet]).size;return intersection/union}export{COMPACTED_STRING_LENGTH,compactExplanatoryString,isCompactedCursorArgument,isContinuationTokenKey,jaccardSimilarity,normalizeLowercaseWhitespace,readCompactionMarker,tokenizeAlphaNumeric,unicodeSafePrefix};
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f74cf2ed-6219-57c6-98a3-4b4c7496a17c")}catch{}})();function normalizeLowercaseWhitespace(value){return value.trim().toLowerCase().replace(/\s+/g," ")}function unicodeSafePrefix(value,end){const prefix=value.slice(0,end),last=prefix.charCodeAt(prefix.length-1),next=value.charCodeAt(prefix.length);return last>=55296&&last<=56319&&next>=56320&&next<=57343?prefix.slice(0,-1):prefix}const COMPACTED_STRING_LENGTH=240,COMPACTION_MARKER_PATTERN=/\u2026\[\+([1-9]\d*) chars\]$/u;function compactExplanatoryString(value){if(value.length<=COMPACTED_STRING_LENGTH)return value;const marker=COMPACTION_MARKER_PATTERN.exec(value);if(marker!==null&&marker.index<=COMPACTED_STRING_LENGTH)return value;const prefix=unicodeSafePrefix(value,COMPACTED_STRING_LENGTH);return`${prefix}\u2026[+${value.length-prefix.length} chars]`}function readCompactionMarker(text){const match=COMPACTION_MARKER_PATTERN.exec(text.trimEnd());return match?Number(match[1]):void 0}function isContinuationTokenKey(key){return key==="cursor"||key.endsWith("_cursor")}const TRACKER_ITEM_READ_SURFACES=new Set(["get","list","search"]);function isTrackerItemDocumentKey(surface,key){return(key==="item"||key==="items")&&surface!==void 0&&TRACKER_ITEM_READ_SURFACES.has(surface)}function isCompactedCursorArgument(value){return value.includes("\u2026")}function tokenizeAlphaNumeric(value){return normalizeLowercaseWhitespace(value).split(/[^a-z0-9]+/).filter(token=>token.length>0)}function jaccardSimilarity(leftTokens,rightTokens){if(leftTokens.length===0&&rightTokens.length===0)return 1;if(leftTokens.length===0||rightTokens.length===0)return 0;const leftSet=new Set(leftTokens),rightSet=new Set(rightTokens);let intersection=0;for(const token of leftSet)rightSet.has(token)&&(intersection+=1);const union=new Set([...leftSet,...rightSet]).size;return intersection/union}export{COMPACTED_STRING_LENGTH,compactExplanatoryString,isCompactedCursorArgument,isContinuationTokenKey,isTrackerItemDocumentKey,jaccardSimilarity,normalizeLowercaseWhitespace,readCompactionMarker,tokenizeAlphaNumeric,unicodeSafePrefix};
2
2
  //# sourceMappingURL=text-normalization.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="100048de-2349-5062-b6c2-7176277ec38d")}catch{}})();import{AsyncLocalStorage}from"node:async_hooks";import{attachExtensionReadOutputRows}from"./read-output/extension.js";import{renderPmCommand}from"./command-line.js";import{attachOutputOmissionReceipt}from"./output-projection.js";import{encodeQueryCursor}from"./pagination.js";import{applyReadOutputDimensions,isReadResultOmittedForBudget,stabilizeReadOutputReceiptEstimates}from"./read-output-contracts.js";import{estimateReadOutputTokens,MAX_ESTIMATE_ITERATIONS,readOutputMeasurementFormat,resolveReadOutputRecoveryBudget}from"./read-output-budget.js";import{propagateContextUsageServingReceipt}from"./context-usage.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{compactExplanatoryString,isContinuationTokenKey}from"../core/shared/text-normalization.js";const CONTEXT_INTENT_LIMIT_OVERRIDE_WARNING="limit_overridden_by_intent",PM_CONTEXT_INTENT_CONTRACTS=Object.freeze([{command:"context",intent:"orient",description:"Bounded active hierarchy, ownership, blockers, and recent progress.",included_field_groups:["summary","focus","hierarchy","blockers","activity"],token_budget:3e3,source:"core"},{command:"context",intent:"handoff",description:"Active ownership, evidence, decisions, and immediate continuation context.",included_field_groups:["summary","focus","in_progress","decisions","activity"],token_budget:2200,source:"core"},{command:"get",intent:"inspect",description:"Standard-depth item metadata, relationships, evidence, and lifecycle state.",included_field_groups:["item","children","claim_state","linked"],token_budget:3200,source:"core"},{command:"list",intent:"triage",description:"A budget-derived page of compact governance, ownership, priority, and blocker rows for triage.",included_field_groups:["identity","governance","ownership","dependencies"],token_budget:3200,source:"core"},{command:"next",intent:"execute",description:"The highest-ranked actionable work with concise ranking evidence.",included_field_groups:["recommended"],token_budget:1200,source:"core"},{command:"search",intent:"discover",description:"A budget-derived page of ranked canonical lineage candidates with compact match evidence.",included_field_groups:["identity","status","lineage","match"],token_budget:1800,source:"core"}]),activeContextIntentContracts=new AsyncLocalStorage;function getActiveContextIntentContracts(){return activeContextIntentContracts.getStore()??PM_CONTEXT_INTENT_CONTRACTS}function runWithContextIntentContracts(layers,run){return activeContextIntentContracts.run(composeContextIntentContracts(layers.workspaceContracts,layers.packageContracts),run)}function normalizeContextIntentDeclaration(declaration,source){const command=declaration.command.trim().toLowerCase(),intent=declaration.intent.trim().toLowerCase(),key=`${command}:${intent}`;if(!/^[a-z0-9][a-z0-9-]*$/.test(command)||!/^[a-z0-9][a-z0-9-]*$/.test(intent))throw new TypeError(`Invalid context intent command or name: ${key}`);if(declaration.description.trim().length===0)throw new TypeError(`Context intent ${key} requires a non-empty description`);if(!Number.isSafeInteger(declaration.token_budget)||declaration.token_budget<=0)throw new TypeError(`Context intent ${key} requires a positive integer token_budget`);const includedFieldGroups=[...new Set(declaration.included_field_groups.map(field=>field.trim()).filter(Boolean))];if(includedFieldGroups.length===0)throw new TypeError(`Context intent ${key} requires included_field_groups`);return{command,intent,description:declaration.description.trim(),included_field_groups:includedFieldGroups,token_budget:declaration.token_budget,source}}function composeContextIntentContracts(workspaceContracts=[],packageContracts=[]){const layers=[{source:"core",contracts:PM_CONTEXT_INTENT_CONTRACTS,allowOverride:!1},{source:"package",contracts:packageContracts,allowOverride:!1},{source:"workspace",contracts:workspaceContracts,allowOverride:!0}],composed=new Map,keysSeenWithinLayer=new Set;for(const layer of layers){keysSeenWithinLayer.clear();for(const declaration of layer.contracts){const normalized=normalizeContextIntentDeclaration(declaration,layer.source),key=`${normalized.command}:${normalized.intent}`;if(keysSeenWithinLayer.has(key))throw new TypeError(`Duplicate context intent declaration: ${key}`);if(keysSeenWithinLayer.add(key),!layer.allowOverride&&composed.has(key))throw new TypeError(`Duplicate context intent declaration: ${key}`);composed.set(key,normalized)}}return[...composed.values()].sort((left,right)=>left.command.localeCompare(right.command)||left.intent.localeCompare(right.intent))}function resolveContextIntentContract(command,intent,contracts=getActiveContextIntentContracts(),positionalArguments=[]){const normalizedCommand=command.trim().toLowerCase(),normalizedIntent=intent.trim().toLowerCase(),exact=contracts.find(entry=>entry.command===normalizedCommand&&entry.intent===normalizedIntent);if(exact)return{...exact,source:exact.source??"core"};const candidates=contracts.filter(entry=>entry.command===normalizedCommand).map(entry=>entry.intent);if(candidates.length===0)return;const suggestion=candidates.map(candidate=>{const rows=Array.from({length:normalizedIntent.length+1},(_,index)=>index);for(let candidateIndex=1;candidateIndex<=candidate.length;candidateIndex+=1){let previous=rows[0];rows[0]=candidateIndex;for(let intentIndex=1;intentIndex<=normalizedIntent.length;intentIndex+=1){const prior=rows[intentIndex];rows[intentIndex]=Math.min(rows[intentIndex]+1,rows[intentIndex-1]+1,previous+(candidate[candidateIndex-1]===normalizedIntent[intentIndex-1]?0:1)),previous=prior}}return{candidate,distance:rows[normalizedIntent.length]}}).sort((left,right)=>left.distance-right.distance||left.candidate.localeCompare(right.candidate))[0].candidate,attemptedArguments=[normalizedCommand,...positionalArguments,"--for",normalizedIntent],suggestedRetryArguments=[normalizedCommand,...positionalArguments,"--for",suggestion],suggestedCommand=renderPmCommand(suggestedRetryArguments);throw new PmCliError(`Unknown context intent "${normalizedIntent}" for ${normalizedCommand}. Did you mean "${suggestion}"?`,EXIT_CODE.USAGE,{code:"unknown_context_intent",reason:"unknown_intent",field:"for",flag:"--for",value:normalizedIntent,required:`Use a declared ${normalizedCommand} intent.`,why:"Intent names are command-local contracts and cannot be inferred from output section names.",nextSteps:[suggestedCommand],recovery:{recovery_mode:"compact",attempted_command:renderPmCommand(attemptedArguments),allowed_values:[...candidates].sort(),suggested_retry:suggestedCommand,suggested_retry_args:suggestedRetryArguments}})}function applyIntentRowLimit(projected,budgetDerivedLimit){const requestedLimit=parsePositiveIntentTokenBudget(projected.limit),effectiveLimit=String(requestedLimit===void 0?budgetDerivedLimit:Math.min(requestedLimit,budgetDerivedLimit));return(projected.limit===void 0||requestedLimit!==void 0)&&(projected.limit=effectiveLimit),effectiveLimit}const CONTEXT_INTENT_DEFAULT_APPLIERS={context:(projected,contract,explicitTokenBudget,canonical)=>{projected.section===void 0&&projected.depth===void 0&&(projected.section=contract.intent==="handoff"?["activity","progress","blockers"]:["hierarchy","blockers","activity"]),projected.depth===void 0&&(projected.depth=contract.intent==="handoff"?"deep":"standard");const tokenBudget=resolveEffectiveIntentTokenBudget(canonical,projected.tokenBudget,contract.token_budget),budgetDerivedLimit=resolveIntentRowBudget("context",contract.intent,tokenBudget,explicitTokenBudget),derivedLimit=applyIntentRowLimit(projected,budgetDerivedLimit);projected.activityLimit===void 0&&(projected.activityLimit=derivedLimit)},get:projected=>{projected.depth===void 0&&projected.fields===void 0&&(projected.depth="standard")},list:(projected,contract,explicitTokenBudget,canonical)=>{projected.brief===void 0&&projected.compact===void 0&&projected.full===void 0&&projected.fields===void 0&&(projected.fields="id,title,status,type,priority,parent,assignee,risk,blocked_by");const tokenBudget=resolveEffectiveIntentTokenBudget(canonical,projected.tokenBudget,contract.token_budget),budgetDerivedLimit=resolveIntentRowBudget("list",contract.intent,tokenBudget,explicitTokenBudget);applyIntentRowLimit(projected,budgetDerivedLimit)},next:projected=>{projected.readyOnly===void 0&&(projected.readyOnly=!0)},search:(projected,contract,explicitTokenBudget,canonical)=>{projected.compact===void 0&&projected.full===void 0&&projected.fields===void 0&&(projected.compact=!0);const tokenBudget=resolveEffectiveIntentTokenBudget(canonical,projected.tokenBudget,contract.token_budget),budgetDerivedLimit=resolveIntentRowBudget("search",contract.intent,tokenBudget,explicitTokenBudget);applyIntentRowLimit(projected,budgetDerivedLimit)}};function applyContextIntentProjection(command,options,positionalArguments=[]){const tokenBudget=options.tokenBudget??options.token_budget;if(typeof options.for!="string"){if(tokenBudget!==void 0&&(command==="get"||command==="list"||command==="search"))throw new PmCliError("--token-budget requires a declared context intent selected with --for",EXIT_CODE.USAGE,{code:"missing_required_option",field:"for",required:"Select a context intent with --for when setting --token-budget.",why:"A token-budget override has no projection contract to constrain without a selected intent.",nextSteps:["Retry with --for <intent> --token-budget <n>, or omit --token-budget."]});if(options.tokenBudget!==void 0||options.token_budget===void 0)return options;const projected2={...options,tokenBudget};return delete projected2.token_budget,projected2}const contract=resolveContextIntentContract(command,options.for,void 0,positionalArguments),canonical=canonicalIntentOutputBudget(options),explicitTokenBudget=parsePositiveIntentTokenBudget(tokenBudget)!==void 0||typeof canonical=="number",projected={...options};return projected.tokenBudget===void 0&&tokenBudget!==void 0&&(projected.tokenBudget=tokenBudget),delete projected.token_budget,typeof canonical=="number"?projected.tokenBudget=String(canonical):projected.tokenBudget===void 0&&(projected.tokenBudget=String(contract.token_budget)),CONTEXT_INTENT_DEFAULT_APPLIERS[command](projected,contract,explicitTokenBudget,canonical),projected}const CONTEXT_INTENT_DEGRADATIONS={context:"bounded_sections",get:"standard_item",list:"bounded_fields_and_rows",next:"bounded_ranked_rows",search:"bounded_ranked_rows"},MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET=256;function compactContextIntentValue(value){return Array.isArray(value)?value.map(compactContextIntentValue):value!==null&&typeof value=="object"?Object.fromEntries(Object.entries(value).map(([key,entry])=>[key,typeof entry=="string"&&isContinuationTokenKey(key)?entry:compactContextIntentValue(entry)])):typeof value=="string"?compactExplanatoryString(value):value}function parsePositiveIntentTokenBudget(value){const parsed=typeof value=="number"?value:typeof value=="string"&&/^\d+$/u.test(value.trim())?Number(value):Number.NaN;return Number.isSafeInteger(parsed)&&parsed>0?parsed:void 0}function canonicalIntentOutputBudget(options){const value=options.outputBudget??options.output_budget;return value==="unbounded"?value:parsePositiveIntentTokenBudget(value)}function intentBudgetFlag(options){return canonicalIntentOutputBudget(options)===void 0?"--token-budget":"--output-budget"}function resolveEffectiveIntentTokenBudget(canonical,legacy,declaredBudget){return typeof canonical=="number"?canonical:resolveIntentTokenBudget(legacy,declaredBudget)}function resolveIntentTokenBudget(value,declaredBudget){const parsed=parsePositiveIntentTokenBudget(value);if(parsed===void 0)return declaredBudget;if(parsed<MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET)throw new PmCliError(`Context intent token budget must be at least ${MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET}`,EXIT_CODE.USAGE,{code:"invalid_argument_value",reason:"below_minimum",field:"tokenBudget",value:String(value),required:`Use an integer token budget of at least ${MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET}.`,why:"Smaller ceilings cannot contain the minimum machine-readable intent receipt.",nextSteps:[`Retry with --token-budget ${MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET} or omit the override.`]});return parsed}function resolveIntentRowCost(command,intent){return command==="context"?command==="context"&&intent==="orient"?{overhead:1200,rowCost:600}:{overhead:800,rowCost:500}:{overhead:command==="list"?520:480,rowCost:16}}function resolveIntentRowBudget(command,intent,tokenBudget,explicitTokenBudget){if(command==="get"||command==="next")return;const{overhead,rowCost}=resolveIntentRowCost(command,intent),calculatedLimit=Math.max(command==="context"?1:2,Math.floor((tokenBudget-overhead)/rowCost));return explicitTokenBudget?calculatedLimit:Math.min(command==="context"?20:100,calculatedLimit)}function updateContextIntentEstimate(projected,receipt,options){const format=readOutputMeasurementFormat(options),rowContractDelivered=options.outputRowContract===!0||options.output_row_contract===!0;let measuredTokens=receipt.estimated_tokens,largestTokens=measuredTokens;for(let iteration=0;iteration<MAX_ESTIMATE_ITERATIONS;iteration+=1){receipt.estimated_tokens=measuredTokens;const nextMeasurement=estimateReadOutputTokens(rowContractDelivered||!Object.hasOwn(projected,"row_contract")?projected:Object.fromEntries(Object.entries(projected).filter(([key])=>key!=="row_contract")),format);if(nextMeasurement===measuredTokens)return;measuredTokens=nextMeasurement,largestTokens=Math.max(largestTokens,measuredTokens)}receipt.estimated_tokens=largestTokens}const CONTEXT_INTENT_ROW_KEYS={context:["high_level","low_level","blocked_fallback","recently_created","unparented","hierarchy","activity","blockers"],get:["children"],list:["items"],next:["ready","decision_needed","gate_needed","containers","blocked","held_by_others"],search:["items"]};function decodeContextIntentCursor(cursor){try{const parsed=JSON.parse(Buffer.from(cursor,"base64url").toString("utf8"));return typeof parsed.fingerprint!="string"||!Number.isSafeInteger(parsed.after_index)?void 0:{fingerprint:parsed.fingerprint,after_index:parsed.after_index,...typeof parsed.snapshot=="string"?{snapshot:parsed.snapshot}:{}}}catch{return}}function contextIntentRowId(row){if(row===null||typeof row!="object")return;if(typeof row.id=="string")return row.id;const nestedId=row.item?.id;return typeof nestedId=="string"?nestedId:void 0}function shrinkContextIntentRowsToBudget(projected,receipt,rows,options){let compacted=!1;for(;;){if(updateContextIntentEstimate(projected,receipt,options),receipt.estimated_tokens<=receipt.token_budget||rows.length<=1)return compacted;const rowBytes=Buffer.byteLength(JSON.stringify(rows),"utf8"),excessBytes=(receipt.estimated_tokens-receipt.token_budget)*4;rows.splice(-Math.min(rows.length-1,Math.max(1,Math.ceil(excessBytes/Math.max(1,Math.ceil(rowBytes/rows.length)))))),compacted=!0}}function compactPaginatedContextIntentRows(projected,receipt,options){const rows=projected.items,cursorContinuesExistingPage=typeof projected.next_cursor=="string",cursorSource=cursorContinuesExistingPage?projected.next_cursor:options.after;if(!Array.isArray(rows)||typeof cursorSource!="string")return!1;const cursorEnvelope=decodeContextIntentCursor(cursorSource);if(cursorEnvelope===void 0)return!1;const originalRowCount=rows.length,originalRows=[...rows];let compacted=!1;for(;;){if(compacted=shrinkContextIntentRowsToBudget(projected,receipt,rows,options)||compacted,!compacted)return!1;const lastId=contextIntentRowId(rows.at(-1));if(lastId===void 0)return rows.splice(0,rows.length,...originalRows),updateContextIntentEstimate(projected,receipt,options),!1;if(projected.next_cursor=encodeQueryCursor(cursorEnvelope.fingerprint,lastId,cursorContinuesExistingPage?cursorEnvelope.after_index-(originalRowCount-rows.length):cursorEnvelope.after_index+rows.length,cursorEnvelope.snapshot),updateContextIntentEstimate(projected,receipt,options),receipt.estimated_tokens<=receipt.token_budget||rows.length<=1)break}return typeof projected.count=="number"&&(projected.count=rows.length),typeof projected.applied_limit=="number"&&(projected.applied_limit=rows.length),!0}function compactContextIntentRows(command,projected,receipt,options){if(command==="list"||command==="search")return compactPaginatedContextIntentRows(projected,receipt,options);if(command!=="next"||typeof projected.next_cursor=="string")return!1;let compacted=!1;for(;;){if(updateContextIntentEstimate(projected,receipt,options),receipt.estimated_tokens<=receipt.token_budget)return compacted;const candidate=CONTEXT_INTENT_ROW_KEYS[command].map(key=>({key,rows:Array.isArray(projected[key])?projected[key]:[]})).filter(({rows})=>rows.length>0).sort((left,right)=>right.rows.length-left.rows.length||left.key.localeCompare(right.key))[0];if(candidate===void 0)return compacted;const retainedTotal=CONTEXT_INTENT_ROW_KEYS[command].reduce((total,key)=>total+(Array.isArray(projected[key])?projected[key].length:0),0);if(retainedTotal<=1)return compacted;const removableRows=Math.min(candidate.rows.length,retainedTotal-1),candidateBytes=Buffer.byteLength(JSON.stringify(candidate.rows),"utf8"),estimatedBytesPerRow=Math.max(1,Math.ceil(candidateBytes/candidate.rows.length)),excessBytes=(receipt.estimated_tokens-receipt.token_budget)*4,removalCount=Math.min(removableRows,Math.max(1,Math.ceil(excessBytes/estimatedBytesPerRow)));candidate.rows.splice(-removalCount,removalCount),compacted=!0}}function attachContextIntentReceipt(command,options,result){if(typeof options.for!="string")return result;const normalizedCommand=command.startsWith("list-")?"list":command;if(!(normalizedCommand in CONTEXT_INTENT_DEFAULT_APPLIERS))return result;const builtInCommand=normalizedCommand,contract=resolveContextIntentContract(builtInCommand,options.for),canonicalBudget=canonicalIntentOutputBudget(options),effectiveTokenBudget=resolveEffectiveIntentTokenBudget(canonicalBudget,options.tokenBudget??options.token_budget,contract.token_budget),receipt={command:builtInCommand,intent:contract.intent,source:contract.source,included_field_groups:[...contract.included_field_groups],token_budget:effectiveTokenBudget,declared_token_budget:contract.token_budget,token_budget_override:effectiveTokenBudget-contract.token_budget,estimated_tokens:0,within_budget:!0,degradation:CONTEXT_INTENT_DEGRADATIONS[builtInCommand],declaration_feasible:!0,result_omitted:!1},resultWithDiagnostics={...result},budgetDerivedLimit=resolveIntentRowBudget(builtInCommand,contract.intent,receipt.token_budget,parsePositiveIntentTokenBudget(options.tokenBudget??options.token_budget)!==void 0||typeof canonicalBudget=="number");if(budgetDerivedLimit!==void 0){const effectiveLimit=parsePositiveIntentTokenBudget(options.limit),explicitLimitBinds=effectiveLimit!==void 0&&effectiveLimit<budgetDerivedLimit;receipt.budget_derived_limit=budgetDerivedLimit,receipt.binding_constraint=explicitLimitBinds?"explicit_limit":"token_budget",receipt.limit_reason=explicitLimitBinds?"The caller supplied a smaller row limit than the budget-derived ceiling.":"The selected intent token budget constrains the effective row ceiling.",resultWithDiagnostics.budget_derived_limit=budgetDerivedLimit,discloseIntentLimitOverride({builtInCommand,intent:contract.intent},receipt,resultWithDiagnostics,options)}const envelopeOverhead=intentEnvelopeOverheads.get(options)??0,reportedBudget=receipt.token_budget;receipt.token_budget=reportedBudget-envelopeOverhead;const projected=canonicalBudget==="unbounded"?estimatedIntentProjection(resultWithDiagnostics,receipt,options):compactIntentProjection(builtInCommand,resultWithDiagnostics,receipt,options);receipt.declaration_feasible=receipt.estimated_tokens<=receipt.declared_token_budget;const outcome=intentBudgetOutcome(canonicalBudget,receipt,projected,()=>buildContextIntentRecoveryCommand(command,builtInCommand,contract.intent,{...receipt,token_budget:reportedBudget,estimated_tokens:receipt.estimated_tokens+envelopeOverhead},resultWithDiagnostics,options));return receipt.result_omitted&&(receipt.estimated_tokens+=envelopeOverhead,receipt.declaration_feasible=receipt.estimated_tokens<=receipt.declared_token_budget),receipt.token_budget=reportedBudget,outcome}function estimatedIntentProjection(result,receipt,options){const projected={...result,context_intent:receipt};return updateContextIntentEstimate(projected,receipt,options),projected}function compactIntentProjection(builtInCommand,result,receipt,options){let projected=estimatedIntentProjection(result,receipt,options);return receipt.estimated_tokens>receipt.token_budget&&(receipt.degradation="recursive_budget_compaction",projected=estimatedIntentProjection(compactContextIntentValue(result),receipt,options)),receipt.estimated_tokens>receipt.token_budget&&compactContextIntentRows(builtInCommand,projected,receipt,options)&&(receipt.degradation="budget_row_compaction",updateContextIntentEstimate(projected,receipt,options)),projected}const intentEnvelopeOverheads=new WeakMap;function intentBudgetOutcome(canonicalBudget,receipt,projected,restoreWith){return receipt.estimated_tokens<=receipt.token_budget||(receipt.within_budget=!1,canonicalBudget==="unbounded")?projected:(receipt.degradation="budget_receipt_only",receipt.result_omitted=!0,typeof canonicalBudget=="number"?{output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},context_intent:receipt}:{budget_exceeded:{omitted_result:!0,reason:receipt.token_budget_override===0?"declared_budget_infeasible":"effective_budget_infeasible",restore_with:restoreWith()},context_intent:receipt})}const CONTINUATION_METADATA_KEYS=["applied_limit","completeness","context_intent","count","filters","has_more","now","omission_receipt","projection","row_contract","sorting","total","truncated"];function collapseContinuationMetadata(options,result){if(typeof options.after!="string"||options.after.length===0||isReadResultOmittedForBudget(result))return result;const fingerprint=decodeContextIntentCursor(options.after)?.fingerprint??"opaque_cursor",projected={...result};for(const key of CONTINUATION_METADATA_KEYS)delete projected[key];return projected.continuation_contract={fingerprint,metadata:"reference",restore_with:"omit --after"},projected}function isOutputRecord(value){return value!==null&&typeof value=="object"&&!Array.isArray(value)}function contextIntentRecoveryPositional(builtInCommand,result){const recoveryTarget=builtInCommand==="get"&&isOutputRecord(result.item)&&typeof result.item.id=="string"?result.item.id:builtInCommand==="search"&&typeof result.query=="string"?result.query:void 0;return recoveryTarget===void 0?"":` ${shellQuote(recoveryTarget)}`}function shellQuote(value){return`'${value.replaceAll("'",`'"'"'`)}'`}function contextIntentRecoveryProjection(options){return typeof options.fields=="string"&&options.fields.trim()!==""?` --fields ${shellQuote(options.fields)}`:""}function discloseIntentLimitOverride(identity,receipt,result,options){const requested=parsePositiveIntentTokenBudget(options.limit),effective=receipt.budget_derived_limit;if(requested===void 0||requested<=effective)return;const{overhead,rowCost}=resolveIntentRowCost(identity.builtInCommand,identity.intent),sufficientBudget=Math.max(receipt.token_budget,overhead+rowCost*requested);receipt.limit_reason=`The ${receipt.token_budget}-token ${identity.intent} budget carries ${effective} rows, so it reduced the caller's --limit ${requested}.`,receipt.limit_override={flag:"--limit",requested,effective,...Number.isSafeInteger(sufficientBudget)?{token_budget_for_requested:sufficientBudget,restore_with:`${intentBudgetFlag(options)} ${sufficientBudget}`}:{}};const warning=`${CONTEXT_INTENT_LIMIT_OVERRIDE_WARNING}:--limit ${requested}->${effective}`;result.warnings=Array.isArray(result.warnings)?[...result.warnings,warning]:[warning],isOutputRecord(result.filters)&&(result.filters={...result.filters,requested_limit:String(requested)})}function buildContextIntentRecoveryCommand(command,builtInCommand,intent,receipt,result,options){const recoveryPositional=contextIntentRecoveryPositional(builtInCommand,result),boundedRowLimit=builtInCommand==="get"?"":` --limit ${receipt.budget_derived_limit??1}`,{output_budget:retryBudget}=resolveReadOutputRecoveryBudget({effective_budget_tokens:receipt.token_budget,measured_result_tokens:receipt.estimated_tokens});return`pm ${command}${recoveryPositional}${contextIntentRecoveryProjection(options)} --for ${intent} --token-budget ${retryBudget}${boundedRowLimit}`}function receiptEstimate(value,field){if(isOutputRecord(value))return typeof value[field]=="number"?value[field]:void 0}function stabilizeSuppressedRowContractReceipts(result,options){let finalized=result;for(let iteration=0;iteration<8;iteration+=1){reconcileIntentFit(finalized);const previousContextEstimate=receiptEstimate(finalized.context_intent,"estimated_tokens"),previousReadEstimate=receiptEstimate(finalized.read_output,"estimated_tokens"),previousSessionEstimate=receiptEstimate(finalized.read_session,"spent_this_call_tokens");if(isOutputRecord(finalized.context_intent)&&finalized.context_intent.result_omitted!==!0&&updateContextIntentEstimate(finalized,finalized.context_intent,options),finalized=stabilizeReadOutputReceiptEstimates(finalized,options),receiptEstimate(finalized.context_intent,"estimated_tokens")===previousContextEstimate&&receiptEstimate(finalized.read_output,"estimated_tokens")===previousReadEstimate&&receiptEstimate(finalized.read_session,"spent_this_call_tokens")===previousSessionEstimate)break}return finalized}function reconcileIntentFit(result){const intent=result.context_intent;isOutputRecord(intent)&&Number(intent.estimated_tokens)>Number(intent.token_budget)&&(intent.within_budget=!1)}function attachReadOutputContracts(command,options,result){const disclosedResult=attachOutputOmissionReceipt(command,attachExtensionReadOutputRows(command??"",result));if(typeof disclosedResult!="object"||disclosedResult===null||Array.isArray(disclosedResult))return propagateContextUsageServingReceipt(result,disclosedResult),disclosedResult;const surface=command??"",source=disclosedResult,intentProjected=attachContextIntentReceipt(surface,options,source),intentEstimate=receiptEstimate(intentProjected.context_intent,"estimated_tokens"),finalized=finalizeReadOutputEnvelope(surface,options,result,intentProjected),settled=settledIntentOverBudget(options,finalized,intentProjected.context_intent);if(settled===void 0)return finalized;const charged={...options};intentEnvelopeOverheads.set(charged,settled.estimated-Number(intentEstimate));const rechargedIntent=attachContextIntentReceipt(surface,charged,source),recharged=finalizeReadOutputEnvelope(surface,charged,result,rechargedIntent),residual=settledIntentOverBudget(options,recharged,rechargedIntent.context_intent);if(residual===void 0)return recharged;const receipt={...residual.receipt,estimated_tokens:residual.estimated};return finalizeReadOutputEnvelope(surface,options,result,intentBudgetOutcome(canonicalIntentOutputBudget(options),receipt,recharged,()=>buildContextIntentRecoveryCommand(surface,receipt.command,receipt.intent,receipt,source,options)))}function settledIntentOverBudget(options,finalized,intentReceipt){const delivered=isOutputRecord(finalized.context_intent),settled=delivered?finalized.context_intent:intentReceipt;if(!isOutputRecord(settled)||settled.result_omitted===!0||Object.hasOwn(finalized,"output_budget_exceeded"))return;const receipt=settled,estimated=delivered?receipt.estimated_tokens:estimateReadOutputTokens(finalized,readOutputMeasurementFormat(options));return canonicalIntentOutputBudget(options)==="unbounded"||estimated<=receipt.token_budget?void 0:{receipt,estimated}}function finalizeReadOutputEnvelope(command,options,result,intentProjected){const projected=applyReadOutputDimensions(command,{...options,outputRowContract:options.outputRowContract===!0||options.output_row_contract===!0},collapseContinuationMetadata(options,intentProjected));if(propagateContextUsageServingReceipt(result,projected),options.outputRowContract===!0||options.output_row_contract===!0||!Object.hasOwn(projected,"row_contract"))return isOutputRecord(projected.context_intent)?stabilizeSuppressedRowContractReceipts(projected,options):projected;const withoutDiscoveryMetadata=Object.fromEntries(Object.entries(projected).filter(([key])=>key!=="row_contract"));Object.defineProperty(withoutDiscoveryMetadata,"row_contract",{value:projected.row_contract,enumerable:!1,configurable:!0});const suppressed=stabilizeSuppressedRowContractReceipts(withoutDiscoveryMetadata,options);return delete suppressed.row_contract,propagateContextUsageServingReceipt(projected,suppressed),suppressed}export{CONTEXT_INTENT_LIMIT_OVERRIDE_WARNING,PM_CONTEXT_INTENT_CONTRACTS,applyContextIntentProjection,attachContextIntentReceipt,attachReadOutputContracts,composeContextIntentContracts,contextIntentRowId,decodeContextIntentCursor,getActiveContextIntentContracts,resolveContextIntentContract,runWithContextIntentContracts};
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a64c599a-e4c7-5f37-8ef6-fad2f7a9fd20")}catch{}})();import{AsyncLocalStorage}from"node:async_hooks";import{attachExtensionReadOutputRows}from"./read-output/extension.js";import{renderPmCommand}from"./command-line.js";import{attachOutputOmissionReceipt}from"./output-projection.js";import{encodeQueryCursor}from"./pagination.js";import{applyReadOutputDimensions,decodeReadOutputContinuationCursor,isReadResultOmittedForBudget,resolveReadOutputSurface,stabilizeReadOutputReceiptEstimates}from"./read-output-contracts.js";import{estimateReadOutputTokens,MAX_ESTIMATE_ITERATIONS,readOutputMeasurementFormat,registerReadOutputPassHooks,resolveReadOutputRecoveryBudget}from"./read-output-budget.js";import{propagateContextUsageServingReceipt}from"./context-usage.js";import{readOutputContinuationRowCollections}from"./read-output-rows.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{compactExplanatoryString,isContinuationTokenKey,isTrackerItemDocumentKey}from"../core/shared/text-normalization.js";const CONTEXT_INTENT_LIMIT_OVERRIDE_WARNING="limit_overridden_by_intent",PM_CONTEXT_INTENT_CONTRACTS=Object.freeze([{command:"context",intent:"orient",description:"Bounded active hierarchy, ownership, blockers, and recent progress.",included_field_groups:["summary","focus","hierarchy","blockers","activity"],token_budget:3e3,source:"core"},{command:"context",intent:"handoff",description:"Active ownership, evidence, decisions, and immediate continuation context.",included_field_groups:["summary","focus","in_progress","decisions","activity"],token_budget:2200,source:"core"},{command:"get",intent:"inspect",description:"Standard-depth item metadata, relationships, evidence, and lifecycle state.",included_field_groups:["item","children","claim_state","linked"],token_budget:3200,source:"core"},{command:"list",intent:"triage",description:"A budget-derived page of compact governance, ownership, priority, and blocker rows for triage.",included_field_groups:["identity","governance","ownership","dependencies"],token_budget:3200,source:"core"},{command:"next",intent:"execute",description:"The highest-ranked actionable work with concise ranking evidence.",included_field_groups:["recommended"],token_budget:1200,source:"core"},{command:"search",intent:"discover",description:"A budget-derived page of ranked canonical lineage candidates with compact match evidence.",included_field_groups:["identity","status","lineage","match"],token_budget:1800,source:"core"}]),activeContextIntentContracts=new AsyncLocalStorage;function getActiveContextIntentContracts(){return activeContextIntentContracts.getStore()??PM_CONTEXT_INTENT_CONTRACTS}function runWithContextIntentContracts(layers,run){return activeContextIntentContracts.run(composeContextIntentContracts(layers.workspaceContracts,layers.packageContracts),run)}function normalizeContextIntentDeclaration(declaration,source){const command=declaration.command.trim().toLowerCase(),intent=declaration.intent.trim().toLowerCase(),key=`${command}:${intent}`;if(!/^[a-z0-9][a-z0-9-]*$/.test(command)||!/^[a-z0-9][a-z0-9-]*$/.test(intent))throw new TypeError(`Invalid context intent command or name: ${key}`);if(declaration.description.trim().length===0)throw new TypeError(`Context intent ${key} requires a non-empty description`);if(!Number.isSafeInteger(declaration.token_budget)||declaration.token_budget<=0)throw new TypeError(`Context intent ${key} requires a positive integer token_budget`);const includedFieldGroups=[...new Set(declaration.included_field_groups.map(field=>field.trim()).filter(Boolean))];if(includedFieldGroups.length===0)throw new TypeError(`Context intent ${key} requires included_field_groups`);return{command,intent,description:declaration.description.trim(),included_field_groups:includedFieldGroups,token_budget:declaration.token_budget,source}}function composeContextIntentContracts(workspaceContracts=[],packageContracts=[]){const layers=[{source:"core",contracts:PM_CONTEXT_INTENT_CONTRACTS,allowOverride:!1},{source:"package",contracts:packageContracts,allowOverride:!1},{source:"workspace",contracts:workspaceContracts,allowOverride:!0}],composed=new Map,keysSeenWithinLayer=new Set;for(const layer of layers){keysSeenWithinLayer.clear();for(const declaration of layer.contracts){const normalized=normalizeContextIntentDeclaration(declaration,layer.source),key=`${normalized.command}:${normalized.intent}`;if(keysSeenWithinLayer.has(key))throw new TypeError(`Duplicate context intent declaration: ${key}`);if(keysSeenWithinLayer.add(key),!layer.allowOverride&&composed.has(key))throw new TypeError(`Duplicate context intent declaration: ${key}`);composed.set(key,normalized)}}return[...composed.values()].sort((left,right)=>left.command.localeCompare(right.command)||left.intent.localeCompare(right.intent))}function resolveContextIntentContract(command,intent,contracts=getActiveContextIntentContracts(),positionalArguments=[]){const normalizedCommand=command.trim().toLowerCase(),normalizedIntent=intent.trim().toLowerCase(),exact=contracts.find(entry=>entry.command===normalizedCommand&&entry.intent===normalizedIntent);if(exact)return{...exact,source:exact.source??"core"};const candidates=contracts.filter(entry=>entry.command===normalizedCommand).map(entry=>entry.intent);if(candidates.length===0)return;const suggestion=candidates.map(candidate=>{const rows=Array.from({length:normalizedIntent.length+1},(_,index)=>index);for(let candidateIndex=1;candidateIndex<=candidate.length;candidateIndex+=1){let previous=rows[0];rows[0]=candidateIndex;for(let intentIndex=1;intentIndex<=normalizedIntent.length;intentIndex+=1){const prior=rows[intentIndex];rows[intentIndex]=Math.min(rows[intentIndex]+1,rows[intentIndex-1]+1,previous+(candidate[candidateIndex-1]===normalizedIntent[intentIndex-1]?0:1)),previous=prior}}return{candidate,distance:rows[normalizedIntent.length]}}).sort((left,right)=>left.distance-right.distance||left.candidate.localeCompare(right.candidate))[0].candidate,attemptedArguments=[normalizedCommand,...positionalArguments,"--for",normalizedIntent],suggestedRetryArguments=[normalizedCommand,...positionalArguments,"--for",suggestion],suggestedCommand=renderPmCommand(suggestedRetryArguments);throw new PmCliError(`Unknown context intent "${normalizedIntent}" for ${normalizedCommand}. Did you mean "${suggestion}"?`,EXIT_CODE.USAGE,{code:"unknown_context_intent",reason:"unknown_intent",field:"for",flag:"--for",value:normalizedIntent,required:`Use a declared ${normalizedCommand} intent.`,why:"Intent names are command-local contracts and cannot be inferred from output section names.",nextSteps:[suggestedCommand],recovery:{recovery_mode:"compact",attempted_command:renderPmCommand(attemptedArguments),allowed_values:[...candidates].sort(),suggested_retry:suggestedCommand,suggested_retry_args:suggestedRetryArguments}})}function applyIntentRowLimit(projected,budgetDerivedLimit){const requestedLimit=parsePositiveIntentTokenBudget(projected.limit),effectiveLimit=String(requestedLimit===void 0?budgetDerivedLimit:Math.min(requestedLimit,budgetDerivedLimit));return(projected.limit===void 0||requestedLimit!==void 0)&&(projected.limit=effectiveLimit),effectiveLimit}const CONTEXT_INTENT_DEFAULT_APPLIERS={context:(projected,contract,explicitTokenBudget,canonical)=>{projected.section===void 0&&projected.depth===void 0&&(projected.section=contract.intent==="handoff"?["activity","progress","blockers"]:["hierarchy","blockers","activity"]),projected.depth===void 0&&(projected.depth=contract.intent==="handoff"?"deep":"standard");const tokenBudget=resolveEffectiveIntentTokenBudget(canonical,projected.tokenBudget,contract.token_budget),budgetDerivedLimit=resolveIntentRowBudget("context",contract.intent,tokenBudget,explicitTokenBudget),derivedLimit=applyIntentRowLimit(projected,budgetDerivedLimit);projected.activityLimit===void 0&&(projected.activityLimit=derivedLimit)},get:projected=>{projected.depth===void 0&&projected.fields===void 0&&(projected.depth="standard")},list:(projected,contract,explicitTokenBudget,canonical)=>{projected.brief===void 0&&projected.compact===void 0&&projected.full===void 0&&projected.fields===void 0&&(projected.fields="id,title,status,type,priority,parent,assignee,risk,blocked_by");const tokenBudget=resolveEffectiveIntentTokenBudget(canonical,projected.tokenBudget,contract.token_budget),budgetDerivedLimit=resolveIntentRowBudget("list",contract.intent,tokenBudget,explicitTokenBudget);applyIntentRowLimit(projected,budgetDerivedLimit)},next:projected=>{projected.readyOnly===void 0&&(projected.readyOnly=!0)},search:(projected,contract,explicitTokenBudget,canonical)=>{projected.compact===void 0&&projected.full===void 0&&projected.fields===void 0&&(projected.compact=!0);const tokenBudget=resolveEffectiveIntentTokenBudget(canonical,projected.tokenBudget,contract.token_budget),budgetDerivedLimit=resolveIntentRowBudget("search",contract.intent,tokenBudget,explicitTokenBudget);applyIntentRowLimit(projected,budgetDerivedLimit)}};function applyContextIntentProjection(command,options,positionalArguments=[]){const tokenBudget=options.tokenBudget??options.token_budget;if(typeof options.for!="string"){if(tokenBudget!==void 0&&(command==="get"||command==="list"||command==="search"))throw new PmCliError("--token-budget requires a declared context intent selected with --for",EXIT_CODE.USAGE,{code:"missing_required_option",field:"for",required:"Select a context intent with --for when setting --token-budget.",why:"A token-budget override has no projection contract to constrain without a selected intent.",nextSteps:["Retry with --for <intent> --token-budget <n>, or omit --token-budget."]});if(options.tokenBudget!==void 0||options.token_budget===void 0)return options;const projected2={...options,tokenBudget};return delete projected2.token_budget,projected2}const contract=resolveContextIntentContract(command,options.for,void 0,positionalArguments),canonical=canonicalIntentOutputBudget(options),explicitTokenBudget=parsePositiveIntentTokenBudget(tokenBudget)!==void 0||typeof canonical=="number",projected={...options};return projected.tokenBudget===void 0&&tokenBudget!==void 0&&(projected.tokenBudget=tokenBudget),delete projected.token_budget,typeof canonical=="number"?projected.tokenBudget=String(canonical):projected.tokenBudget===void 0&&(projected.tokenBudget=String(contract.token_budget)),CONTEXT_INTENT_DEFAULT_APPLIERS[command](projected,contract,explicitTokenBudget,canonical),projected}const CONTEXT_INTENT_DEGRADATIONS={context:"bounded_sections",get:"standard_item",list:"bounded_fields_and_rows",next:"bounded_ranked_rows",search:"bounded_ranked_rows"},MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET=256;function compactContextIntentValue(value,surface,exemptTokens=!0,root=!0){return Array.isArray(value)?value.map(entry=>compactContextIntentValue(entry,surface,exemptTokens,!1)):value!==null&&typeof value=="object"?Object.fromEntries(Object.entries(value).map(([key,entry])=>[key,exemptTokens&&typeof entry=="string"&&isContinuationTokenKey(key)?entry:compactContextIntentValue(entry,surface,exemptTokens&&!(root&&isTrackerItemDocumentKey(surface,key)),!1)])):typeof value=="string"?compactExplanatoryString(value):value}function parsePositiveIntentTokenBudget(value){const parsed=typeof value=="number"?value:typeof value=="string"&&/^\d+$/u.test(value.trim())?Number(value):Number.NaN;return Number.isSafeInteger(parsed)&&parsed>0?parsed:void 0}function canonicalIntentOutputBudget(options){const value=options.outputBudget??options.output_budget;return value==="unbounded"?value:parsePositiveIntentTokenBudget(value)}function intentBudgetFlag(options){return canonicalIntentOutputBudget(options)===void 0?"--token-budget":"--output-budget"}function resolveEffectiveIntentTokenBudget(canonical,legacy,declaredBudget){return typeof canonical=="number"?canonical:resolveIntentTokenBudget(legacy,declaredBudget)}function resolveIntentTokenBudget(value,declaredBudget){const parsed=parsePositiveIntentTokenBudget(value);if(parsed===void 0)return declaredBudget;if(parsed<MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET)throw new PmCliError(`Context intent token budget must be at least ${MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET}`,EXIT_CODE.USAGE,{code:"invalid_argument_value",reason:"below_minimum",field:"tokenBudget",value:String(value),required:`Use an integer token budget of at least ${MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET}.`,why:"Smaller ceilings cannot contain the minimum machine-readable intent receipt.",nextSteps:[`Retry with --token-budget ${MINIMUM_CONTEXT_INTENT_TOKEN_BUDGET} or omit the override.`]});return parsed}function resolveIntentRowCost(command,intent){return command==="context"?command==="context"&&intent==="orient"?{overhead:1200,rowCost:600}:{overhead:800,rowCost:500}:{overhead:command==="list"?520:480,rowCost:16}}function resolveIntentRowBudget(command,intent,tokenBudget,explicitTokenBudget){if(command==="get"||command==="next")return;const{overhead,rowCost}=resolveIntentRowCost(command,intent),calculatedLimit=Math.max(command==="context"?1:2,Math.floor((tokenBudget-overhead)/rowCost));return explicitTokenBudget?calculatedLimit:Math.min(command==="context"?20:100,calculatedLimit)}function updateContextIntentEstimate(projected,receipt,options){const format=readOutputMeasurementFormat(options),rowContractDelivered=options.outputRowContract===!0||options.output_row_contract===!0;let measuredTokens=receipt.estimated_tokens,largestTokens=measuredTokens;for(let iteration=0;iteration<MAX_ESTIMATE_ITERATIONS;iteration+=1){receipt.estimated_tokens=measuredTokens;const nextMeasurement=estimateReadOutputTokens(rowContractDelivered||!Object.hasOwn(projected,"row_contract")?projected:Object.fromEntries(Object.entries(projected).filter(([key])=>key!=="row_contract")),format);if(nextMeasurement===measuredTokens)return;measuredTokens=nextMeasurement,largestTokens=Math.max(largestTokens,measuredTokens)}receipt.estimated_tokens=largestTokens}const CONTEXT_INTENT_ROW_KEYS={context:["high_level","low_level","blocked_fallback","recently_created","unparented","hierarchy","activity","blockers"],get:["children"],list:["items"],next:["ready","decision_needed","gate_needed","containers","blocked","held_by_others"],search:["items"]};function decodeContextIntentCursor(cursor){try{const parsed=JSON.parse(Buffer.from(cursor,"base64url").toString("utf8"));return typeof parsed.fingerprint!="string"||!Number.isSafeInteger(parsed.after_index)?void 0:{fingerprint:parsed.fingerprint,after_index:parsed.after_index,...typeof parsed.snapshot=="string"?{snapshot:parsed.snapshot}:{}}}catch{return}}function contextIntentRowId(row){if(row===null||typeof row!="object")return;if(typeof row.id=="string")return row.id;const nestedId=row.item?.id;return typeof nestedId=="string"?nestedId:void 0}function shrinkContextIntentRowsToBudget(projected,receipt,rows,options){let compacted=!1;for(;;){if(updateContextIntentEstimate(projected,receipt,options),receipt.estimated_tokens<=receipt.token_budget||rows.length<=1)return compacted;const rowBytes=Buffer.byteLength(JSON.stringify(rows),"utf8"),excessBytes=(receipt.estimated_tokens-receipt.token_budget)*4;rows.splice(-Math.min(rows.length-1,Math.max(1,Math.ceil(excessBytes/Math.max(1,Math.ceil(rowBytes/rows.length)))))),compacted=!0}}function compactPaginatedContextIntentRows(projected,receipt,options){const rows=projected.items,cursorContinuesExistingPage=typeof projected.next_cursor=="string",cursorSource=cursorContinuesExistingPage?projected.next_cursor:options.after;if(!Array.isArray(rows)||typeof cursorSource!="string")return!1;const cursorEnvelope=decodeContextIntentCursor(cursorSource);if(cursorEnvelope===void 0)return!1;const originalRowCount=rows.length,originalRows=[...rows];let compacted=!1;for(;;){if(compacted=shrinkContextIntentRowsToBudget(projected,receipt,rows,options)||compacted,!compacted)return!1;const lastId=contextIntentRowId(rows.at(-1));if(lastId===void 0)return rows.splice(0,rows.length,...originalRows),updateContextIntentEstimate(projected,receipt,options),!1;if(projected.next_cursor=encodeQueryCursor(cursorEnvelope.fingerprint,lastId,cursorContinuesExistingPage?cursorEnvelope.after_index-(originalRowCount-rows.length):cursorEnvelope.after_index+rows.length,cursorEnvelope.snapshot),updateContextIntentEstimate(projected,receipt,options),receipt.estimated_tokens<=receipt.token_budget||rows.length<=1)break}return typeof projected.count=="number"&&(projected.count=rows.length),typeof projected.applied_limit=="number"&&(projected.applied_limit=rows.length),!0}function compactContextIntentRows(command,projected,receipt,options){if(command==="list"||command==="search")return compactPaginatedContextIntentRows(projected,receipt,options);if(command!=="next"||typeof projected.next_cursor=="string")return!1;let compacted=!1;for(;;){if(updateContextIntentEstimate(projected,receipt,options),receipt.estimated_tokens<=receipt.token_budget)return compacted;const candidate=CONTEXT_INTENT_ROW_KEYS[command].map(key=>({key,rows:Array.isArray(projected[key])?projected[key]:[]})).filter(({rows})=>rows.length>0).sort((left,right)=>right.rows.length-left.rows.length||left.key.localeCompare(right.key))[0];if(candidate===void 0)return compacted;const retainedTotal=CONTEXT_INTENT_ROW_KEYS[command].reduce((total,key)=>total+(Array.isArray(projected[key])?projected[key].length:0),0);if(retainedTotal<=1)return compacted;const removableRows=Math.min(candidate.rows.length,retainedTotal-1),candidateBytes=Buffer.byteLength(JSON.stringify(candidate.rows),"utf8"),estimatedBytesPerRow=Math.max(1,Math.ceil(candidateBytes/candidate.rows.length)),excessBytes=(receipt.estimated_tokens-receipt.token_budget)*4,removalCount=Math.min(removableRows,Math.max(1,Math.ceil(excessBytes/estimatedBytesPerRow)));candidate.rows.splice(-removalCount,removalCount),compacted=!0}}function attachContextIntentReceipt(command,options,result){if(typeof options.for!="string")return result;const normalizedCommand=command.startsWith("list-")?"list":command;if(!(normalizedCommand in CONTEXT_INTENT_DEFAULT_APPLIERS))return result;const builtInCommand=normalizedCommand,contract=resolveContextIntentContract(builtInCommand,options.for),canonicalBudget=canonicalIntentOutputBudget(options),effectiveTokenBudget=resolveEffectiveIntentTokenBudget(canonicalBudget,options.tokenBudget??options.token_budget,contract.token_budget),receipt={command:builtInCommand,intent:contract.intent,source:contract.source,included_field_groups:[...contract.included_field_groups],token_budget:effectiveTokenBudget,declared_token_budget:contract.token_budget,token_budget_override:effectiveTokenBudget-contract.token_budget,estimated_tokens:0,within_budget:!0,degradation:CONTEXT_INTENT_DEGRADATIONS[builtInCommand],declaration_feasible:!0,result_omitted:!1},resultWithDiagnostics={...result},budgetDerivedLimit=resolveIntentRowBudget(builtInCommand,contract.intent,receipt.token_budget,parsePositiveIntentTokenBudget(options.tokenBudget??options.token_budget)!==void 0||typeof canonicalBudget=="number");if(budgetDerivedLimit!==void 0){const effectiveLimit=parsePositiveIntentTokenBudget(options.limit),explicitLimitBinds=effectiveLimit!==void 0&&effectiveLimit<budgetDerivedLimit;receipt.budget_derived_limit=budgetDerivedLimit,receipt.binding_constraint=explicitLimitBinds?"explicit_limit":"token_budget",receipt.limit_reason=explicitLimitBinds?"The caller supplied a smaller row limit than the budget-derived ceiling.":"The selected intent token budget constrains the effective row ceiling.",resultWithDiagnostics.budget_derived_limit=budgetDerivedLimit,discloseIntentLimitOverride({builtInCommand,intent:contract.intent},receipt,resultWithDiagnostics,options)}const envelopeOverhead=intentEnvelopeOverheads.get(options)??0,reportedBudget=receipt.token_budget;receipt.token_budget=reportedBudget-envelopeOverhead;const projected=canonicalBudget==="unbounded"?estimatedIntentProjection(resultWithDiagnostics,receipt,options):compactIntentProjection(builtInCommand,resultWithDiagnostics,receipt,options,resolveReadOutputSurface(command,options));receipt.declaration_feasible=receipt.estimated_tokens<=receipt.declared_token_budget;const outcome=intentBudgetOutcome(canonicalBudget,receipt,projected,()=>buildContextIntentRecoveryCommand(command,builtInCommand,contract.intent,{...receipt,token_budget:reportedBudget,estimated_tokens:receipt.estimated_tokens+envelopeOverhead},resultWithDiagnostics,options));return receipt.result_omitted&&(receipt.estimated_tokens+=envelopeOverhead,receipt.declaration_feasible=receipt.estimated_tokens<=receipt.declared_token_budget),receipt.token_budget=reportedBudget,outcome}function estimatedIntentProjection(result,receipt,options){const projected={...result,context_intent:receipt};return updateContextIntentEstimate(projected,receipt,options),projected}function compactIntentProjection(builtInCommand,result,receipt,options,surface){let projected=estimatedIntentProjection(result,receipt,options);return receipt.estimated_tokens>receipt.token_budget&&(receipt.degradation="recursive_budget_compaction",projected=estimatedIntentProjection(compactContextIntentValue(result,surface),receipt,options)),receipt.estimated_tokens>receipt.token_budget&&compactContextIntentRows(builtInCommand,projected,receipt,options)&&(receipt.degradation="budget_row_compaction",updateContextIntentEstimate(projected,receipt,options)),projected}const intentEnvelopeOverheads=new WeakMap;function intentBudgetOutcome(canonicalBudget,receipt,projected,restoreWith){return receipt.estimated_tokens<=receipt.token_budget||(receipt.within_budget=!1,canonicalBudget==="unbounded")?projected:(receipt.degradation="budget_receipt_only",receipt.result_omitted=!0,typeof canonicalBudget=="number"?{output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},context_intent:receipt}:{budget_exceeded:{omitted_result:!0,reason:receipt.token_budget_override===0?"declared_budget_infeasible":"effective_budget_infeasible",restore_with:restoreWith()},context_intent:receipt})}const CONTINUATION_METADATA_KEYS=["applied_limit","completeness","context_intent","count","filters","has_more","now","omission_receipt","projection","row_contract","sorting","total","truncated"];function collapseContinuationMetadata(options,result){if(typeof options.after!="string"||options.after.length===0||isReadResultOmittedForBudget(result))return result;const fingerprint=decodeContextIntentCursor(options.after)?.fingerprint??"opaque_cursor",projected={...result};for(const key of CONTINUATION_METADATA_KEYS)delete projected[key];return projected.continuation_contract={fingerprint,metadata:"reference",restore_with:"omit --after"},projected}function isOutputRecord(value){return value!==null&&typeof value=="object"&&!Array.isArray(value)}function contextIntentRecoveryPositional(builtInCommand,result){const recoveryTarget=builtInCommand==="get"&&isOutputRecord(result.item)&&typeof result.item.id=="string"?result.item.id:builtInCommand==="search"&&typeof result.query=="string"?result.query:void 0;return recoveryTarget===void 0?"":` ${shellQuote(recoveryTarget)}`}function shellQuote(value){return`'${value.replaceAll("'",`'"'"'`)}'`}function contextIntentRecoveryProjection(options){return typeof options.fields=="string"&&options.fields.trim()!==""?` --fields ${shellQuote(options.fields)}`:""}function discloseIntentLimitOverride(identity,receipt,result,options){const requested=parsePositiveIntentTokenBudget(options.limit),effective=receipt.budget_derived_limit;if(requested===void 0||requested<=effective)return;const{overhead,rowCost}=resolveIntentRowCost(identity.builtInCommand,identity.intent),sufficientBudget=Math.max(receipt.token_budget,overhead+rowCost*requested);receipt.limit_reason=`The ${receipt.token_budget}-token ${identity.intent} budget carries ${effective} rows, so it reduced the caller's --limit ${requested}.`,receipt.limit_override={flag:"--limit",requested,effective,...Number.isSafeInteger(sufficientBudget)?{token_budget_for_requested:sufficientBudget,restore_with:`${intentBudgetFlag(options)} ${sufficientBudget}`}:{}};const warning=`${CONTEXT_INTENT_LIMIT_OVERRIDE_WARNING}:--limit ${requested}->${effective}`;result.warnings=Array.isArray(result.warnings)?[...result.warnings,warning]:[warning],isOutputRecord(result.filters)&&(result.filters={...result.filters,requested_limit:String(requested)})}function buildContextIntentRecoveryCommand(command,builtInCommand,intent,receipt,result,options){const recoveryPositional=contextIntentRecoveryPositional(builtInCommand,result),boundedRowLimit=builtInCommand==="get"?"":` --limit ${receipt.budget_derived_limit??1}`,{output_budget:retryBudget}=resolveReadOutputRecoveryBudget({effective_budget_tokens:receipt.token_budget,measured_result_tokens:receipt.estimated_tokens});return`pm ${command}${recoveryPositional}${contextIntentRecoveryProjection(options)} --for ${intent} --token-budget ${retryBudget}${boundedRowLimit}`}function receiptEstimate(value,field){if(isOutputRecord(value))return typeof value[field]=="number"?value[field]:void 0}function stabilizeSuppressedRowContractReceipts(result,options){let finalized=result;for(let iteration=0;iteration<8;iteration+=1){reconcileIntentFit(finalized);const previousContextEstimate=receiptEstimate(finalized.context_intent,"estimated_tokens"),previousReadEstimate=receiptEstimate(finalized.read_output,"estimated_tokens"),previousSessionEstimate=receiptEstimate(finalized.read_session,"spent_this_call_tokens");if(isOutputRecord(finalized.context_intent)&&finalized.context_intent.result_omitted!==!0&&updateContextIntentEstimate(finalized,finalized.context_intent,options),finalized=stabilizeReadOutputReceiptEstimates(finalized,options),receiptEstimate(finalized.context_intent,"estimated_tokens")===previousContextEstimate&&receiptEstimate(finalized.read_output,"estimated_tokens")===previousReadEstimate&&receiptEstimate(finalized.read_session,"spent_this_call_tokens")===previousSessionEstimate)break}return finalized}function reconcileIntentFit(result){const intent=result.context_intent;isOutputRecord(intent)&&Number(intent.estimated_tokens)>Number(intent.token_budget)&&(intent.within_budget=!1)}function intentContinuationBinding(source,intentProjected){const intent=intentProjected.context_intent;if(!isOutputRecord(intent)||intent.result_omitted===!0)return;const compacted=intent.degradation==="recursive_budget_compaction"||intent.degradation==="budget_row_compaction",binding={...intentProjected};for(const collection of readOutputContinuationRowCollections(source)){const delivered=intentProjected[collection.path];if(Array.isArray(delivered)&&Array.isArray(collection.value)&&delivered.length<=collection.value.length){const prefix=collection.value.slice(0,delivered.length);binding[collection.path]=compacted?prefix.map(normalizeContextIntentValue):prefix}}return binding}function normalizeContextIntentValue(value){return Array.isArray(value)?value.map(normalizeContextIntentValue):value!==null&&typeof value=="object"?Object.fromEntries(Object.entries(value).map(([key,entry])=>[key,normalizeContextIntentValue(entry)])):value}function attachReadOutputContracts(command,options,result){const disclosedResult=attachOutputOmissionReceipt(command,attachExtensionReadOutputRows(command??"",result));if(typeof disclosedResult!="object"||disclosedResult===null||Array.isArray(disclosedResult))return propagateContextUsageServingReceipt(result,disclosedResult),disclosedResult;const surface=command??"",source=disclosedResult,intentProjected=attachContextIntentReceipt(surface,options,source),intentEstimate=receiptEstimate(intentProjected.context_intent,"estimated_tokens"),binding=intentContinuationBinding(source,intentProjected),finalized=finalizeReadOutputEnvelope(surface,options,result,intentProjected,binding),settled=settledIntentOverBudget(options,finalized,intentProjected.context_intent);if(settled===void 0)return readOutputStageOmittedIntentPage(options,finalized,intentProjected)?chargedIntentPassOrRefusal(surface,options,result,source,intentProjected,Number(intentEstimate),binding,finalized):finalized;const charged={...options};intentEnvelopeOverheads.set(charged,settled.estimated-Number(intentEstimate));const rechargedIntent=attachContextIntentReceipt(surface,charged,source),recharged=finalizeChargedIntentPage(surface,options,charged,result,rechargedIntent,binding),residual=recharged===void 0?settled:settledIntentOverBudget(options,recharged,rechargedIntent.context_intent);if(residual===void 0)return recharged;const omitted={...residual.receipt,estimated_tokens:residual.estimated};return finalizeReadOutputEnvelope(surface,{...options,outputCursor:void 0,output_cursor:void 0},result,intentBudgetOutcome(canonicalIntentOutputBudget(options),omitted,recharged??finalized,()=>buildContextIntentRecoveryCommand(surface,omitted.command,omitted.intent,omitted,source,options)))}function readOutputStageOmittedIntentPage(options,finalized,intentProjected){const intent=intentProjected.context_intent;return Object.hasOwn(finalized,"output_budget_exceeded")&&isOutputRecord(intent)&&intent.result_omitted!==!0&&PRODUCER_PAGED_INTENT_COMMANDS.has(String(intent.command))&&(options.outputInclude??options.output_include)===void 0&&(options.outputSession??options.output_session)===void 0}const PRODUCER_PAGED_INTENT_COMMANDS=new Set(["list","search"]);function chargedIntentPassOrRefusal(surface,options,result,source,intentProjected,intentEstimate,binding,refusal){const measured=finalizeReadOutputEnvelope(surface,{...options,outputBudget:"unbounded"},result,{...intentProjected,context_intent:{...intentProjected.context_intent}},binding),charged={...options};intentEnvelopeOverheads.set(charged,estimateReadOutputTokens(measured,readOutputMeasurementFormat(options))-intentEstimate);const rechargedIntent=attachContextIntentReceipt(surface,charged,source),recharged=finalizeChargedIntentPage(surface,options,charged,result,rechargedIntent,binding);return recharged===void 0||Object.hasOwn(recharged,"output_budget_exceeded")||settledIntentOverBudget(options,recharged,rechargedIntent.context_intent)!==void 0?refusal:recharged}function finalizeChargedIntentPage(surface,options,charged,result,rechargedIntent,binding){return isReadResultOmittedForBudget(rechargedIntent)||chargedPrefixEndsBeforeCursor(options,rechargedIntent)?void 0:finalizeReadOutputEnvelope(surface,charged,result,rechargedIntent,binding)}function chargedPrefixEndsBeforeCursor(options,rechargedIntent){const raw=options.outputCursor??options.output_cursor;if(typeof raw!="string")return!1;const cursor=decodeReadOutputContinuationCursor(raw),rows=rechargedIntent[cursor.path];return Array.isArray(rows)&&rows.length<=cursor.offset}function settledIntentOverBudget(options,finalized,intentReceipt){const delivered=isOutputRecord(finalized.context_intent),settled=delivered?finalized.context_intent:intentReceipt;if(!isOutputRecord(settled)||settled.result_omitted===!0||Object.hasOwn(finalized,"output_budget_exceeded"))return;const receipt=settled,estimated=delivered?receipt.estimated_tokens:estimateReadOutputTokens(finalized,readOutputMeasurementFormat(options));return canonicalIntentOutputBudget(options)==="unbounded"||estimated<=receipt.token_budget?void 0:{receipt,estimated}}function intentEstimateMirror(intentReceipt){return!isOutputRecord(intentReceipt)||intentReceipt.result_omitted===!0?{}:{mirrorEstimate:(result,estimate)=>{isOutputRecord(result.context_intent)&&(result.context_intent.estimated_tokens=estimate)}}}function finalizeReadOutputEnvelope(command,options,result,intentProjected,continuationBinding){const dimensionOptions={...options,outputRowContract:options.outputRowContract===!0||options.output_row_contract===!0};registerReadOutputPassHooks(dimensionOptions,{...continuationBinding===void 0?{}:{continuationBinding:collapseContinuationMetadata(options,continuationBinding)},...intentEstimateMirror(intentProjected.context_intent)});const projected=applyReadOutputDimensions(command,dimensionOptions,collapseContinuationMetadata(options,intentProjected));if(propagateContextUsageServingReceipt(result,projected),options.outputRowContract===!0||options.output_row_contract===!0||!Object.hasOwn(projected,"row_contract"))return isOutputRecord(projected.context_intent)?stabilizeSuppressedRowContractReceipts(projected,options):projected;const withoutDiscoveryMetadata=Object.fromEntries(Object.entries(projected).filter(([key])=>key!=="row_contract"));Object.defineProperty(withoutDiscoveryMetadata,"row_contract",{value:projected.row_contract,enumerable:!1,configurable:!0});const suppressed=stabilizeSuppressedRowContractReceipts(withoutDiscoveryMetadata,options);return delete suppressed.row_contract,propagateContextUsageServingReceipt(projected,suppressed),suppressed}export{CONTEXT_INTENT_LIMIT_OVERRIDE_WARNING,PM_CONTEXT_INTENT_CONTRACTS,applyContextIntentProjection,attachContextIntentReceipt,attachReadOutputContracts,composeContextIntentContracts,contextIntentRowId,decodeContextIntentCursor,getActiveContextIntentContracts,resolveContextIntentContract,runWithContextIntentContracts};
2
2
  //# sourceMappingURL=context-intent-contracts.js.map
@@ -1,4 +1,4 @@
1
- import type{PmReadOutputCursorEnvelope,PmReadOutputSurface}from "../read-output-contracts.js";
1
+ import type{PmReadOutputCursorEnvelope,PmReadOutputSurface}from "../read-output-contracts.js";import{type PmReadOutputRowCollection}from "../read-output-rows.js";
2
2
  /** Stable snapshot policy for a read surface whose probes refresh observation metadata. */
3
3
  export interface PmReadOutputContinuationFingerprintPolicy{
4
4
  /** Version included in fingerprints so policy changes invalidate older cursors. */
@@ -27,5 +27,11 @@ export declare function encodeReadOutputContinuationCursor(cursor:Omit<PmReadOut
27
27
  export declare function decodeReadOutputContinuationCursor(raw:string):PmReadOutputCursorEnvelope;
28
28
  /** Place every non-passing assurance assertion before passing evidence. */
29
29
  export declare function prioritizeAssuranceAssertions(result:Record<string,unknown>):Record<string,unknown>;
30
- /** Validate and apply a continuation suffix to its declared row collection. */
31
- export declare function applyReadOutputContinuation(result:Record<string,unknown>,command:PmReadOutputSurface,cursor:PmReadOutputCursorEnvelope|undefined):Record<string,unknown>;
30
+ /**
31
+ * Validate and apply a continuation suffix to its declared row collection.
32
+ * `bindings` names the collections the cursor was issued against when they
33
+ * differ from the result's own: an intent read's charged second pass keeps a
34
+ * prefix of the rows its first pass kept, so the cursor validates against the
35
+ * first pass's collection and slices the delivered one (GH-1753).
36
+ */
37
+ export declare function applyReadOutputContinuation(result:Record<string,unknown>,command:PmReadOutputSurface,cursor:PmReadOutputCursorEnvelope|undefined,bindings?:ReadonlyMap<string,PmReadOutputRowCollection>):Record<string,unknown>;