@cuylabs/channel-slack 0.5.1 → 0.7.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.
Files changed (66) hide show
  1. package/README.md +25 -136
  2. package/dist/app-home.d.ts +23 -0
  3. package/dist/app-home.js +40 -0
  4. package/dist/artifacts/index.d.ts +135 -0
  5. package/dist/artifacts/index.js +299 -0
  6. package/dist/{assistant.d.ts → assistant/index.d.ts} +1 -1
  7. package/dist/{assistant.js → assistant/index.js} +2 -2
  8. package/dist/auth/index.d.ts +56 -0
  9. package/dist/auth/index.js +168 -0
  10. package/dist/{chunk-IDVDMJ5U.js → chunk-6JSGIVQH.js} +110 -3
  11. package/dist/chunk-6WHFQUYQ.js +54 -0
  12. package/dist/{bolt.js → chunk-73QXT7MA.js} +25 -320
  13. package/dist/{chunk-CMR6B76C.js → chunk-DNVSH7H5.js} +407 -1
  14. package/dist/chunk-IRFKUPJN.js +235 -0
  15. package/dist/chunk-QJYCHWN6.js +76 -0
  16. package/dist/chunk-S3SWPYXJ.js +81 -0
  17. package/dist/{chunk-JZG4IETE.js → chunk-X4WBBBYM.js} +0 -52
  18. package/dist/core.js +5 -3
  19. package/dist/diagnostics/index.d.ts +71 -0
  20. package/dist/{diagnostics.js → diagnostics/index.js} +5 -1
  21. package/dist/entrypoints/index.d.ts +120 -0
  22. package/dist/entrypoints/index.js +132 -0
  23. package/dist/{feedback.js → feedback/index.js} +5 -7
  24. package/dist/{history.d.ts → history/index.d.ts} +2 -2
  25. package/dist/{history.js → history/index.js} +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +28 -15
  28. package/dist/{policy.d.ts → policy/index.d.ts} +103 -2
  29. package/dist/{policy.js → policy/index.js} +13 -1
  30. package/dist/runtime-BNBHOZSQ.d.ts +53 -0
  31. package/dist/{setup.d.ts → setup/index.d.ts} +30 -3
  32. package/dist/{setup.js → setup/index.js} +137 -3
  33. package/dist/transports/http/index.d.ts +68 -0
  34. package/dist/transports/http/index.js +8 -0
  35. package/dist/transports/index.d.ts +8 -0
  36. package/dist/transports/index.js +24 -0
  37. package/dist/transports/socket/index.d.ts +94 -0
  38. package/dist/transports/socket/index.js +19 -0
  39. package/dist/types-B9NfCVrk.d.ts +141 -0
  40. package/dist/views/index.d.ts +98 -0
  41. package/dist/views/index.js +22 -0
  42. package/docs/README.md +32 -0
  43. package/docs/concepts/activity.md +3 -3
  44. package/docs/concepts/artifacts.md +56 -0
  45. package/docs/concepts/entrypoints.md +73 -0
  46. package/docs/concepts/setup-requirements.md +23 -0
  47. package/docs/concepts/{bolt-runtime.md → transport-runtime.md} +9 -4
  48. package/docs/concepts/views.md +46 -0
  49. package/docs/recipes/generate-slack-manifest.md +16 -0
  50. package/docs/recipes/publish-artifact.md +45 -0
  51. package/docs/recipes/slash-command-and-shortcut.md +51 -0
  52. package/docs/recipes/socket-mode-app.md +1 -1
  53. package/docs/reference/channel-slack-boundary.md +10 -6
  54. package/docs/reference/exports.md +18 -12
  55. package/docs/reference/source-layout.md +36 -0
  56. package/package.json +68 -39
  57. package/dist/bolt.d.ts +0 -364
  58. package/dist/chunk-NE57BLLU.js +0 -0
  59. package/dist/diagnostics.d.ts +0 -22
  60. package/dist/shared.d.ts +0 -2
  61. package/dist/shared.js +0 -43
  62. /package/dist/{feedback.d.ts → feedback/index.d.ts} +0 -0
  63. /package/dist/{targets.d.ts → targets/index.d.ts} +0 -0
  64. /package/dist/{targets.js → targets/index.js} +0 -0
  65. /package/dist/{users.d.ts → users/index.d.ts} +0 -0
  66. /package/dist/{users.js → users/index.js} +0 -0
