@cuylabs/channel-slack-agent-core 0.9.0 → 0.11.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 (52) hide show
  1. package/README.md +13 -10
  2. package/dist/chunk-U6RC4SXN.js +331 -0
  3. package/dist/history/index.d.ts +7 -17
  4. package/dist/index.d.ts +5 -28
  5. package/dist/index.js +14 -58
  6. package/dist/interactive/index.d.ts +86 -7
  7. package/dist/shared/index.d.ts +144 -19
  8. package/dist/shared/index.js +8 -4
  9. package/docs/README.md +0 -1
  10. package/docs/concepts/final-response-artifacts.md +9 -7
  11. package/docs/concepts/tool-task-rendering.md +2 -0
  12. package/docs/reference/exports.md +10 -20
  13. package/package.json +4 -54
  14. package/dist/adapter/index.d.ts +0 -26
  15. package/dist/adapter/index.js +0 -9
  16. package/dist/adapter-vbqtraAr.d.ts +0 -31
  17. package/dist/app-surface.d.ts +0 -82
  18. package/dist/app-surface.js +0 -10
  19. package/dist/app.d.ts +0 -60
  20. package/dist/app.js +0 -11
  21. package/dist/artifacts/index.d.ts +0 -57
  22. package/dist/artifacts/index.js +0 -6
  23. package/dist/assistant/index.d.ts +0 -22
  24. package/dist/assistant/index.js +0 -14
  25. package/dist/chunk-A2PLAVW6.js +0 -75
  26. package/dist/chunk-C7CHMYV6.js +0 -226
  27. package/dist/chunk-D4CSEAIF.js +0 -82
  28. package/dist/chunk-ELR6MQD7.js +0 -12
  29. package/dist/chunk-FJP6ZFUB.js +0 -921
  30. package/dist/chunk-GKZRDNEB.js +0 -187
  31. package/dist/chunk-HHXAXSG6.js +0 -67
  32. package/dist/chunk-JU5R6JZG.js +0 -85
  33. package/dist/chunk-KAEZPS3U.js +0 -77
  34. package/dist/chunk-NNCVHQC4.js +0 -94
  35. package/dist/chunk-VBGQD6JT.js +0 -1008
  36. package/dist/chunk-XA7U3GRN.js +0 -482
  37. package/dist/express-assistant.d.ts +0 -106
  38. package/dist/express-assistant.js +0 -9
  39. package/dist/express.d.ts +0 -103
  40. package/dist/express.js +0 -8
  41. package/dist/feedback/index.d.ts +0 -1
  42. package/dist/feedback/index.js +0 -10
  43. package/dist/options-ByNm2o89.d.ts +0 -323
  44. package/dist/options-CGUfVStV.d.ts +0 -119
  45. package/dist/socket.d.ts +0 -143
  46. package/dist/socket.js +0 -13
  47. package/dist/types-BeGPexio.d.ts +0 -381
  48. package/dist/types-Bz4OYEAV.d.ts +0 -87
  49. package/dist/types-CiwGU6zC.d.ts +0 -56
  50. package/dist/views/index.d.ts +0 -8
  51. package/dist/views/index.js +0 -10
  52. package/docs/concepts/view-workflows.md +0 -52
