@integrity-labs/agt-cli 0.28.323 → 0.28.325

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-5FKI4NCL.js");
103
+ const { resolveClaudeBinary } = await import("./persistent-session-BICDYHOC.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-JSOSBAH3.js.map
376
+ //# sourceMappingURL=claude-pair-runtime-BOFTEAQC.js.map
@@ -43,7 +43,7 @@ import {
43
43
  requireHost,
44
44
  safeWriteJsonAtomic,
45
45
  setConfigHash
46
- } from "../chunk-MLXFGOLB.js";
46
+ } from "../chunk-BATSDQD7.js";
47
47
  import {
48
48
  getProjectDir as getProjectDir2,
49
49
  getReadyTasks,
@@ -132,7 +132,7 @@ import {
132
132
  takeZombieDetection,
133
133
  transcriptActivityAgeSeconds,
134
134
  writeEgressAllowlist
135
- } from "../chunk-JTQ6RYGM.js";
135
+ } from "../chunk-BSTFCC62.js";
136
136
  import {
137
137
  reapOrphanChannelMcps
138
138
  } from "../chunk-XWVM4KPK.js";
@@ -4641,6 +4641,9 @@ async function maybeSendTelegramFollowUpHint(agentCodeName, botToken, chatId) {
4641
4641
  }
4642
4642
 
4643
4643
  // src/lib/manager/delivery/state.ts
4644
+ function toPreferredChannel(raw) {
4645
+ return raw === "slack" || raw === "telegram" ? raw : null;
4646
+ }
4644
4647
  var agentInfoForDelivery = /* @__PURE__ */ new Map();
4645
4648
  function cacheAgentDeliveryMetadata(codeName, refreshData) {
4646
4649
  const agentRow = refreshData["agent"] ?? {};
@@ -4672,7 +4675,8 @@ function cacheAgentDeliveryMetadata(codeName, refreshData) {
4672
4675
  person_id: reportsToPersonId,
4673
4676
  display_name: agentRow["reports_to_name"] ?? "Reports-To",
4674
4677
  slack_user_id: agentRow["reports_to_slack_user_id"] ?? null,
4675
- telegram_chat_id: agentRow["reports_to_telegram_chat_id"] ?? null
4678
+ telegram_chat_id: agentRow["reports_to_telegram_chat_id"] ?? null,
4679
+ preferred_channel: toPreferredChannel(agentRow["reports_to_approval_notify_channel"])
4676
4680
  });
4677
4681
  }
4678
4682
  const people = refreshData["people"] ?? [];
@@ -4684,7 +4688,8 @@ function cacheAgentDeliveryMetadata(codeName, refreshData) {
4684
4688
  person_id: personId,
4685
4689
  display_name: p["display_name"] ?? "person",
4686
4690
  slack_user_id: contactPrefs["slack_user_id"] ?? null,
4687
- telegram_chat_id: contactPrefs["telegram_chat_id"] ?? null
4691
+ telegram_chat_id: contactPrefs["telegram_chat_id"] ?? null,
4692
+ preferred_channel: toPreferredChannel(contactPrefs["approval_notify_channel"])
4688
4693
  });
4689
4694
  }
