pi-mega-compact 0.15.3 → 0.15.4
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/dist/extensions/dashboard-server/resolve-snapshot.js +38 -28
- package/extensions/dashboard-client/dist/assets/{AreaChart-CMri0vM1.js → AreaChart-CrmTcE7w.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-CMri0vM1.js.map → AreaChart-CrmTcE7w.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-BbkxxSkM.js → BarChart-Cf8DTaXS.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-BbkxxSkM.js.map → BarChart-Cf8DTaXS.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-CiHS6tod.js → CacheTab-Ce0MES6p.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-CiHS6tod.js.map → CacheTab-Ce0MES6p.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-NnD7EpRm.js → EventsTab-DbaUuA58.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-NnD7EpRm.js.map → EventsTab-DbaUuA58.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-Dlt7WTh7.js → HealthTab-BmEXkcfL.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-Dlt7WTh7.js.map → HealthTab-BmEXkcfL.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DgKBZmdD.js → MaintenanceTab-n2JQrMy7.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DgKBZmdD.js.map → MaintenanceTab-n2JQrMy7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-SwTOzuZW.js → MemoryMapTab-Dvu7vkOm.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-SwTOzuZW.js.map → MemoryMapTab-Dvu7vkOm.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-CWEgBTx0.js → MetricsTab-Q0g32AmP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-CWEgBTx0.js.map → MetricsTab-Q0g32AmP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-B0YDSSMH.js → OverviewTab-iKiEcOLL.js} +4 -4
- package/extensions/dashboard-client/dist/assets/OverviewTab-iKiEcOLL.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{ReposTab-CMKZ_a4B.js → ReposTab-DWpnv77y.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-CMKZ_a4B.js.map → ReposTab-DWpnv77y.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-D2cCDKB3.js → SessionsTab-G0YxR1vG.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-D2cCDKB3.js.map → SessionsTab-G0YxR1vG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-HUAG7xDf.js → SetupTab-C-y6H-F-.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-HUAG7xDf.js.map → SetupTab-C-y6H-F-.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-NFCsyJhB.js → TimeSavedCard-1_LCFiJp.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-NFCsyJhB.js.map → TimeSavedCard-1_LCFiJp.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-BY7_AZaG.js → TurnsTab-pqOkjE4L.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-BY7_AZaG.js.map → TurnsTab-pqOkjE4L.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{WikiTab-MbmjqKVQ.js → WikiTab-99sKE4nB.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-MbmjqKVQ.js.map → WikiTab-99sKE4nB.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-CoVmU9Vr.js → button-YcV2VQEP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-CoVmU9Vr.js.map → button-YcV2VQEP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-Cp9Hpdoo.js → card-Bwxzo50p.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-Cp9Hpdoo.js.map → card-Bwxzo50p.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CMM8OUO5.js → generateCategoricalChart-C6hlfMYG.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-CMM8OUO5.js.map → generateCategoricalChart-C6hlfMYG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-CRHmWnRi.js → index-DRa2d4TF.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-CRHmWnRi.js.map → index-DRa2d4TF.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{switch-jrYrJJYy.js → switch-rU-lor0v.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-jrYrJJYy.js.map → switch-rU-lor0v.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-DT1AN5wS.js → toggle-h-9B4w9X.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-DT1AN5wS.js.map → toggle-h-9B4w9X.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-rJH_Rx6K.js → useSSE-BxJORWx8.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-rJH_Rx6K.js.map → useSSE-BxJORWx8.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/components/SessionContextGauges.tsx +16 -9
- package/extensions/dashboard-client/src/tabs/OverviewTab.tsx +10 -13
- package/extensions/dashboard-server/resolve-snapshot.ts +39 -29
- package/package.json +1 -1
- package/extensions/dashboard-client/dist/assets/OverviewTab-B0YDSSMH.js.map +0 -1
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
* dashboard-server/resolve-snapshot.ts — dynamic per-repo snapshot resolver.
|
|
3
3
|
*
|
|
4
4
|
* The dashboard server is launched with a single static stateDir, but the
|
|
5
|
-
* active pi session may be running in a different repo. This module
|
|
6
|
-
*
|
|
7
|
-
* so the Overview always shows live data from the repo pi is actually running
|
|
8
|
-
* in.
|
|
5
|
+
* active pi session may be running in a different repo. This module resolves
|
|
6
|
+
* which repo's dashboard.json to serve as the "this session" snapshot.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* 2.
|
|
8
|
+
* Resolution order (the launch dir is the OWNer of this dashboard):
|
|
9
|
+
* 1. The launch stateDir's OWN dashboard.json — the pi process that launched
|
|
10
|
+
* this dashboard server is the session you are coding in, so its snapshot
|
|
11
|
+
* is "this session" by definition. This must win over any other repo
|
|
12
|
+
* regardless of last_seen freshness; otherwise a more-recently-active
|
|
13
|
+
* OTHER repo steals the "this session" slot and your actual session gets
|
|
14
|
+
* demoted to an "other" gauge, producing the exact duplicate-gauge bug
|
|
15
|
+
* (this session + pi-<launchrepo> both showing the same active session
|
|
16
|
+
* split across two boxes).
|
|
17
|
+
* 2. Most recently seen OTHER repo (by last_seen in repo_registry) whose
|
|
18
|
+
* dashboard.json exists and has a non-null updatedAt — fallback for when
|
|
19
|
+
* the launch dir has no live snapshot yet (e.g. dashboard launched before
|
|
20
|
+
* any compaction wrote dashboard.json).
|
|
21
|
+
* 3. The static launch stateDir's dashboard.json (original behavior).
|
|
20
22
|
*/
|
|
21
23
|
|
|
22
24
|
import { existsSync } from "node:fs";
|
|
@@ -40,17 +42,12 @@ interface RepoRegistryRow {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
|
-
* Find the most recently active repo's stateDir
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* The launch stateDir is NOT excluded: if it is itself the most-recently-active
|
|
48
|
-
* repo (the common case — `/dashboard` was run in the repo you are still
|
|
49
|
-
* coding in), its live dashboard.json must be served. Excluding it would cause
|
|
50
|
-
* a stale *other*-repo snapshot to win, producing a phantom 0% "this session"
|
|
51
|
-
* gauge + a duplicate live-session gauge.
|
|
45
|
+
* Find the most recently active OTHER repo's stateDir (excluding the launch
|
|
46
|
+
* dir, which is handled by the caller) by scanning the repo registry for the
|
|
47
|
+
* repo with the highest last_seen whose dashboard.json exists and has a
|
|
48
|
+
* non-null updatedAt. Returns null if no suitable repo is found.
|
|
52
49
|
*/
|
|
53
|
-
function
|
|
50
|
+
function mostRecentOtherRepoStateDir(launchStateDir: string): string | null {
|
|
54
51
|
const indexPath = join(getIndexDir(), "index.sqlite");
|
|
55
52
|
if (!existsSync(indexPath)) return null;
|
|
56
53
|
let db;
|
|
@@ -58,13 +55,14 @@ function mostRecentRepoStateDir(_staticStateDir: string): string | null {
|
|
|
58
55
|
const { DatabaseSync } =
|
|
59
56
|
require("node:sqlite") as typeof import("node:sqlite");
|
|
60
57
|
db = new DatabaseSync(indexPath, { readOnly: true });
|
|
61
|
-
|
|
58
|
+
const rows = db
|
|
62
59
|
.prepare(
|
|
63
60
|
`SELECT state_dir, last_seen FROM repo_registry
|
|
64
61
|
WHERE state_dir IS NOT NULL AND last_seen IS NOT NULL
|
|
62
|
+
AND state_dir != @launch
|
|
65
63
|
ORDER BY last_seen DESC`,
|
|
66
64
|
)
|
|
67
|
-
.all() as unknown as RepoRegistryRow[];
|
|
65
|
+
.all({ launch: launchStateDir }) as unknown as RepoRegistryRow[];
|
|
68
66
|
for (const r of rows) {
|
|
69
67
|
const dashPath = join(r.state_dir, "dashboard.json");
|
|
70
68
|
if (!existsSync(dashPath)) continue;
|
|
@@ -93,8 +91,20 @@ export function resolveSnapshot(
|
|
|
93
91
|
staticSnapshotPath: string,
|
|
94
92
|
staticStateDir: string,
|
|
95
93
|
): ResolvedSnapshot {
|
|
96
|
-
//
|
|
97
|
-
|
|
94
|
+
// 1. The launch dir's OWN snapshot is "this session" — the pi process that
|
|
95
|
+
// launched this dashboard is the session you are coding in. It wins over
|
|
96
|
+
// any other repo regardless of last_seen, so a more-recently-active OTHER
|
|
97
|
+
// repo can't steal the "this session" slot and demote your actual session
|
|
98
|
+
// to a duplicate "other" gauge.
|
|
99
|
+
if (existsSync(staticSnapshotPath)) {
|
|
100
|
+
const launchSnap = readSnapshot(staticSnapshotPath);
|
|
101
|
+
if (launchSnap.updatedAt) {
|
|
102
|
+
return { snapshot: launchSnap, stateDir: staticStateDir };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// 2. Fall back to the most recently active OTHER repo (launch dir had no
|
|
106
|
+
// live snapshot yet).
|
|
107
|
+
const activeDir = mostRecentOtherRepoStateDir(staticStateDir);
|
|
98
108
|
if (activeDir) {
|
|
99
109
|
const activePath = join(activeDir, "dashboard.json");
|
|
100
110
|
const snap = readSnapshot(activePath);
|
|
@@ -102,7 +112,7 @@ export function resolveSnapshot(
|
|
|
102
112
|
return { snapshot: snap, stateDir: activeDir };
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
|
-
//
|
|
115
|
+
// 3. Last resort: the static launch path (even if stale).
|
|
106
116
|
return {
|
|
107
117
|
snapshot: readSnapshot(staticSnapshotPath),
|
|
108
118
|
stateDir: staticStateDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mega-compact",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"description": "Layered, local, vector-backed context compressor for pi — supersede/collapse/cluster compaction with deduped inline recall.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD-3-Clause",
|