@automagik/omni 2.260915.2 → 2.260915.4

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.
package/dist/index.js CHANGED
@@ -137289,7 +137289,7 @@ import { fileURLToPath } from "url";
137289
137289
  // package.json
137290
137290
  var package_default = {
137291
137291
  name: "@automagik/omni",
137292
- version: "2.260915.2",
137292
+ version: "2.260915.4",
137293
137293
  repository: {
137294
137294
  type: "git",
137295
137295
  url: "git+https://github.com/automagik-dev/omni.git",
@@ -250986,7 +250986,7 @@ var init_sentry_scrub = __esm(() => {
250986
250986
  var require_package7 = __commonJS((exports, module) => {
250987
250987
  module.exports = {
250988
250988
  name: "@omni/api",
250989
- version: "2.260915.2",
250989
+ version: "2.260915.4",
250990
250990
  private: true,
250991
250991
  type: "module",
250992
250992
  exports: {
@@ -412608,6 +412608,26 @@ class SlackPlugin extends BaseChannelPlugin {
412608
412608
  this.userNameCache.set(cacheKey, null);
412609
412609
  return;
412610
412610
  }
412611
+ async resolveChannelName(instanceId, channelId) {
412612
+ const cacheKey = `${instanceId}:channel:${channelId}`;
412613
+ if (this.userNameCache.has(cacheKey)) {
412614
+ return this.userNameCache.get(cacheKey) ?? undefined;
412615
+ }
412616
+ let name;
412617
+ try {
412618
+ const result = await this.getConnection(instanceId).actingClient.conversations.info({ channel: channelId });
412619
+ name = result.channel?.name || undefined;
412620
+ } catch (error) {
412621
+ this.logger.warn("Failed to fetch channel info", { channelId, error: String(error) });
412622
+ }
412623
+ this.userNameCache.set(cacheKey, name ?? null);
412624
+ return name;
412625
+ }
412626
+ handleChannelRename(instanceId, event) {
412627
+ const channel2 = event.channel;
412628
+ if (channel2?.id && channel2.name)
412629
+ this.userNameCache.set(`${instanceId}:channel:${channel2.id}`, channel2.name);
412630
+ }
412611
412631
  resolveThreadTs(replyToMode, replyTo, threadId) {
412612
412632
  switch (replyToMode) {
412613
412633
  case "all":
@@ -412918,12 +412938,12 @@ class SlackPlugin extends BaseChannelPlugin {
412918
412938
  this.threadCaches.delete(instanceId);
412919
412939
  }
412920
412940
  }
412921
- async buildEnrichedPayload(instanceId, from, rawPayload) {
412941
+ async buildEnrichedPayload(instanceId, from, chatId, rawPayload) {
412922
412942
  const displayName = await this.resolveUserDisplayName(instanceId, from);
412923
412943
  const isDm = rawPayload.isDm;
412924
412944
  const isMpim = rawPayload.isMpim === true;
412925
412945
  const isOneToOne = isDm && !isMpim;
412926
- const chatName = isOneToOne ? displayName : undefined;
412946
+ const chatName = isOneToOne ? displayName : !isDm ? await this.resolveChannelName(instanceId, chatId) : undefined;
412927
412947
  return {
412928
412948
  ...rawPayload,
412929
412949
  displayName,
@@ -412941,7 +412961,7 @@ class SlackPlugin extends BaseChannelPlugin {
412941
412961
  if (connection && config2) {
412942
412962
  this.addAckReaction(instanceId, args.chatId, args.externalId, connection, config2);
412943
412963
  }
412944
- const enrichedPayload = await this.buildEnrichedPayload(instanceId, args.from, args.rawPayload);
412964
+ const enrichedPayload = await this.buildEnrichedPayload(instanceId, args.from, args.chatId, args.rawPayload);
412945
412965
  await this.handleMessageReceived(instanceId, args.externalId, args.chatId, args.from, args.content, args.replyToId, enrichedPayload, args.platformTimestamp);
412946
412966
  }
412947
412967
  setupHandlers(instanceId, connection, config2, reliability) {
@@ -412953,7 +412973,7 @@ class SlackPlugin extends BaseChannelPlugin {
412953
412973
  const threadTs = rawPayload.threadTs;
412954
412974
  this.trackActiveThread(instanceId, chatId, threadTs ?? externalId);
412955
412975
  this.addAckReaction(instanceId, chatId, externalId, connection, config2);
412956
- const enrichedPayload = await this.buildEnrichedPayload(instanceId, from, rawPayload);
412976
+ const enrichedPayload = await this.buildEnrichedPayload(instanceId, from, chatId, rawPayload);
412957
412977
  const files = enrichedPayload.files;
412958
412978
  if (files && files.length > 0) {
412959
412979
  await this.handleInboundFiles(instanceId, externalId, chatId, from, content, replyToId, enrichedPayload, platformTimestamp);
@@ -412997,6 +413017,7 @@ class SlackPlugin extends BaseChannelPlugin {
412997
413017
  }
412998
413018
  }
412999
413019
  }, this.logger);
413020
+ connection.app.event("channel_rename", async ({ event }) => this.handleChannelRename(instanceId, event));
413000
413021
  setupAgentSessionHandlers(connection.app, instanceId, {
413001
413022
  onSessionStopped: async (instId, args) => {
413002
413023
  await this.handleAgentSessionStopped(instId, connection, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260915.2",
3
+ "version": "2.260915.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/automagik-dev/omni.git",