package/dist/express.js DELETED
@@ -1,8 +0,0 @@
1
- import {
2
- mountSlackAgent
3
- } from "./chunk-D4CSEAIF.js";
4
- import "./chunk-XA7U3GRN.js";
5
- import "./chunk-VBGQD6JT.js";
6
- export {
7
- mountSlackAgent
8
- };
@@ -1 +0,0 @@
1
- export { RegisterSlackFeedbackOptions, SLACK_FEEDBACK_ACTION_ID, SlackFeedbackBlockOptions, SlackFeedbackButtonConfig, SlackFeedbackContext, SlackFeedbackContextBlock, SlackFeedbackHandler, SlackFeedbackVerdict, createSlackFeedbackBlock, registerSlackFeedbackAction } from '@cuylabs/channel-slack/feedback';
@@ -1,10 +0,0 @@
1
- import {
2
- SLACK_FEEDBACK_ACTION_ID,
3
- createSlackFeedbackBlock,
4
- registerSlackFeedbackAction
5
- } from "../chunk-ELR6MQD7.js";
6
- export {
7
- SLACK_FEEDBACK_ACTION_ID,
8
- createSlackFeedbackBlock,
9
- registerSlackFeedbackAction
10
- };
@@ -1,323 +0,0 @@
1
- import { AgentTurnSource, AgentEvent, Logger } from '@cuylabs/agent-core';
2
- import { AssistantUserMessageMiddleware, AssistantThreadStartedMiddleware, Assistant, App } from '@slack/bolt';
3
- import { WebClient } from '@slack/web-api';
4
- import { SlackAuthContext, SlackAssistantThreadContext, SlackAssistantUtilities, SlackTurnPreparation, SlackAssistantTaskDisplayMode, SlackAssistantStatusUpdate, SlackAssistantSuggestedPrompts, SlackChatStreamStartArgs, SlackMessageFormattingOptions } from '@cuylabs/channel-slack/core';
5
- import { f as SlackInteractiveRequestHandler } from './interactive-BigrPKnu.js';
6
- import { S as SlackEventBridgeOptions } from './options-CGUfVStV.js';
7
- import { SlackFeedbackBlockOptions, SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
8
- import { ParsedAssistantUserMessage } from '@cuylabs/channel-slack/assistant';
9
-
10
- type SlackAssistantCancelControlVisibleWhen = "before-output" | "always-while-active";
11
- interface SlackAssistantCancelControlOptions {
12
- actionId?: string;
13
- buttonText?: string;
14
- messageText?: string;
15
- visibleWhen?: SlackAssistantCancelControlVisibleWhen;
16
- canceledAck?: string | false;
17
- alreadyCompletedAck?: string | false;
18
- unauthorizedAck?: string | false;
19
- onCancel?: (context: SlackAssistantTurnCancelContext) => MaybePromise<void>;
20
- }
21
- interface SlackAssistantTurnControlsOptions {
22
- cancel?: true | SlackAssistantCancelControlOptions;
23
- }
24
- interface SlackAssistantTurnCancelContext {
25
- controlId: string;
26
- sessionId: string;
27
- channelId: string;
28
- threadTs: string;
29
- userId: string;
30
- teamId?: string;
31
- }
32
-
33
- /**
34
- * Session strategies for the Bolt Assistant bridge.
35
- *
36
- * Slack assistant conversations are always threaded, including Assistant DMs,
37
- * so the default assistant mapping keys sessions by `channel:thread_ts`. This
38
- * intentionally differs from the shared channel adapter, where plain DMs use
39
- * only the DM channel id.
40
- */
41
-
42
- type SlackAssistantSessionStrategy = "thread-aware" | "channel-id" | "user-per-thread";
43
- declare function resolveAssistantSessionId(message: ParsedAssistantUserMessage, strategy: SlackAssistantSessionStrategy): string;
44
-
45
- /**
46
- * Public option types for the Slack Assistant bridge.
47
- *
48
- * Kept in a dedicated file so the lifecycle handlers, sink, and helpers can
49
- * reference them without dragging the entire factory in.
50
- */
51
-
52
- type MaybePromise<T> = T | Promise<T>;
53
- /**
54
- * Structural alias for Bolt's `AssistantThreadContextStore`. Bolt does not
55
- * re-export the type at the package root, so we redefine its `get` / `save`
56
- * surface here. `DefaultThreadContextStore` from `@slack/bolt` (the bridge's
57
- * default when no override is provided) implements the same shape.
58
- */
59
- interface SlackAssistantThreadContextStoreLike {
60
- get: (args: any) => Promise<unknown>;
61
- save: (args: any) => Promise<void>;
62
- }
63
- /**
64
- * Loose alias for the runtime shape of arguments handed to assistant
65
- * lifecycle middleware. Bolt does not re-export `AllAssistantMiddlewareArgs`
66
- * either, but every handler we register receives a compatible record.
67
- */
68
- type AssistantLifecycleArgs = Parameters<AssistantUserMessageMiddleware>[0];
69
- /** Args specifically for the `threadStarted` middleware. */
70
- type AssistantThreadStartedArgs = Parameters<AssistantThreadStartedMiddleware>[0];
71
- /**
72
- * Context handed to `getSuggestedPrompts` / `getInitialReply` /
73
- * `formatThreadTitle` when a Slack assistant thread starts.
74
- */
75
- interface SlackAssistantThreadStartedContext {
76
- /** The raw `assistant_thread_started` event payload. */
77
- event: AssistantThreadStartedArgs["payload"];
78
- context: AssistantThreadStartedArgs["context"];
79
- client: AssistantThreadStartedArgs["client"];
80
- logger: AssistantThreadStartedArgs["logger"];
81
- }
82
- /**
83
- * Context for per-message agent-side preparation. Returned values augment the
84
- * agent turn but never replace the bridge's lifecycle calls (status, stream,
85
- * feedback, etc.).
86
- *
87
- * `auth`, `threadContext`, and `assistant` are populated by the bridge before
88
- * `prepareTurn` / `resolveSession` run, so callers can read tokens and the
89
- * channel-of-origin metadata (or call `setStatus` etc. mid-prep) without
90
- * reaching into `rawArgs`.
91
- */
92
- interface SlackAssistantUserMessageContext {
93
- message: ParsedAssistantUserMessage;
94
- sessionId: string;
95
- /** Slack Web API client for direct Slack calls scoped to this turn. */
96
- client: WebClient;
97
- rawArgs: AssistantLifecycleArgs;
98
- /** Slack auth + identity for the inbound request. */
99
- auth: SlackAuthContext;
100
- /**
101
- * Bolt-resolved assistant thread context (channel of origin, etc.).
102
- *
103
- * Populated lazily on first read via `getThreadContext()`. The bridge
104
- * resolves it once per turn and caches it so handlers don't have to.
105
- */
106
- threadContext: SlackAssistantThreadContext;
107
- /**
108
- * Assistant pane utilities (`setStatus`, `setSuggestedPrompts`, `setTitle`,
109
- * `getThreadContext`, `saveThreadContext`).
110
- */
111
- assistant: SlackAssistantUtilities;
112
- }
113
- interface SlackAssistantTurnPreparation extends SlackTurnPreparation {
114
- }
115
- interface SlackAssistantStatusContext {
116
- event: AgentEvent;
117
- rawArgs: AssistantLifecycleArgs;
118
- }
119
- /**
120
- * Configuration for the feedback block attached to assistant replies.
121
- */
122
- interface SlackAssistantFeedbackConfig extends SlackFeedbackBlockOptions {
123
- /**
124
- * Called after the user clicks a feedback button. The bridge already calls
125
- * `ack()` and posts an ephemeral acknowledgement (configurable below).
126
- */
127
- onFeedback?: SlackFeedbackHandler;
128
- /** Ephemeral text shown after a positive click. Set to `false` to skip. */
129
- positiveAck?: string | false;
130
- /** Ephemeral text shown after a negative click. */
131
- negativeAck?: string | false;
132
- }
133
- interface CreateSlackAssistantBridgeOptions {
134
- /**
135
- * Source of agent turns. Any object satisfying `AgentTurnSource` works:
136
- * `Agent`, `InProcessAgentServer`, a runtime bridge, or a stub.
137
- */
138
- source: AgentTurnSource;
139
- /**
140
- * Custom Bolt thread context store. Defaults to Bolt's
141
- * `DefaultThreadContextStore` (metadata-on-message persistence).
142
- */
143
- threadContextStore?: SlackAssistantThreadContextStoreLike;
144
- /**
145
- * Session strategy for messages routed through the assistant.
146
- * The default `"thread-aware"` strategy maps Slack Assistant threads to
147
- * `${channelId}:${threadTs}`, including Assistant DM threads.
148
- *
149
- * @default "thread-aware"
150
- */
151
- sessionStrategy?: SlackAssistantSessionStrategy;
152
- /**
153
- * Optional explicit session resolver. Returning a falsy value falls back to
154
- * the configured strategy.
155
- */
156
- resolveSession?: (request: SlackAssistantUserMessageContext) => MaybePromise<string | undefined>;
157
- /**
158
- * Optional per-turn preparation hook.
159
- */
160
- prepareTurn?: (request: SlackAssistantUserMessageContext) => MaybePromise<SlackAssistantTurnPreparation | undefined>;
161
- /**
162
- * Display mode for `client.chatStream`.
163
- *
164
- * - `"timeline"` (default) — linear streaming, best for chat answers.
165
- * - `"plan"` — task list with `task_update` chunks. Pair with the agent
166
- * emitting tool-start/tool-result events for the task UI.
167
- */
168
- taskDisplayMode?: SlackAssistantTaskDisplayMode;
169
- /**
170
- * Initial assistant pane status set immediately when a user message arrives.
171
- *
172
- * @default { status: "Thinking..." }
173
- */
174
- initialStatus?: SlackAssistantStatusUpdate | ((request: SlackAssistantUserMessageContext) => MaybePromise<SlackAssistantStatusUpdate | undefined>);
175
- /**
176
- * Map an AgentEvent to an assistant pane status update. Returning
177
- * `undefined` keeps the previous status.
178
- */
179
- formatStatus?: (context: SlackAssistantStatusContext) => MaybePromise<SlackAssistantStatusUpdate | undefined>;
180
- /**
181
- * Suggested prompts shown when an assistant thread is opened.
182
- */
183
- getSuggestedPrompts?: (context: SlackAssistantThreadStartedContext) => MaybePromise<SlackAssistantSuggestedPrompts | undefined>;
184
- /**
185
- * Optional follow-up prompts surfaced after a successful turn completes.
186
- *
187
- * When provided and a non-empty result is returned, the bridge calls
188
- * `assistant.threads.setSuggestedPrompts(...)` after the streaming reply
189
- * has been finalized. Errors from this hook are logged and never break
190
- * the turn.
191
- */
192
- getFollowUpPrompts?: (context: SlackAssistantUserMessageContext & {
193
- finalText: string;
194
- }) => MaybePromise<SlackAssistantSuggestedPrompts | undefined>;
195
- /**
196
- * Greeting message posted when an assistant thread is opened.
197
- *
198
- * @default "Hi, how can I help?"
199
- */
200
- getInitialReply?: (context: SlackAssistantThreadStartedContext) => MaybePromise<string | false | undefined>;
201
- /**
202
- * Called once per assistant turn to set the thread title via
203
- * `assistant.threads.setTitle`. Return `undefined` to skip.
204
- */
205
- formatThreadTitle?: (request: SlackAssistantUserMessageContext) => MaybePromise<string | undefined>;
206
- /**
207
- * Feedback block configuration.
208
- *
209
- * - Object: builder + handler config (default).
210
- * - `false`: omit the feedback block entirely.
211
- */
212
- feedback?: SlackAssistantFeedbackConfig | false;
213
- /**
214
- * Optional active-turn controls rendered in Slack while an assistant turn is
215
- * running. The cancel control aborts the underlying `AgentTurnSource` via
216
- * the per-turn `AbortSignal`, so any runtime implementing that contract can
217
- * participate without Slack-specific code.
218
- */
219
- turnControls?: SlackAssistantTurnControlsOptions;
220
- /**
221
- * Bridge options forwarded to `bridgeAgentEventsToSlack`. Streaming mode is
222
- * pinned to `"chat-stream"` and cannot be overridden here.
223
- */
224
- showReasoning?: boolean;
225
- /** Render root-agent tool rows/status updates. Defaults to true. */
226
- showToolUsage?: boolean;
227
- /** Render subagent child tool rows. Defaults to false. */
228
- showSubagentToolUsage?: boolean;
229
- /** Include full subagent final output in the task row. Defaults to false. */
230
- showSubagentResultInTask?: boolean;
231
- formatToolTitle?: (toolName: string) => string;
232
- formatToolUpdate?: (toolName: string) => string;
233
- formatToolDetails?: SlackEventBridgeOptions["formatToolDetails"];
234
- formatToolResultOutput?: SlackEventBridgeOptions["formatToolResultOutput"];
235
- formatToolError?: (toolName: string, error: string) => string;
236
- formatReasoningUpdate?: () => string;
237
- chatStreamBufferSize?: number;
238
- maxTaskUpdates?: number;
239
- maxTaskUpdateTextChars?: number;
240
- maxTaskUpdateFieldChars?: number;
241
- /**
242
- * Start arguments merged into Slack's native chat stream.
243
- *
244
- * Use this for Slack-supported authorship fields such as `icon_emoji`,
245
- * `icon_url`, and `username`. The bridge still owns channel, thread,
246
- * recipient ids, task display mode, and buffer size.
247
- */
248
- chatStreamStartArgs?: SlackChatStreamStartArgs;
249
- /**
250
- * Final arguments merged into `chatStream.stop(...)`.
251
- *
252
- * Use this for static footer blocks such as content disclaimers. When
253
- * feedback is enabled, the feedback block is appended after any configured
254
- * blocks.
255
- */
256
- chatStreamFinalArgs?: SlackEventBridgeOptions["chatStreamFinalArgs"];
257
- /**
258
- * Optional publisher for rich artifacts derived from the final accumulated
259
- * answer, such as creating a Slack Canvas for long responses.
260
- */
261
- publishFinalResponseArtifact?: SlackEventBridgeOptions["publishFinalResponseArtifact"];
262
- /**
263
- * Controls whether final-response artifacts are supplemental or replace long
264
- * Slack text with a compact artifact pointer.
265
- *
266
- * @default "supplemental"
267
- */
268
- finalResponseArtifactMode?: SlackEventBridgeOptions["finalResponseArtifactMode"];
269
- /**
270
- * Raw-character threshold for replacement-mode streaming suppression.
271
- *
272
- * @default 4000
273
- */
274
- finalResponseArtifactStreamThreshold?: SlackEventBridgeOptions["finalResponseArtifactStreamThreshold"];
275
- /** Notice emitted when replacement mode moves the remaining response to an artifact. */
276
- formatFinalResponseArtifactContinuationNotice?: SlackEventBridgeOptions["formatFinalResponseArtifactContinuationNotice"];
277
- /** Compact final Slack message emitted after artifact publication succeeds. */
278
- formatFinalResponseArtifactMessage?: SlackEventBridgeOptions["formatFinalResponseArtifactMessage"];
279
- /** Diagnostics hook for final-response artifact publishing failures. */
280
- onFinalResponseArtifactError?: SlackEventBridgeOptions["onFinalResponseArtifactError"];
281
- formatChatMarkdown?: SlackMessageFormattingOptions;
282
- formatStreamError?: (error: Error) => string;
283
- /**
284
- * Slack-native renderer/resolver hook for approval and human-input
285
- * requests. Return `true` after rendering/recording the request to keep the
286
- * agent turn alive while an out-of-band Slack action resolves it.
287
- */
288
- handleInteractiveRequest?: SlackInteractiveRequestHandler;
289
- /**
290
- * Maximum time to let an assistant turn run before aborting the underlying
291
- * `AgentTurnSource`.
292
- *
293
- * Set to `0` to disable the timeout.
294
- *
295
- * @default 120000
296
- */
297
- timeoutMs?: number;
298
- /**
299
- * Optional logger for bridge diagnostics.
300
- */
301
- logger?: Logger;
302
- }
303
- interface SlackAssistantBridge {
304
- /** The Bolt `Assistant` middleware instance to pass to `app.assistant(...)`. */
305
- assistant: Assistant;
306
- /**
307
- * Wire the assistant + feedback action handler onto a Bolt `App` in one
308
- * call. Equivalent to `app.assistant(bridge.assistant)` plus the feedback
309
- * action registration when feedback is enabled.
310
- */
311
- install(app: App): void;
312
- /**
313
- * The resolved feedback action id, or `undefined` when feedback is disabled.
314
- */
315
- feedbackActionId?: string;
316
- /**
317
- * The resolved cancel action id, or `undefined` when turn cancel controls are
318
- * disabled.
319
- */
320
- turnCancelActionId?: string;
321
- }
322
-
323
- export { type AssistantLifecycleArgs as A, type CreateSlackAssistantBridgeOptions as C, type MaybePromise as M, type SlackAssistantBridge as S, type AssistantThreadStartedArgs as a, type SlackAssistantCancelControlOptions as b, type SlackAssistantCancelControlVisibleWhen as c, type SlackAssistantFeedbackConfig as d, type SlackAssistantSessionStrategy as e, type SlackAssistantStatusContext as f, type SlackAssistantThreadContextStoreLike as g, type SlackAssistantThreadStartedContext as h, type SlackAssistantTurnCancelContext as i, type SlackAssistantTurnControlsOptions as j, type SlackAssistantTurnPreparation as k, type SlackAssistantUserMessageContext as l, resolveAssistantSessionId as r };
@@ -1,119 +0,0 @@
1
- import { AgentEvent, ApprovalEvent } from '@cuylabs/agent-core';
2
- import { SlackFinalResponseArtifactPublisher, SlackFinalResponseArtifactDeliveryMode, SlackFinalResponseArtifactContext, SlackFinalResponseArtifactResult } from './artifacts/index.js';
3
- import { a as SlackEventInteractiveRequestHandler } from './interactive-BigrPKnu.js';
4
-
5
- /**
6
- * Event-bridge configuration. The bridge is mode-aware (progressive,
7
- * accumulate, chat-stream) and these options control formatting, status
8
- * propagation, interactive-request handling, and chat-stream finalization.
9
- */
10
-
11
- type HumanInputEvent = Extract<AgentEvent, {
12
- type: "human-input-request";
13
- }>["request"];
14
- type ToolStartEvent = Extract<AgentEvent, {
15
- type: "tool-start";
16
- }>;
17
- type ToolResultEvent = Extract<AgentEvent, {
18
- type: "tool-result";
19
- }>;
20
- interface SlackEventBridgeOptions {
21
- showReasoning: boolean;
22
- /** Render root-agent tool rows/status updates. */
23
- showToolUsage: boolean;
24
- /** Render subagent child tool rows in the parent Slack task timeline. */
25
- showSubagentToolUsage: boolean;
26
- /** Include full subagent completion output in the subagent task row. */
27
- showSubagentResultInTask: boolean;
28
- formatToolTitle?: (toolName: string) => string;
29
- formatToolUpdate: (toolName: string) => string;
30
- formatToolDetails?: (event: ToolStartEvent) => string | undefined;
31
- /**
32
- * Format the completed tool output shown in Slack task rows.
33
- *
34
- * Return `undefined` to use the default generic formatter. Return `null` to
35
- * intentionally omit task-row output for this tool result.
36
- */
37
- formatToolResultOutput?: (event: ToolResultEvent) => string | null | undefined;
38
- formatToolError: (toolName: string, error: string) => string;
39
- formatReasoningUpdate: () => string;
40
- formatMessageText: (text: string) => string;
41
- streamingMode: "progressive" | "accumulate" | "chat-stream";
42
- progressiveUpdateThreshold: number;
43
- progressiveUpdateIntervalMs: number;
44
- chatStreamBufferSize: number;
45
- /**
46
- * Maximum number of Slack task-update chunks the bridge will append to a
47
- * single chat stream. Task rows are a bounded UI projection, not a durable
48
- * event log.
49
- */
50
- maxTaskUpdates: number;
51
- /**
52
- * Maximum cumulative characters from task titles/details/output that the
53
- * bridge will append to one chat stream.
54
- */
55
- maxTaskUpdateTextChars: number;
56
- /**
57
- * Maximum characters for a single task details/output field.
58
- */
59
- maxTaskUpdateFieldChars: number;
60
- interactiveMode: "message-and-error" | "ignore";
61
- handleInteractiveRequest?: SlackEventInteractiveRequestHandler;
62
- formatApprovalRequired: (request: ApprovalEvent) => string;
63
- formatHumanInputRequired: (request: HumanInputEvent) => string;
64
- /**
65
- * Optional hook called whenever the bridge's status label changes — used by
66
- * the assistant bridge to update the assistant pane's status line via
67
- * `assistant.threads.setStatus`. Errors are swallowed by the caller.
68
- */
69
- onStatusChange?: (label: string, event: AgentEvent | undefined) => void | Promise<void>;
70
- /**
71
- * Optional final-args passthrough for `chatStream.stop(...)`. When the
72
- * bridge stops the chat stream on `complete`, these args (e.g. final
73
- * `blocks` for a feedback widget) are merged into the `stop` call. The
74
- * existing `markdown_text` final-text fallback always wins on text fields.
75
- */
76
- chatStreamFinalArgs?: {
77
- blocks?: unknown[];
78
- } & Record<string, unknown>;
79
- /**
80
- * Optional post-processing hook for publishing a rich artifact from the final
81
- * accumulated response, such as a Slack Canvas for long answers.
82
- */
83
- publishFinalResponseArtifact?: SlackFinalResponseArtifactPublisher;
84
- /**
85
- * Controls whether artifact publication is additive or becomes the primary
86
- * final-answer surface.
87
- *
88
- * - `supplemental`: finalize the Slack text normally, then publish artifact.
89
- * - `replace`: publish artifact first and use a compact Slack final message.
90
- *
91
- * @default "supplemental"
92
- */
93
- finalResponseArtifactMode?: SlackFinalResponseArtifactDeliveryMode;
94
- /**
95
- * When replacement mode is active, continue streaming text up to this many
96
- * raw characters, then suppress further text deltas and publish the full
97
- * answer as an artifact at completion. This preserves normal short-answer
98
- * streaming without flooding Slack for long answers.
99
- *
100
- * @default 4000
101
- */
102
- finalResponseArtifactStreamThreshold?: number;
103
- /**
104
- * Notice appended when replacement mode suppresses the remaining text stream.
105
- */
106
- formatFinalResponseArtifactContinuationNotice?: (context: Pick<SlackFinalResponseArtifactContext, "text" | "formattedText">) => string;
107
- /**
108
- * Final compact message used when an artifact replaces the full Slack text.
109
- */
110
- formatFinalResponseArtifactMessage?: (result: SlackFinalResponseArtifactResult, context: SlackFinalResponseArtifactContext) => string;
111
- /**
112
- * Called when `publishFinalResponseArtifact` throws. Errors from this hook
113
- * are swallowed so artifact publication cannot break a completed turn.
114
- */
115
- onFinalResponseArtifactError?: (error: unknown, context: SlackFinalResponseArtifactContext) => void | Promise<void>;
116
- }
117
- declare function resolveSlackEventBridgeOptions(partial: Partial<SlackEventBridgeOptions>): SlackEventBridgeOptions;
118
-
119
- export { type SlackEventBridgeOptions as S, resolveSlackEventBridgeOptions as r };
package/dist/socket.d.ts DELETED
@@ -1,143 +0,0 @@
1
- import { App } from '@slack/bolt';
2
- import { CreateSlackSocketBoltAppOptions } from '@cuylabs/channel-slack/transports/socket';
3
- import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
4
- import { S as SlackAssistantBridge, C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig } from './options-ByNm2o89.js';
5
- import { SlackAgentAppSurfaceOptions } from './app-surface.js';
6
- import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
7
- import '@cuylabs/agent-core';
8
- import '@slack/web-api';
9
- import '@cuylabs/channel-slack/core';
10
- import './interactive-BigrPKnu.js';
11
- import '@cuylabs/channel-slack/interactive';
12
- import './options-CGUfVStV.js';
13
- import './artifacts/index.js';
14
- import '@cuylabs/channel-slack/artifacts';
15
- import '@cuylabs/channel-slack/assistant';
16
- import './types-BeGPexio.js';
17
- import './types-Bz4OYEAV.js';
18
- import './types-CiwGU6zC.js';
19
- import '@cuylabs/channel-slack/views';
20
-
21
- /**
22
- * Socket Mode helpers for direct Slack.
23
- *
24
- * Slack's Socket Mode is the recommended local-development transport because
25
- * it does not need a public webhook URL. The starter agent in
26
- * `bolt-js-starter-agent` uses it for that reason. These helpers mirror the
27
- * HTTP/Express mounts for the Socket Mode case so application code stays
28
- * identical across transports.
29
- *
30
- * @example
31
- * ```ts
32
- * import { mountSlackAssistantAgentSocket } from "@cuylabs/channel-slack-agent-core";
33
- *
34
- * await mountSlackAssistantAgentSocket({
35
- * source: agent,
36
- * appToken: process.env.SLACK_APP_TOKEN, // xapp-...
37
- * botToken: process.env.SLACK_BOT_TOKEN, // xoxb-...
38
- * getSuggestedPrompts: () => ({
39
- * prompts: [
40
- * { title: "Roll dice", message: "Roll 2d20" },
41
- * { title: "Brainstorm", message: "Help me brainstorm a launch plan" },
42
- * ],
43
- * }),
44
- * });
45
- * ```
46
- */
47
-
48
- interface MountSlackAssistantAgentSocketOptions extends Omit<CreateSlackAssistantBridgeOptions, "feedback"> {
49
- /**
50
- * Slack app-level token (`xapp-...`) with `connections:write` scope.
51
- * @default process.env.SLACK_APP_TOKEN
52
- */
53
- appToken?: string;
54
- /**
55
- * Slack bot token (`xoxb-...`) for the bot user in single-workspace mode.
56
- * @default process.env.SLACK_BOT_TOKEN
57
- */
58
- botToken?: string;
59
- /**
60
- * Direct-mode auth config (single-workspace, OAuth, custom).
61
- *
62
- * Socket Mode still requires `appToken`; OAuth/custom authorize only change
63
- * how Bolt resolves workspace bot/user tokens once events arrive.
64
- */
65
- auth?: SlackDirectAuthOptions;
66
- /**
67
- * Additional Bolt `App` options. Socket/auth fields are controlled by this
68
- * helper and cannot be overridden. In OAuth Socket Mode, use `port` here to
69
- * control the small HTTP server Bolt starts for install/callback routes.
70
- */
71
- boltAppOptions?: CreateSlackSocketBoltAppOptions["boltAppOptions"];
72
- /**
73
- * Additional native Socket Mode receiver options. Use this for websocket
74
- * health tuning such as ping timeouts and reconnect behavior.
75
- */
76
- socketModeReceiverOptions?: CreateSlackSocketBoltAppOptions["socketModeReceiverOptions"];
77
- /**
78
- * Feedback config. Pass `false` to omit the feedback block. Pass an object
79
- * to override action ids, button labels, or the handler.
80
- */
81
- feedback?: SlackAssistantFeedbackConfig | false;
82
- /**
83
- * Convenience shorthand: `onFeedback: handler` is equivalent to
84
- * `feedback: { onFeedback: handler }`. Ignored if `feedback` is set.
85
- */
86
- onFeedback?: SlackFeedbackHandler;
87
- /**
88
- * Whether to call `app.start()` automatically. When `false`, callers own
89
- * the lifecycle and must call `result.boltApp.start()` themselves.
90
- * @default true
91
- */
92
- start?: boolean;
93
- }
94
- interface MountSlackAssistantAgentSocketResult {
95
- boltApp: App;
96
- bridge: SlackAssistantBridge;
97
- authMode: SlackDirectAuthMode;
98
- }
99
- interface MountSlackAgentAppSocketOptions extends SlackAgentAppSurfaceOptions {
100
- /**
101
- * Slack app-level token (`xapp-...`) with `connections:write` scope.
102
- * @default process.env.SLACK_APP_TOKEN
103
- */
104
- appToken?: string;
105
- /**
106
- * Slack bot token (`xoxb-...`) for the bot user in single-workspace mode.
107
- * @default process.env.SLACK_BOT_TOKEN
108
- */
109
- botToken?: string;
110
- /**
111
- * Direct-mode auth config (single-workspace, OAuth, custom).
112
- *
113
- * Socket Mode still requires `appToken`; OAuth/custom authorize only change
114
- * how Bolt resolves workspace bot/user tokens once events arrive.
115
- */
116
- auth?: SlackDirectAuthOptions;
117
- /**
118
- * Additional Bolt `App` options. Socket/auth fields are controlled by this
119
- * helper and cannot be overridden. In OAuth Socket Mode, use `port` here to
120
- * control the small HTTP server Bolt starts for install/callback routes.
121
- */
122
- boltAppOptions?: CreateSlackSocketBoltAppOptions["boltAppOptions"];
123
- /**
124
- * Additional native Socket Mode receiver options. Use this for websocket
125
- * health tuning such as ping timeouts and reconnect behavior.
126
- */
127
- socketModeReceiverOptions?: CreateSlackSocketBoltAppOptions["socketModeReceiverOptions"];
128
- /**
129
- * Whether to call `app.start()` automatically. When `false`, callers own
130
- * the lifecycle and must call `result.boltApp.start()` themselves.
131
- * @default true
132
- */
133
- start?: boolean;
134
- }
135
- interface MountSlackAgentAppSocketResult {
136
- boltApp: App;
137
- bridge: SlackAssistantBridge;
138
- authMode: SlackDirectAuthMode;
139
- }
140
- declare function mountSlackAssistantAgentSocket(options: MountSlackAssistantAgentSocketOptions): Promise<MountSlackAssistantAgentSocketResult>;
141
- declare function mountSlackAgentAppSocket(options: MountSlackAgentAppSocketOptions): Promise<MountSlackAgentAppSocketResult>;
142
-
143
- export { type MountSlackAgentAppSocketOptions, type MountSlackAgentAppSocketResult, type MountSlackAssistantAgentSocketOptions, type MountSlackAssistantAgentSocketResult, mountSlackAgentAppSocket, mountSlackAssistantAgentSocket };
package/dist/socket.js DELETED
@@ -1,13 +0,0 @@
1
- import {
2
- mountSlackAgentAppSocket,
3
- mountSlackAssistantAgentSocket
4
- } from "./chunk-HHXAXSG6.js";
5
- import "./chunk-GKZRDNEB.js";
6
- import "./chunk-FJP6ZFUB.js";
7
- import "./chunk-ELR6MQD7.js";
8
- import "./chunk-XA7U3GRN.js";
9
- import "./chunk-VBGQD6JT.js";
10
- export {
11
- mountSlackAgentAppSocket,
12
- mountSlackAssistantAgentSocket
13
- };