feat(connectd): companion sidecar lifecycle (connectd-child, v1)
Adds optional ServerConfig.companion {command,args,env,healthUrl}. On stdio connect, ensureCompanion
spawns the sidecar (e.g. the WhatsApp bridge) if healthUrl isn't already serving, polls health (15s),
then spawns the MCP server that talks to it. Killed on closeServer + SIGINT/SIGTERM (disposeCompanions)
so it never orphans. Reuses an already-running bridge (idempotent). Typecheck clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,16 @@ export interface ServerConfig {
|
||||
command?: string;
|
||||
args?: string[];
|
||||
env?: Record<string, string>;
|
||||
// Companion sidecar: a long-running process this connector's MCP server talks to (e.g. the
|
||||
// WhatsApp bridge on :8080 that holds the paired session). connectd starts it as a CHILD when the
|
||||
// connector connects, waits for healthUrl to respond, then spawns the MCP server; it is killed on
|
||||
// disconnect/shutdown. `command` supports @bin//@node//@bundled resolution like the server itself.
|
||||
companion?: {
|
||||
command: string;
|
||||
args?: string[];
|
||||
env?: Record<string, string>;
|
||||
healthUrl?: string;
|
||||
};
|
||||
// http (Phase 3)
|
||||
url?: string;
|
||||
auth?: "none" | "oauth" | "token" | "google";
|
||||
|
||||
Reference in New Issue
Block a user