@50arms/platform-mcp 0.1.476 → 0.1.478

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/README.md CHANGED
@@ -19,7 +19,6 @@ BOARD-ONLY (DX-1171): board is the first-level concept; repo is DERIVED from boa
19
19
  An operator session has no stored credential. Signed out, `session_connect` (optionally with `title`, the session's own Claude title) posts `POST /api/access-requests` and answers at once `{state: "approval_required", approvalUrl, confirmCode, expiresAt, instruction}`: show the user the code and open the URL; they approve in the dashboard. The server polls `POST /api/access-requests/claim` in the background, so the key is stored when the approval lands; the next `session_connect` waits up to about 45 seconds for it, then connects, or answers `approval_pending`. One tool call never blocks for minutes. `denied` is reported once; a request that lapsed (the dashboard deletes it within about a minute of expiry, so a claim answers 404) starts a fresh one on the next call.
20
20
  - **A machine secret and an auto-approved request (DX-6764, PLAN-128).** Every `session` access request also sends `machineSecret`: one random secret per machine and per dashboard, made the first time it is needed in `~/.config/danxbot/machine-secrets/<sha12(dashboard url)>.json` (mode 0600, written durably, then hard-linked into place so two sessions starting at once on a fresh machine end up with the same one; an unusable file is a loud error, never replaced). The dashboard keeps only its hash, so a person can let later sessions from this machine sign in by themselves; it is never sent to another dashboard, and the `machine` daemon's request and a dispatched agent's credential are unchanged. When the create answer says `autoApproved: true` no person decides the request: the first claim is not delayed, `session_connect` waits up to about 45 seconds for the key and answers signed in with no `approvalUrl` or `confirmCode`; a claim slower than that answers `{state: "signing_in"}`, still with no link. `autoApproved` is required in the create answer: a dashboard that does not send it fails the request loudly. A request left pending behaves as above.
21
21
  - **A launched session signs in by its grant (DX-7586, DEC-1127).** A signed-out `session_connect` with a `target`, on a registered machine, first calls the public `POST /api/access-requests/launch-claim` with `{machineSecret, labelId: <this session's id>, target}`: the dashboard redeems the grant a session on this machine wrote for that plan or card (`POST /api/session-launch-grants`), so no token passes through any agent. `approved` stores the key like an approval and answers signed in, with no access request. `none` (or a 404 from a dashboard without the route) goes on to the usual person's request; a refusal (409 `launch_grant_refused` with its `reason`, 403, 429) goes on too, the answer carrying a `note` that names why the grant was not used.
22
- - **A launch token (DX-6801, DEC-522; kept only for grants and role text from before DX-7586).** `session_connect` takes an optional `launch_token`: the one-use token the session that started this one passed in its prompt. A signed-out session given one redeems it once per process through the public `POST /api/access-requests/claim` with `{secret: <token>, labelId: <this session's id>}` (`labelId` is sent only on a redeem); `approved` stores the key like an approval and answers signed in, with no access request. Any other answer (`claimed`, `expired`, 404, 409 `launch_grant_refused` with its `reason`, 429) spends the token and falls through to the usual person's request, the answer carrying a `note` that names why the token was not used. A signed-in session ignores the token.
23
22
 
24
23
  - **Storage.** `~/.config/danxbot/session-keys/<sha12(dashboard url)>/<session id>.json`, mode 0600, written write-then-rename, pruned after 7 days. One file per dashboard and per session; this server reads it at boot, and `restart_notice` reads the same file through the `session-key` credential source and proves the fingerprint. The key lapses on the dashboard after 24 hours without use (every authenticated call, the relay's heartbeat included, renews it), and is revocable from the account page.
25
24
  - **A 401 on the stored key** deletes the file and returns the sign-in halt (in `session_connect`: a new request in the same call). That is a key that lapsed. A key a PERSON revoked is answered `401 key_revoked` (DX-4418): the key file is deleted and EVERY dashboard tool, `session_connect` included, returns one stop halt (who revoked it and when; commit work in progress and end; a dispatched agent makes no further call), for the rest of the process. No access request is made. The worker finds the revocation itself and ends the dispatch as revoked (every dashboard route, the dispatch-complete one included, refuses a revoked key). `plan_events_wait` answers `stopped` with the reason `key_revoked` the same way. **A 404 on create** means the dashboard predates request-and-approve and says so.
@@ -84,14 +84,9 @@ export async function createAccessRequest(fetchImpl, dashboardUrl, input) {
84
84
  };
85
85
  return { kind: "refused", status, body: json };
86
86
  }
87
- /**
88
- * DX-6801: `labelId` rides along ONLY when redeeming a launch token (the secret is then the token a parent session passed in this
89
- * session's prompt, and `labelId` this session's id, which the dashboard stores the key under); a normal poll sends `{secret}` alone.
90
- * A launch redeem the dashboard refuses answers 409 `launch_grant_refused` with a `reason`: that is a `refused` answer, body as sent.
91
- */
92
- export async function claimAccessRequest(fetchImpl, dashboardUrl, secret, labelId) {
87
+ export async function claimAccessRequest(fetchImpl, dashboardUrl, secret) {
93
88
  const url = `${baseOf(dashboardUrl)}/api/access-requests/claim`;
94
- const { status, headers, json } = await postPublic(fetchImpl, url, labelId === undefined ? { secret } : { secret, labelId });
89
+ const { status, headers, json } = await postPublic(fetchImpl, url, { secret });
95
90
  if (status === 404)
96
91
  return { kind: "not_found" };
97
92
  if (status === 429)
package/dist/index.js CHANGED
@@ -1083,13 +1083,6 @@ strictTool("session_connect",
1083
1083
  .describe(
1084
1084
  // DX-6939: read only by a call that makes a sign-in claim; a signed-in session's call ignores it.
1085
1085
  "The key of the team role this session's key is minted with when this call signs it in: default `session`, the system agent role every team has that a Member holds within. Name `agent` (what a dispatched worker runs on) only when a person said so: it holds keys a Member lacks, so the sign-in is refused unless that person holds them too. It must be an agent role within what the person this machine is registered to holds, or the sign-in is refused. Omit it unless a person named another role."),
1086
- launch_token: z
1087
- .string()
1088
- .min(1)
1089
- .optional()
1090
- .describe(
1091
- // DX-7586: kept only while a prompt written under the role text from before DX-7586 may still carry a token; a started session now signs in through `target` alone.
1092
- "Only when a prompt from an older session names one: a one-use token. Omit it otherwise: a session another session started for a plan or card signs in through `target` with no token."),
1093
1086
  person_sign_in: z.boolean().optional().describe(
1094
1087
  // DX-6894 (DEC-589): set only by the plugin band when a PERSON presses its Sign in; the one call that leaves a revoked key's stop.
1095
1088
  "Set only by the plugin's Sign in button when a person presses it; an agent never sets it. On a session whose key a person revoked it lifts the stop and starts a new access request a person must approve; any call without it still answers the stop."),
@@ -1115,7 +1108,7 @@ async (args) => {
1115
1108
  }
1116
1109
  // DX-4390 — no key yet: ask for one (or wait for the approval already asked for).
1117
1110
  // DX-7586: `target` lets a session another one started for it sign in by the grant waiting there.
1118
- const ready = await access.ensureAccess(args.title, args.launch_token, args.role, args.target);
1111
+ const ready = await access.ensureAccess(args.title, args.role, args.target);
1119
1112
  if (!ready.signedIn)
1120
1113
  return accessReply(ready);
1121
1114
  if (args.target === undefined) {
@@ -1148,7 +1141,7 @@ async (args) => {
1148
1141
  return haltResult(revokedHalt);
1149
1142
  // DX-4390 — the dashboard no longer accepts the stored key: drop it and ask again in the same call.
1150
1143
  if (result.status === 401 && access.dropKey(result)) {
1151
- return accessReply(await access.ensureAccess(args.title, undefined, args.role), "the dashboard no longer accepted this session's key");
1144
+ return accessReply(await access.ensureAccess(args.title, args.role), "the dashboard no longer accepted this session's key");
1152
1145
  }
1153
1146
  return finishConnect("session_connect", result, args.disconnect === true);
1154
1147
  });
@@ -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.476",
615
+ false ? void 0 : "0.1.478",
616
616
  readOwnManifest
617
617
  );
618
618
  function envelope(now) {
@@ -27,6 +27,7 @@ export const GET_ROUTE_BOARD_SCOPE = [
27
27
  ["/api/feedback/mine", "refuse"],
28
28
  ["/api/issues", "named"],
29
29
  ["/api/issues/:id/decision-records", "refuse"],
30
+ ["/api/issues/:id/evidence-records", "refuse"],
30
31
  ["/api/issues/:id/problems", "refuse"],
31
32
  ["/api/issues/:id/usage-runs", "refuse"],
32
33
  ["/api/issues/:id/usage-series", "refuse"],
@@ -103,38 +103,19 @@ const CLAIMED_LOST_ERROR = "the dashboard says this request was already claimed,
103
103
  "start a new request";
104
104
  /** DX-6801 / DX-7586: why the grant the starting session wrote signed nobody in; the session then asks a person as any signed-out session does. */
105
105
  const launchNote = (why) => `The launch grant was not used: ${why}. This session asks a person to approve it instead: show the user the confirm code and URL.`;
106
- /** DX-7586: why a launch claim (by machine and target) signed nobody in. A rate limit is its own; every refusal reads as a token redeem's does. */
106
+ /** DX-7586: why a launch claim (by machine and target) signed nobody in. */
107
107
  function launchClaimWhy(claim) {
108
108
  if (claim.kind === "rate_limited")
109
109
  return `the dashboard rate limited the sign-in (retry after ${claim.retryAfterSeconds}s)`;
110
- return launchRefusalWhy(claim);
111
- }
112
- function launchRefusalWhy(claim) {
113
- switch (claim.kind) {
114
- case "claimed":
115
- return "it was already redeemed (a launch token works once)";
116
- case "expired":
117
- return "it expired or was withdrawn";
118
- case "not_found":
119
- return "the dashboard does not know it";
120
- case "denied":
121
- return "the dashboard answered denied";
122
- case "pending":
123
- return "the dashboard answered pending, which a launch token never is";
124
- case "rate_limited":
125
- return `the dashboard rate limited the redeem (retry after ${claim.retryAfterSeconds}s) and a token is tried once per process`;
126
- case "refused": {
127
- const body = claim.body;
128
- if (claim.status === 409 && body?.error === "launch_grant_refused") {
129
- const missing = Array.isArray(body.missingPermissions) &&
130
- body.missingPermissions.length > 0
131
- ? ` (missing permissions: ${body.missingPermissions.join(", ")})`
132
- : "";
133
- return `the dashboard refused the launch grant: ${String(body.reason)}${missing}`;
134
- }
135
- return `the dashboard refused the redeem (${claim.status}): ${JSON.stringify(claim.body)}`;
136
- }
110
+ const body = claim.body;
111
+ if (claim.status === 409 && body?.error === "launch_grant_refused") {
112
+ const missing = Array.isArray(body.missingPermissions) &&
113
+ body.missingPermissions.length > 0
114
+ ? ` (missing permissions: ${body.missingPermissions.join(", ")})`
115
+ : "";
116
+ return `the dashboard refused the launch grant: ${String(body.reason)}${missing}`;
137
117
  }
118
+ return `the dashboard refused the sign-in (${claim.status}): ${JSON.stringify(claim.body)}`;
138
119
  }
139
120
  export const EXPIRED_NOTE = "The previous request expired before it was approved: the dashboard stopped hearing from this session. This is a new " +
140
121
  "request: show the user its new confirm code and URL.";
@@ -158,8 +139,6 @@ export class SessionAccess {
158
139
  // DX-4390: two concurrent signed-out session_connect calls must not each post a request.
159
140
  ensureQueue = Promise.resolve();
160
141
  lastKeyFileWrite = 0;
161
- // DX-6801: a launch token is redeemed at most once per process, whatever the answer.
162
- launchTokenTried = false;
163
142
  // DX-5882: why this server holds no credential (null while it holds one); logged with every "Not signed in" halt.
164
143
  signedOutCause = null;
165
144
  fetchImpl;
@@ -307,17 +286,13 @@ export class SessionAccess {
307
286
  * DX-7586 (DEC-1127): a signed-out session on a registered machine whose call names a `target` first redeems the launch grant a session on this machine wrote for that plan or card, with no
308
287
  * token and no person approving (`claimLaunchGrant`). `none` goes on as below; a refusal goes on too, the answer carrying a `note` that says why the grant was not used.
309
288
  *
310
- * DX-6801 / DEC-522: a signed-out session given the `launchToken` the session that started it passed in its prompt redeems it
311
- * (once per process) through the public claim route, with no person approving. Any answer but `approved` spends the token and
312
- * falls through to the person's request, the answer carrying a `note` that says why the token was not used.
313
- * DX-7586: the token is kept only for grants written before DX-7586, and for role text from before it a running session may still follow.
314
289
  */
315
- ensureAccess(title, launchToken, role, target) {
316
- const run = this.ensureQueue.then(() => this.ensureAccessNow(title, launchToken, role, target));
290
+ ensureAccess(title, role, target) {
291
+ const run = this.ensureQueue.then(() => this.ensureAccessNow(title, role, target));
317
292
  this.ensureQueue = run.catch(() => undefined);
318
293
  return run;
319
294
  }
320
- async ensureAccessNow(title, launchToken, role, target) {
295
+ async ensureAccessNow(title, role, target) {
321
296
  // DX-4418: a person revoked this session's access; it asks again only after `personSignIn` (DX-6894).
322
297
  const revokedHalt = this.revokedHalt();
323
298
  if (revokedHalt !== null)
@@ -352,24 +327,7 @@ export class SessionAccess {
352
327
  note = launchNote(launchClaimWhy(claim));
353
328
  }
354
329
  }
355
- // DX-6801: only while no request of this process is open (a person's approval already in flight stays the way in).
356
- if (launchToken !== undefined &&
357
- !this.launchTokenTried &&
358
- this.pending === null) {
359
- this.launchTokenTried = true;
360
- const claim = await claimAccessRequest(this.fetchImpl, this.deps.dashboardUrl, launchToken, sessionId);
361
- if (claim.kind === "approved") {
362
- const stored = this.storeKey(claim.apiKey);
363
- if (stored.kind === "approved")
364
- return { signedIn: true };
365
- if (stored.kind === "failed")
366
- return notReady({ state: "request_failed", error: stored.error }, true);
367
- }
368
- else {
369
- note = launchNote(launchRefusalWhy(claim));
370
- }
371
- }
372
- // DX-7010: a machine with no registration makes no access request; `env` credentials and launch tokens returned above and never reach this.
330
+ // DX-7010: a machine with no registration makes no access request; `env` credentials returned above and never reach this.
373
331
  const unregistered = await this.machineRegistrationAnswer(note);
374
332
  if (unregistered !== null)
375
333
  return unregistered;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@50arms/platform-mcp",
3
- "version": "0.1.476",
3
+ "version": "0.1.478",
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",