@integrity-labs/agt-cli 0.7.6 → 0.7.7
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
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
resolveChannels,
|
|
33
33
|
serializeManifestForSlackCli,
|
|
34
34
|
setActiveTeam
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-QS2GCIWQ.js";
|
|
36
36
|
|
|
37
37
|
// src/bin/agt.ts
|
|
38
38
|
import { join as join11 } from "path";
|
|
@@ -3411,7 +3411,7 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
|
|
|
3411
3411
|
import { execSync } from "child_process";
|
|
3412
3412
|
import chalk19 from "chalk";
|
|
3413
3413
|
import ora15 from "ora";
|
|
3414
|
-
var cliVersion = true ? "0.7.
|
|
3414
|
+
var cliVersion = true ? "0.7.7" : "dev";
|
|
3415
3415
|
async function fetchLatestVersion() {
|
|
3416
3416
|
const host2 = AGT_HOST;
|
|
3417
3417
|
if (!host2) return null;
|
|
@@ -3527,7 +3527,7 @@ async function checkForUpdateOnStartup() {
|
|
|
3527
3527
|
}
|
|
3528
3528
|
|
|
3529
3529
|
// src/bin/agt.ts
|
|
3530
|
-
var cliVersion2 = true ? "0.7.
|
|
3530
|
+
var cliVersion2 = true ? "0.7.7" : "dev";
|
|
3531
3531
|
var program = new Command();
|
|
3532
3532
|
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");
|
|
3533
3533
|
program.hook("preAction", (thisCommand) => {
|
|
@@ -2500,8 +2500,11 @@ function ensureAugmentedDir() {
|
|
|
2500
2500
|
mkdirSync4(AUGMENTED_DIR2, { recursive: true });
|
|
2501
2501
|
}
|
|
2502
2502
|
}
|
|
2503
|
-
function
|
|
2504
|
-
|
|
2503
|
+
function reloadFromShellProfile() {
|
|
2504
|
+
return loadFromShellProfile(true);
|
|
2505
|
+
}
|
|
2506
|
+
function loadFromShellProfile(force = false) {
|
|
2507
|
+
if (!force && process.env["AGT_HOST"] && process.env["AGT_API_KEY"]) return;
|
|
2505
2508
|
const shell = process.env["SHELL"] ?? "";
|
|
2506
2509
|
const home = homedir3();
|
|
2507
2510
|
const candidates = shell.includes("zsh") ? [join4(home, ".zshrc"), join4(home, ".zprofile")] : shell.includes("fish") ? [join4(home, ".config", "fish", "config.fish")] : [join4(home, ".bashrc"), join4(home, ".bash_profile")];
|
|
@@ -2509,7 +2512,7 @@ function loadFromShellProfile() {
|
|
|
2509
2512
|
try {
|
|
2510
2513
|
const content = readFileSync4(profile, "utf-8");
|
|
2511
2514
|
for (const key of ["AGT_HOST", "AGT_API_KEY", "AGT_TEAM"]) {
|
|
2512
|
-
if (process.env[key]) continue;
|
|
2515
|
+
if (!force && process.env[key]) continue;
|
|
2513
2516
|
const match = content.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#")).map(
|
|
2514
2517
|
(line) => line.match(
|
|
2515
2518
|
new RegExp(
|
|
@@ -2562,7 +2565,7 @@ function requireHost() {
|
|
|
2562
2565
|
|
|
2563
2566
|
// src/lib/api-client.ts
|
|
2564
2567
|
var cachedExchange = null;
|
|
2565
|
-
async function exchangeApiKey(rawKey) {
|
|
2568
|
+
async function exchangeApiKey(rawKey, retried = false) {
|
|
2566
2569
|
if (cachedExchange && Date.now() < cachedExchange.expiresAt - 6e4) {
|
|
2567
2570
|
return {
|
|
2568
2571
|
token: cachedExchange.token,
|
|
@@ -2581,9 +2584,17 @@ async function exchangeApiKey(rawKey) {
|
|
|
2581
2584
|
});
|
|
2582
2585
|
if (!res.ok) {
|
|
2583
2586
|
const body = await res.json().catch(() => ({}));
|
|
2587
|
+
const errorMsg = String(body["error"] ?? res.statusText);
|
|
2588
|
+
if (errorMsg.includes("revoked") && !retried) {
|
|
2589
|
+
reloadFromShellProfile();
|
|
2590
|
+
const freshKey = getApiKey();
|
|
2591
|
+
if (freshKey && freshKey !== rawKey) {
|
|
2592
|
+
return exchangeApiKey(freshKey, true);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2584
2595
|
const host = requireHost();
|
|
2585
2596
|
const obfuscated = rawKey.length > 12 ? `${rawKey.slice(0, 8)}${"*".repeat(rawKey.length - 12)}${rawKey.slice(-4)}` : rawKey.slice(0, 4) + "****";
|
|
2586
|
-
throw new Error(`API key exchange failed: ${
|
|
2597
|
+
throw new Error(`API key exchange failed: ${errorMsg} (host=${host}, key=${obfuscated})`);
|
|
2587
2598
|
}
|
|
2588
2599
|
const data = await res.json();
|
|
2589
2600
|
if (!data.token) {
|
|
@@ -4587,4 +4598,4 @@ export {
|
|
|
4587
4598
|
detectDrift,
|
|
4588
4599
|
provision
|
|
4589
4600
|
};
|
|
4590
|
-
//# sourceMappingURL=chunk-
|
|
4601
|
+
//# sourceMappingURL=chunk-QS2GCIWQ.js.map
|