Repository navigation
Commit 91f2428
refactor(usage): usage readers use Effect FileSystem and SqlClient
The Antigravity, OpenCode and Cursor account usage readers were Node
code wrapped in Effect.promise: node:fs/promises, node:sqlite
DatabaseSync, setImmediate yields every 256 rows, and a file-wide
nodeBuiltinImport:off. They are now Effect functions.
- Discovery, reads and walks go through FileSystem and Path. Symlinks
are detected with readLink, so they are still never followed.
- Databases open through @t3tools/shared/nodeSqliteClient with
readonly: true, one scoped client per file, and keep the
busy_timeout = 100 pragma. Antigravity still reads in one
transaction.
- Yields use Effect.yieldNow at the same points.
- Cursor reads credentials with FileSystem, hashes with effect/Crypto,
and decodes the JWT with Base64Url. Pages read ahead run as scoped
fibers, so interruption replaces the AbortController. Each page and
the whole read keep their 10 s and 60 s budgets. CursorAccountReader
passes the Keychain as an Effect instead of a promise callback.
- The tests are it.effect with scoped temp dirs and seed SQLite through
the shared client.
One Node import remains in the Antigravity reader and its test:
node:fs/promises stat, because Effect's File.Info has no ctime, and the
cache fingerprint (size:mtimeMs:ctimeMs) depends on it.
apps/server/src/usage/usageTranscriptReader.ts, the stream-json engine
that predates this stack, is still Node-based.
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent f99db8a commit 91f2428
8 files changed
Lines changed: 1280 additions & 968 deletions
File tree
- apps/server/src/provider/Drivers
- packages
- provider-cursor/src/server
- provider-opencode/src/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
0 commit comments