@unbrained/pm-cli 2026.10.14 → 2026.10.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +54 -2
- package/dist/cli/after-command-context-usage.d.ts +7 -7
- package/dist/cli/argv-utils.d.ts +4 -4
- package/dist/cli/bundle-integrity.d.ts +16 -16
- package/dist/cli/command-namespaces.d.ts +1 -1
- package/dist/cli/commander-usage.d.ts +34 -34
- package/dist/cli/commands/governance/validate.d.ts +1 -1
- package/dist/cli/commands/history/history-compact.d.ts +1 -1
- package/dist/cli/commands/history/history-redact.d.ts +1 -1
- package/dist/cli/commands/history/history-repair.d.ts +1 -1
- package/dist/cli/commands/history/restore.d.ts +1 -1
- package/dist/cli/commands/lifecycle/close.d.ts +1 -1
- package/dist/cli/commands/lifecycle/copy.d.ts +1 -1
- package/dist/cli/commands/lifecycle/delete.d.ts +1 -1
- package/dist/cli/commands/lifecycle/focus.d.ts +1 -1
- package/dist/cli/commands/query/get.d.ts +1 -1
- package/dist/cli/commands/workspace/merge.d.ts +1 -1
- package/dist/cli/commands/workspace/schema.d.ts +1 -1
- package/dist/cli/context-intent-invocation.d.ts +1 -1
- package/dist/cli/description-stdin.d.ts +1 -1
- package/dist/cli/error-guidance.d.ts +119 -119
- package/dist/cli/extension-command-help.d.ts +64 -64
- package/dist/cli/extension-command-help.js +2 -2
- package/dist/cli/extension-command-options.d.ts +16 -16
- package/dist/cli/extension-recovery.d.ts +13 -13
- package/dist/cli/help-content.d.ts +22 -22
- package/dist/cli/help-content.js +2 -2
- package/dist/cli/help-json-payload.d.ts +45 -45
- package/dist/cli/invocation-profile.d.ts +5 -5
- package/dist/cli/main.d.ts +217 -217
- package/dist/cli/migration-gates.d.ts +24 -24
- package/dist/cli/option-values.d.ts +1 -1
- package/dist/cli/public.d.ts +1 -1
- package/dist/cli/register-annotations.d.ts +2 -2
- package/dist/cli/register-assurance.d.ts +1 -1
- package/dist/cli/register-files-lookup.d.ts +1 -1
- package/dist/cli/register-history-activity.d.ts +1 -1
- package/dist/cli/register-history-author.d.ts +1 -1
- package/dist/cli/register-history-maintenance.d.ts +1 -1
- package/dist/cli/register-list-query.d.ts +7 -7
- package/dist/cli/register-list-query.js +3 -3
- package/dist/cli/register-mutation-options.d.ts +1 -1
- package/dist/cli/register-mutation.d.ts +4 -4
- package/dist/cli/register-operations.d.ts +75 -75
- package/dist/cli/register-setup.d.ts +4 -4
- package/dist/cli/register-structured-mutation.d.ts +8 -8
- package/dist/cli/runtime/activation.d.ts +23 -23
- package/dist/cli/runtime/invocation-options.d.ts +12 -12
- package/dist/cli/runtime/projection-retry.d.ts +1 -1
- package/dist/cli/runtime/selection.d.ts +16 -16
- package/dist/cli/runtime/telemetry-outcome.d.ts +11 -11
- package/dist/cli/runtime-compatibility-boundary.d.ts +7 -7
- package/dist/cli/schema/registration.d.ts +1 -1
- package/dist/cli/schema-registration-helpers.d.ts +2 -2
- package/dist/cli/stats-analytics-json.d.ts +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-5LU6PWA4.js → chunk-52EZH2QQ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-7OEGNA4X.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-LKESCZEN.js → chunk-7VHINXZP.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-EMEEHV2Y.js +2 -0
- package/dist/cli-bundle/chunks/chunk-JGKTOBVB.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-PP3BVMFL.js → chunk-JSUJWIHQ.js} +30 -30
- package/dist/cli-bundle/chunks/{chunk-MAT4AP7P.js → chunk-LNKLQYBG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LE4IEHDG.js → chunk-N56CAQBU.js} +63 -64
- package/dist/cli-bundle/chunks/{chunk-3S5SEMEB.js → chunk-NC3QVGDD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2UKKO45F.js → chunk-RJ5N44WY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LOSRTNNP.js → chunk-VIMQCFCK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JTF6VMXH.js → chunk-WBBW3WQX.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-X2H6UR26.js +236 -0
- package/dist/cli-bundle/chunks/{register-list-query-GBLTOQQL.js → register-list-query-FKKFQ66D.js} +7 -7
- package/dist/cli-bundle/chunks/{register-mutation-TNRHNK4N.js → register-mutation-EWMMVZJB.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-J3WXP3MA.js → register-operations-GEQ2H7PS.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-HLSKKU4V.js → register-setup-PSJTQBBO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-4UA7KY4V.js → chunk-3RNUMVK4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BUAGNTLG.js → chunk-4KQFMOM7.js} +6 -6
- package/dist/cli-bundle/focused-chunks/{chunk-QIU4Y3AB.js → chunk-52I2SNKJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y5A4XOSK.js → chunk-5KRACGBK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HNRI2KBT.js → chunk-5OO54BIV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LKWDWER4.js → chunk-5TBAVZDR.js} +14 -14
- package/dist/cli-bundle/focused-chunks/{chunk-RHQCQTZA.js → chunk-FQKPOZKS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IGBSAHCA.js → chunk-H3P77KVU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-HTA3TNC3.js +26 -0
- package/dist/cli-bundle/focused-chunks/{chunk-23ACMPGB.js → chunk-JKBH7YGX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AULVKHYX.js → chunk-KIIFVULU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ESOW6PH4.js → chunk-N6FUKTZS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-PDYE7QDX.js +166 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KSMQEB3V.js → chunk-Q4VNCTR2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YJNKISEI.js → chunk-THYQR3ON.js} +61 -62
- package/dist/cli-bundle/focused-chunks/{chunk-ELQNEJDA.js → chunk-TYLG5VEB.js} +2 -2
- package/dist/cli-bundle/main.js +26 -26
- 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 +22 -22
- 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 +51 -51
- 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 +7 -7
- package/dist/cli.d.ts +9 -9
- package/dist/core/checkpoint/checkpoint-gc.d.ts +17 -17
- package/dist/core/checkpoint/mutation-checkpoint.d.ts +26 -26
- package/dist/core/config/nested-settings.d.ts +20 -20
- package/dist/core/config/positional-value.d.ts +9 -9
- package/dist/core/diagnostics/remediation.d.ts +7 -7
- package/dist/core/extensions/activation-summary-markdown.d.ts +4 -4
- package/dist/core/extensions/activation-summary.d.ts +30 -30
- package/dist/core/extensions/activation-transaction.d.ts +9 -9
- package/dist/core/extensions/capability-usage.d.ts +25 -25
- package/dist/core/extensions/command-hook-context.d.ts +15 -15
- package/dist/core/extensions/command-metadata-contract.d.ts +1 -1
- package/dist/core/extensions/command-visibility-tier.d.ts +1 -1
- package/dist/core/extensions/contribution-inventory.d.ts +24 -24
- package/dist/core/extensions/exporter-output-contract.d.ts +4 -4
- package/dist/core/extensions/extension-candidate.d.ts +14 -14
- package/dist/core/extensions/extension-capability-aliases.d.ts +14 -14
- package/dist/core/extensions/extension-hook-runtime.d.ts +14 -14
- package/dist/core/extensions/extension-policy.d.ts +62 -62
- package/dist/core/extensions/extension-registries.d.ts +8 -8
- package/dist/core/extensions/extension-runtime-helpers.d.ts +5 -5
- package/dist/core/extensions/extension-types.d.ts +702 -702
- package/dist/core/extensions/flag-definition-validation.d.ts +11 -11
- package/dist/core/extensions/flag-value-types.d.ts +16 -4
- package/dist/core/extensions/flag-value-types.js +1 -1
- package/dist/core/extensions/index.d.ts +34 -34
- package/dist/core/extensions/item-field-types.d.ts +3 -3
- package/dist/core/extensions/item-fields.d.ts +6 -6
- package/dist/core/extensions/loader.d.ts +66 -66
- package/dist/core/extensions/manifest-parser.d.ts +1 -1
- package/dist/core/extensions/manifest-schema.d.ts +13 -13
- package/dist/core/extensions/module-graph-snapshot.d.ts +5 -5
- package/dist/core/extensions/preflight-ownership.d.ts +3 -3
- package/dist/core/extensions/read-output-contract.d.ts +2 -2
- package/dist/core/extensions/registration-contracts.d.ts +12 -12
- package/dist/core/extensions/registration-validation.d.ts +6 -6
- package/dist/core/extensions/registration-values.d.ts +19 -19
- package/dist/core/extensions/reserved-host-flags.d.ts +5 -5
- package/dist/core/extensions/runtime-registrations.d.ts +6 -6
- package/dist/core/extensions/service-ownership.d.ts +1 -1
- package/dist/core/extensions/version-compat.d.ts +9 -9
- package/dist/core/fs/atomic-create.d.ts +1 -1
- package/dist/core/fs/fs-utils.d.ts +12 -12
- package/dist/core/fs/host-environment-errors.d.ts +10 -10
- package/dist/core/fs/path-utils.d.ts +1 -1
- package/dist/core/governance/content-fields.d.ts +25 -25
- package/dist/core/governance/issue-codes.d.ts +16 -16
- package/dist/core/governance/metadata-coverage.d.ts +64 -64
- package/dist/core/history/digest.d.ts +5 -5
- package/dist/core/history/drift-cache.d.ts +2 -2
- package/dist/core/history/drift-scan.d.ts +18 -18
- package/dist/core/history/event-classification.d.ts +4 -4
- package/dist/core/history/event-index.d.ts +33 -33
- package/dist/core/history/history-compact-bulk.d.ts +12 -12
- package/dist/core/history/history-diff.d.ts +15 -15
- package/dist/core/history/history-rewrite.d.ts +43 -43
- package/dist/core/history/history-storage-stats.d.ts +20 -20
- package/dist/core/history/history-stream-policy.d.ts +12 -12
- package/dist/core/history/history.d.ts +45 -45
- package/dist/core/history/identity.d.ts +4 -4
- package/dist/core/history/operation-contract.d.ts +17 -17
- package/dist/core/history/projection.d.ts +16 -16
- package/dist/core/history/read.d.ts +4 -4
- package/dist/core/history/replay.d.ts +47 -47
- package/dist/core/history/tombstone.d.ts +1 -1
- package/dist/core/history/version-address.d.ts +2 -2
- package/dist/core/history/workspace-history.d.ts +72 -72
- package/dist/core/io/body-file.d.ts +2 -2
- package/dist/core/io/bulk-ids-input.d.ts +7 -7
- package/dist/core/item/actionability.d.ts +30 -30
- package/dist/core/item/dependency-reference.d.ts +2 -2
- package/dist/core/item/id.d.ts +9 -9
- package/dist/core/item/item-format-version.d.ts +17 -15
- package/dist/core/item/item-format-version.js +1 -1
- package/dist/core/item/item-format.d.ts +54 -54
- package/dist/core/item/item-record.d.ts +1 -1
- package/dist/core/item/item-type-definition.d.ts +11 -11
- package/dist/core/item/parent-reference-policy.d.ts +6 -6
- package/dist/core/item/parse.d.ts +37 -37
- package/dist/core/item/plan-lifecycle.d.ts +4 -4
- package/dist/core/item/priority.d.ts +3 -3
- package/dist/core/item/sprint-release-format.d.ts +4 -4
- package/dist/core/item/status-filter.d.ts +5 -5
- package/dist/core/item/status.d.ts +3 -3
- package/dist/core/item/toon-decode.d.ts +10 -10
- package/dist/core/item/type-registry.d.ts +35 -35
- package/dist/core/item/type-synonyms.d.ts +2 -2
- package/dist/core/lock/lock-gc.d.ts +28 -28
- package/dist/core/lock/lock.d.ts +53 -53
- package/dist/core/output/mutation-projection.d.ts +4 -4
- package/dist/core/output/output-control.d.ts +4 -4
- package/dist/core/output/output.d.ts +30 -30
- package/dist/core/output/query-summary.d.ts +5 -5
- package/dist/core/output/tabular.d.ts +3 -3
- package/dist/core/packages/manifest.d.ts +30 -30
- package/dist/core/packages/root.d.ts +4 -4
- package/dist/core/policy/workflow-policy-schema.d.ts +291 -291
- package/dist/core/policy/workflow-policy-store.d.ts +15 -15
- package/dist/core/policy/workflow-policy.d.ts +56 -56
- package/dist/core/profile/profile-describe.d.ts +22 -22
- package/dist/core/profile/profile-lint.d.ts +13 -13
- package/dist/core/profile/profile-plan.d.ts +45 -45
- package/dist/core/profile/profile-presets.d.ts +36 -36
- package/dist/core/reproducibility/context.d.ts +9 -9
- package/dist/core/schema/fields-file.d.ts +35 -35
- package/dist/core/schema/item-types-file.d.ts +29 -29
- package/dist/core/schema/runtime-field-filters.d.ts +3 -3
- package/dist/core/schema/runtime-field-values.d.ts +7 -7
- package/dist/core/schema/runtime-schema.d.ts +59 -59
- package/dist/core/schema/status-defs-file.d.ts +29 -29
- package/dist/core/schema/status-token.d.ts +1 -1
- package/dist/core/schema/type-inference.d.ts +10 -10
- package/dist/core/schema/type-presets.d.ts +5 -5
- package/dist/core/schema/type-workflows.d.ts +14 -14
- package/dist/core/search/background-refresh.d.ts +12 -12
- package/dist/core/search/bm25.d.ts +16 -16
- package/dist/core/search/cache.d.ts +34 -34
- package/dist/core/search/corpus.d.ts +17 -17
- package/dist/core/search/embedding-batches.d.ts +25 -25
- package/dist/core/search/eval-thresholds.d.ts +4 -4
- package/dist/core/search/eval.d.ts +40 -40
- package/dist/core/search/http-client.d.ts +24 -24
- package/dist/core/search/providers.d.ts +30 -30
- package/dist/core/search/relevance.d.ts +17 -17
- package/dist/core/search/semantic-defaults.d.ts +5 -5
- package/dist/core/search/staleness.d.ts +3 -3
- package/dist/core/search/vector-stores.d.ts +51 -51
- package/dist/core/search/vectorization-metadata.d.ts +9 -9
- package/dist/core/sentry/helpers.d.ts +27 -27
- package/dist/core/sentry/instrument.d.ts +51 -51
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/sentry/sensitive-assignments.d.ts +9 -0
- package/dist/core/sentry/sensitive-assignments.js +2 -0
- package/dist/core/session/session-state.d.ts +37 -37
- package/dist/core/shared/agent-session-context.d.ts +14 -14
- package/dist/core/shared/author.d.ts +89 -89
- package/dist/core/shared/command-line.d.ts +3 -3
- package/dist/core/shared/command-types.d.ts +20 -20
- package/dist/core/shared/conflict-markers.d.ts +5 -5
- package/dist/core/shared/constants.d.ts +30 -30
- package/dist/core/shared/errors.d.ts +100 -100
- package/dist/core/shared/html-entity-decode.d.ts +2 -2
- package/dist/core/shared/item-metadata-contract.d.ts +2 -2
- package/dist/core/shared/lazy-module.d.ts +1 -1
- package/dist/core/shared/levenshtein.d.ts +1 -1
- package/dist/core/shared/memo.d.ts +1 -1
- package/dist/core/shared/numeric-parsers.d.ts +1 -1
- package/dist/core/shared/option-alias-visibility.d.ts +3 -3
- package/dist/core/shared/primitives.d.ts +13 -13
- package/dist/core/shared/secret-rules.d.ts +92 -92
- package/dist/core/shared/serial-queue.d.ts +6 -6
- package/dist/core/shared/serialization.d.ts +4 -4
- package/dist/core/shared/split-comma-list.d.ts +4 -4
- package/dist/core/shared/text-normalization.d.ts +3 -3
- package/dist/core/shared/time.d.ts +27 -27
- package/dist/core/store/item-format-migration.d.ts +7 -7
- package/dist/core/store/item-metadata-cache.d.ts +30 -30
- package/dist/core/store/item-metadata-query-index.d.ts +66 -66
- package/dist/core/store/item-metadata-read-work.d.ts +6 -6
- package/dist/core/store/item-store.d.ts +123 -123
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/paths.d.ts +27 -27
- package/dist/core/store/settings-concurrency.d.ts +1 -1
- package/dist/core/store/settings-read-cache.d.ts +11 -11
- package/dist/core/store/settings-validator.d.ts +117 -117
- package/dist/core/store/settings.d.ts +84 -84
- package/dist/core/store/sqlite-runtime.d.ts +2 -2
- package/dist/core/store/tracker-preflight.d.ts +3 -3
- package/dist/core/telemetry/consent.d.ts +1 -1
- package/dist/core/telemetry/observability.d.ts +16 -16
- package/dist/core/telemetry/policy.d.ts +7 -7
- package/dist/core/telemetry/read-sampling.d.ts +1 -1
- package/dist/core/telemetry/runtime.d.ts +275 -275
- package/dist/core/test/background-runs.d.ts +123 -123
- package/dist/core/test/item-test-run-tracking.d.ts +10 -10
- package/dist/core/test/run-selectors.d.ts +12 -12
- package/dist/core/validate/estimate-defaults.d.ts +3 -3
- package/dist/core/validate/fix-planning.d.ts +36 -36
- package/dist/core/validate/linked-artifact-reference.d.ts +1 -1
- package/dist/core/validate/missing-by-type.d.ts +3 -3
- package/dist/core/validate/missing-link-owners.d.ts +17 -17
- package/dist/core/validate/stale-file-classification.d.ts +6 -6
- package/dist/mcp/http-server.d.ts +26 -26
- package/dist/mcp/legacy-adapter.d.ts +18 -18
- package/dist/mcp/runtime-capabilities.d.ts +18 -18
- package/dist/mcp/server.d.ts +73 -73
- package/dist/mcp/tool-definitions.d.ts +27 -27
- package/dist/sdk/actionability.d.ts +1 -1
- package/dist/sdk/agent/closed-domain-contracts.d.ts +11 -11
- package/dist/sdk/agent/command-recovery.d.ts +5 -5
- package/dist/sdk/agent/command-suggestions.d.ts +4 -4
- package/dist/sdk/agent/create-option-policy.d.ts +2 -2
- package/dist/sdk/agent/identity-config.d.ts +18 -18
- package/dist/sdk/agent/item-addressing.d.ts +6 -6
- package/dist/sdk/agent/refusal-closure-census.d.ts +26 -26
- package/dist/sdk/agent/refusal-closure.d.ts +22 -22
- package/dist/sdk/agent/refusal-corpus-contracts.d.ts +26 -26
- package/dist/sdk/agent/refusal-reachability.d.ts +65 -65
- package/dist/sdk/agent/subcommand-recovery.d.ts +20 -20
- package/dist/sdk/agent/task-transcript-contracts.d.ts +18 -18
- package/dist/sdk/agent/tracker-preflight-contracts.d.ts +21 -21
- package/dist/sdk/agent-capability-contracts.d.ts +41 -41
- package/dist/sdk/agent-session-context.d.ts +1 -1
- package/dist/sdk/annotations.d.ts +74 -74
- package/dist/sdk/author-attribution.d.ts +47 -47
- package/dist/sdk/authoring.d.ts +9 -9
- package/dist/sdk/cli-bootstrap.d.ts +65 -65
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +56 -56
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.d.ts +6 -6
- package/dist/sdk/cli-contracts/command-aliases.d.ts +19 -19
- package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +66 -66
- package/dist/sdk/cli-contracts/commander-mutation-options.d.ts +7 -7
- package/dist/sdk/cli-contracts/commander-types.d.ts +18 -18
- package/dist/sdk/cli-contracts/completeness.d.ts +14 -14
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +28 -28
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +114 -112
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +27 -27
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +61 -61
- package/dist/sdk/cli-contracts/registration-helpers.d.ts +56 -56
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +250 -250
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +678 -678
- package/dist/sdk/cli-contracts/string-lists.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +564 -564
- package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +13 -13
- package/dist/sdk/cli-contracts/tool-schema.d.ts +54 -54
- package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +20 -20
- package/dist/sdk/cli-contracts.d.ts +15 -15
- package/dist/sdk/cli-program.d.ts +1 -1
- package/dist/sdk/cli-program.js +1 -1
- package/dist/sdk/command-line.d.ts +3 -3
- package/dist/sdk/comments.d.ts +24 -24
- package/dist/sdk/compile-cache.d.ts +4 -4
- package/dist/sdk/completion/bash.d.ts +1 -1
- package/dist/sdk/completion/fish.d.ts +1 -1
- package/dist/sdk/completion/shared.d.ts +74 -74
- package/dist/sdk/completion/zsh.d.ts +1 -1
- package/dist/sdk/completion.d.ts +3 -3
- package/dist/sdk/compose.d.ts +94 -94
- package/dist/sdk/config.d.ts +105 -105
- package/dist/sdk/context/recency.d.ts +1 -1
- package/dist/sdk/context/semantic-session-attribution.d.ts +23 -23
- package/dist/sdk/context/usage-egress.d.ts +1 -1
- package/dist/sdk/context/usage-ledger.d.ts +18 -18
- package/dist/sdk/context-intent-contracts.d.ts +37 -37
- package/dist/sdk/context-intent-runtime.d.ts +10 -10
- package/dist/sdk/context-packing.d.ts +44 -44
- package/dist/sdk/context-relevance.d.ts +110 -110
- package/dist/sdk/context-signal-store.d.ts +52 -52
- package/dist/sdk/context-usage.d.ts +78 -78
- package/dist/sdk/contracts.d.ts +2 -1
- package/dist/sdk/contracts.js +1 -1
- package/dist/sdk/core-governance.d.ts +5 -5
- package/dist/sdk/core.d.ts +8 -8
- package/dist/sdk/corpus-shape.d.ts +60 -60
- package/dist/sdk/define.d.ts +36 -36
- package/dist/sdk/dependencies.d.ts +70 -70
- package/dist/sdk/dependency-flag-validation.d.ts +17 -17
- package/dist/sdk/dependency-provenance.d.ts +22 -22
- package/dist/sdk/docs.d.ts +17 -17
- package/dist/sdk/duplicates.d.ts +14 -14
- package/dist/sdk/environment/agent-environment.d.ts +118 -118
- package/dist/sdk/environment/host-environment-errors.d.ts +1 -1
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +42 -40
- package/dist/sdk/environment/project-runtime-compatibility.js +2 -2
- package/dist/sdk/environment/source-context.d.ts +4 -4
- package/dist/sdk/environment/tracker-preflight.d.ts +1 -1
- package/dist/sdk/error-code-catalog.d.ts +33 -33
- package/dist/sdk/error-runtime.d.ts +5 -5
- package/dist/sdk/errors.d.ts +17 -17
- package/dist/sdk/eval.d.ts +27 -27
- package/dist/sdk/extension/author-manifest.d.ts +9 -9
- package/dist/sdk/extension/bundled-catalog.d.ts +18 -18
- package/dist/sdk/extension/concurrency.d.ts +1 -1
- package/dist/sdk/extension/copy-scope.d.ts +1 -1
- package/dist/sdk/extension/custom-field-collisions.d.ts +1 -1
- package/dist/sdk/extension/describe.d.ts +21 -21
- package/dist/sdk/extension/doctor.d.ts +46 -46
- package/dist/sdk/extension/install-plan.d.ts +32 -32
- package/dist/sdk/extension/install-receipts.d.ts +4 -4
- package/dist/sdk/extension/install-runtime.d.ts +12 -12
- package/dist/sdk/extension/install-snapshot.d.ts +10 -10
- package/dist/sdk/extension/install-sources.d.ts +106 -106
- package/dist/sdk/extension/managed-state.d.ts +42 -42
- package/dist/sdk/extension/managed-update-status.d.ts +1 -1
- package/dist/sdk/extension/migrations.d.ts +48 -48
- package/dist/sdk/extension/output-ownership.d.ts +19 -19
- package/dist/sdk/extension/runtime-summary.d.ts +7 -7
- package/dist/sdk/extension/scaffold.d.ts +15 -15
- package/dist/sdk/extension/shared.d.ts +16 -16
- package/dist/sdk/extension/source-resolution.d.ts +16 -16
- package/dist/sdk/extension/static-inventory.d.ts +23 -23
- package/dist/sdk/extension/update-check.d.ts +9 -9
- package/dist/sdk/extension-command-context.d.ts +1 -1
- package/dist/sdk/extension-contracts.d.ts +10 -10
- package/dist/sdk/extension.d.ts +221 -221
- package/dist/sdk/files.d.ts +101 -101
- package/dist/sdk/flag-invocation-contracts.d.ts +25 -25
- package/dist/sdk/flag-invocation-contracts.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/generated-error-code-catalog.d.ts +1 -1
- package/dist/sdk/governance/artifact-ledgers.d.ts +19 -19
- package/dist/sdk/governance/assurance-action-contracts.d.ts +1 -1
- package/dist/sdk/governance/assurance-action.d.ts +46 -46
- package/dist/sdk/governance/assurance-mutation-error.d.ts +20 -20
- package/dist/sdk/governance/assurance-presets.d.ts +25 -25
- package/dist/sdk/governance/assurance-runtime.d.ts +10 -10
- package/dist/sdk/governance/assurance.d.ts +204 -204
- package/dist/sdk/governance/boundary-fixtures.d.ts +32 -32
- package/dist/sdk/governance/closure-timestamps.d.ts +10 -10
- package/dist/sdk/governance/coverage-assurance.d.ts +7 -7
- package/dist/sdk/governance/defect-recurrence-coverage.d.ts +40 -40
- package/dist/sdk/governance/defect-recurrence-graph.d.ts +11 -11
- package/dist/sdk/governance/defect-recurrence-signals.d.ts +1 -1
- package/dist/sdk/governance/defect-recurrence.d.ts +97 -97
- package/dist/sdk/governance/extension-host-version.d.ts +9 -9
- package/dist/sdk/governance/gc.d.ts +26 -26
- package/dist/sdk/governance/health-merge-evidence.d.ts +8 -8
- package/dist/sdk/governance/health.d.ts +172 -172
- package/dist/sdk/governance/health.js +1 -1
- package/dist/sdk/governance/hierarchy-validation.d.ts +16 -16
- package/dist/sdk/governance/linked-file-report.d.ts +15 -15
- package/dist/sdk/governance/merge-receipt-history.d.ts +24 -24
- package/dist/sdk/governance/provenance-health.d.ts +35 -35
- package/dist/sdk/governance/reindex.d.ts +102 -102
- package/dist/sdk/governance/reliability.d.ts +29 -29
- package/dist/sdk/governance/stale-work.d.ts +13 -13
- package/dist/sdk/governance/status-role-diagnostics.d.ts +8 -8
- package/dist/sdk/governance/storage-integrity.d.ts +28 -28
- package/dist/sdk/governance/tracked-runtime-cache.d.ts +7 -7
- package/dist/sdk/governance/upgrade.d.ts +77 -77
- package/dist/sdk/governance/validate-history-drift.d.ts +3 -3
- package/dist/sdk/governance/validate-item-reader.d.ts +9 -9
- package/dist/sdk/governance/validate-normalization.d.ts +4 -4
- package/dist/sdk/governance/validate.d.ts +176 -176
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/governance/workflow-completeness.d.ts +15 -15
- package/dist/sdk/governance/workflow-policy.d.ts +18 -18
- package/dist/sdk/governance/workspace-position.d.ts +40 -40
- package/dist/sdk/governance.d.ts +2 -2
- package/dist/sdk/graph/adapter.d.ts +45 -45
- package/dist/sdk/graph/analytics.d.ts +36 -36
- package/dist/sdk/graph/assembly.d.ts +51 -51
- package/dist/sdk/graph/cache.d.ts +19 -19
- package/dist/sdk/graph/cardinality-integrity.d.ts +4 -4
- package/dist/sdk/graph/centrality.d.ts +20 -20
- package/dist/sdk/graph/conformance.d.ts +21 -21
- package/dist/sdk/graph/deadline-scheduling.d.ts +30 -30
- package/dist/sdk/graph/durable-cache.d.ts +22 -22
- package/dist/sdk/graph/governance-contracts.d.ts +1 -1
- package/dist/sdk/graph/governance.d.ts +92 -92
- package/dist/sdk/graph/hierarchy-integrity.d.ts +32 -32
- package/dist/sdk/graph/index.d.ts +15 -15
- package/dist/sdk/graph/lifecycle-coverage.d.ts +12 -12
- package/dist/sdk/graph/mutation-advisory.d.ts +15 -15
- package/dist/sdk/graph/query-contracts.d.ts +6 -6
- package/dist/sdk/graph/remediation.d.ts +15 -15
- package/dist/sdk/graph/run.d.ts +203 -203
- package/dist/sdk/graph/scheduling.d.ts +21 -21
- package/dist/sdk/graph/traversal.d.ts +18 -18
- package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +1 -1
- package/dist/sdk/guide-topics.d.ts +19 -19
- package/dist/sdk/guide.d.ts +43 -43
- package/dist/sdk/history/attestation-command.d.ts +8 -8
- package/dist/sdk/history/attestation-contract.d.ts +43 -43
- package/dist/sdk/history/attestation-scan.d.ts +4 -4
- package/dist/sdk/history/attestation.d.ts +4 -4
- package/dist/sdk/history/maintenance.d.ts +25 -25
- package/dist/sdk/history/salvage.d.ts +19 -19
- package/dist/sdk/history/subject.d.ts +8 -8
- package/dist/sdk/history-analytics.d.ts +64 -64
- package/dist/sdk/history-compact.d.ts +67 -67
- package/dist/sdk/history-mcp.d.ts +7 -7
- package/dist/sdk/history-provenance.d.ts +40 -40
- package/dist/sdk/history-read.d.ts +24 -24
- package/dist/sdk/history-redact.d.ts +68 -68
- package/dist/sdk/history-repair.d.ts +92 -92
- package/dist/sdk/improvement-ledger-validation.d.ts +1 -1
- package/dist/sdk/improvement-ledger.d.ts +62 -62
- package/dist/sdk/index.d.ts +69 -69
- package/dist/sdk/init-agent-guidance.d.ts +68 -68
- package/dist/sdk/init.d.ts +117 -117
- package/dist/sdk/invocation-author.d.ts +1 -1
- package/dist/sdk/item-children.d.ts +15 -15
- package/dist/sdk/item-metadata-index.d.ts +2 -2
- package/dist/sdk/item-schedule.d.ts +9 -9
- package/dist/sdk/item-transaction.d.ts +73 -73
- package/dist/sdk/learnings.d.ts +23 -23
- package/dist/sdk/lifecycle/append.d.ts +8 -8
- package/dist/sdk/lifecycle/claim.d.ts +38 -38
- package/dist/sdk/lifecycle/close-many.d.ts +71 -71
- package/dist/sdk/lifecycle/close.d.ts +18 -18
- package/dist/sdk/lifecycle/copy.d.ts +10 -10
- package/dist/sdk/lifecycle/core-field-recovery.d.ts +1 -1
- package/dist/sdk/lifecycle/create.d.ts +88 -88
- package/dist/sdk/lifecycle/delete.d.ts +15 -15
- package/dist/sdk/lifecycle/event-validation-messages.d.ts +1 -1
- package/dist/sdk/lifecycle/focus.d.ts +6 -6
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +6 -6
- package/dist/sdk/lifecycle/legacy-none-tokens.d.ts +35 -35
- package/dist/sdk/lifecycle/lifecycle-transitions.d.ts +3 -3
- package/dist/sdk/lifecycle/mcp-actions.d.ts +10 -10
- package/dist/sdk/lifecycle/metadata-normalizers.d.ts +4 -4
- package/dist/sdk/lifecycle/mutation-command-options.d.ts +58 -58
- package/dist/sdk/lifecycle/mutation-facet-contracts.d.ts +1 -1
- package/dist/sdk/lifecycle/plan-mutation-receipt.d.ts +24 -24
- package/dist/sdk/lifecycle/plan.d.ts +127 -127
- package/dist/sdk/lifecycle/recurrence-parsers.d.ts +5 -5
- package/dist/sdk/lifecycle/reopen.d.ts +15 -15
- package/dist/sdk/lifecycle/repeatable-metadata-parsers.d.ts +7 -7
- package/dist/sdk/lifecycle/restore.d.ts +34 -34
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/shared-unset-fields.d.ts +20 -20
- package/dist/sdk/lifecycle/task-composition.d.ts +7 -7
- package/dist/sdk/lifecycle/update-many.d.ts +61 -61
- package/dist/sdk/lifecycle/update.d.ts +120 -120
- package/dist/sdk/lifecycle-completion.d.ts +14 -14
- package/dist/sdk/lifecycle-policy.d.ts +31 -31
- package/dist/sdk/linked-artifacts.d.ts +58 -58
- package/dist/sdk/mcp/apps.d.ts +28 -28
- package/dist/sdk/mcp/authorization.d.ts +66 -66
- package/dist/sdk/mcp/discovery.d.ts +67 -67
- package/dist/sdk/mcp/interactions.d.ts +49 -49
- package/dist/sdk/mcp/protocol.d.ts +63 -63
- package/dist/sdk/mcp/skills.d.ts +62 -62
- package/dist/sdk/mcp/subscriptions.d.ts +26 -26
- package/dist/sdk/mcp/tasks.d.ts +51 -51
- package/dist/sdk/mcp/transport.d.ts +17 -17
- package/dist/sdk/merge/abandoned-receipts.d.ts +8 -8
- package/dist/sdk/merge/driver.d.ts +38 -38
- package/dist/sdk/merge/index.d.ts +5 -5
- package/dist/sdk/merge/install.d.ts +48 -48
- package/dist/sdk/merge/receipt-file-boundary.d.ts +6 -6
- package/dist/sdk/merge/receipt-operation.d.ts +6 -6
- package/dist/sdk/merge/receipt-schema.d.ts +11 -11
- package/dist/sdk/merge/receipts.d.ts +111 -111
- package/dist/sdk/merge/reconcile.d.ts +20 -20
- package/dist/sdk/merge/three-way.d.ts +50 -50
- package/dist/sdk/merge/three-way.js +2 -2
- package/dist/sdk/merge/worktree-config.d.ts +3 -3
- package/dist/sdk/mutation-events.d.ts +62 -62
- package/dist/sdk/mutation-guard.d.ts +134 -134
- package/dist/sdk/notes.d.ts +28 -28
- package/dist/sdk/output/table-rows.d.ts +6 -6
- package/dist/sdk/output-contracts.d.ts +26 -26
- package/dist/sdk/output-projection.d.ts +108 -108
- package/dist/sdk/output-token-accounting.d.ts +18 -18
- package/dist/sdk/output.d.ts +18 -18
- package/dist/sdk/ownership-source.d.ts +1 -1
- package/dist/sdk/package-import-adapters.d.ts +51 -51
- package/dist/sdk/package-migrations.d.ts +3 -3
- package/dist/sdk/package-runtime-options.d.ts +3 -3
- package/dist/sdk/pagination.d.ts +28 -28
- package/dist/sdk/pagination.js +1 -1
- package/dist/sdk/profile.d.ts +72 -72
- package/dist/sdk/provenance.d.ts +37 -37
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/activity.d.ts +84 -84
- package/dist/sdk/query/aggregate.d.ts +109 -109
- package/dist/sdk/query/calendar.d.ts +95 -95
- package/dist/sdk/query/complete-list.d.ts +35 -35
- package/dist/sdk/query/context.d.ts +300 -300
- package/dist/sdk/query/duplicate-candidates.d.ts +3 -3
- package/dist/sdk/query/get.d.ts +54 -54
- package/dist/sdk/query/history.d.ts +38 -38
- package/dist/sdk/query/item-filter-options.d.ts +41 -41
- package/dist/sdk/query/light-metadata.d.ts +1 -1
- package/dist/sdk/query/list-filter-shared.d.ts +4 -4
- package/dist/sdk/query/list.d.ts +167 -167
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/multi-value-filters.d.ts +6 -6
- package/dist/sdk/query/next-ready-budget.d.ts +8 -8
- package/dist/sdk/query/next.d.ts +94 -94
- package/dist/sdk/query/parsers.d.ts +3 -3
- package/dist/sdk/query/projection-contracts.d.ts +18 -18
- package/dist/sdk/query/search/corpus.d.ts +15 -15
- package/dist/sdk/query/search/filters.d.ts +15 -15
- package/dist/sdk/query/search/input.d.ts +8 -8
- package/dist/sdk/query/search/lexical.d.ts +10 -10
- package/dist/sdk/query/search/response.d.ts +22 -22
- package/dist/sdk/query/search/semantic.d.ts +133 -133
- package/dist/sdk/query/search/types.d.ts +65 -65
- package/dist/sdk/query/search-contracts.d.ts +53 -53
- package/dist/sdk/query/search-pagination.d.ts +21 -21
- package/dist/sdk/query/search-rendering.d.ts +30 -30
- package/dist/sdk/query/search.d.ts +60 -60
- package/dist/sdk/query/workspace-contracts.d.ts +2 -2
- package/dist/sdk/query.d.ts +6 -6
- package/dist/sdk/read-output/continuation.d.ts +11 -11
- package/dist/sdk/read-output/extension.d.ts +3 -3
- package/dist/sdk/read-output/options.d.ts +7 -7
- package/dist/sdk/read-output/provenance.d.ts +6 -6
- package/dist/sdk/read-output-budget.d.ts +11 -11
- package/dist/sdk/read-output-contracts.d.ts +112 -112
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.d.ts +15 -15
- package/dist/sdk/read-output-session.d.ts +29 -29
- package/dist/sdk/relationship-analytics.d.ts +46 -46
- package/dist/sdk/relationship-context.d.ts +48 -48
- package/dist/sdk/relationship-history.d.ts +59 -59
- package/dist/sdk/relationship-kinds/contract.d.ts +18 -18
- package/dist/sdk/relationship-migration.d.ts +14 -14
- package/dist/sdk/relationships.d.ts +46 -46
- package/dist/sdk/reproducibility/process.d.ts +9 -9
- package/dist/sdk/runtime/actions.d.ts +1 -1
- package/dist/sdk/runtime/context.d.ts +15 -15
- package/dist/sdk/runtime/schema-preview.d.ts +1 -1
- package/dist/sdk/runtime/schema.d.ts +1 -1
- package/dist/sdk/runtime-action-aliases.d.ts +3 -3
- package/dist/sdk/runtime-extended-actions.d.ts +9 -9
- package/dist/sdk/runtime-input.d.ts +29 -29
- package/dist/sdk/runtime-primitives.d.ts +53 -53
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime-public-contracts.d.ts +46 -46
- package/dist/sdk/runtime-stats-options.d.ts +1 -1
- package/dist/sdk/runtime.d.ts +374 -374
- package/dist/sdk/scheduling-shortcuts.d.ts +19 -19
- package/dist/sdk/schema-migration.d.ts +79 -79
- package/dist/sdk/schema.d.ts +224 -224
- package/dist/sdk/search-refresh-worker.d.ts +1 -1
- package/dist/sdk/similarity-scoring.d.ts +10 -10
- package/dist/sdk/similarity.d.ts +73 -73
- package/dist/sdk/start-task-status.d.ts +1 -1
- package/dist/sdk/stats.d.ts +72 -72
- package/dist/sdk/structured-mutations.d.ts +13 -13
- package/dist/sdk/telemetry-flush.d.ts +1 -1
- package/dist/sdk/telemetry.d.ts +32 -32
- package/dist/sdk/templates.d.ts +35 -35
- package/dist/sdk/test/batch.d.ts +50 -50
- package/dist/sdk/test/command-args.d.ts +2 -2
- package/dist/sdk/test/entry.d.ts +4 -4
- package/dist/sdk/test/execution-receipts.d.ts +5 -5
- package/dist/sdk/test/execution.d.ts +247 -247
- package/dist/sdk/test/json-path.d.ts +4 -4
- package/dist/sdk/test/linked-command-detection.d.ts +36 -36
- package/dist/sdk/test/measurements.d.ts +10 -10
- package/dist/sdk/test/parsers.d.ts +18 -18
- package/dist/sdk/test/prerequisites.d.ts +3 -3
- package/dist/sdk/test/runs.d.ts +43 -43
- package/dist/sdk/test/trust.d.ts +15 -15
- package/dist/sdk/test/update.d.ts +23 -23
- package/dist/sdk/test/workspace-snapshot.d.ts +1 -1
- package/dist/sdk/testing.d.ts +248 -248
- package/dist/sdk/traceability/runtime-files-lookup.d.ts +1 -1
- package/dist/sdk/traceability/source-traceability.d.ts +50 -50
- package/dist/sdk/workspace-contracts-cache.d.ts +2 -2
- package/dist/sdk/workspace-contracts.d.ts +20 -20
- package/dist/sdk/workspace-memory.d.ts +42 -42
- package/dist/sdk/workspace-recipe.d.ts +9 -9
- package/dist/sdk/workspace-snapshot.d.ts +60 -60
- package/dist/sdk/workspace-transaction-gc.d.ts +17 -17
- package/dist/sdk/workspace-transaction.d.ts +26 -26
- package/dist/sdk/workspace.d.ts +9 -9
- package/dist/types.d.ts +540 -540
- package/docs/COMMANDS.md +11 -2
- package/docs/EXTENSION_AUTHOR_CONTRACTS.md +18 -4
- package/docs/LINKED_TEST_EDITS.md +15 -0
- package/docs/RELEASING.md +2 -0
- package/docs/TESTING.md +21 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +1 -1
- package/package.json +3 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/scripts/finalize-build.mjs +9 -3
- package/dist/cli-bundle/chunks/chunk-66BZVFIK.js +0 -6
- package/dist/cli-bundle/chunks/chunk-IDEHMKYZ.js +0 -235
- package/dist/cli-bundle/chunks/chunk-UNQZGMJL.js +0 -20
- package/dist/cli-bundle/chunks/chunk-YXRAYL7H.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JDVZF75H.js +0 -165
- package/dist/cli-bundle/focused-chunks/chunk-WIXZF5SS.js +0 -26
|
@@ -5,13 +5,13 @@ import { type MergeDecisionReceiptSummary } from "./receipts.js";
|
|
|
5
5
|
/** Options for the audited post-merge reconciliation workflow. */
|
|
6
6
|
export interface MergeReconcileOptions {
|
|
7
7
|
/** Preview drifted streams without mutating history. */
|
|
8
|
-
dryRun?:
|
|
8
|
+
dryRun?:boolean;
|
|
9
9
|
/** Attribution recorded on repair audit entries. */
|
|
10
|
-
author?:
|
|
10
|
+
author?:string;
|
|
11
11
|
/** Human-readable reason recorded on repair audit entries. */
|
|
12
|
-
message?:
|
|
12
|
+
message?:string;
|
|
13
13
|
/** Permit ownership overrides already supported by history repair. */
|
|
14
|
-
force?:
|
|
14
|
+
force?:boolean;
|
|
15
15
|
}
|
|
16
16
|
/** Structured post-merge reconciliation and verification result. */
|
|
17
17
|
export interface MergeReconcileResult {
|
|
@@ -20,33 +20,33 @@ export interface MergeReconcileResult {
|
|
|
20
20
|
* merge-critical validation. Dry-run previews therefore fail closed while
|
|
21
21
|
* drift or pending merge decisions still require an apply pass.
|
|
22
22
|
*/
|
|
23
|
-
ok:
|
|
23
|
+
ok:boolean;
|
|
24
24
|
/** Whether this invocation only previewed repairs. */
|
|
25
|
-
dry_run:
|
|
25
|
+
dry_run:boolean;
|
|
26
26
|
/** Bulk history repair preview or apply result. */
|
|
27
|
-
repair:
|
|
27
|
+
repair:HistoryRepairAllResult;
|
|
28
28
|
/** Clone-local merge receipts represented by merge history events. */
|
|
29
|
-
receipts:
|
|
30
|
-
pending_before:
|
|
31
|
-
reconciled:
|
|
29
|
+
receipts:{
|
|
30
|
+
pending_before:number;
|
|
31
|
+
reconciled:number;
|
|
32
32
|
/** Receipts proven to restore their original Git state; these do not represent applied merges. */
|
|
33
|
-
abandoned:
|
|
34
|
-
summaries:
|
|
33
|
+
abandoned:number;
|
|
34
|
+
summaries:MergeDecisionReceiptSummary[];
|
|
35
35
|
/** Missing durable references discovered before this reconciliation. */
|
|
36
|
-
missing_history_references_before:
|
|
36
|
+
missing_history_references_before:number;
|
|
37
37
|
/** Pre-durable references eligible for explicit audited disposition. */
|
|
38
|
-
legacy_disposition_eligible:
|
|
38
|
+
legacy_disposition_eligible:number;
|
|
39
39
|
/** Eligible references dispositioned by this apply pass. */
|
|
40
|
-
legacy_disposition_recorded:
|
|
40
|
+
legacy_disposition_recorded:number;
|
|
41
41
|
/** Missing durable references still blocking health after this pass. */
|
|
42
|
-
missing_history_references_after:
|
|
42
|
+
missing_history_references_after:number;
|
|
43
43
|
};
|
|
44
44
|
/** Post-operation history-drift and storage-integrity validation. */
|
|
45
|
-
validation:
|
|
45
|
+
validation:ValidateResult;
|
|
46
46
|
/** Stable next-step guidance for Git hooks and interactive agents. */
|
|
47
|
-
guidance:
|
|
47
|
+
guidance:string[];
|
|
48
48
|
/** ISO timestamp copied from the validation pass. */
|
|
49
|
-
generated_at:
|
|
49
|
+
generated_at:string;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Preview or apply post-merge history reconciliation and immediately validate
|
|
@@ -54,4 +54,4 @@ generated_at: string;
|
|
|
54
54
|
* callers opt into this command after Git finishes; installing merge drivers
|
|
55
55
|
* does not silently install or mutate repository hooks.
|
|
56
56
|
*/
|
|
57
|
-
export declare function runMergeReconcile(options:
|
|
57
|
+
export declare function runMergeReconcile(options:MergeReconcileOptions,global:GlobalOptions):Promise<MergeReconcileResult>;
|
|
@@ -6,33 +6,33 @@ export type ItemScalarConflictResolution = "preferred_side" | "stable_value_orde
|
|
|
6
6
|
/** Explains the exact evidence used to select one conflicting item scalar. */
|
|
7
7
|
export type ItemScalarResolutionBasis = "requested_preference" | "document_updated_at" | "stable_value_tiebreak";
|
|
8
8
|
/** JSON-stable marker used when a conflict decision refers to an absent scalar. */
|
|
9
|
-
export declare const ITEM_SCALAR_MISSING_VALUE:
|
|
10
|
-
readonly pm_item_scalar_missing:
|
|
9
|
+
export declare const ITEM_SCALAR_MISSING_VALUE:Readonly<{
|
|
10
|
+
readonly pm_item_scalar_missing:true;
|
|
11
11
|
}>;
|
|
12
12
|
/** Return whether receipt evidence represents an absent item scalar. */
|
|
13
|
-
export declare function isItemScalarMissingValue(value:
|
|
13
|
+
export declare function isItemScalarMissingValue(value:unknown):value is typeof ITEM_SCALAR_MISSING_VALUE;
|
|
14
14
|
/** Encode an absent scalar so every decision property survives JSON serialization. */
|
|
15
|
-
export declare function encodeItemScalarDecisionValue(value:
|
|
15
|
+
export declare function encodeItemScalarDecisionValue(value:unknown):unknown;
|
|
16
16
|
/** Hash scalars in disjoint present/missing domains for collision-free evidence. */
|
|
17
|
-
export declare function hashItemScalarDecisionValue(value:
|
|
17
|
+
export declare function hashItemScalarDecisionValue(value:unknown):string;
|
|
18
18
|
/** Restricts the strategy labels reported by the history stream merge. */
|
|
19
19
|
export type HistoryMergeStrategy = "identical" | "fast_forward_ours" | "fast_forward_theirs" | "union_reanchor";
|
|
20
20
|
/** Documents the history stream merge result payload exchanged by command, SDK, and package integrations. */
|
|
21
21
|
export interface HistoryMergeResult {
|
|
22
22
|
/** Merged JSONL content ready to be written as the resolved history stream. */
|
|
23
|
-
merged:
|
|
23
|
+
merged:string;
|
|
24
24
|
/** Strategy the merge used: identical inputs, one-sided fast-forward, or a deterministic union with a re-anchored hash chain. */
|
|
25
|
-
strategy:
|
|
25
|
+
strategy:HistoryMergeStrategy;
|
|
26
26
|
/** Number of entries shared by both sides before their streams diverged. */
|
|
27
|
-
common_entries:
|
|
27
|
+
common_entries:number;
|
|
28
28
|
/** Number of divergent entries contributed by the ours side. */
|
|
29
|
-
entries_from_ours:
|
|
29
|
+
entries_from_ours:number;
|
|
30
30
|
/** Number of divergent entries contributed by the theirs side. */
|
|
31
|
-
entries_from_theirs:
|
|
31
|
+
entries_from_theirs:number;
|
|
32
32
|
/** Total entries in the merged stream. */
|
|
33
|
-
entries_total:
|
|
33
|
+
entries_total:number;
|
|
34
34
|
/** Whether the merged chain required hash re-anchoring (true for every union merge). */
|
|
35
|
-
reanchored:
|
|
35
|
+
reanchored:boolean;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Deterministically merge two diverged versions of one append-only history
|
|
@@ -47,23 +47,23 @@ reanchored: boolean;
|
|
|
47
47
|
* deterministic ordering, the merge fails closed instead of publishing a
|
|
48
48
|
* hash-valid stream that omitted a branch effect.
|
|
49
49
|
*/
|
|
50
|
-
export declare function mergeHistoryStreams(baseRaw:
|
|
50
|
+
export declare function mergeHistoryStreams(baseRaw:string,oursRaw:string,theirsRaw:string):HistoryMergeResult;
|
|
51
51
|
/** Documents the relationship event stream merge result payload exchanged by command, SDK, and package integrations. */
|
|
52
52
|
export interface RelationshipStreamMergeResult {
|
|
53
53
|
/** Merged JSONL content with consecutively renumbered `sequence` values, ready to be written as the resolved event store. */
|
|
54
|
-
merged:
|
|
54
|
+
merged:string;
|
|
55
55
|
/** Strategy the merge used: identical inputs, one-sided fast-forward, or a deterministic union with renumbered sequences. */
|
|
56
|
-
strategy:
|
|
56
|
+
strategy:HistoryMergeStrategy;
|
|
57
57
|
/** Number of events shared by both sides before their streams diverged. */
|
|
58
|
-
common_entries:
|
|
58
|
+
common_entries:number;
|
|
59
59
|
/** Number of divergent events contributed by the ours side. */
|
|
60
|
-
entries_from_ours:
|
|
60
|
+
entries_from_ours:number;
|
|
61
61
|
/** Number of divergent events contributed by the theirs side. */
|
|
62
|
-
entries_from_theirs:
|
|
62
|
+
entries_from_theirs:number;
|
|
63
63
|
/** Total events in the merged stream. */
|
|
64
|
-
entries_total:
|
|
64
|
+
entries_total:number;
|
|
65
65
|
/** Whether merged events required sequence renumbering (true for every union merge). */
|
|
66
|
-
reanchored:
|
|
66
|
+
reanchored:boolean;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Deterministically merge two diverged versions of one append-only
|
|
@@ -74,7 +74,7 @@ reanchored: boolean;
|
|
|
74
74
|
* ours-first on ties), and renumbers every merged sequence consecutively so
|
|
75
75
|
* the resulting stream loads again. No side's events are ever discarded.
|
|
76
76
|
*/
|
|
77
|
-
export declare function mergeRelationshipEventStreams(baseRaw:
|
|
77
|
+
export declare function mergeRelationshipEventStreams(baseRaw:string,oursRaw:string,theirsRaw:string):RelationshipStreamMergeResult;
|
|
78
78
|
/**
|
|
79
79
|
* Item metadata collections merged by element-identity set semantics instead
|
|
80
80
|
* of whole-field three-way comparison: concurrent commutative appends from two
|
|
@@ -85,46 +85,46 @@ export declare function mergeRelationshipEventStreams(baseRaw: string, oursRaw:
|
|
|
85
85
|
* steps carry cross-element ordering invariants that set-union would corrupt,
|
|
86
86
|
* so they stay under scalar three-way semantics with explicit conflicts.
|
|
87
87
|
*/
|
|
88
|
-
export declare const ITEM_UNION_COLLECTION_FIELDS:
|
|
88
|
+
export declare const ITEM_UNION_COLLECTION_FIELDS:readonly ["tags","dependencies","comments","notes","learnings","files","tests","test_runs","docs","reminders","events"];
|
|
89
89
|
/** Item metadata fields resolved by deterministic latest-timestamp-wins instead of three-way conflict, so disjoint-field edits never conflict on the shared freshness scalar every mutation rewrites. */
|
|
90
|
-
export declare const ITEM_LATEST_TIMESTAMP_FIELDS:
|
|
90
|
+
export declare const ITEM_LATEST_TIMESTAMP_FIELDS:readonly ["updated_at"];
|
|
91
91
|
/** Documents one recoverable scalar decision made during an item merge. */
|
|
92
92
|
export interface ItemMergeConflictDecision {
|
|
93
93
|
/** Metadata field name, or `body`. */
|
|
94
|
-
field:
|
|
94
|
+
field:string;
|
|
95
95
|
/** Common-ancestor value. */
|
|
96
|
-
base:
|
|
96
|
+
base:unknown;
|
|
97
97
|
/** Current-branch value. */
|
|
98
|
-
ours:
|
|
98
|
+
ours:unknown;
|
|
99
99
|
/** Other-branch value. */
|
|
100
|
-
theirs:
|
|
100
|
+
theirs:unknown;
|
|
101
101
|
/** Value retained in the merged item. */
|
|
102
|
-
retained:
|
|
102
|
+
retained:unknown;
|
|
103
103
|
/** Value not retained in the merged item. */
|
|
104
|
-
discarded:
|
|
104
|
+
discarded:unknown;
|
|
105
105
|
/** Branch coordinate whose value was retained. */
|
|
106
|
-
retained_side?:
|
|
106
|
+
retained_side?:MergePreferredSide;
|
|
107
107
|
/** Evidence class that selected the retained value. */
|
|
108
|
-
resolution_basis?:
|
|
108
|
+
resolution_basis?:ItemScalarResolutionBasis;
|
|
109
109
|
}
|
|
110
110
|
/** Documents the item document merge result payload exchanged by command, SDK, and package integrations. */
|
|
111
111
|
export interface ItemDocumentMergeResult {
|
|
112
112
|
/** Serialized merged item document (always parseable; count headers recomputed by canonical serialization). */
|
|
113
|
-
merged:
|
|
113
|
+
merged:string;
|
|
114
114
|
/** Metadata fields (plus `body`) where both sides changed to different values; resolved toward the preferred side. */
|
|
115
|
-
conflict_fields:
|
|
115
|
+
conflict_fields:string[];
|
|
116
116
|
/** Fields taken from the theirs side by clean three-way resolution. */
|
|
117
|
-
fields_from_theirs:
|
|
117
|
+
fields_from_theirs:string[];
|
|
118
118
|
/** Collection fields that merged by element-identity union. */
|
|
119
|
-
union_fields:
|
|
119
|
+
union_fields:string[];
|
|
120
120
|
/** Scalar conflict decisions; callers choose a privacy-appropriate persistence boundary. */
|
|
121
|
-
conflict_decisions:
|
|
121
|
+
conflict_decisions:ItemMergeConflictDecision[];
|
|
122
122
|
/** Side requested by the caller; stable-value decisions can retain either side. */
|
|
123
|
-
requested_preference:
|
|
123
|
+
requested_preference:MergePreferredSide;
|
|
124
124
|
/** Whether the requested side participates in item scalar selection under the declared policy. */
|
|
125
|
-
requested_preference_applied:
|
|
125
|
+
requested_preference_applied:boolean;
|
|
126
126
|
/** Scalar-conflict selection contract used for this merge. */
|
|
127
|
-
conflict_resolution:
|
|
127
|
+
conflict_resolution:ItemScalarConflictResolution;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* Field-aware three-way merge of one tracker item document. Commutative
|
|
@@ -138,22 +138,22 @@ conflict_resolution: ItemScalarConflictResolution;
|
|
|
138
138
|
* recomputed, so the hand-resolution corruption class (stale `notes[N]`
|
|
139
139
|
* headers) cannot be produced by this merge.
|
|
140
140
|
*/
|
|
141
|
-
export declare function mergeItemDocuments(baseRaw:
|
|
141
|
+
export declare function mergeItemDocuments(baseRaw:string,oursRaw:string,theirsRaw:string,options?:ItemDocumentFormatOptions & {
|
|
142
142
|
/** Side that wins unresolvable conflicts (default "ours"). */
|
|
143
|
-
preferred?:
|
|
143
|
+
preferred?:MergePreferredSide;
|
|
144
144
|
/** Direction-independent scalar selection used by the Git driver. */
|
|
145
|
-
conflictResolution?:
|
|
146
|
-
}):
|
|
145
|
+
conflictResolution?:ItemScalarConflictResolution;
|
|
146
|
+
}):ItemDocumentMergeResult;
|
|
147
147
|
/** Documents the JSON document merge result payload exchanged by command, SDK, and package integrations. */
|
|
148
148
|
export interface JsonDocumentMergeResult {
|
|
149
149
|
/** Serialized merged JSON document (two-space indent, trailing newline — the tracker's canonical config style). */
|
|
150
|
-
merged:
|
|
150
|
+
merged:string;
|
|
151
151
|
/** Dotted key paths where both sides changed to different values; resolved toward the preferred side. */
|
|
152
|
-
conflict_paths:
|
|
152
|
+
conflict_paths:string[];
|
|
153
153
|
/** Dotted key paths taken from the theirs side by clean three-way resolution. */
|
|
154
|
-
paths_from_theirs:
|
|
154
|
+
paths_from_theirs:string[];
|
|
155
155
|
/** Which side unresolvable conflicts were resolved toward. */
|
|
156
|
-
preferred:
|
|
156
|
+
preferred:MergePreferredSide;
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
159
|
* Key-level three-way merge for the tracker's JSON configuration artifacts.
|
|
@@ -163,7 +163,7 @@ preferred: MergePreferredSide;
|
|
|
163
163
|
* always valid JSON, so merged configuration cannot regress into the
|
|
164
164
|
* silent-defaults fallback that raw conflict markers cause.
|
|
165
165
|
*/
|
|
166
|
-
export declare function mergeJsonDocuments(baseRaw:
|
|
166
|
+
export declare function mergeJsonDocuments(baseRaw:string,oursRaw:string,theirsRaw:string,options?:{
|
|
167
167
|
/** Side that wins unresolvable conflicts (default "ours"). */
|
|
168
|
-
preferred?:
|
|
169
|
-
}):
|
|
168
|
+
preferred?:MergePreferredSide;
|
|
169
|
+
}):JsonDocumentMergeResult;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c7589997-de92-502d-8e61-ac61b67fe6cd")}catch{}})();import{cloneEmptyReplayDocument,historyEntriesToRaw,normalizeReplayPatchOps,reanchorHistoryEntries,toReplayDocument,tryApplyReplayPatch}from"../../core/history/replay.js";import jsonPatch from"fast-json-patch";import{canonicalDocument,parseItemDocument,serializeItemDocument}from"../../core/item/item-format.js";import{splitAcceptanceCriteria}from"../../core/item/parse.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{findFirstMergeConflictMarker}from"../../core/shared/conflict-markers.js";import{PmCliError}from"../../core/shared/errors.js";import{sha256Hex,stableStringify}from"../../core/shared/serialization.js";import{compareTimestampStrings}from"../../core/shared/time.js";const ITEM_SCALAR_MISSING_VALUE=Object.freeze({pm_item_scalar_missing:!0});function isItemScalarMissingValue(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)&&Object.keys(value).length===1&&value.pm_item_scalar_missing===!0}function encodeItemScalarDecisionValue(value){return value===void 0?ITEM_SCALAR_MISSING_VALUE:value}function hashItemScalarDecisionValue(value){return sha256Hex(stableStringify(value===void 0?{pm_item_scalar_presence:"missing"}:{pm_item_scalar_presence:"present",value}))}function parseHistoryJsonl(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker)throw new PmCliError(`History merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,EXIT_CODE.GENERIC_FAILURE);const entries=[];for(const[index,rawLine]of raw.split(/\r?\n/).entries()){const line=rawLine.trim();if(line)try{const parsed=JSON.parse(line);if(typeof parsed!="object"||parsed===null||Array.isArray(parsed))throw new TypeError("history entry must be an object");entries.push(parsed)}catch{throw new PmCliError(`History merge input (${label}) contains invalid JSON at line ${index+1}.`,EXIT_CODE.GENERIC_FAILURE)}}return entries}function historyEntryIdentity(entry){return stableStringify({ts:entry.ts,author:entry.author,op:entry.op,patch:entry.patch,message:entry.message??null})}function commonHistoryPrefixLength(ours,theirs){const limit=Math.min(ours.length,theirs.length);let shared=0;for(;shared<limit&&historyEntryIdentity(ours[shared])===historyEntryIdentity(theirs[shared]);)shared+=1;return shared}function orderHistoryUnionSuffix(ours,theirs,incoming,oursIdentities){const entries=[...ours,...incoming],positions=new Map(entries.map((entry,index)=>[entry,index])),aliases=new Map(entries.map((entry,index)=>[historyEntryIdentity(entry),index])),successors=entries.map(()=>new Set);for(const branch of[ours,theirs]){const coordinates=branch.map(entry=>positions.get(entry)??aliases.get(historyEntryIdentity(entry)));for(let index=1;index<coordinates.length;index+=1)coordinates[index-1]!==coordinates[index]&&successors[coordinates[index-1]].add(coordinates[index])}const predecessors=entries.map(()=>0);for(const targets of successors)for(const target of targets)predecessors[target]+=1;const ready=entries.map((_,index)=>index).filter(index=>predecessors[index]===0),result=[];for(;ready.length>0;){ready.sort((leftIndex,rightIndex)=>{const left=entries[leftIndex],right=entries[rightIndex],byTs=compareTimestampStrings(left.ts,right.ts),leftIdentity=historyEntryIdentity(left),rightIdentity=historyEntryIdentity(right);return byTs||Number(oursIdentities.has(rightIdentity))-Number(oursIdentities.has(leftIdentity))});const index=ready.shift();result.push(entries[index]);for(const target of successors[index])predecessors[target]-=1,predecessors[target]===0&&ready.push(target)}if(result.length!==entries.length)throw new PmCliError("History union cannot preserve contradictory original branch event orders; leave the file unresolved for manual recovery.",EXIT_CODE.GENERIC_FAILURE);return result}function createHistoryBranchProjection(entries){return{entries,positions:new Map(entries.map((entry,index)=>[historyEntryIdentity(entry),index])),index:-1,document:cloneEmptyReplayDocument()}}function advanceHistoryBranch(state,target){const end=target??state.index;for(;state.index<end;){const applied=tryApplyReplayPatch(state.document,state.entries[state.index+1].patch);if(!applied.ok)throw new PmCliError("History union cannot preserve a patch that does not apply in its original branch.",EXIT_CODE.GENERIC_FAILURE);state.document=applied.document,state.index+=1}return state.document}function advanceOrderedHistoryBranch(state,target){if(target!==void 0&&target>state.index+1)throw new PmCliError("History union cannot attribute multiple original branch events to one semantic identity; preserve the source histories for manual recovery.",EXIT_CODE.GENERIC_FAILURE);return advanceHistoryBranch(state,target)}function historyUnionPatchProjection(ours,theirs,shared){if(shared===0)return;const oursBranch=createHistoryBranchProjection(ours),theirsBranch=createHistoryBranchProjection(theirs),prefix=advanceHistoryBranch(oursBranch,shared-1);advanceHistoryBranch(theirsBranch,shared-1);let position=0;const unionFields=new Set([...ITEM_UNION_COLLECTION_FIELDS,...ITEM_UNION_DELIMITED_FIELDS]);return(entry,current)=>{if(position++<shared)return entry.patch;const identity=historyEntryIdentity(entry),oursState=advanceOrderedHistoryBranch(oursBranch,oursBranch.positions.get(identity)),theirsState=advanceOrderedHistoryBranch(theirsBranch,theirsBranch.positions.get(identity)),scalarPatch=normalizeReplayPatchOps(entry.patch).filter(operation=>{const[root,field]=operation.path.slice(1).split("/");return root!=="metadata"||!unionFields.has(field)}),scalar=tryApplyReplayPatch(current,scalarPatch);if(!scalar.ok)throw new PmCliError("History union cannot rebase a scalar patch onto the merged replay position; leave the file unresolved for manual recovery.",EXIT_CODE.GENERIC_FAILURE);const merged=mergeItemMetadataRecords(prefix.metadata,oursState.metadata,theirsState.metadata,"ours","latest_document_update",String(oursState.metadata.updated_at),String(theirsState.metadata.updated_at)),next=scalar.document;for(const field of unionFields)Object.hasOwn(merged.merged,field)?next.metadata[field]=merged.merged[field]:delete next.metadata[field];const canonical=toReplayDocument({metadata:next.metadata,body:next.body});return jsonPatch.compare(current,canonical)}}function mergeHistoryStreams(baseRaw,oursRaw,theirsRaw){const base=parseHistoryJsonl(baseRaw,"base"),ours=parseHistoryJsonl(oursRaw,"ours"),theirs=parseHistoryJsonl(theirsRaw,"theirs"),creates=[base,ours,theirs].map(entries=>entries.filter(entry=>entry.op==="create"));if(creates[0].length===0&&creates.slice(1).every(entries=>entries.length>0)||creates.some(entries=>entries.length>1)||new Set(creates.flat().map(historyEntryIdentity)).size>1)throw new PmCliError("Duplicate item identity: history contains independent or unproven create events. Preserve both branches and assign distinct item ids before merging.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict"});const shared=commonHistoryPrefixLength(ours,theirs);if(shared===ours.length&&shared===theirs.length)return{merged:historyEntriesToRaw(ours),strategy:"identical",common_entries:shared,entries_from_ours:0,entries_from_theirs:0,entries_total:ours.length,reanchored:!1};if(shared===theirs.length)return{merged:historyEntriesToRaw(ours),strategy:"fast_forward_ours",common_entries:shared,entries_from_ours:ours.length-shared,entries_from_theirs:0,entries_total:ours.length,reanchored:!1};if(shared===ours.length)return{merged:historyEntriesToRaw(theirs),strategy:"fast_forward_theirs",common_entries:shared,entries_from_ours:0,entries_from_theirs:theirs.length-shared,entries_total:theirs.length,reanchored:!1};const oursSuffix=ours.slice(shared),seenIdentities=new Set(oursSuffix.map(historyEntryIdentity)),theirsSuffix=theirs.slice(shared).filter(entry=>!seenIdentities.has(historyEntryIdentity(entry))),mergedSuffix=orderHistoryUnionSuffix(oursSuffix,theirs.slice(shared),theirsSuffix,seenIdentities),reanchored=reanchorHistoryEntries([...ours.slice(0,shared),...mergedSuffix],void 0,{continuousHashSurface:!0,projectPatch:historyUnionPatchProjection(ours,theirs,shared)});if(reanchored.skippedOps>0)throw new PmCliError(`History union cannot preserve ${reanchored.skippedOps} patch operation(s) after deterministic suffix ordering; leave the file unresolved for manual recovery.`,EXIT_CODE.GENERIC_FAILURE);return{merged:historyEntriesToRaw(reanchored.entries),strategy:"union_reanchor",common_entries:shared,entries_from_ours:oursSuffix.length,entries_from_theirs:theirsSuffix.length,entries_total:reanchored.entries.length,reanchored:!0}}function parseRelationshipJsonl(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker)throw new PmCliError(`Relationship merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,EXIT_CODE.GENERIC_FAILURE);const events=[];for(const[index,rawLine]of raw.split(/\r?\n/).entries()){const line=rawLine.trim();if(!line)continue;let parsed;try{parsed=JSON.parse(line)}catch{throw new PmCliError(`Relationship merge input (${label}) contains invalid JSON at line ${index+1}.`,EXIT_CODE.GENERIC_FAILURE)}if(typeof parsed!="object"||parsed===null||Array.isArray(parsed)||typeof parsed.eventId!="string"||typeof parsed.sequence!="number")throw new PmCliError(`Relationship merge input (${label}) line ${index+1} is not a relationship event (eventId + sequence required).`,EXIT_CODE.GENERIC_FAILURE);events.push(parsed)}return events}function relationshipEventsToRaw(events){return events.length===0?"":`${events.map(event=>JSON.stringify(event)).join(`
|
|
1
|
+
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f6def6d2-fbf3-55ce-8654-0c4e76d78a2a")}catch{}})();import{cloneEmptyReplayDocument,historyEntriesToRaw,normalizeReplayPatchOps,reanchorHistoryEntries,toReplayDocument,tryApplyReplayPatch}from"../../core/history/replay.js";import jsonPatch from"fast-json-patch";import{canonicalDocument,parseItemDocument,serializeItemDocument}from"../../core/item/item-format.js";import{splitAcceptanceCriteria}from"../../core/item/parse.js";import{normalizeItemFormatVersion,requiredItemFormatVersion}from"../../core/item/item-format-version.js";import{EXIT_CODE}from"../../core/shared/constants.js";import{findFirstMergeConflictMarker}from"../../core/shared/conflict-markers.js";import{PmCliError}from"../../core/shared/errors.js";import{sha256Hex,stableStringify}from"../../core/shared/serialization.js";import{compareTimestampStrings}from"../../core/shared/time.js";const ITEM_SCALAR_MISSING_VALUE=Object.freeze({pm_item_scalar_missing:!0});function isItemScalarMissingValue(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)&&Object.keys(value).length===1&&value.pm_item_scalar_missing===!0}function encodeItemScalarDecisionValue(value){return value===void 0?ITEM_SCALAR_MISSING_VALUE:value}function hashItemScalarDecisionValue(value){return sha256Hex(stableStringify(value===void 0?{pm_item_scalar_presence:"missing"}:{pm_item_scalar_presence:"present",value}))}function parseHistoryJsonl(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker)throw new PmCliError(`History merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,EXIT_CODE.GENERIC_FAILURE);const entries=[];for(const[index,rawLine]of raw.split(/\r?\n/).entries()){const line=rawLine.trim();if(line)try{const parsed=JSON.parse(line);if(typeof parsed!="object"||parsed===null||Array.isArray(parsed))throw new TypeError("history entry must be an object");entries.push(parsed)}catch{throw new PmCliError(`History merge input (${label}) contains invalid JSON at line ${index+1}.`,EXIT_CODE.GENERIC_FAILURE)}}return entries}function historyEntryIdentity(entry){return stableStringify({ts:entry.ts,author:entry.author,op:entry.op,patch:entry.patch,message:entry.message??null})}function commonHistoryPrefixLength(ours,theirs){const limit=Math.min(ours.length,theirs.length);let shared=0;for(;shared<limit&&historyEntryIdentity(ours[shared])===historyEntryIdentity(theirs[shared]);)shared+=1;return shared}function orderHistoryUnionSuffix(ours,theirs,incoming,oursIdentities){const entries=[...ours,...incoming],positions=new Map(entries.map((entry,index)=>[entry,index])),aliases=new Map(entries.map((entry,index)=>[historyEntryIdentity(entry),index])),successors=entries.map(()=>new Set);for(const branch of[ours,theirs]){const coordinates=branch.map(entry=>positions.get(entry)??aliases.get(historyEntryIdentity(entry)));for(let index=1;index<coordinates.length;index+=1)coordinates[index-1]!==coordinates[index]&&successors[coordinates[index-1]].add(coordinates[index])}const predecessors=entries.map(()=>0);for(const targets of successors)for(const target of targets)predecessors[target]+=1;const ready=entries.map((_,index)=>index).filter(index=>predecessors[index]===0),result=[];for(;ready.length>0;){ready.sort((leftIndex,rightIndex)=>{const left=entries[leftIndex],right=entries[rightIndex],byTs=compareTimestampStrings(left.ts,right.ts),leftIdentity=historyEntryIdentity(left),rightIdentity=historyEntryIdentity(right);return byTs||Number(oursIdentities.has(rightIdentity))-Number(oursIdentities.has(leftIdentity))});const index=ready.shift();result.push(entries[index]);for(const target of successors[index])predecessors[target]-=1,predecessors[target]===0&&ready.push(target)}if(result.length!==entries.length)throw new PmCliError("History union cannot preserve contradictory original branch event orders; leave the file unresolved for manual recovery.",EXIT_CODE.GENERIC_FAILURE);return result}function createHistoryBranchProjection(entries){return{entries,positions:new Map(entries.map((entry,index)=>[historyEntryIdentity(entry),index])),index:-1,document:cloneEmptyReplayDocument()}}function advanceHistoryBranch(state,target){const end=target??state.index;for(;state.index<end;){const applied=tryApplyReplayPatch(state.document,state.entries[state.index+1].patch);if(!applied.ok)throw new PmCliError("History union cannot preserve a patch that does not apply in its original branch.",EXIT_CODE.GENERIC_FAILURE);state.document=applied.document,state.index+=1}return state.document}function advanceOrderedHistoryBranch(state,target){if(target!==void 0&&target>state.index+1)throw new PmCliError("History union cannot attribute multiple original branch events to one semantic identity; preserve the source histories for manual recovery.",EXIT_CODE.GENERIC_FAILURE);return advanceHistoryBranch(state,target)}function historyUnionPatchProjection(ours,theirs,shared){if(shared===0)return;const oursBranch=createHistoryBranchProjection(ours),theirsBranch=createHistoryBranchProjection(theirs),prefix=advanceHistoryBranch(oursBranch,shared-1);advanceHistoryBranch(theirsBranch,shared-1);let position=0;const unionFields=new Set([...ITEM_UNION_COLLECTION_FIELDS,...ITEM_UNION_DELIMITED_FIELDS]);return(entry,current)=>{if(position++<shared)return entry.patch;const identity=historyEntryIdentity(entry),oursState=advanceOrderedHistoryBranch(oursBranch,oursBranch.positions.get(identity)),theirsState=advanceOrderedHistoryBranch(theirsBranch,theirsBranch.positions.get(identity)),scalarPatch=normalizeReplayPatchOps(entry.patch).filter(operation=>{const[root,field]=operation.path.slice(1).split("/");return root!=="metadata"||!unionFields.has(field)}),scalar=tryApplyReplayPatch(current,scalarPatch);if(!scalar.ok)throw new PmCliError("History union cannot rebase a scalar patch onto the merged replay position; leave the file unresolved for manual recovery.",EXIT_CODE.GENERIC_FAILURE);const merged=mergeItemMetadataRecords(prefix.metadata,oursState.metadata,theirsState.metadata,"ours","latest_document_update",String(oursState.metadata.updated_at),String(theirsState.metadata.updated_at)),next=scalar.document;for(const field of unionFields)Object.hasOwn(merged.merged,field)?next.metadata[field]=merged.merged[field]:delete next.metadata[field];const canonical=toReplayDocument({metadata:next.metadata,body:next.body});return jsonPatch.compare(current,canonical)}}function mergeHistoryStreams(baseRaw,oursRaw,theirsRaw){const base=parseHistoryJsonl(baseRaw,"base"),ours=parseHistoryJsonl(oursRaw,"ours"),theirs=parseHistoryJsonl(theirsRaw,"theirs"),creates=[base,ours,theirs].map(entries=>entries.filter(entry=>entry.op==="create"));if(creates[0].length===0&&creates.slice(1).every(entries=>entries.length>0)||creates.some(entries=>entries.length>1)||new Set(creates.flat().map(historyEntryIdentity)).size>1)throw new PmCliError("Duplicate item identity: history contains independent or unproven create events. Preserve both branches and assign distinct item ids before merging.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict"});const shared=commonHistoryPrefixLength(ours,theirs);if(shared===ours.length&&shared===theirs.length)return{merged:historyEntriesToRaw(ours),strategy:"identical",common_entries:shared,entries_from_ours:0,entries_from_theirs:0,entries_total:ours.length,reanchored:!1};if(shared===theirs.length)return{merged:historyEntriesToRaw(ours),strategy:"fast_forward_ours",common_entries:shared,entries_from_ours:ours.length-shared,entries_from_theirs:0,entries_total:ours.length,reanchored:!1};if(shared===ours.length)return{merged:historyEntriesToRaw(theirs),strategy:"fast_forward_theirs",common_entries:shared,entries_from_ours:0,entries_from_theirs:theirs.length-shared,entries_total:theirs.length,reanchored:!1};const oursSuffix=ours.slice(shared),seenIdentities=new Set(oursSuffix.map(historyEntryIdentity)),theirsSuffix=theirs.slice(shared).filter(entry=>!seenIdentities.has(historyEntryIdentity(entry))),mergedSuffix=orderHistoryUnionSuffix(oursSuffix,theirs.slice(shared),theirsSuffix,seenIdentities),reanchored=reanchorHistoryEntries([...ours.slice(0,shared),...mergedSuffix],void 0,{continuousHashSurface:!0,projectPatch:historyUnionPatchProjection(ours,theirs,shared)});if(reanchored.skippedOps>0)throw new PmCliError(`History union cannot preserve ${reanchored.skippedOps} patch operation(s) after deterministic suffix ordering; leave the file unresolved for manual recovery.`,EXIT_CODE.GENERIC_FAILURE);return{merged:historyEntriesToRaw(reanchored.entries),strategy:"union_reanchor",common_entries:shared,entries_from_ours:oursSuffix.length,entries_from_theirs:theirsSuffix.length,entries_total:reanchored.entries.length,reanchored:!0}}function parseRelationshipJsonl(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker)throw new PmCliError(`Relationship merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,EXIT_CODE.GENERIC_FAILURE);const events=[];for(const[index,rawLine]of raw.split(/\r?\n/).entries()){const line=rawLine.trim();if(!line)continue;let parsed;try{parsed=JSON.parse(line)}catch{throw new PmCliError(`Relationship merge input (${label}) contains invalid JSON at line ${index+1}.`,EXIT_CODE.GENERIC_FAILURE)}if(typeof parsed!="object"||parsed===null||Array.isArray(parsed)||typeof parsed.eventId!="string"||typeof parsed.sequence!="number")throw new PmCliError(`Relationship merge input (${label}) line ${index+1} is not a relationship event (eventId + sequence required).`,EXIT_CODE.GENERIC_FAILURE);events.push(parsed)}return events}function relationshipEventsToRaw(events){return events.length===0?"":`${events.map(event=>JSON.stringify(event)).join(`
|
|
2
2
|
`)}
|
|
3
|
-
`}function renumberRelationshipEvents(events){return events.map((event,index)=>({...event,sequence:index+1}))}function mergeRelationshipEventStreams(baseRaw,oursRaw,theirsRaw){parseRelationshipJsonl(baseRaw,"base");const ours=parseRelationshipJsonl(oursRaw,"ours"),theirs=parseRelationshipJsonl(theirsRaw,"theirs"),limit=Math.min(ours.length,theirs.length);let shared=0;for(;shared<limit&&ours[shared].eventId===theirs[shared].eventId;)shared+=1;if(shared===ours.length&&shared===theirs.length)return{merged:relationshipEventsToRaw(ours),strategy:"identical",common_entries:shared,entries_from_ours:0,entries_from_theirs:0,entries_total:ours.length,reanchored:!1};if(shared===theirs.length)return{merged:relationshipEventsToRaw(ours),strategy:"fast_forward_ours",common_entries:shared,entries_from_ours:ours.length-shared,entries_from_theirs:0,entries_total:ours.length,reanchored:!1};if(shared===ours.length)return{merged:relationshipEventsToRaw(theirs),strategy:"fast_forward_theirs",common_entries:shared,entries_from_ours:0,entries_from_theirs:theirs.length-shared,entries_total:theirs.length,reanchored:!1};const oursSuffix=ours.slice(shared),oursEventIds=new Set(oursSuffix.map(event=>event.eventId)),theirsSuffix=theirs.slice(shared).filter(event=>!oursEventIds.has(event.eventId)),mergedSuffix=[...oursSuffix,...theirsSuffix].sort((left,right)=>{if(left.timestamp!==void 0&&right.timestamp!==void 0){const byTs=compareTimestampStrings(left.timestamp,right.timestamp);if(byTs!==0)return byTs}else{if(left.timestamp===void 0&&right.timestamp!==void 0)return 1;if(left.timestamp!==void 0)return-1}const leftFromOurs=oursEventIds.has(left.eventId),rightFromOurs=oursEventIds.has(right.eventId);return leftFromOurs!==rightFromOurs?Number(rightFromOurs)-Number(leftFromOurs):0}),merged=renumberRelationshipEvents([...ours.slice(0,shared),...mergedSuffix]);return{merged:relationshipEventsToRaw(merged),strategy:"union_reanchor",common_entries:shared,entries_from_ours:oursSuffix.length,entries_from_theirs:theirsSuffix.length,entries_total:merged.length,reanchored:!0}}const ITEM_UNION_COLLECTION_FIELDS=["tags","dependencies","comments","notes","learnings","files","tests","test_runs","docs","reminders","events"],ITEM_UNION_DELIMITED_FIELDS=["acceptance_criteria"],ITEM_LATEST_TIMESTAMP_FIELDS=["updated_at"];function jsonEquals(left,right){return left===void 0||right===void 0?left===void 0&&right===void 0:stableStringify(left)===stableStringify(right)}function unionCollection(base,ours,theirs){const toEntries=value=>Array.isArray(value)?value:[],baseIds=new Set(toEntries(base).map(entry=>stableStringify(entry))),oursEntries=toEntries(ours),oursIds=new Set(oursEntries.map(entry=>stableStringify(entry))),theirsEntries=toEntries(theirs),theirsIds=new Set(theirsEntries.map(entry=>stableStringify(entry))),merged=oursEntries.filter(entry=>{const identity=stableStringify(entry);return!baseIds.has(identity)||theirsIds.has(identity)});for(const entry of theirsEntries){const identity=stableStringify(entry);!oursIds.has(identity)&&!baseIds.has(identity)&&merged.push(entry)}return merged}function linkedTestDefinitionIdentity(value){if(typeof value!="object"||value===null||Array.isArray(value))return stableStringify(value);const{provenance:_provenance,...definition}=value;return stableStringify(definition)}function markMergedLinkedTest(value){if(typeof value!="object"||value===null||Array.isArray(value))return value;const test=value;return test.provenance?{...test,provenance:{...test.provenance,source_kind:"merge_union"}}:{...test,provenance:{source_kind:"merge_union"}}}function unionLinkedTests(base,ours,theirs){const toEntries=value=>Array.isArray(value)?value:[],baseIds=new Set(toEntries(base).map(linkedTestDefinitionIdentity)),oursEntries=toEntries(ours),oursIds=new Set(oursEntries.map(linkedTestDefinitionIdentity)),theirsEntries=toEntries(theirs),theirsIds=new Set(theirsEntries.map(linkedTestDefinitionIdentity)),merged=oursEntries.filter(entry=>{const identity=linkedTestDefinitionIdentity(entry);return!baseIds.has(identity)||theirsIds.has(identity)});for(const entry of theirsEntries){const identity=linkedTestDefinitionIdentity(entry);!oursIds.has(identity)&&!baseIds.has(identity)&&merged.push(markMergedLinkedTest(entry))}return merged}function latestTimestamp(ours,theirs){return compareTimestampStrings(String(ours),String(theirs))>=0?ours:theirs}function mergeScalarThreeWay(base,ours,theirs,preferred){return jsonEquals(ours,theirs)?{value:ours,from_theirs:!1,conflict:!1}:jsonEquals(base,ours)?{value:theirs,from_theirs:!0,conflict:!1}:jsonEquals(base,theirs)?{value:ours,from_theirs:!1,conflict:!1}:{value:preferred==="theirs"?theirs:ours,from_theirs:preferred==="theirs",conflict:!0}}function mergeItemScalarThreeWay(base,ours,theirs,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt){const outcome=mergeScalarThreeWay(base,ours,theirs,preferred);if(!outcome.conflict)return{...outcome,conflict:!1};if(conflictResolution==="preferred_side")return{...outcome,resolution_basis:"requested_preference",retained_side:outcome.from_theirs?"theirs":"ours"};const timestampOrder=compareTimestampStrings(oursUpdatedAt,theirsUpdatedAt);if(conflictResolution==="latest_document_update"&×tampOrder!==0){const retainTheirs2=timestampOrder<0;return{value:retainTheirs2?theirs:ours,from_theirs:retainTheirs2,conflict:!0,resolution_basis:"document_updated_at",retained_side:retainTheirs2?"theirs":"ours"}}const retainTheirs=stableStringify(encodeItemScalarDecisionValue(theirs)).localeCompare(stableStringify(encodeItemScalarDecisionValue(ours)))<0;return{value:retainTheirs?theirs:ours,from_theirs:retainTheirs,conflict:!0,resolution_basis:"stable_value_tiebreak",retained_side:retainTheirs?"theirs":"ours"}}function toMetadataRecord(document){return{...document.metadata}}function parseItemMergeSide(raw,label,options){try{const document=canonicalDocument(parseItemDocument(raw,options),options),reservedField=Object.entries(document.metadata).find(([,value])=>isItemScalarMissingValue(value))?.[0];if(reservedField!==void 0)throw new TypeError(`metadata field ${reservedField} uses the reserved missing-scalar evidence marker`);return document}catch(error){throw new PmCliError(`Item merge input (${label}) is not a readable item document: ${String(error)}`,EXIT_CODE.GENERIC_FAILURE)}}function mergeItemUnionField(params){if(!params.unionFieldSet.has(params.field))return!1;const union=params.field==="tests"?unionLinkedTests(params.baseValue,params.oursValue,params.theirsValue):params.field==="acceptance_criteria"?unionCollection(splitAcceptanceCriteria(params.baseValue),splitAcceptanceCriteria(params.oursValue),splitAcceptanceCriteria(params.theirsValue)).join("; "):unionCollection(params.baseValue,params.oursValue,params.theirsValue);return params.accumulator.merged[params.field]=union,jsonEquals(union,params.oursValue)||params.accumulator.unionFields.push(params.field),!0}function mergeItemScalarField(params){const outcome=mergeItemScalarThreeWay(params.baseValue,params.oursValue,params.theirsValue,params.preferred,params.conflictResolution,params.oursUpdatedAt,params.theirsUpdatedAt);outcome.value!==void 0&&(params.accumulator.merged[params.field]=outcome.value),outcome.conflict?(params.accumulator.conflictFields.push(params.field),params.accumulator.conflictDecisions.push({field:params.field,base:encodeItemScalarDecisionValue(params.baseValue),ours:encodeItemScalarDecisionValue(params.oursValue),theirs:encodeItemScalarDecisionValue(params.theirsValue),retained:encodeItemScalarDecisionValue(outcome.value),discarded:encodeItemScalarDecisionValue(outcome.from_theirs?params.oursValue:params.theirsValue),retained_side:outcome.retained_side,resolution_basis:outcome.resolution_basis})):outcome.from_theirs&¶ms.accumulator.fieldsFromTheirs.push(params.field)}function mergeItemMetadataRecords(baseRecord,oursRecord,theirsRecord,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt){const unionFieldSet=new Set([...ITEM_UNION_COLLECTION_FIELDS,...ITEM_UNION_DELIMITED_FIELDS]),latestFieldSet=new Set(ITEM_LATEST_TIMESTAMP_FIELDS),fieldNames=[...new Set([...Object.keys(oursRecord),...Object.keys(theirsRecord)])].sort((left,right)=>left.localeCompare(right)),accumulator={merged:{},conflictFields:[],fieldsFromTheirs:[],unionFields:[],conflictDecisions:[]};for(const field of fieldNames){const baseValue=baseRecord[field],oursValue=oursRecord[field],theirsValue=theirsRecord[field];if(!mergeItemUnionField({field,baseValue,oursValue,theirsValue,unionFieldSet,accumulator})){if(latestFieldSet.has(field)){accumulator.merged[field]=latestTimestamp(oursValue,theirsValue);continue}mergeItemScalarField({field,baseValue,oursValue,theirsValue,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt,accumulator})}}return accumulator}function mergeItemDocuments(baseRaw,oursRaw,theirsRaw,options={}){const preferred=options.preferred??"ours",conflictResolution=options.conflictResolution??"preferred_side",ours=parseItemMergeSide(oursRaw,"ours",options),theirs=parseItemMergeSide(theirsRaw,"theirs",options);if(baseRaw.trim().length===0)throw new PmCliError("Duplicate item identity: add/add item documents have no common ancestor. Preserve both branches and assign distinct item ids before merging.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict",item_id:ours.metadata.id});const base=parseItemMergeSide(baseRaw,"base",options);if(base.metadata.id!==ours.metadata.id||base.metadata.id!==theirs.metadata.id)throw new PmCliError("Duplicate or mismatched item identity: all merge sides must address the common ancestor's item id.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict",item_id:base.metadata.id});const baseRecord=toMetadataRecord(base),oursRecord=toMetadataRecord(ours),theirsRecord=toMetadataRecord(theirs),{merged,conflictFields,fieldsFromTheirs,unionFields,conflictDecisions}=mergeItemMetadataRecords(baseRecord,oursRecord,theirsRecord,preferred,conflictResolution,ours.metadata.updated_at,theirs.metadata.updated_at),bodyOutcome=mergeItemScalarThreeWay(base.body,ours.body,theirs.body,preferred,conflictResolution,ours.metadata.updated_at,theirs.metadata.updated_at);return bodyOutcome.conflict?(conflictFields.push("body"),conflictDecisions.push({field:"body",base:encodeItemScalarDecisionValue(base.body),ours:encodeItemScalarDecisionValue(ours.body),theirs:encodeItemScalarDecisionValue(theirs.body),retained:encodeItemScalarDecisionValue(bodyOutcome.value),discarded:encodeItemScalarDecisionValue(bodyOutcome.from_theirs?ours.body:theirs.body),retained_side:bodyOutcome.retained_side,resolution_basis:bodyOutcome.resolution_basis})):bodyOutcome.from_theirs&&fieldsFromTheirs.push("body"),{merged:serializeItemDocument({metadata:merged,body:bodyOutcome.value},options),conflict_fields:conflictFields,fields_from_theirs:fieldsFromTheirs,union_fields:unionFields,conflict_decisions:conflictDecisions,requested_preference:preferred,requested_preference_applied:conflictResolution==="preferred_side",conflict_resolution:conflictResolution}}function isPlainObject(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function parseJsonSide(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker)throw new PmCliError(`JSON merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}.`,EXIT_CODE.GENERIC_FAILURE);if(raw.trim().length!==0)try{return JSON.parse(raw)}catch{throw new PmCliError(`JSON merge input (${label}) is not valid JSON.`,EXIT_CODE.GENERIC_FAILURE)}}function mergeAdditiveJsonArrays(base,ours,theirs){if(!Array.isArray(base)||!Array.isArray(ours)||!Array.isArray(theirs))return null;const countEntries=entries=>{const counts=new Map;for(const entry of entries){const identity=stableStringify(entry);counts.set(identity,(counts.get(identity)??0)+1)}return counts},baseCounts=countEntries(base),oursCounts=countEntries(ours),theirsCounts=countEntries(theirs);for(const[identity,baseCount]of baseCounts)if((oursCounts.get(identity)??0)<baseCount||(theirsCounts.get(identity)??0)<baseCount)return null;const unmatchedOursCounts=new Map(oursCounts),additionsFromTheirs=[];for(const entry of theirs){const identity=stableStringify(entry),unmatchedOursCount=unmatchedOursCounts.get(identity)??0;unmatchedOursCount>0?unmatchedOursCounts.set(identity,unmatchedOursCount-1):additionsFromTheirs.push(entry)}return{merged:[...ours,...additionsFromTheirs],acceptedTheirs:additionsFromTheirs.length>0}}function mergeJsonObjects(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs){if(!isPlainObject(ours)||!isPlainObject(theirs))return null;const baseObject=isPlainObject(base)?base:{},merged={},keys=[...new Set([...Object.keys(ours),...Object.keys(theirs)])].sort((left,right)=>left.localeCompare(right));for(const key of keys){const childPath=pathPrefix.length>0?`${pathPrefix}.${key}`:key,child=mergeJsonKey(baseObject,ours,theirs,key,preferred,childPath,conflictPaths,pathsFromTheirs);child!==void 0&&(merged[key]=child)}return merged}function mergeJsonValue(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs){if(jsonEquals(ours,theirs))return ours;const additiveArrayMerge=mergeAdditiveJsonArrays(base,ours,theirs);if(additiveArrayMerge!==null)return additiveArrayMerge.acceptedTheirs&&pathsFromTheirs.push(pathPrefix),additiveArrayMerge.merged;const mergedObject=mergeJsonObjects(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs);if(mergedObject!==null)return mergedObject;const outcome=mergeScalarThreeWay(base,ours,theirs,preferred);return outcome.conflict?conflictPaths.push(pathPrefix):outcome.from_theirs&&pathsFromTheirs.push(pathPrefix),outcome.value}function mergeJsonKey(base,ours,theirs,key,preferred,childPath,conflictPaths,pathsFromTheirs){const inOurs=Object.prototype.hasOwnProperty.call(ours,key),inTheirs=Object.prototype.hasOwnProperty.call(theirs,key),inBase=Object.prototype.hasOwnProperty.call(base,key);if(inOurs&&inTheirs)return mergeJsonValue(base[key],ours[key],theirs[key],preferred,childPath,conflictPaths,pathsFromTheirs);if(inOurs){if(inBase&&jsonEquals(base[key],ours[key])){pathsFromTheirs.push(childPath);return}return inBase?(conflictPaths.push(childPath),preferred==="theirs"?void 0:ours[key]):ours[key]}if(!(inBase&&jsonEquals(base[key],theirs[key])))return inBase?(conflictPaths.push(childPath),preferred==="theirs"?theirs[key]:void 0):(pathsFromTheirs.push(childPath),theirs[key])}function mergeJsonDocuments(baseRaw,oursRaw,theirsRaw,options={}){const preferred=options.preferred??"ours",base=parseJsonSide(baseRaw,"base"),ours=parseJsonSide(oursRaw,"ours"),theirs=parseJsonSide(theirsRaw,"theirs"),conflictPaths=[],pathsFromTheirs=[],merged=mergeJsonValue(base,ours,theirs,preferred,"",conflictPaths,pathsFromTheirs);return{merged:`${JSON.stringify(merged??null,null,2)}
|
|
3
|
+
`}function renumberRelationshipEvents(events){return events.map((event,index)=>({...event,sequence:index+1}))}function mergeRelationshipEventStreams(baseRaw,oursRaw,theirsRaw){parseRelationshipJsonl(baseRaw,"base");const ours=parseRelationshipJsonl(oursRaw,"ours"),theirs=parseRelationshipJsonl(theirsRaw,"theirs"),limit=Math.min(ours.length,theirs.length);let shared=0;for(;shared<limit&&ours[shared].eventId===theirs[shared].eventId;)shared+=1;if(shared===ours.length&&shared===theirs.length)return{merged:relationshipEventsToRaw(ours),strategy:"identical",common_entries:shared,entries_from_ours:0,entries_from_theirs:0,entries_total:ours.length,reanchored:!1};if(shared===theirs.length)return{merged:relationshipEventsToRaw(ours),strategy:"fast_forward_ours",common_entries:shared,entries_from_ours:ours.length-shared,entries_from_theirs:0,entries_total:ours.length,reanchored:!1};if(shared===ours.length)return{merged:relationshipEventsToRaw(theirs),strategy:"fast_forward_theirs",common_entries:shared,entries_from_ours:0,entries_from_theirs:theirs.length-shared,entries_total:theirs.length,reanchored:!1};const oursSuffix=ours.slice(shared),oursEventIds=new Set(oursSuffix.map(event=>event.eventId)),theirsSuffix=theirs.slice(shared).filter(event=>!oursEventIds.has(event.eventId)),mergedSuffix=[...oursSuffix,...theirsSuffix].sort((left,right)=>{if(left.timestamp!==void 0&&right.timestamp!==void 0){const byTs=compareTimestampStrings(left.timestamp,right.timestamp);if(byTs!==0)return byTs}else{if(left.timestamp===void 0&&right.timestamp!==void 0)return 1;if(left.timestamp!==void 0)return-1}const leftFromOurs=oursEventIds.has(left.eventId),rightFromOurs=oursEventIds.has(right.eventId);return leftFromOurs!==rightFromOurs?Number(rightFromOurs)-Number(leftFromOurs):0}),merged=renumberRelationshipEvents([...ours.slice(0,shared),...mergedSuffix]);return{merged:relationshipEventsToRaw(merged),strategy:"union_reanchor",common_entries:shared,entries_from_ours:oursSuffix.length,entries_from_theirs:theirsSuffix.length,entries_total:merged.length,reanchored:!0}}const ITEM_UNION_COLLECTION_FIELDS=["tags","dependencies","comments","notes","learnings","files","tests","test_runs","docs","reminders","events"],ITEM_UNION_DELIMITED_FIELDS=["acceptance_criteria"],ITEM_LATEST_TIMESTAMP_FIELDS=["updated_at"];function jsonEquals(left,right){return left===void 0||right===void 0?left===void 0&&right===void 0:stableStringify(left)===stableStringify(right)}function unionCollection(base,ours,theirs){const toEntries=value=>Array.isArray(value)?value:[],baseIds=new Set(toEntries(base).map(entry=>stableStringify(entry))),oursEntries=toEntries(ours),oursIds=new Set(oursEntries.map(entry=>stableStringify(entry))),theirsEntries=toEntries(theirs),theirsIds=new Set(theirsEntries.map(entry=>stableStringify(entry))),merged=oursEntries.filter(entry=>{const identity=stableStringify(entry);return!baseIds.has(identity)||theirsIds.has(identity)});for(const entry of theirsEntries){const identity=stableStringify(entry);!oursIds.has(identity)&&!baseIds.has(identity)&&merged.push(entry)}return merged}function linkedTestDefinitionIdentity(value){if(typeof value!="object"||value===null||Array.isArray(value))return stableStringify(value);const{provenance:_provenance,...definition}=value;return stableStringify(definition)}function markMergedLinkedTest(value){if(typeof value!="object"||value===null||Array.isArray(value))return value;const test=value;return test.provenance?{...test,provenance:{...test.provenance,source_kind:"merge_union"}}:{...test,provenance:{source_kind:"merge_union"}}}function unionLinkedTests(base,ours,theirs){const toEntries=value=>Array.isArray(value)?value:[],baseIds=new Set(toEntries(base).map(linkedTestDefinitionIdentity)),oursEntries=toEntries(ours),oursIds=new Set(oursEntries.map(linkedTestDefinitionIdentity)),theirsEntries=toEntries(theirs),theirsIds=new Set(theirsEntries.map(linkedTestDefinitionIdentity)),merged=oursEntries.filter(entry=>{const identity=linkedTestDefinitionIdentity(entry);return!baseIds.has(identity)||theirsIds.has(identity)});for(const entry of theirsEntries){const identity=linkedTestDefinitionIdentity(entry);!oursIds.has(identity)&&!baseIds.has(identity)&&merged.push(markMergedLinkedTest(entry))}return merged}function latestTimestamp(ours,theirs){return compareTimestampStrings(String(ours),String(theirs))>=0?ours:theirs}function mergeScalarThreeWay(base,ours,theirs,preferred){return jsonEquals(ours,theirs)?{value:ours,from_theirs:!1,conflict:!1}:jsonEquals(base,ours)?{value:theirs,from_theirs:!0,conflict:!1}:jsonEquals(base,theirs)?{value:ours,from_theirs:!1,conflict:!1}:{value:preferred==="theirs"?theirs:ours,from_theirs:preferred==="theirs",conflict:!0}}function mergeItemScalarThreeWay(base,ours,theirs,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt){const outcome=mergeScalarThreeWay(base,ours,theirs,preferred);if(!outcome.conflict)return{...outcome,conflict:!1};if(conflictResolution==="preferred_side")return{...outcome,resolution_basis:"requested_preference",retained_side:outcome.from_theirs?"theirs":"ours"};const timestampOrder=compareTimestampStrings(oursUpdatedAt,theirsUpdatedAt);if(conflictResolution==="latest_document_update"&×tampOrder!==0){const retainTheirs2=timestampOrder<0;return{value:retainTheirs2?theirs:ours,from_theirs:retainTheirs2,conflict:!0,resolution_basis:"document_updated_at",retained_side:retainTheirs2?"theirs":"ours"}}const retainTheirs=stableStringify(encodeItemScalarDecisionValue(theirs)).localeCompare(stableStringify(encodeItemScalarDecisionValue(ours)))<0;return{value:retainTheirs?theirs:ours,from_theirs:retainTheirs,conflict:!0,resolution_basis:"stable_value_tiebreak",retained_side:retainTheirs?"theirs":"ours"}}function toMetadataRecord(document){return{...document.metadata}}function parseItemMergeSide(raw,label,options){try{const document=canonicalDocument(parseItemDocument(raw,{...options,requireSupportedFormat:!0}),options),reservedField=Object.entries(document.metadata).find(([,value])=>isItemScalarMissingValue(value))?.[0];if(reservedField!==void 0)throw new TypeError(`metadata field ${reservedField} uses the reserved missing-scalar evidence marker`);return document}catch(error){throw error instanceof PmCliError&&error.context?.code==="item_format_version_unsupported"?error:new PmCliError(`Item merge input (${label}) is not a readable item document: ${String(error)}`,EXIT_CODE.GENERIC_FAILURE)}}function mergeItemUnionField(params){if(!params.unionFieldSet.has(params.field))return!1;const union=params.field==="tests"?unionLinkedTests(params.baseValue,params.oursValue,params.theirsValue):params.field==="acceptance_criteria"?unionCollection(splitAcceptanceCriteria(params.baseValue),splitAcceptanceCriteria(params.oursValue),splitAcceptanceCriteria(params.theirsValue)).join("; "):unionCollection(params.baseValue,params.oursValue,params.theirsValue);return params.accumulator.merged[params.field]=union,jsonEquals(union,params.oursValue)||params.accumulator.unionFields.push(params.field),!0}function mergeItemScalarField(params){const outcome=mergeItemScalarThreeWay(params.baseValue,params.oursValue,params.theirsValue,params.preferred,params.conflictResolution,params.oursUpdatedAt,params.theirsUpdatedAt);outcome.value!==void 0&&(params.accumulator.merged[params.field]=outcome.value),outcome.conflict?(params.accumulator.conflictFields.push(params.field),params.accumulator.conflictDecisions.push({field:params.field,base:encodeItemScalarDecisionValue(params.baseValue),ours:encodeItemScalarDecisionValue(params.oursValue),theirs:encodeItemScalarDecisionValue(params.theirsValue),retained:encodeItemScalarDecisionValue(outcome.value),discarded:encodeItemScalarDecisionValue(outcome.from_theirs?params.oursValue:params.theirsValue),retained_side:outcome.retained_side,resolution_basis:outcome.resolution_basis})):outcome.from_theirs&¶ms.accumulator.fieldsFromTheirs.push(params.field)}function mergeItemMetadataRecords(baseRecord,oursRecord,theirsRecord,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt){const unionFieldSet=new Set([...ITEM_UNION_COLLECTION_FIELDS,...ITEM_UNION_DELIMITED_FIELDS]),latestFieldSet=new Set(ITEM_LATEST_TIMESTAMP_FIELDS),fieldNames=[...new Set([...Object.keys(oursRecord),...Object.keys(theirsRecord)])].sort((left,right)=>left.localeCompare(right)),accumulator={merged:{},conflictFields:[],fieldsFromTheirs:[],unionFields:[],conflictDecisions:[]};for(const field of fieldNames){const baseValue=baseRecord[field],oursValue=oursRecord[field],theirsValue=theirsRecord[field];if(!mergeItemUnionField({field,baseValue,oursValue,theirsValue,unionFieldSet,accumulator})){if(latestFieldSet.has(field)){accumulator.merged[field]=latestTimestamp(oursValue,theirsValue);continue}mergeItemScalarField({field,baseValue,oursValue,theirsValue,preferred,conflictResolution,oursUpdatedAt,theirsUpdatedAt,accumulator})}}return accumulator}function mergeItemDocuments(baseRaw,oursRaw,theirsRaw,options={}){const preferred=options.preferred??"ours",conflictResolution=options.conflictResolution??"preferred_side",ours=parseItemMergeSide(oursRaw,"ours",options),theirs=parseItemMergeSide(theirsRaw,"theirs",options);if(baseRaw.trim().length===0)throw new PmCliError("Duplicate item identity: add/add item documents have no common ancestor. Preserve both branches and assign distinct item ids before merging.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict",item_id:ours.metadata.id});const base=parseItemMergeSide(baseRaw,"base",options);if(base.metadata.id!==ours.metadata.id||base.metadata.id!==theirs.metadata.id)throw new PmCliError("Duplicate or mismatched item identity: all merge sides must address the common ancestor's item id.",EXIT_CODE.CONFLICT,{code:"item_identity_conflict",item_id:base.metadata.id});const baseRecord=toMetadataRecord(base),oursRecord=toMetadataRecord(ours),theirsRecord=toMetadataRecord(theirs),{merged,conflictFields,fieldsFromTheirs,unionFields,conflictDecisions}=mergeItemMetadataRecords(baseRecord,oursRecord,theirsRecord,preferred,conflictResolution,ours.metadata.updated_at,theirs.metadata.updated_at),bodyOutcome=mergeItemScalarThreeWay(base.body,ours.body,theirs.body,preferred,conflictResolution,ours.metadata.updated_at,theirs.metadata.updated_at);bodyOutcome.conflict?(conflictFields.push("body"),conflictDecisions.push({field:"body",base:encodeItemScalarDecisionValue(base.body),ours:encodeItemScalarDecisionValue(ours.body),theirs:encodeItemScalarDecisionValue(theirs.body),retained:encodeItemScalarDecisionValue(bodyOutcome.value),discarded:encodeItemScalarDecisionValue(bodyOutcome.from_theirs?ours.body:theirs.body),retained_side:bodyOutcome.retained_side,resolution_basis:bodyOutcome.resolution_basis})):bodyOutcome.from_theirs&&fieldsFromTheirs.push("body");const mergedMetadata=merged;return mergedMetadata.pm_format_version=normalizeItemFormatVersion(Math.max(...[base.metadata,ours.metadata,theirs.metadata,mergedMetadata].map(requiredItemFormatVersion))),{merged:serializeItemDocument({metadata:mergedMetadata,body:bodyOutcome.value},options),conflict_fields:conflictFields,fields_from_theirs:fieldsFromTheirs,union_fields:unionFields,conflict_decisions:conflictDecisions,requested_preference:preferred,requested_preference_applied:conflictResolution==="preferred_side",conflict_resolution:conflictResolution}}function isPlainObject(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function parseJsonSide(raw,label){const conflictMarker=findFirstMergeConflictMarker(raw);if(conflictMarker)throw new PmCliError(`JSON merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}.`,EXIT_CODE.GENERIC_FAILURE);if(raw.trim().length!==0)try{return JSON.parse(raw)}catch{throw new PmCliError(`JSON merge input (${label}) is not valid JSON.`,EXIT_CODE.GENERIC_FAILURE)}}function mergeAdditiveJsonArrays(base,ours,theirs){if(!Array.isArray(base)||!Array.isArray(ours)||!Array.isArray(theirs))return null;const countEntries=entries=>{const counts=new Map;for(const entry of entries){const identity=stableStringify(entry);counts.set(identity,(counts.get(identity)??0)+1)}return counts},baseCounts=countEntries(base),oursCounts=countEntries(ours),theirsCounts=countEntries(theirs);for(const[identity,baseCount]of baseCounts)if((oursCounts.get(identity)??0)<baseCount||(theirsCounts.get(identity)??0)<baseCount)return null;const unmatchedOursCounts=new Map(oursCounts),additionsFromTheirs=[];for(const entry of theirs){const identity=stableStringify(entry),unmatchedOursCount=unmatchedOursCounts.get(identity)??0;unmatchedOursCount>0?unmatchedOursCounts.set(identity,unmatchedOursCount-1):additionsFromTheirs.push(entry)}return{merged:[...ours,...additionsFromTheirs],acceptedTheirs:additionsFromTheirs.length>0}}function mergeJsonObjects(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs){if(!isPlainObject(ours)||!isPlainObject(theirs))return null;const baseObject=isPlainObject(base)?base:{},merged={},keys=[...new Set([...Object.keys(ours),...Object.keys(theirs)])].sort((left,right)=>left.localeCompare(right));for(const key of keys){const childPath=pathPrefix.length>0?`${pathPrefix}.${key}`:key,child=mergeJsonKey(baseObject,ours,theirs,key,preferred,childPath,conflictPaths,pathsFromTheirs);child!==void 0&&(merged[key]=child)}return merged}function mergeJsonValue(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs){if(jsonEquals(ours,theirs))return ours;const additiveArrayMerge=mergeAdditiveJsonArrays(base,ours,theirs);if(additiveArrayMerge!==null)return additiveArrayMerge.acceptedTheirs&&pathsFromTheirs.push(pathPrefix),additiveArrayMerge.merged;const mergedObject=mergeJsonObjects(base,ours,theirs,preferred,pathPrefix,conflictPaths,pathsFromTheirs);if(mergedObject!==null)return mergedObject;const outcome=mergeScalarThreeWay(base,ours,theirs,preferred);return outcome.conflict?conflictPaths.push(pathPrefix):outcome.from_theirs&&pathsFromTheirs.push(pathPrefix),outcome.value}function mergeJsonKey(base,ours,theirs,key,preferred,childPath,conflictPaths,pathsFromTheirs){const inOurs=Object.prototype.hasOwnProperty.call(ours,key),inTheirs=Object.prototype.hasOwnProperty.call(theirs,key),inBase=Object.prototype.hasOwnProperty.call(base,key);if(inOurs&&inTheirs)return mergeJsonValue(base[key],ours[key],theirs[key],preferred,childPath,conflictPaths,pathsFromTheirs);if(inOurs){if(inBase&&jsonEquals(base[key],ours[key])){pathsFromTheirs.push(childPath);return}return inBase?(conflictPaths.push(childPath),preferred==="theirs"?void 0:ours[key]):ours[key]}if(!(inBase&&jsonEquals(base[key],theirs[key])))return inBase?(conflictPaths.push(childPath),preferred==="theirs"?theirs[key]:void 0):(pathsFromTheirs.push(childPath),theirs[key])}function mergeJsonDocuments(baseRaw,oursRaw,theirsRaw,options={}){const preferred=options.preferred??"ours",base=parseJsonSide(baseRaw,"base"),ours=parseJsonSide(oursRaw,"ours"),theirs=parseJsonSide(theirsRaw,"theirs"),conflictPaths=[],pathsFromTheirs=[],merged=mergeJsonValue(base,ours,theirs,preferred,"",conflictPaths,pathsFromTheirs);return{merged:`${JSON.stringify(merged??null,null,2)}
|
|
4
4
|
`,conflict_paths:conflictPaths,paths_from_theirs:pathsFromTheirs,preferred}}export{ITEM_LATEST_TIMESTAMP_FIELDS,ITEM_SCALAR_MISSING_VALUE,ITEM_UNION_COLLECTION_FIELDS,encodeItemScalarDecisionValue,hashItemScalarDecisionValue,isItemScalarMissingValue,mergeHistoryStreams,mergeItemDocuments,mergeJsonDocuments,mergeRelationshipEventStreams};
|
|
5
5
|
//# sourceMappingURL=three-way.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** Write clone-local configuration after a bounded wait for Git's own exclusive lock. Retry only the native lock-exists diagnostic; never remove another writer's lock or retry malformed and unwritable configuration. */
|
|
2
|
-
export declare function writeMergeDriverGitConfig(cwd:
|
|
2
|
+
export declare function writeMergeDriverGitConfig(cwd:string,args:string[]):Promise<void>;
|
|
3
3
|
/** Preserve caller tools and preferences while binding Git repository discovery and writes to the explicit cwd. */
|
|
4
|
-
export declare function gitWorkspaceEnvironment():
|
|
4
|
+
export declare function gitWorkspaceEnvironment():NodeJS.ProcessEnv;
|
|
5
5
|
/**
|
|
6
6
|
* Keep simple clones on local config. Linked worktrees opt into Git's native
|
|
7
7
|
* per-worktree layer, first preserving the main worktree's special core keys.
|
|
8
8
|
* Drivers already installed in the main tree are copied into its layer so
|
|
9
9
|
* later installations cannot replace the main tree's runtime selection.
|
|
10
10
|
*/
|
|
11
|
-
export declare function resolveMergeDriverConfigScope(workspaceRoot:
|
|
11
|
+
export declare function resolveMergeDriverConfigScope(workspaceRoot:string):Promise<"--local" | "--worktree">;
|
|
@@ -1,128 +1,128 @@
|
|
|
1
1
|
import { type IndexedHistoryEvent } from "../core/history/event-index.js";
|
|
2
2
|
import type { HistoryEntry } from "../types/index.js";
|
|
3
|
-
import { type HistoryProvenanceRow,
|
|
3
|
+
import { type HistoryProvenanceRow,type HistoryProvenanceSummary } from "./history-provenance.js";
|
|
4
4
|
/** Regression budgets for the canonical 200-event wire-cost fixture. */
|
|
5
|
-
export declare const MUTATION_EVENT_WIRE_BUDGET:
|
|
5
|
+
export declare const MUTATION_EVENT_WIRE_BUDGET:Readonly<{
|
|
6
6
|
/** Maximum default batch bytes divided by legacy row-cursor bytes. */
|
|
7
|
-
batch_to_row_ratio:
|
|
7
|
+
batch_to_row_ratio:0.6;
|
|
8
8
|
/** Fixture size used to keep the ratio representative of fleet catch-up. */
|
|
9
|
-
fixture_events:
|
|
9
|
+
fixture_events:200;
|
|
10
10
|
}>;
|
|
11
11
|
interface MutationEventCursorEnvelope {
|
|
12
|
-
version:
|
|
13
|
-
fingerprint:
|
|
14
|
-
ts:
|
|
15
|
-
stream_id:
|
|
16
|
-
stream_offset:
|
|
12
|
+
version:number;
|
|
13
|
+
fingerprint:string;
|
|
14
|
+
ts:string;
|
|
15
|
+
stream_id:string;
|
|
16
|
+
stream_offset:number;
|
|
17
17
|
}
|
|
18
18
|
/** Workspace and filtering controls for mutation-event reads. */
|
|
19
19
|
export interface ListMutationEventsOptions {
|
|
20
20
|
/** Explicit tracker root, equivalent to global `--pm-path`. */
|
|
21
|
-
pmRoot?:
|
|
21
|
+
pmRoot?:string;
|
|
22
22
|
/** Working directory used to discover the nearest tracker. */
|
|
23
|
-
cwd?:
|
|
23
|
+
cwd?:string;
|
|
24
24
|
/** Opaque cursor or inclusive ISO timestamp lower bound. */
|
|
25
|
-
since?:
|
|
25
|
+
since?:string;
|
|
26
26
|
/** Operation name filter, repeatable through arrays. */
|
|
27
|
-
type?:
|
|
27
|
+
type?:string | readonly string[];
|
|
28
28
|
/** Author filter, repeatable through arrays. */
|
|
29
|
-
author?:
|
|
29
|
+
author?:string | readonly string[];
|
|
30
30
|
/** Item/workspace stream filter, repeatable through arrays. */
|
|
31
|
-
item?:
|
|
31
|
+
item?:string | readonly string[];
|
|
32
32
|
/** Maximum events returned, capped at 1,000. */
|
|
33
|
-
limit?:
|
|
33
|
+
limit?:number;
|
|
34
34
|
/** Include the complete history entry instead of the compact projection. */
|
|
35
|
-
full?:
|
|
35
|
+
full?:boolean;
|
|
36
36
|
/** Return patch-free provenance instead of the compact event projection. */
|
|
37
|
-
provenance?:
|
|
37
|
+
provenance?:boolean;
|
|
38
38
|
/** Include bounded provenance completeness counts for the returned page. */
|
|
39
|
-
provenanceSummary?:
|
|
39
|
+
provenanceSummary?:boolean;
|
|
40
40
|
/** Filter by canonical recorded or vocabulary-resolved harness. */
|
|
41
|
-
harness?:
|
|
41
|
+
harness?:string | readonly string[];
|
|
42
42
|
/** Filter by privacy-safe invocation fingerprint. */
|
|
43
|
-
agentInstance?:
|
|
43
|
+
agentInstance?:string | readonly string[];
|
|
44
44
|
/** Exact provenance dimension predicates (`dimension=value`). */
|
|
45
|
-
provenanceFilter?:
|
|
45
|
+
provenanceFilter?:string | readonly string[];
|
|
46
46
|
/** Cursor framing mode; batch is the token-efficient default. */
|
|
47
|
-
cursorMode?:
|
|
47
|
+
cursorMode?:"batch" | "row";
|
|
48
48
|
}
|
|
49
49
|
/** One ordered cross-item mutation event. */
|
|
50
50
|
export interface MutationEvent {
|
|
51
51
|
/** Cursor that resumes strictly after this event. */
|
|
52
|
-
cursor?:
|
|
52
|
+
cursor?:string;
|
|
53
53
|
/** Item id or `_workspace` stream subject. */
|
|
54
|
-
item_id:
|
|
54
|
+
item_id:string;
|
|
55
55
|
/** One-based version within the subject's stream. */
|
|
56
|
-
version:
|
|
56
|
+
version:number;
|
|
57
57
|
/** Mutation timestamp. */
|
|
58
|
-
ts:
|
|
58
|
+
ts:string;
|
|
59
59
|
/** Attributed mutation author. */
|
|
60
|
-
author:
|
|
60
|
+
author:string;
|
|
61
61
|
/** Stable mutation operation. */
|
|
62
|
-
type:
|
|
62
|
+
type:string;
|
|
63
63
|
/** Optional mutation message. */
|
|
64
|
-
message?:
|
|
64
|
+
message?:string;
|
|
65
65
|
/** Number of JSON Patch operations in the history entry. */
|
|
66
|
-
patch_count:
|
|
66
|
+
patch_count:number;
|
|
67
67
|
/** Complete authoritative history entry when `full` is requested. */
|
|
68
|
-
entry?:
|
|
68
|
+
entry?:HistoryEntry;
|
|
69
69
|
/** Patch-free provenance row when requested. */
|
|
70
|
-
provenance?:
|
|
70
|
+
provenance?:HistoryProvenanceRow;
|
|
71
71
|
}
|
|
72
72
|
/** Bounded event page returned by {@link listMutationEvents}. */
|
|
73
73
|
export interface MutationEventPage {
|
|
74
74
|
/** Ordered mutation events. */
|
|
75
|
-
events:
|
|
75
|
+
events:MutationEvent[];
|
|
76
76
|
/** Number of events in this page. */
|
|
77
|
-
count:
|
|
77
|
+
count:number;
|
|
78
78
|
/** Whether another matching event is immediately available. */
|
|
79
|
-
has_more:
|
|
79
|
+
has_more:boolean;
|
|
80
80
|
/** Cursor framing used by this page. */
|
|
81
|
-
cursor_mode:
|
|
81
|
+
cursor_mode:"batch" | "row";
|
|
82
82
|
/** Cursor that resumes after the final returned event. */
|
|
83
|
-
next_cursor?:
|
|
83
|
+
next_cursor?:string;
|
|
84
84
|
/** Persistent derived projection used for the read. */
|
|
85
|
-
source:
|
|
85
|
+
source:"derived_index" | "authoritative_history";
|
|
86
86
|
/** Constant-size provenance completeness metrics for the returned page. */
|
|
87
|
-
provenance_summary?:
|
|
87
|
+
provenance_summary?:HistoryProvenanceSummary;
|
|
88
88
|
}
|
|
89
89
|
/** Follow controls accepted by {@link subscribeMutationEvents}. */
|
|
90
90
|
export interface SubscribeMutationEventsOptions extends ListMutationEventsOptions {
|
|
91
91
|
/** Delay between empty catch-up reads. */
|
|
92
|
-
intervalMs?:
|
|
92
|
+
intervalMs?:number;
|
|
93
93
|
/** Cancellation signal for a long-lived subscription. */
|
|
94
|
-
signal?:
|
|
94
|
+
signal?:AbortSignal;
|
|
95
95
|
}
|
|
96
|
-
declare function eventQueryFingerprint(options:
|
|
97
|
-
declare function encodeMutationEventCursor(event:
|
|
98
|
-
declare function isMutationEventCursorEnvelope(value:
|
|
99
|
-
declare function decodeMutationEventCursor(cursor:
|
|
100
|
-
declare function parseMutationEventLimit(value:
|
|
101
|
-
declare function isAbortError(error:
|
|
102
|
-
declare function resolveMutationEventStart(sinceValue:
|
|
103
|
-
cursor?:
|
|
104
|
-
sinceTimestamp?:
|
|
96
|
+
declare function eventQueryFingerprint(options:ListMutationEventsOptions):string;
|
|
97
|
+
declare function encodeMutationEventCursor(event:IndexedHistoryEvent,fingerprint:string):string;
|
|
98
|
+
declare function isMutationEventCursorEnvelope(value:unknown,fingerprint:string):value is MutationEventCursorEnvelope;
|
|
99
|
+
declare function decodeMutationEventCursor(cursor:string,fingerprint:string):MutationEventCursorEnvelope;
|
|
100
|
+
declare function parseMutationEventLimit(value:number | undefined):number;
|
|
101
|
+
declare function isAbortError(error:unknown):boolean;
|
|
102
|
+
declare function resolveMutationEventStart(sinceValue:string | undefined,fingerprint:string):{
|
|
103
|
+
cursor?:MutationEventCursorEnvelope;
|
|
104
|
+
sinceTimestamp?:string;
|
|
105
105
|
};
|
|
106
106
|
/** Read one bounded page of mutation events from the persistent projection. */
|
|
107
|
-
export declare function listMutationEvents(options?:
|
|
107
|
+
export declare function listMutationEvents(options?:ListMutationEventsOptions):Promise<MutationEventPage>;
|
|
108
108
|
/**
|
|
109
109
|
* Subscribe to complete event batches. Every yield is a recoverable boundary;
|
|
110
110
|
* an empty batch is an idle heartbeat carrying the last known cursor.
|
|
111
111
|
*/
|
|
112
|
-
export declare function subscribeMutationEventBatches(options?:
|
|
112
|
+
export declare function subscribeMutationEventBatches(options?:SubscribeMutationEventsOptions):AsyncGenerator<MutationEventPage,void,void>;
|
|
113
113
|
/**
|
|
114
114
|
* Subscribe to committed mutation facts as an async iterable. The iterator
|
|
115
115
|
* performs cursor catch-up reads and waits only when no new event is available.
|
|
116
116
|
*/
|
|
117
|
-
export declare function subscribeMutationEvents(options?:
|
|
117
|
+
export declare function subscribeMutationEvents(options?:SubscribeMutationEventsOptions):AsyncGenerator<MutationEvent,void,void>;
|
|
118
118
|
/** Public test seams for cursor contract verification. */
|
|
119
|
-
export declare const _testOnlyMutationEvents:
|
|
120
|
-
decodeMutationEventCursor:
|
|
121
|
-
encodeMutationEventCursor:
|
|
122
|
-
eventQueryFingerprint:
|
|
123
|
-
isAbortError:
|
|
124
|
-
isMutationEventCursorEnvelope:
|
|
125
|
-
parseMutationEventLimit:
|
|
126
|
-
resolveMutationEventStart:
|
|
119
|
+
export declare const _testOnlyMutationEvents:{
|
|
120
|
+
decodeMutationEventCursor:typeof decodeMutationEventCursor;
|
|
121
|
+
encodeMutationEventCursor:typeof encodeMutationEventCursor;
|
|
122
|
+
eventQueryFingerprint:typeof eventQueryFingerprint;
|
|
123
|
+
isAbortError:typeof isAbortError;
|
|
124
|
+
isMutationEventCursorEnvelope:typeof isMutationEventCursorEnvelope;
|
|
125
|
+
parseMutationEventLimit:typeof parseMutationEventLimit;
|
|
126
|
+
resolveMutationEventStart:typeof resolveMutationEventStart;
|
|
127
127
|
};
|
|
128
128
|
export {};
|