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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +13 -10
  2. package/dist/chunk-U6RC4SXN.js +331 -0
  3. package/dist/history/index.d.ts +7 -17
  4. package/dist/index.d.ts +5 -28
  5. package/dist/index.js +14 -58
  6. package/dist/interactive/index.d.ts +86 -7
  7. package/dist/shared/index.d.ts +144 -19
  8. package/dist/shared/index.js +8 -4
  9. package/docs/README.md +0 -1
  10. package/docs/concepts/final-response-artifacts.md +9 -7
  11. package/docs/concepts/tool-task-rendering.md +2 -0
  12. package/docs/reference/exports.md +10 -20
  13. package/package.json +4 -54
  14. package/dist/adapter/index.d.ts +0 -26
  15. package/dist/adapter/index.js +0 -9
  16. package/dist/adapter-vbqtraAr.d.ts +0 -31
  17. package/dist/app-surface.d.ts +0 -82
  18. package/dist/app-surface.js +0 -10
  19. package/dist/app.d.ts +0 -60
  20. package/dist/app.js +0 -11
  21. package/dist/artifacts/index.d.ts +0 -57
  22. package/dist/artifacts/index.js +0 -6
  23. package/dist/assistant/index.d.ts +0 -22
  24. package/dist/assistant/index.js +0 -14
  25. package/dist/chunk-A2PLAVW6.js +0 -75
  26. package/dist/chunk-C7CHMYV6.js +0 -226
  27. package/dist/chunk-D4CSEAIF.js +0 -82
  28. package/dist/chunk-ELR6MQD7.js +0 -12
  29. package/dist/chunk-FJP6ZFUB.js +0 -921
  30. package/dist/chunk-GKZRDNEB.js +0 -187
  31. package/dist/chunk-HHXAXSG6.js +0 -67
  32. package/dist/chunk-JU5R6JZG.js +0 -85
  33. package/dist/chunk-KAEZPS3U.js +0 -77
  34. package/dist/chunk-NNCVHQC4.js +0 -94
  35. package/dist/chunk-VBGQD6JT.js +0 -1008
  36. package/dist/chunk-XA7U3GRN.js +0 -482
  37. package/dist/express-assistant.d.ts +0 -106
  38. package/dist/express-assistant.js +0 -9
  39. package/dist/express.d.ts +0 -103
  40. package/dist/express.js +0 -8
  41. package/dist/feedback/index.d.ts +0 -1
  42. package/dist/feedback/index.js +0 -10
  43. package/dist/options-ByNm2o89.d.ts +0 -323
  44. package/dist/options-CGUfVStV.d.ts +0 -119
  45. package/dist/socket.d.ts +0 -143
  46. package/dist/socket.js +0 -13
  47. package/dist/types-BeGPexio.d.ts +0 -381
  48. package/dist/types-Bz4OYEAV.d.ts +0 -87
  49. package/dist/types-CiwGU6zC.d.ts +0 -56
  50. package/dist/views/index.d.ts +0 -8
  51. package/dist/views/index.js +0 -10
  52. package/docs/concepts/view-workflows.md +0 -52
@@ -1,36 +1,159 @@
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
- import { AgentEvent } from '@cuylabs/agent-core';
3
- import { S as SlackEventBridgeOptions } from '../options-CGUfVStV.js';
4
- export { r as resolveSlackEventBridgeOptions } from '../options-CGUfVStV.js';
2
+ import { AgentEvent, ApprovalEvent, AgentTurnSource } from '@cuylabs/agent-core';
5
3
  import { SlackResponseSink } from '@cuylabs/channel-slack/responses';
6
- 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';
4
+ import { SlackFinalResponseArtifactPublisher, SlackFinalResponseArtifactDeliveryMode, SlackFinalResponseArtifactContext, SlackFinalResponseArtifactResult, SlackTurnEvent, SlackEventBridgeOptions as SlackEventBridgeOptions$1, SlackTurnSource } from '@cuylabs/channel-slack/runtime';
5
+ import { a as SlackEventInteractiveRequestHandler } from '../interactive-BigrPKnu.js';
6
+ export { S as SlackApprovalRequest, b as SlackHumanInputRequest, c as SlackInteractiveRequest, d as SlackInteractiveRequestBaseContext, e as SlackInteractiveRequestContext, f as SlackInteractiveRequestHandler } from '../interactive-BigrPKnu.js';
7
7
  import '@cuylabs/channel-slack/core';
8
- import '../artifacts/index.js';
9
- import '@cuylabs/channel-slack/artifacts';
10
8
  import '@cuylabs/channel-slack/interactive';
11
9
 
12
10
  /**
13
- * Event bridge maps an agent-core `AgentEvent` stream to a Slack
14
- * conversation via a `SlackResponseSink`.
15
- *
16
- * | Mode | Behaviour |
17
- * |----------------|--------------------------------------------------------|
18
- * | `progressive` | Posts a placeholder, updates it as text accumulates. |
19
- * | `accumulate` | Collects the full response then posts it in one shot. |
20
- * | `chat-stream` | Uses Slack's native `chat.startStream` + append + stop |
11
+ * Event-bridge configuration. The bridge is mode-aware (progressive,
12
+ * accumulate, chat-stream) and these options control formatting, status
13
+ * propagation, interactive-request handling, and chat-stream finalization.
14
+ */
15
+
16
+ type HumanInputEvent = Extract<AgentEvent, {
17
+ type: "human-input-request";
18
+ }>["request"];
19
+ type ToolStartEvent = Extract<AgentEvent, {
20
+ type: "tool-start";
21
+ }>;
22
+ type ToolResultEvent = Extract<AgentEvent, {
23
+ type: "tool-result";
24
+ }>;
25
+ interface SlackEventBridgeOptions {
26
+ showReasoning: boolean;
27
+ /** Render root-agent tool rows/status updates. */
28
+ showToolUsage: boolean;
29
+ /** Render subagent child tool rows in the parent Slack task timeline. */
30
+ showSubagentToolUsage: boolean;
31
+ /** Include full subagent completion output in the subagent task row. */
32
+ showSubagentResultInTask: boolean;
33
+ formatToolTitle?: (toolName: string) => string;
34
+ formatToolUpdate: (toolName: string) => string;
35
+ formatToolDetails?: (event: ToolStartEvent) => string | undefined;
36
+ /**
37
+ * Format the completed tool output shown in Slack task rows.
38
+ *
39
+ * Return `undefined` to use the default generic formatter. Return `null` to
40
+ * intentionally omit task-row output for this tool result.
41
+ */
42
+ formatToolResultOutput?: (event: ToolResultEvent) => string | null | undefined;
43
+ formatToolError: (toolName: string, error: string) => string;
44
+ formatReasoningUpdate: () => string;
45
+ formatMessageText: (text: string) => string;
46
+ streamingMode: "progressive" | "accumulate" | "chat-stream";
47
+ progressiveUpdateThreshold: number;
48
+ progressiveUpdateIntervalMs: number;
49
+ chatStreamBufferSize: number;
50
+ /**
51
+ * Maximum number of Slack task-update chunks the bridge will append to a
52
+ * single chat stream. Task rows are a bounded UI projection, not a durable
53
+ * event log.
54
+ */
55
+ maxTaskUpdates: number;
56
+ /**
57
+ * Maximum cumulative characters from task titles/details/output that the
58
+ * bridge will append to one chat stream.
59
+ */
60
+ maxTaskUpdateTextChars: number;
61
+ /**
62
+ * Maximum characters for a single task details/output field.
63
+ */
64
+ maxTaskUpdateFieldChars: number;
65
+ interactiveMode: "message-and-error" | "ignore";
66
+ handleInteractiveRequest?: SlackEventInteractiveRequestHandler;
67
+ formatApprovalRequired: (request: ApprovalEvent) => string;
68
+ formatHumanInputRequired: (request: HumanInputEvent) => string;
69
+ /**
70
+ * Optional hook called whenever the bridge's status label changes — used by
71
+ * the assistant bridge to update the assistant pane's status line via
72
+ * `assistant.threads.setStatus`. Errors are swallowed by the caller.
73
+ */
74
+ onStatusChange?: (label: string, event: AgentEvent | undefined) => void | Promise<void>;
75
+ /**
76
+ * Optional final-args passthrough for `chatStream.stop(...)`. When the
77
+ * bridge stops the chat stream on `complete`, these args (e.g. final
78
+ * `blocks` for a feedback widget) are merged into the `stop` call. The
79
+ * existing `markdown_text` final-text fallback always wins on text fields.
80
+ */
81
+ chatStreamFinalArgs?: {
82
+ blocks?: unknown[];
83
+ } & Record<string, unknown>;
84
+ /**
85
+ * Optional post-processing hook for publishing a rich artifact from the final
86
+ * accumulated response, such as a Slack Canvas for long answers.
87
+ */
88
+ publishFinalResponseArtifact?: SlackFinalResponseArtifactPublisher;
89
+ /**
90
+ * Controls whether artifact publication is additive or becomes the primary
91
+ * final-answer surface.
92
+ *
93
+ * - `supplemental`: finalize the Slack text normally, then publish artifact.
94
+ * - `replace`: publish artifact first and use a compact Slack final message.
95
+ *
96
+ * @default "supplemental"
97
+ */
98
+ finalResponseArtifactMode?: SlackFinalResponseArtifactDeliveryMode;
99
+ /**
100
+ * When replacement mode is active, continue streaming text up to this many
101
+ * raw characters, then suppress further text deltas and publish the full
102
+ * answer as an artifact at completion. This preserves normal short-answer
103
+ * streaming without flooding Slack for long answers.
104
+ *
105
+ * @default 4000
106
+ */
107
+ finalResponseArtifactStreamThreshold?: number;
108
+ /**
109
+ * Notice appended when replacement mode suppresses the remaining text stream.
110
+ */
111
+ formatFinalResponseArtifactContinuationNotice?: (context: Pick<SlackFinalResponseArtifactContext, "text" | "formattedText">) => string;
112
+ /**
113
+ * Final compact message used when an artifact replaces the full Slack text.
114
+ */
115
+ formatFinalResponseArtifactMessage?: (result: SlackFinalResponseArtifactResult, context: SlackFinalResponseArtifactContext) => string;
116
+ /**
117
+ * Called when `publishFinalResponseArtifact` throws. Errors from this hook
118
+ * are swallowed so artifact publication cannot break a completed turn.
119
+ */
120
+ onFinalResponseArtifactError?: (error: unknown, context: SlackFinalResponseArtifactContext) => void | Promise<void>;
121
+ }
122
+ declare function resolveSlackEventBridgeOptions(partial: Partial<SlackEventBridgeOptions>): SlackEventBridgeOptions;
123
+
124
+ /**
125
+ * Agent Core compatibility bridge.
21
126
  *
22
- * The three modes share enough state (full-response accumulator, status
23
- * label, last-update offset) that they live in one function. Per-mode
24
- * branches are clearly labelled inside the event loop.
127
+ * The Slack renderer itself lives in `@cuylabs/channel-slack/runtime` and
128
+ * consumes runtime-neutral `SlackTurnEvent`s. This adapter keeps the existing
129
+ * `bridgeAgentEventsToSlack` API and owns the explicit Agent Core to Slack
130
+ * runtime mapping.
25
131
  */
