@integrity-labs/agt-cli 0.28.717 → 0.28.718
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 +5 -5
- package/dist/{chunk-KVR5KNED.js → chunk-7LH3SVAD.js} +7 -2
- package/dist/chunk-7LH3SVAD.js.map +1 -0
- package/dist/{chunk-XSBRGOGL.js → chunk-EEZHSNQ2.js} +4 -4
- package/dist/{chunk-JN4D7534.js → chunk-FNALM4HG.js} +120 -19
- package/dist/chunk-FNALM4HG.js.map +1 -0
- package/dist/{claude-pair-runtime-KWBCSCZO.js → claude-pair-runtime-PDG74SAT.js} +2 -2
- package/dist/lib/manager-worker.js +78 -16
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +6 -1
- package/dist/mcp/index.js +6 -1
- package/dist/mcp/origami.js +6 -1
- package/dist/mcp/slack-channel.js +6 -1
- package/dist/mcp/telegram-channel.js +6 -1
- package/dist/{persistent-session-GB3D5OIA.js → persistent-session-2AWYIUCX.js} +7 -3
- package/dist/{responsiveness-probe-TDZDQXBU.js → responsiveness-probe-JQS4WA2L.js} +3 -3
- package/dist/{session-auth-dead-CPY4UZI7.js → session-auth-dead-VBMZW4GG.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-JN4D7534.js.map +0 -1
- package/dist/chunk-KVR5KNED.js.map +0 -1
- /package/dist/{chunk-XSBRGOGL.js.map → chunk-EEZHSNQ2.js.map} +0 -0
- /package/dist/{claude-pair-runtime-KWBCSCZO.js.map → claude-pair-runtime-PDG74SAT.js.map} +0 -0
- /package/dist/{persistent-session-GB3D5OIA.js.map → persistent-session-2AWYIUCX.js.map} +0 -0
- /package/dist/{responsiveness-probe-TDZDQXBU.js.map → responsiveness-probe-JQS4WA2L.js.map} +0 -0
- /package/dist/{session-auth-dead-CPY4UZI7.js.map → session-auth-dead-VBMZW4GG.js.map} +0 -0
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
parseEnvFileEntries,
|
|
14
14
|
parseEnvIntegrations,
|
|
15
15
|
shellQuote
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FNALM4HG.js";
|
|
17
17
|
import {
|
|
18
18
|
BIND_FAILURE_QUARANTINE_THRESHOLD,
|
|
19
19
|
INTEGRATIONS_SECTION_END,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
sessionTranscriptDir,
|
|
63
63
|
worseConnectivityOutcome,
|
|
64
64
|
wrapScheduledTaskPrompt
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-7LH3SVAD.js";
|
|
66
66
|
import {
|
|
67
67
|
parsePsRows
|
|
68
68
|
} from "./chunk-XWVM4KPK.js";
|
|
@@ -6428,7 +6428,7 @@ function exchangeFailureKind(err) {
|
|
|
6428
6428
|
}
|
|
6429
6429
|
|
|
6430
6430
|
// src/lib/api-client.ts
|
|
6431
|
-
var agtCliVersion = true ? "0.28.
|
|
6431
|
+
var agtCliVersion = true ? "0.28.718" : "dev";
|
|
6432
6432
|
var lastConfigHash = null;
|
|
6433
6433
|
function setConfigHash(hash) {
|
|
6434
6434
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -10470,4 +10470,4 @@ export {
|
|
|
10470
10470
|
managerInstallSystemUnitCommand,
|
|
10471
10471
|
managerUninstallSystemUnitCommand
|
|
10472
10472
|
};
|
|
10473
|
-
//# sourceMappingURL=chunk-
|
|
10473
|
+
//# sourceMappingURL=chunk-EEZHSNQ2.js.map
|
|
@@ -17,16 +17,16 @@ import {
|
|
|
17
17
|
rotateDailySession,
|
|
18
18
|
sessionFileExists,
|
|
19
19
|
todayLocalIso
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7LH3SVAD.js";
|
|
21
21
|
import {
|
|
22
22
|
reapOrphanChannelMcps
|
|
23
23
|
} from "./chunk-XWVM4KPK.js";
|
|
24
24
|
|
|
25
25
|
// src/lib/persistent-session.ts
|
|
26
26
|
import { spawn as spawn2, execSync as execSync2, execFileSync as execFileSync3 } from "child_process";
|
|
27
|
-
import { join as join6, dirname as
|
|
27
|
+
import { join as join6, dirname as dirname5 } from "path";
|
|
28
28
|
import { homedir as homedir5, platform, userInfo as userInfo2 } from "os";
|
|
29
|
-
import { existsSync as existsSync5, readFileSync as readFileSync6, readdirSync as readdirSync2, writeFileSync as writeFileSync4, appendFileSync as appendFileSync2, mkdirSync as
|
|
29
|
+
import { existsSync as existsSync5, readFileSync as readFileSync6, readdirSync as readdirSync2, writeFileSync as writeFileSync4, appendFileSync as appendFileSync2, mkdirSync as mkdirSync5, chmodSync as chmodSync3, copyFileSync, rmSync as rmSync3, lstatSync as lstatSync3, realpathSync as realpathSync2, renameSync as renameSync2, statSync } from "fs";
|
|
30
30
|
|
|
31
31
|
// src/lib/mcp-sanitize.ts
|
|
32
32
|
import { readFileSync, writeFileSync } from "fs";
|
|
@@ -2515,11 +2515,97 @@ function probeClaudeProcessInTmux(tmuxSession) {
|
|
|
2515
2515
|
}
|
|
2516
2516
|
|
|
2517
2517
|
// ../../packages/core/dist/provisioning/frameworks/claudecode/agent-tmpdir.js
|
|
2518
|
-
import {
|
|
2518
|
+
import { closeSync, lstatSync as lstatSync2, mkdirSync as mkdirSync4, openSync, renameSync } from "fs";
|
|
2519
|
+
import { dirname as dirname4, join as join5 } from "path";
|
|
2519
2520
|
function agentTmpDirFor(agentDir2) {
|
|
2520
2521
|
return join5(agentDir2, "scratch", "tmp");
|
|
2521
2522
|
}
|
|
2522
2523
|
var CLAUDE_CODE_TMPDIR_ENV = "CLAUDE_CODE_TMPDIR";
|
|
2524
|
+
function ensureAgentTmpDir(agentDir2, now = /* @__PURE__ */ new Date()) {
|
|
2525
|
+
const path = agentTmpDirFor(agentDir2);
|
|
2526
|
+
const scratchDir = dirname4(path);
|
|
2527
|
+
try {
|
|
2528
|
+
if (lstatSync2(scratchDir).isSymbolicLink()) {
|
|
2529
|
+
return {
|
|
2530
|
+
outcome: "failed",
|
|
2531
|
+
path,
|
|
2532
|
+
error: `${scratchDir} is a symlink; refusing to create a temp directory through it (agent temp files would land outside the agent tree)`
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2535
|
+
} catch (err) {
|
|
2536
|
+
if (err?.code !== "ENOENT") {
|
|
2537
|
+
return { outcome: "failed", path, error: describeError(err) };
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
let existing;
|
|
2541
|
+
try {
|
|
2542
|
+
existing = lstatSync2(path);
|
|
2543
|
+
} catch (err) {
|
|
2544
|
+
if (err?.code !== "ENOENT") {
|
|
2545
|
+
return { outcome: "failed", path, error: describeError(err) };
|
|
2546
|
+
}
|
|
2547
|
+
existing = null;
|
|
2548
|
+
}
|
|
2549
|
+
if (existing?.isDirectory())
|
|
2550
|
+
return { outcome: "ready", path };
|
|
2551
|
+
let displacedTo = null;
|
|
2552
|
+
if (existing) {
|
|
2553
|
+
const kind = describeEntryKind(existing);
|
|
2554
|
+
try {
|
|
2555
|
+
displacedTo = reserveDisplacementPath(path, now);
|
|
2556
|
+
renameSync(path, displacedTo);
|
|
2557
|
+
} catch (err) {
|
|
2558
|
+
return { outcome: "failed", path, error: describeError(err) };
|
|
2559
|
+
}
|
|
2560
|
+
try {
|
|
2561
|
+
mkdirSync4(path, { recursive: true });
|
|
2562
|
+
} catch (err) {
|
|
2563
|
+
return { outcome: "failed", path, error: describeError(err) };
|
|
2564
|
+
}
|
|
2565
|
+
return { outcome: "displaced", path, displacedTo, kind };
|
|
2566
|
+
}
|
|
2567
|
+
try {
|
|
2568
|
+
mkdirSync4(path, { recursive: true });
|
|
2569
|
+
} catch (err) {
|
|
2570
|
+
return { outcome: "failed", path, error: describeError(err) };
|
|
2571
|
+
}
|
|
2572
|
+
return { outcome: "created", path };
|
|
2573
|
+
}
|
|
2574
|
+
function describeEntryKind(stats) {
|
|
2575
|
+
if (stats.isSymbolicLink())
|
|
2576
|
+
return "symlink";
|
|
2577
|
+
if (stats.isFile())
|
|
2578
|
+
return "regular file";
|
|
2579
|
+
if (stats.isFIFO())
|
|
2580
|
+
return "fifo";
|
|
2581
|
+
if (stats.isSocket())
|
|
2582
|
+
return "socket";
|
|
2583
|
+
if (stats.isBlockDevice())
|
|
2584
|
+
return "block device";
|
|
2585
|
+
if (stats.isCharacterDevice())
|
|
2586
|
+
return "character device";
|
|
2587
|
+
return "non-directory";
|
|
2588
|
+
}
|
|
2589
|
+
function reserveDisplacementPath(path, now) {
|
|
2590
|
+
const stamp = now.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
|
|
2591
|
+
const base = `${path}.displaced-${stamp}`;
|
|
2592
|
+
for (let n = 1; n <= 100; n += 1) {
|
|
2593
|
+
const candidate = n === 1 ? base : `${base}-${n}`;
|
|
2594
|
+
try {
|
|
2595
|
+
closeSync(openSync(candidate, "wx"));
|
|
2596
|
+
return candidate;
|
|
2597
|
+
} catch (err) {
|
|
2598
|
+
if (err?.code !== "EEXIST")
|
|
2599
|
+
throw err;
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
throw new Error(`no free displacement name beside ${path}`);
|
|
2603
|
+
}
|
|
2604
|
+
function describeError(err) {
|
|
2605
|
+
const code = err?.code;
|
|
2606
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2607
|
+
return code ? `${code}: ${msg}` : msg;
|
|
2608
|
+
}
|
|
2523
2609
|
|
|
2524
2610
|
// src/lib/claude-dialogs.ts
|
|
2525
2611
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -3076,7 +3162,7 @@ function syncClaudeCredsToRoot() {
|
|
|
3076
3162
|
const sourceFilename = sourcePath.endsWith("credentials.json") && !sourcePath.endsWith(".credentials.json") ? "credentials.json" : ".credentials.json";
|
|
3077
3163
|
const targetPath = join6(targetDir, sourceFilename);
|
|
3078
3164
|
try {
|
|
3079
|
-
if (!existsSync5(targetDir))
|
|
3165
|
+
if (!existsSync5(targetDir)) mkdirSync5(targetDir, { recursive: true, mode: 448 });
|
|
3080
3166
|
copyFileSync(sourcePath, targetPath);
|
|
3081
3167
|
chmodSync3(targetPath, 384);
|
|
3082
3168
|
return true;
|
|
@@ -3158,7 +3244,7 @@ function egressAllowlistHostPath(codeName, homeDir) {
|
|
|
3158
3244
|
}
|
|
3159
3245
|
function writeEgressAllowlist(codeName, domains, homeDir) {
|
|
3160
3246
|
const p = egressAllowlistHostPath(codeName, homeDir);
|
|
3161
|
-
|
|
3247
|
+
mkdirSync5(dirname5(p), { recursive: true });
|
|
3162
3248
|
writeFileSync4(p, domains.join("\n") + "\n", { mode: 420 });
|
|
3163
3249
|
return p;
|
|
3164
3250
|
}
|
|
@@ -3335,7 +3421,7 @@ function writePersistentClaudeWrapper(args) {
|
|
|
3335
3421
|
wrapperLines.push(
|
|
3336
3422
|
`exec ${JSON.stringify(claudeBin)} ${initPromptArg}${claudeArgsJoined}`
|
|
3337
3423
|
);
|
|
3338
|
-
|
|
3424
|
+
mkdirSync5(join6(projectDir, ".claude"), { recursive: true });
|
|
3339
3425
|
writeFileSync4(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
|
|
3340
3426
|
chmodSync3(wrapperPath, 448);
|
|
3341
3427
|
return wrapperPath;
|
|
@@ -3414,12 +3500,12 @@ function paneSinkCommand(logPath, log2) {
|
|
|
3414
3500
|
}
|
|
3415
3501
|
if (paneRedactorPerlAvailable) {
|
|
3416
3502
|
try {
|
|
3417
|
-
|
|
3503
|
+
mkdirSync5(dirname5(PANE_REDACTOR_SCRIPT), { recursive: true });
|
|
3418
3504
|
const tmp = `${PANE_REDACTOR_SCRIPT}.${randomUUID()}.tmp`;
|
|
3419
3505
|
try {
|
|
3420
3506
|
writeFileSync4(tmp, buildRedactorProgram(), { encoding: "utf-8", mode: 448 });
|
|
3421
3507
|
chmodSync3(tmp, 448);
|
|
3422
|
-
|
|
3508
|
+
renameSync2(tmp, PANE_REDACTOR_SCRIPT);
|
|
3423
3509
|
} catch (e) {
|
|
3424
3510
|
try {
|
|
3425
3511
|
rmSync3(tmp, { force: true });
|
|
@@ -3441,7 +3527,7 @@ function paneSinkCommand(logPath, log2) {
|
|
|
3441
3527
|
function setupPaneLog2(tmuxSession, codeName, log2) {
|
|
3442
3528
|
const logPath = paneLogPath(codeName);
|
|
3443
3529
|
try {
|
|
3444
|
-
|
|
3530
|
+
mkdirSync5(dirname5(logPath), { recursive: true });
|
|
3445
3531
|
appendFileSync2(
|
|
3446
3532
|
logPath,
|
|
3447
3533
|
`
|
|
@@ -3463,13 +3549,13 @@ function rotatePaneLogForDayRollover(codeName, log2, agentTimezone, now = /* @__
|
|
|
3463
3549
|
if (!existsSync5(logPath)) return null;
|
|
3464
3550
|
if (statSync(logPath).size === 0) return null;
|
|
3465
3551
|
const stamp = todayLocalIso(now, agentTimezone ?? void 0).replace(/-/g, "");
|
|
3466
|
-
const dir =
|
|
3552
|
+
const dir = dirname5(logPath);
|
|
3467
3553
|
let target = join6(dir, `pane.log-${stamp}`);
|
|
3468
3554
|
if (existsSync5(target)) {
|
|
3469
3555
|
const hhmmss = now.toISOString().slice(11, 19).replace(/:/g, "");
|
|
3470
3556
|
target = join6(dir, `pane.log-${stamp}-${hhmmss}`);
|
|
3471
3557
|
}
|
|
3472
|
-
|
|
3558
|
+
renameSync2(logPath, target);
|
|
3473
3559
|
writeFileSync4(logPath, "", "utf-8");
|
|
3474
3560
|
const rotated = target.slice(dir.length + 1);
|
|
3475
3561
|
log2(`[persistent-session] Rotated pane.log for '${codeName}' \u2192 ${rotated} (day-rollover)`);
|
|
@@ -3495,6 +3581,7 @@ function readPaneLogTail(codeName, lines = PANE_TAIL_LINES) {
|
|
|
3495
3581
|
function detectFailureSignature(tail) {
|
|
3496
3582
|
if (!tail) return "unknown";
|
|
3497
3583
|
if (/Session ID .* is already in use/i.test(tail)) return "session_id_in_use";
|
|
3584
|
+
if (/ENOTDIR[^\n]*mkdir/i.test(tail)) return "tmpdir_not_a_directory";
|
|
3498
3585
|
return "unknown";
|
|
3499
3586
|
}
|
|
3500
3587
|
function prepareForRespawn(codeName) {
|
|
@@ -3571,9 +3658,12 @@ function readDirectChatSessionState(agentId) {
|
|
|
3571
3658
|
}
|
|
3572
3659
|
function writeDirectChatSessionState(agentId, state) {
|
|
3573
3660
|
const p = directChatSessionStatePath(agentId);
|
|
3574
|
-
|
|
3661
|
+
mkdirSync5(dirname5(p), { recursive: true });
|
|
3575
3662
|
writeFileSync4(p, JSON.stringify(state));
|
|
3576
3663
|
}
|
|
3664
|
+
function spawnBackoffMs(restartCount) {
|
|
3665
|
+
return Math.min(5e3 * Math.pow(2, restartCount), 6e4);
|
|
3666
|
+
}
|
|
3577
3667
|
function startPersistentSession(config) {
|
|
3578
3668
|
const existing = sessions2.get(config.codeName);
|
|
3579
3669
|
if (existing && existing.status === "running") {
|
|
@@ -3581,8 +3671,7 @@ function startPersistentSession(config) {
|
|
|
3581
3671
|
}
|
|
3582
3672
|
const restartCount = existing?.restartCount ?? 0;
|
|
3583
3673
|
if (existing?.status === "crashed" && existing.startedAt) {
|
|
3584
|
-
|
|
3585
|
-
if (Date.now() - existing.startedAt < backoffMs) {
|
|
3674
|
+
if (Date.now() - existing.startedAt < spawnBackoffMs(restartCount)) {
|
|
3586
3675
|
return existing;
|
|
3587
3676
|
}
|
|
3588
3677
|
}
|
|
@@ -3609,6 +3698,16 @@ function spawnSession(config, session) {
|
|
|
3609
3698
|
log2(
|
|
3610
3699
|
`[persistent-session] Starting tmux session '${tmuxSession}' for '${codeName}' (auth=${openRouterMode ? "openrouter" : claudeAuthMode})`
|
|
3611
3700
|
);
|
|
3701
|
+
const tmpDirOutcome = ensureAgentTmpDir(dirname5(config.projectDir));
|
|
3702
|
+
if (tmpDirOutcome.outcome === "displaced") {
|
|
3703
|
+
log2(
|
|
3704
|
+
`[persistent-session] agent temp path for '${codeName}' was a ${tmpDirOutcome.kind}, not a directory: moved ${tmpDirOutcome.path} -> ${tmpDirOutcome.displacedTo} and recreated it as a directory. Claude Code would otherwise have failed at startup with ENOTDIR on every spawn. The displaced content is PRESERVED, not deleted - an agent may have written something it still needs.`
|
|
3705
|
+
);
|
|
3706
|
+
} else if (tmpDirOutcome.outcome === "failed") {
|
|
3707
|
+
log2(
|
|
3708
|
+
`[persistent-session] WARN: could not prepare agent temp path ${tmpDirOutcome.path} for '${codeName}': ${tmpDirOutcome.error} - Claude Code may fail at startup with ENOTDIR/EACCES on this path`
|
|
3709
|
+
);
|
|
3710
|
+
}
|
|
3612
3711
|
try {
|
|
3613
3712
|
sanitizeMcpJson(mcpConfigPath, apiHost);
|
|
3614
3713
|
try {
|
|
@@ -3705,7 +3804,7 @@ function spawnSession(config, session) {
|
|
|
3705
3804
|
tmuxSessionEnvArgs.push("-e", `AGT_AGENT_ID=${config.agentId}`);
|
|
3706
3805
|
tmuxSessionEnvArgs.push(
|
|
3707
3806
|
"-e",
|
|
3708
|
-
`${CLAUDE_CODE_TMPDIR_ENV}=${agentTmpDirFor(
|
|
3807
|
+
`${CLAUDE_CODE_TMPDIR_ENV}=${agentTmpDirFor(dirname5(config.projectDir))}`
|
|
3709
3808
|
);
|
|
3710
3809
|
if (config.perAgentApiKey) {
|
|
3711
3810
|
tmuxSessionEnvArgs.push("-e", `AGT_API_KEY=${config.perAgentApiKey}`);
|
|
@@ -3930,7 +4029,6 @@ function spawnSession(config, session) {
|
|
|
3930
4029
|
});
|
|
3931
4030
|
session.startedAt = Date.now();
|
|
3932
4031
|
session.status = "running";
|
|
3933
|
-
session.restartCount = 0;
|
|
3934
4032
|
} catch (err) {
|
|
3935
4033
|
log2(`[persistent-session] Failed to start session for '${codeName}': ${err.message}`);
|
|
3936
4034
|
session.status = "crashed";
|
|
@@ -4349,6 +4447,7 @@ function isSessionHealthy(codeName) {
|
|
|
4349
4447
|
zombieProbeCache.delete(codeName);
|
|
4350
4448
|
return false;
|
|
4351
4449
|
}
|
|
4450
|
+
session.restartCount = 0;
|
|
4352
4451
|
}
|
|
4353
4452
|
return true;
|
|
4354
4453
|
}
|
|
@@ -4500,7 +4599,7 @@ async function stopAllSessionsAndWait(log2, opts) {
|
|
|
4500
4599
|
}
|
|
4501
4600
|
function resolveRealAgentPath(codeNamePath) {
|
|
4502
4601
|
try {
|
|
4503
|
-
if (
|
|
4602
|
+
if (lstatSync3(codeNamePath).isSymbolicLink()) {
|
|
4504
4603
|
return realpathSync2(codeNamePath);
|
|
4505
4604
|
}
|
|
4506
4605
|
} catch {
|
|
@@ -4568,6 +4667,7 @@ export {
|
|
|
4568
4667
|
paneLogPath,
|
|
4569
4668
|
rotatePaneLogForDayRollover,
|
|
4570
4669
|
readPaneLogTail,
|
|
4670
|
+
detectFailureSignature,
|
|
4571
4671
|
prepareForRespawn,
|
|
4572
4672
|
rotateSessionForWedge,
|
|
4573
4673
|
getLastFailureContext,
|
|
@@ -4576,6 +4676,7 @@ export {
|
|
|
4576
4676
|
directChatSessionStatePath,
|
|
4577
4677
|
readDirectChatSessionState,
|
|
4578
4678
|
writeDirectChatSessionState,
|
|
4679
|
+
spawnBackoffMs,
|
|
4579
4680
|
startPersistentSession,
|
|
4580
4681
|
SEND_KEYS_ENTER_DELAY_MS,
|
|
4581
4682
|
sendToAgent,
|
|
@@ -4593,4 +4694,4 @@ export {
|
|
|
4593
4694
|
stopAllSessionsAndWait,
|
|
4594
4695
|
getProjectDir
|
|
4595
4696
|
};
|
|
4596
|
-
//# sourceMappingURL=chunk-
|
|
4697
|
+
//# sourceMappingURL=chunk-FNALM4HG.js.map
|