create-egregore 0.19.15 → 0.19.17
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/assets/egregore-launcher.js +55 -6
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// egregore-launcher-version: 0.19.
|
|
2
|
+
// egregore-launcher-version: 0.19.17
|
|
3
3
|
//
|
|
4
4
|
// egregore — launch and browse Egregore instances from your terminal.
|
|
5
5
|
// Installed by create-egregore. Reads ~/.egregore/instances.json.
|
|
@@ -33,7 +33,7 @@ const crypto = require("node:crypto");
|
|
|
33
33
|
const { spawnSync, spawn } = require("node:child_process");
|
|
34
34
|
const readline = require("node:readline");
|
|
35
35
|
|
|
36
|
-
const VERSION = "0.19.
|
|
36
|
+
const VERSION = "0.19.17";
|
|
37
37
|
const REGISTRY = path.join(os.homedir(), ".egregore", "instances.json");
|
|
38
38
|
const DEFAULT_FILE = path.join(os.homedir(), ".egregore", "default");
|
|
39
39
|
const UPDATE_CACHE_FILE = path.join(os.homedir(), ".egregore", "update-check.json");
|
|
@@ -41,8 +41,9 @@ const PUBLIC_NPX_PACKAGE = "create-egregore";
|
|
|
41
41
|
const UPDATE_REGISTRY_URL =
|
|
42
42
|
process.env.EGREGORE_UPDATE_REGISTRY_URL ||
|
|
43
43
|
`https://registry.npmjs.org/${PUBLIC_NPX_PACKAGE}/latest`;
|
|
44
|
-
const
|
|
45
|
-
const
|
|
44
|
+
const UPDATE_AVAILABLE_CACHE_TTL_MS = 6 * 60 * 60 * 1000;
|
|
45
|
+
const UPDATE_CURRENT_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
46
|
+
const UPDATE_FAILURE_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
46
47
|
const UPDATE_CHECK_TIMEOUT_MS = 1500;
|
|
47
48
|
const CONNECT_API_URL = (
|
|
48
49
|
process.env.EGREGORE_CONNECT_API_URL ||
|
|
@@ -1048,10 +1049,16 @@ function readUpdateCache() {
|
|
|
1048
1049
|
const cache = JSON.parse(fs.readFileSync(UPDATE_CACHE_FILE, "utf-8"));
|
|
1049
1050
|
if (!cache || !cache.checked_at) return null;
|
|
1050
1051
|
const age = Date.now() - new Date(cache.checked_at).getTime();
|
|
1051
|
-
const
|
|
1052
|
+
const cachedUpdate = cache.latest ? cliUpdateState(cache.latest) : null;
|
|
1053
|
+
if (cache.latest && !cachedUpdate) return null;
|
|
1054
|
+
const ttl = !cache.latest
|
|
1055
|
+
? UPDATE_FAILURE_CACHE_TTL_MS
|
|
1056
|
+
: cachedUpdate.available
|
|
1057
|
+
? UPDATE_AVAILABLE_CACHE_TTL_MS
|
|
1058
|
+
: UPDATE_CURRENT_CACHE_TTL_MS;
|
|
1052
1059
|
if (!Number.isFinite(age) || age < 0 || age > ttl) return null;
|
|
1053
1060
|
if (!cache.latest) return { current: VERSION, latest: null, available: false };
|
|
1054
|
-
return
|
|
1061
|
+
return cachedUpdate;
|
|
1055
1062
|
} catch {
|
|
1056
1063
|
return null;
|
|
1057
1064
|
}
|
|
@@ -1241,6 +1248,43 @@ function sleep(ms) {
|
|
|
1241
1248
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1242
1249
|
}
|
|
1243
1250
|
|
|
1251
|
+
function backfillCount(summary, key) {
|
|
1252
|
+
const value = Number(summary?.[key]);
|
|
1253
|
+
return Number.isInteger(value) && value >= 0 ? value : null;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
function backfillCountLabel(count, singular, plural) {
|
|
1257
|
+
return `${count} ${count === 1 ? singular : plural}`;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
function backfillSummaryLines(summary) {
|
|
1261
|
+
const sessions = backfillCount(summary, "sessions");
|
|
1262
|
+
const artifacts = backfillCount(summary, "artifacts");
|
|
1263
|
+
const quests = backfillCount(summary, "quests");
|
|
1264
|
+
const resolved = backfillCount(summary, "resolved");
|
|
1265
|
+
const ingestManifests = backfillCount(summary, "ingest_manifests");
|
|
1266
|
+
const lines = [];
|
|
1267
|
+
|
|
1268
|
+
if (sessions !== null && artifacts !== null && quests !== null) {
|
|
1269
|
+
if (sessions + artifacts + quests === 0) {
|
|
1270
|
+
lines.push("Graph already contained all sessions, artifacts, and quests");
|
|
1271
|
+
} else {
|
|
1272
|
+
lines.push(`Added ${[
|
|
1273
|
+
backfillCountLabel(sessions, "session", "sessions"),
|
|
1274
|
+
backfillCountLabel(artifacts, "artifact", "artifacts"),
|
|
1275
|
+
backfillCountLabel(quests, "quest", "quests"),
|
|
1276
|
+
].join(" · ")}`);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
if (ingestManifests > 0) {
|
|
1280
|
+
lines.push(`Replayed ${backfillCountLabel(ingestManifests, "ingest manifest", "ingest manifests")}`);
|
|
1281
|
+
}
|
|
1282
|
+
if (resolved > 0) {
|
|
1283
|
+
lines.push(`Resolved ${backfillCountLabel(resolved, "handoff", "handoffs")}`);
|
|
1284
|
+
}
|
|
1285
|
+
return lines;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1244
1288
|
async function cmdConnect(args) {
|
|
1245
1289
|
const registry = readRegistry();
|
|
1246
1290
|
if (registry.length === 0) die("no egregores installed yet.\n run: npx -y create-egregore@latest");
|
|
@@ -1405,6 +1449,8 @@ async function cmdConnect(args) {
|
|
|
1405
1449
|
if (!fs.existsSync(syncScript)) {
|
|
1406
1450
|
die("bin/sync-graph.sh is missing. Update the installed Egregore version, then run egregore connect again.");
|
|
1407
1451
|
}
|
|
1452
|
+
console.log(` [5/5] ${CYAN}◦${RESET} Projecting existing memory into the graph…`);
|
|
1453
|
+
console.log(` ${DIM}Scanning sessions, artifacts, quests, and ingest history${RESET}`);
|
|
1408
1454
|
const sync = spawnSync("bash", [syncScript], {
|
|
1409
1455
|
cwd: inst.path,
|
|
1410
1456
|
encoding: "utf-8",
|
|
@@ -1438,6 +1484,9 @@ async function cmdConnect(args) {
|
|
|
1438
1484
|
backfill_summary: backfillSummary,
|
|
1439
1485
|
});
|
|
1440
1486
|
console.log(` [5/5] ${GREEN}✓${RESET} Existing memory projected into the graph`);
|
|
1487
|
+
for (const line of backfillSummaryLines(backfillSummary)) {
|
|
1488
|
+
console.log(` ${DIM}${line}${RESET}`);
|
|
1489
|
+
}
|
|
1441
1490
|
console.log("");
|
|
1442
1491
|
console.log(` ${GREEN}✓${RESET} ${BOLD}${inst.slug}${RESET} is connected. Local files remain the source of truth.`);
|
|
1443
1492
|
console.log("");
|
package/package.json
CHANGED