@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
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module mcp/legacy-adapter
|
|
3
3
|
*
|
|
4
|
-
* Isolates the bounded
|
|
4
|
+
* Isolates the bounded initialize-era stdio compatibility surface from the
|
|
5
5
|
* canonical stateless dispatcher. No modern transport imports policy from it.
|
|
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]="75228af6-d015-596d-ac32-4f5e78cb3916")}catch(e){}}();
|
|
9
9
|
import { PmCliError } from "../sdk/runtime-primitives.js";
|
|
10
10
|
import { PM_MCP_ERROR_CODES, PM_MCP_LEGACY_PROTOCOL_VERSIONS, PM_MCP_PROTOCOL_VERSION, PmMcpProtocolError, } from "../sdk/mcp/protocol.js";
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the legacy revision a handshake negotiates, or refuse with the full
|
|
13
|
+
* supported set.
|
|
14
|
+
*
|
|
15
|
+
* A legacy client has no fall-forward mechanism, so the refusal names every
|
|
16
|
+
* accepted legacy revision alongside the canonical modern one: the error text
|
|
17
|
+
* is the only diagnostic such a client can surface.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveLegacyProtocolVersion(requestedVersion) {
|
|
20
|
+
if (requestedVersion === undefined || requestedVersion === null) {
|
|
21
|
+
return PM_MCP_LEGACY_PROTOCOL_VERSIONS[0];
|
|
22
|
+
}
|
|
23
|
+
const accepted = PM_MCP_LEGACY_PROTOCOL_VERSIONS.find((candidate) => candidate === requestedVersion);
|
|
24
|
+
if (accepted)
|
|
25
|
+
return accepted;
|
|
26
|
+
throw new PmMcpProtocolError("Unsupported legacy MCP protocol version", PM_MCP_ERROR_CODES.unsupportedProtocolVersion, {
|
|
27
|
+
supported: [...PM_MCP_LEGACY_PROTOCOL_VERSIONS],
|
|
28
|
+
requested: requestedVersion,
|
|
29
|
+
modern: PM_MCP_PROTOCOL_VERSION,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
11
32
|
/** Explicit compatibility adapter with no cross-process or modern-session role. */
|
|
12
33
|
export class LegacyMcpAdapter {
|
|
13
34
|
#options;
|
|
@@ -23,17 +44,10 @@ export class LegacyMcpAdapter {
|
|
|
23
44
|
/** Validate and answer the historical initialize handshake. */
|
|
24
45
|
initialize(params) {
|
|
25
46
|
const requestedVersion = params?.protocolVersion;
|
|
26
|
-
|
|
27
|
-
!PM_MCP_LEGACY_PROTOCOL_VERSIONS.includes(requestedVersion)) {
|
|
28
|
-
throw new PmMcpProtocolError("Unsupported legacy MCP protocol version", PM_MCP_ERROR_CODES.unsupportedProtocolVersion, {
|
|
29
|
-
supported: [...PM_MCP_LEGACY_PROTOCOL_VERSIONS],
|
|
30
|
-
requested: requestedVersion,
|
|
31
|
-
modern: PM_MCP_PROTOCOL_VERSION,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
47
|
+
const negotiatedVersion = resolveLegacyProtocolVersion(requestedVersion);
|
|
34
48
|
this.#clientInfo = this.#options.parseClientInfo(params?.clientInfo);
|
|
35
49
|
return {
|
|
36
|
-
protocolVersion:
|
|
50
|
+
protocolVersion: negotiatedVersion,
|
|
37
51
|
capabilities: structuredClone(this.#options.capabilities),
|
|
38
52
|
serverInfo: { ...this.#options.serverInfo },
|
|
39
53
|
instructions: this.#options.instructions,
|
|
@@ -61,4 +75,4 @@ export class LegacyMcpAdapter {
|
|
|
61
75
|
}
|
|
62
76
|
}
|
|
63
77
|
//# sourceMappingURL=legacy-adapter.js.map
|
|
64
|
-
//# debugId=
|
|
78
|
+
//# debugId=75228af6-d015-596d-ac32-4f5e78cb3916
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -21,8 +21,8 @@ declare function nearestDeclaredKey(unexpected: string, declared: string[]): str
|
|
|
21
21
|
declare function detectUnexpectedTopLevelKeys(toolName: string, args: Record<string, unknown>, toolDeclaredKeys?: Map<string, string[]>): string[];
|
|
22
22
|
declare function collectMutationGuardWarnings(toolName: string, action: string | undefined, args: Record<string, unknown>): Promise<string[]>;
|
|
23
23
|
declare function detectUnexpectedOptionKeys(toolName: string, action: string | undefined, args: Record<string, unknown>): string[];
|
|
24
|
-
declare function resultContent(result: unknown, warnings?: string[], tokenAccounting?: boolean): Record<string, unknown>;
|
|
25
|
-
declare function errorContent(error: unknown): Record<string, unknown>;
|
|
24
|
+
declare function resultContent(result: unknown, warnings?: string[], tokenAccounting?: boolean, canonicalStructuredResult?: boolean): Record<string, unknown>;
|
|
25
|
+
declare function errorContent(error: unknown, canonicalStructuredResult?: boolean): Record<string, unknown>;
|
|
26
26
|
/** Retain at most 32 own, valid provenance values without cloning unbounded input. */
|
|
27
27
|
declare function boundMcpClientProvenance(value: unknown): Record<string, string>;
|
|
28
28
|
declare function emitMcpChangeNotifications(action: string | undefined): Promise<void>;
|
package/dist/mcp/server.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Runs the MCP server adapter that exposes pm actions and contracts to external agents.
|
|
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]="71cfdc6b-c990-51b6-a9ae-ed9bf98136f7")}catch(e){}}();
|
|
9
9
|
import { realpathSync } from "node:fs";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
@@ -17,6 +17,7 @@ import { readRequiredString, runAction, runWithActiveExtensions, } from "../sdk/
|
|
|
17
17
|
import { NARROW_TOOL_ACTIONS, TOOLS } from "./tool-definitions.js";
|
|
18
18
|
import { normalizeWorkspaceToolArguments, resolveMcpToolAccess, resolveMcpToolSurface, } from "./runtime-capabilities.js";
|
|
19
19
|
import { PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, } from "../sdk/agent-capability-contracts.js";
|
|
20
|
+
import { PM_MCP_ENTRY_TOOL_NAMES, PM_MCP_PROGRESSIVE_DISCOVERY_EXTENSION, PM_MCP_PROGRESSIVE_DISCOVERY_SERVER_CAPABILITY, discoverPmTools, parsePmToolDiscoveryOptions, } from "../sdk/mcp/discovery.js";
|
|
20
21
|
import { commitItemMutations } from "../sdk/item-transaction.js";
|
|
21
22
|
import { isRuntimeRecord, markMcpMutationTransportInput, } from "../sdk/runtime-input.js";
|
|
22
23
|
import { attachOutputTokenAccounting } from "../sdk/output-token-accounting.js";
|
|
@@ -59,6 +60,7 @@ const PM_MCP_SERVER_CAPABILITIES = {
|
|
|
59
60
|
[PM_MCP_TASKS_EXTENSION]: {},
|
|
60
61
|
[PM_MCP_APPS_EXTENSION]: PM_MCP_APPS_SERVER_CAPABILITY,
|
|
61
62
|
[PM_MCP_SKILLS_EXTENSION]: PM_MCP_SKILLS_SERVER_CAPABILITY,
|
|
63
|
+
[PM_MCP_PROGRESSIVE_DISCOVERY_EXTENSION]: PM_MCP_PROGRESSIVE_DISCOVERY_SERVER_CAPABILITY,
|
|
62
64
|
},
|
|
63
65
|
};
|
|
64
66
|
const PM_MCP_SUBSCRIPTIONS = new Map();
|
|
@@ -99,6 +101,7 @@ const PM_MCP_SKILL_METHODS = new Set([
|
|
|
99
101
|
"resources/directory/read",
|
|
100
102
|
]);
|
|
101
103
|
const PM_MCP_INSTRUCTIONS = "You have access to native pm CLI tools for git-based project management. " +
|
|
104
|
+
"When progressive discovery is negotiated, use pm_discover to expand the small entry catalog by intent and request schemas only when needed. " +
|
|
102
105
|
"Use pm_next to pick the next actionable item, or pm_context or pm_search before creating new work. " +
|
|
103
106
|
"Prefer narrow tools (pm_next, pm_context, pm_list, pm_get, pm_search, pm_events, pm_create, pm_mutate, pm_copy, pm_focus, pm_update, pm_append, pm_claim, pm_release, pm_close, pm_comments, pm_files, pm_docs, pm_notes, pm_learnings, pm_deps, pm_graph, pm_test, pm_validate, pm_health, pm_contracts, pm_schema, pm_profile, pm_config, pm_plan) over pm_run when they cover the operation. " +
|
|
104
107
|
"Use pm_plan for agent harness Plan workflows: it provides Codex/Claude/Cursor-style planning with durable steps, dependencies, decisions, discoveries, validation, and materialization. " +
|
|
@@ -145,6 +148,17 @@ function nearestDeclaredKey(unexpected, declared) {
|
|
|
145
148
|
// keys there are by-design rather than typos and must not be flagged.
|
|
146
149
|
const UNEXPECTED_KEY_WARNING_EXEMPT_TOOLS = new Set(["pm_run"]);
|
|
147
150
|
const MCP_RETRY_ARGUMENT_KEYS = new Set(["inputResponses", "requestState"]);
|
|
151
|
+
/** Resolve the optional shared cursor key without exposing it to tool input. */
|
|
152
|
+
function resolveMcpDiscoveryCursorIntegrityKey() {
|
|
153
|
+
const configuredKey = process.env.PM_MCP_DISCOVERY_CURSOR_KEY;
|
|
154
|
+
if (configuredKey === undefined)
|
|
155
|
+
return undefined;
|
|
156
|
+
const key = Buffer.from(configuredKey, "utf8");
|
|
157
|
+
if (key.byteLength < 32) {
|
|
158
|
+
throw new PmCliError("PM_MCP_DISCOVERY_CURSOR_KEY must contain at least 32 UTF-8 bytes.", 64);
|
|
159
|
+
}
|
|
160
|
+
return key;
|
|
161
|
+
}
|
|
148
162
|
function detectUnexpectedTopLevelKeys(toolName, args, toolDeclaredKeys = declaredToolKeys()) {
|
|
149
163
|
if (typeof args !== "object" || args === null || Array.isArray(args)) {
|
|
150
164
|
return [];
|
|
@@ -171,6 +185,29 @@ function detectUnexpectedTopLevelKeys(toolName, args, toolDeclaredKeys = declare
|
|
|
171
185
|
}
|
|
172
186
|
const HANDLERS = {
|
|
173
187
|
pm_run: (args) => runMcpAction(args),
|
|
188
|
+
pm_discover: async (args) => {
|
|
189
|
+
const surface = await resolveMcpToolSurface(TOOLS, args);
|
|
190
|
+
const cursorIntegrityKey = resolveMcpDiscoveryCursorIntegrityKey();
|
|
191
|
+
const discoveryOptions = parsePmToolDiscoveryOptions(args);
|
|
192
|
+
return discoverPmTools(surface.tools.map((tool) => ({
|
|
193
|
+
name: tool.name,
|
|
194
|
+
description: tool.description,
|
|
195
|
+
inputSchema: tool.inputSchema,
|
|
196
|
+
authorized: true,
|
|
197
|
+
signals: {
|
|
198
|
+
freshness: 1,
|
|
199
|
+
usage: PM_MCP_ENTRY_TOOL_NAMES.includes(tool.name) ? 1 : 0,
|
|
200
|
+
},
|
|
201
|
+
})), {
|
|
202
|
+
...discoveryOptions,
|
|
203
|
+
profile: surface.profile,
|
|
204
|
+
...(cursorIntegrityKey === undefined
|
|
205
|
+
? {}
|
|
206
|
+
: {
|
|
207
|
+
cursorIntegrityKey,
|
|
208
|
+
}),
|
|
209
|
+
});
|
|
210
|
+
},
|
|
174
211
|
pm_mutate: async (args) => {
|
|
175
212
|
const transactionId = readRequiredString(args, "transactionId");
|
|
176
213
|
const controls = parseAtomicMutationControls(args);
|
|
@@ -279,7 +316,7 @@ function detectUnexpectedOptionKeys(toolName, action, args) {
|
|
|
279
316
|
}
|
|
280
317
|
return warnings;
|
|
281
318
|
}
|
|
282
|
-
function resultContent(result, warnings, tokenAccounting = false) {
|
|
319
|
+
function resultContent(result, warnings, tokenAccounting = false, canonicalStructuredResult = false) {
|
|
283
320
|
const effectiveResult = tokenAccounting
|
|
284
321
|
? attachOutputTokenAccounting(result, (value) => JSON.stringify(value, null, 2))
|
|
285
322
|
: result;
|
|
@@ -292,13 +329,15 @@ function resultContent(result, warnings, tokenAccounting = false) {
|
|
|
292
329
|
content: [
|
|
293
330
|
{
|
|
294
331
|
type: "text",
|
|
295
|
-
text:
|
|
332
|
+
text: canonicalStructuredResult
|
|
333
|
+
? "Canonical result: structuredContent.result"
|
|
334
|
+
: JSON.stringify(effectiveResult, null, 2),
|
|
296
335
|
},
|
|
297
336
|
],
|
|
298
337
|
structuredContent,
|
|
299
338
|
};
|
|
300
339
|
}
|
|
301
|
-
function errorContent(error) {
|
|
340
|
+
function errorContent(error, canonicalStructuredResult = false) {
|
|
302
341
|
const code = error instanceof PmCliError ? error.exitCode : 1;
|
|
303
342
|
const message = error instanceof Error ? error.message : String(error);
|
|
304
343
|
const details = error instanceof PmCliError ? error.context : undefined;
|
|
@@ -307,7 +346,9 @@ function errorContent(error) {
|
|
|
307
346
|
content: [
|
|
308
347
|
{
|
|
309
348
|
type: "text",
|
|
310
|
-
text:
|
|
349
|
+
text: canonicalStructuredResult
|
|
350
|
+
? "Canonical error: structuredContent"
|
|
351
|
+
: JSON.stringify({ error: message, code, details }, null, 2),
|
|
311
352
|
},
|
|
312
353
|
],
|
|
313
354
|
// Keep `result` present on the error envelope so consumers can read
|
|
@@ -369,7 +410,7 @@ async function emitMcpChangeNotifications(action) {
|
|
|
369
410
|
}
|
|
370
411
|
pruneClosedMcpSubscriptionRegistries();
|
|
371
412
|
}
|
|
372
|
-
async function handleToolCall(paramsInput, clientInfo) {
|
|
413
|
+
async function handleToolCall(paramsInput, clientInfo, progressiveDiscoveryNegotiated = false) {
|
|
373
414
|
return runWithHarnessDetectionSignals({
|
|
374
415
|
env: process.env,
|
|
375
416
|
argv: process.argv,
|
|
@@ -386,6 +427,7 @@ async function handleToolCall(paramsInput, clientInfo) {
|
|
|
386
427
|
const inputResponses = params.inputResponses === undefined
|
|
387
428
|
? undefined
|
|
388
429
|
: parseMcpInputResponses(params.inputResponses);
|
|
430
|
+
validateMcpToolArguments(params.arguments);
|
|
389
431
|
const requestedArgs = {
|
|
390
432
|
...decodeHtmlEntitiesInOptions(asRecordClone(params.arguments)),
|
|
391
433
|
...(inputResponses ? { inputResponses } : {}),
|
|
@@ -394,7 +436,10 @@ async function handleToolCall(paramsInput, clientInfo) {
|
|
|
394
436
|
: {}),
|
|
395
437
|
};
|
|
396
438
|
const access = await resolveMcpToolAccess(TOOLS, name, requestedArgs);
|
|
397
|
-
|
|
439
|
+
const requiredCustomDiscoveryEntry = progressiveDiscoveryNegotiated &&
|
|
440
|
+
access.profile === "custom" &&
|
|
441
|
+
name === "pm_discover";
|
|
442
|
+
if (!access.available && !requiredCustomDiscoveryEntry) {
|
|
398
443
|
throw new PmCliError(`pm MCP tool "${name}" is unavailable in the ${access.profile} profile.`, 64);
|
|
399
444
|
}
|
|
400
445
|
// pm-ydkl: defensive HTML-entity decode for free-text fields. Claude / the
|
|
@@ -426,7 +471,7 @@ async function handleToolCall(paramsInput, clientInfo) {
|
|
|
426
471
|
// so the chdir/restore is exclusive per request and cannot race a concurrent caller.
|
|
427
472
|
const result = await handler(args);
|
|
428
473
|
void emitMcpChangeNotifications(action);
|
|
429
|
-
return resultContent(result, warnings, args.tokenAccounting === true);
|
|
474
|
+
return resultContent(result, warnings, args.tokenAccounting === true, progressiveDiscoveryNegotiated);
|
|
430
475
|
}, { probesEnabled: workspaceIdentity?.probes_enabled });
|
|
431
476
|
});
|
|
432
477
|
}
|
|
@@ -484,7 +529,8 @@ export function buildMcpToolCallErrorResult(request, error) {
|
|
|
484
529
|
if (request.method !== "tools/call" || error instanceof PmMcpProtocolError) {
|
|
485
530
|
return undefined;
|
|
486
531
|
}
|
|
487
|
-
const content = errorContent(error)
|
|
532
|
+
const content = errorContent(error, hasMcpProtocolVersionMetadata(request) &&
|
|
533
|
+
hasMcpClientExtension(resolveMcpRequestContext(request.params), PM_MCP_PROGRESSIVE_DISCOVERY_EXTENSION));
|
|
488
534
|
return hasMcpProtocolVersionMetadata(request)
|
|
489
535
|
? buildMcpCompleteResult(content, PM_MCP_SERVER_INFO)
|
|
490
536
|
: content;
|
|
@@ -607,6 +653,12 @@ function mcpTaskStore() {
|
|
|
607
653
|
owner: "pm-mcp-task-provider",
|
|
608
654
|
});
|
|
609
655
|
}
|
|
656
|
+
/** Rejects malformed MCP tool argument containers before dispatch. */
|
|
657
|
+
function validateMcpToolArguments(value) {
|
|
658
|
+
if (value !== undefined && !isMcpRecord(value)) {
|
|
659
|
+
throw new PmCliError("pm MCP tool arguments must be an object.", 64);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
610
662
|
function shouldCreateMcpTask(params, requestContext) {
|
|
611
663
|
if (!hasMcpClientExtension(requestContext, PM_MCP_TASKS_EXTENSION)) {
|
|
612
664
|
return false;
|
|
@@ -633,7 +685,7 @@ async function executeMcpTask(execution, inputResponses) {
|
|
|
633
685
|
...(execution.requestState ? { requestState: execution.requestState } : {}),
|
|
634
686
|
};
|
|
635
687
|
try {
|
|
636
|
-
const result = await handleToolCall(params, execution.context.clientInfo);
|
|
688
|
+
const result = await handleToolCall(params, execution.context.clientInfo, hasMcpClientExtension(execution.context, PM_MCP_PROGRESSIVE_DISCOVERY_EXTENSION));
|
|
637
689
|
await execution.store.complete(execution.taskId, execution.principal, buildMcpCompleteResult(result, PM_MCP_SERVER_INFO));
|
|
638
690
|
PENDING_MCP_TASKS.delete(execution.taskId);
|
|
639
691
|
}
|
|
@@ -657,7 +709,7 @@ async function executeMcpTask(execution, inputResponses) {
|
|
|
657
709
|
});
|
|
658
710
|
}
|
|
659
711
|
else {
|
|
660
|
-
await execution.store.complete(execution.taskId, execution.principal, buildMcpCompleteResult(errorContent(error), PM_MCP_SERVER_INFO));
|
|
712
|
+
await execution.store.complete(execution.taskId, execution.principal, buildMcpCompleteResult(errorContent(error, hasMcpClientExtension(execution.context, PM_MCP_PROGRESSIVE_DISCOVERY_EXTENSION)), PM_MCP_SERVER_INFO));
|
|
661
713
|
}
|
|
662
714
|
PENDING_MCP_TASKS.delete(execution.taskId);
|
|
663
715
|
}
|
|
@@ -726,17 +778,28 @@ async function dispatchMcpTaskMethod(request, requestContext) {
|
|
|
726
778
|
async function dispatchModernToolMethod(request, requestContext, clientInfo) {
|
|
727
779
|
if (request.method === "tools/list") {
|
|
728
780
|
const surface = await resolveMcpToolSurface(TOOLS, requestWorkspaceArgs(request.params));
|
|
781
|
+
const progressiveDiscovery = hasMcpClientExtension(requestContext, PM_MCP_PROGRESSIVE_DISCOVERY_EXTENSION);
|
|
782
|
+
const listedTools = progressiveDiscovery
|
|
783
|
+
? [
|
|
784
|
+
...surface.tools.filter((tool) => PM_MCP_ENTRY_TOOL_NAMES.includes(tool.name)),
|
|
785
|
+
...(surface.profile === "custom" &&
|
|
786
|
+
!surface.tools.some((tool) => tool.name === "pm_discover")
|
|
787
|
+
? TOOLS.filter((tool) => tool.name === "pm_discover")
|
|
788
|
+
: []),
|
|
789
|
+
]
|
|
790
|
+
: surface.tools;
|
|
729
791
|
return buildMcpCompleteResult(withMcpCachePolicy({
|
|
730
792
|
tools: hasCompatiblePmMcpAppsCapability(requestContext)
|
|
731
|
-
? decoratePmMcpToolsWithApps(deterministicMcpTools(
|
|
732
|
-
: deterministicMcpTools(
|
|
793
|
+
? decoratePmMcpToolsWithApps(deterministicMcpTools(listedTools))
|
|
794
|
+
: deterministicMcpTools(listedTools),
|
|
733
795
|
}, PM_MCP_CACHE_POLICIES.tools), PM_MCP_SERVER_INFO);
|
|
734
796
|
}
|
|
797
|
+
validateMcpToolArguments(request.params?.arguments);
|
|
735
798
|
if (shouldCreateMcpTask(request.params, requestContext)) {
|
|
736
799
|
return createMcpTaskForToolCall(request.params, requestContext);
|
|
737
800
|
}
|
|
738
801
|
try {
|
|
739
|
-
return buildMcpCompleteResult(await handleToolCall(request.params, clientInfo), PM_MCP_SERVER_INFO);
|
|
802
|
+
return buildMcpCompleteResult(await handleToolCall(request.params, clientInfo, hasMcpClientExtension(requestContext, PM_MCP_PROGRESSIVE_DISCOVERY_EXTENSION)), PM_MCP_SERVER_INFO);
|
|
740
803
|
}
|
|
741
804
|
catch (error) {
|
|
742
805
|
if (!(error instanceof PmMcpInputRequiredError))
|
|
@@ -1162,4 +1225,4 @@ if (isInvokedAsMcpMainModule(process.argv[1], import.meta.url)) {
|
|
|
1162
1225
|
}
|
|
1163
1226
|
/* c8 ignore stop */
|
|
1164
1227
|
//# sourceMappingURL=server.js.map
|
|
1165
|
-
//# debugId=
|
|
1228
|
+
//# debugId=71cfdc6b-c990-51b6-a9ae-ed9bf98136f7
|
|
@@ -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
|
|
@@ -207,6 +207,8 @@ export declare const GRAPH_FLAG_CONTRACTS: CliFlagContract[];
|
|
|
207
207
|
export declare const EVAL_FLAG_CONTRACTS: CliFlagContract[];
|
|
208
208
|
/** Public contract for guarded portable workspace snapshot command paths. */
|
|
209
209
|
export declare const WORKSPACE_FLAG_CONTRACTS: CliFlagContract[];
|
|
210
|
+
/** Flagless bounded workspace position read. */
|
|
211
|
+
export declare const WORKSPACE_POSITION_FLAG_CONTRACTS: CliFlagContract[];
|
|
210
212
|
/** Public contract for next flag contracts, shared by SDK and presentation-layer consumers. */
|
|
211
213
|
export declare const NEXT_FLAG_CONTRACTS: CliFlagContract[];
|
|
212
214
|
/** Public contract for search flag contracts, shared by SDK and presentation-layer consumers. */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
10
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="789faf62-dfbf-56ff-9412-55adc5c12d3d")}catch(e){}}();
|
|
11
11
|
import { normalizeUniqueStringList } from "./string-lists.js";
|
|
12
12
|
import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
|
|
13
13
|
import { PM_POSITIONAL_ACTION_CONTRACTS, } from "./grammar-contracts.js";
|
|
@@ -1555,6 +1555,8 @@ export const WORKSPACE_FLAG_CONTRACTS = [
|
|
|
1555
1555
|
{ flag: "--author" },
|
|
1556
1556
|
{ flag: "--message" },
|
|
1557
1557
|
];
|
|
1558
|
+
/** Flagless bounded workspace position read. */
|
|
1559
|
+
export const WORKSPACE_POSITION_FLAG_CONTRACTS = [];
|
|
1558
1560
|
/** Public contract for next flag contracts, shared by SDK and presentation-layer consumers. */
|
|
1559
1561
|
export const NEXT_FLAG_CONTRACTS = [
|
|
1560
1562
|
{ flag: "--for", value_name: "intent" },
|
|
@@ -1709,6 +1711,7 @@ const ASSURANCE_FLAG_CONTRACT_INDEX = indexCliFlagContracts(ASSURANCE_FLAG_CONTR
|
|
|
1709
1711
|
const POSITIONAL_ACTION_FLAG_INDEX_BY_PARENT = new Map([
|
|
1710
1712
|
["assurance", ASSURANCE_FLAG_CONTRACT_INDEX],
|
|
1711
1713
|
["plan", PLAN_FLAG_CONTRACT_INDEX],
|
|
1714
|
+
["workspace", indexCliFlagContracts(WORKSPACE_POSITION_FLAG_CONTRACTS)],
|
|
1712
1715
|
["workspace snapshot", indexCliFlagContracts(WORKSPACE_FLAG_CONTRACTS)],
|
|
1713
1716
|
]);
|
|
1714
1717
|
/** Resolve every positional action's accepted flags against one parent contract. */
|
|
@@ -1770,6 +1773,7 @@ const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND = new Map([
|
|
|
1770
1773
|
["next", NEXT_FLAG_CONTRACTS],
|
|
1771
1774
|
["eval", EVAL_FLAG_CONTRACTS],
|
|
1772
1775
|
["workspace", WORKSPACE_FLAG_CONTRACTS],
|
|
1776
|
+
["workspace position", WORKSPACE_POSITION_FLAG_CONTRACTS],
|
|
1773
1777
|
["workspace snapshot", WORKSPACE_FLAG_CONTRACTS],
|
|
1774
1778
|
["workspace snapshot create", WORKSPACE_FLAG_CONTRACTS],
|
|
1775
1779
|
["workspace snapshot list", WORKSPACE_FLAG_CONTRACTS],
|
|
@@ -1915,4 +1919,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
|
|
|
1915
1919
|
return normalizeUniqueStringList(all).join(" ");
|
|
1916
1920
|
}
|
|
1917
1921
|
//# sourceMappingURL=flag-contracts.js.map
|
|
1918
|
-
//# debugId=
|
|
1922
|
+
//# debugId=789faf62-dfbf-56ff-9412-55adc5c12d3d
|
|
@@ -53,7 +53,7 @@ export interface PmCommandPositionalContract {
|
|
|
53
53
|
/** Discoverable positional action projected through help, contracts, and completion. */
|
|
54
54
|
export interface PmPositionalActionContract extends PmCommandPositionalContract {
|
|
55
55
|
/** Commander command that dispatches the action positionally. */
|
|
56
|
-
parent: "assurance" | "plan" | "workspace snapshot";
|
|
56
|
+
parent: "assurance" | "plan" | "workspace" | "workspace snapshot";
|
|
57
57
|
/** Literal action token accepted in the parent's first positional slot. */
|
|
58
58
|
action: string;
|
|
59
59
|
/** Canonical flags applicable to this action-specific view. */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* cannot silently bypass the architecture decision.
|
|
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]="4efc5934-7d1b-517b-8b5e-eb2fe14379f2")}catch(e){}}();
|
|
11
11
|
import { resolvePmCommandAlias, } from "./command-aliases.js";
|
|
12
12
|
/** Canonical top-level domains an agent must retain to route pm operations. */
|
|
13
13
|
export const PM_CLI_GRAMMAR_NOUNS = [
|
|
@@ -314,6 +314,15 @@ export const PM_POSITIONAL_ACTION_CONTRACTS = [
|
|
|
314
314
|
description: "Analyze bounded defect-recurrence risk for a proposed change.",
|
|
315
315
|
example: 'pm assurance risk --definition \'{"change":{"files":[]}}\'',
|
|
316
316
|
},
|
|
317
|
+
{
|
|
318
|
+
command: "workspace position",
|
|
319
|
+
parent: "workspace",
|
|
320
|
+
action: "position",
|
|
321
|
+
slots: [],
|
|
322
|
+
accepted_flags: [],
|
|
323
|
+
description: "Read bounded merge-fence, receipt, history-drift, and next-action readiness.",
|
|
324
|
+
example: "pm workspace position",
|
|
325
|
+
},
|
|
317
326
|
{
|
|
318
327
|
command: "workspace snapshot create",
|
|
319
328
|
parent: "workspace snapshot",
|
|
@@ -638,6 +647,7 @@ export const PM_COMMAND_DESTINATION_CONTRACTS = [
|
|
|
638
647
|
]),
|
|
639
648
|
...destinationRows("workspace", "workspace", "target_noun", "pm-pbyu", [
|
|
640
649
|
"workspace",
|
|
650
|
+
"workspace position",
|
|
641
651
|
"workspace snapshot",
|
|
642
652
|
"workspace snapshot create",
|
|
643
653
|
"workspace snapshot delete",
|
|
@@ -965,4 +975,4 @@ export function verifyPmCliGrammar(commands, aliases = [], destinations = PM_COM
|
|
|
965
975
|
};
|
|
966
976
|
}
|
|
967
977
|
//# sourceMappingURL=grammar-contracts.js.map
|
|
968
|
-
//# debugId=
|
|
978
|
+
//# debugId=4efc5934-7d1b-517b-8b5e-eb2fe14379f2
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm contracts 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]="1506e8bc-3350-5ef5-a40a-44509eb59317")}catch(e){}}();
|
|
8
8
|
import { EXIT_CODE, SETTINGS_DEFAULTS, PmCliError, activateExtensions, getActiveExtensionRegistrations, loadExtensions, pathExists, commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
|
|
9
9
|
import { buildMcpToolContracts, } from "../../mcp/tool-definitions.js";
|
|
10
10
|
import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, ASSURANCE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, ITEM_REOPEN_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_OUTPUT_DEGRADATION_STEPS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_DEPRECATED_TOOL_ACTIONS, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, PROFILE_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, EVAL_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, PM_COMMAND_ALIAS_CONTRACTS, PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS, resolvePmCommandOutputBudget, } from "../cli-contracts.js";
|
|
@@ -367,6 +367,7 @@ const CORE_COMMAND_FLAG_CONTRACT_ENTRIES = [
|
|
|
367
367
|
["search", SEARCH_FLAG_CONTRACTS],
|
|
368
368
|
["eval", EVAL_FLAG_CONTRACTS],
|
|
369
369
|
["workspace", WORKSPACE_FLAG_CONTRACTS],
|
|
370
|
+
["workspace position", []],
|
|
370
371
|
["workspace snapshot", WORKSPACE_FLAG_CONTRACTS],
|
|
371
372
|
["workspace snapshot create", WORKSPACE_FLAG_CONTRACTS],
|
|
372
373
|
["workspace snapshot list", WORKSPACE_FLAG_CONTRACTS],
|
|
@@ -2084,4 +2085,4 @@ export const _testOnlyContractsCommand = {
|
|
|
2084
2085
|
toRuntimeShortFlagToken,
|
|
2085
2086
|
};
|
|
2086
2087
|
//# sourceMappingURL=runtime-contracts.js.map
|
|
2087
|
-
//# debugId=
|
|
2088
|
+
//# debugId=1506e8bc-3350-5ef5-a40a-44509eb59317
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* consumers from a single source of truth.
|
|
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]="b81a68c1-565d-56f6-a0eb-35d2c737bdb7")}catch(e){}}();
|
|
11
11
|
import { normalizeUniqueStringList } from "./string-lists.js";
|
|
12
12
|
import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
|
|
13
13
|
import { TOOL_CREATE_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CONTEXT_OPTION_CONTRACTS, TOOL_ACTIVITY_OPTION_CONTRACTS, TOOL_LIST_FILTER_OPTION_CONTRACTS, TOOL_AGGREGATE_OPTION_CONTRACTS, TOOL_SEARCH_FILTER_OPTION_CONTRACTS, TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS, } from "./tool-option-contracts.js";
|
|
@@ -567,8 +567,9 @@ const PM_TOOL_ACTION_SCHEMA_CONTRACTS = {
|
|
|
567
567
|
],
|
|
568
568
|
},
|
|
569
569
|
workspace: {
|
|
570
|
-
required: ["subcommand"
|
|
570
|
+
required: ["subcommand"],
|
|
571
571
|
optional: [
|
|
572
|
+
"snapshotAction",
|
|
572
573
|
"name",
|
|
573
574
|
"target",
|
|
574
575
|
"dryRun",
|
|
@@ -578,6 +579,13 @@ const PM_TOOL_ACTION_SCHEMA_CONTRACTS = {
|
|
|
578
579
|
"lockTtlSeconds",
|
|
579
580
|
"lockWaitMs",
|
|
580
581
|
],
|
|
582
|
+
conditionalRequired: [
|
|
583
|
+
{
|
|
584
|
+
property: "subcommand",
|
|
585
|
+
value: "snapshot",
|
|
586
|
+
required: ["snapshotAction"],
|
|
587
|
+
},
|
|
588
|
+
],
|
|
581
589
|
},
|
|
582
590
|
meet: SCHEDULING_ACTION_SCHEMA_CONTRACT,
|
|
583
591
|
event: SCHEDULING_ACTION_SCHEMA_CONTRACT,
|
|
@@ -1629,4 +1637,4 @@ export const _testOnlyCliContracts = {
|
|
|
1629
1637
|
withFlagAliasMetadata,
|
|
1630
1638
|
};
|
|
1631
1639
|
//# sourceMappingURL=tool-schema.js.map
|
|
1632
|
-
//# debugId=
|
|
1640
|
+
//# debugId=b81a68c1-565d-56f6-a0eb-35d2c737bdb7
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Generated partition 2 of the exhaustive error-code catalog. */
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="41e6f81d-ccb5-546c-9b26-3b78027528b5")}catch(e){}}();
|
|
4
4
|
export const PM_ERROR_CODE_CATALOG_PART_2 = [
|
|
5
5
|
{
|
|
6
6
|
code: "missing_destination",
|
|
@@ -919,6 +919,18 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
|
|
|
919
919
|
canonical_code: "status_invalid",
|
|
920
920
|
aliases: [],
|
|
921
921
|
},
|
|
922
|
+
{
|
|
923
|
+
code: "status_lifecycle_role_required",
|
|
924
|
+
meaning: "Status lifecycle role required condition.",
|
|
925
|
+
stability: "provisional",
|
|
926
|
+
exit_code: 2,
|
|
927
|
+
class: "usage",
|
|
928
|
+
recovery: "Inspect the structured error guidance and retry the suggested command.",
|
|
929
|
+
sources: ["sdk/schema.ts"],
|
|
930
|
+
emitting_commands: ["*"],
|
|
931
|
+
canonical_code: "status_lifecycle_role_required",
|
|
932
|
+
aliases: [],
|
|
933
|
+
},
|
|
922
934
|
{
|
|
923
935
|
code: "stdin_json_invalid",
|
|
924
936
|
meaning: "Stdin json invalid condition.",
|
|
@@ -2162,4 +2174,4 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
|
|
|
2162
2174
|
},
|
|
2163
2175
|
];
|
|
2164
2176
|
//# sourceMappingURL=generated-error-code-catalog-part-2.js.map
|
|
2165
|
-
//# debugId=
|
|
2177
|
+
//# debugId=41e6f81d-ccb5-546c-9b26-3b78027528b5
|