@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.
- package/README.md +13 -10
- package/dist/chunk-U6RC4SXN.js +331 -0
- package/dist/history/index.d.ts +7 -17
- package/dist/index.d.ts +5 -28
- package/dist/index.js +14 -58
- package/dist/interactive/index.d.ts +86 -7
- package/dist/shared/index.d.ts +144 -19
- package/dist/shared/index.js +8 -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-A2PLAVW6.js +0 -75
- package/dist/chunk-C7CHMYV6.js +0 -226
- package/dist/chunk-D4CSEAIF.js +0 -82
- package/dist/chunk-ELR6MQD7.js +0 -12
- package/dist/chunk-FJP6ZFUB.js +0 -921
- package/dist/chunk-GKZRDNEB.js +0 -187
- package/dist/chunk-HHXAXSG6.js +0 -67
- package/dist/chunk-JU5R6JZG.js +0 -85
- package/dist/chunk-KAEZPS3U.js +0 -77
- package/dist/chunk-NNCVHQC4.js +0 -94
- package/dist/chunk-VBGQD6JT.js +0 -1008
- package/dist/chunk-XA7U3GRN.js +0 -482
- 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/README.md
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Slack adapter for `@cuylabs/agent-core`, built on
|
|
4
4
|
`@cuylabs/channel-slack`.
|
|
5
5
|
|
|
6
|
-
Use this package when an Agent Core application needs
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Use this package when an Agent Core application needs Agent Core-specific Slack
|
|
7
|
+
bindings: event mapping, source adaptation, context fragments, history helpers,
|
|
8
|
+
MCP token bridging, or approval/human-input controller binding.
|
|
9
9
|
|
|
10
|
-
Generic Slack mechanics
|
|
11
|
-
|
|
10
|
+
Generic Slack mechanics, mounts, Assistant rendering, classic message routing,
|
|
11
|
+
feedback, artifacts, interactive stores/builders, response sinks, and
|
|
12
12
|
transports live in `@cuylabs/channel-slack`.
|
|
13
13
|
|
|
14
14
|
## Install
|
|
@@ -33,10 +33,11 @@ without injecting its own client.
|
|
|
33
33
|
Socket Mode:
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
import {
|
|
36
|
+
import { mountSlackAppSocket } from "@cuylabs/channel-slack/socket";
|
|
37
|
+
import { adaptAgentTurnSourceToSlackTurnSource } from "@cuylabs/channel-slack-agent-core";
|
|
37
38
|
|
|
38
|
-
await
|
|
39
|
-
source: agent,
|
|
39
|
+
await mountSlackAppSocket({
|
|
40
|
+
source: adaptAgentTurnSourceToSlackTurnSource(agent),
|
|
40
41
|
appToken: process.env.SLACK_APP_TOKEN,
|
|
41
42
|
botToken: process.env.SLACK_BOT_TOKEN,
|
|
42
43
|
});
|
|
@@ -45,9 +46,11 @@ await mountSlackAssistantAgentSocket({
|
|
|
45
46
|
Express Events API:
|
|
46
47
|
|
|
47
48
|
```typescript
|
|
48
|
-
import {
|
|
49
|
+
import { mountSlackApp } from "@cuylabs/channel-slack/app";
|
|
50
|
+
import { adaptAgentTurnSourceToSlackTurnSource } from "@cuylabs/channel-slack-agent-core";
|
|
49
51
|
|
|
50
|
-
await
|
|
52
|
+
await mountSlackApp({
|
|
53
|
+
source: adaptAgentTurnSourceToSlackTurnSource(agent),
|
|
51
54
|
botToken: process.env.SLACK_BOT_TOKEN,
|
|
52
55
|
signingSecret: process.env.SLACK_SIGNING_SECRET,
|
|
53
56
|
});
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
// src/shared/context-fragments.ts
|
|
2
|
+
import {
|
|
3
|
+
currentSlackTurnContext
|
|
4
|
+
} from "@cuylabs/channel-slack/core";
|
|
5
|
+
var DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY = "slackContextFragment";
|
|
6
|
+
function isRecord(value) {
|
|
7
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
function isPayload(value) {
|
|
10
|
+
return isRecord(value) && typeof value.content === "string";
|
|
11
|
+
}
|
|
12
|
+
function resolveContextBagValue(slack, key) {
|
|
13
|
+
const value = slack.context?.[key];
|
|
14
|
+
if (typeof value === "string") {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
if (isPayload(value)) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
function resolveDedupeKey(options, context) {
|
|
23
|
+
return typeof options.dedupeKey === "function" ? options.dedupeKey(context) : options.dedupeKey;
|
|
24
|
+
}
|
|
25
|
+
function resolveMetadata(options, context) {
|
|
26
|
+
return typeof options.metadata === "function" ? options.metadata(context) : options.metadata;
|
|
27
|
+
}
|
|
28
|
+
function normalizeFragment(resolved, options, context) {
|
|
29
|
+
const payload = typeof resolved === "string" ? { content: resolved } : isPayload(resolved) ? resolved : void 0;
|
|
30
|
+
if (!payload) {
|
|
31
|
+
return resolved;
|
|
32
|
+
}
|
|
33
|
+
if (payload.content.trim().length === 0) {
|
|
34
|
+
return void 0;
|
|
35
|
+
}
|
|
36
|
+
const dedupeKey = payload.dedupeKey ?? resolveDedupeKey(options, context);
|
|
37
|
+
const metadata = payload.metadata ?? resolveMetadata(options, context);
|
|
38
|
+
const maxChars = payload.maxChars ?? options.maxChars;
|
|
39
|
+
return {
|
|
40
|
+
kind: payload.kind ?? options.kind ?? "slack-context",
|
|
41
|
+
content: payload.content,
|
|
42
|
+
role: payload.role ?? options.role ?? "user",
|
|
43
|
+
placement: payload.placement ?? options.placement ?? "after-latest-user",
|
|
44
|
+
lifetime: payload.lifetime ?? options.lifetime ?? "turn",
|
|
45
|
+
source: payload.source ?? options.source ?? "slack",
|
|
46
|
+
title: payload.title ?? options.title ?? "Slack Context",
|
|
47
|
+
budgetBehavior: payload.budgetBehavior ?? options.budgetBehavior ?? "droppable",
|
|
48
|
+
...maxChars !== void 0 ? { maxChars } : {},
|
|
49
|
+
...dedupeKey ? { dedupeKey } : {},
|
|
50
|
+
...metadata ? { metadata } : {}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function createSlackContextFragmentMiddleware(options = {}) {
|
|
54
|
+
const contextKey = options.contextKey ?? DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY;
|
|
55
|
+
return {
|
|
56
|
+
name: options.name ?? "slack-context-fragment",
|
|
57
|
+
async contextFragments(step) {
|
|
58
|
+
const slack = currentSlackTurnContext();
|
|
59
|
+
if (!slack) {
|
|
60
|
+
return void 0;
|
|
61
|
+
}
|
|
62
|
+
const context = { slack, step };
|
|
63
|
+
const resolved = options.resolve ? await options.resolve(context) : resolveContextBagValue(slack, contextKey);
|
|
64
|
+
if (resolved === void 0) {
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
return normalizeFragment(resolved, options, context);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/shared/event-bridge/agent-event-mapper.ts
|
|
73
|
+
function mapAgentEventToSlackTurnEvent(event) {
|
|
74
|
+
switch (event.type) {
|
|
75
|
+
case "text-start":
|
|
76
|
+
case "text-delta":
|
|
77
|
+
case "text-end":
|
|
78
|
+
case "reasoning-start":
|
|
79
|
+
case "reasoning-end":
|
|
80
|
+
case "tool-start":
|
|
81
|
+
case "tool-result":
|
|
82
|
+
case "tool-error":
|
|
83
|
+
case "subagent-start":
|
|
84
|
+
case "subagent-complete":
|
|
85
|
+
case "subagent-error":
|
|
86
|
+
case "status":
|
|
87
|
+
case "complete":
|
|
88
|
+
case "error":
|
|
89
|
+
case "approval-request":
|
|
90
|
+
case "approval-resolved":
|
|
91
|
+
case "human-input-request":
|
|
92
|
+
case "human-input-resolved":
|
|
93
|
+
return { ...event };
|
|
94
|
+
case "subagent-event":
|
|
95
|
+
return {
|
|
96
|
+
...event,
|
|
97
|
+
event: mapAgentEventToSlackTurnEvent(event.event)
|
|
98
|
+
};
|
|
99
|
+
case "reasoning-delta":
|
|
100
|
+
case "step-start":
|
|
101
|
+
case "step-finish":
|
|
102
|
+
case "turn-boundary":
|
|
103
|
+
case "message":
|
|
104
|
+
case "computer-call":
|
|
105
|
+
case "computer-result":
|
|
106
|
+
case "intervention-applied":
|
|
107
|
+
case "follow-up-queued":
|
|
108
|
+
case "doom-loop":
|
|
109
|
+
case "context-overflow":
|
|
110
|
+
case "context-compaction":
|
|
111
|
+
case "turn-summary":
|
|
112
|
+
case "retry":
|
|
113
|
+
return mapIgnoredAgentEvent(event);
|
|
114
|
+
default:
|
|
115
|
+
return mapIgnoredAgentEvent(event);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function mapIgnoredAgentEvent(event) {
|
|
119
|
+
return { ...event };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/shared/event-bridge/options-adapter.ts
|
|
123
|
+
function mapAgentSlackEventBridgeOptionsToRuntimeOptions(options) {
|
|
124
|
+
return {
|
|
125
|
+
showReasoning: options.showReasoning,
|
|
126
|
+
showToolUsage: options.showToolUsage,
|
|
127
|
+
showSubagentToolUsage: options.showSubagentToolUsage,
|
|
128
|
+
showSubagentResultInTask: options.showSubagentResultInTask,
|
|
129
|
+
...options.formatToolTitle ? { formatToolTitle: options.formatToolTitle } : {},
|
|
130
|
+
formatToolUpdate: options.formatToolUpdate,
|
|
131
|
+
...options.formatToolDetails ? {
|
|
132
|
+
formatToolDetails: (event) => options.formatToolDetails?.(
|
|
133
|
+
event
|
|
134
|
+
)
|
|
135
|
+
} : {},
|
|
136
|
+
...options.formatToolResultOutput ? {
|
|
137
|
+
formatToolResultOutput: (event) => options.formatToolResultOutput?.(
|
|
138
|
+
event
|
|
139
|
+
)
|
|
140
|
+
} : {},
|
|
141
|
+
formatToolError: options.formatToolError,
|
|
142
|
+
formatReasoningUpdate: options.formatReasoningUpdate,
|
|
143
|
+
formatMessageText: options.formatMessageText,
|
|
144
|
+
streamingMode: options.streamingMode,
|
|
145
|
+
progressiveUpdateThreshold: options.progressiveUpdateThreshold,
|
|
146
|
+
progressiveUpdateIntervalMs: options.progressiveUpdateIntervalMs,
|
|
147
|
+
chatStreamBufferSize: options.chatStreamBufferSize,
|
|
148
|
+
maxTaskUpdates: options.maxTaskUpdates,
|
|
149
|
+
maxTaskUpdateTextChars: options.maxTaskUpdateTextChars,
|
|
150
|
+
maxTaskUpdateFieldChars: options.maxTaskUpdateFieldChars,
|
|
151
|
+
interactiveMode: options.interactiveMode,
|
|
152
|
+
...options.handleInteractiveRequest ? {
|
|
153
|
+
handleInteractiveRequest: (context) => options.handleInteractiveRequest?.(
|
|
154
|
+
context
|
|
155
|
+
)
|
|
156
|
+
} : {},
|
|
157
|
+
formatApprovalRequired: (request) => options.formatApprovalRequired(request),
|
|
158
|
+
formatHumanInputRequired: (request) => options.formatHumanInputRequired(request),
|
|
159
|
+
...options.onStatusChange ? {
|
|
160
|
+
onStatusChange: (label, event) => options.onStatusChange?.(
|
|
161
|
+
label,
|
|
162
|
+
event
|
|
163
|
+
)
|
|
164
|
+
} : {},
|
|
165
|
+
...options.chatStreamFinalArgs ? { chatStreamFinalArgs: options.chatStreamFinalArgs } : {},
|
|
166
|
+
...options.publishFinalResponseArtifact ? { publishFinalResponseArtifact: options.publishFinalResponseArtifact } : {},
|
|
167
|
+
...options.finalResponseArtifactMode ? { finalResponseArtifactMode: options.finalResponseArtifactMode } : {},
|
|
168
|
+
...options.finalResponseArtifactStreamThreshold ? {
|
|
169
|
+
finalResponseArtifactStreamThreshold: options.finalResponseArtifactStreamThreshold
|
|
170
|
+
} : {},
|
|
171
|
+
...options.formatFinalResponseArtifactContinuationNotice ? {
|
|
172
|
+
formatFinalResponseArtifactContinuationNotice: options.formatFinalResponseArtifactContinuationNotice
|
|
173
|
+
} : {},
|
|
174
|
+
...options.formatFinalResponseArtifactMessage ? {
|
|
175
|
+
formatFinalResponseArtifactMessage: options.formatFinalResponseArtifactMessage
|
|
176
|
+
} : {},
|
|
177
|
+
...options.onFinalResponseArtifactError ? { onFinalResponseArtifactError: options.onFinalResponseArtifactError } : {}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// src/shared/event-bridge/bridge.ts
|
|
182
|
+
import {
|
|
183
|
+
bridgeSlackTurnEventsToSlack
|
|
184
|
+
} from "@cuylabs/channel-slack/runtime";
|
|
185
|
+
async function bridgeAgentEventsToSlack(events, sink, options) {
|
|
186
|
+
return bridgeSlackTurnEventsToSlack(
|
|
187
|
+
toSlackTurnEvents(events),
|
|
188
|
+
sink,
|
|
189
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions(options)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
async function* toSlackTurnEvents(events) {
|
|
193
|
+
for await (const event of events) {
|
|
194
|
+
yield mapAgentEventToSlackTurnEvent(event);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// src/shared/event-bridge/options.ts
|
|
199
|
+
var DEFAULT_OPTIONS = {
|
|
200
|
+
showReasoning: false,
|
|
201
|
+
showToolUsage: true,
|
|
202
|
+
showSubagentToolUsage: false,
|
|
203
|
+
showSubagentResultInTask: false,
|
|
204
|
+
formatToolTitle: (toolName) => toolName,
|
|
205
|
+
formatToolUpdate: (toolName) => `\u{1F50D} Using tool: ${toolName}...`,
|
|
206
|
+
formatToolError: (toolName, _error) => `\u26A0\uFE0F Tool ${toolName} encountered an error`,
|
|
207
|
+
formatReasoningUpdate: () => "Thinking...",
|
|
208
|
+
formatMessageText: (text) => text,
|
|
209
|
+
streamingMode: "progressive",
|
|
210
|
+
progressiveUpdateThreshold: 150,
|
|
211
|
+
progressiveUpdateIntervalMs: 3e3,
|
|
212
|
+
chatStreamBufferSize: 256,
|
|
213
|
+
maxTaskUpdates: 200,
|
|
214
|
+
maxTaskUpdateTextChars: 2e4,
|
|
215
|
+
maxTaskUpdateFieldChars: 500,
|
|
216
|
+
interactiveMode: "message-and-error",
|
|
217
|
+
formatApprovalRequired: (request) => `This turn requires approval for "${request.tool}", but in-channel approval is not configured for this Slack host.`,
|
|
218
|
+
formatHumanInputRequired: (request) => `This turn is waiting for input: ${request.title}. In-channel human input is not configured for this Slack host.`,
|
|
219
|
+
finalResponseArtifactMode: "supplemental",
|
|
220
|
+
finalResponseArtifactStreamThreshold: 4e3,
|
|
221
|
+
formatFinalResponseArtifactContinuationNotice: () => "\n\nFull response is long. I will publish the complete answer as a Slack artifact when it finishes.",
|
|
222
|
+
formatFinalResponseArtifactMessage: (result) => {
|
|
223
|
+
const title = result.publication.artifact.title.trim() || "Agent response";
|
|
224
|
+
if (result.publication.method === "canvas") {
|
|
225
|
+
return `I created a Slack Canvas for the full response: ${title}`;
|
|
226
|
+
}
|
|
227
|
+
if (result.publication.method === "file") {
|
|
228
|
+
return `I uploaded the full response as a file: ${title}`;
|
|
229
|
+
}
|
|
230
|
+
return `I published the full response as a Slack artifact: ${title}`;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
function resolveSlackEventBridgeOptions(partial) {
|
|
234
|
+
return {
|
|
235
|
+
showReasoning: partial.showReasoning ?? DEFAULT_OPTIONS.showReasoning,
|
|
236
|
+
showToolUsage: partial.showToolUsage ?? DEFAULT_OPTIONS.showToolUsage,
|
|
237
|
+
showSubagentToolUsage: partial.showSubagentToolUsage ?? DEFAULT_OPTIONS.showSubagentToolUsage,
|
|
238
|
+
showSubagentResultInTask: partial.showSubagentResultInTask ?? DEFAULT_OPTIONS.showSubagentResultInTask,
|
|
239
|
+
formatToolTitle: partial.formatToolTitle ?? DEFAULT_OPTIONS.formatToolTitle,
|
|
240
|
+
formatToolUpdate: partial.formatToolUpdate ?? DEFAULT_OPTIONS.formatToolUpdate,
|
|
241
|
+
...partial.formatToolDetails ? { formatToolDetails: partial.formatToolDetails } : {},
|
|
242
|
+
...partial.formatToolResultOutput ? { formatToolResultOutput: partial.formatToolResultOutput } : {},
|
|
243
|
+
formatToolError: partial.formatToolError ?? DEFAULT_OPTIONS.formatToolError,
|
|
244
|
+
formatReasoningUpdate: partial.formatReasoningUpdate ?? DEFAULT_OPTIONS.formatReasoningUpdate,
|
|
245
|
+
formatMessageText: partial.formatMessageText ?? DEFAULT_OPTIONS.formatMessageText,
|
|
246
|
+
streamingMode: partial.streamingMode ?? DEFAULT_OPTIONS.streamingMode,
|
|
247
|
+
progressiveUpdateThreshold: partial.progressiveUpdateThreshold ?? DEFAULT_OPTIONS.progressiveUpdateThreshold,
|
|
248
|
+
progressiveUpdateIntervalMs: partial.progressiveUpdateIntervalMs ?? DEFAULT_OPTIONS.progressiveUpdateIntervalMs,
|
|
249
|
+
chatStreamBufferSize: partial.chatStreamBufferSize ?? DEFAULT_OPTIONS.chatStreamBufferSize,
|
|
250
|
+
maxTaskUpdates: resolveNonNegativeInteger(
|
|
251
|
+
partial.maxTaskUpdates,
|
|
252
|
+
DEFAULT_OPTIONS.maxTaskUpdates
|
|
253
|
+
),
|
|
254
|
+
maxTaskUpdateTextChars: resolveNonNegativeInteger(
|
|
255
|
+
partial.maxTaskUpdateTextChars,
|
|
256
|
+
DEFAULT_OPTIONS.maxTaskUpdateTextChars
|
|
257
|
+
),
|
|
258
|
+
maxTaskUpdateFieldChars: resolveNonNegativeInteger(
|
|
259
|
+
partial.maxTaskUpdateFieldChars,
|
|
260
|
+
DEFAULT_OPTIONS.maxTaskUpdateFieldChars
|
|
261
|
+
),
|
|
262
|
+
interactiveMode: partial.interactiveMode ?? DEFAULT_OPTIONS.interactiveMode,
|
|
263
|
+
...partial.handleInteractiveRequest ? { handleInteractiveRequest: partial.handleInteractiveRequest } : {},
|
|
264
|
+
formatApprovalRequired: partial.formatApprovalRequired ?? DEFAULT_OPTIONS.formatApprovalRequired,
|
|
265
|
+
formatHumanInputRequired: partial.formatHumanInputRequired ?? DEFAULT_OPTIONS.formatHumanInputRequired,
|
|
266
|
+
...partial.onStatusChange ? { onStatusChange: partial.onStatusChange } : {},
|
|
267
|
+
...partial.chatStreamFinalArgs ? { chatStreamFinalArgs: partial.chatStreamFinalArgs } : {},
|
|
268
|
+
...partial.publishFinalResponseArtifact ? { publishFinalResponseArtifact: partial.publishFinalResponseArtifact } : {},
|
|
269
|
+
finalResponseArtifactMode: partial.finalResponseArtifactMode ?? DEFAULT_OPTIONS.finalResponseArtifactMode,
|
|
270
|
+
finalResponseArtifactStreamThreshold: resolvePositiveInteger(
|
|
271
|
+
partial.finalResponseArtifactStreamThreshold,
|
|
272
|
+
DEFAULT_OPTIONS.finalResponseArtifactStreamThreshold ?? 4e3
|
|
273
|
+
),
|
|
274
|
+
formatFinalResponseArtifactContinuationNotice: partial.formatFinalResponseArtifactContinuationNotice ?? DEFAULT_OPTIONS.formatFinalResponseArtifactContinuationNotice,
|
|
275
|
+
formatFinalResponseArtifactMessage: partial.formatFinalResponseArtifactMessage ?? DEFAULT_OPTIONS.formatFinalResponseArtifactMessage,
|
|
276
|
+
...partial.onFinalResponseArtifactError ? { onFinalResponseArtifactError: partial.onFinalResponseArtifactError } : {}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function resolveNonNegativeInteger(value, fallback) {
|
|
280
|
+
if (value === void 0) {
|
|
281
|
+
return fallback;
|
|
282
|
+
}
|
|
283
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
284
|
+
return fallback;
|
|
285
|
+
}
|
|
286
|
+
return Math.floor(value);
|
|
287
|
+
}
|
|
288
|
+
function resolvePositiveInteger(value, fallback) {
|
|
289
|
+
if (value === void 0) {
|
|
290
|
+
return fallback;
|
|
291
|
+
}
|
|
292
|
+
if (!Number.isFinite(value) || value < 1) {
|
|
293
|
+
return fallback;
|
|
294
|
+
}
|
|
295
|
+
return Math.floor(value);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// src/shared/event-bridge/interactive.ts
|
|
299
|
+
var UnsupportedSlackInteractiveRequestError = class extends Error {
|
|
300
|
+
kind;
|
|
301
|
+
requestId;
|
|
302
|
+
constructor(kind, requestId, message) {
|
|
303
|
+
super(message);
|
|
304
|
+
this.name = "UnsupportedSlackInteractiveRequestError";
|
|
305
|
+
this.kind = kind;
|
|
306
|
+
this.requestId = requestId;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
// src/shared/event-bridge/turn-source.ts
|
|
311
|
+
function adaptAgentTurnSourceToSlackTurnSource(source) {
|
|
312
|
+
return {
|
|
313
|
+
async *chat(sessionId, message, options) {
|
|
314
|
+
const events = source.chat(sessionId, message, options);
|
|
315
|
+
for await (const event of events) {
|
|
316
|
+
yield mapAgentEventToSlackTurnEvent(event);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export {
|
|
323
|
+
DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
|
|
324
|
+
createSlackContextFragmentMiddleware,
|
|
325
|
+
mapAgentEventToSlackTurnEvent,
|
|
326
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions,
|
|
327
|
+
bridgeAgentEventsToSlack,
|
|
328
|
+
resolveSlackEventBridgeOptions,
|
|
329
|
+
UnsupportedSlackInteractiveRequestError,
|
|
330
|
+
adaptAgentTurnSourceToSlackTurnSource
|
|
331
|
+
};
|
package/dist/history/index.d.ts
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import { Logger } from '@cuylabs/agent-core';
|
|
2
2
|
import { SlackHistoryUnavailable, SlackSupplementalHistoryVisibilityMode } from '@cuylabs/channel-slack/history';
|
|
3
|
-
import {
|
|
3
|
+
import { SlackTurnRequestContext, SlackAssistantUtilities } from '@cuylabs/channel-slack/core';
|
|
4
|
+
import { WebClient } from '@slack/web-api';
|
|
4
5
|
import { a as SlackContextFragmentPayload } from '../context-fragments-CQEDcjYR.js';
|
|
5
|
-
import '@slack/bolt';
|
|
6
|
-
import '@slack/web-api';
|
|
7
|
-
import '../options-ByNm2o89.js';
|
|
8
|
-
import '@cuylabs/channel-slack/core';
|
|
9
|
-
import '../interactive-BigrPKnu.js';
|
|
10
|
-
import '@cuylabs/channel-slack/interactive';
|
|
11
|
-
import '../options-CGUfVStV.js';
|
|
12
|
-
import '../artifacts/index.js';
|
|
13
|
-
import '@cuylabs/channel-slack/artifacts';
|
|
14
|
-
import '@cuylabs/channel-slack/feedback';
|
|
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
6
|
|
|
7
|
+
interface SlackAgentHistoryTurnRequestContext extends SlackTurnRequestContext {
|
|
8
|
+
assistant?: SlackAssistantUtilities;
|
|
9
|
+
client?: WebClient;
|
|
10
|
+
}
|
|
21
11
|
interface SlackAgentTurnHistoryOptions {
|
|
22
12
|
enabled: boolean;
|
|
23
13
|
limit: number;
|
|
@@ -40,7 +30,7 @@ interface LoadSlackAgentTurnHistoryContextOptions {
|
|
|
40
30
|
logger?: Pick<Logger, "debug" | "info" | "warn">;
|
|
41
31
|
originChannelId?: string;
|
|
42
32
|
profileResolver?: SlackAgentTurnHistoryProfileResolver;
|
|
43
|
-
request:
|
|
33
|
+
request: SlackAgentHistoryTurnRequestContext;
|
|
44
34
|
}
|
|
45
35
|
type SlackAgentTurnHistoryContextResult = {
|
|
46
36
|
fragment?: SlackContextFragmentPayload;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
export { D as DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY, S as SlackContextFragmentMiddlewareOptions, a as SlackContextFragmentPayload, b as SlackContextFragmentResolver, c as SlackContextFragmentResolverContext, d as createSlackContextFragmentMiddleware } from './context-fragments-CQEDcjYR.js';
|
|
2
|
-
export { UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack } from './shared/index.js';
|
|
3
|
-
export { S as SlackEventBridgeOptions, r as resolveSlackEventBridgeOptions } from './options-CGUfVStV.js';
|
|
2
|
+
export { SlackEventBridgeOptions, UnsupportedSlackInteractiveRequestError, adaptAgentTurnSourceToSlackTurnSource, bridgeAgentEventsToSlack, mapAgentEventToSlackTurnEvent, mapAgentSlackEventBridgeOptionsToRuntimeOptions, resolveSlackEventBridgeOptions } from './shared/index.js';
|
|
4
3
|
export { S as SlackApprovalRequest, a as SlackEventInteractiveRequestHandler, b as SlackHumanInputRequest, c as SlackInteractiveRequest, d as SlackInteractiveRequestBaseContext, e as SlackInteractiveRequestContext, f as SlackInteractiveRequestHandler } from './interactive-BigrPKnu.js';
|
|
5
|
-
export { c as createSlackChannelAdapter } from './adapter-vbqtraAr.js';
|
|
6
|
-
export { S as SlackChannelAdapter, a as SlackChannelOptions, b as SlackSessionStrategy, c as SlackStreamingMode, d as SlackToolStartEvent } from './types-BeGPexio.js';
|
|
7
|
-
export { SlackSessionMap, createSlackSessionMap } from './adapter/index.js';
|
|
8
|
-
export { createSlackAssistantBridge } from './assistant/index.js';
|
|
9
|
-
export { A as AssistantLifecycleArgs, a as AssistantThreadStartedArgs, C as CreateSlackAssistantBridgeOptions, M as MaybePromise, S as SlackAssistantBridge, b as SlackAssistantCancelControlOptions, c as SlackAssistantCancelControlVisibleWhen, d as SlackAssistantFeedbackConfig, e as SlackAssistantSessionStrategy, f as SlackAssistantStatusContext, g as SlackAssistantThreadContextStoreLike, h as SlackAssistantThreadStartedContext, i as SlackAssistantTurnCancelContext, j as SlackAssistantTurnControlsOptions, k as SlackAssistantTurnPreparation, l as SlackAssistantUserMessageContext, r as resolveAssistantSessionId } from './options-ByNm2o89.js';
|
|
10
|
-
export { ParsedAssistantUserMessage, createSlackAssistantThreadContextStore, parseSlackMessageActivityFromMessageEvent } from '@cuylabs/channel-slack/assistant';
|
|
11
|
-
export { CreateSlackFinalResponseArtifactPublisherOptions, SlackFinalResponseArtifactContext, SlackFinalResponseArtifactDeliveryMode, SlackFinalResponseArtifactPublisher, SlackFinalResponseArtifactResult, SlackFinalResponseArtifactValueResolver, createSlackFinalResponseArtifactPublisher } from './artifacts/index.js';
|
|
12
4
|
export { LoadSlackAgentTurnHistoryContextOptions, SlackAgentTurnHistoryContextResult, SlackAgentTurnHistoryOptions, SlackAgentTurnHistoryProfileResolver, emptySlackAgentTurnHistoryContextResult, loadSlackAgentTurnHistoryContext } from './history/index.js';
|
|
13
|
-
export {
|
|
14
|
-
export { createSlackInteractiveController } from './interactive/index.js';
|
|
15
|
-
export { createSlackAgentViewWorkflowController } from './views/index.js';
|
|
16
|
-
export { C as CreateSlackAgentViewWorkflowControllerOptions, S as SlackAgentViewStateValue, a as SlackAgentViewStateValues, b as SlackAgentViewWorkflow, c as SlackAgentViewWorkflowContext, d as SlackAgentViewWorkflowController, e as SlackAgentViewWorkflowDefinition, f as extractSlackAgentViewStateValues, r as readSlackAgentViewStateValue } from './types-CiwGU6zC.js';
|
|
5
|
+
export { SlackInteractiveApprovalRequest, SlackInteractiveController, SlackInteractiveControllerOptions, SlackInteractiveHumanInputRequest, SlackInteractivePendingWaiter, SlackInteractivePostedMessage, SlackInteractiveRequestWaitOptions, SlackInteractiveResolution, createSlackInteractiveController } from './interactive/index.js';
|
|
17
6
|
export { InspectSlackTurnStatusVisibilityOptions, ResolvedSlackTurnStatusVisibilityOptions, RouteSlackAgentEventOptions, SlackActiveToolCall, SlackAgentEventQueue, SlackAgentEventQueueState, SlackSubagentCompletionMessage, SlackSubagentCompletionMessageFormatterOptions, SlackSubagentCompletionNotifierOptions, SlackSubagentCompletionPoster, SlackSubagentCompletionRun, SlackSubagentCompletionSlackContext, SlackSubagentCompletionTurnContext, SlackTurnActivityState, SlackTurnPhase, SlackTurnStatusVisibilityOptions, SlackTurnStatusVisibilityState, SlackTurnStatusVisibilityWarning, SlackTypedApprovalAction, coalesceSlackAgentEvents, createSlackSubagentCompletionNotifier, formatDefaultSlackSubagentCompletionMessage, immediateSlackTextResponse, inspectSlackTurnStatusVisibility, isAbortLikeError, isRunningAgentTurnError, isSlackCancelMessage, isSlackSubagentTerminalEvent, isSlackTerminalTurnPhase, isSlackWaitingForHumanTurnPhase, recordSlackTurnActivity, resolveSlackTurnStatusVisibilityOptions, resolveSlackTypedApprovalAction, routeSlackAgentEvent, shouldInspectSlackTurnStatusVisibility, shouldQueueSlackAgentEvent } from './source/index.js';
|
|
18
|
-
export { MountSlackAgentOptions, MountSlackAgentResult, mountSlackAgent } from './express.js';
|
|
19
|
-
export { MountSlackAssistantAgentOptions, MountSlackAssistantAgentResult, mountSlackAssistantAgent } from './express-assistant.js';
|
|
20
|
-
export { MountSlackAgentAppSocketOptions, MountSlackAgentAppSocketResult, MountSlackAssistantAgentSocketOptions, MountSlackAssistantAgentSocketResult, mountSlackAgentAppSocket, mountSlackAssistantAgentSocket } from './socket.js';
|
|
21
|
-
export { MountSlackAgentAppOptions, MountSlackAgentAppResult, mountSlackAgentApp } from './app.js';
|
|
22
7
|
export { CreateSlackMcpServerConfigOptions, SLACK_MCP_URL, createSlackMcpServerConfig } from './mcp.js';
|
|
23
|
-
export { MountSlackAgentAppTurnRequestContext } from './app-surface.js';
|
|
24
8
|
import '@cuylabs/agent-core';
|
|
25
9
|
import '@cuylabs/channel-slack/core';
|
|
26
10
|
import '@cuylabs/channel-slack/responses';
|
|
11
|
+
import '@cuylabs/channel-slack/runtime';
|
|
27
12
|
import '@cuylabs/channel-slack/interactive';
|
|
28
|
-
import '@slack/bolt';
|
|
29
|
-
import '@slack/web-api';
|
|
30
|
-
import '@cuylabs/channel-slack/feedback';
|
|
31
|
-
import '@cuylabs/channel-slack/artifacts';
|
|
32
13
|
import '@cuylabs/channel-slack/history';
|
|
33
|
-
import '@
|
|
14
|
+
import '@slack/web-api';
|
|
15
|
+
import '@slack/bolt';
|
|
34
16
|
import '@cuylabs/agent-core/dispatch';
|
|
35
|
-
import 'node:http';
|
|
36
|
-
import 'express';
|
|
37
|
-
import '@cuylabs/channel-slack/transports/http';
|
|
38
|
-
import '@cuylabs/channel-slack/auth';
|
|
39
|
-
import '@cuylabs/channel-slack/transports/socket';
|
|
40
17
|
import '@cuylabs/agent-core/mcp';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
SLACK_MCP_URL,
|
|
3
|
+
createSlackMcpServerConfig
|
|
4
|
+
} from "./chunk-RFHXERNL.js";
|
|
4
5
|
import {
|
|
5
6
|
emptySlackAgentTurnHistoryContextResult,
|
|
6
7
|
loadSlackAgentTurnHistoryContext
|
|
@@ -10,8 +11,14 @@ import {
|
|
|
10
11
|
} from "./chunk-OP27SSZU.js";
|
|
11
12
|
import {
|
|
12
13
|
DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
UnsupportedSlackInteractiveRequestError,
|
|
15
|
+
adaptAgentTurnSourceToSlackTurnSource,
|
|
16
|
+
bridgeAgentEventsToSlack,
|
|
17
|
+
createSlackContextFragmentMiddleware,
|
|
18
|
+
mapAgentEventToSlackTurnEvent,
|
|
19
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions,
|
|
20
|
+
resolveSlackEventBridgeOptions
|
|
21
|
+
} from "./chunk-U6RC4SXN.js";
|
|
15
22
|
import {
|
|
16
23
|
coalesceSlackAgentEvents,
|
|
17
24
|
createSlackSubagentCompletionNotifier,
|
|
@@ -31,63 +38,18 @@ import {
|
|
|
31
38
|
shouldInspectSlackTurnStatusVisibility,
|
|
32
39
|
shouldQueueSlackAgentEvent
|
|
33
40
|
} from "./chunk-C7VSW4ZM.js";
|
|
34
|
-
import {
|
|
35
|
-
createSlackAgentViewWorkflowController,
|
|
36
|
-
extractSlackAgentViewStateValues,
|
|
37
|
-
readSlackAgentViewStateValue
|
|
38
|
-
} from "./chunk-C7CHMYV6.js";
|
|
39
|
-
import {
|
|
40
|
-
mountSlackAgentApp
|
|
41
|
-
} from "./chunk-KAEZPS3U.js";
|
|
42
|
-
import {
|
|
43
|
-
mountSlackAssistantAgent
|
|
44
|
-
} from "./chunk-JU5R6JZG.js";
|
|
45
|
-
import {
|
|
46
|
-
mountSlackAgent
|
|
47
|
-
} from "./chunk-D4CSEAIF.js";
|
|
48
|
-
import {
|
|
49
|
-
SLACK_MCP_URL,
|
|
50
|
-
createSlackMcpServerConfig
|
|
51
|
-
} from "./chunk-RFHXERNL.js";
|
|
52
|
-
import {
|
|
53
|
-
mountSlackAgentAppSocket,
|
|
54
|
-
mountSlackAssistantAgentSocket
|
|
55
|
-
} from "./chunk-HHXAXSG6.js";
|
|
56
|
-
import "./chunk-GKZRDNEB.js";
|
|
57
|
-
import {
|
|
58
|
-
createSlackAssistantBridge,
|
|
59
|
-
createSlackAssistantThreadContextStore,
|
|
60
|
-
parseSlackMessageActivityFromMessageEvent,
|
|
61
|
-
resolveAssistantSessionId
|
|
62
|
-
} from "./chunk-FJP6ZFUB.js";
|
|
63
|
-
import "./chunk-ELR6MQD7.js";
|
|
64
|
-
import {
|
|
65
|
-
createSlackChannelAdapter,
|
|
66
|
-
createSlackSessionMap
|
|
67
|
-
} from "./chunk-XA7U3GRN.js";
|
|
68
|
-
import {
|
|
69
|
-
UnsupportedSlackInteractiveRequestError,
|
|
70
|
-
bridgeAgentEventsToSlack,
|
|
71
|
-
resolveSlackEventBridgeOptions
|
|
72
|
-
} from "./chunk-VBGQD6JT.js";
|
|
73
41
|
export {
|
|
74
42
|
DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
|
|
75
43
|
SLACK_MCP_URL,
|
|
76
44
|
UnsupportedSlackInteractiveRequestError,
|
|
45
|
+
adaptAgentTurnSourceToSlackTurnSource,
|
|
77
46
|
bridgeAgentEventsToSlack,
|
|
78
47
|
coalesceSlackAgentEvents,
|
|
79
|
-
createSlackAgentViewWorkflowController,
|
|
80
|
-
createSlackAssistantBridge,
|
|
81
|
-
createSlackAssistantThreadContextStore,
|
|
82
|
-
createSlackChannelAdapter,
|
|
83
48
|
createSlackContextFragmentMiddleware,
|
|
84
|
-
createSlackFinalResponseArtifactPublisher,
|
|
85
49
|
createSlackInteractiveController,
|
|
86
50
|
createSlackMcpServerConfig,
|
|
87
|
-
createSlackSessionMap,
|
|
88
51
|
createSlackSubagentCompletionNotifier,
|
|
89
52
|
emptySlackAgentTurnHistoryContextResult,
|
|
90
|
-
extractSlackAgentViewStateValues,
|
|
91
53
|
formatDefaultSlackSubagentCompletionMessage,
|
|
92
54
|
immediateSlackTextResponse,
|
|
93
55
|
inspectSlackTurnStatusVisibility,
|
|
@@ -98,15 +60,9 @@ export {
|
|
|
98
60
|
isSlackTerminalTurnPhase,
|
|
99
61
|
isSlackWaitingForHumanTurnPhase,
|
|
100
62
|
loadSlackAgentTurnHistoryContext,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
mountSlackAgentAppSocket,
|
|
104
|
-
mountSlackAssistantAgent,
|
|
105
|
-
mountSlackAssistantAgentSocket,
|
|
106
|
-
parseSlackMessageActivityFromMessageEvent,
|
|
107
|
-
readSlackAgentViewStateValue,
|
|
63
|
+
mapAgentEventToSlackTurnEvent,
|
|
64
|
+
mapAgentSlackEventBridgeOptionsToRuntimeOptions,
|
|
108
65
|
recordSlackTurnActivity,
|
|
109
|
-
resolveAssistantSessionId,
|
|
110
66
|
resolveSlackEventBridgeOptions,
|
|
111
67
|
resolveSlackTurnStatusVisibilityOptions,
|
|
112
68
|
resolveSlackTypedApprovalAction,
|
|
@@ -1,11 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import '@
|
|
4
|
-
import '
|
|
5
|
-
import '@slack/bolt';
|
|
6
|
-
import '../interactive-BigrPKnu.js';
|
|
1
|
+
import { ApprovalRequest, ApprovalResolution, HumanInputRequest, HumanInputResponse, ApprovalAction, ApprovalRememberScope } from '@cuylabs/agent-core';
|
|
2
|
+
import { SlackInteractiveActionIds, SlackInteractiveRequestStore, SlackInteractiveRequestRecord, SlackInteractiveActor, SlackInteractiveHumanInputRequest as SlackInteractiveHumanInputRequest$1, SlackInteractiveMessageRef } from '@cuylabs/channel-slack/interactive';
|
|
3
|
+
import { App } from '@slack/bolt';
|
|
4
|
+
import { e as SlackInteractiveRequestContext } from '../interactive-BigrPKnu.js';
|
|
7
5
|
import '@cuylabs/channel-slack/core';
|
|
8
6
|
|
|
7
|
+
type SlackInteractiveApprovalRequest = ApprovalRequest;
|
|
8
|
+
type SlackInteractiveHumanInputRequest = SlackInteractiveHumanInputRequest$1 & Partial<Pick<HumanInputRequest, "sessionId" | "timestamp" | "toolCallId">>;
|
|
9
|
+
type SlackInteractiveResolution = {
|
|
10
|
+
kind: "approval";
|
|
11
|
+
action: ApprovalAction;
|
|
12
|
+
feedback?: string;
|
|
13
|
+
rememberScope?: ApprovalRememberScope;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "human-input";
|
|
16
|
+
response: HumanInputResponse;
|
|
17
|
+
};
|
|
18
|
+
interface SlackInteractiveRequestWaitOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Abort waiting for this request. The controller removes its local waiter and
|
|
21
|
+
* deletes the pending store record when the signal fires.
|
|
22
|
+
*/
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
/**
|
|
25
|
+
* Override the controller-level request timeout for this request. Use `0` to
|
|
26
|
+
* disable timeout cleanup for this request.
|
|
27
|
+
*/
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
}
|
|
30
|
+
interface SlackInteractiveControllerOptions {
|
|
31
|
+
store?: SlackInteractiveRequestStore;
|
|
32
|
+
/**
|
|
33
|
+
* Stable namespace for default Slack action IDs. Use this when installing
|
|
34
|
+
* multiple interactive controllers in the same Slack app.
|
|
35
|
+
*
|
|
36
|
+
* @default "agent_slack"
|
|
37
|
+
*/
|
|
38
|
+
namespace?: string;
|
|
39
|
+
actionIds?: Partial<SlackInteractiveActionIds>;
|
|
40
|
+
/**
|
|
41
|
+
* Default timeout for local waiters and pending store records. This should
|
|
42
|
+
* usually match the agent-core approval/human-input timeout.
|
|
43
|
+
*
|
|
44
|
+
* @default 300000
|
|
45
|
+
*/
|
|
46
|
+
requestTimeoutMs?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Called on every successful Slack resolution after the local waiter, if
|
|
49
|
+
* present, is resolved. Use this to fan out decisions to agent-server or
|
|
50
|
+
* another runtime that owns the turn.
|
|
51
|
+
*/
|
|
52
|
+
onResolve?: (requestId: string, resolution: SlackInteractiveResolution) => void | Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Authorization hook for approving/responding to pending requests.
|
|
55
|
+
*
|
|
56
|
+
* Defaults to the original Slack requester only. Return `true` for delegated
|
|
57
|
+
* approvers, channel owners, or admin policy checks.
|
|
58
|
+
*/
|
|
59
|
+
authorize?: (record: SlackInteractiveRequestRecord, actor: SlackInteractiveActor) => boolean | Promise<boolean>;
|
|
60
|
+
}
|
|
61
|
+
interface SlackInteractiveController {
|
|
62
|
+
readonly actionIds: SlackInteractiveActionIds;
|
|
63
|
+
readonly store: SlackInteractiveRequestStore;
|
|
64
|
+
approval: {
|
|
65
|
+
onRequest(request: ApprovalRequest, options?: SlackInteractiveRequestWaitOptions): Promise<ApprovalResolution>;
|
|
66
|
+
};
|
|
67
|
+
humanInput: {
|
|
68
|
+
onRequest(request: HumanInputRequest, options?: SlackInteractiveRequestWaitOptions): Promise<HumanInputResponse>;
|
|
69
|
+
};
|
|
70
|
+
/** Reject one pending in-process waiter and delete its pending store record. */
|
|
71
|
+
cancel(requestId: string, reason?: string): Promise<boolean>;
|
|
72
|
+
/** Shutdown helper: cancel every pending request created by this controller. */
|
|
73
|
+
cancelAll(reason?: string): Promise<void>;
|
|
74
|
+
handleInteractiveRequest(context: SlackInteractiveRequestContext): Promise<boolean>;
|
|
75
|
+
install(app: App): void;
|
|
76
|
+
}
|
|
77
|
+
type SlackInteractivePendingWaiter = {
|
|
78
|
+
resolve: (resolution: SlackInteractiveResolution) => void;
|
|
79
|
+
reject: (error: Error) => void;
|
|
80
|
+
cleanup: () => void;
|
|
81
|
+
};
|
|
82
|
+
interface SlackInteractivePostedMessage {
|
|
83
|
+
text: string;
|
|
84
|
+
blocks: unknown[];
|
|
85
|
+
ref: SlackInteractiveMessageRef;
|
|
86
|
+
}
|
|
87
|
+
|
|
9
88
|
declare function createSlackInteractiveController(options?: SlackInteractiveControllerOptions): SlackInteractiveController;
|
|
10
89
|
|
|
11
|
-
export { SlackInteractiveController, SlackInteractiveControllerOptions, createSlackInteractiveController };
|
|
90
|
+
export { type SlackInteractiveApprovalRequest, type SlackInteractiveController, type SlackInteractiveControllerOptions, type SlackInteractiveHumanInputRequest, type SlackInteractivePendingWaiter, type SlackInteractivePostedMessage, type SlackInteractiveRequestWaitOptions, type SlackInteractiveResolution, createSlackInteractiveController };
|