@unbrained/pm-cli 2026.8.31 → 2026.9.1
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/AGENTS.md +15 -13
- package/CHANGELOG.md +23 -6
- package/README.md +3 -3
- package/dist/cli/commands/merge.d.ts +1 -1
- package/dist/cli/commands/merge.js +3 -3
- package/dist/cli/register-mutation.js +8 -5
- package/dist/cli-bundle/bundle-manifest.json +125 -125
- package/dist/cli-bundle/chunks/{chunk-SXMHPK4V.js → chunk-2MC2LCXZ.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-52JXYSDW.js → chunk-3WICXLVT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OUGDA7NR.js → chunk-6XIIGE7U.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ALKKAUFN.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-JIFYOJF7.js → chunk-DTGWEL23.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-GOACULJW.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-NW6LV3TU.js → chunk-NOPL37X4.js} +64 -64
- package/dist/cli-bundle/chunks/{chunk-IEFJ3ZEB.js → chunk-TAG4VC22.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-MWIN6OH2.js → chunk-U45JXJCC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5DH5XCJL.js → chunk-X4RCGLTX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QZCIBZR3.js → chunk-Y7VOMSZT.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-7C7DKZ2U.js → register-list-query-XYNX4ASQ.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-2MVLRS3J.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-IIMA5OKO.js → register-operations-WCIDXBU3.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-52H36QCB.js → register-setup-KVNC5KPL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7VATS5QY.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-VJ7EFMFL.js → chunk-FWPLDEXF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FOMZ6NG5.js → chunk-MKHG3T76.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UN34D63M.js → chunk-PF3E6Q36.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-APN4QN6R.js → chunk-RMRCQPWU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BPWJ4QM5.js → chunk-S4U5CN5Q.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-T2LXXSOD.js +158 -0
- package/dist/cli-bundle/focused-chunks/{chunk-JCOOAUHK.js → chunk-Y6JJIX6I.js} +30 -30
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +25 -25
- 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 +31 -31
- 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/history/drift-scan.js +6 -6
- package/dist/core/history/history.d.ts +6 -0
- package/dist/core/history/history.js +47 -5
- package/dist/core/history/replay.d.ts +12 -1
- package/dist/core/history/replay.js +60 -39
- package/dist/mcp/server.d.ts +2 -2
- package/dist/mcp/server.js +78 -15
- package/dist/mcp/tool-definitions.js +56 -2
- package/dist/sdk/agent-capability-contracts.js +4 -2
- package/dist/sdk/history-read.js +14 -6
- package/dist/sdk/history-repair.js +17 -10
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +3 -2
- package/dist/sdk/init-agent-guidance.js +4 -4
- package/dist/sdk/lifecycle/update.js +23 -10
- package/dist/sdk/mcp/discovery.d.ts +152 -0
- package/dist/sdk/mcp/discovery.js +495 -0
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/receipts.d.ts +27 -1
- package/dist/sdk/merge/receipts.js +27 -8
- package/dist/sdk/merge/three-way.d.ts +3 -1
- package/dist/sdk/merge/three-way.js +9 -7
- package/dist/sdk/runtime-extended-actions.js +4 -4
- package/docs/AGENT_GUIDE.md +11 -3
- package/docs/ARCHITECTURE.md +5 -0
- package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
- package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +14 -5
- package/docs/MCP_2026_07_28.md +9 -5
- package/docs/MCP_CAPABILITY_SURFACES.md +7 -1
- package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +11 -1
- package/docs/MERGE_SAFETY.md +30 -2
- package/docs/OUTPUT_TOKEN_ACCOUNTING.md +5 -3
- package/docs/PROGRESSIVE_TOOL_DISCOVERY.md +42 -0
- package/docs/README.md +1 -0
- package/docs/agent-task-token-baseline.json +157 -3
- package/docs/agent-task-transcripts.json +143 -0
- package/docs/performance/cli-transport-overhead.md +8 -6
- package/marketplace.json +2 -2
- package/package.json +2 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/README.md +4 -3
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +145 -2
- package/dist/cli-bundle/chunks/chunk-2XVV45NJ.js +0 -35
- package/dist/cli-bundle/chunks/chunk-3FCSFWZT.js +0 -13
- package/dist/cli-bundle/chunks/register-mutation-OI4BJLUX.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-BMD42PUG.js +0 -158
- package/dist/cli-bundle/focused-chunks/chunk-EUTABA4M.js +0 -16
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Defines the Tool Definitions module for pm CLI source.
|
|
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]="5ceccf7d-78cb-5750-8e4b-793efa6e716c")}catch(e){}}();
|
|
8
8
|
import { GRAPH_SUBCOMMAND_VALUES, PM_DISCOVERABLE_TOOL_ACTIONS, } from "../sdk/cli-contracts/enum-contracts.js";
|
|
9
9
|
import { buildPmActionToolInputSchema } from "../sdk/cli-contracts/tool-schema.js";
|
|
10
10
|
import { RUNTIME_STATUS_ROLE_VALUES } from "../types.js";
|
|
@@ -149,6 +149,60 @@ const RAW_TOOLS = [
|
|
|
149
149
|
...READ_OUTPUT_TOOL_PROPERTIES,
|
|
150
150
|
}, ["action"]),
|
|
151
151
|
},
|
|
152
|
+
{
|
|
153
|
+
name: "pm_discover",
|
|
154
|
+
description: "Discover the smallest relevant authorized pm tool catalog under an explicit token budget. " +
|
|
155
|
+
"Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. " +
|
|
156
|
+
"Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",
|
|
157
|
+
inputSchema: objectSchema({
|
|
158
|
+
query: {
|
|
159
|
+
type: "string",
|
|
160
|
+
maxLength: 4096,
|
|
161
|
+
description: "Free-text capability intent. Empty text lists by stable policy order.",
|
|
162
|
+
},
|
|
163
|
+
family: {
|
|
164
|
+
type: "string",
|
|
165
|
+
enum: [
|
|
166
|
+
"workspace",
|
|
167
|
+
"intake",
|
|
168
|
+
"context",
|
|
169
|
+
"lifecycle",
|
|
170
|
+
"evidence",
|
|
171
|
+
"graph",
|
|
172
|
+
"quality",
|
|
173
|
+
"automation",
|
|
174
|
+
"extensions",
|
|
175
|
+
"internal",
|
|
176
|
+
],
|
|
177
|
+
description: "Optional stable capability-family filter.",
|
|
178
|
+
},
|
|
179
|
+
tier: {
|
|
180
|
+
type: "string",
|
|
181
|
+
enum: ["core", "standard", "full"],
|
|
182
|
+
description: "Maximum command visibility tier included in results.",
|
|
183
|
+
},
|
|
184
|
+
limit: {
|
|
185
|
+
type: "integer",
|
|
186
|
+
minimum: 1,
|
|
187
|
+
maximum: 100,
|
|
188
|
+
description: "Maximum result rows; defaults to 10.",
|
|
189
|
+
},
|
|
190
|
+
cursor: {
|
|
191
|
+
type: "string",
|
|
192
|
+
minLength: 1,
|
|
193
|
+
maxLength: 4096,
|
|
194
|
+
description: "Opaque next_cursor from an equivalent discovery request.",
|
|
195
|
+
},
|
|
196
|
+
includeSchema: {
|
|
197
|
+
type: "boolean",
|
|
198
|
+
description: "Include complete tool input schemas; false by default.",
|
|
199
|
+
},
|
|
200
|
+
outputBudget: {
|
|
201
|
+
anyOf: [{ type: "integer", minimum: 128 }, { const: "unbounded" }],
|
|
202
|
+
description: "Estimated-token ceiling; defaults to 1200.",
|
|
203
|
+
},
|
|
204
|
+
}),
|
|
205
|
+
},
|
|
152
206
|
{
|
|
153
207
|
name: "pm_context",
|
|
154
208
|
description: "Return the agent-oriented project context snapshot. " +
|
|
@@ -748,4 +802,4 @@ export function buildMcpToolContracts() {
|
|
|
748
802
|
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
749
803
|
}
|
|
750
804
|
//# sourceMappingURL=tool-definitions.js.map
|
|
751
|
-
//# debugId=
|
|
805
|
+
//# debugId=5ceccf7d-78cb-5750-8e4b-793efa6e716c
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* surfaces from one public SDK contract.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!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
|
+
!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]="f3f07ca8-7823-536d-b523-6d8f87c35f4a")}catch(e){}}();
|
|
9
9
|
import { PM_CORE_COMMAND_NAMES } from "./cli-contracts/enum-contracts.js";
|
|
10
10
|
const CORE_COMMANDS = new Set([
|
|
11
11
|
"claim",
|
|
@@ -176,6 +176,7 @@ export const PM_CORE_HELP_BUDGET = Object.freeze({
|
|
|
176
176
|
/** Root options retained in the compact progressive-disclosure help screen. */
|
|
177
177
|
export const PM_CORE_HELP_OPTION_FLAGS = Object.freeze([
|
|
178
178
|
"-V, --version",
|
|
179
|
+
"--all",
|
|
179
180
|
"--json",
|
|
180
181
|
"--output-include <fields>",
|
|
181
182
|
"--output-limit <count>",
|
|
@@ -277,6 +278,7 @@ export const PM_MCP_TOOL_COMMAND_CONTRACTS = Object.freeze({
|
|
|
277
278
|
pm_copy: "copy",
|
|
278
279
|
pm_create: "create",
|
|
279
280
|
pm_deps: "deps",
|
|
281
|
+
pm_discover: "help",
|
|
280
282
|
pm_docs: "docs",
|
|
281
283
|
pm_events: "history",
|
|
282
284
|
pm_files: "files",
|
|
@@ -424,4 +426,4 @@ export function renderPmCapabilityRoutingMarkdown(contracts = PM_COMMAND_CAPABIL
|
|
|
424
426
|
].join("\n");
|
|
425
427
|
}
|
|
426
428
|
//# sourceMappingURL=agent-capability-contracts.js.map
|
|
427
|
-
//# debugId=
|
|
429
|
+
//# debugId=f3f07ca8-7823-536d-b523-6d8f87c35f4a
|
package/dist/sdk/history-read.js
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
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]="f1ea4209-59d4-53f0-a8ea-2e060e385d14")}catch(e){}}();
|
|
11
11
|
import { assertInitializedTracker } from "./environment/tracker-preflight.js";
|
|
12
12
|
import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
|
|
13
13
|
import { applyHistoryPatch, ensureMaterializedHistoryTarget, extractPatchFailureContext, replayHistoryToTarget, resolveHistoryTarget, } from "../core/history/projection.js";
|
|
14
14
|
import { readHistoryEntries } from "../core/history/read.js";
|
|
15
|
-
import { hashDocument, hashEmptyDocument, } from "../core/history/history.js";
|
|
16
|
-
import { replayToCanonicalItemDocument,
|
|
15
|
+
import { hashDocument, hashDocumentVerificationCandidates, hashEmptyDocument, } from "../core/history/history.js";
|
|
16
|
+
import { replayToCanonicalItemDocument, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
|
|
17
17
|
import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
|
|
18
18
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
19
19
|
import { PmCliError } from "../core/shared/errors.js";
|
|
@@ -28,11 +28,19 @@ import { resolveHistorySubject } from "./history-redact.js";
|
|
|
28
28
|
* document to compare.
|
|
29
29
|
*/
|
|
30
30
|
export function verifyHistoryEntries(history, currentDocument) {
|
|
31
|
-
const verification =
|
|
31
|
+
const verification = verifyHistoryChainWithVersion(history);
|
|
32
32
|
const latestAfterHash = history.length > 0
|
|
33
33
|
? history[history.length - 1].after_hash
|
|
34
34
|
: hashEmptyDocument();
|
|
35
|
-
const
|
|
35
|
+
const currentItemHashCandidates = currentDocument === undefined ||
|
|
36
|
+
verification.item_hash_version === undefined
|
|
37
|
+
? undefined
|
|
38
|
+
: hashDocumentVerificationCandidates(currentDocument, verification.item_hash_version);
|
|
39
|
+
const currentItemHash = currentDocument === undefined
|
|
40
|
+
? undefined
|
|
41
|
+
: currentItemHashCandidates === undefined
|
|
42
|
+
? hashDocument(currentDocument)
|
|
43
|
+
: currentItemHashCandidates[Math.max(0, currentItemHashCandidates.indexOf(latestAfterHash))];
|
|
36
44
|
const currentMatchesLatest = currentItemHash === undefined
|
|
37
45
|
? undefined
|
|
38
46
|
: currentItemHash === latestAfterHash;
|
|
@@ -83,4 +91,4 @@ export async function getItemAt(id, target, options = {}) {
|
|
|
83
91
|
}
|
|
84
92
|
export { applyHistoryPatch, ensureMaterializedHistoryTarget, extractPatchFailureContext, readHistoryEntries, replayHistoryToTarget, resolveHistoryTarget, };
|
|
85
93
|
//# sourceMappingURL=history-read.js.map
|
|
86
|
-
//# debugId=
|
|
94
|
+
//# debugId=f1ea4209-59d4-53f0-a8ea-2e060e385d14
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm history repair command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="151e5d26-d6f5-5fcf-84ab-ce89e2b7664e")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "./environment/tracker-preflight.js";
|
|
9
9
|
import { realpath } from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
@@ -12,7 +12,7 @@ import jsonPatch from "fast-json-patch";
|
|
|
12
12
|
import { patchPathToChangedField } from "../core/history/history-diff.js";
|
|
13
13
|
import { pathExists, readFileIfExists } from "../core/fs/fs-utils.js";
|
|
14
14
|
import { executeHistoryRewrite, writeHistoryRawWithRollback, } from "../core/history/history-rewrite.js";
|
|
15
|
-
import { historyEntriesToRaw, normalizeReplayPatchOps, reanchorHistoryEntries,
|
|
15
|
+
import { historyEntriesToRaw, normalizeReplayPatchOps, reanchorHistoryEntries, replayHashVerificationCandidates, resolveHistoryRepairItemHashVersion, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
|
|
16
16
|
import { scanHistoryDrift } from "../core/history/drift-scan.js";
|
|
17
17
|
import { invalidateHistoryDriftCache } from "../core/history/drift-cache.js";
|
|
18
18
|
import { readHistoryEntries } from "../core/history/read.js";
|
|
@@ -287,11 +287,11 @@ async function loadHistoryRepairItemReplay(subject, settings, historyEntries, it
|
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
289
|
const currentItemReplay = toReplayDocument(loadedItem.document);
|
|
290
|
-
const lastOriginalAfterHash = historyEntries[historyEntries.length - 1]
|
|
290
|
+
const lastOriginalAfterHash = historyEntries[historyEntries.length - 1].after_hash;
|
|
291
291
|
return {
|
|
292
292
|
currentItemReplay,
|
|
293
293
|
currentItemPath,
|
|
294
|
-
matchedChainBefore:
|
|
294
|
+
matchedChainBefore: replayHashVerificationCandidates(currentItemReplay, itemHashVersion).includes(lastOriginalAfterHash),
|
|
295
295
|
currentItemRawBeforeLock: loadedItem.raw,
|
|
296
296
|
loadedItem,
|
|
297
297
|
};
|
|
@@ -312,6 +312,10 @@ function buildHistoryRepairEntries(params) {
|
|
|
312
312
|
const afterReplay = params.reconcileNeeded && params.currentItemReplay
|
|
313
313
|
? params.currentItemReplay
|
|
314
314
|
: params.finalReplay;
|
|
315
|
+
const beforeHashes = replayHashVerificationCandidates(params.finalReplay, params.itemHashVersion);
|
|
316
|
+
const previousAfterHash = params.reanchorEntries[params.reanchorEntries.length - 1].after_hash;
|
|
317
|
+
const semanticIndex = beforeHashes.indexOf(previousAfterHash);
|
|
318
|
+
const afterHashes = replayHashVerificationCandidates(afterReplay, params.itemHashVersion);
|
|
315
319
|
rewrittenEntries.push({
|
|
316
320
|
ts: nowIso(),
|
|
317
321
|
author: params.author,
|
|
@@ -319,8 +323,8 @@ function buildHistoryRepairEntries(params) {
|
|
|
319
323
|
patch: params.reconcileNeeded && params.currentItemReplay
|
|
320
324
|
? jsonPatch.compare(params.finalReplay, params.currentItemReplay)
|
|
321
325
|
: [],
|
|
322
|
-
before_hash:
|
|
323
|
-
after_hash:
|
|
326
|
+
before_hash: beforeHashes[semanticIndex],
|
|
327
|
+
after_hash: afterHashes[semanticIndex],
|
|
324
328
|
message: params.message,
|
|
325
329
|
...(params.explicitItemHashVersion
|
|
326
330
|
? { item_hash_version: params.itemHashVersion }
|
|
@@ -403,9 +407,12 @@ export async function runHistoryRepair(id, options, global) {
|
|
|
403
407
|
const reanchor = reanchorHistoryEntries(provenanceNormalization.entries, itemHashVersion);
|
|
404
408
|
const itemReplayContext = await loadHistoryRepairItemReplay(subject, settings, historyEntries, itemHashVersion);
|
|
405
409
|
const finalReplay = reanchor.finalDocument;
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
410
|
+
const finalReplayHashes = replayHashVerificationCandidates(finalReplay, itemHashVersion);
|
|
411
|
+
let reconcileNeeded = false;
|
|
412
|
+
if (itemReplayContext.currentItemReplay !== null) {
|
|
413
|
+
const currentItemReplayHashes = replayHashVerificationCandidates(itemReplayContext.currentItemReplay, itemHashVersion);
|
|
414
|
+
reconcileNeeded = !finalReplayHashes.some((hash, hashIndex) => hash === currentItemReplayHashes[hashIndex]);
|
|
415
|
+
}
|
|
409
416
|
// GH-603: reconciling toward the on-disk item can silently overwrite the
|
|
410
417
|
// replayed effect of other authors' events (classic after a lossy merge).
|
|
411
418
|
// Surface exactly what is being discarded before any write happens.
|
|
@@ -591,4 +598,4 @@ export async function runHistoryRepairAll(options, global) {
|
|
|
591
598
|
};
|
|
592
599
|
}
|
|
593
600
|
//# sourceMappingURL=history-repair.js.map
|
|
594
|
-
//# debugId=
|
|
601
|
+
//# debugId=151e5d26-d6f5-5fcf-84ab-ce89e2b7664e
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ export { describeProfileComposition, describeProjectProfile, type ProjectProfile
|
|
|
182
182
|
export { lintProjectProfile, PROFILE_LINT_CODES, PROFILE_LINT_DIMENSIONS, type ProfileLintCode, type ProfileLintDimension, type ProfileLintSeverity, type ProjectProfileLintFinding, type ProjectProfileLintReport, } from "../core/profile/profile-lint.js";
|
|
183
183
|
export * from "./authoring.js";
|
|
184
184
|
export * from "./governance.js";
|
|
185
|
+
export * from "./mcp/discovery.js";
|
|
185
186
|
export * from "./query.js";
|
|
186
187
|
export * from "./testing.js";
|
|
187
188
|
export type { GlobalOptions } from "../core/shared/command-types.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]="8a1a02de-32cb-5714-b950-6041ae8ce229")}catch(e){}}();
|
|
8
8
|
export { PM_COMMAND_CAPABILITY_CONTRACTS, PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForFamily, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandCapabilityFamily, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
|
|
9
9
|
export * from "./mcp/protocol.js";
|
|
10
10
|
export * from "./mcp/interactions.js";
|
|
@@ -173,7 +173,8 @@ export { describeProfileComposition, describeProjectProfile, } from "../core/pro
|
|
|
173
173
|
export { lintProjectProfile, PROFILE_LINT_CODES, PROFILE_LINT_DIMENSIONS, } from "../core/profile/profile-lint.js";
|
|
174
174
|
export * from "./authoring.js";
|
|
175
175
|
export * from "./governance.js";
|
|
176
|
+
export * from "./mcp/discovery.js";
|
|
176
177
|
export * from "./query.js";
|
|
177
178
|
export * from "./testing.js";
|
|
178
179
|
//# sourceMappingURL=index.js.map
|
|
179
|
-
//# debugId=
|
|
180
|
+
//# debugId=8a1a02de-32cb-5714-b950-6041ae8ce229
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm init agent guidance 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]="542cd5ac-e4a7-51fe-8521-d0bacd9e6a07")}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";
|
|
@@ -96,10 +96,10 @@ function buildAgentGuidanceBlock(lineEnding, projectTestCommand = "<your project
|
|
|
96
96
|
AGENT_GUIDANCE_START_MARKER,
|
|
97
97
|
"## pm Workflow (Agent Quickstart)",
|
|
98
98
|
"",
|
|
99
|
-
'-
|
|
99
|
+
'- Cold start with the measured canonical orientation: `pm context --limit 10 --for orient`; before item mutation, also run `pm search "<keywords>" --limit 10`, `pm list --status open --limit 20`, and `pm list --status in_progress --limit 20`.',
|
|
100
100
|
"- Claim and execute: `pm claim <id>` then `pm update <id> --status in_progress`.",
|
|
101
101
|
`- Link evidence while coding: \`pm files <id> --add ...\`, \`pm docs <id> --add ...\`, \`pm test <id> --add command="${projectTestCommand}"\`.`,
|
|
102
|
-
'- Verify and close: `pm test <id> --run --progress`, `pm close <id> "<
|
|
102
|
+
'- Verify and close: `pm test <id> --run --progress`, then atomically record closure evidence with `pm close <id> "<reason>" --resolution "<what changed>" --expected "<expected outcome>" --actual "<observed outcome>" --validate-close warn`, then `pm release <id>`.',
|
|
103
103
|
"- Author identity is automatic for supported agent harnesses; use `--author` only for an explicit override.",
|
|
104
104
|
"",
|
|
105
105
|
AGENT_GUIDANCE_END_MARKER,
|
|
@@ -494,4 +494,4 @@ export async function runInitAgentGuidance(options) {
|
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
//# sourceMappingURL=init-agent-guidance.js.map
|
|
497
|
-
//# debugId=
|
|
497
|
+
//# debugId=542cd5ac-e4a7-51fe-8521-d0bacd9e6a07
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm update 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]="78f8b369-1802-555d-a8cc-0147c0d8fb08")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
9
|
import { resolveMutationStdinTokenFields } from "../../core/item/parse.js";
|
|
10
10
|
import { COMMON_MUTATION_COMMAND_OPTION_KEYS, canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveItemTypeRegistry, resolveCommandOptionPolicyState, resolveTypeDefinition, resolveTypeName, validateTypeOptions, normalizeItemId, toItemRecord, buildInvalidTypeError, assertParentReferenceIsNotSelf, normalizeParentReferenceValue, validateMissingParentReference, validateSprintOrReleaseValue, applyAcceptanceCriteriaMutations, applyTagRemovals, assertNoUnknownCsvKeys, looksLikeGenericKeyValueEntry, mergeAdditiveTags, parseCsvKv, parseOptionalNonNegativeInteger, parseOptionalNumber, parseTags, shouldResolveMutationStdinTokens, transferMutationStdinTokenPolicy, splitAcceptanceCriteria, resolvePriority, normalizeStatusInput, isTerminalStatus, collectRuntimeUpdateFieldValues, resolveItemTypesFilePath, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, describeAllowedTransitions, evaluateTransition, resolveTypeWorkflows, EXIT_CODE, PmCliError, stableValueEquals, resolveIsoOrRelative, getActiveExtensionRegistrations, collectRegisteredItemFieldNames, applyRegisteredItemFieldDefaultsAndValidation, parseRegisteredItemFieldAssignments, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
@@ -1273,6 +1273,25 @@ function applySimpleItemMutations(document, options, statusRegistry, changedFiel
|
|
|
1273
1273
|
return (normalizeStatusInput(document.metadata.status, statusRegistry) ??
|
|
1274
1274
|
document.metadata.status);
|
|
1275
1275
|
}
|
|
1276
|
+
const TERMINAL_EVIDENCE_METADATA_KEYS = [
|
|
1277
|
+
"closed_at",
|
|
1278
|
+
"completed_at",
|
|
1279
|
+
"close_reason",
|
|
1280
|
+
"resolution",
|
|
1281
|
+
"expected_result",
|
|
1282
|
+
"actual_result",
|
|
1283
|
+
"fixed_version",
|
|
1284
|
+
];
|
|
1285
|
+
/** Remove stale terminal evidence when work returns to an active lifecycle. */
|
|
1286
|
+
function clearTerminalEvidence(metadata, changedFields) {
|
|
1287
|
+
for (const key of TERMINAL_EVIDENCE_METADATA_KEYS) {
|
|
1288
|
+
if (metadata[key] === undefined) {
|
|
1289
|
+
continue;
|
|
1290
|
+
}
|
|
1291
|
+
delete metadata[key];
|
|
1292
|
+
changedFields.push(key);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1276
1295
|
function applyStatusMutation(document, context, statusInput, previousStatusNormalized, changedFields) {
|
|
1277
1296
|
const status = parseStatus(statusInput, context.statusRegistry);
|
|
1278
1297
|
document.metadata.status = status;
|
|
@@ -1286,14 +1305,8 @@ function applyStatusMutation(document, context, statusInput, previousStatusNorma
|
|
|
1286
1305
|
return;
|
|
1287
1306
|
}
|
|
1288
1307
|
if (!isTerminalStatus(status, context.statusRegistry) &&
|
|
1289
|
-
isTerminalStatus(previousStatusNormalized, context.statusRegistry)
|
|
1290
|
-
document.metadata
|
|
1291
|
-
delete document.metadata.closed_at;
|
|
1292
|
-
changedFields.push("closed_at");
|
|
1293
|
-
if (document.metadata.completed_at !== undefined) {
|
|
1294
|
-
delete document.metadata.completed_at;
|
|
1295
|
-
changedFields.push("completed_at");
|
|
1296
|
-
}
|
|
1308
|
+
isTerminalStatus(previousStatusNormalized, context.statusRegistry)) {
|
|
1309
|
+
clearTerminalEvidence(document.metadata, changedFields);
|
|
1297
1310
|
}
|
|
1298
1311
|
}
|
|
1299
1312
|
function applyStatusAndCompletionMutations(document, context, previousStatusNormalized, changedFields) {
|
|
@@ -2121,4 +2134,4 @@ export const _testOnlyUpdateCommand = {
|
|
|
2121
2134
|
resolveRuntimeUnsetDefinition: (token, registry) => resolveRuntimeUnsetFieldDefinition(token, "update", registry),
|
|
2122
2135
|
};
|
|
2123
2136
|
//# sourceMappingURL=update.js.map
|
|
2124
|
-
//# debugId=
|
|
2137
|
+
//# debugId=78f8b369-1802-555d-a8cc-0147c0d8fb08
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type PmCommandCapabilityFamily, type PmCommandVisibilityTier, type PmMcpToolProfile } from "../agent-capability-contracts.js";
|
|
2
|
+
/** Namespaced MCP extension that opts a client into progressive tool discovery. */
|
|
3
|
+
export declare const PM_MCP_PROGRESSIVE_DISCOVERY_EXTENSION = "dev.unbrained.pm/progressive-tool-discovery";
|
|
4
|
+
/** Versioned server capability advertised for progressive tool discovery. */
|
|
5
|
+
export declare const PM_MCP_PROGRESSIVE_DISCOVERY_SERVER_CAPABILITY: Readonly<{
|
|
6
|
+
version: 1;
|
|
7
|
+
discoveryTool: "pm_discover";
|
|
8
|
+
canonicalResult: "structuredContent.result";
|
|
9
|
+
compatibilityText: "pointer";
|
|
10
|
+
}>;
|
|
11
|
+
/** Small stable tool catalog returned to clients that negotiate the extension. */
|
|
12
|
+
export declare const PM_MCP_ENTRY_TOOL_NAMES: readonly string[];
|
|
13
|
+
/** Ranking signals composed by the public discovery contract. */
|
|
14
|
+
export type PmToolDiscoverySignalName = "lexical" | "semantic" | "graph" | "permission" | "freshness" | "usage";
|
|
15
|
+
/** Optional host-owned signals supplied for one tool. */
|
|
16
|
+
export interface PmToolDiscoverySignalInput {
|
|
17
|
+
/** Semantic relevance normalized to the inclusive range zero through one. */
|
|
18
|
+
semantic?: number;
|
|
19
|
+
/** Graph proximity normalized to the inclusive range zero through one. */
|
|
20
|
+
graph?: number;
|
|
21
|
+
/** Definition freshness normalized to the inclusive range zero through one. */
|
|
22
|
+
freshness?: number;
|
|
23
|
+
/** Historical selection usefulness normalized to the inclusive range zero through one. */
|
|
24
|
+
usage?: number;
|
|
25
|
+
}
|
|
26
|
+
/** One tool definition accepted by the SDK discovery engine. */
|
|
27
|
+
export interface PmToolDiscoveryCandidate {
|
|
28
|
+
/** Stable callable tool name. */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Agent-facing tool description. */
|
|
31
|
+
description: string;
|
|
32
|
+
/** JSON Schema supplied when callers request schema expansion. */
|
|
33
|
+
inputSchema: Record<string, unknown>;
|
|
34
|
+
/** Whether the current caller is authorized to invoke the tool. */
|
|
35
|
+
authorized?: boolean;
|
|
36
|
+
/** Optional host-owned ranking signals. */
|
|
37
|
+
signals?: PmToolDiscoverySignalInput;
|
|
38
|
+
}
|
|
39
|
+
/** Options controlling one progressive discovery page. */
|
|
40
|
+
export interface PmToolDiscoveryOptions {
|
|
41
|
+
/** Free-text capability intent. Empty text lists by deterministic policy order. */
|
|
42
|
+
query?: string;
|
|
43
|
+
/** Restrict results to one stable capability family. */
|
|
44
|
+
family?: PmCommandCapabilityFamily;
|
|
45
|
+
/** Restrict results to tools visible at or below this tier. */
|
|
46
|
+
tier?: Exclude<PmCommandVisibilityTier, "internal">;
|
|
47
|
+
/** Maximum result rows, from one through one hundred. */
|
|
48
|
+
limit?: number;
|
|
49
|
+
/** Opaque continuation cursor from an equivalent discovery request. */
|
|
50
|
+
cursor?: string;
|
|
51
|
+
/** Include complete input schemas instead of the default compact projection. */
|
|
52
|
+
includeSchema?: boolean;
|
|
53
|
+
/** Estimated-token ceiling, or unbounded for the complete selected page. */
|
|
54
|
+
outputBudget?: number | "unbounded";
|
|
55
|
+
/** MCP profile that produced the authorized candidate catalog. */
|
|
56
|
+
profile?: PmMcpToolProfile;
|
|
57
|
+
/** Host-owned HMAC key of at least 32 bytes for restart-stable cursors. */
|
|
58
|
+
cursorIntegrityKey?: Uint8Array;
|
|
59
|
+
}
|
|
60
|
+
/** Applied score for one signal with explicit provenance. */
|
|
61
|
+
export interface PmToolDiscoveryAppliedSignal {
|
|
62
|
+
/** Normalized signal value. */
|
|
63
|
+
value: number;
|
|
64
|
+
/** Public policy weight. */
|
|
65
|
+
weight: number;
|
|
66
|
+
/** Whether the signal was computed or supplied rather than defaulted. */
|
|
67
|
+
available: boolean;
|
|
68
|
+
/** Transparent source of the normalized value. */
|
|
69
|
+
source: "computed" | "host" | "authorization" | "unavailable";
|
|
70
|
+
}
|
|
71
|
+
/** One ranked discovery result. */
|
|
72
|
+
export interface PmToolDiscoveryResultRow {
|
|
73
|
+
/** Stable callable tool name. */
|
|
74
|
+
name: string;
|
|
75
|
+
/** Agent-facing description. */
|
|
76
|
+
description: string;
|
|
77
|
+
/** Canonical CLI command backing the tool. */
|
|
78
|
+
command: string;
|
|
79
|
+
/** Minimum visibility tier inherited from the command contract. */
|
|
80
|
+
tier: PmCommandVisibilityTier;
|
|
81
|
+
/** Stable capability family inherited from the command contract. */
|
|
82
|
+
family: PmCommandCapabilityFamily;
|
|
83
|
+
/** Weighted aggregate score used for ordering. */
|
|
84
|
+
score: number;
|
|
85
|
+
/** Complete per-signal score explanation. */
|
|
86
|
+
signals: Readonly<Record<PmToolDiscoverySignalName, PmToolDiscoveryAppliedSignal>>;
|
|
87
|
+
/** Complete JSON Schema when explicitly requested. */
|
|
88
|
+
input_schema?: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/** Explicit receipt for information omitted from a discovery page. */
|
|
91
|
+
export interface PmToolDiscoveryOmissionReceipt {
|
|
92
|
+
/** Whether any result rows or schemas were omitted. */
|
|
93
|
+
has_omissions: boolean;
|
|
94
|
+
/** Stable omitted field groups. */
|
|
95
|
+
omitted: Array<{
|
|
96
|
+
name: "input_schema" | "tools";
|
|
97
|
+
reason: "compact_projection" | "limit" | "token_budget";
|
|
98
|
+
restore_with: string;
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
/** Deterministic progressive tool discovery response. */
|
|
102
|
+
export interface PmToolDiscoveryResult {
|
|
103
|
+
/** Stable result discriminator for model and host routing. */
|
|
104
|
+
result_type: "pm_tool_discovery";
|
|
105
|
+
/** Public contract revision. */
|
|
106
|
+
contract_version: 1;
|
|
107
|
+
/** Normalized query used by ranking and cursor binding. */
|
|
108
|
+
query: string;
|
|
109
|
+
/** MCP profile that produced the candidate catalog. */
|
|
110
|
+
profile: PmMcpToolProfile;
|
|
111
|
+
/** Ranked page of authorized tools. */
|
|
112
|
+
tools: PmToolDiscoveryResultRow[];
|
|
113
|
+
/** Total authorized rows after filters and before pagination. */
|
|
114
|
+
total: number;
|
|
115
|
+
/** Rows returned on this page. */
|
|
116
|
+
returned: number;
|
|
117
|
+
/** Whether a later ranked row remains. */
|
|
118
|
+
has_more: boolean;
|
|
119
|
+
/** Opaque continuation cursor bound to query, filters, and catalog. */
|
|
120
|
+
next_cursor?: string;
|
|
121
|
+
/** Exact estimated serialized result cost. */
|
|
122
|
+
token_cost: {
|
|
123
|
+
estimated_tokens: number;
|
|
124
|
+
budget: number | "unbounded";
|
|
125
|
+
within_budget: boolean;
|
|
126
|
+
};
|
|
127
|
+
/** Public ranking formula and weights. */
|
|
128
|
+
ranking_policy: {
|
|
129
|
+
version: 1;
|
|
130
|
+
formula: "weighted_sum_then_name";
|
|
131
|
+
weights: Readonly<Record<PmToolDiscoverySignalName, number>>;
|
|
132
|
+
};
|
|
133
|
+
/** Cache identity and invalidation contract for deterministic pages. */
|
|
134
|
+
cache: {
|
|
135
|
+
key: string;
|
|
136
|
+
ttl_ms: number;
|
|
137
|
+
scope: "private";
|
|
138
|
+
invalidates_on: readonly string[];
|
|
139
|
+
};
|
|
140
|
+
/** Explicit recovery for compacted fields and rows. */
|
|
141
|
+
omission_receipt: PmToolDiscoveryOmissionReceipt;
|
|
142
|
+
}
|
|
143
|
+
/** Parse untrusted adapter input without discarding malformed discovery values. */
|
|
144
|
+
export declare function parsePmToolDiscoveryOptions(input: Record<string, unknown>): PmToolDiscoveryOptions;
|
|
145
|
+
/**
|
|
146
|
+
* Rank and page an authorized MCP tool catalog under an explicit token budget.
|
|
147
|
+
*
|
|
148
|
+
* Cursors fail closed when the query, filters, schemas, authorization-filtered
|
|
149
|
+
* catalog, or ranking inputs change. Host signals override documented local
|
|
150
|
+
* fallbacks without changing the public formula or hiding signal provenance.
|
|
151
|
+
*/
|
|
152
|
+
export declare function discoverPmTools(candidates: readonly PmToolDiscoveryCandidate[], options?: PmToolDiscoveryOptions): PmToolDiscoveryResult;
|