package/dist/index.js CHANGED
@@ -1,12 +1,30 @@
1
- import "./chunk-NE57BLLU.js";
1
+ import {
2
+ createAsyncSlackMessagePolicyResolver,
3
+ createAsyncSlackThreadAwareMessagePolicyResolver,
4
+ createInMemorySlackMessagePolicyStateStore,
5
+ createInMemorySlackThreadParticipationStateStore,
6
+ createPostgresSlackMessagePolicyStateStore,
7
+ createPostgresSlackThreadParticipationStateStore,
8
+ createSlackMessagePolicyMessageKey,
9
+ createSlackMessagePolicyResolver,
10
+ createSlackMessagePolicyThreadKey,
11
+ initializePostgresSlackMessagePolicyState,
12
+ initializePostgresSlackThreadParticipationState,
13
+ prunePostgresSlackMessagePolicyState,
14
+ prunePostgresSlackThreadParticipationState,
15
+ resolveSlackThreadParticipationEligibility,
16
+ shouldRegisterSlackPassiveChannelMessages
17
+ } from "./chunk-DNVSH7H5.js";
2
18
  import {
3
19
  currentSlackTurnContext,
4
20
  formatSlackAttributedFollowUp,
5
- markdownToSlackMrkdwn,
6
- resolveSlackMessageFormatter,
7
21
  resolveThreadAwareSlackSessionId,
8
22
  runWithSlackTurnContext
9
- } from "./chunk-JZG4IETE.js";
23
+ } from "./chunk-X4WBBBYM.js";
24
+ import {
25
+ markdownToSlackMrkdwn,
26
+ resolveSlackMessageFormatter
27
+ } from "./chunk-6WHFQUYQ.js";
10
28
  import {
11
29
  extractSlackActionToken,
12
30
  extractSlackAuthContext,
@@ -22,21 +40,13 @@ import {
22
40
  resolveSlackChannelType,
23
41
  stripLeadingMentions
24
42
  } from "./chunk-FPCE5V5Y.js";
25
- import {
26
- createAsyncSlackMessagePolicyResolver,
27
- createInMemorySlackMessagePolicyStateStore,
28
- createPostgresSlackMessagePolicyStateStore,
29
- createSlackMessagePolicyMessageKey,
30
- createSlackMessagePolicyResolver,
31
- createSlackMessagePolicyThreadKey,
32
- initializePostgresSlackMessagePolicyState,
33
- prunePostgresSlackMessagePolicyState,
34
- shouldRegisterSlackPassiveChannelMessages
35
- } from "./chunk-CMR6B76C.js";
36
43
  export {
37
44
  createAsyncSlackMessagePolicyResolver,
45
+ createAsyncSlackThreadAwareMessagePolicyResolver,
38
46
  createInMemorySlackMessagePolicyStateStore,
47
+ createInMemorySlackThreadParticipationStateStore,
39
48
  createPostgresSlackMessagePolicyStateStore,
49
+ createPostgresSlackThreadParticipationStateStore,
40
50
  createSlackMessagePolicyMessageKey,
41
51
  createSlackMessagePolicyResolver,
42
52
  createSlackMessagePolicyThreadKey,
@@ -49,13 +59,16 @@ export {
49
59
  extractSlackUserIdentity,
50
60
  formatSlackAttributedFollowUp,
51
61
  initializePostgresSlackMessagePolicyState,
62
+ initializePostgresSlackThreadParticipationState,
52
63
  isProcessableMessage,
53
64
  markdownToSlackMrkdwn,
54
65
  parseSlackMentionActivity,
55
66
  parseSlackMessageActivity,
56
67
  prunePostgresSlackMessagePolicyState,
68
+ prunePostgresSlackThreadParticipationState,
57
69
  resolveSlackChannelType,
58
70
  resolveSlackMessageFormatter,
71
+ resolveSlackThreadParticipationEligibility,
59
72
  resolveThreadAwareSlackSessionId,
60
73
  runWithSlackTurnContext,
61
74
  shouldRegisterSlackPassiveChannelMessages,
@@ -1,4 +1,4 @@
1
- import { S as SlackActivityInfo } from './activity-ByrD9Ftr.js';
1
+ import { S as SlackActivityInfo } from '../activity-ByrD9Ftr.js';
2
2
 
3
3
  type MaybePromise<T> = T | Promise<T>;
4
4
  type SlackChannelMessagePolicy = "disabled" | "mentioned-threads" | "allowed-channels" | "any-added-channel";
@@ -173,4 +173,105 @@ declare function createInMemorySlackMessagePolicyStateStore({ maxAcceptedMessage
173
173
  maxMentionedThreads?: number;
174
174
  }): SlackSyncMessagePolicyStateStore;
175
175
 
176
- export { type PostgresSlackMessagePolicyPruneResult, type PostgresSlackMessagePolicyStateStore, type PostgresSlackMessagePolicyStateStoreOptions, type SlackAsyncMessagePolicyConfig, type SlackAsyncMessagePolicyResolver, type SlackChannelMessagePolicy, type SlackMentionedThreadState, type SlackMessagePolicyAcceptReason, type SlackMessagePolicyAcceptedDecision, type SlackMessagePolicyConfig, type SlackMessagePolicyDecision, type SlackMessagePolicyPostgresClient, type SlackMessagePolicyRejectReason, type SlackMessagePolicyRejectedDecision, type SlackMessagePolicyResolver, type SlackMessagePolicyStateContext, type SlackMessagePolicyStateStore, type SlackSyncMessagePolicyStateStore, type SlackThreadReplyPolicy, createAsyncSlackMessagePolicyResolver, createInMemorySlackMessagePolicyStateStore, createPostgresSlackMessagePolicyStateStore, createSlackMessagePolicyMessageKey, createSlackMessagePolicyResolver, createSlackMessagePolicyThreadKey, initializePostgresSlackMessagePolicyState, prunePostgresSlackMessagePolicyState, shouldRegisterSlackPassiveChannelMessages };
176
+ type SlackThreadParticipationMode = "quiet" | "active";
177
+ interface SlackThreadParticipationState {
178
+ mode: "quiet";
179
+ reason?: string;
180
+ sourceMessageTs?: string;
181
+ updatedAt?: string;
182
+ updatedByUserId?: string;
183
+ }
184
+ interface SlackThreadParticipationStateContext {
185
+ activity: SlackActivityInfo;
186
+ key: string;
187
+ }
188
+ interface SlackThreadParticipationPruneResult {
189
+ quietThreadsDeleted: number;
190
+ }
191
+ interface SlackThreadParticipationStateStore {
192
+ get(key: string, context: SlackThreadParticipationStateContext): Promise<SlackThreadParticipationState | undefined>;
193
+ setQuiet(key: string, state: Omit<SlackThreadParticipationState, "mode" | "updatedAt">, context: SlackThreadParticipationStateContext): Promise<void>;
194
+ clear(key: string, context: SlackThreadParticipationStateContext): Promise<void>;
195
+ close?(): Promise<void>;
196
+ prune?(): Promise<SlackThreadParticipationPruneResult>;
197
+ }
198
+ interface SlackThreadParticipationEligibility {
199
+ available: boolean;
200
+ reason?: string;
201
+ threadKey?: string;
202
+ threadTs?: string;
203
+ }
204
+ interface SlackThreadParticipationEligibilityOptions {
205
+ activity: SlackActivityInfo;
206
+ policy: Pick<SlackMessagePolicyConfig, "messagePolicy" | "threadReplyPolicy">;
207
+ stateStore?: SlackThreadParticipationStateStore;
208
+ }
209
+ interface InMemorySlackThreadParticipationStateStoreOptions {
210
+ maxThreads?: number;
211
+ now?: () => Date;
212
+ }
213
+ interface SlackThreadParticipationPostgresClient {
214
+ end?: () => Promise<void>;
215
+ query<T = unknown>(sql: string, values?: readonly unknown[]): Promise<{
216
+ rows: T[];
217
+ rowCount?: number | null;
218
+ }>;
219
+ }
220
+ interface PostgresSlackThreadParticipationStateStoreOptions {
221
+ client?: SlackThreadParticipationPostgresClient;
222
+ connectionString?: string;
223
+ ensureSchema?: boolean;
224
+ onPruneError?: (error: unknown) => void;
225
+ pruneBatchSize?: number;
226
+ pruneIntervalMs?: number;
227
+ retentionMs?: number;
228
+ schema?: string;
229
+ tableName?: string;
230
+ }
231
+ interface PostgresSlackThreadParticipationStateStore extends SlackThreadParticipationStateStore {
232
+ close(): Promise<void>;
233
+ prune(): Promise<SlackThreadParticipationPruneResult>;
234
+ }
235
+ declare function resolveSlackThreadParticipationEligibility({ activity, policy, stateStore, }: SlackThreadParticipationEligibilityOptions): SlackThreadParticipationEligibility;
236
+ declare function createInMemorySlackThreadParticipationStateStore({ maxThreads, now, }?: InMemorySlackThreadParticipationStateStoreOptions): SlackThreadParticipationStateStore;
237
+ declare function createPostgresSlackThreadParticipationStateStore({ client, connectionString, ensureSchema, onPruneError, pruneBatchSize, pruneIntervalMs, retentionMs, schema, tableName, }: PostgresSlackThreadParticipationStateStoreOptions): PostgresSlackThreadParticipationStateStore;
238
+ declare function initializePostgresSlackThreadParticipationState({ client, ensureSchema, schema, tableName, }: {
239
+ client: SlackThreadParticipationPostgresClient;
240
+ ensureSchema?: boolean;
241
+ schema?: string;
242
+ tableName?: string;
243
+ }): Promise<void>;
244
+ declare function prunePostgresSlackThreadParticipationState({ client, pruneBatchSize, retentionMs, schema, tableName, }: {
245
+ client: SlackThreadParticipationPostgresClient;
246
+ pruneBatchSize?: number;
247
+ retentionMs?: number;
248
+ schema?: string;
249
+ tableName?: string;
250
+ }): Promise<SlackThreadParticipationPruneResult>;
251
+
252
+ interface SlackThreadParticipationReactivation {
253
+ reason?: string;
254
+ threadKey: string;
255
+ threadTs?: string;
256
+ }
257
+ interface SlackQuietThreadRejectedDecision {
258
+ accepted: false;
259
+ activity: SlackActivityInfo;
260
+ reason: "quiet-thread";
261
+ threadKey: string;
262
+ threadParticipationReason?: string;
263
+ threadTs?: string;
264
+ }
265
+ type SlackThreadAwareMessagePolicyDecision = (SlackMessagePolicyDecision & {
266
+ reactivatedThreadParticipation?: SlackThreadParticipationReactivation;
267
+ }) | SlackQuietThreadRejectedDecision;
268
+ interface SlackThreadAwareMessagePolicyResolver {
269
+ resolve(activity: SlackActivityInfo): Promise<SlackThreadAwareMessagePolicyDecision>;
270
+ resolveMessage(activity: SlackActivityInfo): Promise<string | undefined>;
271
+ }
272
+ interface SlackThreadAwareMessagePolicyConfig extends SlackAsyncMessagePolicyConfig {
273
+ threadParticipationStore?: SlackThreadParticipationStateStore;
274
+ }
275
+ declare function createAsyncSlackThreadAwareMessagePolicyResolver(config?: SlackThreadAwareMessagePolicyConfig): SlackThreadAwareMessagePolicyResolver;
276
+
277
+ export { type InMemorySlackThreadParticipationStateStoreOptions, type PostgresSlackMessagePolicyPruneResult, type PostgresSlackMessagePolicyStateStore, type PostgresSlackMessagePolicyStateStoreOptions, type PostgresSlackThreadParticipationStateStore, type PostgresSlackThreadParticipationStateStoreOptions, type SlackAsyncMessagePolicyConfig, type SlackAsyncMessagePolicyResolver, type SlackChannelMessagePolicy, type SlackMentionedThreadState, type SlackMessagePolicyAcceptReason, type SlackMessagePolicyAcceptedDecision, type SlackMessagePolicyConfig, type SlackMessagePolicyDecision, type SlackMessagePolicyPostgresClient, type SlackMessagePolicyRejectReason, type SlackMessagePolicyRejectedDecision, type SlackMessagePolicyResolver, type SlackMessagePolicyStateContext, type SlackMessagePolicyStateStore, type SlackQuietThreadRejectedDecision, type SlackSyncMessagePolicyStateStore, type SlackThreadAwareMessagePolicyConfig, type SlackThreadAwareMessagePolicyDecision, type SlackThreadAwareMessagePolicyResolver, type SlackThreadParticipationEligibility, type SlackThreadParticipationEligibilityOptions, type SlackThreadParticipationMode, type SlackThreadParticipationPostgresClient, type SlackThreadParticipationPruneResult, type SlackThreadParticipationReactivation, type SlackThreadParticipationState, type SlackThreadParticipationStateContext, type SlackThreadParticipationStateStore, type SlackThreadReplyPolicy, createAsyncSlackMessagePolicyResolver, createAsyncSlackThreadAwareMessagePolicyResolver, createInMemorySlackMessagePolicyStateStore, createInMemorySlackThreadParticipationStateStore, createPostgresSlackMessagePolicyStateStore, createPostgresSlackThreadParticipationStateStore, createSlackMessagePolicyMessageKey, createSlackMessagePolicyResolver, createSlackMessagePolicyThreadKey, initializePostgresSlackMessagePolicyState, initializePostgresSlackThreadParticipationState, prunePostgresSlackMessagePolicyState, prunePostgresSlackThreadParticipationState, resolveSlackThreadParticipationEligibility, shouldRegisterSlackPassiveChannelMessages };
@@ -1,22 +1,34 @@
1
1
  import {
2
2
  createAsyncSlackMessagePolicyResolver,
3
+ createAsyncSlackThreadAwareMessagePolicyResolver,
3
4
  createInMemorySlackMessagePolicyStateStore,
5
+ createInMemorySlackThreadParticipationStateStore,
4
6
  createPostgresSlackMessagePolicyStateStore,
7
+ createPostgresSlackThreadParticipationStateStore,
5
8
  createSlackMessagePolicyMessageKey,
6
9
  createSlackMessagePolicyResolver,
7
10
  createSlackMessagePolicyThreadKey,
8
11
  initializePostgresSlackMessagePolicyState,
12
+ initializePostgresSlackThreadParticipationState,
9
13
  prunePostgresSlackMessagePolicyState,
14
+ prunePostgresSlackThreadParticipationState,
15
+ resolveSlackThreadParticipationEligibility,
10
16
  shouldRegisterSlackPassiveChannelMessages
11
- } from "./chunk-CMR6B76C.js";
17
+ } from "../chunk-DNVSH7H5.js";
12
18
  export {
13
19
  createAsyncSlackMessagePolicyResolver,
20
+ createAsyncSlackThreadAwareMessagePolicyResolver,
14
21
  createInMemorySlackMessagePolicyStateStore,
22
+ createInMemorySlackThreadParticipationStateStore,
15
23
  createPostgresSlackMessagePolicyStateStore,
24
+ createPostgresSlackThreadParticipationStateStore,
16
25
  createSlackMessagePolicyMessageKey,
17
26
  createSlackMessagePolicyResolver,
18
27
  createSlackMessagePolicyThreadKey,
19
28
  initializePostgresSlackMessagePolicyState,
29
+ initializePostgresSlackThreadParticipationState,
20
30
  prunePostgresSlackMessagePolicyState,
31
+ prunePostgresSlackThreadParticipationState,
32
+ resolveSlackThreadParticipationEligibility,
21
33
  shouldRegisterSlackPassiveChannelMessages
22
34
  };
@@ -0,0 +1,53 @@
1
+ import { Logger } from '@slack/bolt';
2
+ import { L as Logger$1 } from './logging-Bl3HfcC8.js';
3
+
4
+ type SlackSocketModeRuntimePolicy = "single-instance" | "external-coordination";
5
+ interface SlackSocketModeReceiverRuntimeOptions {
6
+ autoReconnectEnabled?: boolean;
7
+ clientPingTimeout?: number;
8
+ pingPongLoggingEnabled?: boolean;
9
+ serverPingTimeout?: number;
10
+ }
11
+ interface SlackSocketModeRuntimeOptions {
12
+ appSlug: string;
13
+ appToken?: string;
14
+ autoReconnectEnabled?: boolean;
15
+ clientPingTimeoutMs?: number;
16
+ exitProcess?: (code: number) => never | void;
17
+ lockDir?: string;
18
+ lockEnabled?: boolean;
19
+ logger?: Logger$1;
20
+ logLevel?: "debug" | "info" | "warn" | "error";
21
+ pingPongLoggingEnabled?: boolean;
22
+ restartGuardEnabled?: boolean;
23
+ restartGuardMaxWarnings?: number;
24
+ restartGuardWindowMs?: number;
25
+ runtimePolicy?: SlackSocketModeRuntimePolicy;
26
+ serverPingTimeoutMs?: number;
27
+ }
28
+ interface SlackSocketModeRuntime {
29
+ boltAppOptions: {
30
+ logger: Logger;
31
+ };
32
+ close(): void;
33
+ socketModeReceiverOptions: SlackSocketModeReceiverRuntimeOptions;
34
+ }
35
+ interface SlackSocketModeRestartGuard {
36
+ record(message: string): void;
37
+ }
38
+ declare function createSlackSocketModeRuntime({ appSlug, appToken, autoReconnectEnabled, clientPingTimeoutMs, exitProcess, lockDir, lockEnabled, logger, logLevel, pingPongLoggingEnabled, restartGuardEnabled, restartGuardMaxWarnings, restartGuardWindowMs, runtimePolicy, serverPingTimeoutMs, }: SlackSocketModeRuntimeOptions): SlackSocketModeRuntime;
39
+ declare function createSlackSocketModeRestartGuard({ enabled, exitProcess, logger, maxWarnings, windowMs, }: {
40
+ enabled: boolean;
41
+ exitProcess: (code: number) => never | void;
42
+ logger?: Logger$1;
43
+ maxWarnings: number;
44
+ windowMs: number;
45
+ }): SlackSocketModeRestartGuard;
46
+ declare function createSlackSdkLogger({ level, logger, restartGuard, }: {
47
+ level: "debug" | "info" | "warn" | "error";
48
+ logger?: Logger$1;
49
+ restartGuard?: SlackSocketModeRestartGuard;
50
+ }): Logger;
51
+ declare function redactSlackSocketModeLogValue(value: unknown, depth?: number): unknown;
52
+
53
+ export { type SlackSocketModeReceiverRuntimeOptions as S, type SlackSocketModeRestartGuard as a, type SlackSocketModeRuntime as b, type SlackSocketModeRuntimeOptions as c, type SlackSocketModeRuntimePolicy as d, createSlackSdkLogger as e, createSlackSocketModeRestartGuard as f, createSlackSocketModeRuntime as g, redactSlackSocketModeLogValue as r };
@@ -1,6 +1,6 @@
1
- import { I as InspectSlackConnectionOptions, f as SlackDiagnosticsClient, c as SlackConnectionInspection } from './inspect-BpY5JA0K.js';
1
+ import { I as InspectSlackConnectionOptions, f as SlackDiagnosticsClient, c as SlackConnectionInspection } from '../inspect-BpY5JA0K.js';
2
2
 
3
- type SlackSetupFeature = "assistant" | "app-mentions" | "direct-messages" | "channel-messages" | "history" | "interactivity" | "feedback" | "user-profiles" | "user-emails";
3
+ type SlackSetupFeature = "assistant" | "app-mentions" | "direct-messages" | "channel-messages" | "slash-commands" | "shortcuts" | "artifacts" | "canvas-artifacts" | "history" | "interactivity" | "views" | "feedback" | "user-profiles" | "user-emails" | "workspace-search";
4
4
  type SlackSetupFeaturePreset = "assistant" | "channel-adapter" | "agent-app";
5
5
  type SlackSetupTransport = "http" | "socket";
6
6
  interface SlackSetupEnvironmentVariable {
@@ -11,6 +11,8 @@ interface SlackSetupSettingsRequirements {
11
11
  assistantView: boolean;
12
12
  eventSubscriptions: boolean;
13
13
  interactivity: boolean;
14
+ slashCommands: boolean;
15
+ shortcuts: boolean;
14
16
  socketMode: boolean;
15
17
  }
16
18
  interface SlackSetupRequirements {
@@ -43,6 +45,16 @@ interface GetSlackSetupRequirementsOptions {
43
45
  * is used as-is.
44
46
  */
45
47
  features?: readonly SlackSetupFeature[];
48
+ /**
49
+ * Slash commands exposed by the host app. Supplying at least one command
50
+ * automatically enables the `slash-commands` feature.
51
+ */
52
+ slashCommands?: readonly SlackManifestSlashCommand[];
53
+ /**
54
+ * Global or message shortcuts exposed by the host app. Supplying at least one
55
+ * shortcut automatically enables the `shortcuts` feature.
56
+ */
57
+ shortcuts?: readonly SlackManifestShortcut[];
46
58
  /**
47
59
  * Inbound transport used by the direct Slack app.
48
60
  *
@@ -76,6 +88,19 @@ interface SlackManifestSuggestedPrompt {
76
88
  title: string;
77
89
  message: string;
78
90
  }
91
+ interface SlackManifestShortcut {
92
+ type: "global" | "message";
93
+ name: string;
94
+ callback_id: string;
95
+ description: string;
96
+ }
97
+ interface SlackManifestSlashCommand {
98
+ command: string;
99
+ description: string;
100
+ should_escape?: boolean;
101
+ url?: string;
102
+ usage_hint?: string;
103
+ }
79
104
  interface SlackAppManifest {
80
105
  display_information: {
81
106
  name: string;
@@ -92,6 +117,8 @@ interface SlackAppManifest {
92
117
  assistant_description?: string;
93
118
  suggested_prompts?: SlackManifestSuggestedPrompt[];
94
119
  };
120
+ shortcuts?: SlackManifestShortcut[];
121
+ slash_commands?: SlackManifestSlashCommand[];
95
122
  };
96
123
  oauth_config: {
97
124
  scopes: {
@@ -162,4 +189,4 @@ interface SlackAppSetupInspection {
162
189
  }
163
190
  declare function inspectSlackAppSetup(options?: InspectSlackAppSetupOptions): Promise<SlackAppSetupInspection>;
164
191
 
165
- export { type CreateSlackAppManifestOptions, type GetSlackSetupRequirementsOptions, type InspectSlackAppSetupOptions, type SlackAppManifest, type SlackAppManifestComparison, type SlackAppManifestComparisonFinding, type SlackAppManifestComparisonFindingSeverity, type SlackAppSetupInspection, SlackDiagnosticsClient, type SlackManifestAppHome, type SlackManifestSuggestedPrompt, type SlackSetupEnvironmentVariable, type SlackSetupFeature, type SlackSetupFeaturePreset, type SlackSetupRequirements, type SlackSetupSettingsRequirements, type SlackSetupTransport, compareSlackAppManifest, createSlackAppManifest, getSlackSetupRequirements, inspectSlackAppSetup, slackSetupFeaturePresets };
192
+ export { type CreateSlackAppManifestOptions, type GetSlackSetupRequirementsOptions, type InspectSlackAppSetupOptions, type SlackAppManifest, type SlackAppManifestComparison, type SlackAppManifestComparisonFinding, type SlackAppManifestComparisonFindingSeverity, type SlackAppSetupInspection, SlackDiagnosticsClient, type SlackManifestAppHome, type SlackManifestShortcut, type SlackManifestSlashCommand, type SlackManifestSuggestedPrompt, type SlackSetupEnvironmentVariable, type SlackSetupFeature, type SlackSetupFeaturePreset, type SlackSetupRequirements, type SlackSetupSettingsRequirements, type SlackSetupTransport, compareSlackAppManifest, createSlackAppManifest, getSlackSetupRequirements, inspectSlackAppSetup, slackSetupFeaturePresets };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  inspectSlackConnection
3
- } from "./chunk-IDVDMJ5U.js";
3
+ } from "../chunk-6JSGIVQH.js";
4
4
 
5
5
  // src/setup/requirements.ts
6
6
  var DEFAULT_EVENTS_PATH = "/slack/events";
@@ -27,6 +27,20 @@ var FEATURE_REQUIREMENTS = {
27
27
  botScopes: ["channels:history", "chat:write", "groups:history"],
28
28
  botEvents: ["message.channels", "message.groups"]
29
29
  },
30
+ "slash-commands": {
31
+ botScopes: ["commands"],
32
+ interactivity: true
33
+ },
34
+ shortcuts: {
35
+ botScopes: ["commands"],
36
+ interactivity: true
37
+ },
38
+ artifacts: {
39
+ botScopes: ["chat:write", "files:write"]
40
+ },
41
+ "canvas-artifacts": {
42
+ botScopes: ["canvases:write"]
43
+ },
30
44
  history: {
31
45
  botScopes: [
32
46
  "channels:history",
@@ -39,6 +53,9 @@ var FEATURE_REQUIREMENTS = {
39
53
  botScopes: ["chat:write"],
40
54
  interactivity: true
41
55
  },
56
+ views: {
57
+ interactivity: true
58
+ },
42
59
  feedback: {
43
60
  botScopes: ["chat:write"],
44
61
  interactivity: true
@@ -49,6 +66,9 @@ var FEATURE_REQUIREMENTS = {
49
66
  },
50
67
  "user-emails": {
51
68
  botScopes: ["users:read", "users:read.email"]
69
+ },
70
+ "workspace-search": {
71
+ botScopes: ["search:read.files", "search:read.public", "search:read.users"]
52
72
  }
53
73
  };
54
74
  function getSlackSetupRequirements(options = {}) {
@@ -63,6 +83,8 @@ function getSlackSetupRequirements(options = {}) {
63
83
  const botEvents = [];
64
84
  let assistantView = false;
65
85
  let interactivity = false;
86
+ let slashCommands = false;
87
+ let shortcuts = false;
66
88
  for (const feature of features) {
67
89
  const requirement = FEATURE_REQUIREMENTS[feature];
68
90
  if (!requirement) {
@@ -73,6 +95,8 @@ function getSlackSetupRequirements(options = {}) {
73
95
  collect(requirement.botEvents, botEvents);
74
96
  assistantView ||= requirement.assistantView === true;
75
97
  interactivity ||= requirement.interactivity === true;
98
+ slashCommands ||= feature === "slash-commands";
99
+ shortcuts ||= feature === "shortcuts";
76
100
  }
77
101
  collect(options.extraBotScopes, botScopes);
78
102
  collect(options.extraOptionalBotScopes, optionalBotScopes);
@@ -91,6 +115,8 @@ function getSlackSetupRequirements(options = {}) {
91
115
  assistantView,
92
116
  eventSubscriptions: normalizedBotEvents.length > 0,
93
117
  interactivity,
118
+ slashCommands,
119
+ shortcuts,
94
120
  socketMode: transport === "socket"
95
121
  };
96
122
  const environment = resolveEnvironment({
@@ -112,9 +138,13 @@ function getSlackSetupRequirements(options = {}) {
112
138
  };
113
139
  }
114
140
  function resolveSetupFeatures(options) {
141
+ const inferredFeatures = [
142
+ ...options.slashCommands && options.slashCommands.length > 0 ? ["slash-commands"] : [],
143
+ ...options.shortcuts && options.shortcuts.length > 0 ? ["shortcuts"] : []
144
+ ];
115
145
  const preset = options.preset ?? "agent-app";
116
146
  if (preset === false) {
117
- return uniqueFeatures(options.features ?? []);
147
+ return uniqueFeatures([...options.features ?? [], ...inferredFeatures]);
118
148
  }
119
149
  const presetFeatures = slackSetupFeaturePresets[preset];
120
150
  if (!presetFeatures) {
@@ -122,7 +152,8 @@ function resolveSetupFeatures(options) {
122
152
  }
123
153
  return uniqueFeatures([
124
154
  ...presetFeatures ?? [],
125
- ...options.features ?? []
155
+ ...options.features ?? [],
156
+ ...inferredFeatures
126
157
  ]);
127
158
  }
128
159
  function resolveEnvironment(context) {
@@ -226,6 +257,27 @@ function createSlackAppManifest(options) {
226
257
  ...options.suggestedPrompts ? { suggested_prompts: [...options.suggestedPrompts] } : {}
227
258
  };
228
259
  }
260
+ const slashCommands = normalizeSlashCommands(options.slashCommands ?? []);
261
+ if (requirements.settings.slashCommands) {
262
+ if (slashCommands.length === 0) {
263
+ throw new Error(
264
+ "Slack slash command definitions are required when the `slash-commands` feature is enabled."
265
+ );
266
+ }
267
+ features.slash_commands = slashCommands.map((command) => ({
268
+ ...command,
269
+ ...command.url || requirements.transport !== "http" ? {} : requirements.requestUrl ? { url: requirements.requestUrl } : {}
270
+ }));
271
+ }
272
+ const shortcuts = normalizeShortcuts(options.shortcuts ?? []);
273
+ if (requirements.settings.shortcuts) {
274
+ if (shortcuts.length === 0) {
275
+ throw new Error(
276
+ "Slack shortcut definitions are required when the `shortcuts` feature is enabled."
277
+ );
278
+ }
279
+ features.shortcuts = shortcuts;
280
+ }
229
281
  const settings = {
230
282
  socket_mode_enabled: requirements.settings.socketMode,
231
283
  token_rotation_enabled: options.tokenRotationEnabled ?? false
@@ -327,6 +379,8 @@ function compareSettings(manifest, requirements, findings) {
327
379
  const settings = readRecord(manifestRecord?.settings);
328
380
  const eventSubscriptions = readRecord(settings?.event_subscriptions);
329
381
  const interactivity = readRecord(settings?.interactivity);
382
+ const slashCommands = features?.slash_commands;
383
+ const shortcuts = features?.shortcuts;
330
384
  if (requirements.settings.assistantView && !readRecord(features?.assistant_view)) {
331
385
  findings.push({
332
386
  severity: "error",
@@ -357,6 +411,26 @@ function compareSettings(manifest, requirements, findings) {
357
411
  actual: readBoolean(interactivity?.is_enabled) ?? false
358
412
  });
359
413
  }
414
+ if (requirements.settings.slashCommands && !Array.isArray(slashCommands)) {
415
+ findings.push({
416
+ severity: "error",
417
+ code: "slash-commands-missing",
418
+ message: "Slack manifest must configure slash commands for selected features.",
419
+ path: "features.slash_commands",
420
+ expected: true,
421
+ actual: void 0
422
+ });
423
+ }
424
+ if (requirements.settings.shortcuts && !Array.isArray(shortcuts)) {
425
+ findings.push({
426
+ severity: "error",
427
+ code: "shortcuts-missing",
428
+ message: "Slack manifest must configure shortcuts for selected features.",
429
+ path: "features.shortcuts",
430
+ expected: true,
431
+ actual: void 0
432
+ });
433
+ }
360
434
  if (requirements.settings.socketMode && readBoolean(settings?.socket_mode_enabled) !== true) {
361
435
  findings.push({
362
436
  severity: "error",
@@ -387,6 +461,28 @@ function compareSettings(manifest, requirements, findings) {
387
461
  actual: readString(interactivity?.request_url)
388
462
  });
389
463
  }
464
+ if (requirements.requestUrl && requirements.transport === "http" && requirements.settings.slashCommands && Array.isArray(slashCommands)) {
465
+ const mismatched = slashCommands.map((command, index) => ({
466
+ index,
467
+ command: readRecord(command)
468
+ })).filter(
469
+ ({ command }) => readString(command?.url) !== requirements.requestUrl
470
+ );
471
+ if (mismatched.length > 0) {
472
+ findings.push({
473
+ severity: "error",
474
+ code: "slash-command-url-mismatch",
475
+ message: `Slack manifest slash command URL(s) must be ${requirements.requestUrl}.`,
476
+ path: "features.slash_commands",
477
+ expected: requirements.requestUrl,
478
+ actual: mismatched.map(({ index, command }) => ({
479
+ index,
480
+ command: readString(command?.command),
481
+ url: readString(command?.url)
482
+ }))
483
+ });
484
+ }
485
+ }
390
486
  }
391
487
  function trimString2(value) {
392
488
  const trimmed = value?.trim();
@@ -408,6 +504,44 @@ function uniqueSorted2(values) {
408
504
  }
409
505
  return [...unique.values()].sort((a, b) => a.localeCompare(b));
410
506
  }
507
+ function normalizeSlashCommands(values) {
508
+ return values.map((command) => {
509
+ const normalized = {
510
+ command: requireTrimmed(command.command, "slash command"),
511
+ description: requireTrimmed(
512
+ command.description,
513
+ `description for ${command.command}`
514
+ ),
515
+ ...trimString2(command.usage_hint) ? { usage_hint: trimString2(command.usage_hint) } : {},
516
+ ...trimString2(command.url) ? { url: trimString2(command.url) } : {},
517
+ ...command.should_escape !== void 0 ? { should_escape: command.should_escape } : {}
518
+ };
519
+ if (!normalized.command.startsWith("/")) {
520
+ throw new Error(
521
+ `Slack slash command must start with "/": ${normalized.command}`
522
+ );
523
+ }
524
+ return normalized;
525
+ });
526
+ }
527
+ function normalizeShortcuts(values) {
528
+ return values.map((shortcut) => ({
529
+ type: shortcut.type,
530
+ name: requireTrimmed(shortcut.name, "shortcut name"),
531
+ callback_id: requireTrimmed(shortcut.callback_id, "shortcut callback_id"),
532
+ description: requireTrimmed(
533
+ shortcut.description,
534
+ `description for ${shortcut.callback_id}`
535
+ )
536
+ }));
537
+ }
538
+ function requireTrimmed(value, label) {
539
+ const trimmed = value.trim();
540
+ if (!trimmed) {
541
+ throw new Error(`Slack ${label} must not be empty.`);
542
+ }
543
+ return trimmed;
544
+ }
411
545
  function readRecord(value) {
412
546
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
413
547
  }
@@ -0,0 +1,68 @@
1
+ import { Application } from 'express';
2
+ import { AppOptions, ExpressReceiverOptions, App, ExpressReceiver } from '@slack/bolt';
3
+ import { e as SlackDirectAuthOptions, d as SlackDirectAuthMode } from '../../types-B9NfCVrk.js';
4
+ import 'node:http';
5
+
6
+ /**
7
+ * `createSlackBoltApp` — builds a Bolt `App` + `ExpressReceiver` pair from
8
+ * the package's structured `CreateSlackBoltAppOptions`. Supports
9
+ * single-workspace, OAuth, and custom-authorize auth modes.
10
+ */
11
+
12
+ interface CreateSlackBoltAppOptions {
13
+ /**
14
+ * Slack signing secret used to verify inbound requests.
15
+ * Defaults to `SLACK_SIGNING_SECRET`.
16
+ */
17
+ signingSecret?: string;
18
+ /**
19
+ * Exact Slack Events API endpoint path.
20
+ * Defaults to `/slack/events`.
21
+ */
22
+ path?: string;
23
+ /**
24
+ * Direct-mode auth configuration.
25
+ *
26
+ * - omit for single-workspace token mode
27
+ * - use `{ mode: "oauth", ... }` for Bolt-managed installs
28
+ * - use `{ mode: "authorize", authorize }` for external token resolution
29
+ */
30
+ auth?: SlackDirectAuthOptions;
31
+ /**
32
+ * Convenience override for single-workspace mode.
33
+ * Defaults to `SLACK_BOT_TOKEN`.
34
+ */
35
+ botToken?: string;
36
+ /**
37
+ * Pre-existing Express app to mount onto.
38
+ */
39
+ app?: Application;
40
+ processBeforeResponse?: boolean;
41
+ signatureVerification?: boolean;
42
+ /**
43
+ * Additional Bolt `App` options passed through after this package sets
44
+ * receiver/auth. Use for logger/clientOptions and other native Bolt config.
45
+ */
46
+ boltAppOptions?: Partial<Omit<AppOptions, "receiver" | "token" | "authorize" | "botId" | "botUserId">>;
47
+ /**
48
+ * Additional Bolt `ExpressReceiver` options passed through after this
49
+ * package sets signing/auth/endpoints. Use for router, custom properties,
50
+ * and receiver-level error handlers.
51
+ */
52
+ receiverOptions?: Partial<Omit<ExpressReceiverOptions, "signingSecret" | "endpoints" | "processBeforeResponse" | "signatureVerification" | "app" | "clientId" | "clientSecret" | "stateSecret" | "installationStore" | "redirectUri" | "scopes" | "installerOptions">>;
53
+ }
54
+ interface CreateSlackBoltAppResult {
55
+ /** Bolt `App` used for event registration and outbound Slack calls. */
56
+ boltApp: App;
57
+ /** Bolt `ExpressReceiver` that owns request verification and OAuth routes. */
58
+ receiver: ExpressReceiver;
59
+ /** Express app that should receive `receiver.router`. */
60
+ app: Application;
61
+ /** Resolved direct auth mode. */
62
+ authMode: SlackDirectAuthMode;
63
+ /** Exact normalized events endpoint path. */
64
+ routePath: string;
65
+ }
66
+ declare function createSlackBoltApp(options?: CreateSlackBoltAppOptions): Promise<CreateSlackBoltAppResult>;
67
+
68
+ export { type CreateSlackBoltAppOptions, type CreateSlackBoltAppResult, createSlackBoltApp, createSlackBoltApp as createSlackHttpBoltApp };
@@ -0,0 +1,8 @@
1
+ import {
2
+ createSlackBoltApp
3
+ } from "../../chunk-QJYCHWN6.js";
4
+ import "../../chunk-S3SWPYXJ.js";
5
+ export {
6
+ createSlackBoltApp,
7
+ createSlackBoltApp as createSlackHttpBoltApp
8
+ };
@@ -0,0 +1,8 @@
1
+ export { CreateSlackBoltAppOptions, CreateSlackBoltAppResult, createSlackBoltApp, createSlackBoltApp as createSlackHttpBoltApp } from './http/index.js';
2
+ export { CreateSlackSocketBoltAppOptions, CreateSlackSocketBoltAppResult, SlackSocketModePostgresLock, SlackSocketModePostgresLockClient, SlackSocketModePostgresLockOptions, SlackSocketModePostgresLockPool, SlackSocketModeProcessLock, SlackSocketModeProcessLockOptions, acquireSlackSocketModePostgresLock, acquireSlackSocketModeProcessLock, createSlackSocketBoltApp } from './socket/index.js';
3
+ export { S as SlackSocketModeReceiverRuntimeOptions, a as SlackSocketModeRestartGuard, b as SlackSocketModeRuntime, c as SlackSocketModeRuntimeOptions, d as SlackSocketModeRuntimePolicy, e as createSlackSdkLogger, f as createSlackSocketModeRestartGuard, g as createSlackSocketModeRuntime, r as redactSlackSocketModeLogValue } from '../runtime-BNBHOZSQ.js';
4
+ export { LogLevel as SlackSdkLogLevel, Logger as SlackSdkLogger } from '@slack/bolt';
5
+ import 'express';
6
+ import '../types-B9NfCVrk.js';
7
+ import 'node:http';
8
+ import '../logging-Bl3HfcC8.js';