@unbrained/pm-cli 2026.9.28 → 2026.9.29
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.
- package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +7 -6
- package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +1 -1
- package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +26 -3
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +17 -0
- package/dist/cli/error-guidance.js +1 -1
- package/dist/cli/help-json-payload.js +2 -2
- package/dist/cli/main.js +2 -2
- package/dist/cli/runtime/invocation-options.d.ts +3 -1
- package/dist/cli/runtime/invocation-options.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +153 -153
- package/dist/cli-bundle/chunks/{chunk-OYCCWPBM.js → chunk-2AQKVJMW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UT7GRGHY.js → chunk-4DOL43PF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GLH2LNRH.js → chunk-5KEPG36D.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YERBAGQD.js → chunk-D32HVIB2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-A2G5OG6W.js → chunk-GP6QTYSD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CPOWTIIS.js → chunk-OTLIM22J.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PLNNUAFZ.js → chunk-P75SO5HO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PR4UAMI5.js → chunk-PJSQAWWQ.js} +60 -60
- package/dist/cli-bundle/chunks/{chunk-VMJLM7P2.js → chunk-S5A2UIRV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZFHJP7YD.js → chunk-SC6JHXFT.js} +31 -29
- package/dist/cli-bundle/chunks/{chunk-NBDB3SRC.js → chunk-SEJ53XDN.js} +48 -48
- package/dist/cli-bundle/chunks/{chunk-35DME35A.js → chunk-SJI55O65.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NEUIVBFO.js → chunk-U3QJGJYN.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-N6RP6PSP.js → register-list-query-R3ELWWPY.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-CY7JGQE6.js → register-mutation-WHXJXIHJ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-53HAD3QP.js → register-operations-7ASWBYQG.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-NVX6374E.js → register-setup-FDRTUG54.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YZB7IPR6.js → chunk-2O3QFI3G.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y5Z3XNGY.js → chunk-4A4DO5ZT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-K7GSZ7YZ.js → chunk-5MC57KRC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IWLMQLBO.js → chunk-6OXJVE74.js} +17 -17
- package/dist/cli-bundle/focused-chunks/{chunk-6IVQPNYN.js → chunk-7URX7FMY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5KJXX2TZ.js → chunk-AVP5C674.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DTLRXY77.js → chunk-AZE7KUHG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-V7OPZRL6.js → chunk-DZVOCJFY.js} +14 -14
- package/dist/cli-bundle/focused-chunks/{chunk-AZA4AEOR.js → chunk-FBIRNSYP.js} +6 -6
- package/dist/cli-bundle/focused-chunks/{chunk-A5O3VYWV.js → chunk-IFBA3ZAT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ONDNR3VU.js → chunk-K3AIMRIK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZMQTIS3L.js → chunk-KLKKCHWM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BRLXKRI2.js → chunk-MRH4A542.js} +4 -4
- package/dist/cli-bundle/focused-chunks/{chunk-IJXZQE3D.js → chunk-NXQZMKW5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BGWF6CMP.js → chunk-NY6FLQTN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-OVVCXTIE.js → chunk-T4H6Q44B.js} +2 -2
- package/dist/cli-bundle/main.js +22 -22
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +22 -21
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +28 -28
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -2
- package/dist/core/history/replay.js +1 -1
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/telemetry/runtime.js +2 -2
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/lifecycle/plan-mutation-receipt.d.ts +53 -0
- package/dist/sdk/lifecycle/plan-mutation-receipt.js +2 -0
- package/dist/sdk/lifecycle/plan.d.ts +3 -0
- package/dist/sdk/lifecycle/plan.js +1 -1
- package/dist/sdk/linked-artifacts.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/runtime/actions.js +1 -1
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/similarity-scoring.js +1 -1
- package/dist/sdk/telemetry.d.ts +2 -0
- package/dist/sdk/telemetry.js +3 -1
- package/docs/CLI_GRAMMAR.md +18 -1
- package/docs/ECOSYSTEM_PLANNING_REVIEW.md +270 -0
- package/docs/README.md +1 -0
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +34 -0
- package/docs/agent-task-token-baseline.json +28 -2
- package/docs/agent-task-transcripts.json +137 -14
- package/docs/ecosystem-review-2026-09-28.json +3159 -0
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
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]="9ddd9ea4-8586-5d3d-9ed8-0bf9da49b9a5")}catch{}})();var B=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],mt=2,an=Object.freeze({migration:"schema",validation:"schema"}),E_=Object.freeze({version:mt,capabilities:[...B],legacy_aliases:{...an}}),pt=["off","warn","enforce"],_t=["off","warn","enforce"],gt=["none","restricted","strict"],Lr=["block","warn"],yt=["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"],Oe=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function ht(){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]="e33ee377-aae0-5158-9af6-e6081287a85b")}catch{}})();var La=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],jr=La,O_=["draft","open","in_progress","blocked","closed","canceled"],A_=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],Fr=["string","number","boolean","string_array","array","object"],S_=["create","update","update_many","list","search","calendar","context"],C_=["allow","warn","reject"],T_=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],I_=["project","global"],R_=["low","medium","high","critical"],x_=["low","medium","high","critical"],N_=["low","medium","high"];var D_=["minimal","default","strict","custom"],P_=["none","warn","strict"],M_=["progressive","strict"],$_=["off","warn","strict"],L_=["off","warn","strict"];var j_=["daily","weekly","monthly","yearly"],ja=["mon","tue","wed","thu","fri","sat","sun"];function F_(e){return ja.indexOf(e)}var U_=["draft","research","review","approved","executing","paused","completed","superseded"],z_=["pending","in_progress","completed","blocked","skipped","superseded"],q_=["codex","claude-code","cursor","generic"],B_=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],V_=["brief","standard","deep","full"],W_=["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]="89d6c349-10d7-596d-90a1-65afcc65eb91")}catch{}})();var Ur=["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"],Fa=["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",...Ur,"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"],Ua=Fa;(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]="6e329ab1-f22d-5749-b8a4-0a6e7a1c8023")}catch{}})();var za=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"]}]),qa=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),bt=".agents/pm",wt="settings.json";var Ba=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],Va=["decisions","events","reminders","milestones","meetings","plans"],X_=[...Ba,...Va],Ue={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},Wa={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}},Ga=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],cn={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 zr(e){return e?[...e]:void 0}var J_={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:[...Ga],lifecycle_closure_like_blocked_reason_patterns:[...cn.blocked_reason],lifecycle_closure_like_resolution_patterns:[...cn.resolution],lifecycle_closure_like_actual_result_patterns:[...cn.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...Wa.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:za.map(e=>({...e,aliases:zr(e.aliases),roles:zr(e.roles)})),fields:[],workflow:{...qa},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:ht()},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:"",default_mode:"auto",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:""}}},Q_={metadata:{},body:""},y={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},Z_=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]="c3a7c240-7575-5db7-98fa-9dd010c9ff7d")}catch{}})();var h=class extends Error{exitCode;code;context;constructor(t,n,r={}){super(t),this.name="PmCliError",this.exitCode=n,this.context=r,this.code=r.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]="9961b408-ad70-5556-84dd-5ca1b1497c27")}catch{}})();var Ka=new Set(["name","version","entry","priority","description","author","capabilities","manifest_version","pm_min_version","pm_max_version","engines","trusted","provenance","sandbox_profile","permissions","activation","contributions","legacy_capability_aliases"]);function Ha(e){return{unknownKeys:Object.keys(e).filter(t=>!Ka.has(t)).sort((t,n)=>t>n?1:-1),missingVersionBounds:e.pm_min_version===void 0&&e.pm_max_version===void 0}}function Ya(e){let t=Ha(e),n=t.unknownKeys.map(r=>({code:"manifest_unknown_key",path:r,...r==="compatibility"?{suggested_key:"pm_min_version"}:{},message:r==="compatibility"?'Manifest key "compatibility" is ignored; declare the canonical pm_min_version and optional pm_max_version fields instead.':`Manifest key "${r}" is not part of the extension manifest contract and will be ignored.`}));return t.missingVersionBounds&&n.push({code:"no_version_bounds_declared",path:"$",suggested_key:"pm_min_version",message:"No canonical pm version bounds are declared; add pm_min_version so compatibility intent is explicit."}),{ok:n.length===0,findings:n}}function qr(e,t,n){return Ya(n).findings.map(r=>r.code==="manifest_unknown_key"?`extension_manifest_unknown_key:${e}:${t.name}:key=${r.path}${r.suggested_key?`:suggested=${r.suggested_key}`:""}`:`extension_manifest_no_version_bounds:${e}:${t.name}:suggested=pm_min_version`)}(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]="4c00e38a-27df-5315-91e8-d35c03ed6bf3")}catch{}})();var dn=[{kind:"blocked_by",direction:"directed",traversal:"ordering",inverse:"blocks",ordering:!0,precedence:"target_before_source",hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",aliases:["depends_on"],compatibilityVersion:1,allowSelf:!1},{kind:"blocks",direction:"directed",traversal:"ordering",inverse:"blocked_by",ordering:!0,precedence:"source_before_target",hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"parent",direction:"directed",traversal:"hierarchy",outcomeTraversal:"source_to_target",inverse:"child",ordering:!1,hierarchy:!0,hierarchyDirection:"target_parent",outgoing:"one",incoming:"many",lifecycle:"supersedable",aliases:["child_of","epic"],compatibilityVersion:1,allowSelf:!1},{kind:"child",direction:"directed",traversal:"hierarchy",outcomeTraversal:"target_to_source",inverse:"parent",ordering:!1,hierarchy:!0,hierarchyDirection:"source_parent",outgoing:"many",incoming:"one",lifecycle:"supersedable",aliases:["parent_child","task"],compatibilityVersion:1,allowSelf:!1},{kind:"related",direction:"undirected",traversal:"association",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",aliases:["related_to"],compatibilityVersion:1,allowSelf:!1},{kind:"discovered_from",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"incident_from",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"implements",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"recurs_from",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,temporalOrder:"source_after_target",hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"verifies",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"supersedes",direction:"directed",traversal:"semantic",outcomeTraversal:"both",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"supersedable",compatibilityVersion:1,allowSelf:!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]="b658dc99-fdbb-5d10-9dd6-5f5c263bf48b")}catch{}})();function kt(e){return e.trim().toLowerCase().replaceAll("-","_")}function Xa(e){if(e===void 0)return;let t=kt(e);if(!/^[a-z][a-z0-9_]*$/.test(t))throw new TypeError(`Invalid inverse relationship kind: ${e}`);return t}function un(e,t=new Set){if(e===null||typeof e!="object"||t.has(e))return e;if(t.add(e),Array.isArray(e)){for(let n of e)un(n,t);return Object.freeze(e)}for(let n of Object.values(e))un(n,t);return Object.freeze(e)}function Ja(e,t){if(e.precedence!==void 0&&e.precedence!=="source_before_target"&&e.precedence!=="target_before_source")throw new TypeError(`Invalid relationship precedence for ${t}`);if(!e.ordering&&e.precedence!==void 0)throw new TypeError(`Non-ordering relationship kind cannot declare precedence: ${t}`)}function Qa(e,t){if(e.temporalOrder!==void 0&&e.temporalOrder!=="source_after_target")throw new TypeError(`Invalid relationship temporal order for ${t}`);if(e.direction!=="directed"&&e.temporalOrder!==void 0)throw new TypeError(`Undirected relationship kind cannot declare temporal order: ${t}`)}function Za(e,t){if(e.hierarchyDirection!==void 0&&e.hierarchyDirection!=="source_parent"&&e.hierarchyDirection!=="target_parent")throw new TypeError(`Invalid relationship hierarchy direction for ${t}`);if(!e.hierarchy&&e.hierarchyDirection!==void 0)throw new TypeError(`Non-hierarchy relationship kind cannot declare hierarchy direction: ${t}`)}function ec(e){if(typeof e!="object"||e===null)throw new TypeError("Relationship kind definition requires an object");if(typeof e.kind!="string")throw new TypeError("Relationship kind requires a string identifier");let t=kt(e.kind);if(!/^[a-z][a-z0-9_]*$/.test(t))throw new TypeError(`Invalid relationship kind: ${e.kind}`);if(!Number.isInteger(e.compatibilityVersion)||e.compatibilityVersion<1)throw new TypeError(`Invalid compatibility version for ${t}`);return t}function tc(e,t){if(!["directed","undirected"].includes(e.direction))throw new TypeError(`Invalid relationship direction for ${t}`);if(typeof e.ordering!="boolean")throw new TypeError(`Invalid relationship ordering flag for ${t}`);if(![void 0,!0,!1].includes(e.hierarchy))throw new TypeError(`Invalid relationship hierarchy flag for ${t}`);if(!["one","many"].includes(e.outgoing))throw new TypeError(`Invalid outgoing relationship cardinality for ${t}`);if(!["one","many"].includes(e.incoming))throw new TypeError(`Invalid incoming relationship cardinality for ${t}`);if(!["persistent","supersedable","ephemeral"].includes(e.lifecycle))throw new TypeError(`Invalid relationship lifecycle for ${t}`);if(typeof e.allowSelf!="boolean")throw new TypeError(`Invalid relationship self-edge flag for ${t}`);if(e.traversal!==void 0&&!["hierarchy","ordering","semantic","association"].includes(e.traversal))throw new TypeError(`Invalid relationship traversal family for ${t}`);if(e.outcomeTraversal!==void 0&&!["source_to_target","target_to_source","both"].includes(e.outcomeTraversal))throw new TypeError(`Invalid outcome traversal for ${t}`);if(e.direction==="undirected"&&e.outcomeTraversal!==void 0&&e.outcomeTraversal!=="both")throw new TypeError(`Undirected relationship kind cannot declare directional outcome traversal: ${t}`)}function nc(e,t){if(e.payloadSchema!==void 0&&(typeof e.payloadSchema!="object"||e.payloadSchema===null||Array.isArray(e.payloadSchema)))throw new TypeError(`Invalid relationship payload schema for ${t}`);if(e.aliases!==void 0&&(!Array.isArray(e.aliases)||e.aliases.some(n=>typeof n!="string")))throw new TypeError(`Invalid relationship aliases for ${t}`)}function rc(e){return e.traversal?e.traversal:e.ordering?"ordering":e.hierarchy?"hierarchy":e.direction==="undirected"?"association":"semantic"}var fn=class{#e=new Map;#n=new Map;constructor(t=dn){for(let n of t)this.register(n)}register(t){let n=ec(t);if(tc(t,n),nc(t,n),Ja(t,n),Qa(t,n),Za(t,n),this.#e.has(n)||this.#n.has(n))throw new TypeError(`Relationship kind already registered: ${n}`);let r=Xa(t.inverse),o=[...new Set((t.aliases??[]).map(kt))].sort();for(let s of o){if(!/^[a-z][a-z0-9_]*$/.test(s))throw new TypeError(`Invalid relationship alias: ${s}`);if(s===n||this.#e.has(s)||this.#n.has(s))throw new TypeError(`Relationship alias already registered: ${s}`)}let i=Object.freeze({...t,kind:n,traversal:rc(t),hierarchy:t.hierarchy??!1,hierarchyDirection:t.hierarchy?t.hierarchyDirection??"source_parent":void 0,inverse:r,aliases:Object.freeze(o),payloadSchema:t.payloadSchema?un(structuredClone(t.payloadSchema)):void 0});this.#e.set(n,i);for(let s of o)this.#n.set(s,n);return this}resolve(t){if(typeof t!="string")return;let n=kt(t);return this.#e.get(this.#n.get(n)??n)}require(t){let n=this.resolve(t);if(!n)throw new TypeError(`Unknown relationship kind: ${t}`);return n}list(){return Object.freeze([...this.#e.values()].sort((t,n)=>t.kind.localeCompare(n.kind)))}};function mn(){return new fn}var ce=mn();function sg(e){return ce.require(e).kind}function ag(e){return ce.resolve(e)?.kind}function cg(e,t=ce){return t.resolve(e)?.ordering===!0}function oc(e,t,n,r=ce){let o=ze(e),i=ze(t);if(!o||!i)throw new TypeError("Relationship endpoint must not be empty");let s=r.require(n);if(o===i&&!s.allowSelf)throw new TypeError(`Self relationship is not allowed for ${s.kind}`);return s}function vt(e,t){return e.source.localeCompare(t.source)||e.target.localeCompare(t.target)||e.kind.localeCompare(t.kind)}function ic(e,t,n){let r=typeof e.source=="string"?e.source.trim():"",o=typeof e.target=="string"?e.target.trim():"";if(!t.has(r)||!t.has(o))throw new TypeError(`Relationship endpoint not found: ${r} -> ${o}`);let i=oc(r,o,e.kind,n),s=Object.freeze({...e,source:r,target:o,kind:i.kind}),a=i.direction==="undirected"?[r,o].sort().join("\0"):`${r}\0${o}`;return{edge:s,identity:`${i.kind}\0${a}`}}function Et(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function ze(e){return typeof e=="string"?e.trim():""}function ln(e,t){let n=ze(e);return n&&t.has(n)?n:void 0}function sc(e,t,n){let r=[t],o=t;for(;o!==e;)o=n.get(o),r.push(o);return r.reverse()}var Br=class e{#e;#n;#o;#r;#s=new Map;#a=new Map;constructor(t,n,r=ce){this.#e=r,this.#n=new Set([...t].filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean)),this.#o=Object.freeze([...this.#n].sort());let o=new Map;for(let i of n){let{edge:s,identity:a}=ic(i,this.#n,r);o.set(a,s)}this.#r=Object.freeze([...o.values()].sort(vt));for(let i of this.#r)Et(this.#s,i.source,i),Et(this.#a,i.target,i),r.require(i.kind).direction==="undirected"&&(Et(this.#s,i.target,i),Et(this.#a,i.source,i))}static fromItems(t,n=ce){let r=new Set(t.map(i=>ze(i.id)).filter(Boolean)),o=[];for(let i of t){let s=ze(i.id);if(!s)continue;let a=ln(i.parent,r);a&&o.push({source:s,target:a,kind:"parent"});let c=ln(i.blocked_by,r);c&&o.push({source:s,target:c,kind:"blocked_by"});for(let d of i.dependencies??[]){let l=ln(d.id,r);l&&n.resolve(d.kind)&&o.push({source:s,target:l,kind:d.kind,createdAt:d.created_at,author:d.author})}}return new e(r,o,n)}edges(){return this.#r}incidentEdges(t){this.#i(t);let n=this.#s.get(t)??[],r=this.#a.get(t)??[];if(n.length===0)return Object.freeze([...r]);if(r.length===0)return Object.freeze([...n]);let o=[],i=0,s=0;for(;i<n.length||s<r.length;){let a=n[i],c=r[s],d=a===void 0?c:c===void 0||vt(a,c)<=0?a:c;o.at(-1)!==d&&o.push(d),a===d&&(i+=1),c===d&&(s+=1)}return Object.freeze(o)}nodes(){return this.#o}hasNode(t){return this.#n.has(t)}registry(){return this.#e}#i(t){if(!this.#n.has(t))throw new TypeError(`Relationship node not found: ${t}`)}#c(t,n){if(!n)return!0;let r=this.#e.require(t.kind);return n.has(t.kind)||r.inverse!==void 0&&n.has(r.inverse)}#t(t,n,r){let o=[...n==="incoming"?[]:this.#s.get(t)??[],...n==="outgoing"?[]:this.#a.get(t)??[]];return[...new Set(o)].filter(i=>this.#c(i,r)).map(i=>({id:i.source===t?i.target:i.source,edge:i})).sort((i,s)=>i.id.localeCompare(s.id)||vt(i.edge,s.edge))}adjacency(t,n={}){this.#i(t),n.signal?.throwIfAborted();let r=n.kinds?new Set(n.kinds.map(c=>this.#e.require(c).kind)):void 0,o=this.#t(t,n.direction??"outgoing",r),i=n.limit??Number.POSITIVE_INFINITY,s=[...new Set(o.map(c=>c.id))],a=s.slice(0,i);return{value:a,meta:{visitedNodes:1,inspectedEdges:o.length,truncated:a.length<s.length,nextCursor:a.at(-1)}}}neighborEdges(t,n={}){this.#i(t),n.signal?.throwIfAborted();let r=n.kinds?new Set(n.kinds.map(a=>this.#e.require(a).kind)):void 0,o=this.#t(t,n.direction??"outgoing",r),i=n.limit??Number.POSITIVE_INFINITY,s=o.slice(0,i);return{value:s,meta:{visitedNodes:1,inspectedEdges:o.length,truncated:s.length<o.length,nextCursor:s.at(-1)?.id}}}closure(t,n={}){this.#i(t);let r=n.kinds?new Set(n.kinds.map(m=>this.#e.require(m).kind)):void 0,o=n.direction??"outgoing",i=n.limit??Number.POSITIVE_INFINITY,s=n.maxDepth??Number.POSITIVE_INFINITY,a=new Set([t]),c=[],d=[{id:t,depth:0}],l=0,u=0,f=!1;e:for(let m=0;m<d.length;m+=1){n.signal?.throwIfAborted();let p=d[m];l+=1;let _=this.#t(p.id,o,r);if(u+=_.length,p.depth>=s){_.some(g=>!a.has(g.id))&&(f=!0);continue}for(let g of _)if(!a.has(g.id)){if(c.length>=i){f=!0;break e}a.add(g.id),c.push(g.id),d.push({id:g.id,depth:p.depth+1})}}return{value:c,meta:{visitedNodes:l,inspectedEdges:u,truncated:f,nextCursor:c.at(-1)}}}shortestPath(t,n,r={}){if(this.#i(t),this.#i(n),t===n)return{value:[t],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}};let o=r.kinds?new Set(r.kinds.map(m=>this.#e.require(m).kind)):void 0,i=r.direction??"outgoing",s=r.maxDepth??Number.POSITIVE_INFINITY,a=[{id:t,depth:0}],c=new Map,d=new Set([t]),l=0,u=0,f=!1;for(let m=0;m<a.length;m+=1){r.signal?.throwIfAborted();let p=a[m];l+=1;let _=this.#t(p.id,i,o);if(u+=_.length,p.depth>=s){_.some(g=>!d.has(g.id))&&(f=!0);continue}for(let g of _)if(!d.has(g.id)){if(c.set(g.id,p.id),g.id===n)return{value:sc(t,n,c),meta:{visitedNodes:l,inspectedEdges:u,truncated:!1}};d.add(g.id),a.push({id:g.id,depth:p.depth+1})}}return{value:[],meta:{visitedNodes:l,inspectedEdges:u,truncated:f}}}subgraph(t,n={}){let r=this.closure(t,n),o=[t,...r.value].sort(),i=new Set(o),s=n.kinds?new Set(n.kinds.map(c=>this.#e.require(c).kind)):void 0,a=new Set;for(let c of o)for(let d of this.#s.get(c)??[])i.has(d.source)&&i.has(d.target)&&this.#c(d,s)&&a.add(d);return{value:{nodes:o,edges:[...a].sort(vt)},meta:r.meta}}};function dg(e,t,n=ce){return{source:e,target:t.id,kind:n.require(t.kind).kind,createdAt:t.created_at,author:t.author}}(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]="720821b8-d18d-5a10-a8b9-f16073dc1fc4")}catch{}})();function O(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function ac(){return{json:!1,quiet:!1,noExtensions:!1,profile:!1}}function Vr(e){return e?P(e):{}}function Wr(e){return e?P(e):ac()}function P(e){return structuredClone(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]="7d96fda0-1f2f-5e34-99da-c3c5ad0f53f6")}catch{}})();var cc=new Set(["commands","command_overrides","command_handlers","flag_commands","parser_overrides"]),dc=["commands","command_overrides","command_handlers","hooks","flag_commands","item_types","item_fields","relationship_kinds","migrations","profiles","importers","exporters","search_providers","vector_store_adapters","assurance_providers","parser_overrides","service_overrides","renderer_overrides"];function lc(e,t){for(let n of dc){let r=e[n];if(r===void 0)continue;if(!Array.isArray(r)||r.some(i=>typeof i!="string"))return!1;let o=r.map(i=>cc.has(n)?O(i):i.trim()).filter(i=>i.length>0);t[n]=[...new Set(o)].sort((i,s)=>i.localeCompare(s))}return!0}function uc(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!="object"||n===null)return null;let r=n;if(r.format!=="json"&&r.format!=="toon"||!Array.isArray(r.commands)||r.commands.some(o=>typeof o!="string")||typeof r.result_discriminator!="boolean")return null;t.push({format:r.format,commands:[...new Set(r.commands.map(o=>O(o)))].sort((o,i)=>o.localeCompare(i)),result_discriminator:r.result_discriminator})}return t.sort((n,r)=>n.format.localeCompare(r.format))}function fc(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!="object"||n===null)return null;let r=n.commands;if(!Array.isArray(r)||r.some(o=>typeof o!="string"))return null;t.push({commands:[...new Set(r.map(o=>O(o)))].filter(o=>o.length>0).sort((o,i)=>o.localeCompare(i))})}return t}function Ot(e){if(e==null)return;if(typeof e!="object"||Array.isArray(e))return null;let t=e;if(t.schema_version!==1)return null;let n={schema_version:1};if(!lc(t,n))return null;let r=t.preflight_overrides;if(r!==void 0&&(!Number.isInteger(r)||r<0))return null;typeof r=="number"&&(n.preflight_overrides=r);let o=t.renderer_ownership;if(o!==void 0){let s=uc(o);if(s===null)return null;n.renderer_ownership=s}let i=t.preflight_ownership;if(i!==void 0){let s=fc(i);if(s===null)return null;n.preflight_ownership=s}return n}function mg(e){return{schema_version:1,commands:e.commands,command_overrides:e.command_overrides,command_handlers:e.command_handlers,hooks:e.hooks,flag_commands:e.flag_commands,item_types:e.item_types,item_fields:e.item_fields,...e.relationship_kinds?{relationship_kinds:e.relationship_kinds}:{},migrations:e.migrations,profiles:e.profiles,importers:e.importers,exporters:e.exporters,search_providers:e.search_providers,vector_store_adapters:e.vector_store_adapters,...e.assurance_providers?{assurance_providers:e.assurance_providers}:{},parser_overrides:e.parser_overrides,service_overrides:e.service_overrides,renderer_overrides:e.renderer_overrides,...e.renderer_ownership?{renderer_ownership:e.renderer_ownership}:{},preflight_overrides:e.preflight_overrides,...e.preflight_ownership?{preflight_ownership:e.preflight_ownership}:{}}}(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]="c42420db-459b-5ce7-a9b5-e6d44873253a")}catch{}})();var mc=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-tqel"})),pc=[...["next","focus"].map(e=>({alias:e,canonical:`context ${e}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-6apl"})),...["normalize","reindex"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(e=>({...e,canonical_argv:e.canonical.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap"})),_c=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-ik19"})),gc=[...pc,..._c,...["init","config","schema","profile"].map(e=>({alias:e,canonical:`workspace ${e}`,canonical_argv:["workspace",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-npr3"})),...[...["comments","notes","learnings","files","docs","deps","append","test"].map(e=>[e,`item ${e}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(e=>[`completion-${e}`,`completion ${e}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(e=>[e,`calendar ${e}`,"pm-o3fh"])].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:n}))],pn=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-3z0k"},...mc,...gc,...["discover","lookup"].map(e=>({alias:`files ${e}`,canonical:`item files ${e}`,canonical_argv:["item","files",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-yql1"}))];function _g(e){let t;for(let n of pn)n.canonical_argv.length<=(t?.canonical_argv.length??0)||n.canonical_argv.every((r,o)=>r===(o===0&&e[o]==="ctx"?"context":e[o]))&&(t=n);return t}function yc(e){let t=e.trim().replace(/\s+/gu," ");return pn.find(n=>n.canonical===t.replace(/^ctx /u,"context "))?.alias??t}function qe(e){return yc(e)}var At=[...pn,...[["ctx","context"],["packages","package"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-pbyu"})),...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:[t,n],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:["comments","notes","learnings"].includes(t)?`item ${t}`:t,canonical_argv:["comments","notes","learnings"].includes(t)?["item",t]:[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"}))],gg=Object.fromEntries(At.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function yg(e){let t=e.trim().toLowerCase();return At.find(n=>n.alias===t)}function hg(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]="bfaa3455-3237-5c98-8ef4-b353ce9530fe")}catch{}})();var wg=Object.freeze({rows:10,paths:5,samples:10,path_depth:8,visited_paths:1e4});import{createHash as Hr}from"node:crypto";import hc 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]="c036d6cf-6a10-5c74-9e2f-e7c953339e2c")}catch{}})();function bc(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 wc(e){let t=Object.keys(e).sort(),n={};for(let r of t){let o=e[r];o!==void 0&&(n[r]=St(o))}return n}function St(e){let t=bc(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(r=>St(r));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let r=n.toJSON();if(r!==e)return St(r)}return wc(e)}function de(e){return JSON.stringify(St(e))}function Gr(e,t,n,r){for(let o=0;o<t.length;o+=1)if(!n.has(o)&&r(e,t[o]))return n.add(o),!0;return!1}function vc(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function Ec(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function kc(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],r=new Set;for(let o of e)if(!Gr(o,n,r,V))return!1;return!0}function Oc(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()],r=new Set;for(let[o,i]of e.entries())if(!Gr([o,i],n,r,([a,c],[d,l])=>V(a,d)&&V(c,l)))return!1;return!0}function Ac(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>V(n,t[r]))}function Sc(e,t){let n=Object.keys(e).sort((o,i)=>o.localeCompare(i)),r=Object.keys(t).sort((o,i)=>o.localeCompare(i));if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1){let i=n[o];if(i!==r[o]||!V(e[i],t[i]))return!1}return!0}var Cc=[vc,Ec,kc,Oc,Ac];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 Cc){let r=n(e,t);if(r!==void 0)return r}return Sc(e,t)}function kg(e){return hc.createHash("sha256").update(e,"utf8").digest("hex")}function Og(e,t){let n={};for(let o of t){let i=e[o];i!==void 0&&(n[o]=i)}let r=Object.keys(e).filter(o=>!t.includes(o)).sort((o,i)=>o.localeCompare(i));for(let o of r){let i=e[o];i!==void 0&&(n[o]=i)}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8b0d8654-211b-57bf-852f-8a153849e8fd")}catch{}})();var Tc=["policies","policy-put","policy-remove","policy-mode","policy-check","policy-approve","policy-presets"],Kr=256,_n=64;function L(e){throw new h(`Invalid workflow policy: ${e}`,y.USAGE,{code:"workflow_policy_invalid",nextSteps:["Inspect pm schema policies and correct the declaration using pm schema policy-put."]})}function G(e,t,n){if(typeof e!="object"||e===null||Array.isArray(e))return L(`${n} must be an object`);let r=e;return Object.keys(r).some(o=>!t.includes(o))?L(`${n} contains an unknown key`):r}function le(e,t,n=128){return typeof e!="string"||!e.trim()||e.length>n?L(`${t} must be nonempty text of at most ${n} characters`):e.trim()}function Be(e,t){if(!Array.isArray(e)||e.length===0||e.length>_n)return L(`${t} requires 1-${_n} terms`);let n=e.map(r=>le(r,t));return t==="fields"&&n.some(r=>!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$/.test(r)||r.split(".").some(o=>["__proto__","constructor","prototype"].includes(o)))?L("fields must be safe metadata paths of at most eight segments"):[...new Set(n)]}function Ic(e){let t=G(e,["kind","fields","authors","allowed"],"rule");return t.kind==="transition"?(G(t,["kind","allowed"],"transition rule"),!Array.isArray(t.allowed)||t.allowed.length>_n?L("transition.allowed must be a bounded array"):{kind:"transition",allowed:t.allowed.map(n=>!Array.isArray(n)||n.length!==2?L("transition pairs need two statuses"):[le(n[0],"from"),le(n[1],"to")])}):t.kind==="authors"?(G(t,["kind","authors"],"authors rule"),{kind:"authors",authors:Be(t.authors,"authors")}):t.kind==="require_fields"?(G(t,["kind","fields"],"require_fields rule"),{kind:"require_fields",fields:Be(t.fields,"fields")}):t.kind==="field_writers"||t.kind==="approval"?(G(t,["kind","fields","authors"],"field rule"),{kind:t.kind,fields:Be(t.fields,"fields"),authors:Be(t.authors,"authors")}):L("unknown rule kind")}function Rc(e){let t={},n=G(e,["types","tags","statuses","operations","parents","dependency"],"subject");for(let r of["types","tags","statuses","operations","parents"])n[r]!==void 0&&(t[r]=Be(n[r],r));if(n.dependency!==void 0){let r=G(n.dependency,["kind","id"],"dependency");t.dependency={kind:le(r.kind,"dependency kind"),...r.id===void 0?{}:{id:le(r.id,"dependency id")}}}return t}function xc(e){let t=G(e,["id","description","subject","effect","rule"],"policy"),n=le(t.id,"id");return/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(n)?t.effect!==void 0&&(typeof t.effect!="string"||!["advise","warn","refuse"].includes(t.effect))?L("effect must be advise, warn, or refuse"):{id:n,rule:Ic(t.rule),...t.subject===void 0?{}:{subject:Rc(t.subject)},...t.description===void 0?{}:{description:le(t.description,"description",500)},...t.effect===void 0?{}:{effect:t.effect}}:L("id must be a stable token")}function Nc(e){let t=G(e,["version","enforcement","policies"],"document");if(t.version!==1)return L("unsupported version");if(t.enforcement!==void 0&&t.enforcement!=="advise"&&t.enforcement!=="refuse")return L("enforcement must be advise or refuse");if(!Array.isArray(t.policies)||t.policies.length>Kr)return L(`policies must contain at most ${Kr} declarations`);let n=t.policies.map(xc);return new Set(n.map(r=>r.id)).size!==n.length?L("duplicate policy id"):{version:1,enforcement:t.enforcement??"advise",policies:n}}function Ct(e,t){let n=e;for(let r of t.split(".")){if(typeof n!="object"||n===null||!Object.hasOwn(n,r))return;n=n[r]}return n}function Dc(e){return e==null?!1:typeof e=="string"?e.trim().length>0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.length>0:typeof e=="object"?Object.keys(e).length>0:!0}function Yr(e){return Hr("sha256").update(de(e)).digest("hex")}function Pc(e,t){let n=e.rule.kind==="approval"?e.rule.fields:[];return Hr("sha256").update(de({id:t.id,fields:n.map(r=>[r,Ct(t,r)])})).digest("hex")}function Mc(e,t){return Array.isArray(t)&&t.some(n=>typeof n=="object"&&n!==null&&"kind"in n&&n.kind===e.kind&&(e.id===void 0||"id"in n&&n.id===e.id))}function $c(e,t,n){return!(e.types&&!e.types.some(r=>r.toLowerCase()===String(t.type).toLowerCase())||e.statuses&&!e.statuses.includes(String(t.status))||e.operations&&!e.operations.includes(n)||e.parents&&!e.parents.includes(String(t.parent))||e.tags&&(!Array.isArray(t.tags)||!e.tags.some(r=>t.tags.includes(r)))||e.dependency&&!Mc(e.dependency,t.dependencies))}function Lc(e,t){if(t.completeness_only&&(e.rule.kind!=="require_fields"||e.subject?.operations!==void 0)||e.rule.kind==="approval"&&t.before===null)return!1;let n=e.subject??{},r=t.after?.status??t.before?.status;return[t.before,t.after].some(o=>o!==null&&$c(n,{...o,status:r},t.operation))}function jc(e,t,n,r){let o=["type","tags","parent","dependencies"].some(s=>!V(t.before?.[s],t.after?.[s]));return t.after&&(t.completeness_only||n||r||o)?e.filter(s=>!Dc(Ct(t.after,s))):[]}function Fc(e,t,n,r){let o=t.after??t.before,i=Pc(e,o);return t.approvals?.some(s=>s.policy_fingerprint===r&&s.content_fingerprint===i&&s.author!==t.author&&n.includes(s.author))??!1}function Uc(e,t,n){let r=e.rule,o=t.before?.status!==t.after?.status,i="fields"in r&&r.fields.some(s=>!V(Ct(t.before,s),Ct(t.after,s)));switch(r.kind){case"require_fields":{let s=jc(r.fields,t,o,i);return{satisfied:s.length===0,missing_fields:s,remediation:"Supply the declared required fields before this lifecycle transition."}}case"transition":return{satisfied:!o||r.allowed.some(([s,a])=>s===String(t.before?.status??"$create")&&a===String(t.after?.status??"$delete")),missing_fields:[],remediation:"Choose a declared allowed transition; inspect pm schema policies."};case"authors":return{satisfied:r.authors.includes(t.author),missing_fields:[],remediation:"Have a declared workflow actor perform this operation."};case"field_writers":return{satisfied:!i||r.authors.includes(t.author),missing_fields:[],remediation:"Have a declared field writer change the protected fields."};case"approval":return{satisfied:!o||Fc(e,t,r.authors,n),missing_fields:[],remediation:`Record an independent approval with pm schema policy-approve <item-id> --policy ${e.id} after preparing the reviewed fields.`}}}function Xr(e,t,n){let r=e.policies.filter(o=>Lc(o,t)).map(o=>{let i=o.effect??"advise",s=n(o);return{policy_id:o.id,policy_fingerprint:s,rule:o.rule.kind,effect:i==="refuse"&&e.enforcement!=="refuse"?"warn":i,...Uc(o,t,s)}});return{allowed:!r.some(o=>!o.satisfied&&o.effect==="refuse"),decisions:r,warnings:r.filter(o=>!o.satisfied).map(o=>`workflow_policy:${o.effect}:${o.policy_id}:${o.rule}`)}}function Rg(e,t){return Xr(e,t,Yr)}function xg(e){let t=Nc(e),n=new Map(t.policies.map(r=>[r,Yr(r)]));return r=>Xr(t,r,o=>n.get(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]="1dd71b26-fc38-5304-9156-f32b57cc1cc0")}catch{}})();var zc=[...B],qc=[...Oe],Bc=[...pt],$g=[..._t],Lg=[...gt],Vc=[...yt],Tt=["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-attest","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"],jg=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],Fg=["install","reconcile","report","driver"],Wc=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],Gc=["upgrade"],Kc=["reopen"],Jr={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},It=Object.freeze(Tt.flatMap(e=>e in Jr?[]:e==="extension"||e==="package"?[...Wc.map(t=>`${e}-${t}`),...e==="package"?Gc.map(t=>`package-${t}`):[],e]:e==="item"?Kc.map(t=>`item-${t}`):[e])),Hc=Object.freeze(At.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&It.includes(e.alias)).map(e=>e.alias)),Ug=Object.freeze(It.filter(e=>!Hc.includes(e)));function zg(e=Tt,t=It,n=Jr){let r=new Set(t),o=new Set(e);return{missing_cli_actions:e.filter(i=>!r.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&n[i]===void 0),waived_cli_actions:e.filter(i=>!r.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&n[i]!==void 0),stale_waivers:Object.keys(n).filter(i=>!o.has(i)||r.has(i)||t.some(s=>s.startsWith(`${i}-`)))}}function qg(e){return It.includes(e)}function Bg(e){return zc.includes(e)}function Vg(e){return qc.includes(e)}function Wg(e){return Bc.includes(e)}function Gg(e){return Vc.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]="de2a2a0e-8a39-5569-9af9-cbf557bce2a9")}catch{}})();function Rt(e,t,n){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return null;let r=t.length+1,o=new Array(r),i=new Array(r),s=new Array(r);for(let c=0;c<r;c+=1)o[c]=0,i[c]=c;for(let c=1;c<=e.length;c+=1){s[0]=c;let d=s[0];for(let l=1;l<=t.length;l+=1){let u=e[c-1]===t[l-1]?0:1,f=i[l-1]+u,m=s[l-1]+1,p=i[l]+1,_=Math.min(f,m,p);c>1&&l>1&&e[c-1]===t[l-2]&&e[c-2]===t[l-1]&&(_=Math.min(_,o[l-2]+1)),s[l]=_,_<d&&(d=_)}if(d>n)return null;for(let l=0;l<r;l+=1)o[l]=i[l],i[l]=s[l]}let a=i[t.length];return a<=n?a:null}(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]="1ddb0411-5fdd-56af-a524-0f6830c288a5")}catch{}})();function Ve(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function J(e){return B.includes(e)}function Qr(e){let t=e.trim().toLowerCase();return J(t)?t:null}function Zr(e){return e.filter(t=>!J(t))}function gn(e){let t=e.trim().toLowerCase();return t.length===0?null:an[t]??null}function eo(e){let t=Ve([...e].map(i=>i.toLowerCase())),n=[],r=[];for(let i of t){let s=gn(i);if(s){n.push(s),r.push({alias:i,target:s});continue}n.push(i)}let o=[...new Map(r.map(i=>[`${i.alias}>${i.target}`,i])).values()].sort((i,s)=>i.alias.localeCompare(s.alias));return{capabilities:Ve(n),legacy_aliases:o}}function Yc(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let n=gn(t);if(n)return n;let r=Math.max(1,Math.floor(t.length*.34)),o=null,i=Number.POSITIVE_INFINITY;for(let s of B){let a=Rt(t,s,r);a!==null&&a<i&&(i=a,o=s)}return o}function to(e,t,n){let r=B.join(","),o=Yc(n)??"none";return`extension_capability_unknown:${e}:${t}:${n}:allowed=${r}:suggested=${o}`}function no(e,t,n){let r=n.map(o=>`${o.alias}>${o.target}`).join(",");return`extension_capability_legacy_alias:${e}:${t}:aliases=${r}`}function Xc(e){let t=/^extension_capability_unknown:(global|project):([^:]+):([^:]+):allowed=([^:]+):suggested=([^:]+)$/.exec(e.trim());if(!t)return null;let[,n,r,o,i,s]=t,a=n,c=i.split(",").map(m=>m.trim()).filter(m=>m.length>0),d=gn(o),u=(s==="none"?void 0:s)??d??void 0;return{layer:a,name:r,capability:o,allowed_capabilities:c,capability_contract_version:mt,suggested_capability:u,suggestion_source:u?d===u?"legacy_alias":"nearest_match":void 0,legacy_alias_target:d??void 0}}function Jc(e){let t=/^extension_capability_legacy_alias:(global|project):([^:]+):aliases=(.+)$/.exec(e.trim());if(!t)return[];let[,n,r,o]=t,i=n,s=[...B],a=[];for(let c of o.split(",")){let[d,l]=c.split(">"),u=d?.trim(),f=l?.trim().toLowerCase();!u||!f||!J(f)||a.push({layer:i,name:r,capability:u,allowed_capabilities:s,capability_contract_version:mt,suggested_capability:f,suggestion_source:"legacy_alias",legacy_alias_target:f})}return a}(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]="71c44385-0182-50f8-8e05-3aeebfe57ad9")}catch{}})();var Qc={commands:["registerCommand","command override","command handler"],renderers:["registerRenderer"],hooks:["hooks.beforeCommand","hooks.beforeMutation","hooks.afterCommand","hooks.onWrite","hooks.onRead","hooks.onIndex"],schema:["registerFlags","registerItemFields","registerItemTypes","registerRelationshipKinds","registerMigration","registerProfile"],importers:["registerImporter","registerExporter"],search:["registerSearchProvider","registerVectorStoreAdapter"],parser:["registerParser"],preflight:["registerPreflight"],services:["registerService","registerAssuranceMeasurementProvider"]},ro=":";function oo(e,t){return`${e}${ro}${yn(t)}`}function Zc(e){return e.slice(e.indexOf(ro)+1)}function yn(e){return e.trim().toLowerCase()}function ed(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let r=Qr(n);r!==null&&t.add(r)}return[...t].sort((n,r)=>n.localeCompare(r))}function io(e){let t=new Map,n=(l,u)=>{for(let f of l){let m=oo(f.layer,f.name),p=t.get(m);p===void 0&&(p=new Set,t.set(m,p)),p.add(u)}},{registrations:r,commands:o,parsers:i,preflight:s,services:a,renderers:c,hooks:d}=e;return n(r.commands,"commands"),n(o.overrides,"commands"),n(o.handlers,"commands"),n(r.flags,"schema"),n(r.item_fields,"schema"),n(r.item_types,"schema"),n(r.relationship_kinds??[],"schema"),n(r.migrations,"schema"),n(r.profiles,"schema"),n(r.importers,"importers"),n(r.exporters,"importers"),n(r.search_providers,"search"),n(r.vector_store_adapters,"search"),n(i.overrides,"parser"),n(s.overrides,"preflight"),n(a.overrides,"services"),n(r.assurance_providers??[],"services"),n(c.overrides,"renderers"),n(d.beforeCommand,"hooks"),n(d.beforeMutation,"hooks"),n(d.afterCommand,"hooks"),n(d.onWrite,"hooks"),n(d.onRead,"hooks"),n(d.onIndex,"hooks"),t}function td(e,t={}){let n=io(e),r=new Set;t.extensionName!==void 0&&r.add(yn(t.extensionName));for(let i of t.extensionNames??[])r.add(yn(i));let o=new Set;for(let[i,s]of n)if(!(r.size>0&&!r.has(Zc(i))))for(let a of s)o.add(a);return[...o].sort((i,s)=>i.localeCompare(s))}function nd(e,t){let n=io(t),r=[];for(let o of e){let i=ed(o.capabilities);if(i.length===0)continue;let s=n.get(oo(o.layer,o.name))??new Set,a=[...s].sort((d,l)=>d.localeCompare(l)),c=i.filter(d=>!s.has(d));r.push({layer:o.layer,name:o.name,declared:i,used:a,unused:c})}return r}import{createHash as rd}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]="4b085328-0791-58f5-872a-f796f9087ab4")}catch{}})();var hn=1,ao=4096,od=/^[A-Za-z0-9_-]+$/;function so(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function oy(e,t){let n=new Set;for(let r of t)if(r.cursor_semantics==="presentation"){n.add(so(r.flag));for(let o of r.aliases??[])n.add(so(o))}return Object.fromEntries(Object.entries(e).filter(([r])=>!n.has(r)))}function iy(e,t){return rd("sha256").update(e).update("\0").update(de(t)).digest("hex").slice(0,24)}function We(e,t,n,r){return Buffer.from(JSON.stringify({version:hn,fingerprint:e,after_id:t,...n===void 0?{}:{after_index:n},...r===void 0?{}:{snapshot:r}})).toString("base64url")}function ue(e){return new h(e,y.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function id(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===hn&&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 bn(e){if(typeof e!="string")throw ue("Query cursor is malformed.");let t=e.trim();if(t.length===0||t.length>ao||!od.test(t))throw ue("Query cursor is malformed.");let n;try{n=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw ue("Query cursor is malformed.")}if(!id(n))throw ue("Query cursor version or payload is unsupported.");return n}function wn(e,t){let n=bn(e);if(n.fingerprint!==t)throw ue(`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 sy(e,t){return wn(e,t).after_id}function sd(e,t,n,r){if(t===void 0)return 0;let o=wn(t,n),i=e.findIndex(s=>r(s)===o.after_id);if(i<0){if(o.after_index!==void 0)return Math.min(o.after_index,e.length);throw ue(`Query cursor item ${o.after_id} is no longer present in this result set.`)}return i+1}function ay(e,t){if(t.cursor!==void 0&&wn(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw ue("Query cursor does not match the requested snapshot.");let n=sd(e,t.cursor,t.fingerprint,t.readId),r=e.slice(n,n+t.limit),o=r.length>0&&n+r.length<e.length,i=r.at(-1);return{rows:r,has_more:o,...o&&i!==void 0?{next_cursor:We(t.fingerprint,t.readId(i),n+r.length-1,t.snapshot)}:{}}}var cy=Object.freeze({version:hn,max_length:ao});import{stripVTControlCharacters as ad}from"node:util";(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]="b4036040-c0b8-5d01-b490-3405722fd1c5")}catch{}})();var cd=["full","compact","brief","summary","counts"],my=["mutation","read","discovery","governance"],lo=["error","warning","validation_summary","recovery_bundle"],dd=["full","omit_explanation","limit_collections","compact_recovery","action_only"],ld=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"]),ud=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),fd=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),md={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},pd=3,_d=2,gd=192,yd={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},hd=lo.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:yd[e],minimum_max_estimated_tokens:gd,degradation_ladder:dd,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),bd=new Map(hd.map(e=>[e.diagnostic_class,e]));function wd(e){let[t=""]=qe(e).split(/\s+/u);return ld.has(t)?"mutation":ud.has(t)?"discovery":fd.has(t)?"governance":"read"}function uo(e,t=wd(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let r=md[t];return vd({command:n,budget_class:t,default_max_estimated_tokens:r,default_max_estimated_tokens_by_format:{toon:r,json:Math.ceil(r*pd/_d)},degradation_ladder:cd,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function vd(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 Ed=Tt.map(e=>uo(e)),kd=new Map(Ed.map(e=>[e.command,e]));function fo(e,t={}){let n=e.trim().replace(/\s+/gu," "),[r]=qe(n).split(" "),o=kd.get(r);return o?{...o,command:n}:t.generateFallback?uo(n):null}function me(e){return Math.ceil(Math.max(0,e)/4)}function mo(e){let t=bd.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${lo.join(", ")}`);return t}function Q(e){return me(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function Od(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vn(e){if(!Od(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 r=e[n];Array.isArray(r)?t[n]=n==="suggested_retry_args"?r:r.slice(0,3):r!==void 0&&(t[n]=r)}return Object.keys(t).length>0?t:void 0}function Ad(e,t){return typeof e!="string"||e.length<=t?e:`${e.slice(0,Math.max(1,t-3))}...`}function fe(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;let n="...",r=Array.from(e),o=0,i=r.length;for(;o<i;){let s=Math.ceil((o+i)/2),a=`${r.slice(0,s).join("")}${n}`;Buffer.byteLength(a,"utf8")<=t?o=s:i=s-1}return`${r.slice(0,o).join("")}${n}`}function po(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,r]of Object.entries(e))n!=="__proto__"&&!Object.hasOwn(t,n)&&(t[n]=r);return t}var Sd=new Set(["limit_collections","compact_recovery","action_only"]),Cd=new Set(["compact_recovery","action_only"]);function Td(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:Ad(e.required,160)??"Inspect the diagnostic code and retry with corrected input."},n=vn(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 Id(e,t){let n=structuredClone(e);if(t!=="full"&&(delete n.why,delete n.examples),Sd.has(t))for(let[r,o]of Object.entries(n))Array.isArray(o)&&(n[r]=o.slice(0,3));if(Cd.has(t)){let r=vn(n.recovery);r?n.recovery=r:delete n.recovery}return t!=="action_only"?po(n):Td(n)}function Ae(e,t){let n={...e,diagnostic_output:{...t,estimated_tokens:0}};for(let r=0;r<4;r+=1){let o=Q(n),i=n.diagnostic_output;if(i.estimated_tokens===o)break;i.estimated_tokens=o}return n}function Rd(e,t,n){let r=Ae(e,t);for(let i of["recovery","exit_code"])Q(r)<=n||e[i]===void 0||(delete e[i],r=Ae(e,t));let o=40;for(;Q(r)>n&&o>4;)o-=4,e.code=fe(String(e.code),o),e.required=fe(String(e.required),o),r=Ae(e,t);return r}function xd(e,t){let n=e.diagnostic_output,{estimated_tokens:r,...o}=n,i=o.omitted_fields.slice(0,8).map(u=>fe(u,32)),s={...o,omitted_fields:i,...o.omitted_fields.length>i.length?{omitted_fields_overflow_count:o.omitted_fields.length-i.length}:{}},a=vn(e.recovery),c=a&&Q(a)<=48?a:void 0,d={code:fe(String(e.code),320),required:fe(String(e.required),320),...c?{recovery:c}:{},...e.exit_code!==void 0?{exit_code:e.exit_code}:{}},l=Ae(d,s);for(;Q(l)>t&&s.omitted_fields.length>0;)s.omitted_fields.pop(),s.omitted_fields_overflow_count=o.omitted_fields.length-s.omitted_fields.length,l=Ae(d,s);return l=Rd(d,s,t),l}function py(e,t={}){let n=e,r=t.diagnosticClass??"error",o=mo(r),i=t.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<o.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${o.minimum_max_estimated_tokens}`);let s=i??o.default_max_estimated_tokens_by_format.json,a=Q(n),c=Object.keys(n);if(a<=s)return po(structuredClone(n));let d;for(let[l,u]of o.degradation_ladder.entries()){let f=Id(n,u),m=c.filter(_=>!Object.hasOwn(f,_)),p=Ae(f,{diagnostic_class:r,format:"json",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,truncated:l>0,degradation_steps:o.degradation_ladder.slice(0,l+1),omitted_fields:m});if(d=p,Q(p)<=s)break}return Q(d)>s&&(d=xd(d,s)),d}function co(e){return ad(e).replace(/\r\n/gu,`
|
|
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]="9ddd9ea4-8586-5d3d-9ed8-0bf9da49b9a5")}catch{}})();var B=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],mt=2,an=Object.freeze({migration:"schema",validation:"schema"}),E_=Object.freeze({version:mt,capabilities:[...B],legacy_aliases:{...an}}),pt=["off","warn","enforce"],_t=["off","warn","enforce"],gt=["none","restricted","strict"],Lr=["block","warn"],yt=["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"],Oe=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function ht(){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]="e33ee377-aae0-5158-9af6-e6081287a85b")}catch{}})();var La=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],jr=La,O_=["draft","open","in_progress","blocked","closed","canceled"],A_=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],Fr=["string","number","boolean","string_array","array","object"],S_=["create","update","update_many","list","search","calendar","context"],C_=["allow","warn","reject"],T_=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],I_=["project","global"],R_=["low","medium","high","critical"],x_=["low","medium","high","critical"],N_=["low","medium","high"];var D_=["minimal","default","strict","custom"],P_=["none","warn","strict"],M_=["progressive","strict"],$_=["off","warn","strict"],L_=["off","warn","strict"];var j_=["daily","weekly","monthly","yearly"],ja=["mon","tue","wed","thu","fri","sat","sun"];function F_(e){return ja.indexOf(e)}var U_=["draft","research","review","approved","executing","paused","completed","superseded"],z_=["pending","in_progress","completed","blocked","skipped","superseded"],q_=["codex","claude-code","cursor","generic"],B_=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],V_=["brief","standard","deep","full"],W_=["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]="89d6c349-10d7-596d-90a1-65afcc65eb91")}catch{}})();var Ur=["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"],Fa=["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",...Ur,"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"],Ua=Fa;(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]="6e329ab1-f22d-5749-b8a4-0a6e7a1c8023")}catch{}})();var za=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"]}]),qa=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),bt=".agents/pm",wt="settings.json";var Ba=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],Va=["decisions","events","reminders","milestones","meetings","plans"],X_=[...Ba,...Va],Ue={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},Wa={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}},Ga=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],cn={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 zr(e){return e?[...e]:void 0}var J_={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:[...Ga],lifecycle_closure_like_blocked_reason_patterns:[...cn.blocked_reason],lifecycle_closure_like_resolution_patterns:[...cn.resolution],lifecycle_closure_like_actual_result_patterns:[...cn.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...Wa.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:za.map(e=>({...e,aliases:zr(e.aliases),roles:zr(e.roles)})),fields:[],workflow:{...qa},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:ht()},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:"",default_mode:"auto",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:""}}},Q_={metadata:{},body:""},y={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},Z_=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]="c3a7c240-7575-5db7-98fa-9dd010c9ff7d")}catch{}})();var h=class extends Error{exitCode;code;context;constructor(t,n,r={}){super(t),this.name="PmCliError",this.exitCode=n,this.context=r,this.code=r.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]="9961b408-ad70-5556-84dd-5ca1b1497c27")}catch{}})();var Ka=new Set(["name","version","entry","priority","description","author","capabilities","manifest_version","pm_min_version","pm_max_version","engines","trusted","provenance","sandbox_profile","permissions","activation","contributions","legacy_capability_aliases"]);function Ha(e){return{unknownKeys:Object.keys(e).filter(t=>!Ka.has(t)).sort((t,n)=>t>n?1:-1),missingVersionBounds:e.pm_min_version===void 0&&e.pm_max_version===void 0}}function Ya(e){let t=Ha(e),n=t.unknownKeys.map(r=>({code:"manifest_unknown_key",path:r,...r==="compatibility"?{suggested_key:"pm_min_version"}:{},message:r==="compatibility"?'Manifest key "compatibility" is ignored; declare the canonical pm_min_version and optional pm_max_version fields instead.':`Manifest key "${r}" is not part of the extension manifest contract and will be ignored.`}));return t.missingVersionBounds&&n.push({code:"no_version_bounds_declared",path:"$",suggested_key:"pm_min_version",message:"No canonical pm version bounds are declared; add pm_min_version so compatibility intent is explicit."}),{ok:n.length===0,findings:n}}function qr(e,t,n){return Ya(n).findings.map(r=>r.code==="manifest_unknown_key"?`extension_manifest_unknown_key:${e}:${t.name}:key=${r.path}${r.suggested_key?`:suggested=${r.suggested_key}`:""}`:`extension_manifest_no_version_bounds:${e}:${t.name}:suggested=pm_min_version`)}(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]="4c00e38a-27df-5315-91e8-d35c03ed6bf3")}catch{}})();var dn=[{kind:"blocked_by",direction:"directed",traversal:"ordering",inverse:"blocks",ordering:!0,precedence:"target_before_source",hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",aliases:["depends_on"],compatibilityVersion:1,allowSelf:!1},{kind:"blocks",direction:"directed",traversal:"ordering",inverse:"blocked_by",ordering:!0,precedence:"source_before_target",hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"parent",direction:"directed",traversal:"hierarchy",outcomeTraversal:"source_to_target",inverse:"child",ordering:!1,hierarchy:!0,hierarchyDirection:"target_parent",outgoing:"one",incoming:"many",lifecycle:"supersedable",aliases:["child_of","epic"],compatibilityVersion:1,allowSelf:!1},{kind:"child",direction:"directed",traversal:"hierarchy",outcomeTraversal:"target_to_source",inverse:"parent",ordering:!1,hierarchy:!0,hierarchyDirection:"source_parent",outgoing:"many",incoming:"one",lifecycle:"supersedable",aliases:["parent_child","task"],compatibilityVersion:1,allowSelf:!1},{kind:"related",direction:"undirected",traversal:"association",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",aliases:["related_to"],compatibilityVersion:1,allowSelf:!1},{kind:"discovered_from",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"incident_from",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"implements",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"recurs_from",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,temporalOrder:"source_after_target",hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"verifies",direction:"directed",traversal:"semantic",outcomeTraversal:"source_to_target",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"persistent",compatibilityVersion:1,allowSelf:!1},{kind:"supersedes",direction:"directed",traversal:"semantic",outcomeTraversal:"both",ordering:!1,hierarchy:!1,outgoing:"many",incoming:"many",lifecycle:"supersedable",compatibilityVersion:1,allowSelf:!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]="b658dc99-fdbb-5d10-9dd6-5f5c263bf48b")}catch{}})();function kt(e){return e.trim().toLowerCase().replaceAll("-","_")}function Xa(e){if(e===void 0)return;let t=kt(e);if(!/^[a-z][a-z0-9_]*$/.test(t))throw new TypeError(`Invalid inverse relationship kind: ${e}`);return t}function un(e,t=new Set){if(e===null||typeof e!="object"||t.has(e))return e;if(t.add(e),Array.isArray(e)){for(let n of e)un(n,t);return Object.freeze(e)}for(let n of Object.values(e))un(n,t);return Object.freeze(e)}function Ja(e,t){if(e.precedence!==void 0&&e.precedence!=="source_before_target"&&e.precedence!=="target_before_source")throw new TypeError(`Invalid relationship precedence for ${t}`);if(!e.ordering&&e.precedence!==void 0)throw new TypeError(`Non-ordering relationship kind cannot declare precedence: ${t}`)}function Qa(e,t){if(e.temporalOrder!==void 0&&e.temporalOrder!=="source_after_target")throw new TypeError(`Invalid relationship temporal order for ${t}`);if(e.direction!=="directed"&&e.temporalOrder!==void 0)throw new TypeError(`Undirected relationship kind cannot declare temporal order: ${t}`)}function Za(e,t){if(e.hierarchyDirection!==void 0&&e.hierarchyDirection!=="source_parent"&&e.hierarchyDirection!=="target_parent")throw new TypeError(`Invalid relationship hierarchy direction for ${t}`);if(!e.hierarchy&&e.hierarchyDirection!==void 0)throw new TypeError(`Non-hierarchy relationship kind cannot declare hierarchy direction: ${t}`)}function ec(e){if(typeof e!="object"||e===null)throw new TypeError("Relationship kind definition requires an object");if(typeof e.kind!="string")throw new TypeError("Relationship kind requires a string identifier");let t=kt(e.kind);if(!/^[a-z][a-z0-9_]*$/.test(t))throw new TypeError(`Invalid relationship kind: ${e.kind}`);if(!Number.isInteger(e.compatibilityVersion)||e.compatibilityVersion<1)throw new TypeError(`Invalid compatibility version for ${t}`);return t}function tc(e,t){if(!["directed","undirected"].includes(e.direction))throw new TypeError(`Invalid relationship direction for ${t}`);if(typeof e.ordering!="boolean")throw new TypeError(`Invalid relationship ordering flag for ${t}`);if(![void 0,!0,!1].includes(e.hierarchy))throw new TypeError(`Invalid relationship hierarchy flag for ${t}`);if(!["one","many"].includes(e.outgoing))throw new TypeError(`Invalid outgoing relationship cardinality for ${t}`);if(!["one","many"].includes(e.incoming))throw new TypeError(`Invalid incoming relationship cardinality for ${t}`);if(!["persistent","supersedable","ephemeral"].includes(e.lifecycle))throw new TypeError(`Invalid relationship lifecycle for ${t}`);if(typeof e.allowSelf!="boolean")throw new TypeError(`Invalid relationship self-edge flag for ${t}`);if(e.traversal!==void 0&&!["hierarchy","ordering","semantic","association"].includes(e.traversal))throw new TypeError(`Invalid relationship traversal family for ${t}`);if(e.outcomeTraversal!==void 0&&!["source_to_target","target_to_source","both"].includes(e.outcomeTraversal))throw new TypeError(`Invalid outcome traversal for ${t}`);if(e.direction==="undirected"&&e.outcomeTraversal!==void 0&&e.outcomeTraversal!=="both")throw new TypeError(`Undirected relationship kind cannot declare directional outcome traversal: ${t}`)}function nc(e,t){if(e.payloadSchema!==void 0&&(typeof e.payloadSchema!="object"||e.payloadSchema===null||Array.isArray(e.payloadSchema)))throw new TypeError(`Invalid relationship payload schema for ${t}`);if(e.aliases!==void 0&&(!Array.isArray(e.aliases)||e.aliases.some(n=>typeof n!="string")))throw new TypeError(`Invalid relationship aliases for ${t}`)}function rc(e){return e.traversal?e.traversal:e.ordering?"ordering":e.hierarchy?"hierarchy":e.direction==="undirected"?"association":"semantic"}var fn=class{#e=new Map;#n=new Map;constructor(t=dn){for(let n of t)this.register(n)}register(t){let n=ec(t);if(tc(t,n),nc(t,n),Ja(t,n),Qa(t,n),Za(t,n),this.#e.has(n)||this.#n.has(n))throw new TypeError(`Relationship kind already registered: ${n}`);let r=Xa(t.inverse),o=[...new Set((t.aliases??[]).map(kt))].sort();for(let s of o){if(!/^[a-z][a-z0-9_]*$/.test(s))throw new TypeError(`Invalid relationship alias: ${s}`);if(s===n||this.#e.has(s)||this.#n.has(s))throw new TypeError(`Relationship alias already registered: ${s}`)}let i=Object.freeze({...t,kind:n,traversal:rc(t),hierarchy:t.hierarchy??!1,hierarchyDirection:t.hierarchy?t.hierarchyDirection??"source_parent":void 0,inverse:r,aliases:Object.freeze(o),payloadSchema:t.payloadSchema?un(structuredClone(t.payloadSchema)):void 0});this.#e.set(n,i);for(let s of o)this.#n.set(s,n);return this}resolve(t){if(typeof t!="string")return;let n=kt(t);return this.#e.get(this.#n.get(n)??n)}require(t){let n=this.resolve(t);if(!n)throw new TypeError(`Unknown relationship kind: ${t}`);return n}list(){return Object.freeze([...this.#e.values()].sort((t,n)=>t.kind.localeCompare(n.kind)))}};function mn(){return new fn}var ce=mn();function sg(e){return ce.require(e).kind}function ag(e){return ce.resolve(e)?.kind}function cg(e,t=ce){return t.resolve(e)?.ordering===!0}function oc(e,t,n,r=ce){let o=ze(e),i=ze(t);if(!o||!i)throw new TypeError("Relationship endpoint must not be empty");let s=r.require(n);if(o===i&&!s.allowSelf)throw new TypeError(`Self relationship is not allowed for ${s.kind}`);return s}function vt(e,t){return e.source.localeCompare(t.source)||e.target.localeCompare(t.target)||e.kind.localeCompare(t.kind)}function ic(e,t,n){let r=typeof e.source=="string"?e.source.trim():"",o=typeof e.target=="string"?e.target.trim():"";if(!t.has(r)||!t.has(o))throw new TypeError(`Relationship endpoint not found: ${r} -> ${o}`);let i=oc(r,o,e.kind,n),s=Object.freeze({...e,source:r,target:o,kind:i.kind}),a=i.direction==="undirected"?[r,o].sort().join("\0"):`${r}\0${o}`;return{edge:s,identity:`${i.kind}\0${a}`}}function Et(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function ze(e){return typeof e=="string"?e.trim():""}function ln(e,t){let n=ze(e);return n&&t.has(n)?n:void 0}function sc(e,t,n){let r=[t],o=t;for(;o!==e;)o=n.get(o),r.push(o);return r.reverse()}var Br=class e{#e;#n;#o;#r;#s=new Map;#a=new Map;constructor(t,n,r=ce){this.#e=r,this.#n=new Set([...t].filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean)),this.#o=Object.freeze([...this.#n].sort());let o=new Map;for(let i of n){let{edge:s,identity:a}=ic(i,this.#n,r);o.set(a,s)}this.#r=Object.freeze([...o.values()].sort(vt));for(let i of this.#r)Et(this.#s,i.source,i),Et(this.#a,i.target,i),r.require(i.kind).direction==="undirected"&&(Et(this.#s,i.target,i),Et(this.#a,i.source,i))}static fromItems(t,n=ce){let r=new Set(t.map(i=>ze(i.id)).filter(Boolean)),o=[];for(let i of t){let s=ze(i.id);if(!s)continue;let a=ln(i.parent,r);a&&o.push({source:s,target:a,kind:"parent"});let c=ln(i.blocked_by,r);c&&o.push({source:s,target:c,kind:"blocked_by"});for(let d of i.dependencies??[]){let l=ln(d.id,r);l&&n.resolve(d.kind)&&o.push({source:s,target:l,kind:d.kind,createdAt:d.created_at,author:d.author})}}return new e(r,o,n)}edges(){return this.#r}incidentEdges(t){this.#i(t);let n=this.#s.get(t)??[],r=this.#a.get(t)??[];if(n.length===0)return Object.freeze([...r]);if(r.length===0)return Object.freeze([...n]);let o=[],i=0,s=0;for(;i<n.length||s<r.length;){let a=n[i],c=r[s],d=a===void 0?c:c===void 0||vt(a,c)<=0?a:c;o.at(-1)!==d&&o.push(d),a===d&&(i+=1),c===d&&(s+=1)}return Object.freeze(o)}nodes(){return this.#o}hasNode(t){return this.#n.has(t)}registry(){return this.#e}#i(t){if(!this.#n.has(t))throw new TypeError(`Relationship node not found: ${t}`)}#c(t,n){if(!n)return!0;let r=this.#e.require(t.kind);return n.has(t.kind)||r.inverse!==void 0&&n.has(r.inverse)}#t(t,n,r){let o=[...n==="incoming"?[]:this.#s.get(t)??[],...n==="outgoing"?[]:this.#a.get(t)??[]];return[...new Set(o)].filter(i=>this.#c(i,r)).map(i=>({id:i.source===t?i.target:i.source,edge:i})).sort((i,s)=>i.id.localeCompare(s.id)||vt(i.edge,s.edge))}adjacency(t,n={}){this.#i(t),n.signal?.throwIfAborted();let r=n.kinds?new Set(n.kinds.map(c=>this.#e.require(c).kind)):void 0,o=this.#t(t,n.direction??"outgoing",r),i=n.limit??Number.POSITIVE_INFINITY,s=[...new Set(o.map(c=>c.id))],a=s.slice(0,i);return{value:a,meta:{visitedNodes:1,inspectedEdges:o.length,truncated:a.length<s.length,nextCursor:a.at(-1)}}}neighborEdges(t,n={}){this.#i(t),n.signal?.throwIfAborted();let r=n.kinds?new Set(n.kinds.map(a=>this.#e.require(a).kind)):void 0,o=this.#t(t,n.direction??"outgoing",r),i=n.limit??Number.POSITIVE_INFINITY,s=o.slice(0,i);return{value:s,meta:{visitedNodes:1,inspectedEdges:o.length,truncated:s.length<o.length,nextCursor:s.at(-1)?.id}}}closure(t,n={}){this.#i(t);let r=n.kinds?new Set(n.kinds.map(m=>this.#e.require(m).kind)):void 0,o=n.direction??"outgoing",i=n.limit??Number.POSITIVE_INFINITY,s=n.maxDepth??Number.POSITIVE_INFINITY,a=new Set([t]),c=[],d=[{id:t,depth:0}],l=0,u=0,f=!1;e:for(let m=0;m<d.length;m+=1){n.signal?.throwIfAborted();let p=d[m];l+=1;let _=this.#t(p.id,o,r);if(u+=_.length,p.depth>=s){_.some(g=>!a.has(g.id))&&(f=!0);continue}for(let g of _)if(!a.has(g.id)){if(c.length>=i){f=!0;break e}a.add(g.id),c.push(g.id),d.push({id:g.id,depth:p.depth+1})}}return{value:c,meta:{visitedNodes:l,inspectedEdges:u,truncated:f,nextCursor:c.at(-1)}}}shortestPath(t,n,r={}){if(this.#i(t),this.#i(n),t===n)return{value:[t],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}};let o=r.kinds?new Set(r.kinds.map(m=>this.#e.require(m).kind)):void 0,i=r.direction??"outgoing",s=r.maxDepth??Number.POSITIVE_INFINITY,a=[{id:t,depth:0}],c=new Map,d=new Set([t]),l=0,u=0,f=!1;for(let m=0;m<a.length;m+=1){r.signal?.throwIfAborted();let p=a[m];l+=1;let _=this.#t(p.id,i,o);if(u+=_.length,p.depth>=s){_.some(g=>!d.has(g.id))&&(f=!0);continue}for(let g of _)if(!d.has(g.id)){if(c.set(g.id,p.id),g.id===n)return{value:sc(t,n,c),meta:{visitedNodes:l,inspectedEdges:u,truncated:!1}};d.add(g.id),a.push({id:g.id,depth:p.depth+1})}}return{value:[],meta:{visitedNodes:l,inspectedEdges:u,truncated:f}}}subgraph(t,n={}){let r=this.closure(t,n),o=[t,...r.value].sort(),i=new Set(o),s=n.kinds?new Set(n.kinds.map(c=>this.#e.require(c).kind)):void 0,a=new Set;for(let c of o)for(let d of this.#s.get(c)??[])i.has(d.source)&&i.has(d.target)&&this.#c(d,s)&&a.add(d);return{value:{nodes:o,edges:[...a].sort(vt)},meta:r.meta}}};function dg(e,t,n=ce){return{source:e,target:t.id,kind:n.require(t.kind).kind,createdAt:t.created_at,author:t.author}}(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]="720821b8-d18d-5a10-a8b9-f16073dc1fc4")}catch{}})();function O(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function ac(){return{json:!1,quiet:!1,noExtensions:!1,profile:!1}}function Vr(e){return e?P(e):{}}function Wr(e){return e?P(e):ac()}function P(e){return structuredClone(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]="7d96fda0-1f2f-5e34-99da-c3c5ad0f53f6")}catch{}})();var cc=new Set(["commands","command_overrides","command_handlers","flag_commands","parser_overrides"]),dc=["commands","command_overrides","command_handlers","hooks","flag_commands","item_types","item_fields","relationship_kinds","migrations","profiles","importers","exporters","search_providers","vector_store_adapters","assurance_providers","parser_overrides","service_overrides","renderer_overrides"];function lc(e,t){for(let n of dc){let r=e[n];if(r===void 0)continue;if(!Array.isArray(r)||r.some(i=>typeof i!="string"))return!1;let o=r.map(i=>cc.has(n)?O(i):i.trim()).filter(i=>i.length>0);t[n]=[...new Set(o)].sort((i,s)=>i.localeCompare(s))}return!0}function uc(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!="object"||n===null)return null;let r=n;if(r.format!=="json"&&r.format!=="toon"||!Array.isArray(r.commands)||r.commands.some(o=>typeof o!="string")||typeof r.result_discriminator!="boolean")return null;t.push({format:r.format,commands:[...new Set(r.commands.map(o=>O(o)))].sort((o,i)=>o.localeCompare(i)),result_discriminator:r.result_discriminator})}return t.sort((n,r)=>n.format.localeCompare(r.format))}function fc(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!="object"||n===null)return null;let r=n.commands;if(!Array.isArray(r)||r.some(o=>typeof o!="string"))return null;t.push({commands:[...new Set(r.map(o=>O(o)))].filter(o=>o.length>0).sort((o,i)=>o.localeCompare(i))})}return t}function Ot(e){if(e==null)return;if(typeof e!="object"||Array.isArray(e))return null;let t=e;if(t.schema_version!==1)return null;let n={schema_version:1};if(!lc(t,n))return null;let r=t.preflight_overrides;if(r!==void 0&&(!Number.isInteger(r)||r<0))return null;typeof r=="number"&&(n.preflight_overrides=r);let o=t.renderer_ownership;if(o!==void 0){let s=uc(o);if(s===null)return null;n.renderer_ownership=s}let i=t.preflight_ownership;if(i!==void 0){let s=fc(i);if(s===null)return null;n.preflight_ownership=s}return n}function mg(e){return{schema_version:1,commands:e.commands,command_overrides:e.command_overrides,command_handlers:e.command_handlers,hooks:e.hooks,flag_commands:e.flag_commands,item_types:e.item_types,item_fields:e.item_fields,...e.relationship_kinds?{relationship_kinds:e.relationship_kinds}:{},migrations:e.migrations,profiles:e.profiles,importers:e.importers,exporters:e.exporters,search_providers:e.search_providers,vector_store_adapters:e.vector_store_adapters,...e.assurance_providers?{assurance_providers:e.assurance_providers}:{},parser_overrides:e.parser_overrides,service_overrides:e.service_overrides,renderer_overrides:e.renderer_overrides,...e.renderer_ownership?{renderer_ownership:e.renderer_ownership}:{},preflight_overrides:e.preflight_overrides,...e.preflight_ownership?{preflight_ownership:e.preflight_ownership}:{}}}(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]="dd0b1f79-0f4c-5042-8915-23adfc1f3b8d")}catch{}})();var mc=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-tqel"})),pc=[...["next","focus"].map(e=>({alias:e,canonical:`context ${e}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-6apl"})),...["normalize","reindex"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(e=>({...e,canonical_argv:e.canonical.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap"})),_c=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-ik19"})),gc=[...pc,..._c,...["init","config","schema","profile"].map(e=>({alias:e,canonical:`workspace ${e}`,canonical_argv:["workspace",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-npr3"})),...[...["comments","notes","learnings","files","docs","deps","append","test"].map(e=>[e,`item ${e}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(e=>[`completion-${e}`,`completion ${e}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(e=>[e,`calendar ${e}`,"pm-o3fh"])].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:n}))],pn=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-3z0k"},...mc,...gc,...["discover","lookup"].map(e=>({alias:`files ${e}`,canonical:`item files ${e}`,canonical_argv:["item","files",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-yql1"}))];function _g(e){let t;for(let n of pn)n.canonical_argv.length<=(t?.canonical_argv.length??0)||n.canonical_argv.every((r,o)=>r===(o===0&&e[o]==="ctx"?"context":e[o]))&&(t=n);return t}function yc(e){let t=e.trim().replace(/\s+/gu," ");return pn.find(n=>n.canonical===t.replace(/^ctx /u,"context "))?.alias??t}function qe(e){return yc(e)}var At=[...pn,...[["ctx","context"],["packages","package"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-pbyu"})),...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:[t,n],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:["comments","notes","learnings"].includes(t)?`item ${t}`:t,canonical_argv:["comments","notes","learnings"].includes(t)?["item",t]:[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","package catalog"],["packages scaffold","package 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"}))],gg=Object.fromEntries(At.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function yg(e){let t=e.trim().toLowerCase();return At.find(n=>n.alias===t)}function hg(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]="bfaa3455-3237-5c98-8ef4-b353ce9530fe")}catch{}})();var wg=Object.freeze({rows:10,paths:5,samples:10,path_depth:8,visited_paths:1e4});import{createHash as Hr}from"node:crypto";import hc 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]="c036d6cf-6a10-5c74-9e2f-e7c953339e2c")}catch{}})();function bc(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 wc(e){let t=Object.keys(e).sort(),n={};for(let r of t){let o=e[r];o!==void 0&&(n[r]=St(o))}return n}function St(e){let t=bc(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(r=>St(r));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let r=n.toJSON();if(r!==e)return St(r)}return wc(e)}function de(e){return JSON.stringify(St(e))}function Gr(e,t,n,r){for(let o=0;o<t.length;o+=1)if(!n.has(o)&&r(e,t[o]))return n.add(o),!0;return!1}function vc(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function Ec(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function kc(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],r=new Set;for(let o of e)if(!Gr(o,n,r,V))return!1;return!0}function Oc(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()],r=new Set;for(let[o,i]of e.entries())if(!Gr([o,i],n,r,([a,c],[d,l])=>V(a,d)&&V(c,l)))return!1;return!0}function Ac(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>V(n,t[r]))}function Sc(e,t){let n=Object.keys(e).sort((o,i)=>o.localeCompare(i)),r=Object.keys(t).sort((o,i)=>o.localeCompare(i));if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1){let i=n[o];if(i!==r[o]||!V(e[i],t[i]))return!1}return!0}var Cc=[vc,Ec,kc,Oc,Ac];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 Cc){let r=n(e,t);if(r!==void 0)return r}return Sc(e,t)}function kg(e){return hc.createHash("sha256").update(e,"utf8").digest("hex")}function Og(e,t){let n={};for(let o of t){let i=e[o];i!==void 0&&(n[o]=i)}let r=Object.keys(e).filter(o=>!t.includes(o)).sort((o,i)=>o.localeCompare(i));for(let o of r){let i=e[o];i!==void 0&&(n[o]=i)}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8b0d8654-211b-57bf-852f-8a153849e8fd")}catch{}})();var Tc=["policies","policy-put","policy-remove","policy-mode","policy-check","policy-approve","policy-presets"],Kr=256,_n=64;function j(e){throw new h(`Invalid workflow policy: ${e}`,y.USAGE,{code:"workflow_policy_invalid",nextSteps:["Inspect pm schema policies and correct the declaration using pm schema policy-put."]})}function G(e,t,n){if(typeof e!="object"||e===null||Array.isArray(e))return j(`${n} must be an object`);let r=e;return Object.keys(r).some(o=>!t.includes(o))?j(`${n} contains an unknown key`):r}function le(e,t,n=128){return typeof e!="string"||!e.trim()||e.length>n?j(`${t} must be nonempty text of at most ${n} characters`):e.trim()}function Be(e,t){if(!Array.isArray(e)||e.length===0||e.length>_n)return j(`${t} requires 1-${_n} terms`);let n=e.map(r=>le(r,t));return t==="fields"&&n.some(r=>!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$/.test(r)||r.split(".").some(o=>["__proto__","constructor","prototype"].includes(o)))?j("fields must be safe metadata paths of at most eight segments"):[...new Set(n)]}function Ic(e){let t=G(e,["kind","fields","authors","allowed"],"rule");return t.kind==="transition"?(G(t,["kind","allowed"],"transition rule"),!Array.isArray(t.allowed)||t.allowed.length>_n?j("transition.allowed must be a bounded array"):{kind:"transition",allowed:t.allowed.map(n=>!Array.isArray(n)||n.length!==2?j("transition pairs need two statuses"):[le(n[0],"from"),le(n[1],"to")])}):t.kind==="authors"?(G(t,["kind","authors"],"authors rule"),{kind:"authors",authors:Be(t.authors,"authors")}):t.kind==="require_fields"?(G(t,["kind","fields"],"require_fields rule"),{kind:"require_fields",fields:Be(t.fields,"fields")}):t.kind==="field_writers"||t.kind==="approval"?(G(t,["kind","fields","authors"],"field rule"),{kind:t.kind,fields:Be(t.fields,"fields"),authors:Be(t.authors,"authors")}):j("unknown rule kind")}function Rc(e){let t={},n=G(e,["types","tags","statuses","operations","parents","dependency"],"subject");for(let r of["types","tags","statuses","operations","parents"])n[r]!==void 0&&(t[r]=Be(n[r],r));if(n.dependency!==void 0){let r=G(n.dependency,["kind","id"],"dependency");t.dependency={kind:le(r.kind,"dependency kind"),...r.id===void 0?{}:{id:le(r.id,"dependency id")}}}return t}function xc(e){let t=G(e,["id","description","subject","effect","rule"],"policy"),n=le(t.id,"id");return/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(n)?t.effect!==void 0&&(typeof t.effect!="string"||!["advise","warn","refuse"].includes(t.effect))?j("effect must be advise, warn, or refuse"):{id:n,rule:Ic(t.rule),...t.subject===void 0?{}:{subject:Rc(t.subject)},...t.description===void 0?{}:{description:le(t.description,"description",500)},...t.effect===void 0?{}:{effect:t.effect}}:j("id must be a stable token")}function Nc(e){let t=G(e,["version","enforcement","policies"],"document");if(t.version!==1)return j("unsupported version");if(t.enforcement!==void 0&&t.enforcement!=="advise"&&t.enforcement!=="refuse")return j("enforcement must be advise or refuse");if(!Array.isArray(t.policies)||t.policies.length>Kr)return j(`policies must contain at most ${Kr} declarations`);let n=t.policies.map(xc);return new Set(n.map(r=>r.id)).size!==n.length?j("duplicate policy id"):{version:1,enforcement:t.enforcement??"advise",policies:n}}function Ct(e,t){let n=e;for(let r of t.split(".")){if(typeof n!="object"||n===null||!Object.hasOwn(n,r))return;n=n[r]}return n}function Dc(e){return e==null?!1:typeof e=="string"?e.trim().length>0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.length>0:typeof e=="object"?Object.keys(e).length>0:!0}function Yr(e){return Hr("sha256").update(de(e)).digest("hex")}function Pc(e,t){let n=e.rule.kind==="approval"?e.rule.fields:[];return Hr("sha256").update(de({id:t.id,fields:n.map(r=>[r,Ct(t,r)])})).digest("hex")}function Mc(e,t){return Array.isArray(t)&&t.some(n=>typeof n=="object"&&n!==null&&"kind"in n&&n.kind===e.kind&&(e.id===void 0||"id"in n&&n.id===e.id))}function $c(e,t,n){return!(e.types&&!e.types.some(r=>r.toLowerCase()===String(t.type).toLowerCase())||e.statuses&&!e.statuses.includes(String(t.status))||e.operations&&!e.operations.includes(n)||e.parents&&!e.parents.includes(String(t.parent))||e.tags&&(!Array.isArray(t.tags)||!e.tags.some(r=>t.tags.includes(r)))||e.dependency&&!Mc(e.dependency,t.dependencies))}function Lc(e,t){if(t.completeness_only&&(e.rule.kind!=="require_fields"||e.subject?.operations!==void 0)||e.rule.kind==="approval"&&t.before===null)return!1;let n=e.subject??{},r=t.after?.status??t.before?.status;return[t.before,t.after].some(o=>o!==null&&$c(n,{...o,status:r},t.operation))}function jc(e,t,n,r){let o=["type","tags","parent","dependencies"].some(s=>!V(t.before?.[s],t.after?.[s]));return t.after&&(t.completeness_only||n||r||o)?e.filter(s=>!Dc(Ct(t.after,s))):[]}function Fc(e,t,n,r){let o=t.after??t.before,i=Pc(e,o);return t.approvals?.some(s=>s.policy_fingerprint===r&&s.content_fingerprint===i&&s.author!==t.author&&n.includes(s.author))??!1}function Uc(e,t,n){let r=e.rule,o=t.before?.status!==t.after?.status,i="fields"in r&&r.fields.some(s=>!V(Ct(t.before,s),Ct(t.after,s)));switch(r.kind){case"require_fields":{let s=jc(r.fields,t,o,i);return{satisfied:s.length===0,missing_fields:s,remediation:"Supply the declared required fields before this lifecycle transition."}}case"transition":return{satisfied:!o||r.allowed.some(([s,a])=>s===String(t.before?.status??"$create")&&a===String(t.after?.status??"$delete")),missing_fields:[],remediation:"Choose a declared allowed transition; inspect pm schema policies."};case"authors":return{satisfied:r.authors.includes(t.author),missing_fields:[],remediation:"Have a declared workflow actor perform this operation."};case"field_writers":return{satisfied:!i||r.authors.includes(t.author),missing_fields:[],remediation:"Have a declared field writer change the protected fields."};case"approval":return{satisfied:!o||Fc(e,t,r.authors,n),missing_fields:[],remediation:`Record an independent approval with pm schema policy-approve <item-id> --policy ${e.id} after preparing the reviewed fields.`}}}function Xr(e,t,n){let r=e.policies.filter(o=>Lc(o,t)).map(o=>{let i=o.effect??"advise",s=n(o);return{policy_id:o.id,policy_fingerprint:s,rule:o.rule.kind,effect:i==="refuse"&&e.enforcement!=="refuse"?"warn":i,...Uc(o,t,s)}});return{allowed:!r.some(o=>!o.satisfied&&o.effect==="refuse"),decisions:r,warnings:r.filter(o=>!o.satisfied).map(o=>`workflow_policy:${o.effect}:${o.policy_id}:${o.rule}`)}}function Rg(e,t){return Xr(e,t,Yr)}function xg(e){let t=Nc(e),n=new Map(t.policies.map(r=>[r,Yr(r)]));return r=>Xr(t,r,o=>n.get(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]="1dd71b26-fc38-5304-9156-f32b57cc1cc0")}catch{}})();var zc=[...B],qc=[...Oe],Bc=[...pt],$g=[..._t],Lg=[...gt],Vc=[...yt],Tt=["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-attest","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"],jg=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],Fg=["install","reconcile","report","driver"],Wc=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],Gc=["upgrade"],Kc=["reopen"],Jr={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},It=Object.freeze(Tt.flatMap(e=>e in Jr?[]:e==="extension"||e==="package"?[...Wc.map(t=>`${e}-${t}`),...e==="package"?Gc.map(t=>`package-${t}`):[],e]:e==="item"?Kc.map(t=>`item-${t}`):[e])),Hc=Object.freeze(At.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&It.includes(e.alias)).map(e=>e.alias)),Ug=Object.freeze(It.filter(e=>!Hc.includes(e)));function zg(e=Tt,t=It,n=Jr){let r=new Set(t),o=new Set(e);return{missing_cli_actions:e.filter(i=>!r.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&n[i]===void 0),waived_cli_actions:e.filter(i=>!r.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&n[i]!==void 0),stale_waivers:Object.keys(n).filter(i=>!o.has(i)||r.has(i)||t.some(s=>s.startsWith(`${i}-`)))}}function qg(e){return It.includes(e)}function Bg(e){return zc.includes(e)}function Vg(e){return qc.includes(e)}function Wg(e){return Bc.includes(e)}function Gg(e){return Vc.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]="de2a2a0e-8a39-5569-9af9-cbf557bce2a9")}catch{}})();function Rt(e,t,n){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return null;let r=t.length+1,o=new Array(r),i=new Array(r),s=new Array(r);for(let c=0;c<r;c+=1)o[c]=0,i[c]=c;for(let c=1;c<=e.length;c+=1){s[0]=c;let d=s[0];for(let l=1;l<=t.length;l+=1){let u=e[c-1]===t[l-1]?0:1,f=i[l-1]+u,m=s[l-1]+1,p=i[l]+1,_=Math.min(f,m,p);c>1&&l>1&&e[c-1]===t[l-2]&&e[c-2]===t[l-1]&&(_=Math.min(_,o[l-2]+1)),s[l]=_,_<d&&(d=_)}if(d>n)return null;for(let l=0;l<r;l+=1)o[l]=i[l],i[l]=s[l]}let a=i[t.length];return a<=n?a:null}(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]="1ddb0411-5fdd-56af-a524-0f6830c288a5")}catch{}})();function Ve(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function J(e){return B.includes(e)}function Qr(e){let t=e.trim().toLowerCase();return J(t)?t:null}function Zr(e){return e.filter(t=>!J(t))}function gn(e){let t=e.trim().toLowerCase();return t.length===0?null:an[t]??null}function eo(e){let t=Ve([...e].map(i=>i.toLowerCase())),n=[],r=[];for(let i of t){let s=gn(i);if(s){n.push(s),r.push({alias:i,target:s});continue}n.push(i)}let o=[...new Map(r.map(i=>[`${i.alias}>${i.target}`,i])).values()].sort((i,s)=>i.alias.localeCompare(s.alias));return{capabilities:Ve(n),legacy_aliases:o}}function Yc(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let n=gn(t);if(n)return n;let r=Math.max(1,Math.floor(t.length*.34)),o=null,i=Number.POSITIVE_INFINITY;for(let s of B){let a=Rt(t,s,r);a!==null&&a<i&&(i=a,o=s)}return o}function to(e,t,n){let r=B.join(","),o=Yc(n)??"none";return`extension_capability_unknown:${e}:${t}:${n}:allowed=${r}:suggested=${o}`}function no(e,t,n){let r=n.map(o=>`${o.alias}>${o.target}`).join(",");return`extension_capability_legacy_alias:${e}:${t}:aliases=${r}`}function Xc(e){let t=/^extension_capability_unknown:(global|project):([^:]+):([^:]+):allowed=([^:]+):suggested=([^:]+)$/.exec(e.trim());if(!t)return null;let[,n,r,o,i,s]=t,a=n,c=i.split(",").map(m=>m.trim()).filter(m=>m.length>0),d=gn(o),u=(s==="none"?void 0:s)??d??void 0;return{layer:a,name:r,capability:o,allowed_capabilities:c,capability_contract_version:mt,suggested_capability:u,suggestion_source:u?d===u?"legacy_alias":"nearest_match":void 0,legacy_alias_target:d??void 0}}function Jc(e){let t=/^extension_capability_legacy_alias:(global|project):([^:]+):aliases=(.+)$/.exec(e.trim());if(!t)return[];let[,n,r,o]=t,i=n,s=[...B],a=[];for(let c of o.split(",")){let[d,l]=c.split(">"),u=d?.trim(),f=l?.trim().toLowerCase();!u||!f||!J(f)||a.push({layer:i,name:r,capability:u,allowed_capabilities:s,capability_contract_version:mt,suggested_capability:f,suggestion_source:"legacy_alias",legacy_alias_target:f})}return a}(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]="71c44385-0182-50f8-8e05-3aeebfe57ad9")}catch{}})();var Qc={commands:["registerCommand","command override","command handler"],renderers:["registerRenderer"],hooks:["hooks.beforeCommand","hooks.beforeMutation","hooks.afterCommand","hooks.onWrite","hooks.onRead","hooks.onIndex"],schema:["registerFlags","registerItemFields","registerItemTypes","registerRelationshipKinds","registerMigration","registerProfile"],importers:["registerImporter","registerExporter"],search:["registerSearchProvider","registerVectorStoreAdapter"],parser:["registerParser"],preflight:["registerPreflight"],services:["registerService","registerAssuranceMeasurementProvider"]},ro=":";function oo(e,t){return`${e}${ro}${yn(t)}`}function Zc(e){return e.slice(e.indexOf(ro)+1)}function yn(e){return e.trim().toLowerCase()}function ed(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let r=Qr(n);r!==null&&t.add(r)}return[...t].sort((n,r)=>n.localeCompare(r))}function io(e){let t=new Map,n=(l,u)=>{for(let f of l){let m=oo(f.layer,f.name),p=t.get(m);p===void 0&&(p=new Set,t.set(m,p)),p.add(u)}},{registrations:r,commands:o,parsers:i,preflight:s,services:a,renderers:c,hooks:d}=e;return n(r.commands,"commands"),n(o.overrides,"commands"),n(o.handlers,"commands"),n(r.flags,"schema"),n(r.item_fields,"schema"),n(r.item_types,"schema"),n(r.relationship_kinds??[],"schema"),n(r.migrations,"schema"),n(r.profiles,"schema"),n(r.importers,"importers"),n(r.exporters,"importers"),n(r.search_providers,"search"),n(r.vector_store_adapters,"search"),n(i.overrides,"parser"),n(s.overrides,"preflight"),n(a.overrides,"services"),n(r.assurance_providers??[],"services"),n(c.overrides,"renderers"),n(d.beforeCommand,"hooks"),n(d.beforeMutation,"hooks"),n(d.afterCommand,"hooks"),n(d.onWrite,"hooks"),n(d.onRead,"hooks"),n(d.onIndex,"hooks"),t}function td(e,t={}){let n=io(e),r=new Set;t.extensionName!==void 0&&r.add(yn(t.extensionName));for(let i of t.extensionNames??[])r.add(yn(i));let o=new Set;for(let[i,s]of n)if(!(r.size>0&&!r.has(Zc(i))))for(let a of s)o.add(a);return[...o].sort((i,s)=>i.localeCompare(s))}function nd(e,t){let n=io(t),r=[];for(let o of e){let i=ed(o.capabilities);if(i.length===0)continue;let s=n.get(oo(o.layer,o.name))??new Set,a=[...s].sort((d,l)=>d.localeCompare(l)),c=i.filter(d=>!s.has(d));r.push({layer:o.layer,name:o.name,declared:i,used:a,unused:c})}return r}import{createHash as rd}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]="4b085328-0791-58f5-872a-f796f9087ab4")}catch{}})();var hn=1,ao=4096,od=/^[A-Za-z0-9_-]+$/;function so(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function oy(e,t){let n=new Set;for(let r of t)if(r.cursor_semantics==="presentation"){n.add(so(r.flag));for(let o of r.aliases??[])n.add(so(o))}return Object.fromEntries(Object.entries(e).filter(([r])=>!n.has(r)))}function iy(e,t){return rd("sha256").update(e).update("\0").update(de(t)).digest("hex").slice(0,24)}function We(e,t,n,r){return Buffer.from(JSON.stringify({version:hn,fingerprint:e,after_id:t,...n===void 0?{}:{after_index:n},...r===void 0?{}:{snapshot:r}})).toString("base64url")}function ue(e){return new h(e,y.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function id(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===hn&&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 bn(e){if(typeof e!="string")throw ue("Query cursor is malformed.");let t=e.trim();if(t.length===0||t.length>ao||!od.test(t))throw ue("Query cursor is malformed.");let n;try{n=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw ue("Query cursor is malformed.")}if(!id(n))throw ue("Query cursor version or payload is unsupported.");return n}function wn(e,t){let n=bn(e);if(n.fingerprint!==t)throw ue(`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 sy(e,t){return wn(e,t).after_id}function sd(e,t,n,r){if(t===void 0)return 0;let o=wn(t,n),i=e.findIndex(s=>r(s)===o.after_id);if(i<0){if(o.after_index!==void 0)return Math.min(o.after_index,e.length);throw ue(`Query cursor item ${o.after_id} is no longer present in this result set.`)}return i+1}function ay(e,t){if(t.cursor!==void 0&&wn(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw ue("Query cursor does not match the requested snapshot.");let n=sd(e,t.cursor,t.fingerprint,t.readId),r=e.slice(n,n+t.limit),o=r.length>0&&n+r.length<e.length,i=r.at(-1);return{rows:r,has_more:o,...o&&i!==void 0?{next_cursor:We(t.fingerprint,t.readId(i),n+r.length-1,t.snapshot)}:{}}}var cy=Object.freeze({version:hn,max_length:ao});import{stripVTControlCharacters as ad}from"node:util";(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]="b4036040-c0b8-5d01-b490-3405722fd1c5")}catch{}})();var cd=["full","compact","brief","summary","counts"],my=["mutation","read","discovery","governance"],lo=["error","warning","validation_summary","recovery_bundle"],dd=["full","omit_explanation","limit_collections","compact_recovery","action_only"],ld=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"]),ud=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),fd=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),md={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},pd=3,_d=2,gd=192,yd={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},hd=lo.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:yd[e],minimum_max_estimated_tokens:gd,degradation_ladder:dd,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),bd=new Map(hd.map(e=>[e.diagnostic_class,e]));function wd(e){let[t=""]=qe(e).split(/\s+/u);return ld.has(t)?"mutation":ud.has(t)?"discovery":fd.has(t)?"governance":"read"}function uo(e,t=wd(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let r=md[t];return vd({command:n,budget_class:t,default_max_estimated_tokens:r,default_max_estimated_tokens_by_format:{toon:r,json:Math.ceil(r*pd/_d)},degradation_ladder:cd,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function vd(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 Ed=Tt.map(e=>uo(e)),kd=new Map(Ed.map(e=>[e.command,e]));function fo(e,t={}){let n=e.trim().replace(/\s+/gu," "),[r]=qe(n).split(" "),o=kd.get(r);return o?{...o,command:n}:t.generateFallback?uo(n):null}function me(e){return Math.ceil(Math.max(0,e)/4)}function mo(e){let t=bd.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${lo.join(", ")}`);return t}function Q(e){return me(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function Od(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vn(e){if(!Od(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 r=e[n];Array.isArray(r)?t[n]=n==="suggested_retry_args"?r:r.slice(0,3):r!==void 0&&(t[n]=r)}return Object.keys(t).length>0?t:void 0}function Ad(e,t){return typeof e!="string"||e.length<=t?e:`${e.slice(0,Math.max(1,t-3))}...`}function fe(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;let n="...",r=Array.from(e),o=0,i=r.length;for(;o<i;){let s=Math.ceil((o+i)/2),a=`${r.slice(0,s).join("")}${n}`;Buffer.byteLength(a,"utf8")<=t?o=s:i=s-1}return`${r.slice(0,o).join("")}${n}`}function po(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,r]of Object.entries(e))n!=="__proto__"&&!Object.hasOwn(t,n)&&(t[n]=r);return t}var Sd=new Set(["limit_collections","compact_recovery","action_only"]),Cd=new Set(["compact_recovery","action_only"]);function Td(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:Ad(e.required,160)??"Inspect the diagnostic code and retry with corrected input."},n=vn(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 Id(e,t){let n=structuredClone(e);if(t!=="full"&&(delete n.why,delete n.examples),Sd.has(t))for(let[r,o]of Object.entries(n))Array.isArray(o)&&(n[r]=o.slice(0,3));if(Cd.has(t)){let r=vn(n.recovery);r?n.recovery=r:delete n.recovery}return t!=="action_only"?po(n):Td(n)}function Ae(e,t){let n={...e,diagnostic_output:{...t,estimated_tokens:0}};for(let r=0;r<4;r+=1){let o=Q(n),i=n.diagnostic_output;if(i.estimated_tokens===o)break;i.estimated_tokens=o}return n}function Rd(e,t,n){let r=Ae(e,t);for(let i of["recovery","exit_code"])Q(r)<=n||e[i]===void 0||(delete e[i],r=Ae(e,t));let o=40;for(;Q(r)>n&&o>4;)o-=4,e.code=fe(String(e.code),o),e.required=fe(String(e.required),o),r=Ae(e,t);return r}function xd(e,t){let n=e.diagnostic_output,{estimated_tokens:r,...o}=n,i=o.omitted_fields.slice(0,8).map(u=>fe(u,32)),s={...o,omitted_fields:i,...o.omitted_fields.length>i.length?{omitted_fields_overflow_count:o.omitted_fields.length-i.length}:{}},a=vn(e.recovery),c=a&&Q(a)<=48?a:void 0,d={code:fe(String(e.code),320),required:fe(String(e.required),320),...c?{recovery:c}:{},...e.exit_code!==void 0?{exit_code:e.exit_code}:{}},l=Ae(d,s);for(;Q(l)>t&&s.omitted_fields.length>0;)s.omitted_fields.pop(),s.omitted_fields_overflow_count=o.omitted_fields.length-s.omitted_fields.length,l=Ae(d,s);return l=Rd(d,s,t),l}function py(e,t={}){let n=e,r=t.diagnosticClass??"error",o=mo(r),i=t.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<o.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${o.minimum_max_estimated_tokens}`);let s=i??o.default_max_estimated_tokens_by_format.json,a=Q(n),c=Object.keys(n);if(a<=s)return po(structuredClone(n));let d;for(let[l,u]of o.degradation_ladder.entries()){let f=Id(n,u),m=c.filter(_=>!Object.hasOwn(f,_)),p=Ae(f,{diagnostic_class:r,format:"json",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,truncated:l>0,degradation_steps:o.degradation_ladder.slice(0,l+1),omitted_fields:m});if(d=p,Q(p)<=s)break}return Q(d)>s&&(d=xd(d,s)),d}function co(e){return ad(e).replace(/\r\n/gu,`
|
|
2
2
|
`).replace(/[^\P{Cc}\n]/gu," ")}function _y(e,t,n={}){let r=n.diagnosticClass??"error",o=mo(r),i=n.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<o.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${o.minimum_max_estimated_tokens}`);let s=i??o.default_max_estimated_tokens_by_format.text,a=co(e),c=me(Buffer.byteLength(a,"utf8")),d=c>s,l=`What is required:
|
|
3
3
|
`,f=`
|
|
4
4
|
|
|
5
5
|
${fe(a.trimStart().split(/\r?\n/u,1)[0].trim(),320)}
|
|
6
6
|
|
|
7
7
|
Diagnostic output exceeded its declared ${s}-token ceiling; rerun with structured JSON for the bounded recovery envelope.`,m=co(t).trim()||"Inspect the diagnostic code and retry with corrected input.",p=Math.max(1,s*4-Buffer.byteLength(`${l}${f}`,"utf8")),_=d?`${l}${fe(m,p)}${f}`:a;return{output:_,diagnostic_output:{diagnostic_class:r,format:"text",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:c,estimated_tokens:me(Buffer.byteLength(_,"utf8")),truncated:d,degradation_steps:d?[...o.degradation_ladder]:["full"],omitted_fields:d?["explanation","collections"]:[]}}}import{createHash as h_}from"node:crypto";import{existsSync as ff}from"node:fs";import{AsyncLocalStorage as mf}from"node:async_hooks";import H from"node:path";import we from"node:fs/promises";import be from"node:path";import{pathToFileURL as Nu}from"node:url";import*as C from"node:fs/promises";import xt from"node:path";import Nd 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]="1240aa49-b3fa-57d3-b6e1-7f911005a757")}catch{}})();var Dd=[10,25,50,100];async function _o(e){await C.mkdir(e,{recursive:!0})}async function En(e){try{return await C.access(e),!0}catch{return!1}}function go(e){return _e(e)||pe(e,"ENOTDIR")}function _e(e){return pe(e,"ENOENT")}async function by(e){try{return await C.readFile(e,"utf8")}catch(t){if(go(t))return null;throw t}}async function wy(e,t){let n=xt.dirname(e);await _o(n);let r=xt.join(n,`.${xt.basename(e)}.${process.pid}.${Date.now()}.${Nd.randomBytes(4).toString("hex")}.tmp`);await C.writeFile(r,t,"utf8");try{await C.rename(r,e)}catch(o){if(process.platform==="win32"&&(pe(o,"EPERM")||pe(o,"EBUSY"))){let i=o;for(let s of Dd){await new Promise(a=>setTimeout(a,s));try{await C.rename(r,e);return}catch(a){if(i=a,!pe(a,"EPERM")&&!pe(a,"EBUSY"))break}}try{await C.unlink(r)}catch{}throw i}if(pe(o,"EXDEV")){try{await C.copyFile(r,e)}finally{try{await C.unlink(r)}catch{}}return}try{await C.unlink(r)}catch{}throw o}}async function vy(e,t){let n=xt.dirname(e);await _o(n);let r=await C.open(e,"a");try{await r.writeFile(`${t}
|
|
8
|
-
`,"utf8")}finally{await r.close()}}async function Ey(e){try{await C.unlink(e)}catch(t){if(!go(t))throw t}}function pe(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}import yo from"path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="83a29a06-1b0b-52e6-9617-2fc03861cb18")}catch{}})();function kn(e,t){let n=yo.relative(e,t);return n.length===0?!0:!n.startsWith("..")&&!yo.isAbsolute(n)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="de5f8d66-b9dc-555c-a52f-33b1b5368be3")}catch{}})();var Pd="__pm_suppress_host_output",On="@unbrained/pm-cli:suppress-host-output:v1";function ho(e){return e===void 0?{__pm_suppress_host_output:On}:{__pm_suppress_host_output:On,result:e}}function An(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&e[Pd]===On}import Se from"node:fs";import Z from"node:path";import{fileURLToPath as Md}from"node:url";(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]="dc77f588-e4ea-59fc-908f-51b41114430a")}catch{}})();var $d="@unbrained/pm-cli";function Ld(e){try{return JSON.parse(Se.readFileSync(e,"utf8")).name===$d}catch{return!1}}function jd(e){let t=Se.existsSync(e)&&Se.statSync(e).isDirectory()?Z.resolve(e):Z.dirname(Z.resolve(e));for(;;){let n=Z.join(t,"package.json");if(Se.existsSync(n)&&Ld(n))return t;let r=Z.dirname(t);if(r===t)return;t=r}}function Sn(e,t=[]){let n=Md(e),r=jd(n);return r||Z.resolve(Z.dirname(n),...t)}function Ry(e,t=[]){try{let n=Z.join(Sn(e,t),"package.json");if(!Se.existsSync(n))return;let r=JSON.parse(Se.readFileSync(n,"utf8"));return typeof r.version=="string"&&r.version.trim().length>0?r.version:void 0}catch{return}}(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]="49fe564d-671f-5425-96fe-517cb323f773")}catch{}})();function Fd(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Ny(e){return Fd(e)??void 0}function Dy(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t-=1;return t===e.length?e:e.slice(0,t)}function Py(e){return Array.isArray(e)&&e.every(t=>typeof t=="number"&&Number.isFinite(t))}function wo(e){if(e instanceof Error){let t=e.message.trim();return t.length>0?t:e.name}return String(e)}function vo(e){let t=typeof e=="number"?e:typeof e=="string"&&e.trim().length>0?Number(e.trim()):Number.NaN;return Number.isFinite(t)?t:null}function My(e){let t=vo(e);return t===null||t<=0||!Number.isInteger(t)?null:t}function $y(e,t,n){let r=vo(e);return r===null||r<t||r>n?null:r}function ee(e){return typeof e!="object"||e===null?null:e}function bo(e){return typeof e!="object"&&typeof e!="function"||e===null?null:e}function Eo(e){let t=bo(e);if(!t)return null;if(typeof t.activate=="function")return t;let n=bo(t.default);return typeof n?.activate=="function"?n:null}function Ly(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...e}:{}}import{readFileSync as Al,readdirSync as Qy,statSync as Sl}from"node:fs";import Cl from"node:os";import A from"node:path";import Vd from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0ca7f52c-fb31-5cd9-b689-a918f4e61816")}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]="7647d826-e562-5f8e-86b2-2e40d8714b4d")}catch{}})();function te(e){return[...new Set((e??[]).map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function Ud(e){let t=e.key.trim();if(t.length===0)return null;let n=te(e.aliases),r=e.description?.trim();return{key:t,values:te(e.values),required:e.required===!0?!0:void 0,aliases:n.length>0?n:void 0,description:r&&r.length>0?r:void 0}}var zd=e=>e,Oo=e=>{let t=e.trim().toLowerCase();return t==="create"||t==="update"?t:null};function qd(e,t){let n=t(e.command);if(n===null)return null;let r=e.option.trim();return r.length===0?null:{command:n,option:r,required:e.required,visible:e.visible,enabled:e.enabled}}function Bd(e,t){let n=new Map;for(let r of e??[]){let o=qd(r,t);o&&n.set(`${o.command}:${o.option.toLowerCase()}`,o)}return[...n.values()].sort((r,o)=>r.command===o.command?r.option.localeCompare(o.option):r.command.localeCompare(o.command))}function ko(e,t){return t?te(e):void 0}function Cn(e){let t=e?.trim();return t&&t.length>0?t:void 0}function Tn(e){if(e===void 0||e==="agent"||e==="human"||e==="gate")return e;throw new Error("Item type execution_role must be agent, human, or gate.")}function Ao(e,t={}){let n=t.resolvePolicyCommand??zd,r=e.name.trim();if(r.length===0)return null;let o=e.required_create_fields!==void 0,i=e.required_create_repeatables!==void 0,s=e.options!==void 0,a=e.command_option_policies!==void 0,c=te(e.aliases),d=(e.options??[]).map(u=>Ud(u)).filter(u=>u!==null).sort((u,f)=>u.key.localeCompare(f.key)),l=Bd(e.command_option_policies,n);return{name:r,description:Cn(e.description),default_status:Cn(e.default_status),...e.execution_role===void 0?{}:{execution_role:Tn(e.execution_role)},folder:Cn(e.folder),aliases:c.length>0?c:void 0,required_create_fields:ko(e.required_create_fields,o),required_create_repeatables:ko(e.required_create_repeatables,i),options:s?d:void 0,command_option_policies:a?l: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]="69ea08ca-3793-51d7-a971-95abf442028f")}catch{}})();var Wd=Object.freeze({decision:"human",milestone:"gate"}),Gd=["title","description","status","priority","tags","body","deadline","estimatedMinutes","acceptanceCriteria","author","message","assignee"],Kd=["dep","comment","note","learning","file","test","doc"],Co=["deadline","estimatedMinutes","acceptanceCriteria","definitionOfReady","order","goal","objective","value","impact","outcome","whyNow","assignee","parent","reviewer","risk","confidence","sprint","release","blockedBy","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact"],Hd=["title","description","type","status","priority","tags","body",...Co,"author","message","dep","comment","note","learning","file","test","doc","reminder","event","typeOption","field"],Yd=["title","description","body","status","closeReason","priority","type","tags",...Co,"author","message","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ownershipMetadataBypass","ownershipDependencyBypass","force"],To={"close-reason":"closeReason",close_reason:"closeReason","estimated-minutes":"estimatedMinutes",estimated_minutes:"estimatedMinutes",estimate:"estimatedMinutes","acceptance-criteria":"acceptanceCriteria",acceptance_criteria:"acceptanceCriteria",ac:"acceptanceCriteria","definition-of-ready":"definitionOfReady",definition_of_ready:"definitionOfReady",rank:"order","why-now":"whyNow",why_now:"whyNow","blocked-by":"blockedBy",blocked_by:"blockedBy","blocked-reason":"blockedReason",blocked_reason:"blockedReason","unblock-note":"unblockNote",unblock_note:"unblockNote","repro-steps":"reproSteps",repro_steps:"reproSteps","expected-result":"expectedResult",expected_result:"expectedResult","actual-result":"actualResult",actual_result:"actualResult","affected-version":"affectedVersion",affected_version:"affectedVersion","fixed-version":"fixedVersion",fixed_version:"fixedVersion","customer-impact":"customerImpact",customer_impact:"customerImpact","type-option":"typeOption",type_option:"typeOption",type_options:"typeOption"},Xd={...To},Jd={...To},Io=[["deadline","--deadline"],["estimatedMinutes","--estimate/--estimated-minutes"],["acceptanceCriteria","--acceptance-criteria/--ac"],["definitionOfReady","--definition-of-ready"],["order","--order/--rank"],["goal","--goal"],["objective","--objective"],["value","--value"],["impact","--impact"],["outcome","--outcome"],["whyNow","--why-now"],["assignee","--assignee"],["parent","--parent"],["reviewer","--reviewer"],["risk","--risk"],["confidence","--confidence"],["sprint","--sprint"],["release","--release"],["blockedBy","--blocked-by"],["blockedReason","--blocked-reason"],["unblockNote","--unblock-note"],["reporter","--reporter"],["severity","--severity"],["environment","--environment"],["reproSteps","--repro-steps"],["resolution","--resolution"],["expectedResult","--expected-result"],["actualResult","--actual-result"],["affectedVersion","--affected-version"],["fixedVersion","--fixed-version"],["component","--component"],["regression","--regression"],["customerImpact","--customer-impact"]],Ro=[["comment","--comment"],["note","--note"],["learning","--learning"],["file","--file"],["test","--test"],["doc","--doc"],["reminder","--reminder"],["event","--event"],["typeOption","--type-option"]];function xo(e){return Object.fromEntries(e)}var Qd=xo([["title","--title"],["description","--description"],["type","--type"],["status","--status"],["priority","--priority"],["tags","--tags"],["body","--body"],...Io,["author","--author"],["message","--message"],["dep","--dep"],...Ro]),Zd=xo([["title","--title"],["description","--description"],["body","--body"],["status","--status"],["closeReason","--close-reason"],["priority","--priority"],["type","--type"],["tags","--tags"],...Io,...Ro,["author","--author"],["message","--message"],["force","--force"]]);function el(e){return e.trim().replace(/^--+/,"").toLowerCase()}function tl(e){return e==="create"?Hd:Yd}function nl(e){return e==="create"?Xd:Jd}function No(e,t){let n=el(t);if(n.length===0)return;let r=nl(e)[n];return r||tl(e).find(o=>o.toLowerCase()===n)}function Gy(e,t){return(e==="create"?Qd:Zd)[t]??`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function Rn(e){let t=ol(e);return t.length===0?"items":t.endsWith("s")?t:`${t}s`}function rl(e){let t=e.trim(),r=t.replaceAll("\\","/").replace(/^\/+/,""),o=Vd.posix.normalize(r);if(t.includes("\0")||/^[A-Za-z]:/.test(o)||o==="."||o===".."||o.startsWith("../"))throw new Error(`Item type folder "${e}" must stay inside the pm tracker root.`);return o}function ol(e){let t=e.trim().toLowerCase(),n="",r=!1;for(let o of t){let i=o.charCodeAt(0),s=i>=97&&i<=122,a=i>=48&&i<=57;if(s||a){r&&n.length>0&&(n+="-"),n+=o,r=!1;continue}n.length>0&&(r=!0)}return n}function il(e){return Ao(e,{resolvePolicyCommand:Oo})}function Ge(e,t){let n=e[t];return Array.isArray(n)?n.filter(r=>typeof r=="string"):void 0}function sl(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e;return typeof t.key!="string"?null:{key:t.key,values:Ge(t,"values")??[],required:t.required===void 0?void 0:!!t.required,aliases:Ge(t,"aliases"),description:typeof t.description=="string"?t.description:void 0}}function al(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e;if(typeof t.command!="string"||typeof t.option!="string")return null;let n=t.command.trim().toLowerCase();return n!=="create"&&n!=="update"?null:{command:n,option:t.option,required:t.required===void 0?void 0:!!t.required,visible:t.visible===void 0?void 0:!!t.visible,enabled:t.enabled===void 0?void 0:!!t.enabled}}function cl(e){if(Array.isArray(e.options))return e.options.map(t=>sl(t)).filter(t=>t!==null)}function dl(e){if(Array.isArray(e.command_option_policies))return e.command_option_policies.map(t=>al(t)).filter(t=>t!==null)}function ll(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e,n=typeof t.name=="string"?t.name:"";if(n.trim().length===0)return null;let r=typeof t.folder=="string"?t.folder:void 0,o=typeof t.description=="string"?t.description:void 0,i=typeof t.default_status=="string"?t.default_status:void 0;return{name:n,description:o,default_status:i,execution_role:Tn(t.execution_role),folder:r,aliases:Ge(t,"aliases"),required_create_fields:Ge(t,"required_create_fields"),required_create_repeatables:Ge(t,"required_create_repeatables"),options:cl(t),command_option_policies:dl(t)}}function ul(e,t){return e.required_create_fields?te(e.required_create_fields):t?.required_create_fields??[]}function fl(e,t){return e.required_create_repeatables?te(e.required_create_repeatables):t?.required_create_repeatables??[]}function ml(e,t){return e.options?e.options:t?.options?[...t.options]:[]}function pl(e,t){return e.command_option_policies?e.command_option_policies:t?.command_option_policies?[...t.command_option_policies]:[]}function _l(e,t){let n=t?.name??e.name,r=e.description??t?.description,o=e.default_status??t?.default_status,i=rl(e.folder??t?.folder??Rn(n)),s={name:n,execution_role:e.execution_role,folder:i,aliases:te([...t?.aliases??[],...e.aliases??[]]),required_create_fields:ul(e,t),required_create_repeatables:fl(e,t),options:ml(e,t),command_option_policies:pl(e,t)};return r&&(s.description=r),o&&(s.default_status=o),s}function So(e,t){for(let n of e){let r=il(n);if(!r)continue;let o=r.name.toLowerCase(),i=t.get(o);t.set(o,_l({...r,execution_role:r.execution_role??i?.execution_role},i))}}function gl(e){if(!e)return[];let t=[];for(let n of e.item_types??[]){let r=n.types;if(Array.isArray(r))for(let o of r){let i=ll(o);i&&t.push(i)}}return t}function Ky(e,t=null){let n=new Map;for(let c of jr)n.set(c.toLowerCase(),{name:c,execution_role:Wd[c.toLowerCase()]??"agent",folder:Ue[c],aliases:[],required_create_fields:[...Gd],required_create_repeatables:[...Kd],options:[],command_option_policies:[]});So(e.item_types?.definitions??[],n),So(gl(t),n);let r=[...n.values()].sort((c,d)=>c.name.localeCompare(d.name)),o={},i={},s={};for(let c of r){o[c.name]=c,s[c.name]=c.folder,i[c.name.toLowerCase()]=c.name;for(let d of c.aliases)i[d.toLowerCase()]=c.name}let a=[...new Set(r.map(c=>c.folder))].sort((c,d)=>c.localeCompare(d));return{types:r.map(c=>c.name),folders:a,type_to_folder:s,by_type:o,alias_to_type:i}}function yl(e,t){if(e!==void 0)return t.alias_to_type[e.trim().toLowerCase()]}function hl(e,t){let n=yl(e,t);if(n)return t.by_type[n]}function bl(e,t,n,r){for(let o of r){let i=No(n,o);if(i){e.required.add(i);continue}e.errors.push(`Unsupported base required option "${o}" for command "${n}" on type "${t.name}"`)}}function In(e,t,n){if(n){e.add(t);return}e.delete(t)}function wl(e,t,n,r){let o=No(n,r.option);if(!o){e.errors.push(`Unsupported command_option_policies option "${r.option}" for command "${n}" on type "${t.name}"`);return}r.required!==void 0&&In(e.required,o,r.required),r.visible!==void 0&&In(e.hidden,o,!r.visible),r.enabled!==void 0&&In(e.disabled,o,!r.enabled)}function vl(e,t,n){for(let r of t.command_option_policies)r.command===n&&wl(e,t,n,r)}function El(e,t,n){for(let r of e.required)e.disabled.has(r)&&e.errors.push(`Option "${r}" cannot be both required and disabled for command "${n}" on type "${t.name}"`)}function Hy(e,t,n){let r=[],o=new Set,i=new Set,s=new Set,a={required:o,hidden:i,disabled:s,errors:r};return bl(a,e,t,n),vl(a,e,t),El(a,e,t),{required:[...o],hidden:[...i].sort((c,d)=>c.localeCompare(d)),disabled:[...s].sort((c,d)=>c.localeCompare(d)),errors:r}}function kl(e){let t=new Map;for(let n of e.options){t.set(n.key.toLowerCase(),n);for(let r of n.aliases??[])t.set(r.toLowerCase(),n)}return t}function Ol(e,t,n){let r=e.values;if(r.length===0)return t;let i=new Map(r.map(s=>[s.toLowerCase(),s])).get(t.toLowerCase());if(!i){n.push(`Invalid value "${t}" for type option "${e.key}". Allowed: ${r.join(", ")}`);return}return i}function Yy(e,t,n){let r=hl(e,n);if(!r)return{normalized:void 0,errors:[`Unknown type "${e}"`]};let o=[],i=kl(r),s={};for(let[c,d]of Object.entries(t??{})){let l=c.trim(),u=d.trim();if(l.length===0){o.push("type option keys must not be empty");continue}if(u.length===0){o.push(`type option "${l}" must not be empty`);continue}let f=i.get(l.toLowerCase());if(!f){let p=r.options.map(_=>_.key).join(", ");o.push(r.options.length>0?`Unknown type option "${l}" for type "${r.name}". Allowed: ${p}`:`Type "${r.name}" does not define any configurable type options`);continue}let m=Ol(f,u,o);m!==void 0&&(s[f.key]=m)}for(let c of r.options)c.required&&!(c.key in s)&&o.push(`Missing required type option "${c.key}" for type "${r.name}"`);let a=Object.keys(s).sort((c,d)=>c.localeCompare(d));return a.length===0?{normalized:void 0,errors:o}:{normalized:Object.fromEntries(a.map(c=>[c,s[c]])),errors: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]="124443e3-a20b-5fd6-a1d9-e4a09b17dc4a")}catch{}})();var Tl={json_markdown:".md",toon:".toon"},Il={".md":"json_markdown",".toon":"toon"};var oh=[".md",".toon"];function Nt(e){try{return Sl(e),!0}catch{return!1}}function Rl(e){try{let t=JSON.parse(Al(e,"utf8"));return typeof t!="object"||t===null||Array.isArray(t)?!1:"id_prefix"in t||"item_format"in t}catch{return!1}}function xl(e){let t=A.resolve(e);for(;;){let n=A.join(t,bt),r=A.join(n,wt);if(Nt(r))return n;let o=A.join(t,wt);if(Nt(o)&&Rl(o))return t;let i=A.dirname(t);if(i===t)return;t=i}}function Nl(e){return xl(e)??A.resolve(e,bt)}function ih(e,t){let n=process.env.PM_PATH,r=t?.trim()||n?.trim();if(r){let o=A.resolve(e,r);if(!Nt(Do(o))){let i=A.join(o,bt);if(Nt(Do(i)))return i}return o}return Nl(e)}function sh(e){let t=A.resolve(e),n=A.dirname(t);return A.basename(t)==="pm"&&A.basename(n)===".agents"?A.dirname(n):t}function Po(e){let t=process.env.PM_GLOBAL_PATH?.trim(),n=t&&t.length>0?t:A.join(Cl.homedir(),".pm-cli");return A.resolve(e,n)}function Do(e){return A.join(e,wt)}function Dl(e,t,n=Ue){let r=n[t]??Rn(t);return A.join(e,r)}function ah(e,t,n,r="toon",o=Ue){return A.join(Dl(e,t,o),`${n}${Tl[r]}`)}function ch(e){let t=e.replaceAll("\\","/"),n=A.posix.extname(t).toLowerCase();return Il[n]??null}function dh(e,t){if(!/^(?!\.{1,2}$)[^/\\:\0]+$/.test(t))throw new h("Invalid history item id: expected a single filename.",y.USAGE);return A.join(e,"history",`${t}.jsonl`)}function Mo(e,t){return A.join(e,"locks",`${t}.lock`)}function lh(e){return A.join(e,"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]="44b86710-2d6f-57fe-912d-1cf7482a4f86")}catch{}})();function $o(e){let t={beforeCommand:e.hooks.beforeCommand.length,beforeMutation:e.hooks.beforeMutation.length,afterCommand:e.hooks.afterCommand.length,onWrite:e.hooks.onWrite.length,onRead:e.hooks.onRead.length,onIndex:e.hooks.onIndex.length,commandOverrides:e.commands.overrides.length,commandHandlers:e.commands.handlers.length,parserOverrides:e.parsers.overrides.length,preflightOverrides:e.preflight.overrides.length,serviceOverrides:e.services.overrides.length,rendererOverrides:e.renderers.overrides.length,registrations:Object.fromEntries(Object.entries(e.registrations).map(([n,r])=>[n,r.length]))};return()=>{e.hooks.beforeCommand.length=t.beforeCommand,e.hooks.beforeMutation.length=t.beforeMutation,e.hooks.afterCommand.length=t.afterCommand,e.hooks.onWrite.length=t.onWrite,e.hooks.onRead.length=t.onRead,e.hooks.onIndex.length=t.onIndex,e.commands.overrides.length=t.commandOverrides,e.commands.handlers.length=t.commandHandlers,e.parsers.overrides.length=t.parserOverrides,e.preflight.overrides.length=t.preflightOverrides,e.services.overrides.length=t.serviceOverrides,e.renderers.overrides.length=t.rendererOverrides;for(let[n,r]of Object.entries(t.registrations))e.registrations[n].length=r}}(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]="aade6230-a71b-5cbc-bc9d-022f20e521bd")}catch{}})();function x(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return t}function D(e,t){if(t!==void 0&&typeof t!="boolean")throw new TypeError(`${e} must be a boolean when provided`)}function S(e,t){if(t!==void 0&&(typeof t!="string"||t.trim().length===0))throw new TypeError(`${e} must be a non-empty string when provided`)}function Lo(e,t){if(t===void 0)return;let n=r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean";if(Array.isArray(t)){for(let[r,o]of t.entries())if(!n(o))throw new TypeError(`${e}[${r}] must be a string, number, or boolean`);return}if(!n(t))throw new TypeError(`${e} must be a string, number, or boolean, or an array of these when provided`)}function ge(e,t){if(t!==void 0){if(!Array.isArray(t))throw new TypeError(`${e} must be an array of non-empty strings when provided`);for(let[n,r]of t.entries())if(typeof r!="string"||r.trim().length===0)throw new TypeError(`${e}[${n}] must be a non-empty string`)}}function Ke(e,t){if(ge(e,t),!Array.isArray(t))return[];let n=[],r=new Set;for(let o of t){let i=o.trim();i.length===0||r.has(i)||(r.add(i),n.push(i))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="34536eba-0f92-5599-a807-5b39b000e733")}catch{}})();var xn=Object.freeze(["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"]);(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]="ca48c32a-e4e0-5da5-b9cb-b1f713646bad")}catch{}})();var Pl=new Set(xn);function Ml(e){if(e!==void 0&&!Pl.has(String(e)))throw new Error(`registerCommand definition.family must be one of: ${xn.join(", ")}`)}function jo(e){S("registerCommand definition.action",e.action),S("registerCommand definition.family",e.family),S("registerCommand definition.description",e.description),S("registerCommand definition.intent",e.intent),S("registerCommand definition.tier",e.tier);let t=e.tier;if(t!==void 0&&t!=="core"&&t!=="standard"&&t!=="full"&&t!=="internal")throw new Error("registerCommand definition.tier must be core, standard, full, or internal");Ml(e.family)}(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]="1729c469-5e9c-5d8c-8137-ec506c9fd31b")}catch{}})();function $l(e){let t=x("registerExporter options.output",e),n=new Set(["channel","receipt","media_type"]);for(let r of Object.keys(t))if(!n.has(r))throw new TypeError(`registerExporter options.output contains unsupported field ${r}`);if(t.channel!=="stdout"&&t.channel!=="file")throw new TypeError("registerExporter options.output.channel must be stdout|file");if(t.receipt!==void 0&&t.receipt!=="suppress"&&t.receipt!=="render")throw new TypeError("registerExporter options.output.receipt must be suppress|render");if(t.channel==="stdout"&&t.receipt==="render")throw new TypeError("registerExporter stdout artifacts cannot render a host receipt");return S("registerExporter options.output.media_type",t.media_type),{channel:t.channel,receipt:t.receipt??(t.channel==="stdout"?"suppress":"render"),...typeof t.media_type=="string"?{media_type:t.media_type}:{}}}function Fo(e,t,n){if(e==="registerImporter"&&t.output!==void 0)throw new TypeError("registerImporter options.output is exporter-only");if(e!=="registerExporter"||t.output===void 0)return;let r=$l(t.output);return!n&&r.channel==="stdout"&&(t.description="Export items with the registered extension adapter. Artifact bytes are written exclusively to stdout and the host receipt is suppressed by default."),r}function Nn(e,t,n){return{registration:t,action:n,command:e.command,args:P(e.args),options:P(e.options),global:P(e.global),pm_root:e.pm_root,source_workspace_root:e.source_workspace_root,repo_root:e.repo_root,pm_root_rel:e.pm_root_rel,...e.sdk===void 0?{}:{sdk:e.sdk}}}(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]="b35d854e-5025-5999-abe7-507f1a25647f")}catch{}})();function Uo(e){return!e.extensionReady||!e.enabledForLoad?null:{layer:e.layer,directory:e.directory,manifest_path:e.manifestPath,entry_path:e.entryPath,manifest:e.manifest,source_package:e.sourceIdentity?.package_name,source_aliases:e.sourceIdentity?.aliases,contributions:e.sourceIdentity?.contributions}}(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]="8ea4597b-6a2b-5061-b490-d8aff3fbe7aa")}catch{}})();function U(e){return typeof e!="string"?"":e.trim().toLowerCase()}function b(e){return new Set((e??[]).map(t=>t.trim().toLowerCase()).filter(t=>t.length>0))}function Ll(e){let t=e.trim().toLowerCase();if(t.length===0)return"";let n=t.split(/[.:/]/).map(r=>r.replace(/[\s_-]+/g,"")).filter(r=>r.length>0);return n.length===0?"":n.length===1?n[0]:`${n[0]}.${n.slice(1).join("")}`}function Ce(e){return new Set((e??[]).map(t=>Ll(t)).filter(t=>t.length>0))}function zo(e){let t=U(e);return pt.includes(t)?t:"off"}function qo(e){let t=U(e);return _t.includes(t)?t:"off"}function He(e){let t=U(e);return gt.includes(t)?t:"none"}function Dn(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return Lr.includes(t)?t:void 0}function Bo(e){if(typeof e=="string"){let t=Dn(e)??"block";return{global:t,project:t}}return typeof e=="object"&&e!==null&&!Array.isArray(e)?{global:Dn(e.global)??"block",project:Dn(e.project)??"block"}:{global:"block",project:"block"}}function jl(e){return e.global===e.project?e.global:{global:e.global,project:e.project}}function E(e){return[...new Set(e)].sort((t,n)=>t.localeCompare(n))}function Fl(e){let t=U(e.name);return t.length===0?null:{name:t,normalized:{name:t,disabled:e.disabled===!0,requireTrusted:e.require_trusted===!0,requireProvenance:e.require_provenance===!0,sandboxProfile:e.sandbox_profile!==void 0?He(e.sandbox_profile):void 0,allowedCapabilities:b(e.allowed_capabilities),blockedCapabilities:b(e.blocked_capabilities),allowedSurfaces:Ce(e.allowed_surfaces),blockedSurfaces:Ce(e.blocked_surfaces),allowedCommands:b(e.allowed_commands),blockedCommands:b(e.blocked_commands),allowedActions:b(e.allowed_actions),blockedActions:b(e.blocked_actions),allowedServices:b(e.allowed_services),blockedServices:b(e.blocked_services)}}}function Vo(e){let t=new Map;for(let n of e??[]){let r=Fl(n);r&&t.set(r.name,r.normalized)}return t}function Ul(e){let t=[],n=[...e.overridesByName.values()].sort((o,i)=>o.name.localeCompare(i.name));for(let o of E([...e.allowedCapabilities,...e.blockedCapabilities]))J(o)||t.push(`extension_policy_unknown_capability:${o}`);for(let o of n)for(let i of E([...o.allowedCapabilities,...o.blockedCapabilities]))J(i)||t.push(`extension_policy_unknown_capability:${o.name}:${i}`);let r=new Set(yt);for(let o of E([...e.allowedSurfaces,...e.blockedSurfaces]))r.has(o)||t.push(`extension_policy_unknown_surface:${o}`);for(let o of n)for(let i of E([...o.allowedSurfaces,...o.blockedSurfaces]))r.has(i)||t.push(`extension_policy_unknown_surface:${o.name}:${i}`);return[...new Set(t)].sort((o,i)=>o.localeCompare(i))}function Wo(e){let t=e.extensions?.policy??{},n=b(t.allowed_capabilities),r=b(t.blocked_capabilities),o=Ce(t.allowed_surfaces),i=Ce(t.blocked_surfaces),s=Vo(t.extension_overrides);return{mode:zo(t.mode),trustMode:qo(t.trust_mode),pmMaxVersionExceededMode:Bo(t.pm_max_version_exceeded_mode),requireProvenance:t.require_provenance===!0,trustedExtensions:b(t.trusted_extensions),defaultSandboxProfile:He(t.default_sandbox_profile),allowedExtensions:b(t.allowed_extensions),blockedExtensions:b(t.blocked_extensions),allowedCapabilities:n,blockedCapabilities:r,allowedSurfaces:o,blockedSurfaces:i,allowedCommands:b(t.allowed_commands),blockedCommands:b(t.blocked_commands),allowedActions:b(t.allowed_actions),blockedActions:b(t.blocked_actions),allowedServices:b(t.allowed_services),blockedServices:b(t.blocked_services),overridesByName:s,warnings:Ul({allowedCapabilities:n,blockedCapabilities:r,allowedSurfaces:o,blockedSurfaces:i,overridesByName:s})}}function Go(e){let t=[...e.overridesByName.values()].sort((n,r)=>n.name.localeCompare(r.name)).map(n=>({name:n.name,...n.disabled?{disabled:!0}:{},...n.requireTrusted?{require_trusted:!0}:{},...n.requireProvenance?{require_provenance:!0}:{},...n.sandboxProfile?{sandbox_profile:n.sandboxProfile}:{},...n.allowedCapabilities.size>0?{allowed_capabilities:E(n.allowedCapabilities)}:{},...n.blockedCapabilities.size>0?{blocked_capabilities:E(n.blockedCapabilities)}:{},...n.allowedSurfaces.size>0?{allowed_surfaces:E(n.allowedSurfaces)}:{},...n.blockedSurfaces.size>0?{blocked_surfaces:E(n.blockedSurfaces)}:{},...n.allowedCommands.size>0?{allowed_commands:E(n.allowedCommands)}:{},...n.blockedCommands.size>0?{blocked_commands:E(n.blockedCommands)}:{},...n.allowedActions.size>0?{allowed_actions:E(n.allowedActions)}:{},...n.blockedActions.size>0?{blocked_actions:E(n.blockedActions)}:{},...n.allowedServices.size>0?{allowed_services:E(n.allowedServices)}:{},...n.blockedServices.size>0?{blocked_services:E(n.blockedServices)}:{}}));return{mode:e.mode,trust_mode:e.trustMode,pm_max_version_exceeded_mode:jl(e.pmMaxVersionExceededMode),require_provenance:e.requireProvenance,trusted_extensions:E(e.trustedExtensions),default_sandbox_profile:e.defaultSandboxProfile,allowed_extensions:E(e.allowedExtensions),blocked_extensions:E(e.blockedExtensions),allowed_capabilities:E(e.allowedCapabilities),blocked_capabilities:E(e.blockedCapabilities),allowed_surfaces:E(e.allowedSurfaces),blocked_surfaces:E(e.blockedSurfaces),allowed_commands:E(e.allowedCommands),blocked_commands:E(e.blockedCommands),allowed_actions:E(e.allowedActions),blocked_actions:E(e.blockedActions),allowed_services:E(e.allowedServices),blocked_services:E(e.blockedServices),extension_overrides:t}}function Ko(e){let t=Vo(e.extension_overrides);return{mode:zo(e.mode),trustMode:qo(e.trust_mode),pmMaxVersionExceededMode:Bo(e.pm_max_version_exceeded_mode),requireProvenance:e.require_provenance===!0,trustedExtensions:b(e.trusted_extensions),defaultSandboxProfile:He(e.default_sandbox_profile),allowedExtensions:b(e.allowed_extensions),blockedExtensions:b(e.blocked_extensions),allowedCapabilities:b(e.allowed_capabilities),blockedCapabilities:b(e.blocked_capabilities),allowedSurfaces:Ce(e.allowed_surfaces),blockedSurfaces:Ce(e.blocked_surfaces),allowedCommands:b(e.allowed_commands),blockedCommands:b(e.blocked_commands),allowedActions:b(e.allowed_actions),blockedActions:b(e.blocked_actions),allowedServices:b(e.allowed_services),blockedServices:b(e.blocked_services),overridesByName:t,warnings:[]}}function ne(e,t){return e.overridesByName.get(U(t))??null}function Te(e,t,n,r,o){return t.has(n)?o:e.size>0&&!e.has(n)?r:null}function Ho(e,t,n){let r=n.trim().toLowerCase(),o=ne(e,t.name),i=o&&o.allowedCapabilities.size>0?o.allowedCapabilities:e.allowedCapabilities,s=new Set([...e.blockedCapabilities,...o?o.blockedCapabilities:[]]);return Te(i,s,r,"capability_not_allowlisted","capability_blocked")}function zl(e,t,n){let r=ne(e,t.name),o=r&&r.allowedSurfaces.size>0?r.allowedSurfaces:e.allowedSurfaces,i=new Set([...e.blockedSurfaces,...r?r.blockedSurfaces:[]]);return Te(o,i,n,"surface_not_allowlisted","surface_blocked")}function ql(e,t,n){let r=O(n);if(r.length===0)return null;let o=ne(e,t.name),i=o&&o.allowedCommands.size>0?o.allowedCommands:e.allowedCommands,s=new Set([...e.blockedCommands,...o?o.blockedCommands:[]]);return Te(i,s,r,"command_not_allowlisted","command_blocked")}function Bl(e,t,n){let r=U(n).replace(/\s+/g,"-");if(r.length===0)return null;let o=ne(e,t.name),i=o&&o.allowedActions.size>0?o.allowedActions:e.allowedActions,s=new Set([...e.blockedActions,...o?o.blockedActions:[]]);return Te(i,s,r,"action_not_allowlisted","action_blocked")}function Vl(e,t,n){let r=U(n);if(r.length===0)return null;let o=ne(e,t.name),i=o&&o.allowedServices.size>0?o.allowedServices:e.allowedServices,s=new Set([...e.blockedServices,...o?o.blockedServices:[]]);return Te(i,s,r,"service_not_allowlisted","service_blocked")}function Wl(e,t){let n=U(t.name);return ne(e,t.name)?.disabled===!0?"extension_override_disabled":Te(e.allowedExtensions,e.blockedExtensions,n,"extension_not_allowlisted","extension_blocked")}function Gl(e,t){if(e.trustMode==="off")return null;let n=ne(e,t.name),r=U(t.name),o=t.trusted===!0,i=t.provenanceVerified===!0;return e.trustedExtensions.size>0&&!e.trustedExtensions.has(r)?"extension_not_trusted":(n?.requireTrusted===!0||e.trustMode==="warn"||e.trustMode==="enforce")&&!o?"extension_untrusted":(e.requireProvenance||n?.requireProvenance===!0)&&!i?"provenance_missing_or_unverified":null}function Kl(e,t){if(e.mode==="off")return null;let r=ne(e,t.name)?.sandboxProfile??t.sandboxProfile??e.defaultSandboxProfile;if(r==="none")return null;let o=t.permissions;if(!o)return"sandbox_permissions_missing";let i=s=>o[s]===!0;return r==="restricted"?i("process_spawn")?"sandbox_restricted_disallows_process_spawn":i("env_write")?"sandbox_restricted_disallows_env_write":null:i("process_spawn")?"sandbox_strict_disallows_process_spawn":i("network")?"sandbox_strict_disallows_network":i("fs_write")?"sandbox_strict_disallows_fs_write":i("env_write")?"sandbox_strict_disallows_env_write":null}function Dt(e,t,n,r,o={}){let i=Object.entries(o).sort((a,c)=>a[0].localeCompare(c[0])).map(([a,c])=>`${a}=${c}`).join(":"),s=i.length>0?`:${i}`:"";return`extension_policy_${e}_${t}:${n.layer}:${n.name}:reason=${r}${s}`}function Yo(e,t){if(e.mode==="off"&&e.trustMode==="off")return{allowed:!0,warning:null};let n=[],r=Wl(e,t);r&&n.push({reason:r,scope:"extension",mode:e.mode});let o=Gl(e,t);o&&n.push({reason:o,scope:"trust",mode:e.trustMode});let i=Kl(e,t);i&&n.push({reason:i,scope:"extension",mode:e.mode});let s=n.find(c=>c.mode==="enforce");if(s)return{allowed:!1,warning:Dt("blocked",s.scope,t,s.reason)};let a=n.find(c=>c.mode==="warn");return a?{allowed:!0,warning:Dt("violation",a.scope,t,a.reason)}:{allowed:!0,warning:null}}function Xo(e,t,n){if(e.mode==="off")return{allowed:!0,warning:null};let r=Ho(e,t,n);return r?{allowed:e.mode==="warn",warning:Dt(e.mode==="warn"?"violation":"blocked","capability",t,r,{capability:n.trim().toLowerCase()})}:{allowed:!0,warning:null}}function Hl(e,t,n,r,o){let i=typeof r=="string"?Ho(e,t,r):null,s=zl(e,t,n),a=o.command?ql(e,t,o.command):null,c=o.action?Bl(e,t,o.action):null,d=o.service?Vl(e,t,o.service):null;return i??s??a??c??d}function Yl(e,t,n,r){let o={method:U(e).replace(/\s+/g,"_"),surface:t};return n&&(o.capability=n),r.command&&(o.command=O(r.command)),r.action&&(o.action=U(r.action).replace(/\s+/g,"-")),r.service&&(o.service=U(r.service)),o}function Jo(e,t,n,r,o,i){if(e.mode==="off")return{allowed:!0,warning:null};let s=i??{},a=Hl(e,t,n,o,s);if(!a)return{allowed:!0,warning:null};let c=Dt(e.mode==="warn"?"violation":"blocked","registration",t,a,Yl(r,n,o,s));return{allowed:e.mode==="warn",warning:c}}(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]="01116a5e-62d1-591b-9fd0-84ac6e99f8d0")}catch{}})();function Pt(){return{beforeCommand:[],beforeMutation:[],afterCommand:[],onWrite:[],onRead:[],onIndex:[]}}function Pn(){return{overrides:[],handlers:[]}}function Mn(){return{overrides:[]}}function $n(){return{overrides:[]}}function Ln(){return{overrides:[]}}function jn(){return{overrides:[]}}function Fn(){return{commands:[],flags:[],item_fields:[],item_types:[],relationship_kinds:[],migrations:[],profiles:[],importers:[],exporters:[],search_providers:[],vector_store_adapters:[],assurance_providers:[]}}(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]="1c944ddd-e05b-5d8c-bdc5-7bc9677fa5d1")}catch{}})();var Zo=100;function Qo(e,t){let n=e[t];if(n!=null)return typeof n!="string"||n.trim().length===0?null:n.trim()}function Xl(e){if(e==null)return;let t=ee(e);if(!t)return null;let n={};for(let r of Object.keys(t).sort((o,i)=>o.localeCompare(i))){if(r.trim().length===0)return null;let o=t[r];if(typeof o!="string"||o.trim().length===0)return null;n[r.trim()]=o.trim()}return Object.keys(n).length>0?n:void 0}function Un(e,t){let n=e[t];return typeof n!="string"||n.trim().length===0?null:n.trim()}function ei(e){if(e!=null)return typeof e!="number"||!Number.isInteger(e)?null:e}function ye(e){if(e!=null)return typeof e!="boolean"?null:e}function Jl(e){let t=ei(e.priority);return t===void 0?Zo:t}function Ql(e){let t=e.sandbox_profile;if(t==null)return;if(typeof t!="string")return null;let n=He(t);return n!==t.trim().toLowerCase()?null:n}function zn(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function Zl(e){if(e==null)return;let t=ee(e);if(!t)return null;let n=zn(t.source),r=zn(t.signature),o=zn(t.attestation),i=t.verified===void 0||t.verified===null?void 0:typeof t.verified=="boolean"?t.verified:null;return i===null?null:{...n?{source:n}:{},...r?{signature:r}:{},...o?{attestation:o}:{},...typeof i=="boolean"?{verified:i}:{}}}function eu(e){if(e==null)return;let t=ee(e);if(!t)return null;let n=ye(t.fs_read),r=ye(t.fs_write),o=ye(t.network),i=ye(t.env_read),s=ye(t.env_write),a=ye(t.process_spawn);return[n,r,o,i,s,a].includes(null)?null:{...typeof n=="boolean"?{fs_read:n}:{},...typeof r=="boolean"?{fs_write:r}:{},...typeof o=="boolean"?{network:o}:{},...typeof i=="boolean"?{env_read:i}:{},...typeof s=="boolean"?{env_write:s}:{},...typeof a=="boolean"?{process_spawn:a}:{}}}function tu(e){if(e==null)return{capabilities:[],legacy_aliases:[]};if(!Array.isArray(e)||e.some(n=>typeof n!="string"))return null;let t=eo(e);return{capabilities:t.capabilities,legacy_aliases:t.legacy_aliases}}function nu(e){if(e==null)return;let t=ee(e);if(!t)return null;let n=t.commands;if(n==null)return;if(!Array.isArray(n)||n.some(o=>typeof o!="string"))return null;let r=[...new Set(n.map(o=>O(o)).filter(o=>o.length>0))].sort((o,i)=>o.localeCompare(i));return r.length>0?{commands:r}:void 0}function ru(e){let t=ei(e.manifest_version);if(t===null)return null;let n=Qo(e,"pm_min_version");if(n===null)return null;let r=Qo(e,"pm_max_version");if(r===null)return null;let o=Xl(e.engines);if(o===null)return null;let i=ye(e.trusted);if(i===null)return null;let s=Ql(e);if(s===null)return null;let a=Zl(e.provenance);if(a===null)return null;let c=eu(e.permissions);if(c===null)return null;let d=tu(e.capabilities);if(d===null)return null;let l=nu(e.activation);if(l===null)return null;let u=Ot(e.contributions);return u===null?null:{manifest_version:t,pm_min_version:n,pm_max_version:r,engines:o,trusted:i,sandbox_profile:s,provenance:a,permissions:c,capabilities:d.capabilities,legacy_capability_aliases:d.legacy_aliases,activation:l,contributions:u}}function qn(e){if(typeof e!="object"||e===null)return null;let t=e,n=Un(t,"name");if(n===null)return null;let r=Un(t,"version");if(r===null)return null;let o=Un(t,"entry");if(o===null)return null;let i=Jl(t);if(i===null)return null;let s=ru(t);return s===null?null:{name:n,version:r,entry:o,priority:i,manifest_version:s.manifest_version,pm_min_version:s.pm_min_version,pm_max_version:s.pm_max_version,engines:s.engines,trusted:s.trusted,provenance:s.provenance,sandbox_profile:s.sandbox_profile,permissions:s.permissions,activation:s.activation,contributions:s.contributions,capabilities:s.capabilities,legacy_capability_aliases:s.legacy_capability_aliases.length>0?s.legacy_capability_aliases:void 0}}import{constants as re}from"node:os";(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]="aaf1c6ce-1bc9-5974-a38f-7daf8e4e63cc")}catch{}})();var ti=new Map([["EACCES",{summary:"was denied filesystem permission",recovery:"Grant the required filesystem access, then retry.",category:"permission"}],["EDQUOT",{summary:"exceeded the filesystem quota",recovery:"Raise or reclaim the filesystem quota, then retry.",category:"capacity"}],["EMFILE",{summary:"exhausted the process file-descriptor limit",recovery:"Close unused file handles or raise the process limit, then retry.",category:"resource"}],["ENFILE",{summary:"exhausted the host file-descriptor limit",recovery:"Free host file descriptors or raise the host limit, then retry.",category:"resource"}],["ENOMEM",{summary:"ran out of available memory",recovery:"Free memory or reduce concurrent work, then retry.",category:"resource"}],["ENOSPC",{summary:"ran out of storage space",recovery:"Free storage on the filesystem holding the project, then retry.",category:"capacity"}],["EPERM",{summary:"was denied by the host permission policy",recovery:"Grant the required filesystem permission, then retry.",category:"permission"}],["EROFS",{summary:"targeted a read-only filesystem",recovery:"Use a writable project filesystem or remount it read-write, then retry.",category:"permission"}]]),ou=/^[a-z][a-z0-9_]{0,63}$/u,iu=new Map([[re.errno.EACCES,"EACCES"],[re.errno.EDQUOT,"EDQUOT"],[re.errno.EMFILE,"EMFILE"],[re.errno.ENFILE,"ENFILE"],[re.errno.ENOMEM,"ENOMEM"],[re.errno.ENOSPC,"ENOSPC"],[re.errno.EPERM,"EPERM"],[re.errno.EROFS,"EROFS"]].filter(([e])=>Number.isInteger(e))),su={capacity:{code:"host_environment_capacity_fault"},permission:{code:"host_environment_permission_fault"},resource:{code:"host_environment_resource_fault"}};function au(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.code=="string"&&ti.has(t.code)?t.code:typeof t.errno!="number"||!Number.isInteger(t.errno)?null:iu.get(Math.abs(t.errno))??null}function cu(e,t,n={}){let r=au(e);if(r===null)return null;if(!ou.test(t))throw new h("Host environment operation labels must be bounded identifiers.",y.USAGE,{code:"host_environment_operation_invalid",field:"operation"});let o=ti.get(r);return new h(`Host filesystem operation ${t} ${o.summary}.`,y.GENERIC_FAILURE,{code:n.codes?.[o.category]??su[o.category].code,reason:r,required:o.recovery,why:n.why??"The operating system refused a required project filesystem operation.",nextSteps:[o.recovery,...n.nextSteps??[]],...n.suggestedRetry?{recovery:{suggested_retry:n.suggestedRetry}}:{}})}async function ni(e,t,n={}){try{return await t()}catch(r){throw cu(r,e,n)??r}}import du from"node:fs/promises";import Ye from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6d77d806-1c41-5235-b56b-802089979395")}catch{}})();async function ri(e,t){let n=Ye.dirname(t.manifest_path),r=Ye.relative(n,t.entry_path);if(r.startsWith("..")||Ye.isAbsolute(r))throw new Error(`Cannot snapshot extension entry outside its package directory: ${t.entry_path}`);let o=Ye.join(e,`${t.layer}-${t.directory.replace(/[^a-zA-Z0-9._-]/gu,"_")}`);return await ni("extension_module_graph_snapshot",()=>du.cp(n,o,{recursive:!0,force:!0})),Ye.join(o,r)}(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]="092f2852-fa07-5f0f-8266-e9e2ca078cb6")}catch{}})();function oi(e){let t=typeof e=="function"?e:e.run;if(typeof t!="function")throw new TypeError("registerPreflight override requires a function handler");let n=[...new Set((typeof e=="function"?[]:e.commands??[]).map(r=>{if(typeof r!="string"||r.trim().length===0)throw new TypeError("registerPreflight ownership.commands must contain non-empty command paths");return O(r)}))];return{run:t,...n.length>0?{commands:n}:{}}}function ii(e){let t=[];for(let n=1;n<e.overrides.length;n+=1){let r=e.overrides[n];for(let o of e.overrides.slice(0,n))r.commands?.length&&o.commands?.length&&!o.commands.some(i=>r.commands.includes(i))||t.push(`extension_preflight_override_collision:${r.layer}:${r.name}:${o.layer}:${o.name}`)}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="09098e5c-d021-53ae-96b5-c56394c304da")}catch{}})();var lu=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"}]),Bn=new Set(lu.flatMap(e=>[e.flag,...e.aliases??[]]));(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]="f823edae-b035-5547-8d81-2761a9a44034")}catch{}})();var uu=/^--[a-z0-9][a-z0-9_-]*(?:[ =](?:<[^<>]+>|\[[^[\]]+\]))?$/;function fu(e){if(typeof e!="string")return null;let t=e.trim(),n=t.split(/[ =]/,1)[0];return Bn.has(n)?"host_owned_flag_collision":uu.test(t)?null:"malformed_long_flag"}function si(e,t){let n=[e,t].find(i=>typeof i=="string"&&Bn.has(i.trim().split(/[ =]/,1)[0]));if(typeof n=="string")return{token:n.trim().split(/[ =]/,1)[0],failure:"host_owned_flag_collision"};if(typeof e!="string")return null;let r=e.trim(),o=fu(r);return o===null?null:{token:r,failure:o}}function ai(e,t){return t==="host_owned_flag_collision"?`cannot shadow host-owned global flag "${e}"; read it from context.global instead`:`long flag "${e}" must start with a double-dash name such as "--my-flag" or "--my-flag <value>"`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="31da4a5a-1e85-5d77-a09f-2736cc44d850")}catch{}})();var mu=Object.freeze({string:"string",number:"number",int:"number",integer:"number",float:"number",boolean:"boolean",bool:"boolean"});function ci(e){return typeof e!="string"?null:mu[e.trim().toLowerCase()]??null}function di(e){let t=[],n=r=>{if(Array.isArray(r)){for(let o of r)n(o);return}if(typeof r=="string"){for(let o of r.split(",")){let i=o.trim();i.length>0&&t.push(i)}return}r!=null&&t.push(r)};return n(e),t}function li(e,t){return t==="string"?!0:t==="number"?typeof e=="number"?Number.isFinite(e):typeof e=="string"&&e.trim().length>0&&Number.isFinite(Number(e)):typeof e=="boolean"?!0:typeof e=="string"&&["true","false","1","0"].includes(e.trim().toLowerCase())}(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]="99f785c2-7c67-5564-9423-3439c41b4557")}catch{}})();var Mt=Fr;function ui(e){let t=e.trim().toLowerCase();return Mt.includes(t)?t:null}function fi(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let n=Math.max(1,Math.floor(t.length*.34));for(let r of Mt)if(Rt(t,r,n)!==null)return r;return null}(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]="483b4197-5498-568a-bcc4-abd6999a07cc")}catch{}})();function mi(e){return e==="toon"||e==="json"}function pi(e){return Oe.includes(e)}function he(e,t){if(typeof t!="function")throw new TypeError(`api.hooks.${e} requires a function handler`)}var _i=Symbol("extension_registration_trace");function K(e,t){let n=new TypeError(e);return Object.defineProperty(n,_i,{value:t,enumerable:!1,configurable:!1,writable:!1}),n}function gi(e){return e instanceof Error?e[_i]:void 0}function Xe(e){if(e===null)return null;if(Array.isArray(e))return e.map(t=>Xe(t));if(typeof e=="function")return"[Function]";if(typeof e=="bigint"||typeof e=="symbol")return e.toString();if(typeof e=="object"){let t=e,n={};for(let r of Object.keys(t).sort((o,i)=>o.localeCompare(i)))n[r]=Xe(t[r]);return n}return e}function Je(e){if(Array.isArray(e))return e.map(t=>Je(t));if(typeof e=="object"&&e!==null){let t=e,n={};for(let r of Object.keys(t).sort((o,i)=>o.localeCompare(i)))n[r]=Je(t[r]);return n}return e}function Ie(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Xe(t)}function Qe(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Je(t)}function Ze(e,t){if(!Array.isArray(t))throw new TypeError(`${e} requires an array of object definitions`);return t.map(n=>Ie(e,n))}function M(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function et(e,t){if(typeof t!="function")throw new TypeError(`${e} requires a function handler`)}function Vn(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function Wn(e,t){return O(`${e} ${t}`)}function tt(e,t){return Object.defineProperty(e,"runtime_definition",{value:t,enumerable:!1,writable:!1,configurable:!1}),e}var pu=new Set(["low","medium","high"]),_u=new Set(["number","string_set"]),gu=new Set(["string","number","boolean"]);function yi(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function yu(e,t,n){let r=`registerAssuranceMeasurementProvider provider.keys.${t}`,o=x(r,n);if(!_u.has(String(o.value_type)))throw new TypeError(`${r}.value_type must be number or string_set`);if(S(`${r}.description`,o.description),o.parameters===void 0)return;let i=x(`${r}.parameters`,o.parameters);for(let[s,a]of Object.entries(i)){let c=`${r}.parameters.${s}`;yi(`${c}.name`,s);let d=x(c,a);if(!gu.has(String(d.type)))throw new TypeError(`${c}.type must be string, number, or boolean`);D(`${c}.required`,d.required),S(`${c}.description`,d.description)}if(Object.keys(i).length>50)throw new TypeError(`assurance provider ${e} key ${t} exceeds 50 parameters`)}function hi(e){let t=x("registerAssuranceMeasurementProvider provider",e),n=yi("registerAssuranceMeasurementProvider provider.id",t.id);if(!/^[a-z0-9][a-z0-9-]*$/u.test(n))throw new TypeError("registerAssuranceMeasurementProvider provider.id must be a stable lowercase id");if(!pu.has(String(t.cost_class)))throw new TypeError("registerAssuranceMeasurementProvider provider.cost_class must be low, medium, or high");if(typeof t.network!="boolean")throw new TypeError("registerAssuranceMeasurementProvider provider.network must be boolean");let r=x("registerAssuranceMeasurementProvider provider.keys",t.keys);if(Object.keys(r).length===0)throw new TypeError("registerAssuranceMeasurementProvider provider.keys requires at least one key");for(let[o,i]of Object.entries(r)){if(!/^[a-z0-9][a-z0-9-]*$/u.test(o))throw new TypeError(`registerAssuranceMeasurementProvider provider key ${o} must be a stable lowercase id`);yu(n,o,i)}if(t.timeout_ms!==void 0&&(typeof t.timeout_ms!="number"||!Number.isInteger(t.timeout_ms)||t.timeout_ms<1||t.timeout_ms>3e5))throw new TypeError("registerAssuranceMeasurementProvider provider.timeout_ms must be an integer from 1 through 300000");if(typeof t.resolve!="function")throw new TypeError("registerAssuranceMeasurementProvider provider.resolve requires a function handler")}(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]="7640f483-6c14-56f1-bccd-cec9ca88e6ea")}catch{}})();var hu=new Set(["default","description","enabled","list","long","repeatable","required","short","type","value_name","value_type","visible"]);function $t(e,t){return Ze(e,t).map(n=>(n.repeatable===!0&&(n.list=!0),n))}function bu(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Gn(e,t){if(t===void 0)return e.replace(/\s+/g,"-");if(typeof t!="string"||t.trim().length===0)throw new TypeError("registerCommand definition.action must be a non-empty string when provided");let n=bu(t);if(n.length===0)throw new TypeError("registerCommand definition.action must contain alphanumeric characters");return n}function Kn(e){if(e===void 0)return[];if(!Array.isArray(e))throw new TypeError("registerCommand definition.arguments must be an array when provided");let t=[];for(let[r,o]of e.entries()){let i=x(`registerCommand definition.arguments[${r}]`,o),s=M(`registerCommand definition.arguments[${r}].name`,i.name);if(D(`registerCommand definition.arguments[${r}].required`,i.required),D(`registerCommand definition.arguments[${r}].variadic`,i.variadic),S(`registerCommand definition.arguments[${r}].description`,i.description),s.includes(" "))throw new TypeError(`registerCommand definition.arguments[${r}].name must not contain spaces`);let a={name:s};i.required===!0&&(a.required=!0),i.variadic===!0&&(a.variadic=!0),typeof i.description=="string"&&(a.description=i.description.trim()),t.push(a)}let n=t.map((r,o)=>r.variadic?o:-1).filter(r=>r>=0);if(n.length>1)throw new TypeError("registerCommand definition.arguments supports at most one variadic argument");if(n.length===1&&n[0]!==t.length-1)throw new TypeError("registerCommand definition.arguments variadic argument must be the final argument");return t}function Lt(e){if(!Array.isArray(e))throw new TypeError("registerFlags flags requires an array of object definitions");for(let[t,n]of e.entries()){let r=x(`registerFlags flags[${t}]`,n),o=Object.keys(r).filter(c=>!hu.has(c)).sort((c,d)=>c.localeCompare(d));if(o.length>0)throw new TypeError(`registerFlags flags[${t}] contains unknown field(s): ${o.join(", ")}`);let i=r.long,s=r.short;if(i===void 0&&s===void 0)throw new TypeError(`registerFlags flags[${t}] requires at least one of long or short`);S(`registerFlags flags[${t}].long`,i),S(`registerFlags flags[${t}].short`,s);let a=si(i,s);if(a!==null)throw new TypeError(`registerFlags flags[${t}] ${ai(a.token,a.failure)}`);if(S(`registerFlags flags[${t}].value_name`,r.value_name),S(`registerFlags flags[${t}].description`,r.description),D(`registerFlags flags[${t}].required`,r.required),D(`registerFlags flags[${t}].enabled`,r.enabled),D(`registerFlags flags[${t}].visible`,r.visible),D(`registerFlags flags[${t}].list`,r.list),D(`registerFlags flags[${t}].repeatable`,r.repeatable),r.list!==void 0&&r.repeatable!==void 0&&r.list!==r.repeatable)throw new TypeError(`registerFlags flags[${t}].list and repeatable must match when both are provided`);if(Lo(`registerFlags flags[${t}].default`,r.default),Array.isArray(r.default)&&r.list!==!0&&r.repeatable!==!0)throw new TypeError(`registerFlags flags[${t}].default cannot be an array unless list is true.`);bi(`registerFlags flags[${t}]`,r)}}function bi(e,t){let n=(typeof t.value_type=="string"?t.value_type:void 0)??(typeof t.type=="string"?t.type:void 0);if(n===void 0)return;let r=ci(n);if(r===null)throw new TypeError(`${e} value_type "${n}" is not a known flag value type (expected one of: string, number, boolean).`);if(t.default===void 0)return;let o=t.list===!0||t.repeatable===!0?di(t.default):[t.default];for(let[i,s]of o.entries())if(!li(s,r)){let a=o.length>1?`default[${i}]`:"default";throw new TypeError(`${e}.${a} (${JSON.stringify(s)}) is not coercible to ${r}.`)}}function wi(e){if(!Array.isArray(e))throw new TypeError("registerItemFields fields requires an array of object definitions");for(let[t,n]of e.entries()){let r=x(`registerItemFields fields[${t}]`,n);M(`registerItemFields fields[${t}].name`,r.name);let o=M(`registerItemFields fields[${t}].type`,r.type);if(ui(o)===null){let i=fi(o),s=i?` Did you mean "${i}"?`:"";throw new TypeError(`registerItemFields fields[${t}].type "${o}" is not a known field type (expected one of: ${Mt.join(", ")}).${s}`)}D(`registerItemFields fields[${t}].optional`,r.optional)}}function wu(e,t){if(t===void 0)return;let n=`registerItemTypes types[${e}].command_option_policies`;if(!Array.isArray(t))throw new TypeError(`${n} must be an array when provided`);for(let[r,o]of t.entries()){let i=`${n}[${r}]`,s=x(i,o);M(`${i}.command`,s.command),M(`${i}.option`,s.option),D(`${i}.enabled`,s.enabled),D(`${i}.required`,s.required),D(`${i}.visible`,s.visible)}}function vu(e,t){if(t===void 0)return;let n=`registerItemTypes types[${e}].options`;if(!Array.isArray(t))throw new TypeError(`${n} must be an array when provided`);for(let[r,o]of t.entries()){let i=`${n}[${r}]`,s=x(i,o);M(`${i}.key`,s.key),ge(`${i}.values`,s.values),D(`${i}.required`,s.required),ge(`${i}.aliases`,s.aliases)}}function vi(e){if(!Array.isArray(e))throw new TypeError("registerItemTypes types requires an array of object definitions");for(let[t,n]of e.entries()){let r=`registerItemTypes types[${t}]`,o=x(r,n);M(`${r}.name`,o.name),S(`${r}.folder`,o.folder),ge(`${r}.aliases`,o.aliases),ge(`${r}.required_create_fields`,o.required_create_fields),ge(`${r}.required_create_repeatables`,o.required_create_repeatables),wu(t,o.command_option_policies),vu(t,o.options)}}function Ei(e){let t=x("registerMigration definition",e);if(t.id!==void 0&&typeof t.id!="string")throw new TypeError("registerMigration definition.id must be a string when provided");if(t.description!==void 0&&typeof t.description!="string")throw new TypeError("registerMigration definition.description must be a string when provided");if(t.status!==void 0&&typeof t.status!="string")throw new TypeError("registerMigration definition.status must be a string when provided");if(D("registerMigration definition.mandatory",t.mandatory),t.run!==void 0&&typeof t.run!="function")throw new TypeError("registerMigration definition.run must be a function when provided")}var ki=["types","statuses","fields","workflows","config","templates","packages"],Eu={types:(e,t)=>{if(t.name!==void 0&&typeof t.name!="string")throw new TypeError(`${e}.name must be a string when provided`)},workflows:(e,t)=>{if(typeof t.type!="string")throw new TypeError(`${e}.type must be a string`);if(!Array.isArray(t.allowed_transitions))throw new TypeError(`${e}.allowed_transitions must be an array`);for(let[n,r]of t.allowed_transitions.entries())if(!Array.isArray(r))throw new TypeError(`${e}.allowed_transitions[${n}] must be a [from, to] array`)},templates:(e,t)=>{if(typeof t.name!="string")throw new TypeError(`${e}.name must be a string`);if(typeof t.options!="object"||t.options===null||Array.isArray(t.options))throw new TypeError(`${e}.options must be an object`)},packages:(e,t)=>{if(typeof t.spec!="string")throw new TypeError(`${e}.spec must be a string`)}};function Oi(e){let t=x("registerProfile profile",e);if(M("registerProfile profile.name",t.name),M("registerProfile profile.title",t.title),t.summary!==void 0&&typeof t.summary!="string")throw new TypeError("registerProfile profile.summary must be a string when provided");for(let n of ki){let r=t[n];if(r!==void 0){if(!Array.isArray(r))throw new TypeError(`registerProfile profile.${n} must be an array when provided`);for(let[o,i]of r.entries()){if(typeof i!="object"||i===null||Array.isArray(i))throw new TypeError(`registerProfile profile.${n}[${o}] must be an object`);Eu[n]?.(`registerProfile profile.${n}[${o}]`,i)}}}}function Ai(e){e.summary===void 0&&(e.summary="");for(let t of ki)e[t]===void 0&&(e[t]=[]);return 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]="09c95125-68bd-512b-bb09-c9ef0b2f676e")}catch{}})();function Si(e){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("registerService ownership must be an object");if(Reflect.ownKeys(e).some(t=>t!=="passThrough"))throw new TypeError("registerService ownership supports only passThrough");if(e.passThrough!==void 0&&typeof e.passThrough!="boolean")throw new TypeError("registerService ownership.passThrough must be a boolean when provided");return e.passThrough===!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]="d2feae50-9a1e-54fa-98a3-df529be63069")}catch{}})();function Ci(e){return typeof e=="string"?e:String(e)}function nt(e){let n=e.trim().replace(/^>=\s*/,"").replace(/^v/i,"").split(/[+-]/,1)[0];return/^\d+(?:[.-]\d+)*$/.test(n)?n.split(/[.-]/).map(r=>Number(r)):null}function Hn(e,t){let n=nt(e),r=nt(t);if(!n||!r)return null;let o=Math.max(n.length,r.length);for(let i=0;i<o;i+=1){let s=n[i]??0,a=r[i]??0;if(s>a)return 1;if(s<a)return-1}return 0}function Ti(e,t){if(e==null)return{kind:"pm_min_version",status:"absent",allowed:!0,required:"",current:t};let n=Ci(e);if(typeof e!="string"||n.trim().length===0)return{kind:"pm_min_version",status:"invalid",allowed:!1,required:n,current:t};if(!nt(n))return{kind:"pm_min_version",status:"invalid",allowed:!1,required:n,current:t};if(t===null)return{kind:"pm_min_version",status:"unchecked",allowed:!0,required:n,current:null};let r=Hn(t,n);return r===null?{kind:"pm_min_version",status:"unchecked",allowed:!0,required:n,current:t}:r<0?{kind:"pm_min_version",status:"unmet",allowed:!1,required:n,current:t}:{kind:"pm_min_version",status:"ok",allowed:!0,required:n,current:t}}function Ii(e,t,n){if(e==null)return{kind:"pm_max_version",status:"absent",allowed:!0,required:"",current:t};let r=Ci(e);if(typeof e!="string"||r.trim().length===0)return{kind:"pm_max_version",status:"invalid",allowed:!1,required:r,current:t};if(/^[<>=~^]/.test(r.trim())||!nt(r))return{kind:"pm_max_version",status:"invalid",allowed:!1,required:r,current:t};if(t===null)return{kind:"pm_max_version",status:"unchecked",allowed:!0,required:r,current:null};let o=Hn(t,r);return o===null?{kind:"pm_max_version",status:"unchecked",allowed:!0,required:r,current:t}:o>0?n==="warn"?{kind:"pm_max_version",status:"exceeded_warn",allowed:!0,required:r,current:t}:{kind:"pm_max_version",status:"exceeded",allowed:!1,required:r,current:t}:{kind:"pm_max_version",status:"ok",allowed:!0,required:r,current:t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="736cf7fc-d4da-57ce-90d8-2432085dd2c8")}catch{}})();var ku=5e3;async function Yn(e,t,n){let r=[];for(let o of e)try{await o.run(P(n))}catch{r.push(`extension_hook_failed:${o.layer}:${o.name}:${t}`)}return r}function Ou(e,t,n){if(e===void 0)return;if(typeof e!="object"||e===null||!("allow"in e)||e.allow!==!0&&e.allow!==!1)throw new h(`Extension mutation guard ${t.name} returned an invalid decision.`,y.CONFLICT,{code:"extension_mutation_guard_invalid_decision",reason:`${t.layer}:${t.name}`,nextSteps:["Return { allow: true } or a structured denial from the guard."]});if(e.allow)return;let r=e,o=typeof r.code=="string"?r.code.trim():"",i=typeof r.remediation=="string"?r.remediation.trim():"";if(o.length===0||i.length===0)throw new h(`Extension mutation guard ${t.name} returned an invalid denial.`,y.CONFLICT,{code:"extension_mutation_guard_invalid_denial",reason:`${t.layer}:${t.name}`,nextSteps:["Return non-empty code and remediation fields from the guard."]});let s=typeof r.message=="string"?r.message.trim():"";throw new h(s||`Extension mutation guard ${t.name} denied ${n}.`,y.CONFLICT,{code:o,reason:`${t.layer}:${t.name}`,nextSteps:[i]})}async function Xn(e,t){for(let n of e.beforeMutation??[]){let r,o;try{let i=Promise.resolve().then(()=>n.run({pm_root:t.pm_root,operation:t.operation,before:t.before===null?null:P(t.before),after:t.after===null?null:P(t.after),changed_fields:[...t.changed_fields],sdk:t.sdk}));i.catch(()=>{}),r=await Promise.race([i,new Promise((s,a)=>{o=setTimeout(()=>{a(new h(`Extension mutation guard ${n.name} timed out before ${t.operation}.`,y.CONFLICT,{code:"extension_mutation_guard_timed_out",reason:`${n.layer}:${n.name}`,nextSteps:["Fix or disable the stalled extension guard, then retry the mutation."]}))},ku),o.unref?.()})])}catch(i){throw i instanceof h?i:new h(`Extension mutation guard ${n.name} failed before ${t.operation}.`,y.CONFLICT,{code:"extension_mutation_guard_failed",reason:`${n.layer}:${n.name}`,nextSteps:["Fix or disable the failing extension guard, then retry the mutation."]})}finally{clearTimeout(o)}Ou(r,n,t.operation)}}async function Jn(e,t){return Yn(e.onWrite,"onWrite",t)}async function Qn(e,t){return Yn(e.onRead,"onRead",t)}async function Zn(e,t){return Yn(e.onIndex,"onIndex",t)}function Au(e){let t="";e instanceof Error&&typeof e.message=="string"?t=e.message:typeof e=="string"?t=e:typeof e=="object"&&e!==null&&typeof e.message=="string"&&(t=e.message);let n=t.replace(/\s+/gu," ").trim();if(n.length===0)return"";let r=300;return n.length>r?`${n.slice(0,r-1)}\u2026`:n}function jt(e,t){if(typeof e!="object"||e===null||typeof e[t]!="string")return;let n=String(e[t]).replace(/\s+/gu," ").trim();return n.length>0?n.slice(0,300):void 0}function Su(e){if(typeof e!="object"||e===null||!Object.hasOwn(e,"exit_code"))return;let t=e.exit_code;if(typeof t!="number"||!Number.isInteger(t)||t<1||t>255)throw new TypeError("Extension command result exit_code must be an integer from 1 to 255.");return t}async function er(e,t){let n=O(t.command);if(n.length===0)return{handled:!1,result:null,warnings:[]};let r=[...e.handlers].reverse().find(o=>o.command===n);if(!r)return{handled:!1,result:null,warnings:[]};try{let o=await r.run({command:n,args:P(t.args),options:P(t.options),global:P(t.global),pm_root:t.pm_root,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel,...t.sdk===void 0?{}:{sdk:t.sdk}});return{handled:!0,result:o,warnings:[],...Object.fromEntries([["exitCode",Su(o)],["errorCode",jt(o,"code")],["remediation",jt(o,"remediation")]].filter(i=>i[1]!==void 0))}}catch(o){let i=typeof o=="object"&&o!==null&&"exitCode"in o?o.exitCode:void 0;if(typeof i=="number"&&Number.isFinite(i))throw o;return{handled:!1,result:null,warnings:[`extension_command_handler_failed:${r.layer}:${r.name}:${r.command}`],errorMessage:Au(o),...Object.fromEntries([["errorCode",jt(o,"code")],["remediation",jt(o,"remediation")]].filter(s=>s[1]!==void 0))}}}function Ri(e){return{handled:!1,result:e.payload,warnings:[]}}function xi(e,t){return[...e.overrides].reverse().filter(n=>n.service===t)}function Ni(e){return{service:e.service,command:e.command?O(e.command):void 0,args:e.args?P(e.args):void 0,options:e.options?Vr(e.options):void 0,global:e.global?Wr(e.global):void 0,pm_root:e.pm_root,source_workspace_root:e.source_workspace_root,repo_root:e.repo_root,pm_root_rel:e.pm_root_rel,payload:P(e.payload)}}function Cu(e){if(typeof e!="object"||e===null||!Object.hasOwn(e,"handled"))return!1;let t=e.handled;return t===!0?Object.hasOwn(e,"result"):t===!1&&Reflect.ownKeys(e).length===1}function Di(e,t){return Cu(e)?e.handled?{handled:!0,result:e.result}:{handled:!1,result:t.payload}:t.service==="output_format"&&e==null?{handled:!1,result:t.payload}:{handled:!0,result:e}}function Pi(e,t,n){return t.service==="output_format"&&typeof e=="object"&&e!==null&&V(e,n.payload)}function Mi(e,t,n){if(t.handled){if(e.passThrough===!0){n.push(`extension_service_pass_through_contract_violated:${e.layer}:${e.name}:${e.service}`);return}return{handled:!0,result:t.result,warnings:n}}}function tr(e,t){let n=xi(e,t.service);if(n.length===0)return Ri(t);let r=[];for(let o of n)try{let i=Ni(t),s=o.run(i);if(s instanceof Promise){r.push(`extension_service_override_async_unsupported:${o.layer}:${o.name}:${o.service}`);continue}if(Pi(s,t,i)){r.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=Mi(o,Di(s,t),r);if(a)return a}catch{r.push(`extension_service_override_failed:${o.layer}:${o.name}:${o.service}`)}return{handled:!1,result:t.payload,warnings:r}}async function nr(e,t){let n=xi(e,t.service);if(n.length===0)return Ri(t);let r=[];for(let o of n)try{let i=Ni(t),s=await Promise.resolve(o.run(i));if(Pi(s,t,i)){r.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=Mi(o,Di(s,t),r);if(a)return a}catch{r.push(`extension_service_override_failed:${o.layer}:${o.name}:${o.service}`)}return{handled:!1,result:t.payload,warnings:r}}(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]="3ee03fc2-5b71-508c-8524-d22104fa2194")}catch{}})();var $i=null,Du=Object.freeze(ht()),Li=0;function Pu(e=Date.now()){return Li+=1,`${Li}-${e}`}function Mu(e,t,n){return n.has(e)?!1:t.size===0?!0:t.has(e)}async function $u(e,t){let[n,r]=await Promise.all([we.realpath(e),we.realpath(t)]);return kn(n,r)}function Lu(e,t=process.cwd()){return{global:be.join(Po(t),"extensions"),project:be.join(e,"extensions")}}async function ju(e){try{return(await we.readdir(e,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort((n,r)=>n.localeCompare(r))}catch{return[]}}function Fu(e){let t={layer:e.layer,directory:e.directory,manifest_path:e.manifest_path,name:e.manifest.name,version:e.manifest.version,entry:e.manifest.entry,priority:e.manifest.priority,entry_path:e.entry_path,manifest_version:e.manifest.manifest_version,pm_min_version:e.manifest.pm_min_version,pm_max_version:e.manifest.pm_max_version,engines:e.manifest.engines,trusted:e.manifest.trusted,provenance:e.manifest.provenance,sandbox_profile:e.manifest.sandbox_profile,permissions:e.manifest.permissions,capabilities:[...e.manifest.capabilities],activation:e.manifest.activation?{commands:[...e.manifest.activation.commands]}:void 0,contributions:e.manifest.contributions??e.contributions};return e.source_package&&(t.source_package=e.source_package),e.source_aliases&&(t.source_aliases=[...e.source_aliases]),t}function ji(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}async function Uu(e){let t=new Map;try{let n=JSON.parse(await we.readFile(be.join(e,".managed-extensions.json"),"utf8")),o=ee(n)?.entries;if(!Array.isArray(o))return t;for(let i of o){if(typeof i!="object"||i===null)continue;let s=i,a=ji(s.source?.package),c=[s.source?.input,s.source?.name,a].map(u=>ji(u)).filter(u=>u!==void 0),d=Ot(s.contributions),l={aliases:[...new Set(c)],...a?{package_name:a}:{},...d?{contributions:d}:{}};typeof s.directory=="string"&&s.directory.trim().length>0&&t.set(`directory:${s.directory.trim()}`,l),typeof s.name=="string"&&s.name.trim().length>0&&t.set(`name:${s.name.trim()}`,l)}}catch{return t}return t}function Fi(e){return[...e].sort((t,n)=>{if(t.manifest.priority!==n.manifest.priority)return t.manifest.priority-n.manifest.priority;let r=t.manifest.name.localeCompare(n.manifest.name);return r!==0?r:t.directory.localeCompare(n.directory)})}function zu(e,t){let n=[...Fi(e),...Fi(t)],r=[];for(let o of n){let i=r.findIndex(s=>s.manifest.name===o.manifest.name);i>=0&&r.splice(i,1),r.push(o)}return r}async function Ui(e,t,n,r,o){let i=[],s=[],a=[],c=await ju(t),d=await Uu(t);for(let l of c){let u=await Vu(e,t,l,n,r,d,o);i.push(u.diagnostic),s.push(...u.warnings),u.candidate&&a.push(u.candidate)}return{diagnostics:i,warnings:s,candidates:a}}function qu(){return{diagnostics:[],warnings:[],candidates:[]}}function zi(e,t,n,r){return{diagnostic:{layer:e,directory:t,manifest_path:n,name:null,version:null,entry:null,priority:null,entry_path:null,enabled:null,status:"warn"},warnings:[r],candidate:null}}function Bu(e,t,n,r,o,i,s){let a=qr(e,t,n);Array.isArray(t.legacy_capability_aliases)&&t.legacy_capability_aliases.length>0&&a.push(no(e,t.name,t.legacy_capability_aliases));for(let c of Zr(t.capabilities))a.push(to(e,t.name,c));return r?o||a.push(`extension_entry_missing:${e}:${t.name}`):a.push(`extension_entry_outside_extension:${e}:${t.name}`),i.warning&&a.push(i.warning),s.warning&&a.push(s.warning),a}async function Vu(e,t,n,r,o,i,s){let a=be.join(t,n),c=be.join(a,"manifest.json");if(!await En(c))return zi(e,n,c,`extension_manifest_missing:${e}:${n}`);let d,l;try{let ft=JSON.parse(await we.readFile(c,"utf8"));l=ee(ft),d=qn(ft)}catch{l=null,d=null}if(!d||!l)return zi(e,n,c,`extension_manifest_invalid:${e}:${n}`);let u=be.resolve(a,d.entry),f=kn(a,u),m=f?await En(u):!1,p=f&&m?await $u(a,u):f,_=Mu(d.name,r,o),g=await Ku(e,d),w=await Hu(e,d,s),v=Bu(e,d,l,p,m,g,w),R=p&&m&&g.allowed&&w.allowed,$r=i.get(`directory:${n}`)??i.get(`name:${d.name}`);return{diagnostic:{layer:e,directory:n,manifest_path:c,name:d.name,version:d.version,entry:d.entry,priority:d.priority,entry_path:u,enabled:_,status:R?"ok":"warn"},warnings:v,candidate:Uo({layer:e,directory:n,manifestPath:c,entryPath:u,manifest:d,sourceIdentity:$r,extensionReady:R,enabledForLoad:_})}}async function Wu(e){let t=Lu(e.pmRoot,e.cwd??process.cwd()),n=Ve(e.settings.extensions.enabled),r=Ve(e.settings.extensions.disabled),o=Wo(e.settings),i=Go(o);if(e.noExtensions)return{disabled_by_flag:!0,roots:t,configured_enabled:n,configured_disabled:r,discovered:[],effective:[],warnings:[...o.warnings],policy:i};let s=new Set(n),a=new Set(r),c=e.ignoreGlobalExtensions===!0?qu():await Ui("global",t.global,s,a,o.pmMaxVersionExceededMode.global),d=await Ui("project",t.project,s,a,o.pmMaxVersionExceededMode.project),l=[...o.warnings],u=zu(c.candidates,d.candidates),f=[];for(let m of u){let p={layer:m.layer,name:m.manifest.name,trusted:m.manifest.trusted===!0,provenanceVerified:m.manifest.provenance?.verified===!0,sandboxProfile:m.manifest.sandbox_profile,permissions:m.manifest.permissions&&typeof m.manifest.permissions=="object"?{fs_read:m.manifest.permissions.fs_read,fs_write:m.manifest.permissions.fs_write,network:m.manifest.permissions.network,env_read:m.manifest.permissions.env_read,env_write:m.manifest.permissions.env_write,process_spawn:m.manifest.permissions.process_spawn}:void 0},_=Yo(o,p);if(_.warning&&l.push(_.warning),!!_.allowed){for(let g of m.manifest.capabilities){let w=Xo(o,p,g);w.warning&&l.push(w.warning)}f.push(Fu(m))}}return{disabled_by_flag:!1,roots:t,configured_enabled:n,configured_disabled:r,discovered:[...c.diagnostics,...d.diagnostics],effective:f,warnings:[...new Set([...c.warnings,...d.warnings,...l])],policy:i}}function Ft(e){return e instanceof Error&&e.message.trim().length>0?e.message:String(e)}async function Gu(){try{let e=Sn(import.meta.url,["../../.."]),t=await we.readFile(be.join(e,"package.json"),"utf8"),n=JSON.parse(t);return typeof n.version=="string"&&n.version.trim().length>0?n.version.trim():null}catch{return null}}function Vi(){return $i??=Gu(),$i}function Wi(e,t,n){let r=n.current??"unknown";if(n.kind==="pm_min_version")switch(n.status){case"invalid":return`extension_pm_min_version_invalid:${e}:${t.name}:required=${n.required}`;case"unchecked":return`extension_pm_min_version_unchecked:${e}:${t.name}:required=${n.required}:current=${r}`;case"unmet":return`extension_pm_min_version_unmet:${e}:${t.name}:required=${n.required}:current=${r}`;default:return}switch(n.status){case"invalid":return`extension_pm_max_version_invalid:${e}:${t.name}:allowed=${n.required}`;case"unchecked":return`extension_pm_max_version_unchecked:${e}:${t.name}:allowed=${n.required}:current=${r}`;case"exceeded_warn":return`extension_pm_max_version_exceeded_warn:${e}:${t.name}:allowed=${n.required}:current=${r}`;case"exceeded":return`extension_pm_max_version_exceeded:${e}:${t.name}:allowed=${n.required}:current=${r}`;default:return}}async function Ku(e,t){if(t.pm_min_version===void 0)return{allowed:!0};let n=Ti(t.pm_min_version,await Vi()),r=Wi(e,t,n);return r?{allowed:n.allowed,warning:r}:{allowed:n.allowed}}async function Hu(e,t,n){if(t.pm_max_version===void 0)return{allowed:!0};let r=Ii(t.pm_max_version,await Vi(),n),o=Wi(e,t,r);return o?{allowed:r.allowed,warning:o}:{allowed:r.allowed}}async function qi(e){try{let t=await we.stat(e);return`${Math.trunc(t.mtimeMs)}-${t.size}`}catch{return"missing"}}async function Yu(e,t){let n=e.entry_path;t.module_graph_snapshot_root&&(n=await ri(t.module_graph_snapshot_root,e));let r=new URL(Nu(n).href);if(!(t.cache_bust===!0||typeof t.reload_token=="string"))return r.href;let[i,s]=await Promise.all([qi(e.entry_path),qi(e.manifest_path)]),a=t.reload_token??Pu();return r.searchParams.set("pm_ext_reload",a),r.searchParams.set("pm_ext_entry",i),r.searchParams.set("pm_ext_manifest",s),r.href}async function Hb(e){let t=await Wu(e),n=[],r=[],o=[...t.warnings];if(t.disabled_by_flag)return{...t,warnings:o,loaded:n,failed:r};let i=typeof e.extensionFilter=="function"?t.effective.filter(e.extensionFilter):t.effective;for(let s of i)try{let c=await import(await Yu(s,e));n.push({...s,module:c})}catch(a){o.push(`extension_load_failed:${s.layer}:${s.name}`),r.push({layer:s.layer,name:s.name,entry_path:s.entry_path,error:Ft(a)})}return{...t,warnings:o,loaded:n,failed:r}}var Bi=5e3,Xu=2147483647;function Ju(e){let n={activate:e.activate.bind(e)};if(typeof e.deactivate=="function"){let r=e.deactivate;n.deactivate=r.bind(e)}return n}function Gi(e){let t=Eo(e);return t?Ju(t):null}async function Yb(e,t,n={}){let r=Qu(n?.deactivate_timeout_ms),o=new Set((t?.failed??[]).map(l=>`${l.layer}:${l.name}`)),i=[];for(let l of e.loaded){if(o.has(`${l.layer}:${l.name}`))continue;let u=Gi(l.module);!u||typeof u.deactivate!="function"||i.push({extension:l,deactivate:u.deactivate})}let s=await Promise.all(i.map(async({extension:l,deactivate:u})=>{try{return await Zu(u,r),{ok:!0}}catch(f){return{ok:!1,layer:l.layer,name:l.name,error:Ft(f)}}})),a=[],c=[],d=0;for(let l of s){if(l.ok){d+=1;continue}a.push(`extension_deactivate_failed:${l.layer}:${l.name}`),c.push({layer:l.layer,name:l.name,error:l.error})}return{deactivated:d,warnings:a,failed:c}}function Qu(e){return typeof e!="number"||e<0?Bi:e===0||e===1/0?0:Number.isFinite(e)?Math.min(Xu,Math.max(1,Math.floor(e))):Bi}async function Zu(e,t){if(t===0){await e();return}let n;try{let r=Promise.resolve().then(()=>e());r.catch(()=>{}),await Promise.race([r,new Promise((o,i)=>{n=setTimeout(()=>{i(new Error(`extension deactivate timed out after ${t}ms`))},t),n.unref?.()})])}finally{clearTimeout(n)}}function ef(e){if(!Array.isArray(e.capabilities))return null;let t=new Set;for(let n of e.capabilities){let r=n.trim().toLowerCase();J(r)&&t.add(r)}return t}function k(e,t,n){let r=ef(e);if(r!==null&&!r.has(t))throw K(`${n} requires capability '${t}' in extension manifest capabilities`,{method:n,registration_index:-1,capability:t,missing_capability:t,expected_schema:`"capabilities": [..., "${t}"]`,received:e.capabilities,hint:`Add "${t}" to ${e.name} manifest capabilities, or remove the ${n} registration call.`})}function tf(e){return Object.freeze({name:e.name,layer:e.layer,version:e.version,capabilities:Object.freeze((e.capabilities??[]).filter(t=>B.includes(t))),pm_min_version:e.pm_min_version,pm_max_version:e.pm_max_version,source_package:e.source_package})}function nf(e){return{layer:e.layer,name:e.name,trusted:e.trusted===!0,provenanceVerified:e.provenance?.verified===!0,sandboxProfile:e.sandbox_profile,permissions:e.permissions&&typeof e.permissions=="object"?{fs_read:e.permissions.fs_read,fs_write:e.permissions.fs_write,network:e.permissions.network,env_read:e.permissions.env_read,env_write:e.permissions.env_write,process_spawn:e.permissions.process_spawn}:void 0}}var rr=class{extension;hooks;#e;#n;#o;#r;#s;#a;#i;#c;#t;#d;#l;#u;constructor(t,n,r,o,i,s,a,c,d,l,u){this.#e=t,this.extension=tf(t),this.#n=nf(t),this.#o=n,this.#r=r,this.#s=o,this.#a=i,this.#i=s,this.#c=a,this.#t=c,this.#d=d,this.#l=l,this.#u=u,this.registerCommand=this.registerCommand.bind(this),this.registerParser=this.registerParser.bind(this),this.registerPreflight=this.registerPreflight.bind(this),this.registerService=this.registerService.bind(this),this.registerFlags=this.registerFlags.bind(this),this.registerItemFields=this.registerItemFields.bind(this),this.registerItemTypes=this.registerItemTypes.bind(this),this.registerRelationshipKinds=this.registerRelationshipKinds.bind(this),this.registerMigration=this.registerMigration.bind(this),this.registerProfile=this.registerProfile.bind(this),this.registerRenderer=this.registerRenderer.bind(this),this.registerImporter=this.registerImporter.bind(this),this.registerExporter=this.registerExporter.bind(this),this.registerSearchProvider=this.registerSearchProvider.bind(this),this.registerVectorStoreAdapter=this.registerVectorStoreAdapter.bind(this),this.registerAssuranceMeasurementProvider=this.registerAssuranceMeasurementProvider.bind(this),this.hooks={beforeCommand:f=>this.registerBeforeCommand(f),beforeMutation:f=>this.registerBeforeMutation(f),afterCommand:f=>this.registerAfterCommand(f),onWrite:f=>this.registerOnWrite(f),onRead:f=>this.registerOnRead(f),onIndex:f=>this.registerOnIndex(f)}}allowRegistration(t,n,r,o){let i=Jo(this.#u,this.#n,t,n,r,o);return i.warning&&this.#d.push(i.warning),i.allowed}registerCommandTrace(t,n,r,o,i){return{method:"registerCommand",registration_index:t==="override"?this.#r.overrides.length:this.#r.handlers.length,command:n,expected_schema:r,received:Xe(o),hint:i}}registerCommandOverride(t,n){let r=O(t);if(r.length===0)throw K("registerCommand requires a non-empty command name",this.registerCommandTrace("override",t,'registerCommand("<command>", (context) => unknown)',t,"Provide a non-empty command path as the first argument."));if(typeof n!="function"){let o=this.registerCommandTrace("override",r,'registerCommand("<command>", (context) => unknown)',n,"Provide a function as the second registerCommand argument.");throw K(`registerCommand requires an override function when command name is provided (command="${r}", registration_index=${o.registration_index})`,o)}this.allowRegistration("commands.override","registerCommand","commands",{command:r})&&this.#r.overrides.push({layer:this.#e.layer,name:this.#e.name,command:r,run:n})}resolveCommandDefinitionRunHandler(t,n){let r=typeof t.run=="function"?t.run:void 0,o=typeof t.handler=="function"?t.handler:void 0;return!r&&o&&this.#d.push(`extension_command_definition_legacy_handler_alias:${this.#e.layer}:${this.#e.name}:${n}`),r??o}registerCommandDefinition(t){if(typeof t!="object"||t===null)throw K("registerCommand requires a command definition object",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",t,'Use registerCommand({ name: "command path", run: (context) => ... }).'));if(typeof t.name!="string")throw K("registerCommand requires a command definition name",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",t,"Set command definition.name to a non-empty string command path."));let n=O(t.name);if(n.length===0)throw K("registerCommand requires a non-empty command definition name",this.registerCommandTrace("definition",t.name,"{ name: string; run: (context) => unknown; }",t,"Ensure command definition.name contains a non-empty command path."));let r=this.resolveCommandDefinitionRunHandler(t,n);if(typeof r!="function"){let o=this.registerCommandTrace("definition",n,"{ name: string; run: (context) => unknown; }",r,"Define command definition.run as a function.");throw K(`registerCommand requires a command definition run handler (command="${n}", registration_index=${o.registration_index})`,o)}try{jo(t);let o=Gn(n,t.action);if(!this.allowRegistration("commands.handler","registerCommand","commands",{command:n,action:o}))return;let i=t.description?.trim(),s=t.intent?.trim(),a=Ke("registerCommand definition.examples",t.examples),c=Ke("registerCommand definition.failure_hints",t.failure_hints),d=Kn(t.arguments);t.flags!==void 0&&(k(this.#e,"schema","registerCommand flags"),this.allowRegistration("schema.flags","registerCommand flags","schema")&&(Lt(t.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:n,flags:$t("registerCommand definition.flags",t.flags)})));let l={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:n,action:o,examples:a,failure_hints:c,arguments:d,tier:t.tier??"standard",family:t.family??"extensions"};i&&(l.description=i),s&&(l.intent=s),this.#t.commands.push(l)}catch(o){let i=Ft(o),s=this.registerCommandTrace("definition",n,"{ name: string; run: (context) => unknown; action?: string; arguments?: object[]; flags?: object[]; }",t,i),a=K(`registerCommand definition metadata invalid (command="${n}", registration_index=${s.registration_index}): ${i}`,s);this.#d.push(`extension_command_quarantined:${this.#e.layer}:${this.#e.name}:${n}`),this.#l.push({layer:this.#e.layer,name:this.#e.name,entry_path:this.#e.entry_path,error:a.message,trace:s});return}this.#r.handlers.push({layer:this.#e.layer,name:this.#e.name,command:n,run:r})}registerCommand(t,n){if(k(this.#e,"commands","registerCommand"),typeof t=="string"){this.registerCommandOverride(t,n);return}this.registerCommandDefinition(t)}registerParser(t,n){if(k(this.#e,"parser","registerParser"),!this.allowRegistration("parser.override","registerParser","parser"))return;let r=O(M("registerParser command",t));et("registerParser override",n),this.#s.overrides.push({layer:this.#e.layer,name:this.#e.name,command:r,run:n})}registerPreflight(t){if(k(this.#e,"preflight","registerPreflight"),!this.allowRegistration("preflight.override","registerPreflight","preflight"))return;let n=oi(t);this.#a.overrides.push({layer:this.#e.layer,name:this.#e.name,...n})}registerService(t,n,r={}){k(this.#e,"services","registerService");let o=String(t).trim().toLowerCase();if(!pi(o))throw new TypeError(`registerService service must be one of: ${Oe.join(", ")}`);this.allowRegistration("services.override","registerService","services",{service:o})&&(et("registerService override",n),this.#i.overrides.push({layer:this.#e.layer,name:this.#e.name,service:o,run:n,...Si(r)?{passThrough:!0}:{}}))}registerRenderer(t,n,r={}){if(k(this.#e,"renderers","registerRenderer"),!this.allowRegistration("renderers.override","registerRenderer","renderers"))return;if(typeof n!="function")throw new TypeError("registerRenderer requires a renderer function");let o=String(t).trim().toLowerCase();if(!mi(o))throw new Error(`registerRenderer format must be toon|json, received: ${String(t)}`);if(r.resultDiscriminator!==void 0&&typeof r.resultDiscriminator!="function")throw new TypeError("registerRenderer ownership.resultDiscriminator must be a function when provided");let i=[...new Set((r.commands??[]).map(s=>{if(typeof s!="string"||s.trim().length===0)throw new TypeError("registerRenderer ownership.commands must contain non-empty command paths");return O(s)}))];this.#c.overrides.push({layer:this.#e.layer,name:this.#e.name,format:o,run:n,commands:i,...r.resultDiscriminator?{resultDiscriminator:r.resultDiscriminator}:{}})}registerFlags(t,n){if(k(this.#e,"schema","registerFlags"),!this.allowRegistration("schema.flags","registerFlags","schema"))return;let r=O(M("registerFlags targetCommand",t));Lt(n);let o=$t("registerFlags flags",n);if(o.length===0)throw new TypeError("registerFlags requires at least one flag definition");this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:r,flags:o})}registerItemFields(t){if(k(this.#e,"schema","registerItemFields"),!this.allowRegistration("schema.itemfields","registerItemFields","schema"))return;wi(t);let n=Ze("registerItemFields fields",t);if(n.length===0)throw new TypeError("registerItemFields requires at least one field definition");this.#t.item_fields.push({layer:this.#e.layer,name:this.#e.name,fields:n})}registerItemTypes(t){if(k(this.#e,"schema","registerItemTypes"),!this.allowRegistration("schema.itemtypes","registerItemTypes","schema"))return;vi(t);let n=Ze("registerItemTypes types",t);if(n.length===0)throw new TypeError("registerItemTypes requires at least one type definition");this.#t.item_types.push({layer:this.#e.layer,name:this.#e.name,types:n})}registerRelationshipKinds(t){if(k(this.#e,"schema","registerRelationshipKinds"),!this.allowRegistration("schema.relationshipkinds","registerRelationshipKinds","schema"))return;if(!Array.isArray(t))throw new TypeError("registerRelationshipKinds definitions requires an array of object definitions");if(t.length===0)throw new TypeError("registerRelationshipKinds requires at least one definition");let n=mn();for(let o of this.#t.relationship_kinds)for(let i of o.definitions)n.register(i);let r=t.map(o=>(n.register(o),n.require(o.kind)));this.#t.relationship_kinds.push({layer:this.#e.layer,name:this.#e.name,definitions:r})}registerMigration(t){if(k(this.#e,"schema","registerMigration"),!this.allowRegistration("schema.migrations","registerMigration","schema"))return;Ei(t);let n=Qe("registerMigration definition",t);this.#t.migrations.push(tt({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerMigration definition",t)},n))}registerProfile(t){if(k(this.#e,"schema","registerProfile"),!this.allowRegistration("schema.profiles","registerProfile","schema"))return;let n=Je(t);Oi(n),this.#t.profiles.push({layer:this.#e.layer,name:this.#e.name,profile:Ai(n)})}registerImportExportCommandFlags(t,n,r){r.flags!==void 0&&(k(this.#e,"schema",`${t} options.flags`),this.allowRegistration("schema.flags",`${t} options.flags`,"schema")&&(Lt(r.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:n,flags:$t(`${t} options.flags`,r.flags)})))}applyImportExportCommandMetadata(t,n,r){if(r!==void 0&&(typeof r!="object"||r===null||Array.isArray(r)))throw new TypeError(`${t} options must be an object when provided`);let o=`${t==="registerImporter"?"Import":"Export"} items with the registered extension adapter.`,i=[{name:"file",required:!1,description:"Optional input or output file path."}],s={...r,description:r?.description??o,arguments:r?.arguments??i},a=Fo(t,s,r?.description!==void 0);S(`${t} options.action`,s.action),S(`${t} options.description`,s.description),S(`${t} options.intent`,s.intent);let c=Gn(n,s.action),d=Ke(`${t} options.examples`,s.examples),l=Ke(`${t} options.failure_hints`,s.failure_hints),u=Kn(s.arguments);this.registerImportExportCommandFlags(t,n,s);let f={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:n,action:c,examples:d,failure_hints:l,arguments:u},m=s.description?.trim();m&&(f.description=m);let p=s.intent?.trim();return p&&(f.intent=p),this.#t.commands.push(f),a}registerImporter(t,n,r){if(k(this.#e,"importers","registerImporter"),!this.allowRegistration("importers.importer","registerImporter","importers"))return;let o=Vn(M("registerImporter name",t));et("registerImporter importer",n);let i=Wn(o,"import");this.applyImportExportCommandMetadata("registerImporter",i,r),this.#t.importers.push({layer:this.#e.layer,name:this.#e.name,importer:o}),this.#r.handlers.push({layer:this.#e.layer,name:this.#e.name,command:i,run:async s=>n(Nn(s,o,"import"))})}registerExporter(t,n,r){if(k(this.#e,"importers","registerExporter"),!this.allowRegistration("importers.exporter","registerExporter","importers"))return;let o=Vn(M("registerExporter name",t));et("registerExporter exporter",n);let i=Wn(o,"export"),s=this.applyImportExportCommandMetadata("registerExporter",i,r);this.#t.exporters.push({layer:this.#e.layer,name:this.#e.name,exporter:o,...s===void 0?{}:{output:s}}),this.#r.handlers.push({layer:this.#e.layer,name:this.#e.name,command:i,run:async a=>{let c=await n(Nn(a,o,"export"));return s?.receipt==="suppress"&&!An(c)?ho(c):c}})}registerSearchProvider(t){if(k(this.#e,"search","registerSearchProvider"),!this.allowRegistration("search.provider","registerSearchProvider","search"))return;let n=Qe("registerSearchProvider provider",t);this.#t.search_providers.push(tt({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerSearchProvider provider",t)},n))}registerVectorStoreAdapter(t){if(k(this.#e,"search","registerVectorStoreAdapter"),!this.allowRegistration("search.vectorstore","registerVectorStoreAdapter","search"))return;let n=Qe("registerVectorStoreAdapter adapter",t);this.#t.vector_store_adapters.push(tt({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerVectorStoreAdapter adapter",t)},n))}registerAssuranceMeasurementProvider(t){if(k(this.#e,"services","registerAssuranceMeasurementProvider"),!this.allowRegistration("services.assuranceprovider","registerAssuranceMeasurementProvider","services"))return;if(hi(t),t.network&&this.#e.permissions?.network!==!0)throw new TypeError("registerAssuranceMeasurementProvider network provider requires permissions.network=true");let n=Qe("registerAssuranceMeasurementProvider provider",t);this.#t.assurance_providers.push(tt({layer:this.#e.layer,name:this.#e.name,network_permission:this.#e.permissions?.network===!0,definition:Ie("registerAssuranceMeasurementProvider provider",t)},n))}registerBeforeCommand(t){k(this.#e,"hooks","api.hooks.beforeCommand"),this.allowRegistration("hooks.beforecommand","api.hooks.beforeCommand","hooks")&&(he("beforeCommand",t),this.#o.beforeCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerBeforeMutation(t){k(this.#e,"hooks","api.hooks.beforeMutation"),this.allowRegistration("hooks.beforemutation","api.hooks.beforeMutation","hooks")&&(he("beforeMutation",t),this.#o.beforeMutation.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerAfterCommand(t){k(this.#e,"hooks","api.hooks.afterCommand"),this.allowRegistration("hooks.aftercommand","api.hooks.afterCommand","hooks")&&(he("afterCommand",t),this.#o.afterCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnWrite(t){k(this.#e,"hooks","api.hooks.onWrite"),this.allowRegistration("hooks.onwrite","api.hooks.onWrite","hooks")&&(he("onWrite",t),this.#o.onWrite.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnRead(t){k(this.#e,"hooks","api.hooks.onRead"),this.allowRegistration("hooks.onread","api.hooks.onRead","hooks")&&(he("onRead",t),this.#o.onRead.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnIndex(t){k(this.#e,"hooks","api.hooks.onIndex"),this.allowRegistration("hooks.onindex","api.hooks.onIndex","hooks")&&(he("onIndex",t),this.#o.onIndex.push({layer:this.#e.layer,name:this.#e.name,run:t}))}};function rf(e,t,n,r,o,i,s,a,c,d,l){return new rr(e,t,n,r,o,i,s,a,c,d,l)}function of(e){let t=e.commands.length,n=e.flags.reduce((s,a)=>s+a.flags.length,0),r=e.item_fields.reduce((s,a)=>s+a.fields.length,0),o=e.item_types.reduce((s,a)=>s+a.types.length,0),i=(e.relationship_kinds??[]).reduce((s,a)=>s+a.definitions.length,0);return{commands:t,flags:n,item_fields:r,item_types:o,...i>0?{relationship_kinds:i}:{},migrations:e.migrations.length,profiles:e.profiles.length,importers:e.importers.length,exporters:e.exporters.length,search_providers:e.search_providers.length,vector_store_adapters:e.vector_store_adapters.length,...(e.assurance_providers?.length??0)>0?{assurance_providers:e.assurance_providers.length}:{}}}function sf(e){let t=[],n=(i,s)=>{let a=new Map;for(let c of i){let d=a.get(c.command)??[];d.push(c),a.set(c.command,d)}for(let c of[...a.keys()].sort((d,l)=>d.localeCompare(l))){let d=a.get(c);if(d.length<=1)continue;let l=d[d.length-1];for(let u of d.slice(0,-1))t.push(`${s}:${c}:${l.layer}:${l.name}:${u.layer}:${u.name}`)}};n(e.handlers,"extension_command_handler_collision"),n(e.overrides,"extension_command_override_collision");let r=new Set(e.handlers.map(i=>i.command)),o=[...new Set(e.overrides.map(i=>i.command))].filter(i=>r.has(i));o.sort((i,s)=>i.localeCompare(s));for(let i of o){let s=e.handlers.filter(c=>c.command===i),a=e.overrides.filter(c=>c.command===i);for(let c of a)for(let d of s)t.push(`extension_command_override_handler_overlap:${i}:${c.layer}:${c.name}:${d.layer}:${d.name}`)}return t}function af(e){let t=new Map;for(let r of e.overrides){let o=t.get(r.format)??[];o.push(r),t.set(r.format,o)}let n=[];for(let r of[...t.keys()].sort((o,i)=>o.localeCompare(i))){let o=t.get(r);if(o.length<=1)continue;let i=o[o.length-1];for(let s of o.slice(0,-1))i.commands?.length&&s.commands?.length&&!s.commands.some(a=>i.commands?.includes(a))||n.push(`extension_renderer_collision:${r}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return n}function cf(e){let t=[],n=new Map;for(let r of e.overrides){let o=n.get(r.command)??[];o.push(r),n.set(r.command,o)}for(let r of[...n.keys()].sort((o,i)=>o.localeCompare(i))){let o=n.get(r);if(o.length<=1)continue;let i=o[o.length-1];for(let s of o.slice(0,-1))t.push(`extension_parser_override_collision:${r}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return t}var df=new Set(["output_format"]);function lf(e){let t=[],n=new Map;for(let r of e.overrides){let o=n.get(r.service)??[];o.push(r),n.set(r.service,o)}for(let r of[...n.keys()].sort((o,i)=>o.localeCompare(i))){let o=n.get(r);if(o.length<=1||df.has(r))continue;let i=o[o.length-1];for(let s of o.slice(0,-1))t.push(`extension_service_override_collision:${r}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return t}async function Xb(e){let t=Ko(e.policy??Du),n=Pt(),r=Pn(),o=Mn(),i=$n(),s=Ln(),a=jn(),c=Fn(),d=[],l=[];for(let m of e.loaded){let p=Gi(m.module);if(!p)continue;let _=d.length,g=$o({hooks:n,commands:r,parsers:o,preflight:i,services:s,renderers:a,registrations:c});try{await p.activate(rf(m,n,r,o,i,s,a,c,l,d,t)),d.length>_&&(g(),l.push(`extension_activation_rolled_back:${m.layer}:${m.name}`))}catch(w){g(),l.push(`extension_activate_failed:${m.layer}:${m.name}`);let v=gi(w);d.push({layer:m.layer,name:m.name,entry_path:m.entry_path,error:Ft(w),trace:v})}}let u=[...sf(r),...cf(o),...ii(i),...lf(s),...af(a)],f=[...new Set([...l,...u])];return{hooks:n,commands:r,parsers:o,preflight:i,services:s,renderers:a,registrations:c,failed:d,warnings:f,hook_counts:{before_command:n.beforeCommand.length,before_mutation:n.beforeMutation.length,after_command:n.afterCommand.length,on_write:n.onWrite.length,on_read:n.onRead.length,on_index:n.onIndex.length},command_override_count:r.overrides.length,command_handler_count:r.handlers.length,parser_override_count:o.overrides.length,preflight_override_count:i.overrides.length,service_override_count:s.overrides.length,renderer_override_count:a.overrides.length,registration_counts:of(c)}}(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]="b2cf7f56-432d-5c74-ba0f-248c42a97255")}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]="07566a0b-2917-5ed8-828a-d811ae48dfaf")}catch{}})();function tw(){let e=Promise.resolve(),t=new Set;return{async read(n){let r=e,o,i=new Promise(s=>{o=s});t.add(i),await r;try{return await n()}finally{t.delete(i),o()}},write(n){let o=Promise.all([e,...t]).then(()=>n());return e=o.then(()=>{},()=>{}),o}}}function uf(){let e=Promise.resolve(),t=0,n=[],r=()=>{if(t!==0)return;let o=n.splice(0);for(let i of o)i()};return{enqueue(o){t++;let i=e.then(()=>o());return e=i.then(()=>{},()=>{}).finally(()=>{t--,r()}),i},idle(){return t===0?Promise.resolve():new Promise(o=>n.push(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]="40b169fc-3c5f-5b2a-8fed-a9388b07d9f7")}catch{}})();var Re=null,Hi=null,pf=null,_f=null,or=null,gf=null,Yi=null,yf=null;var hf=[],Xi=new mf;function T(){return Xi.getStore()}function aw(e){return Xi.run({hooks:null,commands:null,parsers:null,preflight:null,services:null,renderers:null,registrations:null,commandContext:null,commandResult:void 0,affectedItems:[]},e)}var bf=new Set(["body","comments","dependencies","docs","events","files","learnings","notes","reminders","test_runs","tests"]);function Ki(e){let t=H.resolve(e);for(;;){if(ff(H.join(t,".git")))return t;let n=H.dirname(t);if(n===t)return;t=n}}function wf(e){let t=process.env.PM_SOURCE_WORKSPACE_ROOT?.trim()||process.cwd(),n=Ki(t)??H.resolve(t),r=Ki(n);if(!e)return{source_workspace_root:n,...r?{repo_root:r}:{}};let o=H.relative(n,H.resolve(e)),i=o.length>0&&!o.startsWith(`..${H.sep}`)&&o!==".."&&!H.isAbsolute(o);return{source_workspace_root:n,...r?{repo_root:r}:{},...i?{pm_root_rel:o.split(H.sep).join("/")}:{}}}function cw(e){let t=T();if(t){t.hooks=e;return}Re=e}function dw(e){let t=T();if(t){t.commands=e;return}Hi=e}function lw(e){let t=T();if(t){t.parsers=e;return}pf=e}function uw(e){let t=T();if(t){t.preflight=e;return}_f=e}function fw(e){let t=T();if(t){t.services=e;return}or=e}function mw(e){let t=T();if(t){t.renderers=e;return}gf=e}function pw(e){let t=T();if(t){t.registrations=e;return}Yi=e}function _w(){let e=T();return e?e.registrations:Yi}function gw(e){if(!e)return;let t=T();t?t.affectedItems.push(e):hf.push(e)}function yw(e,t){if(!e||!e.id)return{};let n={id:e.id,type:e.type,status:e.status};if(!Array.isArray(t))return n;let r=e;for(let o of t){if(typeof o!="string")continue;let i=o.startsWith("unset:")?o.slice(6):o;i==="id"||i==="type"||i==="status"||bf.has(i)||Object.hasOwn(r,i)&&r[i]!==void 0&&(n[i]=r[i])}return n}async function Ji(e){let t=T(),n=t?t.hooks:Re;return n?Jn(n,e):[]}async function hw(e){let t=T(),n=t?t.hooks:Re;n&&await Xn(n,e)}async function Qi(e){let t=T(),n=t?t.hooks:Re;return n?Qn(n,e):[]}function bw(){let e=T();return((e?e.hooks:Re)?.onRead?.length??0)>0}async function ww(e){let t=T(),n=t?t.hooks:Re;return n?Zn(n,e):[]}async function vw(e){let t=T(),n=t?t.commands:Hi;return n?er(n,{...e,...wf(e.pm_root)}):{handled:!1,result:null,warnings:[]}}function Zi(e,t){let n=T(),r=n?n.commandContext:yf;return{service:e,command:r?.command,args:r?[...r.args]:[],options:r?.options?{...r.options}:{},global:r?.global?{...r.global}:void 0,pm_root:r?.pm_root,source_workspace_root:r?.source_workspace_root,repo_root:r?.repo_root,pm_root_rel:r?.pm_root_rel,payload:t}}async function Ut(e,t){let n=T(),r=n?n.services:or;return r?nr(r,Zi(e,t)):{handled:!1,result:t,warnings:[]}}function es(e,t){let n=T(),r=n?n.services:or;return r?tr(r,Zi(e,t)):{handled:!1,result:t,warnings:[]}}(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]="6e88d6b7-aa5f-5515-8ea4-481916b12ef1")}catch{}})();var zt="changed_fields",vf="changed_field_count",ir="rows",Ef=new Set(["apply","rollback"]),os=new Set(["deleted","would_delete"]),ts=256,ns={start_task:["claim","update"],pause_task:["update","release"],close_task:["close","release"]};function kf(e,t){if(!j(e)||typeof e.action!="string"||typeof e.id!="string"||e.id.length===0)return null;let n=Object.hasOwn(ns,e.action)?ns[e.action]:void 0;if(!n||!n.every(i=>{let s=e[i];return j(s)&&j(s.item)&&s.item.id===e.id&&Array.isArray(s.changed_fields)&&s.changed_fields.every(a=>typeof a=="string")}))return null;let r=e[n.at(-1)],o=ss(r);return t.idOnly?o:!t.compactEnvelope&&t.changedFields!=="compact"?null:{...e,...t.compactEnvelope?{...o,changed_field_count:new Set(n.flatMap(i=>e[i].changed_fields)).size}:{},...Object.fromEntries(n.map(i=>[i,as(e[i],t)]))}}function rs(e){return typeof e!="string"||e.length<=ts?e:`${e.slice(0,ts-1)}\u2026`}function Of(e){if(!j(e))return null;let t={...e};return t.reason=rs(t.reason),j(t.previous_terminal)&&(t.previous_terminal=Object.fromEntries(Object.entries(t.previous_terminal).map(([n,r])=>[n,rs(r)]))),t}function j(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function is(e){let t=e[zt];if(!Array.isArray(t))return null;let n=Object.getPrototypeOf(e)===null?Object.create(null):{};for(let[r,o]of Object.entries(e))r!==zt&&(n[r]=o);return n[vf]=t.length,n}function Af(e){return"item"in e&&Array.isArray(e[zt])}function Sf(e){return typeof e.mode=="string"&&Ef.has(e.mode)&&Array.isArray(e[ir])}function Cf(e,t){let n=Object.getPrototypeOf(e)===null?Object.create(null):{};return Object.assign(n,e),n[ir]=t,n}function ss(e){if(!j(e))return null;let t=j(e.item)?e.item:j(e.plan)?e.plan:null;if(t===null)return null;let n=typeof t.id=="string"?t.id:void 0,r=typeof e.outcome=="string"&&os.has(e.outcome)?e.outcome:typeof t.status=="string"?t.status:void 0;return n?r?{id:n,status:r,...typeof e.deleted=="boolean"?{deleted:e.deleted}:{}}:{id:n}:null}function Tf(e){if(!j(e)||!j(e.item)||typeof e.item.id!="string")return null;let t=e[zt];if(!Array.isArray(t))return null;let n={id:e.item.id,...typeof e.outcome=="string"&&os.has(e.outcome)?{status:e.outcome}:typeof e.item.status=="string"?{status:e.item.status}:{},...typeof e.deleted=="boolean"?{deleted:e.deleted}:{},...typeof e.previous_status=="string"?{previous_status:e.previous_status}:{},changed_field_count:t.length};return If(e,e.item,n),n}function If(e,t,n){let r=typeof e.close_reason=="string"?e.close_reason:typeof t.close_reason=="string"?t.close_reason:void 0;r!==void 0&&(n.close_reason=r);let o=Of(e.recurrence);if(o!==null&&(n.recurrence=o),Array.isArray(e.warnings)&&e.warnings.length>0&&(n.warnings=e.warnings),j(e.recovery)&&(n.recovery=e.recovery),typeof e.claimed_by=="string"||typeof e.released_by=="string")for(let i of["claimed_by","released_by","previous_assignee","forced","skipped","available","attempts","suggestions"])Object.hasOwn(e,i)&&(n[i]=e[i])}function Rf(e){let t=Sf(e)?e[ir]:void 0;if(!Array.isArray(t))return{projected:e,changed:!1};let n=!1,r=t.map(o=>{if(!j(o))return o;let i=is(o);return i?(n=!0,i):o});return n?{projected:Cf(e,r),changed:!0}:{projected:e,changed:!1}}function as(e,t={}){let n=kf(e,t);if(n!==null)return n;if(t.idOnly===!0){let c=ss(e);if(c!==null)return c}if(t.compactEnvelope===!0){let c=Tf(e);if(c!==null)return c}if((t.changedFields??"full")==="full"||!j(e))return e;let o=!1,i=e,s=Af(e)?is(e):null;s!==null&&(i=s,o=!0);let a=Rf(i);return a.changed&&(i=a.projected,o=!0),o?i:e}import{AsyncLocalStorage as Qm}from"node:async_hooks";(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]="b18eefc1-0d1d-5c9c-b98a-b96771070301")}catch{}})();var cs=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),xf=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract","--all"]);function Nf(e){let t=e.indexOf("=");return t>0&&cs.has(e.slice(0,t))}function Df(e,t){return typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-")}function ds(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(cs.has(n)){t+=Df(n,e[t+1])?1:0;continue}if(!(Nf(n)||xf.has(n)||n==="--profile"||n==="--id-only"||n==="--explain")&&!n.startsWith("-"))return t}}function Tw(e){let t=ds(e);return t===void 0?void 0:e[t].trim().toLowerCase()}(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]="4f014bd9-39b6-5017-93ed-f0e7fba8497a")}catch{}})();var ls=e=>{let t='"',n=0;for(let r of e){if(r==="\\"){n+=1;continue}t+="\\".repeat(r==='"'?n*2+1:n),t+=r,n=0}return`${t}${"\\".repeat(n*2)}"`},us=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?ls(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,qt=(e,t=process.platform)=>{let n=e.map(r=>us(r,t)).join(" ");return n.length>0?`pm ${n}`:"pm"};(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]="49de148c-3c60-547b-b3bc-d0a71e013dc6")}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]="d248fcfa-d007-526a-9849-9ea8352acaa1")}catch{}})();var _s=new WeakMap;function $w(e,t){_s.set(e,new Set(t))}var fs='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',Pf={context:{row_keys:["high_level","low_level"],fields:"supported"},get:{row_keys:["children"],fields:"supported"},list:{row_keys:["items"],fields:"supported"},next:{row_keys:["recommended","ready","decision_needed","gate_needed","containers","blocked","held_by_others"],fields:"unsupported"},search:{row_keys:["items"],fields:"supported"},activity:{row_keys:["activity_digest","compact_activity","provenance_activity","activity"],fields:"unsupported"},history:{row_keys:["compact_history","provenance_history","history","diff"],fields:"unsupported"},deps:{row_keys:["graph.nodes","graph.edges","context.nodes","context.edges"],fields:"unsupported"},health:{row_keys:["checks"],fields:"unsupported"},aggregate:{row_keys:["groups"],fields:"unsupported"},duplicates:{row_keys:["clusters"],fields:"unsupported"},stats:{row_keys:["by_type","by_status"],fields:"unsupported"},comments:{row_keys:["comments"],fields:"unsupported"},notes:{row_keys:["notes"],fields:"unsupported"},learnings:{row_keys:["learnings"],fields:"unsupported"},files:{row_keys:["files"],fields:"unsupported"},docs:{row_keys:["docs"],fields:"unsupported"},validate:{row_keys:["checks","warnings"],fields:"unsupported"},contracts:{row_keys:["command_summaries","commands"],fields:"unsupported"}},Mf=[{command:"activity",complete_mode:"full",omissions_by_mode:{digest:[{name:"event_rows",restore_with:"--raw"}],compact:[{name:"provenance",restore_with:"--full"}],provenance:[{name:"patch_and_hashes",restore_with:"--full"}]}},{command:"history",complete_mode:"full",omissions_by_mode:{compact:[{name:"raw_history",restore_with:"--full"}],provenance:[{name:"patch_and_hashes",restore_with:"--full"}]}}];function Lw(e,t,n){if(e&&t)throw new h(`${n} cannot be combined with --full`,y.USAGE)}function W(e,t=new Set){let n=e.filter(r=>!t.has(r.name)).map(r=>({...r}));return{has_omissions:n.length>0,omitted_field_group_count:n.length,omitted_field_groups:n}}function jw(e,t){let n=Mf.find(o=>o.command===e);if(n===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===n.complete_mode)return W([]);let r=n.omissions_by_mode[t];if(r===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return W(r)}var $f=[{name:"hierarchy",restore_with:"--depth standard"},{name:"activity",restore_with:"--depth standard"},{name:"progress",restore_with:"--depth standard"},{name:"blockers",restore_with:"--depth standard"},{name:"recently_created",restore_with:"--depth standard"},{name:"unparented",restore_with:"--depth standard"},{name:"files",restore_with:"--depth deep"},{name:"workload",restore_with:"--depth standard"},{name:"staleness",restore_with:"--depth deep"},{name:"tests",restore_with:"--depth deep"},{name:"workspace_memory",restore_with:"--depth deep"}];function F(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Lf=new Set([void 0,"tabular_when_uniform"]),jf=new Set(["collection","none"]),Ff=new Set(["supported","unsupported"]);function ms(e,t){return Array.isArray(e)&&(t||e.length>0)&&e.every(n=>typeof n=="string"&&n.length>0)&&new Set(e).size===e.length}function Uf(e){return F(e)&&typeof e.command=="string"&&e.command.trim().length>0&&jf.has(e.row_kind)&&ms(e.row_keys,!0)&&(e.continuation_row_keys===void 0||ms(e.continuation_row_keys,!1))&&Ff.has(e.fields)&&Lf.has(e.toon_encoding)&&(e.row_kind==="collection"?e.row_keys.length>0&&typeof e.jq_selector=="string"&&e.jq_selector.trim().length>0:e.row_keys.length===0&&e.jq_selector===void 0)}var zf={ancestors:["ids"],descendants:["ids"],predecessors:["ids"],successors:["ids"],paths:["paths"],impact:["affected"],audit:["findings"],communities:["communities"],redundancy:["redundant"],dominators:["bottlenecks"],slack:["rows"],centrality:["rows"],articulation:["articulation_points","bridges"],plan:["steps"]},qf={context:["sections_included","high_level","low_level"],get:["item"],list:["items","projection"],next:["recommended","ready","decision_needed","gate_needed","containers","blocked","held_by_others"],search:["items","projection"],activity:["activity_digest","compact_activity","provenance_activity","activity"],history:["compact_history","provenance_history","history","diff"],deps:["tree","graph","projection"],health:["checks"],aggregate:["groups"],duplicates:["clusters"],stats:["totals","by_type","by_status"],comments:["comments"],notes:["notes"],learnings:["learnings"],files:["files"],docs:["docs"],validate:["checks","warnings"],contracts:["command_summaries","commands","selected"]};function Bf(e,t){let n=e.trim().toLowerCase().split(/\s+/u,1)[0],r=n?.startsWith("list-")?"list":n;if(r==="graph"){let s=typeof t.subcommand=="string"?t.subcommand:"";if(s.length===0)return;let a=zf[s];if(a===void 0)return;let c=a.filter(d=>Array.isArray(t[d])||F(t[d]));return{command:"graph",row_kind:c.length>0?"collection":"none",row_keys:c,fields:"unsupported",...c.length>0?{jq_selector:fs}:{},toon_encoding:"tabular_when_uniform"}}let o=Pf[r],i=qf[r];return o===void 0||i===void 0||!i.some(s=>Object.hasOwn(t,s))?void 0:(()=>{let s=o.row_keys.filter(a=>{let c=a.split(".").reduce((d,l)=>F(d)?d[l]:void 0,t);return Array.isArray(c)||F(c)});return{command:r,row_kind:s.length>0?"collection":"none",row_keys:s,fields:o.fields,...s.length>0?{jq_selector:fs}:{},toon_encoding:"tabular_when_uniform"}})()}function Vf(e){if(!F(e.projection)||typeof e.projection.mode!="string"||e.projection.mode.trim().length===0)return;let t=e.projection.declared_field_groups,n=e.projection.included_field_groups;if(!Array.isArray(t)||!Array.isArray(n))return;let r=t.filter(s=>F(s)&&typeof s.name=="string"&&s.name.trim().length>0&&typeof s.restore_with=="string"&&s.restore_with.trim().length>0),o=n.filter(s=>typeof s=="string");if(r.length!==t.length||o.length!==n.length)return;let i=new Set(r.map(s=>s.name));if(!(i.size!==r.length||new Set(o).size!==o.length||o.some(s=>!i.has(s))))return W(r,new Set(o))}function Wf(e){if(!Array.isArray(e.sections_included))return;let t=W($f,new Set(e.sections_included.filter(n=>typeof n=="string")));return F(e.summary)&&e.summary.scope==="matching_items"&&(t.summary_scope="matching_items"),t}function Gf(e){if(!F(e.item))return;let t=e.item,n=["comments","notes","learnings","files","tests","docs","reminders","events"],r=["body","children","claim_state","linked","schedule"],o=_s.get(e),i=a=>n.includes(a)||a==="body"?t:e,s=["body",...n,...r.slice(1)].filter(a=>o===void 0||o.has(a)||Object.hasOwn(i(a),a)).map(a=>({name:a,restore_with:`--fields ${a}`}));return W(s,new Set(s.flatMap(({name:a})=>Object.hasOwn(i(a),a)?[a]:[])))}function ps(e){if(F(e.projection))return W([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function Kf(e){if(!F(e.projection))return W([]);if(typeof e.projection.mode=="string")return W([{name:"full_check_details",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_check_details"]:[]))}function Hf(e){if(!(!F(e.selected)||typeof e.selected.summary!="boolean"))return W([{name:"full_contract_catalog",restore_with:"--full"}],new Set(e.selected.summary?[]:["full_contract_catalog"]))}function Yf(e,t){let n=Vf(t);if(n!==void 0)return n;let[r]=e.split(/\s+/u,1);if(r==="context")return Wf(t);if(r==="get")return Gf(t);if(r==="list"||r.startsWith("list-"))return ps(t);if(r==="search")return ps(t)??W([{name:"projection_metadata",restore_with:"--full"}]);if(r==="health")return Kf(t);if(r==="contracts")return Hf(t)}function gs(e,t){if(e===void 0||!F(t))return t;let n=Yf(e,t),r=t.row_contract,o=Uf(r)?r:Bf(e,t),i=o!==void 0?{...t,row_contract:o}:Object.hasOwn(t,"row_contract")?Object.fromEntries(Object.entries(t).filter(([s])=>s!=="row_contract")):t;return F(i.omission_receipt)||n===void 0?i:{...i,omission_receipt:n}}import{randomUUID as qm}from"node:crypto";import{randomUUID as jm}from"node:crypto";import{constants as Ne}from"node:fs";import{lstat as js,mkdir as Fm,open as Us,rename as Um,rm as zm}from"node:fs/promises";import Gt from"node:path";import{constants as ym}from"node:fs";import z from"node:fs/promises";import Wt from"node:path";import{randomUUID as dr}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]="43f7bd27-7874-56f9-a497-e6f67a3ae9be")}catch{}})();function ys(e){let t=Math.ceil(e.size/2);for(let n of e.keys()){if(t===0)return;e.delete(n),t-=1}}import Xf from"node:crypto";import{AsyncLocalStorage as Jf}from"node:async_hooks";(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]="38ed5847-939e-5846-bc7d-6d257d36a25f")}catch{}})();var bs=new Jf,hs=1024;function ws(){let e=bs.getStore();if(e===void 0)return;let t=new Date(Date.parse(e.clock)+e.clockReads*e.tickMs).toISOString();return e.clockReads+=1,t}function Bw(e){let t=bs.getStore();if(t===void 0)return;if(!Number.isSafeInteger(e)||e<0||e>hs)throw new Error(`Reproducible token length must be an integer between 0 and ${hs}`);let n="";for(;n.length<e;){let r=Xf.createHash("sha256").update(`${t.seed}\0${t.tokenReads}`).digest();t.tokenReads+=1;for(let o of r)if(n+=(o%36).toString(36),n.length===e)break}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a5bd8db9-cd23-5529-ad78-b7e87bd43b59")}catch{}})();var Qf=/^([+-]?)(\d+)([hdwm])$/i,Zf=/^[+-]?\d+[hdwm](?:[+-]\d+[hdwm])+$/i,em=/^(\d{4})(\d{2})(\d{2})$/,tm=/^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,nm=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})-(\d{2})(?:-(\d{2}))?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,rm=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,om=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;function Es(){return ws()??new Date().toISOString()}function Yw(e){return Number.isFinite(Date.parse(e))}function im(e){let t=om.exec(e);if(!t||!Number.isFinite(Date.parse(e)))return!1;let[,n,r,o,i,s,a,c,d]=t,[l,u,f,m,p,_]=[n,r,o,i,s,a].map(Number);return u>=1&&u<=12&&f>=1&&f<=cr(l,u-1)&&m<=23&&p<=59&&_<=59&&(c===void 0||Number(c)<=23)&&(d===void 0||Number(d)<=59)}function Xw(e){let t=/\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/iu.exec(e)?.[1];return im(e)&&(t===void 0||/^\d{0,3}0*$/u.test(t))}var sm=1e4,Bt=new Map;function vs(e){let t=Bt.get(e);if(t!==void 0)return t;let n=Date.parse(e);return Bt.size>=sm&&ys(Bt),Bt.set(e,n),n}function xe(e,t){let n=vs(e),r=vs(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t)}function Jw(e,t){return!(t.deadlineBefore&&(!e.deadline||xe(e.deadline,t.deadlineBefore)>0)||t.deadlineAfter&&(!e.deadline||xe(e.deadline,t.deadlineAfter)<0)||t.updatedAfter&&xe(e.updated_at,t.updatedAfter)<0||t.updatedBefore&&xe(e.updated_at,t.updatedBefore)>0||t.createdAfter&&xe(e.created_at,t.createdAfter)<0||t.createdBefore&&xe(e.created_at,t.createdBefore)>0)}function sr(e){return e?`.${e.slice(1).padEnd(3,"0").slice(0,3)}`:""}function ar(e){if(!e)return"";if(e.toUpperCase()==="Z")return"Z";let t=/^([+-]\d{2})(\d{2})$/.exec(e);return t?`${t[1]}:${t[2]}`:e}function am(e,t,n){n&&n!==t&&(e.includes(n)||e.push(n))}function cm(e){let t=[],n=d=>am(t,e,d),r=em.exec(e);if(r){let[,d,l,u]=r;n(`${d}-${l}-${u}`)}let o=tm.exec(e);if(o){let[,d,l,u,f,m,p,_,g]=o,w=p?`:${p}`:"";n(`${d}-${l}-${u}T${f}:${m}${w}${sr(_)}${ar(g)}`)}let i=nm.exec(e);if(i){let[,d,l,u,f,m,p]=i,_=f?`:${f}`:"";n(`${d}T${l}:${u}${_}${sr(m)}${ar(p)}`)}let s=rm.exec(e);if(s){let[,d,l,u,f,m,p]=s,_=f?`:${f}`:"";n(`${d}T${l}:${u}${_}${sr(m)}${ar(p)}`)}let a=10,c=e.slice(0,a);if(lm(c)){let d=a;for(;d<e.length&&um(e[d]);)d+=1;d<e.length&&n(`${c}T${e.slice(d)}`)}return t}function dm(e){let t=Date.parse(e);if(Number.isFinite(t))return t;for(let n of cm(e)){let r=Date.parse(n);if(Number.isFinite(r))return r}return Number.NaN}function lm(e){if(e.length!==10)return!1;for(let t=0;t<e.length;t+=1){let n=e[t];if(t===4||t===7){if(n!=="-")return!1;continue}let r=n.charCodeAt(0);if(r<48||r>57)return!1}return!0}function um(e){return e?e===" "||e===" "||e===`
|
|
8
|
+
`,"utf8")}finally{await r.close()}}async function Ey(e){try{await C.unlink(e)}catch(t){if(!go(t))throw t}}function pe(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}import yo from"path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="83a29a06-1b0b-52e6-9617-2fc03861cb18")}catch{}})();function kn(e,t){let n=yo.relative(e,t);return n.length===0?!0:!n.startsWith("..")&&!yo.isAbsolute(n)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="de5f8d66-b9dc-555c-a52f-33b1b5368be3")}catch{}})();var Pd="__pm_suppress_host_output",On="@unbrained/pm-cli:suppress-host-output:v1";function ho(e){return e===void 0?{__pm_suppress_host_output:On}:{__pm_suppress_host_output:On,result:e}}function An(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&e[Pd]===On}import Se from"node:fs";import Z from"node:path";import{fileURLToPath as Md}from"node:url";(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]="dc77f588-e4ea-59fc-908f-51b41114430a")}catch{}})();var $d="@unbrained/pm-cli";function Ld(e){try{return JSON.parse(Se.readFileSync(e,"utf8")).name===$d}catch{return!1}}function jd(e){let t=Se.existsSync(e)&&Se.statSync(e).isDirectory()?Z.resolve(e):Z.dirname(Z.resolve(e));for(;;){let n=Z.join(t,"package.json");if(Se.existsSync(n)&&Ld(n))return t;let r=Z.dirname(t);if(r===t)return;t=r}}function Sn(e,t=[]){let n=Md(e),r=jd(n);return r||Z.resolve(Z.dirname(n),...t)}function Ry(e,t=[]){try{let n=Z.join(Sn(e,t),"package.json");if(!Se.existsSync(n))return;let r=JSON.parse(Se.readFileSync(n,"utf8"));return typeof r.version=="string"&&r.version.trim().length>0?r.version:void 0}catch{return}}(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]="49fe564d-671f-5425-96fe-517cb323f773")}catch{}})();function Fd(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Ny(e){return Fd(e)??void 0}function Dy(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t-=1;return t===e.length?e:e.slice(0,t)}function Py(e){return Array.isArray(e)&&e.every(t=>typeof t=="number"&&Number.isFinite(t))}function wo(e){if(e instanceof Error){let t=e.message.trim();return t.length>0?t:e.name}return String(e)}function vo(e){let t=typeof e=="number"?e:typeof e=="string"&&e.trim().length>0?Number(e.trim()):Number.NaN;return Number.isFinite(t)?t:null}function My(e){let t=vo(e);return t===null||t<=0||!Number.isInteger(t)?null:t}function $y(e,t,n){let r=vo(e);return r===null||r<t||r>n?null:r}function ee(e){return typeof e!="object"||e===null?null:e}function bo(e){return typeof e!="object"&&typeof e!="function"||e===null?null:e}function Eo(e){let t=bo(e);if(!t)return null;if(typeof t.activate=="function")return t;let n=bo(t.default);return typeof n?.activate=="function"?n:null}function Ly(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...e}:{}}import{readFileSync as Al,readdirSync as Qy,statSync as Sl}from"node:fs";import Cl from"node:os";import A from"node:path";import Vd from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0ca7f52c-fb31-5cd9-b689-a918f4e61816")}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]="7647d826-e562-5f8e-86b2-2e40d8714b4d")}catch{}})();function te(e){return[...new Set((e??[]).map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function Ud(e){let t=e.key.trim();if(t.length===0)return null;let n=te(e.aliases),r=e.description?.trim();return{key:t,values:te(e.values),required:e.required===!0?!0:void 0,aliases:n.length>0?n:void 0,description:r&&r.length>0?r:void 0}}var zd=e=>e,Oo=e=>{let t=e.trim().toLowerCase();return t==="create"||t==="update"?t:null};function qd(e,t){let n=t(e.command);if(n===null)return null;let r=e.option.trim();return r.length===0?null:{command:n,option:r,required:e.required,visible:e.visible,enabled:e.enabled}}function Bd(e,t){let n=new Map;for(let r of e??[]){let o=qd(r,t);o&&n.set(`${o.command}:${o.option.toLowerCase()}`,o)}return[...n.values()].sort((r,o)=>r.command===o.command?r.option.localeCompare(o.option):r.command.localeCompare(o.command))}function ko(e,t){return t?te(e):void 0}function Cn(e){let t=e?.trim();return t&&t.length>0?t:void 0}function Tn(e){if(e===void 0||e==="agent"||e==="human"||e==="gate")return e;throw new Error("Item type execution_role must be agent, human, or gate.")}function Ao(e,t={}){let n=t.resolvePolicyCommand??zd,r=e.name.trim();if(r.length===0)return null;let o=e.required_create_fields!==void 0,i=e.required_create_repeatables!==void 0,s=e.options!==void 0,a=e.command_option_policies!==void 0,c=te(e.aliases),d=(e.options??[]).map(u=>Ud(u)).filter(u=>u!==null).sort((u,f)=>u.key.localeCompare(f.key)),l=Bd(e.command_option_policies,n);return{name:r,description:Cn(e.description),default_status:Cn(e.default_status),...e.execution_role===void 0?{}:{execution_role:Tn(e.execution_role)},folder:Cn(e.folder),aliases:c.length>0?c:void 0,required_create_fields:ko(e.required_create_fields,o),required_create_repeatables:ko(e.required_create_repeatables,i),options:s?d:void 0,command_option_policies:a?l: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]="69ea08ca-3793-51d7-a971-95abf442028f")}catch{}})();var Wd=Object.freeze({decision:"human",milestone:"gate"}),Gd=["title","description","status","priority","tags","body","deadline","estimatedMinutes","acceptanceCriteria","author","message","assignee"],Kd=["dep","comment","note","learning","file","test","doc"],Co=["deadline","estimatedMinutes","acceptanceCriteria","definitionOfReady","order","goal","objective","value","impact","outcome","whyNow","assignee","parent","reviewer","risk","confidence","sprint","release","blockedBy","blockedReason","unblockNote","reporter","severity","environment","reproSteps","resolution","expectedResult","actualResult","affectedVersion","fixedVersion","component","regression","customerImpact"],Hd=["title","description","type","status","priority","tags","body",...Co,"author","message","dep","comment","note","learning","file","test","doc","reminder","event","typeOption","field"],Yd=["title","description","body","status","closeReason","priority","type","tags",...Co,"author","message","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ownershipMetadataBypass","ownershipDependencyBypass","force"],To={"close-reason":"closeReason",close_reason:"closeReason","estimated-minutes":"estimatedMinutes",estimated_minutes:"estimatedMinutes",estimate:"estimatedMinutes","acceptance-criteria":"acceptanceCriteria",acceptance_criteria:"acceptanceCriteria",ac:"acceptanceCriteria","definition-of-ready":"definitionOfReady",definition_of_ready:"definitionOfReady",rank:"order","why-now":"whyNow",why_now:"whyNow","blocked-by":"blockedBy",blocked_by:"blockedBy","blocked-reason":"blockedReason",blocked_reason:"blockedReason","unblock-note":"unblockNote",unblock_note:"unblockNote","repro-steps":"reproSteps",repro_steps:"reproSteps","expected-result":"expectedResult",expected_result:"expectedResult","actual-result":"actualResult",actual_result:"actualResult","affected-version":"affectedVersion",affected_version:"affectedVersion","fixed-version":"fixedVersion",fixed_version:"fixedVersion","customer-impact":"customerImpact",customer_impact:"customerImpact","type-option":"typeOption",type_option:"typeOption",type_options:"typeOption"},Xd={...To},Jd={...To},Io=[["deadline","--deadline"],["estimatedMinutes","--estimate/--estimated-minutes"],["acceptanceCriteria","--acceptance-criteria/--ac"],["definitionOfReady","--definition-of-ready"],["order","--order/--rank"],["goal","--goal"],["objective","--objective"],["value","--value"],["impact","--impact"],["outcome","--outcome"],["whyNow","--why-now"],["assignee","--assignee"],["parent","--parent"],["reviewer","--reviewer"],["risk","--risk"],["confidence","--confidence"],["sprint","--sprint"],["release","--release"],["blockedBy","--blocked-by"],["blockedReason","--blocked-reason"],["unblockNote","--unblock-note"],["reporter","--reporter"],["severity","--severity"],["environment","--environment"],["reproSteps","--repro-steps"],["resolution","--resolution"],["expectedResult","--expected-result"],["actualResult","--actual-result"],["affectedVersion","--affected-version"],["fixedVersion","--fixed-version"],["component","--component"],["regression","--regression"],["customerImpact","--customer-impact"]],Ro=[["comment","--comment"],["note","--note"],["learning","--learning"],["file","--file"],["test","--test"],["doc","--doc"],["reminder","--reminder"],["event","--event"],["typeOption","--type-option"]];function xo(e){return Object.fromEntries(e)}var Qd=xo([["title","--title"],["description","--description"],["type","--type"],["status","--status"],["priority","--priority"],["tags","--tags"],["body","--body"],...Io,["author","--author"],["message","--message"],["dep","--dep"],...Ro]),Zd=xo([["title","--title"],["description","--description"],["body","--body"],["status","--status"],["closeReason","--close-reason"],["priority","--priority"],["type","--type"],["tags","--tags"],...Io,...Ro,["author","--author"],["message","--message"],["force","--force"]]);function el(e){return e.trim().replace(/^--+/,"").toLowerCase()}function tl(e){return e==="create"?Hd:Yd}function nl(e){return e==="create"?Xd:Jd}function No(e,t){let n=el(t);if(n.length===0)return;let r=nl(e)[n];return r||tl(e).find(o=>o.toLowerCase()===n)}function Gy(e,t){return(e==="create"?Qd:Zd)[t]??`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function Rn(e){let t=ol(e);return t.length===0?"items":t.endsWith("s")?t:`${t}s`}function rl(e){let t=e.trim(),r=t.replaceAll("\\","/").replace(/^\/+/,""),o=Vd.posix.normalize(r);if(t.includes("\0")||/^[A-Za-z]:/.test(o)||o==="."||o===".."||o.startsWith("../"))throw new Error(`Item type folder "${e}" must stay inside the pm tracker root.`);return o}function ol(e){let t=e.trim().toLowerCase(),n="",r=!1;for(let o of t){let i=o.charCodeAt(0),s=i>=97&&i<=122,a=i>=48&&i<=57;if(s||a){r&&n.length>0&&(n+="-"),n+=o,r=!1;continue}n.length>0&&(r=!0)}return n}function il(e){return Ao(e,{resolvePolicyCommand:Oo})}function Ge(e,t){let n=e[t];return Array.isArray(n)?n.filter(r=>typeof r=="string"):void 0}function sl(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e;return typeof t.key!="string"?null:{key:t.key,values:Ge(t,"values")??[],required:t.required===void 0?void 0:!!t.required,aliases:Ge(t,"aliases"),description:typeof t.description=="string"?t.description:void 0}}function al(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e;if(typeof t.command!="string"||typeof t.option!="string")return null;let n=t.command.trim().toLowerCase();return n!=="create"&&n!=="update"?null:{command:n,option:t.option,required:t.required===void 0?void 0:!!t.required,visible:t.visible===void 0?void 0:!!t.visible,enabled:t.enabled===void 0?void 0:!!t.enabled}}function cl(e){if(Array.isArray(e.options))return e.options.map(t=>sl(t)).filter(t=>t!==null)}function dl(e){if(Array.isArray(e.command_option_policies))return e.command_option_policies.map(t=>al(t)).filter(t=>t!==null)}function ll(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e,n=typeof t.name=="string"?t.name:"";if(n.trim().length===0)return null;let r=typeof t.folder=="string"?t.folder:void 0,o=typeof t.description=="string"?t.description:void 0,i=typeof t.default_status=="string"?t.default_status:void 0;return{name:n,description:o,default_status:i,execution_role:Tn(t.execution_role),folder:r,aliases:Ge(t,"aliases"),required_create_fields:Ge(t,"required_create_fields"),required_create_repeatables:Ge(t,"required_create_repeatables"),options:cl(t),command_option_policies:dl(t)}}function ul(e,t){return e.required_create_fields?te(e.required_create_fields):t?.required_create_fields??[]}function fl(e,t){return e.required_create_repeatables?te(e.required_create_repeatables):t?.required_create_repeatables??[]}function ml(e,t){return e.options?e.options:t?.options?[...t.options]:[]}function pl(e,t){return e.command_option_policies?e.command_option_policies:t?.command_option_policies?[...t.command_option_policies]:[]}function _l(e,t){let n=t?.name??e.name,r=e.description??t?.description,o=e.default_status??t?.default_status,i=rl(e.folder??t?.folder??Rn(n)),s={name:n,execution_role:e.execution_role,folder:i,aliases:te([...t?.aliases??[],...e.aliases??[]]),required_create_fields:ul(e,t),required_create_repeatables:fl(e,t),options:ml(e,t),command_option_policies:pl(e,t)};return r&&(s.description=r),o&&(s.default_status=o),s}function So(e,t){for(let n of e){let r=il(n);if(!r)continue;let o=r.name.toLowerCase(),i=t.get(o);t.set(o,_l({...r,execution_role:r.execution_role??i?.execution_role},i))}}function gl(e){if(!e)return[];let t=[];for(let n of e.item_types??[]){let r=n.types;if(Array.isArray(r))for(let o of r){let i=ll(o);i&&t.push(i)}}return t}function Ky(e,t=null){let n=new Map;for(let c of jr)n.set(c.toLowerCase(),{name:c,execution_role:Wd[c.toLowerCase()]??"agent",folder:Ue[c],aliases:[],required_create_fields:[...Gd],required_create_repeatables:[...Kd],options:[],command_option_policies:[]});So(e.item_types?.definitions??[],n),So(gl(t),n);let r=[...n.values()].sort((c,d)=>c.name.localeCompare(d.name)),o={},i={},s={};for(let c of r){o[c.name]=c,s[c.name]=c.folder,i[c.name.toLowerCase()]=c.name;for(let d of c.aliases)i[d.toLowerCase()]=c.name}let a=[...new Set(r.map(c=>c.folder))].sort((c,d)=>c.localeCompare(d));return{types:r.map(c=>c.name),folders:a,type_to_folder:s,by_type:o,alias_to_type:i}}function yl(e,t){if(e!==void 0)return t.alias_to_type[e.trim().toLowerCase()]}function hl(e,t){let n=yl(e,t);if(n)return t.by_type[n]}function bl(e,t,n,r){for(let o of r){let i=No(n,o);if(i){e.required.add(i);continue}e.errors.push(`Unsupported base required option "${o}" for command "${n}" on type "${t.name}"`)}}function In(e,t,n){if(n){e.add(t);return}e.delete(t)}function wl(e,t,n,r){let o=No(n,r.option);if(!o){e.errors.push(`Unsupported command_option_policies option "${r.option}" for command "${n}" on type "${t.name}"`);return}r.required!==void 0&&In(e.required,o,r.required),r.visible!==void 0&&In(e.hidden,o,!r.visible),r.enabled!==void 0&&In(e.disabled,o,!r.enabled)}function vl(e,t,n){for(let r of t.command_option_policies)r.command===n&&wl(e,t,n,r)}function El(e,t,n){for(let r of e.required)e.disabled.has(r)&&e.errors.push(`Option "${r}" cannot be both required and disabled for command "${n}" on type "${t.name}"`)}function Hy(e,t,n){let r=[],o=new Set,i=new Set,s=new Set,a={required:o,hidden:i,disabled:s,errors:r};return bl(a,e,t,n),vl(a,e,t),El(a,e,t),{required:[...o],hidden:[...i].sort((c,d)=>c.localeCompare(d)),disabled:[...s].sort((c,d)=>c.localeCompare(d)),errors:r}}function kl(e){let t=new Map;for(let n of e.options){t.set(n.key.toLowerCase(),n);for(let r of n.aliases??[])t.set(r.toLowerCase(),n)}return t}function Ol(e,t,n){let r=e.values;if(r.length===0)return t;let i=new Map(r.map(s=>[s.toLowerCase(),s])).get(t.toLowerCase());if(!i){n.push(`Invalid value "${t}" for type option "${e.key}". Allowed: ${r.join(", ")}`);return}return i}function Yy(e,t,n){let r=hl(e,n);if(!r)return{normalized:void 0,errors:[`Unknown type "${e}"`]};let o=[],i=kl(r),s={};for(let[c,d]of Object.entries(t??{})){let l=c.trim(),u=d.trim();if(l.length===0){o.push("type option keys must not be empty");continue}if(u.length===0){o.push(`type option "${l}" must not be empty`);continue}let f=i.get(l.toLowerCase());if(!f){let p=r.options.map(_=>_.key).join(", ");o.push(r.options.length>0?`Unknown type option "${l}" for type "${r.name}". Allowed: ${p}`:`Type "${r.name}" does not define any configurable type options`);continue}let m=Ol(f,u,o);m!==void 0&&(s[f.key]=m)}for(let c of r.options)c.required&&!(c.key in s)&&o.push(`Missing required type option "${c.key}" for type "${r.name}"`);let a=Object.keys(s).sort((c,d)=>c.localeCompare(d));return a.length===0?{normalized:void 0,errors:o}:{normalized:Object.fromEntries(a.map(c=>[c,s[c]])),errors: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]="124443e3-a20b-5fd6-a1d9-e4a09b17dc4a")}catch{}})();var Tl={json_markdown:".md",toon:".toon"},Il={".md":"json_markdown",".toon":"toon"};var oh=[".md",".toon"];function Nt(e){try{return Sl(e),!0}catch{return!1}}function Rl(e){try{let t=JSON.parse(Al(e,"utf8"));return typeof t!="object"||t===null||Array.isArray(t)?!1:"id_prefix"in t||"item_format"in t}catch{return!1}}function xl(e){let t=A.resolve(e);for(;;){let n=A.join(t,bt),r=A.join(n,wt);if(Nt(r))return n;let o=A.join(t,wt);if(Nt(o)&&Rl(o))return t;let i=A.dirname(t);if(i===t)return;t=i}}function Nl(e){return xl(e)??A.resolve(e,bt)}function ih(e,t){let n=process.env.PM_PATH,r=t?.trim()||n?.trim();if(r){let o=A.resolve(e,r);if(!Nt(Do(o))){let i=A.join(o,bt);if(Nt(Do(i)))return i}return o}return Nl(e)}function sh(e){let t=A.resolve(e),n=A.dirname(t);return A.basename(t)==="pm"&&A.basename(n)===".agents"?A.dirname(n):t}function Po(e){let t=process.env.PM_GLOBAL_PATH?.trim(),n=t&&t.length>0?t:A.join(Cl.homedir(),".pm-cli");return A.resolve(e,n)}function Do(e){return A.join(e,wt)}function Dl(e,t,n=Ue){let r=n[t]??Rn(t);return A.join(e,r)}function ah(e,t,n,r="toon",o=Ue){return A.join(Dl(e,t,o),`${n}${Tl[r]}`)}function ch(e){let t=e.replaceAll("\\","/"),n=A.posix.extname(t).toLowerCase();return Il[n]??null}function dh(e,t){if(!/^(?!\.{1,2}$)[^/\\:\0]+$/.test(t))throw new h("Invalid history item id: expected a single filename.",y.USAGE);return A.join(e,"history",`${t}.jsonl`)}function Mo(e,t){return A.join(e,"locks",`${t}.lock`)}function lh(e){return A.join(e,"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]="44b86710-2d6f-57fe-912d-1cf7482a4f86")}catch{}})();function $o(e){let t={beforeCommand:e.hooks.beforeCommand.length,beforeMutation:e.hooks.beforeMutation.length,afterCommand:e.hooks.afterCommand.length,onWrite:e.hooks.onWrite.length,onRead:e.hooks.onRead.length,onIndex:e.hooks.onIndex.length,commandOverrides:e.commands.overrides.length,commandHandlers:e.commands.handlers.length,parserOverrides:e.parsers.overrides.length,preflightOverrides:e.preflight.overrides.length,serviceOverrides:e.services.overrides.length,rendererOverrides:e.renderers.overrides.length,registrations:Object.fromEntries(Object.entries(e.registrations).map(([n,r])=>[n,r.length]))};return()=>{e.hooks.beforeCommand.length=t.beforeCommand,e.hooks.beforeMutation.length=t.beforeMutation,e.hooks.afterCommand.length=t.afterCommand,e.hooks.onWrite.length=t.onWrite,e.hooks.onRead.length=t.onRead,e.hooks.onIndex.length=t.onIndex,e.commands.overrides.length=t.commandOverrides,e.commands.handlers.length=t.commandHandlers,e.parsers.overrides.length=t.parserOverrides,e.preflight.overrides.length=t.preflightOverrides,e.services.overrides.length=t.serviceOverrides,e.renderers.overrides.length=t.rendererOverrides;for(let[n,r]of Object.entries(t.registrations))e.registrations[n].length=r}}(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]="aade6230-a71b-5cbc-bc9d-022f20e521bd")}catch{}})();function x(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return t}function D(e,t){if(t!==void 0&&typeof t!="boolean")throw new TypeError(`${e} must be a boolean when provided`)}function S(e,t){if(t!==void 0&&(typeof t!="string"||t.trim().length===0))throw new TypeError(`${e} must be a non-empty string when provided`)}function Lo(e,t){if(t===void 0)return;let n=r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean";if(Array.isArray(t)){for(let[r,o]of t.entries())if(!n(o))throw new TypeError(`${e}[${r}] must be a string, number, or boolean`);return}if(!n(t))throw new TypeError(`${e} must be a string, number, or boolean, or an array of these when provided`)}function ge(e,t){if(t!==void 0){if(!Array.isArray(t))throw new TypeError(`${e} must be an array of non-empty strings when provided`);for(let[n,r]of t.entries())if(typeof r!="string"||r.trim().length===0)throw new TypeError(`${e}[${n}] must be a non-empty string`)}}function Ke(e,t){if(ge(e,t),!Array.isArray(t))return[];let n=[],r=new Set;for(let o of t){let i=o.trim();i.length===0||r.has(i)||(r.add(i),n.push(i))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="34536eba-0f92-5599-a807-5b39b000e733")}catch{}})();var xn=Object.freeze(["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"]);(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]="ca48c32a-e4e0-5da5-b9cb-b1f713646bad")}catch{}})();var Pl=new Set(xn);function Ml(e){if(e!==void 0&&!Pl.has(String(e)))throw new Error(`registerCommand definition.family must be one of: ${xn.join(", ")}`)}function jo(e){S("registerCommand definition.action",e.action),S("registerCommand definition.family",e.family),S("registerCommand definition.description",e.description),S("registerCommand definition.intent",e.intent),S("registerCommand definition.tier",e.tier);let t=e.tier;if(t!==void 0&&t!=="core"&&t!=="standard"&&t!=="full"&&t!=="internal")throw new Error("registerCommand definition.tier must be core, standard, full, or internal");Ml(e.family)}(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]="1729c469-5e9c-5d8c-8137-ec506c9fd31b")}catch{}})();function $l(e){let t=x("registerExporter options.output",e),n=new Set(["channel","receipt","media_type"]);for(let r of Object.keys(t))if(!n.has(r))throw new TypeError(`registerExporter options.output contains unsupported field ${r}`);if(t.channel!=="stdout"&&t.channel!=="file")throw new TypeError("registerExporter options.output.channel must be stdout|file");if(t.receipt!==void 0&&t.receipt!=="suppress"&&t.receipt!=="render")throw new TypeError("registerExporter options.output.receipt must be suppress|render");if(t.channel==="stdout"&&t.receipt==="render")throw new TypeError("registerExporter stdout artifacts cannot render a host receipt");return S("registerExporter options.output.media_type",t.media_type),{channel:t.channel,receipt:t.receipt??(t.channel==="stdout"?"suppress":"render"),...typeof t.media_type=="string"?{media_type:t.media_type}:{}}}function Fo(e,t,n){if(e==="registerImporter"&&t.output!==void 0)throw new TypeError("registerImporter options.output is exporter-only");if(e!=="registerExporter"||t.output===void 0)return;let r=$l(t.output);return!n&&r.channel==="stdout"&&(t.description="Export items with the registered extension adapter. Artifact bytes are written exclusively to stdout and the host receipt is suppressed by default."),r}function Nn(e,t,n){return{registration:t,action:n,command:e.command,args:P(e.args),options:P(e.options),global:P(e.global),pm_root:e.pm_root,source_workspace_root:e.source_workspace_root,repo_root:e.repo_root,pm_root_rel:e.pm_root_rel,...e.sdk===void 0?{}:{sdk:e.sdk}}}(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]="b35d854e-5025-5999-abe7-507f1a25647f")}catch{}})();function Uo(e){return!e.extensionReady||!e.enabledForLoad?null:{layer:e.layer,directory:e.directory,manifest_path:e.manifestPath,entry_path:e.entryPath,manifest:e.manifest,source_package:e.sourceIdentity?.package_name,source_aliases:e.sourceIdentity?.aliases,contributions:e.sourceIdentity?.contributions}}(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]="8ea4597b-6a2b-5061-b490-d8aff3fbe7aa")}catch{}})();function U(e){return typeof e!="string"?"":e.trim().toLowerCase()}function b(e){return new Set((e??[]).map(t=>t.trim().toLowerCase()).filter(t=>t.length>0))}function Ll(e){let t=e.trim().toLowerCase();if(t.length===0)return"";let n=t.split(/[.:/]/).map(r=>r.replace(/[\s_-]+/g,"")).filter(r=>r.length>0);return n.length===0?"":n.length===1?n[0]:`${n[0]}.${n.slice(1).join("")}`}function Ce(e){return new Set((e??[]).map(t=>Ll(t)).filter(t=>t.length>0))}function zo(e){let t=U(e);return pt.includes(t)?t:"off"}function qo(e){let t=U(e);return _t.includes(t)?t:"off"}function He(e){let t=U(e);return gt.includes(t)?t:"none"}function Dn(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return Lr.includes(t)?t:void 0}function Bo(e){if(typeof e=="string"){let t=Dn(e)??"block";return{global:t,project:t}}return typeof e=="object"&&e!==null&&!Array.isArray(e)?{global:Dn(e.global)??"block",project:Dn(e.project)??"block"}:{global:"block",project:"block"}}function jl(e){return e.global===e.project?e.global:{global:e.global,project:e.project}}function E(e){return[...new Set(e)].sort((t,n)=>t.localeCompare(n))}function Fl(e){let t=U(e.name);return t.length===0?null:{name:t,normalized:{name:t,disabled:e.disabled===!0,requireTrusted:e.require_trusted===!0,requireProvenance:e.require_provenance===!0,sandboxProfile:e.sandbox_profile!==void 0?He(e.sandbox_profile):void 0,allowedCapabilities:b(e.allowed_capabilities),blockedCapabilities:b(e.blocked_capabilities),allowedSurfaces:Ce(e.allowed_surfaces),blockedSurfaces:Ce(e.blocked_surfaces),allowedCommands:b(e.allowed_commands),blockedCommands:b(e.blocked_commands),allowedActions:b(e.allowed_actions),blockedActions:b(e.blocked_actions),allowedServices:b(e.allowed_services),blockedServices:b(e.blocked_services)}}}function Vo(e){let t=new Map;for(let n of e??[]){let r=Fl(n);r&&t.set(r.name,r.normalized)}return t}function Ul(e){let t=[],n=[...e.overridesByName.values()].sort((o,i)=>o.name.localeCompare(i.name));for(let o of E([...e.allowedCapabilities,...e.blockedCapabilities]))J(o)||t.push(`extension_policy_unknown_capability:${o}`);for(let o of n)for(let i of E([...o.allowedCapabilities,...o.blockedCapabilities]))J(i)||t.push(`extension_policy_unknown_capability:${o.name}:${i}`);let r=new Set(yt);for(let o of E([...e.allowedSurfaces,...e.blockedSurfaces]))r.has(o)||t.push(`extension_policy_unknown_surface:${o}`);for(let o of n)for(let i of E([...o.allowedSurfaces,...o.blockedSurfaces]))r.has(i)||t.push(`extension_policy_unknown_surface:${o.name}:${i}`);return[...new Set(t)].sort((o,i)=>o.localeCompare(i))}function Wo(e){let t=e.extensions?.policy??{},n=b(t.allowed_capabilities),r=b(t.blocked_capabilities),o=Ce(t.allowed_surfaces),i=Ce(t.blocked_surfaces),s=Vo(t.extension_overrides);return{mode:zo(t.mode),trustMode:qo(t.trust_mode),pmMaxVersionExceededMode:Bo(t.pm_max_version_exceeded_mode),requireProvenance:t.require_provenance===!0,trustedExtensions:b(t.trusted_extensions),defaultSandboxProfile:He(t.default_sandbox_profile),allowedExtensions:b(t.allowed_extensions),blockedExtensions:b(t.blocked_extensions),allowedCapabilities:n,blockedCapabilities:r,allowedSurfaces:o,blockedSurfaces:i,allowedCommands:b(t.allowed_commands),blockedCommands:b(t.blocked_commands),allowedActions:b(t.allowed_actions),blockedActions:b(t.blocked_actions),allowedServices:b(t.allowed_services),blockedServices:b(t.blocked_services),overridesByName:s,warnings:Ul({allowedCapabilities:n,blockedCapabilities:r,allowedSurfaces:o,blockedSurfaces:i,overridesByName:s})}}function Go(e){let t=[...e.overridesByName.values()].sort((n,r)=>n.name.localeCompare(r.name)).map(n=>({name:n.name,...n.disabled?{disabled:!0}:{},...n.requireTrusted?{require_trusted:!0}:{},...n.requireProvenance?{require_provenance:!0}:{},...n.sandboxProfile?{sandbox_profile:n.sandboxProfile}:{},...n.allowedCapabilities.size>0?{allowed_capabilities:E(n.allowedCapabilities)}:{},...n.blockedCapabilities.size>0?{blocked_capabilities:E(n.blockedCapabilities)}:{},...n.allowedSurfaces.size>0?{allowed_surfaces:E(n.allowedSurfaces)}:{},...n.blockedSurfaces.size>0?{blocked_surfaces:E(n.blockedSurfaces)}:{},...n.allowedCommands.size>0?{allowed_commands:E(n.allowedCommands)}:{},...n.blockedCommands.size>0?{blocked_commands:E(n.blockedCommands)}:{},...n.allowedActions.size>0?{allowed_actions:E(n.allowedActions)}:{},...n.blockedActions.size>0?{blocked_actions:E(n.blockedActions)}:{},...n.allowedServices.size>0?{allowed_services:E(n.allowedServices)}:{},...n.blockedServices.size>0?{blocked_services:E(n.blockedServices)}:{}}));return{mode:e.mode,trust_mode:e.trustMode,pm_max_version_exceeded_mode:jl(e.pmMaxVersionExceededMode),require_provenance:e.requireProvenance,trusted_extensions:E(e.trustedExtensions),default_sandbox_profile:e.defaultSandboxProfile,allowed_extensions:E(e.allowedExtensions),blocked_extensions:E(e.blockedExtensions),allowed_capabilities:E(e.allowedCapabilities),blocked_capabilities:E(e.blockedCapabilities),allowed_surfaces:E(e.allowedSurfaces),blocked_surfaces:E(e.blockedSurfaces),allowed_commands:E(e.allowedCommands),blocked_commands:E(e.blockedCommands),allowed_actions:E(e.allowedActions),blocked_actions:E(e.blockedActions),allowed_services:E(e.allowedServices),blocked_services:E(e.blockedServices),extension_overrides:t}}function Ko(e){let t=Vo(e.extension_overrides);return{mode:zo(e.mode),trustMode:qo(e.trust_mode),pmMaxVersionExceededMode:Bo(e.pm_max_version_exceeded_mode),requireProvenance:e.require_provenance===!0,trustedExtensions:b(e.trusted_extensions),defaultSandboxProfile:He(e.default_sandbox_profile),allowedExtensions:b(e.allowed_extensions),blockedExtensions:b(e.blocked_extensions),allowedCapabilities:b(e.allowed_capabilities),blockedCapabilities:b(e.blocked_capabilities),allowedSurfaces:Ce(e.allowed_surfaces),blockedSurfaces:Ce(e.blocked_surfaces),allowedCommands:b(e.allowed_commands),blockedCommands:b(e.blocked_commands),allowedActions:b(e.allowed_actions),blockedActions:b(e.blocked_actions),allowedServices:b(e.allowed_services),blockedServices:b(e.blocked_services),overridesByName:t,warnings:[]}}function ne(e,t){return e.overridesByName.get(U(t))??null}function Te(e,t,n,r,o){return t.has(n)?o:e.size>0&&!e.has(n)?r:null}function Ho(e,t,n){let r=n.trim().toLowerCase(),o=ne(e,t.name),i=o&&o.allowedCapabilities.size>0?o.allowedCapabilities:e.allowedCapabilities,s=new Set([...e.blockedCapabilities,...o?o.blockedCapabilities:[]]);return Te(i,s,r,"capability_not_allowlisted","capability_blocked")}function zl(e,t,n){let r=ne(e,t.name),o=r&&r.allowedSurfaces.size>0?r.allowedSurfaces:e.allowedSurfaces,i=new Set([...e.blockedSurfaces,...r?r.blockedSurfaces:[]]);return Te(o,i,n,"surface_not_allowlisted","surface_blocked")}function ql(e,t,n){let r=O(n);if(r.length===0)return null;let o=ne(e,t.name),i=o&&o.allowedCommands.size>0?o.allowedCommands:e.allowedCommands,s=new Set([...e.blockedCommands,...o?o.blockedCommands:[]]);return Te(i,s,r,"command_not_allowlisted","command_blocked")}function Bl(e,t,n){let r=U(n).replace(/\s+/g,"-");if(r.length===0)return null;let o=ne(e,t.name),i=o&&o.allowedActions.size>0?o.allowedActions:e.allowedActions,s=new Set([...e.blockedActions,...o?o.blockedActions:[]]);return Te(i,s,r,"action_not_allowlisted","action_blocked")}function Vl(e,t,n){let r=U(n);if(r.length===0)return null;let o=ne(e,t.name),i=o&&o.allowedServices.size>0?o.allowedServices:e.allowedServices,s=new Set([...e.blockedServices,...o?o.blockedServices:[]]);return Te(i,s,r,"service_not_allowlisted","service_blocked")}function Wl(e,t){let n=U(t.name);return ne(e,t.name)?.disabled===!0?"extension_override_disabled":Te(e.allowedExtensions,e.blockedExtensions,n,"extension_not_allowlisted","extension_blocked")}function Gl(e,t){if(e.trustMode==="off")return null;let n=ne(e,t.name),r=U(t.name),o=t.trusted===!0,i=t.provenanceVerified===!0;return e.trustedExtensions.size>0&&!e.trustedExtensions.has(r)?"extension_not_trusted":(n?.requireTrusted===!0||e.trustMode==="warn"||e.trustMode==="enforce")&&!o?"extension_untrusted":(e.requireProvenance||n?.requireProvenance===!0)&&!i?"provenance_missing_or_unverified":null}function Kl(e,t){if(e.mode==="off")return null;let r=ne(e,t.name)?.sandboxProfile??t.sandboxProfile??e.defaultSandboxProfile;if(r==="none")return null;let o=t.permissions;if(!o)return"sandbox_permissions_missing";let i=s=>o[s]===!0;return r==="restricted"?i("process_spawn")?"sandbox_restricted_disallows_process_spawn":i("env_write")?"sandbox_restricted_disallows_env_write":null:i("process_spawn")?"sandbox_strict_disallows_process_spawn":i("network")?"sandbox_strict_disallows_network":i("fs_write")?"sandbox_strict_disallows_fs_write":i("env_write")?"sandbox_strict_disallows_env_write":null}function Dt(e,t,n,r,o={}){let i=Object.entries(o).sort((a,c)=>a[0].localeCompare(c[0])).map(([a,c])=>`${a}=${c}`).join(":"),s=i.length>0?`:${i}`:"";return`extension_policy_${e}_${t}:${n.layer}:${n.name}:reason=${r}${s}`}function Yo(e,t){if(e.mode==="off"&&e.trustMode==="off")return{allowed:!0,warning:null};let n=[],r=Wl(e,t);r&&n.push({reason:r,scope:"extension",mode:e.mode});let o=Gl(e,t);o&&n.push({reason:o,scope:"trust",mode:e.trustMode});let i=Kl(e,t);i&&n.push({reason:i,scope:"extension",mode:e.mode});let s=n.find(c=>c.mode==="enforce");if(s)return{allowed:!1,warning:Dt("blocked",s.scope,t,s.reason)};let a=n.find(c=>c.mode==="warn");return a?{allowed:!0,warning:Dt("violation",a.scope,t,a.reason)}:{allowed:!0,warning:null}}function Xo(e,t,n){if(e.mode==="off")return{allowed:!0,warning:null};let r=Ho(e,t,n);return r?{allowed:e.mode==="warn",warning:Dt(e.mode==="warn"?"violation":"blocked","capability",t,r,{capability:n.trim().toLowerCase()})}:{allowed:!0,warning:null}}function Hl(e,t,n,r,o){let i=typeof r=="string"?Ho(e,t,r):null,s=zl(e,t,n),a=o.command?ql(e,t,o.command):null,c=o.action?Bl(e,t,o.action):null,d=o.service?Vl(e,t,o.service):null;return i??s??a??c??d}function Yl(e,t,n,r){let o={method:U(e).replace(/\s+/g,"_"),surface:t};return n&&(o.capability=n),r.command&&(o.command=O(r.command)),r.action&&(o.action=U(r.action).replace(/\s+/g,"-")),r.service&&(o.service=U(r.service)),o}function Jo(e,t,n,r,o,i){if(e.mode==="off")return{allowed:!0,warning:null};let s=i??{},a=Hl(e,t,n,o,s);if(!a)return{allowed:!0,warning:null};let c=Dt(e.mode==="warn"?"violation":"blocked","registration",t,a,Yl(r,n,o,s));return{allowed:e.mode==="warn",warning:c}}(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]="01116a5e-62d1-591b-9fd0-84ac6e99f8d0")}catch{}})();function Pt(){return{beforeCommand:[],beforeMutation:[],afterCommand:[],onWrite:[],onRead:[],onIndex:[]}}function Pn(){return{overrides:[],handlers:[]}}function Mn(){return{overrides:[]}}function $n(){return{overrides:[]}}function Ln(){return{overrides:[]}}function jn(){return{overrides:[]}}function Fn(){return{commands:[],flags:[],item_fields:[],item_types:[],relationship_kinds:[],migrations:[],profiles:[],importers:[],exporters:[],search_providers:[],vector_store_adapters:[],assurance_providers:[]}}(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]="1c944ddd-e05b-5d8c-bdc5-7bc9677fa5d1")}catch{}})();var Zo=100;function Qo(e,t){let n=e[t];if(n!=null)return typeof n!="string"||n.trim().length===0?null:n.trim()}function Xl(e){if(e==null)return;let t=ee(e);if(!t)return null;let n={};for(let r of Object.keys(t).sort((o,i)=>o.localeCompare(i))){if(r.trim().length===0)return null;let o=t[r];if(typeof o!="string"||o.trim().length===0)return null;n[r.trim()]=o.trim()}return Object.keys(n).length>0?n:void 0}function Un(e,t){let n=e[t];return typeof n!="string"||n.trim().length===0?null:n.trim()}function ei(e){if(e!=null)return typeof e!="number"||!Number.isInteger(e)?null:e}function ye(e){if(e!=null)return typeof e!="boolean"?null:e}function Jl(e){let t=ei(e.priority);return t===void 0?Zo:t}function Ql(e){let t=e.sandbox_profile;if(t==null)return;if(typeof t!="string")return null;let n=He(t);return n!==t.trim().toLowerCase()?null:n}function zn(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function Zl(e){if(e==null)return;let t=ee(e);if(!t)return null;let n=zn(t.source),r=zn(t.signature),o=zn(t.attestation),i=t.verified===void 0||t.verified===null?void 0:typeof t.verified=="boolean"?t.verified:null;return i===null?null:{...n?{source:n}:{},...r?{signature:r}:{},...o?{attestation:o}:{},...typeof i=="boolean"?{verified:i}:{}}}function eu(e){if(e==null)return;let t=ee(e);if(!t)return null;let n=ye(t.fs_read),r=ye(t.fs_write),o=ye(t.network),i=ye(t.env_read),s=ye(t.env_write),a=ye(t.process_spawn);return[n,r,o,i,s,a].includes(null)?null:{...typeof n=="boolean"?{fs_read:n}:{},...typeof r=="boolean"?{fs_write:r}:{},...typeof o=="boolean"?{network:o}:{},...typeof i=="boolean"?{env_read:i}:{},...typeof s=="boolean"?{env_write:s}:{},...typeof a=="boolean"?{process_spawn:a}:{}}}function tu(e){if(e==null)return{capabilities:[],legacy_aliases:[]};if(!Array.isArray(e)||e.some(n=>typeof n!="string"))return null;let t=eo(e);return{capabilities:t.capabilities,legacy_aliases:t.legacy_aliases}}function nu(e){if(e==null)return;let t=ee(e);if(!t)return null;let n=t.commands;if(n==null)return;if(!Array.isArray(n)||n.some(o=>typeof o!="string"))return null;let r=[...new Set(n.map(o=>O(o)).filter(o=>o.length>0))].sort((o,i)=>o.localeCompare(i));return r.length>0?{commands:r}:void 0}function ru(e){let t=ei(e.manifest_version);if(t===null)return null;let n=Qo(e,"pm_min_version");if(n===null)return null;let r=Qo(e,"pm_max_version");if(r===null)return null;let o=Xl(e.engines);if(o===null)return null;let i=ye(e.trusted);if(i===null)return null;let s=Ql(e);if(s===null)return null;let a=Zl(e.provenance);if(a===null)return null;let c=eu(e.permissions);if(c===null)return null;let d=tu(e.capabilities);if(d===null)return null;let l=nu(e.activation);if(l===null)return null;let u=Ot(e.contributions);return u===null?null:{manifest_version:t,pm_min_version:n,pm_max_version:r,engines:o,trusted:i,sandbox_profile:s,provenance:a,permissions:c,capabilities:d.capabilities,legacy_capability_aliases:d.legacy_aliases,activation:l,contributions:u}}function qn(e){if(typeof e!="object"||e===null)return null;let t=e,n=Un(t,"name");if(n===null)return null;let r=Un(t,"version");if(r===null)return null;let o=Un(t,"entry");if(o===null)return null;let i=Jl(t);if(i===null)return null;let s=ru(t);return s===null?null:{name:n,version:r,entry:o,priority:i,manifest_version:s.manifest_version,pm_min_version:s.pm_min_version,pm_max_version:s.pm_max_version,engines:s.engines,trusted:s.trusted,provenance:s.provenance,sandbox_profile:s.sandbox_profile,permissions:s.permissions,activation:s.activation,contributions:s.contributions,capabilities:s.capabilities,legacy_capability_aliases:s.legacy_capability_aliases.length>0?s.legacy_capability_aliases:void 0}}import{constants as re}from"node:os";(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]="aaf1c6ce-1bc9-5974-a38f-7daf8e4e63cc")}catch{}})();var ti=new Map([["EACCES",{summary:"was denied filesystem permission",recovery:"Grant the required filesystem access, then retry.",category:"permission"}],["EDQUOT",{summary:"exceeded the filesystem quota",recovery:"Raise or reclaim the filesystem quota, then retry.",category:"capacity"}],["EMFILE",{summary:"exhausted the process file-descriptor limit",recovery:"Close unused file handles or raise the process limit, then retry.",category:"resource"}],["ENFILE",{summary:"exhausted the host file-descriptor limit",recovery:"Free host file descriptors or raise the host limit, then retry.",category:"resource"}],["ENOMEM",{summary:"ran out of available memory",recovery:"Free memory or reduce concurrent work, then retry.",category:"resource"}],["ENOSPC",{summary:"ran out of storage space",recovery:"Free storage on the filesystem holding the project, then retry.",category:"capacity"}],["EPERM",{summary:"was denied by the host permission policy",recovery:"Grant the required filesystem permission, then retry.",category:"permission"}],["EROFS",{summary:"targeted a read-only filesystem",recovery:"Use a writable project filesystem or remount it read-write, then retry.",category:"permission"}]]),ou=/^[a-z][a-z0-9_]{0,63}$/u,iu=new Map([[re.errno.EACCES,"EACCES"],[re.errno.EDQUOT,"EDQUOT"],[re.errno.EMFILE,"EMFILE"],[re.errno.ENFILE,"ENFILE"],[re.errno.ENOMEM,"ENOMEM"],[re.errno.ENOSPC,"ENOSPC"],[re.errno.EPERM,"EPERM"],[re.errno.EROFS,"EROFS"]].filter(([e])=>Number.isInteger(e))),su={capacity:{code:"host_environment_capacity_fault"},permission:{code:"host_environment_permission_fault"},resource:{code:"host_environment_resource_fault"}};function au(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.code=="string"&&ti.has(t.code)?t.code:typeof t.errno!="number"||!Number.isInteger(t.errno)?null:iu.get(Math.abs(t.errno))??null}function cu(e,t,n={}){let r=au(e);if(r===null)return null;if(!ou.test(t))throw new h("Host environment operation labels must be bounded identifiers.",y.USAGE,{code:"host_environment_operation_invalid",field:"operation"});let o=ti.get(r);return new h(`Host filesystem operation ${t} ${o.summary}.`,y.GENERIC_FAILURE,{code:n.codes?.[o.category]??su[o.category].code,reason:r,required:o.recovery,why:n.why??"The operating system refused a required project filesystem operation.",nextSteps:[o.recovery,...n.nextSteps??[]],...n.suggestedRetry?{recovery:{suggested_retry:n.suggestedRetry}}:{}})}async function ni(e,t,n={}){try{return await t()}catch(r){throw cu(r,e,n)??r}}import du from"node:fs/promises";import Ye from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6d77d806-1c41-5235-b56b-802089979395")}catch{}})();async function ri(e,t){let n=Ye.dirname(t.manifest_path),r=Ye.relative(n,t.entry_path);if(r.startsWith("..")||Ye.isAbsolute(r))throw new Error(`Cannot snapshot extension entry outside its package directory: ${t.entry_path}`);let o=Ye.join(e,`${t.layer}-${t.directory.replace(/[^a-zA-Z0-9._-]/gu,"_")}`);return await ni("extension_module_graph_snapshot",()=>du.cp(n,o,{recursive:!0,force:!0})),Ye.join(o,r)}(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]="092f2852-fa07-5f0f-8266-e9e2ca078cb6")}catch{}})();function oi(e){let t=typeof e=="function"?e:e.run;if(typeof t!="function")throw new TypeError("registerPreflight override requires a function handler");let n=[...new Set((typeof e=="function"?[]:e.commands??[]).map(r=>{if(typeof r!="string"||r.trim().length===0)throw new TypeError("registerPreflight ownership.commands must contain non-empty command paths");return O(r)}))];return{run:t,...n.length>0?{commands:n}:{}}}function ii(e){let t=[];for(let n=1;n<e.overrides.length;n+=1){let r=e.overrides[n];for(let o of e.overrides.slice(0,n))r.commands?.length&&o.commands?.length&&!o.commands.some(i=>r.commands.includes(i))||t.push(`extension_preflight_override_collision:${r.layer}:${r.name}:${o.layer}:${o.name}`)}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="09098e5c-d021-53ae-96b5-c56394c304da")}catch{}})();var lu=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"}]),Bn=new Set(lu.flatMap(e=>[e.flag,...e.aliases??[]]));(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]="f823edae-b035-5547-8d81-2761a9a44034")}catch{}})();var uu=/^--[a-z0-9][a-z0-9_-]*(?:[ =](?:<[^<>]+>|\[[^[\]]+\]))?$/;function fu(e){if(typeof e!="string")return null;let t=e.trim(),n=t.split(/[ =]/,1)[0];return Bn.has(n)?"host_owned_flag_collision":uu.test(t)?null:"malformed_long_flag"}function si(e,t){let n=[e,t].find(i=>typeof i=="string"&&Bn.has(i.trim().split(/[ =]/,1)[0]));if(typeof n=="string")return{token:n.trim().split(/[ =]/,1)[0],failure:"host_owned_flag_collision"};if(typeof e!="string")return null;let r=e.trim(),o=fu(r);return o===null?null:{token:r,failure:o}}function ai(e,t){return t==="host_owned_flag_collision"?`cannot shadow host-owned global flag "${e}"; read it from context.global instead`:`long flag "${e}" must start with a double-dash name such as "--my-flag" or "--my-flag <value>"`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="31da4a5a-1e85-5d77-a09f-2736cc44d850")}catch{}})();var mu=Object.freeze({string:"string",number:"number",int:"number",integer:"number",float:"number",boolean:"boolean",bool:"boolean"});function ci(e){return typeof e!="string"?null:mu[e.trim().toLowerCase()]??null}function di(e){let t=[],n=r=>{if(Array.isArray(r)){for(let o of r)n(o);return}if(typeof r=="string"){for(let o of r.split(",")){let i=o.trim();i.length>0&&t.push(i)}return}r!=null&&t.push(r)};return n(e),t}function li(e,t){return t==="string"?!0:t==="number"?typeof e=="number"?Number.isFinite(e):typeof e=="string"&&e.trim().length>0&&Number.isFinite(Number(e)):typeof e=="boolean"?!0:typeof e=="string"&&["true","false","1","0"].includes(e.trim().toLowerCase())}(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]="99f785c2-7c67-5564-9423-3439c41b4557")}catch{}})();var Mt=Fr;function ui(e){let t=e.trim().toLowerCase();return Mt.includes(t)?t:null}function fi(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let n=Math.max(1,Math.floor(t.length*.34));for(let r of Mt)if(Rt(t,r,n)!==null)return r;return null}(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]="483b4197-5498-568a-bcc4-abd6999a07cc")}catch{}})();function mi(e){return e==="toon"||e==="json"}function pi(e){return Oe.includes(e)}function he(e,t){if(typeof t!="function")throw new TypeError(`api.hooks.${e} requires a function handler`)}var _i=Symbol("extension_registration_trace");function K(e,t){let n=new TypeError(e);return Object.defineProperty(n,_i,{value:t,enumerable:!1,configurable:!1,writable:!1}),n}function gi(e){return e instanceof Error?e[_i]:void 0}function Xe(e){if(e===null)return null;if(Array.isArray(e))return e.map(t=>Xe(t));if(typeof e=="function")return"[Function]";if(typeof e=="bigint"||typeof e=="symbol")return e.toString();if(typeof e=="object"){let t=e,n={};for(let r of Object.keys(t).sort((o,i)=>o.localeCompare(i)))n[r]=Xe(t[r]);return n}return e}function Je(e){if(Array.isArray(e))return e.map(t=>Je(t));if(typeof e=="object"&&e!==null){let t=e,n={};for(let r of Object.keys(t).sort((o,i)=>o.localeCompare(i)))n[r]=Je(t[r]);return n}return e}function Ie(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Xe(t)}function Qe(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Je(t)}function Ze(e,t){if(!Array.isArray(t))throw new TypeError(`${e} requires an array of object definitions`);return t.map(n=>Ie(e,n))}function M(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function et(e,t){if(typeof t!="function")throw new TypeError(`${e} requires a function handler`)}function Vn(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function Wn(e,t){return O(`${e} ${t}`)}function tt(e,t){return Object.defineProperty(e,"runtime_definition",{value:t,enumerable:!1,writable:!1,configurable:!1}),e}var pu=new Set(["low","medium","high"]),_u=new Set(["number","string_set"]),gu=new Set(["string","number","boolean"]);function yi(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function yu(e,t,n){let r=`registerAssuranceMeasurementProvider provider.keys.${t}`,o=x(r,n);if(!_u.has(String(o.value_type)))throw new TypeError(`${r}.value_type must be number or string_set`);if(S(`${r}.description`,o.description),o.parameters===void 0)return;let i=x(`${r}.parameters`,o.parameters);for(let[s,a]of Object.entries(i)){let c=`${r}.parameters.${s}`;yi(`${c}.name`,s);let d=x(c,a);if(!gu.has(String(d.type)))throw new TypeError(`${c}.type must be string, number, or boolean`);D(`${c}.required`,d.required),S(`${c}.description`,d.description)}if(Object.keys(i).length>50)throw new TypeError(`assurance provider ${e} key ${t} exceeds 50 parameters`)}function hi(e){let t=x("registerAssuranceMeasurementProvider provider",e),n=yi("registerAssuranceMeasurementProvider provider.id",t.id);if(!/^[a-z0-9][a-z0-9-]*$/u.test(n))throw new TypeError("registerAssuranceMeasurementProvider provider.id must be a stable lowercase id");if(!pu.has(String(t.cost_class)))throw new TypeError("registerAssuranceMeasurementProvider provider.cost_class must be low, medium, or high");if(typeof t.network!="boolean")throw new TypeError("registerAssuranceMeasurementProvider provider.network must be boolean");let r=x("registerAssuranceMeasurementProvider provider.keys",t.keys);if(Object.keys(r).length===0)throw new TypeError("registerAssuranceMeasurementProvider provider.keys requires at least one key");for(let[o,i]of Object.entries(r)){if(!/^[a-z0-9][a-z0-9-]*$/u.test(o))throw new TypeError(`registerAssuranceMeasurementProvider provider key ${o} must be a stable lowercase id`);yu(n,o,i)}if(t.timeout_ms!==void 0&&(typeof t.timeout_ms!="number"||!Number.isInteger(t.timeout_ms)||t.timeout_ms<1||t.timeout_ms>3e5))throw new TypeError("registerAssuranceMeasurementProvider provider.timeout_ms must be an integer from 1 through 300000");if(typeof t.resolve!="function")throw new TypeError("registerAssuranceMeasurementProvider provider.resolve requires a function handler")}(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]="7640f483-6c14-56f1-bccd-cec9ca88e6ea")}catch{}})();var hu=new Set(["default","description","enabled","list","long","repeatable","required","short","type","value_name","value_type","visible"]);function $t(e,t){return Ze(e,t).map(n=>(n.repeatable===!0&&(n.list=!0),n))}function bu(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Gn(e,t){if(t===void 0)return e.replace(/\s+/g,"-");if(typeof t!="string"||t.trim().length===0)throw new TypeError("registerCommand definition.action must be a non-empty string when provided");let n=bu(t);if(n.length===0)throw new TypeError("registerCommand definition.action must contain alphanumeric characters");return n}function Kn(e){if(e===void 0)return[];if(!Array.isArray(e))throw new TypeError("registerCommand definition.arguments must be an array when provided");let t=[];for(let[r,o]of e.entries()){let i=x(`registerCommand definition.arguments[${r}]`,o),s=M(`registerCommand definition.arguments[${r}].name`,i.name);if(D(`registerCommand definition.arguments[${r}].required`,i.required),D(`registerCommand definition.arguments[${r}].variadic`,i.variadic),S(`registerCommand definition.arguments[${r}].description`,i.description),s.includes(" "))throw new TypeError(`registerCommand definition.arguments[${r}].name must not contain spaces`);let a={name:s};i.required===!0&&(a.required=!0),i.variadic===!0&&(a.variadic=!0),typeof i.description=="string"&&(a.description=i.description.trim()),t.push(a)}let n=t.map((r,o)=>r.variadic?o:-1).filter(r=>r>=0);if(n.length>1)throw new TypeError("registerCommand definition.arguments supports at most one variadic argument");if(n.length===1&&n[0]!==t.length-1)throw new TypeError("registerCommand definition.arguments variadic argument must be the final argument");return t}function Lt(e){if(!Array.isArray(e))throw new TypeError("registerFlags flags requires an array of object definitions");for(let[t,n]of e.entries()){let r=x(`registerFlags flags[${t}]`,n),o=Object.keys(r).filter(c=>!hu.has(c)).sort((c,d)=>c.localeCompare(d));if(o.length>0)throw new TypeError(`registerFlags flags[${t}] contains unknown field(s): ${o.join(", ")}`);let i=r.long,s=r.short;if(i===void 0&&s===void 0)throw new TypeError(`registerFlags flags[${t}] requires at least one of long or short`);S(`registerFlags flags[${t}].long`,i),S(`registerFlags flags[${t}].short`,s);let a=si(i,s);if(a!==null)throw new TypeError(`registerFlags flags[${t}] ${ai(a.token,a.failure)}`);if(S(`registerFlags flags[${t}].value_name`,r.value_name),S(`registerFlags flags[${t}].description`,r.description),D(`registerFlags flags[${t}].required`,r.required),D(`registerFlags flags[${t}].enabled`,r.enabled),D(`registerFlags flags[${t}].visible`,r.visible),D(`registerFlags flags[${t}].list`,r.list),D(`registerFlags flags[${t}].repeatable`,r.repeatable),r.list!==void 0&&r.repeatable!==void 0&&r.list!==r.repeatable)throw new TypeError(`registerFlags flags[${t}].list and repeatable must match when both are provided`);if(Lo(`registerFlags flags[${t}].default`,r.default),Array.isArray(r.default)&&r.list!==!0&&r.repeatable!==!0)throw new TypeError(`registerFlags flags[${t}].default cannot be an array unless list is true.`);bi(`registerFlags flags[${t}]`,r)}}function bi(e,t){let n=(typeof t.value_type=="string"?t.value_type:void 0)??(typeof t.type=="string"?t.type:void 0);if(n===void 0)return;let r=ci(n);if(r===null)throw new TypeError(`${e} value_type "${n}" is not a known flag value type (expected one of: string, number, boolean).`);if(t.default===void 0)return;let o=t.list===!0||t.repeatable===!0?di(t.default):[t.default];for(let[i,s]of o.entries())if(!li(s,r)){let a=o.length>1?`default[${i}]`:"default";throw new TypeError(`${e}.${a} (${JSON.stringify(s)}) is not coercible to ${r}.`)}}function wi(e){if(!Array.isArray(e))throw new TypeError("registerItemFields fields requires an array of object definitions");for(let[t,n]of e.entries()){let r=x(`registerItemFields fields[${t}]`,n);M(`registerItemFields fields[${t}].name`,r.name);let o=M(`registerItemFields fields[${t}].type`,r.type);if(ui(o)===null){let i=fi(o),s=i?` Did you mean "${i}"?`:"";throw new TypeError(`registerItemFields fields[${t}].type "${o}" is not a known field type (expected one of: ${Mt.join(", ")}).${s}`)}D(`registerItemFields fields[${t}].optional`,r.optional)}}function wu(e,t){if(t===void 0)return;let n=`registerItemTypes types[${e}].command_option_policies`;if(!Array.isArray(t))throw new TypeError(`${n} must be an array when provided`);for(let[r,o]of t.entries()){let i=`${n}[${r}]`,s=x(i,o);M(`${i}.command`,s.command),M(`${i}.option`,s.option),D(`${i}.enabled`,s.enabled),D(`${i}.required`,s.required),D(`${i}.visible`,s.visible)}}function vu(e,t){if(t===void 0)return;let n=`registerItemTypes types[${e}].options`;if(!Array.isArray(t))throw new TypeError(`${n} must be an array when provided`);for(let[r,o]of t.entries()){let i=`${n}[${r}]`,s=x(i,o);M(`${i}.key`,s.key),ge(`${i}.values`,s.values),D(`${i}.required`,s.required),ge(`${i}.aliases`,s.aliases)}}function vi(e){if(!Array.isArray(e))throw new TypeError("registerItemTypes types requires an array of object definitions");for(let[t,n]of e.entries()){let r=`registerItemTypes types[${t}]`,o=x(r,n);M(`${r}.name`,o.name),S(`${r}.folder`,o.folder),ge(`${r}.aliases`,o.aliases),ge(`${r}.required_create_fields`,o.required_create_fields),ge(`${r}.required_create_repeatables`,o.required_create_repeatables),wu(t,o.command_option_policies),vu(t,o.options)}}function Ei(e){let t=x("registerMigration definition",e);if(t.id!==void 0&&typeof t.id!="string")throw new TypeError("registerMigration definition.id must be a string when provided");if(t.description!==void 0&&typeof t.description!="string")throw new TypeError("registerMigration definition.description must be a string when provided");if(t.status!==void 0&&typeof t.status!="string")throw new TypeError("registerMigration definition.status must be a string when provided");if(D("registerMigration definition.mandatory",t.mandatory),t.run!==void 0&&typeof t.run!="function")throw new TypeError("registerMigration definition.run must be a function when provided")}var ki=["types","statuses","fields","workflows","config","templates","packages"],Eu={types:(e,t)=>{if(t.name!==void 0&&typeof t.name!="string")throw new TypeError(`${e}.name must be a string when provided`)},workflows:(e,t)=>{if(typeof t.type!="string")throw new TypeError(`${e}.type must be a string`);if(!Array.isArray(t.allowed_transitions))throw new TypeError(`${e}.allowed_transitions must be an array`);for(let[n,r]of t.allowed_transitions.entries())if(!Array.isArray(r))throw new TypeError(`${e}.allowed_transitions[${n}] must be a [from, to] array`)},templates:(e,t)=>{if(typeof t.name!="string")throw new TypeError(`${e}.name must be a string`);if(typeof t.options!="object"||t.options===null||Array.isArray(t.options))throw new TypeError(`${e}.options must be an object`)},packages:(e,t)=>{if(typeof t.spec!="string")throw new TypeError(`${e}.spec must be a string`)}};function Oi(e){let t=x("registerProfile profile",e);if(M("registerProfile profile.name",t.name),M("registerProfile profile.title",t.title),t.summary!==void 0&&typeof t.summary!="string")throw new TypeError("registerProfile profile.summary must be a string when provided");for(let n of ki){let r=t[n];if(r!==void 0){if(!Array.isArray(r))throw new TypeError(`registerProfile profile.${n} must be an array when provided`);for(let[o,i]of r.entries()){if(typeof i!="object"||i===null||Array.isArray(i))throw new TypeError(`registerProfile profile.${n}[${o}] must be an object`);Eu[n]?.(`registerProfile profile.${n}[${o}]`,i)}}}}function Ai(e){e.summary===void 0&&(e.summary="");for(let t of ki)e[t]===void 0&&(e[t]=[]);return 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]="09c95125-68bd-512b-bb09-c9ef0b2f676e")}catch{}})();function Si(e){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("registerService ownership must be an object");if(Reflect.ownKeys(e).some(t=>t!=="passThrough"))throw new TypeError("registerService ownership supports only passThrough");if(e.passThrough!==void 0&&typeof e.passThrough!="boolean")throw new TypeError("registerService ownership.passThrough must be a boolean when provided");return e.passThrough===!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]="d2feae50-9a1e-54fa-98a3-df529be63069")}catch{}})();function Ci(e){return typeof e=="string"?e:String(e)}function nt(e){let n=e.trim().replace(/^>=\s*/,"").replace(/^v/i,"").split(/[+-]/,1)[0];return/^\d+(?:[.-]\d+)*$/.test(n)?n.split(/[.-]/).map(r=>Number(r)):null}function Hn(e,t){let n=nt(e),r=nt(t);if(!n||!r)return null;let o=Math.max(n.length,r.length);for(let i=0;i<o;i+=1){let s=n[i]??0,a=r[i]??0;if(s>a)return 1;if(s<a)return-1}return 0}function Ti(e,t){if(e==null)return{kind:"pm_min_version",status:"absent",allowed:!0,required:"",current:t};let n=Ci(e);if(typeof e!="string"||n.trim().length===0)return{kind:"pm_min_version",status:"invalid",allowed:!1,required:n,current:t};if(!nt(n))return{kind:"pm_min_version",status:"invalid",allowed:!1,required:n,current:t};if(t===null)return{kind:"pm_min_version",status:"unchecked",allowed:!0,required:n,current:null};let r=Hn(t,n);return r===null?{kind:"pm_min_version",status:"unchecked",allowed:!0,required:n,current:t}:r<0?{kind:"pm_min_version",status:"unmet",allowed:!1,required:n,current:t}:{kind:"pm_min_version",status:"ok",allowed:!0,required:n,current:t}}function Ii(e,t,n){if(e==null)return{kind:"pm_max_version",status:"absent",allowed:!0,required:"",current:t};let r=Ci(e);if(typeof e!="string"||r.trim().length===0)return{kind:"pm_max_version",status:"invalid",allowed:!1,required:r,current:t};if(/^[<>=~^]/.test(r.trim())||!nt(r))return{kind:"pm_max_version",status:"invalid",allowed:!1,required:r,current:t};if(t===null)return{kind:"pm_max_version",status:"unchecked",allowed:!0,required:r,current:null};let o=Hn(t,r);return o===null?{kind:"pm_max_version",status:"unchecked",allowed:!0,required:r,current:t}:o>0?n==="warn"?{kind:"pm_max_version",status:"exceeded_warn",allowed:!0,required:r,current:t}:{kind:"pm_max_version",status:"exceeded",allowed:!1,required:r,current:t}:{kind:"pm_max_version",status:"ok",allowed:!0,required:r,current:t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="736cf7fc-d4da-57ce-90d8-2432085dd2c8")}catch{}})();var ku=5e3;async function Yn(e,t,n){let r=[];for(let o of e)try{await o.run(P(n))}catch{r.push(`extension_hook_failed:${o.layer}:${o.name}:${t}`)}return r}function Ou(e,t,n){if(e===void 0)return;if(typeof e!="object"||e===null||!("allow"in e)||e.allow!==!0&&e.allow!==!1)throw new h(`Extension mutation guard ${t.name} returned an invalid decision.`,y.CONFLICT,{code:"extension_mutation_guard_invalid_decision",reason:`${t.layer}:${t.name}`,nextSteps:["Return { allow: true } or a structured denial from the guard."]});if(e.allow)return;let r=e,o=typeof r.code=="string"?r.code.trim():"",i=typeof r.remediation=="string"?r.remediation.trim():"";if(o.length===0||i.length===0)throw new h(`Extension mutation guard ${t.name} returned an invalid denial.`,y.CONFLICT,{code:"extension_mutation_guard_invalid_denial",reason:`${t.layer}:${t.name}`,nextSteps:["Return non-empty code and remediation fields from the guard."]});let s=typeof r.message=="string"?r.message.trim():"";throw new h(s||`Extension mutation guard ${t.name} denied ${n}.`,y.CONFLICT,{code:o,reason:`${t.layer}:${t.name}`,nextSteps:[i]})}async function Xn(e,t){for(let n of e.beforeMutation??[]){let r,o;try{let i=Promise.resolve().then(()=>n.run({pm_root:t.pm_root,operation:t.operation,before:t.before===null?null:P(t.before),after:t.after===null?null:P(t.after),changed_fields:[...t.changed_fields],sdk:t.sdk}));i.catch(()=>{}),r=await Promise.race([i,new Promise((s,a)=>{o=setTimeout(()=>{a(new h(`Extension mutation guard ${n.name} timed out before ${t.operation}.`,y.CONFLICT,{code:"extension_mutation_guard_timed_out",reason:`${n.layer}:${n.name}`,nextSteps:["Fix or disable the stalled extension guard, then retry the mutation."]}))},ku),o.unref?.()})])}catch(i){throw i instanceof h?i:new h(`Extension mutation guard ${n.name} failed before ${t.operation}.`,y.CONFLICT,{code:"extension_mutation_guard_failed",reason:`${n.layer}:${n.name}`,nextSteps:["Fix or disable the failing extension guard, then retry the mutation."]})}finally{clearTimeout(o)}Ou(r,n,t.operation)}}async function Jn(e,t){return Yn(e.onWrite,"onWrite",t)}async function Qn(e,t){return Yn(e.onRead,"onRead",t)}async function Zn(e,t){return Yn(e.onIndex,"onIndex",t)}function Au(e){let t="";e instanceof Error&&typeof e.message=="string"?t=e.message:typeof e=="string"?t=e:typeof e=="object"&&e!==null&&typeof e.message=="string"&&(t=e.message);let n=t.replace(/\s+/gu," ").trim();if(n.length===0)return"";let r=300;return n.length>r?`${n.slice(0,r-1)}\u2026`:n}function jt(e,t){if(typeof e!="object"||e===null||typeof e[t]!="string")return;let n=String(e[t]).replace(/\s+/gu," ").trim();return n.length>0?n.slice(0,300):void 0}function Su(e){if(typeof e!="object"||e===null||!Object.hasOwn(e,"exit_code"))return;let t=e.exit_code;if(typeof t!="number"||!Number.isInteger(t)||t<1||t>255)throw new TypeError("Extension command result exit_code must be an integer from 1 to 255.");return t}async function er(e,t){let n=O(t.command);if(n.length===0)return{handled:!1,result:null,warnings:[]};let r=[...e.handlers].reverse().find(o=>o.command===n);if(!r)return{handled:!1,result:null,warnings:[]};try{let o=await r.run({command:n,args:P(t.args),options:P(t.options),global:P(t.global),pm_root:t.pm_root,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel,...t.sdk===void 0?{}:{sdk:t.sdk}});return{handled:!0,result:o,warnings:[],...Object.fromEntries([["exitCode",Su(o)],["errorCode",jt(o,"code")],["remediation",jt(o,"remediation")]].filter(i=>i[1]!==void 0))}}catch(o){let i=typeof o=="object"&&o!==null&&"exitCode"in o?o.exitCode:void 0;if(typeof i=="number"&&Number.isFinite(i))throw o;return{handled:!1,result:null,warnings:[`extension_command_handler_failed:${r.layer}:${r.name}:${r.command}`],errorMessage:Au(o),...Object.fromEntries([["errorCode",jt(o,"code")],["remediation",jt(o,"remediation")]].filter(s=>s[1]!==void 0))}}}function Ri(e){return{handled:!1,result:e.payload,warnings:[]}}function xi(e,t){return[...e.overrides].reverse().filter(n=>n.service===t)}function Ni(e){return{service:e.service,command:e.command?O(e.command):void 0,args:e.args?P(e.args):void 0,options:e.options?Vr(e.options):void 0,global:e.global?Wr(e.global):void 0,pm_root:e.pm_root,source_workspace_root:e.source_workspace_root,repo_root:e.repo_root,pm_root_rel:e.pm_root_rel,payload:P(e.payload)}}function Cu(e){if(typeof e!="object"||e===null||!Object.hasOwn(e,"handled"))return!1;let t=e.handled;return t===!0?Object.hasOwn(e,"result"):t===!1&&Reflect.ownKeys(e).length===1}function Di(e,t){return Cu(e)?e.handled?{handled:!0,result:e.result}:{handled:!1,result:t.payload}:t.service==="output_format"&&e==null?{handled:!1,result:t.payload}:{handled:!0,result:e}}function Pi(e,t,n){return t.service==="output_format"&&typeof e=="object"&&e!==null&&V(e,n.payload)}function Mi(e,t,n){if(t.handled){if(e.passThrough===!0){n.push(`extension_service_pass_through_contract_violated:${e.layer}:${e.name}:${e.service}`);return}return{handled:!0,result:t.result,warnings:n}}}function tr(e,t){let n=xi(e,t.service);if(n.length===0)return Ri(t);let r=[];for(let o of n)try{let i=Ni(t),s=o.run(i);if(s instanceof Promise){r.push(`extension_service_override_async_unsupported:${o.layer}:${o.name}:${o.service}`);continue}if(Pi(s,t,i)){r.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=Mi(o,Di(s,t),r);if(a)return a}catch{r.push(`extension_service_override_failed:${o.layer}:${o.name}:${o.service}`)}return{handled:!1,result:t.payload,warnings:r}}async function nr(e,t){let n=xi(e,t.service);if(n.length===0)return Ri(t);let r=[];for(let o of n)try{let i=Ni(t),s=await Promise.resolve(o.run(i));if(Pi(s,t,i)){r.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=Mi(o,Di(s,t),r);if(a)return a}catch{r.push(`extension_service_override_failed:${o.layer}:${o.name}:${o.service}`)}return{handled:!1,result:t.payload,warnings:r}}(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]="3ee03fc2-5b71-508c-8524-d22104fa2194")}catch{}})();var $i=null,Du=Object.freeze(ht()),Li=0;function Pu(e=Date.now()){return Li+=1,`${Li}-${e}`}function Mu(e,t,n){return n.has(e)?!1:t.size===0?!0:t.has(e)}async function $u(e,t){let[n,r]=await Promise.all([we.realpath(e),we.realpath(t)]);return kn(n,r)}function Lu(e,t=process.cwd()){return{global:be.join(Po(t),"extensions"),project:be.join(e,"extensions")}}async function ju(e){try{return(await we.readdir(e,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort((n,r)=>n.localeCompare(r))}catch{return[]}}function Fu(e){let t={layer:e.layer,directory:e.directory,manifest_path:e.manifest_path,name:e.manifest.name,version:e.manifest.version,entry:e.manifest.entry,priority:e.manifest.priority,entry_path:e.entry_path,manifest_version:e.manifest.manifest_version,pm_min_version:e.manifest.pm_min_version,pm_max_version:e.manifest.pm_max_version,engines:e.manifest.engines,trusted:e.manifest.trusted,provenance:e.manifest.provenance,sandbox_profile:e.manifest.sandbox_profile,permissions:e.manifest.permissions,capabilities:[...e.manifest.capabilities],activation:e.manifest.activation?{commands:[...e.manifest.activation.commands]}:void 0,contributions:e.manifest.contributions??e.contributions};return e.source_package&&(t.source_package=e.source_package),e.source_aliases&&(t.source_aliases=[...e.source_aliases]),t}function ji(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}async function Uu(e){let t=new Map;try{let n=JSON.parse(await we.readFile(be.join(e,".managed-extensions.json"),"utf8")),o=ee(n)?.entries;if(!Array.isArray(o))return t;for(let i of o){if(typeof i!="object"||i===null)continue;let s=i,a=ji(s.source?.package),c=[s.source?.input,s.source?.name,a].map(u=>ji(u)).filter(u=>u!==void 0),d=Ot(s.contributions),l={aliases:[...new Set(c)],...a?{package_name:a}:{},...d?{contributions:d}:{}};typeof s.directory=="string"&&s.directory.trim().length>0&&t.set(`directory:${s.directory.trim()}`,l),typeof s.name=="string"&&s.name.trim().length>0&&t.set(`name:${s.name.trim()}`,l)}}catch{return t}return t}function Fi(e){return[...e].sort((t,n)=>{if(t.manifest.priority!==n.manifest.priority)return t.manifest.priority-n.manifest.priority;let r=t.manifest.name.localeCompare(n.manifest.name);return r!==0?r:t.directory.localeCompare(n.directory)})}function zu(e,t){let n=[...Fi(e),...Fi(t)],r=[];for(let o of n){let i=r.findIndex(s=>s.manifest.name===o.manifest.name);i>=0&&r.splice(i,1),r.push(o)}return r}async function Ui(e,t,n,r,o){let i=[],s=[],a=[],c=await ju(t),d=await Uu(t);for(let l of c){let u=await Vu(e,t,l,n,r,d,o);i.push(u.diagnostic),s.push(...u.warnings),u.candidate&&a.push(u.candidate)}return{diagnostics:i,warnings:s,candidates:a}}function qu(){return{diagnostics:[],warnings:[],candidates:[]}}function zi(e,t,n,r){return{diagnostic:{layer:e,directory:t,manifest_path:n,name:null,version:null,entry:null,priority:null,entry_path:null,enabled:null,status:"warn"},warnings:[r],candidate:null}}function Bu(e,t,n,r,o,i,s){let a=qr(e,t,n);Array.isArray(t.legacy_capability_aliases)&&t.legacy_capability_aliases.length>0&&a.push(no(e,t.name,t.legacy_capability_aliases));for(let c of Zr(t.capabilities))a.push(to(e,t.name,c));return r?o||a.push(`extension_entry_missing:${e}:${t.name}`):a.push(`extension_entry_outside_extension:${e}:${t.name}`),i.warning&&a.push(i.warning),s.warning&&a.push(s.warning),a}async function Vu(e,t,n,r,o,i,s){let a=be.join(t,n),c=be.join(a,"manifest.json");if(!await En(c))return zi(e,n,c,`extension_manifest_missing:${e}:${n}`);let d,l;try{let ft=JSON.parse(await we.readFile(c,"utf8"));l=ee(ft),d=qn(ft)}catch{l=null,d=null}if(!d||!l)return zi(e,n,c,`extension_manifest_invalid:${e}:${n}`);let u=be.resolve(a,d.entry),f=kn(a,u),m=f?await En(u):!1,p=f&&m?await $u(a,u):f,_=Mu(d.name,r,o),g=await Ku(e,d),w=await Hu(e,d,s),v=Bu(e,d,l,p,m,g,w),R=p&&m&&g.allowed&&w.allowed,$r=i.get(`directory:${n}`)??i.get(`name:${d.name}`);return{diagnostic:{layer:e,directory:n,manifest_path:c,name:d.name,version:d.version,entry:d.entry,priority:d.priority,entry_path:u,enabled:_,status:R?"ok":"warn"},warnings:v,candidate:Uo({layer:e,directory:n,manifestPath:c,entryPath:u,manifest:d,sourceIdentity:$r,extensionReady:R,enabledForLoad:_})}}async function Wu(e){let t=Lu(e.pmRoot,e.cwd??process.cwd()),n=Ve(e.settings.extensions.enabled),r=Ve(e.settings.extensions.disabled),o=Wo(e.settings),i=Go(o);if(e.noExtensions)return{disabled_by_flag:!0,roots:t,configured_enabled:n,configured_disabled:r,discovered:[],effective:[],warnings:[...o.warnings],policy:i};let s=new Set(n),a=new Set(r),c=e.ignoreGlobalExtensions===!0?qu():await Ui("global",t.global,s,a,o.pmMaxVersionExceededMode.global),d=await Ui("project",t.project,s,a,o.pmMaxVersionExceededMode.project),l=[...o.warnings],u=zu(c.candidates,d.candidates),f=[];for(let m of u){let p={layer:m.layer,name:m.manifest.name,trusted:m.manifest.trusted===!0,provenanceVerified:m.manifest.provenance?.verified===!0,sandboxProfile:m.manifest.sandbox_profile,permissions:m.manifest.permissions&&typeof m.manifest.permissions=="object"?{fs_read:m.manifest.permissions.fs_read,fs_write:m.manifest.permissions.fs_write,network:m.manifest.permissions.network,env_read:m.manifest.permissions.env_read,env_write:m.manifest.permissions.env_write,process_spawn:m.manifest.permissions.process_spawn}:void 0},_=Yo(o,p);if(_.warning&&l.push(_.warning),!!_.allowed){for(let g of m.manifest.capabilities){let w=Xo(o,p,g);w.warning&&l.push(w.warning)}f.push(Fu(m))}}return{disabled_by_flag:!1,roots:t,configured_enabled:n,configured_disabled:r,discovered:[...c.diagnostics,...d.diagnostics],effective:f,warnings:[...new Set([...c.warnings,...d.warnings,...l])],policy:i}}function Ft(e){return e instanceof Error&&e.message.trim().length>0?e.message:String(e)}async function Gu(){try{let e=Sn(import.meta.url,["../../.."]),t=await we.readFile(be.join(e,"package.json"),"utf8"),n=JSON.parse(t);return typeof n.version=="string"&&n.version.trim().length>0?n.version.trim():null}catch{return null}}function Vi(){return $i??=Gu(),$i}function Wi(e,t,n){let r=n.current??"unknown";if(n.kind==="pm_min_version")switch(n.status){case"invalid":return`extension_pm_min_version_invalid:${e}:${t.name}:required=${n.required}`;case"unchecked":return`extension_pm_min_version_unchecked:${e}:${t.name}:required=${n.required}:current=${r}`;case"unmet":return`extension_pm_min_version_unmet:${e}:${t.name}:required=${n.required}:current=${r}`;default:return}switch(n.status){case"invalid":return`extension_pm_max_version_invalid:${e}:${t.name}:allowed=${n.required}`;case"unchecked":return`extension_pm_max_version_unchecked:${e}:${t.name}:allowed=${n.required}:current=${r}`;case"exceeded_warn":return`extension_pm_max_version_exceeded_warn:${e}:${t.name}:allowed=${n.required}:current=${r}`;case"exceeded":return`extension_pm_max_version_exceeded:${e}:${t.name}:allowed=${n.required}:current=${r}`;default:return}}async function Ku(e,t){if(t.pm_min_version===void 0)return{allowed:!0};let n=Ti(t.pm_min_version,await Vi()),r=Wi(e,t,n);return r?{allowed:n.allowed,warning:r}:{allowed:n.allowed}}async function Hu(e,t,n){if(t.pm_max_version===void 0)return{allowed:!0};let r=Ii(t.pm_max_version,await Vi(),n),o=Wi(e,t,r);return o?{allowed:r.allowed,warning:o}:{allowed:r.allowed}}async function qi(e){try{let t=await we.stat(e);return`${Math.trunc(t.mtimeMs)}-${t.size}`}catch{return"missing"}}async function Yu(e,t){let n=e.entry_path;t.module_graph_snapshot_root&&(n=await ri(t.module_graph_snapshot_root,e));let r=new URL(Nu(n).href);if(!(t.cache_bust===!0||typeof t.reload_token=="string"))return r.href;let[i,s]=await Promise.all([qi(e.entry_path),qi(e.manifest_path)]),a=t.reload_token??Pu();return r.searchParams.set("pm_ext_reload",a),r.searchParams.set("pm_ext_entry",i),r.searchParams.set("pm_ext_manifest",s),r.href}async function Hb(e){let t=await Wu(e),n=[],r=[],o=[...t.warnings];if(t.disabled_by_flag)return{...t,warnings:o,loaded:n,failed:r};let i=typeof e.extensionFilter=="function"?t.effective.filter(e.extensionFilter):t.effective;for(let s of i)try{let c=await import(await Yu(s,e));n.push({...s,module:c})}catch(a){o.push(`extension_load_failed:${s.layer}:${s.name}`),r.push({layer:s.layer,name:s.name,entry_path:s.entry_path,error:Ft(a)})}return{...t,warnings:o,loaded:n,failed:r}}var Bi=5e3,Xu=2147483647;function Ju(e){let n={activate:e.activate.bind(e)};if(typeof e.deactivate=="function"){let r=e.deactivate;n.deactivate=r.bind(e)}return n}function Gi(e){let t=Eo(e);return t?Ju(t):null}async function Yb(e,t,n={}){let r=Qu(n?.deactivate_timeout_ms),o=new Set((t?.failed??[]).map(l=>`${l.layer}:${l.name}`)),i=[];for(let l of e.loaded){if(o.has(`${l.layer}:${l.name}`))continue;let u=Gi(l.module);!u||typeof u.deactivate!="function"||i.push({extension:l,deactivate:u.deactivate})}let s=await Promise.all(i.map(async({extension:l,deactivate:u})=>{try{return await Zu(u,r),{ok:!0}}catch(f){return{ok:!1,layer:l.layer,name:l.name,error:Ft(f)}}})),a=[],c=[],d=0;for(let l of s){if(l.ok){d+=1;continue}a.push(`extension_deactivate_failed:${l.layer}:${l.name}`),c.push({layer:l.layer,name:l.name,error:l.error})}return{deactivated:d,warnings:a,failed:c}}function Qu(e){return typeof e!="number"||e<0?Bi:e===0||e===1/0?0:Number.isFinite(e)?Math.min(Xu,Math.max(1,Math.floor(e))):Bi}async function Zu(e,t){if(t===0){await e();return}let n;try{let r=Promise.resolve().then(()=>e());r.catch(()=>{}),await Promise.race([r,new Promise((o,i)=>{n=setTimeout(()=>{i(new Error(`extension deactivate timed out after ${t}ms`))},t),n.unref?.()})])}finally{clearTimeout(n)}}function ef(e){if(!Array.isArray(e.capabilities))return null;let t=new Set;for(let n of e.capabilities){let r=n.trim().toLowerCase();J(r)&&t.add(r)}return t}function k(e,t,n){let r=ef(e);if(r!==null&&!r.has(t))throw K(`${n} requires capability '${t}' in extension manifest capabilities`,{method:n,registration_index:-1,capability:t,missing_capability:t,expected_schema:`"capabilities": [..., "${t}"]`,received:e.capabilities,hint:`Add "${t}" to ${e.name} manifest capabilities, or remove the ${n} registration call.`})}function tf(e){return Object.freeze({name:e.name,layer:e.layer,version:e.version,capabilities:Object.freeze((e.capabilities??[]).filter(t=>B.includes(t))),pm_min_version:e.pm_min_version,pm_max_version:e.pm_max_version,source_package:e.source_package})}function nf(e){return{layer:e.layer,name:e.name,trusted:e.trusted===!0,provenanceVerified:e.provenance?.verified===!0,sandboxProfile:e.sandbox_profile,permissions:e.permissions&&typeof e.permissions=="object"?{fs_read:e.permissions.fs_read,fs_write:e.permissions.fs_write,network:e.permissions.network,env_read:e.permissions.env_read,env_write:e.permissions.env_write,process_spawn:e.permissions.process_spawn}:void 0}}var rr=class{extension;hooks;#e;#n;#o;#r;#s;#a;#i;#c;#t;#d;#l;#u;constructor(t,n,r,o,i,s,a,c,d,l,u){this.#e=t,this.extension=tf(t),this.#n=nf(t),this.#o=n,this.#r=r,this.#s=o,this.#a=i,this.#i=s,this.#c=a,this.#t=c,this.#d=d,this.#l=l,this.#u=u,this.registerCommand=this.registerCommand.bind(this),this.registerParser=this.registerParser.bind(this),this.registerPreflight=this.registerPreflight.bind(this),this.registerService=this.registerService.bind(this),this.registerFlags=this.registerFlags.bind(this),this.registerItemFields=this.registerItemFields.bind(this),this.registerItemTypes=this.registerItemTypes.bind(this),this.registerRelationshipKinds=this.registerRelationshipKinds.bind(this),this.registerMigration=this.registerMigration.bind(this),this.registerProfile=this.registerProfile.bind(this),this.registerRenderer=this.registerRenderer.bind(this),this.registerImporter=this.registerImporter.bind(this),this.registerExporter=this.registerExporter.bind(this),this.registerSearchProvider=this.registerSearchProvider.bind(this),this.registerVectorStoreAdapter=this.registerVectorStoreAdapter.bind(this),this.registerAssuranceMeasurementProvider=this.registerAssuranceMeasurementProvider.bind(this),this.hooks={beforeCommand:f=>this.registerBeforeCommand(f),beforeMutation:f=>this.registerBeforeMutation(f),afterCommand:f=>this.registerAfterCommand(f),onWrite:f=>this.registerOnWrite(f),onRead:f=>this.registerOnRead(f),onIndex:f=>this.registerOnIndex(f)}}allowRegistration(t,n,r,o){let i=Jo(this.#u,this.#n,t,n,r,o);return i.warning&&this.#d.push(i.warning),i.allowed}registerCommandTrace(t,n,r,o,i){return{method:"registerCommand",registration_index:t==="override"?this.#r.overrides.length:this.#r.handlers.length,command:n,expected_schema:r,received:Xe(o),hint:i}}registerCommandOverride(t,n){let r=O(t);if(r.length===0)throw K("registerCommand requires a non-empty command name",this.registerCommandTrace("override",t,'registerCommand("<command>", (context) => unknown)',t,"Provide a non-empty command path as the first argument."));if(typeof n!="function"){let o=this.registerCommandTrace("override",r,'registerCommand("<command>", (context) => unknown)',n,"Provide a function as the second registerCommand argument.");throw K(`registerCommand requires an override function when command name is provided (command="${r}", registration_index=${o.registration_index})`,o)}this.allowRegistration("commands.override","registerCommand","commands",{command:r})&&this.#r.overrides.push({layer:this.#e.layer,name:this.#e.name,command:r,run:n})}resolveCommandDefinitionRunHandler(t,n){let r=typeof t.run=="function"?t.run:void 0,o=typeof t.handler=="function"?t.handler:void 0;return!r&&o&&this.#d.push(`extension_command_definition_legacy_handler_alias:${this.#e.layer}:${this.#e.name}:${n}`),r??o}registerCommandDefinition(t){if(typeof t!="object"||t===null)throw K("registerCommand requires a command definition object",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",t,'Use registerCommand({ name: "command path", run: (context) => ... }).'));if(typeof t.name!="string")throw K("registerCommand requires a command definition name",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",t,"Set command definition.name to a non-empty string command path."));let n=O(t.name);if(n.length===0)throw K("registerCommand requires a non-empty command definition name",this.registerCommandTrace("definition",t.name,"{ name: string; run: (context) => unknown; }",t,"Ensure command definition.name contains a non-empty command path."));let r=this.resolveCommandDefinitionRunHandler(t,n);if(typeof r!="function"){let o=this.registerCommandTrace("definition",n,"{ name: string; run: (context) => unknown; }",r,"Define command definition.run as a function.");throw K(`registerCommand requires a command definition run handler (command="${n}", registration_index=${o.registration_index})`,o)}try{jo(t);let o=Gn(n,t.action);if(!this.allowRegistration("commands.handler","registerCommand","commands",{command:n,action:o}))return;let i=t.description?.trim(),s=t.intent?.trim(),a=Ke("registerCommand definition.examples",t.examples),c=Ke("registerCommand definition.failure_hints",t.failure_hints),d=Kn(t.arguments);t.flags!==void 0&&(k(this.#e,"schema","registerCommand flags"),this.allowRegistration("schema.flags","registerCommand flags","schema")&&(Lt(t.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:n,flags:$t("registerCommand definition.flags",t.flags)})));let l={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:n,action:o,examples:a,failure_hints:c,arguments:d,tier:t.tier??"standard",family:t.family??"extensions"};i&&(l.description=i),s&&(l.intent=s),this.#t.commands.push(l)}catch(o){let i=Ft(o),s=this.registerCommandTrace("definition",n,"{ name: string; run: (context) => unknown; action?: string; arguments?: object[]; flags?: object[]; }",t,i),a=K(`registerCommand definition metadata invalid (command="${n}", registration_index=${s.registration_index}): ${i}`,s);this.#d.push(`extension_command_quarantined:${this.#e.layer}:${this.#e.name}:${n}`),this.#l.push({layer:this.#e.layer,name:this.#e.name,entry_path:this.#e.entry_path,error:a.message,trace:s});return}this.#r.handlers.push({layer:this.#e.layer,name:this.#e.name,command:n,run:r})}registerCommand(t,n){if(k(this.#e,"commands","registerCommand"),typeof t=="string"){this.registerCommandOverride(t,n);return}this.registerCommandDefinition(t)}registerParser(t,n){if(k(this.#e,"parser","registerParser"),!this.allowRegistration("parser.override","registerParser","parser"))return;let r=O(M("registerParser command",t));et("registerParser override",n),this.#s.overrides.push({layer:this.#e.layer,name:this.#e.name,command:r,run:n})}registerPreflight(t){if(k(this.#e,"preflight","registerPreflight"),!this.allowRegistration("preflight.override","registerPreflight","preflight"))return;let n=oi(t);this.#a.overrides.push({layer:this.#e.layer,name:this.#e.name,...n})}registerService(t,n,r={}){k(this.#e,"services","registerService");let o=String(t).trim().toLowerCase();if(!pi(o))throw new TypeError(`registerService service must be one of: ${Oe.join(", ")}`);this.allowRegistration("services.override","registerService","services",{service:o})&&(et("registerService override",n),this.#i.overrides.push({layer:this.#e.layer,name:this.#e.name,service:o,run:n,...Si(r)?{passThrough:!0}:{}}))}registerRenderer(t,n,r={}){if(k(this.#e,"renderers","registerRenderer"),!this.allowRegistration("renderers.override","registerRenderer","renderers"))return;if(typeof n!="function")throw new TypeError("registerRenderer requires a renderer function");let o=String(t).trim().toLowerCase();if(!mi(o))throw new Error(`registerRenderer format must be toon|json, received: ${String(t)}`);if(r.resultDiscriminator!==void 0&&typeof r.resultDiscriminator!="function")throw new TypeError("registerRenderer ownership.resultDiscriminator must be a function when provided");let i=[...new Set((r.commands??[]).map(s=>{if(typeof s!="string"||s.trim().length===0)throw new TypeError("registerRenderer ownership.commands must contain non-empty command paths");return O(s)}))];this.#c.overrides.push({layer:this.#e.layer,name:this.#e.name,format:o,run:n,commands:i,...r.resultDiscriminator?{resultDiscriminator:r.resultDiscriminator}:{}})}registerFlags(t,n){if(k(this.#e,"schema","registerFlags"),!this.allowRegistration("schema.flags","registerFlags","schema"))return;let r=O(M("registerFlags targetCommand",t));Lt(n);let o=$t("registerFlags flags",n);if(o.length===0)throw new TypeError("registerFlags requires at least one flag definition");this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:r,flags:o})}registerItemFields(t){if(k(this.#e,"schema","registerItemFields"),!this.allowRegistration("schema.itemfields","registerItemFields","schema"))return;wi(t);let n=Ze("registerItemFields fields",t);if(n.length===0)throw new TypeError("registerItemFields requires at least one field definition");this.#t.item_fields.push({layer:this.#e.layer,name:this.#e.name,fields:n})}registerItemTypes(t){if(k(this.#e,"schema","registerItemTypes"),!this.allowRegistration("schema.itemtypes","registerItemTypes","schema"))return;vi(t);let n=Ze("registerItemTypes types",t);if(n.length===0)throw new TypeError("registerItemTypes requires at least one type definition");this.#t.item_types.push({layer:this.#e.layer,name:this.#e.name,types:n})}registerRelationshipKinds(t){if(k(this.#e,"schema","registerRelationshipKinds"),!this.allowRegistration("schema.relationshipkinds","registerRelationshipKinds","schema"))return;if(!Array.isArray(t))throw new TypeError("registerRelationshipKinds definitions requires an array of object definitions");if(t.length===0)throw new TypeError("registerRelationshipKinds requires at least one definition");let n=mn();for(let o of this.#t.relationship_kinds)for(let i of o.definitions)n.register(i);let r=t.map(o=>(n.register(o),n.require(o.kind)));this.#t.relationship_kinds.push({layer:this.#e.layer,name:this.#e.name,definitions:r})}registerMigration(t){if(k(this.#e,"schema","registerMigration"),!this.allowRegistration("schema.migrations","registerMigration","schema"))return;Ei(t);let n=Qe("registerMigration definition",t);this.#t.migrations.push(tt({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerMigration definition",t)},n))}registerProfile(t){if(k(this.#e,"schema","registerProfile"),!this.allowRegistration("schema.profiles","registerProfile","schema"))return;let n=Je(t);Oi(n),this.#t.profiles.push({layer:this.#e.layer,name:this.#e.name,profile:Ai(n)})}registerImportExportCommandFlags(t,n,r){r.flags!==void 0&&(k(this.#e,"schema",`${t} options.flags`),this.allowRegistration("schema.flags",`${t} options.flags`,"schema")&&(Lt(r.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:n,flags:$t(`${t} options.flags`,r.flags)})))}applyImportExportCommandMetadata(t,n,r){if(r!==void 0&&(typeof r!="object"||r===null||Array.isArray(r)))throw new TypeError(`${t} options must be an object when provided`);let o=`${t==="registerImporter"?"Import":"Export"} items with the registered extension adapter.`,i=[{name:"file",required:!1,description:"Optional input or output file path."}],s={...r,description:r?.description??o,arguments:r?.arguments??i},a=Fo(t,s,r?.description!==void 0);S(`${t} options.action`,s.action),S(`${t} options.description`,s.description),S(`${t} options.intent`,s.intent);let c=Gn(n,s.action),d=Ke(`${t} options.examples`,s.examples),l=Ke(`${t} options.failure_hints`,s.failure_hints),u=Kn(s.arguments);this.registerImportExportCommandFlags(t,n,s);let f={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:n,action:c,examples:d,failure_hints:l,arguments:u},m=s.description?.trim();m&&(f.description=m);let p=s.intent?.trim();return p&&(f.intent=p),this.#t.commands.push(f),a}registerImporter(t,n,r){if(k(this.#e,"importers","registerImporter"),!this.allowRegistration("importers.importer","registerImporter","importers"))return;let o=Vn(M("registerImporter name",t));et("registerImporter importer",n);let i=Wn(o,"import");this.applyImportExportCommandMetadata("registerImporter",i,r),this.#t.importers.push({layer:this.#e.layer,name:this.#e.name,importer:o}),this.#r.handlers.push({layer:this.#e.layer,name:this.#e.name,command:i,run:async s=>n(Nn(s,o,"import"))})}registerExporter(t,n,r){if(k(this.#e,"importers","registerExporter"),!this.allowRegistration("importers.exporter","registerExporter","importers"))return;let o=Vn(M("registerExporter name",t));et("registerExporter exporter",n);let i=Wn(o,"export"),s=this.applyImportExportCommandMetadata("registerExporter",i,r);this.#t.exporters.push({layer:this.#e.layer,name:this.#e.name,exporter:o,...s===void 0?{}:{output:s}}),this.#r.handlers.push({layer:this.#e.layer,name:this.#e.name,command:i,run:async a=>{let c=await n(Nn(a,o,"export"));return s?.receipt==="suppress"&&!An(c)?ho(c):c}})}registerSearchProvider(t){if(k(this.#e,"search","registerSearchProvider"),!this.allowRegistration("search.provider","registerSearchProvider","search"))return;let n=Qe("registerSearchProvider provider",t);this.#t.search_providers.push(tt({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerSearchProvider provider",t)},n))}registerVectorStoreAdapter(t){if(k(this.#e,"search","registerVectorStoreAdapter"),!this.allowRegistration("search.vectorstore","registerVectorStoreAdapter","search"))return;let n=Qe("registerVectorStoreAdapter adapter",t);this.#t.vector_store_adapters.push(tt({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerVectorStoreAdapter adapter",t)},n))}registerAssuranceMeasurementProvider(t){if(k(this.#e,"services","registerAssuranceMeasurementProvider"),!this.allowRegistration("services.assuranceprovider","registerAssuranceMeasurementProvider","services"))return;if(hi(t),t.network&&this.#e.permissions?.network!==!0)throw new TypeError("registerAssuranceMeasurementProvider network provider requires permissions.network=true");let n=Qe("registerAssuranceMeasurementProvider provider",t);this.#t.assurance_providers.push(tt({layer:this.#e.layer,name:this.#e.name,network_permission:this.#e.permissions?.network===!0,definition:Ie("registerAssuranceMeasurementProvider provider",t)},n))}registerBeforeCommand(t){k(this.#e,"hooks","api.hooks.beforeCommand"),this.allowRegistration("hooks.beforecommand","api.hooks.beforeCommand","hooks")&&(he("beforeCommand",t),this.#o.beforeCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerBeforeMutation(t){k(this.#e,"hooks","api.hooks.beforeMutation"),this.allowRegistration("hooks.beforemutation","api.hooks.beforeMutation","hooks")&&(he("beforeMutation",t),this.#o.beforeMutation.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerAfterCommand(t){k(this.#e,"hooks","api.hooks.afterCommand"),this.allowRegistration("hooks.aftercommand","api.hooks.afterCommand","hooks")&&(he("afterCommand",t),this.#o.afterCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnWrite(t){k(this.#e,"hooks","api.hooks.onWrite"),this.allowRegistration("hooks.onwrite","api.hooks.onWrite","hooks")&&(he("onWrite",t),this.#o.onWrite.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnRead(t){k(this.#e,"hooks","api.hooks.onRead"),this.allowRegistration("hooks.onread","api.hooks.onRead","hooks")&&(he("onRead",t),this.#o.onRead.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnIndex(t){k(this.#e,"hooks","api.hooks.onIndex"),this.allowRegistration("hooks.onindex","api.hooks.onIndex","hooks")&&(he("onIndex",t),this.#o.onIndex.push({layer:this.#e.layer,name:this.#e.name,run:t}))}};function rf(e,t,n,r,o,i,s,a,c,d,l){return new rr(e,t,n,r,o,i,s,a,c,d,l)}function of(e){let t=e.commands.length,n=e.flags.reduce((s,a)=>s+a.flags.length,0),r=e.item_fields.reduce((s,a)=>s+a.fields.length,0),o=e.item_types.reduce((s,a)=>s+a.types.length,0),i=(e.relationship_kinds??[]).reduce((s,a)=>s+a.definitions.length,0);return{commands:t,flags:n,item_fields:r,item_types:o,...i>0?{relationship_kinds:i}:{},migrations:e.migrations.length,profiles:e.profiles.length,importers:e.importers.length,exporters:e.exporters.length,search_providers:e.search_providers.length,vector_store_adapters:e.vector_store_adapters.length,...(e.assurance_providers?.length??0)>0?{assurance_providers:e.assurance_providers.length}:{}}}function sf(e){let t=[],n=(i,s)=>{let a=new Map;for(let c of i){let d=a.get(c.command)??[];d.push(c),a.set(c.command,d)}for(let c of[...a.keys()].sort((d,l)=>d.localeCompare(l))){let d=a.get(c);if(d.length<=1)continue;let l=d[d.length-1];for(let u of d.slice(0,-1))t.push(`${s}:${c}:${l.layer}:${l.name}:${u.layer}:${u.name}`)}};n(e.handlers,"extension_command_handler_collision"),n(e.overrides,"extension_command_override_collision");let r=new Set(e.handlers.map(i=>i.command)),o=[...new Set(e.overrides.map(i=>i.command))].filter(i=>r.has(i));o.sort((i,s)=>i.localeCompare(s));for(let i of o){let s=e.handlers.filter(c=>c.command===i),a=e.overrides.filter(c=>c.command===i);for(let c of a)for(let d of s)t.push(`extension_command_override_handler_overlap:${i}:${c.layer}:${c.name}:${d.layer}:${d.name}`)}return t}function af(e){let t=new Map;for(let r of e.overrides){let o=t.get(r.format)??[];o.push(r),t.set(r.format,o)}let n=[];for(let r of[...t.keys()].sort((o,i)=>o.localeCompare(i))){let o=t.get(r);if(o.length<=1)continue;let i=o[o.length-1];for(let s of o.slice(0,-1))i.commands?.length&&s.commands?.length&&!s.commands.some(a=>i.commands?.includes(a))||n.push(`extension_renderer_collision:${r}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return n}function cf(e){let t=[],n=new Map;for(let r of e.overrides){let o=n.get(r.command)??[];o.push(r),n.set(r.command,o)}for(let r of[...n.keys()].sort((o,i)=>o.localeCompare(i))){let o=n.get(r);if(o.length<=1)continue;let i=o[o.length-1];for(let s of o.slice(0,-1))t.push(`extension_parser_override_collision:${r}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return t}var df=new Set(["output_format"]);function lf(e){let t=[],n=new Map;for(let r of e.overrides){let o=n.get(r.service)??[];o.push(r),n.set(r.service,o)}for(let r of[...n.keys()].sort((o,i)=>o.localeCompare(i))){let o=n.get(r);if(o.length<=1||df.has(r))continue;let i=o[o.length-1];for(let s of o.slice(0,-1))t.push(`extension_service_override_collision:${r}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return t}async function Xb(e){let t=Ko(e.policy??Du),n=Pt(),r=Pn(),o=Mn(),i=$n(),s=Ln(),a=jn(),c=Fn(),d=[],l=[];for(let m of e.loaded){let p=Gi(m.module);if(!p)continue;let _=d.length,g=$o({hooks:n,commands:r,parsers:o,preflight:i,services:s,renderers:a,registrations:c});try{await p.activate(rf(m,n,r,o,i,s,a,c,l,d,t)),d.length>_&&(g(),l.push(`extension_activation_rolled_back:${m.layer}:${m.name}`))}catch(w){g(),l.push(`extension_activate_failed:${m.layer}:${m.name}`);let v=gi(w);d.push({layer:m.layer,name:m.name,entry_path:m.entry_path,error:Ft(w),trace:v})}}let u=[...sf(r),...cf(o),...ii(i),...lf(s),...af(a)],f=[...new Set([...l,...u])];return{hooks:n,commands:r,parsers:o,preflight:i,services:s,renderers:a,registrations:c,failed:d,warnings:f,hook_counts:{before_command:n.beforeCommand.length,before_mutation:n.beforeMutation.length,after_command:n.afterCommand.length,on_write:n.onWrite.length,on_read:n.onRead.length,on_index:n.onIndex.length},command_override_count:r.overrides.length,command_handler_count:r.handlers.length,parser_override_count:o.overrides.length,preflight_override_count:i.overrides.length,service_override_count:s.overrides.length,renderer_override_count:a.overrides.length,registration_counts:of(c)}}(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]="b2cf7f56-432d-5c74-ba0f-248c42a97255")}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]="07566a0b-2917-5ed8-828a-d811ae48dfaf")}catch{}})();function tw(){let e=Promise.resolve(),t=new Set;return{async read(n){let r=e,o,i=new Promise(s=>{o=s});t.add(i),await r;try{return await n()}finally{t.delete(i),o()}},write(n){let o=Promise.all([e,...t]).then(()=>n());return e=o.then(()=>{},()=>{}),o}}}function uf(){let e=Promise.resolve(),t=0,n=[],r=()=>{if(t!==0)return;let o=n.splice(0);for(let i of o)i()};return{enqueue(o){t++;let i=e.then(()=>o());return e=i.then(()=>{},()=>{}).finally(()=>{t--,r()}),i},idle(){return t===0?Promise.resolve():new Promise(o=>n.push(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]="40b169fc-3c5f-5b2a-8fed-a9388b07d9f7")}catch{}})();var Re=null,Hi=null,pf=null,_f=null,or=null,gf=null,Yi=null,yf=null;var hf=[],Xi=new mf;function T(){return Xi.getStore()}function aw(e){return Xi.run({hooks:null,commands:null,parsers:null,preflight:null,services:null,renderers:null,registrations:null,commandContext:null,commandResult:void 0,affectedItems:[]},e)}var bf=new Set(["body","comments","dependencies","docs","events","files","learnings","notes","reminders","test_runs","tests"]);function Ki(e){let t=H.resolve(e);for(;;){if(ff(H.join(t,".git")))return t;let n=H.dirname(t);if(n===t)return;t=n}}function wf(e){let t=process.env.PM_SOURCE_WORKSPACE_ROOT?.trim()||process.cwd(),n=Ki(t)??H.resolve(t),r=Ki(n);if(!e)return{source_workspace_root:n,...r?{repo_root:r}:{}};let o=H.relative(n,H.resolve(e)),i=o.length>0&&!o.startsWith(`..${H.sep}`)&&o!==".."&&!H.isAbsolute(o);return{source_workspace_root:n,...r?{repo_root:r}:{},...i?{pm_root_rel:o.split(H.sep).join("/")}:{}}}function cw(e){let t=T();if(t){t.hooks=e;return}Re=e}function dw(e){let t=T();if(t){t.commands=e;return}Hi=e}function lw(e){let t=T();if(t){t.parsers=e;return}pf=e}function uw(e){let t=T();if(t){t.preflight=e;return}_f=e}function fw(e){let t=T();if(t){t.services=e;return}or=e}function mw(e){let t=T();if(t){t.renderers=e;return}gf=e}function pw(e){let t=T();if(t){t.registrations=e;return}Yi=e}function _w(){let e=T();return e?e.registrations:Yi}function gw(e){if(!e)return;let t=T();t?t.affectedItems.push(e):hf.push(e)}function yw(e,t){if(!e||!e.id)return{};let n={id:e.id,type:e.type,status:e.status};if(!Array.isArray(t))return n;let r=e;for(let o of t){if(typeof o!="string")continue;let i=o.startsWith("unset:")?o.slice(6):o;i==="id"||i==="type"||i==="status"||bf.has(i)||Object.hasOwn(r,i)&&r[i]!==void 0&&(n[i]=r[i])}return n}async function Ji(e){let t=T(),n=t?t.hooks:Re;return n?Jn(n,e):[]}async function hw(e){let t=T(),n=t?t.hooks:Re;n&&await Xn(n,e)}async function Qi(e){let t=T(),n=t?t.hooks:Re;return n?Qn(n,e):[]}function bw(){let e=T();return((e?e.hooks:Re)?.onRead?.length??0)>0}async function ww(e){let t=T(),n=t?t.hooks:Re;return n?Zn(n,e):[]}async function vw(e){let t=T(),n=t?t.commands:Hi;return n?er(n,{...e,...wf(e.pm_root)}):{handled:!1,result:null,warnings:[]}}function Zi(e,t){let n=T(),r=n?n.commandContext:yf;return{service:e,command:r?.command,args:r?[...r.args]:[],options:r?.options?{...r.options}:{},global:r?.global?{...r.global}:void 0,pm_root:r?.pm_root,source_workspace_root:r?.source_workspace_root,repo_root:r?.repo_root,pm_root_rel:r?.pm_root_rel,payload:t}}async function Ut(e,t){let n=T(),r=n?n.services:or;return r?nr(r,Zi(e,t)):{handled:!1,result:t,warnings:[]}}function es(e,t){let n=T(),r=n?n.services:or;return r?tr(r,Zi(e,t)):{handled:!1,result:t,warnings:[]}}(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]="fd8576c5-0011-5aa2-ad8c-f6ec5715e419")}catch{}})();var zt="changed_fields",vf="changed_field_count",ir="rows",Ef=new Set(["apply","rollback"]),os=new Set(["deleted","would_delete"]),ts=256,ns={start_task:["claim","update"],pause_task:["update","release"],close_task:["close","release"]};function kf(e,t){if(!$(e)||typeof e.action!="string"||typeof e.id!="string"||e.id.length===0)return null;let n=Object.hasOwn(ns,e.action)?ns[e.action]:void 0;if(!n||!n.every(i=>{let s=e[i];return $(s)&&$(s.item)&&s.item.id===e.id&&Array.isArray(s.changed_fields)&&s.changed_fields.every(a=>typeof a=="string")}))return null;let r=e[n.at(-1)],o=ss(r);return t.idOnly?o:!t.compactEnvelope&&t.changedFields!=="compact"?null:{...e,...t.compactEnvelope?{...o,changed_field_count:new Set(n.flatMap(i=>e[i].changed_fields)).size}:{},...Object.fromEntries(n.map(i=>[i,as(e[i],t)]))}}function rs(e){return typeof e!="string"||e.length<=ts?e:`${e.slice(0,ts-1)}\u2026`}function Of(e){if(!$(e))return null;let t={...e};return t.reason=rs(t.reason),$(t.previous_terminal)&&(t.previous_terminal=Object.fromEntries(Object.entries(t.previous_terminal).map(([n,r])=>[n,rs(r)]))),t}function $(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function is(e){let t=e[zt];if(!Array.isArray(t))return null;let n=Object.getPrototypeOf(e)===null?Object.create(null):{};for(let[r,o]of Object.entries(e))r!==zt&&(n[r]=o);return n[vf]=t.length,n}function Af(e){return"item"in e&&Array.isArray(e[zt])}function Sf(e){return typeof e.mode=="string"&&Ef.has(e.mode)&&Array.isArray(e[ir])}function Cf(e,t){let n=Object.getPrototypeOf(e)===null?Object.create(null):{};return Object.assign(n,e),n[ir]=t,n}function ss(e){if(!$(e))return null;let t=$(e.item)?e.item:$(e.plan)?e.plan:null;if(t===null)return null;let n=typeof t.id=="string"?t.id:void 0,r=typeof e.outcome=="string"&&os.has(e.outcome)?e.outcome:typeof t.status=="string"?t.status:void 0;return n?r?{id:n,status:r,...typeof e.deleted=="boolean"?{deleted:e.deleted}:{}}:{id:n}:null}function Tf(e,t){if(!$(e))return null;if($(e.plan)&&$(e.mutation_receipt)&&e.mutation_receipt.kind==="plan_mutation"&&e.mutation_receipt.id===e.plan.id&&e.mutation_receipt.action===e.action)return e.mutation_receipt;if(!t||!$(e.item)||typeof e.item.id!="string")return null;let n=e[zt];if(!Array.isArray(n))return null;let r={id:e.item.id,...typeof e.outcome=="string"&&os.has(e.outcome)?{status:e.outcome}:typeof e.item.status=="string"?{status:e.item.status}:{},...typeof e.deleted=="boolean"?{deleted:e.deleted}:{},...typeof e.previous_status=="string"?{previous_status:e.previous_status}:{},changed_field_count:n.length};return If(e,e.item,r),r}function If(e,t,n){let r=typeof e.close_reason=="string"?e.close_reason:typeof t.close_reason=="string"?t.close_reason:void 0;r!==void 0&&(n.close_reason=r);let o=Of(e.recurrence);if(o!==null&&(n.recurrence=o),Array.isArray(e.warnings)&&e.warnings.length>0&&(n.warnings=e.warnings),$(e.recovery)&&(n.recovery=e.recovery),typeof e.claimed_by=="string"||typeof e.released_by=="string")for(let i of["claimed_by","released_by","previous_assignee","forced","skipped","available","attempts","suggestions"])Object.hasOwn(e,i)&&(n[i]=e[i])}function Rf(e){let t=Sf(e)?e[ir]:void 0;if(!Array.isArray(t))return{projected:e,changed:!1};let n=!1,r=t.map(o=>{if(!$(o))return o;let i=is(o);return i?(n=!0,i):o});return n?{projected:Cf(e,r),changed:!0}:{projected:e,changed:!1}}function as(e,t={}){let n=kf(e,t);if(n!==null)return n;if(t.idOnly===!0){let c=ss(e);if(c!==null)return c}if(t.compactEnvelope===!0||t.changedFields==="compact"){let c=Tf(e,t.compactEnvelope===!0);if(c!==null)return c}if((t.changedFields??"full")==="full"||!$(e))return e;let o=!1,i=e,s=Af(e)?is(e):null;s!==null&&(i=s,o=!0);let a=Rf(i);return a.changed&&(i=a.projected,o=!0),o?i:e}import{AsyncLocalStorage as Qm}from"node:async_hooks";(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]="b18eefc1-0d1d-5c9c-b98a-b96771070301")}catch{}})();var cs=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),xf=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract","--all"]);function Nf(e){let t=e.indexOf("=");return t>0&&cs.has(e.slice(0,t))}function Df(e,t){return typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-")}function ds(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(cs.has(n)){t+=Df(n,e[t+1])?1:0;continue}if(!(Nf(n)||xf.has(n)||n==="--profile"||n==="--id-only"||n==="--explain")&&!n.startsWith("-"))return t}}function Tw(e){let t=ds(e);return t===void 0?void 0:e[t].trim().toLowerCase()}(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]="4f014bd9-39b6-5017-93ed-f0e7fba8497a")}catch{}})();var ls=e=>{let t='"',n=0;for(let r of e){if(r==="\\"){n+=1;continue}t+="\\".repeat(r==='"'?n*2+1:n),t+=r,n=0}return`${t}${"\\".repeat(n*2)}"`},us=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?ls(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,qt=(e,t=process.platform)=>{let n=e.map(r=>us(r,t)).join(" ");return n.length>0?`pm ${n}`:"pm"};(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]="49de148c-3c60-547b-b3bc-d0a71e013dc6")}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]="d248fcfa-d007-526a-9849-9ea8352acaa1")}catch{}})();var _s=new WeakMap;function $w(e,t){_s.set(e,new Set(t))}var fs='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',Pf={context:{row_keys:["high_level","low_level"],fields:"supported"},get:{row_keys:["children"],fields:"supported"},list:{row_keys:["items"],fields:"supported"},next:{row_keys:["recommended","ready","decision_needed","gate_needed","containers","blocked","held_by_others"],fields:"unsupported"},search:{row_keys:["items"],fields:"supported"},activity:{row_keys:["activity_digest","compact_activity","provenance_activity","activity"],fields:"unsupported"},history:{row_keys:["compact_history","provenance_history","history","diff"],fields:"unsupported"},deps:{row_keys:["graph.nodes","graph.edges","context.nodes","context.edges"],fields:"unsupported"},health:{row_keys:["checks"],fields:"unsupported"},aggregate:{row_keys:["groups"],fields:"unsupported"},duplicates:{row_keys:["clusters"],fields:"unsupported"},stats:{row_keys:["by_type","by_status"],fields:"unsupported"},comments:{row_keys:["comments"],fields:"unsupported"},notes:{row_keys:["notes"],fields:"unsupported"},learnings:{row_keys:["learnings"],fields:"unsupported"},files:{row_keys:["files"],fields:"unsupported"},docs:{row_keys:["docs"],fields:"unsupported"},validate:{row_keys:["checks","warnings"],fields:"unsupported"},contracts:{row_keys:["command_summaries","commands"],fields:"unsupported"}},Mf=[{command:"activity",complete_mode:"full",omissions_by_mode:{digest:[{name:"event_rows",restore_with:"--raw"}],compact:[{name:"provenance",restore_with:"--full"}],provenance:[{name:"patch_and_hashes",restore_with:"--full"}]}},{command:"history",complete_mode:"full",omissions_by_mode:{compact:[{name:"raw_history",restore_with:"--full"}],provenance:[{name:"patch_and_hashes",restore_with:"--full"}]}}];function Lw(e,t,n){if(e&&t)throw new h(`${n} cannot be combined with --full`,y.USAGE)}function W(e,t=new Set){let n=e.filter(r=>!t.has(r.name)).map(r=>({...r}));return{has_omissions:n.length>0,omitted_field_group_count:n.length,omitted_field_groups:n}}function jw(e,t){let n=Mf.find(o=>o.command===e);if(n===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===n.complete_mode)return W([]);let r=n.omissions_by_mode[t];if(r===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return W(r)}var $f=[{name:"hierarchy",restore_with:"--depth standard"},{name:"activity",restore_with:"--depth standard"},{name:"progress",restore_with:"--depth standard"},{name:"blockers",restore_with:"--depth standard"},{name:"recently_created",restore_with:"--depth standard"},{name:"unparented",restore_with:"--depth standard"},{name:"files",restore_with:"--depth deep"},{name:"workload",restore_with:"--depth standard"},{name:"staleness",restore_with:"--depth deep"},{name:"tests",restore_with:"--depth deep"},{name:"workspace_memory",restore_with:"--depth deep"}];function F(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Lf=new Set([void 0,"tabular_when_uniform"]),jf=new Set(["collection","none"]),Ff=new Set(["supported","unsupported"]);function ms(e,t){return Array.isArray(e)&&(t||e.length>0)&&e.every(n=>typeof n=="string"&&n.length>0)&&new Set(e).size===e.length}function Uf(e){return F(e)&&typeof e.command=="string"&&e.command.trim().length>0&&jf.has(e.row_kind)&&ms(e.row_keys,!0)&&(e.continuation_row_keys===void 0||ms(e.continuation_row_keys,!1))&&Ff.has(e.fields)&&Lf.has(e.toon_encoding)&&(e.row_kind==="collection"?e.row_keys.length>0&&typeof e.jq_selector=="string"&&e.jq_selector.trim().length>0:e.row_keys.length===0&&e.jq_selector===void 0)}var zf={ancestors:["ids"],descendants:["ids"],predecessors:["ids"],successors:["ids"],paths:["paths"],impact:["affected"],audit:["findings"],communities:["communities"],redundancy:["redundant"],dominators:["bottlenecks"],slack:["rows"],centrality:["rows"],articulation:["articulation_points","bridges"],plan:["steps"]},qf={context:["sections_included","high_level","low_level"],get:["item"],list:["items","projection"],next:["recommended","ready","decision_needed","gate_needed","containers","blocked","held_by_others"],search:["items","projection"],activity:["activity_digest","compact_activity","provenance_activity","activity"],history:["compact_history","provenance_history","history","diff"],deps:["tree","graph","projection"],health:["checks"],aggregate:["groups"],duplicates:["clusters"],stats:["totals","by_type","by_status"],comments:["comments"],notes:["notes"],learnings:["learnings"],files:["files"],docs:["docs"],validate:["checks","warnings"],contracts:["command_summaries","commands","selected"]};function Bf(e,t){let n=e.trim().toLowerCase().split(/\s+/u,1)[0],r=n?.startsWith("list-")?"list":n;if(r==="graph"){let s=typeof t.subcommand=="string"?t.subcommand:"";if(s.length===0)return;let a=zf[s];if(a===void 0)return;let c=a.filter(d=>Array.isArray(t[d])||F(t[d]));return{command:"graph",row_kind:c.length>0?"collection":"none",row_keys:c,fields:"unsupported",...c.length>0?{jq_selector:fs}:{},toon_encoding:"tabular_when_uniform"}}let o=Pf[r],i=qf[r];return o===void 0||i===void 0||!i.some(s=>Object.hasOwn(t,s))?void 0:(()=>{let s=o.row_keys.filter(a=>{let c=a.split(".").reduce((d,l)=>F(d)?d[l]:void 0,t);return Array.isArray(c)||F(c)});return{command:r,row_kind:s.length>0?"collection":"none",row_keys:s,fields:o.fields,...s.length>0?{jq_selector:fs}:{},toon_encoding:"tabular_when_uniform"}})()}function Vf(e){if(!F(e.projection)||typeof e.projection.mode!="string"||e.projection.mode.trim().length===0)return;let t=e.projection.declared_field_groups,n=e.projection.included_field_groups;if(!Array.isArray(t)||!Array.isArray(n))return;let r=t.filter(s=>F(s)&&typeof s.name=="string"&&s.name.trim().length>0&&typeof s.restore_with=="string"&&s.restore_with.trim().length>0),o=n.filter(s=>typeof s=="string");if(r.length!==t.length||o.length!==n.length)return;let i=new Set(r.map(s=>s.name));if(!(i.size!==r.length||new Set(o).size!==o.length||o.some(s=>!i.has(s))))return W(r,new Set(o))}function Wf(e){if(!Array.isArray(e.sections_included))return;let t=W($f,new Set(e.sections_included.filter(n=>typeof n=="string")));return F(e.summary)&&e.summary.scope==="matching_items"&&(t.summary_scope="matching_items"),t}function Gf(e){if(!F(e.item))return;let t=e.item,n=["comments","notes","learnings","files","tests","docs","reminders","events"],r=["body","children","claim_state","linked","schedule"],o=_s.get(e),i=a=>n.includes(a)||a==="body"?t:e,s=["body",...n,...r.slice(1)].filter(a=>o===void 0||o.has(a)||Object.hasOwn(i(a),a)).map(a=>({name:a,restore_with:`--fields ${a}`}));return W(s,new Set(s.flatMap(({name:a})=>Object.hasOwn(i(a),a)?[a]:[])))}function ps(e){if(F(e.projection))return W([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function Kf(e){if(!F(e.projection))return W([]);if(typeof e.projection.mode=="string")return W([{name:"full_check_details",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_check_details"]:[]))}function Hf(e){if(!(!F(e.selected)||typeof e.selected.summary!="boolean"))return W([{name:"full_contract_catalog",restore_with:"--full"}],new Set(e.selected.summary?[]:["full_contract_catalog"]))}function Yf(e,t){let n=Vf(t);if(n!==void 0)return n;let[r]=e.split(/\s+/u,1);if(r==="context")return Wf(t);if(r==="get")return Gf(t);if(r==="list"||r.startsWith("list-"))return ps(t);if(r==="search")return ps(t)??W([{name:"projection_metadata",restore_with:"--full"}]);if(r==="health")return Kf(t);if(r==="contracts")return Hf(t)}function gs(e,t){if(e===void 0||!F(t))return t;let n=Yf(e,t),r=t.row_contract,o=Uf(r)?r:Bf(e,t),i=o!==void 0?{...t,row_contract:o}:Object.hasOwn(t,"row_contract")?Object.fromEntries(Object.entries(t).filter(([s])=>s!=="row_contract")):t;return F(i.omission_receipt)||n===void 0?i:{...i,omission_receipt:n}}import{randomUUID as qm}from"node:crypto";import{randomUUID as jm}from"node:crypto";import{constants as Ne}from"node:fs";import{lstat as js,mkdir as Fm,open as Us,rename as Um,rm as zm}from"node:fs/promises";import Gt from"node:path";import{constants as ym}from"node:fs";import z from"node:fs/promises";import Wt from"node:path";import{randomUUID as dr}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]="43f7bd27-7874-56f9-a497-e6f67a3ae9be")}catch{}})();function ys(e){let t=Math.ceil(e.size/2);for(let n of e.keys()){if(t===0)return;e.delete(n),t-=1}}import Xf from"node:crypto";import{AsyncLocalStorage as Jf}from"node:async_hooks";(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]="38ed5847-939e-5846-bc7d-6d257d36a25f")}catch{}})();var bs=new Jf,hs=1024;function ws(){let e=bs.getStore();if(e===void 0)return;let t=new Date(Date.parse(e.clock)+e.clockReads*e.tickMs).toISOString();return e.clockReads+=1,t}function Bw(e){let t=bs.getStore();if(t===void 0)return;if(!Number.isSafeInteger(e)||e<0||e>hs)throw new Error(`Reproducible token length must be an integer between 0 and ${hs}`);let n="";for(;n.length<e;){let r=Xf.createHash("sha256").update(`${t.seed}\0${t.tokenReads}`).digest();t.tokenReads+=1;for(let o of r)if(n+=(o%36).toString(36),n.length===e)break}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a5bd8db9-cd23-5529-ad78-b7e87bd43b59")}catch{}})();var Qf=/^([+-]?)(\d+)([hdwm])$/i,Zf=/^[+-]?\d+[hdwm](?:[+-]\d+[hdwm])+$/i,em=/^(\d{4})(\d{2})(\d{2})$/,tm=/^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,nm=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})-(\d{2})(?:-(\d{2}))?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,rm=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,om=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;function Es(){return ws()??new Date().toISOString()}function Yw(e){return Number.isFinite(Date.parse(e))}function im(e){let t=om.exec(e);if(!t||!Number.isFinite(Date.parse(e)))return!1;let[,n,r,o,i,s,a,c,d]=t,[l,u,f,m,p,_]=[n,r,o,i,s,a].map(Number);return u>=1&&u<=12&&f>=1&&f<=cr(l,u-1)&&m<=23&&p<=59&&_<=59&&(c===void 0||Number(c)<=23)&&(d===void 0||Number(d)<=59)}function Xw(e){let t=/\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/iu.exec(e)?.[1];return im(e)&&(t===void 0||/^\d{0,3}0*$/u.test(t))}var sm=1e4,Bt=new Map;function vs(e){let t=Bt.get(e);if(t!==void 0)return t;let n=Date.parse(e);return Bt.size>=sm&&ys(Bt),Bt.set(e,n),n}function xe(e,t){let n=vs(e),r=vs(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t)}function Jw(e,t){return!(t.deadlineBefore&&(!e.deadline||xe(e.deadline,t.deadlineBefore)>0)||t.deadlineAfter&&(!e.deadline||xe(e.deadline,t.deadlineAfter)<0)||t.updatedAfter&&xe(e.updated_at,t.updatedAfter)<0||t.updatedBefore&&xe(e.updated_at,t.updatedBefore)>0||t.createdAfter&&xe(e.created_at,t.createdAfter)<0||t.createdBefore&&xe(e.created_at,t.createdBefore)>0)}function sr(e){return e?`.${e.slice(1).padEnd(3,"0").slice(0,3)}`:""}function ar(e){if(!e)return"";if(e.toUpperCase()==="Z")return"Z";let t=/^([+-]\d{2})(\d{2})$/.exec(e);return t?`${t[1]}:${t[2]}`:e}function am(e,t,n){n&&n!==t&&(e.includes(n)||e.push(n))}function cm(e){let t=[],n=d=>am(t,e,d),r=em.exec(e);if(r){let[,d,l,u]=r;n(`${d}-${l}-${u}`)}let o=tm.exec(e);if(o){let[,d,l,u,f,m,p,_,g]=o,w=p?`:${p}`:"";n(`${d}-${l}-${u}T${f}:${m}${w}${sr(_)}${ar(g)}`)}let i=nm.exec(e);if(i){let[,d,l,u,f,m,p]=i,_=f?`:${f}`:"";n(`${d}T${l}:${u}${_}${sr(m)}${ar(p)}`)}let s=rm.exec(e);if(s){let[,d,l,u,f,m,p]=s,_=f?`:${f}`:"";n(`${d}T${l}:${u}${_}${sr(m)}${ar(p)}`)}let a=10,c=e.slice(0,a);if(lm(c)){let d=a;for(;d<e.length&&um(e[d]);)d+=1;d<e.length&&n(`${c}T${e.slice(d)}`)}return t}function dm(e){let t=Date.parse(e);if(Number.isFinite(t))return t;for(let n of cm(e)){let r=Date.parse(n);if(Number.isFinite(r))return r}return Number.NaN}function lm(e){if(e.length!==10)return!1;for(let t=0;t<e.length;t+=1){let n=e[t];if(t===4||t===7){if(n!=="-")return!1;continue}let r=n.charCodeAt(0);if(r<48||r>57)return!1}return!0}function um(e){return e?e===" "||e===" "||e===`
|
|
9
9
|
`||e==="\r"||e==="\f"||e==="\v":!1}function cr(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}var fm=["January","February","March","April","May","June","July","August","September","October","November","December"],mm=/^(\d{4})-(\d{2})-(\d{2})/,pm=/^(\d{4})(\d{2})(\d{2})(?:[T ]?\d{2}|$)/;function _m(e,t,n){let r=mm.exec(t)??pm.exec(t);if(!r)return;let o=Number.parseInt(r[1],10),i=Number.parseInt(r[2],10),s=Number.parseInt(r[3],10),a=n?.trim()||"deadline";if(i<1||i>12)throw new h(`Invalid ${a} value "${e}". Month "${r[2]}" is out of range \u2014 use a month between 01 and 12.`,y.USAGE);let c=cr(o,i-1);if(s<1||s>c)throw new h(`Invalid ${a} value "${e}". ${fm[i-1]} ${o} has ${c} days, so day "${r[3]}" does not exist. Use a real YYYY-MM-DD calendar date.`,y.USAGE)}function gm(e,t){let n=new Date(e.getTime()),r=n.getUTCDate(),o=n.getUTCMonth()+t,i=n.getUTCFullYear()+Math.floor(o/12),s=(o%12+12)%12,a=Math.min(r,cr(i,s));return n.setUTCFullYear(i,s,a),n}function Qw(e,t=new Date,n="deadline"){let r=e.trim();if(r.toLowerCase()==="now")return t.toISOString();let o=Qf.exec(r);if(o){let s=o[1]==="-"?-1:1,a=Number.parseInt(o[2],10)*s,c=o[3].toLowerCase();if(c==="m")return gm(t,a).toISOString();let d=c==="h"?3600*1e3:c==="d"?1440*60*1e3:10080*60*1e3;return new Date(t.getTime()+a*d).toISOString()}_m(e,r,n);let i=dm(r);if(!Number.isFinite(i)){let s=n.trim().length>0?n.trim():"deadline",a=Zf.test(r)?"Compound relative expressions like +3d+1h are not supported; use a single relative token (for example +3d) or an ISO/date string.":'Use ISO/date string input, "now", or relative +6h/-6h/+1d/-1d/+2w/-2w/+6m/-6m.';throw new h(`Invalid ${s} value "${e}". ${a}`,y.USAGE)}return new Date(i).toISOString()}(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]="f0484213-41f9-583e-bd0f-f85e507682b2")}catch{}})();function hm(e){let t;try{t=JSON.parse(e)}catch{return{info:null,warnings:["lock_info_invalid_json"]}}if(typeof t!="object"||t===null||Array.isArray(t))return{info:null,warnings:["lock_info_invalid_shape"]};let n=t,r=n.id,o=n.pid,i=n.owner,s=n.token,a=n.created_at,c=n.ttl_seconds;return typeof r!="string"||typeof o!="number"||!Number.isFinite(o)||typeof i!="string"||s!==void 0&&(typeof s!="string"||s.trim().length===0)||typeof a!="string"||typeof c!="number"||!Number.isFinite(c)?{info:null,warnings:["lock_info_invalid_shape"]}:{info:{id:r,pid:o,owner:i,...typeof s=="string"?{token:s}:{},created_at:a,ttl_seconds:c},warnings:[]}}async function Vt(e,t=!0){try{let n=await z.readFile(e,"utf8");return t&&await Qi({path:e,scope:"project"}),hm(n)}catch(n){return _e(n)?{info:null,warnings:[]}:{info:null,warnings:["lock_info_read_failed"]}}}function Y(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}async function bm(e,t,n=process.platform){if(Y(e,"EEXIST"))return!0;if(!Y(e,"EPERM")&&!Y(e,"EACCES")&&!Y(e,"EBUSY"))return!1;try{return await z.lstat(t),!0}catch(r){if(n!=="win32"||!_e(r)&&!Y(r,"EPERM")&&!Y(r,"EACCES")&&!Y(r,"EBUSY"))return!1}try{return await z.access(Wt.dirname(t),ym.W_OK),!0}catch{return!1}}async function Ts(e,t){await Ji({path:e,scope:"project",op:t})}function wm(e,t,n,r=dr()){return{id:e,pid:process.pid,owner:t,token:r,created_at:Es(),ttl_seconds:n}}async function vm(e,t,n,r,o){await z.mkdir(Wt.dirname(e),{recursive:!0});let i=await mr(e,t);if(i===null)throw Object.assign(new Error("Lock initialization is contended"),{code:"EEXIST"});try{let s=await z.open(e,"wx");try{try{await s.writeFile(`${JSON.stringify(wm(t,n,r,o),null,2)}
|
|
10
10
|
`,"utf8")}finally{await s.close()}}catch(a){throw await lr(e,"lock:release"),a}}finally{await i()}await Ts(e,"lock:create")}async function lr(e,t){try{return await z.unlink(e),await Ts(e,t),!0}catch{return!1}}async function Em(e,t,n,r){let o=Date.now(),i=Rs;for(;;){let s=await mr(e,t);if(s!==null){try{let d=await Vt(e,!1);ks(d.info,t,n,r)&&await lr(e,"lock:release")}finally{await s()}return}let a=await Vt(e,!1);if(!ks(a.info,t,n,r))return;let c=Date.now()-o;if(c>=Os)return;await Ds(Math.min(i,Os-c)),i=Math.min(i*2,ur)}}function ks(e,t,n,r){return e?.id===t&&e.pid===process.pid&&e.owner===n&&e.token===r}function Is(e,t){let n=e?.created_at?Date.parse(e.created_at):Number.NaN;return(Number.isFinite(n)?Date.now()-n:Number.POSITIVE_INFINITY)>t*1e3}function km(e){return e?.owner?` (owner ${e.owner})`:""}var Rs=25,ur=200,Om=250,Am=3,Sm=".stale-cleanup",xs="owner.json",Ns=1e4,Os=Ns+ur,Cm=60*6e4;function As(e){if(typeof e=="string"){let t=e.trim();if(!/^\d+$/.test(t))return;let n=Number(t);return Number.isSafeInteger(n)?n:void 0}if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return Math.trunc(e)}function Tm(e){let t=process.env.PM_LOCK_WAIT_MS,n=As(t);if(n!==void 0)return n;let r=As(e);return r!==void 0?r:0}function Ds(e){let t=Math.max(1,Math.round(e*(.5+Math.random())));return new Promise(n=>setTimeout(n,t))}function Ps(e,t,n){let r=n>0?` after waiting ${n}ms`:"";return new h(`Item ${e} is locked${km(t)}${r}`,y.CONFLICT,{code:"lock_conflict",recovery:{retry_after_ms:Om}})}function Im(e){if(typeof e=="function")return e;if(typeof e=="object"&&e!==null&&"release"in e){let t=e.release;return typeof t=="function"?t:null}return null}function Rm(e,t,n,r){if(!n&&r){let o=t.warnings.length>0?` (${t.warnings.join(",")})`:"";throw new h(`Item ${e} lock is stale${o}; rerun with --force when supported for this command`,y.CONFLICT)}}function xm(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!="object"||t===null||Array.isArray(t))return null;let n=t,r=n.pid,o=n.token,i=n.process_start_identity;return typeof r!="number"||!Number.isInteger(r)||r<=0||typeof o!="string"||o.length===0||i!==void 0&&(typeof i!="string"||!/^\d+$/u.test(i))?null:{pid:r,token:o,...typeof i=="string"?{process_start_identity:i}:{}}}async function Ms(e){try{return xm(await z.readFile(Wt.join(e,xs),"utf8"))}catch{return null}}function Nm(e){if(!Number.isSafeInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){return!Y(t,"ESRCH")}}function Dm(e){let t=e.lastIndexOf(")");if(t<0)return null;let n=e.slice(t+2).trim().split(/\s+/u)[19];return n!==void 0&&/^\d+$/u.test(n)?n:null}async function $s(e){try{return Dm(await z.readFile(`/proc/${e}/stat`,"utf8"))}catch{return null}}async function Pm(e=process.pid){let t=await $s(e);return{pid:e,...t===null?{}:{process_start_identity:t}}}async function Mm(e,t,n){if(!Nm(e.pid))return!1;let r=await $s(e.pid);return e.process_start_identity!==void 0&&r!==null?r===e.process_start_identity:t<=n}async function fr(e){try{return await z.rm(e,{recursive:!0,force:!0}),!0}catch{return!1}}async function Ss(e,t){let n=await Ms(e);n===null||n.token!==t||await fr(e)}async function Cs(e){try{await z.mkdir(e)}catch(n){return Y(n,"EEXIST"),null}let t={...await Pm(),token:dr()};try{await z.writeFile(Wt.join(e,xs),`${JSON.stringify(t)}
|
|
11
11
|
`,"utf8")}catch{return await fr(e),null}return t}async function $m(e){let t;try{let r=await z.stat(e);if(t=Date.now()-r.mtimeMs,t<=Ns)return!1}catch(r){return _e(r)}let n=await Ms(e);return n!==null&&await Mm(n,t,Cm)?!1:fr(e)}async function mr(e,t){let n=`${e}${Sm}`,r=await Cs(n);if(r!==null)return async()=>Ss(n,r.token);if(!await $m(n))return null;let o=await Cs(n);return o===null?null:async()=>Ss(n,o.token)}async function Lm(e){let t=await mr(e.lockPath,e.id);if(t===null)return{lockInfo:e.fallbackLockInfo,shouldRetryCreate:!1,staleRemovalCounted:!1};try{let n=await Vt(e.lockPath);if(n.info===null&&n.warnings.length===0)return{lockInfo:n,shouldRetryCreate:!0,staleRemovalCounted:!1};if(!Is(n.info,e.ttlSeconds))return{lockInfo:n,shouldRetryCreate:!1,staleRemovalCounted:!1};if(Rm(e.id,n,e.force,e.forceRequiredForStaleLock),e.staleRemovals>=Am)throw Ps(e.id,n.info,Date.now()-e.startedAtMs);return{lockInfo:n,shouldRetryCreate:await lr(e.lockPath,"lock:stale_remove"),staleRemovalCounted:!0}}finally{await t()}}async function Ls(e,t,n,r,o=!1,i=!0,s){let a=await Ut("lock_acquire",{pm_root:e,id:t,ttl_seconds:n,owner:r,force:o,force_required_for_stale_lock:i});if(a.handled){let p=Im(a.result);if(p)return async()=>{await Promise.resolve(p()),await Ut("lock_release",{pm_root:e,id:t,owner:r})}}let c=Mo(e,t),d=Tm(s),l=Date.now(),u=0,f=Rs,m=dr();for(;;)try{return await vm(c,t,r,n,m),async()=>{await Em(c,t,r,m),await Ut("lock_release",{pm_root:e,id:t,owner:r})}}catch(p){if(!await bm(p,c))throw new h(`Failed to acquire lock for ${t}: ${wo(p)}`,y.GENERIC_FAILURE);let _=await Vt(c);if(Is(_.info,n)){let w=await Lm({lockPath:c,id:t,ttlSeconds:n,force:o,forceRequiredForStaleLock:i,staleRemovals:u,waitBudgetMs:d,startedAtMs:l,fallbackLockInfo:_});if(_=w.lockInfo,w.staleRemovalCounted&&(u+=1),w.shouldRetryCreate)continue}let g=Date.now()-l;if(d===0||g>=d)throw Ps(t,_.info,d===0?0:g);await Ds(Math.min(f,d-g)),f=Math.min(f*2,ur)}}(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]="72eb01a9-e8b8-59cd-b178-3c594d3faff9")}catch{}})();var X={max_serving_rows:256,max_bytes:262144,max_event_bytes:32768,retained_byte_fraction:.5,max_events:2048,retention_days:30},I=class extends TypeError{code="context_usage_validation_failed";constructor(t){super(t),this.name="ContextUsageValidationError"}};function ve(e){let t=Date.parse(e.now??new Date().toISOString());if(!Number.isFinite(t))throw new I("Context usage now must be a valid timestamp");return{iso:new Date(t).toISOString(),ms:t}}function zs(e){let t=e.maxBytes??X.max_bytes,n=e.maxEvents??X.max_events,r=e.retentionDays??X.retention_days;if(!Number.isSafeInteger(t)||t<1024||t>X.max_bytes||!Number.isSafeInteger(n)||n<1||!Number.isFinite(r)||r<=0)throw new I("Context usage retention requires positive maxEvents and retentionDays, and maxBytes from 1024 through 262144");return{maxBytes:t,maxEvents:n,cutoff:ve(e).ms-r*864e5}}async function qs(e,t){if(!(await js(Gt.dirname(e))).isDirectory())throw new I("Context usage runtime must be a real directory");try{if((await js(e)).isSymbolicLink())throw new I("Context usage ledger must not be a symbolic link")}catch(r){if(!_e(r))throw r}let n=await Us(e,t|Ne.O_NOFOLLOW|Ne.O_NONBLOCK,384);try{let r=await n.stat();if(!r.isFile()||r.nlink!==1)throw new I("Context usage ledger must be an unshared regular file");return n}catch(r){throw await n.close(),r}}async function Kt(e){let t=zs(e);try{let n=await qs(Gt.join(e.pmRoot,"runtime","context-usage.jsonl"),Ne.O_RDONLY);try{let r=(await n.stat()).size,o=Math.max(0,r-t.maxBytes),i=Buffer.alloc(Math.min(r,t.maxBytes)),{bytesRead:s}=await n.read(i,0,i.length,o),a=i.subarray(0,s).toString("utf8");return(o>0?a.includes(`
|
|
@@ -26,5 +26,5 @@ ${a.join(`
|
|
|
26
26
|
`:`${Er(n,0)}
|
|
27
27
|
`}function nE(e){let t=es("error_format",{message:e}),n=t.handled&&typeof t.result=="string"?t.result:e;Sp(n.endsWith(`
|
|
28
28
|
`)?n:`${n}
|
|
29
|
-
`)}(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]="85bc6b10-700a-5d06-970f-d544833dd059")}catch{}})();var Rp=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 Me(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function aa(e,t){let n=e;for(let r of t.split("."))if(Array.isArray(n)){if(!/^\d+$/u.test(r))return;n=n[Number(r)]}else{if(!Me(n))return;n=n[r]}return n}function kr(e,t,n){let r=t.split("."),o=(i,s)=>{if(s===r.length)return n;let a=r[s];if(Array.isArray(i)){let d=Number(a),l=[...i];return l[d]=o(i[d],s+1),l}let c=i;return{...c,[a]:o(c[a],s+1)}};return o(e,0)}function ca(e,t,n){let r=$e(e).find(i=>i.path===t);if(!r)return e;let o=Array.isArray(r.value)?r.value.slice(n):Object.fromEntries(Object.entries(r.value).slice(n));return kr(e,t,o)}function Zt(e){let t=e.row_contract;return Me(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 xp(e){let t=e.row_contract;return Me(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):Zt(e)}function se(e){return Zt(e).flatMap(t=>{let n=aa(e,t);return Array.isArray(n)||Me(n)?[{path:t,value:n}]:[]})}function $e(e){return xp(e).flatMap(t=>{let n=aa(e,t);return Array.isArray(n)||Me(n)?[{path:t,value:n}]:[]})}function ot(e){let t=se(e),n=new Set(t.map(o=>o.path)),r=(o,i)=>{if(Array.isArray(o)){n.has(i)||t.push({path:i,value:o}),o.forEach((s,a)=>r(s,`${i}.${a}`));return}if(Me(o))for(let[s,a]of Object.entries(o))i.length===0&&Rp.has(s)||r(a,i.length===0?s:`${i}.${s}`)};return r(e,""),t}function en(e){return se(e).reduce((t,n)=>t+(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length),0)}function it(e,t){let n=e;for(let r of se(n)){let o=Array.isArray(r.value)?r.value.map((i,s)=>t(i,r.path,s)):Object.fromEntries(Object.entries(r.value).map(([i,s],a)=>[i,t(s,r.path,a)]));n=kr(n,r.path,o)}return n}function da(e,t){let n=e,r=!1;for(let o of se(n)){let i=Array.isArray(o.value)?o.value:Object.entries(o.value);if(i.length<=t)continue;r=!0;let s=Array.isArray(o.value)?i.slice(0,t):Object.fromEntries(i.slice(0,t));n=kr(n,o.path,s)}return{result:n,truncated:r}}(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]="f960f91a-c5a7-5114-b4d2-7d562a8b6fdb")}catch{}})();var Np=8,Dp=64,Pp=5,Mp=4,la=100;function ua(e,t,n){if(e!=="get"||!Or(n.item)||["fields","outputInclude","output_include","outputCursor","output_cursor"].some(d=>t[d]!==void 0)||t.full===!0||t.tree===!0||t.depth!==void 0&&t.depth!=="standard")return;let r=n.item,o=["linked","claim_state","schedule"],i=o.filter(d=>Object.hasOwn(n,d)),s=Object.fromEntries(Object.entries(n).filter(([d])=>!o.includes(d)));s.item=Object.fromEntries(Object.entries(r).filter(([d])=>d!=="body")),Object.hasOwn(r,"body")&&i.push("body");let c=[...Or(n.omission_receipt)&&Array.isArray(n.omission_receipt.omitted_field_groups)?n.omission_receipt.omitted_field_groups:[],...i.map(d=>({name:d,restore_with:`--fields ${d}`}))];return s.omission_receipt={has_omissions:c.length>0,omitted_field_group_count:c.length,omitted_field_groups:c},s}function Sr(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 r=Math.max(t+1,n),o=Math.ceil(r*Pp/Mp),i=Math.ceil(o/la)*la;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 Le(e,t,n=!1){let r=Object.getOwnPropertyDescriptor(e,"row_contract");r&&(n||r.enumerable===!1)&&Object.defineProperty(t,"row_contract",{...r,enumerable:!1})}function st(e,t){let n=t===void 0?JSON.stringify(e):sa(e,t);return Math.ceil(Buffer.byteLength(n,"utf8")/4)}function Or(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ar(e,t,n=!1){return typeof e=="string"?n||e.length<=240?e:(t.compacted=!0,`${e.slice(0,240)}\u2026`):Array.isArray(e)?e.map(r=>Ar(r,t,n)):Or(e)?Object.fromEntries(Object.entries(e).map(([r,o])=>[r,Ar(o,t,n)])):e}function ae(e,t,n){let r=t.estimated_tokens;for(let o=0;o<Np;o+=1){t.estimated_tokens=r;let i=st(e,n);if(i===r)return;r=i}t.estimated_tokens=r}function $p(e,t){return ot(e).filter(n=>(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length)>Math.max(1,t.get(n.path)??0)).map(n=>({collection:n,length:Array.isArray(n.value)?n.value.length:Object.keys(n.value).length})).sort((n,r)=>r.length-n.length||n.collection.path.localeCompare(r.collection.path))[0]?.collection}function Lp(e,t,n,r,o,i){for(let s=0;s<Dp;s+=1){if(i?.(e),ae(e,t,o),t.estimated_tokens<=n)return;let a=$p(e,r);if(!a)return;let c=Math.max(1,r.get(a.path)??0),d=Array.isArray(a.value)?[...a.value]:Object.entries(a.value),l=p=>{if(Array.isArray(a.value)){a.value.length=p;for(let _=0;_<p;_+=1)a.value[_]=d[_]}else{for(let _ of Object.keys(a.value))delete a.value[_];Object.defineProperties(a.value,Object.getOwnPropertyDescriptors(Object.fromEntries(d.slice(0,p))))}typeof e.count=="number"&&(e.count=en(e)),a.path==="items"&&(e.applied_limit=p),i?.(e),ae(e,t,o)};t.rows_compacted=!0,t.compacted_row_paths=[...new Set([...t.compacted_row_paths??[],a.path])].sort((p,_)=>p.localeCompare(_)),e.has_more=!0,e.truncated=!0;let u=c,f=d.length-1,m=c;for(;u<=f;){let p=Math.floor((u+f)/2);l(p),t.estimated_tokens<=n?(m=p,u=p+1):f=p-1}l(m)}}function fa(e,t,n,r=new Map,o,i,s=!1){let a={compacted:!1},c=Object.fromEntries(Object.entries(e).map(([d,l])=>[d,Ar(l,a,s&&d==="diff")]));return Le(e,c),t.strings_compacted=a.compacted,c.read_output=t,Lp(c,t,n,r,o,i),ae(c,t,o),c}(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]="999accf0-d4e1-5dc4-92a0-4ea7d745ac48")}catch{}})();var Cr=256,Tr=1e4,jp=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,ma=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u,Fp=new Set(["version","id","token_budget","spent_tokens","seen_item_ids"]),Up=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&jp.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=Cr,reason:`token_budget must be a safe integer of at least ${Cr}.`},{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<=Tr&&e.seen_item_ids.every(t=>typeof t=="string"&&ma.test(t)),reason:`seen_item_ids must contain at most ${Tr} portable item identifiers.`}];function nn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function tn(e){throw new h(`--output-session ${e}`,y.USAGE,{code:"invalid_read_output_session",field:"outputSession"})}function rn(e){if(e===void 0)return;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{tn("must be a valid JSON object.")}nn(t)||tn("must be a JSON object.");let n=Object.keys(t).filter(i=>!Fp.has(i));n.length>0&&tn(`contains unknown field "${n.sort()[0]}".`);let r=Up.find(i=>!i.valid(t));r!==void 0&&tn(r.reason);let o=[...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:o}}function pa(e){if(nn(e))return typeof e.id=="string"?e.id:typeof e.item_id=="string"?e.item_id:nn(e.item)&&typeof e.item.id=="string"?e.item.id:void 0}function zp(e){let t=new Set,n=0,r=se(e),o=new Set(r.map(({path:s})=>s)),i=Object.entries(e).flatMap(([s,a])=>Array.isArray(a)&&!o.has(s)?[{path:s,value:a}]:[]);for(let s of[...r,...i]){let a=Array.isArray(s.value)?s.value:Object.values(s.value);for(let c of a){if(!nn(c))continue;if(typeof c.context_ref=="string"){n+=1;continue}let d=pa(c);d!==void 0&&ma.test(d)&&t.add(d)}}return{deliveredIds:t,suppressedRepeatCount:n}}function _a(e,t){let n=new Set(t.seen_item_ids);return it(e,r=>{let o=pa(r);return o!==void 0&&n.has(o)?{id:o,context_ref:`session:${t.id}:${o}`}:r})}function Ir(e,t,n){let{deliveredIds:r,suppressedRepeatCount:o}=zp(e),i=new Set(t.seen_item_ids),s=[...r].filter(_=>!i.has(_)).sort(),a=s.slice(0,Tr-t.seen_item_ids.length),c=[...t.seen_item_ids,...a].sort(),d=s.length-a.length,l={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:r.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:c}},u={...e,read_session:l},f=_=>{l.spent_this_call_tokens=_,l.charged_this_call_tokens=Math.min(t.token_budget-t.spent_tokens,_),l.spent_total_tokens=Math.min(t.token_budget,t.spent_tokens+l.charged_this_call_tokens),l.remaining_tokens=Math.max(0,t.token_budget-l.spent_total_tokens),l.exhausted=l.remaining_tokens<Cr,l.next_state.spent_tokens=l.spent_total_tokens},m=0,p=0;for(let _=0;_<8;_+=1){f(m);let g=st(u,n);if(g===m)return u;p=Math.max(p,g),m=g}return f(p),u}function ga(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]="c649c902-db30-5a05-982e-46669ca96148")}catch{}})();var at=Symbol.for("pm.readOutputInvocationProvenance");function mE(e,t){return Reflect.set(e,at,{canonical_include_modes:[...t],explicit_legacy_aliases:[],sdk_invocation_observed:!0}),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]="72058f24-2965-5a9a-994d-e84a9af0c558")}catch{}})();var ke=["include","amount","cost","encoding"],Aa=["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"],Sa=["canonical","legacy","intent","default"],dt={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},CE=Object.freeze(ke.map(e=>dt[e])),TE=Object.freeze(["--output-session","--output-cursor","--output-row-contract"]),Ca={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:{}},Ta=new Set(["--collapse","--fields","--section"]),Nr=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 Dr(e){return e.slice(2).replaceAll("-","_")}function qp(e,t){let n=Nr[e];if(n!==void 0)return n;let r=t==="include"?Ta.has(e)?"<csv>":Dr(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${dt[t]} ${r}.`}function Bp(e){let t=Ca[e],n=Object.freeze(Object.fromEntries(ke.map(r=>[r,Object.freeze({dimension:r,canonical_option:dt[r],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[r]??[]).map(o=>Object.freeze({flag:o,semantics:Nr[o]===void 0?"replacement":"behavior_preserving",migration_hint:qp(o,r),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:Sa,budget_retention_policy:e==="assurance"?"verdict_priority":"ordered_prefix",projection_modes:Object.freeze([...Pr(e).keys()])})}var Vp=Object.freeze(Aa.map(Bp)),Wp=new Map(Vp.map(e=>[e.command,e]));function Fe(e,t={}){let n=qe(e.trim().toLowerCase()),o=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=o.startsWith("list-")?"list":o==="ctx"?"context":o;return Aa.includes(i)?i:void 0}var Gp=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],Kp={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 Hp(e){return Gp.some(t=>t!=="outputFormat"&&t!=="output_format"&&e[t]!==void 0)}var Yp=[{keys:["outputInclude","output_include"],valid:e=>ct(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||je(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>e==="unbounded"||je(e)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputSession","output_session"],valid:e=>(rn(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 IE(e,t){let n=t.outputFormat??t.output_format;if(n!==void 0&&n!=="json"&&n!=="toon")throw new h("--output-format must be toon or json.",y.USAGE);if(!Hp(t))return;let r=Fe(e,t);if(!r)throw new h(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,y.USAGE);if((Kp[r]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new h(`Universal output controls cannot be combined with a ${r} mutation.`,y.USAGE);for(let o of Yp){let i=o.keys.map(s=>t[s]).find(s=>s!==void 0);if(i!==void 0&&!o.valid(i))throw new h(o.message,y.USAGE)}}function Pr(e){let t=Fe(e);return t?new Map((Ca[t].include??[]).filter(n=>!Ta.has(n)&&Nr[n]===void 0).map(n=>[Dr(n),Ia(n)])):new Map}function Xp(e,t,n){let r=ct(t)??[],o=Pr(e),i=[],s=[],a=n,c=a[at],d=new Set(c?.canonical_include_modes??[]),l=new Set(c?.explicit_legacy_aliases??[]);for(let m of r){let p=o.get(m);if(p===void 0){i.push(m);continue}let _=`--${m.replaceAll("_","-")}`;xa(Ra(n,_))&&l.add(_),n[p]=!0,s.push(m),d.add(m)}let u=Fe(e)==="get"?i.filter(m=>m!=="item"):[],f=u.length>0;return f&&(n.fields=[...new Set([...ct(n.fields)??[],...u])].join(","),d.add("fields")),(s.length>0||f)&&(a[at]={canonical_include_modes:[...d],explicit_legacy_aliases:[...l],...c?.cli_invocation_observed===!0?{cli_invocation_observed:!0}:{}}),{selectors:i,modes:s}}function RE(e,t){let n=t.outputInclude??t.output_include;if(n===void 0)return;let{selectors:r,modes:o}=Xp(e,n,t);if(o.length===0)return;let i=r.length>0?r.join(","):void 0;t.outputInclude=i,Object.hasOwn(t,"output_include")&&(t.output_include=i)}function Ia(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}function Ra(e,t){let n=Ia(t);if(Object.hasOwn(e,n))return e[n];let r=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,r))return e[r];if(t==="--no-truncate"&&e.truncate===!1)return!0}function xa(e){return e!==void 0&&e!==!1&&e!==null}function ct(e){let n=(Array.isArray(e)?e:[e]).flatMap(r=>typeof r=="string"?r.split(","):[]).map(r=>r.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function je(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 Jp(e,t,n,r){for(let o of e.legacy_aliases){if(r(o.flag))continue;let i=Ra(t,o.flag),s={value:i,flag:o.flag};if(xa(i)&&n(s))return s}}function ya(e,t){let n=ct(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:ct(t.value)??[Dr(t.flag)]}}function ha(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=je(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 r=je(t.value);return r===void 0?void 0:{source:"legacy",value:r}}function ba(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=je(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;let r=je(t.value);return r===void 0?void 0:{source:"legacy",value:r}}function wa(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 Qp(e,t,n){if(!e)return!1;let r=new Set(e.explicit_legacy_aliases);if(e.cli_invocation_observed===!0||e.sdk_invocation_observed===!0)return!r.has(n);let o=new Set(e.canonical_include_modes.map(i=>`--${i.replaceAll("_","-")}`));return t==="include"&&o.has(n)&&!r.has(n)}function Zp(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 e_(e,t){return ke.flatMap(n=>e[n]?.source==="canonical"||n==="include"&&(t?.canonical_include_modes.length??0)>0?[dt[n]]:[])}function Na(e,t){let n=Fe(e,t);if(!n)return;let r=Wp.get(n),o=t[at],i={include:v=>ya(void 0,v),amount:v=>ha(void 0,v),cost:v=>ba(void 0,v),encoding:v=>wa(void 0,v)},s=Object.fromEntries(ke.map(v=>[v,Jp(r.dimensions[v],t,R=>i[v](R)!==void 0,R=>Qp(o,v,R))])),a=ke.flatMap(v=>{let R=s[v];return R?[R.flag]:[]}),c=ke.flatMap(v=>{let R=s[v];return R?[r.dimensions[v].legacy_aliases.find(ft=>ft.flag===R.flag).migration_hint]:[]}),d=wa(t.outputFormat??t.output_format,s.encoding),l=ya(t.outputInclude??t.output_include,s.include),u=ha(t.outputLimit??t.output_limit,s.amount),f=ba(t.outputBudget??t.output_budget,s.cost),m=Zp(e,s,o),p=fo(e,{generateFallback:!0}),_=d?.value==="json"||t.resolvedOutputFormat==="json"?"json":"toon",g=f??(m?{source:"intent",value:"unbounded"}:{source:"default",value:p.default_max_estimated_tokens_by_format[_]});return{command:n,include:l,amount:u,cost:g,encoding:d,canonical_options_used:e_({include:l,amount:u,cost:g,encoding:d},o),legacy_aliases_used:a,migration_hints:c,precedence:Sa}}function $(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Mr=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"]),t_=["collection_counts","notes_count","tests_count"];function Da(e,t){let n=new Set(t.map(r=>r.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([r])=>n.has(r)))}function n_(e){let t=$(e.item)?e.item:{},n=[...new Set([...Object.keys(t),...t_.filter(o=>Object.hasOwn(t,o))])].sort((o,i)=>o.localeCompare(i)),r=Object.keys(e).filter(o=>o!=="item"&&o!=="read_output"&&!Mr.has(o)).sort((o,i)=>o.localeCompare(i));return{item:t,itemFields:n,sections:r,valid:[...n,"item",...n.map(o=>`item.${o}`),...r]}}function r_(e,t){let n=n_(e),r=t.filter(u=>!n.valid.includes(u));if(r.length>0)throw new h(`Unknown --output-include selector(s) for get: ${r.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,y.USAGE);let o=t.includes("item"),i=t.flatMap(u=>u.startsWith("item.")?[u.slice(5)]:n.itemFields.includes(u)?[u]:[]).filter((u,f,m)=>m.indexOf(u)===f);if(o&&i.length>0)throw new h("--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])=>Mr.has(u)||s.has(u)));o?a.item=n.item:i.length>0&&(a.item=Da(n.item,i));let c=[...o?[]: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=[...$(a.omission_receipt)&&Array.isArray(a.omission_receipt.omitted_field_groups)?a.omission_receipt.omitted_field_groups:[],...c];return a.omission_receipt={has_omissions:l.length>0,omitted_field_group_count:l.length,omitted_field_groups:l},a}function va(e){let t=0;return it({...e},n=>($(n)&&Object.keys(n).length>0&&(t+=1),n)),t}function o_(e,t,n,r){if(va(t)===0||va(n)>0)return;let o=[...Pr(e).keys()],i=o.length>0?` Declared ${e} projection modes: ${o.join(", ")}.`:` The ${e} surface declares no projection modes; name row fields instead.`;throw new h(`Unknown --output-include selector(s) for ${e}: ${r.join(", ")}. No selector matched any returned row field.${i}`,y.USAGE)}function i_(e,t,n){if(e==="get")return r_(t,n);let r=Zt(t),o=n.flatMap(s=>r.flatMap(a=>s.startsWith(`${a}.`)?[s.slice(a.length+1)]:[])),i=n.some(s=>Object.hasOwn(t,s.split(".")[0])&&!r.some(a=>s.startsWith(`${a}.`)));if(r.length>0&&(!i||o.length>0)){let s={...t},a=o.length>0?o:n,c=it(s,d=>$(d)?Da(d,a):d);return o_(e,t,c,a),c}return Object.fromEntries(Object.entries(t).filter(([s])=>n.some(a=>a.split(".")[0]===s)||Mr.has(s)))}function s_(e,t){if(t==="unbounded")return e;let{result:n,truncated:r}=da(e,t);if(!r)return n;if(n.has_more=!0,n.truncated=!0,typeof n.count=="number"){let o=$(n.projection)?n.projection.row_key:void 0;n.count=typeof o=="string"&&Array.isArray(n[o])?n[o].length:en(n)}return n.applied_bound={kind:"output_limit",source:"explicit",value:t},n}function a_(e){return ke.filter(t=>e[t]!==void 0&&e[t]?.source!=="default"||e.canonical_options_used.includes(dt[t]))}function Pa(e){let t=e.resolvedOutputFormat??e.outputFormat??e.output_format??e.format;return t==="json"||t==="toon"?t:void 0}function sn(e,t,n,r){let o=Ir(e,t,r);Le(e,o);for(let i=0;i<8;i+=1){let s=n.estimated_tokens,a=o.read_session.spent_this_call_tokens;ae(o,n,r);let c=o;o=Ir(o,t,r),Le(c,o);let d=o.read_session.spent_this_call_tokens;if(n.estimated_tokens===s&&d===a)return o}return o}function _r(e,t){if(!$(e.read_output))return e;let n=Pa(t),r=e.read_output,o=rn(t.outputSession??t.output_session);return o===void 0?(ae(e,r,n),e):sn(e,o,r,n)}function c_(e,t){if(e!=="validate")return t;let n=$(t.projection)?t.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(u=>$(u)&&u.name==="diagnostic_rows"))return t;let o=[...new Set(ot(t).map(({path:u})=>u).filter(u=>/^checks\.\d+\.details\./u.test(u)))],i=o.filter(u=>!o.some(f=>f!==u&&u.startsWith(`${f}.`)));if(i.length===0)return t;let s=$(t.row_contract)?t.row_contract:{},a=Array.isArray(s.row_keys)?s.row_keys.filter(u=>typeof u=="string"):[],c=Array.isArray(s.continuation_row_keys)?s.continuation_row_keys.filter(u=>typeof u=="string"):[],d=a.length>0?a:i,l=[...new Set(i)];return JSON.stringify(d)===JSON.stringify(a)&&JSON.stringify(l)===JSON.stringify(c)?t:{...t,row_contract:{...s,row_keys:d,continuation_row_keys:l,jq_selector:typeof s.jq_selector=="string"?s.jq_selector:".checks[].details"}}}function d_(e,t,n,r){let o={...e};if(t.include?.source==="canonical"&&(o=i_(t.command,o,t.include.value)),t.command==="assurance"&&(o=ka(o)),o=Oa(o,t.command,r),t.command==="history"&&r){let i=["compact_history","provenance_history","history","diff"];if(o=Object.fromEntries(Object.entries(o).filter(([s])=>!i.includes(s)||s===r.path)),$(o.projection)&&(o.projection={...o.projection,row_key:r.path}),$(o.row_contract)){let s=o.row_contract;o.row_contract={...s,row_keys:[r.path],...Array.isArray(s.continuation_row_keys)?{continuation_row_keys:[r.path]}:{}}}o.count=Object.keys(o[r.path]).length}return t.amount?.source==="canonical"&&(o=s_(o,t.amount.value)),n===void 0?o:_a(o,n)}function l_(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:ga(t)}]].sort((r,o)=>r.tokens-o.tokens)[0]}function Ma(e){let t=e.canonical_options_used;return t&&t.length>0?{canonical_options_used:t}:{}}function u_(e,t,n,r,o,i){let s={contract_version:1,command:e.command,requested_dimensions:t,...r.source==="default"?{budget_source:r.source,budget_tokens:r.tokens}:{},precedence:e.precedence,...Ma(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:o}:{}},a={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:s},c=n===void 0?a:sn(a,n,s,i);if(n===void 0&&ae(c,s,i),n!==void 0&&s.estimated_tokens>r.tokens)throw new h("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",y.USAGE);return c}function f_(e,t){return t.outputRowContract===!0||t.output_row_contract===!0||e.canonical_options_used.includes("--output-include")||e.command==="list"&&e.canonical_options_used.length>0&&e.include?.value.includes("full")===!0}function m_(e,t,n,r,o){if(t!==void 0||f_(e,o))return!1;if(e.amount?.source==="canonical"&&e.amount.value!=="unbounded"){let i=e.amount.value;if(se(n).some(({value:s})=>(Array.isArray(s)?s.length:Object.keys(s).length)>i))return!1}return e.cost===void 0||e.cost.value==="unbounded"||e.cost.source==="legacy"||st(o.outputRowContract===!1?Object.fromEntries(Object.entries(n).filter(([i])=>i!=="row_contract")):n,r)<=e.cost.value}function p_(e,t,n,r,o,i,s){if(!n.rows_compacted)return;let a=t.amount?.value==="unbounded"?["amount"]:[],c=new Map($e(e).map(p=>[p.path,Array.isArray(p.value)?p.value.length:Object.keys(p.value).length])),d=[...s.entries()].flatMap(([p,_])=>{let g=c.get(p);if(g>=_.rows)return[];let w=_.baseOffset+g;return[{path:p,cursor:Rr({command:t.command,path:p,offset:w,total_rows:_.totalRows,fingerprint:_.fingerprint}),retained_rows:g,remaining_rows:_.totalRows-w,total_rows:_.totalRows}]}),l=d[0],u=l?"; page --output-cursor":"",f=r.source==="session"?`Truncated by the remaining ${r.tokens}-token session budget; start a new output session with a larger token_budget${u}.`:`${r.tokens}-token: raise --output-budget${u}`;n.migration_hints=[f,...t.migration_hints];let m=Sr({effective_budget_tokens:r.tokens,measured_result_tokens:i});l&&!o&&(typeof e.next_cursor!="string"||e.continuation_kind==="output_cursor")&&(e.next_cursor=l.cursor),e.continuation_kind=o?"producer_cursor":l?"output_cursor":"none",e.output_budget_truncation={reason:"output_budget_reached",budget_source:r.source,budget_tokens:r.tokens,overridden_dimensions:a,compacted_row_paths:n.compacted_row_paths,continuation_cursor_rebased:o,continuation_available:d.length>0,recovery_budget_multiplier:l?1:m.recovery_budget_multiplier,continuations:d,restore_with:l?"recovery":`Retry with --output-budget ${m.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 ${m.output_budget}`,sdk:{outputBudget:m.output_budget},mcp:{outputBudget:m.output_budget}}}}function __(e,t,n,r){if(typeof n!="string"||!Array.isArray(e.items))return!1;let o=e.items.length;if(o===0||o>=t)return!1;let i;try{i=bn(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 c=Reflect.get(a,"id");if(typeof c!="string"||c.length===0)return!1;let d=r?s-(t-o):s+o;return d<0?!1:(e.next_cursor=We(i.fingerprint,c,d,i.snapshot),!0)}function g_(e,t,n,r){let o=new Map($e(e).map(s=>{let a=Array.isArray(s.value)?s.value.length:Object.keys(s.value).length,c=n?.path===s.path;return[s.path,{rows:a,totalRows:c?n.total_rows:a,baseOffset:c?n.offset:0,fingerprint:c?n.fingerprint:on(s.path,s.value,t)}]})),i=typeof e.next_cursor=="string";return{collectionsBeforeBudget:o,originalItemCount:Array.isArray(e.items)?e.items.length:0,cursorContinuesExistingPage:i,cursorSource:i?e.next_cursor:r.after}}function y_(e,t,n,r,o,i,s,a){let c=t.command==="assurance"&&Array.isArray(e.assertions)?e.assertions.filter(l=>$(l)&&l.verdict!=="pass").length:0,d=new Map;if(c>0&&d.set("assertions",c),t.command==="history"&&Array.isArray(e.diff))for(let l of ot(e))l.path.startsWith("diff.")&&d.set(l.path,Object.keys(l.value).length);return fa(e,n,r.tokens,d,a,l=>{let u=__(l,i.originalItemCount,i.cursorSource,i.cursorContinuesExistingPage);if(p_(l,t,n,r,u,s,i.collectionsBeforeBudget),t.command==="history"&&$(l.projection)){l.has_more=typeof l.next_cursor=="string"||l.applied_bound?.kind==="output_limit";let f=l.projection.row_key;typeof f=="string"&&Array.isArray(l[f])&&(l.count=l[f].length)}o!==void 0&&Object.assign(l,sn(l,o,n,a))},t.command==="history"&&Array.isArray(e.diff))}function Ks(e,t,n){let r=Na(e,t);if(!r)return n;let o=Pa(t),i=rn(t.outputSession??t.output_session),s=t.outputCursor??t.output_cursor,a=typeof s=="string"?xr(s):void 0,c=a_(r),d=c_(r.command,n);if(a===void 0&&m_(r,i,d,o,t))return d;let l=l_(r,i),u=d_(d,r,i,a);Le(u,u,t.outputRowContract===!1);let f={contract_version:1,command:r.command,requested_dimensions:c,...l?.source==="default"?{budget_source:l.source,budget_tokens:l.tokens}:{},precedence:r.precedence,...Ma(r),legacy_aliases_used:r.legacy_aliases_used,migration_hints:r.migration_hints,estimated_tokens:0,within_budget:!0,strings_compacted:!1,rows_compacted:!1,result_omitted:!1};if(u.read_output=f,u=i===void 0?u:sn(u,i,f,o),ae(u,f,o),l!==void 0&&f.estimated_tokens>l.tokens){let m=ua(r.command,t,u);m!==void 0&&(f.applied_depth="brief",f.degradation_reason="output_budget_reached",Le(u,m),u=_r(m,t)),f.estimated_tokens>l.tokens&&(u=y_(u,r,f,l,i,g_(u,r.command,a,t),f.estimated_tokens,o))}return l!==void 0&&f.estimated_tokens>l.tokens?u_(r,c,i,l,f.estimated_tokens,o):u}function wp(e){return $(e)&&$(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function vp(e,t){let n=t.outputFormat??t.output_format;if(n==="json"||n==="toon")return n;let r=Na(e,t)?.encoding;return r?.value==="json"||r?.value==="toon"?r.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]="de370088-9285-5b33-8c7f-da8e9bb88286")}catch{}})();var b_=4096,w_=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"]),Ea=Object.freeze({health:Object.freeze({version:3,paths:Object.freeze(["checks"]),ignored_detail_field_names_by_row:Object.freeze({telemetry:w_}),guarantee:"nonvolatile_snapshot_and_stable_configuration"})});function ut(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function lt(e){return Array.isArray(e)?e.map(lt):ut(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,lt(n)])):e}function $a(e,t){if(!ut(e))return lt(e);let n=typeof e.name=="string"?e.name:void 0,r=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(([o,i])=>o!=="details"||!r||!ut(i)?[o,lt(i)]:[o,Object.fromEntries(Object.entries(i).filter(([s])=>!r.includes(s)).map(([s,a])=>[s,lt(a)]))]))}function v_(e,t){return Array.isArray(e)?e.map(n=>$a(n,t)):$a(e,t)}function on(e,t,n){let r=n?Ea[n]:void 0,o=r?.paths.includes(e)===!0;return h_("sha256").update(de({path:e,value:o?v_(t,r):t,...o?{fingerprint_policy_version:r.version}:{}})).digest("base64url").slice(0,16)}function Rr(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 xr(e){if(e.length>b_)throw new h("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(!ut(t)||t.v!==1||Fe(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 h("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 ka(e){if(!Array.isArray(e.assertions))return e;let t=n=>!ut(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,r)=>({row:n,index:r})).sort((n,r)=>t(n.row)-t(r.row)||n.index-r.index).map(({row:n})=>n),budget_retention_policy:"verdict_priority"}}function Oa(e,t,n){if(!n)return e;if(n.command!==t)throw new h(`The read-output cursor belongs to ${n.command}, not ${t}.`,y.USAGE,{code:"read_output_cursor_command_mismatch"});let r=$e(e).find(i=>i.path===n.path),o=r?Array.isArray(r.value)?r.value.length:Object.keys(r.value).length:0;if(!r||o!==n.total_rows||n.offset>o||on(n.path,r.value,t)!==n.fingerprint)throw new h("The read-output continuation no longer matches the declared row collection; restart the bounded read.",y.USAGE,{code:"read_output_cursor_stale"});return ca(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]="e216fd39-09ee-5a04-b0b5-44f518db4f93")}catch{}})();function FE(e){let t=e?.trim()??"";return/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(t)||/^(?:github|gitlab|jira|linear):/iu.test(t)}function UE(e){let t=e?.trim().toLowerCase();return t==="global"||t==="external"}export{B as a,mt as b,an as c,E_ as d,pt as e,_t as f,gt as g,yt as h,Rt as i,Qr as j,gn as k,Xc as l,Jc as m,O as n,La as o,jr as p,O_ as q,A_ as r,Fr as s,S_ as t,C_ as u,T_ as v,I_ as w,R_ as x,x_ as y,N_ as z,D_ as A,P_ as B,M_ as C,$_ as D,L_ as E,j_ as F,ja as G,F_ as H,U_ as I,z_ as J,q_ as K,B_ as L,V_ as M,W_ as N,ui as O,Ua as P,za as Q,qa as R,bt as S,Ba as T,X_ as U,Ue as V,Wa as W,Ga as X,cn as Y,J_ as Z,Q_ as _,y as $,h as aa,lu as ba,si as ca,ai as da,Ti as ea,Ii as fa,Ha as ga,Ya as ha,dn as ia,fn as ja,mn as ka,sg as la,ag as ma,cg as na,oc as oa,Br as pa,dg as qa,_o as ra,En as sa,go as ta,_e as ua,by as va,wy as wa,vy as xa,Ey as ya,kn as za,Sn as Aa,Ry as Ba,Fd as Ca,Ny as Da,Dy as Ea,Py as Fa,wo as Ga,vo as Ha,My as Ia,$y as Ja,Ly as Ka,Ao as La,Wd as Ma,Co as Na,No as Oa,Gy as Pa,Rn as Qa,rl as Ra,Ky as Sa,yl as Ta,hl as Ua,Hy as Va,Yy as Wa,oh as Xa,ih as Ya,sh as Za,Po as _a,Do as $a,ah as ab,ch as bb,dh as cb,Mo as db,lh as eb,Ot as fb,mg as gb,Pt as hb,Pn as ib,Mn as jb,$n as kb,Ln as lb,jn as mb,Fn as nb,qn as ob,ni as pb,de as qb,V as rb,kg as sb,Og as tb,Pu as ub,$u as vb,Lu as wb,Wu as xb,Hb as yb,Yb as zb,Xb as Ab,mc as Bb,pc as Cb,_c as Db,gc as Eb,pn as Fb,_g as Gb,yc as Hb,qe as Ib,At as Jb,gg as Kb,yg as Lb,hg as Mb,wg as Nb,ys as Ob,Tc as Pb,Kr as Qb,_n as Rb,xc as Sb,Nc as Tb,Ct as Ub,Yr as Vb,Pc as Wb,Lc as Xb,Rg as Yb,xg as Zb,zc as _b,qc as $b,Bc as ac,$g as bc,Lg as cc,Vc as dc,Tt as ec,jg as fc,Fg as gc,Wc as hc,Gc as ic,Kc as jc,Jr as kc,It as lc,Hc as mc,Ug as nc,zg as oc,qg as pc,Bg as qc,Vg as rc,Wg as sc,Gg as tc,tw as uc,uf as vc,Qc as wc,yn as xc,td as yc,nd as zc,aw as Ac,wf as Bc,cw as Cc,dw as Dc,lw as Ec,uw as Fc,fw as Gc,mw as Hc,pw as Ic,_w as Jc,gw as Kc,yw as Lc,Ji as Mc,hw as Nc,Qi as Oc,bw as Pc,ww as Qc,vw as Rc,Ut as Sc,as as Tc,cs as Uc,ds as Vc,Tw as Wc,us as Xc,qt as Yc,$w as Zc,Lw as _c,jw as $c,gs as ad,oy as bd,iy as cd,We as dd,bn as ed,wn as fd,sy as gd,sd as hd,ay as id,cy as jd,cd as kd,my as ld,lo as md,dd as nd,hd as od,wd as pd,uo as qd,vd as rd,Ed as sd,fo as td,me as ud,mo as vd,py as wd,_y as xd,Ea as yd,on as zd,Rr as Ad,xr as Bd,mE as Cd,ke as Dd,Aa as Ed,CE as Fd,TE as Gd,Vp as Hd,Fe as Id,IE as Jd,Pr as Kd,Xp as Ld,RE as Md,Na as Nd,_r as Od,Ks as Pd,wp as Qd,vp as Rd,Bw as Sd,Es as Td,Yw as Ud,im as Vd,Xw as Wd,xe as Xd,Jw as Yd,Qw as Zd,Pm as _d,Mm as $d,Ls as ae,X as be,I as ce,Ev as de,Yt as ee,Hm as fe,kv as ge,Ov as he,Ym as ie,Av as je,Sv as ke,Cv as le,Hs as me,Zm as ne,Lv as oe,tp as pe,Xs as qe,jv as re,Qs as se,rp as te,ap as ue,up as ve,bp as we,Sp as xe,sa as ye,nE as ze,Sr as Ae,st as Be,Tr as Ce,rn as De,_a as Ee,Ir as Fe,ga as Ge,FE as He,UE as Ie};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
`)}(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]="85bc6b10-700a-5d06-970f-d544833dd059")}catch{}})();var Rp=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 Me(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function aa(e,t){let n=e;for(let r of t.split("."))if(Array.isArray(n)){if(!/^\d+$/u.test(r))return;n=n[Number(r)]}else{if(!Me(n))return;n=n[r]}return n}function kr(e,t,n){let r=t.split("."),o=(i,s)=>{if(s===r.length)return n;let a=r[s];if(Array.isArray(i)){let d=Number(a),l=[...i];return l[d]=o(i[d],s+1),l}let c=i;return{...c,[a]:o(c[a],s+1)}};return o(e,0)}function ca(e,t,n){let r=$e(e).find(i=>i.path===t);if(!r)return e;let o=Array.isArray(r.value)?r.value.slice(n):Object.fromEntries(Object.entries(r.value).slice(n));return kr(e,t,o)}function Zt(e){let t=e.row_contract;return Me(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 xp(e){let t=e.row_contract;return Me(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):Zt(e)}function se(e){return Zt(e).flatMap(t=>{let n=aa(e,t);return Array.isArray(n)||Me(n)?[{path:t,value:n}]:[]})}function $e(e){return xp(e).flatMap(t=>{let n=aa(e,t);return Array.isArray(n)||Me(n)?[{path:t,value:n}]:[]})}function ot(e){let t=se(e),n=new Set(t.map(o=>o.path)),r=(o,i)=>{if(Array.isArray(o)){n.has(i)||t.push({path:i,value:o}),o.forEach((s,a)=>r(s,`${i}.${a}`));return}if(Me(o))for(let[s,a]of Object.entries(o))i.length===0&&Rp.has(s)||r(a,i.length===0?s:`${i}.${s}`)};return r(e,""),t}function en(e){return se(e).reduce((t,n)=>t+(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length),0)}function it(e,t){let n=e;for(let r of se(n)){let o=Array.isArray(r.value)?r.value.map((i,s)=>t(i,r.path,s)):Object.fromEntries(Object.entries(r.value).map(([i,s],a)=>[i,t(s,r.path,a)]));n=kr(n,r.path,o)}return n}function da(e,t){let n=e,r=!1;for(let o of se(n)){let i=Array.isArray(o.value)?o.value:Object.entries(o.value);if(i.length<=t)continue;r=!0;let s=Array.isArray(o.value)?i.slice(0,t):Object.fromEntries(i.slice(0,t));n=kr(n,o.path,s)}return{result:n,truncated:r}}(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]="f960f91a-c5a7-5114-b4d2-7d562a8b6fdb")}catch{}})();var Np=8,Dp=64,Pp=5,Mp=4,la=100;function ua(e,t,n){if(e!=="get"||!Or(n.item)||["fields","outputInclude","output_include","outputCursor","output_cursor"].some(d=>t[d]!==void 0)||t.full===!0||t.tree===!0||t.depth!==void 0&&t.depth!=="standard")return;let r=n.item,o=["linked","claim_state","schedule"],i=o.filter(d=>Object.hasOwn(n,d)),s=Object.fromEntries(Object.entries(n).filter(([d])=>!o.includes(d)));s.item=Object.fromEntries(Object.entries(r).filter(([d])=>d!=="body")),Object.hasOwn(r,"body")&&i.push("body");let c=[...Or(n.omission_receipt)&&Array.isArray(n.omission_receipt.omitted_field_groups)?n.omission_receipt.omitted_field_groups:[],...i.map(d=>({name:d,restore_with:`--fields ${d}`}))];return s.omission_receipt={has_omissions:c.length>0,omitted_field_group_count:c.length,omitted_field_groups:c},s}function Sr(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 r=Math.max(t+1,n),o=Math.ceil(r*Pp/Mp),i=Math.ceil(o/la)*la;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 Le(e,t,n=!1){let r=Object.getOwnPropertyDescriptor(e,"row_contract");r&&(n||r.enumerable===!1)&&Object.defineProperty(t,"row_contract",{...r,enumerable:!1})}function st(e,t){let n=t===void 0?JSON.stringify(e):sa(e,t);return Math.ceil(Buffer.byteLength(n,"utf8")/4)}function Or(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ar(e,t,n=!1){return typeof e=="string"?n||e.length<=240?e:(t.compacted=!0,`${e.slice(0,240)}\u2026`):Array.isArray(e)?e.map(r=>Ar(r,t,n)):Or(e)?Object.fromEntries(Object.entries(e).map(([r,o])=>[r,Ar(o,t,n)])):e}function ae(e,t,n){let r=t.estimated_tokens;for(let o=0;o<Np;o+=1){t.estimated_tokens=r;let i=st(e,n);if(i===r)return;r=i}t.estimated_tokens=r}function $p(e,t){return ot(e).filter(n=>(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length)>Math.max(1,t.get(n.path)??0)).map(n=>({collection:n,length:Array.isArray(n.value)?n.value.length:Object.keys(n.value).length})).sort((n,r)=>r.length-n.length||n.collection.path.localeCompare(r.collection.path))[0]?.collection}function Lp(e,t,n,r,o,i){for(let s=0;s<Dp;s+=1){if(i?.(e),ae(e,t,o),t.estimated_tokens<=n)return;let a=$p(e,r);if(!a)return;let c=Math.max(1,r.get(a.path)??0),d=Array.isArray(a.value)?[...a.value]:Object.entries(a.value),l=p=>{if(Array.isArray(a.value)){a.value.length=p;for(let _=0;_<p;_+=1)a.value[_]=d[_]}else{for(let _ of Object.keys(a.value))delete a.value[_];Object.defineProperties(a.value,Object.getOwnPropertyDescriptors(Object.fromEntries(d.slice(0,p))))}typeof e.count=="number"&&(e.count=en(e)),a.path==="items"&&(e.applied_limit=p),i?.(e),ae(e,t,o)};t.rows_compacted=!0,t.compacted_row_paths=[...new Set([...t.compacted_row_paths??[],a.path])].sort((p,_)=>p.localeCompare(_)),e.has_more=!0,e.truncated=!0;let u=c,f=d.length-1,m=c;for(;u<=f;){let p=Math.floor((u+f)/2);l(p),t.estimated_tokens<=n?(m=p,u=p+1):f=p-1}l(m)}}function fa(e,t,n,r=new Map,o,i,s=!1){let a={compacted:!1},c=Object.fromEntries(Object.entries(e).map(([d,l])=>[d,Ar(l,a,s&&d==="diff")]));return Le(e,c),t.strings_compacted=a.compacted,c.read_output=t,Lp(c,t,n,r,o,i),ae(c,t,o),c}(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]="999accf0-d4e1-5dc4-92a0-4ea7d745ac48")}catch{}})();var Cr=256,Tr=1e4,jp=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,ma=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u,Fp=new Set(["version","id","token_budget","spent_tokens","seen_item_ids"]),Up=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&jp.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=Cr,reason:`token_budget must be a safe integer of at least ${Cr}.`},{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<=Tr&&e.seen_item_ids.every(t=>typeof t=="string"&&ma.test(t)),reason:`seen_item_ids must contain at most ${Tr} portable item identifiers.`}];function nn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function tn(e){throw new h(`--output-session ${e}`,y.USAGE,{code:"invalid_read_output_session",field:"outputSession"})}function rn(e){if(e===void 0)return;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{tn("must be a valid JSON object.")}nn(t)||tn("must be a JSON object.");let n=Object.keys(t).filter(i=>!Fp.has(i));n.length>0&&tn(`contains unknown field "${n.sort()[0]}".`);let r=Up.find(i=>!i.valid(t));r!==void 0&&tn(r.reason);let o=[...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:o}}function pa(e){if(nn(e))return typeof e.id=="string"?e.id:typeof e.item_id=="string"?e.item_id:nn(e.item)&&typeof e.item.id=="string"?e.item.id:void 0}function zp(e){let t=new Set,n=0,r=se(e),o=new Set(r.map(({path:s})=>s)),i=Object.entries(e).flatMap(([s,a])=>Array.isArray(a)&&!o.has(s)?[{path:s,value:a}]:[]);for(let s of[...r,...i]){let a=Array.isArray(s.value)?s.value:Object.values(s.value);for(let c of a){if(!nn(c))continue;if(typeof c.context_ref=="string"){n+=1;continue}let d=pa(c);d!==void 0&&ma.test(d)&&t.add(d)}}return{deliveredIds:t,suppressedRepeatCount:n}}function _a(e,t){let n=new Set(t.seen_item_ids);return it(e,r=>{let o=pa(r);return o!==void 0&&n.has(o)?{id:o,context_ref:`session:${t.id}:${o}`}:r})}function Ir(e,t,n){let{deliveredIds:r,suppressedRepeatCount:o}=zp(e),i=new Set(t.seen_item_ids),s=[...r].filter(_=>!i.has(_)).sort(),a=s.slice(0,Tr-t.seen_item_ids.length),c=[...t.seen_item_ids,...a].sort(),d=s.length-a.length,l={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:r.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:c}},u={...e,read_session:l},f=_=>{l.spent_this_call_tokens=_,l.charged_this_call_tokens=Math.min(t.token_budget-t.spent_tokens,_),l.spent_total_tokens=Math.min(t.token_budget,t.spent_tokens+l.charged_this_call_tokens),l.remaining_tokens=Math.max(0,t.token_budget-l.spent_total_tokens),l.exhausted=l.remaining_tokens<Cr,l.next_state.spent_tokens=l.spent_total_tokens},m=0,p=0;for(let _=0;_<8;_+=1){f(m);let g=st(u,n);if(g===m)return u;p=Math.max(p,g),m=g}return f(p),u}function ga(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]="c649c902-db30-5a05-982e-46669ca96148")}catch{}})();var at=Symbol.for("pm.readOutputInvocationProvenance");function mE(e,t){return Reflect.set(e,at,{canonical_include_modes:[...t],explicit_legacy_aliases:[],sdk_invocation_observed:!0}),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]="72058f24-2965-5a9a-994d-e84a9af0c558")}catch{}})();var ke=["include","amount","cost","encoding"],Aa=["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"],Sa=["canonical","legacy","intent","default"],dt={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},CE=Object.freeze(ke.map(e=>dt[e])),TE=Object.freeze(["--output-session","--output-cursor","--output-row-contract"]),Ca={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:{}},Ta=new Set(["--collapse","--fields","--section"]),Nr=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 Dr(e){return e.slice(2).replaceAll("-","_")}function qp(e,t){let n=Nr[e];if(n!==void 0)return n;let r=t==="include"?Ta.has(e)?"<csv>":Dr(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${dt[t]} ${r}.`}function Bp(e){let t=Ca[e],n=Object.freeze(Object.fromEntries(ke.map(r=>[r,Object.freeze({dimension:r,canonical_option:dt[r],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[r]??[]).map(o=>Object.freeze({flag:o,semantics:Nr[o]===void 0?"replacement":"behavior_preserving",migration_hint:qp(o,r),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:Sa,budget_retention_policy:e==="assurance"?"verdict_priority":"ordered_prefix",projection_modes:Object.freeze([...Pr(e).keys()])})}var Vp=Object.freeze(Aa.map(Bp)),Wp=new Map(Vp.map(e=>[e.command,e]));function Fe(e,t={}){let n=qe(e.trim().toLowerCase()),o=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=o.startsWith("list-")?"list":o==="ctx"?"context":o;return Aa.includes(i)?i:void 0}var Gp=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],Kp={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 Hp(e){return Gp.some(t=>t!=="outputFormat"&&t!=="output_format"&&e[t]!==void 0)}var Yp=[{keys:["outputInclude","output_include"],valid:e=>ct(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||je(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>e==="unbounded"||je(e)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputSession","output_session"],valid:e=>(rn(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 IE(e,t){let n=t.outputFormat??t.output_format;if(n!==void 0&&n!=="json"&&n!=="toon")throw new h("--output-format must be toon or json.",y.USAGE);if(!Hp(t))return;let r=Fe(e,t);if(!r)throw new h(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,y.USAGE);if((Kp[r]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new h(`Universal output controls cannot be combined with a ${r} mutation.`,y.USAGE);for(let o of Yp){let i=o.keys.map(s=>t[s]).find(s=>s!==void 0);if(i!==void 0&&!o.valid(i))throw new h(o.message,y.USAGE)}}function Pr(e){let t=Fe(e);return t?new Map((Ca[t].include??[]).filter(n=>!Ta.has(n)&&Nr[n]===void 0).map(n=>[Dr(n),Ia(n)])):new Map}function Xp(e,t,n){let r=ct(t)??[],o=Pr(e),i=[],s=[],a=n,c=a[at],d=new Set(c?.canonical_include_modes??[]),l=new Set(c?.explicit_legacy_aliases??[]);for(let m of r){let p=o.get(m);if(p===void 0){i.push(m);continue}let _=`--${m.replaceAll("_","-")}`;xa(Ra(n,_))&&l.add(_),n[p]=!0,s.push(m),d.add(m)}let u=Fe(e)==="get"?i.filter(m=>m!=="item"):[],f=u.length>0;return f&&(n.fields=[...new Set([...ct(n.fields)??[],...u])].join(","),d.add("fields")),(s.length>0||f)&&(a[at]={canonical_include_modes:[...d],explicit_legacy_aliases:[...l],...c?.cli_invocation_observed===!0?{cli_invocation_observed:!0}:{}}),{selectors:i,modes:s}}function RE(e,t){let n=t.outputInclude??t.output_include;if(n===void 0)return;let{selectors:r,modes:o}=Xp(e,n,t);if(o.length===0)return;let i=r.length>0?r.join(","):void 0;t.outputInclude=i,Object.hasOwn(t,"output_include")&&(t.output_include=i)}function Ia(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}function Ra(e,t){let n=Ia(t);if(Object.hasOwn(e,n))return e[n];let r=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,r))return e[r];if(t==="--no-truncate"&&e.truncate===!1)return!0}function xa(e){return e!==void 0&&e!==!1&&e!==null}function ct(e){let n=(Array.isArray(e)?e:[e]).flatMap(r=>typeof r=="string"?r.split(","):[]).map(r=>r.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function je(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 Jp(e,t,n,r){for(let o of e.legacy_aliases){if(r(o.flag))continue;let i=Ra(t,o.flag),s={value:i,flag:o.flag};if(xa(i)&&n(s))return s}}function ya(e,t){let n=ct(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:ct(t.value)??[Dr(t.flag)]}}function ha(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=je(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 r=je(t.value);return r===void 0?void 0:{source:"legacy",value:r}}function ba(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=je(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;let r=je(t.value);return r===void 0?void 0:{source:"legacy",value:r}}function wa(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 Qp(e,t,n){if(!e)return!1;let r=new Set(e.explicit_legacy_aliases);if(e.cli_invocation_observed===!0||e.sdk_invocation_observed===!0)return!r.has(n);let o=new Set(e.canonical_include_modes.map(i=>`--${i.replaceAll("_","-")}`));return t==="include"&&o.has(n)&&!r.has(n)}function Zp(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 e_(e,t){return ke.flatMap(n=>e[n]?.source==="canonical"||n==="include"&&(t?.canonical_include_modes.length??0)>0?[dt[n]]:[])}function Na(e,t){let n=Fe(e,t);if(!n)return;let r=Wp.get(n),o=t[at],i={include:v=>ya(void 0,v),amount:v=>ha(void 0,v),cost:v=>ba(void 0,v),encoding:v=>wa(void 0,v)},s=Object.fromEntries(ke.map(v=>[v,Jp(r.dimensions[v],t,R=>i[v](R)!==void 0,R=>Qp(o,v,R))])),a=ke.flatMap(v=>{let R=s[v];return R?[R.flag]:[]}),c=ke.flatMap(v=>{let R=s[v];return R?[r.dimensions[v].legacy_aliases.find(ft=>ft.flag===R.flag).migration_hint]:[]}),d=wa(t.outputFormat??t.output_format,s.encoding),l=ya(t.outputInclude??t.output_include,s.include),u=ha(t.outputLimit??t.output_limit,s.amount),f=ba(t.outputBudget??t.output_budget,s.cost),m=Zp(e,s,o),p=fo(e,{generateFallback:!0}),_=d?.value==="json"||t.resolvedOutputFormat==="json"?"json":"toon",g=f??(m?{source:"intent",value:"unbounded"}:{source:"default",value:p.default_max_estimated_tokens_by_format[_]});return{command:n,include:l,amount:u,cost:g,encoding:d,canonical_options_used:e_({include:l,amount:u,cost:g,encoding:d},o),legacy_aliases_used:a,migration_hints:c,precedence:Sa}}function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Mr=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"]),t_=["collection_counts","notes_count","tests_count"];function Da(e,t){let n=new Set(t.map(r=>r.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([r])=>n.has(r)))}function n_(e){let t=L(e.item)?e.item:{},n=[...new Set([...Object.keys(t),...t_.filter(o=>Object.hasOwn(t,o))])].sort((o,i)=>o.localeCompare(i)),r=Object.keys(e).filter(o=>o!=="item"&&o!=="read_output"&&!Mr.has(o)).sort((o,i)=>o.localeCompare(i));return{item:t,itemFields:n,sections:r,valid:[...n,"item",...n.map(o=>`item.${o}`),...r]}}function r_(e,t){let n=n_(e),r=t.filter(u=>!n.valid.includes(u));if(r.length>0)throw new h(`Unknown --output-include selector(s) for get: ${r.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,y.USAGE);let o=t.includes("item"),i=t.flatMap(u=>u.startsWith("item.")?[u.slice(5)]:n.itemFields.includes(u)?[u]:[]).filter((u,f,m)=>m.indexOf(u)===f);if(o&&i.length>0)throw new h("--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])=>Mr.has(u)||s.has(u)));o?a.item=n.item:i.length>0&&(a.item=Da(n.item,i));let c=[...o?[]: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=[...L(a.omission_receipt)&&Array.isArray(a.omission_receipt.omitted_field_groups)?a.omission_receipt.omitted_field_groups:[],...c];return a.omission_receipt={has_omissions:l.length>0,omitted_field_group_count:l.length,omitted_field_groups:l},a}function va(e){let t=0;return it({...e},n=>(L(n)&&Object.keys(n).length>0&&(t+=1),n)),t}function o_(e,t,n,r){if(va(t)===0||va(n)>0)return;let o=[...Pr(e).keys()],i=o.length>0?` Declared ${e} projection modes: ${o.join(", ")}.`:` The ${e} surface declares no projection modes; name row fields instead.`;throw new h(`Unknown --output-include selector(s) for ${e}: ${r.join(", ")}. No selector matched any returned row field.${i}`,y.USAGE)}function i_(e,t,n){if(e==="get")return r_(t,n);let r=Zt(t),o=n.flatMap(s=>r.flatMap(a=>s.startsWith(`${a}.`)?[s.slice(a.length+1)]:[])),i=n.some(s=>Object.hasOwn(t,s.split(".")[0])&&!r.some(a=>s.startsWith(`${a}.`)));if(r.length>0&&(!i||o.length>0)){let s={...t},a=o.length>0?o:n,c=it(s,d=>L(d)?Da(d,a):d);return o_(e,t,c,a),c}return Object.fromEntries(Object.entries(t).filter(([s])=>n.some(a=>a.split(".")[0]===s)||Mr.has(s)))}function s_(e,t){if(t==="unbounded")return e;let{result:n,truncated:r}=da(e,t);if(!r)return n;if(n.has_more=!0,n.truncated=!0,typeof n.count=="number"){let o=L(n.projection)?n.projection.row_key:void 0;n.count=typeof o=="string"&&Array.isArray(n[o])?n[o].length:en(n)}return n.applied_bound={kind:"output_limit",source:"explicit",value:t},n}function a_(e){return ke.filter(t=>e[t]!==void 0&&e[t]?.source!=="default"||e.canonical_options_used.includes(dt[t]))}function Pa(e){let t=e.resolvedOutputFormat??e.outputFormat??e.output_format??e.format;return t==="json"||t==="toon"?t:void 0}function sn(e,t,n,r){let o=Ir(e,t,r);Le(e,o);for(let i=0;i<8;i+=1){let s=n.estimated_tokens,a=o.read_session.spent_this_call_tokens;ae(o,n,r);let c=o;o=Ir(o,t,r),Le(c,o);let d=o.read_session.spent_this_call_tokens;if(n.estimated_tokens===s&&d===a)return o}return o}function _r(e,t){if(!L(e.read_output))return e;let n=Pa(t),r=e.read_output,o=rn(t.outputSession??t.output_session);return o===void 0?(ae(e,r,n),e):sn(e,o,r,n)}function c_(e,t){if(e!=="validate")return t;let n=L(t.projection)?t.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(u=>L(u)&&u.name==="diagnostic_rows"))return t;let o=[...new Set(ot(t).map(({path:u})=>u).filter(u=>/^checks\.\d+\.details\./u.test(u)))],i=o.filter(u=>!o.some(f=>f!==u&&u.startsWith(`${f}.`)));if(i.length===0)return t;let s=L(t.row_contract)?t.row_contract:{},a=Array.isArray(s.row_keys)?s.row_keys.filter(u=>typeof u=="string"):[],c=Array.isArray(s.continuation_row_keys)?s.continuation_row_keys.filter(u=>typeof u=="string"):[],d=a.length>0?a:i,l=[...new Set(i)];return JSON.stringify(d)===JSON.stringify(a)&&JSON.stringify(l)===JSON.stringify(c)?t:{...t,row_contract:{...s,row_keys:d,continuation_row_keys:l,jq_selector:typeof s.jq_selector=="string"?s.jq_selector:".checks[].details"}}}function d_(e,t,n,r){let o={...e};if(t.include?.source==="canonical"&&(o=i_(t.command,o,t.include.value)),t.command==="assurance"&&(o=ka(o)),o=Oa(o,t.command,r),t.command==="history"&&r){let i=["compact_history","provenance_history","history","diff"];if(o=Object.fromEntries(Object.entries(o).filter(([s])=>!i.includes(s)||s===r.path)),L(o.projection)&&(o.projection={...o.projection,row_key:r.path}),L(o.row_contract)){let s=o.row_contract;o.row_contract={...s,row_keys:[r.path],...Array.isArray(s.continuation_row_keys)?{continuation_row_keys:[r.path]}:{}}}o.count=Object.keys(o[r.path]).length}return t.amount?.source==="canonical"&&(o=s_(o,t.amount.value)),n===void 0?o:_a(o,n)}function l_(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:ga(t)}]].sort((r,o)=>r.tokens-o.tokens)[0]}function Ma(e){let t=e.canonical_options_used;return t&&t.length>0?{canonical_options_used:t}:{}}function u_(e,t,n,r,o,i){let s={contract_version:1,command:e.command,requested_dimensions:t,...r.source==="default"?{budget_source:r.source,budget_tokens:r.tokens}:{},precedence:e.precedence,...Ma(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:o}:{}},a={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:s},c=n===void 0?a:sn(a,n,s,i);if(n===void 0&&ae(c,s,i),n!==void 0&&s.estimated_tokens>r.tokens)throw new h("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",y.USAGE);return c}function f_(e,t){return t.outputRowContract===!0||t.output_row_contract===!0||e.canonical_options_used.includes("--output-include")||e.command==="list"&&e.canonical_options_used.length>0&&e.include?.value.includes("full")===!0}function m_(e,t,n,r,o){if(t!==void 0||f_(e,o))return!1;if(e.amount?.source==="canonical"&&e.amount.value!=="unbounded"){let i=e.amount.value;if(se(n).some(({value:s})=>(Array.isArray(s)?s.length:Object.keys(s).length)>i))return!1}return e.cost===void 0||e.cost.value==="unbounded"||e.cost.source==="legacy"||st(o.outputRowContract===!1?Object.fromEntries(Object.entries(n).filter(([i])=>i!=="row_contract")):n,r)<=e.cost.value}function p_(e,t,n,r,o,i,s){if(!n.rows_compacted)return;let a=t.amount?.value==="unbounded"?["amount"]:[],c=new Map($e(e).map(p=>[p.path,Array.isArray(p.value)?p.value.length:Object.keys(p.value).length])),d=[...s.entries()].flatMap(([p,_])=>{let g=c.get(p);if(g>=_.rows)return[];let w=_.baseOffset+g;return[{path:p,cursor:Rr({command:t.command,path:p,offset:w,total_rows:_.totalRows,fingerprint:_.fingerprint}),retained_rows:g,remaining_rows:_.totalRows-w,total_rows:_.totalRows}]}),l=d[0],u=l?"; page --output-cursor":"",f=r.source==="session"?`Truncated by the remaining ${r.tokens}-token session budget; start a new output session with a larger token_budget${u}.`:`${r.tokens}-token: raise --output-budget${u}`;n.migration_hints=[f,...t.migration_hints];let m=Sr({effective_budget_tokens:r.tokens,measured_result_tokens:i});l&&!o&&(typeof e.next_cursor!="string"||e.continuation_kind==="output_cursor")&&(e.next_cursor=l.cursor),e.continuation_kind=o?"producer_cursor":l?"output_cursor":"none",e.output_budget_truncation={reason:"output_budget_reached",budget_source:r.source,budget_tokens:r.tokens,overridden_dimensions:a,compacted_row_paths:n.compacted_row_paths,continuation_cursor_rebased:o,continuation_available:d.length>0,recovery_budget_multiplier:l?1:m.recovery_budget_multiplier,continuations:d,restore_with:l?"recovery":`Retry with --output-budget ${m.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 ${m.output_budget}`,sdk:{outputBudget:m.output_budget},mcp:{outputBudget:m.output_budget}}}}function __(e,t,n,r){if(typeof n!="string"||!Array.isArray(e.items))return!1;let o=e.items.length;if(o===0||o>=t)return!1;let i;try{i=bn(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 c=Reflect.get(a,"id");if(typeof c!="string"||c.length===0)return!1;let d=r?s-(t-o):s+o;return d<0?!1:(e.next_cursor=We(i.fingerprint,c,d,i.snapshot),!0)}function g_(e,t,n,r){let o=new Map($e(e).map(s=>{let a=Array.isArray(s.value)?s.value.length:Object.keys(s.value).length,c=n?.path===s.path;return[s.path,{rows:a,totalRows:c?n.total_rows:a,baseOffset:c?n.offset:0,fingerprint:c?n.fingerprint:on(s.path,s.value,t)}]})),i=typeof e.next_cursor=="string";return{collectionsBeforeBudget:o,originalItemCount:Array.isArray(e.items)?e.items.length:0,cursorContinuesExistingPage:i,cursorSource:i?e.next_cursor:r.after}}function y_(e,t,n,r,o,i,s,a){let c=t.command==="assurance"&&Array.isArray(e.assertions)?e.assertions.filter(l=>L(l)&&l.verdict!=="pass").length:0,d=new Map;if(c>0&&d.set("assertions",c),t.command==="history"&&Array.isArray(e.diff))for(let l of ot(e))l.path.startsWith("diff.")&&d.set(l.path,Object.keys(l.value).length);return fa(e,n,r.tokens,d,a,l=>{let u=__(l,i.originalItemCount,i.cursorSource,i.cursorContinuesExistingPage);if(p_(l,t,n,r,u,s,i.collectionsBeforeBudget),t.command==="history"&&L(l.projection)){l.has_more=typeof l.next_cursor=="string"||l.applied_bound?.kind==="output_limit";let f=l.projection.row_key;typeof f=="string"&&Array.isArray(l[f])&&(l.count=l[f].length)}o!==void 0&&Object.assign(l,sn(l,o,n,a))},t.command==="history"&&Array.isArray(e.diff))}function Ks(e,t,n){let r=Na(e,t);if(!r)return n;let o=Pa(t),i=rn(t.outputSession??t.output_session),s=t.outputCursor??t.output_cursor,a=typeof s=="string"?xr(s):void 0,c=a_(r),d=c_(r.command,n);if(a===void 0&&m_(r,i,d,o,t))return d;let l=l_(r,i),u=d_(d,r,i,a);Le(u,u,t.outputRowContract===!1);let f={contract_version:1,command:r.command,requested_dimensions:c,...l?.source==="default"?{budget_source:l.source,budget_tokens:l.tokens}:{},precedence:r.precedence,...Ma(r),legacy_aliases_used:r.legacy_aliases_used,migration_hints:r.migration_hints,estimated_tokens:0,within_budget:!0,strings_compacted:!1,rows_compacted:!1,result_omitted:!1};if(u.read_output=f,u=i===void 0?u:sn(u,i,f,o),ae(u,f,o),l!==void 0&&f.estimated_tokens>l.tokens){let m=ua(r.command,t,u);m!==void 0&&(f.applied_depth="brief",f.degradation_reason="output_budget_reached",Le(u,m),u=_r(m,t)),f.estimated_tokens>l.tokens&&(u=y_(u,r,f,l,i,g_(u,r.command,a,t),f.estimated_tokens,o))}return l!==void 0&&f.estimated_tokens>l.tokens?u_(r,c,i,l,f.estimated_tokens,o):u}function wp(e){return L(e)&&L(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function vp(e,t){let n=t.outputFormat??t.output_format;if(n==="json"||n==="toon")return n;let r=Na(e,t)?.encoding;return r?.value==="json"||r?.value==="toon"?r.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]="de370088-9285-5b33-8c7f-da8e9bb88286")}catch{}})();var b_=4096,w_=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"]),Ea=Object.freeze({health:Object.freeze({version:3,paths:Object.freeze(["checks"]),ignored_detail_field_names_by_row:Object.freeze({telemetry:w_}),guarantee:"nonvolatile_snapshot_and_stable_configuration"})});function ut(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function lt(e){return Array.isArray(e)?e.map(lt):ut(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,lt(n)])):e}function $a(e,t){if(!ut(e))return lt(e);let n=typeof e.name=="string"?e.name:void 0,r=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(([o,i])=>o!=="details"||!r||!ut(i)?[o,lt(i)]:[o,Object.fromEntries(Object.entries(i).filter(([s])=>!r.includes(s)).map(([s,a])=>[s,lt(a)]))]))}function v_(e,t){return Array.isArray(e)?e.map(n=>$a(n,t)):$a(e,t)}function on(e,t,n){let r=n?Ea[n]:void 0,o=r?.paths.includes(e)===!0;return h_("sha256").update(de({path:e,value:o?v_(t,r):t,...o?{fingerprint_policy_version:r.version}:{}})).digest("base64url").slice(0,16)}function Rr(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 xr(e){if(e.length>b_)throw new h("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(!ut(t)||t.v!==1||Fe(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 h("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 ka(e){if(!Array.isArray(e.assertions))return e;let t=n=>!ut(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,r)=>({row:n,index:r})).sort((n,r)=>t(n.row)-t(r.row)||n.index-r.index).map(({row:n})=>n),budget_retention_policy:"verdict_priority"}}function Oa(e,t,n){if(!n)return e;if(n.command!==t)throw new h(`The read-output cursor belongs to ${n.command}, not ${t}.`,y.USAGE,{code:"read_output_cursor_command_mismatch"});let r=$e(e).find(i=>i.path===n.path),o=r?Array.isArray(r.value)?r.value.length:Object.keys(r.value).length:0;if(!r||o!==n.total_rows||n.offset>o||on(n.path,r.value,t)!==n.fingerprint)throw new h("The read-output continuation no longer matches the declared row collection; restart the bounded read.",y.USAGE,{code:"read_output_cursor_stale"});return ca(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]="e216fd39-09ee-5a04-b0b5-44f518db4f93")}catch{}})();function FE(e){let t=e?.trim()??"";return/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(t)||/^(?:github|gitlab|jira|linear):/iu.test(t)}function UE(e){let t=e?.trim().toLowerCase();return t==="global"||t==="external"}export{B as a,mt as b,an as c,E_ as d,pt as e,_t as f,gt as g,yt as h,Rt as i,Qr as j,gn as k,Xc as l,Jc as m,O as n,La as o,jr as p,O_ as q,A_ as r,Fr as s,S_ as t,C_ as u,T_ as v,I_ as w,R_ as x,x_ as y,N_ as z,D_ as A,P_ as B,M_ as C,$_ as D,L_ as E,j_ as F,ja as G,F_ as H,U_ as I,z_ as J,q_ as K,B_ as L,V_ as M,W_ as N,ui as O,Ua as P,za as Q,qa as R,bt as S,Ba as T,X_ as U,Ue as V,Wa as W,Ga as X,cn as Y,J_ as Z,Q_ as _,y as $,h as aa,lu as ba,si as ca,ai as da,Ti as ea,Ii as fa,Ha as ga,Ya as ha,dn as ia,fn as ja,mn as ka,sg as la,ag as ma,cg as na,oc as oa,Br as pa,dg as qa,_o as ra,En as sa,go as ta,_e as ua,by as va,wy as wa,vy as xa,Ey as ya,kn as za,Sn as Aa,Ry as Ba,Fd as Ca,Ny as Da,Dy as Ea,Py as Fa,wo as Ga,vo as Ha,My as Ia,$y as Ja,Ly as Ka,Ao as La,Wd as Ma,Co as Na,No as Oa,Gy as Pa,Rn as Qa,rl as Ra,Ky as Sa,yl as Ta,hl as Ua,Hy as Va,Yy as Wa,oh as Xa,ih as Ya,sh as Za,Po as _a,Do as $a,ah as ab,ch as bb,dh as cb,Mo as db,lh as eb,Ot as fb,mg as gb,Pt as hb,Pn as ib,Mn as jb,$n as kb,Ln as lb,jn as mb,Fn as nb,qn as ob,ni as pb,de as qb,V as rb,kg as sb,Og as tb,Pu as ub,$u as vb,Lu as wb,Wu as xb,Hb as yb,Yb as zb,Xb as Ab,mc as Bb,pc as Cb,_c as Db,gc as Eb,pn as Fb,_g as Gb,yc as Hb,qe as Ib,At as Jb,gg as Kb,yg as Lb,hg as Mb,wg as Nb,ys as Ob,Tc as Pb,Kr as Qb,_n as Rb,xc as Sb,Nc as Tb,Ct as Ub,Yr as Vb,Pc as Wb,Lc as Xb,Rg as Yb,xg as Zb,zc as _b,qc as $b,Bc as ac,$g as bc,Lg as cc,Vc as dc,Tt as ec,jg as fc,Fg as gc,Wc as hc,Gc as ic,Kc as jc,Jr as kc,It as lc,Hc as mc,Ug as nc,zg as oc,qg as pc,Bg as qc,Vg as rc,Wg as sc,Gg as tc,tw as uc,uf as vc,Qc as wc,yn as xc,td as yc,nd as zc,aw as Ac,wf as Bc,cw as Cc,dw as Dc,lw as Ec,uw as Fc,fw as Gc,mw as Hc,pw as Ic,_w as Jc,gw as Kc,yw as Lc,Ji as Mc,hw as Nc,Qi as Oc,bw as Pc,ww as Qc,vw as Rc,Ut as Sc,as as Tc,cs as Uc,ds as Vc,Tw as Wc,us as Xc,qt as Yc,$w as Zc,Lw as _c,jw as $c,gs as ad,oy as bd,iy as cd,We as dd,bn as ed,wn as fd,sy as gd,sd as hd,ay as id,cy as jd,cd as kd,my as ld,lo as md,dd as nd,hd as od,wd as pd,uo as qd,vd as rd,Ed as sd,fo as td,me as ud,mo as vd,py as wd,_y as xd,Ea as yd,on as zd,Rr as Ad,xr as Bd,mE as Cd,ke as Dd,Aa as Ed,CE as Fd,TE as Gd,Vp as Hd,Fe as Id,IE as Jd,Pr as Kd,Xp as Ld,RE as Md,Na as Nd,_r as Od,Ks as Pd,wp as Qd,vp as Rd,Bw as Sd,Es as Td,Yw as Ud,im as Vd,Xw as Wd,xe as Xd,Jw as Yd,Qw as Zd,Pm as _d,Mm as $d,Ls as ae,X as be,I as ce,Ev as de,Yt as ee,Hm as fe,kv as ge,Ov as he,Ym as ie,Av as je,Sv as ke,Cv as le,Hs as me,Zm as ne,Lv as oe,tp as pe,Xs as qe,jv as re,Qs as se,rp as te,ap as ue,up as ve,bp as we,Sp as xe,sa as ye,nE as ze,Sr as Ae,st as Be,Tr as Ce,rn as De,_a as Ee,Ir as Fe,ga as Ge,FE as He,UE as Ie};
|
|
30
|
+
//# sourceMappingURL=chunk-MRH4A542.js.map
|