@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.
Files changed (44) 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-YSDFYHPC.js → chunk-6EMFBOXD.js} +2 -2
  12. package/dist/{chunk-2R7B7NJR.js → chunk-DS6E5OEJ.js} +1 -1
  13. package/dist/{chunk-7YZWCSML.js → chunk-GEFK72VO.js} +1 -1
  14. package/dist/{chunk-FQWFB54C.js → chunk-KQPUQJ57.js} +1 -1
  15. package/dist/chunk-L5RAGYVJ.js +245 -0
  16. package/dist/chunk-OP27SSZU.js +409 -0
  17. package/dist/{chunk-236WN6JD.js → chunk-P2DIC42J.js} +1 -1
  18. package/dist/{chunk-6T6N4MRK.js → chunk-Q2GU4QLZ.js} +2 -2
  19. package/dist/{chunk-TCNJY7QA.js → chunk-QFDXKCAQ.js} +1 -1
  20. package/dist/express-assistant.d.ts +4 -3
  21. package/dist/express-assistant.js +3 -3
  22. package/dist/express.d.ts +5 -4
  23. package/dist/express.js +3 -3
  24. package/dist/history/index.d.ts +6 -5
  25. package/dist/index.d.ts +12 -10
  26. package/dist/index.js +14 -34
  27. package/dist/interactive/index.d.ts +5 -65
  28. package/dist/interactive/index.js +3 -27
  29. package/dist/interactive-BigrPKnu.d.ts +30 -0
  30. package/dist/{options-C7-VXmhD.d.ts → options-ByNm2o89.d.ts} +2 -2
  31. package/dist/{options-BcDReOJv.d.ts → options-CGUfVStV.d.ts} +1 -1
  32. package/dist/shared/index.d.ts +27 -84
  33. package/dist/shared/index.js +5 -1
  34. package/dist/socket.d.ts +6 -5
  35. package/dist/socket.js +5 -5
  36. package/dist/{types-CRWzJB5G.d.ts → types-BeGPexio.d.ts} +2 -2
  37. package/dist/{types-Crpil4kb.d.ts → types-Bz4OYEAV.d.ts} +6 -55
  38. package/docs/concepts/interactive-requests.md +7 -7
  39. package/docs/reference/boundary.md +5 -3
  40. package/docs/reference/exports.md +18 -18
  41. package/package.json +2 -2
  42. package/dist/chunk-TMADMHBN.js +0 -1008
  43. package/dist/chunk-X7ILLZZP.js +0 -1046
  44. package/dist/interactive-o_NZb-Xg.d.ts +0 -47
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-236WN6JD.js";
41
+ } from "./chunk-P2DIC42J.js";
54
42
  import {
55
43
  mountSlackAssistantAgent
56
- } from "./chunk-2R7B7NJR.js";
44
+ } from "./chunk-DS6E5OEJ.js";
57
45
  import {
58
46
  mountSlackAgent
59
- } from "./chunk-TCNJY7QA.js";
47
+ } from "./chunk-QFDXKCAQ.js";
60
48
  import {
61
49
  SLACK_MCP_URL,
62
50
  createSlackMcpServerConfig
@@ -64,37 +52,32 @@ import {
64
52
  import {
65
53
  mountSlackAgentAppSocket,
66
54
  mountSlackAssistantAgentSocket
67
- } from "./chunk-YSDFYHPC.js";
68
- import "./chunk-6T6N4MRK.js";
55
+ } from "./chunk-6EMFBOXD.js";
56
+ import "./chunk-Q2GU4QLZ.js";
69
57
  import {
70
58
  createSlackAssistantBridge,
71
59
  createSlackAssistantThreadContextStore,
72
60
  parseSlackMessageActivityFromMessageEvent,
73
61
  resolveAssistantSessionId
74
- } from "./chunk-7YZWCSML.js";
62
+ } from "./chunk-GEFK72VO.js";
75
63
  import "./chunk-ELR6MQD7.js";
