Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bridge-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"devDependencies": {
"@crxjs/vite-plugin": "2.4.0",
"@types/chrome": "^0.0.260",
"@types/chrome": "^0.3.5",
"@types/node": "^20.19.43",
"typescript": "^5.3.0",
"vite": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion bridge-browser/src/background/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async function redeemBridgeCode(
}

async function findConflictTabId(port: number, tabId: number): Promise<string | null> {
const all = await chrome.storage.local.get(null) as Record<string, unknown>;
const all = await chrome.storage.local.get(null);
for (const [key, val] of Object.entries(all)) {
if (isConflictingSession(key, val, port, tabId)) {
return key.replace("session_", "");
Expand Down
2 changes: 1 addition & 1 deletion bridge-browser/src/background/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function handleInstalled(details?: chrome.runtime.InstalledDetails)
}

async function clearStoredSessions(): Promise<void> {
const localItems = await chrome.storage.local.get(null) as Record<string, unknown>;
const localItems = await chrome.storage.local.get(null);
const sessionKeys = Object.keys(localItems).filter(
(key) => key.startsWith('session_') || key.startsWith('disconnect_')
);
Expand Down
2 changes: 1 addition & 1 deletion bridge-browser/src/background/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function discoverGateways(): Promise<DiscoveredGateway[]> {
}

async function readPreferredPort(): Promise<number | null> {
const stored = await chrome.storage.local.get([LAST_GATEWAY_PORT_KEY]) as Record<string, unknown>;
const stored = await chrome.storage.local.get([LAST_GATEWAY_PORT_KEY]);
const value = stored[LAST_GATEWAY_PORT_KEY];
return typeof value === "number" && Number.isInteger(value) ? value : null;
}
Expand Down
4 changes: 3 additions & 1 deletion bridge-browser/src/background/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ export async function focusNotificationSourceTab(notificationId: string): Promis
const tabId = getNotificationSourceTabId(notificationId);
if (tabId === null) {return;}

// `tabs.update` resolves to undefined when the tab no longer exists, so the
// window focus step is skipped instead of dereferencing a missing tab.
const tab = await chrome.tabs.update(tabId, { active: true });

if (typeof tab.windowId === "number" && tab.windowId !== chrome.windows.WINDOW_ID_NONE) {
if (tab && typeof tab.windowId === "number" && tab.windowId !== chrome.windows.WINDOW_ID_NONE) {
await focusWindow(tab.windowId);
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion bridge-browser/src/background/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_SESSION_PRESET_SETTINGS: SessionPresetSettings = {
};

export async function getSessionPresetSettings(): Promise<SessionPresetSettings> {
const result = await chrome.storage.local.get([SESSION_PRESET_SETTINGS_KEY]) as Record<string, unknown>;
const result = await chrome.storage.local.get([SESSION_PRESET_SETTINGS_KEY]);
return normalizeSessionPresetSettings(result[SESSION_PRESET_SETTINGS_KEY]);
}

Expand Down
6 changes: 3 additions & 3 deletions bridge-browser/src/background/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export type ActiveProtocolSessionResult =

export async function getSession(tabId: number): Promise<Session | undefined> {
const key = `session_${tabId}`;
const result = await chrome.storage.local.get([key]) as Record<string, unknown>;
const result = await chrome.storage.local.get([key]);
return normalizeSession(result[key]) ?? undefined;
}

export async function getStoredSessionTabIds(): Promise<number[]> {
const result = await chrome.storage.local.get(null) as Record<string, unknown>;
const result = await chrome.storage.local.get(null);
return Object.keys(result)
.map(getSessionTabIdFromKey)
.filter((tabId): tabId is number => typeof tabId === "number");
Expand All @@ -31,7 +31,7 @@ export async function getSessionDisconnectReason(
tabId: number
): Promise<SessionDisconnectReason | undefined> {
const key = getDisconnectReasonKey(tabId);
const result = await chrome.storage.local.get([key]) as Record<string, unknown>;
const result = await chrome.storage.local.get([key]);
return normalizeDisconnectReason(result[key]);
}

Expand Down
2 changes: 1 addition & 1 deletion bridge-browser/src/background/tab_lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { checkUrlSafety, isBridgePageUrl } from './url_safety';

export async function handleTabUpdated(
tabId: number,
changeInfo: chrome.tabs.TabChangeInfo,
changeInfo: chrome.tabs.OnUpdatedInfo,
tab: chrome.tabs.Tab
) {
// Use URL from changeInfo if available, otherwise fallback to tab.url
Expand Down
2 changes: 1 addition & 1 deletion bridge-browser/src/content/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ chrome.storage.onChanged.addListener((changes, namespace) => {
if (namespace === "local") {
const approvalStorageKey = `allowed_tools_${currentWorkspaceId}`;
if (changes[approvalStorageKey]) {
approvalState = parseStoredApprovalEntries(changes[approvalStorageKey].newValue as unknown);
approvalState = parseStoredApprovalEntries(changes[approvalStorageKey].newValue);
Logger.log(`Allowed tools updated (Workspace: ${currentWorkspaceId})`, "action");
}
if (changes.syncedAiSites) {
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading