




























@@ -21,14 +21,6 @@ export type BrowserActResponse = {
2121results?: Array<{ ok: boolean; error?: string }>;
2222};
232324-export type BrowserDownloadPayload = {
25-url: string;
26-suggestedFilename: string;
27-path: string;
28-};
29-30-type BrowserDownloadResult = { ok: true; targetId: string; download: BrowserDownloadPayload };
31-3224const BROWSER_ACT_REQUEST_TIMEOUT_SLACK_MS = 5_000;
33253426function normalizePositiveTimeoutMs(value: unknown): number | undefined {
@@ -52,21 +44,6 @@ function resolveBrowserActRequestTimeoutMs(req: BrowserActRequest): number {
5244return Math.max(...candidateTimeouts);
5345}
544655-async function postDownloadRequest(
56-baseUrl: string | undefined,
57-route: "/wait/download" | "/download",
58-body: Record<string, unknown>,
59-profile?: string,
60-): Promise<BrowserDownloadResult> {
61-const q = buildProfileQuery(profile);
62-return await fetchBrowserJson<BrowserDownloadResult>(withBaseUrl(baseUrl, `${route}${q}`), {
63-method: "POST",
64-headers: { "Content-Type": "application/json" },
65-body: JSON.stringify(body),
66-timeoutMs: 20000,
67-});
68-}
69-7047export async function browserNavigate(
7148baseUrl: string | undefined,
7249opts: {
@@ -136,50 +113,6 @@ export async function browserArmFileChooser(
136113});
137114}
138115139-export async function browserWaitForDownload(
140-baseUrl: string | undefined,
141-opts: {
142-path?: string;
143-targetId?: string;
144-timeoutMs?: number;
145-profile?: string;
146-},
147-): Promise<BrowserDownloadResult> {
148-return await postDownloadRequest(
149-baseUrl,
150-"/wait/download",
151-{
152-targetId: opts.targetId,
153-path: opts.path,
154-timeoutMs: opts.timeoutMs,
155-},
156-opts.profile,
157-);
158-}
159-160-export async function browserDownload(
161-baseUrl: string | undefined,
162-opts: {
163-ref: string;
164-path: string;
165-targetId?: string;
166-timeoutMs?: number;
167-profile?: string;
168-},
169-): Promise<BrowserDownloadResult> {
170-return await postDownloadRequest(
171-baseUrl,
172-"/download",
173-{
174-targetId: opts.targetId,
175-ref: opts.ref,
176-path: opts.path,
177-timeoutMs: opts.timeoutMs,
178-},
179-opts.profile,
180-);
181-}
182-183116export async function browserAct(
184117baseUrl: string | undefined,
185118req: BrowserActRequest,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。