@unbrained/pm-cli 2026.8.13 → 2026.8.14
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 +141 -112
- package/dist/cli/main.js +39 -3
- package/dist/cli-bundle/bundle-manifest.json +144 -176
- package/dist/cli-bundle/chunks/{chunk-DEDU3DG7.js → chunk-BBOFSVAK.js} +66 -65
- package/dist/cli-bundle/chunks/chunk-BFALV3YP.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-Q47C67TQ.js → chunk-FIW4P64F.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QGTUPEU5.js → chunk-G5JUB66K.js} +41 -41
- package/dist/cli-bundle/chunks/{chunk-3ZMOWAFM.js → chunk-SBRKH6OR.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TMJ7URWS.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-F7FJYGK3.js → chunk-TXMEUUUY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YLBAPY22.js → chunk-XAVMOK6B.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TF3TPKPR.js → chunk-YAMTJL6Y.js} +33 -33
- package/dist/cli-bundle/chunks/{chunk-IMGIN7R6.js → chunk-YSVSMJ2B.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-4HIZ7EA3.js → register-list-query-T3EHHNNV.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-W64FZ5HN.js → register-mutation-E27WCLSZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-C44ET7R5.js → register-operations-4R6I7CPY.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-634MFRXU.js → register-setup-3YXZ444E.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-OOYYKQWX.js → chunk-4DQ2YERC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-F43TT2QQ.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2RI2FESN.js → chunk-K7RWWOAG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KFSZ3BP6.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3DJSGWVB.js → chunk-KSEDUWVZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NFHFZH2Z.js → chunk-KYUQGTSB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IIS2FRKL.js → chunk-LZ4MV3RH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-PGXJQLCT.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-E3AVJ655.js → chunk-PPFGQDSI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q4YY3XNF.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QK753U3U.js +46 -0
- package/dist/cli-bundle/focused-chunks/{chunk-QDZUABWL.js → chunk-QUMB2J27.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-SM7MTG27.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-I75MANL7.js → chunk-WCVE2NIG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-XDNAW5OI.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2JP7W7GO.js → chunk-YOOI3UZX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZM6TZVHC.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 +44 -41
- 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 +109 -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/history/drift-scan.d.ts +6 -0
- package/dist/core/history/drift-scan.js +74 -50
- package/dist/core/history/workspace-history.d.ts +59 -0
- package/dist/core/history/workspace-history.js +197 -10
- package/dist/core/output/output.js +12 -4
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +6 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +155 -60
- package/dist/sdk/cli-program.js +3 -3
- package/dist/sdk/context-relevance.js +12 -4
- package/dist/sdk/governance/assurance.js +4 -4
- package/dist/sdk/governance/health.js +15 -3
- package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
- package/dist/sdk/governance/validate-history-drift.js +68 -0
- package/dist/sdk/governance/validate.js +4 -46
- package/dist/sdk/graph/assembly.d.ts +23 -0
- package/dist/sdk/graph/assembly.js +54 -2
- package/dist/sdk/graph/durable-cache.js +50 -20
- package/dist/sdk/graph/governance-contracts.d.ts +1 -1
- package/dist/sdk/graph/governance-contracts.js +4 -2
- package/dist/sdk/graph/governance.d.ts +21 -1
- package/dist/sdk/graph/governance.js +94 -32
- package/dist/sdk/graph/index.d.ts +2 -2
- package/dist/sdk/graph/index.js +4 -4
- package/dist/sdk/graph/mutation-advisory.js +15 -7
- package/dist/sdk/graph/remediation.js +12 -2
- package/dist/sdk/history-read.d.ts +8 -0
- package/dist/sdk/history-read.js +2 -2
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/query/history.js +20 -3
- package/dist/sdk/read-output-budget.d.ts +2 -0
- package/dist/sdk/read-output-budget.js +12 -5
- package/dist/sdk/read-output-contracts.d.ts +61 -5
- package/dist/sdk/read-output-contracts.js +210 -28
- package/dist/sdk/read-output-rows.d.ts +11 -0
- package/dist/sdk/read-output-rows.js +47 -2
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.js +5 -3
- package/docs/ASSURANCE.md +10 -1
- package/docs/COMMANDS.md +31 -2
- package/docs/READ_OUTPUT_CONTRACTS.md +44 -8
- package/docs/RELATIONSHIP_GRAPH.md +20 -5
- package/docs/SDK.md +12 -5
- package/docs/SDK_CONTEXT_INTEGRITY.md +32 -1
- package/docs/TESTING.md +23 -1
- package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
- package/marketplace.json +2 -2
- package/package.json +6 -6
- package/packages/pm-beads/extensions/beads/index.ts +1 -0
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/extensions/digital-twin/index.ts +7 -0
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
- 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/extensions/linked-test-adapters/index.ts +6 -0
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/extensions/templates/index.ts +4 -0
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/extensions/todos/index.ts +2 -0
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/bundle-cli.mjs +17 -4
- package/sdk/public-surface.json +209 -29
- package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +0 -13
- package/dist/cli-bundle/chunks/chunk-HIUZVCMN.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +0 -31
- package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-6MLIRBLV.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-EBTNSFYE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HC2OL2H2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +0 -17
- package/dist/cli-bundle/focused-chunks/chunk-PKPOZXLL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-TEZIXMTH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +0 -18
|
@@ -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]="1eb0e2cb-084a-5a54-b41c-29dfdd6d2f34")}catch(e){}}();
|
|
3
3
|
import { findRedundantRelationshipEdges } from "./analytics.js";
|
|
4
4
|
import { auditWorkspaceRelationshipGraph, collectDuplicateRelationshipEdgeGroups, formatDuplicateEdgeGroup, } from "./governance.js";
|
|
5
5
|
/** Per-finding-code operation template applied to every sampled subject. */
|
|
@@ -29,6 +29,16 @@ const FINDING_STEP_TEMPLATES = {
|
|
|
29
29
|
confidence: "high",
|
|
30
30
|
rationale: "Terminal-only ordering cycles have no scheduling effect; repairing them would mutate closed history (changelog drag).",
|
|
31
31
|
},
|
|
32
|
+
ordering_storage_contradiction: {
|
|
33
|
+
op: "remove",
|
|
34
|
+
confidence: "high",
|
|
35
|
+
rationale: "The structured ordering row asserts the opposite precedence from the same-target scalar blocker; remove that exact dependency row or replace both representations with one unambiguous edge.",
|
|
36
|
+
},
|
|
37
|
+
legacy_ordering_storage_contradiction: {
|
|
38
|
+
op: "remove",
|
|
39
|
+
confidence: "high",
|
|
40
|
+
rationale: "The terminal holder contains a proven contradictory structured ordering row; remove it in a dedicated changelog-safe batch while preserving the scalar blocker as history.",
|
|
41
|
+
},
|
|
32
42
|
// duplicate_edge findings are expanded into per-stored-edge remove steps by
|
|
33
43
|
// the planner itself (see stepsFromDuplicateGroup); this template documents
|
|
34
44
|
// the family for exhaustiveness and backs any future sample-only fallback.
|
|
@@ -155,4 +165,4 @@ export function planRelationshipRemediation(assembly, options = {}) {
|
|
|
155
165
|
};
|
|
156
166
|
}
|
|
157
167
|
//# sourceMappingURL=remediation.js.map
|
|
158
|
-
//# debugId=
|
|
168
|
+
//# debugId=1eb0e2cb-084a-5a54-b41c-29dfdd6d2f34
|
|
@@ -37,6 +37,14 @@ export interface HistoryVerificationResult {
|
|
|
37
37
|
current_item_hash?: string;
|
|
38
38
|
/** Whether the supplied document matches the newest history hash. */
|
|
39
39
|
current_matches_latest?: boolean;
|
|
40
|
+
/** Whether every governed workspace singleton matches the latest replayed state. */
|
|
41
|
+
workspace_state_matches_latest?: boolean;
|
|
42
|
+
/** Governed singleton paths whose JSON differs from the replayed value. */
|
|
43
|
+
workspace_state_mismatches?: string[];
|
|
44
|
+
/** Governed singleton paths absent from disk. */
|
|
45
|
+
workspace_state_missing?: string[];
|
|
46
|
+
/** Governed singleton paths unreadable as safe workspace-local JSON. */
|
|
47
|
+
workspace_state_unreadable?: string[];
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* Verify a history chain and optionally compare it with a current document.
|
package/dist/sdk/history-read.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* systems without acquiring locks or appending history.
|
|
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]="04f5d4d2-4021-5ce2-b35a-2134d98d2ad7")}catch(e){}}();
|
|
11
11
|
import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
|
|
12
12
|
import { pathExists } from "../core/fs/fs-utils.js";
|
|
13
13
|
import { applyHistoryPatch, ensureMaterializedHistoryTarget, extractPatchFailureContext, replayHistoryToTarget, resolveHistoryTarget, } from "../core/history/projection.js";
|
|
@@ -85,4 +85,4 @@ export async function getItemAt(id, target, options = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
export { applyHistoryPatch, ensureMaterializedHistoryTarget, extractPatchFailureContext, readHistoryEntries, replayHistoryToTarget, resolveHistoryTarget, };
|
|
87
87
|
//# sourceMappingURL=history-read.js.map
|
|
88
|
-
//# debugId=
|
|
88
|
+
//# debugId=04f5d4d2-4021-5ce2-b35a-2134d98d2ad7
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export * from "./history-compact.js";
|
|
|
84
84
|
export * from "./history-read.js";
|
|
85
85
|
export * from "./history-provenance.js";
|
|
86
86
|
export * from "./mutation-events.js";
|
|
87
|
-
export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, type WorkspaceAuditEventOptions, type WorkspaceHistoryChange, type WorkspaceJsonMutation, type WorkspaceJsonMutationOptions, type WorkspaceJsonWriteOptions, } from "../core/history/workspace-history.js";
|
|
87
|
+
export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, mutateWorkspaceJsonWithHistory, reconcileWorkspaceJsonHistory, restoreWorkspaceJsonFromHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, type WorkspaceAuditEventOptions, type WorkspaceHistoryChange, type WorkspaceHistoryStateAgreement, type WorkspaceJsonMutation, type WorkspaceJsonMutationOptions, type WorkspaceJsonReconciliationOptions, type WorkspaceJsonRestoreOptions, type WorkspaceJsonRestoreResult, type WorkspaceJsonWriteOptions, } from "../core/history/workspace-history.js";
|
|
88
88
|
export * from "./history-redact.js";
|
|
89
89
|
export { _testOnly } from "./history-redact.js";
|
|
90
90
|
export * from "./history-repair.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]="a05170b2-a48d-5275-ac04-aafc9f8315b2")}catch(e){}}();
|
|
8
8
|
export { PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
|
|
9
9
|
export * from "./agent-session-context.js";
|
|
10
10
|
export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, normalizeAnnotationTransportOptions, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, } from "./annotations.js";
|
|
@@ -82,7 +82,7 @@ export * from "./history-compact.js";
|
|
|
82
82
|
export * from "./history-read.js";
|
|
83
83
|
export * from "./history-provenance.js";
|
|
84
84
|
export * from "./mutation-events.js";
|
|
85
|
-
export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
|
|
85
|
+
export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, mutateWorkspaceJsonWithHistory, reconcileWorkspaceJsonHistory, restoreWorkspaceJsonFromHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
|
|
86
86
|
export * from "./history-redact.js";
|
|
87
87
|
export { _testOnly } from "./history-redact.js";
|
|
88
88
|
export * from "./history-repair.js";
|
|
@@ -151,4 +151,4 @@ export * from "./governance.js";
|
|
|
151
151
|
export * from "./query.js";
|
|
152
152
|
export * from "./testing.js";
|
|
153
153
|
//# sourceMappingURL=index.js.map
|
|
154
|
-
//# debugId=
|
|
154
|
+
//# debugId=a05170b2-a48d-5275-ac04-aafc9f8315b2
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Implements the pm history 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]="
|
|
8
|
-
import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, getSettingsPath, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.js";
|
|
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]="f18d7526-01eb-593b-bf50-788c08a35e5d")}catch(e){}}();
|
|
8
|
+
import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, getSettingsPath, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.js";
|
|
9
9
|
import { readHistoryEntries, verifyHistoryEntries, } from "../history-read.js";
|
|
10
10
|
export { readHistoryEntries } from "../history-read.js";
|
|
11
11
|
import { parseLimit } from "./parsers.js";
|
|
@@ -140,8 +140,25 @@ export async function runHistory(id, options, global) {
|
|
|
140
140
|
})).document
|
|
141
141
|
: undefined;
|
|
142
142
|
result.verification = verifyHistoryEntries(fullHistory, currentDocument);
|
|
143
|
+
if (resolvedId === WORKSPACE_HISTORY_ID && result.verification.ok) {
|
|
144
|
+
const agreement = await inspectWorkspaceHistoryState(resolvePmRoot(process.cwd(), global.path));
|
|
145
|
+
result.verification = {
|
|
146
|
+
...result.verification,
|
|
147
|
+
ok: agreement.ok,
|
|
148
|
+
errors: agreement.ok
|
|
149
|
+
? result.verification.errors
|
|
150
|
+
: [
|
|
151
|
+
...result.verification.errors,
|
|
152
|
+
"verify_failed:workspace_state_mismatch",
|
|
153
|
+
],
|
|
154
|
+
workspace_state_matches_latest: agreement.ok,
|
|
155
|
+
workspace_state_mismatches: agreement.mismatched_documents,
|
|
156
|
+
workspace_state_missing: agreement.missing_documents,
|
|
157
|
+
workspace_state_unreadable: agreement.unreadable_documents,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
143
160
|
}
|
|
144
161
|
return result;
|
|
145
162
|
}
|
|
146
163
|
//# sourceMappingURL=history.js.map
|
|
147
|
-
//# debugId=
|
|
164
|
+
//# debugId=f18d7526-01eb-593b-bf50-788c08a35e5d
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* read-output contract without expanding its public declaration module.
|
|
6
6
|
*/
|
|
7
7
|
import type { PmReadOutputReceipt } from "./read-output-contracts.js";
|
|
8
|
+
/** Estimate the conservative token cost of a JSON-shaped result. */
|
|
9
|
+
export declare function estimateReadOutputTokens(result: unknown): number;
|
|
8
10
|
/** Update a receipt to the fixed-point estimate of the result containing it. */
|
|
9
11
|
export declare function updateReadOutputReceiptEstimate(result: Record<string, unknown>, receipt: PmReadOutputReceipt): void;
|
|
10
12
|
/** Compact strings and rows in place, then return the final exact estimate. */
|
|
@@ -1,8 +1,12 @@
|
|
|
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]="
|
|
3
|
-
import { countReadOutputRows,
|
|
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]="cc595424-0176-5920-8f4c-d935e6a546ce")}catch(e){}}();
|
|
3
|
+
import { countReadOutputRows, readOutputBudgetCollections, } from "./read-output-rows.js";
|
|
4
4
|
const MAX_ESTIMATE_ITERATIONS = 8;
|
|
5
5
|
const MAX_COMPACTION_ITERATIONS = 64;
|
|
6
|
+
/** Estimate the conservative token cost of a JSON-shaped result. */
|
|
7
|
+
export function estimateReadOutputTokens(result) {
|
|
8
|
+
return Math.ceil(Buffer.byteLength(JSON.stringify(result), "utf8") / 4);
|
|
9
|
+
}
|
|
6
10
|
/** Return whether a value is a non-array object record. */
|
|
7
11
|
function isRecord(value) {
|
|
8
12
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -30,7 +34,7 @@ export function updateReadOutputReceiptEstimate(result, receipt) {
|
|
|
30
34
|
let estimate = receipt.estimated_tokens;
|
|
31
35
|
for (let iteration = 0; iteration < MAX_ESTIMATE_ITERATIONS; iteration += 1) {
|
|
32
36
|
receipt.estimated_tokens = estimate;
|
|
33
|
-
const measured =
|
|
37
|
+
const measured = estimateReadOutputTokens(result);
|
|
34
38
|
if (measured === estimate)
|
|
35
39
|
return;
|
|
36
40
|
estimate = measured;
|
|
@@ -43,7 +47,7 @@ function compactRowsToBudget(result, receipt, budget) {
|
|
|
43
47
|
updateReadOutputReceiptEstimate(result, receipt);
|
|
44
48
|
if (receipt.estimated_tokens <= budget)
|
|
45
49
|
return;
|
|
46
|
-
const candidate =
|
|
50
|
+
const candidate = readOutputBudgetCollections(result)
|
|
47
51
|
.filter((collection) => (Array.isArray(collection.value)
|
|
48
52
|
? collection.value.length
|
|
49
53
|
: Object.keys(collection.value).length) > 1)
|
|
@@ -67,6 +71,9 @@ function compactRowsToBudget(result, receipt, budget) {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
receipt.rows_compacted = true;
|
|
74
|
+
receipt.compacted_row_paths = [
|
|
75
|
+
...new Set([...(receipt.compacted_row_paths ?? []), candidate.path]),
|
|
76
|
+
].sort((left, right) => left.localeCompare(right));
|
|
70
77
|
result.has_more = true;
|
|
71
78
|
result.truncated = true;
|
|
72
79
|
if (typeof result.count === "number") {
|
|
@@ -85,4 +92,4 @@ export function compactReadOutputToBudget(result, receipt, budget) {
|
|
|
85
92
|
return compacted;
|
|
86
93
|
}
|
|
87
94
|
//# sourceMappingURL=read-output-budget.js.map
|
|
88
|
-
//# debugId=
|
|
95
|
+
//# debugId=cc595424-0176-5920-8f4c-d935e6a546ce
|
|
@@ -4,7 +4,7 @@ export declare const PM_READ_OUTPUT_DIMENSIONS: readonly ["include", "amount", "
|
|
|
4
4
|
/** One member of the universal read-output dimension set. */
|
|
5
5
|
export type PmReadOutputDimension = (typeof PM_READ_OUTPUT_DIMENSIONS)[number];
|
|
6
6
|
/** Built-in command roots whose primary operation is a read. */
|
|
7
|
-
export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "package-manage"];
|
|
7
|
+
export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "package-manage", "comments-audit", "assurance"];
|
|
8
8
|
/** Built-in read command supported by the universal output contract. */
|
|
9
9
|
export type PmReadOutputSurface = (typeof PM_READ_OUTPUT_SURFACES)[number];
|
|
10
10
|
/** Canonical output controls accepted by every built-in read action. */
|
|
@@ -13,8 +13,8 @@ export interface PmReadOutputOptions {
|
|
|
13
13
|
outputInclude?: string | string[];
|
|
14
14
|
/** Maximum rows retained, or `unbounded` to disable the shared row ceiling. */
|
|
15
15
|
outputLimit?: string | number | "unbounded";
|
|
16
|
-
/** Maximum estimated result tokens. */
|
|
17
|
-
outputBudget?: string | number;
|
|
16
|
+
/** Maximum estimated result tokens, or `unbounded` to disable the default ceiling. */
|
|
17
|
+
outputBudget?: string | number | "unbounded";
|
|
18
18
|
/** Requested static renderer encoding; streaming remains a command behavior. */
|
|
19
19
|
outputFormat?: "json" | "toon";
|
|
20
20
|
/** Caller-carried cross-call budget and served-fact state. */
|
|
@@ -26,6 +26,8 @@ export interface PmReadOutputOptions {
|
|
|
26
26
|
export interface PmReadOutputLegacyAlias {
|
|
27
27
|
/** Historical CLI spelling. */
|
|
28
28
|
flag: string;
|
|
29
|
+
/** Strength of the migration promise carried by this alias. */
|
|
30
|
+
semantics?: "replacement" | "behavior_preserving";
|
|
29
31
|
/** One-line migration instruction for agents and help generators. */
|
|
30
32
|
migration_hint: string;
|
|
31
33
|
/** Compatibility aliases are accepted but omitted from the canonical vocabulary. */
|
|
@@ -70,8 +72,8 @@ export interface PmResolvedReadOutputDimensions {
|
|
|
70
72
|
include?: PmResolvedReadOutputDimension<string[]>;
|
|
71
73
|
/** Requested row ceiling. */
|
|
72
74
|
amount?: PmResolvedReadOutputDimension<number | "unbounded">;
|
|
73
|
-
/** Requested estimated-token ceiling. */
|
|
74
|
-
cost?: PmResolvedReadOutputDimension<number>;
|
|
75
|
+
/** Requested estimated-token ceiling or explicit opt-out. */
|
|
76
|
+
cost?: PmResolvedReadOutputDimension<number | "unbounded">;
|
|
75
77
|
/** Requested static encoding or a retained legacy streaming behavior. */
|
|
76
78
|
encoding?: PmResolvedReadOutputDimension<"json" | "toon" | "stream">;
|
|
77
79
|
/** Compatibility flags observed on the invocation. */
|
|
@@ -89,6 +91,10 @@ export interface PmReadOutputReceipt {
|
|
|
89
91
|
command: PmReadOutputSurface;
|
|
90
92
|
/** Dimensions explicitly or compatibly requested by the invocation. */
|
|
91
93
|
requested_dimensions: PmReadOutputDimension[];
|
|
94
|
+
/** Layer that supplied an automatically applied token ceiling. */
|
|
95
|
+
budget_source?: "default";
|
|
96
|
+
/** Automatically applied token ceiling; explicit/session budgets already disclose their value. */
|
|
97
|
+
budget_tokens?: number;
|
|
92
98
|
/** Deterministic precedence used during resolution. */
|
|
93
99
|
precedence: readonly ["canonical", "legacy", "intent", "default"];
|
|
94
100
|
/** Compatibility options observed on the invocation. */
|
|
@@ -103,8 +109,27 @@ export interface PmReadOutputReceipt {
|
|
|
103
109
|
strings_compacted: boolean;
|
|
104
110
|
/** Whether row collections were reduced while satisfying the cost ceiling. */
|
|
105
111
|
rows_compacted: boolean;
|
|
112
|
+
/** Declared or nested collection paths reduced by budget degradation. */
|
|
113
|
+
compacted_row_paths?: string[];
|
|
106
114
|
/** Whether the requested cost ceiling forced the useful result to be omitted. */
|
|
107
115
|
result_omitted: boolean;
|
|
116
|
+
/** Estimated tokens in the useful result immediately before whole-result omission. */
|
|
117
|
+
omitted_result_estimated_tokens?: number;
|
|
118
|
+
}
|
|
119
|
+
/** Machine-readable explanation of budget-driven row degradation. */
|
|
120
|
+
export interface PmReadOutputTruncationDisclosure {
|
|
121
|
+
/** Stable reason for dropping rows. */
|
|
122
|
+
reason: "output_budget_reached";
|
|
123
|
+
/** Layer that supplied the binding ceiling. */
|
|
124
|
+
budget_source: PmReadOutputDimensionSource | "session";
|
|
125
|
+
/** Binding estimated-token ceiling. */
|
|
126
|
+
budget_tokens: number;
|
|
127
|
+
/** Explicit dimensions whose unbounded request was overridden by the ceiling. */
|
|
128
|
+
overridden_dimensions: PmReadOutputDimension[];
|
|
129
|
+
/** Declared or nested collection paths reduced by budget degradation. */
|
|
130
|
+
compacted_row_paths: string[];
|
|
131
|
+
/** Executable recovery instruction for retrieving the complete result. */
|
|
132
|
+
restore_with: string;
|
|
108
133
|
}
|
|
109
134
|
/** Result returned when the requested cost ceiling cannot fit useful content. */
|
|
110
135
|
export interface PmReadOutputBudgetExceeded {
|
|
@@ -124,6 +149,7 @@ export interface PmReadOutputBudgetExceeded {
|
|
|
124
149
|
export type PmReadOutputResult<Result> = (Result & {
|
|
125
150
|
read_output?: PmReadOutputReceipt;
|
|
126
151
|
read_session?: PmReadOutputSessionReceipt;
|
|
152
|
+
output_budget_truncation?: PmReadOutputTruncationDisclosure;
|
|
127
153
|
}) | (PmReadOutputBudgetExceeded & {
|
|
128
154
|
read_session?: PmReadOutputSessionReceipt;
|
|
129
155
|
});
|
|
@@ -139,6 +165,36 @@ export declare const PM_READ_OUTPUT_SURFACE_CONTRACTS: readonly PmReadOutputSurf
|
|
|
139
165
|
export declare function resolveReadOutputSurface(command: string): PmReadOutputSurface | undefined;
|
|
140
166
|
/** Reject malformed or mutation-scoped universal output controls before command execution. */
|
|
141
167
|
export declare function validateReadOutputOptions(command: string, options: Record<string, unknown>): void;
|
|
168
|
+
/**
|
|
169
|
+
* Map every canonical `--output-include` token that names a projection mode
|
|
170
|
+
* rather than a row field onto the command-local option that mode already owns.
|
|
171
|
+
*
|
|
172
|
+
* The include dimension folds two kinds of legacy alias into one canonical
|
|
173
|
+
* spelling: value-bearing selectors (`--fields`, `--section`) that name row
|
|
174
|
+
* fields, and mode flags (`--brief`, `--full`, `--summary`, ...) that select a
|
|
175
|
+
* whole declared projection. Only the first kind can be honoured by projecting
|
|
176
|
+
* an already-computed result, so mode tokens have to reach the command itself.
|
|
177
|
+
*/
|
|
178
|
+
export declare function readOutputIncludeModeOptions(command: string): ReadonlyMap<string, string>;
|
|
179
|
+
/**
|
|
180
|
+
* Translate canonical projection-mode tokens into the command-local options
|
|
181
|
+
* they alias, so the spelling the migration hints recommend is behaviour
|
|
182
|
+
* identical to the legacy flag it replaces, and return the field selectors that
|
|
183
|
+
* remain for post-execution projection.
|
|
184
|
+
*/
|
|
185
|
+
export declare function applyReadOutputIncludeModes(command: string, includeValue: unknown, commandOptions: Record<string, unknown>): {
|
|
186
|
+
selectors: string[];
|
|
187
|
+
modes: string[];
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Resolve canonical include modes against one combined options bag, rewriting
|
|
191
|
+
* the include value in place to the selectors that remain.
|
|
192
|
+
*
|
|
193
|
+
* Used by dispatch paths that carry command options and universal output
|
|
194
|
+
* controls in a single record, so an action honours a mode token exactly as the
|
|
195
|
+
* CLI does.
|
|
196
|
+
*/
|
|
197
|
+
export declare function normalizeReadOutputIncludeModeOptions(command: string, options: Record<string, unknown>): void;
|
|
142
198
|
/** Resolve canonical and compatibility controls into the universal dimension set. */
|
|
143
199
|
export declare function resolveReadOutputDimensions(command: string, options: Record<string, unknown>): PmResolvedReadOutputDimensions | undefined;
|
|
144
200
|
/** Recompute read and optional session receipts after a final envelope projection. */
|