@andorra-labs/code 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/acp-agent.d.ts +54 -0
- package/dist/src/acp-agent.js +991 -0
- package/dist/src/agent-definitions.js +29 -6
- package/dist/src/agent-execution.js +8 -2
- package/dist/src/agent-mcp-catalog.js +2 -0
- package/dist/src/agent-mcp.d.ts +3 -1
- package/dist/src/agent-mcp.js +97 -11
- package/dist/src/andorra/entry.js +21 -3
- package/dist/src/andorra/hosted.d.ts +3 -0
- package/dist/src/andorra/hosted.js +5 -1
- package/dist/src/andorra/notices.d.ts +10 -1
- package/dist/src/andorra/notices.js +25 -2
- package/dist/src/andorra/terminal.d.ts +2 -0
- package/dist/src/andorra/terminal.js +2 -2
- package/dist/src/app-server/protocol.d.ts +9 -2
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server/workspace.d.ts +1 -0
- package/dist/src/app-server/workspace.js +141 -10
- package/dist/src/app-server.d.ts +115 -0
- package/dist/src/app-server.js +980 -63
- package/dist/src/auth/AuthManager.js +4 -4
- package/dist/src/auth/deployment.js +2 -2
- package/dist/src/browser-bridge.d.ts +1 -0
- package/dist/src/browser-bridge.js +5 -2
- package/dist/src/browser-external-app.d.ts +27 -0
- package/dist/src/browser-external-app.js +60 -0
- package/dist/src/browser-panel-tool.d.ts +6 -0
- package/dist/src/browser-panel-tool.js +36 -0
- package/dist/src/browser-runner.js +1 -0
- package/dist/src/browser-server.d.ts +5 -0
- package/dist/src/browser-server.js +27 -3
- package/dist/src/browser-ui/style.css +3 -3
- package/dist/src/browser-ui/tokens.css +27 -16
- package/dist/src/browser-view.d.ts +16 -0
- package/dist/src/browser-view.js +60 -2
- package/dist/src/bug-report.d.ts +81 -0
- package/dist/src/bug-report.js +235 -0
- package/dist/src/claude-provider.d.ts +2 -1
- package/dist/src/claude-provider.js +13 -9
- package/dist/src/cli-sign-in.d.ts +3 -1
- package/dist/src/cli-sign-in.js +4 -1
- package/dist/src/cli.js +184 -40
- package/dist/src/codex-errors.js +4 -1
- package/dist/src/coding-tools.js +7 -7
- package/dist/src/command-screens.d.ts +9 -2
- package/dist/src/command-screens.js +166 -97
- package/dist/src/commands.d.ts +3 -2
- package/dist/src/commands.js +1 -0
- package/dist/src/compaction-phrases.d.ts +4 -0
- package/dist/src/compaction-phrases.js +20 -0
- package/dist/src/completion-gates.d.ts +22 -0
- package/dist/src/completion-gates.js +11 -0
- package/dist/src/config.d.ts +5 -0
- package/dist/src/config.js +48 -0
- package/dist/src/context-compaction.js +2 -1
- package/dist/src/decision/DecisionManager.js +3 -2
- package/dist/src/decision/requestPhrases.d.ts +4 -0
- package/dist/src/decision/requestPhrases.js +23 -0
- package/dist/src/github-inbox.d.ts +55 -0
- package/dist/src/github-inbox.js +153 -0
- package/dist/src/google-provider.d.ts +31 -0
- package/dist/src/google-provider.js +153 -0
- package/dist/src/graph-health.js +8 -4
- package/dist/src/graph-manager-chat.js +6 -1
- package/dist/src/graph-provider-portability.js +32 -10
- package/dist/src/graph-quota.d.ts +29 -2
- package/dist/src/graph-quota.js +68 -10
- package/dist/src/graph-runner.js +24 -7
- package/dist/src/graph-server.d.ts +1 -1
- package/dist/src/graph-server.js +9 -7
- package/dist/src/graph-sync.d.ts +1 -0
- package/dist/src/graph-sync.js +93 -34
- package/dist/src/graph-tool.d.ts +2 -0
- package/dist/src/graph-tool.js +2 -2
- package/dist/src/graph-ui/app.js +177 -41
- package/dist/src/graph-ui/controls.css +1 -0
- package/dist/src/graph-ui/edge-router.js +121 -53
- package/dist/src/graph-ui/embed.js +2 -2
- package/dist/src/graph-ui/icons.js +1 -0
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graph-ui/manager.css +1 -1
- package/dist/src/graph-ui/manager.js +2 -2
- package/dist/src/graph-ui/sidebar.js +30 -0
- package/dist/src/graph-ui/studio-canvas.js +26 -13
- package/dist/src/graph-ui/studio.css +15 -7
- package/dist/src/graph-ui/studio.js +11 -4
- package/dist/src/graph-ui/style.css +77 -45
- package/dist/src/graph-ui/theme.js +3 -36
- package/dist/src/graph-ui/tokens.css +27 -19
- package/dist/src/graph-visibility.d.ts +31 -0
- package/dist/src/graph-visibility.js +102 -0
- package/dist/src/graphs.js +4 -3
- package/dist/src/live-model.d.ts +24 -0
- package/dist/src/live-model.js +37 -0
- package/dist/src/managed-sign-in.d.ts +1 -0
- package/dist/src/managed-sign-in.js +13 -0
- package/dist/src/membership-errors.d.ts +2 -0
- package/dist/src/membership-errors.js +5 -1
- package/dist/src/membership.d.ts +23 -1
- package/dist/src/membership.js +48 -6
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +1 -1
- package/dist/src/model-metadata.js +12 -3
- package/dist/src/paged-transcript.d.ts +2 -0
- package/dist/src/paged-transcript.js +16 -0
- package/dist/src/plan-pass.d.ts +59 -0
- package/dist/src/plan-pass.js +165 -0
- package/dist/src/provider-connection.js +17 -0
- package/dist/src/provider-engine.d.ts +5 -0
- package/dist/src/provider-engine.js +6 -3
- package/dist/src/provider-import.js +3 -1
- package/dist/src/provider-settings.js +14 -2
- package/dist/src/providers.d.ts +33 -2
- package/dist/src/providers.js +101 -28
- package/dist/src/pull-request-checks.d.ts +26 -0
- package/dist/src/pull-request-checks.js +56 -0
- package/dist/src/pull-request-conversation.d.ts +134 -0
- package/dist/src/pull-request-conversation.js +221 -0
- package/dist/src/pull-request-create.d.ts +175 -0
- package/dist/src/pull-request-create.js +392 -0
- package/dist/src/pull-request-details.d.ts +242 -0
- package/dist/src/pull-request-details.js +614 -0
- package/dist/src/pull-request-edit.d.ts +23 -0
- package/dist/src/pull-request-edit.js +91 -0
- package/dist/src/pull-request-logs.d.ts +76 -0
- package/dist/src/pull-request-logs.js +172 -0
- package/dist/src/pull-request-merge.d.ts +112 -0
- package/dist/src/pull-request-merge.js +258 -0
- package/dist/src/pull-request-review.d.ts +137 -0
- package/dist/src/pull-request-review.js +401 -0
- package/dist/src/pull-requests.d.ts +43 -2
- package/dist/src/pull-requests.js +112 -21
- package/dist/src/react-runtime.js +58 -9
- package/dist/src/read-document-tool.d.ts +2 -0
- package/dist/src/read-document-tool.js +6 -6
- package/dist/src/remote/engine-pool.js +42 -6
- package/dist/src/run-control.d.ts +10 -0
- package/dist/src/run-control.js +24 -0
- package/dist/src/run-progress.d.ts +10 -0
- package/dist/src/run-progress.js +122 -0
- package/dist/src/run-records.d.ts +2 -2
- package/dist/src/runtime-environment.d.ts +1 -0
- package/dist/src/runtime-environment.js +13 -0
- package/dist/src/runtime.d.ts +5 -1
- package/dist/src/runtime.js +14 -2
- package/dist/src/save-lock.js +14 -7
- package/dist/src/session-title.d.ts +3 -0
- package/dist/src/session-title.js +5 -2
- package/dist/src/sign-in-detection.d.ts +1 -1
- package/dist/src/sign-in-detection.js +10 -3
- package/dist/src/sign-in-offer.js +1 -1
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/bug-report/SKILL.md +80 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +9 -1
- package/dist/src/skills/bundled/graph-manager/errors.md +1 -0
- package/dist/src/skills/bundled/provenance.json +7 -2
- package/dist/src/skills/runtime-skills.js +1 -0
- package/dist/src/subagent-run.js +1 -0
- package/dist/src/telemetry/capture-core.d.ts +17 -0
- package/dist/src/telemetry/capture-core.js +59 -1
- package/dist/src/telemetry/classify.d.ts +3 -1
- package/dist/src/telemetry/classify.js +37 -0
- package/dist/src/telemetry/emitter.d.ts +2 -0
- package/dist/src/telemetry/emitter.js +42 -5
- package/dist/src/telemetry/schema.d.ts +22 -0
- package/dist/src/telemetry/schema.js +68 -1
- package/dist/src/telemetry/surface.d.ts +1 -0
- package/dist/src/telemetry/uploader.d.ts +12 -1
- package/dist/src/telemetry/uploader.js +30 -2
- package/dist/src/terminal-links.d.ts +16 -0
- package/dist/src/terminal-links.js +113 -0
- package/dist/src/terminal-ui.d.ts +8 -1
- package/dist/src/terminal-ui.js +40 -14
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/trajectory.js +6 -1
- package/dist/src/transcript.d.ts +2 -0
- package/dist/src/transcript.js +10 -3
- package/dist/src/types.d.ts +9 -0
- package/dist/src/usage-analytics.js +18 -10
- package/package.json +2 -1
|
@@ -146,12 +146,12 @@ export class AuthManager {
|
|
|
146
146
|
try {
|
|
147
147
|
return await this.fetch(`${this.config.domain}${path}`, { method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded' }, body, redirect: 'error', signal: signal ? AbortSignal.any([signal, deadline]) : deadline });
|
|
148
148
|
}
|
|
149
|
-
catch {
|
|
149
|
+
catch (error) {
|
|
150
150
|
if (signal?.aborted)
|
|
151
151
|
throw new AuthError('cancelled', 'Authentication cancelled.');
|
|
152
152
|
if (deadline.aborted)
|
|
153
|
-
throw new AuthError('network', 'The account service did not respond in time. Retry shortly.');
|
|
154
|
-
throw new AuthError('network', 'The account service is unavailable. Retry shortly.');
|
|
153
|
+
throw new AuthError('network', 'The account service did not respond in time. Retry shortly.', { cause: error });
|
|
154
|
+
throw new AuthError('network', 'The account service is unavailable. Retry shortly.', { cause: error });
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
async tokenResponse(body, signal) {
|
|
@@ -159,7 +159,7 @@ export class AuthManager {
|
|
|
159
159
|
if (!response.ok) {
|
|
160
160
|
if (response.status !== 400 && response.status !== 401) {
|
|
161
161
|
await response.body?.cancel().catch(() => { });
|
|
162
|
-
throw new AuthError('network', 'The account service is unavailable. Retry shortly.');
|
|
162
|
+
throw new AuthError('network', 'The account service is unavailable. Retry shortly.', { cause: Object.assign(new Error(`HTTP ${response.status}`), { code: `HTTP_${response.status}` }) });
|
|
163
163
|
}
|
|
164
164
|
let refusal;
|
|
165
165
|
try {
|
|
@@ -2,8 +2,8 @@ export const AUTH_DEPLOYMENT = {
|
|
|
2
2
|
issuer: 'https://cognito-idp.us-east-2.amazonaws.com/us-east-2_RBw7LImHf',
|
|
3
3
|
clientId: '5gsaecbpdqnt6a0mh6u6h46gag',
|
|
4
4
|
domain: 'https://auth.andorracode.com',
|
|
5
|
-
apiBaseUrl: 'https://
|
|
6
|
-
telemetryBaseUrl: 'https://
|
|
5
|
+
apiBaseUrl: 'https://api.andorracode.com/v1',
|
|
6
|
+
telemetryBaseUrl: 'https://api.andorracode.com/telemetry/v1',
|
|
7
7
|
inferenceBaseUrl: 'https://inference.andorracode.com',
|
|
8
8
|
redirectUri: 'http://localhost:43187/callback',
|
|
9
9
|
};
|
|
@@ -31,6 +31,7 @@ export interface BrowserSession extends SavedSession {
|
|
|
31
31
|
export declare function validBrowserSession(value: unknown): value is BrowserSession;
|
|
32
32
|
export declare function browserReply(res: ServerResponse, status: number, value: unknown): void;
|
|
33
33
|
export declare function browserBody(req: IncomingMessage): Promise<Record<string, unknown>>;
|
|
34
|
+
export declare function browserBearerMatches(req: IncomingMessage, token: string): boolean;
|
|
34
35
|
export declare function browserAuthorized(req: IncomingMessage, token: string, origin: string): boolean;
|
|
35
36
|
export interface BrowserBridgeActions {
|
|
36
37
|
prompt(text: string): void | Promise<void>;
|
|
@@ -35,10 +35,13 @@ export async function browserBody(req) {
|
|
|
35
35
|
throw new Error('Expected a JSON object');
|
|
36
36
|
return value;
|
|
37
37
|
}
|
|
38
|
-
export function
|
|
38
|
+
export function browserBearerMatches(req, token) {
|
|
39
39
|
const supplied = Buffer.from(req.headers.authorization || '');
|
|
40
40
|
const expected = Buffer.from(`Bearer ${token}`);
|
|
41
|
-
return
|
|
41
|
+
return supplied.length === expected.length && timingSafeEqual(supplied, expected);
|
|
42
|
+
}
|
|
43
|
+
export function browserAuthorized(req, token, origin) {
|
|
44
|
+
return req.headers.host === new URL(origin).host && (!req.headers.origin || req.headers.origin === origin) && browserBearerMatches(req, token);
|
|
42
45
|
}
|
|
43
46
|
export async function createBrowserBridge(directory, snapshot, actions, cancellation) {
|
|
44
47
|
const token = randomBytes(32).toString('hex');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A page that navigates to an app link (slack://, zoommtg://, ms-teams:// …) makes
|
|
3
|
+
* a headed Chromium raise its "Open <app>?" prompt. The prompt is part of the
|
|
4
|
+
* browser window, not the page, so the panel's screencast never shows it, and
|
|
5
|
+
* while it is up Chromium drops every click and key sent to that tab. The panel
|
|
6
|
+
* runs its window offscreen, so the tab looks frozen for no visible reason.
|
|
7
|
+
*
|
|
8
|
+
* Two layers deal with it. The guard below runs in every frame and cancels the
|
|
9
|
+
* navigations it can see (location changes, link clicks, window.open), so no
|
|
10
|
+
* prompt appears. Chromium offers no way to cancel the rest (an iframe whose src
|
|
11
|
+
* is an app link, a server redirect, a form post), so the panel watches for the
|
|
12
|
+
* request instead and tells the user and the agent how to clear the prompt.
|
|
13
|
+
*/
|
|
14
|
+
/** The scheme of a URL that would be handed to another application, lower-cased and without the colon. */
|
|
15
|
+
export declare function externalAppScheme(url: unknown): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Runs in the page, in every frame, before the page's own scripts. It only adds a
|
|
18
|
+
* listener to the Navigation API; nothing on the page is patched or replaced.
|
|
19
|
+
*/
|
|
20
|
+
export declare const EXTERNAL_APP_GUARD_SCRIPT: string;
|
|
21
|
+
export declare function guardExternalApps(context: any): Promise<void>;
|
|
22
|
+
export interface ExternalAppPrompt {
|
|
23
|
+
scheme: string;
|
|
24
|
+
at: number;
|
|
25
|
+
}
|
|
26
|
+
/** What the agent is told while a tab may be sitting behind the prompt. */
|
|
27
|
+
export declare function externalAppPromptNote(prompt: ExternalAppPrompt): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A page that navigates to an app link (slack://, zoommtg://, ms-teams:// …) makes
|
|
3
|
+
* a headed Chromium raise its "Open <app>?" prompt. The prompt is part of the
|
|
4
|
+
* browser window, not the page, so the panel's screencast never shows it, and
|
|
5
|
+
* while it is up Chromium drops every click and key sent to that tab. The panel
|
|
6
|
+
* runs its window offscreen, so the tab looks frozen for no visible reason.
|
|
7
|
+
*
|
|
8
|
+
* Two layers deal with it. The guard below runs in every frame and cancels the
|
|
9
|
+
* navigations it can see (location changes, link clicks, window.open), so no
|
|
10
|
+
* prompt appears. Chromium offers no way to cancel the rest (an iframe whose src
|
|
11
|
+
* is an app link, a server redirect, a form post), so the panel watches for the
|
|
12
|
+
* request instead and tells the user and the agent how to clear the prompt.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Schemes the browser handles itself or opens without asking. mailto/news/snews
|
|
16
|
+
* are on Chromium's own never-prompt list, so they cannot freeze a tab.
|
|
17
|
+
*/
|
|
18
|
+
const HANDLED_SCHEMES = [
|
|
19
|
+
'http', 'https', 'ws', 'wss', 'about', 'blob', 'data', 'javascript', 'file', 'filesystem',
|
|
20
|
+
'chrome', 'chrome-extension', 'chrome-untrusted', 'chrome-error', 'devtools', 'view-source',
|
|
21
|
+
'mailto', 'news', 'snews',
|
|
22
|
+
];
|
|
23
|
+
const HANDLED = new Set(HANDLED_SCHEMES);
|
|
24
|
+
/** The scheme of a URL that would be handed to another application, lower-cased and without the colon. */
|
|
25
|
+
export function externalAppScheme(url) {
|
|
26
|
+
if (typeof url !== 'string')
|
|
27
|
+
return undefined;
|
|
28
|
+
const match = /^\s*([a-z][a-z0-9+.-]*):/i.exec(url);
|
|
29
|
+
if (!match)
|
|
30
|
+
return undefined;
|
|
31
|
+
const scheme = match[1].toLowerCase();
|
|
32
|
+
// A one-letter scheme is a Windows drive path, which Chromium refuses outright.
|
|
33
|
+
return scheme.length < 2 || HANDLED.has(scheme) ? undefined : scheme.slice(0, 64);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Runs in the page, in every frame, before the page's own scripts. It only adds a
|
|
37
|
+
* listener to the Navigation API; nothing on the page is patched or replaced.
|
|
38
|
+
*/
|
|
39
|
+
export const EXTERNAL_APP_GUARD_SCRIPT = `(() => {
|
|
40
|
+
try {
|
|
41
|
+
const nav = globalThis.navigation;
|
|
42
|
+
if (!nav || typeof nav.addEventListener !== 'function') return;
|
|
43
|
+
const handled = new Set(${JSON.stringify(HANDLED_SCHEMES)});
|
|
44
|
+
nav.addEventListener('navigate', event => {
|
|
45
|
+
try {
|
|
46
|
+
const match = /^\\s*([a-z][a-z0-9+.-]*):/i.exec(String(event.destination && event.destination.url));
|
|
47
|
+
if (!match) return;
|
|
48
|
+
const scheme = match[1].toLowerCase();
|
|
49
|
+
if (scheme.length > 1 && !handled.has(scheme) && event.cancelable) event.preventDefault();
|
|
50
|
+
} catch { /* A hostile page must not break the browser. */ }
|
|
51
|
+
});
|
|
52
|
+
} catch { /* The Navigation API is missing; the panel still reports the prompt. */ }
|
|
53
|
+
})()`;
|
|
54
|
+
export async function guardExternalApps(context) {
|
|
55
|
+
await Promise.resolve().then(() => context?.addInitScript?.(EXTERNAL_APP_GUARD_SCRIPT)).catch(() => { });
|
|
56
|
+
}
|
|
57
|
+
/** What the agent is told while a tab may be sitting behind the prompt. */
|
|
58
|
+
export function externalAppPromptNote(prompt) {
|
|
59
|
+
return `This tab asked to open a desktop app (${prompt.scheme}://). The browser may be showing an "Open app?" prompt that screenshots and snapshots cannot see; while it is up the tab ignores clicks and keys, and reloading does not clear it. Do not keep retrying. Ask the user to click "Show the browser window" in the Browser panel and press Cancel on the prompt, or close this tab and open the page in a new one.`;
|
|
60
|
+
}
|
|
@@ -13,6 +13,12 @@ export interface PanelArguments {
|
|
|
13
13
|
deltaY?: number;
|
|
14
14
|
}
|
|
15
15
|
export declare function validatePanelArguments(args: Record<string, unknown>): PanelArguments;
|
|
16
|
+
/**
|
|
17
|
+
* Runs the operation, then says so when the tab may be sitting behind the
|
|
18
|
+
* browser's "Open app?" prompt. A snapshot or screenshot of such a tab looks
|
|
19
|
+
* normal and clicks on it appear to succeed, so without the warning the agent
|
|
20
|
+
* retries the same click with nothing to tell it why the page does not react.
|
|
21
|
+
*/
|
|
16
22
|
export declare function runPanelOperation(views: BrowserViewManager, sessionId: string, args: PanelArguments, signal: AbortSignal): Promise<{
|
|
17
23
|
result: string;
|
|
18
24
|
image?: ToolImage;
|
|
@@ -78,7 +78,43 @@ export function validatePanelArguments(args) {
|
|
|
78
78
|
...(args.deltaY === undefined ? {} : { deltaY: args.deltaY }),
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Runs the operation, then says so when the tab may be sitting behind the
|
|
83
|
+
* browser's "Open app?" prompt. A snapshot or screenshot of such a tab looks
|
|
84
|
+
* normal and clicks on it appear to succeed, so without the warning the agent
|
|
85
|
+
* retries the same click with nothing to tell it why the page does not react.
|
|
86
|
+
*/
|
|
81
87
|
export async function runPanelOperation(views, sessionId, args, signal) {
|
|
88
|
+
const warning = () => {
|
|
89
|
+
try {
|
|
90
|
+
return views.appPromptNote?.(sessionId, args.tabId);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
let answer;
|
|
97
|
+
try {
|
|
98
|
+
answer = await performPanelOperation(views, sessionId, args, signal);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
const note = signal.aborted ? undefined : warning();
|
|
102
|
+
if (note && error instanceof Error)
|
|
103
|
+
throw new Error(`${error.message} ${note}`, { cause: error });
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
const note = warning();
|
|
107
|
+
if (!note)
|
|
108
|
+
return answer;
|
|
109
|
+
try {
|
|
110
|
+
const data = JSON.parse(answer.result);
|
|
111
|
+
if (data && typeof data === 'object' && !Array.isArray(data))
|
|
112
|
+
return { ...answer, result: JSON.stringify({ ...data, warning: note }) };
|
|
113
|
+
}
|
|
114
|
+
catch { /* A result that is not JSON is returned as it is. */ }
|
|
115
|
+
return answer;
|
|
116
|
+
}
|
|
117
|
+
async function performPanelOperation(views, sessionId, args, signal) {
|
|
82
118
|
const { operation, url, tabId, selector } = args;
|
|
83
119
|
if (operation === 'tabs')
|
|
84
120
|
return { result: panelTabsResult(views, sessionId) };
|
|
@@ -253,6 +253,7 @@ export async function runBrowserTask(session, task, control, options = {}) {
|
|
|
253
253
|
status: result.status, ...(result.reason === undefined ? {} : { reason: result.reason }),
|
|
254
254
|
...(result.providerRequestFailed ? { providerRequestFailed: true } : {}),
|
|
255
255
|
...(result.providerOverflow ? { providerOverflow: true } : {}),
|
|
256
|
+
...(result.failureCode === undefined ? {} : { errorCode: result.failureCode }),
|
|
256
257
|
...(result.telemetry !== undefined || probeModels.size > 0 ? { telemetry: finishedTelemetry } : {}),
|
|
257
258
|
toolCalls: result.toolCalls,
|
|
258
259
|
});
|
|
@@ -22,4 +22,9 @@ export declare function startBrowserServer(options?: BrowserServerOptions): Prom
|
|
|
22
22
|
url: string;
|
|
23
23
|
close(): Promise<void>;
|
|
24
24
|
}>;
|
|
25
|
+
export declare function loopbackRequestOrigin(host: string | undefined): string | undefined;
|
|
26
|
+
export declare function browserLaunch(url: string, environment?: NodeJS.ProcessEnv): {
|
|
27
|
+
text: string;
|
|
28
|
+
open: boolean;
|
|
29
|
+
};
|
|
25
30
|
export declare function openBrowserUrl(url: string): void;
|
|
@@ -9,7 +9,7 @@ import { join, resolve } from 'node:path';
|
|
|
9
9
|
import { configDirectory, loadConfig } from './config.js';
|
|
10
10
|
import { SessionWriteFence, SessionStore, sessionName, writeSessionSnapshot, removeSessionSnapshot, savedSessionFields, carryRailOwnedFields, primaryDigest, projectIdentity, validSavedSession } from './sessions.js';
|
|
11
11
|
import { acquireSessionMutationLock, SessionMutationLockHeldError, sessionHasOpenRun } from './run-records.js';
|
|
12
|
-
import { createBrowserBridge, validBrowserSession,
|
|
12
|
+
import { createBrowserBridge, validBrowserSession, browserBearerMatches, browserBody, browserReply, discoverBrowserSessions, assertBrowserSessionUnowned } from './browser-bridge.js';
|
|
13
13
|
import { readSessionTrajectory } from './app-server/workspace.js';
|
|
14
14
|
import { runBrowserTask } from './browser-runner.js';
|
|
15
15
|
import { configuredSurface, reportSessionStarted } from './telemetry/surface.js';
|
|
@@ -659,7 +659,8 @@ export async function startBrowserServer(options = {}) {
|
|
|
659
659
|
const server = createServer(async (req, res) => {
|
|
660
660
|
try {
|
|
661
661
|
const path = new URL(req.url || '/', origin).pathname;
|
|
662
|
-
|
|
662
|
+
const requestOrigin = loopbackRequestOrigin(req.headers.host);
|
|
663
|
+
if (!requestOrigin || req.headers.origin && req.headers.origin !== requestOrigin) {
|
|
663
664
|
browserReply(res, 403, { error: 'Invalid origin' });
|
|
664
665
|
return;
|
|
665
666
|
}
|
|
@@ -674,7 +675,7 @@ export async function startBrowserServer(options = {}) {
|
|
|
674
675
|
res.end(content);
|
|
675
676
|
return;
|
|
676
677
|
}
|
|
677
|
-
if (!
|
|
678
|
+
if (!browserBearerMatches(req, token)) {
|
|
678
679
|
browserReply(res, 401, { error: 'Reopen using /browser.' });
|
|
679
680
|
return;
|
|
680
681
|
}
|
|
@@ -987,6 +988,29 @@ export async function startBrowserServer(options = {}) {
|
|
|
987
988
|
throw failure.reason;
|
|
988
989
|
} };
|
|
989
990
|
}
|
|
991
|
+
// The origin a request addressed, when its Host header names this machine's loopback interface.
|
|
992
|
+
// A forwarded port (ssh -L, an editor's port forwarding) arrives as localhost or under another
|
|
993
|
+
// port, so neither the spelling nor the port is compared with the bound address. Refusing every
|
|
994
|
+
// other name is what stops DNS rebinding: a page on a hostile name that resolves here still sends
|
|
995
|
+
// its own name as Host.
|
|
996
|
+
export function loopbackRequestOrigin(host) {
|
|
997
|
+
if (!host || !/^(?:127\.0\.0\.1|localhost|\[::1\])(?::\d{1,5})?$/i.test(host))
|
|
998
|
+
return undefined;
|
|
999
|
+
return `http://${host.toLowerCase()}`;
|
|
1000
|
+
}
|
|
1001
|
+
// What /browser prints, and whether to launch a browser on this machine. Over SSH a browser
|
|
1002
|
+
// opened here is on the wrong computer, so the text explains how to reach the server instead.
|
|
1003
|
+
export function browserLaunch(url, environment = process.env) {
|
|
1004
|
+
if (!(environment.SSH_CONNECTION || environment.SSH_CLIENT || environment.SSH_TTY))
|
|
1005
|
+
return { text: `Andorra Browser: ${url}`, open: true };
|
|
1006
|
+
const port = new URL(url).port;
|
|
1007
|
+
return { open: false, text: [
|
|
1008
|
+
`Andorra Browser: ${url}`,
|
|
1009
|
+
'This is an SSH session, so no browser was opened on this machine. The server listens only on this machine, so forward its port from your own computer, then open the address above there:',
|
|
1010
|
+
` ssh -N -L ${port}:127.0.0.1:${port} <this host>`,
|
|
1011
|
+
'The same address works with localhost in place of 127.0.0.1, and with a different local port if you forward to one.',
|
|
1012
|
+
].join('\n') };
|
|
1013
|
+
}
|
|
990
1014
|
export function openBrowserUrl(url) {
|
|
991
1015
|
const command = process.platform === 'win32' ? 'rundll32.exe' : process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
992
1016
|
execFile(command, process.platform === 'win32' ? ['url.dll,FileProtocolHandler', url] : [url], { windowsHide: true, timeout: 10000 }, error => { if (error)
|
|
@@ -72,9 +72,9 @@ textarea{resize:none;line-height:var(--leading-sm)}
|
|
|
72
72
|
.mark{width:16px;height:16px;flex:none;display:inline-grid;place-items:center}
|
|
73
73
|
.mark::before{content:'';display:block;box-sizing:border-box;border-radius:var(--radius-full)}
|
|
74
74
|
.mark.running::before{width:12px;height:12px;border:1.5px solid var(--border-strong);border-top-color:var(--text-2);animation:spin var(--loop-spin) linear infinite}
|
|
75
|
-
.mark.waiting::before{width:
|
|
76
|
-
.mark.failed::before{width:
|
|
77
|
-
.mark.stopped::before{
|
|
75
|
+
.mark.waiting::before{width:6px;height:6px;background:var(--status-waiting)}
|
|
76
|
+
.mark.failed::before{width:6px;height:6px;background:var(--err)}
|
|
77
|
+
.mark.stopped::before{content:none}
|
|
78
78
|
.mark.unread::before{width:6px;height:6px;background:var(--text-3)}
|
|
79
79
|
@keyframes spin{to{transform:rotate(360deg)}}
|
|
80
80
|
.empty-projects{padding:var(--space-2) var(--space-3);color:var(--text-3);font-size:var(--type-xs);line-height:var(--leading-xs)}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--rail-width:
|
|
3
|
-
--rail-task-indent:
|
|
4
|
-
--chrome-height:
|
|
2
|
+
--rail-width: 252px;
|
|
3
|
+
--rail-task-indent: 12px;
|
|
4
|
+
--chrome-height: 44px;
|
|
5
5
|
--reading-measure: 792px;
|
|
6
6
|
--settings-measure: 880px;
|
|
7
|
-
--
|
|
7
|
+
--group-radius: 10px;
|
|
8
|
+
--settings-page-measure: 680px;
|
|
9
|
+
--row-height: 30px;
|
|
8
10
|
--row-radius: 6px;
|
|
9
11
|
--control-height: 28px;
|
|
10
12
|
--btn-height: 32px;
|
|
@@ -21,17 +23,17 @@
|
|
|
21
23
|
--type-section: 15px;
|
|
22
24
|
--type-hint: 12px;
|
|
23
25
|
--type-h1: 17px;
|
|
24
|
-
--weight-regular: 400; --weight-strong: 500;
|
|
26
|
+
--weight-regular: 400; --weight-strong: 500; --weight-title: 600;
|
|
25
27
|
--leading-xs: 16px; --leading-sm: 18px; --leading-md: 20px; --leading-prose: 22px; --leading-lg: 24px;
|
|
26
28
|
--leading-code: 18px;
|
|
27
29
|
--tracking-sm: -0.08px; --tracking-title: -0.01em; --tracking-code: .06em;
|
|
28
30
|
--type-prose: 14px; --weight-prose: 400; --weight-prose-strong: 600; --weight-prose-bold: 500;
|
|
29
|
-
--text-prose:
|
|
31
|
+
--text-prose: var(--text);
|
|
30
32
|
--space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
|
|
31
33
|
--input-height: 32px;
|
|
32
34
|
--input-radius: 8px;
|
|
33
35
|
|
|
34
|
-
--bg-rail: #
|
|
36
|
+
--bg-rail: #181818; --bg-app: #141414; --bg-surface: #141414; --bg-input: #212121;
|
|
35
37
|
--text: #f5f5f5; --text-2: rgba(245,245,245,.74); --text-3: rgba(245,245,245,.60); --shimmer-dim: 40%;
|
|
36
38
|
--text-disabled: rgba(245,245,245,.36);
|
|
37
39
|
--border: rgba(245,245,245,.08); --border-strong: rgba(245,245,245,.12);
|
|
@@ -39,16 +41,20 @@
|
|
|
39
41
|
--bg-control: rgba(245,245,245,.08); --bg-control-hover: rgba(245,245,245,.14);
|
|
40
42
|
--bg-raised: rgba(245,245,245,.16);
|
|
41
43
|
--bg-card-solid: color-mix(in srgb, var(--text) 6%, var(--bg-surface));
|
|
42
|
-
--
|
|
43
|
-
--
|
|
44
|
-
--
|
|
44
|
+
--bg-group: color-mix(in srgb, var(--text) 4%, var(--bg-surface));
|
|
45
|
+
--bg-bubble: var(--bg-input);
|
|
46
|
+
--switch-off: color-mix(in srgb, var(--text) 18%, transparent); --switch-on: #3fa266; --switch-knob: #ffffff;
|
|
47
|
+
--hover: color-mix(in srgb, var(--text) 5%, transparent);
|
|
48
|
+
--selected: color-mix(in srgb, var(--text) 8%, transparent);
|
|
49
|
+
--pressed: color-mix(in srgb, var(--text) 10%, transparent);
|
|
45
50
|
--bg-hover: var(--hover);
|
|
46
51
|
--accent: #ececec; --accent-soft: rgba(245,245,245,.16); --on-accent: #141414;
|
|
47
52
|
--accent-hover: #ffffff; --accent-ring: rgba(245,245,245,.36);
|
|
48
|
-
--accent-fill: #1372da; --accent-fill-hover: #2a7fdd; --on-accent-fill: #f5f5f5;
|
|
53
|
+
--accent-fill: #1372da; --accent-fill-hover: #2a7fdd; --accent-fill-pressed: #0f63c2; --on-accent-fill: #f5f5f5;
|
|
49
54
|
--accent-text: #71aeff; --focus: #1f87fc;
|
|
55
|
+
--status-waiting: #518cce;
|
|
50
56
|
--ok: #2f9e6a; --err: #e5484d; --warn: #c9c9c9; --caution: #d9a520; --caution-text: #f2c94c;
|
|
51
|
-
--ok-text: #7cc79a; --err-text: #f47174; --warn-text: #ececec; --merged-text: #bba4f2;
|
|
57
|
+
--ok-text: #7cc79a; --err-text: #f47174; --warn-text: #ececec; --merged-text: #bba4f2;
|
|
52
58
|
--skill: #aab8ff; --skill-wash: rgba(120,140,255,.18);
|
|
53
59
|
--ok-wash: rgba(47,158,106,.14); --err-wash: rgba(229,72,77,.14); --merged-wash: rgba(142,110,224,.14);
|
|
54
60
|
--add-wash: rgba(47,158,106,.16); --del-wash: rgba(229,72,77,.16);
|
|
@@ -78,6 +84,7 @@
|
|
|
78
84
|
--pop-distance: 4px; --pop-scale: .98;
|
|
79
85
|
--loop-spin: 1s; --loop-shimmer: 1.8s; --loop-breathe: 2.4s;
|
|
80
86
|
--delay-hover-intent: 150ms;
|
|
87
|
+
--delay-startup-status: 800ms;
|
|
81
88
|
|
|
82
89
|
color-scheme: dark;
|
|
83
90
|
}
|
|
@@ -85,17 +92,21 @@
|
|
|
85
92
|
:root[data-theme="light"] {
|
|
86
93
|
--bg-rail: #f5f5f5; --bg-app: #ffffff; --bg-surface: #ffffff; --bg-input: #ffffff;
|
|
87
94
|
--text: #1c1c1c; --text-2: rgba(28,28,28,.74); --text-3: rgba(28,28,28,.66); --shimmer-dim: 34%; --text-disabled: rgba(28,28,28,.36);
|
|
88
|
-
--border: rgba(28,28,28,.
|
|
95
|
+
--border: rgba(28,28,28,.10); --border-strong: rgba(28,28,28,.14);
|
|
89
96
|
--bg-card: rgba(28,28,28,.06);
|
|
90
97
|
--bg-control: rgba(28,28,28,.08); --bg-control-hover: rgba(28,28,28,.14);
|
|
91
98
|
--bg-raised: #ffffff;
|
|
92
|
-
--switch-off: color-mix(in srgb, var(--text) 50%, transparent);
|
|
99
|
+
--switch-off: color-mix(in srgb, var(--text) 50%, transparent); --switch-on: #2f9e6a;
|
|
100
|
+
--bg-group: rgba(28,28,28,.035); --bg-bubble: #f5f5f5;
|
|
101
|
+
--hover: color-mix(in srgb, var(--text) 6%, transparent); --selected: color-mix(in srgb, var(--text) 10%, transparent);
|
|
102
|
+
--pressed: color-mix(in srgb, var(--text) 13%, transparent);
|
|
93
103
|
--accent: #1c1c1c; --accent-soft: rgba(28,28,28,.16); --on-accent: #ffffff;
|
|
94
104
|
--accent-hover: #333333; --accent-ring: rgba(28,28,28,.48);
|
|
95
|
-
--accent-fill: #1680f3; --accent-fill-hover: #1776dd; --on-accent-fill: #ffffff;
|
|
105
|
+
--accent-fill: #1680f3; --accent-fill-hover: #1776dd; --accent-fill-pressed: #1468c8; --on-accent-fill: #ffffff;
|
|
96
106
|
--accent-text: #0b6dd3; --focus: #1680f3;
|
|
107
|
+
--status-waiting: #2f6fbd;
|
|
97
108
|
--ok: #3d7a5c; --err: #d13438; --warn: #45464b; --caution: #b8860b; --caution-text: #8a6100;
|
|
98
|
-
--ok-text: #36704f; --err-text: #c4262e; --warn-text: #1c1c1c; --merged-text: #6a4fc4;
|
|
109
|
+
--ok-text: #36704f; --err-text: #c4262e; --warn-text: #1c1c1c; --merged-text: #6a4fc4;
|
|
99
110
|
--skill: #3b4fc4; --skill-wash: rgba(59,79,196,.10);
|
|
100
111
|
--ok-wash: rgba(61,122,92,.08); --err-wash: rgba(209,52,56,.08); --merged-wash: rgba(106,79,196,.08);
|
|
101
112
|
--add-wash: rgba(61,122,92,.14); --del-wash: rgba(209,52,56,.13);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ExternalAppPrompt } from './browser-external-app.js';
|
|
1
2
|
import type { ImportedCookie } from './firefox-cookies.js';
|
|
2
3
|
import type { ExtensionStatus } from './browser-extensions.js';
|
|
3
4
|
export type BrowserViewChannel = 'chromium' | 'msedge' | 'chrome';
|
|
@@ -12,6 +13,7 @@ export interface BrowserViewTab {
|
|
|
12
13
|
url: string;
|
|
13
14
|
title: string;
|
|
14
15
|
loading: boolean;
|
|
16
|
+
appPrompt?: ExternalAppPrompt;
|
|
15
17
|
}
|
|
16
18
|
export declare const VIEW_TAB_LIMIT = 6;
|
|
17
19
|
export declare const VIEW_SESSION_LIMIT = 4;
|
|
@@ -161,6 +163,20 @@ export declare class BrowserViewManager {
|
|
|
161
163
|
private browserCdpFor;
|
|
162
164
|
showWindow(sessionId: string): Promise<void>;
|
|
163
165
|
hideWindow(sessionId: string): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Whether the native window holding this tab is on the user's screen right now.
|
|
168
|
+
* Sessions of one project share a window, so one session can hide what another
|
|
169
|
+
* showed; the window's own bounds are the only record that stays true.
|
|
170
|
+
*/
|
|
171
|
+
private windowOnScreen;
|
|
172
|
+
/**
|
|
173
|
+
* An app link got past the in-page guard. With the window on screen the user can
|
|
174
|
+
* see the browser's prompt; otherwise the tab is flagged so the panel and the
|
|
175
|
+
* agent are told why it stopped responding.
|
|
176
|
+
*/
|
|
177
|
+
private flagAppPrompt;
|
|
178
|
+
/** What to tell the agent when a tab may be stuck behind the browser's "Open app?" prompt. */
|
|
179
|
+
appPromptNote(sessionId: string, tabId?: string): string | undefined;
|
|
164
180
|
private moveWindow;
|
|
165
181
|
restartForExtensions(force?: boolean): Promise<{
|
|
166
182
|
restarted: number;
|
package/dist/src/browser-view.js
CHANGED
|
@@ -5,6 +5,7 @@ import { mkdir } from 'node:fs/promises';
|
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { observePage, observationResult } from './browser-observation.js';
|
|
8
|
+
import { externalAppPromptNote, externalAppScheme, guardExternalApps } from './browser-external-app.js';
|
|
8
9
|
import { desktopUaOverride, hardenContext, stealthLaunchArgs, STEALTH_LOCALE, userAgentMetadata } from './browser-stealth.js';
|
|
9
10
|
export const VIEW_TAB_LIMIT = 6;
|
|
10
11
|
export const VIEW_SESSION_LIMIT = 4;
|
|
@@ -432,6 +433,7 @@ export class BrowserViewManager {
|
|
|
432
433
|
// the context. Only the locale stays as a stealth option.
|
|
433
434
|
const context = await chromium.launchPersistentContext(directory, { ...headedViewLaunchOptions(channel, candidate, scale, paths), locale: STEALTH_LOCALE, viewport: { ...viewport }, acceptDownloads: false });
|
|
434
435
|
await hardenContext(context);
|
|
436
|
+
await guardExternalApps(context);
|
|
435
437
|
return context;
|
|
436
438
|
};
|
|
437
439
|
try {
|
|
@@ -578,10 +580,56 @@ export class BrowserViewManager {
|
|
|
578
580
|
}
|
|
579
581
|
async showWindow(sessionId) {
|
|
580
582
|
await this.moveWindow(sessionId, VIEW_ONSCREEN_POSITION, true);
|
|
583
|
+
// The user can now see and answer the prompt on the tab this brought to the front, so that tab's
|
|
584
|
+
// notice has done its job. Other tabs keep theirs: their prompts are still behind this one, or in
|
|
585
|
+
// a popup's own window that was not moved.
|
|
586
|
+
const session = this.sessions.get(sessionId);
|
|
587
|
+
const active = session?.activeTabId ? session.tabs.get(session.activeTabId) : undefined;
|
|
588
|
+
if (!session || !active?.appPrompt)
|
|
589
|
+
return;
|
|
590
|
+
active.appPrompt = undefined;
|
|
591
|
+
this.publishTabs(sessionId, session);
|
|
581
592
|
}
|
|
582
593
|
async hideWindow(sessionId) {
|
|
583
594
|
await this.moveWindow(sessionId, VIEW_OFFSCREEN_POSITION, false);
|
|
584
595
|
}
|
|
596
|
+
/**
|
|
597
|
+
* Whether the native window holding this tab is on the user's screen right now.
|
|
598
|
+
* Sessions of one project share a window, so one session can hide what another
|
|
599
|
+
* showed; the window's own bounds are the only record that stays true.
|
|
600
|
+
*/
|
|
601
|
+
async windowOnScreen(session, tab) {
|
|
602
|
+
try {
|
|
603
|
+
const cdp = await this.browserCdpFor(session);
|
|
604
|
+
const found = await cdp.send('Browser.getWindowForTarget', tab.targetId !== undefined ? { targetId: tab.targetId } : {});
|
|
605
|
+
const bounds = found?.bounds;
|
|
606
|
+
return typeof bounds?.left === 'number' && typeof bounds.top === 'number' && bounds.windowState !== 'minimized'
|
|
607
|
+
&& bounds.left > VIEW_OFFSCREEN_POSITION.left / 2 && bounds.top > VIEW_OFFSCREEN_POSITION.top / 2;
|
|
608
|
+
}
|
|
609
|
+
catch {
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* An app link got past the in-page guard. With the window on screen the user can
|
|
615
|
+
* see the browser's prompt; otherwise the tab is flagged so the panel and the
|
|
616
|
+
* agent are told why it stopped responding.
|
|
617
|
+
*/
|
|
618
|
+
async flagAppPrompt(sessionId, session, tab, scheme) {
|
|
619
|
+
const at = Date.now();
|
|
620
|
+
if (await this.windowOnScreen(session, tab))
|
|
621
|
+
return;
|
|
622
|
+
if (session.closing || session.tabs.get(tab.id) !== tab)
|
|
623
|
+
return;
|
|
624
|
+
tab.appPrompt = { scheme, at };
|
|
625
|
+
this.publishTabs(sessionId, session);
|
|
626
|
+
}
|
|
627
|
+
/** What to tell the agent when a tab may be stuck behind the browser's "Open app?" prompt. */
|
|
628
|
+
appPromptNote(sessionId, tabId) {
|
|
629
|
+
const session = this.sessions.get(sessionId);
|
|
630
|
+
const tab = session ? session.tabs.get(tabId ?? session.activeTabId ?? '') : undefined;
|
|
631
|
+
return tab?.appPrompt ? externalAppPromptNote(tab.appPrompt) : undefined;
|
|
632
|
+
}
|
|
585
633
|
async moveWindow(sessionId, position, activate) {
|
|
586
634
|
const session = this.sessions.get(sessionId);
|
|
587
635
|
if (!session || session.closing)
|
|
@@ -913,7 +961,7 @@ export class BrowserViewManager {
|
|
|
913
961
|
summary(session) {
|
|
914
962
|
return {
|
|
915
963
|
profile: session.profile,
|
|
916
|
-
tabs: [...session.tabs.values()].map(tab => ({ id: tab.id, url: tab.url, title: tab.title, loading: tab.loading })),
|
|
964
|
+
tabs: [...session.tabs.values()].map(tab => ({ id: tab.id, url: tab.url, title: tab.title, loading: tab.loading, ...(tab.appPrompt ? { appPrompt: { ...tab.appPrompt } } : {}) })),
|
|
917
965
|
...(session.activeTabId ? { activeTabId: session.activeTabId } : {}),
|
|
918
966
|
};
|
|
919
967
|
}
|
|
@@ -1103,6 +1151,16 @@ export class BrowserViewManager {
|
|
|
1103
1151
|
documentRequest = request;
|
|
1104
1152
|
}
|
|
1105
1153
|
catch { }
|
|
1154
|
+
// An app link the in-page guard could not cancel (an iframe src, a redirect, a
|
|
1155
|
+
// form post) still shows up here, in any frame. Chromium is now raising its
|
|
1156
|
+
// "Open app?" prompt, which nothing in this process can see or dismiss.
|
|
1157
|
+
let scheme;
|
|
1158
|
+
try {
|
|
1159
|
+
scheme = externalAppScheme(request?.url?.());
|
|
1160
|
+
}
|
|
1161
|
+
catch { }
|
|
1162
|
+
if (scheme)
|
|
1163
|
+
void this.flagAppPrompt(sessionId, session, tab, scheme);
|
|
1106
1164
|
});
|
|
1107
1165
|
page.on('requestfailed', (request) => { if (request === documentRequest)
|
|
1108
1166
|
documentRequest = undefined; });
|
|
@@ -1298,7 +1356,7 @@ export class BrowserViewManager {
|
|
|
1298
1356
|
session.contextTask ??= Promise.resolve()
|
|
1299
1357
|
// Headed: the browser's own identity goes through, only the locale stays as a stealth option.
|
|
1300
1358
|
.then(() => session.browser.newContext({ viewport: { ...session.viewport }, acceptDownloads: false, locale: STEALTH_LOCALE }))
|
|
1301
|
-
.then(async (context) => { await hardenContext(context); session.context = context; return context; });
|
|
1359
|
+
.then(async (context) => { await hardenContext(context); await guardExternalApps(context); session.context = context; return context; });
|
|
1302
1360
|
return await session.contextTask;
|
|
1303
1361
|
}
|
|
1304
1362
|
async openTab(sessionId, url, signal) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Tool } from './types.js';
|
|
2
|
+
/** The built-in skill that interviews the user; a run that carries it also gets the tool below. */
|
|
3
|
+
export declare const BUG_REPORT_SKILL = "andorra:bug-report";
|
|
4
|
+
export declare const BUG_REPORT_TOOL = "submit_bug_report";
|
|
5
|
+
export declare const SEND_CHOICE = "Send report";
|
|
6
|
+
export declare const CANCEL_CHOICE = "Do not send";
|
|
7
|
+
/** The report's text fields with the byte limits the service enforces (infra/andorra-auth/bug_report.py). */
|
|
8
|
+
declare const FIELDS: readonly [{
|
|
9
|
+
readonly name: "title";
|
|
10
|
+
readonly required: true;
|
|
11
|
+
readonly limit: 120;
|
|
12
|
+
readonly heading: "Title";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "description";
|
|
15
|
+
readonly required: true;
|
|
16
|
+
readonly limit: 4000;
|
|
17
|
+
readonly heading: "What happened";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "steps";
|
|
20
|
+
readonly required: false;
|
|
21
|
+
readonly limit: 2000;
|
|
22
|
+
readonly heading: "Steps to reproduce";
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "expected";
|
|
25
|
+
readonly required: false;
|
|
26
|
+
readonly limit: 1000;
|
|
27
|
+
readonly heading: "Expected";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "actual";
|
|
30
|
+
readonly required: false;
|
|
31
|
+
readonly limit: 2000;
|
|
32
|
+
readonly heading: "Actual";
|
|
33
|
+
}];
|
|
34
|
+
type FieldName = typeof FIELDS[number]['name'];
|
|
35
|
+
export type BugReport = {
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
} & Partial<Record<Exclude<FieldName, 'title' | 'description'>, string>>;
|
|
39
|
+
export interface BugReportEnvironment {
|
|
40
|
+
appVersion?: string;
|
|
41
|
+
surface?: 'cli' | 'desktop';
|
|
42
|
+
os: 'windows' | 'macos' | 'linux' | 'other';
|
|
43
|
+
arch: 'x64' | 'arm64' | 'other';
|
|
44
|
+
}
|
|
45
|
+
export type BugReportFailure = 'signed_out' | 'refused' | 'invalid' | 'limit' | 'unavailable';
|
|
46
|
+
export declare class BugReportError extends Error {
|
|
47
|
+
readonly code: BugReportFailure;
|
|
48
|
+
constructor(code: BugReportFailure, message: string);
|
|
49
|
+
}
|
|
50
|
+
/** The report as it will be sent: trimmed, bounded, and with anything credential-shaped replaced. */
|
|
51
|
+
export declare function normalizeBugReport(args: Record<string, unknown>): BugReport;
|
|
52
|
+
/** Exactly what the user is asked to approve: every field that will be sent, and what is attached. */
|
|
53
|
+
export declare function bugReportPreview(report: BugReport, environment: BugReportEnvironment): string;
|
|
54
|
+
export declare function bugReportEnvironment(env?: NodeJS.ProcessEnv, version?: () => Promise<string | undefined>): Promise<BugReportEnvironment>;
|
|
55
|
+
export interface BugReportDependencies {
|
|
56
|
+
accessToken(signal?: AbortSignal): Promise<string>;
|
|
57
|
+
apiBaseUrl(): string;
|
|
58
|
+
fetch: typeof globalThis.fetch;
|
|
59
|
+
}
|
|
60
|
+
export interface BugReportClient {
|
|
61
|
+
/** Throws `signed_out` unless an Andorra account is signed in on this installation. */
|
|
62
|
+
token(signal?: AbortSignal): Promise<string>;
|
|
63
|
+
submit(report: BugReport, environment: BugReportEnvironment, token: string, signal?: AbortSignal): Promise<{
|
|
64
|
+
reference: string;
|
|
65
|
+
}>;
|
|
66
|
+
}
|
|
67
|
+
export declare function createBugReportClient(deps: BugReportDependencies): BugReportClient;
|
|
68
|
+
/** The shipped client. Sign-in code is loaded on first use, so a run that never reports does not pay for it. */
|
|
69
|
+
export declare const bugReports: BugReportClient;
|
|
70
|
+
export interface BugReportToolOptions {
|
|
71
|
+
client?: BugReportClient;
|
|
72
|
+
environment?: () => Promise<BugReportEnvironment>;
|
|
73
|
+
/** Tells the surface a question is open, the way ask_user does, so the tool clock pauses while it waits. */
|
|
74
|
+
emit?: (type: string, data: Record<string, unknown>) => void | Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Files a bug report with the Andorra team. The report leaves the machine only after the user has read
|
|
78
|
+
* exactly what will be sent and chosen to send it, so the tool refuses on a surface where nobody can answer.
|
|
79
|
+
*/
|
|
80
|
+
export declare function bugReportTool(options?: BugReportToolOptions): Tool;
|
|
81
|
+
export {};
|