@integrity-labs/agt-cli 0.28.618 → 0.28.619

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.
@@ -30250,14 +30250,23 @@ var ALLOWED_MESSAGE_SUBTYPES = /* @__PURE__ */ new Set([
30250
30250
  "file_share",
30251
30251
  "thread_broadcast"
30252
30252
  ]);
30253
- function decideSlackMessageForward(evt) {
30253
+ function matchesThirdPartyGrant(evt, thirdPartyBots) {
30254
+ const botId = evt.bot_id;
30255
+ if (!botId || !thirdPartyBots?.length)
30256
+ return false;
30257
+ return thirdPartyBots.some((b) => b.bot_id === botId || b.bot_user_id === botId);
30258
+ }
30259
+ function decideSlackMessageForward(evt, thirdPartyBots) {
30254
30260
  if (evt.type !== "message") {
30255
30261
  return { forward: true };
30256
30262
  }
30263
+ const granted = matchesThirdPartyGrant(evt, thirdPartyBots);
30257
30264
  if (!ALLOWED_MESSAGE_SUBTYPES.has(evt.subtype)) {
30258
- return { forward: false, reason: "subtype" };
30265
+ if (!granted || evt.subtype !== "bot_message") {
30266
+ return { forward: false, reason: "subtype" };
30267
+ }
30259
30268
  }
30260
- if (!evt.user) {
30269
+ if (!evt.user && !granted) {
30261
30270
  return { forward: false, reason: "no_user" };
30262
30271
  }
30263
30272
  const hasText = typeof evt.text === "string" && evt.text.trim().length > 0;
@@ -40594,7 +40603,13 @@ function classifyPeerMessage(msg, cfg, self) {
40594
40603
  }
40595
40604
  const peer = cfg.peers.find((p2) => p2.bot_user_id === msg.user);
40596
40605
  if (!peer) {
40597
- const thirdParty = cfg.third_party_bots?.find((b) => b.bot_user_id === msg.user);
40606
+ const thirdParty = cfg.third_party_bots?.find((b) => {
40607
+ if (msg.user && b.bot_user_id === msg.user)
40608
+ return true;
40609
+ if (!msg.bot_id)
40610
+ return false;
40611
+ return b.bot_id === msg.bot_id || b.bot_user_id === msg.bot_id;
40612
+ });
40598
40613
  if (thirdParty) {
40599
40614
  if (cfg.peer_disabled_mode === "cross_team_only") {
40600
40615
  return { kind: "drop", reason: "peer_disabled_cross_team" };
@@ -40734,7 +40749,13 @@ function parseThirdPartyBotsEnv(raw) {
40734
40749
  continue;
40735
40750
  const channels = rec["channel_ids"].filter((c) => typeof c === "string" && c.trim() !== "").map((c) => c.trim());
40736
40751
  const label = typeof rec["label"] === "string" && rec["label"].trim() ? rec["label"].trim() : void 0;
40737
- out.push({ bot_user_id: botUserId2, channel_ids: channels, ...label ? { label } : {} });
40752
+ const botId = typeof rec["bot_id"] === "string" && rec["bot_id"].trim() ? rec["bot_id"].trim() : void 0;
40753
+ out.push({
40754
+ bot_user_id: botUserId2,
40755
+ channel_ids: channels,
40756
+ ...botId ? { bot_id: botId } : {},
40757
+ ...label ? { label } : {}
40758
+ });
40738
40759
  }
40739
40760
  return out;
40740
40761
  }
@@ -46244,7 +46265,10 @@ async function connectSocketMode() {
46244
46265
  return;
46245
46266
  }
46246
46267
  const isBot = Boolean(evt.bot_id);
46247
- const filterDecision = decideSlackMessageForward(evt);
46268
+ const filterDecision = decideSlackMessageForward(
46269
+ evt,
46270
+ SLACK_PEER_CLASSIFIER_CONFIG.third_party_bots
46271
+ );
46248
46272
  const senderPolicyDecision = decideSenderPolicyForward(evt, SLACK_SENDER_POLICY);
46249
46273
  const policyBlockReason = senderPolicyDecision.forward ? void 0 : classifySlackPolicyBlock(evt, SLACK_SENDER_POLICY);
46250
46274
  const peerClassification = isBot ? classifyPeerMessage(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.618",
3
+ "version": "0.28.619",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {