@unbrained/pm-cli 2026.8.26 → 2026.8.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/.agents/skills/HARNESS_COMPATIBILITY.md +32 -0
  2. package/.agents/skills/README.md +47 -0
  3. package/.agents/skills/pm-developer/SKILL.md +117 -0
  4. package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +49 -0
  5. package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +91 -0
  6. package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +72 -0
  7. package/.agents/skills/pm-developer/references/PROMPTS.md +17 -0
  8. package/.agents/skills/pm-developer/references/SCRIPTING_COMPOSITION.md +82 -0
  9. package/.agents/skills/pm-developer/references/TOKEN_BUDGETS.md +85 -0
  10. package/.agents/skills/pm-extensions/SKILL.md +106 -0
  11. package/.agents/skills/pm-extensions/references/AUTHORING.md +95 -0
  12. package/.agents/skills/pm-extensions/references/LIFECYCLE.md +40 -0
  13. package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +25 -0
  14. package/.agents/skills/pm-sdk/SKILL.md +107 -0
  15. package/.agents/skills/pm-sdk/references/DOMAIN_MODELING.md +78 -0
  16. package/.agents/skills/pm-sdk/references/INTEGRATION_CHECKLIST.md +31 -0
  17. package/.agents/skills/pm-sdk/references/PROMPTS.md +13 -0
  18. package/.agents/skills/pm-sdk/references/SURFACE_MAP.md +82 -0
  19. package/.agents/skills/pm-user/SKILL.md +111 -0
  20. package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +105 -0
  21. package/.agents/skills/pm-user/references/PROMPTS.md +17 -0
  22. package/.agents/skills/pm-user/references/WORKFLOWS.md +35 -0
  23. package/.claude-plugin/marketplace.json +2 -2
  24. package/CHANGELOG.md +50 -4
  25. package/README.md +8 -5
  26. package/dist/cli/commander-usage.js +11 -7
  27. package/dist/cli/error-guidance.js +62 -8
  28. package/dist/cli/help-content.d.ts +2 -0
  29. package/dist/cli/help-content.js +53 -17
  30. package/dist/cli/help-json-payload.d.ts +8 -2
  31. package/dist/cli/help-json-payload.js +46 -12
  32. package/dist/cli/main.js +52 -74
  33. package/dist/cli/register-annotations.js +83 -60
  34. package/dist/cli/register-setup.js +98 -57
  35. package/dist/cli-bundle/bundle-manifest.json +151 -151
  36. package/dist/cli-bundle/chunks/{chunk-UKBCRPA2.js → chunk-BY2FQ2NI.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-E73FDIWT.js +3 -0
  38. package/dist/cli-bundle/chunks/{chunk-WRHJ3MB6.js → chunk-FEVBFFCQ.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-KBFP3E4E.js → chunk-M7OXRQE3.js} +66 -44
  40. package/dist/cli-bundle/chunks/{chunk-S4U76VZF.js → chunk-NBCBFVZI.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-ZNRLJ54C.js → chunk-NTXZHRKA.js} +45 -45
  42. package/dist/cli-bundle/chunks/chunk-QE6WQXFO.js +3 -0
  43. package/dist/cli-bundle/chunks/chunk-TIQ6AMH2.js +13 -0
  44. package/dist/cli-bundle/chunks/chunk-X2RROGZE.js +2 -0
  45. package/dist/cli-bundle/chunks/{chunk-E2GCFJSU.js → chunk-XRVVYRRO.js} +33 -33
  46. package/dist/cli-bundle/chunks/chunk-XWEQGHHG.js +202 -0
  47. package/dist/cli-bundle/chunks/{register-list-query-EMCPMICY.js → register-list-query-J35ZPQQ5.js} +2 -2
  48. package/dist/cli-bundle/chunks/{register-mutation-OJ67ABCB.js → register-mutation-J6XJJOGU.js} +4 -4
  49. package/dist/cli-bundle/chunks/{register-operations-H2GLP7LT.js → register-operations-AE3JEMFT.js} +2 -2
  50. package/dist/cli-bundle/chunks/register-setup-OQERLLWE.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/{chunk-72T6JGAE.js → chunk-4ZDRZYYJ.js} +43 -43
  52. package/dist/cli-bundle/focused-chunks/{chunk-OHIHZ7HS.js → chunk-6GCRSLPG.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-UYBA57GY.js → chunk-AD6ULRAF.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-FXDLT6FL.js → chunk-AHAM2HAU.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/{chunk-LV5N3LK5.js → chunk-FC2AXLB5.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-IBHXMFE7.js → chunk-HC7ODMH3.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-4K2II4TV.js → chunk-HVQ22RC4.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-MMXUPDDJ.js → chunk-JZYPPMXF.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/chunk-LLNTHF5X.js +2 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-LYFWQMVC.js +2 -0
  61. package/dist/cli-bundle/focused-chunks/{chunk-A644DUFQ.js → chunk-MEASX544.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{chunk-YO3ZF3FI.js → chunk-THEPQMLX.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{chunk-57XY346D.js → chunk-XDPYBQCF.js} +9 -9
  64. package/dist/cli-bundle/focused-chunks/{chunk-TMJDFHVD.js → chunk-Y3JJXRVK.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-66VGB23P.js → chunk-Y5A7SJJ7.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/chunk-YJLDHJOD.js +2 -0
  67. package/dist/cli-bundle/focused-chunks/{chunk-P2E6LDAE.js → chunk-YVVZ3LQ6.js} +3 -3
  68. package/dist/cli-bundle/focused-chunks/chunk-Z2USIBR2.js +5 -0
  69. package/dist/cli-bundle/main.js +15 -14
  70. package/dist/cli-bundle/sdk-authoring.js +1 -1
  71. package/dist/cli-bundle/sdk-contracts.js +2 -2
  72. package/dist/cli-bundle/sdk-core.js +31 -31
  73. package/dist/cli-bundle/sdk-governance.js +1 -1
  74. package/dist/cli-bundle/sdk-graph.js +1 -1
  75. package/dist/cli-bundle/sdk-merge.js +31 -31
  76. package/dist/cli-bundle/sdk-query.js +1 -1
  77. package/dist/cli-bundle/sdk-runtime.js +1 -1
  78. package/dist/cli-bundle/sdk-testing.js +1 -1
  79. package/dist/cli-bundle/sdk.js +32 -7
  80. package/dist/core/governance/issue-codes.d.ts +11 -2
  81. package/dist/core/governance/issue-codes.js +29 -10
  82. package/dist/core/item/item-format.js +3 -3
  83. package/dist/core/store/item-store.js +12 -5
  84. package/dist/mcp/server.js +123 -9
  85. package/dist/mcp/tool-definitions.d.ts +2 -0
  86. package/dist/mcp/tool-definitions.js +5 -5
  87. package/dist/sdk/agent/closed-domain-contracts.d.ts +1 -1
  88. package/dist/sdk/agent/closed-domain-contracts.js +24 -2
  89. package/dist/sdk/agent/command-recovery.js +3 -3
  90. package/dist/sdk/agent/task-transcript-contracts.d.ts +52 -0
  91. package/dist/sdk/agent/task-transcript-contracts.js +198 -0
  92. package/dist/sdk/agent-capability-contracts.js +6 -2
  93. package/dist/sdk/annotations.d.ts +5 -2
  94. package/dist/sdk/annotations.js +66 -36
  95. package/dist/sdk/cli-bootstrap.d.ts +2 -8
  96. package/dist/sdk/cli-bootstrap.js +7 -66
  97. package/dist/sdk/cli-contracts/bootstrap-command-scanner.d.ts +23 -0
  98. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +80 -0
  99. package/dist/sdk/cli-contracts/command-aliases.js +15 -2
  100. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -1
  101. package/dist/sdk/cli-contracts/enum-contracts.js +7 -2
  102. package/dist/sdk/cli-contracts/flag-contracts.js +12 -5
  103. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +5 -5
  104. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +3 -3
  105. package/dist/sdk/cli-contracts/grammar-contracts.js +24 -17
  106. package/dist/sdk/cli-contracts/runtime-contracts.js +13 -11
  107. package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -2
  108. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  109. package/dist/sdk/cli-contracts/tool-schema.js +32 -16
  110. package/dist/sdk/cli-contracts.d.ts +1 -1
  111. package/dist/sdk/cli-contracts.js +3 -3
  112. package/dist/sdk/cli-program.js +3 -2
  113. package/dist/sdk/comments.d.ts +4 -0
  114. package/dist/sdk/comments.js +2 -2
  115. package/dist/sdk/completion.js +47 -16
  116. package/dist/sdk/contracts.d.ts +1 -0
  117. package/dist/sdk/contracts.js +3 -2
  118. package/dist/sdk/extension/install-sources.d.ts +13 -0
  119. package/dist/sdk/extension/install-sources.js +62 -30
  120. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -2
  121. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +38 -14
  122. package/dist/sdk/governance/upgrade.d.ts +2 -0
  123. package/dist/sdk/governance/upgrade.js +30 -8
  124. package/dist/sdk/governance/validate.js +8 -6
  125. package/dist/sdk/guide-topics.js +6 -6
  126. package/dist/sdk/index.d.ts +5 -2
  127. package/dist/sdk/index.js +6 -3
  128. package/dist/sdk/learnings.d.ts +4 -0
  129. package/dist/sdk/learnings.js +7 -4
  130. package/dist/sdk/lifecycle/close.js +4 -3
  131. package/dist/sdk/mcp/apps.d.ts +70 -0
  132. package/dist/sdk/mcp/apps.js +154 -0
  133. package/dist/sdk/mcp/skills.d.ts +127 -0
  134. package/dist/sdk/mcp/skills.js +390 -0
  135. package/dist/sdk/notes.d.ts +4 -0
  136. package/dist/sdk/notes.js +2 -2
  137. package/dist/sdk/read-output-contracts.js +16 -3
  138. package/dist/sdk/runtime-action-aliases.js +7 -3
  139. package/dist/sdk/runtime-input.js +15 -4
  140. package/dist/sdk/runtime-primitives.d.ts +1 -1
  141. package/dist/sdk/runtime-primitives.js +3 -3
  142. package/dist/sdk/runtime.d.ts +6 -6
  143. package/dist/sdk/runtime.js +8 -8
  144. package/docs/CLI_GRAMMAR.md +7 -1
  145. package/docs/COMMANDS.md +5 -4
  146. package/docs/EXTENSIONS.md +33 -32
  147. package/docs/MCP_2026_07_28.md +24 -2
  148. package/docs/MCP_2026_07_28_CONFORMANCE.md +4 -4
  149. package/docs/MCP_SKILLS_AND_APPS.md +107 -0
  150. package/docs/OUTPUT_TOKEN_ACCOUNTING.md +20 -7
  151. package/docs/QUICKSTART.md +15 -15
  152. package/docs/README.md +1 -0
  153. package/docs/RELEASING.md +20 -4
  154. package/docs/SDK.md +12 -0
  155. package/docs/SDK_CONTEXT_INTEGRITY.md +18 -1
  156. package/docs/SDK_EVIDENCE_TRACEABILITY.md +9 -1
  157. package/docs/SDK_RUNTIME_BOUNDARIES.md +10 -0
  158. package/docs/TESTING.md +6 -2
  159. package/docs/agent-task-token-baseline.json +97 -11
  160. package/docs/agent-task-transcripts.json +211 -0
  161. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
  162. package/docs/generated/FLAG_LEXICON_BUDGETS.md +3 -3
  163. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -7
  164. package/docs/performance/cli-transport-overhead.md +10 -2
  165. package/marketplace.json +2 -2
  166. package/package.json +10 -8
  167. package/packages/pm-beads/README.md +12 -6
  168. package/packages/pm-beads/docs/MIGRATION.md +53 -0
  169. package/packages/pm-beads/extensions/beads/index.ts +8 -0
  170. package/packages/pm-beads/extensions/beads/runtime.ts +671 -112
  171. package/packages/pm-beads/package.json +1 -1
  172. package/packages/pm-calendar/package.json +1 -1
  173. package/packages/pm-command-kit/package.json +1 -1
  174. package/packages/pm-digital-twin/package.json +1 -1
  175. package/packages/pm-governance-audit/package.json +1 -1
  176. package/packages/pm-guide-shell/package.json +1 -1
  177. package/packages/pm-kanban/package.json +1 -1
  178. package/packages/pm-lifecycle-hooks/package.json +1 -1
  179. package/packages/pm-linked-test-adapters/package.json +1 -1
  180. package/packages/pm-search-advanced/package.json +1 -1
  181. package/packages/pm-templates/package.json +1 -1
  182. package/packages/pm-todos/package.json +1 -1
  183. package/packages/pm-vcs/package.json +1 -1
  184. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  185. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  186. package/sdk/public-surface.json +430 -36
  187. package/dist/cli-bundle/chunks/chunk-ES25LX3D.js +0 -202
  188. package/dist/cli-bundle/chunks/chunk-FRDWWB6R.js +0 -3
  189. package/dist/cli-bundle/chunks/chunk-ICQ3RVIY.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-IV64RJVE.js +0 -13
  191. package/dist/cli-bundle/chunks/chunk-MVYLQ67M.js +0 -3
  192. package/dist/cli-bundle/chunks/register-setup-GLZAHLVI.js +0 -2
  193. package/dist/cli-bundle/focused-chunks/chunk-4XNH2HM7.js +0 -2
  194. package/dist/cli-bundle/focused-chunks/chunk-7I23XGWO.js +0 -2
  195. package/dist/cli-bundle/focused-chunks/chunk-7YCDTCBC.js +0 -2
  196. package/dist/cli-bundle/focused-chunks/chunk-LMKG3DFE.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"}),lo=Object.freeze({version:lt,capabilities:[...Q],legacy_aliases:{..._t}}),Ee=["off","warn","enforce"],Oe=["off","warn","enforce"],Ae=["none","restricted","strict"],_o=["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"],po=ft,mo=["draft","open","in_progress","blocked","closed","canceled"],go=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],yo=["string","number","boolean","string_array","array","object"],ho=["create","update","update_many","list","search","calendar","context"],bo=["allow","warn","reject"],Eo=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],Oo=["project","global"],Ao=["low","medium","high","critical"],So=["low","medium","high","critical"],wo=["low","medium","high"];var To=["minimal","default","strict","custom"],xo=["none","warn","strict"],ko=["progressive","strict"],Ro=["off","warn","strict"],Io=["off","warn","strict"];var No=["daily","weekly","monthly","yearly"],pt=["mon","tue","wed","thu","fri","sat","sun"];function Co(e){return pt.indexOf(e)}var vo=["draft","research","review","approved","executing","paused","completed","superseded"],Do=["pending","in_progress","completed","blocked","skipped","superseded"],Mo=["codex","claude-code","cursor","generic"],Uo=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],Lo=["brief","standard","deep","full"],Po=["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 xe=["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",...xe,"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"}),Bo=".agents/pm",Go="settings.json";var bt=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],Et=["decisions","events","reminders","milestones","meetings","plans"],$o=[...bt,...Et],zo={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 ke(e){return e?[...e]:void 0}var qo={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:ke(e.aliases),roles:ke(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:""}}},Ko={metadata:{},body:""},g={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},Yo=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 p=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]="9afc5057-afcd-5d6c-a4c1-c2883640fc50")}catch{}})();var P=[...[["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"}))],Qo=Object.fromEntries(P.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function Ho(e){let t=e.trim().toLowerCase();return P.find(n=>n.alias===t)}function Zo(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]="3935bae8-0a40-59ea-aca6-64e238d1f318")}catch{}})();var St=[...Q],wt=[...we],Tt=[...Ee],or=[...Oe],rr=[...Ae],xt=[...Se],j=["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"],ir=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],sr=["install","reconcile","report","driver"],kt=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],Rt=["reopen"],Re={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},F=Object.freeze(j.flatMap(e=>e in Re?[]:e==="extension"||e==="package"?[...kt.map(t=>`${e}-${t}`),e]:e==="item"?Rt.map(t=>`item-${t}`):[e])),It=Object.freeze(P.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&F.includes(e.alias)).map(e=>e.alias)),ar=Object.freeze(F.filter(e=>!It.includes(e)));function cr(e=j,t=F,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 ur(e){return F.includes(e)}function dr(e){return St.includes(e)}function lr(e){return wt.includes(e)}function _r(e){return Tt.includes(e)}function fr(e){return xt.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 Nt=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=k(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 V(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 Ct(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):V(e)}function x(e){return V(e).flatMap(t=>{let n=Ie(e,t);return Array.isArray(n)||T(n)?[{path:t,value:n}]:[]})}function k(e){return Ct(e).flatMap(t=>{let n=Ie(e,t);return Array.isArray(n)||T(n)?[{path:t,value:n}]:[]})}function B(e){let t=x(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&&Nt.has(s)||o(a,i.length===0?s:`${i}.${s}`)};return o(e,""),t}function G(e){return x(e).reduce((t,n)=>t+(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length),0)}function C(e,t){let n=e;for(let o of x(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 x(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,vt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,Dt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u,Mt=new Set(["version","id","token_budget","spent_tokens","seen_item_ids"]),Ut=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&vt.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"&&Dt.test(t)),reason:`seen_item_ids must contain at most ${te} portable item identifiers.`}];function z(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function $(e){throw new p(`--output-session ${e}`,g.USAGE,{code:"invalid_read_output_session",field:"outputSession"})}function q(e){if(e===void 0)return;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{$("must be a valid JSON object.")}z(t)||$("must be a JSON object.");let n=Object.keys(t).filter(i=>!Mt.has(i));n.length>0&&$(`contains unknown field "${n.sort()[0]}".`);let o=Ut.find(i=>!i.valid(t));o!==void 0&&$(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(z(e))return typeof e.id=="string"?e.id:typeof e.item_id=="string"?e.item_id:z(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 x(e)){let r=Array.isArray(o.value)?o.value:Object.values(o.value);for(let i of r){if(!z(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 C(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(y=>!r.has(y)).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=y=>{c.spent_this_call_tokens=y,c.charged_this_call_tokens=Math.min(t.token_budget-t.spent_tokens,y),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 y=0;y<8;y+=1){u(_);let b=Math.ceil(Buffer.byteLength(JSON.stringify(l),"utf8")/4);if(b===_)return l;f=Math.max(f,b),_=b}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 Pt=8,jt=64,Ft=5,Vt=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*Ft/Vt),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 Bt(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)):Bt(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<Pt;o+=1){t.estimated_tokens=n;let r=ie(e);if(r===n)return;n=r}t.estimated_tokens=n}function Gt(e,t,n,o){for(let r=0;r<jt;r+=1){if(A(e,t),t.estimated_tokens<=n)return;let i=B(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=G(e))}}function Le(e,t,n,o=new Map){let r={compacted:!1},i=oe(e,r);return t.strings_compacted=r.compacted,i.read_output=t,Gt(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 $t=["full","compact","brief","summary","counts"],Sr=["mutation","read","discovery","governance"],Pe=["error","warning","validation_summary","recovery_bundle"],zt=["full","omit_explanation","limit_collections","compact_recovery","action_only"],qt=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"]),Kt=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),Yt=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),Xt={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},Wt=3,Jt=2,Qt=192,Ht={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},Zt=Pe.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:Ht[e],minimum_max_estimated_tokens:Qt,degradation_ladder:zt,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),en=new Map(Zt.map(e=>[e.diagnostic_class,e]));function tn(e){let[t=""]=e.trim().split(/\s+/u);return qt.has(t)?"mutation":Kt.has(t)?"discovery":Yt.has(t)?"governance":"read"}function je(e,t=tn(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=Xt[t];return nn({command:n,budget_class:t,default_max_estimated_tokens:o,default_max_estimated_tokens_by_format:{toon:o,json:Math.ceil(o*Wt/Jt)},degradation_ladder:$t,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function nn(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 on=j.map(e=>je(e)),rn=new Map(on.map(e=>[e.command,e]));function Fe(e,t={}){let n=e.trim().replace(/\s+/gu," "),[o]=n.split(" "),r=rn.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=en.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${Pe.join(", ")}`);return t}function O(e){return se(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function sn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ae(e){if(!sn(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 an(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 cn=new Set(["limit_collections","compact_recovery","action_only"]),un=new Set(["compact_recovery","action_only"]);function dn(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:an(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 ln(e,t){let n=structuredClone(e);if(t!=="full"&&(delete n.why,delete n.examples),cn.has(t))for(let[o,r]of Object.entries(n))Array.isArray(r)&&(n[o]=r.slice(0,3));if(un.has(t)){let o=ae(n.recovery);o?n.recovery=o:delete n.recovery}return t!=="action_only"?Be(n):dn(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 _n(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 fn(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=_n(c,s,t),l}function wr(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 _=ln(n,u),f=d.filter(b=>!Object.hasOwn(_,b)),y=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=y,O(y)<=s)break}return O(c)>s&&(c=fn(c,s)),c}function Tr(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 oo}from"node:crypto";import pn 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 mn(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 gn(e){let t=Object.keys(e).sort(),n={};for(let o of t){let r=e[o];r!==void 0&&(n[o]=K(r))}return n}function K(e){let t=mn(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(o=>K(o));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let o=n.toJSON();if(o!==e)return K(o)}return gn(e)}function Y(e){return JSON.stringify(K(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 yn(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function hn(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function bn(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,v))return!1;return!0}function En(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])=>v(a,c)&&v(d,l)))return!1;return!0}function On(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)=>v(n,t[o]))}function An(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]||!v(e[i],t[i]))return!1}return!0}var Sn=[yn,hn,bn,En,On];function v(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 Sn){let o=n(e,t);if(o!==void 0)return o}return An(e,t)}function Rr(e){return pn.createHash("sha256").update(e,"utf8").digest("hex")}function Ir(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 wn}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,Tn=/^[A-Za-z0-9_-]+$/;function $e(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function Ur(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 wn("sha256").update(e).update("\0").update(Y(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 p(e,g.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||!Tn.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 Pr(e,t){return le(e,t).after_id}function kn(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 jr(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=kn(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 Fr=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]="d084da05-c967-58f1-afe4-069f09838e6f")}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"],D={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},_e=Symbol.for("pm.readOutputInvocationProvenance"),Wr=Object.freeze(w.map(e=>D[e])),Jr=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 Rn(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 ${D[t]} ${o}.`}function In(e){let t=tt[e],n=Object.freeze(Object.fromEntries(w.map(o=>[o,Object.freeze({dimension:o,canonical_option:D[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:Rn(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 Nn=Object.freeze(Ze.map(In)),Cn=new Map(Nn.map(e=>[e.command,e]));function M(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 vn=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],Dn={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 Mn(e){return vn.some(t=>e[t]!==void 0)}var Un=[{keys:["outputInclude","output_include"],valid:e=>X(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=>(q(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 Qr(e,t){if(!Mn(t))return;let n=M(e,t);if(!n)throw new p(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,g.USAGE);if((Dn[n]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new p(`Universal output controls cannot be combined with a ${n} mutation.`,g.USAGE);for(let o of Un){let r=o.keys.map(i=>t[i]).find(i=>i!==void 0);if(r!==void 0&&!o.valid(r))throw new p(o.message,g.USAGE)}}function ye(e){let t=M(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=X(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 u of o){let _=r.get(u);if(_===void 0){i.push(u);continue}let f=`--${u.replaceAll("_","-")}`;it(rt(n,f))&&l.add(f),n[_]=!0,s.push(u),c.add(u)}return 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 Hr(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 X(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 Pn(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=X(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:X(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 jn(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 Fn(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 Vn(e,t){return w.flatMap(n=>e[n]?.source==="canonical"||n==="include"&&(t?.canonical_include_modes.length??0)>0?[D[n]]:[])}function st(e,t){let n=M(e,t);if(!n)return;let o=Cn.get(n),r=t[_e],i={include:m=>qe(void 0,m),amount:m=>Ke(void 0,m),cost:m=>Ye(void 0,m),encoding:m=>Xe(void 0,m)},s=Object.fromEntries(w.map(m=>[m,Pn(o.dimensions[m],t,E=>i[m](E)!==void 0,E=>jn(r,m,E))])),a=w.flatMap(m=>{let E=s[m];return E?[E.flag]:[]}),d=w.flatMap(m=>{let E=s[m];return E?[o.dimensions[m].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=Fn(e,s,r),y=Fe(e,{generateFallback:!0}),b=c?.value==="json"||t.resolvedOutputFormat==="json"?"json":"toon",be=_??(f?{source:"intent",value:"unbounded"}:{source:"default",value:y.default_max_estimated_tokens_by_format[b]});return{command:n,include:l,amount:u,cost:be,encoding:c,canonical_options_used:Vn({include:l,amount:u,cost:be,encoding:c},r),legacy_aliases_used:a,migration_hints:d,precedence:et}}function h(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"]),Bn=["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 Gn(e){let t=h(e.item)?e.item:{},n=[...new Set([...Object.keys(t),...Bn.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 $n(e,t){let n=Gn(e),o=t.filter(u=>!n.valid.includes(u));if(o.length>0)throw new p(`Unknown --output-include selector(s) for get: ${o.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,g.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 p("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.",g.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=[...h(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 C({...e},n=>(h(n)&&Object.keys(n).length>0&&(t+=1),n)),t}function zn(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 p(`Unknown --output-include selector(s) for ${e}: ${o.join(", ")}. No selector matched any returned row field.${i}`,g.USAGE)}function qn(e,t,n){if(e==="get")return $n(t,n);let o=V(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=C(s,c=>h(c)?at(c,a):c);return zn(e,t,d,a),d}return Object.fromEntries(Object.entries(t).filter(([s])=>n.some(a=>a.split(".")[0]===s)||he.has(s)))}function Kn(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=G(n)),n.applied_bound={kind:"output_limit",source:"explicit",value:t}),n}function Yn(e){return w.filter(t=>e[t]!==void 0&&e[t]?.source!=="default"||e.canonical_options_used.includes(D[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 Zr(e,t){if(!h(e.read_output))return e;let n=e.read_output,o=q(t.outputSession??t.output_session);return o===void 0?(A(e,n),e):J(e,o,n)}function Xn(e,t){if(e!=="validate")return t;let n=h(t.projection)?t.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(u=>h(u)&&u.name==="diagnostic_rows"))return t;let r=[...new Set(B(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=h(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 Wn(e,t,n,o){let r={...e};return t.include?.source==="canonical"&&(r=qn(t.command,r,t.include.value)),t.command==="assurance"&&(r=Qe(r)),r=He(r,t.command,o),t.amount?.source==="canonical"&&(r=Kn(r,t.amount.value)),n===void 0?r:De(r,n)}function Jn(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 Qn(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 p("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",g.USAGE);return a}function Hn(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 Zn(e,t,n,o,r,i,s){if(!n.rows_compacted)return;let a=t.amount?.value==="unbounded"?["amount"]:[],d=new Map(k(e).map(_=>[_.path,Array.isArray(_.value)?_.value.length:Object.keys(_.value).length])),c=[...s.entries()].flatMap(([_,f])=>{let y=d.get(_);if(y>=f.rows)return[];let b=f.baseOffset+y;return[{path:_,cursor:fe({command:t.command,path:_,offset:b,total_rows:f.totalRows,fingerprint:f.fingerprint}),retained_rows:y,remaining_rows:f.totalRows-b,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 eo(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 to(e,t,n,o){let r=new Map(k(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 no(e,t,n,o,r,i,s){let a=t.command==="assurance"&&Array.isArray(e.assertions)?e.assertions.filter(l=>h(l)&&l.verdict!=="pass").length:0,d=Le(e,n,o.tokens,a>0?new Map([["assertions",a]]):new Map),c=eo(d,i.originalItemCount,i.cursorSource,i.cursorContinuesExistingPage);return Zn(d,t,n,o,c,s,i.collectionsBeforeBudget),r!==void 0&&(d=J(d,r,n)),d}function ei(e,t,n){let o=st(e,t);if(!o)return n;let r=q(t.outputSession??t.output_session),i=t.outputCursor??t.output_cursor,s=typeof i=="string"?pe(i):void 0,a=Yn(o);if(s===void 0&&Hn(o,r,n))return n;let d=Xn(o.command,n),c=Jn(o,r),l=Wn(d,o,r,s),u=to(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=no(l,o,_,c,r,u,f)}return c!==void 0&&_.estimated_tokens>c.tokens?Qn(o,a,r,c,_.estimated_tokens):l}function ti(e){return h(e)&&h(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function ni(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 ro=4096,io=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:io}),guarantee:"nonvolatile_snapshot_and_stable_configuration"})});function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function U(e){return Array.isArray(e)?e.map(U):L(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,U(n)])):e}function ut(e,t){if(!L(e))return U(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,U(i)]:[r,Object.fromEntries(Object.entries(i).filter(([s])=>!o.includes(s)).map(([s,a])=>[s,U(a)]))]))}function so(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 oo("sha256").update(Y({path:e,value:r?so(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>ro)throw new p("The read-output continuation cursor is malformed or unsupported.",g.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||M(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 p("The read-output continuation cursor is malformed or unsupported.",g.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 p(`The read-output cursor belongs to ${n.command}, not ${t}.`,g.USAGE,{code:"read_output_cursor_command_mismatch"});let o=k(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 p("The read-output continuation no longer matches the declared row collection; restart the bounded read.",g.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 ao=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"}]),mi=new Set(ao.flatMap(e=>[e.flag,...e.aliases??[]]));export{Q as a,lt as b,_t as c,lo as d,Ee as e,Oe as f,Ae as g,_o as h,Se as i,we as j,Te as k,ft as l,po as m,mo as n,go as o,yo as p,ho as q,bo as r,Eo as s,Oo as t,Ao as u,So as v,wo as w,To as x,xo as y,ko as z,Ro as A,Io as B,No as C,pt as D,Co as E,vo as F,Do as G,Mo as H,Uo as I,Lo as J,Po as K,gt as L,yt as M,ht as N,Bo as O,Go as P,bt as Q,$o as R,zo as S,Ot as T,At as U,H as V,qo as W,Ko as X,g as Y,p as Z,ao as _,mi as $,Y as aa,v as ba,Rr as ca,Ir as da,P as ea,Qo as fa,Ho as ga,Zo as ha,St as ia,wt as ja,Tt as ka,or as la,rr as ma,xt as na,j as oa,ir as pa,sr as qa,kt as ra,Rt as sa,Re as ta,F as ua,It as va,ar as wa,cr as xa,ur as ya,dr as za,lr as Aa,_r as Ba,fr as Ca,te as Da,q as Ea,De as Fa,ne as Ga,Me as Ha,re as Ia,$t as Ja,Sr as Ka,Pe as La,zt as Ma,Zt as Na,tn as Oa,je as Pa,nn as Qa,on as Ra,Fe as Sa,se as Ta,Ve as Ua,wr as Va,Tr as Wa,Je as Xa,W as Ya,fe as Za,pe as _a,Ur as $a,Lr as ab,ue as bb,de as cb,le as db,Pr as eb,kn as fb,jr as gb,Fr as hb,w as ib,Ze as jb,Wr as kb,Jr as lb,Nn as mb,M as nb,Qr as ob,ye as pb,Ln as qb,Hr as rb,st as sb,Zr as tb,ei as ub,ti as vb,ni as wb};
5
- //# sourceMappingURL=chunk-LMKG3DFE.js.map