Commit Graph

10 Commits

Author SHA1 Message Date
Zoltan Kochan
08feef90a5 refactor: always send projects array to agent, remove legacy single-project fields 2026-04-16 22:40:47 +02:00
Zoltan Kochan
62d43ced56 refactor: always send projects array to agent, remove legacy single-project fields 2026-04-16 22:40:46 +02:00
Zoltan Kochan
0be4170c9c feat: support workspaces with multiple projects in agent install 2026-04-16 22:40:46 +02:00
Zoltan Kochan
afc903ea63 fix: use fullMetadata on server so minimumReleaseAge can use cached time data 2026-04-16 22:40:45 +02:00
Zoltan Kochan
7932ee59a2 feat: pass minimumReleaseAge from client to agent server
The resolver can skip npm registry requests when cached metadata
satisfies the minimum release age constraint.
2026-04-16 22:40:45 +02:00
Zoltan Kochan
4837abedc9 perf: gzip entire /v1/files stream instead of per-file compression
Pipe the whole response through createGzip(level 1) on the server,
createGunzip on the client. Better compression ratio (cross-file
context), simpler code (no per-file gzip flag), and one decompress
pipe instead of thousands of gunzipSync calls.

274MB uncompressed → ~80MB over the wire. Negligible overhead on
localhost, significant savings on remote servers.
2026-04-16 22:40:45 +02:00
Zoltan Kochan
169e82bb19 perf: serve /v1/files from SQLite file store (consistent cold cache performance) 2026-04-16 22:40:44 +02:00
Zoltan Kochan
b4f5c88bc7 fix: correct I line key parsing and add WAL checkpoint
Two bugs that caused headless install to re-download from npm:

1. Client parsed I line key incorrectly: the key format is
   "integrity\tpkgId\tbase64" but the parser split at the first tab,
   giving only the integrity hash as the key. Fixed to split at the
   last tab so key = "integrity\tpkgId".

2. After writing index entries, the WAL wasn't checkpointed. Other
   SQLite connections (in worker threads) used stale WAL indexes.
   Added StoreIndex.checkpoint() which runs PRAGMA wal_checkpoint.

Also removed gzip from /v1/files streaming (was causing corrupt
header errors) and removed debug logging.
2026-04-16 22:40:44 +02:00
Zoltan Kochan
c97aca1627 fix: emit I lines only from diff (correct depPath-based keys), not from wrapper 2026-04-16 22:40:44 +02:00
Zoltan Kochan
3b6cc772c6 feat: pnpm agent — server-side resolution for faster installs
Add an opt-in pnpm agent server that resolves dependencies server-side
and streams only the files missing from the client's store.

Server (@pnpm/agent.server):
- Multi-process HTTP server (Node.js cluster, 9 workers)
- SQLite-backed metadata cache — resolution in ~1s vs ~3.4s with .jsonl
- Streaming NDJSON /v1/install — file digests emitted as packages resolve
- Gzip-compressed streaming /v1/files — no buffering on server or worker
- Binary protocol with server-provided digests (no client rehashing)

Client (@pnpm/agent.client):
- Streaming NDJSON parser dispatches worker batches during resolution
- Worker-thread streaming HTTP + gzip decompress + CAFS writes
- Pre-packed msgpack store index entries written directly to SQLite
- Pipelined headless install via wrapped store controller

Config: `agent: "http://host:port"` in pnpm-workspace.yaml
2026-04-16 22:40:43 +02:00