@unbrained/pm-cli 2026.8.11 → 2026.8.12
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 +52 -21
- package/dist/cli/commander-usage.js +37 -11
- package/dist/cli/error-guidance.d.ts +2 -0
- package/dist/cli/error-guidance.js +80 -13
- package/dist/cli/main.js +34 -19
- package/dist/cli/register-annotations.js +56 -3
- package/dist/cli/register-list-query.js +10 -7
- package/dist/cli/register-operations.js +16 -6
- package/dist/cli-bundle/bundle-manifest.json +157 -157
- package/dist/cli-bundle/chunks/{chunk-2OOU2AFH.js → chunk-3PS7X6GS.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-WMEZHCFI.js → chunk-BM5YJ2UW.js} +51 -43
- package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +33 -0
- package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +196 -0
- package/dist/cli-bundle/chunks/{chunk-ZU34C3LH.js → chunk-KOQMGCTA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-R76342NV.js +2 -0
- package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-IUNRVDAI.js → chunk-VLUQOIDT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-A2SJGHSI.js → chunk-WLAHPSOX.js} +2 -2
- package/dist/cli-bundle/chunks/register-list-query-XPCJRUUD.js +10 -0
- package/dist/cli-bundle/chunks/register-mutation-4RJCBKRS.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-NOCOOWQY.js → register-setup-LLHAKP2V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +5 -0
- package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +155 -0
- package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FPSYO5ZG.js → chunk-ECADZMVC.js} +11 -11
- package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BKPIY34S.js → chunk-GQW4BPUT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-UDAZWT25.js → chunk-JAFRIWVF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2DL3MRTD.js → chunk-KHM2CS2C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-J5EKAIVD.js → chunk-KPSXVBDV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-23FTGO3W.js → chunk-KTLOKKCQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KDH5OX3D.js → chunk-NBLUKITQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-55BIB6DV.js → chunk-NYLOUPOB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DPO7TEFX.js → chunk-Q4T463SD.js} +28 -28
- package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TL5M2PAY.js → chunk-RWPAWUOT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +17 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4H5IA6AV.js → chunk-YIAXMC3T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZMGWAYH7.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- 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 +40 -40
- 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 +1 -1
- 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 +2 -2
- package/dist/core/extensions/reserved-host-flags.js +3 -2
- package/dist/core/history/drift-scan.js +13 -8
- package/dist/core/history/history.d.ts +8 -0
- package/dist/core/history/history.js +57 -7
- package/dist/core/history/replay.d.ts +9 -1
- package/dist/core/history/replay.js +48 -13
- package/dist/core/output/output.d.ts +2 -0
- package/dist/core/output/output.js +46 -14
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/errors.d.ts +5 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/item-metadata-cache.d.ts +1 -1
- package/dist/core/store/item-metadata-cache.js +14 -7
- package/dist/sdk/cli-bootstrap.d.ts +2 -0
- package/dist/sdk/cli-bootstrap.js +6 -2
- package/dist/sdk/cli-contracts/completeness.js +3 -2
- package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
- package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
- package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +8 -6
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +4 -3
- package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +22 -2
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +7 -4
- package/dist/sdk/cli-program.js +3 -2
- package/dist/sdk/completion.js +16 -7
- package/dist/sdk/context-intent-contracts.js +45 -4
- package/dist/sdk/core.d.ts +1 -0
- package/dist/sdk/core.js +3 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1585 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
- package/dist/sdk/generated-error-code-catalog.js +6 -3140
- package/dist/sdk/governance/assurance-action.js +9 -7
- package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
- package/dist/sdk/governance/assurance-mutation-error.js +35 -0
- package/dist/sdk/governance/assurance-runtime.js +11 -8
- package/dist/sdk/governance/assurance.d.ts +12 -6
- package/dist/sdk/governance/assurance.js +181 -66
- package/dist/sdk/governance/health.d.ts +3 -1
- package/dist/sdk/governance/health.js +21 -4
- package/dist/sdk/governance/validate-item-reader.js +3 -3
- package/dist/sdk/governance/validate.d.ts +2 -0
- package/dist/sdk/governance/validate.js +13 -3
- package/dist/sdk/graph/durable-cache.d.ts +1 -1
- package/dist/sdk/graph/durable-cache.js +98 -29
- package/dist/sdk/graph/governance.d.ts +14 -0
- package/dist/sdk/graph/governance.js +34 -9
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/lifecycle/claim.js +10 -3
- package/dist/sdk/merge/driver.d.ts +2 -2
- package/dist/sdk/merge/driver.js +3 -3
- package/dist/sdk/merge/receipts.d.ts +6 -4
- package/dist/sdk/merge/receipts.js +7 -5
- package/dist/sdk/merge/three-way.d.ts +2 -2
- package/dist/sdk/merge/three-way.js +3 -3
- package/dist/sdk/output-projection.d.ts +9 -1
- package/dist/sdk/output-projection.js +45 -9
- package/dist/sdk/query/activity.d.ts +49 -2
- package/dist/sdk/query/activity.js +183 -37
- package/dist/sdk/query/get.js +19 -2
- package/dist/sdk/read-output-contracts.d.ts +5 -1
- package/dist/sdk/read-output-contracts.js +17 -2
- package/dist/sdk/read-output-session.d.ts +2 -0
- package/dist/sdk/read-output-session.js +12 -5
- package/dist/sdk/runtime-primitives.d.ts +3 -3
- package/dist/sdk/runtime-primitives.js +5 -5
- package/dist/sdk/runtime-stats-options.js +3 -2
- package/dist/sdk/runtime.js +5 -9
- package/dist/sdk/stats.d.ts +36 -3
- package/dist/sdk/stats.js +55 -15
- package/dist/sdk/test/execution.d.ts +4 -0
- package/dist/sdk/test/execution.js +86 -21
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -2
- package/docs/ASSURANCE.md +17 -12
- package/docs/COMMANDS.md +29 -8
- package/docs/CONFIGURATION.md +7 -0
- package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
- package/docs/MERGE_SAFETY.md +3 -1
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
- package/docs/README.md +2 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +12 -1
- package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
- package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
- package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
- package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
- 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 +203 -52
- package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +0 -33
- package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +0 -13
- package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +0 -194
- package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +0 -5
- package/dist/cli-bundle/chunks/register-list-query-HAUXVUPY.js +0 -10
- package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-E3KCL7AY.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +0 -17
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements append-only history and replay behavior for History.
|
|
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]="2fc7f675-3500-5abb-8d5c-9ca9caa803b6")}catch(e){}}();
|
|
8
8
|
import jsonPatch from "fast-json-patch";
|
|
9
9
|
import { ITEM_METADATA_KEY_ORDER } from "../shared/constants.js";
|
|
10
10
|
import { runActiveServiceOverride } from "../extensions/index.js";
|
|
@@ -20,6 +20,42 @@ const EMPTY_LEGACY_HASH_DOCUMENT = {
|
|
|
20
20
|
front_matter: {},
|
|
21
21
|
body: "",
|
|
22
22
|
};
|
|
23
|
+
/** Hash epoch that preserves linked-test insertion order in immutable history. */
|
|
24
|
+
export const CURRENT_HISTORY_ITEM_HASH_VERSION = 2;
|
|
25
|
+
/** Hash epochs understood by this runtime. */
|
|
26
|
+
export const SUPPORTED_HISTORY_ITEM_HASH_VERSIONS = [1, 2];
|
|
27
|
+
function compareOptionalStrings(left, right) {
|
|
28
|
+
return (left ?? "").localeCompare(right ?? "");
|
|
29
|
+
}
|
|
30
|
+
function compareOptionalNumbers(left, right) {
|
|
31
|
+
return (left ?? 0) - (right ?? 0);
|
|
32
|
+
}
|
|
33
|
+
function compareJsonValues(left, right, fallback) {
|
|
34
|
+
// Preserve the original v1 comparator byte-for-byte: replacing JSON.stringify
|
|
35
|
+
// with stableStringify would invalidate immutable hashes from legacy streams.
|
|
36
|
+
return JSON.stringify(left ?? fallback).localeCompare(JSON.stringify(right ?? fallback));
|
|
37
|
+
}
|
|
38
|
+
function compareLegacyLinkedTests(left, right) {
|
|
39
|
+
const comparisons = [
|
|
40
|
+
left.scope.localeCompare(right.scope),
|
|
41
|
+
compareOptionalStrings(left.path, right.path),
|
|
42
|
+
compareOptionalStrings(left.command, right.command),
|
|
43
|
+
compareOptionalNumbers(left.timeout_seconds, right.timeout_seconds),
|
|
44
|
+
compareOptionalStrings(left.pm_context_mode, right.pm_context_mode),
|
|
45
|
+
Number(Boolean(left.shared_host_safe)) - Number(Boolean(right.shared_host_safe)),
|
|
46
|
+
compareJsonValues(left.env_clear, right.env_clear, []),
|
|
47
|
+
compareJsonValues(left.env_set, right.env_set, {}),
|
|
48
|
+
compareJsonValues(left.assert_stdout_contains, right.assert_stdout_contains, []),
|
|
49
|
+
compareJsonValues(left.assert_stdout_regex, right.assert_stdout_regex, []),
|
|
50
|
+
compareJsonValues(left.assert_stderr_contains, right.assert_stderr_contains, []),
|
|
51
|
+
compareJsonValues(left.assert_stderr_regex, right.assert_stderr_regex, []),
|
|
52
|
+
compareOptionalNumbers(left.assert_stdout_min_lines, right.assert_stdout_min_lines),
|
|
53
|
+
compareJsonValues(left.assert_json_field_equals, right.assert_json_field_equals, {}),
|
|
54
|
+
compareJsonValues(left.assert_json_field_gte, right.assert_json_field_gte, {}),
|
|
55
|
+
compareOptionalStrings(left.note, right.note),
|
|
56
|
+
];
|
|
57
|
+
return comparisons.find((comparison) => comparison !== 0) ?? 0;
|
|
58
|
+
}
|
|
23
59
|
function decodeJsonPointer(path) {
|
|
24
60
|
if (!path || path === "/") {
|
|
25
61
|
return [];
|
|
@@ -81,7 +117,7 @@ function normalizeHistoryPatchOps(beforeDocument, patch) {
|
|
|
81
117
|
}
|
|
82
118
|
return normalized;
|
|
83
119
|
}
|
|
84
|
-
function canonicalHashDocument(document) {
|
|
120
|
+
function canonicalHashDocument(document, version) {
|
|
85
121
|
const hasMetadata = document.metadata && Object.keys(document.metadata).length > 0;
|
|
86
122
|
if (!hasMetadata) {
|
|
87
123
|
return {
|
|
@@ -90,7 +126,13 @@ function canonicalHashDocument(document) {
|
|
|
90
126
|
};
|
|
91
127
|
}
|
|
92
128
|
const canonical = canonicalDocument(document);
|
|
93
|
-
const
|
|
129
|
+
const metadata = version === 1 && canonical.metadata.tests
|
|
130
|
+
? {
|
|
131
|
+
...canonical.metadata,
|
|
132
|
+
tests: [...canonical.metadata.tests].sort(compareLegacyLinkedTests),
|
|
133
|
+
}
|
|
134
|
+
: canonical.metadata;
|
|
135
|
+
const orderedMetadata = orderObject(toItemRecord(metadata), ITEM_METADATA_KEY_ORDER);
|
|
94
136
|
return {
|
|
95
137
|
front_matter: orderedMetadata,
|
|
96
138
|
body: canonical.body,
|
|
@@ -113,7 +155,14 @@ function canonicalPatchDocument(document) {
|
|
|
113
155
|
}
|
|
114
156
|
/** Implements hash document for the public runtime surface of this module. */
|
|
115
157
|
export function hashDocument(document) {
|
|
116
|
-
return
|
|
158
|
+
return hashDocumentForVersion(document, CURRENT_HISTORY_ITEM_HASH_VERSION);
|
|
159
|
+
}
|
|
160
|
+
/** Hash an item with an explicit canonicalization epoch for replay compatibility. */
|
|
161
|
+
export function hashDocumentForVersion(document, version) {
|
|
162
|
+
if (!SUPPORTED_HISTORY_ITEM_HASH_VERSIONS.some((supportedVersion) => supportedVersion === version)) {
|
|
163
|
+
throw new TypeError(`unsupported_item_hash_version:${String(version)}`);
|
|
164
|
+
}
|
|
165
|
+
return sha256Hex(stableStringify(canonicalHashDocument(document, version)));
|
|
117
166
|
}
|
|
118
167
|
/** Implements hash empty document for the public runtime surface of this module. */
|
|
119
168
|
export function hashEmptyDocument() {
|
|
@@ -121,8 +170,8 @@ export function hashEmptyDocument() {
|
|
|
121
170
|
}
|
|
122
171
|
/** Implements create history entry for the public runtime surface of this module. */
|
|
123
172
|
export function createHistoryEntry(params) {
|
|
124
|
-
const beforeHashCanonical = canonicalHashDocument(params.before);
|
|
125
|
-
const afterHashCanonical = canonicalHashDocument(params.after);
|
|
173
|
+
const beforeHashCanonical = canonicalHashDocument(params.before, CURRENT_HISTORY_ITEM_HASH_VERSION);
|
|
174
|
+
const afterHashCanonical = canonicalHashDocument(params.after, CURRENT_HISTORY_ITEM_HASH_VERSION);
|
|
126
175
|
const beforePatchCanonical = canonicalPatchDocument(params.before);
|
|
127
176
|
const afterPatchCanonical = canonicalPatchDocument(params.after);
|
|
128
177
|
const rawPatch = jsonPatch.compare(beforePatchCanonical, afterPatchCanonical);
|
|
@@ -159,6 +208,7 @@ export function createHistoryEntry(params) {
|
|
|
159
208
|
patch,
|
|
160
209
|
before_hash: sha256Hex(stableStringify(beforeHashCanonical)),
|
|
161
210
|
after_hash: sha256Hex(stableStringify(afterHashCanonical)),
|
|
211
|
+
item_hash_version: CURRENT_HISTORY_ITEM_HASH_VERSION,
|
|
162
212
|
message: params.message === undefined ? undefined : params.message,
|
|
163
213
|
...(context === undefined ? {} : { context }),
|
|
164
214
|
};
|
|
@@ -242,4 +292,4 @@ export const _testOnly = {
|
|
|
242
292
|
isDefinedPointerPath,
|
|
243
293
|
};
|
|
244
294
|
//# sourceMappingURL=history.js.map
|
|
245
|
-
//# debugId=
|
|
295
|
+
//# debugId=2fc7f675-3500-5abb-8d5c-9ca9caa803b6
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { canonicalDocument } from "../item/item-format.js";
|
|
2
|
+
import { type HistoryItemHashVersion } from "./history.js";
|
|
2
3
|
import type { HistoryEntry, HistoryPatchOp, ItemDocument } from "../../types/index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Shared history replay/patch mechanics single-sourced for the history, restore,
|
|
@@ -19,7 +20,7 @@ export declare const EMPTY_REPLAY_DOCUMENT: ReplayDocument;
|
|
|
19
20
|
/** Implements clone empty replay document for the public runtime surface of this module. */
|
|
20
21
|
export declare function cloneEmptyReplayDocument(): ReplayDocument;
|
|
21
22
|
/** Implements replay hash for the public runtime surface of this module. */
|
|
22
|
-
export declare function replayHash(document: ReplayDocument): string;
|
|
23
|
+
export declare function replayHash(document: ReplayDocument, version?: HistoryItemHashVersion): string;
|
|
23
24
|
/** Implements replay to item document for the public runtime surface of this module. */
|
|
24
25
|
export declare function replayToItemDocument(document: ReplayDocument): ItemDocument;
|
|
25
26
|
/** Converts a materialized replay document into a canonical item document. Use this when callers have already rejected the empty/deleted replay state and need restored metadata validated through the normal item-metadata rules. */
|
|
@@ -41,6 +42,13 @@ export type ReplayApplyResult = {
|
|
|
41
42
|
/** Strictly apply a history patch (front_matter->metadata normalized) to a replay document. Returns a result envelope rather than throwing so each caller can format its own error contract. */
|
|
42
43
|
export declare function tryApplyReplayPatch(current: ReplayDocument, patch: HistoryPatchOp[]): ReplayApplyResult;
|
|
43
44
|
/** Deterministically verify a history chain: each entry's before_hash must equal the prior replayed after_hash, the patch must strictly apply, and the recorded after_hash must equal the replayed result. */
|
|
45
|
+
/** Verify a chain and report the explicit or auto-detected item hash epoch. */
|
|
46
|
+
export declare function verifyHistoryChainWithVersion(entries: HistoryEntry[]): {
|
|
47
|
+
ok: boolean;
|
|
48
|
+
errors: string[];
|
|
49
|
+
item_hash_version?: HistoryItemHashVersion;
|
|
50
|
+
};
|
|
51
|
+
/** Deterministically verify a history chain while preserving the legacy result shape. */
|
|
44
52
|
export declare function verifyHistoryChain(entries: HistoryEntry[]): {
|
|
45
53
|
ok: boolean;
|
|
46
54
|
errors: string[];
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Implements append-only history and replay behavior for Replay.
|
|
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]="a1283470-00c7-5e91-8676-e1c1a667537f")}catch(e){}}();
|
|
8
8
|
import jsonPatch from "fast-json-patch";
|
|
9
9
|
import { ITEM_METADATA_KEY_ORDER } from "../shared/constants.js";
|
|
10
10
|
import { canonicalDocument } from "../item/item-format.js";
|
|
11
11
|
import { toItemRecord } from "../item/item-record.js";
|
|
12
12
|
import { orderObject, sha256Hex, stableStringify, } from "../shared/serialization.js";
|
|
13
|
-
import {
|
|
13
|
+
import { CURRENT_HISTORY_ITEM_HASH_VERSION, SUPPORTED_HISTORY_ITEM_HASH_VERSIONS, hashDocumentForVersion, } from "./history.js";
|
|
14
14
|
/** Public contract for empty replay document, shared by SDK and presentation-layer consumers. */
|
|
15
15
|
export const EMPTY_REPLAY_DOCUMENT = {
|
|
16
16
|
metadata: {},
|
|
@@ -21,11 +21,11 @@ export function cloneEmptyReplayDocument() {
|
|
|
21
21
|
return structuredClone(EMPTY_REPLAY_DOCUMENT);
|
|
22
22
|
}
|
|
23
23
|
/** Implements replay hash for the public runtime surface of this module. */
|
|
24
|
-
export function replayHash(document) {
|
|
24
|
+
export function replayHash(document, version = CURRENT_HISTORY_ITEM_HASH_VERSION) {
|
|
25
25
|
if (Object.keys(document.metadata).length === 0 ||
|
|
26
26
|
Array.isArray(document.metadata.tags)) {
|
|
27
27
|
try {
|
|
28
|
-
return
|
|
28
|
+
return hashDocumentForVersion(replayToItemDocument(document), version);
|
|
29
29
|
}
|
|
30
30
|
catch {
|
|
31
31
|
// Fall through when another malformed legacy field cannot be canonicalized.
|
|
@@ -124,14 +124,20 @@ export function tryApplyReplayPatch(current, patch) {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
/** Deterministically verify a history chain: each entry's before_hash must equal the prior replayed after_hash, the patch must strictly apply, and the recorded after_hash must equal the replayed result. */
|
|
127
|
-
|
|
127
|
+
/** Verify a chain and report the explicit or auto-detected item hash epoch. */
|
|
128
|
+
export function verifyHistoryChainWithVersion(entries) {
|
|
128
129
|
let replay = cloneEmptyReplayDocument();
|
|
130
|
+
let detectedVersion;
|
|
129
131
|
for (let index = 0; index < entries.length; index += 1) {
|
|
130
132
|
const entry = entries[index];
|
|
131
|
-
|
|
133
|
+
const explicitVersion = entry.item_hash_version;
|
|
134
|
+
if (explicitVersion !== undefined &&
|
|
135
|
+
!SUPPORTED_HISTORY_ITEM_HASH_VERSIONS.includes(explicitVersion)) {
|
|
132
136
|
return {
|
|
133
137
|
ok: false,
|
|
134
|
-
errors: [
|
|
138
|
+
errors: [
|
|
139
|
+
`verify_failed:unsupported_item_hash_version:${String(explicitVersion)}:entry_${index + 1}`,
|
|
140
|
+
],
|
|
135
141
|
};
|
|
136
142
|
}
|
|
137
143
|
const applied = tryApplyReplayPatch(replay, entry.patch);
|
|
@@ -141,15 +147,38 @@ export function verifyHistoryChain(entries) {
|
|
|
141
147
|
errors: [`verify_failed:patch_apply_failed:entry_${index + 1}`],
|
|
142
148
|
};
|
|
143
149
|
}
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
const candidates = explicitVersion === undefined
|
|
151
|
+
? [CURRENT_HISTORY_ITEM_HASH_VERSION, 1]
|
|
152
|
+
: [explicitVersion];
|
|
153
|
+
const beforeMatches = candidates.filter((version) => replayHash(replay, version) === entry.before_hash);
|
|
154
|
+
if (beforeMatches.length === 0) {
|
|
155
|
+
return {
|
|
156
|
+
ok: false,
|
|
157
|
+
errors: [`verify_failed:before_hash_mismatch:entry_${index + 1}`],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const version = beforeMatches.find((candidate) => replayHash(applied.document, candidate) === entry.after_hash);
|
|
161
|
+
if (version === undefined) {
|
|
146
162
|
return {
|
|
147
163
|
ok: false,
|
|
148
164
|
errors: [`verify_failed:after_hash_mismatch:entry_${index + 1}`],
|
|
149
165
|
};
|
|
150
166
|
}
|
|
167
|
+
replay = applied.document;
|
|
168
|
+
detectedVersion = version;
|
|
151
169
|
}
|
|
152
|
-
return {
|
|
170
|
+
return {
|
|
171
|
+
ok: true,
|
|
172
|
+
errors: [],
|
|
173
|
+
...(detectedVersion === undefined
|
|
174
|
+
? {}
|
|
175
|
+
: { item_hash_version: detectedVersion }),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/** Deterministically verify a history chain while preserving the legacy result shape. */
|
|
179
|
+
export function verifyHistoryChain(entries) {
|
|
180
|
+
const result = verifyHistoryChainWithVersion(entries);
|
|
181
|
+
return { ok: result.ok, errors: result.errors };
|
|
153
182
|
}
|
|
154
183
|
function tryApplySingleOp(document, op) {
|
|
155
184
|
try {
|
|
@@ -192,6 +221,11 @@ export function lenientApplyReplayPatch(current, patch) {
|
|
|
192
221
|
}
|
|
193
222
|
/** Re-anchor a drifted history chain: replay every entry from empty, recompute the before/after hashes, and only rewrite a patch when the original op set no longer strictly applies (legacy drift). Clean entries keep their patch verbatim so the on-disk diff stays minimal. The returned chain verifies via verifyHistoryChain. */
|
|
194
223
|
export function reanchorHistoryEntries(entries) {
|
|
224
|
+
const unsupportedIndex = entries.findIndex((entry) => entry.item_hash_version !== undefined &&
|
|
225
|
+
!SUPPORTED_HISTORY_ITEM_HASH_VERSIONS.includes(entry.item_hash_version));
|
|
226
|
+
if (unsupportedIndex >= 0) {
|
|
227
|
+
throw new TypeError(`unsupported_item_hash_version:${String(entries[unsupportedIndex]?.item_hash_version)}:entry_${unsupportedIndex + 1}`);
|
|
228
|
+
}
|
|
195
229
|
let replay = cloneEmptyReplayDocument();
|
|
196
230
|
const rewritten = [];
|
|
197
231
|
const details = [];
|
|
@@ -201,7 +235,7 @@ export function reanchorHistoryEntries(entries) {
|
|
|
201
235
|
let skippedOps = 0;
|
|
202
236
|
for (let index = 0; index < entries.length; index += 1) {
|
|
203
237
|
const entry = entries[index];
|
|
204
|
-
const beforeHash = replayHash(replay);
|
|
238
|
+
const beforeHash = replayHash(replay, CURRENT_HISTORY_ITEM_HASH_VERSION);
|
|
205
239
|
const strict = tryApplyReplayPatch(replay, entry.patch);
|
|
206
240
|
let next;
|
|
207
241
|
let outPatch;
|
|
@@ -223,7 +257,7 @@ export function reanchorHistoryEntries(entries) {
|
|
|
223
257
|
skippedOps += entrySkipped;
|
|
224
258
|
entriesPatchRepaired += 1;
|
|
225
259
|
}
|
|
226
|
-
const afterHash = replayHash(next);
|
|
260
|
+
const afterHash = replayHash(next, CURRENT_HISTORY_ITEM_HASH_VERSION);
|
|
227
261
|
const rehashed = beforeHash !== entry.before_hash || afterHash !== entry.after_hash;
|
|
228
262
|
if (rehashed) {
|
|
229
263
|
entriesRehashed += 1;
|
|
@@ -233,6 +267,7 @@ export function reanchorHistoryEntries(entries) {
|
|
|
233
267
|
patch: outPatch,
|
|
234
268
|
before_hash: beforeHash,
|
|
235
269
|
after_hash: afterHash,
|
|
270
|
+
item_hash_version: CURRENT_HISTORY_ITEM_HASH_VERSION,
|
|
236
271
|
});
|
|
237
272
|
details.push({
|
|
238
273
|
index: index + 1,
|
|
@@ -261,4 +296,4 @@ export function historyEntriesToRaw(entries) {
|
|
|
261
296
|
return `${entries.map((entry) => JSON.stringify(entry)).join("\n")}\n`;
|
|
262
297
|
}
|
|
263
298
|
//# sourceMappingURL=replay.js.map
|
|
264
|
-
//# debugId=
|
|
299
|
+
//# debugId=a1283470-00c7-5e91-8676-e1c1a667537f
|
|
@@ -24,6 +24,8 @@ export interface OutputOptions {
|
|
|
24
24
|
outputFormat?: "toon" | "json";
|
|
25
25
|
/** Caller-carried cross-call budget and served-item state. */
|
|
26
26
|
outputSession?: string;
|
|
27
|
+
/** Include machine-readable row location and row-encoding metadata. */
|
|
28
|
+
outputRowContract?: boolean;
|
|
27
29
|
/** Fallback output format used when callers do not provide an override. */
|
|
28
30
|
defaultOutputFormat?: "toon" | "json";
|
|
29
31
|
/** Value that configures or reports command for this contract. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Formats compact human and machine output for Output.
|
|
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]="5aaf8b90-5b95-5102-9ea4-b877c696d593")}catch(e){}}();
|
|
8
8
|
import { getActiveCommandContext, runActiveCommandOverride, runActiveRendererOverride, runActiveServiceOverrideSync, setActiveCommandResult, } from "../extensions/index.js";
|
|
9
9
|
import { EXIT_CODE } from "../shared/constants.js";
|
|
10
10
|
import { isHostOutputSuppressed } from "./output-control.js";
|
|
@@ -12,6 +12,7 @@ import { projectMutationResult } from "./mutation-projection.js";
|
|
|
12
12
|
import { attachReadOutputContracts } from "../../sdk/context-intent-contracts.js";
|
|
13
13
|
import { attachOutputTokenAccounting } from "../../sdk/output-token-accounting.js";
|
|
14
14
|
import { resolveReadOutputEncoding } from "../../sdk/read-output-contracts.js";
|
|
15
|
+
import { encode as encodeToon } from "@toon-format/toon";
|
|
15
16
|
const DECLARED_PROCESS_EXIT_CODES = new Set(Object.values(EXIT_CODE));
|
|
16
17
|
const NATIVE_OUTPUT_MARKER = "__pm_native_output";
|
|
17
18
|
let streamErrorHandlersInstalled = false;
|
|
@@ -114,6 +115,44 @@ function renderScalar(value) {
|
|
|
114
115
|
return "null";
|
|
115
116
|
return JSON.stringify(value);
|
|
116
117
|
}
|
|
118
|
+
function isToonPrimitive(value) {
|
|
119
|
+
return (value === null ||
|
|
120
|
+
typeof value === "string" ||
|
|
121
|
+
typeof value === "number" ||
|
|
122
|
+
typeof value === "boolean");
|
|
123
|
+
}
|
|
124
|
+
function tabularObjectArray(value) {
|
|
125
|
+
if (value.length === 0 || !value.every(isPlainObject))
|
|
126
|
+
return false;
|
|
127
|
+
const keys = Object.keys(value[0]);
|
|
128
|
+
return (keys.length > 0 &&
|
|
129
|
+
value.every((entry) => Object.keys(entry).length === keys.length &&
|
|
130
|
+
keys.every((key) => Object.hasOwn(entry, key) && isToonPrimitive(entry[key]))));
|
|
131
|
+
}
|
|
132
|
+
function indentToon(encoded, depth) {
|
|
133
|
+
const indent = " ".repeat(depth);
|
|
134
|
+
return encoded
|
|
135
|
+
.split("\n")
|
|
136
|
+
.map((line) => `${indent}${line}`)
|
|
137
|
+
.join("\n");
|
|
138
|
+
}
|
|
139
|
+
/** Render one object field while preserving nested and tabular TOON structure. */
|
|
140
|
+
function renderToonObjectEntry(key, entry, depth) {
|
|
141
|
+
const indent = " ".repeat(depth);
|
|
142
|
+
if (!isPlainObject(entry) && !Array.isArray(entry)) {
|
|
143
|
+
return `${indent}${key}: ${renderScalar(entry)}`;
|
|
144
|
+
}
|
|
145
|
+
if (Array.isArray(entry) && entry.length === 0) {
|
|
146
|
+
return `${indent}${key}: []`;
|
|
147
|
+
}
|
|
148
|
+
if (Array.isArray(entry) && tabularObjectArray(entry)) {
|
|
149
|
+
return indentToon(encodeToon({ [key]: entry }), depth);
|
|
150
|
+
}
|
|
151
|
+
if (isPlainObject(entry) && Object.keys(entry).length === 0) {
|
|
152
|
+
return `${indent}${key}: {}`;
|
|
153
|
+
}
|
|
154
|
+
return `${indent}${key}:\n${renderToonValue(entry, depth + 1)}`;
|
|
155
|
+
}
|
|
117
156
|
function compactToonValue(value) {
|
|
118
157
|
if (value === null || value === undefined) {
|
|
119
158
|
return undefined;
|
|
@@ -147,6 +186,9 @@ function renderToonValue(value, depth) {
|
|
|
147
186
|
if (Array.isArray(value)) {
|
|
148
187
|
if (value.length === 0)
|
|
149
188
|
return "[]";
|
|
189
|
+
if (tabularObjectArray(value)) {
|
|
190
|
+
return indentToon(encodeToon(value), depth);
|
|
191
|
+
}
|
|
150
192
|
return value
|
|
151
193
|
.map((entry) => {
|
|
152
194
|
if (!isPlainObject(entry) && !Array.isArray(entry)) {
|
|
@@ -167,18 +209,7 @@ function renderToonValue(value, depth) {
|
|
|
167
209
|
if (entries.length === 0)
|
|
168
210
|
return "{}";
|
|
169
211
|
return entries
|
|
170
|
-
.map(([key, entry]) =>
|
|
171
|
-
if (!isPlainObject(entry) && !Array.isArray(entry)) {
|
|
172
|
-
return `${indent}${key}: ${renderScalar(entry)}`;
|
|
173
|
-
}
|
|
174
|
-
if (Array.isArray(entry) && entry.length === 0) {
|
|
175
|
-
return `${indent}${key}: []`;
|
|
176
|
-
}
|
|
177
|
-
if (isPlainObject(entry) && Object.keys(entry).length === 0) {
|
|
178
|
-
return `${indent}${key}: {}`;
|
|
179
|
-
}
|
|
180
|
-
return `${indent}${key}:\n${renderToonValue(entry, depth + 1)}`;
|
|
181
|
-
})
|
|
212
|
+
.map(([key, entry]) => renderToonObjectEntry(key, entry, depth))
|
|
182
213
|
.join("\n");
|
|
183
214
|
}
|
|
184
215
|
return `${indent}${renderScalar(value)}`;
|
|
@@ -335,6 +366,7 @@ function formatEffectiveOutput(effectiveResult, nativeOutput, options) {
|
|
|
335
366
|
["outputBudget", options.outputBudget],
|
|
336
367
|
["outputFormat", options.outputFormat],
|
|
337
368
|
["outputSession", options.outputSession],
|
|
369
|
+
["outputRowContract", options.outputRowContract],
|
|
338
370
|
].filter((entry) => entry[1] !== undefined)),
|
|
339
371
|
};
|
|
340
372
|
const format = resolveReadOutputEncoding(command ?? "", commandOptions) ??
|
|
@@ -424,4 +456,4 @@ export const outputTestOnly = {
|
|
|
424
456
|
renderToonValue,
|
|
425
457
|
};
|
|
426
458
|
//# sourceMappingURL=output.js.map
|
|
427
|
-
//# debugId=
|
|
459
|
+
//# debugId=5aaf8b90-5b95-5102-9ea4-b877c696d593
|
|
@@ -29,6 +29,8 @@ export interface GlobalOptions {
|
|
|
29
29
|
outputFormat?: "toon" | "json";
|
|
30
30
|
/** Caller-carried cross-call budget and served-item state. */
|
|
31
31
|
outputSession?: string;
|
|
32
|
+
/** Include the machine-readable row selector and TOON encoding contract. */
|
|
33
|
+
outputRowContract?: boolean;
|
|
32
34
|
/** Filesystem path used for path resolution. */
|
|
33
35
|
path?: string;
|
|
34
36
|
/** Value that configures or reports no extensions for this contract. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!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]="
|
|
2
|
+
!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]="044af354-3047-5fd4-ae65-458a259dedca")}catch(e){}}();
|
|
3
3
|
export {};
|
|
4
4
|
//# sourceMappingURL=command-types.js.map
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=044af354-3047-5fd4-ae65-458a259dedca
|
|
@@ -11,6 +11,11 @@ export interface PmCliErrorRecoveryPayload {
|
|
|
11
11
|
attempted_command?: string;
|
|
12
12
|
/** Value that configures or reports normalized args for this contract. */
|
|
13
13
|
normalized_args?: string[];
|
|
14
|
+
/** Positional tokens paired with their parser roles for unambiguous recovery. */
|
|
15
|
+
parsed_positionals?: Array<{
|
|
16
|
+
role: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}>;
|
|
14
19
|
/** Value that configures or reports provided fields for this contract. */
|
|
15
20
|
provided_fields?: string[];
|
|
16
21
|
/** Value that configures or reports missing for this contract. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Implements the exported pm cli error runtime abstraction for core/shared/errors.ts. */
|
|
2
2
|
|
|
3
|
-
!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]="
|
|
3
|
+
!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]="62fb0ba7-643f-5b33-870b-df875559610a")}catch(e){}}();
|
|
4
4
|
export class PmCliError extends Error {
|
|
5
5
|
/** Value that configures or reports exit code for this contract. */
|
|
6
6
|
exitCode;
|
|
@@ -18,4 +18,4 @@ export class PmCliError extends Error {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=errors.js.map
|
|
21
|
-
//# debugId=
|
|
21
|
+
//# debugId=62fb0ba7-643f-5b33-870b-df875559610a
|
|
@@ -83,7 +83,7 @@ export interface ListCacheOptions {
|
|
|
83
83
|
includeBody?: boolean;
|
|
84
84
|
/** When false, heavy collection fields (comments/notes/learnings/files/tests/ test_runs/docs) are neither loaded from nor written to the separate collections cache, and are absent from the returned metadata. Light-only callers (`pm list` compact, stats, deps, activity, calendar, close) skip the large collections cache entirely. Defaults to true so any caller that does read those fields stays correct. */
|
|
85
85
|
includeCollections?: boolean;
|
|
86
|
-
/** Force canonical item enumeration and
|
|
86
|
+
/** Force canonical item enumeration and authoritative file reads even when stat-matched cache tiers or a fresh derived index are available. Validation, repair, migration, and equivalence tests use this correctness path. */
|
|
87
87
|
forceSourceScan?: boolean;
|
|
88
88
|
/** Minimum item count required before the directory-signature derived-index fast path is used. Defaults to 500 so small workspaces preserve per-file external-edit detection; tests and specialized SDK hosts may lower it explicitly. */
|
|
89
89
|
derivedIndexMinimumItems?: number;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Reads and writes tracker storage with format-aware helpers for the item metadata cache.
|
|
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]="58d1ab81-16b6-5c93-ade4-ba189ea48c9b")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -257,7 +257,8 @@ async function loadBodyCache(pmRoot, contextFingerprint) {
|
|
|
257
257
|
};
|
|
258
258
|
const cachePath = getBodyCachePath(pmRoot);
|
|
259
259
|
const active = await loadEnvelopeMemoized(cachePath, parse);
|
|
260
|
-
return contextFingerprint &&
|
|
260
|
+
return contextFingerprint &&
|
|
261
|
+
active?.context_fingerprint !== contextFingerprint
|
|
261
262
|
? await loadEnvelopeMemoized(getContextCachePath(cachePath, contextFingerprint), parse)
|
|
262
263
|
: active;
|
|
263
264
|
}
|
|
@@ -274,7 +275,8 @@ async function loadCollectionsCache(pmRoot, contextFingerprint) {
|
|
|
274
275
|
};
|
|
275
276
|
const cachePath = getCollectionsCachePath(pmRoot);
|
|
276
277
|
const active = await loadEnvelopeMemoized(cachePath, parse);
|
|
277
|
-
return contextFingerprint &&
|
|
278
|
+
return contextFingerprint &&
|
|
279
|
+
active?.context_fingerprint !== contextFingerprint
|
|
278
280
|
? await loadEnvelopeMemoized(getContextCachePath(cachePath, contextFingerprint), parse)
|
|
279
281
|
: active;
|
|
280
282
|
}
|
|
@@ -518,12 +520,16 @@ async function readCachedDocumentParts(filePath, relativePath, context) {
|
|
|
518
520
|
const itemFormat = getItemFormatFromPath(filePath);
|
|
519
521
|
await dispatchCachedDocumentReadHooks(filePath, context.warnings, context.dispatchReadHooks);
|
|
520
522
|
const cachedEntry = context.previousEntries[relativePath];
|
|
521
|
-
const metadataCached =
|
|
523
|
+
const metadataCached = !context.forceSourceRead &&
|
|
524
|
+
cachedEntry !== undefined &&
|
|
522
525
|
statMatches(cachedEntry, mtimeMs, ctimeMs, size);
|
|
523
526
|
const cachedBody = context.previousBodies[relativePath];
|
|
524
|
-
const bodyCached =
|
|
527
|
+
const bodyCached = !context.forceSourceRead &&
|
|
528
|
+
cachedBody !== undefined &&
|
|
529
|
+
statMatches(cachedBody, mtimeMs, ctimeMs, size);
|
|
525
530
|
const cachedCollections = context.previousCollections[relativePath];
|
|
526
|
-
const collectionsCached =
|
|
531
|
+
const collectionsCached = !context.forceSourceRead &&
|
|
532
|
+
cachedCollections !== undefined &&
|
|
527
533
|
statMatches(cachedCollections, mtimeMs, ctimeMs, size);
|
|
528
534
|
const needRead = !metadataCached ||
|
|
529
535
|
(context.includeBody && !bodyCached) ||
|
|
@@ -1028,6 +1034,7 @@ export async function listAllDocumentCandidatesCached(pmRoot, preferredFormat, t
|
|
|
1028
1034
|
extensionFieldNames,
|
|
1029
1035
|
includeBody,
|
|
1030
1036
|
includeCollections,
|
|
1037
|
+
forceSourceRead: options.forceSourceScan === true,
|
|
1031
1038
|
dispatchReadHooks,
|
|
1032
1039
|
previousEntries,
|
|
1033
1040
|
previousBodies,
|
|
@@ -1107,4 +1114,4 @@ export async function listAllDocumentsCachedLight(pmRoot, preferredFormat, typeT
|
|
|
1107
1114
|
}));
|
|
1108
1115
|
}
|
|
1109
1116
|
//# sourceMappingURL=item-metadata-cache.js.map
|
|
1110
|
-
//# debugId=
|
|
1117
|
+
//# debugId=58d1ab81-16b6-5c93-ade4-ba189ea48c9b
|
|
@@ -31,6 +31,8 @@ export interface BootstrapGlobalOptions {
|
|
|
31
31
|
outputFormat?: "toon" | "json";
|
|
32
32
|
/** Caller-carried cross-call budget and served-item state. */
|
|
33
33
|
outputSession?: string;
|
|
34
|
+
/** Whether machine-readable row discovery metadata is requested. */
|
|
35
|
+
outputRowContract?: boolean;
|
|
34
36
|
/** Invocation-wide mutation author override. */
|
|
35
37
|
author?: string;
|
|
36
38
|
/** Whether `--author` was present without its required value. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides public bootstrap argument normalization for embedded CLI hosts.
|
|
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]="7b3209a8-8580-542c-9e80-21d04df3f61f")}catch(e){}}();
|
|
8
8
|
import { EXECUTABLE_COMMAND_ALIASES, resolveSubcommandFlagContractsForCommand, } from "./cli-contracts.js";
|
|
9
9
|
export { EXECUTABLE_COMMAND_ALIASES };
|
|
10
10
|
import { levenshteinDistanceWithinLimit } from "../core/shared/levenshtein.js";
|
|
@@ -47,6 +47,7 @@ const BOOTSTRAP_BOOLEAN_FLAGS = new Set([
|
|
|
47
47
|
"--quiet",
|
|
48
48
|
"--lean",
|
|
49
49
|
"--token-accounting",
|
|
50
|
+
"--output-row-contract",
|
|
50
51
|
]);
|
|
51
52
|
/** Consume one bootstrap-global token and update the accumulated parse state. */
|
|
52
53
|
function consumeBootstrapGlobalToken(argv, index, state) {
|
|
@@ -95,6 +96,9 @@ export function parseBootstrapGlobalOptions(argv) {
|
|
|
95
96
|
quiet: state.booleanFlags.has("--quiet"),
|
|
96
97
|
lean: state.booleanFlags.has("--lean"),
|
|
97
98
|
tokenAccounting: state.booleanFlags.has("--token-accounting"),
|
|
99
|
+
...(state.booleanFlags.has("--output-row-contract")
|
|
100
|
+
? { outputRowContract: true }
|
|
101
|
+
: {}),
|
|
98
102
|
...(state.outputValues.get("--output-include") === undefined
|
|
99
103
|
? {}
|
|
100
104
|
: { outputInclude: state.outputValues.get("--output-include") }),
|
|
@@ -886,4 +890,4 @@ export const _testOnly = {
|
|
|
886
890
|
resolveCanonicalFlag,
|
|
887
891
|
};
|
|
888
892
|
//# sourceMappingURL=cli-bootstrap.js.map
|
|
889
|
-
//# debugId=
|
|
893
|
+
//# debugId=7b3209a8-8580-542c-9e80-21d04df3f61f
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* a hand-picked test list.
|
|
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]="
|
|
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]="13847453-3016-5855-a816-2cadc2ca4870")}catch(e){}}();
|
|
11
11
|
import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
|
|
12
12
|
import { resolveSubcommandFlagContractsForCommand, } from "./flag-contracts.js";
|
|
13
13
|
import { pmToolActionParameterKeys } from "./tool-schema.js";
|
|
@@ -23,6 +23,7 @@ const CLI_TRANSPORT_FLAGS = new Set([
|
|
|
23
23
|
"--output-budget",
|
|
24
24
|
"--output-format",
|
|
25
25
|
"--output-session",
|
|
26
|
+
"--output-row-contract",
|
|
26
27
|
"--no-changed-fields",
|
|
27
28
|
"--no-extensions",
|
|
28
29
|
"--no-pager",
|
|
@@ -376,4 +377,4 @@ export function analyzeSdkCliParameterCompleteness(source = {}) {
|
|
|
376
377
|
});
|
|
377
378
|
}
|
|
378
379
|
//# sourceMappingURL=completeness.js.map
|
|
379
|
-
//# debugId=
|
|
380
|
+
//# debugId=13847453-3016-5855-a816-2cadc2ca4870
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
|
|
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]="
|
|
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]="40309a44-7d45-5333-9003-6fc740e827c8")}catch(e){}}();
|
|
11
11
|
import { normalizeUniqueStringList } from "./string-lists.js";
|
|
12
12
|
import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
|
|
13
13
|
function normalizeFlagAliasKey(flag) {
|
|
@@ -875,6 +875,7 @@ export const TEST_FLAG_CONTRACTS = [
|
|
|
875
875
|
{ flag: "--add" },
|
|
876
876
|
{ flag: "--add-json" },
|
|
877
877
|
{ flag: "--remove" },
|
|
878
|
+
{ flag: "--remove-index", repeatable: true },
|
|
878
879
|
{ flag: "--run" },
|
|
879
880
|
{ flag: "--match" },
|
|
880
881
|
{ flag: "--only-index" },
|
|
@@ -940,6 +941,7 @@ export const GC_FLAG_CONTRACTS = [
|
|
|
940
941
|
];
|
|
941
942
|
/** Public contract for stats flag contracts, shared by SDK and presentation-layer consumers. */
|
|
942
943
|
export const STATS_FLAG_CONTRACTS = [
|
|
944
|
+
{ flag: "--include-empty" },
|
|
943
945
|
{ flag: "--storage" },
|
|
944
946
|
{ flag: "--metadata-coverage" },
|
|
945
947
|
{ flag: "--field-utilization" },
|
|
@@ -1391,6 +1393,7 @@ export const ACTIVITY_FLAG_CONTRACTS = [
|
|
|
1391
1393
|
{ flag: "--limit" },
|
|
1392
1394
|
{ flag: "--unbounded" },
|
|
1393
1395
|
{ flag: "--compact" },
|
|
1396
|
+
{ flag: "--raw" },
|
|
1394
1397
|
{ flag: "--full" },
|
|
1395
1398
|
{ flag: "--provenance" },
|
|
1396
1399
|
{ flag: "--provenance-summary" },
|
|
@@ -1811,4 +1814,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
|
|
|
1811
1814
|
return normalizeUniqueStringList(all).join(" ");
|
|
1812
1815
|
}
|
|
1813
1816
|
//# sourceMappingURL=flag-contracts.js.map
|
|
1814
|
-
//# debugId=
|
|
1817
|
+
//# debugId=40309a44-7d45-5333-9003-6fc740e827c8
|