@creatornader/agent-bridge 0.7.4 → 0.7.8
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 +48 -1
- package/README.md +3 -1
- package/SECURITY.md +7 -1
- package/dist/loopback-host.js.map +1 -1
- package/docs/deployment.md +9 -1
- package/docs/postmortems/2026-07-08-wrapper-source-drift.md +48 -33
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,46 @@ All notable changes to agent-bridge are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.7.8] - 2026-10-23
|
|
10
|
+
|
|
11
|
+
### Security
|
|
12
|
+
|
|
13
|
+
- Bump `@modelcontextprotocol/sdk` to 1.32.2, `vitest` to 5.0.5, `zod` to 4.6.7,
|
|
14
|
+
`ip-address` to 10.7.4, `fast-uri` to 3.1.8, `hono` to 4.13.11, and
|
|
15
|
+
`body-parser` to 2.4.0.
|
|
16
|
+
- Run OSV scans on all pull requests, including Dependabot and fork updates.
|
|
17
|
+
SARIF results attach to the pull request and fail the check when vulnerabilities
|
|
18
|
+
remain.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Accept npm 12 array output when verifying an already published package.
|
|
23
|
+
|
|
24
|
+
## [0.7.7] - 2026-07-30
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Publish the packed package before checking npm for immutable release recovery.
|
|
29
|
+
|
|
30
|
+
## [0.7.6] - 2026-07-30
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Read release package metadata directly from the verified tarball before checking
|
|
35
|
+
the immutable npm version during recovery.
|
|
36
|
+
|
|
37
|
+
## [0.7.5] - 2026-07-30
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- Create a canonical immutable GitHub Release only after the tagged gateway and npm
|
|
42
|
+
publication gates succeed. Release pages now use the same tag and `Agent Bridge
|
|
43
|
+
v<version>` title for every new version.
|
|
44
|
+
- Make release recovery verify an already published package from the packed artifact
|
|
45
|
+
instead of failing on an immutable npm version.
|
|
46
|
+
|
|
7
47
|
## [0.7.4] - 2026-07-30
|
|
8
48
|
|
|
9
49
|
### Fixed
|
|
@@ -528,7 +568,14 @@ First tagged release. Marks the point where agent-bridge has shipped its initial
|
|
|
528
568
|
- Narrative-leak detection in CI + on commit via `creatornader/textleaks@v0.2.0` (renamed from leakguard).
|
|
529
569
|
|
|
530
570
|
[0.1.0]: https://github.com/creatornader/agent-bridge/releases/tag/v0.1.0
|
|
531
|
-
[Unreleased]: https://github.com/creatornader/agent-bridge/compare/v0.
|
|
571
|
+
[Unreleased]: https://github.com/creatornader/agent-bridge/compare/v0.7.7...HEAD
|
|
572
|
+
[0.7.7]: https://github.com/creatornader/agent-bridge/compare/v0.7.6...v0.7.7
|
|
573
|
+
[0.7.6]: https://github.com/creatornader/agent-bridge/compare/v0.7.5...v0.7.6
|
|
574
|
+
[0.7.5]: https://github.com/creatornader/agent-bridge/compare/v0.7.4...v0.7.5
|
|
575
|
+
[0.7.4]: https://github.com/creatornader/agent-bridge/compare/v0.7.3...v0.7.4
|
|
576
|
+
[0.7.3]: https://github.com/creatornader/agent-bridge/compare/v0.7.2...v0.7.3
|
|
577
|
+
[0.7.2]: https://github.com/creatornader/agent-bridge/compare/v0.7.1...v0.7.2
|
|
578
|
+
[0.7.1]: https://github.com/creatornader/agent-bridge/compare/v0.7.0...v0.7.1
|
|
532
579
|
[0.6.4]: https://github.com/creatornader/agent-bridge/compare/v0.6.3...v0.6.4
|
|
533
580
|
[0.6.3]: https://github.com/creatornader/agent-bridge/compare/v0.6.2...v0.6.3
|
|
534
581
|
[0.6.2]: https://github.com/creatornader/agent-bridge/compare/v0.6.1...v0.6.2
|
package/README.md
CHANGED
|
@@ -150,7 +150,9 @@ The authenticated check compares the running package and Git revision with the
|
|
|
150
150
|
intended release. It also requires protocol 2.1, request authority, and row isolation.
|
|
151
151
|
It prints no credential. A missing or different revision stops the rollout.
|
|
152
152
|
|
|
153
|
-
Release tags run this deployment gate before npm publication.
|
|
153
|
+
Release tags run this deployment gate before npm publication. After the package is
|
|
154
|
+
published, the workflow creates the immutable GitHub Release for the same tag with
|
|
155
|
+
the canonical title `Agent Bridge v<version>`. The release environment
|
|
154
156
|
must define `AGENT_BRIDGE_FLY_APP` and `AGENT_BRIDGE_GATEWAY_ORIGIN`, and keep
|
|
155
157
|
`FLY_API_TOKEN` plus `RELEASE_VERIFY_TOKEN` as protected secrets. The manual `gateway
|
|
156
158
|
production proof` workflow tests the deployed gateway after this gate passes. GitHub
|
package/SECURITY.md
CHANGED
|
@@ -4,13 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
| Version | Security updates |
|
|
6
6
|
| --- | --- |
|
|
7
|
-
| 0.
|
|
7
|
+
| 0.7.x | Supported |
|
|
8
|
+
| 0.6.x | Not supported |
|
|
9
|
+
| 0.5.x | Not supported |
|
|
10
|
+
| 0.4.x | Not supported |
|
|
11
|
+
| 0.3.x | Not supported |
|
|
8
12
|
| 0.2.x | Not supported |
|
|
9
13
|
| 0.1.x | Not supported |
|
|
10
14
|
| Unreleased development code | No public support guarantee |
|
|
11
15
|
|
|
12
16
|
Upgrade to the latest published package before reporting a defect that may already be
|
|
13
17
|
fixed. The npm package and GitHub release page are the public version authorities.
|
|
18
|
+
Projects that install Agent Bridge as a dependency must update and commit their own
|
|
19
|
+
lockfile. This repository's overrides do not apply to downstream npm projects.
|
|
14
20
|
|
|
15
21
|
## Release integrity
|
|
16
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/loopback-host.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { chmodSync, existsSync, mkdirSync, realpathSync, rmSync, writeFileSync } from \"node:fs\";\nimport { createServer, type IncomingMessage, type Server as HttpServer, type ServerResponse } from \"node:http\";\nimport { connect, type AddressInfo } from \"node:net\";\nimport { homedir } from \"node:os\";\nimport { dirname, isAbsolute, join } from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { StreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/streamableHttp.js\";\nimport { isInitializeRequest } from \"@modelcontextprotocol/sdk/types.js\";\nimport { configFromEnv, createAgentBridgeServer } from \"./server.js\";\nimport { verifyPrivatePathAccess } from \"./private-path.js\";\n\nconst DEFAULT_HOST = \"127.0.0.1\";\nconst DEFAULT_PORT = 8794;\nconst DEFAULT_PATH = \"/mcp\";\nconst DEFAULT_SESSION_IDLE_MS = 12 * 60 * 60 * 1000;\nconst MAX_BODY_BYTES = 1024 * 1024;\n\nexport interface LoopbackHostOptions {\n host?: string;\n port?: number;\n path?: string;\n sessionIdleMs?: number;\n}\n\nexport interface LoopbackHost {\n endpoint: string;\n healthEndpoint: string;\n close(): Promise<void>;\n}\n\nexport interface LaunchdInstallOptions extends Required<LoopbackHostOptions> {\n serviceName: string;\n configPath: string;\n agent: string;\n instance: string;\n home?: string;\n executablePath?: string;\n}\n\ninterface Session {\n bridge: ReturnType<typeof createAgentBridgeServer>;\n transport: StreamableHTTPServerTransport;\n id?: string;\n lastSeenAt: number;\n closing: boolean;\n}\n\nfunction normalizePath(raw: string): string {\n const path = raw.startsWith(\"/\") ? raw : `/${raw}`;\n return path.length > 1 ? path.replace(/\\/+$/, \"\") : path;\n}\n\nfunction isLoopback(host: string): boolean {\n return host === \"127.0.0.1\" || host === \"::1\" || host === \"localhost\";\n}\n\nfunction endpoint(host: string, port: number, path: string): string {\n return `http://${host.includes(\":\") ? `[${host}]` : host}:${port}${path}`;\n}\n\nfunction requestPath(req: IncomingMessage): string {\n try {\n return new URL(req.url ?? \"/\", \"http://localhost\").pathname;\n } catch {\n return \"/\";\n }\n}\n\nfunction sessionId(req: IncomingMessage): string | undefined {\n const value = req.headers[\"mcp-session-id\"];\n return Array.isArray(value) ? value[0] : value;\n}\n\nfunction reply(res: ServerResponse, status: number, body: unknown): void {\n const bytes = Buffer.from(JSON.stringify(body));\n res.writeHead(status, {\n \"content-type\": \"application/json; charset=utf-8\",\n \"content-length\": bytes.length,\n });\n res.end(bytes);\n}\n\nfunction jsonRpcError(res: ServerResponse, status: number, code: number, message: string): void {\n reply(res, status, { jsonrpc: \"2.0\", error: { code, message }, id: null });\n}\n\nasync function readBody(req: IncomingMessage): Promise<unknown> {\n const chunks: Buffer[] = [];\n let length = 0;\n for await (const chunk of req) {\n const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);\n length += bytes.length;\n if (length > MAX_BODY_BYTES) throw new Error(`request body exceeds ${MAX_BODY_BYTES} bytes`);\n chunks.push(bytes);\n }\n const value = Buffer.concat(chunks).toString(\"utf8\").trim();\n return value ? JSON.parse(value) : undefined;\n}\n\nfunction listen(server: HttpServer, host: string, port: number): Promise<void> {\n return new Promise((resolve, reject) => {\n const onError = (error: Error) => {\n server.off(\"listening\", onListening);\n reject(error);\n };\n const onListening = () => {\n server.off(\"error\", onError);\n resolve();\n };\n server.once(\"error\", onError);\n server.once(\"listening\", onListening);\n server.listen(port, host);\n });\n}\n\nfunction closeServer(server: HttpServer): Promise<void> {\n return new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));\n}\n\nfunction boundPort(server: HttpServer): number {\n const address = server.address();\n if (!address || typeof address === \"string\") throw new Error(\"loopback host did not bind a TCP port\");\n return (address as AddressInfo).port;\n}\n\nexport async function startLoopbackHost(options: LoopbackHostOptions = {}): Promise<LoopbackHost> {\n const host = options.host ?? DEFAULT_HOST;\n const port = options.port ?? DEFAULT_PORT;\n const mcpPath = normalizePath(options.path ?? DEFAULT_PATH);\n const healthPath = `${mcpPath}/health`;\n const sessionIdleMs = options.sessionIdleMs ?? DEFAULT_SESSION_IDLE_MS;\n if (!isLoopback(host)) throw new Error(\"--host must be 127.0.0.1, ::1, or localhost\");\n if (!Number.isInteger(port) || port < 0 || port > 65535) throw new Error(\"--port must be an integer from 0 to 65535\");\n if (!Number.isInteger(sessionIdleMs) || sessionIdleMs <= 0) throw new Error(\"--session-idle-ms must be a positive integer\");\n\n const sessions = new Map<string, Session>();\n let openedSessions = 0;\n let closedSessions = 0;\n let closing = false;\n const closeSession = async (session: Session): Promise<void> => {\n if (session.closing) return;\n session.closing = true;\n if (session.id) sessions.delete(session.id);\n closedSessions += 1;\n await Promise.allSettled([session.transport.close(), session.bridge.close()]);\n };\n const sweep = (): void => {\n const cutoff = Date.now() - sessionIdleMs;\n for (const session of sessions.values()) {\n if (session.lastSeenAt < cutoff) void closeSession(session);\n }\n };\n const sweepTimer = setInterval(sweep, Math.min(sessionIdleMs, 60_000));\n sweepTimer.unref();\n\n const server = createServer(async (req, res) => {\n const path = requestPath(req);\n if (path === healthPath || path === \"/health\") {\n reply(res, 200, {\n status: \"healthy\",\n report: {\n bridgeRuntime: \"agent-bridge\",\n transport: \"streamable-http\",\n sessions: { active: sessions.size, opened: openedSessions, closed: closedSessions, idleTimeoutMs: sessionIdleMs },\n },\n });\n return;\n }\n if (path !== mcpPath) return jsonRpcError(res, 404, -32000, \"Not Found\");\n if (![\"POST\", \"GET\", \"DELETE\"].includes(req.method ?? \"\")) {\n return jsonRpcError(res, 405, -32000, \"Method Not Allowed\");\n }\n sweep();\n try {\n const body = req.method === \"POST\" ? await readBody(req) : undefined;\n const existingId = sessionId(req);\n if (existingId) {\n const session = sessions.get(existingId);\n if (!session) return jsonRpcError(res, 404, -32000, \"Session not found\");\n session.lastSeenAt = Date.now();\n await session.transport.handleRequest(req, res, body);\n return;\n }\n if (req.method !== \"POST\" || !isInitializeRequest(body)) {\n return jsonRpcError(res, 400, -32000, \"initialize first or provide mcp-session-id\");\n }\n let session: Session | undefined;\n try {\n const bridge = createAgentBridgeServer(configFromEnv());\n session = {\n bridge,\n transport: new StreamableHTTPServerTransport({\n sessionIdGenerator: randomUUID,\n onsessioninitialized: (id) => {\n if (!session) return;\n session.id = id;\n session.lastSeenAt = Date.now();\n sessions.set(id, session);\n },\n }),\n lastSeenAt: Date.now(),\n closing: false,\n };\n session.transport.onclose = () => { if (session) void closeSession(session); };\n await bridge.connect(session.transport);\n openedSessions += 1;\n await session.transport.handleRequest(req, res, body);\n } finally {\n if (session && !session.id && !session.closing) await closeSession(session);\n }\n } catch (error) {\n if (!res.headersSent) {\n const message = error instanceof Error ? error.message : String(error);\n jsonRpcError(res, 500, -32603, `Internal server error: ${message}`);\n }\n }\n });\n await listen(server, host, port);\n const actualPort = boundPort(server);\n const mcpEndpoint = endpoint(host, actualPort, mcpPath);\n const healthEndpoint = endpoint(host, actualPort, healthPath);\n process.stdout.write(`${JSON.stringify({ status: \"ready\", endpoint: mcpEndpoint, healthEndpoint })}\\n`);\n\n return {\n endpoint: mcpEndpoint,\n healthEndpoint,\n close: async () => {\n if (closing) return;\n closing = true;\n clearInterval(sweepTimer);\n await Promise.allSettled([...sessions.values()].map(closeSession));\n await closeServer(server);\n },\n };\n}\n\nfunction option(args: string[], name: string, fallback: string): string {\n const index = args.indexOf(name);\n if (index < 0) return fallback;\n return args[index + 1] ?? (() => { throw new Error(`${name} requires a value`); })();\n}\n\nfunction usage(): string {\n return `Usage:\n agent-bridge-loopback-host [--host 127.0.0.1] [--port 8794] [--path /mcp] [--session-idle-ms 43200000]\n agent-bridge-loopback-host --install-launchd --service-name <name> --config <private-backend> --agent <identity> --instance <stable-key> [host options]\n agent-bridge-loopback-host --uninstall-launchd --service-name <name> --port <port>\n`;\n}\n\nfunction required(args: string[], name: string): string {\n const value = option(args, name, \"\");\n if (!value) throw new Error(`${name} requires a value`);\n return value;\n}\n\nfunction serviceLabel(name: string): string {\n if (!/^[A-Za-z0-9_-]+$/.test(name)) throw new Error(\"--service-name must contain only letters, numbers, _ or -\");\n return `com.creatornader.agent-bridge.${name}`;\n}\n\nfunction launchctl(args: string[]): void {\n const result = spawnSync(\"launchctl\", args, { encoding: \"utf8\" });\n if (result.status !== 0 && result.status !== 3 && result.status !== 113) {\n throw new Error(`launchctl ${args[0]} failed: ${(result.stderr || result.stdout || \"unknown error\").trim()}`);\n }\n}\n\nfunction currentUserId(): number {\n if (!process.getuid) throw new Error(\"launchd requires a POSIX user identity\");\n return process.getuid();\n}\n\nexport function launchdPlist(options: LaunchdInstallOptions): string {\n const executable = options.executablePath ?? fileURLToPath(import.meta.url);\n const label = serviceLabel(options.serviceName);\n const environment = {\n AGENT_BRIDGE_CONFIG: options.configPath,\n AGENT_BRIDGE_AGENT: options.agent,\n AGENT_BRIDGE_INSTANCE: options.instance,\n };\n const encode = (value: string): string => value.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n const strings = (values: string[]): string => values.map((value) => ` <string>${encode(value)}</string>`).join(\"\\n\");\n const env = Object.entries(environment).map(([key, value]) => ` <key>${key}</key>\\n <string>${encode(value)}</string>`).join(\"\\n\");\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>Label</key>\n <string>${label}</string>\n <key>ProgramArguments</key>\n <array>\n${strings([process.execPath, executable, \"--host\", options.host, \"--port\", String(options.port), \"--path\", options.path, \"--session-idle-ms\", String(options.sessionIdleMs)])}\n </array>\n <key>EnvironmentVariables</key>\n <dict>\n${env}\n </dict>\n <key>RunAtLoad</key>\n <true/>\n <key>KeepAlive</key>\n <true/>\n <key>StandardOutPath</key>\n <string>${encode(join(options.home ?? homedir(), \".agent-bridge\", \"logs\", `${options.serviceName}.out.log`))}</string>\n <key>StandardErrorPath</key>\n <string>${encode(join(options.home ?? homedir(), \".agent-bridge\", \"logs\", `${options.serviceName}.err.log`))}</string>\n</dict>\n</plist>\n`;\n}\n\nasync function waitForHealth(healthEndpoint: string): Promise<void> {\n let lastError = \"no response\";\n for (let attempt = 0; attempt < 30; attempt += 1) {\n try {\n const response = await fetch(healthEndpoint, { signal: AbortSignal.timeout(1_000) });\n const body = await response.json() as { status?: unknown };\n if (response.ok && body.status === \"healthy\") return;\n lastError = `HTTP ${response.status}`;\n } catch (error) {\n lastError = error instanceof Error ? error.message : String(error);\n }\n await new Promise((resolve) => setTimeout(resolve, 200));\n }\n throw new Error(`launchd started but ${healthEndpoint} did not become healthy: ${lastError}`);\n}\n\nexport async function installLaunchdHost(options: LaunchdInstallOptions): Promise<{ label: string; plistPath: string; healthEndpoint: string }> {\n if (process.platform !== \"darwin\") throw new Error(\"--install-launchd is supported only on macOS\");\n if (!isLoopback(options.host)) throw new Error(\"--host must be 127.0.0.1, ::1, or localhost\");\n if (!Number.isInteger(options.port) || options.port < 1 || options.port > 65535) throw new Error(\"--port must be an integer from 1 to 65535 for launchd\");\n if (!isAbsolute(options.configPath) || !existsSync(options.configPath)) throw new Error(`--config must be an existing absolute path: ${options.configPath}`);\n verifyPrivatePathAccess(options.configPath, \"file\");\n const home = options.home ?? homedir();\n const label = serviceLabel(options.serviceName);\n const agents = join(home, \"Library\", \"LaunchAgents\");\n const logs = join(home, \".agent-bridge\", \"logs\");\n const plistPath = join(agents, `${label}.plist`);\n mkdirSync(agents, { recursive: true, mode: 0o700 });\n mkdirSync(logs, { recursive: true, mode: 0o700 });\n chmodSync(agents, 0o700);\n chmodSync(logs, 0o700);\n launchctl([\"bootout\", `gui/${currentUserId()}/${label}`]);\n writeFileSync(plistPath, launchdPlist({ ...options, home }), { mode: 0o600 });\n chmodSync(plistPath, 0o600);\n launchctl([\"bootstrap\", `gui/${currentUserId()}`, plistPath]);\n const healthEndpoint = endpoint(options.host, options.port, `${normalizePath(options.path)}/health`);\n await waitForHealth(healthEndpoint);\n return { label, plistPath, healthEndpoint };\n}\n\nasync function portIsOpen(host: string, port: number): Promise<boolean> {\n return await new Promise((resolve) => {\n const socket = connect({ host, port });\n const finish = (open: boolean) => { socket.destroy(); resolve(open); };\n socket.once(\"connect\", () => finish(true));\n socket.once(\"error\", () => finish(false));\n socket.setTimeout(1_000, () => finish(false));\n });\n}\n\nasync function waitForPortClosed(host: string, port: number): Promise<void> {\n for (let attempt = 0; attempt < 30; attempt += 1) {\n if (!await portIsOpen(host, port)) return;\n await new Promise((resolve) => setTimeout(resolve, 200));\n }\n throw new Error(`launchd unloaded but ${host}:${port} is still accepting connections`);\n}\n\nexport async function uninstallLaunchdHost(\n serviceName: string,\n port: number,\n host = DEFAULT_HOST,\n home = homedir(),\n): Promise<{ label: string; plistPath: string }> {\n if (process.platform !== \"darwin\") throw new Error(\"--uninstall-launchd is supported only on macOS\");\n if (!isLoopback(host)) throw new Error(\"--host must be 127.0.0.1, ::1, or localhost\");\n if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error(\"--port must be an integer from 1 to 65535 for launchd\");\n const label = serviceLabel(serviceName);\n const plistPath = join(home, \"Library\", \"LaunchAgents\", `${label}.plist`);\n launchctl([\"bootout\", `gui/${currentUserId()}/${label}`]);\n rmSync(plistPath, { force: true });\n await waitForPortClosed(host, port);\n return { label, plistPath };\n}\n\nfunction isMainModule(): boolean {\n if (!process.argv[1]) return false;\n try {\n return import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href;\n } catch {\n return false;\n }\n}\n\nif (isMainModule()) {\n const args = process.argv.slice(2);\n if (args.includes(\"--help\") || args.includes(\"-h\")) process.stdout.write(usage());\n else if (args.includes(\"--install-launchd\")) {\n void (async () => {\n try {\n const result = await installLaunchdHost({\n serviceName: required(args, \"--service-name\"),\n configPath: required(args, \"--config\"),\n agent: required(args, \"--agent\"),\n instance: required(args, \"--instance\"),\n host: option(args, \"--host\", DEFAULT_HOST),\n port: Number(option(args, \"--port\", String(DEFAULT_PORT))),\n path: option(args, \"--path\", DEFAULT_PATH),\n sessionIdleMs: Number(option(args, \"--session-idle-ms\", String(DEFAULT_SESSION_IDLE_MS))),\n });\n process.stdout.write(`${JSON.stringify({ status: \"installed\", ...result })}\\n`);\n } catch (error) {\n process.stderr.write(`agent-bridge-loopback-host: ${error instanceof Error ? error.message : String(error)}\\n`);\n process.exitCode = 1;\n }\n })();\n } else if (args.includes(\"--uninstall-launchd\")) {\n void (async () => {\n try {\n const result = await uninstallLaunchdHost(\n required(args, \"--service-name\"),\n Number(required(args, \"--port\")),\n option(args, \"--host\", DEFAULT_HOST),\n );\n process.stdout.write(`${JSON.stringify({ status: \"uninstalled\", ...result })}\\n`);\n } catch (error) {\n process.stderr.write(`agent-bridge-loopback-host: ${error instanceof Error ? error.message : String(error)}\\n`);\n process.exitCode = 1;\n }\n })();\n }\n else void startLoopbackHost({\n host: option(args, \"--host\", DEFAULT_HOST),\n port: Number(option(args, \"--port\", String(DEFAULT_PORT))),\n path: option(args, \"--path\", DEFAULT_PATH),\n sessionIdleMs: Number(option(args, \"--session-idle-ms\", String(DEFAULT_SESSION_IDLE_MS))),\n }).then((host) => {\n const shutdown = () => void host.close().finally(() => process.exit(0));\n process.once(\"SIGINT\", shutdown);\n process.once(\"SIGTERM\", shutdown);\n }).catch((error) => {\n process.stderr.write(`agent-bridge-loopback-host: ${error instanceof Error ? error.message : String(error)}\\n`);\n process.exitCode = 1;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW,YAAY,WAAW,cAAc,QAAQ,qBAAqB;AACtF,SAAS,oBAA0F;AACnG,SAAS,eAAiC;AAC1C,SAAS,eAAe;AACxB,SAAkB,YAAY,YAAY;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,eAAe,qBAAqB;AAC7C,SAAS,qCAAqC;AAC9C,SAAS,2BAA2B;AAIpC,IAAM,eAAe;AACrB,IAAM,eAAe;AACrB,IAAM,eAAe;AACrB,IAAM,0BAA0B,KAAK,KAAK,KAAK;AAC/C,IAAM,iBAAiB,OAAO;A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AC;AAAA,EAC1F,CAAC,EAAE,KAAK,CAAC,SAAS;AAChB,UAAM,WAAW,MAAM,KAAK,KAAK,MAAM,EAAE,QAAQ,MAAM,QAAQ,KAAK,CAAC,CAAC;AACtE,YAAQ,KAAK,UAAU,QAAQ;AAC/B,YAAQ,KAAK,WAAW,QAAQ;AAAA,EAClC,CAAC,EAAE,MAAM,CAAC,UAAU;AAClB,YAAQ,OAAO,MAAM,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAC9G,YAAQ,WAAW;AAAA,EACrB,CAAC;AACH;","names":["session"]}
|
|
1
|
+
{"version":3,"sources":["../src/loopback-host.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { chmodSync, existsSync, mkdirSync, realpathSync, rmSync, writeFileSync } from \"node:fs\";\nimport { createServer, type IncomingMessage, type Server as HttpServer, type ServerResponse } from \"node:http\";\nimport { connect, type AddressInfo } from \"node:net\";\nimport { homedir } from \"node:os\";\nimport { dirname, isAbsolute, join } from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { StreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/streamableHttp.js\";\nimport { isInitializeRequest } from \"@modelcontextprotocol/sdk/types.js\";\nimport { configFromEnv, createAgentBridgeServer } from \"./server.js\";\nimport { verifyPrivatePathAccess } from \"./private-path.js\";\n\nconst DEFAULT_HOST = \"127.0.0.1\";\nconst DEFAULT_PORT = 8794;\nconst DEFAULT_PATH = \"/mcp\";\nconst DEFAULT_SESSION_IDLE_MS = 12 * 60 * 60 * 1000;\n// The low-level Server API does not expose McpServer's input-element limit.\nconst MAX_BODY_BYTES = 1024 * 1024;\n\nexport interface LoopbackHostOptions {\n host?: string;\n port?: number;\n path?: string;\n sessionIdleMs?: number;\n}\n\nexport interface LoopbackHost {\n endpoint: string;\n healthEndpoint: string;\n close(): Promise<void>;\n}\n\nexport interface LaunchdInstallOptions extends Required<LoopbackHostOptions> {\n serviceName: string;\n configPath: string;\n agent: string;\n instance: string;\n home?: string;\n executablePath?: string;\n}\n\ninterface Session {\n bridge: ReturnType<typeof createAgentBridgeServer>;\n transport: StreamableHTTPServerTransport;\n id?: string;\n lastSeenAt: number;\n closing: boolean;\n}\n\nfunction normalizePath(raw: string): string {\n const path = raw.startsWith(\"/\") ? raw : `/${raw}`;\n return path.length > 1 ? path.replace(/\\/+$/, \"\") : path;\n}\n\nfunction isLoopback(host: string): boolean {\n return host === \"127.0.0.1\" || host === \"::1\" || host === \"localhost\";\n}\n\nfunction endpoint(host: string, port: number, path: string): string {\n return `http://${host.includes(\":\") ? `[${host}]` : host}:${port}${path}`;\n}\n\nfunction requestPath(req: IncomingMessage): string {\n try {\n return new URL(req.url ?? \"/\", \"http://localhost\").pathname;\n } catch {\n return \"/\";\n }\n}\n\nfunction sessionId(req: IncomingMessage): string | undefined {\n const value = req.headers[\"mcp-session-id\"];\n return Array.isArray(value) ? value[0] : value;\n}\n\nfunction reply(res: ServerResponse, status: number, body: unknown): void {\n const bytes = Buffer.from(JSON.stringify(body));\n res.writeHead(status, {\n \"content-type\": \"application/json; charset=utf-8\",\n \"content-length\": bytes.length,\n });\n res.end(bytes);\n}\n\nfunction jsonRpcError(res: ServerResponse, status: number, code: number, message: string): void {\n reply(res, status, { jsonrpc: \"2.0\", error: { code, message }, id: null });\n}\n\nasync function readBody(req: IncomingMessage): Promise<unknown> {\n const chunks: Buffer[] = [];\n let length = 0;\n for await (const chunk of req) {\n const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);\n length += bytes.length;\n if (length > MAX_BODY_BYTES) throw new Error(`request body exceeds ${MAX_BODY_BYTES} bytes`);\n chunks.push(bytes);\n }\n const value = Buffer.concat(chunks).toString(\"utf8\").trim();\n return value ? JSON.parse(value) : undefined;\n}\n\nfunction listen(server: HttpServer, host: string, port: number): Promise<void> {\n return new Promise((resolve, reject) => {\n const onError = (error: Error) => {\n server.off(\"listening\", onListening);\n reject(error);\n };\n const onListening = () => {\n server.off(\"error\", onError);\n resolve();\n };\n server.once(\"error\", onError);\n server.once(\"listening\", onListening);\n server.listen(port, host);\n });\n}\n\nfunction closeServer(server: HttpServer): Promise<void> {\n return new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));\n}\n\nfunction boundPort(server: HttpServer): number {\n const address = server.address();\n if (!address || typeof address === \"string\") throw new Error(\"loopback host did not bind a TCP port\");\n return (address as AddressInfo).port;\n}\n\nexport async function startLoopbackHost(options: LoopbackHostOptions = {}): Promise<LoopbackHost> {\n const host = options.host ?? DEFAULT_HOST;\n const port = options.port ?? DEFAULT_PORT;\n const mcpPath = normalizePath(options.path ?? DEFAULT_PATH);\n const healthPath = `${mcpPath}/health`;\n const sessionIdleMs = options.sessionIdleMs ?? DEFAULT_SESSION_IDLE_MS;\n if (!isLoopback(host)) throw new Error(\"--host must be 127.0.0.1, ::1, or localhost\");\n if (!Number.isInteger(port) || port < 0 || port > 65535) throw new Error(\"--port must be an integer from 0 to 65535\");\n if (!Number.isInteger(sessionIdleMs) || sessionIdleMs <= 0) throw new Error(\"--session-idle-ms must be a positive integer\");\n\n const sessions = new Map<string, Session>();\n let openedSessions = 0;\n let closedSessions = 0;\n let closing = false;\n const closeSession = async (session: Session): Promise<void> => {\n if (session.closing) return;\n session.closing = true;\n if (session.id) sessions.delete(session.id);\n closedSessions += 1;\n await Promise.allSettled([session.transport.close(), session.bridge.close()]);\n };\n const sweep = (): void => {\n const cutoff = Date.now() - sessionIdleMs;\n for (const session of sessions.values()) {\n if (session.lastSeenAt < cutoff) void closeSession(session);\n }\n };\n const sweepTimer = setInterval(sweep, Math.min(sessionIdleMs, 60_000));\n sweepTimer.unref();\n\n const server = createServer(async (req, res) => {\n const path = requestPath(req);\n if (path === healthPath || path === \"/health\") {\n reply(res, 200, {\n status: \"healthy\",\n report: {\n bridgeRuntime: \"agent-bridge\",\n transport: \"streamable-http\",\n sessions: { active: sessions.size, opened: openedSessions, closed: closedSessions, idleTimeoutMs: sessionIdleMs },\n },\n });\n return;\n }\n if (path !== mcpPath) return jsonRpcError(res, 404, -32000, \"Not Found\");\n if (![\"POST\", \"GET\", \"DELETE\"].includes(req.method ?? \"\")) {\n return jsonRpcError(res, 405, -32000, \"Method Not Allowed\");\n }\n sweep();\n try {\n const body = req.method === \"POST\" ? await readBody(req) : undefined;\n const existingId = sessionId(req);\n if (existingId) {\n const session = sessions.get(existingId);\n if (!session) return jsonRpcError(res, 404, -32000, \"Session not found\");\n session.lastSeenAt = Date.now();\n await session.transport.handleRequest(req, res, body);\n return;\n }\n if (req.method !== \"POST\" || !isInitializeRequest(body)) {\n return jsonRpcError(res, 400, -32000, \"initialize first or provide mcp-session-id\");\n }\n let session: Session | undefined;\n try {\n const bridge = createAgentBridgeServer(configFromEnv());\n session = {\n bridge,\n transport: new StreamableHTTPServerTransport({\n sessionIdGenerator: randomUUID,\n onsessioninitialized: (id) => {\n if (!session) return;\n session.id = id;\n session.lastSeenAt = Date.now();\n sessions.set(id, session);\n },\n }),\n lastSeenAt: Date.now(),\n closing: false,\n };\n session.transport.onclose = () => { if (session) void closeSession(session); };\n await bridge.connect(session.transport);\n openedSessions += 1;\n await session.transport.handleRequest(req, res, body);\n } finally {\n if (session && !session.id && !session.closing) await closeSession(session);\n }\n } catch (error) {\n if (!res.headersSent) {\n const message = error instanceof Error ? error.message : String(error);\n jsonRpcError(res, 500, -32603, `Internal server error: ${message}`);\n }\n }\n });\n await listen(server, host, port);\n const actualPort = boundPort(server);\n const mcpEndpoint = endpoint(host, actualPort, mcpPath);\n const healthEndpoint = endpoint(host, actualPort, healthPath);\n process.stdout.write(`${JSON.stringify({ status: \"ready\", endpoint: mcpEndpoint, healthEndpoint })}\\n`);\n\n return {\n endpoint: mcpEndpoint,\n healthEndpoint,\n close: async () => {\n if (closing) return;\n closing = true;\n clearInterval(sweepTimer);\n await Promise.allSettled([...sessions.values()].map(closeSession));\n await closeServer(server);\n },\n };\n}\n\nfunction option(args: string[], name: string, fallback: string): string {\n const index = args.indexOf(name);\n if (index < 0) return fallback;\n return args[index + 1] ?? (() => { throw new Error(`${name} requires a value`); })();\n}\n\nfunction usage(): string {\n return `Usage:\n agent-bridge-loopback-host [--host 127.0.0.1] [--port 8794] [--path /mcp] [--session-idle-ms 43200000]\n agent-bridge-loopback-host --install-launchd --service-name <name> --config <private-backend> --agent <identity> --instance <stable-key> [host options]\n agent-bridge-loopback-host --uninstall-launchd --service-name <name> --port <port>\n`;\n}\n\nfunction required(args: string[], name: string): string {\n const value = option(args, name, \"\");\n if (!value) throw new Error(`${name} requires a value`);\n return value;\n}\n\nfunction serviceLabel(name: string): string {\n if (!/^[A-Za-z0-9_-]+$/.test(name)) throw new Error(\"--service-name must contain only letters, numbers, _ or -\");\n return `com.creatornader.agent-bridge.${name}`;\n}\n\nfunction launchctl(args: string[]): void {\n const result = spawnSync(\"launchctl\", args, { encoding: \"utf8\" });\n if (result.status !== 0 && result.status !== 3 && result.status !== 113) {\n throw new Error(`launchctl ${args[0]} failed: ${(result.stderr || result.stdout || \"unknown error\").trim()}`);\n }\n}\n\nfunction currentUserId(): number {\n if (!process.getuid) throw new Error(\"launchd requires a POSIX user identity\");\n return process.getuid();\n}\n\nexport function launchdPlist(options: LaunchdInstallOptions): string {\n const executable = options.executablePath ?? fileURLToPath(import.meta.url);\n const label = serviceLabel(options.serviceName);\n const environment = {\n AGENT_BRIDGE_CONFIG: options.configPath,\n AGENT_BRIDGE_AGENT: options.agent,\n AGENT_BRIDGE_INSTANCE: options.instance,\n };\n const encode = (value: string): string => value.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n const strings = (values: string[]): string => values.map((value) => ` <string>${encode(value)}</string>`).join(\"\\n\");\n const env = Object.entries(environment).map(([key, value]) => ` <key>${key}</key>\\n <string>${encode(value)}</string>`).join(\"\\n\");\n return `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>Label</key>\n <string>${label}</string>\n <key>ProgramArguments</key>\n <array>\n${strings([process.execPath, executable, \"--host\", options.host, \"--port\", String(options.port), \"--path\", options.path, \"--session-idle-ms\", String(options.sessionIdleMs)])}\n </array>\n <key>EnvironmentVariables</key>\n <dict>\n${env}\n </dict>\n <key>RunAtLoad</key>\n <true/>\n <key>KeepAlive</key>\n <true/>\n <key>StandardOutPath</key>\n <string>${encode(join(options.home ?? homedir(), \".agent-bridge\", \"logs\", `${options.serviceName}.out.log`))}</string>\n <key>StandardErrorPath</key>\n <string>${encode(join(options.home ?? homedir(), \".agent-bridge\", \"logs\", `${options.serviceName}.err.log`))}</string>\n</dict>\n</plist>\n`;\n}\n\nasync function waitForHealth(healthEndpoint: string): Promise<void> {\n let lastError = \"no response\";\n for (let attempt = 0; attempt < 30; attempt += 1) {\n try {\n const response = await fetch(healthEndpoint, { signal: AbortSignal.timeout(1_000) });\n const body = await response.json() as { status?: unknown };\n if (response.ok && body.status === \"healthy\") return;\n lastError = `HTTP ${response.status}`;\n } catch (error) {\n lastError = error instanceof Error ? error.message : String(error);\n }\n await new Promise((resolve) => setTimeout(resolve, 200));\n }\n throw new Error(`launchd started but ${healthEndpoint} did not become healthy: ${lastError}`);\n}\n\nexport async function installLaunchdHost(options: LaunchdInstallOptions): Promise<{ label: string; plistPath: string; healthEndpoint: string }> {\n if (process.platform !== \"darwin\") throw new Error(\"--install-launchd is supported only on macOS\");\n if (!isLoopback(options.host)) throw new Error(\"--host must be 127.0.0.1, ::1, or localhost\");\n if (!Number.isInteger(options.port) || options.port < 1 || options.port > 65535) throw new Error(\"--port must be an integer from 1 to 65535 for launchd\");\n if (!isAbsolute(options.configPath) || !existsSync(options.configPath)) throw new Error(`--config must be an existing absolute path: ${options.configPath}`);\n verifyPrivatePathAccess(options.configPath, \"file\");\n const home = options.home ?? homedir();\n const label = serviceLabel(options.serviceName);\n const agents = join(home, \"Library\", \"LaunchAgents\");\n const logs = join(home, \".agent-bridge\", \"logs\");\n const plistPath = join(agents, `${label}.plist`);\n mkdirSync(agents, { recursive: true, mode: 0o700 });\n mkdirSync(logs, { recursive: true, mode: 0o700 });\n chmodSync(agents, 0o700);\n chmodSync(logs, 0o700);\n launchctl([\"bootout\", `gui/${currentUserId()}/${label}`]);\n writeFileSync(plistPath, launchdPlist({ ...options, home }), { mode: 0o600 });\n chmodSync(plistPath, 0o600);\n launchctl([\"bootstrap\", `gui/${currentUserId()}`, plistPath]);\n const healthEndpoint = endpoint(options.host, options.port, `${normalizePath(options.path)}/health`);\n await waitForHealth(healthEndpoint);\n return { label, plistPath, healthEndpoint };\n}\n\nasync function portIsOpen(host: string, port: number): Promise<boolean> {\n return await new Promise((resolve) => {\n const socket = connect({ host, port });\n const finish = (open: boolean) => { socket.destroy(); resolve(open); };\n socket.once(\"connect\", () => finish(true));\n socket.once(\"error\", () => finish(false));\n socket.setTimeout(1_000, () => finish(false));\n });\n}\n\nasync function waitForPortClosed(host: string, port: number): Promise<void> {\n for (let attempt = 0; attempt < 30; attempt += 1) {\n if (!await portIsOpen(host, port)) return;\n await new Promise((resolve) => setTimeout(resolve, 200));\n }\n throw new Error(`launchd unloaded but ${host}:${port} is still accepting connections`);\n}\n\nexport async function uninstallLaunchdHost(\n serviceName: string,\n port: number,\n host = DEFAULT_HOST,\n home = homedir(),\n): Promise<{ label: string; plistPath: string }> {\n if (process.platform !== \"darwin\") throw new Error(\"--uninstall-launchd is supported only on macOS\");\n if (!isLoopback(host)) throw new Error(\"--host must be 127.0.0.1, ::1, or localhost\");\n if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error(\"--port must be an integer from 1 to 65535 for launchd\");\n const label = serviceLabel(serviceName);\n const plistPath = join(home, \"Library\", \"LaunchAgents\", `${label}.plist`);\n launchctl([\"bootout\", `gui/${currentUserId()}/${label}`]);\n rmSync(plistPath, { force: true });\n await waitForPortClosed(host, port);\n return { label, plistPath };\n}\n\nfunction isMainModule(): boolean {\n if (!process.argv[1]) return false;\n try {\n return import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href;\n } catch {\n return false;\n }\n}\n\nif (isMainModule()) {\n const args = process.argv.slice(2);\n if (args.includes(\"--help\") || args.includes(\"-h\")) process.stdout.write(usage());\n else if (args.includes(\"--install-launchd\")) {\n void (async () => {\n try {\n const result = await installLaunchdHost({\n serviceName: required(args, \"--service-name\"),\n configPath: required(args, \"--config\"),\n agent: required(args, \"--agent\"),\n instance: required(args, \"--instance\"),\n host: option(args, \"--host\", DEFAULT_HOST),\n port: Number(option(args, \"--port\", String(DEFAULT_PORT))),\n path: option(args, \"--path\", DEFAULT_PATH),\n sessionIdleMs: Number(option(args, \"--session-idle-ms\", String(DEFAULT_SESSION_IDLE_MS))),\n });\n process.stdout.write(`${JSON.stringify({ status: \"installed\", ...result })}\\n`);\n } catch (error) {\n process.stderr.write(`agent-bridge-loopback-host: ${error instanceof Error ? error.message : String(error)}\\n`);\n process.exitCode = 1;\n }\n })();\n } else if (args.includes(\"--uninstall-launchd\")) {\n void (async () => {\n try {\n const result = await uninstallLaunchdHost(\n required(args, \"--service-name\"),\n Number(required(args, \"--port\")),\n option(args, \"--host\", DEFAULT_HOST),\n );\n process.stdout.write(`${JSON.stringify({ status: \"uninstalled\", ...result })}\\n`);\n } catch (error) {\n process.stderr.write(`agent-bridge-loopback-host: ${error instanceof Error ? error.message : String(error)}\\n`);\n process.exitCode = 1;\n }\n })();\n }\n else void startLoopbackHost({\n host: option(args, \"--host\", DEFAULT_HOST),\n port: Number(option(args, \"--port\", String(DEFAULT_PORT))),\n path: option(args, \"--path\", DEFAULT_PATH),\n sessionIdleMs: Number(option(args, \"--session-idle-ms\", String(DEFAULT_SESSION_IDLE_MS))),\n }).then((host) => {\n const shutdown = () => void host.close().finally(() => process.exit(0));\n process.once(\"SIGINT\", shutdown);\n process.once(\"SIGTERM\", shutdown);\n }).catch((error) => {\n process.stderr.write(`agent-bridge-loopback-host: ${error instanceof Error ? error.message : String(error)}\\n`);\n process.exitCode = 1;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW,YAAY,WAAW,cAAc,QAAQ,qBAAqB;AACtF,SAAS,oBAA0F;AACnG,SAAS,eAAiC;AAC1C,SAAS,eAAe;AACxB,SAAkB,YAAY,YAAY;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,eAAe,qBAAqB;AAC7C,SAAS,qCAAqC;AAC9C,SAAS,2BAA2B;AAIpC,IAAM,eAAe;AACrB,IAAM,eAAe;AACrB,IAAM,eAAe;AACrB,IAAM,0BAA0B,KAAK,KAAK,KAAK;AAE/C,IAAM,iBAAiB,OAAO;AAgC9B,SAAS,cAAc,KAAqB;AAC1C,QAAM,OAAO,IAAI,WAAW,GAAG,IAAI,MAAM,IAAI,GAAG;AAChD,SAAO,KAAK,SAAS,IAAI,KAAK,QAAQ,QAAQ,EAAE,IAAI;AACtD;AAEA,SAAS,WAAW,MAAuB;AACzC,SAAO,SAAS,eAAe,SAAS,SAAS,SAAS;AAC5D;AAEA,SAAS,SAAS,MAAc,MAAc,MAAsB;AAClE,SAAO,UAAU,KAAK,SAAS,GAAG,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,GAAG,IAAI;AACzE;AAEA,SAAS,YAAY,KAA8B;AACjD,MAAI;AACF,WAAO,IAAI,IAAI,IAAI,OAAO,KAAK,kBAAkB,EAAE;AAAA,EACrD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,UAAU,KAA0C;AAC3D,QAAM,QAAQ,IAAI,QAAQ,gBAAgB;AAC1C,SAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,CAAC,IAAI;AAC3C;AAEA,SAAS,MAAM,KAAqB,QAAgB,MAAqB;AACvE,QAAM,QAAQ,OAAO,KAAK,KAAK,UAAU,IAAI,CAAC;AAC9C,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,MAAM,GAAG,KAAK,UAAU,EAAE,QAAQ,eAAe,GAAG,OAAO,CAAC,CAAC;AAAA,CAAI;AAAA,MAClF,SAAS,OAAO;AACd,gBAAQ,OAAO,MAAM,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAC9G,gBAAQ,WAAW;AAAA,MACrB;AAAA,IACF,GAAG;AAAA,EACL,MACK,MAAK,kBAAkB;AAAA,IAC1B,MAAM,OAAO,MAAM,UAAU,YAAY;AAAA,IACzC,MAAM,OAAO,OAAO,MAAM,UAAU,OAAO,YAAY,CAAC,CAAC;AAAA,IACzD,MAAM,OAAO,MAAM,UAAU,YAAY;AAAA,IACzC,eAAe,OAAO,OAAO,MAAM,qBAAqB,OAAO,uBAAuB,CAAC,CAAC;AAAA,EAC1F,CAAC,EAAE,KAAK,CAAC,SAAS;AAChB,UAAM,WAAW,MAAM,KAAK,KAAK,MAAM,EAAE,QAAQ,MAAM,QAAQ,KAAK,CAAC,CAAC;AACtE,YAAQ,KAAK,UAAU,QAAQ;AAC/B,YAAQ,KAAK,WAAW,QAAQ;AAAA,EAClC,CAAC,EAAE,MAAM,CAAC,UAAU;AAClB,YAAQ,OAAO,MAAM,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,CAAI;AAC9G,YAAQ,WAAW;AAAA,EACrB,CAAC;AACH;","names":["session"]}
|
package/docs/deployment.md
CHANGED
|
@@ -271,7 +271,9 @@ messages before choosing one authority. If schema or data recovery is required,
|
|
|
271
271
|
restore the verified native DR bundle into a fresh target and switch authority once.
|
|
272
272
|
Do not run the source and restored database as active authorities at the same time.
|
|
273
273
|
|
|
274
|
-
Release tags deploy the exact tagged revision before npm publication.
|
|
274
|
+
Release tags deploy the exact tagged revision before npm publication. After successful
|
|
275
|
+
package publication, the release job creates the immutable GitHub Release for that
|
|
276
|
+
same tag. The release job
|
|
275
277
|
uses the approval-protected `agent-bridge-production-proof` environment. Configure
|
|
276
278
|
`AGENT_BRIDGE_FLY_APP` and `AGENT_BRIDGE_GATEWAY_ORIGIN` as environment variables, and
|
|
277
279
|
configure `PROOF_SENDER_TOKEN`, `PROOF_RECEIVER_TOKEN`, `PROOF_HOST_SALT`, and
|
|
@@ -280,6 +282,12 @@ for the release job. It runs the read-only Fly preflight, deploys the image with
|
|
|
280
282
|
checked-out revision, requires `/readyz`, and verifies the running package version and
|
|
281
283
|
revision. A failed deployment or identity check stops npm publication.
|
|
282
284
|
|
|
285
|
+
To recover a release workflow, dispatch it from the release tag itself and provide the
|
|
286
|
+
same tag as the input. The workflow verifies an already published package by its name
|
|
287
|
+
and version from the packed artifact, then leaves that immutable npm version intact.
|
|
288
|
+
It also leaves an existing GitHub Release intact. A recovery run cannot publish a
|
|
289
|
+
different package under the tag.
|
|
290
|
+
|
|
283
291
|
The manual `gateway production proof` GitHub Actions workflow runs its acceptance
|
|
284
292
|
proof against that deployed HTTPS gateway. GitHub restricts it to `main`, and every job
|
|
285
293
|
uses the same approval-protected environment. Use a release-specific proof workspace
|
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## Status
|
|
4
4
|
|
|
5
|
-
Resolved for
|
|
5
|
+
Resolved for Codex, Claude Code, and Claude Desktop availability.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
The public package now owns the local MCP path. Each client has a public
|
|
8
|
+
`agent-bridge-loopback-host` launchd service that binds only its assigned
|
|
9
|
+
loopback port and serves `/mcp/health` plus Streamable HTTP MCP. Claude Desktop
|
|
10
|
+
uses the public `agent-bridge-stdio-http-proxy` to reach its local host. The
|
|
11
|
+
client services read owner-private backend files, so registrations do not need
|
|
12
|
+
to duplicate gateway credentials.
|
|
11
13
|
|
|
12
14
|
The broken Codex, Claude Code, and Claude Desktop signed-wrapper launchd jobs
|
|
13
15
|
were removed after their labels stayed loaded while `/mcp/health` refused
|
|
14
|
-
connections. The wrapper
|
|
15
|
-
|
|
16
|
+
connections. The wrapper remains an optional signed attribution layer outside
|
|
17
|
+
the public Agent Bridge runtime.
|
|
16
18
|
|
|
17
19
|
## Impact
|
|
18
20
|
|
|
@@ -40,43 +42,56 @@ it required `AGENT_BRIDGE_URL` and `AGENT_BRIDGE_KEY` in process env. The CLI
|
|
|
40
42
|
already read `~/.agent-bridge/config`, so the two source-repo entrypoints had
|
|
41
43
|
drifted.
|
|
42
44
|
|
|
45
|
+
The first public-host release also exposed a package-distribution defect. npm
|
|
46
|
+
executes package bins through a symlink, while the host and proxy used a source
|
|
47
|
+
file entrypoint check that compared the unresolved `argv[1]` path. Their
|
|
48
|
+
install commands therefore returned success without starting a service.
|
|
49
|
+
|
|
50
|
+
The release workflow published valid npm versions but did not create matching
|
|
51
|
+
GitHub Release objects. This made the release page incomplete and left older
|
|
52
|
+
titles inconsistent.
|
|
53
|
+
|
|
43
54
|
During recovery, the wrapper installer also selected `node` from ambient
|
|
44
55
|
`PATH`. That allowed restarts to drift to a local Node shim instead of the
|
|
45
56
|
Homebrew Node binary that had previously run the service.
|
|
46
57
|
|
|
47
58
|
## Fixes
|
|
48
59
|
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
- The public package provides a long-lived loopback host, health endpoint, and
|
|
61
|
+
Claude Desktop stdio proxy. It installs launchd services only after health
|
|
62
|
+
proves the socket is listening, and uninstalls them only after the socket
|
|
63
|
+
closes.
|
|
64
|
+
- The host and proxy resolve the invoked file before deciding whether to run as
|
|
65
|
+
a CLI. Their global npm bins now work through npm's symlink layout.
|
|
66
|
+
- Package-install smoke invokes both public binaries. This catches a silent
|
|
67
|
+
entrypoint failure before publication.
|
|
68
|
+
- Local Codex, Claude Code, and Claude Desktop registrations now point to the
|
|
69
|
+
public client-owned loopback services. The dead private wrapper jobs were
|
|
57
70
|
uninstalled.
|
|
58
|
-
-
|
|
59
|
-
|
|
71
|
+
- Tagged releases now create one immutable GitHub Release after the gateway and
|
|
72
|
+
npm gates pass. New release pages use `Agent Bridge v<version>`. A tag-based
|
|
73
|
+
recovery verifies the immutable package already in npm before continuing.
|
|
60
74
|
|
|
61
75
|
## Wrapper Policy
|
|
62
76
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Desktop
|
|
77
|
+
Agent Bridge must run fully from its public package. Keep the signed wrapper
|
|
78
|
+
for attribution receipts and local-substrate metadata only. Do not make it an
|
|
79
|
+
availability boundary for Codex, Claude Code, Claude Desktop, or another MCP
|
|
80
|
+
client.
|
|
66
81
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
82
|
+
An active launchd label is not proof that Agent Bridge MCP is available. The
|
|
83
|
+
proof is a successful public `/mcp/health` probe and a real MCP tool call. New
|
|
84
|
+
versions use an immutable `v<version>` tag and the GitHub Release title `Agent
|
|
85
|
+
Bridge v<version>`.
|
|
71
86
|
|
|
72
87
|
## Verification
|
|
73
88
|
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
|
|
89
|
+
- A global-package launchd install bound a disposable loopback port, passed
|
|
90
|
+
`/mcp/health`, then unbound the port after uninstall.
|
|
91
|
+
- Each production Codex, Claude Code, and Claude Desktop public host passed
|
|
92
|
+
`/mcp/health`, completed an MCP handshake, listed 17 tools, and accepted a
|
|
93
|
+
`post_context` write.
|
|
94
|
+
- Each client registration and its identity, instance, and private backend file
|
|
95
|
+
passed managed-client inspection.
|
|
96
|
+
- The three private wrapper labels are absent. The three public launchd labels
|
|
97
|
+
are running and own ports 8794, 8793, and 8791.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creatornader/agent-bridge",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"description": "Let AI agents message each other and hand off work across tools, sessions, and machines.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"check:windows": "npm run typecheck && npm run build && npm run contracts:check:built && vitest run --maxWorkers=2 --testTimeout=90000 --exclude test/private-path.test.ts --exclude test/client-maintenance.test.ts --exclude test/cli.test.ts"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
111
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
112
112
|
"@sinclair/typebox": "npm:typebox@1.3.6",
|
|
113
113
|
"pg": "^8.22.0"
|
|
114
114
|
},
|
|
@@ -117,13 +117,16 @@
|
|
|
117
117
|
"@types/pg": "^8.20.0",
|
|
118
118
|
"tsup": "^8.4.0",
|
|
119
119
|
"typescript": "^6.0.3",
|
|
120
|
-
"vitest": "^
|
|
120
|
+
"vitest": "^5.0.5"
|
|
121
121
|
},
|
|
122
122
|
"overrides": {
|
|
123
123
|
"@hono/node-server": "2.0.11",
|
|
124
|
+
"body-parser": "2.4.0",
|
|
124
125
|
"esbuild": "0.28.1",
|
|
125
|
-
"fast-uri": "3.1.
|
|
126
|
-
"hono": "4.
|
|
126
|
+
"fast-uri": "3.1.8",
|
|
127
|
+
"hono": "4.13.11",
|
|
128
|
+
"ip-address": "10.7.4",
|
|
129
|
+
"zod": "4.6.7"
|
|
127
130
|
},
|
|
128
131
|
"directories": {
|
|
129
132
|
"doc": "docs",
|