@integrity-labs/agt-cli 0.28.431 → 0.28.433
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-EREBH2LV.js → chunk-NUKNLJNJ.js} +212 -274
- package/dist/chunk-NUKNLJNJ.js.map +1 -0
- package/dist/{chunk-SV67CNIX.js → chunk-RUVNJO63.js} +3 -3
- package/dist/{claude-pair-runtime-44RPFRIE.js → claude-pair-runtime-YAHBPFYL.js} +2 -2
- package/dist/lib/manager-worker.js +238 -197
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +101 -26
- package/dist/mcp/slack-channel.js +236 -128
- package/dist/mcp/telegram-channel.js +187 -91
- package/dist/{persistent-session-A4VUV3UI.js → persistent-session-ISBR3BBX.js} +2 -2
- package/dist/{responsiveness-probe-QRVMR22C.js → responsiveness-probe-OT6JVP43.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-EREBH2LV.js.map +0 -1
- /package/dist/{chunk-SV67CNIX.js.map → chunk-RUVNJO63.js.map} +0 -0
- /package/dist/{claude-pair-runtime-44RPFRIE.js.map → claude-pair-runtime-YAHBPFYL.js.map} +0 -0
- /package/dist/{persistent-session-A4VUV3UI.js.map → persistent-session-ISBR3BBX.js.map} +0 -0
- /package/dist/{responsiveness-probe-QRVMR22C.js.map → responsiveness-probe-OT6JVP43.js.map} +0 -0
|
@@ -18870,7 +18870,7 @@ var require_filters = __commonJS({
|
|
|
18870
18870
|
return r.copySafeness(str, res);
|
|
18871
18871
|
}
|
|
18872
18872
|
_exports.indent = indent;
|
|
18873
|
-
function
|
|
18873
|
+
function join19(arr, del, attr) {
|
|
18874
18874
|
del = del || "";
|
|
18875
18875
|
if (attr) {
|
|
18876
18876
|
arr = lib.map(arr, function(v) {
|
|
@@ -18879,7 +18879,7 @@ var require_filters = __commonJS({
|
|
|
18879
18879
|
}
|
|
18880
18880
|
return arr.join(del);
|
|
18881
18881
|
}
|
|
18882
|
-
_exports.join =
|
|
18882
|
+
_exports.join = join19;
|
|
18883
18883
|
function last(arr) {
|
|
18884
18884
|
return arr[arr.length - 1];
|
|
18885
18885
|
}
|
|
@@ -33731,6 +33731,28 @@ function buildUsageLimitReplyText(limitedUntil) {
|
|
|
33731
33731
|
return `Your agent has hit its Claude Code usage limit until ${formatUtcClock(limitedUntil)}. It'll pick back up once the limit resets \u2014 please try again after then.`;
|
|
33732
33732
|
}
|
|
33733
33733
|
|
|
33734
|
+
// ../core/dist/account-enforcement/marker.js
|
|
33735
|
+
var ACCOUNT_ENFORCEMENT_MARKER_FILENAME = "account-enforcement.json";
|
|
33736
|
+
var ACCOUNT_ENFORCEMENT_MARKER_VERSION = 1;
|
|
33737
|
+
function parseAccountEnforcementMarker(raw) {
|
|
33738
|
+
let parsed;
|
|
33739
|
+
try {
|
|
33740
|
+
parsed = JSON.parse(raw);
|
|
33741
|
+
} catch {
|
|
33742
|
+
return null;
|
|
33743
|
+
}
|
|
33744
|
+
if (typeof parsed !== "object" || parsed === null || parsed.version !== ACCOUNT_ENFORCEMENT_MARKER_VERSION) {
|
|
33745
|
+
return null;
|
|
33746
|
+
}
|
|
33747
|
+
const level = parsed.level;
|
|
33748
|
+
if (level !== "warn" && level !== "mute")
|
|
33749
|
+
return null;
|
|
33750
|
+
return { version: ACCOUNT_ENFORCEMENT_MARKER_VERSION, level };
|
|
33751
|
+
}
|
|
33752
|
+
function buildAccountIssueReplyText() {
|
|
33753
|
+
return "There is an issue with your account, please contact support@augmented.team.";
|
|
33754
|
+
}
|
|
33755
|
+
|
|
33734
33756
|
// ../core/dist/kanban/state-machine.js
|
|
33735
33757
|
var KANBAN_STATUSES = [
|
|
33736
33758
|
"backlog",
|
|
@@ -35030,6 +35052,26 @@ function readUsageLimitUntil(opts) {
|
|
|
35030
35052
|
return resolveUsageLimitUntil(parseUsageLimitMarker(raw), opts.now ?? /* @__PURE__ */ new Date());
|
|
35031
35053
|
}
|
|
35032
35054
|
|
|
35055
|
+
// src/account-enforcement-notice.ts
|
|
35056
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
35057
|
+
import { homedir as homedir3 } from "os";
|
|
35058
|
+
import { join as join3 } from "path";
|
|
35059
|
+
function accountEnforcementMarkerPath(codeName) {
|
|
35060
|
+
if (!codeName) return null;
|
|
35061
|
+
return join3(homedir3(), ".augmented", codeName, ACCOUNT_ENFORCEMENT_MARKER_FILENAME);
|
|
35062
|
+
}
|
|
35063
|
+
function readAccountEnforcementLevel(opts) {
|
|
35064
|
+
const path = opts.filePath ?? accountEnforcementMarkerPath(opts.codeName);
|
|
35065
|
+
if (!path) return null;
|
|
35066
|
+
let raw;
|
|
35067
|
+
try {
|
|
35068
|
+
raw = readFileSync3(path, "utf-8");
|
|
35069
|
+
} catch {
|
|
35070
|
+
return null;
|
|
35071
|
+
}
|
|
35072
|
+
return parseAccountEnforcementMarker(raw)?.level ?? null;
|
|
35073
|
+
}
|
|
35074
|
+
|
|
35033
35075
|
// src/watch-command.ts
|
|
35034
35076
|
var WATCH_DEFAULT_DURATION_MS = 2 * 60 * 60 * 1e3;
|
|
35035
35077
|
var WATCH_MAX_DURATION_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -35135,8 +35177,8 @@ function watchSuccessTextSlack(fileId, durationMs, reused) {
|
|
|
35135
35177
|
}
|
|
35136
35178
|
|
|
35137
35179
|
// src/ack-reaction.ts
|
|
35138
|
-
import { readdirSync, readFileSync as
|
|
35139
|
-
import { join as
|
|
35180
|
+
import { readdirSync, readFileSync as readFileSync4, writeFileSync } from "fs";
|
|
35181
|
+
import { join as join4 } from "path";
|
|
35140
35182
|
var REPLY_WEDGED_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
35141
35183
|
var ACK_STARTUP_GRACE_MS = 6e4;
|
|
35142
35184
|
var ACK_PANE_FRESH_THRESHOLD_MS = 6e4;
|
|
@@ -35233,7 +35275,7 @@ var GIVE_UP_SIGNAL_MAX_AGE_MS = 30 * 60 * 1e3;
|
|
|
35233
35275
|
function readGiveUpSignal(path, now = Date.now()) {
|
|
35234
35276
|
if (!path) return null;
|
|
35235
35277
|
try {
|
|
35236
|
-
const raw = JSON.parse(
|
|
35278
|
+
const raw = JSON.parse(readFileSync4(path, "utf8"));
|
|
35237
35279
|
if (typeof raw.gave_up_at !== "string") return null;
|
|
35238
35280
|
const t = Date.parse(raw.gave_up_at);
|
|
35239
35281
|
if (!Number.isFinite(t) || t > now) return null;
|
|
@@ -35268,7 +35310,7 @@ function oldestPendingMarkerAgeMs(dir, now = Date.now(), opts) {
|
|
|
35268
35310
|
if (!name.endsWith(".json")) continue;
|
|
35269
35311
|
let receivedAt;
|
|
35270
35312
|
try {
|
|
35271
|
-
const raw = JSON.parse(
|
|
35313
|
+
const raw = JSON.parse(readFileSync4(join4(dir, name), "utf-8"));
|
|
35272
35314
|
if (raw.discretionary === true) continue;
|
|
35273
35315
|
if (!opts?.includeSeen && typeof raw.seen_at === "string" && raw.seen_at) continue;
|
|
35274
35316
|
receivedAt = raw.received_at;
|
|
@@ -35336,14 +35378,14 @@ function isMarkerGenuinelyAged(receivedAt, nowMs, thresholdMs) {
|
|
|
35336
35378
|
}
|
|
35337
35379
|
var DEFLECTION_COUNTER_SUFFIX = "-deflections.json";
|
|
35338
35380
|
function deflectionCounterPath(agentDir, channel) {
|
|
35339
|
-
return
|
|
35381
|
+
return join4(agentDir, `${channel}${DEFLECTION_COUNTER_SUFFIX}`);
|
|
35340
35382
|
}
|
|
35341
35383
|
function recordChannelDeflection(agentDir, channel, cause) {
|
|
35342
35384
|
if (!agentDir) return;
|
|
35343
35385
|
const path = deflectionCounterPath(agentDir, channel);
|
|
35344
35386
|
let counts = {};
|
|
35345
35387
|
try {
|
|
35346
|
-
const parsed = JSON.parse(
|
|
35388
|
+
const parsed = JSON.parse(readFileSync4(path, "utf-8"));
|
|
35347
35389
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
35348
35390
|
} catch {
|
|
35349
35391
|
}
|
|
@@ -35407,15 +35449,15 @@ function probeAgentSessionCached(codeName, ttlMs = SESSION_PROBE_TTL_MS, now = D
|
|
|
35407
35449
|
}
|
|
35408
35450
|
|
|
35409
35451
|
// src/agent-config-state.ts
|
|
35410
|
-
import { existsSync as existsSync2, readFileSync as
|
|
35411
|
-
import { join as
|
|
35452
|
+
import { existsSync as existsSync2, readFileSync as readFileSync5 } from "fs";
|
|
35453
|
+
import { join as join5 } from "path";
|
|
35412
35454
|
var SESSION_STATE_FILENAME = "session-state.json";
|
|
35413
35455
|
function readAgentSessionState(stateDir) {
|
|
35414
35456
|
if (!stateDir) return null;
|
|
35415
|
-
const path =
|
|
35457
|
+
const path = join5(stateDir, SESSION_STATE_FILENAME);
|
|
35416
35458
|
if (!existsSync2(path)) return null;
|
|
35417
35459
|
try {
|
|
35418
|
-
const parsed = JSON.parse(
|
|
35460
|
+
const parsed = JSON.parse(readFileSync5(path, "utf-8"));
|
|
35419
35461
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
35420
35462
|
return parsed;
|
|
35421
35463
|
} catch {
|
|
@@ -35622,10 +35664,10 @@ import { promisify } from "util";
|
|
|
35622
35664
|
import { open, stat } from "fs/promises";
|
|
35623
35665
|
|
|
35624
35666
|
// src/channel-attachments.ts
|
|
35625
|
-
import { homedir as
|
|
35626
|
-
import { join as
|
|
35667
|
+
import { homedir as homedir4 } from "os";
|
|
35668
|
+
import { join as join6, resolve, sep } from "path";
|
|
35627
35669
|
function resolveChannelInboundDir(codeName, channelSlug) {
|
|
35628
|
-
const base =
|
|
35670
|
+
const base = join6(homedir4(), ".augmented");
|
|
35629
35671
|
const allowedSegment = /^[A-Za-z0-9_-]+$/;
|
|
35630
35672
|
if (!allowedSegment.test(codeName) || !allowedSegment.test(channelSlug)) {
|
|
35631
35673
|
throw new Error(
|
|
@@ -35703,7 +35745,7 @@ function isPathInside(target, root) {
|
|
|
35703
35745
|
return normalizedTarget === resolve(root) || normalizedTarget.startsWith(normalizedRoot);
|
|
35704
35746
|
}
|
|
35705
35747
|
function redactAugmentedPaths(msg) {
|
|
35706
|
-
const homePrefix =
|
|
35748
|
+
const homePrefix = homedir4().replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
35707
35749
|
return msg.replaceAll(
|
|
35708
35750
|
new RegExp(`${homePrefix}[\\\\/]\\.augmented(?:[\\\\/][^\\s'"\`]*)*`, "g"),
|
|
35709
35751
|
"<augmented-path>"
|
|
@@ -36155,8 +36197,8 @@ function emitToolCallMarkupRedactionTelemetry(channel) {
|
|
|
36155
36197
|
// src/reply-intent-runtime.ts
|
|
36156
36198
|
import { execFile as execFile2 } from "child_process";
|
|
36157
36199
|
import { existsSync as existsSync3, mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
36158
|
-
import { homedir as
|
|
36159
|
-
import { join as
|
|
36200
|
+
import { homedir as homedir5 } from "os";
|
|
36201
|
+
import { join as join7 } from "path";
|
|
36160
36202
|
var DEFAULT_CLAUDE_EVAL_MODEL = "claude-haiku-4-5-20251001";
|
|
36161
36203
|
var DEFAULT_ANTHROPIC_MESSAGES_URL = "https://api.anthropic.com/v1/messages";
|
|
36162
36204
|
var ANTHROPIC_API_VERSION = "2023-06-01";
|
|
@@ -36255,12 +36297,12 @@ async function runAnthropicMessages(prompt, opts) {
|
|
|
36255
36297
|
var emptyMcpConfigPath = null;
|
|
36256
36298
|
function ensureEmptyMcpConfig() {
|
|
36257
36299
|
if (emptyMcpConfigPath && existsSync3(emptyMcpConfigPath)) return emptyMcpConfigPath;
|
|
36258
|
-
const dir =
|
|
36300
|
+
const dir = join7(homedir5(), ".augmented");
|
|
36259
36301
|
try {
|
|
36260
36302
|
mkdirSync(dir, { recursive: true });
|
|
36261
36303
|
} catch {
|
|
36262
36304
|
}
|
|
36263
|
-
const p2 =
|
|
36305
|
+
const p2 = join7(dir, ".reply-intent-empty-mcp.json");
|
|
36264
36306
|
writeFileSync2(p2, JSON.stringify({ mcpServers: {} }));
|
|
36265
36307
|
emptyMcpConfigPath = p2;
|
|
36266
36308
|
return p2;
|
|
@@ -36285,7 +36327,7 @@ function runClaudeP(prompt, model) {
|
|
|
36285
36327
|
execFile2(
|
|
36286
36328
|
"claude",
|
|
36287
36329
|
args,
|
|
36288
|
-
{ cwd:
|
|
36330
|
+
{ cwd: homedir5(), timeout: CLASSIFY_TIMEOUT_MS, maxBuffer: 1 << 20 },
|
|
36289
36331
|
(err, stdout) => {
|
|
36290
36332
|
if (err) {
|
|
36291
36333
|
reject(err);
|
|
@@ -36408,7 +36450,7 @@ function emitTransientApiErrorTelemetry(channel, match, original) {
|
|
|
36408
36450
|
|
|
36409
36451
|
// src/slack-pending-inbound-cleanup.ts
|
|
36410
36452
|
import { existsSync as existsSync4, readdirSync as readdirSync2, statSync, unlinkSync } from "fs";
|
|
36411
|
-
import { join as
|
|
36453
|
+
import { join as join8 } from "path";
|
|
36412
36454
|
function sanitizeMarkerSegment(value) {
|
|
36413
36455
|
return value.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
36414
36456
|
}
|
|
@@ -36424,7 +36466,7 @@ function applyToMatchingMarkers(dir, prefix, suffix, op) {
|
|
|
36424
36466
|
try {
|
|
36425
36467
|
for (const f of readdirSync2(dir)) {
|
|
36426
36468
|
if (!f.startsWith(prefix) || !f.endsWith(suffix)) continue;
|
|
36427
|
-
op(
|
|
36469
|
+
op(join8(dir, f));
|
|
36428
36470
|
applied += 1;
|
|
36429
36471
|
}
|
|
36430
36472
|
} catch {
|
|
@@ -36454,7 +36496,7 @@ function clearOldestSlackPendingMarkerInChannel(dir, channel, clear = defaultCle
|
|
|
36454
36496
|
const channelPrefix = `${sanitizeMarkerSegment(channel)}__`;
|
|
36455
36497
|
try {
|
|
36456
36498
|
const entries = readdirSync2(dir).filter((f) => f.startsWith(channelPrefix) && f.endsWith(".json")).map((f) => {
|
|
36457
|
-
const full =
|
|
36499
|
+
const full = join8(dir, f);
|
|
36458
36500
|
let mtime = 0;
|
|
36459
36501
|
try {
|
|
36460
36502
|
mtime = statSync(full).mtimeMs;
|
|
@@ -36473,12 +36515,12 @@ function clearOldestSlackPendingMarkerInChannel(dir, channel, clear = defaultCle
|
|
|
36473
36515
|
|
|
36474
36516
|
// src/recovery-ledger.ts
|
|
36475
36517
|
import { existsSync as existsSync5, unlinkSync as unlinkSync2 } from "fs";
|
|
36476
|
-
import { join as
|
|
36518
|
+
import { join as join9 } from "path";
|
|
36477
36519
|
function recoveryLedgerEntryExists(ledgerDir, markerName, exists = (p2) => existsSync5(p2)) {
|
|
36478
36520
|
if (!ledgerDir || !markerName) return false;
|
|
36479
36521
|
if (markerName.includes("/") || markerName.includes("\\") || markerName.includes("..")) return false;
|
|
36480
36522
|
try {
|
|
36481
|
-
return exists(
|
|
36523
|
+
return exists(join9(ledgerDir, markerName));
|
|
36482
36524
|
} catch {
|
|
36483
36525
|
return false;
|
|
36484
36526
|
}
|
|
@@ -36489,7 +36531,7 @@ function removeRecoveryLedgerEntry(ledgerDir, markerName, unlink = (p2) => {
|
|
|
36489
36531
|
if (!ledgerDir || !markerName) return;
|
|
36490
36532
|
if (markerName.includes("/") || markerName.includes("\\") || markerName.includes("..")) return;
|
|
36491
36533
|
try {
|
|
36492
|
-
unlink(
|
|
36534
|
+
unlink(join9(ledgerDir, markerName));
|
|
36493
36535
|
} catch {
|
|
36494
36536
|
}
|
|
36495
36537
|
}
|
|
@@ -36726,7 +36768,7 @@ function applyHotThreadGuard(input) {
|
|
|
36726
36768
|
}
|
|
36727
36769
|
|
|
36728
36770
|
// src/restart-confirm.ts
|
|
36729
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as
|
|
36771
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync6, renameSync, unlinkSync as unlinkSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
36730
36772
|
import { dirname } from "path";
|
|
36731
36773
|
import { randomUUID } from "crypto";
|
|
36732
36774
|
var RESTART_CONFIRM_MAX_AGE_MS = 10 * 60 * 1e3;
|
|
@@ -36752,7 +36794,7 @@ function writeRestartConfirmMarker(filePath, marker) {
|
|
|
36752
36794
|
function readRestartConfirmMarker(filePath) {
|
|
36753
36795
|
try {
|
|
36754
36796
|
if (!existsSync6(filePath)) return null;
|
|
36755
|
-
const parsed = JSON.parse(
|
|
36797
|
+
const parsed = JSON.parse(readFileSync6(filePath, "utf8"));
|
|
36756
36798
|
if (!parsed || typeof parsed !== "object") return null;
|
|
36757
36799
|
return parsed;
|
|
36758
36800
|
} catch {
|
|
@@ -36897,7 +36939,7 @@ import {
|
|
|
36897
36939
|
ftruncateSync,
|
|
36898
36940
|
mkdirSync as mkdirSync9,
|
|
36899
36941
|
openSync,
|
|
36900
|
-
readFileSync as
|
|
36942
|
+
readFileSync as readFileSync18,
|
|
36901
36943
|
readdirSync as readdirSync5,
|
|
36902
36944
|
renameSync as renameSync5,
|
|
36903
36945
|
statSync as statSync3,
|
|
@@ -36906,12 +36948,12 @@ import {
|
|
|
36906
36948
|
writeFileSync as writeFileSync13,
|
|
36907
36949
|
writeSync
|
|
36908
36950
|
} from "fs";
|
|
36909
|
-
import { basename, join as
|
|
36910
|
-
import { homedir as
|
|
36951
|
+
import { basename, join as join18, resolve as resolve2 } from "path";
|
|
36952
|
+
import { homedir as homedir6 } from "os";
|
|
36911
36953
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "crypto";
|
|
36912
36954
|
|
|
36913
36955
|
// src/slack-thread-store.ts
|
|
36914
|
-
import { mkdirSync as mkdirSync3, readFileSync as
|
|
36956
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
36915
36957
|
import { dirname as dirname2 } from "path";
|
|
36916
36958
|
function isParticipatingThread(entry) {
|
|
36917
36959
|
if (!entry) return false;
|
|
@@ -36926,7 +36968,7 @@ function loadThreadStore(filePath, opts = {}) {
|
|
|
36926
36968
|
const ttlMs = ttlDays * 24 * 60 * 60 * 1e3;
|
|
36927
36969
|
let raw;
|
|
36928
36970
|
try {
|
|
36929
|
-
raw =
|
|
36971
|
+
raw = readFileSync7(filePath, "utf-8");
|
|
36930
36972
|
} catch {
|
|
36931
36973
|
return { threads: /* @__PURE__ */ new Map(), pruned: 0 };
|
|
36932
36974
|
}
|
|
@@ -37027,7 +37069,7 @@ function isThreadEntry(value) {
|
|
|
37027
37069
|
}
|
|
37028
37070
|
|
|
37029
37071
|
// src/dm-restart-notice.ts
|
|
37030
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
37072
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync8, unlinkSync as unlinkSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
37031
37073
|
import { dirname as dirname3 } from "path";
|
|
37032
37074
|
var RECENT_DM_VERSION = 1;
|
|
37033
37075
|
var DEFAULT_RECENT_DM_TTL_MS = 30 * 60 * 1e3;
|
|
@@ -37051,7 +37093,7 @@ function loadRecentDms(filePath, opts = {}) {
|
|
|
37051
37093
|
const ttlMs = opts.ttlMs ?? DEFAULT_RECENT_DM_TTL_MS;
|
|
37052
37094
|
let raw;
|
|
37053
37095
|
try {
|
|
37054
|
-
raw =
|
|
37096
|
+
raw = readFileSync8(filePath, "utf-8");
|
|
37055
37097
|
} catch (err) {
|
|
37056
37098
|
const code = err.code;
|
|
37057
37099
|
if (code !== "ENOENT") {
|
|
@@ -37136,7 +37178,7 @@ var CHANNEL_ADD_RESTART_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
|
37136
37178
|
function readChannelAddRestartMarker(filePath) {
|
|
37137
37179
|
let raw;
|
|
37138
37180
|
try {
|
|
37139
|
-
raw =
|
|
37181
|
+
raw = readFileSync8(filePath, "utf-8");
|
|
37140
37182
|
} catch {
|
|
37141
37183
|
return null;
|
|
37142
37184
|
}
|
|
@@ -37194,13 +37236,13 @@ async function runOrRetry(fn, opts) {
|
|
|
37194
37236
|
}
|
|
37195
37237
|
|
|
37196
37238
|
// src/turn-initiator-marker.ts
|
|
37197
|
-
import { writeFileSync as writeFileSync6, readFileSync as
|
|
37198
|
-
import { dirname as dirname4, join as
|
|
37239
|
+
import { writeFileSync as writeFileSync6, readFileSync as readFileSync9, mkdirSync as mkdirSync5, renameSync as renameSync2 } from "fs";
|
|
37240
|
+
import { dirname as dirname4, join as join10 } from "path";
|
|
37199
37241
|
var TURN_INITIATOR_MAX_AGE_MS = 5 * 60 * 1e3;
|
|
37200
37242
|
var TURN_INITIATOR_LEDGER_MAX_ENTRIES = 20;
|
|
37201
37243
|
var TURN_INITIATOR_LEDGER_FILENAME = ".turn-initiator-ledger.json";
|
|
37202
37244
|
function turnInitiatorLedgerPath(singleSlotFile) {
|
|
37203
|
-
return
|
|
37245
|
+
return join10(dirname4(singleSlotFile), TURN_INITIATOR_LEDGER_FILENAME);
|
|
37204
37246
|
}
|
|
37205
37247
|
function foldTurnInitiatorLedger(existing, marker, maxAgeMs = TURN_INITIATOR_MAX_AGE_MS, maxEntries = TURN_INITIATOR_LEDGER_MAX_ENTRIES) {
|
|
37206
37248
|
const now = marker.ts;
|
|
@@ -37225,7 +37267,7 @@ function updateTurnInitiatorLedger(singleSlotFile, marker) {
|
|
|
37225
37267
|
const ledgerFile = turnInitiatorLedgerPath(singleSlotFile);
|
|
37226
37268
|
let existing = null;
|
|
37227
37269
|
try {
|
|
37228
|
-
const parsed = JSON.parse(
|
|
37270
|
+
const parsed = JSON.parse(readFileSync9(ledgerFile, "utf8"));
|
|
37229
37271
|
if (parsed && parsed.v === 1 && Array.isArray(parsed.entries)) existing = parsed;
|
|
37230
37272
|
} catch {
|
|
37231
37273
|
}
|
|
@@ -37252,7 +37294,7 @@ function writeTurnInitiatorMarker(input) {
|
|
|
37252
37294
|
}
|
|
37253
37295
|
|
|
37254
37296
|
// src/slack-bot-photo.ts
|
|
37255
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as
|
|
37297
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "fs";
|
|
37256
37298
|
import { dirname as dirname5 } from "path";
|
|
37257
37299
|
async function applyBotPhoto(opts) {
|
|
37258
37300
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
@@ -37262,7 +37304,7 @@ async function applyBotPhoto(opts) {
|
|
|
37262
37304
|
const { token, avatarUrl, markerPath } = opts;
|
|
37263
37305
|
if (markerPath && existsSync7(markerPath)) {
|
|
37264
37306
|
try {
|
|
37265
|
-
if (
|
|
37307
|
+
if (readFileSync10(markerPath, "utf-8").trim() === avatarUrl) {
|
|
37266
37308
|
return { status: "skipped-unchanged" };
|
|
37267
37309
|
}
|
|
37268
37310
|
} catch {
|
|
@@ -37387,8 +37429,8 @@ function conversationalLaneMeta(expectsReply = true) {
|
|
|
37387
37429
|
}
|
|
37388
37430
|
|
|
37389
37431
|
// src/inbound-lane-telemetry.ts
|
|
37390
|
-
import { readFileSync as
|
|
37391
|
-
import { join as
|
|
37432
|
+
import { readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
37433
|
+
import { join as join11 } from "path";
|
|
37392
37434
|
var LANE_CLASSIFICATION_COUNTER_SUFFIX = "-lane-classifications.json";
|
|
37393
37435
|
var SUSPECTED_MISCLASSIFICATION_KEY = "suspected_misclassification";
|
|
37394
37436
|
var HUMAN_CHANNEL_SOURCES = /* @__PURE__ */ new Set([
|
|
@@ -37405,10 +37447,10 @@ function isSuspectedMisclassification(lane, source) {
|
|
|
37405
37447
|
}
|
|
37406
37448
|
function recordLaneClassification(agentDir, channel, classification) {
|
|
37407
37449
|
if (!agentDir) return;
|
|
37408
|
-
const path =
|
|
37450
|
+
const path = join11(agentDir, `${channel}${LANE_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
37409
37451
|
let counts = {};
|
|
37410
37452
|
try {
|
|
37411
|
-
const parsed = JSON.parse(
|
|
37453
|
+
const parsed = JSON.parse(readFileSync11(path, "utf-8"));
|
|
37412
37454
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
37413
37455
|
} catch {
|
|
37414
37456
|
}
|
|
@@ -37424,8 +37466,8 @@ function recordLaneClassification(agentDir, channel, classification) {
|
|
|
37424
37466
|
}
|
|
37425
37467
|
|
|
37426
37468
|
// src/slack-inbound-registry.ts
|
|
37427
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
37428
|
-
import { join as
|
|
37469
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync12 } from "fs";
|
|
37470
|
+
import { join as join12 } from "path";
|
|
37429
37471
|
var DEFAULT_MAX_ENTRIES = 500;
|
|
37430
37472
|
var DEFAULT_CLEARED_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
37431
37473
|
function entryKey(channel, messageTs) {
|
|
@@ -37546,7 +37588,7 @@ function createInboundRegistry(opts = {}) {
|
|
|
37546
37588
|
if (name.includes(".retry-") || name.includes(".poison")) continue;
|
|
37547
37589
|
let marker;
|
|
37548
37590
|
try {
|
|
37549
|
-
marker = JSON.parse(
|
|
37591
|
+
marker = JSON.parse(readFileSync12(join12(dir, name), "utf-8"));
|
|
37550
37592
|
} catch {
|
|
37551
37593
|
continue;
|
|
37552
37594
|
}
|
|
@@ -37591,8 +37633,8 @@ function slackInboundId(channel, threadTs, messageTs) {
|
|
|
37591
37633
|
}
|
|
37592
37634
|
|
|
37593
37635
|
// src/inbound-delivery-ledger.ts
|
|
37594
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync7, readdirSync as readdirSync4, readFileSync as
|
|
37595
|
-
import { join as
|
|
37636
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync7, readdirSync as readdirSync4, readFileSync as readFileSync13, renameSync as renameSync3, writeFileSync as writeFileSync9 } from "fs";
|
|
37637
|
+
import { join as join13 } from "path";
|
|
37596
37638
|
function safeInboundId(inboundId) {
|
|
37597
37639
|
return inboundId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
37598
37640
|
}
|
|
@@ -37601,7 +37643,7 @@ var defaultDeps = {
|
|
|
37601
37643
|
writeFile: (path, data) => writeFileSync9(path, data, "utf8"),
|
|
37602
37644
|
rename: (from, to) => renameSync3(from, to),
|
|
37603
37645
|
readdir: (dir) => readdirSync4(dir),
|
|
37604
|
-
readFile: (path) =>
|
|
37646
|
+
readFile: (path) => readFileSync13(path, "utf8"),
|
|
37605
37647
|
exists: (path) => existsSync8(path)
|
|
37606
37648
|
};
|
|
37607
37649
|
function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
@@ -37610,7 +37652,7 @@ function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
|
37610
37652
|
if (!safe || safe.includes("/") || safe.includes("\\") || safe.includes("..")) return;
|
|
37611
37653
|
try {
|
|
37612
37654
|
deps.mkdir(dir);
|
|
37613
|
-
const final =
|
|
37655
|
+
const final = join13(dir, `${safe}.json`);
|
|
37614
37656
|
const tmp = `${final}.tmp`;
|
|
37615
37657
|
deps.writeFile(tmp, JSON.stringify(record2));
|
|
37616
37658
|
deps.rename(tmp, final);
|
|
@@ -37766,8 +37808,8 @@ function describeChannelRedirect(input) {
|
|
|
37766
37808
|
}
|
|
37767
37809
|
|
|
37768
37810
|
// src/slack-reply-binding-telemetry.ts
|
|
37769
|
-
import { readFileSync as
|
|
37770
|
-
import { join as
|
|
37811
|
+
import { readFileSync as readFileSync14, writeFileSync as writeFileSync10 } from "fs";
|
|
37812
|
+
import { join as join14 } from "path";
|
|
37771
37813
|
var REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX = "-reply-binding-classifications.json";
|
|
37772
37814
|
var UNKNOWN_INBOUND_ID_KEY = "unknown_inbound_id";
|
|
37773
37815
|
var CHANNEL_MISTARGET_CORRECTED_KEY = "channel_mistarget_corrected";
|
|
@@ -37782,10 +37824,10 @@ function slackReplyBindingMode() {
|
|
|
37782
37824
|
}
|
|
37783
37825
|
function recordReplyBindingClassification(agentDir, channel, input) {
|
|
37784
37826
|
if (!agentDir) return;
|
|
37785
|
-
const path =
|
|
37827
|
+
const path = join14(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
37786
37828
|
let counts = {};
|
|
37787
37829
|
try {
|
|
37788
|
-
const parsed = JSON.parse(
|
|
37830
|
+
const parsed = JSON.parse(readFileSync14(path, "utf-8"));
|
|
37789
37831
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
37790
37832
|
} catch {
|
|
37791
37833
|
}
|
|
@@ -37800,10 +37842,10 @@ function recordReplyBindingClassification(agentDir, channel, input) {
|
|
|
37800
37842
|
}
|
|
37801
37843
|
function recordScheduledChannelOverride(agentDir, channel, input) {
|
|
37802
37844
|
if (!agentDir) return;
|
|
37803
|
-
const path =
|
|
37845
|
+
const path = join14(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
37804
37846
|
let counts = {};
|
|
37805
37847
|
try {
|
|
37806
|
-
const parsed = JSON.parse(
|
|
37848
|
+
const parsed = JSON.parse(readFileSync14(path, "utf-8"));
|
|
37807
37849
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
37808
37850
|
} catch {
|
|
37809
37851
|
}
|
|
@@ -37816,10 +37858,10 @@ function recordScheduledChannelOverride(agentDir, channel, input) {
|
|
|
37816
37858
|
}
|
|
37817
37859
|
function recordChannelMistarget(agentDir, channel, input) {
|
|
37818
37860
|
if (!agentDir) return;
|
|
37819
|
-
const path =
|
|
37861
|
+
const path = join14(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
37820
37862
|
let counts = {};
|
|
37821
37863
|
try {
|
|
37822
|
-
const parsed = JSON.parse(
|
|
37864
|
+
const parsed = JSON.parse(readFileSync14(path, "utf-8"));
|
|
37823
37865
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
37824
37866
|
} catch {
|
|
37825
37867
|
}
|
|
@@ -37834,8 +37876,8 @@ function recordChannelMistarget(agentDir, channel, input) {
|
|
|
37834
37876
|
}
|
|
37835
37877
|
|
|
37836
37878
|
// src/slack-reply-target-telemetry.ts
|
|
37837
|
-
import { readFileSync as
|
|
37838
|
-
import { join as
|
|
37879
|
+
import { readFileSync as readFileSync15, writeFileSync as writeFileSync11 } from "fs";
|
|
37880
|
+
import { join as join15 } from "path";
|
|
37839
37881
|
var REPLY_TARGET_CLASSIFICATION_COUNTER_SUFFIX = "-reply-target-classifications.json";
|
|
37840
37882
|
function pendingThreadsBucket(n) {
|
|
37841
37883
|
if (n <= 0) return "0";
|
|
@@ -37868,10 +37910,10 @@ function classifyReplyTarget(input) {
|
|
|
37868
37910
|
}
|
|
37869
37911
|
function recordReplyTargetClassification(agentDir, channel, classification) {
|
|
37870
37912
|
if (!agentDir) return;
|
|
37871
|
-
const path =
|
|
37913
|
+
const path = join15(agentDir, `${channel}${REPLY_TARGET_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
37872
37914
|
let counts = {};
|
|
37873
37915
|
try {
|
|
37874
|
-
const parsed = JSON.parse(
|
|
37916
|
+
const parsed = JSON.parse(readFileSync15(path, "utf-8"));
|
|
37875
37917
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
37876
37918
|
} catch {
|
|
37877
37919
|
}
|
|
@@ -37887,8 +37929,8 @@ function recordReplyTargetClassification(agentDir, channel, classification) {
|
|
|
37887
37929
|
}
|
|
37888
37930
|
|
|
37889
37931
|
// src/scheduled-turn-marker.ts
|
|
37890
|
-
import { readFileSync as
|
|
37891
|
-
import { join as
|
|
37932
|
+
import { readFileSync as readFileSync16, unlinkSync as unlinkSync5 } from "fs";
|
|
37933
|
+
import { join as join16 } from "path";
|
|
37892
37934
|
var SCHEDULED_TURN_MARKER_FILENAME2 = ".current-scheduled-turn.json";
|
|
37893
37935
|
var SCHEDULED_TURN_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
37894
37936
|
function validateScheduledTurnMarker(raw, now, maxAgeMs = SCHEDULED_TURN_MAX_AGE_MS) {
|
|
@@ -37926,7 +37968,7 @@ function readScheduledTurnMarker(agentDir, now = Date.now()) {
|
|
|
37926
37968
|
if (!agentDir) return null;
|
|
37927
37969
|
try {
|
|
37928
37970
|
const raw = JSON.parse(
|
|
37929
|
-
|
|
37971
|
+
readFileSync16(join16(agentDir, SCHEDULED_TURN_MARKER_FILENAME2), "utf8")
|
|
37930
37972
|
);
|
|
37931
37973
|
return validateScheduledTurnMarker(raw, now);
|
|
37932
37974
|
} catch {
|
|
@@ -37936,7 +37978,7 @@ function readScheduledTurnMarker(agentDir, now = Date.now()) {
|
|
|
37936
37978
|
function clearScheduledTurnMarker(agentDir) {
|
|
37937
37979
|
if (!agentDir) return;
|
|
37938
37980
|
try {
|
|
37939
|
-
unlinkSync5(
|
|
37981
|
+
unlinkSync5(join16(agentDir, SCHEDULED_TURN_MARKER_FILENAME2));
|
|
37940
37982
|
} catch {
|
|
37941
37983
|
}
|
|
37942
37984
|
}
|
|
@@ -38734,14 +38776,14 @@ async function actuateHostRestart(opts) {
|
|
|
38734
38776
|
import {
|
|
38735
38777
|
existsSync as existsSync9,
|
|
38736
38778
|
mkdirSync as mkdirSync8,
|
|
38737
|
-
readFileSync as
|
|
38779
|
+
readFileSync as readFileSync17,
|
|
38738
38780
|
renameSync as renameSync4,
|
|
38739
38781
|
statSync as statSync2,
|
|
38740
38782
|
unlinkSync as unlinkSync6,
|
|
38741
38783
|
utimesSync,
|
|
38742
38784
|
writeFileSync as writeFileSync12
|
|
38743
38785
|
} from "fs";
|
|
38744
|
-
import { join as
|
|
38786
|
+
import { join as join17 } from "path";
|
|
38745
38787
|
var STALE_LOCK_MS = 9e4;
|
|
38746
38788
|
var HEARTBEAT_INTERVAL_MS = 3e4;
|
|
38747
38789
|
function defaultIsPidAlive(pid) {
|
|
@@ -38764,7 +38806,7 @@ function acquireMcpSpawnLock(args) {
|
|
|
38764
38806
|
const nowMs = options.nowMs ?? (() => Date.now());
|
|
38765
38807
|
const lockMtimeMs = options.lockMtimeMs ?? defaultLockMtimeMs;
|
|
38766
38808
|
const staleMs = options.staleMs ?? STALE_LOCK_MS;
|
|
38767
|
-
const path =
|
|
38809
|
+
const path = join17(agentDir, basename2);
|
|
38768
38810
|
const existing = readLockHolder(path);
|
|
38769
38811
|
if (existing) {
|
|
38770
38812
|
if (existing.pid === selfPid) {
|
|
@@ -38831,7 +38873,7 @@ function defaultLockMtimeMs(path) {
|
|
|
38831
38873
|
function readLockHolder(path) {
|
|
38832
38874
|
if (!existsSync9(path)) return null;
|
|
38833
38875
|
try {
|
|
38834
|
-
const raw =
|
|
38876
|
+
const raw = readFileSync17(path, "utf8");
|
|
38835
38877
|
const parsed = JSON.parse(raw);
|
|
38836
38878
|
const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
|
|
38837
38879
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
@@ -39062,6 +39104,55 @@ async function maybeSendUsageLimitNotice(args) {
|
|
|
39062
39104
|
clearTimeout(timeoutId);
|
|
39063
39105
|
}
|
|
39064
39106
|
}
|
|
39107
|
+
var SLACK_ACCOUNT_MUTE_NOTICE_CACHE = /* @__PURE__ */ new Map();
|
|
39108
|
+
async function maybeSendAccountMuteNotice(args) {
|
|
39109
|
+
if (!BOT_TOKEN) return;
|
|
39110
|
+
if (!args.channel || !args.senderId) return;
|
|
39111
|
+
const key2 = `${args.channel}|${args.senderId}|account_mute`;
|
|
39112
|
+
const decision = decideDeclineReply({
|
|
39113
|
+
cache: SLACK_ACCOUNT_MUTE_NOTICE_CACHE,
|
|
39114
|
+
key: key2,
|
|
39115
|
+
cooldownMs: SLACK_POLICY_DECLINE_COOLDOWN_MS,
|
|
39116
|
+
now: Date.now()
|
|
39117
|
+
});
|
|
39118
|
+
if (!decision.reply) {
|
|
39119
|
+
process.stderr.write(
|
|
39120
|
+
`slack-channel(${AGENT_CODE_NAME}): account-mute notice suppressed by cooldown (channel=${redactSlackId(args.channel)}, sender=${redactSlackId(args.senderId)}, remaining=${decision.remainingMs}ms)
|
|
39121
|
+
`
|
|
39122
|
+
);
|
|
39123
|
+
return;
|
|
39124
|
+
}
|
|
39125
|
+
const controller = new AbortController();
|
|
39126
|
+
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
39127
|
+
try {
|
|
39128
|
+
const res = await fetch("https://slack.com/api/chat.postMessage", {
|
|
39129
|
+
method: "POST",
|
|
39130
|
+
signal: controller.signal,
|
|
39131
|
+
headers: {
|
|
39132
|
+
"Content-Type": "application/json",
|
|
39133
|
+
Authorization: `Bearer ${BOT_TOKEN}`
|
|
39134
|
+
},
|
|
39135
|
+
body: JSON.stringify({
|
|
39136
|
+
channel: args.channel,
|
|
39137
|
+
text: buildAccountIssueReplyText(),
|
|
39138
|
+
...args.threadTs ? { thread_ts: args.threadTs } : {}
|
|
39139
|
+
})
|
|
39140
|
+
});
|
|
39141
|
+
const data = await res.json();
|
|
39142
|
+
if (!data.ok) {
|
|
39143
|
+
SLACK_ACCOUNT_MUTE_NOTICE_CACHE.delete(key2);
|
|
39144
|
+
process.stderr.write(
|
|
39145
|
+
`slack-channel(${AGENT_CODE_NAME}): account-mute notice post failed: ${data.error ?? "unknown"}
|
|
39146
|
+
`
|
|
39147
|
+
);
|
|
39148
|
+
}
|
|
39149
|
+
} catch (err) {
|
|
39150
|
+
SLACK_ACCOUNT_MUTE_NOTICE_CACHE.delete(key2);
|
|
39151
|
+
throw err;
|
|
39152
|
+
} finally {
|
|
39153
|
+
clearTimeout(timeoutId);
|
|
39154
|
+
}
|
|
39155
|
+
}
|
|
39065
39156
|
var BLOCK_KIT_DISABLED = process.env.SLACK_BLOCK_KIT_DISABLED === "true";
|
|
39066
39157
|
var ALLOWED_USERS = parseAllowedUsersCsv(process.env.SLACK_ALLOWED_USERS);
|
|
39067
39158
|
var PING_ALLOWED_USERS = parseAllowedUsersCsv(process.env.SLACK_PING_ALLOWED_USERS);
|
|
@@ -39137,8 +39228,8 @@ var SLACK_TEAM_PEER_USER_IDS = parseTeamPeerUserIdsEnv(
|
|
|
39137
39228
|
process.env.SLACK_TEAM_PEER_USER_IDS
|
|
39138
39229
|
);
|
|
39139
39230
|
var PEER_HINT_SEEN = /* @__PURE__ */ new Set();
|
|
39140
|
-
var SLACK_AGENT_DIR = AGENT_CODE_NAME ?
|
|
39141
|
-
var SLACK_MCP_CONFIG_PATH = SLACK_AGENT_DIR ?
|
|
39231
|
+
var SLACK_AGENT_DIR = AGENT_CODE_NAME ? join18(homedir6(), ".augmented", AGENT_CODE_NAME) : null;
|
|
39232
|
+
var SLACK_MCP_CONFIG_PATH = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "project", ".mcp.json") : null;
|
|
39142
39233
|
var liveAllowedUsersCache = null;
|
|
39143
39234
|
function readLiveAllowedUsers() {
|
|
39144
39235
|
if (!SLACK_MCP_CONFIG_PATH) return null;
|
|
@@ -39148,7 +39239,7 @@ function readLiveAllowedUsers() {
|
|
|
39148
39239
|
return liveAllowedUsersCache.value;
|
|
39149
39240
|
}
|
|
39150
39241
|
const value = extractAllowedUsersFromMcpJson(
|
|
39151
|
-
|
|
39242
|
+
readFileSync18(SLACK_MCP_CONFIG_PATH, "utf-8")
|
|
39152
39243
|
);
|
|
39153
39244
|
if (value === null) return null;
|
|
39154
39245
|
liveAllowedUsersCache = { mtimeMs, value };
|
|
@@ -39169,7 +39260,7 @@ function readLivePingAllowedUsers() {
|
|
|
39169
39260
|
return livePingAllowedUsersCache.value;
|
|
39170
39261
|
}
|
|
39171
39262
|
const value = extractPingAllowedUsersFromMcpJson(
|
|
39172
|
-
|
|
39263
|
+
readFileSync18(SLACK_MCP_CONFIG_PATH, "utf-8")
|
|
39173
39264
|
);
|
|
39174
39265
|
if (value === null) return null;
|
|
39175
39266
|
livePingAllowedUsersCache = { mtimeMs, value };
|
|
@@ -39181,17 +39272,17 @@ function readLivePingAllowedUsers() {
|
|
|
39181
39272
|
function getEffectivePingAllowedUsers() {
|
|
39182
39273
|
return readLivePingAllowedUsers() ?? PING_ALLOWED_USERS;
|
|
39183
39274
|
}
|
|
39184
|
-
var SLACK_PENDING_INBOUND_DIR = SLACK_AGENT_DIR ?
|
|
39185
|
-
var SLACK_RESTART_CONTEXT_DIR = SLACK_AGENT_DIR ?
|
|
39186
|
-
var SLACK_RECOVERY_OUTBOX_DIR = SLACK_AGENT_DIR ?
|
|
39187
|
-
var SLACK_RECOVERY_LEDGER_DIR = SLACK_AGENT_DIR ?
|
|
39188
|
-
var SLACK_DELIVERY_LEDGER_DIR = SLACK_AGENT_DIR ?
|
|
39275
|
+
var SLACK_PENDING_INBOUND_DIR = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "slack-pending-inbound") : null;
|
|
39276
|
+
var SLACK_RESTART_CONTEXT_DIR = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "slack-restart-context") : null;
|
|
39277
|
+
var SLACK_RECOVERY_OUTBOX_DIR = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "slack-recovery-outbox") : null;
|
|
39278
|
+
var SLACK_RECOVERY_LEDGER_DIR = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, ".agt-slack-recovery-ledger") : null;
|
|
39279
|
+
var SLACK_DELIVERY_LEDGER_DIR = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, ".agt-inbound-delivery-ledger") : null;
|
|
39189
39280
|
var slackInboundRegistry = createInboundRegistry();
|
|
39190
|
-
var SLACK_RESTART_CONFIRM_FILE = SLACK_AGENT_DIR ?
|
|
39191
|
-
var SLACK_RECENT_DMS_FILE = SLACK_AGENT_DIR ?
|
|
39192
|
-
var SLACK_CHANNEL_ADD_RESTART_FILE = SLACK_AGENT_DIR ?
|
|
39281
|
+
var SLACK_RESTART_CONFIRM_FILE = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "slack-restart-confirm.json") : null;
|
|
39282
|
+
var SLACK_RECENT_DMS_FILE = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "slack-recent-dms.json") : null;
|
|
39283
|
+
var SLACK_CHANNEL_ADD_RESTART_FILE = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "slack-channel-add-restart.json") : null;
|
|
39193
39284
|
var SLACK_MAX_RECOVERY_ATTEMPTS = 3;
|
|
39194
|
-
var SLACK_AVATAR_MARKER_PATH = SLACK_AGENT_DIR ?
|
|
39285
|
+
var SLACK_AVATAR_MARKER_PATH = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "slack-avatar-applied") : null;
|
|
39195
39286
|
function redactSlackId(id) {
|
|
39196
39287
|
if (!id) return "<none>";
|
|
39197
39288
|
return createHash2("sha256").update(id).digest("hex").slice(0, 8);
|
|
@@ -39202,7 +39293,7 @@ function safeSlackMarkerName(channel, threadTs, messageTs) {
|
|
|
39202
39293
|
}
|
|
39203
39294
|
function slackPendingInboundPath(channel, threadTs, messageTs) {
|
|
39204
39295
|
if (!SLACK_PENDING_INBOUND_DIR) return null;
|
|
39205
|
-
return
|
|
39296
|
+
return join18(SLACK_PENDING_INBOUND_DIR, safeSlackMarkerName(channel, threadTs, messageTs));
|
|
39206
39297
|
}
|
|
39207
39298
|
function writeSlackPendingInboundMarker(channel, threadTs, messageTs, undeliverable = false, discretionary = false, payload) {
|
|
39208
39299
|
const path = slackPendingInboundPath(channel, threadTs, messageTs);
|
|
@@ -39253,7 +39344,7 @@ function rewriteSlackMarkerInPlace(path, marker) {
|
|
|
39253
39344
|
function markSlackMarkerSeenInPlace(fullPath) {
|
|
39254
39345
|
let marker;
|
|
39255
39346
|
try {
|
|
39256
|
-
marker = JSON.parse(
|
|
39347
|
+
marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
|
|
39257
39348
|
} catch {
|
|
39258
39349
|
return;
|
|
39259
39350
|
}
|
|
@@ -39267,7 +39358,7 @@ function attachSlackReplayPayload(channel, threadTs, messageTs, payload) {
|
|
|
39267
39358
|
if (!path) return;
|
|
39268
39359
|
let marker;
|
|
39269
39360
|
try {
|
|
39270
|
-
marker = JSON.parse(
|
|
39361
|
+
marker = JSON.parse(readFileSync18(path, "utf-8"));
|
|
39271
39362
|
} catch {
|
|
39272
39363
|
return;
|
|
39273
39364
|
}
|
|
@@ -39278,7 +39369,7 @@ function readSlackPendingInboundMarker(channel, threadTs, messageTs) {
|
|
|
39278
39369
|
const path = slackPendingInboundPath(channel, threadTs, messageTs);
|
|
39279
39370
|
if (!path || !existsSync10(path)) return null;
|
|
39280
39371
|
try {
|
|
39281
|
-
return JSON.parse(
|
|
39372
|
+
return JSON.parse(readFileSync18(path, "utf-8"));
|
|
39282
39373
|
} catch {
|
|
39283
39374
|
return null;
|
|
39284
39375
|
}
|
|
@@ -39394,7 +39485,7 @@ function scheduleBusyAck(channel, threadTs, messageTs, isThreadReply, arrivedWhi
|
|
|
39394
39485
|
let paneLogFreshAgeMs = null;
|
|
39395
39486
|
if (SLACK_AGENT_DIR) {
|
|
39396
39487
|
try {
|
|
39397
|
-
const paneMtimeMs = statSync3(
|
|
39488
|
+
const paneMtimeMs = statSync3(join18(SLACK_AGENT_DIR, "pane.log")).mtimeMs;
|
|
39398
39489
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
39399
39490
|
} catch {
|
|
39400
39491
|
}
|
|
@@ -39427,7 +39518,7 @@ function __resetSlackBusyAckNoticeThrottle() {
|
|
|
39427
39518
|
function clearSlackMarkerFileWithHeal(fullPath) {
|
|
39428
39519
|
let marker = null;
|
|
39429
39520
|
try {
|
|
39430
|
-
marker = JSON.parse(
|
|
39521
|
+
marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
|
|
39431
39522
|
} catch {
|
|
39432
39523
|
}
|
|
39433
39524
|
if (marker && decideRecoveryHeal({
|
|
@@ -39445,7 +39536,7 @@ function clearSlackMarkerFileWithHeal(fullPath) {
|
|
|
39445
39536
|
function markSlackMarkerSeenWithHeal(fullPath) {
|
|
39446
39537
|
let marker = null;
|
|
39447
39538
|
try {
|
|
39448
|
-
marker = JSON.parse(
|
|
39539
|
+
marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
|
|
39449
39540
|
} catch {
|
|
39450
39541
|
return;
|
|
39451
39542
|
}
|
|
@@ -39514,10 +39605,10 @@ function slackNextRetryName(filename) {
|
|
|
39514
39605
|
async function processSlackRecoveryOutboxFile(filename) {
|
|
39515
39606
|
if (!SLACK_RECOVERY_OUTBOX_DIR) return;
|
|
39516
39607
|
if (filename.endsWith(".poison.json") || filename.endsWith(".tmp")) return;
|
|
39517
|
-
const fullPath =
|
|
39608
|
+
const fullPath = join18(SLACK_RECOVERY_OUTBOX_DIR, filename);
|
|
39518
39609
|
let payload;
|
|
39519
39610
|
try {
|
|
39520
|
-
payload = JSON.parse(
|
|
39611
|
+
payload = JSON.parse(readFileSync18(fullPath, "utf-8"));
|
|
39521
39612
|
} catch (err) {
|
|
39522
39613
|
process.stderr.write(
|
|
39523
39614
|
`slack-channel(${AGENT_CODE_NAME}): recovery outbox parse failed (${filename}): ${err.message}
|
|
@@ -39621,7 +39712,7 @@ async function processSlackRecoveryOutboxFile(filename) {
|
|
|
39621
39712
|
const next = slackNextRetryName(filename);
|
|
39622
39713
|
if (next) {
|
|
39623
39714
|
try {
|
|
39624
|
-
renameSync5(fullPath,
|
|
39715
|
+
renameSync5(fullPath, join18(SLACK_RECOVERY_OUTBOX_DIR, next.next));
|
|
39625
39716
|
if (next.attempt >= SLACK_MAX_RECOVERY_ATTEMPTS) {
|
|
39626
39717
|
process.stderr.write(
|
|
39627
39718
|
`slack-channel(${AGENT_CODE_NAME}): ghost-reply recovery exhausted retries \u2014 moved to ${next.next}
|
|
@@ -39661,7 +39752,7 @@ function scanSlackRecoveryRetries() {
|
|
|
39661
39752
|
if (!f.includes(".retry-") || f.endsWith(".poison.json")) continue;
|
|
39662
39753
|
let mtimeMs;
|
|
39663
39754
|
try {
|
|
39664
|
-
mtimeMs = statSync3(
|
|
39755
|
+
mtimeMs = statSync3(join18(SLACK_RECOVERY_OUTBOX_DIR, f)).mtimeMs;
|
|
39665
39756
|
} catch {
|
|
39666
39757
|
continue;
|
|
39667
39758
|
}
|
|
@@ -39691,7 +39782,7 @@ function startSlackRecoveryOutboxWatcher() {
|
|
|
39691
39782
|
const watcher = watch(SLACK_RECOVERY_OUTBOX_DIR, (event, filename) => {
|
|
39692
39783
|
if (event !== "rename" || !filename) return;
|
|
39693
39784
|
if (!isFirstAttemptSlackOutboxFile(filename)) return;
|
|
39694
|
-
if (existsSync10(
|
|
39785
|
+
if (existsSync10(join18(SLACK_RECOVERY_OUTBOX_DIR, filename))) {
|
|
39695
39786
|
void processSlackRecoveryOutboxFile(filename);
|
|
39696
39787
|
}
|
|
39697
39788
|
});
|
|
@@ -39706,7 +39797,7 @@ function startSlackRecoveryOutboxWatcher() {
|
|
|
39706
39797
|
retryTimer.unref?.();
|
|
39707
39798
|
}
|
|
39708
39799
|
startSlackRecoveryOutboxWatcher();
|
|
39709
|
-
var SLACK_NOTICE_OUTBOX_DIR = SLACK_AGENT_DIR ?
|
|
39800
|
+
var SLACK_NOTICE_OUTBOX_DIR = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "slack-notice-outbox") : null;
|
|
39710
39801
|
var SLACK_NOTICE_MAX_AGE_MS = 9e4;
|
|
39711
39802
|
var SLACK_NOTICE_INFLIGHT = /* @__PURE__ */ new Set();
|
|
39712
39803
|
async function processSlackNoticeOutboxFile(filename) {
|
|
@@ -39714,7 +39805,7 @@ async function processSlackNoticeOutboxFile(filename) {
|
|
|
39714
39805
|
if (filename.startsWith(".") || filename.endsWith(".tmp") || !filename.endsWith(".json")) return;
|
|
39715
39806
|
if (SLACK_NOTICE_INFLIGHT.has(filename)) return;
|
|
39716
39807
|
SLACK_NOTICE_INFLIGHT.add(filename);
|
|
39717
|
-
const fullPath =
|
|
39808
|
+
const fullPath = join18(SLACK_NOTICE_OUTBOX_DIR, filename);
|
|
39718
39809
|
try {
|
|
39719
39810
|
let mtimeMs;
|
|
39720
39811
|
try {
|
|
@@ -39731,7 +39822,7 @@ async function processSlackNoticeOutboxFile(filename) {
|
|
|
39731
39822
|
}
|
|
39732
39823
|
let payload;
|
|
39733
39824
|
try {
|
|
39734
|
-
const parsed = JSON.parse(
|
|
39825
|
+
const parsed = JSON.parse(readFileSync18(fullPath, "utf-8"));
|
|
39735
39826
|
if (!parsed || typeof parsed !== "object") throw new Error("not an object");
|
|
39736
39827
|
payload = parsed;
|
|
39737
39828
|
} catch {
|
|
@@ -39820,7 +39911,7 @@ function startSlackNoticeOutboxWatcher() {
|
|
|
39820
39911
|
try {
|
|
39821
39912
|
const watcher = watch(SLACK_NOTICE_OUTBOX_DIR, (event, filename) => {
|
|
39822
39913
|
if (event !== "rename" || !filename) return;
|
|
39823
|
-
if (existsSync10(
|
|
39914
|
+
if (existsSync10(join18(SLACK_NOTICE_OUTBOX_DIR, filename))) {
|
|
39824
39915
|
void processSlackNoticeOutboxFile(filename);
|
|
39825
39916
|
}
|
|
39826
39917
|
});
|
|
@@ -39856,10 +39947,10 @@ function sweepSlackStaleMarkers(thresholdMs) {
|
|
|
39856
39947
|
for (const filename of filenames) {
|
|
39857
39948
|
if (!filename.endsWith(".json")) continue;
|
|
39858
39949
|
if (filename.endsWith(".tmp")) continue;
|
|
39859
|
-
const fullPath =
|
|
39950
|
+
const fullPath = join18(SLACK_PENDING_INBOUND_DIR, filename);
|
|
39860
39951
|
let marker;
|
|
39861
39952
|
try {
|
|
39862
|
-
marker = JSON.parse(
|
|
39953
|
+
marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
|
|
39863
39954
|
} catch (err) {
|
|
39864
39955
|
process.stderr.write(
|
|
39865
39956
|
`slack-channel(${AGENT_CODE_NAME}): stale-marker parse failed for ${redactSlackId(filename)}: ${err.message}
|
|
@@ -39909,13 +40000,13 @@ var slackOrphanSweepTimer = setInterval(() => {
|
|
|
39909
40000
|
checkSlackWatchdogGiveUpNotice();
|
|
39910
40001
|
}, orphanSweepIntervalMs());
|
|
39911
40002
|
slackOrphanSweepTimer.unref?.();
|
|
39912
|
-
var SLACK_PROGRESS_HEARTBEAT_PATH = SLACK_AGENT_DIR ?
|
|
40003
|
+
var SLACK_PROGRESS_HEARTBEAT_PATH = SLACK_AGENT_DIR ? join18(SLACK_AGENT_DIR, "channel-progress-heartbeat.json") : null;
|
|
39913
40004
|
var slackTrackedProgress = null;
|
|
39914
40005
|
var slackProgressTickRunning = false;
|
|
39915
40006
|
function readSlackProgressHeartbeat() {
|
|
39916
40007
|
if (!SLACK_PROGRESS_HEARTBEAT_PATH || !existsSync10(SLACK_PROGRESS_HEARTBEAT_PATH)) return null;
|
|
39917
40008
|
try {
|
|
39918
|
-
return parseProgressHeartbeat(
|
|
40009
|
+
return parseProgressHeartbeat(readFileSync18(SLACK_PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
39919
40010
|
} catch {
|
|
39920
40011
|
return null;
|
|
39921
40012
|
}
|
|
@@ -39942,7 +40033,7 @@ function findSlackProgressTarget() {
|
|
|
39942
40033
|
if (!name.endsWith(".json")) continue;
|
|
39943
40034
|
let m;
|
|
39944
40035
|
try {
|
|
39945
|
-
m = JSON.parse(
|
|
40036
|
+
m = JSON.parse(readFileSync18(join18(SLACK_PENDING_INBOUND_DIR, name), "utf-8"));
|
|
39946
40037
|
} catch {
|
|
39947
40038
|
continue;
|
|
39948
40039
|
}
|
|
@@ -40093,7 +40184,7 @@ function listPendingSlackConversations() {
|
|
|
40093
40184
|
if (!name.endsWith(".json")) continue;
|
|
40094
40185
|
try {
|
|
40095
40186
|
const marker = JSON.parse(
|
|
40096
|
-
|
|
40187
|
+
readFileSync18(join18(SLACK_PENDING_INBOUND_DIR, name), "utf8")
|
|
40097
40188
|
);
|
|
40098
40189
|
if (typeof marker.channel !== "string" || !marker.channel) continue;
|
|
40099
40190
|
if (typeof marker.thread_ts !== "string" || !marker.thread_ts) continue;
|
|
@@ -40145,7 +40236,7 @@ function postSlackWatchdogGiveUpNotice(channel, threadTs, isThreadReply, reason)
|
|
|
40145
40236
|
}
|
|
40146
40237
|
function checkSlackWatchdogGiveUpNotice() {
|
|
40147
40238
|
if (!SLACK_AGENT_DIR) return;
|
|
40148
|
-
const signal = readGiveUpSignal(
|
|
40239
|
+
const signal = readGiveUpSignal(join18(SLACK_AGENT_DIR, GIVE_UP_SIGNAL_FILENAME));
|
|
40149
40240
|
const signalAtMs = signal?.atMs ?? null;
|
|
40150
40241
|
const act = decideGiveUpNotice({
|
|
40151
40242
|
signalAtMs,
|
|
@@ -40177,7 +40268,7 @@ function readRestartTopicForMarker(filename, channel, threadTs) {
|
|
|
40177
40268
|
if (!SLACK_RESTART_CONTEXT_DIR) return null;
|
|
40178
40269
|
let raw;
|
|
40179
40270
|
try {
|
|
40180
|
-
raw =
|
|
40271
|
+
raw = readFileSync18(join18(SLACK_RESTART_CONTEXT_DIR, filename), "utf-8");
|
|
40181
40272
|
} catch {
|
|
40182
40273
|
return null;
|
|
40183
40274
|
}
|
|
@@ -40186,7 +40277,7 @@ function readRestartTopicForMarker(filename, channel, threadTs) {
|
|
|
40186
40277
|
function removeRestartContextHint(filename) {
|
|
40187
40278
|
if (!SLACK_RESTART_CONTEXT_DIR) return;
|
|
40188
40279
|
try {
|
|
40189
|
-
unlinkSync7(
|
|
40280
|
+
unlinkSync7(join18(SLACK_RESTART_CONTEXT_DIR, filename));
|
|
40190
40281
|
} catch {
|
|
40191
40282
|
}
|
|
40192
40283
|
}
|
|
@@ -40201,7 +40292,7 @@ function clearAllRestartContextHints() {
|
|
|
40201
40292
|
for (const name of names) {
|
|
40202
40293
|
if (!name.endsWith(".json")) continue;
|
|
40203
40294
|
try {
|
|
40204
|
-
unlinkSync7(
|
|
40295
|
+
unlinkSync7(join18(SLACK_RESTART_CONTEXT_DIR, name));
|
|
40205
40296
|
} catch {
|
|
40206
40297
|
}
|
|
40207
40298
|
}
|
|
@@ -40228,10 +40319,10 @@ async function notifyStrandedInboundsOnFirstConnect() {
|
|
|
40228
40319
|
let notified = 0;
|
|
40229
40320
|
for (const filename of filenames) {
|
|
40230
40321
|
if (!filename.endsWith(".json")) continue;
|
|
40231
|
-
const fullPath =
|
|
40322
|
+
const fullPath = join18(SLACK_PENDING_INBOUND_DIR, filename);
|
|
40232
40323
|
let marker;
|
|
40233
40324
|
try {
|
|
40234
|
-
marker = JSON.parse(
|
|
40325
|
+
marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
|
|
40235
40326
|
} catch {
|
|
40236
40327
|
continue;
|
|
40237
40328
|
}
|
|
@@ -40405,7 +40496,7 @@ function noteThreadActivityByMessageTs(channel, messageTs) {
|
|
|
40405
40496
|
markSeenAllSlackPendingMarkersForThread2(channel, messageTs);
|
|
40406
40497
|
markSeenSlackPendingMarkerByMessageTs2(channel, messageTs);
|
|
40407
40498
|
}
|
|
40408
|
-
var RESTART_FLAGS_DIR =
|
|
40499
|
+
var RESTART_FLAGS_DIR = join18(homedir6(), ".augmented", "restart-flags");
|
|
40409
40500
|
function actuateHostRestartSlack() {
|
|
40410
40501
|
return actuateHostRestart({
|
|
40411
40502
|
agtHost: AGT_HOST,
|
|
@@ -41010,7 +41101,7 @@ async function handleSlashCommandEnvelope(payload) {
|
|
|
41010
41101
|
if (!existsSync10(RESTART_FLAGS_DIR)) {
|
|
41011
41102
|
mkdirSync9(RESTART_FLAGS_DIR, { recursive: true });
|
|
41012
41103
|
}
|
|
41013
|
-
const flagPath =
|
|
41104
|
+
const flagPath = join18(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
41014
41105
|
const flag = {
|
|
41015
41106
|
codeName,
|
|
41016
41107
|
source: "slack",
|
|
@@ -41153,7 +41244,7 @@ async function handleRestartCommand(opts) {
|
|
|
41153
41244
|
if (!existsSync10(RESTART_FLAGS_DIR)) {
|
|
41154
41245
|
mkdirSync9(RESTART_FLAGS_DIR, { recursive: true });
|
|
41155
41246
|
}
|
|
41156
|
-
const flagPath =
|
|
41247
|
+
const flagPath = join18(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
41157
41248
|
const flag = {
|
|
41158
41249
|
codeName,
|
|
41159
41250
|
source: "slack",
|
|
@@ -41275,7 +41366,7 @@ var SLACK_HOT_THREAD_WINDOW_MS = parseHotThreadWindowMs(
|
|
|
41275
41366
|
);
|
|
41276
41367
|
function resolveThreadStorePath() {
|
|
41277
41368
|
if (!AGENT_CODE_NAME) return null;
|
|
41278
|
-
return
|
|
41369
|
+
return join18(homedir6(), ".augmented", AGENT_CODE_NAME, "slack-tracked-threads.json");
|
|
41279
41370
|
}
|
|
41280
41371
|
function parseTtlDays(raw) {
|
|
41281
41372
|
if (!raw) return void 0;
|
|
@@ -41314,9 +41405,9 @@ if (!BOT_TOKEN || !APP_TOKEN) {
|
|
|
41314
41405
|
var slackStderrLogStream = null;
|
|
41315
41406
|
if (AGENT_CODE_NAME) {
|
|
41316
41407
|
try {
|
|
41317
|
-
const logDir =
|
|
41408
|
+
const logDir = join18(homedir6(), ".augmented", AGENT_CODE_NAME);
|
|
41318
41409
|
mkdirSync9(logDir, { recursive: true });
|
|
41319
|
-
slackStderrLogStream = createWriteStream(
|
|
41410
|
+
slackStderrLogStream = createWriteStream(join18(logDir, "slack-channel-stderr.log"), {
|
|
41320
41411
|
flags: "a",
|
|
41321
41412
|
mode: 384
|
|
41322
41413
|
});
|
|
@@ -42186,7 +42277,7 @@ ${result.formatted}` : "No messages in range, or the bot is not a member of this
|
|
|
42186
42277
|
isError: true
|
|
42187
42278
|
};
|
|
42188
42279
|
}
|
|
42189
|
-
const allowedRoot = resolve2(
|
|
42280
|
+
const allowedRoot = resolve2(homedir6(), ".augmented", AGENT_CODE_NAME, "project") + "/";
|
|
42190
42281
|
const resolvedPath = resolve2(path);
|
|
42191
42282
|
if (!resolvedPath.startsWith(allowedRoot)) {
|
|
42192
42283
|
return {
|
|
@@ -42208,7 +42299,7 @@ ${result.formatted}` : "No messages in range, or the bot is not a member of this
|
|
|
42208
42299
|
};
|
|
42209
42300
|
}
|
|
42210
42301
|
size = stat2.size;
|
|
42211
|
-
bytes =
|
|
42302
|
+
bytes = readFileSync18(resolvedPath);
|
|
42212
42303
|
} catch (err) {
|
|
42213
42304
|
return {
|
|
42214
42305
|
content: [{ type: "text", text: `Failed to read file: ${err.message}` }],
|
|
@@ -42863,7 +42954,7 @@ function isDownloadableFileId(fileId, channel) {
|
|
|
42863
42954
|
}
|
|
42864
42955
|
function redactAugmentedPaths2(msg) {
|
|
42865
42956
|
return msg.replaceAll(
|
|
42866
|
-
new RegExp(`${
|
|
42957
|
+
new RegExp(`${homedir6().replace(/[.*+?^${}()|[\\]\\\\]/g, "\\\\$&")}/\\.augmented/[^\\s'"\`]*`, "g"),
|
|
42867
42958
|
"<augmented-path>"
|
|
42868
42959
|
);
|
|
42869
42960
|
}
|
|
@@ -42991,7 +43082,7 @@ async function replayPendingSlackMarkers() {
|
|
|
42991
43082
|
let paneFreshAgeMs = null;
|
|
42992
43083
|
if (SLACK_AGENT_DIR) {
|
|
42993
43084
|
try {
|
|
42994
|
-
paneFreshAgeMs = Math.max(0, now - statSync3(
|
|
43085
|
+
paneFreshAgeMs = Math.max(0, now - statSync3(join18(SLACK_AGENT_DIR, "pane.log")).mtimeMs);
|
|
42995
43086
|
} catch {
|
|
42996
43087
|
}
|
|
42997
43088
|
}
|
|
@@ -42999,10 +43090,10 @@ async function replayPendingSlackMarkers() {
|
|
|
42999
43090
|
const entries = [];
|
|
43000
43091
|
for (const name of filenames) {
|
|
43001
43092
|
if (!name.endsWith(".json") || name.endsWith(".tmp")) continue;
|
|
43002
|
-
const fullPath =
|
|
43093
|
+
const fullPath = join18(SLACK_PENDING_INBOUND_DIR, name);
|
|
43003
43094
|
let marker;
|
|
43004
43095
|
try {
|
|
43005
|
-
marker = JSON.parse(
|
|
43096
|
+
marker = JSON.parse(readFileSync18(fullPath, "utf-8"));
|
|
43006
43097
|
} catch {
|
|
43007
43098
|
continue;
|
|
43008
43099
|
}
|
|
@@ -43452,6 +43543,23 @@ async function connectSocketMode() {
|
|
|
43452
43543
|
}).catch((err) => {
|
|
43453
43544
|
process.stderr.write(
|
|
43454
43545
|
`slack-channel(${AGENT_CODE_NAME}): maintenance notice failed: ${err.message}
|
|
43546
|
+
`
|
|
43547
|
+
);
|
|
43548
|
+
});
|
|
43549
|
+
return;
|
|
43550
|
+
}
|
|
43551
|
+
if (!isBot && readAccountEnforcementLevel({ codeName: AGENT_CODE_NAME }) === "mute") {
|
|
43552
|
+
process.stderr.write(
|
|
43553
|
+
`slack-channel(${AGENT_CODE_NAME}): account muted \u2014 notice, no dispatch (channel=${redactSlackId(evt.channel)})
|
|
43554
|
+
`
|
|
43555
|
+
);
|
|
43556
|
+
await maybeSendAccountMuteNotice({
|
|
43557
|
+
channel: evt.channel,
|
|
43558
|
+
senderId: evt.user,
|
|
43559
|
+
threadTs: evt.thread_ts
|
|
43560
|
+
}).catch((err) => {
|
|
43561
|
+
process.stderr.write(
|
|
43562
|
+
`slack-channel(${AGENT_CODE_NAME}): account-mute notice failed: ${err.message}
|
|
43455
43563
|
`
|
|
43456
43564
|
);
|
|
43457
43565
|
});
|
|
@@ -43582,7 +43690,7 @@ async function connectSocketMode() {
|
|
|
43582
43690
|
let paneLogFreshAgeMs = null;
|
|
43583
43691
|
if (SLACK_AGENT_DIR) {
|
|
43584
43692
|
try {
|
|
43585
|
-
const paneMtimeMs = statSync3(
|
|
43693
|
+
const paneMtimeMs = statSync3(join18(SLACK_AGENT_DIR, "pane.log")).mtimeMs;
|
|
43586
43694
|
paneLogFreshAgeMs = Math.max(0, Date.now() - paneMtimeMs);
|
|
43587
43695
|
} catch {
|
|
43588
43696
|
}
|