@integrity-labs/agt-cli 0.27.90 → 0.27.91

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.
@@ -16,7 +16,7 @@ import {
16
16
  provisionStopHook,
17
17
  requireHost,
18
18
  safeWriteJsonAtomic
19
- } from "../chunk-BGXIKCLR.js";
19
+ } from "../chunk-ALXQEKLP.js";
20
20
  import {
21
21
  getProjectDir as getProjectDir2,
22
22
  getReadyTasks,
@@ -695,6 +695,18 @@ function extractMsTeamsBehaviourSubset(config2) {
695
695
  };
696
696
  }
697
697
 
698
+ // src/lib/slack-behaviour-restart.ts
699
+ function extractSlackBehaviourSubset(config2) {
700
+ const rawAllowed = config2?.["allowed_users"];
701
+ return {
702
+ thread_auto_follow: config2?.["thread_auto_follow"] ?? "off",
703
+ channel_response_mode: config2?.["channel_response_mode"] ?? "mention_only",
704
+ // Mirror the adapter's defensive filter exactly — a malformed entry the
705
+ // adapter would drop must not count as an env change.
706
+ allowed_users: Array.isArray(rawAllowed) ? rawAllowed.filter((v) => typeof v === "string" && v.trim().length > 0).map((v) => v.trim()) : []
707
+ };
708
+ }
709
+
698
710
  // src/lib/channel-quarantine.ts
699
711
  import { readFileSync } from "fs";
700
712
  import { join } from "path";
