@credal/actions 0.2.146 → 0.2.147

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.
@@ -47,6 +47,12 @@ class SlackUserCache {
47
47
  }
48
48
  }
49
49
  /* ===================== Helpers ===================== */
50
+ function normalizeChannelOperand(ch) {
51
+ const s = ch.trim();
52
+ if (/^[CGD][A-Z0-9]/i.test(s))
53
+ return s;
54
+ return s.replace(/^#/, "");
55
+ }
50
56
  function fmtDaysAgo(n) {
51
57
  const d = new Date();
52
58
  d.setDate(d.getDate() - n);
@@ -224,7 +230,7 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
224
230
  throw new Error(MISSING_AUTH_TOKEN);
225
231
  const client = new WebClient(authParams.authToken);
226
232
  const cache = new SlackUserCache(client);
227
- const { emails, topic, timeRange, limit = 20 } = params;
233
+ const { emails, topic, timeRange, limit = 20, channel } = params;
228
234
  const { user_id: myUserId } = yield client.auth.test();
229
235
  if (!myUserId)
230
236
  throw new Error("Failed to get my user ID.");
@@ -245,8 +251,11 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
245
251
  allMatches.push(...(yield searchScoped({ client, scope: `<@${id}>`, topic, timeRange, limit })));
246
252
  }
247
253
  }
254
+ else if (channel) {
255
+ allMatches.push(...(yield searchScoped({ client, scope: normalizeChannelOperand(channel), topic, timeRange, limit })));
256
+ }
248
257
  // --- Topic-wide search ---
249
- const topicMatches = yield searchByTopic({ client, topic, timeRange, limit });
258
+ const topicMatches = topic ? yield searchByTopic({ client, topic, timeRange, limit }) : [];
250
259
  allMatches.push(...topicMatches);
251
260
  // --- Expand hits with context + filter overlap ---
252
261
  const expanded = yield Promise.all(allMatches.map(m => limitHit(() => __awaiter(void 0, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.146",
3
+ "version": "0.2.147",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,