@desplega.ai/slack-mock 0.1.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.
@@ -0,0 +1,48 @@
1
+ // @bun
2
+ // src/screenshot.ts
3
+ import { existsSync } from "fs";
4
+ var CHROME_CANDIDATES = [
5
+ process.env.SLACK_MOCK_CHROME,
6
+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
7
+ "/Applications/Chromium.app/Contents/MacOS/Chromium",
8
+ "/usr/bin/google-chrome",
9
+ "/usr/bin/google-chrome-stable",
10
+ "/usr/bin/chromium",
11
+ "/usr/bin/chromium-browser"
12
+ ];
13
+ function findChrome() {
14
+ for (const c of CHROME_CANDIDATES)
15
+ if (c && existsSync(c))
16
+ return c;
17
+ const fromPath = Bun.which("google-chrome") ?? Bun.which("chromium") ?? Bun.which("chrome");
18
+ return fromPath ?? undefined;
19
+ }
20
+ async function screenshot(url, opts) {
21
+ const chrome = findChrome();
22
+ if (!chrome)
23
+ throw new Error("no Chrome/Chromium binary found; set SLACK_MOCK_CHROME=/path/to/chrome");
24
+ const target = new URL(url);
25
+ if (!target.searchParams.has("screenshot"))
26
+ target.searchParams.set("screenshot", "1");
27
+ const proc = Bun.spawn([
28
+ chrome,
29
+ "--headless=new",
30
+ "--disable-gpu",
31
+ "--hide-scrollbars",
32
+ "--no-first-run",
33
+ "--no-default-browser-check",
34
+ `--window-size=${opts.width ?? 800},${opts.height ?? 1000}`,
35
+ `--screenshot=${opts.out}`,
36
+ target.toString()
37
+ ], { stdout: "ignore", stderr: "pipe" });
38
+ const timer = setTimeout(() => proc.kill(), opts.timeoutMs ?? 30000);
39
+ const code = await proc.exited;
40
+ clearTimeout(timer);
41
+ if (code !== 0 || !existsSync(opts.out)) {
42
+ const err = await new Response(proc.stderr).text();
43
+ throw new Error(`chrome exited with ${code}: ${err.slice(-500)}`);
44
+ }
45
+ return opts.out;
46
+ }
47
+
48
+ export { findChrome, screenshot };
@@ -0,0 +1,7 @@
1
+ export { findChrome, screenshot } from "./screenshot.ts";
2
+ export type { Fault, MessageQuery, PostMessageInput, SlackManifest, SlackMockOptions, } from "./server.ts";
3
+ export { SlackApiError, SlackMock } from "./server.ts";
4
+ export type { AckResult, DeliveryRecord } from "./socket-mode.ts";
5
+ export type { AddChannelInput, AddUserInput } from "./store.ts";
6
+ export { Store } from "./store.ts";
7
+ export type * from "./types.ts";
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ // @bun
2
+ import {
3
+ SlackApiError,
4
+ SlackMock,
5
+ Store
6
+ } from "./index-thgwpw70.js";
7
+ import {
8
+ findChrome,
9
+ screenshot
10
+ } from "./index-v7mbr1cx.js";
11
+ export {
12
+ SlackApiError,
13
+ SlackMock,
14
+ Store,
15
+ findChrome,
16
+ screenshot
17
+ };
@@ -0,0 +1,7 @@
1
+ import { type RenderContext } from "./mrkdwn.ts";
2
+ /** mrkdwn / plain_text text object (or a bare string). */
3
+ export declare function textObject(v: unknown, ctx: RenderContext): string;
4
+ /** Section accessories and action elements. */
5
+ export declare function renderElement(v: unknown, ctx: RenderContext): string;
6
+ export declare function renderBlocks(blocks: unknown[], ctx: RenderContext): string;
7
+ export declare function renderAttachments(attachments: unknown[], ctx: RenderContext): string;
@@ -0,0 +1,25 @@
1
+ import type { Store } from "../store.ts";
2
+ export { escapeHtml } from "./mrkdwn.ts";
3
+ export type View = {
4
+ kind: "index";
5
+ } | {
6
+ kind: "channel";
7
+ channel: string;
8
+ } | {
9
+ kind: "thread";
10
+ channel: string;
11
+ ts: string;
12
+ };
13
+ export interface RenderOptions {
14
+ /** Screenshot mode: no navigation chrome, fixed width, no auto-refresh. */
15
+ screenshot?: boolean;
16
+ /** Number of live Socket Mode connections (shown on the index page). */
17
+ connections?: number;
18
+ /** Auto-refresh interval in seconds (omit for none). */
19
+ refreshSec?: number;
20
+ /** CSS width of the thread side panel. Default "50%", never below 360px. */
21
+ panelWidth?: string;
22
+ /** "panel" (default) shows the thread beside the channel, "full" shows it alone. */
23
+ threadView?: "panel" | "full";
24
+ }
25
+ export declare function renderPage(store: Store, view: View, opts?: RenderOptions): string;
@@ -0,0 +1,16 @@
1
+ import type { SlackChannel, SlackUser } from "../types.ts";
2
+ export interface RenderContext {
3
+ users: Map<string, SlackUser>;
4
+ channels: Map<string, SlackChannel>;
5
+ botUserId: string;
6
+ }
7
+ export declare function escapeHtml(s: string): string;
8
+ /** Unicode character for a Slack emoji shortcode, or undefined when unknown. */
9
+ export declare function emojiChar(name: string): string | undefined;
10
+ /** Codepoint list from a rich_text emoji element, e.g. "1f44b" or "1f1ea-1f1f8". */
11
+ export declare function emojiFromUnicode(code: string): string | undefined;
12
+ export declare function displayName(user: SlackUser): string;
13
+ /** Render Slack mrkdwn to HTML. */
14
+ export declare function mrkdwnToHtml(text: string, ctx: RenderContext): string;
15
+ /** plain_text objects: escaping and emoji only, no formatting. */
16
+ export declare function plainTextToHtml(text: string): string;
@@ -0,0 +1,13 @@
1
+ /** Locate a Chrome/Chromium binary for headless screenshots, or undefined. */
2
+ export declare function findChrome(): string | undefined;
3
+ export interface ScreenshotOptions {
4
+ out: string;
5
+ width?: number;
6
+ height?: number;
7
+ timeoutMs?: number;
8
+ }
9
+ /**
10
+ * Render a URL to a PNG with headless Chrome. Appends `screenshot=1` so the
11
+ * mock's pages drop their navigation chrome.
12
+ */
13
+ export declare function screenshot(url: string, opts: ScreenshotOptions): Promise<string>;
@@ -0,0 +1,9 @@
1
+ // @bun
2
+ import {
3
+ findChrome,
4
+ screenshot
5
+ } from "./index-v7mbr1cx.js";
6
+ export {
7
+ findChrome,
8
+ screenshot
9
+ };
@@ -0,0 +1,240 @@
1
+ import { type AckResult, type DeliveryRecord, SocketModeHub } from "./socket-mode.ts";
2
+ import { type AddChannelInput, type AddUserInput, SlackApiError, Store, type StoreOptions } from "./store.ts";
3
+ import type { ApiCall, Change, SlackChannel, SlackMessage, SlackUser } from "./types.ts";
4
+ export interface SlackManifest {
5
+ display_information?: {
6
+ name?: string;
7
+ };
8
+ features?: {
9
+ bot_user?: {
10
+ display_name?: string;
11
+ };
12
+ slash_commands?: Array<{
13
+ command: string;
14
+ description?: string;
15
+ }>;
16
+ };
17
+ settings?: {
18
+ event_subscriptions?: {
19
+ bot_events?: string[];
20
+ };
21
+ };
22
+ }
23
+ export interface SlackMockOptions extends StoreOptions {
24
+ /** 0 picks a free port. */
25
+ port?: number;
26
+ host?: string;
27
+ /** Path to a Slack app manifest JSON, or the parsed manifest. Sets app name, commands and event subscriptions. */
28
+ manifest?: string | SlackManifest;
29
+ /** Create a default workspace (#general, two humans). Default true. */
30
+ seed?: boolean;
31
+ /** Deliver the bot's own messages back as events, like Slack does. Default true. */
32
+ echoBotMessages?: boolean;
33
+ /** Event types (manifest style, e.g. "message.channels") to push to the app. */
34
+ subscribedEvents?: string[];
35
+ pingIntervalMs?: number;
36
+ ackTimeoutMs?: number;
37
+ maxRetries?: number;
38
+ /** How long a trigger_id stays valid for views.open (Slack: 3s). */
39
+ triggerIdTtlMs?: number;
40
+ /** Delay before each event is pushed (emulates Slack latency). */
41
+ eventDelayMs?: number;
42
+ /** Default width of the thread side panel in the HTML UI, e.g. "50%" or "640px". `?panel=` overrides per request. */
43
+ panelWidth?: string;
44
+ log?: boolean | ((msg: string) => void);
45
+ }
46
+ export interface PostMessageInput {
47
+ channel: string;
48
+ /** Sending user id; defaults to the first seeded human. */
49
+ user?: string;
50
+ text: string;
51
+ thread_ts?: string;
52
+ blocks?: unknown[];
53
+ files?: Array<{
54
+ name: string;
55
+ content: string | Uint8Array;
56
+ title?: string;
57
+ mimetype?: string;
58
+ }>;
59
+ reply_broadcast?: boolean;
60
+ }
61
+ export interface MessageQuery {
62
+ channel?: string;
63
+ thread_ts?: string;
64
+ /** "bot", "human", or a user id. */
65
+ from?: string;
66
+ text?: string | RegExp;
67
+ /** Match against message.metadata.event_type. */
68
+ event_type?: string;
69
+ /** Include ephemeral messages (default false). */
70
+ ephemeral?: boolean;
71
+ }
72
+ export interface Fault {
73
+ /** Web API method to fail, e.g. "chat.postMessage". */
74
+ method: string;
75
+ /** Slack error code to return, e.g. "ratelimited" or "missing_scope". */
76
+ error: string;
77
+ /** How many calls to fail (default 1). */
78
+ times?: number;
79
+ /** HTTP status (default 200, like Slack). Use 429 with retryAfterSec to test rate limiting. */
80
+ httpStatus?: number;
81
+ retryAfterSec?: number;
82
+ /** Extra body fields, e.g. { needed: "chat:write" }. */
83
+ extra?: Record<string, unknown>;
84
+ }
85
+ export declare class SlackMock {
86
+ readonly store: Store;
87
+ readonly hub: SocketModeHub;
88
+ readonly opts: SlackMockOptions;
89
+ private server;
90
+ private triggerIds;
91
+ private pendingUploads;
92
+ private responseUrls;
93
+ private inflight;
94
+ private subscribed;
95
+ private commands;
96
+ private faults;
97
+ private lastRequestAt;
98
+ private log;
99
+ /** Slack-facing errors with the same shape Slack returns. */
100
+ static Error: typeof SlackApiError;
101
+ constructor(opts?: SlackMockOptions);
102
+ static start(opts?: SlackMockOptions): Promise<SlackMock>;
103
+ private seed;
104
+ listen(): void;
105
+ get baseUrl(): string;
106
+ get apiUrl(): string;
107
+ get port(): number;
108
+ /** Environment variables a Bolt app needs to talk to this mock. */
109
+ get env(): Record<string, string>;
110
+ get bot(): {
111
+ userId: string;
112
+ botId: string;
113
+ token: string;
114
+ appToken: string;
115
+ userToken?: string;
116
+ };
117
+ get team(): {
118
+ id: string;
119
+ name: string;
120
+ domain: string;
121
+ };
122
+ stop(): Promise<void>;
123
+ private fetch;
124
+ private actorFor;
125
+ private handleApi;
126
+ private handleUpload;
127
+ private handleDownload;
128
+ private handleResponseUrl;
129
+ private postAsBot;
130
+ private handleUi;
131
+ private isSubscribed;
132
+ /** Manifest event name for a message in this channel: message.channels / groups / im / mpim. */
133
+ private messageEventName;
134
+ private track;
135
+ private push;
136
+ private botInChannel;
137
+ private dispatch;
138
+ /**
139
+ * Wait until every event pushed so far has been acked (or dropped) and the app
140
+ * has been quiet on the HTTP side for `settleMs` (so respond() calls that follow
141
+ * an ack have landed). Bounded by `maxMs`.
142
+ */
143
+ flush(settleMs?: number, maxMs?: number): Promise<void>;
144
+ addUser(input: AddUserInput): SlackUser;
145
+ addChannel(input: AddChannelInput & {
146
+ withBot?: boolean;
147
+ }): SlackChannel;
148
+ openDm(user: string): SlackChannel;
149
+ invite(channel: string, users: string[], inviter?: string): void;
150
+ user(idOrName: string): SlackUser;
151
+ channel(idOrName: string): SlackChannel;
152
+ private resolveChannel;
153
+ private defaultHuman;
154
+ /** Turn `@name` and `@here` / `@channel` in human-typed text into Slack mention syntax. */
155
+ resolveMentions(text: string): string;
156
+ /** A human posts a message; resolves once the app acked the resulting events. */
157
+ postMessage(input: PostMessageInput): Promise<SlackMessage>;
158
+ /** A human edits their message. */
159
+ editMessage(channel: string, ts: string, text: string): Promise<SlackMessage>;
160
+ deleteMessage(channel: string, ts: string): Promise<void>;
161
+ addReaction(input: {
162
+ channel: string;
163
+ ts: string;
164
+ name: string;
165
+ user?: string;
166
+ }): Promise<void>;
167
+ private issueResponseUrl;
168
+ private issueTriggerId;
169
+ /** A human runs a slash command. Resolves with the app's ack payload and any message it produced. */
170
+ slashCommand(input: {
171
+ command: string;
172
+ text?: string;
173
+ user?: string;
174
+ channel?: string;
175
+ }): Promise<{
176
+ ack: AckResult;
177
+ response?: SlackMessage;
178
+ }>;
179
+ /** A human clicks a button on a message. */
180
+ clickButton(input: {
181
+ channel: string;
182
+ ts: string;
183
+ action_id: string;
184
+ user?: string;
185
+ value?: string;
186
+ block_id?: string;
187
+ text?: string;
188
+ }): Promise<AckResult>;
189
+ /** A human submits the most recently opened modal (or the one with the given id / callback_id). */
190
+ submitView(input: {
191
+ values: Record<string, Record<string, unknown>>;
192
+ user?: string;
193
+ view_id?: string;
194
+ callback_id?: string;
195
+ }): Promise<AckResult>;
196
+ /** A human opens the app's assistant pane; returns the DM thread to talk in. */
197
+ startAssistantThread(input?: {
198
+ user?: string;
199
+ context?: Record<string, unknown>;
200
+ }): Promise<{
201
+ channel: string;
202
+ thread_ts: string;
203
+ }>;
204
+ changeAssistantContext(input: {
205
+ channel: string;
206
+ thread_ts: string;
207
+ context: Record<string, unknown>;
208
+ user?: string;
209
+ }): Promise<void>;
210
+ assistantThread(channel: string, thread_ts: string): {
211
+ status?: string;
212
+ title?: string;
213
+ prompts?: unknown[];
214
+ promptsTitle?: string;
215
+ };
216
+ messages(channel: string): SlackMessage[];
217
+ thread(channel: string, ts: string): SlackMessage[];
218
+ ephemeralMessages(channel?: string): SlackMessage[];
219
+ /** Make the next call(s) to a Web API method fail with a Slack error. */
220
+ injectFault(fault: Fault): void;
221
+ /** Every Socket Mode envelope pushed to the app, with ack status. */
222
+ deliveries(name?: string): DeliveryRecord[];
223
+ apiCalls(method?: string): ApiCall[];
224
+ private matches;
225
+ findMessages(q: MessageQuery): SlackMessage[];
226
+ /** Resolve with the first message (existing or future) that matches. */
227
+ waitForMessage(q: MessageQuery | ((m: SlackMessage) => boolean), opts?: {
228
+ timeoutMs?: number;
229
+ after?: string;
230
+ }): Promise<SlackMessage>;
231
+ waitForApiCall(method: string, opts?: {
232
+ timeoutMs?: number;
233
+ where?: (c: ApiCall) => boolean;
234
+ }): Promise<ApiCall>;
235
+ waitForConnection(timeoutMs?: number): Promise<void>;
236
+ disconnectSockets(reason?: Parameters<SocketModeHub["disconnectAll"]>[0]): void;
237
+ onChange(listener: (change: Change) => void): () => void;
238
+ private handleAdmin;
239
+ }
240
+ export { SlackApiError };
@@ -0,0 +1,73 @@
1
+ import type { ServerWebSocket } from "bun";
2
+ export interface ConnData {
3
+ id: string;
4
+ ticket: string;
5
+ pingTimer?: ReturnType<typeof setInterval>;
6
+ }
7
+ export type EnvelopeType = "events_api" | "interactive" | "slash_commands";
8
+ export interface Envelope {
9
+ envelope_id: string;
10
+ type: EnvelopeType;
11
+ accepts_response_payload: boolean;
12
+ retry_attempt: number;
13
+ retry_reason: string;
14
+ payload: unknown;
15
+ }
16
+ export interface AckResult {
17
+ envelope_id: string;
18
+ /** Body the app sent with its ack, e.g. a slash-command response. */
19
+ payload?: unknown;
20
+ attempts: number;
21
+ }
22
+ export interface SocketModeOptions {
23
+ appId: string;
24
+ /** Server ping frame interval. Slack pings often; the client expects one at least every 30s. */
25
+ pingIntervalMs?: number;
26
+ /** How long to wait for an ack before redelivering (Slack uses ~3s). */
27
+ ackTimeoutMs?: number;
28
+ /** Redeliveries after the first attempt (Slack retries a few times). */
29
+ maxRetries?: number;
30
+ log?: (msg: string) => void;
31
+ }
32
+ export declare class SocketModeClosedError extends Error {
33
+ }
34
+ export interface DeliveryRecord {
35
+ envelope_id: string;
36
+ type: EnvelopeType;
37
+ /** event.type, command name or interactive payload type. */
38
+ name: string;
39
+ sentAt: string;
40
+ attempts: number;
41
+ acked: boolean;
42
+ ackPayload?: unknown;
43
+ }
44
+ /**
45
+ * The Socket Mode side of the mock: tracks app connections, pushes envelopes,
46
+ * waits for acks, redelivers on timeout and keeps the link alive with pings.
47
+ */
48
+ export declare class SocketModeHub {
49
+ private connections;
50
+ private pending;
51
+ private connectionWaiters;
52
+ private rr;
53
+ readonly tickets: Set<string>;
54
+ /** Every envelope ever sent, in order, with its ack status. */
55
+ readonly history: DeliveryRecord[];
56
+ readonly opts: Required<Omit<SocketModeOptions, "log">> & {
57
+ log: (msg: string) => void;
58
+ };
59
+ constructor(opts: SocketModeOptions);
60
+ get connectionCount(): number;
61
+ issueTicket(): string;
62
+ open(ws: ServerWebSocket<ConnData>): void;
63
+ message(ws: ServerWebSocket<ConnData>, raw: string | Buffer): void;
64
+ close(ws: ServerWebSocket<ConnData>): void;
65
+ waitForConnection(timeoutMs?: number): Promise<void>;
66
+ /** Push an envelope to one connected app and resolve when it is acked. */
67
+ send(type: EnvelopeType, payload: unknown, acceptsResponsePayload?: boolean): Promise<AckResult>;
68
+ private attempt;
69
+ private pickConnection;
70
+ /** Emulate Slack asking apps to reconnect (or just drop them). */
71
+ disconnectAll(reason?: "warning" | "refresh_requested" | "too_many_websockets" | "link_disabled", graceMs?: number): void;
72
+ shutdown(): void;
73
+ }
@@ -0,0 +1,150 @@
1
+ import type { ApiCall, Change, SlackChannel, SlackFile, SlackMessage, SlackUser, SlackView } from "./types.ts";
2
+ export declare class SlackApiError extends Error {
3
+ code: string;
4
+ extra: Record<string, unknown>;
5
+ constructor(code: string, extra?: Record<string, unknown>);
6
+ }
7
+ export interface StoreOptions {
8
+ /** Append every change as one JSON line to this file and replay it on start. */
9
+ dataFile?: string;
10
+ teamId?: string;
11
+ teamName?: string;
12
+ teamDomain?: string;
13
+ appId?: string;
14
+ appName?: string;
15
+ botUserId?: string;
16
+ botId?: string;
17
+ botToken?: string;
18
+ appToken?: string;
19
+ userToken?: string;
20
+ }
21
+ export interface AddUserInput {
22
+ id?: string;
23
+ name: string;
24
+ real_name?: string;
25
+ email?: string;
26
+ is_admin?: boolean;
27
+ is_bot?: boolean;
28
+ tz?: string;
29
+ }
30
+ export interface AddChannelInput {
31
+ id?: string;
32
+ name: string;
33
+ is_private?: boolean;
34
+ members?: string[];
35
+ creator?: string;
36
+ topic?: string;
37
+ purpose?: string;
38
+ }
39
+ export interface HistoryQuery {
40
+ oldest?: string;
41
+ latest?: string;
42
+ inclusive?: boolean;
43
+ limit?: number;
44
+ cursor?: string;
45
+ }
46
+ export interface Page<T> {
47
+ items: T[];
48
+ has_more: boolean;
49
+ next_cursor: string;
50
+ }
51
+ /** In-memory Slack workspace with an optional append-only JSONL journal. */
52
+ export declare class Store {
53
+ readonly team: {
54
+ id: string;
55
+ name: string;
56
+ domain: string;
57
+ };
58
+ readonly app: {
59
+ id: string;
60
+ name: string;
61
+ };
62
+ readonly bot: {
63
+ userId: string;
64
+ botId: string;
65
+ token: string;
66
+ appToken: string;
67
+ userToken?: string;
68
+ };
69
+ readonly users: Map<string, SlackUser>;
70
+ readonly channels: Map<string, SlackChannel>;
71
+ readonly messages: Map<string, SlackMessage[]>;
72
+ readonly files: Map<string, SlackFile>;
73
+ readonly views: Map<string, SlackView>;
74
+ /** Ephemeral messages (chat.postEphemeral, command responses). Not part of history. */
75
+ readonly ephemerals: SlackMessage[];
76
+ readonly apiCalls: ApiCall[];
77
+ readonly assistantThreads: Map<string, {
78
+ status?: string;
79
+ title?: string;
80
+ prompts?: unknown[];
81
+ promptsTitle?: string;
82
+ }>;
83
+ private listeners;
84
+ private dataFile?;
85
+ private replaying;
86
+ constructor(opts?: StoreOptions);
87
+ onChange(listener: (change: Change) => void): () => void;
88
+ /** Emit a change that is not produced by a store mutation (e.g. assistant status). */
89
+ onChangeEmit(change: Change): void;
90
+ private emit;
91
+ private replay;
92
+ private applyReplayed;
93
+ addUser(input: AddUserInput): SlackUser;
94
+ user(id: string): SlackUser;
95
+ userByEmail(email: string): SlackUser | undefined;
96
+ isBotUser(userId: string | undefined): boolean;
97
+ addChannel(input: AddChannelInput): SlackChannel;
98
+ /** Direct message channel between the bot and a user (created on demand). */
99
+ openDm(userId: string): SlackChannel;
100
+ channel(id: string): SlackChannel;
101
+ channelByName(name: string): SlackChannel | undefined;
102
+ channelType(c: SlackChannel): "channel" | "group" | "im" | "mpim";
103
+ join(channelId: string, userId: string, inviter?: string): {
104
+ alreadyMember: boolean;
105
+ };
106
+ archive(channelId: string): void;
107
+ private insertMessage;
108
+ findMessage(channelId: string, ts: string): SlackMessage | undefined;
109
+ /** A message by ts, including ephemeral ones (used by response_url handling). */
110
+ findAnyMessage(channelId: string, ts: string): SlackMessage | undefined;
111
+ /** Replace the content of an ephemeral message in place (no event, like Slack). */
112
+ updateEphemeral(channelId: string, ts: string, patch: Partial<SlackMessage>): SlackMessage;
113
+ deleteEphemeral(channelId: string, ts: string): void;
114
+ message(channelId: string, ts: string): SlackMessage;
115
+ addMessage(input: Omit<SlackMessage, "type" | "team" | "ts"> & {
116
+ ts?: string;
117
+ }): SlackMessage;
118
+ updateMessage(channelId: string, ts: string, patch: Partial<SlackMessage>, editor: string): SlackMessage;
119
+ deleteMessage(channelId: string, ts: string): SlackMessage;
120
+ addReaction(channelId: string, ts: string, name: string, userId: string): SlackMessage;
121
+ removeReaction(channelId: string, ts: string, name: string, userId: string): SlackMessage;
122
+ /** Top-level messages of a channel (thread replies excluded, like conversations.history). */
123
+ history(channelId: string, q?: HistoryQuery): Page<SlackMessage>;
124
+ /** Parent plus replies, oldest first (like conversations.replies). */
125
+ replies(channelId: string, threadTs: string, q?: HistoryQuery): Page<SlackMessage>;
126
+ addFile(input: {
127
+ id?: string;
128
+ name: string;
129
+ title?: string;
130
+ mimetype?: string;
131
+ user: string;
132
+ bytes: Uint8Array;
133
+ baseUrl: string;
134
+ }): SlackFile;
135
+ file(id: string): SlackFile;
136
+ openView(view: Omit<SlackView, "id" | "hash" | "root_view_id" | "team_id" | "app_id" | "bot_id"> & {
137
+ id?: string;
138
+ }): SlackView;
139
+ recordApiCall(call: ApiCall): void;
140
+ assistantThread(channel: string, threadTs: string): {
141
+ status?: string;
142
+ title?: string;
143
+ prompts?: unknown[];
144
+ promptsTitle?: string;
145
+ };
146
+ }
147
+ /** Public (wire) form of a message: mock-only fields removed, file bytes dropped. */
148
+ export declare function wireMessage(m: SlackMessage): Record<string, unknown>;
149
+ export declare function wireFile(f: SlackFile): SlackFile;
150
+ export declare function ensureDir(file: string): void;