@automagik/omni 2.260922.4 → 2.260922.6

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.
@@ -61,8 +61,11 @@ interface ConnectOptions {
61
61
  readonly timeout?: string;
62
62
  }
63
63
  declare function handleConnect(client: OmniClient, opts: ConnectOptions, ports?: ConnectPorts): Promise<CommandResult>;
64
+ /** The follow-up `omni send` invocation printed after `omni slack dm` resolves a channel. */
65
+ declare function dmSendHint(instance: string, channelId: string): string;
64
66
  export declare function createSlackCommand(): Command;
65
67
  export declare const __testables: {
68
+ dmSendHint: typeof dmSendHint;
66
69
  handleAppSetup: typeof handleAppSetup;
67
70
  handleAppStatus: typeof handleAppStatus;
68
71
  handleConnect: typeof handleConnect;
@@ -1 +1 @@
1
- {"version":3,"file":"slack.d.ts","sourceRoot":"","sources":["../../src/commands/slack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CpC,wGAAwG;AACxG,UAAU,aAAa;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAMD;;;;GAIG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG1C;AAkDD,gGAAgG;AAChG,UAAU,UAAU;IAClB,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACxD;AAED,kGAAkG;AAClG,UAAU,YAAY;IACpB,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAA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3B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,YAAY,EAClB,KAAK,GAAE,UAA8B,GACpC,OAAO,CAAC,aAAa,CAAC,CAcxB;AAED,iBAAe,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAGzE;AAMD,UAAU,cAAc;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AA0CD,iBAAe,aAAa,CAC1B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,cAAc,EACpB,KAAK,GAAE,YAAkC,GACxC,OAAO,CAAC,aAAa,CAAC,CAgDxB;AAgCD,6FAA6F;AAC7F,iBAAS,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAkE5C;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;CAYvB,CAAC"}
package/dist/index.js CHANGED
@@ -137453,7 +137453,7 @@ import { fileURLToPath } from "url";
137453
137453
  // package.json
137454
137454
  var package_default = {
137455
137455
  name: "@automagik/omni",
137456
- version: "2.260922.4",
137456
+ version: "2.260922.6",
137457
137457
  repository: {
137458
137458
  type: "git",
137459
137459
  url: "git+https://github.com/automagik-dev/omni.git",
@@ -137919,6 +137919,7 @@ init_output();
137919
137919
  // src/resolve.ts
137920
137920
  init_output();
137921
137921
  var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
137922
+ var SLACK_CONVERSATION_RE = /^[CDG][A-Z0-9]{8,}$/;
137922
137923
  async function resolveInstanceId(input) {
137923
137924
  if (UUID_RE.test(input))
137924
137925
  return input;
@@ -137981,7 +137982,8 @@ async function resolveChatId(input, instanceId) {
137981
137982
  await assertChatInInstance(input, instanceId);
137982
137983
  return input;
137983
137984
  }
137984
- const byExternal = input.includes("@") ? await resolveChatByExternalId(input, instanceId) : undefined;
137985
+ const looksExternal = input.includes("@") || SLACK_CONVERSATION_RE.test(input);
137986
+ const byExternal = looksExternal ? await resolveChatByExternalId(input, instanceId) : undefined;
137985
137987
  if (byExternal)
137986
137988
  return byExternal;
137987
137989
  const client = getClient();
@@ -138020,6 +138022,8 @@ async function resolveRecipient(input, instanceId) {
138020
138022
  return input;
138021
138023
  if (input.includes("@"))
138022
138024
  return input;
138025
+ if (SLACK_CONVERSATION_RE.test(input))
138026
+ return input;
138023
138027
  return resolveChatId(input, instanceId);
138024
138028
  }
138025
138029
  async function resolveMessageId(input, chatId) {
@@ -151480,6 +151484,9 @@ function createSlackAppCommand() {
151480
151484
  });
151481
151485
  return app;
151482
151486
  }
151487
+ function dmSendHint(instance3, channelId) {
151488
+ return `Send with: omni send --instance ${instance3} --to ${channelId} --text "..."`;
151489
+ }
151483
151490
  function createSlackCommand() {
151484
151491
  const cmd = new Command("slack").description("Slack-only operations: connect a workspace, open a DM, search messages (#889)");
151485
151492
  cmd.command("dm <instance> <userId>").description("Resolve the DM channel id for a Slack user (U\u2026). Idempotent.").action(async (instance3, userId) => {
@@ -151487,7 +151494,7 @@ function createSlackCommand() {
151487
151494
  const instanceId = await resolveInstanceId(instance3);
151488
151495
  const { channelId } = await getClient().slack.openDm(instanceId, userId);
151489
151496
  success(`DM channel with ${userId}: ${channelId}`);
151490
- info(`Send with: omni send text ${instance3} ${channelId} "..."`);
151497
+ info(dmSendHint(instance3, channelId));
151491
151498
  } catch (err2) {
151492
151499
  error(`Failed to open DM: ${err2 instanceof Error ? err2.message : "Unknown error"}`, undefined, 3);
151493
151500
  }
package/dist/resolve.d.ts CHANGED
@@ -24,7 +24,8 @@ export declare function resolveInstanceId(input: string): Promise<string>;
24
24
  * 2. UUID prefix match (minimum 2 hex chars)
25
25
  * 3. Exact name match (case-insensitive)
26
26
  * 4. Name substring match (case-insensitive)
27
- * (inputs containing "@" first try an exact external id / JID match)
27
+ * (inputs containing "@", and Slack conversation ids, first try an exact
28
+ * external id / JID match)
28
29
  *
29
30
  * Exits with error if no match or ambiguous.
30
31
  */
@@ -32,8 +33,9 @@ export declare function resolveChatId(input: string, instanceId?: string): Promi
32
33
  /**
33
34
  * Resolve a recipient identifier for the send command.
34
35
  *
35
- * If the input looks like a phone number (starts with '+' or all digits) or a JID
36
- * (contains '@'), it is passed through as-is — these are external identifiers.
36
+ * If the input looks like a phone number (starts with '+' or all digits), a JID
37
+ * (contains '@') or a Slack conversation id (C…/D…/G…), it is passed through
38
+ * as-is — these are external identifiers the API's send path accepts directly.
37
39
  *
38
40
  * Otherwise, resolves as a chat identifier (full UUID, UUID prefix, name).
39
41
  * Exits with error if resolution fails.
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BtE;AA4BD;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuCvF;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY1F;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwCtF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,M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AM,CAAC,CAe1F;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwCtF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBpE;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BxE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BnE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BrE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBvF"}
@@ -136020,6 +136020,7 @@ var init_manifest = __esm(() => {
136020
136020
  "channels:history",
136021
136021
  "channels:read",
136022
136022
  "chat:write",
136023
+ "files:read",
136023
136024
  "files:write",
136024
136025
  "groups:history",
136025
136026
  "groups:read",
@@ -254737,7 +254738,7 @@ var init_sentry_scrub = __esm(() => {
254737
254738
  var require_package7 = __commonJS((exports, module) => {
254738
254739
  module.exports = {
254739
254740
  name: "@omni/api",
254740
- version: "2.260922.4",
254741
+ version: "2.260922.6",
254741
254742
  private: true,
254742
254743
  type: "module",
254743
254744
  exports: {
@@ -404083,14 +404084,22 @@ function getMimeType2(content) {
404083
404084
  return;
404084
404085
  }
404085
404086
  }
404087
+ function selectSlackDownloadToken(instance4) {
404088
+ const slackAuthMode = instance4.slackAuthMode;
404089
+ const slackUserToken = instance4.slackUserToken;
404090
+ if (slackAuthMode === "user" && typeof slackUserToken === "string" && slackUserToken.length > 0) {
404091
+ return slackUserToken;
404092
+ }
404093
+ return instance4.slackBotToken;
404094
+ }
404086
404095
  async function buildFetchOptions2(ctx, instanceId, channelType, trustedTenantId) {
404087
404096
  if (channelType !== "slack")
404088
404097
  return;
404089
404098
  try {
404090
404099
  const instance4 = await runMediaDb(ctx, trustedTenantId, () => ctx.services.instances.getById(instanceId));
404091
- const slackBotToken = instance4.slackBotToken;
404092
- if (slackBotToken) {
404093
- return { headers: { Authorization: `Bearer ${slackBotToken}` } };
404100
+ const token = selectSlackDownloadToken(instance4);
404101
+ if (token) {
404102
+ return { headers: { Authorization: `Bearer ${token}` } };
404094
404103
  }
404095
404104
  } catch {}
404096
404105
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260922.4",
3
+ "version": "2.260922.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/automagik-dev/omni.git",