@integrity-labs/agt-cli 0.28.331 → 0.28.332
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 +3 -3
- package/dist/{chunk-4Y3UPOR2.js → chunk-YNHMQ4CW.js} +119 -26
- package/dist/chunk-YNHMQ4CW.js.map +1 -0
- package/dist/lib/manager-worker.js +4 -4
- package/dist/mcp/direct-chat-channel.js +92 -51
- package/dist/mcp/slack-channel.js +155 -118
- package/dist/mcp/teams-channel.js +100 -51
- package/dist/mcp/telegram-channel.js +146 -98
- package/dist/{responsiveness-probe-OJJESVVX.js → responsiveness-probe-46XFHCPY.js} +12 -2
- package/dist/responsiveness-probe-46XFHCPY.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-4Y3UPOR2.js.map +0 -1
- package/dist/responsiveness-probe-OJJESVVX.js.map +0 -1
|
@@ -14518,26 +14518,26 @@ var StdioServerTransport = class {
|
|
|
14518
14518
|
|
|
14519
14519
|
// src/telegram-channel.ts
|
|
14520
14520
|
import https from "https";
|
|
14521
|
-
import { createHash, randomUUID as randomUUID3 } from "crypto";
|
|
14521
|
+
import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
|
|
14522
14522
|
import {
|
|
14523
14523
|
closeSync,
|
|
14524
14524
|
createWriteStream,
|
|
14525
|
-
existsSync as
|
|
14525
|
+
existsSync as existsSync9,
|
|
14526
14526
|
ftruncateSync,
|
|
14527
|
-
mkdirSync as
|
|
14527
|
+
mkdirSync as mkdirSync9,
|
|
14528
14528
|
openSync,
|
|
14529
|
-
readFileSync as
|
|
14530
|
-
readdirSync as
|
|
14529
|
+
readFileSync as readFileSync12,
|
|
14530
|
+
readdirSync as readdirSync4,
|
|
14531
14531
|
realpathSync,
|
|
14532
|
-
renameSync as
|
|
14532
|
+
renameSync as renameSync7,
|
|
14533
14533
|
statSync as statSync2,
|
|
14534
14534
|
unlinkSync as unlinkSync7,
|
|
14535
14535
|
watch,
|
|
14536
|
-
writeFileSync as
|
|
14536
|
+
writeFileSync as writeFileSync11,
|
|
14537
14537
|
writeSync
|
|
14538
14538
|
} from "fs";
|
|
14539
14539
|
import { homedir as homedir4 } from "os";
|
|
14540
|
-
import { basename, extname, join as
|
|
14540
|
+
import { basename, extname, join as join12, resolve as resolve2 } from "path";
|
|
14541
14541
|
|
|
14542
14542
|
// src/channel-attachments.ts
|
|
14543
14543
|
import { homedir } from "os";
|
|
@@ -17047,6 +17047,45 @@ function removeRecoveryLedgerEntry(ledgerDir, markerName, unlink = (p) => {
|
|
|
17047
17047
|
}
|
|
17048
17048
|
}
|
|
17049
17049
|
|
|
17050
|
+
// src/inbound-delivery-ledger.ts
|
|
17051
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync7, readdirSync as readdirSync2, readFileSync as readFileSync9, renameSync as renameSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
17052
|
+
import { join as join9 } from "path";
|
|
17053
|
+
function safeInboundId(inboundId) {
|
|
17054
|
+
return inboundId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
17055
|
+
}
|
|
17056
|
+
var defaultDeps = {
|
|
17057
|
+
mkdir: (dir) => mkdirSync7(dir, { recursive: true }),
|
|
17058
|
+
writeFile: (path, data) => writeFileSync8(path, data, "utf8"),
|
|
17059
|
+
rename: (from, to) => renameSync5(from, to),
|
|
17060
|
+
readdir: (dir) => readdirSync2(dir),
|
|
17061
|
+
readFile: (path) => readFileSync9(path, "utf8"),
|
|
17062
|
+
exists: (path) => existsSync7(path)
|
|
17063
|
+
};
|
|
17064
|
+
function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
17065
|
+
if (!dir || !record2.inbound_id || !record2.conv_key) return;
|
|
17066
|
+
const safe = safeInboundId(record2.inbound_id);
|
|
17067
|
+
if (!safe || safe.includes("/") || safe.includes("\\") || safe.includes("..")) return;
|
|
17068
|
+
try {
|
|
17069
|
+
deps.mkdir(dir);
|
|
17070
|
+
const final = join9(dir, `${safe}.json`);
|
|
17071
|
+
const tmp = `${final}.tmp`;
|
|
17072
|
+
deps.writeFile(tmp, JSON.stringify(record2));
|
|
17073
|
+
deps.rename(tmp, final);
|
|
17074
|
+
} catch {
|
|
17075
|
+
}
|
|
17076
|
+
}
|
|
17077
|
+
|
|
17078
|
+
// src/channel-inbound-id.ts
|
|
17079
|
+
import { createHash } from "crypto";
|
|
17080
|
+
var INBOUND_ID_HEX_LEN = 12;
|
|
17081
|
+
function hashInboundId(payload) {
|
|
17082
|
+
const digest = createHash("sha256").update(payload).digest("hex").slice(0, INBOUND_ID_HEX_LEN);
|
|
17083
|
+
return `ib_${digest}`;
|
|
17084
|
+
}
|
|
17085
|
+
function telegramInboundId(chatId, messageId) {
|
|
17086
|
+
return hashInboundId(`${chatId}|${messageId}`);
|
|
17087
|
+
}
|
|
17088
|
+
|
|
17050
17089
|
// src/channel-progress.ts
|
|
17051
17090
|
function channelLiveProgressEnabled() {
|
|
17052
17091
|
return resolveHostBooleanFlag({
|
|
@@ -17231,14 +17270,14 @@ function createKanbanCardActiveClient(args) {
|
|
|
17231
17270
|
|
|
17232
17271
|
// src/mcp-spawn-lock.ts
|
|
17233
17272
|
import {
|
|
17234
|
-
existsSync as
|
|
17235
|
-
mkdirSync as
|
|
17236
|
-
readFileSync as
|
|
17237
|
-
renameSync as
|
|
17273
|
+
existsSync as existsSync8,
|
|
17274
|
+
mkdirSync as mkdirSync8,
|
|
17275
|
+
readFileSync as readFileSync10,
|
|
17276
|
+
renameSync as renameSync6,
|
|
17238
17277
|
unlinkSync as unlinkSync6,
|
|
17239
|
-
writeFileSync as
|
|
17278
|
+
writeFileSync as writeFileSync9
|
|
17240
17279
|
} from "fs";
|
|
17241
|
-
import { join as
|
|
17280
|
+
import { join as join10 } from "path";
|
|
17242
17281
|
function defaultIsPidAlive(pid) {
|
|
17243
17282
|
if (!Number.isFinite(pid) || pid <= 0) return false;
|
|
17244
17283
|
try {
|
|
@@ -17256,7 +17295,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
17256
17295
|
const isPidAlive = options.isPidAlive ?? defaultIsPidAlive;
|
|
17257
17296
|
const selfPid = options.selfPid ?? process.pid;
|
|
17258
17297
|
const now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
17259
|
-
const path =
|
|
17298
|
+
const path = join10(agentDir, basename2);
|
|
17260
17299
|
const existing = readLockHolder(path);
|
|
17261
17300
|
if (existing) {
|
|
17262
17301
|
if (existing.pid === selfPid) {
|
|
@@ -17266,11 +17305,11 @@ function acquireMcpSpawnLock(args) {
|
|
|
17266
17305
|
return { kind: "blocked", path, holder: existing };
|
|
17267
17306
|
}
|
|
17268
17307
|
}
|
|
17269
|
-
|
|
17308
|
+
mkdirSync8(agentDir, { recursive: true, mode: 448 });
|
|
17270
17309
|
const tmpPath = `${path}.${selfPid}.tmp`;
|
|
17271
17310
|
const payload = { pid: selfPid, started_at: now() };
|
|
17272
|
-
|
|
17273
|
-
|
|
17311
|
+
writeFileSync9(tmpPath, JSON.stringify(payload), { mode: 384 });
|
|
17312
|
+
renameSync6(tmpPath, path);
|
|
17274
17313
|
return { kind: "acquired", path };
|
|
17275
17314
|
}
|
|
17276
17315
|
function releaseMcpSpawnLock(lockPath, opts = {}) {
|
|
@@ -17285,9 +17324,9 @@ function releaseMcpSpawnLock(lockPath, opts = {}) {
|
|
|
17285
17324
|
}
|
|
17286
17325
|
}
|
|
17287
17326
|
function readLockHolder(path) {
|
|
17288
|
-
if (!
|
|
17327
|
+
if (!existsSync8(path)) return null;
|
|
17289
17328
|
try {
|
|
17290
|
-
const raw =
|
|
17329
|
+
const raw = readFileSync10(path, "utf8");
|
|
17291
17330
|
const parsed = JSON.parse(raw);
|
|
17292
17331
|
const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
|
|
17293
17332
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
@@ -17299,8 +17338,8 @@ function readLockHolder(path) {
|
|
|
17299
17338
|
}
|
|
17300
17339
|
|
|
17301
17340
|
// src/ack-reaction.ts
|
|
17302
|
-
import { readdirSync as
|
|
17303
|
-
import { join as
|
|
17341
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync11, writeFileSync as writeFileSync10 } from "fs";
|
|
17342
|
+
import { join as join11 } from "path";
|
|
17304
17343
|
var REPLY_WEDGED_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
17305
17344
|
var ACK_STARTUP_GRACE_MS = 6e4;
|
|
17306
17345
|
var ACK_PANE_FRESH_THRESHOLD_MS = 6e4;
|
|
@@ -17373,7 +17412,7 @@ var GIVE_UP_SIGNAL_MAX_AGE_MS = 30 * 60 * 1e3;
|
|
|
17373
17412
|
function readGiveUpSignal(path, now = Date.now()) {
|
|
17374
17413
|
if (!path) return null;
|
|
17375
17414
|
try {
|
|
17376
|
-
const raw = JSON.parse(
|
|
17415
|
+
const raw = JSON.parse(readFileSync11(path, "utf8"));
|
|
17377
17416
|
if (typeof raw.gave_up_at !== "string") return null;
|
|
17378
17417
|
const t = Date.parse(raw.gave_up_at);
|
|
17379
17418
|
if (!Number.isFinite(t) || t > now) return null;
|
|
@@ -17399,7 +17438,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
|
|
|
17399
17438
|
if (!dir) return null;
|
|
17400
17439
|
let names;
|
|
17401
17440
|
try {
|
|
17402
|
-
names =
|
|
17441
|
+
names = readdirSync3(dir);
|
|
17403
17442
|
} catch {
|
|
17404
17443
|
return null;
|
|
17405
17444
|
}
|
|
@@ -17408,7 +17447,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
|
|
|
17408
17447
|
if (!name.endsWith(".json")) continue;
|
|
17409
17448
|
let receivedAt;
|
|
17410
17449
|
try {
|
|
17411
|
-
const raw = JSON.parse(
|
|
17450
|
+
const raw = JSON.parse(readFileSync11(join11(dir, name), "utf-8"));
|
|
17412
17451
|
if (raw.discretionary === true) continue;
|
|
17413
17452
|
if (!opts?.includeSeen && typeof raw.seen_at === "string" && raw.seen_at) continue;
|
|
17414
17453
|
receivedAt = raw.received_at;
|
|
@@ -17476,20 +17515,20 @@ function isMarkerGenuinelyAged(receivedAt, nowMs, thresholdMs) {
|
|
|
17476
17515
|
}
|
|
17477
17516
|
var DEFLECTION_COUNTER_SUFFIX = "-deflections.json";
|
|
17478
17517
|
function deflectionCounterPath(agentDir, channel) {
|
|
17479
|
-
return
|
|
17518
|
+
return join11(agentDir, `${channel}${DEFLECTION_COUNTER_SUFFIX}`);
|
|
17480
17519
|
}
|
|
17481
17520
|
function recordChannelDeflection(agentDir, channel, cause) {
|
|
17482
17521
|
if (!agentDir) return;
|
|
17483
17522
|
const path = deflectionCounterPath(agentDir, channel);
|
|
17484
17523
|
let counts = {};
|
|
17485
17524
|
try {
|
|
17486
|
-
const parsed = JSON.parse(
|
|
17525
|
+
const parsed = JSON.parse(readFileSync11(path, "utf-8"));
|
|
17487
17526
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
17488
17527
|
} catch {
|
|
17489
17528
|
}
|
|
17490
17529
|
counts[cause] = (counts[cause] ?? 0) + 1;
|
|
17491
17530
|
try {
|
|
17492
|
-
|
|
17531
|
+
writeFileSync10(path, JSON.stringify(counts), { mode: 384 });
|
|
17493
17532
|
} catch {
|
|
17494
17533
|
}
|
|
17495
17534
|
}
|
|
@@ -17560,11 +17599,11 @@ async function actuateHostRestart(opts) {
|
|
|
17560
17599
|
|
|
17561
17600
|
// src/telegram-channel.ts
|
|
17562
17601
|
function redactId(id) {
|
|
17563
|
-
return
|
|
17602
|
+
return createHash2("sha256").update(String(id)).digest("hex").slice(0, 8);
|
|
17564
17603
|
}
|
|
17565
17604
|
var BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN;
|
|
17566
17605
|
var AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
|
|
17567
|
-
var TELEGRAM_AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ?
|
|
17606
|
+
var TELEGRAM_AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? join12(homedir4(), ".augmented", AGENT_CODE_NAME) : null;
|
|
17568
17607
|
var AGT_HOST = process.env.AGT_HOST ?? null;
|
|
17569
17608
|
var AGT_API_KEY = process.env.AGT_API_KEY ?? null;
|
|
17570
17609
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID ?? null;
|
|
@@ -17668,9 +17707,9 @@ if (!BOT_TOKEN) {
|
|
|
17668
17707
|
var stderrLogStream = null;
|
|
17669
17708
|
if (AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown") {
|
|
17670
17709
|
try {
|
|
17671
|
-
const logDir =
|
|
17672
|
-
|
|
17673
|
-
stderrLogStream = createWriteStream(
|
|
17710
|
+
const logDir = join12(homedir4(), ".augmented", AGENT_CODE_NAME);
|
|
17711
|
+
mkdirSync9(logDir, { recursive: true });
|
|
17712
|
+
stderrLogStream = createWriteStream(join12(logDir, "telegram-channel-stderr.log"), {
|
|
17674
17713
|
flags: "a",
|
|
17675
17714
|
mode: 384
|
|
17676
17715
|
});
|
|
@@ -17949,7 +17988,7 @@ function scheduleBusyAck(chatId, messageId, arrivedWhileBusy) {
|
|
|
17949
17988
|
let paneLogFreshAgeMs = null;
|
|
17950
17989
|
if (AGENT_DIR) {
|
|
17951
17990
|
try {
|
|
17952
|
-
const paneMtimeMs = statSync2(
|
|
17991
|
+
const paneMtimeMs = statSync2(join12(AGENT_DIR, "pane.log")).mtimeMs;
|
|
17953
17992
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
17954
17993
|
} catch {
|
|
17955
17994
|
}
|
|
@@ -17979,7 +18018,7 @@ function scheduleBusyAck(chatId, messageId, arrivedWhileBusy) {
|
|
|
17979
18018
|
function __resetBusyAckNoticeThrottle() {
|
|
17980
18019
|
lastBusyAckNoticeAt.clear();
|
|
17981
18020
|
}
|
|
17982
|
-
var RESTART_FLAGS_DIR =
|
|
18021
|
+
var RESTART_FLAGS_DIR = join12(homedir4(), ".augmented", "restart-flags");
|
|
17983
18022
|
function actuateHostRestartTelegram() {
|
|
17984
18023
|
return actuateHostRestart({
|
|
17985
18024
|
agtHost: AGT_HOST,
|
|
@@ -18361,10 +18400,10 @@ async function handleRestartCommand(opts) {
|
|
|
18361
18400
|
writeTelegramRestartConfirm({ chat_id: opts.chatId, message_id: opts.messageId }, opts.requesterName);
|
|
18362
18401
|
} else {
|
|
18363
18402
|
writeTelegramRestartConfirm({ chat_id: opts.chatId, message_id: opts.messageId }, opts.requesterName);
|
|
18364
|
-
if (!
|
|
18365
|
-
|
|
18403
|
+
if (!existsSync9(RESTART_FLAGS_DIR)) {
|
|
18404
|
+
mkdirSync9(RESTART_FLAGS_DIR, { recursive: true });
|
|
18366
18405
|
}
|
|
18367
|
-
const flagPath =
|
|
18406
|
+
const flagPath = join12(RESTART_FLAGS_DIR, `${AGENT_CODE_NAME}.flag`);
|
|
18368
18407
|
const flag = {
|
|
18369
18408
|
codeName: AGENT_CODE_NAME,
|
|
18370
18409
|
source: "telegram",
|
|
@@ -18372,8 +18411,8 @@ async function handleRestartCommand(opts) {
|
|
|
18372
18411
|
reply: { chat_id: opts.chatId, message_id: opts.messageId }
|
|
18373
18412
|
};
|
|
18374
18413
|
const tmpPath = `${flagPath}.${process.pid}.${randomUUID3()}.tmp`;
|
|
18375
|
-
|
|
18376
|
-
|
|
18414
|
+
writeFileSync11(tmpPath, JSON.stringify(flag) + "\n", "utf8");
|
|
18415
|
+
renameSync7(tmpPath, flagPath);
|
|
18377
18416
|
}
|
|
18378
18417
|
process.stderr.write(
|
|
18379
18418
|
`telegram-channel(${AGENT_CODE_NAME}): /restart queued from chat ${redactId(opts.chatId)}
|
|
@@ -18770,15 +18809,16 @@ async function classifyRestartCommand(text) {
|
|
|
18770
18809
|
if (!ours) return "verification_failed";
|
|
18771
18810
|
return target === ours ? "act" : "ignore";
|
|
18772
18811
|
}
|
|
18773
|
-
var AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ?
|
|
18774
|
-
var PENDING_INBOUND_DIR = AGENT_DIR ?
|
|
18775
|
-
var RECOVERY_OUTBOX_DIR = AGENT_DIR ?
|
|
18776
|
-
var RECOVERY_LEDGER_DIR = AGENT_DIR ?
|
|
18777
|
-
var
|
|
18812
|
+
var AGENT_DIR = AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? join12(homedir4(), ".augmented", AGENT_CODE_NAME) : null;
|
|
18813
|
+
var PENDING_INBOUND_DIR = AGENT_DIR ? join12(AGENT_DIR, "telegram-pending-inbound") : null;
|
|
18814
|
+
var RECOVERY_OUTBOX_DIR = AGENT_DIR ? join12(AGENT_DIR, "telegram-recovery-outbox") : null;
|
|
18815
|
+
var RECOVERY_LEDGER_DIR = AGENT_DIR ? join12(AGENT_DIR, ".agt-telegram-recovery-ledger") : null;
|
|
18816
|
+
var DELIVERY_LEDGER_DIR = AGENT_DIR ? join12(AGENT_DIR, ".agt-inbound-delivery-ledger") : null;
|
|
18817
|
+
var RESTART_CONFIRM_FILE = AGENT_DIR ? join12(AGENT_DIR, "telegram-restart-confirm.json") : null;
|
|
18778
18818
|
var TELEGRAM_PROCESS_BOOT_MS = Date.now();
|
|
18779
|
-
var TELEGRAM_RECENT_DMS_FILE = AGENT_DIR ?
|
|
18780
|
-
var TELEGRAM_CHANNEL_ADD_RESTART_FILE = AGENT_DIR ?
|
|
18781
|
-
var TELEGRAM_OFFSET_FILE = AGENT_DIR ?
|
|
18819
|
+
var TELEGRAM_RECENT_DMS_FILE = AGENT_DIR ? join12(AGENT_DIR, "telegram-recent-dms.json") : null;
|
|
18820
|
+
var TELEGRAM_CHANNEL_ADD_RESTART_FILE = AGENT_DIR ? join12(AGENT_DIR, "telegram-channel-add-restart.json") : null;
|
|
18821
|
+
var TELEGRAM_OFFSET_FILE = AGENT_DIR ? join12(AGENT_DIR, "telegram-getupdates-offset.json") : null;
|
|
18782
18822
|
var recentDms = /* @__PURE__ */ new Map();
|
|
18783
18823
|
var recentDmPersister = TELEGRAM_RECENT_DMS_FILE ? createRecentDmPersister({
|
|
18784
18824
|
filePath: TELEGRAM_RECENT_DMS_FILE,
|
|
@@ -18833,7 +18873,7 @@ function safeMarkerName(chatId, messageId) {
|
|
|
18833
18873
|
}
|
|
18834
18874
|
function pendingInboundPath(chatId, messageId) {
|
|
18835
18875
|
if (!PENDING_INBOUND_DIR) return null;
|
|
18836
|
-
return
|
|
18876
|
+
return join12(PENDING_INBOUND_DIR, safeMarkerName(chatId, messageId));
|
|
18837
18877
|
}
|
|
18838
18878
|
function writePendingInboundMarker(chatId, messageId, chatType, undeliverable = false, payload) {
|
|
18839
18879
|
const path = pendingInboundPath(chatId, messageId);
|
|
@@ -18843,6 +18883,8 @@ function writePendingInboundMarker(chatId, messageId, chatType, undeliverable =
|
|
|
18843
18883
|
message_id: messageId,
|
|
18844
18884
|
chat_type: chatType,
|
|
18845
18885
|
received_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18886
|
+
// ENG-7806 (fm1): stamp the deterministic inbound id (marker-semantics-neutral).
|
|
18887
|
+
inbound_id: telegramInboundId(chatId, messageId),
|
|
18846
18888
|
// Only persist the flag when set — keeps healthy-path markers byte-identical.
|
|
18847
18889
|
...undeliverable ? { undeliverable: true } : {},
|
|
18848
18890
|
// ENG-5969: carry the replay payload only when provided (the durable-replay
|
|
@@ -18850,8 +18892,8 @@ function writePendingInboundMarker(chatId, messageId, chatType, undeliverable =
|
|
|
18850
18892
|
...payload ? { payload } : {}
|
|
18851
18893
|
};
|
|
18852
18894
|
try {
|
|
18853
|
-
|
|
18854
|
-
|
|
18895
|
+
mkdirSync9(PENDING_INBOUND_DIR, { recursive: true, mode: 448 });
|
|
18896
|
+
writeFileSync11(path, JSON.stringify(marker), { mode: 384 });
|
|
18855
18897
|
} catch (err) {
|
|
18856
18898
|
process.stderr.write(
|
|
18857
18899
|
`telegram-channel(${AGENT_CODE_NAME}): pending-inbound marker write failed: ${err.message}
|
|
@@ -18879,7 +18921,7 @@ function rewriteTelegramMarkerInPlace(path, marker) {
|
|
|
18879
18921
|
function clearTelegramMarkerFileWithHeal(fullPath) {
|
|
18880
18922
|
let marker = null;
|
|
18881
18923
|
try {
|
|
18882
|
-
marker = JSON.parse(
|
|
18924
|
+
marker = JSON.parse(readFileSync12(fullPath, "utf-8"));
|
|
18883
18925
|
} catch {
|
|
18884
18926
|
}
|
|
18885
18927
|
if (marker && decideRecoveryHeal({
|
|
@@ -18889,14 +18931,14 @@ function clearTelegramMarkerFileWithHeal(fullPath) {
|
|
|
18889
18931
|
notifyBackOnline(marker.chat_id);
|
|
18890
18932
|
}
|
|
18891
18933
|
try {
|
|
18892
|
-
if (
|
|
18934
|
+
if (existsSync9(fullPath)) unlinkSync7(fullPath);
|
|
18893
18935
|
} catch {
|
|
18894
18936
|
}
|
|
18895
18937
|
}
|
|
18896
18938
|
function markTelegramMarkerSeenInPlace(fullPath) {
|
|
18897
18939
|
let marker;
|
|
18898
18940
|
try {
|
|
18899
|
-
marker = JSON.parse(
|
|
18941
|
+
marker = JSON.parse(readFileSync12(fullPath, "utf-8"));
|
|
18900
18942
|
} catch {
|
|
18901
18943
|
return;
|
|
18902
18944
|
}
|
|
@@ -18908,7 +18950,7 @@ function markTelegramMarkerSeenInPlace(fullPath) {
|
|
|
18908
18950
|
function markTelegramMarkerSeenWithHeal(fullPath) {
|
|
18909
18951
|
let marker = null;
|
|
18910
18952
|
try {
|
|
18911
|
-
marker = JSON.parse(
|
|
18953
|
+
marker = JSON.parse(readFileSync12(fullPath, "utf-8"));
|
|
18912
18954
|
} catch {
|
|
18913
18955
|
return;
|
|
18914
18956
|
}
|
|
@@ -18922,9 +18964,9 @@ function markTelegramMarkerSeenWithHeal(fullPath) {
|
|
|
18922
18964
|
}
|
|
18923
18965
|
function readPendingInboundMarker(chatId, messageId) {
|
|
18924
18966
|
const path = pendingInboundPath(chatId, messageId);
|
|
18925
|
-
if (!path || !
|
|
18967
|
+
if (!path || !existsSync9(path)) return null;
|
|
18926
18968
|
try {
|
|
18927
|
-
return JSON.parse(
|
|
18969
|
+
return JSON.parse(readFileSync12(path, "utf-8"));
|
|
18928
18970
|
} catch {
|
|
18929
18971
|
return null;
|
|
18930
18972
|
}
|
|
@@ -18944,10 +18986,10 @@ function nextRetryName(filename) {
|
|
|
18944
18986
|
async function processRecoveryOutboxFile(filename) {
|
|
18945
18987
|
if (!RECOVERY_OUTBOX_DIR) return;
|
|
18946
18988
|
if (filename.endsWith(".poison.json") || filename.endsWith(".tmp")) return;
|
|
18947
|
-
const fullPath =
|
|
18989
|
+
const fullPath = join12(RECOVERY_OUTBOX_DIR, filename);
|
|
18948
18990
|
let payload;
|
|
18949
18991
|
try {
|
|
18950
|
-
const raw =
|
|
18992
|
+
const raw = readFileSync12(fullPath, "utf-8");
|
|
18951
18993
|
payload = JSON.parse(raw);
|
|
18952
18994
|
} catch (err) {
|
|
18953
18995
|
process.stderr.write(
|
|
@@ -18955,7 +18997,7 @@ async function processRecoveryOutboxFile(filename) {
|
|
|
18955
18997
|
`
|
|
18956
18998
|
);
|
|
18957
18999
|
try {
|
|
18958
|
-
|
|
19000
|
+
renameSync7(fullPath, `${fullPath}.parse-error.poison`);
|
|
18959
19001
|
} catch {
|
|
18960
19002
|
}
|
|
18961
19003
|
return;
|
|
@@ -18967,7 +19009,7 @@ async function processRecoveryOutboxFile(filename) {
|
|
|
18967
19009
|
);
|
|
18968
19010
|
removeRecoveryLedgerEntry(RECOVERY_LEDGER_DIR, payload.marker_name);
|
|
18969
19011
|
try {
|
|
18970
|
-
|
|
19012
|
+
renameSync7(fullPath, `${fullPath}.malformed.poison`);
|
|
18971
19013
|
} catch {
|
|
18972
19014
|
}
|
|
18973
19015
|
return;
|
|
@@ -19041,7 +19083,7 @@ async function processRecoveryOutboxFile(filename) {
|
|
|
19041
19083
|
const next = nextRetryName(filename);
|
|
19042
19084
|
if (next) {
|
|
19043
19085
|
try {
|
|
19044
|
-
|
|
19086
|
+
renameSync7(fullPath, join12(RECOVERY_OUTBOX_DIR, next.next));
|
|
19045
19087
|
if (next.attempt >= MAX_RECOVERY_ATTEMPTS) {
|
|
19046
19088
|
process.stderr.write(
|
|
19047
19089
|
`telegram-channel(${AGENT_CODE_NAME}): ghost-reply recovery exhausted retries \u2014 moved to ${next.next}
|
|
@@ -19073,7 +19115,7 @@ function scanRecoveryRetries() {
|
|
|
19073
19115
|
if (!RECOVERY_OUTBOX_DIR) return;
|
|
19074
19116
|
let entries;
|
|
19075
19117
|
try {
|
|
19076
|
-
entries =
|
|
19118
|
+
entries = readdirSync4(RECOVERY_OUTBOX_DIR);
|
|
19077
19119
|
} catch {
|
|
19078
19120
|
return;
|
|
19079
19121
|
}
|
|
@@ -19082,7 +19124,7 @@ function scanRecoveryRetries() {
|
|
|
19082
19124
|
if (!f.includes(".retry-") || f.endsWith(".poison.json")) continue;
|
|
19083
19125
|
let mtimeMs;
|
|
19084
19126
|
try {
|
|
19085
|
-
mtimeMs = statSync2(
|
|
19127
|
+
mtimeMs = statSync2(join12(RECOVERY_OUTBOX_DIR, f)).mtimeMs;
|
|
19086
19128
|
} catch {
|
|
19087
19129
|
continue;
|
|
19088
19130
|
}
|
|
@@ -19094,7 +19136,7 @@ function scanRecoveryRetries() {
|
|
|
19094
19136
|
function startRecoveryOutboxWatcher() {
|
|
19095
19137
|
if (!RECOVERY_OUTBOX_DIR) return;
|
|
19096
19138
|
try {
|
|
19097
|
-
|
|
19139
|
+
mkdirSync9(RECOVERY_OUTBOX_DIR, { recursive: true, mode: 448 });
|
|
19098
19140
|
} catch (err) {
|
|
19099
19141
|
process.stderr.write(
|
|
19100
19142
|
`telegram-channel(${AGENT_CODE_NAME}): recovery outbox mkdir failed: ${err.message}
|
|
@@ -19103,7 +19145,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
19103
19145
|
return;
|
|
19104
19146
|
}
|
|
19105
19147
|
try {
|
|
19106
|
-
for (const f of
|
|
19148
|
+
for (const f of readdirSync4(RECOVERY_OUTBOX_DIR)) {
|
|
19107
19149
|
if (isFirstAttemptOutboxFile(f)) void processRecoveryOutboxFile(f);
|
|
19108
19150
|
}
|
|
19109
19151
|
} catch {
|
|
@@ -19112,7 +19154,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
19112
19154
|
const watcher = watch(RECOVERY_OUTBOX_DIR, (event, filename) => {
|
|
19113
19155
|
if (event !== "rename" || !filename) return;
|
|
19114
19156
|
if (!isFirstAttemptOutboxFile(filename)) return;
|
|
19115
|
-
if (
|
|
19157
|
+
if (existsSync9(join12(RECOVERY_OUTBOX_DIR, filename))) {
|
|
19116
19158
|
void processRecoveryOutboxFile(filename);
|
|
19117
19159
|
}
|
|
19118
19160
|
});
|
|
@@ -19127,7 +19169,7 @@ function startRecoveryOutboxWatcher() {
|
|
|
19127
19169
|
retryTimer.unref?.();
|
|
19128
19170
|
}
|
|
19129
19171
|
startRecoveryOutboxWatcher();
|
|
19130
|
-
var NOTICE_OUTBOX_DIR = AGENT_DIR ?
|
|
19172
|
+
var NOTICE_OUTBOX_DIR = AGENT_DIR ? join12(AGENT_DIR, "telegram-notice-outbox") : null;
|
|
19131
19173
|
var NOTICE_MAX_AGE_MS = 9e4;
|
|
19132
19174
|
var NOTICE_INFLIGHT = /* @__PURE__ */ new Set();
|
|
19133
19175
|
async function processNoticeOutboxFile(filename) {
|
|
@@ -19135,7 +19177,7 @@ async function processNoticeOutboxFile(filename) {
|
|
|
19135
19177
|
if (filename.startsWith(".") || filename.endsWith(".tmp") || !filename.endsWith(".json")) return;
|
|
19136
19178
|
if (NOTICE_INFLIGHT.has(filename)) return;
|
|
19137
19179
|
NOTICE_INFLIGHT.add(filename);
|
|
19138
|
-
const fullPath =
|
|
19180
|
+
const fullPath = join12(NOTICE_OUTBOX_DIR, filename);
|
|
19139
19181
|
try {
|
|
19140
19182
|
let mtimeMs;
|
|
19141
19183
|
try {
|
|
@@ -19152,7 +19194,7 @@ async function processNoticeOutboxFile(filename) {
|
|
|
19152
19194
|
}
|
|
19153
19195
|
let payload;
|
|
19154
19196
|
try {
|
|
19155
|
-
const parsed = JSON.parse(
|
|
19197
|
+
const parsed = JSON.parse(readFileSync12(fullPath, "utf-8"));
|
|
19156
19198
|
if (!parsed || typeof parsed !== "object") throw new Error("not an object");
|
|
19157
19199
|
payload = parsed;
|
|
19158
19200
|
} catch {
|
|
@@ -19214,7 +19256,7 @@ async function processNoticeOutboxFile(filename) {
|
|
|
19214
19256
|
function startNoticeOutboxWatcher() {
|
|
19215
19257
|
if (!NOTICE_OUTBOX_DIR) return;
|
|
19216
19258
|
try {
|
|
19217
|
-
|
|
19259
|
+
mkdirSync9(NOTICE_OUTBOX_DIR, { recursive: true, mode: 448 });
|
|
19218
19260
|
} catch (err) {
|
|
19219
19261
|
process.stderr.write(
|
|
19220
19262
|
`telegram-channel(${AGENT_CODE_NAME}): notice outbox mkdir failed: ${err.message}
|
|
@@ -19223,13 +19265,13 @@ function startNoticeOutboxWatcher() {
|
|
|
19223
19265
|
return;
|
|
19224
19266
|
}
|
|
19225
19267
|
try {
|
|
19226
|
-
for (const f of
|
|
19268
|
+
for (const f of readdirSync4(NOTICE_OUTBOX_DIR)) void processNoticeOutboxFile(f);
|
|
19227
19269
|
} catch {
|
|
19228
19270
|
}
|
|
19229
19271
|
try {
|
|
19230
19272
|
const watcher = watch(NOTICE_OUTBOX_DIR, (event, filename) => {
|
|
19231
19273
|
if (event !== "rename" || !filename) return;
|
|
19232
|
-
if (
|
|
19274
|
+
if (existsSync9(join12(NOTICE_OUTBOX_DIR, filename))) void processNoticeOutboxFile(filename);
|
|
19233
19275
|
});
|
|
19234
19276
|
watcher.unref?.();
|
|
19235
19277
|
} catch (err) {
|
|
@@ -19246,10 +19288,10 @@ function trackPendingMessage(chatId, messageId, chatType, undeliverable = false,
|
|
|
19246
19288
|
}
|
|
19247
19289
|
function sweepTelegramStaleMarkers(thresholdMs) {
|
|
19248
19290
|
if (!PENDING_INBOUND_DIR) return;
|
|
19249
|
-
if (!
|
|
19291
|
+
if (!existsSync9(PENDING_INBOUND_DIR)) return;
|
|
19250
19292
|
let filenames;
|
|
19251
19293
|
try {
|
|
19252
|
-
filenames =
|
|
19294
|
+
filenames = readdirSync4(PENDING_INBOUND_DIR);
|
|
19253
19295
|
} catch (err) {
|
|
19254
19296
|
process.stderr.write(
|
|
19255
19297
|
`telegram-channel(${AGENT_CODE_NAME}): stale-marker readdir failed: ${err.message}
|
|
@@ -19262,10 +19304,10 @@ function sweepTelegramStaleMarkers(thresholdMs) {
|
|
|
19262
19304
|
for (const filename of filenames) {
|
|
19263
19305
|
if (!filename.endsWith(".json")) continue;
|
|
19264
19306
|
if (filename.endsWith(".tmp")) continue;
|
|
19265
|
-
const fullPath =
|
|
19307
|
+
const fullPath = join12(PENDING_INBOUND_DIR, filename);
|
|
19266
19308
|
let marker;
|
|
19267
19309
|
try {
|
|
19268
|
-
marker = JSON.parse(
|
|
19310
|
+
marker = JSON.parse(readFileSync12(fullPath, "utf-8"));
|
|
19269
19311
|
} catch (err) {
|
|
19270
19312
|
process.stderr.write(
|
|
19271
19313
|
`telegram-channel(${AGENT_CODE_NAME}): stale-marker parse failed for ${redactId(filename)}: ${err.message}
|
|
@@ -19311,13 +19353,13 @@ var orphanSweepTimer = setInterval(() => {
|
|
|
19311
19353
|
checkWatchdogGiveUpNotice();
|
|
19312
19354
|
}, orphanSweepIntervalMs());
|
|
19313
19355
|
orphanSweepTimer.unref?.();
|
|
19314
|
-
var TELEGRAM_PROGRESS_HEARTBEAT_PATH = AGENT_DIR ?
|
|
19356
|
+
var TELEGRAM_PROGRESS_HEARTBEAT_PATH = AGENT_DIR ? join12(AGENT_DIR, "channel-progress-heartbeat.json") : null;
|
|
19315
19357
|
var telegramTrackedProgress = null;
|
|
19316
19358
|
var telegramProgressTickRunning = false;
|
|
19317
19359
|
function readTelegramProgressHeartbeat() {
|
|
19318
|
-
if (!TELEGRAM_PROGRESS_HEARTBEAT_PATH || !
|
|
19360
|
+
if (!TELEGRAM_PROGRESS_HEARTBEAT_PATH || !existsSync9(TELEGRAM_PROGRESS_HEARTBEAT_PATH)) return null;
|
|
19319
19361
|
try {
|
|
19320
|
-
return parseProgressHeartbeat(
|
|
19362
|
+
return parseProgressHeartbeat(readFileSync12(TELEGRAM_PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
19321
19363
|
} catch {
|
|
19322
19364
|
return null;
|
|
19323
19365
|
}
|
|
@@ -19326,8 +19368,8 @@ function seedTelegramProgressHeartbeat() {
|
|
|
19326
19368
|
if (!TELEGRAM_PROGRESS_HEARTBEAT_PATH) return;
|
|
19327
19369
|
const tmp = `${TELEGRAM_PROGRESS_HEARTBEAT_PATH}.${process.pid}.tmp`;
|
|
19328
19370
|
try {
|
|
19329
|
-
|
|
19330
|
-
|
|
19371
|
+
writeFileSync11(tmp, serializeProgressHeartbeat(SEED_PROGRESS_STEP, Date.now()), { mode: 384 });
|
|
19372
|
+
renameSync7(tmp, TELEGRAM_PROGRESS_HEARTBEAT_PATH);
|
|
19331
19373
|
} catch {
|
|
19332
19374
|
try {
|
|
19333
19375
|
unlinkSync7(tmp);
|
|
@@ -19336,15 +19378,15 @@ function seedTelegramProgressHeartbeat() {
|
|
|
19336
19378
|
}
|
|
19337
19379
|
}
|
|
19338
19380
|
function findTelegramProgressTarget() {
|
|
19339
|
-
if (!PENDING_INBOUND_DIR || !
|
|
19381
|
+
if (!PENDING_INBOUND_DIR || !existsSync9(PENDING_INBOUND_DIR)) return null;
|
|
19340
19382
|
let best = null;
|
|
19341
19383
|
let bestMs = Infinity;
|
|
19342
19384
|
try {
|
|
19343
|
-
for (const name of
|
|
19385
|
+
for (const name of readdirSync4(PENDING_INBOUND_DIR)) {
|
|
19344
19386
|
if (!name.endsWith(".json")) continue;
|
|
19345
19387
|
let m;
|
|
19346
19388
|
try {
|
|
19347
|
-
m = JSON.parse(
|
|
19389
|
+
m = JSON.parse(readFileSync12(join12(PENDING_INBOUND_DIR, name), "utf-8"));
|
|
19348
19390
|
} catch {
|
|
19349
19391
|
continue;
|
|
19350
19392
|
}
|
|
@@ -19468,14 +19510,14 @@ if (BOT_TOKEN && PENDING_INBOUND_DIR) {
|
|
|
19468
19510
|
}
|
|
19469
19511
|
var lastGiveUpHandledAtMs = null;
|
|
19470
19512
|
function listPendingInboundChatIds() {
|
|
19471
|
-
if (!PENDING_INBOUND_DIR || !
|
|
19513
|
+
if (!PENDING_INBOUND_DIR || !existsSync9(PENDING_INBOUND_DIR)) return [];
|
|
19472
19514
|
const chats = /* @__PURE__ */ new Set();
|
|
19473
19515
|
try {
|
|
19474
|
-
for (const name of
|
|
19516
|
+
for (const name of readdirSync4(PENDING_INBOUND_DIR)) {
|
|
19475
19517
|
if (!name.endsWith(".json")) continue;
|
|
19476
19518
|
try {
|
|
19477
19519
|
const marker = JSON.parse(
|
|
19478
|
-
|
|
19520
|
+
readFileSync12(join12(PENDING_INBOUND_DIR, name), "utf8")
|
|
19479
19521
|
);
|
|
19480
19522
|
if (typeof marker.seen_at === "string" && marker.seen_at) continue;
|
|
19481
19523
|
if (typeof marker.chat_id === "string" && marker.chat_id) chats.add(marker.chat_id);
|
|
@@ -19517,7 +19559,7 @@ async function notifyWatchdogGiveUp(chatId, reason) {
|
|
|
19517
19559
|
}
|
|
19518
19560
|
function checkWatchdogGiveUpNotice() {
|
|
19519
19561
|
if (!AGENT_DIR) return;
|
|
19520
|
-
const signal = readGiveUpSignal(
|
|
19562
|
+
const signal = readGiveUpSignal(join12(AGENT_DIR, GIVE_UP_SIGNAL_FILENAME));
|
|
19521
19563
|
const signalAtMs = signal?.atMs ?? null;
|
|
19522
19564
|
const act = decideGiveUpNotice({
|
|
19523
19565
|
signalAtMs,
|
|
@@ -19579,7 +19621,7 @@ async function deliverQueuedReply(p) {
|
|
|
19579
19621
|
}
|
|
19580
19622
|
}
|
|
19581
19623
|
function clearPendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
|
|
19582
|
-
if (!PENDING_INBOUND_DIR || !
|
|
19624
|
+
if (!PENDING_INBOUND_DIR || !existsSync9(PENDING_INBOUND_DIR)) return;
|
|
19583
19625
|
clearAllTelegramPendingMarkersForChat(
|
|
19584
19626
|
PENDING_INBOUND_DIR,
|
|
19585
19627
|
chatId,
|
|
@@ -19588,7 +19630,7 @@ function clearPendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
|
|
|
19588
19630
|
);
|
|
19589
19631
|
}
|
|
19590
19632
|
function markSeenPendingMessage(chatId, cutoffMs = Number.POSITIVE_INFINITY) {
|
|
19591
|
-
if (!PENDING_INBOUND_DIR || !
|
|
19633
|
+
if (!PENDING_INBOUND_DIR || !existsSync9(PENDING_INBOUND_DIR)) return;
|
|
19592
19634
|
markSeenAllTelegramPendingMarkersForChat(
|
|
19593
19635
|
PENDING_INBOUND_DIR,
|
|
19594
19636
|
chatId,
|
|
@@ -19873,7 +19915,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
19873
19915
|
isError: true
|
|
19874
19916
|
};
|
|
19875
19917
|
}
|
|
19876
|
-
bytes =
|
|
19918
|
+
bytes = readFileSync12(realPath);
|
|
19877
19919
|
} catch (err) {
|
|
19878
19920
|
return { content: [{ type: "text", text: `Failed to read file: ${err.message}` }], isError: true };
|
|
19879
19921
|
}
|
|
@@ -20014,6 +20056,12 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
20014
20056
|
if (name === "telegram.reply") {
|
|
20015
20057
|
if (interim) markSeenPendingMessage(chat_id, drainCutoffMs);
|
|
20016
20058
|
else clearPendingMessage(chat_id, drainCutoffMs);
|
|
20059
|
+
writeInboundDeliveryLedgerEntry(DELIVERY_LEDGER_DIR, {
|
|
20060
|
+
inbound_id: telegramInboundId(chat_id, reply_to_message_id ? String(reply_to_message_id) : ""),
|
|
20061
|
+
source: "telegram",
|
|
20062
|
+
conv_key: chat_id,
|
|
20063
|
+
delivered_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
20064
|
+
});
|
|
20017
20065
|
}
|
|
20018
20066
|
return { content: [{ type: "text", text: "sent" }] };
|
|
20019
20067
|
} catch (err) {
|
|
@@ -20414,13 +20462,13 @@ await mcp.connect(new StdioServerTransport());
|
|
|
20414
20462
|
var REPLAY_SCAN_INTERVAL_MS = 6e4;
|
|
20415
20463
|
async function replayPendingTelegramMarkers() {
|
|
20416
20464
|
if (!channelReplayEnabled()) return;
|
|
20417
|
-
if (!PENDING_INBOUND_DIR || !
|
|
20465
|
+
if (!PENDING_INBOUND_DIR || !existsSync9(PENDING_INBOUND_DIR)) return;
|
|
20418
20466
|
const probe = process.env.TMUX && AGENT_CODE_NAME && AGENT_CODE_NAME !== "unknown" ? probeAgentSessionCached(AGENT_CODE_NAME) : { tmux: "unknown", claude: "unknown" };
|
|
20419
20467
|
const sessionAlive = probe.tmux === "alive" && probe.claude === "alive";
|
|
20420
20468
|
if (!sessionAlive) return;
|
|
20421
20469
|
let filenames;
|
|
20422
20470
|
try {
|
|
20423
|
-
filenames =
|
|
20471
|
+
filenames = readdirSync4(PENDING_INBOUND_DIR);
|
|
20424
20472
|
} catch {
|
|
20425
20473
|
return;
|
|
20426
20474
|
}
|
|
@@ -20428,7 +20476,7 @@ async function replayPendingTelegramMarkers() {
|
|
|
20428
20476
|
let paneFreshAgeMs = null;
|
|
20429
20477
|
if (AGENT_DIR) {
|
|
20430
20478
|
try {
|
|
20431
|
-
paneFreshAgeMs = Math.max(0, now - statSync2(
|
|
20479
|
+
paneFreshAgeMs = Math.max(0, now - statSync2(join12(AGENT_DIR, "pane.log")).mtimeMs);
|
|
20432
20480
|
} catch {
|
|
20433
20481
|
}
|
|
20434
20482
|
}
|
|
@@ -20436,10 +20484,10 @@ async function replayPendingTelegramMarkers() {
|
|
|
20436
20484
|
const entries = [];
|
|
20437
20485
|
for (const name of filenames) {
|
|
20438
20486
|
if (!name.endsWith(".json") || name.endsWith(".tmp")) continue;
|
|
20439
|
-
const fullPath =
|
|
20487
|
+
const fullPath = join12(PENDING_INBOUND_DIR, name);
|
|
20440
20488
|
let marker;
|
|
20441
20489
|
try {
|
|
20442
|
-
marker = JSON.parse(
|
|
20490
|
+
marker = JSON.parse(readFileSync12(fullPath, "utf-8"));
|
|
20443
20491
|
} catch {
|
|
20444
20492
|
continue;
|
|
20445
20493
|
}
|
|
@@ -20959,7 +21007,7 @@ async function pollLoop() {
|
|
|
20959
21007
|
let paneLogFreshAgeMs = null;
|
|
20960
21008
|
if (AGENT_DIR) {
|
|
20961
21009
|
try {
|
|
20962
|
-
const paneMtimeMs = statSync2(
|
|
21010
|
+
const paneMtimeMs = statSync2(join12(AGENT_DIR, "pane.log")).mtimeMs;
|
|
20963
21011
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
20964
21012
|
} catch {
|
|
20965
21013
|
}
|