Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(train): keep server/index.ts at its pinned line count after the VPS shell route

milind-soni75bcce95de29
diff --git a/server/index.ts b/server/index.ts
index c0c01bec94..2d067ffc1c 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -435,8 +435,7 @@ import { loopGuardSettings } from "./host/loop-guard.ts"; import { createUnatten
import { claudeUserSkillsEnabled } from "./turn-settings.ts";
import { addHeldSecretScrubber, redactSecretsInText, scrubHeldSecrets } from "./redact.ts";
import * as vps from "./vps-computer.ts";
-import { vpsConfigForBot, vpsSshAliasForBot } from "./vps-hosts.ts";
-import { vpsContainerExec } from "./vps-exec.ts";
+import { vpsConfigForBot, vpsSshAliasForBot } from "./vps-hosts.ts"; import { vpsContainerExec } from "./vps-exec.ts";
import { ROUTINE_RESTARTED, RoutineManager, type Routine, type RoutineRun, type RoutineRunOn, type RoutineRunTrigger } from "./routines.ts"; import { routineModelRefusal, routineThreadModel, type RoutineModelChecks } from "./routine-input.ts"; import { routineHistoryFor, routineRunsFor } from "./routine-run-window.ts"; import { runTurnLive } from "./routine-turn-live.ts"; import { batchSaves, flushLaterSaves } from "./save-batch.ts";
import { CalendarCallManager, type CalendarCall } from "./calendar-calls.ts";
import { BROWSER_UPLOAD_TOOL, browserRuntimeEnv } from "./browser-runtime.ts";
@@ -5809,8 +5808,7 @@ async function mountBotVps(
autoVmClaims.set(owner.threadId, {
owner,
lazy: true,
- label: "the VPS computer",
- vps: { sshAlias: remote.sshAlias, container: remote.container_id ?? vps.vpsContainerName(bot.id) },
+ label: "the VPS computer", vps: { sshAlias: remote.sshAlias, container: remote.container_id ?? vps.vpsContainerName(bot.id) },
onRejected: opts.onRejected,
claim: async () => {
await bindTurnComputer(owner, vpsResource, true);
@@ -13124,16 +13122,8 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
}
const body = await readInternalBody();
try {
- const vm = await attachmentVmForTurn(internalCapability);
- const vpsSlot = vm ? undefined : autoVmClaims.get(threadId);
- if (vpsSlot?.vps && vpsSlot.owner.generation === internalCapability.generation) {
- const gate = await computerCallGate(internalCapability);
- if (gate.held) return json(res, 409, { error: controlRefusal(gate) });
- requireActiveInternalCapability();
- const target = autoVmClaims.get(threadId)?.vps;
- if (target) return json(res, 200, await vpsContainerExec(target, typeof body.command === "string" ? body.command : "", { timeoutSeconds: typeof body.timeout_seconds === "number" ? body.timeout_seconds : undefined }));
- }
- if (!vm) return json(res, 409, { error: "You have no Local VM or Self-hosted VPS desktop in this turn, so there is nowhere to run a command." });
+ const vm = await attachmentVmForTurn(internalCapability); const vpsSlot = vm ? undefined : autoVmClaims.get(threadId);
+ if (vpsSlot?.vps && vpsSlot.owner.generation === internalCapability.generation) { const gate = await computerCallGate(internalCapability); if (gate.held) return json(res, 409, { error: controlRefusal(gate) }); requireActiveInternalCapability(); const target = autoVmClaims.get(threadId)?.vps; if (target) return json(res, 200, await vpsContainerExec(target, typeof body.command === "string" ? body.command : "", { timeoutSeconds: typeof body.timeout_seconds === "number" ? body.timeout_seconds : undefined })); } if (!vm) return json(res, 409, { error: "You have no Local VM or Self-hosted VPS desktop in this turn, so there is nowhere to run a command." });
const runtime = (await containerRuntimeStatus()).runtime;
requireActiveInternalCapability();
if (!runtime || !internalCapabilityIsActive({ ...internalCapability, localVmTarget: vm }) ||