@50arms/platform-mcp 0.1.463 → 0.1.465
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/access-request.js +19 -6
- package/dist/agent-gate.js +19 -5
- package/dist/board-id.js +8 -2
- package/dist/checkout-docs-root.js +10 -2
- package/dist/clear-control.js +18 -4
- package/dist/compaction-control.js +30 -7
- package/dist/credential.js +10 -2
- package/dist/danxbot-api-examples.js +20 -3
- package/dist/design-screenshot.js +22 -5
- package/dist/digest-hold.js +14 -3
- package/dist/docs-tools.js +46 -12
- package/dist/durable-write.js +10 -2
- package/dist/forbidden-hint.js +13 -2
- package/dist/guarded-calls.js +7 -2
- package/dist/handlers.js +70 -15
- package/dist/heartbeat-reporter.js +8 -3
- package/dist/http-client.js +5 -3
- package/dist/index.js +252 -82
- package/dist/job-key.js +47 -0
- package/dist/json-body.js +3 -1
- package/dist/key-revoked-halt.js +2 -1
- package/dist/leftover-wire.js +17 -4
- package/dist/lifecycle.js +11 -3
- package/dist/listen.js +242 -64
- package/dist/listener-reminder.js +8 -2
- package/dist/machine-daemon/autostart.js +16 -4
- package/dist/machine-daemon/beat.js +18 -4
- package/dist/machine-daemon/cli.js +15 -4
- package/dist/machine-daemon/install.js +33 -9
- package/dist/machine-daemon/leftovers.js +134 -30
- package/dist/machine-daemon/state.js +9 -3
- package/dist/machine-daemon.js +531 -128
- package/dist/machine-registration.js +27 -6
- package/dist/machine-secret.js +8 -3
- package/dist/machine-toolkit.js +377 -81
- package/dist/mini-app-build.js +19 -5
- package/dist/mini-app-checkout.js +38 -10
- package/dist/mini-app-output.js +22 -5
- package/dist/mini-app-publish.js +34 -11
- package/dist/mini-app-restore.js +30 -9
- package/dist/one-line.js +3 -1
- package/dist/permission-request.js +14 -3
- package/dist/permission-watch.js +10 -3
- package/dist/plan-events-relay.js +96 -19
- package/dist/plan-events-tool.js +9 -2
- package/dist/plugin-publish.js +23 -6
- package/dist/plugin-screenshot.js +18 -6
- package/dist/restart-notice.js +47 -15
- package/dist/result-limit.js +6 -1
- package/dist/role-instruction-file.js +16 -4
- package/dist/route-board-scope.generated.js +5 -0
- package/dist/route-board-scope.js +6 -2
- package/dist/session-access.js +114 -33
- package/dist/session-connection.js +23 -7
- package/dist/session-control-file.js +1 -1
- package/dist/session-key.js +12 -4
- package/dist/session-options.js +6 -2
- package/dist/session-stats.js +2 -1
- package/dist/session-stream.js +81 -20
- package/dist/shutdown.js +3 -1
- package/dist/subagents-live.js +8 -2
- package/dist/terms-halt.js +4 -2
- package/dist/tool-access.js +17 -4
- package/dist/tool-surface.js +9 -2
- package/dist/transcript-lineage.js +5 -2
- package/dist/urgent-records.js +1 -0
- package/package.json +1 -1
package/dist/handlers.js
CHANGED
|
@@ -55,10 +55,21 @@ const PLAN_SESSIONS_BASE_PATH = "/api/plan-sessions";
|
|
|
55
55
|
export async function sessionConnect(client, args) {
|
|
56
56
|
if (args.disconnect === true) {
|
|
57
57
|
if (args.title !== undefined) {
|
|
58
|
-
return {
|
|
58
|
+
return {
|
|
59
|
+
ok: false,
|
|
60
|
+
status: 400,
|
|
61
|
+
body: {
|
|
62
|
+
error: "session_connect: `disconnect: true` takes no `title` — a leave changes no title",
|
|
63
|
+
},
|
|
64
|
+
};
|
|
59
65
|
}
|
|
60
66
|
// DX-2985 — `DELETE /api/plan-sessions/me/connect?target=`: `me` is the forwarded session id, so only the caller's own session leaves.
|
|
61
|
-
return client.request({
|
|
67
|
+
return client.request({
|
|
68
|
+
method: "DELETE",
|
|
69
|
+
path: "/me/connect",
|
|
70
|
+
basePath: PLAN_SESSIONS_BASE_PATH,
|
|
71
|
+
query: { target: args.target },
|
|
72
|
+
});
|
|
62
73
|
}
|
|
63
74
|
return client.request({
|
|
64
75
|
method: "POST",
|
|
@@ -67,7 +78,9 @@ export async function sessionConnect(client, args) {
|
|
|
67
78
|
body: {
|
|
68
79
|
target: args.target,
|
|
69
80
|
...(args.title === undefined ? {} : { title: args.title }),
|
|
70
|
-
...(args.assignment_id === undefined
|
|
81
|
+
...(args.assignment_id === undefined
|
|
82
|
+
? {}
|
|
83
|
+
: { assignment_id: args.assignment_id }),
|
|
71
84
|
},
|
|
72
85
|
});
|
|
73
86
|
}
|
|
@@ -77,7 +90,11 @@ export async function sessionConnect(client, args) {
|
|
|
77
90
|
* and personality, or `agent_needed` / `agent_limit_reached` when the session has none (see `agent-gate.ts`).
|
|
78
91
|
*/
|
|
79
92
|
export async function claimSessionAgent(client) {
|
|
80
|
-
return client.request({
|
|
93
|
+
return client.request({
|
|
94
|
+
method: "POST",
|
|
95
|
+
path: "/me/agent",
|
|
96
|
+
basePath: PLAN_SESSIONS_BASE_PATH,
|
|
97
|
+
});
|
|
81
98
|
}
|
|
82
99
|
// DX-3465 (code-architecture gate finding, at 275f82c0d) — the dedicated
|
|
83
100
|
// `resource_fields` handler (DX-3426) was deleted from here: it was a thin
|
|
@@ -85,9 +102,16 @@ export async function claimSessionAgent(client) {
|
|
|
85
102
|
// already reaches with nothing agent-specific in it. See `index.ts`'s own
|
|
86
103
|
// note at the former tool-registration site.
|
|
87
104
|
// ---------------- 50arms_api (DX-3465, PLN-11 R-25) ----------------
|
|
88
|
-
export const DANXBOT_API_METHODS = [
|
|
105
|
+
export const DANXBOT_API_METHODS = [
|
|
106
|
+
"GET",
|
|
107
|
+
"POST",
|
|
108
|
+
"PATCH",
|
|
109
|
+
"PUT",
|
|
110
|
+
"DELETE",
|
|
111
|
+
];
|
|
89
112
|
export function isDanxbotApiMethod(value) {
|
|
90
|
-
return typeof value === "string" &&
|
|
113
|
+
return (typeof value === "string" &&
|
|
114
|
+
DANXBOT_API_METHODS.includes(value));
|
|
91
115
|
}
|
|
92
116
|
/** The file types a `body_file` may carry, by extension; the content type sent is the one the extension names. The one route that takes a file today re-draws each as a PNG (the proposal avatar). */
|
|
93
117
|
export const BODY_FILE_MIME_BY_EXT = {
|
|
@@ -152,9 +176,13 @@ async function readRawBodyFile(path, deps) {
|
|
|
152
176
|
* route that used to attach a reminder to a deleted per-operation tool's
|
|
153
177
|
* response still attaches it here, with zero special MCP-side plumbing).
|
|
154
178
|
*/
|
|
155
|
-
export async function danxbotApi(client, args, deps = {}
|
|
179
|
+
export async function danxbotApi(client, args, deps = {},
|
|
180
|
+
// DX-7098: a system job's key (`job-key.ts`), never a model-supplied value: `DanxbotApiArgs` still carries no credential.
|
|
181
|
+
bearer) {
|
|
156
182
|
// The file is checked and read BEFORE the request, so a bad path leaves nothing behind on the dashboard.
|
|
157
|
-
const rawBody = args.body_file === undefined
|
|
183
|
+
const rawBody = args.body_file === undefined
|
|
184
|
+
? undefined
|
|
185
|
+
: await readRawBodyFile(args.body_file, deps);
|
|
158
186
|
return client.request({
|
|
159
187
|
method: args.method,
|
|
160
188
|
// `basePath: ""` — `path` here is the FULL absolute path already (see
|
|
@@ -169,6 +197,7 @@ export async function danxbotApi(client, args, deps = {}) {
|
|
|
169
197
|
rawBody,
|
|
170
198
|
board: args.board,
|
|
171
199
|
background: args.background,
|
|
200
|
+
...(bearer === undefined ? {} : { bearer }),
|
|
172
201
|
});
|
|
173
202
|
}
|
|
174
203
|
// ---------------- 50arms_api_list (DX-3465 A5, PLN-11 R-25) ----------------
|
|
@@ -258,7 +287,8 @@ export const INLINE_IMAGE_MIME_BY_EXT = {
|
|
|
258
287
|
};
|
|
259
288
|
export const MAX_INLINE_IMAGE_BYTES = 25 * 1024 * 1024;
|
|
260
289
|
export function inferAttachmentMime(filename) {
|
|
261
|
-
return MIME_BY_EXT[posix.extname(filename).toLowerCase()] ??
|
|
290
|
+
return (MIME_BY_EXT[posix.extname(filename).toLowerCase()] ??
|
|
291
|
+
"application/octet-stream");
|
|
262
292
|
}
|
|
263
293
|
/**
|
|
264
294
|
* Attach a local file to a card (`target` "card", the default; replies with the attachment row) or, with `target: "inline_image"`, upload
|
|
@@ -303,7 +333,9 @@ export async function attachFile(client, args, deps = {}) {
|
|
|
303
333
|
// A missing / unreadable file rejects here — no HTTP call is made, so no
|
|
304
334
|
// S3 upload, no row insert, and no projection are ever triggered.
|
|
305
335
|
const bytes = await read(args.path);
|
|
306
|
-
const contentTypeOf = (name) =>
|
|
336
|
+
const contentTypeOf = (name) => args.content_type?.trim()
|
|
337
|
+
? args.content_type.trim()
|
|
338
|
+
: inferAttachmentMime(name);
|
|
307
339
|
const issuePath = `/${encodeURIComponent(args.card_id)}/attachments`;
|
|
308
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.
|
|
309
341
|
const primary = args.primary === undefined ? {} : { primary: args.primary };
|
|
@@ -312,16 +344,27 @@ export async function attachFile(client, args, deps = {}) {
|
|
|
312
344
|
method: "PUT",
|
|
313
345
|
basePath: "/api/issues",
|
|
314
346
|
path: `${issuePath}/${args.replaces}`,
|
|
315
|
-
body: {
|
|
347
|
+
body: {
|
|
348
|
+
contentType: contentTypeOf(basename(args.path)),
|
|
349
|
+
base64: bytes.toString("base64"),
|
|
350
|
+
...primary,
|
|
351
|
+
},
|
|
316
352
|
board: args.board,
|
|
317
353
|
});
|
|
318
354
|
}
|
|
319
|
-
const filename = args.filename?.trim()
|
|
355
|
+
const filename = args.filename?.trim()
|
|
356
|
+
? args.filename.trim()
|
|
357
|
+
: basename(args.path);
|
|
320
358
|
return client.request({
|
|
321
359
|
method: "POST",
|
|
322
360
|
basePath: "/api/issues",
|
|
323
361
|
path: issuePath,
|
|
324
|
-
body: {
|
|
362
|
+
body: {
|
|
363
|
+
filename,
|
|
364
|
+
contentType: contentTypeOf(filename),
|
|
365
|
+
base64: bytes.toString("base64"),
|
|
366
|
+
...primary,
|
|
367
|
+
},
|
|
325
368
|
board: args.board,
|
|
326
369
|
});
|
|
327
370
|
}
|
|
@@ -331,7 +374,14 @@ export async function attachFile(client, args, deps = {}) {
|
|
|
331
374
|
* Everything that makes no sense for an inline image (a card, a replace, a cover flag, a name or type override) is refused before any read.
|
|
332
375
|
*/
|
|
333
376
|
async function uploadInlineImage(client, args, read, fileSize, { basename, extname }) {
|
|
334
|
-
for (const key of [
|
|
377
|
+
for (const key of [
|
|
378
|
+
"card_id",
|
|
379
|
+
"filename",
|
|
380
|
+
"content_type",
|
|
381
|
+
"replaces",
|
|
382
|
+
"primary",
|
|
383
|
+
"board",
|
|
384
|
+
]) {
|
|
335
385
|
if (args[key] !== undefined)
|
|
336
386
|
throw new Error(`attach_file: ${key} cannot be set with target inline_image`);
|
|
337
387
|
}
|
|
@@ -348,7 +398,12 @@ async function uploadInlineImage(client, args, read, fileSize, { basename, extna
|
|
|
348
398
|
throw new Error(`attach_file: "${args.path}" is ${size} bytes; the limit is ${MAX_INLINE_IMAGE_BYTES} (25 MB)`);
|
|
349
399
|
}
|
|
350
400
|
const bytes = await read(args.path);
|
|
351
|
-
const result = await client.request({
|
|
401
|
+
const result = await client.request({
|
|
402
|
+
method: "POST",
|
|
403
|
+
basePath: "/api/uploads",
|
|
404
|
+
path: "/images",
|
|
405
|
+
rawBody: { bytes, contentType },
|
|
406
|
+
});
|
|
352
407
|
if (!result.ok)
|
|
353
408
|
return result;
|
|
354
409
|
const url = result.body?.url;
|
|
@@ -11,7 +11,7 @@ import { keyRevokedHalt } from "./key-revoked-halt.js";
|
|
|
11
11
|
import { oneLine } from "./one-line.js";
|
|
12
12
|
import { DIGEST_PREFIX } from "./digest-hold.js";
|
|
13
13
|
import { HEARTBEAT_SILENT_FAILURE_THRESHOLD, HEARTBEAT_SUSTAINED_OUTAGE_MS, sendHeartbeat, } from "./session-stream.js";
|
|
14
|
-
import { OperatorSessionStats } from "./session-stats.js";
|
|
14
|
+
import { OperatorSessionStats, } from "./session-stats.js";
|
|
15
15
|
import { TranscriptTitleReader } from "./session-title.js";
|
|
16
16
|
/** DX-5415: how long a stop waits for the final settle (drain + one stats flush) before giving up; shutdown must stay bounded. */
|
|
17
17
|
export const FINAL_SETTLE_BOUND_MS = 10_000;
|
|
@@ -40,7 +40,10 @@ export class HeartbeatReporter {
|
|
|
40
40
|
this.deps = deps;
|
|
41
41
|
this.transcriptPath = transcriptPath;
|
|
42
42
|
this.sessionStats = new OperatorSessionStats(transcriptPath, deps.makeStatsWatcher);
|
|
43
|
-
this.titleReader =
|
|
43
|
+
this.titleReader =
|
|
44
|
+
transcriptPath === null
|
|
45
|
+
? null
|
|
46
|
+
: new TranscriptTitleReader(transcriptPath);
|
|
44
47
|
}
|
|
45
48
|
/**
|
|
46
49
|
* The relay learns the session's transcript from each `plan_events_wait` call, after the reporter exists: a different path
|
|
@@ -91,7 +94,9 @@ export class HeartbeatReporter {
|
|
|
91
94
|
try {
|
|
92
95
|
const title = this.titleReader.read();
|
|
93
96
|
this.lastTitleError = null;
|
|
94
|
-
return title !== null && title !== this.dashboardTitle
|
|
97
|
+
return title !== null && title !== this.dashboardTitle
|
|
98
|
+
? title
|
|
99
|
+
: undefined;
|
|
95
100
|
}
|
|
96
101
|
catch (err) {
|
|
97
102
|
const message = err instanceof Error ? err.message : String(err);
|
package/dist/http-client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { boardStampOf, takesBoardInBody } from "./route-board-scope.js";
|
|
2
|
-
import { assertVersionFloorSatisfied, MCP_MIN_VERSION_HEADER, MCP_VERSION_HEADER, readOwnVersion } from "./version-floor.js";
|
|
2
|
+
import { assertVersionFloorSatisfied, MCP_MIN_VERSION_HEADER, MCP_VERSION_HEADER, readOwnVersion, } from "./version-floor.js";
|
|
3
3
|
import { PLUGIN_BACKGROUND_HEADER } from "./session-options.js";
|
|
4
4
|
/** `<basePath><path>` with the path's own query string cut off and its leading slash normalised (an empty or "/" path adds nothing). */
|
|
5
5
|
function routePathOf(path, basePath = "/api/issues") {
|
|
@@ -40,7 +40,7 @@ export class DashboardHttpClient {
|
|
|
40
40
|
}
|
|
41
41
|
const url = this.buildUrl(args.method, args.path, args.query, args.board, args.basePath);
|
|
42
42
|
const headers = {
|
|
43
|
-
Authorization: `Bearer ${this.config.token}`,
|
|
43
|
+
Authorization: `Bearer ${args.bearer ?? this.config.token}`,
|
|
44
44
|
Accept: "application/json",
|
|
45
45
|
};
|
|
46
46
|
// DX-1398 Hop 3 (outbound) — stamp the cross-process trace at the SAME
|
|
@@ -162,7 +162,9 @@ export class DashboardHttpClient {
|
|
|
162
162
|
if (board !== undefined)
|
|
163
163
|
params.set("board", String(board));
|
|
164
164
|
}
|
|
165
|
-
else if (boardInQuery &&
|
|
165
|
+
else if (boardInQuery &&
|
|
166
|
+
stamp === "named" &&
|
|
167
|
+
boardOverride !== undefined) {
|
|
166
168
|
params.set("board", String(boardOverride));
|
|
167
169
|
}
|
|
168
170
|
if (extraQuery) {
|