@cuylabs/channel-slack-agent-core 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -10
- package/dist/{chunk-L5RAGYVJ.js → chunk-U6RC4SXN.js} +87 -1
- package/dist/history/index.d.ts +7 -17
- package/dist/index.d.ts +4 -28
- package/dist/index.js +12 -60
- package/dist/interactive/index.d.ts +86 -7
- package/dist/shared/index.d.ts +121 -8
- package/dist/shared/index.js +4 -4
- package/docs/README.md +0 -1
- package/docs/concepts/final-response-artifacts.md +9 -7
- package/docs/concepts/tool-task-rendering.md +2 -0
- package/docs/reference/exports.md +10 -20
- package/package.json +4 -54
- package/dist/adapter/index.d.ts +0 -26
- package/dist/adapter/index.js +0 -9
- package/dist/adapter-vbqtraAr.d.ts +0 -31
- package/dist/app-surface.d.ts +0 -82
- package/dist/app-surface.js +0 -10
- package/dist/app.d.ts +0 -60
- package/dist/app.js +0 -11
- package/dist/artifacts/index.d.ts +0 -57
- package/dist/artifacts/index.js +0 -6
- package/dist/assistant/index.d.ts +0 -22
- package/dist/assistant/index.js +0 -14
- package/dist/chunk-6EMFBOXD.js +0 -67
- package/dist/chunk-A2PLAVW6.js +0 -75
- package/dist/chunk-C7CHMYV6.js +0 -226
- package/dist/chunk-DS6E5OEJ.js +0 -85
- package/dist/chunk-ELR6MQD7.js +0 -12
- package/dist/chunk-GEFK72VO.js +0 -921
- package/dist/chunk-KQPUQJ57.js +0 -482
- package/dist/chunk-NNCVHQC4.js +0 -94
- package/dist/chunk-P2DIC42J.js +0 -77
- package/dist/chunk-Q2GU4QLZ.js +0 -187
- package/dist/chunk-QFDXKCAQ.js +0 -82
- package/dist/express-assistant.d.ts +0 -106
- package/dist/express-assistant.js +0 -9
- package/dist/express.d.ts +0 -103
- package/dist/express.js +0 -8
- package/dist/feedback/index.d.ts +0 -1
- package/dist/feedback/index.js +0 -10
- package/dist/options-ByNm2o89.d.ts +0 -323
- package/dist/options-CGUfVStV.d.ts +0 -119
- package/dist/socket.d.ts +0 -143
- package/dist/socket.js +0 -13
- package/dist/types-BeGPexio.d.ts +0 -381
- package/dist/types-Bz4OYEAV.d.ts +0 -87
- package/dist/types-CiwGU6zC.d.ts +0 -56
- package/dist/views/index.d.ts +0 -8
- package/dist/views/index.js +0 -10
- package/docs/concepts/view-workflows.md +0 -52
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
# Exports
|
|
2
2
|
|
|
3
|
-
Use feature subpaths when you only need one
|
|
4
|
-
primitives
|
|
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
|
|
7
|
-
|
|
|
8
|
-
| `@cuylabs/channel-slack-agent-core`
|
|
9
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
10
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
11
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
12
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
13
|
-
| `@cuylabs/channel-slack-agent-core/
|
|
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.
|
|
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.
|
|
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/
|
|
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/
|
|
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",
|
package/dist/adapter/index.d.ts
DELETED
|
@@ -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 };
|
package/dist/adapter/index.js
DELETED
|
@@ -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 };
|
package/dist/app-surface.d.ts
DELETED
|
@@ -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 };
|
package/dist/app-surface.js
DELETED
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-P2DIC42J.js";
|
|
4
|
-
import "./chunk-Q2GU4QLZ.js";
|
|
5
|
-
import "./chunk-GEFK72VO.js";
|
|
6
|
-
import "./chunk-ELR6MQD7.js";
|
|
7
|
-
import "./chunk-KQPUQJ57.js";
|
|
8
|
-
import "./chunk-L5RAGYVJ.js";
|
|
9
|
-
export {
|
|
10
|
-
mountSlackAgentApp
|
|
11
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { SlackArtifactClient, SlackArtifactPublication } from '@cuylabs/channel-slack/artifacts';
|
|
2
|
-
|
|
3
|
-
interface SlackFinalResponseArtifactContext {
|
|
4
|
-
text: string;
|
|
5
|
-
formattedText: string;
|
|
6
|
-
client: SlackArtifactClient;
|
|
7
|
-
channelId: string;
|
|
8
|
-
threadTs?: string;
|
|
9
|
-
}
|
|
10
|
-
interface SlackFinalResponseArtifactResult {
|
|
11
|
-
publication: SlackArtifactPublication;
|
|
12
|
-
}
|
|
13
|
-
type SlackFinalResponseArtifactDeliveryMode = "supplemental" | "replace";
|
|
14
|
-
type SlackFinalResponseArtifactPublisher = (context: SlackFinalResponseArtifactContext) => Promise<SlackFinalResponseArtifactResult | undefined>;
|
|
15
|
-
type SlackFinalResponseArtifactValueResolver<T> = T | ((context: SlackFinalResponseArtifactContext) => T | Promise<T>);
|
|
16
|
-
interface CreateSlackFinalResponseArtifactPublisherOptions {
|
|
17
|
-
/**
|
|
18
|
-
* Minimum raw-response characters required before publishing an artifact.
|
|
19
|
-
*
|
|
20
|
-
* @default 4000
|
|
21
|
-
*/
|
|
22
|
-
minCharacters?: number;
|
|
23
|
-
/**
|
|
24
|
-
* Canvas/file title.
|
|
25
|
-
*
|
|
26
|
-
* @default "Agent response"
|
|
27
|
-
*/
|
|
28
|
-
title?: SlackFinalResponseArtifactValueResolver<string | undefined>;
|
|
29
|
-
/**
|
|
30
|
-
* Optional Slack artifact summary.
|
|
31
|
-
*/
|
|
32
|
-
summary?: SlackFinalResponseArtifactValueResolver<string | undefined>;
|
|
33
|
-
/**
|
|
34
|
-
* Prefer creating a channel canvas when the Slack client exposes
|
|
35
|
-
* `conversations.canvases.create`.
|
|
36
|
-
*
|
|
37
|
-
* @default true
|
|
38
|
-
*/
|
|
39
|
-
channelCanvas?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Fallback when Canvas publication fails.
|
|
42
|
-
*
|
|
43
|
-
* @default "file"
|
|
44
|
-
*/
|
|
45
|
-
fallback?: "file" | "none";
|
|
46
|
-
/**
|
|
47
|
-
* Called after a Canvas or fallback file is published.
|
|
48
|
-
*/
|
|
49
|
-
onPublished?: (result: SlackFinalResponseArtifactResult, context: SlackFinalResponseArtifactContext) => void | Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Called when Canvas publication fails and no fallback publication succeeds.
|
|
52
|
-
*/
|
|
53
|
-
onError?: (error: unknown, context: SlackFinalResponseArtifactContext) => void | Promise<void>;
|
|
54
|
-
}
|
|
55
|
-
declare function createSlackFinalResponseArtifactPublisher({ minCharacters, title, summary, channelCanvas, fallback, onPublished, onError, }?: CreateSlackFinalResponseArtifactPublisherOptions): SlackFinalResponseArtifactPublisher;
|
|
56
|
-
|
|
57
|
-
export { type CreateSlackFinalResponseArtifactPublisherOptions, type SlackFinalResponseArtifactContext, type SlackFinalResponseArtifactDeliveryMode, type SlackFinalResponseArtifactPublisher, type SlackFinalResponseArtifactResult, type SlackFinalResponseArtifactValueResolver, createSlackFinalResponseArtifactPublisher };
|
package/dist/artifacts/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { C as CreateSlackAssistantBridgeOptions, S as SlackAssistantBridge } from '../options-ByNm2o89.js';
|
|
2
|
-
export { A as AssistantLifecycleArgs, a as AssistantThreadStartedArgs, M as MaybePromise, 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';
|
|
3
|
-
export { ParsedAssistantUserMessage, createSlackAssistantThreadContextStore, parseSlackMessageActivityFromMessageEvent } from '@cuylabs/channel-slack/assistant';
|
|
4
|
-
import '@cuylabs/agent-core';
|
|
5
|
-
import '@slack/bolt';
|
|
6
|
-
import '@slack/web-api';
|
|
7
|
-
import '@cuylabs/channel-slack/core';
|
|
8
|
-
import '../interactive-BigrPKnu.js';
|
|
9
|
-
import '@cuylabs/channel-slack/interactive';
|
|
10
|
-
import '../options-CGUfVStV.js';
|
|
11
|
-
import '../artifacts/index.js';
|
|
12
|
-
import '@cuylabs/channel-slack/artifacts';
|
|
13
|
-
import '@cuylabs/channel-slack/feedback';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* `createSlackAssistantBridge` factory — assembles the three lifecycle
|
|
17
|
-
* middlewares into a Bolt `Assistant` and wires the feedback action handler.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
declare function createSlackAssistantBridge(options: CreateSlackAssistantBridgeOptions): SlackAssistantBridge;
|
|
21
|
-
|
|
22
|
-
export { CreateSlackAssistantBridgeOptions, SlackAssistantBridge, createSlackAssistantBridge };
|
package/dist/assistant/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createSlackAssistantBridge,
|
|
3
|
-
createSlackAssistantThreadContextStore,
|
|
4
|
-
parseSlackMessageActivityFromMessageEvent,
|
|
5
|
-
resolveAssistantSessionId
|
|
6
|
-
} from "../chunk-GEFK72VO.js";
|
|
7
|
-
import "../chunk-ELR6MQD7.js";
|
|
8
|
-
import "../chunk-L5RAGYVJ.js";
|
|
9
|
-
export {
|
|
10
|
-
createSlackAssistantBridge,
|
|
11
|
-
createSlackAssistantThreadContextStore,
|
|
12
|
-
parseSlackMessageActivityFromMessageEvent,
|
|
13
|
-
resolveAssistantSessionId
|
|
14
|
-
};
|
package/dist/chunk-6EMFBOXD.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
installSlackAgentAppSurface
|
|
3
|
-
} from "./chunk-Q2GU4QLZ.js";
|
|
4
|
-
import {
|
|
5
|
-
createSlackAssistantBridge
|
|
6
|
-
} from "./chunk-GEFK72VO.js";
|
|
7
|
-
|
|
8
|
-
// src/socket.ts
|
|
9
|
-
import { createSlackSocketBoltApp } from "@cuylabs/channel-slack/transports/socket";
|
|
10
|
-
async function mountSlackAssistantAgentSocket(options) {
|
|
11
|
-
const {
|
|
12
|
-
appToken: appTokenOption,
|
|
13
|
-
botToken: botTokenOption,
|
|
14
|
-
auth,
|
|
15
|
-
boltAppOptions,
|
|
16
|
-
socketModeReceiverOptions,
|
|
17
|
-
feedback: feedbackOption,
|
|
18
|
-
onFeedback,
|
|
19
|
-
start,
|
|
20
|
-
...bridgeOptions
|
|
21
|
-
} = options;
|
|
22
|
-
const { boltApp, authMode } = await createSlackSocketBoltApp({
|
|
23
|
-
appToken: appTokenOption,
|
|
24
|
-
botToken: botTokenOption,
|
|
25
|
-
auth,
|
|
26
|
-
boltAppOptions,
|
|
27
|
-
socketModeReceiverOptions
|
|
28
|
-
});
|
|
29
|
-
const feedback = feedbackOption !== void 0 ? feedbackOption : onFeedback ? { onFeedback } : void 0;
|
|
30
|
-
const bridge = createSlackAssistantBridge({
|
|
31
|
-
...bridgeOptions,
|
|
32
|
-
...feedback !== void 0 ? { feedback } : {}
|
|
33
|
-
});
|
|
34
|
-
bridge.install(boltApp);
|
|
35
|
-
if (start !== false) {
|
|
36
|
-
await boltApp.start();
|
|
37
|
-
}
|
|
38
|
-
return { boltApp, bridge, authMode };
|
|
39
|
-
}
|
|
40
|
-
async function mountSlackAgentAppSocket(options) {
|
|
41
|
-
const {
|
|
42
|
-
appToken: appTokenOption,
|
|
43
|
-
botToken: botTokenOption,
|
|
44
|
-
auth,
|
|
45
|
-
boltAppOptions,
|
|
46
|
-
socketModeReceiverOptions,
|
|
47
|
-
start,
|
|
48
|
-
...surfaceOptions
|
|
49
|
-
} = options;
|
|
50
|
-
const { boltApp, authMode } = await createSlackSocketBoltApp({
|
|
51
|
-
appToken: appTokenOption,
|
|
52
|
-
botToken: botTokenOption,
|
|
53
|
-
auth,
|
|
54
|
-
boltAppOptions,
|
|
55
|
-
socketModeReceiverOptions
|
|
56
|
-
});
|
|
57
|
-
const { bridge } = installSlackAgentAppSurface(boltApp, surfaceOptions);
|
|
58
|
-
if (start !== false) {
|
|
59
|
-
await boltApp.start();
|
|
60
|
-
}
|
|
61
|
-
return { boltApp, bridge, authMode };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
mountSlackAssistantAgentSocket,
|
|
66
|
-
mountSlackAgentAppSocket
|
|
67
|
-
};
|
package/dist/chunk-A2PLAVW6.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// src/shared/context-fragments.ts
|
|
2
|
-
import {
|
|
3
|
-
currentSlackTurnContext
|
|
4
|
-
} from "@cuylabs/channel-slack/core";
|
|
5
|
-
var DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY = "slackContextFragment";
|
|
6
|
-
function isRecord(value) {
|
|
7
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8
|
-
}
|
|
9
|
-
function isPayload(value) {
|
|
10
|
-
return isRecord(value) && typeof value.content === "string";
|
|
11
|
-
}
|
|
12
|
-
function resolveContextBagValue(slack, key) {
|
|
13
|
-
const value = slack.context?.[key];
|
|
14
|
-
if (typeof value === "string") {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
if (isPayload(value)) {
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
function resolveDedupeKey(options, context) {
|
|
23
|
-
return typeof options.dedupeKey === "function" ? options.dedupeKey(context) : options.dedupeKey;
|
|
24
|
-
}
|
|
25
|
-
function resolveMetadata(options, context) {
|
|
26
|
-
return typeof options.metadata === "function" ? options.metadata(context) : options.metadata;
|
|
27
|
-
}
|
|
28
|
-
function normalizeFragment(resolved, options, context) {
|
|
29
|
-
const payload = typeof resolved === "string" ? { content: resolved } : isPayload(resolved) ? resolved : void 0;
|
|
30
|
-
if (!payload) {
|
|
31
|
-
return resolved;
|
|
32
|
-
}
|
|
33
|
-
if (payload.content.trim().length === 0) {
|
|
34
|
-
return void 0;
|
|
35
|
-
}
|
|
36
|
-
const dedupeKey = payload.dedupeKey ?? resolveDedupeKey(options, context);
|
|
37
|
-
const metadata = payload.metadata ?? resolveMetadata(options, context);
|
|
38
|
-
const maxChars = payload.maxChars ?? options.maxChars;
|
|
39
|
-
return {
|
|
40
|
-
kind: payload.kind ?? options.kind ?? "slack-context",
|
|
41
|
-
content: payload.content,
|
|
42
|
-
role: payload.role ?? options.role ?? "user",
|
|
43
|
-
placement: payload.placement ?? options.placement ?? "after-latest-user",
|
|
44
|
-
lifetime: payload.lifetime ?? options.lifetime ?? "turn",
|
|
45
|
-
source: payload.source ?? options.source ?? "slack",
|
|
46
|
-
title: payload.title ?? options.title ?? "Slack Context",
|
|
47
|
-
budgetBehavior: payload.budgetBehavior ?? options.budgetBehavior ?? "droppable",
|
|
48
|
-
...maxChars !== void 0 ? { maxChars } : {},
|
|
49
|
-
...dedupeKey ? { dedupeKey } : {},
|
|
50
|
-
...metadata ? { metadata } : {}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function createSlackContextFragmentMiddleware(options = {}) {
|
|
54
|
-
const contextKey = options.contextKey ?? DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY;
|
|
55
|
-
return {
|
|
56
|
-
name: options.name ?? "slack-context-fragment",
|
|
57
|
-
async contextFragments(step) {
|
|
58
|
-
const slack = currentSlackTurnContext();
|
|
59
|
-
if (!slack) {
|
|
60
|
-
return void 0;
|
|
61
|
-
}
|
|
62
|
-
const context = { slack, step };
|
|
63
|
-
const resolved = options.resolve ? await options.resolve(context) : resolveContextBagValue(slack, contextKey);
|
|
64
|
-
if (resolved === void 0) {
|
|
65
|
-
return void 0;
|
|
66
|
-
}
|
|
67
|
-
return normalizeFragment(resolved, options, context);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
DEFAULT_SLACK_CONTEXT_FRAGMENT_KEY,
|
|
74
|
-
createSlackContextFragmentMiddleware
|
|
75
|
-
};
|