@integrity-labs/agt-cli 0.28.299 → 0.28.301
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-KMJHNKPQ.js → chunk-E6L7SSE7.js} +218 -27
- package/dist/chunk-E6L7SSE7.js.map +1 -0
- package/dist/{chunk-V23GLSEX.js → chunk-HRER2SCW.js} +3 -3
- package/dist/{claude-pair-runtime-ZJZ3XYH4.js → claude-pair-runtime-BEUY5L6C.js} +2 -2
- package/dist/lib/manager-worker.js +148 -112
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/origami.js +252 -73
- package/dist/mcp/slack-channel.js +146 -72
- package/dist/{persistent-session-RSM62IW7.js → persistent-session-HWVIMZAY.js} +2 -2
- package/dist/{responsiveness-probe-DAKU7GSN.js → responsiveness-probe-WFO4SRHV.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-KMJHNKPQ.js.map +0 -1
- /package/dist/{chunk-V23GLSEX.js.map → chunk-HRER2SCW.js.map} +0 -0
- /package/dist/{claude-pair-runtime-ZJZ3XYH4.js.map → claude-pair-runtime-BEUY5L6C.js.map} +0 -0
- /package/dist/{persistent-session-RSM62IW7.js.map → persistent-session-HWVIMZAY.js.map} +0 -0
- /package/dist/{responsiveness-probe-DAKU7GSN.js.map → responsiveness-probe-WFO4SRHV.js.map} +0 -0
|
@@ -16342,16 +16342,16 @@ import {
|
|
|
16342
16342
|
ftruncateSync,
|
|
16343
16343
|
mkdirSync as mkdirSync8,
|
|
16344
16344
|
openSync,
|
|
16345
|
-
readFileSync as
|
|
16345
|
+
readFileSync as readFileSync15,
|
|
16346
16346
|
readdirSync as readdirSync4,
|
|
16347
16347
|
renameSync as renameSync4,
|
|
16348
16348
|
statSync as statSync2,
|
|
16349
|
-
unlinkSync as
|
|
16349
|
+
unlinkSync as unlinkSync6,
|
|
16350
16350
|
watch,
|
|
16351
16351
|
writeFileSync as writeFileSync12,
|
|
16352
16352
|
writeSync
|
|
16353
16353
|
} from "fs";
|
|
16354
|
-
import { basename, join as
|
|
16354
|
+
import { basename, join as join14, resolve as resolve2 } from "path";
|
|
16355
16355
|
import { homedir as homedir4 } from "os";
|
|
16356
16356
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "crypto";
|
|
16357
16357
|
|
|
@@ -17269,6 +17269,61 @@ function recordReplyTargetClassification(agentDir, channel, classification) {
|
|
|
17269
17269
|
}
|
|
17270
17270
|
}
|
|
17271
17271
|
|
|
17272
|
+
// src/scheduled-turn-marker.ts
|
|
17273
|
+
import { readFileSync as readFileSync13, unlinkSync as unlinkSync4 } from "fs";
|
|
17274
|
+
import { join as join12 } from "path";
|
|
17275
|
+
var SCHEDULED_TURN_MARKER_FILENAME = ".current-scheduled-turn.json";
|
|
17276
|
+
var SCHEDULED_TURN_MAX_AGE_MS = 30 * 60 * 1e3;
|
|
17277
|
+
function validateScheduledTurnMarker(raw, now, maxAgeMs = SCHEDULED_TURN_MAX_AGE_MS) {
|
|
17278
|
+
if (!raw || typeof raw !== "object") return null;
|
|
17279
|
+
const m = raw;
|
|
17280
|
+
if (typeof m.ts !== "number" || !Number.isFinite(m.ts)) return null;
|
|
17281
|
+
if (now - m.ts > maxAgeMs || now - m.ts < 0) return null;
|
|
17282
|
+
const out = { ts: m.ts };
|
|
17283
|
+
if (typeof m.task_id === "string" && m.task_id.length > 0) out.task_id = m.task_id;
|
|
17284
|
+
const t = m.target;
|
|
17285
|
+
if (t && typeof t === "object") {
|
|
17286
|
+
const tc = t;
|
|
17287
|
+
if (typeof tc.channel_id === "string" && tc.channel_id.length > 0) {
|
|
17288
|
+
out.target = {
|
|
17289
|
+
channel_id: tc.channel_id,
|
|
17290
|
+
...typeof tc.thread_ts === "string" && tc.thread_ts.length > 0 ? { thread_ts: tc.thread_ts } : {}
|
|
17291
|
+
};
|
|
17292
|
+
}
|
|
17293
|
+
}
|
|
17294
|
+
return out;
|
|
17295
|
+
}
|
|
17296
|
+
function resolveScheduledTurnDestination(marker, requested) {
|
|
17297
|
+
if (marker.target) {
|
|
17298
|
+
const channel = marker.target.channel_id;
|
|
17299
|
+
const thread_ts = marker.target.thread_ts;
|
|
17300
|
+
return {
|
|
17301
|
+
channel,
|
|
17302
|
+
thread_ts,
|
|
17303
|
+
retargeted: channel !== requested.channel || thread_ts !== requested.thread_ts
|
|
17304
|
+
};
|
|
17305
|
+
}
|
|
17306
|
+
return { channel: requested.channel, thread_ts: void 0, retargeted: Boolean(requested.thread_ts) };
|
|
17307
|
+
}
|
|
17308
|
+
function readScheduledTurnMarker(agentDir, now = Date.now()) {
|
|
17309
|
+
if (!agentDir) return null;
|
|
17310
|
+
try {
|
|
17311
|
+
const raw = JSON.parse(
|
|
17312
|
+
readFileSync13(join12(agentDir, SCHEDULED_TURN_MARKER_FILENAME), "utf8")
|
|
17313
|
+
);
|
|
17314
|
+
return validateScheduledTurnMarker(raw, now);
|
|
17315
|
+
} catch {
|
|
17316
|
+
return null;
|
|
17317
|
+
}
|
|
17318
|
+
}
|
|
17319
|
+
function clearScheduledTurnMarker(agentDir) {
|
|
17320
|
+
if (!agentDir) return;
|
|
17321
|
+
try {
|
|
17322
|
+
unlinkSync4(join12(agentDir, SCHEDULED_TURN_MARKER_FILENAME));
|
|
17323
|
+
} catch {
|
|
17324
|
+
}
|
|
17325
|
+
}
|
|
17326
|
+
|
|
17272
17327
|
// src/slack-allowlist-source.ts
|
|
17273
17328
|
function parseAllowedUsersCsv(raw) {
|
|
17274
17329
|
return new Set(
|
|
@@ -17322,6 +17377,14 @@ function channelMessageShouldRespond(text, mode) {
|
|
|
17322
17377
|
if (mode === "addressed_team" && matchesAddressedTeam(text)) return true;
|
|
17323
17378
|
return false;
|
|
17324
17379
|
}
|
|
17380
|
+
function parseNotifyDispatchMode(raw) {
|
|
17381
|
+
if (!raw) return "off";
|
|
17382
|
+
return raw.trim().toLowerCase() === "membership" ? "membership" : "off";
|
|
17383
|
+
}
|
|
17384
|
+
function channelMessageShouldWake(text, responseMode, notifyMode) {
|
|
17385
|
+
if (notifyMode === "membership") return true;
|
|
17386
|
+
return channelMessageShouldRespond(text, responseMode);
|
|
17387
|
+
}
|
|
17325
17388
|
|
|
17326
17389
|
// src/slack-list-channels.ts
|
|
17327
17390
|
function normaliseForMatch(s) {
|
|
@@ -17944,12 +18007,12 @@ async function actuateHostRestart(opts) {
|
|
|
17944
18007
|
import {
|
|
17945
18008
|
existsSync as existsSync7,
|
|
17946
18009
|
mkdirSync as mkdirSync7,
|
|
17947
|
-
readFileSync as
|
|
18010
|
+
readFileSync as readFileSync14,
|
|
17948
18011
|
renameSync as renameSync3,
|
|
17949
|
-
unlinkSync as
|
|
18012
|
+
unlinkSync as unlinkSync5,
|
|
17950
18013
|
writeFileSync as writeFileSync11
|
|
17951
18014
|
} from "fs";
|
|
17952
|
-
import { join as
|
|
18015
|
+
import { join as join13 } from "path";
|
|
17953
18016
|
function defaultIsPidAlive(pid) {
|
|
17954
18017
|
if (!Number.isFinite(pid) || pid <= 0) return false;
|
|
17955
18018
|
try {
|
|
@@ -17967,7 +18030,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
17967
18030
|
const isPidAlive = options.isPidAlive ?? defaultIsPidAlive;
|
|
17968
18031
|
const selfPid = options.selfPid ?? process.pid;
|
|
17969
18032
|
const now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
17970
|
-
const path =
|
|
18033
|
+
const path = join13(agentDir, basename2);
|
|
17971
18034
|
const existing = readLockHolder(path);
|
|
17972
18035
|
if (existing) {
|
|
17973
18036
|
if (existing.pid === selfPid) {
|
|
@@ -17991,14 +18054,14 @@ function releaseMcpSpawnLock(lockPath, opts = {}) {
|
|
|
17991
18054
|
if (!existing) return;
|
|
17992
18055
|
if (existing.pid !== selfPid) return;
|
|
17993
18056
|
try {
|
|
17994
|
-
|
|
18057
|
+
unlinkSync5(lockPath);
|
|
17995
18058
|
} catch {
|
|
17996
18059
|
}
|
|
17997
18060
|
}
|
|
17998
18061
|
function readLockHolder(path) {
|
|
17999
18062
|
if (!existsSync7(path)) return null;
|
|
18000
18063
|
try {
|
|
18001
|
-
const raw =
|
|
18064
|
+
const raw = readFileSync14(path, "utf8");
|
|
18002
18065
|
const parsed = JSON.parse(raw);
|
|
18003
18066
|
const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
|
|
18004
18067
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
@@ -18178,6 +18241,7 @@ var THREAD_AUTO_FOLLOW = process.env.SLACK_THREAD_AUTO_FOLLOW ?? "off";
|
|
|
18178
18241
|
var SLACK_SKIP_REACTION = (process.env.SLACK_SKIP_REACTION ?? "").trim();
|
|
18179
18242
|
var SLACK_ACK_REACTION = (process.env.SLACK_ACK_REACTION ?? "").trim() || "eyes";
|
|
18180
18243
|
var CHANNEL_RESPONSE_MODE = parseResponseMode(process.env.SLACK_CHANNEL_RESPONSE_MODE);
|
|
18244
|
+
var NOTIFY_DISPATCH_MODE = parseNotifyDispatchMode(process.env.AGT_NOTIFY_DISPATCH);
|
|
18181
18245
|
var SLACK_PEER_DISABLED_MODE = (() => {
|
|
18182
18246
|
const raw = (process.env.PEER_DISABLED ?? "").trim().toLowerCase();
|
|
18183
18247
|
if (raw === "" || raw === "off") return "off";
|
|
@@ -18232,8 +18296,8 @@ var SLACK_TEAM_PEER_USER_IDS = parseTeamPeerUserIdsEnv(
|
|
|
18232
18296
|
process.env.SLACK_TEAM_PEER_USER_IDS
|
|
18233
18297
|
);
|
|
18234
18298
|
var PEER_HINT_SEEN = /* @__PURE__ */ new Set();
|
|
18235
|
-
var SLACK_AGENT_DIR = AGENT_CODE_NAME ?
|
|
18236
|
-
var SLACK_MCP_CONFIG_PATH = SLACK_AGENT_DIR ?
|
|
18299
|
+
var SLACK_AGENT_DIR = AGENT_CODE_NAME ? join14(homedir4(), ".augmented", AGENT_CODE_NAME) : null;
|
|
18300
|
+
var SLACK_MCP_CONFIG_PATH = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "project", ".mcp.json") : null;
|
|
18237
18301
|
var liveAllowedUsersCache = null;
|
|
18238
18302
|
function readLiveAllowedUsers() {
|
|
18239
18303
|
if (!SLACK_MCP_CONFIG_PATH) return null;
|
|
@@ -18243,7 +18307,7 @@ function readLiveAllowedUsers() {
|
|
|
18243
18307
|
return liveAllowedUsersCache.value;
|
|
18244
18308
|
}
|
|
18245
18309
|
const value = extractAllowedUsersFromMcpJson(
|
|
18246
|
-
|
|
18310
|
+
readFileSync15(SLACK_MCP_CONFIG_PATH, "utf-8")
|
|
18247
18311
|
);
|
|
18248
18312
|
if (value === null) return null;
|
|
18249
18313
|
liveAllowedUsersCache = { mtimeMs, value };
|
|
@@ -18264,7 +18328,7 @@ function readLivePingAllowedUsers() {
|
|
|
18264
18328
|
return livePingAllowedUsersCache.value;
|
|
18265
18329
|
}
|
|
18266
18330
|
const value = extractPingAllowedUsersFromMcpJson(
|
|
18267
|
-
|
|
18331
|
+
readFileSync15(SLACK_MCP_CONFIG_PATH, "utf-8")
|
|
18268
18332
|
);
|
|
18269
18333
|
if (value === null) return null;
|
|
18270
18334
|
livePingAllowedUsersCache = { mtimeMs, value };
|
|
@@ -18276,14 +18340,14 @@ function readLivePingAllowedUsers() {
|
|
|
18276
18340
|
function getEffectivePingAllowedUsers() {
|
|
18277
18341
|
return readLivePingAllowedUsers() ?? PING_ALLOWED_USERS;
|
|
18278
18342
|
}
|
|
18279
|
-
var SLACK_PENDING_INBOUND_DIR = SLACK_AGENT_DIR ?
|
|
18280
|
-
var SLACK_RECOVERY_OUTBOX_DIR = SLACK_AGENT_DIR ?
|
|
18343
|
+
var SLACK_PENDING_INBOUND_DIR = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "slack-pending-inbound") : null;
|
|
18344
|
+
var SLACK_RECOVERY_OUTBOX_DIR = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "slack-recovery-outbox") : null;
|
|
18281
18345
|
var slackInboundRegistry = createInboundRegistry();
|
|
18282
|
-
var SLACK_RESTART_CONFIRM_FILE = SLACK_AGENT_DIR ?
|
|
18283
|
-
var SLACK_RECENT_DMS_FILE = SLACK_AGENT_DIR ?
|
|
18284
|
-
var SLACK_CHANNEL_ADD_RESTART_FILE = SLACK_AGENT_DIR ?
|
|
18346
|
+
var SLACK_RESTART_CONFIRM_FILE = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "slack-restart-confirm.json") : null;
|
|
18347
|
+
var SLACK_RECENT_DMS_FILE = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "slack-recent-dms.json") : null;
|
|
18348
|
+
var SLACK_CHANNEL_ADD_RESTART_FILE = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "slack-channel-add-restart.json") : null;
|
|
18285
18349
|
var SLACK_MAX_RECOVERY_ATTEMPTS = 3;
|
|
18286
|
-
var SLACK_AVATAR_MARKER_PATH = SLACK_AGENT_DIR ?
|
|
18350
|
+
var SLACK_AVATAR_MARKER_PATH = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "slack-avatar-applied") : null;
|
|
18287
18351
|
function redactSlackId(id) {
|
|
18288
18352
|
if (!id) return "<none>";
|
|
18289
18353
|
return createHash2("sha256").update(id).digest("hex").slice(0, 8);
|
|
@@ -18294,7 +18358,7 @@ function safeSlackMarkerName(channel, threadTs, messageTs) {
|
|
|
18294
18358
|
}
|
|
18295
18359
|
function slackPendingInboundPath(channel, threadTs, messageTs) {
|
|
18296
18360
|
if (!SLACK_PENDING_INBOUND_DIR) return null;
|
|
18297
|
-
return
|
|
18361
|
+
return join14(SLACK_PENDING_INBOUND_DIR, safeSlackMarkerName(channel, threadTs, messageTs));
|
|
18298
18362
|
}
|
|
18299
18363
|
function writeSlackPendingInboundMarker(channel, threadTs, messageTs, undeliverable = false, discretionary = false, payload) {
|
|
18300
18364
|
const path = slackPendingInboundPath(channel, threadTs, messageTs);
|
|
@@ -18345,7 +18409,7 @@ function rewriteSlackMarkerInPlace(path, marker) {
|
|
|
18345
18409
|
function markSlackMarkerSeenInPlace(fullPath) {
|
|
18346
18410
|
let marker;
|
|
18347
18411
|
try {
|
|
18348
|
-
marker = JSON.parse(
|
|
18412
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
18349
18413
|
} catch {
|
|
18350
18414
|
return;
|
|
18351
18415
|
}
|
|
@@ -18359,7 +18423,7 @@ function attachSlackReplayPayload(channel, threadTs, messageTs, payload) {
|
|
|
18359
18423
|
if (!path) return;
|
|
18360
18424
|
let marker;
|
|
18361
18425
|
try {
|
|
18362
|
-
marker = JSON.parse(
|
|
18426
|
+
marker = JSON.parse(readFileSync15(path, "utf-8"));
|
|
18363
18427
|
} catch {
|
|
18364
18428
|
return;
|
|
18365
18429
|
}
|
|
@@ -18370,7 +18434,7 @@ function readSlackPendingInboundMarker(channel, threadTs, messageTs) {
|
|
|
18370
18434
|
const path = slackPendingInboundPath(channel, threadTs, messageTs);
|
|
18371
18435
|
if (!path || !existsSync8(path)) return null;
|
|
18372
18436
|
try {
|
|
18373
|
-
return JSON.parse(
|
|
18437
|
+
return JSON.parse(readFileSync15(path, "utf-8"));
|
|
18374
18438
|
} catch {
|
|
18375
18439
|
return null;
|
|
18376
18440
|
}
|
|
@@ -18465,7 +18529,7 @@ function scheduleBusyAck(channel, threadTs, messageTs, isThreadReply, arrivedWhi
|
|
|
18465
18529
|
let paneLogFreshAgeMs = null;
|
|
18466
18530
|
if (SLACK_AGENT_DIR) {
|
|
18467
18531
|
try {
|
|
18468
|
-
const paneMtimeMs = statSync2(
|
|
18532
|
+
const paneMtimeMs = statSync2(join14(SLACK_AGENT_DIR, "pane.log")).mtimeMs;
|
|
18469
18533
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
18470
18534
|
} catch {
|
|
18471
18535
|
}
|
|
@@ -18498,7 +18562,7 @@ function __resetSlackBusyAckNoticeThrottle() {
|
|
|
18498
18562
|
function clearSlackMarkerFileWithHeal(fullPath) {
|
|
18499
18563
|
let marker = null;
|
|
18500
18564
|
try {
|
|
18501
|
-
marker = JSON.parse(
|
|
18565
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
18502
18566
|
} catch {
|
|
18503
18567
|
}
|
|
18504
18568
|
if (marker && decideRecoveryHeal({
|
|
@@ -18508,14 +18572,14 @@ function clearSlackMarkerFileWithHeal(fullPath) {
|
|
|
18508
18572
|
healSlackUndeliverable(marker.channel, marker.message_ts);
|
|
18509
18573
|
}
|
|
18510
18574
|
try {
|
|
18511
|
-
if (existsSync8(fullPath))
|
|
18575
|
+
if (existsSync8(fullPath)) unlinkSync6(fullPath);
|
|
18512
18576
|
} catch {
|
|
18513
18577
|
}
|
|
18514
18578
|
}
|
|
18515
18579
|
function markSlackMarkerSeenWithHeal(fullPath) {
|
|
18516
18580
|
let marker = null;
|
|
18517
18581
|
try {
|
|
18518
|
-
marker = JSON.parse(
|
|
18582
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
18519
18583
|
} catch {
|
|
18520
18584
|
return;
|
|
18521
18585
|
}
|
|
@@ -18583,10 +18647,10 @@ function slackNextRetryName(filename) {
|
|
|
18583
18647
|
async function processSlackRecoveryOutboxFile(filename) {
|
|
18584
18648
|
if (!SLACK_RECOVERY_OUTBOX_DIR) return;
|
|
18585
18649
|
if (filename.endsWith(".poison.json") || filename.endsWith(".tmp")) return;
|
|
18586
|
-
const fullPath =
|
|
18650
|
+
const fullPath = join14(SLACK_RECOVERY_OUTBOX_DIR, filename);
|
|
18587
18651
|
let payload;
|
|
18588
18652
|
try {
|
|
18589
|
-
payload = JSON.parse(
|
|
18653
|
+
payload = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
18590
18654
|
} catch (err) {
|
|
18591
18655
|
process.stderr.write(
|
|
18592
18656
|
`slack-channel(${AGENT_CODE_NAME}): recovery outbox parse failed (${filename}): ${err.message}
|
|
@@ -18631,7 +18695,7 @@ async function processSlackRecoveryOutboxFile(filename) {
|
|
|
18631
18695
|
if (decision.action === "suppress") {
|
|
18632
18696
|
if (payload.thread_ts) clearPendingMessage(payload.channel, payload.thread_ts);
|
|
18633
18697
|
try {
|
|
18634
|
-
|
|
18698
|
+
unlinkSync6(fullPath);
|
|
18635
18699
|
} catch {
|
|
18636
18700
|
}
|
|
18637
18701
|
return;
|
|
@@ -18679,7 +18743,7 @@ async function processSlackRecoveryOutboxFile(filename) {
|
|
|
18679
18743
|
}
|
|
18680
18744
|
if (sendSucceeded) {
|
|
18681
18745
|
try {
|
|
18682
|
-
|
|
18746
|
+
unlinkSync6(fullPath);
|
|
18683
18747
|
} catch {
|
|
18684
18748
|
}
|
|
18685
18749
|
return;
|
|
@@ -18687,7 +18751,7 @@ async function processSlackRecoveryOutboxFile(filename) {
|
|
|
18687
18751
|
const next = slackNextRetryName(filename);
|
|
18688
18752
|
if (next) {
|
|
18689
18753
|
try {
|
|
18690
|
-
renameSync4(fullPath,
|
|
18754
|
+
renameSync4(fullPath, join14(SLACK_RECOVERY_OUTBOX_DIR, next.next));
|
|
18691
18755
|
if (next.attempt >= SLACK_MAX_RECOVERY_ATTEMPTS) {
|
|
18692
18756
|
process.stderr.write(
|
|
18693
18757
|
`slack-channel(${AGENT_CODE_NAME}): ghost-reply recovery exhausted retries \u2014 moved to ${next.next}
|
|
@@ -18726,7 +18790,7 @@ function scanSlackRecoveryRetries() {
|
|
|
18726
18790
|
if (!f.includes(".retry-") || f.endsWith(".poison.json")) continue;
|
|
18727
18791
|
let mtimeMs;
|
|
18728
18792
|
try {
|
|
18729
|
-
mtimeMs = statSync2(
|
|
18793
|
+
mtimeMs = statSync2(join14(SLACK_RECOVERY_OUTBOX_DIR, f)).mtimeMs;
|
|
18730
18794
|
} catch {
|
|
18731
18795
|
continue;
|
|
18732
18796
|
}
|
|
@@ -18756,7 +18820,7 @@ function startSlackRecoveryOutboxWatcher() {
|
|
|
18756
18820
|
const watcher = watch(SLACK_RECOVERY_OUTBOX_DIR, (event, filename) => {
|
|
18757
18821
|
if (event !== "rename" || !filename) return;
|
|
18758
18822
|
if (!isFirstAttemptSlackOutboxFile(filename)) return;
|
|
18759
|
-
if (existsSync8(
|
|
18823
|
+
if (existsSync8(join14(SLACK_RECOVERY_OUTBOX_DIR, filename))) {
|
|
18760
18824
|
void processSlackRecoveryOutboxFile(filename);
|
|
18761
18825
|
}
|
|
18762
18826
|
});
|
|
@@ -18771,7 +18835,7 @@ function startSlackRecoveryOutboxWatcher() {
|
|
|
18771
18835
|
retryTimer.unref?.();
|
|
18772
18836
|
}
|
|
18773
18837
|
startSlackRecoveryOutboxWatcher();
|
|
18774
|
-
var SLACK_NOTICE_OUTBOX_DIR = SLACK_AGENT_DIR ?
|
|
18838
|
+
var SLACK_NOTICE_OUTBOX_DIR = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "slack-notice-outbox") : null;
|
|
18775
18839
|
var SLACK_NOTICE_MAX_AGE_MS = 9e4;
|
|
18776
18840
|
var SLACK_NOTICE_INFLIGHT = /* @__PURE__ */ new Set();
|
|
18777
18841
|
async function processSlackNoticeOutboxFile(filename) {
|
|
@@ -18779,7 +18843,7 @@ async function processSlackNoticeOutboxFile(filename) {
|
|
|
18779
18843
|
if (filename.startsWith(".") || filename.endsWith(".tmp") || !filename.endsWith(".json")) return;
|
|
18780
18844
|
if (SLACK_NOTICE_INFLIGHT.has(filename)) return;
|
|
18781
18845
|
SLACK_NOTICE_INFLIGHT.add(filename);
|
|
18782
|
-
const fullPath =
|
|
18846
|
+
const fullPath = join14(SLACK_NOTICE_OUTBOX_DIR, filename);
|
|
18783
18847
|
try {
|
|
18784
18848
|
let mtimeMs;
|
|
18785
18849
|
try {
|
|
@@ -18789,26 +18853,26 @@ async function processSlackNoticeOutboxFile(filename) {
|
|
|
18789
18853
|
}
|
|
18790
18854
|
if (Date.now() - mtimeMs > SLACK_NOTICE_MAX_AGE_MS) {
|
|
18791
18855
|
try {
|
|
18792
|
-
|
|
18856
|
+
unlinkSync6(fullPath);
|
|
18793
18857
|
} catch {
|
|
18794
18858
|
}
|
|
18795
18859
|
return;
|
|
18796
18860
|
}
|
|
18797
18861
|
let payload;
|
|
18798
18862
|
try {
|
|
18799
|
-
const parsed = JSON.parse(
|
|
18863
|
+
const parsed = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
18800
18864
|
if (!parsed || typeof parsed !== "object") throw new Error("not an object");
|
|
18801
18865
|
payload = parsed;
|
|
18802
18866
|
} catch {
|
|
18803
18867
|
try {
|
|
18804
|
-
|
|
18868
|
+
unlinkSync6(fullPath);
|
|
18805
18869
|
} catch {
|
|
18806
18870
|
}
|
|
18807
18871
|
return;
|
|
18808
18872
|
}
|
|
18809
18873
|
if (!payload.channel || !payload.text) {
|
|
18810
18874
|
try {
|
|
18811
|
-
|
|
18875
|
+
unlinkSync6(fullPath);
|
|
18812
18876
|
} catch {
|
|
18813
18877
|
}
|
|
18814
18878
|
return;
|
|
@@ -18819,7 +18883,7 @@ async function processSlackNoticeOutboxFile(filename) {
|
|
|
18819
18883
|
defaultValue: false
|
|
18820
18884
|
})) {
|
|
18821
18885
|
try {
|
|
18822
|
-
|
|
18886
|
+
unlinkSync6(fullPath);
|
|
18823
18887
|
} catch {
|
|
18824
18888
|
}
|
|
18825
18889
|
return;
|
|
@@ -18860,7 +18924,7 @@ async function processSlackNoticeOutboxFile(filename) {
|
|
|
18860
18924
|
clearTimeout(timeoutId);
|
|
18861
18925
|
}
|
|
18862
18926
|
try {
|
|
18863
|
-
|
|
18927
|
+
unlinkSync6(fullPath);
|
|
18864
18928
|
} catch {
|
|
18865
18929
|
}
|
|
18866
18930
|
} finally {
|
|
@@ -18885,7 +18949,7 @@ function startSlackNoticeOutboxWatcher() {
|
|
|
18885
18949
|
try {
|
|
18886
18950
|
const watcher = watch(SLACK_NOTICE_OUTBOX_DIR, (event, filename) => {
|
|
18887
18951
|
if (event !== "rename" || !filename) return;
|
|
18888
|
-
if (existsSync8(
|
|
18952
|
+
if (existsSync8(join14(SLACK_NOTICE_OUTBOX_DIR, filename))) {
|
|
18889
18953
|
void processSlackNoticeOutboxFile(filename);
|
|
18890
18954
|
}
|
|
18891
18955
|
});
|
|
@@ -18921,17 +18985,17 @@ function sweepSlackStaleMarkers(thresholdMs) {
|
|
|
18921
18985
|
for (const filename of filenames) {
|
|
18922
18986
|
if (!filename.endsWith(".json")) continue;
|
|
18923
18987
|
if (filename.endsWith(".tmp")) continue;
|
|
18924
|
-
const fullPath =
|
|
18988
|
+
const fullPath = join14(SLACK_PENDING_INBOUND_DIR, filename);
|
|
18925
18989
|
let marker;
|
|
18926
18990
|
try {
|
|
18927
|
-
marker = JSON.parse(
|
|
18991
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
18928
18992
|
} catch (err) {
|
|
18929
18993
|
process.stderr.write(
|
|
18930
18994
|
`slack-channel(${AGENT_CODE_NAME}): stale-marker parse failed for ${redactSlackId(filename)}: ${err.message}
|
|
18931
18995
|
`
|
|
18932
18996
|
);
|
|
18933
18997
|
try {
|
|
18934
|
-
|
|
18998
|
+
unlinkSync6(fullPath);
|
|
18935
18999
|
} catch {
|
|
18936
19000
|
}
|
|
18937
19001
|
cleared++;
|
|
@@ -18946,7 +19010,7 @@ function sweepSlackStaleMarkers(thresholdMs) {
|
|
|
18946
19010
|
recordChannelDeflection(SLACK_AGENT_DIR, "slack", "replay_orphaned");
|
|
18947
19011
|
}
|
|
18948
19012
|
try {
|
|
18949
|
-
|
|
19013
|
+
unlinkSync6(fullPath);
|
|
18950
19014
|
} catch {
|
|
18951
19015
|
}
|
|
18952
19016
|
cleared++;
|
|
@@ -18970,13 +19034,13 @@ var slackOrphanSweepTimer = setInterval(() => {
|
|
|
18970
19034
|
checkSlackWatchdogGiveUpNotice();
|
|
18971
19035
|
}, orphanSweepIntervalMs());
|
|
18972
19036
|
slackOrphanSweepTimer.unref?.();
|
|
18973
|
-
var SLACK_PROGRESS_HEARTBEAT_PATH = SLACK_AGENT_DIR ?
|
|
19037
|
+
var SLACK_PROGRESS_HEARTBEAT_PATH = SLACK_AGENT_DIR ? join14(SLACK_AGENT_DIR, "channel-progress-heartbeat.json") : null;
|
|
18974
19038
|
var slackTrackedProgress = null;
|
|
18975
19039
|
var slackProgressTickRunning = false;
|
|
18976
19040
|
function readSlackProgressHeartbeat() {
|
|
18977
19041
|
if (!SLACK_PROGRESS_HEARTBEAT_PATH || !existsSync8(SLACK_PROGRESS_HEARTBEAT_PATH)) return null;
|
|
18978
19042
|
try {
|
|
18979
|
-
return parseProgressHeartbeat(
|
|
19043
|
+
return parseProgressHeartbeat(readFileSync15(SLACK_PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
18980
19044
|
} catch {
|
|
18981
19045
|
return null;
|
|
18982
19046
|
}
|
|
@@ -18989,7 +19053,7 @@ function seedSlackProgressHeartbeat() {
|
|
|
18989
19053
|
renameSync4(tmp, SLACK_PROGRESS_HEARTBEAT_PATH);
|
|
18990
19054
|
} catch {
|
|
18991
19055
|
try {
|
|
18992
|
-
|
|
19056
|
+
unlinkSync6(tmp);
|
|
18993
19057
|
} catch {
|
|
18994
19058
|
}
|
|
18995
19059
|
}
|
|
@@ -19003,7 +19067,7 @@ function findSlackProgressTarget() {
|
|
|
19003
19067
|
if (!name.endsWith(".json")) continue;
|
|
19004
19068
|
let m;
|
|
19005
19069
|
try {
|
|
19006
|
-
m = JSON.parse(
|
|
19070
|
+
m = JSON.parse(readFileSync15(join14(SLACK_PENDING_INBOUND_DIR, name), "utf-8"));
|
|
19007
19071
|
} catch {
|
|
19008
19072
|
continue;
|
|
19009
19073
|
}
|
|
@@ -19154,7 +19218,7 @@ function listPendingSlackConversations() {
|
|
|
19154
19218
|
if (!name.endsWith(".json")) continue;
|
|
19155
19219
|
try {
|
|
19156
19220
|
const marker = JSON.parse(
|
|
19157
|
-
|
|
19221
|
+
readFileSync15(join14(SLACK_PENDING_INBOUND_DIR, name), "utf8")
|
|
19158
19222
|
);
|
|
19159
19223
|
if (typeof marker.channel !== "string" || !marker.channel) continue;
|
|
19160
19224
|
if (typeof marker.thread_ts !== "string" || !marker.thread_ts) continue;
|
|
@@ -19206,7 +19270,7 @@ function postSlackWatchdogGiveUpNotice(channel, threadTs, isThreadReply, reason)
|
|
|
19206
19270
|
}
|
|
19207
19271
|
function checkSlackWatchdogGiveUpNotice() {
|
|
19208
19272
|
if (!SLACK_AGENT_DIR) return;
|
|
19209
|
-
const signal = readGiveUpSignal(
|
|
19273
|
+
const signal = readGiveUpSignal(join14(SLACK_AGENT_DIR, GIVE_UP_SIGNAL_FILENAME));
|
|
19210
19274
|
const signalAtMs = signal?.atMs ?? null;
|
|
19211
19275
|
const act = decideGiveUpNotice({
|
|
19212
19276
|
signalAtMs,
|
|
@@ -19253,10 +19317,10 @@ async function notifyStrandedInboundsOnFirstConnect() {
|
|
|
19253
19317
|
let notified = 0;
|
|
19254
19318
|
for (const filename of filenames) {
|
|
19255
19319
|
if (!filename.endsWith(".json")) continue;
|
|
19256
|
-
const fullPath =
|
|
19320
|
+
const fullPath = join14(SLACK_PENDING_INBOUND_DIR, filename);
|
|
19257
19321
|
let marker;
|
|
19258
19322
|
try {
|
|
19259
|
-
marker = JSON.parse(
|
|
19323
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
19260
19324
|
} catch {
|
|
19261
19325
|
continue;
|
|
19262
19326
|
}
|
|
@@ -19269,7 +19333,7 @@ async function notifyStrandedInboundsOnFirstConnect() {
|
|
|
19269
19333
|
const key2 = `${channel}__${thread_ts}`;
|
|
19270
19334
|
if (seen.has(key2)) {
|
|
19271
19335
|
try {
|
|
19272
|
-
|
|
19336
|
+
unlinkSync6(fullPath);
|
|
19273
19337
|
} catch {
|
|
19274
19338
|
}
|
|
19275
19339
|
continue;
|
|
@@ -19283,7 +19347,7 @@ async function notifyStrandedInboundsOnFirstConnect() {
|
|
|
19283
19347
|
if (res.ok) {
|
|
19284
19348
|
notified += 1;
|
|
19285
19349
|
try {
|
|
19286
|
-
|
|
19350
|
+
unlinkSync6(fullPath);
|
|
19287
19351
|
} catch {
|
|
19288
19352
|
}
|
|
19289
19353
|
} else {
|
|
@@ -19427,7 +19491,7 @@ function noteThreadActivityByMessageTs(channel, messageTs) {
|
|
|
19427
19491
|
markSeenAllSlackPendingMarkersForThread2(channel, messageTs);
|
|
19428
19492
|
markSeenSlackPendingMarkerByMessageTs2(channel, messageTs);
|
|
19429
19493
|
}
|
|
19430
|
-
var RESTART_FLAGS_DIR =
|
|
19494
|
+
var RESTART_FLAGS_DIR = join14(homedir4(), ".augmented", "restart-flags");
|
|
19431
19495
|
function actuateHostRestartSlack() {
|
|
19432
19496
|
return actuateHostRestart({
|
|
19433
19497
|
agtHost: AGT_HOST,
|
|
@@ -19973,7 +20037,7 @@ async function handleSlashCommandEnvelope(payload) {
|
|
|
19973
20037
|
if (!existsSync8(RESTART_FLAGS_DIR)) {
|
|
19974
20038
|
mkdirSync8(RESTART_FLAGS_DIR, { recursive: true });
|
|
19975
20039
|
}
|
|
19976
|
-
const flagPath =
|
|
20040
|
+
const flagPath = join14(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
19977
20041
|
const flag = {
|
|
19978
20042
|
codeName,
|
|
19979
20043
|
source: "slack",
|
|
@@ -20116,7 +20180,7 @@ async function handleRestartCommand(opts) {
|
|
|
20116
20180
|
if (!existsSync8(RESTART_FLAGS_DIR)) {
|
|
20117
20181
|
mkdirSync8(RESTART_FLAGS_DIR, { recursive: true });
|
|
20118
20182
|
}
|
|
20119
|
-
const flagPath =
|
|
20183
|
+
const flagPath = join14(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
20120
20184
|
const flag = {
|
|
20121
20185
|
codeName,
|
|
20122
20186
|
source: "slack",
|
|
@@ -20229,7 +20293,7 @@ var THREAD_STORE_TTL_DAYS = parseTtlDays(process.env.SLACK_THREAD_FOLLOW_TTL_DAY
|
|
|
20229
20293
|
var threadPersister = null;
|
|
20230
20294
|
function resolveThreadStorePath() {
|
|
20231
20295
|
if (!AGENT_CODE_NAME) return null;
|
|
20232
|
-
return
|
|
20296
|
+
return join14(homedir4(), ".augmented", AGENT_CODE_NAME, "slack-tracked-threads.json");
|
|
20233
20297
|
}
|
|
20234
20298
|
function parseTtlDays(raw) {
|
|
20235
20299
|
if (!raw) return void 0;
|
|
@@ -20268,9 +20332,9 @@ if (!BOT_TOKEN || !APP_TOKEN) {
|
|
|
20268
20332
|
var slackStderrLogStream = null;
|
|
20269
20333
|
if (AGENT_CODE_NAME) {
|
|
20270
20334
|
try {
|
|
20271
|
-
const logDir =
|
|
20335
|
+
const logDir = join14(homedir4(), ".augmented", AGENT_CODE_NAME);
|
|
20272
20336
|
mkdirSync8(logDir, { recursive: true });
|
|
20273
|
-
slackStderrLogStream = createWriteStream(
|
|
20337
|
+
slackStderrLogStream = createWriteStream(join14(logDir, "slack-channel-stderr.log"), {
|
|
20274
20338
|
flags: "a",
|
|
20275
20339
|
mode: 384
|
|
20276
20340
|
});
|
|
@@ -20681,9 +20745,17 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
20681
20745
|
`
|
|
20682
20746
|
);
|
|
20683
20747
|
}
|
|
20684
|
-
const
|
|
20748
|
+
const scheduledMarker = readScheduledTurnMarker(SLACK_AGENT_DIR);
|
|
20749
|
+
const scheduledDest = scheduledMarker ? resolveScheduledTurnDestination(scheduledMarker, { channel, thread_ts }) : null;
|
|
20750
|
+
if (scheduledDest?.retargeted) {
|
|
20751
|
+
process.stderr.write(
|
|
20752
|
+
`slack-channel(${AGENT_CODE_NAME}): scheduled_turn_retargeted task=${scheduledMarker?.task_id ?? "?"} requested=${redactSlackId(channel)}/${redactSlackId(thread_ts)} routed=${redactSlackId(scheduledDest.channel)}/${redactSlackId(scheduledDest.thread_ts)}
|
|
20753
|
+
`
|
|
20754
|
+
);
|
|
20755
|
+
}
|
|
20756
|
+
const effectiveChannel = scheduledDest ? scheduledDest.channel : channelGuard.corrected && channelGuard.channel ? channelGuard.channel : channel;
|
|
20685
20757
|
const effectiveMessageTs = channelGuard.corrected ? channelGuard.messageTs : message_ts;
|
|
20686
|
-
if (bindingMode === "enforce" && binding.reject && !channelGuard.corrected) {
|
|
20758
|
+
if (bindingMode === "enforce" && binding.reject && !channelGuard.corrected && !scheduledDest) {
|
|
20687
20759
|
process.stderr.write(
|
|
20688
20760
|
`slack-channel(${AGENT_CODE_NAME}): reply_binding_rejected class=${binding.classification} channel=${redactSlackId(channel)}
|
|
20689
20761
|
`
|
|
@@ -20707,7 +20779,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
20707
20779
|
};
|
|
20708
20780
|
}
|
|
20709
20781
|
const bindingFeedback = bindingMode === "warn" ? binding.agentFeedback : void 0;
|
|
20710
|
-
const effectiveThreadTs = enforceBound ? binding.threadTs : channelGuard.corrected ? channelGuard.threadTs : resolveReplyThreadTs({
|
|
20782
|
+
const effectiveThreadTs = scheduledDest ? scheduledDest.thread_ts : enforceBound ? binding.threadTs : channelGuard.corrected ? channelGuard.threadTs : resolveReplyThreadTs({
|
|
20711
20783
|
channel,
|
|
20712
20784
|
threadTs: thread_ts,
|
|
20713
20785
|
messageTs: message_ts
|
|
@@ -20994,7 +21066,7 @@ ${result.formatted}` : "Thread is empty or not found."
|
|
|
20994
21066
|
};
|
|
20995
21067
|
}
|
|
20996
21068
|
size = stat2.size;
|
|
20997
|
-
bytes =
|
|
21069
|
+
bytes = readFileSync15(resolvedPath);
|
|
20998
21070
|
} catch (err) {
|
|
20999
21071
|
return {
|
|
21000
21072
|
content: [{ type: "text", text: `Failed to read file: ${err.message}` }],
|
|
@@ -21775,17 +21847,17 @@ async function replayPendingSlackMarkers() {
|
|
|
21775
21847
|
let paneFreshAgeMs = null;
|
|
21776
21848
|
if (SLACK_AGENT_DIR) {
|
|
21777
21849
|
try {
|
|
21778
|
-
paneFreshAgeMs = Math.max(0, now - statSync2(
|
|
21850
|
+
paneFreshAgeMs = Math.max(0, now - statSync2(join14(SLACK_AGENT_DIR, "pane.log")).mtimeMs);
|
|
21779
21851
|
} catch {
|
|
21780
21852
|
}
|
|
21781
21853
|
}
|
|
21782
21854
|
const entries = [];
|
|
21783
21855
|
for (const name of filenames) {
|
|
21784
21856
|
if (!name.endsWith(".json") || name.endsWith(".tmp")) continue;
|
|
21785
|
-
const fullPath =
|
|
21857
|
+
const fullPath = join14(SLACK_PENDING_INBOUND_DIR, name);
|
|
21786
21858
|
let marker;
|
|
21787
21859
|
try {
|
|
21788
|
-
marker = JSON.parse(
|
|
21860
|
+
marker = JSON.parse(readFileSync15(fullPath, "utf-8"));
|
|
21789
21861
|
} catch {
|
|
21790
21862
|
continue;
|
|
21791
21863
|
}
|
|
@@ -22256,7 +22328,8 @@ async function connectSocketMode() {
|
|
|
22256
22328
|
return;
|
|
22257
22329
|
}
|
|
22258
22330
|
} else {
|
|
22259
|
-
if (!
|
|
22331
|
+
if (!channelMessageShouldWake(evt.text ?? "", CHANNEL_RESPONSE_MODE, NOTIFY_DISPATCH_MODE))
|
|
22332
|
+
return;
|
|
22260
22333
|
}
|
|
22261
22334
|
}
|
|
22262
22335
|
const text = evt.text ?? "";
|
|
@@ -22282,7 +22355,7 @@ async function connectSocketMode() {
|
|
|
22282
22355
|
let paneLogFreshAgeMs = null;
|
|
22283
22356
|
if (SLACK_AGENT_DIR) {
|
|
22284
22357
|
try {
|
|
22285
|
-
const paneMtimeMs = statSync2(
|
|
22358
|
+
const paneMtimeMs = statSync2(join14(SLACK_AGENT_DIR, "pane.log")).mtimeMs;
|
|
22286
22359
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
22287
22360
|
} catch {
|
|
22288
22361
|
}
|
|
@@ -22440,6 +22513,7 @@ ${forwarded.text}` : forwarded.text;
|
|
|
22440
22513
|
sender_name: userName,
|
|
22441
22514
|
channel_ref: threadTs
|
|
22442
22515
|
});
|
|
22516
|
+
clearScheduledTurnMarker(SLACK_AGENT_DIR);
|
|
22443
22517
|
}
|
|
22444
22518
|
await mcp.notification({
|
|
22445
22519
|
method: "notifications/claude/channel",
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
writeDirectChatSessionState,
|
|
37
37
|
writeEgressAllowlist,
|
|
38
38
|
writePersistentClaudeWrapper
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-E6L7SSE7.js";
|
|
40
40
|
import "./chunk-XWVM4KPK.js";
|
|
41
41
|
export {
|
|
42
42
|
EGRESS_BASELINE_DOMAINS,
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
writeEgressAllowlist,
|
|
78
78
|
writePersistentClaudeWrapper
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=persistent-session-
|
|
80
|
+
//# sourceMappingURL=persistent-session-HWVIMZAY.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
paneLogPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-E6L7SSE7.js";
|
|
4
4
|
import "./chunk-XWVM4KPK.js";
|
|
5
5
|
|
|
6
6
|
// src/lib/responsiveness-probe.ts
|
|
@@ -418,4 +418,4 @@ export {
|
|
|
418
418
|
readAndResetSlackReplyBindingClassifications,
|
|
419
419
|
readAndResetSlackReplyTargetClassifications
|
|
420
420
|
};
|
|
421
|
-
//# sourceMappingURL=responsiveness-probe-
|
|
421
|
+
//# sourceMappingURL=responsiveness-probe-WFO4SRHV.js.map
|