Files
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00
..

@tutti-os/workbench-electron

Electron main-process helpers for Workbench previews.

The package owns two product-neutral mechanics:

  • serial webContents.capturePage() capture, renderer-rectangle cropping, full-size Genie output, bounded Dock resizing, timeout handling, and empty-image handling
  • validated, bounded, atomic filesystem storage for Dock preview data URLs

The consuming desktop host still owns IPC authorization, BrowserWindow ownership, the cache directory (for example, a path below Electron app.getPath("userData")), and product logging.

import {
  captureWorkbenchPreviewImages,
  createWorkbenchDockPreviewCacheStore
} from "@tutti-os/workbench-electron";

const previewImages = await captureWorkbenchPreviewImages({
  contentSize: ownerWindow.getContentBounds(),
  maxHeight: 170,
  maxWidth: 260,
  rect: rendererRect,
  webContents: ownerWindow.webContents
});

const cache = createWorkbenchDockPreviewCacheStore({
  directory: dockPreviewCacheDirectory
});

if (previewImages) {
  await cache.write({ dataUrl: previewImages.dockPreviewImageUrl, key });
}

captureWorkbenchPreviewImages calls capturePage() once. The cropped native image becomes the Genie image; a resized copy becomes the Dock preview. captureWorkbenchDockPreview remains available for consumers that only need the bounded Dock image.