@integrity-labs/agt-cli 0.28.422 → 0.28.424
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 +4 -4
- package/dist/{chunk-6JC5YLU5.js → chunk-2QBY2QVX.js} +3 -3
- package/dist/{chunk-EP6E6CIY.js → chunk-3HLECXMI.js} +28 -6
- package/dist/chunk-3HLECXMI.js.map +1 -0
- package/dist/{chunk-XFC7YVGS.js → chunk-CWIWI2ZX.js} +1 -1
- package/dist/{chunk-XFC7YVGS.js.map → chunk-CWIWI2ZX.js.map} +1 -1
- package/dist/{claude-pair-runtime-3JHCWZZD.js → claude-pair-runtime-PAP4BS3I.js} +2 -2
- package/dist/lib/manager-worker.js +65 -44
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +80 -64
- package/dist/mcp/slack-channel.js +1 -1
- package/dist/mcp/telegram-channel.js +113 -97
- package/dist/{persistent-session-HWCKGPYF.js → persistent-session-O7OCNB6B.js} +2 -2
- package/dist/{responsiveness-probe-4CGMUXOH.js → responsiveness-probe-R5FWKHPI.js} +2 -2
- package/dist/{scheduler-engine-HYOOQV4A.js → scheduler-engine-NDP36U7O.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-EP6E6CIY.js.map +0 -1
- /package/dist/{chunk-6JC5YLU5.js.map → chunk-2QBY2QVX.js.map} +0 -0
- /package/dist/{claude-pair-runtime-3JHCWZZD.js.map → claude-pair-runtime-PAP4BS3I.js.map} +0 -0
- /package/dist/{persistent-session-HWCKGPYF.js.map → persistent-session-O7OCNB6B.js.map} +0 -0
- /package/dist/{responsiveness-probe-4CGMUXOH.js.map → responsiveness-probe-R5FWKHPI.js.map} +0 -0
- /package/dist/{scheduler-engine-HYOOQV4A.js.map → scheduler-engine-NDP36U7O.js.map} +0 -0
|
@@ -18867,7 +18867,7 @@ var require_filters = __commonJS({
|
|
|
18867
18867
|
return r.copySafeness(str, res);
|
|
18868
18868
|
}
|
|
18869
18869
|
_exports.indent = indent;
|
|
18870
|
-
function
|
|
18870
|
+
function join12(arr, del, attr) {
|
|
18871
18871
|
del = del || "";
|
|
18872
18872
|
if (attr) {
|
|
18873
18873
|
arr = lib.map(arr, function(v) {
|
|
@@ -18876,7 +18876,7 @@ var require_filters = __commonJS({
|
|
|
18876
18876
|
}
|
|
18877
18877
|
return arr.join(del);
|
|
18878
18878
|
}
|
|
18879
|
-
_exports.join =
|
|
18879
|
+
_exports.join = join12;
|
|
18880
18880
|
function last(arr) {
|
|
18881
18881
|
return arr[arr.length - 1];
|
|
18882
18882
|
}
|
|
@@ -29827,17 +29827,30 @@ function writeTurnInitiatorMarker(input) {
|
|
|
29827
29827
|
}
|
|
29828
29828
|
}
|
|
29829
29829
|
|
|
29830
|
+
// src/scheduled-turn-marker.ts
|
|
29831
|
+
import { readFileSync as readFileSync3, unlinkSync } from "fs";
|
|
29832
|
+
import { join as join3 } from "path";
|
|
29833
|
+
var SCHEDULED_TURN_MARKER_FILENAME = ".current-scheduled-turn.json";
|
|
29834
|
+
var SCHEDULED_TURN_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
29835
|
+
function clearScheduledTurnMarker(agentDir) {
|
|
29836
|
+
if (!agentDir) return;
|
|
29837
|
+
try {
|
|
29838
|
+
unlinkSync(join3(agentDir, SCHEDULED_TURN_MARKER_FILENAME));
|
|
29839
|
+
} catch {
|
|
29840
|
+
}
|
|
29841
|
+
}
|
|
29842
|
+
|
|
29830
29843
|
// src/direct-chat-pending-inbound.ts
|
|
29831
29844
|
import {
|
|
29832
29845
|
existsSync as existsSync2,
|
|
29833
29846
|
mkdirSync as mkdirSync2,
|
|
29834
29847
|
readdirSync,
|
|
29835
|
-
readFileSync as
|
|
29848
|
+
readFileSync as readFileSync4,
|
|
29836
29849
|
renameSync as renameSync2,
|
|
29837
|
-
unlinkSync,
|
|
29850
|
+
unlinkSync as unlinkSync2,
|
|
29838
29851
|
writeFileSync as writeFileSync2
|
|
29839
29852
|
} from "fs";
|
|
29840
|
-
import { join as
|
|
29853
|
+
import { join as join4 } from "path";
|
|
29841
29854
|
function hexEncodeSegment(value) {
|
|
29842
29855
|
return Buffer.from(value, "utf8").toString("hex");
|
|
29843
29856
|
}
|
|
@@ -29846,7 +29859,7 @@ function directChatMarkerName(sessionId, messageId) {
|
|
|
29846
29859
|
}
|
|
29847
29860
|
var defaultClearMarkerFile = (fullPath) => {
|
|
29848
29861
|
try {
|
|
29849
|
-
if (existsSync2(fullPath))
|
|
29862
|
+
if (existsSync2(fullPath)) unlinkSync2(fullPath);
|
|
29850
29863
|
} catch {
|
|
29851
29864
|
}
|
|
29852
29865
|
};
|
|
@@ -29864,7 +29877,7 @@ function writeDirectChatPendingInboundMarker(dir, sessionId, messageId) {
|
|
|
29864
29877
|
received_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
29865
29878
|
inbound_id: directChatInboundId(sessionId, messageId)
|
|
29866
29879
|
};
|
|
29867
|
-
const final =
|
|
29880
|
+
const final = join4(dir, directChatMarkerName(sessionId, messageId));
|
|
29868
29881
|
const tmp = `${final}.tmp`;
|
|
29869
29882
|
writeFileSync2(tmp, JSON.stringify(marker), "utf8");
|
|
29870
29883
|
renameSync2(tmp, final);
|
|
@@ -29883,15 +29896,15 @@ function clearDirectChatPendingMarkersForSession(dir, sessionId, op = defaultCle
|
|
|
29883
29896
|
}
|
|
29884
29897
|
for (const name of names) {
|
|
29885
29898
|
if (!name.startsWith(prefix) || !name.endsWith(".json")) continue;
|
|
29886
|
-
op(
|
|
29899
|
+
op(join4(dir, name));
|
|
29887
29900
|
cleared += 1;
|
|
29888
29901
|
}
|
|
29889
29902
|
return cleared;
|
|
29890
29903
|
}
|
|
29891
|
-
function readDirectChatPendingInboundMarker(dir, sessionId, messageId, readFileImpl = (path) =>
|
|
29904
|
+
function readDirectChatPendingInboundMarker(dir, sessionId, messageId, readFileImpl = (path) => readFileSync4(path, "utf8")) {
|
|
29892
29905
|
if (!dir || !sessionId || !messageId) return null;
|
|
29893
29906
|
try {
|
|
29894
|
-
const raw = readFileImpl(
|
|
29907
|
+
const raw = readFileImpl(join4(dir, directChatMarkerName(sessionId, messageId)));
|
|
29895
29908
|
return JSON.parse(raw);
|
|
29896
29909
|
} catch {
|
|
29897
29910
|
return null;
|
|
@@ -29908,7 +29921,7 @@ function sweepAgedDirectChatMarkers(dir, deps) {
|
|
|
29908
29921
|
}
|
|
29909
29922
|
for (const name of names) {
|
|
29910
29923
|
if (!name.endsWith(".json") || name.startsWith(".")) continue;
|
|
29911
|
-
const full =
|
|
29924
|
+
const full = join4(dir, name);
|
|
29912
29925
|
let marker;
|
|
29913
29926
|
try {
|
|
29914
29927
|
marker = JSON.parse(deps.readFile(full));
|
|
@@ -29997,8 +30010,8 @@ async function consumeDirectChatRecoveryFile(fullPath, filename, deps) {
|
|
|
29997
30010
|
}
|
|
29998
30011
|
|
|
29999
30012
|
// src/inbound-delivery-ledger.ts
|
|
30000
|
-
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as
|
|
30001
|
-
import { join as
|
|
30013
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync5, renameSync as renameSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
30014
|
+
import { join as join5 } from "path";
|
|
30002
30015
|
function safeInboundId(inboundId) {
|
|
30003
30016
|
return inboundId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
30004
30017
|
}
|
|
@@ -30007,7 +30020,7 @@ var defaultDeps = {
|
|
|
30007
30020
|
writeFile: (path, data) => writeFileSync3(path, data, "utf8"),
|
|
30008
30021
|
rename: (from, to) => renameSync3(from, to),
|
|
30009
30022
|
readdir: (dir) => readdirSync2(dir),
|
|
30010
|
-
readFile: (path) =>
|
|
30023
|
+
readFile: (path) => readFileSync5(path, "utf8"),
|
|
30011
30024
|
exists: (path) => existsSync3(path)
|
|
30012
30025
|
};
|
|
30013
30026
|
function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
@@ -30016,7 +30029,7 @@ function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
|
30016
30029
|
if (!safe || safe.includes("/") || safe.includes("\\") || safe.includes("..")) return;
|
|
30017
30030
|
try {
|
|
30018
30031
|
deps.mkdir(dir);
|
|
30019
|
-
const final =
|
|
30032
|
+
const final = join5(dir, `${safe}.json`);
|
|
30020
30033
|
const tmp = `${final}.tmp`;
|
|
30021
30034
|
deps.writeFile(tmp, JSON.stringify(record2));
|
|
30022
30035
|
deps.rename(tmp, final);
|
|
@@ -30028,22 +30041,22 @@ function inboundDeliveryLedgerHas(dir, inboundId, deps = defaultDeps) {
|
|
|
30028
30041
|
const safe = safeInboundId(inboundId);
|
|
30029
30042
|
if (!safe || safe.includes("/") || safe.includes("\\") || safe.includes("..")) return false;
|
|
30030
30043
|
try {
|
|
30031
|
-
return deps.exists(
|
|
30044
|
+
return deps.exists(join5(dir, `${safe}.json`));
|
|
30032
30045
|
} catch {
|
|
30033
30046
|
return false;
|
|
30034
30047
|
}
|
|
30035
30048
|
}
|
|
30036
30049
|
|
|
30037
30050
|
// src/ack-reaction.ts
|
|
30038
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
30039
|
-
import { join as
|
|
30051
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
30052
|
+
import { join as join7 } from "path";
|
|
30040
30053
|
|
|
30041
30054
|
// src/flags-cache-read.ts
|
|
30042
|
-
import { existsSync as existsSync4, readFileSync as
|
|
30055
|
+
import { existsSync as existsSync4, readFileSync as readFileSync6 } from "fs";
|
|
30043
30056
|
import { homedir } from "os";
|
|
30044
|
-
import { join as
|
|
30057
|
+
import { join as join6 } from "path";
|
|
30045
30058
|
function defaultFlagsCachePath() {
|
|
30046
|
-
return
|
|
30059
|
+
return join6(homedir(), ".augmented", "flags-cache.json");
|
|
30047
30060
|
}
|
|
30048
30061
|
function envBoolean(raw) {
|
|
30049
30062
|
if (raw === void 0) return void 0;
|
|
@@ -30056,7 +30069,7 @@ function envBoolean(raw) {
|
|
|
30056
30069
|
function cachedBoolean(key, path) {
|
|
30057
30070
|
try {
|
|
30058
30071
|
if (!existsSync4(path)) return void 0;
|
|
30059
|
-
const parsed = JSON.parse(
|
|
30072
|
+
const parsed = JSON.parse(readFileSync6(path, "utf8"));
|
|
30060
30073
|
if (!parsed || typeof parsed !== "object") return void 0;
|
|
30061
30074
|
const flags = parsed.flags;
|
|
30062
30075
|
if (!flags || typeof flags !== "object") return void 0;
|
|
@@ -30142,7 +30155,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
|
|
|
30142
30155
|
if (!name.endsWith(".json")) continue;
|
|
30143
30156
|
let receivedAt;
|
|
30144
30157
|
try {
|
|
30145
|
-
const raw = JSON.parse(
|
|
30158
|
+
const raw = JSON.parse(readFileSync7(join7(dir, name), "utf-8"));
|
|
30146
30159
|
if (raw.discretionary === true) continue;
|
|
30147
30160
|
if (!opts?.includeSeen && typeof raw.seen_at === "string" && raw.seen_at) continue;
|
|
30148
30161
|
receivedAt = raw.received_at;
|
|
@@ -30183,14 +30196,14 @@ function isMarkerGenuinelyAged(receivedAt, nowMs, thresholdMs) {
|
|
|
30183
30196
|
}
|
|
30184
30197
|
var DEFLECTION_COUNTER_SUFFIX = "-deflections.json";
|
|
30185
30198
|
function deflectionCounterPath(agentDir, channel) {
|
|
30186
|
-
return
|
|
30199
|
+
return join7(agentDir, `${channel}${DEFLECTION_COUNTER_SUFFIX}`);
|
|
30187
30200
|
}
|
|
30188
30201
|
function recordChannelDeflection(agentDir, channel, cause) {
|
|
30189
30202
|
if (!agentDir) return;
|
|
30190
30203
|
const path = deflectionCounterPath(agentDir, channel);
|
|
30191
30204
|
let counts = {};
|
|
30192
30205
|
try {
|
|
30193
|
-
const parsed = JSON.parse(
|
|
30206
|
+
const parsed = JSON.parse(readFileSync7(path, "utf-8"));
|
|
30194
30207
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
30195
30208
|
} catch {
|
|
30196
30209
|
}
|
|
@@ -30277,14 +30290,14 @@ async function fetchWithTimeout(input, init, timeoutMs, fetchImpl = fetch) {
|
|
|
30277
30290
|
import {
|
|
30278
30291
|
existsSync as existsSync5,
|
|
30279
30292
|
mkdirSync as mkdirSync4,
|
|
30280
|
-
readFileSync as
|
|
30293
|
+
readFileSync as readFileSync8,
|
|
30281
30294
|
renameSync as renameSync4,
|
|
30282
30295
|
statSync,
|
|
30283
|
-
unlinkSync as
|
|
30296
|
+
unlinkSync as unlinkSync3,
|
|
30284
30297
|
utimesSync,
|
|
30285
30298
|
writeFileSync as writeFileSync5
|
|
30286
30299
|
} from "fs";
|
|
30287
|
-
import { join as
|
|
30300
|
+
import { join as join8 } from "path";
|
|
30288
30301
|
var STALE_LOCK_MS = 9e4;
|
|
30289
30302
|
var HEARTBEAT_INTERVAL_MS = 3e4;
|
|
30290
30303
|
function defaultIsPidAlive(pid) {
|
|
@@ -30307,7 +30320,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
30307
30320
|
const nowMs = options.nowMs ?? (() => Date.now());
|
|
30308
30321
|
const lockMtimeMs = options.lockMtimeMs ?? defaultLockMtimeMs;
|
|
30309
30322
|
const staleMs = options.staleMs ?? STALE_LOCK_MS;
|
|
30310
|
-
const path =
|
|
30323
|
+
const path = join8(agentDir, basename);
|
|
30311
30324
|
const existing = readLockHolder(path);
|
|
30312
30325
|
if (existing) {
|
|
30313
30326
|
if (existing.pid === selfPid) {
|
|
@@ -30335,7 +30348,7 @@ function releaseMcpSpawnLock(lockPath, opts = {}) {
|
|
|
30335
30348
|
if (!existing) return;
|
|
30336
30349
|
if (existing.pid !== selfPid) return;
|
|
30337
30350
|
try {
|
|
30338
|
-
|
|
30351
|
+
unlinkSync3(lockPath);
|
|
30339
30352
|
} catch {
|
|
30340
30353
|
}
|
|
30341
30354
|
}
|
|
@@ -30374,7 +30387,7 @@ function defaultLockMtimeMs(path) {
|
|
|
30374
30387
|
function readLockHolder(path) {
|
|
30375
30388
|
if (!existsSync5(path)) return null;
|
|
30376
30389
|
try {
|
|
30377
|
-
const raw =
|
|
30390
|
+
const raw = readFileSync8(path, "utf8");
|
|
30378
30391
|
const parsed = JSON.parse(raw);
|
|
30379
30392
|
const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
|
|
30380
30393
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
@@ -30387,38 +30400,38 @@ function readLockHolder(path) {
|
|
|
30387
30400
|
|
|
30388
30401
|
// src/direct-chat-channel.ts
|
|
30389
30402
|
import { homedir as homedir3 } from "os";
|
|
30390
|
-
import { join as
|
|
30403
|
+
import { join as join11 } from "path";
|
|
30391
30404
|
import { randomUUID } from "crypto";
|
|
30392
30405
|
import {
|
|
30393
30406
|
watch,
|
|
30394
30407
|
mkdirSync as mkdirSync5,
|
|
30395
30408
|
writeFileSync as writeFileSync6,
|
|
30396
|
-
readFileSync as
|
|
30409
|
+
readFileSync as readFileSync10,
|
|
30397
30410
|
readdirSync as readdirSync4,
|
|
30398
30411
|
existsSync as existsSync6,
|
|
30399
30412
|
renameSync as renameSync5,
|
|
30400
|
-
unlinkSync as
|
|
30413
|
+
unlinkSync as unlinkSync4,
|
|
30401
30414
|
statSync as statSync2,
|
|
30402
30415
|
createWriteStream
|
|
30403
30416
|
} from "fs";
|
|
30404
30417
|
|
|
30405
30418
|
// src/direct-chat-inbound-attachments.ts
|
|
30406
|
-
import { dirname as dirname2, join as
|
|
30419
|
+
import { dirname as dirname2, join as join9 } from "path";
|
|
30407
30420
|
var MAX_INBOUND_ATTACHMENT_BYTES = 10 * 1024 * 1024;
|
|
30408
30421
|
var INBOUND_ATTACHMENTS_SUBDIR = "direct-chat-inbound";
|
|
30409
30422
|
function resolveInboundAttachmentsDir(input) {
|
|
30410
30423
|
const { codeName, turnInitiatorFile, agentId, homeDir } = input;
|
|
30411
30424
|
const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
|
|
30412
30425
|
if (codeNameTrimmed) {
|
|
30413
|
-
return
|
|
30426
|
+
return join9(homeDir, ".augmented", codeNameTrimmed, INBOUND_ATTACHMENTS_SUBDIR);
|
|
30414
30427
|
}
|
|
30415
30428
|
const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
|
|
30416
30429
|
if (initiator) {
|
|
30417
|
-
return
|
|
30430
|
+
return join9(dirname2(initiator), INBOUND_ATTACHMENTS_SUBDIR);
|
|
30418
30431
|
}
|
|
30419
30432
|
const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
|
|
30420
30433
|
if (agentIdTrimmed) {
|
|
30421
|
-
return
|
|
30434
|
+
return join9(homeDir, ".augmented", agentIdTrimmed, INBOUND_ATTACHMENTS_SUBDIR);
|
|
30422
30435
|
}
|
|
30423
30436
|
return null;
|
|
30424
30437
|
}
|
|
@@ -30825,9 +30838,9 @@ function isMaintenanceModeActive(opts) {
|
|
|
30825
30838
|
}
|
|
30826
30839
|
|
|
30827
30840
|
// src/usage-limit-notice.ts
|
|
30828
|
-
import { readFileSync as
|
|
30841
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
30829
30842
|
import { homedir as homedir2 } from "os";
|
|
30830
|
-
import { join as
|
|
30843
|
+
import { join as join10 } from "path";
|
|
30831
30844
|
|
|
30832
30845
|
// ../core/dist/types/integration.js
|
|
30833
30846
|
var HITL_TIER_ORDER = [
|
|
@@ -35346,14 +35359,14 @@ var FLAGS_SCHEMA_VERSION = computeFlagsSchemaVersion();
|
|
|
35346
35359
|
// src/usage-limit-notice.ts
|
|
35347
35360
|
function usageLimitMarkerPath(codeName) {
|
|
35348
35361
|
if (!codeName) return null;
|
|
35349
|
-
return
|
|
35362
|
+
return join10(homedir2(), ".augmented", codeName, USAGE_LIMIT_MARKER_FILENAME);
|
|
35350
35363
|
}
|
|
35351
35364
|
function readUsageLimitUntil(opts) {
|
|
35352
35365
|
const path = opts.filePath ?? usageLimitMarkerPath(opts.codeName);
|
|
35353
35366
|
if (!path) return null;
|
|
35354
35367
|
let raw;
|
|
35355
35368
|
try {
|
|
35356
|
-
raw =
|
|
35369
|
+
raw = readFileSync9(path, "utf-8");
|
|
35357
35370
|
} catch {
|
|
35358
35371
|
return null;
|
|
35359
35372
|
}
|
|
@@ -35384,7 +35397,7 @@ var DIRECT_CHAT_USAGE_LIMIT_CACHE = /* @__PURE__ */ new Map();
|
|
|
35384
35397
|
var AGT_HOST = process.env.AGT_HOST;
|
|
35385
35398
|
var AGT_API_KEY = process.env.AGT_API_KEY;
|
|
35386
35399
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID;
|
|
35387
|
-
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ?
|
|
35400
|
+
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ? join11(homedir3(), ".augmented", AGT_AGENT_ID) : null;
|
|
35388
35401
|
var INBOUND_ATTACHMENTS_DIR = resolveInboundAttachmentsDir({
|
|
35389
35402
|
codeName: process.env.AGT_AGENT_CODE_NAME,
|
|
35390
35403
|
turnInitiatorFile: process.env.AGT_TURN_INITIATOR_FILE,
|
|
@@ -35395,10 +35408,10 @@ var AGT_AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME;
|
|
|
35395
35408
|
var directChatStderrLogStream = null;
|
|
35396
35409
|
if (AGT_AGENT_CODE_NAME) {
|
|
35397
35410
|
try {
|
|
35398
|
-
const logDir =
|
|
35411
|
+
const logDir = join11(homedir3(), ".augmented", AGT_AGENT_CODE_NAME);
|
|
35399
35412
|
mkdirSync5(logDir, { recursive: true });
|
|
35400
35413
|
directChatStderrLogStream = createWriteStream(
|
|
35401
|
-
|
|
35414
|
+
join11(logDir, "direct-chat-channel-stderr.log"),
|
|
35402
35415
|
{ flags: "a", mode: 384 }
|
|
35403
35416
|
);
|
|
35404
35417
|
directChatStderrLogStream.on("error", () => {
|
|
@@ -35417,10 +35430,10 @@ if (AGT_AGENT_CODE_NAME) {
|
|
|
35417
35430
|
} catch {
|
|
35418
35431
|
}
|
|
35419
35432
|
}
|
|
35420
|
-
var PROGRESS_HEARTBEAT_PATH = AGT_AGENT_CODE_NAME ?
|
|
35421
|
-
var DIRECT_CHAT_PENDING_INBOUND_DIR = AGT_AGENT_CODE_NAME ?
|
|
35422
|
-
var DIRECT_CHAT_DELIVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ?
|
|
35423
|
-
var DIRECT_CHAT_CODE_NAME_AGENT_DIR = AGT_AGENT_CODE_NAME ?
|
|
35433
|
+
var PROGRESS_HEARTBEAT_PATH = AGT_AGENT_CODE_NAME ? join11(homedir3(), ".augmented", AGT_AGENT_CODE_NAME, "channel-progress-heartbeat.json") : null;
|
|
35434
|
+
var DIRECT_CHAT_PENDING_INBOUND_DIR = AGT_AGENT_CODE_NAME ? join11(homedir3(), ".augmented", AGT_AGENT_CODE_NAME, "direct-chat-pending-inbound") : null;
|
|
35435
|
+
var DIRECT_CHAT_DELIVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ? join11(homedir3(), ".augmented", AGT_AGENT_CODE_NAME, ".agt-inbound-delivery-ledger") : null;
|
|
35436
|
+
var DIRECT_CHAT_CODE_NAME_AGENT_DIR = AGT_AGENT_CODE_NAME ? join11(homedir3(), ".augmented", AGT_AGENT_CODE_NAME) : null;
|
|
35424
35437
|
var DIRECT_CHAT_STALE_MARKER_MS = 24 * 60 * 60 * 1e3;
|
|
35425
35438
|
function recordDirectChatDelivery(sessionId, messageIds) {
|
|
35426
35439
|
if (!sessionId) return;
|
|
@@ -35431,8 +35444,8 @@ function recordDirectChatDelivery(sessionId, messageIds) {
|
|
|
35431
35444
|
delivered_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
35432
35445
|
});
|
|
35433
35446
|
}
|
|
35434
|
-
var DIRECT_CHAT_RECOVERY_OUTBOX_DIR = AGT_AGENT_CODE_NAME ?
|
|
35435
|
-
var DIRECT_CHAT_RECOVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ?
|
|
35447
|
+
var DIRECT_CHAT_RECOVERY_OUTBOX_DIR = AGT_AGENT_CODE_NAME ? join11(homedir3(), ".augmented", AGT_AGENT_CODE_NAME, "direct-chat-recovery-outbox") : null;
|
|
35448
|
+
var DIRECT_CHAT_RECOVERY_LEDGER_DIR = AGT_AGENT_CODE_NAME ? join11(homedir3(), ".augmented", AGT_AGENT_CODE_NAME, ".agt-direct-chat-recovery-ledger") : null;
|
|
35436
35449
|
var progressReceivedAt = /* @__PURE__ */ new Map();
|
|
35437
35450
|
var directChatProgressState = { tracked: null };
|
|
35438
35451
|
var directChatProgressTickRunning = false;
|
|
@@ -35451,7 +35464,7 @@ var directChatKanbanCardClient = createKanbanCardActiveClient({
|
|
|
35451
35464
|
function readProgressHeartbeat() {
|
|
35452
35465
|
if (!PROGRESS_HEARTBEAT_PATH || !existsSync6(PROGRESS_HEARTBEAT_PATH)) return null;
|
|
35453
35466
|
try {
|
|
35454
|
-
return parseProgressHeartbeat(
|
|
35467
|
+
return parseProgressHeartbeat(readFileSync10(PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
35455
35468
|
} catch {
|
|
35456
35469
|
return null;
|
|
35457
35470
|
}
|
|
@@ -35460,12 +35473,12 @@ function seedProgressHeartbeat() {
|
|
|
35460
35473
|
if (!PROGRESS_HEARTBEAT_PATH) return;
|
|
35461
35474
|
const tmp = `${PROGRESS_HEARTBEAT_PATH}.${process.pid}.tmp`;
|
|
35462
35475
|
try {
|
|
35463
|
-
mkdirSync5(
|
|
35476
|
+
mkdirSync5(join11(homedir3(), ".augmented", AGT_AGENT_CODE_NAME), { recursive: true });
|
|
35464
35477
|
writeFileSync6(tmp, serializeProgressHeartbeat(SEED_PROGRESS_STEP, Date.now()), { mode: 384 });
|
|
35465
35478
|
renameSync5(tmp, PROGRESS_HEARTBEAT_PATH);
|
|
35466
35479
|
} catch {
|
|
35467
35480
|
try {
|
|
35468
|
-
|
|
35481
|
+
unlinkSync4(tmp);
|
|
35469
35482
|
} catch {
|
|
35470
35483
|
}
|
|
35471
35484
|
}
|
|
@@ -35620,7 +35633,7 @@ var inboundAttachmentDeps = {
|
|
|
35620
35633
|
},
|
|
35621
35634
|
ensureDir: (dir) => mkdirSync5(dir, { recursive: true }),
|
|
35622
35635
|
writeFile: (path, bytes) => writeFileSync6(path, bytes, { mode: 384 }),
|
|
35623
|
-
joinPath: (...parts) =>
|
|
35636
|
+
joinPath: (...parts) => join11(...parts),
|
|
35624
35637
|
warn: (msg) => process.stderr.write(`${msg}
|
|
35625
35638
|
`)
|
|
35626
35639
|
};
|
|
@@ -35944,7 +35957,7 @@ function scheduleDirectChatBusyAck(sessionId, messageId, arrivedWhileBusy) {
|
|
|
35944
35957
|
let paneLogFreshAgeMs = null;
|
|
35945
35958
|
if (DIRECT_CHAT_CODE_NAME_AGENT_DIR) {
|
|
35946
35959
|
try {
|
|
35947
|
-
const paneMtimeMs = statSync2(
|
|
35960
|
+
const paneMtimeMs = statSync2(join11(DIRECT_CHAT_CODE_NAME_AGENT_DIR, "pane.log")).mtimeMs;
|
|
35948
35961
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
35949
35962
|
} catch {
|
|
35950
35963
|
}
|
|
@@ -36101,6 +36114,9 @@ async function pollForMessages(sinceMs) {
|
|
|
36101
36114
|
if (annotation) injectContent = `${msg.content}${annotation}`;
|
|
36102
36115
|
attachmentMeta = buildAttachmentMeta(processed);
|
|
36103
36116
|
}
|
|
36117
|
+
if (!isNotice && msg.sender_id) {
|
|
36118
|
+
clearScheduledTurnMarker(DIRECT_CHAT_CODE_NAME_AGENT_DIR);
|
|
36119
|
+
}
|
|
36104
36120
|
await mcp.notification({
|
|
36105
36121
|
method: "notifications/claude/channel",
|
|
36106
36122
|
params: {
|
|
@@ -36267,9 +36283,9 @@ function sweepAgedDirectChatMarkersNow(thresholdMs) {
|
|
|
36267
36283
|
const now = Date.now();
|
|
36268
36284
|
const res = sweepAgedDirectChatMarkers(DIRECT_CHAT_PENDING_INBOUND_DIR, {
|
|
36269
36285
|
readdir: (dir) => readdirSync4(dir),
|
|
36270
|
-
readFile: (p2) =>
|
|
36286
|
+
readFile: (p2) => readFileSync10(p2, "utf8"),
|
|
36271
36287
|
unlink: (p2) => {
|
|
36272
|
-
if (existsSync6(p2))
|
|
36288
|
+
if (existsSync6(p2)) unlinkSync4(p2);
|
|
36273
36289
|
},
|
|
36274
36290
|
isAged: (receivedAt) => isMarkerGenuinelyAged(receivedAt, now, thresholdMs),
|
|
36275
36291
|
hasDelivery: (inboundId) => inboundDeliveryLedgerHas(DIRECT_CHAT_DELIVERY_LEDGER_DIR, inboundId),
|
|
@@ -36303,10 +36319,10 @@ function sanitizeRecoveryText(text) {
|
|
|
36303
36319
|
}
|
|
36304
36320
|
function directChatRecoveryDeps() {
|
|
36305
36321
|
return {
|
|
36306
|
-
readFile: (p2) =>
|
|
36322
|
+
readFile: (p2) => readFileSync10(p2, "utf-8"),
|
|
36307
36323
|
renameFile: (from, to) => renameSync5(from, to),
|
|
36308
36324
|
unlinkFile: (p2) => {
|
|
36309
|
-
if (existsSync6(p2))
|
|
36325
|
+
if (existsSync6(p2)) unlinkSync4(p2);
|
|
36310
36326
|
},
|
|
36311
36327
|
sanitize: sanitizeRecoveryText,
|
|
36312
36328
|
peekClaims: (sessionId) => claimTracker.peek(sessionId),
|
|
@@ -36316,8 +36332,8 @@ function directChatRecoveryDeps() {
|
|
|
36316
36332
|
if (!DIRECT_CHAT_RECOVERY_LEDGER_DIR) return;
|
|
36317
36333
|
if (markerName.includes("/") || markerName.includes("\\") || markerName.includes("..")) return;
|
|
36318
36334
|
try {
|
|
36319
|
-
const p2 =
|
|
36320
|
-
if (existsSync6(p2))
|
|
36335
|
+
const p2 = join11(DIRECT_CHAT_RECOVERY_LEDGER_DIR, markerName);
|
|
36336
|
+
if (existsSync6(p2)) unlinkSync4(p2);
|
|
36321
36337
|
} catch {
|
|
36322
36338
|
}
|
|
36323
36339
|
},
|
|
@@ -36352,7 +36368,7 @@ async function processDirectChatRecoveryOutboxFile(filename) {
|
|
|
36352
36368
|
if (!enabled) return;
|
|
36353
36369
|
directChatRecoveryInFlight.add(filename);
|
|
36354
36370
|
try {
|
|
36355
|
-
const fullPath =
|
|
36371
|
+
const fullPath = join11(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, filename);
|
|
36356
36372
|
await consumeDirectChatRecoveryFile(fullPath, filename, directChatRecoveryDeps());
|
|
36357
36373
|
} catch (err) {
|
|
36358
36374
|
process.stderr.write(
|
|
@@ -36380,7 +36396,7 @@ if (DIRECT_CHAT_RECOVERY_OUTBOX_DIR) {
|
|
|
36380
36396
|
if (!filename) return;
|
|
36381
36397
|
const name = filename.toString();
|
|
36382
36398
|
if (!name.endsWith(".json")) return;
|
|
36383
|
-
if (existsSync6(
|
|
36399
|
+
if (existsSync6(join11(DIRECT_CHAT_RECOVERY_OUTBOX_DIR, name))) {
|
|
36384
36400
|
void processDirectChatRecoveryOutboxFile(name);
|
|
36385
36401
|
}
|
|
36386
36402
|
});
|
|
@@ -37803,7 +37803,7 @@ function recordReplyTargetClassification(agentDir, channel, classification) {
|
|
|
37803
37803
|
import { readFileSync as readFileSync15, unlinkSync as unlinkSync5 } from "fs";
|
|
37804
37804
|
import { join as join15 } from "path";
|
|
37805
37805
|
var SCHEDULED_TURN_MARKER_FILENAME2 = ".current-scheduled-turn.json";
|
|
37806
|
-
var SCHEDULED_TURN_MAX_AGE_MS =
|
|
37806
|
+
var SCHEDULED_TURN_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
37807
37807
|
function validateScheduledTurnMarker(raw, now, maxAgeMs = SCHEDULED_TURN_MAX_AGE_MS) {
|
|
37808
37808
|
if (!raw || typeof raw !== "object") return null;
|
|
37809
37809
|
const m = raw;
|