Files
Kilo-Org_kilocode/packages/opencode/src/cli/cmd/remote.ts
T
Evgeny Shurakov 37b866f1ef feat(cli): add remote session relay over WebSocket
Introduce WebSocket-based remote session relay so external clients can
subscribe to sessions, send messages, answer questions, and respond to
permissions in real time.

- RemoteWS manages the authenticated WebSocket lifecycle with reconnect
- RemoteSender dispatches inbound commands and forwards server events
- Backfill pending questions/permissions when a client subscribes
- Add question_reject command for dismissing questions remotely
- Consolidate /remote TUI command into kilo-commands
- Add session.viewed endpoint to the generated SDK
- RemoteProtocol.Preview schema for diagnostic logging
2026-03-24 13:54:30 +01:00

32 lines
965 B
TypeScript

// kilocode_change - new file
import { cmd } from "./cmd"
import { bootstrap } from "../bootstrap"
import { KiloSessions } from "@/kilo-sessions/kilo-sessions"
import { Instance } from "@/project/instance"
export const RemoteCommand = cmd({
command: "remote",
describe: "enable remote connection for real-time session relay",
builder: (yargs) => yargs,
handler: async () => {
await bootstrap(process.cwd(), async () => {
await KiloSessions.enableRemote()
console.log("Remote connection enabled.")
const abort = new AbortController()
const shutdown = async () => {
try {
KiloSessions.disableRemote()
await Instance.dispose()
} finally {
abort.abort()
}
}
process.on("SIGTERM", shutdown)
process.on("SIGINT", shutdown)
process.on("SIGHUP", shutdown)
await new Promise((resolve) => abort.signal.addEventListener("abort", resolve))
})
},
})