@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
|
@@ -42,7 +42,13 @@ export function readMachineRegistration(dashboardUrl, home) {
|
|
|
42
42
|
if (record.schemaVersion !== MACHINE_REGISTRATION_SCHEMA_VERSION) {
|
|
43
43
|
throw unusable(path, `schemaVersion is ${JSON.stringify(record.schemaVersion)}, not ${MACHINE_REGISTRATION_SCHEMA_VERSION}`);
|
|
44
44
|
}
|
|
45
|
-
for (const key of [
|
|
45
|
+
for (const key of [
|
|
46
|
+
"dashboardUrl",
|
|
47
|
+
"machineId",
|
|
48
|
+
"teamName",
|
|
49
|
+
"username",
|
|
50
|
+
"registeredAt",
|
|
51
|
+
]) {
|
|
46
52
|
if (typeof record[key] !== "string")
|
|
47
53
|
throw unusable(path, `${key} is not a string`);
|
|
48
54
|
}
|
|
@@ -50,7 +56,8 @@ export function readMachineRegistration(dashboardUrl, home) {
|
|
|
50
56
|
if (typeof record[key] !== "number")
|
|
51
57
|
throw unusable(path, `${key} is not a number`);
|
|
52
58
|
}
|
|
53
|
-
if (record.dashboardUrl.replace(/\/+$/, "") !==
|
|
59
|
+
if (record.dashboardUrl.replace(/\/+$/, "") !==
|
|
60
|
+
dashboardUrl.replace(/\/+$/, "")) {
|
|
54
61
|
throw unusable(path, `it names the dashboard ${JSON.stringify(record.dashboardUrl)}, not ${dashboardUrl}`);
|
|
55
62
|
}
|
|
56
63
|
return record;
|
|
@@ -76,13 +83,24 @@ export function deleteMachineRegistration(dashboardUrl, home) {
|
|
|
76
83
|
rmSync(machineRegistrationPath(dashboardUrl, home), { force: true });
|
|
77
84
|
}
|
|
78
85
|
function asPending(json, url) {
|
|
79
|
-
if (typeof json.claimCode !== "string" ||
|
|
86
|
+
if (typeof json.claimCode !== "string" ||
|
|
87
|
+
typeof json.registrationUrl !== "string" ||
|
|
88
|
+
typeof json.pollMs !== "number") {
|
|
80
89
|
throw new Error(`[platform-mcp] POST ${url} answered pending without its fields: ${JSON.stringify(json)}`);
|
|
81
90
|
}
|
|
82
|
-
return {
|
|
91
|
+
return {
|
|
92
|
+
kind: "pending",
|
|
93
|
+
claimCode: json.claimCode,
|
|
94
|
+
registrationUrl: json.registrationUrl,
|
|
95
|
+
pollMs: json.pollMs,
|
|
96
|
+
};
|
|
83
97
|
}
|
|
84
98
|
function asAccepted(json, url) {
|
|
85
|
-
if (typeof json.machineId !== "string" ||
|
|
99
|
+
if (typeof json.machineId !== "string" ||
|
|
100
|
+
typeof json.teamId !== "number" ||
|
|
101
|
+
typeof json.teamName !== "string" ||
|
|
102
|
+
typeof json.userId !== "number" ||
|
|
103
|
+
typeof json.username !== "string") {
|
|
86
104
|
throw new Error(`[platform-mcp] POST ${url} answered accepted without its fields: ${JSON.stringify(json)}`);
|
|
87
105
|
}
|
|
88
106
|
return {
|
|
@@ -110,6 +128,9 @@ export async function callMachineRegistration(fetchImpl, dashboardUrl, input) {
|
|
|
110
128
|
if (status === 404)
|
|
111
129
|
return { kind: "dashboard_outdated" };
|
|
112
130
|
if (status === 429)
|
|
113
|
-
return {
|
|
131
|
+
return {
|
|
132
|
+
kind: "rate_limited",
|
|
133
|
+
retryAfterSeconds: retryAfterSeconds(headers),
|
|
134
|
+
};
|
|
114
135
|
return { kind: "refused", status, body: json };
|
|
115
136
|
}
|
package/dist/machine-secret.js
CHANGED
|
@@ -22,7 +22,10 @@ export const MACHINE_SECRET_SCHEMA_VERSION = 1;
|
|
|
22
22
|
/** The dashboard refuses a shorter secret (`MACHINE_SECRET_MIN` in `src/dashboard/access-request-routes.ts`); 32 random bytes as hex is twice that. */
|
|
23
23
|
const SECRET_BYTES = 32;
|
|
24
24
|
const SECRET_MIN_LENGTH = 32;
|
|
25
|
-
export const dashboardHash = (dashboardUrl) => createHash("sha256")
|
|
25
|
+
export const dashboardHash = (dashboardUrl) => createHash("sha256")
|
|
26
|
+
.update(dashboardUrl.replace(/\/+$/, ""))
|
|
27
|
+
.digest("hex")
|
|
28
|
+
.slice(0, 12);
|
|
26
29
|
/** DX-7010: the one home every process on a host resolves the secret from, the MCP and the daemon's installer alike: a different home would be a second secret and a second identity for the host. */
|
|
27
30
|
export const machineSecretHome = () => homedir();
|
|
28
31
|
export function machineSecretPath(dashboardUrl, home = machineSecretHome()) {
|
|
@@ -55,10 +58,12 @@ function readSecret(path, dashboardUrl) {
|
|
|
55
58
|
if (record.schemaVersion !== MACHINE_SECRET_SCHEMA_VERSION) {
|
|
56
59
|
throw unusable(path, `schemaVersion is ${JSON.stringify(record.schemaVersion)}, not ${MACHINE_SECRET_SCHEMA_VERSION}`);
|
|
57
60
|
}
|
|
58
|
-
if (typeof record.secret !== "string" ||
|
|
61
|
+
if (typeof record.secret !== "string" ||
|
|
62
|
+
record.secret.length < SECRET_MIN_LENGTH) {
|
|
59
63
|
throw unusable(path, `secret is not a string of at least ${SECRET_MIN_LENGTH} characters`);
|
|
60
64
|
}
|
|
61
|
-
if (typeof record.dashboardUrl !== "string" ||
|
|
65
|
+
if (typeof record.dashboardUrl !== "string" ||
|
|
66
|
+
record.dashboardUrl.replace(/\/+$/, "") !== dashboardUrl.replace(/\/+$/, "")) {
|
|
62
67
|
throw unusable(path, `it names the dashboard ${JSON.stringify(record.dashboardUrl)}, not ${dashboardUrl}`);
|
|
63
68
|
}
|
|
64
69
|
return record.secret;
|