@unbrained/pm-cli 2026.10.4 → 2026.10.6
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 +37 -1
- package/dist/cli/after-command-context-usage.js +1 -1
- package/dist/cli/argv-utils.js +1 -1
- package/dist/cli/bootstrap-args.js +1 -1
- package/dist/cli/bundle-integrity.js +2 -2
- package/dist/cli/command-namespaces.js +1 -1
- package/dist/cli/commander-usage.d.ts +1 -1
- package/dist/cli/commander-usage.js +7 -4
- package/dist/cli/commands/annotations/comments.js +1 -1
- package/dist/cli/commands/annotations/docs.js +1 -1
- package/dist/cli/commands/annotations/files.js +1 -1
- package/dist/cli/commands/annotations/learnings.js +1 -1
- package/dist/cli/commands/annotations/notes.js +1 -1
- package/dist/cli/commands/extension/describe.js +1 -1
- package/dist/cli/commands/extension/extension.js +1 -1
- package/dist/cli/commands/extension/scaffold.js +1 -1
- package/dist/cli/commands/extension/shared.js +1 -1
- package/dist/cli/commands/governance/gc.js +1 -1
- package/dist/cli/commands/governance/health.js +1 -1
- package/dist/cli/commands/governance/telemetry.js +1 -1
- package/dist/cli/commands/governance/validate.js +1 -1
- package/dist/cli/commands/history/activity.js +1 -1
- package/dist/cli/commands/history/history-compact.js +1 -1
- package/dist/cli/commands/history/history-redact.js +1 -1
- package/dist/cli/commands/history/history-repair.js +1 -1
- package/dist/cli/commands/history/history.js +1 -1
- package/dist/cli/commands/history/restore.js +1 -1
- package/dist/cli/commands/lifecycle/append.js +1 -1
- package/dist/cli/commands/lifecycle/claim.js +1 -1
- package/dist/cli/commands/lifecycle/close-many.js +1 -1
- package/dist/cli/commands/lifecycle/close.js +1 -1
- package/dist/cli/commands/lifecycle/copy.js +1 -1
- package/dist/cli/commands/lifecycle/create.js +1 -1
- package/dist/cli/commands/lifecycle/delete.js +1 -1
- package/dist/cli/commands/lifecycle/focus.js +1 -1
- package/dist/cli/commands/lifecycle/plan.js +1 -1
- package/dist/cli/commands/lifecycle/update-many.js +1 -1
- package/dist/cli/commands/lifecycle/update.js +1 -1
- package/dist/cli/commands/query/aggregate.js +1 -1
- package/dist/cli/commands/query/context.js +1 -1
- package/dist/cli/commands/query/deps.js +1 -1
- package/dist/cli/commands/query/duplicates.js +1 -1
- package/dist/cli/commands/query/eval.js +1 -1
- package/dist/cli/commands/query/get.js +1 -1
- package/dist/cli/commands/query/graph.js +1 -1
- package/dist/cli/commands/query/list.js +1 -1
- package/dist/cli/commands/query/next.js +1 -1
- package/dist/cli/commands/query/search.js +1 -1
- package/dist/cli/commands/query/stats.js +1 -1
- package/dist/cli/commands/test/test-all.js +1 -1
- package/dist/cli/commands/test/test-runs.js +1 -1
- package/dist/cli/commands/test/test.js +1 -1
- package/dist/cli/commands/workspace/config.js +1 -1
- package/dist/cli/commands/workspace/contracts.js +1 -1
- package/dist/cli/commands/workspace/init.js +1 -1
- package/dist/cli/commands/workspace/merge.js +1 -1
- package/dist/cli/commands/workspace/profile.js +1 -1
- package/dist/cli/commands/workspace/schema.js +1 -1
- package/dist/cli/commands/workspace/upgrade.js +1 -1
- package/dist/cli/context-intent-invocation.js +1 -1
- package/dist/cli/description-stdin.js +1 -1
- package/dist/cli/error-guidance.js +3 -1
- package/dist/cli/extension-command-help.js +5 -3
- package/dist/cli/extension-command-options.js +1 -1
- package/dist/cli/extension-recovery.js +1 -1
- package/dist/cli/help-content.js +5 -2
- package/dist/cli/help-json-payload.js +6 -3
- package/dist/cli/invocation-profile.js +2 -2
- package/dist/cli/main.js +5 -5
- package/dist/cli/migration-gates.js +1 -1
- package/dist/cli/option-values.js +1 -1
- package/dist/cli/public.js +1 -1
- package/dist/cli/register-annotations.js +1 -1
- package/dist/cli/register-assurance.js +1 -1
- package/dist/cli/register-files-lookup.js +1 -1
- package/dist/cli/register-history-activity.js +1 -1
- package/dist/cli/register-history-author.js +1 -1
- package/dist/cli/register-history-maintenance.js +2 -2
- package/dist/cli/register-list-query.js +10 -10
- package/dist/cli/register-mutation-options.js +1 -1
- package/dist/cli/register-mutation.js +2 -2
- package/dist/cli/register-operations.js +1 -1
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/register-structured-mutation.js +1 -1
- package/dist/cli/registration-helpers.js +1 -1
- package/dist/cli/runtime/activation.js +1 -1
- package/dist/cli/runtime/invocation-options.js +1 -1
- package/dist/cli/runtime/projection-retry.js +1 -1
- package/dist/cli/runtime/selection.js +1 -1
- package/dist/cli/runtime/telemetry-outcome.js +1 -1
- package/dist/cli/runtime-compatibility-boundary.js +4 -4
- package/dist/cli/schema/registration.js +2 -2
- package/dist/cli/schema-registration-helpers.js +1 -1
- package/dist/cli/search-refresh.js +1 -1
- package/dist/cli/stats-analytics-json.js +1 -1
- package/dist/cli/telemetry-flush.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +163 -163
- package/dist/cli-bundle/chunks/{chunk-SMKHR6BM.js → chunk-25EW53VO.js} +89 -88
- package/dist/cli-bundle/chunks/chunk-3CCVTV6Q.js +8 -0
- package/dist/cli-bundle/chunks/chunk-3REXBTST.js +3 -0
- package/dist/cli-bundle/chunks/chunk-4WB55TBC.js +80 -0
- package/dist/cli-bundle/chunks/{chunk-7CE2DJMA.js → chunk-6STTPXOC.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ATB4ZZBQ.js +20 -0
- package/dist/cli-bundle/chunks/chunk-D4G43LBV.js +238 -0
- package/dist/cli-bundle/chunks/chunk-K6D6DMRT.js +31 -0
- package/dist/cli-bundle/chunks/chunk-KIRHWPZB.js +2 -0
- package/dist/cli-bundle/chunks/chunk-O67BH435.js +6 -0
- package/dist/cli-bundle/chunks/chunk-R7CG2DB7.js +2 -0
- package/dist/cli-bundle/chunks/chunk-RJHLD64E.js +3 -0
- package/dist/cli-bundle/chunks/chunk-TUKO5NF7.js +2 -0
- package/dist/cli-bundle/chunks/chunk-UZ7BIUCI.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-GZMWISWW.js → chunk-XJD47LUH.js} +3 -3
- package/dist/cli-bundle/chunks/{register-list-query-QBGXO5JJ.js → register-list-query-53WYLNZT.js} +11 -11
- package/dist/cli-bundle/chunks/register-mutation-34XXUBVI.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-WANO6EIM.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-WT37UPBQ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-6KFKQD2D.js +165 -0
- package/dist/cli-bundle/focused-chunks/chunk-FOHRPFIT.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-GRQXL5G5.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-467EW5RL.js → chunk-JZ4WGUVH.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-NM3PM6O6.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-OT7HK7SG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-Q6DJ5DFQ.js → chunk-PCLU34KB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HFAW3FJQ.js → chunk-PSXFFQFT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-QQIE4L42.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-RPUNVKXK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-RXSVJPZ7.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-SPN5QTZ3.js +30 -0
- package/dist/cli-bundle/focused-chunks/chunk-SUZJNPGB.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-W4BG5HHS.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Y5HXFDTZ.js +20 -0
- package/dist/cli-bundle/focused-chunks/chunk-ZK5SOOPC.js +75 -0
- package/dist/cli-bundle/focused-chunks/chunk-ZQK2XUSS.js +12 -0
- package/dist/cli-bundle/main.js +25 -25
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +25 -24
- 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 +55 -55
- 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 +10 -10
- package/dist/cli.js +1 -1
- package/dist/core/checkpoint/checkpoint-gc.js +1 -1
- package/dist/core/checkpoint/mutation-checkpoint.js +2 -2
- package/dist/core/config/nested-settings.js +1 -1
- package/dist/core/config/positional-value.js +1 -1
- package/dist/core/diagnostics/remediation.js +1 -1
- package/dist/core/extensions/activation-summary-markdown.js +2 -1
- package/dist/core/extensions/activation-summary.js +1 -1
- package/dist/core/extensions/activation-transaction.js +1 -1
- package/dist/core/extensions/capability-usage.js +1 -1
- package/dist/core/extensions/command-hook-context.js +1 -1
- package/dist/core/extensions/command-metadata-contract.js +1 -1
- package/dist/core/extensions/command-visibility-tier.js +1 -1
- package/dist/core/extensions/contribution-inventory.js +1 -1
- package/dist/core/extensions/exporter-output-contract.js +1 -1
- package/dist/core/extensions/extension-candidate.js +1 -1
- package/dist/core/extensions/extension-capability-aliases.js +1 -1
- package/dist/core/extensions/extension-hook-runtime.js +1 -1
- package/dist/core/extensions/extension-policy.js +1 -1
- package/dist/core/extensions/extension-registries.js +1 -1
- package/dist/core/extensions/extension-runtime-helpers.js +1 -1
- package/dist/core/extensions/extension-types.d.ts +2 -0
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/extensions/flag-definition-validation.js +1 -1
- package/dist/core/extensions/flag-value-types.js +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/item-field-types.js +1 -1
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/manifest-parser.js +1 -1
- package/dist/core/extensions/manifest-schema.js +1 -1
- package/dist/core/extensions/module-graph-snapshot.js +1 -1
- package/dist/core/extensions/preflight-ownership.js +1 -1
- package/dist/core/extensions/registration-contracts.js +1 -1
- package/dist/core/extensions/registration-validation.js +1 -1
- package/dist/core/extensions/registration-values.js +1 -1
- package/dist/core/extensions/reserved-host-flags.js +1 -1
- package/dist/core/extensions/runtime-registrations.js +1 -1
- package/dist/core/extensions/service-ownership.js +1 -1
- package/dist/core/extensions/version-compat.js +1 -1
- package/dist/core/fs/atomic-create.js +1 -1
- package/dist/core/fs/fs-utils.js +2 -2
- package/dist/core/fs/host-environment-errors.js +1 -1
- package/dist/core/fs/index.js +1 -1
- package/dist/core/fs/path-utils.js +1 -1
- package/dist/core/governance/content-fields.js +1 -1
- package/dist/core/governance/issue-codes.js +1 -1
- package/dist/core/governance/metadata-coverage.js +1 -1
- package/dist/core/history/digest.js +1 -1
- package/dist/core/history/drift-cache.js +3 -3
- package/dist/core/history/drift-scan.d.ts +4 -0
- package/dist/core/history/drift-scan.js +1 -1
- package/dist/core/history/event-classification.js +1 -1
- package/dist/core/history/event-index.js +8 -7
- package/dist/core/history/history-compact-bulk.js +1 -1
- package/dist/core/history/history-diff.js +1 -1
- package/dist/core/history/history-rewrite.js +1 -1
- package/dist/core/history/history-storage-stats.js +1 -1
- package/dist/core/history/history-stream-policy.js +1 -1
- package/dist/core/history/history.js +2 -2
- package/dist/core/history/identity.js +1 -1
- package/dist/core/history/index.js +1 -1
- package/dist/core/history/operation-contract.js +1 -1
- package/dist/core/history/projection.js +1 -1
- package/dist/core/history/read.js +1 -1
- package/dist/core/history/replay.js +2 -1
- package/dist/core/history/tombstone.js +1 -1
- package/dist/core/history/version-address.js +1 -1
- package/dist/core/history/workspace-history.js +2 -2
- package/dist/core/io/body-file.js +1 -1
- package/dist/core/io/bulk-ids-input.js +2 -1
- package/dist/core/item/actionability.js +1 -1
- package/dist/core/item/dependency-reference.js +1 -1
- package/dist/core/item/id.js +1 -1
- package/dist/core/item/index.js +1 -1
- package/dist/core/item/item-format-version.js +1 -1
- package/dist/core/item/item-format.js +6 -4
- package/dist/core/item/item-record.js +1 -1
- package/dist/core/item/item-type-definition.js +1 -1
- package/dist/core/item/parent-reference-policy.js +1 -1
- package/dist/core/item/parse.js +8 -2
- package/dist/core/item/plan-lifecycle.js +1 -1
- package/dist/core/item/priority.js +1 -1
- package/dist/core/item/sprint-release-format.js +1 -1
- package/dist/core/item/status-filter.js +1 -1
- package/dist/core/item/status.js +1 -1
- package/dist/core/item/toon-decode.js +1 -1
- package/dist/core/item/type-registry.js +1 -1
- package/dist/core/item/type-synonyms.js +1 -1
- package/dist/core/lock/index.js +1 -1
- package/dist/core/lock/lock-gc.js +1 -1
- package/dist/core/lock/lock.js +3 -3
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/output/output-control.js +1 -1
- package/dist/core/output/output.js +22 -10
- package/dist/core/output/query-summary.js +1 -1
- package/dist/core/output/tabular.js +3 -1
- package/dist/core/packages/manifest.js +1 -1
- package/dist/core/packages/root.js +1 -1
- package/dist/core/policy/workflow-policy-schema.js +1 -1
- package/dist/core/policy/workflow-policy-store.js +1 -1
- package/dist/core/policy/workflow-policy.js +1 -1
- package/dist/core/profile/profile-describe.js +1 -1
- package/dist/core/profile/profile-lint.js +1 -1
- package/dist/core/profile/profile-plan.js +1 -1
- package/dist/core/profile/profile-presets.js +25 -1
- package/dist/core/reproducibility/context.js +1 -1
- package/dist/core/schema/fields-file.js +2 -2
- package/dist/core/schema/item-types-file.js +2 -2
- package/dist/core/schema/runtime-field-filters.js +1 -1
- package/dist/core/schema/runtime-field-values.js +1 -1
- package/dist/core/schema/runtime-schema.js +2 -2
- package/dist/core/schema/status-defs-file.js +2 -2
- package/dist/core/schema/status-token.js +1 -1
- package/dist/core/schema/type-inference.js +1 -1
- package/dist/core/schema/type-presets.js +1 -1
- package/dist/core/schema/type-workflows.js +1 -1
- package/dist/core/search/background-refresh.js +2 -2
- package/dist/core/search/bm25.js +1 -1
- package/dist/core/search/cache.js +2 -2
- package/dist/core/search/corpus.js +1 -1
- package/dist/core/search/embedding-batches.js +1 -1
- package/dist/core/search/eval-thresholds.js +1 -1
- package/dist/core/search/eval.js +1 -1
- package/dist/core/search/http-client.js +1 -1
- package/dist/core/search/providers.js +1 -1
- package/dist/core/search/relevance.js +1 -1
- package/dist/core/search/semantic-defaults.js +1 -1
- package/dist/core/search/staleness.js +1 -1
- package/dist/core/search/vector-stores.js +2 -2
- package/dist/core/search/vectorization-metadata.js +1 -1
- package/dist/core/sentry/helpers.js +1 -1
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/session/session-state.js +1 -1
- package/dist/core/shared/agent-session-context.js +1 -1
- package/dist/core/shared/author.js +5 -1
- package/dist/core/shared/command-line.js +1 -1
- package/dist/core/shared/command-types.js +1 -1
- package/dist/core/shared/conflict-markers.js +1 -1
- package/dist/core/shared/constants.js +1 -1
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/shared/html-entity-decode.js +1 -1
- package/dist/core/shared/index.js +1 -1
- package/dist/core/shared/item-metadata-contract.js +1 -1
- package/dist/core/shared/lazy-module.js +1 -1
- package/dist/core/shared/levenshtein.js +1 -1
- package/dist/core/shared/memo.js +1 -1
- package/dist/core/shared/numeric-parsers.js +1 -1
- package/dist/core/shared/option-alias-visibility.js +1 -1
- package/dist/core/shared/primitives.js +1 -1
- package/dist/core/shared/secret-rules.js +1 -1
- package/dist/core/shared/serial-queue.js +1 -1
- package/dist/core/shared/serialization.js +1 -1
- package/dist/core/shared/split-comma-list.js +1 -1
- package/dist/core/shared/text-normalization.js +1 -1
- package/dist/core/shared/time.js +2 -1
- package/dist/core/store/index.js +1 -1
- package/dist/core/store/item-format-migration.js +1 -1
- package/dist/core/store/item-metadata-cache.js +1 -1
- package/dist/core/store/item-metadata-query-index.js +7 -7
- package/dist/core/store/item-metadata-read-work.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/paths.js +1 -1
- package/dist/core/store/settings-concurrency.js +1 -1
- package/dist/core/store/settings-read-cache.js +1 -1
- package/dist/core/store/settings-validator.js +1 -1
- package/dist/core/store/settings.js +3 -3
- package/dist/core/store/tracker-preflight.js +1 -1
- package/dist/core/telemetry/consent.js +2 -2
- package/dist/core/telemetry/observability.js +1 -1
- package/dist/core/telemetry/policy.js +1 -1
- package/dist/core/telemetry/read-sampling.js +2 -2
- package/dist/core/telemetry/runtime.js +9 -5
- package/dist/core/test/background-runs.js +3 -3
- package/dist/core/test/item-test-run-tracking.js +1 -1
- package/dist/core/test/run-selectors.js +1 -1
- package/dist/core/validate/estimate-defaults.js +1 -1
- package/dist/core/validate/fix-planning.js +1 -1
- package/dist/core/validate/linked-artifact-reference.js +1 -1
- package/dist/core/validate/missing-by-type.js +1 -1
- package/dist/core/validate/missing-link-owners.js +1 -1
- package/dist/core/validate/stale-file-classification.js +1 -1
- package/dist/mcp/http-server.js +6 -4
- package/dist/mcp/legacy-adapter.js +1 -1
- package/dist/mcp/runtime-capabilities.js +1 -1
- package/dist/mcp/server.js +4 -4
- package/dist/mcp/tool-definitions.js +1 -1
- package/dist/sdk/actionability.js +1 -1
- package/dist/sdk/agent/closed-domain-contracts.js +1 -1
- package/dist/sdk/agent/command-recovery.js +1 -1
- package/dist/sdk/agent/command-suggestions.js +1 -1
- package/dist/sdk/agent/create-option-policy.js +1 -1
- package/dist/sdk/agent/identity-config.js +1 -1
- package/dist/sdk/agent/item-addressing.js +1 -1
- package/dist/sdk/agent/refusal-closure-census.js +2 -1
- package/dist/sdk/agent/refusal-closure.js +1 -1
- package/dist/sdk/agent/refusal-corpus-contracts.js +1 -1
- package/dist/sdk/agent/refusal-reachability.js +3 -1
- package/dist/sdk/agent/subcommand-recovery.js +1 -1
- package/dist/sdk/agent/task-transcript-contracts.js +1 -1
- package/dist/sdk/agent/tracker-preflight-contracts.js +1 -1
- package/dist/sdk/agent-capability-contracts.js +3 -1
- package/dist/sdk/agent-session-context.js +1 -1
- package/dist/sdk/annotations.js +1 -1
- package/dist/sdk/author-attribution.js +1 -1
- package/dist/sdk/authoring.js +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +5 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/agent-output-contracts.js +5 -3
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -1
- package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
- package/dist/sdk/cli-contracts/commander-types.js +1 -1
- package/dist/sdk/cli-contracts/completeness.js +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +2 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.js +7 -7
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -1
- package/dist/sdk/cli-contracts/string-lists.js +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts/typed-action-inputs.js +1 -1
- package/dist/sdk/cli-contracts.js +1 -1
- package/dist/sdk/cli-program.js +1 -1
- package/dist/sdk/command-line.js +1 -1
- package/dist/sdk/comments.js +1 -1
- package/dist/sdk/compile-cache.js +1 -1
- package/dist/sdk/completion/bash.js +2 -1
- package/dist/sdk/completion/fish.js +13 -7
- package/dist/sdk/completion/shared.js +1 -1
- package/dist/sdk/completion/zsh.js +14 -8
- package/dist/sdk/completion.js +1 -1
- package/dist/sdk/compose.js +1 -1
- package/dist/sdk/config.js +1 -1
- package/dist/sdk/context/recency.js +1 -1
- package/dist/sdk/context/semantic-session-attribution.js +1 -1
- package/dist/sdk/context/usage-egress.js +1 -1
- package/dist/sdk/context/usage-ledger.js +6 -3
- package/dist/sdk/context-intent-contracts.js +1 -1
- package/dist/sdk/context-intent-runtime.js +1 -1
- package/dist/sdk/context-packing.js +1 -1
- package/dist/sdk/context-relevance.js +1 -1
- package/dist/sdk/context-signal-store.js +2 -2
- package/dist/sdk/context-usage.js +1 -1
- package/dist/sdk/contracts.js +1 -1
- package/dist/sdk/core-governance.js +1 -1
- package/dist/sdk/core.js +1 -1
- package/dist/sdk/corpus-shape.js +1 -1
- package/dist/sdk/define.js +1 -1
- package/dist/sdk/dependencies.js +1 -1
- package/dist/sdk/dependency-flag-validation.js +1 -1
- package/dist/sdk/dependency-provenance.js +1 -1
- package/dist/sdk/docs.js +1 -1
- package/dist/sdk/duplicates.js +1 -1
- package/dist/sdk/environment/agent-environment.js +1 -1
- package/dist/sdk/environment/host-environment-errors.js +1 -1
- package/dist/sdk/environment/project-runtime-compatibility.js +2 -1
- package/dist/sdk/environment/source-context.js +1 -1
- package/dist/sdk/environment/tracker-preflight.js +1 -1
- package/dist/sdk/error-code-catalog.js +1 -1
- package/dist/sdk/error-runtime.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/eval.js +1 -1
- package/dist/sdk/extension/author-manifest.js +1 -1
- package/dist/sdk/extension/bundled-catalog.js +1 -1
- package/dist/sdk/extension/concurrency.js +1 -1
- package/dist/sdk/extension/copy-scope.js +1 -1
- package/dist/sdk/extension/custom-field-collisions.js +1 -1
- package/dist/sdk/extension/describe.js +4 -2
- package/dist/sdk/extension/doctor.js +1 -1
- package/dist/sdk/extension/install-plan.js +1 -1
- package/dist/sdk/extension/install-receipts.js +1 -1
- package/dist/sdk/extension/install-runtime.js +3 -3
- package/dist/sdk/extension/install-snapshot.js +1 -1
- package/dist/sdk/extension/install-sources.js +5 -5
- package/dist/sdk/extension/managed-state.d.ts +2 -0
- package/dist/sdk/extension/managed-state.js +2 -2
- package/dist/sdk/extension/managed-update-status.d.ts +3 -0
- package/dist/sdk/extension/managed-update-status.js +2 -0
- package/dist/sdk/extension/migrations.js +2 -2
- package/dist/sdk/extension/output-ownership.js +1 -1
- package/dist/sdk/extension/runtime-summary.js +1 -1
- package/dist/sdk/extension/scaffold.js +11 -4
- package/dist/sdk/extension/shared.js +1 -1
- package/dist/sdk/extension/source-resolution.d.ts +2 -6
- package/dist/sdk/extension/source-resolution.js +1 -1
- package/dist/sdk/extension/static-inventory.js +1 -1
- package/dist/sdk/extension/update-check.d.ts +10 -0
- package/dist/sdk/extension/update-check.js +1 -1
- package/dist/sdk/extension-command-context.js +2 -1
- package/dist/sdk/extension-contracts.js +1 -1
- package/dist/sdk/extension.d.ts +4 -0
- package/dist/sdk/extension.js +1 -1
- package/dist/sdk/files.js +1 -1
- package/dist/sdk/flag-invocation-contracts.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/generated-error-code-catalog.js +1 -1
- package/dist/sdk/governance/assurance-action-contracts.js +1 -1
- package/dist/sdk/governance/assurance-action.js +1 -1
- package/dist/sdk/governance/assurance-limits.js +1 -1
- package/dist/sdk/governance/assurance-mutation-error.js +1 -1
- package/dist/sdk/governance/assurance-presets.js +1 -1
- package/dist/sdk/governance/assurance-runtime.js +1 -1
- package/dist/sdk/governance/assurance.js +4 -4
- package/dist/sdk/governance/boundary-fixtures.js +1 -1
- package/dist/sdk/governance/closure-timestamps.js +1 -1
- package/dist/sdk/governance/coverage-assurance.js +1 -1
- package/dist/sdk/governance/defect-recurrence-coverage.js +1 -1
- package/dist/sdk/governance/defect-recurrence-graph.js +1 -1
- package/dist/sdk/governance/defect-recurrence-signals.js +1 -1
- package/dist/sdk/governance/defect-recurrence.js +1 -1
- package/dist/sdk/governance/extension-host-version.js +1 -1
- package/dist/sdk/governance/gc.js +1 -1
- package/dist/sdk/governance/health-merge-evidence.js +1 -1
- package/dist/sdk/governance/health.js +2 -1
- package/dist/sdk/governance/hierarchy-validation.js +1 -1
- package/dist/sdk/governance/linked-file-report.js +1 -1
- package/dist/sdk/governance/merge-receipt-history.js +1 -1
- package/dist/sdk/governance/provenance-health.js +4 -1
- package/dist/sdk/governance/reindex.js +5 -4
- package/dist/sdk/governance/stale-work.js +1 -1
- package/dist/sdk/governance/status-role-diagnostics.js +1 -1
- package/dist/sdk/governance/storage-integrity.js +1 -1
- package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
- package/dist/sdk/governance/upgrade.js +2 -2
- package/dist/sdk/governance/validate-history-drift.js +1 -1
- package/dist/sdk/governance/validate-item-reader.js +1 -1
- package/dist/sdk/governance/validate-normalization.js +1 -1
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/governance/workflow-completeness.js +1 -1
- package/dist/sdk/governance/workflow-policy.js +3 -3
- package/dist/sdk/governance/workspace-position.js +2 -1
- package/dist/sdk/governance.js +1 -1
- package/dist/sdk/graph/adapter.js +1 -1
- package/dist/sdk/graph/analytics.js +1 -1
- package/dist/sdk/graph/assembly.js +1 -1
- package/dist/sdk/graph/cache.js +1 -1
- package/dist/sdk/graph/centrality.js +1 -1
- package/dist/sdk/graph/conformance.js +1 -1
- package/dist/sdk/graph/deadline-scheduling.js +1 -1
- package/dist/sdk/graph/durable-cache.js +1 -1
- package/dist/sdk/graph/governance-contracts.js +1 -1
- package/dist/sdk/graph/governance.js +1 -1
- package/dist/sdk/graph/hierarchy-integrity.js +1 -1
- package/dist/sdk/graph/index.js +1 -1
- package/dist/sdk/graph/lifecycle-coverage.js +1 -1
- package/dist/sdk/graph/mutation-advisory.js +1 -1
- package/dist/sdk/graph/query-contracts.js +1 -1
- package/dist/sdk/graph/remediation.js +1 -1
- package/dist/sdk/graph/run.js +1 -1
- package/dist/sdk/graph/scheduling.js +1 -1
- package/dist/sdk/graph/traversal.js +1 -1
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -1
- package/dist/sdk/graph.js +1 -1
- package/dist/sdk/guide-topics.js +1 -1
- package/dist/sdk/guide.js +8 -1
- package/dist/sdk/history/attestation-command.js +1 -1
- package/dist/sdk/history/attestation-contract.js +1 -1
- package/dist/sdk/history/attestation-scan.js +1 -1
- package/dist/sdk/history/attestation.js +1 -1
- package/dist/sdk/history/maintenance.js +1 -1
- package/dist/sdk/history/salvage.js +3 -2
- package/dist/sdk/history/subject.js +1 -1
- package/dist/sdk/history-analytics.js +1 -1
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-mcp.js +1 -1
- package/dist/sdk/history-provenance.js +1 -1
- package/dist/sdk/history-read.js +1 -1
- package/dist/sdk/history-redact.js +1 -1
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/improvement-ledger-validation.js +1 -1
- package/dist/sdk/improvement-ledger.js +2 -2
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/init-agent-guidance.js +16 -2
- package/dist/sdk/init.js +16 -2
- package/dist/sdk/invocation-author.js +1 -1
- package/dist/sdk/item-children.js +1 -1
- package/dist/sdk/item-metadata-index.js +1 -1
- package/dist/sdk/item-schedule.js +1 -1
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/learnings.js +1 -1
- package/dist/sdk/lifecycle/append.js +4 -2
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/close-many.js +1 -1
- package/dist/sdk/lifecycle/close.js +1 -1
- package/dist/sdk/lifecycle/copy.js +1 -1
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/delete.js +1 -1
- package/dist/sdk/lifecycle/event-validation-messages.js +1 -1
- package/dist/sdk/lifecycle/focus.js +1 -1
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -1
- package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -1
- package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -1
- package/dist/sdk/lifecycle/mcp-actions.js +1 -1
- package/dist/sdk/lifecycle/metadata-normalizers.js +1 -1
- package/dist/sdk/lifecycle/mutation-command-options.js +1 -1
- package/dist/sdk/lifecycle/plan-mutation-receipt.js +1 -1
- package/dist/sdk/lifecycle/plan.js +1 -1
- package/dist/sdk/lifecycle/recurrence-parsers.js +1 -1
- package/dist/sdk/lifecycle/reopen.js +1 -1
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +2 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
- package/dist/sdk/lifecycle/task-composition.js +1 -1
- package/dist/sdk/lifecycle/update-many.js +1 -1
- package/dist/sdk/lifecycle/update.js +2 -1
- package/dist/sdk/lifecycle-completion.js +1 -1
- package/dist/sdk/lifecycle-policy.js +1 -1
- package/dist/sdk/linked-artifacts.js +2 -1
- package/dist/sdk/mcp/apps.js +1 -1
- package/dist/sdk/mcp/authorization.js +1 -1
- package/dist/sdk/mcp/discovery.js +1 -1
- package/dist/sdk/mcp/interactions.js +1 -1
- package/dist/sdk/mcp/protocol.js +1 -1
- package/dist/sdk/mcp/skills.js +3 -1
- package/dist/sdk/mcp/subscriptions.js +1 -1
- package/dist/sdk/mcp/tasks.js +2 -2
- package/dist/sdk/mcp/transport.js +1 -1
- package/dist/sdk/merge/abandoned-receipts.js +1 -1
- package/dist/sdk/merge/driver.js +1 -1
- package/dist/sdk/merge/index.js +1 -1
- package/dist/sdk/merge/install.js +4 -2
- package/dist/sdk/merge/receipt-file-boundary.js +1 -1
- package/dist/sdk/merge/receipt-operation.js +1 -1
- package/dist/sdk/merge/receipt-schema.js +1 -1
- package/dist/sdk/merge/receipts.js +4 -4
- package/dist/sdk/merge/reconcile.js +1 -1
- package/dist/sdk/merge/three-way.js +3 -2
- package/dist/sdk/merge/worktree-config.js +1 -1
- package/dist/sdk/merge.js +1 -1
- package/dist/sdk/mutation-events.js +1 -1
- package/dist/sdk/mutation-guard.js +1 -1
- package/dist/sdk/notes.js +1 -1
- package/dist/sdk/output-contracts.js +1 -1
- package/dist/sdk/output-projection.js +1 -1
- package/dist/sdk/output-token-accounting.js +1 -1
- package/dist/sdk/output.js +2 -1
- package/dist/sdk/ownership-source.js +1 -1
- package/dist/sdk/package-import-adapters.js +1 -1
- package/dist/sdk/package-migrations.js +1 -1
- package/dist/sdk/package-runtime-options.js +1 -1
- package/dist/sdk/pagination.js +1 -1
- package/dist/sdk/profile.js +5 -1
- package/dist/sdk/provenance.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.js +1 -1
- package/dist/sdk/query/aggregate.js +1 -1
- package/dist/sdk/query/calendar.js +4 -1
- package/dist/sdk/query/complete-list.js +1 -1
- package/dist/sdk/query/context.js +2 -1
- package/dist/sdk/query/duplicate-candidates.js +1 -1
- package/dist/sdk/query/get.d.ts +14 -2
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/query/history.js +1 -1
- package/dist/sdk/query/item-filter-options.js +1 -1
- package/dist/sdk/query/light-metadata.js +1 -1
- package/dist/sdk/query/list-filter-shared.js +1 -1
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/multi-value-filters.js +1 -1
- package/dist/sdk/query/next-ready-budget.js +1 -1
- package/dist/sdk/query/next.js +2 -1
- package/dist/sdk/query/parsers.js +1 -1
- package/dist/sdk/query/projection-contracts.js +1 -1
- package/dist/sdk/query/search/corpus.js +2 -1
- package/dist/sdk/query/search/filters.js +1 -1
- package/dist/sdk/query/search/input.js +1 -1
- package/dist/sdk/query/search/lexical.js +1 -1
- package/dist/sdk/query/search/response.js +1 -1
- package/dist/sdk/query/search/semantic.js +3 -2
- package/dist/sdk/query/search/types.js +1 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/query/search-pagination.js +1 -1
- package/dist/sdk/query/search-rendering.js +1 -1
- package/dist/sdk/query/search.js +1 -1
- package/dist/sdk/query/workspace-contracts.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/read-output/continuation.js +1 -1
- package/dist/sdk/read-output/options.js +1 -1
- package/dist/sdk/read-output/provenance.js +1 -1
- package/dist/sdk/read-output-budget.js +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.js +1 -1
- package/dist/sdk/read-output-session.js +1 -1
- package/dist/sdk/relationship-analytics.js +1 -1
- package/dist/sdk/relationship-context.js +1 -1
- package/dist/sdk/relationship-history.js +7 -4
- package/dist/sdk/relationship-kinds/contract.js +1 -1
- package/dist/sdk/relationship-migration.js +1 -1
- package/dist/sdk/relationships.js +1 -1
- package/dist/sdk/reproducibility/process.js +1 -1
- package/dist/sdk/runtime/actions.js +1 -1
- package/dist/sdk/runtime/context.js +1 -1
- package/dist/sdk/runtime/schema-preview.js +1 -1
- package/dist/sdk/runtime/schema.js +1 -1
- package/dist/sdk/runtime-action-aliases.js +1 -1
- package/dist/sdk/runtime-extended-actions.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime-public-contracts.js +1 -1
- package/dist/sdk/runtime-stats-options.js +1 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/scheduling-shortcuts.js +1 -1
- package/dist/sdk/schema-migration.js +4 -3
- package/dist/sdk/schema.js +7 -1
- package/dist/sdk/search-refresh-worker.js +1 -1
- package/dist/sdk/similarity-scoring.js +1 -1
- package/dist/sdk/similarity.js +1 -1
- package/dist/sdk/start-task-status.js +1 -1
- package/dist/sdk/stats.js +1 -1
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/telemetry-flush.js +1 -1
- package/dist/sdk/telemetry.js +4 -3
- package/dist/sdk/templates.js +26 -2
- package/dist/sdk/test/batch.js +2 -2
- package/dist/sdk/test/entry.js +1 -1
- package/dist/sdk/test/execution.d.ts +2 -1
- package/dist/sdk/test/execution.js +6 -5
- package/dist/sdk/test/json-path.js +1 -1
- package/dist/sdk/test/linked-command-detection.js +1 -1
- package/dist/sdk/test/measurements.js +1 -1
- package/dist/sdk/test/parsers.js +1 -1
- package/dist/sdk/test/runs.js +1 -1
- package/dist/sdk/test/trust.js +2 -2
- package/dist/sdk/test/workspace-snapshot.js +1 -1
- package/dist/sdk/testing.js +7 -4
- package/dist/sdk/traceability/runtime-files-lookup.js +1 -1
- package/dist/sdk/traceability/source-traceability.js +2 -1
- package/dist/sdk/tracker-root-discovery.js +1 -1
- package/dist/sdk/workspace-contracts-cache.js +1 -1
- package/dist/sdk/workspace-contracts.js +1 -1
- package/dist/sdk/workspace-memory.js +2 -2
- package/dist/sdk/workspace-recipe.js +1 -1
- package/dist/sdk/workspace-snapshot.js +5 -4
- package/dist/sdk/workspace-transaction-gc.js +1 -1
- package/dist/sdk/workspace-transaction.js +2 -2
- package/dist/sdk/workspace.js +3 -2
- package/dist/types/index.js +1 -1
- package/dist/types.js +1 -1
- package/docs/AGENT_EVIDENCE_CONSISTENCY.md +88 -0
- package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +36 -0
- package/docs/GET_READ_EVIDENCE.md +84 -0
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +23 -0
- package/docs/PR_REVIEW_LOOP.md +21 -4
- package/docs/README.md +3 -0
- package/docs/RELEASING.md +18 -0
- package/docs/SDK_CONFIGURATION_SAFETY.md +123 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +3 -3
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +2 -2
- package/package.json +3 -3
- 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/extensions/vcs/index.ts +4 -2
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
- package/scripts/finalize-build.mjs +3 -2
- package/dist/cli-bundle/chunks/chunk-7UVXKI7K.js +0 -2
- package/dist/cli-bundle/chunks/chunk-D7Z2ZMJL.js +0 -3
- package/dist/cli-bundle/chunks/chunk-DEZPZOQ7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-J52QIRRZ.js +0 -80
- package/dist/cli-bundle/chunks/chunk-JDKD3WGG.js +0 -6
- package/dist/cli-bundle/chunks/chunk-JQ7DW663.js +0 -2
- package/dist/cli-bundle/chunks/chunk-QXIDOOWT.js +0 -20
- package/dist/cli-bundle/chunks/chunk-SGFQQXFD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-V3U77H3V.js +0 -31
- package/dist/cli-bundle/chunks/chunk-XZDWAYJC.js +0 -3
- package/dist/cli-bundle/chunks/chunk-Y6VRBTP3.js +0 -238
- package/dist/cli-bundle/chunks/chunk-YAAFYFS4.js +0 -8
- package/dist/cli-bundle/chunks/register-mutation-53ZLT4RX.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-OBK2FXUU.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-HM3OCBH2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2JFYR56O.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-32EVUSS4.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-5GUSO2P4.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-6XBRADQQ.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-7O4NUJVO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CURTIIQT.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-IJUWEEEB.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-JCVMOSWQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JMJK2L4Z.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-KG3H4UZZ.js +0 -30
- package/dist/cli-bundle/focused-chunks/chunk-MHQ2XICU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-RJV6QVJE.js +0 -75
- package/dist/cli-bundle/focused-chunks/chunk-ZE2JZ7R6.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-ZLEN4HZD.js +0 -165
|
@@ -0,0 +1,30 @@
|
|
|
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]="f483c0e2-e630-568c-b4c0-3ca4f5434d5e")}catch{}})();var B=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],cr=2,lr=Object.freeze({migration:"schema",validation:"schema"}),N_=Object.freeze({version:2,capabilities:[...B],legacy_aliases:{...lr}}),ft=["off","warn","enforce"],pt=["off","warn","enforce"],_t=["none","restricted","strict"],qn=["block","warn"],gt=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore","services.assuranceprovider"],Oe=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function yt(){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]="e6847fdd-b2c1-5503-b510-56fdfdcf933f")}catch{}})();var Ba=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],Bn=Ba,P_=["draft","open","in_progress","blocked","closed","canceled"],M_=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],Vn=["string","number","boolean","string_array","array","object"],$_=["create","update","update_many","list","search","calendar","context"],L_=["allow","warn","reject"],j_=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],F_=["project","global"],U_=["low","medium","high","critical"],z_=["low","medium","high","critical"],q_=["low","medium","high"];var B_=["minimal","default","strict","custom"],V_=["none","warn","strict"],G_=["progressive","strict"],W_=["off","warn","strict"],K_=["off","warn","strict"];var H_=["daily","weekly","monthly","yearly"],Va=["mon","tue","wed","thu","fri","sat","sun"];function Y_(e){return Va.indexOf(e)}var X_=["draft","research","review","approved","executing","paused","completed","superseded"],J_=["pending","in_progress","completed","blocked","skipped","superseded"],Q_=["codex","claude-code","cursor","generic"],Z_=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],eg=["brief","standard","deep","full"],tg=["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]="3d6df465-e82e-57d8-a687-6c2e720c99c1")}catch{}})();var Gn=["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"],Ga=["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",...Gn,"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"],Wa=Ga;(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9a92abe3-1900-5a69-a35d-6aa592c83da0")}catch{}})();var Ka=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"]}]),Ha=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),ht=".agents/pm",bt="settings.json";var Ya=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],Xa=["decisions","events","reminders","milestones","meetings","plans"],sg=[...Ya,...Xa],Fe={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},Ja={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}},Qa=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],dr={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 Wn(e){return e?[...e]:void 0}var ag={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:[...Qa],lifecycle_closure_like_blocked_reason_patterns:[...dr.blocked_reason],lifecycle_closure_like_resolution_patterns:[...dr.resolution],lifecycle_closure_like_actual_result_patterns:[...dr.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...Ja.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:Ka.map(e=>({...e,aliases:Wn(e.aliases),roles:Wn(e.roles)})),fields:[],workflow:{...Ha},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:yt()},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:""}}},cg={metadata:{},body:""},y={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},lg=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",init_gitignore_unwritable:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="25e7f564-061f-5409-89a6-d2ae7c573ad3")}catch{}})();var h=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]="67511565-01f8-58a6-ad06-45b5d0ce831b")}catch{}})();var Za=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=>!Za.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 Kn(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`)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ea7934f-4751-5245-a5ba-492681aa3794")}catch{}})();var ur=[{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]="418b3f7f-6350-5878-a362-3948de287baf")}catch{}})();function Et(e){return e.trim().toLowerCase().replaceAll("-","_")}function rc(e){if(e===void 0)return;let t=Et(e);if(!/^[a-z][a-z0-9_]*$/.test(t))throw new TypeError(`Invalid inverse relationship kind: ${e}`);return t}function fr(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)fr(r,t);return Object.freeze(e)}for(let r of Object.values(e))fr(r,t);return Object.freeze(e)}function nc(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 oc(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 ic(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 sc(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=Et(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 ac(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 cc(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 lc(e){return e.traversal?e.traversal:e.ordering?"ordering":e.hierarchy?"hierarchy":e.direction==="undirected"?"association":"semantic"}var pr=class{#e=new Map;#r=new Map;constructor(t=ur){for(let r of t)this.register(r)}register(t){let r=sc(t);if(ac(t,r),cc(t,r),nc(t,r),oc(t,r),ic(t,r),this.#e.has(r)||this.#r.has(r))throw new TypeError(`Relationship kind already registered: ${r}`);let n=rc(t.inverse),o=[...new Set((t.aliases??[]).map(Et))].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:lc(t),hierarchy:t.hierarchy??!1,hierarchyDirection:t.hierarchy?t.hierarchyDirection??"source_parent":void 0,inverse:n,aliases:Object.freeze(o),payloadSchema:t.payloadSchema?fr(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=Et(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 _r(){return new pr}var ce=_r();function gg(e){return ce.require(e).kind}function yg(e){return ce.resolve(e)?.kind}function hg(e,t=ce){return t.resolve(e)?.ordering===!0}function dc(e,t,r,n=ce){let o=Ue(e),i=Ue(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 wt(e,t){return e.source.localeCompare(t.source)||e.target.localeCompare(t.target)||e.kind.localeCompare(t.kind)}function uc(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=dc(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 vt(e,t,r){let n=e.get(t);n?n.push(r):e.set(t,[r])}function Ue(e){return typeof e=="string"?e.trim():""}function mr(e,t){let r=Ue(e);return r&&t.has(r)?r:void 0}function mc(e,t,r){let n=[t],o=t;for(;o!==e;)o=r.get(o),n.push(o);return n.reverse()}var Hn=class e{#e;#r;#o;#n;#s=new Map;#a=new Map;constructor(t,r,n=ce){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}=uc(i,this.#r,n);o.set(a,s)}this.#n=Object.freeze([...o.values()].sort(wt));for(let i of this.#n)vt(this.#s,i.source,i),vt(this.#a,i.target,i),n.require(i.kind).direction==="undirected"&&(vt(this.#s,i.target,i),vt(this.#a,i.source,i))}static fromItems(t,r=ce){let n=new Set(t.map(i=>Ue(i.id)).filter(Boolean)),o=[];for(let i of t){let s=Ue(i.id);if(!s)continue;let a=mr(i.parent,n);a&&o.push({source:s,target:a,kind:"parent"});let c=mr(i.blocked_by,n);c&&o.push({source:s,target:c,kind:"blocked_by"});for(let l of i.dependencies??[]){let d=mr(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||wt(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)||wt(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(m=>this.#e.require(m).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,f=0,u=!1;e:for(let m=0;m<l.length;m+=1){r.signal?.throwIfAborted();let p=l[m];d+=1;let _=this.#t(p.id,o,n);if(f+=_.length,p.depth>=s){_.some(g=>!a.has(g.id))&&(u=!0);continue}for(let g of _)if(!a.has(g.id)){if(c.length>=i){u=!0;break e}a.add(g.id),c.push(g.id),l.push({id:g.id,depth:p.depth+1})}}return{value:c,meta:{visitedNodes:d,inspectedEdges:f,truncated:u,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(m=>this.#e.require(m).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,f=0,u=!1;for(let m=0;m<a.length;m+=1){n.signal?.throwIfAborted();let p=a[m];d+=1;let _=this.#t(p.id,i,o);if(f+=_.length,p.depth>=s){_.some(g=>!l.has(g.id))&&(u=!0);continue}for(let g of _)if(!l.has(g.id)){if(c.set(g.id,p.id),g.id===r)return{value:mc(t,r,c),meta:{visitedNodes:d,inspectedEdges:f,truncated:!1}};l.add(g.id),a.push({id:g.id,depth:p.depth+1})}}return{value:[],meta:{visitedNodes:d,inspectedEdges:f,truncated:u}}}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(wt)},meta:n.meta}}};function bg(e,t,r=ce){return{source:e,target:t.id,kind:r.require(t.kind).kind,createdAt:t.created_at,author:t.author}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f8657910-1392-5fae-afda-614b96dc8320")}catch{}})();function k(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function fc(){return{json:!1,quiet:!1,noExtensions:!1,profile:!1}}function Yn(e){return e?P(e):{}}function Xn(e){return e?P(e):fc()}function P(e){return structuredClone(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="615b4955-a30d-5d45-a86d-4bcf7bd9bd7a")}catch{}})();var pc=new Set(["commands","command_overrides","command_handlers","flag_commands","parser_overrides"]),_c=["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 gc(e,t){for(let r of _c){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=>pc.has(r)?k(i):i.trim()).filter(i=>i.length>0);t[r]=[...new Set(o)].sort((i,s)=>i.localeCompare(s))}return!0}function yc(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=>k(o)))].sort((o,i)=>o.localeCompare(i)),result_discriminator:n.result_discriminator})}return t.sort((r,n)=>r.format.localeCompare(n.format))}function hc(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=>k(o)))].filter(o=>o.length>0).sort((o,i)=>o.localeCompare(i))})}return t}function kt(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(!gc(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=yc(o);if(s===null)return null;r.renderer_ownership=s}let i=t.preflight_ownership;if(i!==void 0){let s=hc(i);if(s===null)return null;r.preflight_ownership=s}return r}function kg(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]="451b262c-a9b6-5f1c-b397-2686a5fd953a")}catch{}})();var bc=[["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"})),wc=[...["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"})),vc=[["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"})),Ec=[...wc,...vc,...["init","config","schema","profile"].map(e=>({alias:e,canonical:`workspace ${e}`,canonical_argv:["workspace",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-npr3"})),...[...["comments","notes","learnings","files","docs","deps","append","test"].map(e=>[e,`item ${e}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(e=>[`completion-${e}`,`completion ${e}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(e=>[e,`calendar ${e}`,"pm-o3fh"])].map(([e,t,r])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:r}))],gr=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-3z0k"},...bc,...Ec,...["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 Ag(e){let t;for(let r of gr)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 kc(e){let t=e.trim().replace(/\s+/gu," ");return gr.find(r=>r.canonical===t.replace(/^ctx /u,"context "))?.alias??t}function ze(e){return kc(e)}var Ot=[...gr,...[["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","package catalog"],["packages scaffold","package init"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-ya7x55"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([e,t])=>({alias:e,canonical:"list",canonical_argv:["list","--status",t],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-tnud"}))],Sg=Object.fromEntries(Ot.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function Tg(e){let t=e.trim().toLowerCase();return Ot.find(r=>r.alias===t)}function Cg(e){return`Deprecated command \`${e.alias}\`; use \`pm ${e.canonical_argv.join(" ")}\`.`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bfaa3455-3237-5c98-8ef4-b353ce9530fe")}catch{}})();var Rg=Object.freeze({rows:10,paths:5,samples:10,path_depth:8,visited_paths:1e4});import{createHash as Zn}from"node:crypto";import Oc 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]="77f9d61e-e78b-5b6a-a769-1ad6e5b91777")}catch{}})();function Ac(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 Sc(e){let t=Object.keys(e).sort(),r={};for(let n of t){let o=e[n];o!==void 0&&(r[n]=At(o))}return r}function At(e){let t=Ac(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(n=>At(n));if(e instanceof Date)return e.toISOString();let r=e;if(typeof r.toJSON=="function"){let n=r.toJSON();if(n!==e)return At(n)}return Sc(e)}function le(e){return JSON.stringify(At(e))}function Jn(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 Tc(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function Cc(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function Ic(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(!Jn(o,r,n,V))return!1;return!0}function Rc(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(!Jn([o,i],r,n,([s,a],[c,l])=>V(s,c)&&V(a,l)))return!1;return!0}function xc(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)=>V(r,t[n]))}function Nc(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]||!V(e[i],t[i]))return!1}return!0}var Dc=[Tc,Cc,Ic,Rc,xc];function V(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let r of Dc){let n=r(e,t);if(n!==void 0)return n}return Nc(e,t)}function Dg(e){return Oc.createHash("sha256").update(e,"utf8").digest("hex")}function Pg(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]="f675993f-c483-5751-baed-d968b4fd24c0")}catch{}})();var Pc=["policies","policy-put","policy-remove","policy-mode","policy-check","policy-approve","policy-presets"],Qn=256,yr=64;function F(e){throw new h(`Invalid workflow policy: ${e}`,y.USAGE,{code:"workflow_policy_invalid",nextSteps:["Inspect pm schema policies and correct the declaration using pm schema policy-put."]})}function W(e,t,r){if(typeof e!="object"||e===null||Array.isArray(e))return F(`${r} must be an object`);let n=e;return Object.keys(n).some(o=>!t.includes(o))?F(`${r} contains an unknown key`):n}function de(e,t,r=128){return typeof e!="string"||!e.trim()||e.length>r?F(`${t} must be nonempty text of at most ${r} characters`):e.trim()}function qe(e,t){if(!Array.isArray(e)||e.length===0||e.length>yr)return F(`${t} requires 1-${yr} terms`);let r=e.map(n=>de(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)))?F("fields must be safe metadata paths of at most eight segments"):[...new Set(r)]}function Mc(e){let t=W(e,["kind","fields","authors","allowed"],"rule");return t.kind==="transition"?(W(t,["kind","allowed"],"transition rule"),!Array.isArray(t.allowed)||t.allowed.length>yr?F("transition.allowed must be a bounded array"):{kind:"transition",allowed:t.allowed.map(r=>!Array.isArray(r)||r.length!==2?F("transition pairs need two statuses"):[de(r[0],"from"),de(r[1],"to")])}):t.kind==="authors"?(W(t,["kind","authors"],"authors rule"),{kind:"authors",authors:qe(t.authors,"authors")}):t.kind==="require_fields"?(W(t,["kind","fields"],"require_fields rule"),{kind:"require_fields",fields:qe(t.fields,"fields")}):t.kind==="field_writers"||t.kind==="approval"?(W(t,["kind","fields","authors"],"field rule"),{kind:t.kind,fields:qe(t.fields,"fields"),authors:qe(t.authors,"authors")}):F("unknown rule kind")}function $c(e){let t={},r=W(e,["types","tags","statuses","operations","parents","dependency"],"subject");for(let n of["types","tags","statuses","operations","parents"])r[n]!==void 0&&(t[n]=qe(r[n],n));if(r.dependency!==void 0){let n=W(r.dependency,["kind","id"],"dependency");t.dependency={kind:de(n.kind,"dependency kind"),...n.id===void 0?{}:{id:de(n.id,"dependency id")}}}return t}function Lc(e){let t=W(e,["id","description","subject","effect","rule"],"policy"),r=de(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))?F("effect must be advise, warn, or refuse"):{id:r,rule:Mc(t.rule),...t.subject===void 0?{}:{subject:$c(t.subject)},...t.description===void 0?{}:{description:de(t.description,"description",500)},...t.effect===void 0?{}:{effect:t.effect}}:F("id must be a stable token")}function jc(e){let t=W(e,["version","enforcement","policies"],"document");if(t.version!==1)return F("unsupported version");if(t.enforcement!==void 0&&t.enforcement!=="advise"&&t.enforcement!=="refuse")return F("enforcement must be advise or refuse");if(!Array.isArray(t.policies)||t.policies.length>Qn)return F(`policies must contain at most ${Qn} declarations`);let r=t.policies.map(Lc);return new Set(r.map(n=>n.id)).size!==r.length?F("duplicate policy id"):{version:1,enforcement:t.enforcement??"advise",policies:r}}function St(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 Fc(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 eo(e){return Zn("sha256").update(le(e)).digest("hex")}function Uc(e,t){let r=e.rule.kind==="approval"?e.rule.fields:[];return Zn("sha256").update(le({id:t.id,fields:r.map(n=>[n,St(t,n)])})).digest("hex")}function zc(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 qc(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&&!zc(e.dependency,t.dependencies))}function Bc(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&&qc(r,{...o,status:n},t.operation))}function Vc(e,t,r,n){let o=["type","tags","parent","dependencies"].some(i=>!V(t.before?.[i],t.after?.[i]));return t.after&&(t.completeness_only||r||n||o)?e.filter(i=>!Fc(St(t.after,i))):[]}function Gc(e,t,r,n){let o=t.after??t.before,i=Uc(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 Wc(e,t,r){let n=e.rule,o=t.before?.status!==t.after?.status,i="fields"in n&&n.fields.some(s=>!V(St(t.before,s),St(t.after,s)));switch(n.kind){case"require_fields":{let s=Vc(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||Gc(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 to(e,t,r){let n=e.policies.filter(o=>Bc(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,...Wc(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 Ug(e,t){return to(e,t,eo)}function zg(e){let t=jc(e),r=new Map(t.policies.map(n=>[n,eo(n)]));return n=>to(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]="432226a6-9df4-5de6-b9af-5c06ec2eed66")}catch{}})();var Kc=[...B],Hc=[...Oe],Yc=[...ft],Wg=[...pt],Kg=[..._t],Xc=[...gt],Tt=["init","config","extension","package","packages","install","upgrade","create","item","copy","focus","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","aggregate","context","ctx","get","graph","search","duplicates","eval","next","history","events","history-redact","history-repair","history-compact","history-attest","history-author-acknowledge","merge","schema","profile","activity","restore","update","update-many","close","close-many","delete","append","comments","notes","learnings","files","docs","deps","plan","test","test-all","telemetry","stats","health","validate","assurance","gc","workspace","contracts","claim","release","start-task","pause-task","close-task","meet","event","remind","help"],Hg=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],Yg=["install","reconcile","report","driver"],Jc=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],Qc=["upgrade"],Zc=["reopen"],ro={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},Ct=Object.freeze(Tt.flatMap(e=>e in ro?[]:e==="extension"||e==="package"?[...Jc.map(t=>`${e}-${t}`),...e==="package"?Qc.map(t=>`package-${t}`):[],e]:e==="item"?Zc.map(t=>`item-${t}`):[e])),el=Object.freeze(Ot.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&Ct.includes(e.alias)).map(e=>e.alias)),Xg=Object.freeze(Ct.filter(e=>!el.includes(e)));function Jg(e=Tt,t=Ct,r=ro){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 Qg(e){return Ct.includes(e)}function Zg(e){return Kc.includes(e)}function ey(e){return Hc.includes(e)}function ty(e){return Yc.includes(e)}function ry(e){return Xc.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]="628615ea-5be3-5753-a6c5-3eba8400a8da")}catch{}})();function It(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 f=e[c-1]===t[d-1]?0:1,u=i[d-1]+f,m=s[d-1]+1,p=i[d]+1,_=Math.min(u,m,p);c>1&&d>1&&e[c-1]===t[d-2]&&e[c-2]===t[d-1]&&(_=Math.min(_,o[d-2]+1)),s[d]=_,_<l&&(l=_)}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]="7359c10a-4c56-57ea-8254-fc26b19e5c84")}catch{}})();function Be(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,r)=>t.localeCompare(r))}function J(e){return B.includes(e)}function no(e){let t=e.trim().toLowerCase();return J(t)?t:null}function oo(e){return e.filter(t=>!J(t))}function hr(e){let t=e.trim().toLowerCase();return t.length===0?null:lr[t]??null}function io(e){let t=Be([...e].map(i=>i.toLowerCase())),r=[],n=[];for(let i of t){let s=hr(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:Be(r),legacy_aliases:o}}function tl(e){let t=e.trim().toLowerCase();if(t.length===0)return null;let r=hr(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 B){let a=It(t,s,n);a!==null&&a<i&&(i=a,o=s)}return o}function so(e,t,r){let n=B.join(","),o=tl(r)??"none";return`extension_capability_unknown:${e}:${t}:${r}:allowed=${n}:suggested=${o}`}function ao(e,t,r){let n=r.map(o=>`${o.alias}>${o.target}`).join(",");return`extension_capability_legacy_alias:${e}:${t}:aliases=${n}`}function rl(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(f=>f.trim()).filter(f=>f.length>0),l=hr(o),d=(s==="none"?void 0:s)??l??void 0;return{layer:a,name:n,capability:o,allowed_capabilities:c,capability_contract_version:cr,suggested_capability:d,suggestion_source:d?l===d?"legacy_alias":"nearest_match":void 0,legacy_alias_target:l??void 0}}function nl(e){let t=/^extension_capability_legacy_alias:(global|project):([^:]+):aliases=(.+)$/.exec(e.trim());if(!t)return[];let[,r,n,o]=t,i=r,s=[...B],a=[];for(let c of o.split(",")){let[l,d]=c.split(">"),f=l?.trim(),u=d?.trim().toLowerCase();!f||!u||!J(u)||a.push({layer:i,name:n,capability:f,allowed_capabilities:s,capability_contract_version:cr,suggested_capability:u,suggestion_source:"legacy_alias",legacy_alias_target:u})}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]="d8844150-afb4-5f2e-a005-4cfb8482660c")}catch{}})();var ol={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"]},co=":";function lo(e,t){return`${e}${co}${br(t)}`}function il(e){return e.slice(e.indexOf(co)+1)}function br(e){return e.trim().toLowerCase()}function sl(e){if(!Array.isArray(e))return[];let t=new Set;for(let r of e){let n=no(r);n!==null&&t.add(n)}return[...t].sort((r,n)=>r.localeCompare(n))}function uo(e){let t=new Map,r=(d,f)=>{for(let u of d){let m=lo(u.layer,u.name),p=t.get(m);p===void 0&&(p=new Set,t.set(m,p)),p.add(f)}},{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 al(e,t={}){let r=uo(e),n=new Set;t.extensionName!==void 0&&n.add(br(t.extensionName));for(let i of t.extensionNames??[])n.add(br(i));let o=new Set;for(let[i,s]of r)if(!(n.size>0&&!n.has(il(i))))for(let a of s)o.add(a);return[...o].sort((i,s)=>i.localeCompare(s))}function cl(e,t){let r=uo(t),n=[];for(let o of e){let i=sl(o.capabilities);if(i.length===0)continue;let s=r.get(lo(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}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ddd492ec-2482-5047-8d7f-8c40e18b60e3")}catch{}})();var Rt={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},xt=Object.freeze(["--output-session","--output-cursor","--output-row-contract"]);import{createHash as ll}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]="d60ea0a7-96d4-5a22-92bd-ac64eece5a51")}catch{}})();var vr=1,mo=4096,dl=/^[A-Za-z0-9_-]+$/;function wr(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,r)=>r.toUpperCase())}function gy(e,t){let r=[...Object.values(Rt),...xt],n=new Set(r.flatMap(o=>[wr(o),o.slice(2).replaceAll("-","_")]));for(let o of t)if(o.cursor_semantics==="presentation"){n.add(wr(o.flag));for(let i of o.aliases??[])n.add(wr(i))}return Object.fromEntries(Object.entries(e).filter(([o])=>!n.has(o)))}function yy(e,t){return ll("sha256").update(e).update("\0").update(le(t)).digest("hex").slice(0,24)}function Ve(e,t,r,n){return Buffer.from(JSON.stringify({version:vr,fingerprint:e,after_id:t,...r===void 0?{}:{after_index:r},...n===void 0?{}:{snapshot:n}})).toString("base64url")}function ue(e){return new h(e,y.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function ul(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===vr&&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 Er(e){if(typeof e!="string")throw ue("Query cursor is malformed.");let t=e.trim();if(t.length===0||t.length>mo||!dl.test(t))throw ue("Query cursor is malformed.");let r;try{r=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw ue("Query cursor is malformed.")}if(!ul(r))throw ue("Query cursor version or payload is unsupported.");return r}function kr(e,t){let r=Er(e);if(r.fingerprint!==t)throw ue(`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 hy(e,t){return kr(e,t).after_id}function ml(e,t,r,n){if(t===void 0)return 0;let o=kr(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 ue(`Query cursor item ${o.after_id} is no longer present in this result set.`)}return i+1}function by(e,t){if(t.cursor!==void 0&&kr(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw ue("Query cursor does not match the requested snapshot.");let r=ml(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:Ve(t.fingerprint,t.readId(i),r+n.length-1,t.snapshot)}:{}}}var wy=Object.freeze({version:vr,max_length:mo});import{stripVTControlCharacters as fl}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d956e747-cbca-5e3c-925f-e1aeb2ebbfa7")}catch{}})();var pl=["full","compact","brief","summary","counts"],Ay=["mutation","read","discovery","governance"],po=["error","warning","validation_summary","recovery_bundle"],_l=["full","omit_explanation","limit_collections","compact_recovery","action_only"],gl=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"]),yl=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),hl=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),bl={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},wl=3,vl=2,El=192,kl={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},Ol=po.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:kl[e],minimum_max_estimated_tokens:El,degradation_ladder:_l,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),Al=new Map(Ol.map(e=>[e.diagnostic_class,e]));function Sl(e){let[t=""]=ze(e).split(/\s+/u);return gl.has(t)?"mutation":yl.has(t)?"discovery":hl.has(t)?"governance":"read"}function _o(e,t=Sl(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=bl[t];return Tl({command:r,budget_class:t,default_max_estimated_tokens:n,default_max_estimated_tokens_by_format:{toon:n,json:Math.ceil(n*wl/vl)},degradation_ladder:pl,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function Tl(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 Cl=Tt.map(e=>_o(e)),Il=new Map(Cl.map(e=>[e.command,e]));function go(e,t={}){let r=e.trim().replace(/\s+/gu," "),[n]=ze(r).split(" "),o=Il.get(n);return o?{...o,command:r}:t.generateFallback?_o(r):null}function fe(e){return Math.ceil(Math.max(0,e)/4)}function yo(e){let t=Al.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${po.join(", ")}`);return t}function Q(e){return fe(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function Rl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Or(e){if(!Rl(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 xl(e,t){return typeof e!="string"||e.length<=t?e:`${e.slice(0,Math.max(1,t-3))}...`}function me(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 ho(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 Nl=new Set(["limit_collections","compact_recovery","action_only"]),Dl=new Set(["compact_recovery","action_only"]);function Pl(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:xl(e.required,160)??"Inspect the diagnostic code and retry with corrected input."},r=Or(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 Ml(e,t){let r=structuredClone(e);if(t!=="full"&&(delete r.why,delete r.examples),Nl.has(t))for(let[n,o]of Object.entries(r))Array.isArray(o)&&(r[n]=o.slice(0,3));if(Dl.has(t)){let n=Or(r.recovery);n?r.recovery=n:delete r.recovery}return t!=="action_only"?ho(r):Pl(r)}function Ae(e,t){let r={...e,diagnostic_output:{...t,estimated_tokens:0}};for(let n=0;n<4;n+=1){let o=Q(r),i=r.diagnostic_output;if(i.estimated_tokens===o)break;i.estimated_tokens=o}return r}function $l(e,t,r){let n=Ae(e,t);for(let i of["recovery","exit_code"])Q(n)<=r||e[i]===void 0||(delete e[i],n=Ae(e,t));let o=40;for(;Q(n)>r&&o>4;)o-=4,e.code=me(String(e.code),o),e.required=me(String(e.required),o),n=Ae(e,t);return n}function Ll(e,t){let r=e.diagnostic_output,{estimated_tokens:n,...o}=r,i=o.omitted_fields.slice(0,8).map(f=>me(f,32)),s={...o,omitted_fields:i,...o.omitted_fields.length>i.length?{omitted_fields_overflow_count:o.omitted_fields.length-i.length}:{}},a=Or(e.recovery),c=a&&Q(a)<=48?a:void 0,l={code:me(String(e.code),320),required:me(String(e.required),320),...c?{recovery:c}:{},...e.exit_code!==void 0?{exit_code:e.exit_code}:{}},d=Ae(l,s);for(;Q(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=Ae(l,s);return d=$l(l,s,t),d}function Sy(e,t={}){let r=e,n=t.diagnosticClass??"error",o=yo(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=Q(r),c=Object.keys(r);if(a<=s)return ho(structuredClone(r));let l;for(let[d,f]of o.degradation_ladder.entries()){let u=Ml(r,f),m=c.filter(_=>!Object.hasOwn(u,_)),p=Ae(u,{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:m});if(l=p,Q(p)<=s)break}return Q(l)>s&&(l=Ll(l,s)),l}function fo(e){return fl(e).replace(/\r\n/gu,`
|
|
2
|
+
`).replace(/[^\P{Cc}\n]/gu," ")}function Ty(e,t,r={}){let n=r.diagnosticClass??"error",o=yo(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=fo(e),c=fe(Buffer.byteLength(a,"utf8")),l=c>s,d=`What is required:
|
|
3
|
+
`,f=`
|
|
4
|
+
|
|
5
|
+
${me(a.trimStart().split(/\r?\n/u,1)[0].trim(),320)}
|
|
6
|
+
|
|
7
|
+
Diagnostic output exceeded its declared ${s}-token ceiling; rerun with structured JSON for the bounded recovery envelope.`,u=fo(t).trim()||"Inspect the diagnostic code and retry with corrected input.",m=Math.max(1,s*4-Buffer.byteLength(`${d}${f}`,"utf8")),p=l?`${d}${me(u,m)}${f}`:a;return{output:p,diagnostic_output:{diagnostic_class:n,format:"text",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:c,estimated_tokens:fe(Buffer.byteLength(p,"utf8")),truncated:l,degradation_steps:l?[...o.degradation_ladder]:["full"],omitted_fields:l?["explanation","collections"]:[]}}}import{createHash as C_}from"node:crypto";import{existsSync as ym}from"node:fs";import{AsyncLocalStorage as hm}from"node:async_hooks";import H from"node:path";import we from"node:fs/promises";import be from"node:path";import{pathToFileURL as ju}from"node:url";import*as S from"node:fs/promises";import{constants as Ar}from"node:fs";import Nt from"node:path";import jl 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]="937f3049-08a1-5d60-8005-05441dc1c0b6")}catch{}})();var Fl=[10,25,50,100];async function bo(e){await S.mkdir(e,{recursive:!0})}async function Sr(e){try{return await S.access(e),!0}catch{return!1}}function wo(e){return _e(e)||pe(e,"ENOTDIR")}function _e(e){return pe(e,"ENOENT")}async function Ny(e){try{return await S.readFile(e,"utf8")}catch(t){if(wo(t))return null;throw t}}async function Dy(e,t){let r=await S.open(e,Ar.O_RDONLY|Ar.O_NOFOLLOW|Ar.O_NONBLOCK);try{if(!(await r.stat()).isFile())throw new TypeError(t);return await r.readFile("utf8")}finally{await r.close()}}async function Py(e,t){let r=Nt.dirname(e);await bo(r);let n=Nt.join(r,`.${Nt.basename(e)}.${process.pid}.${Date.now()}.${jl.randomBytes(4).toString("hex")}.tmp`);await S.writeFile(n,t,"utf8");try{await S.rename(n,e)}catch(o){if(process.platform==="win32"&&(pe(o,"EPERM")||pe(o,"EBUSY"))){let i=o;for(let s of Fl){await new Promise(a=>setTimeout(a,s));try{await S.rename(n,e);return}catch(a){if(i=a,!pe(a,"EPERM")&&!pe(a,"EBUSY"))break}}try{await S.unlink(n)}catch{}throw i}if(pe(o,"EXDEV")){try{await S.copyFile(n,e)}finally{try{await S.unlink(n)}catch{}}return}try{await S.unlink(n)}catch{}throw o}}async function My(e,t){let r=Nt.dirname(e);await bo(r);let n=await S.open(e,"a");try{await n.writeFile(`${t}
|
|
8
|
+
`,"utf8")}finally{await n.close()}}async function $y(e){try{await S.unlink(e)}catch(t){if(!wo(t))throw t}}function pe(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}import vo 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]="01422574-583a-5fd1-bc00-f61f430073cd")}catch{}})();function Tr(e,t){let r=vo.relative(e,t);return r.length===0?!0:!r.startsWith("..")&&!vo.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]="32aa20df-edf7-543d-b733-841130466f00")}catch{}})();var Ul="__pm_suppress_host_output",Cr="@unbrained/pm-cli:suppress-host-output:v1";function Eo(e){return e===void 0?{__pm_suppress_host_output:Cr}:{__pm_suppress_host_output:Cr,result:e}}function Ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&e[Ul]===Cr}import Se from"node:fs";import Z from"node:path";import{fileURLToPath as zl}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]="efea1aa1-1ad1-5f53-a3a5-b83803d9deb1")}catch{}})();var ql="@unbrained/pm-cli";function Bl(e){try{return JSON.parse(Se.readFileSync(e,"utf8")).name===ql}catch{return!1}}function Vl(e){let t=Se.existsSync(e)&&Se.statSync(e).isDirectory()?Z.resolve(e):Z.dirname(Z.resolve(e));for(;;){let r=Z.join(t,"package.json");if(Se.existsSync(r)&&Bl(r))return t;let n=Z.dirname(t);if(n===t)return;t=n}}function Rr(e,t=[]){let r=zl(e);return Vl(r)||Z.resolve(Z.dirname(r),...t)}function Vy(e,t=[]){try{let r=Z.join(Rr(e,t),"package.json");if(!Se.existsSync(r))return;let n=JSON.parse(Se.readFileSync(r,"utf8"));return typeof n.version=="string"&&n.version.trim().length>0?n.version:void 0}catch{return}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a797572f-fbc6-5e62-a9b5-5a0bd6ef22b4")}catch{}})();function Gl(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Wy(e){return Gl(e)??void 0}function Ky(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 Hy(e){return Array.isArray(e)&&e.every(t=>typeof t=="number"&&Number.isFinite(t))}function Oo(e){if(e instanceof Error){let t=e.message.trim();return t.length>0?t:e.name}return String(e)}function Ao(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 Yy(e){let t=Ao(e);return t===null||t<=0||!Number.isInteger(t)?null:t}function Xy(e,t,r){let n=Ao(e);return n===null||n<t||n>r?null:n}function Jy(e){return typeof e!="object"||e===null||Array.isArray(e)?null:e}function ee(e){return typeof e!="object"||e===null?null:e}function ko(e){return typeof e!="object"&&typeof e!="function"||e===null?null:e}function So(e){let t=ko(e);if(!t)return null;if(typeof t.activate=="function")return t;let r=ko(t.default);return typeof r?.activate=="function"?r:null}function Qy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...e}:{}}import{readFileSync as xd,readdirSync as fh,statSync as Nd}from"node:fs";import Dd from"node:os";import O from"node:path";import Xl from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0ca7f52c-fb31-5cd9-b689-a918f4e61816")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="75f74db3-9547-5c78-8561-f371c016b90d")}catch{}})();function te(e){return[...new Set((e??[]).map(t=>t.trim()).filter(t=>t.length>0))].sort((t,r)=>t.localeCompare(r))}function Wl(e){let t=e.key.trim();if(t.length===0)return null;let r=te(e.aliases),n=e.description?.trim();return{key:t,values:te(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 Kl=e=>e,Co=e=>{let t=e.trim().toLowerCase();return t==="create"||t==="update"?t:null};function Hl(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 Yl(e,t){let r=new Map;for(let n of e??[]){let o=Hl(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 To(e,t){return t?te(e):void 0}function xr(e){let t=e?.trim();return t&&t.length>0?t:void 0}function Nr(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 Io(e,t={}){let r=t.resolvePolicyCommand??Kl,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=te(e.aliases),l=(e.options??[]).map(f=>Wl(f)).filter(f=>f!==null).sort((f,u)=>f.key.localeCompare(u.key)),d=Yl(e.command_option_policies,r);return{name:n,description:xr(e.description),default_status:xr(e.default_status),...e.execution_role===void 0?{}:{execution_role:Nr(e.execution_role)},folder:xr(e.folder),aliases:c.length>0?c:void 0,required_create_fields:To(e.required_create_fields,o),required_create_repeatables:To(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]="f40ddc8e-1dd5-5f26-b2ba-fbbac30a1781")}catch{}})();var Jl=Object.freeze({decision:"human",milestone:"gate"}),Ql=["title","description","status","priority","tags","body","deadline","estimatedMinutes","acceptanceCriteria","author","message","assignee"],Zl=["dep","comment","note","learning","file","test","doc"],xo=["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"],ed=["title","description","type","status","priority","tags","body",...xo,"author","message","dep","comment","note","learning","file","test","doc","reminder","event","typeOption","field"],td=["title","description","body","status","closeReason","priority","type","tags",...xo,"author","message","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ownershipMetadataBypass","ownershipDependencyBypass","force"],No={"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"},rd={...No},nd={...No},Do=[["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"]],Po=[["comment","--comment"],["note","--note"],["learning","--learning"],["file","--file"],["test","--test"],["doc","--doc"],["reminder","--reminder"],["event","--event"],["typeOption","--type-option"]];function Mo(e){return Object.fromEntries(e)}var od=Mo([["title","--title"],["description","--description"],["type","--type"],["status","--status"],["priority","--priority"],["tags","--tags"],["body","--body"],...Do,["author","--author"],["message","--message"],["dep","--dep"],...Po]),id=Mo([["title","--title"],["description","--description"],["body","--body"],["status","--status"],["closeReason","--close-reason"],["priority","--priority"],["type","--type"],["tags","--tags"],...Do,...Po,["author","--author"],["message","--message"],["force","--force"]]);function sd(e){return e.trim().replace(/^--+/,"").toLowerCase()}function ad(e){return e==="create"?ed:td}function cd(e){return e==="create"?rd:nd}function $o(e,t){let r=sd(t);return r.length===0?void 0:cd(e)[r]||ad(e).find(n=>n.toLowerCase()===r)}function ah(e,t){return(e==="create"?od:id)[t]??`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`}function Pr(e){let t=dd(e);return t.length===0?"items":t.endsWith("s")?t:`${t}s`}function ld(e){let t=e.trim(),r=t.replaceAll("\\","/").replace(/^\/+/,""),n=Xl.posix.normalize(r);if(t.includes("\0")||/^[A-Za-z]:/.test(n)||n==="."||n===".."||n.startsWith("../"))throw new Error(`Item type folder "${e}" must stay inside the pm tracker root.`);return n}function dd(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 ud(e){return Io(e,{resolvePolicyCommand:Co})}function Ge(e,t){let r=e[t];return Array.isArray(r)?r.filter(n=>typeof n=="string"):void 0}function md(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e;return typeof t.key!="string"?null:{key:t.key,values:Ge(t,"values")??[],required:t.required===void 0?void 0:!!t.required,aliases:Ge(t,"aliases"),description:typeof t.description=="string"?t.description:void 0}}function fd(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 pd(e){if(Array.isArray(e.options))return e.options.map(t=>md(t)).filter(t=>t!==null)}function _d(e){if(Array.isArray(e.command_option_policies))return e.command_option_policies.map(t=>fd(t)).filter(t=>t!==null)}function gd(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:Nr(t.execution_role),folder:n,aliases:Ge(t,"aliases"),required_create_fields:Ge(t,"required_create_fields"),required_create_repeatables:Ge(t,"required_create_repeatables"),options:pd(t),command_option_policies:_d(t)}}function yd(e,t){return e.required_create_fields?te(e.required_create_fields):t?.required_create_fields??[]}function hd(e,t){return e.required_create_repeatables?te(e.required_create_repeatables):t?.required_create_repeatables??[]}function bd(e,t){return e.options?e.options:t?.options?[...t.options]:[]}function wd(e,t){return e.command_option_policies?e.command_option_policies:t?.command_option_policies?[...t.command_option_policies]:[]}function vd(e,t){let r=t?.name??e.name,n=e.description??t?.description,o=e.default_status??t?.default_status,i=ld(e.folder??t?.folder??Pr(r)),s={name:r,execution_role:e.execution_role,folder:i,aliases:te([...t?.aliases??[],...e.aliases??[]]),required_create_fields:yd(e,t),required_create_repeatables:hd(e,t),options:bd(e,t),command_option_policies:wd(e,t)};return n&&(s.description=n),o&&(s.default_status=o),s}function Ro(e,t){for(let r of e){let n=ud(r);if(!n)continue;let o=n.name.toLowerCase(),i=t.get(o);t.set(o,vd({...n,execution_role:n.execution_role??i?.execution_role},i))}}function Ed(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=gd(o);i&&t.push(i)}}return t}function ch(e,t=null){let r=new Map;for(let c of Bn)r.set(c.toLowerCase(),{name:c,execution_role:Jl[c.toLowerCase()]??"agent",folder:Fe[c],aliases:[],required_create_fields:[...Ql],required_create_repeatables:[...Zl],options:[],command_option_policies:[]});Ro(e.item_types?.definitions??[],r),Ro(Ed(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 kd(e,t){if(e!==void 0)return t.alias_to_type[e.trim().toLowerCase()]}function Od(e,t){let r=kd(e,t);if(r)return t.by_type[r]}function Ad(e,t,r,n){for(let o of n){let i=$o(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 Dr(e,t,r){if(r){e.add(t);return}e.delete(t)}function Sd(e,t,r,n){let o=$o(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&&Dr(e.required,o,n.required),n.visible!==void 0&&Dr(e.hidden,o,!n.visible),n.enabled!==void 0&&Dr(e.disabled,o,!n.enabled)}function Td(e,t,r){for(let n of t.command_option_policies)n.command===r&&Sd(e,t,r,n)}function Cd(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 lh(e,t,r){let n=[],o=new Set,i=new Set,s=new Set,a={required:o,hidden:i,disabled:s,errors:n};return Ad(a,e,t,r),Td(a,e,t),Cd(a,e,t),{required:[...o],hidden:[...i].sort((c,l)=>c.localeCompare(l)),disabled:[...s].sort((c,l)=>c.localeCompare(l)),errors:n}}function Id(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 Rd(e,t,r){let n=e.values;if(n.length===0)return t;let o=new Map(n.map(i=>[i.toLowerCase(),i])).get(t.toLowerCase());if(!o){r.push(`Invalid value "${t}" for type option "${e.key}". Allowed: ${n.join(", ")}`);return}return o}function dh(e,t,r){let n=Od(e,r);if(!n)return{normalized:void 0,errors:[`Unknown type "${e}"`]};let o=[],i=Id(n),s={};for(let[c,l]of Object.entries(t??{})){let d=c.trim(),f=l.trim();if(d.length===0){o.push("type option keys must not be empty");continue}if(f.length===0){o.push(`type option "${d}" must not be empty`);continue}let u=i.get(d.toLowerCase());if(!u){let p=n.options.map(_=>_.key).join(", ");o.push(n.options.length>0?`Unknown type option "${d}" for type "${n.name}". Allowed: ${p}`:`Type "${n.name}" does not define any configurable type options`);continue}let m=Rd(u,f,o);m!==void 0&&(s[u.key]=m)}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}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e1a10a41-219e-52fe-8369-94b8d842a29b")}catch{}})();var Pd={json_markdown:".md",toon:".toon"},Md={".md":"json_markdown",".toon":"toon"};var bh=[".md",".toon"];function Dt(e){try{return Nd(e),!0}catch{return!1}}function $d(e){try{let t=JSON.parse(xd(e,"utf8"));return typeof t!="object"||t===null||Array.isArray(t)?!1:"id_prefix"in t||"item_format"in t}catch{return!1}}function Ld(e){let t=O.resolve(e);for(;;){let r=O.join(t,ht),n=O.join(r,bt);if(Dt(n))return r;let o=O.join(t,bt);if(Dt(o)&&$d(o))return t;let i=O.dirname(t);if(i===t)return;t=i}}function jd(e){return Ld(e)??O.resolve(e,ht)}function wh(e,t){let r=process.env.PM_PATH,n=t?.trim()||r?.trim();if(n){let o=O.resolve(e,n);if(!Dt(Lo(o))){let i=O.join(o,ht);if(Dt(Lo(i)))return i}return o}return jd(e)}function vh(e){let t=O.resolve(e),r=O.dirname(t);return O.basename(t)==="pm"&&O.basename(r)===".agents"?O.dirname(r):t}function jo(e){let t=process.env.PM_GLOBAL_PATH?.trim(),r=t&&t.length>0?t:O.join(Dd.homedir(),".pm-cli");return O.resolve(e,r)}function Lo(e){return O.join(e,bt)}function Fd(e,t,r=Fe){let n=r[t]??Pr(t);return O.join(e,n)}function Eh(e,t,r,n="toon",o=Fe){return O.join(Fd(e,t,o),`${r}${Pd[n]}`)}function kh(e){let t=e.replaceAll("\\","/"),r=O.posix.extname(t).toLowerCase();return Md[r]??null}function Oh(e,t){if(!/^(?!\.{1,2}$)[^/\\:\0]+$/.test(t))throw new h("Invalid history item id: expected a single filename.",y.USAGE);return O.join(e,"history",`${t}.jsonl`)}function Fo(e,t){return O.join(e,"locks",`${t}.lock`)}function Ah(e){return O.join(e,"runtime")}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="559b05dc-0290-5a7c-97b9-ef1e5e8670ba")}catch{}})();function Uo(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]="17ae377d-20c2-5e45-825a-48a79c6c7601")}catch{}})();function R(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return t}function D(e,t){if(t!==void 0&&typeof t!="boolean")throw new TypeError(`${e} must be a boolean when provided`)}function A(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 zo(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 ge(e,t){if(t!==void 0){if(!Array.isArray(t))throw new TypeError(`${e} must be an array of non-empty strings when provided`);for(let[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 We(e,t){if(ge(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 Mr=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]="60fd882d-7c92-5be5-bf46-7e3c128bfb58")}catch{}})();var Ud=new Set(Mr);function zd(e){if(e!==void 0&&!Ud.has(String(e)))throw new Error(`registerCommand definition.family must be one of: ${Mr.join(", ")}`)}function qo(e){A("registerCommand definition.action",e.action),A("registerCommand definition.family",e.family),A("registerCommand definition.description",e.description),A("registerCommand definition.intent",e.intent),A("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");zd(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]="07cb237c-3956-5997-85f8-972d2ee490d0")}catch{}})();function qd(e){let t=R("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 A("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 Bo(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=qd(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 $r(e,t,r){return{registration:t,action:r,command:e.command,args:P(e.args),options:P(e.options),global:P(e.global),pm_root:e.pm_root,source_workspace_root:e.source_workspace_root,repo_root:e.repo_root,pm_root_rel:e.pm_root_rel,...e.sdk===void 0?{}:{sdk:e.sdk}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fc2e7eac-cd1c-5885-aa27-e98455008a4f")}catch{}})();function Vo(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]="bb1b4879-079c-50d4-afa5-e8a36ead2e5c")}catch{}})();function U(e){return typeof e!="string"?"":e.trim().toLowerCase()}function w(e){return new Set((e??[]).map(t=>t.trim().toLowerCase()).filter(t=>t.length>0))}function Bd(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 Te(e){return new Set((e??[]).map(t=>Bd(t)).filter(t=>t.length>0))}function Go(e){let t=U(e);return ft.includes(t)?t:"off"}function Wo(e){let t=U(e);return pt.includes(t)?t:"off"}function Ke(e){let t=U(e);return _t.includes(t)?t:"none"}function Lr(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return qn.includes(t)?t:void 0}function Ko(e){if(typeof e=="string"){let t=Lr(e)??"block";return{global:t,project:t}}return typeof e=="object"&&e!==null&&!Array.isArray(e)?{global:Lr(e.global)??"block",project:Lr(e.project)??"block"}:{global:"block",project:"block"}}function Vd(e){return e.global===e.project?e.global:{global:e.global,project:e.project}}function v(e){return[...new Set(e)].sort((t,r)=>t.localeCompare(r))}function Gd(e){let t=U(e.name);return t.length===0?null:{name:t,normalized:{name:t,disabled:e.disabled===!0,requireTrusted:e.require_trusted===!0,requireProvenance:e.require_provenance===!0,sandboxProfile:e.sandbox_profile!==void 0?Ke(e.sandbox_profile):void 0,allowedCapabilities:w(e.allowed_capabilities),blockedCapabilities:w(e.blocked_capabilities),allowedSurfaces:Te(e.allowed_surfaces),blockedSurfaces:Te(e.blocked_surfaces),allowedCommands:w(e.allowed_commands),blockedCommands:w(e.blocked_commands),allowedActions:w(e.allowed_actions),blockedActions:w(e.blocked_actions),allowedServices:w(e.allowed_services),blockedServices:w(e.blocked_services)}}}function Ho(e){let t=new Map;for(let r of e??[]){let n=Gd(r);n&&t.set(n.name,n.normalized)}return t}function Wd(e){let t=[],r=[...e.overridesByName.values()].sort((o,i)=>o.name.localeCompare(i.name));for(let o of v([...e.allowedCapabilities,...e.blockedCapabilities]))J(o)||t.push(`extension_policy_unknown_capability:${o}`);for(let o of r)for(let i of v([...o.allowedCapabilities,...o.blockedCapabilities]))J(i)||t.push(`extension_policy_unknown_capability:${o.name}:${i}`);let n=new Set(gt);for(let o of v([...e.allowedSurfaces,...e.blockedSurfaces]))n.has(o)||t.push(`extension_policy_unknown_surface:${o}`);for(let o of r)for(let i of v([...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 Yo(e){let t=e.extensions?.policy??{},r=w(t.allowed_capabilities),n=w(t.blocked_capabilities),o=Te(t.allowed_surfaces),i=Te(t.blocked_surfaces),s=Ho(t.extension_overrides);return{mode:Go(t.mode),trustMode:Wo(t.trust_mode),pmMaxVersionExceededMode:Ko(t.pm_max_version_exceeded_mode),requireProvenance:t.require_provenance===!0,trustedExtensions:w(t.trusted_extensions),defaultSandboxProfile:Ke(t.default_sandbox_profile),allowedExtensions:w(t.allowed_extensions),blockedExtensions:w(t.blocked_extensions),allowedCapabilities:r,blockedCapabilities:n,allowedSurfaces:o,blockedSurfaces:i,allowedCommands:w(t.allowed_commands),blockedCommands:w(t.blocked_commands),allowedActions:w(t.allowed_actions),blockedActions:w(t.blocked_actions),allowedServices:w(t.allowed_services),blockedServices:w(t.blocked_services),overridesByName:s,warnings:Wd({allowedCapabilities:r,blockedCapabilities:n,allowedSurfaces:o,blockedSurfaces:i,overridesByName:s})}}function Xo(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:v(r.allowedCapabilities)}:{},...r.blockedCapabilities.size>0?{blocked_capabilities:v(r.blockedCapabilities)}:{},...r.allowedSurfaces.size>0?{allowed_surfaces:v(r.allowedSurfaces)}:{},...r.blockedSurfaces.size>0?{blocked_surfaces:v(r.blockedSurfaces)}:{},...r.allowedCommands.size>0?{allowed_commands:v(r.allowedCommands)}:{},...r.blockedCommands.size>0?{blocked_commands:v(r.blockedCommands)}:{},...r.allowedActions.size>0?{allowed_actions:v(r.allowedActions)}:{},...r.blockedActions.size>0?{blocked_actions:v(r.blockedActions)}:{},...r.allowedServices.size>0?{allowed_services:v(r.allowedServices)}:{},...r.blockedServices.size>0?{blocked_services:v(r.blockedServices)}:{}}));return{mode:e.mode,trust_mode:e.trustMode,pm_max_version_exceeded_mode:Vd(e.pmMaxVersionExceededMode),require_provenance:e.requireProvenance,trusted_extensions:v(e.trustedExtensions),default_sandbox_profile:e.defaultSandboxProfile,allowed_extensions:v(e.allowedExtensions),blocked_extensions:v(e.blockedExtensions),allowed_capabilities:v(e.allowedCapabilities),blocked_capabilities:v(e.blockedCapabilities),allowed_surfaces:v(e.allowedSurfaces),blocked_surfaces:v(e.blockedSurfaces),allowed_commands:v(e.allowedCommands),blocked_commands:v(e.blockedCommands),allowed_actions:v(e.allowedActions),blocked_actions:v(e.blockedActions),allowed_services:v(e.allowedServices),blocked_services:v(e.blockedServices),extension_overrides:t}}function Jo(e){let t=Ho(e.extension_overrides);return{mode:Go(e.mode),trustMode:Wo(e.trust_mode),pmMaxVersionExceededMode:Ko(e.pm_max_version_exceeded_mode),requireProvenance:e.require_provenance===!0,trustedExtensions:w(e.trusted_extensions),defaultSandboxProfile:Ke(e.default_sandbox_profile),allowedExtensions:w(e.allowed_extensions),blockedExtensions:w(e.blocked_extensions),allowedCapabilities:w(e.allowed_capabilities),blockedCapabilities:w(e.blocked_capabilities),allowedSurfaces:Te(e.allowed_surfaces),blockedSurfaces:Te(e.blocked_surfaces),allowedCommands:w(e.allowed_commands),blockedCommands:w(e.blocked_commands),allowedActions:w(e.allowed_actions),blockedActions:w(e.blocked_actions),allowedServices:w(e.allowed_services),blockedServices:w(e.blocked_services),overridesByName:t,warnings:[]}}function re(e,t){return e.overridesByName.get(U(t))??null}function Ce(e,t,r,n,o){return t.has(r)?o:e.size>0&&!e.has(r)?n:null}function Qo(e,t,r){let n=r.trim().toLowerCase(),o=re(e,t.name),i=o&&o.allowedCapabilities.size>0?o.allowedCapabilities:e.allowedCapabilities,s=new Set([...e.blockedCapabilities,...o?o.blockedCapabilities:[]]);return Ce(i,s,n,"capability_not_allowlisted","capability_blocked")}function Kd(e,t,r){let n=re(e,t.name),o=n&&n.allowedSurfaces.size>0?n.allowedSurfaces:e.allowedSurfaces,i=new Set([...e.blockedSurfaces,...n?n.blockedSurfaces:[]]);return Ce(o,i,r,"surface_not_allowlisted","surface_blocked")}function Hd(e,t,r){let n=k(r);if(n.length===0)return null;let o=re(e,t.name),i=o&&o.allowedCommands.size>0?o.allowedCommands:e.allowedCommands,s=new Set([...e.blockedCommands,...o?o.blockedCommands:[]]);return Ce(i,s,n,"command_not_allowlisted","command_blocked")}function Yd(e,t,r){let n=U(r).replace(/\s+/g,"-");if(n.length===0)return null;let o=re(e,t.name),i=o&&o.allowedActions.size>0?o.allowedActions:e.allowedActions,s=new Set([...e.blockedActions,...o?o.blockedActions:[]]);return Ce(i,s,n,"action_not_allowlisted","action_blocked")}function Xd(e,t,r){let n=U(r);if(n.length===0)return null;let o=re(e,t.name),i=o&&o.allowedServices.size>0?o.allowedServices:e.allowedServices,s=new Set([...e.blockedServices,...o?o.blockedServices:[]]);return Ce(i,s,n,"service_not_allowlisted","service_blocked")}function Jd(e,t){let r=U(t.name);return re(e,t.name)?.disabled===!0?"extension_override_disabled":Ce(e.allowedExtensions,e.blockedExtensions,r,"extension_not_allowlisted","extension_blocked")}function Qd(e,t){if(e.trustMode==="off")return null;let r=re(e,t.name),n=U(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 Zd(e,t){if(e.mode==="off")return null;let r=re(e,t.name)?.sandboxProfile??t.sandboxProfile??e.defaultSandboxProfile;if(r==="none")return null;let n=t.permissions;if(!n)return"sandbox_permissions_missing";let o=i=>n[i]===!0;return r==="restricted"?o("process_spawn")?"sandbox_restricted_disallows_process_spawn":o("env_write")?"sandbox_restricted_disallows_env_write":null:o("process_spawn")?"sandbox_strict_disallows_process_spawn":o("network")?"sandbox_strict_disallows_network":o("fs_write")?"sandbox_strict_disallows_fs_write":o("env_write")?"sandbox_strict_disallows_env_write":null}function Pt(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 Zo(e,t){if(e.mode==="off"&&e.trustMode==="off")return{allowed:!0,warning:null};let r=[],n=Jd(e,t);n&&r.push({reason:n,scope:"extension",mode:e.mode});let o=Qd(e,t);o&&r.push({reason:o,scope:"trust",mode:e.trustMode});let i=Zd(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:Pt("blocked",s.scope,t,s.reason)};let a=r.find(c=>c.mode==="warn");return a?{allowed:!0,warning:Pt("violation",a.scope,t,a.reason)}:{allowed:!0,warning:null}}function ei(e,t,r){if(e.mode==="off")return{allowed:!0,warning:null};let n=Qo(e,t,r);return n?{allowed:e.mode==="warn",warning:Pt(e.mode==="warn"?"violation":"blocked","capability",t,n,{capability:r.trim().toLowerCase()})}:{allowed:!0,warning:null}}function eu(e,t,r,n,o){let i=typeof n=="string"?Qo(e,t,n):null,s=Kd(e,t,r),a=o.command?Hd(e,t,o.command):null,c=o.action?Yd(e,t,o.action):null,l=o.service?Xd(e,t,o.service):null;return i??s??a??c??l}function tu(e,t,r,n){let o={method:U(e).replace(/\s+/g,"_"),surface:t};return r&&(o.capability=r),n.command&&(o.command=k(n.command)),n.action&&(o.action=U(n.action).replace(/\s+/g,"-")),n.service&&(o.service=U(n.service)),o}function ti(e,t,r,n,o,i){if(e.mode==="off")return{allowed:!0,warning:null};let s=i??{},a=eu(e,t,r,o,s);if(!a)return{allowed:!0,warning:null};let c=Pt(e.mode==="warn"?"violation":"blocked","registration",t,a,tu(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]="01116a5e-62d1-591b-9fd0-84ac6e99f8d0")}catch{}})();function Mt(){return{beforeCommand:[],beforeMutation:[],afterCommand:[],onWrite:[],onRead:[],onIndex:[]}}function jr(){return{overrides:[],handlers:[]}}function Fr(){return{overrides:[]}}function Ur(){return{overrides:[]}}function zr(){return{overrides:[]}}function qr(){return{overrides:[]}}function Br(){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]="cd1de600-27e4-522b-842e-1993c12e9f0e")}catch{}})();var ni=100;function ri(e,t){let r=e[t];if(r!=null)return typeof r!="string"||r.trim().length===0?null:r.trim()}function ru(e){if(e==null)return;let t=ee(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 Vr(e,t){let r=e[t];return typeof r!="string"||r.trim().length===0?null:r.trim()}function oi(e){if(e!=null)return typeof e!="number"||!Number.isInteger(e)?null:e}function ye(e){if(e!=null)return typeof e!="boolean"?null:e}function nu(e){let t=oi(e.priority);return t===void 0?ni:t}function ou(e){let t=e.sandbox_profile;if(t==null)return;if(typeof t!="string")return null;let r=Ke(t);return r!==t.trim().toLowerCase()?null:r}function Gr(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function iu(e){if(e==null)return;let t=ee(e);if(!t)return null;let r=Gr(t.source),n=Gr(t.signature),o=Gr(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 su(e){if(e==null)return;let t=ee(e);if(!t)return null;let r=ye(t.fs_read),n=ye(t.fs_write),o=ye(t.network),i=ye(t.env_read),s=ye(t.env_write),a=ye(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 au(e){if(e==null)return{capabilities:[],legacy_aliases:[]};if(!Array.isArray(e)||e.some(r=>typeof r!="string"))return null;let t=io(e);return{capabilities:t.capabilities,legacy_aliases:t.legacy_aliases}}function cu(e){if(e==null)return;let t=ee(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=>k(o)).filter(o=>o.length>0))].sort((o,i)=>o.localeCompare(i));return n.length>0?{commands:n}:void 0}function lu(e){let t=oi(e.manifest_version);if(t===null)return null;let r=ri(e,"pm_min_version");if(r===null)return null;let n=ri(e,"pm_max_version");if(n===null)return null;let o=ru(e.engines);if(o===null)return null;let i=ye(e.trusted);if(i===null)return null;let s=ou(e);if(s===null)return null;let a=iu(e.provenance);if(a===null)return null;let c=su(e.permissions);if(c===null)return null;let l=au(e.capabilities);if(l===null)return null;let d=cu(e.activation);if(d===null)return null;let f=kt(e.contributions);return f===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:f}}function Wr(e){if(typeof e!="object"||e===null)return null;let t=e,r=Vr(t,"name");if(r===null)return null;let n=Vr(t,"version");if(n===null)return null;let o=Vr(t,"entry");if(o===null)return null;let i=nu(t);if(i===null)return null;let s=lu(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{constants as ne}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]="151124a3-cefa-55d3-bf4f-bd8f2553ad72")}catch{}})();var ii=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"}]]),du=/^[a-z][a-z0-9_]{0,63}$/u,uu=new Map([[ne.errno.EACCES,"EACCES"],[ne.errno.EDQUOT,"EDQUOT"],[ne.errno.EMFILE,"EMFILE"],[ne.errno.ENFILE,"ENFILE"],[ne.errno.ENOMEM,"ENOMEM"],[ne.errno.ENOSPC,"ENOSPC"],[ne.errno.EPERM,"EPERM"],[ne.errno.EROFS,"EROFS"]].filter(([e])=>Number.isInteger(e))),mu={capacity:{code:"host_environment_capacity_fault"},permission:{code:"host_environment_permission_fault"},resource:{code:"host_environment_resource_fault"}};function fu(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.code=="string"&&ii.has(t.code)?t.code:typeof t.errno!="number"||!Number.isInteger(t.errno)?null:uu.get(Math.abs(t.errno))??null}function pu(e,t,r={}){let n=fu(e);if(n===null)return null;if(!du.test(t))throw new h("Host environment operation labels must be bounded identifiers.",y.USAGE,{code:"host_environment_operation_invalid",field:"operation"});let o=ii.get(n);return new h(`Host filesystem operation ${t} ${o.summary}.`,y.GENERIC_FAILURE,{code:r.codes?.[o.category]??mu[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 si(e,t,r={}){try{return await t()}catch(n){throw pu(n,e,r)??n}}import _u from"node:fs/promises";import He 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]="029e0066-2ef5-5204-92ad-4866321710f4")}catch{}})();async function ai(e,t){let r=He.dirname(t.manifest_path),n=He.relative(r,t.entry_path);if(n.startsWith("..")||He.isAbsolute(n))throw new Error(`Cannot snapshot extension entry outside its package directory: ${t.entry_path}`);let o=He.join(e,`${t.layer}-${t.directory.replace(/[^a-zA-Z0-9._-]/gu,"_")}`);return await si("extension_module_graph_snapshot",()=>_u.cp(r,o,{recursive:!0,force:!0})),He.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]="bf5c3834-b388-507e-a13c-3beb5d096abb")}catch{}})();function ci(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 k(n)}))];return{run:t,...r.length>0?{commands:r}:{}}}function li(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]="c24357cc-5dad-5cd7-aa89-cddd2945aab7")}catch{}})();var gu=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"}]),Kr=new Set(gu.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]="0403fec1-f10a-5361-982b-c127c2617e95")}catch{}})();var yu=/^--[a-z0-9][a-z0-9_-]*(?:[ =](?:<[^<>]+>|\[[^[\]]+\]))?$/;function hu(e){if(typeof e!="string")return null;let t=e.trim(),r=t.split(/[ =]/,1)[0];return Kr.has(r)?"host_owned_flag_collision":yu.test(t)?null:"malformed_long_flag"}function di(e,t){let r=[e,t].find(i=>typeof i=="string"&&Kr.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=hu(n);return o===null?null:{token:n,failure:o}}function ui(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]="a2ab8801-f75b-5ba0-88a5-354d24c37c6f")}catch{}})();var bu=Object.freeze({string:"string",number:"number",int:"number",integer:"number",float:"number",boolean:"boolean",bool:"boolean"});function mi(e){return typeof e!="string"?null:bu[e.trim().toLowerCase()]??null}function fi(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 pi(e,t){return t==="string"?!0:t==="number"?typeof e=="number"?Number.isFinite(e):typeof e=="string"&&e.trim().length>0&&Number.isFinite(Number(e)):typeof e=="boolean"?!0:typeof e=="string"&&["true","false","1","0"].includes(e.trim().toLowerCase())}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="47d10c23-88f8-5ba1-bcc2-458f339121a8")}catch{}})();var $t=Vn;function _i(e){let t=e.trim().toLowerCase();return $t.includes(t)?t:null}function gi(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 $t)if(It(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]="355fe619-e6f3-51d9-b88c-0b57267c25be")}catch{}})();function yi(e){return e==="toon"||e==="json"}function hi(e){return Oe.includes(e)}function he(e,t){if(typeof t!="function")throw new TypeError(`api.hooks.${e} requires a function handler`)}var bi=Symbol("extension_registration_trace");function K(e,t){let r=new TypeError(e);return Object.defineProperty(r,bi,{value:t,enumerable:!1,configurable:!1,writable:!1}),r}function wi(e){return e instanceof Error?e[bi]:void 0}function Ye(e){if(e===null)return null;if(Array.isArray(e))return e.map(t=>Ye(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]=Ye(t[n]);return r}return e}function Xe(e){if(Array.isArray(e))return e.map(t=>Xe(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]=Xe(t[n]);return r}return e}function Ie(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Ye(t)}function Je(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError(`${e} requires an object definition`);return Xe(t)}function Qe(e,t){if(!Array.isArray(t))throw new TypeError(`${e} requires an array of object definitions`);return t.map(r=>Ie(e,r))}function M(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function Ze(e,t){if(typeof t!="function")throw new TypeError(`${e} requires a function handler`)}function Hr(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function Yr(e,t){return k(`${e} ${t}`)}function et(e,t){return Object.defineProperty(e,"runtime_definition",{value:t,enumerable:!1,writable:!1,configurable:!1}),e}var wu=new Set(["low","medium","high"]),vu=new Set(["number","string_set"]),Eu=new Set(["string","number","boolean"]);function vi(e,t){if(typeof t!="string"||t.trim().length===0)throw new TypeError(`${e} requires a non-empty string`);return t.trim()}function ku(e,t,r){let n=`registerAssuranceMeasurementProvider provider.keys.${t}`,o=R(n,r);if(!vu.has(String(o.value_type)))throw new TypeError(`${n}.value_type must be number or string_set`);if(A(`${n}.description`,o.description),o.parameters===void 0)return;let i=R(`${n}.parameters`,o.parameters);for(let[s,a]of Object.entries(i)){let c=`${n}.parameters.${s}`;vi(`${c}.name`,s);let l=R(c,a);if(!Eu.has(String(l.type)))throw new TypeError(`${c}.type must be string, number, or boolean`);D(`${c}.required`,l.required),A(`${c}.description`,l.description)}if(Object.keys(i).length>50)throw new TypeError(`assurance provider ${e} key ${t} exceeds 50 parameters`)}function Ei(e){let t=R("registerAssuranceMeasurementProvider provider",e),r=vi("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(!wu.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=R("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`);ku(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]="bc1e888a-4274-5d8d-9077-89ca5341172c")}catch{}})();var Ou=new Set(["default","description","enabled","list","long","repeatable","required","short","type","value_name","value_type","visible"]);function Lt(e,t){return Qe(e,t).map(r=>(r.repeatable===!0&&(r.list=!0),r))}function Au(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Xr(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=Au(t);if(r.length===0)throw new TypeError("registerCommand definition.action must contain alphanumeric characters");return r}function Jr(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=R(`registerCommand definition.arguments[${n}]`,o),s=M(`registerCommand definition.arguments[${n}].name`,i.name);if(D(`registerCommand definition.arguments[${n}].required`,i.required),D(`registerCommand definition.arguments[${n}].variadic`,i.variadic),A(`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 jt(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=R(`registerFlags flags[${t}]`,r),o=Object.keys(n).filter(c=>!Ou.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`);A(`registerFlags flags[${t}].long`,i),A(`registerFlags flags[${t}].short`,s);let a=di(i,s);if(a!==null)throw new TypeError(`registerFlags flags[${t}] ${ui(a.token,a.failure)}`);if(A(`registerFlags flags[${t}].value_name`,n.value_name),A(`registerFlags flags[${t}].description`,n.description),D(`registerFlags flags[${t}].required`,n.required),D(`registerFlags flags[${t}].enabled`,n.enabled),D(`registerFlags flags[${t}].visible`,n.visible),D(`registerFlags flags[${t}].list`,n.list),D(`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(zo(`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.`);ki(`registerFlags flags[${t}]`,n)}}function ki(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=mi(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?fi(t.default):[t.default];for(let[i,s]of o.entries())if(!pi(s,n)){let a=o.length>1?`default[${i}]`:"default";throw new TypeError(`${e}.${a} (${JSON.stringify(s)}) is not coercible to ${n}.`)}}function Oi(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=R(`registerItemFields fields[${t}]`,r);M(`registerItemFields fields[${t}].name`,n.name);let o=M(`registerItemFields fields[${t}].type`,n.type);if(_i(o)===null){let i=gi(o),s=i?` Did you mean "${i}"?`:"";throw new TypeError(`registerItemFields fields[${t}].type "${o}" is not a known field type (expected one of: ${$t.join(", ")}).${s}`)}D(`registerItemFields fields[${t}].optional`,n.optional)}}function Su(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=R(i,o);M(`${i}.command`,s.command),M(`${i}.option`,s.option),D(`${i}.enabled`,s.enabled),D(`${i}.required`,s.required),D(`${i}.visible`,s.visible)}}function Tu(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=R(i,o);M(`${i}.key`,s.key),ge(`${i}.values`,s.values),D(`${i}.required`,s.required),ge(`${i}.aliases`,s.aliases)}}function Ai(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=R(n,r);M(`${n}.name`,o.name),A(`${n}.folder`,o.folder),ge(`${n}.aliases`,o.aliases),ge(`${n}.required_create_fields`,o.required_create_fields),ge(`${n}.required_create_repeatables`,o.required_create_repeatables),Su(t,o.command_option_policies),Tu(t,o.options)}}function Si(e){let t=R("registerMigration definition",e);if(t.id!==void 0&&typeof t.id!="string")throw new TypeError("registerMigration definition.id must be a string when provided");if(t.description!==void 0&&typeof t.description!="string")throw new TypeError("registerMigration definition.description must be a string when provided");if(t.status!==void 0&&typeof t.status!="string")throw new TypeError("registerMigration definition.status must be a string when provided");if(D("registerMigration definition.mandatory",t.mandatory),t.run!==void 0&&typeof t.run!="function")throw new TypeError("registerMigration definition.run must be a function when provided")}var Ti=["types","statuses","fields","workflows","config","templates","packages"],Cu={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 Ci(e){let t=R("registerProfile profile",e);if(M("registerProfile profile.name",t.name),M("registerProfile profile.title",t.title),t.summary!==void 0&&typeof t.summary!="string")throw new TypeError("registerProfile profile.summary must be a string when provided");for(let r of Ti){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`);Cu[r]?.(`registerProfile profile.${r}[${o}]`,i)}}}}function Ii(e){e.summary===void 0&&(e.summary="");for(let t of Ti)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]="45ff820c-32af-5bdb-a570-3059684129ce")}catch{}})();function Ri(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]="b5de5028-f981-599b-8d11-0fc7b07beda4")}catch{}})();function xi(e){return typeof e=="string"?e:String(e)}function tt(e){let t=e.trim().replace(/^>=\s*/,"").replace(/^v/i,"").split(/[+-]/,1)[0];return/^\d+(?:[.-]\d+)*$/.test(t)?t.split(/[.-]/).map(r=>Number(r)):null}function Qr(e,t){let r=tt(e),n=tt(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 Ni(e,t){if(e==null)return{kind:"pm_min_version",status:"absent",allowed:!0,required:"",current:t};let r=xi(e);if(typeof e!="string"||r.trim().length===0)return{kind:"pm_min_version",status:"invalid",allowed:!1,required:r,current:t};if(!tt(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=Qr(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 Di(e,t,r){if(e==null)return{kind:"pm_max_version",status:"absent",allowed:!0,required:"",current:t};let n=xi(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())||!tt(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=Qr(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]="1dcf5e56-cb0c-5e4c-b0e8-e4dbd06187dd")}catch{}})();var Iu=5e3;async function Zr(e,t,r){let n=[];for(let o of e)try{await o.run(P(r))}catch{n.push(`extension_hook_failed:${o.layer}:${o.name}:${t}`)}return n}function Ru(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 h(`Extension mutation guard ${t.name} returned an invalid decision.`,y.CONFLICT,{code:"extension_mutation_guard_invalid_decision",reason:`${t.layer}:${t.name}`,nextSteps:["Return { allow: true } or a structured denial from the guard."]});if(e.allow)return;let 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 h(`Extension mutation guard ${t.name} returned an invalid denial.`,y.CONFLICT,{code:"extension_mutation_guard_invalid_denial",reason:`${t.layer}:${t.name}`,nextSteps:["Return non-empty code and remediation fields from the guard."]});let s=typeof n.message=="string"?n.message.trim():"";throw new h(s||`Extension mutation guard ${t.name} denied ${r}.`,y.CONFLICT,{code:o,reason:`${t.layer}:${t.name}`,nextSteps:[i]})}async function en(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:P(t.before),after:t.after===null?null:P(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 h(`Extension mutation guard ${r.name} timed out before ${t.operation}.`,y.CONFLICT,{code:"extension_mutation_guard_timed_out",reason:`${r.layer}:${r.name}`,nextSteps:["Fix or disable the stalled extension guard, then retry the mutation."]}))},Iu),o.unref?.()})])}catch(i){throw i instanceof h?i:new h(`Extension mutation guard ${r.name} failed before ${t.operation}.`,y.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)}Ru(n,r,t.operation)}}async function tn(e,t){return Zr(e.onWrite,"onWrite",t)}async function rn(e,t){return Zr(e.onRead,"onRead",t)}async function nn(e,t){return Zr(e.onIndex,"onIndex",t)}function xu(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 Ft(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 Nu(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 on(e,t){let r=k(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:P(t.args),options:P(t.options),global:P(t.global),pm_root:t.pm_root,source_workspace_root:t.source_workspace_root,repo_root:t.repo_root,pm_root_rel:t.pm_root_rel,...t.sdk===void 0?{}:{sdk:t.sdk}});return{handled:!0,result:o,warnings:[],...Object.fromEntries([["exitCode",Nu(o)],["errorCode",Ft(o,"code")],["remediation",Ft(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:xu(o),...Object.fromEntries([["errorCode",Ft(o,"code")],["remediation",Ft(o,"remediation")]].filter(s=>s[1]!==void 0))}}}function Pi(e){return{handled:!1,result:e.payload,warnings:[]}}function Mi(e,t){return[...e.overrides].reverse().filter(r=>r.service===t)}function $i(e){return{service:e.service,command:e.command?k(e.command):void 0,args:e.args?P(e.args):void 0,options:e.options?Yn(e.options):void 0,global:e.global?Xn(e.global):void 0,pm_root:e.pm_root,source_workspace_root:e.source_workspace_root,repo_root:e.repo_root,pm_root_rel:e.pm_root_rel,payload:P(e.payload)}}function Du(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 Li(e,t){return Du(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 ji(e,t,r){return t.service==="output_format"&&typeof e=="object"&&e!==null&&V(e,r.payload)}function Fi(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 sn(e,t){let r=Mi(e,t.service);if(r.length===0)return Pi(t);let n=[];for(let o of r)try{let i=$i(t),s=o.run(i);if(s instanceof Promise){n.push(`extension_service_override_async_unsupported:${o.layer}:${o.name}:${o.service}`);continue}if(ji(s,t,i)){n.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=Fi(o,Li(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 an(e,t){let r=Mi(e,t.service);if(r.length===0)return Pi(t);let n=[];for(let o of r)try{let i=$i(t),s=await Promise.resolve(o.run(i));if(ji(s,t,i)){n.push(`extension_output_format_payload_echo_deprecated:${o.layer}:${o.name}`);continue}let a=Fi(o,Li(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(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="79f32043-06a1-5929-ac52-bc4a003806fc")}catch{}})();var Ui=null,Fu=Object.freeze(yt()),zi=0;function Uu(e=Date.now()){return zi+=1,`${zi}-${e}`}function zu(e,t,r){return r.has(e)?!1:t.size===0?!0:t.has(e)}async function qu(e,t){let[r,n]=await Promise.all([we.realpath(e),we.realpath(t)]);return Tr(r,n)}function Bu(e,t=process.cwd()){return{global:be.join(jo(t),"extensions"),project:be.join(e,"extensions")}}async function Vu(e){try{return(await we.readdir(e,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,r)=>t.localeCompare(r))}catch{return[]}}function Gu(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 qi(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}async function Wu(e){let t=new Map;try{let r=JSON.parse(await we.readFile(be.join(e,".managed-extensions.json"),"utf8")),n=ee(r)?.entries;if(!Array.isArray(n))return t;for(let o of n){if(typeof o!="object"||o===null)continue;let i=o,s=qi(i.source?.package),a=[i.source?.input,i.source?.name,s].map(d=>qi(d)).filter(d=>d!==void 0),c=kt(i.contributions),l={aliases:[...new Set(a)],...s?{package_name:s}:{},...c?{contributions:c}:{}};typeof i.directory=="string"&&i.directory.trim().length>0&&t.set(`directory:${i.directory.trim()}`,l),typeof i.name=="string"&&i.name.trim().length>0&&t.set(`name:${i.name.trim()}`,l)}}catch{return t}return t}function Bi(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 Ku(e,t){let r=[...Bi(e),...Bi(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 Vi(e,t,r,n,o){let i=[],s=[],a=[],c=await Vu(t),l=await Wu(t);for(let d of c){let f=await Xu(e,t,d,r,n,l,o);i.push(f.diagnostic),s.push(...f.warnings),f.candidate&&a.push(f.candidate)}return{diagnostics:i,warnings:s,candidates:a}}function Hu(){return{diagnostics:[],warnings:[],candidates:[]}}function Gi(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 Yu(e,t,r,n,o,i,s){let a=Kn(e,t,r);Array.isArray(t.legacy_capability_aliases)&&t.legacy_capability_aliases.length>0&&a.push(ao(e,t.name,t.legacy_capability_aliases));for(let c of oo(t.capabilities))a.push(so(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 Xu(e,t,r,n,o,i,s){let a=be.join(t,r),c=be.join(a,"manifest.json");if(!await Sr(c))return Gi(e,r,c,`extension_manifest_missing:${e}:${r}`);let l,d;try{let zn=JSON.parse(await we.readFile(c,"utf8"));d=ee(zn),l=Wr(zn)}catch{d=null,l=null}if(!l||!d)return Gi(e,r,c,`extension_manifest_invalid:${e}:${r}`);let f=be.resolve(a,l.entry),u=Tr(a,f),m=u?await Sr(f):!1,p=u&&m?await qu(a,f):u,_=zu(l.name,n,o),g=await Zu(e,l),b=await em(e,l,s),T=Yu(e,l,d,p,m,g,b),mt=p&&m&&g.allowed&&b.allowed,qa=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:f,enabled:_,status:mt?"ok":"warn"},warnings:T,candidate:Vo({layer:e,directory:r,manifestPath:c,entryPath:f,manifest:l,sourceIdentity:qa,extensionReady:mt,enabledForLoad:_})}}async function Ju(e){let t=Bu(e.pmRoot,e.cwd??process.cwd()),r=Be(e.settings.extensions.enabled),n=Be(e.settings.extensions.disabled),o=Yo(e.settings),i=Xo(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?Hu():await Vi("global",t.global,s,a,o.pmMaxVersionExceededMode.global),l=await Vi("project",t.project,s,a,o.pmMaxVersionExceededMode.project),d=[...o.warnings],f=Ku(c.candidates,l.candidates),u=[];for(let m of f){let p={layer:m.layer,name:m.manifest.name,trusted:m.manifest.trusted===!0,provenanceVerified:m.manifest.provenance?.verified===!0,sandboxProfile:m.manifest.sandbox_profile,permissions:m.manifest.permissions&&typeof m.manifest.permissions=="object"?{fs_read:m.manifest.permissions.fs_read,fs_write:m.manifest.permissions.fs_write,network:m.manifest.permissions.network,env_read:m.manifest.permissions.env_read,env_write:m.manifest.permissions.env_write,process_spawn:m.manifest.permissions.process_spawn}:void 0},_=Zo(o,p);if(_.warning&&d.push(_.warning),!!_.allowed){for(let g of m.manifest.capabilities){let b=ei(o,p,g);b.warning&&d.push(b.warning)}u.push(Gu(m))}}return{disabled_by_flag:!1,roots:t,configured_enabled:r,configured_disabled:n,discovered:[...c.diagnostics,...l.diagnostics],effective:u,warnings:[...new Set([...c.warnings,...l.warnings,...d])],policy:i}}function Ut(e){return e instanceof Error&&e.message.trim().length>0?e.message:String(e)}async function Qu(){try{let e=Rr(import.meta.url,["../../.."]),t=await we.readFile(be.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 Hi(){return Ui??=Qu(),Ui}function Yi(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 Zu(e,t){if(t.pm_min_version===void 0)return{allowed:!0};let r=Ni(t.pm_min_version,await Hi()),n=Yi(e,t,r);return n?{allowed:r.allowed,warning:n}:{allowed:r.allowed}}async function em(e,t,r){if(t.pm_max_version===void 0)return{allowed:!0};let n=Di(t.pm_max_version,await Hi(),r),o=Yi(e,t,n);return o?{allowed:n.allowed,warning:o}:{allowed:n.allowed}}async function Wi(e){try{let t=await we.stat(e);return`${Math.trunc(t.mtimeMs)}-${t.size}`}catch{return"missing"}}async function tm(e,t){let r=e.entry_path;t.module_graph_snapshot_root&&(r=await ai(t.module_graph_snapshot_root,e));let n=new URL(ju(r).href);if(!(t.cache_bust===!0||typeof t.reload_token=="string"))return n.href;let[o,i]=await Promise.all([Wi(e.entry_path),Wi(e.manifest_path)]),s=t.reload_token??Uu();return n.searchParams.set("pm_ext_reload",s),n.searchParams.set("pm_ext_entry",o),n.searchParams.set("pm_ext_manifest",i),n.href}async function lw(e){let t=await Ju(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 a=await import(await tm(s,e));r.push({...s,module:a})}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:Ut(a)})}return{...t,warnings:o,loaded:r,failed:n}}var Ki=5e3,rm=2147483647;function nm(e){let t={activate:e.activate.bind(e)};if(typeof e.deactivate=="function"){let r=e.deactivate;t.deactivate=r.bind(e)}return t}function Xi(e){let t=So(e);return t?nm(t):null}async function dw(e,t,r={}){let n=om(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 f=Xi(d.module);!f||typeof f.deactivate!="function"||i.push({extension:d,deactivate:f.deactivate})}let s=await Promise.all(i.map(async({extension:d,deactivate:f})=>{try{return await im(f,n),{ok:!0}}catch(u){return{ok:!1,layer:d.layer,name:d.name,error:Ut(u)}}})),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 om(e){return typeof e!="number"||e<0?Ki:e===0||e===1/0?0:Number.isFinite(e)?Math.min(rm,Math.max(1,Math.floor(e))):Ki}async function im(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 sm(e){if(!Array.isArray(e.capabilities))return null;let t=new Set;for(let r of e.capabilities){let n=r.trim().toLowerCase();J(n)&&t.add(n)}return t}function E(e,t,r){let n=sm(e);if(n!==null&&!n.has(t))throw K(`${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 am(e){return Object.freeze({name:e.name,layer:e.layer,version:e.version,capabilities:Object.freeze((e.capabilities??[]).filter(t=>B.includes(t))),pm_min_version:e.pm_min_version,pm_max_version:e.pm_max_version,source_package:e.source_package})}function cm(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 cn=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,f){this.#e=t,this.extension=am(t),this.#r=cm(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=f,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:u=>this.registerBeforeCommand(u),beforeMutation:u=>this.registerBeforeMutation(u),afterCommand:u=>this.registerAfterCommand(u),onWrite:u=>this.registerOnWrite(u),onRead:u=>this.registerOnRead(u),onIndex:u=>this.registerOnIndex(u)}}allowRegistration(t,r,n,o){let i=ti(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:Ye(o),hint:i}}registerCommandOverride(t,r){let n=k(t);if(n.length===0)throw K("registerCommand requires a non-empty command name",this.registerCommandTrace("override",t,'registerCommand("<command>", (context) => unknown)',t,"Provide a non-empty command path as the first argument."));if(typeof r!="function"){let o=this.registerCommandTrace("override",n,'registerCommand("<command>", (context) => unknown)',r,"Provide a function as the second registerCommand argument.");throw K(`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 K("registerCommand requires a command definition object",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",t,'Use registerCommand({ name: "command path", run: (context) => ... }).'));if(typeof t.name!="string")throw K("registerCommand requires a command definition name",this.registerCommandTrace("definition",void 0,"{ name: string; run: (context) => unknown; }",t,"Set command definition.name to a non-empty string command path."));let r=k(t.name);if(r.length===0)throw K("registerCommand requires a non-empty command definition name",this.registerCommandTrace("definition",t.name,"{ name: string; run: (context) => unknown; }",t,"Ensure command definition.name contains a non-empty command path."));let 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 K(`registerCommand requires a command definition run handler (command="${r}", registration_index=${o.registration_index})`,o)}try{qo(t);let o=Xr(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=We("registerCommand definition.examples",t.examples),c=We("registerCommand definition.failure_hints",t.failure_hints),l=Jr(t.arguments);t.flags!==void 0&&(E(this.#e,"schema","registerCommand flags"),this.allowRegistration("schema.flags","registerCommand flags","schema")&&(jt(t.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:r,flags:Lt("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=Ut(o),s=this.registerCommandTrace("definition",r,"{ name: string; run: (context) => unknown; action?: string; arguments?: object[]; flags?: object[]; }",t,i),a=K(`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(E(this.#e,"commands","registerCommand"),typeof t=="string"){this.registerCommandOverride(t,r);return}this.registerCommandDefinition(t)}registerParser(t,r){if(E(this.#e,"parser","registerParser"),!this.allowRegistration("parser.override","registerParser","parser"))return;let n=k(M("registerParser command",t));Ze("registerParser override",r),this.#s.overrides.push({layer:this.#e.layer,name:this.#e.name,command:n,run:r})}registerPreflight(t){if(E(this.#e,"preflight","registerPreflight"),!this.allowRegistration("preflight.override","registerPreflight","preflight"))return;let r=ci(t);this.#a.overrides.push({layer:this.#e.layer,name:this.#e.name,...r})}registerService(t,r,n={}){E(this.#e,"services","registerService");let o=String(t).trim().toLowerCase();if(!hi(o))throw new TypeError(`registerService service must be one of: ${Oe.join(", ")}`);this.allowRegistration("services.override","registerService","services",{service:o})&&(Ze("registerService override",r),this.#i.overrides.push({layer:this.#e.layer,name:this.#e.name,service:o,run:r,...Ri(n)?{passThrough:!0}:{}}))}registerRenderer(t,r,n={}){if(E(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(!yi(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 k(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(E(this.#e,"schema","registerFlags"),!this.allowRegistration("schema.flags","registerFlags","schema"))return;let n=k(M("registerFlags targetCommand",t));jt(r);let o=Lt("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(E(this.#e,"schema","registerItemFields"),!this.allowRegistration("schema.itemfields","registerItemFields","schema"))return;Oi(t);let r=Qe("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(E(this.#e,"schema","registerItemTypes"),!this.allowRegistration("schema.itemtypes","registerItemTypes","schema"))return;Ai(t);let r=Qe("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(E(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=_r();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(E(this.#e,"schema","registerMigration"),!this.allowRegistration("schema.migrations","registerMigration","schema"))return;Si(t);let r=Je("registerMigration definition",t);this.#t.migrations.push(et({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerMigration definition",t)},r))}registerProfile(t){if(E(this.#e,"schema","registerProfile"),!this.allowRegistration("schema.profiles","registerProfile","schema"))return;let r=Xe(t);Ci(r),this.#t.profiles.push({layer:this.#e.layer,name:this.#e.name,profile:Ii(r)})}registerImportExportCommandFlags(t,r,n){n.flags!==void 0&&(E(this.#e,"schema",`${t} options.flags`),this.allowRegistration("schema.flags",`${t} options.flags`,"schema")&&(jt(n.flags),this.#t.flags.push({layer:this.#e.layer,name:this.#e.name,target_command:r,flags:Lt(`${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=Bo(t,s,n?.description!==void 0);A(`${t} options.action`,s.action),A(`${t} options.description`,s.description),A(`${t} options.intent`,s.intent);let c=Xr(r,s.action),l=We(`${t} options.examples`,s.examples),d=We(`${t} options.failure_hints`,s.failure_hints),f=Jr(s.arguments);this.registerImportExportCommandFlags(t,r,s);let u={layer:this.#e.layer,name:this.#e.name,source_package:this.#e.source_package,command:r,action:c,examples:l,failure_hints:d,arguments:f},m=s.description?.trim();m&&(u.description=m);let p=s.intent?.trim();return p&&(u.intent=p),this.#t.commands.push(u),a}registerImporter(t,r,n){if(E(this.#e,"importers","registerImporter"),!this.allowRegistration("importers.importer","registerImporter","importers"))return;let o=Hr(M("registerImporter name",t));Ze("registerImporter importer",r);let i=Yr(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($r(s,o,"import"))})}registerExporter(t,r,n){if(E(this.#e,"importers","registerExporter"),!this.allowRegistration("importers.exporter","registerExporter","importers"))return;let o=Hr(M("registerExporter name",t));Ze("registerExporter exporter",r);let i=Yr(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($r(a,o,"export"));return s?.receipt==="suppress"&&!Ir(c)?Eo(c):c}})}registerSearchProvider(t){if(E(this.#e,"search","registerSearchProvider"),!this.allowRegistration("search.provider","registerSearchProvider","search"))return;let r=Je("registerSearchProvider provider",t);this.#t.search_providers.push(et({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerSearchProvider provider",t)},r))}registerVectorStoreAdapter(t){if(E(this.#e,"search","registerVectorStoreAdapter"),!this.allowRegistration("search.vectorstore","registerVectorStoreAdapter","search"))return;let r=Je("registerVectorStoreAdapter adapter",t);this.#t.vector_store_adapters.push(et({layer:this.#e.layer,name:this.#e.name,definition:Ie("registerVectorStoreAdapter adapter",t)},r))}registerAssuranceMeasurementProvider(t){if(E(this.#e,"services","registerAssuranceMeasurementProvider"),!this.allowRegistration("services.assuranceprovider","registerAssuranceMeasurementProvider","services"))return;if(Ei(t),t.network&&this.#e.permissions?.network!==!0)throw new TypeError("registerAssuranceMeasurementProvider network provider requires permissions.network=true");let r=Je("registerAssuranceMeasurementProvider provider",t);this.#t.assurance_providers.push(et({layer:this.#e.layer,name:this.#e.name,network_permission:this.#e.permissions?.network===!0,definition:Ie("registerAssuranceMeasurementProvider provider",t)},r))}registerBeforeCommand(t){E(this.#e,"hooks","api.hooks.beforeCommand"),this.allowRegistration("hooks.beforecommand","api.hooks.beforeCommand","hooks")&&(he("beforeCommand",t),this.#o.beforeCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerBeforeMutation(t){E(this.#e,"hooks","api.hooks.beforeMutation"),this.allowRegistration("hooks.beforemutation","api.hooks.beforeMutation","hooks")&&(he("beforeMutation",t),this.#o.beforeMutation.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerAfterCommand(t){E(this.#e,"hooks","api.hooks.afterCommand"),this.allowRegistration("hooks.aftercommand","api.hooks.afterCommand","hooks")&&(he("afterCommand",t),this.#o.afterCommand.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnWrite(t){E(this.#e,"hooks","api.hooks.onWrite"),this.allowRegistration("hooks.onwrite","api.hooks.onWrite","hooks")&&(he("onWrite",t),this.#o.onWrite.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnRead(t){E(this.#e,"hooks","api.hooks.onRead"),this.allowRegistration("hooks.onread","api.hooks.onRead","hooks")&&(he("onRead",t),this.#o.onRead.push({layer:this.#e.layer,name:this.#e.name,run:t}))}registerOnIndex(t){E(this.#e,"hooks","api.hooks.onIndex"),this.allowRegistration("hooks.onindex","api.hooks.onIndex","hooks")&&(he("onIndex",t),this.#o.onIndex.push({layer:this.#e.layer,name:this.#e.name,run:t}))}};function lm(e,t,r,n,o,i,s,a,c,l,d){return new cn(e,t,r,n,o,i,s,a,c,l,d)}function dm(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 um(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 f of l.slice(0,-1))t.push(`${s}:${c}:${d.layer}:${d.name}:${f.layer}:${f.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 mm(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 fm(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 pm=new Set(["output_format"]);function _m(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||pm.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 uw(e){let t=Jo(e.policy??Fu),r=Mt(),n=jr(),o=Fr(),i=Ur(),s=zr(),a=qr(),c=Br(),l=[],d=[];for(let m of e.loaded){let p=Xi(m.module);if(!p)continue;let _=l.length,g=Uo({hooks:r,commands:n,parsers:o,preflight:i,services:s,renderers:a,registrations:c});try{await p.activate(lm(m,r,n,o,i,s,a,c,d,l,t)),l.length>_&&(g(),d.push(`extension_activation_rolled_back:${m.layer}:${m.name}`))}catch(b){g(),d.push(`extension_activate_failed:${m.layer}:${m.name}`);let T=wi(b);l.push({layer:m.layer,name:m.name,entry_path:m.entry_path,error:Ut(b),trace:T})}}let f=[...um(n),...fm(o),...li(i),..._m(s),...mm(a)],u=[...new Set([...d,...f])];return{hooks:r,commands:n,parsers:o,preflight:i,services:s,renderers:a,registrations:c,failed:l,warnings:u,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:dm(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]="b1a38f8c-8f65-59e2-bddf-ed0606a0f0b5")}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]="4da25248-2914-5bc5-aa42-87f677ef4ea8")}catch{}})();function gw(){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 n=Promise.all([e,...t]).then(()=>r());return e=n.then(()=>{},()=>{}),n}}}function gm(){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]="7c2e7a35-cbf9-5bb6-abfd-f1ae75c6afc2")}catch{}})();var Re=null,Qi=null,bm=null,wm=null,ln=null,vm=null,Zi=null,Em=null;var km=[],es=new hm;function C(){return es.getStore()}function Ew(e){return es.run({hooks:null,commands:null,parsers:null,preflight:null,services:null,renderers:null,registrations:null,commandContext:null,commandResult:void 0,affectedItems:[]},e)}var Om=new Set(["body","comments","dependencies","docs","events","files","learnings","notes","reminders","test_runs","tests"]);function Ji(e){let t=H.resolve(e);for(;;){if(ym(H.join(t,".git")))return t;let r=H.dirname(t);if(r===t)return;t=r}}function Am(e){let t=process.env.PM_SOURCE_WORKSPACE_ROOT?.trim()||process.cwd(),r=Ji(t)??H.resolve(t),n=Ji(r);if(!e)return{source_workspace_root:r,...n?{repo_root:n}:{}};let o=H.relative(r,H.resolve(e)),i=o.length>0&&!o.startsWith(`..${H.sep}`)&&o!==".."&&!H.isAbsolute(o);return{source_workspace_root:r,...n?{repo_root:n}:{},...i?{pm_root_rel:o.split(H.sep).join("/")}:{}}}function kw(e){let t=C();if(t){t.hooks=e;return}Re=e}function Ow(e){let t=C();if(t){t.commands=e;return}Qi=e}function Aw(e){let t=C();if(t){t.parsers=e;return}bm=e}function Sw(e){let t=C();if(t){t.preflight=e;return}wm=e}function Tw(e){let t=C();if(t){t.services=e;return}ln=e}function Cw(e){let t=C();if(t){t.renderers=e;return}vm=e}function Iw(e){let t=C();if(t){t.registrations=e;return}Zi=e}function Rw(){let e=C();return e?e.registrations:Zi}function xw(e){if(!e)return;let t=C();t?t.affectedItems.push(e):km.push(e)}function Nw(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"||Om.has(i)||Object.hasOwn(n,i)&&n[i]!==void 0&&(r[i]=n[i])}return r}async function ts(e){let t=C(),r=t?t.hooks:Re;return r?tn(r,e):[]}async function Dw(e){let t=C(),r=t?t.hooks:Re;r&&await en(r,e)}async function rs(e){let t=C(),r=t?t.hooks:Re;return r?rn(r,e):[]}function Pw(){let e=C();return((e?e.hooks:Re)?.onRead?.length??0)>0}async function Mw(e){let t=C(),r=t?t.hooks:Re;return r?nn(r,e):[]}async function $w(e){let t=C(),r=t?t.commands:Qi;return r?on(r,{...e,...Am(e.pm_root)}):{handled:!1,result:null,warnings:[]}}function ns(e,t){let r=C(),n=r?r.commandContext:Em;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 zt(e,t){let r=C(),n=r?r.services:ln;return n?an(n,ns(e,t)):{handled:!1,result:t,warnings:[]}}function os(e,t){let r=C(),n=r?r.services:ln;return n?sn(n,ns(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]="71a40065-6b91-54bb-ad90-4a4b018de3b4")}catch{}})();var qt="changed_fields",Sm="changed_field_count",dn="rows",Tm=new Set(["apply","rollback"]),cs=new Set(["deleted","would_delete"]),is=256,ss={start_task:["claim","update"],pause_task:["update","release"],close_task:["close","release"]};function Cm(e,t){if(!$(e)||typeof e.action!="string"||typeof e.id!="string"||e.id.length===0)return null;let r=Object.hasOwn(ss,e.action)?ss[e.action]:void 0;if(!r||!r.every(i=>{let s=e[i];return $(s)&&$(s.item)&&s.item.id===e.id&&Array.isArray(s.changed_fields)&&s.changed_fields.every(a=>typeof a=="string")}))return null;let n=e[r.at(-1)],o=ds(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,us(e[i],t)]))}}function as(e){return typeof e!="string"||e.length<=is?e:`${e.slice(0,is-1)}\u2026`}function Im(e){if(!$(e))return null;let t={...e};return t.reason=as(t.reason),$(t.previous_terminal)&&(t.previous_terminal=Object.fromEntries(Object.entries(t.previous_terminal).map(([r,n])=>[r,as(n)]))),t}function $(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function ls(e){let t=e[qt];if(!Array.isArray(t))return null;let r=Object.getPrototypeOf(e)===null?Object.create(null):{};for(let[n,o]of Object.entries(e))n!==qt&&(r[n]=o);return r[Sm]=t.length,r}function Rm(e){return"item"in e&&Array.isArray(e[qt])}function xm(e){return typeof e.mode=="string"&&Tm.has(e.mode)&&Array.isArray(e[dn])}function Nm(e,t){let r=Object.getPrototypeOf(e)===null?Object.create(null):{};return Object.assign(r,e),r[dn]=t,r}function ds(e){if(!$(e))return null;let t=$(e.item)?e.item:$(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"&&cs.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 Dm(e,t){if(!$(e))return null;if($(e.plan)&&$(e.mutation_receipt)&&e.mutation_receipt.kind==="plan_mutation"&&e.mutation_receipt.id===e.plan.id&&e.mutation_receipt.action===e.action)return e.mutation_receipt;if(!t||!$(e.item)||typeof e.item.id!="string")return null;let r=e[qt];if(!Array.isArray(r))return null;let n={id:e.item.id,...typeof e.outcome=="string"&&cs.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:r.length};return Pm(e,e.item,n),n}function Pm(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=Im(e.recurrence);if(o!==null&&(r.recurrence=o),Array.isArray(e.warnings)&&e.warnings.length>0&&(r.warnings=e.warnings),$(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 Mm(e){let t=xm(e)?e[dn]:void 0;if(!Array.isArray(t))return{projected:e,changed:!1};let r=!1,n=t.map(o=>{if(!$(o))return o;let i=ls(o);return i?(r=!0,i):o});return r?{projected:Nm(e,n),changed:!0}:{projected:e,changed:!1}}function us(e,t={}){let r=Cm(e,t);if(r!==null)return r;if(t.idOnly===!0){let a=ds(e);if(a!==null)return a}if(t.compactEnvelope===!0||t.changedFields==="compact"){let a=Dm(e,t.compactEnvelope===!0);if(a!==null)return a}if((t.changedFields??"full")==="full"||!$(e))return e;let n=!1,o=e,i=Rm(e)?ls(e):null;i!==null&&(o=i,n=!0);let s=Mm(o);return s.changed&&(o=s.projected,n=!0),n?o:e}import{AsyncLocalStorage as ip}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="177144db-ac15-59ef-84ab-708b4dd544cc")}catch{}})();var ms=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),$m=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract","--all"]);function Lm(e){let t=e.indexOf("=");return t>0&&ms.has(e.slice(0,t))}function jm(e,t){return typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-")}function fs(e){for(let t=0;t<e.length;t+=1){let r=e[t];if(r==="--")return;if(ms.has(r)){t+=jm(r,e[t+1])?1:0;continue}if(!(Lm(r)||$m.has(r)||r==="--profile"||r==="--id-only"||r==="--explain")&&!r.startsWith("-"))return t}}function Bw(e){let t=fs(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]="86412887-5659-5892-beaa-bdd15a02ff4c")}catch{}})();var ps=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)}"`},_s=(e,t=process.platform)=>(t==="win32"?/^[A-Za-z0-9._:/\\@=-]+$/:/^[A-Za-z0-9._:/@=-]+$/).test(e)?e:t==="win32"?ps(e):`"${e.replace(/(["\\$`])/g,"\\$1")}"`,Bt=(e,t=process.platform)=>{let r=e.map(n=>_s(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]="98cde1d6-d5dd-56b9-89f9-51f5d08221d1")}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]="3a66ccfd-51fb-5d4a-b9cd-257c49997d52")}catch{}})();var bs=new WeakMap;function Jw(e,t){bs.set(e,new Set(t))}var gs='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',Fm={context:{row_keys:["high_level","low_level"],fields:"supported"},get:{row_keys:["children"],fields:"supported"},list:{row_keys:["items"],fields:"supported"},next:{row_keys:["recommended","ready","decision_needed","gate_needed","containers","blocked","held_by_others"],fields:"unsupported"},search:{row_keys:["items"],fields:"supported"},activity:{row_keys:["activity_digest","compact_activity","provenance_activity","activity"],fields:"unsupported"},history:{row_keys:["compact_history","provenance_history","history","diff"],fields:"unsupported"},deps:{row_keys:["graph.nodes","graph.edges","context.nodes","context.edges"],fields:"unsupported"},health:{row_keys:["checks"],fields:"unsupported"},aggregate:{row_keys:["groups"],fields:"unsupported"},duplicates:{row_keys:["clusters"],fields:"unsupported"},stats:{row_keys:["by_type","by_status"],fields:"unsupported"},comments:{row_keys:["comments"],fields:"unsupported"},notes:{row_keys:["notes"],fields:"unsupported"},learnings:{row_keys:["learnings"],fields:"unsupported"},files:{row_keys:["files"],fields:"unsupported"},docs:{row_keys:["docs"],fields:"unsupported"},validate:{row_keys:["checks","warnings"],fields:"unsupported"},contracts:{row_keys:["command_summaries","commands"],fields:"unsupported"}},Um=[{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 Qw(e,t,r){if(e&&t)throw new h(`${r} cannot be combined with --full`,y.USAGE)}function G(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 Zw(e,t){let r=Um.find(o=>o.command===e);if(r===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===r.complete_mode)return G([]);let n=r.omissions_by_mode[t];if(n===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return G(n)}var zm=[{name:"hierarchy",restore_with:"--section hierarchy"},{name:"activity",restore_with:"--section activity"},{name:"progress",restore_with:"--section progress"},{name:"blockers",restore_with:"--section blockers"},{name:"recently_created",restore_with:"--section recently_created"},{name:"unparented",restore_with:"--section unparented"},{name:"files",restore_with:"--section files"},{name:"workload",restore_with:"--section workload"},{name:"staleness",restore_with:"--section staleness"},{name:"tests",restore_with:"--section tests"}];function L(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var qm=new Set([void 0,"tabular_when_uniform"]),Bm=new Set(["collection","none"]),Vm=new Set(["supported","unsupported"]);function ys(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 Gm(e){return L(e)&&typeof e.command=="string"&&e.command.trim().length>0&&Bm.has(e.row_kind)&&ys(e.row_keys,!0)&&(e.continuation_row_keys===void 0||ys(e.continuation_row_keys,!1))&&Vm.has(e.fields)&&qm.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 Wm={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"]},Km={context:["sections_included","high_level","low_level"],get:["item"],list:["items","projection"],next:["recommended","ready","decision_needed","gate_needed","containers","blocked","held_by_others"],search:["items","projection"],activity:["activity_digest","compact_activity","provenance_activity","activity"],history:["compact_history","provenance_history","history","diff"],deps:["tree","graph","projection"],health:["checks"],aggregate:["groups"],duplicates:["clusters"],stats:["totals","by_type","by_status"],comments:["comments"],notes:["notes"],learnings:["learnings"],files:["files"],docs:["docs"],validate:["checks","warnings"],contracts:["command_summaries","commands","selected"]};function Hm(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=Wm[s];if(a===void 0)return;let c=a.filter(l=>Array.isArray(t[l])||L(t[l]));return{command:"graph",row_kind:c.length>0?"collection":"none",row_keys:c,fields:"unsupported",...c.length>0?{jq_selector:gs}:{},toon_encoding:"tabular_when_uniform"}}let o=Fm[n],i=Km[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)=>L(l)?l[d]:void 0,t);return Array.isArray(c)||L(c)});return{command:n,row_kind:s.length>0?"collection":"none",row_keys:s,fields:o.fields,...s.length>0?{jq_selector:gs}:{},toon_encoding:"tabular_when_uniform"}})()}function Ym(e){if(!L(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=>L(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 G(n,new Set(o))}function Xm(e){if(!Array.isArray(e.sections_included))return;let t=G(zm,new Set(e.sections_included.filter(r=>typeof r=="string")));return L(e.summary)&&e.summary.scope==="matching_items"&&(t.summary_scope="matching_items"),t}function Jm(e,t,r){return e==="dependency_provenance"?!1:Object.hasOwn(t,e)||(e==="reminders"||e==="events")&&L(r.schedule)&&Object.hasOwn(r.schedule,e)||["files","tests","docs"].includes(e)&&L(r.linked)&&Array.isArray(r.linked[e])&&r.linked[e].length>0}function Qm(e){if(!L(e.item))return;let t=e.item,r=["comments","notes","learnings","files","tests","docs","reminders","events"],n=["body","children","claim_state","linked","schedule"],o=bs.get(e),i=a=>r.includes(a)||a==="body"||a==="dependency_provenance"?t:e,s=["body",...r,...n.slice(1),...o?.has("dependency_provenance")?["dependency_provenance"]:[],...o?.has("blockers")||Object.hasOwn(e,"blockers")?["blockers"]:[]].filter(a=>o===void 0||o.has(a)||Object.hasOwn(i(a),a)).map(a=>({name:a,restore_with:a==="blockers"?"--full":a==="dependency_provenance"?"--fields dependencies":`--fields ${a}`}));return G(s,new Set(s.flatMap(({name:a})=>Jm(a,i(a),e)?[a]:[])))}function hs(e){if(L(e.projection))return G([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function Zm(e){if(!L(e.projection))return G([]);if(typeof e.projection.mode=="string")return G([{name:"full_check_details",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_check_details"]:[]))}function ef(e){if(!(!L(e.selected)||typeof e.selected.summary!="boolean"))return G([{name:"full_contract_catalog",restore_with:"--full"}],new Set(e.selected.summary?[]:["full_contract_catalog"]))}function tf(e,t){let r=Ym(t);if(r!==void 0)return r;let[n]=e.split(/\s+/u,1);if(n==="context")return Xm(t);if(n==="get")return Qm(t);if(n==="list"||n.startsWith("list-"))return hs(t);if(n==="search")return hs(t)??G([{name:"projection_metadata",restore_with:"--full"}]);if(n==="health")return Zm(t);if(n==="contracts")return ef(t)}function ws(e,t){if(e===void 0||!L(t))return t;let r=tf(e,t),n=t.row_contract,o=Gm(n)?n:Hm(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 L(i.omission_receipt)||r===void 0?i:{...i,omission_receipt:r}}import{randomUUID as Yf}from"node:crypto";import{randomUUID as Gf}from"node:crypto";import{constants as Ne}from"node:fs";import{lstat as qs,mkdir as Wf,open as Vs,rename as Kf,rm as Hf}from"node:fs/promises";import Kt from"node:path";import{constants as Of}from"node:fs";import z from"node:fs/promises";import Wt from"node:path";import{randomUUID as pn}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="92573990-a040-526d-a0b1-b91d2ef401f1")}catch{}})();function vs(e){let t=Math.ceil(e.size/2);for(let r of e.keys()){if(t===0)return;e.delete(r),t-=1}}import rf from"node:crypto";import{AsyncLocalStorage as nf}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ced47074-06d3-53b9-af75-63586cbd4f6a")}catch{}})();var ks=new nf,Es=1024;function Os(){let e=ks.getStore();if(e===void 0)return;let t=new Date(Date.parse(e.clock)+e.clockReads*e.tickMs).toISOString();return e.clockReads+=1,t}function ov(e){let t=ks.getStore();if(t===void 0)return;if(!Number.isSafeInteger(e)||e<0||e>Es)throw new Error(`Reproducible token length must be an integer between 0 and ${Es}`);let r="";for(;r.length<e;){let n=rf.createHash("sha256").update(`${t.seed}\0${t.tokenReads}`).digest();t.tokenReads+=1;for(let o of n)if(r+=(o%36).toString(36),r.length===e)break}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]="0bf155fc-c690-5318-ba1e-275f1787858b")}catch{}})();var of=/^([+-]?)(\d+)([hdwm])$/i,sf=/^[+-]?\d+[hdwm](?:[+-]\d+[hdwm])+$/i,af=/^(\d{4})(\d{2})(\d{2})$/,cf=/^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,lf=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})-(\d{2})(?:-(\d{2}))?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,df=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,uf=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;function Ss(){return Os()??new Date().toISOString()}function dv(e){return Number.isFinite(Date.parse(e))}function mf(e){let t=uf.exec(e);if(!t||!Number.isFinite(Date.parse(e)))return!1;let[,r,n,o,i,s,a,c,l]=t,[d,f,u,m,p,_]=[r,n,o,i,s,a].map(Number);return f>=1&&f<=12&&u>=1&&u<=fn(d,f-1)&&m<=23&&p<=59&&_<=59&&(c===void 0||Number(c)<=23)&&(l===void 0||Number(l)<=59)}function uv(e){let t=/\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/iu.exec(e)?.[1];return mf(e)&&(t===void 0||/^\d{0,3}0*$/u.test(t))}var ff=1e4,Vt=new Map;function As(e){let t=Vt.get(e);if(t!==void 0)return t;let r=Date.parse(e);return Vt.size>=ff&&vs(Vt),Vt.set(e,r),r}function xe(e,t){let r=As(e),n=As(t);return Number.isFinite(r)&&Number.isFinite(n)&&r!==n?r-n:e.localeCompare(t)}function mv(e,t){return!(t.deadlineBefore&&(!e.deadline||xe(e.deadline,t.deadlineBefore)>0)||t.deadlineAfter&&(!e.deadline||xe(e.deadline,t.deadlineAfter)<0)||t.updatedAfter&&xe(e.updated_at,t.updatedAfter)<0||t.updatedBefore&&xe(e.updated_at,t.updatedBefore)>0||t.createdAfter&&xe(e.created_at,t.createdAfter)<0||t.createdBefore&&xe(e.created_at,t.createdBefore)>0)}function un(e){return e?`.${e.slice(1).padEnd(3,"0").slice(0,3)}`:""}function mn(e){if(!e)return"";if(e.toUpperCase()==="Z")return"Z";let t=/^([+-]\d{2})(\d{2})$/.exec(e);return t?`${t[1]}:${t[2]}`:e}function pf(e,t,r){r&&r!==t&&(e.includes(r)||e.push(r))}function _f(e){let t=[],r=l=>pf(t,e,l),n=af.exec(e);if(n){let[,l,d,f]=n;r(`${l}-${d}-${f}`)}let o=cf.exec(e);if(o){let[,l,d,f,u,m,p,_,g]=o,b=p?`:${p}`:"";r(`${l}-${d}-${f}T${u}:${m}${b}${un(_)}${mn(g)}`)}let i=lf.exec(e);if(i){let[,l,d,f,u,m,p]=i,_=u?`:${u}`:"";r(`${l}T${d}:${f}${_}${un(m)}${mn(p)}`)}let s=df.exec(e);if(s){let[,l,d,f,u,m,p]=s,_=u?`:${u}`:"";r(`${l}T${d}:${f}${_}${un(m)}${mn(p)}`)}let a=10,c=e.slice(0,a);if(yf(c)){let l=a;for(;l<e.length&&hf(e[l]);)l+=1;l<e.length&&r(`${c}T${e.slice(l)}`)}return t}function gf(e){let t=Date.parse(e);if(Number.isFinite(t))return t;for(let r of _f(e)){let n=Date.parse(r);if(Number.isFinite(n))return n}return Number.NaN}function yf(e){if(e.length!==10)return!1;for(let t=0;t<e.length;t+=1){let r=e[t];if(t===4||t===7){if(r!=="-")return!1;continue}let n=r.charCodeAt(0);if(n<48||n>57)return!1}return!0}function hf(e){return e?e===" "||e===" "||e===`
|
|
9
|
+
`||e==="\r"||e==="\f"||e==="\v":!1}function fn(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}var bf=["January","February","March","April","May","June","July","August","September","October","November","December"],wf=/^(\d{4})-(\d{2})-(\d{2})/,vf=/^(\d{4})(\d{2})(\d{2})(?:[T ]?\d{2}|$)/;function Ef(e,t,r){let n=wf.exec(t)??vf.exec(t);if(!n)return;let o=Number.parseInt(n[1],10),i=Number.parseInt(n[2],10),s=Number.parseInt(n[3],10),a=r?.trim()||"deadline";if(i<1||i>12)throw new h(`Invalid ${a} value "${e}". Month "${n[2]}" is out of range \u2014 use a month between 01 and 12.`,y.USAGE,{field:a,value:e});let c=fn(o,i-1);if(s<1||s>c)throw new h(`Invalid ${a} value "${e}". ${bf[i-1]} ${o} has ${c} days, so day "${n[3]}" does not exist. Use a real YYYY-MM-DD calendar date.`,y.USAGE,{field:a,value:e})}function kf(e,t){let r=new Date(e.getTime()),n=r.getUTCDate(),o=r.getUTCMonth()+t,i=r.getUTCFullYear()+Math.floor(o/12),s=(o%12+12)%12,a=Math.min(n,fn(i,s));return r.setUTCFullYear(i,s,a),r}function fv(e,t=new Date,r="deadline"){let n=e.trim();if(n.toLowerCase()==="now")return t.toISOString();let o=of.exec(n);if(o){let s=o[1]==="-"?-1:1,a=Number.parseInt(o[2],10)*s,c=o[3].toLowerCase();if(c==="m")return kf(t,a).toISOString();let l=c==="h"?3600*1e3:c==="d"?1440*60*1e3:10080*60*1e3;return new Date(t.getTime()+a*l).toISOString()}Ef(e,n,r);let i=gf(n);if(!Number.isFinite(i)){let s=r.trim().length>0?r.trim():"deadline",a=sf.test(n)?"Compound relative expressions like +3d+1h are not supported; use a single relative token (for example +3d) or an ISO/date string.":'Use ISO/date string input, "now", or relative +6h/-6h/+1d/-1d/+2w/-2w/+6m/-6m.';throw new h(`Invalid ${s} value "${e}". ${a}`,y.USAGE,{field:s,value:e})}return new Date(i).toISOString()}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0128939c-bb33-5929-acd2-686f6437ca27")}catch{}})();function Af(e){let t;try{t=JSON.parse(e)}catch{return{info:null,warnings:["lock_info_invalid_json"]}}if(typeof t!="object"||t===null||Array.isArray(t))return{info:null,warnings:["lock_info_invalid_shape"]};let r=t,n=r.id,o=r.pid,i=r.owner,s=r.token,a=r.created_at,c=r.ttl_seconds;return typeof n!="string"||typeof o!="number"||!Number.isFinite(o)||typeof i!="string"||s!==void 0&&(typeof s!="string"||s.trim().length===0)||typeof a!="string"||typeof c!="number"||!Number.isFinite(c)?{info:null,warnings:["lock_info_invalid_shape"]}:{info:{id:n,pid:o,owner:i,...typeof s=="string"?{token:s}:{},created_at:a,ttl_seconds:c},warnings:[]}}async function Gt(e,t=!0){try{let r=await z.readFile(e,"utf8");return t&&await rs({path:e,scope:"project"}),Af(r)}catch(r){return _e(r)?{info:null,warnings:[]}:{info:null,warnings:["lock_info_read_failed"]}}}function Y(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}async function Sf(e,t,r=process.platform){if(Y(e,"EEXIST"))return!0;if(!Y(e,"EPERM")&&!Y(e,"EACCES")&&!Y(e,"EBUSY"))return!1;try{return await z.lstat(t),!0}catch(n){if(r!=="win32"||!_e(n)&&!Y(n,"EPERM")&&!Y(n,"EACCES")&&!Y(n,"EBUSY"))return!1}try{return await z.access(Wt.dirname(t),Of.W_OK),!0}catch{return!1}}async function Ns(e,t){await ts({path:e,scope:"project",op:t})}function Tf(e,t,r,n=pn()){return{id:e,pid:process.pid,owner:t,token:n,created_at:Ss(),ttl_seconds:r}}async function Cf(e,t,r,n,o){await z.mkdir(Wt.dirname(e),{recursive:!0});let i=await hn(e,t);if(i===null)throw Object.assign(new Error("Lock initialization is contended"),{code:"EEXIST"});try{let s=await z.open(e,"wx");try{try{await s.writeFile(`${JSON.stringify(Tf(t,r,n,o),null,2)}
|
|
10
|
+
`,"utf8")}finally{await s.close()}}catch(a){throw await _n(e,"lock:release"),a}}finally{await i()}await Ns(e,"lock:create")}async function _n(e,t){try{return await z.unlink(e),await Ns(e,t),!0}catch{return!1}}async function If(e,t,r,n){let o=Date.now(),i=Ps;for(;;){let s=await hn(e,t);if(s!==null){try{let l=await Gt(e,!1);Ts(l.info,t,r,n)&&await _n(e,"lock:release")}finally{await s()}return}let a=await Gt(e,!1);if(!Ts(a.info,t,r,n))return;let c=Date.now()-o;if(c>=Cs)return;await Ls(Math.min(i,Cs-c)),i=Math.min(i*2,gn)}}function Ts(e,t,r,n){return e?.id===t&&e.pid===process.pid&&e.owner===r&&e.token===n}function Ds(e,t){let r=e?.created_at?Date.parse(e.created_at):Number.NaN;return(Number.isFinite(r)?Date.now()-r:Number.POSITIVE_INFINITY)>t*1e3}function Rf(e){return e?.owner?` (owner ${e.owner})`:""}var Ps=25,gn=200,xf=250,Nf=3,Df=".stale-cleanup",Ms="owner.json",$s=1e4,Cs=$s+gn,Pf=60*6e4;function Is(e){if(typeof e=="string"){let t=e.trim();if(!/^\d+$/.test(t))return;let r=Number(t);return Number.isSafeInteger(r)?r:void 0}if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return Math.trunc(e)}function Mf(e){let t=process.env.PM_LOCK_WAIT_MS,r=Is(t);if(r!==void 0)return r;let n=Is(e);return n!==void 0?n:0}function Ls(e){let t=Math.max(1,Math.round(e*(.5+Math.random())));return new Promise(r=>setTimeout(r,t))}function js(e,t,r){let n=r>0?` after waiting ${r}ms`:"";return new h(`Item ${e} is locked${Rf(t)}${n}`,y.CONFLICT,{code:"lock_conflict",recovery:{retry_after_ms:xf}})}function $f(e){if(typeof e=="function")return e;if(typeof e=="object"&&e!==null&&"release"in e){let t=e.release;return typeof t=="function"?t:null}return null}function Lf(e,t,r,n){if(!r&&n){let o=t.warnings.length>0?` (${t.warnings.join(",")})`:"";throw new h(`Item ${e} lock is stale${o}; rerun with --force when supported for this command`,y.CONFLICT)}}function jf(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!="object"||t===null||Array.isArray(t))return null;let r=t,n=r.pid,o=r.token,i=r.process_start_identity;return typeof n!="number"||!Number.isInteger(n)||n<=0||typeof o!="string"||o.length===0||i!==void 0&&(typeof i!="string"||!/^\d+$/u.test(i))?null:{pid:n,token:o,...typeof i=="string"?{process_start_identity:i}:{}}}async function Fs(e){try{return jf(await z.readFile(Wt.join(e,Ms),"utf8"))}catch{return null}}function Ff(e){if(!Number.isSafeInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){return!Y(t,"ESRCH")}}function Uf(e){let t=e.lastIndexOf(")");if(t<0)return null;let r=e.slice(t+2).trim().split(/\s+/u)[19];return r!==void 0&&/^\d+$/u.test(r)?r:null}async function Us(e){try{return Uf(await z.readFile(`/proc/${e}/stat`,"utf8"))}catch{return null}}async function zf(e=process.pid){let t=await Us(e);return{pid:e,...t===null?{}:{process_start_identity:t}}}async function qf(e,t,r){if(!Ff(e.pid))return!1;let n=await Us(e.pid);return e.process_start_identity!==void 0&&n!==null?n===e.process_start_identity:t<=r}async function yn(e){try{return await z.rm(e,{recursive:!0,force:!0}),!0}catch{return!1}}async function Rs(e,t){let r=await Fs(e);r===null||r.token!==t||await yn(e)}async function xs(e){try{await z.mkdir(e)}catch(r){return Y(r,"EEXIST"),null}let t={...await zf(),token:pn()};try{await z.writeFile(Wt.join(e,Ms),`${JSON.stringify(t)}
|
|
11
|
+
`,"utf8")}catch{return await yn(e),null}return t}async function Bf(e){let t;try{let n=await z.stat(e);if(t=Date.now()-n.mtimeMs,t<=$s)return!1}catch(n){return _e(n)}let r=await Fs(e);return r!==null&&await qf(r,t,Pf)?!1:yn(e)}async function hn(e,t){let r=`${e}${Df}`,n=await xs(r);if(n!==null)return async()=>Rs(r,n.token);if(!await Bf(r))return null;let o=await xs(r);return o===null?null:async()=>Rs(r,o.token)}async function Vf(e){let t=await hn(e.lockPath,e.id);if(t===null)return{lockInfo:e.fallbackLockInfo,shouldRetryCreate:!1,staleRemovalCounted:!1};try{let r=await Gt(e.lockPath);if(r.info===null&&r.warnings.length===0)return{lockInfo:r,shouldRetryCreate:!0,staleRemovalCounted:!1};if(!Ds(r.info,e.ttlSeconds))return{lockInfo:r,shouldRetryCreate:!1,staleRemovalCounted:!1};if(Lf(e.id,r,e.force,e.forceRequiredForStaleLock),e.staleRemovals>=Nf)throw js(e.id,r.info,Date.now()-e.startedAtMs);return{lockInfo:r,shouldRetryCreate:await _n(e.lockPath,"lock:stale_remove"),staleRemovalCounted:!0}}finally{await t()}}async function zs(e,t,r,n,o=!1,i=!0,s){let a=await zt("lock_acquire",{pm_root:e,id:t,ttl_seconds:r,owner:n,force:o,force_required_for_stale_lock:i});if(a.handled){let p=$f(a.result);if(p)return async()=>{await Promise.resolve(p()),await zt("lock_release",{pm_root:e,id:t,owner:n})}}let c=Fo(e,t),l=Mf(s),d=Date.now(),f=0,u=Ps,m=pn();for(;;)try{return await Cf(c,t,n,r,m),async()=>{await If(c,t,n,m),await zt("lock_release",{pm_root:e,id:t,owner:n})}}catch(p){if(!await Sf(p,c))throw new h(`Failed to acquire lock for ${t}: ${Oo(p)}`,y.GENERIC_FAILURE);let _=await Gt(c);if(Ds(_.info,r)){let b=await Vf({lockPath:c,id:t,ttlSeconds:r,force:o,forceRequiredForStaleLock:i,staleRemovals:f,waitBudgetMs:l,startedAtMs:d,fallbackLockInfo:_});if(_=b.lockInfo,b.staleRemovalCounted&&(f+=1),b.shouldRetryCreate)continue}let g=Date.now()-d;if(l===0||g>=l)throw js(t,_.info,l===0?0:g);await Ls(Math.min(u,l-g)),u=Math.min(u*2,gn)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="71b65888-baa5-5c5f-a02c-4a0fd818fadb")}catch{}})();var X={max_serving_rows:256,max_bytes:262144,max_event_bytes:32768,retained_byte_fraction:.5,max_events:2048,retention_days:30},I=class extends TypeError{code="context_usage_validation_failed";constructor(t){super(t),this.name="ContextUsageValidationError"}};function ve(e){let t=Date.parse(e.now??new Date().toISOString());if(!Number.isFinite(t))throw new I("Context usage now must be a valid timestamp");return{iso:new Date(t).toISOString(),ms:t}}function Gs(e){let t=e.maxBytes??X.max_bytes,r=e.maxEvents??X.max_events,n=e.retentionDays??X.retention_days;if(!Number.isSafeInteger(t)||t<1024||t>X.max_bytes||!Number.isSafeInteger(r)||r<1||!Number.isFinite(n)||n<=0)throw new I("Context usage retention requires positive maxEvents and retentionDays, and maxBytes from 1024 through 262144");return{maxBytes:t,maxEvents:r,cutoff:ve(e).ms-n*864e5}}async function Ws(e,t){if(!(await qs(Kt.dirname(e))).isDirectory())throw new I("Context usage runtime must be a real directory");try{if((await qs(e)).isSymbolicLink())throw new I("Context usage ledger must not be a symbolic link")}catch(n){if(!_e(n))throw n}let r=await Vs(e,t|Ne.O_NOFOLLOW|Ne.O_NONBLOCK,384);try{let n=await r.stat();if(!n.isFile()||n.nlink!==1)throw new I("Context usage ledger must be an unshared regular file");return r}catch(n){throw await r.close(),n}}async function Ht(e){let t=Gs(e);try{let r=await Ws(Kt.join(e.pmRoot,"runtime","context-usage.jsonl"),Ne.O_RDONLY);try{let n=(await r.stat()).size,o=Math.max(0,n-t.maxBytes),i=Buffer.alloc(Math.min(n,t.maxBytes)),{bytesRead:s}=await r.read(i,0,i.length,o),a=i.subarray(0,s).toString("utf8");return(o>0?a.includes(`
|
|
12
|
+
`)?a.slice(a.indexOf(`
|
|
13
|
+
`)+1):"":a).split(`
|
|
14
|
+
`).flatMap(c=>{try{let l=JSON.parse(c);return l&&Date.parse(l.at)>=t.cutoff?[l]:[]}catch{return[]}}).slice(-t.maxEvents)}finally{await r.close()}}catch{return[]}}function Bs(e,t,r){let n=[],o=0;for(let i=e.length-1;i>=0&&n.length<r;i-=1){let s=`${JSON.stringify(e[i])}
|
|
15
|
+
`;if(o+=Buffer.byteLength(s),o>t)break;n.push(s)}return n.reverse().join("")}async function rt(e,t,r){let n=Gs(e),o=Kt.join(e.pmRoot,"runtime","context-usage.jsonl"),i=Math.floor(n.maxBytes*X.retained_byte_fraction),s=Math.min(X.max_event_bytes,i);if(t.some(u=>Buffer.byteLength(`${JSON.stringify(u)}
|
|
16
|
+
`)>s))throw new I("Context usage event exceeds the declared byte ceiling");let a=t.filter(u=>Date.parse(u.at)>=n.cutoff),c=Bs(a,i,n.maxEvents),l=performance.now(),d=await zs(e.pmRoot,"context-usage-ledger",30,`context-usage:${process.pid}`,!1,!1,3e3),f=performance.now()-l;try{await Wf(Kt.dirname(o),{recursive:!0});let u=await Ws(o,Ne.O_WRONLY|Ne.O_CREAT|Ne.O_APPEND);try{let m=(await u.stat()).size,p=r===void 0?void 0:await Ht(e);if(p?.some(T=>T.kind==="delivery"&&T.serve_id===r))return{written_bytes:0,ledger_bytes:m,compacted:!1,lock_wait_ms:f};if(!(e.maxEvents!==void 0||e.retentionDays!==void 0)&&m+Buffer.byteLength(c)<=n.maxBytes)return await u.writeFile(c,"utf8"),{written_bytes:Buffer.byteLength(c),ledger_bytes:m+Buffer.byteLength(c),compacted:!1,lock_wait_ms:f};let _=Bs([...p??await Ht(e),...a],i,n.maxEvents),g=`${o}.${process.pid}.${Gf()}.tmp`,b=await Vs(g,"wx",384);try{try{await b.writeFile(_,"utf8")}finally{await b.close()}return await u.close(),u=void 0,await Kf(g,o),{written_bytes:Buffer.byteLength(_),ledger_bytes:Buffer.byteLength(_),compacted:!0,lock_wait_ms:f}}finally{await Hf(g,{force:!0})}}finally{await u?.close()}}finally{await 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]="e76b38ce-b2aa-589b-9d17-0952eca9e7a2")}catch{}})();var Xf=864e5,Yt=Symbol.for("@unbrained/pm-cli/context-usage-serving-receipt");function x(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function Lv(e,t){let r=x(e);r!==null&&t!==null&&(r[Yt]=t)}function Xt(e,t){let r=x(e),n=x(t),o=r?.[Yt];n!==null&&o!==void 0&&(n[Yt]=o)}function Jf(e){return x(e)?.[Yt]??null}function Hs(e){let t=x(e);for(let r of["read_output","context_intent"])if(x(t?.[r])?.result_omitted===!0)return!0;return!1}function oe(e,t){typeof t=="string"&&t.trim().length>0&&e.add(t.trim())}function Ys(e,t){if(Array.isArray(t))for(let r of t)oe(e,x(r)?.id)}function Ks(e,t){if(Array.isArray(t))for(let r of t)oe(e,r)}function Qf(e,t){let r=x(e.recommended)===null?[]:[e.recommended];for(let n of["ready","decision_needed","gate_needed","containers","blocked","held_by_others"])Array.isArray(e[n])&&r.push(...e[n]);for(let n of r){let o=x(n);oe(t,o?.id);for(let i of Array.isArray(o?.blockers)?o.blockers:[])oe(t,x(i)?.id);for(let i of Array.isArray(o?.unblocks)?o.unblocks:[])oe(t,i)}}function Zf(e,t){for(let r of["high_level","low_level","blocked_fallback","recently_created","unparented","activity","progress","blockers","staleness"])Ys(t,e[r]);for(let r of Array.isArray(e.blockers)?e.blockers:[])oe(t,x(r)?.blocked_by);ep(e,t)}function ep(e,t){for(let o of Array.isArray(e.hierarchy)?e.hierarchy:[]){let i=x(o);oe(t,i?.id),Ys(t,i?.children)}for(let o of["files","workload"])for(let i of Array.isArray(e[o])?e[o]:[])Ks(t,x(i)?.items);let r=x(e.agenda);for(let o of Array.isArray(r?.events)?r.events:[])oe(t,x(o)?.item_id);let n=x(e.tests);Ks(t,n?.items_failing)}function tp(e,t){let r=x(e);if(r===null||Hs(e))return[];let n=new Set;return t==="next"?Qf(r,n):Zf(r,n),[...n]}async function jv(e){let t=Jf(e.result);if(t===null)return!1;let r=Hs(e.result);return await rp({pmRoot:e.pmRoot,receipt:t,deliveredItemIds:tp(e.result,t.surface),resultOmitted:r}),!0}async function Fv(e){if([process.env.PM_CONTEXT_USAGE_DISABLED==="1",e.enabled===!1].includes(!0))return null;if(!e.author.trim()||e.rows.some(o=>!o.id.trim()||!Number.isInteger(o.rank)||o.rank<1))throw new I("Context usage serving requires an author and valid ranked rows");let t=e.rows.map(o=>({id:o.id.trim(),rank:o.rank,included:o.included}));if(new Set(t.map(o=>o.id)).size!==t.length)throw new I("Context usage serving requires unique normalized row ids");let r=t.slice(0,X.max_serving_rows),n={serve_id:Yf(),author:e.author.trim(),surface:e.surface,rows:t,recorded_item_ids:r.map(o=>o.id)};return n.storage=await rt(e,[{kind:"serve",schema_version:2,serve_id:n.serve_id,at:ve(e).iso,author:e.author.trim(),surface:e.surface,profile:e.profile.trim()||"balanced",rows:r,candidate_count:t.length,omitted_row_count:t.length-r.length,result_omitted:!1,packed_item_ids:r.filter(o=>o.included).map(o=>o.id)}]),n}async function rp(e){if(e.receipt===null||process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)return;let t=new Set(e.receipt.rows.map(i=>i.id)),r=[...new Set(e.deliveredItemIds.map(i=>i.trim()))];if(r.some(i=>i.length===0||!t.has(i))||e.resultOmitted&&r.length>0)throw new I("Context usage delivery requires emitted ranked ids and zero ids for an omitted result");let n=new Set(e.receipt.recorded_item_ids??e.receipt.rows.map(i=>i.id)),o={kind:"delivery",schema_version:2,serve_id:e.receipt.serve_id,at:ve(e).iso,author:e.receipt.author,surface:e.receipt.surface,result_omitted:e.resultOmitted,delivered_item_ids:r.filter(i=>n.has(i))};await rt(e,[o],o.serve_id)}async function Uv(e){if(!(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)){if(!e.author.trim()||!e.itemId.trim()||!e.intent.trim())throw new I("Context usage touch requires author, itemId, and intent");await rt(e,[{kind:"touch",at:ve(e).iso,author:e.author.trim(),item_id:e.itemId.trim(),intent:e.intent.trim()}])}}async function zv(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1||e.itemIds.length===0)return;let t=e.author.trim(),r=e.intent.trim();if(!t||!r)throw new I("Context usage touch requires author and intent");let n=new Set;for(let s of e.itemIds){if(typeof s!="string")throw new I("Context usage touch requires string itemIds");let a=s.trim();if(!a)throw new I("Context usage touch requires non-empty itemId");n.add(a)}let o=ve(e).iso,i=[...n].map(s=>({kind:"touch",at:o,author:t,item_id:s,intent:r}));await rt(e,i)}function np(e,t,r,n){return e.find(({entry:o,time:i})=>o.item_id===t&&i>=r&&i-r<=n)?.time}function op(e,t){let r=new Map;for(let n of e)n.kind==="delivery"&&n.schema_version===2&&n.author===t&&!r.has(n.serve_id)&&r.set(n.serve_id,n);return r}async function qv(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)return{affinity:{},positive_judgments:0,serving_events:0,untrusted_serving_events:0};let t=await Ht(e),r=ve(e).ms,n=(e.horizonHours??24)*36e5;if(![Number.isFinite(n),n>0].every(Boolean))throw new I("Context usage horizonHours must be positive");let o=e.author.trim(),i=t.filter(u=>u.kind==="touch").filter(u=>u.author===o).map(u=>({entry:u,time:Date.parse(u.at)})),s=new Map,a=0,c=0,l=0,d=op(t,o);t.filter(u=>u.kind==="serve").filter(u=>u.author===o).forEach(u=>{if(![u.schema_version===2,!!u.serve_id].every(Boolean)){c+=1;return}a+=1;let m=Date.parse(u.at),p=d.get(u.serve_id),_=new Set(p?.delivered_item_ids??[]);for(let g of u.rows){if(!_.has(g.id))continue;let b=np(i,g.id,m,n);if(b===void 0)continue;l+=1;let T=Math.max(0,(r-b)/Xf);s.set(g.id,(s.get(g.id)??0)+Math.exp(-T/14))}});let f=Math.max(0,...s.values());return{affinity:Object.fromEntries([...s.entries()].map(([u,m])=>[u,f===0?.05:.05+.95*m/f])),positive_judgments:l,serving_events:a,untrusted_serving_events: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]="e834062a-97f7-51d7-b934-1e4b43e3d6b2")}catch{}})();var Qs=Object.freeze([{command:"context",intent:"orient",description:"Bounded active hierarchy, ownership, blockers, and recent progress.",included_field_groups:["summary","focus","hierarchy","blockers","activity"],token_budget:3e3,source:"core"},{command:"context",intent:"handoff",description:"Active ownership, evidence, decisions, and immediate continuation context.",included_field_groups:["summary","focus","in_progress","decisions","activity"],token_budget:2200,source:"core"},{command:"get",intent:"inspect",description:"Standard-depth item metadata, relationships, evidence, and lifecycle state.",included_field_groups:["item","children","claim_state","linked"],token_budget:3200,source:"core"},{command:"list",intent:"triage",description:"A budget-derived page of compact governance, ownership, priority, and blocker rows for triage.",included_field_groups:["identity","governance","ownership","dependencies"],token_budget:3200,source:"core"},{command:"next",intent:"execute",description:"The highest-ranked actionable work with concise ranking evidence.",included_field_groups:["recommended"],token_budget:1200,source:"core"},{command:"search",intent:"discover",description:"A budget-derived page of ranked canonical lineage candidates with compact match evidence.",included_field_groups:["identity","status","lineage","match"],token_budget:1800,source:"core"}]),Zs=new ip;function sp(){return Zs.getStore()??Qs}function Qv(e,t){return Zs.run(cp(e.workspaceContracts,e.packageContracts),t)}function ap(e,t){let r=e.command.trim().toLowerCase(),n=e.intent.trim().toLowerCase(),o=`${r}:${n}`;if(!/^[a-z0-9][a-z0-9-]*$/.test(r)||!/^[a-z0-9][a-z0-9-]*$/.test(n))throw new TypeError(`Invalid context intent command or name: ${o}`);if(e.description.trim().length===0)throw new TypeError(`Context intent ${o} requires a non-empty description`);if(!Number.isSafeInteger(e.token_budget)||e.token_budget<=0)throw new TypeError(`Context intent ${o} requires a positive integer token_budget`);let i=[...new Set(e.included_field_groups.map(s=>s.trim()).filter(Boolean))];if(i.length===0)throw new TypeError(`Context intent ${o} requires included_field_groups`);return{command:r,intent:n,description:e.description.trim(),included_field_groups:i,token_budget:e.token_budget,source:t}}function cp(e=[],t=[]){let r=[{source:"core",contracts:Qs,allowOverride:!1},{source:"package",contracts:t,allowOverride:!1},{source:"workspace",contracts:e,allowOverride:!0}],n=new Map,o=new Set;for(let i of r){o.clear();for(let s of i.contracts){let a=ap(s,i.source),c=`${a.command}:${a.intent}`;if(o.has(c))throw new TypeError(`Duplicate context intent declaration: ${c}`);if(o.add(c),!i.allowOverride&&n.has(c))throw new TypeError(`Duplicate context intent declaration: ${c}`);n.set(c,a)}}return[...n.values()].sort((i,s)=>i.command.localeCompare(s.command)||i.intent.localeCompare(s.intent))}function ea(e,t,r=sp(),n=[]){let o=e.trim().toLowerCase(),i=t.trim().toLowerCase(),s=r.find(u=>u.command===o&&u.intent===i);if(s)return{...s,source:s.source??"core"};let a=r.filter(u=>u.command===o).map(u=>u.intent);if(a.length===0)return;let c=a.map(u=>{let m=Array.from({length:i.length+1},(p,_)=>_);for(let p=1;p<=u.length;p+=1){let _=m[0];m[0]=p;for(let g=1;g<=i.length;g+=1){let b=m[g];m[g]=Math.min(m[g]+1,m[g-1]+1,_+(u[p-1]===i[g-1]?0:1)),_=b}}return{candidate:u,distance:m[i.length]}}).sort((u,m)=>u.distance-m.distance||u.candidate.localeCompare(m.candidate))[0].candidate,l=[o,...n,"--for",i],d=[o,...n,"--for",c],f=Bt(d);throw new h(`Unknown context intent "${i}" for ${o}. Did you mean "${c}"?`,y.USAGE,{code:"unknown_context_intent",reason:"unknown_intent",field:"for",flag:"--for",value:i,required:`Use a declared ${o} intent.`,why:"Intent names are command-local contracts and cannot be inferred from output section names.",nextSteps:[f],recovery:{recovery_mode:"compact",attempted_command:Bt(l),allowed_values:[...a].sort(),suggested_retry:f,suggested_retry_args:d}})}var ta={context:(e,t,r)=>{e.section===void 0&&e.depth===void 0&&(e.section=t.intent==="handoff"?["activity","progress","blockers"]:["hierarchy","blockers","activity"]),e.depth===void 0&&(e.depth=t.intent==="handoff"?"deep":"standard");let n=Qt(e.tokenBudget,t.token_budget),o=Zt("context",t.intent,n,r),i=Ee(e.limit),s=String(i===void 0?o:Math.min(i,o));(e.limit===void 0||i!==void 0)&&(e.limit=s),e.activityLimit===void 0&&(e.activityLimit=s)},get:e=>{e.depth===void 0&&e.fields===void 0&&(e.depth="standard")},list:(e,t,r)=>{e.brief===void 0&&e.compact===void 0&&e.full===void 0&&e.fields===void 0&&(e.fields="id,title,status,type,priority,parent,assignee,risk,blocked_by");let n=Qt(e.tokenBudget,t.token_budget),o=Zt("list",t.intent,n,r),i=Ee(e.limit);(e.limit===void 0||i!==void 0)&&(e.limit=String(i===void 0?o:Math.min(i,o)))},next:e=>{e.readyOnly===void 0&&(e.readyOnly=!0)},search:(e,t,r)=>{e.compact===void 0&&e.full===void 0&&e.fields===void 0&&(e.compact=!0);let n=Qt(e.tokenBudget,t.token_budget),o=Zt("search",t.intent,n,r),i=Ee(e.limit);(e.limit===void 0||i!==void 0)&&(e.limit=String(i===void 0?o:Math.min(i,o)))}};function Zv(e,t,r=[]){let n=t.tokenBudget??t.token_budget;if(typeof t.for!="string"){if(n!==void 0&&(e==="get"||e==="list"||e==="search"))throw new h("--token-budget requires a declared context intent selected with --for",y.USAGE,{code:"missing_required_option",field:"for",required:"Select a context intent with --for when setting --token-budget.",why:"A token-budget override has no projection contract to constrain without a selected intent.",nextSteps:["Retry with --for <intent> --token-budget <n>, or omit --token-budget."]});if(t.tokenBudget!==void 0||t.token_budget===void 0)return t;let a={...t,tokenBudget:n};return delete a.token_budget,a}let o=ea(e,t.for,void 0,r),i=Ee(n)!==void 0,s={...t};return s.tokenBudget===void 0&&n!==void 0&&(s.tokenBudget=n),delete s.token_budget,s.tokenBudget===void 0&&(s.tokenBudget=String(o.token_budget)),ta[e](s,o,i),s}var lp={context:"bounded_sections",get:"standard_item",list:"bounded_fields_and_rows",next:"bounded_ranked_rows",search:"bounded_ranked_rows"},Jt=256;function bn(e){return Array.isArray(e)?e.map(bn):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,bn(r)])):typeof e=="string"&&e.length>240?`${e.slice(0,240)}\u2026`:e}function Ee(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function Qt(e,t){let r=Ee(e);if(r===void 0)return t;if(r<Jt)throw new h(`Context intent token budget must be at least ${Jt}`,y.USAGE,{code:"invalid_argument_value",reason:"below_minimum",field:"tokenBudget",value:String(e),required:`Use an integer token budget of at least ${Jt}.`,why:"Smaller ceilings cannot contain the minimum machine-readable intent receipt.",nextSteps:[`Retry with --token-budget ${Jt} or omit the override.`]});return r}function Zt(e,t,r,n){if(e==="get"||e==="next")return;let o=e==="context"&&t==="orient",i=e==="context"?o?1200:800:e==="list"?520:480,s=e==="context"?o?600:500:16,a=Math.max(e==="context"?1:2,Math.floor((r-i)/s));return n?a:Math.min(e==="context"?20:100,a)}function ie(e,t){let r=t.estimated_tokens;for(;;){t.estimated_tokens=r;let n=Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4);if(n===r)return;r=n}}var Xs={context:["high_level","low_level","blocked_fallback","recently_created","unparented","hierarchy","activity","blockers"],get:["children"],list:["items"],next:["ready","decision_needed","gate_needed","containers","blocked","held_by_others"],search:["items"]};function ra(e){try{let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));return typeof t.fingerprint!="string"||!Number.isSafeInteger(t.after_index)?void 0:{fingerprint:t.fingerprint,after_index:t.after_index,...typeof t.snapshot=="string"?{snapshot:t.snapshot}:{}}}catch{return}}function dp(e){if(e===null||typeof e!="object")return;if(typeof e.id=="string")return e.id;let t=e.item?.id;return typeof t=="string"?t:void 0}function up(e,t,r){let n=!1;for(;;){if(ie(e,t),t.estimated_tokens<=t.token_budget||r.length<=1)return n;let o=Buffer.byteLength(JSON.stringify(r),"utf8"),i=(t.estimated_tokens-t.token_budget)*4;r.splice(-Math.min(r.length-1,Math.max(1,Math.ceil(i/Math.max(1,Math.ceil(o/r.length)))))),n=!0}}function mp(e,t,r){let n=e.items,o=typeof e.next_cursor=="string",i=o?e.next_cursor:r.after;if(!Array.isArray(n)||typeof i!="string")return!1;let s=ra(i);if(s===void 0)return!1;let a=n.length,c=[...n],l=!1;for(;;){if(l=up(e,t,n)||l,!l)return!1;let d=dp(n.at(-1));if(d===void 0)return n.splice(0,n.length,...c),ie(e,t),!1;if(e.next_cursor=Ve(s.fingerprint,d,o?s.after_index-(a-n.length):s.after_index+n.length,s.snapshot),ie(e,t),t.estimated_tokens<=t.token_budget||n.length<=1)break}return typeof e.count=="number"&&(e.count=n.length),typeof e.applied_limit=="number"&&(e.applied_limit=n.length),!0}function fp(e,t,r,n){if(e==="list"||e==="search")return mp(t,r,n);if(e!=="next"||typeof t.next_cursor=="string")return!1;let o=!1;for(;;){if(ie(t,r),r.estimated_tokens<=r.token_budget)return o;let i=Xs[e].map(u=>({key:u,rows:Array.isArray(t[u])?t[u]:[]})).filter(({rows:u})=>u.length>0).sort((u,m)=>m.rows.length-u.rows.length||u.key.localeCompare(m.key))[0];if(i===void 0)return o;let s=Xs[e].reduce((u,m)=>u+(Array.isArray(t[m])?t[m].length:0),0);if(s<=1)return o;let a=Math.min(i.rows.length,s-1),c=Buffer.byteLength(JSON.stringify(i.rows),"utf8"),l=Math.max(1,Math.ceil(c/i.rows.length)),d=(r.estimated_tokens-r.token_budget)*4,f=Math.min(a,Math.max(1,Math.ceil(d/l)));i.rows.splice(-f,f),o=!0}}function pp(e,t,r){if(typeof t.for!="string")return r;let n=e.startsWith("list-")?"list":e;if(!(n in ta))return r;let o=n,i=ea(o,t.for),s=Qt(t.tokenBudget??t.token_budget,i.token_budget),a={command:o,intent:i.intent,source:i.source,included_field_groups:[...i.included_field_groups],token_budget:s,declared_token_budget:i.token_budget,token_budget_override:s-i.token_budget,estimated_tokens:0,within_budget:!0,degradation:lp[o],declaration_feasible:!0,result_omitted:!1},c={...r},l=Zt(o,i.intent,a.token_budget,Ee(t.tokenBudget??t.token_budget)!==void 0);if(l!==void 0){let f=Ee(t.limit),u=f!==void 0&&f<l;a.budget_derived_limit=l,a.binding_constraint=u?"explicit_limit":"token_budget",a.limit_reason=u?"The caller supplied a smaller row limit than the budget-derived ceiling.":"The selected intent token budget constrains the effective row ceiling.",c.budget_derived_limit=l}let d={...c,context_intent:a};return ie(d,a),a.estimated_tokens>a.token_budget&&(a.degradation="recursive_budget_compaction",d={...bn(c),context_intent:a},ie(d,a)),a.estimated_tokens>a.token_budget&&fp(o,d,a,t)&&(a.degradation="budget_row_compaction",ie(d,a)),a.declaration_feasible=a.estimated_tokens<=a.declared_token_budget,a.estimated_tokens>a.token_budget&&(a.degradation="budget_receipt_only",a.result_omitted=!0,a.within_budget=!1,d={budget_exceeded:{omitted_result:!0,reason:a.token_budget_override===0?"declared_budget_infeasible":"effective_budget_infeasible",restore_with:gp(e,o,i.intent,a,c)},context_intent:a}),d}function _p(e,t){if(typeof e.after!="string"||e.after.length===0)return t;let r=ra(e.after)?.fingerprint??"opaque_cursor",n={...t};for(let o of["applied_limit","completeness","context_intent","count","filters","has_more","now","omission_receipt","projection","row_contract","sorting","total","truncated"])delete n[o];return n.continuation_contract={fingerprint:r,metadata:"reference",restore_with:"omit --after"},n}function vn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function gp(e,t,r,n,o){let i=t==="get"&&vn(o.item)&&typeof o.item.id=="string"?o.item.id:t==="search"&&typeof o.query=="string"?o.query:void 0,s=i===void 0?"":` '${i.replaceAll("'",`'"'"'`)}'`,a=t==="get"?"":` --limit ${n.budget_derived_limit??1}`;return`pm ${e}${s} --for ${r} --token-budget ${Math.ceil(n.estimated_tokens/100)*100}${a}`}function De(e,t){if(vn(e))return typeof e[t]=="number"?e[t]:void 0}function yp(e,t){let r=e;for(let n=0;n<8;n+=1){let o=De(r.context_intent,"estimated_tokens"),i=De(r.read_output,"estimated_tokens"),s=De(r.read_session,"spent_this_call_tokens");if(vn(r.context_intent)&&ie(r,r.context_intent),r=wn(r,t),De(r.context_intent,"estimated_tokens")===o&&De(r.read_output,"estimated_tokens")===i&&De(r.read_session,"spent_this_call_tokens")===s)break}return r}function hp(e,t,r){let n=ws(e,r),o=typeof n=="object"&&n!==null&&!Array.isArray(n)?Js(e??"",{...t,outputRowContract:t.outputRowContract===!0||t.output_row_contract===!0},_p(t,pp(e??"",t,n))):n;if(Xt(r,o),t.outputRowContract===!0||t.output_row_contract===!0||typeof o!="object"||o===null||Array.isArray(o)||!Object.hasOwn(o,"row_contract"))return o;let i=Object.fromEntries(Object.entries(o).filter(([a])=>a!=="row_contract"));Object.defineProperty(i,"row_contract",{value:o.row_contract,enumerable:!1,configurable:!0});let s=yp(i,t);return delete s.row_contract,Xt(o,s),s}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cb1266f3-8375-586f-87c6-356cf7843969")}catch{}})();var Pe=["result_rows","envelope","diagnostics","hints"],bp=/^(?:items|results|rows|ready|blocked|recommended|decision_needed|children|dependencies|events|matches|commands|tools)$/u,wp=/^(?:diagnostics|errors?|warnings?|findings|violations|failures?)$/u,vp=/^(?:hints?|suggestions?|next_steps?|recovery|remediation|examples?)$/u,Ep=8;function En(e){return Buffer.byteLength(e,"utf8")}function na(e){return En(JSON.stringify(e)??"null")}function kp(e,t){return wp.test(e)?"diagnostics":vp.test(e)?"hints":bp.test(e)||Array.isArray(t)?"result_rows":"envelope"}function Op(e){let t={result_rows:0,envelope:0,diagnostics:0,hints:0};if(typeof e!="object"||e===null||Array.isArray(e))return t[Array.isArray(e)?"result_rows":"envelope"]=na(e),t;for(let[r,n]of Object.entries(e))t[kp(r,n)]+=na({[r]:n});return Object.values(t).every(r=>r===0)&&(t.envelope=1),t}function Ap(e,t){let r=Pe.reduce((s,a)=>s+t[a],0),n=Pe.map(s=>({section:s,value:e*t[s]/r})),o={result_rows:0,envelope:0,diagnostics:0,hints:0};for(let s of n)o[s.section]=Math.floor(s.value);let i=e-Pe.reduce((s,a)=>s+o[a],0);for(let s of[...n].sort((a,c)=>c.value-Math.floor(c.value)-(a.value-Math.floor(a.value))||Pe.indexOf(a.section)-Pe.indexOf(c.section))){if(i===0)break;o[s.section]+=1,i-=1}return o}function oa(e,t){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...e,token_accounting:t}:{result:e,token_accounting:t}}function Sp(e,t){let r=En(t(e)),n=Ap(r,Op(e)),o=Object.fromEntries(Pe.map(a=>[a,{bytes:n[a],estimated_tokens:fe(n[a])}])),i={version:1,measurement_scope:"output_before_token_accounting",estimator:"ceil(utf8_bytes / 4)",total_bytes:r,total_estimated_tokens:fe(r),sections:o,accounting_receipt_bytes:0,accounting_receipt_estimated_tokens:0,excluded_fields:["token_accounting"],section_allocation:"proportional_canonical_json"},s=oa(e,i);for(let a=0;a<Ep;a+=1){let c=En(t(s))-r;if(c===i.accounting_receipt_bytes)return s;i={...i,accounting_receipt_bytes:c,accounting_receipt_estimated_tokens:fe(c)},s=oa(e,i)}return s}import{encode as aa}from"@toon-format/toon";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="226eaad9-e87a-5ee9-a35b-e1a6f05b8965")}catch{}})();var gE=new Set(Object.values(y));var ia=!1;function q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function kn(e){return typeof e=="object"&&e!==null&&e.code==="EPIPE"}function Ip(){(process.exitCode===void 0||process.exitCode===y.SUCCESS)&&(process.exitCode=y.SUCCESS)}function Rp(){(process.exitCode===void 0||process.exitCode===y.SUCCESS)&&(process.exitCode=y.GENERIC_FAILURE)}function On(e){if(e==="stdout"){Ip();return}Rp()}function sa(e){let t=e instanceof Error?e:new Error(String(e));setImmediate(()=>{throw t})}function xp(){ia||(ia=!0,process.stdout.on("error",e=>{if(kn(e)){On("stdout");return}sa(e)}),process.stderr.on("error",e=>{if(kn(e)){On("stderr");return}sa(e)}))}function Np(e,t){xp();try{return e==="stdout"?process.stdout.write(t):process.stderr.write(t),!0}catch(r){if(kn(r))return On(e),!1;throw r}}function Dp(e){return Np("stderr",e)}function An(e){return typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"?String(e):e===null?"null":JSON.stringify(e)}function Pp(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function ca(e){if(e.length===0||!e.every(q))return!1;let t=Object.keys(e[0]);return t.length>0&&e.every(r=>Object.keys(r).length===t.length&&t.every(n=>Object.hasOwn(r,n)&&Pp(r[n])))}function la(e,t){let r=" ".repeat(t);return e.split(`
|
|
17
|
+
`).map(n=>`${r}${n}`).join(`
|
|
18
|
+
`)}function Mp(e,t,r){let n=" ".repeat(r);return!q(t)&&!Array.isArray(t)?`${n}${e}: ${An(t)}`:Array.isArray(t)&&t.length===0?`${n}${e}: []`:Array.isArray(t)&&ca(t)?la(aa({[e]:t}),r):q(t)&&Object.keys(t).length===0?`${n}${e}: {}`:`${n}${e}:
|
|
19
|
+
${Tn(t,r+1)}`}function Sn(e){if(e!=null){if(Array.isArray(e)){let t=e.map(r=>Sn(r)).filter(r=>r!==void 0);return t.length>0?t:void 0}if(q(e)){let t={};for(let[r,n]of Object.entries(e)){if(r==="omitted_field_groups"&&Array.isArray(n)&&n.length===0){t[r]=[];continue}let o=Sn(n);o!==void 0&&(t[r]=o)}return Object.keys(t).length>0?t:void 0}return e}}function Tn(e,t){let r=" ".repeat(t);if(Array.isArray(e))return e.length===0?"[]":ca(e)?la(aa(e),t):e.map(n=>{if(!q(n)&&!Array.isArray(n))return`${r}- ${An(n)}`;let o=Tn(n,t+1).split(`
|
|
20
|
+
`),[i,...s]=o;return s.length===0?`${r}- ${i.trimStart()}`:`${r}- ${i.trimStart()}
|
|
21
|
+
${s.join(`
|
|
22
|
+
`)}`}).join(`
|
|
23
|
+
`);if(q(e)){let n=Object.entries(e);return n.length===0?"{}":n.map(([o,i])=>Mp(o,i,t)).join(`
|
|
24
|
+
`)}return`${r}${An(e)}`}function $p(e){if(!q(e)||!Array.isArray(e.items)||Object.hasOwn(e,"details")||!q(e.projection)||e.projection.mode!=="brief"||!q(e.completeness)||e.completeness.status!=="complete"||[e.completeness.unreadable_item_count,e.completeness.unreadable_directory_count].some(f=>f!==0)||[e.has_more,e.truncated].some(f=>f!==!1)||e.count!==e.items.length||e.total!==e.count||!q(e.omission_receipt)||JSON.stringify(e.omission_receipt.omitted_field_groups)!==JSON.stringify([{name:"full_item_fields",restore_with:"--full"}]))return e;let{total:t,has_more:r,truncated:n,next_cursor:o,completeness:i,projection:s,now:a,omission_receipt:c,sorting:l,...d}=e;return{...d,...q(l)&&l.sort==="default"?{}:{sorting:l},details:"--full"}}function da(e,t){if(t==="json")return`${JSON.stringify(e,null,2)}
|
|
25
|
+
`;let r=Sn($p(e));return r===void 0?`{}
|
|
26
|
+
`:`${Tn(r,0)}
|
|
27
|
+
`}function yE(e){let t=os("error_format",{message:e}),r=t.handled&&typeof t.result=="string"?t.result:e;Dp(r.endsWith(`
|
|
28
|
+
`)?r:`${r}
|
|
29
|
+
`)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b6db58d1-5d89-56b2-adee-13e985ebc675")}catch{}})();var Lp=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 N(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ua(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(!N(r))return;r=r[n]}return r}function Cn(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 ma(e,t,r){let n=Me(e).find(s=>s.path===t);if(!n)return e;let o=Array.isArray(n.value)?n.value.slice(r):Object.fromEntries(Object.entries(n.value).slice(r)),i=Cn(e,t,o);return N(i.summary)&&N(i.summary.focus_row_states)&&typeof i.summary.focus_row_states[t]=="string"&&(i.summary={...i.summary,focus_row_states:{...i.summary.focus_row_states,[t]:i.summary.focus_row_states[t].slice(r)}}),it(i),i}function tr(e){let t=e.row_contract;return N(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 jp(e){let t=e.row_contract;return N(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(r=>typeof r=="string"&&r.trim().length>0):tr(e)}function se(e){return tr(e).flatMap(t=>{let r=ua(e,t);return Array.isArray(r)||N(r)?[{path:t,value:r}]:[]})}function Me(e){return jp(e).flatMap(t=>{let r=ua(e,t);return Array.isArray(r)||N(r)?[{path:t,value:r}]:[]})}function nt(e){let t=se(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(N(o))for(let[s,a]of Object.entries(o))i.length===0&&Lp.has(s)||n(a,i.length===0?s:`${i}.${s}`)};return n(e,""),t}function rr(e){return se(e).reduce((t,r)=>t+(Array.isArray(r.value)?r.value.length:Object.keys(r.value).length),0)}function ot(e,t){let r=e;for(let n of se(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=Cn(r,n.path,o)}return r}function fa(e,t){let r=e,n=!1;for(let o of se(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=Cn(r,o.path,s)}return{result:r,truncated:n}}var pa=["high_level","low_level","blocked_fallback"];function er(e){let t=e.status==="in_progress"?"i":"o";return e.blocked===!0?t.toUpperCase():t}function bE(e,t){if(!N(e.summary)||!N(e.summary.returned_focus))return;let r=new Map(t.map(n=>[n.id,n]));e.summary={...e.summary,focus_row_states:Object.fromEntries(pa.map(n=>[n,Array.isArray(e[n])?e[n].filter(N).map(o=>er(r.get(o.id)??o)).join(""):""]))}}function Fp(e,t){if(e!==void 0){if(typeof e!="string"||e.length!==t||!/^[iIoO]*$/u.test(e))throw new TypeError("Context focus classification receipt must contain one i/I/o/O code per delivered record");return e}}function Up(e,t,r,n){let o=Array.isArray(t[r])?t[r].filter(N):[],i=Fp(n[r],o.length)??o.map(er).join(""),s=new Map(o.flatMap((l,d)=>l.id===void 0?[]:[[l.id,i[d]]])),a=Array.isArray(e[r])?e[r].filter(N):[],c=!1;return{states:a.map((l,d)=>{let f=s.get(l.id)??(l.id===void 0?i[d]:void 0)??er(l);return f!==er(l)&&(c=!0),f}).join(""),needsStates:c}}function zp(e,t){typeof e.count=="number"&&(e.count_only===!0||t.count_only===!0?typeof t.count=="number"&&(e.count=t.count):Array.isArray(e.items)&&(e.count=e.items.length))}function it(e,t=e){if(zp(e,t),!N(e.summary)||!N(e.summary.returned_focus))return;let r={...e.summary},n=N(t.summary)&&N(t.summary.focus_row_states)?t.summary.focus_row_states:{},o=pa.map(c=>({key:c,...Up(e,t,c,n)})),i=Object.fromEntries(o.map(({key:c,states:l})=>[c,l])),s=o.some(c=>c.needsStates),a=Object.values(i).join("");typeof r.high_level=="number"&&(r.high_level=Array.isArray(e.high_level)?e.high_level.length:0),typeof r.low_level=="number"&&(r.low_level=Array.isArray(e.low_level)?e.low_level.length:0),r.returned_focus={active_items:a.length,in_progress:[...a].filter(c=>c.toLowerCase()==="i").length,open:[...a].filter(c=>c.toLowerCase()==="o").length,blocked:[...a].filter(c=>c===c.toUpperCase()).length},s?r.focus_row_states=i:delete r.focus_row_states,e.summary=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]="11fbc131-03e8-5cea-948b-8bda15b11292")}catch{}})();var qp=8,Bp=64,Vp=5,Gp=4,_a=100;function ga(e,t,r){if(e!=="get"||!In(r.item)||["fields","outputInclude","output_include","outputCursor","output_cursor"].some(c=>t[c]!==void 0)||t.full===!0||t.tree===!0||t.depth!==void 0&&t.depth!=="standard")return;let n=r.item,o=["linked","claim_state","schedule"],i=o.filter(c=>Object.hasOwn(r,c)),s=Object.fromEntries(Object.entries(r).filter(([c])=>!o.includes(c)));s.item=Object.fromEntries(Object.entries(n).filter(([c])=>c!=="body")),Object.hasOwn(n,"body")&&i.push("body");let a=[...In(r.omission_receipt)&&Array.isArray(r.omission_receipt.omitted_field_groups)?r.omission_receipt.omitted_field_groups:[],...i.map(c=>({name:c,restore_with:`--fields ${c}`}))];return s.omission_receipt={has_omissions:a.length>0,omitted_field_group_count:a.length,omitted_field_groups:a},s}function xn(e){let t=Math.trunc(e.effective_budget_tokens),r=Math.trunc(e.measured_result_tokens);if(!Number.isSafeInteger(t)||t<=0||!Number.isSafeInteger(r)||r<=0)return{output_budget:"unbounded",recovery_budget_multiplier:null,rule_version:"v1"};let n=Math.max(t+1,r),o=Math.ceil(n*Vp/Gp),i=Math.ceil(o/_a)*_a;return Number.isSafeInteger(i)?{output_budget:i,recovery_budget_multiplier:i/t,rule_version:"v1"}:{output_budget:"unbounded",recovery_budget_multiplier:null,rule_version:"v1"}}function $e(e,t,r=!1){let n=Object.getOwnPropertyDescriptor(e,"row_contract");n&&(r||n.enumerable===!1)&&Object.defineProperty(t,"row_contract",{...n,enumerable:!1})}function st(e,t){let r=t===void 0?JSON.stringify(e):da(e,t);return Math.ceil(Buffer.byteLength(r,"utf8")/4)}function In(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Rn(e,t,r=!1){return typeof e=="string"?r||e.length<=240?e:(t.compacted=!0,`${e.slice(0,240)}\u2026`):Array.isArray(e)?e.map(n=>Rn(n,t,r)):In(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Rn(o,t,r||n==="focus_row_states")])):e}function ae(e,t,r){let n=t.estimated_tokens;for(let o=0;o<qp;o+=1){t.estimated_tokens=n;let i=st(e,r);if(i===n)return;n=i}t.estimated_tokens=n}function Wp(e,t){return nt(e).filter(r=>(Array.isArray(r.value)?r.value.length:Object.keys(r.value).length)>Math.max(1,t.get(r.path)??0)).map(r=>({collection:r,length:Array.isArray(r.value)?r.value.length:Object.keys(r.value).length})).sort((r,n)=>n.length-r.length||r.collection.path.localeCompare(n.collection.path))[0]?.collection}function Kp(e,t,r,n,o,i){for(let s=0;s<Bp;s+=1){if(i?.(e),ae(e,t,o),t.estimated_tokens<=r)return;let a=Wp(e,n);if(!a)return;let c=Math.max(1,n.get(a.path)??0),l=Array.isArray(a.value)?[...a.value]:Object.entries(a.value),d=p=>{if(Array.isArray(a.value)){a.value.length=p;for(let _=0;_<p;_+=1)a.value[_]=l[_]}else{for(let _ of Object.keys(a.value))delete a.value[_];Object.defineProperties(a.value,Object.getOwnPropertyDescriptors(Object.fromEntries(l.slice(0,p))))}typeof e.count=="number"&&(e.count=rr(e)),a.path==="items"&&(e.applied_limit=p),i?.(e),ae(e,t,o)};t.rows_compacted=!0,t.compacted_row_paths=[...new Set([...t.compacted_row_paths??[],a.path])].sort((p,_)=>p.localeCompare(_)),e.has_more=!0,e.truncated=!0;let f=c,u=l.length-1,m=c;for(;f<=u;){let p=Math.floor((f+u)/2);d(p),t.estimated_tokens<=r?(m=p,f=p+1):u=p-1}d(m)}}function ya(e,t,r,n=new Map,o,i,s=!1){let a={compacted:!1},c=Object.fromEntries(Object.entries(e).map(([l,d])=>[l,Rn(d,a,s&&l==="diff")]));return $e(e,c),t.strings_compacted=a.compacted,c.read_output=t,Kp(c,t,r,n,o,i),ae(c,t,o),c}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f7d00f9c-6e95-5426-971d-9b30e2ec1652")}catch{}})();var Nn=256,Dn=1e4,Hp=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,ha=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u,Yp=new Set(["version","id","token_budget","spent_tokens","seen_item_ids"]),Xp=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&Hp.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=Nn,reason:`token_budget must be a safe integer of at least ${Nn}.`},{valid:e=>Number.isSafeInteger(e.spent_tokens)&&e.spent_tokens>=0&&e.spent_tokens<=e.token_budget,reason:"spent_tokens must be a non-negative safe integer no larger than token_budget."},{valid:e=>Array.isArray(e.seen_item_ids)&&e.seen_item_ids.length<=Dn&&e.seen_item_ids.every(t=>typeof t=="string"&&ha.test(t)),reason:`seen_item_ids must contain at most ${Dn} portable item identifiers.`}];function or(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nr(e){throw new h(`--output-session ${e}`,y.USAGE,{code:"invalid_read_output_session",field:"outputSession"})}function ir(e){if(e===void 0)return;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{nr("must be a valid JSON object.")}or(t)||nr("must be a JSON object.");let r=Object.keys(t).filter(i=>!Yp.has(i));r.length>0&&nr(`contains unknown field "${r.sort()[0]}".`);let n=Xp.find(i=>!i.valid(t));n!==void 0&&nr(n.reason);let o=[...new Set(t.seen_item_ids)].sort();return{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:o}}function ba(e){if(or(e))return typeof e.id=="string"?e.id:typeof e.item_id=="string"?e.item_id:or(e.item)&&typeof e.item.id=="string"?e.item.id:void 0}function Jp(e){let t=new Set,r=0,n=se(e),o=new Set(n.map(({path:s})=>s)),i=Object.entries(e).flatMap(([s,a])=>Array.isArray(a)&&!o.has(s)?[{path:s,value:a}]:[]);for(let s of[...n,...i]){let a=Array.isArray(s.value)?s.value:Object.values(s.value);for(let c of a){if(!or(c))continue;if(typeof c.context_ref=="string"){r+=1;continue}let l=ba(c);l!==void 0&&ha.test(l)&&t.add(l)}}return{deliveredIds:t,suppressedRepeatCount:r}}function wa(e,t){let r=new Set(t.seen_item_ids);return ot(e,n=>{let o=ba(n);return o!==void 0&&r.has(o)?{id:o,context_ref:`session:${t.id}:${o}`}:n})}function Pn(e,t,r){let{deliveredIds:n,suppressedRepeatCount:o}=Jp(e),i=new Set(t.seen_item_ids),s=[...n].filter(_=>!i.has(_)).sort(),a=s.slice(0,Dn-t.seen_item_ids.length),c=[...t.seen_item_ids,...a].sort(),l=s.length-a.length,d={contract_version:1,id:t.id,measurement_scope:"complete_read_envelope",estimator:"ceil(utf8_bytes / 4)",token_budget:t.token_budget,spent_before_tokens:t.spent_tokens,spent_this_call_tokens:0,charged_this_call_tokens:0,spent_total_tokens:t.spent_tokens,remaining_tokens:t.token_budget-t.spent_tokens,exhausted:!1,seen_before_count:t.seen_item_ids.length,new_item_count:n.size,...l===0?{}:{seen_item_overflow_count:l},suppressed_repeat_count:o,reference_format:"session:<session-id>:<item-id>",restore_reference_with:"pm get <item-id> --brief",next_state:{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:c}},f={...e,read_session:d},u=_=>{d.spent_this_call_tokens=_,d.charged_this_call_tokens=Math.min(t.token_budget-t.spent_tokens,_),d.spent_total_tokens=Math.min(t.token_budget,t.spent_tokens+d.charged_this_call_tokens),d.remaining_tokens=Math.max(0,t.token_budget-d.spent_total_tokens),d.exhausted=d.remaining_tokens<Nn,d.next_state.spent_tokens=d.spent_total_tokens},m=0,p=0;for(let _=0;_<8;_+=1){u(m);let g=st(f,r);if(g===m)return f;p=Math.max(p,g),m=g}return u(p),f}function va(e){return Math.max(0,e.token_budget-e.spent_tokens)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1cc0fcb7-2aaa-5233-bdfd-4b4d0fb3e9c1")}catch{}})();var at=Symbol.for("pm.readOutputInvocationProvenance");function IE(e,t){return Reflect.set(e,at,{canonical_include_modes:[...t],explicit_legacy_aliases:[],sdk_invocation_observed:!0}),e}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2c49208d-1cb1-583b-82c3-15d06c273c48")}catch{}})();var ke=["include","amount","cost","encoding"],Ra=["list","context","search","get","next","health","deps","graph","history","activity","validate","events","contracts","comments","notes","files","docs","stats","aggregate","duplicates","package-catalog","package-manage","comments-audit","assurance"],xa=["canonical","legacy","intent","default"],lt=Rt,VE=Object.freeze(ke.map(e=>lt[e])),GE=xt,Na={list:{include:["--brief","--compact","--fields","--full"],amount:["--after","--limit","--no-truncate"],cost:["--token-budget"],encoding:["--format","--stream"]},context:{include:["--fields","--section"],amount:["--after","--depth","--limit"],cost:["--token-budget"],encoding:["--format"]},search:{include:["--compact","--fields","--full"],amount:["--after","--limit"],cost:["--token-budget"],encoding:["--format"]},get:{include:["--fields","--full"],amount:["--depth"],cost:["--token-budget"],encoding:["--format"]},next:{amount:["--blocked-limit","--limit"],cost:["--token-budget"],encoding:["--format"]},health:{include:["--brief","--check-only","--full","--summary"]},deps:{include:["--collapse","--full","--summary"],amount:["--edge-limit","--max-depth","--node-limit"],cost:["--token-budget"],encoding:["--format"]},graph:{include:["--full","--summary"],amount:["--after","--limit","--max-depth","--max-paths"]},history:{include:["--compact","--full"],amount:["--limit"],encoding:["--format"]},activity:{include:["--compact","--full"],amount:["--limit","--unbounded"],encoding:["--stream"]},validate:{include:["--counts","--full"]},events:{include:["--full"],amount:["--limit"],encoding:["--follow"]},contracts:{include:["--full","--summary"]},comments:{amount:["--limit"]},notes:{amount:["--limit"]},files:{amount:["--limit","--no-truncate","--offset"]},docs:{},stats:{},aggregate:{},duplicates:{amount:["--limit"]},"package-catalog":{},"package-manage":{},"comments-audit":{},assurance:{}},Da=new Set(["--collapse","--fields","--section"]),Ln=Object.freeze({"--after":"--after retains cursor-position semantics; use --output-limit <n> separately to bound returned rows.","--check-only":"--check-only retains health side-effect semantics; --output-include does not suppress vector refresh.","--collapse":"--collapse retains dependency grouping semantics; --output-include does not replace it.","--depth":"--depth retains traversal or detail-depth semantics; --output-limit does not replace it.","--follow":"--follow retains event-tail semantics; --output-format does not enable following.","--max-depth":"--max-depth retains graph traversal-depth semantics; --output-limit does not replace it.","--max-paths":"--max-paths retains graph path-search semantics; use --output-limit separately to bound returned rows.","--no-truncate":"--no-truncate is a compatibility alias; prefer --output-limit unbounded.","--offset":"--offset retains positional pagination semantics; use --output-limit separately to bound returned rows.","--stream":"--stream retains command streaming semantics; --output-format selects only static result encoding.","--unbounded":"--unbounded is a compatibility alias; prefer --output-limit unbounded."});function jn(e){return e.slice(2).replaceAll("-","_")}function Qp(e,t){let r=Ln[e];if(r!==void 0)return r;let n=t==="include"?Da.has(e)?"<csv>":jn(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${lt[t]} ${n}.`}function Zp(e){let t=Na[e],r=Object.freeze(Object.fromEntries(ke.map(n=>[n,Object.freeze({dimension:n,canonical_option:lt[n],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[n]??[]).map(o=>Object.freeze({flag:o,semantics:Ln[o]===void 0?"replacement":"behavior_preserving",migration_hint:Qp(o,n),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:r,precedence:xa,budget_retention_policy:e==="assurance"?"verdict_priority":"ordered_prefix",projection_modes:Object.freeze([...Fn(e).keys()])})}var e_=Object.freeze(Ra.map(Zp)),t_=new Map(e_.map(e=>[e.command,e]));function je(e,t={}){let r=ze(e.trim().toLowerCase()),n=r==="package catalog"||r==="packages catalog"||r==="package-catalog"||(r==="package"||r==="packages"||r==="extension")&&(t.catalog===!0||t.target==="catalog"||t.action==="catalog")?"package-catalog":r==="package manage"||r==="package-manage"?"package-manage":r.split(" ")[0],o=n.startsWith("list-")?"list":n==="ctx"?"context":n;return Ra.includes(o)?o:void 0}var r_=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],n_={comments:["add","body","stdin","file","edit","delete"],notes:["add","addJson","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"],"package-catalog":["activate","adopt","adoptAll","deactivate","doctor","init","install","manage","migrate","reload","scaffold","uninstall"]};function o_(e){return r_.some(t=>t!=="outputFormat"&&t!=="output_format"&&e[t]!==void 0)}var i_=[{keys:["outputInclude","output_include"],valid:e=>ct(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||Le(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>e==="unbounded"||Le(e)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputSession","output_session"],valid:e=>(ir(e),!0),message:"--output-session must be a valid session-state object."},{keys:["outputCursor","output_cursor"],valid:e=>typeof e=="string"&&e.trim().length>0,message:"--output-cursor requires a non-empty continuation cursor."}];function WE(e,t){let r=t.outputFormat??t.output_format;if(r!==void 0&&r!=="json"&&r!=="toon")throw new h("--output-format must be toon or json.",y.USAGE);if(!o_(t))return;let n=je(e,t);if(!n)throw new h(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,y.USAGE);if((n_[n]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new h(`Universal output controls cannot be combined with a ${n} mutation.`,y.USAGE);for(let o of i_){let i=o.keys.map(s=>t[s]).find(s=>s!==void 0);if(i!==void 0&&!o.valid(i))throw new h(o.message,y.USAGE)}}function Fn(e){let t=je(e);return t?new Map((Na[t].include??[]).filter(r=>!Da.has(r)&&Ln[r]===void 0).map(r=>[jn(r),Pa(r)])):new Map}function s_(e,t,r){let n=ct(t)??[],o=Fn(e),i=[],s=[],a=r,c=a[at],l=new Set(c?.canonical_include_modes??[]),d=new Set(c?.explicit_legacy_aliases??[]);for(let m of n){let p=o.get(m);if(p===void 0){i.push(m);continue}let _=`--${m.replaceAll("_","-")}`;$a(Ma(r,_))&&d.add(_),r[p]=!0,s.push(m),l.add(m)}let f=je(e)==="get"?i.filter(m=>m!=="item"):[],u=f.length>0;return u&&(r.fields=[...new Set([...ct(r.fields)??[],...f])].join(","),l.add("fields")),(s.length>0||u)&&(a[at]={canonical_include_modes:[...l],explicit_legacy_aliases:[...d],...c?.cli_invocation_observed===!0?{cli_invocation_observed:!0}:{}}),{selectors:i,modes:s}}function KE(e,t){let r=t.outputInclude??t.output_include;if(r===void 0)return;let{selectors:n,modes:o}=s_(e,r,t);if(o.length===0)return;let i=n.length>0?n.join(","):void 0;t.outputInclude=i,Object.hasOwn(t,"output_include")&&(t.output_include=i)}function Pa(e){return e.slice(2).replace(/-([a-z])/gu,(t,r)=>r.toUpperCase())}function Ma(e,t){let r=Pa(t);if(Object.hasOwn(e,r))return e[r];let n=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,n))return e[n];if(t==="--no-truncate"&&e.truncate===!1)return!0}function $a(e){return e!==void 0&&e!==!1&&e!==null}function ct(e){let t=(Array.isArray(e)?e:[e]).flatMap(r=>typeof r=="string"?r.split(","):[]).map(r=>r.trim()).filter(Boolean);return t.length>0?[...new Set(t)]:void 0}function Le(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function a_(e,t,r,n){for(let o of e.legacy_aliases){if(n(o.flag))continue;let i=Ma(t,o.flag),s={value:i,flag:o.flag};if($a(i)&&r(s))return s}}function Ea(e,t){let r=ct(e);if(r)return{source:"canonical",value:r};if(t)return{source:"legacy",value:ct(t.value)??[jn(t.flag)]}}function ka(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let r=Le(e);if(r!==void 0)return{source:"canonical",value:r};if(!t)return;if(t.flag==="--no-truncate"||t.flag==="--unbounded")return{source:"legacy",value:"unbounded"};let n=Le(t.value);return n===void 0?void 0:{source:"legacy",value:n}}function Oa(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let r=Le(e);if(r!==void 0)return{source:"canonical",value:r};if(!t)return;let n=Le(t.value);return n===void 0?void 0:{source:"legacy",value:n}}function Aa(e,t){if(e==="json"||e==="toon")return{source:"canonical",value:e};if(t)return t.flag==="--stream"||t.flag==="--follow"?{source:"legacy",value:"stream"}:t.value==="json"||t.value==="toon"?{source:"legacy",value:t.value}:void 0}function c_(e,t,r){if(!e)return!1;let n=new Set(e.explicit_legacy_aliases);if(e.cli_invocation_observed===!0||e.sdk_invocation_observed===!0)return!n.has(r);let o=new Set(e.canonical_include_modes.map(i=>`--${i.replaceAll("_","-")}`));return t==="include"&&o.has(r)&&!n.has(r)}function l_(e,t,r){return e.trim().toLowerCase().replaceAll(/\s+/gu," ").split(" ")[0]==="list-all"||t.amount?.flag==="--no-truncate"||t.include?.flag==="--full"||r?.canonical_include_modes.includes("full")===!0}function d_(e,t){return ke.flatMap(r=>e[r]?.source==="canonical"||r==="include"&&(t?.canonical_include_modes.length??0)>0?[lt[r]]:[])}function La(e,t){let r=je(e,t);if(!r)return;let n=t_.get(r),o=t[at],i={include:b=>Ea(void 0,b),amount:b=>ka(void 0,b),cost:b=>Oa(void 0,b),encoding:b=>Aa(void 0,b)},s=Object.fromEntries(ke.map(b=>[b,a_(n.dimensions[b],t,T=>i[b](T)!==void 0,T=>c_(o,b,T))])),a=ke.flatMap(b=>{let T=s[b];return T?[T.flag]:[]}),c=ke.flatMap(b=>{let T=s[b];return T?[n.dimensions[b].legacy_aliases.find(mt=>mt.flag===T.flag).migration_hint]:[]}),l=Aa(t.outputFormat??t.output_format,s.encoding),d=Ea(t.outputInclude??t.output_include,s.include),f=ka(t.outputLimit??t.output_limit,s.amount),u=Oa(t.outputBudget??t.output_budget,s.cost),m=l_(e,s,o),p=go(e,{generateFallback:!0}),_=l?.value==="json"||t.resolvedOutputFormat==="json"?"json":"toon",g=u??(m?{source:"intent",value:"unbounded"}:{source:"default",value:p.default_max_estimated_tokens_by_format[_]});return{command:r,include:d,amount:f,cost:g,encoding:l,canonical_options_used:d_({include:d,amount:f,cost:g,encoding:l},o),legacy_aliases_used:a,migration_hints:c,precedence:xa}}function j(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Un=new Set(["applied_bound","applied_limit","completeness","continuation_kind","continuation_path","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","budget_retention_policy","row_contract","sorting","total","truncated"]),u_=["collection_counts","notes_count","tests_count"];function ja(e,t){let r=new Set(t.map(n=>n.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([n])=>r.has(n)))}function m_(e){let t=j(e.item)?e.item:{},r=[...new Set([...Object.keys(t),...u_.filter(o=>Object.hasOwn(t,o))])].sort((o,i)=>o.localeCompare(i)),n=Object.keys(e).filter(o=>o!=="item"&&o!=="read_output"&&!Un.has(o)).sort((o,i)=>o.localeCompare(i));return{item:t,itemFields:r,sections:n,valid:[...r,"item",...r.map(o=>`item.${o}`),...n]}}function f_(e,t){let r=m_(e),n=t.filter(d=>!r.valid.includes(d));if(n.length>0)throw new h(`Unknown --output-include selector(s) for get: ${n.join(", ")}. Valid selectors: ${r.valid.join(", ")}.`,y.USAGE);let o=t.includes("item"),i=t.flatMap(d=>d.startsWith("item.")?[d.slice(5)]:r.itemFields.includes(d)?[d]:[]).filter((d,f,u)=>u.indexOf(d)===f);if(o&&i.length>0)throw new h("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.",y.USAGE);let s=new Set(t.filter(d=>r.sections.includes(d))),a=Object.fromEntries(Object.entries(e).filter(([d])=>Un.has(d)||s.has(d)));o?a.item=r.item:i.length>0&&(a.item=ja(r.item,i));let c=[...o?[]:i.length>0?r.itemFields.filter(d=>!i.includes(d)).map(d=>({name:`item.${d}`,restore_with:`--output-include item.${d}`})):[{name:"item",restore_with:"--output-include item"}],...r.sections.filter(d=>!s.has(d)).map(d=>({name:d,restore_with:`--output-include ${d}`}))],l=[...j(a.omission_receipt)&&Array.isArray(a.omission_receipt.omitted_field_groups)?a.omission_receipt.omitted_field_groups:[],...c];return a.omission_receipt={has_omissions:l.length>0,omitted_field_group_count:l.length,omitted_field_groups:l},a}function Sa(e){let t=0;return ot({...e},r=>(j(r)&&Object.keys(r).length>0&&(t+=1),r)),t}function p_(e,t,r,n){if(Sa(t)===0||Sa(r)>0)return;let o=[...Fn(e).keys()],i=o.length>0?` Declared ${e} projection modes: ${o.join(", ")}.`:` The ${e} surface declares no projection modes; name row fields instead.`;throw new h(`Unknown --output-include selector(s) for ${e}: ${n.join(", ")}. No selector matched any returned row field.${i}`,y.USAGE)}function __(e,t,r){if(e==="get")return f_(t,r);let n=tr(t),o=r.flatMap(s=>n.flatMap(a=>s.startsWith(`${a}.`)?[s.slice(a.length+1)]:[])),i=r.some(s=>Object.hasOwn(t,s.split(".")[0])&&!n.some(a=>s.startsWith(`${a}.`)));if(n.length>0&&(!i||o.length>0)){let s={...t},a=o.length>0?o:r,c=ot(s,l=>j(l)?ja(l,a):l);return p_(e,t,c,a),c}return Object.fromEntries(Object.entries(t).filter(([s])=>r.some(a=>a.split(".")[0]===s)||Un.has(s)))}function g_(e,t){if(t==="unbounded")return e;let{result:r,truncated:n}=fa(e,t);if(!n)return r;if(r.has_more=!0,r.truncated=!0,typeof r.count=="number"){let o=j(r.projection)?r.projection.row_key:void 0;r.count=typeof o=="string"&&Array.isArray(r[o])?r[o].length:rr(r)}return r.applied_bound={kind:"output_limit",source:"explicit",value:t},r}function y_(e){return ke.filter(t=>e[t]!==void 0&&e[t]?.source!=="default"||e.canonical_options_used.includes(lt[t]))}function Fa(e){let t=e.resolvedOutputFormat??e.outputFormat??e.output_format??e.format;return t==="json"||t==="toon"?t:void 0}function ar(e,t,r,n){let o=Pn(e,t,n);$e(e,o);for(let i=0;i<8;i+=1){let s=r.estimated_tokens,a=o.read_session.spent_this_call_tokens;ae(o,r,n);let c=o;o=Pn(o,t,n),$e(c,o);let l=o.read_session.spent_this_call_tokens;if(r.estimated_tokens===s&&l===a)return o}return o}function wn(e,t){if(!j(e.read_output))return e;let r=Fa(t),n=e.read_output,o=ir(t.outputSession??t.output_session);return o===void 0?(ae(e,n,r),e):ar(e,o,n,r)}function h_(e,t){if(e!=="validate")return t;let r=j(t.projection)?t.projection:void 0;if(!(Array.isArray(r?.declared_field_groups)?r.declared_field_groups:[]).some(d=>j(d)&&d.name==="diagnostic_rows"))return t;let n=[...new Set(nt(t).map(({path:d})=>d).filter(d=>/^checks\.\d+\.details\./u.test(d)))],o=n.filter(d=>!n.some(f=>f!==d&&d.startsWith(`${f}.`)));if(o.length===0)return t;let i=j(t.row_contract)?t.row_contract:{},s=Array.isArray(i.row_keys)?i.row_keys.filter(d=>typeof d=="string"):[],a=Array.isArray(i.continuation_row_keys)?i.continuation_row_keys.filter(d=>typeof d=="string"):[],c=s.length>0?s:o,l=[...new Set(o)];return JSON.stringify(c)===JSON.stringify(s)&&JSON.stringify(l)===JSON.stringify(a)?t:{...t,row_contract:{...i,row_keys:c,continuation_row_keys:l,jq_selector:typeof i.jq_selector=="string"?i.jq_selector:".checks[].details"}}}function b_(e,t,r,n,o){let i={...e};if(t.include?.source==="canonical"&&(i=__(t.command,i,t.include.value)),t.command==="assurance"&&(i=Ca(i)),it(i,e),i=Ia(i,t.command,n),t.command==="history"&&n){let c=["compact_history","provenance_history","history","diff"];if(i=Object.fromEntries(Object.entries(i).filter(([l])=>!c.includes(l)||l===n.path)),j(i.projection)&&(i.projection={...i.projection,row_key:n.path}),j(i.row_contract)){let l=i.row_contract;i.row_contract={...l,row_keys:[n.path],...Array.isArray(l.continuation_row_keys)?{continuation_row_keys:[n.path]}:{}}}i.count=Object.keys(i[n.path]).length}let s=e.count_only===!0?{...i,count_only:!0,count:e.count}:i,a=S_(i,t.command,n,o);return t.amount?.source==="canonical"&&(i=g_(i,t.amount.value)),it(i,s),{projected:r===void 0?i:wa(i,r),continuationState:a}}function w_(e,t){return[...e.cost!==void 0&&e.cost.value!=="unbounded"&&(e.cost.source==="canonical"||e.cost.source==="default")?[{source:e.cost.source,tokens:e.cost.value}]:[],...t===void 0?[]:[{source:"session",tokens:va(t)}]].sort((r,n)=>r.tokens-n.tokens)[0]}function Ua(e){let t=e.canonical_options_used;return t&&t.length>0?{canonical_options_used:t}:{}}function v_(e,t,r,n,o,i){let s={contract_version:1,command:e.command,requested_dimensions:t,...n.source==="default"?{budget_source:n.source,budget_tokens:n.tokens}:{},precedence:e.precedence,...Ua(e),legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0,...r===void 0?{omitted_result_estimated_tokens:o}:{}},a={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:s},c=r===void 0?a:ar(a,r,s,i);if(r===void 0&&ae(c,s,i),r!==void 0&&s.estimated_tokens>n.tokens)throw new h("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",y.USAGE);return c}function E_(e,t){return t.outputRowContract===!0||t.output_row_contract===!0||e.canonical_options_used.includes("--output-include")||e.command==="list"&&e.canonical_options_used.length>0&&e.include?.value.includes("full")===!0}function k_(e,t,r,n,o){if(t!==void 0||E_(e,o))return!1;if(e.amount?.source==="canonical"&&e.amount.value!=="unbounded"){let i=e.amount.value;if(se(r).some(({value:s})=>(Array.isArray(s)?s.length:Object.keys(s).length)>i))return!1}return e.cost===void 0||e.cost.value==="unbounded"||e.cost.source==="legacy"||st(o.outputRowContract===!1?Object.fromEntries(Object.entries(r).filter(([i])=>i!=="row_contract")):r,n)<=e.cost.value}function O_(e,t,r,n,o,i,s){if(!r.rows_compacted)return;let a=t.amount?.value==="unbounded"?["amount"]:[],c=new Map(Me(e).map(p=>[p.path,Array.isArray(p.value)?p.value.length:Object.keys(p.value).length])),l=[...s.entries()].flatMap(([p,_])=>{let g=c.get(p);if(g>=_.rows)return[];let b=_.baseOffset+g;return[{path:p,cursor:Mn({command:t.command,path:p,offset:b,total_rows:_.totalRows,fingerprint:_.fingerprint}),retained_rows:g,remaining_rows:_.totalRows-b,total_rows:_.totalRows}]}),d=l[0],f=d?"; page --output-cursor":"",u=n.source==="session"?`Truncated by the remaining ${n.tokens}-token session budget; start a new output session with a larger token_budget${f}.`:`${n.tokens}-token: raise --output-budget${f}`;r.migration_hints=[u,...t.migration_hints];let m=xn({effective_budget_tokens:n.tokens,measured_result_tokens:i});d&&!o&&(typeof e.next_cursor!="string"||e.continuation_kind==="output_cursor")&&(e.next_cursor=d.cursor),e.continuation_kind=o?"producer_cursor":d?"output_cursor":"none",e.output_budget_truncation={reason:"output_budget_reached",budget_source:n.source,budget_tokens:n.tokens,overridden_dimensions:a,compacted_row_paths:r.compacted_row_paths,continuation_cursor_rebased:o,continuation_available:l.length>0,recovery_budget_multiplier:d?1:m.recovery_budget_multiplier,continuations:l,restore_with:d?"recovery":`Retry with --output-budget ${m.output_budget} because no declared row collection can be continued.`,recovery:d?{cursor:d.cursor,cli:"--output-cursor",sdk:"outputCursor",mcp:"outputCursor"}:{cli:`--output-budget ${m.output_budget}`,sdk:{outputBudget:m.output_budget},mcp:{outputBudget:m.output_budget}}}}function A_(e,t,r,n){if(typeof r!="string"||!Array.isArray(e.items))return!1;let o=e.items.length;if(o===0||o>=t)return!1;let i;try{i=Er(r)}catch{return!1}let s=i.after_index;if(s===void 0)return!1;let a=e.items.at(-1);if(Object.prototype.toString.call(a)!=="[object Object]")return!1;let c=Reflect.get(a,"id");if(typeof c!="string"||c.length===0)return!1;let l=n?s-(t-o):s+o;return l<0?!1:(e.next_cursor=Ve(i.fingerprint,c,l,i.snapshot),!0)}function S_(e,t,r,n){let o=new Map(Me(e).map(s=>{let a=Array.isArray(s.value)?s.value.length:Object.keys(s.value).length,c=r?.path===s.path;return[s.path,{rows:a,totalRows:c?r.total_rows:a,baseOffset:c?r.offset:0,fingerprint:c?r.fingerprint:sr(s.path,s.value,t)}]})),i=typeof e.next_cursor=="string";return{collectionsBeforeBudget:o,originalItemCount:Array.isArray(e.items)?e.items.length:0,cursorContinuesExistingPage:i,cursorSource:i?e.next_cursor:n.after}}function T_(e,t,r,n,o,i,s,a,c,l){let d={...t,count_only:r},f=n.command==="assurance"&&Array.isArray(e.assertions)?e.assertions.filter(m=>j(m)&&m.verdict!=="pass").length:0,u=new Map;if(f>0&&u.set("assertions",f),n.command==="history"&&Array.isArray(e.diff))for(let m of nt(e))m.path.startsWith("diff.")&&u.set(m.path,Object.keys(m.value).length);return ya(e,o,i.tokens,u,l,m=>{it(m,d);let p=A_(m,a.originalItemCount,a.cursorSource,a.cursorContinuesExistingPage);if(O_(m,n,o,i,p,c,a.collectionsBeforeBudget),n.command==="history"&&j(m.projection)){m.has_more=typeof m.next_cursor=="string"||m.applied_bound?.kind==="output_limit";let _=m.projection.row_key;typeof _=="string"&&Array.isArray(m[_])&&(m.count=m[_].length)}s!==void 0&&Object.assign(m,ar(m,s,o,l))},n.command==="history"&&Array.isArray(e.diff))}function Js(e,t,r){let n=La(e,t);if(!n)return r;let o=Fa(t),i=ir(t.outputSession??t.output_session),s=t.outputCursor??t.output_cursor,a=typeof s=="string"?$n(s):void 0,c=y_(n),l=h_(n.command,r);if(a===void 0&&k_(n,i,l,o,t))return l;let d=w_(n,i),f=b_(l,n,i,a,t),u=f.projected;$e(u,u,t.outputRowContract===!1);let m={contract_version:1,command:n.command,requested_dimensions:c,...d?.source==="default"?{budget_source:d.source,budget_tokens:d.tokens}:{},precedence:n.precedence,...Ua(n),legacy_aliases_used:n.legacy_aliases_used,migration_hints:n.migration_hints,estimated_tokens:0,within_budget:!0,strings_compacted:!1,rows_compacted:!1,result_omitted:!1};if(u.read_output=m,u=i===void 0?u:ar(u,i,m,o),ae(u,m,o),d!==void 0&&m.estimated_tokens>d.tokens){let p=ga(n.command,t,u);p!==void 0&&(m.applied_depth="brief",m.degradation_reason="output_budget_reached",$e(u,p),u=wn(p,t)),m.estimated_tokens>d.tokens&&(u=T_(u,u,l.count_only===!0,n,m,d,i,f.continuationState,m.estimated_tokens,o))}return d!==void 0&&m.estimated_tokens>d.tokens?v_(n,c,i,d,m.estimated_tokens,o):u}function Tp(e){return j(e)&&j(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function Cp(e,t){let r=t.outputFormat??t.output_format;if(r==="json"||r==="toon")return r;let n=La(e,t)?.encoding;return n?.value==="json"||n?.value==="toon"?n.value:void 0}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ddc50fa6-a983-5d61-bc06-673c9b4a483e")}catch{}})();var I_=4096,R_=Object.freeze(["queue_draining","queue_entries","queue_exists","queue_high_retry_entries","queue_invalid_rows","queue_max_attempts","queue_rows_total","queue_size_bytes","pending_otel_spans","last_attempted_flush_at","last_failed_flush_at","last_otel_attempt_at","last_otel_failure_at","last_otel_success_at","last_successful_flush_at"]),Ta=Object.freeze({health:Object.freeze({version:3,paths:Object.freeze(["checks"]),ignored_detail_field_names_by_row:Object.freeze({telemetry:R_}),guarantee:"nonvolatile_snapshot_and_stable_configuration"})});function ut(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function dt(e){return Array.isArray(e)?e.map(dt):ut(e)?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,dt(r)])):e}function za(e,t){if(!ut(e))return dt(e);let r=typeof e.name=="string"?e.name:void 0,n=r!==void 0&&Object.hasOwn(t.ignored_detail_field_names_by_row,r)?t.ignored_detail_field_names_by_row[r]:void 0;return Object.fromEntries(Object.entries(e).map(([o,i])=>o!=="details"||!n||!ut(i)?[o,dt(i)]:[o,Object.fromEntries(Object.entries(i).filter(([s])=>!n.includes(s)).map(([s,a])=>[s,dt(a)]))]))}function x_(e,t){return Array.isArray(e)?e.map(r=>za(r,t)):za(e,t)}function sr(e,t,r){let n=r?Ta[r]:void 0,o=n?.paths.includes(e)===!0;return C_("sha256").update(le({path:e,value:o?x_(t,n):t,...o?{fingerprint_policy_version:n.version}:{}})).digest("base64url").slice(0,16)}function Mn(e){return Buffer.from(JSON.stringify({v:1,c:e.command,p:e.path,o:e.offset,n:e.total_rows,f:e.fingerprint}),"utf8").toString("base64url")}function $n(e){if(e.length>I_)throw new h("The read-output continuation cursor is malformed or unsupported.",y.USAGE,{code:"read_output_cursor_invalid"});let t;try{t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{t=null}if(!ut(t)||t.v!==1||je(String(t.c??""))!==t.c||typeof t.p!="string"||t.p.length===0||!Number.isSafeInteger(t.o)||t.o<0||!Number.isSafeInteger(t.n)||t.n<1||typeof t.f!="string"||t.f.length===0)throw new h("The read-output continuation cursor is malformed or unsupported.",y.USAGE,{code:"read_output_cursor_invalid"});return{version:1,command:t.c,path:t.p,offset:t.o,total_rows:t.n,fingerprint:t.f}}function Ca(e){if(!Array.isArray(e.assertions))return e;let t=r=>!ut(r)||r.verdict==="pass"?4:r.verdict==="retired"?3:r.enforcement==="block"?0:r.enforcement==="warn"?1:2;return{...e,assertions:e.assertions.map((r,n)=>({row:r,index:n})).sort((r,n)=>t(r.row)-t(n.row)||r.index-n.index).map(({row:r})=>r),budget_retention_policy:"verdict_priority"}}function Ia(e,t,r){if(!r)return e;if(r.command!==t)throw new h(`The read-output cursor belongs to ${r.command}, not ${t}.`,y.USAGE,{code:"read_output_cursor_command_mismatch"});let n=Me(e).find(i=>i.path===r.path),o=n?Array.isArray(n.value)?n.value.length:Object.keys(n.value).length:0;if(!n||o!==r.total_rows||r.offset>o||sr(r.path,n.value,t)!==r.fingerprint)throw new h("The read-output continuation no longer matches the declared row collection; restart the bounded read.",y.USAGE,{code:"read_output_cursor_stale"});return ma(e,r.path,r.offset)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e216fd39-09ee-5a04-b0b5-44f518db4f93")}catch{}})();function rk(e){let t=e?.trim()??"";return/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(t)||/^(?:github|gitlab|jira|linear):/iu.test(t)}function nk(e){let t=e?.trim().toLowerCase();return t==="global"||t==="external"}export{B as a,cr as b,lr as c,N_ as d,ft as e,pt as f,_t as g,gt as h,It as i,no as j,hr as k,rl as l,nl as m,k as n,Ba as o,Bn as p,P_ as q,M_ as r,Vn as s,$_ as t,L_ as u,j_ as v,F_ as w,U_ as x,z_ as y,q_ as z,B_ as A,V_ as B,G_ as C,W_ as D,K_ as E,H_ as F,Va as G,Y_ as H,X_ as I,J_ as J,Q_ as K,Z_ as L,eg as M,tg as N,_i as O,Wa as P,Ka as Q,Ha as R,ht as S,Ya as T,sg as U,Fe as V,Ja as W,Qa as X,dr as Y,ag as Z,cg as _,y as $,h as aa,gu as ba,di as ca,ui as da,Ni as ea,Di as fa,ec as ga,tc as ha,ur as ia,pr as ja,_r as ka,gg as la,yg as ma,hg as na,dc as oa,Hn as pa,bg as qa,bo as ra,Sr as sa,wo as ta,_e as ua,Ny as va,Dy as wa,Py as xa,My as ya,$y as za,Tr as Aa,Rr as Ba,Vy as Ca,Gl as Da,Wy as Ea,Ky as Fa,Hy as Ga,Oo as Ha,Ao as Ia,Yy as Ja,Xy as Ka,Jy as La,Qy as Ma,Io as Na,Jl as Oa,xo as Pa,$o as Qa,ah as Ra,Pr as Sa,ld as Ta,ch as Ua,kd as Va,Od as Wa,lh as Xa,dh as Ya,bh as Za,wh as _a,vh as $a,jo as ab,Lo as bb,Eh as cb,kh as db,Oh as eb,Fo as fb,Ah as gb,kt as hb,kg as ib,Mt as jb,jr as kb,Fr as lb,Ur as mb,zr as nb,qr as ob,Br as pb,Wr as qb,si as rb,le as sb,V as tb,Dg as ub,Pg as vb,Uu as wb,qu as xb,Bu as yb,Ju as zb,lw as Ab,dw as Bb,uw as Cb,bc as Db,wc as Eb,vc as Fb,Ec as Gb,gr as Hb,Ag as Ib,kc as Jb,ze as Kb,Ot as Lb,Sg as Mb,Tg as Nb,Cg as Ob,Rg as Pb,vs as Qb,Pc as Rb,Qn as Sb,yr as Tb,Lc as Ub,jc as Vb,St as Wb,eo as Xb,Uc as Yb,Bc as Zb,Ug as _b,zg as $b,Kc as ac,Hc as bc,Yc as cc,Wg as dc,Kg as ec,Xc as fc,Tt as gc,Hg as hc,Yg as ic,Jc as jc,Qc as kc,Zc as lc,ro as mc,Ct as nc,el as oc,Xg as pc,Jg as qc,Qg as rc,Zg as sc,ey as tc,ty as uc,ry as vc,gw as wc,gm as xc,ol as yc,br as zc,al as Ac,cl as Bc,Ew as Cc,Am as Dc,kw as Ec,Ow as Fc,Aw as Gc,Sw as Hc,Tw as Ic,Cw as Jc,Iw as Kc,Rw as Lc,xw as Mc,Nw as Nc,ts as Oc,Dw as Pc,rs as Qc,Pw as Rc,Mw as Sc,$w as Tc,zt as Uc,us as Vc,ms as Wc,fs as Xc,Bw as Yc,_s as Zc,Bt as _c,Jw as $c,Qw as ad,Zw as bd,ws as cd,gy as dd,yy as ed,Ve as fd,Er as gd,kr as hd,hy as id,ml as jd,by as kd,wy as ld,pl as md,Ay as nd,po as od,_l as pd,Ol as qd,Sl as rd,_o as sd,Tl as td,Cl as ud,go as vd,fe as wd,yo as xd,Sy as yd,Ty as zd,bE as Ad,it as Bd,Ta as Cd,sr as Dd,Mn as Ed,$n as Fd,IE as Gd,ke as Hd,Ra as Id,VE as Jd,GE as Kd,e_ as Ld,je as Md,WE as Nd,Fn as Od,s_ as Pd,KE as Qd,La as Rd,wn as Sd,Js as Td,Tp as Ud,Cp as Vd,ov as Wd,Ss as Xd,dv as Yd,mf as Zd,uv as _d,xe as $d,mv as ae,fv as be,zf as ce,qf as de,zs as ee,X as fe,I as ge,Lv as he,Xt as ie,tp as je,jv as ke,Fv as le,rp as me,Uv as ne,zv as oe,qv as pe,Qs as qe,sp as re,Qv as se,cp as te,ea as ue,Zv as ve,ra as we,dp as xe,pp as ye,hp as ze,Sp as Ae,Dp as Be,da as Ce,yE as De,xn as Ee,st as Fe,Dn as Ge,ir as He,wa as Ie,Pn as Je,va as Ke,rk as Le,nk as Me};
|
|
30
|
+
//# sourceMappingURL=chunk-SPN5QTZ3.js.map
|