26
132
 
27
133
  /**
28
- * Stream agent-core events to a Slack conversation via `SlackResponseSink`.
134
+ * Stream Agent Core events to a Slack conversation via `SlackResponseSink`.
29
135
  *
30
136
  * @returns The full accumulated response text.
31
137
  */
32
138
  declare function bridgeAgentEventsToSlack(events: AsyncGenerator<AgentEvent>, sink: SlackResponseSink, options: SlackEventBridgeOptions): Promise<string>;
33
139
 
140
+ /**
141
+ * Agent Core to Slack runtime event mapping.
142
+ *
143
+ * This file is the compatibility boundary between `@cuylabs/agent-core` and
144
+ * the runtime-neutral Slack renderer in `@cuylabs/channel-slack/runtime`.
145
+ */
146
+
147
+ declare function mapAgentEventToSlackTurnEvent(event: AgentEvent): SlackTurnEvent;
148
+
149
+ /**
150
+ * Adapter from Agent Core bridge options to runtime-neutral Slack bridge
151
+ * options. Function-valued options are wrapped so Agent Core-specific event
152
+ * types do not leak into `@cuylabs/channel-slack/runtime`.
153
+ */
154
+
155
+ declare function mapAgentSlackEventBridgeOptionsToRuntimeOptions(options: SlackEventBridgeOptions): SlackEventBridgeOptions$1;
156
+
34
157
  /**
35
158
  * Interactive-request error type raised when an `approval-request` or
36
159
  * `human-input-request` event reaches the Slack transport in a mode that
@@ -45,4 +168,6 @@ declare class UnsupportedSlackInteractiveRequestError extends Error {
45
168
  constructor(kind: "approval" | "human-input", requestId: string, message: string);
46
169
  }
47
170
 
48
- export { SlackEventBridgeOptions, UnsupportedSlackInteractiveRequestError, bridgeAgentEventsToSlack };
171
+ declare function adaptAgentTurnSourceToSlackTurnSource(source: AgentTurnSource): SlackTurnSource;
172
+
173
+ export { type SlackEventBridgeOptions, SlackEventInteractiveRequestHandler, UnsupportedSlackInteractiveRequestError, adaptAgentTurnSourceToSlackTurnSource, bridgeAgentEventsToSlack, mapAgentEventToSlackTurnEvent, mapAgentSlackEventBridgeOptionsToRuntimeOptions, resolveSlackEventBridgeOptions };
@@ -1,16 +1,20 @@
1
1
  import {
2
2
  DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
3
- createSlackContextFragmentMiddleware
4
- } from "../chunk-A2PLAVW6.js";
5
- import {
6
3
  UnsupportedSlackInteractiveRequestError,
4
+ adaptAgentTurnSourceToSlackTurnSource,
7
5
  bridgeAgentEventsToSlack,
6
+ createSlackContextFragmentMiddleware,
7
+ mapAgentEventToSlackTurnEvent,
8
+ mapAgentSlackEventBridgeOptionsToRuntimeOptions,
8
9
  resolveSlackEventBridgeOptions
9
- } from "../chunk-VBGQD6JT.js";
10
+ } from "../chunk-U6RC4SXN.js";
10
11
  export {
11
12
  DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
12
13
  UnsupportedSlackInteractiveRequestError,
14
+ adaptAgentTurnSourceToSlackTurnSource,
13
15
  bridgeAgentEventsToSlack,
14
16
  createSlackContextFragmentMiddleware,
17
+ mapAgentEventToSlackTurnEvent,
18
+ mapAgentSlackEventBridgeOptionsToRuntimeOptions,
15
19
  resolveSlackEventBridgeOptions
16
20
  };
package/docs/README.md CHANGED
@@ -15,4 +15,3 @@ and human-input requests.
15
15
  - [Final response artifacts](concepts/final-response-artifacts.md)
16
16
  - [Interactive requests](concepts/interactive-requests.md)
17
17
  - [Tool task rendering](concepts/tool-task-rendering.md)
18
- - [View workflows](concepts/view-workflows.md)
@@ -1,12 +1,14 @@
1
1
  # Final Response Artifacts
2
2
 
3
- Final response artifacts let a Slack host publish a rich surface from the
4
- completed Agent Core response. The first built-in publisher creates a Slack
5
- Canvas for long answers and can fall back to a text file when Canvas
6
- publication is unavailable.
3
+ Final response artifacts let a Slack host publish a rich surface from a
4
+ completed Slack turn response. The built-in publisher creates a Slack Canvas
5
+ for long answers and can fall back to a text file when Canvas publication is
6
+ unavailable.
7
7
 
8
8
  ```typescript
9
- import { createSlackFinalResponseArtifactPublisher } from "@cuylabs/channel-slack-agent-core/artifacts";
9
+ import { mountSlackApp } from "@cuylabs/channel-slack/app";
10
+ import { createSlackFinalResponseArtifactPublisher } from "@cuylabs/channel-slack/artifacts";
11
+ import { adaptAgentTurnSourceToSlackTurnSource } from "@cuylabs/channel-slack-agent-core";
10
12
 
11
13
  const publishFinalResponseArtifact = createSlackFinalResponseArtifactPublisher({
12
14
  minCharacters: 4000,
@@ -14,8 +16,8 @@ const publishFinalResponseArtifact = createSlackFinalResponseArtifactPublisher({
14
16
  fallback: "file",
15
17
  });
16
18
 
17
- await mountSlackAgentApp({
18
- source,
19
+ await mountSlackApp({
20
+ source: adaptAgentTurnSourceToSlackTurnSource(agent),
19
21
  publishFinalResponseArtifact,
20
22
  finalResponseArtifactMode: "replace",
21
23
  finalResponseArtifactStreamThreshold: 4000,
@@ -19,6 +19,8 @@ Core. Return `undefined` to use the default formatter. Return `null` to omit the
19
19
  completed task output intentionally.
20
20
 
21
21
  ```ts
22
+ import { createSlackChannelAdapter } from "@cuylabs/channel-slack/adapter";
23
+
22
24
  createSlackChannelAdapter({
23
25
  source,
24
26
  streamingMode: "chat-stream",
@@ -1,26 +1,16 @@
1
1
  # Exports
2
2
 
3
- Use feature subpaths when you only need one adapter surface. Generic Slack
4
- primitives should be imported from `@cuylabs/channel-slack` directly.
3
+ Use feature subpaths when you only need one Agent Core binding. Generic Slack
4
+ mounts and primitives must be imported from `@cuylabs/channel-slack` directly.
5
5
 
6
- | Export | Depends on | Notes |
7
- | ----------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------- |
8
- | `@cuylabs/channel-slack-agent-core` | `@cuylabs/agent-core`, selected Slack peers | Full adapter surface re-export |
9
- | `@cuylabs/channel-slack-agent-core/adapter` | `@slack/bolt`, `@slack/web-api` types | Classic app mention, DM, and passive channel-message adapter |
10
- | `@cuylabs/channel-slack-agent-core/app` | `@slack/bolt`, `@slack/web-api` | Direct app factory for mounted Slack surfaces |
11
- | `@cuylabs/channel-slack-agent-core/app-surface` | `@slack/bolt`, `@slack/web-api` types | Shared surface installer for Assistant, mentions, DMs, feedback, and interactions |
12
- | `@cuylabs/channel-slack-agent-core/artifacts` | `@cuylabs/channel-slack/artifacts` | Agent Core final-response artifact publishers for Slack surfaces |
13
- | `@cuylabs/channel-slack-agent-core/assistant` | `@slack/bolt`, `@slack/web-api` types | Slack Assistant bridge and lifecycle handlers |
14
- | `@cuylabs/channel-slack-agent-core/express` | `@slack/bolt`, `express` | Express Events API mounting for classic Slack surfaces |
15
- | `@cuylabs/channel-slack-agent-core/express-assistant` | `@slack/bolt`, `express` | Express Events API mounting for Slack Assistant |
16
- | `@cuylabs/channel-slack-agent-core/feedback` | `@slack/bolt`, `@slack/types` | Agent Core feedback binding helpers |
17
- | `@cuylabs/channel-slack-agent-core/history` | `@slack/web-api`, `@cuylabs/agent-core` types | Agent Core turn history context fragment assembly |
18
- | `@cuylabs/channel-slack-agent-core/interactive` | `@slack/bolt`, `@cuylabs/channel-slack/interactive` | Agent Core approval and human-input controller binding for Slack |
19
- | `@cuylabs/channel-slack-agent-core/mcp` | `@cuylabs/agent-core/mcp` types | Slack OAuth token bridge for Agent Core MCP setup |
20
- | `@cuylabs/channel-slack-agent-core/shared` | `@cuylabs/agent-core` types | Context fragments, event bridge, and Agent Core interactive request contracts |
21
- | `@cuylabs/channel-slack-agent-core/socket` | `@slack/bolt` | Socket Mode mounting helpers |
22
- | `@cuylabs/channel-slack-agent-core/source` | `@cuylabs/agent-core` types | Source event queue, response helpers, and status visibility helpers |
23
- | `@cuylabs/channel-slack-agent-core/views` | `@cuylabs/channel-slack/views`, `@slack/bolt` | Agent/product Slack modal workflow controller and submitted state helpers |
6
+ | Export | Depends on | Notes |
7
+ | ------------------------------------------- | --------------------------------------------------- | ----------------------------------------------------------------------------- |
8
+ | `@cuylabs/channel-slack-agent-core` | `@cuylabs/agent-core` | Agent Core event bridge, context fragments, history, interactive, source, MCP |
9
+ | `@cuylabs/channel-slack-agent-core/history` | `@slack/web-api`, `@cuylabs/agent-core` types | Agent Core turn history context fragment assembly |
10
+ | `@cuylabs/channel-slack-agent-core/interactive` | `@slack/bolt`, `@cuylabs/channel-slack/interactive` | Agent Core approval and human-input controller binding for Slack |
11
+ | `@cuylabs/channel-slack-agent-core/mcp` | `@cuylabs/agent-core/mcp` types | Slack OAuth token bridge for Agent Core MCP setup |
12
+ | `@cuylabs/channel-slack-agent-core/shared` | `@cuylabs/agent-core` types | Context fragments, Agent Core event mapping, and source adaptation |
13
+ | `@cuylabs/channel-slack-agent-core/source` | `@cuylabs/agent-core` types | Agent Core event queue, response helpers, and status visibility helpers |
24
14
 
25
15
  For generic Slack package exports, see
26
16
  `@cuylabs/channel-slack/docs/reference/exports.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuylabs/channel-slack-agent-core",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Slack adapter for @cuylabs/agent-core built on @cuylabs/channel-slack",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,46 +11,6 @@
11
11
  "import": "./dist/index.js",
12
12
  "default": "./dist/index.js"
13
13
  },
14
- "./adapter": {
15
- "types": "./dist/adapter/index.d.ts",
16
- "import": "./dist/adapter/index.js",
17
- "default": "./dist/adapter/index.js"
18
- },
19
- "./app": {
20
- "types": "./dist/app.d.ts",
21
- "import": "./dist/app.js",
22
- "default": "./dist/app.js"
23
- },
24
- "./app-surface": {
25
- "types": "./dist/app-surface.d.ts",
26
- "import": "./dist/app-surface.js",
27
- "default": "./dist/app-surface.js"
28
- },
29
- "./artifacts": {
30
- "types": "./dist/artifacts/index.d.ts",
31
- "import": "./dist/artifacts/index.js",
32
- "default": "./dist/artifacts/index.js"
33
- },
34
- "./assistant": {
35
- "types": "./dist/assistant/index.d.ts",
36
- "import": "./dist/assistant/index.js",
37
- "default": "./dist/assistant/index.js"
38
- },
39
- "./express": {
40
- "types": "./dist/express.d.ts",
41
- "import": "./dist/express.js",
42
- "default": "./dist/express.js"
43
- },
44
- "./express-assistant": {
45
- "types": "./dist/express-assistant.d.ts",
46
- "import": "./dist/express-assistant.js",
47
- "default": "./dist/express-assistant.js"
48
- },
49
- "./feedback": {
50
- "types": "./dist/feedback/index.d.ts",
51
- "import": "./dist/feedback/index.js",
52
- "default": "./dist/feedback/index.js"
53
- },
54
14
  "./history": {
55
15
  "types": "./dist/history/index.d.ts",
56
16
  "import": "./dist/history/index.js",
@@ -71,20 +31,10 @@
71
31
  "import": "./dist/shared/index.js",
72
32
  "default": "./dist/shared/index.js"
73
33
  },
74
- "./socket": {
75
- "types": "./dist/socket.d.ts",
76
- "import": "./dist/socket.js",
77
- "default": "./dist/socket.js"
78
- },
79
34
  "./source": {
80
35
  "types": "./dist/source/index.d.ts",
81
36
  "import": "./dist/source/index.js",
82
37
  "default": "./dist/source/index.js"
83
- },
84
- "./views": {
85
- "types": "./dist/views/index.d.ts",
86
- "import": "./dist/views/index.js",
87
- "default": "./dist/views/index.js"
88
38
  }
89
39
  },
90
40
  "files": [
@@ -94,7 +44,7 @@
94
44
  ],
95
45
  "dependencies": {
96
46
  "@cuylabs/agent-core": "^7.2.0",
97
- "@cuylabs/channel-slack": "^0.9.0"
47
+ "@cuylabs/channel-slack": "^0.11.0"
98
48
  },
99
49
  "peerDependencies": {
100
50
  "@slack/bolt": ">=4.7.3",
@@ -144,9 +94,9 @@
144
94
  "node": ">=20"
145
95
  },
146
96
  "scripts": {
147
- "build": "tsup src/index.ts src/shared/index.ts src/adapter/index.ts src/app.ts src/app-surface.ts src/artifacts/index.ts src/assistant/index.ts src/express.ts src/express-assistant.ts src/feedback/index.ts src/history/index.ts src/interactive/index.ts src/mcp.ts src/socket.ts src/source/index.ts src/views/index.ts --format esm --dts --clean",
97
+ "build": "tsup src/index.ts src/shared/index.ts src/history/index.ts src/interactive/index.ts src/mcp.ts src/source/index.ts --format esm --dts --clean",
148
98
  "clean": "rm -rf dist",
149
- "dev": "tsup src/index.ts src/shared/index.ts src/adapter/index.ts src/app.ts src/app-surface.ts src/artifacts/index.ts src/assistant/index.ts src/express.ts src/express-assistant.ts src/feedback/index.ts src/history/index.ts src/interactive/index.ts src/mcp.ts src/socket.ts src/source/index.ts src/views/index.ts --format esm --dts --watch",
99
+ "dev": "tsup src/index.ts src/shared/index.ts src/history/index.ts src/interactive/index.ts src/mcp.ts src/source/index.ts --format esm --dts --watch",
150
100
  "lint": "eslint \"src/**/*.{ts,tsx}\" \"tests/**/*.{ts,tsx}\" --max-warnings=0",
