pi-mega-compact 0.15.0 → 0.15.1
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.
|
@@ -5,11 +5,17 @@
|
|
|
5
5
|
* active pi session may be running in a different repo. This module queries
|
|
6
6
|
* the repo registry to find the most recently active repo's dashboard.json,
|
|
7
7
|
* so the Overview always shows live data from the repo pi is actually running
|
|
8
|
-
* in
|
|
8
|
+
* in.
|
|
9
|
+
*
|
|
10
|
+
* The launch stateDir is a candidate like any other (NOT excluded): when
|
|
11
|
+
* `/dashboard` was run in the repo you are still coding in, the launch dir
|
|
12
|
+
* IS the most-recently-active repo and must win. Excluding it would serve a
|
|
13
|
+
* stale other-repo snapshot, surfacing a phantom 0% "this session" gauge
|
|
14
|
+
* plus a duplicate live-session gauge.
|
|
9
15
|
*
|
|
10
16
|
* Resolution order:
|
|
11
|
-
* 1. Most recently seen repo (by last_seen in repo_registry
|
|
12
|
-
* dashboard.json exists and has a non-null updatedAt
|
|
17
|
+
* 1. Most recently seen repo (by last_seen in repo_registry, launch dir
|
|
18
|
+
* included) whose dashboard.json exists and has a non-null updatedAt
|
|
13
19
|
* 2. The static launch stateDir's dashboard.json (original behavior)
|
|
14
20
|
*/
|
|
15
21
|
import { existsSync } from "node:fs";
|
|
@@ -20,10 +26,16 @@ import { getIndexDir } from "./index-reader.js";
|
|
|
20
26
|
const require = createRequire(import.meta.url);
|
|
21
27
|
/**
|
|
22
28
|
* Find the most recently active repo's stateDir by scanning the repo registry
|
|
23
|
-
* for
|
|
24
|
-
* if no suitable repo is found.
|
|
29
|
+
* for the repo with the highest last_seen whose dashboard.json exists and has
|
|
30
|
+
* a non-null updatedAt. Returns null if no suitable repo is found.
|
|
31
|
+
*
|
|
32
|
+
* The launch stateDir is NOT excluded: if it is itself the most-recently-active
|
|
33
|
+
* repo (the common case — `/dashboard` was run in the repo you are still
|
|
34
|
+
* coding in), its live dashboard.json must be served. Excluding it would cause
|
|
35
|
+
* a stale *other*-repo snapshot to win, producing a phantom 0% "this session"
|
|
36
|
+
* gauge + a duplicate live-session gauge.
|
|
25
37
|
*/
|
|
26
|
-
function mostRecentRepoStateDir(
|
|
38
|
+
function mostRecentRepoStateDir(_staticStateDir) {
|
|
27
39
|
const indexPath = join(getIndexDir(), "index.sqlite");
|
|
28
40
|
if (!existsSync(indexPath))
|
|
29
41
|
return null;
|
|
@@ -33,9 +45,9 @@ function mostRecentRepoStateDir(staticStateDir) {
|
|
|
33
45
|
db = new DatabaseSync(indexPath, { readOnly: true });
|
|
34
46
|
const rows = db
|
|
35
47
|
.prepare(`SELECT state_dir, last_seen FROM repo_registry
|
|
36
|
-
WHERE state_dir IS NOT NULL AND
|
|
48
|
+
WHERE state_dir IS NOT NULL AND last_seen IS NOT NULL
|
|
37
49
|
ORDER BY last_seen DESC`)
|
|
38
|
-
.all(
|
|
50
|
+
.all();
|
|
39
51
|
for (const r of rows) {
|
|
40
52
|
const dashPath = join(r.state_dir, "dashboard.json");
|
|
41
53
|
if (!existsSync(dashPath))
|
|
@@ -1651,9 +1651,6 @@
|
|
|
1651
1651
|
"arm"
|
|
1652
1652
|
],
|
|
1653
1653
|
"dev": true,
|
|
1654
|
-
"libc": [
|
|
1655
|
-
"glibc"
|
|
1656
|
-
],
|
|
1657
1654
|
"license": "MIT",
|
|
1658
1655
|
"optional": true,
|
|
1659
1656
|
"os": [
|
|
@@ -1668,9 +1665,6 @@
|
|
|
1668
1665
|
"arm"
|
|
1669
1666
|
],
|
|
1670
1667
|
"dev": true,
|
|
1671
|
-
"libc": [
|
|
1672
|
-
"musl"
|
|
1673
|
-
],
|
|
1674
1668
|
"license": "MIT",
|
|
1675
1669
|
"optional": true,
|
|
1676
1670
|
"os": [
|
|
@@ -1685,9 +1679,6 @@
|
|
|
1685
1679
|
"arm64"
|
|
1686
1680
|
],
|
|
1687
1681
|
"dev": true,
|
|
1688
|
-
"libc": [
|
|
1689
|
-
"glibc"
|
|
1690
|
-
],
|
|
1691
1682
|
"license": "MIT",
|
|
1692
1683
|
"optional": true,
|
|
1693
1684
|
"os": [
|
|
@@ -1702,9 +1693,6 @@
|
|
|
1702
1693
|
"arm64"
|
|
1703
1694
|
],
|
|
1704
1695
|
"dev": true,
|
|
1705
|
-
"libc": [
|
|
1706
|
-
"musl"
|
|
1707
|
-
],
|
|
1708
1696
|
"license": "MIT",
|
|
1709
1697
|
"optional": true,
|
|
1710
1698
|
"os": [
|
|
@@ -1719,9 +1707,6 @@
|
|
|
1719
1707
|
"loong64"
|
|
1720
1708
|
],
|
|
1721
1709
|
"dev": true,
|
|
1722
|
-
"libc": [
|
|
1723
|
-
"glibc"
|
|
1724
|
-
],
|
|
1725
1710
|
"license": "MIT",
|
|
1726
1711
|
"optional": true,
|
|
1727
1712
|
"os": [
|
|
@@ -1736,9 +1721,6 @@
|
|
|
1736
1721
|
"loong64"
|
|
1737
1722
|
],
|
|
1738
1723
|
"dev": true,
|
|
1739
|
-
"libc": [
|
|
1740
|
-
"musl"
|
|
1741
|
-
],
|
|
1742
1724
|
"license": "MIT",
|
|
1743
1725
|
"optional": true,
|
|
1744
1726
|
"os": [
|
|
@@ -1753,9 +1735,6 @@
|
|
|
1753
1735
|
"ppc64"
|
|
1754
1736
|
],
|
|
1755
1737
|
"dev": true,
|
|
1756
|
-
"libc": [
|
|
1757
|
-
"glibc"
|
|
1758
|
-
],
|
|
1759
1738
|
"license": "MIT",
|
|
1760
1739
|
"optional": true,
|
|
1761
1740
|
"os": [
|
|
@@ -1770,9 +1749,6 @@
|
|
|
1770
1749
|
"ppc64"
|
|
1771
1750
|
],
|
|
1772
1751
|
"dev": true,
|
|
1773
|
-
"libc": [
|
|
1774
|
-
"musl"
|
|
1775
|
-
],
|
|
1776
1752
|
"license": "MIT",
|
|
1777
1753
|
"optional": true,
|
|
1778
1754
|
"os": [
|
|
@@ -1787,9 +1763,6 @@
|
|
|
1787
1763
|
"riscv64"
|
|
1788
1764
|
],
|
|
1789
1765
|
"dev": true,
|
|
1790
|
-
"libc": [
|
|
1791
|
-
"glibc"
|
|
1792
|
-
],
|
|
1793
1766
|
"license": "MIT",
|
|
1794
1767
|
"optional": true,
|
|
1795
1768
|
"os": [
|
|
@@ -1804,9 +1777,6 @@
|
|
|
1804
1777
|
"riscv64"
|
|
1805
1778
|
],
|
|
1806
1779
|
"dev": true,
|
|
1807
|
-
"libc": [
|
|
1808
|
-
"musl"
|
|
1809
|
-
],
|
|
1810
1780
|
"license": "MIT",
|
|
1811
1781
|
"optional": true,
|
|
1812
1782
|
"os": [
|
|
@@ -1821,9 +1791,6 @@
|
|
|
1821
1791
|
"s390x"
|
|
1822
1792
|
],
|
|
1823
1793
|
"dev": true,
|
|
1824
|
-
"libc": [
|
|
1825
|
-
"glibc"
|
|
1826
|
-
],
|
|
1827
1794
|
"license": "MIT",
|
|
1828
1795
|
"optional": true,
|
|
1829
1796
|
"os": [
|
|
@@ -1838,9 +1805,6 @@
|
|
|
1838
1805
|
"x64"
|
|
1839
1806
|
],
|
|
1840
1807
|
"dev": true,
|
|
1841
|
-
"libc": [
|
|
1842
|
-
"glibc"
|
|
1843
|
-
],
|
|
1844
1808
|
"license": "MIT",
|
|
1845
1809
|
"optional": true,
|
|
1846
1810
|
"os": [
|
|
@@ -1855,9 +1819,6 @@
|
|
|
1855
1819
|
"x64"
|
|
1856
1820
|
],
|
|
1857
1821
|
"dev": true,
|
|
1858
|
-
"libc": [
|
|
1859
|
-
"musl"
|
|
1860
|
-
],
|
|
1861
1822
|
"license": "MIT",
|
|
1862
1823
|
"optional": true,
|
|
1863
1824
|
"os": [
|
|
@@ -5,11 +5,17 @@
|
|
|
5
5
|
* active pi session may be running in a different repo. This module queries
|
|
6
6
|
* the repo registry to find the most recently active repo's dashboard.json,
|
|
7
7
|
* so the Overview always shows live data from the repo pi is actually running
|
|
8
|
-
* in
|
|
8
|
+
* in.
|
|
9
|
+
*
|
|
10
|
+
* The launch stateDir is a candidate like any other (NOT excluded): when
|
|
11
|
+
* `/dashboard` was run in the repo you are still coding in, the launch dir
|
|
12
|
+
* IS the most-recently-active repo and must win. Excluding it would serve a
|
|
13
|
+
* stale other-repo snapshot, surfacing a phantom 0% "this session" gauge
|
|
14
|
+
* plus a duplicate live-session gauge.
|
|
9
15
|
*
|
|
10
16
|
* Resolution order:
|
|
11
|
-
* 1. Most recently seen repo (by last_seen in repo_registry
|
|
12
|
-
* dashboard.json exists and has a non-null updatedAt
|
|
17
|
+
* 1. Most recently seen repo (by last_seen in repo_registry, launch dir
|
|
18
|
+
* included) whose dashboard.json exists and has a non-null updatedAt
|
|
13
19
|
* 2. The static launch stateDir's dashboard.json (original behavior)
|
|
14
20
|
*/
|
|
15
21
|
|
|
@@ -35,23 +41,30 @@ interface RepoRegistryRow {
|
|
|
35
41
|
|
|
36
42
|
/**
|
|
37
43
|
* Find the most recently active repo's stateDir by scanning the repo registry
|
|
38
|
-
* for
|
|
39
|
-
* if no suitable repo is found.
|
|
44
|
+
* for the repo with the highest last_seen whose dashboard.json exists and has
|
|
45
|
+
* a non-null updatedAt. Returns null if no suitable repo is found.
|
|
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.
|
|
40
52
|
*/
|
|
41
|
-
function mostRecentRepoStateDir(
|
|
53
|
+
function mostRecentRepoStateDir(_staticStateDir: string): string | null {
|
|
42
54
|
const indexPath = join(getIndexDir(), "index.sqlite");
|
|
43
55
|
if (!existsSync(indexPath)) return null;
|
|
44
56
|
let db;
|
|
45
57
|
try {
|
|
46
|
-
const { DatabaseSync } =
|
|
58
|
+
const { DatabaseSync } =
|
|
59
|
+
require("node:sqlite") as typeof import("node:sqlite");
|
|
47
60
|
db = new DatabaseSync(indexPath, { readOnly: true });
|
|
48
61
|
const rows = db
|
|
49
62
|
.prepare(
|
|
50
63
|
`SELECT state_dir, last_seen FROM repo_registry
|
|
51
|
-
WHERE state_dir IS NOT NULL AND
|
|
64
|
+
WHERE state_dir IS NOT NULL AND last_seen IS NOT NULL
|
|
52
65
|
ORDER BY last_seen DESC`,
|
|
53
66
|
)
|
|
54
|
-
.all(
|
|
67
|
+
.all() as unknown as RepoRegistryRow[];
|
|
55
68
|
for (const r of rows) {
|
|
56
69
|
const dashPath = join(r.state_dir, "dashboard.json");
|
|
57
70
|
if (!existsSync(dashPath)) continue;
|
|
@@ -95,4 +108,3 @@ export function resolveSnapshot(
|
|
|
95
108
|
stateDir: staticStateDir,
|
|
96
109
|
};
|
|
97
110
|
}
|
|
98
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mega-compact",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
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",
|