@cuylabs/channel-slack 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 +15 -2
- package/dist/adapter/index.d.ts +53 -0
- package/dist/adapter/index.js +13 -0
- package/dist/app-surface.d.ts +86 -0
- package/dist/app-surface.js +15 -0
- package/dist/app.d.ts +58 -0
- package/dist/app.js +86 -0
- package/dist/artifacts/index.d.ts +57 -3
- package/dist/artifacts/index.js +88 -0
- package/dist/assistant/index.d.ts +18 -53
- package/dist/assistant/index.js +15 -184
- package/dist/bolt-app-BM0tiL7c.d.ts +49 -0
- package/dist/{chunk-TWJGVDA2.js → chunk-37RN2YUI.js} +88 -1
- package/dist/chunk-LFQCINHI.js +187 -0
- package/dist/chunk-Q6YX7HHK.js +1062 -0
- package/dist/chunk-RHOIVQLD.js +127 -0
- package/dist/chunk-RTDLIYEE.js +446 -0
- package/dist/core.d.ts +5 -201
- package/dist/core.js +10 -12
- package/dist/feedback/index.d.ts +2 -2
- package/dist/feedback/index.js +5 -120
- package/dist/formatting-C-kwQseI.d.ts +25 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +10 -12
- package/dist/options-B0xQCaez.d.ts +221 -0
- package/dist/options-DQacQDmD.d.ts +368 -0
- package/dist/runtime/index.d.ts +6 -220
- package/dist/socket.d.ts +142 -0
- package/dist/socket.js +77 -0
- package/dist/transports/index.d.ts +2 -1
- package/dist/transports/socket/index.d.ts +4 -49
- package/dist/turn-BGAXddH_.d.ts +178 -0
- package/dist/types-wLZzyI9r.d.ts +375 -0
- package/docs/reference/exports.md +5 -1
- package/package.json +23 -3
- package/dist/chunk-ISOMBQXE.js +0 -89
package/dist/chunk-ISOMBQXE.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// src/shared/turn-context.ts
|
|
2
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
3
|
-
var store = new AsyncLocalStorage();
|
|
4
|
-
function currentSlackTurnContext() {
|
|
5
|
-
return store.getStore();
|
|
6
|
-
}
|
|
7
|
-
function runWithSlackTurnContext(value, fn) {
|
|
8
|
-
return Promise.resolve(store.run({ ...value }, fn));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// src/shared/follow-up.ts
|
|
12
|
-
function formatSlackAttributedFollowUp(message) {
|
|
13
|
-
const slack = currentSlackTurnContext();
|
|
14
|
-
if (!slack) {
|
|
15
|
-
return message;
|
|
16
|
-
}
|
|
17
|
-
const sender = formatSlackSender(slack);
|
|
18
|
-
const conversation = formatSlackConversation(slack);
|
|
19
|
-
if (!sender && !conversation) {
|
|
20
|
-
return message;
|
|
21
|
-
}
|
|
22
|
-
const lines = ["Additional Slack follow-up for the running request."];
|
|
23
|
-
if (sender) {
|
|
24
|
-
lines.push(`Sender: ${sender}`);
|
|
25
|
-
}
|
|
26
|
-
if (conversation) {
|
|
27
|
-
lines.push(`Conversation: ${conversation}`);
|
|
28
|
-
}
|
|
29
|
-
lines.push("Message:", message);
|
|
30
|
-
return lines.join("\n");
|
|
31
|
-
}
|
|
32
|
-
function formatSlackSender(slack) {
|
|
33
|
-
const userId = slack.slackActivity.userId || slack.user.userId;
|
|
34
|
-
const displayName = readPreparedSlackDisplayName(slack.context) ?? slack.user.userName;
|
|
35
|
-
if (displayName && userId) {
|
|
36
|
-
return `${displayName} (${userId})`;
|
|
37
|
-
}
|
|
38
|
-
return displayName ?? userId ?? "unknown Slack user";
|
|
39
|
-
}
|
|
40
|
-
function formatSlackConversation(slack) {
|
|
41
|
-
const activity = slack.slackActivity;
|
|
42
|
-
const surface = formatSlackSurface(activity.channelType);
|
|
43
|
-
const parts = [
|
|
44
|
-
activity.teamId ? `team ${activity.teamId}` : void 0,
|
|
45
|
-
activity.channelId ? `channel ${activity.channelId}` : void 0,
|
|
46
|
-
activity.threadTs ? `thread ${activity.threadTs}` : activity.messageTs ? `message ${activity.messageTs}` : void 0
|
|
47
|
-
].filter((part) => Boolean(part));
|
|
48
|
-
return parts.length > 0 ? `${surface} (${parts.join(", ")})` : surface;
|
|
49
|
-
}
|
|
50
|
-
function formatSlackSurface(channelType) {
|
|
51
|
-
switch (channelType) {
|
|
52
|
-
case "dm":
|
|
53
|
-
return "private Slack DM";
|
|
54
|
-
case "thread":
|
|
55
|
-
return "shared Slack thread";
|
|
56
|
-
case "channel":
|
|
57
|
-
return "shared Slack channel";
|
|
58
|
-
case "group":
|
|
59
|
-
return "shared Slack group conversation";
|
|
60
|
-
default:
|
|
61
|
-
return "Slack conversation";
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function readPreparedSlackDisplayName(context) {
|
|
65
|
-
const slack = context?.slack;
|
|
66
|
-
if (!slack || typeof slack !== "object") {
|
|
67
|
-
return void 0;
|
|
68
|
-
}
|
|
69
|
-
const value = slack.userDisplayName;
|
|
70
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/shared/session.ts
|
|
74
|
-
function resolveThreadAwareSlackSessionId(info) {
|
|
75
|
-
if (info.channelType === "dm") {
|
|
76
|
-
return info.channelId;
|
|
77
|
-
}
|
|
78
|
-
if (info.threadTs) {
|
|
79
|
-
return `${info.channelId}:${info.threadTs}`;
|
|
80
|
-
}
|
|
81
|
-
return `${info.channelId}:${info.messageTs ?? info.channelId}`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export {
|
|
85
|
-
currentSlackTurnContext,
|
|
86
|
-
runWithSlackTurnContext,
|
|
87
|
-
formatSlackAttributedFollowUp,
|
|
88
|
-
resolveThreadAwareSlackSessionId
|
|
89
|
-
};
|