Files
claude-code/src/commands/remoteControlServer/index.ts
Dosion 0c53796d15 feat: restore daemon supervisor and remoteControlServer command (#170)
Reverse-engineer the missing daemon + remoteControlServer implementation
by tracing the call chain from existing code:

- src/daemon/main.ts: restore from stub to full supervisor (spawn/monitor
  workers, exponential backoff restart, graceful shutdown)
- src/daemon/workerRegistry.ts: restore from stub to worker dispatcher
  (remoteControl kind → runBridgeHeadless())
- src/commands/remoteControlServer/: new slash command /remote-control-server
  (alias /rcs) for managing the daemon from REPL
- build.ts + scripts/dev.ts: enable DAEMON feature flag

Both official CLI 2.1.92 and our codebase had the command registered in
commands.ts but the directory and daemon implementation were missing.
The bottom layer (runBridgeHeadless in bridgeMain.ts) was already complete.

Co-authored-by: unraid <local@unraid.local>
2026-04-07 15:36:29 +08:00

27 lines
682 B
TypeScript

import { feature } from 'bun:bundle'
import { isBridgeEnabled } from '../../bridge/bridgeEnabled.js'
import type { Command } from '../../commands.js'
function isEnabled(): boolean {
if (!feature('DAEMON') || !feature('BRIDGE_MODE')) {
return false
}
return isBridgeEnabled()
}
const remoteControlServer = {
type: 'local-jsx',
name: 'remote-control-server',
aliases: ['rcs'],
description:
'Start a persistent Remote Control server (daemon) that accepts multiple sessions',
isEnabled,
get isHidden() {
return !isEnabled()
},
immediate: true,
load: () => import('./remoteControlServer.js'),
} satisfies Command
export default remoteControlServer