@integrity-labs/agt-cli 0.27.152 → 0.27.154

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.
@@ -15092,6 +15092,16 @@ function clearOldestSlackPendingMarkerInChannel(dir, channel, clear = defaultCle
15092
15092
  }
15093
15093
  }
15094
15094
 
15095
+ // src/slack-reply-threading.ts
15096
+ function isSlackDmChannel(channel) {
15097
+ return typeof channel === "string" && channel.startsWith("D");
15098
+ }
15099
+ function resolveReplyThreadTs(input) {
15100
+ if (input.threadTs) return input.threadTs;
15101
+ if (isSlackDmChannel(input.channel)) return void 0;
15102
+ return input.messageTs || void 0;
15103
+ }
15104
+
15095
15105
  // src/restart-confirm.ts
15096
15106
  import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync3, renameSync, unlinkSync as unlinkSync2, writeFileSync } from "fs";
15097
15107
  import { dirname } from "path";
@@ -17827,7 +17837,7 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
17827
17837
  text: { type: "string", description: "The message to send" },
17828
17838
  thread_ts: {
17829
17839
  type: "string",
17830
- description: "Thread timestamp for threaded replies (from the thread_ts attribute). Omit for a top-level reply (e.g. a fresh DM)."
17840
+ description: "Thread timestamp for an existing thread reply (from the thread_ts attribute). Safe to omit: for a channel message the server automatically threads your reply off the message you are answering (via message_ts), and a DM reply posts inline."
17831
17841
  },
17832
17842
  // ENG-5861: explicit message_ts so the cleanup gate can match the
17833
17843
  // exact pending-inbound marker — necessary because top-level DM
@@ -18066,17 +18076,22 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
18066
18076
  }
18067
18077
  if (name === "slack.reply") {
18068
18078
  const { channel, text, thread_ts, message_ts } = args;
18069
- if (channel && thread_ts) {
18079
+ const effectiveThreadTs = resolveReplyThreadTs({
18080
+ channel,
18081
+ threadTs: thread_ts,
18082
+ messageTs: message_ts
18083
+ });
18084
+ if (channel && effectiveThreadTs) {
18070
18085
  const killed = await isThreadKilled({
18071
18086
  channelType: "slack",
18072
18087
  channelId: channel,
18073
- threadTs: thread_ts,
18088
+ threadTs: effectiveThreadTs,
18074
18089
  agtHost: AGT_HOST,
18075
18090
  agtApiKey: AGT_API_KEY
18076
18091
  });
18077
18092
  if (killed) {
18078
18093
  process.stderr.write(
18079
- `slack-channel(${AGENT_CODE_NAME}): reply_killed channel=${redactSlackId(channel)} thread=${redactSlackId(thread_ts)}
18094
+ `slack-channel(${AGENT_CODE_NAME}): reply_killed channel=${redactSlackId(channel)} thread=${redactSlackId(effectiveThreadTs)}
18080
18095
  `
18081
18096
  );
18082
18097
  return {
@@ -18091,7 +18106,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
18091
18106
  }
18092
18107
  }
18093
18108
  const throttleCfg = configFromEnv();
18094
- const throttleKey = thread_ts ?? channel;
18109
+ const throttleKey = effectiveThreadTs ?? channel;
18095
18110
  const throttleNow = Date.now();
18096
18111
  const throttleDecision = decideReplyThrottle({
18097
18112
  recentReplyTimestamps: getRecentReplies(channel, throttleKey, throttleNow, throttleCfg),
@@ -18103,14 +18118,14 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
18103
18118
  `slack-channel(${AGENT_CODE_NAME}): reply_throttled channel=${redactSlackId(channel)} thread=${redactSlackId(throttleKey)} count=${throttleDecision.recentCount} window_ms=${throttleCfg.windowMs} threshold=${throttleCfg.threshold}
18104
18119
  `
18105
18120
  );
18106
- if (channel && thread_ts) {
18121
+ if (channel && effectiveThreadTs) {
18107
18122
  fetch("https://slack.com/api/reactions.add", {
18108
18123
  method: "POST",
18109
18124
  headers: {
18110
18125
  "Content-Type": "application/json",
18111
18126
  Authorization: `Bearer ${BOT_TOKEN}`
18112
18127
  },
18113
- body: JSON.stringify({ channel, timestamp: thread_ts, name: "lock" })
18128
+ body: JSON.stringify({ channel, timestamp: effectiveThreadTs, name: "lock" })
18114
18129
  }).catch(() => {
18115
18130
  });
18116
18131
  }
@@ -18144,7 +18159,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
18144
18159
  body: JSON.stringify({
18145
18160
  channel,
18146
18161
  text,
18147
- ...thread_ts ? { thread_ts } : {},
18162
+ ...effectiveThreadTs ? { thread_ts: effectiveThreadTs } : {},
18148
18163
  ...buildAugmentedSlackMetadata() ? { metadata: buildAugmentedSlackMetadata() } : {}
18149
18164
  // ↑ Labels this message as Augmented-agent-originated so peer agents
18150
18165
  // enforcing sender_policy=team_agents_only can verify the sender.
@@ -18160,7 +18175,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
18160
18175
  recordReply(channel, throttleKey, throttleNow, throttleCfg);
18161
18176
  recordActivity("reply");
18162
18177
  if (THREAD_AUTO_FOLLOW !== "off") {
18163
- const trackTs = thread_ts ?? data.ts ?? void 0;
18178
+ const trackTs = effectiveThreadTs ?? data.ts ?? void 0;
18164
18179
  rememberThread(channel, trackTs, thread_ts ? "mentioned" : "started");
18165
18180
  }
18166
18181
  if (interactiveHostAvailable() && data.ts) {
@@ -18170,7 +18185,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
18170
18185
  agentId: AGT_AGENT_ID
18171
18186
  };
18172
18187
  const tsToRecord = data.ts;
18173
- const threadTsToRecord = thread_ts;
18188
+ const threadTsToRecord = effectiveThreadTs;
18174
18189
  void (async () => {
18175
18190
  try {
18176
18191
  const runtime = await Promise.resolve().then(() => (init_slack_block_kit_runtime(), slack_block_kit_runtime_exports));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.27.152",
3
+ "version": "0.27.154",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {