omnius 1.0.71 → 1.0.72
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 +179 -33
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -609574,6 +609574,28 @@ import { join as join127, resolve as resolve43, basename as basename27, relative
|
|
|
609574
609574
|
import { homedir as homedir40 } from "node:os";
|
|
609575
609575
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
609576
609576
|
import { createHash as createHash23, randomBytes as randomBytes22, randomInt } from "node:crypto";
|
|
609577
|
+
function cleanTelegramDecisionNote(value2, maxLength = 260) {
|
|
609578
|
+
if (typeof value2 !== "string") return void 0;
|
|
609579
|
+
const clean5 = stripTelegramHiddenThinking(value2).replace(/\s+/g, " ").trim();
|
|
609580
|
+
if (!clean5) return void 0;
|
|
609581
|
+
return clean5.length > maxLength ? `${clean5.slice(0, Math.max(0, maxLength - 3)).trimEnd()}...` : clean5;
|
|
609582
|
+
}
|
|
609583
|
+
function telegramDecisionNote(parsed, keys, nestedKeys = ["internal_notes", "internalNotes", "notes"]) {
|
|
609584
|
+
for (const key of keys) {
|
|
609585
|
+
const direct = cleanTelegramDecisionNote(parsed[key]);
|
|
609586
|
+
if (direct) return direct;
|
|
609587
|
+
}
|
|
609588
|
+
for (const nestedKey of nestedKeys) {
|
|
609589
|
+
const nested = parsed[nestedKey];
|
|
609590
|
+
if (!nested || typeof nested !== "object" || Array.isArray(nested)) continue;
|
|
609591
|
+
const record = nested;
|
|
609592
|
+
for (const key of keys) {
|
|
609593
|
+
const value2 = cleanTelegramDecisionNote(record[key]);
|
|
609594
|
+
if (value2) return value2;
|
|
609595
|
+
}
|
|
609596
|
+
}
|
|
609597
|
+
return void 0;
|
|
609598
|
+
}
|
|
609577
609599
|
function parseTelegramInteractionDecision(text, forcedRoute, options2 = {}) {
|
|
609578
609600
|
const cleaned = stripTelegramHiddenThinking(text).replace(/```(?:json)?/gi, "").replace(/```/g, "").trim();
|
|
609579
609601
|
const jsonText = cleaned.startsWith("{") ? cleaned : cleaned.match(/\{[\s\S]*\}/)?.[0] ?? "";
|
|
@@ -609603,7 +609625,11 @@ function parseTelegramInteractionDecision(text, forcedRoute, options2 = {}) {
|
|
|
609603
609625
|
attentionDelta: Number.isFinite(attentionDeltaRaw) ? Math.max(-1, Math.min(1, attentionDeltaRaw)) : void 0,
|
|
609604
609626
|
attentionScore: Number.isFinite(attentionScoreRaw) ? Math.max(0, Math.min(1, attentionScoreRaw)) : void 0,
|
|
609605
609627
|
nextCheckAfterMessages: Number.isFinite(nextMessagesRaw) ? Math.max(1, Math.floor(nextMessagesRaw)) : void 0,
|
|
609606
|
-
nextCheckAfterMs: Number.isFinite(nextMsRaw) ? Math.max(0, Math.floor(nextMsRaw)) : void 0
|
|
609628
|
+
nextCheckAfterMs: Number.isFinite(nextMsRaw) ? Math.max(0, Math.floor(nextMsRaw)) : void 0,
|
|
609629
|
+
silentDisposition: telegramDecisionNote(parsed, ["silent_disposition", "silentDisposition", "disposition"]),
|
|
609630
|
+
mentalNote: telegramDecisionNote(parsed, ["mental_note", "mentalNote", "observation", "insight"]),
|
|
609631
|
+
memoryNote: telegramDecisionNote(parsed, ["memory_note", "memoryNote", "memory"]),
|
|
609632
|
+
relationshipNote: telegramDecisionNote(parsed, ["relationship_note", "relationshipNote", "relationship"])
|
|
609607
609633
|
};
|
|
609608
609634
|
} catch {
|
|
609609
609635
|
return null;
|
|
@@ -609951,6 +609977,9 @@ function truncateTelegramContextLine(text, maxLength = TELEGRAM_CONTEXT_LINE_LIM
|
|
|
609951
609977
|
if (compact2.length <= maxLength) return compact2;
|
|
609952
609978
|
return `${compact2.slice(0, Math.max(0, maxLength - 3)).trimEnd()}...`;
|
|
609953
609979
|
}
|
|
609980
|
+
function telegramRegexEscape(text) {
|
|
609981
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
609982
|
+
}
|
|
609954
609983
|
function redactTelegramLocalPaths(text) {
|
|
609955
609984
|
return text.replace(/\/(?:home|root|tmp|var|etc|usr|opt|mnt|media|srv|run)\/[^\s"'`<>)]*/g, "[local-path-redacted]");
|
|
609956
609985
|
}
|
|
@@ -611379,6 +611408,7 @@ External acquisition contract:
|
|
|
611379
611408
|
lastUpdateId = 0;
|
|
611380
611409
|
state = {
|
|
611381
611410
|
active: false,
|
|
611411
|
+
botUserId: void 0,
|
|
611382
611412
|
botUsername: "",
|
|
611383
611413
|
botFirstName: void 0,
|
|
611384
611414
|
supportsGuestQueries: false,
|
|
@@ -611550,6 +611580,38 @@ External acquisition contract:
|
|
|
611550
611580
|
get botUsername() {
|
|
611551
611581
|
return this.state.botUsername;
|
|
611552
611582
|
}
|
|
611583
|
+
currentTelegramBotUserId() {
|
|
611584
|
+
const stateId = this.state.botUserId;
|
|
611585
|
+
if (typeof stateId === "number" && Number.isFinite(stateId)) return stateId;
|
|
611586
|
+
if (typeof this.botUserId === "number" && Number.isFinite(this.botUserId)) return this.botUserId;
|
|
611587
|
+
return void 0;
|
|
611588
|
+
}
|
|
611589
|
+
telegramSelfIdentitySignals() {
|
|
611590
|
+
const username = this.state.botUsername.trim().replace(/^@/, "");
|
|
611591
|
+
const firstName = this.state.botFirstName?.trim() ?? "";
|
|
611592
|
+
const botUserId = this.currentTelegramBotUserId();
|
|
611593
|
+
return [
|
|
611594
|
+
username ? `@${username}` : "",
|
|
611595
|
+
username,
|
|
611596
|
+
firstName,
|
|
611597
|
+
botUserId !== void 0 ? `telegram_user_id:${botUserId}` : ""
|
|
611598
|
+
];
|
|
611599
|
+
}
|
|
611600
|
+
buildTelegramSelfIdentityContext() {
|
|
611601
|
+
const username = this.state.botUsername.trim().replace(/^@/, "");
|
|
611602
|
+
const firstName = this.state.botFirstName?.trim() ?? "";
|
|
611603
|
+
const botUserId = this.currentTelegramBotUserId();
|
|
611604
|
+
const detail = [
|
|
611605
|
+
botUserId !== void 0 ? `user_id=${botUserId}` : "user_id=unknown",
|
|
611606
|
+
username ? `username=@${username}` : "username=unknown",
|
|
611607
|
+
firstName ? `display_name=${firstName}` : "display_name=unknown"
|
|
611608
|
+
].join(", ");
|
|
611609
|
+
return [
|
|
611610
|
+
`Telegram bot self identity: ${detail}.`,
|
|
611611
|
+
`Known self identity signals (context only, not triggers): ${formatTelegramIdentitySignals(this.telegramSelfIdentitySignals())}.`,
|
|
611612
|
+
`Use these signals to infer whether heard text is probably aimed at this bot; identity matches raise salience but never force should_reply.`
|
|
611613
|
+
].join("\n");
|
|
611614
|
+
}
|
|
611553
611615
|
beginAdminAuthChallenge(ttlMs = 5 * 60 * 1e3) {
|
|
611554
611616
|
const code8 = String(randomInt(1e5, 1e6));
|
|
611555
611617
|
this.adminAuthChallenge = {
|
|
@@ -611577,6 +611639,56 @@ External acquisition contract:
|
|
|
611577
611639
|
viewIdForMessage(msg) {
|
|
611578
611640
|
return `telegram-${this.sessionKeyForMessage(msg).replace(/[^A-Za-z0-9_-]/g, "-")}`;
|
|
611579
611641
|
}
|
|
611642
|
+
attentionViewIdForMessage(msg) {
|
|
611643
|
+
const id = Number.isFinite(msg.messageId) ? msg.messageId : Date.now();
|
|
611644
|
+
return `${this.viewIdForMessage(msg)}-heard-${id}`;
|
|
611645
|
+
}
|
|
611646
|
+
registerTelegramAttentionView(msg, toolContext, detail = "heard message") {
|
|
611647
|
+
if (!this.subAgentViewCallbacks) return null;
|
|
611648
|
+
const viewId = this.attentionViewIdForMessage(msg);
|
|
611649
|
+
const preview = truncateTelegramContextLine(msg.text || summarizeTelegramMessageAttachments(msg) || "[non-text Telegram message]", 160);
|
|
611650
|
+
const chat = msg.chatTitle || msg.chatType;
|
|
611651
|
+
this.subAgentViewCallbacks.onRegister(
|
|
611652
|
+
viewId,
|
|
611653
|
+
`✈ heard @${msg.username || "telegram"}`,
|
|
611654
|
+
`Telegram attention: ${preview}`
|
|
611655
|
+
);
|
|
611656
|
+
this.subAgentViewCallbacks.onWrite(
|
|
611657
|
+
viewId,
|
|
611658
|
+
`heard: @${msg.username || "unknown"} [${telegramActorKindLabel(msg)}] in ${chat}: ${preview}`
|
|
611659
|
+
);
|
|
611660
|
+
const replyEdge = this.formatTelegramReplyEdgeForTui(this.sessionKeyForMessage(msg), msg);
|
|
611661
|
+
if (replyEdge) this.subAgentViewCallbacks.onWrite(viewId, replyEdge);
|
|
611662
|
+
this.subAgentViewCallbacks.onWrite(viewId, `context: ${detail}; tool_context=${toolContext}; assessing attention, memory, and relationship state`);
|
|
611663
|
+
this.subAgentViewCallbacks.onStatus(viewId, "running");
|
|
611664
|
+
return viewId;
|
|
611665
|
+
}
|
|
611666
|
+
writeTelegramAttentionDecision(viewId, decision) {
|
|
611667
|
+
if (!viewId || !this.subAgentViewCallbacks) return;
|
|
611668
|
+
const route = decision.shouldReply ? `reply via ${decision.route}` : "silent";
|
|
611669
|
+
const attention = [
|
|
611670
|
+
decision.attentionState ? `state=${decision.attentionState}` : "",
|
|
611671
|
+
decision.attentionDelta !== void 0 ? `delta=${decision.attentionDelta.toFixed(2)}` : "",
|
|
611672
|
+
decision.attentionScore !== void 0 ? `score=${decision.attentionScore.toFixed(2)}` : ""
|
|
611673
|
+
].filter(Boolean).join(", ");
|
|
611674
|
+
const cadence = [
|
|
611675
|
+
decision.nextCheckAfterMessages !== void 0 ? `after ${decision.nextCheckAfterMessages} message(s)` : "",
|
|
611676
|
+
decision.nextCheckAfterMs !== void 0 ? `after ${Math.round(decision.nextCheckAfterMs / 1e3)}s` : ""
|
|
611677
|
+
].filter(Boolean).join(" or ");
|
|
611678
|
+
const lines = [
|
|
611679
|
+
`decision: ${route} (${decision.source}, confidence ${decision.confidence.toFixed(2)})`,
|
|
611680
|
+
attention ? `attention: ${attention}` : "",
|
|
611681
|
+
`reason: ${decision.reason}`,
|
|
611682
|
+
decision.silentDisposition ? `silent disposition: ${decision.silentDisposition}` : "",
|
|
611683
|
+
decision.mentalNote ? `mental note: ${decision.mentalNote}` : "",
|
|
611684
|
+
decision.memoryNote ? `memory note: ${decision.memoryNote}` : "",
|
|
611685
|
+
decision.relationshipNote ? `relationship note: ${decision.relationshipNote}` : "",
|
|
611686
|
+
cadence ? `next attention sample: ${cadence}` : ""
|
|
611687
|
+
].filter(Boolean);
|
|
611688
|
+
this.subAgentViewCallbacks.onWrite(viewId, lines.join("\n"));
|
|
611689
|
+
this.subAgentViewCallbacks.onStatus(viewId, "completed");
|
|
611690
|
+
this.subAgentViewCallbacks.onComplete(viewId);
|
|
611691
|
+
}
|
|
611580
611692
|
normalizeTelegramCommandText(input) {
|
|
611581
611693
|
const trimmed = input.trim();
|
|
611582
611694
|
if (!trimmed.startsWith("/")) return input;
|
|
@@ -611776,7 +611888,10 @@ No scoped reflection artifact exists yet for this chat. Use <code>/reflect</code
|
|
|
611776
611888
|
if (!sender) return void 0;
|
|
611777
611889
|
const bot = this.state.botUsername.trim().replace(/^@/, "").toLowerCase();
|
|
611778
611890
|
const senderUsername = sender.username?.trim().replace(/^@/, "").toLowerCase();
|
|
611779
|
-
const
|
|
611891
|
+
const botUserId = this.currentTelegramBotUserId();
|
|
611892
|
+
const isSelf = Boolean(
|
|
611893
|
+
sender.isSelf || bot && senderUsername === bot || botUserId !== void 0 && sender.id === botUserId
|
|
611894
|
+
);
|
|
611780
611895
|
return isSelf === sender.isSelf ? sender : { ...sender, isSelf };
|
|
611781
611896
|
}
|
|
611782
611897
|
telegramReplyContextFromHistoryEntry(entry) {
|
|
@@ -614215,26 +614330,45 @@ ${lines.join("\n")}`);
|
|
|
614215
614330
|
this.groupSkipLogAt.set(sessionKey, now);
|
|
614216
614331
|
this.tuiWrite(() => renderTelegramSubAgentEvent(msg.username, `${reason} (context retained)`));
|
|
614217
614332
|
}
|
|
614218
|
-
|
|
614219
|
-
const
|
|
614220
|
-
|
|
614221
|
-
const
|
|
614222
|
-
|
|
614223
|
-
);
|
|
614224
|
-
|
|
614225
|
-
if (msg.
|
|
614226
|
-
|
|
614227
|
-
|
|
614333
|
+
telegramMessageIdentitySalienceSignals(msg) {
|
|
614334
|
+
const signals = /* @__PURE__ */ new Set();
|
|
614335
|
+
const username = this.state.botUsername.trim().replace(/^@/, "");
|
|
614336
|
+
const usernameLower = username.toLowerCase();
|
|
614337
|
+
const displayName = this.state.botFirstName?.trim() ?? "";
|
|
614338
|
+
const botUserId = this.currentTelegramBotUserId();
|
|
614339
|
+
const text = msg.text || "";
|
|
614340
|
+
if (msg.chatType === "private") signals.add("private_dm_delivery");
|
|
614341
|
+
if (usernameLower) {
|
|
614342
|
+
const mentioned = (msg.mentionedUsernames ?? []).some(
|
|
614343
|
+
(name10) => name10.trim().replace(/^@/, "").toLowerCase() === usernameLower
|
|
614344
|
+
);
|
|
614345
|
+
if (mentioned) signals.add(`entity_mention:@${username}`);
|
|
614346
|
+
const rawMention = new RegExp(`(^|[^A-Za-z0-9_@])@${telegramRegexEscape(username)}(?![A-Za-z0-9_])`, "i");
|
|
614347
|
+
if (rawMention.test(text)) signals.add(`raw_text_mention:@${username}`);
|
|
614348
|
+
if (msg.replyToUsername && msg.replyToUsername.trim().replace(/^@/, "").toLowerCase() === usernameLower) {
|
|
614349
|
+
signals.add(`reply_to_username:@${username}`);
|
|
614350
|
+
}
|
|
614351
|
+
const replyUsername = msg.replyContext?.sender?.username?.trim().replace(/^@/, "").toLowerCase();
|
|
614352
|
+
if (replyUsername && replyUsername === usernameLower) signals.add(`reply_context_username:@${username}`);
|
|
614353
|
+
}
|
|
614354
|
+
if (displayName.length >= 3) {
|
|
614355
|
+
const displayPattern = new RegExp(`(^|[^\\p{L}\\p{N}_])${telegramRegexEscape(displayName)}(?![\\p{L}\\p{N}_])`, "iu");
|
|
614356
|
+
if (displayPattern.test(text)) signals.add(`display_name:${displayName}`);
|
|
614357
|
+
}
|
|
614358
|
+
if (botUserId !== void 0 && msg.replyContext?.sender?.id === botUserId) {
|
|
614359
|
+
signals.add(`reply_context_user_id:${botUserId}`);
|
|
614360
|
+
}
|
|
614228
614361
|
const resolvedReply = this.resolveTelegramReplyContext(this.sessionKeyForMessage(msg), msg);
|
|
614229
|
-
if (resolvedReply?.sender?.isSelf)
|
|
614230
|
-
return
|
|
614362
|
+
if (resolvedReply?.sender?.isSelf) signals.add("reply_to_self_history");
|
|
614363
|
+
return [...signals];
|
|
614231
614364
|
}
|
|
614232
614365
|
telegramMessageRepliesToBot(msg) {
|
|
614233
614366
|
const bot = this.state.botUsername.trim().replace(/^@/, "").toLowerCase();
|
|
614234
|
-
|
|
614367
|
+
const botUserId = this.currentTelegramBotUserId();
|
|
614235
614368
|
const legacyReply = msg.replyToUsername?.trim().replace(/^@/, "").toLowerCase();
|
|
614236
614369
|
const contextReply = msg.replyContext?.sender?.username?.trim().replace(/^@/, "").toLowerCase();
|
|
614237
|
-
if (legacyReply === bot || contextReply === bot) return true;
|
|
614370
|
+
if (bot && (legacyReply === bot || contextReply === bot)) return true;
|
|
614371
|
+
if (botUserId !== void 0 && msg.replyContext?.sender?.id === botUserId) return true;
|
|
614238
614372
|
const resolvedReply = this.resolveTelegramReplyContext(this.sessionKeyForMessage(msg), msg);
|
|
614239
614373
|
return Boolean(resolvedReply?.sender?.isSelf);
|
|
614240
614374
|
}
|
|
@@ -614252,7 +614386,8 @@ ${lines.join("\n")}`);
|
|
|
614252
614386
|
const config = this.agentConfig;
|
|
614253
614387
|
const forcedRoute = this.interactionMode === "chat" || this.interactionMode === "action" ? this.interactionMode : null;
|
|
614254
614388
|
const isGroup = msg.chatType !== "private";
|
|
614255
|
-
const
|
|
614389
|
+
const identitySalienceSignals = this.telegramMessageIdentitySalienceSignals(msg);
|
|
614390
|
+
const addressesBot = identitySalienceSignals.length > 0;
|
|
614256
614391
|
const sessionKey = this.sessionKeyForMessage(msg);
|
|
614257
614392
|
const daydreamForceCheck = isGroup && this.shouldForceAnalysisFromChannelDaydream(sessionKey);
|
|
614258
614393
|
const stimulationProbe = this.stimulation.observe({
|
|
@@ -614269,7 +614404,9 @@ ${lines.join("\n")}`);
|
|
|
614269
614404
|
shouldReply: false,
|
|
614270
614405
|
confidence: 0,
|
|
614271
614406
|
reason: "router inference unavailable; no model-derived reply decision",
|
|
614272
|
-
source: "inference-unavailable"
|
|
614407
|
+
source: "inference-unavailable",
|
|
614408
|
+
silentDisposition: "retained as context without replying",
|
|
614409
|
+
mentalNote: "router unavailable, so no model-derived attention note was produced"
|
|
614273
614410
|
};
|
|
614274
614411
|
this.applyTelegramStimulationDecision(sessionKey, fallback2);
|
|
614275
614412
|
return fallback2;
|
|
@@ -614282,17 +614419,12 @@ ${lines.join("\n")}`);
|
|
|
614282
614419
|
const forcedLine = forcedRoute ? `The operator selected Telegram mode "${forcedRoute}". The route field MUST be "${forcedRoute}", but should_reply must still be inferred live from context.` : `The operator selected Telegram mode "auto". Infer route live from context.`;
|
|
614283
614420
|
const context2 = this.buildTelegramConversationContextStream(sessionKey, msg, isGroup ? 36 : 20);
|
|
614284
614421
|
const currentReplyContext = this.buildTelegramCurrentReplyContext(sessionKey, msg);
|
|
614285
|
-
const
|
|
614286
|
-
const botIdentitySignals = [
|
|
614287
|
-
botUsername && botUsername !== "unknown" ? `@${botUsername}` : "",
|
|
614288
|
-
botUsername && botUsername !== "unknown" ? botUsername.replace(/^@/, "") : "",
|
|
614289
|
-
this.state.botFirstName || ""
|
|
614290
|
-
];
|
|
614422
|
+
const selfIdentityContext = this.buildTelegramSelfIdentityContext();
|
|
614291
614423
|
const userPrompt = [
|
|
614292
614424
|
`You are the Telegram live routing and reply-discretion model.`,
|
|
614293
614425
|
`Return JSON only, with no markdown and no explanation outside JSON.`,
|
|
614294
614426
|
``,
|
|
614295
|
-
`Schema: {"route":"chat"|"action","should_reply":true|false,"confidence":0.0-1.0,"reason":"short reason","attention_state":"idle"|"observing"|"engaged"|"cooldown","attention_delta":-1.0..1.0,"next_check_after_messages":1..12}`,
|
|
614427
|
+
`Schema: {"route":"chat"|"action","should_reply":true|false,"confidence":0.0-1.0,"reason":"short reason","attention_state":"idle"|"observing"|"engaged"|"cooldown","attention_delta":-1.0..1.0,"next_check_after_messages":1..12,"silent_disposition":"short outcome-level disposition","mental_note":"short outcome-level observation","memory_note":"short memory/summary update","relationship_note":"short relationship/thread note"}`,
|
|
614296
614428
|
``,
|
|
614297
614429
|
`Route meanings:`,
|
|
614298
614430
|
`- chat: a short conversational answer can be produced without tools.`,
|
|
@@ -614301,7 +614433,9 @@ ${lines.join("\n")}`);
|
|
|
614301
614433
|
``,
|
|
614302
614434
|
`Reply discretion: make a human-like attention decision from the full social context. Observe the message, relationship stream, reply graph, conversation momentum, prior bot involvement, speaker intent, and notification-like signals, then decide whether a visible reply would be natural.`,
|
|
614303
614435
|
`No hard triggers: direct address, @mentions, name/identity references, private-chat delivery, replies, active threads, and stimulation score are evidence only. They may raise or lower salience, but none guarantees should_reply=true or should_reply=false.`,
|
|
614436
|
+
`High-salience evidence: private DMs, exact @username matches, display-name self references, and replies to this bot are notification-like signals. They should usually move attention toward deeper processing and a likely response unless the surrounding context makes silence more natural.`,
|
|
614304
614437
|
`No keyword routing: do not use static keyword rules. Infer whether identity references are actually aimed at this bot from syntax, tone, recent turns, and relationships.`,
|
|
614438
|
+
`Observation notes: always fill silent_disposition, mental_note, memory_note, and relationship_note with concise outcome-level notes for the TUI. Do not expose hidden chain-of-thought; summarize what the bot did with the heard message.`,
|
|
614305
614439
|
`Bot-to-bot discipline: sender labels include [bot] or [human]. Treat peer bots as autonomous actors, not human users. Avoid bot loops by replying only when the exchange context makes a response socially useful.`,
|
|
614306
614440
|
`Ingress discipline: this Telegram message has already been retained as chat context. should_reply controls only whether to emit a visible reply.`,
|
|
614307
614441
|
`Memory discipline: use durable associative user memory, relationships, prior actions, and recent context to infer whether this speaker is continuing a bot-related thread. A mention is not required when the semantic target is clearly the bot or an ongoing bot-mediated discussion.`,
|
|
@@ -614310,8 +614444,9 @@ ${lines.join("\n")}`);
|
|
|
614310
614444
|
forcedLine,
|
|
614311
614445
|
``,
|
|
614312
614446
|
`Tool context: ${toolContext}`,
|
|
614313
|
-
|
|
614447
|
+
selfIdentityContext,
|
|
614314
614448
|
`Platform notification/direct-address signal (salience evidence only, not a decision): ${addressesBot ? "yes" : "no"}`,
|
|
614449
|
+
`Platform salience signals (context only, not triggers): ${identitySalienceSignals.length ? identitySalienceSignals.join(", ") : "none"}`,
|
|
614315
614450
|
`Current chat type: ${msg.chatType}`,
|
|
614316
614451
|
`Current sender: ${telegramSpeakerLabel(msg)} [${telegramActorKindLabel(msg)}]`,
|
|
614317
614452
|
msg.replyToMessageId ? `Current message replies to message_id ${msg.replyToMessageId}` : "",
|
|
@@ -614359,7 +614494,9 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
|
|
|
614359
614494
|
shouldReply: false,
|
|
614360
614495
|
confidence: 0,
|
|
614361
614496
|
reason: "router inference failed; no model-derived reply decision",
|
|
614362
|
-
source: "inference-unavailable"
|
|
614497
|
+
source: "inference-unavailable",
|
|
614498
|
+
silentDisposition: "retained as context without replying",
|
|
614499
|
+
mentalNote: "router failed, so no model-derived attention note was produced"
|
|
614363
614500
|
};
|
|
614364
614501
|
this.applyTelegramStimulationDecision(sessionKey, fallback);
|
|
614365
614502
|
return fallback;
|
|
@@ -614709,6 +614846,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
614709
614846
|
}
|
|
614710
614847
|
this.state = {
|
|
614711
614848
|
active: true,
|
|
614849
|
+
botUserId: typeof me.result?.id === "number" ? me.result.id : void 0,
|
|
614712
614850
|
botUsername: me.result?.username ?? "unknown",
|
|
614713
614851
|
botFirstName: typeof me.result?.first_name === "string" ? me.result.first_name : void 0,
|
|
614714
614852
|
supportsGuestQueries: Boolean(me.result?.supports_guest_queries),
|
|
@@ -614958,10 +615096,8 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
614958
615096
|
if (startsWithSlash && isAdminAuthSecretCommand && await this.handleAdminAuthCommand({ ...msg, text: normalizedCommandText })) {
|
|
614959
615097
|
return;
|
|
614960
615098
|
}
|
|
614961
|
-
|
|
614962
|
-
|
|
614963
|
-
this.tuiWrite(() => renderTelegramIngressMessage(msg));
|
|
614964
|
-
}
|
|
615099
|
+
this.recordTelegramUserMessage(msg, "ambient");
|
|
615100
|
+
this.tuiWrite(() => renderTelegramIngressMessage(msg));
|
|
614965
615101
|
if (startsWithSlash && !isAdminAuthSecretCommand && await this.handleAdminAuthCommand({ ...msg, text: normalizedCommandText })) {
|
|
614966
615102
|
return;
|
|
614967
615103
|
}
|
|
@@ -615083,8 +615219,9 @@ Join: ${newUrl}`);
|
|
|
615083
615219
|
if (existing && !existing.aborted) {
|
|
615084
615220
|
const isGroup = msg.chatType !== "private";
|
|
615085
615221
|
if (isGroup) {
|
|
615086
|
-
this.
|
|
615222
|
+
const attentionViewId2 = this.registerTelegramAttentionView(msg, existing.toolContext || toolContext, "active Telegram thread");
|
|
615087
615223
|
const decision2 = await this.inferTelegramInteractionDecision(msg, existing.toolContext || toolContext);
|
|
615224
|
+
this.writeTelegramAttentionDecision(attentionViewId2, decision2);
|
|
615088
615225
|
this.markLastTelegramUserMessageMode(msg, decision2.shouldReply ? "steering" : "ambient");
|
|
615089
615226
|
this.subAgentViewCallbacks?.onWrite(
|
|
615090
615227
|
existing.viewId,
|
|
@@ -615119,8 +615256,9 @@ Join: ${newUrl}`);
|
|
|
615119
615256
|
}
|
|
615120
615257
|
return;
|
|
615121
615258
|
}
|
|
615122
|
-
this.
|
|
615259
|
+
const attentionViewId = this.registerTelegramAttentionView(msg, toolContext);
|
|
615123
615260
|
const decision = await this.inferTelegramInteractionDecision(msg, toolContext);
|
|
615261
|
+
this.writeTelegramAttentionDecision(attentionViewId, decision);
|
|
615124
615262
|
this.markLastTelegramUserMessageMode(msg, decision.shouldReply ? decision.route : "ambient");
|
|
615125
615263
|
this.subAgentViewCallbacks?.onWrite(
|
|
615126
615264
|
this.viewIdForMessage(msg),
|
|
@@ -615502,6 +615640,7 @@ ${TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT}
|
|
|
615502
615640
|
${TELEGRAM_PUBLIC_VISION_STACK_CONTRACT}`;
|
|
615503
615641
|
const groupHint = isGroup ? `Telegram group: ${msg.chatTitle || "unknown"}. The live router selected this turn as reply-worthy; keep the reply short and relevant. Never output a skip decision, no_reply marker, memory-stage note, or completion status.` : "Telegram private chat.";
|
|
615504
615642
|
const runtime = buildTelegramRuntimeContext(/* @__PURE__ */ new Date());
|
|
615643
|
+
const selfIdentityContext = this.buildTelegramSelfIdentityContext();
|
|
615505
615644
|
const messages2 = [
|
|
615506
615645
|
{
|
|
615507
615646
|
role: "system",
|
|
@@ -615511,6 +615650,8 @@ ${TELEGRAM_PUBLIC_VISION_STACK_CONTRACT}`;
|
|
|
615511
615650
|
|
|
615512
615651
|
${runtime}
|
|
615513
615652
|
|
|
615653
|
+
${selfIdentityContext}
|
|
615654
|
+
|
|
615514
615655
|
${safety}
|
|
615515
615656
|
|
|
615516
615657
|
${groupHint}
|
|
@@ -615787,10 +615928,13 @@ Respond concisely and safely. Send the actual chat reply, not router/status/comp
|
|
|
615787
615928
|
[Media attached — processed content below]
|
|
615788
615929
|
${mediaContext}`;
|
|
615789
615930
|
}
|
|
615931
|
+
const selfIdentityContext = this.buildTelegramSelfIdentityContext();
|
|
615790
615932
|
const systemCtx = isAdminDM ? `${runtimeContext}
|
|
615933
|
+
${selfIdentityContext}
|
|
615791
615934
|
Telegram admin: @${msg.username}
|
|
615792
615935
|
Telegram profile: ${profile}
|
|
615793
615936
|
Todo/session id: ${sessionContext.sessionId}` : `${runtimeContext}
|
|
615937
|
+
${selfIdentityContext}
|
|
615794
615938
|
Telegram ${isGroup ? "group" : "public"} chat. Respond concisely. Safety filter: ACTIVE.${creativeWorkspace ? `
|
|
615795
615939
|
|
|
615796
615940
|
${creativeWorkspace}` : ""}`;
|
|
@@ -617201,7 +617345,9 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
617201
617345
|
}
|
|
617202
617346
|
const botId = result.result.id;
|
|
617203
617347
|
this.botUserId = botId;
|
|
617348
|
+
this.state.botUserId = botId;
|
|
617204
617349
|
if (typeof result.result.username === "string") this.state.botUsername = result.result.username;
|
|
617350
|
+
if (typeof result.result.first_name === "string") this.state.botFirstName = result.result.first_name;
|
|
617205
617351
|
return botId;
|
|
617206
617352
|
}
|
|
617207
617353
|
async getChatMember(chatId, userId) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.72",
|
|
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.72",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED