@integrity-labs/agt-cli 0.27.8 → 0.27.10
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 +128 -30
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-IB655E5U.js → chunk-5FZ2QLD7.js} +23 -2
- package/dist/chunk-5FZ2QLD7.js.map +1 -0
- package/dist/lib/manager-worker.js +9 -9
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +47 -0
- package/dist/mcp/index.js +78 -78
- package/dist/mcp/slack-channel.js +50 -0
- package/dist/mcp/telegram-channel.js +50 -1
- package/package.json +1 -1
- package/dist/chunk-IB655E5U.js.map +0 -1
package/dist/bin/agt.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
success,
|
|
28
28
|
table,
|
|
29
29
|
warn
|
|
30
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-5FZ2QLD7.js";
|
|
31
31
|
import {
|
|
32
32
|
CHANNEL_REGISTRY,
|
|
33
33
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -1557,8 +1557,9 @@ async function provisionCommand(codeName, options) {
|
|
|
1557
1557
|
import chalk10 from "chalk";
|
|
1558
1558
|
import ora10 from "ora";
|
|
1559
1559
|
import { spawn } from "child_process";
|
|
1560
|
-
import { readFileSync as readFileSync5, writeFileSync as writeFileSync7 } from "fs";
|
|
1561
|
-
import { join as join10 } from "path";
|
|
1560
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync7 } from "fs";
|
|
1561
|
+
import { dirname as dirname3, join as join10 } from "path";
|
|
1562
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1562
1563
|
|
|
1563
1564
|
// src/lib/impersonate-flag.ts
|
|
1564
1565
|
var ENV_VAR = "AGT_IMPERSONATE_ENABLED";
|
|
@@ -1996,12 +1997,67 @@ function buildIntroduction(input4) {
|
|
|
1996
1997
|
const lines = [`I'm ${spokenName}${codeSuffix}${roleClause}.`, ""];
|
|
1997
1998
|
if (integrations.length > 0) {
|
|
1998
1999
|
lines.push(`Connected integrations: ${integrations.join(", ")}.`);
|
|
2000
|
+
lines.push("");
|
|
2001
|
+
lines.push(
|
|
2002
|
+
"If the operator asks what you can do, call each MCP server's `tools/list` and report the actual tool inventory. Do not narrate capabilities from CHARTER.md \u2014 it describes intent, not runtime state. Tools that fail to enumerate (server failed to spawn, env missing, etc.) should be reported as such, not silently omitted."
|
|
2003
|
+
);
|
|
1999
2004
|
} else {
|
|
2000
2005
|
lines.push("No integrations are connected.");
|
|
2001
2006
|
}
|
|
2002
2007
|
return lines.join("\n");
|
|
2003
2008
|
}
|
|
2004
2009
|
|
|
2010
|
+
// src/lib/impersonate-mcp-rewrite.ts
|
|
2011
|
+
var SERVER_HOME_MCP_PATH_RE = /^\/home\/[^/]+\/\.augmented\/_mcp\/([^/]+)$/;
|
|
2012
|
+
function rewriteMcpJsonForImpersonation(mcpJson, ctx) {
|
|
2013
|
+
const parsed = JSON.parse(mcpJson);
|
|
2014
|
+
if (!isPlainObject(parsed)) {
|
|
2015
|
+
throw new Error(
|
|
2016
|
+
`rewriteMcpJsonForImpersonation: expected an object at the JSON root, got ${typeof parsed}`
|
|
2017
|
+
);
|
|
2018
|
+
}
|
|
2019
|
+
const servers = parsed["mcpServers"];
|
|
2020
|
+
if (!isPlainObject(servers)) {
|
|
2021
|
+
throw new Error(
|
|
2022
|
+
"rewriteMcpJsonForImpersonation: expected an object-typed `mcpServers` field"
|
|
2023
|
+
);
|
|
2024
|
+
}
|
|
2025
|
+
const rewrittenServers = {};
|
|
2026
|
+
for (const [serverName, raw] of Object.entries(servers)) {
|
|
2027
|
+
rewrittenServers[serverName] = rewriteServerEntry(raw, ctx);
|
|
2028
|
+
}
|
|
2029
|
+
const out = { ...parsed, mcpServers: rewrittenServers };
|
|
2030
|
+
return JSON.stringify(out, null, 2);
|
|
2031
|
+
}
|
|
2032
|
+
function rewriteServerEntry(raw, ctx) {
|
|
2033
|
+
if (!isPlainObject(raw)) return raw;
|
|
2034
|
+
let args = raw["args"];
|
|
2035
|
+
if (Array.isArray(args)) {
|
|
2036
|
+
args = args.map((arg) => {
|
|
2037
|
+
if (typeof arg !== "string") return arg;
|
|
2038
|
+
const m = SERVER_HOME_MCP_PATH_RE.exec(arg);
|
|
2039
|
+
if (!m) return arg;
|
|
2040
|
+
return `${ctx.cliMcpBundleDir}/${m[1]}`;
|
|
2041
|
+
});
|
|
2042
|
+
}
|
|
2043
|
+
const env = isPlainObject(raw["env"]) ? { ...raw["env"] } : {};
|
|
2044
|
+
fillIfEmpty(env, "AGT_HOST", ctx.apiHost);
|
|
2045
|
+
fillIfEmpty(env, "AGT_API_KEY", ctx.impersonationToken);
|
|
2046
|
+
fillIfEmpty(env, "HOME", ctx.operatorHome);
|
|
2047
|
+
fillIfEmpty(env, "AGT_AGENT_ID", ctx.agentId);
|
|
2048
|
+
fillIfEmpty(env, "AGT_AGENT_CODE_NAME", ctx.agentCodeName);
|
|
2049
|
+
return { ...raw, args, env };
|
|
2050
|
+
}
|
|
2051
|
+
function fillIfEmpty(env, key, value) {
|
|
2052
|
+
const current = env[key];
|
|
2053
|
+
if (typeof current !== "string" || current.length === 0) {
|
|
2054
|
+
env[key] = value;
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
function isPlainObject(v) {
|
|
2058
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2005
2061
|
// src/commands/impersonate.ts
|
|
2006
2062
|
var SWAP_FILES = ["CLAUDE.md", ".mcp.json"];
|
|
2007
2063
|
var AGENT_IMPERSONATION_HEADER = "X-Agent-Impersonation";
|
|
@@ -2071,7 +2127,14 @@ async function impersonateConnectCommand(token, options = {}) {
|
|
|
2071
2127
|
);
|
|
2072
2128
|
writeFileSync7(
|
|
2073
2129
|
join10(personaDir, ".mcp.json"),
|
|
2074
|
-
bundle.artifacts[".mcp.json"]
|
|
2130
|
+
rewriteMcpJsonForImpersonation(bundle.artifacts[".mcp.json"], {
|
|
2131
|
+
operatorHome: process.env.HOME ?? "",
|
|
2132
|
+
cliMcpBundleDir: resolveCliMcpBundleDir(),
|
|
2133
|
+
impersonationToken: bundle.token,
|
|
2134
|
+
apiHost: host2,
|
|
2135
|
+
agentId: bundle.agent.agent_id,
|
|
2136
|
+
agentCodeName: bundle.agent.code_name
|
|
2137
|
+
})
|
|
2075
2138
|
);
|
|
2076
2139
|
spinner.text = "Swapping persona files\u2026";
|
|
2077
2140
|
const projectCwd = options.workdir ? ensureImpersonateWorkdir(bundle.agent.code_name) : process.cwd();
|
|
@@ -2164,10 +2227,16 @@ async function impersonateConnectCommand(token, options = {}) {
|
|
|
2164
2227
|
}
|
|
2165
2228
|
info("Launching Claude Code\u2026 (use `--no-launch` next time to skip)");
|
|
2166
2229
|
console.log();
|
|
2230
|
+
const launch = buildImpersonateClaudeLaunch(
|
|
2231
|
+
projectCwd,
|
|
2232
|
+
process.env,
|
|
2233
|
+
bundle.agent.agent_id
|
|
2234
|
+
);
|
|
2167
2235
|
await new Promise((resolve2) => {
|
|
2168
|
-
const child = spawn("claude", {
|
|
2236
|
+
const child = spawn("claude", launch.args, {
|
|
2169
2237
|
stdio: "inherit",
|
|
2170
|
-
cwd: projectCwd
|
|
2238
|
+
cwd: projectCwd,
|
|
2239
|
+
env: launch.env
|
|
2171
2240
|
});
|
|
2172
2241
|
child.on("error", (err) => {
|
|
2173
2242
|
if (err.code === "ENOENT") {
|
|
@@ -2347,6 +2416,35 @@ function readMcpIntegrations(path) {
|
|
|
2347
2416
|
return [];
|
|
2348
2417
|
}
|
|
2349
2418
|
}
|
|
2419
|
+
function resolveCliMcpBundleDir() {
|
|
2420
|
+
const moduleDir = dirname3(fileURLToPath2(import.meta.url));
|
|
2421
|
+
const candidates = [
|
|
2422
|
+
join10(moduleDir, "mcp"),
|
|
2423
|
+
join10(moduleDir, "..", "mcp"),
|
|
2424
|
+
join10(moduleDir, "..", "..", "mcp")
|
|
2425
|
+
];
|
|
2426
|
+
for (const candidate of candidates) {
|
|
2427
|
+
if (existsSync6(join10(candidate, "index.js"))) return candidate;
|
|
2428
|
+
}
|
|
2429
|
+
return candidates[candidates.length - 1];
|
|
2430
|
+
}
|
|
2431
|
+
function buildImpersonateClaudeLaunch(projectCwd, inheritEnv = process.env, agentId = null) {
|
|
2432
|
+
const env = {
|
|
2433
|
+
...inheritEnv,
|
|
2434
|
+
ENABLE_CLAUDEAI_MCP_SERVERS: "false"
|
|
2435
|
+
};
|
|
2436
|
+
if (agentId !== null && agentId.length > 0) {
|
|
2437
|
+
env.AGT_ACT_AS_AGENT_ID = agentId;
|
|
2438
|
+
}
|
|
2439
|
+
return {
|
|
2440
|
+
args: [
|
|
2441
|
+
"--strict-mcp-config",
|
|
2442
|
+
"--mcp-config",
|
|
2443
|
+
join10(projectCwd, ".mcp.json")
|
|
2444
|
+
],
|
|
2445
|
+
env
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2350
2448
|
|
|
2351
2449
|
// src/commands/drift.ts
|
|
2352
2450
|
import chalk11 from "chalk";
|
|
@@ -2989,7 +3087,7 @@ function terminate(child) {
|
|
|
2989
3087
|
// src/commands/manager-watch.tsx
|
|
2990
3088
|
import { useEffect, useState, useMemo } from "react";
|
|
2991
3089
|
import { render, Box, Text, useApp, useInput } from "ink";
|
|
2992
|
-
import { existsSync as
|
|
3090
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6, statSync, openSync, readSync, closeSync } from "fs";
|
|
2993
3091
|
import { homedir as homedir4 } from "os";
|
|
2994
3092
|
import { join as join12 } from "path";
|
|
2995
3093
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -3021,7 +3119,7 @@ function managerWatchCommand(opts = {}) {
|
|
|
3021
3119
|
}
|
|
3022
3120
|
function readState(stateFile) {
|
|
3023
3121
|
try {
|
|
3024
|
-
if (!
|
|
3122
|
+
if (!existsSync7(stateFile)) return null;
|
|
3025
3123
|
const raw = readFileSync6(stateFile, "utf-8");
|
|
3026
3124
|
return JSON.parse(raw);
|
|
3027
3125
|
} catch {
|
|
@@ -3029,7 +3127,7 @@ function readState(stateFile) {
|
|
|
3029
3127
|
}
|
|
3030
3128
|
}
|
|
3031
3129
|
function tailLogFile(logFile, lines) {
|
|
3032
|
-
if (!
|
|
3130
|
+
if (!existsSync7(logFile)) return [];
|
|
3033
3131
|
try {
|
|
3034
3132
|
const fileSize = statSync(logFile).size;
|
|
3035
3133
|
if (fileSize === 0) return [];
|
|
@@ -3270,7 +3368,7 @@ function truncate(s, max) {
|
|
|
3270
3368
|
return s.length > max ? `${s.slice(0, Math.max(0, max - 1))}\u2026` : s;
|
|
3271
3369
|
}
|
|
3272
3370
|
function streamLogFile(logFile) {
|
|
3273
|
-
if (!
|
|
3371
|
+
if (!existsSync7(logFile)) {
|
|
3274
3372
|
process.stderr.write(`No manager log found at ${logFile}.
|
|
3275
3373
|
Start the manager first: agt manager start
|
|
3276
3374
|
`);
|
|
@@ -3316,14 +3414,14 @@ Start the manager first: agt manager start
|
|
|
3316
3414
|
// src/commands/agent.ts
|
|
3317
3415
|
import chalk14 from "chalk";
|
|
3318
3416
|
import JSON52 from "json5";
|
|
3319
|
-
import { readFileSync as readFileSync7, existsSync as
|
|
3417
|
+
import { readFileSync as readFileSync7, existsSync as existsSync8 } from "fs";
|
|
3320
3418
|
import { join as join13 } from "path";
|
|
3321
3419
|
async function agentShowCommand(codeName, opts) {
|
|
3322
3420
|
const json = isJsonMode();
|
|
3323
3421
|
const unifiedDir = join13(opts.configDir, codeName, "provision");
|
|
3324
3422
|
const legacyDir = join13(opts.configDir, codeName, "claudecode", "provision");
|
|
3325
|
-
const agentDir =
|
|
3326
|
-
const hasLocalConfig =
|
|
3423
|
+
const agentDir = existsSync8(unifiedDir) ? unifiedDir : legacyDir;
|
|
3424
|
+
const hasLocalConfig = existsSync8(agentDir);
|
|
3327
3425
|
let apiChannels = null;
|
|
3328
3426
|
let apiAgent = null;
|
|
3329
3427
|
if (getApiKey()) {
|
|
@@ -3357,7 +3455,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3357
3455
|
let agentState = null;
|
|
3358
3456
|
if (hasLocalConfig) {
|
|
3359
3457
|
const charterPath = join13(agentDir, "CHARTER.md");
|
|
3360
|
-
if (
|
|
3458
|
+
if (existsSync8(charterPath)) {
|
|
3361
3459
|
const raw = readFileSync7(charterPath, "utf-8");
|
|
3362
3460
|
const parsed = extractFrontmatter(raw);
|
|
3363
3461
|
if (parsed.frontmatter) {
|
|
@@ -3365,7 +3463,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3365
3463
|
}
|
|
3366
3464
|
}
|
|
3367
3465
|
const toolsPath = join13(agentDir, "TOOLS.md");
|
|
3368
|
-
if (
|
|
3466
|
+
if (existsSync8(toolsPath)) {
|
|
3369
3467
|
const raw = readFileSync7(toolsPath, "utf-8");
|
|
3370
3468
|
const parsed = extractFrontmatter(raw);
|
|
3371
3469
|
if (parsed.frontmatter) {
|
|
@@ -3373,7 +3471,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3373
3471
|
}
|
|
3374
3472
|
}
|
|
3375
3473
|
const openclawPath = join13(agentDir, "openclaw.json5");
|
|
3376
|
-
if (
|
|
3474
|
+
if (existsSync8(openclawPath)) {
|
|
3377
3475
|
try {
|
|
3378
3476
|
const raw = readFileSync7(openclawPath, "utf-8");
|
|
3379
3477
|
openclawConfig = JSON52.parse(raw);
|
|
@@ -3381,7 +3479,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3381
3479
|
}
|
|
3382
3480
|
}
|
|
3383
3481
|
const statePath = join13(opts.configDir, "manager-state.json");
|
|
3384
|
-
if (
|
|
3482
|
+
if (existsSync8(statePath)) {
|
|
3385
3483
|
try {
|
|
3386
3484
|
const raw = readFileSync7(statePath, "utf-8");
|
|
3387
3485
|
const state = JSON.parse(raw);
|
|
@@ -3720,8 +3818,8 @@ async function kanbanRecurringDisableCommand(titleOrId, opts) {
|
|
|
3720
3818
|
}
|
|
3721
3819
|
|
|
3722
3820
|
// src/commands/setup.ts
|
|
3723
|
-
import { existsSync as
|
|
3724
|
-
import { join as join14, dirname as
|
|
3821
|
+
import { existsSync as existsSync9, readFileSync as readFileSync8, writeFileSync as writeFileSync8, mkdirSync as mkdirSync7, accessSync, constants as fsConstants } from "fs";
|
|
3822
|
+
import { join as join14, dirname as dirname4 } from "path";
|
|
3725
3823
|
import { homedir as homedir5 } from "os";
|
|
3726
3824
|
import chalk16 from "chalk";
|
|
3727
3825
|
import ora14 from "ora";
|
|
@@ -3736,7 +3834,7 @@ function detectShellProfile() {
|
|
|
3736
3834
|
return fishConfig;
|
|
3737
3835
|
}
|
|
3738
3836
|
const bashrc = join14(home, ".bashrc");
|
|
3739
|
-
if (
|
|
3837
|
+
if (existsSync9(bashrc)) return bashrc;
|
|
3740
3838
|
return join14(home, ".bash_profile");
|
|
3741
3839
|
}
|
|
3742
3840
|
function maybeWriteSystemWideEnv(apiUrl, apiKey, consoleUrl) {
|
|
@@ -3763,7 +3861,7 @@ function quoteForFishShell(value) {
|
|
|
3763
3861
|
}
|
|
3764
3862
|
function writeEtcEnvironment(apiUrl, apiKey, consoleUrl) {
|
|
3765
3863
|
const envPath = "/etc/environment";
|
|
3766
|
-
if (!
|
|
3864
|
+
if (!existsSync9(envPath)) return false;
|
|
3767
3865
|
try {
|
|
3768
3866
|
accessSync(envPath, fsConstants.W_OK);
|
|
3769
3867
|
} catch {
|
|
@@ -3789,7 +3887,7 @@ function writeEtcEnvironment(apiUrl, apiKey, consoleUrl) {
|
|
|
3789
3887
|
}
|
|
3790
3888
|
function writeProfileDScript(apiUrl, apiKey, consoleUrl) {
|
|
3791
3889
|
const profileD = "/etc/profile.d";
|
|
3792
|
-
if (!
|
|
3890
|
+
if (!existsSync9(profileD)) return false;
|
|
3793
3891
|
try {
|
|
3794
3892
|
accessSync(profileD, fsConstants.W_OK);
|
|
3795
3893
|
} catch {
|
|
@@ -3812,7 +3910,7 @@ function writeProfileDScript(apiUrl, apiKey, consoleUrl) {
|
|
|
3812
3910
|
}
|
|
3813
3911
|
function ensureBashrcSourcesProfileD() {
|
|
3814
3912
|
const bashrc = "/etc/bashrc";
|
|
3815
|
-
if (!
|
|
3913
|
+
if (!existsSync9(bashrc)) return false;
|
|
3816
3914
|
try {
|
|
3817
3915
|
accessSync(bashrc, fsConstants.W_OK);
|
|
3818
3916
|
} catch {
|
|
@@ -3945,12 +4043,12 @@ async function setupCommand(token) {
|
|
|
3945
4043
|
);
|
|
3946
4044
|
}
|
|
3947
4045
|
const exportLines = buildExportLines(shell, finalApiUrl, setupResult.api_key, consoleUrl);
|
|
3948
|
-
const profileDir =
|
|
3949
|
-
if (!
|
|
4046
|
+
const profileDir = dirname4(profilePath);
|
|
4047
|
+
if (!existsSync9(profileDir)) {
|
|
3950
4048
|
mkdirSync7(profileDir, { recursive: true });
|
|
3951
4049
|
}
|
|
3952
4050
|
const marker = "# Augmented (agt) host configuration";
|
|
3953
|
-
const current =
|
|
4051
|
+
const current = existsSync9(profilePath) ? readFileSync8(profilePath, "utf-8") : "";
|
|
3954
4052
|
let updated;
|
|
3955
4053
|
if (current.includes(marker)) {
|
|
3956
4054
|
updated = current.replace(
|
|
@@ -4529,10 +4627,10 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
|
|
|
4529
4627
|
|
|
4530
4628
|
// src/commands/update.ts
|
|
4531
4629
|
import { execFileSync, execSync } from "child_process";
|
|
4532
|
-
import { existsSync as
|
|
4630
|
+
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4533
4631
|
import chalk18 from "chalk";
|
|
4534
4632
|
import ora16 from "ora";
|
|
4535
|
-
var cliVersion = true ? "0.27.
|
|
4633
|
+
var cliVersion = true ? "0.27.10" : "dev";
|
|
4536
4634
|
async function fetchLatestVersion() {
|
|
4537
4635
|
const host2 = getHost();
|
|
4538
4636
|
if (!host2) return null;
|
|
@@ -4636,7 +4734,7 @@ function performUpdate(version) {
|
|
|
4636
4734
|
function detectBrewOwner() {
|
|
4637
4735
|
for (const prefix of ["/home/linuxbrew/.linuxbrew", "/opt/homebrew", "/usr/local"]) {
|
|
4638
4736
|
const cellar = `${prefix}/Cellar`;
|
|
4639
|
-
if (!
|
|
4737
|
+
if (!existsSync10(cellar)) continue;
|
|
4640
4738
|
try {
|
|
4641
4739
|
return execSync(`stat -c %U "${cellar}" 2>/dev/null || stat -f %Su "${cellar}"`, { encoding: "utf-8" }).trim() || null;
|
|
4642
4740
|
} catch {
|
|
@@ -5064,7 +5162,7 @@ function handleError(err) {
|
|
|
5064
5162
|
}
|
|
5065
5163
|
|
|
5066
5164
|
// src/bin/agt.ts
|
|
5067
|
-
var cliVersion2 = true ? "0.27.
|
|
5165
|
+
var cliVersion2 = true ? "0.27.10" : "dev";
|
|
5068
5166
|
var program = new Command();
|
|
5069
5167
|
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");
|
|
5070
5168
|
program.hook("preAction", (thisCommand) => {
|