machine-bridge-mcp 0.9.0 → 0.11.0
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/CHANGELOG.md +50 -0
- package/README.md +76 -23
- package/SECURITY.md +16 -2
- package/browser-extension/manifest.json +33 -0
- package/browser-extension/page-automation.js +246 -0
- package/browser-extension/pairing.js +19 -0
- package/browser-extension/service-worker.js +406 -0
- package/docs/AGENT_CONTEXT.md +134 -124
- package/docs/ARCHITECTURE.md +29 -9
- package/docs/CLIENTS.md +8 -0
- package/docs/ENGINEERING.md +10 -2
- package/docs/LOCAL_AUTOMATION.md +111 -0
- package/docs/LOGGING.md +10 -1
- package/docs/OPERATIONS.md +49 -0
- package/docs/PRIVACY.md +10 -1
- package/docs/RELEASING.md +2 -2
- package/docs/TESTING.md +7 -5
- package/package.json +13 -7
- package/scripts/sync-worker-version.mjs +27 -12
- package/src/local/agent-context.mjs +248 -15
- package/src/local/app-automation.mjs +400 -0
- package/src/local/browser-bridge.mjs +757 -0
- package/src/local/cli.mjs +156 -17
- package/src/local/default-instructions.mjs +337 -0
- package/src/local/runtime.mjs +114 -4
- package/src/local/state.mjs +8 -4
- package/src/local/stdio.mjs +12 -7
- package/src/shared/server-metadata.json +4 -1
- package/src/shared/tool-catalog.json +854 -1
- package/src/worker/index.ts +24 -4
package/src/worker/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import toolCatalog from "../shared/tool-catalog.json";
|
|
|
3
3
|
import serverMetadata from "../shared/server-metadata.json";
|
|
4
4
|
|
|
5
5
|
const SERVER_NAME = String(serverMetadata.name);
|
|
6
|
-
const SERVER_VERSION = "0.
|
|
6
|
+
const SERVER_VERSION = "0.11.0";
|
|
7
7
|
const MCP_PROTOCOL_VERSION = String(serverMetadata.protocolVersion);
|
|
8
8
|
const MCP_SUPPORTED_PROTOCOL_VERSIONS = serverMetadata.supportedProtocolVersions.map((value) => String(value));
|
|
9
9
|
const JSONRPC_VERSION = "2.0";
|
|
@@ -357,6 +357,10 @@ export class BridgeRoom extends DurableObject<BridgeEnv> {
|
|
|
357
357
|
const protocolVersion = typeof requested === "string" && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(requested as typeof MCP_SUPPORTED_PROTOCOL_VERSIONS[number])
|
|
358
358
|
? requested
|
|
359
359
|
: MCP_PROTOCOL_VERSION;
|
|
360
|
+
const bootstrap = this.daemonToolEnabled("session_bootstrap")
|
|
361
|
+
? await this.callDaemonTool("session_bootstrap", { path: "." }).catch(() => null)
|
|
362
|
+
: null;
|
|
363
|
+
const localInstructions = sessionInstructionText(bootstrap);
|
|
360
364
|
return rpcResult(request.id, {
|
|
361
365
|
protocolVersion,
|
|
362
366
|
capabilities: { tools: { listChanged: false }, logging: {} },
|
|
@@ -366,7 +370,7 @@ export class BridgeRoom extends DurableObject<BridgeEnv> {
|
|
|
366
370
|
version: SERVER_VERSION,
|
|
367
371
|
description: "Workspace-scoped local coding tools over authenticated remote relay.",
|
|
368
372
|
},
|
|
369
|
-
instructions: MCP_INSTRUCTIONS,
|
|
373
|
+
instructions: localInstructions ? `${MCP_INSTRUCTIONS}\n\n--- LOCAL SESSION INSTRUCTIONS ---\n${localInstructions}` : MCP_INSTRUCTIONS,
|
|
370
374
|
});
|
|
371
375
|
}
|
|
372
376
|
if (request.method === "notifications/initialized") return null;
|
|
@@ -1179,11 +1183,27 @@ function clampNumber(value: unknown, fallback: number, min: number, max: number)
|
|
|
1179
1183
|
}
|
|
1180
1184
|
|
|
1181
1185
|
function daemonToolTimeoutMs(name: string, args: Record<string, unknown>): number {
|
|
1182
|
-
if (name
|
|
1183
|
-
const
|
|
1186
|
+
if (name === "session_bootstrap") return 10_000;
|
|
1187
|
+
const configurable = new Set([
|
|
1188
|
+
"exec_command", "run_process", "run_local_command", "open_local_application",
|
|
1189
|
+
"inspect_local_application", "operate_local_application", "browser_list_tabs",
|
|
1190
|
+
"browser_get_source", "browser_inspect_page", "browser_action", "browser_fill_form",
|
|
1191
|
+
"browser_screenshot", "browser_upload_files",
|
|
1192
|
+
]);
|
|
1193
|
+
if (!configurable.has(name)) return 60_000;
|
|
1194
|
+
const seconds = clampNumber(args.timeout_seconds, name === "browser_fill_form" ? 60 : 120, 1, 600);
|
|
1184
1195
|
return Math.min((seconds + 5) * 1000, 610_000);
|
|
1185
1196
|
}
|
|
1186
1197
|
|
|
1198
|
+
function sessionInstructionText(value: unknown): string {
|
|
1199
|
+
const object = asObject(value);
|
|
1200
|
+
const instructions = typeof object.instructions === "string" ? object.instructions : "";
|
|
1201
|
+
if (!instructions) return "";
|
|
1202
|
+
const bytes = new TextEncoder().encode(instructions);
|
|
1203
|
+
if (bytes.byteLength > 3 * 1024 * 1024) return "";
|
|
1204
|
+
return instructions;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1187
1207
|
function validateProtocolVersionHeader(request: Request, body: JsonRpcRequest): Record<string, unknown> | null {
|
|
1188
1208
|
if (body.method === "initialize") return null;
|
|
1189
1209
|
const version = request.headers.get("MCP-Protocol-Version");
|