feat: add trans playwright passthrough

This commit is contained in:
Codex
2026-06-14 00:44:11 +00:00
parent e5860cc36c
commit fd8954e443
6 changed files with 493 additions and 8 deletions
+44 -7
View File
@@ -66,6 +66,23 @@ interface SshFileTransferDownloadResult {
remainingBytes: number;
}
export interface SshVerifiedDownloadResult {
remotePath: string;
localPath: string;
bytes: number;
sha256: string;
verified: true;
verification: Record<string, unknown>;
transfer: {
strategy: SshFileTransferDownloadResult["strategy"];
transport: SshFileTransferDownloadResult["transport"];
chunks: number;
elapsedMs: number;
throughputBytesPerSecond: number;
remainingBytes: number;
};
}
class SshFileTransferError extends Error {
constructor(message: string, public readonly details: Record<string, unknown> = {}) {
super(message);
@@ -117,11 +134,7 @@ export async function runSshFileTransferOperation(
return 0;
}
const read = await downloadRemoteFileVerified(invocation, executor, builders, options.remotePath, localPath, options.inactivityTimeoutMs);
const verification = buildTransferVerification(
{ side: "remote", path: options.remotePath, ...read.remote },
{ side: "local", path: localPath, ...read.local },
);
const download = await downloadSshFileVerified(invocation, executor, builders, options.remotePath, localPath, options.inactivityTimeoutMs);
process.stdout.write(`${JSON.stringify({
ok: true,
command: "ssh download",
@@ -129,6 +142,31 @@ export async function runSshFileTransferOperation(
providerId: invocation.providerId,
remotePath: options.remotePath,
localPath,
bytes: download.bytes,
sha256: download.sha256,
verified: true,
verification: download.verification,
transfer: download.transfer,
}, null, 2)}\n`);
return 0;
}
export async function downloadSshFileVerified(
invocation: ParsedSshInvocation,
executor: SshRemoteCommandExecutor,
builders: SshFileTransferCommandBuilders,
remotePath: string,
localPath: string,
inactivityTimeoutMs?: number,
): Promise<SshVerifiedDownloadResult> {
const read = await downloadRemoteFileVerified(invocation, executor, builders, remotePath, localPath, inactivityTimeoutMs);
const verification = buildTransferVerification(
{ side: "remote", path: remotePath, ...read.remote },
{ side: "local", path: localPath, ...read.local },
);
return {
remotePath,
localPath,
bytes: read.remote.bytes,
sha256: read.remote.sha256,
verified: true,
@@ -141,8 +179,7 @@ export async function runSshFileTransferOperation(
throughputBytesPerSecond: read.throughputBytesPerSecond,
remainingBytes: read.remainingBytes,
},
}, null, 2)}\n`);
return 0;
};
}
function parseSshFileTransferCliOptions(args: string[]): SshFileTransferCliOptions {