151
101
  "test": "vitest run",
152
102
  "test:watch": "vitest",
@@ -1,26 +0,0 @@
1
- export { c as createSlackChannelAdapter } from '../adapter-vbqtraAr.js';
2
- import { a as SlackChannelOptions } from '../types-BeGPexio.js';
3
- export { S as SlackChannelAdapter, b as SlackSessionStrategy, c as SlackStreamingMode, d as SlackToolStartEvent } from '../types-BeGPexio.js';
4
- import { SlackActivityInfo } from '@cuylabs/channel-slack/core';
5
- import '@cuylabs/agent-core';
6
- import '../options-CGUfVStV.js';
7
- import '../artifacts/index.js';
8
- import '@cuylabs/channel-slack/artifacts';
9
- import '../interactive-BigrPKnu.js';
10
- import '@cuylabs/channel-slack/interactive';
11
-
12
- /**
13
- * Session mapping — Slack activity info to agent-core session IDs.
14
- *
15
- * The default strategy (`"thread-aware"`) produces natural conversation
16
- * groupings by using the thread timestamp when present and falling back to
17
- * the channel ID for DMs and top-level messages.
18
- */
19
-
20
- interface SlackSessionMap {
21
- /** Resolve (or create) a session ID for the given Slack activity. */
22
- resolve(info: SlackActivityInfo): string | Promise<string>;
23
- }
24
- declare function createSlackSessionMap(options: SlackChannelOptions): SlackSessionMap;
25
-
26
- export { SlackChannelOptions, type SlackSessionMap, createSlackSessionMap };
@@ -1,9 +0,0 @@
1
- import {
2
- createSlackChannelAdapter,
3
- createSlackSessionMap
4
- } from "../chunk-XA7U3GRN.js";
5
- import "../chunk-VBGQD6JT.js";
6
- export {
7
- createSlackChannelAdapter,
8
- createSlackSessionMap
9
- };
@@ -1,31 +0,0 @@
1
- import { a as SlackChannelOptions, S as SlackChannelAdapter } from './types-BeGPexio.js';
2
-
3
- /**
4
- * Slack Channel Adapter
5
- *
6
- * Creates a configured Bolt handler that bridges an agent-core Agent (or any
7
- * `AgentTurnSource`) to Slack via @slack/bolt.
8
- *
9
- * The adapter mounts message/event handlers on a Bolt `App` instance and
10
- * processes each turn by:
11
- * 1. Parsing the Slack event into a `SlackActivityInfo`.
12
- * 2. Resolving a session ID via the configured session strategy.
13
- * 3. Calling `source.chat()` with the user message.
14
- * 4. Streaming the response back to Slack via progressive updates or a
15
- * single final post.
16
- *
17
- * @example
18
- * ```ts
19
- * import { App } from "@slack/bolt";
20
- * import { createSlackChannelAdapter } from "@cuylabs/channel-slack-agent-core";
21
- *
22
- * const app = new App({ token: process.env.SLACK_BOT_TOKEN, signingSecret: process.env.SLACK_SIGNING_SECRET });
23
- * const adapter = createSlackChannelAdapter({ agent });
24
- * adapter.mount(app);
25
- * await app.start(3000);
26
- * ```
27
- */
28
-
29
- declare function createSlackChannelAdapter(options: SlackChannelOptions): SlackChannelAdapter;
30
-
31
- export { createSlackChannelAdapter as c };
@@ -1,82 +0,0 @@
1
- import { AgentTurnSource, Logger } from '@cuylabs/agent-core';
2
- import { App } from '@slack/bolt';
3
- import { WebClient } from '@slack/web-api';
4
- import { C as CreateSlackAssistantBridgeOptions, d as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-ByNm2o89.js';
5
- import { a as SlackChannelOptions } from './types-BeGPexio.js';
6
- import { SlackTurnRequestContext, SlackAssistantUtilities, SlackTurnPreparation } from '@cuylabs/channel-slack/core';
7
- import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
8
- import { a as SlackInteractiveController } from './types-Bz4OYEAV.js';
9
- import { d as SlackAgentViewWorkflowController } from './types-CiwGU6zC.js';
10
- import './interactive-BigrPKnu.js';
11
- import '@cuylabs/channel-slack/interactive';
12
- import './options-CGUfVStV.js';
13
- import './artifacts/index.js';
14
- import '@cuylabs/channel-slack/artifacts';
15
- import '@cuylabs/channel-slack/assistant';
16
- import '@cuylabs/channel-slack/views';
17
-
18
- /**
19
- * Shared installer for the direct Slack app surfaces.
20
- *
21
- * HTTP Events API and Socket Mode differ only in how Bolt receives inbound
22
- * events. The Assistant pane, app_mention, DM/channel routing, feedback, and
23
- * interactive request wiring are mounted here so both transports behave the
24
- * same.
25
- */
26
-
27
- interface MountSlackAgentAppTurnRequestContext extends SlackTurnRequestContext {
28
- /** Present only for Assistant-pane turns. */
29
- assistant?: SlackAssistantUtilities;
30
- /** Present for Assistant-pane turns; use direct history helpers for Slack API context. */
31
- client?: WebClient;
32
- /** Raw Bolt assistant args for advanced hosts. */
33
- rawArgs?: unknown;
34
- }
35
- interface SlackAgentAppSurfaceOptions extends Omit<CreateSlackAssistantBridgeOptions, "feedback" | "source" | "prepareTurn" | "resolveSession" | "handleInteractiveRequest"> {
36
- /** Source of agent turns. */
37
- source: AgentTurnSource;
38
- /**
39
- * Prepare an agent turn for every direct Slack surface registered by this
40
- * mount: Assistant pane, @mentions, and DMs.
41
- */
42
- prepareTurn?: (request: MountSlackAgentAppTurnRequestContext) => SlackTurnPreparation | Promise<SlackTurnPreparation>;
43
- /**
44
- * Resolve the agent session for every direct Slack surface. Returning
45
- * `undefined` falls back to the configured session strategy.
46
- */
47
- resolveSession?: (request: MountSlackAgentAppTurnRequestContext) => string | undefined | Promise<string | undefined>;
48
- /** Register `app.event("app_mention", ...)`. @default true */
49
- respondToMentions?: boolean;
50
- /** Register `app.message(...)` for DMs. @default true */
51
- respondToMessages?: boolean;
52
- /** Forward plain channel/group messages too. @default false */
53
- respondToChannelMessages?: boolean;
54
- /** Resolve or skip classic Slack channel-adapter messages. Return undefined to skip. */
55
- resolveMessage?: SlackChannelOptions["resolveMessage"];
56
- /** Feedback config. Pass `false` to omit feedback blocks. */
57
- feedback?: SlackAssistantFeedbackConfig | false;
58
- /** Convenience feedback handler. Ignored when `feedback` is set. */
59
- onFeedback?: SlackFeedbackHandler;
60
- /** Maximum turn runtime in ms. Set `0` to disable. @default 120_000 */
61
- timeoutMs?: number;
62
- /** Optional logger for diagnostics. */
63
- logger?: Logger;
64
- /**
65
- * Slack-native approval/human-input controller. Pair this with
66
- * `interactive.approval.onRequest` / `interactive.humanInput.onRequest` in
67
- * the agent config, or with `interactive.onResolve` for server-backed turns.
68
- */
69
- interactive?: SlackInteractiveController;
70
- /**
71
- * Product/agent Slack modal workflow controller. Use this for workflows that
72
- * are richer than approval/human-input, such as incident triage forms or
73
- * report-generation setup modals.
74
- */
75
- viewWorkflows?: SlackAgentViewWorkflowController;
76
- }
77
- interface SlackAgentAppSurfaceResult {
78
- bridge: SlackAssistantBridge;
79
- }
80
- declare function installSlackAgentAppSurface(boltApp: App, options: SlackAgentAppSurfaceOptions): SlackAgentAppSurfaceResult;
81
-
82
- export { type MountSlackAgentAppTurnRequestContext, type SlackAgentAppSurfaceOptions, type SlackAgentAppSurfaceResult, installSlackAgentAppSurface };
@@ -1,10 +0,0 @@
1
- import {
2
- installSlackAgentAppSurface
3
- } from "./chunk-GKZRDNEB.js";
4
- import "./chunk-FJP6ZFUB.js";
5
- import "./chunk-ELR6MQD7.js";
6
- import "./chunk-XA7U3GRN.js";
7
- import "./chunk-VBGQD6JT.js";
8
- export {
9
- installSlackAgentAppSurface
10
- };
package/dist/app.d.ts DELETED
@@ -1,60 +0,0 @@
1
- import { Server } from 'node:http';
2
- import { Application } from 'express';
3
- import { App, ExpressReceiver } from '@slack/bolt';
4
- import { CreateSlackBoltAppOptions } from '@cuylabs/channel-slack/transports/http';
5
- import { SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/auth';
6
- import { SlackAgentAppSurfaceOptions } from './app-surface.js';
7
- export { MountSlackAgentAppTurnRequestContext } from './app-surface.js';
8
- import { S as SlackAssistantBridge } from './options-ByNm2o89.js';
9
- import '@cuylabs/agent-core';
10
- import '@slack/web-api';
11
- import './types-BeGPexio.js';
12
- import '@cuylabs/channel-slack/core';
13
- import './options-CGUfVStV.js';
14
- import './artifacts/index.js';
15
- import '@cuylabs/channel-slack/artifacts';
16
- import './interactive-BigrPKnu.js';
17
- import '@cuylabs/channel-slack/interactive';
18
- import '@cuylabs/channel-slack/feedback';
19
- import './types-Bz4OYEAV.js';
20
- import './types-CiwGU6zC.js';
21
- import '@cuylabs/channel-slack/views';
22
- import '@cuylabs/channel-slack/assistant';
23
-
24
- /**
25
- * Unified Slack agent app over the HTTP Events API.
26
- *
27
- * This file owns only the HTTP/Bolt receiver lifecycle. The actual Slack
28
- * surfaces (Assistant pane, app mentions, DMs/channel messages, feedback, and
29
- * interactive requests) are mounted by `installSlackAgentAppSurface` so Socket
30
- * Mode gets the exact same behavior.
31
- */
32
-
33
- interface MountSlackAgentAppOptions extends SlackAgentAppSurfaceOptions, Omit<CreateSlackBoltAppOptions, "app" | "path" | "botToken" | "signingSecret" | "auth"> {
34
- /** Slack bot token (`xoxb-...`). @default process.env.SLACK_BOT_TOKEN */
35
- botToken?: string;
36
- /** Slack signing secret. @default process.env.SLACK_SIGNING_SECRET */
37
- signingSecret?: string;
38
- /** Direct-mode auth config (single-workspace, OAuth, custom). */
39
- auth?: SlackDirectAuthOptions;
40
- /** Slack Events API callback path. @default "/slack/events" */
41
- path?: string;
42
- /** Port to listen on. @default process.env.PORT || 3000 */
43
- port?: number | null;
44
- /** Optional host for `app.listen(port, host)`. */
45
- host?: string;
46
- /** Pre-existing Express app. */
47
- app?: Application;
48
- }
49
- interface MountSlackAgentAppResult {
50
- app: Application;
51
- boltApp: App;
52
- receiver: ExpressReceiver;
53
- authMode: SlackDirectAuthMode;
54
- routePath: string;
55
- bridge: SlackAssistantBridge;
56
- server?: Server;
57
- }
58
- declare function mountSlackAgentApp(options: MountSlackAgentAppOptions): Promise<MountSlackAgentAppResult>;
59
-
60
- export { type MountSlackAgentAppOptions, type MountSlackAgentAppResult, mountSlackAgentApp };
package/dist/app.js DELETED
@@ -1,11 +0,0 @@
1
- import {
2
- mountSlackAgentApp
3
- } from "./chunk-KAEZPS3U.js";
4
- import "./chunk-GKZRDNEB.js";
5
- import "./chunk-FJP6ZFUB.js";
6
- import "./chunk-ELR6MQD7.js";
7
- import "./chunk-XA7U3GRN.js";
8
- import "./chunk-VBGQD6JT.js";
9
- export {
10
- mountSlackAgentApp
11
- };