@integrity-labs/agt-cli 0.28.82 → 0.28.83
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.
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
requireHost,
|
|
29
29
|
safeWriteJsonAtomic,
|
|
30
30
|
setConfigHash
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-WFIKSR3G.js";
|
|
32
32
|
import {
|
|
33
33
|
getProjectDir as getProjectDir2,
|
|
34
34
|
getReadyTasks,
|
|
@@ -6803,7 +6803,7 @@ var cachedMaintenanceWindow = null;
|
|
|
6803
6803
|
var lastVersionCheckAt = 0;
|
|
6804
6804
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
6805
6805
|
var lastResponsivenessProbeAt = 0;
|
|
6806
|
-
var agtCliVersion = true ? "0.28.
|
|
6806
|
+
var agtCliVersion = true ? "0.28.83" : "dev";
|
|
6807
6807
|
function resolveBrewPath(execFileSync4) {
|
|
6808
6808
|
try {
|
|
6809
6809
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -15518,15 +15518,15 @@ import {
|
|
|
15518
15518
|
createWriteStream,
|
|
15519
15519
|
existsSync as existsSync7,
|
|
15520
15520
|
ftruncateSync,
|
|
15521
|
-
mkdirSync as
|
|
15521
|
+
mkdirSync as mkdirSync7,
|
|
15522
15522
|
openSync,
|
|
15523
15523
|
readFileSync as readFileSync9,
|
|
15524
15524
|
readdirSync as readdirSync3,
|
|
15525
|
-
renameSync as
|
|
15525
|
+
renameSync as renameSync4,
|
|
15526
15526
|
statSync as statSync2,
|
|
15527
15527
|
unlinkSync as unlinkSync5,
|
|
15528
15528
|
watch,
|
|
15529
|
-
writeFileSync as
|
|
15529
|
+
writeFileSync as writeFileSync8,
|
|
15530
15530
|
writeSync
|
|
15531
15531
|
} from "fs";
|
|
15532
15532
|
import { basename, join as join7, resolve as resolve2 } from "path";
|
|
@@ -15812,9 +15812,25 @@ async function runOrRetry(fn, opts) {
|
|
|
15812
15812
|
}
|
|
15813
15813
|
}
|
|
15814
15814
|
|
|
15815
|
-
// src/
|
|
15816
|
-
import {
|
|
15815
|
+
// src/turn-initiator-marker.ts
|
|
15816
|
+
import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, renameSync as renameSync2 } from "fs";
|
|
15817
15817
|
import { dirname as dirname4 } from "path";
|
|
15818
|
+
function writeTurnInitiatorMarker(input) {
|
|
15819
|
+
const file = process.env["AGT_TURN_INITIATOR_FILE"];
|
|
15820
|
+
if (!file || !input.sender_id) return;
|
|
15821
|
+
try {
|
|
15822
|
+
mkdirSync4(dirname4(file), { recursive: true });
|
|
15823
|
+
const marker = { ...input, ts: Date.now() };
|
|
15824
|
+
const tmp = `${file}.tmp`;
|
|
15825
|
+
writeFileSync5(tmp, JSON.stringify(marker), "utf8");
|
|
15826
|
+
renameSync2(tmp, file);
|
|
15827
|
+
} catch {
|
|
15828
|
+
}
|
|
15829
|
+
}
|
|
15830
|
+
|
|
15831
|
+
// src/slack-bot-photo.ts
|
|
15832
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
15833
|
+
import { dirname as dirname5 } from "path";
|
|
15818
15834
|
async function applyBotPhoto(opts) {
|
|
15819
15835
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
15820
15836
|
const log = opts.log ?? ((m) => {
|
|
@@ -15864,8 +15880,8 @@ async function applyBotPhoto(opts) {
|
|
|
15864
15880
|
}
|
|
15865
15881
|
if (markerPath) {
|
|
15866
15882
|
try {
|
|
15867
|
-
|
|
15868
|
-
|
|
15883
|
+
mkdirSync5(dirname5(markerPath), { recursive: true, mode: 448 });
|
|
15884
|
+
writeFileSync6(markerPath, avatarUrl, { mode: 384 });
|
|
15869
15885
|
} catch {
|
|
15870
15886
|
}
|
|
15871
15887
|
}
|
|
@@ -16648,11 +16664,11 @@ function createSlackBotUserIdClient(args) {
|
|
|
16648
16664
|
// src/mcp-spawn-lock.ts
|
|
16649
16665
|
import {
|
|
16650
16666
|
existsSync as existsSync6,
|
|
16651
|
-
mkdirSync as
|
|
16667
|
+
mkdirSync as mkdirSync6,
|
|
16652
16668
|
readFileSync as readFileSync8,
|
|
16653
|
-
renameSync as
|
|
16669
|
+
renameSync as renameSync3,
|
|
16654
16670
|
unlinkSync as unlinkSync4,
|
|
16655
|
-
writeFileSync as
|
|
16671
|
+
writeFileSync as writeFileSync7
|
|
16656
16672
|
} from "fs";
|
|
16657
16673
|
import { join as join6 } from "path";
|
|
16658
16674
|
function defaultIsPidAlive(pid) {
|
|
@@ -16682,11 +16698,11 @@ function acquireMcpSpawnLock(args) {
|
|
|
16682
16698
|
return { kind: "blocked", path, holder: existing };
|
|
16683
16699
|
}
|
|
16684
16700
|
}
|
|
16685
|
-
|
|
16701
|
+
mkdirSync6(agentDir, { recursive: true, mode: 448 });
|
|
16686
16702
|
const tmpPath = `${path}.${selfPid}.tmp`;
|
|
16687
16703
|
const payload = { pid: selfPid, started_at: now() };
|
|
16688
|
-
|
|
16689
|
-
|
|
16704
|
+
writeFileSync7(tmpPath, JSON.stringify(payload), { mode: 384 });
|
|
16705
|
+
renameSync3(tmpPath, path);
|
|
16690
16706
|
return { kind: "acquired", path };
|
|
16691
16707
|
}
|
|
16692
16708
|
function releaseMcpSpawnLock(lockPath, opts = {}) {
|
|
@@ -16983,8 +16999,8 @@ function writeSlackPendingInboundMarker(channel, threadTs, messageTs, undelivera
|
|
|
16983
16999
|
...payload ? { payload } : {}
|
|
16984
17000
|
};
|
|
16985
17001
|
try {
|
|
16986
|
-
|
|
16987
|
-
|
|
17002
|
+
mkdirSync7(SLACK_PENDING_INBOUND_DIR, { recursive: true, mode: 448 });
|
|
17003
|
+
writeFileSync8(path, JSON.stringify(marker), { mode: 384 });
|
|
16988
17004
|
} catch (err) {
|
|
16989
17005
|
process.stderr.write(
|
|
16990
17006
|
`slack-channel(${AGENT_CODE_NAME}): pending-inbound marker write failed: ${err.message}
|
|
@@ -17257,7 +17273,7 @@ async function processSlackRecoveryOutboxFile(filename) {
|
|
|
17257
17273
|
`
|
|
17258
17274
|
);
|
|
17259
17275
|
try {
|
|
17260
|
-
|
|
17276
|
+
renameSync4(fullPath, `${fullPath}.parse-error.poison`);
|
|
17261
17277
|
} catch {
|
|
17262
17278
|
}
|
|
17263
17279
|
return;
|
|
@@ -17268,7 +17284,7 @@ async function processSlackRecoveryOutboxFile(filename) {
|
|
|
17268
17284
|
`
|
|
17269
17285
|
);
|
|
17270
17286
|
try {
|
|
17271
|
-
|
|
17287
|
+
renameSync4(fullPath, `${fullPath}.malformed.poison`);
|
|
17272
17288
|
} catch {
|
|
17273
17289
|
}
|
|
17274
17290
|
return;
|
|
@@ -17326,7 +17342,7 @@ ${payload.text}`;
|
|
|
17326
17342
|
const next = slackNextRetryName(filename);
|
|
17327
17343
|
if (next) {
|
|
17328
17344
|
try {
|
|
17329
|
-
|
|
17345
|
+
renameSync4(fullPath, join7(SLACK_RECOVERY_OUTBOX_DIR, next.next));
|
|
17330
17346
|
if (next.attempt >= SLACK_MAX_RECOVERY_ATTEMPTS) {
|
|
17331
17347
|
process.stderr.write(
|
|
17332
17348
|
`slack-channel(${AGENT_CODE_NAME}): ghost-reply recovery exhausted retries \u2014 moved to ${next.next}
|
|
@@ -17377,7 +17393,7 @@ function scanSlackRecoveryRetries() {
|
|
|
17377
17393
|
function startSlackRecoveryOutboxWatcher() {
|
|
17378
17394
|
if (!SLACK_RECOVERY_OUTBOX_DIR) return;
|
|
17379
17395
|
try {
|
|
17380
|
-
|
|
17396
|
+
mkdirSync7(SLACK_RECOVERY_OUTBOX_DIR, { recursive: true, mode: 448 });
|
|
17381
17397
|
} catch (err) {
|
|
17382
17398
|
process.stderr.write(
|
|
17383
17399
|
`slack-channel(${AGENT_CODE_NAME}): recovery outbox mkdir failed: ${err.message}
|
|
@@ -18334,7 +18350,7 @@ async function handleSlashCommandEnvelope(payload) {
|
|
|
18334
18350
|
}
|
|
18335
18351
|
try {
|
|
18336
18352
|
if (!existsSync7(RESTART_FLAGS_DIR)) {
|
|
18337
|
-
|
|
18353
|
+
mkdirSync7(RESTART_FLAGS_DIR, { recursive: true });
|
|
18338
18354
|
}
|
|
18339
18355
|
const flagPath = join7(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
18340
18356
|
writeSlackRestartConfirm(
|
|
@@ -18354,8 +18370,8 @@ async function handleSlashCommandEnvelope(payload) {
|
|
|
18354
18370
|
}
|
|
18355
18371
|
};
|
|
18356
18372
|
const tmpPath = `${flagPath}.${process.pid}.${randomUUID2()}.tmp`;
|
|
18357
|
-
|
|
18358
|
-
|
|
18373
|
+
writeFileSync8(tmpPath, JSON.stringify(flag) + "\n", "utf8");
|
|
18374
|
+
renameSync4(tmpPath, flagPath);
|
|
18359
18375
|
process.stderr.write(
|
|
18360
18376
|
`slack-channel(${codeName}): /restart slash-command queued from channel ${hashChannelId(payload.channel_id)}
|
|
18361
18377
|
`
|
|
@@ -18472,7 +18488,7 @@ async function handleRestartCommand(opts) {
|
|
|
18472
18488
|
const codeName = AGENT_CODE_NAME ?? "unknown";
|
|
18473
18489
|
try {
|
|
18474
18490
|
if (!existsSync7(RESTART_FLAGS_DIR)) {
|
|
18475
|
-
|
|
18491
|
+
mkdirSync7(RESTART_FLAGS_DIR, { recursive: true });
|
|
18476
18492
|
}
|
|
18477
18493
|
const flagPath = join7(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
18478
18494
|
writeSlackRestartConfirm(
|
|
@@ -18493,8 +18509,8 @@ async function handleRestartCommand(opts) {
|
|
|
18493
18509
|
}
|
|
18494
18510
|
};
|
|
18495
18511
|
const tmpPath = `${flagPath}.${process.pid}.${randomUUID2()}.tmp`;
|
|
18496
|
-
|
|
18497
|
-
|
|
18512
|
+
writeFileSync8(tmpPath, JSON.stringify(flag) + "\n", "utf8");
|
|
18513
|
+
renameSync4(tmpPath, flagPath);
|
|
18498
18514
|
process.stderr.write(
|
|
18499
18515
|
`slack-channel(${codeName}): /restart queued from channel ${hashChannelId(opts.channel)}
|
|
18500
18516
|
`
|
|
@@ -18637,7 +18653,7 @@ var slackStderrLogStream = null;
|
|
|
18637
18653
|
if (AGENT_CODE_NAME) {
|
|
18638
18654
|
try {
|
|
18639
18655
|
const logDir = join7(homedir3(), ".augmented", AGENT_CODE_NAME);
|
|
18640
|
-
|
|
18656
|
+
mkdirSync7(logDir, { recursive: true });
|
|
18641
18657
|
slackStderrLogStream = createWriteStream(join7(logDir, "slack-channel-stderr.log"), {
|
|
18642
18658
|
flags: "a",
|
|
18643
18659
|
mode: 384
|
|
@@ -19870,8 +19886,8 @@ async function downloadSlackFile(fileId, codeName) {
|
|
|
19870
19886
|
if (!isPathInside(savedPath, dir)) {
|
|
19871
19887
|
throw new Error(`refusing to write ${savedPath} outside ${dir}`);
|
|
19872
19888
|
}
|
|
19873
|
-
|
|
19874
|
-
|
|
19889
|
+
mkdirSync7(dir, { recursive: true });
|
|
19890
|
+
writeFileSync8(savedPath, bytes, { mode: 384 });
|
|
19875
19891
|
try {
|
|
19876
19892
|
chmodSync(savedPath, 384);
|
|
19877
19893
|
} catch {
|
|
@@ -20487,6 +20503,14 @@ async function connectSocketMode() {
|
|
|
20487
20503
|
if (channel && ts && armMarker) {
|
|
20488
20504
|
attachSlackReplayPayload(channel, threadTs, ts, replayPayload);
|
|
20489
20505
|
}
|
|
20506
|
+
if (!isFromBot && evt.user && channel) {
|
|
20507
|
+
writeTurnInitiatorMarker({
|
|
20508
|
+
channel: "slack",
|
|
20509
|
+
sender_id: evt.user,
|
|
20510
|
+
sender_name: userName,
|
|
20511
|
+
channel_ref: threadTs
|
|
20512
|
+
});
|
|
20513
|
+
}
|
|
20490
20514
|
await mcp.notification({
|
|
20491
20515
|
method: "notifications/claude/channel",
|
|
20492
20516
|
params: replayPayload
|