@inkeep/agents-work-apps 0.58.18 → 0.58.20
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/env.js +7 -0
- package/dist/github/installation.d.ts +1 -1
- package/dist/github/installation.js +6 -3
- package/dist/github/routes/setup.d.ts +2 -2
- package/dist/github/routes/tokenExchange.js +16 -1
- package/dist/github/routes/webhooks.d.ts +2 -2
- package/dist/slack/mcp/index.d.ts +2 -2
- package/dist/slack/services/events/utils.d.ts +2 -2
- package/package.json +2 -2
package/dist/env.js
CHANGED
|
@@ -44,11 +44,18 @@ const envSchema = z.object({
|
|
|
44
44
|
INKEEP_AGENTS_JWT_SIGNING_SECRET: z.string().optional().describe("JWT signing secret shared with agents-api. Required in production (min 32 chars). Used for Slack user tokens and link tokens."),
|
|
45
45
|
INKEEP_AGENTS_API_URL: z.string().optional().describe("Inkeep Agents API URL")
|
|
46
46
|
});
|
|
47
|
+
const logEnvIssues = (scope, error) => {
|
|
48
|
+
for (const issue of error.issues) {
|
|
49
|
+
const key = issue.path.length > 0 ? issue.path.join(".") : "<root>";
|
|
50
|
+
console.error(`[${scope}] ${key}: ${issue.message}`);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
47
53
|
const parseEnv = () => {
|
|
48
54
|
try {
|
|
49
55
|
return envSchema.parse(process.env);
|
|
50
56
|
} catch (error) {
|
|
51
57
|
if (error instanceof z.ZodError) {
|
|
58
|
+
logEnvIssues("agents-work-apps env", error);
|
|
52
59
|
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
53
60
|
throw new Error(`❌ Invalid environment variables: ${missingVars.join(", ")}\n${error.message}`);
|
|
54
61
|
}
|
|
@@ -45,7 +45,7 @@ interface GitHubRepository {
|
|
|
45
45
|
type GenerateInstallationAccessTokenResult = GenerateTokenResult | GenerateTokenError;
|
|
46
46
|
declare function createAppJwt(): Promise<string>;
|
|
47
47
|
declare function lookupInstallationForRepo(repositoryOwner: string, repositoryName: string): Promise<LookupInstallationForRepoResult>;
|
|
48
|
-
declare function generateInstallationAccessToken(installationId: number): Promise<GenerateInstallationAccessTokenResult>;
|
|
48
|
+
declare function generateInstallationAccessToken(installationId: number, repositoryId: number): Promise<GenerateInstallationAccessTokenResult>;
|
|
49
49
|
declare function fetchInstallationDetails(installationId: string, appJwt: string): Promise<{
|
|
50
50
|
success: true;
|
|
51
51
|
installation: GitHubInstallationResponse;
|
|
@@ -100,7 +100,7 @@ async function lookupInstallationForRepo(repositoryOwner, repositoryName) {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
async function generateInstallationAccessToken(installationId) {
|
|
103
|
+
async function generateInstallationAccessToken(installationId, repositoryId) {
|
|
104
104
|
let appJwt;
|
|
105
105
|
try {
|
|
106
106
|
appJwt = await createAppJwt();
|
|
@@ -120,9 +120,11 @@ async function generateInstallationAccessToken(installationId) {
|
|
|
120
120
|
headers: {
|
|
121
121
|
Authorization: `Bearer ${appJwt}`,
|
|
122
122
|
Accept: "application/vnd.github+json",
|
|
123
|
+
"Content-Type": "application/json",
|
|
123
124
|
"X-GitHub-Api-Version": "2022-11-28",
|
|
124
125
|
"User-Agent": "inkeep-agents-api"
|
|
125
|
-
}
|
|
126
|
+
},
|
|
127
|
+
body: JSON.stringify({ repository_ids: [repositoryId] })
|
|
126
128
|
});
|
|
127
129
|
if (!response.ok) {
|
|
128
130
|
const errorText = await response.text();
|
|
@@ -159,7 +161,8 @@ async function generateInstallationAccessToken(installationId) {
|
|
|
159
161
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
160
162
|
logger.error({
|
|
161
163
|
error: message,
|
|
162
|
-
installationId
|
|
164
|
+
installationId,
|
|
165
|
+
repositoryId
|
|
163
166
|
}, "Error calling GitHub API to generate installation access token");
|
|
164
167
|
return {
|
|
165
168
|
success: false,
|
|
@@ -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 };
|
|
@@ -195,7 +195,22 @@ app.post("/", async (c) => {
|
|
|
195
195
|
reason: accessCheck.reason
|
|
196
196
|
}, "Project has access to repository");
|
|
197
197
|
}
|
|
198
|
-
const
|
|
198
|
+
const repositoryId = Number.parseInt(claims.repository_id, 10);
|
|
199
|
+
if (!Number.isSafeInteger(repositoryId) || repositoryId <= 0) {
|
|
200
|
+
const errorMessage = "OIDC token contains an invalid repository_id claim";
|
|
201
|
+
logger.warn({
|
|
202
|
+
repository: claims.repository,
|
|
203
|
+
repositoryId: claims.repository_id
|
|
204
|
+
}, errorMessage);
|
|
205
|
+
c.header("Content-Type", "application/problem+json");
|
|
206
|
+
return c.json({
|
|
207
|
+
title: "Bad Request",
|
|
208
|
+
status: 400,
|
|
209
|
+
detail: errorMessage,
|
|
210
|
+
error: errorMessage
|
|
211
|
+
}, 400);
|
|
212
|
+
}
|
|
213
|
+
const tokenResult = await generateInstallationAccessToken(installation.installationId, repositoryId);
|
|
199
214
|
if (!tokenResult.success) {
|
|
200
215
|
const { errorType, message } = tokenResult;
|
|
201
216
|
logger.error({
|
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -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
|
+
id: string;
|
|
12
13
|
createdAt: string;
|
|
13
14
|
updatedAt: string;
|
|
14
|
-
|
|
15
|
+
slackUserId: 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;
|
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.20",
|
|
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.20"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@hono/zod-openapi": "^1.1.5",
|