@cuylabs/channel-slack-agent-core 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +4 -2
  2. package/dist/adapter/index.d.ts +6 -5
  3. package/dist/adapter/index.js +2 -2
  4. package/dist/{adapter-B3CI611y.d.ts → adapter-vbqtraAr.d.ts} +1 -1
  5. package/dist/app-surface.d.ts +6 -5
  6. package/dist/app-surface.js +4 -4
  7. package/dist/app.d.ts +6 -5
  8. package/dist/app.js +5 -5
  9. package/dist/assistant/index.d.ts +5 -4
  10. package/dist/assistant/index.js +2 -2
  11. package/dist/{chunk-TCNJY7QA.js → chunk-D4CSEAIF.js} +1 -1
  12. package/dist/{chunk-MGBNGG4D.js → chunk-FJP6ZFUB.js} +241 -4
  13. package/dist/{chunk-7DUO5BMW.js → chunk-GKZRDNEB.js} +4 -25
  14. package/dist/{chunk-VMVQIDNR.js → chunk-HHXAXSG6.js} +2 -2
  15. package/dist/{chunk-DJPKRKGP.js → chunk-JU5R6JZG.js} +1 -1
  16. package/dist/{chunk-76SRS54H.js → chunk-KAEZPS3U.js} +1 -1
  17. package/dist/chunk-OP27SSZU.js +409 -0
  18. package/dist/{chunk-FQWFB54C.js → chunk-XA7U3GRN.js} +1 -1
  19. package/dist/express-assistant.d.ts +4 -3
  20. package/dist/express-assistant.js +3 -3
  21. package/dist/express.d.ts +5 -4
  22. package/dist/express.js +3 -3
  23. package/dist/history/index.d.ts +6 -5
  24. package/dist/index.d.ts +11 -10
  25. package/dist/index.js +10 -34
  26. package/dist/interactive/index.d.ts +5 -65
  27. package/dist/interactive/index.js +3 -27
  28. package/dist/interactive-BigrPKnu.d.ts +30 -0
  29. package/dist/{options-CdqBABcM.d.ts → options-ByNm2o89.d.ts} +38 -3
  30. package/dist/{options-BcDReOJv.d.ts → options-CGUfVStV.d.ts} +1 -1
  31. package/dist/shared/index.d.ts +7 -76
  32. package/dist/shared/index.js +1 -1
  33. package/dist/socket.d.ts +6 -5
  34. package/dist/socket.js +5 -5
  35. package/dist/{types-CRWzJB5G.d.ts → types-BeGPexio.d.ts} +2 -2
  36. package/dist/{types-Crpil4kb.d.ts → types-Bz4OYEAV.d.ts} +6 -55
  37. package/docs/concepts/interactive-requests.md +7 -7
  38. package/docs/reference/boundary.md +5 -3
  39. package/docs/reference/exports.md +18 -18
  40. package/package.json +2 -2
  41. package/dist/chunk-X7ILLZZP.js +0 -1046
  42. package/dist/interactive-o_NZb-Xg.d.ts +0 -47
  43. /package/dist/{chunk-TMADMHBN.js → chunk-VBGQD6JT.js} +0 -0
@@ -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
+ };
@@ -2,7 +2,7 @@ import {
2
2
  UnsupportedSlackInteractiveRequestError,
3
3
  bridgeAgentEventsToSlack,
4
4
  resolveSlackEventBridgeOptions
5
- } from "./chunk-TMADMHBN.js";
5
+ } from "./chunk-VBGQD6JT.js";
6
6
 
7
7
  // src/adapter/adapter.ts
8
8
  import { withinScope } from "@cuylabs/agent-core";
@@ -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, b as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-CdqBABcM.js';
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-o_NZb-Xg.js';
12
- import './options-BcDReOJv.js';
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-DJPKRKGP.js";
4
- import "./chunk-MGBNGG4D.js";
3
+ } from "./chunk-JU5R6JZG.js";
4
+ import "./chunk-FJP6ZFUB.js";
5
5
  import "./chunk-ELR6MQD7.js";
6
- import "./chunk-TMADMHBN.js";
6
+ import "./chunk-VBGQD6JT.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-B3CI611y.js';
6
- import { a as SlackChannelOptions } from './types-CRWzJB5G.js';
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-BcDReOJv.js';
10
+ import './options-CGUfVStV.js';
11
11
  import './artifacts/index.js';
12
12
  import '@cuylabs/channel-slack/artifacts';