@@ -2942,6 +2954,14 @@ var agentState = {
2942
2954
  * the session when an operator saves the webapp's Teams Advanced panel.
2943
2955
  */
2944
2956
  knownMsTeamsBehaviourHashes: /* @__PURE__ */ new Map(),
2957
+ /**
2958
+ * ENG-6035: hash of the Slack behaviour subset (allowed_users,
2959
+ * thread_auto_follow, channel_response_mode) from the agent's slack
2960
+ * channel config. Same last-hop rationale as the Teams map above —
2961
+ * slack-channel reads SLACK_ALLOWED_USERS (and friends) once at boot,
2962
+ * so an operator save needs this dedicated value-change trigger.
2963
+ */
2964
+ knownSlackBehaviourHashes: /* @__PURE__ */ new Map(),
2945
2965
  // ---------------------------------------------------------------------------
2946
2966
  // codeName-keyed
2947
2967
  // ---------------------------------------------------------------------------
@@ -2973,6 +2993,7 @@ function clearAgentState(agentId, codeName) {
2973
2993
  agentState.knownManagedMcpStructure.delete(agentId);
2974
2994
  agentState.knownSenderPolicyHashes.delete(agentId);
2975
2995
  agentState.knownMsTeamsBehaviourHashes.delete(agentId);
2996
+ agentState.knownSlackBehaviourHashes.delete(agentId);
2976
2997
  agentState.agentDisplayNames.delete(codeName);
2977
2998
  agentState.codeNameToAgentId.delete(codeName);
2978
2999
  let channelCacheMutated = false;
@@ -3975,7 +3996,7 @@ var cachedMaintenanceWindow = null;
3975
3996
  var lastVersionCheckAt = 0;
3976
3997
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
3977
3998
  var lastResponsivenessProbeAt = 0;
3978
- var agtCliVersion = true ? "0.27.90" : "dev";
3999
+ var agtCliVersion = true ? "0.27.91" : "dev";
3979
4000
  function resolveBrewPath(execFileSync4) {
3980
4001
  try {
3981
4002
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -6165,6 +6186,7 @@ async function processAgent(agent, agentStates) {
6165
6186
  );
6166
6187
  }
6167
6188
  agentState.knownSenderPolicyHashes.set(agent.agent_id, senderPolicyHash);
6189
+ let msteamsBehaviourRestartScheduled = false;
6168
6190
  if (currentChannelIds.has("msteams")) {
6169
6191
  const msteamsEntry = refreshData.channel_configs?.["msteams"];
6170
6192
  const behaviourSubset = extractMsTeamsBehaviourSubset(
@@ -6206,11 +6228,59 @@ async function processAgent(agent, agentStates) {
6206
6228
  "msteams behaviour change",
6207
6229
  "channel-behaviour-change"
6208
6230
  );
6231
+ msteamsBehaviourRestartScheduled = true;
6209
6232
  }
6210
6233
  agentState.knownMsTeamsBehaviourHashes.set(agent.agent_id, behaviourHash);
6211
6234
  } else {
6212
6235
  agentState.knownMsTeamsBehaviourHashes.delete(agent.agent_id);
6213
6236
  }
6237
+ if (currentChannelIds.has("slack")) {
6238
+ const slackEntry = refreshData.channel_configs?.["slack"];
6239
+ const slackBehaviourSubset = extractSlackBehaviourSubset(
6240
+ slackEntry?.config
6241
+ );
6242
+ const slackBehaviourHash = createHash3("sha256").update(canonicalJson(slackBehaviourSubset)).digest("hex");
6243
+ const prevSlackBehaviourHash = agentState.knownSlackBehaviourHashes.get(agent.agent_id);
6244
+ const slackBehaviourDecision = decideSenderPolicyRestart({
6245
+ previousHash: prevSlackBehaviourHash,
6246
+ currentHash: slackBehaviourHash,
6247
+ sessionMode: refreshData.agent.session_mode,
6248
+ framework: agentFrameworkCache.get(agent.code_name) ?? "openclaw",
6249
+ sessionHealthy: isSessionHealthy(agent.code_name),
6250
+ // A channel-set, sender-policy, or msteams-behaviour restart
6251
+ // scheduled this tick respawns the MCP children with the
6252
+ // freshly-written env for free.
6253
+ channelSetRestartAlreadyScheduled: channelSetRestartScheduled || senderPolicyDecision.restart || msteamsBehaviourRestartScheduled
6254
+ });
6255
+ if (slackBehaviourDecision.restart) {
6256
+ log(
6257
+ `[hot-reload] slack behaviour settings changed for '${agent.code_name}' (${prevSlackBehaviourHash?.slice(0, 8) ?? "first"} \u2192 ${slackBehaviourHash.slice(0, 8)}) \u2014 restarting session`
6258
+ );
6259
+ const slackBehaviourNotice = "Your Slack channel behaviour settings were updated. Restarting session shortly so the slack-channel MCP picks up the new configuration.";
6260
+ const slackBehaviourDelivered = await injectMessage(
6261
+ agent.code_name,
6262
+ "system",
6263
+ slackBehaviourNotice,
6264
+ { task_name: "channel-update" },
6265
+ log
6266
+ ).catch(() => false);
6267
+ const slackBehaviourDelay = slackBehaviourDelivered ? 8e3 : 3e3;
6268
+ if (!slackBehaviourDelivered) {
6269
+ log(
6270
+ `[hot-reload] Inject notification unconfirmed for '${agent.code_name}' \u2014 proceeding with shorter delay`
6271
+ );
6272
+ }
6273
+ scheduleSessionRestart(
6274
+ agent.code_name,
6275
+ slackBehaviourDelay,
6276
+ "slack behaviour change",
6277
+ "channel-behaviour-change"
6278
+ );
6279
+ }
6280
+ agentState.knownSlackBehaviourHashes.set(agent.agent_id, slackBehaviourHash);
6281
+ } else {
6282
+ agentState.knownSlackBehaviourHashes.delete(agent.agent_id);
6283
+ }
6214
6284
  }
6215
6285
  const agentSessionMode = refreshData.agent.session_mode;
6216
6286
  if (agentSessionMode === "persistent" && (agentFrameworkCache.get(agent.code_name) ?? "openclaw") === "claude-code") {