fix browser issues

This commit is contained in:
Arjun 2026-07-02 19:11:53 +05:30
parent 35a3a77d10
commit 7f3987094f
5 changed files with 440 additions and 26 deletions

View file

@ -14,6 +14,15 @@ export const BrowserStateSchema = z.object({
tabs: z.array(BrowserTabStateSchema),
});
// HTTP basic/proxy auth challenge raised by a page in the embedded browser.
// Defined once here so main, preload, and renderer share one shape.
export const HttpAuthRequestSchema = z.object({
requestId: z.string(),
host: z.string(),
isProxy: z.boolean(),
realm: z.string().optional(),
});
export const BrowserPageElementSchema = z.object({
index: z.number().int().positive(),
tagName: z.string(),
@ -134,6 +143,7 @@ export const BrowserControlResultSchema = z.object({
export type BrowserTabState = z.infer<typeof BrowserTabStateSchema>;
export type BrowserState = z.infer<typeof BrowserStateSchema>;
export type HttpAuthRequest = z.infer<typeof HttpAuthRequestSchema>;
export type BrowserPageElement = z.infer<typeof BrowserPageElementSchema>;
export type BrowserPageSnapshot = z.infer<typeof BrowserPageSnapshotSchema>;
export type BrowserControlAction = z.infer<typeof BrowserControlActionSchema>;

View file

@ -18,7 +18,7 @@ import { RequestedAgent, type TurnEvent } from './turns.js';
import type { SessionBusEvent, SessionIndexEntry, SessionState } from './sessions.js';
import { RowboatApiConfig } from './rowboat-account.js';
import { ZListToolkitsResponse } from './composio.js';
import { BrowserStateSchema } from './browser-control.js';
import { BrowserStateSchema, HttpAuthRequestSchema } from './browser-control.js';
import { BillingInfoSchema } from './billing.js';
import { EmailBlockSchema, GmailThreadSchema } from './blocks.js';
import { PermissionDecision, ApprovalPolicy, CodingAgent } from './code-mode.js';
@ -1667,6 +1667,30 @@ const ipcSchemas = {
req: BrowserStateSchema,
res: z.null(),
},
// HTTP basic/proxy auth challenge from a page in the embedded browser
// (main → renderer push). The renderer shows a credential prompt and
// answers via browser:httpAuthResponse.
'browser:httpAuthRequest': {
req: HttpAuthRequestSchema,
res: z.null(),
},
// Main → renderer: a pending auth challenge was resolved without the
// renderer answering (timed out, or its tab/window was destroyed), so the
// renderer must drop the corresponding dialog from its queue.
'browser:httpAuthResolved': {
req: z.object({ requestId: z.string() }),
res: z.null(),
},
// Renderer → main. Omit username to cancel the challenge; provide it (even
// empty, for token-style auth) to submit credentials.
'browser:httpAuthResponse': {
req: z.object({
requestId: z.string(),
username: z.string().optional(),
password: z.string().optional(),
}),
res: z.object({ ok: z.boolean() }),
},
// Billing channels
'billing:getInfo': {
req: z.null(),