@cuylabs/channel-slack-agent-core 0.10.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.
- package/README.md +13 -10
- package/dist/{chunk-L5RAGYVJ.js → chunk-U6RC4SXN.js} +87 -1
- package/dist/history/index.d.ts +7 -17
- package/dist/index.d.ts +4 -28
- package/dist/index.js +12 -60
- package/dist/interactive/index.d.ts +86 -7
- package/dist/shared/index.d.ts +121 -8
- package/dist/shared/index.js +4 -4
- package/docs/README.md +0 -1
- package/docs/concepts/final-response-artifacts.md +9 -7
- package/docs/concepts/tool-task-rendering.md +2 -0
- package/docs/reference/exports.md +10 -20
- package/package.json +4 -54
- package/dist/adapter/index.d.ts +0 -26
- package/dist/adapter/index.js +0 -9
- package/dist/adapter-vbqtraAr.d.ts +0 -31
- package/dist/app-surface.d.ts +0 -82
- package/dist/app-surface.js +0 -10
- package/dist/app.d.ts +0 -60
- package/dist/app.js +0 -11
- package/dist/artifacts/index.d.ts +0 -57
- package/dist/artifacts/index.js +0 -6
- package/dist/assistant/index.d.ts +0 -22
- package/dist/assistant/index.js +0 -14
- package/dist/chunk-6EMFBOXD.js +0 -67
- package/dist/chunk-A2PLAVW6.js +0 -75
- package/dist/chunk-C7CHMYV6.js +0 -226
- package/dist/chunk-DS6E5OEJ.js +0 -85
- package/dist/chunk-ELR6MQD7.js +0 -12
- package/dist/chunk-GEFK72VO.js +0 -921
- package/dist/chunk-KQPUQJ57.js +0 -482
- package/dist/chunk-NNCVHQC4.js +0 -94
- package/dist/chunk-P2DIC42J.js +0 -77
- package/dist/chunk-Q2GU4QLZ.js +0 -187
- package/dist/chunk-QFDXKCAQ.js +0 -82
- package/dist/express-assistant.d.ts +0 -106
- package/dist/express-assistant.js +0 -9
- package/dist/express.d.ts +0 -103
- package/dist/express.js +0 -8
- package/dist/feedback/index.d.ts +0 -1
- package/dist/feedback/index.js +0 -10
- package/dist/options-ByNm2o89.d.ts +0 -323
- package/dist/options-CGUfVStV.d.ts +0 -119
- package/dist/socket.d.ts +0 -143
- package/dist/socket.js +0 -13
- package/dist/types-BeGPexio.d.ts +0 -381
- package/dist/types-Bz4OYEAV.d.ts +0 -87
- package/dist/types-CiwGU6zC.d.ts +0 -56
- package/dist/views/index.d.ts +0 -8
- package/dist/views/index.js +0 -10
- package/docs/concepts/view-workflows.md +0 -52
package/dist/chunk-Q2GU4QLZ.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createSlackAssistantBridge
|
|
3
|
-
} from "./chunk-GEFK72VO.js";
|
|
4
|
-
import {
|
|
5
|
-
createSlackFeedbackBlock
|
|
6
|
-
} from "./chunk-ELR6MQD7.js";
|
|
7
|
-
import {
|
|
8
|
-
createSlackChannelAdapter
|
|
9
|
-
} from "./chunk-KQPUQJ57.js";
|
|
10
|
-
|
|
11
|
-
// src/app-surface.ts
|
|
12
|
-
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
13
|
-
var DEFAULT_STREAM_ERROR_MESSAGE = "I ran into an error while preparing this answer. Please try again.";
|
|
14
|
-
function installSlackAgentAppSurface(boltApp, options) {
|
|
15
|
-
const {
|
|
16
|
-
respondToMentions,
|
|
17
|
-
respondToMessages,
|
|
18
|
-
respondToChannelMessages,
|
|
19
|
-
resolveMessage,
|
|
20
|
-
feedback: feedbackOption,
|
|
21
|
-
onFeedback,
|
|
22
|
-
timeoutMs,
|
|
23
|
-
logger,
|
|
24
|
-
source,
|
|
25
|
-
prepareTurn,
|
|
26
|
-
resolveSession,
|
|
27
|
-
interactive,
|
|
28
|
-
viewWorkflows,
|
|
29
|
-
...assistantBridgeOptions
|
|
30
|
-
} = options;
|
|
31
|
-
const feedbackConfig = feedbackOption === false ? void 0 : feedbackOption ?? (onFeedback ? { onFeedback } : {});
|
|
32
|
-
const assistantFeedback = feedbackOption === false ? false : feedbackConfig;
|
|
33
|
-
const feedbackBlock = feedbackConfig ? createSlackFeedbackBlock(feedbackConfig) : void 0;
|
|
34
|
-
const formatStreamError = assistantBridgeOptions.formatStreamError ?? (() => DEFAULT_STREAM_ERROR_MESSAGE);
|
|
35
|
-
const formatting = assistantBridgeOptions.formatChatMarkdown;
|
|
36
|
-
const channelSource = createErrorTranslatingSource(source, formatStreamError);
|
|
37
|
-
const channelFinalArgs = mergeChatStreamFinalArgs(
|
|
38
|
-
assistantBridgeOptions.chatStreamFinalArgs,
|
|
39
|
-
feedbackBlock
|
|
40
|
-
);
|
|
41
|
-
const bridge = createSlackAssistantBridge({
|
|
42
|
-
...assistantBridgeOptions,
|
|
43
|
-
source,
|
|
44
|
-
...assistantFeedback !== void 0 ? { feedback: assistantFeedback } : {},
|
|
45
|
-
...timeoutMs !== void 0 ? { timeoutMs } : {},
|
|
46
|
-
...logger ? { logger } : {},
|
|
47
|
-
...prepareTurn ? { prepareTurn: toAssistantPrepareTurn(prepareTurn) } : {},
|
|
48
|
-
...resolveSession ? { resolveSession: toAssistantResolveSession(resolveSession) } : {},
|
|
49
|
-
...interactive ? { handleInteractiveRequest: interactive.handleInteractiveRequest } : {}
|
|
50
|
-
});
|
|
51
|
-
bridge.install(boltApp);
|
|
52
|
-
const channelAdapter = createSlackChannelAdapter({
|
|
53
|
-
source: channelSource,
|
|
54
|
-
sessionStrategy: assistantBridgeOptions.sessionStrategy,
|
|
55
|
-
...resolveSession ? { resolveSession } : {},
|
|
56
|
-
...prepareTurn ? { prepareTurn } : {},
|
|
57
|
-
...interactive ? { handleInteractiveRequest: interactive.handleInteractiveRequest } : {},
|
|
58
|
-
streamingMode: "chat-stream",
|
|
59
|
-
showReasoning: assistantBridgeOptions.showReasoning,
|
|
60
|
-
showToolUsage: assistantBridgeOptions.showToolUsage,
|
|
61
|
-
showSubagentToolUsage: assistantBridgeOptions.showSubagentToolUsage,
|
|
62
|
-
showSubagentResultInTask: assistantBridgeOptions.showSubagentResultInTask,
|
|
63
|
-
formatToolTitle: assistantBridgeOptions.formatToolTitle,
|
|
64
|
-
formatToolUpdate: assistantBridgeOptions.formatToolUpdate,
|
|
65
|
-
formatToolDetails: assistantBridgeOptions.formatToolDetails,
|
|
66
|
-
formatToolResultOutput: assistantBridgeOptions.formatToolResultOutput,
|
|
67
|
-
formatToolError: assistantBridgeOptions.formatToolError,
|
|
68
|
-
formatReasoningUpdate: assistantBridgeOptions.formatReasoningUpdate,
|
|
69
|
-
chatStreamBufferSize: assistantBridgeOptions.chatStreamBufferSize,
|
|
70
|
-
chatStreamStartArgs: {
|
|
71
|
-
...assistantBridgeOptions.chatStreamStartArgs ?? {},
|
|
72
|
-
task_display_mode: assistantBridgeOptions.taskDisplayMode ?? "timeline"
|
|
73
|
-
},
|
|
74
|
-
publishFinalResponseArtifact: assistantBridgeOptions.publishFinalResponseArtifact,
|
|
75
|
-
finalResponseArtifactMode: assistantBridgeOptions.finalResponseArtifactMode,
|
|
76
|
-
finalResponseArtifactStreamThreshold: assistantBridgeOptions.finalResponseArtifactStreamThreshold,
|
|
77
|
-
formatFinalResponseArtifactContinuationNotice: assistantBridgeOptions.formatFinalResponseArtifactContinuationNotice,
|
|
78
|
-
formatFinalResponseArtifactMessage: assistantBridgeOptions.formatFinalResponseArtifactMessage,
|
|
79
|
-
onFinalResponseArtifactError: assistantBridgeOptions.onFinalResponseArtifactError,
|
|
80
|
-
...typeof assistantBridgeOptions.initialStatus === "object" && assistantBridgeOptions.initialStatus !== null ? { initialStatus: assistantBridgeOptions.initialStatus } : {},
|
|
81
|
-
...formatting?.formatChatMarkdown !== void 0 ? { formatChatMarkdown: formatting.formatChatMarkdown } : {},
|
|
82
|
-
...formatting?.formatMessageText ? { formatMessageText: formatting.formatMessageText } : {},
|
|
83
|
-
timeout: timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
84
|
-
respondToMentions: respondToMentions !== false,
|
|
85
|
-
respondToMessages: respondToMessages !== false,
|
|
86
|
-
respondToChannelMessages: respondToChannelMessages === true,
|
|
87
|
-
...resolveMessage ? { resolveMessage } : {},
|
|
88
|
-
chatStreamFinalArgs: channelFinalArgs,
|
|
89
|
-
...logger ? { logger } : {},
|
|
90
|
-
...logger ? {
|
|
91
|
-
onError: async (error, info) => {
|
|
92
|
-
logger.warn?.("slack channel turn failed", {
|
|
93
|
-
error: formatErrorForLog(error),
|
|
94
|
-
channelId: info.channelId,
|
|
95
|
-
userId: info.userId
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
} : {}
|
|
99
|
-
});
|
|
100
|
-
channelAdapter.mount(boltApp);
|
|
101
|
-
interactive?.install(boltApp);
|
|
102
|
-
viewWorkflows?.install(boltApp);
|
|
103
|
-
return { bridge };
|
|
104
|
-
}
|
|
105
|
-
function mergeChatStreamFinalArgs(base, feedbackBlock) {
|
|
106
|
-
if (!base && !feedbackBlock) {
|
|
107
|
-
return void 0;
|
|
108
|
-
}
|
|
109
|
-
const configuredBlocks = Array.isArray(base?.blocks) ? base.blocks : [];
|
|
110
|
-
const blocks = feedbackBlock ? [...configuredBlocks, feedbackBlock] : configuredBlocks;
|
|
111
|
-
return {
|
|
112
|
-
...base ?? {},
|
|
113
|
-
...blocks.length > 0 ? { blocks } : {}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function toAssistantPrepareTurn(prepareTurn) {
|
|
117
|
-
return (request) => prepareTurn(toAppTurnRequest(request));
|
|
118
|
-
}
|
|
119
|
-
function toAssistantResolveSession(resolveSession) {
|
|
120
|
-
return (request) => resolveSession(toAppTurnRequest(request));
|
|
121
|
-
}
|
|
122
|
-
function toAppTurnRequest(request) {
|
|
123
|
-
const user = {
|
|
124
|
-
userId: request.message.userId,
|
|
125
|
-
channelId: request.message.channelId,
|
|
126
|
-
teamId: request.message.teamId ?? request.auth.teamId,
|
|
127
|
-
threadTs: request.message.threadTs,
|
|
128
|
-
messageTs: request.message.messageTs
|
|
129
|
-
};
|
|
130
|
-
return {
|
|
131
|
-
slackActivity: request.message,
|
|
132
|
-
user,
|
|
133
|
-
sessionId: request.sessionId,
|
|
134
|
-
message: request.message.text,
|
|
135
|
-
auth: request.auth,
|
|
136
|
-
threadContext: request.threadContext,
|
|
137
|
-
assistant: request.assistant,
|
|
138
|
-
client: request.client,
|
|
139
|
-
rawArgs: request.rawArgs
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function createErrorTranslatingSource(source, formatStreamError) {
|
|
143
|
-
return {
|
|
144
|
-
chat(sessionId, message, options) {
|
|
145
|
-
const events = source.chat(sessionId, message, options);
|
|
146
|
-
return translateErrors(events, formatStreamError);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
async function* translateErrors(events, formatStreamError) {
|
|
151
|
-
try {
|
|
152
|
-
for await (const event of events) {
|
|
153
|
-
if (event.type === "error") {
|
|
154
|
-
yield {
|
|
155
|
-
type: "text-delta",
|
|
156
|
-
text: `
|
|
157
|
-
|
|
158
|
-
${formatStreamError(toError(event.error))}`
|
|
159
|
-
};
|
|
160
|
-
yield { type: "complete" };
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
yield event;
|
|
164
|
-
}
|
|
165
|
-
} catch (error) {
|
|
166
|
-
yield {
|
|
167
|
-
type: "text-delta",
|
|
168
|
-
text: `
|
|
169
|
-
|
|
170
|
-
${formatStreamError(toError(error))}`
|
|
171
|
-
};
|
|
172
|
-
yield { type: "complete" };
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
function toError(value) {
|
|
176
|
-
return value instanceof Error ? value : new Error(String(value));
|
|
177
|
-
}
|
|
178
|
-
function formatErrorForLog(error) {
|
|
179
|
-
if (error instanceof Error) {
|
|
180
|
-
return error.stack ?? error.message;
|
|
181
|
-
}
|
|
182
|
-
return String(error);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export {
|
|
186
|
-
installSlackAgentAppSurface
|
|
187
|
-
};
|
package/dist/chunk-QFDXKCAQ.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createSlackChannelAdapter
|
|
3
|
-
} from "./chunk-KQPUQJ57.js";
|
|
4
|
-
|
|
5
|
-
// src/express.ts
|
|
6
|
-
import {
|
|
7
|
-
createSlackBoltApp
|
|
8
|
-
} from "@cuylabs/channel-slack/transports/http";
|
|
9
|
-
async function mountSlackAgent(source, options = {}) {
|
|
10
|
-
const {
|
|
11
|
-
botToken: providedToken,
|
|
12
|
-
signingSecret,
|
|
13
|
-
auth,
|
|
14
|
-
path,
|
|
15
|
-
processBeforeResponse,
|
|
16
|
-
signatureVerification,
|
|
17
|
-
boltAppOptions,
|
|
18
|
-
receiverOptions,
|
|
19
|
-
port: portOption,
|
|
20
|
-
host,
|
|
21
|
-
app: providedApp,
|
|
22
|
-
...adapterOptions
|
|
23
|
-
} = options;
|
|
24
|
-
const {
|
|
25
|
-
boltApp,
|
|
26
|
-
receiver,
|
|
27
|
-
app: expressApp,
|
|
28
|
-
authMode,
|
|
29
|
-
routePath
|
|
30
|
-
} = await createSlackBoltApp({
|
|
31
|
-
signingSecret,
|
|
32
|
-
path,
|
|
33
|
-
botToken: providedToken,
|
|
34
|
-
auth,
|
|
35
|
-
app: providedApp,
|
|
36
|
-
processBeforeResponse,
|
|
37
|
-
signatureVerification,
|
|
38
|
-
boltAppOptions,
|
|
39
|
-
receiverOptions
|
|
40
|
-
});
|
|
41
|
-
const channelAdapter = createSlackChannelAdapter({
|
|
42
|
-
source,
|
|
43
|
-
...adapterOptions
|
|
44
|
-
});
|
|
45
|
-
channelAdapter.mount(boltApp);
|
|
46
|
-
mountReceiverRouter(expressApp, receiver);
|
|
47
|
-
const port = portOption === void 0 ? resolvePort(process.env.PORT) : portOption;
|
|
48
|
-
let server;
|
|
49
|
-
if (!providedApp && port !== null) {
|
|
50
|
-
const onListen = () => {
|
|
51
|
-
process.stdout.write(
|
|
52
|
-
`Slack bot listening on port ${port} at ${routePath}
|
|
53
|
-
`
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
server = host ? expressApp.listen(port, host, onListen) : expressApp.listen(port, onListen);
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
app: expressApp,
|
|
60
|
-
boltApp,
|
|
61
|
-
receiver,
|
|
62
|
-
authMode,
|
|
63
|
-
routePath,
|
|
64
|
-
channelAdapter,
|
|
65
|
-
server
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function resolvePort(port) {
|
|
69
|
-
if (!port) return 3e3;
|
|
70
|
-
const parsed = Number(port);
|
|
71
|
-
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
72
|
-
throw new Error(`Invalid PORT value: ${port}`);
|
|
73
|
-
}
|
|
74
|
-
return parsed;
|
|
75
|
-
}
|
|
76
|
-
function mountReceiverRouter(app, receiver) {
|
|
77
|
-
app.use(receiver.router);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export {
|
|
81
|
-
mountSlackAgent
|
|
82
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { Server } from 'node:http';
|
|
2
|
-
import { Application } from 'express';
|
|
3
|
-
import { App, ExpressReceiver } from '@slack/bolt';
|
|
4
|
-
import { CreateSlackBoltAppOptions } from '@cuylabs/channel-slack/transports/http';
|
|
5
|
-
import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
|
|
6
|
-
import { C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-ByNm2o89.js';
|
|
7
|
-
import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
|
|
8
|
-
import '@cuylabs/agent-core';
|
|
9
|
-
import '@slack/web-api';
|
|
10
|
-
import '@cuylabs/channel-slack/core';
|
|
11
|
-
import './interactive-BigrPKnu.js';
|
|
12
|
-
import '@cuylabs/channel-slack/interactive';
|
|
13
|
-
import './options-CGUfVStV.js';
|
|
14
|
-
import './artifacts/index.js';
|
|
15
|
-
import '@cuylabs/channel-slack/artifacts';
|
|
16
|
-
import '@cuylabs/channel-slack/assistant';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Express helper for mounting the Slack assistant bridge.
|
|
20
|
-
*
|
|
21
|
-
* Companion to `mountSlackAgent` (which wires the classic
|
|
22
|
-
* `app.message`/`app.event` listeners). This one uses
|
|
23
|
-
* `createSlackAssistantBridge` so the bot uses Bolt's
|
|
24
|
-
* `app.assistant(new Assistant({...}))` lifecycle — `setStatus`,
|
|
25
|
-
* `setSuggestedPrompts`, `chatStream`, feedback buttons.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { mountSlackAssistantAgent } from "@cuylabs/channel-slack-agent-core";
|
|
30
|
-
*
|
|
31
|
-
* await mountSlackAssistantAgent(agent, {
|
|
32
|
-
* getSuggestedPrompts: () => ({
|
|
33
|
-
* title: "Try one of these:",
|
|
34
|
-
* prompts: [
|
|
35
|
-
* { title: "Roll some dice", message: "Roll 2d20" },
|
|
36
|
-
* { title: "Summarize this thread", message: "Summarize the last 20 messages" },
|
|
37
|
-
* ],
|
|
38
|
-
* }),
|
|
39
|
-
* onFeedback: ({ verdict, sessionId }) => {
|
|
40
|
-
* metrics.increment(`feedback.${verdict}`, { sessionId });
|
|
41
|
-
* },
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
interface MountSlackAssistantAgentOptions extends Omit<CreateSlackAssistantBridgeOptions, "feedback">, Omit<CreateSlackBoltAppOptions, "app" | "path" | "botToken" | "signingSecret" | "auth"> {
|
|
47
|
-
/**
|
|
48
|
-
* Slack bot token (`xoxb-...`).
|
|
49
|
-
* @default process.env.SLACK_BOT_TOKEN
|
|
50
|
-
*/
|
|
51
|
-
botToken?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Slack signing secret used to verify incoming webhook requests.
|
|
54
|
-
* @default process.env.SLACK_SIGNING_SECRET
|
|
55
|
-
*/
|
|
56
|
-
signingSecret?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Structured direct-mode auth config (single-workspace, OAuth, custom).
|
|
59
|
-
* Defaults to `botToken` / `SLACK_BOT_TOKEN` single-workspace mode.
|
|
60
|
-
*/
|
|
61
|
-
auth?: SlackDirectAuthOptions;
|
|
62
|
-
/**
|
|
63
|
-
* Slack Events API callback path handled by Bolt.
|
|
64
|
-
*
|
|
65
|
-
* @default "/slack/events"
|
|
66
|
-
*/
|
|
67
|
-
path?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Port to listen on. Set to `null` to skip `app.listen()` — caller manages
|
|
70
|
-
* the server.
|
|
71
|
-
*
|
|
72
|
-
* @default process.env.PORT || 3000
|
|
73
|
-
*/
|
|
74
|
-
port?: number | null;
|
|
75
|
-
/** Optional host passed to `app.listen(port, host)`. */
|
|
76
|
-
host?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Pre-existing Express app. If not provided, a new one is created and the
|
|
79
|
-
* helper calls `app.listen()` itself.
|
|
80
|
-
*/
|
|
81
|
-
app?: Application;
|
|
82
|
-
/**
|
|
83
|
-
* Feedback config — block + handler. Pass `false` to omit feedback buttons
|
|
84
|
-
* entirely. Pass an object to override action ids, button labels, or the
|
|
85
|
-
* feedback handler. Pass a function as `onFeedback` for the most common
|
|
86
|
-
* case where only the handler differs.
|
|
87
|
-
*/
|
|
88
|
-
feedback?: SlackAssistantFeedbackConfig | false;
|
|
89
|
-
/**
|
|
90
|
-
* Convenience shorthand: `onFeedback: handler` is equivalent to
|
|
91
|
-
* `feedback: { onFeedback: handler }`. Ignored if `feedback` is set.
|
|
92
|
-
*/
|
|
93
|
-
onFeedback?: SlackFeedbackHandler;
|
|
94
|
-
}
|
|
95
|
-
interface MountSlackAssistantAgentResult {
|
|
96
|
-
app: Application;
|
|
97
|
-
boltApp: App;
|
|
98
|
-
receiver: ExpressReceiver;
|
|
99
|
-
authMode: SlackDirectAuthMode;
|
|
100
|
-
routePath: string;
|
|
101
|
-
bridge: SlackAssistantBridge;
|
|
102
|
-
server?: Server;
|
|
103
|
-
}
|
|
104
|
-
declare function mountSlackAssistantAgent(options: MountSlackAssistantAgentOptions): Promise<MountSlackAssistantAgentResult>;
|
|
105
|
-
|
|
106
|
-
export { type MountSlackAssistantAgentOptions, type MountSlackAssistantAgentResult, mountSlackAssistantAgent };
|
package/dist/express.d.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as _slack_bolt from '@slack/bolt';
|
|
2
|
-
import { Server } from 'node:http';
|
|
3
|
-
import { AgentTurnSource } from '@cuylabs/agent-core';
|
|
4
|
-
import { Application } from 'express';
|
|
5
|
-
import { c as createSlackChannelAdapter } from './adapter-vbqtraAr.js';
|
|
6
|
-
import { a as SlackChannelOptions } from './types-BeGPexio.js';
|
|
7
|
-
import { CreateSlackBoltAppOptions } from '@cuylabs/channel-slack/transports/http';
|
|
8
|
-
import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
|
|
9
|
-
import '@cuylabs/channel-slack/core';
|
|
10
|
-
import './options-CGUfVStV.js';
|
|
11
|
-
import './artifacts/index.js';
|
|
12
|
-
import '@cuylabs/channel-slack/artifacts';
|
|
13
|
-
import './interactive-BigrPKnu.js';
|
|
14
|
-
import '@cuylabs/channel-slack/interactive';
|
|
15
|
-
|
|
16
|
-
interface MountSlackAgentOptions extends Omit<SlackChannelOptions, "agent" | "source">, Omit<CreateSlackBoltAppOptions, "app" | "path" | "botToken" | "signingSecret" | "auth"> {
|
|
17
|
-
/**
|
|
18
|
-
* Slack bot token (`xoxb-...`).
|
|
19
|
-
* @default process.env.SLACK_BOT_TOKEN
|
|
20
|
-
*/
|
|
21
|
-
botToken?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Slack signing secret used to verify incoming webhook requests.
|
|
24
|
-
* @default process.env.SLACK_SIGNING_SECRET
|
|
25
|
-
*/
|
|
26
|
-
signingSecret?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Structured direct-mode auth config.
|
|
29
|
-
*
|
|
30
|
-
* Use this for:
|
|
31
|
-
* - multi-workspace OAuth installs
|
|
32
|
-
* - custom Bolt authorize callbacks
|
|
33
|
-
*
|
|
34
|
-
* When omitted, `mountSlackAgent()` defaults to single-workspace mode
|
|
35
|
-
* using `botToken` / `SLACK_BOT_TOKEN`.
|
|
36
|
-
*/
|
|
37
|
-
auth?: SlackDirectAuthOptions;
|
|
38
|
-
/**
|
|
39
|
-
* Exact Slack Events API callback path handled by Bolt.
|
|
40
|
-
*
|
|
41
|
-
* This becomes the request URL you configure in the Slack app:
|
|
42
|
-
* `https://<your-host>${path}`.
|
|
43
|
-
*
|
|
44
|
-
* @default "/slack/events"
|
|
45
|
-
*/
|
|
46
|
-
path?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Port to listen on.
|
|
49
|
-
* Set to `null` to skip `app.listen()` — caller manages the server.
|
|
50
|
-
* @default process.env.PORT || 3000
|
|
51
|
-
*/
|
|
52
|
-
port?: number | null;
|
|
53
|
-
/**
|
|
54
|
-
* Optional host/interface passed to `app.listen(port, host)`.
|
|
55
|
-
*/
|
|
56
|
-
host?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Pre-existing Express app. If not provided, a new one is created.
|
|
59
|
-
*
|
|
60
|
-
* When provided, the Bolt receiver router is mounted on `path` and no
|
|
61
|
-
* internal `app.listen()` is called (the caller must start the server).
|
|
62
|
-
*/
|
|
63
|
-
app?: Application;
|
|
64
|
-
}
|
|
65
|
-
interface MountSlackAgentResult {
|
|
66
|
-
/** The Express application */
|
|
67
|
-
app: Application;
|
|
68
|
-
/** The Bolt App instance */
|
|
69
|
-
boltApp: _slack_bolt.App;
|
|
70
|
-
/** The Bolt ExpressReceiver */
|
|
71
|
-
receiver: _slack_bolt.ExpressReceiver;
|
|
72
|
-
/** Resolved direct Slack auth mode */
|
|
73
|
-
authMode: SlackDirectAuthMode;
|
|
74
|
-
/** Exact Slack callback path handled by Bolt */
|
|
75
|
-
routePath: string;
|
|
76
|
-
/** The Slack channel adapter */
|
|
77
|
-
channelAdapter: ReturnType<typeof createSlackChannelAdapter>;
|
|
78
|
-
/** The Node HTTP server when `listen()` was started internally */
|
|
79
|
-
server?: Server;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Mount an agent-core-compatible turn source as a Slack bot on an Express app.
|
|
83
|
-
*
|
|
84
|
-
* This is the simplest way to deploy an agent-core agent to Slack. It handles:
|
|
85
|
-
* 1. Creating a Bolt `ExpressReceiver` with request verification.
|
|
86
|
-
* 2. Creating a Bolt `App` using one of the supported direct auth modes.
|
|
87
|
-
* 3. Creating the Slack channel adapter and mounting it on the Bolt App.
|
|
88
|
-
* 4. Registering `receiver.router` on the Express app.
|
|
89
|
-
* 5. Optionally starting the server.
|
|
90
|
-
*
|
|
91
|
-
* Single-workspace mode environment variables (if not passed explicitly):
|
|
92
|
-
* - `SLACK_BOT_TOKEN` — Bot OAuth token (`xoxb-...`)
|
|
93
|
-
* - `SLACK_SIGNING_SECRET` — App signing secret for request verification
|
|
94
|
-
*
|
|
95
|
-
* OAuth mode environment variables:
|
|
96
|
-
* - `SLACK_SIGNING_SECRET`
|
|
97
|
-
* - `SLACK_CLIENT_ID`
|
|
98
|
-
* - `SLACK_CLIENT_SECRET`
|
|
99
|
-
* - `SLACK_STATE_SECRET` unless you provide a custom state store
|
|
100
|
-
*/
|
|
101
|
-
declare function mountSlackAgent(source: AgentTurnSource, options?: MountSlackAgentOptions): Promise<MountSlackAgentResult>;
|
|
102
|
-
|
|
103
|
-
export { type MountSlackAgentOptions, type MountSlackAgentResult, mountSlackAgent };
|
package/dist/express.js
DELETED
package/dist/feedback/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { RegisterSlackFeedbackOptions, SLACK_FEEDBACK_ACTION_ID, SlackFeedbackBlockOptions, SlackFeedbackButtonConfig, SlackFeedbackContext, SlackFeedbackContextBlock, SlackFeedbackHandler, SlackFeedbackVerdict, createSlackFeedbackBlock, registerSlackFeedbackAction } from '@cuylabs/channel-slack/feedback';
|
package/dist/feedback/index.js
DELETED