@unbrained/pm-cli 2026.9.21 → 2026.9.22
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +21 -1
- package/dist/cli/commander-usage.d.ts +5 -1
- package/dist/cli/commander-usage.js +2 -2
- package/dist/cli/commands/annotations/comments.d.ts +2 -0
- package/dist/cli/commands/{comments.js → annotations/comments.js} +1 -1
- package/dist/cli/commands/{docs.d.ts → annotations/docs.d.ts} +2 -2
- package/dist/cli/commands/{docs.js → annotations/docs.js} +1 -1
- package/dist/cli/commands/{files.d.ts → annotations/files.d.ts} +2 -2
- package/dist/cli/commands/{files.js → annotations/files.js} +1 -1
- package/dist/cli/commands/annotations/learnings.d.ts +2 -0
- package/dist/cli/commands/{learnings.js → annotations/learnings.js} +1 -1
- package/dist/cli/commands/annotations/notes.d.ts +2 -0
- package/dist/cli/commands/{notes.js → annotations/notes.js} +1 -1
- package/dist/cli/commands/extension/extension.d.ts +6 -0
- package/dist/cli/commands/{extension.js → extension/extension.js} +1 -1
- package/dist/cli/commands/{gc.d.ts → governance/gc.d.ts} +2 -2
- package/dist/cli/commands/{gc.js → governance/gc.js} +1 -1
- package/dist/cli/commands/governance/health.d.ts +6 -0
- package/dist/cli/commands/{deps.js → governance/health.js} +2 -2
- package/dist/cli/commands/governance/telemetry.d.ts +6 -0
- package/dist/cli/commands/{telemetry.js → governance/telemetry.js} +1 -1
- package/dist/cli/commands/governance/validate.d.ts +9 -0
- package/dist/cli/commands/governance/validate.js +2 -0
- package/dist/cli/commands/history/activity.d.ts +6 -0
- package/dist/cli/commands/{activity.js → history/activity.js} +1 -1
- package/dist/cli/commands/history/history-compact.d.ts +7 -0
- package/dist/cli/commands/{history-compact.js → history/history-compact.js} +1 -1
- package/dist/cli/commands/{history-redact.d.ts → history/history-redact.d.ts} +2 -2
- package/dist/cli/commands/history/history-redact.js +2 -0
- package/dist/cli/commands/{history-repair.d.ts → history/history-repair.d.ts} +2 -2
- package/dist/cli/commands/{history-repair.js → history/history-repair.js} +1 -1
- package/dist/cli/commands/history/history.d.ts +2 -0
- package/dist/cli/commands/{history.js → history/history.js} +1 -1
- package/dist/cli/commands/history/restore.d.ts +6 -0
- package/dist/cli/commands/history/restore.js +2 -0
- package/dist/cli/commands/lifecycle/append.d.ts +2 -0
- package/dist/cli/commands/{append.js → lifecycle/append.js} +1 -1
- package/dist/cli/commands/lifecycle/claim.d.ts +2 -0
- package/dist/cli/commands/{claim.js → lifecycle/claim.js} +1 -1
- package/dist/cli/commands/lifecycle/close-many.d.ts +2 -0
- package/dist/cli/commands/{close-many.js → lifecycle/close-many.js} +1 -1
- package/dist/cli/commands/lifecycle/close.d.ts +6 -0
- package/dist/cli/commands/lifecycle/close.js +2 -0
- package/dist/cli/commands/lifecycle/copy.d.ts +6 -0
- package/dist/cli/commands/lifecycle/copy.js +2 -0
- package/dist/cli/commands/lifecycle/create.d.ts +6 -0
- package/dist/cli/commands/{create.js → lifecycle/create.js} +1 -1
- package/dist/cli/commands/lifecycle/delete.d.ts +6 -0
- package/dist/cli/commands/{delete.js → lifecycle/delete.js} +1 -1
- package/dist/cli/commands/lifecycle/focus.d.ts +6 -0
- package/dist/cli/commands/lifecycle/focus.js +2 -0
- package/dist/cli/commands/lifecycle/plan.d.ts +6 -0
- package/dist/cli/commands/{plan.js → lifecycle/plan.js} +1 -1
- package/dist/cli/commands/lifecycle/update-many.d.ts +2 -0
- package/dist/cli/commands/lifecycle/update-many.js +2 -0
- package/dist/cli/commands/lifecycle/update.d.ts +6 -0
- package/dist/cli/commands/{copy.js → lifecycle/update.js} +2 -2
- package/dist/cli/commands/query/aggregate.d.ts +2 -0
- package/dist/cli/commands/{aggregate.js → query/aggregate.js} +1 -1
- package/dist/cli/commands/query/context.d.ts +6 -0
- package/dist/cli/commands/{focus.js → query/context.js} +2 -2
- package/dist/cli/commands/{deps.d.ts → query/deps.d.ts} +2 -2
- package/dist/cli/commands/query/deps.js +2 -0
- package/dist/cli/commands/query/duplicates.d.ts +6 -0
- package/dist/cli/commands/{duplicates.js → query/duplicates.js} +1 -1
- package/dist/cli/commands/{eval.d.ts → query/eval.d.ts} +2 -2
- package/dist/cli/commands/{eval.js → query/eval.js} +1 -1
- package/dist/cli/commands/query/get.d.ts +6 -0
- package/dist/cli/commands/{get.js → query/get.js} +1 -1
- package/dist/cli/commands/{graph.d.ts → query/graph.d.ts} +2 -2
- package/dist/cli/commands/{graph.js → query/graph.js} +1 -1
- package/dist/cli/commands/{list.d.ts → query/list.d.ts} +2 -2
- package/dist/cli/commands/{list.js → query/list.js} +1 -1
- package/dist/cli/commands/{next.d.ts → query/next.d.ts} +2 -2
- package/dist/cli/commands/{next.js → query/next.js} +1 -1
- package/dist/cli/commands/query/search.d.ts +6 -0
- package/dist/cli/commands/{search.js → query/search.js} +1 -1
- package/dist/cli/commands/query/stats.d.ts +6 -0
- package/dist/cli/commands/{stats.js → query/stats.js} +1 -1
- package/dist/cli/commands/{test-all.d.ts → test/test-all.d.ts} +2 -2
- package/dist/cli/commands/{test-all.js → test/test-all.js} +1 -1
- package/dist/cli/commands/{test-runs.d.ts → test/test-runs.d.ts} +2 -2
- package/dist/cli/commands/{test-runs.js → test/test-runs.js} +1 -1
- package/dist/cli/commands/{test.d.ts → test/test.d.ts} +2 -2
- package/dist/cli/commands/{test.js → test/test.js} +1 -1
- package/dist/cli/commands/{config.d.ts → workspace/config.d.ts} +2 -2
- package/dist/cli/commands/{config.js → workspace/config.js} +1 -1
- package/dist/cli/commands/workspace/contracts.d.ts +2 -0
- package/dist/cli/commands/{contracts.js → workspace/contracts.js} +1 -1
- package/dist/cli/commands/{init.d.ts → workspace/init.d.ts} +2 -2
- package/dist/cli/commands/{update.js → workspace/init.js} +2 -2
- package/dist/cli/commands/workspace/merge.d.ts +8 -0
- package/dist/cli/commands/workspace/merge.js +2 -0
- package/dist/cli/commands/{profile.d.ts → workspace/profile.d.ts} +2 -2
- package/dist/cli/commands/{profile.js → workspace/profile.js} +1 -1
- package/dist/cli/commands/workspace/schema.d.ts +7 -0
- package/dist/cli/commands/workspace/schema.js +2 -0
- package/dist/cli/commands/workspace/upgrade.d.ts +2 -0
- package/dist/cli/commands/{update-many.js → workspace/upgrade.js} +2 -2
- package/dist/cli/register-annotations.js +1 -1
- package/dist/cli/register-history-activity.js +1 -1
- package/dist/cli/register-history-maintenance.js +1 -1
- package/dist/cli/register-list-query.js +1 -1
- package/dist/cli/register-mutation.js +1 -1
- package/dist/cli/register-operations.js +1 -1
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/schema/registration.js +1 -1
- package/dist/cli/stats-analytics-json.d.ts +1 -1
- package/dist/cli/stats-analytics-json.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +154 -154
- package/dist/cli-bundle/chunks/{chunk-GRHSNUQO.js → chunk-3OFFMS2N.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QZTS23BV.js → chunk-4XOV7Q5R.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2QLXN6HZ.js → chunk-AVWHZUNC.js} +26 -26
- package/dist/cli-bundle/chunks/{chunk-2UNYUB4A.js → chunk-BJBBOUYQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JBJUOOJI.js → chunk-CM57QHVK.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-NHRB3L5T.js → chunk-D2OV2UBV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4SI67A2F.js → chunk-GFTN5OS4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HAFSMFJK.js → chunk-JSW33Q6R.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-FBWAECBI.js → chunk-ML42DLI3.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-SDLBF4PY.js → chunk-SBTT42A4.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SGFQQXFD.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-7YUYLYJQ.js → chunk-UDNYAMCM.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-K7RWRJLT.js → chunk-ZSPZJOMK.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-5V43MYPN.js → register-list-query-VOS5CBX4.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-LWZH6UFJ.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-LJU5H2CU.js → register-operations-YJK4DNFZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-HJUNGYBB.js → register-setup-Q3CYF67Q.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-L6L4XCLY.js → chunk-AO5FR7PN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-K5ZCBC6Y.js → chunk-CASXNCNQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FXAZPSU6.js → chunk-FKYUTTFL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DPBTIFW7.js → chunk-IOL25GKH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-N6KI3LWF.js → chunk-JCD5YESL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6MNKQKT6.js → chunk-LH24XUPJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IA5CCSBB.js → chunk-MXESHALQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3XPBKIV6.js → chunk-PRMQTT7X.js} +12 -12
- package/dist/cli-bundle/focused-chunks/{chunk-ISEOBALS.js → chunk-QFEDRPPI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UIS5FVHH.js → chunk-QYN77MQP.js} +49 -49
- package/dist/cli-bundle/focused-chunks/{chunk-5BLRMUMK.js → chunk-TSI73EEM.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-PC6ZZVNP.js → chunk-UAU4DJSR.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-RQL5WLNZ.js → chunk-URH727T5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-U2SB2BMM.js → chunk-UT7VS4X2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HYPK5OPA.js → chunk-V2NARGRH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DRNXMOSV.js → chunk-XR5EBU3B.js} +2 -2
- package/dist/cli-bundle/main.js +18 -18
- 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 +3 -3
- 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 +38 -38
- 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 +1 -1
- package/dist/core/config/positional-value.d.ts +0 -2
- package/dist/core/config/positional-value.js +1 -1
- package/dist/core/history/history-diff.js +1 -1
- package/dist/core/schema/type-workflows.d.ts +1 -1
- package/dist/core/schema/type-workflows.js +1 -1
- package/dist/core/search/eval.d.ts +1 -1
- package/dist/core/search/eval.js +1 -1
- package/dist/core/shared/item-metadata-contract.d.ts +0 -4
- package/dist/core/shared/item-metadata-contract.js +1 -1
- package/dist/sdk/extension/shared.d.ts +2 -2
- package/dist/sdk/extension/shared.js +1 -1
- package/dist/sdk/governance/upgrade.d.ts +2 -0
- package/dist/sdk/governance/upgrade.js +2 -2
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/search-contracts.d.ts +0 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/schema.d.ts +8 -4
- package/dist/sdk/schema.js +1 -1
- package/docs/ARCHITECTURE.md +31 -4
- package/docs/BUILD_AND_RELEASE_ACCEPTANCE.md +50 -1
- package/docs/COMMANDS.md +1 -1
- package/docs/EXTENSIONS.md +1 -1
- package/docs/READ_OUTPUT_CONTRACTS.md +1 -1
- package/docs/RELEASING.md +7 -1
- package/docs/SDK_CONTEXT_INTEGRITY_PRIMITIVES.md +1 -1
- package/marketplace.json +2 -2
- package/package.json +6 -4
- 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-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/build-lease.mjs +27 -0
- package/dist/cli/commands/activity.d.ts +0 -6
- package/dist/cli/commands/aggregate.d.ts +0 -2
- package/dist/cli/commands/append.d.ts +0 -2
- package/dist/cli/commands/claim.d.ts +0 -2
- package/dist/cli/commands/close-many.d.ts +0 -2
- package/dist/cli/commands/close.d.ts +0 -6
- package/dist/cli/commands/close.js +0 -2
- package/dist/cli/commands/comments.d.ts +0 -2
- package/dist/cli/commands/context.d.ts +0 -6
- package/dist/cli/commands/context.js +0 -2
- package/dist/cli/commands/contracts.d.ts +0 -2
- package/dist/cli/commands/copy.d.ts +0 -6
- package/dist/cli/commands/create.d.ts +0 -6
- package/dist/cli/commands/delete.d.ts +0 -6
- package/dist/cli/commands/duplicates.d.ts +0 -6
- package/dist/cli/commands/extension.d.ts +0 -6
- package/dist/cli/commands/focus.d.ts +0 -6
- package/dist/cli/commands/get.d.ts +0 -6
- package/dist/cli/commands/health.d.ts +0 -6
- package/dist/cli/commands/health.js +0 -2
- package/dist/cli/commands/history-compact.d.ts +0 -7
- package/dist/cli/commands/history-redact.js +0 -2
- package/dist/cli/commands/history.d.ts +0 -2
- package/dist/cli/commands/index.d.ts +0 -55
- package/dist/cli/commands/index.js +0 -2
- package/dist/cli/commands/init-agent-guidance.d.ts +0 -6
- package/dist/cli/commands/init-agent-guidance.js +0 -2
- package/dist/cli/commands/init.js +0 -2
- package/dist/cli/commands/learnings.d.ts +0 -2
- package/dist/cli/commands/lifecycle-transitions.d.ts +0 -2
- package/dist/cli/commands/lifecycle-transitions.js +0 -2
- package/dist/cli/commands/merge.d.ts +0 -8
- package/dist/cli/commands/merge.js +0 -2
- package/dist/cli/commands/notes.d.ts +0 -2
- package/dist/cli/commands/plan.d.ts +0 -6
- package/dist/cli/commands/restore.d.ts +0 -6
- package/dist/cli/commands/restore.js +0 -2
- package/dist/cli/commands/scheduling-shortcuts.d.ts +0 -6
- package/dist/cli/commands/scheduling-shortcuts.js +0 -2
- package/dist/cli/commands/schema.d.ts +0 -7
- package/dist/cli/commands/schema.js +0 -2
- package/dist/cli/commands/search.d.ts +0 -6
- package/dist/cli/commands/stats.d.ts +0 -6
- package/dist/cli/commands/telemetry.d.ts +0 -6
- package/dist/cli/commands/update-many.d.ts +0 -2
- package/dist/cli/commands/update.d.ts +0 -6
- package/dist/cli/commands/upgrade.d.ts +0 -2
- package/dist/cli/commands/upgrade.js +0 -2
- package/dist/cli/commands/validate.d.ts +0 -9
- package/dist/cli/commands/validate.js +0 -2
- package/dist/cli-bundle/chunks/chunk-T3AMFUCN.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-DXES37MA.js +0 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var pS=Object.defineProperty;var EV=(e,t)=>{for(var r in t)pS(e,r,{get:t[r],enumerable:!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]="c7018240-2680-597f-9e71-e4b3f46ef91d")}catch{}})();var Yi=[["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"})),jm=[...["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"})),Um=[["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"})),Ki=[...jm,...Um,...[...["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,r])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:r}))],Xi=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-3z0k"},...Yi,...Ki,...["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 mS(e){let t;for(let r of Xi)r.canonical_argv.length<=(t?.canonical_argv.length??0)||r.canonical_argv.every((n,o)=>n===(o===0&&e[o]==="ctx"?"context":e[o]))&&(t=r);return t}function zm(e){let t=e.trim().replace(/\s+/gu," ");return Xi.find(r=>r.canonical===t.replace(/^ctx /u,"context "))?.alias??t}function Ke(e){return zm(e)}var go=[...Xi,...[["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,r])=>({alias:e,canonical:t,canonical_argv:[t,r],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"}))],_S=Object.fromEntries(go.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function fl(e){let t=e.trim().toLowerCase();return go.find(r=>r.alias===t)}function gS(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]="4c00e38a-27df-5315-91e8-d35c03ed6bf3")}catch{}})();var pl=[{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 Qi(e){return e.trim().toLowerCase().replaceAll("-","_")}function yS(e){if(e===void 0)return;let t=Qi(e);if(!/^[a-z][a-z0-9_]*$/.test(t))throw new TypeError(`Invalid inverse relationship kind: ${e}`);return t}function _l(e,t=new Set){if(e===null||typeof e!="object"||t.has(e))return e;if(t.add(e),Array.isArray(e)){for(let r of e)_l(r,t);return Object.freeze(e)}for(let r of Object.values(e))_l(r,t);return Object.freeze(e)}function hS(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 bS(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 wS(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 vS(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=Qi(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 ES(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 TS(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(r=>typeof r!="string")))throw new TypeError(`Invalid relationship aliases for ${t}`)}function kS(e){return e.traversal?e.traversal:e.ordering?"ordering":e.hierarchy?"hierarchy":e.direction==="undirected"?"association":"semantic"}var gl=class{#e=new Map;#r=new Map;constructor(t=pl){for(let r of t)this.register(r)}register(t){let r=vS(t);if(ES(t,r),TS(t,r),hS(t,r),bS(t,r),wS(t,r),this.#e.has(r)||this.#r.has(r))throw new TypeError(`Relationship kind already registered: ${r}`);let n=yS(t.inverse),o=[...new Set((t.aliases??[]).map(Qi))].sort();for(let s of o){if(!/^[a-z][a-z0-9_]*$/.test(s))throw new TypeError(`Invalid relationship alias: ${s}`);if(s===r||this.#e.has(s)||this.#r.has(s))throw new TypeError(`Relationship alias already registered: ${s}`)}let i=Object.freeze({...t,kind:r,traversal:kS(t),hierarchy:t.hierarchy??!1,hierarchyDirection:t.hierarchy?t.hierarchyDirection??"source_parent":void 0,inverse:n,aliases:Object.freeze(o),payloadSchema:t.payloadSchema?_l(structuredClone(t.payloadSchema)):void 0});this.#e.set(r,i);for(let s of o)this.#r.set(s,r);return this}resolve(t){if(typeof t!="string")return;let r=Qi(t);return this.#e.get(this.#r.get(r)??r)}require(t){let r=this.resolve(t);if(!r)throw new TypeError(`Unknown relationship kind: ${t}`);return r}list(){return Object.freeze([...this.#e.values()].sort((t,r)=>t.kind.localeCompare(r.kind)))}};function yl(){return new gl}var Ar=yl();function CV(e){return Ar.require(e).kind}function IV(e){return Ar.resolve(e)?.kind}function RV(e,t=Ar){return t.resolve(e)?.ordering===!0}function AS(e,t,r,n=Ar){let o=yo(e),i=yo(t);if(!o||!i)throw new TypeError("Relationship endpoint must not be empty");let s=n.require(r);if(o===i&&!s.allowSelf)throw new TypeError(`Self relationship is not allowed for ${s.kind}`);return s}function Ji(e,t){return e.source.localeCompare(t.source)||e.target.localeCompare(t.target)||e.kind.localeCompare(t.kind)}function SS(e,t,r){let n=typeof e.source=="string"?e.source.trim():"",o=typeof e.target=="string"?e.target.trim():"";if(!t.has(n)||!t.has(o))throw new TypeError(`Relationship endpoint not found: ${n} -> ${o}`);let i=AS(n,o,e.kind,r),s=Object.freeze({...e,source:n,target:o,kind:i.kind}),a=i.direction==="undirected"?[n,o].sort().join("\0"):`${n}\0${o}`;return{edge:s,identity:`${i.kind}\0${a}`}}function Zi(e,t,r){let n=e.get(t);n?n.push(r):e.set(t,[r])}function yo(e){return typeof e=="string"?e.trim():""}function ml(e,t){let r=yo(e);return r&&t.has(r)?r:void 0}function OS(e,t,r){let n=[t],o=t;for(;o!==e;)o=r.get(o),n.push(o);return n.reverse()}var qm=class e{#e;#r;#o;#n;#s=new Map;#a=new Map;constructor(t,r,n=Ar){this.#e=n,this.#r=new Set([...t].filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean)),this.#o=Object.freeze([...this.#r].sort());let o=new Map;for(let i of r){let{edge:s,identity:a}=SS(i,this.#r,n);o.set(a,s)}this.#n=Object.freeze([...o.values()].sort(Ji));for(let i of this.#n)Zi(this.#s,i.source,i),Zi(this.#a,i.target,i),n.require(i.kind).direction==="undirected"&&(Zi(this.#s,i.target,i),Zi(this.#a,i.source,i))}static fromItems(t,r=Ar){let n=new Set(t.map(i=>yo(i.id)).filter(Boolean)),o=[];for(let i of t){let s=yo(i.id);if(!s)continue;let a=ml(i.parent,n);a&&o.push({source:s,target:a,kind:"parent"});let c=ml(i.blocked_by,n);c&&o.push({source:s,target:c,kind:"blocked_by"});for(let l of i.dependencies??[]){let d=ml(l.id,n);d&&r.resolve(l.kind)&&o.push({source:s,target:d,kind:l.kind,createdAt:l.created_at,author:l.author})}}return new e(n,o,r)}edges(){return this.#n}incidentEdges(t){this.#i(t);let r=this.#s.get(t)??[],n=this.#a.get(t)??[];if(r.length===0)return Object.freeze([...n]);if(n.length===0)return Object.freeze([...r]);let o=[],i=0,s=0;for(;i<r.length||s<n.length;){let a=r[i],c=n[s],l=a===void 0?c:c===void 0||Ji(a,c)<=0?a:c;o.at(-1)!==l&&o.push(l),a===l&&(i+=1),c===l&&(s+=1)}return Object.freeze(o)}nodes(){return this.#o}hasNode(t){return this.#r.has(t)}registry(){return this.#e}#i(t){if(!this.#r.has(t))throw new TypeError(`Relationship node not found: ${t}`)}#c(t,r){if(!r)return!0;let n=this.#e.require(t.kind);return r.has(t.kind)||n.inverse!==void 0&&r.has(n.inverse)}#t(t,r,n){let o=[...r==="incoming"?[]:this.#s.get(t)??[],...r==="outgoing"?[]:this.#a.get(t)??[]];return[...new Set(o)].filter(i=>this.#c(i,n)).map(i=>({id:i.source===t?i.target:i.source,edge:i})).sort((i,s)=>i.id.localeCompare(s.id)||Ji(i.edge,s.edge))}adjacency(t,r={}){this.#i(t),r.signal?.throwIfAborted();let n=r.kinds?new Set(r.kinds.map(c=>this.#e.require(c).kind)):void 0,o=this.#t(t,r.direction??"outgoing",n),i=r.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,r={}){this.#i(t),r.signal?.throwIfAborted();let n=r.kinds?new Set(r.kinds.map(a=>this.#e.require(a).kind)):void 0,o=this.#t(t,r.direction??"outgoing",n),i=r.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,r={}){this.#i(t);let n=r.kinds?new Set(r.kinds.map(p=>this.#e.require(p).kind)):void 0,o=r.direction??"outgoing",i=r.limit??Number.POSITIVE_INFINITY,s=r.maxDepth??Number.POSITIVE_INFINITY,a=new Set([t]),c=[],l=[{id:t,depth:0}],d=0,u=0,f=!1;e:for(let p=0;p<l.length;p+=1){r.signal?.throwIfAborted();let m=l[p];d+=1;let h=this.#t(m.id,o,n);if(u+=h.length,m.depth>=s){h.some(b=>!a.has(b.id))&&(f=!0);continue}for(let b of h)if(!a.has(b.id)){if(c.length>=i){f=!0;break e}a.add(b.id),c.push(b.id),l.push({id:b.id,depth:m.depth+1})}}return{value:c,meta:{visitedNodes:d,inspectedEdges:u,truncated:f,nextCursor:c.at(-1)}}}shortestPath(t,r,n={}){if(this.#i(t),this.#i(r),t===r)return{value:[t],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}};let o=n.kinds?new Set(n.kinds.map(p=>this.#e.require(p).kind)):void 0,i=n.direction??"outgoing",s=n.maxDepth??Number.POSITIVE_INFINITY,a=[{id:t,depth:0}],c=new Map,l=new Set([t]),d=0,u=0,f=!1;for(let p=0;p<a.length;p+=1){n.signal?.throwIfAborted();let m=a[p];d+=1;let h=this.#t(m.id,i,o);if(u+=h.length,m.depth>=s){h.some(b=>!l.has(b.id))&&(f=!0);continue}for(let b of h)if(!l.has(b.id)){if(c.set(b.id,m.id),b.id===r)return{value:OS(t,r,c),meta:{visitedNodes:d,inspectedEdges:u,truncated:!1}};l.add(b.id),a.push({id:b.id,depth:m.depth+1})}}return{value:[],meta:{visitedNodes:d,inspectedEdges:u,truncated:f}}}subgraph(t,r={}){let n=this.closure(t,r),o=[t,...n.value].sort(),i=new Set(o),s=r.kinds?new Set(r.kinds.map(c=>this.#e.require(c).kind)):void 0,a=new Set;for(let c of o)for(let l of this.#s.get(c)??[])i.has(l.source)&&i.has(l.target)&&this.#c(l,s)&&a.add(l);return{value:{nodes:o,edges:[...a].sort(Ji)},meta:n.meta}}};function xV(e,t,r=Ar){return{source:e,target:t.id,kind:r.require(t.kind).kind,createdAt:t.created_at,author:t.author}}import*as ce from"node:fs/promises";import es from"node:path";import CS 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 IS=[10,25,50,100];async function ts(e){await ce.mkdir(e,{recursive:!0})}async function re(e){try{return await ce.access(e),!0}catch{return!1}}function ho(e){return X(e)||Sr(e,"ENOTDIR")}function X(e){return Sr(e,"ENOENT")}async function G(e){try{return await ce.readFile(e,"utf8")}catch(t){if(ho(t))return null;throw t}}async function z(e,t){let r=es.dirname(e);await ts(r);let n=es.join(r,`.${es.basename(e)}.${process.pid}.${Date.now()}.${CS.randomBytes(4).toString("hex")}.tmp`);await ce.writeFile(n,t,"utf8");try{await ce.rename(n,e)}catch(o){if(process.platform==="win32"&&(Sr(o,"EPERM")||Sr(o,"EBUSY"))){let i=o;for(let s of IS){await new Promise(a=>setTimeout(a,s));try{await ce.rename(n,e);return}catch(a){if(i=a,!Sr(a,"EPERM")&&!Sr(a,"EBUSY"))break}}try{await ce.unlink(n)}catch{}throw i}if(Sr(o,"EXDEV")){try{await ce.copyFile(n,e)}finally{try{await ce.unlink(n)}catch{}}return}try{await ce.unlink(n)}catch{}throw o}}async function bo(e,t){let r=es.dirname(e);await ts(r);let n=await ce.open(e,"a");try{await n.writeFile(`${t}
|
|
2
|
-
`,"utf8")}finally{await n.close()}}async function wo(e){try{await ce.unlink(e)}catch(t){if(!ho(t))throw t}}function Sr(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===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]="de5f8d66-b9dc-555c-a52f-33b1b5368be3")}catch{}})();var RS="__pm_suppress_host_output",hl="@unbrained/pm-cli:suppress-host-output:v1";function Hm(e){return e===void 0?{__pm_suppress_host_output:hl}:{__pm_suppress_host_output:hl,result:e}}function rs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&e[RS]===hl}import mn from"node:fs";import Ot from"node:path";import{fileURLToPath as xS}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 NS="@unbrained/pm-cli";function DS(e){try{return JSON.parse(mn.readFileSync(e,"utf8")).name===NS}catch{return!1}}function PS(e){let t=mn.existsSync(e)&&mn.statSync(e).isDirectory()?Ot.resolve(e):Ot.dirname(Ot.resolve(e));for(;;){let r=Ot.join(t,"package.json");if(mn.existsSync(r)&&DS(r))return t;let n=Ot.dirname(t);if(n===t)return;t=n}}function Ct(e,t=[]){let r=xS(e),n=PS(r);return n||Ot.resolve(Ot.dirname(r),...t)}function bl(e,t=[]){try{let r=Ot.join(Ct(e,t),"package.json");if(!mn.existsSync(r))return;let n=JSON.parse(mn.readFileSync(r,"utf8"));return typeof n.version=="string"&&n.version.trim().length>0?n.version:void 0}catch{return}}function MS(e=process.env,t="PM_CLI_PACKAGE_ROOT",r,n=[]){let o=e[t];return typeof o=="string"&&o.trim().length>0?Ot.resolve(o.trim()):r?Ct(r,n):process.cwd()}(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 j(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function LS(e){return j(e)??void 0}function vo(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 _n(e){return Array.isArray(e)&&e.every(t=>typeof t=="number"&&Number.isFinite(t))}function B(e){if(e instanceof Error){let t=e.message.trim();return t.length>0?t:e.name}return String(e)}function ns(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 Bm(e){let t=ns(e);return t===null||t<=0||!Number.isInteger(t)?null:t}function zV(e,t,r){let n=ns(e);return n===null||n<t||n>r?null:n}function FS(e){return typeof e!="object"||e===null||Array.isArray(e)?null:e}function Wt(e){return typeof e!="object"||e===null?null:e}function Gm(e){return typeof e!="object"&&typeof e!="function"||e===null?null:e}function Vm(e){let t=Gm(e);if(!t)return null;if(typeof t.activate=="function")return t;let r=Gm(t.default);return typeof r?.activate=="function"?r:null}function $S(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...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]="9ddd9ea4-8586-5d3d-9ed8-0bf9da49b9a5")}catch{}})();var mt=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],os=2,wl=Object.freeze({migration:"schema",validation:"schema"}),HV=Object.freeze({version:os,capabilities:[...mt],legacy_aliases:{...wl}}),is=["off","warn","enforce"],ss=["off","warn","enforce"],as=["none","restricted","strict"],Wm=["block","warn"],cs=["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"],gn=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function ls(){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]="0d16c1b3-1bc5-5973-a20d-78ada79d4c9b")}catch{}})();var Ym=["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"],jS=["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",...Ym,"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"],Xe=jS;(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6e329ab1-f22d-5749-b8a4-0a6e7a1c8023")}catch{}})();var El=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"]}]),Tl=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),ds=".agents/pm",us="settings.json",US="Closed at creation via pm create",zS=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],qS=["decisions","events","reminders","milestones","meetings","plans"],YV=[...zS,...qS],Ee={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},kl={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}},HS=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],vl={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 Km(e){return e?[...e]:void 0}var O={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:[...HS],lifecycle_closure_like_blocked_reason_patterns:[...vl.blocked_reason],lifecycle_closure_like_resolution_patterns:[...vl.resolution],lifecycle_closure_like_actual_result_patterns:[...vl.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...kl.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:El.map(e=>({...e,aliases:Km(e.aliases),roles:Km(e.roles)})),fields:[],workflow:{...Tl},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:ls()},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:""}}},yn={metadata:{},body:""},_={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},GS=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 fs(e){let t=(e??"").trim().toLowerCase();if(t.length===0)return"unknown";let r=GS[t];return typeof r=="string"?r:t.includes("conflict")||t.includes("locked")?"conflict":t.startsWith("unknown_")||t.startsWith("missing_required_")?"usage":t.startsWith("invalid_")||t.endsWith("_not_found")||t.includes("validation")?"validation":t.endsWith("_error")||t.endsWith("_failed")?"runtime":"unknown"}(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]="0f7e5fb3-86d2-5af5-a189-a40dd223ef26")}catch{}})();var g=class extends Error{exitCode;code;context;constructor(t,r,n={}){super(t),this.name="PmCliError",this.exitCode=r,this.context=n,this.code=n.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]="a966bb77-c4be-593b-93f5-b6277072160e")}catch{}})();var hn=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],Xm=hn,bn=["draft","open","in_progress","blocked","closed","canceled"],ps=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],wn=["string","number","boolean","string_array","array","object"],ms=["create","update","update_many","list","search","calendar","context"],_s=["allow","warn","reject"],JV=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],ZV=["project","global"],QV=["low","medium","high","critical"],gs=["low","medium","high","critical"],ys=["low","medium","high"];var Jm=["minimal","default","strict","custom"],e5=["none","warn","strict"],t5=["progressive","strict"],r5=["off","warn","strict"],n5=["off","warn","strict"];var hs=["daily","weekly","monthly","yearly"],Eo=["mon","tue","wed","thu","fri","sat","sun"];function Al(e){return Eo.indexOf(e)}var Zm=["draft","research","review","approved","executing","paused","completed","superseded"],bs=["pending","in_progress","completed","blocked","skipped","superseded"],Qm=["codex","claude-code","cursor","generic"],e_=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],o5=["brief","standard","deep","full"],i5=["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]="0ca7f52c-fb31-5cd9-b689-a918f4e61816")}catch{}})();import KS 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]="7647d826-e562-5f8e-86b2-2e40d8714b4d")}catch{}})();function Yt(e){return[...new Set((e??[]).map(t=>t.trim()).filter(t=>t.length>0))].sort((t,r)=>t.localeCompare(r))}function BS(e){let t=e.key.trim();if(t.length===0)return null;let r=Yt(e.aliases),n=e.description?.trim();return{key:t,values:Yt(e.values),required:e.required===!0?!0:void 0,aliases:r.length>0?r:void 0,description:n&&n.length>0?n:void 0}}var VS=e=>e,r_=e=>{let t=e.trim().toLowerCase();return t==="create"||t==="update"?t:null};function WS(e,t){let r=t(e.command);if(r===null)return null;let n=e.option.trim();return n.length===0?null:{command:r,option:n,required:e.required,visible:e.visible,enabled:e.enabled}}function YS(e,t){let r=new Map;for(let n of e??[]){let o=WS(n,t);o&&r.set(`${o.command}:${o.option.toLowerCase()}`,o)}return[...r.values()].sort((n,o)=>n.command===o.command?n.option.localeCompare(o.option):n.command.localeCompare(o.command))}function t_(e,t){return t?Yt(e):void 0}function Sl(e){let t=e?.trim();return t&&t.length>0?t:void 0}function Ol(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 ws(e,t={}){let r=t.resolvePolicyCommand??VS,n=e.name.trim();if(n.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=Yt(e.aliases),l=(e.options??[]).map(u=>BS(u)).filter(u=>u!==null).sort((u,f)=>u.key.localeCompare(f.key)),d=YS(e.command_option_policies,r);return{name:n,description:Sl(e.description),default_status:Sl(e.default_status),...e.execution_role===void 0?{}:{execution_role:Ol(e.execution_role)},folder:Sl(e.folder),aliases:c.length>0?c:void 0,required_create_fields:t_(e.required_create_fields,o),required_create_repeatables:t_(e.required_create_repeatables,i),options:s?l:void 0,command_option_policies:a?d: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 XS=Object.freeze({decision:"human",milestone:"gate"}),JS=["title","description","status","priority","tags","body","deadline","estimatedMinutes","acceptanceCriteria","author","message","assignee"],ZS=["dep","comment","note","learning","file","test","doc"],Il=["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"],QS=["title","description","type","status","priority","tags","body",...Il,"author","message","dep","comment","note","learning","file","test","doc","reminder","event","typeOption","field"],eO=["title","description","body","status","closeReason","priority","type","tags",...Il,"author","message","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ownershipMetadataBypass","ownershipDependencyBypass","force"],o_={"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"},tO={...o_},rO={...o_},i_=[["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"]],s_=[["comment","--comment"],["note","--note"],["learning","--learning"],["file","--file"],["test","--test"],["doc","--doc"],["reminder","--reminder"],["event","--event"],["typeOption","--type-option"]];function a_(e){return Object.fromEntries(e)}var nO=a_([["title","--title"],["description","--description"],["type","--type"],["status","--status"],["priority","--priority"],["tags","--tags"],["body","--body"],...i_,["author","--author"],["message","--message"],["dep","--dep"],...s_]),oO=a_([["title","--title"],["description","--description"],["body","--body"],["status","--status"],["closeReason","--close-reason"],["priority","--priority"],["type","--type"],["tags","--tags"],...i_,...s_,["author","--author"],["message","--message"],["force","--force"]]);function iO(e){return e.trim().replace(/^--+/,"").toLowerCase()}function sO(e){return e==="create"?QS:eO}function aO(e){return e==="create"?tO:rO}function Rl(e,t){let r=iO(t);if(r.length===0)return;let n=aO(e)[r];return n||sO(e).find(o=>o.toLowerCase()===r)}function cO(e,t){return(e==="create"?nO:oO)[t]??`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function ko(e){let t=lO(e);return t.length===0?"items":t.endsWith("s")?t:`${t}s`}function vs(e){let t=e.trim(),n=t.replaceAll("\\","/").replace(/^\/+/,""),o=KS.posix.normalize(n);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 lO(e){let t=e.trim().toLowerCase(),r="",n=!1;for(let o of t){let i=o.charCodeAt(0),s=i>=97&&i<=122,a=i>=48&&i<=57;if(s||a){n&&r.length>0&&(r+="-"),r+=o,n=!1;continue}r.length>0&&(n=!0)}return r}function dO(e){return ws(e,{resolvePolicyCommand:r_})}function To(e,t){let r=e[t];return Array.isArray(r)?r.filter(n=>typeof n=="string"):void 0}function uO(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:To(t,"values")??[],required:t.required===void 0?void 0:!!t.required,aliases:To(t,"aliases"),description:typeof t.description=="string"?t.description:void 0}}function fO(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 r=t.command.trim().toLowerCase();return r!=="create"&&r!=="update"?null:{command:r,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 pO(e){if(Array.isArray(e.options))return e.options.map(t=>uO(t)).filter(t=>t!==null)}function mO(e){if(Array.isArray(e.command_option_policies))return e.command_option_policies.map(t=>fO(t)).filter(t=>t!==null)}function _O(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e,r=typeof t.name=="string"?t.name:"";if(r.trim().length===0)return null;let n=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:r,description:o,default_status:i,execution_role:Ol(t.execution_role),folder:n,aliases:To(t,"aliases"),required_create_fields:To(t,"required_create_fields"),required_create_repeatables:To(t,"required_create_repeatables"),options:pO(t),command_option_policies:mO(t)}}function gO(e,t){return e.required_create_fields?Yt(e.required_create_fields):t?.required_create_fields??[]}function yO(e,t){return e.required_create_repeatables?Yt(e.required_create_repeatables):t?.required_create_repeatables??[]}function hO(e,t){return e.options?e.options:t?.options?[...t.options]:[]}function bO(e,t){return e.command_option_policies?e.command_option_policies:t?.command_option_policies?[...t.command_option_policies]:[]}function wO(e,t){let r=t?.name??e.name,n=e.description??t?.description,o=e.default_status??t?.default_status,i=vs(e.folder??t?.folder??ko(r)),s={name:r,execution_role:e.execution_role,folder:i,aliases:Yt([...t?.aliases??[],...e.aliases??[]]),required_create_fields:gO(e,t),required_create_repeatables:yO(e,t),options:hO(e,t),command_option_policies:bO(e,t)};return n&&(s.description=n),o&&(s.default_status=o),s}function n_(e,t){for(let r of e){let n=dO(r);if(!n)continue;let o=n.name.toLowerCase(),i=t.get(o);t.set(o,wO({...n,execution_role:n.execution_role??i?.execution_role},i))}}function vO(e){if(!e)return[];let t=[];for(let r of e.item_types??[]){let n=r.types;if(Array.isArray(n))for(let o of n){let i=_O(o);i&&t.push(i)}}return t}function Ao(e,t=null){let r=new Map;for(let c of Xm)r.set(c.toLowerCase(),{name:c,execution_role:XS[c.toLowerCase()]??"agent",folder:Ee[c],aliases:[],required_create_fields:[...JS],required_create_repeatables:[...ZS],options:[],command_option_policies:[]});n_(e.item_types?.definitions??[],r),n_(vO(t),r);let n=[...r.values()].sort((c,l)=>c.name.localeCompare(l.name)),o={},i={},s={};for(let c of n){o[c.name]=c,s[c.name]=c.folder,i[c.name.toLowerCase()]=c.name;for(let l of c.aliases)i[l.toLowerCase()]=c.name}let a=[...new Set(n.map(c=>c.folder))].sort((c,l)=>c.localeCompare(l));return{types:n.map(c=>c.name),folders:a,type_to_folder:s,by_type:o,alias_to_type:i}}function c_(e,t){if(e!==void 0)return t.alias_to_type[e.trim().toLowerCase()]}function l_(e,t){let r=c_(e,t);if(r)return t.by_type[r]}function EO(e,t,r,n){for(let o of n){let i=Rl(r,o);if(i){e.required.add(i);continue}e.errors.push(`Unsupported base required option "${o}" for command "${r}" on type "${t.name}"`)}}function Cl(e,t,r){if(r){e.add(t);return}e.delete(t)}function TO(e,t,r,n){let o=Rl(r,n.option);if(!o){e.errors.push(`Unsupported command_option_policies option "${n.option}" for command "${r}" on type "${t.name}"`);return}n.required!==void 0&&Cl(e.required,o,n.required),n.visible!==void 0&&Cl(e.hidden,o,!n.visible),n.enabled!==void 0&&Cl(e.disabled,o,!n.enabled)}function kO(e,t,r){for(let n of t.command_option_policies)n.command===r&&TO(e,t,r,n)}function AO(e,t,r){for(let n of e.required)e.disabled.has(n)&&e.errors.push(`Option "${n}" cannot be both required and disabled for command "${r}" on type "${t.name}"`)}function SO(e,t,r){let n=[],o=new Set,i=new Set,s=new Set,a={required:o,hidden:i,disabled:s,errors:n};return EO(a,e,t,r),kO(a,e,t),AO(a,e,t),{required:[...o],hidden:[...i].sort((c,l)=>c.localeCompare(l)),disabled:[...s].sort((c,l)=>c.localeCompare(l)),errors:n}}function OO(e){let t=new Map;for(let r of e.options){t.set(r.key.toLowerCase(),r);for(let n of r.aliases??[])t.set(n.toLowerCase(),r)}return t}function CO(e,t,r){let n=e.values;if(n.length===0)return t;let i=new Map(n.map(s=>[s.toLowerCase(),s])).get(t.toLowerCase());if(!i){r.push(`Invalid value "${t}" for type option "${e.key}". Allowed: ${n.join(", ")}`);return}return i}function IO(e,t,r){let n=l_(e,r);if(!n)return{normalized:void 0,errors:[`Unknown type "${e}"`]};let o=[],i=OO(n),s={};for(let[c,l]of Object.entries(t??{})){let d=c.trim(),u=l.trim();if(d.length===0){o.push("type option keys must not be empty");continue}if(u.length===0){o.push(`type option "${d}" must not be empty`);continue}let f=i.get(d.toLowerCase());if(!f){let m=n.options.map(h=>h.key).join(", ");o.push(n.options.length>0?`Unknown type option "${d}" for type "${n.name}". Allowed: ${m}`:`Type "${n.name}" does not define any configurable type options`);continue}let p=CO(f,u,o);p!==void 0&&(s[f.key]=p)}for(let c of n.options)c.required&&!(c.key in s)&&o.push(`Missing required type option "${c.key}" for type "${n.name}"`);let a=Object.keys(s).sort((c,l)=>c.localeCompare(l));return a.length===0?{normalized:void 0,errors:o}:{normalized:Object.fromEntries(a.map(c=>[c,s[c]])),errors:o}}import{readFileSync as RO,readdirSync as xO,statSync as NO}from"node:fs";import DO from"node:os";import M 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]="124443e3-a20b-5fd6-a1d9-e4a09b17dc4a")}catch{}})();var PO={json_markdown:".md",toon:".toon"},MO={".md":"json_markdown",".toon":"toon"},LO=new Set([".git","coverage","dist","node_modules"]),Es=[".md",".toon"];function So(e){try{return NO(e),!0}catch{return!1}}function d_(e){try{let t=JSON.parse(RO(e,"utf8"));return typeof t!="object"||t===null||Array.isArray(t)?!1:"id_prefix"in t||"item_format"in t}catch{return!1}}function FO(e){let t=M.resolve(e);for(;;){let r=M.join(t,ds),n=M.join(r,us);if(So(n))return r;let o=M.join(t,us);if(So(o)&&d_(o))return t;let i=M.dirname(t);if(i===t)return;t=i}}function u_(e){return FO(e)??M.resolve(e,ds)}function v5(e,t){let r=t?M.resolve(t):void 0;try{return xO(M.resolve(e),{withFileTypes:!0}).filter(n=>n.isDirectory()&&!LO.has(n.name)).map(n=>M.join(M.resolve(e),n.name)).filter(n=>n!==r).filter(n=>So(Te(n))).filter(n=>d_(Te(n))).sort((n,o)=>n.localeCompare(o))[0]}catch{return}}function Oo(e,t){let r=process.env.PM_PATH,n=t?.trim()||r?.trim();if(n){let o=M.resolve(e,n);if(!So(Te(o))){let i=M.join(o,ds);if(So(Te(i)))return i}return o}return u_(e)}function $O(e){let t=M.resolve(e),r=M.dirname(t);return M.basename(t)==="pm"&&M.basename(r)===".agents"?M.dirname(r):t}function It(e){let t=process.env.PM_GLOBAL_PATH?.trim(),r=t&&t.length>0?t:M.join(DO.homedir(),".pm-cli");return M.resolve(e,r)}function Te(e){return M.join(e,us)}function jO(e,t,r=Ee){let n=r[t]??ko(t);return M.join(e,n)}function vn(e,t,r,n="toon",o=Ee){return M.join(jO(e,t,o),`${r}${PO[n]}`)}function Co(e){let t=e.replaceAll("\\","/"),r=M.posix.extname(t).toLowerCase();return MO[r]??null}function _t(e,t){if(!/^(?!\.{1,2}$)[^/\\:\0]+$/.test(t))throw new g("Invalid history item id: expected a single filename.",_.USAGE);return M.join(e,"history",`${t}.jsonl`)}function f_(e,t){return M.join(e,"locks",`${t}.lock`)}function xl(e){return M.join(e,"runtime")}function Ts(e){return M.join(xl(e),"test-runs")}function UO(e){return M.join(Ts(e),"runs")}function E5(e,t){return M.join(UO(e),`${t}.json`)}function zO(e){return M.join(Ts(e),"stdout")}function qO(e){return M.join(Ts(e),"stderr")}function T5(e,t){return M.join(zO(e),`${t}.log`)}function k5(e,t){return M.join(qO(e),`${t}.log`)}function HO(e){return M.join(Ts(e),"results")}function A5(e,t){return M.join(HO(e),`${t}.json`)}(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 J(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function GO(){return{json:!1,quiet:!1,noExtensions:!1,profile:!1}}function Le(e){return e?U(e):{}}function Fe(e){return e?U(e):GO()}function U(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 BO=new Set(["commands","command_overrides","command_handlers","flag_commands","parser_overrides"]),VO=["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 WO(e,t){for(let r of VO){let n=e[r];if(n===void 0)continue;if(!Array.isArray(n)||n.some(i=>typeof i!="string"))return!1;let o=n.map(i=>BO.has(r)?J(i):i.trim()).filter(i=>i.length>0);t[r]=[...new Set(o)].sort((i,s)=>i.localeCompare(s))}return!0}function YO(e){if(!Array.isArray(e))return null;let t=[];for(let r of e){if(typeof r!="object"||r===null)return null;let n=r;if(n.format!=="json"&&n.format!=="toon"||!Array.isArray(n.commands)||n.commands.some(o=>typeof o!="string")||typeof n.result_discriminator!="boolean")return null;t.push({format:n.format,commands:[...new Set(n.commands.map(o=>J(o)))].sort((o,i)=>o.localeCompare(i)),result_discriminator:n.result_discriminator})}return t.sort((r,n)=>r.format.localeCompare(n.format))}function KO(e){if(!Array.isArray(e))return null;let t=[];for(let r of e){if(typeof r!="object"||r===null)return null;let n=r.commands;if(!Array.isArray(n)||n.some(o=>typeof o!="string"))return null;t.push({commands:[...new Set(n.map(o=>J(o)))].filter(o=>o.length>0).sort((o,i)=>o.localeCompare(i))})}return t}function ks(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 r={schema_version:1};if(!WO(t,r))return null;let n=t.preflight_overrides;if(n!==void 0&&(!Number.isInteger(n)||n<0))return null;typeof n=="number"&&(r.preflight_overrides=n);let o=t.renderer_ownership;if(o!==void 0){let s=YO(o);if(s===null)return null;r.renderer_ownership=s}let i=t.preflight_ownership;if(i!==void 0){let s=KO(i);if(s===null)return null;r.preflight_ownership=s}return r}function I5(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]="de2a2a0e-8a39-5569-9af9-cbf557bce2a9")}catch{}})();function ot(e,t,r){if(e===t)return 0;if(Math.abs(e.length-t.length)>r)return null;let n=t.length+1,o=new Array(n),i=new Array(n),s=new Array(n);for(let c=0;c<n;c+=1)o[c]=0,i[c]=c;for(let c=1;c<=e.length;c+=1){s[0]=c;let l=s[0];for(let d=1;d<=t.length;d+=1){let u=e[c-1]===t[d-1]?0:1,f=i[d-1]+u,p=s[d-1]+1,m=i[d]+1,h=Math.min(f,p,m);c>1&&d>1&&e[c-1]===t[d-2]&&e[c-2]===t[d-1]&&(h=Math.min(h,o[d-2]+1)),s[d]=h,h<l&&(l=h)}if(l>r)return null;for(let d=0;d<n;d+=1)o[d]=i[d],i[d]=s[d]}let a=i[t.length];return a<=r?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 Io(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,r)=>t.localeCompare(r))}function Kt(e){return mt.includes(e)}function p_(e){let t=e.trim().toLowerCase();return Kt(t)?t:null}function m_(e){return e.filter(t=>!Kt(t))}function Nl(e){let t=e.trim().toLowerCase();return t.length===0?null:wl[t]??null}function __(e){let t=Io([...e].map(i=>i.toLowerCase())),r=[],n=[];for(let i of t){let s=Nl(i);if(s){r.push(s),n.push({alias:i,target:s});continue}r.push(i)}let o=[...new Map(n.map(i=>[`${i.alias}>${i.target}`,i])).values()].sort((i,s)=>i.alias.localeCompare(s.alias));return{capabilities:Io(r),legacy_aliases:o}}function XO(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let r=Nl(t);if(r)return r;let n=Math.max(1,Math.floor(t.length*.34)),o=null,i=Number.POSITIVE_INFINITY;for(let s of mt){let a=ot(t,s,n);a!==null&&a<i&&(i=a,o=s)}return o}function g_(e,t,r){let n=mt.join(","),o=XO(r)??"none";return`extension_capability_unknown:${e}:${t}:${r}:allowed=${n}:suggested=${o}`}function y_(e,t,r){let n=r.map(o=>`${o.alias}>${o.target}`).join(",");return`extension_capability_legacy_alias:${e}:${t}:aliases=${n}`}function JO(e){let t=/^extension_capability_unknown:(global|project):([^:]+):([^:]+):allowed=([^:]+):suggested=([^:]+)$/.exec(e.trim());if(!t)return null;let[,r,n,o,i,s]=t,a=r,c=i.split(",").map(p=>p.trim()).filter(p=>p.length>0),l=Nl(o),u=(s==="none"?void 0:s)??l??void 0;return{layer:a,name:n,capability:o,allowed_capabilities:c,capability_contract_version:os,suggested_capability:u,suggestion_source:u?l===u?"legacy_alias":"nearest_match":void 0,legacy_alias_target:l??void 0}}function ZO(e){let t=/^extension_capability_legacy_alias:(global|project):([^:]+):aliases=(.+)$/.exec(e.trim());if(!t)return[];let[,r,n,o]=t,i=r,s=[...mt],a=[];for(let c of o.split(",")){let[l,d]=c.split(">"),u=l?.trim(),f=d?.trim().toLowerCase();!u||!f||!Kt(f)||a.push({layer:i,name:n,capability:u,allowed_capabilities:s,capability_contract_version:os,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]="01116a5e-62d1-591b-9fd0-84ac6e99f8d0")}catch{}})();function Ro(){return{beforeCommand:[],beforeMutation:[],afterCommand:[],onWrite:[],onRead:[],onIndex:[]}}function Dl(){return{overrides:[],handlers:[]}}function Pl(){return{overrides:[]}}function Ml(){return{overrides:[]}}function Ll(){return{overrides:[]}}function Fl(){return{overrides:[]}}function As(){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]="9961b408-ad70-5556-84dd-5ca1b1497c27")}catch{}})();var QO=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 eC(e){return{unknownKeys:Object.keys(e).filter(t=>!QO.has(t)).sort((t,r)=>t>r?1:-1),missingVersionBounds:e.pm_min_version===void 0&&e.pm_max_version===void 0}}function tC(e){let t=eC(e),r=t.unknownKeys.map(n=>({code:"manifest_unknown_key",path:n,...n==="compatibility"?{suggested_key:"pm_min_version"}:{},message:n==="compatibility"?'Manifest key "compatibility" is ignored; declare the canonical pm_min_version and optional pm_max_version fields instead.':`Manifest key "${n}" is not part of the extension manifest contract and will be ignored.`}));return t.missingVersionBounds&&r.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:r.length===0,findings:r}}function h_(e,t,r){return tC(r).findings.map(n=>n.code==="manifest_unknown_key"?`extension_manifest_unknown_key:${e}:${t.name}:key=${n.path}${n.suggested_key?`:suggested=${n.suggested_key}`:""}`:`extension_manifest_no_version_bounds:${e}:${t.name}:suggested=pm_min_version`)}import{constants as Xt}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 b_=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"}]]),rC=/^[a-z][a-z0-9_]{0,63}$/u,nC=new Map([[Xt.errno.EACCES,"EACCES"],[Xt.errno.EDQUOT,"EDQUOT"],[Xt.errno.EMFILE,"EMFILE"],[Xt.errno.ENFILE,"ENFILE"],[Xt.errno.ENOMEM,"ENOMEM"],[Xt.errno.ENOSPC,"ENOSPC"],[Xt.errno.EPERM,"EPERM"],[Xt.errno.EROFS,"EROFS"]].filter(([e])=>Number.isInteger(e))),oC={capacity:{code:"host_environment_capacity_fault"},permission:{code:"host_environment_permission_fault"},resource:{code:"host_environment_resource_fault"}};function iC(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.code=="string"&&b_.has(t.code)?t.code:typeof t.errno!="number"||!Number.isInteger(t.errno)?null:nC.get(Math.abs(t.errno))??null}function sC(e,t,r={}){let n=iC(e);if(n===null)return null;if(!rC.test(t))throw new g("Host environment operation labels must be bounded identifiers.",_.USAGE,{code:"host_environment_operation_invalid",field:"operation"});let o=b_.get(n);return new g(`Host filesystem operation ${t} ${o.summary}.`,_.GENERIC_FAILURE,{code:r.codes?.[o.category]??oC[o.category].code,reason:n,required:o.recovery,why:r.why??"The operating system refused a required project filesystem operation.",nextSteps:[o.recovery,...r.nextSteps??[]],...r.suggestedRetry?{recovery:{suggested_retry:r.suggestedRetry}}:{}})}async function w_(e,t,r={}){try{return await t()}catch(n){throw sC(n,e,r)??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]="31da4a5a-1e85-5d77-a09f-2736cc44d850")}catch{}})();var aC=Object.freeze({string:"string",number:"number",int:"number",integer:"number",float:"number",boolean:"boolean",bool:"boolean"});function $l(e){return typeof e!="string"?null:aC[e.trim().toLowerCase()]??null}function jl(e){let t=[],r=n=>{if(Array.isArray(n)){for(let o of n)r(o);return}if(typeof n=="string"){for(let o of n.split(",")){let i=o.trim();i.length>0&&t.push(i)}return}n!=null&&t.push(n)};return r(e),t}function v_(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())}import cC 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 lC(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 dC(e){let t=Object.keys(e).sort(),r={};for(let n of t){let o=e[n];o!==void 0&&(r[n]=Ss(o))}return r}function Ss(e){let t=lC(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(n=>Ss(n));if(e instanceof Date)return e.toISOString();let r=e;if(typeof r.toJSON=="function"){let n=r.toJSON();if(n!==e)return Ss(n)}return dC(e)}function L(e){return JSON.stringify(Ss(e))}function E_(e,t,r,n){for(let o=0;o<t.length;o+=1)if(!r.has(o)&&n(e,t[o]))return r.add(o),!0;return!1}function uC(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function fC(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function pC(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let r=[...t],n=new Set;for(let o of e)if(!E_(o,r,n,ne))return!1;return!0}function mC(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let r=[...t.entries()],n=new Set;for(let[o,i]of e.entries())if(!E_([o,i],r,n,([a,c],[l,d])=>ne(a,l)&&ne(c,d)))return!1;return!0}function _C(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((r,n)=>ne(r,t[n]))}function gC(e,t){let r=Object.keys(e).sort((o,i)=>o.localeCompare(i)),n=Object.keys(t).sort((o,i)=>o.localeCompare(i));if(r.length!==n.length)return!1;for(let o=0;o<r.length;o+=1){let i=r[o];if(i!==n[o]||!ne(e[i],t[i]))return!1}return!0}var yC=[uC,fC,pC,mC,_C];function ne(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let r of yC){let n=r(e,t);if(n!==void 0)return n}return gC(e,t)}function Os(e){return cC.createHash("sha256").update(e,"utf8").digest("hex")}function R(e,t){let r={};for(let o of t){let i=e[o];i!==void 0&&(r[o]=i)}let n=Object.keys(e).filter(o=>!t.includes(o)).sort((o,i)=>o.localeCompare(i));for(let o of n){let i=e[o];i!==void 0&&(r[o]=i)}return 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]="736cf7fc-d4da-57ce-90d8-2432085dd2c8")}catch{}})();var hC=5e3;async function xo(e,t,r){let n=[];for(let o of e)try{await o.run(U(r))}catch{n.push(`extension_hook_failed:${o.layer}:${o.name}:${t}`)}return n}async function T_(e,t){return xo(e.beforeCommand,"beforeCommand",t)}function bC(e,t,r){if(e===void 0)return;if(typeof e!="object"||e===null||!("allow"in e)||e.allow!==!0&&e.allow!==!1)throw new g(`Extension mutation guard ${t.name} returned an invalid decision.`,_.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 n=e,o=typeof n.code=="string"?n.code.trim():"",i=typeof n.remediation=="string"?n.remediation.trim():"";if(o.length===0||i.length===0)throw new g(`Extension mutation guard ${t.name} returned an invalid denial.`,_.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 n.message=="string"?n.message.trim():"";throw new g(s||`Extension mutation guard ${t.name} denied ${r}.`,_.CONFLICT,{code:o,reason:`${t.layer}:${t.name}`,nextSteps:[i]})}async function Ul(e,t){for(let r of e.beforeMutation??[]){let n,o;try{let i=Promise.resolve().then(()=>r.run({pm_root:t.pm_root,operation:t.operation,before:t.before===null?null:U(t.before),after:t.after===null?null:U(t.after),changed_fields:[...t.changed_fields],sdk:t.sdk}));i.catch(()=>{}),n=await Promise.race([i,new Promise((s,a)=>{o=setTimeout(()=>{a(new g(`Extension mutation guard ${r.name} timed out before ${t.operation}.`,_.CONFLICT,{code:"extension_mutation_guard_timed_out",reason:`${r.layer}:${r.name}`,nextSteps:["Fix or disable the stalled extension guard, then retry the mutation."]}))},hC),o.unref?.()})])}catch(i){throw i instanceof g?i:new g(`Extension mutation guard ${r.name} failed before ${t.operation}.`,_.CONFLICT,{code:"extension_mutation_guard_failed",reason:`${r.layer}:${r.name}`,nextSteps:["Fix or disable the failing extension guard, then retry the mutation."]})}finally{clearTimeout(o)}bC(n,r,t.operation)}}async function k_(e,t){return xo(e.afterCommand,"afterCommand",t)}async function zl(e,t){return xo(e.onWrite,"onWrite",t)}async function ql(e,t){return xo(e.onRead,"onRead",t)}async function Hl(e,t){return xo(e.onIndex,"onIndex",t)}function wC(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 r=t.replace(/\s+/gu," ").trim();if(r.length===0)return"";let n=300;return r.length>n?`${r.slice(0,n-1)}\u2026`:r}function Cs(e,t){if(typeof e!="object"||e===null||typeof e[t]!="string")return;let r=String(e[t]).replace(/\s+/gu," ").trim();return r.length>0?r.slice(0,300):void 0}function vC(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 Gl(e,t){let r=J(t.command);if(r.length===0)return{handled:!1,result:null,warnings:[]};let n=[...e.handlers].reverse().find(o=>o.command===r);if(!n)return{handled:!1,result:null,warnings:[]};try{let o=await n.run({command:r,args:U(t.args),options:U(t.options),global:U(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",vC(o)],["errorCode",Cs(o,"code")],["remediation",Cs(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:${n.layer}:${n.name}:${n.command}`],errorMessage:wC(o),...Object.fromEntries([["errorCode",Cs(o,"code")],["remediation",Cs(o,"remediation")]].filter(s=>s[1]!==void 0))}}}async function Bl(e,t){let r=J(t.command);if(r.length===0)return{overridden:!1,context:{command:r,args:U(t.args),options:Le(t.options),global:Fe(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},warnings:[]};let n=[...e.overrides].reverse().find(o=>o.command===r);if(!n)return{overridden:!1,context:{command:r,args:U(t.args),options:Le(t.options),global:Fe(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},warnings:[]};try{let o=await Promise.resolve(n.run({command:r,args:U(t.args),options:Le(t.options),global:Fe(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}))??{},i=Array.isArray(o.args)?U(o.args):U(t.args),s=o.options?Le(o.options):Le(t.options),a=o.global?Fe(o.global):Fe(t.global);return{overridden:!0,context:{command:r,args:i,options:s,global:a,pm_root:t.pm_root,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel},warnings:[]}}catch{return{overridden:!1,context:{command:r,args:U(t.args),options:Le(t.options),global:Fe(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},warnings:[`extension_parser_override_failed:${n.layer}:${n.name}:${n.command}`]}}}async function Vl(e,t){let r={command:J(t.command),args:U(t.args),options:Le(t.options),global:Fe(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},n=U(t.decision),o=[...e.overrides].reverse().find(i=>!i.commands?.length||i.commands.includes(r.command));if(!o)return{overridden:!1,context:r,decision:n,warnings:[]};try{let i=await Promise.resolve(o.run({command:r.command,args:U(r.args),options:Le(r.options),global:Fe(r.global),pm_root:r.pm_root,source_workspace_root:r.source_workspace_root,repo_root:r.repo_root,pm_root_rel:r.pm_root_rel,decision:U(n)}))??{},s={command:r.command,args:Array.isArray(i.args)?U(i.args):r.args,options:i.options?Le(i.options):r.options,global:i.global?Fe(i.global):r.global,pm_root:r.pm_root,source_workspace_root:r.source_workspace_root,repo_root:r.repo_root,pm_root_rel:r.pm_root_rel},a={enforce_item_format_gate:typeof i.enforce_item_format_gate=="boolean"?i.enforce_item_format_gate:n.enforce_item_format_gate,run_preflight_item_format_sync:typeof i.run_preflight_item_format_sync=="boolean"?i.run_preflight_item_format_sync:n.run_preflight_item_format_sync,run_extension_migrations:typeof i.run_extension_migrations=="boolean"?i.run_extension_migrations:n.run_extension_migrations,enforce_mandatory_migration_gate:typeof i.enforce_mandatory_migration_gate=="boolean"?i.enforce_mandatory_migration_gate:n.enforce_mandatory_migration_gate};return{overridden:!0,context:s,decision:a,warnings:[]}}catch{return{overridden:!1,context:r,decision:n,warnings:[`extension_preflight_override_failed:${o.layer}:${o.name}`]}}}function A_(e){return{handled:!1,result:e.payload,warnings:[]}}function S_(e,t){return[...e.overrides].reverse().filter(r=>r.service===t)}function O_(e){return{service:e.service,command:e.command?J(e.command):void 0,args:e.args?U(e.args):void 0,options:e.options?Le(e.options):void 0,global:e.global?Fe(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:U(e.payload)}}function EC(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 C_(e,t){return EC(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 I_(e,t,r){return t.service==="output_format"&&typeof e=="object"&&e!==null&&ne(e,r.payload)}function R_(e,t,r){if(t.handled){if(e.passThrough===!0){r.push(`extension_service_pass_through_contract_violated:${e.layer}:${e.name}:${e.service}`);return}return{handled:!0,result:t.result,warnings:r}}}function Wl(e,t){let r=S_(e,t.service);if(r.length===0)return A_(t);let n=[];for(let o of r)try{let i=O_(t),s=o.run(i);if(s instanceof Promise){n.push(`extension_service_override_async_unsupported:${o.layer}:${o.name}:${o.service}`);continue}if(I_(s,t,i)){n.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=R_(o,C_(s,t),n);if(a)return a}catch{n.push(`extension_service_override_failed:${o.layer}:${o.name}:${o.service}`)}return{handled:!1,result:t.payload,warnings:n}}async function Yl(e,t){let r=S_(e,t.service);if(r.length===0)return A_(t);let n=[];for(let o of r)try{let i=O_(t),s=await Promise.resolve(o.run(i));if(I_(s,t,i)){n.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=R_(o,C_(s,t),n);if(a)return a}catch{n.push(`extension_service_override_failed:${o.layer}:${o.name}:${o.service}`)}return{handled:!1,result:t.payload,warnings:n}}function Kl(e,t){let r=J(t.command);if(r.length===0)return{overridden:!1,result:t.result,warnings:[]};let n=[...e.overrides].reverse().find(o=>o.command===r);if(!n)return{overridden:!1,result:t.result,warnings:[]};try{let o=Le(t.options),i=Fe(t.global),s=n.run({command:r,args:U(t.args),options:o,global:i,pm_root:t.pm_root,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel,result:U(t.result)});return s instanceof Promise?{overridden:!1,result:t.result,warnings:[`extension_command_override_async_unsupported:${n.layer}:${n.name}:${n.command}`]}:{overridden:!0,result:s,warnings:[]}}catch{return{overridden:!1,result:t.result,warnings:[`extension_command_override_failed:${n.layer}:${n.name}:${n.command}`]}}}function TC(e,t,r){if((e.commands?.length??0)>0&&!e.commands?.includes(t))return!1;if(e.resultDiscriminator===void 0)return!0;try{return e.resultDiscriminator(U(r))}catch{return!1}}function Xl(e,t){let r=typeof t.command=="string"?J(t.command):"",n=[...e.overrides].reverse().find(o=>o.format===t.format&&TC(o,r,t.result));if(!n)return{overridden:!1,rendered:null,warnings:[]};try{let o=Array.isArray(t.args)?U(t.args):[],i=Le(t.options),s=Fe(t.global),a=typeof t.pm_root=="string"?t.pm_root:"",c=n.run({format:t.format,command:r,args:o,options:i,global:s,pm_root:a,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel,result:U(t.result)});return c==null?{overridden:!1,rendered:null,warnings:[]}:typeof c!="string"?{overridden:!1,rendered:null,warnings:[`extension_renderer_invalid_result:${n.layer}:${n.name}:${n.format}`]}:{overridden:!0,rendered:c,warnings:[]}}catch{return{overridden:!1,rendered:null,warnings:[`extension_renderer_failed:${n.layer}:${n.name}:${n.format}`]}}}import xr from"node:fs/promises";import Rr from"node:path";import{pathToFileURL as sI}from"node:url";import x_ 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 Jl(e,t){let r=x_.relative(e,t);return r.length===0?!0:!r.startsWith("..")&&!x_.isAbsolute(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]="44b86710-2d6f-57fe-912d-1cf7482a4f86")}catch{}})();function N_(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(([r,n])=>[r,n.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[r,n]of Object.entries(t.registrations))e.registrations[r].length=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]="aade6230-a71b-5cbc-bc9d-022f20e521bd")}catch{}})();function pe(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return t}function be(e,t){if(t!==void 0&&typeof t!="boolean")throw new TypeError(`${e} must be a boolean when provided`)}function ie(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 D_(e,t){if(t===void 0)return;let r=n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean";if(Array.isArray(t)){for(let[n,o]of t.entries())if(!r(o))throw new TypeError(`${e}[${n}] must be a string, number, or boolean`);return}if(!r(t))throw new TypeError(`${e} must be a string, number, or boolean, or an array of these when provided`)}function Or(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[r,n]of t.entries())if(typeof n!="string"||n.trim().length===0)throw new TypeError(`${e}[${r}] must be a non-empty string`)}}function No(e,t){if(Or(e,t),!Array.isArray(t))return[];let r=[],n=new Set;for(let o of t){let i=o.trim();i.length===0||n.has(i)||(n.add(i),r.push(i))}return 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]="34536eba-0f92-5599-a807-5b39b000e733")}catch{}})();var Zl=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 kC=new Set(Zl);function AC(e){if(e!==void 0&&!kC.has(String(e)))throw new Error(`registerCommand definition.family must be one of: ${Zl.join(", ")}`)}function P_(e){ie("registerCommand definition.action",e.action),ie("registerCommand definition.family",e.family),ie("registerCommand definition.description",e.description),ie("registerCommand definition.intent",e.intent),ie("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");AC(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 SC(e){let t=pe("registerExporter options.output",e),r=new Set(["channel","receipt","media_type"]);for(let n of Object.keys(t))if(!r.has(n))throw new TypeError(`registerExporter options.output contains unsupported field ${n}`);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 ie("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 M_(e,t,r){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 n=SC(t.output);return!r&&n.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."),n}function Ql(e,t,r){return{registration:t,action:r,command:e.command,args:U(e.args),options:U(e.options),global:U(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 L_(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 Je(e){return typeof e!="string"?"":e.trim().toLowerCase()}function q(e){return new Set((e??[]).map(t=>t.trim().toLowerCase()).filter(t=>t.length>0))}function OC(e){let t=e.trim().toLowerCase();if(t.length===0)return"";let r=t.split(/[.:/]/).map(n=>n.replace(/[\s_-]+/g,"")).filter(n=>n.length>0);return r.length===0?"":r.length===1?r[0]:`${r[0]}.${r.slice(1).join("")}`}function En(e){return new Set((e??[]).map(t=>OC(t)).filter(t=>t.length>0))}function F_(e){let t=Je(e);return is.includes(t)?t:"off"}function $_(e){let t=Je(e);return ss.includes(t)?t:"off"}function Do(e){let t=Je(e);return as.includes(t)?t:"none"}function ed(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return Wm.includes(t)?t:void 0}function j_(e){if(typeof e=="string"){let t=ed(e)??"block";return{global:t,project:t}}return typeof e=="object"&&e!==null&&!Array.isArray(e)?{global:ed(e.global)??"block",project:ed(e.project)??"block"}:{global:"block",project:"block"}}function CC(e){return e.global===e.project?e.global:{global:e.global,project:e.project}}function W(e){return[...new Set(e)].sort((t,r)=>t.localeCompare(r))}function IC(e){let t=Je(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?Do(e.sandbox_profile):void 0,allowedCapabilities:q(e.allowed_capabilities),blockedCapabilities:q(e.blocked_capabilities),allowedSurfaces:En(e.allowed_surfaces),blockedSurfaces:En(e.blocked_surfaces),allowedCommands:q(e.allowed_commands),blockedCommands:q(e.blocked_commands),allowedActions:q(e.allowed_actions),blockedActions:q(e.blocked_actions),allowedServices:q(e.allowed_services),blockedServices:q(e.blocked_services)}}}function U_(e){let t=new Map;for(let r of e??[]){let n=IC(r);n&&t.set(n.name,n.normalized)}return t}function RC(e){let t=[],r=[...e.overridesByName.values()].sort((o,i)=>o.name.localeCompare(i.name));for(let o of W([...e.allowedCapabilities,...e.blockedCapabilities]))Kt(o)||t.push(`extension_policy_unknown_capability:${o}`);for(let o of r)for(let i of W([...o.allowedCapabilities,...o.blockedCapabilities]))Kt(i)||t.push(`extension_policy_unknown_capability:${o.name}:${i}`);let n=new Set(cs);for(let o of W([...e.allowedSurfaces,...e.blockedSurfaces]))n.has(o)||t.push(`extension_policy_unknown_surface:${o}`);for(let o of r)for(let i of W([...o.allowedSurfaces,...o.blockedSurfaces]))n.has(i)||t.push(`extension_policy_unknown_surface:${o.name}:${i}`);return[...new Set(t)].sort((o,i)=>o.localeCompare(i))}function z_(e){let t=e.extensions?.policy??{},r=q(t.allowed_capabilities),n=q(t.blocked_capabilities),o=En(t.allowed_surfaces),i=En(t.blocked_surfaces),s=U_(t.extension_overrides);return{mode:F_(t.mode),trustMode:$_(t.trust_mode),pmMaxVersionExceededMode:j_(t.pm_max_version_exceeded_mode),requireProvenance:t.require_provenance===!0,trustedExtensions:q(t.trusted_extensions),defaultSandboxProfile:Do(t.default_sandbox_profile),allowedExtensions:q(t.allowed_extensions),blockedExtensions:q(t.blocked_extensions),allowedCapabilities:r,blockedCapabilities:n,allowedSurfaces:o,blockedSurfaces:i,allowedCommands:q(t.allowed_commands),blockedCommands:q(t.blocked_commands),allowedActions:q(t.allowed_actions),blockedActions:q(t.blocked_actions),allowedServices:q(t.allowed_services),blockedServices:q(t.blocked_services),overridesByName:s,warnings:RC({allowedCapabilities:r,blockedCapabilities:n,allowedSurfaces:o,blockedSurfaces:i,overridesByName:s})}}function q_(e){let t=[...e.overridesByName.values()].sort((r,n)=>r.name.localeCompare(n.name)).map(r=>({name:r.name,...r.disabled?{disabled:!0}:{},...r.requireTrusted?{require_trusted:!0}:{},...r.requireProvenance?{require_provenance:!0}:{},...r.sandboxProfile?{sandbox_profile:r.sandboxProfile}:{},...r.allowedCapabilities.size>0?{allowed_capabilities:W(r.allowedCapabilities)}:{},...r.blockedCapabilities.size>0?{blocked_capabilities:W(r.blockedCapabilities)}:{},...r.allowedSurfaces.size>0?{allowed_surfaces:W(r.allowedSurfaces)}:{},...r.blockedSurfaces.size>0?{blocked_surfaces:W(r.blockedSurfaces)}:{},...r.allowedCommands.size>0?{allowed_commands:W(r.allowedCommands)}:{},...r.blockedCommands.size>0?{blocked_commands:W(r.blockedCommands)}:{},...r.allowedActions.size>0?{allowed_actions:W(r.allowedActions)}:{},...r.blockedActions.size>0?{blocked_actions:W(r.blockedActions)}:{},...r.allowedServices.size>0?{allowed_services:W(r.allowedServices)}:{},...r.blockedServices.size>0?{blocked_services:W(r.blockedServices)}:{}}));return{mode:e.mode,trust_mode:e.trustMode,pm_max_version_exceeded_mode:CC(e.pmMaxVersionExceededMode),require_provenance:e.requireProvenance,trusted_extensions:W(e.trustedExtensions),default_sandbox_profile:e.defaultSandboxProfile,allowed_extensions:W(e.allowedExtensions),blocked_extensions:W(e.blockedExtensions),allowed_capabilities:W(e.allowedCapabilities),blocked_capabilities:W(e.blockedCapabilities),allowed_surfaces:W(e.allowedSurfaces),blocked_surfaces:W(e.blockedSurfaces),allowed_commands:W(e.allowedCommands),blocked_commands:W(e.blockedCommands),allowed_actions:W(e.allowedActions),blocked_actions:W(e.blockedActions),allowed_services:W(e.allowedServices),blocked_services:W(e.blockedServices),extension_overrides:t}}function H_(e){let t=U_(e.extension_overrides);return{mode:F_(e.mode),trustMode:$_(e.trust_mode),pmMaxVersionExceededMode:j_(e.pm_max_version_exceeded_mode),requireProvenance:e.require_provenance===!0,trustedExtensions:q(e.trusted_extensions),defaultSandboxProfile:Do(e.default_sandbox_profile),allowedExtensions:q(e.allowed_extensions),blockedExtensions:q(e.blocked_extensions),allowedCapabilities:q(e.allowed_capabilities),blockedCapabilities:q(e.blocked_capabilities),allowedSurfaces:En(e.allowed_surfaces),blockedSurfaces:En(e.blocked_surfaces),allowedCommands:q(e.allowed_commands),blockedCommands:q(e.blocked_commands),allowedActions:q(e.allowed_actions),blockedActions:q(e.blocked_actions),allowedServices:q(e.allowed_services),blockedServices:q(e.blocked_services),overridesByName:t,warnings:[]}}function Jt(e,t){return e.overridesByName.get(Je(t))??null}function Tn(e,t,r,n,o){return t.has(r)?o:e.size>0&&!e.has(r)?n:null}function G_(e,t,r){let n=r.trim().toLowerCase(),o=Jt(e,t.name),i=o&&o.allowedCapabilities.size>0?o.allowedCapabilities:e.allowedCapabilities,s=new Set([...e.blockedCapabilities,...o?o.blockedCapabilities:[]]);return Tn(i,s,n,"capability_not_allowlisted","capability_blocked")}function xC(e,t,r){let n=Jt(e,t.name),o=n&&n.allowedSurfaces.size>0?n.allowedSurfaces:e.allowedSurfaces,i=new Set([...e.blockedSurfaces,...n?n.blockedSurfaces:[]]);return Tn(o,i,r,"surface_not_allowlisted","surface_blocked")}function NC(e,t,r){let n=J(r);if(n.length===0)return null;let o=Jt(e,t.name),i=o&&o.allowedCommands.size>0?o.allowedCommands:e.allowedCommands,s=new Set([...e.blockedCommands,...o?o.blockedCommands:[]]);return Tn(i,s,n,"command_not_allowlisted","command_blocked")}function DC(e,t,r){let n=Je(r).replace(/\s+/g,"-");if(n.length===0)return null;let o=Jt(e,t.name),i=o&&o.allowedActions.size>0?o.allowedActions:e.allowedActions,s=new Set([...e.blockedActions,...o?o.blockedActions:[]]);return Tn(i,s,n,"action_not_allowlisted","action_blocked")}function PC(e,t,r){let n=Je(r);if(n.length===0)return null;let o=Jt(e,t.name),i=o&&o.allowedServices.size>0?o.allowedServices:e.allowedServices,s=new Set([...e.blockedServices,...o?o.blockedServices:[]]);return Tn(i,s,n,"service_not_allowlisted","service_blocked")}function MC(e,t){let r=Je(t.name);return Jt(e,t.name)?.disabled===!0?"extension_override_disabled":Tn(e.allowedExtensions,e.blockedExtensions,r,"extension_not_allowlisted","extension_blocked")}function LC(e,t){if(e.trustMode==="off")return null;let r=Jt(e,t.name),n=Je(t.name),o=t.trusted===!0,i=t.provenanceVerified===!0;return e.trustedExtensions.size>0&&!e.trustedExtensions.has(n)?"extension_not_trusted":(r?.requireTrusted===!0||e.trustMode==="warn"||e.trustMode==="enforce")&&!o?"extension_untrusted":(e.requireProvenance||r?.requireProvenance===!0)&&!i?"provenance_missing_or_unverified":null}function FC(e,t){if(e.mode==="off")return null;let n=Jt(e,t.name)?.sandboxProfile??t.sandboxProfile??e.defaultSandboxProfile;if(n==="none")return null;let o=t.permissions;if(!o)return"sandbox_permissions_missing";let i=s=>o[s]===!0;return n==="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 Is(e,t,r,n,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}:${r.layer}:${r.name}:reason=${n}${s}`}function B_(e,t){if(e.mode==="off"&&e.trustMode==="off")return{allowed:!0,warning:null};let r=[],n=MC(e,t);n&&r.push({reason:n,scope:"extension",mode:e.mode});let o=LC(e,t);o&&r.push({reason:o,scope:"trust",mode:e.trustMode});let i=FC(e,t);i&&r.push({reason:i,scope:"extension",mode:e.mode});let s=r.find(c=>c.mode==="enforce");if(s)return{allowed:!1,warning:Is("blocked",s.scope,t,s.reason)};let a=r.find(c=>c.mode==="warn");return a?{allowed:!0,warning:Is("violation",a.scope,t,a.reason)}:{allowed:!0,warning:null}}function V_(e,t,r){if(e.mode==="off")return{allowed:!0,warning:null};let n=G_(e,t,r);return n?{allowed:e.mode==="warn",warning:Is(e.mode==="warn"?"violation":"blocked","capability",t,n,{capability:r.trim().toLowerCase()})}:{allowed:!0,warning:null}}function $C(e,t,r,n,o){let i=typeof n=="string"?G_(e,t,n):null,s=xC(e,t,r),a=o.command?NC(e,t,o.command):null,c=o.action?DC(e,t,o.action):null,l=o.service?PC(e,t,o.service):null;return i??s??a??c??l}function jC(e,t,r,n){let o={method:Je(e).replace(/\s+/g,"_"),surface:t};return r&&(o.capability=r),n.command&&(o.command=J(n.command)),n.action&&(o.action=Je(n.action).replace(/\s+/g,"-")),n.service&&(o.service=Je(n.service)),o}function W_(e,t,r,n,o,i){if(e.mode==="off")return{allowed:!0,warning:null};let s=i??{},a=$C(e,t,r,o,s);if(!a)return{allowed:!0,warning:null};let c=Is(e.mode==="warn"?"violation":"blocked","registration",t,a,jC(n,r,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]="1c944ddd-e05b-5d8c-bdc5-7bc9677fa5d1")}catch{}})();var K_=100;function Y_(e,t){let r=e[t];if(r!=null)return typeof r!="string"||r.trim().length===0?null:r.trim()}function UC(e){if(e==null)return;let t=Wt(e);if(!t)return null;let r={};for(let n of Object.keys(t).sort((o,i)=>o.localeCompare(i))){if(n.trim().length===0)return null;let o=t[n];if(typeof o!="string"||o.trim().length===0)return null;r[n.trim()]=o.trim()}return Object.keys(r).length>0?r:void 0}function td(e,t){let r=e[t];return typeof r!="string"||r.trim().length===0?null:r.trim()}function X_(e){if(e!=null)return typeof e!="number"||!Number.isInteger(e)?null:e}function Cr(e){if(e!=null)return typeof e!="boolean"?null:e}function zC(e){let t=X_(e.priority);return t===void 0?K_:t}function qC(e){let t=e.sandbox_profile;if(t==null)return;if(typeof t!="string")return null;let r=Do(t);return r!==t.trim().toLowerCase()?null:r}function rd(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function HC(e){if(e==null)return;let t=Wt(e);if(!t)return null;let r=rd(t.source),n=rd(t.signature),o=rd(t.attestation),i=t.verified===void 0||t.verified===null?void 0:typeof t.verified=="boolean"?t.verified:null;return i===null?null:{...r?{source:r}:{},...n?{signature:n}:{},...o?{attestation:o}:{},...typeof i=="boolean"?{verified:i}:{}}}function GC(e){if(e==null)return;let t=Wt(e);if(!t)return null;let r=Cr(t.fs_read),n=Cr(t.fs_write),o=Cr(t.network),i=Cr(t.env_read),s=Cr(t.env_write),a=Cr(t.process_spawn);return[r,n,o,i,s,a].includes(null)?null:{...typeof r=="boolean"?{fs_read:r}:{},...typeof n=="boolean"?{fs_write:n}:{},...typeof o=="boolean"?{network:o}:{},...typeof i=="boolean"?{env_read:i}:{},...typeof s=="boolean"?{env_write:s}:{},...typeof a=="boolean"?{process_spawn:a}:{}}}function BC(e){if(e==null)return{capabilities:[],legacy_aliases:[]};if(!Array.isArray(e)||e.some(r=>typeof r!="string"))return null;let t=__(e);return{capabilities:t.capabilities,legacy_aliases:t.legacy_aliases}}function VC(e){if(e==null)return;let t=Wt(e);if(!t)return null;let r=t.commands;if(r==null)return;if(!Array.isArray(r)||r.some(o=>typeof o!="string"))return null;let n=[...new Set(r.map(o=>J(o)).filter(o=>o.length>0))].sort((o,i)=>o.localeCompare(i));return n.length>0?{commands:n}:void 0}function WC(e){let t=X_(e.manifest_version);if(t===null)return null;let r=Y_(e,"pm_min_version");if(r===null)return null;let n=Y_(e,"pm_max_version");if(n===null)return null;let o=UC(e.engines);if(o===null)return null;let i=Cr(e.trusted);if(i===null)return null;let s=qC(e);if(s===null)return null;let a=HC(e.provenance);if(a===null)return null;let c=GC(e.permissions);if(c===null)return null;let l=BC(e.capabilities);if(l===null)return null;let d=VC(e.activation);if(d===null)return null;let u=ks(e.contributions);return u===null?null:{manifest_version:t,pm_min_version:r,pm_max_version:n,engines:o,trusted:i,sandbox_profile:s,provenance:a,permissions:c,capabilities:l.capabilities,legacy_capability_aliases:l.legacy_aliases,activation:d,contributions:u}}function nd(e){if(typeof e!="object"||e===null)return null;let t=e,r=td(t,"name");if(r===null)return null;let n=td(t,"version");if(n===null)return null;let o=td(t,"entry");if(o===null)return null;let i=zC(t);if(i===null)return null;let s=WC(t);return s===null?null:{name:r,version:n,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 YC from"node:fs/promises";import Po 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 J_(e,t){let r=Po.dirname(t.manifest_path),n=Po.relative(r,t.entry_path);if(n.startsWith("..")||Po.isAbsolute(n))throw new Error(`Cannot snapshot extension entry outside its package directory: ${t.entry_path}`);let o=Po.join(e,`${t.layer}-${t.directory.replace(/[^a-zA-Z0-9._-]/gu,"_")}`);return await w_("extension_module_graph_snapshot",()=>YC.cp(r,o,{recursive:!0,force:!0})),Po.join(o,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]="092f2852-fa07-5f0f-8266-e9e2ca078cb6")}catch{}})();function Z_(e){let t=typeof e=="function"?e:e.run;if(typeof t!="function")throw new TypeError("registerPreflight override requires a function handler");let r=[...new Set((typeof e=="function"?[]:e.commands??[]).map(n=>{if(typeof n!="string"||n.trim().length===0)throw new TypeError("registerPreflight ownership.commands must contain non-empty command paths");return J(n)}))];return{run:t,...r.length>0?{commands:r}:{}}}function Q_(e){let t=[];for(let r=1;r<e.overrides.length;r+=1){let n=e.overrides[r];for(let o of e.overrides.slice(0,r))n.commands?.length&&o.commands?.length&&!o.commands.some(i=>n.commands.includes(i))||t.push(`extension_preflight_override_collision:${n.layer}:${n.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 od=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"}]),id=new Set(od.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 KC=/^--[a-z0-9][a-z0-9_-]*(?:[ =](?:<[^<>]+>|\[[^[\]]+\]))?$/;function XC(e){if(typeof e!="string")return null;let t=e.trim(),r=t.split(/[ =]/,1)[0];return id.has(r)?"host_owned_flag_collision":KC.test(t)?null:"malformed_long_flag"}function eg(e,t){let r=[e,t].find(i=>typeof i=="string"&&id.has(i.trim().split(/[ =]/,1)[0]));if(typeof r=="string")return{token:r.trim().split(/[ =]/,1)[0],failure:"host_owned_flag_collision"};if(typeof e!="string")return null;let n=e.trim(),o=XC(n);return o===null?null:{token:n,failure:o}}function tg(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]="99f785c2-7c67-5564-9423-3439c41b4557")}catch{}})();var Rs=wn;function xs(e){let t=e.trim().toLowerCase();return Rs.includes(t)?t:null}function rg(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let r=Math.max(1,Math.floor(t.length*.34));for(let n of Rs)if(ot(t,n,r)!==null)return n;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 ng(e){return e==="toon"||e==="json"}function og(e){return gn.includes(e)}function Ir(e,t){if(typeof t!="function")throw new TypeError(`api.hooks.${e} requires a function handler`)}var ig=Symbol("extension_registration_trace");function Rt(e,t){let r=new TypeError(e);return Object.defineProperty(r,ig,{value:t,enumerable:!1,configurable:!1,writable:!1}),r}function sg(e){return e instanceof Error?e[ig]:void 0}function Mo(e){if(e===null)return null;if(Array.isArray(e))return e.map(t=>Mo(t));if(typeof e=="function")return"[Function]";if(typeof e=="bigint"||typeof e=="symbol")return e.toString();if(typeof e=="object"){let t=e,r={};for(let n of Object.keys(t).sort((o,i)=>o.localeCompare(i)))r[n]=Mo(t[n]);return r}return e}function Lo(e){if(Array.isArray(e))return e.map(t=>Lo(t));if(typeof e=="object"&&e!==null){let t=e,r={};for(let n of Object.keys(t).sort((o,i)=>o.localeCompare(i)))r[n]=Lo(t[n]);return r}return e}function kn(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Mo(t)}function Fo(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Lo(t)}function $o(e,t){if(!Array.isArray(t))throw new TypeError(`${e} requires an array of object definitions`);return t.map(r=>kn(e,r))}function ke(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function jo(e,t){if(typeof t!="function")throw new TypeError(`${e} requires a function handler`)}function sd(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function ad(e,t){return J(`${e} ${t}`)}function Uo(e,t){return Object.defineProperty(e,"runtime_definition",{value:t,enumerable:!1,writable:!1,configurable:!1}),e}var JC=new Set(["low","medium","high"]),ZC=new Set(["number","string_set"]),QC=new Set(["string","number","boolean"]);function ag(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function eI(e,t,r){let n=`registerAssuranceMeasurementProvider provider.keys.${t}`,o=pe(n,r);if(!ZC.has(String(o.value_type)))throw new TypeError(`${n}.value_type must be number or string_set`);if(ie(`${n}.description`,o.description),o.parameters===void 0)return;let i=pe(`${n}.parameters`,o.parameters);for(let[s,a]of Object.entries(i)){let c=`${n}.parameters.${s}`;ag(`${c}.name`,s);let l=pe(c,a);if(!QC.has(String(l.type)))throw new TypeError(`${c}.type must be string, number, or boolean`);be(`${c}.required`,l.required),ie(`${c}.description`,l.description)}if(Object.keys(i).length>50)throw new TypeError(`assurance provider ${e} key ${t} exceeds 50 parameters`)}function cg(e){let t=pe("registerAssuranceMeasurementProvider provider",e),r=ag("registerAssuranceMeasurementProvider provider.id",t.id);if(!/^[a-z0-9][a-z0-9-]*$/u.test(r))throw new TypeError("registerAssuranceMeasurementProvider provider.id must be a stable lowercase id");if(!JC.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 n=pe("registerAssuranceMeasurementProvider provider.keys",t.keys);if(Object.keys(n).length===0)throw new TypeError("registerAssuranceMeasurementProvider provider.keys requires at least one key");for(let[o,i]of Object.entries(n)){if(!/^[a-z0-9][a-z0-9-]*$/u.test(o))throw new TypeError(`registerAssuranceMeasurementProvider provider key ${o} must be a stable lowercase id`);eI(r,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 tI=new Set(["default","description","enabled","list","long","repeatable","required","short","type","value_name","value_type","visible"]);function Ns(e,t){return $o(e,t).map(r=>(r.repeatable===!0&&(r.list=!0),r))}function rI(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function cd(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 r=rI(t);if(r.length===0)throw new TypeError("registerCommand definition.action must contain alphanumeric characters");return r}function ld(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[n,o]of e.entries()){let i=pe(`registerCommand definition.arguments[${n}]`,o),s=ke(`registerCommand definition.arguments[${n}].name`,i.name);if(be(`registerCommand definition.arguments[${n}].required`,i.required),be(`registerCommand definition.arguments[${n}].variadic`,i.variadic),ie(`registerCommand definition.arguments[${n}].description`,i.description),s.includes(" "))throw new TypeError(`registerCommand definition.arguments[${n}].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 r=t.map((n,o)=>n.variadic?o:-1).filter(n=>n>=0);if(r.length>1)throw new TypeError("registerCommand definition.arguments supports at most one variadic argument");if(r.length===1&&r[0]!==t.length-1)throw new TypeError("registerCommand definition.arguments variadic argument must be the final argument");return t}function Ds(e){if(!Array.isArray(e))throw new TypeError("registerFlags flags requires an array of object definitions");for(let[t,r]of e.entries()){let n=pe(`registerFlags flags[${t}]`,r),o=Object.keys(n).filter(c=>!tI.has(c)).sort((c,l)=>c.localeCompare(l));if(o.length>0)throw new TypeError(`registerFlags flags[${t}] contains unknown field(s): ${o.join(", ")}`);let i=n.long,s=n.short;if(i===void 0&&s===void 0)throw new TypeError(`registerFlags flags[${t}] requires at least one of long or short`);ie(`registerFlags flags[${t}].long`,i),ie(`registerFlags flags[${t}].short`,s);let a=eg(i,s);if(a!==null)throw new TypeError(`registerFlags flags[${t}] ${tg(a.token,a.failure)}`);if(ie(`registerFlags flags[${t}].value_name`,n.value_name),ie(`registerFlags flags[${t}].description`,n.description),be(`registerFlags flags[${t}].required`,n.required),be(`registerFlags flags[${t}].enabled`,n.enabled),be(`registerFlags flags[${t}].visible`,n.visible),be(`registerFlags flags[${t}].list`,n.list),be(`registerFlags flags[${t}].repeatable`,n.repeatable),n.list!==void 0&&n.repeatable!==void 0&&n.list!==n.repeatable)throw new TypeError(`registerFlags flags[${t}].list and repeatable must match when both are provided`);if(D_(`registerFlags flags[${t}].default`,n.default),Array.isArray(n.default)&&n.list!==!0&&n.repeatable!==!0)throw new TypeError(`registerFlags flags[${t}].default cannot be an array unless list is true.`);lg(`registerFlags flags[${t}]`,n)}}function lg(e,t){let r=(typeof t.value_type=="string"?t.value_type:void 0)??(typeof t.type=="string"?t.type:void 0);if(r===void 0)return;let n=$l(r);if(n===null)throw new TypeError(`${e} value_type "${r}" 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?jl(t.default):[t.default];for(let[i,s]of o.entries())if(!v_(s,n)){let a=o.length>1?`default[${i}]`:"default";throw new TypeError(`${e}.${a} (${JSON.stringify(s)}) is not coercible to ${n}.`)}}function dg(e){if(!Array.isArray(e))throw new TypeError("registerItemFields fields requires an array of object definitions");for(let[t,r]of e.entries()){let n=pe(`registerItemFields fields[${t}]`,r);ke(`registerItemFields fields[${t}].name`,n.name);let o=ke(`registerItemFields fields[${t}].type`,n.type);if(xs(o)===null){let i=rg(o),s=i?` Did you mean "${i}"?`:"";throw new TypeError(`registerItemFields fields[${t}].type "${o}" is not a known field type (expected one of: ${Rs.join(", ")}).${s}`)}be(`registerItemFields fields[${t}].optional`,n.optional)}}function nI(e,t){if(t===void 0)return;let r=`registerItemTypes types[${e}].command_option_policies`;if(!Array.isArray(t))throw new TypeError(`${r} must be an array when provided`);for(let[n,o]of t.entries()){let i=`${r}[${n}]`,s=pe(i,o);ke(`${i}.command`,s.command),ke(`${i}.option`,s.option),be(`${i}.enabled`,s.enabled),be(`${i}.required`,s.required),be(`${i}.visible`,s.visible)}}function oI(e,t){if(t===void 0)return;let r=`registerItemTypes types[${e}].options`;if(!Array.isArray(t))throw new TypeError(`${r} must be an array when provided`);for(let[n,o]of t.entries()){let i=`${r}[${n}]`,s=pe(i,o);ke(`${i}.key`,s.key),Or(`${i}.values`,s.values),be(`${i}.required`,s.required),Or(`${i}.aliases`,s.aliases)}}function ug(e){if(!Array.isArray(e))throw new TypeError("registerItemTypes types requires an array of object definitions");for(let[t,r]of e.entries()){let n=`registerItemTypes types[${t}]`,o=pe(n,r);ke(`${n}.name`,o.name),ie(`${n}.folder`,o.folder),Or(`${n}.aliases`,o.aliases),Or(`${n}.required_create_fields`,o.required_create_fields),Or(`${n}.required_create_repeatables`,o.required_create_repeatables),nI(t,o.command_option_policies),oI(t,o.options)}}function fg(e){let t=pe("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(be("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 pg=["types","statuses","fields","workflows","config","templates","packages"],iI={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[r,n]of t.allowed_transitions.entries())if(!Array.isArray(n))throw new TypeError(`${e}.allowed_transitions[${r}] 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 mg(e){let t=pe("registerProfile profile",e);if(ke("registerProfile profile.name",t.name),ke("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 r of pg){let n=t[r];if(n!==void 0){if(!Array.isArray(n))throw new TypeError(`registerProfile profile.${r} must be an array when provided`);for(let[o,i]of n.entries()){if(typeof i!="object"||i===null||Array.isArray(i))throw new TypeError(`registerProfile profile.${r}[${o}] must be an object`);iI[r]?.(`registerProfile profile.${r}[${o}]`,i)}}}}function _g(e){e.summary===void 0&&(e.summary="");for(let t of pg)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 gg(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 yg(e){return typeof e=="string"?e:String(e)}function zo(e){let r=e.trim().replace(/^>=\s*/,"").replace(/^v/i,"").split(/[+-]/,1)[0];return/^\d+(?:[.-]\d+)*$/.test(r)?r.split(/[.-]/).map(n=>Number(n)):null}function dd(e,t){let r=zo(e),n=zo(t);if(!r||!n)return null;let o=Math.max(r.length,n.length);for(let i=0;i<o;i+=1){let s=r[i]??0,a=n[i]??0;if(s>a)return 1;if(s<a)return-1}return 0}function hg(e,t){if(e==null)return{kind:"pm_min_version",status:"absent",allowed:!0,required:"",current:t};let r=yg(e);if(typeof e!="string"||r.trim().length===0)return{kind:"pm_min_version",status:"invalid",allowed:!1,required:r,current:t};if(!zo(r))return{kind:"pm_min_version",status:"invalid",allowed:!1,required:r,current:t};if(t===null)return{kind:"pm_min_version",status:"unchecked",allowed:!0,required:r,current:null};let n=dd(t,r);return n===null?{kind:"pm_min_version",status:"unchecked",allowed:!0,required:r,current:t}:n<0?{kind:"pm_min_version",status:"unmet",allowed:!1,required:r,current:t}:{kind:"pm_min_version",status:"ok",allowed:!0,required:r,current:t}}function bg(e,t,r){if(e==null)return{kind:"pm_max_version",status:"absent",allowed:!0,required:"",current:t};let n=yg(e);if(typeof e!="string"||n.trim().length===0)return{kind:"pm_max_version",status:"invalid",allowed:!1,required:n,current:t};if(/^[<>=~^]/.test(n.trim())||!zo(n))return{kind:"pm_max_version",status:"invalid",allowed:!1,required:n,current:t};if(t===null)return{kind:"pm_max_version",status:"unchecked",allowed:!0,required:n,current:null};let o=dd(t,n);return o===null?{kind:"pm_max_version",status:"unchecked",allowed:!0,required:n,current:t}:o>0?r==="warn"?{kind:"pm_max_version",status:"exceeded_warn",allowed:!0,required:n,current:t}:{kind:"pm_max_version",status:"exceeded",allowed:!1,required:n,current:t}:{kind:"pm_max_version",status:"ok",allowed:!0,required:n,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]="3ee03fc2-5b71-508c-8524-d22104fa2194")}catch{}})();var wg=null,aI=Object.freeze(ls()),vg=0;function cI(e=Date.now()){return vg+=1,`${vg}-${e}`}function lI(e,t,r){return r.has(e)?!1:t.size===0?!0:t.has(e)}async function dI(e,t){let[r,n]=await Promise.all([xr.realpath(e),xr.realpath(t)]);return Jl(r,n)}function Cg(e,t=process.cwd()){return{global:Rr.join(It(t),"extensions"),project:Rr.join(e,"extensions")}}async function uI(e){try{return(await xr.readdir(e,{withFileTypes:!0})).filter(r=>r.isDirectory()).map(r=>r.name).sort((r,n)=>r.localeCompare(n))}catch{return[]}}function fI(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 Eg(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}async function pI(e){let t=new Map;try{let r=JSON.parse(await xr.readFile(Rr.join(e,".managed-extensions.json"),"utf8")),o=Wt(r)?.entries;if(!Array.isArray(o))return t;for(let i of o){if(typeof i!="object"||i===null)continue;let s=i,a=Eg(s.source?.package),c=[s.source?.input,s.source?.name,a].map(u=>Eg(u)).filter(u=>u!==void 0),l=ks(s.contributions),d={aliases:[...new Set(c)],...a?{package_name:a}:{},...l?{contributions:l}:{}};typeof s.directory=="string"&&s.directory.trim().length>0&&t.set(`directory:${s.directory.trim()}`,d),typeof s.name=="string"&&s.name.trim().length>0&&t.set(`name:${s.name.trim()}`,d)}}catch{return t}return t}function Tg(e){return[...e].sort((t,r)=>{if(t.manifest.priority!==r.manifest.priority)return t.manifest.priority-r.manifest.priority;let n=t.manifest.name.localeCompare(r.manifest.name);return n!==0?n:t.directory.localeCompare(r.directory)})}function mI(e,t){let r=[...Tg(e),...Tg(t)],n=[];for(let o of r){let i=n.findIndex(s=>s.manifest.name===o.manifest.name);i>=0&&n.splice(i,1),n.push(o)}return n}async function kg(e,t,r,n,o){let i=[],s=[],a=[],c=await uI(t),l=await pI(t);for(let d of c){let u=await yI(e,t,d,r,n,l,o);i.push(u.diagnostic),s.push(...u.warnings),u.candidate&&a.push(u.candidate)}return{diagnostics:i,warnings:s,candidates:a}}function _I(){return{diagnostics:[],warnings:[],candidates:[]}}function Ag(e,t,r,n){return{diagnostic:{layer:e,directory:t,manifest_path:r,name:null,version:null,entry:null,priority:null,entry_path:null,enabled:null,status:"warn"},warnings:[n],candidate:null}}function gI(e,t,r,n,o,i,s){let a=h_(e,t,r);Array.isArray(t.legacy_capability_aliases)&&t.legacy_capability_aliases.length>0&&a.push(y_(e,t.name,t.legacy_capability_aliases));for(let c of m_(t.capabilities))a.push(g_(e,t.name,c));return n?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 yI(e,t,r,n,o,i,s){let a=Rr.join(t,r),c=Rr.join(a,"manifest.json");if(!await re(c))return Ag(e,r,c,`extension_manifest_missing:${e}:${r}`);let l,d;try{let P=JSON.parse(await xr.readFile(c,"utf8"));d=Wt(P),l=nd(P)}catch{d=null,l=null}if(!l||!d)return Ag(e,r,c,`extension_manifest_invalid:${e}:${r}`);let u=Rr.resolve(a,l.entry),f=Jl(a,u),p=f?await re(u):!1,m=f&&p?await dI(a,u):f,h=lI(l.name,n,o),b=await bI(e,l),w=await wI(e,l,s),E=gI(e,l,d,m,p,b,w),C=m&&p&&b.allowed&&w.allowed,V=i.get(`directory:${r}`)??i.get(`name:${l.name}`);return{diagnostic:{layer:e,directory:r,manifest_path:c,name:l.name,version:l.version,entry:l.entry,priority:l.priority,entry_path:u,enabled:h,status:C?"ok":"warn"},warnings:E,candidate:L_({layer:e,directory:r,manifestPath:c,entryPath:u,manifest:l,sourceIdentity:V,extensionReady:C,enabledForLoad:h})}}async function Ig(e){let t=Cg(e.pmRoot,e.cwd??process.cwd()),r=Io(e.settings.extensions.enabled),n=Io(e.settings.extensions.disabled),o=z_(e.settings),i=q_(o);if(e.noExtensions)return{disabled_by_flag:!0,roots:t,configured_enabled:r,configured_disabled:n,discovered:[],effective:[],warnings:[...o.warnings],policy:i};let s=new Set(r),a=new Set(n),c=e.ignoreGlobalExtensions===!0?_I():await kg("global",t.global,s,a,o.pmMaxVersionExceededMode.global),l=await kg("project",t.project,s,a,o.pmMaxVersionExceededMode.project),d=[...o.warnings],u=mI(c.candidates,l.candidates),f=[];for(let p of u){let m={layer:p.layer,name:p.manifest.name,trusted:p.manifest.trusted===!0,provenanceVerified:p.manifest.provenance?.verified===!0,sandboxProfile:p.manifest.sandbox_profile,permissions:p.manifest.permissions&&typeof p.manifest.permissions=="object"?{fs_read:p.manifest.permissions.fs_read,fs_write:p.manifest.permissions.fs_write,network:p.manifest.permissions.network,env_read:p.manifest.permissions.env_read,env_write:p.manifest.permissions.env_write,process_spawn:p.manifest.permissions.process_spawn}:void 0},h=B_(o,m);if(h.warning&&d.push(h.warning),!!h.allowed){for(let b of p.manifest.capabilities){let w=V_(o,m,b);w.warning&&d.push(w.warning)}f.push(fI(p))}}return{disabled_by_flag:!1,roots:t,configured_enabled:r,configured_disabled:n,discovered:[...c.diagnostics,...l.diagnostics],effective:f,warnings:[...new Set([...c.warnings,...l.warnings,...d])],policy:i}}function Ps(e){return e instanceof Error&&e.message.trim().length>0?e.message:String(e)}async function hI(){try{let e=Ct(import.meta.url,["../../.."]),t=await xr.readFile(Rr.join(e,"package.json"),"utf8"),r=JSON.parse(t);return typeof r.version=="string"&&r.version.trim().length>0?r.version.trim():null}catch{return null}}function Rg(){return wg??=hI(),wg}function xg(e,t,r){let n=r.current??"unknown";if(r.kind==="pm_min_version")switch(r.status){case"invalid":return`extension_pm_min_version_invalid:${e}:${t.name}:required=${r.required}`;case"unchecked":return`extension_pm_min_version_unchecked:${e}:${t.name}:required=${r.required}:current=${n}`;case"unmet":return`extension_pm_min_version_unmet:${e}:${t.name}:required=${r.required}:current=${n}`;default:return}switch(r.status){case"invalid":return`extension_pm_max_version_invalid:${e}:${t.name}:allowed=${r.required}`;case"unchecked":return`extension_pm_max_version_unchecked:${e}:${t.name}:allowed=${r.required}:current=${n}`;case"exceeded_warn":return`extension_pm_max_version_exceeded_warn:${e}:${t.name}:allowed=${r.required}:current=${n}`;case"exceeded":return`extension_pm_max_version_exceeded:${e}:${t.name}:allowed=${r.required}:current=${n}`;default:return}}async function bI(e,t){if(t.pm_min_version===void 0)return{allowed:!0};let r=hg(t.pm_min_version,await Rg()),n=xg(e,t,r);return n?{allowed:r.allowed,warning:n}:{allowed:r.allowed}}async function wI(e,t,r){if(t.pm_max_version===void 0)return{allowed:!0};let n=bg(t.pm_max_version,await Rg(),r),o=xg(e,t,n);return o?{allowed:n.allowed,warning:o}:{allowed:n.allowed}}async function Sg(e){try{let t=await xr.stat(e);return`${Math.trunc(t.mtimeMs)}-${t.size}`}catch{return"missing"}}async function vI(e,t){let r=e.entry_path;t.module_graph_snapshot_root&&(r=await J_(t.module_graph_snapshot_root,e));let n=new URL(sI(r).href);if(!(t.cache_bust===!0||typeof t.reload_token=="string"))return n.href;let[i,s]=await Promise.all([Sg(e.entry_path),Sg(e.manifest_path)]),a=t.reload_token??cI();return n.searchParams.set("pm_ext_reload",a),n.searchParams.set("pm_ext_entry",i),n.searchParams.set("pm_ext_manifest",s),n.href}async function EI(e){let t=await Ig(e),r=[],n=[],o=[...t.warnings];if(t.disabled_by_flag)return{...t,warnings:o,loaded:r,failed:n};let i=typeof e.extensionFilter=="function"?t.effective.filter(e.extensionFilter):t.effective;for(let s of i)try{let c=await import(await vI(s,e));r.push({...s,module:c})}catch(a){o.push(`extension_load_failed:${s.layer}:${s.name}`),n.push({layer:s.layer,name:s.name,entry_path:s.entry_path,error:Ps(a)})}return{...t,warnings:o,loaded:r,failed:n}}var Og=5e3,TI=2147483647;function kI(e){let r={activate:e.activate.bind(e)};if(typeof e.deactivate=="function"){let n=e.deactivate;r.deactivate=n.bind(e)}return r}function Ng(e){let t=Vm(e);return t?kI(t):null}async function wW(e,t,r={}){let n=AI(r?.deactivate_timeout_ms),o=new Set((t?.failed??[]).map(d=>`${d.layer}:${d.name}`)),i=[];for(let d of e.loaded){if(o.has(`${d.layer}:${d.name}`))continue;let u=Ng(d.module);!u||typeof u.deactivate!="function"||i.push({extension:d,deactivate:u.deactivate})}let s=await Promise.all(i.map(async({extension:d,deactivate:u})=>{try{return await SI(u,n),{ok:!0}}catch(f){return{ok:!1,layer:d.layer,name:d.name,error:Ps(f)}}})),a=[],c=[],l=0;for(let d of s){if(d.ok){l+=1;continue}a.push(`extension_deactivate_failed:${d.layer}:${d.name}`),c.push({layer:d.layer,name:d.name,error:d.error})}return{deactivated:l,warnings:a,failed:c}}function AI(e){return typeof e!="number"||e<0?Og:e===0||e===1/0?0:Number.isFinite(e)?Math.min(TI,Math.max(1,Math.floor(e))):Og}async function SI(e,t){if(t===0){await e();return}let r;try{let n=Promise.resolve().then(()=>e());n.catch(()=>{}),await Promise.race([n,new Promise((o,i)=>{r=setTimeout(()=>{i(new Error(`extension deactivate timed out after ${t}ms`))},t),r.unref?.()})])}finally{clearTimeout(r)}}function OI(e){if(!Array.isArray(e.capabilities))return null;let t=new Set;for(let r of e.capabilities){let n=r.trim().toLowerCase();Kt(n)&&t.add(n)}return t}function Z(e,t,r){let n=OI(e);if(n!==null&&!n.has(t))throw Rt(`${r} requires capability '${t}' in extension manifest capabilities`,{method:r,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 ${r} registration call.`})}function CI(e){return Object.freeze({name:e.name,layer:e.layer,version:e.version,capabilities:Object.freeze((e.capabilities??[]).filter(t=>mt.includes(t))),pm_min_version:e.pm_min_version,pm_max_version:e.pm_max_version,source_package:e.source_package})}function II(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 ud=class{extension;hooks;#e;#r;#o;#n;#s;#a;#i;#c;#t;#l;#d;#u;constructor(t,r,n,o,i,s,a,c,l,d,u){this.#e=t,this.extension=CI(t),this.#r=II(t),this.#o=r,this.#n=n,this.#s=o,this.#a=i,this.#i=s,this.#c=a,this.#t=c,this.#l=l,this.#d=d,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,r,n,o){let i=W_(this.#u,this.#r,t,r,n,o);return i.warning&&this.#l.push(i.warning),i.allowed}registerCommandTrace(t,r,n,o,i){return{method:"registerCommand",registration_index:t==="override"?this.#n.overrides.length:this.#n.handlers.length,command:r,expected_schema:n,received:Mo(o),hint:i}}registerCommandOverride(t,r){let n=J(t);if(n.length===0)throw Rt("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 r!="function"){let o=this.registerCommandTrace("override",n,'registerCommand("<command>", (context) => unknown)',r,"Provide a function as the second registerCommand argument.");throw Rt(`registerCommand requires an override function when command name is provided (command="${n}", registration_index=${o.registration_index})`,o)}this.allowRegistration("commands.override","registerCommand","commands",{command:n})&&this.#n.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:r})}resolveCommandDefinitionRunHandler(t,r){let n=typeof t.run=="function"?t.run:void 0,o=typeof t.handler=="function"?t.handler:void 0;return!n&&o&&this.#l.push(`extension_command_definition_legacy_handler_alias:${this.#e.layer}:${this.#e.name}:${r}`),n??o}registerCommandDefinition(t){if(typeof t!="object"||t===null)throw Rt("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 Rt("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 r=J(t.name);if(r.length===0)throw Rt("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 n=this.resolveCommandDefinitionRunHandler(t,r);if(typeof n!="function"){let o=this.registerCommandTrace("definition",r,"{ name: string; run: (context) => unknown; }",n,"Define command definition.run as a function.");throw Rt(`registerCommand requires a command definition run handler (command="${r}", registration_index=${o.registration_index})`,o)}try{P_(t);let o=cd(r,t.action);if(!this.allowRegistration("commands.handler","registerCommand","commands",{command:r,action:o}))return;let i=t.description?.trim(),s=t.intent?.trim(),a=No("registerCommand definition.examples",t.examples),c=No("registerCommand definition.failure_hints",t.failure_hints),l=ld(t.arguments);t.flags!==void 0&&(Z(this.#e,"schema","registerCommand flags"),this.allowRegistration("schema.flags","registerCommand flags","schema")&&(Ds(t.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:r,flags:Ns("registerCommand definition.flags",t.flags)})));let d={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:r,action:o,examples:a,failure_hints:c,arguments:l,tier:t.tier??"standard",family:t.family??"extensions"};i&&(d.description=i),s&&(d.intent=s),this.#t.commands.push(d)}catch(o){let i=Ps(o),s=this.registerCommandTrace("definition",r,"{ name: string; run: (context) => unknown; action?: string; arguments?: object[]; flags?: object[]; }",t,i),a=Rt(`registerCommand definition metadata invalid (command="${r}", registration_index=${s.registration_index}): ${i}`,s);this.#l.push(`extension_command_quarantined:${this.#e.layer}:${this.#e.name}:${r}`),this.#d.push({layer:this.#e.layer,name:this.#e.name,entry_path:this.#e.entry_path,error:a.message,trace:s});return}this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:r,run:n})}registerCommand(t,r){if(Z(this.#e,"commands","registerCommand"),typeof t=="string"){this.registerCommandOverride(t,r);return}this.registerCommandDefinition(t)}registerParser(t,r){if(Z(this.#e,"parser","registerParser"),!this.allowRegistration("parser.override","registerParser","parser"))return;let n=J(ke("registerParser command",t));jo("registerParser override",r),this.#s.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:r})}registerPreflight(t){if(Z(this.#e,"preflight","registerPreflight"),!this.allowRegistration("preflight.override","registerPreflight","preflight"))return;let r=Z_(t);this.#a.overrides.push({layer:this.#e.layer,name:this.#e.name,...r})}registerService(t,r,n={}){Z(this.#e,"services","registerService");let o=String(t).trim().toLowerCase();if(!og(o))throw new TypeError(`registerService service must be one of: ${gn.join(", ")}`);this.allowRegistration("services.override","registerService","services",{service:o})&&(jo("registerService override",r),this.#i.overrides.push({layer:this.#e.layer,name:this.#e.name,service:o,run:r,...gg(n)?{passThrough:!0}:{}}))}registerRenderer(t,r,n={}){if(Z(this.#e,"renderers","registerRenderer"),!this.allowRegistration("renderers.override","registerRenderer","renderers"))return;if(typeof r!="function")throw new TypeError("registerRenderer requires a renderer function");let o=String(t).trim().toLowerCase();if(!ng(o))throw new Error(`registerRenderer format must be toon|json, received: ${String(t)}`);if(n.resultDiscriminator!==void 0&&typeof n.resultDiscriminator!="function")throw new TypeError("registerRenderer ownership.resultDiscriminator must be a function when provided");let i=[...new Set((n.commands??[]).map(s=>{if(typeof s!="string"||s.trim().length===0)throw new TypeError("registerRenderer ownership.commands must contain non-empty command paths");return J(s)}))];this.#c.overrides.push({layer:this.#e.layer,name:this.#e.name,format:o,run:r,commands:i,...n.resultDiscriminator?{resultDiscriminator:n.resultDiscriminator}:{}})}registerFlags(t,r){if(Z(this.#e,"schema","registerFlags"),!this.allowRegistration("schema.flags","registerFlags","schema"))return;let n=J(ke("registerFlags targetCommand",t));Ds(r);let o=Ns("registerFlags flags",r);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:n,flags:o})}registerItemFields(t){if(Z(this.#e,"schema","registerItemFields"),!this.allowRegistration("schema.itemfields","registerItemFields","schema"))return;dg(t);let r=$o("registerItemFields fields",t);if(r.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:r})}registerItemTypes(t){if(Z(this.#e,"schema","registerItemTypes"),!this.allowRegistration("schema.itemtypes","registerItemTypes","schema"))return;ug(t);let r=$o("registerItemTypes types",t);if(r.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:r})}registerRelationshipKinds(t){if(Z(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 r=yl();for(let o of this.#t.relationship_kinds)for(let i of o.definitions)r.register(i);let n=t.map(o=>(r.register(o),r.require(o.kind)));this.#t.relationship_kinds.push({layer:this.#e.layer,name:this.#e.name,definitions:n})}registerMigration(t){if(Z(this.#e,"schema","registerMigration"),!this.allowRegistration("schema.migrations","registerMigration","schema"))return;fg(t);let r=Fo("registerMigration definition",t);this.#t.migrations.push(Uo({layer:this.#e.layer,name:this.#e.name,definition:kn("registerMigration definition",t)},r))}registerProfile(t){if(Z(this.#e,"schema","registerProfile"),!this.allowRegistration("schema.profiles","registerProfile","schema"))return;let r=Lo(t);mg(r),this.#t.profiles.push({layer:this.#e.layer,name:this.#e.name,profile:_g(r)})}registerImportExportCommandFlags(t,r,n){n.flags!==void 0&&(Z(this.#e,"schema",`${t} options.flags`),this.allowRegistration("schema.flags",`${t} options.flags`,"schema")&&(Ds(n.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:r,flags:Ns(`${t} options.flags`,n.flags)})))}applyImportExportCommandMetadata(t,r,n){if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))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={...n,description:n?.description??o,arguments:n?.arguments??i},a=M_(t,s,n?.description!==void 0);ie(`${t} options.action`,s.action),ie(`${t} options.description`,s.description),ie(`${t} options.intent`,s.intent);let c=cd(r,s.action),l=No(`${t} options.examples`,s.examples),d=No(`${t} options.failure_hints`,s.failure_hints),u=ld(s.arguments);this.registerImportExportCommandFlags(t,r,s);let f={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:r,action:c,examples:l,failure_hints:d,arguments:u},p=s.description?.trim();p&&(f.description=p);let m=s.intent?.trim();return m&&(f.intent=m),this.#t.commands.push(f),a}registerImporter(t,r,n){if(Z(this.#e,"importers","registerImporter"),!this.allowRegistration("importers.importer","registerImporter","importers"))return;let o=sd(ke("registerImporter name",t));jo("registerImporter importer",r);let i=ad(o,"import");this.applyImportExportCommandMetadata("registerImporter",i,n),this.#t.importers.push({layer:this.#e.layer,name:this.#e.name,importer:o}),this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:i,run:async s=>r(Ql(s,o,"import"))})}registerExporter(t,r,n){if(Z(this.#e,"importers","registerExporter"),!this.allowRegistration("importers.exporter","registerExporter","importers"))return;let o=sd(ke("registerExporter name",t));jo("registerExporter exporter",r);let i=ad(o,"export"),s=this.applyImportExportCommandMetadata("registerExporter",i,n);this.#t.exporters.push({layer:this.#e.layer,name:this.#e.name,exporter:o,...s===void 0?{}:{output:s}}),this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:i,run:async a=>{let c=await r(Ql(a,o,"export"));return s?.receipt==="suppress"&&!rs(c)?Hm(c):c}})}registerSearchProvider(t){if(Z(this.#e,"search","registerSearchProvider"),!this.allowRegistration("search.provider","registerSearchProvider","search"))return;let r=Fo("registerSearchProvider provider",t);this.#t.search_providers.push(Uo({layer:this.#e.layer,name:this.#e.name,definition:kn("registerSearchProvider provider",t)},r))}registerVectorStoreAdapter(t){if(Z(this.#e,"search","registerVectorStoreAdapter"),!this.allowRegistration("search.vectorstore","registerVectorStoreAdapter","search"))return;let r=Fo("registerVectorStoreAdapter adapter",t);this.#t.vector_store_adapters.push(Uo({layer:this.#e.layer,name:this.#e.name,definition:kn("registerVectorStoreAdapter adapter",t)},r))}registerAssuranceMeasurementProvider(t){if(Z(this.#e,"services","registerAssuranceMeasurementProvider"),!this.allowRegistration("services.assuranceprovider","registerAssuranceMeasurementProvider","services"))return;if(cg(t),t.network&&this.#e.permissions?.network!==!0)throw new TypeError("registerAssuranceMeasurementProvider network provider requires permissions.network=true");let r=Fo("registerAssuranceMeasurementProvider provider",t);this.#t.assurance_providers.push(Uo({layer:this.#e.layer,name:this.#e.name,network_permission:this.#e.permissions?.network===!0,definition:kn("registerAssuranceMeasurementProvider provider",t)},r))}registerBeforeCommand(t){Z(this.#e,"hooks","api.hooks.beforeCommand"),this.allowRegistration("hooks.beforecommand","api.hooks.beforeCommand","hooks")&&(Ir("beforeCommand",t),this.#o.beforeCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerBeforeMutation(t){Z(this.#e,"hooks","api.hooks.beforeMutation"),this.allowRegistration("hooks.beforemutation","api.hooks.beforeMutation","hooks")&&(Ir("beforeMutation",t),this.#o.beforeMutation.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerAfterCommand(t){Z(this.#e,"hooks","api.hooks.afterCommand"),this.allowRegistration("hooks.aftercommand","api.hooks.afterCommand","hooks")&&(Ir("afterCommand",t),this.#o.afterCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnWrite(t){Z(this.#e,"hooks","api.hooks.onWrite"),this.allowRegistration("hooks.onwrite","api.hooks.onWrite","hooks")&&(Ir("onWrite",t),this.#o.onWrite.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnRead(t){Z(this.#e,"hooks","api.hooks.onRead"),this.allowRegistration("hooks.onread","api.hooks.onRead","hooks")&&(Ir("onRead",t),this.#o.onRead.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnIndex(t){Z(this.#e,"hooks","api.hooks.onIndex"),this.allowRegistration("hooks.onindex","api.hooks.onIndex","hooks")&&(Ir("onIndex",t),this.#o.onIndex.push({layer:this.#e.layer,name:this.#e.name,run:t}))}};function RI(e,t,r,n,o,i,s,a,c,l,d){return new ud(e,t,r,n,o,i,s,a,c,l,d)}function xI(e){let t=e.commands.length,r=e.flags.reduce((s,a)=>s+a.flags.length,0),n=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:r,item_fields:n,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 NI(e){let t=[],r=(i,s)=>{let a=new Map;for(let c of i){let l=a.get(c.command)??[];l.push(c),a.set(c.command,l)}for(let c of[...a.keys()].sort((l,d)=>l.localeCompare(d))){let l=a.get(c);if(l.length<=1)continue;let d=l[l.length-1];for(let u of l.slice(0,-1))t.push(`${s}:${c}:${d.layer}:${d.name}:${u.layer}:${u.name}`)}};r(e.handlers,"extension_command_handler_collision"),r(e.overrides,"extension_command_override_collision");let n=new Set(e.handlers.map(i=>i.command)),o=[...new Set(e.overrides.map(i=>i.command))].filter(i=>n.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 l of s)t.push(`extension_command_override_handler_overlap:${i}:${c.layer}:${c.name}:${l.layer}:${l.name}`)}return t}function DI(e){let t=new Map;for(let n of e.overrides){let o=t.get(n.format)??[];o.push(n),t.set(n.format,o)}let r=[];for(let n of[...t.keys()].sort((o,i)=>o.localeCompare(i))){let o=t.get(n);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))||r.push(`extension_renderer_collision:${n}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return r}function PI(e){let t=[],r=new Map;for(let n of e.overrides){let o=r.get(n.command)??[];o.push(n),r.set(n.command,o)}for(let n of[...r.keys()].sort((o,i)=>o.localeCompare(i))){let o=r.get(n);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:${n}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return t}var MI=new Set(["output_format"]);function LI(e){let t=[],r=new Map;for(let n of e.overrides){let o=r.get(n.service)??[];o.push(n),r.set(n.service,o)}for(let n of[...r.keys()].sort((o,i)=>o.localeCompare(i))){let o=r.get(n);if(o.length<=1||MI.has(n))continue;let i=o[o.length-1];for(let s of o.slice(0,-1))t.push(`extension_service_override_collision:${n}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return t}async function FI(e){let t=H_(e.policy??aI),r=Ro(),n=Dl(),o=Pl(),i=Ml(),s=Ll(),a=Fl(),c=As(),l=[],d=[];for(let p of e.loaded){let m=Ng(p.module);if(!m)continue;let h=l.length,b=N_({hooks:r,commands:n,parsers:o,preflight:i,services:s,renderers:a,registrations:c});try{await m.activate(RI(p,r,n,o,i,s,a,c,d,l,t)),l.length>h&&(b(),d.push(`extension_activation_rolled_back:${p.layer}:${p.name}`))}catch(w){b(),d.push(`extension_activate_failed:${p.layer}:${p.name}`);let E=sg(w);l.push({layer:p.layer,name:p.name,entry_path:p.entry_path,error:Ps(w),trace:E})}}let u=[...NI(n),...PI(o),...Q_(i),...LI(s),...DI(a)],f=[...new Set([...d,...u])];return{hooks:r,commands:n,parsers:o,preflight:i,services:s,renderers:a,registrations:c,failed:l,warnings:f,hook_counts:{before_command:r.beforeCommand.length,before_mutation:r.beforeMutation.length,after_command:r.afterCommand.length,on_write:r.onWrite.length,on_read:r.onRead.length,on_index:r.onIndex.length},command_override_count:n.overrides.length,command_handler_count:n.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:xI(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 $I(e){return{...e,hooks:Ro(),profileEnabled:!!e.globalOptions.profile,migrationBlockers:[]}}(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 AW(){let e=Promise.resolve(),t=new Set;return{async read(r){let n=e,o,i=new Promise(s=>{o=s});t.add(i),await n;try{return await r()}finally{t.delete(i),o()}},write(r){let o=Promise.all([e,...t]).then(()=>r());return e=o.then(()=>{},()=>{}),o}}}function Dg(){let e=Promise.resolve(),t=0,r=[],n=()=>{if(t!==0)return;let o=r.splice(0);for(let i of o)i()};return{enqueue(o){t++;let i=e.then(()=>o());return e=i.then(()=>{},()=>{}).finally(()=>{t--,n()}),i},idle(){return t===0?Promise.resolve():new Promise(o=>r.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]="71c44385-0182-50f8-8e05-3aeebfe57ad9")}catch{}})();var jI={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"]},Pg=":";function Mg(e,t){return`${e}${Pg}${fd(t)}`}function UI(e){return e.slice(e.indexOf(Pg)+1)}function fd(e){return e.trim().toLowerCase()}function zI(e){if(!Array.isArray(e))return[];let t=new Set;for(let r of e){let n=p_(r);n!==null&&t.add(n)}return[...t].sort((r,n)=>r.localeCompare(n))}function Lg(e){let t=new Map,r=(d,u)=>{for(let f of d){let p=Mg(f.layer,f.name),m=t.get(p);m===void 0&&(m=new Set,t.set(p,m)),m.add(u)}},{registrations:n,commands:o,parsers:i,preflight:s,services:a,renderers:c,hooks:l}=e;return r(n.commands,"commands"),r(o.overrides,"commands"),r(o.handlers,"commands"),r(n.flags,"schema"),r(n.item_fields,"schema"),r(n.item_types,"schema"),r(n.relationship_kinds??[],"schema"),r(n.migrations,"schema"),r(n.profiles,"schema"),r(n.importers,"importers"),r(n.exporters,"importers"),r(n.search_providers,"search"),r(n.vector_store_adapters,"search"),r(i.overrides,"parser"),r(s.overrides,"preflight"),r(a.overrides,"services"),r(n.assurance_providers??[],"services"),r(c.overrides,"renderers"),r(l.beforeCommand,"hooks"),r(l.beforeMutation,"hooks"),r(l.afterCommand,"hooks"),r(l.onWrite,"hooks"),r(l.onRead,"hooks"),r(l.onIndex,"hooks"),t}function qI(e,t={}){let r=Lg(e),n=new Set;t.extensionName!==void 0&&n.add(fd(t.extensionName));for(let i of t.extensionNames??[])n.add(fd(i));let o=new Set;for(let[i,s]of r)if(!(n.size>0&&!n.has(UI(i))))for(let a of s)o.add(a);return[...o].sort((i,s)=>i.localeCompare(s))}function HI(e,t){let r=Lg(t),n=[];for(let o of e){let i=zI(o.capabilities);if(i.length===0)continue;let s=r.get(Mg(o.layer,o.name))??new Set,a=[...s].sort((l,d)=>l.localeCompare(d)),c=i.filter(l=>!s.has(l));n.push({layer:o.layer,name:o.name,declared:i,used:a,unused:c})}return n}import{existsSync as GI}from"node:fs";import{AsyncLocalStorage as BI}from"node:async_hooks";import xt 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]="40b169fc-3c5f-5b2a-8fed-a9388b07d9f7")}catch{}})();var Nt=null,An=null,qo=null,Ho=null,Sn=null,Go=null,Bo=null,Zt=null,Ls,Ms=[],$g=new BI;function H(){return $g.getStore()}function jg(e){return $g.run({hooks:null,commands:null,parsers:null,preflight:null,services:null,renderers:null,registrations:null,commandContext:null,commandResult:void 0,affectedItems:[]},e)}var VI=new Set(["body","comments","dependencies","docs","events","files","learnings","notes","reminders","test_runs","tests"]);function Fg(e){let t=xt.resolve(e);for(;;){if(GI(xt.join(t,".git")))return t;let r=xt.dirname(t);if(r===t)return;t=r}}function Fs(e){let t=process.env.PM_SOURCE_WORKSPACE_ROOT?.trim()||process.cwd(),r=Fg(t)??xt.resolve(t),n=Fg(r);if(!e)return{source_workspace_root:r,...n?{repo_root:n}:{}};let o=xt.relative(r,xt.resolve(e)),i=o.length>0&&!o.startsWith(`..${xt.sep}`)&&o!==".."&&!xt.isAbsolute(o);return{source_workspace_root:r,...n?{repo_root:n}:{},...i?{pm_root_rel:o.split(xt.sep).join("/")}:{}}}function WI(e){let t=H();if(t){t.hooks=e;return}Nt=e}function YI(e){let t=H();if(t){t.commands=e;return}An=e}function KI(e){let t=H();if(t){t.parsers=e;return}qo=e}function XI(e){let t=H();if(t){t.preflight=e;return}Ho=e}function JI(e){let t=H();if(t){t.services=e;return}Sn=e}function ZI(e){let t=H();if(t){t.renderers=e;return}Go=e}function QI(e){let t=H();if(t){t.registrations=e;return}Bo=e}function Qt(){let e=H();return e?e.registrations:Bo}function e0(){let e=H();if(e){e.hooks=null,e.commands=null,e.parsers=null,e.preflight=null,e.services=null,e.renderers=null,e.registrations=null,e.commandContext=null,e.commandResult=null,e.affectedItems=[];return}Nt=null,An=null,qo=null,Ho=null,Sn=null,Go=null,Bo=null,Zt=null,Ls=null}function t0(e){let t=e?{...e,...Fs(e.pm_root)}:null,r=H();if(r){r.commandContext=t;return}Zt=t}function Ug(){let e=H(),t=e?e.commandContext:Zt;return t?{...t,args:[...t.args],options:t.options?{...t.options}:{},global:t.global?{...t.global}:void 0}:null}function zg(e){let t=H()??{commandContext:Zt,hooks:Nt,commands:An,parsers:qo,preflight:Ho,services:Sn,renderers:Go,registrations:Bo};return t.commandContext?.command!==e||[t.hooks,t.preflight,t.services,t.renderers].some(o=>Object.values(o??{}).some(i=>i.length>0))||[t.commands,t.parsers].some(o=>Object.values(o??{}).some(i=>i.some(s=>s.command===e)))?!1:!Object.entries(t.registrations??{}).some(([o,i])=>["migrations","search_providers","vector_store_adapters","assurance_providers"].includes(o)&&i.length>0)}function er(e){let t=H();if(t){t.commandResult=e;return}Ls=e}function r0(){let e=H();return e?e.commandResult:Ls}function $s(e){if(!e)return;let t=H();t?t.affectedItems.push(e):Ms.push(e)}function Vo(e,t){if(!e||!e.id)return{};let r={id:e.id,type:e.type,status:e.status};if(!Array.isArray(t))return r;let n=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"||VI.has(i)||Object.hasOwn(n,i)&&n[i]!==void 0&&(r[i]=n[i])}return r}function n0(){let e=H(),t=e?.affectedItems??Ms;if(t.length===0)return;let r=t;return e?e.affectedItems=[]:Ms=[],r}function o0(){let e=H();if(e){e.hooks=null,e.commands=null,e.parsers=null,e.preflight=null,e.services=null,e.renderers=null,e.registrations=null,e.commandContext=null,e.commandResult=void 0,e.affectedItems=[];return}Nt=null,An=null,qo=null,Ho=null,Sn=null,Go=null,Bo=null,Zt=null,Ls=void 0,Ms=[]}async function Ae(e){let t=H(),r=t?t.hooks:Nt;return r?zl(r,e):[]}async function js(e){let t=H(),r=t?t.hooks:Nt;r&&await Ul(r,e)}async function it(e){let t=H(),r=t?t.hooks:Nt;return r?ql(r,e):[]}function pd(){let e=H();return((e?e.hooks:Nt)?.onRead?.length??0)>0}async function i0(e){let t=H(),r=t?t.hooks:Nt;return r?Hl(r,e):[]}function qg(e){let t=H(),r=t?t.commands:An,n=t?t.commandContext:Zt;return!r||!n?{overridden:!1,result:e,warnings:[]}:Kl(r,{command:n.command,args:[...n.args],options:n.options?{...n.options}:{},global:n.global?{...n.global}:void 0,pm_root:n.pm_root,source_workspace_root:n.source_workspace_root,repo_root:n.repo_root,pm_root_rel:n.pm_root_rel,result:e})}async function s0(e){let t=H(),r=t?t.commands:An;return r?Gl(r,{...e,...Fs(e.pm_root)}):{handled:!1,result:null,warnings:[]}}async function a0(e){let t=H(),r=t?t.parsers:qo;return r?Bl(r,{...e,...Fs(e.pm_root)}):{overridden:!1,context:{command:e.command,args:[...e.args],options:{...e.options},global:{...e.global},pm_root:e.pm_root},warnings:[]}}async function c0(e){let t=H(),r=t?t.preflight:Ho;return r?Vl(r,{...e,...Fs(e.pm_root)}):{overridden:!1,context:{command:e.command,args:[...e.args],options:{...e.options},global:{...e.global},pm_root:e.pm_root},decision:{...e.decision},warnings:[]}}function Hg(e,t){let r=H(),n=r?r.renderers:Go,o=r?r.commandContext:Zt;return n?Xl(n,{format:e,command:o?.command,args:o?[...o.args]:[],options:o?.options?{...o.options}:{},global:o?.global?{...o.global}:void 0,pm_root:o?.pm_root,source_workspace_root:o?.source_workspace_root,repo_root:o?.repo_root,pm_root_rel:o?.pm_root_rel,result:t}):{overridden:!1,rendered:null,warnings:[]}}function Gg(e,t){let r=H(),n=r?r.commandContext:Zt;return{service:e,command:n?.command,args:n?[...n.args]:[],options:n?.options?{...n.options}:{},global:n?.global?{...n.global}:void 0,pm_root:n?.pm_root,source_workspace_root:n?.source_workspace_root,repo_root:n?.repo_root,pm_root_rel:n?.pm_root_rel,payload:t}}async function Ze(e,t){let r=H(),n=r?r.services:Sn;return n?Yl(n,Gg(e,t)):{handled:!1,result:t,warnings:[]}}function md(e,t){let r=H(),n=r?r.services:Sn;return n?Wl(n,Gg(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]="4f014bd9-39b6-5017-93ed-f0e7fba8497a")}catch{}})();var Bg=e=>{let t='"',r=0;for(let n of e){if(n==="\\"){r+=1;continue}t+="\\".repeat(n==='"'?r*2+1:r),t+=n,r=0}return`${t}${"\\".repeat(r*2)}"`},Vg=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?Bg(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,Dt=(e,t=process.platform)=>{let r=e.map(n=>Vg(n,t)).join(" ");return r.length>0?`pm ${r}`:"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]="b18eefc1-0d1d-5c9c-b98a-b96771070301")}catch{}})();var Wg=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),l0=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract","--all"]);function d0(e){let t=e.indexOf("=");return t>0&&Wg.has(e.slice(0,t))}function u0(e,t){return typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-")}function Us(e){for(let t=0;t<e.length;t+=1){let r=e[t];if(r==="--")return;if(Wg.has(r)){t+=u0(r,e[t+1])?1:0;continue}if(!(d0(r)||l0.has(r)||r==="--profile"||r==="--id-only"||r==="--explain")&&!r.startsWith("-"))return t}}function jW(e){let t=Us(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]="49de148c-3c60-547b-b3bc-d0a71e013dc6")}catch{}})();var f0=new Set(["--literal","--regex","--replacement"]);function p0(e){let t=Us(e);if(t===void 0)return!1;if(e[t]==="history-redact")return!0;if(e[t]!=="history")return!1;let r=e.slice(t+1),n=Us(r);return n!==void 0&&r[n]==="redact"}function HW(e){if(!p0(e))return[...e];let t=[],r=!1;for(let n of e){if(r){t.push("[redacted]"),r=!1;continue}r=!1;let o=n.indexOf("="),i=o>=0?n.slice(0,o):n;if(!f0.has(i)){t.push(n);continue}if(o>=0){t.push(`${i}=[redacted]`);continue}t.push(i),r=!0}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]="6c87b004-3647-531a-9599-d37fd91c2807")}catch{}})();var Jg=new WeakMap;function WW(e,t){Jg.set(e,new Set(t))}var Yg='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',m0={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"],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"}},_0=[{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 YW(e,t,r){if(e&&t)throw new g(`${r} cannot be combined with --full`,_.USAGE)}function gt(e,t=new Set){let r=e.filter(n=>!t.has(n.name)).map(n=>({...n}));return{has_omissions:r.length>0,omitted_field_group_count:r.length,omitted_field_groups:r}}function KW(e,t){let r=_0.find(o=>o.command===e);if(r===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===r.complete_mode)return gt([]);let n=r.omissions_by_mode[t];if(n===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return gt(n)}var g0=[{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 $e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var y0=new Set([void 0,"tabular_when_uniform"]),h0=new Set(["collection","none"]),b0=new Set(["supported","unsupported"]);function Kg(e,t){return Array.isArray(e)&&(t||e.length>0)&&e.every(r=>typeof r=="string"&&r.length>0)&&new Set(e).size===e.length}function w0(e){return $e(e)&&typeof e.command=="string"&&e.command.trim().length>0&&h0.has(e.row_kind)&&Kg(e.row_keys,!0)&&(e.continuation_row_keys===void 0||Kg(e.continuation_row_keys,!1))&&b0.has(e.fields)&&y0.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 v0={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"]},E0={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"],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 T0(e,t){let r=e.trim().toLowerCase().split(/\s+/u,1)[0],n=r?.startsWith("list-")?"list":r;if(n==="graph"){let s=typeof t.subcommand=="string"?t.subcommand:"";if(s.length===0)return;let a=v0[s];if(a===void 0)return;let c=a.filter(l=>Array.isArray(t[l])||$e(t[l]));return{command:"graph",row_kind:c.length>0?"collection":"none",row_keys:c,fields:"unsupported",...c.length>0?{jq_selector:Yg}:{},toon_encoding:"tabular_when_uniform"}}let o=m0[n],i=E0[n];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((l,d)=>$e(l)?l[d]:void 0,t);return Array.isArray(c)||$e(c)});return{command:n,row_kind:s.length>0?"collection":"none",row_keys:s,fields:o.fields,...s.length>0?{jq_selector:Yg}:{},toon_encoding:"tabular_when_uniform"}})()}function k0(e){if(!$e(e.projection)||typeof e.projection.mode!="string"||e.projection.mode.trim().length===0)return;let t=e.projection.declared_field_groups,r=e.projection.included_field_groups;if(!Array.isArray(t)||!Array.isArray(r))return;let n=t.filter(s=>$e(s)&&typeof s.name=="string"&&s.name.trim().length>0&&typeof s.restore_with=="string"&&s.restore_with.trim().length>0),o=r.filter(s=>typeof s=="string");if(n.length!==t.length||o.length!==r.length)return;let i=new Set(n.map(s=>s.name));if(!(i.size!==n.length||new Set(o).size!==o.length||o.some(s=>!i.has(s))))return gt(n,new Set(o))}function A0(e){if(!Array.isArray(e.sections_included))return;let t=gt(g0,new Set(e.sections_included.filter(r=>typeof r=="string")));return $e(e.summary)&&e.summary.scope==="matching_items"&&(t.summary_scope="matching_items"),t}function S0(e){if(!$e(e.item))return;let t=e.item,r=["comments","notes","learnings","files","tests","docs","reminders","events"],n=["body","children","claim_state","linked","schedule"],o=Jg.get(e),i=a=>r.includes(a)||a==="body"?t:e,s=["body",...r,...n.slice(1)].filter(a=>o===void 0||o.has(a)||Object.hasOwn(i(a),a)).map(a=>({name:a,restore_with:`--fields ${a}`}));return gt(s,new Set(s.flatMap(({name:a})=>Object.hasOwn(i(a),a)?[a]:[])))}function Xg(e){if($e(e.projection))return gt([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function O0(e){if(!$e(e.projection))return gt([]);if(typeof e.projection.mode=="string")return gt([{name:"full_check_details",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_check_details"]:[]))}function C0(e){if(!(!$e(e.selected)||typeof e.selected.summary!="boolean"))return gt([{name:"full_contract_catalog",restore_with:"--full"}],new Set(e.selected.summary?[]:["full_contract_catalog"]))}function I0(e,t){let r=k0(t);if(r!==void 0)return r;let[n]=e.split(/\s+/u,1);if(n==="context")return A0(t);if(n==="get")return S0(t);if(n==="list"||n.startsWith("list-"))return Xg(t);if(n==="search")return Xg(t)??gt([{name:"projection_metadata",restore_with:"--full"}]);if(n==="health")return O0(t);if(n==="contracts")return C0(t)}function Zg(e,t){if(e===void 0||!$e(t))return t;let r=I0(e,t),n=t.row_contract,o=w0(n)?n:T0(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 $e(i.omission_receipt)||r===void 0?i:{...i,omission_receipt:r}}import{createHash as R0}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]="15037266-75b7-5f8d-9565-e7848e720a49")}catch{}})();var _d=1,ey=4096,x0=/^[A-Za-z0-9_-]+$/;function Qg(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,r)=>r.toUpperCase())}function t3(e,t){let r=new Set;for(let n of t)if(n.cursor_semantics==="presentation"){r.add(Qg(n.flag));for(let o of n.aliases??[])r.add(Qg(o))}return Object.fromEntries(Object.entries(e).filter(([n])=>!r.has(n)))}function r3(e,t){return R0("sha256").update(e).update("\0").update(L(t)).digest("hex").slice(0,24)}function Wo(e,t,r,n){return Buffer.from(JSON.stringify({version:_d,fingerprint:e,after_id:t,...r===void 0?{}:{after_index:r},...n===void 0?{}:{snapshot:n}})).toString("base64url")}function Nr(e){return new g(e,_.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function N0(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===_d&&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 gd(e){if(typeof e!="string")throw Nr("Query cursor is malformed.");let t=e.trim();if(t.length===0||t.length>ey||!x0.test(t))throw Nr("Query cursor is malformed.");let r;try{r=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw Nr("Query cursor is malformed.")}if(!N0(r))throw Nr("Query cursor version or payload is unsupported.");return r}function yd(e,t){let r=gd(e);if(r.fingerprint!==t)throw Nr(`Query cursor does not match the current filters, sort, or query (${r.fingerprint} != ${t}).`);return{after_id:r.after_id,...r.after_index===void 0?{}:{after_index:r.after_index},...r.snapshot===void 0?{}:{snapshot:r.snapshot}}}function n3(e,t){return yd(e,t).after_id}function D0(e,t,r,n){if(t===void 0)return 0;let o=yd(t,r),i=e.findIndex(s=>n(s)===o.after_id);if(i<0){if(o.after_index!==void 0)return Math.min(o.after_index,e.length);throw Nr(`Query cursor item ${o.after_id} is no longer present in this result set.`)}return i+1}function o3(e,t){if(t.cursor!==void 0&&yd(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw Nr("Query cursor does not match the requested snapshot.");let r=D0(e,t.cursor,t.fingerprint,t.readId),n=e.slice(r,r+t.limit),o=n.length>0&&r+n.length<e.length,i=n.at(-1);return{rows:n,has_more:o,...o&&i!==void 0?{next_cursor:Wo(t.fingerprint,t.readId(i),r+n.length-1,t.snapshot)}:{}}}var i3=Object.freeze({version:_d,max_length:ey});(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 P0=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 On(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ty(e,t){let r=e;for(let n of t.split("."))if(Array.isArray(r)){if(!/^\d+$/u.test(n))return;r=r[Number(n)]}else{if(!On(r))return;r=r[n]}return r}function hd(e,t,r){let n=t.split("."),o=(i,s)=>{if(s===n.length)return r;let a=n[s];if(Array.isArray(i)){let l=Number(a),d=[...i];return d[l]=o(i[l],s+1),d}let c=i;return{...c,[a]:o(c[a],s+1)}};return o(e,0)}function ry(e,t,r){let n=Cn(e).find(i=>i.path===t);if(!n)return e;let o=Array.isArray(n.value)?n.value.slice(r):Object.fromEntries(Object.entries(n.value).slice(r));return hd(e,t,o)}function zs(e){let t=e.row_contract;return On(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(r=>typeof r=="string"&&r.trim().length>0):Object.entries(e).filter(([,r])=>Array.isArray(r)).map(([r])=>r)}function M0(e){let t=e.row_contract;return On(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(r=>typeof r=="string"&&r.trim().length>0):zs(e)}function tr(e){return zs(e).flatMap(t=>{let r=ty(e,t);return Array.isArray(r)||On(r)?[{path:t,value:r}]:[]})}function Cn(e){return M0(e).flatMap(t=>{let r=ty(e,t);return Array.isArray(r)||On(r)?[{path:t,value:r}]:[]})}function qs(e){let t=tr(e),r=new Set(t.map(o=>o.path)),n=(o,i)=>{if(Array.isArray(o)){r.has(i)||t.push({path:i,value:o}),o.forEach((s,a)=>n(s,`${i}.${a}`));return}if(On(o))for(let[s,a]of Object.entries(o))i.length===0&&P0.has(s)||n(a,i.length===0?s:`${i}.${s}`)};return n(e,""),t}function Hs(e){return tr(e).reduce((t,r)=>t+(Array.isArray(r.value)?r.value.length:Object.keys(r.value).length),0)}function Yo(e,t){let r=e;for(let n of tr(r)){let o=Array.isArray(n.value)?n.value.map((i,s)=>t(i,n.path,s)):Object.fromEntries(Object.entries(n.value).map(([i,s],a)=>[i,t(s,n.path,a)]));r=hd(r,n.path,o)}return r}function ny(e,t){let r=e,n=!1;for(let o of tr(r)){let i=Array.isArray(o.value)?o.value:Object.entries(o.value);if(i.length<=t)continue;n=!0;let s=Array.isArray(o.value)?i.slice(0,t):Object.fromEntries(i.slice(0,t));r=hd(r,o.path,s)}return{result:r,truncated: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]="6e88d6b7-aa5f-5515-8ea4-481916b12ef1")}catch{}})();var Gs="changed_fields",L0="changed_field_count",bd="rows",F0=new Set(["apply","rollback"]),ay=new Set(["deleted","would_delete"]),oy=256,iy={start_task:["claim","update"],pause_task:["update","release"],close_task:["close","release"]};function $0(e,t){if(!je(e)||typeof e.action!="string"||typeof e.id!="string"||e.id.length===0)return null;let r=Object.hasOwn(iy,e.action)?iy[e.action]:void 0;if(!r||!r.every(i=>{let s=e[i];return je(s)&&je(s.item)&&s.item.id===e.id&&Array.isArray(s.changed_fields)&&s.changed_fields.every(a=>typeof a=="string")}))return null;let n=e[r.at(-1)],o=ly(n);return t.idOnly?o:!t.compactEnvelope&&t.changedFields!=="compact"?null:{...e,...t.compactEnvelope?{...o,changed_field_count:new Set(r.flatMap(i=>e[i].changed_fields)).size}:{},...Object.fromEntries(r.map(i=>[i,Ko(e[i],t)]))}}function sy(e){return typeof e!="string"||e.length<=oy?e:`${e.slice(0,oy-1)}\u2026`}function j0(e){if(!je(e))return null;let t={...e};return t.reason=sy(t.reason),je(t.previous_terminal)&&(t.previous_terminal=Object.fromEntries(Object.entries(t.previous_terminal).map(([r,n])=>[r,sy(n)]))),t}function je(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function cy(e){let t=e[Gs];if(!Array.isArray(t))return null;let r=Object.getPrototypeOf(e)===null?Object.create(null):{};for(let[n,o]of Object.entries(e))n!==Gs&&(r[n]=o);return r[L0]=t.length,r}function U0(e){return"item"in e&&Array.isArray(e[Gs])}function z0(e){return typeof e.mode=="string"&&F0.has(e.mode)&&Array.isArray(e[bd])}function q0(e,t){let r=Object.getPrototypeOf(e)===null?Object.create(null):{};return Object.assign(r,e),r[bd]=t,r}function ly(e){if(!je(e))return null;let t=je(e.item)?e.item:je(e.plan)?e.plan:null;if(t===null)return null;let r=typeof t.id=="string"?t.id:void 0,n=typeof e.outcome=="string"&&ay.has(e.outcome)?e.outcome:typeof t.status=="string"?t.status:void 0;return r?n?{id:r,status:n,...typeof e.deleted=="boolean"?{deleted:e.deleted}:{}}:{id:r}:null}function H0(e){if(!je(e)||!je(e.item)||typeof e.item.id!="string")return null;let t=e[Gs];if(!Array.isArray(t))return null;let r={id:e.item.id,...typeof e.outcome=="string"&&ay.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 G0(e,e.item,r),r}function G0(e,t,r){let n=typeof e.close_reason=="string"?e.close_reason:typeof t.close_reason=="string"?t.close_reason:void 0;n!==void 0&&(r.close_reason=n);let o=j0(e.recurrence);if(o!==null&&(r.recurrence=o),Array.isArray(e.warnings)&&e.warnings.length>0&&(r.warnings=e.warnings),je(e.recovery)&&(r.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)&&(r[i]=e[i])}function B0(e){let t=z0(e)?e[bd]:void 0;if(!Array.isArray(t))return{projected:e,changed:!1};let r=!1,n=t.map(o=>{if(!je(o))return o;let i=cy(o);return i?(r=!0,i):o});return r?{projected:q0(e,n),changed:!0}:{projected:e,changed:!1}}function Ko(e,t={}){let r=$0(e,t);if(r!==null)return r;if(t.idOnly===!0){let c=ly(e);if(c!==null)return c}if(t.compactEnvelope===!0){let c=H0(e);if(c!==null)return c}if((t.changedFields??"full")==="full"||!je(e))return e;let o=!1,i=e,s=U0(e)?cy(e):null;s!==null&&(i=s,o=!0);let a=B0(i);return a.changed&&(i=a.projected,o=!0),o?i:e}import{AsyncLocalStorage as vN}from"node:async_hooks";import{stripVTControlCharacters as pR}from"node:util";import{createHash as uy}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]="8b0d8654-211b-57bf-852f-8a153849e8fd")}catch{}})();var V0=["policies","policy-put","policy-remove","policy-mode","policy-check","policy-approve","policy-presets"],dy=256,wd=64;function Re(e){throw new g(`Invalid workflow policy: ${e}`,_.USAGE,{code:"workflow_policy_invalid",nextSteps:["Inspect pm schema policies and correct the declaration using pm schema policy-put."]})}function Pt(e,t,r){if(typeof e!="object"||e===null||Array.isArray(e))return Re(`${r} must be an object`);let n=e;return Object.keys(n).some(o=>!t.includes(o))?Re(`${r} contains an unknown key`):n}function Dr(e,t,r=128){return typeof e!="string"||!e.trim()||e.length>r?Re(`${t} must be nonempty text of at most ${r} characters`):e.trim()}function Xo(e,t){if(!Array.isArray(e)||e.length===0||e.length>wd)return Re(`${t} requires 1-${wd} terms`);let r=e.map(n=>Dr(n,t));return t==="fields"&&r.some(n=>!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$/.test(n)||n.split(".").some(o=>["__proto__","constructor","prototype"].includes(o)))?Re("fields must be safe metadata paths of at most eight segments"):[...new Set(r)]}function W0(e){let t=Pt(e,["kind","fields","authors","allowed"],"rule");return t.kind==="transition"?(Pt(t,["kind","allowed"],"transition rule"),!Array.isArray(t.allowed)||t.allowed.length>wd?Re("transition.allowed must be a bounded array"):{kind:"transition",allowed:t.allowed.map(r=>!Array.isArray(r)||r.length!==2?Re("transition pairs need two statuses"):[Dr(r[0],"from"),Dr(r[1],"to")])}):t.kind==="authors"?(Pt(t,["kind","authors"],"authors rule"),{kind:"authors",authors:Xo(t.authors,"authors")}):t.kind==="require_fields"?(Pt(t,["kind","fields"],"require_fields rule"),{kind:"require_fields",fields:Xo(t.fields,"fields")}):t.kind==="field_writers"||t.kind==="approval"?(Pt(t,["kind","fields","authors"],"field rule"),{kind:t.kind,fields:Xo(t.fields,"fields"),authors:Xo(t.authors,"authors")}):Re("unknown rule kind")}function Y0(e){let t={},r=Pt(e,["types","tags","statuses","operations","parents","dependency"],"subject");for(let n of["types","tags","statuses","operations","parents"])r[n]!==void 0&&(t[n]=Xo(r[n],n));if(r.dependency!==void 0){let n=Pt(r.dependency,["kind","id"],"dependency");t.dependency={kind:Dr(n.kind,"dependency kind"),...n.id===void 0?{}:{id:Dr(n.id,"dependency id")}}}return t}function K0(e){let t=Pt(e,["id","description","subject","effect","rule"],"policy"),r=Dr(t.id,"id");return/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(r)?t.effect!==void 0&&(typeof t.effect!="string"||!["advise","warn","refuse"].includes(t.effect))?Re("effect must be advise, warn, or refuse"):{id:r,rule:W0(t.rule),...t.subject===void 0?{}:{subject:Y0(t.subject)},...t.description===void 0?{}:{description:Dr(t.description,"description",500)},...t.effect===void 0?{}:{effect:t.effect}}:Re("id must be a stable token")}function vd(e){let t=Pt(e,["version","enforcement","policies"],"document");if(t.version!==1)return Re("unsupported version");if(t.enforcement!==void 0&&t.enforcement!=="advise"&&t.enforcement!=="refuse")return Re("enforcement must be advise or refuse");if(!Array.isArray(t.policies)||t.policies.length>dy)return Re(`policies must contain at most ${dy} declarations`);let r=t.policies.map(K0);return new Set(r.map(n=>n.id)).size!==r.length?Re("duplicate policy id"):{version:1,enforcement:t.enforcement??"advise",policies:r}}function Bs(e,t){let r=e;for(let n of t.split(".")){if(typeof r!="object"||r===null||!Object.hasOwn(r,n))return;r=r[n]}return r}function X0(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 fy(e){return uy("sha256").update(L(e)).digest("hex")}function J0(e,t){let r=e.rule.kind==="approval"?e.rule.fields:[];return uy("sha256").update(L({id:t.id,fields:r.map(n=>[n,Bs(t,n)])})).digest("hex")}function Z0(e,t){return Array.isArray(t)&&t.some(r=>typeof r=="object"&&r!==null&&"kind"in r&&r.kind===e.kind&&(e.id===void 0||"id"in r&&r.id===e.id))}function Q0(e,t,r){return!(e.types&&!e.types.some(n=>n.toLowerCase()===String(t.type).toLowerCase())||e.statuses&&!e.statuses.includes(String(t.status))||e.operations&&!e.operations.includes(r)||e.parents&&!e.parents.includes(String(t.parent))||e.tags&&(!Array.isArray(t.tags)||!e.tags.some(n=>t.tags.includes(n)))||e.dependency&&!Z0(e.dependency,t.dependencies))}function Ed(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 r=e.subject??{},n=t.after?.status??t.before?.status;return[t.before,t.after].some(o=>o!==null&&Q0(r,{...o,status:n},t.operation))}function eR(e,t,r,n){let o=["type","tags","parent","dependencies"].some(s=>!ne(t.before?.[s],t.after?.[s]));return t.after&&(t.completeness_only||r||n||o)?e.filter(s=>!X0(Bs(t.after,s))):[]}function tR(e,t,r,n){let o=t.after??t.before,i=J0(e,o);return t.approvals?.some(s=>s.policy_fingerprint===n&&s.content_fingerprint===i&&s.author!==t.author&&r.includes(s.author))??!1}function rR(e,t,r){let n=e.rule,o=t.before?.status!==t.after?.status,i="fields"in n&&n.fields.some(s=>!ne(Bs(t.before,s),Bs(t.after,s)));switch(n.kind){case"require_fields":{let s=eR(n.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||n.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:n.authors.includes(t.author),missing_fields:[],remediation:"Have a declared workflow actor perform this operation."};case"field_writers":return{satisfied:!i||n.authors.includes(t.author),missing_fields:[],remediation:"Have a declared field writer change the protected fields."};case"approval":return{satisfied:!o||tR(e,t,n.authors,r),missing_fields:[],remediation:`Record an independent approval with pm schema policy-approve <item-id> --policy ${e.id} after preparing the reviewed fields.`}}}function py(e,t,r){let n=e.policies.filter(o=>Ed(o,t)).map(o=>{let i=o.effect??"advise",s=r(o);return{policy_id:o.id,policy_fingerprint:s,rule:o.rule.kind,effect:i==="refuse"&&e.enforcement!=="refuse"?"warn":i,...rR(o,t,s)}});return{allowed:!n.some(o=>!o.satisfied&&o.effect==="refuse"),decisions:n,warnings:n.filter(o=>!o.satisfied).map(o=>`workflow_policy:${o.effect}:${o.policy_id}:${o.rule}`)}}function my(e,t){return py(e,t,fy)}function p3(e){let t=vd(e),r=new Map(t.policies.map(n=>[n,fy(n)]));return n=>py(t,n,o=>r.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 _y=[...mt],gy=[...gn],yy=[...is],nR=[...ss],oR=[...as],hy=[...cs],Jo=["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"],h3=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],iR=["install","reconcile","report","driver"],by=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],wy=["upgrade"],vy=["reopen"],Td={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},st=Object.freeze(Jo.flatMap(e=>e in Td?[]:e==="extension"||e==="package"?[...by.map(t=>`${e}-${t}`),...e==="package"?wy.map(t=>`package-${t}`):[],e]:e==="item"?vy.map(t=>`item-${t}`):[e])),Ey=Object.freeze(go.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&st.includes(e.alias)).map(e=>e.alias)),sR=Object.freeze(st.filter(e=>!Ey.includes(e)));function aR(e=Jo,t=st,r=Td){let n=new Set(t),o=new Set(e);return{missing_cli_actions:e.filter(i=>!n.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&r[i]===void 0),waived_cli_actions:e.filter(i=>!n.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&r[i]!==void 0),stale_waivers:Object.keys(r).filter(i=>!o.has(i)||n.has(i)||t.some(s=>s.startsWith(`${i}-`)))}}function cR(e){return st.includes(e)}function lR(e){return _y.includes(e)}function dR(e){return gy.includes(e)}function uR(e){return yy.includes(e)}function fR(e){return hy.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]="b4036040-c0b8-5d01-b490-3405722fd1c5")}catch{}})();var ky=["full","compact","brief","summary","counts"],mR=["mutation","read","discovery","governance"],kd=["error","warning","validation_summary","recovery_bundle"],Ay=["full","omit_explanation","limit_collections","compact_recovery","action_only"],_R=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"]),gR=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),yR=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),hR={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},bR=3,wR=2,vR=192,ER={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},Sy=kd.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:ER[e],minimum_max_estimated_tokens:vR,degradation_ladder:Ay,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),TR=new Map(Sy.map(e=>[e.diagnostic_class,e]));function Oy(e){let[t=""]=Ke(e).split(/\s+/u);return _R.has(t)?"mutation":gR.has(t)?"discovery":yR.has(t)?"governance":"read"}function Ad(e,t=Oy(e)){let r=e.trim().replace(/\s+/gu," ");if(r.length===0)throw new TypeError("command must be a non-empty command path");let n=hR[t];return Cy({command:r,budget_class:t,default_max_estimated_tokens:n,default_max_estimated_tokens_by_format:{toon:n,json:Math.ceil(n*bR/wR)},degradation_ladder:ky,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function Cy(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,r]of Object.entries(e.default_max_estimated_tokens_by_format))if(!Number.isSafeInteger(r)||r<=0)throw new RangeError(`default_max_estimated_tokens_by_format.${t} must be a positive safe integer`);return e}var Iy=Jo.map(e=>Ad(e)),kR=new Map(Iy.map(e=>[e.command,e]));function Sd(e,t={}){let r=e.trim().replace(/\s+/gu," "),[n]=Ke(r).split(" "),o=kR.get(n);return o?{...o,command:r}:t.generateFallback?Ad(r):null}function nr(e){return Math.ceil(Math.max(0,e)/4)}function Od(e){let t=TR.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${kd.join(", ")}`);return t}function rr(e){return nr(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function AR(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Cd(e){if(!AR(e))return;let t={};for(let r of["suggested_retry","suggested_retry_args","next_best_command","allowed_values","candidate_commands","missing","missing_required_fields","option_scope","retry_after_ms"]){let n=e[r];Array.isArray(n)?t[r]=r==="suggested_retry_args"?n:n.slice(0,3):n!==void 0&&(t[r]=n)}return Object.keys(t).length>0?t:void 0}function SR(e,t){return typeof e!="string"||e.length<=t?e:`${e.slice(0,Math.max(1,t-3))}...`}function Pr(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;let r="...",n=Array.from(e),o=0,i=n.length;for(;o<i;){let s=Math.ceil((o+i)/2),a=`${n.slice(0,s).join("")}${r}`;Buffer.byteLength(a,"utf8")<=t?o=s:i=s-1}return`${n.slice(0,o).join("")}${r}`}function Ry(e){let t={};for(let r of["code","required","recovery","next_steps","exit_code","type","title","detail","why","examples"])Object.hasOwn(e,r)&&e[r]!==void 0&&(t[r]=e[r]);for(let[r,n]of Object.entries(e))r!=="__proto__"&&!Object.hasOwn(t,r)&&(t[r]=n);return t}var OR=new Set(["limit_collections","compact_recovery","action_only"]),CR=new Set(["compact_recovery","action_only"]);function IR(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:SR(e.required,160)??"Inspect the diagnostic code and retry with corrected input."},r=Cd(e.recovery);return r!==void 0?t.recovery=r: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 RR(e,t){let r=structuredClone(e);if(t!=="full"&&(delete r.why,delete r.examples),OR.has(t))for(let[n,o]of Object.entries(r))Array.isArray(o)&&(r[n]=o.slice(0,3));if(CR.has(t)){let n=Cd(r.recovery);n?r.recovery=n:delete r.recovery}return t!=="action_only"?Ry(r):IR(r)}function In(e,t){let r={...e,diagnostic_output:{...t,estimated_tokens:0}};for(let n=0;n<4;n+=1){let o=rr(r),i=r.diagnostic_output;if(i.estimated_tokens===o)break;i.estimated_tokens=o}return r}function xR(e,t,r){let n=In(e,t);for(let i of["recovery","exit_code"])rr(n)<=r||e[i]===void 0||(delete e[i],n=In(e,t));let o=40;for(;rr(n)>r&&o>4;)o-=4,e.code=Pr(String(e.code),o),e.required=Pr(String(e.required),o),n=In(e,t);return n}function NR(e,t){let r=e.diagnostic_output,{estimated_tokens:n,...o}=r,i=o.omitted_fields.slice(0,8).map(u=>Pr(u,32)),s={...o,omitted_fields:i,...o.omitted_fields.length>i.length?{omitted_fields_overflow_count:o.omitted_fields.length-i.length}:{}},a=Cd(e.recovery),c=a&&rr(a)<=48?a:void 0,l={code:Pr(String(e.code),320),required:Pr(String(e.required),320),...c?{recovery:c}:{},...e.exit_code!==void 0?{exit_code:e.exit_code}:{}},d=In(l,s);for(;rr(d)>t&&s.omitted_fields.length>0;)s.omitted_fields.pop(),s.omitted_fields_overflow_count=o.omitted_fields.length-s.omitted_fields.length,d=In(l,s);return d=xR(l,s,t),d}function DR(e,t={}){let r=e,n=t.diagnosticClass??"error",o=Od(n),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=rr(r),c=Object.keys(r);if(a<=s)return Ry(structuredClone(r));let l;for(let[d,u]of o.degradation_ladder.entries()){let f=RR(r,u),p=c.filter(h=>!Object.hasOwn(f,h)),m=In(f,{diagnostic_class:n,format:"json",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,truncated:d>0,degradation_steps:o.degradation_ladder.slice(0,d+1),omitted_fields:p});if(l=m,rr(m)<=s)break}return rr(l)>s&&(l=NR(l,s)),l}function Ty(e){return pR(e).replace(/\r\n/gu,`
|
|
2
|
+
`,"utf8")}finally{await n.close()}}async function wo(e){try{await ce.unlink(e)}catch(t){if(!ho(t))throw t}}function Sr(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===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]="de5f8d66-b9dc-555c-a52f-33b1b5368be3")}catch{}})();var RS="__pm_suppress_host_output",hl="@unbrained/pm-cli:suppress-host-output:v1";function Hm(e){return e===void 0?{__pm_suppress_host_output:hl}:{__pm_suppress_host_output:hl,result:e}}function rs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&e[RS]===hl}import mn from"node:fs";import Ot from"node:path";import{fileURLToPath as xS}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 NS="@unbrained/pm-cli";function DS(e){try{return JSON.parse(mn.readFileSync(e,"utf8")).name===NS}catch{return!1}}function PS(e){let t=mn.existsSync(e)&&mn.statSync(e).isDirectory()?Ot.resolve(e):Ot.dirname(Ot.resolve(e));for(;;){let r=Ot.join(t,"package.json");if(mn.existsSync(r)&&DS(r))return t;let n=Ot.dirname(t);if(n===t)return;t=n}}function Ct(e,t=[]){let r=xS(e),n=PS(r);return n||Ot.resolve(Ot.dirname(r),...t)}function bl(e,t=[]){try{let r=Ot.join(Ct(e,t),"package.json");if(!mn.existsSync(r))return;let n=JSON.parse(mn.readFileSync(r,"utf8"));return typeof n.version=="string"&&n.version.trim().length>0?n.version:void 0}catch{return}}function MS(e=process.env,t="PM_CLI_PACKAGE_ROOT",r,n=[]){let o=e[t];return typeof o=="string"&&o.trim().length>0?Ot.resolve(o.trim()):r?Ct(r,n):process.cwd()}(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 j(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function LS(e){return j(e)??void 0}function vo(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 _n(e){return Array.isArray(e)&&e.every(t=>typeof t=="number"&&Number.isFinite(t))}function B(e){if(e instanceof Error){let t=e.message.trim();return t.length>0?t:e.name}return String(e)}function ns(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 Bm(e){let t=ns(e);return t===null||t<=0||!Number.isInteger(t)?null:t}function zV(e,t,r){let n=ns(e);return n===null||n<t||n>r?null:n}function FS(e){return typeof e!="object"||e===null||Array.isArray(e)?null:e}function Wt(e){return typeof e!="object"||e===null?null:e}function Gm(e){return typeof e!="object"&&typeof e!="function"||e===null?null:e}function Vm(e){let t=Gm(e);if(!t)return null;if(typeof t.activate=="function")return t;let r=Gm(t.default);return typeof r?.activate=="function"?r:null}function $S(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...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]="9ddd9ea4-8586-5d3d-9ed8-0bf9da49b9a5")}catch{}})();var mt=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],os=2,wl=Object.freeze({migration:"schema",validation:"schema"}),HV=Object.freeze({version:os,capabilities:[...mt],legacy_aliases:{...wl}}),is=["off","warn","enforce"],ss=["off","warn","enforce"],as=["none","restricted","strict"],Wm=["block","warn"],cs=["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"],gn=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function ls(){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]="89d6c349-10d7-596d-90a1-65afcc65eb91")}catch{}})();var Ym=["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"],jS=["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",...Ym,"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"],Xe=jS;(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6e329ab1-f22d-5749-b8a4-0a6e7a1c8023")}catch{}})();var El=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"]}]),Tl=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),ds=".agents/pm",us="settings.json",US="Closed at creation via pm create",zS=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],qS=["decisions","events","reminders","milestones","meetings","plans"],YV=[...zS,...qS],Ee={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},kl={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}},HS=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],vl={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 Km(e){return e?[...e]:void 0}var O={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:[...HS],lifecycle_closure_like_blocked_reason_patterns:[...vl.blocked_reason],lifecycle_closure_like_resolution_patterns:[...vl.resolution],lifecycle_closure_like_actual_result_patterns:[...vl.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...kl.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:El.map(e=>({...e,aliases:Km(e.aliases),roles:Km(e.roles)})),fields:[],workflow:{...Tl},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:ls()},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:""}}},yn={metadata:{},body:""},_={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},GS=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 fs(e){let t=(e??"").trim().toLowerCase();if(t.length===0)return"unknown";let r=GS[t];return typeof r=="string"?r:t.includes("conflict")||t.includes("locked")?"conflict":t.startsWith("unknown_")||t.startsWith("missing_required_")?"usage":t.startsWith("invalid_")||t.endsWith("_not_found")||t.includes("validation")?"validation":t.endsWith("_error")||t.endsWith("_failed")?"runtime":"unknown"}(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]="0f7e5fb3-86d2-5af5-a189-a40dd223ef26")}catch{}})();var g=class extends Error{exitCode;code;context;constructor(t,r,n={}){super(t),this.name="PmCliError",this.exitCode=r,this.context=n,this.code=n.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]="a966bb77-c4be-593b-93f5-b6277072160e")}catch{}})();var hn=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],Xm=hn,bn=["draft","open","in_progress","blocked","closed","canceled"],ps=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],wn=["string","number","boolean","string_array","array","object"],ms=["create","update","update_many","list","search","calendar","context"],_s=["allow","warn","reject"],JV=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],ZV=["project","global"],QV=["low","medium","high","critical"],gs=["low","medium","high","critical"],ys=["low","medium","high"];var Jm=["minimal","default","strict","custom"],e5=["none","warn","strict"],t5=["progressive","strict"],r5=["off","warn","strict"],n5=["off","warn","strict"];var hs=["daily","weekly","monthly","yearly"],Eo=["mon","tue","wed","thu","fri","sat","sun"];function Al(e){return Eo.indexOf(e)}var Zm=["draft","research","review","approved","executing","paused","completed","superseded"],bs=["pending","in_progress","completed","blocked","skipped","superseded"],Qm=["codex","claude-code","cursor","generic"],e_=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],o5=["brief","standard","deep","full"],i5=["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]="0ca7f52c-fb31-5cd9-b689-a918f4e61816")}catch{}})();import KS 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]="7647d826-e562-5f8e-86b2-2e40d8714b4d")}catch{}})();function Yt(e){return[...new Set((e??[]).map(t=>t.trim()).filter(t=>t.length>0))].sort((t,r)=>t.localeCompare(r))}function BS(e){let t=e.key.trim();if(t.length===0)return null;let r=Yt(e.aliases),n=e.description?.trim();return{key:t,values:Yt(e.values),required:e.required===!0?!0:void 0,aliases:r.length>0?r:void 0,description:n&&n.length>0?n:void 0}}var VS=e=>e,r_=e=>{let t=e.trim().toLowerCase();return t==="create"||t==="update"?t:null};function WS(e,t){let r=t(e.command);if(r===null)return null;let n=e.option.trim();return n.length===0?null:{command:r,option:n,required:e.required,visible:e.visible,enabled:e.enabled}}function YS(e,t){let r=new Map;for(let n of e??[]){let o=WS(n,t);o&&r.set(`${o.command}:${o.option.toLowerCase()}`,o)}return[...r.values()].sort((n,o)=>n.command===o.command?n.option.localeCompare(o.option):n.command.localeCompare(o.command))}function t_(e,t){return t?Yt(e):void 0}function Sl(e){let t=e?.trim();return t&&t.length>0?t:void 0}function Ol(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 ws(e,t={}){let r=t.resolvePolicyCommand??VS,n=e.name.trim();if(n.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=Yt(e.aliases),l=(e.options??[]).map(u=>BS(u)).filter(u=>u!==null).sort((u,f)=>u.key.localeCompare(f.key)),d=YS(e.command_option_policies,r);return{name:n,description:Sl(e.description),default_status:Sl(e.default_status),...e.execution_role===void 0?{}:{execution_role:Ol(e.execution_role)},folder:Sl(e.folder),aliases:c.length>0?c:void 0,required_create_fields:t_(e.required_create_fields,o),required_create_repeatables:t_(e.required_create_repeatables,i),options:s?l:void 0,command_option_policies:a?d: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 XS=Object.freeze({decision:"human",milestone:"gate"}),JS=["title","description","status","priority","tags","body","deadline","estimatedMinutes","acceptanceCriteria","author","message","assignee"],ZS=["dep","comment","note","learning","file","test","doc"],Il=["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"],QS=["title","description","type","status","priority","tags","body",...Il,"author","message","dep","comment","note","learning","file","test","doc","reminder","event","typeOption","field"],eO=["title","description","body","status","closeReason","priority","type","tags",...Il,"author","message","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ownershipMetadataBypass","ownershipDependencyBypass","force"],o_={"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"},tO={...o_},rO={...o_},i_=[["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"]],s_=[["comment","--comment"],["note","--note"],["learning","--learning"],["file","--file"],["test","--test"],["doc","--doc"],["reminder","--reminder"],["event","--event"],["typeOption","--type-option"]];function a_(e){return Object.fromEntries(e)}var nO=a_([["title","--title"],["description","--description"],["type","--type"],["status","--status"],["priority","--priority"],["tags","--tags"],["body","--body"],...i_,["author","--author"],["message","--message"],["dep","--dep"],...s_]),oO=a_([["title","--title"],["description","--description"],["body","--body"],["status","--status"],["closeReason","--close-reason"],["priority","--priority"],["type","--type"],["tags","--tags"],...i_,...s_,["author","--author"],["message","--message"],["force","--force"]]);function iO(e){return e.trim().replace(/^--+/,"").toLowerCase()}function sO(e){return e==="create"?QS:eO}function aO(e){return e==="create"?tO:rO}function Rl(e,t){let r=iO(t);if(r.length===0)return;let n=aO(e)[r];return n||sO(e).find(o=>o.toLowerCase()===r)}function cO(e,t){return(e==="create"?nO:oO)[t]??`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function ko(e){let t=lO(e);return t.length===0?"items":t.endsWith("s")?t:`${t}s`}function vs(e){let t=e.trim(),n=t.replaceAll("\\","/").replace(/^\/+/,""),o=KS.posix.normalize(n);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 lO(e){let t=e.trim().toLowerCase(),r="",n=!1;for(let o of t){let i=o.charCodeAt(0),s=i>=97&&i<=122,a=i>=48&&i<=57;if(s||a){n&&r.length>0&&(r+="-"),r+=o,n=!1;continue}r.length>0&&(n=!0)}return r}function dO(e){return ws(e,{resolvePolicyCommand:r_})}function To(e,t){let r=e[t];return Array.isArray(r)?r.filter(n=>typeof n=="string"):void 0}function uO(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:To(t,"values")??[],required:t.required===void 0?void 0:!!t.required,aliases:To(t,"aliases"),description:typeof t.description=="string"?t.description:void 0}}function fO(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 r=t.command.trim().toLowerCase();return r!=="create"&&r!=="update"?null:{command:r,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 pO(e){if(Array.isArray(e.options))return e.options.map(t=>uO(t)).filter(t=>t!==null)}function mO(e){if(Array.isArray(e.command_option_policies))return e.command_option_policies.map(t=>fO(t)).filter(t=>t!==null)}function _O(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e,r=typeof t.name=="string"?t.name:"";if(r.trim().length===0)return null;let n=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:r,description:o,default_status:i,execution_role:Ol(t.execution_role),folder:n,aliases:To(t,"aliases"),required_create_fields:To(t,"required_create_fields"),required_create_repeatables:To(t,"required_create_repeatables"),options:pO(t),command_option_policies:mO(t)}}function gO(e,t){return e.required_create_fields?Yt(e.required_create_fields):t?.required_create_fields??[]}function yO(e,t){return e.required_create_repeatables?Yt(e.required_create_repeatables):t?.required_create_repeatables??[]}function hO(e,t){return e.options?e.options:t?.options?[...t.options]:[]}function bO(e,t){return e.command_option_policies?e.command_option_policies:t?.command_option_policies?[...t.command_option_policies]:[]}function wO(e,t){let r=t?.name??e.name,n=e.description??t?.description,o=e.default_status??t?.default_status,i=vs(e.folder??t?.folder??ko(r)),s={name:r,execution_role:e.execution_role,folder:i,aliases:Yt([...t?.aliases??[],...e.aliases??[]]),required_create_fields:gO(e,t),required_create_repeatables:yO(e,t),options:hO(e,t),command_option_policies:bO(e,t)};return n&&(s.description=n),o&&(s.default_status=o),s}function n_(e,t){for(let r of e){let n=dO(r);if(!n)continue;let o=n.name.toLowerCase(),i=t.get(o);t.set(o,wO({...n,execution_role:n.execution_role??i?.execution_role},i))}}function vO(e){if(!e)return[];let t=[];for(let r of e.item_types??[]){let n=r.types;if(Array.isArray(n))for(let o of n){let i=_O(o);i&&t.push(i)}}return t}function Ao(e,t=null){let r=new Map;for(let c of Xm)r.set(c.toLowerCase(),{name:c,execution_role:XS[c.toLowerCase()]??"agent",folder:Ee[c],aliases:[],required_create_fields:[...JS],required_create_repeatables:[...ZS],options:[],command_option_policies:[]});n_(e.item_types?.definitions??[],r),n_(vO(t),r);let n=[...r.values()].sort((c,l)=>c.name.localeCompare(l.name)),o={},i={},s={};for(let c of n){o[c.name]=c,s[c.name]=c.folder,i[c.name.toLowerCase()]=c.name;for(let l of c.aliases)i[l.toLowerCase()]=c.name}let a=[...new Set(n.map(c=>c.folder))].sort((c,l)=>c.localeCompare(l));return{types:n.map(c=>c.name),folders:a,type_to_folder:s,by_type:o,alias_to_type:i}}function c_(e,t){if(e!==void 0)return t.alias_to_type[e.trim().toLowerCase()]}function l_(e,t){let r=c_(e,t);if(r)return t.by_type[r]}function EO(e,t,r,n){for(let o of n){let i=Rl(r,o);if(i){e.required.add(i);continue}e.errors.push(`Unsupported base required option "${o}" for command "${r}" on type "${t.name}"`)}}function Cl(e,t,r){if(r){e.add(t);return}e.delete(t)}function TO(e,t,r,n){let o=Rl(r,n.option);if(!o){e.errors.push(`Unsupported command_option_policies option "${n.option}" for command "${r}" on type "${t.name}"`);return}n.required!==void 0&&Cl(e.required,o,n.required),n.visible!==void 0&&Cl(e.hidden,o,!n.visible),n.enabled!==void 0&&Cl(e.disabled,o,!n.enabled)}function kO(e,t,r){for(let n of t.command_option_policies)n.command===r&&TO(e,t,r,n)}function AO(e,t,r){for(let n of e.required)e.disabled.has(n)&&e.errors.push(`Option "${n}" cannot be both required and disabled for command "${r}" on type "${t.name}"`)}function SO(e,t,r){let n=[],o=new Set,i=new Set,s=new Set,a={required:o,hidden:i,disabled:s,errors:n};return EO(a,e,t,r),kO(a,e,t),AO(a,e,t),{required:[...o],hidden:[...i].sort((c,l)=>c.localeCompare(l)),disabled:[...s].sort((c,l)=>c.localeCompare(l)),errors:n}}function OO(e){let t=new Map;for(let r of e.options){t.set(r.key.toLowerCase(),r);for(let n of r.aliases??[])t.set(n.toLowerCase(),r)}return t}function CO(e,t,r){let n=e.values;if(n.length===0)return t;let i=new Map(n.map(s=>[s.toLowerCase(),s])).get(t.toLowerCase());if(!i){r.push(`Invalid value "${t}" for type option "${e.key}". Allowed: ${n.join(", ")}`);return}return i}function IO(e,t,r){let n=l_(e,r);if(!n)return{normalized:void 0,errors:[`Unknown type "${e}"`]};let o=[],i=OO(n),s={};for(let[c,l]of Object.entries(t??{})){let d=c.trim(),u=l.trim();if(d.length===0){o.push("type option keys must not be empty");continue}if(u.length===0){o.push(`type option "${d}" must not be empty`);continue}let f=i.get(d.toLowerCase());if(!f){let m=n.options.map(h=>h.key).join(", ");o.push(n.options.length>0?`Unknown type option "${d}" for type "${n.name}". Allowed: ${m}`:`Type "${n.name}" does not define any configurable type options`);continue}let p=CO(f,u,o);p!==void 0&&(s[f.key]=p)}for(let c of n.options)c.required&&!(c.key in s)&&o.push(`Missing required type option "${c.key}" for type "${n.name}"`);let a=Object.keys(s).sort((c,l)=>c.localeCompare(l));return a.length===0?{normalized:void 0,errors:o}:{normalized:Object.fromEntries(a.map(c=>[c,s[c]])),errors:o}}import{readFileSync as RO,readdirSync as xO,statSync as NO}from"node:fs";import DO from"node:os";import M 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]="124443e3-a20b-5fd6-a1d9-e4a09b17dc4a")}catch{}})();var PO={json_markdown:".md",toon:".toon"},MO={".md":"json_markdown",".toon":"toon"},LO=new Set([".git","coverage","dist","node_modules"]),Es=[".md",".toon"];function So(e){try{return NO(e),!0}catch{return!1}}function d_(e){try{let t=JSON.parse(RO(e,"utf8"));return typeof t!="object"||t===null||Array.isArray(t)?!1:"id_prefix"in t||"item_format"in t}catch{return!1}}function FO(e){let t=M.resolve(e);for(;;){let r=M.join(t,ds),n=M.join(r,us);if(So(n))return r;let o=M.join(t,us);if(So(o)&&d_(o))return t;let i=M.dirname(t);if(i===t)return;t=i}}function u_(e){return FO(e)??M.resolve(e,ds)}function v5(e,t){let r=t?M.resolve(t):void 0;try{return xO(M.resolve(e),{withFileTypes:!0}).filter(n=>n.isDirectory()&&!LO.has(n.name)).map(n=>M.join(M.resolve(e),n.name)).filter(n=>n!==r).filter(n=>So(Te(n))).filter(n=>d_(Te(n))).sort((n,o)=>n.localeCompare(o))[0]}catch{return}}function Oo(e,t){let r=process.env.PM_PATH,n=t?.trim()||r?.trim();if(n){let o=M.resolve(e,n);if(!So(Te(o))){let i=M.join(o,ds);if(So(Te(i)))return i}return o}return u_(e)}function $O(e){let t=M.resolve(e),r=M.dirname(t);return M.basename(t)==="pm"&&M.basename(r)===".agents"?M.dirname(r):t}function It(e){let t=process.env.PM_GLOBAL_PATH?.trim(),r=t&&t.length>0?t:M.join(DO.homedir(),".pm-cli");return M.resolve(e,r)}function Te(e){return M.join(e,us)}function jO(e,t,r=Ee){let n=r[t]??ko(t);return M.join(e,n)}function vn(e,t,r,n="toon",o=Ee){return M.join(jO(e,t,o),`${r}${PO[n]}`)}function Co(e){let t=e.replaceAll("\\","/"),r=M.posix.extname(t).toLowerCase();return MO[r]??null}function _t(e,t){if(!/^(?!\.{1,2}$)[^/\\:\0]+$/.test(t))throw new g("Invalid history item id: expected a single filename.",_.USAGE);return M.join(e,"history",`${t}.jsonl`)}function f_(e,t){return M.join(e,"locks",`${t}.lock`)}function xl(e){return M.join(e,"runtime")}function Ts(e){return M.join(xl(e),"test-runs")}function UO(e){return M.join(Ts(e),"runs")}function E5(e,t){return M.join(UO(e),`${t}.json`)}function zO(e){return M.join(Ts(e),"stdout")}function qO(e){return M.join(Ts(e),"stderr")}function T5(e,t){return M.join(zO(e),`${t}.log`)}function k5(e,t){return M.join(qO(e),`${t}.log`)}function HO(e){return M.join(Ts(e),"results")}function A5(e,t){return M.join(HO(e),`${t}.json`)}(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 J(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function GO(){return{json:!1,quiet:!1,noExtensions:!1,profile:!1}}function Le(e){return e?U(e):{}}function Fe(e){return e?U(e):GO()}function U(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 BO=new Set(["commands","command_overrides","command_handlers","flag_commands","parser_overrides"]),VO=["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 WO(e,t){for(let r of VO){let n=e[r];if(n===void 0)continue;if(!Array.isArray(n)||n.some(i=>typeof i!="string"))return!1;let o=n.map(i=>BO.has(r)?J(i):i.trim()).filter(i=>i.length>0);t[r]=[...new Set(o)].sort((i,s)=>i.localeCompare(s))}return!0}function YO(e){if(!Array.isArray(e))return null;let t=[];for(let r of e){if(typeof r!="object"||r===null)return null;let n=r;if(n.format!=="json"&&n.format!=="toon"||!Array.isArray(n.commands)||n.commands.some(o=>typeof o!="string")||typeof n.result_discriminator!="boolean")return null;t.push({format:n.format,commands:[...new Set(n.commands.map(o=>J(o)))].sort((o,i)=>o.localeCompare(i)),result_discriminator:n.result_discriminator})}return t.sort((r,n)=>r.format.localeCompare(n.format))}function KO(e){if(!Array.isArray(e))return null;let t=[];for(let r of e){if(typeof r!="object"||r===null)return null;let n=r.commands;if(!Array.isArray(n)||n.some(o=>typeof o!="string"))return null;t.push({commands:[...new Set(n.map(o=>J(o)))].filter(o=>o.length>0).sort((o,i)=>o.localeCompare(i))})}return t}function ks(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 r={schema_version:1};if(!WO(t,r))return null;let n=t.preflight_overrides;if(n!==void 0&&(!Number.isInteger(n)||n<0))return null;typeof n=="number"&&(r.preflight_overrides=n);let o=t.renderer_ownership;if(o!==void 0){let s=YO(o);if(s===null)return null;r.renderer_ownership=s}let i=t.preflight_ownership;if(i!==void 0){let s=KO(i);if(s===null)return null;r.preflight_ownership=s}return r}function I5(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]="de2a2a0e-8a39-5569-9af9-cbf557bce2a9")}catch{}})();function ot(e,t,r){if(e===t)return 0;if(Math.abs(e.length-t.length)>r)return null;let n=t.length+1,o=new Array(n),i=new Array(n),s=new Array(n);for(let c=0;c<n;c+=1)o[c]=0,i[c]=c;for(let c=1;c<=e.length;c+=1){s[0]=c;let l=s[0];for(let d=1;d<=t.length;d+=1){let u=e[c-1]===t[d-1]?0:1,f=i[d-1]+u,p=s[d-1]+1,m=i[d]+1,h=Math.min(f,p,m);c>1&&d>1&&e[c-1]===t[d-2]&&e[c-2]===t[d-1]&&(h=Math.min(h,o[d-2]+1)),s[d]=h,h<l&&(l=h)}if(l>r)return null;for(let d=0;d<n;d+=1)o[d]=i[d],i[d]=s[d]}let a=i[t.length];return a<=r?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 Io(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,r)=>t.localeCompare(r))}function Kt(e){return mt.includes(e)}function p_(e){let t=e.trim().toLowerCase();return Kt(t)?t:null}function m_(e){return e.filter(t=>!Kt(t))}function Nl(e){let t=e.trim().toLowerCase();return t.length===0?null:wl[t]??null}function __(e){let t=Io([...e].map(i=>i.toLowerCase())),r=[],n=[];for(let i of t){let s=Nl(i);if(s){r.push(s),n.push({alias:i,target:s});continue}r.push(i)}let o=[...new Map(n.map(i=>[`${i.alias}>${i.target}`,i])).values()].sort((i,s)=>i.alias.localeCompare(s.alias));return{capabilities:Io(r),legacy_aliases:o}}function XO(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let r=Nl(t);if(r)return r;let n=Math.max(1,Math.floor(t.length*.34)),o=null,i=Number.POSITIVE_INFINITY;for(let s of mt){let a=ot(t,s,n);a!==null&&a<i&&(i=a,o=s)}return o}function g_(e,t,r){let n=mt.join(","),o=XO(r)??"none";return`extension_capability_unknown:${e}:${t}:${r}:allowed=${n}:suggested=${o}`}function y_(e,t,r){let n=r.map(o=>`${o.alias}>${o.target}`).join(",");return`extension_capability_legacy_alias:${e}:${t}:aliases=${n}`}function JO(e){let t=/^extension_capability_unknown:(global|project):([^:]+):([^:]+):allowed=([^:]+):suggested=([^:]+)$/.exec(e.trim());if(!t)return null;let[,r,n,o,i,s]=t,a=r,c=i.split(",").map(p=>p.trim()).filter(p=>p.length>0),l=Nl(o),u=(s==="none"?void 0:s)??l??void 0;return{layer:a,name:n,capability:o,allowed_capabilities:c,capability_contract_version:os,suggested_capability:u,suggestion_source:u?l===u?"legacy_alias":"nearest_match":void 0,legacy_alias_target:l??void 0}}function ZO(e){let t=/^extension_capability_legacy_alias:(global|project):([^:]+):aliases=(.+)$/.exec(e.trim());if(!t)return[];let[,r,n,o]=t,i=r,s=[...mt],a=[];for(let c of o.split(",")){let[l,d]=c.split(">"),u=l?.trim(),f=d?.trim().toLowerCase();!u||!f||!Kt(f)||a.push({layer:i,name:n,capability:u,allowed_capabilities:s,capability_contract_version:os,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]="01116a5e-62d1-591b-9fd0-84ac6e99f8d0")}catch{}})();function Ro(){return{beforeCommand:[],beforeMutation:[],afterCommand:[],onWrite:[],onRead:[],onIndex:[]}}function Dl(){return{overrides:[],handlers:[]}}function Pl(){return{overrides:[]}}function Ml(){return{overrides:[]}}function Ll(){return{overrides:[]}}function Fl(){return{overrides:[]}}function As(){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]="9961b408-ad70-5556-84dd-5ca1b1497c27")}catch{}})();var QO=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 eC(e){return{unknownKeys:Object.keys(e).filter(t=>!QO.has(t)).sort((t,r)=>t>r?1:-1),missingVersionBounds:e.pm_min_version===void 0&&e.pm_max_version===void 0}}function tC(e){let t=eC(e),r=t.unknownKeys.map(n=>({code:"manifest_unknown_key",path:n,...n==="compatibility"?{suggested_key:"pm_min_version"}:{},message:n==="compatibility"?'Manifest key "compatibility" is ignored; declare the canonical pm_min_version and optional pm_max_version fields instead.':`Manifest key "${n}" is not part of the extension manifest contract and will be ignored.`}));return t.missingVersionBounds&&r.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:r.length===0,findings:r}}function h_(e,t,r){return tC(r).findings.map(n=>n.code==="manifest_unknown_key"?`extension_manifest_unknown_key:${e}:${t.name}:key=${n.path}${n.suggested_key?`:suggested=${n.suggested_key}`:""}`:`extension_manifest_no_version_bounds:${e}:${t.name}:suggested=pm_min_version`)}import{constants as Xt}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 b_=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"}]]),rC=/^[a-z][a-z0-9_]{0,63}$/u,nC=new Map([[Xt.errno.EACCES,"EACCES"],[Xt.errno.EDQUOT,"EDQUOT"],[Xt.errno.EMFILE,"EMFILE"],[Xt.errno.ENFILE,"ENFILE"],[Xt.errno.ENOMEM,"ENOMEM"],[Xt.errno.ENOSPC,"ENOSPC"],[Xt.errno.EPERM,"EPERM"],[Xt.errno.EROFS,"EROFS"]].filter(([e])=>Number.isInteger(e))),oC={capacity:{code:"host_environment_capacity_fault"},permission:{code:"host_environment_permission_fault"},resource:{code:"host_environment_resource_fault"}};function iC(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.code=="string"&&b_.has(t.code)?t.code:typeof t.errno!="number"||!Number.isInteger(t.errno)?null:nC.get(Math.abs(t.errno))??null}function sC(e,t,r={}){let n=iC(e);if(n===null)return null;if(!rC.test(t))throw new g("Host environment operation labels must be bounded identifiers.",_.USAGE,{code:"host_environment_operation_invalid",field:"operation"});let o=b_.get(n);return new g(`Host filesystem operation ${t} ${o.summary}.`,_.GENERIC_FAILURE,{code:r.codes?.[o.category]??oC[o.category].code,reason:n,required:o.recovery,why:r.why??"The operating system refused a required project filesystem operation.",nextSteps:[o.recovery,...r.nextSteps??[]],...r.suggestedRetry?{recovery:{suggested_retry:r.suggestedRetry}}:{}})}async function w_(e,t,r={}){try{return await t()}catch(n){throw sC(n,e,r)??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]="31da4a5a-1e85-5d77-a09f-2736cc44d850")}catch{}})();var aC=Object.freeze({string:"string",number:"number",int:"number",integer:"number",float:"number",boolean:"boolean",bool:"boolean"});function $l(e){return typeof e!="string"?null:aC[e.trim().toLowerCase()]??null}function jl(e){let t=[],r=n=>{if(Array.isArray(n)){for(let o of n)r(o);return}if(typeof n=="string"){for(let o of n.split(",")){let i=o.trim();i.length>0&&t.push(i)}return}n!=null&&t.push(n)};return r(e),t}function v_(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())}import cC 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 lC(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 dC(e){let t=Object.keys(e).sort(),r={};for(let n of t){let o=e[n];o!==void 0&&(r[n]=Ss(o))}return r}function Ss(e){let t=lC(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(n=>Ss(n));if(e instanceof Date)return e.toISOString();let r=e;if(typeof r.toJSON=="function"){let n=r.toJSON();if(n!==e)return Ss(n)}return dC(e)}function L(e){return JSON.stringify(Ss(e))}function E_(e,t,r,n){for(let o=0;o<t.length;o+=1)if(!r.has(o)&&n(e,t[o]))return r.add(o),!0;return!1}function uC(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function fC(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function pC(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let r=[...t],n=new Set;for(let o of e)if(!E_(o,r,n,ne))return!1;return!0}function mC(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let r=[...t.entries()],n=new Set;for(let[o,i]of e.entries())if(!E_([o,i],r,n,([a,c],[l,d])=>ne(a,l)&&ne(c,d)))return!1;return!0}function _C(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((r,n)=>ne(r,t[n]))}function gC(e,t){let r=Object.keys(e).sort((o,i)=>o.localeCompare(i)),n=Object.keys(t).sort((o,i)=>o.localeCompare(i));if(r.length!==n.length)return!1;for(let o=0;o<r.length;o+=1){let i=r[o];if(i!==n[o]||!ne(e[i],t[i]))return!1}return!0}var yC=[uC,fC,pC,mC,_C];function ne(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let r of yC){let n=r(e,t);if(n!==void 0)return n}return gC(e,t)}function Os(e){return cC.createHash("sha256").update(e,"utf8").digest("hex")}function R(e,t){let r={};for(let o of t){let i=e[o];i!==void 0&&(r[o]=i)}let n=Object.keys(e).filter(o=>!t.includes(o)).sort((o,i)=>o.localeCompare(i));for(let o of n){let i=e[o];i!==void 0&&(r[o]=i)}return 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]="736cf7fc-d4da-57ce-90d8-2432085dd2c8")}catch{}})();var hC=5e3;async function xo(e,t,r){let n=[];for(let o of e)try{await o.run(U(r))}catch{n.push(`extension_hook_failed:${o.layer}:${o.name}:${t}`)}return n}async function T_(e,t){return xo(e.beforeCommand,"beforeCommand",t)}function bC(e,t,r){if(e===void 0)return;if(typeof e!="object"||e===null||!("allow"in e)||e.allow!==!0&&e.allow!==!1)throw new g(`Extension mutation guard ${t.name} returned an invalid decision.`,_.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 n=e,o=typeof n.code=="string"?n.code.trim():"",i=typeof n.remediation=="string"?n.remediation.trim():"";if(o.length===0||i.length===0)throw new g(`Extension mutation guard ${t.name} returned an invalid denial.`,_.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 n.message=="string"?n.message.trim():"";throw new g(s||`Extension mutation guard ${t.name} denied ${r}.`,_.CONFLICT,{code:o,reason:`${t.layer}:${t.name}`,nextSteps:[i]})}async function Ul(e,t){for(let r of e.beforeMutation??[]){let n,o;try{let i=Promise.resolve().then(()=>r.run({pm_root:t.pm_root,operation:t.operation,before:t.before===null?null:U(t.before),after:t.after===null?null:U(t.after),changed_fields:[...t.changed_fields],sdk:t.sdk}));i.catch(()=>{}),n=await Promise.race([i,new Promise((s,a)=>{o=setTimeout(()=>{a(new g(`Extension mutation guard ${r.name} timed out before ${t.operation}.`,_.CONFLICT,{code:"extension_mutation_guard_timed_out",reason:`${r.layer}:${r.name}`,nextSteps:["Fix or disable the stalled extension guard, then retry the mutation."]}))},hC),o.unref?.()})])}catch(i){throw i instanceof g?i:new g(`Extension mutation guard ${r.name} failed before ${t.operation}.`,_.CONFLICT,{code:"extension_mutation_guard_failed",reason:`${r.layer}:${r.name}`,nextSteps:["Fix or disable the failing extension guard, then retry the mutation."]})}finally{clearTimeout(o)}bC(n,r,t.operation)}}async function k_(e,t){return xo(e.afterCommand,"afterCommand",t)}async function zl(e,t){return xo(e.onWrite,"onWrite",t)}async function ql(e,t){return xo(e.onRead,"onRead",t)}async function Hl(e,t){return xo(e.onIndex,"onIndex",t)}function wC(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 r=t.replace(/\s+/gu," ").trim();if(r.length===0)return"";let n=300;return r.length>n?`${r.slice(0,n-1)}\u2026`:r}function Cs(e,t){if(typeof e!="object"||e===null||typeof e[t]!="string")return;let r=String(e[t]).replace(/\s+/gu," ").trim();return r.length>0?r.slice(0,300):void 0}function vC(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 Gl(e,t){let r=J(t.command);if(r.length===0)return{handled:!1,result:null,warnings:[]};let n=[...e.handlers].reverse().find(o=>o.command===r);if(!n)return{handled:!1,result:null,warnings:[]};try{let o=await n.run({command:r,args:U(t.args),options:U(t.options),global:U(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",vC(o)],["errorCode",Cs(o,"code")],["remediation",Cs(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:${n.layer}:${n.name}:${n.command}`],errorMessage:wC(o),...Object.fromEntries([["errorCode",Cs(o,"code")],["remediation",Cs(o,"remediation")]].filter(s=>s[1]!==void 0))}}}async function Bl(e,t){let r=J(t.command);if(r.length===0)return{overridden:!1,context:{command:r,args:U(t.args),options:Le(t.options),global:Fe(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},warnings:[]};let n=[...e.overrides].reverse().find(o=>o.command===r);if(!n)return{overridden:!1,context:{command:r,args:U(t.args),options:Le(t.options),global:Fe(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},warnings:[]};try{let o=await Promise.resolve(n.run({command:r,args:U(t.args),options:Le(t.options),global:Fe(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}))??{},i=Array.isArray(o.args)?U(o.args):U(t.args),s=o.options?Le(o.options):Le(t.options),a=o.global?Fe(o.global):Fe(t.global);return{overridden:!0,context:{command:r,args:i,options:s,global:a,pm_root:t.pm_root,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel},warnings:[]}}catch{return{overridden:!1,context:{command:r,args:U(t.args),options:Le(t.options),global:Fe(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},warnings:[`extension_parser_override_failed:${n.layer}:${n.name}:${n.command}`]}}}async function Vl(e,t){let r={command:J(t.command),args:U(t.args),options:Le(t.options),global:Fe(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},n=U(t.decision),o=[...e.overrides].reverse().find(i=>!i.commands?.length||i.commands.includes(r.command));if(!o)return{overridden:!1,context:r,decision:n,warnings:[]};try{let i=await Promise.resolve(o.run({command:r.command,args:U(r.args),options:Le(r.options),global:Fe(r.global),pm_root:r.pm_root,source_workspace_root:r.source_workspace_root,repo_root:r.repo_root,pm_root_rel:r.pm_root_rel,decision:U(n)}))??{},s={command:r.command,args:Array.isArray(i.args)?U(i.args):r.args,options:i.options?Le(i.options):r.options,global:i.global?Fe(i.global):r.global,pm_root:r.pm_root,source_workspace_root:r.source_workspace_root,repo_root:r.repo_root,pm_root_rel:r.pm_root_rel},a={enforce_item_format_gate:typeof i.enforce_item_format_gate=="boolean"?i.enforce_item_format_gate:n.enforce_item_format_gate,run_preflight_item_format_sync:typeof i.run_preflight_item_format_sync=="boolean"?i.run_preflight_item_format_sync:n.run_preflight_item_format_sync,run_extension_migrations:typeof i.run_extension_migrations=="boolean"?i.run_extension_migrations:n.run_extension_migrations,enforce_mandatory_migration_gate:typeof i.enforce_mandatory_migration_gate=="boolean"?i.enforce_mandatory_migration_gate:n.enforce_mandatory_migration_gate};return{overridden:!0,context:s,decision:a,warnings:[]}}catch{return{overridden:!1,context:r,decision:n,warnings:[`extension_preflight_override_failed:${o.layer}:${o.name}`]}}}function A_(e){return{handled:!1,result:e.payload,warnings:[]}}function S_(e,t){return[...e.overrides].reverse().filter(r=>r.service===t)}function O_(e){return{service:e.service,command:e.command?J(e.command):void 0,args:e.args?U(e.args):void 0,options:e.options?Le(e.options):void 0,global:e.global?Fe(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:U(e.payload)}}function EC(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 C_(e,t){return EC(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 I_(e,t,r){return t.service==="output_format"&&typeof e=="object"&&e!==null&&ne(e,r.payload)}function R_(e,t,r){if(t.handled){if(e.passThrough===!0){r.push(`extension_service_pass_through_contract_violated:${e.layer}:${e.name}:${e.service}`);return}return{handled:!0,result:t.result,warnings:r}}}function Wl(e,t){let r=S_(e,t.service);if(r.length===0)return A_(t);let n=[];for(let o of r)try{let i=O_(t),s=o.run(i);if(s instanceof Promise){n.push(`extension_service_override_async_unsupported:${o.layer}:${o.name}:${o.service}`);continue}if(I_(s,t,i)){n.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=R_(o,C_(s,t),n);if(a)return a}catch{n.push(`extension_service_override_failed:${o.layer}:${o.name}:${o.service}`)}return{handled:!1,result:t.payload,warnings:n}}async function Yl(e,t){let r=S_(e,t.service);if(r.length===0)return A_(t);let n=[];for(let o of r)try{let i=O_(t),s=await Promise.resolve(o.run(i));if(I_(s,t,i)){n.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=R_(o,C_(s,t),n);if(a)return a}catch{n.push(`extension_service_override_failed:${o.layer}:${o.name}:${o.service}`)}return{handled:!1,result:t.payload,warnings:n}}function Kl(e,t){let r=J(t.command);if(r.length===0)return{overridden:!1,result:t.result,warnings:[]};let n=[...e.overrides].reverse().find(o=>o.command===r);if(!n)return{overridden:!1,result:t.result,warnings:[]};try{let o=Le(t.options),i=Fe(t.global),s=n.run({command:r,args:U(t.args),options:o,global:i,pm_root:t.pm_root,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel,result:U(t.result)});return s instanceof Promise?{overridden:!1,result:t.result,warnings:[`extension_command_override_async_unsupported:${n.layer}:${n.name}:${n.command}`]}:{overridden:!0,result:s,warnings:[]}}catch{return{overridden:!1,result:t.result,warnings:[`extension_command_override_failed:${n.layer}:${n.name}:${n.command}`]}}}function TC(e,t,r){if((e.commands?.length??0)>0&&!e.commands?.includes(t))return!1;if(e.resultDiscriminator===void 0)return!0;try{return e.resultDiscriminator(U(r))}catch{return!1}}function Xl(e,t){let r=typeof t.command=="string"?J(t.command):"",n=[...e.overrides].reverse().find(o=>o.format===t.format&&TC(o,r,t.result));if(!n)return{overridden:!1,rendered:null,warnings:[]};try{let o=Array.isArray(t.args)?U(t.args):[],i=Le(t.options),s=Fe(t.global),a=typeof t.pm_root=="string"?t.pm_root:"",c=n.run({format:t.format,command:r,args:o,options:i,global:s,pm_root:a,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel,result:U(t.result)});return c==null?{overridden:!1,rendered:null,warnings:[]}:typeof c!="string"?{overridden:!1,rendered:null,warnings:[`extension_renderer_invalid_result:${n.layer}:${n.name}:${n.format}`]}:{overridden:!0,rendered:c,warnings:[]}}catch{return{overridden:!1,rendered:null,warnings:[`extension_renderer_failed:${n.layer}:${n.name}:${n.format}`]}}}import xr from"node:fs/promises";import Rr from"node:path";import{pathToFileURL as sI}from"node:url";import x_ 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 Jl(e,t){let r=x_.relative(e,t);return r.length===0?!0:!r.startsWith("..")&&!x_.isAbsolute(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]="44b86710-2d6f-57fe-912d-1cf7482a4f86")}catch{}})();function N_(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(([r,n])=>[r,n.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[r,n]of Object.entries(t.registrations))e.registrations[r].length=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]="aade6230-a71b-5cbc-bc9d-022f20e521bd")}catch{}})();function pe(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return t}function be(e,t){if(t!==void 0&&typeof t!="boolean")throw new TypeError(`${e} must be a boolean when provided`)}function ie(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 D_(e,t){if(t===void 0)return;let r=n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean";if(Array.isArray(t)){for(let[n,o]of t.entries())if(!r(o))throw new TypeError(`${e}[${n}] must be a string, number, or boolean`);return}if(!r(t))throw new TypeError(`${e} must be a string, number, or boolean, or an array of these when provided`)}function Or(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[r,n]of t.entries())if(typeof n!="string"||n.trim().length===0)throw new TypeError(`${e}[${r}] must be a non-empty string`)}}function No(e,t){if(Or(e,t),!Array.isArray(t))return[];let r=[],n=new Set;for(let o of t){let i=o.trim();i.length===0||n.has(i)||(n.add(i),r.push(i))}return 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]="34536eba-0f92-5599-a807-5b39b000e733")}catch{}})();var Zl=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 kC=new Set(Zl);function AC(e){if(e!==void 0&&!kC.has(String(e)))throw new Error(`registerCommand definition.family must be one of: ${Zl.join(", ")}`)}function P_(e){ie("registerCommand definition.action",e.action),ie("registerCommand definition.family",e.family),ie("registerCommand definition.description",e.description),ie("registerCommand definition.intent",e.intent),ie("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");AC(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 SC(e){let t=pe("registerExporter options.output",e),r=new Set(["channel","receipt","media_type"]);for(let n of Object.keys(t))if(!r.has(n))throw new TypeError(`registerExporter options.output contains unsupported field ${n}`);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 ie("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 M_(e,t,r){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 n=SC(t.output);return!r&&n.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."),n}function Ql(e,t,r){return{registration:t,action:r,command:e.command,args:U(e.args),options:U(e.options),global:U(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 L_(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 Je(e){return typeof e!="string"?"":e.trim().toLowerCase()}function q(e){return new Set((e??[]).map(t=>t.trim().toLowerCase()).filter(t=>t.length>0))}function OC(e){let t=e.trim().toLowerCase();if(t.length===0)return"";let r=t.split(/[.:/]/).map(n=>n.replace(/[\s_-]+/g,"")).filter(n=>n.length>0);return r.length===0?"":r.length===1?r[0]:`${r[0]}.${r.slice(1).join("")}`}function En(e){return new Set((e??[]).map(t=>OC(t)).filter(t=>t.length>0))}function F_(e){let t=Je(e);return is.includes(t)?t:"off"}function $_(e){let t=Je(e);return ss.includes(t)?t:"off"}function Do(e){let t=Je(e);return as.includes(t)?t:"none"}function ed(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return Wm.includes(t)?t:void 0}function j_(e){if(typeof e=="string"){let t=ed(e)??"block";return{global:t,project:t}}return typeof e=="object"&&e!==null&&!Array.isArray(e)?{global:ed(e.global)??"block",project:ed(e.project)??"block"}:{global:"block",project:"block"}}function CC(e){return e.global===e.project?e.global:{global:e.global,project:e.project}}function W(e){return[...new Set(e)].sort((t,r)=>t.localeCompare(r))}function IC(e){let t=Je(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?Do(e.sandbox_profile):void 0,allowedCapabilities:q(e.allowed_capabilities),blockedCapabilities:q(e.blocked_capabilities),allowedSurfaces:En(e.allowed_surfaces),blockedSurfaces:En(e.blocked_surfaces),allowedCommands:q(e.allowed_commands),blockedCommands:q(e.blocked_commands),allowedActions:q(e.allowed_actions),blockedActions:q(e.blocked_actions),allowedServices:q(e.allowed_services),blockedServices:q(e.blocked_services)}}}function U_(e){let t=new Map;for(let r of e??[]){let n=IC(r);n&&t.set(n.name,n.normalized)}return t}function RC(e){let t=[],r=[...e.overridesByName.values()].sort((o,i)=>o.name.localeCompare(i.name));for(let o of W([...e.allowedCapabilities,...e.blockedCapabilities]))Kt(o)||t.push(`extension_policy_unknown_capability:${o}`);for(let o of r)for(let i of W([...o.allowedCapabilities,...o.blockedCapabilities]))Kt(i)||t.push(`extension_policy_unknown_capability:${o.name}:${i}`);let n=new Set(cs);for(let o of W([...e.allowedSurfaces,...e.blockedSurfaces]))n.has(o)||t.push(`extension_policy_unknown_surface:${o}`);for(let o of r)for(let i of W([...o.allowedSurfaces,...o.blockedSurfaces]))n.has(i)||t.push(`extension_policy_unknown_surface:${o.name}:${i}`);return[...new Set(t)].sort((o,i)=>o.localeCompare(i))}function z_(e){let t=e.extensions?.policy??{},r=q(t.allowed_capabilities),n=q(t.blocked_capabilities),o=En(t.allowed_surfaces),i=En(t.blocked_surfaces),s=U_(t.extension_overrides);return{mode:F_(t.mode),trustMode:$_(t.trust_mode),pmMaxVersionExceededMode:j_(t.pm_max_version_exceeded_mode),requireProvenance:t.require_provenance===!0,trustedExtensions:q(t.trusted_extensions),defaultSandboxProfile:Do(t.default_sandbox_profile),allowedExtensions:q(t.allowed_extensions),blockedExtensions:q(t.blocked_extensions),allowedCapabilities:r,blockedCapabilities:n,allowedSurfaces:o,blockedSurfaces:i,allowedCommands:q(t.allowed_commands),blockedCommands:q(t.blocked_commands),allowedActions:q(t.allowed_actions),blockedActions:q(t.blocked_actions),allowedServices:q(t.allowed_services),blockedServices:q(t.blocked_services),overridesByName:s,warnings:RC({allowedCapabilities:r,blockedCapabilities:n,allowedSurfaces:o,blockedSurfaces:i,overridesByName:s})}}function q_(e){let t=[...e.overridesByName.values()].sort((r,n)=>r.name.localeCompare(n.name)).map(r=>({name:r.name,...r.disabled?{disabled:!0}:{},...r.requireTrusted?{require_trusted:!0}:{},...r.requireProvenance?{require_provenance:!0}:{},...r.sandboxProfile?{sandbox_profile:r.sandboxProfile}:{},...r.allowedCapabilities.size>0?{allowed_capabilities:W(r.allowedCapabilities)}:{},...r.blockedCapabilities.size>0?{blocked_capabilities:W(r.blockedCapabilities)}:{},...r.allowedSurfaces.size>0?{allowed_surfaces:W(r.allowedSurfaces)}:{},...r.blockedSurfaces.size>0?{blocked_surfaces:W(r.blockedSurfaces)}:{},...r.allowedCommands.size>0?{allowed_commands:W(r.allowedCommands)}:{},...r.blockedCommands.size>0?{blocked_commands:W(r.blockedCommands)}:{},...r.allowedActions.size>0?{allowed_actions:W(r.allowedActions)}:{},...r.blockedActions.size>0?{blocked_actions:W(r.blockedActions)}:{},...r.allowedServices.size>0?{allowed_services:W(r.allowedServices)}:{},...r.blockedServices.size>0?{blocked_services:W(r.blockedServices)}:{}}));return{mode:e.mode,trust_mode:e.trustMode,pm_max_version_exceeded_mode:CC(e.pmMaxVersionExceededMode),require_provenance:e.requireProvenance,trusted_extensions:W(e.trustedExtensions),default_sandbox_profile:e.defaultSandboxProfile,allowed_extensions:W(e.allowedExtensions),blocked_extensions:W(e.blockedExtensions),allowed_capabilities:W(e.allowedCapabilities),blocked_capabilities:W(e.blockedCapabilities),allowed_surfaces:W(e.allowedSurfaces),blocked_surfaces:W(e.blockedSurfaces),allowed_commands:W(e.allowedCommands),blocked_commands:W(e.blockedCommands),allowed_actions:W(e.allowedActions),blocked_actions:W(e.blockedActions),allowed_services:W(e.allowedServices),blocked_services:W(e.blockedServices),extension_overrides:t}}function H_(e){let t=U_(e.extension_overrides);return{mode:F_(e.mode),trustMode:$_(e.trust_mode),pmMaxVersionExceededMode:j_(e.pm_max_version_exceeded_mode),requireProvenance:e.require_provenance===!0,trustedExtensions:q(e.trusted_extensions),defaultSandboxProfile:Do(e.default_sandbox_profile),allowedExtensions:q(e.allowed_extensions),blockedExtensions:q(e.blocked_extensions),allowedCapabilities:q(e.allowed_capabilities),blockedCapabilities:q(e.blocked_capabilities),allowedSurfaces:En(e.allowed_surfaces),blockedSurfaces:En(e.blocked_surfaces),allowedCommands:q(e.allowed_commands),blockedCommands:q(e.blocked_commands),allowedActions:q(e.allowed_actions),blockedActions:q(e.blocked_actions),allowedServices:q(e.allowed_services),blockedServices:q(e.blocked_services),overridesByName:t,warnings:[]}}function Jt(e,t){return e.overridesByName.get(Je(t))??null}function Tn(e,t,r,n,o){return t.has(r)?o:e.size>0&&!e.has(r)?n:null}function G_(e,t,r){let n=r.trim().toLowerCase(),o=Jt(e,t.name),i=o&&o.allowedCapabilities.size>0?o.allowedCapabilities:e.allowedCapabilities,s=new Set([...e.blockedCapabilities,...o?o.blockedCapabilities:[]]);return Tn(i,s,n,"capability_not_allowlisted","capability_blocked")}function xC(e,t,r){let n=Jt(e,t.name),o=n&&n.allowedSurfaces.size>0?n.allowedSurfaces:e.allowedSurfaces,i=new Set([...e.blockedSurfaces,...n?n.blockedSurfaces:[]]);return Tn(o,i,r,"surface_not_allowlisted","surface_blocked")}function NC(e,t,r){let n=J(r);if(n.length===0)return null;let o=Jt(e,t.name),i=o&&o.allowedCommands.size>0?o.allowedCommands:e.allowedCommands,s=new Set([...e.blockedCommands,...o?o.blockedCommands:[]]);return Tn(i,s,n,"command_not_allowlisted","command_blocked")}function DC(e,t,r){let n=Je(r).replace(/\s+/g,"-");if(n.length===0)return null;let o=Jt(e,t.name),i=o&&o.allowedActions.size>0?o.allowedActions:e.allowedActions,s=new Set([...e.blockedActions,...o?o.blockedActions:[]]);return Tn(i,s,n,"action_not_allowlisted","action_blocked")}function PC(e,t,r){let n=Je(r);if(n.length===0)return null;let o=Jt(e,t.name),i=o&&o.allowedServices.size>0?o.allowedServices:e.allowedServices,s=new Set([...e.blockedServices,...o?o.blockedServices:[]]);return Tn(i,s,n,"service_not_allowlisted","service_blocked")}function MC(e,t){let r=Je(t.name);return Jt(e,t.name)?.disabled===!0?"extension_override_disabled":Tn(e.allowedExtensions,e.blockedExtensions,r,"extension_not_allowlisted","extension_blocked")}function LC(e,t){if(e.trustMode==="off")return null;let r=Jt(e,t.name),n=Je(t.name),o=t.trusted===!0,i=t.provenanceVerified===!0;return e.trustedExtensions.size>0&&!e.trustedExtensions.has(n)?"extension_not_trusted":(r?.requireTrusted===!0||e.trustMode==="warn"||e.trustMode==="enforce")&&!o?"extension_untrusted":(e.requireProvenance||r?.requireProvenance===!0)&&!i?"provenance_missing_or_unverified":null}function FC(e,t){if(e.mode==="off")return null;let n=Jt(e,t.name)?.sandboxProfile??t.sandboxProfile??e.defaultSandboxProfile;if(n==="none")return null;let o=t.permissions;if(!o)return"sandbox_permissions_missing";let i=s=>o[s]===!0;return n==="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 Is(e,t,r,n,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}:${r.layer}:${r.name}:reason=${n}${s}`}function B_(e,t){if(e.mode==="off"&&e.trustMode==="off")return{allowed:!0,warning:null};let r=[],n=MC(e,t);n&&r.push({reason:n,scope:"extension",mode:e.mode});let o=LC(e,t);o&&r.push({reason:o,scope:"trust",mode:e.trustMode});let i=FC(e,t);i&&r.push({reason:i,scope:"extension",mode:e.mode});let s=r.find(c=>c.mode==="enforce");if(s)return{allowed:!1,warning:Is("blocked",s.scope,t,s.reason)};let a=r.find(c=>c.mode==="warn");return a?{allowed:!0,warning:Is("violation",a.scope,t,a.reason)}:{allowed:!0,warning:null}}function V_(e,t,r){if(e.mode==="off")return{allowed:!0,warning:null};let n=G_(e,t,r);return n?{allowed:e.mode==="warn",warning:Is(e.mode==="warn"?"violation":"blocked","capability",t,n,{capability:r.trim().toLowerCase()})}:{allowed:!0,warning:null}}function $C(e,t,r,n,o){let i=typeof n=="string"?G_(e,t,n):null,s=xC(e,t,r),a=o.command?NC(e,t,o.command):null,c=o.action?DC(e,t,o.action):null,l=o.service?PC(e,t,o.service):null;return i??s??a??c??l}function jC(e,t,r,n){let o={method:Je(e).replace(/\s+/g,"_"),surface:t};return r&&(o.capability=r),n.command&&(o.command=J(n.command)),n.action&&(o.action=Je(n.action).replace(/\s+/g,"-")),n.service&&(o.service=Je(n.service)),o}function W_(e,t,r,n,o,i){if(e.mode==="off")return{allowed:!0,warning:null};let s=i??{},a=$C(e,t,r,o,s);if(!a)return{allowed:!0,warning:null};let c=Is(e.mode==="warn"?"violation":"blocked","registration",t,a,jC(n,r,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]="1c944ddd-e05b-5d8c-bdc5-7bc9677fa5d1")}catch{}})();var K_=100;function Y_(e,t){let r=e[t];if(r!=null)return typeof r!="string"||r.trim().length===0?null:r.trim()}function UC(e){if(e==null)return;let t=Wt(e);if(!t)return null;let r={};for(let n of Object.keys(t).sort((o,i)=>o.localeCompare(i))){if(n.trim().length===0)return null;let o=t[n];if(typeof o!="string"||o.trim().length===0)return null;r[n.trim()]=o.trim()}return Object.keys(r).length>0?r:void 0}function td(e,t){let r=e[t];return typeof r!="string"||r.trim().length===0?null:r.trim()}function X_(e){if(e!=null)return typeof e!="number"||!Number.isInteger(e)?null:e}function Cr(e){if(e!=null)return typeof e!="boolean"?null:e}function zC(e){let t=X_(e.priority);return t===void 0?K_:t}function qC(e){let t=e.sandbox_profile;if(t==null)return;if(typeof t!="string")return null;let r=Do(t);return r!==t.trim().toLowerCase()?null:r}function rd(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function HC(e){if(e==null)return;let t=Wt(e);if(!t)return null;let r=rd(t.source),n=rd(t.signature),o=rd(t.attestation),i=t.verified===void 0||t.verified===null?void 0:typeof t.verified=="boolean"?t.verified:null;return i===null?null:{...r?{source:r}:{},...n?{signature:n}:{},...o?{attestation:o}:{},...typeof i=="boolean"?{verified:i}:{}}}function GC(e){if(e==null)return;let t=Wt(e);if(!t)return null;let r=Cr(t.fs_read),n=Cr(t.fs_write),o=Cr(t.network),i=Cr(t.env_read),s=Cr(t.env_write),a=Cr(t.process_spawn);return[r,n,o,i,s,a].includes(null)?null:{...typeof r=="boolean"?{fs_read:r}:{},...typeof n=="boolean"?{fs_write:n}:{},...typeof o=="boolean"?{network:o}:{},...typeof i=="boolean"?{env_read:i}:{},...typeof s=="boolean"?{env_write:s}:{},...typeof a=="boolean"?{process_spawn:a}:{}}}function BC(e){if(e==null)return{capabilities:[],legacy_aliases:[]};if(!Array.isArray(e)||e.some(r=>typeof r!="string"))return null;let t=__(e);return{capabilities:t.capabilities,legacy_aliases:t.legacy_aliases}}function VC(e){if(e==null)return;let t=Wt(e);if(!t)return null;let r=t.commands;if(r==null)return;if(!Array.isArray(r)||r.some(o=>typeof o!="string"))return null;let n=[...new Set(r.map(o=>J(o)).filter(o=>o.length>0))].sort((o,i)=>o.localeCompare(i));return n.length>0?{commands:n}:void 0}function WC(e){let t=X_(e.manifest_version);if(t===null)return null;let r=Y_(e,"pm_min_version");if(r===null)return null;let n=Y_(e,"pm_max_version");if(n===null)return null;let o=UC(e.engines);if(o===null)return null;let i=Cr(e.trusted);if(i===null)return null;let s=qC(e);if(s===null)return null;let a=HC(e.provenance);if(a===null)return null;let c=GC(e.permissions);if(c===null)return null;let l=BC(e.capabilities);if(l===null)return null;let d=VC(e.activation);if(d===null)return null;let u=ks(e.contributions);return u===null?null:{manifest_version:t,pm_min_version:r,pm_max_version:n,engines:o,trusted:i,sandbox_profile:s,provenance:a,permissions:c,capabilities:l.capabilities,legacy_capability_aliases:l.legacy_aliases,activation:d,contributions:u}}function nd(e){if(typeof e!="object"||e===null)return null;let t=e,r=td(t,"name");if(r===null)return null;let n=td(t,"version");if(n===null)return null;let o=td(t,"entry");if(o===null)return null;let i=zC(t);if(i===null)return null;let s=WC(t);return s===null?null:{name:r,version:n,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 YC from"node:fs/promises";import Po 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 J_(e,t){let r=Po.dirname(t.manifest_path),n=Po.relative(r,t.entry_path);if(n.startsWith("..")||Po.isAbsolute(n))throw new Error(`Cannot snapshot extension entry outside its package directory: ${t.entry_path}`);let o=Po.join(e,`${t.layer}-${t.directory.replace(/[^a-zA-Z0-9._-]/gu,"_")}`);return await w_("extension_module_graph_snapshot",()=>YC.cp(r,o,{recursive:!0,force:!0})),Po.join(o,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]="092f2852-fa07-5f0f-8266-e9e2ca078cb6")}catch{}})();function Z_(e){let t=typeof e=="function"?e:e.run;if(typeof t!="function")throw new TypeError("registerPreflight override requires a function handler");let r=[...new Set((typeof e=="function"?[]:e.commands??[]).map(n=>{if(typeof n!="string"||n.trim().length===0)throw new TypeError("registerPreflight ownership.commands must contain non-empty command paths");return J(n)}))];return{run:t,...r.length>0?{commands:r}:{}}}function Q_(e){let t=[];for(let r=1;r<e.overrides.length;r+=1){let n=e.overrides[r];for(let o of e.overrides.slice(0,r))n.commands?.length&&o.commands?.length&&!o.commands.some(i=>n.commands.includes(i))||t.push(`extension_preflight_override_collision:${n.layer}:${n.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 od=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"}]),id=new Set(od.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 KC=/^--[a-z0-9][a-z0-9_-]*(?:[ =](?:<[^<>]+>|\[[^[\]]+\]))?$/;function XC(e){if(typeof e!="string")return null;let t=e.trim(),r=t.split(/[ =]/,1)[0];return id.has(r)?"host_owned_flag_collision":KC.test(t)?null:"malformed_long_flag"}function eg(e,t){let r=[e,t].find(i=>typeof i=="string"&&id.has(i.trim().split(/[ =]/,1)[0]));if(typeof r=="string")return{token:r.trim().split(/[ =]/,1)[0],failure:"host_owned_flag_collision"};if(typeof e!="string")return null;let n=e.trim(),o=XC(n);return o===null?null:{token:n,failure:o}}function tg(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]="99f785c2-7c67-5564-9423-3439c41b4557")}catch{}})();var Rs=wn;function xs(e){let t=e.trim().toLowerCase();return Rs.includes(t)?t:null}function rg(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let r=Math.max(1,Math.floor(t.length*.34));for(let n of Rs)if(ot(t,n,r)!==null)return n;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 ng(e){return e==="toon"||e==="json"}function og(e){return gn.includes(e)}function Ir(e,t){if(typeof t!="function")throw new TypeError(`api.hooks.${e} requires a function handler`)}var ig=Symbol("extension_registration_trace");function Rt(e,t){let r=new TypeError(e);return Object.defineProperty(r,ig,{value:t,enumerable:!1,configurable:!1,writable:!1}),r}function sg(e){return e instanceof Error?e[ig]:void 0}function Mo(e){if(e===null)return null;if(Array.isArray(e))return e.map(t=>Mo(t));if(typeof e=="function")return"[Function]";if(typeof e=="bigint"||typeof e=="symbol")return e.toString();if(typeof e=="object"){let t=e,r={};for(let n of Object.keys(t).sort((o,i)=>o.localeCompare(i)))r[n]=Mo(t[n]);return r}return e}function Lo(e){if(Array.isArray(e))return e.map(t=>Lo(t));if(typeof e=="object"&&e!==null){let t=e,r={};for(let n of Object.keys(t).sort((o,i)=>o.localeCompare(i)))r[n]=Lo(t[n]);return r}return e}function kn(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Mo(t)}function Fo(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Lo(t)}function $o(e,t){if(!Array.isArray(t))throw new TypeError(`${e} requires an array of object definitions`);return t.map(r=>kn(e,r))}function ke(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function jo(e,t){if(typeof t!="function")throw new TypeError(`${e} requires a function handler`)}function sd(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function ad(e,t){return J(`${e} ${t}`)}function Uo(e,t){return Object.defineProperty(e,"runtime_definition",{value:t,enumerable:!1,writable:!1,configurable:!1}),e}var JC=new Set(["low","medium","high"]),ZC=new Set(["number","string_set"]),QC=new Set(["string","number","boolean"]);function ag(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function eI(e,t,r){let n=`registerAssuranceMeasurementProvider provider.keys.${t}`,o=pe(n,r);if(!ZC.has(String(o.value_type)))throw new TypeError(`${n}.value_type must be number or string_set`);if(ie(`${n}.description`,o.description),o.parameters===void 0)return;let i=pe(`${n}.parameters`,o.parameters);for(let[s,a]of Object.entries(i)){let c=`${n}.parameters.${s}`;ag(`${c}.name`,s);let l=pe(c,a);if(!QC.has(String(l.type)))throw new TypeError(`${c}.type must be string, number, or boolean`);be(`${c}.required`,l.required),ie(`${c}.description`,l.description)}if(Object.keys(i).length>50)throw new TypeError(`assurance provider ${e} key ${t} exceeds 50 parameters`)}function cg(e){let t=pe("registerAssuranceMeasurementProvider provider",e),r=ag("registerAssuranceMeasurementProvider provider.id",t.id);if(!/^[a-z0-9][a-z0-9-]*$/u.test(r))throw new TypeError("registerAssuranceMeasurementProvider provider.id must be a stable lowercase id");if(!JC.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 n=pe("registerAssuranceMeasurementProvider provider.keys",t.keys);if(Object.keys(n).length===0)throw new TypeError("registerAssuranceMeasurementProvider provider.keys requires at least one key");for(let[o,i]of Object.entries(n)){if(!/^[a-z0-9][a-z0-9-]*$/u.test(o))throw new TypeError(`registerAssuranceMeasurementProvider provider key ${o} must be a stable lowercase id`);eI(r,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 tI=new Set(["default","description","enabled","list","long","repeatable","required","short","type","value_name","value_type","visible"]);function Ns(e,t){return $o(e,t).map(r=>(r.repeatable===!0&&(r.list=!0),r))}function rI(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function cd(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 r=rI(t);if(r.length===0)throw new TypeError("registerCommand definition.action must contain alphanumeric characters");return r}function ld(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[n,o]of e.entries()){let i=pe(`registerCommand definition.arguments[${n}]`,o),s=ke(`registerCommand definition.arguments[${n}].name`,i.name);if(be(`registerCommand definition.arguments[${n}].required`,i.required),be(`registerCommand definition.arguments[${n}].variadic`,i.variadic),ie(`registerCommand definition.arguments[${n}].description`,i.description),s.includes(" "))throw new TypeError(`registerCommand definition.arguments[${n}].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 r=t.map((n,o)=>n.variadic?o:-1).filter(n=>n>=0);if(r.length>1)throw new TypeError("registerCommand definition.arguments supports at most one variadic argument");if(r.length===1&&r[0]!==t.length-1)throw new TypeError("registerCommand definition.arguments variadic argument must be the final argument");return t}function Ds(e){if(!Array.isArray(e))throw new TypeError("registerFlags flags requires an array of object definitions");for(let[t,r]of e.entries()){let n=pe(`registerFlags flags[${t}]`,r),o=Object.keys(n).filter(c=>!tI.has(c)).sort((c,l)=>c.localeCompare(l));if(o.length>0)throw new TypeError(`registerFlags flags[${t}] contains unknown field(s): ${o.join(", ")}`);let i=n.long,s=n.short;if(i===void 0&&s===void 0)throw new TypeError(`registerFlags flags[${t}] requires at least one of long or short`);ie(`registerFlags flags[${t}].long`,i),ie(`registerFlags flags[${t}].short`,s);let a=eg(i,s);if(a!==null)throw new TypeError(`registerFlags flags[${t}] ${tg(a.token,a.failure)}`);if(ie(`registerFlags flags[${t}].value_name`,n.value_name),ie(`registerFlags flags[${t}].description`,n.description),be(`registerFlags flags[${t}].required`,n.required),be(`registerFlags flags[${t}].enabled`,n.enabled),be(`registerFlags flags[${t}].visible`,n.visible),be(`registerFlags flags[${t}].list`,n.list),be(`registerFlags flags[${t}].repeatable`,n.repeatable),n.list!==void 0&&n.repeatable!==void 0&&n.list!==n.repeatable)throw new TypeError(`registerFlags flags[${t}].list and repeatable must match when both are provided`);if(D_(`registerFlags flags[${t}].default`,n.default),Array.isArray(n.default)&&n.list!==!0&&n.repeatable!==!0)throw new TypeError(`registerFlags flags[${t}].default cannot be an array unless list is true.`);lg(`registerFlags flags[${t}]`,n)}}function lg(e,t){let r=(typeof t.value_type=="string"?t.value_type:void 0)??(typeof t.type=="string"?t.type:void 0);if(r===void 0)return;let n=$l(r);if(n===null)throw new TypeError(`${e} value_type "${r}" 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?jl(t.default):[t.default];for(let[i,s]of o.entries())if(!v_(s,n)){let a=o.length>1?`default[${i}]`:"default";throw new TypeError(`${e}.${a} (${JSON.stringify(s)}) is not coercible to ${n}.`)}}function dg(e){if(!Array.isArray(e))throw new TypeError("registerItemFields fields requires an array of object definitions");for(let[t,r]of e.entries()){let n=pe(`registerItemFields fields[${t}]`,r);ke(`registerItemFields fields[${t}].name`,n.name);let o=ke(`registerItemFields fields[${t}].type`,n.type);if(xs(o)===null){let i=rg(o),s=i?` Did you mean "${i}"?`:"";throw new TypeError(`registerItemFields fields[${t}].type "${o}" is not a known field type (expected one of: ${Rs.join(", ")}).${s}`)}be(`registerItemFields fields[${t}].optional`,n.optional)}}function nI(e,t){if(t===void 0)return;let r=`registerItemTypes types[${e}].command_option_policies`;if(!Array.isArray(t))throw new TypeError(`${r} must be an array when provided`);for(let[n,o]of t.entries()){let i=`${r}[${n}]`,s=pe(i,o);ke(`${i}.command`,s.command),ke(`${i}.option`,s.option),be(`${i}.enabled`,s.enabled),be(`${i}.required`,s.required),be(`${i}.visible`,s.visible)}}function oI(e,t){if(t===void 0)return;let r=`registerItemTypes types[${e}].options`;if(!Array.isArray(t))throw new TypeError(`${r} must be an array when provided`);for(let[n,o]of t.entries()){let i=`${r}[${n}]`,s=pe(i,o);ke(`${i}.key`,s.key),Or(`${i}.values`,s.values),be(`${i}.required`,s.required),Or(`${i}.aliases`,s.aliases)}}function ug(e){if(!Array.isArray(e))throw new TypeError("registerItemTypes types requires an array of object definitions");for(let[t,r]of e.entries()){let n=`registerItemTypes types[${t}]`,o=pe(n,r);ke(`${n}.name`,o.name),ie(`${n}.folder`,o.folder),Or(`${n}.aliases`,o.aliases),Or(`${n}.required_create_fields`,o.required_create_fields),Or(`${n}.required_create_repeatables`,o.required_create_repeatables),nI(t,o.command_option_policies),oI(t,o.options)}}function fg(e){let t=pe("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(be("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 pg=["types","statuses","fields","workflows","config","templates","packages"],iI={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[r,n]of t.allowed_transitions.entries())if(!Array.isArray(n))throw new TypeError(`${e}.allowed_transitions[${r}] 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 mg(e){let t=pe("registerProfile profile",e);if(ke("registerProfile profile.name",t.name),ke("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 r of pg){let n=t[r];if(n!==void 0){if(!Array.isArray(n))throw new TypeError(`registerProfile profile.${r} must be an array when provided`);for(let[o,i]of n.entries()){if(typeof i!="object"||i===null||Array.isArray(i))throw new TypeError(`registerProfile profile.${r}[${o}] must be an object`);iI[r]?.(`registerProfile profile.${r}[${o}]`,i)}}}}function _g(e){e.summary===void 0&&(e.summary="");for(let t of pg)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 gg(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 yg(e){return typeof e=="string"?e:String(e)}function zo(e){let r=e.trim().replace(/^>=\s*/,"").replace(/^v/i,"").split(/[+-]/,1)[0];return/^\d+(?:[.-]\d+)*$/.test(r)?r.split(/[.-]/).map(n=>Number(n)):null}function dd(e,t){let r=zo(e),n=zo(t);if(!r||!n)return null;let o=Math.max(r.length,n.length);for(let i=0;i<o;i+=1){let s=r[i]??0,a=n[i]??0;if(s>a)return 1;if(s<a)return-1}return 0}function hg(e,t){if(e==null)return{kind:"pm_min_version",status:"absent",allowed:!0,required:"",current:t};let r=yg(e);if(typeof e!="string"||r.trim().length===0)return{kind:"pm_min_version",status:"invalid",allowed:!1,required:r,current:t};if(!zo(r))return{kind:"pm_min_version",status:"invalid",allowed:!1,required:r,current:t};if(t===null)return{kind:"pm_min_version",status:"unchecked",allowed:!0,required:r,current:null};let n=dd(t,r);return n===null?{kind:"pm_min_version",status:"unchecked",allowed:!0,required:r,current:t}:n<0?{kind:"pm_min_version",status:"unmet",allowed:!1,required:r,current:t}:{kind:"pm_min_version",status:"ok",allowed:!0,required:r,current:t}}function bg(e,t,r){if(e==null)return{kind:"pm_max_version",status:"absent",allowed:!0,required:"",current:t};let n=yg(e);if(typeof e!="string"||n.trim().length===0)return{kind:"pm_max_version",status:"invalid",allowed:!1,required:n,current:t};if(/^[<>=~^]/.test(n.trim())||!zo(n))return{kind:"pm_max_version",status:"invalid",allowed:!1,required:n,current:t};if(t===null)return{kind:"pm_max_version",status:"unchecked",allowed:!0,required:n,current:null};let o=dd(t,n);return o===null?{kind:"pm_max_version",status:"unchecked",allowed:!0,required:n,current:t}:o>0?r==="warn"?{kind:"pm_max_version",status:"exceeded_warn",allowed:!0,required:n,current:t}:{kind:"pm_max_version",status:"exceeded",allowed:!1,required:n,current:t}:{kind:"pm_max_version",status:"ok",allowed:!0,required:n,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]="3ee03fc2-5b71-508c-8524-d22104fa2194")}catch{}})();var wg=null,aI=Object.freeze(ls()),vg=0;function cI(e=Date.now()){return vg+=1,`${vg}-${e}`}function lI(e,t,r){return r.has(e)?!1:t.size===0?!0:t.has(e)}async function dI(e,t){let[r,n]=await Promise.all([xr.realpath(e),xr.realpath(t)]);return Jl(r,n)}function Cg(e,t=process.cwd()){return{global:Rr.join(It(t),"extensions"),project:Rr.join(e,"extensions")}}async function uI(e){try{return(await xr.readdir(e,{withFileTypes:!0})).filter(r=>r.isDirectory()).map(r=>r.name).sort((r,n)=>r.localeCompare(n))}catch{return[]}}function fI(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 Eg(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}async function pI(e){let t=new Map;try{let r=JSON.parse(await xr.readFile(Rr.join(e,".managed-extensions.json"),"utf8")),o=Wt(r)?.entries;if(!Array.isArray(o))return t;for(let i of o){if(typeof i!="object"||i===null)continue;let s=i,a=Eg(s.source?.package),c=[s.source?.input,s.source?.name,a].map(u=>Eg(u)).filter(u=>u!==void 0),l=ks(s.contributions),d={aliases:[...new Set(c)],...a?{package_name:a}:{},...l?{contributions:l}:{}};typeof s.directory=="string"&&s.directory.trim().length>0&&t.set(`directory:${s.directory.trim()}`,d),typeof s.name=="string"&&s.name.trim().length>0&&t.set(`name:${s.name.trim()}`,d)}}catch{return t}return t}function Tg(e){return[...e].sort((t,r)=>{if(t.manifest.priority!==r.manifest.priority)return t.manifest.priority-r.manifest.priority;let n=t.manifest.name.localeCompare(r.manifest.name);return n!==0?n:t.directory.localeCompare(r.directory)})}function mI(e,t){let r=[...Tg(e),...Tg(t)],n=[];for(let o of r){let i=n.findIndex(s=>s.manifest.name===o.manifest.name);i>=0&&n.splice(i,1),n.push(o)}return n}async function kg(e,t,r,n,o){let i=[],s=[],a=[],c=await uI(t),l=await pI(t);for(let d of c){let u=await yI(e,t,d,r,n,l,o);i.push(u.diagnostic),s.push(...u.warnings),u.candidate&&a.push(u.candidate)}return{diagnostics:i,warnings:s,candidates:a}}function _I(){return{diagnostics:[],warnings:[],candidates:[]}}function Ag(e,t,r,n){return{diagnostic:{layer:e,directory:t,manifest_path:r,name:null,version:null,entry:null,priority:null,entry_path:null,enabled:null,status:"warn"},warnings:[n],candidate:null}}function gI(e,t,r,n,o,i,s){let a=h_(e,t,r);Array.isArray(t.legacy_capability_aliases)&&t.legacy_capability_aliases.length>0&&a.push(y_(e,t.name,t.legacy_capability_aliases));for(let c of m_(t.capabilities))a.push(g_(e,t.name,c));return n?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 yI(e,t,r,n,o,i,s){let a=Rr.join(t,r),c=Rr.join(a,"manifest.json");if(!await re(c))return Ag(e,r,c,`extension_manifest_missing:${e}:${r}`);let l,d;try{let P=JSON.parse(await xr.readFile(c,"utf8"));d=Wt(P),l=nd(P)}catch{d=null,l=null}if(!l||!d)return Ag(e,r,c,`extension_manifest_invalid:${e}:${r}`);let u=Rr.resolve(a,l.entry),f=Jl(a,u),p=f?await re(u):!1,m=f&&p?await dI(a,u):f,h=lI(l.name,n,o),b=await bI(e,l),w=await wI(e,l,s),E=gI(e,l,d,m,p,b,w),C=m&&p&&b.allowed&&w.allowed,V=i.get(`directory:${r}`)??i.get(`name:${l.name}`);return{diagnostic:{layer:e,directory:r,manifest_path:c,name:l.name,version:l.version,entry:l.entry,priority:l.priority,entry_path:u,enabled:h,status:C?"ok":"warn"},warnings:E,candidate:L_({layer:e,directory:r,manifestPath:c,entryPath:u,manifest:l,sourceIdentity:V,extensionReady:C,enabledForLoad:h})}}async function Ig(e){let t=Cg(e.pmRoot,e.cwd??process.cwd()),r=Io(e.settings.extensions.enabled),n=Io(e.settings.extensions.disabled),o=z_(e.settings),i=q_(o);if(e.noExtensions)return{disabled_by_flag:!0,roots:t,configured_enabled:r,configured_disabled:n,discovered:[],effective:[],warnings:[...o.warnings],policy:i};let s=new Set(r),a=new Set(n),c=e.ignoreGlobalExtensions===!0?_I():await kg("global",t.global,s,a,o.pmMaxVersionExceededMode.global),l=await kg("project",t.project,s,a,o.pmMaxVersionExceededMode.project),d=[...o.warnings],u=mI(c.candidates,l.candidates),f=[];for(let p of u){let m={layer:p.layer,name:p.manifest.name,trusted:p.manifest.trusted===!0,provenanceVerified:p.manifest.provenance?.verified===!0,sandboxProfile:p.manifest.sandbox_profile,permissions:p.manifest.permissions&&typeof p.manifest.permissions=="object"?{fs_read:p.manifest.permissions.fs_read,fs_write:p.manifest.permissions.fs_write,network:p.manifest.permissions.network,env_read:p.manifest.permissions.env_read,env_write:p.manifest.permissions.env_write,process_spawn:p.manifest.permissions.process_spawn}:void 0},h=B_(o,m);if(h.warning&&d.push(h.warning),!!h.allowed){for(let b of p.manifest.capabilities){let w=V_(o,m,b);w.warning&&d.push(w.warning)}f.push(fI(p))}}return{disabled_by_flag:!1,roots:t,configured_enabled:r,configured_disabled:n,discovered:[...c.diagnostics,...l.diagnostics],effective:f,warnings:[...new Set([...c.warnings,...l.warnings,...d])],policy:i}}function Ps(e){return e instanceof Error&&e.message.trim().length>0?e.message:String(e)}async function hI(){try{let e=Ct(import.meta.url,["../../.."]),t=await xr.readFile(Rr.join(e,"package.json"),"utf8"),r=JSON.parse(t);return typeof r.version=="string"&&r.version.trim().length>0?r.version.trim():null}catch{return null}}function Rg(){return wg??=hI(),wg}function xg(e,t,r){let n=r.current??"unknown";if(r.kind==="pm_min_version")switch(r.status){case"invalid":return`extension_pm_min_version_invalid:${e}:${t.name}:required=${r.required}`;case"unchecked":return`extension_pm_min_version_unchecked:${e}:${t.name}:required=${r.required}:current=${n}`;case"unmet":return`extension_pm_min_version_unmet:${e}:${t.name}:required=${r.required}:current=${n}`;default:return}switch(r.status){case"invalid":return`extension_pm_max_version_invalid:${e}:${t.name}:allowed=${r.required}`;case"unchecked":return`extension_pm_max_version_unchecked:${e}:${t.name}:allowed=${r.required}:current=${n}`;case"exceeded_warn":return`extension_pm_max_version_exceeded_warn:${e}:${t.name}:allowed=${r.required}:current=${n}`;case"exceeded":return`extension_pm_max_version_exceeded:${e}:${t.name}:allowed=${r.required}:current=${n}`;default:return}}async function bI(e,t){if(t.pm_min_version===void 0)return{allowed:!0};let r=hg(t.pm_min_version,await Rg()),n=xg(e,t,r);return n?{allowed:r.allowed,warning:n}:{allowed:r.allowed}}async function wI(e,t,r){if(t.pm_max_version===void 0)return{allowed:!0};let n=bg(t.pm_max_version,await Rg(),r),o=xg(e,t,n);return o?{allowed:n.allowed,warning:o}:{allowed:n.allowed}}async function Sg(e){try{let t=await xr.stat(e);return`${Math.trunc(t.mtimeMs)}-${t.size}`}catch{return"missing"}}async function vI(e,t){let r=e.entry_path;t.module_graph_snapshot_root&&(r=await J_(t.module_graph_snapshot_root,e));let n=new URL(sI(r).href);if(!(t.cache_bust===!0||typeof t.reload_token=="string"))return n.href;let[i,s]=await Promise.all([Sg(e.entry_path),Sg(e.manifest_path)]),a=t.reload_token??cI();return n.searchParams.set("pm_ext_reload",a),n.searchParams.set("pm_ext_entry",i),n.searchParams.set("pm_ext_manifest",s),n.href}async function EI(e){let t=await Ig(e),r=[],n=[],o=[...t.warnings];if(t.disabled_by_flag)return{...t,warnings:o,loaded:r,failed:n};let i=typeof e.extensionFilter=="function"?t.effective.filter(e.extensionFilter):t.effective;for(let s of i)try{let c=await import(await vI(s,e));r.push({...s,module:c})}catch(a){o.push(`extension_load_failed:${s.layer}:${s.name}`),n.push({layer:s.layer,name:s.name,entry_path:s.entry_path,error:Ps(a)})}return{...t,warnings:o,loaded:r,failed:n}}var Og=5e3,TI=2147483647;function kI(e){let r={activate:e.activate.bind(e)};if(typeof e.deactivate=="function"){let n=e.deactivate;r.deactivate=n.bind(e)}return r}function Ng(e){let t=Vm(e);return t?kI(t):null}async function wW(e,t,r={}){let n=AI(r?.deactivate_timeout_ms),o=new Set((t?.failed??[]).map(d=>`${d.layer}:${d.name}`)),i=[];for(let d of e.loaded){if(o.has(`${d.layer}:${d.name}`))continue;let u=Ng(d.module);!u||typeof u.deactivate!="function"||i.push({extension:d,deactivate:u.deactivate})}let s=await Promise.all(i.map(async({extension:d,deactivate:u})=>{try{return await SI(u,n),{ok:!0}}catch(f){return{ok:!1,layer:d.layer,name:d.name,error:Ps(f)}}})),a=[],c=[],l=0;for(let d of s){if(d.ok){l+=1;continue}a.push(`extension_deactivate_failed:${d.layer}:${d.name}`),c.push({layer:d.layer,name:d.name,error:d.error})}return{deactivated:l,warnings:a,failed:c}}function AI(e){return typeof e!="number"||e<0?Og:e===0||e===1/0?0:Number.isFinite(e)?Math.min(TI,Math.max(1,Math.floor(e))):Og}async function SI(e,t){if(t===0){await e();return}let r;try{let n=Promise.resolve().then(()=>e());n.catch(()=>{}),await Promise.race([n,new Promise((o,i)=>{r=setTimeout(()=>{i(new Error(`extension deactivate timed out after ${t}ms`))},t),r.unref?.()})])}finally{clearTimeout(r)}}function OI(e){if(!Array.isArray(e.capabilities))return null;let t=new Set;for(let r of e.capabilities){let n=r.trim().toLowerCase();Kt(n)&&t.add(n)}return t}function Z(e,t,r){let n=OI(e);if(n!==null&&!n.has(t))throw Rt(`${r} requires capability '${t}' in extension manifest capabilities`,{method:r,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 ${r} registration call.`})}function CI(e){return Object.freeze({name:e.name,layer:e.layer,version:e.version,capabilities:Object.freeze((e.capabilities??[]).filter(t=>mt.includes(t))),pm_min_version:e.pm_min_version,pm_max_version:e.pm_max_version,source_package:e.source_package})}function II(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 ud=class{extension;hooks;#e;#r;#o;#n;#s;#a;#i;#c;#t;#l;#d;#u;constructor(t,r,n,o,i,s,a,c,l,d,u){this.#e=t,this.extension=CI(t),this.#r=II(t),this.#o=r,this.#n=n,this.#s=o,this.#a=i,this.#i=s,this.#c=a,this.#t=c,this.#l=l,this.#d=d,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,r,n,o){let i=W_(this.#u,this.#r,t,r,n,o);return i.warning&&this.#l.push(i.warning),i.allowed}registerCommandTrace(t,r,n,o,i){return{method:"registerCommand",registration_index:t==="override"?this.#n.overrides.length:this.#n.handlers.length,command:r,expected_schema:n,received:Mo(o),hint:i}}registerCommandOverride(t,r){let n=J(t);if(n.length===0)throw Rt("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 r!="function"){let o=this.registerCommandTrace("override",n,'registerCommand("<command>", (context) => unknown)',r,"Provide a function as the second registerCommand argument.");throw Rt(`registerCommand requires an override function when command name is provided (command="${n}", registration_index=${o.registration_index})`,o)}this.allowRegistration("commands.override","registerCommand","commands",{command:n})&&this.#n.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:r})}resolveCommandDefinitionRunHandler(t,r){let n=typeof t.run=="function"?t.run:void 0,o=typeof t.handler=="function"?t.handler:void 0;return!n&&o&&this.#l.push(`extension_command_definition_legacy_handler_alias:${this.#e.layer}:${this.#e.name}:${r}`),n??o}registerCommandDefinition(t){if(typeof t!="object"||t===null)throw Rt("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 Rt("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 r=J(t.name);if(r.length===0)throw Rt("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 n=this.resolveCommandDefinitionRunHandler(t,r);if(typeof n!="function"){let o=this.registerCommandTrace("definition",r,"{ name: string; run: (context) => unknown; }",n,"Define command definition.run as a function.");throw Rt(`registerCommand requires a command definition run handler (command="${r}", registration_index=${o.registration_index})`,o)}try{P_(t);let o=cd(r,t.action);if(!this.allowRegistration("commands.handler","registerCommand","commands",{command:r,action:o}))return;let i=t.description?.trim(),s=t.intent?.trim(),a=No("registerCommand definition.examples",t.examples),c=No("registerCommand definition.failure_hints",t.failure_hints),l=ld(t.arguments);t.flags!==void 0&&(Z(this.#e,"schema","registerCommand flags"),this.allowRegistration("schema.flags","registerCommand flags","schema")&&(Ds(t.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:r,flags:Ns("registerCommand definition.flags",t.flags)})));let d={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:r,action:o,examples:a,failure_hints:c,arguments:l,tier:t.tier??"standard",family:t.family??"extensions"};i&&(d.description=i),s&&(d.intent=s),this.#t.commands.push(d)}catch(o){let i=Ps(o),s=this.registerCommandTrace("definition",r,"{ name: string; run: (context) => unknown; action?: string; arguments?: object[]; flags?: object[]; }",t,i),a=Rt(`registerCommand definition metadata invalid (command="${r}", registration_index=${s.registration_index}): ${i}`,s);this.#l.push(`extension_command_quarantined:${this.#e.layer}:${this.#e.name}:${r}`),this.#d.push({layer:this.#e.layer,name:this.#e.name,entry_path:this.#e.entry_path,error:a.message,trace:s});return}this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:r,run:n})}registerCommand(t,r){if(Z(this.#e,"commands","registerCommand"),typeof t=="string"){this.registerCommandOverride(t,r);return}this.registerCommandDefinition(t)}registerParser(t,r){if(Z(this.#e,"parser","registerParser"),!this.allowRegistration("parser.override","registerParser","parser"))return;let n=J(ke("registerParser command",t));jo("registerParser override",r),this.#s.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:r})}registerPreflight(t){if(Z(this.#e,"preflight","registerPreflight"),!this.allowRegistration("preflight.override","registerPreflight","preflight"))return;let r=Z_(t);this.#a.overrides.push({layer:this.#e.layer,name:this.#e.name,...r})}registerService(t,r,n={}){Z(this.#e,"services","registerService");let o=String(t).trim().toLowerCase();if(!og(o))throw new TypeError(`registerService service must be one of: ${gn.join(", ")}`);this.allowRegistration("services.override","registerService","services",{service:o})&&(jo("registerService override",r),this.#i.overrides.push({layer:this.#e.layer,name:this.#e.name,service:o,run:r,...gg(n)?{passThrough:!0}:{}}))}registerRenderer(t,r,n={}){if(Z(this.#e,"renderers","registerRenderer"),!this.allowRegistration("renderers.override","registerRenderer","renderers"))return;if(typeof r!="function")throw new TypeError("registerRenderer requires a renderer function");let o=String(t).trim().toLowerCase();if(!ng(o))throw new Error(`registerRenderer format must be toon|json, received: ${String(t)}`);if(n.resultDiscriminator!==void 0&&typeof n.resultDiscriminator!="function")throw new TypeError("registerRenderer ownership.resultDiscriminator must be a function when provided");let i=[...new Set((n.commands??[]).map(s=>{if(typeof s!="string"||s.trim().length===0)throw new TypeError("registerRenderer ownership.commands must contain non-empty command paths");return J(s)}))];this.#c.overrides.push({layer:this.#e.layer,name:this.#e.name,format:o,run:r,commands:i,...n.resultDiscriminator?{resultDiscriminator:n.resultDiscriminator}:{}})}registerFlags(t,r){if(Z(this.#e,"schema","registerFlags"),!this.allowRegistration("schema.flags","registerFlags","schema"))return;let n=J(ke("registerFlags targetCommand",t));Ds(r);let o=Ns("registerFlags flags",r);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:n,flags:o})}registerItemFields(t){if(Z(this.#e,"schema","registerItemFields"),!this.allowRegistration("schema.itemfields","registerItemFields","schema"))return;dg(t);let r=$o("registerItemFields fields",t);if(r.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:r})}registerItemTypes(t){if(Z(this.#e,"schema","registerItemTypes"),!this.allowRegistration("schema.itemtypes","registerItemTypes","schema"))return;ug(t);let r=$o("registerItemTypes types",t);if(r.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:r})}registerRelationshipKinds(t){if(Z(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 r=yl();for(let o of this.#t.relationship_kinds)for(let i of o.definitions)r.register(i);let n=t.map(o=>(r.register(o),r.require(o.kind)));this.#t.relationship_kinds.push({layer:this.#e.layer,name:this.#e.name,definitions:n})}registerMigration(t){if(Z(this.#e,"schema","registerMigration"),!this.allowRegistration("schema.migrations","registerMigration","schema"))return;fg(t);let r=Fo("registerMigration definition",t);this.#t.migrations.push(Uo({layer:this.#e.layer,name:this.#e.name,definition:kn("registerMigration definition",t)},r))}registerProfile(t){if(Z(this.#e,"schema","registerProfile"),!this.allowRegistration("schema.profiles","registerProfile","schema"))return;let r=Lo(t);mg(r),this.#t.profiles.push({layer:this.#e.layer,name:this.#e.name,profile:_g(r)})}registerImportExportCommandFlags(t,r,n){n.flags!==void 0&&(Z(this.#e,"schema",`${t} options.flags`),this.allowRegistration("schema.flags",`${t} options.flags`,"schema")&&(Ds(n.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:r,flags:Ns(`${t} options.flags`,n.flags)})))}applyImportExportCommandMetadata(t,r,n){if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))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={...n,description:n?.description??o,arguments:n?.arguments??i},a=M_(t,s,n?.description!==void 0);ie(`${t} options.action`,s.action),ie(`${t} options.description`,s.description),ie(`${t} options.intent`,s.intent);let c=cd(r,s.action),l=No(`${t} options.examples`,s.examples),d=No(`${t} options.failure_hints`,s.failure_hints),u=ld(s.arguments);this.registerImportExportCommandFlags(t,r,s);let f={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:r,action:c,examples:l,failure_hints:d,arguments:u},p=s.description?.trim();p&&(f.description=p);let m=s.intent?.trim();return m&&(f.intent=m),this.#t.commands.push(f),a}registerImporter(t,r,n){if(Z(this.#e,"importers","registerImporter"),!this.allowRegistration("importers.importer","registerImporter","importers"))return;let o=sd(ke("registerImporter name",t));jo("registerImporter importer",r);let i=ad(o,"import");this.applyImportExportCommandMetadata("registerImporter",i,n),this.#t.importers.push({layer:this.#e.layer,name:this.#e.name,importer:o}),this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:i,run:async s=>r(Ql(s,o,"import"))})}registerExporter(t,r,n){if(Z(this.#e,"importers","registerExporter"),!this.allowRegistration("importers.exporter","registerExporter","importers"))return;let o=sd(ke("registerExporter name",t));jo("registerExporter exporter",r);let i=ad(o,"export"),s=this.applyImportExportCommandMetadata("registerExporter",i,n);this.#t.exporters.push({layer:this.#e.layer,name:this.#e.name,exporter:o,...s===void 0?{}:{output:s}}),this.#n.handlers.push({layer:this.#e.layer,name:this.#e.name,command:i,run:async a=>{let c=await r(Ql(a,o,"export"));return s?.receipt==="suppress"&&!rs(c)?Hm(c):c}})}registerSearchProvider(t){if(Z(this.#e,"search","registerSearchProvider"),!this.allowRegistration("search.provider","registerSearchProvider","search"))return;let r=Fo("registerSearchProvider provider",t);this.#t.search_providers.push(Uo({layer:this.#e.layer,name:this.#e.name,definition:kn("registerSearchProvider provider",t)},r))}registerVectorStoreAdapter(t){if(Z(this.#e,"search","registerVectorStoreAdapter"),!this.allowRegistration("search.vectorstore","registerVectorStoreAdapter","search"))return;let r=Fo("registerVectorStoreAdapter adapter",t);this.#t.vector_store_adapters.push(Uo({layer:this.#e.layer,name:this.#e.name,definition:kn("registerVectorStoreAdapter adapter",t)},r))}registerAssuranceMeasurementProvider(t){if(Z(this.#e,"services","registerAssuranceMeasurementProvider"),!this.allowRegistration("services.assuranceprovider","registerAssuranceMeasurementProvider","services"))return;if(cg(t),t.network&&this.#e.permissions?.network!==!0)throw new TypeError("registerAssuranceMeasurementProvider network provider requires permissions.network=true");let r=Fo("registerAssuranceMeasurementProvider provider",t);this.#t.assurance_providers.push(Uo({layer:this.#e.layer,name:this.#e.name,network_permission:this.#e.permissions?.network===!0,definition:kn("registerAssuranceMeasurementProvider provider",t)},r))}registerBeforeCommand(t){Z(this.#e,"hooks","api.hooks.beforeCommand"),this.allowRegistration("hooks.beforecommand","api.hooks.beforeCommand","hooks")&&(Ir("beforeCommand",t),this.#o.beforeCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerBeforeMutation(t){Z(this.#e,"hooks","api.hooks.beforeMutation"),this.allowRegistration("hooks.beforemutation","api.hooks.beforeMutation","hooks")&&(Ir("beforeMutation",t),this.#o.beforeMutation.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerAfterCommand(t){Z(this.#e,"hooks","api.hooks.afterCommand"),this.allowRegistration("hooks.aftercommand","api.hooks.afterCommand","hooks")&&(Ir("afterCommand",t),this.#o.afterCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnWrite(t){Z(this.#e,"hooks","api.hooks.onWrite"),this.allowRegistration("hooks.onwrite","api.hooks.onWrite","hooks")&&(Ir("onWrite",t),this.#o.onWrite.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnRead(t){Z(this.#e,"hooks","api.hooks.onRead"),this.allowRegistration("hooks.onread","api.hooks.onRead","hooks")&&(Ir("onRead",t),this.#o.onRead.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnIndex(t){Z(this.#e,"hooks","api.hooks.onIndex"),this.allowRegistration("hooks.onindex","api.hooks.onIndex","hooks")&&(Ir("onIndex",t),this.#o.onIndex.push({layer:this.#e.layer,name:this.#e.name,run:t}))}};function RI(e,t,r,n,o,i,s,a,c,l,d){return new ud(e,t,r,n,o,i,s,a,c,l,d)}function xI(e){let t=e.commands.length,r=e.flags.reduce((s,a)=>s+a.flags.length,0),n=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:r,item_fields:n,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 NI(e){let t=[],r=(i,s)=>{let a=new Map;for(let c of i){let l=a.get(c.command)??[];l.push(c),a.set(c.command,l)}for(let c of[...a.keys()].sort((l,d)=>l.localeCompare(d))){let l=a.get(c);if(l.length<=1)continue;let d=l[l.length-1];for(let u of l.slice(0,-1))t.push(`${s}:${c}:${d.layer}:${d.name}:${u.layer}:${u.name}`)}};r(e.handlers,"extension_command_handler_collision"),r(e.overrides,"extension_command_override_collision");let n=new Set(e.handlers.map(i=>i.command)),o=[...new Set(e.overrides.map(i=>i.command))].filter(i=>n.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 l of s)t.push(`extension_command_override_handler_overlap:${i}:${c.layer}:${c.name}:${l.layer}:${l.name}`)}return t}function DI(e){let t=new Map;for(let n of e.overrides){let o=t.get(n.format)??[];o.push(n),t.set(n.format,o)}let r=[];for(let n of[...t.keys()].sort((o,i)=>o.localeCompare(i))){let o=t.get(n);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))||r.push(`extension_renderer_collision:${n}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return r}function PI(e){let t=[],r=new Map;for(let n of e.overrides){let o=r.get(n.command)??[];o.push(n),r.set(n.command,o)}for(let n of[...r.keys()].sort((o,i)=>o.localeCompare(i))){let o=r.get(n);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:${n}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return t}var MI=new Set(["output_format"]);function LI(e){let t=[],r=new Map;for(let n of e.overrides){let o=r.get(n.service)??[];o.push(n),r.set(n.service,o)}for(let n of[...r.keys()].sort((o,i)=>o.localeCompare(i))){let o=r.get(n);if(o.length<=1||MI.has(n))continue;let i=o[o.length-1];for(let s of o.slice(0,-1))t.push(`extension_service_override_collision:${n}:${i.layer}:${i.name}:${s.layer}:${s.name}`)}return t}async function FI(e){let t=H_(e.policy??aI),r=Ro(),n=Dl(),o=Pl(),i=Ml(),s=Ll(),a=Fl(),c=As(),l=[],d=[];for(let p of e.loaded){let m=Ng(p.module);if(!m)continue;let h=l.length,b=N_({hooks:r,commands:n,parsers:o,preflight:i,services:s,renderers:a,registrations:c});try{await m.activate(RI(p,r,n,o,i,s,a,c,d,l,t)),l.length>h&&(b(),d.push(`extension_activation_rolled_back:${p.layer}:${p.name}`))}catch(w){b(),d.push(`extension_activate_failed:${p.layer}:${p.name}`);let E=sg(w);l.push({layer:p.layer,name:p.name,entry_path:p.entry_path,error:Ps(w),trace:E})}}let u=[...NI(n),...PI(o),...Q_(i),...LI(s),...DI(a)],f=[...new Set([...d,...u])];return{hooks:r,commands:n,parsers:o,preflight:i,services:s,renderers:a,registrations:c,failed:l,warnings:f,hook_counts:{before_command:r.beforeCommand.length,before_mutation:r.beforeMutation.length,after_command:r.afterCommand.length,on_write:r.onWrite.length,on_read:r.onRead.length,on_index:r.onIndex.length},command_override_count:n.overrides.length,command_handler_count:n.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:xI(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 $I(e){return{...e,hooks:Ro(),profileEnabled:!!e.globalOptions.profile,migrationBlockers:[]}}(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 AW(){let e=Promise.resolve(),t=new Set;return{async read(r){let n=e,o,i=new Promise(s=>{o=s});t.add(i),await n;try{return await r()}finally{t.delete(i),o()}},write(r){let o=Promise.all([e,...t]).then(()=>r());return e=o.then(()=>{},()=>{}),o}}}function Dg(){let e=Promise.resolve(),t=0,r=[],n=()=>{if(t!==0)return;let o=r.splice(0);for(let i of o)i()};return{enqueue(o){t++;let i=e.then(()=>o());return e=i.then(()=>{},()=>{}).finally(()=>{t--,n()}),i},idle(){return t===0?Promise.resolve():new Promise(o=>r.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]="71c44385-0182-50f8-8e05-3aeebfe57ad9")}catch{}})();var jI={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"]},Pg=":";function Mg(e,t){return`${e}${Pg}${fd(t)}`}function UI(e){return e.slice(e.indexOf(Pg)+1)}function fd(e){return e.trim().toLowerCase()}function zI(e){if(!Array.isArray(e))return[];let t=new Set;for(let r of e){let n=p_(r);n!==null&&t.add(n)}return[...t].sort((r,n)=>r.localeCompare(n))}function Lg(e){let t=new Map,r=(d,u)=>{for(let f of d){let p=Mg(f.layer,f.name),m=t.get(p);m===void 0&&(m=new Set,t.set(p,m)),m.add(u)}},{registrations:n,commands:o,parsers:i,preflight:s,services:a,renderers:c,hooks:l}=e;return r(n.commands,"commands"),r(o.overrides,"commands"),r(o.handlers,"commands"),r(n.flags,"schema"),r(n.item_fields,"schema"),r(n.item_types,"schema"),r(n.relationship_kinds??[],"schema"),r(n.migrations,"schema"),r(n.profiles,"schema"),r(n.importers,"importers"),r(n.exporters,"importers"),r(n.search_providers,"search"),r(n.vector_store_adapters,"search"),r(i.overrides,"parser"),r(s.overrides,"preflight"),r(a.overrides,"services"),r(n.assurance_providers??[],"services"),r(c.overrides,"renderers"),r(l.beforeCommand,"hooks"),r(l.beforeMutation,"hooks"),r(l.afterCommand,"hooks"),r(l.onWrite,"hooks"),r(l.onRead,"hooks"),r(l.onIndex,"hooks"),t}function qI(e,t={}){let r=Lg(e),n=new Set;t.extensionName!==void 0&&n.add(fd(t.extensionName));for(let i of t.extensionNames??[])n.add(fd(i));let o=new Set;for(let[i,s]of r)if(!(n.size>0&&!n.has(UI(i))))for(let a of s)o.add(a);return[...o].sort((i,s)=>i.localeCompare(s))}function HI(e,t){let r=Lg(t),n=[];for(let o of e){let i=zI(o.capabilities);if(i.length===0)continue;let s=r.get(Mg(o.layer,o.name))??new Set,a=[...s].sort((l,d)=>l.localeCompare(d)),c=i.filter(l=>!s.has(l));n.push({layer:o.layer,name:o.name,declared:i,used:a,unused:c})}return n}import{existsSync as GI}from"node:fs";import{AsyncLocalStorage as BI}from"node:async_hooks";import xt 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]="40b169fc-3c5f-5b2a-8fed-a9388b07d9f7")}catch{}})();var Nt=null,An=null,qo=null,Ho=null,Sn=null,Go=null,Bo=null,Zt=null,Ls,Ms=[],$g=new BI;function H(){return $g.getStore()}function jg(e){return $g.run({hooks:null,commands:null,parsers:null,preflight:null,services:null,renderers:null,registrations:null,commandContext:null,commandResult:void 0,affectedItems:[]},e)}var VI=new Set(["body","comments","dependencies","docs","events","files","learnings","notes","reminders","test_runs","tests"]);function Fg(e){let t=xt.resolve(e);for(;;){if(GI(xt.join(t,".git")))return t;let r=xt.dirname(t);if(r===t)return;t=r}}function Fs(e){let t=process.env.PM_SOURCE_WORKSPACE_ROOT?.trim()||process.cwd(),r=Fg(t)??xt.resolve(t),n=Fg(r);if(!e)return{source_workspace_root:r,...n?{repo_root:n}:{}};let o=xt.relative(r,xt.resolve(e)),i=o.length>0&&!o.startsWith(`..${xt.sep}`)&&o!==".."&&!xt.isAbsolute(o);return{source_workspace_root:r,...n?{repo_root:n}:{},...i?{pm_root_rel:o.split(xt.sep).join("/")}:{}}}function WI(e){let t=H();if(t){t.hooks=e;return}Nt=e}function YI(e){let t=H();if(t){t.commands=e;return}An=e}function KI(e){let t=H();if(t){t.parsers=e;return}qo=e}function XI(e){let t=H();if(t){t.preflight=e;return}Ho=e}function JI(e){let t=H();if(t){t.services=e;return}Sn=e}function ZI(e){let t=H();if(t){t.renderers=e;return}Go=e}function QI(e){let t=H();if(t){t.registrations=e;return}Bo=e}function Qt(){let e=H();return e?e.registrations:Bo}function e0(){let e=H();if(e){e.hooks=null,e.commands=null,e.parsers=null,e.preflight=null,e.services=null,e.renderers=null,e.registrations=null,e.commandContext=null,e.commandResult=null,e.affectedItems=[];return}Nt=null,An=null,qo=null,Ho=null,Sn=null,Go=null,Bo=null,Zt=null,Ls=null}function t0(e){let t=e?{...e,...Fs(e.pm_root)}:null,r=H();if(r){r.commandContext=t;return}Zt=t}function Ug(){let e=H(),t=e?e.commandContext:Zt;return t?{...t,args:[...t.args],options:t.options?{...t.options}:{},global:t.global?{...t.global}:void 0}:null}function zg(e){let t=H()??{commandContext:Zt,hooks:Nt,commands:An,parsers:qo,preflight:Ho,services:Sn,renderers:Go,registrations:Bo};return t.commandContext?.command!==e||[t.hooks,t.preflight,t.services,t.renderers].some(o=>Object.values(o??{}).some(i=>i.length>0))||[t.commands,t.parsers].some(o=>Object.values(o??{}).some(i=>i.some(s=>s.command===e)))?!1:!Object.entries(t.registrations??{}).some(([o,i])=>["migrations","search_providers","vector_store_adapters","assurance_providers"].includes(o)&&i.length>0)}function er(e){let t=H();if(t){t.commandResult=e;return}Ls=e}function r0(){let e=H();return e?e.commandResult:Ls}function $s(e){if(!e)return;let t=H();t?t.affectedItems.push(e):Ms.push(e)}function Vo(e,t){if(!e||!e.id)return{};let r={id:e.id,type:e.type,status:e.status};if(!Array.isArray(t))return r;let n=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"||VI.has(i)||Object.hasOwn(n,i)&&n[i]!==void 0&&(r[i]=n[i])}return r}function n0(){let e=H(),t=e?.affectedItems??Ms;if(t.length===0)return;let r=t;return e?e.affectedItems=[]:Ms=[],r}function o0(){let e=H();if(e){e.hooks=null,e.commands=null,e.parsers=null,e.preflight=null,e.services=null,e.renderers=null,e.registrations=null,e.commandContext=null,e.commandResult=void 0,e.affectedItems=[];return}Nt=null,An=null,qo=null,Ho=null,Sn=null,Go=null,Bo=null,Zt=null,Ls=void 0,Ms=[]}async function Ae(e){let t=H(),r=t?t.hooks:Nt;return r?zl(r,e):[]}async function js(e){let t=H(),r=t?t.hooks:Nt;r&&await Ul(r,e)}async function it(e){let t=H(),r=t?t.hooks:Nt;return r?ql(r,e):[]}function pd(){let e=H();return((e?e.hooks:Nt)?.onRead?.length??0)>0}async function i0(e){let t=H(),r=t?t.hooks:Nt;return r?Hl(r,e):[]}function qg(e){let t=H(),r=t?t.commands:An,n=t?t.commandContext:Zt;return!r||!n?{overridden:!1,result:e,warnings:[]}:Kl(r,{command:n.command,args:[...n.args],options:n.options?{...n.options}:{},global:n.global?{...n.global}:void 0,pm_root:n.pm_root,source_workspace_root:n.source_workspace_root,repo_root:n.repo_root,pm_root_rel:n.pm_root_rel,result:e})}async function s0(e){let t=H(),r=t?t.commands:An;return r?Gl(r,{...e,...Fs(e.pm_root)}):{handled:!1,result:null,warnings:[]}}async function a0(e){let t=H(),r=t?t.parsers:qo;return r?Bl(r,{...e,...Fs(e.pm_root)}):{overridden:!1,context:{command:e.command,args:[...e.args],options:{...e.options},global:{...e.global},pm_root:e.pm_root},warnings:[]}}async function c0(e){let t=H(),r=t?t.preflight:Ho;return r?Vl(r,{...e,...Fs(e.pm_root)}):{overridden:!1,context:{command:e.command,args:[...e.args],options:{...e.options},global:{...e.global},pm_root:e.pm_root},decision:{...e.decision},warnings:[]}}function Hg(e,t){let r=H(),n=r?r.renderers:Go,o=r?r.commandContext:Zt;return n?Xl(n,{format:e,command:o?.command,args:o?[...o.args]:[],options:o?.options?{...o.options}:{},global:o?.global?{...o.global}:void 0,pm_root:o?.pm_root,source_workspace_root:o?.source_workspace_root,repo_root:o?.repo_root,pm_root_rel:o?.pm_root_rel,result:t}):{overridden:!1,rendered:null,warnings:[]}}function Gg(e,t){let r=H(),n=r?r.commandContext:Zt;return{service:e,command:n?.command,args:n?[...n.args]:[],options:n?.options?{...n.options}:{},global:n?.global?{...n.global}:void 0,pm_root:n?.pm_root,source_workspace_root:n?.source_workspace_root,repo_root:n?.repo_root,pm_root_rel:n?.pm_root_rel,payload:t}}async function Ze(e,t){let r=H(),n=r?r.services:Sn;return n?Yl(n,Gg(e,t)):{handled:!1,result:t,warnings:[]}}function md(e,t){let r=H(),n=r?r.services:Sn;return n?Wl(n,Gg(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]="4f014bd9-39b6-5017-93ed-f0e7fba8497a")}catch{}})();var Bg=e=>{let t='"',r=0;for(let n of e){if(n==="\\"){r+=1;continue}t+="\\".repeat(n==='"'?r*2+1:r),t+=n,r=0}return`${t}${"\\".repeat(r*2)}"`},Vg=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?Bg(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,Dt=(e,t=process.platform)=>{let r=e.map(n=>Vg(n,t)).join(" ");return r.length>0?`pm ${r}`:"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]="b18eefc1-0d1d-5c9c-b98a-b96771070301")}catch{}})();var Wg=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),l0=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract","--all"]);function d0(e){let t=e.indexOf("=");return t>0&&Wg.has(e.slice(0,t))}function u0(e,t){return typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-")}function Us(e){for(let t=0;t<e.length;t+=1){let r=e[t];if(r==="--")return;if(Wg.has(r)){t+=u0(r,e[t+1])?1:0;continue}if(!(d0(r)||l0.has(r)||r==="--profile"||r==="--id-only"||r==="--explain")&&!r.startsWith("-"))return t}}function jW(e){let t=Us(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]="49de148c-3c60-547b-b3bc-d0a71e013dc6")}catch{}})();var f0=new Set(["--literal","--regex","--replacement"]);function p0(e){let t=Us(e);if(t===void 0)return!1;if(e[t]==="history-redact")return!0;if(e[t]!=="history")return!1;let r=e.slice(t+1),n=Us(r);return n!==void 0&&r[n]==="redact"}function HW(e){if(!p0(e))return[...e];let t=[],r=!1;for(let n of e){if(r){t.push("[redacted]"),r=!1;continue}r=!1;let o=n.indexOf("="),i=o>=0?n.slice(0,o):n;if(!f0.has(i)){t.push(n);continue}if(o>=0){t.push(`${i}=[redacted]`);continue}t.push(i),r=!0}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]="6c87b004-3647-531a-9599-d37fd91c2807")}catch{}})();var Jg=new WeakMap;function WW(e,t){Jg.set(e,new Set(t))}var Yg='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',m0={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"],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"}},_0=[{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 YW(e,t,r){if(e&&t)throw new g(`${r} cannot be combined with --full`,_.USAGE)}function gt(e,t=new Set){let r=e.filter(n=>!t.has(n.name)).map(n=>({...n}));return{has_omissions:r.length>0,omitted_field_group_count:r.length,omitted_field_groups:r}}function KW(e,t){let r=_0.find(o=>o.command===e);if(r===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===r.complete_mode)return gt([]);let n=r.omissions_by_mode[t];if(n===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return gt(n)}var g0=[{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 $e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var y0=new Set([void 0,"tabular_when_uniform"]),h0=new Set(["collection","none"]),b0=new Set(["supported","unsupported"]);function Kg(e,t){return Array.isArray(e)&&(t||e.length>0)&&e.every(r=>typeof r=="string"&&r.length>0)&&new Set(e).size===e.length}function w0(e){return $e(e)&&typeof e.command=="string"&&e.command.trim().length>0&&h0.has(e.row_kind)&&Kg(e.row_keys,!0)&&(e.continuation_row_keys===void 0||Kg(e.continuation_row_keys,!1))&&b0.has(e.fields)&&y0.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 v0={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"]},E0={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"],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 T0(e,t){let r=e.trim().toLowerCase().split(/\s+/u,1)[0],n=r?.startsWith("list-")?"list":r;if(n==="graph"){let s=typeof t.subcommand=="string"?t.subcommand:"";if(s.length===0)return;let a=v0[s];if(a===void 0)return;let c=a.filter(l=>Array.isArray(t[l])||$e(t[l]));return{command:"graph",row_kind:c.length>0?"collection":"none",row_keys:c,fields:"unsupported",...c.length>0?{jq_selector:Yg}:{},toon_encoding:"tabular_when_uniform"}}let o=m0[n],i=E0[n];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((l,d)=>$e(l)?l[d]:void 0,t);return Array.isArray(c)||$e(c)});return{command:n,row_kind:s.length>0?"collection":"none",row_keys:s,fields:o.fields,...s.length>0?{jq_selector:Yg}:{},toon_encoding:"tabular_when_uniform"}})()}function k0(e){if(!$e(e.projection)||typeof e.projection.mode!="string"||e.projection.mode.trim().length===0)return;let t=e.projection.declared_field_groups,r=e.projection.included_field_groups;if(!Array.isArray(t)||!Array.isArray(r))return;let n=t.filter(s=>$e(s)&&typeof s.name=="string"&&s.name.trim().length>0&&typeof s.restore_with=="string"&&s.restore_with.trim().length>0),o=r.filter(s=>typeof s=="string");if(n.length!==t.length||o.length!==r.length)return;let i=new Set(n.map(s=>s.name));if(!(i.size!==n.length||new Set(o).size!==o.length||o.some(s=>!i.has(s))))return gt(n,new Set(o))}function A0(e){if(!Array.isArray(e.sections_included))return;let t=gt(g0,new Set(e.sections_included.filter(r=>typeof r=="string")));return $e(e.summary)&&e.summary.scope==="matching_items"&&(t.summary_scope="matching_items"),t}function S0(e){if(!$e(e.item))return;let t=e.item,r=["comments","notes","learnings","files","tests","docs","reminders","events"],n=["body","children","claim_state","linked","schedule"],o=Jg.get(e),i=a=>r.includes(a)||a==="body"?t:e,s=["body",...r,...n.slice(1)].filter(a=>o===void 0||o.has(a)||Object.hasOwn(i(a),a)).map(a=>({name:a,restore_with:`--fields ${a}`}));return gt(s,new Set(s.flatMap(({name:a})=>Object.hasOwn(i(a),a)?[a]:[])))}function Xg(e){if($e(e.projection))return gt([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function O0(e){if(!$e(e.projection))return gt([]);if(typeof e.projection.mode=="string")return gt([{name:"full_check_details",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_check_details"]:[]))}function C0(e){if(!(!$e(e.selected)||typeof e.selected.summary!="boolean"))return gt([{name:"full_contract_catalog",restore_with:"--full"}],new Set(e.selected.summary?[]:["full_contract_catalog"]))}function I0(e,t){let r=k0(t);if(r!==void 0)return r;let[n]=e.split(/\s+/u,1);if(n==="context")return A0(t);if(n==="get")return S0(t);if(n==="list"||n.startsWith("list-"))return Xg(t);if(n==="search")return Xg(t)??gt([{name:"projection_metadata",restore_with:"--full"}]);if(n==="health")return O0(t);if(n==="contracts")return C0(t)}function Zg(e,t){if(e===void 0||!$e(t))return t;let r=I0(e,t),n=t.row_contract,o=w0(n)?n:T0(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 $e(i.omission_receipt)||r===void 0?i:{...i,omission_receipt:r}}import{createHash as R0}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]="15037266-75b7-5f8d-9565-e7848e720a49")}catch{}})();var _d=1,ey=4096,x0=/^[A-Za-z0-9_-]+$/;function Qg(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,r)=>r.toUpperCase())}function t3(e,t){let r=new Set;for(let n of t)if(n.cursor_semantics==="presentation"){r.add(Qg(n.flag));for(let o of n.aliases??[])r.add(Qg(o))}return Object.fromEntries(Object.entries(e).filter(([n])=>!r.has(n)))}function r3(e,t){return R0("sha256").update(e).update("\0").update(L(t)).digest("hex").slice(0,24)}function Wo(e,t,r,n){return Buffer.from(JSON.stringify({version:_d,fingerprint:e,after_id:t,...r===void 0?{}:{after_index:r},...n===void 0?{}:{snapshot:n}})).toString("base64url")}function Nr(e){return new g(e,_.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function N0(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===_d&&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 gd(e){if(typeof e!="string")throw Nr("Query cursor is malformed.");let t=e.trim();if(t.length===0||t.length>ey||!x0.test(t))throw Nr("Query cursor is malformed.");let r;try{r=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw Nr("Query cursor is malformed.")}if(!N0(r))throw Nr("Query cursor version or payload is unsupported.");return r}function yd(e,t){let r=gd(e);if(r.fingerprint!==t)throw Nr(`Query cursor does not match the current filters, sort, or query (${r.fingerprint} != ${t}).`);return{after_id:r.after_id,...r.after_index===void 0?{}:{after_index:r.after_index},...r.snapshot===void 0?{}:{snapshot:r.snapshot}}}function n3(e,t){return yd(e,t).after_id}function D0(e,t,r,n){if(t===void 0)return 0;let o=yd(t,r),i=e.findIndex(s=>n(s)===o.after_id);if(i<0){if(o.after_index!==void 0)return Math.min(o.after_index,e.length);throw Nr(`Query cursor item ${o.after_id} is no longer present in this result set.`)}return i+1}function o3(e,t){if(t.cursor!==void 0&&yd(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw Nr("Query cursor does not match the requested snapshot.");let r=D0(e,t.cursor,t.fingerprint,t.readId),n=e.slice(r,r+t.limit),o=n.length>0&&r+n.length<e.length,i=n.at(-1);return{rows:n,has_more:o,...o&&i!==void 0?{next_cursor:Wo(t.fingerprint,t.readId(i),r+n.length-1,t.snapshot)}:{}}}var i3=Object.freeze({version:_d,max_length:ey});(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 P0=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 On(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ty(e,t){let r=e;for(let n of t.split("."))if(Array.isArray(r)){if(!/^\d+$/u.test(n))return;r=r[Number(n)]}else{if(!On(r))return;r=r[n]}return r}function hd(e,t,r){let n=t.split("."),o=(i,s)=>{if(s===n.length)return r;let a=n[s];if(Array.isArray(i)){let l=Number(a),d=[...i];return d[l]=o(i[l],s+1),d}let c=i;return{...c,[a]:o(c[a],s+1)}};return o(e,0)}function ry(e,t,r){let n=Cn(e).find(i=>i.path===t);if(!n)return e;let o=Array.isArray(n.value)?n.value.slice(r):Object.fromEntries(Object.entries(n.value).slice(r));return hd(e,t,o)}function zs(e){let t=e.row_contract;return On(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(r=>typeof r=="string"&&r.trim().length>0):Object.entries(e).filter(([,r])=>Array.isArray(r)).map(([r])=>r)}function M0(e){let t=e.row_contract;return On(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(r=>typeof r=="string"&&r.trim().length>0):zs(e)}function tr(e){return zs(e).flatMap(t=>{let r=ty(e,t);return Array.isArray(r)||On(r)?[{path:t,value:r}]:[]})}function Cn(e){return M0(e).flatMap(t=>{let r=ty(e,t);return Array.isArray(r)||On(r)?[{path:t,value:r}]:[]})}function qs(e){let t=tr(e),r=new Set(t.map(o=>o.path)),n=(o,i)=>{if(Array.isArray(o)){r.has(i)||t.push({path:i,value:o}),o.forEach((s,a)=>n(s,`${i}.${a}`));return}if(On(o))for(let[s,a]of Object.entries(o))i.length===0&&P0.has(s)||n(a,i.length===0?s:`${i}.${s}`)};return n(e,""),t}function Hs(e){return tr(e).reduce((t,r)=>t+(Array.isArray(r.value)?r.value.length:Object.keys(r.value).length),0)}function Yo(e,t){let r=e;for(let n of tr(r)){let o=Array.isArray(n.value)?n.value.map((i,s)=>t(i,n.path,s)):Object.fromEntries(Object.entries(n.value).map(([i,s],a)=>[i,t(s,n.path,a)]));r=hd(r,n.path,o)}return r}function ny(e,t){let r=e,n=!1;for(let o of tr(r)){let i=Array.isArray(o.value)?o.value:Object.entries(o.value);if(i.length<=t)continue;n=!0;let s=Array.isArray(o.value)?i.slice(0,t):Object.fromEntries(i.slice(0,t));r=hd(r,o.path,s)}return{result:r,truncated: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]="6e88d6b7-aa5f-5515-8ea4-481916b12ef1")}catch{}})();var Gs="changed_fields",L0="changed_field_count",bd="rows",F0=new Set(["apply","rollback"]),ay=new Set(["deleted","would_delete"]),oy=256,iy={start_task:["claim","update"],pause_task:["update","release"],close_task:["close","release"]};function $0(e,t){if(!je(e)||typeof e.action!="string"||typeof e.id!="string"||e.id.length===0)return null;let r=Object.hasOwn(iy,e.action)?iy[e.action]:void 0;if(!r||!r.every(i=>{let s=e[i];return je(s)&&je(s.item)&&s.item.id===e.id&&Array.isArray(s.changed_fields)&&s.changed_fields.every(a=>typeof a=="string")}))return null;let n=e[r.at(-1)],o=ly(n);return t.idOnly?o:!t.compactEnvelope&&t.changedFields!=="compact"?null:{...e,...t.compactEnvelope?{...o,changed_field_count:new Set(r.flatMap(i=>e[i].changed_fields)).size}:{},...Object.fromEntries(r.map(i=>[i,Ko(e[i],t)]))}}function sy(e){return typeof e!="string"||e.length<=oy?e:`${e.slice(0,oy-1)}\u2026`}function j0(e){if(!je(e))return null;let t={...e};return t.reason=sy(t.reason),je(t.previous_terminal)&&(t.previous_terminal=Object.fromEntries(Object.entries(t.previous_terminal).map(([r,n])=>[r,sy(n)]))),t}function je(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function cy(e){let t=e[Gs];if(!Array.isArray(t))return null;let r=Object.getPrototypeOf(e)===null?Object.create(null):{};for(let[n,o]of Object.entries(e))n!==Gs&&(r[n]=o);return r[L0]=t.length,r}function U0(e){return"item"in e&&Array.isArray(e[Gs])}function z0(e){return typeof e.mode=="string"&&F0.has(e.mode)&&Array.isArray(e[bd])}function q0(e,t){let r=Object.getPrototypeOf(e)===null?Object.create(null):{};return Object.assign(r,e),r[bd]=t,r}function ly(e){if(!je(e))return null;let t=je(e.item)?e.item:je(e.plan)?e.plan:null;if(t===null)return null;let r=typeof t.id=="string"?t.id:void 0,n=typeof e.outcome=="string"&&ay.has(e.outcome)?e.outcome:typeof t.status=="string"?t.status:void 0;return r?n?{id:r,status:n,...typeof e.deleted=="boolean"?{deleted:e.deleted}:{}}:{id:r}:null}function H0(e){if(!je(e)||!je(e.item)||typeof e.item.id!="string")return null;let t=e[Gs];if(!Array.isArray(t))return null;let r={id:e.item.id,...typeof e.outcome=="string"&&ay.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 G0(e,e.item,r),r}function G0(e,t,r){let n=typeof e.close_reason=="string"?e.close_reason:typeof t.close_reason=="string"?t.close_reason:void 0;n!==void 0&&(r.close_reason=n);let o=j0(e.recurrence);if(o!==null&&(r.recurrence=o),Array.isArray(e.warnings)&&e.warnings.length>0&&(r.warnings=e.warnings),je(e.recovery)&&(r.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)&&(r[i]=e[i])}function B0(e){let t=z0(e)?e[bd]:void 0;if(!Array.isArray(t))return{projected:e,changed:!1};let r=!1,n=t.map(o=>{if(!je(o))return o;let i=cy(o);return i?(r=!0,i):o});return r?{projected:q0(e,n),changed:!0}:{projected:e,changed:!1}}function Ko(e,t={}){let r=$0(e,t);if(r!==null)return r;if(t.idOnly===!0){let c=ly(e);if(c!==null)return c}if(t.compactEnvelope===!0){let c=H0(e);if(c!==null)return c}if((t.changedFields??"full")==="full"||!je(e))return e;let o=!1,i=e,s=U0(e)?cy(e):null;s!==null&&(i=s,o=!0);let a=B0(i);return a.changed&&(i=a.projected,o=!0),o?i:e}import{AsyncLocalStorage as vN}from"node:async_hooks";import{stripVTControlCharacters as pR}from"node:util";import{createHash as uy}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]="8b0d8654-211b-57bf-852f-8a153849e8fd")}catch{}})();var V0=["policies","policy-put","policy-remove","policy-mode","policy-check","policy-approve","policy-presets"],dy=256,wd=64;function Re(e){throw new g(`Invalid workflow policy: ${e}`,_.USAGE,{code:"workflow_policy_invalid",nextSteps:["Inspect pm schema policies and correct the declaration using pm schema policy-put."]})}function Pt(e,t,r){if(typeof e!="object"||e===null||Array.isArray(e))return Re(`${r} must be an object`);let n=e;return Object.keys(n).some(o=>!t.includes(o))?Re(`${r} contains an unknown key`):n}function Dr(e,t,r=128){return typeof e!="string"||!e.trim()||e.length>r?Re(`${t} must be nonempty text of at most ${r} characters`):e.trim()}function Xo(e,t){if(!Array.isArray(e)||e.length===0||e.length>wd)return Re(`${t} requires 1-${wd} terms`);let r=e.map(n=>Dr(n,t));return t==="fields"&&r.some(n=>!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$/.test(n)||n.split(".").some(o=>["__proto__","constructor","prototype"].includes(o)))?Re("fields must be safe metadata paths of at most eight segments"):[...new Set(r)]}function W0(e){let t=Pt(e,["kind","fields","authors","allowed"],"rule");return t.kind==="transition"?(Pt(t,["kind","allowed"],"transition rule"),!Array.isArray(t.allowed)||t.allowed.length>wd?Re("transition.allowed must be a bounded array"):{kind:"transition",allowed:t.allowed.map(r=>!Array.isArray(r)||r.length!==2?Re("transition pairs need two statuses"):[Dr(r[0],"from"),Dr(r[1],"to")])}):t.kind==="authors"?(Pt(t,["kind","authors"],"authors rule"),{kind:"authors",authors:Xo(t.authors,"authors")}):t.kind==="require_fields"?(Pt(t,["kind","fields"],"require_fields rule"),{kind:"require_fields",fields:Xo(t.fields,"fields")}):t.kind==="field_writers"||t.kind==="approval"?(Pt(t,["kind","fields","authors"],"field rule"),{kind:t.kind,fields:Xo(t.fields,"fields"),authors:Xo(t.authors,"authors")}):Re("unknown rule kind")}function Y0(e){let t={},r=Pt(e,["types","tags","statuses","operations","parents","dependency"],"subject");for(let n of["types","tags","statuses","operations","parents"])r[n]!==void 0&&(t[n]=Xo(r[n],n));if(r.dependency!==void 0){let n=Pt(r.dependency,["kind","id"],"dependency");t.dependency={kind:Dr(n.kind,"dependency kind"),...n.id===void 0?{}:{id:Dr(n.id,"dependency id")}}}return t}function K0(e){let t=Pt(e,["id","description","subject","effect","rule"],"policy"),r=Dr(t.id,"id");return/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(r)?t.effect!==void 0&&(typeof t.effect!="string"||!["advise","warn","refuse"].includes(t.effect))?Re("effect must be advise, warn, or refuse"):{id:r,rule:W0(t.rule),...t.subject===void 0?{}:{subject:Y0(t.subject)},...t.description===void 0?{}:{description:Dr(t.description,"description",500)},...t.effect===void 0?{}:{effect:t.effect}}:Re("id must be a stable token")}function vd(e){let t=Pt(e,["version","enforcement","policies"],"document");if(t.version!==1)return Re("unsupported version");if(t.enforcement!==void 0&&t.enforcement!=="advise"&&t.enforcement!=="refuse")return Re("enforcement must be advise or refuse");if(!Array.isArray(t.policies)||t.policies.length>dy)return Re(`policies must contain at most ${dy} declarations`);let r=t.policies.map(K0);return new Set(r.map(n=>n.id)).size!==r.length?Re("duplicate policy id"):{version:1,enforcement:t.enforcement??"advise",policies:r}}function Bs(e,t){let r=e;for(let n of t.split(".")){if(typeof r!="object"||r===null||!Object.hasOwn(r,n))return;r=r[n]}return r}function X0(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 fy(e){return uy("sha256").update(L(e)).digest("hex")}function J0(e,t){let r=e.rule.kind==="approval"?e.rule.fields:[];return uy("sha256").update(L({id:t.id,fields:r.map(n=>[n,Bs(t,n)])})).digest("hex")}function Z0(e,t){return Array.isArray(t)&&t.some(r=>typeof r=="object"&&r!==null&&"kind"in r&&r.kind===e.kind&&(e.id===void 0||"id"in r&&r.id===e.id))}function Q0(e,t,r){return!(e.types&&!e.types.some(n=>n.toLowerCase()===String(t.type).toLowerCase())||e.statuses&&!e.statuses.includes(String(t.status))||e.operations&&!e.operations.includes(r)||e.parents&&!e.parents.includes(String(t.parent))||e.tags&&(!Array.isArray(t.tags)||!e.tags.some(n=>t.tags.includes(n)))||e.dependency&&!Z0(e.dependency,t.dependencies))}function Ed(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 r=e.subject??{},n=t.after?.status??t.before?.status;return[t.before,t.after].some(o=>o!==null&&Q0(r,{...o,status:n},t.operation))}function eR(e,t,r,n){let o=["type","tags","parent","dependencies"].some(s=>!ne(t.before?.[s],t.after?.[s]));return t.after&&(t.completeness_only||r||n||o)?e.filter(s=>!X0(Bs(t.after,s))):[]}function tR(e,t,r,n){let o=t.after??t.before,i=J0(e,o);return t.approvals?.some(s=>s.policy_fingerprint===n&&s.content_fingerprint===i&&s.author!==t.author&&r.includes(s.author))??!1}function rR(e,t,r){let n=e.rule,o=t.before?.status!==t.after?.status,i="fields"in n&&n.fields.some(s=>!ne(Bs(t.before,s),Bs(t.after,s)));switch(n.kind){case"require_fields":{let s=eR(n.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||n.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:n.authors.includes(t.author),missing_fields:[],remediation:"Have a declared workflow actor perform this operation."};case"field_writers":return{satisfied:!i||n.authors.includes(t.author),missing_fields:[],remediation:"Have a declared field writer change the protected fields."};case"approval":return{satisfied:!o||tR(e,t,n.authors,r),missing_fields:[],remediation:`Record an independent approval with pm schema policy-approve <item-id> --policy ${e.id} after preparing the reviewed fields.`}}}function py(e,t,r){let n=e.policies.filter(o=>Ed(o,t)).map(o=>{let i=o.effect??"advise",s=r(o);return{policy_id:o.id,policy_fingerprint:s,rule:o.rule.kind,effect:i==="refuse"&&e.enforcement!=="refuse"?"warn":i,...rR(o,t,s)}});return{allowed:!n.some(o=>!o.satisfied&&o.effect==="refuse"),decisions:n,warnings:n.filter(o=>!o.satisfied).map(o=>`workflow_policy:${o.effect}:${o.policy_id}:${o.rule}`)}}function my(e,t){return py(e,t,fy)}function p3(e){let t=vd(e),r=new Map(t.policies.map(n=>[n,fy(n)]));return n=>py(t,n,o=>r.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 _y=[...mt],gy=[...gn],yy=[...is],nR=[...ss],oR=[...as],hy=[...cs],Jo=["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"],h3=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],iR=["install","reconcile","report","driver"],by=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],wy=["upgrade"],vy=["reopen"],Td={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},st=Object.freeze(Jo.flatMap(e=>e in Td?[]:e==="extension"||e==="package"?[...by.map(t=>`${e}-${t}`),...e==="package"?wy.map(t=>`package-${t}`):[],e]:e==="item"?vy.map(t=>`item-${t}`):[e])),Ey=Object.freeze(go.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&st.includes(e.alias)).map(e=>e.alias)),sR=Object.freeze(st.filter(e=>!Ey.includes(e)));function aR(e=Jo,t=st,r=Td){let n=new Set(t),o=new Set(e);return{missing_cli_actions:e.filter(i=>!n.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&r[i]===void 0),waived_cli_actions:e.filter(i=>!n.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&r[i]!==void 0),stale_waivers:Object.keys(r).filter(i=>!o.has(i)||n.has(i)||t.some(s=>s.startsWith(`${i}-`)))}}function cR(e){return st.includes(e)}function lR(e){return _y.includes(e)}function dR(e){return gy.includes(e)}function uR(e){return yy.includes(e)}function fR(e){return hy.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]="b4036040-c0b8-5d01-b490-3405722fd1c5")}catch{}})();var ky=["full","compact","brief","summary","counts"],mR=["mutation","read","discovery","governance"],kd=["error","warning","validation_summary","recovery_bundle"],Ay=["full","omit_explanation","limit_collections","compact_recovery","action_only"],_R=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"]),gR=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),yR=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),hR={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},bR=3,wR=2,vR=192,ER={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},Sy=kd.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:ER[e],minimum_max_estimated_tokens:vR,degradation_ladder:Ay,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),TR=new Map(Sy.map(e=>[e.diagnostic_class,e]));function Oy(e){let[t=""]=Ke(e).split(/\s+/u);return _R.has(t)?"mutation":gR.has(t)?"discovery":yR.has(t)?"governance":"read"}function Ad(e,t=Oy(e)){let r=e.trim().replace(/\s+/gu," ");if(r.length===0)throw new TypeError("command must be a non-empty command path");let n=hR[t];return Cy({command:r,budget_class:t,default_max_estimated_tokens:n,default_max_estimated_tokens_by_format:{toon:n,json:Math.ceil(n*bR/wR)},degradation_ladder:ky,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function Cy(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,r]of Object.entries(e.default_max_estimated_tokens_by_format))if(!Number.isSafeInteger(r)||r<=0)throw new RangeError(`default_max_estimated_tokens_by_format.${t} must be a positive safe integer`);return e}var Iy=Jo.map(e=>Ad(e)),kR=new Map(Iy.map(e=>[e.command,e]));function Sd(e,t={}){let r=e.trim().replace(/\s+/gu," "),[n]=Ke(r).split(" "),o=kR.get(n);return o?{...o,command:r}:t.generateFallback?Ad(r):null}function nr(e){return Math.ceil(Math.max(0,e)/4)}function Od(e){let t=TR.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${kd.join(", ")}`);return t}function rr(e){return nr(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function AR(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Cd(e){if(!AR(e))return;let t={};for(let r of["suggested_retry","suggested_retry_args","next_best_command","allowed_values","candidate_commands","missing","missing_required_fields","option_scope","retry_after_ms"]){let n=e[r];Array.isArray(n)?t[r]=r==="suggested_retry_args"?n:n.slice(0,3):n!==void 0&&(t[r]=n)}return Object.keys(t).length>0?t:void 0}function SR(e,t){return typeof e!="string"||e.length<=t?e:`${e.slice(0,Math.max(1,t-3))}...`}function Pr(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;let r="...",n=Array.from(e),o=0,i=n.length;for(;o<i;){let s=Math.ceil((o+i)/2),a=`${n.slice(0,s).join("")}${r}`;Buffer.byteLength(a,"utf8")<=t?o=s:i=s-1}return`${n.slice(0,o).join("")}${r}`}function Ry(e){let t={};for(let r of["code","required","recovery","next_steps","exit_code","type","title","detail","why","examples"])Object.hasOwn(e,r)&&e[r]!==void 0&&(t[r]=e[r]);for(let[r,n]of Object.entries(e))r!=="__proto__"&&!Object.hasOwn(t,r)&&(t[r]=n);return t}var OR=new Set(["limit_collections","compact_recovery","action_only"]),CR=new Set(["compact_recovery","action_only"]);function IR(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:SR(e.required,160)??"Inspect the diagnostic code and retry with corrected input."},r=Cd(e.recovery);return r!==void 0?t.recovery=r: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 RR(e,t){let r=structuredClone(e);if(t!=="full"&&(delete r.why,delete r.examples),OR.has(t))for(let[n,o]of Object.entries(r))Array.isArray(o)&&(r[n]=o.slice(0,3));if(CR.has(t)){let n=Cd(r.recovery);n?r.recovery=n:delete r.recovery}return t!=="action_only"?Ry(r):IR(r)}function In(e,t){let r={...e,diagnostic_output:{...t,estimated_tokens:0}};for(let n=0;n<4;n+=1){let o=rr(r),i=r.diagnostic_output;if(i.estimated_tokens===o)break;i.estimated_tokens=o}return r}function xR(e,t,r){let n=In(e,t);for(let i of["recovery","exit_code"])rr(n)<=r||e[i]===void 0||(delete e[i],n=In(e,t));let o=40;for(;rr(n)>r&&o>4;)o-=4,e.code=Pr(String(e.code),o),e.required=Pr(String(e.required),o),n=In(e,t);return n}function NR(e,t){let r=e.diagnostic_output,{estimated_tokens:n,...o}=r,i=o.omitted_fields.slice(0,8).map(u=>Pr(u,32)),s={...o,omitted_fields:i,...o.omitted_fields.length>i.length?{omitted_fields_overflow_count:o.omitted_fields.length-i.length}:{}},a=Cd(e.recovery),c=a&&rr(a)<=48?a:void 0,l={code:Pr(String(e.code),320),required:Pr(String(e.required),320),...c?{recovery:c}:{},...e.exit_code!==void 0?{exit_code:e.exit_code}:{}},d=In(l,s);for(;rr(d)>t&&s.omitted_fields.length>0;)s.omitted_fields.pop(),s.omitted_fields_overflow_count=o.omitted_fields.length-s.omitted_fields.length,d=In(l,s);return d=xR(l,s,t),d}function DR(e,t={}){let r=e,n=t.diagnosticClass??"error",o=Od(n),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=rr(r),c=Object.keys(r);if(a<=s)return Ry(structuredClone(r));let l;for(let[d,u]of o.degradation_ladder.entries()){let f=RR(r,u),p=c.filter(h=>!Object.hasOwn(f,h)),m=In(f,{diagnostic_class:n,format:"json",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,truncated:d>0,degradation_steps:o.degradation_ladder.slice(0,d+1),omitted_fields:p});if(l=m,rr(m)<=s)break}return rr(l)>s&&(l=NR(l,s)),l}function Ty(e){return pR(e).replace(/\r\n/gu,`
|
|
3
3
|
`).replace(/[^\P{Cc}\n]/gu," ")}function PR(e,t,r={}){let n=r.diagnosticClass??"error",o=Od(n),i=r.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=Ty(e),c=nr(Buffer.byteLength(a,"utf8")),l=c>s,d=`What is required:
|
|
4
4
|
`,f=`
|
|
5
5
|
|
|
@@ -209,10 +209,10 @@ ${i}
|
|
|
209
209
|
`)&&!t.startsWith("-")&&!t.startsWith("*")&&!t.startsWith("+"))return null;let r={},n,o=Yf(t).split(`
|
|
210
210
|
`).map(i=>i.trim()).filter(i=>i.length>0);for(let i of o){let s=i.match(/^(?:[-*+]\s+)?([a-zA-Z0-9_.-]+)\s*(=|:)\s*(.*)$/);if(s){let a=s[1].trim();r[a]=jv(s[3].trim()),n=a;continue}if(n&&Pv.has(n.toLowerCase())){r[n]=`${r[n]}
|
|
211
211
|
${i}`;continue}return null}return r}function M1(e,t){let r=$v(e).trim();if(!r)throw new g(`${t} cannot be empty`,_.USAGE);let n=P1(r);if(n)return n;let o={},i,s=x1(r);for(let a of s){let c=N1(a);if(c>=0){let l=a.slice(0,c).trim();if(!l)throw new g(Dv(e,t),_.USAGE);let d=jv(a.slice(c+1).trim());o[l]=d,i=l;continue}if(i&&Pv.has(i.toLowerCase())){o[i]=`${o[i]},${a}`;continue}throw new g(Dv(e,t),_.USAGE)}return o}var L1=/^[A-Za-z]:[\\/]/,F1=/^(?:[-*+]\s+)?[A-Za-z_][A-Za-z0-9_.-]*\s*=/;function $1(e){let t=e.trim();return L1.test(t)?!1:F1.test(t)}function DX(e,t,r,n){if(!(n||!e.includes(",")))throw new g(`${t} received an ambiguous comma-bearing bare ${r}. Repeat ${t} for multiple values, or quote or escape literal commas in a structured key=<value> entry.`,_.USAGE,{code:"bare_comma_entry_ambiguous",required:`Use one ${t} per bare ${r}, or quote or escape literal commas in a structured key=<value> entry.`})}function j1(e,t,r){let n=new Set(r.map(i=>i.toLowerCase())),o=Object.keys(e).filter(i=>!n.has(i.toLowerCase()));if(o.length>0)throw new g(`${t} does not recognize key${o.length>1?"s":""} ${o.map(i=>`"${i}"`).join(", ")}. Allowed keys: ${r.join(", ")}.`,_.USAGE);for(let i of Object.keys(e)){let s=i.toLowerCase();if(s!==i){if(Object.hasOwn(e,s))throw new g(`${t} provides key "${i}" more than once after case normalization.`,_.USAGE);e[s]=e[i],delete e[i]}}}async function U1(e){if(process.stdin.isTTY===!0)throw new g(`${e} value "${Ht}" requires piped stdin input. Pipe content into the command, or end manual stdin with Ctrl+D (Unix/macOS) or Ctrl+Z then Enter (Windows).`,_.USAGE);return process.stdin.setEncoding("utf8"),await new Promise((t,r)=>{let n="";process.stdin.on("data",o=>{n+=o}),process.stdin.on("end",()=>{t(Yf(n))}),process.stdin.on("error",o=>{r(o)})})}var Qr=Symbol("all-mutation-stdin-fields"),ut=new WeakMap;function Uv(e){return ut.set(e,Qr),e}function z1(e,t){let r=ut.get(e);return r===Qr||ut.set(e,new Set([...r??[],...t])),e}function q1(e,t){let r=ut.get(e);return r===void 0||ut.set(t,r===Qr?r:new Set(r)),t}function PX(e,t){let r=ut.get(e),n=ut.get(t);return r===void 0||n===Qr?t:r===Qr?(ut.set(t,r),t):(ut.set(t,new Set([...n??[],...r])),t)}function H1(e){return ut.get(e)!==Qr}function pc(e,t){let r=ut.get(e);return r!==Qr&&!r?.has(t)}function G1(e){let t;for(let r of e){if(r.resolveToken===!1||r.value===void 0)continue;let o=(Array.isArray(r.value)?r.value:[r.value]).filter(i=>i.trim()===Ht).length;if(o>1)throw new g(`${r.optionName} accepts "${Ht}" stdin token at most once per command invocation`,_.USAGE);if(o!==0){if(t!==void 0&&t!==r.optionName)throw new g(`Only one option may use "${Ht}" stdin token per command invocation. Already used by ${t}.`,_.USAGE);t=r.optionName}}}async function MX(e,t,r){let n=e,o=[...t,...r];G1(o.map(([a,c])=>({value:n[a],optionName:c,resolveToken:pc(e,a)})));let i=oo(),s={...n};for(let[a,c]of t)s[a]=await i.resolveValue(n[a],c,pc(e,a));for(let[a,c]of r)s[a]=await i.resolveList(n[a],c,pc(e,a));return Uv(s)}function oo(){let e,t,r=async i=>{if(t&&t!==i)throw new g(`Only one option may use "${Ht}" stdin token per command invocation. Already used by ${t}.`,_.USAGE);return t=i,e||(e=U1(i)),await e};return{resolveValue:async(i,s,a=!0)=>{if(!a)return i;if(i!==void 0)return i.trim()!==Ht?i:await r(s)},resolveList:async(i,s,a=!0)=>{if(!a)return i;if(!i)return;let c=i.map((u,f)=>u.trim()===Ht?f:-1).filter(u=>u>=0);if(c.length===0)return i;if(c.length>1)throw new g(`${s} accepts "${Ht}" stdin token at most once per command invocation`,_.USAGE);let l=await r(s),d=[...i];return d[c[0]]=l,d}}}function B1(e,t){let r=Number(e);if(!Number.isFinite(r))throw new g(`Invalid ${t} value "${e}"`,_.USAGE);return r}function V1(e,t){let r=e.trim(),n=Number(r);if(r===""||!Number.isInteger(n)||n<0)throw new g(`Invalid ${t} value "${e}". Expected a non-negative integer.`,_.USAGE);return n}import{readFile as W1}from"node:fs/promises";(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]="854a0596-b0ec-5d2e-85b1-5444d8d7b622")}catch{}})();var Y1=e=>W1(e,"utf8"),K1=async e=>await oo().resolveValue("-",e);function Kf(e){return[...new Set(e.split(/[,\r\n]+/).map(t=>t.trim()).filter(t=>t.length>0))]}function X1(e){let t=[];for(let n of e)if(typeof n=="string")t.push(n);else if(typeof n=="number"&&Number.isFinite(n))t.push(String(n));else return"";let r=Kf(t.join(`
|
|
212
|
-
`));return r.length>0?r.join(","):""}function zv(e){if(e===void 0)return;if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(Array.isArray(e))return X1(e);if(typeof e!="string")return"";let t=Kf(e);return t.length>0?t.join(","):""}async function J1(e,t="--ids",r={}){if(e===void 0)return;let n=e.trim(),o=e;try{if(n==="-")o=await(r.readStdin??K1)(t);else if(n.startsWith("@")){let s=n.slice(1).trim();if(s.length===0)throw new g(`${t} @path requires a non-empty file path.`,_.USAGE,{code:"bulk_ids_input_missing_path",required:`Pass ${t} @<path>, ${t} -, or inline IDs.`});o=await(r.readFile??Y1)(s)}}catch(s){if(s instanceof g)throw s;let a=s instanceof Error?s.message:String(s);throw new g(`${t} could not read ${n==="-"?"stdin":`"${n.slice(1).trim()}"`}: ${a}`,_.NOT_FOUND,{code:"bulk_ids_input_unreadable",required:`Provide readable newline/comma-delimited IDs via ${t} -, ${t} @<path>, or inline argv text.`,nextSteps:[`Retry with inline IDs: ${t} pm-a1b2,pm-c3d4`,`Or pipe IDs: pm list --id-only | pm update-many ${t} - --dry-run`]})}let i=zv(o);if(i!=="")return i;throw new g(`${t} requires at least one non-empty item ID.`,_.USAGE,{code:"bulk_ids_input_empty",required:"Provide one or more comma- or newline-delimited IDs through argv, stdin, or @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]="b0ab458f-0faf-5653-9862-43cbe9cf8f1f")}catch{}})();function qv(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Xf(e){if(e==="/body"||e.startsWith("/body/"))return"body";if(e==="/metadata"||e.startsWith("/metadata/")||e==="/front_matter"||e.startsWith("/front_matter/")){let r=e.replace(/^\/(?:metadata|front_matter)\/?/,"").split("/")[0];return r?qv(r):"metadata"}let t=e.replace(/^\//,"").split("/")[0];return t?qv(t):"root"}function mc(e,t){return t==="body"?e.body:t==="metadata"?e.metadata:t==="root"?e:e.metadata[t]}function Z1(e,t){let r=t?.windowStartIndex??0,n=t?.field;if(e.length===0||r>=e.length)return[];let o=Xn(),i=[];for(let s=0;s<e.length;s+=1){let a=e[s],c=o,l=zt(o,a.patch),d;l.ok?(d=l.document,o=d):d=c;let u=new Set;for(let p of a.patch)u.add(Xf(p.path)),p.from!==void 0&&u.add(Xf(p.from));let f=[...u].sort((p,m)=>p.localeCompare(m));if(s>=r)if(n!==void 0){if(!u.has(n))continue;let p={field:n,before:mc(c,n),after:mc(d,n)};i.push({index:s+1,ts:a.ts,op:a.op,author:a.author,patch_ops:a.patch.length,changed_fields:[n],changes:[p]})}else{let p=f.map(m=>({field:m,before:mc(c,m),after:mc(d,m)}));i.push({index:s+1,ts:a.ts,op:a.op,author:a.author,patch_ops:a.patch.length,changed_fields:f,changes:p})}}return i}import{readFile as Q1}from"node:fs/promises";(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]="e6571e4b-c436-5af7-be01-c3fce3a9c5d3")}catch{}})();var eU=e=>Q1(e,"utf8");async function tU(e,t,r=eU){if(t!==void 0)throw new g("--body and --body-file are mutually exclusive; provide the body inline with --body or from a file with --body-file, not both.",_.USAGE,{code:"body_file_conflicts_with_body",required:"Choose exactly one body source.",why:"Both --body and --body-file set the item body; allowing both would make the effective body ambiguous.",nextSteps:["Re-run with only --body <text> or only --body-file <path>."]});let n=e.trim();if(n.length===0)throw new g("--body-file requires a file path.",_.USAGE,{code:"body_file_missing_path",required:"Pass a readable file path: --body-file <path>.",why:"An empty --body-file value has no file to read the body from."});if(n==="-")return await oo().resolveValue("-","--body-file");try{return await r(n)}catch(o){let i=o?.code,s=i==="EISDIR",a=i?` (${i})`:"";throw new g(s?`--body-file "${n}" is a directory, not a file. Point it at a readable file.`:`--body-file could not read "${n}"${a}. Check that the file exists and is readable.`,_.NOT_FOUND,{code:"body_file_unreadable",required:"Point --body-file at an existing, readable file.",why:`The body content is loaded from the file at the supplied path, so an unreadable path cannot produce a body${i?` (underlying error: ${i})`:""}.`,nextSteps:[`Verify the path: ls -l "${n}"`,"Or pipe the body with --body-file -.","Or pass the body inline with --body <text>."]})}}(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]="91874535-458b-5a33-a68a-96f44bd2e1f8")}catch{}})();var rU=new Set(["none","null","undefined"]);function ZX(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="warn"||t==="strict_error")return t;if(t==="strict")return"strict_error";throw new g("Config set parent-reference-policy requires --policy with one of: warn, strict_error (alias: strict)",_.USAGE)}function nU(e){if(typeof e!="string")throw new g("--parent must be a string. Use --unset parent to clear this field.",_.USAGE);let t=e.trim();if(t.length===0)throw new g("--parent must not be empty. Use --parent none to unset.",_.USAGE);if(Hv(t))throw new g(`--parent must not use placeholder token "${t}". Use --unset parent to clear this field.`,_.USAGE);return t}function Hv(e){return rU.has(e.trim().toLowerCase())}function oU(e,t){if(t==="strict_error")throw new g(`Parent item "${e}" was not found. Create it first or use --parent none.`,_.USAGE);return{warnings:[`validation_warning:parent_reference_missing:${e}`]}}function iU(e,t,r){let n=qt(e,r),o=qt(t,r);if(n!==o)return;let i=t!==o||e!==n?` (normalized from parent "${t}" and item "${e}")`:"";throw new g(`Parent item "${o}" cannot be the same as item "${n}"${i}. Use --unset parent to clear this field.`,_.USAGE)}(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]="b0306587-b3bb-5f82-bb56-7939d1976870")}catch{}})();var Jf={critical:0,high:1,medium:2,low:3,minimal:4},sU=Object.keys(Jf),aU=`numbers 0..4 (0=critical, 1=high, 2=medium, 3=low, 4=minimal) or names (${sU.join(", ")}), case-insensitive`;function _c(e){return new g(`Invalid priority "${e}". Accepted values: ${aU}.`,_.USAGE)}function cU(e){if(typeof e=="number"){if(Number.isInteger(e)&&e>=0&&e<=4)return e;throw _c(String(e))}if(typeof e!="string")throw _c(String(e));let t=e.trim();if(t.length===0)throw _c(e);let r=t.toLowerCase();if(Object.prototype.hasOwnProperty.call(Jf,r))return Jf[r];if(/^[0-4]$/.test(t))return Number(t);throw _c(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]="bfb46357-04de-55a0-b132-779c153314de")}catch{}})();var lU=/^[A-Za-z0-9][A-Za-z0-9._/-]*$/,dU=64;function iJ(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="warn"||t==="strict_error")return t;if(t==="strict")return"strict_error";throw new g("Config set sprint-release-format-policy requires --policy with one of: warn, strict_error (alias: strict)",_.USAGE)}function uU(e,t,r){let n=t.trim();if(n.length===0)throw new g(`--${e} must not be empty. Use --${e} none to unset.`,_.USAGE);if(n.length<=dU&&lU.test(n))return{value:n,warnings:[]};let i="Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._/-]* (no spaces).";if(r==="strict_error")throw new g(`Invalid --${e} value "${n}". ${i}`,_.USAGE);return{value:n,warnings:[`validation_warning:${e}_format:${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]="0eff4d63-2691-5130-bc12-4957218393b5")}catch{}})();var Gv={open:"open_status",closed:"close_status",canceled:"canceled_status",cancelled:"canceled_status"},Bv="all";function uJ(e){if(typeof e!="string")return!1;let t=e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r.length>0);return t.length===1&&t[0]===Bv}function fU(e,t){let r=e.trim().toLowerCase();if(r.length===0)return;let n=Gv[r];return n?t[n]:zr(e,t)}function pU(e){let t=new Set(Object.keys(Gv));for(let r of e.definitions){t.add(r.id);for(let n of r.aliases)t.add(n)}return[...t]}function mU(e,t){let r=e.trim().toLowerCase(),n,o=Number.POSITIVE_INFINITY;for(let i of pU(t)){let s=ot(r,i.toLowerCase(),2);s!==null&&s<o&&(n=i,o=s)}return n}function _U(e,t,r){if(typeof e!="string")return;let n=r?.strict===!0,o=r?.flagLabel??"--status",i=e.split(",").map(c=>c.trim()).filter(c=>c.length>0);if(i.length===0)return;if(i.filter(c=>c.trim().toLowerCase()===Bv).length>0){if(i.length===1)return;throw new g(`Invalid ${o} value "all". Use it by itself, or omit ${o} to search every status.`,_.USAGE)}let a=[];for(let c of i){let l=fU(c,t);if(l===void 0){if(n){let d=mU(c,t);throw new g(`Invalid ${o} value "${c}". Use open|closed|canceled or a configured status id${d?`. Did you mean "${d}"?`:"."}`,_.USAGE)}a.push(c);continue}a.push(l)}return[...new Set(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]="eb151177-d326-5ce4-9624-87f6393046e0")}catch{}})();var gU={bug:"Issue",bugfix:"Issue",defect:"Issue",incident:"Issue",enhancement:"Feature",story:"Feature",userstory:"Feature","user-story":"Feature","user story":"Feature",change:"Chore",ticket:"Task",todo:"Task"};function yU(e){if(e!==void 0)return gU[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]="41196e9d-00c2-5473-848d-7563463c42a7")}catch{}})();function Wv(e){let t=[],r=new Set;for(let n of e)for(let o of Object.keys(n))r.has(o)||(r.add(o),t.push(o));return t}function Zf(e){return e==null?"":Array.isArray(e)?e.map(t=>Zf(t)).join(";"):typeof e=="object"?JSON.stringify(e):String(e)}function Vv(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function hU(e){if(e.length===0)return"";let t=Wv(e),r=[t.map(n=>Vv(n)).join(",")];for(let n of e)r.push(t.map(o=>Vv(Zf(n[o]))).join(","));return r.join(`
|
|
212
|
+
`));return r.length>0?r.join(","):""}function zv(e){if(e===void 0)return;if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(Array.isArray(e))return X1(e);if(typeof e!="string")return"";let t=Kf(e);return t.length>0?t.join(","):""}async function J1(e,t="--ids",r={}){if(e===void 0)return;let n=e.trim(),o=e;try{if(n==="-")o=await(r.readStdin??K1)(t);else if(n.startsWith("@")){let s=n.slice(1).trim();if(s.length===0)throw new g(`${t} @path requires a non-empty file path.`,_.USAGE,{code:"bulk_ids_input_missing_path",required:`Pass ${t} @<path>, ${t} -, or inline IDs.`});o=await(r.readFile??Y1)(s)}}catch(s){if(s instanceof g)throw s;let a=s instanceof Error?s.message:String(s);throw new g(`${t} could not read ${n==="-"?"stdin":`"${n.slice(1).trim()}"`}: ${a}`,_.NOT_FOUND,{code:"bulk_ids_input_unreadable",required:`Provide readable newline/comma-delimited IDs via ${t} -, ${t} @<path>, or inline argv text.`,nextSteps:[`Retry with inline IDs: ${t} pm-a1b2,pm-c3d4`,`Or pipe IDs: pm list --id-only | pm update-many ${t} - --dry-run`]})}let i=zv(o);if(i!=="")return i;throw new g(`${t} requires at least one non-empty item ID.`,_.USAGE,{code:"bulk_ids_input_empty",required:"Provide one or more comma- or newline-delimited IDs through argv, stdin, or @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]="44d1db57-ab29-540d-b337-443d382d0d9b")}catch{}})();function qv(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Xf(e){if(e==="/body"||e.startsWith("/body/"))return"body";if(e==="/metadata"||e.startsWith("/metadata/")||e==="/front_matter"||e.startsWith("/front_matter/")){let r=e.replace(/^\/(?:metadata|front_matter)\/?/,"").split("/")[0];return r?qv(r):"metadata"}let t=e.replace(/^\//,"").split("/")[0];return t?qv(t):"root"}function mc(e,t){return t==="body"?e.body:t==="metadata"?e.metadata:t==="root"?e:e.metadata[t]}function Z1(e,t){let r=t?.windowStartIndex??0,n=t?.field;if(e.length===0||r>=e.length)return[];let o=Xn(),i=[];for(let s=0;s<e.length;s+=1){let a=e[s],c=o,l=zt(o,a.patch),d;l.ok?(d=l.document,o=d):d=c;let u=new Set;for(let p of a.patch)u.add(Xf(p.path)),p.from!==void 0&&u.add(Xf(p.from));let f=[...u].sort((p,m)=>p.localeCompare(m));if(s>=r)if(n!==void 0){if(!u.has(n))continue;let p={field:n,before:mc(c,n),after:mc(d,n)};i.push({index:s+1,ts:a.ts,op:a.op,author:a.author,patch_ops:a.patch.length,changed_fields:[n],changes:[p]})}else{let p=f.map(m=>({field:m,before:mc(c,m),after:mc(d,m)}));i.push({index:s+1,ts:a.ts,op:a.op,author:a.author,patch_ops:a.patch.length,changed_fields:f,changes:p})}}return i}import{readFile as Q1}from"node:fs/promises";(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]="e6571e4b-c436-5af7-be01-c3fce3a9c5d3")}catch{}})();var eU=e=>Q1(e,"utf8");async function tU(e,t,r=eU){if(t!==void 0)throw new g("--body and --body-file are mutually exclusive; provide the body inline with --body or from a file with --body-file, not both.",_.USAGE,{code:"body_file_conflicts_with_body",required:"Choose exactly one body source.",why:"Both --body and --body-file set the item body; allowing both would make the effective body ambiguous.",nextSteps:["Re-run with only --body <text> or only --body-file <path>."]});let n=e.trim();if(n.length===0)throw new g("--body-file requires a file path.",_.USAGE,{code:"body_file_missing_path",required:"Pass a readable file path: --body-file <path>.",why:"An empty --body-file value has no file to read the body from."});if(n==="-")return await oo().resolveValue("-","--body-file");try{return await r(n)}catch(o){let i=o?.code,s=i==="EISDIR",a=i?` (${i})`:"";throw new g(s?`--body-file "${n}" is a directory, not a file. Point it at a readable file.`:`--body-file could not read "${n}"${a}. Check that the file exists and is readable.`,_.NOT_FOUND,{code:"body_file_unreadable",required:"Point --body-file at an existing, readable file.",why:`The body content is loaded from the file at the supplied path, so an unreadable path cannot produce a body${i?` (underlying error: ${i})`:""}.`,nextSteps:[`Verify the path: ls -l "${n}"`,"Or pipe the body with --body-file -.","Or pass the body inline with --body <text>."]})}}(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]="91874535-458b-5a33-a68a-96f44bd2e1f8")}catch{}})();var rU=new Set(["none","null","undefined"]);function ZX(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="warn"||t==="strict_error")return t;if(t==="strict")return"strict_error";throw new g("Config set parent-reference-policy requires --policy with one of: warn, strict_error (alias: strict)",_.USAGE)}function nU(e){if(typeof e!="string")throw new g("--parent must be a string. Use --unset parent to clear this field.",_.USAGE);let t=e.trim();if(t.length===0)throw new g("--parent must not be empty. Use --parent none to unset.",_.USAGE);if(Hv(t))throw new g(`--parent must not use placeholder token "${t}". Use --unset parent to clear this field.`,_.USAGE);return t}function Hv(e){return rU.has(e.trim().toLowerCase())}function oU(e,t){if(t==="strict_error")throw new g(`Parent item "${e}" was not found. Create it first or use --parent none.`,_.USAGE);return{warnings:[`validation_warning:parent_reference_missing:${e}`]}}function iU(e,t,r){let n=qt(e,r),o=qt(t,r);if(n!==o)return;let i=t!==o||e!==n?` (normalized from parent "${t}" and item "${e}")`:"";throw new g(`Parent item "${o}" cannot be the same as item "${n}"${i}. Use --unset parent to clear this field.`,_.USAGE)}(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]="b0306587-b3bb-5f82-bb56-7939d1976870")}catch{}})();var Jf={critical:0,high:1,medium:2,low:3,minimal:4},sU=Object.keys(Jf),aU=`numbers 0..4 (0=critical, 1=high, 2=medium, 3=low, 4=minimal) or names (${sU.join(", ")}), case-insensitive`;function _c(e){return new g(`Invalid priority "${e}". Accepted values: ${aU}.`,_.USAGE)}function cU(e){if(typeof e=="number"){if(Number.isInteger(e)&&e>=0&&e<=4)return e;throw _c(String(e))}if(typeof e!="string")throw _c(String(e));let t=e.trim();if(t.length===0)throw _c(e);let r=t.toLowerCase();if(Object.prototype.hasOwnProperty.call(Jf,r))return Jf[r];if(/^[0-4]$/.test(t))return Number(t);throw _c(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]="bfb46357-04de-55a0-b132-779c153314de")}catch{}})();var lU=/^[A-Za-z0-9][A-Za-z0-9._/-]*$/,dU=64;function iJ(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="warn"||t==="strict_error")return t;if(t==="strict")return"strict_error";throw new g("Config set sprint-release-format-policy requires --policy with one of: warn, strict_error (alias: strict)",_.USAGE)}function uU(e,t,r){let n=t.trim();if(n.length===0)throw new g(`--${e} must not be empty. Use --${e} none to unset.`,_.USAGE);if(n.length<=dU&&lU.test(n))return{value:n,warnings:[]};let i="Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._/-]* (no spaces).";if(r==="strict_error")throw new g(`Invalid --${e} value "${n}". ${i}`,_.USAGE);return{value:n,warnings:[`validation_warning:${e}_format:${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]="0eff4d63-2691-5130-bc12-4957218393b5")}catch{}})();var Gv={open:"open_status",closed:"close_status",canceled:"canceled_status",cancelled:"canceled_status"},Bv="all";function uJ(e){if(typeof e!="string")return!1;let t=e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r.length>0);return t.length===1&&t[0]===Bv}function fU(e,t){let r=e.trim().toLowerCase();if(r.length===0)return;let n=Gv[r];return n?t[n]:zr(e,t)}function pU(e){let t=new Set(Object.keys(Gv));for(let r of e.definitions){t.add(r.id);for(let n of r.aliases)t.add(n)}return[...t]}function mU(e,t){let r=e.trim().toLowerCase(),n,o=Number.POSITIVE_INFINITY;for(let i of pU(t)){let s=ot(r,i.toLowerCase(),2);s!==null&&s<o&&(n=i,o=s)}return n}function _U(e,t,r){if(typeof e!="string")return;let n=r?.strict===!0,o=r?.flagLabel??"--status",i=e.split(",").map(c=>c.trim()).filter(c=>c.length>0);if(i.length===0)return;if(i.filter(c=>c.trim().toLowerCase()===Bv).length>0){if(i.length===1)return;throw new g(`Invalid ${o} value "all". Use it by itself, or omit ${o} to search every status.`,_.USAGE)}let a=[];for(let c of i){let l=fU(c,t);if(l===void 0){if(n){let d=mU(c,t);throw new g(`Invalid ${o} value "${c}". Use open|closed|canceled or a configured status id${d?`. Did you mean "${d}"?`:"."}`,_.USAGE)}a.push(c);continue}a.push(l)}return[...new Set(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]="eb151177-d326-5ce4-9624-87f6393046e0")}catch{}})();var gU={bug:"Issue",bugfix:"Issue",defect:"Issue",incident:"Issue",enhancement:"Feature",story:"Feature",userstory:"Feature","user-story":"Feature","user story":"Feature",change:"Chore",ticket:"Task",todo:"Task"};function yU(e){if(e!==void 0)return gU[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]="41196e9d-00c2-5473-848d-7563463c42a7")}catch{}})();function Wv(e){let t=[],r=new Set;for(let n of e)for(let o of Object.keys(n))r.has(o)||(r.add(o),t.push(o));return t}function Zf(e){return e==null?"":Array.isArray(e)?e.map(t=>Zf(t)).join(";"):typeof e=="object"?JSON.stringify(e):String(e)}function Vv(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function hU(e){if(e.length===0)return"";let t=Wv(e),r=[t.map(n=>Vv(n)).join(",")];for(let n of e)r.push(t.map(o=>Vv(Zf(n[o]))).join(","));return r.join(`
|
|
213
213
|
`)}function bU(e){if(e.length===0)return"";let t=Wv(e),r=e.map(s=>t.map(a=>Zf(s[a]))),n=t.map((s,a)=>Math.max(s.length,...r.map(c=>c[a].length))),o=(s,a)=>s.padEnd(n[a]),i=[t.map((s,a)=>o(s,a)).join(" | ")];i.push(n.map(s=>"-".repeat(s)).join("-+-"));for(let s of r)i.push(s.map((a,c)=>o(a,c)).join(" | "));return i.join(`
|
|
214
214
|
`)}(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]="df9abedd-6e84-5712-8e5e-4e510ec3ed60")}catch{}})();function wU(e,t="--limit"){if(e===void 0)return;let r=Number(e);if(!Number.isFinite(r)||r<0)throw new g(`${t} must be a non-negative number`,_.USAGE);return Math.floor(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]="24688724-53cd-5375-ae7e-cfe098cd0dc8")}catch{}})();var vU=new Map(hn.map(e=>[e.toLowerCase(),e])),EU=/^[A-Za-z][A-Za-z0-9_-]*$/;function Yv(e,t){if(!EU.test(e))throw new Error(`${t} "${e}" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. "Spike" or "code-review").`)}function Qf(e){return vU.get(e.trim().toLowerCase())}function Jv(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function TU(e){return e.replace(/[\\"`$]/g,t=>`\\${t}`)}function Zv(e){let t=new Map;for(let r of e){let n=r.trim();if(n.length===0)continue;let o=n.toLowerCase();t.has(o)||t.set(o,n)}return[...t.values()].sort((r,n)=>r.localeCompare(n))}function wJ(e){let t=(e.name??"").trim();if(t.length===0)throw new Error("Type name must not be empty.");Yv(t,"Type name");let r=Qf(t);if(r)throw new Error(`Cannot redefine built-in item type "${r}". Built-in types are reserved: ${hn.join(", ")}.`);let n=e.description?.trim(),o=e.defaultStatus?.trim(),i=e.folder?.trim(),s=i&&i.length>0?vs(i):void 0,a=Zv(e.aliases??[]);for(let c of a){Yv(c,"Alias");let l=Qf(c);if(l)throw new Error(`Alias "${c}" collides with built-in item type "${l}". Built-in types are reserved: ${hn.join(", ")}.`)}return{name:t,description:n&&n.length>0?n:void 0,defaultStatus:o&&o.length>0?o:void 0,folder:s,aliases:a}}function vJ(e,t){let r=e.name.toLowerCase(),n=new Map;for(let i of t.definitions){if(typeof i.name!="string")continue;let s=i.name.trim();if(!(s.length===0||s.toLowerCase()===r)){n.set(s.toLowerCase(),s);for(let a of Jv(i.aliases))a.trim().length>0&&n.set(a.trim().toLowerCase(),s)}}let o=n.get(r);if(o)throw new Error(`Type name "${e.name}" collides with an alias of existing item type "${o}".`);for(let i of e.aliases){let s=n.get(i.toLowerCase());if(s)throw new Error(`Alias "${i}" already maps to existing item type "${s}".`)}}function Kv(e,t){return typeof t=="string"&&t.trim().length>0?vs(t).toLowerCase():ko(e).toLowerCase()}function EJ(e,t,r){let n=e.name.toLowerCase(),o=Kv(e.name,e.folder),i=a=>{throw new Error(`Item type "${e.name}" would store items in folder "${o}", which already belongs to existing item type "${a}". Pass a distinct --folder to keep their storage separate.`)};for(let a of t.definitions){if(typeof a.name!="string")continue;let c=a.name.trim();c.length===0||c.toLowerCase()===n||Kv(c,a.folder)===o&&i(c)}let s=r?.get(o);s!==void 0&&s.toLowerCase()!==n&&i(s)}function TJ(e){if(e==null||e.trim().length===0)return{definitions:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/types.json contains invalid JSON.")}return{definitions:kU(t)}}function kU(e){let t=AU(e);if(!t)return[];let r=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let o=n;typeof o.name!="string"||o.name.trim().length===0||r.push(o)}return r}function AU(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function kJ(e,t){let r=t.name.toLowerCase(),n=e.definitions.slice(),o=n.findIndex(c=>typeof c.name=="string"&&c.name.trim().toLowerCase()===r),i=o>=0?n[o]:void 0,s=Zv([...Jv(i?.aliases),...t.aliases]),a={...i,name:t.name};return t.folder!==void 0&&(a.folder=t.folder),s.length>0?a.aliases=s:a.aliases!==void 0&&delete a.aliases,Xv(a,"description",t.description),Xv(a,"default_status",t.defaultStatus),o>=0?n[o]=a:n.push(a),n.sort((c,l)=>c.name.localeCompare(l.name)),{file:{definitions:n},definition:a,replaced:o>=0,...i&&typeof i.name=="string"?{previousName:i.name}:{}}}function AJ(e,t){let r=(t??"").trim();if(r.length===0)throw new Error("Type name must not be empty.");let n=Qf(r);if(n)throw new Error(`Cannot remove built-in item type "${n}". Built-in types are reserved: ${hn.join(", ")}.`);let o=r.toLowerCase(),i=e.definitions.slice(),s=i.findIndex(c=>typeof c.name=="string"&&c.name.trim().toLowerCase()===o);if(s<0)return{file:{definitions:i},removed:!1};let[a]=i.splice(s,1);return{file:{definitions:i},removed:!0,definition:a}}function Xv(e,t,r){let n=e;r!==void 0&&(n[t]=r)}function SJ(e){return`${JSON.stringify({definitions:e.definitions},null,2)}
|
|
215
|
-
`}function SU(e,t){let r=e.trim().length>0?e.trim():e,n=t?.trim()||".agents/pm/schema/types.json";return`To register a custom type, run: pm schema add-type "${TU(r)}" (writes ${n}).`}function OU(e,t,r){return`Invalid type value "${e}". Allowed: ${t.join(", ")}. ${SU(e,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]="7778b388-1b28-53e7-a06e-ef6441b0ed68")}catch{}})();function Qv(e,t){return ne(e,t)}function CU(e,t,r){let n={};for(let o of t.command_to_fields.get(r)??[]){let i=_a(e,o);i!==void 0&&(n[o.metadata_key]=Ur(o,i))}return n}function IU(e,t){for(let[r,n]of Object.entries(t)){let o=e[r];if(Array.isArray(n)){if(Array.isArray(o)){let i=o.map(a=>String(a));if(!n.map(a=>String(a)).every(a=>i.includes(a)))return!1;continue}if(!Qv(o,n[n.length-1]))return!1;continue}if(!Qv(o,n))return!1}return!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]="
|
|
215
|
+
`}function SU(e,t){let r=e.trim().length>0?e.trim():e,n=t?.trim()||".agents/pm/schema/types.json";return`To register a custom type, run: pm schema add-type "${TU(r)}" (writes ${n}).`}function OU(e,t,r){return`Invalid type value "${e}". Allowed: ${t.join(", ")}. ${SU(e,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]="7778b388-1b28-53e7-a06e-ef6441b0ed68")}catch{}})();function Qv(e,t){return ne(e,t)}function CU(e,t,r){let n={};for(let o of t.command_to_fields.get(r)??[]){let i=_a(e,o);i!==void 0&&(n[o.metadata_key]=Ur(o,i))}return n}function IU(e,t){for(let[r,n]of Object.entries(t)){let o=e[r];if(Array.isArray(n)){if(Array.isArray(o)){let i=o.map(a=>String(a));if(!n.map(a=>String(a)).every(a=>i.includes(a)))return!1;continue}if(!Qv(o,n[n.length-1]))return!1;continue}if(!Qv(o,n))return!1}return!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]="ef20c613-623c-5a11-8384-ccf4ee3addde")}catch{}})();function eE(e){return typeof e=="string"?e.trim().toLowerCase():""}function gc(e,t){let r=Ue(e);return r.length===0?"":t?.alias_to_id?.get(r)??r}function RU(e){let t=Array.isArray(e?.type_workflows)?e.type_workflows:[],r=new Map;for(let n of t){let o=eE(n?.type);if(o.length===0||!Array.isArray(n?.allowed_transitions))continue;let i=n.allowed_transitions,s=r.get(o)??{pairs:[],denyAll:!1};i.length===0&&(s.denyAll=!0);for(let a of i){if(!Array.isArray(a)||a.length!==2)continue;let c=Ue(a[0]),l=Ue(a[1]);c.length===0||l.length===0||s.pairs.some(d=>d[0]===c&&d[1]===l)||s.pairs.push([c,l])}r.set(o,s)}return[...r.entries()].filter(([,n])=>n.pairs.length>0||n.denyAll).map(([n,o])=>({type:n,allowed_transitions:o.pairs})).sort((n,o)=>n.type.localeCompare(o.type))}function xU(e){let t=eE(e.typeName),r=e.typeWorkflows.find(s=>s.type===t);if(!r)return{allowed:!0,hasRule:!1,allowedTransitions:[]};let n=gc(e.fromStatus,e.statusRegistry),o=gc(e.toStatus,e.statusRegistry);return n.length>0&&n===o?{allowed:!0,hasRule:!0,allowedTransitions:r.allowed_transitions}:{allowed:r.allowed_transitions.some(s=>{let a=gc(s[0],e.statusRegistry),c=gc(s[1],e.statusRegistry);return a===n&&c===o}),hasRule:!0,allowedTransitions:r.allowed_transitions}}function NU(e){return e.length===0?"(no transitions allowed)":e.map(t=>`${t[0]} -> ${t[1]}`).join(", ")}import{spawnSync as rE}from"node:child_process";(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]="02a573c3-251d-5f42-abcc-63b5aa263aa1")}catch{}})();var DU="PM_DISABLE_OLLAMA_AUTO_DEFAULTS",PU="PM_OLLAMA_MODEL",MU="http://localhost:11434",LU="qwen3-embedding:0.6b",FU=".agents/pm/search/lancedb/",$U=1500,jU=2500,UU=/qwen.*(?:embed|embedding)|(?:embed|embedding).*qwen/i,zU=/embed|embedding/i,Et=j;function qU(){let e=Et(process.env[DU]);if(!e)return!1;let t=e.toLowerCase();return t==="1"||t==="true"||t==="yes"}function tE(e){return e.some(t=>Et(t)!==null)}function HU(e){let t=Et(e);return!!(t&&t.toLowerCase()!=="ollama")}function GU(e){let t=Et(e);return!!(t&&t.toLowerCase()!=="lancedb")}function BU(e){return HU(e.search?.provider)||GU(e.vector_store?.adapter)||tE([e.providers?.openai?.base_url,e.providers?.openai?.model,e.providers?.openai?.api_key])?!0:tE([e.vector_store?.qdrant?.url,e.vector_store?.qdrant?.api_key])}function VU(){let e=rE("ollama",["--version"],{encoding:"utf8",timeout:$U});return e.error?!1:e.status===0}function WU(e){let t=e.split(/\r?\n/).map(i=>i.trim()).filter(i=>i.length>0);if(t.length===0)return null;let r=t.map(i=>i.split(/\s+/)[0]?.trim()).filter(i=>!!(i&&i.length>0)).filter(i=>i.toUpperCase()!=="NAME");if(r.length===0)return null;let n=r.find(i=>UU.test(i));return n||(r.find(i=>zU.test(i))??null)}function YU(e){let t=Et(e.providers?.ollama?.model);if(t)return t;let r=Et(process.env[PU]);if(r)return r;let n=rE("ollama",["list"],{encoding:"utf8",timeout:jU});if(!n.error&&n.status===0){let o=WU(typeof n.stdout=="string"?n.stdout:"");if(o)return o}return null}function KU(e){return{baseUrl:Et(e.providers?.ollama?.base_url)===null,model:Et(e.providers?.ollama?.model)===null,lancedbPath:Et(e.vector_store?.lancedb?.path)===null,embeddingModel:Et(e.search?.embedding_model)===null}}function XU(e){return e.baseUrl||e.model||e.lancedbPath||e.embeddingModel}function JU(e,t,r){if(!t.baseUrl&&!t.model)return;let n=e.providers??={},o=n.ollama??={};t.baseUrl&&(o.base_url=MU),t.model&&(o.model=r)}function ZU(e,t){if(!t.lancedbPath)return;let r=e.vector_store??={},n=r.lancedb??={};n.path=FU}function QU(e,t,r){if(!t.embeddingModel)return;let n=e.search??={};n.embedding_model=r}function io(e){let t={settings:e,auto_ollama_defaults_applied:!1};if(qU()||BU(e))return t;let r=KU(e);if(!XU(r)||r.model&&!VU())return t;let n=structuredClone(e),o=YU(n);return o?(JU(n,r,o),ZU(n,r),QU(n,r,o),{settings:n,auto_ollama_defaults_applied:!0}):{...t,auto_ollama_defaults_skipped_reason:"no_installed_embedding_model",auto_ollama_defaults_remediation:`Run ollama pull ${LU} or configure providers.ollama.model explicitly (and search.embedding_model if you need an override).`}}import{spawn as ez}from"node:child_process";import{mkdirSync as nE,rmSync as iE,statSync as tz}from"node:fs";import yc 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]="22112449-f1ab-5b6b-a9bb-37e5d3c5b83a")}catch{}})();var sE="reindex",rz="search/pending-refresh.json",nz="search/pending-refresh.gate.lock",oz=3e4,iz="PM_SEARCH_REFRESH_INLINE",aE="PM_SEARCH_REFRESH_CHILD",sz=3e4;function oE(e){if(typeof e!="string")return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"||t==="yes"||t==="on"}function tp(){if(oE(process.env[iz])||oE(process.env[aE]))return!0;let e=(process.env.NODE_ENV??"").trim().toLowerCase();return typeof process.env.VITEST=="string"||typeof process.env.VITEST_WORKER_ID=="string"||e==="test"}function cE(e){return yc.join(e,rz)}function lE(e){return yc.join(e,nz)}function az(e){let t=lE(e);try{if(Date.now()-tz(t).mtimeMs<oz)return!1;iE(t,{recursive:!0,force:!0})}catch{}try{return nE(yc.dirname(t),{recursive:!0}),nE(t),!0}catch{return!1}}function cz(e){try{iE(lE(e),{recursive:!0,force:!0})}catch{}}async function dE(e,t,r){for(let n=0;n<50;n+=1){if(az(e))try{return await t()}finally{cz(e)}await lz(20)}return r}function lz(e){return new Promise(t=>{setTimeout(t,e)})}async function rp(e){let t=await G(cE(e));if(!t||t.trim().length===0)return[];try{let r=JSON.parse(t);return Array.isArray(r.ids)?r.ids.filter(n=>typeof n=="string"&&n.length>0):[]}catch{return[]}}async function uE(e,t){await z(cE(e),`${JSON.stringify({ids:t})}
|
|
216
216
|
`)}async function ep(e,t){let r=t.filter(i=>typeof i=="string"&&i.trim().length>0);if(r.length===0)return;let n=async()=>{let i=await rp(e),s=[...new Set([...i,...r])].sort((a,c)=>a.localeCompare(c));await uE(e,s)};await dE(e,async()=>(await n(),!0),!1)||await n()}async function dz(e){return dE(e,async()=>{let t=await rp(e);return t.length>0&&await uE(e,[]),t},[])}function uz(){return yc.join(Ct(import.meta.url,["../../.."]),"dist","cli","search-refresh.js")}function np(e){try{let t=ez(process.execPath,[uz()],{detached:!0,stdio:"ignore",env:{...process.env,PM_PATH:e,[aE]:"1"}});t.on("error",()=>{}),t.unref()}catch{}}function fz(e){setTimeout(()=>np(e),sz)}async function fE(e,t){await ep(e,t),np(e)}async function WJ(e,t,r=fz){let n=[],o=[];if(!await re(e))return{processed:o,rounds:0,warnings:n};let i;try{let u=await hr(e),f=u.warnings.find(p=>p.startsWith("settings_read_"));if(f)return r(e),{processed:o,rounds:0,warnings:[`search_background_refresh_settings_read_failed:${f}`]};i=io(u.settings).settings}catch(u){return r(e),{processed:o,rounds:0,warnings:[`search_background_refresh_settings_read_failed:${B(u)}`]}}let s=null;try{s=await oe(e,sE,i.locks.ttl_seconds,mi(void 0,"pm-search-refresh"),!1,i.governance.force_required_for_stale_lock,i.locks.wait_ms)}catch{}if(!s)return{processed:o,rounds:0,warnings:n};let a=0,c=!1,l=!1;try{for(;;){let u=await dz(e);if(u.length===0)break;a+=1;try{let f=await t(e,u);if(n.push(...f.warnings),f.warnings.some(p=>p.startsWith("search_semantic_refresh_skipped:settings_read_failed:"))){await ep(e,u),c=!0,l=!0;break}o.push(...f.refreshed)}catch(f){n.push(`search_background_refresh_failed:${B(f)}`),await ep(e,u),c=!0;break}}}finally{await s?.()}return l&&r(e),(c?[]:await rp(e)).length>0&&np(e),{processed:[...new Set(o)].sort((u,f)=>u.localeCompare(f)),rounds:a,warnings: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]="74cee8e6-1785-50f4-94d8-fc0b29055dc2")}catch{}})();var pz=3e4;function en(e,t,r=pz){let n=e??r;if(!Number.isFinite(n)||n<=0)throw new Error(`${t} timeout must be a positive finite number`);return Math.floor(n)}function tn(e,t){if(e)return e;if(typeof globalThis.fetch=="function")return globalThis.fetch.bind(globalThis);throw new Error(`${t} execution requires a fetch implementation`)}async function mz(e){try{return(await e.text()).replaceAll(/\s+/g," ").trim()}catch(t){return`(failed to read response body: ${B(t)})`}}async function hc(e){let t=new AbortController,r=setTimeout(()=>{t.abort()},e.timeoutMs);try{let n;try{n=await e.fetcher(e.endpoint,{method:e.method,headers:e.headers,body:JSON.stringify(e.body),signal:t.signal})}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error(`${e.requestLabel} timed out after ${e.timeoutMs}ms`):new Error(`${e.requestLabel} execution failed: ${B(o)}`)}if(!n.ok){let o=await mz(n),i=o.length>0?`: ${o}`:"";throw new Error(`${e.requestLabel} failed with status ${n.status} ${n.statusText}${i}`)}try{return await n.json()}catch(o){throw new Error(`${e.responseLabel} JSON parse failed: ${B(o)}`)}}finally{clearTimeout(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]="2c36f008-53c4-5ee7-bc87-6bfb7aeb8f42")}catch{}})();function QJ(e,t){let r=j(e);if(!r)return"unconfigured";let n=j(t);return n&&n.toLowerCase()===r.toLowerCase()?"configured":"auto-detected"}function _z(e){let t=vo(e),r=t.toLowerCase();return r.endsWith("/embeddings")?t:r.endsWith("/v1")?`${t}/embeddings`:`${t}/v1/embeddings`}function mE(e){let t=e.search?.embedding_model;return j(t)||null}function gz(e){let t=j(e.providers?.openai?.base_url),r=j(e.providers?.openai?.model);if(!t||!r)return null;let n=mE(e),o=j(e.providers?.openai?.api_key);return{name:"openai",base_url:t,model:n??r,...o?{api_key:o}:{}}}function yz(e){let t=j(e.providers?.ollama?.base_url),r=j(e.providers?.ollama?.model);if(!t||!r)return null;let n=mE(e);return{name:"ollama",base_url:t,model:n??r}}function _E(e){let t=(Array.isArray(e)?e:[e]).map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)throw new Error("Embedding input must include at least one non-empty string");return t}function hz(e){let t=[],r=[],n=new Map;for(let o of e){let i=n.get(o);if(i===void 0){let s=t.length;t.push(o),n.set(o,s),r.push(s);continue}r.push(i)}return{uniqueInputs:t,originalToUniqueIndex:r}}function bz(e){let t=e.map((n,o)=>({embedding:n.embedding,index:n.index,position:o}));if(t.some(n=>n.index!==void 0)){for(let n of t)if(!Number.isInteger(n.index))throw new TypeError(`OpenAI embedding response entry at position ${n.position} is missing a valid integer index`);return[...t].sort((n,o)=>{let i=n.index-o.index;return i!==0?i:n.position-o.position})}return t}function bc(e){let t=gz(e),r=yz(e),n=[t,r].filter(a=>a!==null),o=j(e.search?.provider),i=o?o.toLowerCase():null;return{active:(i?n.find(a=>a.name===i):void 0)??n[0]??null,available:n}}function pE(e){let t=vo(e.base_url);return e.name==="openai"?{provider:"openai",endpoint:_z(t),model:e.model}:{provider:"ollama",endpoint:`${t}/api/embed`,model:e.model}}function wz(e,t){let r=_E(t);return e.name==="openai"?{target:pE(e),method:"POST",headers:{"content-type":"application/json",...e.api_key?{authorization:`Bearer ${e.api_key}`}:{}},body:{model:e.model,input:r.length===1?r[0]:r}}:{target:pE(e),method:"POST",headers:{"content-type":"application/json"},body:{model:e.model,input:r}}}function vz(e,t){if(e.name==="openai"){let o=t.data;if(!Array.isArray(o)||o.length===0)throw new Error("OpenAI embedding response must include a non-empty data array");return bz(o).map((s,a)=>{let c=s.embedding;if(!_n(c))throw new Error(`OpenAI embedding response entry at index ${a} is missing a numeric embedding vector`);return[...c]})}let r=t.embedding;if(_n(r))return[[...r]];let n=t.embeddings;if(Array.isArray(n)&&n.length>0)return n.map((o,i)=>{if(!_n(o))throw new Error(`Ollama embedding response entry at index ${i} is missing a numeric embedding vector`);return[...o]});throw new Error("Ollama embedding response must include embedding or embeddings vectors")}async function gE(e,t,r={}){let n=en(r.timeout_ms,"Embedding request"),o=tn(r.fetcher,"Embedding request"),i=_E(t),s=hz(i),a=wz(e,s.uniqueInputs),c=await hc({endpoint:a.target.endpoint,method:a.method,headers:a.headers,body:a.body,timeoutMs:n,fetcher:o,requestLabel:"Embedding request",responseLabel:"Embedding response"}),l=vz(e,c);if(l.length!==s.uniqueInputs.length)throw new Error(`Embedding response cardinality mismatch: expected ${s.uniqueInputs.length} vector(s), received ${l.length}`);return s.originalToUniqueIndex.map(d=>[...l[d]])}(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]="16c567d7-0065-5401-a768-0913cec6d5f4")}catch{}})();var wc=["title","description","tags","status","type","priority","assignee","parent","goal","value","why_now","risk","confidence","estimated_minutes","acceptance_criteria","resolution","expected_result","actual_result","body","comments","notes","learnings","reminders","events","dependencies","plan"];function op(e){let t=e?.search?.corpus_fields;if(!Array.isArray(t))return[...wc];let r=new Set(wc),n=Array.from(new Set(t.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0&&r.has(o))));return n.length>0?n:[...wc]}var Ez=8e3,ip=3200,rn="...[semantic corpus truncated]",Tz="search_embedding_corpus_max_characters_invalid:using_provider_default";function kt(e){return e.map(t=>t==null?"":String(t).trim()).filter(t=>t.length>0).join(" ")}function kz(e){return(e.reminders??[]).map(t=>kt([t.at,t.text]))}function Az(e){return(e.events??[]).map(t=>kt([t.start_at,t.end_at,t.title,t.description,t.location,t.all_day===!0?"all day":void 0,t.timezone,t.recurrence?.freq,t.recurrence?.interval,t.recurrence?.count,t.recurrence?.until,t.recurrence?.by_weekday?.join(" "),t.recurrence?.by_month_day?.join(" "),t.recurrence?.exdates?.join(" ")]))}function Sz(e,t){e.push(t.title,t.body,t.status,t.owner,t.evidence,t.blocked_reason,t.superseded_by);for(let r of t.linked_items??[])e.push(`${r.kind} ${r.id}`,r.note);for(let r of t.files??[])e.push(r.path,r.note);for(let r of t.tests??[])e.push(r.command,r.path,r.note);for(let r of t.docs??[])e.push(r.path,r.note)}function Oz(e,t){for(let r of t.plan_decisions??[])e.push(r.decision,r.rationale,r.evidence);for(let r of t.plan_discoveries??[])e.push(r.text);for(let r of t.plan_validation??[])e.push(r.text,r.command,r.expected)}function rZ(e){let t=[];t.push(e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context);for(let r of e.plan_steps??[])Sz(t,r);return Oz(t,e),t.filter(r=>typeof r=="string"&&r.length>0).join(" ")}function Cz(e){let t=(e.plan_steps??[]).map(s=>kt([s.order,s.id,s.title,s.body,s.status,s.owner,s.evidence,s.blocked_reason,s.superseded_by,(s.linked_items??[]).map(a=>kt([a.kind,a.id,a.note])).join(" "),(s.files??[]).map(a=>kt([a.path,a.note])).join(" "),(s.tests??[]).map(a=>kt([a.command,a.path,a.note])).join(" "),(s.docs??[]).map(a=>kt([a.path,a.note])).join(" ")])),r=(e.plan_decisions??[]).map(s=>kt([s.decision,s.rationale,s.evidence,s.step_id])),n=(e.plan_discoveries??[]).map(s=>kt([s.text,s.step_id])),o=(e.plan_validation??[]).map(s=>kt([s.text,s.command,s.expected]));if([e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context,...t,...r,...n,...o].some(s=>s!==void 0))return{mode:e.plan_mode,scope:e.plan_scope,harness:e.plan_harness,resume_context:e.plan_resume_context,steps:t,decisions:r,discoveries:n,validation:o}}function Tt(e){return typeof e=="string"&&e.trim().length>0}var Iz={title:e=>e.metadata.title,description:e=>e.metadata.description,tags:e=>e.metadata.tags,status:e=>e.metadata.status,type:e=>e.metadata.type,priority:e=>typeof e.metadata.priority=="number"?e.metadata.priority:void 0,assignee:e=>Tt(e.metadata.assignee)?e.metadata.assignee:void 0,parent:e=>Tt(e.metadata.parent)?e.metadata.parent:void 0,goal:e=>Tt(e.metadata.goal)?e.metadata.goal:void 0,value:e=>Tt(e.metadata.value)?e.metadata.value:void 0,why_now:e=>Tt(e.metadata.why_now)?e.metadata.why_now:void 0,risk:e=>Tt(e.metadata.risk)?e.metadata.risk:void 0,confidence:e=>e.metadata.confidence!==void 0&&e.metadata.confidence!==null?e.metadata.confidence:void 0,estimated_minutes:e=>typeof e.metadata.estimated_minutes=="number"?e.metadata.estimated_minutes:void 0,acceptance_criteria:e=>Tt(e.metadata.acceptance_criteria)?e.metadata.acceptance_criteria:void 0,resolution:e=>Tt(e.metadata.resolution)?e.metadata.resolution:void 0,expected_result:e=>Tt(e.metadata.expected_result)?e.metadata.expected_result:void 0,actual_result:e=>Tt(e.metadata.actual_result)?e.metadata.actual_result:void 0,body:e=>e.body,comments:e=>(e.metadata.comments??[]).map(t=>t.text),notes:e=>(e.metadata.notes??[]).map(t=>t.text),learnings:e=>(e.metadata.learnings??[]).map(t=>t.text),reminders:e=>kz(e.metadata),events:e=>Az(e.metadata),dependencies:e=>(e.metadata.dependencies??[]).map(t=>({id:t.id,kind:t.kind})),plan:e=>Cz(e.metadata)};function yE(e,t={}){let r=t.fields??wc,n={};for(let o of r){let i=Iz[o];if(!i)continue;let s=i(e);s!==void 0&&(n[o]=s)}return n}function Rz(e){return e?.trim().toLowerCase()==="ollama"?ip:Ez}function so(e,t){let r=Rz(e),n=Bm(t);return n!==null?{maxCharacters:n,warning:null}:{maxCharacters:r,warning:t==null?null:Tz}}function sp(e,t={}){let r=JSON.stringify(yE(e,{fields:t.fields})),n=so(t.providerName,t.maxCharacters).maxCharacters;if(r.length<=n)return r;if(n<=rn.length)return rn.slice(0,n);let o=Math.max(0,n-rn.length);return`${r.slice(0,o)}${rn}`}(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]="f0edf7da-87cc-5e66-9f9f-c9a25e21808e")}catch{}})();function xz(e,t){let r=e.search.embedding_batch_size,n=e.search.embedding_timeout_ms,o=e.search.scanner_max_batch_retries,i=Number.isFinite(r)&&r>0?Math.floor(r):1,s=Number.isFinite(n)&&n>0?Math.floor(n):3e4,a=Number.isFinite(o)&&o>=0?Math.floor(o):0;return{batchSize:i,timeoutMs:s,maxRetries:a,maxBatchInputCharacters:Number.POSITIVE_INFINITY,maxInputCharacters:t}}function Nz(e,t,r){let n=[],o=[],i=0;for(let s of e){let a=o.length>=t,c=o.length>0&&Number.isFinite(r)&&i+s.length>r;(a||c)&&(n.push(o),o=[],i=0),o.push(s),i+=s.length}return n.push(o),n}function Dz(e,t){return e.name!=="ollama"?t:{...t,maxBatchInputCharacters:ip}}function Pz(e,t){if(!Number.isFinite(t)||t<=0||e.length<=t)return e;let r=Math.max(0,t-rn.length);return`${e.slice(0,r)}${rn}`.slice(0,t)}function hE(e){let t=B(e).toLowerCase();return t.includes("timed out")||t.includes("timeout")}function Mz(e,t,r,n,o,i){let s=`Embedding batch ${t} failed after ${o} attempt(s): ${B(i)}`,a=`provider=${e.name} model=${e.model} batch_size=${r} timeout_ms=${n}`;return hE(i)?`${s} (${a}; guidance=check provider availability or lower search.embedding_batch_size, raise search.embedding_timeout_ms, or run keyword search while semantic indexing catches up)`:`${s} (${a})`}async function ap(e,t,r,n,o,i){let s=null;for(let a=0;a<=o;a+=1)try{let c=await gE(e,t,{timeout_ms:n});return a>0&&i.push(`search_embedding_batch_retry_succeeded:batch=${r}:attempt=${a+1}:size=${t.length}`),c}catch(c){if(s=c,hE(c)&&t.length>1){let l=Math.ceil(t.length/2),d=t.slice(0,l),u=t.slice(l);return i.push(`search_embedding_batch_split_after_timeout:batch=${r}:size=${t.length}:parts=${d.length}|${u.length}`),[...await ap(e,d,`${r}.1`,n,o,i),...await ap(e,u,`${r}.2`,n,o,i)]}if(a<o){let l=Math.min(1e3*2**a,8e3);await new Promise(d=>setTimeout(d,l))}}throw new Error(Mz(e,r,t.length,n,o+1,s))}async function cp(e,t,r,n={}){if(r.length===0)return{vectors:[],warnings:[]};let o=[],i=so(e.name,t.search.embedding_corpus_max_characters);i.warning&&o.push(i.warning);let s=Dz(e,xz(t,i.maxCharacters)),a=0,c=r.map(f=>{let p=Pz(f,s.maxInputCharacters);return p.length<f.length&&(a+=1),p});a>0&&o.push(`search_embedding_input_truncated:count=${a}:max_characters=${s.maxInputCharacters}`);let l=Nz(c,s.batchSize,s.maxBatchInputCharacters),d=[],u=0;for(let f=0;f<l.length;f+=1){let p=l[f];n.onProgress?.({batch_index:f+1,batch_total:l.length,batch_size:p.length,completed_inputs:u,total_inputs:c.length,phase:"start"}),d.push(...await ap(e,p,String(f+1),s.timeoutMs,s.maxRetries,o)),u+=p.length,n.onProgress?.({batch_index:f+1,batch_total:l.length,batch_size:p.length,completed_inputs:u,total_inputs:c.length,phase:"complete"})}return{vectors:d,warnings:o}}import{mkdir as Lz,readFile as Fz,stat as up,unlink as $z}from"node:fs/promises";import{basename as bE,dirname as lp,isAbsolute as jz,join as Uz,resolve as fp}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]="887ac66e-679f-5a07-a6a2-8a19a4007198")}catch{}})();var pp="pm_items",zz=/[^a-zA-Z0-9_-]/g,qz=128,Hz=".pm-cli-local-vectors",dp=1,nn=new Map;function Li(e){return(j(e.collection_name)??pp).replaceAll(zz,"_").slice(0,qz)}function vc(e){if(!_n(e)||e.length===0)throw new Error("Vector values must be a non-empty numeric array");return[...e]}function vE(e){if(!Number.isFinite(e)||e<=0)throw new Error("Vector query limit must be a positive number");return Math.floor(e)}function Gz(e){let t=e.result;if(!Array.isArray(t))throw new TypeError("Qdrant query response must include a result array");let r=t.map((n,o)=>{let i=n.id,s=typeof i=="number"?String(i):i,a=j(s);if(!a)throw new Error(`Qdrant query response entry at index ${o} is missing a non-empty id`);let c=n.score;if(typeof c!="number"||!Number.isFinite(c))throw new TypeError(`Qdrant query response entry at index ${o} is missing a finite numeric score`);let l=n.payload;if(l!==void 0&&(typeof l!="object"||l===null||Array.isArray(l)))throw new Error(`Qdrant query response entry at index ${o} must provide payload as an object when set`);return{id:a,score:c,...l?{payload:l}:{}}});return r.sort((n,o)=>n.score!==o.score?o.score-n.score:n.id.localeCompare(o.id)),r}function mp(e){let t=j(e.result?.status);if(t)return{status:t};let r=j(e.status);if(r)return{status:r};throw new Error("Qdrant upsert response must include status metadata")}async function Mi(e,t,r,n,o){return await hc({endpoint:e,method:t.method,headers:t.headers,body:t.body,timeoutMs:r,fetcher:n,requestLabel:`Vector ${o} request`,responseLabel:`Vector ${o} response`})}function Bz(e){let t=j(e.vector_store?.qdrant?.url);if(!t)return null;let r=j(e.vector_store?.collection_name),n=j(e.vector_store?.qdrant?.api_key);return{name:"qdrant",url:t,...r&&r!==pp?{collection_name:r}:{},...n?{api_key:n}:{}}}function Vz(e){let t=fp(e),r=lp(t);return bE(t)==="pm"&&bE(r)===".agents"?lp(r):t}function Wz(e,t){return!t||jz(e)?e:fp(Vz(t),e)}function Yz(e,t){let r=j(e.vector_store?.lancedb?.path);if(!r)return null;let n=j(e.vector_store?.collection_name);return{name:"lancedb",path:Wz(r,t),...n&&n!==pp?{collection_name:n}:{}}}function Kz(e){if(!Array.isArray(e)||e.length===0)throw new Error("Vector upsert records must include at least one entry");return e.map((t,r)=>{let n=j(t.id);if(!n)throw new Error(`Vector upsert record at index ${r} is missing a non-empty id`);let o=vc(t.vector),i=t.payload;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error(`Vector upsert record at index ${r} must provide payload as an object when set`);return{id:n,vector:o,...i?{payload:i}:{}}})}function Xz(e){if(!Array.isArray(e)||e.length===0)throw new Error("Vector delete ids must include at least one entry");let t=e.map((n,o)=>{let i=j(n);if(!i)throw new Error(`Vector delete id at index ${o} is missing a non-empty value`);return i}).sort((n,o)=>n.localeCompare(o)),r=[];for(let n of t)r.at(-1)!==n&&r.push(n);return r}function Jz(e){return e.replace(/\/points\?wait=true$/,"/points/delete?wait=true")}function Zz(e){return e.replace(/\/points\?wait=true$/,"")}function Ec(e){return{"content-type":"application/json",...e.api_key?{"api-key":e.api_key}:{}}}function Tc(e,t){return ao(e,t)}function ao(e,t){return Uz(fp(e),Hz,`${t}.json`)}function Qz(e,t,r){let n=j(e.id);if(!n)throw new Error(`LanceDB local snapshot '${r}' record at index ${t} is missing a non-empty id`);let o=vc(e.vector),i=e.payload;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error(`LanceDB local snapshot '${r}' record '${n}' must provide payload as an object when set`);return{id:n,vector:o,...i?{payload:i}:{}}}function e2(e,t,r){let n;try{n=JSON.parse(r)}catch(c){throw new Error(`LanceDB local snapshot at '${e}' is not valid JSON: ${B(c)}`)}if(typeof n!="object"||n===null||Array.isArray(n))throw new Error(`LanceDB local snapshot at '${e}' must be a JSON object`);if(n.version!==dp)throw new Error(`LanceDB local snapshot at '${e}' must include version=${dp}`);let i=j(n.table);if(!i)throw new Error(`LanceDB local snapshot at '${e}' must include a non-empty table value`);if(i!==t)throw new Error(`LanceDB local snapshot at '${e}' table mismatch: expected '${t}', received '${i}'`);let s=n.records;if(!Array.isArray(s))throw new TypeError(`LanceDB local snapshot at '${e}' must include a records array`);let a=new Map;for(let c=0;c<s.length;c+=1){let l=Qz(s[c],c,e);a.set(l.id,l)}return a}async function t2(e){try{let t=await up(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch(t){if(!X(t))throw t;return null}}function r2(e,t){if(!t)return null;if(t.mtimeMs===null&&t.size===null&&t.records.size===0)return t.records;let r=new Map;return nn.set(e,{records:r,mtimeMs:null,size:null}),r}function n2(e,t){return e!==void 0&&t!==null&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function _p(e,t){let r=Tc(e,t),n=ao(e,t),o=await t2(n),i=nn.get(r);if(!o){let a=r2(r,i);if(a)return a}if(n2(i,o))return i.records;let s=new Map;try{let a=await Fz(n,"utf8");s=e2(n,t,a)}catch(a){if(!X(a))throw a}return nn.set(r,{records:s,mtimeMs:o?.mtimeMs??null,size:o?.size??null}),s}function o2(e){let t=[...e.values()];return t.sort((r,n)=>r.id.localeCompare(n.id)),t.map(r=>({id:r.id,vector:[...r.vector],...r.payload?{payload:r.payload}:{}}))}async function EE(e){try{await $z(e)}catch(t){if(!X(t))throw new Error(`LanceDB local snapshot delete failed at '${e}': ${B(t)}`)}}async function TE(e,t,r){let n=ao(e,t);if(r.size===0){await EE(n);return}let o=lp(n);try{await Lz(o,{recursive:!0})}catch(s){throw new Error(`LanceDB local snapshot directory create failed at '${o}': ${B(s)}`)}let i=`${JSON.stringify({version:dp,table:t,records:o2(r)})}
|
|
217
217
|
`;try{await z(n,i)}catch(s){throw new Error(`LanceDB local snapshot write failed at '${n}': ${B(s)}`)}}async function i2(e,t){let r=Tc(e,t),n=ao(e,t);await EE(n),nn.delete(r)}function wE(e){let t=0;for(let r=0;r<e.length;r+=1)t+=e[r]*e[r];return Math.sqrt(t)}function s2(e,t){let r=0;for(let i=0;i<e.length;i+=1)r+=e[i]*t[i];let n=wE(e),o=wE(t);return n===0||o===0?0:r/(n*o)}function kc(e,t){let r=Bz(e),n=Yz(e,t),o=[r,n].filter(c=>c!==null),i=j(e.vector_store?.adapter),s=i?i.toLowerCase():null;return{active:(s?o.find(c=>c.name===s):void 0)??o[0]??null,available:o}}function Ac(e){let t=Li(e);if(e.name==="qdrant"){let o=vo(e.url),i=encodeURIComponent(t);return{store:"qdrant",query_target:`${o}/collections/${i}/points/search`,upsert_target:`${o}/collections/${i}/points?wait=true`}}let r=encodeURIComponent(e.path),n=encodeURIComponent(t);return{store:"lancedb",query_target:`lancedb://${r}#${n}`,upsert_target:`lancedb://${r}#${n}`}}function a2(e,t,r){let n=Ac(e),o=vc(t),i=vE(r);return e.name==="qdrant"?{target:n,method:"POST",headers:Ec(e),body:{vector:o,limit:i,with_payload:!0}}:{target:n,method:"LOCAL",headers:{},body:{table:Li(e),vector:o,limit:i}}}function c2(e,t){let r=Ac(e),n=Kz(t);return e.name==="qdrant"?{target:r,method:"POST",headers:Ec(e),body:{points:n}}:{target:r,method:"LOCAL",headers:{},body:{table:Li(e),records:n}}}function l2(e,t){let r=Ac(e),n=Xz(t);return e.name==="qdrant"?{target:r,method:"POST",headers:Ec(e),body:{points:n}}:{target:r,method:"LOCAL",headers:{},body:{table:Li(e),ids:n}}}async function pZ(e,t,r,n={}){let o=a2(e,t,r);if(o.method==="LOCAL"){let c=e,l=o.body,d=await _p(c.path,l.table);if(d.size===0)return[];let u=vc(l.vector),f=vE(l.limit),p=[],m=0;for(let h of d.values()){if(h.vector.length!==u.length){m++;continue}p.push({id:h.id,score:s2(u,h.vector),...h.payload?{payload:h.payload}:{}})}return m>0&&n.warnings&&n.warnings.push(`vector_dimension_mismatch:${m} records skipped (expected ${u.length} dimensions)`),p.sort((h,b)=>h.score!==b.score?b.score-h.score:h.id.localeCompare(b.id)),p.slice(0,f)}let i=en(n.timeout_ms,"Vector request"),s=tn(n.fetcher,"Vector request"),a=await Mi(o.target.query_target,{method:"POST",headers:o.headers,body:o.body},i,s,"query");return Gz(a)}async function gp(e,t,r={}){let n=c2(e,t);if(n.method==="LOCAL"){let a=e,c=n.body,l=Tc(a.path,c.table),d=await _p(a.path,c.table);for(let p of c.records)d.set(p.id,p);await TE(a.path,c.table,d);let u=ao(a.path,c.table),f=await up(u);return nn.set(l,{records:d,mtimeMs:f.mtimeMs,size:f.size}),{status:"ok"}}let o=en(r.timeout_ms,"Vector request"),i=tn(r.fetcher,"Vector request"),s=await Mi(n.target.upsert_target,{method:"POST",headers:n.headers,body:n.body},o,i,"upsert");return mp(s)}async function Sc(e,t,r={}){let n=l2(e,t);if(n.method==="LOCAL"){let a=e,c=n.body,l=Tc(a.path,c.table),d=await _p(a.path,c.table);if(d.size===0)return{status:"ok"};for(let u of c.ids)d.delete(u);if(await TE(a.path,c.table,d),d.size===0)nn.delete(l);else{let u=ao(a.path,c.table),f=await up(u);nn.set(l,{records:d,mtimeMs:f.mtimeMs,size:f.size})}return{status:"ok"}}let o=en(r.timeout_ms,"Vector request"),i=tn(r.fetcher,"Vector request"),s=await Mi(Jz(n.target.upsert_target),{method:"POST",headers:n.headers,body:n.body},o,i,"delete");return mp(s)}async function kE(e,t=[],r={},n){if(e.name==="lancedb")return await i2(e.path,Li(e)),{status:"ok"};if(n!==void 0){if(!Number.isInteger(n)||n<=0)throw new Error("Vector reset dimension must be a positive integer when provided");let i=Ac(e),s=Zz(i.upsert_target),a=en(r.timeout_ms,"Vector request"),c=tn(r.fetcher,"Vector request"),l=Ec(e);try{await Mi(s,{method:"DELETE",headers:l,body:{}},a,c,"delete")}catch(u){if(!B(u).includes("failed with status 404"))throw u}let d=await Mi(s,{method:"PUT",headers:l,body:{vectors:{size:n,distance:"Cosine"}}},a,c,"upsert");return mp(d)}let o=t.map(i=>i.trim()).filter(i=>i.length>0);return o.length===0?{status:"ok"}:await Sc(e,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]="f4a214b6-02f4-5fc4-bfcd-90c0ca940842")}catch{}})();function Oc(e,t){let r=j(e),n=j(t);return!r||!n?null:{provider:r,model:n}}function AE(e){if(e==null)return null;if(typeof e!="object"||Array.isArray(e))throw new Error("Vectorization embedding metadata must be an object when set");let t=Oc(e.provider,e.model),r=e.vector_dimension;if(!t||typeof r!="number"||!Number.isInteger(r)||r<=0)throw new Error("Vectorization embedding metadata must include provider, model, and positive vector_dimension");return{...t,vector_dimension:r}}function yp(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("Vectorization embedding metadata requires a positive vector dimension");return{provider:e.provider,model:e.model,vector_dimension:t}}function hp(e,t){return!e||e.provider!==t.provider||e.model!==t.model}function bp(e,t){return!!(e&&e.vector_dimension!==t)}function wp(e,t){if(e.length===0)throw new Error(`${t} returned no vectors`);let n=e[0].length;if(!Number.isInteger(n)||n<=0)throw new Error(`${t} returned an empty vector`);for(let o=1;o<e.length;o+=1)if(e[o]?.length!==n)throw new Error(`${t} returned mixed vector dimensions`);return n}import vp 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]="b382ab50-682e-5e53-a32d-277c5ccf8bef")}catch{}})();var d2=["index/manifest.json","search/embeddings.jsonl"],OE="search/vectorization-status.json";function u2(e,t){return`search_cache_invalidation_failed:${e}:${String(t)}`}function co(e){return[...new Set([...e].map(t=>t.trim()).filter(t=>t.length>0))].sort((t,r)=>t.localeCompare(r))}function CE(e){return typeof e=="string"&&e.trim().length>0&&Number.isFinite(Date.parse(e))}function IE(e){let t=new Map;for(let[r,n]of Object.entries(e)){let o=r.trim();o.length===0||!CE(n)||t.set(o,n)}return Object.fromEntries([...t.entries()].sort((r,n)=>r[0].localeCompare(n[0])))}async function RE(e){let t=vp.join(e,OE),r=await G(t);if(r===null||r.trim().length===0)return{entries:{},embedding:null,warnings:[]};let n;try{n=JSON.parse(r)}catch{return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]}}if(typeof n!="object"||n===null||n.version!==1||!Array.isArray(n.items))return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};let o=new Map;for(let s of n.items){if(typeof s!="object"||s===null)return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};let a=s.id,c=s.updated_at;if(typeof a!="string"||a.trim().length===0||!CE(c))return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};o.set(a.trim(),c)}let i=null;try{i=AE(n.embedding)}catch{return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]}}return{entries:Object.fromEntries([...o.entries()].sort((s,a)=>s[0].localeCompare(a[0]))),embedding:i,warnings:[]}}async function xE(e,t,r){let n=IE(t),o=vp.join(e,OE),i=`${JSON.stringify({version:1,generated_at:Q(),...r?{embedding:r}:{},items:Object.entries(n).map(([s,a])=>({id:s,updated_at:a}))},null,2)}
|
|
218
218
|
`;await z(o,i)}function f2(e){return{id:e.id,type:e.type,status:e.status,priority:e.priority,updated_at:e.updated_at}}function p2(e){let t=Oc(e.name,e.model);if(!t)throw new Error("Embedding provider must include a provider name and model");return t}function Fi(e,t){return{refreshed:[],skipped:e,warnings:[t]}}async function m2(e,t,r){if(!r.settings&&!await re(Te(e)))return Fi(t,"search_semantic_refresh_skipped:settings_not_initialized");let n;try{if(r.settings)n=r.settings;else{let a=await hr(e),c=a.warnings.find(l=>l.startsWith("settings_read_"));if(c)return Fi(t,`search_semantic_refresh_skipped:settings_read_failed:${c}`);n=a.settings}}catch(a){return Fi(t,`search_semantic_refresh_skipped:settings_read_failed:${B(a)}`)}let o=r.apply_runtime_defaults?io(n).settings:n,i=bc(o).active;if(!i)return Fi(t,"search_semantic_refresh_skipped:provider_unconfigured");let s=kc(o,e).active;return s?{settings:o,provider:i,vectorStore:s}:Fi(t,"search_semantic_refresh_skipped:vector_store_unconfigured")}async function _2(e,t,r,n,o,i){let s=[],a=new Set,c=new Set,l=[];for(let d of n){let u=await Di(e,d,t,r,o);if(!u){c.add(d);continue}try{let f=await Pi(u,{schema:i});l.push({id:f.document.metadata.id,document:f.document})}catch(f){a.add(u.id),s.push(`search_semantic_refresh_item_read_failed:${u.id}:${B(f)}`)}}return l.sort((d,u)=>d.id.localeCompare(u.id)),{documents:l,missingIds:co(c),skippedIds:co(a),warnings:s}}async function g2(e,t,r){let n=so(t.name,e.search.embedding_corpus_max_characters).maxCharacters,o=op(e),i=r.map(a=>sp(a.document,{providerName:t.name,maxCharacters:n,fields:o})),s=await cp(t,e,i);return{vectors:s.vectors,vector_dimension:wp(s.vectors,"Semantic refresh embedding"),warnings:s.warnings}}async function y2(e,t,r){return await gp(e,t.map((n,o)=>({id:n.id,vector:r[o],payload:f2(n.document.metadata)}))),{refreshed:t.map(n=>n.id),skipped:[],warnings:[]}}async function h2(e,t){if(t.length===0)return{refreshed:[],skipped:[],warnings:[]};try{return await Sc(e,t),{refreshed:[],skipped:[],warnings:[]}}catch(r){return{refreshed:[],skipped:t,warnings:[`search_semantic_refresh_delete_failed:${B(r)}`]}}}async function b2(e){let t=[],r=[];for(let n of d2){let o=vp.join(e,n);try{if(!await re(o))continue;await wo(o),t.push(n)}catch(i){r.push(u2(n,i))}}return{invalidated:t,warnings:r}}async function SE(e,t,r={}){let n=co(t);if(n.length===0)return{refreshed:[],skipped:[],warnings:[]};let o=await m2(e,n,r);if(!("settings"in o))return o;let i=Ao(o.settings,Qt()),s=await _2(e,o.settings.id_prefix,o.settings.item_format,n,i.type_to_folder,o.settings.schema),a=s.documents.length>0||s.missingIds.length>0?await RE(e):{entries:{},embedding:null,warnings:[]},c=p2(o.provider),l=a.entries,d={refreshed:[],skipped:[],warnings:[]},u=a.embedding;if(s.documents.length>0)if(a.embedding&&hp(a.embedding,c))d={refreshed:[],skipped:s.documents.map(b=>b.id),warnings:["search_semantic_refresh_requires_reindex:embedding_identity_changed"]};else try{let b=await g2(o.settings,o.provider,s.documents);if(bp(a.embedding,b.vector_dimension))d={refreshed:[],skipped:s.documents.map(w=>w.id),warnings:[...b.warnings,"search_semantic_refresh_requires_reindex:vector_dimension_changed"]};else{u=yp(c,b.vector_dimension);let w=await y2(o.vectorStore,s.documents,b.vectors);d={refreshed:w.refreshed,skipped:w.skipped,warnings:[...b.warnings,...w.warnings]}}}catch(b){d={refreshed:[],skipped:s.documents.map(w=>w.id),warnings:[`search_semantic_refresh_failed:${B(b)}`]}}let f=await h2(o.vectorStore,s.missingIds),p=new Set(d.refreshed),m=Object.fromEntries(s.documents.filter(b=>p.has(b.id)).map(b=>[b.id,b.document.metadata.updated_at])),h=[];if(Object.keys(m).length>0||s.missingIds.length>0){let b={...l,...IE(m)};for(let w of s.missingIds)delete b[w];try{await xE(e,b,u)}catch(w){h.push(`search_vectorization_status_ledger_write_failed:${B(w)}`)}h.push(...a.warnings)}return{refreshed:co([...d.refreshed,...f.refreshed]),skipped:co([...s.skippedIds,...d.skipped,...f.skipped]),warnings:[...s.warnings,...d.warnings,...f.warnings,...h]}}function w2(e,t){let r=t?io(e).settings:e;return!!(bc(r).active&&kc(r).active)}async function Ep(e,t,r={}){let n=await b2(e),o=co(t);if(o.length===0)return{invalidated:n.invalidated,refreshed:[],skipped:[],warnings:n.warnings};if(!await re(Te(e))){let c=await SE(e,o);return{invalidated:n.invalidated,refreshed:c.refreshed,skipped:c.skipped,warnings:[...n.warnings,...c.warnings]}}let i;try{let c=await hr(e),l=c.warnings.find(d=>d.startsWith("settings_read_"));if(l)return{invalidated:n.invalidated,refreshed:[],skipped:o,warnings:[...n.warnings,`search_semantic_refresh_skipped:settings_read_failed:${l}`]};i=c.settings}catch(c){return{invalidated:n.invalidated,refreshed:[],skipped:o,warnings:[...n.warnings,`search_semantic_refresh_skipped:settings_read_failed:${B(c)}`]}}if(i.search.mutation_refresh_policy==="cache_only")return{invalidated:n.invalidated,refreshed:[],skipped:o,warnings:n.warnings};let s=i.search.mutation_refresh_policy==="semantic_auto";if(r.background&&w2(i,s))return await fE(e,o),{invalidated:n.invalidated,refreshed:[],skipped:[],warnings:[...n.warnings,"search_semantic_refresh_scheduled_background"],scheduled:!0};let a=await SE(e,o,{settings:i,apply_runtime_defaults:s});return{invalidated:n.invalidated,refreshed:a.refreshed,skipped:a.skipped,warnings:[...n.warnings,...a.warnings]}}import{createRequire as T2}from"node:module";(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]="c4fba032-7cda-53a2-b518-fa13a60a76d5")}catch{}})();var v2=new Set(["1","true","yes","on"]),$i=["user","automation","test","dogfood"],E2=new Set($i),Ic=new Set(["stats","ops stats","list","get","next","context","activity","aggregate"]);function NE(e,t,r=process.env){let n=r.PM_TELEMETRY_READ_SAMPLE_RATE?.trim();if(!n||!t||!Ic.has(e))return 1;let o=Number(n);return Number.isFinite(o)&&o>0&&o<=1?o:1}function Cc(e,t){return v2.has((t[e]??"").trim().toLowerCase())}function ft(e=process.env){let t=Cc("DO_NOT_TRACK",e),r=(e.PM_TELEMETRY_SOURCE_CONTEXT??"").trim().toLowerCase(),o=(typeof e.VITEST=="string"||typeof e.VITEST_WORKER_ID=="string"||(e.NODE_ENV??"").trim().toLowerCase()==="test")&&!E2.has(r)&&!Cc("PM_TELEMETRY_SEND_TEST_EVENTS",e);return{telemetry_disabled:t||o||Cc("PM_TELEMETRY_DISABLED",e)||Cc("PM_NO_TELEMETRY",e),do_not_track:t,test_suppressed: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]="12bf6794-9410-5683-bb83-a0da8d2614a7")}catch{}})();var k2=new Set(["1","true","yes","on"]);function A2(){return!!(k2.has((process.env.PM_SENTRY_DISABLED??"").trim().toLowerCase())||ft().telemetry_disabled||typeof process.env.VITEST=="string"||typeof process.env.VITEST_WORKER_ID=="string")}var FE=/(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|credentials|bearer|dsn)/i,S2=new RegExp(`\\b(${FE.source})\\s*[:=]\\s*([^\\s,;]+)`,"giu"),O2=/(^|[\s"'`(=])\/(?:[^\s"'`),;]+)/g,C2=/file:\/\/\/?[^\s"'`),;]+/giu,I2=/\b[A-Za-z]:\\[^\s"'`),;]+/g,R2=/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g,x2=/(?:^|[_-])(path|filename|file|module|cwd|dir|directory|location|source|script)s?$/i;var N2=["[starter-extension] activating","[starter-extension] all 8 capabilities registered.","[starter-extension] commands:","[starter] preflight check for workspace","[starter] output_format service override active","[pm-ext-ts-starter] activating","[pm-ext-ts-starter] all capabilities registered.","run `pm init` first to initialise a pm workspace"];function DE(e){let t=e.trim();return t.length===0?!1:t.startsWith("/")||t.startsWith("file://")||/^[A-Za-z]:\\/.test(t)||t.startsWith("\\\\")?!0:t.includes("/home/")}function At(e,t){if(t&&x2.test(t)&&DE(e))return"[scrubbed_path]";let r=e.replaceAll(S2,(n,o)=>`${o}=[scrubbed]`).replaceAll(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/giu,"[scrubbed_email]").replaceAll(/bearer\s+[a-z0-9._=-]+/giu,"bearer [scrubbed]").replaceAll(/sntr[ysu]_[A-Za-z0-9_-]+/g,"[scrubbed_sentry_token]").replaceAll(R2,"[scrubbed_ip]").replaceAll(C2,"[scrubbed_path]").replaceAll(I2,"[scrubbed_path]").replaceAll(O2,(n,o)=>`${o}[scrubbed_path]`);return DE(r)?"[scrubbed_path]":r}function vr(e){let t={};for(let[r,n]of Object.entries(e))FE.test(r)?t[r]="[scrubbed]":typeof n=="string"?t[r]=At(n,r):Array.isArray(n)?t[r]=n.map(o=>typeof o=="string"?At(o,r):o&&typeof o=="object"?vr(o):o):n&&typeof n=="object"?t[r]=vr(n):t[r]=n;return t}function D2(e){for(let r of["filename","absPath","abs_path","module"]){let n=e[r];typeof n=="string"&&(e[r]=At(n,r))}let t=e.context_line;typeof t=="string"&&(e.context_line=At(t,"context_line"));for(let r of["pre_context","post_context"]){let n=e[r];Array.isArray(n)&&(e[r]=n.map(o=>typeof o=="string"?At(o,r):o))}e.vars&&typeof e.vars=="object"&&(e.vars=vr(e.vars)),e.data&&typeof e.data=="object"&&(e.data=vr(e.data))}var P2=T2(import.meta.url),M2=()=>P2("@sentry/node"),Tp,PE=!1,L2=M2,F2="https://bf7ad2ec76c0051c2ee94e48e8bd6868@o4510603477712896.ingest.de.sentry.io/4511316775338064";function kp(e){return/^\s*PmCliError:/.test(e)}function Ap(e){let t=e.trim().toLowerCase();return t.length===0?!1:N2.some(r=>t.includes(r))}function $2(e){return e.logger!=="console"?!1:typeof e.message=="string"&&Ap(e.message)?!0:Array.isArray(e.exception?.values)&&e.exception.values.some(t=>typeof t.value=="string"&&Ap(t.value))}function j2(e){if(e.logger!=="console")return!1;let t=r=>typeof r=="string"&&/^\(node:\d+\) MaxListenersExceededWarning: Possible EventEmitter memory leak detected\./.test(r);return t(e.message)?!0:Array.isArray(e.exception?.values)&&e.exception.values.some(r=>t(r.value))}function U2(e){return!!(e.exception?.values?.some(t=>t.type==="PmCliError")||e.exception?.values?.some(t=>typeof t.value=="string"&&kp(t.value))||e.logger==="console"&&typeof e.message=="string"&&kp(e.message))}function $E(e){return e.category==="console"&&typeof e.message=="string"&&kp(e.message)}function jE(e){return e.category==="console"&&typeof e.message=="string"&&Ap(e.message)}function z2(){return bl(import.meta.url,["../../.."])??"0.0.0"}function q2(){let e=process.env.SENTRY_ENVIRONMENT?.trim();return e&&e.length>0?e:process.env.VITEST||process.env.VITEST_WORKER_ID||process.env.NODE_ENV==="test"?"test":process.env.CI?"ci":"production"}var ME=.2;function H2(){let e=process.env.SENTRY_TRACES_SAMPLE_RATE?.trim();if(!e)return ME;let t=Number(e);return!Number.isFinite(t)||t<0||t>1?ME:t}function G2(e){if(e.exception?.values){for(let t of e.exception.values)if(t.value&&(t.value=At(t.value,"value")),t.stacktrace?.frames)for(let r of t.stacktrace.frames)D2(r)}}function UE(e){if(e.breadcrumbs)for(let t of e.breadcrumbs)t.message&&(t.message=At(t.message)),t.data&&typeof t.data=="object"&&(t.data=vr(t.data))}function zE(e){if(e.contexts)for(let[t,r]of Object.entries(e.contexts))r&&typeof r=="object"&&(e.contexts[t]=vr(r))}function LE(e,t){let r=e,n=r[t];n&&typeof n=="object"&&(r[t]=vr(n))}var B2=e=>{if(U2(e)||$2(e))return null;j2(e)&&(e.level="warning",e.tags={...e.tags,"pm.diagnostic_class":"node_runtime_warning"}),e.message&&(e.message=At(e.message,"message")),e.transaction&&(e.transaction=At(e.transaction,"transaction")),G2(e),UE(e),LE(e,"extra"),zE(e);for(let t of["request","user","tags"])LE(e,t);return e},V2=e=>(e.breadcrumbs&&(e.breadcrumbs=e.breadcrumbs.filter(t=>!$E(t)&&!jE(t)),UE(e)),zE(e),e),W2=e=>$E(e)||jE(e)?null:(e.message&&(e.message=At(e.message,"message")),e.data&&typeof e.data=="object"&&(e.data=vr(e.data)),e);async function Y2(){if(PE)return Tp;if(PE=!0,A2())return;let e=L2();Tp=e;let t=process.env.SENTRY_DSN?.trim()||F2,r=z2();return e.init({dsn:t,release:`pm-cli@${r}`,environment:q2(),tracesSampleRate:H2(),enableLogs:!0,attachStacktrace:!0,normalizeDepth:6,shutdownTimeout:3e3,sendDefaultPii:!1,serverName:void 0,integrations:[e.extraErrorDataIntegration({depth:4}),e.captureConsoleIntegration({levels:["warn","error"]})],initialScope:{tags:{"cli.name":"pm-cli","cli.version":r,"runtime.node":process.version,"runtime.platform":process.platform,"runtime.arch":process.arch}},beforeSend:B2,beforeSendTransaction:V2,beforeBreadcrumb:W2}),e}function on(){return Tp}(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]="4e329152-7e9e-5cf2-a4cf-35260a599360")}catch{}})();var K2=new Set(["init","config","completion","completion-statuses","completion-tags","completion-types"]),X2=new Set(["list","list-all","list-open","list-in-progress","list-blocked","list-closed","list-canceled","list-draft","search","get","context","calendar","history","activity","aggregate","deps","contracts","stats"]),J2=new Set(["create","update","update-many","close-many","append","close","delete","restore","claim","release","comments","notes","learnings","files","docs","start-task","pause-task","close-task"]),Z2=new Set(["test","test-all","test-runs","test-verify","trace-test","test-ping"]),Q2=new Set(["health","validate","normalize","reindex","gc","telemetry","extension-doctor"]);function eq(e){return e.trim().replaceAll(/\s+/g," ").toLowerCase()}function qE(e){let t=e?.trim().toLowerCase();return t&&t.length>0?t:void 0}var tq=[{code:"unknown_command",matches:e=>e.includes("unknown command")},{code:"unknown_option",matches:e=>e.includes("unknown option")},{code:"missing_required_option",matches:e=>e.includes("missing required options")||e.includes("missing required option")},{code:"missing_required_argument",matches:e=>e.includes("missing required argument")},{code:"no_update_fields",matches:e=>e.includes("no update flags provided")},{code:"ownership_conflict",matches:e=>e.includes("is assigned to")&&e.includes("use --force")},{code:"lock_conflict",matches:e=>e.includes("is locked")},{code:"terminal_state_conflict",matches:e=>e.includes("already terminal")&&e.includes("use --force")},{code:"tracker_not_initialized",matches:e=>e.includes("tracker is not initialized")},{code:"item_not_found",matches:e=>e.includes(" not found")},{code:"close_through_update",matches:e=>e.includes('use "pm close <id> <text>" to close an item')||e.includes("invalid --status value")&&e.includes('"closed"')},{code:"invalid_argument_value",matches:e=>e.startsWith("invalid ")||e.includes(" must be ")||e.includes(" requires ")},{code:"invalid_command_usage",matches:e=>e.includes("either as positional")&&e.includes("not both")}],rq=new Map([[_.USAGE,"invalid_command_usage"],[_.NOT_FOUND,"item_not_found"],[_.CONFLICT,"lock_conflict"],[_.DEPENDENCY_FAILED,"dependency_failed"]]);function lo(e){let t=eq(e),r=t.length>0?t.split(" "):["<unknown>"],n=r[0],o=r[r.length-1],i="other";return K2.has(n)?i="setup":X2.has(n)?i="query":J2.has(n)?i="mutation":Z2.has(n)?i="testing":n==="extension"?i="extension":Q2.has(n)&&(i="diagnostics"),{command_path:t.length>0?t:"<unknown>",command_root:n,command_leaf:o,command_depth:r.length,command_family:i}}function Sp(e){if(e.ok)return;let t=qE(e.errorCode);if(t)return t;let r=(e.errorMessage??"").trim().toLowerCase();for(let o of tq)if(o.matches(r))return o.code;let n=Number.isFinite(e.exitCode)?Math.max(0,Math.trunc(e.exitCode)):void 0;return n!==void 0?rq.get(n)??"command_failed":"command_failed"}function uo(e){if(e.ok)return"success";let t=qE(e.errorCode);return t==="unknown_command"?"nonexistent_command":t==="unknown_option"?"invalid_option":t==="missing_required_option"?"missing_required_option":t==="missing_required_argument"?"missing_required_argument":t==="health_findings"?"health_findings":t==="validation_findings"?"validation_findings":e.errorCategory==="usage"?"invalid_usage":e.errorCategory==="validation"?"validation_failed":e.errorCategory==="conflict"?"conflict":e.errorCategory==="runtime"?"runtime_failed":"unknown_failed"}(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]="199c4791-6ca7-50c4-b2cd-aa96c0ab2408")}catch{}})();var fo;function Er(e,t,r){if(r===void 0)return;let n=e;typeof n.setAttribute=="function"&&n.setAttribute(t,r)}function Rc(e,t,r){typeof r=="string"&&r.trim().length>0&&e.setTag(t,r)}function nq(e,t,r){e.setTag("pm.ok",t),e.setTag("pm.command_ok",t),typeof r?.exit_code=="number"&&(e.setTag("pm.exit_code",String(r.exit_code)),e.setTag("pm.command_exit_code",String(r.exit_code))),Rc(e,"pm.error_code",r?.error_code),Rc(e,"pm.error_category",r?.error_category),Rc(e,"pm.command_resolution",r?.command_resolution),Rc(e,"pm.resolution_stage",r?.resolution_stage)}function oq(e,t,r,n){Er(e,"pm.ok",t),Er(e,"pm.command_ok",t),Er(e,"pm.exit_code",r),Er(e,"pm.command_exit_code",r),Er(e,"pm.error_code",n?.error_code),Er(e,"pm.error_category",n?.error_category),Er(e,"pm.command_resolution",n?.command_resolution),Er(e,"pm.resolution_stage",n?.resolution_stage)}function iq(e,t,r,n){let o=on();if(!o)return;let i=lo(e);o.setTag("pm.command",e),o.setTag("pm.command_root",i.command_root),o.setTag("pm.command_family",i.command_family),typeof n?.source_context=="string"&&n.source_context.trim().length>0&&o.setTag("pm.source_context",n.source_context);let s=t.map(a=>a.startsWith("--")?a.split("=")[0]:a);o.setContext("pm.command",{name:e,root:i.command_root,leaf:i.command_leaf,family:i.command_family,args:s,option_keys:Object.keys(r).sort(),source_context:n?.source_context,source_context_source:n?.source_context_source}),o.addBreadcrumb({category:"pm.command",message:`pm ${e}`,level:"info",data:{args:s,command_root:i.command_root,command_family:i.command_family,source_context:n?.source_context}})}function sq(e){let t=on();t&&(fo=t.startInactiveSpan({op:"pm.command",name:`pm ${e}`,forceTransaction:!0}))}function aq(e,t,r){if(!fo)return;let n=e?"true":"false",o=typeof r?.exit_code=="number"?String(r.exit_code):void 0,i=on();i&&nq(i,n,r),oq(fo,n,o,r),fo.setStatus(e?{code:1}:{code:2,message:t??"command_failed"}),fo.end(),fo=void 0}var cq="unclassified_runtime_error";function lq(e){let t=typeof e=="object"&&e!==null?e:void 0,r=typeof t?.exitCode=="number",n=r?Math.trunc(t?.exitCode):_.GENERIC_FAILURE;return{error_code:typeof t?.code=="string"&&t.code.length>0&&r?t?.code:cq,exit_code:n}}function dq(e){let t=lq(e);return{"pm.error_code":t.error_code,"pm.exit_code":String(t.exit_code)}}function uq(e){if(!pq(e))return;let t=on();if(!t)return;let r=dq(e);if(e instanceof Error){let n={};"exitCode"in e&&typeof e.exitCode=="number"&&(n.exit_code=e.exitCode),"context"in e&&typeof e.context=="object"&&(n.error_context=e.context),t.captureException(e,{extra:n,tags:r})}else t.captureException(new Error(String(e)),{tags:r})}function fq(e){let t=on();if(!t)return;let r=e.command_resolution??uo({ok:!1,errorCode:e.error_code,errorCategory:e.error_category}),n=e.resolution_stage??"unknown",o={"pm.command":e.command,"pm.error_code":e.error_code,"pm.error_category":e.error_category,"pm.exit_code":e.exit_code,"pm.error_message":e.error_message,"pm.command_resolution":r,"pm.resolution_stage":n,"pm.source_context":e.source_context??""},i=t.logger;if(i&&typeof i.warn=="function"){i.warn("pm_cli_usage_error",o);return}t.captureMessage(`pm_cli_usage_error:${e.error_code}`,{level:"warning",tags:{"pm.command":e.command,"pm.error_code":e.error_code,"pm.error_category":e.error_category,"pm.exit_code":String(e.exit_code),"pm.command_resolution":r,"pm.resolution_stage":n,"pm.source_context":e.source_context??"unknown"},extra:o})}function pq(e){if(e instanceof g||e instanceof Error&&e.name==="AbortError"&&/(?:ctrl\+[cd]|sigint|user[- ]initiated)/i.test(e.message))return!1;if(typeof e=="object"&&e!==null&&"exitCode"in e&&typeof e.exitCode=="number"){if(e instanceof Error&&e.name==="CommandError")return!1;let t=Math.trunc(e.exitCode);return!new Set([_.SUCCESS,_.USAGE,_.NOT_FOUND,_.CONFLICT]).has(t)}return!0}async function mq(e=3e3){let t=on();if(t)try{await t.flush(e)}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]="d7a68072-168d-509a-95ec-145635d71d46")}catch{}})();var HE=[{name:"private-key",mutationRule:"private_key",regex:/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/g},{name:"github-token",mutationRule:"github_token",regex:/\b(?:gh[opsru]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g},{name:"npm-token",mutationRule:"npm_token",regex:/\bnpm_[A-Za-z0-9]{20,}\b/g},{name:"aws-access-key",mutationRule:"aws_access_key",regex:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g},{name:"google-api-key",mutationRule:"google_api_key",regex:/\bAIza[0-9A-Za-z_-]{35}\b/g},{name:"slack-token",mutationRule:"slack_token",regex:/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g},{name:"anthropic-api-key",mutationRule:"anthropic_api_key",regex:/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g},{name:"openai-api-key",mutationRule:"openai_api_key",regex:/\bsk-(?!ant-)[A-Za-z0-9_-]{20,}\b/g},{name:"gitlab-token",mutationRule:"gitlab_token",regex:/\bglpat-[A-Za-z0-9_.-]{20,}\b/g},{name:"jwt-like-token",mutationRule:"jwt_like_token",regex:/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g},{name:"npm-auth-token-assignment",mutationRule:"npm_auth_token_assignment",regex:/_authToken\s*=\s*\S+/g},{name:"sentry-user-token",mutationRule:"sentry_user_token",regex:/\bsntryu_[A-Za-z0-9]{20,}\b/g},{name:"sentry-org-token",mutationRule:"sentry_org_token",regex:/\bsntrys_[A-Za-z0-9_-]{20,}\b/g},{name:"private-ip",mutationRule:"private_ip",regex:/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"private-ssh-target",mutationRule:"private_ssh_target",regex:/\b(?:ssh|scp|rsync)\s+[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"sshpass-inline-password",mutationRule:"sshpass_inline_password",regex:/\bsshpass\s+-p\s+["'][^"']{6,}["']/g},{name:"password-assignment",mutationRule:"password_assignment",regex:/\b(?:password|passphrase)\s*[:=]\s*(?:(?!<|\$\{|\$\()[A-Za-z0-9!@#$%^&*._+\-=]{8,}|"(?!<|\$\{|\$\()[^"]{8,}"|'(?!<|\$\{|\$\()[^']{8,}')/gi},{name:"absolute-home-path",mutationRule:"absolute_home_path",regex:/(?:^|[\s"'`(=])\/home\/[A-Za-z0-9._-]+\/[^\s"'`),;]+/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"user-at-private-host",mutationRule:"user_at_private_host",regex:/\b[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"high-entropy-assignment",mutationRule:"high_entropy_assignment",regex:/\b(?:token|secret|password|passwd|api[_-]?key)\s*[:=]\s*["']?([A-Za-z0-9+/=_-]{24,})/gi,mutationOnlyReason:"Generic assignments in source code are not credentials; preserve the existing mutation heuristic without treating source identifiers as secrets.",minimumEntropy:3.5}];function GE(e,t){if(e.minimumEntropy===void 0)return!0;let r=t[1],n=new Map;for(let i of r)n.set(i,(n.get(i)??0)+1);let o=0;for(let i of n.values()){let s=i/r.length;o-=s*Math.log2(s)}return o>=e.minimumEntropy}(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]="eed441f0-e2b5-51e9-b9bf-0f4882a9eeea")}catch{}})();var _q=[{action:"append",history_scope:"item"},{action:"claim",history_scope:"item"},{action:"close",history_scope:"item"},{action:"close-many",history_scope:"item"},{action:"close-task",history_scope:"item"},{action:"comments",history_scope:"conditional"},{action:"config",history_scope:"conditional"},{action:"copy",history_scope:"item"},{action:"create",history_scope:"item"},{action:"delete",history_scope:"item"},{action:"deps",history_scope:"conditional"},{action:"discover",history_scope:"item"},{action:"docs",history_scope:"conditional"},{action:"files",history_scope:"conditional"},{action:"focus",history_scope:"conditional"},{action:"gc",history_scope:"conditional"},{action:"history-compact",history_scope:"history"},{action:"history-author-acknowledge",history_scope:"workspace"},{action:"history-redact",history_scope:"history"},{action:"history-repair",history_scope:"history"},{action:"init",history_scope:"workspace"},{action:"install",history_scope:"conditional"},{action:"learnings",history_scope:"conditional"},{action:"notes",history_scope:"conditional"},{action:"package",history_scope:"conditional"},{action:"pause-task",history_scope:"item"},{action:"plan",history_scope:"conditional"},{action:"profile",history_scope:"conditional"},{action:"release",history_scope:"item"},{action:"restore",history_scope:"item"},{action:"schema",history_scope:"conditional"},{action:"start-task",history_scope:"item"},{action:"templates",history_scope:"conditional"},{action:"test",history_scope:"conditional"},{action:"test-all",history_scope:"conditional"},{action:"update",history_scope:"item"},{action:"update-many",history_scope:"item"},{action:"upgrade",history_scope:"conditional"}],Cp=new Map(_q.map(e=>[e.action,e]));function Op(e,t="$",r=new WeakSet){return typeof e=="string"?[{path:t,value:e}]:typeof e!="object"||e===null?[]:r.has(e)?[]:(r.add(e),Array.isArray(e)?e.flatMap((n,o)=>Op(n,`${t}[${o}]`,r)):Object.entries(e).flatMap(([n,o])=>Op(o,`${t}.${n}`,r)))}function BE(e){let t=[];for(let r of Op(e))for(let n of HE){n.regex.lastIndex=0;for(let o of r.value.matchAll(n.regex))if(GE(n,o)){t.push({rule:n.mutationRule,path:r.path});break}}return t.filter((r,n,o)=>o.findIndex(i=>i.rule===r.rule&&i.path===r.path)===n)}function gq(e){let t=e.author.trim()||"unknown";if(e.settings.require_attributed_author&&t.toLowerCase()==="unknown")throw new g("Mutation author is required by workspace policy.",_.USAGE,{code:"mutation_author_required",required:"Pass --author <id>, set PM_AUTHOR, or configure author_default.",nextSteps:["Retry with --author <stable-agent-id>.","Set PM_AUTHOR for this agent session."]});if(e.settings.secret_guard==="off")return{author:t,findings:[],warnings:[],override_applied:!1};let r;try{r=BE(e.payload)}catch{return{author:t,findings:[],warnings:["secret_guard_scan_failed_open"],override_applied:!1}}if(r.length===0)return{author:t,findings:r,warnings:[],override_applied:!1};let n=[...new Set(r.map(o=>o.rule))].sort().join(",");if(e.settings.secret_guard==="block"&&e.force!==!0)throw new g(`Mutation blocked by secret guard (${n}). No detected value was logged.`,_.CONFLICT,{code:"mutation_secret_guard_blocked",required:"Remove the credential-shaped content or retry with --force after explicit review.",nextSteps:["Replace the value with a secret-manager reference.","Use pm history-redact if equivalent content already entered history."],recovery:{recovery_mode:"compact",attempted_command:"pm <mutation> [REDACTED]",normalized_args:["[REDACTED]"],suggested_retry:"Remove credential-shaped content, then retry the mutation."}});return{author:t,findings:r,warnings:[`secret_guard_detected:${r.length}:rules=${n}`,...e.settings.secret_guard==="block"&&e.force===!0?["secret_guard_force_override"]:[]],override_applied:e.settings.secret_guard==="block"&&e.force===!0}}function yq(e){return Cp.has(e.trim().toLowerCase())}function hq(){return[...Cp.keys()].sort((e,t)=>e.localeCompare(t))}function XZ(e){return Cp.get(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]="c18e4dfc-d3e3-5185-9470-9d46b4dca893")}catch{}})();function bq(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function ZZ(e){return bq(e).split(/[^a-z0-9]+/).filter(t=>t.length>0)}function xc(e,t){if(e.length===0&&t.length===0)return 1;if(e.length===0||t.length===0)return 0;let r=new Set(e),n=new Set(t),o=0;for(let s of r)n.has(s)&&(o+=1);let i=new Set([...r,...n]).size;return o/i}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="54784ad1-36bd-5a10-aa00-ad0b09e935a7")}catch{}})();var wq=/\b[a-z][a-z0-9]*-\d+(?:-[a-z0-9]+)*\b/giu;function Ip(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function WE(e){return[...new Set(Ip(e).match(/[\p{L}\p{N}]+/gu)??[])]}function VE(e){let t=Ip(e);return{normalized:t,tokens:WE(t),issueCodes:[...new Set(t.match(wq)?.map(r=>r.toLowerCase())??[])]}}function vq(e,t){return Eq(VE(e),VE(t))}function Eq(e,t){if(e.normalized===t.normalized)return{score:1,reason:"exact_title"};let r=new Set(e.issueCodes);return t.issueCodes.some(n=>r.has(n))?{score:.99,reason:"issue_code"}:{score:xc(e.tokens,t.tokens),reason:"title_token_jaccard"}}import Tq 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]="cdae67c6-8316-5e97-84ca-0be4460ffd57")}catch{}})();function Nc(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function kq(e,t){return[e.updated_at,t].map(n=>({value:n,time:Date.parse(n??"")})).filter(n=>typeof n.value=="string"&&Number.isFinite(n.time)).sort((n,o)=>o.time-n.time)[0]?.value??e.updated_at}function YE(e,t){let r=Math.max(1,Math.trunc(t.threshold_hours)),n=(t.now??new Date).getTime(),o=Nc(t.in_progress_status),i=[];for(let s of e){if(Nc(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=kq(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let l=Math.max(0,Math.floor((n-c)/36e5));l>=r&&i.push({id:s.id,last_activity_at:a,age_hours:l})}return i.sort((s,a)=>a.age_hours-s.age_hours||s.id.localeCompare(a.id)),{threshold_hours:r,count:i.length,items:i,remediation:"Claim active work with `pm claim <id>` or return abandoned work to open with `pm update <id> --status open`."}}async function Aq(e,t,r){let n=new Map;return await Promise.all(t.filter(o=>Nc(String(o.status))===Nc(r.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await qe(Tq.join(e,"history",`${o.id}.jsonl`),o.id)}catch{return}let s=i.map(a=>a.ts).filter(a=>Number.isFinite(Date.parse(a))).sort((a,c)=>Date.parse(c)-Date.parse(a))[0];s&&n.set(o.id,s)})),YE(t,{...r,last_history_activity:o=>n.get(o.id)})}(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]="eb1afbe5-eb0a-56d2-bb94-80fd427325f7")}catch{}})();var Sq=Object.freeze({"<":"<",">":">",""":'"',"'":"'","&":"&"}),Oq=/&(?:lt|gt|quot|#39|amp);/g;function Cq(e){return typeof e!="string"||!e.includes("<")&&!e.includes(">")?e:e.replace(Oq,t=>Sq[t])}function Iq(e){return Rp(e,new WeakMap)}function Rp(e,t){if(typeof e=="string")return Cq(e);if(Array.isArray(e)){if(t.has(e))return t.get(e);let r=[];t.set(e,r);for(let n of e)r.push(Rp(n,t));return r}if(e!==null&&typeof e=="object"){if(!Rq(e))return e;if(t.has(e))return t.get(e);let r=e,n=Object.create(Object.getPrototypeOf(e));t.set(e,n);for(let[o,i]of Object.entries(r))Object.defineProperty(n,o,{value:Rp(i,t),enumerable:!0,writable:!0,configurable:!0});return n}return e}function Rq(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===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]="4873876d-67b4-5f79-a984-756b7e539e9b")}catch{}})();function xq(e){let t=null;return()=>(t??=e(),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]="3940f646-f84d-5eb0-8db1-de64ca0a5985")}catch{}})();function KE(e){return e.split(/[\s,|]+/).map(t=>t.trim()).filter(t=>t.startsWith("--"))}function Nq(e){return KE(e)[0]??null}function Dq(e,t){let r=Nq(t);if(r===null)return!1;let n=o=>o.slice(2).replaceAll("-","_");return KE(e).some(o=>!o.slice(2).includes("-")||r===o?!1:n(r)===n(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]="f3edff87-6ea5-5108-a749-eeb380870601")}catch{}})();function Pq(e,t){if(e==null)return[];let r=t?.separators??/,/,o=e.split(r).map(a=>a.trim()).filter(a=>a.length>0),s=t?.unique!==!1?Array.from(new Set(o)):o;return t?.sort===!0?[...s].sort():s}import XE from"node:fs/promises";import Dc 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]="1ad4a739-f29d-5b50-b1cf-f8590804e32b")}catch{}})();function Mq(e){return"json_markdown"}function JE(e,t){return Dc.relative(e,t).replaceAll("\\","/")}function Lq(e){return String(e).replaceAll(/[^a-zA-Z0-9._-]+/g,"_").slice(0,120)}async function Fq(e,t,r="item_format:migrate",n=Ee,o){if(t!=="toon")throw new Error("Only toon item-format migration targets are supported. Markdown item files are legacy read-only input.");let i=new Set,s=new Set,a=[],c=0,l=Mq(t),d=Object.entries(n);for(let[u,f]of d){let p=Dc.join(e,f),m=[];try{m=await XE.readdir(p)}catch{continue}let h=new Map;for(let w of m){let E=Dc.join(p,w),C=Co(E);if(!C)continue;let V=Dc.extname(w),P=w.slice(0,w.length-V.length).trim();if(P.length===0)continue;let he=h.get(P)??{};he[C]=E,h.set(P,he)}let b=[...h.keys()].sort((w,E)=>w.localeCompare(E));for(let w of b){let E=h.get(w);c+=1;let C=E[l];if(!C)continue;let V=E[t]??C,P=V===E[t]?t:l;try{let he=await XE.readFile(V,"utf8"),Ce=qr(he,{format:P,schema:o,onWarning:pn=>a.push(`item_format_migration_parse_warning:${w}:${pn}`)}),Ye=vn(e,u,w,t,n),Ie=fi(Ce,{format:t,schema:o});await G(Ye)!==Ie&&(await z(Ye,Ie),a.push(...await Ae({path:Ye,scope:"project",op:r})),i.add(w)),await wo(C),s.add(JE(e,C)),a.push(...await Ae({path:C,scope:"project",op:`${r}:remove`})),i.add(w)}catch(he){a.push(`item_format_migration_skipped:${JE(e,V)}:${Lq(he)}`)}}}return{target_format:t,scanned:c,migrated:[...i].sort((u,f)=>u.localeCompare(f)),removed:[...s].sort((u,f)=>u.localeCompare(f)),warnings: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]="d2940263-a7b4-5d29-b1e5-631fe1072a5b")}catch{}})();var $q=new Set(["completed","superseded"]);function jq(e){return e!==void 0&&$q.has(e)}function Uq(e){if(e.type.trim().toLowerCase()!=="plan")return!1;let t=e.plan_steps??[];return t.length>0&&t.every(r=>r.status==="completed")}import zq from"node:readline/promises";import{stdin as qq,stdout as ZE}from"node:process";(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]="91cfc9cf-9ab1-5c9f-803d-f378e9963c4a")}catch{}})();var Hq="PM_TELEMETRY_PROMPT",QE=new Set(["0","false","no","off"]),Gq=new Set(["init","completion","completion-statuses","completion-tags","completion-types"]);function Bq(e){return typeof e!="string"?!1:QE.has(e.trim().toLowerCase())}function Vq(e){if(typeof e!="string")return!1;let t=e.trim().toLowerCase();return t.length===0?!1:!QE.has(t)}function Wq(e,t){if(t.json===!0||t.quiet===!0||process.stdin.isTTY!==!0||process.stdout.isTTY!==!0||Bq(process.env[Hq])||Vq(process.env.CI))return!0;let r=e.trim().toLowerCase();return r.length===0?!0:Gq.has(r)}function Yq(e){let t=e.trim().toLowerCase();return!(t==="n"||t==="no")}async function Kq(e){let r=`pm telemetry helps improve reliability and usage diagnostics.
|
|
@@ -234,5 +234,5 @@ Enable telemetry now? [${e?"Y/n":"y/N"}] `,n=zq.createInterface({input:qq,output
|
|
|
234
234
|
`)}}function Xre(e,t,r){if(er(e),r.quiet)return;let n={type:"meta",command:"activity",count:e.count,filters:{id:t.id??null,op:t.op??null,author:t.author??null,from:t.from??null,to:t.to??null,limit:t.limit??null}};if(!$t(`${JSON.stringify(n)}
|
|
235
235
|
`))return;let o=e.compact&&e.compact_activity?e.compact_activity:e.activity??[];for(let i of o)if(!$t(`${JSON.stringify({type:"entry",command:"activity",entry:i})}
|
|
236
236
|
`))return;$t(`${JSON.stringify({type:"end",command:"activity",count:e.count})}
|
|
237
|
-
`)}function Jre(e){let t=l=>Bt(e,Me(rl,l)),r=l=>{let d=il(e,Me(rl,l));if(typeof d=="string"||typeof d=="number"&&Number.isFinite(d))return d},n=t("fields"),o=e.compact===!0,i=e.full===!0,s=!o&&!i&&n===void 0,c={mode:e.semantic===!0?"semantic":e.hybrid===!0?"hybrid":t("mode"),matchMode:t("matchMode"),minScore:r("minScore"),count:k(e,"count"),semanticWeight:r("semanticWeight"),includeLinked:k(e,"includeLinked"),titleExact:k(e,"titleExact"),phraseExact:k(e,"phraseExact"),highlight:k(e,"highlight"),status:t("status"),type:t("type"),tag:t("tag"),priority:t("priority"),deadlineBefore:t("deadlineBefore"),deadlineAfter:t("deadlineAfter"),updatedAfter:t("updatedAfter"),updatedBefore:t("updatedBefore"),createdAfter:t("createdAfter"),createdBefore:t("createdBefore"),assignee:t("assignee"),sprint:t("sprint"),release:t("release"),parent:t("parent"),limit:t("limit"),fields:n,compact:o||s?!0:void 0,full:k(e,"full"),...uS(e)};return dl(c,e),c}function Zre(e){let t=e.map(r=>r.trim()).filter(r=>r.length>0).join(" ");if(t.length===0)throw new g("Search query must not be empty",_.USAGE);return t}function Qre(e){let t=n=>Bt(e,Me(Dm,n)),r={id:t("id"),op:t("op"),author:t("author"),from:t("from"),to:t("to"),limit:t("limit"),compact:e.full===!0||e.provenance===!0?!1:e.compact===!0||e.raw===!0?!0:void 0,...e.raw===!0||e.compact===!0||e.full===!0?{raw:!0}:{},unbounded:k(e,"unbounded"),provenance:k(e,"provenance"),provenanceSummary:k(e,"provenanceSummary"),harness:Array.isArray(e.harness)?e.harness:void 0,agentInstance:Array.isArray(e.agentInstance)?e.agentInstance:void 0,provenanceFilter:Array.isArray(e.provenanceFilter)?e.provenanceFilter:void 0};return Object.fromEntries(Object.entries(r).filter(([,n])=>n!==void 0))}var bV=new Set(["","rows","ndjson","jsonl","true","1","yes","on"]),wV=new Set(["false","off","none","0"]);function ene(e){if(e===!0)return!0;if(e===!1||e===void 0||e===null)return!1;if(typeof e=="string"){let t=e.trim().toLowerCase();if(bV.has(t))return!0;if(wV.has(t))return!1}throw new g("Activity --stream accepts rows|ndjson|jsonl (or no value)",_.USAGE)}function tne(e){let t=s=>Bt(e,Me(nl,s)),r=s=>lS(e,Me(nl,s)),n=e.section,o=Array.isArray(n)?n.filter(s=>typeof s=="string"&&s.trim().length>0):typeof n=="string"&&n.trim().length>0?[n]:void 0,i={date:t("date"),from:t("from"),to:t("to"),past:e.past===!0?!0:void 0,type:t("type"),tag:t("tag"),priority:t("priority"),assignee:t("assignee"),assigneeFilter:t("assigneeFilter"),sprint:t("sprint"),release:t("release"),parent:t("parent"),limit:t("limit"),format:t("format"),depth:t("depth"),fields:t("fields"),section:o&&o.length>0?o:void 0,activityLimit:t("activityLimit"),staleThreshold:t("staleThreshold"),tokenBudget:r("tokenBudget"),noExtensionHealth:e.extensionHealth===!1?!0:void 0,noTags:e.tags===!1?!0:void 0};for(let[s,a]of Object.entries(e))Object.hasOwn(i,s)||(i[s]=a);return i}function rne(e){let t=o=>Bt(e,Me(ol,o)),r=o=>lS(e,Me(ol,o)),n={type:t("type"),tag:t("tag"),priority:r("priority"),assignee:t("assignee"),assigneeFilter:t("assigneeFilter"),sprint:t("sprint"),release:t("release"),parent:t("parent"),limit:t("limit"),blockedLimit:t("blockedLimit"),readyOnly:e.readyOnly===!0||e.ready_only===!0?!0:void 0,format:t("format"),tokenBudget:r("tokenBudget")};for(let[o,i]of Object.entries(e))Object.hasOwn(n,o)||(n[o]=i);return n}function vV(e){if(!e||typeof e!="object")return[];let t=e,r=new Set,n=a=>{if(typeof a!="string")return;let c=a.trim();c.length!==0&&r.add(c)};n(t.id);let o=t.item;o&&typeof o=="object"&&n(o.id);let i=t.ids;if(Array.isArray(i))for(let a of i)n(a);let s=t.items;if(Array.isArray(s))for(let a of s)!a||typeof a!="object"||n(a.id);return[...r].sort((a,c)=>a.localeCompare(c))}async function nne(e,t){let r=Oo(process.cwd(),e.path),n=await Ep(r,vV(t),{background:!tp()});e.profile&&n.warnings.length>0&&au(`profile:search_refresh_warnings=${yV(n.warnings)}`)}export{EV as a,Yi as b,jm as c,Um as d,Ki as e,Xi as f,mS as g,zm as h,Ke as i,go as j,_S as k,fl as l,gS as m,pl as n,gl as o,yl as p,CV as q,IV as r,RV as s,AS as t,qm as u,xV as v,ts as w,re as x,ho as y,X as z,G as A,z as B,wo as C,Jl as D,hl as E,Hm as F,rs as G,Ct as H,bl as I,MS as J,j as K,LS as L,B as M,Bm as N,zV as O,FS as P,Gm as Q,Vm as R,$S as S,mt as T,os as U,wl as V,HV as W,is as X,ss as Y,as as Z,cs as _,ls as $,Ym as aa,Xe as ba,ds as ca,US as da,zS as ea,YV as fa,Ee as ga,kl as ha,HS as ia,vl as ja,O as ka,_ as la,fs as ma,g as na,hn as oa,Xm as pa,bn as qa,ps as ra,wn as sa,ms as ta,JV as ua,ZV as va,QV as wa,gs as xa,ys as ya,e5 as za,t5 as Aa,r5 as Ba,n5 as Ca,hs as Da,Eo as Ea,Al as Fa,Zm as Ga,bs as Ha,Qm as Ia,e_ as Ja,o5 as Ka,i5 as La,XS as Ma,Il as Na,Rl as Oa,cO as Pa,ko as Qa,vs as Ra,Ao as Sa,c_ as Ta,l_ as Ua,SO as Va,IO as Wa,Es as Xa,u_ as Ya,v5 as Za,Oo as _a,$O as $a,It as ab,Te as bb,vn as cb,Co as db,_t as eb,f_ as fb,xl as gb,Ts as hb,UO as ib,E5 as jb,zO as kb,qO as lb,T5 as mb,k5 as nb,HO as ob,A5 as pb,J as qb,ks as rb,I5 as sb,ot as tb,p_ as ub,Nl as vb,JO as wb,ZO as xb,Ro as yb,Dl as zb,Pl as Ab,Ml as Bb,Ll as Cb,Fl as Db,As as Eb,nd as Fb,eC as Gb,tC as Hb,iC as Ib,sC as Jb,w_ as Kb,eg as Lb,tg as Mb,$l as Nb,jl as Ob,hg as Pb,bg as Qb,L as Rb,ne as Sb,Os as Tb,T_ as Ub,Ul as Vb,k_ as Wb,zl as Xb,ql as Yb,Hl as Zb,Gl as _b,Bl as $b,Vl as ac,Yl as bc,Kl as cc,Xl as dc,cI as ec,dI as fc,Cg as gc,Ig as hc,EI as ic,wW as jc,FI as kc,$I as lc,AW as mc,Dg as nc,jI as oc,fd as pc,qI as qc,HI as rc,jg as sc,Fs as tc,WI as uc,YI as vc,KI as wc,XI as xc,JI as yc,ZI as zc,QI as Ac,Qt as Bc,e0 as Cc,t0 as Dc,er as Ec,r0 as Fc,$s as Gc,Vo as Hc,n0 as Ic,o0 as Jc,Ae as Kc,js as Lc,it as Mc,pd as Nc,i0 as Oc,s0 as Pc,a0 as Qc,c0 as Rc,Ze as Sc,Ko as Tc,Wg as Uc,l0 as Vc,d0 as Wc,u0 as Xc,Us as Yc,jW as Zc,Bg as _c,Vg as $c,Dt as ad,HW as bd,WW as cd,Yg as dd,m0 as ed,_0 as fd,YW as gd,gt as hd,KW as id,w0 as jd,T0 as kd,I0 as ld,Zg as md,t3 as nd,r3 as od,Wo as pd,gd as qd,yd as rd,n3 as sd,D0 as td,o3 as ud,i3 as vd,ry as wd,zs as xd,M0 as yd,tr as zd,Cn as Ad,qs as Bd,Hs as Cd,Yo as Dd,ny as Ed,Pd as Fd,ti as Gd,V0 as Hd,dy as Id,wd as Jd,K0 as Kd,vd as Ld,Bs as Md,fy as Nd,J0 as Od,Ed as Pd,my as Qd,p3 as Rd,_y as Sd,gy as Td,yy as Ud,nR as Vd,oR as Wd,hy as Xd,Jo as Yd,h3 as Zd,iR as _d,by as $d,wy as ae,vy as be,Td as ce,st as de,Ey as ee,sR as fe,aR as ge,cR as he,lR as ie,dR as je,uR as ke,fR as le,ky as me,mR as ne,kd as oe,Ay as pe,Sy as qe,Oy as re,Ad as se,Cy as te,Iy as ue,Sd as ve,nr as we,Od as xe,DR as ye,PR as ze,Ny as Ae,Vs as Be,Id as Ce,Rd as De,xd as Ee,ei as Fe,Ks as Ge,Fy as He,Nd as Ie,$y as Je,Mr as Ke,Vy as Le,Yy as Me,Ky as Ne,BR as Oe,yt as Pe,W3 as Qe,Fd as Re,JR as Se,Y3 as Te,th as Ue,jd as Ve,ih as We,sh as Xe,ah as Ye,vx as Ze,Ex as _e,Q3 as $e,Q as af,Mt as bf,Hd as cf,Dn as df,we as ef,i9 as ff,zx as gf,oe as hf,Ft as if,fe as jf,I9 as kf,Mn as lf,yN as mf,R9 as nf,x9 as of,hN as pf,N9 as qf,D9 as rf,P9 as sf,Mh as tf,EN as uf,G9 as vf,kN as wf,Fh as xf,B9 as yf,jh as zf,SN as Af,RN as Bf,Uh as Cf,Hh as Df,$t as Ef,$n as Ff,aa as Gf,Xh as Hf,au as If,fu as Jf,jn as Kf,fD as Lf,b8 as Mf,mD as Nf,Zh as Of,$r as Pf,cr as Qf,bi as Rf,Qh as Sf,Ue as Tf,Se as Uf,_u as Vf,ht as Wf,xe as Xf,BD as Yf,cb as Zf,gu as _f,ma as $f,yu as ag,db as bg,YD as cg,nP as dg,oP as eg,Un as fg,mb as gg,U8 as hg,_b as ig,iP as jg,z8 as kg,zr as lg,gb as mg,aP as ng,ya as og,ui as pg,hM as qg,qr as rg,fi as sg,et as tg,Iu as ug,Sb as vg,Ob as wg,Ru as xg,Cb as yg,u6 as zg,Ib as Ag,f6 as Bg,wa as Cg,dr as Dg,Ea as Eg,CM as Fg,IM as Gg,Pb as Hg,Lu as Ig,T6 as Jg,k6 as Kg,A6 as Lg,PM as Mg,MM as Ng,LM as Og,Bu as Pg,Vu as Qg,Wu as Rg,M6 as Sg,aL as Tg,cL as Ug,lL as Vg,dL as Wg,uL as Xg,pi as Yg,Ju as Zg,Zu as _g,mL as $g,L6 as ah,_L as bh,Qu as ch,mi as dh,gL as eh,qe as fh,G6 as gh,yL as hh,hL as ih,Vn as jh,FL as kh,nY as lh,oY as mh,iY as nh,BL as oh,La as ph,mr as qh,Yn as rh,pw as sh,mw as th,df as uh,Wr as vh,YL as wh,ja as xh,yi as yh,uf as zh,Ua as Ah,sF as Bh,ff as Ch,gw as Dh,aF as Eh,jt as Fh,Ut as Gh,Kn as Hh,Xn as Ih,$Y as Jh,pf as Kh,hi as Lh,lF as Mh,dF as Nh,_f as Oh,gf as Ph,ct as Qh,hF as Rh,wF as Sh,jY as Th,TF as Uh,Tw as Vh,yf as Wh,kw as Xh,YY as Yh,_r as Zh,Kr as _h,kF as $h,AF as ai,wf as bi,vf as ci,SF as di,OF as ei,CF as fi,mK as gi,Va as hi,t$ as ii,hr as ji,dt as ki,ki as li,tv as mi,eo as ni,qt as oi,N$ as pi,P$ as qi,L$ as ri,F$ as si,$$ as ti,j$ as ui,Pf as vi,JK as wi,Ja as xi,Ai as yi,W$ as zi,X$ as Ai,Za as Bi,cv as Ci,lj as Di,dj as Ei,uj as Fi,jf as Gi,bj as Hi,uc as Ii,Bj as Ji,fc as Ki,Ni as Li,Di as Mi,Pi as Ni,o1 as Oi,Ov as Pi,i1 as Qi,dX as Ri,Vf as Si,Cv as Ti,u1 as Ui,uX as Vi,f1 as Wi,p1 as Xi,g1 as Yi,h1 as Zi,w1 as _i,v1 as $i,AX as aj,T1 as bj,OX as cj,k1 as dj,A1 as ej,CX as fj,NX as gj,Mv as hj,S1 as ij,O1 as jj,C1 as kj,I1 as lj,M1 as mj,$1 as nj,DX as oj,j1 as pj,Uv as qj,z1 as rj,q1 as sj,PX as tj,H1 as uj,pc as vj,MX as wj,oo as xj,B1 as yj,V1 as zj,Kf as Aj,zv as Bj,J1 as Cj,Xf as Dj,Z1 as Ej,tU as Fj,ZX as Gj,nU as Hj,Hv as Ij,oU as Jj,iU as Kj,cU as Lj,iJ as Mj,uU as Nj,uJ as Oj,_U as Pj,yU as Qj,hU as Rj,bU as Sj,wU as Tj,Qf as Uj,TU as Vj,wJ as Wj,vJ as Xj,EJ as Yj,TJ as Zj,kJ as _j,AJ as $j,SJ as ak,SU as bk,OU as ck,CU as dk,IU as ek,RU as fk,xU as gk,NU as hk,io as ik,sE as jk,tp as kk,WJ as lk,QJ as mk,bc as nk,gE as ok,op as pk,kz as qk,Az as rk,rZ as sk,yE as tk,so as uk,sp as vk,cp as wk,kc as xk,pZ as yk,gp as zk,Sc as Ak,kE as Bk,Oc as Ck,yp as Dk,hp as Ek,bp as Fk,wp as Gk,RE as Hk,xE as Ik,SE as Jk,Ep as Kk,$i as Lk,ft as Mk,Y2 as Nk,uo as Ok,iq as Pk,sq as Qk,aq as Rk,uq as Sk,fq as Tk,mq as Uk,_q as Vk,BE as Wk,gq as Xk,yq as Yk,hq as Zk,XZ as _k,ZZ as $k,xc as al,Ip as bl,WE as cl,VE as dl,vq as el,Eq as fl,YE as gl,Aq as hl,Iq as il,xq as jl,Dq as kl,Pq as ll,Fq as ml,jq as nl,Uq as ol,Xq as pl,Fc as ql,_T as rl,an as sl,JQ as tl,_G as ul,gG as vl,yG as wl,hG as xl,Xp as yl,Jp as zl,Zp as Al,XT as Bl,zc as Cl,JT as Dl,Qp as El,ZT as Fl,em as Gl,tm as Hl,rm as Il,nm as Jl,TG as Kl,om as Ll,im as Ml,kG as Nl,AG as Ol,tk as Pl,QT as Ql,ek as Rl,rk as Sl,nk as Tl,mo as Ul,am as Vl,Cte as Wl,Ite as Xl,Rte as Yl,XG as Zl,xte as _l,qi as $l,um as am,JG as bm,ln as cm,Mte as dm,tB as em,Lte as fm,Bc as gm,Vc as hm,Gc as im,dk as jm,rB as km,Hc as lm,Fte as mm,$te as nm,Vi as om,sB as pm,Jc as qm,aB as rm,Kc as sm,_k as tm,gk as um,yk as vm,hk as wm,bk as xm,wk as ym,vk as zm,Ek as Am,Tk as Bm,kk as Cm,Ak as Dm,Sk as Em,cB as Fm,Ok as Gm,Ck as Hm,hm as Im,Ik as Jm,Rk as Km,bm as Lm,De as Mm,wm as Nm,fm as Om,xk as Pm,Nk as Qm,Dk as Rm,Pk as Sm,Mk as Tm,Lk as Um,Fk as Vm,$k as Wm,jk as Xm,Uk as Ym,zk as Zm,qk as _m,pm as $m,Hk as an,Gk as bn,vm as cn,lB as dn,Bk as en,Vk as fn,Wk as gn,Yk as hn,Kk as in,Xk as jn,Jk as kn,Zk as ln,Qk as mn,eA as nn,Em as on,rA as pn,nA as qn,oA as rn,iA as sn,sA as tn,dB as un,aA as vn,cA as wn,lA as xn,dA as yn,uA as zn,Tm as An,mm as Bn,_A as Cn,gA as Dn,yA as En,hA as Fn,bA as Gn,wA as Hn,vA as In,_m as Jn,EA as Kn,TA as Ln,gm as Mn,kA as Nn,AA as On,SA as Pn,OA as Qn,CA as Rn,Gt as Sn,RA as Tn,xA as Un,NA as Vn,DA as Wn,PA as Xn,gB as Yn,yB as Zn,km as _n,bB as $n,JA as ao,AB as bo,ZA as co,eS as do,MB as eo,HB as fo,xm as go,oS as ho,iS as io,GB as jo,WB as ko,Nm as lo,rl as mo,YB as no,nl as oo,ol as po,Dm as qo,Bt as ro,il as so,sl as to,Pm as uo,Mm as vo,al as wo,Lm as xo,Fm as yo,cl as zo,uV as Ao,Pre as Bo,Mre as Co,Lre as Do,Fre as Eo,$re as Fo,mV as Go,jre as Ho,_V as Io,Ure as Jo,gV as Ko,zre as Lo,qre as Mo,Hre as No,yV as Oo,Gre as Po,Bre as Qo,Vre as Ro,Wre as So,Yre as To,Kre as Uo,Xre as Vo,Jre as Wo,Zre as Xo,Qre as Yo,ene as Zo,tne as _o,rne as $o,nne as ap};
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
237
|
+
`)}function Jre(e){let t=l=>Bt(e,Me(rl,l)),r=l=>{let d=il(e,Me(rl,l));if(typeof d=="string"||typeof d=="number"&&Number.isFinite(d))return d},n=t("fields"),o=e.compact===!0,i=e.full===!0,s=!o&&!i&&n===void 0,c={mode:e.semantic===!0?"semantic":e.hybrid===!0?"hybrid":t("mode"),matchMode:t("matchMode"),minScore:r("minScore"),count:k(e,"count"),semanticWeight:r("semanticWeight"),includeLinked:k(e,"includeLinked"),titleExact:k(e,"titleExact"),phraseExact:k(e,"phraseExact"),highlight:k(e,"highlight"),status:t("status"),type:t("type"),tag:t("tag"),priority:t("priority"),deadlineBefore:t("deadlineBefore"),deadlineAfter:t("deadlineAfter"),updatedAfter:t("updatedAfter"),updatedBefore:t("updatedBefore"),createdAfter:t("createdAfter"),createdBefore:t("createdBefore"),assignee:t("assignee"),sprint:t("sprint"),release:t("release"),parent:t("parent"),limit:t("limit"),fields:n,compact:o||s?!0:void 0,full:k(e,"full"),...uS(e)};return dl(c,e),c}function Zre(e){let t=e.map(r=>r.trim()).filter(r=>r.length>0).join(" ");if(t.length===0)throw new g("Search query must not be empty",_.USAGE);return t}function Qre(e){let t=n=>Bt(e,Me(Dm,n)),r={id:t("id"),op:t("op"),author:t("author"),from:t("from"),to:t("to"),limit:t("limit"),compact:e.full===!0||e.provenance===!0?!1:e.compact===!0||e.raw===!0?!0:void 0,...e.raw===!0||e.compact===!0||e.full===!0?{raw:!0}:{},unbounded:k(e,"unbounded"),provenance:k(e,"provenance"),provenanceSummary:k(e,"provenanceSummary"),harness:Array.isArray(e.harness)?e.harness:void 0,agentInstance:Array.isArray(e.agentInstance)?e.agentInstance:void 0,provenanceFilter:Array.isArray(e.provenanceFilter)?e.provenanceFilter:void 0};return Object.fromEntries(Object.entries(r).filter(([,n])=>n!==void 0))}var bV=new Set(["","rows","ndjson","jsonl","true","1","yes","on"]),wV=new Set(["false","off","none","0"]);function ene(e){if(e===!0)return!0;if(e===!1||e===void 0||e===null)return!1;if(typeof e=="string"){let t=e.trim().toLowerCase();if(bV.has(t))return!0;if(wV.has(t))return!1}throw new g("Activity --stream accepts rows|ndjson|jsonl (or no value)",_.USAGE)}function tne(e){let t=s=>Bt(e,Me(nl,s)),r=s=>lS(e,Me(nl,s)),n=e.section,o=Array.isArray(n)?n.filter(s=>typeof s=="string"&&s.trim().length>0):typeof n=="string"&&n.trim().length>0?[n]:void 0,i={date:t("date"),from:t("from"),to:t("to"),past:e.past===!0?!0:void 0,type:t("type"),tag:t("tag"),priority:t("priority"),assignee:t("assignee"),assigneeFilter:t("assigneeFilter"),sprint:t("sprint"),release:t("release"),parent:t("parent"),limit:t("limit"),format:t("format"),depth:t("depth"),fields:t("fields"),section:o&&o.length>0?o:void 0,activityLimit:t("activityLimit"),staleThreshold:t("staleThreshold"),tokenBudget:r("tokenBudget"),noExtensionHealth:e.extensionHealth===!1?!0:void 0,noTags:e.tags===!1?!0:void 0};for(let[s,a]of Object.entries(e))Object.hasOwn(i,s)||(i[s]=a);return i}function rne(e){let t=o=>Bt(e,Me(ol,o)),r=o=>lS(e,Me(ol,o)),n={type:t("type"),tag:t("tag"),priority:r("priority"),assignee:t("assignee"),assigneeFilter:t("assigneeFilter"),sprint:t("sprint"),release:t("release"),parent:t("parent"),limit:t("limit"),blockedLimit:t("blockedLimit"),readyOnly:e.readyOnly===!0||e.ready_only===!0?!0:void 0,format:t("format"),tokenBudget:r("tokenBudget")};for(let[o,i]of Object.entries(e))Object.hasOwn(n,o)||(n[o]=i);return n}function vV(e){if(!e||typeof e!="object")return[];let t=e,r=new Set,n=a=>{if(typeof a!="string")return;let c=a.trim();c.length!==0&&r.add(c)};n(t.id);let o=t.item;o&&typeof o=="object"&&n(o.id);let i=t.ids;if(Array.isArray(i))for(let a of i)n(a);let s=t.items;if(Array.isArray(s))for(let a of s)!a||typeof a!="object"||n(a.id);return[...r].sort((a,c)=>a.localeCompare(c))}async function nne(e,t){let r=Oo(process.cwd(),e.path),n=await Ep(r,vV(t),{background:!tp()});e.profile&&n.warnings.length>0&&au(`profile:search_refresh_warnings=${yV(n.warnings)}`)}export{EV as a,Yi as b,jm as c,Um as d,Ki as e,Xi as f,mS as g,zm as h,Ke as i,go as j,_S as k,fl as l,gS as m,pl as n,gl as o,yl as p,CV as q,IV as r,RV as s,AS as t,qm as u,xV as v,ts as w,re as x,ho as y,X as z,G as A,z as B,wo as C,Jl as D,hl as E,Hm as F,rs as G,Ct as H,bl as I,MS as J,j as K,LS as L,B as M,Bm as N,zV as O,FS as P,Gm as Q,Vm as R,$S as S,mt as T,os as U,wl as V,HV as W,is as X,ss as Y,as as Z,cs as _,ls as $,Ym as aa,Xe as ba,ds as ca,US as da,zS as ea,YV as fa,Ee as ga,kl as ha,HS as ia,vl as ja,O as ka,_ as la,fs as ma,g as na,hn as oa,Xm as pa,bn as qa,ps as ra,wn as sa,ms as ta,JV as ua,ZV as va,QV as wa,gs as xa,ys as ya,e5 as za,t5 as Aa,r5 as Ba,n5 as Ca,hs as Da,Eo as Ea,Al as Fa,Zm as Ga,bs as Ha,Qm as Ia,e_ as Ja,o5 as Ka,i5 as La,XS as Ma,Il as Na,Rl as Oa,cO as Pa,ko as Qa,vs as Ra,Ao as Sa,c_ as Ta,l_ as Ua,SO as Va,IO as Wa,Es as Xa,u_ as Ya,v5 as Za,Oo as _a,$O as $a,It as ab,Te as bb,vn as cb,Co as db,_t as eb,f_ as fb,xl as gb,Ts as hb,UO as ib,E5 as jb,zO as kb,qO as lb,T5 as mb,k5 as nb,HO as ob,A5 as pb,J as qb,ks as rb,I5 as sb,ot as tb,p_ as ub,Nl as vb,JO as wb,ZO as xb,Ro as yb,Dl as zb,Pl as Ab,Ml as Bb,Ll as Cb,Fl as Db,As as Eb,nd as Fb,eC as Gb,tC as Hb,iC as Ib,sC as Jb,w_ as Kb,eg as Lb,tg as Mb,$l as Nb,jl as Ob,hg as Pb,bg as Qb,L as Rb,ne as Sb,Os as Tb,T_ as Ub,Ul as Vb,k_ as Wb,zl as Xb,ql as Yb,Hl as Zb,Gl as _b,Bl as $b,Vl as ac,Yl as bc,Kl as cc,Xl as dc,cI as ec,dI as fc,Cg as gc,Ig as hc,EI as ic,wW as jc,FI as kc,$I as lc,AW as mc,Dg as nc,jI as oc,fd as pc,qI as qc,HI as rc,jg as sc,Fs as tc,WI as uc,YI as vc,KI as wc,XI as xc,JI as yc,ZI as zc,QI as Ac,Qt as Bc,e0 as Cc,t0 as Dc,er as Ec,r0 as Fc,$s as Gc,Vo as Hc,n0 as Ic,o0 as Jc,Ae as Kc,js as Lc,it as Mc,pd as Nc,i0 as Oc,s0 as Pc,a0 as Qc,c0 as Rc,Ze as Sc,Ko as Tc,Wg as Uc,l0 as Vc,d0 as Wc,u0 as Xc,Us as Yc,jW as Zc,Bg as _c,Vg as $c,Dt as ad,HW as bd,WW as cd,Yg as dd,m0 as ed,_0 as fd,YW as gd,gt as hd,KW as id,w0 as jd,T0 as kd,I0 as ld,Zg as md,t3 as nd,r3 as od,Wo as pd,gd as qd,yd as rd,n3 as sd,D0 as td,o3 as ud,i3 as vd,ry as wd,zs as xd,M0 as yd,tr as zd,Cn as Ad,qs as Bd,Hs as Cd,Yo as Dd,ny as Ed,Pd as Fd,ti as Gd,V0 as Hd,dy as Id,wd as Jd,K0 as Kd,vd as Ld,Bs as Md,fy as Nd,J0 as Od,Ed as Pd,my as Qd,p3 as Rd,_y as Sd,gy as Td,yy as Ud,nR as Vd,oR as Wd,hy as Xd,Jo as Yd,h3 as Zd,iR as _d,by as $d,wy as ae,vy as be,Td as ce,st as de,Ey as ee,sR as fe,aR as ge,cR as he,lR as ie,dR as je,uR as ke,fR as le,ky as me,mR as ne,kd as oe,Ay as pe,Sy as qe,Oy as re,Ad as se,Cy as te,Iy as ue,Sd as ve,nr as we,Od as xe,DR as ye,PR as ze,Ny as Ae,Vs as Be,Id as Ce,Rd as De,xd as Ee,ei as Fe,Ks as Ge,Fy as He,Nd as Ie,$y as Je,Mr as Ke,Vy as Le,Yy as Me,Ky as Ne,BR as Oe,yt as Pe,W3 as Qe,Fd as Re,JR as Se,Y3 as Te,th as Ue,jd as Ve,ih as We,sh as Xe,ah as Ye,vx as Ze,Ex as _e,Q3 as $e,Q as af,Mt as bf,Hd as cf,Dn as df,we as ef,i9 as ff,zx as gf,oe as hf,Ft as if,fe as jf,I9 as kf,Mn as lf,yN as mf,R9 as nf,x9 as of,hN as pf,N9 as qf,D9 as rf,P9 as sf,Mh as tf,EN as uf,G9 as vf,kN as wf,Fh as xf,B9 as yf,jh as zf,SN as Af,RN as Bf,Uh as Cf,Hh as Df,$t as Ef,$n as Ff,aa as Gf,Xh as Hf,au as If,fu as Jf,jn as Kf,fD as Lf,b8 as Mf,mD as Nf,Zh as Of,$r as Pf,cr as Qf,bi as Rf,Qh as Sf,Ue as Tf,Se as Uf,_u as Vf,ht as Wf,xe as Xf,BD as Yf,cb as Zf,gu as _f,ma as $f,yu as ag,db as bg,YD as cg,nP as dg,oP as eg,Un as fg,mb as gg,U8 as hg,_b as ig,iP as jg,z8 as kg,zr as lg,gb as mg,aP as ng,ya as og,ui as pg,hM as qg,qr as rg,fi as sg,et as tg,Iu as ug,Sb as vg,Ob as wg,Ru as xg,Cb as yg,u6 as zg,Ib as Ag,f6 as Bg,wa as Cg,dr as Dg,Ea as Eg,CM as Fg,IM as Gg,Pb as Hg,Lu as Ig,T6 as Jg,k6 as Kg,A6 as Lg,PM as Mg,MM as Ng,LM as Og,Bu as Pg,Vu as Qg,Wu as Rg,M6 as Sg,aL as Tg,cL as Ug,lL as Vg,dL as Wg,uL as Xg,pi as Yg,Ju as Zg,Zu as _g,mL as $g,L6 as ah,_L as bh,Qu as ch,mi as dh,gL as eh,qe as fh,G6 as gh,yL as hh,hL as ih,Vn as jh,FL as kh,nY as lh,oY as mh,iY as nh,BL as oh,La as ph,mr as qh,Yn as rh,pw as sh,mw as th,df as uh,Wr as vh,YL as wh,ja as xh,yi as yh,uf as zh,Ua as Ah,sF as Bh,ff as Ch,gw as Dh,aF as Eh,jt as Fh,Ut as Gh,Kn as Hh,Xn as Ih,$Y as Jh,pf as Kh,hi as Lh,lF as Mh,dF as Nh,_f as Oh,gf as Ph,ct as Qh,hF as Rh,wF as Sh,jY as Th,TF as Uh,Tw as Vh,yf as Wh,kw as Xh,YY as Yh,_r as Zh,Kr as _h,kF as $h,AF as ai,wf as bi,vf as ci,SF as di,OF as ei,CF as fi,mK as gi,Va as hi,t$ as ii,hr as ji,dt as ki,ki as li,tv as mi,eo as ni,qt as oi,N$ as pi,P$ as qi,L$ as ri,F$ as si,$$ as ti,j$ as ui,Pf as vi,JK as wi,Ja as xi,Ai as yi,W$ as zi,X$ as Ai,Za as Bi,cv as Ci,lj as Di,dj as Ei,uj as Fi,jf as Gi,bj as Hi,uc as Ii,Bj as Ji,fc as Ki,Ni as Li,Di as Mi,Pi as Ni,o1 as Oi,Ov as Pi,i1 as Qi,dX as Ri,Vf as Si,Cv as Ti,u1 as Ui,uX as Vi,f1 as Wi,p1 as Xi,g1 as Yi,h1 as Zi,w1 as _i,v1 as $i,AX as aj,T1 as bj,OX as cj,k1 as dj,A1 as ej,CX as fj,NX as gj,Mv as hj,S1 as ij,O1 as jj,C1 as kj,I1 as lj,M1 as mj,$1 as nj,DX as oj,j1 as pj,Uv as qj,z1 as rj,q1 as sj,PX as tj,H1 as uj,pc as vj,MX as wj,oo as xj,B1 as yj,V1 as zj,Kf as Aj,zv as Bj,J1 as Cj,Xf as Dj,Z1 as Ej,tU as Fj,ZX as Gj,nU as Hj,Hv as Ij,oU as Jj,iU as Kj,cU as Lj,iJ as Mj,uU as Nj,uJ as Oj,_U as Pj,yU as Qj,hU as Rj,bU as Sj,wU as Tj,Qf as Uj,TU as Vj,wJ as Wj,vJ as Xj,EJ as Yj,TJ as Zj,kJ as _j,AJ as $j,SJ as ak,OU as bk,CU as ck,IU as dk,RU as ek,xU as fk,NU as gk,io as hk,sE as ik,tp as jk,WJ as kk,QJ as lk,bc as mk,gE as nk,op as ok,kz as pk,Az as qk,rZ as rk,yE as sk,so as tk,sp as uk,cp as vk,kc as wk,pZ as xk,gp as yk,Sc as zk,kE as Ak,Oc as Bk,yp as Ck,hp as Dk,bp as Ek,wp as Fk,RE as Gk,xE as Hk,SE as Ik,Ep as Jk,$i as Kk,ft as Lk,Y2 as Mk,uo as Nk,iq as Ok,sq as Pk,aq as Qk,uq as Rk,fq as Sk,mq as Tk,_q as Uk,BE as Vk,gq as Wk,yq as Xk,hq as Yk,XZ as Zk,ZZ as _k,xc as $k,Ip as al,WE as bl,VE as cl,vq as dl,Eq as el,YE as fl,Aq as gl,Iq as hl,xq as il,Dq as jl,Pq as kl,Fq as ll,jq as ml,Uq as nl,Xq as ol,Fc as pl,_T as ql,an as rl,JQ as sl,_G as tl,gG as ul,yG as vl,hG as wl,Xp as xl,Jp as yl,Zp as zl,XT as Al,zc as Bl,JT as Cl,Qp as Dl,ZT as El,em as Fl,tm as Gl,rm as Hl,nm as Il,TG as Jl,om as Kl,im as Ll,kG as Ml,AG as Nl,tk as Ol,QT as Pl,ek as Ql,rk as Rl,nk as Sl,mo as Tl,am as Ul,Cte as Vl,Ite as Wl,Rte as Xl,XG as Yl,xte as Zl,qi as _l,um as $l,JG as am,ln as bm,Mte as cm,tB as dm,Lte as em,Bc as fm,Vc as gm,Gc as hm,dk as im,rB as jm,Hc as km,Fte as lm,$te as mm,Vi as nm,sB as om,Jc as pm,aB as qm,Kc as rm,_k as sm,gk as tm,yk as um,hk as vm,bk as wm,wk as xm,vk as ym,Ek as zm,Tk as Am,kk as Bm,Ak as Cm,Sk as Dm,cB as Em,Ok as Fm,Ck as Gm,hm as Hm,Ik as Im,Rk as Jm,bm as Km,De as Lm,wm as Mm,fm as Nm,xk as Om,Nk as Pm,Dk as Qm,Pk as Rm,Mk as Sm,Lk as Tm,Fk as Um,$k as Vm,jk as Wm,Uk as Xm,zk as Ym,qk as Zm,pm as _m,Hk as $m,Gk as an,vm as bn,lB as cn,Bk as dn,Vk as en,Wk as fn,Yk as gn,Kk as hn,Xk as in,Jk as jn,Zk as kn,Qk as ln,eA as mn,Em as nn,rA as on,nA as pn,oA as qn,iA as rn,sA as sn,dB as tn,aA as un,cA as vn,lA as wn,dA as xn,uA as yn,Tm as zn,mm as An,_A as Bn,gA as Cn,yA as Dn,hA as En,bA as Fn,wA as Gn,vA as Hn,_m as In,EA as Jn,TA as Kn,gm as Ln,kA as Mn,AA as Nn,SA as On,OA as Pn,CA as Qn,Gt as Rn,RA as Sn,xA as Tn,NA as Un,DA as Vn,PA as Wn,gB as Xn,yB as Yn,km as Zn,bB as _n,JA as $n,AB as ao,ZA as bo,eS as co,MB as do,HB as eo,xm as fo,oS as go,iS as ho,GB as io,WB as jo,Nm as ko,rl as lo,YB as mo,nl as no,ol as oo,Dm as po,Bt as qo,il as ro,sl as so,Pm as to,Mm as uo,al as vo,Lm as wo,Fm as xo,cl as yo,uV as zo,Pre as Ao,Mre as Bo,Lre as Co,Fre as Do,$re as Eo,mV as Fo,jre as Go,_V as Ho,Ure as Io,gV as Jo,zre as Ko,qre as Lo,Hre as Mo,yV as No,Gre as Oo,Bre as Po,Vre as Qo,Wre as Ro,Yre as So,Kre as To,Xre as Uo,Jre as Vo,Zre as Wo,Qre as Xo,ene as Yo,tne as Zo,rne as _o,nne as $o};
|
|
238
|
+
//# sourceMappingURL=chunk-CM57QHVK.js.map
|