4690
4695
  agentInfoForDelivery.set(codeName, {
@@ -5984,6 +5989,11 @@ function decideModeForward(evt, policy) {
5984
5989
  const label = extractAugmentedSlackLabel(evt);
5985
5990
  if (!label)
5986
5991
  return { forward: false, reason: "sender_policy" };
5992
+ if (policy.registeredAgentSlackUserIds !== void 0) {
5993
+ if (typeof evt.user !== "string" || !policy.registeredAgentSlackUserIds.has(evt.user)) {
5994
+ return { forward: false, reason: "sender_policy" };
5995
+ }
5996
+ }
5987
5997
  if (policy.mode === "team_agents_only" || policy.mode === "manager_only" || policy.mode === "team_only") {
5988
5998
  if (!policy.teamId || label.teamId !== policy.teamId) {
5989
5999
  return { forward: false, reason: "sender_policy" };
@@ -6074,7 +6084,8 @@ function parsePeersEnv(raw, gateRaw) {
6074
6084
  return [];
6075
6085
  const gateMap = /* @__PURE__ */ new Map();
6076
6086
  let gateConfigInvalid = false;
6077
- if (gateRaw && gateRaw.trim().length > 0) {
6087
+ const gatePresent = !!(gateRaw && gateRaw.trim().length > 0);
6088
+ if (gatePresent) {
6078
6089
  try {
6079
6090
  const gateParsed = JSON.parse(gateRaw);
6080
6091
  if (!gateParsed || typeof gateParsed !== "object" || Array.isArray(gateParsed)) {
@@ -6117,6 +6128,8 @@ function parsePeersEnv(raw, gateRaw) {
6117
6128
  peer.gate_path = null;
6118
6129
  } else if (gateMap.has(e.bot_user_id)) {
6119
6130
  peer.gate_path = gateMap.get(e.bot_user_id) ?? null;
6131
+ } else if (gatePresent) {
6132
+ peer.gate_path = null;
6120
6133
  }
6121
6134
  out.push(peer);
6122
6135
  }
@@ -6247,23 +6260,27 @@ function buildSlackSenderPolicyFromEnv(env, ctx) {
6247
6260
  throw new Error("SLACK_INTERNAL_ONLY=true requires SLACK_HOME_TEAM_ID. The bot install must have a known team_id (run auth.test against the workspace and persist the result).");
6248
6261
  }
6249
6262
  const internalOnlyFields = internalOnly ? { internalOnly: true, homeTeamId } : {};
6263
+ const slackPeersRaw = env["SLACK_PEERS"];
6264
+ const registryFields = slackPeersRaw && slackPeersRaw.trim().length > 0 ? {
6265
+ registeredAgentSlackUserIds: new Set(parsePeersEnv(slackPeersRaw, env["SLACK_PEERS_GATE"]).map((p) => p.bot_user_id))
6266
+ } : {};
6250
6267
  const teamId = ctx.agentTeamId;
6251
6268
  if (raw === "all")
6252
- return { mode: "all", ...internalOnlyFields };
6269
+ return { mode: "all", ...internalOnlyFields, ...registryFields };
6253
6270
  if (raw === "agents_only")
6254
- return { mode: "agents_only", ...internalOnlyFields };
6271
+ return { mode: "agents_only", ...internalOnlyFields, ...registryFields };
6255
6272
  if (raw === "team_agents_only") {
6256
6273
  if (!teamId) {
6257
6274
  throw new Error("SLACK_SENDER_POLICY=team_agents_only requires AGT_TEAM_ID");
6258
6275
  }
6259
- return { mode: "team_agents_only", teamId, ...internalOnlyFields };
6276
+ return { mode: "team_agents_only", teamId, ...internalOnlyFields, ...registryFields };
6260
6277
  }
6261
6278
  if (raw === "team_only") {
6262
6279
  if (!teamId) {
6263
6280
  throw new Error("SLACK_SENDER_POLICY=team_only requires AGT_TEAM_ID");
6264
6281
  }
6265
6282
  const teamPrincipalSlackUserIds = (env["SLACK_SENDER_POLICY_TEAM_PRINCIPAL_IDS"] ?? "").split(",").map((s) => s.trim()).filter((s) => s.length > 0);
6266
- return { mode: "team_only", teamId, teamPrincipalSlackUserIds, ...internalOnlyFields };
6283
+ return { mode: "team_only", teamId, teamPrincipalSlackUserIds, ...internalOnlyFields, ...registryFields };
6267
6284
  }
6268
6285
  if (raw === "manager_only") {
6269
6286
  const principalSlackUserId = env["SLACK_SENDER_POLICY_PRINCIPAL_ID"];
@@ -6273,7 +6290,7 @@ function buildSlackSenderPolicyFromEnv(env, ctx) {
6273
6290
  if (!principalSlackUserId) {
6274
6291
  throw new Error("SLACK_SENDER_POLICY=manager_only requires SLACK_SENDER_POLICY_PRINCIPAL_ID. Set agent.reports_to_person with a slack_user_id in contact_preferences and re-run /host/refresh.");
6275
6292
  }
6276
- return { mode: "manager_only", teamId, principalSlackUserId, ...internalOnlyFields };
6293
+ return { mode: "manager_only", teamId, principalSlackUserId, ...internalOnlyFields, ...registryFields };
6277
6294
  }
6278
6295
  throw new Error(`Invalid SLACK_SENDER_POLICY=${JSON.stringify(env["SLACK_SENDER_POLICY"])}`);
6279
6296
  }
@@ -8357,7 +8374,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
8357
8374
  var lastVersionCheckAt = 0;
8358
8375
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
8359
8376
  var lastResponsivenessProbeAt = 0;
8360
- var agtCliVersion = true ? "0.28.323" : "dev";
8377
+ var agtCliVersion = true ? "0.28.325" : "dev";
8361
8378
  function resolveBrewPath(execFileSync2) {
8362
8379
  try {
8363
8380
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -9253,7 +9270,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
9253
9270
  if (codeNames.length === 0) return;
9254
9271
  void (async () => {
9255
9272
  try {
9256
- const { collectDiagnostics } = await import("../persistent-session-5FKI4NCL.js");
9273
+ const { collectDiagnostics } = await import("../persistent-session-BICDYHOC.js");
9257
9274
  await api.post("/host/heartbeat", {
9258
9275
  host_id: hostId,
9259
9276
  agent_diagnostics: collectDiagnostics(codeNames)
@@ -9352,7 +9369,7 @@ async function pollCycle() {
9352
9369
  }
9353
9370
  try {
9354
9371
  const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
9355
- const { collectDiagnostics } = await import("../persistent-session-5FKI4NCL.js");
9372
+ const { collectDiagnostics } = await import("../persistent-session-BICDYHOC.js");
9356
9373
  const diagCodeNames = [...agentState.persistentSessionAgents];
9357
9374
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
9358
9375
  let tailscaleHostname;
@@ -9501,7 +9518,7 @@ async function pollCycle() {
9501
9518
  const {
9502
9519
  collectResponsivenessProbes,
9503
9520
  getResponsivenessIntervalMs
9504
- } = await import("../responsiveness-probe-R42UJ5ZR.js");
9521
+ } = await import("../responsiveness-probe-FEAFPNUF.js");
9505
9522
  const probeIntervalMs = getResponsivenessIntervalMs();
9506
9523
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
9507
9524
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -9533,7 +9550,7 @@ async function pollCycle() {
9533
9550
  collectResponsivenessProbes,
9534
9551
  livePendingInboundOldestAgeSeconds,
9535
9552
  parkPendingInbound
9536
- } = await import("../responsiveness-probe-R42UJ5ZR.js");
9553
+ } = await import("../responsiveness-probe-FEAFPNUF.js");
9537
9554
  const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
9538
9555
  const wedgeNow = /* @__PURE__ */ new Date();
9539
9556
  const liveAgents = agentState.persistentSessionAgents;
@@ -12631,7 +12648,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
12631
12648
  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}`));
12632
12649
  void (async () => {
12633
12650
  try {
12634
- const { collectDiagnostics } = await import("../persistent-session-5FKI4NCL.js");
12651
+ const { collectDiagnostics } = await import("../persistent-session-BICDYHOC.js");
12635
12652
  await api.post("/host/heartbeat", {
12636
12653
  host_id: hostId,
12637
12654
  agent_diagnostics: collectDiagnostics([codeName])
@@ -12681,7 +12698,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
12681
12698
  }
12682
12699
  try {
12683
12700
  const hostId = await getHostId();
12684
- const { collectDiagnostics } = await import("../persistent-session-5FKI4NCL.js");
12701
+ const { collectDiagnostics } = await import("../persistent-session-BICDYHOC.js");
12685
12702
  await api.post("/host/heartbeat", {
12686
12703
  host_id: hostId,
12687
12704
  agent_diagnostics: collectDiagnostics([codeName])
@@ -13179,7 +13196,7 @@ async function processClaudePairSessions(agents) {
13179
13196
  killPairSession,
13180
13197
  pairTmuxSession,
13181
13198
  finalizeClaudePairOnboarding
13182
- } = await import("../claude-pair-runtime-JSOSBAH3.js");
13199
+ } = await import("../claude-pair-runtime-BOFTEAQC.js");
13183
13200
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
13184
13201
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
13185
13202
  const killed = await killPairSession(pairTmuxSession(pairId));