@cuylabs/channel-slack-agent-core 0.8.0 → 0.10.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 +4 -2
- package/dist/adapter/index.d.ts +6 -5
- package/dist/adapter/index.js +2 -2
- package/dist/{adapter-B3CI611y.d.ts → adapter-vbqtraAr.d.ts} +1 -1
- package/dist/app-surface.d.ts +6 -5
- package/dist/app-surface.js +4 -4
- package/dist/app.d.ts +6 -5
- package/dist/app.js +5 -5
- package/dist/assistant/index.d.ts +5 -4
- package/dist/assistant/index.js +2 -2
- package/dist/{chunk-YSDFYHPC.js → chunk-6EMFBOXD.js} +2 -2
- package/dist/{chunk-2R7B7NJR.js → chunk-DS6E5OEJ.js} +1 -1
- package/dist/{chunk-7YZWCSML.js → chunk-GEFK72VO.js} +1 -1
- package/dist/{chunk-FQWFB54C.js → chunk-KQPUQJ57.js} +1 -1
- package/dist/chunk-L5RAGYVJ.js +245 -0
- package/dist/chunk-OP27SSZU.js +409 -0
- package/dist/{chunk-236WN6JD.js → chunk-P2DIC42J.js} +1 -1
- package/dist/{chunk-6T6N4MRK.js → chunk-Q2GU4QLZ.js} +2 -2
- package/dist/{chunk-TCNJY7QA.js → chunk-QFDXKCAQ.js} +1 -1
- package/dist/express-assistant.d.ts +4 -3
- package/dist/express-assistant.js +3 -3
- package/dist/express.d.ts +5 -4
- package/dist/express.js +3 -3
- package/dist/history/index.d.ts +6 -5
- package/dist/index.d.ts +12 -10
- package/dist/index.js +14 -34
- package/dist/interactive/index.d.ts +5 -65
- package/dist/interactive/index.js +3 -27
- package/dist/interactive-BigrPKnu.d.ts +30 -0
- package/dist/{options-C7-VXmhD.d.ts → options-ByNm2o89.d.ts} +2 -2
- package/dist/{options-BcDReOJv.d.ts → options-CGUfVStV.d.ts} +1 -1
- package/dist/shared/index.d.ts +27 -84
- package/dist/shared/index.js +5 -1
- package/dist/socket.d.ts +6 -5
- package/dist/socket.js +5 -5
- package/dist/{types-CRWzJB5G.d.ts → types-BeGPexio.d.ts} +2 -2
- package/dist/{types-Crpil4kb.d.ts → types-Bz4OYEAV.d.ts} +6 -55
- package/docs/concepts/interactive-requests.md +7 -7
- package/docs/reference/boundary.md +5 -3
- package/docs/reference/exports.md +18 -18
- package/package.json +2 -2
- package/dist/chunk-TMADMHBN.js +0 -1008
- package/dist/chunk-X7ILLZZP.js +0 -1046
- package/dist/interactive-o_NZb-Xg.d.ts +0 -47
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
// src/interactive/controller.ts
|
|
2
|
+
import {
|
|
3
|
+
buildApprovalRequestMessage,
|
|
4
|
+
buildHumanInputModal,
|
|
5
|
+
buildHumanInputRequestMessage,
|
|
6
|
+
buildResolvedMessage,
|
|
7
|
+
createInMemorySlackInteractiveRequestStore,
|
|
8
|
+
decodeActionValue,
|
|
9
|
+
nowIso
|
|
10
|
+
} from "@cuylabs/channel-slack/interactive";
|
|
11
|
+
import { openSlackModal } from "@cuylabs/channel-slack/views";
|
|
12
|
+
var DEFAULT_NAMESPACE = "agent_slack";
|
|
13
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
14
|
+
var installedActionIds = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
function createSlackInteractiveController(options = {}) {
|
|
16
|
+
const store = options.store ?? createInMemorySlackInteractiveRequestStore();
|
|
17
|
+
const actionIds = resolveActionIds(
|
|
18
|
+
options.namespace ?? DEFAULT_NAMESPACE,
|
|
19
|
+
options.actionIds
|
|
20
|
+
);
|
|
21
|
+
const requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
22
|
+
const waiters = /* @__PURE__ */ new Map();
|
|
23
|
+
const pendingIds = /* @__PURE__ */ new Set();
|
|
24
|
+
async function ensurePending(kind, request) {
|
|
25
|
+
const existing = await store.get(request.id);
|
|
26
|
+
if (existing) {
|
|
27
|
+
pendingIds.add(request.id);
|
|
28
|
+
return existing;
|
|
29
|
+
}
|
|
30
|
+
const createdAt = nowIso();
|
|
31
|
+
const record = await store.upsert({
|
|
32
|
+
id: request.id,
|
|
33
|
+
kind,
|
|
34
|
+
request,
|
|
35
|
+
status: "pending",
|
|
36
|
+
createdAt,
|
|
37
|
+
updatedAt: createdAt
|
|
38
|
+
});
|
|
39
|
+
pendingIds.add(request.id);
|
|
40
|
+
return record;
|
|
41
|
+
}
|
|
42
|
+
async function waitForResolution(kind, request, waitOptions = {}) {
|
|
43
|
+
const existing = await ensurePending(kind, request);
|
|
44
|
+
if (existing.status === "resolved" && existing.resolution) {
|
|
45
|
+
return toAgentCoreResolution(existing.resolution);
|
|
46
|
+
}
|
|
47
|
+
if (waiters.has(request.id)) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Slack interactive request is already waiting: ${request.id}. Resolve or cancel the in-flight request before requesting again.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return await new Promise((resolve, reject) => {
|
|
53
|
+
const cleanupCallbacks = [];
|
|
54
|
+
const timeoutMs = waitOptions.timeoutMs ?? requestTimeoutMs;
|
|
55
|
+
if (timeoutMs > 0) {
|
|
56
|
+
const timeoutId = setTimeout(() => {
|
|
57
|
+
void cancel(request.id, "Slack interactive request timed out.");
|
|
58
|
+
}, timeoutMs);
|
|
59
|
+
cleanupCallbacks.push(() => clearTimeout(timeoutId));
|
|
60
|
+
}
|
|
61
|
+
let abortImmediately = false;
|
|
62
|
+
if (waitOptions.signal) {
|
|
63
|
+
const onAbort = () => {
|
|
64
|
+
void cancel(request.id, "Slack interactive request aborted.");
|
|
65
|
+
};
|
|
66
|
+
if (waitOptions.signal.aborted) {
|
|
67
|
+
abortImmediately = true;
|
|
68
|
+
} else {
|
|
69
|
+
waitOptions.signal.addEventListener("abort", onAbort, {
|
|
70
|
+
once: true
|
|
71
|
+
});
|
|
72
|
+
cleanupCallbacks.push(
|
|
73
|
+
() => waitOptions.signal?.removeEventListener("abort", onAbort)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
waiters.set(request.id, {
|
|
78
|
+
resolve,
|
|
79
|
+
reject,
|
|
80
|
+
cleanup: () => {
|
|
81
|
+
for (const cleanup of cleanupCallbacks.splice(0)) {
|
|
82
|
+
cleanup();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
if (abortImmediately) {
|
|
87
|
+
void cancel(request.id, "Slack interactive request aborted.");
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async function resolveRequest(requestId, resolution) {
|
|
92
|
+
const record = await store.resolve(requestId, resolution);
|
|
93
|
+
const waiter = waiters.get(requestId);
|
|
94
|
+
if (waiter) {
|
|
95
|
+
waiters.delete(requestId);
|
|
96
|
+
waiter.cleanup();
|
|
97
|
+
waiter.resolve(resolution);
|
|
98
|
+
}
|
|
99
|
+
if (record) {
|
|
100
|
+
pendingIds.delete(requestId);
|
|
101
|
+
await options.onResolve?.(requestId, resolution);
|
|
102
|
+
}
|
|
103
|
+
return record;
|
|
104
|
+
}
|
|
105
|
+
async function cancel(requestId, reason = "Cancelled") {
|
|
106
|
+
const waiter = waiters.get(requestId);
|
|
107
|
+
if (waiter) {
|
|
108
|
+
waiters.delete(requestId);
|
|
109
|
+
waiter.cleanup();
|
|
110
|
+
waiter.reject(new Error(reason));
|
|
111
|
+
}
|
|
112
|
+
const existing = await store.get(requestId);
|
|
113
|
+
if (existing?.status === "pending") {
|
|
114
|
+
await store.delete(requestId);
|
|
115
|
+
pendingIds.delete(requestId);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
pendingIds.delete(requestId);
|
|
119
|
+
return Boolean(waiter);
|
|
120
|
+
}
|
|
121
|
+
async function cancelAll(reason = "Cancelled") {
|
|
122
|
+
await Promise.all(
|
|
123
|
+
[...pendingIds].map((requestId) => cancel(requestId, reason))
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
async function handleInteractiveRequest(context) {
|
|
127
|
+
const request = context.request;
|
|
128
|
+
const record = await ensurePending(context.kind, request);
|
|
129
|
+
if (record.target) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
const message = context.kind === "approval" ? buildApprovalRequestMessage(
|
|
133
|
+
request,
|
|
134
|
+
actionIds
|
|
135
|
+
) : buildHumanInputRequestMessage(
|
|
136
|
+
request,
|
|
137
|
+
actionIds
|
|
138
|
+
);
|
|
139
|
+
const ref = await context.responder.postMessage(message);
|
|
140
|
+
await store.attachTarget(request.id, {
|
|
141
|
+
channel: ref.channel,
|
|
142
|
+
ts: ref.ts,
|
|
143
|
+
userId: context.user.userId,
|
|
144
|
+
teamId: context.user.teamId,
|
|
145
|
+
...context.slackActivity.threadTs ? { threadTs: context.slackActivity.threadTs } : {}
|
|
146
|
+
});
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
function install(app) {
|
|
150
|
+
assertActionIdsCanInstall(app, actionIds);
|
|
151
|
+
app.action(actionIds.approvalAllow, async (args) => {
|
|
152
|
+
await handleAction(args, {
|
|
153
|
+
kind: "approval",
|
|
154
|
+
action: "allow"
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
app.action(actionIds.approvalDeny, async (args) => {
|
|
158
|
+
await handleAction(args, {
|
|
159
|
+
kind: "approval",
|
|
160
|
+
action: "deny"
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
app.action(actionIds.approvalRemember, async (args) => {
|
|
164
|
+
const value = firstActionValue(args);
|
|
165
|
+
const rememberScope = typeof value.rememberScope === "string" ? value.rememberScope : void 0;
|
|
166
|
+
await handleAction(args, {
|
|
167
|
+
kind: "approval",
|
|
168
|
+
action: "remember",
|
|
169
|
+
...rememberScope ? { rememberScope } : {}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
app.action(actionIds.humanConfirm, async (args) => {
|
|
173
|
+
await handleAction(args, {
|
|
174
|
+
kind: "human-input",
|
|
175
|
+
response: { kind: "confirm", confirmed: true, text: "Confirmed" }
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
app.action(actionIds.humanDeny, async (args) => {
|
|
179
|
+
await handleAction(args, {
|
|
180
|
+
kind: "human-input",
|
|
181
|
+
response: { kind: "confirm", confirmed: false, text: "Cancelled" }
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
app.action(actionIds.humanOpen, async (args) => {
|
|
185
|
+
await openHumanInputModal(args);
|
|
186
|
+
});
|
|
187
|
+
app.view(actionIds.humanSubmit, async (args) => {
|
|
188
|
+
await submitHumanInputModal(args);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
async function handleAction(args, resolutionInput) {
|
|
192
|
+
const actionArgs = args;
|
|
193
|
+
await actionArgs.ack();
|
|
194
|
+
const requestId = extractRequestId(firstActionValue(args));
|
|
195
|
+
if (!requestId) return;
|
|
196
|
+
const record = await store.get(requestId);
|
|
197
|
+
if (!record || record.status === "resolved") {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const actor = extractActor(actionArgs.body);
|
|
201
|
+
if (!await isAuthorized(record, actor)) {
|
|
202
|
+
await postEphemeral(
|
|
203
|
+
actionArgs,
|
|
204
|
+
"Only the original requester can resolve this request."
|
|
205
|
+
);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const resolution = resolutionInput;
|
|
209
|
+
const resolved = await resolveRequest(requestId, resolution);
|
|
210
|
+
if (resolved?.target) {
|
|
211
|
+
await updateOriginalMessage(actionArgs, resolved, resolution);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async function openHumanInputModal(args) {
|
|
215
|
+
const actionArgs = args;
|
|
216
|
+
await actionArgs.ack();
|
|
217
|
+
const requestId = extractRequestId(firstActionValue(args));
|
|
218
|
+
if (!requestId || !actionArgs.body.trigger_id) return;
|
|
219
|
+
const record = await store.get(requestId);
|
|
220
|
+
if (!record || record.kind !== "human-input") return;
|
|
221
|
+
const actor = extractActor(actionArgs.body);
|
|
222
|
+
if (!await isAuthorized(record, actor)) {
|
|
223
|
+
await postEphemeral(
|
|
224
|
+
actionArgs,
|
|
225
|
+
"Only the original requester can answer this request."
|
|
226
|
+
);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
await openSlackModal({
|
|
230
|
+
client: actionArgs.client,
|
|
231
|
+
triggerId: actionArgs.body.trigger_id,
|
|
232
|
+
view: buildHumanInputModal(
|
|
233
|
+
record.request,
|
|
234
|
+
actionIds
|
|
235
|
+
)
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
async function submitHumanInputModal(args) {
|
|
239
|
+
const viewArgs = args;
|
|
240
|
+
await viewArgs.ack();
|
|
241
|
+
const requestId = extractRequestIdFromView(viewArgs.view);
|
|
242
|
+
if (!requestId) return;
|
|
243
|
+
const record = await store.get(requestId);
|
|
244
|
+
if (!record || record.kind !== "human-input" || record.status === "resolved") {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const actor = extractActor(viewArgs.body);
|
|
248
|
+
if (!await isAuthorized(record, actor)) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const response = responseFromView(
|
|
252
|
+
record.request,
|
|
253
|
+
viewArgs.view
|
|
254
|
+
);
|
|
255
|
+
const resolution = {
|
|
256
|
+
kind: "human-input",
|
|
257
|
+
response
|
|
258
|
+
};
|
|
259
|
+
const resolved = await resolveRequest(requestId, resolution);
|
|
260
|
+
if (resolved?.target) {
|
|
261
|
+
await viewArgs.client.chat.update({
|
|
262
|
+
channel: resolved.target.channel,
|
|
263
|
+
ts: resolved.target.ts,
|
|
264
|
+
...buildResolvedMessage("Slack response received.", resolution)
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
async function isAuthorized(record, actor) {
|
|
269
|
+
if (options.authorize) {
|
|
270
|
+
return await options.authorize(record, actor);
|
|
271
|
+
}
|
|
272
|
+
return record.target?.userId === actor.userId;
|
|
273
|
+
}
|
|
274
|
+
async function updateOriginalMessage(args, record, resolution) {
|
|
275
|
+
const target = record.target;
|
|
276
|
+
if (!target) return;
|
|
277
|
+
const label = resolution.kind === "approval" ? `${resolution.action} selected.` : resolution.response.text;
|
|
278
|
+
await args.client.chat.update({
|
|
279
|
+
channel: target.channel,
|
|
280
|
+
ts: target.ts,
|
|
281
|
+
...buildResolvedMessage(label, resolution)
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
actionIds,
|
|
286
|
+
store,
|
|
287
|
+
approval: {
|
|
288
|
+
async onRequest(request, options2) {
|
|
289
|
+
const resolution = await waitForResolution(
|
|
290
|
+
"approval",
|
|
291
|
+
request,
|
|
292
|
+
options2
|
|
293
|
+
);
|
|
294
|
+
if (resolution.kind !== "approval") {
|
|
295
|
+
throw new Error(
|
|
296
|
+
`Unexpected human-input resolution for ${request.id}.`
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
action: resolution.action,
|
|
301
|
+
...resolution.feedback ? { feedback: resolution.feedback } : {},
|
|
302
|
+
...resolution.rememberScope ? { rememberScope: resolution.rememberScope } : {}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
humanInput: {
|
|
307
|
+
async onRequest(request, options2) {
|
|
308
|
+
const resolution = await waitForResolution(
|
|
309
|
+
"human-input",
|
|
310
|
+
request,
|
|
311
|
+
options2
|
|
312
|
+
);
|
|
313
|
+
if (resolution.kind !== "human-input") {
|
|
314
|
+
throw new Error(`Unexpected approval resolution for ${request.id}.`);
|
|
315
|
+
}
|
|
316
|
+
return resolution.response;
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
cancel,
|
|
320
|
+
cancelAll,
|
|
321
|
+
handleInteractiveRequest,
|
|
322
|
+
install
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function toAgentCoreResolution(resolution) {
|
|
326
|
+
return resolution;
|
|
327
|
+
}
|
|
328
|
+
function resolveActionIds(namespace, overrides) {
|
|
329
|
+
const prefix = normalizeActionIdNamespace(namespace);
|
|
330
|
+
return {
|
|
331
|
+
approvalAllow: `${prefix}_approval_allow`,
|
|
332
|
+
approvalDeny: `${prefix}_approval_deny`,
|
|
333
|
+
approvalRemember: `${prefix}_approval_remember`,
|
|
334
|
+
humanConfirm: `${prefix}_human_confirm`,
|
|
335
|
+
humanDeny: `${prefix}_human_deny`,
|
|
336
|
+
humanOpen: `${prefix}_human_open`,
|
|
337
|
+
humanSubmit: `${prefix}_human_submit`,
|
|
338
|
+
...overrides ?? {}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function normalizeActionIdNamespace(namespace) {
|
|
342
|
+
const trimmed = namespace.trim();
|
|
343
|
+
if (!trimmed) {
|
|
344
|
+
throw new Error("Slack interactive action namespace cannot be empty.");
|
|
345
|
+
}
|
|
346
|
+
return trimmed;
|
|
347
|
+
}
|
|
348
|
+
function assertActionIdsCanInstall(app, actionIds) {
|
|
349
|
+
const ids = Object.values(actionIds);
|
|
350
|
+
const duplicateWithinController = ids.find(
|
|
351
|
+
(id, index) => ids.indexOf(id) !== index
|
|
352
|
+
);
|
|
353
|
+
if (duplicateWithinController) {
|
|
354
|
+
throw new Error(
|
|
355
|
+
`Duplicate Slack interactive action id configured: ${duplicateWithinController}`
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
const appKey = app;
|
|
359
|
+
const installed = installedActionIds.get(appKey) ?? /* @__PURE__ */ new Set();
|
|
360
|
+
const duplicate = ids.find((id) => installed.has(id));
|
|
361
|
+
if (duplicate) {
|
|
362
|
+
throw new Error(
|
|
363
|
+
`Slack interactive action id '${duplicate}' is already installed on this Bolt app. Provide a unique createSlackInteractiveController({ namespace }) or actionIds config.`
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
for (const id of ids) {
|
|
367
|
+
installed.add(id);
|
|
368
|
+
}
|
|
369
|
+
installedActionIds.set(appKey, installed);
|
|
370
|
+
}
|
|
371
|
+
function firstActionValue(args) {
|
|
372
|
+
const body = args.body;
|
|
373
|
+
return decodeActionValue(body.actions?.[0]?.value);
|
|
374
|
+
}
|
|
375
|
+
function extractRequestId(value) {
|
|
376
|
+
return typeof value.requestId === "string" && value.requestId.length > 0 ? value.requestId : void 0;
|
|
377
|
+
}
|
|
378
|
+
function extractRequestIdFromView(view) {
|
|
379
|
+
return extractRequestId(decodeActionValue(view.private_metadata));
|
|
380
|
+
}
|
|
381
|
+
function extractActor(body) {
|
|
382
|
+
return {
|
|
383
|
+
userId: body.user?.id ?? "unknown",
|
|
384
|
+
...body.user?.team_id ?? body.team?.id ? { teamId: body.user?.team_id ?? body.team?.id } : {}
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
async function postEphemeral(args, text) {
|
|
388
|
+
const channel = args.body.channel?.id;
|
|
389
|
+
const user = args.body.user?.id;
|
|
390
|
+
if (!channel || !user || !args.client.chat.postEphemeral) return;
|
|
391
|
+
await args.client.chat.postEphemeral({ channel, user, text });
|
|
392
|
+
}
|
|
393
|
+
function responseFromView(request, view) {
|
|
394
|
+
const input = view.state?.values?.input?.value;
|
|
395
|
+
if (request.kind === "choice") {
|
|
396
|
+
const selected = input?.selected_options?.map((option) => option.value ?? "").filter(Boolean) ?? (input?.selected_option?.value ? [input.selected_option.value] : []);
|
|
397
|
+
return {
|
|
398
|
+
kind: "choice",
|
|
399
|
+
selected,
|
|
400
|
+
text: selected.join(", ")
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
const text = input?.value ?? "";
|
|
404
|
+
return { kind: "text", text };
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export {
|
|
408
|
+
createSlackInteractiveController
|
|
409
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSlackAssistantBridge
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GEFK72VO.js";
|
|
4
4
|
import {
|
|
5
5
|
createSlackFeedbackBlock
|
|
6
6
|
} from "./chunk-ELR6MQD7.js";
|
|
7
7
|
import {
|
|
8
8
|
createSlackChannelAdapter
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KQPUQJ57.js";
|
|
10
10
|
|
|
11
11
|
// src/app-surface.ts
|
|
12
12
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
@@ -3,13 +3,14 @@ import { Application } from 'express';
|
|
|
3
3
|
import { App, ExpressReceiver } from '@slack/bolt';
|
|
4
4
|
import { CreateSlackBoltAppOptions } from '@cuylabs/channel-slack/transports/http';
|
|
5
5
|
import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
|
|
6
|
-
import { C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-
|
|
6
|
+
import { C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-ByNm2o89.js';
|
|
7
7
|
import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
|
|
8
8
|
import '@cuylabs/agent-core';
|
|
9
9
|
import '@slack/web-api';
|
|
10
10
|
import '@cuylabs/channel-slack/core';
|
|
11
|
-
import './interactive-
|
|
12
|
-
import '
|
|
11
|
+
import './interactive-BigrPKnu.js';
|
|
12
|
+
import '@cuylabs/channel-slack/interactive';
|
|
13
|
+
import './options-CGUfVStV.js';
|
|
13
14
|
import './artifacts/index.js';
|
|
14
15
|
import '@cuylabs/channel-slack/artifacts';
|
|
15
16
|
import '@cuylabs/channel-slack/assistant';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mountSlackAssistantAgent
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-DS6E5OEJ.js";
|
|
4
|
+
import "./chunk-GEFK72VO.js";
|
|
5
5
|
import "./chunk-ELR6MQD7.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-L5RAGYVJ.js";
|
|
7
7
|
export {
|
|
8
8
|
mountSlackAssistantAgent
|
|
9
9
|
};
|
package/dist/express.d.ts
CHANGED
|
@@ -2,15 +2,16 @@ import * as _slack_bolt from '@slack/bolt';
|
|
|
2
2
|
import { Server } from 'node:http';
|
|
3
3
|
import { AgentTurnSource } from '@cuylabs/agent-core';
|
|
4
4
|
import { Application } from 'express';
|
|
5
|
-
import { c as createSlackChannelAdapter } from './adapter-
|
|
6
|
-
import { a as SlackChannelOptions } from './types-
|
|
5
|
+
import { c as createSlackChannelAdapter } from './adapter-vbqtraAr.js';
|
|
6
|
+
import { a as SlackChannelOptions } from './types-BeGPexio.js';
|
|
7
7
|
import { CreateSlackBoltAppOptions } from '@cuylabs/channel-slack/transports/http';
|
|
8
8
|
import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
|
|
9
9
|
import '@cuylabs/channel-slack/core';
|
|
10
|
-
import './options-
|
|
10
|
+
import './options-CGUfVStV.js';
|
|
11
11
|
import './artifacts/index.js';
|
|
12
12
|
import '@cuylabs/channel-slack/artifacts';
|
|
13
|
-
import './interactive-
|
|
13
|
+
import './interactive-BigrPKnu.js';
|
|
14
|
+
import '@cuylabs/channel-slack/interactive';
|
|
14
15
|
|
|
15
16
|
interface MountSlackAgentOptions extends Omit<SlackChannelOptions, "agent" | "source">, Omit<CreateSlackBoltAppOptions, "app" | "path" | "botToken" | "signingSecret" | "auth"> {
|
|
16
17
|
/**
|
package/dist/express.js
CHANGED
package/dist/history/index.d.ts
CHANGED
|
@@ -4,16 +4,17 @@ import { MountSlackAgentAppTurnRequestContext } from '../app-surface.js';
|
|
|
4
4
|
import { a as SlackContextFragmentPayload } from '../context-fragments-CQEDcjYR.js';
|
|
5
5
|
import '@slack/bolt';
|
|
6
6
|
import '@slack/web-api';
|
|
7
|
-
import '../options-
|
|
7
|
+
import '../options-ByNm2o89.js';
|
|
8
8
|
import '@cuylabs/channel-slack/core';
|
|
9
|
-
import '../interactive-
|
|
10
|
-
import '
|
|
9
|
+
import '../interactive-BigrPKnu.js';
|
|
10
|
+
import '@cuylabs/channel-slack/interactive';
|
|
11
|
+
import '../options-CGUfVStV.js';
|
|
11
12
|
import '../artifacts/index.js';
|
|
12
13
|
import '@cuylabs/channel-slack/artifacts';
|
|
13
14
|
import '@cuylabs/channel-slack/feedback';
|
|
14
15
|
import '@cuylabs/channel-slack/assistant';
|
|
15
|
-
import '../types-
|
|
16
|
-
import '../types-
|
|
16
|
+
import '../types-BeGPexio.js';
|
|
17
|
+
import '../types-Bz4OYEAV.js';
|
|
17
18
|
import '../types-CiwGU6zC.js';
|
|
18
19
|
import '@cuylabs/channel-slack/views';
|
|
19
20
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +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 {
|
|
3
|
-
export { S as SlackEventBridgeOptions, r as resolveSlackEventBridgeOptions } from './options-
|
|
4
|
-
export { S as SlackApprovalRequest, a as SlackEventInteractiveRequestHandler, b as SlackHumanInputRequest, c as
|
|
5
|
-
export { c as createSlackChannelAdapter } from './adapter-
|
|
6
|
-
export { S as SlackChannelAdapter, a as SlackChannelOptions, b as SlackSessionStrategy, c as SlackStreamingMode, d as SlackToolStartEvent } from './types-
|
|
2
|
+
export { UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack, mapAgentEventToSlackTurnEvent, mapAgentSlackEventBridgeOptionsToRuntimeOptions } from './shared/index.js';
|
|
3
|
+
export { S as SlackEventBridgeOptions, r as resolveSlackEventBridgeOptions } from './options-CGUfVStV.js';
|
|
4
|
+
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
7
|
export { SlackSessionMap, createSlackSessionMap } from './adapter/index.js';
|
|
8
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-
|
|
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
10
|
export { ParsedAssistantUserMessage, createSlackAssistantThreadContextStore, parseSlackMessageActivityFromMessageEvent } from '@cuylabs/channel-slack/assistant';
|
|
11
11
|
export { CreateSlackFinalResponseArtifactPublisherOptions, SlackFinalResponseArtifactContext, SlackFinalResponseArtifactDeliveryMode, SlackFinalResponseArtifactPublisher, SlackFinalResponseArtifactResult, SlackFinalResponseArtifactValueResolver, createSlackFinalResponseArtifactPublisher } from './artifacts/index.js';
|
|
12
12
|
export { LoadSlackAgentTurnHistoryContextOptions, SlackAgentTurnHistoryContextResult, SlackAgentTurnHistoryOptions, SlackAgentTurnHistoryProfileResolver, emptySlackAgentTurnHistoryContextResult, loadSlackAgentTurnHistoryContext } from './history/index.js';
|
|
13
|
-
export { S as
|
|
14
|
-
export {
|
|
13
|
+
export { S as SlackInteractiveApprovalRequest, a as SlackInteractiveController, b as SlackInteractiveControllerOptions, c as SlackInteractiveHumanInputRequest, d as SlackInteractivePendingWaiter, e as SlackInteractivePostedMessage, f as SlackInteractiveRequestWaitOptions, g as SlackInteractiveResolution } from './types-Bz4OYEAV.js';
|
|
14
|
+
export { createSlackInteractiveController } from './interactive/index.js';
|
|
15
15
|
export { createSlackAgentViewWorkflowController } from './views/index.js';
|
|
16
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';
|
|
17
17
|
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';
|
|
@@ -23,12 +23,14 @@ export { CreateSlackMcpServerConfigOptions, SLACK_MCP_URL, createSlackMcpServerC
|
|
|
23
23
|
export { MountSlackAgentAppTurnRequestContext } from './app-surface.js';
|
|
24
24
|
import '@cuylabs/agent-core';
|
|
25
25
|
import '@cuylabs/channel-slack/core';
|
|
26
|
-
import '@cuylabs/channel-slack/
|
|
26
|
+
import '@cuylabs/channel-slack/responses';
|
|
27
|
+
import '@cuylabs/channel-slack/runtime';
|
|
28
|
+
import '@cuylabs/channel-slack/interactive';
|
|
27
29
|
import '@slack/bolt';
|
|
28
30
|
import '@slack/web-api';
|
|
29
31
|
import '@cuylabs/channel-slack/feedback';
|
|
32
|
+
import '@cuylabs/channel-slack/artifacts';
|
|
30
33
|
import '@cuylabs/channel-slack/history';
|
|
31
|
-
import '@slack/types';
|
|
32
34
|
import '@cuylabs/channel-slack/views';
|
|
33
35
|
import '@cuylabs/agent-core/dispatch';
|
|
34
36
|
import 'node:http';
|