@sellable/install
Version:
One-command installer for Sellable MCP in Claude Code, Codex, and Hermes
25 lines (22 loc) • 672 B
JavaScript
export const ADMIN_NATIVE_GATEWAY_MAX_LOCAL_RESTARTS = 3;
export function nativeGatewayRunning(gateway) {
const child = gateway?.child;
return Boolean(
child &&
child.exitCode === null &&
child.signalCode === null &&
child.killed !== true
);
}
export function nextAdminNativeGatewayRecovery({ attempts }) {
const completedAttempts = Number.isInteger(attempts)
? Math.max(0, attempts)
: 0;
if (completedAttempts >= ADMIN_NATIVE_GATEWAY_MAX_LOCAL_RESTARTS) {
return {
action: "EXHAUSTED",
attempt: ADMIN_NATIVE_GATEWAY_MAX_LOCAL_RESTARTS,
};
}
return { action: "RESTART", attempt: completedAttempts + 1 };
}