camofox-browser 2.4.6 → 2.4.7
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/CHANGELOG.md +26 -0
- package/README.md +28 -4
- package/THIRD-PARTY-NOTICES.md +49 -0
- package/dist/src/cli/server/manager.d.ts.map +1 -1
- package/dist/src/cli/server/manager.js +1 -4
- package/dist/src/cli/server/manager.js.map +1 -1
- package/dist/src/routes/core.d.ts.map +1 -1
- package/dist/src/routes/core.js +46 -1
- package/dist/src/routes/core.js.map +1 -1
- package/dist/src/routes/openclaw.d.ts.map +1 -1
- package/dist/src/routes/openclaw.js +35 -1
- package/dist/src/routes/openclaw.js.map +1 -1
- package/dist/src/services/context-pool.d.ts +42 -2
- package/dist/src/services/context-pool.d.ts.map +1 -1
- package/dist/src/services/context-pool.js +408 -115
- package/dist/src/services/context-pool.js.map +1 -1
- package/dist/src/services/health.d.ts +57 -6
- package/dist/src/services/health.d.ts.map +1 -1
- package/dist/src/services/health.js +132 -11
- package/dist/src/services/health.js.map +1 -1
- package/dist/src/services/nav-recovery.d.ts +23 -0
- package/dist/src/services/nav-recovery.d.ts.map +1 -0
- package/dist/src/services/nav-recovery.js +63 -0
- package/dist/src/services/nav-recovery.js.map +1 -0
- package/dist/src/services/session.d.ts +84 -0
- package/dist/src/services/session.d.ts.map +1 -1
- package/dist/src/services/session.js +338 -35
- package/dist/src/services/session.js.map +1 -1
- package/dist/src/services/tab.d.ts +5 -1
- package/dist/src/services/tab.d.ts.map +1 -1
- package/dist/src/services/tab.js +114 -51
- package/dist/src/services/tab.js.map +1 -1
- package/dist/src/services/tracing.js +2 -2
- package/dist/src/services/tracing.js.map +1 -1
- package/dist/src/services/vnc.d.ts.map +1 -1
- package/dist/src/services/vnc.js +2 -0
- package/dist/src/services/vnc.js.map +1 -1
- package/dist/src/types.d.ts +2 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/config.d.ts +3 -0
- package/dist/src/utils/config.d.ts.map +1 -1
- package/dist/src/utils/config.js +3 -0
- package/dist/src/utils/config.js.map +1 -1
- package/dist/src/utils/launcher.js +1 -1
- package/dist/src/utils/launcher.js.map +1 -1
- package/dist/src/utils/platform-support.d.ts +17 -0
- package/dist/src/utils/platform-support.d.ts.map +1 -0
- package/dist/src/utils/platform-support.js +57 -0
- package/dist/src/utils/platform-support.js.map +1 -0
- package/dist/src/utils/profile-path.d.ts +9 -0
- package/dist/src/utils/profile-path.d.ts.map +1 -0
- package/dist/src/utils/profile-path.js +105 -0
- package/dist/src/utils/profile-path.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +10 -3
- package/dist/src/cli/utils/api-fallback.d.ts +0 -4
- package/dist/src/cli/utils/api-fallback.d.ts.map +0 -1
- package/dist/src/cli/utils/api-fallback.js +0 -20
- package/dist/src/cli/utils/api-fallback.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [2.4.7] - 2026-08-13
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Added official Windows x64 headless support and a reproducible portable ZIP build that bundles Node.js, the application runtime, the pinned Camoufox Windows x64 engine, portable runtime state under `data\home`, and third-party licensing notices.
|
|
9
|
+
- Added Windows Node 20/22 CI plus a Windows x64 portable-artifact job that extracts into a path containing spaces and verifies bundled-runtime CLI startup, `/health`, a safe local create/navigate/snapshot/close browser flow, server shutdown, and portable-state placement.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Server subprocess launches now reuse `process.execPath`, so bundled/embedded Node runtimes do not depend on a globally installed `node` executable on `PATH`.
|
|
13
|
+
- Package release verification is now implemented in cross-platform Node.js instead of Bash and runs on both Ubuntu and Windows CI.
|
|
14
|
+
- The release workflow builds, verifies, and attaches the Windows x64 portable ZIP to tag releases.
|
|
15
|
+
|
|
16
|
+
### Security
|
|
17
|
+
- Refreshed the dependency lock for current advisories and override `adm-zip` to the patched `0.6.0` release without changing the supported Node floor or `camoufox-js` version.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Windows now rejects headed and virtual/Xvfb/VNC display modes before Linux-only display processes can be attempted, while preserving existing Linux/macOS display behavior.
|
|
21
|
+
- New Windows persistent profile directories now use deterministic hashed internal keys, preventing distinct case-sensitive user/session identities from aliasing on case-insensitive Windows filesystems while leaving Linux/macOS profile naming unchanged. Existing Windows directories from the previous layout remain readable in place when the exact legacy name is unambiguous; if both old and hashed directories exist, or Windows resolves a different case/trailing-dot/space-equivalent legacy name, profile launch fails closed and reports the paths to back up/reconcile instead of silently choosing or migrating state.
|
|
22
|
+
- Navigation health recovery now tracks failures per session, counts only actual navigation failures, preserves unrelated sibling sessions, and applies the same recovery behavior to core and OpenClaw tab-opening routes.
|
|
23
|
+
- Concurrent recovery teardown and same-key context relaunch now use opaque session generations and exact context identity guards, preserving a healthy replacement session even when timestamps collide or lifecycle callbacks arrive late.
|
|
24
|
+
|
|
25
|
+
### Tests
|
|
26
|
+
- Added focused Windows platform and VNC side-effect regression tests plus a launcher test that removes Node from `PATH` and verifies the current runtime is reused.
|
|
27
|
+
- Jest now isolates profiles, cookies, downloads, and traces under a disposable temp root and removes it after the run, preventing test/build verification from accumulating persistent state under the operator's `~/.camofox` directory.
|
|
28
|
+
- Long-running session lifecycle coverage now reclaims its disposable profiles/downloads/cookies/traces after each fully closed case, preventing in-run profile buildup from exhausting Windows CI while retaining every lifecycle assertion.
|
|
29
|
+
- Added production-boundary lifecycle regressions for recovery/relaunch overlap and equal-timestamp collisions, plus real Express coverage for OpenClaw `POST /tabs/open` recovery thresholds, success resets, and non-navigation isolation.
|
|
30
|
+
|
|
5
31
|
## [2.4.6] - 2026-06-17
|
|
6
32
|
|
|
7
33
|
### Fixed
|
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
- [Features](#features)
|
|
14
14
|
- [Preview Status](#preview-status)
|
|
15
15
|
- [Quick Start](#quick-start)
|
|
16
|
+
- [Windows x64 Portable](#windows-x64-portable)
|
|
16
17
|
- [CLI](#cli)
|
|
17
18
|
- [Console Capture](#console-capture)
|
|
18
19
|
- [Playwright Tracing](#playwright-tracing)
|
|
@@ -128,6 +129,27 @@ camofox click e5
|
|
|
128
129
|
|
|
129
130
|
> See [CLI](#cli) for the complete command reference.
|
|
130
131
|
|
|
132
|
+
## Windows x64 Portable
|
|
133
|
+
|
|
134
|
+
Windows x64 is supported as a headless-first portable distribution. Release ZIPs are named `camofox-browser-<version>-windows-x64.zip` and contain the Node.js runtime, application runtime, and the pinned Camoufox Windows x64 engine, so a global Node.js installation is not required.
|
|
135
|
+
|
|
136
|
+
Extract the ZIP to a writable directory and run the bundled launchers from PowerShell or Command Prompt:
|
|
137
|
+
|
|
138
|
+
```powershell
|
|
139
|
+
.\camofox.cmd --version
|
|
140
|
+
.\camofox.cmd server start --background
|
|
141
|
+
.\camofox.cmd server status
|
|
142
|
+
.\camofox.cmd server stop
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Portable runtime state stays under `data\home` inside the extracted directory. This includes camofox-browser's `.camofox` profiles/logs and the bundled Camoufox cache, so the portable distribution does not use the normal Windows user profile for its application state.
|
|
146
|
+
|
|
147
|
+
The portable ZIP intentionally excludes Camoufox's upstream bundled `fonts/` directory because the exact upstream source explicitly does not permit redistribution of those copyrighted Windows/macOS fonts. On Windows, CamoFox uses fonts installed on the host system instead.
|
|
148
|
+
|
|
149
|
+
The supported Windows x64 display contract is `headless=true`. `headless=false` and `headless="virtual"` are rejected with a clear error before any Linux-only display process is attempted. Xvfb/VNC virtual display mode remains Linux-only, and native headed Windows mode is not part of the verified support contract.
|
|
150
|
+
|
|
151
|
+
The release workflow verifies the ZIP after extracting it into a path containing spaces, starts the CLI using bundled Node.js with global Node removed from `PATH`, checks `/health`, runs a local create → navigate → snapshot → close browser flow, and confirms server shutdown and portable-state placement.
|
|
152
|
+
|
|
131
153
|
### Using Docker
|
|
132
154
|
|
|
133
155
|
> Docker image: `ghcr.io/redf0x1/camofox-browser`
|
|
@@ -461,7 +483,7 @@ AI Agent (MCP / OpenClaw / REST Client)
|
|
|
461
483
|
### Persistent Profiles (v1.3.0)
|
|
462
484
|
|
|
463
485
|
- Each `userId` runs in its own persistent Firefox process/context (backed by `launchPersistentContext(userDataDir)`)
|
|
464
|
-
- Profile data is stored
|
|
486
|
+
- Profile data is stored under `~/.camofox/profiles/` (override via `CAMOFOX_PROFILES_DIR`). Linux/macOS keep the readable default-user directory name; new Windows profiles use a deterministic hashed directory name so case-insensitive or trailing-dot/space-equivalent user IDs cannot share a Firefox profile. Existing Windows directories from the previous layout are read in place only when their exact on-disk name is unambiguous and no hashed directory also exists; conflicting layouts fail closed with both recovery paths in the error.
|
|
465
487
|
- Idle user contexts are closed via LRU eviction (profile data remains on disk)
|
|
466
488
|
|
|
467
489
|
## API Reference
|
|
@@ -481,7 +503,7 @@ The OpenAPI spec covers a representative subset of core and OpenClaw endpoints,
|
|
|
481
503
|
|
|
482
504
|
### Core Endpoints
|
|
483
505
|
|
|
484
|
-
Note: For any endpoint that targets an existing tab (`/tabs/:tabId/...`), the server resolves `tabId` **within a `userId` scope**. If you omit `userId
|
|
506
|
+
Note: For any endpoint that targets an existing tab (`/tabs/:tabId/...`), the server resolves `tabId` **within a `userId` scope**. If you omit `userId` from the request body, the server returns `400 { "error": "userId is required" }`. If `userId` is present but the tab belongs to a different user, the server returns `404 Tab not found` — except `DELETE /tabs/:tabId`, which is idempotent and returns `200 { "ok": true }` when no matching tab is found under the given `userId` scope (the tab is already gone from the caller's perspective). For endpoints that accept `userId` as a query parameter (e.g. `GET /tabs/:tabId/snapshot`), omitting it may also result in a `400` or `404` depending on the route.
|
|
485
507
|
|
|
486
508
|
| Method | Endpoint | Description | Required | Auth |
|
|
487
509
|
|--------|----------|-------------|----------|------|
|
|
@@ -539,6 +561,8 @@ POST /sessions/:userId/toggle-display
|
|
|
539
561
|
**Auth:** Conditional — requires `Authorization: Bearer $CAMOFOX_API_KEY` when `CAMOFOX_AUTH_MODE=required` or when `auto` mode has an API key configured. No auth is required in `CAMOFOX_AUTH_MODE=disabled`.
|
|
540
562
|
Switch browser between headless and headed mode. When encountering CAPTCHAs or issues requiring visual interaction, switch to headed mode to show the browser window.
|
|
541
563
|
|
|
564
|
+
**Platform note:** The Windows x64 contract is headless-only. Requests with `headless: false` or `headless: "virtual"` return HTTP 400 on Windows. The Xvfb/VNC behavior described below is Linux-only.
|
|
565
|
+
|
|
542
566
|
Returns:
|
|
543
567
|
```json
|
|
544
568
|
{"ok": true, "headless": "virtual", "vncUrl": "http://localhost:6080/vnc.html?autoconnect=true&resize=scale&token=...", "message": "Browser visible via VNC", "userId": "agent1"}
|
|
@@ -547,7 +571,7 @@ Returns:
|
|
|
547
571
|
**Note:** This restarts the browser context. All tabs are invalidated but cookies/auth state persist via the persistent profile.
|
|
548
572
|
|
|
549
573
|
### Browser Viewer (noVNC)
|
|
550
|
-
|
|
574
|
+
On Linux, when the display mode is set to `"virtual"` or a headed request requires a virtual display, the server can start a VNC viewer accessible via web browser.
|
|
551
575
|
|
|
552
576
|
```bash
|
|
553
577
|
# 1. Switch to virtual mode
|
|
@@ -839,7 +863,7 @@ Then use profiles by name in API requests or CLI commands.
|
|
|
839
863
|
| `CAMOFOX_AUTH_MODE` | `auto` | API-key policy: `auto` allows loopback without auth and requires `CAMOFOX_API_KEY` for non-loopback binds; `required` requires `CAMOFOX_API_KEY` for every bind; `disabled` disables API-key auth for protected endpoints and is only for trusted private agent networks. |
|
|
840
864
|
| `CAMOFOX_API_KEY` | (empty) | Guards protected endpoints (tab creation, navigation, interaction, session management, downloads, image extraction, tracing, console) via `Authorization: Bearer` header when set. Required in `CAMOFOX_AUTH_MODE=required`, and required by `auto` whenever `CAMOFOX_HOST` exposes the server beyond loopback. Must be unset when `CAMOFOX_AUTH_MODE=disabled`. |
|
|
841
865
|
| `CAMOFOX_ALLOW_PRIVATE_NETWORK` | `true` on loopback binds, `false` otherwise | Allows navigation to loopback/private/link-local/metadata targets. Leave unset for the safe default; enable only for trusted deployments that intentionally need internal-network reachability. |
|
|
842
|
-
| `CAMOFOX_HEADLESS` | `true` | Display mode: `true` (headless), `false` (headed), `virtual` (Xvfb) |
|
|
866
|
+
| `CAMOFOX_HEADLESS` | `true` | Display mode: `true` (headless), `false` (headed), `virtual` (Xvfb). Windows x64 supports `true` only; Xvfb/VNC is Linux-only. |
|
|
843
867
|
| `CAMOFOX_VNC_RESOLUTION` | `1920x1080x24` | Virtual Xvfb display resolution (`WIDTHxHEIGHTxDEPTH`) |
|
|
844
868
|
| `CAMOFOX_VNC_TIMEOUT_MS` | `120000` | Max VNC session duration in ms before auto-stop |
|
|
845
869
|
| `CAMOFOX_EVAL_EXTENDED_RATE_LIMIT_MAX` | `20` | Max evaluate-extended requests per user per window |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
The portable Windows distribution redistributes the following runtime components in addition to camofox-browser itself.
|
|
4
|
+
|
|
5
|
+
## Node.js v22.23.2
|
|
6
|
+
|
|
7
|
+
- Project: https://nodejs.org/
|
|
8
|
+
- Source: https://github.com/nodejs/node/tree/v22.23.2
|
|
9
|
+
- License: MIT, with additional third-party notices included by the upstream Node.js distribution.
|
|
10
|
+
- The upstream `LICENSE` file is retained in the portable bundle under `node/LICENSE`.
|
|
11
|
+
|
|
12
|
+
## Camoufox v152.0.4-beta.28
|
|
13
|
+
|
|
14
|
+
- Project: https://github.com/daijro/camoufox
|
|
15
|
+
- Source: https://github.com/daijro/camoufox/tree/v152.0.4-beta.28
|
|
16
|
+
- License: Mozilla Public License 2.0 (MPL-2.0).
|
|
17
|
+
- The portable bundle redistributes the Windows x64 browser/runtime from the exact upstream release, with the upstream `fonts/` directory deliberately removed.
|
|
18
|
+
- The exact upstream tag states that its Windows/macOS bundled fonts are copyrighted and are not intended or permitted for redistribution. Those fonts are therefore not included in this portable distribution; Windows uses the fonts installed on the host system.
|
|
19
|
+
- The exact Camoufox MPL-2.0 text is retained at `licenses/Camoufox-MPL-2.0.txt`, and the corresponding source is available from the exact source tag above.
|
|
20
|
+
|
|
21
|
+
## camoufox-js 0.8.5
|
|
22
|
+
|
|
23
|
+
- Project: https://github.com/apify/camoufox-js
|
|
24
|
+
- Source revision published by npm: https://github.com/apify/camoufox-js/tree/afce2afa1300f1a938c0eb04aae92ff73fcd2c5b
|
|
25
|
+
- License: Mozilla Public License 2.0 (MPL-2.0).
|
|
26
|
+
- The package license is retained under `app/node_modules/camoufox-js/`.
|
|
27
|
+
|
|
28
|
+
## impit 0.7.6 / impit-win32-x64-msvc 0.7.6
|
|
29
|
+
|
|
30
|
+
- Project: https://github.com/apify/impit
|
|
31
|
+
- Source revision published by npm: https://github.com/apify/impit/tree/be0331c1ea34349a6d97c5f269a4af1d21d783e7
|
|
32
|
+
- License: Apache License 2.0.
|
|
33
|
+
- The Windows x64 native package is required by `impit`, a runtime dependency of `camoufox-js`.
|
|
34
|
+
- A copy of the Apache License 2.0 is retained in the portable bundle at `licenses/Apache-2.0.txt`.
|
|
35
|
+
|
|
36
|
+
## playwright-core 1.58.1 / VS Code Codicon assets
|
|
37
|
+
|
|
38
|
+
- Project: https://github.com/microsoft/playwright/tree/v1.58.1
|
|
39
|
+
- `playwright-core` is Apache-2.0 and retains its upstream `LICENSE`, `NOTICE`, and `ThirdPartyNotices.txt` under `app/node_modules/playwright-core/`.
|
|
40
|
+
- Playwright's bundled Codicon font assets originate from its `packages/web/src/third_party/vscode/` source directory and are covered there by the MIT License, Copyright (c) 2015 - present Microsoft Corporation.
|
|
41
|
+
- The exact upstream MIT license text for those Codicon assets is retained at `licenses/Playwright-VSCode-Codicon-MIT.txt`.
|
|
42
|
+
|
|
43
|
+
The Mozilla Public License 2.0 text used by `camoufox-js` is retained at `licenses/MPL-2.0.txt`. The Camoufox executable and browser runtime correspond to upstream `v152.0.4-beta.28`, except for the excluded `fonts/` payload described above.
|
|
44
|
+
|
|
45
|
+
## Other npm runtime dependencies
|
|
46
|
+
|
|
47
|
+
Production npm dependencies are installed from the repository lockfile with their package metadata and license files preserved under `app/node_modules/`. Refer to each package's included `package.json` and license file for its applicable terms.
|
|
48
|
+
|
|
49
|
+
camoufox-browser itself is licensed under the MIT License; see `app/LICENSE` in the portable bundle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/cli/server/manager.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CAClB;AAID,qBAAa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAEzB,IAAI,CAAC,EAAE,MAAM;WAOX,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM;IAOvC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B,WAAW,CAAC,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC3G,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB3B,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAqB/B,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAkB7B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;YA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;IAQtB,OAAO,CAAC,UAAU;YASJ,KAAK;YAIL,WAAW;IAoBzB,OAAO,CAAC,MAAM,CAAC,WAAW;CAG1B"}
|
|
@@ -177,10 +177,7 @@ class ServerManager {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
async delay(ms) {
|
|
180
|
-
await new Promise((resolve) =>
|
|
181
|
-
const timer = setTimeout(() => resolve(), ms);
|
|
182
|
-
timer.unref();
|
|
183
|
-
});
|
|
180
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
184
181
|
}
|
|
185
182
|
async isPortInUse(port) {
|
|
186
183
|
return new Promise((resolve) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../../src/cli/server/manager.ts"],"names":[],"mappings":";;;AAAA,qCAA0G;AAC1G,qCAAkC;AAClC,yCAA0C;AAC1C,2DAA2C;AAE3C,+CAAgD;AAChD,uCAAkC;AAUlC,MAAM,eAAe,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,oCAAoC,CAAC,CAAC;AAEjF,MAAa,aAAa;IACR,IAAI,CAAS;IACb,UAAU,CAAS;IACnB,WAAW,CAAS;IACpB,WAAW,CAAS;IAErC,YAAY,IAAa;QACxB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,UAAU,CAAC,CAAC;QAC9C,IAAI,CAAC,WAAW,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QACvD,IAAI,CAAC,WAAW,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IAChE,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,YAAqB;QAC1C,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,a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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/routes/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/routes/core.ts"],"names":[],"mappings":"AA0HA,QAAA,MAAM,MAAM,4CAAW,CAAC;AA22DxB,eAAe,MAAM,CAAC"}
|
package/dist/src/routes/core.js
CHANGED
|
@@ -45,9 +45,12 @@ const logging_1 = require("../middleware/logging");
|
|
|
45
45
|
const auth_1 = require("../middleware/auth");
|
|
46
46
|
const rate_limit_1 = require("../middleware/rate-limit");
|
|
47
47
|
const config_1 = require("../utils/config");
|
|
48
|
+
const platform_support_1 = require("../utils/platform-support");
|
|
48
49
|
const presets_1 = require("../utils/presets");
|
|
49
50
|
const context_pool_1 = require("../services/context-pool");
|
|
50
51
|
const lifecycle_controller_1 = require("../services/lifecycle-controller");
|
|
52
|
+
const health_1 = require("../services/health");
|
|
53
|
+
const nav_recovery_1 = require("../services/nav-recovery");
|
|
51
54
|
const vnc_1 = require("../services/vnc");
|
|
52
55
|
const session_1 = require("../services/session");
|
|
53
56
|
const tab_1 = require("../services/tab");
|
|
@@ -283,12 +286,18 @@ router.get('/presets', (_req, res) => {
|
|
|
283
286
|
router.post('/tabs', async (req, res) => {
|
|
284
287
|
let createUserId;
|
|
285
288
|
let createSessionKey;
|
|
289
|
+
let createSessionMapKey;
|
|
286
290
|
let createdSessionProfile = false;
|
|
287
291
|
let createdSessionProfileSignature;
|
|
288
292
|
let createdDefaultSessionProfileClaim = false;
|
|
289
293
|
let releaseSessionProfileCreate;
|
|
290
294
|
let isFirstCreator = false;
|
|
291
295
|
let stagedGeneration;
|
|
296
|
+
// Track whether the error (if any) occurred during navigation
|
|
297
|
+
// vs. provisioning. Only navigation errors should be counted
|
|
298
|
+
// toward the nav failure threshold — provisioning errors
|
|
299
|
+
// (session creation, mutex, profile) are a different class.
|
|
300
|
+
let navError = false;
|
|
292
301
|
try {
|
|
293
302
|
if (CONFIG.apiKey && !(0, auth_1.isAuthorizedWithApiKey)(req, CONFIG.apiKey)) {
|
|
294
303
|
return res.status(403).json({ error: 'Forbidden' });
|
|
@@ -427,6 +436,7 @@ router.post('/tabs', async (req, res) => {
|
|
|
427
436
|
const sessionMapKey = establishedProfile
|
|
428
437
|
? (0, session_1.getSessionMapKey)(userId, resolvedSessionKey, establishedProfile.signature)
|
|
429
438
|
: (0, session_1.getSessionMapKey)(userId, contextOverrides);
|
|
439
|
+
createSessionMapKey = sessionMapKey;
|
|
430
440
|
let tabId;
|
|
431
441
|
let pageUrl;
|
|
432
442
|
if (isFirstCreator) {
|
|
@@ -440,11 +450,15 @@ router.post('/tabs', async (req, res) => {
|
|
|
440
450
|
(0, download_1.registerDownloadListener)(tabId, String(userId), page);
|
|
441
451
|
(0, download_1.markDownloadsStaged)(tabId);
|
|
442
452
|
if (url) {
|
|
453
|
+
navError = true;
|
|
443
454
|
await (0, tab_1.navigateWithSafetyGuard)(page, url, {
|
|
444
455
|
allowPrivateNetworkTargets: CONFIG.allowPrivateNetworkTargets,
|
|
445
456
|
waitUntil: 'domcontentloaded',
|
|
446
457
|
timeout: 30000,
|
|
447
458
|
});
|
|
459
|
+
navError = false;
|
|
460
|
+
// Record success immediately after navigation resolves.
|
|
461
|
+
(0, health_1.recordNavSuccess)(String(userId), sessionMapKey);
|
|
448
462
|
tabState.visitedUrls.add(url);
|
|
449
463
|
}
|
|
450
464
|
const committed = (0, session_1.commitStagedFirstUse)(userId, session, contextOverrides, {
|
|
@@ -493,11 +507,15 @@ router.post('/tabs', async (req, res) => {
|
|
|
493
507
|
(0, session_1.indexTab)(tabId, sessionMapKey);
|
|
494
508
|
(0, download_1.registerDownloadListener)(tabId, String(userId), page);
|
|
495
509
|
if (url) {
|
|
510
|
+
navError = true;
|
|
496
511
|
await (0, tab_1.navigateWithSafetyGuard)(page, url, {
|
|
497
512
|
allowPrivateNetworkTargets: CONFIG.allowPrivateNetworkTargets,
|
|
498
513
|
waitUntil: 'domcontentloaded',
|
|
499
514
|
timeout: 30000,
|
|
500
515
|
});
|
|
516
|
+
navError = false;
|
|
517
|
+
// Record success immediately after navigation resolves.
|
|
518
|
+
(0, health_1.recordNavSuccess)(String(userId), sessionMapKey);
|
|
501
519
|
tabState.visitedUrls.add(url);
|
|
502
520
|
}
|
|
503
521
|
pageUrl = page.url();
|
|
@@ -539,6 +557,12 @@ router.post('/tabs', async (req, res) => {
|
|
|
539
557
|
releaseSessionProfileCreate = undefined;
|
|
540
558
|
const message = err instanceof Error ? err.message : String(err);
|
|
541
559
|
(0, logging_1.log)('error', 'tab create failed', { reqId: req.reqId, error: message });
|
|
560
|
+
// Only count navigation errors toward the failure threshold —
|
|
561
|
+
// provisioning errors (session creation, mutex, profile) are
|
|
562
|
+
// a different class and should not trigger browser recovery.
|
|
563
|
+
if (navError) {
|
|
564
|
+
await (0, nav_recovery_1.handleNavFailure)(String(createUserId ?? ''), createSessionMapKey);
|
|
565
|
+
}
|
|
542
566
|
return res.status(getRouteErrorStatus(err)).json({ error: (0, errors_1.safeError)(err) });
|
|
543
567
|
}
|
|
544
568
|
});
|
|
@@ -574,6 +598,8 @@ router.get('/tabs', async (req, res) => {
|
|
|
574
598
|
// Navigate
|
|
575
599
|
router.post('/tabs/:tabId/navigate', async (req, res) => {
|
|
576
600
|
const tabId = req.params.tabId;
|
|
601
|
+
let navError = false;
|
|
602
|
+
let foundSessionKey;
|
|
577
603
|
try {
|
|
578
604
|
if (CONFIG.apiKey && !(0, auth_1.isAuthorizedWithApiKey)(req, CONFIG.apiKey)) {
|
|
579
605
|
return res.status(403).json({ error: 'Forbidden' });
|
|
@@ -584,6 +610,7 @@ router.post('/tabs/:tabId/navigate', async (req, res) => {
|
|
|
584
610
|
const found = (0, session_1.findTabById)(tabId, userId);
|
|
585
611
|
if (!found)
|
|
586
612
|
return res.status(404).json({ error: 'Tab not found' });
|
|
613
|
+
foundSessionKey = found.sessionKey;
|
|
587
614
|
const { tabState } = found;
|
|
588
615
|
tabState.toolCalls++;
|
|
589
616
|
const result = await (0, session_1.withUserLimit)(String(userId), CONFIG.maxConcurrentPerUser, () => (0, tab_1.withTimeout)((0, tab_1.withTabLock)(tabId, async () => {
|
|
@@ -599,11 +626,21 @@ router.post('/tabs/:tabId/navigate', async (req, res) => {
|
|
|
599
626
|
});
|
|
600
627
|
if (urlErr)
|
|
601
628
|
return { status: 400, body: { error: urlErr } };
|
|
629
|
+
// Arm navError only around the actual navigation attempt —
|
|
630
|
+
// limiter/timeout/lock, macro expansion, validation, and
|
|
631
|
+
// buildRefs failures are NOT navigation errors and must not
|
|
632
|
+
// advance the recovery threshold.
|
|
633
|
+
navError = true;
|
|
602
634
|
await (0, tab_1.navigateWithSafetyGuard)(tabState.page, targetUrl, {
|
|
603
635
|
allowPrivateNetworkTargets: CONFIG.allowPrivateNetworkTargets,
|
|
604
636
|
waitUntil: 'domcontentloaded',
|
|
605
637
|
timeout: 30000,
|
|
606
638
|
});
|
|
639
|
+
navError = false;
|
|
640
|
+
// Record success immediately after navigation resolves —
|
|
641
|
+
// a buildRefs failure after this must NOT prevent the
|
|
642
|
+
// counter reset, since the navigation itself succeeded.
|
|
643
|
+
(0, health_1.recordNavSuccess)(String(req.body.userId), foundSessionKey);
|
|
607
644
|
tabState.visitedUrls.add(targetUrl);
|
|
608
645
|
tabState.refs = await (0, tab_1.buildRefs)(tabState.page);
|
|
609
646
|
return { status: 200, body: { ok: true, url: tabState.page.url() } };
|
|
@@ -617,6 +654,9 @@ router.post('/tabs/:tabId/navigate', async (req, res) => {
|
|
|
617
654
|
catch (err) {
|
|
618
655
|
const message = err instanceof Error ? err.message : String(err);
|
|
619
656
|
(0, logging_1.log)('error', 'navigate failed', { reqId: req.reqId, tabId, error: message });
|
|
657
|
+
if (navError) {
|
|
658
|
+
await (0, nav_recovery_1.handleNavFailure)(String(req.body.userId ?? ''), foundSessionKey);
|
|
659
|
+
}
|
|
620
660
|
return res.status(getRouteErrorStatus(err)).json({ error: (0, errors_1.safeError)(err) });
|
|
621
661
|
}
|
|
622
662
|
});
|
|
@@ -808,6 +848,8 @@ router.post('/tabs/:tabId/evaluate', express_1.default.json({ limit: '64kb' }),
|
|
|
808
848
|
return res.status(403).json({ error: 'Forbidden' });
|
|
809
849
|
}
|
|
810
850
|
const { userId, expression, timeout } = req.body;
|
|
851
|
+
if (!userId)
|
|
852
|
+
return res.status(400).json({ error: 'userId is required' });
|
|
811
853
|
if (!expression || typeof expression !== 'string') {
|
|
812
854
|
return res.status(400).json({ error: 'expression is required and must be a string' });
|
|
813
855
|
}
|
|
@@ -1085,6 +1127,8 @@ router.delete('/tabs/:tabId', async (req, res) => {
|
|
|
1085
1127
|
return res.status(403).json({ error: 'Forbidden' });
|
|
1086
1128
|
}
|
|
1087
1129
|
const { userId } = req.body;
|
|
1130
|
+
if (!userId)
|
|
1131
|
+
return res.status(400).json({ error: 'userId is required' });
|
|
1088
1132
|
const found = (0, session_1.findTabById)(req.params.tabId, userId);
|
|
1089
1133
|
if (found) {
|
|
1090
1134
|
await (0, tab_1.safePageClose)(found.tabState.page);
|
|
@@ -1169,6 +1213,7 @@ router.post('/sessions/:userId/toggle-display', async (req, res) => {
|
|
|
1169
1213
|
error: 'headless must be a boolean or "virtual"',
|
|
1170
1214
|
});
|
|
1171
1215
|
}
|
|
1216
|
+
(0, platform_support_1.assertBrowserPlatformSupported)((0, platform_support_1.getHostOS)(), (0, platform_support_1.getHostArchitecture)(), headless);
|
|
1172
1217
|
const existingSessions = (0, session_1.getSessionsForUser)(userId);
|
|
1173
1218
|
const prewarmProfileKey = existingSessions.length === 1 ? existingSessions[0][0] : undefined;
|
|
1174
1219
|
const prewarmEntry = prewarmProfileKey ? context_pool_1.contextPool.getEntry(prewarmProfileKey) : undefined;
|
|
@@ -1224,7 +1269,7 @@ router.post('/sessions/:userId/toggle-display', async (req, res) => {
|
|
|
1224
1269
|
catch (err) {
|
|
1225
1270
|
const message = err instanceof Error ? err.message : String(err);
|
|
1226
1271
|
(0, logging_1.log)('error', 'toggle display failed', { error: message });
|
|
1227
|
-
return res.status(
|
|
1272
|
+
return res.status(getRouteErrorStatus(err)).json({ error: (0, errors_1.safeError)(err) });
|
|
1228
1273
|
}
|
|
1229
1274
|
});
|
|
1230
1275
|
// Downloads: list by tab
|