@andorra-labs/code 0.1.9 → 0.1.11
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/README.md +28 -208
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/dist/src/agent-execution.js +56 -0
- package/dist/src/app-server/protocol.d.ts +109 -1
- package/dist/src/app-server/protocol.js +8 -1
- package/dist/src/app-server.d.ts +59 -1
- package/dist/src/app-server.js +418 -63
- package/dist/src/auth/index.d.ts +1 -1
- package/dist/src/auth/index.js +1 -1
- package/dist/src/auth/store.d.ts +17 -1
- package/dist/src/auth/store.js +25 -2
- package/dist/src/automation-service.js +1 -1
- package/dist/src/browser-session.d.ts +8 -0
- package/dist/src/browser-session.js +27 -1
- package/dist/src/browser-ui/app.js +255 -33
- package/dist/src/browser-ui/index.html +9 -9
- package/dist/src/browser-ui/style.css +110 -65
- package/dist/src/browser-ui/tokens.css +27 -26
- package/dist/src/cli.js +10 -5
- package/dist/src/coding-tools.d.ts +24 -0
- package/dist/src/coding-tools.js +71 -8
- package/dist/src/command-screens.js +1 -1
- package/dist/src/commands.d.ts +1 -1
- package/dist/src/commands.js +2 -2
- package/dist/src/completion-gates.d.ts +42 -7
- package/dist/src/completion-gates.js +55 -9
- package/dist/src/completion.d.ts +9 -1
- package/dist/src/completion.js +20 -2
- package/dist/src/dashboard-view.js +2 -2
- package/dist/src/deadline.js +4 -0
- package/dist/src/decision/checks.js +1 -1
- package/dist/src/file-diff.d.ts +105 -0
- package/dist/src/file-diff.js +244 -0
- package/dist/src/graph-manager-chat.js +4 -4
- package/dist/src/graph-runner.js +39 -2
- package/dist/src/graph-sync.d.ts +8 -0
- package/dist/src/graph-sync.js +54 -3
- package/dist/src/graph-tool.js +1 -1
- package/dist/src/graph-ui/app.js +303 -129
- package/dist/src/graph-ui/controls.css +43 -22
- package/dist/src/graph-ui/controls.js +31 -1
- package/dist/src/graph-ui/embed.js +56 -7
- package/dist/src/graph-ui/icons.js +5 -0
- package/dist/src/graph-ui/index.html +3 -3
- package/dist/src/graph-ui/manager-state.js +2 -2
- package/dist/src/graph-ui/manager.css +19 -18
- package/dist/src/graph-ui/manager.js +5 -5
- package/dist/src/graph-ui/skill-picker.js +5 -5
- package/dist/src/graph-ui/studio-canvas.js +16 -16
- package/dist/src/graph-ui/studio.css +18 -15
- package/dist/src/graph-ui/studio.js +99 -42
- package/dist/src/graph-ui/style.css +125 -80
- package/dist/src/graph-ui/theme.js +2 -2
- package/dist/src/graph-ui/tokens.css +33 -29
- package/dist/src/graphs.d.ts +10 -3
- package/dist/src/graphs.js +15 -4
- package/dist/src/mcp.d.ts +75 -0
- package/dist/src/mcp.js +240 -8
- package/dist/src/membership-errors.d.ts +7 -1
- package/dist/src/membership-errors.js +9 -3
- package/dist/src/provider-keys.d.ts +5 -1
- package/dist/src/provider-keys.js +7 -3
- package/dist/src/provider-settings.d.ts +4 -1
- package/dist/src/provider-settings.js +46 -5
- package/dist/src/pull-requests.d.ts +42 -6
- package/dist/src/pull-requests.js +11 -3
- package/dist/src/qa/guidance.js +6 -19
- package/dist/src/qa/index.d.ts +0 -2
- package/dist/src/qa/index.js +0 -2
- package/dist/src/qa/profile/QaProfile.d.ts +5 -1
- package/dist/src/qa/profile/QaProfile.js +6 -2
- package/dist/src/qa/tools.d.ts +19 -1
- package/dist/src/qa/tools.js +20 -145
- package/dist/src/react-runtime.js +134 -16
- package/dist/src/read-document-doc.d.ts +20 -0
- package/dist/src/read-document-doc.js +524 -0
- package/dist/src/read-document-docx.d.ts +21 -0
- package/dist/src/read-document-docx.js +584 -0
- package/dist/src/read-document-text.d.ts +29 -0
- package/dist/src/read-document-text.js +67 -0
- package/dist/src/read-document-tool.d.ts +48 -0
- package/dist/src/read-document-tool.js +162 -0
- package/dist/src/read-document.d.ts +78 -0
- package/dist/src/read-document.js +353 -0
- package/dist/src/read-image.d.ts +29 -2
- package/dist/src/read-image.js +42 -17
- package/dist/src/remote/engine-pool.js +18 -6
- package/dist/src/runtime.d.ts +19 -0
- package/dist/src/runtime.js +10 -1
- package/dist/src/screen-selection.d.ts +38 -0
- package/dist/src/screen-selection.js +103 -0
- package/dist/src/session-changes.d.ts +122 -0
- package/dist/src/session-changes.js +804 -0
- package/dist/src/side-panel.d.ts +6 -1
- package/dist/src/side-panel.js +12 -10
- package/dist/src/skills/bundled/create-skill/SKILL.md +1 -1
- package/dist/src/skills/bundled/diagram/SKILL.md +1 -1
- package/dist/src/skills/bundled/graph-manager/SKILL.md +37 -3
- package/dist/src/skills/bundled/graph-manager/patterns.md +27 -0
- package/dist/src/skills/bundled/provenance.json +4 -4
- package/dist/src/skills/runtime-skills.js +3 -3
- package/dist/src/stall-recovery.d.ts +15 -0
- package/dist/src/stall-recovery.js +17 -0
- package/dist/src/telemetry/schema.d.ts +1 -1
- package/dist/src/telemetry/schema.js +1 -2
- package/dist/src/terminal-ui.d.ts +64 -20
- package/dist/src/terminal-ui.js +312 -82
- package/dist/src/time-limit.d.ts +53 -0
- package/dist/src/time-limit.js +79 -0
- package/dist/src/tool-diff-stats.d.ts +9 -0
- package/dist/src/tool-diff-stats.js +20 -0
- package/dist/src/tool-names.d.ts +1 -1
- package/dist/src/tool-result-filter.js +1 -1
- package/dist/src/tools.js +118 -9
- package/dist/src/transcript.d.ts +11 -0
- package/dist/src/transcript.js +15 -3
- package/dist/src/types.d.ts +12 -0
- package/dist/src/usage-analytics.d.ts +3 -1
- package/dist/src/usage-analytics.js +16 -2
- package/package.json +6 -26
- package/dist/src/qa/api/http-runner.d.ts +0 -3
- package/dist/src/qa/api/http-runner.js +0 -47
- package/dist/src/qa/git/ChangeDetector.d.ts +0 -26
- package/dist/src/qa/git/ChangeDetector.js +0 -177
- package/dist/src/qa/git/DiffReviewer.d.ts +0 -28
- package/dist/src/qa/git/DiffReviewer.js +0 -115
- package/dist/src/qa/orchestrator/ChangeClassifier.d.ts +0 -14
- package/dist/src/qa/orchestrator/ChangeClassifier.js +0 -28
- package/dist/src/qa/orchestrator/MergeGate.d.ts +0 -14
- package/dist/src/qa/orchestrator/MergeGate.js +0 -40
- package/dist/src/qa/orchestrator/QaOrchestrator.d.ts +0 -79
- package/dist/src/qa/orchestrator/QaOrchestrator.js +0 -373
- package/dist/src/qa/runners/CommandRunner.d.ts +0 -22
- package/dist/src/qa/runners/CommandRunner.js +0 -96
- package/dist/src/qa/runners/TestRunner.d.ts +0 -21
- package/dist/src/qa/runners/TestRunner.js +0 -66
- package/dist/src/qa/runtime/RuntimeSmoke.d.ts +0 -11
- package/dist/src/qa/runtime/RuntimeSmoke.js +0 -78
- package/dist/src/qa/runtime-detect.d.ts +0 -10
- package/dist/src/qa/runtime-detect.js +0 -72
- package/dist/src/qa/security/DependencyScanner.d.ts +0 -19
- package/dist/src/qa/security/DependencyScanner.js +0 -167
- package/dist/src/qa/security/SecretScanner.d.ts +0 -3
- package/dist/src/qa/security/SecretScanner.js +0 -55
- package/docs/README.md +0 -36
- package/docs/agents/README.md +0 -62
- package/docs/agents/install-for-agents.md +0 -56
- package/docs/agents/mcp-server.md +0 -212
- package/docs/agents/subagent-mode.md +0 -149
- package/docs/concepts/README.md +0 -47
- package/docs/concepts/jev-actionable-routing.md +0 -113
- package/docs/concepts/jev-decision-thresholds.md +0 -412
- package/docs/concepts/jev-efficiency.md +0 -217
- package/docs/concepts/jev-eval-2026-11-01.md +0 -78
- package/docs/concepts/limits.md +0 -52
- package/docs/concepts/memory.md +0 -10
- package/docs/concepts/security.md +0 -50
- package/docs/concepts/workspace-instructions.md +0 -29
- package/docs/getting-started/README.md +0 -82
- package/docs/getting-started/accounts.md +0 -78
- package/docs/getting-started/configure-providers.md +0 -132
- package/docs/guides/README.md +0 -13
- package/docs/guides/browser.md +0 -39
- package/docs/guides/desktop-app.md +0 -414
- package/docs/guides/extensions.md +0 -102
- package/docs/guides/graph-builder.md +0 -116
- package/docs/guides/headless.md +0 -46
- package/docs/guides/tui.md +0 -75
- package/docs/guides/update.md +0 -70
- package/docs/guides/web-search.md +0 -51
- package/docs/guides/windows-code-signing.md +0 -319
- package/docs/llms.txt +0 -45
- package/docs/reference/README.md +0 -7
- package/docs/reference/cli.md +0 -76
- package/docs/reference/config.md +0 -91
- package/docs/reference/slash-commands.md +0 -59
- package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +0 -111
- package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +0 -910
- package/docs/superpowers/plans/2026-11-02-workflow-pane.md +0 -398
- package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +0 -125
- package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +0 -295
- package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +0 -203
- package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +0 -79
- package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +0 -50
- package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +0 -176
- package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +0 -164
- package/docs/superpowers/specs/2026-11-01-pr-section-design.md +0 -111
- package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +0 -130
- package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +0 -206
- package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +0 -291
- package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +0 -182
- package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +0 -156
- package/scripts/jev-efficiency-eval.mjs +0 -187
- package/scripts/jev-efficiency-live.mjs +0 -193
- package/scripts/zcode-engine-replay.mjs +0 -223
- package/tests/agent-centric-mcp-test-plan.md +0 -208
- package/tests/analytics-settings-test-plan.md +0 -165
- package/tests/browser-cli-smoke.mjs +0 -276
- package/tests/browser-test-plan.md +0 -280
- package/tests/chat-side-panel-test-plan.md +0 -309
- package/tests/decision-engine-test-plan.md +0 -163
- package/tests/default-active-jev-test-plan.md +0 -85
- package/tests/harness-extensions-test-plan.md +0 -113
- package/tests/jev-all-decisions-test-plan.md +0 -156
- package/tests/jev-efficiency/criteria.json +0 -158
- package/tests/jev-efficiency/workloads.mjs +0 -242
- package/tests/jev-efficiency-test-plan.md +0 -198
- package/tests/permissions-sandbox-probe.mjs +0 -74
- package/tests/permissions-test-plan.md +0 -191
- package/tests/product-telemetry-test-plan.md +0 -536
- package/tests/thinking-stream-preview-test-plan.md +0 -136
- package/tests/zcode-react-engine-test-plan.md +0 -396
package/dist/src/auth/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { AuthConfiguration, AuthError } from './types.js';
|
|
|
3
3
|
export * from './types.js';
|
|
4
4
|
export { AuthManager, AUTH_REFRESH_BUDGET_MS } from './AuthManager.js';
|
|
5
5
|
export { credentialIdentity } from './AuthManager.js';
|
|
6
|
-
export { KeyringCredentialStore, KeyringAbsentError, FileCredentialStore, FallbackCredentialStore, createCredentialStore } from './store.js';
|
|
6
|
+
export { KeyringCredentialStore, KeyringAbsentError, KeyringUnreachableError, FileCredentialStore, FallbackCredentialStore, createCredentialStore } from './store.js';
|
|
7
7
|
export declare function getAuthConfiguration(): AuthConfiguration;
|
|
8
8
|
/**
|
|
9
9
|
* Report an automatic sign-out: the account service rejected the stored refresh token, so the
|
package/dist/src/auth/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { AuthManager } from './AuthManager.js';
|
|
|
3
3
|
export * from './types.js';
|
|
4
4
|
export { AuthManager, AUTH_REFRESH_BUDGET_MS } from './AuthManager.js';
|
|
5
5
|
export { credentialIdentity } from './AuthManager.js';
|
|
6
|
-
export { KeyringCredentialStore, KeyringAbsentError, FileCredentialStore, FallbackCredentialStore, createCredentialStore } from './store.js';
|
|
6
|
+
export { KeyringCredentialStore, KeyringAbsentError, KeyringUnreachableError, FileCredentialStore, FallbackCredentialStore, createCredentialStore } from './store.js';
|
|
7
7
|
export function getAuthConfiguration() { return { ...AUTH_DEPLOYMENT }; }
|
|
8
8
|
let manager;
|
|
9
9
|
let signOutReporter;
|
package/dist/src/auth/store.d.ts
CHANGED
|
@@ -18,6 +18,21 @@ export declare class KeyringAbsentError extends AuthError {
|
|
|
18
18
|
cause?: unknown;
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* A keyring that exists but is locked, and that this session has no way to unlock: a desktop Linux
|
|
23
|
+
* machine reached over SSH, whose login keyring nobody unlocked at the console. Its unlock prompt
|
|
24
|
+
* needs a display, so every read fails the same way until someone unlocks it at the machine.
|
|
25
|
+
*
|
|
26
|
+
* It holds nothing this process can reach, so it is handled like a machine without a store: reads
|
|
27
|
+
* and sign-ins fall back to the owner-only file, and a sign-out does not fail on tokens it cannot
|
|
28
|
+
* touch. A session with a display keeps reporting a locked keyring, because there the user can
|
|
29
|
+
* unlock it and a dismissed prompt is a choice.
|
|
30
|
+
*/
|
|
31
|
+
export declare class KeyringUnreachableError extends KeyringAbsentError {
|
|
32
|
+
constructor(options?: {
|
|
33
|
+
cause?: unknown;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
21
36
|
/** The OS credential store service that Andorra sign-ins are saved under, one scope per identity. */
|
|
22
37
|
export declare const SIGN_IN_SERVICE = "Andorra Code";
|
|
23
38
|
/** Lazy native loading keeps offline BYOK usable on machines without a credential service. */
|
|
@@ -142,7 +157,8 @@ export declare class FallbackCredentialStore implements CredentialStore {
|
|
|
142
157
|
* Unlike reads and writes, a keyring clear never falls back just because it failed: a keyring
|
|
143
158
|
* that committed its tombstone and then could not delete an old token chunk still holds that
|
|
144
159
|
* token, and switching to the file would report a sign-out that left it behind. Only a keyring
|
|
145
|
-
* that cannot even be read holds nothing to clear
|
|
160
|
+
* that cannot even be read holds nothing to clear: a machine without one, or a locked one this
|
|
161
|
+
* session has no display to unlock (its tokens stay for the console to clear).
|
|
146
162
|
*
|
|
147
163
|
* The other store is cleared too. A reachable keyring is cleared whether or not a session reads
|
|
148
164
|
* back from it, because an interrupted keyring write leaves token chunks without the manifest
|
package/dist/src/auth/store.js
CHANGED
|
@@ -21,6 +21,25 @@ export class KeyringAbsentError extends AuthError {
|
|
|
21
21
|
* A locked collection, a dismissed unlock prompt or any other failure is a store that exists.
|
|
22
22
|
*/
|
|
23
23
|
const ABSENT_KEYRING = /not provided by any \.service files|org\.freedesktop\.DBus\.Error\.ServiceUnknown|dbus-daemon autolaunch|set your DBUS_SESSION_BUS_ADDRESS|Failed to connect to socket/i;
|
|
24
|
+
/**
|
|
25
|
+
* A keyring that exists but is locked, and that this session has no way to unlock: a desktop Linux
|
|
26
|
+
* machine reached over SSH, whose login keyring nobody unlocked at the console. Its unlock prompt
|
|
27
|
+
* needs a display, so every read fails the same way until someone unlocks it at the machine.
|
|
28
|
+
*
|
|
29
|
+
* It holds nothing this process can reach, so it is handled like a machine without a store: reads
|
|
30
|
+
* and sign-ins fall back to the owner-only file, and a sign-out does not fail on tokens it cannot
|
|
31
|
+
* touch. A session with a display keeps reporting a locked keyring, because there the user can
|
|
32
|
+
* unlock it and a dismissed prompt is a choice.
|
|
33
|
+
*/
|
|
34
|
+
export class KeyringUnreachableError extends KeyringAbsentError {
|
|
35
|
+
constructor(options) { super('The OS credential store is locked, and this session has no display to unlock it on.', options); this.name = 'KeyringUnreachableError'; }
|
|
36
|
+
}
|
|
37
|
+
/** The errors a locked Secret Service collection gives through @napi-rs/keyring, or its dismissed unlock prompt. */
|
|
38
|
+
const LOCKED_KEYRING = /collection is locked|org\.freedesktop\.Secret\.Error\.IsLocked|prompt (?:was )?dismissed/i;
|
|
39
|
+
/** Whether this session can show the Secret Service unlock prompt: only a graphical session can. */
|
|
40
|
+
function canPromptToUnlock(environment = process.env) {
|
|
41
|
+
return Boolean(environment.DISPLAY || environment.WAYLAND_DISPLAY);
|
|
42
|
+
}
|
|
24
43
|
function errorText(error) {
|
|
25
44
|
const parts = [];
|
|
26
45
|
for (let current = error, depth = 0; current && depth < 6; depth++) {
|
|
@@ -33,8 +52,11 @@ function errorText(error) {
|
|
|
33
52
|
function keyringFailure(error, message) {
|
|
34
53
|
if (error instanceof KeyringAbsentError)
|
|
35
54
|
return error;
|
|
36
|
-
|
|
55
|
+
const text = errorText(error);
|
|
56
|
+
if (ABSENT_KEYRING.test(text))
|
|
37
57
|
return new KeyringAbsentError(undefined, { cause: error });
|
|
58
|
+
if (LOCKED_KEYRING.test(text) && !canPromptToUnlock())
|
|
59
|
+
return new KeyringUnreachableError({ cause: error });
|
|
38
60
|
return new AuthError('storage', message, { cause: error });
|
|
39
61
|
}
|
|
40
62
|
const LOCKED_HINT = 'Unlock it and retry, or set ANDORRA_CREDENTIAL_STORE=file to keep the session in an owner-only file instead.';
|
|
@@ -374,7 +396,8 @@ export class FallbackCredentialStore {
|
|
|
374
396
|
* Unlike reads and writes, a keyring clear never falls back just because it failed: a keyring
|
|
375
397
|
* that committed its tombstone and then could not delete an old token chunk still holds that
|
|
376
398
|
* token, and switching to the file would report a sign-out that left it behind. Only a keyring
|
|
377
|
-
* that cannot even be read holds nothing to clear
|
|
399
|
+
* that cannot even be read holds nothing to clear: a machine without one, or a locked one this
|
|
400
|
+
* session has no display to unlock (its tokens stay for the console to clear).
|
|
378
401
|
*
|
|
379
402
|
* The other store is cleared too. A reachable keyring is cleared whether or not a session reads
|
|
380
403
|
* back from it, because an interrupted keyring write leaves token chunks without the manifest
|
|
@@ -57,7 +57,7 @@ async function status(directory) {
|
|
|
57
57
|
const live = await contact(directory, 'status');
|
|
58
58
|
const registered = await installed(directory);
|
|
59
59
|
return { running: !!live, installed: registered, installSupported: process.platform === 'win32', ...(live ? { pid: live.pid } : {}),
|
|
60
|
-
detail: live ? 'Background scheduler is running. The computer must stay awake and signed in.' : registered ? 'Start at sign-in is installed; the background scheduler is stopped.' : 'Background scheduler is stopped. App-open schedules still run while Andorra is open.' };
|
|
60
|
+
detail: live ? 'Background scheduler is running. The computer must stay awake and signed in.' : registered ? 'Start at sign-in is installed; the background scheduler is stopped.' : 'Background scheduler is stopped. App-open schedules still run while Andorra Code is open.' };
|
|
61
61
|
}
|
|
62
62
|
/** Authenticated loopback control avoids signalling an unrelated process after PID reuse. */
|
|
63
63
|
export async function runAutomationDaemon(directory = configDirectory(), externalSignal) {
|
|
@@ -6,6 +6,14 @@ export declare function isBrowserToolName(name: string): boolean;
|
|
|
6
6
|
/** Project telemetry before any event consumer can persist a browser input. */
|
|
7
7
|
export declare function browserEventArguments(args: unknown): unknown;
|
|
8
8
|
export declare function disposeBrowserSessions(identity?: object): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Said when no channel has anything to launch. A container or server image often has no browser
|
|
11
|
+
* at all, and "install Chrome/Edge" sent agents off to install one mid-task; the useful answer is
|
|
12
|
+
* to stop calling browser tools and reach the page another way.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MISSING_BROWSER_MESSAGE = "Browser unavailable: no Chromium, Chrome or Edge is installed in this environment, so browser tools cannot run here. Do not call them again in this run. Fetch pages with curl or a script instead, and say in your summary that no browser check was possible. Only if the task itself needs a real browser, install one with `npx playwright-core install --with-deps chromium`.";
|
|
15
|
+
/** Forget a remembered "no browser" result; for tests and for a caller that just installed one. */
|
|
16
|
+
export declare function resetBrowserAvailability(): void;
|
|
9
17
|
/**
|
|
10
18
|
* Reserve one screenshot against the image budget every browser tool in this
|
|
11
19
|
* agent tool batch shares. The reservation is a fixed estimate; `commit` trims
|
|
@@ -147,6 +147,9 @@ export async function disposeBrowserSessions(identity) {
|
|
|
147
147
|
}
|
|
148
148
|
/** Headless isolated profile; never attaches to the user's existing browser. */
|
|
149
149
|
async function launch(signal) {
|
|
150
|
+
if (missingBrowser && Date.now() < missingBrowser.until)
|
|
151
|
+
throw new Error(missingBrowser.message);
|
|
152
|
+
missingBrowser = undefined;
|
|
150
153
|
const specifier = 'playwright-core';
|
|
151
154
|
const { chromium } = await import(specifier);
|
|
152
155
|
const failures = [];
|
|
@@ -183,8 +186,31 @@ async function launch(signal) {
|
|
|
183
186
|
failures.push((error instanceof Error ? error.message : String(error)).split('\n')[0]);
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
|
-
|
|
189
|
+
const detail = failures.join('; ').slice(0, 1000);
|
|
190
|
+
if (failures.length && failures.every(noBrowserInstalled)) {
|
|
191
|
+
// Nothing to launch is a fact about the machine, not about this call: remember it so the next
|
|
192
|
+
// call answers at once instead of trying three channels again, and tell the model what to do
|
|
193
|
+
// in its place. The memory is short, so a browser installed during the run is still found.
|
|
194
|
+
missingBrowser = { until: Date.now() + MISSING_BROWSER_MEMORY_MS, message: `${MISSING_BROWSER_MESSAGE} ${detail}` };
|
|
195
|
+
throw new Error(missingBrowser.message);
|
|
196
|
+
}
|
|
197
|
+
throw new Error(`Browser unavailable: install Chrome/Edge or the Chromium version required by playwright-core. ${detail}`);
|
|
198
|
+
}
|
|
199
|
+
/** How long a "no browser is installed" result is reused before the machine is asked again. */
|
|
200
|
+
const MISSING_BROWSER_MEMORY_MS = 60_000;
|
|
201
|
+
/**
|
|
202
|
+
* Said when no channel has anything to launch. A container or server image often has no browser
|
|
203
|
+
* at all, and "install Chrome/Edge" sent agents off to install one mid-task; the useful answer is
|
|
204
|
+
* to stop calling browser tools and reach the page another way.
|
|
205
|
+
*/
|
|
206
|
+
export const MISSING_BROWSER_MESSAGE = 'Browser unavailable: no Chromium, Chrome or Edge is installed in this environment, so browser tools cannot run here. Do not call them again in this run. Fetch pages with curl or a script instead, and say in your summary that no browser check was possible. Only if the task itself needs a real browser, install one with `npx playwright-core install --with-deps chromium`.';
|
|
207
|
+
let missingBrowser;
|
|
208
|
+
/** Playwright's wording for a channel or bundled build that is not on disk. */
|
|
209
|
+
function noBrowserInstalled(failure) {
|
|
210
|
+
return /Executable doesn't exist|is not found at|distribution '[^']+' is not found|Failed to find|ENOENT/i.test(failure);
|
|
187
211
|
}
|
|
212
|
+
/** Forget a remembered "no browser" result; for tests and for a caller that just installed one. */
|
|
213
|
+
export function resetBrowserAvailability() { missingBrowser = undefined; }
|
|
188
214
|
class BrowserOperationTimeoutError extends Error {
|
|
189
215
|
}
|
|
190
216
|
/** Own late transport settlement without awaiting an unresponsive browser close. */
|