open-agents-ai 0.187.586 → 0.187.588
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 +223 -13
- package/npm-shrinkwrap.json +9 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -514656,7 +514656,8 @@ function evaluate(inputs) {
|
|
|
514656
514656
|
return {
|
|
514657
514657
|
decision: "observer_block",
|
|
514658
514658
|
reason: "Littleman observer flagged this fingerprint as redundant",
|
|
514659
|
-
cachedResult: cached ?
|
|
514659
|
+
cachedResult: cached ? `[CACHED RESULT — you already have this information from a prior call. Do NOT call this tool again with the same arguments.]
|
|
514660
|
+
${cached.result}` : null
|
|
514660
514661
|
};
|
|
514661
514662
|
}
|
|
514662
514663
|
if (isReadLike) {
|
|
@@ -514672,10 +514673,12 @@ function evaluate(inputs) {
|
|
|
514672
514673
|
blockMessage: buildForceProgressBlockMessage(proposedCall, hits)
|
|
514673
514674
|
};
|
|
514674
514675
|
}
|
|
514676
|
+
const cachedEnvelope = `[CACHED RESULT — you already have this information from a prior call. Do NOT call this tool again with the same arguments.]
|
|
514677
|
+
${cached.result}`;
|
|
514675
514678
|
return {
|
|
514676
514679
|
decision: "serve_cached",
|
|
514677
514680
|
reason: cached.compacted ? "post-compaction cache re-serve" : `duplicate call #${hits} (still under ${threshold}-hit gate)`,
|
|
514678
|
-
cachedResult:
|
|
514681
|
+
cachedResult: cachedEnvelope,
|
|
514679
514682
|
compacted: cached.compacted,
|
|
514680
514683
|
hitNumber: hits
|
|
514681
514684
|
};
|
|
@@ -529241,14 +529244,15 @@ ${body}`;
|
|
|
529241
529244
|
proactivePrune(messages2, currentTurn) {
|
|
529242
529245
|
if (process.env["OA_DISABLE_PROACTIVE_PRUNE"] === "1")
|
|
529243
529246
|
return;
|
|
529244
|
-
const AGED_FILE_READ_TURNS =
|
|
529245
|
-
const AGED_SHELL_TURNS =
|
|
529247
|
+
const AGED_FILE_READ_TURNS = 20;
|
|
529248
|
+
const AGED_SHELL_TURNS = 12;
|
|
529246
529249
|
const ERROR_MARKERS = /(?:error|fail|exception|traceback|enoent|enotfound|exit code [^0]|status[: ]+1\d?\d?)/i;
|
|
529247
529250
|
const PRUNE_PREFIX = "[Tool result cleared";
|
|
529248
529251
|
const DEDUPE_PREFIX = "[deduped — same call as turn";
|
|
529249
529252
|
const FILE_AGED_PREFIX = "[file_read aged out, summary:";
|
|
529250
529253
|
const SHELL_AGED_PREFIX = "[shell succeeded, output pruned —";
|
|
529251
529254
|
const seen = /* @__PURE__ */ new Map();
|
|
529255
|
+
const seenResource = /* @__PURE__ */ new Map();
|
|
529252
529256
|
const pending = [];
|
|
529253
529257
|
let scanTurn = 0;
|
|
529254
529258
|
for (let i2 = 0; i2 < messages2.length; i2++) {
|
|
@@ -529293,7 +529297,26 @@ ${body}`;
|
|
|
529293
529297
|
}
|
|
529294
529298
|
seen.set(fp, { turn: scanTurn, idx: resultIdx });
|
|
529295
529299
|
const ageTurns = currentTurn - scanTurn;
|
|
529296
|
-
|
|
529300
|
+
const wasRecentlyWritten = (() => {
|
|
529301
|
+
try {
|
|
529302
|
+
const o2 = JSON.parse(tc.function.arguments || "{}");
|
|
529303
|
+
const p2 = String(o2.path ?? o2.file ?? "");
|
|
529304
|
+
for (let k = Math.max(0, i2 - 20); k < i2; k++) {
|
|
529305
|
+
const m2 = messages2[k];
|
|
529306
|
+
if (m2.role === "assistant" && m2.tool_calls) {
|
|
529307
|
+
for (const tc2 of m2.tool_calls) {
|
|
529308
|
+
if ((tc2.function.name === "file_edit" || tc2.function.name === "file_write" || tc2.function.name === "file_patch") && tc2.function.arguments?.includes(p2)) {
|
|
529309
|
+
return true;
|
|
529310
|
+
}
|
|
529311
|
+
}
|
|
529312
|
+
}
|
|
529313
|
+
}
|
|
529314
|
+
return false;
|
|
529315
|
+
} catch {
|
|
529316
|
+
return false;
|
|
529317
|
+
}
|
|
529318
|
+
})();
|
|
529319
|
+
if (name10 === "file_read" && ageTurns > AGED_FILE_READ_TURNS && content.length > 200 && !wasRecentlyWritten) {
|
|
529297
529320
|
const pathArg = (() => {
|
|
529298
529321
|
try {
|
|
529299
529322
|
const o2 = JSON.parse(tc.function.arguments || "{}");
|
|
@@ -529302,11 +529325,15 @@ ${body}`;
|
|
|
529302
529325
|
return "?";
|
|
529303
529326
|
}
|
|
529304
529327
|
})();
|
|
529305
|
-
const
|
|
529328
|
+
const lines = content.split("\n");
|
|
529329
|
+
const lineCount = lines.length;
|
|
529330
|
+
const contentPreview = content.slice(0, 500);
|
|
529306
529331
|
pending.push({
|
|
529307
529332
|
idx: resultIdx,
|
|
529308
529333
|
reason: "aged_file",
|
|
529309
|
-
replacement: `${FILE_AGED_PREFIX} path=${pathArg},
|
|
529334
|
+
replacement: `${FILE_AGED_PREFIX} path=${pathArg}, ${lineCount} lines, ${content.length} chars]
|
|
529335
|
+
${contentPreview}
|
|
529336
|
+
[End of aged file_read preview — do NOT re-read this file, use the content above]`
|
|
529310
529337
|
});
|
|
529311
529338
|
continue;
|
|
529312
529339
|
}
|
|
@@ -530113,6 +530140,61 @@ ${latest.output || ""}`.trim();
|
|
|
530113
530140
|
sections.push(`(turn ${turn} — this block is regenerated every turn from your tool history)`);
|
|
530114
530141
|
return sections.join("\n");
|
|
530115
530142
|
}
|
|
530143
|
+
/**
|
|
530144
|
+
* REG-62: Pre-call knowledge injection. Builds a concise system message
|
|
530145
|
+
* summarizing what the model has already read/searched/listed so it
|
|
530146
|
+
* doesn't re-call those tools. This is the PRIMARY fix for duplicate
|
|
530147
|
+
* tool calls — the model re-reads because it can't find prior results
|
|
530148
|
+
* in the long transcript. By injecting a summary right before the LLM
|
|
530149
|
+
* call, the model knows what it already has.
|
|
530150
|
+
*/
|
|
530151
|
+
_renderKnowledgeBlock(recentToolResults) {
|
|
530152
|
+
if (recentToolResults.size === 0)
|
|
530153
|
+
return null;
|
|
530154
|
+
const filesRead = [];
|
|
530155
|
+
const dirsListed = [];
|
|
530156
|
+
const searches = [];
|
|
530157
|
+
const shells = [];
|
|
530158
|
+
for (const [fingerprint, entry] of recentToolResults) {
|
|
530159
|
+
if (entry.compacted)
|
|
530160
|
+
continue;
|
|
530161
|
+
const colonIdx = fingerprint.indexOf(":");
|
|
530162
|
+
const toolName = colonIdx > 0 ? fingerprint.slice(0, colonIdx) : fingerprint;
|
|
530163
|
+
if (toolName === "file_read") {
|
|
530164
|
+
const pathMatch = fingerprint.match(/path=([^,\s]+)/);
|
|
530165
|
+
if (pathMatch?.[1])
|
|
530166
|
+
filesRead.push(pathMatch[1]);
|
|
530167
|
+
} else if (toolName === "list_directory") {
|
|
530168
|
+
const pathMatch = fingerprint.match(/path=([^,\s]+)/);
|
|
530169
|
+
if (pathMatch?.[1])
|
|
530170
|
+
dirsListed.push(pathMatch[1]);
|
|
530171
|
+
} else if (toolName === "grep_search" || toolName === "find_files") {
|
|
530172
|
+
searches.push(toolName);
|
|
530173
|
+
} else if (toolName === "shell" || toolName === "shell_async") {
|
|
530174
|
+
const cmdMatch = fingerprint.match(/cmd=([^,\s]+)/);
|
|
530175
|
+
shells.push(cmdMatch?.[1] ?? toolName);
|
|
530176
|
+
}
|
|
530177
|
+
}
|
|
530178
|
+
const sections = ["[KNOWLEDGE — you already have these results in context above. Do NOT re-call these tools for the same targets:]"];
|
|
530179
|
+
if (filesRead.length > 0) {
|
|
530180
|
+
const unique = [...new Set(filesRead)].slice(0, 30);
|
|
530181
|
+
sections.push(`Files already read (${unique.length}): ${unique.join(", ")}`);
|
|
530182
|
+
}
|
|
530183
|
+
if (dirsListed.length > 0) {
|
|
530184
|
+
const unique = [...new Set(dirsListed)].slice(0, 15);
|
|
530185
|
+
sections.push(`Directories already listed (${unique.length}): ${unique.join(", ")}`);
|
|
530186
|
+
}
|
|
530187
|
+
if (searches.length > 0) {
|
|
530188
|
+
sections.push(`Searches already run: ${searches.length}`);
|
|
530189
|
+
}
|
|
530190
|
+
if (shells.length > 0) {
|
|
530191
|
+
const unique = [...new Set(shells)].slice(0, 15);
|
|
530192
|
+
sections.push(`Shell commands already executed (${unique.length}): ${unique.join(", ")}`);
|
|
530193
|
+
}
|
|
530194
|
+
if (sections.length <= 1)
|
|
530195
|
+
return null;
|
|
530196
|
+
return sections.join("\n");
|
|
530197
|
+
}
|
|
530116
530198
|
makePhaseSummarizer() {
|
|
530117
530199
|
if (process.env["OA_DISABLE_PHASE_SUMMARIZER"] === "1")
|
|
530118
530200
|
return null;
|
|
@@ -530341,6 +530423,46 @@ ${blob}
|
|
|
530341
530423
|
_buildToolFingerprint(name10, args) {
|
|
530342
530424
|
return `${name10}:${this._buildExactArgsKey(args)}`;
|
|
530343
530425
|
}
|
|
530426
|
+
/**
|
|
530427
|
+
* REG-62: Build a resource-level key for semantic dedup.
|
|
530428
|
+
*
|
|
530429
|
+
* Unlike _buildToolFingerprint (exact args match), this normalizes
|
|
530430
|
+
* different calls that target the SAME resource:
|
|
530431
|
+
* file_read("foo.ts") == file_read("foo.ts", offset=10)
|
|
530432
|
+
* file_read("foo.ts") == shell("cat foo.ts")
|
|
530433
|
+
* grep_search("x", path="src") == grep_search("x", path="src", include="*.ts")
|
|
530434
|
+
*
|
|
530435
|
+
* Returns empty string if no resource key can be extracted (non-dedupable).
|
|
530436
|
+
*/
|
|
530437
|
+
_buildResourceKey(name10, args) {
|
|
530438
|
+
const a2 = args ?? {};
|
|
530439
|
+
if (name10 === "file_read") {
|
|
530440
|
+
const p2 = String(a2.path ?? a2.file ?? "");
|
|
530441
|
+
return p2 ? `resource:file:${p2}` : "";
|
|
530442
|
+
}
|
|
530443
|
+
if (name10 === "shell" || name10 === "shell_async") {
|
|
530444
|
+
const cmd = String(a2.command ?? a2.cmd ?? "");
|
|
530445
|
+
const catMatch = cmd.match(/(?:cat|head|tail|type|less|more)\s+["']?([^\s"';&|>]+)/);
|
|
530446
|
+
if (catMatch?.[1])
|
|
530447
|
+
return `resource:file:${catMatch[1]}`;
|
|
530448
|
+
return "";
|
|
530449
|
+
}
|
|
530450
|
+
if (name10 === "grep_search") {
|
|
530451
|
+
const p2 = String(a2.path ?? ".");
|
|
530452
|
+
const pat = String(a2.pattern ?? "");
|
|
530453
|
+
return `resource:grep:${p2}:${pat}`;
|
|
530454
|
+
}
|
|
530455
|
+
if (name10 === "find_files") {
|
|
530456
|
+
const p2 = String(a2.path ?? ".");
|
|
530457
|
+
const pat = String(a2.pattern ?? "");
|
|
530458
|
+
return `resource:find:${p2}:${pat}`;
|
|
530459
|
+
}
|
|
530460
|
+
if (name10 === "list_directory") {
|
|
530461
|
+
const p2 = String(a2.path ?? ".");
|
|
530462
|
+
return `resource:ls:${p2}`;
|
|
530463
|
+
}
|
|
530464
|
+
return "";
|
|
530465
|
+
}
|
|
530344
530466
|
_formatExactArgValue(value2) {
|
|
530345
530467
|
const canonical = this._canonicalArgValue(value2);
|
|
530346
530468
|
const oneLine = canonical.replace(/\r/g, "\\r").replace(/\n/g, "\\n");
|
|
@@ -532566,6 +532688,9 @@ ${memoryLines.join("\n")}`
|
|
|
532566
532688
|
const progressBlock = this._renderProgressNudgeBlock(turn);
|
|
532567
532689
|
if (progressBlock)
|
|
532568
532690
|
_injections.push(progressBlock);
|
|
532691
|
+
const knowledgeBlock = this._renderKnowledgeBlock(recentToolResults);
|
|
532692
|
+
if (knowledgeBlock)
|
|
532693
|
+
_injections.push(knowledgeBlock);
|
|
532569
532694
|
if (_injections.length > 0) {
|
|
532570
532695
|
const reqMsgs = chatRequest.messages;
|
|
532571
532696
|
if (Array.isArray(reqMsgs)) {
|
|
@@ -579023,12 +579148,9 @@ sleep 1
|
|
|
579023
579148
|
if (ctx3.isBlessed?.()) {
|
|
579024
579149
|
ctx3.blessStop?.();
|
|
579025
579150
|
}
|
|
579026
|
-
if (ctx3.isTelegramActive?.()) {
|
|
579027
|
-
ctx3.telegramStop?.();
|
|
579028
|
-
}
|
|
579029
579151
|
const clearedQueue = ctx3.clearQueuedPrompts?.() ?? 0;
|
|
579030
579152
|
if (!ctx3.hasActiveTask?.()) {
|
|
579031
|
-
if (!ctx3.isBlessed?.()
|
|
579153
|
+
if (!ctx3.isBlessed?.()) {
|
|
579032
579154
|
renderWarning(clearedQueue > 0 ? `No active task to stop. Cleared ${clearedQueue} queued prompt(s).` : "No active task to stop.");
|
|
579033
579155
|
}
|
|
579034
579156
|
return "handled";
|
|
@@ -591030,6 +591152,60 @@ function renderTelegramLiveProgressHTML(progressLines, accumulated) {
|
|
|
591030
591152
|
}
|
|
591031
591153
|
return progressLines.slice(-6).map((line) => line.trim()).filter(Boolean).join("\n");
|
|
591032
591154
|
}
|
|
591155
|
+
function telegramSyntheticHelpSignatures() {
|
|
591156
|
+
return [
|
|
591157
|
+
{ signature: "/help", description: "Show Telegram command help" },
|
|
591158
|
+
{ signature: "/start", description: "Show Telegram bridge status and authentication instructions" },
|
|
591159
|
+
{ signature: "/auth <code>", description: "Authenticate this Telegram user as bot admin using the TUI code" }
|
|
591160
|
+
];
|
|
591161
|
+
}
|
|
591162
|
+
function telegramHelpCommandAllowed(cmd, scope) {
|
|
591163
|
+
if (scope === "admin") return cmd.implementationStatus === "implemented";
|
|
591164
|
+
if (TELEGRAM_PUBLIC_HELP_COMMANDS.has(cmd.name)) return true;
|
|
591165
|
+
return cmd.surfaces.agentTool && !cmd.safety.secretBearing && !cmd.safety.destructive && !cmd.safety.profileGated;
|
|
591166
|
+
}
|
|
591167
|
+
function buildTelegramHelpHTML(scope, maxPublicCommands = 24) {
|
|
591168
|
+
const commands = listCommandRegistry({ includePlanned: false }).filter((cmd) => telegramHelpCommandAllowed(cmd, scope));
|
|
591169
|
+
const signatures = [
|
|
591170
|
+
...telegramSyntheticHelpSignatures(),
|
|
591171
|
+
...commands.flatMap((cmd) => cmd.signatures)
|
|
591172
|
+
];
|
|
591173
|
+
const seen = /* @__PURE__ */ new Set();
|
|
591174
|
+
const unique = signatures.filter((sig) => {
|
|
591175
|
+
if (seen.has(sig.signature)) return false;
|
|
591176
|
+
seen.add(sig.signature);
|
|
591177
|
+
return true;
|
|
591178
|
+
});
|
|
591179
|
+
const visible = scope === "public" ? unique.slice(0, maxPublicCommands) : unique;
|
|
591180
|
+
const lines = [
|
|
591181
|
+
`<b>Commands (${scope === "admin" ? "admin full scope" : "public secure scope"})</b>`,
|
|
591182
|
+
"",
|
|
591183
|
+
...visible.map(
|
|
591184
|
+
(sig) => `<code>${escapeTelegramHTML(sig.signature)}</code> - ${escapeTelegramHTML(sig.description)}`
|
|
591185
|
+
)
|
|
591186
|
+
];
|
|
591187
|
+
if (scope === "public" && unique.length > visible.length) {
|
|
591188
|
+
lines.push("");
|
|
591189
|
+
lines.push(`Public scope truncated to ${visible.length} safe commands. Authenticate as admin for full command help.`);
|
|
591190
|
+
}
|
|
591191
|
+
return lines.join("\n");
|
|
591192
|
+
}
|
|
591193
|
+
function splitTelegramHTMLMessage(html, maxLength = 3600) {
|
|
591194
|
+
const chunks = [];
|
|
591195
|
+
let current = "";
|
|
591196
|
+
for (const line of html.split("\n")) {
|
|
591197
|
+
const candidate = current ? `${current}
|
|
591198
|
+
${line}` : line;
|
|
591199
|
+
if (candidate.length > maxLength && current) {
|
|
591200
|
+
chunks.push(current);
|
|
591201
|
+
current = line;
|
|
591202
|
+
} else {
|
|
591203
|
+
current = candidate;
|
|
591204
|
+
}
|
|
591205
|
+
}
|
|
591206
|
+
if (current.trim()) chunks.push(current);
|
|
591207
|
+
return chunks.length > 0 ? chunks : [html];
|
|
591208
|
+
}
|
|
591033
591209
|
function normalizeTelegramChatId(value2) {
|
|
591034
591210
|
if (typeof value2 === "number" || typeof value2 === "string") return value2;
|
|
591035
591211
|
return 0;
|
|
@@ -591374,7 +591550,7 @@ function renderTelegramSubAgentError(username, error) {
|
|
|
591374
591550
|
process.stdout.write(` ${c3.dim("⎿")} ${c3.red("✘")} @${username}: ${c3.dim(preview)}
|
|
591375
591551
|
`);
|
|
591376
591552
|
}
|
|
591377
|
-
var TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_ACTION_INTENT_RE, TELEGRAM_CODEBASE_CONTEXT_RE, TELEGRAM_COMMANDISH_RE, TELEGRAM_CHAT_INTENT_RE, MEDIA_CACHE_TTL_MS, TelegramBridge;
|
|
591553
|
+
var TELEGRAM_SAFETY_PROMPT, ADMIN_DM_PROMPT, ADMIN_GROUP_PROMPT, GROUP_REPLY_DISCRETION_PROMPT, TELEGRAM_CHAT_MODE_PROMPT, ADMIN_CHAT_PROFILE_PROMPT, TELEGRAM_ACTION_RESPONSE_CONTRACT, TELEGRAM_ACTION_INTENT_RE, TELEGRAM_CODEBASE_CONTEXT_RE, TELEGRAM_COMMANDISH_RE, TELEGRAM_CHAT_INTENT_RE, TELEGRAM_PUBLIC_HELP_COMMANDS, MEDIA_CACHE_TTL_MS, TelegramBridge;
|
|
591378
591554
|
var init_telegram_bridge = __esm({
|
|
591379
591555
|
"packages/cli/src/tui/telegram-bridge.ts"() {
|
|
591380
591556
|
"use strict";
|
|
@@ -591384,6 +591560,7 @@ var init_telegram_bridge = __esm({
|
|
|
591384
591560
|
init_render();
|
|
591385
591561
|
init_tool_policy();
|
|
591386
591562
|
init_media_routing();
|
|
591563
|
+
init_command_registry();
|
|
591387
591564
|
TELEGRAM_SAFETY_PROMPT = `
|
|
591388
591565
|
CRITICAL SAFETY NOTICE — PUBLIC TELEGRAM CHANNEL
|
|
591389
591566
|
|
|
@@ -591465,6 +591642,7 @@ Telegram response contract:
|
|
|
591465
591642
|
TELEGRAM_CODEBASE_CONTEXT_RE = /\b(repo|repository|codebase|workspace|working directory|file|files|folder|directory|src|source|test|tests|package|pnpm|npm|node|git|branch|commit|pr|pull request|issue|shell|terminal|cli|command|function|class|component|endpoint|api)\b/i;
|
|
591466
591643
|
TELEGRAM_COMMANDISH_RE = /(^|\s)(pnpm|npm|node|git|rg|grep|sed|cat|ls|cd|mkdir|rm|mv|cp|curl|docker|pytest|vitest|tsc)\b/i;
|
|
591467
591644
|
TELEGRAM_CHAT_INTENT_RE = /\b(hi|hello|hey|thanks|thank you|lol|haha|joke|how are you|what's up|whats up|can you hear|are you there|explain|what is|what are|why|how does|tell me|opinion|quick question)\b/i;
|
|
591645
|
+
TELEGRAM_PUBLIC_HELP_COMMANDS = /* @__PURE__ */ new Set(["help", "start", "auth", "call"]);
|
|
591468
591646
|
MEDIA_CACHE_TTL_MS = 30 * 60 * 1e3;
|
|
591469
591647
|
TelegramBridge = class {
|
|
591470
591648
|
constructor(botToken, onMessage, agentConfig, repoRoot, toolPolicyConfig) {
|
|
@@ -591632,6 +591810,15 @@ Telegram response contract:
|
|
|
591632
591810
|
if (!canonical || canonical === botless) return input;
|
|
591633
591811
|
return `/${canonical}${trimmed.slice(first2.length)}`;
|
|
591634
591812
|
}
|
|
591813
|
+
telegramSlashName(input) {
|
|
591814
|
+
const first2 = input.trim().split(/\s+/)[0] ?? "";
|
|
591815
|
+
if (!first2.startsWith("/")) return "";
|
|
591816
|
+
return first2.slice(1).split("@")[0]?.toLowerCase() ?? "";
|
|
591817
|
+
}
|
|
591818
|
+
isTelegramHelpCommand(input) {
|
|
591819
|
+
const name10 = this.telegramSlashName(input);
|
|
591820
|
+
return name10 === "help" || name10 === "h" || name10 === "commands" || name10 === "cmds";
|
|
591821
|
+
}
|
|
591635
591822
|
isKnownTelegramSlash(input) {
|
|
591636
591823
|
const first2 = input.trim().split(/\s+/)[0] ?? "";
|
|
591637
591824
|
const botless = first2.startsWith("/") ? first2.slice(1).split("@")[0]?.toLowerCase() : "";
|
|
@@ -591658,6 +591845,25 @@ Telegram response contract:
|
|
|
591658
591845
|
canUseChatActions(msg) {
|
|
591659
591846
|
return !msg.guestQueryId && (typeof msg.chatId === "number" || String(msg.chatId).startsWith("@"));
|
|
591660
591847
|
}
|
|
591848
|
+
async replyWithTelegramHelp(msg, isAdmin) {
|
|
591849
|
+
const scope = isAdmin ? "admin" : "public";
|
|
591850
|
+
const chunks = splitTelegramHTMLMessage(buildTelegramHelpHTML(scope));
|
|
591851
|
+
if (msg.guestQueryId) {
|
|
591852
|
+
await this.answerGuestQuery(msg.guestQueryId, chunks[0] ?? "", { parseMode: "HTML" });
|
|
591853
|
+
return;
|
|
591854
|
+
}
|
|
591855
|
+
for (let i2 = 0; i2 < chunks.length; i2++) {
|
|
591856
|
+
const chunk = chunks[i2];
|
|
591857
|
+
if (i2 === 0) {
|
|
591858
|
+
await this.replyToTelegramMessage(msg, chunk, {
|
|
591859
|
+
html: true,
|
|
591860
|
+
replyToMessageId: msg.chatType !== "private" ? msg.messageId : void 0
|
|
591861
|
+
});
|
|
591862
|
+
} else {
|
|
591863
|
+
await this.sendMessageHTML(msg.chatId, chunk);
|
|
591864
|
+
}
|
|
591865
|
+
}
|
|
591866
|
+
}
|
|
591661
591867
|
recordChatHistory(sessionKey, entry) {
|
|
591662
591868
|
const existing = this.chatHistory.get(sessionKey) ?? [];
|
|
591663
591869
|
existing.push({ ...entry, ts: entry.ts ?? Date.now() });
|
|
@@ -591938,11 +592144,15 @@ ${TELEGRAM_SAFETY_PROMPT}`);
|
|
|
591938
592144
|
if (msg.text.trim().startsWith("/") && await this.handleAdminAuthCommand({ ...msg, text: normalizedCommandText })) {
|
|
591939
592145
|
return;
|
|
591940
592146
|
}
|
|
592147
|
+
const isAdmin = this.isAdminUser(msg);
|
|
592148
|
+
if (msg.text.trim().startsWith("/") && this.isTelegramHelpCommand(normalizedCommandText)) {
|
|
592149
|
+
await this.replyWithTelegramHelp(msg, isAdmin);
|
|
592150
|
+
return;
|
|
592151
|
+
}
|
|
591941
592152
|
if (!this.agentConfig || !this.repoRoot) {
|
|
591942
592153
|
this.onMessage(msg);
|
|
591943
592154
|
return;
|
|
591944
592155
|
}
|
|
591945
|
-
const isAdmin = this.isAdminUser(msg);
|
|
591946
592156
|
const toolContext = this.resolveToolContext(msg, isAdmin);
|
|
591947
592157
|
const isAdminDM = toolContext === "telegram-admin-dm";
|
|
591948
592158
|
const sessionKey = this.sessionKeyForMessage(msg);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-agents-ai",
|
|
3
|
-
"version": "0.187.
|
|
3
|
+
"version": "0.187.588",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "open-agents-ai",
|
|
9
|
-
"version": "0.187.
|
|
9
|
+
"version": "0.187.588",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
|
@@ -1914,12 +1914,12 @@
|
|
|
1914
1914
|
}
|
|
1915
1915
|
},
|
|
1916
1916
|
"node_modules/@types/node": {
|
|
1917
|
-
"version": "25.
|
|
1918
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.
|
|
1919
|
-
"integrity": "sha512-
|
|
1917
|
+
"version": "25.8.0",
|
|
1918
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.8.0.tgz",
|
|
1919
|
+
"integrity": "sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ==",
|
|
1920
1920
|
"license": "MIT",
|
|
1921
1921
|
"dependencies": {
|
|
1922
|
-
"undici-types": "
|
|
1922
|
+
"undici-types": ">=7.24.0 <7.24.7"
|
|
1923
1923
|
}
|
|
1924
1924
|
},
|
|
1925
1925
|
"node_modules/@types/sinon": {
|
|
@@ -6994,9 +6994,9 @@
|
|
|
6994
6994
|
}
|
|
6995
6995
|
},
|
|
6996
6996
|
"node_modules/undici-types": {
|
|
6997
|
-
"version": "7.
|
|
6998
|
-
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.
|
|
6999
|
-
"integrity": "sha512-
|
|
6997
|
+
"version": "7.24.6",
|
|
6998
|
+
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
|
|
6999
|
+
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
|
|
7000
7000
|
"license": "MIT"
|
|
7001
7001
|
},
|
|
7002
7002
|
"node_modules/unlimited-timeout": {
|
package/package.json
CHANGED