@integrity-labs/agt-cli 0.28.22 → 0.28.24
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 +3 -3
- package/dist/{chunk-O2QKTUOE.js → chunk-Z5GPBUID.js} +1 -1
- package/dist/lib/manager-worker.js +58 -4
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/augmented-admin.js +22 -0
- package/package.json +1 -1
- /package/dist/{chunk-O2QKTUOE.js.map → chunk-Z5GPBUID.js.map} +0 -0
package/dist/bin/agt.js
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
success,
|
|
34
34
|
table,
|
|
35
35
|
warn
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-Z5GPBUID.js";
|
|
37
37
|
import {
|
|
38
38
|
CHANNEL_REGISTRY,
|
|
39
39
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -4773,7 +4773,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4773
4773
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4774
4774
|
import chalk18 from "chalk";
|
|
4775
4775
|
import ora16 from "ora";
|
|
4776
|
-
var cliVersion = true ? "0.28.
|
|
4776
|
+
var cliVersion = true ? "0.28.24" : "dev";
|
|
4777
4777
|
async function fetchLatestVersion() {
|
|
4778
4778
|
const host2 = getHost();
|
|
4779
4779
|
if (!host2) return null;
|
|
@@ -5696,7 +5696,7 @@ function handleError(err) {
|
|
|
5696
5696
|
}
|
|
5697
5697
|
|
|
5698
5698
|
// src/bin/agt.ts
|
|
5699
|
-
var cliVersion2 = true ? "0.28.
|
|
5699
|
+
var cliVersion2 = true ? "0.28.24" : "dev";
|
|
5700
5700
|
var program = new Command();
|
|
5701
5701
|
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");
|
|
5702
5702
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
provisionStopHook,
|
|
23
23
|
requireHost,
|
|
24
24
|
safeWriteJsonAtomic
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-Z5GPBUID.js";
|
|
26
26
|
import {
|
|
27
27
|
getProjectDir as getProjectDir2,
|
|
28
28
|
getReadyTasks,
|
|
@@ -4048,6 +4048,11 @@ async function processOne(flag, opts) {
|
|
|
4048
4048
|
const reasonSuffix = flag.source === "agent" && flag.reason ? ` reason="${flag.reason}"` : "";
|
|
4049
4049
|
opts.log(`[restart-handler] Restarting tmux session for '${flag.codeName}' (source: ${flag.source})${reasonSuffix}`);
|
|
4050
4050
|
opts.stopSession(flag.codeName, flag);
|
|
4051
|
+
if (opts.reportRestartEvent) {
|
|
4052
|
+
void opts.reportRestartEvent(flag).catch((err) => {
|
|
4053
|
+
opts.log(`[restart-handler] restart-event report failed for '${flag.codeName}': ${err.message}`);
|
|
4054
|
+
});
|
|
4055
|
+
}
|
|
4051
4056
|
await sendAck(flag, opts, `\u{1F504} Restart initiated for \`${flag.codeName}\` \u2014 the replacement session is being created.`);
|
|
4052
4057
|
}
|
|
4053
4058
|
async function sendAck(flag, opts, text) {
|
|
@@ -5183,6 +5188,16 @@ function stopPersistentSessionAndForgetMcpBaseline(codeName, breakerReason, gate
|
|
|
5183
5188
|
if (breakerReason) {
|
|
5184
5189
|
recordRestartForBreaker(codeName, breakerReason);
|
|
5185
5190
|
}
|
|
5191
|
+
if (breakerReason && breakerReason !== "agent-requested" && breakerReason !== "channel-restart-flag") {
|
|
5192
|
+
const restartAgentId = agentState.codeNameToAgentId.get(codeName);
|
|
5193
|
+
if (restartAgentId) {
|
|
5194
|
+
void api.post("/host/restart-event", {
|
|
5195
|
+
agent_id: restartAgentId,
|
|
5196
|
+
source: breakerReason,
|
|
5197
|
+
reason: breakerReason
|
|
5198
|
+
}).catch((err) => log(`[restart-event] report failed for '${codeName}': ${err.message}`));
|
|
5199
|
+
}
|
|
5200
|
+
}
|
|
5186
5201
|
}
|
|
5187
5202
|
function checkMcpConfigDriftAndScheduleRestart(codeName, projectDir) {
|
|
5188
5203
|
const currentHash = projectMcpHash(codeName, projectDir);
|
|
@@ -5347,7 +5362,7 @@ var cachedMaintenanceWindow = null;
|
|
|
5347
5362
|
var lastVersionCheckAt = 0;
|
|
5348
5363
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
5349
5364
|
var lastResponsivenessProbeAt = 0;
|
|
5350
|
-
var agtCliVersion = true ? "0.28.
|
|
5365
|
+
var agtCliVersion = true ? "0.28.24" : "dev";
|
|
5351
5366
|
function resolveBrewPath(execFileSync4) {
|
|
5352
5367
|
try {
|
|
5353
5368
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -6427,6 +6442,25 @@ async function pollCycle() {
|
|
|
6427
6442
|
} finally {
|
|
6428
6443
|
clearTimeout(timer);
|
|
6429
6444
|
}
|
|
6445
|
+
},
|
|
6446
|
+
// ENG-6399: report the restart to audit_log via POST /host/restart-event.
|
|
6447
|
+
// Maps the flag's transport `source` onto the canonical audit source: the
|
|
6448
|
+
// in-session self-restart (request_restart, ENG-6229) is 'agent-self-request';
|
|
6449
|
+
// a channel /restart (slack/telegram) is 'channel-command'. Best-effort —
|
|
6450
|
+
// restart-handler calls this fire-and-forget so a reporting failure never
|
|
6451
|
+
// blocks the restart.
|
|
6452
|
+
reportRestartEvent: async (flag) => {
|
|
6453
|
+
const agentId = agentState.codeNameToAgentId.get(flag.codeName);
|
|
6454
|
+
if (!agentId) {
|
|
6455
|
+
log(`[restart-handler] no agent_id for '${flag.codeName}' \u2014 skipping restart-event report`);
|
|
6456
|
+
return;
|
|
6457
|
+
}
|
|
6458
|
+
const source = flag.source === "agent" ? "agent-self-request" : flag.source === "unknown" ? "unknown" : "channel-command";
|
|
6459
|
+
void api.post("/host/restart-event", {
|
|
6460
|
+
agent_id: agentId,
|
|
6461
|
+
source,
|
|
6462
|
+
...flag.reason ? { reason: flag.reason } : {}
|
|
6463
|
+
}).catch((err) => log(`[restart-event] report failed for '${flag.codeName}': ${err.message}`));
|
|
6430
6464
|
}
|
|
6431
6465
|
});
|
|
6432
6466
|
} catch (err) {
|
|
@@ -11739,12 +11773,32 @@ function startPolling() {
|
|
|
11739
11773
|
scheduleNext();
|
|
11740
11774
|
});
|
|
11741
11775
|
}
|
|
11776
|
+
async function reportSelfUpdateRestarts() {
|
|
11777
|
+
const liveAgents = [...agentState.persistentSessionAgents];
|
|
11778
|
+
if (liveAgents.length === 0) return;
|
|
11779
|
+
const reason = `CLI self-update${pendingUpgradeVersion ? ` to ${pendingUpgradeVersion}` : ""}`;
|
|
11780
|
+
const posts = Promise.allSettled(
|
|
11781
|
+
liveAgents.map((codeName) => {
|
|
11782
|
+
const agentId = agentState.codeNameToAgentId.get(codeName);
|
|
11783
|
+
if (!agentId) return Promise.resolve();
|
|
11784
|
+
return api.post("/host/restart-event", {
|
|
11785
|
+
agent_id: agentId,
|
|
11786
|
+
source: "self-update",
|
|
11787
|
+
reason
|
|
11788
|
+
});
|
|
11789
|
+
})
|
|
11790
|
+
).then(() => void 0);
|
|
11791
|
+
const deadline = new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
11792
|
+
await Promise.race([posts, deadline]);
|
|
11793
|
+
}
|
|
11742
11794
|
function scheduleNext() {
|
|
11743
11795
|
if (!running || !config) return;
|
|
11744
11796
|
const restartNow = () => {
|
|
11745
11797
|
log(`[self-update] Restarting manager to load upgraded binary (${pendingUpgradeVersion ?? "unknown version"})`);
|
|
11746
|
-
void
|
|
11747
|
-
|
|
11798
|
+
void reportSelfUpdateRestarts().catch((err) => log(`[self-update] restart-event audit failed: ${err.message}`)).finally(() => {
|
|
11799
|
+
void stopPolling({ forcedExitCode: SUPERVISOR_RESTART_EXIT_CODE }).then(() => {
|
|
11800
|
+
process.exit(SUPERVISOR_RESTART_EXIT_CODE);
|
|
11801
|
+
});
|
|
11748
11802
|
});
|
|
11749
11803
|
};
|
|
11750
11804
|
if (restartAfterUpgrade) {
|