omnius 1.0.139 → 1.0.140
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 +96 -29
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -534044,6 +534044,14 @@ var init_episodeStore = __esm({
|
|
|
534044
534044
|
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_ep_tool ON episodes(tool_name)`);
|
|
534045
534045
|
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_ep_decay ON episodes(decay_class)`);
|
|
534046
534046
|
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_ep_hash ON episodes(content_hash, session_id)`);
|
|
534047
|
+
try {
|
|
534048
|
+
this.db.exec(`
|
|
534049
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_ep_hash_unique
|
|
534050
|
+
ON episodes(content_hash, COALESCE(session_id, ''), COALESCE(tool_name, ''))
|
|
534051
|
+
WHERE content_hash IS NOT NULL AND content_hash != ''
|
|
534052
|
+
`);
|
|
534053
|
+
} catch {
|
|
534054
|
+
}
|
|
534047
534055
|
try {
|
|
534048
534056
|
this.db.exec(`ALTER TABLE episodes ADD COLUMN clip_embedding BLOB`);
|
|
534049
534057
|
} catch {
|
|
@@ -534371,6 +534379,21 @@ var init_temporalGraph = __esm({
|
|
|
534371
534379
|
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_kge_src ON kg_edges(src_id)`);
|
|
534372
534380
|
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_kge_dst ON kg_edges(dst_id)`);
|
|
534373
534381
|
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_kge_valid ON kg_edges(valid_from, valid_until)`);
|
|
534382
|
+
try {
|
|
534383
|
+
this.db.exec(`
|
|
534384
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_kgn_unique
|
|
534385
|
+
ON kg_nodes(LOWER(text), node_type)
|
|
534386
|
+
`);
|
|
534387
|
+
} catch {
|
|
534388
|
+
}
|
|
534389
|
+
try {
|
|
534390
|
+
this.db.exec(`
|
|
534391
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_kge_active_unique
|
|
534392
|
+
ON kg_edges(src_id, dst_id, relation, COALESCE(fact, ''), COALESCE(modality, 'text'))
|
|
534393
|
+
WHERE valid_until IS NULL
|
|
534394
|
+
`);
|
|
534395
|
+
} catch {
|
|
534396
|
+
}
|
|
534374
534397
|
this.db.pragma("journal_mode = WAL");
|
|
534375
534398
|
this.db.pragma("synchronous = NORMAL");
|
|
534376
534399
|
}
|
|
@@ -623339,41 +623362,52 @@ ${mediaContext}` : ""
|
|
|
623339
623362
|
const recentActions = memory.actions.filter(
|
|
623340
623363
|
(action) => action.userId === msg.fromUserId || !!currentUsername && action.username?.replace(/^@/, "").toLowerCase() === currentUsername || action.role === "assistant"
|
|
623341
623364
|
).slice(-8);
|
|
623342
|
-
const
|
|
623365
|
+
const lines = [];
|
|
623366
|
+
const userFactIds = /* @__PURE__ */ new Set();
|
|
623343
623367
|
if (userEntries.length > 0) {
|
|
623344
|
-
|
|
623345
|
-
|
|
623346
|
-
const
|
|
623347
|
-
const topics = user.recentTopics.slice(-
|
|
623348
|
-
|
|
623349
|
-
|
|
623350
|
-
|
|
623351
|
-
|
|
623352
|
-
|
|
623353
|
-
});
|
|
623354
|
-
sections.push(`### Durable Associative User Memory
|
|
623355
|
-
${lines.join("\n")}`);
|
|
623368
|
+
lines.push("**Per-user memory (compact):**");
|
|
623369
|
+
for (const [, user] of userEntries) {
|
|
623370
|
+
const label = user.username && user.username !== "unknown" ? `@${user.username}` : user.displayName || "user";
|
|
623371
|
+
const topics = user.recentTopics.slice(-3).join(", ") || "—";
|
|
623372
|
+
const factCount = user.facts.length;
|
|
623373
|
+
const relCount = user.relationshipHints.length;
|
|
623374
|
+
lines.push(`- ${label} [${telegramActorKindLabel(user)}]${user.userId ? ` id:${user.userId}` : ""}: msgs:${user.messageCount}, facts:${factCount}, relations:${relCount}, topics:${topics}`);
|
|
623375
|
+
for (const f2 of user.facts) userFactIds.add(f2.id ?? f2.text);
|
|
623376
|
+
}
|
|
623356
623377
|
}
|
|
623357
623378
|
if (scoredFacts.length > 0) {
|
|
623358
|
-
const
|
|
623359
|
-
|
|
623360
|
-
)
|
|
623361
|
-
|
|
623362
|
-
|
|
623379
|
+
const seenText = /* @__PURE__ */ new Set();
|
|
623380
|
+
const factLines = [];
|
|
623381
|
+
for (const { fact, score } of scoredFacts) {
|
|
623382
|
+
const text = fact.text;
|
|
623383
|
+
if (!text || seenText.has(text)) continue;
|
|
623384
|
+
seenText.add(text);
|
|
623385
|
+
factLines.push(`- (${score.toFixed(2)}) ${telegramContextJsonString(text, 260)}`);
|
|
623386
|
+
}
|
|
623387
|
+
if (factLines.length > 0) {
|
|
623388
|
+
if (lines.length > 0) lines.push("");
|
|
623389
|
+
lines.push("**Top scored facts:**");
|
|
623390
|
+
lines.push(...factLines);
|
|
623391
|
+
}
|
|
623363
623392
|
}
|
|
623364
623393
|
if (relationshipFacts.length > 0) {
|
|
623365
|
-
const
|
|
623366
|
-
|
|
623367
|
-
|
|
623368
|
-
|
|
623369
|
-
|
|
623370
|
-
|
|
623371
|
-
|
|
623372
|
-
)
|
|
623373
|
-
|
|
623374
|
-
|
|
623394
|
+
const seenText = /* @__PURE__ */ new Set();
|
|
623395
|
+
const relLines = [];
|
|
623396
|
+
for (const f2 of relationshipFacts.slice(0, 4)) {
|
|
623397
|
+
if (!f2.text || seenText.has(f2.text)) continue;
|
|
623398
|
+
seenText.add(f2.text);
|
|
623399
|
+
relLines.push(`- ${telegramContextJsonString(f2.text, 240)}`);
|
|
623400
|
+
}
|
|
623401
|
+
if (relLines.length > 0) {
|
|
623402
|
+
if (lines.length > 0) lines.push("");
|
|
623403
|
+
lines.push("**Relationship edges:**");
|
|
623404
|
+
lines.push(...relLines);
|
|
623405
|
+
}
|
|
623375
623406
|
}
|
|
623376
|
-
|
|
623407
|
+
void recentActions;
|
|
623408
|
+
if (lines.length === 0) return "";
|
|
623409
|
+
return `### Associative Memory (deduplicated single view)
|
|
623410
|
+
${lines.join("\n")}`;
|
|
623377
623411
|
}
|
|
623378
623412
|
relevantTelegramSqliteMirrorContext(sessionKey, msg, limit = 12) {
|
|
623379
623413
|
const db = this.telegramDb();
|
|
@@ -625011,6 +625045,39 @@ ${stimulationProbe.context}`,
|
|
|
625011
625045
|
`Current Telegram message text (untrusted user data):
|
|
625012
625046
|
${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
625013
625047
|
].filter(Boolean).join("\n");
|
|
625048
|
+
if (process.env["OMNIUS_TG_DUMP_PROMPT"]) {
|
|
625049
|
+
try {
|
|
625050
|
+
const dumpDir = process.env["OMNIUS_TG_DUMP_PROMPT"] === "1" ? "/tmp" : process.env["OMNIUS_TG_DUMP_PROMPT"];
|
|
625051
|
+
const fs11 = await import("node:fs");
|
|
625052
|
+
const path12 = await import("node:path");
|
|
625053
|
+
try {
|
|
625054
|
+
fs11.mkdirSync(dumpDir, { recursive: true });
|
|
625055
|
+
} catch {
|
|
625056
|
+
}
|
|
625057
|
+
const filename = `omnius-router-prompt-${Date.now()}-${sessionKey.replace(/[^a-zA-Z0-9_-]/g, "_")}.txt`;
|
|
625058
|
+
const dumpFile = path12.join(dumpDir, filename);
|
|
625059
|
+
const sections = userPrompt.split(/\n(?=## |### )/);
|
|
625060
|
+
const breakdown = sections.map((s2) => {
|
|
625061
|
+
const firstLine = s2.split("\n")[0].slice(0, 80);
|
|
625062
|
+
return ` [${s2.length.toString().padStart(6)} bytes / ~${Math.ceil(s2.length / 4).toString().padStart(5)} tok] ${firstLine}`;
|
|
625063
|
+
}).join("\n");
|
|
625064
|
+
const header = [
|
|
625065
|
+
`# Omnius Telegram Router Prompt Dump`,
|
|
625066
|
+
`# session_key: ${sessionKey}`,
|
|
625067
|
+
`# msg.username: ${msg.username || "(none)"}`,
|
|
625068
|
+
`# msg.chatType: ${msg.chatType}`,
|
|
625069
|
+
`# msg.text: ${JSON.stringify((msg.text || "").slice(0, 200))}`,
|
|
625070
|
+
`# total user-prompt bytes: ${userPrompt.length}`,
|
|
625071
|
+
`# total user-prompt tokens (est, 4 char/tok): ~${Math.ceil(userPrompt.length / 4)}`,
|
|
625072
|
+
`# section breakdown (descending size will identify the largest emitter):`,
|
|
625073
|
+
breakdown,
|
|
625074
|
+
`# ─────────────────────────────────────────────────────`,
|
|
625075
|
+
``
|
|
625076
|
+
].join("\n");
|
|
625077
|
+
fs11.writeFileSync(dumpFile, header + userPrompt, "utf8");
|
|
625078
|
+
} catch {
|
|
625079
|
+
}
|
|
625080
|
+
}
|
|
625014
625081
|
const diagnostics = {};
|
|
625015
625082
|
const routerStartMs = Date.now();
|
|
625016
625083
|
try {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.140",
|
|
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.140",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED