@unbrained/pm-cli 2026.9.3 → 2026.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
- package/.agents/skills/README.md +2 -2
- package/.agents/skills/pm-developer/SKILL.md +4 -1
- package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +10 -0
- package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +3 -1
- package/.agents/skills/pm-extensions/SKILL.md +2 -2
- package/.agents/skills/pm-extensions/references/LIFECYCLE.md +3 -3
- package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +3 -3
- package/.agents/skills/pm-user/SKILL.md +2 -0
- package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +5 -0
- package/.agents/skills/pm-user/references/WORKFLOWS.md +20 -5
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +52 -0
- package/dist/cli/commander-usage.d.ts +2 -0
- package/dist/cli/commander-usage.js +15 -12
- package/dist/cli/help-json-payload.js +12 -7
- package/dist/cli/main.js +15 -6
- package/dist/cli/register-list-query.js +4 -2
- package/dist/cli/register-mutation.js +4 -2
- package/dist/cli/register-operations.js +6 -2
- package/dist/cli-bundle/bundle-manifest.json +154 -154
- package/dist/cli-bundle/chunks/{chunk-EDPIS7EB.js → chunk-3HBDTJRK.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-66VPKFP2.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-Y4PJ6HPK.js → chunk-HUAQITVW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DKGP3QLE.js → chunk-IBYREGSP.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-LUI4E32I.js +231 -0
- package/dist/cli-bundle/chunks/{chunk-UPPM2FOZ.js → chunk-QPZHQY2O.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-34HASX3S.js → chunk-SF6SM6U5.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SVK5Y64D.js +40 -0
- package/dist/cli-bundle/chunks/chunk-V5GBD5KV.js +9 -0
- package/dist/cli-bundle/chunks/{chunk-LENC656S.js → chunk-WWAEGW4V.js} +67 -70
- package/dist/cli-bundle/chunks/chunk-ZRAQS3UA.js +8 -0
- package/dist/cli-bundle/chunks/{register-list-query-W2ZTOMKP.js → register-list-query-AYKGODWT.js} +3 -3
- package/dist/cli-bundle/chunks/{register-mutation-RVND5NCG.js → register-mutation-YZYG53SQ.js} +4 -4
- package/dist/cli-bundle/chunks/register-operations-KFSCC7QV.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-D3ZFHY3L.js → register-setup-UJCRVGBG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-24IG6ONG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M5M6SVHS.js → chunk-3ASU6WGI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3ITLIBKS.js +56 -0
- package/dist/cli-bundle/focused-chunks/chunk-3NQD5YDG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-S27XMBIN.js → chunk-4OSHLNUE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-65N6JHAN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-5RFXUPN5.js → chunk-B2TTQGFG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-GUBM3RGY.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-Q45NHPF2.js → chunk-H5FOGAVD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-JX3RCVCX.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-D7KXFBXV.js → chunk-KWWCBWFO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MV752SUC.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-PKIPMCFS.js +6 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4HJFY4MB.js → chunk-QL66QNWG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RJMR2JIF.js +9 -0
- package/dist/cli-bundle/focused-chunks/chunk-WIUPWIZR.js +177 -0
- package/dist/cli-bundle/focused-chunks/chunk-WOCIPMW7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GT7MXDLW.js → chunk-YEF5PQQ2.js} +2 -2
- package/dist/cli-bundle/main.js +22 -15
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +29 -32
- 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 +45 -37
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +10 -10
- package/dist/core/diagnostics/remediation.js +4 -4
- package/dist/core/extensions/extension-types.d.ts +2 -0
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/history/drift-scan.d.ts +5 -0
- package/dist/core/history/drift-scan.js +16 -6
- package/dist/core/history/event-classification.d.ts +1 -1
- package/dist/core/history/event-classification.js +3 -2
- package/dist/core/history/history.d.ts +37 -1
- package/dist/core/history/history.js +311 -59
- package/dist/core/history/identity.d.ts +15 -0
- package/dist/core/history/identity.js +31 -0
- package/dist/core/history/projection.js +50 -17
- package/dist/core/history/read.js +6 -3
- package/dist/core/history/replay.d.ts +1 -2
- package/dist/core/history/replay.js +70 -36
- package/dist/core/history/version-address.d.ts +13 -0
- package/dist/core/history/version-address.js +33 -0
- package/dist/core/item/actionability.d.ts +21 -1
- package/dist/core/item/actionability.js +45 -10
- package/dist/core/item/id.js +8 -4
- package/dist/core/item/item-type-definition.d.ts +2 -0
- package/dist/core/item/item-type-definition.js +9 -2
- package/dist/core/item/type-registry.d.ts +5 -1
- package/dist/core/item/type-registry.js +9 -4
- package/dist/core/lock/lock.d.ts +10 -0
- package/dist/core/lock/lock.js +42 -3
- package/dist/core/shared/author.d.ts +3 -1
- package/dist/core/shared/author.js +111 -23
- package/dist/core/shared/errors.d.ts +8 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/item-store.d.ts +14 -0
- package/dist/core/store/item-store.js +48 -10
- package/dist/core/store/settings-validator.js +3 -2
- package/dist/sdk/actionability.d.ts +1 -1
- package/dist/sdk/actionability.js +3 -3
- package/dist/sdk/cli-contracts/command-aliases.js +11 -2
- package/dist/sdk/cli-contracts/completeness.js +4 -3
- package/dist/sdk/cli-contracts/flag-contracts.js +29 -5
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +19 -12
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +14 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +19 -6
- package/dist/sdk/context-intent-contracts.js +3 -3
- package/dist/sdk/context-usage.js +9 -11
- package/dist/sdk/define.d.ts +1 -1
- package/dist/sdk/define.js +2 -2
- package/dist/sdk/environment/agent-environment.d.ts +296 -0
- package/dist/sdk/environment/agent-environment.js +467 -0
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +19 -1
- package/dist/sdk/environment/project-runtime-compatibility.js +118 -21
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +98 -38
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -2
- package/dist/sdk/governance/health.js +13 -44
- package/dist/sdk/governance/merge-receipt-history.d.ts +62 -0
- package/dist/sdk/governance/merge-receipt-history.js +207 -0
- package/dist/sdk/governance/provenance-health.js +9 -3
- package/dist/sdk/governance/validate-history-drift.js +16 -5
- package/dist/sdk/guide-topics.js +116 -2
- package/dist/sdk/history/salvage.d.ts +35 -0
- package/dist/sdk/history/salvage.js +248 -0
- package/dist/sdk/history-compact.js +41 -37
- package/dist/sdk/history-read.d.ts +3 -2
- package/dist/sdk/history-read.js +6 -3
- package/dist/sdk/history-redact.js +58 -23
- package/dist/sdk/history-repair.d.ts +5 -0
- package/dist/sdk/history-repair.js +28 -6
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +4 -2
- package/dist/sdk/lifecycle/claim.d.ts +4 -0
- package/dist/sdk/lifecycle/claim.js +9 -3
- package/dist/sdk/lifecycle/restore.d.ts +1 -0
- package/dist/sdk/lifecycle/restore.js +19 -7
- package/dist/sdk/merge/driver.d.ts +3 -1
- package/dist/sdk/merge/driver.js +9 -9
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/receipts.d.ts +17 -6
- package/dist/sdk/merge/receipts.js +246 -75
- package/dist/sdk/merge/reconcile.d.ts +9 -7
- package/dist/sdk/merge/reconcile.js +175 -12
- package/dist/sdk/merge/three-way.d.ts +22 -2
- package/dist/sdk/merge/three-way.js +92 -25
- package/dist/sdk/output-projection.d.ts +3 -1
- package/dist/sdk/output-projection.js +11 -3
- package/dist/sdk/public-surface.json +1 -0
- package/dist/sdk/query/context.d.ts +9 -0
- package/dist/sdk/query/context.js +33 -21
- package/dist/sdk/query/get.d.ts +2 -2
- package/dist/sdk/query/get.js +4 -3
- package/dist/sdk/query/history.d.ts +11 -0
- package/dist/sdk/query/history.js +34 -10
- package/dist/sdk/query/next.d.ts +15 -1
- package/dist/sdk/query/next.js +43 -20
- package/dist/sdk/query.d.ts +1 -0
- package/dist/sdk/query.js +3 -2
- package/dist/sdk/runtime-primitives.d.ts +3 -3
- package/dist/sdk/runtime-primitives.js +5 -5
- package/dist/types.d.ts +27 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_ENVIRONMENTS.md +47 -0
- package/docs/AGENT_GUIDE.md +36 -0
- package/docs/AGENT_PROVENANCE_ADR.md +17 -2
- package/docs/CONTEXT_INTEGRITY_CONTRACTS.md +38 -1
- package/docs/HISTORY_RECOVERY.md +146 -0
- package/docs/MERGE_SAFETY.md +119 -23
- package/docs/README.md +2 -0
- package/docs/RELEASING.md +25 -11
- package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +24 -2
- package/docs/SDK_CONTEXT_TRUTH_CONTRACTS.md +24 -1
- package/docs/SDK_EXECUTION_CONTRACTS.md +105 -0
- package/docs/SDK_RUNTIME_BOUNDARIES.md +17 -1
- package/docs/TESTING.md +5 -0
- package/docs/agent-task-token-baseline.json +17 -17
- package/docs/agent-task-transcripts.json +2 -1
- package/docs/examples/sdk-agent-environment/README.md +14 -0
- package/docs/examples/sdk-agent-environment/package.json +8 -0
- package/docs/examples/sdk-agent-environment/run-agent-environment.mjs +154 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +10 -10
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +12 -3
- package/marketplace.json +2 -2
- package/package.json +5 -6
- 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/skills/pm-audit/SKILL.md +2 -2
- package/plugins/pm-claude/skills/pm-developer/SKILL.md +2 -2
- package/plugins/pm-claude/skills/pm-planner/SKILL.md +2 -2
- package/plugins/pm-claude/skills/pm-release/SKILL.md +2 -2
- package/plugins/pm-claude/skills/pm-workflow/SKILL.md +3 -3
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/skills/pm-auditor/SKILL.md +2 -2
- package/plugins/pm-codex/skills/pm-native/SKILL.md +3 -4
- package/plugins/pm-codex/skills/pm-release/SKILL.md +2 -2
- package/scripts/finalize-build.mjs +13 -1
- package/dist/cli-bundle/chunks/chunk-AY324UJ5.js +0 -9
- package/dist/cli-bundle/chunks/chunk-E5RBBCXO.js +0 -230
- package/dist/cli-bundle/chunks/chunk-IEHHE6GA.js +0 -5
- package/dist/cli-bundle/chunks/chunk-L7B7343B.js +0 -8
- package/dist/cli-bundle/chunks/chunk-LISESA7W.js +0 -35
- package/dist/cli-bundle/chunks/register-operations-TTROIVC4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3ZBI35HU.js +0 -176
- package/dist/cli-bundle/focused-chunks/chunk-4RRHC3S4.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-4WR46RMG.js +0 -9
- package/dist/cli-bundle/focused-chunks/chunk-BWKHEIVF.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-GHCZ3YFR.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-KBLZRU62.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-KZ2NB3ET.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-OL5EH6I3.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QKHCSUGJ.js +0 -51
- package/dist/cli-bundle/focused-chunks/chunk-TXE4TSHM.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-UCLO3XDU.js +0 -2
- package/sdk/public-surface.json +0 -32524
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Implements the pm history repair command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d397bc22-d0ae-5c3d-a1bf-7f4c38ca31be")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "./environment/tracker-preflight.js";
|
|
9
|
+
import { salvageHistoryTail } from "./history/salvage.js";
|
|
9
10
|
import { realpath } from "node:fs/promises";
|
|
10
11
|
import path from "node:path";
|
|
11
12
|
import jsonPatch from "fast-json-patch";
|
|
@@ -13,21 +14,24 @@ import { patchPathToChangedField } from "../core/history/history-diff.js";
|
|
|
13
14
|
import { pathExists, readFileIfExists } from "../core/fs/fs-utils.js";
|
|
14
15
|
import { executeHistoryRewrite, writeHistoryRawWithRollback, } from "../core/history/history-rewrite.js";
|
|
15
16
|
import { historyEntriesToRaw, normalizeReplayPatchOps, reanchorHistoryEntries, replayHashVerificationCandidates, resolveHistoryRepairItemHashVersion, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
|
|
17
|
+
import { sealHistoryRecord, } from "../core/history/history.js";
|
|
18
|
+
import { classifyHistoryEvent } from "../core/history/event-classification.js";
|
|
16
19
|
import { scanHistoryDrift } from "../core/history/drift-scan.js";
|
|
17
20
|
import { invalidateHistoryDriftCache } from "../core/history/drift-cache.js";
|
|
18
21
|
import { readHistoryEntries } from "../core/history/read.js";
|
|
19
22
|
import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
|
|
20
23
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
21
24
|
import { PmCliError } from "../core/shared/errors.js";
|
|
25
|
+
import { sha256Hex, stableStringify } from "../core/shared/serialization.js";
|
|
22
26
|
import { resolveAuthor } from "../core/shared/author.js";
|
|
23
27
|
import { nowIso } from "../core/shared/time.js";
|
|
24
|
-
import { sha256Hex, stableStringify } from "../core/shared/serialization.js";
|
|
25
28
|
import { getActiveExtensionRegistrations, runActiveOnWriteHooks, } from "../core/extensions/index.js";
|
|
26
29
|
import { listAllItemMetadataWithBody, readLocatedItem, } from "../core/store/item-store.js";
|
|
27
30
|
import { resolvePmRoot } from "../core/store/paths.js";
|
|
28
31
|
import { readSettings } from "../core/store/settings.js";
|
|
29
32
|
import { resolveHistorySubject } from "./history-redact.js";
|
|
30
33
|
import { inspectMergeReceiptEvidence, summarizeMergeReceipt, } from "./merge/receipts.js";
|
|
34
|
+
import { encodeItemScalarDecisionValue, hashItemScalarDecisionValue, } from "./merge/three-way.js";
|
|
31
35
|
import { listInvalidProvenanceHistoryStreamIds, normalizeInvalidHistoryProvenance, } from "./governance/provenance-health.js";
|
|
32
36
|
function replayFieldValue(document, field) {
|
|
33
37
|
return field === "body"
|
|
@@ -169,7 +173,10 @@ async function verifyReceiptAgainstSnapshot(params) {
|
|
|
169
173
|
const currentMetadata = params.currentItemReplay.metadata;
|
|
170
174
|
const valuesMatch = declaredFields.every((field) => {
|
|
171
175
|
const value = field === "body" ? params.currentItemReplay.body : currentMetadata[field];
|
|
172
|
-
return
|
|
176
|
+
return [
|
|
177
|
+
hashItemScalarDecisionValue(value),
|
|
178
|
+
sha256Hex(stableStringify(encodeItemScalarDecisionValue(value))),
|
|
179
|
+
].includes(hashes[field]);
|
|
173
180
|
});
|
|
174
181
|
return valuesMatch ? { receipt: params.receipt, declaredFields } : null;
|
|
175
182
|
}
|
|
@@ -316,7 +323,7 @@ function buildHistoryRepairEntries(params) {
|
|
|
316
323
|
const previousAfterHash = params.reanchorEntries[params.reanchorEntries.length - 1].after_hash;
|
|
317
324
|
const semanticIndex = beforeHashes.indexOf(previousAfterHash);
|
|
318
325
|
const afterHashes = replayHashVerificationCandidates(afterReplay, params.itemHashVersion);
|
|
319
|
-
|
|
326
|
+
const auditEntry = {
|
|
320
327
|
ts: nowIso(),
|
|
321
328
|
author: params.author,
|
|
322
329
|
op: params.auditOperation,
|
|
@@ -332,7 +339,11 @@ function buildHistoryRepairEntries(params) {
|
|
|
332
339
|
...(params.auditContext === undefined
|
|
333
340
|
? {}
|
|
334
341
|
: { context: params.auditContext }),
|
|
335
|
-
}
|
|
342
|
+
};
|
|
343
|
+
rewrittenEntries.push(sealHistoryRecord({
|
|
344
|
+
...auditEntry,
|
|
345
|
+
event_class: classifyHistoryEvent(auditEntry),
|
|
346
|
+
}));
|
|
336
347
|
return { rewrittenEntries, auditEntryAdded: true };
|
|
337
348
|
}
|
|
338
349
|
function collectHistoryRepairWarnings(changed, skippedOps, reconciliation) {
|
|
@@ -379,6 +390,14 @@ export async function runHistoryRepair(id, options, global) {
|
|
|
379
390
|
const settings = await readSettings(pmRoot);
|
|
380
391
|
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
381
392
|
const subject = await resolveHistorySubject(pmRoot, id, settings, typeRegistry.type_to_folder);
|
|
393
|
+
if (options.salvageTail === true) {
|
|
394
|
+
return salvageHistoryTail({ pmRoot, subject, settings, typeRegistry, options, author: resolveAuthor(options.author, settings.author_default) });
|
|
395
|
+
}
|
|
396
|
+
return repairHistorySubject({ pmRoot, subject, settings, typeRegistry, options });
|
|
397
|
+
}
|
|
398
|
+
/** Reanchor or reconcile one resolved subject, separately from byte-preserving salvage. */
|
|
399
|
+
async function repairHistorySubject(params) {
|
|
400
|
+
const { pmRoot, subject, settings, typeRegistry, options } = params;
|
|
382
401
|
if (!(await pathExists(subject.historyPath))) {
|
|
383
402
|
throw new PmCliError(`No history stream exists for ${subject.id}.`, EXIT_CODE.NOT_FOUND);
|
|
384
403
|
}
|
|
@@ -527,6 +546,9 @@ export function assertHistoryRepairTarget(id, all) {
|
|
|
527
546
|
}
|
|
528
547
|
/** Bulk drift repair: scan every item's history stream with the same drift scan `pm health` uses, then run the audited single-stream repair (ownership check, lock, no-drift verification, audit marker) for each drifted stream. One failing stream never aborts the rest; failures are collected per row and the caller decides the exit code from `totals.failed`. */
|
|
529
548
|
export async function runHistoryRepairAll(options, global) {
|
|
549
|
+
if (options.salvageTail === true) {
|
|
550
|
+
throw new PmCliError("Tail salvage requires one explicit item ID; --all is not supported.", EXIT_CODE.USAGE);
|
|
551
|
+
}
|
|
530
552
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
531
553
|
await assertInitializedTracker(pmRoot);
|
|
532
554
|
const settings = await readSettings(pmRoot);
|
|
@@ -598,4 +620,4 @@ export async function runHistoryRepairAll(options, global) {
|
|
|
598
620
|
};
|
|
599
621
|
}
|
|
600
622
|
//# sourceMappingURL=history-repair.js.map
|
|
601
|
-
//# debugId=
|
|
623
|
+
//# debugId=d397bc22-d0ae-5c3d-a1bf-7f4c38ca31be
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./mcp/apps.js";
|
|
|
14
14
|
export * from "./mcp/skills.js";
|
|
15
15
|
export * from "./cli-contracts/grammar-contracts.js";
|
|
16
16
|
export * from "./agent-session-context.js";
|
|
17
|
+
export * from "./environment/agent-environment.js";
|
|
17
18
|
export type { PmCommandCapabilityContract, PmCommandCapabilityFamily, PmCommandVisibilityContract, PmCommandVisibilityTier, PmMcpPromptArgumentContract, PmMcpPromptContract, PmMcpResourceContract, PmMcpToolProfile, } from "./agent-capability-contracts.js";
|
|
18
19
|
export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, normalizeAnnotationTransportOptions, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, type AnnotationCommandConfig, type AnnotationCommandOptions, type AnnotationCommandResult, type AnnotationEntry, type AnnotationInput, type AnnotationHistoryRestoration, type AnnotationMutationReceipt, type AnnotationOmissionReceipt, type AnnotationSourceOptions, type OwnershipConflictGuidance, } from "./annotations.js";
|
|
19
20
|
export { acknowledgeUnknownAuthorHistoryEvents, acknowledgeUnknownAuthorHistoryEventsFromTransport, inspectHistoryAuthorStream, parseUnknownAuthorHistoryEventCoordinates, planUnknownAuthorHistoryAcknowledgment, resolveUnknownAuthorAcknowledgmentSelector, scanHistoryAuthorAttribution, type AcknowledgeUnknownAuthorEventsOptions, type HistoryAuthorAttributionScan, type UnknownAuthorAcknowledgmentPlan, type UnknownAuthorAcknowledgmentPlanCoordinate, type UnknownAuthorAcknowledgmentResult, type UnknownAuthorHistoryEvent, } from "./author-attribution.js";
|
|
@@ -75,6 +76,7 @@ export * from "./governance/assurance-runtime.js";
|
|
|
75
76
|
export * from "./governance/assurance-presets.js";
|
|
76
77
|
export * from "./governance/boundary-fixtures.js";
|
|
77
78
|
export * from "./governance/defect-recurrence.js";
|
|
79
|
+
export * from "./governance/merge-receipt-history.js";
|
|
78
80
|
export * from "./compile-cache.js";
|
|
79
81
|
export * from "./environment/project-runtime-compatibility.js";
|
|
80
82
|
export * from "./environment/source-context.js";
|
package/dist/sdk/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Defines public SDK APIs and package-author helpers for Index.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ea74fa78-184f-55e7-8c8e-fb912f4d26d8")}catch(e){}}();
|
|
8
8
|
export { PM_COMMAND_CAPABILITY_CONTRACTS, PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForFamily, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandCapabilityFamily, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
|
|
9
9
|
export * from "./mcp/protocol.js";
|
|
10
10
|
export * from "./mcp/interactions.js";
|
|
@@ -16,6 +16,7 @@ export * from "./mcp/apps.js";
|
|
|
16
16
|
export * from "./mcp/skills.js";
|
|
17
17
|
export * from "./cli-contracts/grammar-contracts.js";
|
|
18
18
|
export * from "./agent-session-context.js";
|
|
19
|
+
export * from "./environment/agent-environment.js";
|
|
19
20
|
export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, normalizeAnnotationTransportOptions, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, } from "./annotations.js";
|
|
20
21
|
export { acknowledgeUnknownAuthorHistoryEvents, acknowledgeUnknownAuthorHistoryEventsFromTransport, inspectHistoryAuthorStream, parseUnknownAuthorHistoryEventCoordinates, planUnknownAuthorHistoryAcknowledgment, resolveUnknownAuthorAcknowledgmentSelector, scanHistoryAuthorAttribution, } from "./author-attribution.js";
|
|
21
22
|
export { BUILTIN_CORPUS_SHAPES, PM_CORPUS_SHAPE_SCHEMA, buildCorpusShapeItemPlan, createCorpusShapeMeasurement, defineCorpusShape, listBuiltinCorpusShapes, measureCorpusShapePlan, resolveBuiltinCorpusShape, } from "./corpus-shape.js";
|
|
@@ -72,6 +73,7 @@ export * from "./governance/assurance-runtime.js";
|
|
|
72
73
|
export * from "./governance/assurance-presets.js";
|
|
73
74
|
export * from "./governance/boundary-fixtures.js";
|
|
74
75
|
export * from "./governance/defect-recurrence.js";
|
|
76
|
+
export * from "./governance/merge-receipt-history.js";
|
|
75
77
|
export * from "./compile-cache.js";
|
|
76
78
|
export * from "./environment/project-runtime-compatibility.js";
|
|
77
79
|
export * from "./environment/source-context.js";
|
|
@@ -179,4 +181,4 @@ export * from "./mcp/discovery.js";
|
|
|
179
181
|
export * from "./query.js";
|
|
180
182
|
export * from "./testing.js";
|
|
181
183
|
//# sourceMappingURL=index.js.map
|
|
182
|
-
//# debugId=
|
|
184
|
+
//# debugId=ea74fa78-184f-55e7-8c8e-fb912f4d26d8
|
|
@@ -62,6 +62,10 @@ export interface ReleaseResult {
|
|
|
62
62
|
previous_assignee: string | null;
|
|
63
63
|
/** Value that configures or reports forced for this contract. */
|
|
64
64
|
forced: boolean;
|
|
65
|
+
/** Stable handoff diagnostics shared by CLI and MCP consumers. */
|
|
66
|
+
warnings?: string[];
|
|
67
|
+
/** Concrete recovery commands when releasing ownership leaves work in progress. */
|
|
68
|
+
suggestions?: string[];
|
|
65
69
|
}
|
|
66
70
|
/** Documents the claim mutation options payload exchanged by command, SDK, and package integrations. */
|
|
67
71
|
export interface ClaimMutationOptions {
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Implements the pm claim command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a4d95016-05b9-5272-8044-2649da644e98")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
-
import { resolveRuntimeStatusRegistry, statusIsTerminal, EXIT_CODE, PmCliError, toItemRecord, mutateItem, resolvePmRoot, readSettings, resolveAuthor, resolveClaimPrincipal, } from "../runtime-primitives.js";
|
|
9
|
+
import { resolveRuntimeStatusRegistry, statusIsTerminal, EXIT_CODE, PmCliError, toItemRecord, mutateItem, resolvePmRoot, readSettings, resolveAuthor, resolveClaimPrincipal, normalizeStatusForRegistry, } from "../runtime-primitives.js";
|
|
10
10
|
import { wrapOwnershipConflict } from "../annotations.js";
|
|
11
11
|
import { describeItemOwnershipConflict } from "../ownership-source.js";
|
|
12
12
|
import { runNext, } from "../query/next.js";
|
|
@@ -226,12 +226,18 @@ export async function runRelease(id, force, global, options = {}) {
|
|
|
226
226
|
principal: claimPrincipal,
|
|
227
227
|
itemId: result.item.id,
|
|
228
228
|
});
|
|
229
|
+
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
230
|
+
const stillInProgress = normalizeStatusForRegistry(result.item.status, statusRegistry) === normalizeStatusForRegistry(statusRegistry.in_progress_status, statusRegistry);
|
|
229
231
|
return {
|
|
230
232
|
item: toItemRecord(result.item),
|
|
231
233
|
released_by: author,
|
|
232
234
|
previous_assignee: previousAssignee,
|
|
233
235
|
forced: force,
|
|
236
|
+
...(stillInProgress ? {
|
|
237
|
+
warnings: ["released_unclaimed_in_progress"],
|
|
238
|
+
suggestions: [`${result.item.id} remains ${result.item.status} and unclaimed. If work is paused, run pm pause-task ${result.item.id} to move it to ${statusRegistry.open_status}.`],
|
|
239
|
+
} : {}),
|
|
234
240
|
};
|
|
235
241
|
}
|
|
236
242
|
//# sourceMappingURL=claim.js.map
|
|
237
|
-
//# debugId=
|
|
243
|
+
//# debugId=a4d95016-05b9-5272-8044-2649da644e98
|
|
@@ -4,13 +4,22 @@
|
|
|
4
4
|
* Implements the SDK-owned restore lifecycle operation shared by every surface.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7a3effef-6ba8-51ba-ae99-436d4ef69813")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
9
|
import jsonPatch from "fast-json-patch";
|
|
10
10
|
import fs from "node:fs/promises";
|
|
11
|
-
import {
|
|
11
|
+
import { readLocatedItemSnapshot } from "../../core/store/item-store.js";
|
|
12
|
+
import { historyVersionOffset } from "../../core/history/version-address.js";
|
|
13
|
+
import { pathExists, readFileIfExists, writeFileAtomic, appendHistoryEntry, createHistoryEntry, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, enforceHistoryStreamPolicyForItem, normalizeItemId, normalizeRawItemId, canonicalDocument, serializeItemDocument, resolveItemTypeRegistry, acquireLock, EXIT_CODE, PmCliError, nowIso, getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveOnWriteHooks, runActiveBeforeMutationHooks, locateItem, createMutationGuardSdk, getHistoryPath, getItemPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
12
14
|
import { applyHistoryPatch, ensureMaterializedHistoryTarget as ensureMaterializedRestoreTarget, extractPatchFailureContext, readHistoryEntries, replayHistoryToTarget as replayToTarget, resolveHistoryTarget, } from "../history-read.js";
|
|
13
15
|
import { acquireItemMetadataDerivedIndexLock, refreshItemMetadataDerivedIndex, } from "../item-metadata-index.js";
|
|
16
|
+
/** Read a restore input without discarding unreadable bytes needed for rollback. */
|
|
17
|
+
async function readRestoreItem(located, settings, history) {
|
|
18
|
+
const snapshot = await readLocatedItemSnapshot(located, { schema: settings.schema });
|
|
19
|
+
return snapshot.error === null
|
|
20
|
+
? { raw: snapshot.raw, document: snapshot.document }
|
|
21
|
+
: { raw: snapshot.raw, document: replayCurrentDocument(history), recovered: true };
|
|
22
|
+
}
|
|
14
23
|
/** Resolve restore targets with the command's established wording and at-or-before timestamp semantics. */
|
|
15
24
|
function ensureReplayTarget(target, history) {
|
|
16
25
|
return resolveHistoryTarget(target, history, {
|
|
@@ -82,6 +91,7 @@ function changedFields(beforeDocument, afterDocument) {
|
|
|
82
91
|
}
|
|
83
92
|
return Array.from(fields).sort((a, b) => a.localeCompare(b));
|
|
84
93
|
}
|
|
94
|
+
/** Reload item and history under the caller's lock, refusing changes since the recovery snapshot. */
|
|
85
95
|
async function loadRestoreStateUnderLock(params) {
|
|
86
96
|
const historyRawUnderLock = await readFileIfExists(params.subject.historyPath);
|
|
87
97
|
if (historyRawUnderLock !== params.historyRawBeforeLock) {
|
|
@@ -89,9 +99,7 @@ async function loadRestoreStateUnderLock(params) {
|
|
|
89
99
|
}
|
|
90
100
|
const locatedUnderLock = await locateItem(params.pmRoot, params.resolvedId, params.settings.id_prefix, params.settings.item_format, params.typeToFolder);
|
|
91
101
|
const loadedItemUnderLock = locatedUnderLock
|
|
92
|
-
? await
|
|
93
|
-
schema: params.settings.schema,
|
|
94
|
-
})
|
|
102
|
+
? await readRestoreItem(locatedUnderLock, params.settings, params.history)
|
|
95
103
|
: null;
|
|
96
104
|
if ((loadedItemUnderLock?.raw ?? null) !== params.currentItemRawBeforeLock) {
|
|
97
105
|
throw new PmCliError(`Item ${params.resolvedId} changed while waiting for lock; retry restore.`, EXIT_CODE.CONFLICT);
|
|
@@ -183,7 +191,7 @@ export async function runRestore(id, target, options, global) {
|
|
|
183
191
|
throw new PmCliError(`Restore target resolved to item ${restoredDocument.metadata.id}, expected ${resolvedId}.`, EXIT_CODE.GENERIC_FAILURE);
|
|
184
192
|
}
|
|
185
193
|
const loadedItemBeforeLock = subject.located
|
|
186
|
-
? await
|
|
194
|
+
? await readRestoreItem(subject.located, settings, history)
|
|
187
195
|
: null;
|
|
188
196
|
const currentItemRawBeforeLock = loadedItemBeforeLock?.raw ?? null;
|
|
189
197
|
const author = resolveAuthor(options.author, settings.author_default);
|
|
@@ -197,6 +205,7 @@ export async function runRestore(id, target, options, global) {
|
|
|
197
205
|
typeToFolder: typeRegistry.type_to_folder,
|
|
198
206
|
historyRawBeforeLock,
|
|
199
207
|
currentItemRawBeforeLock,
|
|
208
|
+
history,
|
|
200
209
|
});
|
|
201
210
|
const itemFormat = "toon";
|
|
202
211
|
const currentState = resolveRestoreCurrentState(loadedItemUnderLock, history);
|
|
@@ -282,17 +291,20 @@ export async function runRestore(id, target, options, global) {
|
|
|
282
291
|
changed_fields: restoreChangedFields,
|
|
283
292
|
});
|
|
284
293
|
const targetEntry = history[resolvedTarget.historyIndex];
|
|
294
|
+
const offset = historyVersionOffset(history, true);
|
|
285
295
|
return {
|
|
286
296
|
item: restoredDocument.metadata,
|
|
287
297
|
restored_from: {
|
|
288
298
|
kind: resolvedTarget.kind,
|
|
289
299
|
target: resolvedTarget.raw,
|
|
290
300
|
history_index: resolvedTarget.historyIndex + 1,
|
|
301
|
+
version: offset === null ? null : offset + resolvedTarget.historyIndex + 1,
|
|
291
302
|
entry_ts: targetEntry.ts,
|
|
292
303
|
entry_op: targetEntry.op,
|
|
293
304
|
},
|
|
294
305
|
changed_fields: restoreChangedFields,
|
|
295
306
|
warnings: [
|
|
307
|
+
...(loadedItemUnderLock?.recovered ? ["restore_unreadable_item_recovered"] : []),
|
|
296
308
|
...subject.historyPolicyWarnings,
|
|
297
309
|
...ownershipWarnings,
|
|
298
310
|
...derivedIndexWarnings,
|
|
@@ -316,4 +328,4 @@ export const _testOnlyRestoreCommand = {
|
|
|
316
328
|
resolveRestoreSubject,
|
|
317
329
|
};
|
|
318
330
|
//# sourceMappingURL=restore.js.map
|
|
319
|
-
//# debugId=
|
|
331
|
+
//# debugId=7a3effef-6ba8-51ba-ae99-436d4ef69813
|
|
@@ -56,7 +56,9 @@ export interface MergeDriverResult {
|
|
|
56
56
|
item?: {
|
|
57
57
|
fields_from_theirs: string[];
|
|
58
58
|
union_fields: string[];
|
|
59
|
-
conflict_resolution: "
|
|
59
|
+
conflict_resolution: "latest_document_update";
|
|
60
|
+
/** Item scalars ignore branch-direction preference under the convergent recency policy. */
|
|
61
|
+
requested_preference_applied: false;
|
|
60
62
|
};
|
|
61
63
|
/** JSON-merge key accounting; present only for the json artifact. */
|
|
62
64
|
json?: {
|
package/dist/sdk/merge/driver.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* merge never corrupts tracker storage the way raw conflict markers do.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
12
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5dc5f70c-0b04-51bb-983b-49b15be11587")}catch(e){}}();
|
|
13
13
|
import { readFile, writeFile } from "node:fs/promises";
|
|
14
14
|
import path from "node:path";
|
|
15
15
|
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
@@ -18,11 +18,10 @@ import { pathExists } from "../../core/fs/fs-utils.js";
|
|
|
18
18
|
import { parseItemDocument } from "../../core/item/item-format.js";
|
|
19
19
|
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
20
20
|
import { PmCliError } from "../../core/shared/errors.js";
|
|
21
|
-
import { sha256Hex, stableStringify } from "../../core/shared/serialization.js";
|
|
22
21
|
import { nowIso } from "../../core/shared/time.js";
|
|
23
22
|
import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
|
|
24
23
|
import { readSettings } from "../../core/store/settings.js";
|
|
25
|
-
import { mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, } from "./three-way.js";
|
|
24
|
+
import { hashItemScalarDecisionValue, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, } from "./three-way.js";
|
|
26
25
|
import { summarizeMergeReceipt, writeMergeReceipt, } from "./receipts.js";
|
|
27
26
|
/** Supported values accepted by the merge driver artifact contract across CLI, SDK, and MCP surfaces. */
|
|
28
27
|
export const MERGE_DRIVER_ARTIFACT_VALUES = [
|
|
@@ -131,14 +130,15 @@ export async function runMergeDriver(options, global) {
|
|
|
131
130
|
schema: settings?.schema,
|
|
132
131
|
extensionFieldNames,
|
|
133
132
|
preferred,
|
|
134
|
-
conflictResolution: "
|
|
133
|
+
conflictResolution: "latest_document_update",
|
|
135
134
|
});
|
|
136
135
|
merged = itemMerge.merged;
|
|
137
136
|
conflicts.push(...itemMerge.conflict_fields);
|
|
138
137
|
result.item = {
|
|
139
138
|
fields_from_theirs: itemMerge.fields_from_theirs,
|
|
140
139
|
union_fields: itemMerge.union_fields,
|
|
141
|
-
conflict_resolution: "
|
|
140
|
+
conflict_resolution: "latest_document_update",
|
|
141
|
+
requested_preference_applied: false,
|
|
142
142
|
};
|
|
143
143
|
if (options.itemPath !== undefined) {
|
|
144
144
|
const mergedDocument = parseItemDocument(merged, {
|
|
@@ -158,12 +158,12 @@ export async function runMergeDriver(options, global) {
|
|
|
158
158
|
cwd: process.cwd(),
|
|
159
159
|
itemPath: options.itemPath,
|
|
160
160
|
preferred,
|
|
161
|
-
conflictResolution: "
|
|
161
|
+
conflictResolution: "latest_document_update",
|
|
162
162
|
fieldsFromTheirs: itemMerge.fields_from_theirs,
|
|
163
163
|
unionFields: itemMerge.union_fields,
|
|
164
164
|
mergedFieldHashes: Object.fromEntries(receiptFields.map((field) => [
|
|
165
165
|
field,
|
|
166
|
-
|
|
166
|
+
hashItemScalarDecisionValue(field === "body" ? mergedDocument.body : mergedMetadata[field]),
|
|
167
167
|
])),
|
|
168
168
|
decisions: itemMerge.conflict_decisions,
|
|
169
169
|
};
|
|
@@ -191,7 +191,7 @@ export async function runMergeDriver(options, global) {
|
|
|
191
191
|
const receiptGuidance = result.receipt === undefined
|
|
192
192
|
? 'Run "pm merge report" to inspect clone-local merge evidence.'
|
|
193
193
|
: `Run "pm merge report" and correlate receipt ${result.receipt.receipt_id} with item ${result.receipt.item_id}; clone-local discarded values are never copied into this result.`;
|
|
194
|
-
guidance.push(`Both branches changed ${conflicts.join(", ")}; the item driver kept the
|
|
194
|
+
guidance.push(`Both branches changed ${conflicts.join(", ")}; the item driver kept the value from the later document update, with stable value order only as an equal-timestamp tie-break. --prefer does not apply to convergent item scalar conflicts. ${receiptGuidance} Review the merged file, re-apply the discarded change if needed, then "git add" it.`);
|
|
195
195
|
}
|
|
196
196
|
if (artifact === "history" && result.history?.reanchored) {
|
|
197
197
|
guidance.push('The merged history chain was re-anchored. Run "pm merge reconcile --dry-run" to inspect the complete post-merge repair, then "pm merge reconcile" to apply it; use --force only after explicitly accepting reported discards.');
|
|
@@ -208,4 +208,4 @@ export async function runMergeDriver(options, global) {
|
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
//# sourceMappingURL=driver.js.map
|
|
211
|
-
//# debugId=
|
|
211
|
+
//# debugId=5dc5f70c-0b04-51bb-983b-49b15be11587
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* merge-configuration installer. The CLI `pm merge` command is a shim over
|
|
7
7
|
* this module so packages and hosts can reuse the same merge behavior.
|
|
8
8
|
*/
|
|
9
|
-
export { ITEM_LATEST_TIMESTAMP_FIELDS, ITEM_UNION_COLLECTION_FIELDS, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, type HistoryMergeResult, type HistoryMergeStrategy, type ItemDocumentMergeResult, type JsonDocumentMergeResult, type ItemMergeConflictDecision, type MergePreferredSide, type RelationshipStreamMergeResult, } from "./three-way.js";
|
|
9
|
+
export { ITEM_SCALAR_MISSING_VALUE, ITEM_LATEST_TIMESTAMP_FIELDS, ITEM_UNION_COLLECTION_FIELDS, encodeItemScalarDecisionValue, hashItemScalarDecisionValue, isItemScalarMissingValue, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, type HistoryMergeResult, type HistoryMergeStrategy, type ItemDocumentMergeResult, type JsonDocumentMergeResult, type ItemMergeConflictDecision, type ItemScalarConflictResolution, type ItemScalarResolutionBasis, type MergePreferredSide, type RelationshipStreamMergeResult, } from "./three-way.js";
|
|
10
10
|
export { inspectMergeReceiptEvidence, listMergeReceipts, markMergeReceiptReconciled, runMergeReceiptEvidenceReport, runMergeReceiptReport, summarizeMergeReceipt, type MergeDecisionReceipt, type MergeDecisionReceiptSummary, type MergeReceiptEvidenceReport, type MergeReceiptEvidenceScan, type MergeReceiptInvalidEvidence, type MergeReceiptReport, } from "./receipts.js";
|
|
11
11
|
export { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, type MergeDriverArtifact, type MergeDriverOptions, type MergeDriverResult, } from "./driver.js";
|
|
12
12
|
export { auditMergeAttributeFence, auditMergeDriverConfiguration, buildMergeAttributePatterns, findGitWorkspaceRoot, PM_GITATTRIBUTES_END, PM_GITATTRIBUTES_START, PM_GITATTRIBUTES_V2_END, PM_GITATTRIBUTES_V2_START, refreshMergeAttributeFenceIfInstalled, resolveMergeInstallContext, runMergeInstall, type MergeFenceAuditResult, type MergeDriverConfigurationAuditResult, type MergeFenceRefreshOutcome, type MergeInstallOptions, type MergeInstallContextResolution, type MergeInstallResult, } from "./install.js";
|
package/dist/sdk/merge/index.js
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* this module so packages and hosts can reuse the same merge behavior.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
11
|
-
export { ITEM_LATEST_TIMESTAMP_FIELDS, ITEM_UNION_COLLECTION_FIELDS, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, } from "./three-way.js";
|
|
10
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="925be497-bdd3-527b-9a88-cf9c9f682ab2")}catch(e){}}();
|
|
11
|
+
export { ITEM_SCALAR_MISSING_VALUE, ITEM_LATEST_TIMESTAMP_FIELDS, ITEM_UNION_COLLECTION_FIELDS, encodeItemScalarDecisionValue, hashItemScalarDecisionValue, isItemScalarMissingValue, mergeHistoryStreams, mergeItemDocuments, mergeJsonDocuments, mergeRelationshipEventStreams, } from "./three-way.js";
|
|
12
12
|
export { inspectMergeReceiptEvidence, listMergeReceipts, markMergeReceiptReconciled, runMergeReceiptEvidenceReport, runMergeReceiptReport, summarizeMergeReceipt, } from "./receipts.js";
|
|
13
13
|
export { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, } from "./driver.js";
|
|
14
14
|
export { auditMergeAttributeFence, auditMergeDriverConfiguration, buildMergeAttributePatterns, findGitWorkspaceRoot, PM_GITATTRIBUTES_END, PM_GITATTRIBUTES_START, PM_GITATTRIBUTES_V2_END, PM_GITATTRIBUTES_V2_START, refreshMergeAttributeFenceIfInstalled, resolveMergeInstallContext, runMergeInstall, } from "./install.js";
|
|
15
15
|
export { runMergeReconcile, } from "./reconcile.js";
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
17
|
-
//# debugId=
|
|
17
|
+
//# debugId=925be497-bdd3-527b-9a88-cf9c9f682ab2
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Stats } from "node:fs";
|
|
2
|
-
import type
|
|
2
|
+
import { type ItemMergeConflictDecision, type ItemScalarConflictResolution, type MergePreferredSide } from "./three-way.js";
|
|
3
3
|
/** Return whether a receipt id is safe to expose in cleartext diagnostics. */
|
|
4
4
|
export declare function isSafeReceiptId(value: string): boolean;
|
|
5
|
+
declare const DURABLE_VALUE_POLICY: "bounded_non_sensitive_scalars_v1";
|
|
5
6
|
/** One clone-local merge receipt with recoverable branch values. */
|
|
6
7
|
export interface MergeDecisionReceipt {
|
|
7
8
|
/** Receipt schema version. */
|
|
@@ -14,10 +15,12 @@ export interface MergeDecisionReceipt {
|
|
|
14
15
|
item_id: string;
|
|
15
16
|
/** Side requested by the caller; stable-value decisions can retain either side. */
|
|
16
17
|
requested_preference?: MergePreferredSide;
|
|
18
|
+
/** Whether requested preference participates in item scalar selection. */
|
|
19
|
+
requested_preference_applied?: boolean;
|
|
17
20
|
/** Legacy schema-v1 key accepted while reading older clone-local receipts. */
|
|
18
21
|
preferred?: MergePreferredSide;
|
|
19
22
|
/** Scalar-conflict selection contract used by the item driver. */
|
|
20
|
-
conflict_resolution:
|
|
23
|
+
conflict_resolution: ItemScalarConflictResolution;
|
|
21
24
|
/** Fields selected cleanly from the other branch. */
|
|
22
25
|
fields_from_theirs: string[];
|
|
23
26
|
/** Collections combined from both branches. */
|
|
@@ -33,7 +36,9 @@ export interface MergeDecisionReceipt {
|
|
|
33
36
|
/** Reconciliation timestamp, when consumed. */
|
|
34
37
|
reconciled_at?: string;
|
|
35
38
|
/** Whether decision values are recoverable locally or represented by hashes only. */
|
|
36
|
-
value_availability?: "clone_local" | "hash_only";
|
|
39
|
+
value_availability?: "clone_local" | "hash_only" | "bounded_inline" | "mixed";
|
|
40
|
+
/** Versioned rule governing which durable scalar previews may be committed. */
|
|
41
|
+
value_policy?: typeof DURABLE_VALUE_POLICY;
|
|
37
42
|
/** Runtime-only provenance assigned by the reader; serialized values are ignored. */
|
|
38
43
|
evidence_source?: "clone_local" | "durable";
|
|
39
44
|
}
|
|
@@ -53,8 +58,10 @@ export interface MergeDecisionReceiptSummary {
|
|
|
53
58
|
union_fields: string[];
|
|
54
59
|
/** Side requested by the caller; decision hashes prove the actual retained values. */
|
|
55
60
|
requested_preference: MergePreferredSide;
|
|
61
|
+
/** Whether requested preference participated in item scalar selection. */
|
|
62
|
+
requested_preference_applied: boolean;
|
|
56
63
|
/** Scalar-conflict selection contract used by the item driver. */
|
|
57
|
-
conflict_resolution:
|
|
64
|
+
conflict_resolution: ItemScalarConflictResolution;
|
|
58
65
|
/** Hashes proving the retained and discarded values without publishing them. */
|
|
59
66
|
decisions: Array<{
|
|
60
67
|
field: string;
|
|
@@ -112,12 +119,15 @@ export interface MergeReceiptInvalidEvidence {
|
|
|
112
119
|
/** Evidence store that produced the rejected candidate. */
|
|
113
120
|
evidence_source: "clone_local" | "durable" | "clone_local_and_durable";
|
|
114
121
|
/** Stable failure class suitable for remediation routing and graph analytics. */
|
|
115
|
-
reason: "directory_unreadable" | "candidate_not_bounded_regular_file" | "candidate_unreadable" | "candidate_invalid_json" | "schema_or_identity_invalid" | "copy_provenance_mismatch";
|
|
122
|
+
reason: "directory_unreadable" | "candidate_not_bounded_regular_file" | "candidate_unreadable" | "candidate_invalid_json" | "schema_or_identity_invalid" | "schema_invalid" | "identity_invalid" | "copy_provenance_mismatch";
|
|
123
|
+
/** Exact validation boundary when schema or identity evidence is rejected. */
|
|
124
|
+
validation_error?: "required_fields" | "receipt_id" | "item_id" | "item_path" | "filename" | "collections" | "enums" | "timestamps" | "durable_decisions";
|
|
116
125
|
/** Receipt identity when the bounded filename itself is a valid receipt id. */
|
|
117
126
|
receipt_id?: string;
|
|
118
127
|
/** SHA-256 locator for an unsafe or malformed candidate filename. */
|
|
119
128
|
candidate_name_hash?: string;
|
|
120
129
|
}
|
|
130
|
+
/** Revalidate one receipt and stage its atomic reconciled-state replacement. */
|
|
121
131
|
declare function prepareReceiptSettlement(params: {
|
|
122
132
|
receiptPath: string;
|
|
123
133
|
receiptId: string;
|
|
@@ -136,12 +146,13 @@ export declare function writeMergeReceipt(params: {
|
|
|
136
146
|
cwd: string;
|
|
137
147
|
itemPath: string;
|
|
138
148
|
preferred: MergePreferredSide;
|
|
139
|
-
conflictResolution?:
|
|
149
|
+
conflictResolution?: ItemScalarConflictResolution;
|
|
140
150
|
fieldsFromTheirs: string[];
|
|
141
151
|
unionFields: string[];
|
|
142
152
|
mergedFieldHashes?: Record<string, string>;
|
|
143
153
|
decisions: ItemMergeConflictDecision[];
|
|
144
154
|
}): Promise<MergeDecisionReceipt | null>;
|
|
155
|
+
/** Distinguish a missing optional receipt store from an unreadable one. */
|
|
145
156
|
declare function receiptDirectoryFailureMeansAbsent(directory: string, error: unknown, inspectAncestor?: (ancestor: string) => Promise<Pick<Stats, "isDirectory">>): Promise<boolean>;
|
|
146
157
|
/** Inspect valid receipts and count invalid evidence without returning untrusted file contents. */
|
|
147
158
|
export declare function inspectMergeReceiptEvidence(cwd: string, options?: {
|