76
64
  import {
77
65
  createSlackChannelAdapter,
78
66
  createSlackSessionMap
79
- } from "./chunk-FQWFB54C.js";
67
+ } from "./chunk-KQPUQJ57.js";
80
68
  import {
81
69
  UnsupportedSlackInteractiveRequestError,
82
70
  bridgeAgentEventsToSlack,
71
+ mapAgentEventToSlackTurnEvent,
72
+ mapAgentSlackEventBridgeOptionsToRuntimeOptions,
83
73
  resolveSlackEventBridgeOptions
84
- } from "./chunk-TMADMHBN.js";
74
+ } from "./chunk-L5RAGYVJ.js";
85
75
  export {
86
76
  DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
87
77
  SLACK_MCP_URL,
88
78
  UnsupportedSlackInteractiveRequestError,
89
79
  bridgeAgentEventsToSlack,
90
- buildApprovalRequestMessage,
91
- buildHumanInputModal,
92
- buildHumanInputRequestMessage,
93
- buildResolvedMessage,
94
- cloneRecord,
95
80
  coalesceSlackAgentEvents,
96
- createInMemorySlackInteractiveRequestStore,
97
- createPostgresSlackInteractiveRequestStore,
98
81
  createSlackAgentViewWorkflowController,
99
82
  createSlackAssistantBridge,
100
83
  createSlackAssistantThreadContextStore,
@@ -105,13 +88,10 @@ export {
105
88
  createSlackMcpServerConfig,
106
89
  createSlackSessionMap,
107
90
  createSlackSubagentCompletionNotifier,
108
- decodeActionValue,
109
91
  emptySlackAgentTurnHistoryContextResult,
110
- encodeActionValue,
111
92
  extractSlackAgentViewStateValues,
112
93
  formatDefaultSlackSubagentCompletionMessage,
113
94
  immediateSlackTextResponse,
114
- initializePostgresSlackInteractiveRequestStore,
115
95
  inspectSlackTurnStatusVisibility,
116
96
  isAbortLikeError,
117
97
  isRunningAgentTurnError,
@@ -120,14 +100,14 @@ export {
120
100
  isSlackTerminalTurnPhase,
121
101
  isSlackWaitingForHumanTurnPhase,
122
102
  loadSlackAgentTurnHistoryContext,
103
+ mapAgentEventToSlackTurnEvent,
104
+ mapAgentSlackEventBridgeOptionsToRuntimeOptions,
123
105
  mountSlackAgent,
124
106
  mountSlackAgentApp,
125
107
  mountSlackAgentAppSocket,
126
108
  mountSlackAssistantAgent,
127
109
  mountSlackAssistantAgentSocket,
128
- nowIso,
129
110
  parseSlackMessageActivityFromMessageEvent,
130
- prunePostgresSlackInteractiveRequestStore,
131
111
  readSlackAgentViewStateValue,
132
112
  recordSlackTurnActivity,
133
113
  resolveAssistantSessionId,
@@ -1,71 +1,11 @@
1
- import { i as SlackInteractiveRequestRecord, k as SlackInteractiveRequestStore, b as SlackInteractiveApprovalRequest, S as SlackInteractiveActionIds, e as SlackInteractiveHumanInputRequest, m as SlackInteractiveResolution, d as SlackInteractiveControllerOptions, c as SlackInteractiveController } from '../types-Crpil4kb.js';
2
- export { a as SlackInteractiveActor, f as SlackInteractiveMessageTarget, g as SlackInteractivePendingWaiter, h as SlackInteractivePostedMessage, j as SlackInteractiveRequestStatus, l as SlackInteractiveRequestWaitOptions, n as SlackInteractiveStoredRequest } from '../types-Crpil4kb.js';
3
- import { View } from '@slack/types';
1
+ import { b as SlackInteractiveControllerOptions, a as SlackInteractiveController } from '../types-Bz4OYEAV.js';
2
+ export { S as SlackInteractiveApprovalRequest, c as SlackInteractiveHumanInputRequest, d as SlackInteractivePendingWaiter, e as SlackInteractivePostedMessage, f as SlackInteractiveRequestWaitOptions, g as SlackInteractiveResolution } from '../types-Bz4OYEAV.js';
4
3
  import '@cuylabs/agent-core';
4
+ import '@cuylabs/channel-slack/interactive';
5
5
  import '@slack/bolt';
6
- import '../interactive-o_NZb-Xg.js';
6
+ import '../interactive-BigrPKnu.js';
7
7
  import '@cuylabs/channel-slack/core';
8
8
 
9
- declare function createInMemorySlackInteractiveRequestStore(): SlackInteractiveRequestStore;
10
- declare function nowIso(): string;
11
- declare function cloneRecord(record: SlackInteractiveRequestRecord): SlackInteractiveRequestRecord;
12
-
13
- interface SlackInteractivePostgresClient {
14
- end?: () => Promise<void>;
15
- query<T = unknown>(sql: string, values?: readonly unknown[]): Promise<{
16
- rows: T[];
17
- rowCount?: number | null;
18
- }>;
19
- }
20
- interface PostgresSlackInteractiveRequestStoreOptions {
21
- client?: SlackInteractivePostgresClient;
22
- connectionString?: string;
23
- ensureSchema?: boolean;
24
- onPruneError?: (error: unknown) => void;
25
- pruneBatchSize?: number;
26
- pruneIntervalMs?: number;
27
- retentionMs?: number;
28
- schema?: string;
29
- tableName?: string;
30
- }
31
- interface PostgresSlackInteractiveRequestStore extends SlackInteractiveRequestStore {
32
- close(): Promise<void>;
33
- prune(): Promise<PostgresSlackInteractiveRequestPruneResult>;
34
- }
35
- interface PostgresSlackInteractiveRequestPruneResult {
36
- deleted: number;
37
- }
38
- declare function createPostgresSlackInteractiveRequestStore({ client, connectionString, ensureSchema, onPruneError, pruneBatchSize, pruneIntervalMs, retentionMs, schema, tableName, }: PostgresSlackInteractiveRequestStoreOptions): PostgresSlackInteractiveRequestStore;
39
- declare function initializePostgresSlackInteractiveRequestStore({ client, ensureSchema, schema, tableName, }: {
40
- client: SlackInteractivePostgresClient;
41
- ensureSchema?: boolean;
42
- schema?: string;
43
- tableName?: string;
44
- }): Promise<void>;
45
- declare function prunePostgresSlackInteractiveRequestStore({ client, pruneBatchSize, retentionMs, schema, tableName, }: {
46
- client: SlackInteractivePostgresClient;
47
- pruneBatchSize?: number;
48
- retentionMs?: number;
49
- schema?: string;
50
- tableName?: string;
51
- }): Promise<PostgresSlackInteractiveRequestPruneResult>;
52
-
53
- declare function buildApprovalRequestMessage(request: SlackInteractiveApprovalRequest, actionIds: SlackInteractiveActionIds): {
54
- text: string;
55
- blocks: unknown[];
56
- };
57
- declare function buildHumanInputRequestMessage(request: SlackInteractiveHumanInputRequest, actionIds: SlackInteractiveActionIds): {
58
- text: string;
59
- blocks: unknown[];
60
- };
61
- declare function buildResolvedMessage(label: string, resolution: SlackInteractiveResolution): {
62
- text: string;
63
- blocks: unknown[];
64
- };
65
- declare function buildHumanInputModal(request: SlackInteractiveHumanInputRequest, actionIds: SlackInteractiveActionIds): View;
66
- declare function encodeActionValue(payload: Record<string, unknown>): string;
67
- declare function decodeActionValue(value: unknown): Record<string, unknown>;
68
-
69
9
  declare function createSlackInteractiveController(options?: SlackInteractiveControllerOptions): SlackInteractiveController;
70
10
 
71
- export { type PostgresSlackInteractiveRequestPruneResult, type PostgresSlackInteractiveRequestStore, type PostgresSlackInteractiveRequestStoreOptions, SlackInteractiveActionIds, SlackInteractiveApprovalRequest, SlackInteractiveController, SlackInteractiveControllerOptions, SlackInteractiveHumanInputRequest, type SlackInteractivePostgresClient, SlackInteractiveRequestRecord, SlackInteractiveRequestStore, SlackInteractiveResolution, buildApprovalRequestMessage, buildHumanInputModal, buildHumanInputRequestMessage, buildResolvedMessage, cloneRecord, createInMemorySlackInteractiveRequestStore, createPostgresSlackInteractiveRequestStore, createSlackInteractiveController, decodeActionValue, encodeActionValue, initializePostgresSlackInteractiveRequestStore, nowIso, prunePostgresSlackInteractiveRequestStore };
11
+ export { SlackInteractiveController, SlackInteractiveControllerOptions, createSlackInteractiveController };
@@ -1,30 +1,6 @@
1
1
  import {
2
- buildApprovalRequestMessage,
3
- buildHumanInputModal,
4
- buildHumanInputRequestMessage,
5
- buildResolvedMessage,
6
- cloneRecord,
7
- createInMemorySlackInteractiveRequestStore,
8
- createPostgresSlackInteractiveRequestStore,
9
- createSlackInteractiveController,
10
- decodeActionValue,
11
- encodeActionValue,
12
- initializePostgresSlackInteractiveRequestStore,
13
- nowIso,
14
- prunePostgresSlackInteractiveRequestStore
15
- } from "../chunk-X7ILLZZP.js";
2
+ createSlackInteractiveController
3
+ } from "../chunk-OP27SSZU.js";
16
4
  export {
17
- buildApprovalRequestMessage,
18
- buildHumanInputModal,
19
- buildHumanInputRequestMessage,
20
- buildResolvedMessage,
21
- cloneRecord,
22
- createInMemorySlackInteractiveRequestStore,
23
- createPostgresSlackInteractiveRequestStore,
24
- createSlackInteractiveController,
25
- decodeActionValue,
26
- encodeActionValue,
27
- initializePostgresSlackInteractiveRequestStore,
28
- nowIso,
29
- prunePostgresSlackInteractiveRequestStore
5
+ createSlackInteractiveController
30
6
  };
@@ -0,0 +1,30 @@
1
+ import { AgentEvent } from '@cuylabs/agent-core';
2
+ import { SlackInteractiveRequestBaseContext as SlackInteractiveRequestBaseContext$1, SlackInteractiveRequestContext as SlackInteractiveRequestContext$1 } from '@cuylabs/channel-slack/interactive';
3
+ import { SlackActivityInfo, SlackUserIdentity } from '@cuylabs/channel-slack/core';
4
+
5
+ /**
6
+ * Agent Core interactive request contracts for the Slack event bridge.
7
+ *
8
+ * Generic Slack message/responder primitives live in `@cuylabs/channel-slack`.
9
+ * This module narrows the request payloads to Agent Core events.
10
+ */
11
+
12
+ type SlackApprovalRequest = Extract<AgentEvent, {
13
+ type: "approval-request";
14
+ }>["request"];
15
+ type SlackHumanInputRequest = Extract<AgentEvent, {
16
+ type: "human-input-request";
17
+ }>["request"];
18
+ type SlackInteractiveRequest = SlackApprovalRequest | SlackHumanInputRequest;
19
+ interface SlackInteractiveRequestBaseContext extends Omit<SlackInteractiveRequestBaseContext$1, "request"> {
20
+ request: SlackInteractiveRequest;
21
+ }
22
+ interface SlackInteractiveRequestContext extends Omit<SlackInteractiveRequestContext$1, "request"> {
23
+ slackActivity: SlackActivityInfo;
24
+ user: SlackUserIdentity;
25
+ request: SlackInteractiveRequest;
26
+ }
27
+ type SlackInteractiveRequestHandler = (context: SlackInteractiveRequestContext) => boolean | void | Promise<boolean | void>;
28
+ type SlackEventInteractiveRequestHandler = (context: SlackInteractiveRequestBaseContext) => boolean | void | Promise<boolean | void>;
29
+
30
+ export type { SlackApprovalRequest as S, SlackEventInteractiveRequestHandler as a, SlackHumanInputRequest as b, SlackInteractiveRequest as c, SlackInteractiveRequestBaseContext as d, SlackInteractiveRequestContext as e, SlackInteractiveRequestHandler as f };
@@ -2,8 +2,8 @@ import { AgentTurnSource, AgentEvent, Logger } from '@cuylabs/agent-core';
2
2
  import { AssistantUserMessageMiddleware, AssistantThreadStartedMiddleware, Assistant, App } from '@slack/bolt';
3
3
  import { WebClient } from '@slack/web-api';
4
4
  import { SlackAuthContext, SlackAssistantThreadContext, SlackAssistantUtilities, SlackTurnPreparation, SlackAssistantTaskDisplayMode, SlackAssistantStatusUpdate, SlackAssistantSuggestedPrompts, SlackChatStreamStartArgs, SlackMessageFormattingOptions } from '@cuylabs/channel-slack/core';
5
- import { h as SlackInteractiveRequestHandler } from './interactive-o_NZb-Xg.js';
6
- import { S as SlackEventBridgeOptions } from './options-BcDReOJv.js';
5
+ import { f as SlackInteractiveRequestHandler } from './interactive-BigrPKnu.js';
6
+ import { S as SlackEventBridgeOptions } from './options-CGUfVStV.js';
7
7
  import { SlackFeedbackBlockOptions, SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
8
8
  import { ParsedAssistantUserMessage } from '@cuylabs/channel-slack/assistant';
9
9
 
@@ -1,6 +1,6 @@
1
1
  import { AgentEvent, ApprovalEvent } from '@cuylabs/agent-core';
2
2
  import { SlackFinalResponseArtifactPublisher, SlackFinalResponseArtifactDeliveryMode, SlackFinalResponseArtifactContext, SlackFinalResponseArtifactResult } from './artifacts/index.js';
3
- import { a as SlackEventInteractiveRequestHandler } from './interactive-o_NZb-Xg.js';
3
+ import { a as SlackEventInteractiveRequestHandler } from './interactive-BigrPKnu.js';
4
4
 
5
5
  /**
6
6
  * Event-bridge configuration. The bridge is mode-aware (progressive,
@@ -1,104 +1,47 @@
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
2
  import { AgentEvent } from '@cuylabs/agent-core';
3
- import { S as SlackEventBridgeOptions } from '../options-BcDReOJv.js';
4
- export { r as resolveSlackEventBridgeOptions } from '../options-BcDReOJv.js';
5
- import { SlackArtifactClient } from '@cuylabs/channel-slack/artifacts';
6
- 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';
3
+ import { SlackResponseSink } from '@cuylabs/channel-slack/responses';
4
+ import { S as SlackEventBridgeOptions } from '../options-CGUfVStV.js';
5
+ export { r as resolveSlackEventBridgeOptions } from '../options-CGUfVStV.js';
6
+ import { SlackTurnEvent, SlackEventBridgeOptions as SlackEventBridgeOptions$1 } from '@cuylabs/channel-slack/runtime';
7
+ 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';
7
8
  import '@cuylabs/channel-slack/core';
8
9
  import '../artifacts/index.js';
10
+ import '@cuylabs/channel-slack/artifacts';
11
+ import '@cuylabs/channel-slack/interactive';
9
12
 
10
13
  /**
11
- * Slack response-sink contracts consumed by the event bridge.
14
+ * Agent Core compatibility bridge.
12
15
  *
13
- * The adapter constructs a `SlackResponseSink` from the Bolt `say` function
14
- * and `WebClient` instance available in each handler. Keeping the sink
15
- * interface separate makes the bridge testable without a live Slack
16
- * connection.
16
+ * The Slack renderer itself lives in `@cuylabs/channel-slack/runtime` and
17
+ * consumes runtime-neutral `SlackTurnEvent`s. This adapter keeps the existing
18
+ * `bridgeAgentEventsToSlack` API and owns the explicit Agent Core to Slack
19
+ * runtime mapping.
17
20
  */
18
21
 
19
- type SlackStreamTaskStatus = "pending" | "in_progress" | "complete" | "error";
20
- type SlackStreamChunk = {
21
- type: "markdown_text";
22
- text: string;
23
- } | {
24
- type: "plan_update";
25
- title: string;
26
- } | {
27
- type: "task_update";
28
- id: string;
29
- title: string;
30
- status: SlackStreamTaskStatus;
31
- details?: string;
32
- output?: string;
33
- };
34
- interface SlackChatStream {
35
- append(args: {
36
- markdown_text?: string;
37
- chunks?: SlackStreamChunk[];
38
- }): Promise<unknown>;
39
- stop(args?: {
40
- markdown_text?: string;
41
- chunks?: SlackStreamChunk[];
42
- }): Promise<unknown>;
43
- }
44
22
  /**
45
- * Minimal Slack posting interface consumed by the event bridge.
23
+ * Stream Agent Core events to a Slack conversation via `SlackResponseSink`.
24
+ *
25
+ * @returns The full accumulated response text.
46
26
  */
47
- interface SlackArtifactPublicationTarget {
48
- channelId: string;
49
- threadTs?: string;
50
- }
51
- interface SlackResponseSink {
52
- /**
53
- * Slack Web API surface used by optional artifact publishers.
54
- */
55
- artifactClient?: SlackArtifactClient;
56
- /**
57
- * Channel/thread target used by optional artifact publishers.
58
- */
59
- artifactTarget?: SlackArtifactPublicationTarget;
60
- /**
61
- * Post a new message to the channel / thread.
62
- * Returns the channel ID and message timestamp needed for updates.
63
- */
64
- postMessage(text: string): Promise<{
65
- channel: string;
66
- ts: string;
67
- }>;
68
- /**
69
- * Update an existing message by channel + ts.
70
- */
71
- updateMessage(channel: string, ts: string, text: string): Promise<void>;
72
- /**
73
- * Create a native Slack chat stream. Required when `streamingMode` is
74
- * `"chat-stream"`.
75
- */
76
- createChatStream?(options: {
77
- bufferSize: number;
78
- }): SlackChatStream;
79
- }
27
+ declare function bridgeAgentEventsToSlack(events: AsyncGenerator<AgentEvent>, sink: SlackResponseSink, options: SlackEventBridgeOptions): Promise<string>;
80
28
 
81
29
  /**
82
- * Event bridge maps an agent-core `AgentEvent` stream to a Slack
83
- * conversation via a `SlackResponseSink`.
30
+ * Agent Core to Slack runtime event mapping.
84
31
  *
85
- * | Mode | Behaviour |
86
- * |----------------|--------------------------------------------------------|
87
- * | `progressive` | Posts a placeholder, updates it as text accumulates. |
88
- * | `accumulate` | Collects the full response then posts it in one shot. |
89
- * | `chat-stream` | Uses Slack's native `chat.startStream` + append + stop |
90
- *
91
- * The three modes share enough state (full-response accumulator, status
92
- * label, last-update offset) that they live in one function. Per-mode
93
- * branches are clearly labelled inside the event loop.
32
+ * This file is the compatibility boundary between `@cuylabs/agent-core` and
33
+ * the runtime-neutral Slack renderer in `@cuylabs/channel-slack/runtime`.
94
34
  */
95
35
 
36
+ declare function mapAgentEventToSlackTurnEvent(event: AgentEvent): SlackTurnEvent;
37
+
96
38
  /**
97
- * Stream agent-core events to a Slack conversation via `SlackResponseSink`.
98
- *
99
- * @returns The full accumulated response text.
39
+ * Adapter from Agent Core bridge options to runtime-neutral Slack bridge
40
+ * options. Function-valued options are wrapped so Agent Core-specific event
41
+ * types do not leak into `@cuylabs/channel-slack/runtime`.
100
42
  */
101
- declare function bridgeAgentEventsToSlack(events: AsyncGenerator<AgentEvent>, sink: SlackResponseSink, options: SlackEventBridgeOptions): Promise<string>;
43
+
44
+ declare function mapAgentSlackEventBridgeOptionsToRuntimeOptions(options: SlackEventBridgeOptions): SlackEventBridgeOptions$1;
102
45
 
103
46
  /**
104
47
  * Interactive-request error type raised when an `approval-request` or
@@ -114,4 +57,4 @@ declare class UnsupportedSlackInteractiveRequestError extends Error {
114
57
  constructor(kind: "approval" | "human-input", requestId: string, message: string);
115
58
  }
116
59
 
117
- export { type SlackArtifactPublicationTarget, type SlackChatStream, SlackEventBridgeOptions, type SlackResponseSink, type SlackStreamChunk, type SlackStreamTaskStatus, UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack };
60
+ export { SlackEventBridgeOptions, UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack, mapAgentEventToSlackTurnEvent, mapAgentSlackEventBridgeOptionsToRuntimeOptions };
@@ -5,12 +5,16 @@ import {
5
5
  import {
6
6
  UnsupportedSlackInteractiveRequestError,
7
7
  bridgeAgentEventsToSlack,
8
+ mapAgentEventToSlackTurnEvent,
9
+ mapAgentSlackEventBridgeOptionsToRuntimeOptions,
8
10
  resolveSlackEventBridgeOptions
9
- } from "../chunk-TMADMHBN.js";
11
+ } from "../chunk-L5RAGYVJ.js";
10
12
  export {
11
13
  DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
12
14
  UnsupportedSlackInteractiveRequestError,
13
15
  bridgeAgentEventsToSlack,
14
16
  createSlackContextFragmentMiddleware,
17
+ mapAgentEventToSlackTurnEvent,
18
+ mapAgentSlackEventBridgeOptionsToRuntimeOptions,
15
19
  resolveSlackEventBridgeOptions
16
20
  };
package/dist/socket.d.ts CHANGED
@@ -1,19 +1,20 @@
1
1
  import { App } from '@slack/bolt';
2
2
  import { CreateSlackSocketBoltAppOptions } from '@cuylabs/channel-slack/transports/socket';
3
3
  import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
4
- import { S as SlackAssistantBridge, C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig } from './options-C7-VXmhD.js';
4
+ import { S as SlackAssistantBridge, C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig } from './options-ByNm2o89.js';
5
5
  import { SlackAgentAppSurfaceOptions } from './app-surface.js';
6
6
  import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
7
7
  import '@cuylabs/agent-core';
8
8
  import '@slack/web-api';
9
9
  import '@cuylabs/channel-slack/core';
10
- import './interactive-o_NZb-Xg.js';
11
- import './options-BcDReOJv.js';
10
+ import './interactive-BigrPKnu.js';
11
+ import '@cuylabs/channel-slack/interactive';
12
+ import './options-CGUfVStV.js';
12
13
  import './artifacts/index.js';
13
14
  import '@cuylabs/channel-slack/artifacts';
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/socket.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  mountSlackAgentAppSocket,
3
3
  mountSlackAssistantAgentSocket
4
- } from "./chunk-YSDFYHPC.js";
5
- import "./chunk-6T6N4MRK.js";
6
- import "./chunk-7YZWCSML.js";
4
+ } from "./chunk-6EMFBOXD.js";
5
+ import "./chunk-Q2GU4QLZ.js";
6
+ import "./chunk-GEFK72VO.js";
7
7
  import "./chunk-ELR6MQD7.js";
8
- import "./chunk-FQWFB54C.js";
9
- import "./chunk-TMADMHBN.js";
8
+ import "./chunk-KQPUQJ57.js";
9
+ import "./chunk-L5RAGYVJ.js";
10
10
  export {
11
11
  mountSlackAgentAppSocket,
12
12
  mountSlackAssistantAgentSocket
@@ -1,7 +1,7 @@
1
1
  import { Agent, AgentTurnSource, AgentEvent, ApprovalEvent, Logger } from '@cuylabs/agent-core';
2
2
  import { SlackActivityInfo, SlackTurnRequestContext, SlackAssistantStatusUpdate, SlackChatStreamStartArgs, SlackUserIdentity, SlackTurnPreparation } from '@cuylabs/channel-slack/core';
3
- import { S as SlackEventBridgeOptions } from './options-BcDReOJv.js';
4
- import { h as SlackInteractiveRequestHandler } from './interactive-o_NZb-Xg.js';
3
+ import { S as SlackEventBridgeOptions } from './options-CGUfVStV.js';
4
+ import { f as SlackInteractiveRequestHandler } from './interactive-BigrPKnu.js';
5
5
 
6
6
  /**
7
7
  * Channel-options + adapter contract for the direct Slack adapter
@@ -1,11 +1,10 @@
1
- import { ApprovalAction, ApprovalRememberScope, HumanInputResponse, ApprovalRequest, HumanInputRequest, ApprovalResolution } from '@cuylabs/agent-core';
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';
2
3
  import { App } from '@slack/bolt';
3
- import { S as SlackApprovalRequest, b as SlackHumanInputRequest, g as SlackInteractiveRequestContext, d as SlackInteractiveMessageRef } from './interactive-o_NZb-Xg.js';
4
+ import { e as SlackInteractiveRequestContext } from './interactive-BigrPKnu.js';
4
5
 
5
- type SlackInteractiveRequestStatus = "pending" | "resolved";
6
- type SlackInteractiveApprovalRequest = ApprovalRequest | SlackApprovalRequest;
7
- type SlackInteractiveHumanInputRequest = SlackHumanInputRequest & Partial<Pick<HumanInputRequest, "sessionId" | "timestamp" | "toolCallId">>;
8
- type SlackInteractiveStoredRequest = SlackInteractiveApprovalRequest | SlackInteractiveHumanInputRequest;
6
+ type SlackInteractiveApprovalRequest = ApprovalRequest;
7
+ type SlackInteractiveHumanInputRequest = SlackInteractiveHumanInputRequest$1 & Partial<Pick<HumanInputRequest, "sessionId" | "timestamp" | "toolCallId">>;
9
8
  type SlackInteractiveResolution = {
10
9
  kind: "approval";
11
10
  action: ApprovalAction;
@@ -15,54 +14,6 @@ type SlackInteractiveResolution = {
15
14
  kind: "human-input";
16
15
  response: HumanInputResponse;
17
16
  };
18
- interface SlackInteractiveMessageTarget {
19
- channel: string;
20
- ts: string;
21
- threadTs?: string;
22
- userId: string;
23
- teamId?: string;
24
- }
25
- interface SlackInteractiveRequestRecord {
26
- id: string;
27
- kind: SlackInteractiveResolution["kind"];
28
- request: SlackInteractiveStoredRequest;
29
- status: SlackInteractiveRequestStatus;
30
- createdAt: string;
31
- updatedAt: string;
32
- target?: SlackInteractiveMessageTarget;
33
- resolution?: SlackInteractiveResolution;
34
- }
35
- interface SlackInteractiveRequestStore {
36
- get(requestId: string): Promise<SlackInteractiveRequestRecord | undefined>;
37
- upsert(record: SlackInteractiveRequestRecord): Promise<SlackInteractiveRequestRecord>;
38
- /**
39
- * Attach the Slack message target for an already-upserted request.
40
- *
41
- * Implementations should return `undefined` when the request does not exist;
42
- * callers must upsert before attaching a target.
43
- */
44
- attachTarget(requestId: string, target: SlackInteractiveMessageTarget): Promise<SlackInteractiveRequestRecord | undefined>;
45
- /**
46
- * Mark a request resolved. Implementations must be idempotent: resolving an
47
- * already-resolved request should return the existing record without
48
- * overwriting the original resolution.
49
- */
50
- resolve(requestId: string, resolution: SlackInteractiveResolution): Promise<SlackInteractiveRequestRecord | undefined>;
51
- delete(requestId: string): Promise<void>;
52
- }
53
- interface SlackInteractiveActionIds {
54
- approvalAllow: string;
55
- approvalDeny: string;
56
- approvalRemember: string;
57
- humanConfirm: string;
58
- humanDeny: string;
59
- humanOpen: string;
60
- humanSubmit: string;
61
- }
62
- interface SlackInteractiveActor {
63
- userId: string;
64
- teamId?: string;
65
- }
66
17
  interface SlackInteractiveRequestWaitOptions {
67
18
  /**
68
19
  * Abort waiting for this request. The controller removes its local waiter and
@@ -133,4 +84,4 @@ interface SlackInteractivePostedMessage {
133
84
  ref: SlackInteractiveMessageRef;
134
85
  }
135
86
 
136
- export type { SlackInteractiveActionIds as S, SlackInteractiveActor as a, SlackInteractiveApprovalRequest as b, SlackInteractiveController as c, SlackInteractiveControllerOptions as d, SlackInteractiveHumanInputRequest as e, SlackInteractiveMessageTarget as f, SlackInteractivePendingWaiter as g, SlackInteractivePostedMessage as h, SlackInteractiveRequestRecord as i, SlackInteractiveRequestStatus as j, SlackInteractiveRequestStore as k, SlackInteractiveRequestWaitOptions as l, SlackInteractiveResolution as m, SlackInteractiveStoredRequest as n };
87
+ export type { SlackInteractiveApprovalRequest as S, SlackInteractiveController as a, SlackInteractiveControllerOptions as b, SlackInteractiveHumanInputRequest as c, SlackInteractivePendingWaiter as d, SlackInteractivePostedMessage as e, SlackInteractiveRequestWaitOptions as f, SlackInteractiveResolution as g };
@@ -4,10 +4,8 @@ Slack interactive requests render Agent Core approval and human-input requests
4
4
  as Slack buttons and modals.
5
5
 
6
6
  ```typescript
7
- import {
8
- createPostgresSlackInteractiveRequestStore,
9
- createSlackInteractiveController,
10
- } from "@cuylabs/channel-slack-agent-core/interactive";
7
+ import { createSlackInteractiveController } from "@cuylabs/channel-slack-agent-core/interactive";
8
+ import { createPostgresSlackInteractiveRequestStore } from "@cuylabs/channel-slack/interactive";
11
9
 
12
10
  const interactiveStore = createPostgresSlackInteractiveRequestStore({
13
11
  connectionString: process.env.DATABASE_URL,
@@ -30,10 +28,12 @@ const interactive = createSlackInteractiveController({
30
28
 
31
29
  ## Store Choices
32
30
 
33
- - `createInMemorySlackInteractiveRequestStore` is useful for tests and local
31
+ - `createInMemorySlackInteractiveRequestStore` from
32
+ `@cuylabs/channel-slack/interactive` is useful for tests and local
34
33
  single-process apps.
35
- - `createPostgresSlackInteractiveRequestStore` persists pending requests across
36
- restarts and lets multiple Slack workers resolve the same request safely.
34
+ - `createPostgresSlackInteractiveRequestStore` from
35
+ `@cuylabs/channel-slack/interactive` persists pending requests across restarts
36
+ and lets multiple Slack workers resolve the same request safely.
37
37
 
38
38
  The Postgres store uses one table keyed by request ID. `resolve(...)` is
39
39
  idempotent: the first resolution wins, and later duplicate button clicks return
@@ -6,16 +6,18 @@ This package owns only the `@cuylabs/agent-core` Slack binding.
6
6
 
7
7
  - Mapping Slack turns to `AgentTurnSource.chat(...)`.
8
8
  - Creating Agent Core scopes and context fragments.
9
- - Converting `AgentEvent` streams to Slack messages or chat streams.
9
+ - Converting `AgentEvent` streams through Slack response sink contracts.
10
10
  - Mounting Agent Core sources on Express Events API and Socket Mode surfaces.
11
11
  - Binding Slack Assistant lifecycle handlers to Agent Core turns.
12
- - Handling Agent Core approval and human-input requests in Slack.
12
+ - Binding Agent Core approval and human-input requests to Slack interactive
13
+ request primitives.
13
14
  - Agent Core helpers for Slack history context fragments and source events.
14
15
 
15
16
  ## Outside This Package
16
17
 
17
18
  - Generic Slack activity parsing, formatting, setup, auth, policy, history,
18
- targets, users, entrypoints, artifacts, and transport factories.
19
+ targets, users, entrypoints, artifacts, response sink contracts, interactive
20
+ request builders/stores, and transport factories.
19
21
  - Product prompts, tools, audit policy, privacy rules, and deployment policy.
20
22
  - Slack app configuration outside the reusable setup helpers.
21
23