fix(bsk): fix ci

This commit is contained in:
Ljy-0827
2026-08-24 15:02:52 +08:00
parent bf59753aa3
commit b801bc1f62
5 changed files with 30 additions and 23 deletions
@@ -440,7 +440,11 @@ describe("file transfer tools", () => {
totalBytes: 4,
bytesReceived: 0,
} as chrome.downloads.DownloadItem;
const complete = { ...initial, state: "complete", fileSize: 4 } as chrome.downloads.DownloadItem;
const complete = {
...initial,
state: "complete",
fileSize: 4,
} as chrome.downloads.DownloadItem;
const downloads: DownloadsApi = {
onCreated,
onChanged,
+4 -2
View File
@@ -298,7 +298,8 @@ export async function captureBrowserDownload(
const triggered = await options.trigger();
if (isRpcError(triggered)) {
void completion.catch(() => undefined);
const effect: TransferEffectState = capturedId !== undefined ? "committed" : intent ? "unknown" : "none";
const effect: TransferEffectState =
capturedId !== undefined ? "committed" : intent ? "unknown" : "none";
failureResult = {
...triggered,
data: { ...triggered.data, effect_state: effect, phase: "trigger" },
@@ -310,7 +311,8 @@ export async function captureBrowserDownload(
succeeded = true;
return { click, item };
} catch (err) {
const effect: TransferEffectState = capturedId !== undefined ? "committed" : click ? "unknown" : "none";
const effect: TransferEffectState =
capturedId !== undefined ? "committed" : click ? "unknown" : "none";
failureResult = captureError(
err instanceof Error ? err.message : String(err),
effect,
+1 -5
View File
@@ -4,11 +4,7 @@
import type { SessionManager } from "@/session-manager/manager";
import type { DownloadParams, DownloadResult, RpcError } from "@/transport/types";
import { captureBrowserDownload, chromeDownloadsApi, type DownloadsApi } from "./download-capture";
import {
clickResolvedTarget,
type InteractionDeps,
resolveActionTarget,
} from "./interaction";
import { clickResolvedTarget, type InteractionDeps, resolveActionTarget } from "./interaction";
import { enforceAgentWindow, isRpcError, lookupSession, resolveTargetTab } from "./shared";
let downloadActive = false;
@@ -46,7 +46,10 @@ export interface FileInputTransactionResult {
}
class BoundedWaitError extends Error {
constructor(readonly kind: "timeout" | "aborted", message: string) {
constructor(
readonly kind: "timeout" | "aborted",
message: string,
) {
super(message);
}
}
@@ -99,7 +102,11 @@ function transferFailure(
return transferError(code, reason, message, { effectState, phase });
}
function enrichFailure(error: RpcError, effectState: TransferEffectState, phase: UploadPhase): RpcError {
function enrichFailure(
error: RpcError,
effectState: TransferEffectState,
phase: UploadPhase,
): RpcError {
return {
...error,
data: { ...error.data, effect_state: effectState, phase },
@@ -187,10 +194,15 @@ export async function uploadThroughActivatedFileInput(
try {
const resolved = await waitBounded(
sendToCdpTarget<{ object?: { objectId?: string } }>(options.cdp, target, "DOM.resolveNode", {
backendNodeId: options.actionTarget.backendNodeId,
objectGroup,
}),
sendToCdpTarget<{ object?: { objectId?: string } }>(
options.cdp,
target,
"DOM.resolveNode",
{
backendNodeId: options.actionTarget.backendNodeId,
objectGroup,
},
),
deadline,
options.signal,
"resolving upload trigger timed out",
@@ -309,10 +321,7 @@ export async function uploadThroughActivatedFileInput(
let backendNodeId: number | undefined;
let multiple = summary.multiple;
if (chooser) {
if (
options.actionTarget.frameId &&
chooser.frameId !== options.actionTarget.frameId
) {
if (options.actionTarget.frameId && chooser.frameId !== options.actionTarget.frameId) {
outcome = transferFailure(
"unsupported",
"file_input_not_activated",
+1 -5
View File
@@ -5,11 +5,7 @@
import type { SessionManager } from "@/session-manager/manager";
import type { RpcError, UploadParams, UploadResult } from "@/transport/types";
import { uploadThroughActivatedFileInput } from "./file-input-transaction";
import {
clickResolvedTarget,
type InteractionDeps,
resolveActionTarget,
} from "./interaction";
import { clickResolvedTarget, type InteractionDeps, resolveActionTarget } from "./interaction";
import {
type CdpRunner,
enforceAgentWindow,