@unbrained/pm-cli 2026.8.30 → 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/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
- package/.agents/skills/README.md +1 -1
- package/.agents/skills/pm-developer/SKILL.md +1 -1
- package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +2 -2
- package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +1 -1
- package/.agents/skills/pm-developer/references/TOKEN_BUDGETS.md +1 -1
- package/.agents/skills/pm-extensions/SKILL.md +2 -2
- package/.agents/skills/pm-extensions/references/AUTHORING.md +1 -1
- package/.agents/skills/pm-extensions/references/LIFECYCLE.md +1 -1
- package/.agents/skills/pm-sdk/SKILL.md +1 -1
- package/.agents/skills/pm-user/SKILL.md +2 -2
- package/.agents/skills/pm-user/references/WORKFLOWS.md +2 -2
- package/.claude-plugin/marketplace.json +2 -2
- package/AGENTS.md +16 -14
- package/CHANGELOG.md +41 -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-list-query.js +32 -17
- package/dist/cli/register-mutation.js +8 -5
- package/dist/cli/register-operations.d.ts +2 -0
- package/dist/cli/register-operations.js +20 -9
- package/dist/cli-bundle/bundle-manifest.json +144 -144
- package/dist/cli-bundle/chunks/{chunk-CMIEDWAY.js → chunk-2MC2LCXZ.js} +41 -41
- package/dist/cli-bundle/chunks/{chunk-WS2GJQVG.js → chunk-3WICXLVT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7SKMLSMX.js → chunk-6XIIGE7U.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ALKKAUFN.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-MTTKAUBX.js → chunk-DTGWEL23.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-GOACULJW.js +13 -0
- package/dist/cli-bundle/chunks/chunk-NOPL37X4.js +205 -0
- package/dist/cli-bundle/chunks/{chunk-2UETTHY6.js → chunk-TAG4VC22.js} +30 -30
- package/dist/cli-bundle/chunks/{chunk-3TEF3HM5.js → chunk-U45JXJCC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TGNAA66W.js → chunk-X4RCGLTX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2MKLQL2E.js → chunk-Y7VOMSZT.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-OMKJ5ONN.js → register-list-query-XYNX4ASQ.js} +11 -11
- package/dist/cli-bundle/chunks/register-mutation-2MVLRS3J.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-WCIDXBU3.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-GLQ5SYV3.js → register-setup-KVNC5KPL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HVQ22RC4.js → chunk-2FEZ5SKM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y3JJXRVK.js → chunk-4O4CJAR6.js} +5 -5
- package/dist/cli-bundle/focused-chunks/chunk-7VATS5QY.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LYFWQMVC.js → chunk-BEVHCEWG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TDK3OCX3.js → chunk-FWPLDEXF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-JEFKLWMM.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-JZYPPMXF.js → chunk-KB5OFSFD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-73EDXGYE.js → chunk-MKHG3T76.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3AVAWVZA.js → chunk-PF3E6Q36.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AD6ULRAF.js → chunk-QDFJIRKN.js} +4 -4
- package/dist/cli-bundle/focused-chunks/{chunk-RKOKG43G.js → chunk-RMRCQPWU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XXOWRJZ5.js → chunk-S4U5CN5Q.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-THEPQMLX.js → chunk-SVXJYD6G.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-T2LXXSOD.js +158 -0
- package/dist/cli-bundle/focused-chunks/chunk-Y6JJIX6I.js +51 -0
- package/dist/cli-bundle/main.js +2 -2
- 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 +27 -27
- 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 +33 -33
- 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/core/schema/runtime-schema.d.ts +4 -0
- package/dist/core/schema/runtime-schema.js +60 -48
- package/dist/core/schema/status-defs-file.js +5 -2
- package/dist/mcp/legacy-adapter.d.ts +11 -2
- package/dist/mcp/legacy-adapter.js +26 -12
- 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/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +12 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +3 -2
- package/dist/sdk/cli-contracts/tool-schema.js +11 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +14 -2
- package/dist/sdk/governance/health.js +17 -6
- package/dist/sdk/governance/status-role-diagnostics.d.ts +27 -0
- package/dist/sdk/governance/status-role-diagnostics.js +36 -0
- package/dist/sdk/governance/validate-normalization.d.ts +6 -0
- package/dist/sdk/governance/validate-normalization.js +37 -0
- package/dist/sdk/governance/validate.d.ts +1 -1
- package/dist/sdk/governance/validate.js +20 -35
- package/dist/sdk/governance/workspace-position.d.ts +69 -0
- package/dist/sdk/governance/workspace-position.js +164 -0
- package/dist/sdk/governance.d.ts +2 -0
- package/dist/sdk/governance.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 +2 -1
- package/dist/sdk/index.js +4 -3
- 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/mcp/protocol.d.ts +10 -2
- package/dist/sdk/mcp/protocol.js +15 -4
- 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/query/context.js +11 -14
- package/dist/sdk/query/list.d.ts +2 -0
- package/dist/sdk/query/list.js +33 -12
- package/dist/sdk/runtime-extended-actions.js +10 -6
- package/dist/sdk/schema.js +12 -2
- package/dist/sdk/test/execution.d.ts +15 -0
- package/dist/sdk/test/execution.js +35 -27
- package/docs/AGENT_GUIDE.md +12 -4
- package/docs/AGENT_PROVENANCE_ADR.md +1 -1
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +2 -2
- package/docs/ARCHITECTURE.md +5 -0
- package/docs/CLAUDE_CODE_PLUGIN.md +5 -5
- package/docs/COMMANDS.md +12 -12
- package/docs/CONFIGURATION.md +1 -1
- package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +14 -5
- package/docs/DEFECT_RECURRENCE.md +2 -0
- package/docs/MCP_2026_07_28.md +33 -9
- package/docs/MCP_2026_07_28_CONFORMANCE.md +1 -0
- package/docs/MCP_CAPABILITY_SURFACES.md +7 -1
- package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +15 -3
- package/docs/MERGE_SAFETY.md +30 -2
- package/docs/ONBOARDING.md +1 -1
- package/docs/OUTPUT_TOKEN_ACCOUNTING.md +5 -3
- package/docs/PROGRESSIVE_TOOL_DISCOVERY.md +42 -0
- package/docs/README.md +3 -1
- package/docs/READ_OUTPUT_CONTRACTS.md +1 -1
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +1 -1
- package/docs/SDK.md +3 -3
- package/docs/TESTING.md +23 -14
- package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +113 -0
- package/docs/agent-task-token-baseline.json +157 -3
- package/docs/agent-task-transcripts.json +143 -0
- package/docs/examples/policy-restricted-extension/README.md +2 -2
- package/docs/examples/starter-extension/README.md +1 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/docs/performance/cli-transport-overhead.md +8 -6
- package/marketplace.json +2 -2
- package/package.json +4 -4
- 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 +314 -10
- package/dist/cli-bundle/chunks/chunk-7X6OZEIV.js +0 -34
- package/dist/cli-bundle/chunks/chunk-GNWPTEBW.js +0 -205
- package/dist/cli-bundle/chunks/chunk-N6OR6FAR.js +0 -13
- package/dist/cli-bundle/chunks/register-mutation-QBSNCOY3.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-UC77FQZC.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3UMBF26I.js +0 -158
- package/dist/cli-bundle/focused-chunks/chunk-AXZ5AJAF.js +0 -50
- package/dist/cli-bundle/focused-chunks/chunk-G6PATS5E.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-LLNTHF5X.js +0 -2
|
@@ -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
|
@@ -170,7 +170,7 @@ export { readImprovementLedger, recordImprovementObservation, type ImprovementDi
|
|
|
170
170
|
export { evaluateProvenanceCoverage, projectFleetAttributionAnalytics, projectProvenanceCoverageAnalytics, readHistoryAnalyticsWindow, runFleetAttributionAnalytics, runProvenanceCoverageAnalytics, type FleetAttributionAnalytics, type FleetAttributionDimension, type FleetAttributionRow, type HistoryAnalyticsWindowOptions, type HistoryAnalyticsWindowReceipt, type HistoryAnalyticsEvent, type HistoryAnalyticsWindow, type ProvenanceCoverageAnalytics, } from "./history-analytics.js";
|
|
171
171
|
export { DEFAULT_EVAL_QUERIES_RELATIVE_PATH, EVAL_QUERY_SET_CONTRACT, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, parseEvalQuerySet, runEval, type EvalOptions, type EvalQueryReport, type EvalResult, } from "./eval.js";
|
|
172
172
|
export { runTelemetry, TELEMETRY_SUBCOMMANDS, type TelemetryCommandOptions, type TelemetryFlushResult, type TelemetryStatusSummary, type TelemetrySubcommand, } from "./telemetry.js";
|
|
173
|
-
export { classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, type LinkedTestFailureCategory, type TestCommandOptions, type TestResult, type TestRunResult, } from "./test/execution.js";
|
|
173
|
+
export { classifyLinkedTestCommandSafety, classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, type LinkedTestFailureCategory, type LinkedTestCommandSafetyClassification, type TestCommandOptions, type TestResult, type TestRunResult, } from "./test/execution.js";
|
|
174
174
|
export { TEST_RUN_MEASUREMENT_LIMIT, diffTestRunMeasurements, parseTestRunMeasurements, queryTestRunMeasurementsBelow, type TestRunMeasurementDiff, } from "./test/measurements.js";
|
|
175
175
|
export { runTestAll, type TestAllCommandOptions, type TestAllItemResult, type TestAllResult, } from "./test/batch.js";
|
|
176
176
|
export { LINKED_TEST_ENV_NAME_PATTERN, LINKED_TEST_PM_CONTEXT_MODE_VALUES, LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES, LINKED_TEST_PROTECTED_ENV_KEYS, parseLinkedTestAssertionEqualsMap, parseLinkedTestAssertionGteMap, parseLinkedTestBoolean, parseLinkedTestContextMode, parseLinkedTestEnvClear, parseLinkedTestEnvSet, parseLinkedTestJsonEntries, parseLinkedTestMinLines, parseLinkedTestRegexList, parseLinkedTestStringList, parseLinkedTestWorkspaceContextMode, type LinkedTestPmContextMode, type LinkedTestWorkspaceContextMode, } from "./test/parsers.js";
|
|
@@ -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";
|
|
@@ -161,7 +161,7 @@ export { readImprovementLedger, recordImprovementObservation, } from "./improvem
|
|
|
161
161
|
export { evaluateProvenanceCoverage, projectFleetAttributionAnalytics, projectProvenanceCoverageAnalytics, readHistoryAnalyticsWindow, runFleetAttributionAnalytics, runProvenanceCoverageAnalytics, } from "./history-analytics.js";
|
|
162
162
|
export { DEFAULT_EVAL_QUERIES_RELATIVE_PATH, EVAL_QUERY_SET_CONTRACT, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, parseEvalQuerySet, runEval, } from "./eval.js";
|
|
163
163
|
export { runTelemetry, TELEMETRY_SUBCOMMANDS, } from "./telemetry.js";
|
|
164
|
-
export { classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, } from "./test/execution.js";
|
|
164
|
+
export { classifyLinkedTestCommandSafety, classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, } from "./test/execution.js";
|
|
165
165
|
export { TEST_RUN_MEASUREMENT_LIMIT, diffTestRunMeasurements, parseTestRunMeasurements, queryTestRunMeasurementsBelow, } from "./test/measurements.js";
|
|
166
166
|
export { runTestAll, } from "./test/batch.js";
|
|
167
167
|
export { LINKED_TEST_ENV_NAME_PATTERN, LINKED_TEST_PM_CONTEXT_MODE_VALUES, LINKED_TEST_WORKSPACE_CONTEXT_MODE_VALUES, LINKED_TEST_PROTECTED_ENV_KEYS, parseLinkedTestAssertionEqualsMap, parseLinkedTestAssertionGteMap, parseLinkedTestBoolean, parseLinkedTestContextMode, parseLinkedTestEnvClear, parseLinkedTestEnvSet, parseLinkedTestJsonEntries, parseLinkedTestMinLines, parseLinkedTestRegexList, parseLinkedTestStringList, parseLinkedTestWorkspaceContextMode, } from "./test/parsers.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;
|