@cuylabs/channel-slack-agent-core 0.10.0 → 0.12.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 +18 -11
- package/dist/{chunk-L5RAGYVJ.js → chunk-U6RC4SXN.js} +87 -1
- package/dist/history/index.d.ts +7 -17
- package/dist/index.d.ts +2 -29
- package/dist/index.js +12 -64
- package/dist/shared/index.d.ts +146 -10
- package/dist/shared/index.js +4 -4
- package/docs/README.md +2 -4
- package/docs/concepts/final-response-artifacts.md +9 -7
- package/docs/concepts/interactive-requests.md +31 -26
- package/docs/concepts/tool-task-rendering.md +2 -0
- package/docs/reference/boundary.md +6 -4
- package/docs/reference/exports.md +14 -20
- package/package.json +4 -59
- 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-OP27SSZU.js +0 -409
- 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/interactive/index.d.ts +0 -11
- package/dist/interactive/index.js +0 -6
- package/dist/interactive-BigrPKnu.d.ts +0 -30
- 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,43 +1,48 @@
|
|
|
1
1
|
# Interactive Requests
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Agent Core approval and human-input events are mapped into the runtime-neutral
|
|
4
|
+
Slack event stream by `adaptAgentTurnSourceToSlackTurnSource`. The Slack-native
|
|
5
|
+
controller lives in `@cuylabs/channel-slack/interactive`; do not import it from
|
|
6
|
+
`@cuylabs/channel-slack-agent-core/interactive`.
|
|
5
7
|
|
|
6
8
|
```typescript
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
9
|
+
import {
|
|
10
|
+
createPostgresSlackInteractiveRequestStore,
|
|
11
|
+
createSlackInteractiveController,
|
|
12
|
+
} from "@cuylabs/channel-slack/interactive";
|
|
13
|
+
import { mountSlackAppSocket } from "@cuylabs/channel-slack/socket";
|
|
14
|
+
import { adaptAgentTurnSourceToSlackTurnSource } from "@cuylabs/channel-slack-agent-core";
|
|
14
15
|
|
|
15
16
|
const interactive = createSlackInteractiveController({
|
|
16
|
-
store:
|
|
17
|
+
store: createPostgresSlackInteractiveRequestStore({
|
|
18
|
+
connectionString: process.env.DATABASE_URL,
|
|
19
|
+
schema: "agent",
|
|
20
|
+
}),
|
|
17
21
|
namespace: "my_agent_slack",
|
|
18
22
|
requestTimeoutMs: 5 * 60 * 1000,
|
|
19
23
|
});
|
|
20
24
|
|
|
21
|
-
// Wire these into the Agent Core runtime:
|
|
25
|
+
// Wire these into the Agent Core runtime that owns the pause/resume decision:
|
|
22
26
|
// approval: { onRequest: interactive.approval.onRequest }
|
|
23
27
|
// humanInput: { onRequest: interactive.humanInput.onRequest }
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
await mountSlackAppSocket({
|
|
30
|
+
source: adaptAgentTurnSourceToSlackTurnSource(agent),
|
|
31
|
+
interactive,
|
|
32
|
+
appToken: process.env.SLACK_APP_TOKEN,
|
|
33
|
+
botToken: process.env.SLACK_BOT_TOKEN,
|
|
34
|
+
});
|
|
27
35
|
```
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
`@cuylabs/channel-slack/interactive` is useful for tests and local
|
|
33
|
-
single-process apps.
|
|
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
|
+
`mountSlackApp` and `mountSlackAppSocket` install the controller on the Bolt app
|
|
38
|
+
and route interactive request events from the Slack renderer to
|
|
39
|
+
`interactive.handleInteractiveRequest`.
|
|
37
40
|
|
|
38
|
-
The
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
The controller persists pending requests before rendering Slack buttons. It uses
|
|
42
|
+
first-wins resolution semantics, so duplicate Slack clicks return the stored
|
|
43
|
+
resolution instead of overwriting it. Request IDs must be unique across pending
|
|
44
|
+
approval and human-input requests.
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
`
|
|
46
|
+
By default, only the Slack user who triggered the original turn can resolve the
|
|
47
|
+
request. Pass `authorize(record, actor)` to the controller to allow delegated
|
|
48
|
+
approvers or workspace policy.
|
|
@@ -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",
|
|
@@ -7,17 +7,19 @@ This package owns only the `@cuylabs/agent-core` Slack binding.
|
|
|
7
7
|
- Mapping Slack turns to `AgentTurnSource.chat(...)`.
|
|
8
8
|
- Creating Agent Core scopes and context fragments.
|
|
9
9
|
- Converting `AgentEvent` streams through Slack response sink contracts.
|
|
10
|
-
-
|
|
10
|
+
- Adapting Agent Core sources for the runtime-neutral Express Events API and
|
|
11
|
+
Socket Mode mounts in `@cuylabs/channel-slack`.
|
|
11
12
|
- Binding Slack Assistant lifecycle handlers to Agent Core turns.
|
|
12
|
-
-
|
|
13
|
-
|
|
13
|
+
- Mapping Agent Core approval and human-input events into the runtime-neutral
|
|
14
|
+
Slack event stream.
|
|
14
15
|
- Agent Core helpers for Slack history context fragments and source events.
|
|
15
16
|
|
|
16
17
|
## Outside This Package
|
|
17
18
|
|
|
18
19
|
- Generic Slack activity parsing, formatting, setup, auth, policy, history,
|
|
19
20
|
targets, users, entrypoints, artifacts, response sink contracts, interactive
|
|
20
|
-
request builders/stores, and transport factories.
|
|
21
|
+
request builders/stores/controllers, and transport factories.
|
|
22
|
+
- Slack-native rendering and resolution of approvals or human input.
|
|
21
23
|
- Product prompts, tools, audit policy, privacy rules, and deployment policy.
|
|
22
24
|
- Slack app configuration outside the reusable setup helpers.
|
|
23
25
|
|
|
@@ -1,26 +1,20 @@
|
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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, source, and 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/mcp` | `@cuylabs/agent-core/mcp` types | Slack OAuth token bridge for Agent Core MCP setup |
|
|
11
|
+
| `@cuylabs/channel-slack-agent-core/shared` | `@cuylabs/agent-core` types | Context fragments, Agent Core event mapping, and source adaptation |
|
|
12
|
+
| `@cuylabs/channel-slack-agent-core/source` | `@cuylabs/agent-core` types | Agent Core event queue, response helpers, and status visibility helpers |
|
|
13
|
+
|
|
14
|
+
There is intentionally no
|
|
15
|
+
`@cuylabs/channel-slack-agent-core/interactive` export. Use
|
|
16
|
+
`@cuylabs/channel-slack/interactive` for Slack-native approval and human-input
|
|
17
|
+
controllers.
|
|
24
18
|
|
|
25
19
|
For generic Slack package exports, see
|
|
26
20
|
`@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.12.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,56 +11,11 @@
|
|
|
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",
|
|
57
17
|
"default": "./dist/history/index.js"
|
|
58
18
|
},
|
|
59
|
-
"./interactive": {
|
|
60
|
-
"types": "./dist/interactive/index.d.ts",
|
|
61
|
-
"import": "./dist/interactive/index.js",
|
|
62
|
-
"default": "./dist/interactive/index.js"
|
|
63
|
-
},
|
|
64
19
|
"./mcp": {
|
|
65
20
|
"types": "./dist/mcp.d.ts",
|
|
66
21
|
"import": "./dist/mcp.js",
|
|
@@ -71,20 +26,10 @@
|
|
|
71
26
|
"import": "./dist/shared/index.js",
|
|
72
27
|
"default": "./dist/shared/index.js"
|
|
73
28
|
},
|
|
74
|
-
"./socket": {
|
|
75
|
-
"types": "./dist/socket.d.ts",
|
|
76
|
-
"import": "./dist/socket.js",
|
|
77
|
-
"default": "./dist/socket.js"
|
|
78
|
-
},
|
|
79
29
|
"./source": {
|
|
80
30
|
"types": "./dist/source/index.d.ts",
|
|
81
31
|
"import": "./dist/source/index.js",
|
|
82
32
|
"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
33
|
}
|
|
89
34
|
},
|
|
90
35
|
"files": [
|
|
@@ -94,7 +39,7 @@
|
|
|
94
39
|
],
|
|
95
40
|
"dependencies": {
|
|
96
41
|
"@cuylabs/agent-core": "^7.2.0",
|
|
97
|
-
"@cuylabs/channel-slack": "^0.
|
|
42
|
+
"@cuylabs/channel-slack": "^0.12.0"
|
|
98
43
|
},
|
|
99
44
|
"peerDependencies": {
|
|
100
45
|
"@slack/bolt": ">=4.7.3",
|
|
@@ -144,9 +89,9 @@
|
|
|
144
89
|
"node": ">=20"
|
|
145
90
|
},
|
|
146
91
|
"scripts": {
|
|
147
|
-
"build": "tsup src/index.ts src/shared/index.ts src/
|
|
92
|
+
"build": "tsup src/index.ts src/shared/index.ts src/history/index.ts src/mcp.ts src/source/index.ts --format esm --dts --clean",
|
|
148
93
|
"clean": "rm -rf dist",
|
|
149
|
-
"dev": "tsup src/index.ts src/shared/index.ts src/
|
|
94
|
+
"dev": "tsup src/index.ts src/shared/index.ts src/history/index.ts src/mcp.ts src/source/index.ts --format esm --dts --watch",
|
|
150
95
|
"lint": "eslint \"src/**/*.{ts,tsx}\" \"tests/**/*.{ts,tsx}\" --max-warnings=0",
|
|
151
96
|
"test": "vitest run",
|
|
152
97
|
"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
|
-
};
|