13
- import './interactive-o_NZb-Xg.js';
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
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  mountSlackAgent
3
- } from "./chunk-TCNJY7QA.js";
4
- import "./chunk-FQWFB54C.js";
5
- import "./chunk-TMADMHBN.js";
3
+ } from "./chunk-D4CSEAIF.js";
4
+ import "./chunk-XA7U3GRN.js";
5
+ import "./chunk-VBGQD6JT.js";
6
6
  export {
7
7
  mountSlackAgent
8
8
  };
@@ -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-CdqBABcM.js';
7
+ import '../options-ByNm2o89.js';
8
8
  import '@cuylabs/channel-slack/core';
9
- import '../interactive-o_NZb-Xg.js';
10
- import '../options-BcDReOJv.js';
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-CRWzJB5G.js';
16
- import '../types-Crpil4kb.js';
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 { SlackArtifactPublicationTarget, SlackChatStream, SlackResponseSink, SlackStreamChunk, SlackStreamTaskStatus, UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack } from './shared/index.js';
3
- export { S as SlackEventBridgeOptions, r as resolveSlackEventBridgeOptions } from './options-BcDReOJv.js';
4
- export { S as SlackApprovalRequest, a as SlackEventInteractiveRequestHandler, b as SlackHumanInputRequest, c as SlackInteractiveMessage, d as SlackInteractiveMessageRef, e as SlackInteractiveRequest, f as SlackInteractiveRequestBaseContext, g as SlackInteractiveRequestContext, h as SlackInteractiveRequestHandler, i as SlackInteractiveRequestKind, j as SlackInteractiveResponder } from './interactive-o_NZb-Xg.js';
5
- export { c as createSlackChannelAdapter } from './adapter-B3CI611y.js';
6
- export { S as SlackChannelAdapter, a as SlackChannelOptions, b as SlackSessionStrategy, c as SlackStreamingMode, d as SlackToolStartEvent } from './types-CRWzJB5G.js';
2
+ export { UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack } 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 SlackAssistantFeedbackConfig, c as SlackAssistantSessionStrategy, d as SlackAssistantStatusContext, e as SlackAssistantThreadContextStoreLike, f as SlackAssistantThreadStartedContext, g as SlackAssistantTurnPreparation, h as SlackAssistantUserMessageContext, r as resolveAssistantSessionId } from './options-CdqBABcM.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
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 SlackInteractiveActionIds, a as SlackInteractiveActor, b as SlackInteractiveApprovalRequest, c as SlackInteractiveController, d as SlackInteractiveControllerOptions, e as SlackInteractiveHumanInputRequest, f as SlackInteractiveMessageTarget, g as SlackInteractivePendingWaiter, h as SlackInteractivePostedMessage, i as SlackInteractiveRequestRecord, j as SlackInteractiveRequestStatus, k as SlackInteractiveRequestStore, l as SlackInteractiveRequestWaitOptions, m as SlackInteractiveResolution, n as SlackInteractiveStoredRequest } from './types-Crpil4kb.js';
14
- export { PostgresSlackInteractiveRequestPruneResult, PostgresSlackInteractiveRequestStore, PostgresSlackInteractiveRequestStoreOptions, SlackInteractivePostgresClient, buildApprovalRequestMessage, buildHumanInputModal, buildHumanInputRequestMessage, buildResolvedMessage, cloneRecord, createInMemorySlackInteractiveRequestStore, createPostgresSlackInteractiveRequestStore, createSlackInteractiveController, decodeActionValue, encodeActionValue, initializePostgresSlackInteractiveRequestStore, nowIso, prunePostgresSlackInteractiveRequestStore } from './interactive/index.js';
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,13 @@ 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/artifacts';
26
+ import '@cuylabs/channel-slack/responses';
27
+ import '@cuylabs/channel-slack/interactive';
27
28
  import '@slack/bolt';
28
29
  import '@slack/web-api';
29
30
  import '@cuylabs/channel-slack/feedback';
31
+ import '@cuylabs/channel-slack/artifacts';
30
32
  import '@cuylabs/channel-slack/history';
31
- import '@slack/types';
32
33
  import '@cuylabs/channel-slack/views';
33
34
  import '@cuylabs/agent-core/dispatch';
34
35
  import 'node:http';
package/dist/index.js CHANGED
@@ -6,20 +6,8 @@ import {
6
6
  loadSlackAgentTurnHistoryContext
7
7
  } from "./chunk-P7PFQ3SQ.js";
