@inkeep/agents-work-apps 0.58.14 → 0.58.16
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/index.d.ts +3 -3
- package/dist/github/mcp/auth.d.ts +2 -2
- package/dist/github/mcp/index.d.ts +2 -2
- package/dist/github/mcp/schemas.d.ts +1 -1
- package/dist/github/routes/setup.d.ts +2 -2
- package/dist/github/routes/tokenExchange.d.ts +2 -2
- package/dist/github/routes/webhooks.d.ts +2 -2
- package/dist/slack/mcp/auth.d.ts +2 -2
- package/dist/slack/mcp/index.d.ts +2 -2
- package/dist/slack/middleware/permissions.d.ts +3 -3
- package/dist/slack/routes/oauth.d.ts +2 -1
- package/dist/slack/routes/oauth.js +9 -23
- package/dist/slack/services/events/utils.d.ts +2 -2
- package/dist/slack/slack-app-manifest.js +35 -0
- package/dist/slack/slack-scopes.d.ts +5 -0
- package/dist/slack/slack-scopes.js +10 -0
- package/package.json +2 -2
package/dist/github/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ import "./routes/setup.js";
|
|
|
4
4
|
import "./routes/tokenExchange.js";
|
|
5
5
|
import { WebhookVerificationResult, verifyWebhookSignature } from "./routes/webhooks.js";
|
|
6
6
|
import { Hono } from "hono";
|
|
7
|
-
import * as
|
|
7
|
+
import * as hono_types3 from "hono/types";
|
|
8
8
|
|
|
9
9
|
//#region src/github/index.d.ts
|
|
10
|
-
declare function createGithubRoutes(): Hono<
|
|
11
|
-
declare const githubRoutes: Hono<
|
|
10
|
+
declare function createGithubRoutes(): Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
|
|
11
|
+
declare const githubRoutes: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { GenerateInstallationAccessTokenResult, GenerateTokenError, GenerateTokenResult, GitHubAppConfig, InstallationAccessToken, InstallationInfo, LookupInstallationError, LookupInstallationForRepoResult, LookupInstallationResult, WebhookVerificationResult, clearConfigCache, createAppJwt, createGithubRoutes, determineStatus, fetchInstallationDetails, fetchInstallationRepositories, generateInstallationAccessToken, getGitHubAppConfig, getGitHubAppName, getStateSigningSecret, getWebhookSecret, githubRoutes, isGitHubAppConfigured, isGitHubAppNameConfigured, isStateSigningConfigured, isWebhookConfigured, lookupInstallationForRepo, validateGitHubAppConfigOnStartup, validateGitHubInstallFlowConfigOnStartup, validateGitHubWebhookConfigOnStartup, verifyWebhookSignature };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono2 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/github/mcp/auth.d.ts
|
|
4
|
-
declare const githubMcpAuth: () =>
|
|
4
|
+
declare const githubMcpAuth: () => hono2.MiddlewareHandler<{
|
|
5
5
|
Variables: {
|
|
6
6
|
toolId: string;
|
|
7
7
|
tenantId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types10 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/github/mcp/index.d.ts
|
|
5
5
|
declare const app: Hono<{
|
|
@@ -8,6 +8,6 @@ declare const app: Hono<{
|
|
|
8
8
|
tenantId: string;
|
|
9
9
|
projectId: string;
|
|
10
10
|
};
|
|
11
|
-
},
|
|
11
|
+
}, hono_types10.BlankSchema, "/">;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types0 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_types0.BlankEnv, hono_types0.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_types1 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_types1.BlankEnv, hono_types1.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/github/routes/webhooks.d.ts
|
|
5
5
|
interface WebhookVerificationResult {
|
|
@@ -7,6 +7,6 @@ interface WebhookVerificationResult {
|
|
|
7
7
|
error?: string;
|
|
8
8
|
}
|
|
9
9
|
declare function verifyWebhookSignature(payload: string, signature: string | undefined, secret: string): WebhookVerificationResult;
|
|
10
|
-
declare const app: Hono<
|
|
10
|
+
declare const app: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { WebhookVerificationResult, app as default, verifyWebhookSignature };
|
package/dist/slack/mcp/auth.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono1 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/slack/mcp/auth.d.ts
|
|
4
|
-
declare const slackMcpAuth: () =>
|
|
4
|
+
declare const slackMcpAuth: () => hono1.MiddlewareHandler<{
|
|
5
5
|
Variables: {
|
|
6
6
|
toolId: string;
|
|
7
7
|
tenantId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types9 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_types9.BlankSchema, "/">;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { ChannelInfo, app as default, pruneStaleChannelIds };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono0 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/slack/middleware/permissions.d.ts
|
|
5
5
|
/**
|
|
@@ -14,7 +14,7 @@ declare const requireWorkspaceAdmin: <Env extends {
|
|
|
14
14
|
Variables: ManageAppVariables;
|
|
15
15
|
} = {
|
|
16
16
|
Variables: ManageAppVariables;
|
|
17
|
-
}>() =>
|
|
17
|
+
}>() => hono0.MiddlewareHandler<Env, string, {}, Response>;
|
|
18
18
|
/**
|
|
19
19
|
* Middleware that requires either:
|
|
20
20
|
* 1. Org admin/owner role (can modify any channel), OR
|
|
@@ -26,6 +26,6 @@ declare const requireChannelMemberOrAdmin: <Env extends {
|
|
|
26
26
|
Variables: ManageAppVariables;
|
|
27
27
|
} = {
|
|
28
28
|
Variables: ManageAppVariables;
|
|
29
|
-
}>() =>
|
|
29
|
+
}>() => hono0.MiddlewareHandler<Env, string, {}, Response>;
|
|
30
30
|
//#endregion
|
|
31
31
|
export { isOrgAdmin, requireChannelMemberOrAdmin, requireWorkspaceAdmin };
|
|
@@ -13,8 +13,9 @@ interface OAuthState {
|
|
|
13
13
|
declare function getStateSigningSecret(): string;
|
|
14
14
|
declare function createOAuthState(tenantId?: string): string;
|
|
15
15
|
declare function parseOAuthState(stateStr: string): OAuthState | null;
|
|
16
|
+
declare function sanitizeTenantId(raw: string): string;
|
|
16
17
|
declare const app: OpenAPIHono<{
|
|
17
18
|
Variables: WorkAppsVariables;
|
|
18
19
|
}, {}, "/">;
|
|
19
20
|
//#endregion
|
|
20
|
-
export { createOAuthState, app as default, getBotTokenForTeam, getStateSigningSecret, parseOAuthState, setBotTokenForTeam };
|
|
21
|
+
export { createOAuthState, app as default, getBotTokenForTeam, getStateSigningSecret, parseOAuthState, sanitizeTenantId, setBotTokenForTeam };
|
|
@@ -5,6 +5,7 @@ import { clearWorkspaceConnectionCache, computeWorkspaceConnectionId, deleteWork
|
|
|
5
5
|
import { getSlackClient, getSlackTeamInfo, getSlackUserInfo } from "../services/client.js";
|
|
6
6
|
import { getBotTokenForTeam, setBotTokenForTeam } from "../services/workspace-tokens.js";
|
|
7
7
|
import "../services/index.js";
|
|
8
|
+
import { BOT_SCOPES_CSV } from "../slack-scopes.js";
|
|
8
9
|
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
9
10
|
import { createWorkAppSlackWorkspace, isUniqueConstraintError, listWorkAppSlackWorkspacesByTenant } from "@inkeep/agents-core";
|
|
10
11
|
import * as crypto$1 from "node:crypto";
|
|
@@ -70,6 +71,9 @@ function parseOAuthState(stateStr) {
|
|
|
70
71
|
return null;
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
function sanitizeTenantId(raw) {
|
|
75
|
+
return /^[a-zA-Z0-9_-]+$/.test(raw) ? raw : "";
|
|
76
|
+
}
|
|
73
77
|
const app = new OpenAPIHono();
|
|
74
78
|
app.openapi(createProtectedRoute({
|
|
75
79
|
method: "get",
|
|
@@ -89,30 +93,10 @@ app.openapi(createProtectedRoute({
|
|
|
89
93
|
const { tenant_id: tenantId } = c.req.valid("query");
|
|
90
94
|
const clientId = env.SLACK_CLIENT_ID;
|
|
91
95
|
const redirectUri = `${env.SLACK_APP_URL}/work-apps/slack/oauth_redirect`;
|
|
92
|
-
const botScopes = [
|
|
93
|
-
"app_mentions:read",
|
|
94
|
-
"channels:history",
|
|
95
|
-
"channels:read",
|
|
96
|
-
"chat:write",
|
|
97
|
-
"chat:write.public",
|
|
98
|
-
"commands",
|
|
99
|
-
"files:write",
|
|
100
|
-
"groups:history",
|
|
101
|
-
"groups:read",
|
|
102
|
-
"im:history",
|
|
103
|
-
"im:read",
|
|
104
|
-
"im:write",
|
|
105
|
-
"team:read",
|
|
106
|
-
"users:read",
|
|
107
|
-
"users:read.email",
|
|
108
|
-
"search:read.public",
|
|
109
|
-
"search:read.files",
|
|
110
|
-
"search:read.users"
|
|
111
|
-
].join(",");
|
|
112
96
|
const state = createOAuthState(tenantId);
|
|
113
97
|
const slackAuthUrl = new URL("https://slack.com/oauth/v2/authorize");
|
|
114
98
|
slackAuthUrl.searchParams.set("client_id", clientId || "");
|
|
115
|
-
slackAuthUrl.searchParams.set("scope",
|
|
99
|
+
slackAuthUrl.searchParams.set("scope", BOT_SCOPES_CSV);
|
|
116
100
|
slackAuthUrl.searchParams.set("redirect_uri", redirectUri);
|
|
117
101
|
slackAuthUrl.searchParams.set("state", state);
|
|
118
102
|
logger.info({
|
|
@@ -142,7 +126,9 @@ app.openapi(createProtectedRoute({
|
|
|
142
126
|
}), async (c) => {
|
|
143
127
|
const { code, error, state: stateParam } = c.req.valid("query");
|
|
144
128
|
const parsedState = stateParam ? parseOAuthState(stateParam) : null;
|
|
145
|
-
const
|
|
129
|
+
const rawTenantId = parsedState?.tenantId || "";
|
|
130
|
+
const tenantId = sanitizeTenantId(rawTenantId);
|
|
131
|
+
if (rawTenantId && !tenantId) logger.warn({ rawTenantId: rawTenantId.slice(0, 50) }, "Rejected invalid tenantId from OAuth state");
|
|
146
132
|
const dashboardUrl = `${manageUiUrl}/${tenantId}/work-apps/slack`;
|
|
147
133
|
if (!stateParam || !parsedState) {
|
|
148
134
|
logger.error({ hasState: !!stateParam }, "Invalid or missing OAuth state parameter");
|
|
@@ -346,4 +332,4 @@ app.openapi(createProtectedRoute({
|
|
|
346
332
|
var oauth_default = app;
|
|
347
333
|
|
|
348
334
|
//#endregion
|
|
349
|
-
export { createOAuthState, oauth_default as default, getBotTokenForTeam, getStateSigningSecret, parseOAuthState, setBotTokenForTeam };
|
|
335
|
+
export { createOAuthState, oauth_default as default, getBotTokenForTeam, getStateSigningSecret, parseOAuthState, sanitizeTenantId, setBotTokenForTeam };
|
|
@@ -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
|
-
slackUserId: string;
|
|
13
|
-
id: string;
|
|
14
12
|
createdAt: string;
|
|
15
13
|
updatedAt: string;
|
|
14
|
+
id: string;
|
|
16
15
|
tenantId: string;
|
|
17
16
|
clientId: string;
|
|
17
|
+
slackUserId: string;
|
|
18
18
|
slackTeamId: string;
|
|
19
19
|
slackEnterpriseId: string | null;
|
|
20
20
|
inkeepUserId: string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/slack/slack-app-manifest.json
|
|
2
|
+
var oauth_config = {
|
|
3
|
+
"redirect_urls": ["https://api.nango.dev/oauth/callback", "https://<YOUR_API_DOMAIN>/work-apps/slack/oauth_redirect"],
|
|
4
|
+
"scopes": {
|
|
5
|
+
"user": ["users:read", "users:read.email"],
|
|
6
|
+
"bot": [
|
|
7
|
+
"app_mentions:read",
|
|
8
|
+
"channels:history",
|
|
9
|
+
"channels:read",
|
|
10
|
+
"channels:join",
|
|
11
|
+
"chat:write",
|
|
12
|
+
"chat:write.public",
|
|
13
|
+
"commands",
|
|
14
|
+
"files:write",
|
|
15
|
+
"files:read",
|
|
16
|
+
"groups:history",
|
|
17
|
+
"groups:read",
|
|
18
|
+
"im:history",
|
|
19
|
+
"im:read",
|
|
20
|
+
"im:write",
|
|
21
|
+
"mpim:history",
|
|
22
|
+
"mpim:read",
|
|
23
|
+
"mpim:write",
|
|
24
|
+
"team:read",
|
|
25
|
+
"users:read",
|
|
26
|
+
"users:read.email",
|
|
27
|
+
"search:read.public",
|
|
28
|
+
"search:read.files",
|
|
29
|
+
"search:read.users"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { oauth_config };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { oauth_config } from "./slack-app-manifest.js";
|
|
2
|
+
|
|
3
|
+
//#region src/slack/slack-scopes.ts
|
|
4
|
+
const scopes = oauth_config.scopes?.bot;
|
|
5
|
+
if (!Array.isArray(scopes) || scopes.length === 0) throw new Error("slack-app-manifest.json is missing oauth_config.scopes.bot — check the manifest structure");
|
|
6
|
+
const BOT_SCOPES = scopes;
|
|
7
|
+
const BOT_SCOPES_CSV = BOT_SCOPES.join(",");
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { BOT_SCOPES, BOT_SCOPES_CSV };
|
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.16",
|
|
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.16"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@hono/zod-openapi": "^1.1.5",
|