@integrity-labs/agt-cli 0.27.7-test.6 → 0.27.9
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 +103 -28
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-AACMX6LE.js → chunk-AQVJKJBD.js} +23 -2
- package/dist/chunk-AQVJKJBD.js.map +1 -0
- package/dist/lib/manager-worker.js +9 -9
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/index.js +78 -78
- package/dist/mcp/telegram-channel.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AACMX6LE.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-AQVJKJBD.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();
|
|
@@ -2353,6 +2416,18 @@ function readMcpIntegrations(path) {
|
|
|
2353
2416
|
return [];
|
|
2354
2417
|
}
|
|
2355
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
|
+
}
|
|
2356
2431
|
function buildImpersonateClaudeLaunch(projectCwd, inheritEnv = process.env, agentId = null) {
|
|
2357
2432
|
const env = {
|
|
2358
2433
|
...inheritEnv,
|
|
@@ -3012,7 +3087,7 @@ function terminate(child) {
|
|
|
3012
3087
|
// src/commands/manager-watch.tsx
|
|
3013
3088
|
import { useEffect, useState, useMemo } from "react";
|
|
3014
3089
|
import { render, Box, Text, useApp, useInput } from "ink";
|
|
3015
|
-
import { existsSync as
|
|
3090
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6, statSync, openSync, readSync, closeSync } from "fs";
|
|
3016
3091
|
import { homedir as homedir4 } from "os";
|
|
3017
3092
|
import { join as join12 } from "path";
|
|
3018
3093
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -3044,7 +3119,7 @@ function managerWatchCommand(opts = {}) {
|
|
|
3044
3119
|
}
|
|
3045
3120
|
function readState(stateFile) {
|
|
3046
3121
|
try {
|
|
3047
|
-
if (!
|
|
3122
|
+
if (!existsSync7(stateFile)) return null;
|
|
3048
3123
|
const raw = readFileSync6(stateFile, "utf-8");
|
|
3049
3124
|
return JSON.parse(raw);
|
|
3050
3125
|
} catch {
|
|
@@ -3052,7 +3127,7 @@ function readState(stateFile) {
|
|
|
3052
3127
|
}
|
|
3053
3128
|
}
|
|
3054
3129
|
function tailLogFile(logFile, lines) {
|
|
3055
|
-
if (!
|
|
3130
|
+
if (!existsSync7(logFile)) return [];
|
|
3056
3131
|
try {
|
|
3057
3132
|
const fileSize = statSync(logFile).size;
|
|
3058
3133
|
if (fileSize === 0) return [];
|
|
@@ -3293,7 +3368,7 @@ function truncate(s, max) {
|
|
|
3293
3368
|
return s.length > max ? `${s.slice(0, Math.max(0, max - 1))}\u2026` : s;
|
|
3294
3369
|
}
|
|
3295
3370
|
function streamLogFile(logFile) {
|
|
3296
|
-
if (!
|
|
3371
|
+
if (!existsSync7(logFile)) {
|
|
3297
3372
|
process.stderr.write(`No manager log found at ${logFile}.
|
|
3298
3373
|
Start the manager first: agt manager start
|
|
3299
3374
|
`);
|
|
@@ -3339,14 +3414,14 @@ Start the manager first: agt manager start
|
|
|
3339
3414
|
// src/commands/agent.ts
|
|
3340
3415
|
import chalk14 from "chalk";
|
|
3341
3416
|
import JSON52 from "json5";
|
|
3342
|
-
import { readFileSync as readFileSync7, existsSync as
|
|
3417
|
+
import { readFileSync as readFileSync7, existsSync as existsSync8 } from "fs";
|
|
3343
3418
|
import { join as join13 } from "path";
|
|
3344
3419
|
async function agentShowCommand(codeName, opts) {
|
|
3345
3420
|
const json = isJsonMode();
|
|
3346
3421
|
const unifiedDir = join13(opts.configDir, codeName, "provision");
|
|
3347
3422
|
const legacyDir = join13(opts.configDir, codeName, "claudecode", "provision");
|
|
3348
|
-
const agentDir =
|
|
3349
|
-
const hasLocalConfig =
|
|
3423
|
+
const agentDir = existsSync8(unifiedDir) ? unifiedDir : legacyDir;
|
|
3424
|
+
const hasLocalConfig = existsSync8(agentDir);
|
|
3350
3425
|
let apiChannels = null;
|
|
3351
3426
|
let apiAgent = null;
|
|
3352
3427
|
if (getApiKey()) {
|
|
@@ -3380,7 +3455,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3380
3455
|
let agentState = null;
|
|
3381
3456
|
if (hasLocalConfig) {
|
|
3382
3457
|
const charterPath = join13(agentDir, "CHARTER.md");
|
|
3383
|
-
if (
|
|
3458
|
+
if (existsSync8(charterPath)) {
|
|
3384
3459
|
const raw = readFileSync7(charterPath, "utf-8");
|
|
3385
3460
|
const parsed = extractFrontmatter(raw);
|
|
3386
3461
|
if (parsed.frontmatter) {
|
|
@@ -3388,7 +3463,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3388
3463
|
}
|
|
3389
3464
|
}
|
|
3390
3465
|
const toolsPath = join13(agentDir, "TOOLS.md");
|
|
3391
|
-
if (
|
|
3466
|
+
if (existsSync8(toolsPath)) {
|
|
3392
3467
|
const raw = readFileSync7(toolsPath, "utf-8");
|
|
3393
3468
|
const parsed = extractFrontmatter(raw);
|
|
3394
3469
|
if (parsed.frontmatter) {
|
|
@@ -3396,7 +3471,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3396
3471
|
}
|
|
3397
3472
|
}
|
|
3398
3473
|
const openclawPath = join13(agentDir, "openclaw.json5");
|
|
3399
|
-
if (
|
|
3474
|
+
if (existsSync8(openclawPath)) {
|
|
3400
3475
|
try {
|
|
3401
3476
|
const raw = readFileSync7(openclawPath, "utf-8");
|
|
3402
3477
|
openclawConfig = JSON52.parse(raw);
|
|
@@ -3404,7 +3479,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3404
3479
|
}
|
|
3405
3480
|
}
|
|
3406
3481
|
const statePath = join13(opts.configDir, "manager-state.json");
|
|
3407
|
-
if (
|
|
3482
|
+
if (existsSync8(statePath)) {
|
|
3408
3483
|
try {
|
|
3409
3484
|
const raw = readFileSync7(statePath, "utf-8");
|
|
3410
3485
|
const state = JSON.parse(raw);
|
|
@@ -3743,8 +3818,8 @@ async function kanbanRecurringDisableCommand(titleOrId, opts) {
|
|
|
3743
3818
|
}
|
|
3744
3819
|
|
|
3745
3820
|
// src/commands/setup.ts
|
|
3746
|
-
import { existsSync as
|
|
3747
|
-
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";
|
|
3748
3823
|
import { homedir as homedir5 } from "os";
|
|
3749
3824
|
import chalk16 from "chalk";
|
|
3750
3825
|
import ora14 from "ora";
|
|
@@ -3759,7 +3834,7 @@ function detectShellProfile() {
|
|
|
3759
3834
|
return fishConfig;
|
|
3760
3835
|
}
|
|
3761
3836
|
const bashrc = join14(home, ".bashrc");
|
|
3762
|
-
if (
|
|
3837
|
+
if (existsSync9(bashrc)) return bashrc;
|
|
3763
3838
|
return join14(home, ".bash_profile");
|
|
3764
3839
|
}
|
|
3765
3840
|
function maybeWriteSystemWideEnv(apiUrl, apiKey, consoleUrl) {
|
|
@@ -3786,7 +3861,7 @@ function quoteForFishShell(value) {
|
|
|
3786
3861
|
}
|
|
3787
3862
|
function writeEtcEnvironment(apiUrl, apiKey, consoleUrl) {
|
|
3788
3863
|
const envPath = "/etc/environment";
|
|
3789
|
-
if (!
|
|
3864
|
+
if (!existsSync9(envPath)) return false;
|
|
3790
3865
|
try {
|
|
3791
3866
|
accessSync(envPath, fsConstants.W_OK);
|
|
3792
3867
|
} catch {
|
|
@@ -3812,7 +3887,7 @@ function writeEtcEnvironment(apiUrl, apiKey, consoleUrl) {
|
|
|
3812
3887
|
}
|
|
3813
3888
|
function writeProfileDScript(apiUrl, apiKey, consoleUrl) {
|
|
3814
3889
|
const profileD = "/etc/profile.d";
|
|
3815
|
-
if (!
|
|
3890
|
+
if (!existsSync9(profileD)) return false;
|
|
3816
3891
|
try {
|
|
3817
3892
|
accessSync(profileD, fsConstants.W_OK);
|
|
3818
3893
|
} catch {
|
|
@@ -3835,7 +3910,7 @@ function writeProfileDScript(apiUrl, apiKey, consoleUrl) {
|
|
|
3835
3910
|
}
|
|
3836
3911
|
function ensureBashrcSourcesProfileD() {
|
|
3837
3912
|
const bashrc = "/etc/bashrc";
|
|
3838
|
-
if (!
|
|
3913
|
+
if (!existsSync9(bashrc)) return false;
|
|
3839
3914
|
try {
|
|
3840
3915
|
accessSync(bashrc, fsConstants.W_OK);
|
|
3841
3916
|
} catch {
|
|
@@ -3968,12 +4043,12 @@ async function setupCommand(token) {
|
|
|
3968
4043
|
);
|
|
3969
4044
|
}
|
|
3970
4045
|
const exportLines = buildExportLines(shell, finalApiUrl, setupResult.api_key, consoleUrl);
|
|
3971
|
-
const profileDir =
|
|
3972
|
-
if (!
|
|
4046
|
+
const profileDir = dirname4(profilePath);
|
|
4047
|
+
if (!existsSync9(profileDir)) {
|
|
3973
4048
|
mkdirSync7(profileDir, { recursive: true });
|
|
3974
4049
|
}
|
|
3975
4050
|
const marker = "# Augmented (agt) host configuration";
|
|
3976
|
-
const current =
|
|
4051
|
+
const current = existsSync9(profilePath) ? readFileSync8(profilePath, "utf-8") : "";
|
|
3977
4052
|
let updated;
|
|
3978
4053
|
if (current.includes(marker)) {
|
|
3979
4054
|
updated = current.replace(
|
|
@@ -4552,10 +4627,10 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
|
|
|
4552
4627
|
|
|
4553
4628
|
// src/commands/update.ts
|
|
4554
4629
|
import { execFileSync, execSync } from "child_process";
|
|
4555
|
-
import { existsSync as
|
|
4630
|
+
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4556
4631
|
import chalk18 from "chalk";
|
|
4557
4632
|
import ora16 from "ora";
|
|
4558
|
-
var cliVersion = true ? "0.27.
|
|
4633
|
+
var cliVersion = true ? "0.27.9" : "dev";
|
|
4559
4634
|
async function fetchLatestVersion() {
|
|
4560
4635
|
const host2 = getHost();
|
|
4561
4636
|
if (!host2) return null;
|
|
@@ -4659,7 +4734,7 @@ function performUpdate(version) {
|
|
|
4659
4734
|
function detectBrewOwner() {
|
|
4660
4735
|
for (const prefix of ["/home/linuxbrew/.linuxbrew", "/opt/homebrew", "/usr/local"]) {
|
|
4661
4736
|
const cellar = `${prefix}/Cellar`;
|
|
4662
|
-
if (!
|
|
4737
|
+
if (!existsSync10(cellar)) continue;
|
|
4663
4738
|
try {
|
|
4664
4739
|
return execSync(`stat -c %U "${cellar}" 2>/dev/null || stat -f %Su "${cellar}"`, { encoding: "utf-8" }).trim() || null;
|
|
4665
4740
|
} catch {
|
|
@@ -5087,7 +5162,7 @@ function handleError(err) {
|
|
|
5087
5162
|
}
|
|
5088
5163
|
|
|
5089
5164
|
// src/bin/agt.ts
|
|
5090
|
-
var cliVersion2 = true ? "0.27.
|
|
5165
|
+
var cliVersion2 = true ? "0.27.9" : "dev";
|
|
5091
5166
|
var program = new Command();
|
|
5092
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");
|
|
5093
5168
|
program.hook("preAction", (thisCommand) => {
|