@unbrained/pm-cli 2026.8.25 → 2026.8.27

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.
Files changed (206) hide show
  1. package/.agents/skills/HARNESS_COMPATIBILITY.md +32 -0
  2. package/.agents/skills/README.md +47 -0
  3. package/.agents/skills/pm-developer/SKILL.md +117 -0
  4. package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +49 -0
  5. package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +91 -0
  6. package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +72 -0
  7. package/.agents/skills/pm-developer/references/PROMPTS.md +17 -0
  8. package/.agents/skills/pm-developer/references/SCRIPTING_COMPOSITION.md +82 -0
  9. package/.agents/skills/pm-developer/references/TOKEN_BUDGETS.md +85 -0
  10. package/.agents/skills/pm-extensions/SKILL.md +106 -0
  11. package/.agents/skills/pm-extensions/references/AUTHORING.md +95 -0
  12. package/.agents/skills/pm-extensions/references/LIFECYCLE.md +40 -0
  13. package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +25 -0
  14. package/.agents/skills/pm-sdk/SKILL.md +107 -0
  15. package/.agents/skills/pm-sdk/references/DOMAIN_MODELING.md +78 -0
  16. package/.agents/skills/pm-sdk/references/INTEGRATION_CHECKLIST.md +31 -0
  17. package/.agents/skills/pm-sdk/references/PROMPTS.md +13 -0
  18. package/.agents/skills/pm-sdk/references/SURFACE_MAP.md +82 -0
  19. package/.agents/skills/pm-user/SKILL.md +111 -0
  20. package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +105 -0
  21. package/.agents/skills/pm-user/references/PROMPTS.md +17 -0
  22. package/.agents/skills/pm-user/references/WORKFLOWS.md +35 -0
  23. package/.claude-plugin/marketplace.json +2 -2
  24. package/CHANGELOG.md +58 -3
  25. package/README.md +8 -5
  26. package/dist/cli/commander-usage.js +11 -7
  27. package/dist/cli/error-guidance.js +3 -3
  28. package/dist/cli/help-content.d.ts +2 -0
  29. package/dist/cli/help-content.js +53 -17
  30. package/dist/cli/help-json-payload.d.ts +8 -2
  31. package/dist/cli/help-json-payload.js +46 -12
  32. package/dist/cli/main.js +52 -74
  33. package/dist/cli/register-annotations.js +27 -21
  34. package/dist/cli/register-setup.js +98 -57
  35. package/dist/cli-bundle/bundle-manifest.json +156 -156
  36. package/dist/cli-bundle/chunks/chunk-3OO3W6FW.js +202 -0
  37. package/dist/cli-bundle/chunks/chunk-52EKTW6V.js +3 -0
  38. package/dist/cli-bundle/chunks/{chunk-QLUORNIB.js → chunk-CVBBGWW5.js} +62 -44
  39. package/dist/cli-bundle/chunks/chunk-MFNTKMTI.js +13 -0
  40. package/dist/cli-bundle/chunks/chunk-OS27HHBN.js +35 -0
  41. package/dist/cli-bundle/chunks/chunk-QTO7USTH.js +2 -0
  42. package/dist/cli-bundle/chunks/{chunk-5I5RWIJC.js → chunk-R4ETAOJC.js} +2 -2
  43. package/dist/cli-bundle/chunks/{chunk-OWHNAR2B.js → chunk-SH6P7FXI.js} +2 -2
  44. package/dist/cli-bundle/chunks/chunk-SHMDY36D.js +8 -0
  45. package/dist/cli-bundle/chunks/{chunk-244MI4GS.js → chunk-SKXLJIEK.js} +60 -60
  46. package/dist/cli-bundle/chunks/chunk-TNX6HC54.js +3 -0
  47. package/dist/cli-bundle/chunks/{register-list-query-XVN2ZLI7.js → register-list-query-EUWM6VII.js} +2 -2
  48. package/dist/cli-bundle/chunks/{register-mutation-QCKAEGIJ.js → register-mutation-FD4HSAVU.js} +4 -4
  49. package/dist/cli-bundle/chunks/{register-operations-SDEAXE7E.js → register-operations-HRMNFEC3.js} +2 -2
  50. package/dist/cli-bundle/chunks/register-setup-33GNICLX.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/{chunk-IBZZZGK3.js → chunk-2AGZ5BRT.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/chunk-4BR5UU52.js +50 -0
  53. package/dist/cli-bundle/focused-chunks/{chunk-OHIHZ7HS.js → chunk-6GCRSLPG.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-OVJL6NZE.js → chunk-AD6ULRAF.js} +4 -4
  55. package/dist/cli-bundle/focused-chunks/{chunk-7YCDTCBC.js → chunk-AQ5IYEZZ.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-YO3ZF3FI.js → chunk-EKX37ZHA.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-N7W67YIG.js → chunk-FC2AXLB5.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-H5JZEIQV.js → chunk-HC7ODMH3.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-NOOZGIXP.js → chunk-HVQ22RC4.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-A644DUFQ.js → chunk-MEASX544.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-RAFKLNZX.js → chunk-MXTYGECH.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{chunk-2UIWOP3O.js → chunk-SUBSWYW3.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{chunk-VXWATRFL.js → chunk-XDPYBQCF.js} +9 -9
  64. package/dist/cli-bundle/focused-chunks/{chunk-XUQPEKRN.js → chunk-Y3JJXRVK.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-GQR3WH3F.js → chunk-Y5A7SJJ7.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/chunk-YHWHX6YY.js +2 -0
  67. package/dist/cli-bundle/focused-chunks/{chunk-ONYQCALA.js → chunk-YVVZ3LQ6.js} +6 -6
  68. package/dist/cli-bundle/focused-chunks/chunk-Z2USIBR2.js +5 -0
  69. package/dist/cli-bundle/main.js +15 -14
  70. package/dist/cli-bundle/sdk-authoring.js +1 -1
  71. package/dist/cli-bundle/sdk-contracts.js +2 -2
  72. package/dist/cli-bundle/sdk-core.js +31 -31
  73. package/dist/cli-bundle/sdk-governance.js +1 -1
  74. package/dist/cli-bundle/sdk-graph.js +1 -1
  75. package/dist/cli-bundle/sdk-merge.js +31 -31
  76. package/dist/cli-bundle/sdk-query.js +1 -1
  77. package/dist/cli-bundle/sdk-runtime.js +1 -1
  78. package/dist/cli-bundle/sdk-testing.js +1 -1
  79. package/dist/cli-bundle/sdk.js +32 -6
  80. package/dist/core/extensions/manifest-schema.d.ts +20 -0
  81. package/dist/core/extensions/manifest-schema.js +28 -10
  82. package/dist/core/governance/issue-codes.d.ts +11 -2
  83. package/dist/core/governance/issue-codes.js +29 -10
  84. package/dist/core/item/item-format.js +3 -3
  85. package/dist/core/store/item-store.js +12 -5
  86. package/dist/mcp/http-server.d.ts +60 -0
  87. package/dist/mcp/http-server.js +451 -0
  88. package/dist/mcp/legacy-adapter.d.ts +50 -0
  89. package/dist/mcp/legacy-adapter.js +64 -0
  90. package/dist/mcp/server.d.ts +42 -9
  91. package/dist/mcp/server.js +572 -59
  92. package/dist/mcp/tool-definitions.d.ts +2 -0
  93. package/dist/mcp/tool-definitions.js +2 -2
  94. package/dist/sdk/agent/closed-domain-contracts.d.ts +1 -1
  95. package/dist/sdk/agent/closed-domain-contracts.js +24 -2
  96. package/dist/sdk/agent/refusal-closure-census.d.ts +6 -2
  97. package/dist/sdk/agent/refusal-closure-census.js +16 -8
  98. package/dist/sdk/agent-capability-contracts.js +6 -2
  99. package/dist/sdk/cli-bootstrap.js +3 -2
  100. package/dist/sdk/cli-contracts/command-aliases.js +15 -2
  101. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -1
  102. package/dist/sdk/cli-contracts/enum-contracts.js +7 -2
  103. package/dist/sdk/cli-contracts/flag-contracts.js +9 -5
  104. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +3 -3
  105. package/dist/sdk/cli-contracts/grammar-contracts.js +24 -17
  106. package/dist/sdk/cli-contracts/runtime-contracts.js +13 -11
  107. package/dist/sdk/cli-contracts/tool-schema.js +18 -15
  108. package/dist/sdk/cli-contracts.d.ts +1 -1
  109. package/dist/sdk/cli-contracts.js +3 -3
  110. package/dist/sdk/cli-program.js +3 -2
  111. package/dist/sdk/completion.js +40 -13
  112. package/dist/sdk/compose.d.ts +4 -1
  113. package/dist/sdk/compose.js +23 -36
  114. package/dist/sdk/extension/author-manifest.d.ts +22 -0
  115. package/dist/sdk/extension/author-manifest.js +93 -0
  116. package/dist/sdk/extension.js +6 -3
  117. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +20 -5
  118. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +18 -3
  119. package/dist/sdk/governance/health.js +7 -2
  120. package/dist/sdk/governance/upgrade.d.ts +2 -0
  121. package/dist/sdk/governance/upgrade.js +30 -8
  122. package/dist/sdk/governance/validate.js +8 -6
  123. package/dist/sdk/guide-topics.js +6 -6
  124. package/dist/sdk/index.d.ts +10 -2
  125. package/dist/sdk/index.js +11 -3
  126. package/dist/sdk/mcp/apps.d.ts +70 -0
  127. package/dist/sdk/mcp/apps.js +154 -0
  128. package/dist/sdk/mcp/authorization.d.ts +134 -0
  129. package/dist/sdk/mcp/authorization.js +405 -0
  130. package/dist/sdk/mcp/interactions.d.ts +118 -0
  131. package/dist/sdk/mcp/interactions.js +337 -0
  132. package/dist/sdk/mcp/protocol.d.ts +142 -0
  133. package/dist/sdk/mcp/protocol.js +174 -0
  134. package/dist/sdk/mcp/skills.d.ts +127 -0
  135. package/dist/sdk/mcp/skills.js +390 -0
  136. package/dist/sdk/mcp/subscriptions.d.ts +65 -0
  137. package/dist/sdk/mcp/subscriptions.js +212 -0
  138. package/dist/sdk/mcp/tasks.d.ts +107 -0
  139. package/dist/sdk/mcp/tasks.js +431 -0
  140. package/dist/sdk/mcp/transport.d.ts +30 -0
  141. package/dist/sdk/mcp/transport.js +261 -0
  142. package/dist/sdk/merge/receipts.d.ts +16 -0
  143. package/dist/sdk/merge/receipts.js +9 -8
  144. package/dist/sdk/read-output-contracts.js +16 -3
  145. package/dist/sdk/runtime-action-aliases.js +7 -3
  146. package/dist/sdk/runtime-input.js +12 -4
  147. package/dist/sdk/runtime-primitives.d.ts +2 -2
  148. package/dist/sdk/runtime-primitives.js +4 -4
  149. package/dist/sdk/test/execution.d.ts +6 -0
  150. package/dist/sdk/test/execution.js +32 -3
  151. package/docs/AGENT_PROVENANCE_ADR.md +6 -4
  152. package/docs/AGENT_RUNTIME_PRIMITIVES.md +6 -5
  153. package/docs/CLAUDE_CODE_PLUGIN.md +12 -5
  154. package/docs/CLI_GRAMMAR.md +7 -1
  155. package/docs/COMMANDS.md +2 -2
  156. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +8 -0
  157. package/docs/EXTENSIONS.md +36 -36
  158. package/docs/MCP_2026_07_28.md +160 -0
  159. package/docs/MCP_2026_07_28_CONFORMANCE.md +30 -0
  160. package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +180 -0
  161. package/docs/MCP_SKILLS_AND_APPS.md +107 -0
  162. package/docs/QUICKSTART.md +15 -15
  163. package/docs/README.md +5 -0
  164. package/docs/RELEASING.md +12 -3
  165. package/docs/SDK.md +22 -1
  166. package/docs/SDK_AGENT_SESSION_CONTEXT.md +18 -13
  167. package/docs/SDK_CONTEXT_INTEGRITY.md +6 -0
  168. package/docs/SDK_EVIDENCE_TRACEABILITY.md +9 -1
  169. package/docs/SDK_MCP_INTERACTIONS.md +227 -0
  170. package/docs/TESTING.md +4 -0
  171. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
  172. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +13 -11
  173. package/marketplace.json +2 -2
  174. package/package.json +15 -11
  175. package/packages/pm-beads/README.md +12 -6
  176. package/packages/pm-beads/docs/MIGRATION.md +53 -0
  177. package/packages/pm-beads/extensions/beads/index.ts +8 -0
  178. package/packages/pm-beads/extensions/beads/runtime.ts +671 -112
  179. package/packages/pm-beads/package.json +1 -1
  180. package/packages/pm-calendar/package.json +1 -1
  181. package/packages/pm-command-kit/package.json +1 -1
  182. package/packages/pm-digital-twin/package.json +1 -1
  183. package/packages/pm-governance-audit/package.json +1 -1
  184. package/packages/pm-guide-shell/package.json +1 -1
  185. package/packages/pm-kanban/package.json +1 -1
  186. package/packages/pm-lifecycle-hooks/package.json +1 -1
  187. package/packages/pm-linked-test-adapters/package.json +1 -1
  188. package/packages/pm-search-advanced/package.json +1 -1
  189. package/packages/pm-templates/package.json +1 -1
  190. package/packages/pm-todos/package.json +1 -1
  191. package/packages/pm-vcs/package.json +1 -1
  192. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  193. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  194. package/scripts/finalize-build.mjs +1 -0
  195. package/sdk/public-surface.json +902 -54
  196. package/dist/cli-bundle/chunks/chunk-2F3LUFMW.js +0 -8
  197. package/dist/cli-bundle/chunks/chunk-65MHLHAA.js +0 -2
  198. package/dist/cli-bundle/chunks/chunk-6C7GIMIL.js +0 -13
  199. package/dist/cli-bundle/chunks/chunk-QKGMHGEI.js +0 -202
  200. package/dist/cli-bundle/chunks/chunk-T2ENPRXF.js +0 -3
  201. package/dist/cli-bundle/chunks/chunk-TPQIBSL2.js +0 -3
  202. package/dist/cli-bundle/chunks/chunk-YQMYF3YD.js +0 -35
  203. package/dist/cli-bundle/chunks/register-setup-LXVBRCJ3.js +0 -2
  204. package/dist/cli-bundle/focused-chunks/chunk-42S3GGZ7.js +0 -50
  205. package/dist/cli-bundle/focused-chunks/chunk-7I23XGWO.js +0 -2
  206. package/dist/cli-bundle/focused-chunks/chunk-LMKG3DFE.js +0 -5
@@ -0,0 +1,451 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @module mcp/http-server
4
+ *
5
+ * Serves the pm MCP dispatcher through the sessionless 2026-07-28 Streamable
6
+ * HTTP POST binding with request-scoped JSON/SSE responses.
7
+ */
8
+
9
+ !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]="7c5d2b34-e2ab-52a9-80a9-c5a28ce09dc7")}catch(e){}}();
10
+ import { createServer, } from "node:http";
11
+ import { PM_MCP_ERROR_CODES, PmMcpProtocolError } from "../sdk/mcp/protocol.js";
12
+ import { PmMcpAuthorizationError, authorizeMcpHttpRequest, buildMcpProtectedResourceMetadata, createMcpStaticBearerVerifier, } from "../sdk/mcp/authorization.js";
13
+ import { validateMcpHttpRequestHeaders } from "../sdk/mcp/transport.js";
14
+ import { buildMcpToolCallErrorResult, closeMcpSubscription, handleRequest, isInvokedAsMcpMainModule, openMcpSubscription, resolveMcpToolSchemaForRequest, } from "./server.js";
15
+ const DEFAULT_MAXIMUM_BODY_BYTES = 1024 * 1024;
16
+ const DEFAULT_KEEP_ALIVE_MS = 15_000;
17
+ const PM_MCP_HTTP_RUNTIMES = new WeakMap();
18
+ /** Write one SSE event and wait for transport backpressure to clear. */
19
+ export function writePmMcpSseEvent(response, payload) {
20
+ return new Promise((resolve, reject) => {
21
+ let settled = false;
22
+ const cleanup = () => {
23
+ response.off("drain", onDrain);
24
+ response.off("close", onClose);
25
+ };
26
+ const onDrain = () => {
27
+ settled = true;
28
+ cleanup();
29
+ resolve();
30
+ };
31
+ const onClose = () => {
32
+ settled = true;
33
+ cleanup();
34
+ reject(new Error("MCP response stream closed during backpressure"));
35
+ };
36
+ response.once("drain", onDrain);
37
+ response.once("close", onClose);
38
+ try {
39
+ if (response.write(`data: ${JSON.stringify(payload)}\n\n`) && !settled) {
40
+ settled = true;
41
+ cleanup();
42
+ resolve();
43
+ }
44
+ }
45
+ catch (error) {
46
+ cleanup();
47
+ reject(error);
48
+ }
49
+ });
50
+ }
51
+ function writeJson(response, status, payload, headers = {}) {
52
+ response.writeHead(status, {
53
+ "Cache-Control": "no-store",
54
+ "Content-Type": "application/json",
55
+ ...headers,
56
+ });
57
+ response.end(`${JSON.stringify(payload)}\n`);
58
+ }
59
+ function writeJsonRpcError(response, id, error) {
60
+ const authorizationError = error instanceof PmMcpAuthorizationError ? error : undefined;
61
+ const protocolError = error instanceof PmMcpProtocolError ? error : undefined;
62
+ const code = protocolError?.code ?? -32603;
63
+ const clientErrorCodes = new Set([
64
+ -32700,
65
+ -32600,
66
+ PM_MCP_ERROR_CODES.headerMismatch,
67
+ PM_MCP_ERROR_CODES.unsupportedProtocolVersion,
68
+ PM_MCP_ERROR_CODES.invalidParams,
69
+ ]);
70
+ const status = authorizationError?.httpStatus ??
71
+ (code === -32601 ? 404 : clientErrorCodes.has(code) ? 400 : 500);
72
+ writeJson(response, status, {
73
+ jsonrpc: "2.0",
74
+ id: id ?? null,
75
+ error: {
76
+ code,
77
+ message: error instanceof Error ? error.message : "Internal MCP error",
78
+ ...(protocolError ? { data: protocolError.data } : {}),
79
+ },
80
+ }, authorizationError?.challenge
81
+ ? { "WWW-Authenticate": authorizationError.challenge }
82
+ : {});
83
+ }
84
+ function finishCommittedMcpResponse(response) {
85
+ if (!response.headersSent && !response.writableEnded && !response.destroyed) {
86
+ return false;
87
+ }
88
+ if (!response.writableEnded && !response.destroyed)
89
+ response.end();
90
+ return true;
91
+ }
92
+ function writeMcpHttpDispatchError(response, rpcRequest, error) {
93
+ if (finishCommittedMcpResponse(response))
94
+ return;
95
+ const toolError = rpcRequest
96
+ ? buildMcpToolCallErrorResult(rpcRequest, error)
97
+ : undefined;
98
+ if (toolError && rpcRequest) {
99
+ writeJson(response, 200, {
100
+ jsonrpc: "2.0",
101
+ id: rpcRequest.id ?? null,
102
+ result: toolError,
103
+ });
104
+ return;
105
+ }
106
+ writeJsonRpcError(response, rpcRequest?.id, error);
107
+ }
108
+ function destroyFailedMcpHttpResponse(response, error) {
109
+ response.destroy(new Error("Unhandled MCP HTTP request failure", { cause: error }));
110
+ }
111
+ async function readRequestBody(request, maximumBytes) {
112
+ const chunks = [];
113
+ let observed = 0;
114
+ for await (const chunk of request) {
115
+ const buffer = Buffer.from(chunk);
116
+ observed += buffer.length;
117
+ if (observed > maximumBytes) {
118
+ throw new PmMcpProtocolError("MCP HTTP request body exceeds the configured limit", PM_MCP_ERROR_CODES.invalidParams, { maximumBytes });
119
+ }
120
+ chunks.push(buffer);
121
+ }
122
+ return Buffer.concat(chunks).toString("utf8");
123
+ }
124
+ function parseJsonRpcRequest(source) {
125
+ let value;
126
+ try {
127
+ value = JSON.parse(source);
128
+ }
129
+ catch {
130
+ throw new PmMcpProtocolError("Invalid JSON-RPC request body", -32700);
131
+ }
132
+ if (typeof value !== "object" ||
133
+ value === null ||
134
+ Array.isArray(value) ||
135
+ ("jsonrpc" in value && value.jsonrpc !== "2.0") ||
136
+ ("method" in value && typeof value.method !== "string")) {
137
+ throw new PmMcpProtocolError("Invalid JSON-RPC request", -32600);
138
+ }
139
+ return value;
140
+ }
141
+ function protectedResourcePaths(endpointPath) {
142
+ return new Set([
143
+ "/.well-known/oauth-protected-resource",
144
+ `/.well-known/oauth-protected-resource${endpointPath}`,
145
+ ]);
146
+ }
147
+ function routeMcpHttpBoundary(request, response, requestUrl, runtime) {
148
+ if (runtime.options.protectedResourceMetadata &&
149
+ request.method === "GET" &&
150
+ protectedResourcePaths(runtime.endpointPath).has(requestUrl.pathname)) {
151
+ writeJson(response, 200, { ...runtime.options.protectedResourceMetadata });
152
+ return true;
153
+ }
154
+ if (requestUrl.pathname !== runtime.endpointPath) {
155
+ writeJson(response, 404, { error: "Not found" });
156
+ return true;
157
+ }
158
+ if (request.method !== "POST") {
159
+ response.setHeader("Allow", "POST");
160
+ writeJson(response, 405, { error: "Method not allowed" });
161
+ return true;
162
+ }
163
+ const origin = request.headers.origin;
164
+ if (origin !== undefined && !runtime.allowedOrigins.has(origin)) {
165
+ writeJson(response, 403, { error: "Origin is not allowed" });
166
+ return true;
167
+ }
168
+ const accept = request.headers.accept;
169
+ const contentType = request.headers["content-type"];
170
+ if (typeof accept !== "string" ||
171
+ !accept.includes("application/json") ||
172
+ !accept.includes("text/event-stream") ||
173
+ typeof contentType !== "string" ||
174
+ !contentType.startsWith("application/json")) {
175
+ writeJson(response, 406, {
176
+ error: "MCP requires JSON and SSE content negotiation",
177
+ });
178
+ return true;
179
+ }
180
+ return false;
181
+ }
182
+ async function openHttpSubscription(input) {
183
+ if (typeof input.request.id !== "string" &&
184
+ typeof input.request.id !== "number") {
185
+ throw new PmMcpProtocolError("subscriptions/listen requires a JSON-RPC id", PM_MCP_ERROR_CODES.invalidParams);
186
+ }
187
+ const subscriptionId = input.request.id;
188
+ const subscriptionKey = Symbol("pm-mcp-http-subscription");
189
+ const active = {
190
+ id: subscriptionId,
191
+ key: subscriptionKey,
192
+ response: input.response,
193
+ };
194
+ let disconnected = input.response.destroyed || input.response.writableEnded;
195
+ let subscriptionOpened = false;
196
+ const closeActiveSubscription = () => {
197
+ disconnected = true;
198
+ if (active.timer)
199
+ clearInterval(active.timer);
200
+ input.runtime.activeSubscriptions.delete(subscriptionKey);
201
+ if (subscriptionOpened) {
202
+ closeMcpSubscription(subscriptionId, subscriptionKey);
203
+ }
204
+ };
205
+ input.response.once("close", closeActiveSubscription);
206
+ let responseStarted = false;
207
+ try {
208
+ await openMcpSubscription({
209
+ request: input.request,
210
+ key: subscriptionKey,
211
+ sink: (notification) => {
212
+ if (input.response.destroyed || input.response.writableEnded) {
213
+ throw new Error("MCP response stream closed before acknowledgment");
214
+ }
215
+ if (!responseStarted) {
216
+ responseStarted = true;
217
+ input.response.setHeader("Cache-Control", "no-cache, no-store");
218
+ input.response.setHeader("Connection", "keep-alive");
219
+ input.response.setHeader("Content-Type", "text/event-stream");
220
+ input.response.setHeader("X-Accel-Buffering", "no");
221
+ }
222
+ return writePmMcpSseEvent(input.response, notification);
223
+ },
224
+ });
225
+ subscriptionOpened = true;
226
+ }
227
+ catch (error) {
228
+ input.response.off("close", closeActiveSubscription);
229
+ throw error;
230
+ }
231
+ if (disconnected ||
232
+ input.response.destroyed ||
233
+ input.response.writableEnded) {
234
+ closeActiveSubscription();
235
+ return;
236
+ }
237
+ if (input.runtime.keepAliveMs > 0) {
238
+ active.timer = setInterval(() => input.response.write(":\r\n\r\n"), input.runtime.keepAliveMs);
239
+ active.timer.unref();
240
+ }
241
+ input.runtime.activeSubscriptions.set(subscriptionKey, active);
242
+ }
243
+ async function dispatchMcpHttpRpc(input) {
244
+ let rpcRequest;
245
+ try {
246
+ if (input.runtime.options.authorization) {
247
+ await authorizeMcpHttpRequest({
248
+ headers: input.request.headers,
249
+ requestUrl: input.requestUrl.href,
250
+ policy: input.runtime.options.authorization,
251
+ });
252
+ }
253
+ rpcRequest = parseJsonRpcRequest(await readRequestBody(input.request, input.runtime.maximumBodyBytes));
254
+ validateMcpHttpRequestHeaders({
255
+ headers: input.request.headers,
256
+ request: rpcRequest,
257
+ toolSchema: await resolveMcpToolSchemaForRequest(rpcRequest),
258
+ });
259
+ if (rpcRequest.method === "subscriptions/listen") {
260
+ await openHttpSubscription({
261
+ request: rpcRequest,
262
+ response: input.response,
263
+ runtime: input.runtime,
264
+ });
265
+ return;
266
+ }
267
+ const result = await (input.runtime.options.requestHandler ?? handleRequest)(rpcRequest);
268
+ if (!Object.prototype.hasOwnProperty.call(rpcRequest, "id")) {
269
+ input.response.writeHead(202);
270
+ input.response.end();
271
+ return;
272
+ }
273
+ writeJson(input.response, 200, {
274
+ jsonrpc: "2.0",
275
+ id: rpcRequest.id ?? null,
276
+ result: result ?? {},
277
+ });
278
+ }
279
+ catch (error) {
280
+ writeMcpHttpDispatchError(input.response, rpcRequest, error);
281
+ }
282
+ }
283
+ async function handleMcpHttpRequest(request, response, runtime) {
284
+ const requestUrl = new URL(request.url, "http://localhost");
285
+ if (routeMcpHttpBoundary(request, response, requestUrl, runtime))
286
+ return;
287
+ await dispatchMcpHttpRpc({ request, response, requestUrl, runtime });
288
+ }
289
+ /** Create a configured HTTP server without binding it. */
290
+ export function createPmMcpHttpServer(options = {}) {
291
+ const runtime = {
292
+ activeSubscriptions: new Map(),
293
+ allowedOrigins: new Set(options.allowedOrigins ?? []),
294
+ endpointPath: options.endpointPath ?? "/mcp",
295
+ keepAliveMs: options.keepAliveMs ?? DEFAULT_KEEP_ALIVE_MS,
296
+ maximumBodyBytes: options.maximumBodyBytes ?? DEFAULT_MAXIMUM_BODY_BYTES,
297
+ options,
298
+ };
299
+ const server = createServer((request, response) => {
300
+ void handleMcpHttpRequest(request, response, runtime).catch(destroyFailedMcpHttpResponse.bind(undefined, response));
301
+ });
302
+ PM_MCP_HTTP_RUNTIMES.set(server, runtime);
303
+ server.on("close", () => {
304
+ closeActiveHttpSubscriptions(runtime);
305
+ PM_MCP_HTTP_RUNTIMES.delete(server);
306
+ });
307
+ return server;
308
+ }
309
+ function closeActiveHttpSubscriptions(runtime) {
310
+ for (const [key, active] of runtime.activeSubscriptions) {
311
+ if (active.timer)
312
+ clearInterval(active.timer);
313
+ const result = closeMcpSubscription(active.id, key);
314
+ if (result) {
315
+ active.response.write(`data: ${JSON.stringify({ jsonrpc: "2.0", id: active.id, result })}\n\n`);
316
+ }
317
+ active.response.end();
318
+ }
319
+ runtime.activeSubscriptions.clear();
320
+ }
321
+ /** Gracefully close subscriptions before stopping a Streamable HTTP server. */
322
+ export async function closePmMcpHttpServer(server) {
323
+ const runtime = PM_MCP_HTTP_RUNTIMES.get(server);
324
+ if (runtime)
325
+ closeActiveHttpSubscriptions(runtime);
326
+ await new Promise((resolve, reject) => {
327
+ server.close((error) => (error ? reject(error) : resolve()));
328
+ });
329
+ server.closeAllConnections();
330
+ }
331
+ /** Bind the configured Streamable HTTP server and return its actual address. */
332
+ export async function startPmMcpHttpServer(options = {}) {
333
+ const server = createPmMcpHttpServer(options);
334
+ const address = resolvePmMcpHttpListenAddress(options);
335
+ await new Promise((resolve, reject) => {
336
+ server.once("error", reject);
337
+ server.listen(address.port, address.host, () => {
338
+ server.off("error", reject);
339
+ resolve();
340
+ });
341
+ });
342
+ return server;
343
+ }
344
+ /** Resolve loopback-safe bind defaults without opening a socket. */
345
+ export function resolvePmMcpHttpListenAddress(options = {}) {
346
+ return {
347
+ host: options.host ?? "127.0.0.1",
348
+ port: options.port ?? 3000,
349
+ };
350
+ }
351
+ function readMcpHttpEnvironment(environment) {
352
+ const configuredPort = environment.PM_MCP_HTTP_PORT?.trim();
353
+ const port = Number(configuredPort || "3000");
354
+ if (!Number.isInteger(port) || port < 0 || port > 65_535) {
355
+ throw new Error("PM_MCP_HTTP_PORT must be an integer from 0 through 65535");
356
+ }
357
+ return {
358
+ host: environment.PM_MCP_HTTP_HOST?.trim() || "127.0.0.1",
359
+ port,
360
+ allowedOrigins: (environment.PM_MCP_HTTP_ALLOWED_ORIGINS ?? "")
361
+ .split(",")
362
+ .map((entry) => entry.trim())
363
+ .filter(Boolean),
364
+ token: environment.PM_MCP_HTTP_BEARER_TOKEN?.trim() || undefined,
365
+ issuer: environment.PM_MCP_HTTP_AUTH_ISSUER?.trim() || undefined,
366
+ resource: environment.PM_MCP_HTTP_RESOURCE?.trim() || undefined,
367
+ scopes: (environment.PM_MCP_HTTP_SCOPES ?? "pm:read pm:write")
368
+ .split(/\s+/u)
369
+ .filter(Boolean),
370
+ };
371
+ }
372
+ function buildMcpHttpAuthorizationOptions(environment) {
373
+ const metadata = buildMcpProtectedResourceMetadata({
374
+ resource: environment.resource,
375
+ authorizationServers: [environment.issuer],
376
+ scopes: environment.scopes,
377
+ });
378
+ const acceptedIssuer = environment.issuer;
379
+ return {
380
+ protectedResourceMetadata: metadata,
381
+ authorization: {
382
+ issuer: acceptedIssuer,
383
+ resource: metadata.resource,
384
+ requiredScopes: environment.scopes,
385
+ resourceMetadataUrl: new URL("/.well-known/oauth-protected-resource", metadata.resource).href,
386
+ verifyAccessToken: createMcpStaticBearerVerifier({
387
+ token: environment.token,
388
+ claims: {
389
+ principal: "configured-remote-client",
390
+ issuer: acceptedIssuer,
391
+ audience: metadata.resource,
392
+ scopes: environment.scopes,
393
+ },
394
+ }),
395
+ },
396
+ };
397
+ }
398
+ function hasCompleteMcpHttpAuthorization(environment) {
399
+ return Boolean(environment.token && environment.issuer && environment.resource);
400
+ }
401
+ /** Resolve and harden executable HTTP options from an environment map. */
402
+ export function resolvePmMcpHttpServerOptionsFromEnvironment(processEnvironment = process.env) {
403
+ const environment = readMcpHttpEnvironment(processEnvironment);
404
+ const hasAuthorization = hasCompleteMcpHttpAuthorization(environment);
405
+ if (environment.host !== "127.0.0.1" &&
406
+ environment.host !== "localhost" &&
407
+ !hasAuthorization) {
408
+ throw new Error("Non-loopback MCP HTTP requires PM_MCP_HTTP_BEARER_TOKEN, PM_MCP_HTTP_AUTH_ISSUER, and PM_MCP_HTTP_RESOURCE");
409
+ }
410
+ const base = {
411
+ host: environment.host,
412
+ port: environment.port,
413
+ allowedOrigins: environment.allowedOrigins,
414
+ };
415
+ return hasAuthorization
416
+ ? {
417
+ ...base,
418
+ ...buildMcpHttpAuthorizationOptions({
419
+ issuer: environment.issuer,
420
+ resource: environment.resource,
421
+ token: environment.token,
422
+ scopes: environment.scopes,
423
+ }),
424
+ }
425
+ : base;
426
+ }
427
+ /** Internal HTTP transport seams used only by direct integration tests. */
428
+ export const _testOnly = {
429
+ /** Return the first active request-scoped transport key for one server. */
430
+ activeSubscriptionKey: (server) => PM_MCP_HTTP_RUNTIMES.get(server).activeSubscriptions.keys().next().value,
431
+ /** Open a stream against one server runtime without a network socket. */
432
+ openHttpSubscription: (server, request, response) => openHttpSubscription({
433
+ request,
434
+ response,
435
+ runtime: PM_MCP_HTTP_RUNTIMES.get(server),
436
+ }),
437
+ /** Exercise committed-response handling without a network race. */
438
+ writeMcpHttpDispatchError,
439
+ /** Exercise the terminal request rejection handler without a live socket. */
440
+ destroyFailedMcpHttpResponse,
441
+ };
442
+ /* c8 ignore start -- executable guard and process lifecycle are integration-tested */
443
+ if (isInvokedAsMcpMainModule(process.argv[1], import.meta.url)) {
444
+ startPmMcpHttpServer(resolvePmMcpHttpServerOptionsFromEnvironment()).catch((error) => {
445
+ console.error(error instanceof Error ? error.message : String(error));
446
+ process.exit(1);
447
+ });
448
+ }
449
+ /* c8 ignore stop */
450
+ //# sourceMappingURL=http-server.js.map
451
+ //# debugId=7c5d2b34-e2ab-52a9-80a9-c5a28ce09dc7
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @module mcp/legacy-adapter
3
+ *
4
+ * Isolates the bounded MCP 2025-06-18 stdio compatibility surface from the
5
+ * canonical stateless dispatcher. No modern transport imports policy from it.
6
+ */
7
+ import { type AgentClientInfo } from "../sdk/runtime-primitives.js";
8
+ import { type PmMcpImplementation, type PmMcpServerCapabilities } from "../sdk/mcp/protocol.js";
9
+ /** Minimal request shape consumed by the compatibility adapter. */
10
+ export interface LegacyMcpRequest {
11
+ /** Legacy method name. */
12
+ method?: string;
13
+ /** Legacy method parameters. */
14
+ params?: Record<string, unknown>;
15
+ }
16
+ /** Host callbacks keep this adapter separate from canonical SDK policy. */
17
+ export interface LegacyMcpAdapterOptions {
18
+ /** Immutable server identity. */
19
+ serverInfo: PmMcpImplementation;
20
+ /** Compatibility-era capabilities. */
21
+ capabilities: PmMcpServerCapabilities;
22
+ /** Model-facing usage instructions. */
23
+ instructions: string;
24
+ /** Parse bounded historical client identity. */
25
+ parseClientInfo: (value: unknown) => AgentClientInfo | undefined;
26
+ /** Resolve legacy tool definitions. */
27
+ listTools: (params: Record<string, unknown> | undefined) => Promise<Record<string, unknown>>;
28
+ /** Execute one legacy tool call. */
29
+ callTool: (params: Record<string, unknown> | undefined, clientInfo: AgentClientInfo | undefined) => Promise<Record<string, unknown>>;
30
+ /** List legacy resources. */
31
+ listResources: () => Record<string, unknown>;
32
+ /** Read one legacy resource. */
33
+ readResource: (params: Record<string, unknown> | undefined) => Promise<Record<string, unknown>>;
34
+ /** List legacy prompts. */
35
+ listPrompts: () => Record<string, unknown>;
36
+ /** Render one legacy prompt. */
37
+ getPrompt: (params: Record<string, unknown> | undefined) => Record<string, unknown>;
38
+ }
39
+ /** Explicit compatibility adapter with no cross-process or modern-session role. */
40
+ export declare class LegacyMcpAdapter {
41
+ #private;
42
+ /** Create one process-local legacy stdio adapter. */
43
+ constructor(options: LegacyMcpAdapterOptions);
44
+ /** Read the bounded identity most recently supplied to legacy initialize. */
45
+ getClientInfo(): AgentClientInfo | undefined;
46
+ /** Validate and answer the historical initialize handshake. */
47
+ initialize(params: Record<string, unknown> | undefined): Record<string, unknown>;
48
+ /** Dispatch one unversioned request through the finite legacy method set. */
49
+ dispatch(request: LegacyMcpRequest): Promise<Record<string, unknown>>;
50
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @module mcp/legacy-adapter
3
+ *
4
+ * Isolates the bounded MCP 2025-06-18 stdio compatibility surface from the
5
+ * canonical stateless dispatcher. No modern transport imports policy from it.
6
+ */
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]="6a1d9bca-7dac-5537-9930-a12d8049c8b8")}catch(e){}}();
9
+ import { PmCliError } from "../sdk/runtime-primitives.js";
10
+ import { PM_MCP_ERROR_CODES, PM_MCP_LEGACY_PROTOCOL_VERSIONS, PM_MCP_PROTOCOL_VERSION, PmMcpProtocolError, } from "../sdk/mcp/protocol.js";
11
+ /** Explicit compatibility adapter with no cross-process or modern-session role. */
12
+ export class LegacyMcpAdapter {
13
+ #options;
14
+ #clientInfo;
15
+ /** Create one process-local legacy stdio adapter. */
16
+ constructor(options) {
17
+ this.#options = options;
18
+ }
19
+ /** Read the bounded identity most recently supplied to legacy initialize. */
20
+ getClientInfo() {
21
+ return this.#clientInfo ? structuredClone(this.#clientInfo) : undefined;
22
+ }
23
+ /** Validate and answer the historical initialize handshake. */
24
+ initialize(params) {
25
+ const requestedVersion = params?.protocolVersion;
26
+ if (typeof requestedVersion === "string" &&
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
+ }
34
+ this.#clientInfo = this.#options.parseClientInfo(params?.clientInfo);
35
+ return {
36
+ protocolVersion: PM_MCP_LEGACY_PROTOCOL_VERSIONS[0],
37
+ capabilities: structuredClone(this.#options.capabilities),
38
+ serverInfo: { ...this.#options.serverInfo },
39
+ instructions: this.#options.instructions,
40
+ };
41
+ }
42
+ /** Dispatch one unversioned request through the finite legacy method set. */
43
+ async dispatch(request) {
44
+ if (request.method === "ping")
45
+ return {};
46
+ if (request.method === "tools/list")
47
+ return this.#options.listTools(request.params);
48
+ if (request.method === "tools/call") {
49
+ return this.#options.callTool(request.params, this.#clientInfo);
50
+ }
51
+ if (request.method === "resources/list")
52
+ return this.#options.listResources();
53
+ if (request.method === "resources/read") {
54
+ return this.#options.readResource(request.params);
55
+ }
56
+ if (request.method === "prompts/list")
57
+ return this.#options.listPrompts();
58
+ if (request.method === "prompts/get")
59
+ return this.#options.getPrompt(request.params);
60
+ throw new PmCliError(`Unsupported MCP method: ${request.method ?? "(missing)"}`, 64);
61
+ }
62
+ }
63
+ //# sourceMappingURL=legacy-adapter.js.map
64
+ //# debugId=6a1d9bca-7dac-5537-9930-a12d8049c8b8
@@ -1,12 +1,22 @@
1
1
  #!/usr/bin/env node
2
+ import { type AgentClientInfo } from "../sdk/runtime-primitives.js";
2
3
  import { readRequiredString, type PmActionInput } from "../sdk/runtime.js";
3
- interface JsonRpcRequest {
4
+ import { PmMcpProtocolError, resolveMcpRequestContext, type PmMcpRequestContext } from "../sdk/mcp/protocol.js";
5
+ import { PmMcpInputRequiredError } from "../sdk/mcp/interactions.js";
6
+ import { type PmMcpSubscriptionId, type PmMcpSubscriptionSink } from "../sdk/mcp/subscriptions.js";
7
+ /** JSON-RPC request shape accepted by pm MCP transport adapters. */
8
+ export interface JsonRpcRequest {
9
+ /** JSON-RPC revision marker when supplied by the transport. */
4
10
  jsonrpc?: string;
11
+ /** Correlation identifier omitted only for notifications. */
5
12
  id?: string | number | null;
13
+ /** Protocol operation selected by the caller. */
6
14
  method?: string;
15
+ /** Operation inputs including request-local MCP metadata. */
7
16
  params?: Record<string, unknown>;
8
17
  }
9
18
  declare function runMcpAction(args: PmActionInput): Promise<unknown>;
19
+ type PmMcpTransportSubscriptionKey = PmMcpSubscriptionId | symbol;
10
20
  declare function nearestDeclaredKey(unexpected: string, declared: string[]): string | undefined;
11
21
  declare function detectUnexpectedTopLevelKeys(toolName: string, args: Record<string, unknown>, toolDeclaredKeys?: Map<string, string[]>): string[];
12
22
  declare function collectMutationGuardWarnings(toolName: string, action: string | undefined, args: Record<string, unknown>): Promise<string[]>;
@@ -15,6 +25,26 @@ declare function resultContent(result: unknown, warnings?: string[], tokenAccoun
15
25
  declare function errorContent(error: unknown): Record<string, unknown>;
16
26
  /** Retain at most 32 own, valid provenance values without cloning unbounded input. */
17
27
  declare function boundMcpClientProvenance(value: unknown): Record<string, string>;
28
+ declare function emitMcpChangeNotifications(action: string | undefined): Promise<void>;
29
+ /** Open one modern subscription through a concrete transport-owned sink. */
30
+ export declare function openMcpSubscription(input: {
31
+ request: JsonRpcRequest;
32
+ key?: PmMcpTransportSubscriptionKey;
33
+ sink: PmMcpSubscriptionSink;
34
+ }): Promise<void>;
35
+ /** Gracefully close one active subscription by its request identifier. */
36
+ export declare function closeMcpSubscription(id: PmMcpSubscriptionId, key?: PmMcpTransportSubscriptionKey): Record<string, unknown> | undefined;
37
+ declare function closeStdioMcpSubscriptions(): Array<{
38
+ id: PmMcpSubscriptionId;
39
+ result: Record<string, unknown>;
40
+ }>;
41
+ /** Resolve the current workspace-enriched tool schema for HTTP header checks. */
42
+ export declare function resolveMcpToolSchemaForRequest(request: JsonRpcRequest): Promise<unknown>;
43
+ /** Preserve MCP tool-result error semantics for non-protocol adapter failures. */
44
+ export declare function buildMcpToolCallErrorResult(request: JsonRpcRequest, error: unknown): Record<string, unknown> | undefined;
45
+ declare function mcpTaskPrincipal(requestContext: PmMcpRequestContext): string;
46
+ declare function shouldCreateMcpTask(params: Record<string, unknown> | undefined, requestContext: PmMcpRequestContext): boolean;
47
+ declare function settleMcpTaskExecution(taskId: string, execution: Promise<void>): Promise<void>;
18
48
  /** Dispatch one MCP request under supported process-level reproducibility settings. */
19
49
  export declare function handleRequest(request: JsonRpcRequest): Promise<Record<string, unknown> | undefined>;
20
50
  declare function writeError(id: JsonRpcRequest["id"], error: unknown): void;
@@ -27,24 +57,27 @@ export declare function isInvokedAsMcpMainModule(argvPath: string | undefined, m
27
57
  /** Public contract for test only, shared by SDK and presentation-layer consumers. */
28
58
  export declare const _testOnly: {
29
59
  boundMcpClientProvenance: typeof boundMcpClientProvenance;
60
+ createMcpInputRequiredError: (input: ConstructorParameters<typeof PmMcpInputRequiredError>[0]) => PmMcpInputRequiredError;
61
+ createMcpProtocolError: (message: string, code: number, data?: Record<string, unknown> | undefined) => PmMcpProtocolError;
30
62
  readonly closeManyOptionsFromFlat: typeof import("../sdk/runtime-input.js").closeManyOptionsFromFlat;
31
63
  detectUnexpectedOptionKeys: typeof detectUnexpectedOptionKeys;
32
64
  detectUnexpectedTopLevelKeys: typeof detectUnexpectedTopLevelKeys;
33
65
  collectMutationGuardWarnings: typeof collectMutationGuardWarnings;
66
+ closeStdioMcpSubscriptions: typeof closeStdioMcpSubscriptions;
34
67
  errorContent: typeof errorContent;
35
- getMcpClientInfo: () => {
36
- name: string;
37
- version?: string;
38
- model?: string;
39
- session?: string;
40
- provenance?: Readonly<Record<string, string | undefined>>;
41
- episode?: import("../sdk/runtime-primitives.js").AgentEpisodeIdentity;
42
- } | undefined;
68
+ emitMcpChangeNotifications: typeof emitMcpChangeNotifications;
69
+ expireMcpSubscriptionRecord: (id: PmMcpSubscriptionId, key?: PmMcpTransportSubscriptionKey) => Record<string, unknown> | undefined;
70
+ getMcpClientInfo: () => AgentClientInfo | undefined;
43
71
  readonly extensionOptionsFromArgs: typeof import("../sdk/runtime-input.js").extensionOptionsFromArgs;
44
72
  readonly globalOptions: typeof import("../sdk/runtime-input.js").actionGlobalOptions;
45
73
  readonly mutationListOptions: typeof import("../sdk/runtime-input.js").mutationListOptions;
46
74
  nearestDeclaredKey: typeof nearestDeclaredKey;
75
+ mcpTaskPrincipal: typeof mcpTaskPrincipal;
47
76
  resultContent: typeof resultContent;
77
+ resolveMcpRequestContext: typeof resolveMcpRequestContext;
78
+ shouldCreateMcpTask: typeof shouldCreateMcpTask;
79
+ settleMcpTaskExecution: typeof settleMcpTaskExecution;
80
+ subscriptionCount: () => number;
48
81
  readonly normalizeActionName: typeof import("../sdk/runtime-input.js").normalizeActionName;
49
82
  readonly normalizeCommandPath: typeof import("../sdk/runtime-input.js").normalizeCommandPath;
50
83
  readonly normalizeMcpOptionsArrays: typeof import("../sdk/runtime-input.js").normalizeMcpOptionsArrays;