@50arms/platform-mcp 0.1.475 → 0.1.476
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 +3 -2
- package/dist/access-request.js +29 -0
- package/dist/handlers.js +27 -5
- package/dist/heartbeat-reporter.js +3 -2
- package/dist/index.js +8 -5
- package/dist/machine-toolkit.js +1 -1
- package/dist/plan-events-tool.js +14 -2
- package/dist/session-access.js +39 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,8 @@ BOARD-ONLY (DX-1171): board is the first-level concept; repo is DERIVED from boa
|
|
|
18
18
|
|
|
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
|
-
- **A
|
|
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.
|
|
22
23
|
|
|
23
24
|
- **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.
|
|
24
25
|
- **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.
|
|
@@ -120,4 +121,4 @@ make test PROJECT=packages/danx-dashboard-mcp FILES=.e2e.test.ts
|
|
|
120
121
|
|
|
121
122
|
## Publishing
|
|
122
123
|
|
|
123
|
-
Out of scope for this package's own code — the `make publish
|
|
124
|
+
Out of scope for this package's own code — the `make publish` target in the danxbot root Makefile owns version bump + `npm publish` + propagation wait. Standing operator authorization per `~/.claude/skills/thehammer-publish/`.
|
package/dist/access-request.js
CHANGED
|
@@ -117,3 +117,32 @@ export async function claimAccessRequest(fetchImpl, dashboardUrl, secret, labelI
|
|
|
117
117
|
throw new Error(`[platform-mcp] POST ${url} answered an unknown status: ${JSON.stringify(json)}`);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* DX-7586 (DEC-1127) - a signed-out session redeems the launch grant its parent wrote for `target` (the plan or card its `session_connect` names), from this machine, with no token: the machine's
|
|
122
|
+
* registration secret is the credential. A dashboard from before DX-7586 has no such route and answers 404: no grant can wait there, so that is `none` too. A grant the dashboard will no longer let
|
|
123
|
+
* mint a key answers 409 `launch_grant_refused` with a `reason`, a `refused` answer with its body as sent.
|
|
124
|
+
*/
|
|
125
|
+
export async function claimLaunchGrant(fetchImpl, dashboardUrl, input) {
|
|
126
|
+
const url = `${baseOf(dashboardUrl)}/api/access-requests/launch-claim`;
|
|
127
|
+
const { status, headers, json } = await postPublic(fetchImpl, url, input);
|
|
128
|
+
if (status === 404)
|
|
129
|
+
return { kind: "none" };
|
|
130
|
+
if (status === 429)
|
|
131
|
+
return {
|
|
132
|
+
kind: "rate_limited",
|
|
133
|
+
retryAfterSeconds: retryAfterSeconds(headers),
|
|
134
|
+
};
|
|
135
|
+
if (status !== 200)
|
|
136
|
+
return { kind: "refused", status, body: json };
|
|
137
|
+
const body = json;
|
|
138
|
+
switch (body?.status) {
|
|
139
|
+
case "none":
|
|
140
|
+
return { kind: "none" };
|
|
141
|
+
case "approved":
|
|
142
|
+
if (typeof body.apiKey !== "string" || body.apiKey === "")
|
|
143
|
+
throw new Error(`[platform-mcp] POST ${url} answered approved without an apiKey`);
|
|
144
|
+
return { kind: "approved", apiKey: body.apiKey };
|
|
145
|
+
default:
|
|
146
|
+
throw new Error(`[platform-mcp] POST ${url} answered an unknown status: ${JSON.stringify(json)}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
package/dist/handlers.js
CHANGED
|
@@ -340,7 +340,7 @@ export async function attachFile(client, args, deps = {}) {
|
|
|
340
340
|
// DX-4386: `primary` is the dashboard's own atomic option (one live cover, set in the write's own transaction); an absent flag sends no key.
|
|
341
341
|
const primary = args.primary === undefined ? {} : { primary: args.primary };
|
|
342
342
|
if (args.replaces !== undefined) {
|
|
343
|
-
return client.request({
|
|
343
|
+
return withAttachNextStep(await client.request({
|
|
344
344
|
method: "PUT",
|
|
345
345
|
basePath: "/api/issues",
|
|
346
346
|
path: `${issuePath}/${args.replaces}`,
|
|
@@ -350,12 +350,12 @@ export async function attachFile(client, args, deps = {}) {
|
|
|
350
350
|
...primary,
|
|
351
351
|
},
|
|
352
352
|
board: args.board,
|
|
353
|
-
});
|
|
353
|
+
}));
|
|
354
354
|
}
|
|
355
355
|
const filename = args.filename?.trim()
|
|
356
356
|
? args.filename.trim()
|
|
357
357
|
: basename(args.path);
|
|
358
|
-
return client.request({
|
|
358
|
+
return withAttachNextStep(await client.request({
|
|
359
359
|
method: "POST",
|
|
360
360
|
basePath: "/api/issues",
|
|
361
361
|
path: issuePath,
|
|
@@ -366,7 +366,22 @@ export async function attachFile(client, args, deps = {}) {
|
|
|
366
366
|
...primary,
|
|
367
367
|
},
|
|
368
368
|
board: args.board,
|
|
369
|
-
});
|
|
369
|
+
}));
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* DX-7594 (DEC-1130): a stored card attachment answers its own next step, so no role text has to explain what to do with the reply. A refusal passes through
|
|
373
|
+
* verbatim (its body names the fix). MACHINE-ONLY: the calling agent reads `next_step`; no person sees it.
|
|
374
|
+
*/
|
|
375
|
+
function withAttachNextStep(result) {
|
|
376
|
+
if (!result.ok || typeof result.body !== "object" || result.body === null)
|
|
377
|
+
return result;
|
|
378
|
+
return {
|
|
379
|
+
...result,
|
|
380
|
+
body: {
|
|
381
|
+
...result.body,
|
|
382
|
+
next_step: "Stored. Next: embed `url` as `` in any markdown field, and for a later version of the same picture call attach_file again with `replaces` set to this reply's `attachment_id` (never a growing list).",
|
|
383
|
+
},
|
|
384
|
+
};
|
|
370
385
|
}
|
|
371
386
|
/**
|
|
372
387
|
* DX-5241 / PLAN-47 CAV-1: upload a local image to `POST /api/uploads/images` and answer its permanent URL plus the markdown to embed it
|
|
@@ -411,5 +426,12 @@ async function uploadInlineImage(client, args, read, fileSize, { basename, extna
|
|
|
411
426
|
throw new Error("attach_file: the image upload answered no url");
|
|
412
427
|
}
|
|
413
428
|
const alt = basename(args.path, extname(args.path)).replace(/[[\]]/g, "");
|
|
414
|
-
return {
|
|
429
|
+
return {
|
|
430
|
+
...result,
|
|
431
|
+
body: {
|
|
432
|
+
url,
|
|
433
|
+
markdown: ``,
|
|
434
|
+
next_step: "Uploaded. Next: put `markdown` in the markdown body you are writing (a `POST /api/feedback` body, for one).",
|
|
435
|
+
},
|
|
436
|
+
};
|
|
415
437
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { keyRevokedHalt } from "./key-revoked-halt.js";
|
|
11
11
|
import { oneLine } from "./one-line.js";
|
|
12
|
+
import { fixForStop } from "./stop-fixes.js";
|
|
12
13
|
import { DIGEST_PREFIX } from "./digest-hold.js";
|
|
13
14
|
import { HEARTBEAT_SILENT_FAILURE_THRESHOLD, sendHeartbeat, } from "./session-stream.js";
|
|
14
15
|
import { OperatorSessionStats, } from "./session-stats.js";
|
|
@@ -17,6 +18,7 @@ import { backAgainText, durationWording, } from "./dashboard-reachability.js";
|
|
|
17
18
|
/** DX-5415: how long a stop waits for the final settle (drain + one stats flush) before giving up; shutdown must stay bounded. */
|
|
18
19
|
export const FINAL_SETTLE_BOUND_MS = 10_000;
|
|
19
20
|
/**
|
|
21
|
+
* DX-7602 (DEC-1130): a stopped listener's notice carries the exact fix for its stop reason (`fixForStop`), not a pointer to another call.
|
|
20
22
|
* DX-5088 / DX-7110 - what a relay says of a notice from the shared reachability state: the sustained-outage wording follows the listener's
|
|
21
23
|
* state, because a stopped relay (a terminal outcome) does not reconnect by itself, so "keeps reconnecting" would be false.
|
|
22
24
|
*/
|
|
@@ -26,8 +28,7 @@ function noticeLine(notice, connection) {
|
|
|
26
28
|
const length = durationWording(notice.ms);
|
|
27
29
|
const wording = connection.state === "stopped"
|
|
28
30
|
? `this session's listener has stopped${connection.reason === undefined ? "" : ` (${connection.reason})`} and does not reconnect by itself, ` +
|
|
29
|
-
`so the dashboard has heard nothing from it for ${length}.
|
|
30
|
-
`a person can also restart the session.`
|
|
31
|
+
`so the dashboard has heard nothing from it for ${length}. To fix: ${fixForStop(connection.reason ?? "")}.`
|
|
31
32
|
: `this session's listener has not reached the dashboard for ${length} (its heartbeats keep failing). ` +
|
|
32
33
|
`It keeps reconnecting on its own, and nothing is needed from you.`;
|
|
33
34
|
return oneLine(`${DIGEST_PREFIX} ${wording}`);
|
package/dist/index.js
CHANGED
|
@@ -746,10 +746,10 @@ renamedTool("50arms_api_spec",
|
|
|
746
746
|
// might hold locally, e.g. the Slack recovery agent's CSV path).
|
|
747
747
|
strictTool("attach_file", "Upload a LOCAL file. This server reads and uploads the bytes, so they never pass through your context. " +
|
|
748
748
|
'`target: "card"` (default) attaches it to a card; `target: "inline_image"` uploads an image for a markdown body and replies `{url, markdown}` (below). The card attachment mirrors to the card\'s linked Trello card and Slack thread. 25 MB limit (413). ' +
|
|
749
|
-
"Card target returns `{issue, attachment_id, url, thumbnail_url, is_primary}`: `url` is permanent, embed it in any " +
|
|
749
|
+
"Card target returns `{issue, attachment_id, url, thumbnail_url, is_primary, next_step}`: `url` is permanent, embed it in any " +
|
|
750
750
|
"markdown field as `` and it renders inline. Use it when a screenshot or file judges something faster than prose, or instead of pasting a " +
|
|
751
751
|
"large CSV or log into a card field. " +
|
|
752
|
-
'`target: "inline_image"` instead uploads a local png/jpeg/gif/webp/avif (25 MB) with NO card and returns `{url, markdown}`: put the ' +
|
|
752
|
+
'`target: "inline_image"` instead uploads a local png/jpeg/gif/webp/avif (25 MB) with NO card and returns `{url, markdown, next_step}`: put the ' +
|
|
753
753
|
"markdown in any markdown body, notably a `POST /api/feedback` body (`50arms_api`'s `body_file` sends one raw png/jpg/webp/svg of at most 1 MB to a route that takes a file; this tool adds the upload routes, gif/avif, and the 25 MB limit).", {
|
|
754
754
|
target: z
|
|
755
755
|
.enum(["card", "inline_image"])
|
|
@@ -1061,7 +1061,7 @@ strictTool("session_connect",
|
|
|
1061
1061
|
.string()
|
|
1062
1062
|
.min(1)
|
|
1063
1063
|
.optional()
|
|
1064
|
-
.describe("What to hold: `PLAN-n` (a plan's `ref` in `50arms_api` `GET /api/plans`) or a card's id as the board shows it, for a card on no plan. Omit only to sign in (it still takes your team agent)."),
|
|
1064
|
+
.describe("What to hold: `PLAN-n` (a plan's `ref` in `50arms_api` `GET /api/plans`) or a card's id as the board shows it, for a card on no plan. Omit only to sign in (it still takes your team agent). A signed-out session another session started for this target signs in by itself, with no person approving."),
|
|
1065
1065
|
title: z.string().min(1).optional().describe(
|
|
1066
1066
|
// DX-4608: stored as sent; a wrong one does not refuse the connect, the reply's `naming` says what to rename it to.
|
|
1067
1067
|
"The `naming` block's exact `{Name}: PLAN-NNN {short title}` or `{Name}: {CARD-ID} {card title}`, after renaming this thread. Omit on the first connect."),
|
|
@@ -1087,7 +1087,9 @@ strictTool("session_connect",
|
|
|
1087
1087
|
.string()
|
|
1088
1088
|
.min(1)
|
|
1089
1089
|
.optional()
|
|
1090
|
-
.describe(
|
|
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."),
|
|
1091
1093
|
person_sign_in: z.boolean().optional().describe(
|
|
1092
1094
|
// 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.
|
|
1093
1095
|
"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."),
|
|
@@ -1112,7 +1114,8 @@ async (args) => {
|
|
|
1112
1114
|
return haltResult("session_connect: `disconnect: true` needs `target`, the plan or card this session currently holds");
|
|
1113
1115
|
}
|
|
1114
1116
|
// DX-4390 — no key yet: ask for one (or wait for the approval already asked for).
|
|
1115
|
-
|
|
1117
|
+
// 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);
|
|
1116
1119
|
if (!ready.signedIn)
|
|
1117
1120
|
return accessReply(ready);
|
|
1118
1121
|
if (args.target === undefined) {
|
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.476",
|
|
616
616
|
readOwnManifest
|
|
617
617
|
);
|
|
618
618
|
function envelope(now) {
|
package/dist/plan-events-tool.js
CHANGED
|
@@ -3,14 +3,26 @@ import { checkedTranscriptPath } from "./session-stats.js";
|
|
|
3
3
|
* DX-4233 - the body of the `plan_events_wait` tool: the transcript path is checked (a refusal names it), then the relay waits,
|
|
4
4
|
* and a cancelled request (`signal`, the SDK's `extra.signal`) drops the pending wait. A malformed cursor is refused by the relay.
|
|
5
5
|
*/
|
|
6
|
-
export function servePlanEventsWait(relay, args, signal) {
|
|
6
|
+
export async function servePlanEventsWait(relay, args, signal) {
|
|
7
7
|
const transcriptPath = args.transcript_path === undefined
|
|
8
8
|
? undefined
|
|
9
9
|
: checkedTranscriptPath(args.transcript_path, "plan_events_wait transcript_path");
|
|
10
|
-
|
|
10
|
+
const answer = await relay.wait({
|
|
11
11
|
planId: args.plan_id,
|
|
12
12
|
cursor: args.cursor,
|
|
13
13
|
timeoutMs: args.timeout_ms,
|
|
14
14
|
transcriptPath,
|
|
15
15
|
}, signal);
|
|
16
|
+
return { ...answer, next: nextStep(answer, args.cursor) };
|
|
17
|
+
}
|
|
18
|
+
/** DEC-1130 / DX-7604: the reply names its own next call, so no role text has to explain how to re-arm or what a stop means. */
|
|
19
|
+
export function nextStep(answer, sentCursor) {
|
|
20
|
+
if ("stopped" in answer) {
|
|
21
|
+
const { reason, fix } = answer.stopped;
|
|
22
|
+
return `Stopped (${reason}): ${fix} Do not call plan_events_wait again until that is done.`;
|
|
23
|
+
}
|
|
24
|
+
const last = answer.events[answer.events.length - 1];
|
|
25
|
+
if (last !== undefined)
|
|
26
|
+
return `Take every record, then call plan_events_wait again with cursor "${last.cursor}" (the newest record you took).`;
|
|
27
|
+
return `Nothing new: call plan_events_wait again with ${sentCursor === null ? "no cursor" : `cursor "${sentCursor}"`} (the one you sent).`;
|
|
16
28
|
}
|
package/dist/session-access.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { existsSync } from "node:fs";
|
|
28
28
|
import { hostname } from "node:os";
|
|
29
|
-
import { claimAccessRequest, createAccessRequest, } from "./access-request.js";
|
|
29
|
+
import { claimAccessRequest, claimLaunchGrant, createAccessRequest, } from "./access-request.js";
|
|
30
30
|
import { credentialFingerprint, } from "./credential.js";
|
|
31
31
|
import { keyRevocationOf, keyRevokedHalt, } from "./key-revoked-halt.js";
|
|
32
32
|
import { callMachineRegistration, deleteMachineRegistration, readMachineRegistration, writeMachineRegistration, } from "./machine-registration.js";
|
|
@@ -101,8 +101,14 @@ const REGISTRATION_STILL_MISMATCHED_ERROR = "the dashboard refused this sign-in
|
|
|
101
101
|
const NO_SESSION_ID_ERROR = "this server has no CLAUDE_CODE_SESSION_ID, so it cannot request a session key";
|
|
102
102
|
const CLAIMED_LOST_ERROR = "the dashboard says this request was already claimed, but this process never received the key; " +
|
|
103
103
|
"start a new request";
|
|
104
|
-
/** DX-6801: why
|
|
105
|
-
const launchNote = (why) => `The launch
|
|
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
|
+
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. */
|
|
107
|
+
function launchClaimWhy(claim) {
|
|
108
|
+
if (claim.kind === "rate_limited")
|
|
109
|
+
return `the dashboard rate limited the sign-in (retry after ${claim.retryAfterSeconds}s)`;
|
|
110
|
+
return launchRefusalWhy(claim);
|
|
111
|
+
}
|
|
106
112
|
function launchRefusalWhy(claim) {
|
|
107
113
|
switch (claim.kind) {
|
|
108
114
|
case "claimed":
|
|
@@ -298,16 +304,20 @@ export class SessionAccess {
|
|
|
298
304
|
* `session_connect` returns: the request just made, the one still pending (after waiting up to
|
|
299
305
|
* `awaitMs` for it), or why there is none. Calls run one at a time.
|
|
300
306
|
*
|
|
307
|
+
* 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
|
+
* 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
|
+
*
|
|
301
310
|
* DX-6801 / DEC-522: a signed-out session given the `launchToken` the session that started it passed in its prompt redeems it
|
|
302
311
|
* (once per process) through the public claim route, with no person approving. Any answer but `approved` spends the token and
|
|
303
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.
|
|
304
314
|
*/
|
|
305
|
-
ensureAccess(title, launchToken, role) {
|
|
306
|
-
const run = this.ensureQueue.then(() => this.ensureAccessNow(title, launchToken, role));
|
|
315
|
+
ensureAccess(title, launchToken, role, target) {
|
|
316
|
+
const run = this.ensureQueue.then(() => this.ensureAccessNow(title, launchToken, role, target));
|
|
307
317
|
this.ensureQueue = run.catch(() => undefined);
|
|
308
318
|
return run;
|
|
309
319
|
}
|
|
310
|
-
async ensureAccessNow(title, launchToken, role) {
|
|
320
|
+
async ensureAccessNow(title, launchToken, role, target) {
|
|
311
321
|
// DX-4418: a person revoked this session's access; it asks again only after `personSignIn` (DX-6894).
|
|
312
322
|
const revokedHalt = this.revokedHalt();
|
|
313
323
|
if (revokedHalt !== null)
|
|
@@ -319,6 +329,29 @@ export class SessionAccess {
|
|
|
319
329
|
return notReady({ state: "no_session_id", error: NO_SESSION_ID_ERROR }, true);
|
|
320
330
|
}
|
|
321
331
|
let note;
|
|
332
|
+
// DX-7586: only on a registered machine (its secret is the credential) and while no request of this process is open (a person's approval already in flight stays the way in).
|
|
333
|
+
if (target !== undefined &&
|
|
334
|
+
this.pending === null &&
|
|
335
|
+
readMachineRegistration(this.deps.dashboardUrl, this.deps.home) !== null) {
|
|
336
|
+
const claim = await claimLaunchGrant(this.fetchImpl, this.deps.dashboardUrl, {
|
|
337
|
+
machineSecret: machineSecretFor(this.deps.dashboardUrl, {
|
|
338
|
+
home: this.deps.home,
|
|
339
|
+
now: this.now(),
|
|
340
|
+
}),
|
|
341
|
+
labelId: sessionId,
|
|
342
|
+
target,
|
|
343
|
+
});
|
|
344
|
+
if (claim.kind === "approved") {
|
|
345
|
+
const stored = this.storeKey(claim.apiKey);
|
|
346
|
+
if (stored.kind === "approved")
|
|
347
|
+
return { signedIn: true };
|
|
348
|
+
if (stored.kind === "failed")
|
|
349
|
+
return notReady({ state: "request_failed", error: stored.error }, true);
|
|
350
|
+
}
|
|
351
|
+
else if (claim.kind !== "none") {
|
|
352
|
+
note = launchNote(launchClaimWhy(claim));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
322
355
|
// DX-6801: only while no request of this process is open (a person's approval already in flight stays the way in).
|
|
323
356
|
if (launchToken !== undefined &&
|
|
324
357
|
!this.launchTokenTried &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@50arms/platform-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.476",
|
|
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",
|