@integrity-labs/agt-cli 0.28.779 → 0.28.780

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.
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
100
100
  return { ok: true };
101
101
  } catch {
102
102
  }
103
- const { resolveClaudeBinary } = await import("./persistent-session-GHIBAWHI.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-ETZBTCXU.js");
104
104
  const claudeBin = resolveClaudeBinary();
105
105
  const pairEnv = {
106
106
  ...process.env,
@@ -373,4 +373,4 @@ export {
373
373
  startClaudePair,
374
374
  submitClaudePairCode
375
375
  };
376
- //# sourceMappingURL=claude-pair-runtime-3J7KK6BP.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-CK34MZ6M.js.map
@@ -58,7 +58,7 @@ import {
58
58
  safeWriteJsonAtomic,
59
59
  setConfigHash,
60
60
  tripClass
61
- } from "../chunk-3IDAWL35.js";
61
+ } from "../chunk-VYFQRDSP.js";
62
62
  import {
63
63
  getProjectDir as getProjectDir2,
64
64
  getReadyTasks,
@@ -120,7 +120,7 @@ import {
120
120
  takeZombieDetection,
121
121
  toOpencodeModel,
122
122
  writeEgressAllowlist
123
- } from "../chunk-NTWABPKO.js";
123
+ } from "../chunk-HHFDK7WB.js";
124
124
  import {
125
125
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
126
126
  AnchorSessionClient,
@@ -143,6 +143,8 @@ import {
143
143
  SUPPRESS_SENTINEL,
144
144
  StreamEncoder,
145
145
  UNKNOWN_RATE_LIMIT,
146
+ agentHasRules,
147
+ agentRulesRestartBasis,
146
148
  appendDmFooter,
147
149
  attributeTranscriptUsageByRun,
148
150
  buildFailureCategoryPromptLines,
@@ -209,7 +211,7 @@ import {
209
211
  subagentActivityAgeSeconds,
210
212
  sumTranscriptUsageInWindow,
211
213
  transcriptActivityAgeSeconds
212
- } from "../chunk-LLBJLKGL.js";
214
+ } from "../chunk-REPC7LF2.js";
213
215
  import {
214
216
  reapOrphanChannelMcps
215
217
  } from "../chunk-XWVM4KPK.js";
@@ -6045,14 +6047,29 @@ var BASELINE_CONCERNS = [
6045
6047
  // reads it once at boot, so a change has to be delivered by a respawn, and
6046
6048
  // the baseline has to survive a manager restart or every deploy would look
6047
6049
  // like a first poll and respawn the fleet (ENG-7771).
6048
- "telegramPolicy"
6050
+ "telegramPolicy",
6051
+ // ENG-9861: the agent's standing rules (ENG-9789). Same shape and same reason
6052
+ // again — CLAUDE.md is read once at session start, so a rule added mid-session
6053
+ // is on disk and inert until an unrelated restart, and the baseline has to
6054
+ // survive a manager restart or every deploy looks like a first poll.
6055
+ //
6056
+ // Deliberately added WITHOUT bumping the format version. The version is
6057
+ // coupled to the hash SEMANTICS of existing concerns (invariant 2) and none
6058
+ // of those changed; a new key is additive, and an older sidecar lacking it
6059
+ // loads as an empty map, degrading to the first-poll fail-safe for THIS
6060
+ // concern only. Bumping instead would discard every agent's senderPolicy and
6061
+ // telegramPolicy baseline and take the whole fleet through a fail-closed
6062
+ // restart round to add a key — the precedent set when telegramPolicy itself
6063
+ // was added.
6064
+ "agentRules"
6049
6065
  ];
6050
6066
  function createDeliveryBaselineMaps() {
6051
6067
  return {
6052
6068
  senderPolicy: /* @__PURE__ */ new Map(),
6053
6069
  slackBehaviour: /* @__PURE__ */ new Map(),
6054
6070
  msteamsBehaviour: /* @__PURE__ */ new Map(),
6055
- telegramPolicy: /* @__PURE__ */ new Map()
6071
+ telegramPolicy: /* @__PURE__ */ new Map(),
6072
+ agentRules: /* @__PURE__ */ new Map()
6056
6073
  };
6057
6074
  }
6058
6075
  function getSenderPolicyBaselineFile(configDir) {
@@ -6631,6 +6648,13 @@ var agentState = {
6631
6648
  knownSenderPolicyHashes: /* @__PURE__ */ new Map(),
6632
6649
  /** ENG-9802: per-agent telegram chat-policy hash (allowlist / private-chats-only / peer kill switch). */
6633
6650
  knownTelegramPolicyHashes: /* @__PURE__ */ new Map(),
6651
+ /**
6652
+ * ENG-9861: per-agent hash of the RENDERED standing-rules section, so a rule
6653
+ * added mid-session is delivered to the running agent rather than sitting on
6654
+ * disk until an unrelated restart. Mirrors the sender/telegram policy maps
6655
+ * above and is persisted through the same sidecar (`agentRules` concern).
6656
+ */
6657
+ knownAgentRulesHashes: /* @__PURE__ */ new Map(),
6634
6658
  /**
6635
6659
  * ENG-6024: hash of the Teams behaviour subset (thread_auto_follow,
6636
6660
  * channel_response_mode, adaptive_cards_enabled/_ask_user_enabled) from the
@@ -6719,6 +6743,7 @@ function clearAgentState(agentId, codeName) {
6719
6743
  agentState.knownManagedMcpStructure.delete(agentId);
6720
6744
  agentState.knownSenderPolicyHashes.delete(agentId);
6721
6745
  agentState.knownTelegramPolicyHashes.delete(agentId);
6746
+ agentState.knownAgentRulesHashes.delete(agentId);
6722
6747
  agentState.knownMsTeamsBehaviourHashes.delete(agentId);
6723
6748
  agentState.knownSlackBehaviourHashes.delete(agentId);
6724
6749
  agentState.knownGlobalSkillIds.delete(agentId);
@@ -12721,6 +12746,11 @@ function scheduleSessionRestart(codeName, delayMs, reason, breakerReason = "hot-
12721
12746
  baselineAgentId,
12722
12747
  agentState.knownTelegramPolicyHashes.get(baselineAgentId)
12723
12748
  );
12749
+ persistDeliveryBaselineEntry(
12750
+ "agentRules",
12751
+ baselineAgentId,
12752
+ agentState.knownAgentRulesHashes.get(baselineAgentId)
12753
+ );
12724
12754
  }
12725
12755
  }
12726
12756
  runningMcpHashes.delete(codeName);
@@ -12870,7 +12900,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
12870
12900
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
12871
12901
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
12872
12902
  async function channelInboundActivityAgeSecondsFor(codeName) {
12873
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-TT3LAALK.js");
12903
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-EWUJOLVA.js");
12874
12904
  const newest = newestPendingInboundActivityMtimeMs(dirname10(paneLogPath(codeName)));
12875
12905
  if (newest === null) return null;
12876
12906
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -13530,7 +13560,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
13530
13560
  var lastVersionCheckAt = 0;
13531
13561
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13532
13562
  var lastResponsivenessProbeAt = 0;
13533
- var agtCliVersion = true ? "0.28.779" : "dev";
13563
+ var agtCliVersion = true ? "0.28.780" : "dev";
13534
13564
  function resolveBrewPath(execFileSync2) {
13535
13565
  try {
13536
13566
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -14788,6 +14818,9 @@ function loadSenderPolicyBaseline2() {
14788
14818
  for (const [agentId, hash] of persistedDeliveryBaseline.telegramPolicy) {
14789
14819
  agentState.knownTelegramPolicyHashes.set(agentId, hash);
14790
14820
  }
14821
+ for (const [agentId, hash] of persistedDeliveryBaseline.agentRules) {
14822
+ agentState.knownAgentRulesHashes.set(agentId, hash);
14823
+ }
14791
14824
  }
14792
14825
  var deliveryBaselineDirty = false;
14793
14826
  function saveDeliveryBaseline() {
@@ -15074,7 +15107,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
15074
15107
  if (codeNames.length === 0) return;
15075
15108
  void (async () => {
15076
15109
  try {
15077
- const { collectDiagnostics } = await import("../persistent-session-GHIBAWHI.js");
15110
+ const { collectDiagnostics } = await import("../persistent-session-ETZBTCXU.js");
15078
15111
  await api.post("/host/heartbeat", {
15079
15112
  host_id: hostId,
15080
15113
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -15215,7 +15248,7 @@ async function pollCycleInner() {
15215
15248
  }
15216
15249
  try {
15217
15250
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
15218
- const { collectDiagnostics } = await import("../persistent-session-GHIBAWHI.js");
15251
+ const { collectDiagnostics } = await import("../persistent-session-ETZBTCXU.js");
15219
15252
  const diagCodeNames = [...agentState.persistentSessionAgents];
15220
15253
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor) : void 0;
15221
15254
  let tailscaleHostname;
@@ -15384,7 +15417,7 @@ async function pollCycleInner() {
15384
15417
  collectPanelessActivityProbes,
15385
15418
  getResponsivenessIntervalMs,
15386
15419
  occupancyQualificationClassifications
15387
- } = await import("../responsiveness-probe-TT3LAALK.js");
15420
+ } = await import("../responsiveness-probe-EWUJOLVA.js");
15388
15421
  const probeIntervalMs = getResponsivenessIntervalMs();
15389
15422
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
15390
15423
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -15494,7 +15527,7 @@ async function pollCycleInner() {
15494
15527
  collectResponsivenessProbes,
15495
15528
  livePendingInboundOldestAgeSeconds,
15496
15529
  parkPendingInbound
15497
- } = await import("../responsiveness-probe-TT3LAALK.js");
15530
+ } = await import("../responsiveness-probe-EWUJOLVA.js");
15498
15531
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-NDP36U7O.js");
15499
15532
  const wedgeNow = /* @__PURE__ */ new Date();
15500
15533
  const liveAgents = agentState.persistentSessionAgents;
@@ -15650,7 +15683,7 @@ async function pollCycleInner() {
15650
15683
  }
15651
15684
  try {
15652
15685
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-JA437JIB.js");
15653
- const { probeSessionAuth } = await import("../session-auth-dead-OHPGSHYL.js");
15686
+ const { probeSessionAuth } = await import("../session-auth-dead-TDPTLVBO.js");
15654
15687
  const observations = [];
15655
15688
  const pendingCacheCommits = [];
15656
15689
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -17332,6 +17365,57 @@ async function processAgent(agent, agentStates, managedToolkits) {
17332
17365
  agentState.knownTelegramPolicyHashes.delete(agent.agent_id);
17333
17366
  removeDeliveryBaselineEntry("telegramPolicy", agent.agent_id);
17334
17367
  }
17368
+ {
17369
+ const agentRules = refreshData.agent_rules ?? [];
17370
+ const agentRulesHash = createHash20("sha256").update(agentRulesRestartBasis(agentRules)).digest("hex");
17371
+ const prevAgentRulesHash = agentState.knownAgentRulesHashes.get(agent.agent_id);
17372
+ const rulesPresent = agentHasRules(agentRules);
17373
+ const agentRulesDecision = decideSenderPolicyRestart({
17374
+ previousHash: prevAgentRulesHash,
17375
+ currentPolicyRestrictive: rulesPresent,
17376
+ currentHash: agentRulesHash,
17377
+ sessionMode: spSessionMode,
17378
+ framework: spFramework,
17379
+ sessionHealthy: spSessionHealthy,
17380
+ // Any earlier restart this tick already respawns the session, which
17381
+ // re-reads CLAUDE.md for free. A second would only coalesce and overwrite
17382
+ // a friendlier notice.
17383
+ channelSetRestartAlreadyScheduled: channelSetRestartScheduled || senderPolicyDecision.restart || msteamsBehaviourRestartScheduled || slackBehaviourRestartScheduled
17384
+ });
17385
+ if (agentRulesDecision.restart) {
17386
+ const isRulesVerifyRestart = agentRulesDecision.firstPoll;
17387
+ log(
17388
+ isRulesVerifyRestart ? `[hot-reload] standing-rules delivery baseline unknown for '${agent.code_name}' with rules set (\u2192 ${agentRulesHash.slice(0, 8)}) \u2014 restarting session so the rendered rules are actually in force (fail closed, ENG-9861)` : `[hot-reload] standing rules changed for '${agent.code_name}' (${prevAgentRulesHash?.slice(0, 8) ?? "first"} \u2192 ${agentRulesHash.slice(0, 8)}) \u2014 restarting session`
17389
+ );
17390
+ const rulesNotice = isRulesVerifyRestart ? "Your manager was updated and needs to restart your session to make sure the standing rules you have been given are actually in force." : "Your standing rules have changed. Restarting session shortly so they take effect - until then you are still running on the previous set.";
17391
+ const rulesDelivered = await injectMessage(
17392
+ agent.code_name,
17393
+ "system",
17394
+ rulesNotice + BACK_ONLINE_GREETING_GUIDANCE,
17395
+ { task_name: "standing-rules-update" },
17396
+ log
17397
+ ).catch(() => false);
17398
+ const rulesDelay = rulesDelivered ? 8e3 : 3e3;
17399
+ if (!rulesDelivered) {
17400
+ log(
17401
+ `[hot-reload] Inject notification unconfirmed for '${agent.code_name}' \u2014 proceeding with shorter delay`
17402
+ );
17403
+ }
17404
+ scheduleSessionRestart(
17405
+ agent.code_name,
17406
+ rulesDelay,
17407
+ isRulesVerifyRestart ? "standing-rules verify (unknown baseline)" : "standing-rules change",
17408
+ "agent-rules-change"
17409
+ );
17410
+ }
17411
+ agentState.knownAgentRulesHashes.set(agent.agent_id, agentRulesHash);
17412
+ const hasLiveRulesConsumer = spSessionHealthy && spSessionMode === "persistent" && spFramework === "claude-code";
17413
+ if (!hasLiveRulesConsumer) {
17414
+ persistDeliveryBaselineEntry("agentRules", agent.agent_id, agentRulesHash);
17415
+ } else if (agentRulesDecision.firstPoll && !rulesPresent) {
17416
+ persistDeliveryBaselineEntry("agentRules", agent.agent_id, agentRulesHash);
17417
+ }
17418
+ }
17335
17419
  }
17336
17420
  const agentSessionMode = refreshData.agent.session_mode;
17337
17421
  if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code") {
@@ -19690,7 +19774,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
19690
19774
  void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
19691
19775
  void (async () => {
19692
19776
  try {
19693
- const { collectDiagnostics } = await import("../persistent-session-GHIBAWHI.js");
19777
+ const { collectDiagnostics } = await import("../persistent-session-ETZBTCXU.js");
19694
19778
  await api.post("/host/heartbeat", {
19695
19779
  host_id: hostId,
19696
19780
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -19736,7 +19820,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
19736
19820
  }
19737
19821
  try {
19738
19822
  const hostId = await getHostId();
19739
- const { collectDiagnostics } = await import("../persistent-session-GHIBAWHI.js");
19823
+ const { collectDiagnostics } = await import("../persistent-session-ETZBTCXU.js");
19740
19824
  await api.post("/host/heartbeat", {
19741
19825
  host_id: hostId,
19742
19826
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor)
@@ -20372,7 +20456,7 @@ async function processClaudePairSessions(agents) {
20372
20456
  killPairSession,
20373
20457
  pairTmuxSession,
20374
20458
  finalizeClaudePairOnboarding
20375
- } = await import("../claude-pair-runtime-3J7KK6BP.js");
20459
+ } = await import("../claude-pair-runtime-CK34MZ6M.js");
20376
20460
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
20377
20461
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
20378
20462
  const killed = await killPairSession(pairTmuxSession(pairId));