omnius 1.0.171 → 1.0.173
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 +85 -28
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -558666,7 +558666,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
558666
558666
|
const lines = output.split("\n");
|
|
558667
558667
|
const { foldLineThreshold, foldHeadLines, foldTailLines } = this.contextLimits();
|
|
558668
558668
|
if (lines.length <= foldLineThreshold) {
|
|
558669
|
-
return
|
|
558669
|
+
return this.truncateTextWithoutCuttingUrl(output, maxChars, "\n...(truncated)");
|
|
558670
558670
|
}
|
|
558671
558671
|
const headLines = foldHeadLines;
|
|
558672
558672
|
const tailLines = foldTailLines;
|
|
@@ -558679,10 +558679,27 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
|
|
|
558679
558679
|
|
|
558680
558680
|
${tail}`;
|
|
558681
558681
|
if (folded.length > maxChars) {
|
|
558682
|
-
return
|
|
558682
|
+
return this.truncateTextWithoutCuttingUrl(folded, maxChars, "\n...(truncated)");
|
|
558683
558683
|
}
|
|
558684
558684
|
return folded;
|
|
558685
558685
|
}
|
|
558686
|
+
truncateTextWithoutCuttingUrl(text, maxChars, suffix = "...") {
|
|
558687
|
+
if (text.length <= maxChars)
|
|
558688
|
+
return text;
|
|
558689
|
+
if (maxChars <= suffix.length)
|
|
558690
|
+
return text.slice(0, maxChars);
|
|
558691
|
+
let cut = maxChars - suffix.length;
|
|
558692
|
+
const urlRe = /\bhttps?:\/\/[^\s<>"'()[\]{}]+/gi;
|
|
558693
|
+
for (const match of text.matchAll(urlRe)) {
|
|
558694
|
+
const start2 = match.index ?? 0;
|
|
558695
|
+
const end = start2 + match[0].length;
|
|
558696
|
+
if (start2 < cut && cut < end) {
|
|
558697
|
+
cut = start2;
|
|
558698
|
+
break;
|
|
558699
|
+
}
|
|
558700
|
+
}
|
|
558701
|
+
return `${text.slice(0, Math.max(0, cut)).trimEnd()}${suffix}`;
|
|
558702
|
+
}
|
|
558686
558703
|
async appendInjectedUserMessage(userMsg, messages2, turn) {
|
|
558687
558704
|
const imagePattern = /\[IMAGE_BASE64:([^:]+):([^\]]+)\]/;
|
|
558688
558705
|
const imgMatch = userMsg.match(imagePattern);
|
|
@@ -615378,6 +615395,23 @@ import { existsSync as existsSync109, readFileSync as readFileSync87, readdirSyn
|
|
|
615378
615395
|
import { join as join122, basename as basename24 } from "node:path";
|
|
615379
615396
|
import { execSync as execSync54 } from "node:child_process";
|
|
615380
615397
|
import { homedir as homedir42 } from "node:os";
|
|
615398
|
+
function projectContextUrlSpanAt(text, index) {
|
|
615399
|
+
PROJECT_CONTEXT_URL_RE.lastIndex = 0;
|
|
615400
|
+
for (const match of text.matchAll(PROJECT_CONTEXT_URL_RE)) {
|
|
615401
|
+
const start2 = match.index ?? 0;
|
|
615402
|
+
const end = start2 + match[0].length;
|
|
615403
|
+
if (start2 < index && index < end) return { start: start2, end };
|
|
615404
|
+
}
|
|
615405
|
+
return null;
|
|
615406
|
+
}
|
|
615407
|
+
function truncateProjectContextText(text, maxChars, suffix = "...") {
|
|
615408
|
+
if (text.length <= maxChars) return text;
|
|
615409
|
+
if (maxChars <= suffix.length) return text.slice(0, maxChars);
|
|
615410
|
+
let cut = maxChars - suffix.length;
|
|
615411
|
+
const span = projectContextUrlSpanAt(text, cut);
|
|
615412
|
+
if (span) cut = span.start;
|
|
615413
|
+
return `${text.slice(0, Math.max(0, cut)).trimEnd()}${suffix}`;
|
|
615414
|
+
}
|
|
615381
615415
|
function getModelTier(modelName) {
|
|
615382
615416
|
const m2 = modelName.toLowerCase();
|
|
615383
615417
|
const sizeMatch = m2.match(/\b(\d+)b\b/);
|
|
@@ -615496,7 +615530,7 @@ function loadMemoryContext(repoRoot) {
|
|
|
615496
615530
|
if (sorted.length === 0) continue;
|
|
615497
615531
|
lines.push(`[${bucketKey}]`);
|
|
615498
615532
|
for (const e2 of sorted) {
|
|
615499
|
-
lines.push(` ${e2.key}: ${e2.value
|
|
615533
|
+
lines.push(` ${e2.key}: ${truncateProjectContextText(e2.value, 200, "")}`);
|
|
615500
615534
|
}
|
|
615501
615535
|
}
|
|
615502
615536
|
return lines.join("\n");
|
|
@@ -615509,10 +615543,10 @@ function loadSessionHistory2(repoRoot) {
|
|
|
615509
615543
|
const status = s2.completed ? "completed" : "incomplete";
|
|
615510
615544
|
const date = s2.startedAt.split("T")[0];
|
|
615511
615545
|
const cleanTask = cleanForStorage(s2.task) || s2.task;
|
|
615512
|
-
lines.push(`- [${date}] ${cleanTask
|
|
615546
|
+
lines.push(`- [${date}] ${truncateProjectContextText(cleanTask, 80, "")} (${status}, ${s2.turns ?? 0} turns)`);
|
|
615513
615547
|
if (s2.summary) {
|
|
615514
615548
|
const cleanSummary = cleanForStorage(s2.summary) || s2.summary;
|
|
615515
|
-
lines.push(` Summary: ${cleanSummary
|
|
615549
|
+
lines.push(` Summary: ${truncateProjectContextText(cleanSummary, 120, "")}`);
|
|
615516
615550
|
}
|
|
615517
615551
|
}
|
|
615518
615552
|
const sessionCtx = loadSessionContext(repoRoot);
|
|
@@ -615524,8 +615558,8 @@ function loadSessionHistory2(repoRoot) {
|
|
|
615524
615558
|
const user = cleanForStorage(entry.task) || entry.task;
|
|
615525
615559
|
const assistant = cleanForStorage(entry.assistantResponse || entry.summary) || entry.assistantResponse || entry.summary;
|
|
615526
615560
|
if (!assistant) continue;
|
|
615527
|
-
lines.push(`- User: ${user
|
|
615528
|
-
lines.push(` Assistant: ${assistant
|
|
615561
|
+
lines.push(`- User: ${truncateProjectContextText(user, 120, "")}`);
|
|
615562
|
+
lines.push(` Assistant: ${truncateProjectContextText(assistant, 160, "")}`);
|
|
615529
615563
|
}
|
|
615530
615564
|
}
|
|
615531
615565
|
return lines.length > 1 ? lines.join("\n") : "";
|
|
@@ -615649,7 +615683,7 @@ function loadCustomToolsContext(repoRoot) {
|
|
|
615649
615683
|
const tested = tool.qualityGate?.lastTest?.testedAt?.split("T")[0] ?? "passed";
|
|
615650
615684
|
const schema = tool.qualityGate?.lastTest?.schemaValidation?.status;
|
|
615651
615685
|
const bits = [
|
|
615652
|
-
`- ${tool.name} v${tool.version ?? 1}: ${String(tool.description ?? "")
|
|
615686
|
+
`- ${tool.name} v${tool.version ?? 1}: ${truncateProjectContextText(String(tool.description ?? ""), 140, "")}`,
|
|
615653
615687
|
`docs=${tool.docsPath ?? "missing"}`,
|
|
615654
615688
|
existsSync109(indexPath) ? `index=${indexPath}` : "",
|
|
615655
615689
|
`test=${tested}${schema ? `, schema=${schema}` : ""}`,
|
|
@@ -615733,7 +615767,7 @@ ${ctx3.gitInfo}`);
|
|
|
615733
615767
|
} else if (modelTier === "medium" && ctx3.projectMap.length > 2e3) {
|
|
615734
615768
|
sections.push(`## Project Map (truncated)
|
|
615735
615769
|
|
|
615736
|
-
${ctx3.projectMap
|
|
615770
|
+
${truncateProjectContextText(ctx3.projectMap, 2e3, "")}
|
|
615737
615771
|
...(use find_files/list_directory for full listing)`);
|
|
615738
615772
|
} else {
|
|
615739
615773
|
sections.push(`## Project Map
|
|
@@ -615790,12 +615824,14 @@ These patterns have been repeated 3+ times. Consider using create_tool to automa
|
|
|
615790
615824
|
}
|
|
615791
615825
|
return sections.join("\n\n");
|
|
615792
615826
|
}
|
|
615827
|
+
var PROJECT_CONTEXT_URL_RE;
|
|
615793
615828
|
var init_project_context = __esm({
|
|
615794
615829
|
"packages/cli/src/tui/project-context.ts"() {
|
|
615795
615830
|
"use strict";
|
|
615796
615831
|
init_dist8();
|
|
615797
615832
|
init_omnius_directory();
|
|
615798
615833
|
init_dist5();
|
|
615834
|
+
PROJECT_CONTEXT_URL_RE = /\bhttps?:\/\/[^\s<>"'()[\]{}]+/gi;
|
|
615799
615835
|
}
|
|
615800
615836
|
});
|
|
615801
615837
|
|
|
@@ -627465,6 +627501,29 @@ function normalizeTelegramOutboundLinks(text) {
|
|
|
627465
627501
|
(match) => match.replace(/^(https?:\/\/)\s*/i, "$1").replace(/\s*\.\s*/g, ".").replace(/\s*:\s*(\d+)/g, ":$1")
|
|
627466
627502
|
);
|
|
627467
627503
|
}
|
|
627504
|
+
function telegramUrlSpanAt(text, index) {
|
|
627505
|
+
TELEGRAM_HTTP_URL_RE.lastIndex = 0;
|
|
627506
|
+
for (const match of text.matchAll(TELEGRAM_HTTP_URL_RE)) {
|
|
627507
|
+
const start2 = match.index ?? 0;
|
|
627508
|
+
const end = start2 + match[0].length;
|
|
627509
|
+
if (start2 < index && index < end) return { start: start2, end };
|
|
627510
|
+
}
|
|
627511
|
+
return null;
|
|
627512
|
+
}
|
|
627513
|
+
function truncateTelegramUrlSafe(text, maxLength, suffix = "...") {
|
|
627514
|
+
const normalized = normalizeTelegramOutboundLinks(text);
|
|
627515
|
+
if (normalized.length <= maxLength) return normalized;
|
|
627516
|
+
if (maxLength <= suffix.length) return normalized.slice(0, maxLength);
|
|
627517
|
+
let cut = maxLength - suffix.length;
|
|
627518
|
+
const span = telegramUrlSpanAt(normalized, cut);
|
|
627519
|
+
if (span) {
|
|
627520
|
+
cut = span.start;
|
|
627521
|
+
const tagStart = normalized.lastIndexOf("<", cut);
|
|
627522
|
+
const tagEnd = normalized.lastIndexOf(">", cut);
|
|
627523
|
+
if (tagStart > tagEnd) cut = tagStart;
|
|
627524
|
+
}
|
|
627525
|
+
return `${normalized.slice(0, Math.max(0, cut)).trimEnd()}${suffix}`;
|
|
627526
|
+
}
|
|
627468
627527
|
function splitTelegramMessageText(text, maxLength = 3900) {
|
|
627469
627528
|
const trimmed = text.trim();
|
|
627470
627529
|
if (!trimmed) return [];
|
|
@@ -627611,16 +627670,14 @@ function dedupeTelegramVisibleReply(text) {
|
|
|
627611
627670
|
return out.join(" ").trim();
|
|
627612
627671
|
}
|
|
627613
627672
|
function truncateTelegramContext(text, maxLength) {
|
|
627614
|
-
const trimmed = text.trim();
|
|
627673
|
+
const trimmed = normalizeTelegramOutboundLinks(text).trim();
|
|
627615
627674
|
if (trimmed.length <= maxLength) return trimmed;
|
|
627616
|
-
return
|
|
627617
|
-
|
|
627618
|
-
[Telegram context truncated; use tools for full detail.]`;
|
|
627675
|
+
return truncateTelegramUrlSafe(trimmed, maxLength, "\n\n[Telegram context truncated; use tools for full detail.]");
|
|
627619
627676
|
}
|
|
627620
627677
|
function truncateTelegramContextLine(text, maxLength = TELEGRAM_CONTEXT_LINE_LIMIT) {
|
|
627621
|
-
const compact3 = stripTelegramHiddenThinking(text).replace(/\s+/g, " ").trim();
|
|
627678
|
+
const compact3 = normalizeTelegramOutboundLinks(stripTelegramHiddenThinking(text)).replace(/\s+/g, " ").trim();
|
|
627622
627679
|
if (compact3.length <= maxLength) return compact3;
|
|
627623
|
-
return
|
|
627680
|
+
return truncateTelegramUrlSafe(compact3, maxLength);
|
|
627624
627681
|
}
|
|
627625
627682
|
function telegramRegexEscape(text) {
|
|
627626
627683
|
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -628647,7 +628704,7 @@ function renderTelegramSubAgentError(username, error) {
|
|
|
628647
628704
|
process.stdout.write(` ${c3.dim("│")} ${c3.magenta("✘")} @${username}: ${c3.dim(preview)}
|
|
628648
628705
|
`);
|
|
628649
628706
|
}
|
|
628650
|
-
var TELEGRAM_TOOL_ACTION_GROUPS, TELEGRAM_TOOL_ACTION_GROUP, TELEGRAM_TOOL_MUTATING_GROUPS, DEFAULT_TELEGRAM_TOOL_GROUP_POLICY, TELEGRAM_TOOL_BUTTON_LABELS, TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, TELEGRAM_PUBLIC_SOUL_PROFILE, TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT, TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT, TELEGRAM_PUBLIC_VISION_STACK_CONTRACT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_EXTERNAL_ACQUISITION_CONTRACT, TELEGRAM_LINK_INTEGRITY_CONTRACT, TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT, TELEGRAM_INTERACTION_DECISION_MINIMAL_SCHEMA, TELEGRAM_INTERACTION_DECISION_REPAIR_SCHEMA, TELEGRAM_CHAT_REPLY_RESPONSE_FORMAT, TELEGRAM_SPACED_URL_RE, TELEGRAM_STUCK_SELF_TALK_PREFIXES, TELEGRAM_CHAT_HISTORY_LIMIT, TELEGRAM_CONTEXT_RECENT_DEFAULT, TELEGRAM_CONTEXT_LINE_LIMIT, TELEGRAM_CONTEXT_SAMPLE_LIMIT, TELEGRAM_MEMORY_CARD_LIMIT, TELEGRAM_MEMORY_NOTE_LIMIT, TELEGRAM_ASSOCIATIVE_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_USER_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_ACTION_LIMIT, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT, TELEGRAM_MEMORY_STOPWORDS, TELEGRAM_MEMORY_GENERIC_QUERY_TOKENS, TELEGRAM_SUB_AGENT_BOUNDED_OPTIONS, TELEGRAM_SUB_AGENT_DEFAULT_LIMIT, TELEGRAM_SUB_AGENT_MAX_LIMIT, TELEGRAM_SUB_AGENT_BURST_CONTEXT_LIMIT, TELEGRAM_PUBLIC_HELP_COMMANDS2, TELEGRAM_REMINDER_SLASH_COMMANDS, TELEGRAM_REFLECTION_SLASH_COMMANDS, TELEGRAM_PUBLIC_BOT_COMMAND_NAMES, TELEGRAM_IMAGE_EXTENSIONS, MEDIA_CACHE_TTL_MS, TELEGRAM_CHANNEL_DMN_SWEEP_MS, TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS, TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS, TELEGRAM_CHANNEL_DMN_MIN_MESSAGES, TELEGRAM_ALLOWED_UPDATES, TELEGRAM_PUBLIC_TOOL_QUOTAS, TelegramBridge;
|
|
628707
|
+
var TELEGRAM_TOOL_ACTION_GROUPS, TELEGRAM_TOOL_ACTION_GROUP, TELEGRAM_TOOL_MUTATING_GROUPS, DEFAULT_TELEGRAM_TOOL_GROUP_POLICY, TELEGRAM_TOOL_BUTTON_LABELS, TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, TELEGRAM_PUBLIC_SOUL_PROFILE, TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT, TELEGRAM_PUBLIC_MEMORY_SCOPE_CONTRACT, TELEGRAM_PUBLIC_VISION_STACK_CONTRACT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_EXTERNAL_ACQUISITION_CONTRACT, TELEGRAM_LINK_INTEGRITY_CONTRACT, TELEGRAM_INTERACTION_DECISION_RESPONSE_FORMAT, TELEGRAM_INTERACTION_DECISION_MINIMAL_SCHEMA, TELEGRAM_INTERACTION_DECISION_REPAIR_SCHEMA, TELEGRAM_CHAT_REPLY_RESPONSE_FORMAT, TELEGRAM_SPACED_URL_RE, TELEGRAM_HTTP_URL_RE, TELEGRAM_STUCK_SELF_TALK_PREFIXES, TELEGRAM_CHAT_HISTORY_LIMIT, TELEGRAM_CONTEXT_RECENT_DEFAULT, TELEGRAM_CONTEXT_LINE_LIMIT, TELEGRAM_CONTEXT_SAMPLE_LIMIT, TELEGRAM_MEMORY_CARD_LIMIT, TELEGRAM_MEMORY_NOTE_LIMIT, TELEGRAM_ASSOCIATIVE_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_USER_FACT_LIMIT, TELEGRAM_ASSOCIATIVE_ACTION_LIMIT, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT, TELEGRAM_MEMORY_STOPWORDS, TELEGRAM_MEMORY_GENERIC_QUERY_TOKENS, TELEGRAM_SUB_AGENT_BOUNDED_OPTIONS, TELEGRAM_SUB_AGENT_DEFAULT_LIMIT, TELEGRAM_SUB_AGENT_MAX_LIMIT, TELEGRAM_SUB_AGENT_BURST_CONTEXT_LIMIT, TELEGRAM_PUBLIC_HELP_COMMANDS2, TELEGRAM_REMINDER_SLASH_COMMANDS, TELEGRAM_REFLECTION_SLASH_COMMANDS, TELEGRAM_PUBLIC_BOT_COMMAND_NAMES, TELEGRAM_IMAGE_EXTENSIONS, MEDIA_CACHE_TTL_MS, TELEGRAM_CHANNEL_DMN_SWEEP_MS, TELEGRAM_CHANNEL_DMN_IDLE_AFTER_MS, TELEGRAM_CHANNEL_DMN_MIN_INTERVAL_MS, TELEGRAM_CHANNEL_DMN_MIN_MESSAGES, TELEGRAM_ALLOWED_UPDATES, TELEGRAM_PUBLIC_TOOL_QUOTAS, TelegramBridge;
|
|
628651
628708
|
var init_telegram_bridge = __esm({
|
|
628652
628709
|
"packages/cli/src/tui/telegram-bridge.ts"() {
|
|
628653
628710
|
"use strict";
|
|
@@ -628947,6 +629004,7 @@ Telegram link integrity contract:
|
|
|
628947
629004
|
}
|
|
628948
629005
|
};
|
|
628949
629006
|
TELEGRAM_SPACED_URL_RE = /\bhttps?:\/\/\s*[A-Za-z0-9-]+(?:\s*\.\s*[A-Za-z0-9-]+)+(?:\s*:\s*\d+)?(?:[/?#][^\s<>"'()[\]{}]*)?/gi;
|
|
629007
|
+
TELEGRAM_HTTP_URL_RE = /\bhttps?:\/\/[^\s<>"'()[\]{}]+/gi;
|
|
628950
629008
|
TELEGRAM_STUCK_SELF_TALK_PREFIXES = [
|
|
628951
629009
|
/^i'?ve been stuck for\b/i,
|
|
628952
629010
|
/^i am (still |currently )?stuck\b/i,
|
|
@@ -630230,9 +630288,8 @@ ${message2}`)
|
|
|
630230
630288
|
return reply;
|
|
630231
630289
|
}
|
|
630232
630290
|
quoteTelegramContextBlock(text, maxLength = 1800) {
|
|
630233
|
-
const clean5 = stripTelegramHiddenThinking(text).trim();
|
|
630234
|
-
const clipped = clean5.length > maxLength ?
|
|
630235
|
-
[reply context truncated]` : clean5;
|
|
630291
|
+
const clean5 = normalizeTelegramOutboundLinks(stripTelegramHiddenThinking(text)).trim();
|
|
630292
|
+
const clipped = clean5.length > maxLength ? truncateTelegramUrlSafe(clean5, maxLength, "\n[reply context truncated]") : clean5;
|
|
630236
630293
|
return clipped.split(/\r?\n/).map((line) => `> ${line}`).join("\n");
|
|
630237
630294
|
}
|
|
630238
630295
|
buildTelegramCurrentReplyContext(sessionKey, msg) {
|
|
@@ -631620,7 +631677,7 @@ ${mediaContext}` : ""
|
|
|
631620
631677
|
recordTelegramUserMessage(msg, mode, textOverride) {
|
|
631621
631678
|
const sessionKey = this.sessionKeyForMessage(msg);
|
|
631622
631679
|
const mediaSummary = summarizeTelegramMessageAttachments(msg);
|
|
631623
|
-
const text = (textOverride ?? msg.text ?? "").trim() || mediaSummary || "[non-text Telegram message]";
|
|
631680
|
+
const text = normalizeTelegramOutboundLinks((textOverride ?? msg.text ?? "").trim()) || mediaSummary || "[non-text Telegram message]";
|
|
631624
631681
|
this.ensureTelegramConversationLoaded(sessionKey);
|
|
631625
631682
|
const history = this.chatHistory.get(sessionKey) ?? [];
|
|
631626
631683
|
const existing = Number.isFinite(msg.messageId) ? history.find(
|
|
@@ -631709,7 +631766,7 @@ ${mediaContext}` : ""
|
|
|
631709
631766
|
this.saveTelegramConversationState(sessionKey);
|
|
631710
631767
|
}
|
|
631711
631768
|
recordTelegramAssistantMessage(msg, text, mode, options2 = {}) {
|
|
631712
|
-
const clean5 = stripTelegramHiddenThinking(text).trim();
|
|
631769
|
+
const clean5 = normalizeTelegramOutboundLinks(stripTelegramHiddenThinking(text)).trim();
|
|
631713
631770
|
if (!clean5) return;
|
|
631714
631771
|
const sessionKey = this.sessionKeyForMessage(msg);
|
|
631715
631772
|
const entry = {
|
|
@@ -634729,7 +634786,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
634729
634786
|
*/
|
|
634730
634787
|
async editLiveMessage(chatId, messageId, html) {
|
|
634731
634788
|
const normalizedHtml = normalizeTelegramOutboundLinks(html);
|
|
634732
|
-
const truncated = normalizedHtml.length > 4e3 ? normalizedHtml
|
|
634789
|
+
const truncated = normalizedHtml.length > 4e3 ? truncateTelegramUrlSafe(normalizedHtml, 4e3, "\n\n<i>... (streaming)</i>") : normalizedHtml;
|
|
634733
634790
|
try {
|
|
634734
634791
|
const result = await this.apiCall("editMessageText", {
|
|
634735
634792
|
chat_id: chatId,
|
|
@@ -634743,7 +634800,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`);
|
|
|
634743
634800
|
} catch {
|
|
634744
634801
|
try {
|
|
634745
634802
|
const plain = normalizedHtml.replace(/<[^>]+>/g, "");
|
|
634746
|
-
const truncPlain = plain.length > 4e3 ? plain
|
|
634803
|
+
const truncPlain = plain.length > 4e3 ? truncateTelegramUrlSafe(plain, 4e3, "\n\n... (streaming)") : plain;
|
|
634747
634804
|
const result = await this.apiCall("editMessageText", {
|
|
634748
634805
|
chat_id: chatId,
|
|
634749
634806
|
message_id: messageId,
|
|
@@ -637185,7 +637242,7 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
637185
637242
|
reply_to_message_id: entry.replyToMessageId,
|
|
637186
637243
|
chat_type: entry.chatType,
|
|
637187
637244
|
chat_title: entry.chatTitle,
|
|
637188
|
-
text: redactTelegramLocalPaths(stripTelegramHiddenThinking(entry.text || ""))
|
|
637245
|
+
text: truncateTelegramUrlSafe(redactTelegramLocalPaths(stripTelegramHiddenThinking(entry.text || "")), 4e3)
|
|
637189
637246
|
};
|
|
637190
637247
|
if (entry.mediaSummary) {
|
|
637191
637248
|
safe["media_summary"] = redactTelegramLocalPaths(entry.mediaSummary);
|
|
@@ -637196,13 +637253,13 @@ Scoped workspace: ${scopedRoot}`,
|
|
|
637196
637253
|
source: entry.replyContext.source,
|
|
637197
637254
|
message_id: entry.replyContext.messageId,
|
|
637198
637255
|
sender: entry.replyContext.sender ? telegramReplySenderLabel(entry.replyContext.sender) : void 0,
|
|
637199
|
-
text: entry.replyContext.text ? redactTelegramLocalPaths(stripTelegramHiddenThinking(entry.replyContext.text))
|
|
637200
|
-
caption: entry.replyContext.caption ? redactTelegramLocalPaths(entry.replyContext.caption)
|
|
637256
|
+
text: entry.replyContext.text ? truncateTelegramUrlSafe(redactTelegramLocalPaths(stripTelegramHiddenThinking(entry.replyContext.text)), 2e3) : void 0,
|
|
637257
|
+
caption: entry.replyContext.caption ? truncateTelegramUrlSafe(redactTelegramLocalPaths(entry.replyContext.caption), 1200) : void 0,
|
|
637201
637258
|
media_summary: entry.replyContext.mediaSummary ? redactTelegramLocalPaths(entry.replyContext.mediaSummary) : void 0
|
|
637202
637259
|
};
|
|
637203
637260
|
}
|
|
637204
637261
|
if (includePrivate && entry.generatedMediaPromptInfo?.originalPrompt) {
|
|
637205
|
-
safe["generated_image_prompt"] = redactTelegramLocalPaths(entry.generatedMediaPromptInfo.originalPrompt)
|
|
637262
|
+
safe["generated_image_prompt"] = truncateTelegramUrlSafe(redactTelegramLocalPaths(entry.generatedMediaPromptInfo.originalPrompt), 2e3);
|
|
637206
637263
|
}
|
|
637207
637264
|
return safe;
|
|
637208
637265
|
}
|
|
@@ -638834,7 +638891,7 @@ Content-Type: ${mimeForPath(pathOrFileId, field === "photo" ? "image" : "video")
|
|
|
638834
638891
|
*/
|
|
638835
638892
|
async answerGuestQuery(guestQueryId, text, options2 = {}) {
|
|
638836
638893
|
const normalizedText = normalizeTelegramOutboundLinks(text);
|
|
638837
|
-
const truncated = normalizedText.length > 4e3 ? normalizedText
|
|
638894
|
+
const truncated = normalizedText.length > 4e3 ? truncateTelegramUrlSafe(normalizedText, 4e3, "\n\n... (truncated)") : normalizedText;
|
|
638838
638895
|
const inputMessageContent = {
|
|
638839
638896
|
message_text: truncated
|
|
638840
638897
|
};
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.173",
|
|
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.173",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED