opencode-statboard 2.8.1 → 2.8.2
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/AGENTS.md +1 -0
- package/package.json +1 -1
- package/server.js +5 -5
package/AGENTS.md
CHANGED
|
@@ -32,6 +32,7 @@ The message table is ~1GB of JSON; scanning it with `json_extract` costs **43s**
|
|
|
32
32
|
Rules that keep it fast:
|
|
33
33
|
|
|
34
34
|
- **Nothing on the request path may run a full scan.** `toolCountsFor()` returns the worker/cached counts while a worker round is in flight; only if the worker is unavailable does it fall back to an inline scan.
|
|
35
|
+
- **The bundle cache is keyed on the DB PATH only.** Keying it on size/mtime looked safer but the live DB grows on every message, so the fingerprint changed constantly and the "instant" cold start silently degraded back to a 6–7s rebuild on a busy machine.
|
|
35
36
|
- **Reports refuse to build without a bundle** (`refreshReport` returns `ready:false`), otherwise an all-zero report sits in the 10-minute cache and blanks the dashboard.
|
|
36
37
|
- The bundle is persisted with its tool counts, so a cold start paints complete numbers before the first worker round lands. `settleBundle` repaints and prewarms the default scope report.
|
|
37
38
|
- The frontend `warmOtherScopes()` fetches the scopes the user is NOT looking at, on idle, so a scope click is an in-memory swap.
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -585,13 +585,13 @@ async function buildAttrBundle(now) {
|
|
|
585
585
|
// serves every request while a fresh one is rebuilt in the background.
|
|
586
586
|
const BUNDLE_FILE = path.join(__dirname, '.attr-bundle.json');
|
|
587
587
|
const BUNDLE_SAVE_MS = 60000; // don't hammer the disk while chatting
|
|
588
|
-
// Cache is bound to the
|
|
588
|
+
// Cache is bound to the DATABASE PATH it was computed from, so pointing
|
|
589
589
|
// OPENCODE_DATA at another DB (tests, a restored copy) never reuses it.
|
|
590
|
+
// Deliberately NOT keyed on size/mtime: the live DB grows on every message,
|
|
591
|
+
// so a stat-based fingerprint invalidated the cache on every restart and
|
|
592
|
+
// silently turned the instant cold start back into a full 6-7s rebuild.
|
|
590
593
|
function dbFingerprint() {
|
|
591
|
-
|
|
592
|
-
const st = fs.statSync(BACKUP_SRC);
|
|
593
|
-
return `${BACKUP_SRC}|${st.size}|${Math.round(st.mtimeMs)}`;
|
|
594
|
-
} catch (_) { return BACKUP_SRC; }
|
|
594
|
+
return BACKUP_SRC;
|
|
595
595
|
}
|
|
596
596
|
function serializeBundle(a, tools) {
|
|
597
597
|
// MUST NOT mutate: the caller serializes the LIVE bundle, and swapping a
|