Replace RCON with API-only emulator transport
CI / check (push) Successful in 30s
CI / release (push) Skipped
CI / deploy (push) Successful in 1m9s

- Switch default EMULATOR_MODE from 'rcon' to 'api'
- Remove RCON_HOST/PORT/timeout/maxRetries env vars
- Add EMULATOR_API_URL to .env and .env.example
- Update createEmulatorTransport() to use HTTP API only
- Remove rconHost/port from offline alert context
- All 827 tests pass, TypeScript compiles cleanly
This commit is contained in:
openhands committed 2026-08-22 15:12:56 +02:00
1 parent e6dd22a4de
commit e06e419707
4 files changed
+15 -30

No files matched your search

+1 -3
View File
@@ -223,10 +223,8 @@ export function emulatorOffline(detail?: string): Promise<SendAlertResult> {
severity: "critical",
message: detail
? `Emulator appears offline: ${detail}`
: "Emulator appears offline — RCON connection could not be established.",
: "Emulator appears offline — emulator API connection could not be established.",
context: {
rconHost: env.RCON_HOST,
rconPort: env.RCON_PORT,
...(detail ? { detail } : {}),
},
});
+9 -13
View File
@@ -225,24 +225,20 @@ export function httpTransport(opts: {
* misconfiguration surfaces immediately instead of on first command.
*/
export function createEmulatorTransport(): RconTransport {
if (env.EMULATOR_MODE === "api") {
if (!env.EMULATOR_API_URL) {
throw new Error("EMULATOR_MODE=api requires EMULATOR_API_URL to be set");
}
const mode = env.EMULATOR_MODE ?? "api";
if (mode === "api") {
return httpTransport({
url: env.EMULATOR_API_URL,
timeoutMs: env.RCON_TIMEOUT_MS,
url: env.EMULATOR_API_URL ?? "http://127.0.0.1:3001",
timeoutMs: 10_000,
apiKey: env.EMULATOR_API_KEY,
apiKeyHeader: env.EMULATOR_API_KEY_HEADER,
maxRetries: env.RCON_MAX_RETRIES,
maxRetries: 3,
});
}
return tcpTransport({
host: env.RCON_HOST,
port: env.RCON_PORT,
timeoutMs: env.RCON_TIMEOUT_MS,
maxRetries: env.RCON_MAX_RETRIES,
});
// API mode only; RCON transport removed.
throw new Error(
"EMULATOR_MODE=rcon is no longer supported; use EMULATOR_MODE=api",
);
}
const globalForRcon = globalThis as unknown as { rcon?: RconClient };