@50arms/platform-mcp 0.1.492 → 0.1.494
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/dist/http-client.js +7 -4
- package/dist/index.js +3 -1
- package/dist/listen.js +3 -1
- package/dist/machine-toolkit.js +1 -1
- package/dist/permission-watch.js +3 -0
- package/dist/restart-notice.js +3 -0
- package/dist/session-stream.js +3 -0
- package/dist/version-floor.js +38 -12
- package/package.json +1 -1
package/dist/http-client.js
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
*/
|
|
59
59
|
import { appVersionOf } from "./app-version.js";
|
|
60
60
|
import { boardStampOf, isReadRoute, takesBoardInBody, } from "./route-board-scope.js";
|
|
61
|
-
import { assertVersionFloorSatisfied,
|
|
61
|
+
import { assertVersionFloorSatisfied, clientVersionHeaders, MCP_MIN_VERSION_HEADER, } from "./version-floor.js";
|
|
62
62
|
import { PLUGIN_BACKGROUND_HEADER } from "./session-options.js";
|
|
63
63
|
import { currentToolUseId, TOOL_USE_ID_HEADER } from "./tool-use.js";
|
|
64
64
|
import { boundRequest } from "./request-bound.js";
|
|
@@ -195,8 +195,8 @@ export class DashboardHttpClient {
|
|
|
195
195
|
if (this.config.session) {
|
|
196
196
|
headers["x-danx-session-id"] = this.config.session.id;
|
|
197
197
|
}
|
|
198
|
-
// DX-5897 - this server's own version rides every call
|
|
199
|
-
headers
|
|
198
|
+
// DX-5897 / DX-7957 - this server's own version rides every call, and so does the plugin's when its launcher gave it one: the dashboard holds the call to the endpoint's floors by them and records them for the session.
|
|
199
|
+
Object.assign(headers, clientVersionHeaders(this.config.pluginVersion));
|
|
200
200
|
if (args.background === true) {
|
|
201
201
|
headers[PLUGIN_BACKGROUND_HEADER] = "1";
|
|
202
202
|
}
|
|
@@ -323,9 +323,12 @@ export class DashboardHttpClient {
|
|
|
323
323
|
// error when it's really "you're running an old MCP"). Throws
|
|
324
324
|
// McpOutdatedError instead of returning below when this package is
|
|
325
325
|
// behind the floor — see version-floor.ts's own doc.
|
|
326
|
+
// DX-7957: a 426 is the dashboard's own refusal of this call for a client too old for the endpoint; its body names which client is behind and the update steps, so
|
|
327
|
+
// it is handed to the agent as the answer instead of replaced by this package's own `McpOutdatedError` text.
|
|
326
328
|
const isFirstCall = !this.hasCheckedVersionFloor;
|
|
327
329
|
this.hasCheckedVersionFloor = true;
|
|
328
|
-
if (
|
|
330
|
+
if (res.status !== 426 &&
|
|
331
|
+
(isFirstCall || (res.status >= 400 && res.status < 500))) {
|
|
329
332
|
assertVersionFloorSatisfied(res.headers.get(MCP_MIN_VERSION_HEADER));
|
|
330
333
|
}
|
|
331
334
|
const text = res.text;
|
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ import { SessionAccess } from "./session-access.js";
|
|
|
91
91
|
import { PermissionRequests } from "./permission-request.js";
|
|
92
92
|
import { makeGuardedCalls } from "./guarded-calls.js";
|
|
93
93
|
import { JobKeyHolder, sendWithJobKey } from "./job-key.js";
|
|
94
|
-
import { readOwnVersion } from "./version-floor.js";
|
|
94
|
+
import { pluginVersionFromEnv, readOwnVersion } from "./version-floor.js";
|
|
95
95
|
import { createCheckoutDocsRootReporter, readCheckoutRepo, } from "./checkout-docs-root.js";
|
|
96
96
|
import { isPickupConnect, projectKeyOf, recordSessionConnectionAfterConnect, removeSessionConnectionAfterLeave, } from "./session-connection.js";
|
|
97
97
|
import { createListenerReminder, isPlanConnectedOnThisMachine, mergeReminders, } from "./listener-reminder.js";
|
|
@@ -197,6 +197,8 @@ async function boot() {
|
|
|
197
197
|
// outbound call so the agent's card writes chain under the launch; absent
|
|
198
198
|
// (untraced dispatch) → omitted, and the dashboard mints a fresh root.
|
|
199
199
|
traceparent: readEnvOptional("DANXBOT_TRACEPARENT"),
|
|
200
|
+
// DX-7957: the plugin's launcher passes its own version; unset, no header is stamped.
|
|
201
|
+
pluginVersion: pluginVersionFromEnv(),
|
|
200
202
|
// DX-2683 — the working session, when there is one. See below.
|
|
201
203
|
session,
|
|
202
204
|
};
|
package/dist/listen.js
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
import { controlOfFrame, invalidCompactionReason, } from "./compaction-control.js";
|
|
45
45
|
import { clearControlOfFrame, invalidClearReason, } from "./clear-control.js";
|
|
46
46
|
import { LINE_PREFIX, oneLine } from "./one-line.js";
|
|
47
|
-
import { MCP_STREAM_MIN_VERSION_HEADER, ownVersionBelow, readOwnVersion, } from "./version-floor.js";
|
|
47
|
+
import { clientVersionHeaders, MCP_STREAM_MIN_VERSION_HEADER, ownVersionBelow, pluginVersionFromEnv, readOwnVersion, } from "./version-floor.js";
|
|
48
48
|
import { pacingRelayLine } from "./pacing-relay.js";
|
|
49
49
|
import { isUrgent } from "./urgent-records.js";
|
|
50
50
|
export const INITIAL_BACKOFF_MS = 1_000;
|
|
@@ -1204,6 +1204,8 @@ export async function runListener(options, deps) {
|
|
|
1204
1204
|
Accept: "text/event-stream",
|
|
1205
1205
|
// DX-5846: says this reader understands `acks` and shows the instruction to acknowledge; the dashboard stamps and re-sends only to a connection that sends it (an older reader would drop a repeat it cannot act on).
|
|
1206
1206
|
"X-Danx-Ack": "1",
|
|
1207
|
+
// DX-7957: the stream is never refused for its versions (`neverRefuse`), but it reports them like every other request this package makes.
|
|
1208
|
+
...clientVersionHeaders(pluginVersionFromEnv()),
|
|
1207
1209
|
};
|
|
1208
1210
|
if (lastEventId !== null)
|
|
1209
1211
|
headers["Last-Event-ID"] = String(lastEventId);
|
package/dist/machine-toolkit.js
CHANGED
|
@@ -612,7 +612,7 @@ var readOwnManifest = () => JSON.parse(
|
|
|
612
612
|
readFileSync(new URL("../../package.json", import.meta.url), "utf8")
|
|
613
613
|
).version;
|
|
614
614
|
var TOOLKIT_VERSION = resolveToolkitVersion(
|
|
615
|
-
false ? void 0 : "0.1.
|
|
615
|
+
false ? void 0 : "0.1.494",
|
|
616
616
|
readOwnManifest
|
|
617
617
|
);
|
|
618
618
|
function envelope(now) {
|
package/dist/permission-watch.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import { SYNC_ATTEMPTS, retryBounded } from "./bounded-retry.js";
|
|
19
19
|
import { SseParser } from "./listen.js";
|
|
20
20
|
import { PLUGIN_BACKGROUND_HEADER } from "./session-options.js";
|
|
21
|
+
import { clientVersionHeaders, pluginVersionFromEnv } from "./version-floor.js";
|
|
21
22
|
const STREAM_PATH = "/api/stream?topics=key:self";
|
|
22
23
|
const PERMISSIONS_CHANGED = "permissions_changed";
|
|
23
24
|
export const WATCH_INITIAL_BACKOFF_MS = 1_000;
|
|
@@ -89,6 +90,8 @@ export class PermissionWatch {
|
|
|
89
90
|
Authorization: `Bearer ${token}`,
|
|
90
91
|
Accept: "text/event-stream",
|
|
91
92
|
[PLUGIN_BACKGROUND_HEADER]: "1",
|
|
93
|
+
// DX-7957: the permission stream is a session-key request like any other (`clientVersionHeaders`).
|
|
94
|
+
...clientVersionHeaders(pluginVersionFromEnv()),
|
|
92
95
|
},
|
|
93
96
|
signal: controller.signal,
|
|
94
97
|
});
|
package/dist/restart-notice.js
CHANGED
|
@@ -47,6 +47,7 @@ import { findPredecessorCandidates, projectKeyOf, readSessionConnection, } from
|
|
|
47
47
|
import { checkedTranscriptPath } from "./session-stats.js";
|
|
48
48
|
import { readTranscriptLineage, TranscriptReadAborted, TranscriptUnreadable, } from "./transcript-lineage.js";
|
|
49
49
|
import { fixForStop } from "./stop-fixes.js";
|
|
50
|
+
import { clientVersionHeaders, pluginVersionFromEnv } from "./version-floor.js";
|
|
50
51
|
/**
|
|
51
52
|
* One authenticated HTTP call to this session's dashboard, with a hard
|
|
52
53
|
* timeout. Never throws — a network failure or an abort is reported as
|
|
@@ -68,6 +69,8 @@ export async function sendSessionRequest(options, path, init, deps) {
|
|
|
68
69
|
[SESSION_ID_HEADER]: options.sessionId,
|
|
69
70
|
// DX-5354: the session-start hook's lookup is the plugin's own work, never the agent acting, so it does not extend the session's key.
|
|
70
71
|
[PLUGIN_BACKGROUND_HEADER]: "1",
|
|
72
|
+
// DX-7957: every session-key request reports the client's versions (`clientVersionHeaders`); this serves the restart-notice and price lookups.
|
|
73
|
+
...clientVersionHeaders(pluginVersionFromEnv()),
|
|
71
74
|
},
|
|
72
75
|
body: init.body,
|
|
73
76
|
signal: bound.signal,
|
package/dist/session-stream.js
CHANGED
|
@@ -10,6 +10,7 @@ import { errorCodeOf } from "./json-body.js";
|
|
|
10
10
|
import { boundRequest } from "./request-bound.js";
|
|
11
11
|
import { keyRevocationOf, keyRevokedHalt, } from "./key-revoked-halt.js";
|
|
12
12
|
import { oneLine } from "./one-line.js";
|
|
13
|
+
import { clientVersionHeaders, pluginVersionFromEnv } from "./version-floor.js";
|
|
13
14
|
import { PLUGIN_BACKGROUND_HEADER, SESSION_ID_HEADER, } from "./session-options.js";
|
|
14
15
|
import { isClaimState, } from "@50arms/session-telemetry";
|
|
15
16
|
/**
|
|
@@ -74,6 +75,8 @@ async function request(options, deps, what, url, init = { method: "GET" }) {
|
|
|
74
75
|
[SESSION_ID_HEADER]: options.sessionId,
|
|
75
76
|
// DX-5076: every request this module makes is the relay's own work (ticket mint, inventory read, heartbeat), never the agent acting, so it must not end an agent pause. One marking point, so a new request here cannot forget it.
|
|
76
77
|
[PLUGIN_BACKGROUND_HEADER]: "1",
|
|
78
|
+
// DX-7957: the dashboard refuses a session key that reports no MCP version (`clientVersionHeaders`), so the ticket mint and the inventory read carry it too.
|
|
79
|
+
...clientVersionHeaders(pluginVersionFromEnv()),
|
|
77
80
|
};
|
|
78
81
|
if (init.body !== undefined)
|
|
79
82
|
headers["Content-Type"] = "application/json";
|
package/dist/version-floor.js
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* the main danxbot repo — this package cannot import them, see below).
|
|
6
6
|
*
|
|
7
7
|
* The dashboard stamps `X-Danx-Mcp-Min-Version` on every routed `/api/*`
|
|
8
|
-
* response with the floor of the
|
|
9
|
-
*
|
|
10
|
-
* its
|
|
11
|
-
* published"; DX-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
8
|
+
* response with the floor of the matched endpoint (`endpointFloors` in
|
|
9
|
+
* `src/mcp-contract.ts` — DX-3597 made a floor track the version where
|
|
10
|
+
* its endpoint's MCP-exposed contract last changed, not "whatever's currently
|
|
11
|
+
* published"; DX-7957 made floors per endpoint, so a change to one endpoint
|
|
12
|
+
* blocks this client's calls to that endpoint alone; see that
|
|
13
|
+
* file's module doc for the full decision). The server itself refuses a call
|
|
14
|
+
* below the endpoint's floor with a 426 whose body carries the update steps;
|
|
15
|
+
* `http-client.ts` hands that body to the agent as the answer.
|
|
16
16
|
*
|
|
17
17
|
* `DashboardHttpClient.request()` (`./http-client.ts`) reads this header on
|
|
18
18
|
* the FIRST call this process makes (regardless of outcome — a proactive
|
|
@@ -38,12 +38,38 @@ import { fileURLToPath } from "node:url";
|
|
|
38
38
|
/** Must match `MCP_MIN_VERSION_HEADER` in danxbot's `src/mcp-contract.ts` verbatim. */
|
|
39
39
|
export const MCP_MIN_VERSION_HEADER = "X-Danx-Mcp-Min-Version";
|
|
40
40
|
/**
|
|
41
|
-
* DX-5897 - request header this package stamps on every call with its own version (`readOwnVersion`), so
|
|
42
|
-
*
|
|
41
|
+
* DX-5897 - request header this package stamps on every call with its own version (`readOwnVersion`), so the dashboard can hold the call to the
|
|
42
|
+
* endpoint's floor and refuse a stale session. Must match
|
|
43
43
|
* `MCP_VERSION_HEADER` in danxbot's `src/mcp-contract.ts` verbatim.
|
|
44
44
|
*/
|
|
45
45
|
export const MCP_VERSION_HEADER = "X-Danx-Mcp-Version";
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* DX-7957 - request header this package stamps on every call with the 50arms plugin's version, when the plugin's launcher passed it (`PLUGIN_VERSION_ENV`), so the
|
|
48
|
+
* dashboard can hold the session to an endpoint's plugin floor. Must match `PLUGIN_VERSION_HEADER` in danxbot's `src/mcp-contract.ts` verbatim.
|
|
49
|
+
*/
|
|
50
|
+
export const PLUGIN_VERSION_HEADER = "X-Danx-Plugin-Version";
|
|
51
|
+
/** DX-7957 - the environment variable the plugin's launcher (`50arms/scripts/dashboard-mcp-server.mjs`, CP-150) sets on this process, carrying the plugin's own version. */
|
|
52
|
+
export const PLUGIN_VERSION_ENV = "ARMS50_PLUGIN_VERSION";
|
|
53
|
+
/** DX-7957 - the plugin's version as its launcher passed it in `PLUGIN_VERSION_ENV`, or `undefined` when it set none (a plugin from before CP-150) or an empty one. */
|
|
54
|
+
export function pluginVersionFromEnv(env = process.env) {
|
|
55
|
+
const value = env[PLUGIN_VERSION_ENV];
|
|
56
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* DX-7957 - the ONE builder of the version headers a request to the dashboard carries: this package's own version always, the plugin's when it has one. Every
|
|
60
|
+
* request this package makes with the session's key spreads it into its headers (the client's choke point, the relay's ticket mint and inventory read, the permission
|
|
61
|
+
* watch, the restart-notice and price lookups), because the dashboard refuses a session or dispatch key that reports no MCP version on any endpoint that is not
|
|
62
|
+
* `neverRefuse` (`src/dashboard/mcp-version-guard.ts`): a request outside this builder would be refused 426 and cut the session off.
|
|
63
|
+
*/
|
|
64
|
+
export function clientVersionHeaders(pluginVersion) {
|
|
65
|
+
const headers = {
|
|
66
|
+
[MCP_VERSION_HEADER]: readOwnVersion(),
|
|
67
|
+
};
|
|
68
|
+
if (pluginVersion !== undefined)
|
|
69
|
+
headers[PLUGIN_VERSION_HEADER] = pluginVersion;
|
|
70
|
+
return headers;
|
|
71
|
+
}
|
|
72
|
+
/** DX-6272 - response header of the session event stream carrying its floor. Must match `MCP_STREAM_MIN_VERSION_HEADER` in danxbot's `src/mcp-contract.ts` verbatim. */
|
|
47
73
|
export const MCP_STREAM_MIN_VERSION_HEADER = "X-Danx-Stream-Min-Version";
|
|
48
74
|
/** Must match `MCP_PACKAGE_NAME` in danxbot's `src/mcp-contract.ts` verbatim. */
|
|
49
75
|
export const MCP_PACKAGE_NAME = "@50arms/platform-mcp";
|
|
@@ -117,7 +143,7 @@ export class McpOutdatedError extends Error {
|
|
|
117
143
|
need;
|
|
118
144
|
constructor(have, need) {
|
|
119
145
|
super(`[platform-mcp] mcp_outdated: this MCP is running ${MCP_PACKAGE_NAME}@${have}, but the dashboard's ` +
|
|
120
|
-
`
|
|
146
|
+
`endpoint requires >= ${need}. Restart your Claude Code session to pick up the published update.`);
|
|
121
147
|
this.name = "McpOutdatedError";
|
|
122
148
|
this.have = have;
|
|
123
149
|
this.need = need;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@50arms/platform-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.494",
|
|
4
4
|
"description": "Stdio MCP server fronting the 50 Arms dashboard API for agents (operator sessions and dispatched workers alike): the generic 50arms_api/50arms_api_list/50arms_api_spec tools reach any route the caller's credential may call, plus dedicated agent-specific tools (session_connect, request_permission, attach_file, and 50arms_slack_reply) (DX-3465, PLN-11 R-25).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|