(server: Command)
| 37 | const USER_AGENT_MAX_WIDTH = 40; |
| 38 | |
| 39 | export function registerPsCommand(server: Command): void { |
| 40 | server |
| 41 | .command('ps') |
| 42 | .description('List clients currently connected to the running Kimi server.') |
| 43 | .option('--json', 'Print the raw connection list as JSON.') |
| 44 | .action(async (opts: { json?: boolean }) => { |
| 45 | try { |
| 46 | await handlePsCommand(opts); |
| 47 | } catch (error) { |
| 48 | process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`); |
| 49 | process.exit(1); |
| 50 | } |
| 51 | }); |
| 52 | } |
| 53 | |
| 54 | async function handlePsCommand(opts: { json?: boolean }): Promise<void> { |
| 55 | const lock = getLiveLock(); |
no test coverage detected