@integrity-labs/agt-cli 0.28.1218 → 0.28.1219

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.
@@ -85,7 +85,7 @@ import {
85
85
  tripClass,
86
86
  writeEtcEnvironment,
87
87
  writeProfileDScript
88
- } from "../chunk-2TSVU3OU.js";
88
+ } from "../chunk-QGMGROLF.js";
89
89
  import {
90
90
  CLAUDE_CODE_SECURITY_FLOOR,
91
91
  SELF_UPDATE_TIMEOUTS,
@@ -16387,6 +16387,8 @@ var frameworkBinaryChecked = /* @__PURE__ */ new Set();
16387
16387
  var frameworkBinaryInflight = /* @__PURE__ */ new Map();
16388
16388
  var agentRuntimeAuthenticated = false;
16389
16389
  var lastManagedSettingsStatus = null;
16390
+ var lastCrossSessionBlockStatus = null;
16391
+ var agentRosterFetched = false;
16390
16392
  function resolveAgentFramework(codeName) {
16391
16393
  const frameworkId = agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
16392
16394
  return getFramework(frameworkId);
@@ -16447,7 +16449,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
16447
16449
  var lastVersionCheckAt = 0;
16448
16450
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
16449
16451
  var lastResponsivenessProbeAt = 0;
16450
- var agtCliVersion = true ? "0.28.1218" : "dev";
16452
+ var agtCliVersion = true ? "0.28.1219" : "dev";
16451
16453
  function resolveBrewPath(execFileSync3) {
16452
16454
  try {
16453
16455
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -17011,7 +17013,62 @@ function claudeManagedSettingsPath() {
17011
17013
  }
17012
17014
  var MANAGED_SETTINGS_KEYS = ["channelsEnabled", "enableAllProjectMcpServers"];
17013
17015
  var MANAGED_SETTINGS_ENV = { DISABLE_AUTOUPDATER: "1" };
17014
- function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
17016
+ var CROSS_SESSION_DENY = ["SendMessage", "ListAgents"];
17017
+ var CROSS_SESSION_INBOUND = "refuse";
17018
+ function crossSessionBlockReport(frameworks, rosterFetched, readStatus) {
17019
+ if (frameworks.includes("claude-code")) return readStatus();
17020
+ if (frameworks.length === 0 && !rosterFetched) return null;
17021
+ return frameworks.includes(void 0) ? null : "not_applicable";
17022
+ }
17023
+ function rosterFromHostAgents(agents) {
17024
+ if (!Array.isArray(agents)) throw new Error("/host/agents answered without an agents array");
17025
+ return agents;
17026
+ }
17027
+ function deniedTools(settings) {
17028
+ const permissions = settings["permissions"];
17029
+ if (!permissions || typeof permissions !== "object" || Array.isArray(permissions)) return [];
17030
+ const deny = permissions["deny"];
17031
+ return Array.isArray(deny) ? deny : [];
17032
+ }
17033
+ function readCrossSessionBlockStatus(path = claudeManagedSettingsPath()) {
17034
+ try {
17035
+ const parsed = JSON.parse(readFileSync35(path, "utf-8"));
17036
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return "missing";
17037
+ const settings = parsed;
17038
+ const deny = deniedTools(settings);
17039
+ return settings["crossSessionInbound"] === CROSS_SESSION_INBOUND && CROSS_SESSION_DENY.every((tool) => deny.includes(tool)) ? "enforced" : "missing";
17040
+ } catch {
17041
+ return "missing";
17042
+ }
17043
+ }
17044
+ function managedSettingsOwnership(path) {
17045
+ try {
17046
+ const st = statSync15(path);
17047
+ return { mode: st.mode & 4095, uid: st.uid, gid: st.gid };
17048
+ } catch {
17049
+ return { mode: 420 };
17050
+ }
17051
+ }
17052
+ function writeManagedSettings(path, body, write = {
17053
+ atomic: (p, d) => atomicWriteFileSync(p, d, managedSettingsOwnership(p)),
17054
+ inPlace: (p, d) => writeFileSync18(p, d)
17055
+ }) {
17056
+ try {
17057
+ write.atomic(path, body);
17058
+ return "atomic";
17059
+ } catch (err) {
17060
+ const code = err.code;
17061
+ if ((code === "EACCES" || code === "EPERM" || code === "EROFS") && existsSync19(path)) {
17062
+ write.inPlace(path, body);
17063
+ log(`[managed-settings] ${path}: directory refused the atomic write (${code}); wrote in place (ENG-10191)`);
17064
+ return "in_place";
17065
+ }
17066
+ throw err;
17067
+ }
17068
+ }
17069
+ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath(), write = (p, b) => {
17070
+ writeManagedSettings(p, b);
17071
+ }) {
17015
17072
  try {
17016
17073
  let settings = {};
17017
17074
  if (existsSync19(path)) {
@@ -17033,18 +17090,41 @@ function ensureClaudeManagedSettings(path = claudeManagedSettingsPath()) {
17033
17090
  const existingEnv = settings["env"];
17034
17091
  const env = existingEnv && typeof existingEnv === "object" && !Array.isArray(existingEnv) ? existingEnv : {};
17035
17092
  const missingEnv = Object.entries(MANAGED_SETTINGS_ENV).filter(([k, v]) => env[k] !== v);
17036
- if (missing.length === 0 && missingEnv.length === 0) return "ok";
17093
+ const deny = deniedTools(settings);
17094
+ const missingDeny = CROSS_SESSION_DENY.filter((tool) => !deny.includes(tool));
17095
+ const inboundWrong = settings["crossSessionInbound"] !== CROSS_SESSION_INBOUND;
17096
+ if (missing.length === 0 && missingEnv.length === 0 && missingDeny.length === 0 && !inboundWrong) {
17097
+ return "ok";
17098
+ }
17037
17099
  for (const key of missing) settings[key] = true;
17100
+ if (missingDeny.length > 0) {
17101
+ const existingPermissions = settings["permissions"];
17102
+ settings["permissions"] = {
17103
+ ...existingPermissions && typeof existingPermissions === "object" && !Array.isArray(existingPermissions) ? existingPermissions : {},
17104
+ deny: [...deny, ...missingDeny]
17105
+ };
17106
+ }
17107
+ if (inboundWrong) settings["crossSessionInbound"] = CROSS_SESSION_INBOUND;
17038
17108
  if (missingEnv.length > 0) {
17039
17109
  for (const [k, v] of missingEnv) env[k] = v;
17040
17110
  settings["env"] = env;
17041
17111
  }
17042
- mkdirSync16(dirname11(path), { recursive: true });
17043
- writeFileSync18(path, `${JSON.stringify(settings, null, 2)}
17044
- `);
17112
+ const channelKeysNeeded = missing.length > 0 || missingEnv.length > 0;
17113
+ const body = `${JSON.stringify(settings, null, 2)}
17114
+ `;
17115
+ try {
17116
+ mkdirSync16(dirname11(path), { recursive: true });
17117
+ write(path, body);
17118
+ } catch (err) {
17119
+ if (channelKeysNeeded) throw err;
17120
+ log(`[managed-settings] could not add the cross-session block to ${path}: ${err.message} - channel keys already present, so channels are unaffected; cross_session_block_missing will report it (ENG-10191)`);
17121
+ return "ok";
17122
+ }
17045
17123
  const changed = [
17046
17124
  ...missing.map((k) => `${k}:true`),
17047
- ...missingEnv.map(([k, v]) => `env.${k}=${v}`)
17125
+ ...missingEnv.map(([k, v]) => `env.${k}=${v}`),
17126
+ ...missingDeny.map((tool) => `permissions.deny+=${tool}`),
17127
+ ...inboundWrong ? [`crossSessionInbound=${CROSS_SESSION_INBOUND}`] : []
17048
17128
  ];
17049
17129
  log(`[managed-settings] set ${changed.join(", ")} in ${path} (ENG-5786 unblocks Claude Code channels; ENG-9223 pre-approves project MCP servers so a headless session never freezes on the trust prompt; ENG-10620 disables Claude Code's self-updater for every launch so the fleet pin holds)`);
17050
17130
  return "ok";
@@ -18548,6 +18628,11 @@ async function pollCycleInner() {
18548
18628
  } else {
18549
18629
  lastManagedSettingsStatus = null;
18550
18630
  }
18631
+ lastCrossSessionBlockStatus = crossSessionBlockReport(
18632
+ state9.agents.map((a) => agentFrameworkCache.get(a.codeName)),
18633
+ agentRosterFetched,
18634
+ () => readCrossSessionBlockStatus()
18635
+ );
18551
18636
  await refreshHostNodeObservation();
18552
18637
  const hostNodePin = hostNodeConvergence.desiredPin();
18553
18638
  const hbResp = await api.post("/host/heartbeat", {
@@ -18609,6 +18694,8 @@ async function pollCycleInner() {
18609
18694
  // Omitted (undefined) on hosts that haven't run the assertion
18610
18695
  // (non-claude-code frameworks).
18611
18696
  channels_setting_status: lastManagedSettingsStatus ?? void 0,
18697
+ // ENG-10191: is the cross-session block in the managed file right now?
18698
+ cross_session_block_status: lastCrossSessionBlockStatus ?? void 0,
18612
18699
  // ENG-9252: agents whose channel credential sync has failed to converge
18613
18700
  // for longer than CHANNEL_SYNC_STUCK_AFTER_MS. The API opens/closes a
18614
18701
  // per-agent alert on the edge, exactly as it does for
@@ -19455,7 +19542,7 @@ async function pollCycleInner() {
19455
19542
  log(`[mcp-banner] collection failed: ${err.message}`);
19456
19543
  }
19457
19544
  const data = await api.post("/host/agents", { host_id: hostId });
19458
- const agents = data.agents ?? [];
19545
+ const agents = rosterFromHostAgents(data.agents);
19459
19546
  pairableAgentsSnapshot = agents.map((a) => ({
19460
19547
  agentId: a.agent_id,
19461
19548
  codeName: a.code_name
@@ -20091,6 +20178,7 @@ async function pollCycleInner() {
20091
20178
  // ENG-6088: spent auto-resume credits survive manager restarts too.
20092
20179
  circuitBreakerAutoResumes: Object.fromEntries(autoResumeMarkers.entries())
20093
20180
  };
20181
+ agentRosterFetched = true;
20094
20182
  if (consecutivePollFailures > 0) {
20095
20183
  log(`[poll-backoff] recovered after ${consecutivePollFailures} failure(s), resuming normal interval`);
20096
20184
  consecutivePollFailures = 0;
@@ -26380,6 +26468,7 @@ export {
26380
26468
  createManagedPruneLedger,
26381
26469
  createManagedToolkitReader,
26382
26470
  creditInboundHold,
26471
+ crossSessionBlockReport,
26383
26472
  dashboardRestartBreakerReason,
26384
26473
  decideDayRolloverAction,
26385
26474
  ensureClaudeManagedSettings,
@@ -26394,6 +26483,7 @@ export {
26394
26483
  isOlderSemverTuple,
26395
26484
  isPrereleaseVersion,
26396
26485
  jitteredRealtimeRebindBackoffMs,
26486
+ managedSettingsOwnership,
26397
26487
  markAgentForFreshMemorySync,
26398
26488
  maybeInjectKanbanCheck,
26399
26489
  maybeProbeClaudeRuntimeAuth,
@@ -26401,6 +26491,7 @@ export {
26401
26491
  memoryManifestPath,
26402
26492
  memoryManifests,
26403
26493
  pruneRealtimeRebindState,
26494
+ readCrossSessionBlockStatus,
26404
26495
  realtimeRebindBackoffMs,
26405
26496
  realtimeRebindDue,
26406
26497
  reapLegacyTokenFileEdgeWarned,
@@ -26411,6 +26502,7 @@ export {
26411
26502
  resolveManagedMcpServerId,
26412
26503
  restartReasonBindsNewMcp,
26413
26504
  retiredMemoryDir,
26505
+ rosterFromHostAgents,
26414
26506
  sameChannelSet,
26415
26507
  selfUpdateLatchVerdict,
26416
26508
  shouldLogChannelSyncFailure,
@@ -26424,6 +26516,7 @@ export {
26424
26516
  stuckChannelSyncs,
26425
26517
  stuckRealtimeRebinds,
26426
26518
  supersededRuntimeImageIds,
26427
- verifiedChannelCredentials
26519
+ verifiedChannelCredentials,
26520
+ writeManagedSettings
26428
26521
  };
26429
26522
  //# sourceMappingURL=manager-worker.js.map