@unbrained/pm-cli 2026.9.2 → 2026.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +44 -0
- package/dist/cli/after-command-context-usage.js +16 -3
- package/dist/cli-bundle/bundle-manifest.json +151 -151
- package/dist/cli-bundle/chunks/chunk-6XSKPNCF.js +230 -0
- package/dist/cli-bundle/chunks/chunk-A24WAVE6.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-TAG4VC22.js → chunk-HI6BHPCU.js} +27 -27
- package/dist/cli-bundle/chunks/{chunk-Y7VOMSZT.js → chunk-I2AS367G.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-X4RCGLTX.js → chunk-OGBVU67G.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-DTGWEL23.js → chunk-RI4XNOYS.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TXW6VL33.js +38 -0
- package/dist/cli-bundle/chunks/{chunk-FZ4Z2J4F.js → chunk-V72UV7QS.js} +76 -79
- package/dist/cli-bundle/chunks/chunk-VGLHECAP.js +9 -0
- package/dist/cli-bundle/chunks/{chunk-T6H5BZCP.js → chunk-X6CMGV6L.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3WICXLVT.js → chunk-YW4QK2G7.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-XYNX4ASQ.js → register-list-query-Z5YYSJJG.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-WFQ7MJTX.js → register-mutation-ELSP6I4I.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-JVTI7JPP.js → register-operations-OH7R3ZT4.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-KVNC5KPL.js → register-setup-E2AE72QG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MEASX544.js → chunk-25UJBH4M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SVXJYD6G.js → chunk-3646BZ4W.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4YRAVI43.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-53IHPICX.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-5P4HVOWG.js +176 -0
- package/dist/cli-bundle/focused-chunks/chunk-636VVQ7F.js +54 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4O4CJAR6.js → chunk-6PWPQKDN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7N2TV7WZ.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-AJR3OP2E.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-B3A6MJYE.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-BFDDJ2T2.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-BHUIRZWQ.js +9 -0
- package/dist/cli-bundle/focused-chunks/chunk-JADHHPY6.js +6 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KB5OFSFD.js → chunk-MHKUIPJW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-NBMJD6MK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-NSKBLHVI.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BEVHCEWG.js → chunk-P2GOAOQN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YARWJM2B.js +2 -0
- package/dist/cli-bundle/main.js +15 -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 +28 -31
- 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 +43 -36
- 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/history/event-classification.d.ts +21 -0
- package/dist/core/history/event-classification.js +109 -0
- package/dist/core/history/event-index.d.ts +14 -3
- package/dist/core/history/event-index.js +543 -88
- package/dist/core/history/history.d.ts +37 -1
- package/dist/core/history/history.js +320 -71
- package/dist/core/history/replay.js +68 -34
- package/dist/core/history/workspace-history.js +7 -6
- package/dist/core/lock/lock.d.ts +32 -2
- package/dist/core/lock/lock.js +161 -20
- package/dist/core/output/output.js +31 -7
- package/dist/core/shared/author.d.ts +3 -1
- package/dist/core/shared/author.js +111 -23
- package/dist/core/shared/time.d.ts +2 -0
- package/dist/core/shared/time.js +8 -2
- package/dist/core/store/item-metadata-query-index.js +5 -5
- package/dist/sdk/context/recency.d.ts +9 -0
- package/dist/sdk/context/recency.js +34 -0
- package/dist/sdk/context/usage-egress.d.ts +9 -0
- package/dist/sdk/context/usage-egress.js +30 -0
- package/dist/sdk/context-intent-contracts.js +7 -3
- package/dist/sdk/context-relevance.d.ts +23 -0
- package/dist/sdk/context-relevance.js +94 -23
- package/dist/sdk/context-signal-store.d.ts +7 -3
- package/dist/sdk/context-signal-store.js +155 -42
- package/dist/sdk/context-usage.d.ts +54 -0
- package/dist/sdk/context-usage.js +245 -16
- 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 +14 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +14 -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/history-compact.js +14 -5
- package/dist/sdk/history-redact.js +58 -23
- package/dist/sdk/history-repair.js +16 -6
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/index.js +6 -2
- package/dist/sdk/init.d.ts +2 -0
- package/dist/sdk/init.js +18 -9
- 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/query/context.d.ts +3 -1
- package/dist/sdk/query/context.js +21 -9
- package/dist/sdk/query/next.js +18 -9
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +25 -2
- package/dist/sdk/runtime-primitives.d.ts +2 -2
- package/dist/sdk/runtime-primitives.js +4 -4
- package/dist/sdk/runtime.d.ts +1 -0
- package/dist/sdk/runtime.js +17 -26
- package/dist/types.d.ts +27 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_ENVIRONMENTS.md +47 -0
- package/docs/AGENT_PROVENANCE_ADR.md +17 -2
- package/docs/CONTEXT_INTEGRITY_CONTRACTS.md +38 -1
- package/docs/CONTEXT_RELEVANCE.md +44 -1
- package/docs/MERGE_SAFETY.md +119 -23
- package/docs/PERFORMANCE.md +6 -3
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +9 -1
- package/docs/SDK.md +11 -8
- package/docs/SDK_CONTEXT.md +7 -0
- package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +24 -2
- package/docs/SDK_RUNTIME_BOUNDARIES.md +17 -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/REFUSAL_CLOSURE_CENSUS.md +5 -3
- package/marketplace.json +2 -2
- package/package.json +5 -5
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +773 -46
- package/dist/cli-bundle/chunks/chunk-GOACULJW.js +0 -13
- package/dist/cli-bundle/chunks/chunk-NOPL37X4.js +0 -205
- package/dist/cli-bundle/chunks/chunk-UDW64J2W.js +0 -8
- package/dist/cli-bundle/chunks/chunk-ZLJIFSOE.js +0 -35
- package/dist/cli-bundle/focused-chunks/chunk-242AXYB2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2FEZ5SKM.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-6GCRSLPG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7VATS5QY.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-JEFKLWMM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MKHG3T76.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-O67VDLOT.js +0 -51
- package/dist/cli-bundle/focused-chunks/chunk-PF3E6Q36.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-QDFJIRKN.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-RMRCQPWU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-S4U5CN5Q.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-T2LXXSOD.js +0 -158
- package/dist/cli-bundle/focused-chunks/chunk-Z2USIBR2.js +0 -5
package/dist/sdk/init.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm init 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]="d06d4db7-8ab7-5a9f-84df-508bd305ea23")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import readline from "node:readline/promises";
|
|
@@ -27,6 +27,8 @@ import { renderPmCommand } from "./command-line.js";
|
|
|
27
27
|
import { runExtension } from "./extension.js";
|
|
28
28
|
import { INIT_AGENT_GUIDANCE_MODE_VALUES, runInitAgentGuidance, } from "./init-agent-guidance.js";
|
|
29
29
|
import { findGitWorkspaceRoot, installMergeFence } from "./merge/install.js";
|
|
30
|
+
/** Symbol key for the captured working directory of an in-process init call. */
|
|
31
|
+
export const INIT_INVOCATION_CWD = Symbol.for("pm.sdk.init-invocation-cwd");
|
|
30
32
|
/** Implements summarize init result for the public runtime surface of this module. */
|
|
31
33
|
export function summarizeInitResult(result) {
|
|
32
34
|
return {
|
|
@@ -709,9 +711,21 @@ async function installInitMergeFence(pmRoot, gitWorkspaceRoot, warnings, install
|
|
|
709
711
|
warnings.push(`merge_fence_skipped:install_failed:${error.context.code ?? "pm_error"}:${error.message}:run pm merge install after resolving the Git repository error`);
|
|
710
712
|
}
|
|
711
713
|
}
|
|
714
|
+
async function ensureInitWorkspaceGitignore(workspaceRoot, pmRoot, agentGuidanceMode, warnings) {
|
|
715
|
+
if (workspaceRoot === undefined ||
|
|
716
|
+
workspaceRoot === null ||
|
|
717
|
+
agentGuidanceMode === "status") {
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
const gitignore = await ensurePmGitignore(workspaceRoot, { pmRoot });
|
|
721
|
+
if (gitignore.changed) {
|
|
722
|
+
warnings.push(`updated:gitignore:${gitignore.path}`);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
712
725
|
/** Implements run init for the public runtime surface of this module. */
|
|
713
726
|
export async function runInit(prefixArg, global, options = {}) {
|
|
714
|
-
const
|
|
727
|
+
const invocationCwd = global[INIT_INVOCATION_CWD];
|
|
728
|
+
const cwd = typeof invocationCwd === "string" ? invocationCwd : process.cwd();
|
|
715
729
|
const invocation = resolveInitInvocation(cwd, global, prefixArg, options.workspace);
|
|
716
730
|
const pmRoot = invocation.pmRoot;
|
|
717
731
|
prefixArg = resolveInitPrefixInput(invocation.prefixArg, options.idPrefix);
|
|
@@ -773,12 +787,7 @@ export async function runInit(prefixArg, global, options = {}) {
|
|
|
773
787
|
settings = await readSettings(pmRoot);
|
|
774
788
|
}
|
|
775
789
|
await ensureInitTypeDirectories({ pmRoot, settings, createdDirs, warnings });
|
|
776
|
-
|
|
777
|
-
const gitignore = await ensurePmGitignore(workspaceRoot, { pmRoot });
|
|
778
|
-
if (gitignore.changed) {
|
|
779
|
-
warnings.push(`updated:gitignore:${gitignore.path}`);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
790
|
+
await ensureInitWorkspaceGitignore(workspaceRoot, pmRoot, normalizedOptions.agentGuidanceMode, warnings);
|
|
782
791
|
if (!settingsExists &&
|
|
783
792
|
options.mergeFence !== false &&
|
|
784
793
|
normalizedOptions.agentGuidanceMode !== "status") {
|
|
@@ -809,4 +818,4 @@ export async function runInit(prefixArg, global, options = {}) {
|
|
|
809
818
|
};
|
|
810
819
|
}
|
|
811
820
|
//# sourceMappingURL=init.js.map
|
|
812
|
-
//# debugId=
|
|
821
|
+
//# debugId=d06d4db7-8ab7-5a9f-84df-508bd305ea23
|
|
@@ -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?: {
|