One install's production archive was 2 GB: 2457 MB of computer workspaces (983 MB of npm, pip and bun caches, plus 697 MB of node_modules and 446 MB of pip installs), 993 MB of Chrome profile caches, 148 MB of database snapshots and 15 MB of bun-sqlite scratch space, against 178 MB of bot files. Runs had HOME on the mounted workspace and no cache variables, so every side cache was persisted forever, and the archiver tarred the whole volume with one exclusion. - Runs keep their caches inside the container: computerCacheEnv points XDG_CACHE_HOME, npm_config_cache, PIP_CACHE_DIR, BUN_INSTALL_CACHE_DIR and PYTHONPYCACHEPREFIX at the account's own home, never the run's folder. - prune-computer-caches (daily) clears what earlier runs left in bot folders, user folders, workspaces and Chrome profiles, skipping a computer with a task queued or running. The agent clears a profile's regenerable cache at each start and caps its HTTP cache. - listArchiveExclusions is the one definition of what a data archive leaves out, as exact member paths (--no-wildcards --exclude-from): computers, Chrome profile caches, db/.backups and .bun-sqlite. A restore keeps the running install's db/.backups, since no archive carries them, and still leaves computer folders live. - A computer's workspace has a quota (computer_workspace_quota_mb, Settings > General, default AppData.ComputerWorkspaceQuotaMb): the agent measures it, the app refuses a write past it and warns after computer_bash and browser calls. - An upload's bytes go with the messages that carried them, and prune-orphan-media takes what is left after AppData.MediaOrphanKeepDays; moved-aside old computer homes are pruned after AppData.ComputerOldHomeKeepDays. - install.sh removes the image the previous container ran and dangling layers, so updates stop accumulating gigabytes on the host.
78 lines
2.6 KiB
TypeScript
78 lines
2.6 KiB
TypeScript
/**
|
|
* What a bot's folder on a computer holds that is rebuilt on demand, and
|
|
* so is never worth keeping.
|
|
*
|
|
* A computer's workspace is mounted from the data volume, so without this
|
|
* every cache a run writes beside its work is kept forever: one install's
|
|
* volume held 368 MB of npm cache, 188 MB of pip and headless-Chromium
|
|
* caches and 53 MB of bun's install cache, against 178 MB of bot files.
|
|
* Runs now point their caches at the account's own home inside the
|
|
* container (`computerCacheEnv`), which a new container starts without;
|
|
* `pruneComputerCaches` clears what earlier runs left behind.
|
|
*/
|
|
|
|
/**
|
|
* A run folder's caches, relative to it. `.cache` is where every tool
|
|
* writes once a run has one (`computerCacheEnv`: pip, Playwright,
|
|
* Chromium, bun's install cache); the rest is what runs before that wrote
|
|
* into the folder itself.
|
|
*/
|
|
export const ComputerRunCacheEntries = [
|
|
".cache",
|
|
".npm/_logs",
|
|
".npm/_cacache",
|
|
".bun/install/cache",
|
|
] as const;
|
|
|
|
/**
|
|
* Python's bytecode folders, anywhere below a run folder: every script a
|
|
* bot imports makes one.
|
|
*/
|
|
export const ComputerBytecodeCacheDir = "__pycache__";
|
|
|
|
/**
|
|
* A browser profile a bot started itself, in its own folder, rather than
|
|
* the app's (which lives at `AppData.ComputerBrowserProfileDir`). It holds
|
|
* cookies like any profile, so only its caches go, never the folder.
|
|
*/
|
|
export const ComputerRunBrowserProfileDir = ".cobble-browser";
|
|
|
|
/**
|
|
* The folders inside a Chrome profile that only hold what Chrome downloads
|
|
* or builds again. Two of them alone were 729 MB of one install's 1009 MB
|
|
* profile, while what a profile is kept for (cookies, logins, site
|
|
* permissions, history, local storage, extensions) is a few MB.
|
|
*
|
|
* Keep alike `computer/agent/prune-profile-cache.ts`, which clears the
|
|
* same ones from inside the container on each start; this list is for the
|
|
* app's own daily prune and for a data archive, which both work on the
|
|
* data volume.
|
|
*/
|
|
export const BrowserProfileCacheDirs = [
|
|
"Cache",
|
|
"Code Cache",
|
|
"GPUCache",
|
|
"GPUPersistentCache",
|
|
"DawnGraphiteCache",
|
|
"DawnWebGPUCache",
|
|
"GraphiteDawnCache",
|
|
"GrShaderCache",
|
|
"ShaderCache",
|
|
"Service Worker",
|
|
"CertificateRevocation",
|
|
"component_crx_cache",
|
|
"WasmTtsEngine",
|
|
"OnDeviceHeadSuggestModel",
|
|
"ActorSafetyLists",
|
|
"OptimizationHints",
|
|
"OptimizationGuideModelsManifest",
|
|
"optimization_guide_model_store",
|
|
"PKIMetadata",
|
|
"hyphen-data",
|
|
"ZxcvbnData",
|
|
"Subresource Filter",
|
|
"segmentation_platform",
|
|
"Crowd Deny",
|
|
"SafetyTips",
|
|
"BrowserMetrics-spare.pma",
|
|
] as const; |