@integrity-labs/agt-cli 0.27.13 → 0.27.15
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/bin/agt.js +31 -12
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-GN4XPQWJ.js → chunk-F4NG4EXD.js} +37 -28
- package/dist/chunk-F4NG4EXD.js.map +1 -0
- package/dist/{chunk-YSBGIXJG.js → chunk-HT6EETEL.js} +1 -1
- package/dist/{chunk-Q4MWFZ5Y.js → chunk-LJEV2QHN.js} +9 -6
- package/dist/{chunk-Q4MWFZ5Y.js.map → chunk-LJEV2QHN.js.map} +1 -1
- package/dist/{claude-pair-runtime-ZBQKBBMT.js → claude-pair-runtime-OBAJZDXK.js} +2 -2
- package/dist/lib/manager-worker.js +7 -7
- package/dist/mcp/slack-channel.js +245 -82
- package/dist/mcp/telegram-channel.js +174 -27
- package/dist/{persistent-session-ICYFLUAM.js → persistent-session-SBSOZG74.js} +3 -3
- package/dist/{responsiveness-probe-WZNQ2762.js → responsiveness-probe-DU4IJ2RZ.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-GN4XPQWJ.js.map +0 -1
- /package/dist/{chunk-YSBGIXJG.js.map → chunk-HT6EETEL.js.map} +0 -0
- /package/dist/{claude-pair-runtime-ZBQKBBMT.js.map → claude-pair-runtime-OBAJZDXK.js.map} +0 -0
- /package/dist/{persistent-session-ICYFLUAM.js.map → persistent-session-SBSOZG74.js.map} +0 -0
- /package/dist/{responsiveness-probe-WZNQ2762.js.map → responsiveness-probe-DU4IJ2RZ.js.map} +0 -0
|
@@ -14298,8 +14298,8 @@ import {
|
|
|
14298
14298
|
createWriteStream,
|
|
14299
14299
|
existsSync as existsSync2,
|
|
14300
14300
|
mkdirSync as mkdirSync3,
|
|
14301
|
-
readFileSync as
|
|
14302
|
-
readdirSync,
|
|
14301
|
+
readFileSync as readFileSync3,
|
|
14302
|
+
readdirSync as readdirSync2,
|
|
14303
14303
|
renameSync as renameSync3,
|
|
14304
14304
|
statSync,
|
|
14305
14305
|
unlinkSync as unlinkSync3,
|
|
@@ -14307,7 +14307,7 @@ import {
|
|
|
14307
14307
|
writeFileSync as writeFileSync3
|
|
14308
14308
|
} from "fs";
|
|
14309
14309
|
import { homedir as homedir2 } from "os";
|
|
14310
|
-
import { join as
|
|
14310
|
+
import { join as join4 } from "path";
|
|
14311
14311
|
|
|
14312
14312
|
// src/channel-attachments.ts
|
|
14313
14313
|
import { homedir } from "os";
|
|
@@ -15925,13 +15925,109 @@ function readLockHolder(path) {
|
|
|
15925
15925
|
}
|
|
15926
15926
|
}
|
|
15927
15927
|
|
|
15928
|
+
// src/ack-reaction.ts
|
|
15929
|
+
import { readdirSync, readFileSync as readFileSync2 } from "fs";
|
|
15930
|
+
import { join as join3 } from "path";
|
|
15931
|
+
var REPLY_WEDGED_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
15932
|
+
var ACK_STARTUP_GRACE_MS = 6e4;
|
|
15933
|
+
function decideAckReaction(i) {
|
|
15934
|
+
if (!i.hasTarget) return "none";
|
|
15935
|
+
if (!i.integrationReady) return "undeliverable";
|
|
15936
|
+
if (i.tmux === "dead") return "undeliverable";
|
|
15937
|
+
if (!i.withinStartupGrace && i.claude === "dead") return "undeliverable";
|
|
15938
|
+
const threshold = i.pendingStaleThresholdMs ?? REPLY_WEDGED_THRESHOLD_MS;
|
|
15939
|
+
if (i.oldestPendingAgeMs != null && i.oldestPendingAgeMs > threshold) {
|
|
15940
|
+
return "undeliverable";
|
|
15941
|
+
}
|
|
15942
|
+
return "ack";
|
|
15943
|
+
}
|
|
15944
|
+
function oldestPendingMarkerAgeMs(dir, now = Date.now()) {
|
|
15945
|
+
if (!dir) return null;
|
|
15946
|
+
let names;
|
|
15947
|
+
try {
|
|
15948
|
+
names = readdirSync(dir);
|
|
15949
|
+
} catch {
|
|
15950
|
+
return null;
|
|
15951
|
+
}
|
|
15952
|
+
let oldest = null;
|
|
15953
|
+
for (const name of names) {
|
|
15954
|
+
if (!name.endsWith(".json")) continue;
|
|
15955
|
+
let receivedAt;
|
|
15956
|
+
try {
|
|
15957
|
+
const raw = JSON.parse(readFileSync2(join3(dir, name), "utf-8"));
|
|
15958
|
+
receivedAt = raw.received_at;
|
|
15959
|
+
} catch {
|
|
15960
|
+
continue;
|
|
15961
|
+
}
|
|
15962
|
+
if (!receivedAt) continue;
|
|
15963
|
+
const t = Date.parse(receivedAt);
|
|
15964
|
+
if (Number.isNaN(t)) continue;
|
|
15965
|
+
const age = now - t;
|
|
15966
|
+
if (age < 0) continue;
|
|
15967
|
+
if (oldest == null || age > oldest) oldest = age;
|
|
15968
|
+
}
|
|
15969
|
+
return oldest;
|
|
15970
|
+
}
|
|
15971
|
+
|
|
15972
|
+
// src/session-probe-runtime.ts
|
|
15973
|
+
import { execFileSync } from "child_process";
|
|
15974
|
+
function agentTmuxSessionName(codeName) {
|
|
15975
|
+
return `agt-${codeName}`;
|
|
15976
|
+
}
|
|
15977
|
+
function escapePgrepRegex(value) {
|
|
15978
|
+
return value.replace(/[.[\]{}()*+?^$|\\]/g, "\\$&");
|
|
15979
|
+
}
|
|
15980
|
+
function probeClaudeProcessInTmux(tmuxSession) {
|
|
15981
|
+
const escapedSession = escapePgrepRegex(tmuxSession);
|
|
15982
|
+
const pattern = `(^|[[:space:]])--name ${escapedSession}([[:space:]]|$)`;
|
|
15983
|
+
try {
|
|
15984
|
+
const out = execFileSync("pgrep", ["-f", "--", pattern], {
|
|
15985
|
+
encoding: "utf-8",
|
|
15986
|
+
timeout: 3e3
|
|
15987
|
+
}).trim();
|
|
15988
|
+
return out.length > 0 ? "alive" : "dead";
|
|
15989
|
+
} catch (err) {
|
|
15990
|
+
const e = err;
|
|
15991
|
+
if (e?.code === "ENOENT") return "unknown";
|
|
15992
|
+
return e?.status === 1 ? "dead" : "unknown";
|
|
15993
|
+
}
|
|
15994
|
+
}
|
|
15995
|
+
function probeTmuxSession(tmuxSession) {
|
|
15996
|
+
try {
|
|
15997
|
+
execFileSync("tmux", ["has-session", "-t", tmuxSession], {
|
|
15998
|
+
stdio: "ignore",
|
|
15999
|
+
timeout: 3e3
|
|
16000
|
+
});
|
|
16001
|
+
return "alive";
|
|
16002
|
+
} catch (err) {
|
|
16003
|
+
const e = err;
|
|
16004
|
+
if (e?.code === "ENOENT") return "unknown";
|
|
16005
|
+
return "dead";
|
|
16006
|
+
}
|
|
16007
|
+
}
|
|
16008
|
+
function probeAgentSession(codeName) {
|
|
16009
|
+
const session = agentTmuxSessionName(codeName);
|
|
16010
|
+
const tmux = probeTmuxSession(session);
|
|
16011
|
+
const claude = tmux === "alive" ? probeClaudeProcessInTmux(session) : tmux;
|
|
16012
|
+
return { tmux, claude };
|
|
16013
|
+
}
|
|
16014
|
+
var probeCache = /* @__PURE__ */ new Map();
|
|
16015
|
+
var SESSION_PROBE_TTL_MS = 15e3;
|
|
16016
|
+
function probeAgentSessionCached(codeName, ttlMs = SESSION_PROBE_TTL_MS, now = Date.now()) {
|
|
16017
|
+
const cached2 = probeCache.get(codeName);
|
|
16018
|
+
if (cached2 && now - cached2.at < ttlMs) return cached2.value;
|
|
16019
|
+
const value = probeAgentSession(codeName);
|
|
16020
|
+
probeCache.set(codeName, { at: now, value });
|
|
16021
|
+
return value;
|
|
16022
|
+
}
|
|
16023
|
+
|
|
15928
16024
|
// src/telegram-channel.ts
|
|
15929
16025
|
function redactId(id) {
|
|
15930
16026
|
return createHash("sha256").update(String(id)).digest("hex").slice(0, 8);
|
|
15931
16027
|
}
|
|
15932
16028
|
var BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN;
|
|
15933
16029
|
var AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
|
|
15934
|
-
var TELEGRAM_AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ?
|
|
16030
|
+
var TELEGRAM_AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? join4(homedir2(), ".augmented", AGENT_CODE_NAME) : null;
|
|
15935
16031
|
var AGT_HOST = process.env.AGT_HOST ?? null;
|
|
15936
16032
|
var AGT_API_KEY = process.env.AGT_API_KEY ?? null;
|
|
15937
16033
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID ?? null;
|
|
@@ -16015,9 +16111,9 @@ if (!BOT_TOKEN) {
|
|
|
16015
16111
|
var stderrLogStream = null;
|
|
16016
16112
|
if (AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown") {
|
|
16017
16113
|
try {
|
|
16018
|
-
const logDir =
|
|
16114
|
+
const logDir = join4(homedir2(), ".augmented", AGENT_CODE_NAME);
|
|
16019
16115
|
mkdirSync3(logDir, { recursive: true });
|
|
16020
|
-
stderrLogStream = createWriteStream(
|
|
16116
|
+
stderrLogStream = createWriteStream(join4(logDir, "telegram-channel-stderr.log"), {
|
|
16021
16117
|
flags: "a",
|
|
16022
16118
|
mode: 384
|
|
16023
16119
|
});
|
|
@@ -16098,7 +16194,42 @@ async function setMessageReaction(chatId, messageId, emoji2) {
|
|
|
16098
16194
|
);
|
|
16099
16195
|
}
|
|
16100
16196
|
}
|
|
16101
|
-
var
|
|
16197
|
+
var UNDELIVERABLE_NOTICE_THROTTLE_MS = 5 * 60 * 1e3;
|
|
16198
|
+
var lastUndeliverableNoticeAt = /* @__PURE__ */ new Map();
|
|
16199
|
+
async function notifyUndeliverable(chatId, messageId) {
|
|
16200
|
+
const key2 = String(chatId);
|
|
16201
|
+
const now = Date.now();
|
|
16202
|
+
const last = lastUndeliverableNoticeAt.get(key2);
|
|
16203
|
+
if (last != null && now - last < UNDELIVERABLE_NOTICE_THROTTLE_MS) return;
|
|
16204
|
+
lastUndeliverableNoticeAt.set(key2, now);
|
|
16205
|
+
try {
|
|
16206
|
+
const resp = await telegramApiCall(
|
|
16207
|
+
"sendMessage",
|
|
16208
|
+
{
|
|
16209
|
+
chat_id: chatId,
|
|
16210
|
+
text: "\u26A0\uFE0F I can't respond right now \u2014 I'll follow up once I'm back.",
|
|
16211
|
+
reply_to_message_id: Number(messageId),
|
|
16212
|
+
allow_sending_without_reply: true
|
|
16213
|
+
},
|
|
16214
|
+
1e4
|
|
16215
|
+
);
|
|
16216
|
+
if (!resp.ok) {
|
|
16217
|
+
process.stderr.write(
|
|
16218
|
+
`telegram-channel(${AGENT_CODE_NAME}): undeliverable notice failed (chat=${redactId(chatId)}): ${resp.description ?? "unknown"}
|
|
16219
|
+
`
|
|
16220
|
+
);
|
|
16221
|
+
}
|
|
16222
|
+
} catch (err) {
|
|
16223
|
+
process.stderr.write(
|
|
16224
|
+
`telegram-channel(${AGENT_CODE_NAME}): undeliverable notice error: ${err.message}
|
|
16225
|
+
`
|
|
16226
|
+
);
|
|
16227
|
+
}
|
|
16228
|
+
}
|
|
16229
|
+
function __resetUndeliverableNoticeThrottle() {
|
|
16230
|
+
lastUndeliverableNoticeAt.clear();
|
|
16231
|
+
}
|
|
16232
|
+
var RESTART_FLAGS_DIR = join4(homedir2(), ".augmented", "restart-flags");
|
|
16102
16233
|
function buildTelegramHelpMessage(codeName) {
|
|
16103
16234
|
return [
|
|
16104
16235
|
`\u{1F916} *Available commands for \`${codeName}\`*`,
|
|
@@ -16138,7 +16269,7 @@ async function handleRestartCommand(opts) {
|
|
|
16138
16269
|
if (!existsSync2(RESTART_FLAGS_DIR)) {
|
|
16139
16270
|
mkdirSync3(RESTART_FLAGS_DIR, { recursive: true });
|
|
16140
16271
|
}
|
|
16141
|
-
const flagPath =
|
|
16272
|
+
const flagPath = join4(RESTART_FLAGS_DIR, `${AGENT_CODE_NAME}.flag`);
|
|
16142
16273
|
const flag = {
|
|
16143
16274
|
codeName: AGENT_CODE_NAME,
|
|
16144
16275
|
source: "telegram",
|
|
@@ -16254,16 +16385,16 @@ async function classifyRestartCommand(text) {
|
|
|
16254
16385
|
if (!ours) return "verification_failed";
|
|
16255
16386
|
return target === ours ? "act" : "ignore";
|
|
16256
16387
|
}
|
|
16257
|
-
var AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ?
|
|
16258
|
-
var PENDING_INBOUND_DIR = AGENT_DIR ?
|
|
16259
|
-
var RECOVERY_OUTBOX_DIR = AGENT_DIR ?
|
|
16388
|
+
var AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? join4(homedir2(), ".augmented", AGENT_CODE_NAME) : null;
|
|
16389
|
+
var PENDING_INBOUND_DIR = AGENT_DIR ? join4(AGENT_DIR, "telegram-pending-inbound") : null;
|
|
16390
|
+
var RECOVERY_OUTBOX_DIR = AGENT_DIR ? join4(AGENT_DIR, "telegram-recovery-outbox") : null;
|
|
16260
16391
|
function safeMarkerName(chatId, messageId) {
|
|
16261
16392
|
const safe = (s) => s.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
16262
16393
|
return `${safe(chatId)}__${safe(messageId)}.json`;
|
|
16263
16394
|
}
|
|
16264
16395
|
function pendingInboundPath(chatId, messageId) {
|
|
16265
16396
|
if (!PENDING_INBOUND_DIR) return null;
|
|
16266
|
-
return
|
|
16397
|
+
return join4(PENDING_INBOUND_DIR, safeMarkerName(chatId, messageId));
|
|
16267
16398
|
}
|
|
16268
16399
|
function writePendingInboundMarker(chatId, messageId, chatType) {
|
|
16269
16400
|
const path = pendingInboundPath(chatId, messageId);
|
|
@@ -16307,10 +16438,10 @@ function nextRetryName(filename) {
|
|
|
16307
16438
|
async function processRecoveryOutboxFile(filename) {
|
|
16308
16439
|
if (!RECOVERY_OUTBOX_DIR) return;
|
|
16309
16440
|
if (filename.endsWith(".poison.json") || filename.endsWith(".tmp")) return;
|
|
16310
|
-
const fullPath =
|
|
16441
|
+
const fullPath = join4(RECOVERY_OUTBOX_DIR, filename);
|
|
16311
16442
|
let payload;
|
|
16312
16443
|
try {
|
|
16313
|
-
const raw =
|
|
16444
|
+
const raw = readFileSync3(fullPath, "utf-8");
|
|
16314
16445
|
payload = JSON.parse(raw);
|
|
16315
16446
|
} catch (err) {
|
|
16316
16447
|
process.stderr.write(
|
|
@@ -16373,7 +16504,7 @@ async function processRecoveryOutboxFile(filename) {
|
|
|
16373
16504
|
const next = nextRetryName(filename);
|
|
16374
16505
|
if (next) {
|
|
16375
16506
|
try {
|
|
16376
|
-
renameSync3(fullPath,
|
|
16507
|
+
renameSync3(fullPath, join4(RECOVERY_OUTBOX_DIR, next.next));
|
|
16377
16508
|
if (next.attempt >= MAX_RECOVERY_ATTEMPTS) {
|
|
16378
16509
|
process.stderr.write(
|
|
16379
16510
|
`telegram-channel(${AGENT_CODE_NAME}): ghost-reply recovery exhausted retries \u2014 moved to ${next.next}
|
|
@@ -16404,7 +16535,7 @@ function scanRecoveryRetries() {
|
|
|
16404
16535
|
if (!RECOVERY_OUTBOX_DIR) return;
|
|
16405
16536
|
let entries;
|
|
16406
16537
|
try {
|
|
16407
|
-
entries =
|
|
16538
|
+
entries = readdirSync2(RECOVERY_OUTBOX_DIR);
|
|
16408
16539
|
} catch {
|
|
16409
16540
|
return;
|
|
16410
16541
|
}
|
|
@@ -16413,7 +16544,7 @@ function scanRecoveryRetries() {
|
|
|
16413
16544
|
if (!f.includes(".retry-") || f.endsWith(".poison.json")) continue;
|
|
16414
16545
|
let mtimeMs;
|
|
16415
16546
|
try {
|
|
16416
|
-
mtimeMs = statSync(
|
|
16547
|
+
mtimeMs = statSync(join4(RECOVERY_OUTBOX_DIR, f)).mtimeMs;
|
|
16417
16548
|
} catch {
|
|
16418
16549
|
continue;
|
|
16419
16550
|
}
|
|
@@ -16434,7 +16565,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
16434
16565
|
return;
|
|
16435
16566
|
}
|
|
16436
16567
|
try {
|
|
16437
|
-
for (const f of
|
|
16568
|
+
for (const f of readdirSync2(RECOVERY_OUTBOX_DIR)) {
|
|
16438
16569
|
if (isFirstAttemptOutboxFile(f)) void processRecoveryOutboxFile(f);
|
|
16439
16570
|
}
|
|
16440
16571
|
} catch {
|
|
@@ -16443,7 +16574,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
16443
16574
|
const watcher = watch(RECOVERY_OUTBOX_DIR, (event, filename) => {
|
|
16444
16575
|
if (event !== "rename" || !filename) return;
|
|
16445
16576
|
if (!isFirstAttemptOutboxFile(filename)) return;
|
|
16446
|
-
if (existsSync2(
|
|
16577
|
+
if (existsSync2(join4(RECOVERY_OUTBOX_DIR, filename))) {
|
|
16447
16578
|
void processRecoveryOutboxFile(filename);
|
|
16448
16579
|
}
|
|
16449
16580
|
});
|
|
@@ -16467,7 +16598,7 @@ function sweepTelegramStaleMarkersOnBoot() {
|
|
|
16467
16598
|
if (!existsSync2(PENDING_INBOUND_DIR)) return;
|
|
16468
16599
|
let filenames;
|
|
16469
16600
|
try {
|
|
16470
|
-
filenames =
|
|
16601
|
+
filenames = readdirSync2(PENDING_INBOUND_DIR);
|
|
16471
16602
|
} catch (err) {
|
|
16472
16603
|
process.stderr.write(
|
|
16473
16604
|
`telegram-channel(${AGENT_CODE_NAME}): stale-marker readdir failed: ${err.message}
|
|
@@ -16480,10 +16611,10 @@ function sweepTelegramStaleMarkersOnBoot() {
|
|
|
16480
16611
|
for (const filename of filenames) {
|
|
16481
16612
|
if (!filename.endsWith(".json")) continue;
|
|
16482
16613
|
if (filename.endsWith(".tmp")) continue;
|
|
16483
|
-
const fullPath =
|
|
16614
|
+
const fullPath = join4(PENDING_INBOUND_DIR, filename);
|
|
16484
16615
|
let marker;
|
|
16485
16616
|
try {
|
|
16486
|
-
marker = JSON.parse(
|
|
16617
|
+
marker = JSON.parse(readFileSync3(fullPath, "utf-8"));
|
|
16487
16618
|
} catch (err) {
|
|
16488
16619
|
process.stderr.write(
|
|
16489
16620
|
`telegram-channel(${AGENT_CODE_NAME}): stale-marker parse failed for ${redactId(filename)}: ${err.message}
|
|
@@ -16532,7 +16663,7 @@ function clearPendingMessage(chatId, messageId) {
|
|
|
16532
16663
|
const prefix = `${safeChatId}__`;
|
|
16533
16664
|
let filenames;
|
|
16534
16665
|
try {
|
|
16535
|
-
filenames =
|
|
16666
|
+
filenames = readdirSync2(PENDING_INBOUND_DIR);
|
|
16536
16667
|
} catch {
|
|
16537
16668
|
return;
|
|
16538
16669
|
}
|
|
@@ -16540,7 +16671,7 @@ function clearPendingMessage(chatId, messageId) {
|
|
|
16540
16671
|
if (!filename.startsWith(prefix)) continue;
|
|
16541
16672
|
if (!filename.endsWith(".json")) continue;
|
|
16542
16673
|
try {
|
|
16543
|
-
unlinkSync3(
|
|
16674
|
+
unlinkSync3(join4(PENDING_INBOUND_DIR, filename));
|
|
16544
16675
|
} catch {
|
|
16545
16676
|
}
|
|
16546
16677
|
}
|
|
@@ -16567,7 +16698,7 @@ var mcp = new Server(
|
|
|
16567
16698
|
"Inbound attachments: <channel> `files` is a JSON-serialised array \u2014 JSON.parse it. If an entry has `path`, the image is already downloaded \u2014 Read it directly, do NOT call telegram.download_attachment. Use that tool only for entries with `file_id` but NO `path` (PDF, docx, voice, audio, video, animations): pass file_id + chat_id verbatim, then Read the returned path. Single-image messages also get a top-level `image_path`. Caption arrives as channel content. Don't surface internal file-handling errors that don't affect the answer.",
|
|
16568
16699
|
'For work >30s follow CLAUDE.md kanban flow: kanban_add \u2192 reply "On it \u2014 tracking here: <kanban URL>" \u2192 move to in_progress \u2192 do the work \u2192 reply with the result. Simple lookups skip kanban but still reply.',
|
|
16569
16700
|
"Address users by user_name; user is the numeric Telegram ID. Resolve ambiguous times against your own Timezone from CLAUDE.md \u2014 do not ask.",
|
|
16570
|
-
|
|
16701
|
+
`Reaction taxonomy (use telegram.react sparingly \u2014 prefer telegram.reply): \u{1F440} = ack (already auto-added on inbound, do not duplicate); \u{1F44D} or \u{1F389} = success. NEVER react to signal failure of YOUR work. On failure, telegram.reply with one sentence explaining what went wrong. Free-tier emoji: \u{1F44D} \u{1F44E} \u2764 \u{1F525} \u{1F389} \u{1F914} \u{1F92F} \u{1F64F} \u{1F44C} \u{1F440} \u{1F4AF} \u270D \u{1FAE1} \u{1F192} \u{1F973} \u{1F494}. (If a message arrived while you were offline you may see a system-posted "can't respond right now" notice \u2014 that's the runtime, not you; don't repeat or apologise for it.)`
|
|
16571
16702
|
].join(" ")
|
|
16572
16703
|
}
|
|
16573
16704
|
);
|
|
@@ -16698,7 +16829,7 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
16698
16829
|
},
|
|
16699
16830
|
{
|
|
16700
16831
|
name: "telegram.react",
|
|
16701
|
-
description:
|
|
16832
|
+
description: `Add an emoji reaction to a Telegram message. Use sparingly \u2014 prefer a text reply via telegram.reply. Reaction taxonomy: \u{1F44D} or \u{1F389} = action completed successfully. NEVER react to signal failure of your work \u2014 users can't tell why it failed from a reaction. On failure, call telegram.reply with one sentence explaining what went wrong instead. \u{1F440} is already auto-applied on inbound; do not duplicate. Only free-tier emoji reactions are available to bots (Premium-only emoji fail silently). Pass an empty string or omit emoji to clear the bot's reaction on that message. (Note: when a message arrives while the agent is offline/wedged, the runtime \u2014 not you \u2014 posts a brief "can't respond right now" notice; you never need to add a failure reaction for that.)`,
|
|
16702
16833
|
inputSchema: {
|
|
16703
16834
|
type: "object",
|
|
16704
16835
|
properties: {
|
|
@@ -17419,7 +17550,20 @@ async function pollLoop() {
|
|
|
17419
17550
|
}
|
|
17420
17551
|
}
|
|
17421
17552
|
const messageId = String(msg.message_id);
|
|
17422
|
-
|
|
17553
|
+
const ackProbe = process.env.TMUX && AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? probeAgentSessionCached(AGENT_CODE_NAME) : { tmux: "unknown", claude: "unknown" };
|
|
17554
|
+
const ackDecision = decideAckReaction({
|
|
17555
|
+
hasTarget: Boolean(chatId && messageId),
|
|
17556
|
+
integrationReady: Boolean(BOT_TOKEN),
|
|
17557
|
+
tmux: ackProbe.tmux,
|
|
17558
|
+
claude: ackProbe.claude,
|
|
17559
|
+
withinStartupGrace: process.uptime() * 1e3 < ACK_STARTUP_GRACE_MS,
|
|
17560
|
+
oldestPendingAgeMs: oldestPendingMarkerAgeMs(PENDING_INBOUND_DIR)
|
|
17561
|
+
});
|
|
17562
|
+
if (ackDecision === "ack") {
|
|
17563
|
+
void setMessageReaction(chatId, messageId, ACK_EMOJI);
|
|
17564
|
+
} else if (ackDecision === "undeliverable") {
|
|
17565
|
+
void notifyUndeliverable(chatId, messageId);
|
|
17566
|
+
}
|
|
17423
17567
|
trackPendingMessage(chatId, messageId, msg.chat.type);
|
|
17424
17568
|
const fileMeta = [];
|
|
17425
17569
|
for (const attachment of classifiedAttachments) {
|
|
@@ -17546,3 +17690,6 @@ pollLoop().catch((err) => {
|
|
|
17546
17690
|
);
|
|
17547
17691
|
process.exit(1);
|
|
17548
17692
|
});
|
|
17693
|
+
export {
|
|
17694
|
+
__resetUndeliverableNoticeThrottle
|
|
17695
|
+
};
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
stopPersistentSession,
|
|
22
22
|
takeZombieDetection,
|
|
23
23
|
writePersistentClaudeWrapper
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-F4NG4EXD.js";
|
|
25
|
+
import "./chunk-HT6EETEL.js";
|
|
26
26
|
import "./chunk-XWVM4KPK.js";
|
|
27
27
|
export {
|
|
28
28
|
SEND_KEYS_ENTER_DELAY_MS,
|
|
@@ -48,4 +48,4 @@ export {
|
|
|
48
48
|
takeZombieDetection,
|
|
49
49
|
writePersistentClaudeWrapper
|
|
50
50
|
};
|
|
51
|
-
//# sourceMappingURL=persistent-session-
|
|
51
|
+
//# sourceMappingURL=persistent-session-SBSOZG74.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
paneLogPath
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-F4NG4EXD.js";
|
|
4
|
+
import "./chunk-HT6EETEL.js";
|
|
5
5
|
import "./chunk-XWVM4KPK.js";
|
|
6
6
|
|
|
7
7
|
// src/lib/responsiveness-probe.ts
|
|
@@ -30,4 +30,4 @@ export {
|
|
|
30
30
|
collectResponsivenessProbes,
|
|
31
31
|
getResponsivenessIntervalMs
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=responsiveness-probe-
|
|
33
|
+
//# sourceMappingURL=responsiveness-probe-DU4IJ2RZ.js.map
|