@cuylabs/channel-slack-agent-core 0.1.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/LICENSE +201 -0
- package/README.md +80 -0
- package/dist/adapter-Cmd2C90g.d.ts +31 -0
- package/dist/adapter.d.ts +23 -0
- package/dist/adapter.js +13 -0
- package/dist/app-surface.d.ts +71 -0
- package/dist/app-surface.js +12 -0
- package/dist/app.d.ts +54 -0
- package/dist/app.js +14 -0
- package/dist/assistant.d.ts +19 -0
- package/dist/assistant.js +16 -0
- package/dist/bolt.d.ts +8 -0
- package/dist/bolt.js +10 -0
- package/dist/chunk-2SUAW6MV.js +12 -0
- package/dist/chunk-645NNJIM.js +12 -0
- package/dist/chunk-ANIZ5NT4.js +12 -0
- package/dist/chunk-BFUPAJON.js +662 -0
- package/dist/chunk-CYEBGC6G.js +77 -0
- package/dist/chunk-DHPD4XH5.js +827 -0
- package/dist/chunk-FDRQOG7Q.js +471 -0
- package/dist/chunk-GNXWTKQ6.js +48 -0
- package/dist/chunk-HFT2FXJP.js +12 -0
- package/dist/chunk-I2KLQ2HA.js +22 -0
- package/dist/chunk-IWUYIAY5.js +69 -0
- package/dist/chunk-IXY3BXU5.js +689 -0
- package/dist/chunk-JMLB7A2V.js +85 -0
- package/dist/chunk-K2E6A377.js +12 -0
- package/dist/chunk-M64Z6TYL.js +198 -0
- package/dist/chunk-NDVXBI7Z.js +12 -0
- package/dist/chunk-NIPAN4KA.js +76 -0
- package/dist/chunk-PX4RGO3N.js +12 -0
- package/dist/chunk-RFHXERNL.js +27 -0
- package/dist/chunk-VHGV66M7.js +12 -0
- package/dist/chunk-WO4BJMF3.js +82 -0
- package/dist/diagnostics.d.ts +1 -0
- package/dist/diagnostics.js +10 -0
- package/dist/express-assistant.d.ts +102 -0
- package/dist/express-assistant.js +12 -0
- package/dist/express.d.ts +98 -0
- package/dist/express.js +11 -0
- package/dist/feedback.d.ts +1 -0
- package/dist/feedback.js +10 -0
- package/dist/history.d.ts +1 -0
- package/dist/history.js +10 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +202 -0
- package/dist/interactive-o_NZb-Xg.d.ts +47 -0
- package/dist/interactive.d.ts +30 -0
- package/dist/interactive.js +25 -0
- package/dist/mcp.d.ts +84 -0
- package/dist/mcp.js +9 -0
- package/dist/options-C7OYeNR-.d.ts +71 -0
- package/dist/options-Uf-qmQKN.d.ts +263 -0
- package/dist/policy.d.ts +1 -0
- package/dist/policy.js +10 -0
- package/dist/setup.d.ts +1 -0
- package/dist/setup.js +10 -0
- package/dist/shared.d.ts +129 -0
- package/dist/shared.js +20 -0
- package/dist/socket.d.ts +137 -0
- package/dist/socket.js +16 -0
- package/dist/targets.d.ts +1 -0
- package/dist/targets.js +10 -0
- package/dist/types-BqRzb_Cd.d.ts +346 -0
- package/dist/types-Crpil4kb.d.ts +136 -0
- package/dist/users.d.ts +1 -0
- package/dist/users.js +10 -0
- package/package.json +169 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @cuylabs/channel-slack-agent-core
|
|
2
|
+
|
|
3
|
+
Slack adapter for `@cuylabs/agent-core`, built on the SDK-neutral
|
|
4
|
+
`@cuylabs/channel-slack` primitives.
|
|
5
|
+
|
|
6
|
+
Use this package when your agent runtime is `@cuylabs/agent-core` and you want
|
|
7
|
+
ready-to-mount Slack surfaces for Bolt, Express, Socket Mode, Slack Assistant,
|
|
8
|
+
classic app mentions, DMs, and in-channel interactive approval or human-input
|
|
9
|
+
requests.
|
|
10
|
+
|
|
11
|
+
Use `@cuylabs/channel-slack` directly when you want Slack parsing, policy,
|
|
12
|
+
history, setup, auth, or formatting primitives for another agent runtime.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @cuylabs/channel-slack-agent-core @cuylabs/channel-slack @cuylabs/agent-core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Install Slack peer dependencies for the surfaces you use:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @slack/bolt @slack/web-api express
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Import Map
|
|
27
|
+
|
|
28
|
+
Use feature-specific imports when you only need one adapter surface.
|
|
29
|
+
|
|
30
|
+
| Import | Use for |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `@cuylabs/channel-slack-agent-core/adapter` | Classic app mention, DM, and passive channel-message adapter |
|
|
33
|
+
| `@cuylabs/channel-slack-agent-core/assistant` | Slack Assistant bridge and lifecycle handlers |
|
|
34
|
+
| `@cuylabs/channel-slack-agent-core/express` | Express Events API mounting for classic Slack surfaces |
|
|
35
|
+
| `@cuylabs/channel-slack-agent-core/express-assistant` | Express Events API mounting for Slack Assistant |
|
|
36
|
+
| `@cuylabs/channel-slack-agent-core/socket` | Socket Mode mounting helpers |
|
|
37
|
+
| `@cuylabs/channel-slack-agent-core/interactive` | Agent-core approval and human-input binding for Slack |
|
|
38
|
+
| `@cuylabs/channel-slack-agent-core/shared` | Agent-core context fragments and event bridge plus Slack core primitives |
|
|
39
|
+
| `@cuylabs/channel-slack-agent-core/bolt` | Re-exported Bolt helpers from `@cuylabs/channel-slack/bolt` |
|
|
40
|
+
| `@cuylabs/channel-slack-agent-core/history` | Re-exported history helpers from `@cuylabs/channel-slack/history` |
|
|
41
|
+
| `@cuylabs/channel-slack-agent-core/policy` | Re-exported message policy helpers from `@cuylabs/channel-slack/policy` |
|
|
42
|
+
|
|
43
|
+
The package root re-exports the full adapter surface for compatibility and
|
|
44
|
+
convenience. Reusable Slack mechanics continue to live in
|
|
45
|
+
`@cuylabs/channel-slack`; this package only adds the `@cuylabs/agent-core`
|
|
46
|
+
binding.
|
|
47
|
+
|
|
48
|
+
## Socket Mode
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { mountSlackAssistantAgentSocket } from "@cuylabs/channel-slack-agent-core";
|
|
52
|
+
|
|
53
|
+
await mountSlackAssistantAgentSocket({
|
|
54
|
+
source: agent,
|
|
55
|
+
appToken: process.env.SLACK_APP_TOKEN,
|
|
56
|
+
botToken: process.env.SLACK_BOT_TOKEN,
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Express Events API
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { mountSlackAgent } from "@cuylabs/channel-slack-agent-core";
|
|
64
|
+
|
|
65
|
+
await mountSlackAgent(agent, {
|
|
66
|
+
botToken: process.env.SLACK_BOT_TOKEN,
|
|
67
|
+
signingSecret: process.env.SLACK_SIGNING_SECRET,
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Boundary
|
|
72
|
+
|
|
73
|
+
This package owns only the `@cuylabs/agent-core` binding:
|
|
74
|
+
|
|
75
|
+
- mapping Slack turns to `AgentTurnSource.chat(...)`
|
|
76
|
+
- creating agent-core scopes and context fragments
|
|
77
|
+
- converting `AgentEvent` streams to Slack messages or chat streams
|
|
78
|
+
- handling agent-core approval and human-input requests in Slack
|
|
79
|
+
|
|
80
|
+
Reusable Slack mechanics live in `@cuylabs/channel-slack`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { a as SlackChannelOptions, S as SlackChannelAdapter } from './types-BqRzb_Cd.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 };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { c as createSlackChannelAdapter } from './adapter-Cmd2C90g.js';
|
|
2
|
+
import { a as SlackChannelOptions } from './types-BqRzb_Cd.js';
|
|
3
|
+
export { S as SlackChannelAdapter, b as SlackSessionStrategy, c as SlackStreamingMode, d as SlackToolStartEvent } from './types-BqRzb_Cd.js';
|
|
4
|
+
import { SlackActivityInfo } from '@cuylabs/channel-slack/core';
|
|
5
|
+
export { resolveThreadAwareSlackSessionId } from '@cuylabs/channel-slack/core';
|
|
6
|
+
import '@cuylabs/agent-core';
|
|
7
|
+
import './interactive-o_NZb-Xg.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Session mapping — Slack activity info to agent-core session IDs.
|
|
11
|
+
*
|
|
12
|
+
* The default strategy (`"thread-aware"`) produces natural conversation
|
|
13
|
+
* groupings by using the thread timestamp when present and falling back to
|
|
14
|
+
* the channel ID for DMs and top-level messages.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface SlackSessionMap {
|
|
18
|
+
/** Resolve (or create) a session ID for the given Slack activity. */
|
|
19
|
+
resolve(info: SlackActivityInfo): string | Promise<string>;
|
|
20
|
+
}
|
|
21
|
+
declare function createSlackSessionMap(options: SlackChannelOptions): SlackSessionMap;
|
|
22
|
+
|
|
23
|
+
export { SlackChannelOptions, type SlackSessionMap, createSlackSessionMap };
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSlackChannelAdapter,
|
|
3
|
+
createSlackSessionMap,
|
|
4
|
+
resolveThreadAwareSlackSessionId
|
|
5
|
+
} from "./chunk-FDRQOG7Q.js";
|
|
6
|
+
import "./chunk-GNXWTKQ6.js";
|
|
7
|
+
import "./chunk-DHPD4XH5.js";
|
|
8
|
+
import "./chunk-I2KLQ2HA.js";
|
|
9
|
+
export {
|
|
10
|
+
createSlackChannelAdapter,
|
|
11
|
+
createSlackSessionMap,
|
|
12
|
+
resolveThreadAwareSlackSessionId
|
|
13
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
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, b as SlackAssistantFeedbackConfig, S as SlackAssistantBridge } from './options-Uf-qmQKN.js';
|
|
5
|
+
import { a as SlackChannelOptions } from './types-BqRzb_Cd.js';
|
|
6
|
+
import { SlackTurnRequestContext, SlackAssistantUtilities, SlackTurnPreparation } from '@cuylabs/channel-slack/core';
|
|
7
|
+
import { SlackFeedbackHandler } from '@cuylabs/channel-slack/feedback';
|
|
8
|
+
import { c as SlackInteractiveController } from './types-Crpil4kb.js';
|
|
9
|
+
import './interactive-o_NZb-Xg.js';
|
|
10
|
+
import './options-C7OYeNR-.js';
|
|
11
|
+
import '@cuylabs/channel-slack/assistant';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Shared installer for the direct Slack app surfaces.
|
|
15
|
+
*
|
|
16
|
+
* HTTP Events API and Socket Mode differ only in how Bolt receives inbound
|
|
17
|
+
* events. The Assistant pane, app_mention, DM/channel routing, feedback, and
|
|
18
|
+
* interactive request wiring are mounted here so both transports behave the
|
|
19
|
+
* same.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
interface MountSlackAgentAppTurnRequestContext extends SlackTurnRequestContext {
|
|
23
|
+
/** Present only for Assistant-pane turns. */
|
|
24
|
+
assistant?: SlackAssistantUtilities;
|
|
25
|
+
/** Present for Assistant-pane turns; use direct history helpers for Slack API context. */
|
|
26
|
+
client?: WebClient;
|
|
27
|
+
/** Raw Bolt assistant args for advanced hosts. */
|
|
28
|
+
rawArgs?: unknown;
|
|
29
|
+
}
|
|
30
|
+
interface SlackAgentAppSurfaceOptions extends Omit<CreateSlackAssistantBridgeOptions, "feedback" | "source" | "prepareTurn" | "resolveSession" | "handleInteractiveRequest"> {
|
|
31
|
+
/** Source of agent turns. */
|
|
32
|
+
source: AgentTurnSource;
|
|
33
|
+
/**
|
|
34
|
+
* Prepare an agent turn for every direct Slack surface registered by this
|
|
35
|
+
* mount: Assistant pane, @mentions, and DMs.
|
|
36
|
+
*/
|
|
37
|
+
prepareTurn?: (request: MountSlackAgentAppTurnRequestContext) => SlackTurnPreparation | Promise<SlackTurnPreparation>;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the agent session for every direct Slack surface. Returning
|
|
40
|
+
* `undefined` falls back to the configured session strategy.
|
|
41
|
+
*/
|
|
42
|
+
resolveSession?: (request: MountSlackAgentAppTurnRequestContext) => string | undefined | Promise<string | undefined>;
|
|
43
|
+
/** Register `app.event("app_mention", ...)`. @default true */
|
|
44
|
+
respondToMentions?: boolean;
|
|
45
|
+
/** Register `app.message(...)` for DMs. @default true */
|
|
46
|
+
respondToMessages?: boolean;
|
|
47
|
+
/** Forward plain channel/group messages too. @default false */
|
|
48
|
+
respondToChannelMessages?: boolean;
|
|
49
|
+
/** Resolve or skip classic Slack channel-adapter messages. Return undefined to skip. */
|
|
50
|
+
resolveMessage?: SlackChannelOptions["resolveMessage"];
|
|
51
|
+
/** Feedback config. Pass `false` to omit feedback blocks. */
|
|
52
|
+
feedback?: SlackAssistantFeedbackConfig | false;
|
|
53
|
+
/** Convenience feedback handler. Ignored when `feedback` is set. */
|
|
54
|
+
onFeedback?: SlackFeedbackHandler;
|
|
55
|
+
/** Maximum turn runtime in ms. Set `0` to disable. @default 120_000 */
|
|
56
|
+
timeoutMs?: number;
|
|
57
|
+
/** Optional logger for diagnostics. */
|
|
58
|
+
logger?: Logger;
|
|
59
|
+
/**
|
|
60
|
+
* Slack-native approval/human-input controller. Pair this with
|
|
61
|
+
* `interactive.approval.onRequest` / `interactive.humanInput.onRequest` in
|
|
62
|
+
* the agent config, or with `interactive.onResolve` for server-backed turns.
|
|
63
|
+
*/
|
|
64
|
+
interactive?: SlackInteractiveController;
|
|
65
|
+
}
|
|
66
|
+
interface SlackAgentAppSurfaceResult {
|
|
67
|
+
bridge: SlackAssistantBridge;
|
|
68
|
+
}
|
|
69
|
+
declare function installSlackAgentAppSurface(boltApp: App, options: SlackAgentAppSurfaceOptions): SlackAgentAppSurfaceResult;
|
|
70
|
+
|
|
71
|
+
export { type MountSlackAgentAppTurnRequestContext, type SlackAgentAppSurfaceOptions, type SlackAgentAppSurfaceResult, installSlackAgentAppSurface };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
installSlackAgentAppSurface
|
|
3
|
+
} from "./chunk-M64Z6TYL.js";
|
|
4
|
+
import "./chunk-BFUPAJON.js";
|
|
5
|
+
import "./chunk-VHGV66M7.js";
|
|
6
|
+
import "./chunk-FDRQOG7Q.js";
|
|
7
|
+
import "./chunk-GNXWTKQ6.js";
|
|
8
|
+
import "./chunk-DHPD4XH5.js";
|
|
9
|
+
import "./chunk-I2KLQ2HA.js";
|
|
10
|
+
export {
|
|
11
|
+
installSlackAgentAppSurface
|
|
12
|
+
};
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Server } from 'node:http';
|
|
2
|
+
import { Application } from 'express';
|
|
3
|
+
import { App, ExpressReceiver } from '@slack/bolt';
|
|
4
|
+
import { CreateSlackBoltAppOptions, SlackDirectAuthOptions, SlackDirectAuthMode } from '@cuylabs/channel-slack/bolt';
|
|
5
|
+
import { SlackAgentAppSurfaceOptions } from './app-surface.js';
|
|
6
|
+
export { MountSlackAgentAppTurnRequestContext } from './app-surface.js';
|
|
7
|
+
import { S as SlackAssistantBridge } from './options-Uf-qmQKN.js';
|
|
8
|
+
import '@cuylabs/agent-core';
|
|
9
|
+
import '@slack/web-api';
|
|
10
|
+
import './types-BqRzb_Cd.js';
|
|
11
|
+
import '@cuylabs/channel-slack/core';
|
|
12
|
+
import './interactive-o_NZb-Xg.js';
|
|
13
|
+
import '@cuylabs/channel-slack/feedback';
|
|
14
|
+
import './types-Crpil4kb.js';
|
|
15
|
+
import './options-C7OYeNR-.js';
|
|
16
|
+
import '@cuylabs/channel-slack/assistant';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Unified Slack agent app over the HTTP Events API.
|
|
20
|
+
*
|
|
21
|
+
* This file owns only the HTTP/Bolt receiver lifecycle. The actual Slack
|
|
22
|
+
* surfaces (Assistant pane, app mentions, DMs/channel messages, feedback, and
|
|
23
|
+
* interactive requests) are mounted by `installSlackAgentAppSurface` so Socket
|
|
24
|
+
* Mode gets the exact same behavior.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
interface MountSlackAgentAppOptions extends SlackAgentAppSurfaceOptions, Omit<CreateSlackBoltAppOptions, "app" | "path" | "botToken" | "signingSecret" | "auth"> {
|
|
28
|
+
/** Slack bot token (`xoxb-...`). @default process.env.SLACK_BOT_TOKEN */
|
|
29
|
+
botToken?: string;
|
|
30
|
+
/** Slack signing secret. @default process.env.SLACK_SIGNING_SECRET */
|
|
31
|
+
signingSecret?: string;
|
|
32
|
+
/** Direct-mode auth config (single-workspace, OAuth, custom). */
|
|
33
|
+
auth?: SlackDirectAuthOptions;
|
|
34
|
+
/** Slack Events API callback path. @default "/slack/events" */
|
|
35
|
+
path?: string;
|
|
36
|
+
/** Port to listen on. @default process.env.PORT || 3000 */
|
|
37
|
+
port?: number | null;
|
|
38
|
+
/** Optional host for `app.listen(port, host)`. */
|
|
39
|
+
host?: string;
|
|
40
|
+
/** Pre-existing Express app. */
|
|
41
|
+
app?: Application;
|
|
42
|
+
}
|
|
43
|
+
interface MountSlackAgentAppResult {
|
|
44
|
+
app: Application;
|
|
45
|
+
boltApp: App;
|
|
46
|
+
receiver: ExpressReceiver;
|
|
47
|
+
authMode: SlackDirectAuthMode;
|
|
48
|
+
routePath: string;
|
|
49
|
+
bridge: SlackAssistantBridge;
|
|
50
|
+
server?: Server;
|
|
51
|
+
}
|
|
52
|
+
declare function mountSlackAgentApp(options: MountSlackAgentAppOptions): Promise<MountSlackAgentAppResult>;
|
|
53
|
+
|
|
54
|
+
export { type MountSlackAgentAppOptions, type MountSlackAgentAppResult, mountSlackAgentApp };
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mountSlackAgentApp
|
|
3
|
+
} from "./chunk-CYEBGC6G.js";
|
|
4
|
+
import "./chunk-M64Z6TYL.js";
|
|
5
|
+
import "./chunk-BFUPAJON.js";
|
|
6
|
+
import "./chunk-VHGV66M7.js";
|
|
7
|
+
import "./chunk-FDRQOG7Q.js";
|
|
8
|
+
import "./chunk-GNXWTKQ6.js";
|
|
9
|
+
import "./chunk-DHPD4XH5.js";
|
|
10
|
+
import "./chunk-ANIZ5NT4.js";
|
|
11
|
+
import "./chunk-I2KLQ2HA.js";
|
|
12
|
+
export {
|
|
13
|
+
mountSlackAgentApp
|
|
14
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { C as CreateSlackAssistantBridgeOptions, S as SlackAssistantBridge } from './options-Uf-qmQKN.js';
|
|
2
|
+
export { A as AssistantLifecycleArgs, a as AssistantThreadStartedArgs, M as MaybePromise, b as SlackAssistantFeedbackConfig, c as SlackAssistantSessionStrategy, d as SlackAssistantStatusContext, e as SlackAssistantThreadContextStoreLike, f as SlackAssistantThreadStartedContext, g as SlackAssistantTurnPreparation, h as SlackAssistantUserMessageContext, r as resolveAssistantSessionId } from './options-Uf-qmQKN.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-o_NZb-Xg.js';
|
|
9
|
+
import './options-C7OYeNR-.js';
|
|
10
|
+
import '@cuylabs/channel-slack/feedback';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `createSlackAssistantBridge` factory — assembles the three lifecycle
|
|
14
|
+
* middlewares into a Bolt `Assistant` and wires the feedback action handler.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
declare function createSlackAssistantBridge(options: CreateSlackAssistantBridgeOptions): SlackAssistantBridge;
|
|
18
|
+
|
|
19
|
+
export { CreateSlackAssistantBridgeOptions, SlackAssistantBridge, createSlackAssistantBridge };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSlackAssistantBridge,
|
|
3
|
+
createSlackAssistantThreadContextStore,
|
|
4
|
+
parseSlackMessageActivityFromMessageEvent,
|
|
5
|
+
resolveAssistantSessionId
|
|
6
|
+
} from "./chunk-BFUPAJON.js";
|
|
7
|
+
import "./chunk-VHGV66M7.js";
|
|
8
|
+
import "./chunk-GNXWTKQ6.js";
|
|
9
|
+
import "./chunk-DHPD4XH5.js";
|
|
10
|
+
import "./chunk-I2KLQ2HA.js";
|
|
11
|
+
export {
|
|
12
|
+
createSlackAssistantBridge,
|
|
13
|
+
createSlackAssistantThreadContextStore,
|
|
14
|
+
parseSlackMessageActivityFromMessageEvent,
|
|
15
|
+
resolveAssistantSessionId
|
|
16
|
+
};
|
package/dist/bolt.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from '@cuylabs/channel-slack/bolt';
|
|
2
|
+
import '@cuylabs/channel-slack/diagnostics';
|
|
3
|
+
import '@cuylabs/channel-slack/feedback';
|
|
4
|
+
import '@cuylabs/channel-slack/history';
|
|
5
|
+
import '@cuylabs/channel-slack/policy';
|
|
6
|
+
import '@cuylabs/channel-slack/setup';
|
|
7
|
+
import '@cuylabs/channel-slack/targets';
|
|
8
|
+
import '@cuylabs/channel-slack/users';
|
package/dist/bolt.js
ADDED