@integrity-labs/agt-cli 0.28.440 → 0.28.442
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-V3G7G4QM.js → chunk-JIZ6Z6EX.js} +3 -3
- package/dist/{chunk-R6GVWACQ.js → chunk-XMJ5VMWV.js} +70 -93
- package/dist/chunk-XMJ5VMWV.js.map +1 -0
- package/dist/{claude-pair-runtime-Z4DP2IQA.js → claude-pair-runtime-G4M27XXA.js} +2 -2
- package/dist/lib/manager-worker.js +327 -265
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +25 -2
- package/dist/mcp/origami.js +25 -2
- package/dist/mcp/slack-channel.js +25 -2
- package/dist/mcp/telegram-channel.js +25 -2
- package/dist/{persistent-session-4MIMM3TN.js → persistent-session-VMWQYV5B.js} +2 -2
- package/dist/{responsiveness-probe-5SRDBI4B.js → responsiveness-probe-WMJEL7IZ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-R6GVWACQ.js.map +0 -1
- /package/dist/{chunk-V3G7G4QM.js.map → chunk-JIZ6Z6EX.js.map} +0 -0
- /package/dist/{claude-pair-runtime-Z4DP2IQA.js.map → claude-pair-runtime-G4M27XXA.js.map} +0 -0
- /package/dist/{persistent-session-4MIMM3TN.js.map → persistent-session-VMWQYV5B.js.map} +0 -0
- /package/dist/{responsiveness-probe-5SRDBI4B.js.map → responsiveness-probe-WMJEL7IZ.js.map} +0 -0
package/dist/bin/agt.js
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
success,
|
|
41
41
|
table,
|
|
42
42
|
warn
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-JIZ6Z6EX.js";
|
|
44
44
|
import {
|
|
45
45
|
AnchorSessionClient,
|
|
46
46
|
CHANNEL_REGISTRY,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
requiredMcpWildcard,
|
|
72
72
|
resolveChannels,
|
|
73
73
|
serializeManifestForSlackCli
|
|
74
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-XMJ5VMWV.js";
|
|
75
75
|
import "../chunk-XWVM4KPK.js";
|
|
76
76
|
|
|
77
77
|
// src/bin/agt.ts
|
|
@@ -4830,7 +4830,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4830
4830
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4831
4831
|
import chalk18 from "chalk";
|
|
4832
4832
|
import ora16 from "ora";
|
|
4833
|
-
var cliVersion = true ? "0.28.
|
|
4833
|
+
var cliVersion = true ? "0.28.442" : "dev";
|
|
4834
4834
|
async function fetchLatestVersion() {
|
|
4835
4835
|
const host2 = getHost();
|
|
4836
4836
|
if (!host2) return null;
|
|
@@ -6002,7 +6002,7 @@ function handleError(err) {
|
|
|
6002
6002
|
}
|
|
6003
6003
|
|
|
6004
6004
|
// src/bin/agt.ts
|
|
6005
|
-
var cliVersion2 = true ? "0.28.
|
|
6005
|
+
var cliVersion2 = true ? "0.28.442" : "dev";
|
|
6006
6006
|
var program = new Command();
|
|
6007
6007
|
program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
|
|
6008
6008
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
resolveConnectivityProbe,
|
|
30
30
|
worseConnectivityOutcome,
|
|
31
31
|
wrapScheduledTaskPrompt
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-XMJ5VMWV.js";
|
|
33
33
|
import {
|
|
34
34
|
parsePsRows
|
|
35
35
|
} from "./chunk-XWVM4KPK.js";
|
|
@@ -4901,7 +4901,7 @@ function requireHost() {
|
|
|
4901
4901
|
}
|
|
4902
4902
|
|
|
4903
4903
|
// src/lib/api-client.ts
|
|
4904
|
-
var agtCliVersion = true ? "0.28.
|
|
4904
|
+
var agtCliVersion = true ? "0.28.442" : "dev";
|
|
4905
4905
|
var lastConfigHash = null;
|
|
4906
4906
|
function setConfigHash(hash) {
|
|
4907
4907
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -7402,4 +7402,4 @@ export {
|
|
|
7402
7402
|
managerInstallSystemUnitCommand,
|
|
7403
7403
|
managerUninstallSystemUnitCommand
|
|
7404
7404
|
};
|
|
7405
|
-
//# sourceMappingURL=chunk-
|
|
7405
|
+
//# sourceMappingURL=chunk-JIZ6Z6EX.js.map
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// src/lib/persistent-session.ts
|
|
6
6
|
import { spawn as spawn2, execSync as execSync2, execFileSync as execFileSync3 } from "child_process";
|
|
7
|
-
import { join as
|
|
8
|
-
import { homedir as
|
|
9
|
-
import { existsSync as existsSync6, readFileSync as
|
|
7
|
+
import { join as join5, dirname as dirname3 } from "path";
|
|
8
|
+
import { homedir as homedir5, platform, userInfo as userInfo2 } from "os";
|
|
9
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7, readdirSync as readdirSync3, writeFileSync as writeFileSync5, appendFileSync as appendFileSync2, mkdirSync as mkdirSync5, chmodSync as chmodSync3, copyFileSync, rmSync as rmSync3 } from "fs";
|
|
10
10
|
|
|
11
11
|
// src/lib/mcp-sanitize.ts
|
|
12
12
|
import { readFileSync, writeFileSync } from "fs";
|
|
@@ -1325,8 +1325,31 @@ var DEFAULT_SCOPES = [
|
|
|
1325
1325
|
// links an inbound Slack sender to their organization_people record (inbound
|
|
1326
1326
|
// identity reconcile). Existing installs without it degrade gracefully - the
|
|
1327
1327
|
// reconcile no-ops until the bot is re-authorised with the wider scope set.
|
|
1328
|
-
"users:read.email"
|
|
1329
|
-
|
|
1328
|
+
"users:read.email"
|
|
1329
|
+
// ENG-8203: 'users.profile:write' is deliberately NOT here.
|
|
1330
|
+
//
|
|
1331
|
+
// It is registered with `token_type: 'user'` (ENG-4812 — Slack rejects it
|
|
1332
|
+
// under oauth_config.scopes.bot with `illegal_bot_scopes`). The MANIFEST
|
|
1333
|
+
// generator partitions on that flag; the OAuth install-URL builder does not —
|
|
1334
|
+
// `buildSlackAuthorizeUrl` puts every stored scope into `scope=` — so a
|
|
1335
|
+
// default-scoped OAuth install sent a user-only scope as a bot scope and
|
|
1336
|
+
// Slack rejected the whole authorization with "Invalid permissions
|
|
1337
|
+
// requested". That blocked EVERY new install on the default set.
|
|
1338
|
+
//
|
|
1339
|
+
// Removing it rather than routing it to `user_scope=` is deliberate: the
|
|
1340
|
+
// callback destructures `authed_user?: { id?: string }` and persists only the
|
|
1341
|
+
// BOT token (oauth-callback/route.ts:217,246). `authed_user.access_token` is
|
|
1342
|
+
// never read, so asking for the scope would put an extra consent screen in
|
|
1343
|
+
// front of the installing admin and then discard the token it returned.
|
|
1344
|
+
//
|
|
1345
|
+
// Nothing is lost. `users.profile.set` needs an `xoxp-` user token, which no
|
|
1346
|
+
// OAuth-installed agent has ever had — the bot-status/live-presence indicator
|
|
1347
|
+
// only ever worked where an operator pasted a user token into the wizard by
|
|
1348
|
+
// hand, and that path is untouched. The registry definition stays so existing
|
|
1349
|
+
// configs still render and the `token_type: 'user'` knowledge is preserved.
|
|
1350
|
+
//
|
|
1351
|
+
// Wiring the indicator for OAuth installs means persisting
|
|
1352
|
+
// `authed_user.access_token` first, THEN adding `user_scope=`. Separate work.
|
|
1330
1353
|
];
|
|
1331
1354
|
function getDefaultSlackScopes() {
|
|
1332
1355
|
return [...DEFAULT_SCOPES];
|
|
@@ -11859,8 +11882,8 @@ function stopTranscriptRefresher(codeName) {
|
|
|
11859
11882
|
transcriptTimers.delete(codeName);
|
|
11860
11883
|
}
|
|
11861
11884
|
}
|
|
11862
|
-
function readProvisionedOpencodeModel(
|
|
11863
|
-
return readOpencodeModelString(join3(
|
|
11885
|
+
function readProvisionedOpencodeModel(agentDir2) {
|
|
11886
|
+
return readOpencodeModelString(join3(agentDir2, "provision", "opencode.json"));
|
|
11864
11887
|
}
|
|
11865
11888
|
function readOpencodeModelString(configPath2) {
|
|
11866
11889
|
try {
|
|
@@ -12798,58 +12821,13 @@ function creditWatchdogGiveUpCount(codeName, count) {
|
|
|
12798
12821
|
giveUpCounts.set(codeName, (giveUpCounts.get(codeName) ?? 0) + count);
|
|
12799
12822
|
}
|
|
12800
12823
|
|
|
12801
|
-
// src/lib/usage-limit-marker-file.ts
|
|
12802
|
-
import { mkdirSync as mkdirSync5, readFileSync as readFileSync7, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
12803
|
-
import { homedir as homedir5 } from "os";
|
|
12804
|
-
import { join as join5 } from "path";
|
|
12805
|
-
function agentDir2(codeName) {
|
|
12806
|
-
return join5(homedir5(), ".augmented", codeName);
|
|
12807
|
-
}
|
|
12808
|
-
function usageLimitMarkerPath(codeName) {
|
|
12809
|
-
return join5(agentDir2(codeName), USAGE_LIMIT_MARKER_FILENAME);
|
|
12810
|
-
}
|
|
12811
|
-
function writeUsageLimitMarker(codeName, limitedUntil, log2) {
|
|
12812
|
-
try {
|
|
12813
|
-
mkdirSync5(agentDir2(codeName), { recursive: true });
|
|
12814
|
-
writeFileSync5(usageLimitMarkerPath(codeName), serializeUsageLimitMarker(limitedUntil), "utf-8");
|
|
12815
|
-
} catch (err) {
|
|
12816
|
-
log2(`[usage-banner] usage-limit marker sync failed for '${codeName}': ${err.message}`);
|
|
12817
|
-
}
|
|
12818
|
-
}
|
|
12819
|
-
function clearUsageLimitMarker(codeName, log2) {
|
|
12820
|
-
try {
|
|
12821
|
-
rmSync3(usageLimitMarkerPath(codeName), { force: true });
|
|
12822
|
-
} catch (err) {
|
|
12823
|
-
log2(`[usage-banner] usage-limit marker clear failed for '${codeName}': ${err.message}`);
|
|
12824
|
-
}
|
|
12825
|
-
}
|
|
12826
|
-
function readUsageLimitUntil(opts) {
|
|
12827
|
-
const path = opts.filePath ?? (opts.codeName ? usageLimitMarkerPath(opts.codeName) : null);
|
|
12828
|
-
if (!path) return null;
|
|
12829
|
-
let raw;
|
|
12830
|
-
try {
|
|
12831
|
-
raw = readFileSync7(path, "utf-8");
|
|
12832
|
-
} catch {
|
|
12833
|
-
return null;
|
|
12834
|
-
}
|
|
12835
|
-
return resolveUsageLimitUntil(parseUsageLimitMarker(raw), opts.now ?? /* @__PURE__ */ new Date());
|
|
12836
|
-
}
|
|
12837
|
-
var loggedUsageCapDeferral = /* @__PURE__ */ new Map();
|
|
12838
|
-
function shouldLogUsageCapDeferral(site, codeName, limitedUntil) {
|
|
12839
|
-
const key = `${site}:${codeName}`;
|
|
12840
|
-
const at = limitedUntil.getTime();
|
|
12841
|
-
if (loggedUsageCapDeferral.get(key) === at) return false;
|
|
12842
|
-
loggedUsageCapDeferral.set(key, at);
|
|
12843
|
-
return true;
|
|
12844
|
-
}
|
|
12845
|
-
|
|
12846
12824
|
// src/lib/persistent-session.ts
|
|
12847
12825
|
var OPENROUTER_ANTHROPIC_BASE_URL = "https://openrouter.ai/api";
|
|
12848
12826
|
function syncClaudeCredsToRoot() {
|
|
12849
12827
|
if (platform() !== "linux") return true;
|
|
12850
12828
|
if (typeof process.getuid !== "function" || process.getuid() !== 0) return true;
|
|
12851
12829
|
for (const filename of [".credentials.json", "credentials.json"]) {
|
|
12852
|
-
if (existsSync6(
|
|
12830
|
+
if (existsSync6(join5("/root/.claude", filename))) return true;
|
|
12853
12831
|
}
|
|
12854
12832
|
let sourcePath = null;
|
|
12855
12833
|
try {
|
|
@@ -12857,7 +12835,7 @@ function syncClaudeCredsToRoot() {
|
|
|
12857
12835
|
outer: for (const entry of entries) {
|
|
12858
12836
|
if (!entry.isDirectory()) continue;
|
|
12859
12837
|
for (const filename of [".credentials.json", "credentials.json"]) {
|
|
12860
|
-
const candidate =
|
|
12838
|
+
const candidate = join5("/home", entry.name, ".claude", filename);
|
|
12861
12839
|
if (existsSync6(candidate)) {
|
|
12862
12840
|
sourcePath = candidate;
|
|
12863
12841
|
break outer;
|
|
@@ -12869,9 +12847,9 @@ function syncClaudeCredsToRoot() {
|
|
|
12869
12847
|
if (!sourcePath) return false;
|
|
12870
12848
|
const targetDir = "/root/.claude";
|
|
12871
12849
|
const sourceFilename = sourcePath.endsWith("credentials.json") && !sourcePath.endsWith(".credentials.json") ? "credentials.json" : ".credentials.json";
|
|
12872
|
-
const targetPath =
|
|
12850
|
+
const targetPath = join5(targetDir, sourceFilename);
|
|
12873
12851
|
try {
|
|
12874
|
-
if (!existsSync6(targetDir))
|
|
12852
|
+
if (!existsSync6(targetDir)) mkdirSync5(targetDir, { recursive: true, mode: 448 });
|
|
12875
12853
|
copyFileSync(sourcePath, targetPath);
|
|
12876
12854
|
chmodSync3(targetPath, 384);
|
|
12877
12855
|
return true;
|
|
@@ -12948,13 +12926,13 @@ function buildEgressAllowlist(toolsFrontmatter) {
|
|
|
12948
12926
|
return [...domains].sort();
|
|
12949
12927
|
}
|
|
12950
12928
|
function egressAllowlistHostPath(codeName, homeDir) {
|
|
12951
|
-
const home = homeDir ?? (process.env.HOME?.trim() ||
|
|
12952
|
-
return
|
|
12929
|
+
const home = homeDir ?? (process.env.HOME?.trim() || homedir5());
|
|
12930
|
+
return join5(home, ".augmented", "_egress", `${codeName}.txt`);
|
|
12953
12931
|
}
|
|
12954
12932
|
function writeEgressAllowlist(codeName, domains, homeDir) {
|
|
12955
12933
|
const p2 = egressAllowlistHostPath(codeName, homeDir);
|
|
12956
|
-
|
|
12957
|
-
|
|
12934
|
+
mkdirSync5(dirname3(p2), { recursive: true });
|
|
12935
|
+
writeFileSync5(p2, domains.join("\n") + "\n", { mode: 420 });
|
|
12958
12936
|
return p2;
|
|
12959
12937
|
}
|
|
12960
12938
|
var EGRESS_DOCKER_TIMEOUT_MS = 1e4;
|
|
@@ -12990,13 +12968,13 @@ function restartEgressSidecar(codeName) {
|
|
|
12990
12968
|
function buildDockerRunCommand(args) {
|
|
12991
12969
|
const { codeName, agentId, wrapperPath, projectDir, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch } = args;
|
|
12992
12970
|
const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
|
|
12993
|
-
const
|
|
12994
|
-
const agentIdDir =
|
|
12995
|
-
const mcpDir =
|
|
12996
|
-
const claudeHome =
|
|
12997
|
-
const claudeJson =
|
|
12971
|
+
const agentDir2 = join5(homeDir, ".augmented", codeName);
|
|
12972
|
+
const agentIdDir = join5(homeDir, ".augmented", agentId);
|
|
12973
|
+
const mcpDir = join5(homeDir, ".augmented", "_mcp");
|
|
12974
|
+
const claudeHome = join5(homeDir, ".claude");
|
|
12975
|
+
const claudeJson = join5(homeDir, ".claude.json");
|
|
12998
12976
|
const mounts = [
|
|
12999
|
-
`-v ${q(`${
|
|
12977
|
+
`-v ${q(`${agentDir2}:${agentDir2}`)}`,
|
|
13000
12978
|
`-v ${q(`${agentIdDir}:${agentIdDir}`)}`,
|
|
13001
12979
|
`-v ${q(`${mcpDir}:${mcpDir}:ro`)}`,
|
|
13002
12980
|
`-v ${q(`${claudeHome}:${claudeHome}`)}`,
|
|
@@ -13007,7 +12985,7 @@ function buildDockerRunCommand(args) {
|
|
|
13007
12985
|
const cpus = process.env.AGT_ISOLATION_CPUS || "1.0";
|
|
13008
12986
|
const pids = process.env.AGT_ISOLATION_PIDS || "512";
|
|
13009
12987
|
const envArgs = [`-e ${q(`HOME=${homeDir}`)}`];
|
|
13010
|
-
envArgs.push(`-e ${q(`npm_config_cache=${
|
|
12988
|
+
envArgs.push(`-e ${q(`npm_config_cache=${join5(agentDir2, ".npm-cache")}`)}`);
|
|
13011
12989
|
if (passApiKey) envArgs.push("-e ANTHROPIC_API_KEY");
|
|
13012
12990
|
if (passOpenRouter) {
|
|
13013
12991
|
envArgs.push("-e ANTHROPIC_BASE_URL");
|
|
@@ -13074,8 +13052,8 @@ function buildDockerRunCommand(args) {
|
|
|
13074
13052
|
}
|
|
13075
13053
|
function writePersistentClaudeWrapper(args) {
|
|
13076
13054
|
const { projectDir, claudeBin, initPrompt, claudeArgsJoined } = args;
|
|
13077
|
-
const envIntegrationsPath =
|
|
13078
|
-
const wrapperPath =
|
|
13055
|
+
const envIntegrationsPath = join5(projectDir, ".env.integrations");
|
|
13056
|
+
const wrapperPath = join5(projectDir, ".claude", "persistent-claude.sh");
|
|
13079
13057
|
const wrapperLines = [
|
|
13080
13058
|
"#!/usr/bin/env bash",
|
|
13081
13059
|
"set -e",
|
|
@@ -13094,15 +13072,15 @@ function writePersistentClaudeWrapper(args) {
|
|
|
13094
13072
|
wrapperLines.push(
|
|
13095
13073
|
`exec ${JSON.stringify(claudeBin)} ${initPromptArg}${claudeArgsJoined}`
|
|
13096
13074
|
);
|
|
13097
|
-
|
|
13098
|
-
|
|
13075
|
+
mkdirSync5(join5(projectDir, ".claude"), { recursive: true });
|
|
13076
|
+
writeFileSync5(wrapperPath, wrapperLines.join("\n") + "\n", { mode: 448 });
|
|
13099
13077
|
chmodSync3(wrapperPath, 448);
|
|
13100
13078
|
return wrapperPath;
|
|
13101
13079
|
}
|
|
13102
13080
|
function collectMcpServerNames(mcpConfigPath) {
|
|
13103
13081
|
if (!existsSync6(mcpConfigPath)) return [];
|
|
13104
13082
|
try {
|
|
13105
|
-
const data = JSON.parse(
|
|
13083
|
+
const data = JSON.parse(readFileSync7(mcpConfigPath, "utf-8"));
|
|
13106
13084
|
const servers = data.mcpServers;
|
|
13107
13085
|
return servers ? Object.keys(servers) : [];
|
|
13108
13086
|
} catch {
|
|
@@ -13110,15 +13088,15 @@ function collectMcpServerNames(mcpConfigPath) {
|
|
|
13110
13088
|
}
|
|
13111
13089
|
}
|
|
13112
13090
|
var sessions2 = /* @__PURE__ */ new Map();
|
|
13113
|
-
var PANE_LOG_DIR =
|
|
13091
|
+
var PANE_LOG_DIR = join5(homedir5(), ".augmented");
|
|
13114
13092
|
var PANE_TAIL_LINES = 20;
|
|
13115
13093
|
function paneLogPath(codeName) {
|
|
13116
|
-
return
|
|
13094
|
+
return join5(PANE_LOG_DIR, codeName, "pane.log");
|
|
13117
13095
|
}
|
|
13118
13096
|
function setupPaneLog2(tmuxSession, codeName, log2) {
|
|
13119
13097
|
const logPath = paneLogPath(codeName);
|
|
13120
13098
|
try {
|
|
13121
|
-
|
|
13099
|
+
mkdirSync5(dirname3(logPath), { recursive: true });
|
|
13122
13100
|
appendFileSync2(
|
|
13123
13101
|
logPath,
|
|
13124
13102
|
`
|
|
@@ -13138,7 +13116,7 @@ function readPaneLogTail(codeName, lines = PANE_TAIL_LINES) {
|
|
|
13138
13116
|
const logPath = paneLogPath(codeName);
|
|
13139
13117
|
if (!existsSync6(logPath)) return null;
|
|
13140
13118
|
try {
|
|
13141
|
-
const raw =
|
|
13119
|
+
const raw = readFileSync7(logPath, "utf-8");
|
|
13142
13120
|
if (!raw) return null;
|
|
13143
13121
|
const stripped = raw.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "");
|
|
13144
13122
|
const all = stripped.split("\n").filter((l) => l.length > 0);
|
|
@@ -13209,11 +13187,11 @@ function resolveSessionSpawnDecision(args) {
|
|
|
13209
13187
|
};
|
|
13210
13188
|
}
|
|
13211
13189
|
function directChatSessionStatePath(agentId) {
|
|
13212
|
-
return
|
|
13190
|
+
return join5(homedir5(), ".augmented", agentId, "direct-chat-session.json");
|
|
13213
13191
|
}
|
|
13214
13192
|
function readDirectChatSessionState(agentId) {
|
|
13215
13193
|
try {
|
|
13216
|
-
const parsed = JSON.parse(
|
|
13194
|
+
const parsed = JSON.parse(readFileSync7(directChatSessionStatePath(agentId), "utf-8"));
|
|
13217
13195
|
if (!parsed || typeof parsed !== "object") return null;
|
|
13218
13196
|
const state = parsed;
|
|
13219
13197
|
state.mcpServerKeys = Array.isArray(state.mcpServerKeys) ? state.mcpServerKeys.filter((k) => typeof k === "string") : void 0;
|
|
@@ -13224,8 +13202,8 @@ function readDirectChatSessionState(agentId) {
|
|
|
13224
13202
|
}
|
|
13225
13203
|
function writeDirectChatSessionState(agentId, state) {
|
|
13226
13204
|
const p2 = directChatSessionStatePath(agentId);
|
|
13227
|
-
|
|
13228
|
-
|
|
13205
|
+
mkdirSync5(dirname3(p2), { recursive: true });
|
|
13206
|
+
writeFileSync5(p2, JSON.stringify(state));
|
|
13229
13207
|
}
|
|
13230
13208
|
function startPersistentSession(config) {
|
|
13231
13209
|
const existing = sessions2.get(config.codeName);
|
|
@@ -13281,12 +13259,12 @@ function spawnSession(config, session) {
|
|
|
13281
13259
|
log2(`[persistent-session] No Claude Code credentials found under /root/.claude or /home/*. Pair via browser from the host page, or run 'claude /login' on the host.`);
|
|
13282
13260
|
}
|
|
13283
13261
|
} else {
|
|
13284
|
-
const claudeDir =
|
|
13262
|
+
const claudeDir = join5(homedir5(), ".claude");
|
|
13285
13263
|
for (const filename of [".credentials.json", "credentials.json"]) {
|
|
13286
|
-
const p2 =
|
|
13264
|
+
const p2 = join5(claudeDir, filename);
|
|
13287
13265
|
if (existsSync6(p2)) {
|
|
13288
13266
|
try {
|
|
13289
|
-
|
|
13267
|
+
rmSync3(p2, { force: true });
|
|
13290
13268
|
log2(`[persistent-session] Removed ${p2} (api_key mode active \u2014 preventing OAuth fallback)`);
|
|
13291
13269
|
} catch {
|
|
13292
13270
|
}
|
|
@@ -13378,7 +13356,7 @@ function spawnSession(config, session) {
|
|
|
13378
13356
|
if (config.notifyDispatchMode && config.notifyDispatchMode !== "off" && !process.env["AGT_NOTIFY_DISPATCH"]) {
|
|
13379
13357
|
tmuxSessionEnvArgs.push("-e", `AGT_NOTIFY_DISPATCH=${config.notifyDispatchMode}`);
|
|
13380
13358
|
}
|
|
13381
|
-
const sessionHomeDir = process.env.HOME?.trim() ||
|
|
13359
|
+
const sessionHomeDir = process.env.HOME?.trim() || homedir5();
|
|
13382
13360
|
let egress;
|
|
13383
13361
|
if (egressMode(codeName) === "allowlist") {
|
|
13384
13362
|
const allowlist = config.egressAllowlist ?? buildEgressAllowlist(null);
|
|
@@ -13417,7 +13395,7 @@ function spawnSession(config, session) {
|
|
|
13417
13395
|
// Treat empty-string as missing too — `HOME=""` makes ~ resolve
|
|
13418
13396
|
// to cwd, which is the same broken outcome as no HOME, just
|
|
13419
13397
|
// better hidden.
|
|
13420
|
-
HOME: process.env.HOME?.trim() ||
|
|
13398
|
+
HOME: process.env.HOME?.trim() || homedir5(),
|
|
13421
13399
|
USER: process.env.USER?.trim() || userInfo2().username
|
|
13422
13400
|
};
|
|
13423
13401
|
if (config.runId) {
|
|
@@ -13441,7 +13419,7 @@ function spawnSession(config, session) {
|
|
|
13441
13419
|
} : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv };
|
|
13442
13420
|
for (const f of probeMcpEnvSubstitution({
|
|
13443
13421
|
mcpConfigPath,
|
|
13444
|
-
envIntegrationsPath:
|
|
13422
|
+
envIntegrationsPath: join5(projectDir, ".env.integrations"),
|
|
13445
13423
|
baseEnv: probeBaseEnv
|
|
13446
13424
|
})) {
|
|
13447
13425
|
log2(`[persistent-session] ${formatMissingVar(f)} agent=${codeName}`);
|
|
@@ -13470,7 +13448,6 @@ function spawnSession(config, session) {
|
|
|
13470
13448
|
}
|
|
13471
13449
|
log2(`[persistent-session] tmux session '${tmuxSession}' created for '${codeName}'`);
|
|
13472
13450
|
setupPaneLog2(tmuxSession, codeName, log2);
|
|
13473
|
-
clearUsageLimitMarker(codeName, log2);
|
|
13474
13451
|
session.currentSessionId = sessionId;
|
|
13475
13452
|
acceptDialogs(tmuxSession, codeName, log2, config.primaryModel ?? null, sessionId).catch(() => {
|
|
13476
13453
|
});
|
|
@@ -14000,7 +13977,7 @@ async function stopAllSessionsAndWait(log2, opts) {
|
|
|
14000
13977
|
await new Promise((resolve) => setTimeout(resolve, Math.min(opts.timeoutMs, 2e3)));
|
|
14001
13978
|
}
|
|
14002
13979
|
function getProjectDir(codeName) {
|
|
14003
|
-
return
|
|
13980
|
+
return join5(homedir5(), ".augmented", codeName, "project");
|
|
14004
13981
|
}
|
|
14005
13982
|
|
|
14006
13983
|
export {
|
|
@@ -14087,6 +14064,10 @@ export {
|
|
|
14087
14064
|
sumTranscriptUsageInWindow,
|
|
14088
14065
|
isEmptyTotals,
|
|
14089
14066
|
attributeTranscriptUsageByRun,
|
|
14067
|
+
USAGE_LIMIT_MARKER_FILENAME,
|
|
14068
|
+
serializeUsageLimitMarker,
|
|
14069
|
+
parseUsageLimitMarker,
|
|
14070
|
+
resolveUsageLimitUntil,
|
|
14090
14071
|
ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
|
|
14091
14072
|
serializeAccountEnforcementMarker,
|
|
14092
14073
|
KANBAN_CHECK_COMMAND,
|
|
@@ -14129,10 +14110,6 @@ export {
|
|
|
14129
14110
|
checkChannelInputs,
|
|
14130
14111
|
takeWatchdogGiveUpCount,
|
|
14131
14112
|
creditWatchdogGiveUpCount,
|
|
14132
|
-
writeUsageLimitMarker,
|
|
14133
|
-
clearUsageLimitMarker,
|
|
14134
|
-
readUsageLimitUntil,
|
|
14135
|
-
shouldLogUsageCapDeferral,
|
|
14136
14113
|
resolveOAuthCredAction,
|
|
14137
14114
|
resolveClaudeBinary,
|
|
14138
14115
|
isolationMode,
|
|
@@ -14171,4 +14148,4 @@ export {
|
|
|
14171
14148
|
stopAllSessionsAndWait,
|
|
14172
14149
|
getProjectDir
|
|
14173
14150
|
};
|
|
14174
|
-
//# sourceMappingURL=chunk-
|
|
14151
|
+
//# sourceMappingURL=chunk-XMJ5VMWV.js.map
|