@unbrained/pm-cli 2026.9.1 → 2026.9.3

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 (133) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +27 -0
  3. package/dist/cli/after-command-context-usage.js +16 -3
  4. package/dist/cli-bundle/bundle-manifest.json +153 -153
  5. package/dist/cli-bundle/chunks/{chunk-6XIIGE7U.js → chunk-34HASX3S.js} +2 -2
  6. package/dist/cli-bundle/chunks/chunk-AY324UJ5.js +9 -0
  7. package/dist/cli-bundle/chunks/{chunk-TAG4VC22.js → chunk-DKGP3QLE.js} +27 -27
  8. package/dist/cli-bundle/chunks/chunk-E5RBBCXO.js +230 -0
  9. package/dist/cli-bundle/chunks/{chunk-DTGWEL23.js → chunk-EDPIS7EB.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-X4RCGLTX.js → chunk-IEHHE6GA.js} +5 -5
  11. package/dist/cli-bundle/chunks/{chunk-U45JXJCC.js → chunk-L7B7343B.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-2MC2LCXZ.js → chunk-LENC656S.js} +41 -41
  13. package/dist/cli-bundle/chunks/chunk-LISESA7W.js +35 -0
  14. package/dist/cli-bundle/chunks/{chunk-3WICXLVT.js → chunk-UPPM2FOZ.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-Y7VOMSZT.js → chunk-Y4PJ6HPK.js} +2 -2
  16. package/dist/cli-bundle/chunks/{register-list-query-XYNX4ASQ.js → register-list-query-W2ZTOMKP.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-mutation-2MVLRS3J.js → register-mutation-RVND5NCG.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-operations-WCIDXBU3.js → register-operations-TTROIVC4.js} +2 -2
  19. package/dist/cli-bundle/chunks/{register-setup-KVNC5KPL.js → register-setup-D3ZFHY3L.js} +2 -2
  20. package/dist/cli-bundle/focused-chunks/chunk-3ZBI35HU.js +176 -0
  21. package/dist/cli-bundle/focused-chunks/{chunk-SVXJYD6G.js → chunk-4HJFY4MB.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/chunk-4RRHC3S4.js +6 -0
  23. package/dist/cli-bundle/focused-chunks/chunk-4WR46RMG.js +9 -0
  24. package/dist/cli-bundle/focused-chunks/chunk-5RFXUPN5.js +3 -0
  25. package/dist/cli-bundle/focused-chunks/chunk-BWKHEIVF.js +2 -0
  26. package/dist/cli-bundle/focused-chunks/{chunk-4O4CJAR6.js → chunk-D7KXFBXV.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-MKHG3T76.js → chunk-GHCZ3YFR.js} +3 -3
  28. package/dist/cli-bundle/focused-chunks/{chunk-KB5OFSFD.js → chunk-GT7MXDLW.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-KBLZRU62.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-KZ2NB3ET.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-M5M6SVHS.js +3 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-BEVHCEWG.js → chunk-OL5EH6I3.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-MEASX544.js → chunk-Q45NHPF2.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-Y6JJIX6I.js → chunk-QKHCSUGJ.js} +48 -48
  35. package/dist/cli-bundle/focused-chunks/chunk-S27XMBIN.js +8 -0
  36. package/dist/cli-bundle/focused-chunks/chunk-TXE4TSHM.js +12 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-UCLO3XDU.js +2 -0
  38. package/dist/cli-bundle/main.js +15 -15
  39. package/dist/cli-bundle/sdk-authoring.js +1 -1
  40. package/dist/cli-bundle/sdk-contracts.js +1 -1
  41. package/dist/cli-bundle/sdk-core.js +28 -28
  42. package/dist/cli-bundle/sdk-governance.js +1 -1
  43. package/dist/cli-bundle/sdk-graph.js +1 -1
  44. package/dist/cli-bundle/sdk-merge.js +35 -33
  45. package/dist/cli-bundle/sdk-query.js +1 -1
  46. package/dist/cli-bundle/sdk-runtime.js +1 -1
  47. package/dist/cli-bundle/sdk-testing.js +1 -1
  48. package/dist/cli-bundle/sdk.js +9 -9
  49. package/dist/core/diagnostics/remediation.js +9 -4
  50. package/dist/core/history/event-classification.d.ts +21 -0
  51. package/dist/core/history/event-classification.js +109 -0
  52. package/dist/core/history/event-index.d.ts +14 -3
  53. package/dist/core/history/event-index.js +543 -88
  54. package/dist/core/history/history.js +47 -18
  55. package/dist/core/history/workspace-history.js +7 -6
  56. package/dist/core/lock/lock.d.ts +22 -2
  57. package/dist/core/lock/lock.js +121 -19
  58. package/dist/core/output/output.js +31 -7
  59. package/dist/core/shared/time.d.ts +2 -0
  60. package/dist/core/shared/time.js +8 -2
  61. package/dist/core/store/item-metadata-query-index.js +5 -5
  62. package/dist/sdk/context/recency.d.ts +9 -0
  63. package/dist/sdk/context/recency.js +34 -0
  64. package/dist/sdk/context/usage-egress.d.ts +9 -0
  65. package/dist/sdk/context/usage-egress.js +30 -0
  66. package/dist/sdk/context-intent-contracts.js +7 -3
  67. package/dist/sdk/context-relevance.d.ts +23 -0
  68. package/dist/sdk/context-relevance.js +94 -23
  69. package/dist/sdk/context-signal-store.d.ts +7 -3
  70. package/dist/sdk/context-signal-store.js +155 -42
  71. package/dist/sdk/context-usage.d.ts +54 -0
  72. package/dist/sdk/context-usage.js +245 -16
  73. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -14
  74. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +14 -2
  75. package/dist/sdk/governance/health.js +77 -11
  76. package/dist/sdk/governance/validate.js +4 -2
  77. package/dist/sdk/index.d.ts +2 -0
  78. package/dist/sdk/index.js +4 -2
  79. package/dist/sdk/init.d.ts +2 -0
  80. package/dist/sdk/init.js +18 -9
  81. package/dist/sdk/merge/index.d.ts +1 -1
  82. package/dist/sdk/merge/index.js +2 -2
  83. package/dist/sdk/merge/receipts.d.ts +24 -0
  84. package/dist/sdk/merge/receipts.js +122 -30
  85. package/dist/sdk/query/context.d.ts +3 -1
  86. package/dist/sdk/query/context.js +21 -9
  87. package/dist/sdk/query/next.js +18 -9
  88. package/dist/sdk/runtime-input.d.ts +2 -0
  89. package/dist/sdk/runtime-input.js +25 -2
  90. package/dist/sdk/runtime.d.ts +1 -0
  91. package/dist/sdk/runtime.js +17 -26
  92. package/dist/types.d.ts +2 -0
  93. package/dist/types.js +2 -2
  94. package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +11 -2
  95. package/docs/CONTEXT_RELEVANCE.md +44 -1
  96. package/docs/MERGE_SAFETY.md +16 -2
  97. package/docs/PERFORMANCE.md +6 -3
  98. package/docs/READ_OUTPUT_CONTRACTS.md +9 -1
  99. package/docs/SDK.md +11 -8
  100. package/docs/SDK_CONTEXT.md +7 -0
  101. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +5 -3
  102. package/marketplace.json +2 -2
  103. package/package.json +4 -4
  104. package/packages/pm-beads/package.json +1 -1
  105. package/packages/pm-calendar/package.json +1 -1
  106. package/packages/pm-command-kit/package.json +1 -1
  107. package/packages/pm-digital-twin/package.json +1 -1
  108. package/packages/pm-governance-audit/package.json +1 -1
  109. package/packages/pm-guide-shell/package.json +1 -1
  110. package/packages/pm-kanban/package.json +1 -1
  111. package/packages/pm-lifecycle-hooks/package.json +1 -1
  112. package/packages/pm-linked-test-adapters/package.json +1 -1
  113. package/packages/pm-search-advanced/package.json +1 -1
  114. package/packages/pm-templates/package.json +1 -1
  115. package/packages/pm-todos/package.json +1 -1
  116. package/packages/pm-vcs/package.json +1 -1
  117. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  118. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  119. package/sdk/public-surface.json +268 -28
  120. package/dist/cli-bundle/chunks/chunk-ALKKAUFN.js +0 -35
  121. package/dist/cli-bundle/chunks/chunk-GOACULJW.js +0 -13
  122. package/dist/cli-bundle/chunks/chunk-NOPL37X4.js +0 -205
  123. package/dist/cli-bundle/focused-chunks/chunk-2FEZ5SKM.js +0 -3
  124. package/dist/cli-bundle/focused-chunks/chunk-6GCRSLPG.js +0 -2
  125. package/dist/cli-bundle/focused-chunks/chunk-7VATS5QY.js +0 -16
  126. package/dist/cli-bundle/focused-chunks/chunk-FWPLDEXF.js +0 -2
  127. package/dist/cli-bundle/focused-chunks/chunk-JEFKLWMM.js +0 -2
  128. package/dist/cli-bundle/focused-chunks/chunk-PF3E6Q36.js +0 -8
  129. package/dist/cli-bundle/focused-chunks/chunk-QDFJIRKN.js +0 -4
  130. package/dist/cli-bundle/focused-chunks/chunk-RMRCQPWU.js +0 -2
  131. package/dist/cli-bundle/focused-chunks/chunk-S4U5CN5Q.js +0 -2
  132. package/dist/cli-bundle/focused-chunks/chunk-T2LXXSOD.js +0 -158
  133. package/dist/cli-bundle/focused-chunks/chunk-Z2USIBR2.js +0 -5
@@ -1,5 +0,0 @@
1
- (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]="ef5c8553-c206-5bb5-913a-85afb936f6d7")}catch{}})();var Q=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],lt=2,_t=Object.freeze({migration:"schema",validation:"schema"}),_o=Object.freeze({version:lt,capabilities:[...Q],legacy_aliases:{..._t}}),Ee=["off","warn","enforce"],Oe=["off","warn","enforce"],Ae=["none","restricted","strict"],fo=["block","warn"],Se=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore","services.assuranceprovider"],we=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function Te(){return{mode:"off",trust_mode:"off",require_provenance:!1,trusted_extensions:[],default_sandbox_profile:"none",allowed_extensions:[],blocked_extensions:[],allowed_capabilities:[],blocked_capabilities:[],allowed_surfaces:[],blocked_surfaces:[],allowed_commands:[],blocked_commands:[],allowed_actions:[],blocked_actions:[],allowed_services:[],blocked_services:[],extension_overrides:[]}}(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]="64223a83-1287-57ac-915d-dbd5e375a6eb")}catch{}})();var ft=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],mo=ft,go=["draft","open","in_progress","blocked","closed","canceled"],yo=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],ho=["string","number","boolean","string_array","array","object"],bo=["create","update","update_many","list","search","calendar","context"],Eo=["allow","warn","reject"],Oo=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],Ao=["project","global"],So=["low","medium","high","critical"],wo=["low","medium","high","critical"],To=["low","medium","high"];var ko=["minimal","default","strict","custom"],xo=["none","warn","strict"],Ro=["progressive","strict"],Io=["off","warn","strict"],No=["off","warn","strict"];var Co=["daily","weekly","monthly","yearly"],pt=["mon","tue","wed","thu","fri","sat","sun"];function vo(e){return pt.indexOf(e)}var Do=["draft","research","review","approved","executing","paused","completed","superseded"],Mo=["pending","in_progress","completed","blocked","skipped","superseded"],Uo=["codex","claude-code","cursor","generic"],Po=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],Lo=["brief","standard","deep","full"],jo=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];(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]="27c5eac3-4580-5f6f-8ae9-b04d0281766d")}catch{}})();var ke=["goal","objective","value","impact","outcome","why_now","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","unblock_note","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result"],mt=["id","title","description","type","pm_format_version","source_type","type_options","status","priority","tags","created_at","updated_at","deadline","reminders","events","closed_at","completed_at","assignee","claim_principal","source_owner","author","estimated_minutes","acceptance_criteria","design","external_ref","definition_of_ready","order",...ke,"affected_version","fixed_version","component","regression","customer_impact","dependencies","comments","notes","learnings","files","tests","test_runs","docs","close_reason","duplicate_of","plan_mode","plan_scope","plan_harness","plan_resume_context","plan_validation","plan_decisions","plan_discoveries","plan_steps"],gt=mt;(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]="4bb01c24-e203-5f9f-ba23-25888bd7f6ea")}catch{}})();var yt=Object.freeze([{id:"draft",roles:["draft"]},{id:"open",roles:["active","default_open"]},{id:"in_progress",aliases:["in-progress"],roles:["active"]},{id:"blocked",roles:["blocked"]},{id:"closed",roles:["terminal","terminal_done","default_close"]},{id:"canceled",aliases:["cancelled"],roles:["terminal","terminal_canceled","default_cancel"]}]),ht=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),Go=".agents/pm",$o="settings.json";var bt=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],Et=["decisions","events","reminders","milestones","meetings","plans"],zo=[...bt,...Et],qo={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},Ot={minimal:{ownership_enforcement:"none",create_mode_default:"progressive",close_validation_default:"off",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!1,duplicate_detection_mode:"off",duplicate_detection_threshold:.8,duplicate_detection_limit:3},default:{ownership_enforcement:"warn",create_mode_default:"progressive",close_validation_default:"warn",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3},strict:{ownership_enforcement:"strict",create_mode_default:"strict",close_validation_default:"strict",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"strict",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3}},At=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],H={blocked_reason:["no active blocker because work is closed","work is closed"],resolution:["closed with implementation evidence","closed with verification evidence","work completed and recorded","work is closed"],actual_result:["closed and recorded","work completed","work completed and recorded"]};function xe(e){return e?[...e]:void 0}var Ko={version:1,id_prefix:"pm-",ids:{token_length:4},author_default:"",agent_identity:{probes_enabled:!0,identity_vocabulary:{version:1,aliases:{}},harness_signals:[]},mutation_guard:{require_attributed_author:!1,secret_guard:"advise",stale_in_progress_hours:72},item_format:"toon",locks:{ttl_seconds:1800,wait_ms:3e3},checkpoints:{retention_days:14},output:{default_format:"toon"},ux:{deprecation_hints:!0},history:{missing_stream:"auto_create",compact_policy:{enabled:!1,max_entries:500,trigger:"health_warn"}},validation:{sprint_release_format:"warn",parent_reference:"warn",metadata_profile:"core",metadata_required_fields:[],lifecycle_stale_blocker_reason_patterns:[...At],lifecycle_closure_like_blocked_reason_patterns:[...H.blocked_reason],lifecycle_closure_like_resolution_patterns:[...H.resolution],lifecycle_closure_like_actual_result_patterns:[...H.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...Ot.minimal},workflow:{definition_of_done:[]},testing:{record_results_to_items:!1,allow_untrusted_linked_tests:!1},telemetry:{enabled:!0,first_run_prompt_completed:!1,capture_level:"redacted",endpoint:"https://pm-cli.unbrained.dev/v1/events",installation_id:"",retention_days:365},agent_guidance:{prompt_completed:!1,declined:!1,declined_at:"",template_version:1,last_checked_files:[]},item_types:{definitions:[]},schema:{version:1,files:{types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"},statuses:yt.map(e=>({...e,aliases:xe(e.aliases),roles:xe(e.roles)})),fields:[],workflow:{...ht},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:Te()},search:{score_threshold:0,hybrid_semantic_weight:.7,max_results:50,embedding_model:"",embedding_batch_size:32,embedding_timeout_ms:3e4,scanner_max_batch_retries:3,provider:"",mutation_refresh_policy:"semantic_configured",query_expansion:{enabled:!1,provider:""},rerank:{enabled:!1,model:"",top_k:20}},providers:{openai:{base_url:"",api_key:"",model:""},ollama:{base_url:"",model:""}},context:{default_depth:"brief",activity_limit:10,stale_threshold_days:7,sections:{hierarchy:!0,activity:!0,progress:!0,recently_created:!0,unparented:!0,blockers:!0,files:!0,workload:!0,staleness:!0,tests:!0}},vector_store:{adapter:"",collection_name:"pm_items",qdrant:{url:"",api_key:""},lancedb:{path:""}}},Yo={metadata:{},body:""},y={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},Xo=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",init_gitignore_unwritable:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(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]="922e2e27-1499-5466-98e4-322d0d742e40")}catch{}})();var m=class extends Error{exitCode;code;context;constructor(t,n,o={}){super(t),this.name="PmCliError",this.exitCode=n,this.context=o,this.code=o.code}};(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]="3c9694bd-3635-5298-abeb-6899c94317ab")}catch{}})();var j=[...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-pbyu"})),...[["extension list","extension catalog"],["extension scaffold","extension init"],["package list","package catalog"],["package scaffold","package init"],["packages list","packages catalog"],["packages scaffold","packages init"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-ya7x55"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([e,t])=>({alias:e,canonical:"list",canonical_argv:["list","--status",t],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-tnud"}))],Ho=Object.fromEntries(j.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function Zo(e){let t=e.trim().toLowerCase();return j.find(n=>n.alias===t)}function er(e){return`Deprecated command \`${e.alias}\`; use \`pm ${e.canonical_argv.join(" ")}\`.`}(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]="6315a62f-6f55-5200-a5ea-ec892ff39f58")}catch{}})();var St=[...Q],wt=[...we],Tt=[...Ee],rr=[...Oe],ir=[...Ae],kt=[...Se],F=["init","config","extension","package","packages","install","upgrade","create","item","copy","focus","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","aggregate","context","ctx","get","graph","search","duplicates","eval","next","history","events","history-redact","history-repair","history-compact","history-author-acknowledge","merge","schema","profile","activity","restore","update","update-many","close","close-many","delete","append","comments","notes","learnings","files","docs","deps","plan","test","test-all","telemetry","stats","health","validate","assurance","gc","workspace","contracts","claim","release","start-task","pause-task","close-task","meet","event","remind","help"],sr=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],ar=["install","reconcile","report","driver"],xt=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],Rt=["upgrade"],It=["reopen"],Re={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},V=Object.freeze(F.flatMap(e=>e in Re?[]:e==="extension"||e==="package"?[...xt.map(t=>`${e}-${t}`),...e==="package"?Rt.map(t=>`package-${t}`):[],e]:e==="item"?It.map(t=>`item-${t}`):[e])),Nt=Object.freeze(j.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&V.includes(e.alias)).map(e=>e.alias)),cr=Object.freeze(V.filter(e=>!Nt.includes(e)));function ur(e=F,t=V,n=Re){let o=new Set(t),r=new Set(e);return{missing_cli_actions:e.filter(i=>!o.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&n[i]===void 0),waived_cli_actions:e.filter(i=>!o.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&n[i]!==void 0),stale_waivers:Object.keys(n).filter(i=>!r.has(i)||o.has(i)||t.some(s=>s.startsWith(`${i}-`)))}}function dr(e){return V.includes(e)}function lr(e){return St.includes(e)}function _r(e){return wt.includes(e)}function fr(e){return Tt.includes(e)}function pr(e){return kt.includes(e)}(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]="810d42b5-98f4-57a7-bdd9-2dfa1b2b1c03")}catch{}})();var Ct=new Set(["applied_bound","completeness","budget_retention_policy","continuation_contract","continuation_kind","continuation_path","filters","omission_receipt","output_budget_truncation","projection","read_output","read_session","row_contract","sorting"]);function T(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ie(e,t){let n=e;for(let o of t.split("."))if(Array.isArray(n)){if(!/^\d+$/u.test(o))return;n=n[Number(o)]}else{if(!T(n))return;n=n[o]}return n}function Z(e,t,n){let o=t.split("."),r=(i,s)=>{if(s===o.length)return n;let a=o[s];if(Array.isArray(i)){let c=Number(a),l=[...i];return l[c]=r(i[c],s+1),l}let d=i;return{...d,[a]:r(d[a],s+1)}};return r(e,0)}function Ne(e,t,n){let o=x(e).find(i=>i.path===t);if(!o)return e;let r=Array.isArray(o.value)?o.value.slice(n):Object.fromEntries(Object.entries(o.value).slice(n));return Z(e,t,r)}function B(e){let t=e.row_contract;return T(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):Object.entries(e).filter(([,n])=>Array.isArray(n)).map(([n])=>n)}function vt(e){let t=e.row_contract;return T(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):B(e)}function k(e){return B(e).flatMap(t=>{let n=Ie(e,t);return Array.isArray(n)||T(n)?[{path:t,value:n}]:[]})}function x(e){return vt(e).flatMap(t=>{let n=Ie(e,t);return Array.isArray(n)||T(n)?[{path:t,value:n}]:[]})}function G(e){let t=k(e),n=new Set(t.map(r=>r.path)),o=(r,i)=>{if(Array.isArray(r)){n.has(i)||t.push({path:i,value:r}),r.forEach((s,a)=>o(s,`${i}.${a}`));return}if(T(r))for(let[s,a]of Object.entries(r))i.length===0&&Ct.has(s)||o(a,i.length===0?s:`${i}.${s}`)};return o(e,""),t}function $(e){return k(e).reduce((t,n)=>t+(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length),0)}function v(e,t){let n=e;for(let o of k(n)){let r=Array.isArray(o.value)?o.value.map((i,s)=>t(i,o.path,s)):Object.fromEntries(Object.entries(o.value).map(([i,s],a)=>[i,t(s,o.path,a)]));n=Z(n,o.path,r)}return n}function Ce(e,t){let n=e,o=!1;for(let r of k(n)){let i=Array.isArray(r.value)?r.value:Object.entries(r.value);if(i.length<=t)continue;o=!0;let s=Array.isArray(r.value)?i.slice(0,t):Object.fromEntries(i.slice(0,t));n=Z(n,r.path,s)}return{result:n,truncated:o}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="642f6dec-c0b2-5377-a401-dfa4f8ef6a2a")}catch{}})();var ee=256,te=1e4,Dt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,Mt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u,Ut=new Set(["version","id","token_budget","spent_tokens","seen_item_ids"]),Pt=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&Dt.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=ee,reason:`token_budget must be a safe integer of at least ${ee}.`},{valid:e=>Number.isSafeInteger(e.spent_tokens)&&e.spent_tokens>=0&&e.spent_tokens<=e.token_budget,reason:"spent_tokens must be a non-negative safe integer no larger than token_budget."},{valid:e=>Array.isArray(e.seen_item_ids)&&e.seen_item_ids.length<=te&&e.seen_item_ids.every(t=>typeof t=="string"&&Mt.test(t)),reason:`seen_item_ids must contain at most ${te} portable item identifiers.`}];function q(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function z(e){throw new m(`--output-session ${e}`,y.USAGE,{code:"invalid_read_output_session",field:"outputSession"})}function K(e){if(e===void 0)return;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{z("must be a valid JSON object.")}q(t)||z("must be a JSON object.");let n=Object.keys(t).filter(i=>!Ut.has(i));n.length>0&&z(`contains unknown field "${n.sort()[0]}".`);let o=Pt.find(i=>!i.valid(t));o!==void 0&&z(o.reason);let r=[...new Set(t.seen_item_ids)].sort();return{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:r}}function ve(e){if(q(e))return typeof e.id=="string"?e.id:typeof e.item_id=="string"?e.item_id:q(e.item)&&typeof e.item.id=="string"?e.item.id:void 0}function Lt(e){let t=new Set,n=0;for(let o of k(e)){let r=Array.isArray(o.value)?o.value:Object.values(o.value);for(let i of r){if(!q(i))continue;if(typeof i.context_ref=="string"){n+=1;continue}let s=ve(i);s!==void 0&&t.add(s)}}return{deliveredIds:t,suppressedRepeatCount:n}}function De(e,t){let n=new Set(t.seen_item_ids);return v(e,o=>{let r=ve(o);return r!==void 0&&n.has(r)?{id:r,context_ref:`session:${t.id}:${r}`}:o})}function ne(e,t){let{deliveredIds:n,suppressedRepeatCount:o}=Lt(e),r=new Set(t.seen_item_ids),i=[...n].filter(p=>!r.has(p)).sort(),s=i.slice(0,te-t.seen_item_ids.length),a=[...t.seen_item_ids,...s].sort(),d=i.length-s.length,c={contract_version:1,id:t.id,measurement_scope:"complete_read_envelope",estimator:"ceil(utf8_bytes / 4)",token_budget:t.token_budget,spent_before_tokens:t.spent_tokens,spent_this_call_tokens:0,charged_this_call_tokens:0,spent_total_tokens:t.spent_tokens,remaining_tokens:t.token_budget-t.spent_tokens,exhausted:!1,seen_before_count:t.seen_item_ids.length,new_item_count:n.size,...d===0?{}:{seen_item_overflow_count:d},suppressed_repeat_count:o,reference_format:"session:<session-id>:<item-id>",restore_reference_with:"pm get <item-id> --brief",next_state:{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:a}},l={...e,read_session:c},u=p=>{c.spent_this_call_tokens=p,c.charged_this_call_tokens=Math.min(t.token_budget-t.spent_tokens,p),c.spent_total_tokens=Math.min(t.token_budget,t.spent_tokens+c.charged_this_call_tokens),c.remaining_tokens=Math.max(0,t.token_budget-c.spent_total_tokens),c.exhausted=c.remaining_tokens<ee,c.next_state.spent_tokens=c.spent_total_tokens},_=0,f=0;for(let p=0;p<8;p+=1){u(_);let h=Math.ceil(Buffer.byteLength(JSON.stringify(l),"utf8")/4);if(h===_)return l;f=Math.max(f,h),_=h}return u(f),l}function Me(e){return Math.max(0,e.token_budget-e.spent_tokens)}(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]="02a0bd0c-6ab0-5193-807b-00394a4712b7")}catch{}})();var jt=8,Ft=64,Vt=5,Bt=4,Ue=100;function re(e){let t=Math.trunc(e.effective_budget_tokens),n=Math.trunc(e.measured_result_tokens);if(!Number.isSafeInteger(t)||t<=0||!Number.isSafeInteger(n)||n<=0)return{output_budget:"unbounded",recovery_budget_multiplier:null,rule_version:"v1"};let o=Math.max(t+1,n),r=Math.ceil(o*Vt/Bt),i=Math.ceil(r/Ue)*Ue;return Number.isSafeInteger(i)?{output_budget:i,recovery_budget_multiplier:i/t,rule_version:"v1"}:{output_budget:"unbounded",recovery_budget_multiplier:null,rule_version:"v1"}}function ie(e){return Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4)}function Gt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oe(e,t){return typeof e=="string"?e.length<=240?e:(t.compacted=!0,`${e.slice(0,240)}\u2026`):Array.isArray(e)?e.map(n=>oe(n,t)):Gt(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>[n,oe(o,t)])):e}function A(e,t){let n=t.estimated_tokens;for(let o=0;o<jt;o+=1){t.estimated_tokens=n;let r=ie(e);if(r===n)return;n=r}t.estimated_tokens=n}function $t(e,t,n,o){for(let r=0;r<Ft;r+=1){if(A(e,t),t.estimated_tokens<=n)return;let i=G(e).filter(a=>(Array.isArray(a.value)?a.value.length:Object.keys(a.value).length)>Math.max(1,o.get(a.path)??0)).map(a=>({collection:a,length:Array.isArray(a.value)?a.value.length:Object.keys(a.value).length})).sort((a,d)=>d.length-a.length||a.collection.path.localeCompare(d.collection.path))[0]?.collection;if(!i)return;let s=Math.max(1,o.get(i.path)??0);if(Array.isArray(i.value))i.value.splice(-Math.min(i.value.length-s,Math.max(1,Math.ceil(i.value.length/2))));else{let a=Object.keys(i.value);for(let d of a.slice(-Math.min(a.length-s,Math.max(1,Math.ceil(a.length/2)))))delete i.value[d]}t.rows_compacted=!0,t.compacted_row_paths=[...new Set([...t.compacted_row_paths??[],i.path])].sort((a,d)=>a.localeCompare(d)),e.has_more=!0,e.truncated=!0,typeof e.count=="number"&&(e.count=$(e))}}function Pe(e,t,n,o=new Map){let r={compacted:!1},i=oe(e,r);return t.strings_compacted=r.compacted,i.read_output=t,$t(i,t,n,o),A(i,t),i}(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]="1d338971-5a60-5b4e-b4c8-0705c8e8c98c")}catch{}})();var zt=["full","compact","brief","summary","counts"],wr=["mutation","read","discovery","governance"],Le=["error","warning","validation_summary","recovery_bundle"],qt=["full","omit_explanation","limit_collections","compact_recovery","action_only"],Kt=new Set(["append","claim","close","close-many","close-task","comments","config","copy","create","delete","docs","event","files","focus","history-author-acknowledge","history-compact","history-redact","history-repair","init","item","learnings","meet","notes","pause-task","release","remind","restore","schema","start-task","update","update-many"]),Yt=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),Xt=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),Wt={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},Jt=3,Qt=2,Ht=192,Zt={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},en=Le.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:Zt[e],minimum_max_estimated_tokens:Ht,degradation_ladder:qt,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),tn=new Map(en.map(e=>[e.diagnostic_class,e]));function nn(e){let[t=""]=e.trim().split(/\s+/u);return Kt.has(t)?"mutation":Yt.has(t)?"discovery":Xt.has(t)?"governance":"read"}function je(e,t=nn(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let o=Wt[t];return on({command:n,budget_class:t,default_max_estimated_tokens:o,default_max_estimated_tokens_by_format:{toon:o,json:Math.ceil(o*Jt/Qt)},degradation_ladder:zt,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function on(e){if(!Number.isSafeInteger(e.default_max_estimated_tokens)||e.default_max_estimated_tokens<=0)throw new RangeError("default_max_estimated_tokens must be a positive safe integer");for(let[t,n]of Object.entries(e.default_max_estimated_tokens_by_format))if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`default_max_estimated_tokens_by_format.${t} must be a positive safe integer`);return e}var rn=F.map(e=>je(e)),sn=new Map(rn.map(e=>[e.command,e]));function Fe(e,t={}){let n=e.trim().replace(/\s+/gu," "),[o]=n.split(" "),r=sn.get(o);return r?{...r,command:n}:t.generateFallback?je(n):null}function se(e){return Math.ceil(Math.max(0,e)/4)}function Ve(e){let t=tn.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${Le.join(", ")}`);return t}function O(e){return se(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function an(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ae(e){if(!an(e))return;let t={};for(let n of["suggested_retry","suggested_retry_args","next_best_command","allowed_values","candidate_commands","missing","missing_required_fields","option_scope","retry_after_ms"]){let o=e[n];Array.isArray(o)?t[n]=n==="suggested_retry_args"?o:o.slice(0,3):o!==void 0&&(t[n]=o)}return Object.keys(t).length>0?t:void 0}function cn(e,t){return typeof e!="string"||e.length<=t?e:`${e.slice(0,Math.max(1,t-3))}...`}function R(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;let n="...",o=Array.from(e),r=0,i=o.length;for(;r<i;){let s=Math.ceil((r+i)/2),a=`${o.slice(0,s).join("")}${n}`;Buffer.byteLength(a,"utf8")<=t?r=s:i=s-1}return`${o.slice(0,r).join("")}${n}`}function Be(e){let t={};for(let n of["code","required","recovery","next_steps","exit_code","type","title","detail","why","examples"])Object.hasOwn(e,n)&&e[n]!==void 0&&(t[n]=e[n]);for(let[n,o]of Object.entries(e))n!=="__proto__"&&!Object.hasOwn(t,n)&&(t[n]=o);return t}var un=new Set(["limit_collections","compact_recovery","action_only"]),dn=new Set(["compact_recovery","action_only"]);function ln(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:cn(e.required,160)??"Inspect the diagnostic code and retry with corrected input."},n=ae(e.recovery);return n!==void 0?t.recovery=n:Array.isArray(e.next_steps)&&(t.next_steps=e.next_steps.slice(0,1)),e.exit_code!==void 0&&(t.exit_code=e.exit_code),e.type!==void 0&&(t.type=e.type),t}function _n(e,t){let n=structuredClone(e);if(t!=="full"&&(delete n.why,delete n.examples),un.has(t))for(let[o,r]of Object.entries(n))Array.isArray(r)&&(n[o]=r.slice(0,3));if(dn.has(t)){let o=ae(n.recovery);o?n.recovery=o:delete n.recovery}return t!=="action_only"?Be(n):ln(n)}function I(e,t){let n={...e,diagnostic_output:{...t,estimated_tokens:0}};for(let o=0;o<4;o+=1){let r=O(n),i=n.diagnostic_output;if(i.estimated_tokens===r)break;i.estimated_tokens=r}return n}function fn(e,t,n){let o=I(e,t);for(let i of["recovery","exit_code"])O(o)<=n||e[i]===void 0||(delete e[i],o=I(e,t));let r=40;for(;O(o)>n&&r>4;)r-=4,e.code=R(String(e.code),r),e.required=R(String(e.required),r),o=I(e,t);return o}function pn(e,t){let n=e.diagnostic_output,{estimated_tokens:o,...r}=n,i=r.omitted_fields.slice(0,8).map(u=>R(u,32)),s={...r,omitted_fields:i,...r.omitted_fields.length>i.length?{omitted_fields_overflow_count:r.omitted_fields.length-i.length}:{}},a=ae(e.recovery),d=a&&O(a)<=48?a:void 0,c={code:R(String(e.code),320),required:R(String(e.required),320),...d?{recovery:d}:{},...e.exit_code!==void 0?{exit_code:e.exit_code}:{}},l=I(c,s);for(;O(l)>t&&s.omitted_fields.length>0;)s.omitted_fields.pop(),s.omitted_fields_overflow_count=r.omitted_fields.length-s.omitted_fields.length,l=I(c,s);return l=fn(c,s,t),l}function Tr(e,t={}){let n=e,o=t.diagnosticClass??"error",r=Ve(o),i=t.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<r.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${r.minimum_max_estimated_tokens}`);let s=i??r.default_max_estimated_tokens_by_format.json,a=O(n),d=Object.keys(n);if(a<=s)return Be(structuredClone(n));let c;for(let[l,u]of r.degradation_ladder.entries()){let _=_n(n,u),f=d.filter(h=>!Object.hasOwn(_,h)),p=I(_,{diagnostic_class:o,format:"json",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,truncated:l>0,degradation_steps:r.degradation_ladder.slice(0,l+1),omitted_fields:f});if(c=p,O(p)<=s)break}return O(c)>s&&(c=pn(c,s)),c}function kr(e,t,n={}){let o=n.diagnosticClass??"error",r=Ve(o),i=n.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<r.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${r.minimum_max_estimated_tokens}`);let s=i??r.default_max_estimated_tokens_by_format.text,a=se(Buffer.byteLength(e,"utf8")),d=a>s,c=`What is required:
2
- `,l=`
3
-
4
- Diagnostic output exceeded its declared ${s}-token ceiling; rerun with structured JSON for the bounded recovery envelope.`,u=t.trim()||"Inspect the diagnostic code and retry with corrected input.",_=Math.max(1,s*4-Buffer.byteLength(`${c}${l}`,"utf8")),f=d?`${c}${R(u,_)}${l}`:e;return{output:f,diagnostic_output:{diagnostic_class:o,format:"text",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,estimated_tokens:se(Buffer.byteLength(f,"utf8")),truncated:d,degradation_steps:d?[...r.degradation_ladder]:["full"],omitted_fields:d?["explanation","collections"]:[]}}}import{createHash as ro}from"node:crypto";import mn 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]="83232698-197a-5aef-be7c-aa37f3c56822")}catch{}})();function gn(e){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return e.toString();if(e===void 0)return"undefined";if(typeof e=="symbol")return e.toString();if(typeof e=="function")return`[function:${e.name||"anonymous"}]`}function yn(e){let t=Object.keys(e).sort(),n={};for(let o of t){let r=e[o];r!==void 0&&(n[o]=Y(r))}return n}function Y(e){let t=gn(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(o=>Y(o));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let o=n.toJSON();if(o!==e)return Y(o)}return yn(e)}function X(e){return JSON.stringify(Y(e))}function Ge(e,t,n,o){for(let r=0;r<t.length;r+=1)if(!n.has(r)&&o(e,t[r]))return n.add(r),!0;return!1}function hn(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function bn(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function En(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let n=[...t],o=new Set;for(let r of e)if(!Ge(r,n,o,D))return!1;return!0}function On(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let n=[...t.entries()],o=new Set;for(let[r,i]of e.entries())if(!Ge([r,i],n,o,([a,d],[c,l])=>D(a,c)&&D(d,l)))return!1;return!0}function An(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,o)=>D(n,t[o]))}function Sn(e,t){let n=Object.keys(e).sort((r,i)=>r.localeCompare(i)),o=Object.keys(t).sort((r,i)=>r.localeCompare(i));if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1){let i=n[r];if(i!==o[r]||!D(e[i],t[i]))return!1}return!0}var wn=[hn,bn,En,On,An];function D(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let n of wn){let o=n(e,t);if(o!==void 0)return o}return Sn(e,t)}function Ir(e){return mn.createHash("sha256").update(e,"utf8").digest("hex")}function Nr(e,t){let n={};for(let r of t){let i=e[r];i!==void 0&&(n[r]=i)}let o=Object.keys(e).filter(r=>!t.includes(r)).sort((r,i)=>r.localeCompare(i));for(let r of o){let i=e[r];i!==void 0&&(n[r]=i)}return n}import{createHash as Tn}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]="d3329fac-693d-566c-a30a-43f8fb37938f")}catch{}})();var ce=1,ze=4096,kn=/^[A-Za-z0-9_-]+$/;function $e(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function Pr(e,t){let n=new Set;for(let o of t)if(o.cursor_semantics==="presentation"){n.add($e(o.flag));for(let r of o.aliases??[])n.add($e(r))}return Object.fromEntries(Object.entries(e).filter(([o])=>!n.has(o)))}function Lr(e,t){return Tn("sha256").update(e).update("\0").update(X(t)).digest("hex").slice(0,24)}function ue(e,t,n,o){return Buffer.from(JSON.stringify({version:ce,fingerprint:e,after_id:t,...n===void 0?{}:{after_index:n},...o===void 0?{}:{snapshot:o}})).toString("base64url")}function S(e){return new m(e,y.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function xn(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===ce&&typeof t.fingerprint=="string"&&typeof t.after_id=="string"&&t.after_id.length>0&&(t.after_index===void 0||Number.isSafeInteger(t.after_index)&&t.after_index>=0)&&(t.snapshot===void 0||typeof t.snapshot=="string"&&t.snapshot.length>0)}function de(e){if(typeof e!="string")throw S("Query cursor is malformed.");let t=e.trim();if(t.length===0||t.length>ze||!kn.test(t))throw S("Query cursor is malformed.");let n;try{n=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw S("Query cursor is malformed.")}if(!xn(n))throw S("Query cursor version or payload is unsupported.");return n}function le(e,t){let n=de(e);if(n.fingerprint!==t)throw S(`Query cursor does not match the current filters, sort, or query (${n.fingerprint} != ${t}).`);return{after_id:n.after_id,...n.after_index===void 0?{}:{after_index:n.after_index},...n.snapshot===void 0?{}:{snapshot:n.snapshot}}}function jr(e,t){return le(e,t).after_id}function Rn(e,t,n,o){if(t===void 0)return 0;let r=le(t,n),i=e.findIndex(s=>o(s)===r.after_id);if(i<0){if(r.after_index!==void 0)return Math.min(r.after_index,e.length);throw S(`Query cursor item ${r.after_id} is no longer present in this result set.`)}return i+1}function Fr(e,t){if(t.cursor!==void 0&&le(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw S("Query cursor does not match the requested snapshot.");let n=Rn(e,t.cursor,t.fingerprint,t.readId),o=e.slice(n,n+t.limit),r=o.length>0&&n+o.length<e.length,i=o.at(-1);return{rows:o,has_more:r,...r&&i!==void 0?{next_cursor:ue(t.fingerprint,t.readId(i),n+o.length-1,t.snapshot)}:{}}}var Vr=Object.freeze({version:ce,max_length:ze});(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]="2103a4dc-3037-5768-b2c7-5964de4ac86b")}catch{}})();var w=["include","amount","cost","encoding"],Ze=["list","context","search","get","next","health","deps","graph","history","activity","validate","events","contracts","comments","notes","files","docs","stats","aggregate","duplicates","package-catalog","package-manage","comments-audit","assurance"],et=["canonical","legacy","intent","default"],U={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},_e=Symbol.for("pm.readOutputInvocationProvenance"),Jr=Object.freeze(w.map(e=>U[e])),Qr=Object.freeze(["--output-session","--output-cursor","--output-row-contract"]),tt={list:{include:["--brief","--compact","--fields","--full"],amount:["--after","--limit","--no-truncate"],cost:["--token-budget"],encoding:["--format","--stream"]},context:{include:["--fields","--section"],amount:["--after","--depth","--limit"],cost:["--token-budget"],encoding:["--format"]},search:{include:["--compact","--fields","--full"],amount:["--after","--limit"],cost:["--token-budget"],encoding:["--format"]},get:{include:["--fields","--full"],amount:["--depth"],cost:["--token-budget"],encoding:["--format"]},next:{amount:["--blocked-limit","--limit"],cost:["--token-budget"],encoding:["--format"]},health:{include:["--brief","--check-only","--full","--summary"]},deps:{include:["--collapse","--full","--summary"],amount:["--edge-limit","--max-depth","--node-limit"],cost:["--token-budget"],encoding:["--format"]},graph:{include:["--full","--summary"],amount:["--after","--limit","--max-depth","--max-paths"]},history:{include:["--compact","--full"],amount:["--limit"],encoding:["--format"]},activity:{include:["--compact","--full"],amount:["--limit","--unbounded"],encoding:["--stream"]},validate:{include:["--counts","--full"]},events:{include:["--full"],amount:["--limit"],encoding:["--follow"]},contracts:{include:["--full","--summary"]},comments:{amount:["--limit"]},notes:{amount:["--limit"]},files:{amount:["--limit","--no-truncate","--offset"]},docs:{},stats:{},aggregate:{},duplicates:{amount:["--limit"]},"package-catalog":{},"package-manage":{},"comments-audit":{},assurance:{}},nt=new Set(["--collapse","--fields","--section"]),me=Object.freeze({"--after":"--after retains cursor-position semantics; use --output-limit <n> separately to bound returned rows.","--check-only":"--check-only retains health side-effect semantics; --output-include does not suppress vector refresh.","--collapse":"--collapse retains dependency grouping semantics; --output-include does not replace it.","--depth":"--depth retains traversal or detail-depth semantics; --output-limit does not replace it.","--follow":"--follow retains event-tail semantics; --output-format does not enable following.","--max-depth":"--max-depth retains graph traversal-depth semantics; --output-limit does not replace it.","--max-paths":"--max-paths retains graph path-search semantics; use --output-limit separately to bound returned rows.","--no-truncate":"--no-truncate is a compatibility alias; prefer --output-limit unbounded.","--offset":"--offset retains positional pagination semantics; use --output-limit separately to bound returned rows.","--stream":"--stream retains command streaming semantics; --output-format selects only static result encoding.","--unbounded":"--unbounded is a compatibility alias; prefer --output-limit unbounded."});function ge(e){return e.slice(2).replaceAll("-","_")}function In(e,t){let n=me[e];if(n!==void 0)return n;let o=t==="include"?nt.has(e)?"<csv>":ge(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${U[t]} ${o}.`}function Nn(e){let t=tt[e],n=Object.freeze(Object.fromEntries(w.map(o=>[o,Object.freeze({dimension:o,canonical_option:U[o],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[o]??[]).map(r=>Object.freeze({flag:r,semantics:me[r]===void 0?"replacement":"behavior_preserving",migration_hint:In(r,o),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:et,budget_retention_policy:e==="assurance"?"verdict_priority":"ordered_prefix",projection_modes:Object.freeze([...ye(e).keys()])})}var Cn=Object.freeze(Ze.map(Nn)),vn=new Map(Cn.map(e=>[e.command,e]));function C(e,t={}){let n=e.trim().toLowerCase().replaceAll(/\s+/gu," "),r=n==="package catalog"||n==="packages catalog"||n==="package-catalog"||(n==="package"||n==="packages"||n==="extension")&&(t.catalog===!0||t.target==="catalog"||t.action==="catalog")?"package-catalog":n==="package manage"||n==="package-manage"?"package-manage":n.split(" ")[0],i=r.startsWith("list-")?"list":r==="ctx"?"context":r;return Ze.includes(i)?i:void 0}var Dn=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],Mn={comments:["add","body","stdin","file","edit","delete"],notes:["add","addJson","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"],"package-catalog":["activate","adopt","adoptAll","deactivate","doctor","init","install","manage","migrate","reload","scaffold","uninstall"]};function Un(e){return Dn.some(t=>e[t]!==void 0)}var Pn=[{keys:["outputInclude","output_include"],valid:e=>M(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||N(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>e==="unbounded"||N(e)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputFormat","output_format"],valid:e=>e==="toon"||e==="json",message:"--output-format must be toon or json."},{keys:["outputSession","output_session"],valid:e=>(K(e),!0),message:"--output-session must be a valid session-state object."},{keys:["outputCursor","output_cursor"],valid:e=>typeof e=="string"&&e.trim().length>0,message:"--output-cursor requires a non-empty continuation cursor."}];function Hr(e,t){if(!Un(t))return;let n=C(e,t);if(!n)throw new m(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,y.USAGE);if((Mn[n]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new m(`Universal output controls cannot be combined with a ${n} mutation.`,y.USAGE);for(let o of Pn){let r=o.keys.map(i=>t[i]).find(i=>i!==void 0);if(r!==void 0&&!o.valid(r))throw new m(o.message,y.USAGE)}}function ye(e){let t=C(e);return t?new Map((tt[t].include??[]).filter(n=>!nt.has(n)&&me[n]===void 0).map(n=>[ge(n),ot(n)])):new Map}function Ln(e,t,n){let o=M(t)??[],r=ye(e),i=[],s=[],a=n,d=a[_e],c=new Set(d?.canonical_include_modes??[]),l=new Set(d?.explicit_legacy_aliases??[]);for(let f of o){let p=r.get(f);if(p===void 0){i.push(f);continue}let h=`--${f.replaceAll("_","-")}`;it(rt(n,h))&&l.add(h),n[p]=!0,s.push(f),c.add(f)}let u=C(e)==="get"?i.filter(f=>f!=="item"):[],_=u.length>0;return _&&(n.fields=[...new Set([...M(n.fields)??[],...u])].join(","),c.add("fields")),(s.length>0||_)&&(a[_e]={canonical_include_modes:[...c],explicit_legacy_aliases:[...l],...d?.cli_invocation_observed===!0?{cli_invocation_observed:!0}:{}}),{selectors:i,modes:s}}function Zr(e,t){let n=t.outputInclude??t.output_include;if(n===void 0)return;let{selectors:o,modes:r}=Ln(e,n,t);if(r.length===0)return;let i=o.length>0?o.join(","):void 0;t.outputInclude=i,Object.hasOwn(t,"output_include")&&(t.output_include=i)}function ot(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}function rt(e,t){let n=ot(t);if(Object.hasOwn(e,n))return e[n];let o=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,o))return e[o];if(t==="--no-truncate"&&e.truncate===!1)return!0}function it(e){return e!==void 0&&e!==!1&&e!==null}function M(e){let n=(Array.isArray(e)?e:[e]).flatMap(o=>typeof o=="string"?o.split(","):[]).map(o=>o.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function N(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function jn(e,t,n,o){for(let r of e.legacy_aliases){if(o(r.flag))continue;let i=rt(t,r.flag),s={value:i,flag:r.flag};if(it(i)&&n(s))return s}}function qe(e,t){let n=M(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:M(t.value)??[ge(t.flag)]}}function Ke(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=N(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;if(t.flag==="--no-truncate"||t.flag==="--unbounded")return{source:"legacy",value:"unbounded"};let o=N(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function Ye(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=N(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;let o=N(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function Xe(e,t){if(e==="json"||e==="toon")return{source:"canonical",value:e};if(t)return t.flag==="--stream"||t.flag==="--follow"?{source:"legacy",value:"stream"}:t.value==="json"||t.value==="toon"?{source:"legacy",value:t.value}:void 0}function Fn(e,t,n){if(!e)return!1;let o=new Set(e.explicit_legacy_aliases);if(e.cli_invocation_observed===!0)return!o.has(n);let r=new Set(e.canonical_include_modes.map(i=>`--${i.replaceAll("_","-")}`));return t==="include"&&r.has(n)&&!o.has(n)}function Vn(e,t,n){return e.trim().toLowerCase().replaceAll(/\s+/gu," ").split(" ")[0]==="list-all"||t.amount?.flag==="--no-truncate"||t.include?.flag==="--full"||n?.canonical_include_modes.includes("full")===!0}function Bn(e,t){return w.flatMap(n=>e[n]?.source==="canonical"||n==="include"&&(t?.canonical_include_modes.length??0)>0?[U[n]]:[])}function st(e,t){let n=C(e,t);if(!n)return;let o=vn.get(n),r=t[_e],i={include:g=>qe(void 0,g),amount:g=>Ke(void 0,g),cost:g=>Ye(void 0,g),encoding:g=>Xe(void 0,g)},s=Object.fromEntries(w.map(g=>[g,jn(o.dimensions[g],t,E=>i[g](E)!==void 0,E=>Fn(r,g,E))])),a=w.flatMap(g=>{let E=s[g];return E?[E.flag]:[]}),d=w.flatMap(g=>{let E=s[g];return E?[o.dimensions[g].legacy_aliases.find(dt=>dt.flag===E.flag).migration_hint]:[]}),c=Xe(t.outputFormat??t.output_format,s.encoding),l=qe(t.outputInclude??t.output_include,s.include),u=Ke(t.outputLimit??t.output_limit,s.amount),_=Ye(t.outputBudget??t.output_budget,s.cost),f=Vn(e,s,r),p=Fe(e,{generateFallback:!0}),h=c?.value==="json"||t.resolvedOutputFormat==="json"?"json":"toon",be=_??(f?{source:"intent",value:"unbounded"}:{source:"default",value:p.default_max_estimated_tokens_by_format[h]});return{command:n,include:l,amount:u,cost:be,encoding:c,canonical_options_used:Bn({include:l,amount:u,cost:be,encoding:c},r),legacy_aliases_used:a,migration_hints:d,precedence:et}}function b(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var he=new Set(["applied_bound","applied_limit","completeness","continuation_kind","continuation_path","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","budget_retention_policy","row_contract","sorting","total","truncated"]),Gn=["collection_counts","notes_count","tests_count"];function at(e,t){let n=new Set(t.map(o=>o.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([o])=>n.has(o)))}function $n(e){let t=b(e.item)?e.item:{},n=[...new Set([...Object.keys(t),...Gn.filter(r=>Object.hasOwn(t,r))])].sort((r,i)=>r.localeCompare(i)),o=Object.keys(e).filter(r=>r!=="item"&&r!=="read_output"&&!he.has(r)).sort((r,i)=>r.localeCompare(i));return{item:t,itemFields:n,sections:o,valid:[...n,"item",...n.map(r=>`item.${r}`),...o]}}function zn(e,t){let n=$n(e),o=t.filter(u=>!n.valid.includes(u));if(o.length>0)throw new m(`Unknown --output-include selector(s) for get: ${o.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,y.USAGE);let r=t.includes("item"),i=t.flatMap(u=>u.startsWith("item.")?[u.slice(5)]:n.itemFields.includes(u)?[u]:[]).filter((u,_,f)=>f.indexOf(u)===_);if(r&&i.length>0)throw new m("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.",y.USAGE);let s=new Set(t.filter(u=>n.sections.includes(u))),a=Object.fromEntries(Object.entries(e).filter(([u])=>he.has(u)||s.has(u)));r?a.item=n.item:i.length>0&&(a.item=at(n.item,i));let d=[...r?[]:i.length>0?n.itemFields.filter(u=>!i.includes(u)).map(u=>({name:`item.${u}`,restore_with:`--output-include item.${u}`})):[{name:"item",restore_with:"--output-include item"}],...n.sections.filter(u=>!s.has(u)).map(u=>({name:u,restore_with:`--output-include ${u}`}))],l=[...b(a.omission_receipt)&&Array.isArray(a.omission_receipt.omitted_field_groups)?a.omission_receipt.omitted_field_groups:[],...d];return a.omission_receipt={has_omissions:l.length>0,omitted_field_group_count:l.length,omitted_field_groups:l},a}function We(e){let t=0;return v({...e},n=>(b(n)&&Object.keys(n).length>0&&(t+=1),n)),t}function qn(e,t,n,o){if(We(t)===0||We(n)>0)return;let r=[...ye(e).keys()],i=r.length>0?` Declared ${e} projection modes: ${r.join(", ")}.`:` The ${e} surface declares no projection modes; name row fields instead.`;throw new m(`Unknown --output-include selector(s) for ${e}: ${o.join(", ")}. No selector matched any returned row field.${i}`,y.USAGE)}function Kn(e,t,n){if(e==="get")return zn(t,n);let o=B(t),r=n.flatMap(s=>o.flatMap(a=>s.startsWith(`${a}.`)?[s.slice(a.length+1)]:[])),i=n.some(s=>Object.hasOwn(t,s.split(".")[0])&&!o.some(a=>s.startsWith(`${a}.`)));if(o.length>0&&(!i||r.length>0)){let s={...t},a=r.length>0?r:n,d=v(s,c=>b(c)?at(c,a):c);return qn(e,t,d,a),d}return Object.fromEntries(Object.entries(t).filter(([s])=>n.some(a=>a.split(".")[0]===s)||he.has(s)))}function Yn(e,t){if(t==="unbounded")return e;let{result:n,truncated:o}=Ce(e,t);return o&&(n.has_more=!0,n.truncated=!0,typeof n.count=="number"&&(n.count=$(n)),n.applied_bound={kind:"output_limit",source:"explicit",value:t}),n}function Xn(e){return w.filter(t=>e[t]!==void 0&&e[t]?.source!=="default"||e.canonical_options_used.includes(U[t]))}function J(e,t,n){let o=ne(e,t);for(let r=0;r<8;r+=1){let i=n.estimated_tokens,s=o.read_session.spent_this_call_tokens;A(o,n),o=ne(o,t);let a=o.read_session.spent_this_call_tokens;if(n.estimated_tokens===i&&a===s)return o}return o}function ei(e,t){if(!b(e.read_output))return e;let n=e.read_output,o=K(t.outputSession??t.output_session);return o===void 0?(A(e,n),e):J(e,o,n)}function Wn(e,t){if(e!=="validate")return t;let n=b(t.projection)?t.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(u=>b(u)&&u.name==="diagnostic_rows"))return t;let r=[...new Set(G(t).map(({path:u})=>u).filter(u=>/^checks\.\d+\.details\./u.test(u)))],i=r.filter(u=>!r.some(_=>_!==u&&u.startsWith(`${_}.`)));if(i.length===0)return t;let s=b(t.row_contract)?t.row_contract:{},a=Array.isArray(s.row_keys)?s.row_keys.filter(u=>typeof u=="string"):[],d=Array.isArray(s.continuation_row_keys)?s.continuation_row_keys.filter(u=>typeof u=="string"):[],c=a.length>0?a:i,l=[...new Set(i)];return JSON.stringify(c)===JSON.stringify(a)&&JSON.stringify(l)===JSON.stringify(d)?t:{...t,row_contract:{...s,row_keys:c,continuation_row_keys:l,jq_selector:typeof s.jq_selector=="string"?s.jq_selector:".checks[].details"}}}function Jn(e,t,n,o){let r={...e};return t.include?.source==="canonical"&&(r=Kn(t.command,r,t.include.value)),t.command==="assurance"&&(r=Qe(r)),r=He(r,t.command,o),t.amount?.source==="canonical"&&(r=Yn(r,t.amount.value)),n===void 0?r:De(r,n)}function Qn(e,t){return[...e.cost!==void 0&&e.cost.value!=="unbounded"&&(e.cost.source==="canonical"||e.cost.source==="default")?[{source:e.cost.source,tokens:e.cost.value}]:[],...t===void 0?[]:[{source:"session",tokens:Me(t)}]].sort((o,r)=>o.tokens-r.tokens)[0]}function ct(e){let t=e.canonical_options_used;return t&&t.length>0?{canonical_options_used:t}:{}}function Hn(e,t,n,o,r){let i={contract_version:1,command:e.command,requested_dimensions:t,...o.source==="default"?{budget_source:o.source,budget_tokens:o.tokens}:{},precedence:e.precedence,...ct(e),legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0,...n===void 0?{omitted_result_estimated_tokens:r}:{}},s={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:i},a=n===void 0?s:J(s,n,i);if(n===void 0&&A(a,i),n!==void 0&&i.estimated_tokens>o.tokens)throw new m("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",y.USAGE);return a}function Zn(e,t,n){if(t!==void 0)return!1;let o=e.canonical_options_used.length;return e.cost?.value==="unbounded"?o===(e.cost.source==="canonical"?1:0):e.cost?.source==="legacy"&&o===0?!0:o===0&&(e.cost===void 0||ie(n)<=e.cost.value)}function eo(e,t,n,o,r,i,s){if(!n.rows_compacted)return;let a=t.amount?.value==="unbounded"?["amount"]:[],d=new Map(x(e).map(_=>[_.path,Array.isArray(_.value)?_.value.length:Object.keys(_.value).length])),c=[...s.entries()].flatMap(([_,f])=>{let p=d.get(_);if(p>=f.rows)return[];let h=f.baseOffset+p;return[{path:_,cursor:fe({command:t.command,path:_,offset:h,total_rows:f.totalRows,fingerprint:f.fingerprint}),retained_rows:p,remaining_rows:f.totalRows-h,total_rows:f.totalRows}]}),l=c[0],u=re({effective_budget_tokens:o.tokens,measured_result_tokens:i});l&&typeof e.next_cursor!="string"&&(e.next_cursor=l.cursor),e.continuation_kind=r?"producer_cursor":l?"output_cursor":"none",e.output_budget_truncation={reason:"output_budget_reached",budget_source:o.source,budget_tokens:o.tokens,overridden_dimensions:a,compacted_row_paths:n.compacted_row_paths,continuation_cursor_rebased:r,continuation_available:c.length>0,recovery_budget_multiplier:l?1:u.recovery_budget_multiplier,continuations:c,restore_with:l?"Use recovery binding.":`Retry with --output-budget ${u.output_budget} because no declared row collection can be continued.`,recovery:l?{cursor:l.cursor,cli:"--output-cursor",sdk:"outputCursor",mcp:"outputCursor"}:{cli:`--output-budget ${u.output_budget}`,sdk:{outputBudget:u.output_budget},mcp:{outputBudget:u.output_budget}}}}function to(e,t,n,o){if(typeof n!="string"||!Array.isArray(e.items))return!1;let r=e.items.length;if(r===0||r>=t)return!1;let i;try{i=de(n)}catch{return!1}let s=i.after_index;if(s===void 0)return!1;let a=e.items.at(-1);if(Object.prototype.toString.call(a)!=="[object Object]")return!1;let d=Reflect.get(a,"id");if(typeof d!="string"||d.length===0)return!1;let c=o?s-(t-r):s+r;return c<0?!1:(e.next_cursor=ue(i.fingerprint,d,c,i.snapshot),typeof e.applied_limit=="number"&&(e.applied_limit=r),!0)}function no(e,t,n,o){let r=new Map(x(e).map(s=>{let a=Array.isArray(s.value)?s.value.length:Object.keys(s.value).length,d=n?.path===s.path;return[s.path,{rows:a,totalRows:d?n.total_rows:a,baseOffset:d?n.offset:0,fingerprint:d?n.fingerprint:W(s.path,s.value,t)}]})),i=typeof e.next_cursor=="string";return{collectionsBeforeBudget:r,originalItemCount:Array.isArray(e.items)?e.items.length:0,cursorContinuesExistingPage:i,cursorSource:i?e.next_cursor:o.after}}function oo(e,t,n,o,r,i,s){let a=t.command==="assurance"&&Array.isArray(e.assertions)?e.assertions.filter(l=>b(l)&&l.verdict!=="pass").length:0,d=Pe(e,n,o.tokens,a>0?new Map([["assertions",a]]):new Map),c=to(d,i.originalItemCount,i.cursorSource,i.cursorContinuesExistingPage);return eo(d,t,n,o,c,s,i.collectionsBeforeBudget),r!==void 0&&(d=J(d,r,n)),d}function ti(e,t,n){let o=st(e,t);if(!o)return n;let r=K(t.outputSession??t.output_session),i=t.outputCursor??t.output_cursor,s=typeof i=="string"?pe(i):void 0,a=Xn(o);if(s===void 0&&Zn(o,r,n))return n;let d=Wn(o.command,n),c=Qn(o,r),l=Jn(d,o,r,s),u=no(l,o.command,s,t),_={contract_version:1,command:o.command,requested_dimensions:a,...c?.source==="default"?{budget_source:c.source,budget_tokens:c.tokens}:{},precedence:o.precedence,...ct(o),legacy_aliases_used:o.legacy_aliases_used,migration_hints:o.migration_hints,estimated_tokens:0,within_budget:!0,strings_compacted:!1,rows_compacted:!1,result_omitted:!1};if(l.read_output=_,l=r===void 0?l:J(l,r,_),A(l,_),c!==void 0&&_.estimated_tokens>c.tokens){let f=_.estimated_tokens;l=oo(l,o,_,c,r,u,f)}return c!==void 0&&_.estimated_tokens>c.tokens?Hn(o,a,r,c,_.estimated_tokens):l}function ni(e){return b(e)&&b(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function oi(e,t){let n=st(e,t)?.encoding;return n?.value==="json"||n?.value==="toon"?n.value:void 0}(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]="9e63b4b0-09a5-50bf-9f56-5f239c75ffe5")}catch{}})();var io=4096,so=Object.freeze(["queue_draining","queue_entries","queue_exists","queue_high_retry_entries","queue_invalid_rows","queue_max_attempts","queue_rows_total","queue_size_bytes","pending_otel_spans","last_attempted_flush_at","last_failed_flush_at","last_otel_attempt_at","last_otel_failure_at","last_otel_success_at","last_successful_flush_at"]),Je=Object.freeze({health:Object.freeze({version:3,paths:Object.freeze(["checks"]),ignored_detail_field_names_by_row:Object.freeze({telemetry:so}),guarantee:"nonvolatile_snapshot_and_stable_configuration"})});function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function P(e){return Array.isArray(e)?e.map(P):L(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,P(n)])):e}function ut(e,t){if(!L(e))return P(e);let n=typeof e.name=="string"?e.name:void 0,o=n!==void 0&&Object.hasOwn(t.ignored_detail_field_names_by_row,n)?t.ignored_detail_field_names_by_row[n]:void 0;return Object.fromEntries(Object.entries(e).map(([r,i])=>r!=="details"||!o||!L(i)?[r,P(i)]:[r,Object.fromEntries(Object.entries(i).filter(([s])=>!o.includes(s)).map(([s,a])=>[s,P(a)]))]))}function ao(e,t){return Array.isArray(e)?e.map(n=>ut(n,t)):ut(e,t)}function W(e,t,n){let o=n?Je[n]:void 0,r=o?.paths.includes(e)===!0;return ro("sha256").update(X({path:e,value:r?ao(t,o):t,...r?{fingerprint_policy_version:o.version}:{}})).digest("base64url").slice(0,16)}function fe(e){return Buffer.from(JSON.stringify({v:1,c:e.command,p:e.path,o:e.offset,n:e.total_rows,f:e.fingerprint}),"utf8").toString("base64url")}function pe(e){if(e.length>io)throw new m("The read-output continuation cursor is malformed or unsupported.",y.USAGE,{code:"read_output_cursor_invalid"});let t;try{t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{t=null}if(!L(t)||t.v!==1||C(String(t.c??""))!==t.c||typeof t.p!="string"||t.p.length===0||!Number.isSafeInteger(t.o)||t.o<0||!Number.isSafeInteger(t.n)||t.n<1||typeof t.f!="string"||t.f.length===0)throw new m("The read-output continuation cursor is malformed or unsupported.",y.USAGE,{code:"read_output_cursor_invalid"});return{version:1,command:t.c,path:t.p,offset:t.o,total_rows:t.n,fingerprint:t.f}}function Qe(e){if(!Array.isArray(e.assertions))return e;let t=n=>!L(n)||n.verdict==="pass"?4:n.verdict==="retired"?3:n.enforcement==="block"?0:n.enforcement==="warn"?1:2;return{...e,assertions:e.assertions.map((n,o)=>({row:n,index:o})).sort((n,o)=>t(n.row)-t(o.row)||n.index-o.index).map(({row:n})=>n),budget_retention_policy:"verdict_priority"}}function He(e,t,n){if(!n)return e;if(n.command!==t)throw new m(`The read-output cursor belongs to ${n.command}, not ${t}.`,y.USAGE,{code:"read_output_cursor_command_mismatch"});let o=x(e).find(i=>i.path===n.path),r=o?Array.isArray(o.value)?o.value.length:Object.keys(o.value).length:0;if(!o||r!==n.total_rows||n.offset>r||W(n.path,o.value,t)!==n.fingerprint)throw new m("The read-output continuation no longer matches the declared row collection; restart the bounded read.",y.USAGE,{code:"read_output_cursor_stale"});return Ne(e,n.path,n.offset)}(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]="f6e82c93-54e8-53a7-94df-10a573aae933")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="08ee7e43-8811-57ed-8bfe-0345ee5d3308")}catch{}})();var co=Object.freeze([{flag:"--json"},{flag:"--lean"},{flag:"--token-accounting"},{flag:"--output-include",value_name:"fields"},{flag:"--output-limit",value_name:"count"},{flag:"--output-budget",value_name:"tokens"},{flag:"--output-format",value_name:"toon|json"},{flag:"--output-session",value_name:"state"},{flag:"--output-cursor",value_name:"cursor"},{flag:"--output-row-contract"},{flag:"--quiet"},{flag:"--no-changed-fields"},{flag:"--full-changed-fields"},{flag:"--id-only"},{flag:"--pm-path",aliases:["--path"]},{flag:"--no-extensions"},{flag:"--no-pager"},{flag:"--profile"},{flag:"--help"},{flag:"--author",value_name:"id"}]),gi=new Set(co.flatMap(e=>[e.flag,...e.aliases??[]]));export{Q as a,lt as b,_t as c,_o as d,Ee as e,Oe as f,Ae as g,fo as h,Se as i,we as j,Te as k,ft as l,mo as m,go as n,yo as o,ho as p,bo as q,Eo as r,Oo as s,Ao as t,So as u,wo as v,To as w,ko as x,xo as y,Ro as z,Io as A,No as B,Co as C,pt as D,vo as E,Do as F,Mo as G,Uo as H,Po as I,Lo as J,jo as K,gt as L,yt as M,ht as N,Go as O,$o as P,bt as Q,zo as R,qo as S,Ot as T,At as U,H as V,Ko as W,Yo as X,y as Y,m as Z,co as _,gi as $,X as aa,D as ba,Ir as ca,Nr as da,j as ea,Ho as fa,Zo as ga,er as ha,St as ia,wt as ja,Tt as ka,rr as la,ir as ma,kt as na,F as oa,sr as pa,ar as qa,xt as ra,Rt as sa,It as ta,Re as ua,V as va,Nt as wa,cr as xa,ur as ya,dr as za,lr as Aa,_r as Ba,fr as Ca,pr as Da,te as Ea,K as Fa,De as Ga,ne as Ha,Me as Ia,re as Ja,zt as Ka,wr as La,Le as Ma,qt as Na,en as Oa,nn as Pa,je as Qa,on as Ra,rn as Sa,Fe as Ta,se as Ua,Ve as Va,Tr as Wa,kr as Xa,Je as Ya,W as Za,fe as _a,pe as $a,Pr as ab,Lr as bb,ue as cb,de as db,le as eb,jr as fb,Rn as gb,Fr as hb,Vr as ib,w as jb,Ze as kb,Jr as lb,Qr as mb,Cn as nb,C as ob,Hr as pb,ye as qb,Ln as rb,Zr as sb,st as tb,ei as ub,ti as vb,ni as wb,oi as xb};
5
- //# sourceMappingURL=chunk-Z2USIBR2.js.map