autokap 1.3.11 → 1.3.12

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/browser.js CHANGED
@@ -809,27 +809,49 @@ export class Browser {
809
809
  static async forClipCapture(options, cursorScript) {
810
810
  const instance = new Browser(options);
811
811
  const deviceScaleFactor = normalizeDeviceScaleFactor(options.deviceScaleFactor);
812
- // Enable GPU compositor on non-Linux platforms so Chrome can render
813
- // 2880×1800 without saturating the CPU. Linux (Docker/CI) keeps
814
- // `--disable-gpu` from CHROMIUM_ARGS because GPU is rarely available there.
815
- // SwiftShader was attempted for cloud Linux (v1.3.8) but caused GPU
816
- // process crashes mid-recording Playwright's Jammy base lacks the GL
817
- // libs SwiftShader expects. Reverted in v1.3.9.
818
- const baseArgs = process.platform === 'linux'
812
+ // Enable GPU compositor on every platform that has a real GPU available:
813
+ // macOS (Metal), Windows (D3D11), and Cloud Run (NVIDIA L4 via Vulkan).
814
+ // Local Linux without a GPU keeps `--disable-gpu` from CHROMIUM_ARGS as
815
+ // a safe software fallback. Cloud Run mounts the NVIDIA driver under
816
+ // /usr/local/nvidia/lib64 (see cloud-runner/Dockerfile) so the userspace
817
+ // Vulkan loader can bind to the L4. SwiftShader was tried on Fly (v1.3.8)
818
+ // and crashed because Fly machines had no real GPU; with a hardware L4
819
+ // and the proper userspace stack the path is supported.
820
+ const isCloudRunner = process.env.AUTOKAP_CLOUD_RUNNER === '1';
821
+ const isLinuxWithGpu = process.platform === 'linux' && isCloudRunner;
822
+ const baseArgs = (process.platform === 'linux' && !isLinuxWithGpu)
819
823
  ? CHROMIUM_ARGS
820
824
  : CHROMIUM_ARGS.filter(arg => arg !== '--disable-gpu' && arg !== '--disable-gpu-sandbox');
821
825
  // Pin ANGLE to the platform's native graphics API. Chrome's default
822
826
  // backend is OpenGL on macOS, which is far slower than Metal for the
823
827
  // compositor (measured 4 FPS vs 32 FPS at 2880×1800 on a heavy React UI).
824
- // Same story on Windows where D3D11 is the native fast path.
828
+ // Same story on Windows where D3D11 is the native fast path. Cloud Run
829
+ // L4 routes through Vulkan — the most stable backend Chromium supports
830
+ // on Linux + NVIDIA, with hardware-accelerated rasterization and video.
825
831
  const angleArg = process.platform === 'darwin' ? '--use-angle=metal'
826
832
  : process.platform === 'win32' ? '--use-angle=d3d11'
827
- : null; // Linux: skip — GPU is rarely present in CI anyway
833
+ : isLinuxWithGpu ? '--use-angle=vulkan'
834
+ : null;
835
+ // Cloud Run NVIDIA L4: explicit Vulkan + GPU rasterization opt-ins.
836
+ // `--ignore-gpu-blocklist` bypasses Chromium's hardcoded driver blocklist
837
+ // (it doesn't know about Cloud Run's mounted NVIDIA driver). Skia GPU
838
+ // rasterization + zero-copy texture upload are the throughput wins for
839
+ // backdrop-filter, blur, and full-viewport repaints (the modal-open
840
+ // scenario that defeats software rasterization at ~1 fps).
841
+ const cloudGpuArgs = isLinuxWithGpu
842
+ ? [
843
+ '--enable-features=Vulkan',
844
+ '--ignore-gpu-blocklist',
845
+ '--enable-gpu-rasterization',
846
+ '--enable-zero-copy',
847
+ ]
848
+ : [];
828
849
  const clipArgs = [
829
850
  ...baseArgs,
830
851
  `--force-device-scale-factor=${deviceScaleFactor}`,
831
852
  `--window-size=${Math.round(options.viewport.width)},${Math.round(options.viewport.height)}`,
832
853
  ...(angleArg ? [angleArg] : []),
854
+ ...cloudGpuArgs,
833
855
  ];
834
856
  // Dedicated browser process for clip capture. Not pooled because clip
835
857
  // capture installs context-level init scripts (cursor overlay).
@@ -35,12 +35,13 @@ export class ClipCaptureLoop {
35
35
  this.framesDir = opts.framesDir;
36
36
  this.jpegQuality = opts.jpegQuality ?? 80;
37
37
  // Linux default is 8 fps to stay safe on 2 vCPU CI runners. Cloud runners
38
- // (AUTOKAP_CLOUD_RUNNER=1, set by the Fly.io image and the `--cloud` CLI
39
- // flag) get the same 15 fps default as macOS/Windows since they have
40
- // dedicated 8 vCPU capacity. Callers can still override via opts.targetFps.
38
+ // (AUTOKAP_CLOUD_RUNNER=1, set by the Cloud Run image and the `--cloud`
39
+ // CLI flag) target 30 fps now that NVIDIA L4 GPU compositing is on (AUT-79
40
+ // migration). macOS/Windows also target 30 since their native compositors
41
+ // (Metal/D3D11) sustain it. Callers can still override via opts.targetFps.
41
42
  const isCloudRunner = process.env.AUTOKAP_CLOUD_RUNNER === '1';
42
- const linuxDefault = isCloudRunner ? 15 : 8;
43
- const platformDefault = process.platform === 'linux' ? linuxDefault : 15;
43
+ const linuxDefault = isCloudRunner ? 30 : 8;
44
+ const platformDefault = process.platform === 'linux' ? linuxDefault : 30;
44
45
  const targetFps = Math.max(1, Math.min(30, opts.targetFps ?? platformDefault));
45
46
  this.targetFps = targetFps;
46
47
  this.targetFrameIntervalMs = 1000 / targetFps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autokap",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "description": "AI-powered CLI tool for capturing clean screenshots of websites",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",