@integrity-labs/agt-cli 0.12.9 → 0.14.0

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.
@@ -13995,3 +13995,4 @@ process.stdin.on("close", () => shutdown("stdin closed"));
13995
13995
  process.stdin.on("end", () => shutdown("stdin ended"));
13996
13996
  process.on("SIGTERM", () => shutdown("SIGTERM"));
13997
13997
  process.on("SIGINT", () => shutdown("SIGINT"));
13998
+ process.on("SIGHUP", () => shutdown("SIGHUP"));
@@ -13865,6 +13865,43 @@ var StdioServerTransport = class {
13865
13865
  import { readFileSync, statSync } from "fs";
13866
13866
  import { basename, resolve } from "path";
13867
13867
  import { homedir } from "os";
13868
+
13869
+ // src/slack-response-mode.ts
13870
+ var MODES = [
13871
+ "mention_only",
13872
+ "broadcast",
13873
+ "addressed_team",
13874
+ "all"
13875
+ ];
13876
+ function parseResponseMode(raw) {
13877
+ if (!raw) return "mention_only";
13878
+ const v = raw.trim().toLowerCase();
13879
+ return MODES.includes(v) ? v : "mention_only";
13880
+ }
13881
+ function matchesBroadcast(text) {
13882
+ if (/<!channel>|<!here>/.test(text)) return true;
13883
+ if (/(?:^|\s)@(channel|here)(?=$|[\s.,!?;:])/i.test(text)) return true;
13884
+ return false;
13885
+ }
13886
+ function matchesAddressedTeam(text) {
13887
+ const t = text.trim();
13888
+ if (t.length === 0) return false;
13889
+ if (/^(hey|hi|hello|howdy|good (morning|afternoon|evening)|morning|afternoon)\s+team(?=$|[\s,.!?:])/i.test(t)) return true;
13890
+ if (/(?:^|\s)@team\b/i.test(t)) return true;
13891
+ if (/^team\s*[:,—-]/i.test(t)) return true;
13892
+ if (/(?:^|\s)@(everyone|all)\b/i.test(t)) return true;
13893
+ if (/^(everyone|all)\s*[:,—-]/i.test(t)) return true;
13894
+ return false;
13895
+ }
13896
+ function channelMessageShouldRespond(text, mode) {
13897
+ if (mode === "all") return true;
13898
+ if (mode === "mention_only") return false;
13899
+ if (matchesBroadcast(text)) return true;
13900
+ if (mode === "addressed_team" && matchesAddressedTeam(text)) return true;
13901
+ return false;
13902
+ }
13903
+
13904
+ // src/slack-channel.ts
13868
13905
  var BOT_TOKEN = process.env.SLACK_BOT_TOKEN;
13869
13906
  var APP_TOKEN = process.env.SLACK_APP_TOKEN;
13870
13907
  var AGENT_CODE_NAME = process.env.AGT_AGENT_CODE_NAME ?? null;
@@ -13872,6 +13909,7 @@ var ALLOWED_USERS = new Set(
13872
13909
  (process.env.SLACK_ALLOWED_USERS ?? "").split(",").map((s) => s.trim()).filter(Boolean)
13873
13910
  );
13874
13911
  var THREAD_AUTO_FOLLOW = process.env.SLACK_THREAD_AUTO_FOLLOW ?? "off";
13912
+ var CHANNEL_RESPONSE_MODE = parseResponseMode(process.env.SLACK_CHANNEL_RESPONSE_MODE);
13875
13913
  var RESPONSE_TIMEOUT_MS = 12e4;
13876
13914
  var pendingMessages = /* @__PURE__ */ new Map();
13877
13915
  function trackPendingMessage(channel, threadTs, messageTs) {
@@ -14338,11 +14376,14 @@ async function connectSocketMode() {
14338
14376
  trackedThreads.set(threadKey, trackedThreads.get(threadKey) ?? "mentioned");
14339
14377
  }
14340
14378
  if (evt.type === "message" && evt.channel && !isDirectMessage) {
14341
- if (THREAD_AUTO_FOLLOW === "off") return;
14342
- if (!isThreadReply) return;
14343
- const threadInvolvement = trackedThreads.get(threadKey);
14344
- if (!threadInvolvement) return;
14345
- if (THREAD_AUTO_FOLLOW === "started" && threadInvolvement !== "started") return;
14379
+ if (isThreadReply) {
14380
+ if (THREAD_AUTO_FOLLOW === "off") return;
14381
+ const threadInvolvement = trackedThreads.get(threadKey);
14382
+ if (!threadInvolvement) return;
14383
+ if (THREAD_AUTO_FOLLOW === "started" && threadInvolvement !== "started") return;
14384
+ } else {
14385
+ if (!channelMessageShouldRespond(evt.text ?? "", CHANNEL_RESPONSE_MODE)) return;
14386
+ }
14346
14387
  }
14347
14388
  if (ALLOWED_USERS.size > 0 && evt.user && !ALLOWED_USERS.has(evt.user)) return;
14348
14389
  const text = evt.text ?? "";
@@ -14411,6 +14452,7 @@ process.stdin.on("close", () => shutdown("stdin closed"));
14411
14452
  process.stdin.on("end", () => shutdown("stdin ended"));
14412
14453
  process.on("SIGTERM", () => shutdown("SIGTERM"));
14413
14454
  process.on("SIGINT", () => shutdown("SIGINT"));
14455
+ process.on("SIGHUP", () => shutdown("SIGHUP"));
14414
14456
  botUserId = await getBotUserId();
14415
14457
  process.stderr.write(`slack-channel: Bot user ID: ${botUserId}
14416
14458
  `);
@@ -14205,6 +14205,7 @@ process.stdin.on("close", () => shutdown("stdin closed"));
14205
14205
  process.stdin.on("end", () => shutdown("stdin ended"));
14206
14206
  process.on("SIGTERM", () => shutdown("SIGTERM"));
14207
14207
  process.on("SIGINT", () => shutdown("SIGINT"));
14208
+ process.on("SIGHUP", () => shutdown("SIGHUP"));
14208
14209
  process.stderr.write(
14209
14210
  `telegram-channel(${AGENT_CODE_NAME}): started, long-polling getUpdates
14210
14211
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.12.9",
3
+ "version": "0.14.0",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {