@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
@@ -0,0 +1,24 @@
1
+ import {
2
+ createSlackBoltApp
3
+ } from "../chunk-QJYCHWN6.js";
4
+ import {
5
+ acquireSlackSocketModePostgresLock,
6
+ acquireSlackSocketModeProcessLock,
7
+ createSlackSdkLogger,
8
+ createSlackSocketBoltApp,
9
+ createSlackSocketModeRestartGuard,
10
+ createSlackSocketModeRuntime,
11
+ redactSlackSocketModeLogValue
12
+ } from "../chunk-73QXT7MA.js";
13
+ import "../chunk-S3SWPYXJ.js";
14
+ export {
15
+ acquireSlackSocketModePostgresLock,
16
+ acquireSlackSocketModeProcessLock,
17
+ createSlackBoltApp,
18
+ createSlackBoltApp as createSlackHttpBoltApp,
19
+ createSlackSdkLogger,
20
+ createSlackSocketBoltApp,
21
+ createSlackSocketModeRestartGuard,
22
+ createSlackSocketModeRuntime,
23
+ redactSlackSocketModeLogValue
24
+ };
@@ -0,0 +1,94 @@
1
+ import { AppOptions, SocketModeReceiverOptions, App } from '@slack/bolt';
2
+ export { LogLevel as SlackSdkLogLevel, Logger as SlackSdkLogger } from '@slack/bolt';
3
+ import { e as SlackDirectAuthOptions, d as SlackDirectAuthMode } from '../../types-B9NfCVrk.js';
4
+ import { L as Logger } from '../../logging-Bl3HfcC8.js';
5
+ 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';
6
+ import 'node:http';
7
+
8
+ /**
9
+ * `createSlackSocketBoltApp` — builds a Socket Mode Bolt `App` from the
10
+ * package's structured auth options. Mirrors `createSlackBoltApp` without
11
+ * owning any assistant/app surface mounting.
12
+ */
13
+
14
+ type ControlledSocketBoltAppOption = "receiver" | "socketMode" | "appToken" | "token" | "authorize" | "botId" | "botUserId" | "clientId" | "clientSecret" | "stateSecret" | "redirectUri" | "installationStore" | "scopes" | "installerOptions";
15
+ type ControlledSocketModeReceiverOption = "appToken" | "clientId" | "clientSecret" | "stateSecret" | "redirectUri" | "installationStore" | "scopes" | "installerOptions" | "logger" | "logLevel";
16
+ interface CreateSlackSocketBoltAppOptions {
17
+ /**
18
+ * Slack app-level token (`xapp-...`) with `connections:write` scope.
19
+ * @default process.env.SLACK_APP_TOKEN
20
+ */
21
+ appToken?: string;
22
+ /**
23
+ * Convenience override for single-workspace mode.
24
+ * @default process.env.SLACK_BOT_TOKEN
25
+ */
26
+ botToken?: string;
27
+ /**
28
+ * Direct-mode auth configuration.
29
+ *
30
+ * - omit for single-workspace token mode
31
+ * - use `{ mode: "oauth", ... }` for Bolt-managed installs
32
+ * - use `{ mode: "authorize", authorize }` for external token resolution
33
+ */
34
+ auth?: SlackDirectAuthOptions;
35
+ /**
36
+ * Additional Bolt `App` options passed after this package sets Socket Mode
37
+ * and auth. Use for logger/clientOptions and non-auth native Bolt config.
38
+ */
39
+ boltAppOptions?: Partial<Omit<AppOptions, ControlledSocketBoltAppOption>>;
40
+ /**
41
+ * Additional native Socket Mode receiver options. Use this for websocket
42
+ * health tuning such as ping timeouts, reconnect behavior, and receiver
43
+ * error handling. Auth/OAuth fields stay controlled by this helper.
44
+ */
45
+ socketModeReceiverOptions?: Partial<Omit<SocketModeReceiverOptions, ControlledSocketModeReceiverOption>>;
46
+ }
47
+ interface CreateSlackSocketBoltAppResult {
48
+ boltApp: App;
49
+ authMode: SlackDirectAuthMode;
50
+ }
51
+ declare function createSlackSocketBoltApp(options?: CreateSlackSocketBoltAppOptions): Promise<CreateSlackSocketBoltAppResult>;
52
+
53
+ interface SlackSocketModeProcessLockOptions {
54
+ appSlug: string;
55
+ appToken?: string;
56
+ enabled?: boolean;
57
+ lockDir?: string;
58
+ logger?: Logger;
59
+ }
60
+ interface SlackSocketModeProcessLock {
61
+ path: string;
62
+ release(): void;
63
+ }
64
+ declare function acquireSlackSocketModeProcessLock({ appSlug, appToken, enabled, lockDir, logger, }: SlackSocketModeProcessLockOptions): SlackSocketModeProcessLock | undefined;
65
+
66
+ interface SlackSocketModePostgresLockClient {
67
+ query<T = unknown>(sql: string, values?: readonly unknown[]): Promise<{
68
+ rows: T[];
69
+ rowCount?: number | null;
70
+ }>;
71
+ release?: () => void;
72
+ }
73
+ interface SlackSocketModePostgresLockPool {
74
+ connect(): Promise<SlackSocketModePostgresLockClient>;
75
+ end?: () => Promise<void>;
76
+ }
77
+ interface SlackSocketModePostgresLockOptions {
78
+ appSlug: string;
79
+ appToken?: string;
80
+ client?: SlackSocketModePostgresLockClient;
81
+ connectionString?: string;
82
+ enabled?: boolean;
83
+ logger?: Logger;
84
+ namespace?: string;
85
+ pool?: SlackSocketModePostgresLockPool;
86
+ }
87
+ interface SlackSocketModePostgresLock {
88
+ path: string;
89
+ close(): Promise<void>;
90
+ release(): Promise<void>;
91
+ }
92
+ declare function acquireSlackSocketModePostgresLock({ appSlug, appToken, client, connectionString, enabled, logger, namespace, pool, }: SlackSocketModePostgresLockOptions): Promise<SlackSocketModePostgresLock | undefined>;
93
+
94
+ export { type CreateSlackSocketBoltAppOptions, type CreateSlackSocketBoltAppResult, type SlackSocketModePostgresLock, type SlackSocketModePostgresLockClient, type SlackSocketModePostgresLockOptions, type SlackSocketModePostgresLockPool, type SlackSocketModeProcessLock, type SlackSocketModeProcessLockOptions, acquireSlackSocketModePostgresLock, acquireSlackSocketModeProcessLock, createSlackSocketBoltApp };
@@ -0,0 +1,19 @@
1
+ import {
2
+ acquireSlackSocketModePostgresLock,
3
+ acquireSlackSocketModeProcessLock,
4
+ createSlackSdkLogger,
5
+ createSlackSocketBoltApp,
6
+ createSlackSocketModeRestartGuard,
7
+ createSlackSocketModeRuntime,
8
+ redactSlackSocketModeLogValue
9
+ } from "../../chunk-73QXT7MA.js";
10
+ import "../../chunk-S3SWPYXJ.js";
11
+ export {
12
+ acquireSlackSocketModePostgresLock,
13
+ acquireSlackSocketModeProcessLock,
14
+ createSlackSdkLogger,
15
+ createSlackSocketBoltApp,
16
+ createSlackSocketModeRestartGuard,
17
+ createSlackSocketModeRuntime,
18
+ redactSlackSocketModeLogValue
19
+ };
@@ -0,0 +1,141 @@
1
+ import { IncomingMessage, ServerResponse } from 'node:http';
2
+
3
+ /**
4
+ * OAuth and installation type declarations for the direct Slack adapter.
5
+ *
6
+ * Pure types — no runtime imports beyond `node:http` request/response.
7
+ * Mirrors the public surface of `@slack/oauth` enough that callers can
8
+ * implement custom installation/state stores without depending on Bolt's
9
+ * internal types.
10
+ */
11
+
12
+ type SlackDirectAuthMode = "single-workspace" | "oauth" | "authorize";
13
+ interface SlackOAuthError extends Error {
14
+ code: string;
15
+ }
16
+ interface SlackInstallURLOptions {
17
+ scopes?: string[];
18
+ userScopes?: string[];
19
+ redirectUri?: string;
20
+ metadata?: string;
21
+ teamId?: string;
22
+ }
23
+ interface SlackInstallationQuery {
24
+ teamId: string | undefined;
25
+ enterpriseId: string | undefined;
26
+ userId?: string;
27
+ conversationId?: string;
28
+ isEnterpriseInstall: boolean;
29
+ }
30
+ interface SlackInstallation {
31
+ team?: {
32
+ id: string;
33
+ name?: string;
34
+ } | undefined;
35
+ enterprise?: {
36
+ id: string;
37
+ name?: string;
38
+ } | undefined;
39
+ user: {
40
+ id: string;
41
+ token?: string;
42
+ refreshToken?: string;
43
+ expiresAt?: number;
44
+ scopes?: string[];
45
+ };
46
+ bot?: {
47
+ token: string;
48
+ refreshToken?: string;
49
+ expiresAt?: number;
50
+ scopes: string[];
51
+ id?: string;
52
+ userId?: string;
53
+ };
54
+ incomingWebhook?: {
55
+ url: string;
56
+ channel?: string;
57
+ channelId?: string;
58
+ configurationUrl?: string;
59
+ };
60
+ appId?: string;
61
+ tokenType?: "bot";
62
+ enterpriseUrl?: string;
63
+ isEnterpriseInstall?: boolean;
64
+ authVersion?: "v1" | "v2";
65
+ metadata?: string;
66
+ }
67
+ interface SlackInstallationStore {
68
+ storeInstallation(installation: SlackInstallation, logger?: unknown): Promise<void>;
69
+ fetchInstallation(query: SlackInstallationQuery, logger?: unknown): Promise<SlackInstallation>;
70
+ deleteInstallation?(query: SlackInstallationQuery, logger?: unknown): Promise<void>;
71
+ }
72
+ interface SlackStateStore {
73
+ generateStateParam(installOptions: SlackInstallURLOptions, now: Date): Promise<string>;
74
+ verifyStateParam(now: Date, state: string): Promise<SlackInstallURLOptions>;
75
+ }
76
+ interface SlackOAuthInstallPathOptions {
77
+ beforeRedirection?: (request: IncomingMessage, response: ServerResponse, options?: SlackInstallURLOptions) => Promise<boolean>;
78
+ }
79
+ interface SlackOAuthCallbackOptions {
80
+ beforeInstallation?: (options: SlackInstallURLOptions, request: IncomingMessage, response: ServerResponse) => Promise<boolean>;
81
+ afterInstallation?: (installation: SlackInstallation, options: SlackInstallURLOptions, request: IncomingMessage, response: ServerResponse) => Promise<boolean>;
82
+ success?: (installation: SlackInstallation, options: SlackInstallURLOptions, request: IncomingMessage, response: ServerResponse) => void;
83
+ successAsync?: (installation: SlackInstallation, options: SlackInstallURLOptions, request: IncomingMessage, response: ServerResponse) => Promise<void>;
84
+ failure?: (error: SlackOAuthError, options: SlackInstallURLOptions, request: IncomingMessage, response: ServerResponse) => void;
85
+ failureAsync?: (error: SlackOAuthError, options: SlackInstallURLOptions, request: IncomingMessage, response: ServerResponse) => Promise<void>;
86
+ }
87
+ interface SlackAuthorizeSource {
88
+ teamId: string | undefined;
89
+ enterpriseId: string | undefined;
90
+ userId?: string;
91
+ conversationId?: string;
92
+ isEnterpriseInstall: boolean;
93
+ }
94
+ interface SlackAuthorizeResult {
95
+ botToken?: string;
96
+ userToken?: string;
97
+ botId?: string;
98
+ botUserId?: string;
99
+ userId?: string;
100
+ teamId?: string;
101
+ enterpriseId?: string;
102
+ [key: string]: unknown;
103
+ }
104
+ type SlackAuthorizeFn = (source: SlackAuthorizeSource, body?: unknown) => Promise<SlackAuthorizeResult>;
105
+ interface SlackSingleWorkspaceAuthOptions {
106
+ mode?: "single-workspace";
107
+ botToken?: string;
108
+ botId?: string;
109
+ botUserId?: string;
110
+ }
111
+ interface SlackOAuthAuthOptions {
112
+ mode: "oauth";
113
+ clientId?: string;
114
+ clientSecret?: string;
115
+ stateSecret?: string;
116
+ installationStore: SlackInstallationStore;
117
+ stateStore?: SlackStateStore;
118
+ stateVerification?: boolean;
119
+ legacyStateVerification?: boolean;
120
+ stateCookieName?: string;
121
+ stateCookieExpirationSeconds?: number;
122
+ redirectUri?: string;
123
+ scopes?: string[];
124
+ userScopes?: string[];
125
+ metadata?: string;
126
+ installPath?: string;
127
+ callbackPath?: string;
128
+ renderHtmlForInstallPath?: (url: string) => string;
129
+ installPathOptions?: SlackOAuthInstallPathOptions;
130
+ callbackOptions?: SlackOAuthCallbackOptions;
131
+ directInstall?: boolean;
132
+ authVersion?: "v1" | "v2";
133
+ authorizationUrl?: string;
134
+ }
135
+ interface SlackCustomAuthorizeAuthOptions {
136
+ mode: "authorize";
137
+ authorize: SlackAuthorizeFn;
138
+ }
139
+ type SlackDirectAuthOptions = SlackSingleWorkspaceAuthOptions | SlackOAuthAuthOptions | SlackCustomAuthorizeAuthOptions;
140
+
141
+ export type { SlackAuthorizeFn as S, SlackAuthorizeResult as a, SlackAuthorizeSource as b, SlackCustomAuthorizeAuthOptions as c, SlackDirectAuthMode as d, SlackDirectAuthOptions as e, SlackInstallation as f, SlackInstallationQuery as g, SlackInstallationStore as h, SlackOAuthAuthOptions as i, SlackOAuthCallbackOptions as j, SlackOAuthError as k, SlackOAuthInstallPathOptions as l, SlackSingleWorkspaceAuthOptions as m, SlackStateStore as n };
@@ -0,0 +1,98 @@
1
+ import { App } from '@slack/bolt';
2
+ import { View, HomeView } from '@slack/types';
3
+
4
+ type SlackViewCallbackId = string | RegExp;
5
+ interface SlackViewApiResponse {
6
+ ok?: boolean;
7
+ view?: unknown;
8
+ [key: string]: unknown;
9
+ }
10
+ interface SlackViewsClient {
11
+ views?: {
12
+ open?: unknown;
13
+ push?: unknown;
14
+ update?: unknown;
15
+ publish?: unknown;
16
+ };
17
+ }
18
+ interface OpenSlackModalOptions {
19
+ client: SlackViewsClient;
20
+ triggerId: string;
21
+ view: View;
22
+ token?: string;
23
+ }
24
+ interface PushSlackModalOptions {
25
+ client: SlackViewsClient;
26
+ triggerId: string;
27
+ view: View;
28
+ token?: string;
29
+ }
30
+ interface UpdateSlackViewOptions {
31
+ client: SlackViewsClient;
32
+ view: View;
33
+ viewId?: string;
34
+ externalId?: string;
35
+ hash?: string;
36
+ token?: string;
37
+ }
38
+ interface PublishSlackHomeViewOptions {
39
+ client: SlackViewsClient;
40
+ userId: string;
41
+ view: HomeView;
42
+ hash?: string;
43
+ token?: string;
44
+ }
45
+ interface SlackViewPayload {
46
+ id?: string;
47
+ callback_id?: string;
48
+ private_metadata?: string;
49
+ state?: unknown;
50
+ hash?: string;
51
+ [key: string]: unknown;
52
+ }
53
+ interface SlackViewActor {
54
+ userId?: string;
55
+ teamId?: string;
56
+ enterpriseId?: string;
57
+ }
58
+ interface SlackViewSubmissionAckResponse {
59
+ response_action: "clear" | "errors" | "push" | "update";
60
+ errors?: Record<string, string>;
61
+ view?: View;
62
+ }
63
+ interface SlackViewWorkflowContext<TMetadata = unknown> {
64
+ body: unknown;
65
+ client: SlackViewsClient;
66
+ view: SlackViewPayload;
67
+ callbackId?: string;
68
+ triggerId?: string;
69
+ actor: SlackViewActor;
70
+ metadata: TMetadata | undefined;
71
+ }
72
+ interface RegisterSlackViewWorkflowOptions<TMetadata = unknown> {
73
+ boltApp: App;
74
+ callbackId: SlackViewCallbackId;
75
+ decodePrivateMetadata?: (privateMetadata: string | undefined, context: Omit<SlackViewWorkflowContext<TMetadata>, "metadata">) => TMetadata | undefined;
76
+ onSubmission?: (context: SlackViewWorkflowContext<TMetadata>) => SlackViewSubmissionAckResponse | void | Promise<SlackViewSubmissionAckResponse | void>;
77
+ onClose?: (context: SlackViewWorkflowContext<TMetadata>) => void | Promise<void>;
78
+ onError?: (error: unknown, context: Omit<SlackViewWorkflowContext<TMetadata>, "metadata"> & {
79
+ metadata?: TMetadata | undefined;
80
+ }) => void | Promise<void>;
81
+ }
82
+ interface SlackViewWorkflowRegistration {
83
+ callbackId: SlackViewCallbackId;
84
+ }
85
+
86
+ declare function openSlackModal({ client, triggerId, view, token, }: OpenSlackModalOptions): Promise<SlackViewApiResponse>;
87
+ declare function pushSlackModal({ client, triggerId, view, token, }: PushSlackModalOptions): Promise<SlackViewApiResponse>;
88
+ declare function updateSlackView({ client, view, viewId, externalId, hash, token, }: UpdateSlackViewOptions): Promise<SlackViewApiResponse>;
89
+ declare function publishSlackHomeView({ client, userId, view, hash, token, }: PublishSlackHomeViewOptions): Promise<SlackViewApiResponse>;
90
+
91
+ declare const SLACK_VIEW_PRIVATE_METADATA_MAX_CHARS = 3000;
92
+ declare function encodeSlackViewPrivateMetadata(value: unknown): string;
93
+ declare function decodeSlackViewPrivateMetadata<T = unknown>(privateMetadata: string | undefined): T | undefined;
94
+ declare function readSlackViewPrivateMetadata<T = unknown>(view: Pick<SlackViewPayload, "private_metadata">): T | undefined;
95
+
96
+ declare function registerSlackViewWorkflow<TMetadata = unknown>({ boltApp, callbackId, decodePrivateMetadata, onSubmission, onClose, onError, }: RegisterSlackViewWorkflowOptions<TMetadata>): SlackViewWorkflowRegistration;
97
+
98
+ export { type OpenSlackModalOptions, type PublishSlackHomeViewOptions, type PushSlackModalOptions, type RegisterSlackViewWorkflowOptions, SLACK_VIEW_PRIVATE_METADATA_MAX_CHARS, type SlackViewActor, type SlackViewApiResponse, type SlackViewCallbackId, type SlackViewPayload, type SlackViewSubmissionAckResponse, type SlackViewWorkflowContext, type SlackViewWorkflowRegistration, type SlackViewsClient, type UpdateSlackViewOptions, decodeSlackViewPrivateMetadata, encodeSlackViewPrivateMetadata, openSlackModal, publishSlackHomeView, pushSlackModal, readSlackViewPrivateMetadata, registerSlackViewWorkflow, updateSlackView };
@@ -0,0 +1,22 @@
1
+ import {
2
+ SLACK_VIEW_PRIVATE_METADATA_MAX_CHARS,
3
+ decodeSlackViewPrivateMetadata,
4
+ encodeSlackViewPrivateMetadata,
5
+ openSlackModal,
6
+ publishSlackHomeView,
7
+ pushSlackModal,
8
+ readSlackViewPrivateMetadata,
9
+ registerSlackViewWorkflow,
10
+ updateSlackView
11
+ } from "../chunk-IRFKUPJN.js";
12
+ export {
13
+ SLACK_VIEW_PRIVATE_METADATA_MAX_CHARS,
14
+ decodeSlackViewPrivateMetadata,
15
+ encodeSlackViewPrivateMetadata,
16
+ openSlackModal,
17
+ publishSlackHomeView,
18
+ pushSlackModal,
19
+ readSlackViewPrivateMetadata,
20
+ registerSlackViewWorkflow,
21
+ updateSlackView
22
+ };
package/docs/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Channel Slack Docs
2
+
3
+ `@cuylabs/channel-slack` is the reusable Slack mechanics package. Start with
4
+ the package boundary, then use the reference and recipes for the feature surface
5
+ your adapter or application needs.
6
+
7
+ ## Reference
8
+
9
+ - [Package boundary](reference/channel-slack-boundary.md)
10
+ - [Exports and peer expectations](reference/exports.md)
11
+ - [Source layout](reference/source-layout.md)
12
+
13
+ ## Concepts
14
+
15
+ - [Activity parsing](concepts/activity.md)
16
+ - [Artifacts](concepts/artifacts.md)
17
+ - [Entrypoints](concepts/entrypoints.md)
18
+ - [Message policy](concepts/message-policy.md)
19
+ - [Setup requirements](concepts/setup-requirements.md)
20
+ - [Supplemental history](concepts/supplemental-history.md)
21
+ - [Transport runtime](concepts/transport-runtime.md)
22
+ - [Views](concepts/views.md)
23
+
24
+ ## Recipes
25
+
26
+ - [App mention handler](recipes/app-mention-handler.md)
27
+ - [Assistant thread handler](recipes/assistant-thread-handler.md)
28
+ - [Socket Mode app](recipes/socket-mode-app.md)
29
+ - [Slash command and shortcut handler](recipes/slash-command-and-shortcut.md)
30
+ - [Publish an artifact](recipes/publish-artifact.md)
31
+ - [Generate a Slack manifest](recipes/generate-slack-manifest.md)
32
+ - [History visibility filter](recipes/history-visibility.md)
@@ -1,8 +1,8 @@
1
1
  # Activity
2
2
 
3
- An activity is the normalized message shape an agent adapter receives from
4
- Slack. It is intentionally smaller than a raw Slack event and does not depend on
5
- Bolt.
3
+ An activity is the normalized Slack message shape an adapter or application can
4
+ map into its own runtime. It is intentionally smaller than a raw Slack event and
5
+ does not depend on Bolt.
6
6
 
7
7
  ```typescript
8
8
  import { parseSlackMentionActivity } from "@cuylabs/channel-slack/core";
@@ -0,0 +1,56 @@
1
+ # Artifacts
2
+
3
+ Artifacts publish generated outputs to Slack without depending on any agent
4
+ runtime. The package accepts a structural Slack Web API client, so callers can
5
+ pass a real `WebClient`, a scoped client from a request handler, or a test
6
+ double with the methods they use.
7
+
8
+ ```typescript
9
+ import { publishSlackArtifact } from "@cuylabs/channel-slack/artifacts";
10
+
11
+ const publication = await publishSlackArtifact({
12
+ client,
13
+ channelId: activity.channelId,
14
+ threadTs: activity.threadTs ?? activity.messageTs,
15
+ artifact: {
16
+ kind: "text",
17
+ title: "Investigation summary",
18
+ summary: "Key findings from the thread.",
19
+ text: reportMarkdown,
20
+ },
21
+ });
22
+ ```
23
+
24
+ ## Artifact Kinds
25
+
26
+ - `text`: uploads text as a Slack file by default. Set `publishAs: "message"`
27
+ to post it as a Block Kit message instead.
28
+ - `file`: uploads binary or text data from `data` or `filePath`.
29
+ - `image`: uploads an image file and requires `altText`.
30
+ - `link`: posts a Block Kit message with a Slack-formatted link.
31
+ - `canvas`: creates or updates a Slack Canvas from Markdown.
32
+
33
+ ## Results
34
+
35
+ `publishSlackArtifact` returns a `SlackArtifactPublication` with:
36
+
37
+ - `method`: `message`, `file`, or `canvas`.
38
+ - the original `artifact`.
39
+ - the raw Slack API `response`.
40
+ - target metadata such as `channelId`, `threadTs`, `messageTs`, `fileId`, or
41
+ `canvasId` when Slack returns it.
42
+
43
+ ## Slack Client Surface
44
+
45
+ Only the method required by the selected artifact kind must exist:
46
+
47
+ - message/link artifacts use `client.chat.postMessage`.
48
+ - text/file/image file uploads use `client.files.uploadV2`.
49
+ - Canvas creation uses `client.conversations.canvases.create` for channel
50
+ canvases when available, or `client.canvases.create` otherwise.
51
+ - Canvas updates use `client.canvases.edit`.
52
+
53
+ ## Setup
54
+
55
+ The `artifacts` setup feature adds `chat:write` and `files:write`.
56
+ The `canvas-artifacts` setup feature adds `canvases:write`.
@@ -0,0 +1,73 @@
1
+ # Entrypoints
2
+
3
+ Entrypoints normalize Slack slash command and shortcut payloads into small
4
+ package contracts. They do not start a turn or choose a runtime request shape.
5
+
6
+ ```typescript
7
+ import { parseSlackSlashCommandEntrypoint } from "@cuylabs/channel-slack/entrypoints";
8
+
9
+ const entrypoint = parseSlackSlashCommandEntrypoint(payload);
10
+ ```
11
+
12
+ ## Slash Commands
13
+
14
+ `parseSlackSlashCommandEntrypoint` returns:
15
+
16
+ - `kind: "slash-command"`.
17
+ - `command`: the invoked slash command, such as `/ask`.
18
+ - `activity`: a `SlackActivityInfo` shape with channel, user, team, and text.
19
+ - optional Slack request metadata such as `triggerId`, `responseUrl`,
20
+ `channelName`, `teamDomain`, `appId`, and enterprise fields.
21
+
22
+ The parser treats the command text as the model-facing text. A host adapter can
23
+ map `entrypoint.activity.text` into its own runtime input while preserving the
24
+ Slack metadata for routing, logging, or response targets.
25
+
26
+ ## Shortcuts
27
+
28
+ Use `parseSlackShortcutEntrypoint` when one handler receives both global and
29
+ message shortcuts:
30
+
31
+ ```typescript
32
+ import { parseSlackShortcutEntrypoint } from "@cuylabs/channel-slack/entrypoints";
33
+
34
+ const entrypoint = parseSlackShortcutEntrypoint(payload);
35
+ ```
36
+
37
+ Global shortcuts return `kind: "global-shortcut"` and include trigger/user/team
38
+ metadata, but no selected message.
39
+
40
+ Message shortcuts return `kind: "message-shortcut"`, include the selected
41
+ message text, and also expose `activity` so a runtime adapter can treat the
42
+ selection as a Slack turn candidate.
43
+
44
+ ## Setup
45
+
46
+ Passing `slashCommands` or `shortcuts` to setup helpers automatically enables
47
+ the matching feature, the `commands` scope, and Slack interactivity settings.
48
+
49
+ ```typescript
50
+ import { createSlackAppManifest } from "@cuylabs/channel-slack/setup";
51
+
52
+ const manifest = createSlackAppManifest({
53
+ name: "My Agent",
54
+ preset: false,
55
+ transport: "http",
56
+ baseUrl: "https://agent.example.com",
57
+ slashCommands: [
58
+ {
59
+ command: "/ask",
60
+ description: "Ask the agent",
61
+ usage_hint: "summarize this thread",
62
+ },
63
+ ],
64
+ shortcuts: [
65
+ {
66
+ type: "message",
67
+ name: "Summarize message",
68
+ callback_id: "summarize_message",
69
+ description: "Summarize the selected Slack message",
70
+ },
71
+ ],
72
+ });
73
+ ```
@@ -19,6 +19,10 @@ const requirements = getSlackSetupRequirements({
19
19
  - `agent-app`: Assistant, app mentions, direct messages, and feedback.
20
20
 
21
21
  Pass `preset: false` and provide `features` when an app needs exact control.
22
+ Supplying `slashCommands` or `shortcuts` automatically enables the matching
23
+ feature and adds the Slack `commands` scope plus interactivity settings.
24
+ The `artifacts` feature adds `chat:write` and `files:write`; the
25
+ `canvas-artifacts` feature adds `canvases:write`.
22
26
 
23
27
  ## Features
24
28
 
@@ -32,12 +36,31 @@ Feature selections produce:
32
36
  Socket Mode.
33
37
  - environment variables needed by the chosen transport.
34
38
 
39
+ Common feature selections:
40
+
41
+ - `assistant`: Assistant view events, `assistant:write`, and `chat:write`.
42
+ - `app-mentions`: app mention event subscription and reply permission.
43
+ - `direct-messages`: DM message events and DM history/read scopes.
44
+ - `channel-messages`: passive channel/group message events and history scopes.
45
+ - `slash-commands`: `commands` scope and interactivity.
46
+ - `shortcuts`: `commands` scope and interactivity.
47
+ - `artifacts`: `chat:write` and `files:write`.
48
+ - `canvas-artifacts`: `canvases:write`.
49
+ - `history`: channel, group, DM, and MPIM history scopes.
50
+ - `feedback` and `interactivity`: `chat:write` plus interactivity.
51
+ - `user-profiles` and `user-emails`: Slack user profile scopes.
52
+ - `workspace-search`: Slack search scopes.
53
+
35
54
  ## Manifests
36
55
 
37
56
  `createSlackAppManifest` produces a Slack app manifest from the same
38
57
  requirements. `compareSlackAppManifest` checks an existing manifest-like object
39
58
  against requirements and returns path-level findings.
40
59
 
60
+ Pass `slashCommands` and `shortcuts` to include those manifest sections. For
61
+ HTTP transport, command and interactivity URLs are filled from `baseUrl` and
62
+ `eventsPath` unless a command defines its own `url`.
63
+
41
64
  ## Inspection
42
65
 
43
66
  `inspectSlackAppSetup` combines requirements with a live token inspection. It
@@ -1,7 +1,12 @@
1
- # Bolt Runtime
1
+ # Transport Runtime
2
2
 
3
- The Bolt helpers create Slack transports and auth wiring. They deliberately do
4
- not register handlers, own prompts, run agents, or choose deployment policy.
3
+ The transport helpers create Slack apps with Bolt auth wiring. They deliberately
4
+ do not register handlers, own prompts, run agents, or choose deployment policy.
5
+
6
+ Use transport-specific imports:
7
+
8
+ - `@cuylabs/channel-slack/transports/http`
9
+ - `@cuylabs/channel-slack/transports/socket`
5
10
 
6
11
  ## HTTP
7
12
 
@@ -41,7 +46,7 @@ Postgres advisory lock before starting the Socket Mode app:
41
46
  import {
42
47
  acquireSlackSocketModePostgresLock,
43
48
  createSlackSocketModeRuntime,
44
- } from "@cuylabs/channel-slack/bolt";
49
+ } from "@cuylabs/channel-slack/transports/socket";
45
50
 
46
51
  const postgresLock = await acquireSlackSocketModePostgresLock({
47
52
  appSlug: "my-agent",