@inkeep/agents-work-apps 0.58.3 → 0.58.5
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/dist/github/mcp/auth.d.ts +2 -0
- package/dist/github/mcp/auth.js +20 -0
- package/dist/github/mcp/index.d.ts +4 -2
- package/dist/github/mcp/index.js +9 -6
- package/dist/github/routes/setup.d.ts +2 -2
- package/dist/github/routes/tokenExchange.d.ts +2 -2
- package/dist/slack/mcp/index.d.ts +2 -2
- package/dist/slack/mcp/index.js +76 -2
- package/dist/slack/mcp/utils.d.ts +7 -1
- package/dist/slack/mcp/utils.js +26 -1
- package/dist/slack/routes/oauth.js +4 -1
- package/dist/slack/services/client.d.ts +48 -1
- package/dist/slack/services/client.js +66 -1
- package/dist/slack/services/events/utils.d.ts +2 -2
- package/dist/slack/services/index.d.ts +2 -2
- package/dist/slack/services/index.js +2 -2
- package/dist/slack/services/link-prompt.d.ts +2 -2
- package/package.json +2 -2
package/dist/github/mcp/auth.js
CHANGED
|
@@ -13,6 +13,24 @@ const githubMcpAuth = () => createMiddleware(async (c, next) => {
|
|
|
13
13
|
name: "x-inkeep-tool-id"
|
|
14
14
|
} }
|
|
15
15
|
});
|
|
16
|
+
const tenantId = c.req.header("x-inkeep-tenant-id");
|
|
17
|
+
if (!tenantId) throw createApiError({
|
|
18
|
+
code: "unauthorized",
|
|
19
|
+
message: "Missing required header: x-inkeep-tenant-id",
|
|
20
|
+
extensions: { parameter: {
|
|
21
|
+
in: "header",
|
|
22
|
+
name: "x-inkeep-tenant-id"
|
|
23
|
+
} }
|
|
24
|
+
});
|
|
25
|
+
const projectId = c.req.header("x-inkeep-project-id");
|
|
26
|
+
if (!projectId) throw createApiError({
|
|
27
|
+
code: "unauthorized",
|
|
28
|
+
message: "Missing required header: x-inkeep-project-id",
|
|
29
|
+
extensions: { parameter: {
|
|
30
|
+
in: "header",
|
|
31
|
+
name: "x-inkeep-project-id"
|
|
32
|
+
} }
|
|
33
|
+
});
|
|
16
34
|
const authHeader = c.req.header("Authorization");
|
|
17
35
|
if (!authHeader) throw createApiError({
|
|
18
36
|
code: "unauthorized",
|
|
@@ -36,6 +54,8 @@ const githubMcpAuth = () => createMiddleware(async (c, next) => {
|
|
|
36
54
|
message: "Invalid API key"
|
|
37
55
|
});
|
|
38
56
|
c.set("toolId", toolId);
|
|
57
|
+
c.set("tenantId", tenantId);
|
|
58
|
+
c.set("projectId", projectId);
|
|
39
59
|
await next();
|
|
40
60
|
});
|
|
41
61
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types8 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/github/mcp/index.d.ts
|
|
5
5
|
declare const app: Hono<{
|
|
6
6
|
Variables: {
|
|
7
7
|
toolId: string;
|
|
8
|
+
tenantId: string;
|
|
9
|
+
projectId: string;
|
|
8
10
|
};
|
|
9
|
-
},
|
|
11
|
+
}, hono_types8.BlankSchema, "/">;
|
|
10
12
|
//#endregion
|
|
11
13
|
export { app as default };
|
package/dist/github/mcp/index.js
CHANGED
|
@@ -27,11 +27,8 @@ const getAvailableRepositoryString = (repositoryAccess) => {
|
|
|
27
27
|
if (repositoryAccess.length === 0) return "No repositories available";
|
|
28
28
|
return `Available repositories: ${repositoryAccess.map((r) => `"${r.repositoryFullName}"`).join(", ")}`;
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
const getServer = async (toolId) => {
|
|
34
|
-
const repositoryAccess = await getMcpToolRepositoryAccessWithDetails(runDbClient_default)(toolId);
|
|
30
|
+
const getServer = async (scope) => {
|
|
31
|
+
const repositoryAccess = await getMcpToolRepositoryAccessWithDetails(runDbClient_default)(scope);
|
|
35
32
|
const installationIdMap = /* @__PURE__ */ new Map();
|
|
36
33
|
for (const repo of repositoryAccess) installationIdMap.set(repo.repositoryFullName, repo.installationId);
|
|
37
34
|
if (repositoryAccess.length === 0) throw new Error("No repository access found for tool");
|
|
@@ -985,8 +982,14 @@ app.use("/", githubMcpAuth());
|
|
|
985
982
|
app.post("/", async (c) => {
|
|
986
983
|
if (!process.env.GITHUB_APP_ID || !process.env.GITHUB_APP_PRIVATE_KEY) return c.json({ error: "GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY must be set" }, 500);
|
|
987
984
|
const toolId = c.get("toolId");
|
|
985
|
+
const tenantId = c.get("tenantId");
|
|
986
|
+
const projectId = c.get("projectId");
|
|
988
987
|
const body = await c.req.json();
|
|
989
|
-
const server = await getServer(
|
|
988
|
+
const server = await getServer({
|
|
989
|
+
tenantId,
|
|
990
|
+
projectId,
|
|
991
|
+
toolId
|
|
992
|
+
});
|
|
990
993
|
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: void 0 });
|
|
991
994
|
await server.connect(transport);
|
|
992
995
|
const { req, res } = toReqRes(c.req.raw);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types5 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/github/routes/setup.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types3 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/github/routes/tokenExchange.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types7 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/slack/mcp/index.d.ts
|
|
5
5
|
interface ChannelInfo {
|
|
@@ -18,6 +18,6 @@ declare const app: Hono<{
|
|
|
18
18
|
tenantId: string;
|
|
19
19
|
projectId: string;
|
|
20
20
|
};
|
|
21
|
-
},
|
|
21
|
+
}, hono_types7.BlankSchema, "/">;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { ChannelInfo, app as default, pruneStaleChannelIds };
|
package/dist/slack/mcp/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getLogger } from "../../logger.js";
|
|
2
2
|
import runDbClient_default from "../../db/runDbClient.js";
|
|
3
|
-
import { getBotMemberChannels, getSlackClient, openDmConversation, postMessage, postMessageInThread } from "../services/client.js";
|
|
3
|
+
import { getBotMemberChannels, getSlackClient, getSlackUserByEmail, getSlackUserInfo, getSlackUsers, openDmConversation, postMessage, postMessageInThread } from "../services/client.js";
|
|
4
4
|
import { slackMcpAuth } from "./auth.js";
|
|
5
|
-
import { resolveChannelId, resolveWorkspaceToken, validateChannelAccess } from "./utils.js";
|
|
5
|
+
import { resolveChannelId, resolveWorkspaceToken, searchUsersByName, validateChannelAccess } from "./utils.js";
|
|
6
6
|
import { z } from "@hono/zod-openapi";
|
|
7
7
|
import { getSlackMcpToolAccessConfig, updateSlackMcpToolAccessChannelIds } from "@inkeep/agents-core";
|
|
8
8
|
import { Hono } from "hono";
|
|
@@ -136,6 +136,80 @@ const getServer = async (scope) => {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
|
+
server.tool("get-slack-user", "Look up a Slack user by their user ID, email address, or name. Provide exactly one parameter. User ID and email return an exact match; name returns up to 5 ranked matches. If necessary, please clarify with the user when you receive multiple results.", {
|
|
140
|
+
user_id: z.string().optional().describe("Slack user ID (e.g., U1234567890). Returns an exact match."),
|
|
141
|
+
email: z.string().optional().describe("Email address (e.g., jane@company.com). Returns an exact match."),
|
|
142
|
+
name: z.string().optional().describe("Display name, real name, or username to search for (e.g., \"Jane Smith\"). Returns up to 5 ranked matches.")
|
|
143
|
+
}, async ({ user_id, email, name }) => {
|
|
144
|
+
try {
|
|
145
|
+
const providedCount = [
|
|
146
|
+
user_id,
|
|
147
|
+
email,
|
|
148
|
+
name
|
|
149
|
+
].filter(Boolean).length;
|
|
150
|
+
if (providedCount === 0) return {
|
|
151
|
+
content: [{
|
|
152
|
+
type: "text",
|
|
153
|
+
text: "Error: Provide at least one of user_id, email, or name."
|
|
154
|
+
}],
|
|
155
|
+
isError: true
|
|
156
|
+
};
|
|
157
|
+
if (providedCount > 1) return {
|
|
158
|
+
content: [{
|
|
159
|
+
type: "text",
|
|
160
|
+
text: "Error: Provide exactly one of user_id, email, or name."
|
|
161
|
+
}],
|
|
162
|
+
isError: true
|
|
163
|
+
};
|
|
164
|
+
if (user_id) {
|
|
165
|
+
const user = await getSlackUserInfo(client, user_id);
|
|
166
|
+
if (!user) return { content: [{
|
|
167
|
+
type: "text",
|
|
168
|
+
text: `No user found with ID: ${user_id}`
|
|
169
|
+
}] };
|
|
170
|
+
return { content: [{
|
|
171
|
+
type: "text",
|
|
172
|
+
text: JSON.stringify(user)
|
|
173
|
+
}] };
|
|
174
|
+
}
|
|
175
|
+
if (email) {
|
|
176
|
+
const user = await getSlackUserByEmail(client, email);
|
|
177
|
+
if (!user) return { content: [{
|
|
178
|
+
type: "text",
|
|
179
|
+
text: `No user found with email: ${email}`
|
|
180
|
+
}] };
|
|
181
|
+
return { content: [{
|
|
182
|
+
type: "text",
|
|
183
|
+
text: JSON.stringify(user)
|
|
184
|
+
}] };
|
|
185
|
+
}
|
|
186
|
+
const scored = searchUsersByName(await getSlackUsers(client), name ?? "");
|
|
187
|
+
if (scored.length === 0) return { content: [{
|
|
188
|
+
type: "text",
|
|
189
|
+
text: `No users found matching name: "${name}"`
|
|
190
|
+
}] };
|
|
191
|
+
return { content: [{
|
|
192
|
+
type: "text",
|
|
193
|
+
text: JSON.stringify(scored)
|
|
194
|
+
}] };
|
|
195
|
+
} catch (error) {
|
|
196
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
197
|
+
logger.error({
|
|
198
|
+
error,
|
|
199
|
+
toolId: scope.toolId,
|
|
200
|
+
user_id,
|
|
201
|
+
email,
|
|
202
|
+
name
|
|
203
|
+
}, "Failed to look up Slack user via MCP");
|
|
204
|
+
return {
|
|
205
|
+
content: [{
|
|
206
|
+
type: "text",
|
|
207
|
+
text: `Error looking up user: ${message}`
|
|
208
|
+
}],
|
|
209
|
+
isError: true
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
});
|
|
139
213
|
return server;
|
|
140
214
|
};
|
|
141
215
|
const app = new Hono();
|
|
@@ -4,9 +4,15 @@ import { WebClient } from "@slack/web-api";
|
|
|
4
4
|
//#region src/slack/mcp/utils.d.ts
|
|
5
5
|
declare function resolveChannelId(client: WebClient, channelInput: string): Promise<string>;
|
|
6
6
|
declare function resolveWorkspaceToken(tenantId: string): Promise<string>;
|
|
7
|
+
interface UserWithNameFields {
|
|
8
|
+
realName?: string;
|
|
9
|
+
displayName?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function searchUsersByName<T extends UserWithNameFields>(users: T[], query: string, maxResults?: number): T[];
|
|
7
13
|
declare function validateChannelAccess(channelId: string, config: SlackMcpToolAccessConfig): {
|
|
8
14
|
allowed: boolean;
|
|
9
15
|
reason?: string;
|
|
10
16
|
};
|
|
11
17
|
//#endregion
|
|
12
|
-
export { resolveChannelId, resolveWorkspaceToken, validateChannelAccess };
|
|
18
|
+
export { resolveChannelId, resolveWorkspaceToken, searchUsersByName, validateChannelAccess };
|
package/dist/slack/mcp/utils.js
CHANGED
|
@@ -38,6 +38,31 @@ async function resolveWorkspaceToken(tenantId) {
|
|
|
38
38
|
if (!botToken) throw new Error(`Failed to retrieve bot token for workspace ${workspace.slackTeamId}`);
|
|
39
39
|
return botToken;
|
|
40
40
|
}
|
|
41
|
+
function searchUsersByName(users, query, maxResults = 5) {
|
|
42
|
+
const needle = query.trim().toLowerCase();
|
|
43
|
+
if (!needle) return [];
|
|
44
|
+
return users.map((user) => {
|
|
45
|
+
const fields = [
|
|
46
|
+
user.realName,
|
|
47
|
+
user.displayName,
|
|
48
|
+
user.name
|
|
49
|
+
].filter(Boolean);
|
|
50
|
+
let bestScore = 0;
|
|
51
|
+
for (const field of fields) {
|
|
52
|
+
const lower = field.toLowerCase();
|
|
53
|
+
if (lower === needle) {
|
|
54
|
+
bestScore = 3;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
if (lower.startsWith(needle)) bestScore = Math.max(bestScore, 2);
|
|
58
|
+
else if (lower.includes(needle)) bestScore = Math.max(bestScore, 1);
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
user,
|
|
62
|
+
score: bestScore
|
|
63
|
+
};
|
|
64
|
+
}).filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score).slice(0, maxResults).map((entry) => entry.user);
|
|
65
|
+
}
|
|
41
66
|
function validateChannelAccess(channelId, config) {
|
|
42
67
|
if (channelId.startsWith("D")) {
|
|
43
68
|
if (!config.dmEnabled) return {
|
|
@@ -55,4 +80,4 @@ function validateChannelAccess(channelId, config) {
|
|
|
55
80
|
}
|
|
56
81
|
|
|
57
82
|
//#endregion
|
|
58
|
-
export { resolveChannelId, resolveWorkspaceToken, validateChannelAccess };
|
|
83
|
+
export { resolveChannelId, resolveWorkspaceToken, searchUsersByName, validateChannelAccess };
|
|
@@ -104,7 +104,10 @@ app.openapi(createProtectedRoute({
|
|
|
104
104
|
"im:write",
|
|
105
105
|
"team:read",
|
|
106
106
|
"users:read",
|
|
107
|
-
"users:read.email"
|
|
107
|
+
"users:read.email",
|
|
108
|
+
"search:read.public",
|
|
109
|
+
"search:read.files",
|
|
110
|
+
"search:read.users"
|
|
108
111
|
].join(",");
|
|
109
112
|
const state = createOAuthState(tenantId);
|
|
110
113
|
const slackAuthUrl = new URL("https://slack.com/oauth/v2/authorize");
|
|
@@ -32,6 +32,53 @@ declare function getSlackUserInfo(client: WebClient, userId: string): Promise<{
|
|
|
32
32
|
tz: string | undefined;
|
|
33
33
|
tzOffset: number | undefined;
|
|
34
34
|
} | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Look up a Slack user by email address.
|
|
37
|
+
*
|
|
38
|
+
* @param client - Authenticated Slack WebClient
|
|
39
|
+
* @param email - Email address to look up
|
|
40
|
+
* @returns User profile object, or null if not found
|
|
41
|
+
*/
|
|
42
|
+
declare function getSlackUserByEmail(client: WebClient, email: string): Promise<{
|
|
43
|
+
id: string | undefined;
|
|
44
|
+
name: string | undefined;
|
|
45
|
+
realName: string | undefined;
|
|
46
|
+
displayName: string | undefined;
|
|
47
|
+
email: string | undefined;
|
|
48
|
+
isAdmin: boolean | undefined;
|
|
49
|
+
isOwner: boolean | undefined;
|
|
50
|
+
avatar: string | undefined;
|
|
51
|
+
tz: string | undefined;
|
|
52
|
+
tzOffset: number | undefined;
|
|
53
|
+
} | null>;
|
|
54
|
+
/**
|
|
55
|
+
* List all members of a Slack workspace.
|
|
56
|
+
*
|
|
57
|
+
* Automatically paginates through results. Excludes deleted users and bots by default.
|
|
58
|
+
*
|
|
59
|
+
* @param client - Authenticated Slack WebClient
|
|
60
|
+
* @param options - Optional filters
|
|
61
|
+
* @param options.includeDeleted - Include deactivated users (default: false)
|
|
62
|
+
* @param options.includeBots - Include bot users (default: false)
|
|
63
|
+
* @param options.limit - Maximum number of users to return
|
|
64
|
+
* @returns Array of user profile objects
|
|
65
|
+
*/
|
|
66
|
+
declare function getSlackUsers(client: WebClient, options?: {
|
|
67
|
+
includeDeleted?: boolean;
|
|
68
|
+
includeBots?: boolean;
|
|
69
|
+
limit?: number;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
id: string | undefined;
|
|
72
|
+
name: string | undefined;
|
|
73
|
+
realName: string | undefined;
|
|
74
|
+
displayName: string | undefined;
|
|
75
|
+
email: string | undefined;
|
|
76
|
+
isAdmin: boolean | undefined;
|
|
77
|
+
isOwner: boolean | undefined;
|
|
78
|
+
avatar: string | undefined;
|
|
79
|
+
tz: string | undefined;
|
|
80
|
+
tzOffset: number | undefined;
|
|
81
|
+
}[]>;
|
|
35
82
|
/**
|
|
36
83
|
* Fetch workspace (team) information from Slack.
|
|
37
84
|
*
|
|
@@ -162,4 +209,4 @@ declare function validateBotChannelMembership(client: WebClient, channelIds: str
|
|
|
162
209
|
*/
|
|
163
210
|
declare function revokeSlackToken(token: string): Promise<boolean>;
|
|
164
211
|
//#endregion
|
|
165
|
-
export { checkUserIsChannelMember, getBotMemberChannels, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserInfo, openDmConversation, postMessage, postMessageInThread, revokeSlackToken, validateBotChannelMembership };
|
|
212
|
+
export { checkUserIsChannelMember, getBotMemberChannels, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserByEmail, getSlackUserInfo, getSlackUsers, openDmConversation, postMessage, postMessageInThread, revokeSlackToken, validateBotChannelMembership };
|
|
@@ -63,6 +63,71 @@ async function getSlackUserInfo(client, userId) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
+
* Look up a Slack user by email address.
|
|
67
|
+
*
|
|
68
|
+
* @param client - Authenticated Slack WebClient
|
|
69
|
+
* @param email - Email address to look up
|
|
70
|
+
* @returns User profile object, or null if not found
|
|
71
|
+
*/
|
|
72
|
+
async function getSlackUserByEmail(client, email) {
|
|
73
|
+
const result = await client.users.lookupByEmail({ email });
|
|
74
|
+
if (result.ok && result.user) return {
|
|
75
|
+
id: result.user.id,
|
|
76
|
+
name: result.user.name,
|
|
77
|
+
realName: result.user.real_name,
|
|
78
|
+
displayName: result.user.profile?.display_name,
|
|
79
|
+
email: result.user.profile?.email,
|
|
80
|
+
isAdmin: result.user.is_admin,
|
|
81
|
+
isOwner: result.user.is_owner,
|
|
82
|
+
avatar: result.user.profile?.image_72,
|
|
83
|
+
tz: result.user.tz,
|
|
84
|
+
tzOffset: result.user.tz_offset
|
|
85
|
+
};
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* List all members of a Slack workspace.
|
|
90
|
+
*
|
|
91
|
+
* Automatically paginates through results. Excludes deleted users and bots by default.
|
|
92
|
+
*
|
|
93
|
+
* @param client - Authenticated Slack WebClient
|
|
94
|
+
* @param options - Optional filters
|
|
95
|
+
* @param options.includeDeleted - Include deactivated users (default: false)
|
|
96
|
+
* @param options.includeBots - Include bot users (default: false)
|
|
97
|
+
* @param options.limit - Maximum number of users to return
|
|
98
|
+
* @returns Array of user profile objects
|
|
99
|
+
*/
|
|
100
|
+
async function getSlackUsers(client, options = {}) {
|
|
101
|
+
const { includeDeleted = false, includeBots = false, limit } = options;
|
|
102
|
+
return (await paginateSlack({
|
|
103
|
+
fetchPage: (cursor) => client.users.list({
|
|
104
|
+
limit: 200,
|
|
105
|
+
cursor
|
|
106
|
+
}),
|
|
107
|
+
extractItems: (result) => {
|
|
108
|
+
if (!result.ok) throw new Error(`Slack API error during user listing: ${result.error}`);
|
|
109
|
+
return result.members ?? [];
|
|
110
|
+
},
|
|
111
|
+
getNextCursor: (result) => result.response_metadata?.next_cursor || void 0,
|
|
112
|
+
limit
|
|
113
|
+
})).filter((user) => {
|
|
114
|
+
if (!includeDeleted && user.deleted) return false;
|
|
115
|
+
if (!includeBots && (user.is_bot || user.id === "USLACKBOT")) return false;
|
|
116
|
+
return true;
|
|
117
|
+
}).map((user) => ({
|
|
118
|
+
id: user.id,
|
|
119
|
+
name: user.name,
|
|
120
|
+
realName: user.real_name,
|
|
121
|
+
displayName: user.profile?.display_name,
|
|
122
|
+
email: user.profile?.email,
|
|
123
|
+
isAdmin: user.is_admin,
|
|
124
|
+
isOwner: user.is_owner,
|
|
125
|
+
avatar: user.profile?.image_72,
|
|
126
|
+
tz: user.tz,
|
|
127
|
+
tzOffset: user.tz_offset
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
66
131
|
* Fetch workspace (team) information from Slack.
|
|
67
132
|
*
|
|
68
133
|
* @param client - Authenticated Slack WebClient
|
|
@@ -332,4 +397,4 @@ async function revokeSlackToken(token) {
|
|
|
332
397
|
}
|
|
333
398
|
|
|
334
399
|
//#endregion
|
|
335
|
-
export { checkUserIsChannelMember, getBotMemberChannels, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserInfo, openDmConversation, postMessage, postMessageInThread, revokeSlackToken, validateBotChannelMembership };
|
|
400
|
+
export { checkUserIsChannelMember, getBotMemberChannels, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserByEmail, getSlackUserInfo, getSlackUsers, openDmConversation, postMessage, postMessageInThread, revokeSlackToken, validateBotChannelMembership };
|
|
@@ -9,12 +9,12 @@ import { AgentOption } from "../modals.js";
|
|
|
9
9
|
* Called on every @mention and /inkeep command — caching avoids redundant DB queries.
|
|
10
10
|
*/
|
|
11
11
|
declare function findCachedUserMapping(tenantId: string, slackUserId: string, teamId: string, clientId?: string): Promise<{
|
|
12
|
-
|
|
12
|
+
slackUserId: string;
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
|
+
id: string;
|
|
15
16
|
tenantId: string;
|
|
16
17
|
clientId: string;
|
|
17
|
-
slackUserId: string;
|
|
18
18
|
slackTeamId: string;
|
|
19
19
|
slackEnterpriseId: string | null;
|
|
20
20
|
inkeepUserId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentResolutionParams, ResolvedAgentConfig, getAgentConfigSources, lookupAgentName, lookupProjectName, resolveEffectiveAgent } from "./agent-resolution.js";
|
|
2
2
|
import { AgentConfigSources, ContextBlockParams, ToolApprovalButtonValue, ToolApprovalButtonValueSchema, buildCitationsBlock, buildDataArtifactBlocks, buildDataComponentBlocks, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalDoneBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, createAlreadyLinkedMessage, createContextBlock, createContextBlockFromText, createCreateInkeepAccountMessage, createErrorMessage, createNotLinkedMessage, createSmartLinkMessage, createStatusMessage, createUnlinkSuccessMessage, createUpdatedHelpMessage } from "./blocks/index.js";
|
|
3
|
-
import { checkUserIsChannelMember, getBotMemberChannels, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserInfo, openDmConversation, postMessage, postMessageInThread, revokeSlackToken, validateBotChannelMembership } from "./client.js";
|
|
3
|
+
import { checkUserIsChannelMember, getBotMemberChannels, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserByEmail, getSlackUserInfo, getSlackUsers, openDmConversation, postMessage, postMessageInThread, revokeSlackToken, validateBotChannelMembership } from "./client.js";
|
|
4
4
|
import { DefaultAgentConfig, SlackWorkspaceConnection, WorkspaceInstallData, clearWorkspaceConnectionCache, computeWorkspaceConnectionId, createConnectSession, deleteWorkspaceInstallation, findWorkspaceConnectionByTeamId, getConnectionAccessToken, getSlackIntegrationId, getSlackNango, getWorkspaceDefaultAgent, getWorkspaceDefaultAgentFromNango, listWorkspaceInstallations, setWorkspaceDefaultAgent, storeWorkspaceInstallation, updateConnectionMetadata } from "./nango.js";
|
|
5
5
|
import { SlackCommandPayload, SlackCommandResponse } from "./types.js";
|
|
6
6
|
import { handleAgentPickerCommand, handleCommand, handleHelpCommand, handleLinkCommand, handleQuestionCommand, handleStatusCommand, handleUnlinkCommand } from "./commands/index.js";
|
|
@@ -15,4 +15,4 @@ import { handleModalSubmission } from "./events/modal-submission.js";
|
|
|
15
15
|
import "./events/index.js";
|
|
16
16
|
import { parseSlackCommandBody, parseSlackEventBody, verifySlackRequest } from "./security.js";
|
|
17
17
|
import { getBotTokenForTeam, setBotTokenForTeam } from "./workspace-tokens.js";
|
|
18
|
-
export { AgentConfigSources, AgentOption, AgentResolutionParams, BuildAgentSelectorModalParams, BuildMessageShortcutModalParams, ContextBlockParams, DefaultAgentConfig, InlineSelectorMetadata, ModalMetadata, PublicExecutionParams, ResolvedAgentConfig, SlackCommandPayload, SlackCommandResponse, SlackErrorType, SlackWorkspaceConnection, StreamResult, ToolApprovalButtonValue, ToolApprovalButtonValueSchema, WorkspaceInstallData, buildAgentSelectorModal, buildCitationsBlock, buildDataArtifactBlocks, buildDataComponentBlocks, buildMessageShortcutModal, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalDoneBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, checkIfBotThread, checkUserIsChannelMember, classifyError, clearWorkspaceConnectionCache, computeWorkspaceConnectionId, createAlreadyLinkedMessage, createConnectSession, createContextBlock, createContextBlockFromText, createCreateInkeepAccountMessage, createErrorMessage, createNotLinkedMessage, createSmartLinkMessage, createStatusMessage, createUnlinkSuccessMessage, createUpdatedHelpMessage, deleteWorkspaceInstallation, executeAgentPublicly, extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, findWorkspaceConnectionByTeamId, generateSlackConversationId, getAgentConfigSources, getBotMemberChannels, getBotTokenForTeam, getChannelAgentConfig, getConnectionAccessToken, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackIntegrationId, getSlackNango, getSlackTeamInfo, getSlackUserInfo, getThreadContext, getUserFriendlyErrorMessage, getWorkspaceDefaultAgent, getWorkspaceDefaultAgentFromNango, handleAgentPickerCommand, handleAppMention, handleCommand, handleDirectMessage, handleHelpCommand, handleLinkCommand, handleMessageShortcut, handleModalSubmission, handleOpenAgentSelectorModal, handleQuestionCommand, handleStatusCommand, handleToolApproval, handleUnlinkCommand, listWorkspaceInstallations, lookupAgentName, lookupProjectName, markdownToMrkdwn, openDmConversation, parseSlackCommandBody, parseSlackEventBody, postMessage, postMessageInThread, resolveEffectiveAgent, revokeSlackToken, sendResponseUrlMessage, setBotTokenForTeam, setWorkspaceDefaultAgent, storeWorkspaceInstallation, streamAgentResponse, updateConnectionMetadata, validateBotChannelMembership, verifySlackRequest };
|
|
18
|
+
export { AgentConfigSources, AgentOption, AgentResolutionParams, BuildAgentSelectorModalParams, BuildMessageShortcutModalParams, ContextBlockParams, DefaultAgentConfig, InlineSelectorMetadata, ModalMetadata, PublicExecutionParams, ResolvedAgentConfig, SlackCommandPayload, SlackCommandResponse, SlackErrorType, SlackWorkspaceConnection, StreamResult, ToolApprovalButtonValue, ToolApprovalButtonValueSchema, WorkspaceInstallData, buildAgentSelectorModal, buildCitationsBlock, buildDataArtifactBlocks, buildDataComponentBlocks, buildMessageShortcutModal, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalDoneBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, checkIfBotThread, checkUserIsChannelMember, classifyError, clearWorkspaceConnectionCache, computeWorkspaceConnectionId, createAlreadyLinkedMessage, createConnectSession, createContextBlock, createContextBlockFromText, createCreateInkeepAccountMessage, createErrorMessage, createNotLinkedMessage, createSmartLinkMessage, createStatusMessage, createUnlinkSuccessMessage, createUpdatedHelpMessage, deleteWorkspaceInstallation, executeAgentPublicly, extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, findWorkspaceConnectionByTeamId, generateSlackConversationId, getAgentConfigSources, getBotMemberChannels, getBotTokenForTeam, getChannelAgentConfig, getConnectionAccessToken, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackIntegrationId, getSlackNango, getSlackTeamInfo, getSlackUserByEmail, getSlackUserInfo, getSlackUsers, getThreadContext, getUserFriendlyErrorMessage, getWorkspaceDefaultAgent, getWorkspaceDefaultAgentFromNango, handleAgentPickerCommand, handleAppMention, handleCommand, handleDirectMessage, handleHelpCommand, handleLinkCommand, handleMessageShortcut, handleModalSubmission, handleOpenAgentSelectorModal, handleQuestionCommand, handleStatusCommand, handleToolApproval, handleUnlinkCommand, listWorkspaceInstallations, lookupAgentName, lookupProjectName, markdownToMrkdwn, openDmConversation, parseSlackCommandBody, parseSlackEventBody, postMessage, postMessageInThread, resolveEffectiveAgent, revokeSlackToken, sendResponseUrlMessage, setBotTokenForTeam, setWorkspaceDefaultAgent, storeWorkspaceInstallation, streamAgentResponse, updateConnectionMetadata, validateBotChannelMembership, verifySlackRequest };
|
|
@@ -2,7 +2,7 @@ import { clearWorkspaceConnectionCache, computeWorkspaceConnectionId, createConn
|
|
|
2
2
|
import { SlackErrorType, checkIfBotThread, classifyError, extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, generateSlackConversationId, getChannelAgentConfig, getThreadContext, getUserFriendlyErrorMessage, markdownToMrkdwn, sendResponseUrlMessage } from "./events/utils.js";
|
|
3
3
|
import { getAgentConfigSources, lookupAgentName, lookupProjectName, resolveEffectiveAgent } from "./agent-resolution.js";
|
|
4
4
|
import { ToolApprovalButtonValueSchema, buildCitationsBlock, buildDataArtifactBlocks, buildDataComponentBlocks, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalDoneBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, createAlreadyLinkedMessage, createContextBlock, createContextBlockFromText, createCreateInkeepAccountMessage, createErrorMessage, createNotLinkedMessage, createSmartLinkMessage, createStatusMessage, createUnlinkSuccessMessage, createUpdatedHelpMessage } from "./blocks/index.js";
|
|
5
|
-
import { checkUserIsChannelMember, getBotMemberChannels, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserInfo, openDmConversation, postMessage, postMessageInThread, revokeSlackToken, validateBotChannelMembership } from "./client.js";
|
|
5
|
+
import { checkUserIsChannelMember, getBotMemberChannels, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserByEmail, getSlackUserInfo, getSlackUsers, openDmConversation, postMessage, postMessageInThread, revokeSlackToken, validateBotChannelMembership } from "./client.js";
|
|
6
6
|
import { streamAgentResponse } from "./events/streaming.js";
|
|
7
7
|
import { executeAgentPublicly } from "./events/execution.js";
|
|
8
8
|
import { buildAgentSelectorModal, buildMessageShortcutModal } from "./modals.js";
|
|
@@ -15,4 +15,4 @@ import "./events/index.js";
|
|
|
15
15
|
import { parseSlackCommandBody, parseSlackEventBody, verifySlackRequest } from "./security.js";
|
|
16
16
|
import { getBotTokenForTeam, setBotTokenForTeam } from "./workspace-tokens.js";
|
|
17
17
|
|
|
18
|
-
export { SlackErrorType, ToolApprovalButtonValueSchema, buildAgentSelectorModal, buildCitationsBlock, buildDataArtifactBlocks, buildDataComponentBlocks, buildMessageShortcutModal, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalDoneBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, checkIfBotThread, checkUserIsChannelMember, classifyError, clearWorkspaceConnectionCache, computeWorkspaceConnectionId, createAlreadyLinkedMessage, createConnectSession, createContextBlock, createContextBlockFromText, createCreateInkeepAccountMessage, createErrorMessage, createNotLinkedMessage, createSmartLinkMessage, createStatusMessage, createUnlinkSuccessMessage, createUpdatedHelpMessage, deleteWorkspaceInstallation, executeAgentPublicly, extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, findWorkspaceConnectionByTeamId, generateSlackConversationId, getAgentConfigSources, getBotMemberChannels, getBotTokenForTeam, getChannelAgentConfig, getConnectionAccessToken, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackIntegrationId, getSlackNango, getSlackTeamInfo, getSlackUserInfo, getThreadContext, getUserFriendlyErrorMessage, getWorkspaceDefaultAgent, getWorkspaceDefaultAgentFromNango, handleAgentPickerCommand, handleAppMention, handleCommand, handleDirectMessage, handleHelpCommand, handleLinkCommand, handleMessageShortcut, handleModalSubmission, handleOpenAgentSelectorModal, handleQuestionCommand, handleStatusCommand, handleToolApproval, handleUnlinkCommand, listWorkspaceInstallations, lookupAgentName, lookupProjectName, markdownToMrkdwn, openDmConversation, parseSlackCommandBody, parseSlackEventBody, postMessage, postMessageInThread, resolveEffectiveAgent, revokeSlackToken, sendResponseUrlMessage, setBotTokenForTeam, setWorkspaceDefaultAgent, storeWorkspaceInstallation, streamAgentResponse, updateConnectionMetadata, validateBotChannelMembership, verifySlackRequest };
|
|
18
|
+
export { SlackErrorType, ToolApprovalButtonValueSchema, buildAgentSelectorModal, buildCitationsBlock, buildDataArtifactBlocks, buildDataComponentBlocks, buildMessageShortcutModal, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalDoneBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, checkIfBotThread, checkUserIsChannelMember, classifyError, clearWorkspaceConnectionCache, computeWorkspaceConnectionId, createAlreadyLinkedMessage, createConnectSession, createContextBlock, createContextBlockFromText, createCreateInkeepAccountMessage, createErrorMessage, createNotLinkedMessage, createSmartLinkMessage, createStatusMessage, createUnlinkSuccessMessage, createUpdatedHelpMessage, deleteWorkspaceInstallation, executeAgentPublicly, extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, findWorkspaceConnectionByTeamId, generateSlackConversationId, getAgentConfigSources, getBotMemberChannels, getBotTokenForTeam, getChannelAgentConfig, getConnectionAccessToken, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackIntegrationId, getSlackNango, getSlackTeamInfo, getSlackUserByEmail, getSlackUserInfo, getSlackUsers, getThreadContext, getUserFriendlyErrorMessage, getWorkspaceDefaultAgent, getWorkspaceDefaultAgentFromNango, handleAgentPickerCommand, handleAppMention, handleCommand, handleDirectMessage, handleHelpCommand, handleLinkCommand, handleMessageShortcut, handleModalSubmission, handleOpenAgentSelectorModal, handleQuestionCommand, handleStatusCommand, handleToolApproval, handleUnlinkCommand, listWorkspaceInstallations, lookupAgentName, lookupProjectName, markdownToMrkdwn, openDmConversation, parseSlackCommandBody, parseSlackEventBody, postMessage, postMessageInThread, resolveEffectiveAgent, revokeSlackToken, sendResponseUrlMessage, setBotTokenForTeam, setWorkspaceDefaultAgent, storeWorkspaceInstallation, streamAgentResponse, updateConnectionMetadata, validateBotChannelMembership, verifySlackRequest };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SlackLinkIntent } from "@inkeep/agents-core";
|
|
2
|
-
import * as
|
|
2
|
+
import * as slack_block_builder7 from "slack-block-builder";
|
|
3
3
|
|
|
4
4
|
//#region src/slack/services/link-prompt.d.ts
|
|
5
5
|
type LinkPromptResult = {
|
|
@@ -22,6 +22,6 @@ interface ResolveLinkActionParams {
|
|
|
22
22
|
intent?: SlackLinkIntent;
|
|
23
23
|
}
|
|
24
24
|
declare function resolveUnlinkedUserAction(params: ResolveLinkActionParams): Promise<LinkPromptResult>;
|
|
25
|
-
declare function buildLinkPromptMessage(result: LinkPromptResult): Readonly<
|
|
25
|
+
declare function buildLinkPromptMessage(result: LinkPromptResult): Readonly<slack_block_builder7.SlackMessageDto>;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { LinkPromptResult, ResolveLinkActionParams, buildLinkPromptMessage, resolveUnlinkedUserAction };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-work-apps",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.5",
|
|
4
4
|
"description": "First party integrations for Inkeep Agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"jose": "^6.1.0",
|
|
34
34
|
"minimatch": "^10.2.1",
|
|
35
35
|
"slack-block-builder": "^2.8.0",
|
|
36
|
-
"@inkeep/agents-core": "0.58.
|
|
36
|
+
"@inkeep/agents-core": "0.58.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@hono/zod-openapi": "^1.1.5",
|