@integrity-labs/agt-cli 0.28.873 → 0.28.875

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.
@@ -22960,8 +22960,20 @@ function richTextToString(node, depth = 0) {
22960
22960
  else if (type === "rich_text_table_row") parts.push(children.join(" | "));
22961
22961
  else if (type === "rich_text_list") {
22962
22962
  parts.push(children.map((c) => `- ${c}`).join("\n"));
22963
- } else if (type === "rich_text_quote" || type === "rich_text_preformatted") {
22964
- parts.push(children.join("\n"));
22963
+ } else if (type === "rich_text_quote") {
22964
+ parts.push(
22965
+ children.join("\n").split("\n").map((l) => `> ${l}`).join("\n")
22966
+ );
22967
+ } else if (type === "rich_text_preformatted") {
22968
+ const body = children.join("\n");
22969
+ const longestRun = Math.max(
22970
+ 0,
22971
+ ...[...body.matchAll(/`+/g)].map((m) => m[0].length)
22972
+ );
22973
+ const fence = "`".repeat(Math.max(3, longestRun + 1));
22974
+ parts.push(`${fence}
22975
+ ${body}
22976
+ ${fence}`);
22965
22977
  } else parts.push(children.join(""));
22966
22978
  }
22967
22979
  return parts.join("").trim();
@@ -30374,7 +30386,7 @@ function isAppMentionEcho(evt, botUserId2) {
30374
30386
  return false;
30375
30387
  if (evt.channel?.startsWith("D"))
30376
30388
  return false;
30377
- return typeof evt.text === "string" && evt.text.includes(`<@${botUserId2}>`);
30389
+ return typeof evt.text === "string" && mentionsUser(evt.text, botUserId2);
30378
30390
  }
30379
30391
  function slackInboundDedupId(evt) {
30380
30392
  if (!evt.channel || !evt.ts)
@@ -30382,12 +30394,82 @@ function slackInboundDedupId(evt) {
30382
30394
  return `${evt.channel}:${evt.ts}:${evt.type ?? "unknown"}`;
30383
30395
  }
30384
30396
  function decideSlackEngagement(input) {
30385
- const isExplicitMention = input.type === "app_mention" || !!input.botUserId && input.text.includes(`<@${input.botUserId}>`);
30397
+ const isExplicitMention = input.type === "app_mention" || !!input.botUserId && mentionsUser(input.text, input.botUserId);
30386
30398
  return !(input.isAutoFollowed && !isExplicitMention);
30387
30399
  }
30388
30400
  function decideMarkerArm(input) {
30401
+ if (input.addressesAnotherAgent && !input.shouldEngage)
30402
+ return false;
30389
30403
  return input.shouldEngage || input.isAutoFollowed && input.botPostedInThread;
30390
30404
  }
30405
+ var MENTION_AT_START = /^<@([A-Z0-9]+)(?:\|[^>]*)?>/;
30406
+ function mentionsUser(text, userId) {
30407
+ if (!userId)
30408
+ return false;
30409
+ const escaped = userId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
30410
+ return new RegExp(`<@${escaped}[|>]`).test(text);
30411
+ }
30412
+ var GREETING_PREFIX = /^(?:hey|hi|hello|yo|ok|okay|cc|thanks|thx|morning|afternoon)\b[\s,:!.-]*/i;
30413
+ var ADDRESSEE_SEPARATOR = /^(?:[\s,:;]+|and\b|&|\+)+/i;
30414
+ var BLOCKQUOTE_PREFIX = /^(?:&gt;|>)/;
30415
+ function addressRegion(text) {
30416
+ let fenceLen = 0;
30417
+ for (const rawLine of text.split("\n")) {
30418
+ const line = rawLine.trim();
30419
+ const run = /^`{3,}/.exec(line)?.[0].length ?? 0;
30420
+ if (run > 0) {
30421
+ if (fenceLen === 0)
30422
+ fenceLen = run;
30423
+ else if (run >= fenceLen)
30424
+ fenceLen = 0;
30425
+ continue;
30426
+ }
30427
+ if (fenceLen > 0)
30428
+ continue;
30429
+ if (BLOCKQUOTE_PREFIX.test(line))
30430
+ continue;
30431
+ if (line.length === 0)
30432
+ continue;
30433
+ return line;
30434
+ }
30435
+ return "";
30436
+ }
30437
+ function leadingAddresseeIds(text) {
30438
+ let rest = addressRegion(text);
30439
+ const greeting = GREETING_PREFIX.exec(rest);
30440
+ if (greeting)
30441
+ rest = rest.slice(greeting[0].length);
30442
+ const ids = [];
30443
+ for (; ; ) {
30444
+ const m = MENTION_AT_START.exec(rest);
30445
+ const id = m?.[1];
30446
+ if (!m || !id)
30447
+ break;
30448
+ const after = rest.slice(m[0].length);
30449
+ if (/^['’]/.test(after))
30450
+ break;
30451
+ ids.push(id);
30452
+ if (after.length === 0)
30453
+ break;
30454
+ const sep2 = ADDRESSEE_SEPARATOR.exec(after);
30455
+ if (!sep2)
30456
+ break;
30457
+ rest = after.slice(sep2[0].length);
30458
+ }
30459
+ return ids;
30460
+ }
30461
+ function addressesAnotherRegisteredAgent(text, botUserId2, registeredAgentIds) {
30462
+ if (!botUserId2)
30463
+ return false;
30464
+ if (!registeredAgentIds || registeredAgentIds.size === 0)
30465
+ return false;
30466
+ if (mentionsUser(text, botUserId2))
30467
+ return false;
30468
+ const addressees = leadingAddresseeIds(text);
30469
+ if (addressees.includes(botUserId2))
30470
+ return false;
30471
+ return addressees.some((id) => id !== botUserId2 && registeredAgentIds.has(id));
30472
+ }
30391
30473
  function decideSlackAckReaction(input) {
30392
30474
  return Boolean(input.channel && input.ts);
30393
30475
  }
@@ -48992,7 +49074,17 @@ async function connectSocketMode() {
48992
49074
  });
48993
49075
  const participantEntry = threadKey ? trackedThreads.get(threadKey) : void 0;
48994
49076
  const botPostedInThread = participantEntry?.bot_posted === true || participantEntry?.involvement === "started";
48995
- const armMarker = decideMarkerArm({ shouldEngage, isAutoFollowed, botPostedInThread });
49077
+ const addressesAnotherAgent = addressesAnotherRegisteredAgent(
49078
+ text,
49079
+ botUserId,
49080
+ SLACK_SENDER_POLICY.registeredAgentSlackUserIds
49081
+ );
49082
+ const armMarker = decideMarkerArm({
49083
+ shouldEngage,
49084
+ isAutoFollowed,
49085
+ botPostedInThread,
49086
+ addressesAnotherAgent
49087
+ });
48996
49088
  const ackProbe = process.env.TMUX && AGENT_CODE_NAME ? probeAgentSessionCached(AGENT_CODE_NAME) : { tmux: "unknown", claude: "unknown" };
48997
49089
  let paneLogFreshAgeMs = null;
48998
49090
  if (SLACK_AGENT_DIR) {
@@ -54,8 +54,8 @@ import {
54
54
  writeDirectChatSessionState,
55
55
  writeEgressAllowlist,
56
56
  writePersistentClaudeWrapper
57
- } from "./chunk-XXX4XCOG.js";
58
- import "./chunk-KFRKCRKK.js";
57
+ } from "./chunk-SQ7PB5A6.js";
58
+ import "./chunk-Q2OVEMUG.js";
59
59
  import "./chunk-XWVM4KPK.js";
60
60
  export {
61
61
  EGRESS_BASELINE_DOMAINS,
@@ -114,4 +114,4 @@ export {
114
114
  writeEgressAllowlist,
115
115
  writePersistentClaudeWrapper
116
116
  };
117
- //# sourceMappingURL=persistent-session-TESZPF4A.js.map
117
+ //# sourceMappingURL=persistent-session-MG6FEYRY.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-XXX4XCOG.js";
4
- import "./chunk-KFRKCRKK.js";
3
+ } from "./chunk-SQ7PB5A6.js";
4
+ import "./chunk-Q2OVEMUG.js";
5
5
  import "./chunk-XWVM4KPK.js";
6
6
 
7
7
  // src/lib/responsiveness-probe.ts
@@ -764,4 +764,4 @@ export {
764
764
  readAndResetSlackReplyBindingClassifications,
765
765
  readAndResetSlackReplyTargetClassifications
766
766
  };
767
- //# sourceMappingURL=responsiveness-probe-CZY4TVK7.js.map
767
+ //# sourceMappingURL=responsiveness-probe-2OGWHDXE.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sessionTranscriptDir
3
- } from "./chunk-KFRKCRKK.js";
3
+ } from "./chunk-Q2OVEMUG.js";
4
4
 
5
5
  // src/lib/session-auth-dead.ts
6
6
  import { closeSync, openSync, readSync, readdirSync, statSync } from "fs";
@@ -203,4 +203,4 @@ export {
203
203
  decideSessionAuthState,
204
204
  probeSessionAuth
205
205
  };
206
- //# sourceMappingURL=session-auth-dead-ANDVMNLE.js.map
206
+ //# sourceMappingURL=session-auth-dead-AHL6D3CM.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.873",
3
+ "version": "0.28.875",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {