@integrity-labs/agt-cli 0.28.22 → 0.28.23

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
@@ -33,7 +33,7 @@ import {
33
33
  success,
34
34
  table,
35
35
  warn
36
- } from "../chunk-O2QKTUOE.js";
36
+ } from "../chunk-JFSOYKVJ.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.22" : "dev";
4776
+ var cliVersion = true ? "0.28.23" : "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.22" : "dev";
5699
+ var cliVersion2 = true ? "0.28.23" : "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) => {
@@ -8291,4 +8291,4 @@ export {
8291
8291
  managerInstallSystemUnitCommand,
8292
8292
  managerUninstallSystemUnitCommand
8293
8293
  };
8294
- //# sourceMappingURL=chunk-O2QKTUOE.js.map
8294
+ //# sourceMappingURL=chunk-JFSOYKVJ.js.map
@@ -22,7 +22,7 @@ import {
22
22
  provisionStopHook,
23
23
  requireHost,
24
24
  safeWriteJsonAtomic
25
- } from "../chunk-O2QKTUOE.js";
25
+ } from "../chunk-JFSOYKVJ.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.22" : "dev";
5365
+ var agtCliVersion = true ? "0.28.23" : "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) {