@integrity-labs/agt-cli 0.28.473 → 0.28.474

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
@@ -40,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-VHWLFDME.js";
43
+ } from "../chunk-C47UJ5QI.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -4830,7 +4830,7 @@ import { execFileSync, execSync } from "child_process";
4830
4830
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4831
4831
  import chalk18 from "chalk";
4832
4832
  import ora16 from "ora";
4833
- var cliVersion = true ? "0.28.473" : "dev";
4833
+ var cliVersion = true ? "0.28.474" : "dev";
4834
4834
  async function fetchLatestVersion() {
4835
4835
  const host2 = getHost();
4836
4836
  if (!host2) return null;
@@ -6002,7 +6002,7 @@ function handleError(err) {
6002
6002
  }
6003
6003
 
6004
6004
  // src/bin/agt.ts
6005
- var cliVersion2 = true ? "0.28.473" : "dev";
6005
+ var cliVersion2 = true ? "0.28.474" : "dev";
6006
6006
  var program = new Command();
6007
6007
  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");
6008
6008
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -4932,7 +4932,7 @@ function exchangeFailureKind(err) {
4932
4932
  }
4933
4933
 
4934
4934
  // src/lib/api-client.ts
4935
- var agtCliVersion = true ? "0.28.473" : "dev";
4935
+ var agtCliVersion = true ? "0.28.474" : "dev";
4936
4936
  var lastConfigHash = null;
4937
4937
  function setConfigHash(hash) {
4938
4938
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7661,4 +7661,4 @@ export {
7661
7661
  managerInstallSystemUnitCommand,
7662
7662
  managerUninstallSystemUnitCommand
7663
7663
  };
7664
- //# sourceMappingURL=chunk-VHWLFDME.js.map
7664
+ //# sourceMappingURL=chunk-C47UJ5QI.js.map
@@ -44,7 +44,7 @@ import {
44
44
  resolveEffectivePinRaw,
45
45
  safeWriteJsonAtomic,
46
46
  setConfigHash
47
- } from "../chunk-VHWLFDME.js";
47
+ } from "../chunk-C47UJ5QI.js";
48
48
  import {
49
49
  getProjectDir as getProjectDir2,
50
50
  getReadyTasks,
@@ -2576,6 +2576,59 @@ async function getClaudeAccountFingerprint(paths, nowMs = Date.now()) {
2576
2576
  return lastKnownFingerprint;
2577
2577
  }
2578
2578
 
2579
+ // src/lib/auth-tuple-diff.ts
2580
+ var ABSENT2 = "none";
2581
+ var COMPONENT_ORDER = [
2582
+ "auth_mode",
2583
+ "anthropic_api_key_fingerprint",
2584
+ "claude_account_fingerprint",
2585
+ "openrouter_fingerprint"
2586
+ ];
2587
+ function parseAuthTuple(tuple) {
2588
+ const raw = typeof tuple === "string" ? tuple : "";
2589
+ if (raw.startsWith("openrouter:")) {
2590
+ return {
2591
+ auth_mode: "openrouter",
2592
+ openrouter_fingerprint: raw.slice("openrouter:".length) || ABSENT2
2593
+ };
2594
+ }
2595
+ const parts = raw.split(":");
2596
+ if (parts.length < 2) {
2597
+ return { auth_mode: raw || ABSENT2 };
2598
+ }
2599
+ return {
2600
+ auth_mode: parts[0] || ABSENT2,
2601
+ anthropic_api_key_fingerprint: parts[1] || ABSENT2,
2602
+ // Omitted from the string when there is no signed-in account fingerprint
2603
+ // (api_key mode, or subscription mode before the first successful read).
2604
+ // Recorded as the ABSENT sentinel so "account appeared" / "account
2605
+ // disappeared" is itself visible as a change.
2606
+ claude_account_fingerprint: parts[2] || ABSENT2
2607
+ };
2608
+ }
2609
+ function diffAuthTuples(recorded, current) {
2610
+ const before = parseAuthTuple(recorded);
2611
+ const after = parseAuthTuple(current);
2612
+ const names = [
2613
+ ...COMPONENT_ORDER.filter((n) => n in before || n in after),
2614
+ // Anything unexpected (a tuple shape a newer manager introduced) still gets
2615
+ // reported rather than dropped — this path must never hide a change.
2616
+ ...Object.keys({ ...before, ...after }).filter((n) => !COMPONENT_ORDER.includes(n)).sort()
2617
+ ];
2618
+ const components = names.map((component) => {
2619
+ const from = before[component] ?? ABSENT2;
2620
+ const to = after[component] ?? ABSENT2;
2621
+ return { component, changed: from !== to, from, to };
2622
+ });
2623
+ const changed = components.filter((c) => c.changed).map((c) => c.component);
2624
+ const unchanged = components.filter((c) => !c.changed).map((c) => c.component);
2625
+ const summary = changed.length === 0 ? "auth-tuple-change: no component differs (tuple string re-formatted)" : `auth-tuple-change: ${changed.map((name) => {
2626
+ const c = components.find((x) => x.component === name);
2627
+ return `${name} ${c.from}\u2192${c.to}`;
2628
+ }).join(", ")}${unchanged.length > 0 ? ` (unchanged: ${unchanged.join(", ")})` : ""}`;
2629
+ return { changed, unchanged, components, summary };
2630
+ }
2631
+
2579
2632
  // src/lib/account-enforcement-marker.ts
2580
2633
  import { mkdirSync as mkdirSync5, renameSync, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
2581
2634
  import { homedir as homedir6 } from "os";
@@ -9818,7 +9871,7 @@ async function runAgentSessionToolBindProbes(agent, integrations, projectDir, op
9818
9871
  }
9819
9872
  return result != null;
9820
9873
  }
9821
- function stopPersistentSessionAndForgetMcpBaseline(codeName, breakerReason, gateReason = breakerReason, runClose) {
9874
+ function stopPersistentSessionAndForgetMcpBaseline(codeName, breakerReason, gateReason = breakerReason, runClose, auditDetail) {
9822
9875
  const gate = restartGateFor(codeName, gateReason);
9823
9876
  if (gate !== "bypass" && gate !== "proceed") {
9824
9877
  log(`[maintenance-window] Deferring '${gateReason}' restart for '${codeName}' (${gate})`);
@@ -9844,7 +9897,10 @@ function stopPersistentSessionAndForgetMcpBaseline(codeName, breakerReason, gate
9844
9897
  void api.post("/host/restart-event", {
9845
9898
  agent_id: restartAgentId,
9846
9899
  source: breakerReason,
9847
- reason: breakerReason
9900
+ // ENG-8293: fall back to the source string (the pre-ENG-8293 shape)
9901
+ // only when the caller supplied nothing better.
9902
+ reason: auditDetail?.reason ?? breakerReason,
9903
+ ...auditDetail?.detail ? { detail: auditDetail.detail } : {}
9848
9904
  }).catch((err) => log(`[restart-event] report failed for '${codeName}': ${err.message}`));
9849
9905
  }
9850
9906
  }
@@ -10038,7 +10094,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
10038
10094
  var lastVersionCheckAt = 0;
10039
10095
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
10040
10096
  var lastResponsivenessProbeAt = 0;
10041
- var agtCliVersion = true ? "0.28.473" : "dev";
10097
+ var agtCliVersion = true ? "0.28.474" : "dev";
10042
10098
  function resolveBrewPath(execFileSync2) {
10043
10099
  try {
10044
10100
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -14500,8 +14556,20 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
14500
14556
  const currentAuthTuple = openRouterForAgent ? `openrouter:${openRouterForAgent.fingerprint ?? openRouterForAgent.model}` : `${claudeAuthMode}:${anthropicApiKeyFingerprint ?? "none"}${claudeAccountFingerprint ? `:${claudeAccountFingerprint}` : ""}`;
14501
14557
  const recordedAuthTuple = claudeAuthTupleBySession.get(codeName);
14502
14558
  if (recordedAuthTuple && recordedAuthTuple !== currentAuthTuple && isSessionHealthy(codeName)) {
14503
- log(`[persistent-session] Auth config changed for '${codeName}' (${recordedAuthTuple} \u2192 ${currentAuthTuple}) \u2014 restarting session`);
14504
- stopPersistentSessionAndForgetMcpBaseline(codeName, "auth-tuple-change");
14559
+ const authTupleDiff = diffAuthTuples(recordedAuthTuple, currentAuthTuple);
14560
+ log(
14561
+ `[persistent-session] Auth config changed for '${codeName}' (${recordedAuthTuple} \u2192 ${currentAuthTuple}) \u2014 ${authTupleDiff.summary} \u2014 restarting session`
14562
+ );
14563
+ stopPersistentSessionAndForgetMcpBaseline(codeName, "auth-tuple-change", void 0, void 0, {
14564
+ reason: authTupleDiff.summary,
14565
+ detail: {
14566
+ auth_tuple: {
14567
+ changed: authTupleDiff.changed,
14568
+ unchanged: authTupleDiff.unchanged,
14569
+ components: authTupleDiff.components
14570
+ }
14571
+ }
14572
+ });
14505
14573
  agentState.persistentSessionAgents.delete(codeName);
14506
14574
  restartTrigger = "auth-tuple";
14507
14575
  }