omnius 1.0.596 → 1.0.597
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/index.js +5821 -4807
- package/dist/memory-maintenance-worker.js +88 -14
- package/dist/postinstall-daemon.cjs +5 -0
- package/dist/preinstall.cjs +8 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -1417,9 +1417,8 @@ var EpisodeStore = class {
|
|
|
1417
1417
|
});
|
|
1418
1418
|
scored.sort((a, b) => b.score - a.score);
|
|
1419
1419
|
const topK = scored.slice(0, limit);
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
updateStmt.run(now, episode.id);
|
|
1420
|
+
if (opts.recordRetrieval !== false) {
|
|
1421
|
+
this.recordRetrieved(topK.map((item) => item.episode), now);
|
|
1423
1422
|
}
|
|
1424
1423
|
return topK.map((s) => s.episode);
|
|
1425
1424
|
}
|
|
@@ -1427,30 +1426,105 @@ var EpisodeStore = class {
|
|
|
1427
1426
|
* Falls back to standard search if graph is unavailable or no entities found.
|
|
1428
1427
|
*/
|
|
1429
1428
|
searchWithPPR(query, opts = {}) {
|
|
1430
|
-
const standardResults = this.search(query, opts);
|
|
1431
1429
|
if (!this.graph || !query.query) {
|
|
1432
|
-
return
|
|
1430
|
+
return this.search(query, opts);
|
|
1433
1431
|
}
|
|
1432
|
+
const standardResults = this.search(query, { ...opts, recordRetrieval: false });
|
|
1434
1433
|
try {
|
|
1435
1434
|
const pprResult = retrieveByPPR(query.query, this.graph, this, {
|
|
1436
1435
|
damping: 0.5,
|
|
1437
1436
|
maxIterations: 50,
|
|
1438
1437
|
convergenceThreshold: 1e-6,
|
|
1439
|
-
topK: query.limit ?? 20
|
|
1438
|
+
topK: query.limit ?? 20,
|
|
1439
|
+
currentEmotionalState: opts.currentEmotionalState,
|
|
1440
|
+
influenceFor: opts.influenceFor ? (episodeId) => {
|
|
1441
|
+
const episode = this.get(episodeId);
|
|
1442
|
+
return episode ? opts.influenceFor(episode) : null;
|
|
1443
|
+
} : void 0,
|
|
1444
|
+
engagementWeight: opts.engagementWeight
|
|
1440
1445
|
});
|
|
1441
|
-
const
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1446
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
1447
|
+
const addCandidate = (episode, rank, pprScore = 0) => {
|
|
1448
|
+
if (!this.matchesQueryFilters(episode, query))
|
|
1449
|
+
return;
|
|
1450
|
+
const contribution = 1 / (60 + rank + 1);
|
|
1451
|
+
const existing = candidates.get(episode.id);
|
|
1452
|
+
if (existing) {
|
|
1453
|
+
existing.score += contribution;
|
|
1454
|
+
existing.sourceCount += 1;
|
|
1455
|
+
existing.bestPprScore = Math.max(existing.bestPprScore, pprScore);
|
|
1456
|
+
} else {
|
|
1457
|
+
candidates.set(episode.id, {
|
|
1458
|
+
episode,
|
|
1459
|
+
score: contribution,
|
|
1460
|
+
sourceCount: 1,
|
|
1461
|
+
bestPprScore: pprScore
|
|
1462
|
+
});
|
|
1447
1463
|
}
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1464
|
+
};
|
|
1465
|
+
standardResults.forEach((episode, rank) => addCandidate(episode, rank));
|
|
1466
|
+
pprResult.episodes.forEach(({ episode, pprScore }, rank) => {
|
|
1467
|
+
addCandidate(episode, rank, pprScore);
|
|
1468
|
+
});
|
|
1469
|
+
const limit = query.limit ?? 20;
|
|
1470
|
+
const merged = [...candidates.values()].sort((a, b) => b.score - a.score || b.sourceCount - a.sourceCount || b.bestPprScore - a.bestPprScore || b.episode.timestamp - a.episode.timestamp || a.episode.id.localeCompare(b.episode.id)).slice(0, limit).map((candidate) => candidate.episode);
|
|
1471
|
+
if (opts.recordRetrieval !== false)
|
|
1472
|
+
this.recordRetrieved(merged, Date.now());
|
|
1473
|
+
return merged;
|
|
1450
1474
|
} catch {
|
|
1475
|
+
if (opts.recordRetrieval !== false)
|
|
1476
|
+
this.recordRetrieved(standardResults, Date.now());
|
|
1451
1477
|
return standardResults;
|
|
1452
1478
|
}
|
|
1453
1479
|
}
|
|
1480
|
+
/** Apply every non-text relevance constraint to a graph candidate. */
|
|
1481
|
+
matchesQueryFilters(episode, query) {
|
|
1482
|
+
if (query.sessionId && episode.sessionId !== query.sessionId)
|
|
1483
|
+
return false;
|
|
1484
|
+
if (query.taskId && episode.taskId !== query.taskId)
|
|
1485
|
+
return false;
|
|
1486
|
+
if (query.toolName && episode.toolName !== query.toolName)
|
|
1487
|
+
return false;
|
|
1488
|
+
if (query.modality && episode.modality !== query.modality)
|
|
1489
|
+
return false;
|
|
1490
|
+
if (query.since !== void 0 && episode.timestamp < query.since)
|
|
1491
|
+
return false;
|
|
1492
|
+
if (query.until !== void 0 && episode.timestamp > query.until)
|
|
1493
|
+
return false;
|
|
1494
|
+
if (query.minImportance !== void 0 && episode.importance < query.minImportance)
|
|
1495
|
+
return false;
|
|
1496
|
+
const metadata = episode.metadata;
|
|
1497
|
+
if (query.metadataFilter) {
|
|
1498
|
+
if (!metadata)
|
|
1499
|
+
return false;
|
|
1500
|
+
for (const [key, value] of Object.entries(query.metadataFilter)) {
|
|
1501
|
+
if (metadata[key] !== value)
|
|
1502
|
+
return false;
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
if (query.soundClass && metadata?.["sound_class"] !== query.soundClass)
|
|
1506
|
+
return false;
|
|
1507
|
+
if (query.rmsRange) {
|
|
1508
|
+
const rms = metadata?.["rms_db"] ?? metadata?.["rmsDb"];
|
|
1509
|
+
if (typeof rms !== "number")
|
|
1510
|
+
return false;
|
|
1511
|
+
if (query.rmsRange.min !== void 0 && rms < query.rmsRange.min)
|
|
1512
|
+
return false;
|
|
1513
|
+
if (query.rmsRange.max !== void 0 && rms > query.rmsRange.max)
|
|
1514
|
+
return false;
|
|
1515
|
+
}
|
|
1516
|
+
return true;
|
|
1517
|
+
}
|
|
1518
|
+
recordRetrieved(episodes, timestamp) {
|
|
1519
|
+
if (episodes.length === 0)
|
|
1520
|
+
return;
|
|
1521
|
+
const updateStmt = this.db.prepare("UPDATE episodes SET strength = strength + 1, last_retrieved = ? WHERE id = ?");
|
|
1522
|
+
const updateAll = this.db.transaction(() => {
|
|
1523
|
+
for (const episode of episodes)
|
|
1524
|
+
updateStmt.run(timestamp, episode.id);
|
|
1525
|
+
});
|
|
1526
|
+
updateAll();
|
|
1527
|
+
}
|
|
1454
1528
|
/** Get a single episode by ID. */
|
|
1455
1529
|
get(id) {
|
|
1456
1530
|
const row = this.db.prepare("SELECT * FROM episodes WHERE id = ?").get(id);
|
|
@@ -930,6 +930,11 @@ function main() {
|
|
|
930
930
|
progress(4, INSTALL_STEPS, "Ensuring local REST key");
|
|
931
931
|
ensureBootstrapApiKeyForUser(effectiveUser());
|
|
932
932
|
|
|
933
|
+
if (process.env.OMNIUS_UPDATE_COORDINATED === "1") {
|
|
934
|
+
log("Coordinated update owns daemon restart and exact-version verification.");
|
|
935
|
+
return safeExit(0);
|
|
936
|
+
}
|
|
937
|
+
|
|
933
938
|
if (process.env.OMNIUS_SKIP_DAEMON_INSTALL === "1") {
|
|
934
939
|
log("OMNIUS_SKIP_DAEMON_INSTALL=1 — skipping daemon service install.");
|
|
935
940
|
return safeExit(0);
|
package/dist/preinstall.cjs
CHANGED
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
|
|
14
14
|
"use strict";
|
|
15
15
|
|
|
16
|
+
// A coordinated self-update owns the exact PID/service lifecycle and verifies
|
|
17
|
+
// the replacement runtime afterward. The generic install hook must not race
|
|
18
|
+
// it by sweeping the configured port or killing an unattested process.
|
|
19
|
+
if (process.env.OMNIUS_UPDATE_COORDINATED === "1") {
|
|
20
|
+
process.stdout.write(" [preinstall] coordinated update owns daemon handoff\n");
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
if (process.env.OMNIUS_SKIP_DAEMON_INSTALL === "1") {
|
|
17
25
|
process.exit(0);
|
|
18
26
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.597",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.597",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED