fix(runtime): incorrectly takeover the browser when user open up different tab within the same window

This commit is contained in:
Ljy-0827
2026-07-24 14:07:33 +08:00
parent 4e44fb2823
commit f73a0e9fb3
9 changed files with 419 additions and 139 deletions
@@ -30,6 +30,7 @@ describe("help-bridge", () => {
type: HELP_REQUEST,
requestId: "r1",
prompt: "log in",
displayMode: "compact",
selectors: ["#login"],
timeoutMs: 1000,
}),
+3
View File
@@ -22,6 +22,8 @@ export interface HelpRequestMessage {
prompt: string;
/** Custom overlay title; omitted when the extension should use its default. */
title?: string;
/** Full task UI on the subject tab; compact status UI on related tabs. */
displayMode?: "full" | "compact";
/** CSS selectors to scroll to + flash-highlight (may be empty). */
selectors: string[];
timeoutMs: number;
@@ -69,6 +71,7 @@ export function isHelpRequestMessage(msg: unknown): msg is HelpRequestMessage {
typeof m.requestId === "string" &&
typeof m.prompt === "string" &&
(m.title === undefined || typeof m.title === "string") &&
(m.displayMode === undefined || m.displayMode === "full" || m.displayMode === "compact") &&
Array.isArray(m.selectors) &&
m.selectors.every((selector) => typeof selector === "string") &&
typeof m.timeoutMs === "number"