@unbrained/pm-cli 2026.9.7 → 2026.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/pm-developer/SKILL.md +12 -4
- package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +19 -10
- package/.agents/skills/pm-extensions/SKILL.md +6 -0
- package/.agents/skills/pm-sdk/SKILL.md +11 -2
- package/.agents/skills/pm-user/SKILL.md +5 -0
- package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +95 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +211 -181
- package/dist/cli/after-command-context-usage.js +1 -48
- package/dist/cli/argv-utils.js +1 -40
- package/dist/cli/bootstrap-args.js +1 -9
- package/dist/cli/bundle-integrity.js +2 -110
- package/dist/cli/commander-usage.js +11 -771
- package/dist/cli/commands/activity.js +1 -9
- package/dist/cli/commands/aggregate.js +1 -5
- package/dist/cli/commands/append.js +1 -5
- package/dist/cli/commands/claim.js +1 -5
- package/dist/cli/commands/close-many.js +1 -5
- package/dist/cli/commands/close.js +1 -9
- package/dist/cli/commands/comments.js +1 -5
- package/dist/cli/commands/config.js +1 -9
- package/dist/cli/commands/context.js +1 -9
- package/dist/cli/commands/contracts.js +1 -5
- package/dist/cli/commands/copy.js +1 -9
- package/dist/cli/commands/create.js +1 -9
- package/dist/cli/commands/delete.js +1 -9
- package/dist/cli/commands/deps.js +1 -9
- package/dist/cli/commands/docs.js +1 -9
- package/dist/cli/commands/duplicates.js +1 -9
- package/dist/cli/commands/eval.js +1 -9
- package/dist/cli/commands/extension/describe.js +1 -5
- package/dist/cli/commands/extension/scaffold.js +1 -5
- package/dist/cli/commands/extension/shared.js +1 -5
- package/dist/cli/commands/extension.js +1 -9
- package/dist/cli/commands/files.js +1 -9
- package/dist/cli/commands/focus.js +1 -9
- package/dist/cli/commands/gc.js +1 -9
- package/dist/cli/commands/get.js +1 -9
- package/dist/cli/commands/graph.js +1 -10
- package/dist/cli/commands/health.js +1 -9
- package/dist/cli/commands/history-compact.js +1 -10
- package/dist/cli/commands/history-redact.js +1 -11
- package/dist/cli/commands/history-repair.js +1 -10
- package/dist/cli/commands/history.js +1 -5
- package/dist/cli/commands/index.js +1 -58
- package/dist/cli/commands/init-agent-guidance.js +1 -9
- package/dist/cli/commands/init.js +1 -9
- package/dist/cli/commands/learnings.js +1 -5
- package/dist/cli/commands/lifecycle-transitions.js +1 -5
- package/dist/cli/commands/list.js +1 -9
- package/dist/cli/commands/merge.js +1 -11
- package/dist/cli/commands/next.js +1 -9
- package/dist/cli/commands/notes.js +1 -5
- package/dist/cli/commands/plan.js +1 -9
- package/dist/cli/commands/profile.js +1 -9
- package/dist/cli/commands/restore.js +1 -9
- package/dist/cli/commands/scheduling-shortcuts.js +1 -9
- package/dist/cli/commands/schema.js +1 -10
- package/dist/cli/commands/search.js +1 -9
- package/dist/cli/commands/stats.js +1 -9
- package/dist/cli/commands/telemetry.js +1 -9
- package/dist/cli/commands/test-all.js +1 -9
- package/dist/cli/commands/test-runs.js +1 -9
- package/dist/cli/commands/test.js +1 -9
- package/dist/cli/commands/update-many.js +1 -5
- package/dist/cli/commands/update.js +1 -9
- package/dist/cli/commands/upgrade.js +1 -5
- package/dist/cli/commands/validate.js +1 -15
- package/dist/cli/context-intent-invocation.js +1 -20
- package/dist/cli/description-stdin.js +1 -17
- package/dist/cli/error-guidance.js +1 -1353
- package/dist/cli/extension-command-help.js +5 -636
- package/dist/cli/extension-command-options.js +1 -427
- package/dist/cli/extension-recovery.js +1 -126
- package/dist/cli/help-content.js +2 -1001
- package/dist/cli/help-json-payload.js +4 -570
- package/dist/cli/main.d.ts +4 -0
- package/dist/cli/main.js +5 -2573
- package/dist/cli/migration-gates.js +1 -289
- package/dist/cli/public.js +1 -20
- package/dist/cli/register-annotations.js +1 -270
- package/dist/cli/register-assurance.js +1 -62
- package/dist/cli/register-files-lookup.js +1 -56
- package/dist/cli/register-history-activity.d.ts +8 -0
- package/dist/cli/register-history-activity.js +2 -0
- package/dist/cli/register-history-author.js +1 -38
- package/dist/cli/register-history-maintenance.d.ts +9 -0
- package/dist/cli/register-history-maintenance.js +2 -0
- package/dist/cli/register-list-query.js +10 -943
- package/dist/cli/register-mutation-options.js +1 -9
- package/dist/cli/register-mutation.js +19 -1893
- package/dist/cli/register-operations.js +1 -920
- package/dist/cli/register-setup.js +1 -716
- package/dist/cli/register-structured-mutation.js +1 -196
- package/dist/cli/registration-helpers.js +1 -5
- package/dist/cli/runtime-compatibility-boundary.js +4 -42
- package/dist/cli/schema-registration-helpers.js +1 -73
- package/dist/cli/search-refresh.js +1 -13
- package/dist/cli/stats-analytics-json.js +1 -68
- package/dist/cli/telemetry-flush.js +1 -10
- package/dist/cli-bundle/bundle-manifest.json +164 -156
- package/dist/cli-bundle/chunks/chunk-3BZZA6A3.js +5 -0
- package/dist/cli-bundle/chunks/chunk-AMRDVX36.js +235 -0
- package/dist/cli-bundle/chunks/chunk-DAM4CBBR.js +2202 -0
- package/dist/cli-bundle/chunks/{chunk-WYRZZ5ZE.js → chunk-DEZPZOQ7.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-FLDWYEND.js +77 -0
- package/dist/cli-bundle/chunks/{chunk-NPN5I67J.js → chunk-G5ADGQ2D.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-JAAEYHUA.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-JX4DH4WC.js → chunk-KR3RP4FH.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-LEZOUXG6.js +2 -0
- package/dist/cli-bundle/chunks/chunk-NSAPNEYH.js +2 -0
- package/dist/cli-bundle/chunks/chunk-QOEKOECV.js +29 -0
- package/dist/cli-bundle/chunks/chunk-RHSFOMHU.js +2 -0
- package/dist/cli-bundle/chunks/chunk-XOD2PCB6.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-JT6XF6GE.js → chunk-YVEQ2AMO.js} +4 -4
- package/dist/cli-bundle/chunks/register-list-query-KSK3R63M.js +11 -0
- package/dist/cli-bundle/chunks/register-mutation-IQ5C7U6O.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-I5W3KMGB.js → register-operations-DWVHR2NC.js} +2 -2
- package/dist/cli-bundle/chunks/register-setup-BQ5SVD4B.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-3WRPWLA7.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-7MBUII7U.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-COPBO5HW.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-DUN4IXYN.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LIJIA4TY.js → chunk-EE5QSM4Z.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-HJVARYM3.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-IAUOUGVR.js +177 -0
- package/dist/cli-bundle/focused-chunks/chunk-KOOMJ54F.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MZDXX7JY.js +56 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M6PBRFSH.js → chunk-OPFHFGDD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-QHNETP77.js +9 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3BZEOXLT.js → chunk-RMWES4M6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RXT4P5QH.js +10 -0
- package/dist/cli-bundle/focused-chunks/chunk-SDOL6FM2.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-SQV4AAUC.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PEFABF7E.js → chunk-WE3IUNIW.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-YALOUBWJ.js +2 -0
- package/dist/cli-bundle/main.js +20 -20
- 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 +29 -29
- 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 +42 -42
- 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 +11 -11
- package/dist/cli.js +1 -104
- package/dist/core/checkpoint/checkpoint-gc.js +1 -169
- package/dist/core/checkpoint/mutation-checkpoint.js +2 -133
- package/dist/core/config/nested-settings.js +1 -534
- package/dist/core/config/positional-value.js +1 -109
- package/dist/core/diagnostics/remediation.js +1 -506
- package/dist/core/extensions/activation-summary-markdown.js +2 -145
- package/dist/core/extensions/activation-summary.js +1 -92
- package/dist/core/extensions/activation-transaction.js +1 -46
- package/dist/core/extensions/capability-usage.js +1 -173
- package/dist/core/extensions/command-hook-context.js +1 -13
- package/dist/core/extensions/command-metadata-contract.js +1 -22
- package/dist/core/extensions/command-visibility-tier.js +1 -29
- package/dist/core/extensions/contribution-inventory.js +1 -173
- package/dist/core/extensions/exporter-output-contract.js +1 -66
- package/dist/core/extensions/extension-candidate.js +1 -18
- package/dist/core/extensions/extension-capability-aliases.js +1 -158
- package/dist/core/extensions/extension-hook-runtime.js +1 -699
- package/dist/core/extensions/extension-policy.js +1 -599
- package/dist/core/extensions/extension-registries.js +1 -62
- package/dist/core/extensions/extension-runtime-helpers.js +1 -33
- package/dist/core/extensions/extension-types.js +1 -102
- package/dist/core/extensions/flag-definition-validation.js +1 -52
- package/dist/core/extensions/flag-value-types.js +1 -64
- package/dist/core/extensions/index.js +1 -526
- package/dist/core/extensions/item-field-types.js +1 -39
- package/dist/core/extensions/item-fields.js +1 -261
- package/dist/core/extensions/loader.js +1 -2223
- package/dist/core/extensions/manifest-schema.js +1 -69
- package/dist/core/extensions/module-graph-snapshot.js +1 -33
- package/dist/core/extensions/preflight-ownership.js +1 -41
- package/dist/core/extensions/registration-validation.js +1 -82
- package/dist/core/extensions/registration-values.js +1 -209
- package/dist/core/extensions/reserved-host-flags.js +1 -36
- package/dist/core/extensions/runtime-registrations.js +1 -67
- package/dist/core/extensions/service-ownership.js +1 -19
- package/dist/core/extensions/version-compat.js +1 -216
- package/dist/core/fs/fs-utils.js +2 -158
- package/dist/core/fs/host-environment-errors.js +1 -141
- package/dist/core/fs/index.js +1 -9
- package/dist/core/fs/path-utils.js +1 -17
- package/dist/core/governance/content-fields.js +1 -160
- package/dist/core/governance/issue-codes.js +1 -151
- package/dist/core/governance/metadata-coverage.js +1 -358
- package/dist/core/history/drift-cache.js +3 -72
- package/dist/core/history/drift-scan.js +1 -342
- package/dist/core/history/event-classification.js +1 -109
- package/dist/core/history/event-index.js +8 -784
- package/dist/core/history/history-compact-bulk.js +1 -104
- package/dist/core/history/history-diff.js +1 -158
- package/dist/core/history/history-rewrite.d.ts +6 -1
- package/dist/core/history/history-rewrite.js +1 -107
- package/dist/core/history/history-storage-stats.js +1 -102
- package/dist/core/history/history-stream-policy.js +1 -62
- package/dist/core/history/history.js +2 -617
- package/dist/core/history/identity.js +1 -30
- package/dist/core/history/index.js +1 -9
- package/dist/core/history/projection.js +1 -196
- package/dist/core/history/read.d.ts +9 -0
- package/dist/core/history/read.js +1 -57
- package/dist/core/history/replay.js +2 -439
- package/dist/core/history/version-address.js +1 -32
- package/dist/core/history/workspace-history.js +2 -433
- package/dist/core/io/body-file.js +1 -62
- package/dist/core/io/bulk-ids-input.js +1 -112
- package/dist/core/item/actionability.js +1 -327
- package/dist/core/item/dependency-reference.js +1 -20
- package/dist/core/item/id.js +1 -112
- package/dist/core/item/index.js +1 -12
- package/dist/core/item/item-format-version.js +1 -78
- package/dist/core/item/item-format.js +5 -1473
- package/dist/core/item/item-record.js +1 -23
- package/dist/core/item/item-type-definition.js +1 -133
- package/dist/core/item/parent-reference-policy.js +1 -57
- package/dist/core/item/parse.js +2 -603
- package/dist/core/item/plan-lifecycle.js +1 -19
- package/dist/core/item/priority.js +1 -61
- package/dist/core/item/sprint-release-format.js +1 -38
- package/dist/core/item/status-filter.js +1 -115
- package/dist/core/item/status.js +1 -43
- package/dist/core/item/toon-decode.js +1 -29
- package/dist/core/item/type-registry.js +1 -715
- package/dist/core/item/type-synonyms.js +1 -38
- package/dist/core/lock/index.js +1 -9
- package/dist/core/lock/lock-gc.js +1 -240
- package/dist/core/lock/lock.js +3 -590
- package/dist/core/output/mutation-projection.js +1 -217
- package/dist/core/output/output-control.js +1 -25
- package/dist/core/output/output.js +11 -494
- package/dist/core/output/query-summary.js +1 -58
- package/dist/core/output/tabular.js +1 -77
- package/dist/core/packages/manifest.js +1 -244
- package/dist/core/packages/root.js +1 -84
- package/dist/core/profile/profile-describe.js +1 -83
- package/dist/core/profile/profile-lint.js +1 -415
- package/dist/core/profile/profile-plan.js +0 -0
- package/dist/core/profile/profile-presets.js +1 -370
- package/dist/core/reproducibility/context.js +1 -82
- package/dist/core/schema/fields-file.js +2 -288
- package/dist/core/schema/item-types-file.js +2 -296
- package/dist/core/schema/runtime-field-filters.js +1 -49
- package/dist/core/schema/runtime-field-values.js +1 -313
- package/dist/core/schema/runtime-schema.js +2 -826
- package/dist/core/schema/status-defs-file.js +2 -227
- package/dist/core/schema/status-token.js +1 -31
- package/dist/core/schema/type-inference.js +1 -95
- package/dist/core/schema/type-presets.js +1 -87
- package/dist/core/schema/type-workflows.js +1 -104
- package/dist/core/search/background-refresh.js +2 -286
- package/dist/core/search/bm25.js +1 -146
- package/dist/core/search/cache.js +2 -534
- package/dist/core/search/corpus.js +1 -311
- package/dist/core/search/embedding-batches.js +1 -163
- package/dist/core/search/eval.js +1 -225
- package/dist/core/search/http-client.js +1 -75
- package/dist/core/search/providers.js +1 -242
- package/dist/core/search/relevance.js +1 -244
- package/dist/core/search/semantic-defaults.js +1 -199
- package/dist/core/search/staleness.js +1 -30
- package/dist/core/search/vector-stores.js +2 -664
- package/dist/core/search/vectorization-metadata.js +1 -81
- package/dist/core/sentry/helpers.js +1 -272
- package/dist/core/sentry/instrument.js +1 -387
- package/dist/core/session/session-state.js +1 -260
- package/dist/core/shared/agent-session-context.js +1 -133
- package/dist/core/shared/author.js +1 -1172
- package/dist/core/shared/command-types.js +1 -4
- package/dist/core/shared/conflict-markers.js +1 -31
- package/dist/core/shared/constants.js +1 -405
- package/dist/core/shared/errors.js +1 -20
- package/dist/core/shared/html-entity-decode.js +1 -131
- package/dist/core/shared/index.js +1 -12
- package/dist/core/shared/item-metadata-contract.js +1 -89
- package/dist/core/shared/lazy-module.js +1 -16
- package/dist/core/shared/levenshtein.js +1 -61
- package/dist/core/shared/memo.js +1 -19
- package/dist/core/shared/numeric-parsers.js +1 -20
- package/dist/core/shared/option-alias-visibility.js +1 -67
- package/dist/core/shared/primitives.js +1 -127
- package/dist/core/shared/serial-queue.js +1 -79
- package/dist/core/shared/serialization.js +1 -210
- package/dist/core/shared/split-comma-list.js +1 -30
- package/dist/core/shared/text-normalization.js +1 -38
- package/dist/core/shared/time.js +1 -306
- package/dist/core/store/index.js +1 -12
- package/dist/core/store/item-format-migration.js +1 -125
- package/dist/core/store/item-metadata-cache.js +1 -1116
- package/dist/core/store/item-metadata-query-index.js +9 -394
- package/dist/core/store/item-metadata-read-work.js +1 -43
- package/dist/core/store/item-store.js +1 -693
- package/dist/core/store/paths.d.ts +1 -1
- package/dist/core/store/paths.js +1 -214
- package/dist/core/store/settings-read-cache.js +1 -85
- package/dist/core/store/settings-validator.js +1 -421
- package/dist/core/store/settings.js +3 -1309
- package/dist/core/store/tracker-preflight.js +1 -141
- package/dist/core/telemetry/consent.js +5 -108
- package/dist/core/telemetry/observability.js +1 -246
- package/dist/core/telemetry/runtime.js +4 -1988
- package/dist/core/test/background-runs.js +4 -945
- package/dist/core/test/item-test-run-tracking.js +1 -63
- package/dist/core/test/run-selectors.js +1 -120
- package/dist/core/validate/estimate-defaults.js +1 -89
- package/dist/core/validate/fix-planning.js +1 -189
- package/dist/core/validate/linked-artifact-reference.js +1 -36
- package/dist/core/validate/missing-by-type.js +1 -34
- package/dist/core/validate/missing-link-owners.js +1 -95
- package/dist/core/validate/stale-file-classification.js +1 -82
- package/dist/mcp/http-server.js +5 -448
- package/dist/mcp/legacy-adapter.js +1 -77
- package/dist/mcp/runtime-capabilities.js +1 -200
- package/dist/mcp/server.js +4 -1233
- package/dist/mcp/tool-definitions.js +1 -804
- package/dist/sdk/actionability.js +1 -13
- package/dist/sdk/agent/closed-domain-contracts.js +1 -161
- package/dist/sdk/agent/command-recovery.js +1 -59
- package/dist/sdk/agent/command-suggestions.js +1 -66
- package/dist/sdk/agent/create-option-policy.js +1 -31
- package/dist/sdk/agent/identity-config.js +1 -106
- package/dist/sdk/agent/item-addressing.js +1 -207
- package/dist/sdk/agent/refusal-closure-census.js +1 -151
- package/dist/sdk/agent/refusal-closure.js +1 -133
- package/dist/sdk/agent/refusal-corpus-contracts.js +1 -193
- package/dist/sdk/agent/refusal-reachability.js +1 -593
- package/dist/sdk/agent/subcommand-recovery.js +1 -83
- package/dist/sdk/agent/task-transcript-contracts.js +1 -197
- package/dist/sdk/agent/tracker-preflight-contracts.js +1 -126
- package/dist/sdk/agent-capability-contracts.js +1 -428
- package/dist/sdk/agent-session-context.js +1 -9
- package/dist/sdk/annotations.js +1 -448
- package/dist/sdk/author-attribution.js +1 -468
- package/dist/sdk/authoring.js +1 -20
- package/dist/sdk/cli-bootstrap.js +1 -838
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/agent-output-contracts.js +4 -476
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -79
- package/dist/sdk/cli-contracts/command-aliases.d.ts +4 -0
- package/dist/sdk/cli-contracts/command-aliases.js +1 -107
- package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -151
- package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1081
- package/dist/sdk/cli-contracts/commander-types.js +1 -159
- package/dist/sdk/cli-contracts/completeness.js +1 -393
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -222
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1947
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -347
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -986
- package/dist/sdk/cli-contracts/registration-helpers.js +7 -990
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +5 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -2090
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -324
- package/dist/sdk/cli-contracts/string-lists.js +1 -16
- package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -461
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -2167
- package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1664
- package/dist/sdk/cli-contracts/typed-action-inputs.js +1 -4
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +1 -17
- package/dist/sdk/cli-program.js +1 -49
- package/dist/sdk/command-line.d.ts +2 -5
- package/dist/sdk/command-line.js +1 -78
- package/dist/sdk/comments.js +1 -133
- package/dist/sdk/compile-cache.js +1 -73
- package/dist/sdk/completion.js +157 -837
- package/dist/sdk/compose.js +1 -1090
- package/dist/sdk/config.js +1 -1204
- package/dist/sdk/context/recency.js +1 -33
- package/dist/sdk/context/semantic-session-attribution.js +1 -82
- package/dist/sdk/context/usage-egress.js +1 -29
- package/dist/sdk/context/usage-ledger.js +3 -185
- package/dist/sdk/context-intent-contracts.js +1 -709
- package/dist/sdk/context-intent-runtime.js +1 -115
- package/dist/sdk/context-packing.js +1 -218
- package/dist/sdk/context-relevance.js +1 -503
- package/dist/sdk/context-signal-store.js +2 -426
- package/dist/sdk/context-usage.js +1 -367
- package/dist/sdk/contracts.js +1 -23
- package/dist/sdk/core-governance.js +1 -14
- package/dist/sdk/core.js +1 -14
- package/dist/sdk/corpus-shape.js +1 -401
- package/dist/sdk/define.js +1 -220
- package/dist/sdk/dependencies.js +1 -718
- package/dist/sdk/dependency-flag-validation.js +1 -156
- package/dist/sdk/dependency-provenance.js +1 -135
- package/dist/sdk/docs.js +1 -14
- package/dist/sdk/duplicates.js +1 -40
- package/dist/sdk/environment/agent-environment.js +1 -466
- package/dist/sdk/environment/host-environment-errors.js +1 -8
- package/dist/sdk/environment/project-runtime-compatibility.js +1 -481
- package/dist/sdk/environment/source-context.js +1 -28
- package/dist/sdk/environment/tracker-preflight.js +1 -9
- package/dist/sdk/error-code-catalog.js +1 -153
- package/dist/sdk/error-runtime.js +1 -58
- package/dist/sdk/errors.js +1 -58
- package/dist/sdk/eval.js +1 -190
- package/dist/sdk/extension/author-manifest.js +1 -92
- package/dist/sdk/extension/bundled-catalog.js +1 -332
- package/dist/sdk/extension/concurrency.js +1 -25
- package/dist/sdk/extension/copy-scope.d.ts +2 -0
- package/dist/sdk/extension/copy-scope.js +2 -0
- package/dist/sdk/extension/custom-field-collisions.js +1 -30
- package/dist/sdk/extension/describe.js +3 -189
- package/dist/sdk/extension/doctor.js +1 -606
- package/dist/sdk/extension/install-plan.d.ts +69 -0
- package/dist/sdk/extension/install-plan.js +2 -0
- package/dist/sdk/extension/install-receipts.d.ts +7 -0
- package/dist/sdk/extension/install-receipts.js +2 -0
- package/dist/sdk/extension/install-runtime.js +3 -313
- package/dist/sdk/extension/install-snapshot.js +1 -66
- package/dist/sdk/extension/install-sources.js +5 -1057
- package/dist/sdk/extension/managed-state.js +2 -252
- package/dist/sdk/extension/migrations.js +2 -174
- package/dist/sdk/extension/output-ownership.js +1 -25
- package/dist/sdk/extension/runtime-summary.js +1 -18
- package/dist/sdk/extension/scaffold.js +4 -2308
- package/dist/sdk/extension/shared.js +1 -147
- package/dist/sdk/extension/source-resolution.js +1 -65
- package/dist/sdk/extension/update-check.js +1 -67
- package/dist/sdk/extension-command-context.js +1 -44
- package/dist/sdk/extension-contracts.js +1 -73
- package/dist/sdk/extension.d.ts +7 -2
- package/dist/sdk/extension.js +1 -2196
- package/dist/sdk/files.js +1 -535
- package/dist/sdk/flag-invocation-contracts.d.ts +0 -5
- package/dist/sdk/flag-invocation-contracts.js +1 -344
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -2224
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -2236
- package/dist/sdk/generated-error-code-catalog.js +1 -16
- package/dist/sdk/governance/assurance-action-contracts.js +1 -4
- package/dist/sdk/governance/assurance-action.js +1 -411
- package/dist/sdk/governance/assurance-limits.js +1 -10
- package/dist/sdk/governance/assurance-mutation-error.js +1 -81
- package/dist/sdk/governance/assurance-presets.js +1 -135
- package/dist/sdk/governance/assurance-runtime.js +1 -238
- package/dist/sdk/governance/assurance.js +4 -1182
- package/dist/sdk/governance/boundary-fixtures.js +1 -200
- package/dist/sdk/governance/coverage-assurance.js +1 -60
- package/dist/sdk/governance/defect-recurrence-coverage.js +1 -188
- package/dist/sdk/governance/defect-recurrence-graph.js +1 -120
- package/dist/sdk/governance/defect-recurrence-signals.js +1 -24
- package/dist/sdk/governance/defect-recurrence.js +1 -623
- package/dist/sdk/governance/extension-host-version.js +1 -115
- package/dist/sdk/governance/gc.js +1 -368
- package/dist/sdk/governance/health.js +1 -2367
- package/dist/sdk/governance/hierarchy-validation.js +1 -108
- package/dist/sdk/governance/linked-file-report.js +1 -71
- package/dist/sdk/governance/merge-receipt-history.js +1 -206
- package/dist/sdk/governance/provenance-health.js +1 -282
- package/dist/sdk/governance/reindex.js +4 -761
- package/dist/sdk/governance/stale-work.js +1 -82
- package/dist/sdk/governance/status-role-diagnostics.js +1 -35
- package/dist/sdk/governance/storage-integrity.js +1 -280
- package/dist/sdk/governance/tracked-runtime-cache.js +1 -106
- package/dist/sdk/governance/upgrade.js +2 -327
- package/dist/sdk/governance/validate-history-drift.js +1 -81
- package/dist/sdk/governance/validate-item-reader.js +1 -17
- package/dist/sdk/governance/validate-normalization.js +1 -36
- package/dist/sdk/governance/validate.js +1 -2261
- package/dist/sdk/governance/workspace-position.js +1 -163
- package/dist/sdk/governance.d.ts +1 -0
- package/dist/sdk/governance.js +1 -31
- package/dist/sdk/graph/adapter.js +1 -181
- package/dist/sdk/graph/analytics.js +1 -474
- package/dist/sdk/graph/assembly.js +1 -377
- package/dist/sdk/graph/cache.js +1 -160
- package/dist/sdk/graph/centrality.js +1 -258
- package/dist/sdk/graph/conformance.js +1 -130
- package/dist/sdk/graph/deadline-scheduling.d.ts +90 -0
- package/dist/sdk/graph/deadline-scheduling.js +2 -0
- package/dist/sdk/graph/durable-cache.d.ts +1 -1
- package/dist/sdk/graph/durable-cache.js +1 -361
- package/dist/sdk/graph/governance-contracts.js +1 -34
- package/dist/sdk/graph/governance.d.ts +13 -1
- package/dist/sdk/graph/governance.js +1 -735
- package/dist/sdk/graph/hierarchy-integrity.js +1 -310
- package/dist/sdk/graph/index.d.ts +3 -2
- package/dist/sdk/graph/index.js +1 -26
- package/dist/sdk/graph/lifecycle-coverage.d.ts +32 -0
- package/dist/sdk/graph/lifecycle-coverage.js +2 -0
- package/dist/sdk/graph/mutation-advisory.js +1 -176
- package/dist/sdk/graph/remediation.js +1 -197
- package/dist/sdk/graph/run.d.ts +15 -1
- package/dist/sdk/graph/run.js +1 -768
- package/dist/sdk/graph/scheduling.js +1 -124
- package/dist/sdk/graph/traversal.js +1 -284
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -27
- package/dist/sdk/graph.js +1 -15
- package/dist/sdk/guide-topics.js +1 -707
- package/dist/sdk/guide.js +1 -279
- package/dist/sdk/history/maintenance.d.ts +71 -0
- package/dist/sdk/history/maintenance.js +2 -0
- package/dist/sdk/history/salvage.js +2 -247
- package/dist/sdk/history/subject.d.ts +19 -0
- package/dist/sdk/history/subject.js +2 -0
- package/dist/sdk/history-analytics.js +1 -282
- package/dist/sdk/history-compact.js +1 -527
- package/dist/sdk/history-mcp.js +1 -68
- package/dist/sdk/history-provenance.js +1 -182
- package/dist/sdk/history-read.js +1 -96
- package/dist/sdk/history-redact.d.ts +1 -14
- package/dist/sdk/history-redact.js +1 -643
- package/dist/sdk/history-repair.d.ts +5 -0
- package/dist/sdk/history-repair.js +1 -657
- package/dist/sdk/improvement-ledger-validation.js +1 -62
- package/dist/sdk/improvement-ledger.js +2 -257
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/index.js +1 -183
- package/dist/sdk/init-agent-guidance.js +2 -496
- package/dist/sdk/init.js +2 -820
- package/dist/sdk/invocation-author.js +1 -39
- package/dist/sdk/item-children.js +1 -90
- package/dist/sdk/item-metadata-index.js +1 -15
- package/dist/sdk/item-schedule.js +1 -27
- package/dist/sdk/item-transaction.js +1 -396
- package/dist/sdk/learnings.js +1 -29
- package/dist/sdk/lifecycle/append.js +2 -53
- package/dist/sdk/lifecycle/claim.d.ts +2 -0
- package/dist/sdk/lifecycle/claim.js +1 -242
- package/dist/sdk/lifecycle/close-many.js +1 -438
- package/dist/sdk/lifecycle/close.js +1 -468
- package/dist/sdk/lifecycle/copy.js +1 -212
- package/dist/sdk/lifecycle/create.js +1 -1949
- package/dist/sdk/lifecycle/delete.js +1 -45
- package/dist/sdk/lifecycle/event-validation-messages.js +1 -91
- package/dist/sdk/lifecycle/focus.js +1 -91
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -24
- package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -149
- package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -40
- package/dist/sdk/lifecycle/mcp-actions.d.ts +2 -0
- package/dist/sdk/lifecycle/mcp-actions.js +1 -51
- package/dist/sdk/lifecycle/metadata-normalizers.js +1 -46
- package/dist/sdk/lifecycle/mutation-command-options.js +1 -9
- package/dist/sdk/lifecycle/plan.js +1 -1606
- package/dist/sdk/lifecycle/recurrence-parsers.js +1 -147
- package/dist/sdk/lifecycle/reopen.js +1 -68
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +1 -143
- package/dist/sdk/lifecycle/restore.d.ts +1 -0
- package/dist/sdk/lifecycle/restore.js +1 -330
- package/dist/sdk/lifecycle/shared-unset-fields.js +1 -295
- package/dist/sdk/lifecycle/update-many.js +1 -861
- package/dist/sdk/lifecycle/update.js +1 -2136
- package/dist/sdk/lifecycle-completion.js +1 -92
- package/dist/sdk/lifecycle-policy.js +1 -120
- package/dist/sdk/linked-artifacts.js +1 -530
- package/dist/sdk/mcp/apps.js +4 -133
- package/dist/sdk/mcp/authorization.js +1 -404
- package/dist/sdk/mcp/discovery.js +1 -494
- package/dist/sdk/mcp/interactions.js +1 -336
- package/dist/sdk/mcp/protocol.d.ts +7 -0
- package/dist/sdk/mcp/protocol.js +1 -184
- package/dist/sdk/mcp/skills.js +1 -389
- package/dist/sdk/mcp/subscriptions.js +1 -211
- package/dist/sdk/mcp/tasks.js +2 -430
- package/dist/sdk/mcp/transport.js +1 -260
- package/dist/sdk/merge/abandoned-receipts.js +1 -46
- package/dist/sdk/merge/driver.js +1 -212
- package/dist/sdk/merge/index.js +1 -16
- package/dist/sdk/merge/install.js +3 -561
- package/dist/sdk/merge/receipt-file-boundary.js +1 -46
- package/dist/sdk/merge/receipt-operation.js +1 -96
- package/dist/sdk/merge/receipt-schema.js +1 -397
- package/dist/sdk/merge/receipts.js +4 -525
- package/dist/sdk/merge/reconcile.js +1 -352
- package/dist/sdk/merge/three-way.js +3 -775
- package/dist/sdk/merge.js +1 -10
- package/dist/sdk/mutation-events.js +1 -292
- package/dist/sdk/mutation-guard.js +1 -216
- package/dist/sdk/notes.js +1 -139
- package/dist/sdk/output-contracts.js +1 -172
- package/dist/sdk/output-projection.js +1 -430
- package/dist/sdk/output-token-accounting.js +1 -140
- package/dist/sdk/output.js +1 -64
- package/dist/sdk/ownership-source.js +1 -21
- package/dist/sdk/package-import-adapters.js +1 -442
- package/dist/sdk/package-migrations.js +1 -20
- package/dist/sdk/package-runtime-options.js +1 -80
- package/dist/sdk/pagination.js +1 -162
- package/dist/sdk/profile.js +1 -454
- package/dist/sdk/provenance.js +1 -258
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.js +1 -401
- package/dist/sdk/query/aggregate.d.ts +16 -0
- package/dist/sdk/query/aggregate.js +1 -390
- package/dist/sdk/query/calendar.js +1 -964
- package/dist/sdk/query/complete-list.js +1 -215
- package/dist/sdk/query/context.js +1 -1702
- package/dist/sdk/query/duplicate-candidates.js +1 -70
- package/dist/sdk/query/get.js +1 -450
- package/dist/sdk/query/history.js +1 -186
- package/dist/sdk/query/item-filter-options.js +1 -9
- package/dist/sdk/query/light-metadata.js +1 -18
- package/dist/sdk/query/list-filter-shared.js +1 -81
- package/dist/sdk/query/list.js +1 -1304
- package/dist/sdk/query/multi-value-filters.js +1 -78
- package/dist/sdk/query/next.js +1 -513
- package/dist/sdk/query/parsers.js +1 -44
- package/dist/sdk/query/projection-contracts.js +1 -184
- package/dist/sdk/query/search-contracts.js +1 -230
- package/dist/sdk/query/search-pagination.js +1 -35
- package/dist/sdk/query/search-rendering.js +1 -105
- package/dist/sdk/query/search.js +2 -1987
- package/dist/sdk/query.js +1 -35
- package/dist/sdk/read-output/continuation.js +1 -194
- package/dist/sdk/read-output-budget.js +1 -135
- package/dist/sdk/read-output-contracts.js +1 -1225
- package/dist/sdk/read-output-rows.js +1 -186
- package/dist/sdk/read-output-session.js +1 -208
- package/dist/sdk/relationship-analytics.js +1 -410
- package/dist/sdk/relationship-context.js +1 -284
- package/dist/sdk/relationship-history.js +4 -519
- package/dist/sdk/relationship-kinds/contract.js +1 -22
- package/dist/sdk/relationship-migration.js +1 -77
- package/dist/sdk/relationships.js +1 -579
- package/dist/sdk/reproducibility/process.js +1 -87
- package/dist/sdk/runtime-action-aliases.js +1 -59
- package/dist/sdk/runtime-extended-actions.js +1 -177
- package/dist/sdk/runtime-input.js +1 -614
- package/dist/sdk/runtime-primitives.js +1 -84
- package/dist/sdk/runtime-public-contracts.js +1 -4
- package/dist/sdk/runtime-stats-options.js +1 -38
- package/dist/sdk/runtime.js +1 -1928
- package/dist/sdk/scheduling-shortcuts.js +1 -63
- package/dist/sdk/schema-migration.js +3 -856
- package/dist/sdk/schema.js +1 -1376
- package/dist/sdk/search-refresh-worker.js +1 -18
- package/dist/sdk/similarity-scoring.js +1 -53
- package/dist/sdk/similarity.js +1 -326
- package/dist/sdk/start-task-status.js +1 -14
- package/dist/sdk/stats.js +1 -270
- package/dist/sdk/structured-mutations.js +1 -580
- package/dist/sdk/telemetry-flush.js +1 -13
- package/dist/sdk/telemetry.js +1 -405
- package/dist/sdk/templates.js +2 -292
- package/dist/sdk/test/batch.js +2 -509
- package/dist/sdk/test/entry.js +1 -70
- package/dist/sdk/test/execution.js +6 -2211
- package/dist/sdk/test/linked-command-detection.js +1 -546
- package/dist/sdk/test/measurements.js +1 -91
- package/dist/sdk/test/parsers.js +1 -545
- package/dist/sdk/test/runs.js +1 -193
- package/dist/sdk/test/trust.js +2 -206
- package/dist/sdk/testing.js +4 -1391
- package/dist/sdk/traceability/runtime-files-lookup.js +1 -32
- package/dist/sdk/traceability/source-traceability.js +1 -292
- package/dist/sdk/tracker-root-discovery.js +1 -9
- package/dist/sdk/workspace-contracts-cache.js +1 -28
- package/dist/sdk/workspace-contracts.js +1 -33
- package/dist/sdk/workspace-memory.js +2 -318
- package/dist/sdk/workspace-recipe.js +1 -71
- package/dist/sdk/workspace-snapshot.js +4 -613
- package/dist/sdk/workspace-transaction-gc.js +1 -149
- package/dist/sdk/workspace-transaction.js +2 -363
- package/dist/sdk/workspace.js +3 -127
- package/dist/types/index.js +1 -9
- package/dist/types.js +1 -245
- package/docs/AGENT_GUIDE.md +1 -1
- package/docs/CONTEXT_ALGORITHM_PORTFOLIO.md +167 -0
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +9 -3
- package/docs/EXTENSIONS.md +1 -0
- package/docs/HISTORY_MAINTENANCE.md +125 -0
- package/docs/MCP_2026_07_28_CONFORMANCE.md +20 -10
- package/docs/PACKAGE_EVIDENCE.md +92 -0
- package/docs/PLANNING_MEASUREMENTS.md +183 -0
- package/docs/README.md +3 -0
- package/docs/SCRIPTING.md +21 -0
- package/docs/TESTING.md +23 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +5 -5
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +2 -2
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/finalize-build.mjs +45 -3
- package/dist/cli-bundle/chunks/chunk-AZDFJGH6.js +0 -9
- package/dist/cli-bundle/chunks/chunk-BAX2BYUW.js +0 -2111
- package/dist/cli-bundle/chunks/chunk-CKOL5U7J.js +0 -77
- package/dist/cli-bundle/chunks/chunk-OF76PSDQ.js +0 -5
- package/dist/cli-bundle/chunks/chunk-QUWFABDM.js +0 -232
- package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RWWBOWJ5.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WGAOYSYH.js +0 -40
- package/dist/cli-bundle/chunks/chunk-WI2AYPA7.js +0 -2
- package/dist/cli-bundle/chunks/register-list-query-5JL52D33.js +0 -11
- package/dist/cli-bundle/chunks/register-mutation-ZPG7KMVP.js +0 -20
- package/dist/cli-bundle/chunks/register-setup-H4SVAVX7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-AL5ON6K6.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CHC2IDXA.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-CK6QFAPZ.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-EZR3GHFE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-H2WJWK7L.js +0 -56
- package/dist/cli-bundle/focused-chunks/chunk-NTPY5GSO.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-P5O7MP5Y.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PDMW2E36.js +0 -177
- package/dist/cli-bundle/focused-chunks/chunk-QTVCLMSZ.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-QTZRBUYA.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-SGQST3PQ.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-UKHASMMP.js +0 -10
- package/dist/cli-bundle/focused-chunks/chunk-ZPEKQHOC.js +0 -2
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{$a as on,$b as un,A as Bt,B as Vt,Ia as Jt,M as Qt,N as Yt,Q as Xt,Ta as K,Ua as Zt,Va as en,Wa as tn,Xa as nn,Xb as ln,Ya as rn,a as ke,ab as sn,gb as Ae,hb as Re,ib as Me,jb as Fe,kb as an,lb as cn,m as Gt,n as Wt,ob as dn,pb as Ce,qb as Ie,rb as ie,s as zt,w as $t,y as Kt}from"./chunk-AZDFJGH6.js";import{$d as pt,$e as yt,$i as It,Aj as Ot,Bj as xe,C as m,Di as Mt,E as p,Ei as Ft,F as W,Fc as A,Fe as ht,G as he,He as $,Hh as Et,I as Y,Id as O,J as st,Kd as H,Kj as Ht,Mi as I,Oh as be,Oi as Ct,Ph as St,Qa as j,Qc as we,Qh as xt,R as D,Rg as vt,Sh as J,Te as N,Th as kt,Uh as At,V as at,Vd as mt,Ve as gt,W as ct,Wm as Ut,X as ge,Xd as z,Ya as S,Yc as lt,_a as dt,ab as _e,ad as ut,ak as U,bd as ft,c as it,cb as X,ci as Rt,cj as T,dj as te,ef as _t,ej as ne,fa as ye,ff as wt,gj as Tt,hj as Lt,kj as qt,lf as bt,mk as Nt,ni as Z,qj as Dt,ri as ee,rj as re,sj as Pt,tj as ve,uj as Ee,vj as Se,wj as jt,x as ot}from"./chunk-QUWFABDM.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ab1153b1-2d91-58a5-9b4a-1d9c5f35a54a")}catch{}})();var jr=["status","type","tag","priority","deadlineBefore","deadlineAfter","updatedAfter","updatedBefore","createdAfter","createdBefore","ids","assignee","assigneeFilter","parent","sprint","release"],Or=["filterAcMissing","filterEstimatesMissing","filterResolutionMissing","filterMetadataMissing","filterReviewerMissing","filterRiskMissing","filterConfidenceMissing","filterSprintMissing","filterReleaseMissing","hasNotes","hasLearnings","hasFiles","hasDocs","hasTests","hasComments","hasDeps","hasBody","hasLinkedCommand","noNotes","noLearnings","noFiles","noDocs","noTests","noComments","noDeps","emptyBody","noLinkedCommand"];function Hr(e){return e!=null&&(typeof e!="string"||e.split(",").some(t=>t.trim().length>0))}function Qo(e,t,n={}){let r=n.includePagination!==!1;return[t,...jr.map(o=>e?.[o]),...r?[e?.limit,e?.offset]:[]].some(Hr)||Or.some(o=>e?.[o]===!0)}function fn(e){return{type:e.type,tag:e.tag,priority:e.priority,deadlineBefore:e.deadlineBefore,deadlineAfter:e.deadlineAfter,assignee:e.assignee,assigneeFilter:e.assigneeFilter,parent:e.parent,sprint:e.sprint,release:e.release}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="56486369-9164-58d3-ac34-46d57859f96d")}catch{}})();var mn=["parent","type","priority","status","assignee","tags","sprint","release"];function hn(e,t){let n=Z(e,t,{strict:!0,flagLabel:"--status"});if(!(!n||n.length===0))return n}function gn(e,t=["estimate","estimated_minutes","priority"]){let n=e.sum?.trim(),r=e.avg?.trim(),i=n&&n.length>0?n:void 0,o=r&&r.length>0?r:void 0;if(!i&&!o)return null;if(i&&o&&i!==o)throw new p("Aggregate --sum and --avg must target the same numeric field",m.USAGE);let s=i??o;if(!t.includes(s))throw new p(`Aggregate numeric field "${s}" is not registered. Allowed: ${t.join(", ")}`,m.USAGE);return{field:s,sum:i!==void 0,avg:o!==void 0}}function yn(e){let t=e?.trim()??"status";if(t.length===0)throw new p("--group-by requires at least one field name",m.USAGE);let n=Nt(t);if(n.length===0)throw new p("--group-by requires a comma-separated list of fields",m.USAGE);for(let r of n)if(!mn.includes(r))throw new p(`Aggregate group fields must be one of ${mn.join("|")}; received "${r}"`,m.USAGE);return n}function _n(e){let t=[...new Set(e.map(n=>n.trim().toLowerCase()).filter(n=>n.length>0))].sort((n,r)=>n.localeCompare(r));return t.length===0?null:t.join(",")}function wn(e,t){switch(e){case"parent":return t.parent??null;case"type":return t.type;case"priority":return t.priority;case"status":return t.status;case"assignee":return t.assignee??null;case"tags":return _n(t.tags);case"sprint":return t.sprint??null;case"release":return t.release??null;default:return null}}function bn(e,t){let n=e??null,r=t??null;return n===r?0:n===null?1:r===null?-1:typeof n=="number"&&typeof r=="number"?n-r:String(n).localeCompare(String(r))}function vn(e,t){return e.map(n=>`${n}:${JSON.stringify(t[n]??null)}`).join("|")}var Nr={parent:"(unparented)",type:"(untyped)",priority:"(no priority)",status:"(no status)",assignee:"(unassigned)",tags:"(untagged)",sprint:"(no sprint)",release:"(no release)"};function pn(e,t){return t==null||t===""?Nr[e]:String(t)}function Ur(e,t){return e.length===1?pn(e[0],t[e[0]]):e.map(n=>`${n}=${pn(n,t[n])}`).join(" | ")}function En(e,t,n){for(let r of n){let i=bn(e.group[r],t.group[r]);if(i!==0)return i}return 0}function Sn(e,t){let r=e[t];if(typeof r=="number"&&Number.isFinite(r))return r;if(typeof r=="string"){let i=r.trim();if(i.length===0)return null;let o=Number(i);if(Number.isFinite(o))return o}return null}function xn(e,t){return t<=0?0:Math.round(e/t*1e4)/100}function Te(e,t,n){let r=mt(String(t),n)??t;if(r===n.open_status){e.open_count+=1;return}if(r==="in_progress"||n.active_statuses.has(r)&&r!==n.open_status){e.in_progress_count+=1;return}if(n.terminal_done_statuses.has(r)||r===n.close_status){e.closed_count+=1;return}e.other_count+=1}function Gr(e,t){return{row:{group:e,count:1},numeric_count:t===null?0:1,numeric_sum:t??0,null_count:t===null?1:0,open_count:0,in_progress_count:0,closed_count:0,other_count:0}}function Wr(e,t){if(t===null){e.null_count+=1;return}e.numeric_count+=1,e.numeric_sum+=t}function zr(e){e.accumulator.row.count+=1,e.includeCompletion&&Te(e.accumulator,e.item.status,e.statusRegistry),e.numericAggregation!==null&&Wr(e.accumulator,e.numericValue)}function $r(e,t){let n={};for(let r of e)n[r]=wn(r,t);return n}function Kr(e,t,n,r){let i={...e.row,group_label:Ur(t,e.row.group)};return n&&(i.open=e.open_count,i.in_progress=e.in_progress_count,i.closed=e.closed_count,i.other=e.other_count,i.completion_pct=xn(e.closed_count,e.row.count)),r!==null&&(i.null_count=e.null_count,r.sum&&(i.sum=e.numeric_sum),r.avg&&(i.avg=e.numeric_count===0?null:e.numeric_sum/e.numeric_count)),i}function Br(e){return{group_by:e.groupBy,count:!0,completion:e.includeCompletion,include_unparented:e.includeUnparented,status:e.status?.[0]??null,status_values:e.status,type:e.options.type??null,tag:e.options.tag??null,priority:e.options.priority??null,deadline_before:e.options.deadlineBefore??null,deadline_after:e.options.deadlineAfter??null,assignee:e.options.assignee??null,assignee_filter:e.options.assigneeFilter??null,parent:e.options.parent??null,sprint:e.options.sprint??null,release:e.options.release??null,...e.numericAggregation!==null?{sum:e.options.sum??null,avg:e.options.avg??null,numeric_field:e.numericAggregation.field}:{}}}async function es(e,t){if(e.count===!1)throw new p("Aggregate grouped counts are always enabled; omit count=false.",m.USAGE);let n=S(process.cwd(),t.path),r=await I(n),i=O(r.schema),o=["estimate","estimated_minutes","priority",...H(r.schema).definitions.filter(_=>_.type==="number").map(_=>_.metadata_key)],s=yn(e.groupBy),a=hn(e.status,i),l=gn(e,[...new Set(o)].sort((_,b)=>_.localeCompare(b))),c=e.completion===!0,u=e.includeUnparented===!0,d=await ie(void 0,{...fn(e),status:e.status},t),f=new Map,h=0,y=0;for(let _ of d.items){let b=_,k=$r(s,b);if(s.includes("parent")&&k.parent===null&&!u){h+=1;continue}let M=vn(s,k),pe=f.get(M),E=l===null?null:Sn(b,l.field);if(pe)zr({accumulator:pe,item:b,statusRegistry:i,includeCompletion:c,numericAggregation:l,numericValue:E});else{let v=Gr(k,E);c&&Te(v,b.status,i),f.set(M,v)}y+=1}let w=[...f.values()].map(_=>Kr(_,s,c,l)).sort((_,b)=>En(_,b,s)),g=d.warnings&&d.warnings.length>0?d.warnings:void 0;return{groups:w,count:w.length,totals:{items_considered:d.items.length,items_grouped:y,items_skipped_unparented:h},filters:Br({groupBy:s,includeCompletion:c,includeUnparented:u,status:a,options:e,numericAggregation:l}),now:D(),...g?{warnings:g}:{}}}var ts={buildGroupKey:vn,compareAggregateRows:En,compareNullableGroupValue:bn,completionPct:xn,normalizeTagGroupValue:_n,parseGroupBy:yn,parseNumericAggregation:gn,parseStatus:hn,readNumericAggregateValue:Sn,resolveGroupValue:wn,updateCompletionCounts:Te};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="13e944b0-f049-55e5-8ff8-6335ce888b65")}catch{}})();function Vr(e,t){return t===void 0?e:e.slice(Math.max(0,e.length-t))}function Qr(e,t){return e.map(({entry:n,version:r})=>{let i=new Set,o=Et(n.patch);for(let s of o)i.add(be(s.path)),s.from&&i.add(be(s.from));return{index:r,...t?{version:t.offset===null?null:t.offset+r}:{},ts:n.ts,op:n.op,author:n.author,patch_ops:o.length,changed_fields:[...i].sort((s,a)=>s.localeCompare(a))}})}function Yr(e){if(e[0]?.op!=="history_compact_baseline")return;let t=ke(e,!0);return{offset:t,first_version:t===null?null:t+1,last_version:t===null?null:t+e.length}}async function Xr(e,t){let n=S(process.cwd(),t.path);await T(n);let r=await I(n),i=j(r,A()),o=e.trim()===J,s=o?J:Rt(e,r.id_prefix),a=await te(n,s,r.id_prefix,r.item_format,i.type_to_folder),l=a?.id??s,c=o?kt(n):X(n,l);if(!a&&!await it(c))throw new p(`Item ${e} not found`,m.NOT_FOUND);return a&&await xt({pmRoot:n,settings:r,itemId:a.id,commandLabel:"history"}),{historyPath:c,located:a,resolvedId:l,settings:r}}async function us(e,t,n){let r=ee(t.limit),{historyPath:i,located:o,resolvedId:s,settings:a}=await Xr(e,n),l=await $(i,s),c=Yr(l),u=a.agent_identity.identity_vocabulary,d=$t(a.agent_identity.harness_signals),f=Bt({harness:t.harness,agentInstance:t.agentInstance,provenance:t.provenanceFilter},u,d),h=Jr(l).filter(({entry:v})=>f(v)),y=Vr(h,r),w=y.map(({entry:v})=>v),g=t.compact===!0,_=g?Qr(y,c):void 0,b=t.provenance===!0?y.map(({entry:v,durableVersion:C})=>Kt(v,u,{itemId:s,version:C})):void 0,k=t.provenance===!0?"provenance":g?"compact":"full",M={compact:{compact_history:_},provenance:{provenance_history:b},full:{history:w}}[k],E={id:s,...M,compact:g,projection:{mode:k,row_key:{compact:"compact_history",provenance:"provenance_history",full:"history"}[k]},omission_receipt:yt("history",k),count:w.length,limit:r??null,version_addressing:c,...t.provenanceSummary===!0?{provenance_summary:Vt(h.map(({entry:v})=>v),u,d)}:{}};if((t.diff||t.field!==void 0)&&(E.diff=St(l,{windowStartIndex:Math.max(0,l.length-w.length),field:t.field})),t.verify){let v=o?(await ne(o,{schema:a.schema})).document:void 0;if(E.verification=Gt(l,v),s===J&&E.verification.ok){let C=await At(S(process.cwd(),n.path));E.verification={...E.verification,ok:C.ok,errors:C.ok?E.verification.errors:[...E.verification.errors,"verify_failed:workspace_state_mismatch"],workspace_state_matches_latest:C.ok,workspace_state_mismatches:C.mismatched_documents,workspace_state_missing:C.missing_documents,workspace_state_unreadable:C.unreadable_documents}}}return E}function Jr(e){let t=ke(e,!0);return e.map((n,r)=>({entry:n,version:r+1,durableVersion:t===null?void 0:t+r+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]="4b4d4bb6-8a17-5544-a18c-ad3fc49a759e")}catch{}})();var kn=1e6,An=20;function Rn(e,t,n,r=An){if(!Number.isSafeInteger(r)||r<0)throw new p("Child projection sample limit must be a non-negative integer.",m.USAGE);let i=e.trim().toLowerCase(),o={},s=[],a=0;for(let g of t){if(a+=1,a>kn)throw new p(`Child projection exceeded the ${kn.toLocaleString("en-US")} item safety bound.`,m.GENERIC_FAILURE,{code:"child_projection_item_bound_exceeded",required:"Use an indexed or parent-filtered metadata source.",why:"Unbounded graph scans can exhaust memory in universal project stores.",nextSteps:["Build the derived item index, then retry the parent read."]});s.push(g)}let l=new Map(s.map(g=>[g.id.trim().toLowerCase(),g])),c=Xt(Yt(s,Qt())),u=new Set(c.children_by_parent.get(i)??[]);for(let g of s)g.parent?.trim().toLowerCase()===i&&u.add(g.id.trim().toLowerCase());let d=[...u].map(g=>l.get(g)),f=0;for(let g of d){let _=g.status.trim().toLowerCase();o[_]=(o[_]??0)+1,z(_,n)||(f+=1)}d.sort((g,_)=>g.id.localeCompare(_.id));let h=d.slice(0,r).map(g=>({id:g.id,title:g.title,type:g.type,status:g.status,priority:g.priority})),y=d.length>h.length,w=r===0?An:r;return{count:d.length,active:f,by_status:Object.fromEntries(Object.entries(o).sort(([g],[_])=>g.localeCompare(_))),sample:h,sample_limit:r,truncated:y,next_offset:y?h.length:null,continuation:y?`pm list --status all --parent ${e} --offset ${h.length} --limit ${w}`:null,scanned: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]="80981c24-3442-57a2-8c35-e0e00d5425d6")}catch{}})();var Zr=new Set(["event","meeting","reminder"]);function ei(e){return Zr.has(e.type.trim().toLowerCase())||e.deadline!==void 0||(e.reminders?.length??0)>0||(e.events?.length??0)>0}function Le(e){if(!ei(e))return;let t=[...e.events??[]].sort((r,i)=>r.start_at.localeCompare(i.start_at)),n=t[0];return{deadline:e.deadline??null,start_at:n?.start_at??null,end_at:n?.end_at??null,location:n?.location??null,reminders:[...e.reminders??[]],events: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]="88732a1d-ae5a-5dfb-93d6-9659cb6f05c3")}catch{}})();var ni=new Set(["epic","feature","milestone","plan"]),ri=new Set(Object.keys(ot).map(e=>e.toLowerCase()));function De(e){return Object.fromEntries(["comments","notes","learnings","files","tests","docs","reminders","events"].map(n=>[n,e[n]?.length??0]))}function ii(e,t){let n=De(e);return[...t.length>0?["body"]:[],...Object.entries(n).flatMap(([r,i])=>i>0?[r]:[]),...n.files+n.tests+n.docs>0?["linked"]:[],"children",...typeof e.assignee=="string"&&e.assignee.trim().length>0?["claim_state"]:[],...Le(e)?["schedule"]:[]]}function Fn(e){let t=e.trim().toLowerCase();return t.length>0&&(ni.has(t)||!ri.has(t))}function Mn(e){return{ts:e.ts,author:e.author,message:e.message??null}}function oi(e,t){let n=e?.trim(),r=n&&n.length>0?n:null,i=[...t].reverse().find(s=>s.op==="claim"),o=[...t].reverse().find(s=>s.op==="release");return{claimed:r!==null,assignee:r,last_claim:i?Mn(i):null,last_release:o?Mn(o):null}}function si(e){if(e===void 0||e.trim().length===0)return"standard";let t=e.trim().toLowerCase();if(t==="full")return"deep";if(Ae.includes(t))return t;throw new p("Get --depth must be one of brief|standard|deep|full",m.USAGE)}function ai(e,t){let n=De(e);if(t==="deep")return{...e,comments:e.comments??[],notes:e.notes??[],learnings:e.learnings??[],files:e.files??[],tests:e.tests??[],docs:e.docs??[],reminders:e.reminders??[],events:e.events??[],notes_count:n.notes,tests_count:n.tests,collection_counts:n};let{comments:r,notes:i,learnings:o,files:s,tests:a,docs:l,reminders:c,events:u,...d}=e;return{...d,notes_count:e.notes?.length??0,tests_count:e.tests?.length??0,collection_counts:n}}function ci(e){if(e===void 0)return null;let t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new p("Get --fields requires a comma-separated list of field names",m.USAGE);return t}function se(e){return e.startsWith("item.")?e.slice(5):e}function di(e,t,n){if(e===null)return;let r=Re(t),i=new Set(r),o=e.filter(s=>{let a=se(s);return!i.has(s)&&!i.has(a)});if(o.length>0){let s=["get",n,"--fields","id,title,status"];throw new p(`Unknown get --fields value(s): ${o.join(", ")}`,m.USAGE,{code:"unknown_field_projection",examples:["pm get <id> --fields id,title,status,type,updated_at","pm get <id> --fields id,title,claim_state","pm get <id> --fields id,title,body,linked.files"],recovery:{allowed_values:r,suggested_retry:N(s),suggested_retry_args:s}})}}var li=new Set(["comments","notes","learnings","files","tests","test_runs","docs","reminders","events","dependencies","plan_steps","plan_decisions","plan_discoveries","plan_validation"]);function ui(e,t,n){return Object.hasOwn(t,n)?t[n]:e[n]!==void 0?e[n]:li.has(n)?[]:void 0}function fi(e,t){let n=e,r={notes_count:e.notes?.length??0,tests_count:e.tests?.length??0,collection_counts:De(e)},i={id:e.id};for(let o of t){let s=se(o);s==="body"||s==="linked"||s.startsWith("linked.")||s==="claim_state"||s.startsWith("claim_state.")||s==="children"||s.startsWith("children.")||s==="schedule"||s.startsWith("schedule.")||(i[s]=ui(n,r,s))}return i}function B(e,t){return e?.some(n=>n===t||n===`item.${t}`)??!1}function oe(e,t){return e.some(n=>{let r=se(n);return r===t||r.startsWith(`${t}.`)})}function mi(e,t){if(e.full&&(e.fields!==void 0||e.depth!==void 0))throw new p("Get projection options are mutually exclusive; remove the extra projection flag and retry.",m.USAGE,{code:"projection_options_mutually_exclusive",recovery:{suggested_retry:N(["get",t,"--full"]),suggested_retry_args:["get",t,"--full"]}});if(e.tree!==!0&&e.treeDepth!==void 0)throw new p("Get --tree-depth requires --tree",m.USAGE);if(e.at!==void 0&&e.tree===!0)throw new p("Get --at cannot be combined with --tree because workspace-level historical projections are not yet indexed.",m.USAGE);return{depth:e.full?"deep":si(e.depth),treeDepth:e.tree===!0?zt(e.treeDepth,"--tree-depth"):void 0,fields:ci(e.fields),fieldProjection:e.fields!==void 0}}async function pi(e,t,n){let r=S(process.cwd(),t.path);await T(r);let i=await I(r),o=j(i,A());if(n!==void 0){let l=await Wt(e,n,{pmRoot:t.path});return{pmRoot:r,settings:i,typeToFolder:o.type_to_folder,locatedId:l.document.metadata.id,metadata:l.document.metadata,body:l.document.body,historical:l}}let s=await te(r,e,i.id_prefix,i.item_format,o.type_to_folder);if(!s)throw await qt(r,e,i.id_prefix,o.type_to_folder);let a=await ne(s,{schema:i.schema});return{pmRoot:r,settings:i,typeToFolder:o.type_to_folder,locatedId:s.id,metadata:a.document.metadata,body:a.document.body}}function hi(e,t,n,r){let i=H(t.schema).definitions.map(o=>o.metadata_key);if(di(e,i,r),n&&oe(e??[],"children"))throw new p("Get --at cannot project children because workspace-level historical relationships are not yet indexed.",m.USAGE)}function qe(e){let{fieldProjection:t,depth:n,fields:r,field:i}=e;return t?i==="body"||i==="linked"?B(r,i):oe(r,i):n!=="brief"}async function gi(e,t){if(!t)return;let n=X(e.pmRoot,e.locatedId),r=await $(n,e.locatedId);return oi(e.metadata.assignee,e.historical?r.slice(0,e.historical.target.historyIndex+1):r)}function yi(e,t,n,r){let i=r||B(n,"linked.files"),o=r||B(n,"linked.tests"),s=r||B(n,"linked.docs");!r&&!i&&!o&&!s||(e.linked={files:i?t.metadata.files??[]:[],tests:o?t.metadata.tests??[]:[],docs:s?t.metadata.docs??[]:[]})}async function _i(e,t){if(!t)return;let n=O(e.settings.schema),r=await Lt(e.pmRoot,e.settings.item_format,e.typeToFolder,void 0,e.settings.schema);return Rn(e.locatedId,r,n)}function wi(e,t,n,r){if(!r)return;let i=Le(t.metadata);if(i){if(n===null||B(n,"schedule")){e.schedule=i;return}e.schedule=Object.fromEntries(Object.entries(i).filter(([o])=>n.some(s=>se(s)===`schedule.${o}`)))}}async function bi(e,t,n,r){if(t.tree!==!0)return;let i=await ie(void 0,{parent:e.locatedId,tree:!0,treeDepth:n===void 0?void 0:String(n),full:!0},r);return{root_id:e.locatedId,root_title:e.metadata.title,depth_limit:n??null,count:i.count,items:i.items.map(o=>o)}}async function Ls(e,t,n={}){let r=mi(n,e),i=await pi(e,t,n.at);hi(r.fields,i.settings,i.historical!==void 0,i.locatedId);let o=qe({...r,field:"body"}),s=qe({...r,field:"linked"}),a=qe({...r,field:"claim_state"}),l=i.historical===void 0&&(r.fieldProjection?oe(r.fields,"children"):r.depth==="deep"&&Fn(i.metadata.type)),c=r.fieldProjection?oe(r.fields,"schedule"):r.depth!=="brief",u=await gi(i,a),d={item:r.fieldProjection?fi(i.metadata,r.fields):ai(i.metadata,r.depth)};o&&(d.item.body=i.body),yi(d,i,r.fields,s),u&&(d.claim_state=u),wi(d,i,r.fields,c);let f=await _i(i,l);f!==void 0&&(d.children=f);let h=await bi(i,n,r.treeDepth,t);if(h!==void 0&&(d.tree=h),i.historical&&(d.reconstructed=!0,d.as_of_version=i.historical.as_of_version,d.as_of_timestamp=i.historical.as_of_timestamp),i.historical===void 0)try{await vt({pmRoot:i.pmRoot,author:ht(void 0,i.settings.author_default),itemIds:[i.locatedId],intent:"get"})}catch{}return gt(d,ii(i.metadata,i.body)),d}var qs={shouldAutoIncludeGetChildren:Fn};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="70e06a73-6602-5384-a25b-fd3df5f6438e")}catch{}})();var In=10,L="https://schema.unbrained.dev/pm/eval-query-set/v1",vi={schema:L,accepted_top_level:["array","object"],required_query_fields:["query","relevant_ids"],optional_fields:["mode","description"],modes:["keyword","semantic","hybrid"]},ae={schema:L,queries:[{query:"offline search",relevant_ids:["pm-75k9"],mode:"keyword"}]},x=class extends Error{constructor(t){super(t),this.name="EvalQuerySetError"}},Ei=new Set(["keyword","semantic","hybrid"]);function Cn(e,t){let n=0,r=Math.min(t,e.length);for(let i=0;i<r;i+=1)n+=e[i]/Math.log2(i+2);return n}function Si(e,t,n){if(t.size===0)return 0;let r=e.map(a=>t.has(a)?1:0),i=Cn(r,n),o=Array.from({length:t.size},()=>1),s=Cn(o,n);return s===0?0:i/s}function xi(e,t,n){let r=Math.min(n,e.length);for(let i=0;i<r;i+=1)if(t.has(e[i]))return 1/(i+1);return 0}function Pe(e,t,n){let r=Math.min(n,e.length),i=0;for(let o=0;o<r;o+=1)t.has(e[o])&&(i+=1);return i}function ki(e,t,n){return n<=0?0:Pe(e,t,n)/n}function Ai(e,t,n){return t.size===0?0:Pe(e,t,n)/t.size}function Tn(e,t,n){return{ndcg:Si(e,t,n),mrr:xi(e,t,n),precision:ki(e,t,n),recall:Ai(e,t,n),relevant_total:t.size,retrieved_relevant:Pe(e,t,n)}}function Ln(e){let t=e.length;if(t===0)return{ndcg:0,mrr:0,precision:0,recall:0,query_count:0};let n=e.reduce((r,i)=>({ndcg:r.ndcg+i.ndcg,mrr:r.mrr+i.mrr,precision:r.precision+i.precision,recall:r.recall+i.recall}),{ndcg:0,mrr:0,precision:0,recall:0});return{ndcg:n.ndcg/t,mrr:n.mrr/t,precision:n.precision/t,recall:n.recall/t,query_count:t}}function Ri(e,t){if(typeof e!="object"||e===null)throw new x(`Eval query at index ${t} must be an object`);let n=e,r=typeof n.query=="string"?n.query.trim():"";if(r.length===0)throw new x(`Eval query at index ${t} must have a non-empty "query" string`);if(!Array.isArray(n.relevant_ids))throw new x(`Eval query at index ${t} must have a "relevant_ids" array`);if(n.relevant_ids.some(o=>typeof o!="string"))throw new x(`Eval query at index ${t} must have a "relevant_ids" array of strings`);let i=[...new Set(n.relevant_ids.map(o=>o.trim()).filter(o=>o.length>0))];if(i.length===0)throw new x(`Eval query at index ${t} must list at least one relevant id`);if(n.mode!==void 0&&(typeof n.mode!="string"||!Ei.has(n.mode)))throw new x(`Eval query at index ${t} has an invalid mode (expected keyword|semantic|hybrid)`);return{query:r,relevant_ids:i,...n.mode!==void 0?{mode:n.mode}:{},...typeof n.description=="string"&&n.description.trim().length>0?{description:n.description.trim()}:{}}}function je(e){let t=typeof e=="object"&&e!==null&&!Array.isArray(e)?e.schema:void 0;if(t!==void 0&&t!==L)throw new x(`Unsupported eval query set schema; expected "${L}"`);let n=Array.isArray(e)?e:typeof e=="object"&&e!==null?e.queries:void 0;if(!Array.isArray(n))throw new x('Eval query set must be an array of queries or an object with a "queries" array');if(n.length===0)throw new x("Eval query set must contain at least one query");return{schema:L,queries:n.map((r,i)=>Ri(r,i))}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b0abcc02-bd6e-536a-b876-e13cfc8ea741")}catch{}})();function qn(e){if(typeof e!="string")return!1;let t=e.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return t.length===1&&t[0]==="all"}var Mi=[{optionKey:"status",summaryKey:"status",normalize:e=>qn(e)?"all":e},{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"},{optionKey:"parent",summaryKey:"parent"}];function V(e){let{mode:t,matchMode:n,options:r,includeLinked:i,titleExact:o,phraseExact:s,scoreThreshold:a,hybridSemanticWeight:l,runtimeFieldFilters:c}=e,u={};return dn(u,r,Mi),Object.assign(u,Ie(r)),Object.assign(u,Ce(r)),n!==void 0&&n!=="or"&&(u.match_mode=n),i&&(u.include_linked=!0),o&&(u.title_exact=!0),s&&(u.phrase_exact=!0),a>0&&(u.score_threshold=a),t==="hybrid"&&r.semanticWeight!==void 0&&(u.hybrid_semantic_weight=l),r.limit!==void 0&&(u.limit=r.limit),c&&Object.keys(c).length>0&&(u.runtime_filters=c),u}function Q(e){let{effectiveMode:t,matchMode:n,options:r,includeLinked:i,titleExact:o,phraseExact:s,scoreThreshold:a,hybridSemanticWeight:l,queryExpansion:c,rerank:u,runtimeFieldFilters:d}=e,f=h=>h??null;return{mode:t,match_mode:n,status:r.status===void 0||qn(r.status)?"all":r.status,type:f(r.type),tag:f(r.tag),priority:f(r.priority),deadline_before:f(r.deadlineBefore),deadline_after:f(r.deadlineAfter),updated_after:f(r.updatedAfter),updated_before:f(r.updatedBefore),created_after:f(r.createdAfter),created_before:f(r.createdBefore),assignee:f(r.assignee),sprint:f(r.sprint),release:f(r.release),parent:f(r.parent),...Ie(r),...Ce(r),include_linked:i,title_exact:o,phrase_exact:s,score_threshold:a,hybrid_semantic_weight:t==="hybrid"?l:null,query_expansion_enabled:c.enabled,query_expansion_provider:c.provider,rerank_enabled:u.enabled,rerank_model:u.model,rerank_top_k:u.top_k,limit:f(r.limit),runtime_filters: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]="0fc9ed92-daf5-5fa2-b9a4-ee6c36256ed1")}catch{}})();function Fi(e){return wt("search",{query:e.query.trim(),mode:e.mode,options:_t(e.searchOptions,Ut)})}function Dn(e){let t=bt(e.sorted,{cursor:e.searchOptions.after,fingerprint:Fi(e),limit:e.limit,readId:n=>n.item.id});return{limited:t.rows,pageExtras:{applied_limit:e.limit,...t.has_more?{has_more:!0,truncated:!0}:{},...t.next_cursor?{next_cursor:t.next_cursor}:{}}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d20ab01b-a8ae-5fe8-988a-d05fe87951f6")}catch{}})();function Pn(e){if(e===void 0)return"keyword";let t=e.trim().toLowerCase();if(t!=="keyword"&&t!=="semantic"&&t!=="hybrid")throw new p("Search mode must be one of keyword|semantic|hybrid",m.USAGE);return t}function ce(e){return e===!0}function jn(e){return st(e,0,1)??void 0}function On(e){if(e===void 0)return"or";let t=e.trim().toLowerCase();if(t!=="and"&&t!=="or"&&t!=="exact")throw new p("Search --match-mode must be one of and|or|exact",m.USAGE);return t}function Hn(e){if(e==null||e==="")return;let t=typeof e=="number"?e:Number(String(e).trim());if(!Number.isFinite(t)||t<0)throw new p("Search --min-score must be a finite number >= 0",m.USAGE);return t}function G(e,t){if(e==null)return;let n=String(e).trim();if(n.length!==0)return ge(n,new Date,t)}function F(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function Oe(e,t){if(e!==void 0)return ge(e,new Date,t)}function Ci(e){if(e===void 0)return;let t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new p("Search --fields requires a comma-separated list of field names",m.USAGE);return[...new Set(t)]}function He(e,t="<query>"){let n=e.compact===!0,r=e.full===!0,i=Ci(e.fields);if(Number(n)+Number(r)+ +(i!==void 0)>1)throw new p("Search projection options are mutually exclusive. Use one of --compact, --full, or --fields.",m.USAGE,{code:"projection_options_mutually_exclusive",recovery:{suggested_retry:N(["search",t,"--full"]),suggested_retry_args:["search",t,"--full"]}});return n?{mode:"compact",fields:[...Me]}:r?{mode:"full",fields:[]}:i?{mode:"fields",fields:i}:{mode:"full",fields:[]}}function Ne(e,t,n="<query>"){if(e.mode!=="fields")return;let r=Fe(t.definitions.flatMap(s=>[s.key,s.metadata_key])),i=new Set(r),o=e.fields.filter(s=>{let a=s.trim();return!i.has(a)});if(o.length>0){let s=["search",n,"--fields","id,title,status,score"];throw new p(`Unknown search --fields value(s): ${o.join(", ")}`,m.USAGE,{code:"unknown_field_projection",examples:["pm search <query> --fields id,title,status,score","pm search <query> --fields id,title,item.description,matched_fields"],nextSteps:["Use item.<field> for explicit item metadata fields, or run pm search --help for projection examples."],recovery:{allowed_values:r,suggested_retry:N(s),suggested_retry_args:s}})}}function Ue(e){let t=F(e);if(!t)throw new p("Search query must not be empty",m.USAGE);return t.split(/\s+/u).filter(Boolean)}function Ge(e){let t=e.search?.max_results;return typeof t=="number"&&Number.isFinite(t)&&t>0?Math.floor(t):50}function We(e){let t=e.search?.score_threshold;return typeof t=="number"&&Number.isFinite(t)?t:0}function ze(e){let t=e.search?.hybrid_semantic_weight;return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=1?t:.7}function $e(e){let t={title_exact_bonus:10,title_weight:48,description_weight:5,tags_weight:6,status_weight:2,body_weight:1,comments_weight:1,notes_weight:1,learnings_weight:1,reminders_weight:2,events_weight:2,dependencies_weight:3,linked_content_weight:1},n=e.search?.tuning;if(!n)return t;let r=(i,o)=>typeof i=="number"&&Number.isFinite(i)&&i>=0?i:o;return{title_exact_bonus:r(n.title_exact_bonus,t.title_exact_bonus),title_weight:r(n.title_weight,t.title_weight),description_weight:r(n.description_weight,t.description_weight),tags_weight:r(n.tags_weight,t.tags_weight),status_weight:r(n.status_weight,t.status_weight),body_weight:r(n.body_weight,t.body_weight),comments_weight:r(n.comments_weight,t.comments_weight),notes_weight:r(n.notes_weight,t.notes_weight),learnings_weight:r(n.learnings_weight,t.learnings_weight),reminders_weight:r(n.reminders_weight,t.reminders_weight),events_weight:r(n.events_weight,t.events_weight),dependencies_weight:r(n.dependencies_weight,t.dependencies_weight),linked_content_weight:r(n.linked_content_weight,t.linked_content_weight)}}import le from"node:fs/promises";import Xe 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]="42fde1a1-ee4b-5564-93b2-78d5a0fc7555")}catch{}})();var Ke=4,Ii=20,Ti=200,Li=new Set(["a","an","and","for","from","in","into","of","on","or","the","to","with"]);function Be(e,t){let n=[],r=new Set;for(let i of e){let o=i.trim().replaceAll(/\s+/g," ");if(o.length===0)continue;let s=o.toLowerCase();if(!r.has(s)&&(r.add(s),n.push(o),n.length>=t))break}return n}function qi(e){let t=e.toLowerCase();return t.length>4&&t.endsWith("ies")?`${t.slice(0,-3)}y`:t.length>4&&(t.endsWith("ches")||t.endsWith("shes")||t.endsWith("xes")||t.endsWith("zes")||t.endsWith("sses"))?t.slice(0,-2):t.length>3&&t.endsWith("s")&&!t.endsWith("ss")&&!t.endsWith("us")&&!t.endsWith("is")&&!t.endsWith("as")?t.slice(0,-1):t}function Di(e){let t=e.toLowerCase();return t.length>2&&(!t.endsWith("s")||t.endsWith("ss"))?t.endsWith("y")&&!/[aeiou]y$/u.test(t)?`${t.slice(0,-1)}ies`:t.endsWith("ch")||t.endsWith("sh")||t.endsWith("x")||t.endsWith("z")||t.endsWith("ss")?`${t}es`:`${t}s`:t}function Nn(e,t=Ke){let n=e.trim().replaceAll(/\s+/g," ");if(n.length===0)return[];let r=U(n);if(r.length===0)return[n];let i=r.filter(a=>!Li.has(a.toLowerCase())),o=r.map(a=>qi(a)),s=i.map(a=>Di(a));return Be([n,r.join(" "),i.join(" "),o.join(" "),s.join(" ")],Math.max(1,t))}function Un(e){let t=Array.isArray(e)?e:e?.queries;return Array.isArray(t)?Be(t.filter(n=>typeof n=="string"),Ke):[]}function Gn(e,t,n){return Be([...e,...t],Math.max(1,n))}function Wn(e,t){let r=e.search?.query_expansion,i=W(r?.provider);return{enabled:r?.enabled===!0,provider:i??t,max_queries:Ke}}function zn(e,t){let r=e.search?.rerank,i=W(r?.model),s=Y(r?.top_k)??Ii;return{enabled:r?.enabled===!0,model:i??t,top_k:Math.min(Ti,s)}}function $n(e){let t=Array.isArray(e)?e:e?.hits;if(!Array.isArray(t))return[];let n=new Map;for(let i of t){if(typeof i!="object"||i===null)continue;let o=W(i.id),s=i.score;if(!o||typeof s!="number"||!Number.isFinite(s))continue;let a=n.get(o);(a===void 0||s>a)&&n.set(o,s)}let r=[...n.entries()].map(([i,o])=>({id:i,score:o}));return r.sort((i,o)=>i.score!==o.score?o.score-i.score:i.id.localeCompare(o.id)),r}function Pi(e,t){let n=e.length,r=0;for(let i=0;i<n;i+=1)r+=e[i]*t[i];return r}function Kn(e){let t=0;for(let n=0;n<e.length;n+=1)t+=e[n]*e[n];return Math.sqrt(t)}function ji(e,t,n){if(!e||!t||e.length===0||t.length===0||e.length!==t.length)return 0;let r=Pi(e,t),i=Kn(t),o=n*i;return!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(o)||o===0?0:Math.max(-1,Math.min(1,r/o))}async function Bn(e,t,n,r,i){if(r.length===0)return new Map;let o=W(t)??e.model,s=o===e.model?e:{...e,model:o},a=[n.trim(),...r.map(f=>f.text)],l=await re(s,a,i?{timeout_ms:i}:{}),c=l[0];if(!c)return new Map;let u=Kn(c),d=new Map;for(let f=0;f<r.length;f+=1){let h=r[f],y=l[f+1];if(!y)continue;let w=ji(c,y,u);d.set(h.id,Math.max(0,Math.min(1,(w+1)/2)))}return 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]="3fd6ed70-6633-5886-90a6-3d4cc16b3ef0")}catch{}})();var Oi=1.2,Hi=.75;function Ve(e){return U(e)}function Ni(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return t}function Qn(e){let t=[],n=new Map,r=0;for(let o of e){let s=Ve(o.text),a=Ni(s);r+=s.length;for(let l of a.keys())n.set(l,(n.get(l)??0)+1);t.push({id:o.id,termFrequencies:a,length:s.length})}let i=t.length;return{documents:t,documentFrequency:n,documentCount:i,averageDocumentLength:i>0?r/i:0}}function Ui(e,t){return Math.log(1+(e-t+.5)/(t+.5))}function Yn(e,t,n){let r=new Map;if(e.documentCount===0||e.averageDocumentLength===0)return r;let i=[...new Set(t.filter(s=>s.length>0))];if(i.length===0)return r;let o=new Map;for(let s of i){let a=e.documentFrequency.get(s);a!==void 0&&o.set(s,Ui(e.documentCount,a))}if(o.size===0)return r;for(let s of e.documents){let a=0;for(let[l,c]of o){let u=s.termFrequencies.get(l);if(u===void 0)continue;let d=1-n.b+n.b*s.length/e.averageDocumentLength,f=u+n.k1*d;a+=c*(u*(n.k1+1)/f)}a>0&&r.set(s.id,a)}return r}function Vn(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:Math.min(r,Math.max(n,e))}function Xn(e){let t=n=>typeof n=="string"?[n]:typeof n=="number"?[String(n)]:Array.isArray(n)?n.flatMap(t):typeof n=="object"&&n!==null?Object.values(n).flatMap(t):[];return t(Object.values(e)).join(" ")}function Jn(e){let t=e?.search?.bm25;return{k1:Vn(t?.k1,Oi,0,1e3),b:Vn(t?.b,Hi,0,1)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a4117e19-af3e-50f5-b3cc-86c39aa4b439")}catch{}})();var Gi=2,Wi=120,zi=6,$i=40,Ki=1e3,Bi=900,Vi="\xAB",Qi="\xBB",Zn=60,nr=["tag","status","type","priority"];function rr(e){let t=[],n=e;for(let r=0;r<5&&n&&typeof n=="object";r+=1){let i=n.code;typeof i=="string"&&t.push(i.toLowerCase()),n=n.cause}return t.join(" ")}function ir(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase(),n=rr(e),r=`${t} ${n}`;return r.includes("timed out")||r.includes("timeout")||r.includes("etimedout")?"timeout":r.includes("econnrefused")||r.includes("connection refused")||r.includes("connect ")||r.includes("enotfound")||r.includes("eai_again")||r.includes("econnreset")||r.includes("fetch failed")?"connection":"error"}function or(e,t){let n=ir(t);return`search_${e}_fallback:${n}:using_keyword_mode`}function Yi(e){return e?.commands?.some(n=>n.command.trim()==="reindex")===!0?{command:"pm reindex --mode hybrid",args:["reindex","--mode","hybrid"]}:{command:"pm install search-advanced --project",args:["install","search-advanced","--project"],follow_up_command:"pm reindex --mode hybrid",follow_up_args:["reindex","--mode","hybrid"]}}async function sr(e,t,n){try{let r=await Ht(e);r.warnings.length>0&&n.push(...r.warnings);let i=Jt(t.map(s=>({id:s.metadata.id,updated_at:s.metadata.updated_at})),r.entries);if(i.length===0)return;let o=Yi(A());n.push(...Xi(i.length,o)),process.stderr.write(`[pm] warning: ${i.length} item${i.length===1?" is":"s are"} new or modified since the last reindex and ${i.length===1?"is":"are"} NOT in the semantic index yet \u2014 run '${o.command}'${o.follow_up_command?`, then '${o.follow_up_command}'`:""}. (Write-time embedding is governed by search.mutation_refresh_policy; staleness means the embed was skipped, failed, or the backend was unreachable.)
|
|
2
|
-
`)}catch{}}function Xi(e,t){return[`vector_index_stale:${e}`,`vector_index_recovery:${t.args.join(" ")}`,...t.follow_up_args?[`vector_index_recovery_follow_up:${t.follow_up_args.join(" ")}`]:[]]}var za={applyFilters:fr,applyExactQueryFilters:ur,applyInlineQueryFilters:cr,buildHitHighlights:wr,buildVerboseSearchFilters:Q,buildExplicitSemanticFallbackWarning:or,buildCompactSearchFilterSummary:V,buildHybridLexicalScore:Er,buildRerankCorpus:Ir,buildSemanticHits:Rr,classifyImplicitSemanticFallbackReason:ir,collectErrorCauseCodes:rr,collectExactPhraseFields:dr,collectLinkedPaths:mr,combineHybridHits:tt,computeBuiltInBm25Hits:Fr,computeSemanticOrHybridHits:Tr,resolveBuiltInBm25Mode:Mr,countOccurrences:Ze,dependencyEntries:Je,documentContainsExactPhrase:lr,emptySearchResult:Sr,highlightFieldSnippet:_r,loadDocuments:Lr,markTokenRuns:yr,parseInlineQueryFilters:ar,maybeEmitVectorIndexStaleWarning:sr,loadLinkedCorpus:hr,mergeVectorHitsById:Cr,normalizeExtensionProviderHits:Ar,normalizeScoreMap:Qe,parseProjectionConfig:He,parseTimestampWindow:G,parseTokens:Ue,projectSearchHits:Dr,readSearchFieldValue:qr,requireSemanticDependencies:et,resolveExtensionSearchProvider:xr,resolveExtensionSearchProviderByName:me,resolveExtensionVectorAdapter:kr,resolveLinkedCorpusRoots:pr,scoreDocument:br,sortHits:vr,stringArray:fe,textEntries:P,validateSearchProjectionFields:Ne};function ar(e){let t={},n=[];for(let r of e.split(/\s+/).filter(i=>i.length>0)){let i=r.indexOf(":"),o=i>0?r.slice(0,i).toLowerCase():"",s=i>0?r.slice(i+1):"",a=nr.includes(o)?o:void 0;if(a&&s.length>0&&t[a]===void 0){t[a]=s;continue}n.push(r)}return{residualQuery:n.join(" "),inlineFilters:t}}function cr(e,t,n){let r={...e};for(let i of nr){let o=t[i];if(o!==void 0){if(he(r[i])!==void 0){n.push(`search_inline_filter_ignored:${i}:flag_takes_precedence`);continue}r[i]=o}}return r}function fe(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function P(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t!==null&&typeof t.text=="string"):[]}function Je(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t!==null&&typeof t.id=="string"&&typeof t.kind=="string"):[]}function dr(e){let t=e.metadata;return[t.title,t.description,t.status,fe(t.tags).join(" "),e.body,P(t.comments).map(n=>n.text).join(" "),P(t.notes).map(n=>n.text).join(" "),P(t.learnings).map(n=>n.text).join(" "),ve(t).join(" "),Ee(t).join(" "),Je(t.dependencies).map(n=>`${n.id} ${n.kind}`).join(" "),Se(t)]}function lr(e,t){return dr(e).some(n=>F(n).includes(t))}function ur(e,t,n){return!n.titleExact&&!n.phraseExact?e:e.filter(r=>!(n.titleExact&&F(r.metadata.title)!==t||n.phraseExact&&!lr(r,t)))}function Ji(e){if(e&&[...e].some(t=>t.toLowerCase()==="none"||t.toLowerCase()==="null"))throw new p('--assignee no longer accepts "none" or "null".',m.USAGE)}function Zi(e,t,n){let r=K(e.assignee,{label:"--assignee"});Ji(r);let i=an(e),o=cn(e);return{typeFilter:Zt(e.type,t),tagFilter:K(e.tag,{label:"--tag",normalize:s=>s.toLowerCase()}),priorityFilter:en(e.priority),deadlineBefore:Oe(e.deadlineBefore,"deadline-before"),deadlineAfter:Oe(e.deadlineAfter,"deadline-after"),updatedAfter:G(e.updatedAfter,"updated-after"),updatedBefore:G(e.updatedBefore,"updated-before"),createdAfter:G(e.createdAfter,"created-after"),createdBefore:G(e.createdBefore,"created-before"),assigneeFilter:r,sprintFilter:K(e.sprint,{label:"--sprint"}),releaseFilter:K(e.release,{label:"--release"}),parentFilter:e.parent?.trim(),statusSet:n&&n.length>0?new Set(n):void 0,missingMetadataFilters:i,missingMetadataActive:nn(i),contentFieldFilters:o,contentFiltersActive:on(o)}}function eo(e,t){return to(e,t)&&no(e,t)&&ro(e,t)}function to(e,t){if(t.statusSet&&!t.statusSet.has(e.status)||t.typeFilter&&!t.typeFilter.has(e.type))return!1;let n=t.tagFilter;return!(n&&!fe(e.tags).some(r=>n.has(r))||t.priorityFilter!==void 0&&!t.priorityFilter.has(e.priority))}function no(e,t){return ct(e,t)}function ro(e,t){return!(t.assigneeFilter!==void 0&&(e.assignee===void 0||!t.assigneeFilter.has(e.assignee))||t.sprintFilter!==void 0&&(e.sprint===void 0||!t.sprintFilter.has(e.sprint))||t.releaseFilter!==void 0&&(e.release===void 0||!t.releaseFilter.has(e.release))||t.parentFilter!==void 0&&e.parent!==t.parentFilter)}function io(e,t,n,r){let i=e.metadata;return!(!eo(i,t)||!Ft(i,n)||t.missingMetadataActive&&!rn(i,t.missingMetadataFilters,r)||t.contentFiltersActive&&!sn(i,t.contentFieldFilters))}function fr(e,t,n,r,i,o){let s=Zi(t,n,i);return e.filter(a=>io(a,s,r,o))}function Ze(e,t){let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i<0)return n;n+=1,r=i+t.length}}function oo(e){return U(e)}function mr(e){let t=(e.files??[]).map(s=>({scope:s.scope,path:s.path.trim()})),n=(e.docs??[]).map(s=>({scope:s.scope,path:s.path.trim()})),r=(e.tests??[]).filter(s=>typeof s.path=="string"&&s.path.trim().length>0).map(s=>({scope:s.scope,path:s.path.trim()})),i=[...t,...n,...r].filter(s=>s.path.length>0).sort((s,a)=>s.scope.localeCompare(a.scope)||s.path.localeCompare(a.path)),o=new Map;for(let s of i)o.set(`${s.scope}:${s.path}`,s);return[...o.values()]}async function er(e){let t=Xe.resolve(e);try{let n=await le.realpath(t);return{resolved:t,realpath:n}}catch{return null}}async function pr(e,t){let[n,r]=await Promise.all([er(e),er(t)]);return{projectContainmentRoot:n,globalContainmentRoot:r}}async function hr(e,t){let n=mr(e.metadata),r=[];for(let i of n){let o=i.scope==="global"?t.globalContainmentRoot:t.projectContainmentRoot;if(!o)continue;let s=Xe.resolve(o.resolved,i.path);if(!ye(o.resolved,s))continue;let a;try{a=await le.realpath(s)}catch{continue}if(ye(o.realpath,a))try{await we({path:s,scope:i.scope}),r.push(await le.readFile(s,"utf8"))}catch{}}return r.join(`
|
|
3
|
-
`)}var gr=[{name:"title",weightKey:"title_weight",value:e=>e.metadata.title},{name:"description",weightKey:"description_weight",value:e=>e.metadata.description},{name:"tags",weightKey:"tags_weight",value:e=>fe(e.metadata.tags).join(" ")},{name:"status",weightKey:"status_weight",value:e=>typeof e.metadata.status=="string"?e.metadata.status:""},{name:"body",weightKey:"body_weight",value:e=>e.body},{name:"comments",weightKey:"comments_weight",value:e=>P(e.metadata.comments).map(t=>t.text).join(" ")},{name:"notes",weightKey:"notes_weight",value:e=>P(e.metadata.notes).map(t=>t.text).join(" ")},{name:"learnings",weightKey:"learnings_weight",value:e=>P(e.metadata.learnings).map(t=>t.text).join(" ")},{name:"reminders",weightKey:"reminders_weight",value:e=>ve(e.metadata).join(" ")},{name:"events",weightKey:"events_weight",value:e=>Ee(e.metadata).join(" ")},{name:"dependencies",weightKey:"dependencies_weight",value:e=>Je(e.metadata.dependencies).map(t=>`${t.id} ${t.kind}`).join(" ")},{name:"plan",weightKey:"body_weight",value:e=>Se(e.metadata)}],so=new Map(gr.map(e=>[e.name,e]));function ao(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yr(e,t){let n=t.filter(i=>i.length>0).sort((i,o)=>o.length-i.length).map(ao);if(n.length===0)return e;let r=new RegExp(n.join("|"),"gi");return e.replace(r,i=>`${Vi}${i}${Qi}`)}function _r(e,t){if(e.length===0)return null;let n=e.toLowerCase(),r=-1,i=0;for(let u of t){if(u.length===0)continue;let d=n.indexOf(u);d>=0&&(r<0||d<r)&&(r=d,i=u.length)}if(r<0)return null;let o=Math.max(0,r-Zn),s=Math.min(e.length,r+i+Zn),a=yr(e.slice(o,s),t),l=o>0?"\u2026":"",c=s<e.length?"\u2026":"";return`${l}${a}${c}`}function wr(e,t,n){let r=[];for(let i of t){let o=so.get(i);if(o===void 0)continue;let s=_r(o.value(e),n);s!==null&&r.push({field:i,snippet:s})}return r}function co(e,t,n){return[...gr.map(r=>({name:r.name,value:r.value(e),weight:n[r.weightKey]})),{name:"linked_content",value:t,weight:n.linked_content_weight}]}function lo(e,t,n){let r=F(e.id),i=typeof n=="string"?n.trim().toLowerCase():"",o=F(i),s=o.length>0&&r.startsWith(o)?r.slice(o.length).trim():r;return t!==r&&t!==s?null:{item:e,score:t===r?Ki:Bi,matched_fields:["id"],matched_all_terms:!0,exact_id_match:!0}}function uo(e,t,n,r,i){for(let o of e){let s=t.get(o)??0;s>0&&(i.score+=s*r.title_exact_bonus,i.matched.add("title"),i.matchedTokens.add(o));for(let a of n){let l=Ze(a.value.toLowerCase(),o);l>0&&(i.score+=l*a.weight,i.matched.add(a.name),i.matchedTokens.add(o))}}}function fo(e,t,n,r){F(e.title)===t&&(r.score+=Wi,r.matched.add("title"));for(let o of n){let s=Ze(F(o.value),t);s>0&&(r.score+=s*o.weight*zi,r.matched.add(o.name))}}function br(e,t,n,r,i,o,s=!1){let a=e.metadata,l=lo(a,n,o);if(l)return l;let c=new Map;for(let w of oo(a.title))c.set(w,(c.get(w)??0)+1);let u=co(e,r,i),d={score:0,matched:new Set,matchedTokens:new Set};uo(t,c,u,i,d);let f=new Set(t),h=f.size>0&&d.matchedTokens.size===f.size;return s&&f.size>1&&h&&(d.score+=$i),t.length>=Gi&&n.includes(" ")&&fo(a,n,u,d),d.score<=0?null:{item:a,score:d.score,matched_fields:[...d.matched].sort((w,g)=>w.localeCompare(g)),matched_all_terms:h}}function vr(e,t){return[...e].sort((n,r)=>{let i=r.score-n.score;if(i!==0)return i;let o=z(n.item.status,t),s=z(r.item.status,t);if(o!==s)return o?1:-1;let a=n.item.priority-r.item.priority;if(a!==0)return a;let l=at(r.item.updated_at,n.item.updated_at);return l!==0?l:n.item.id.localeCompare(r.item.id)})}function Er(e,t,n,r,i,o,s,a=!1){return br(e,t,n,r?i.get(e.metadata.id)??"":"",o,s,a)}function Qe(e){if(e.size===0)return new Map;let t=[...e.values()],n=Math.min(...t),r=Math.max(...t);if(r===n)return new Map([...e.keys()].map(o=>[o,1]));let i=new Map;for(let[o,s]of e)i.set(o,(s-n)/(r-n));return i}function Sr(e,t,n,r,i,o,s,a,l,c,u,d,f=!1){let h=f?{total:0,count_only:!0}:{};if(c.mode==="compact"&&r.compact===!0){let g=V({mode:t,matchMode:n,options:r,includeLinked:i,titleExact:r.titleExact===!0,phraseExact:r.phraseExact===!0,scoreThreshold:o,hybridSemanticWeight:s,runtimeFieldFilters:d});return{query:e.trim(),mode:t,items:[],count:0,...h,filters:g,...u.length>0?{warnings:u}:{}}}let w=c.mode==="full"?null:[...c.fields];return{query:e.trim(),mode:t,items:[],count:0,...h,filters:Q({effectiveMode:t,matchMode:n,options:r,includeLinked:i,titleExact:r.titleExact===!0,phraseExact:r.phraseExact===!0,scoreThreshold:o,hybridSemanticWeight:s,queryExpansion:a,rerank:l,runtimeFieldFilters:d??{}}),projection:{mode:c.mode,fields:w},now:D(),...u.length>0?{warnings:u}:{}}}function et(e,t,n,r){if(!t.active)throw new p(`Search mode '${e}' requires a configured embedding provider in settings.providers.openai or settings.providers.ollama`,m.USAGE);if(!n.active&&!r)throw new p(`Search mode '${e}' requires a configured vector store in settings.vector_store.qdrant/settings.vector_store.lancedb or an extension adapter selected by settings.vector_store.adapter`,m.USAGE);return{provider:t.active,vectorStore:n.active??null}}var R=he;function me(e){let t=A(),n=ut(t,e);if(!n)return null;let r=n.runtime_definition??n.definition,i=r.query,o=r.queryExpansion??r.query_expansion,s=r.rerank,a=R(r.name)??R(n.definition.name)??e;if(!a)return null;let l={providerName:a,...typeof i=="function"?{query:i}:{},...typeof o=="function"?{queryExpansion:o}:{},...typeof s=="function"?{rerank:s}:{}};return!l.query&&!l.queryExpansion&&!l.rerank?null:l}function xr(e){let t=R(e.search?.provider),n=me(t);return n?.query?{providerName:n.providerName,query:n.query}:null}function kr(e){let t=A(),n=R(e.vector_store?.adapter),r=ft(t,n);if(!r)return null;let i=r.runtime_definition??r.definition,o=i.query;if(typeof o!="function")return null;let s=i.upsert;return{adapterName:R(i.name)??R(r.definition.name)??n??"extension",query:o,...typeof s=="function"?{upsert:s}:{}}}function Ar(e,t,n){let r=Array.isArray(t)?t:t?.hits;if(!Array.isArray(r))throw new p(`Extension search provider "${e}" must return an array of hits or { hits: [...] }`,m.GENERIC_FAILURE);let i=new Set,o=[];for(let s of r){if(typeof s!="object"||s===null)continue;let a=R(s.id),l=s.score;if(!a||typeof l!="number"||!Number.isFinite(l)||i.has(a))continue;let c=n.get(a);if(!c)continue;let u=s.matched_fields,d=Array.isArray(u)&&u.every(f=>typeof f=="string")?[...new Set(u.map(f=>f.trim()).filter(f=>f.length>0))].sort((f,h)=>f.localeCompare(h)):[`provider:${e}`];i.add(a),o.push({item:c.metadata,score:l,matched_fields:d})}return o}function Rr(e,t){let n=[],r=new Map;for(let i of e){if(r.has(i.id))continue;let o=t.get(i.id);o&&(r.set(i.id,i.score),n.push({item:o.metadata,score:i.score,matched_fields:["semantic"]}))}return{semanticHits:n,semanticScores:r}}function ue(e,t){let n=t.filter(c=>c.exact_id_match===!0);if(n.length===0)return e;let r=new Set(n.map(c=>c.item.id)),i=e.filter(c=>!r.has(c.item.id)),o=i.reduce((c,u)=>Math.max(c,u.score),0),s=n.sort((c,u)=>u.score-c.score),a=o+s.length+1;return[...s.map((c,u)=>({...c,score:a-u,matched_fields:["id"]})),...i]}function tt(e,t,n,r,i="semantic"){let o=new Map(n.map(d=>[d.item.id,d.score])),s=new Map(n.map(d=>[d.item.id,d.matched_fields])),a=Qe(t),l=Qe(o),c=new Set([...t.keys(),...o.keys()]),u=1-r;return[...c].map(d=>{let f=e.get(d),h=a.get(d)??0,y=l.get(d)??0,w=h*r+y*u;if(w<=0)return null;let g=new Set;t.has(d)&&g.add(i);for(let _ of s.get(d)??[])g.add(_);return{item:f.metadata,score:w,matched_fields:[...g].sort((_,b)=>_.localeCompare(b))}}).filter(d=>d!==null)}function Mr(e){let t=e.configuredProvider?.trim().toLowerCase();return t==="bm25"?"explicit":t==="auto"&&!e.hasEmbeddingProvider&&!e.hasExtensionSearchProvider?"auto-fallback":null}function Fr(e){let t=e.filteredDocuments.map(s=>({id:s.metadata.id,text:Xn(jt(s,{fields:e.corpusFields}))})),n=Qn(t),r=Yn(n,Ve(e.query),e.bm25Params),i=new Map(e.filteredDocuments.map(s=>[s.metadata.id,s]));if(e.requestedMode==="semantic"){let s=[...r].map(([a,l])=>({item:i.get(a).metadata,score:l,matched_fields:["bm25"]}));return ue(s,e.keywordHits)}let o=tt(i,r,e.keywordHits,e.hybridSemanticWeight,"bm25");return ue(o,e.keywordHits)}function Cr(e){let t=new Map;for(let r of e)for(let i of r){let o=t.get(i.id);(!o||i.score>o.score)&&t.set(i.id,i)}let n=[...t.values()];return n.sort((r,i)=>r.score!==i.score?i.score-r.score:r.id.localeCompare(i.id)),n}function Ir(e){let t=e.metadata,n=Array.isArray(t?.tags)?t.tags.join(" "):"";return[t?.title,t?.description,t?.type,t?.status,n,e.body].map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0).join(`
|
|
4
|
-
`)}async function mo(e,t){let n=e.queryExpansion.enabled?Nn(t,e.queryExpansion.max_queries):[t],r=n.length>0?n:[t];if(!e.queryExpansion.enabled)return r;if(e.queryExpansionExtension?.expand)try{let i=await Promise.resolve(e.queryExpansionExtension.expand({query:t,mode:e.requestedMode,settings:e.settings}));return Gn(r,Un(i),e.queryExpansion.max_queries)}catch{return e.warnings.push(`search_query_expansion_provider_failed:${e.queryExpansionExtension.providerName}:using_builtin`),r}return e.queryExpansion.provider&&e.queryExpansion.provider!=="openai"&&e.queryExpansion.provider!=="ollama"&&e.warnings.push(`search_query_expansion_provider_unavailable:${e.queryExpansion.provider}:using_builtin`),r}async function po(e,t,n,r){if(e.extensionVectorAdapter?.query)try{return await Promise.resolve(e.extensionVectorAdapter.query({vector:t,limit:n,settings:e.settings}))}catch(i){if(!e.vectorStore)throw new p(`Extension vector adapter query failed and no built-in fallback store is configured (${i instanceof Error?i.message:String(i)})`,m.GENERIC_FAILURE);return e.warnings.push(`search_vector_adapter_failed:${e.extensionVectorAdapter.adapterName}:using_builtin`),await xe(e.vectorStore,t,n,r)}if(e.vectorStore)return await xe(e.vectorStore,t,n,r);throw new p("Semantic search requires either a configured vector store or an extension vector adapter query handler",m.USAGE)}function ho(e,t,n){return[...e].sort((i,o)=>i.score!==o.score?o.score-i.score:i.item.id.localeCompare(o.item.id)).slice(0,n).map(i=>{let o=t.get(i.item.id);return o?{hit:i,text:Ir(o)}:null}).filter(i=>i!==null)}async function go(e,t,n){if(!e.rerankExtension?.rerank)return null;try{let r=await Promise.resolve(e.rerankExtension.rerank({query:t,mode:"hybrid",model:e.rerank.model,top_k:e.rerank.top_k,settings:e.settings,candidates:n.map(o=>({id:o.hit.item.id,text:o.text,score:o.hit.score}))})),i=$n(r);return i.length>0?new Map(i.map(o=>[o.id,o.score])):(e.warnings.push(`search_rerank_provider_invalid_response:${e.rerankExtension.providerName}:using_builtin`),null)}catch{return e.warnings.push(`search_rerank_provider_failed:${e.rerankExtension.providerName}:using_builtin`),null}}async function yo(e,t,n){let r=await go(e,t,n);if(r)return r;let i=n.map(o=>({id:o.hit.item.id,text:o.text}));try{return await Bn(e.provider,e.rerank.model,t,i,e.embeddingTimeoutMs)}catch{return e.warnings.push("search_rerank_failed:using_hybrid_scores"),null}}function _o(e,t){let n=new Set(t.keys()),r=e.map(i=>{let o=t.get(i.item.id);if(o===void 0)return i;let s=new Set(i.matched_fields);return s.add("rerank"),{...i,score:o,matched_fields:[...s].sort((a,l)=>a.localeCompare(l))}});return r.sort((i,o)=>{let s=n.has(i.item.id),a=n.has(o.item.id);return s!==a?s?-1:1:i.score!==o.score?o.score-i.score:i.item.id.localeCompare(o.item.id)}),r}async function wo(e,t,n,r){if(!e.rerank.enabled||n.length<=1)return n;let i=ho(n,r,e.rerank.top_k),o=await yo(e,t,i);return o&&o.size>0?_o(n,o):n}async function Tr(e){let t=Math.max(e.limit??e.maxResults,e.maxResults),n=e.embeddingTimeoutMs!==void 0?{timeout_ms:e.embeddingTimeoutMs}:{},r=e.vectorQueryTimeoutMs!==void 0?{timeout_ms:e.vectorQueryTimeoutMs}:{},i=e.query.trim(),o=await mo(e,i),s=await re(e.provider,o,n),a=await Promise.all(s.map(async y=>await po(e,y,t,r))),l=Cr(a),c=new Map(e.filteredDocuments.map(y=>[y.metadata.id,y])),{semanticHits:u,semanticScores:d}=Rr(l,c),f=d.size;if(e.requestedMode==="semantic")return{hits:ue(u,e.keywordHits),vectorMatchCount:f};let h=await wo(e,i,tt(c,d,e.keywordHits,e.hybridSemanticWeight),c);return{hits:ue(h,e.keywordHits),vectorMatchCount:f}}async function Lr(e,t,n,r){let i=lt(A()),o=async(c,u,d)=>{let f=async(h,y)=>{await we({path:h,scope:"project"});let w=await le.readFile(h,"utf8");return pt(w,{format:y,schema:r,extensionFieldNames:i,onWarning:_=>s.push(_)}).body};try{return await f(u,d)}catch{let h=d==="toon"?"json_markdown":"toon",y=_e(e,c.type,c.id,h,n);try{return await f(y,h)}catch{return s.push(`item_list_item_read_failed:${Xe.relative(e,y)}`),""}}},s=[],a=await It(e,t,n,s,r),l=[];if(a.length===0){let c=await Tt(e,t,n,s,r);for(let u of c){let d=_e(e,u.type,u.id,t,n),f=await o(u,d,t);l.push({metadata:u,body:f})}return{documents:l,warnings:[...new Set(s)].sort((u,d)=>u.localeCompare(d))}}for(let c of a){if(typeof c.body=="string"){l.push({metadata:c.metadata,body:c.body});continue}let u=await o(c.metadata,c.item_path,c.item_format);l.push({metadata:c.metadata,body:u})}return{documents:l,warnings:[...new Set(s)].sort((c,u)=>c.localeCompare(u))}}function qr(e,t){let n=t.trim();if(n.length===0)return null;if(n==="score")return e.score;if(n==="matched_fields")return e.matched_fields;if(n.startsWith("item.")){let o=n.slice(5);return o.length===0?null:e.item[o]??null}let r=e,i=e.item;return Object.prototype.hasOwnProperty.call(i,n)?i[n]??null:Object.prototype.hasOwnProperty.call(r,n)?r[n]??null:null}function Dr(e,t){return t.mode==="full"?e.map(({matched_all_terms:n,exact_id_match:r,...i})=>i):e.map(n=>{let r={};for(let i of t.fields)r[i]=qr(n,i);return r})}function bo(e){let t=me(e.provider??void 0);return t?.queryExpansion?{providerName:t.providerName,expand:t.queryExpansion}:null}function vo(e){let t=me(R(e.search?.provider));return t?.rerank?{providerName:t.providerName,rerank:t.rerank}:null}function Eo(e,t){let n=[],r=ar(e),i=Object.keys(r.inlineFilters).length>0;if(i&&r.residualQuery.trim().length===0)throw new p("Inline field:value tokens consumed the entire query, leaving no search terms.",m.USAGE,{examples:["pm search auth tag:area:search","pm list --tag area:search --status open"],nextSteps:["Add keyword terms alongside the inline filters, or use pm list for pure tag/status/type/priority filtering."]});let o=i?r.residualQuery:e,s=cr(t,r.inlineFilters,n);return{query:o,options:s,inlineWarnings:n,highlight:s.highlight===!0,includeLinked:ce(s.includeLinked),titleExact:ce(s.titleExact),phraseExact:ce(s.phraseExact),matchMode:On(typeof s.matchMode=="string"?s.matchMode:void 0),minScoreOverride:Hn(s.minScore),countOnly:s.count===!0,tokens:Ue(o),normalizedQuery:F(o),limit:ee(s.limit),projection:He(s,e),modeWasExplicit:typeof s.mode=="string"&&s.mode.trim().length>0}}async function So(e,t){let n=S(process.cwd(),t.path);await T(n);let r=await I(n),i=Ct(r).settings,o=O(i.schema),s=H(i.schema);Ne(e.projection,s,e.query);let a=Mt(e.options,s,"search"),l=j(i,A()),c=Dt(i),u=Ot(i,n),d=xr(i),f=kr(i),h=jn(e.options.semanticWeight),y=Wn(i,c.active?.name??null),w=zn(i,c.active?.model??R(i.search?.embedding_model)??"text-embedding-3-small");return{pmRoot:n,settings:i,statusRegistry:o,runtimeFieldRegistry:s,runtimeFieldFilters:a,typeRegistry:l,maxResults:Ge(i),scoreThreshold:e.minScoreOverride??We(i),semanticWeightProvided:e.options.semanticWeight!==void 0,semanticWeightOverride:h,hybridSemanticWeight:h??ze(i),tuning:$e(i),providerResolution:c,vectorResolution:u,extensionSearchProvider:d,extensionVectorAdapter:f,bm25Mode:Mr({configuredProvider:R(i.search?.provider),hasEmbeddingProvider:c.active!==null,hasExtensionSearchProvider:d!==null}),queryExpansion:y,queryExpansionExtension:bo(y),rerank:w,rerankExtension:vo(i),effectiveMode:Pn(e.options.mode)}}async function xo(e,t){let n=await Lr(t.pmRoot,t.settings.item_format??"toon",t.typeRegistry.type_to_folder,t.settings.schema),r=Z(typeof e.options.status=="string"?e.options.status:void 0,t.statusRegistry,{strict:!0}),i=tn(t.statusRegistry),o=fr(n.documents,e.options,t.typeRegistry,t.runtimeFieldFilters,r,i);return{warnings:n.warnings,allDocuments:n.documents,filteredDocuments:ur(o,e.normalizedQuery,{titleExact:e.titleExact,phraseExact:e.phraseExact||e.matchMode==="exact"})}}async function ko(e,t,n){let r=new Map;if(!e||t!=="keyword"&&t!=="hybrid")return r;let i=process.cwd(),o=await pr(i,dt(i)),s=await Promise.all(n.map(async a=>[a.metadata.id,await hr(a,o)]));for(let[a,l]of s)r.set(a,l);return r}async function Ao(e,t,n){let r=await ko(e.includeLinked,t.effectiveMode,n),i=e.matchMode==="or";return n.map(o=>Er(o,e.tokens,e.normalizedQuery,e.includeLinked,r,t.tuning,t.settings.id_prefix,i)).filter(o=>o!==null).filter(o=>e.matchMode!=="and"||o.matched_all_terms===!0)}function tr(e,t){return Sr(e.query,e.effectiveMode,e.matchMode,e.options,e.includeLinked,e.scoreThreshold,e.hybridSemanticWeight,e.queryExpansion,e.rerank,e.projection,e.warnings,e.runtimeFieldFilters,t)}async function Ro(e,t,n,r,i){if(t.bm25Mode===null||t.effectiveMode==="keyword")return null;let o=Fr({requestedMode:t.effectiveMode,query:e.query,filteredDocuments:n,keywordHits:r,corpusFields:Pt(t.settings),bm25Params:Jn(t.settings),hybridSemanticWeight:t.hybridSemanticWeight});return t.bm25Mode==="auto-fallback"&&i.push(`search_${t.effectiveMode}_offline_bm25:no_embedding_provider:using_lexical_bm25`),o}async function Mo(e,t,n,r){if(!t.extensionSearchProvider)return null;let i=t.providerResolution.active!==null&&(t.vectorResolution.active!==null||t.extensionVectorAdapter!==null);try{let o=await Promise.resolve(t.extensionSearchProvider.query({query:e.query,mode:t.effectiveMode,tokens:e.tokens,options:e.options,settings:t.settings,documents:n}));return Ar(t.extensionSearchProvider.providerName,o,r)}catch(o){if(!i)throw new p(`Extension search provider "${t.extensionSearchProvider.providerName}" failed: ${o instanceof Error?o.message:String(o)}`,m.GENERIC_FAILURE);return null}}function Fo(e,t,n,r){return t.vectorMatchCount>0?t.hits:(r.push(`search_${e}_degraded:no_vector_matches:results_are_lexical`),e==="semantic"?n:t.hits)}async function Co(e,t,n,r,i){let o=!e.extensionSearchProvider&&e.providerResolution.active!==null&&(e.vectorResolution.active!==null||e.extensionVectorAdapter!==null);i&&o&&await sr(e.pmRoot,n,r),e.extensionSearchProvider||et(t,e.providerResolution,e.vectorResolution,e.extensionVectorAdapter!==null)}async function Io(e){let{prepared:t,runtime:n,filteredDocuments:r,keywordHits:i,warnings:o,modeWasExplicit:s}=e,a=i,l=await Ro(t,n,r,i,o),c=n.effectiveMode;if(l!==null||c==="keyword")return{effectiveMode:n.effectiveMode,hits:l??a};try{if(await Co(n,c,r,o,s),r.length===0||t.limit===0)return{effectiveMode:n.effectiveMode,hits:[]};let u=new Map(r.map(d=>[d.metadata.id,d]));if(a=await Mo(t,n,r,u)??a,a===i){let{provider:d,vectorStore:f}=et(c,n.providerResolution,n.vectorResolution,n.extensionVectorAdapter!==null),h=await Tr({requestedMode:c,query:t.query,filteredDocuments:r,keywordHits:i,hybridSemanticWeight:n.hybridSemanticWeight,limit:t.limit,maxResults:n.maxResults,provider:d,vectorStore:f,extensionVectorAdapter:n.extensionVectorAdapter,queryExpansion:n.queryExpansion,queryExpansionExtension:n.queryExpansionExtension,rerank:n.rerank,rerankExtension:n.rerankExtension,warnings:o,settings:n.settings});a=Fo(c,h,i,o)}return{effectiveMode:n.effectiveMode,hits:a}}catch(u){return o.push(or(n.effectiveMode,u)),{effectiveMode:"keyword",hits:i}}}function To(e,t){if(e.projection.mode==="compact"&&e.options.compact===!0)return Ye({query:e.query.trim(),mode:e.effectiveMode,items:[],count:t,total:t,count_only:!0,filters:V({mode:e.effectiveMode,matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,runtimeFieldFilters:e.runtimeFieldFilters})},e.warnings);let n=e.projection.mode==="full"?null:[...e.projection.fields];return Ye({query:e.query.trim(),mode:e.effectiveMode,items:[],count:t,total:t,count_only:!0,filters:Q({effectiveMode:e.effectiveMode,matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,queryExpansion:e.queryExpansion,rerank:e.rerank,runtimeFieldFilters:e.runtimeFieldFilters}),projection:{mode:e.projection.mode,fields:n},now:D()},e.warnings)}function Ye(e,t){return t.length===0?e:{...e,warnings:t}}function de(e,t){return t?{...e,workspace_memory:t}:e}function Lo(e,t,n){if(!e.highlight)return{hits:n,projection:e.projection};let r=new Map(t.map(o=>[o.metadata.id,o])),i=n.map(o=>({...o,highlights:wr(r.get(o.item.id),o.matched_fields,e.tokens)}));return e.projection.mode==="full"||e.projection.fields.includes("highlights")?{hits:i,projection:e.projection}:{hits:i,projection:{mode:e.projection.mode,fields:[...e.projection.fields,"highlights"]}}}function qo(e,t,n,r,i,o){let s=r<n?{total:n}:{};if(e.projection.mode==="compact"&&e.options.compact===!0)return Ye({query:e.query.trim(),mode:e.effectiveMode,items:t,count:t.length,...s,...o,filters:V({mode:e.effectiveMode,matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,runtimeFieldFilters:e.runtimeFieldFilters})},e.warnings);let a=i.mode==="full"?null:[...i.fields];return{query:e.query.trim(),mode:e.effectiveMode,items:t,count:t.length,...s,...o,filters:Q({effectiveMode:e.effectiveMode,matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,queryExpansion:e.queryExpansion,rerank:e.rerank,runtimeFieldFilters:e.runtimeFieldFilters}),projection:{mode:i.mode,fields:a},now:D(),...e.warnings.length>0?{warnings:e.warnings}:{}}}function Do(e){if(e.after!==void 0&&e.count===!0)throw new p("Search --after cannot be combined with --count.",m.USAGE)}async function Pr(e,t,n){Do(t);let r=Eo(e,t),i=await So(r,n),o=await xo(r,i),s=o.warnings;s.push(...r.inlineWarnings);let a=await ln(o.allDocuments.map(M=>M.metadata),{pmRoot:i.pmRoot,statusRegistry:i.statusRegistry,now:D()});s.push(...a.warnings);let l=un(a,r.query);i.effectiveMode==="hybrid"&&i.semanticWeightProvided&&i.semanticWeightOverride===void 0&&s.push("search_hybrid_semantic_weight_override_invalid:using_settings_default");let c={query:r.query,matchMode:r.matchMode,options:r.options,includeLinked:r.includeLinked,titleExact:r.titleExact,phraseExact:r.phraseExact,scoreThreshold:i.scoreThreshold,hybridSemanticWeight:i.hybridSemanticWeight,queryExpansion:i.queryExpansion,rerank:i.rerank,projection:r.projection,warnings:s,runtimeFieldFilters:i.runtimeFieldFilters};if(i.effectiveMode==="keyword"&&(o.filteredDocuments.length===0||r.limit===0&&!r.countOnly))return de(tr({...c,effectiveMode:i.effectiveMode},r.countOnly),l);let u=await Ao(r,i,o.filteredDocuments),d=await Io({prepared:r,runtime:i,filteredDocuments:o.filteredDocuments,keywordHits:u,warnings:s,modeWasExplicit:r.modeWasExplicit});if(d.effectiveMode!=="keyword"&&d.hits.length===0&&(o.filteredDocuments.length===0||r.limit===0&&!r.countOnly))return de(tr({...c,effectiveMode:d.effectiveMode},r.countOnly),l);let f=d.hits.filter(M=>M.exact_id_match===!0||M.score>=i.scoreThreshold),h=vr(f,i.statusRegistry),y=h.length,w=Dn({sorted:h,query:r.query,mode:d.effectiveMode,searchOptions:r.options,limit:r.limit??i.maxResults}),g={...c,effectiveMode:d.effectiveMode};if(r.countOnly)return de(To(g,y),l);let{hits:_,projection:b}=Lo(r,o.filteredDocuments,w.limited),k=Dr(_,b);return de(qo(g,k,y,w.limited.length,b,w.pageExtras),l)}import Po from"node:fs/promises";import nt 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]="9cc9405b-d2b8-59aa-893f-54892595788a")}catch{}})();var jo=nt.join("search","eval-queries.json"),rt={schema:L,examples:[JSON.stringify(ae)],nextSteps:["Create a git-tracked golden-query JSON file that follows the schema, then re-run pm eval."]},Oo=new Set(["keyword","semantic","hybrid"]),Ho=e=>{if(e===void 0)return"keyword";let t=e.trim().toLowerCase();if(!Oo.has(t))throw new p("Eval --mode must be one of keyword|semantic|hybrid",m.USAGE);return t},No=e=>{if(e===void 0||e==="")return In;let t=Y(e);if(t===null)throw new p("Eval --k must be a positive integer",m.USAGE);return t},Uo=e=>{if(e===void 0||e==="")return;let t=String(e).trim(),n=Number(t);if([t.length===0,!Number.isFinite(n),n<0,n>1].includes(!0))throw new p("Eval --fail-under must be a number in the range [0, 1]",m.USAGE);return n},q=e=>Math.round(e*1e4)/1e4,Go=async e=>{try{return await Po.readFile(e,"utf8")}catch{throw new p(`Eval query set not found at ${e}`,m.NOT_FOUND,{...rt,examples:[`echo '${JSON.stringify(ae)}' > ${e}`,"pm eval --queries ./my-eval.json"]})}},Wo=(e,t)=>{try{return JSON.parse(e)}catch(n){throw new p(`Eval query set at ${t} is not valid JSON: ${n instanceof Error?n.message:String(n)}`,m.USAGE,rt)}},zo=e=>{try{return je(e)}catch(t){throw new p(t instanceof Error?t.message:String(t),m.USAGE,rt)}},$o=async e=>zo(Wo(await Go(e),e)),Ko=(e,t)=>t?nt.resolve(process.cwd(),t):nt.join(e,jo),Bo=async(e,t,n,r)=>{let i=e.mode??t,s=(await Pr(e.query,{mode:i,limit:String(n),fields:"id"},r)).items.map(l=>l.id).filter(l=>typeof l=="string"),a=Tn(s,new Set(e.relevant_ids),n);return{metrics:a,report:{query:e.query,mode:i,relevant_total:a.relevant_total,retrieved_relevant:a.retrieved_relevant,ndcg:q(a.ndcg),mrr:q(a.mrr),precision:q(a.precision),recall:q(a.recall)}}},Vo=(e,t,n,r)=>{let i=Ln(n);return{k:e,query_count:t.length,aggregate:{ndcg:q(i.ndcg),mrr:q(i.mrr),precision:q(i.precision),recall:q(i.recall)},queries:t,...r!==void 0?{fail_under:r}:{},passed:r===void 0||i.ndcg>=r}},nc=async(e,t)=>{let n=S(process.cwd(),t.path);await T(n);let r=No(e.k),i=Ho(e.mode),o=Uo(e.failUnder),s=Ko(n,e.queries),a=await $o(s),l=[],c=[];for(let u of a.queries){let{report:d,metrics:f}=await Bo(u,i,r,t);c.push(f),l.push(d)}return Vo(r,l,c,o)};export{Qo as a,es as b,ts as c,us as d,kn as e,An as f,Rn as g,ei as h,Le as i,Ls as j,qs as k,L as l,vi as m,ae as n,je as o,V as p,Q as q,Fi as r,Dn as s,Ge as t,We as u,ze as v,$e as w,rr as x,ir as y,Yi as z,Xi as A,za as B,Pr as C,jo as D,nc as E};
|
|
5
|
-
//# sourceMappingURL=chunk-OF76PSDQ.js.map
|