8
8
  import {
9
- buildApprovalRequestMessage,
10
- buildHumanInputModal,
11
- buildHumanInputRequestMessage,
12
- buildResolvedMessage,
13
- cloneRecord,
14
- createInMemorySlackInteractiveRequestStore,
15
- createPostgresSlackInteractiveRequestStore,
16
- createSlackInteractiveController,
17
- decodeActionValue,
18
- encodeActionValue,
19
- initializePostgresSlackInteractiveRequestStore,
20
- nowIso,
21
- prunePostgresSlackInteractiveRequestStore
22
- } from "./chunk-X7ILLZZP.js";
9
+ createSlackInteractiveController
10
+ } from "./chunk-OP27SSZU.js";
23
11
  import {
24
12
  DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
25
13
  createSlackContextFragmentMiddleware
@@ -50,13 +38,13 @@ import {
50
38
  } from "./chunk-C7CHMYV6.js";
51
39
  import {
52
40
  mountSlackAgentApp
53
- } from "./chunk-76SRS54H.js";
41
+ } from "./chunk-KAEZPS3U.js";
54
42
  import {
55
43
  mountSlackAssistantAgent
56
- } from "./chunk-DJPKRKGP.js";
44
+ } from "./chunk-JU5R6JZG.js";
57
45
  import {
58
46
  mountSlackAgent
59
- } from "./chunk-TCNJY7QA.js";
47
+ } from "./chunk-D4CSEAIF.js";
60
48
  import {
61
49
  SLACK_MCP_URL,
62
50
  createSlackMcpServerConfig
@@ -64,37 +52,30 @@ import {
64
52
  import {
65
53
  mountSlackAgentAppSocket,
66
54
  mountSlackAssistantAgentSocket
67
- } from "./chunk-VMVQIDNR.js";
68
- import "./chunk-7DUO5BMW.js";
55
+ } from "./chunk-HHXAXSG6.js";
56
+ import "./chunk-GKZRDNEB.js";
69
57
  import {
70
58
  createSlackAssistantBridge,
71
59
  createSlackAssistantThreadContextStore,
72
60
  parseSlackMessageActivityFromMessageEvent,
73
61
  resolveAssistantSessionId
74
- } from "./chunk-MGBNGG4D.js";
62
+ } from "./chunk-FJP6ZFUB.js";
75
63
  import "./chunk-ELR6MQD7.js";
76
64
  import {
77
65
  createSlackChannelAdapter,
78
66
  createSlackSessionMap
79
- } from "./chunk-FQWFB54C.js";
67
+ } from "./chunk-XA7U3GRN.js";
80
68
  import {
81
69
  UnsupportedSlackInteractiveRequestError,
82
70
  bridgeAgentEventsToSlack,
83
71
  resolveSlackEventBridgeOptions
84
- } from "./chunk-TMADMHBN.js";
72
+ } from "./chunk-VBGQD6JT.js";
85
73
  export {
86
74
  DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
87
75
  SLACK_MCP_URL,
88
76
  UnsupportedSlackInteractiveRequestError,
89
77
  bridgeAgentEventsToSlack,
90
- buildApprovalRequestMessage,
91
- buildHumanInputModal,
92
- buildHumanInputRequestMessage,
93
- buildResolvedMessage,
94
- cloneRecord,
95
78
  coalesceSlackAgentEvents,
96
- createInMemorySlackInteractiveRequestStore,
97
- createPostgresSlackInteractiveRequestStore,
98
79
  createSlackAgentViewWorkflowController,
99
80
  createSlackAssistantBridge,
100
81
  createSlackAssistantThreadContextStore,
@@ -105,13 +86,10 @@ export {
105
86
  createSlackMcpServerConfig,
106
87
  createSlackSessionMap,
107
88
  createSlackSubagentCompletionNotifier,
108
- decodeActionValue,
109
89
  emptySlackAgentTurnHistoryContextResult,
110
- encodeActionValue,
111
90
  extractSlackAgentViewStateValues,
112
91
  formatDefaultSlackSubagentCompletionMessage,
113
92
  immediateSlackTextResponse,
114
- initializePostgresSlackInteractiveRequestStore,
115
93
  inspectSlackTurnStatusVisibility,
116
94
  isAbortLikeError,
117
95
  isRunningAgentTurnError,
@@ -125,9 +103,7 @@ export {
125
103
  mountSlackAgentAppSocket,
126
104
  mountSlackAssistantAgent,
127
105
  mountSlackAssistantAgentSocket,
128
- nowIso,
129
106
  parseSlackMessageActivityFromMessageEvent,
130
- prunePostgresSlackInteractiveRequestStore,
131
107
  readSlackAgentViewStateValue,
132
108
  recordSlackTurnActivity,
133
109
  resolveAssistantSessionId,