fix: route AgentRun bridge from runners

This commit is contained in:
AgentRun Codex
2026-06-11 01:57:17 +00:00
parent 23e2a6e3e2
commit 0d0b3e21f3
5 changed files with 217 additions and 6 deletions
+22
View File
@@ -535,6 +535,28 @@ function scopedSshFrontendSession(host: string, config: UniDeskConfig, token: st
return { baseUrl: frontendBaseUrl(host, config), cookie: "", sshClientToken: token };
}
export async function runRemoteSshCommandCapture(
config: UniDeskConfig,
host: string,
target: string,
args: string[],
input?: string,
env: NodeJS.ProcessEnv = process.env,
): Promise<SshCaptureResult> {
const token = sshClientTokenFromEnv(env);
const session = token === null
? await loginFrontend(host, config)
: scopedSshFrontendSession(host, config, token);
const normalizedArgs = normalizeSshOperationArgs(args);
const invocation = parseSshInvocation(target, normalizedArgs);
const parsed = invocation.parsed;
if (parsed.remoteCommand === null) throw new Error(`remote ssh ${target} capture requires a non-interactive operation`);
const stdin = parsed.stdinPrefix !== undefined || parsed.stdinSuffix !== undefined
? `${parsed.stdinPrefix ?? ""}${input ?? ""}${parsed.stdinSuffix ?? ""}`
: input;
return await runRemoteSshWebSocketCaptureRemoteCommand(session, invocation, parsed.remoteCommand, stdin);
}
async function frontendJson(session: FrontendSession, path: string, init?: RequestInit, timeoutMs = 8000, maxResponseBytes = 5_000_000): Promise<FetchJsonResult> {
const headers = new Headers(init?.headers);
headers.set("cookie", session.cookie);