@inkeep/agents-api 0.0.0-dev-20260126093157 → 0.0.0-dev-20260126181806

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.
Files changed (31) hide show
  1. package/dist/.well-known/workflow/v1/manifest.debug.json +17 -17
  2. package/dist/.well-known/workflow/v1/step.cjs +3 -2
  3. package/dist/createApp.js +3 -0
  4. package/dist/domains/evals/routes/index.d.ts +2 -2
  5. package/dist/domains/evals/workflow/routes.d.ts +2 -2
  6. package/dist/domains/github/config.d.ts +14 -0
  7. package/dist/domains/github/config.js +47 -0
  8. package/dist/domains/github/index.d.ts +12 -0
  9. package/dist/domains/github/index.js +18 -0
  10. package/dist/domains/github/installation.d.ts +34 -0
  11. package/dist/domains/github/installation.js +172 -0
  12. package/dist/domains/github/jwks.d.ts +20 -0
  13. package/dist/domains/github/jwks.js +85 -0
  14. package/dist/domains/github/oidcToken.d.ts +22 -0
  15. package/dist/domains/github/oidcToken.js +140 -0
  16. package/dist/domains/github/routes/tokenExchange.d.ts +7 -0
  17. package/dist/domains/github/routes/tokenExchange.js +130 -0
  18. package/dist/domains/index.d.ts +2 -1
  19. package/dist/domains/index.js +2 -1
  20. package/dist/domains/manage/routes/conversations.d.ts +2 -2
  21. package/dist/domains/manage/routes/evals/evaluationResults.d.ts +2 -2
  22. package/dist/domains/manage/routes/index.d.ts +2 -2
  23. package/dist/domains/manage/routes/mcp.d.ts +2 -2
  24. package/dist/domains/run/context/ContextResolver.js +1 -1
  25. package/dist/domains/run/services/BaseCompressor.js +1 -1
  26. package/dist/factory.d.ts +22 -22
  27. package/dist/index.d.ts +22 -22
  28. package/dist/middleware/runAuth.d.ts +4 -4
  29. package/dist/middleware/tenantAccess.d.ts +2 -2
  30. package/dist/middleware/tracing.d.ts +3 -3
  31. package/package.json +4 -3
@@ -1,17 +1,14 @@
1
1
  {
2
2
  "steps": {
3
- "src/domains/evals/workflow/functions/runDatasetItem.ts": {
4
- "callChatApiStep": {
5
- "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//callChatApiStep"
6
- },
7
- "createRelationStep": {
8
- "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//createRelationStep"
3
+ "node_modules/.pnpm/workflow@4.0.1-beta.33_@aws-sdk+client-sts@3.970.0_@opentelemetry+api@1.9.0_@types+reac_d0e39273ec53983ee1a59c0952eb17f2/node_modules/workflow/dist/internal/builtins.js": {
4
+ "__builtin_response_array_buffer": {
5
+ "stepId": "__builtin_response_array_buffer"
9
6
  },
10
- "executeEvaluatorStep": {
11
- "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//executeEvaluatorStep"
7
+ "__builtin_response_json": {
8
+ "stepId": "__builtin_response_json"
12
9
  },
13
- "logStep": {
14
- "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//logStep"
10
+ "__builtin_response_text": {
11
+ "stepId": "__builtin_response_text"
15
12
  }
16
13
  },
17
14
  "src/domains/evals/workflow/functions/evaluateConversation.ts": {
@@ -28,15 +25,18 @@
28
25
  "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//logStep"
29
26
  }
30
27
  },
31
- "node_modules/.pnpm/workflow@4.0.1-beta.33_@aws-sdk+client-sts@3.970.0_@opentelemetry+api@1.9.0_@types+reac_d0e39273ec53983ee1a59c0952eb17f2/node_modules/workflow/dist/internal/builtins.js": {
32
- "__builtin_response_array_buffer": {
33
- "stepId": "__builtin_response_array_buffer"
28
+ "src/domains/evals/workflow/functions/runDatasetItem.ts": {
29
+ "callChatApiStep": {
30
+ "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//callChatApiStep"
34
31
  },
35
- "__builtin_response_json": {
36
- "stepId": "__builtin_response_json"
32
+ "createRelationStep": {
33
+ "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//createRelationStep"
37
34
  },
38
- "__builtin_response_text": {
39
- "stepId": "__builtin_response_text"
35
+ "executeEvaluatorStep": {
36
+ "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//executeEvaluatorStep"
37
+ },
38
+ "logStep": {
39
+ "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//logStep"
40
40
  }
41
41
  }
42
42
  },
@@ -101700,7 +101700,8 @@ var TOOL_STATUS_VALUES = [
101700
101700
  "healthy",
101701
101701
  "unhealthy",
101702
101702
  "unknown",
101703
- "needs_auth"
101703
+ "needs_auth",
101704
+ "unavailable"
101704
101705
  ];
101705
101706
  var VALID_RELATION_TYPES = [
101706
101707
  "transfer",
@@ -148101,7 +148102,7 @@ var { RelationshipUpdate_Operation: RelationshipUpdate_Operation2, CheckPermissi
148101
148102
 
148102
148103
  // ../packages/agents-core/dist/constants/execution-limits-shared/defaults.js
148103
148104
  var executionLimitsSharedDefaults = {
148104
- MCP_TOOL_CONNECTION_TIMEOUT_MS: 3e3,
148105
+ MCP_TOOL_CONNECTION_TIMEOUT_MS: 1e4,
148105
148106
  MCP_TOOL_MAX_RETRIES: 3,
148106
148107
  MCP_TOOL_MAX_RECONNECTION_DELAY_MS: 3e4,
148107
148108
  MCP_TOOL_INITIAL_RECONNECTION_DELAY_MS: 1e3,
package/dist/createApp.js CHANGED
@@ -2,6 +2,7 @@ import { getLogger } from "./logger.js";
2
2
  import { env } from "./env.js";
3
3
  import { evalRoutes } from "./domains/evals/index.js";
4
4
  import { workflowRoutes } from "./domains/evals/workflow/routes.js";
5
+ import { githubRoutes } from "./domains/github/index.js";
5
6
  import { sessionAuth, sessionContext } from "./middleware/sessionAuth.js";
6
7
  import { manageRoutes } from "./domains/manage/index.js";
7
8
  import { flushBatchProcessor } from "./instrumentation.js";
@@ -53,6 +54,7 @@ function createAgentsHono(config) {
53
54
  if (c.req.path.startsWith("/run/")) return next();
54
55
  if (c.req.path.includes("/playground/token")) return next();
55
56
  if (c.req.path.includes("/signoz/")) return next();
57
+ if (c.req.path.includes("/api/github/")) return next();
56
58
  return cors(defaultCorsConfig)(c, next);
57
59
  });
58
60
  app.use("*", async (c, next) => {
@@ -187,6 +189,7 @@ function createAgentsHono(config) {
187
189
  return fetch(forwardedRequest);
188
190
  });
189
191
  app.route("/evals", evalRoutes);
192
+ app.route("/api/github", githubRoutes);
190
193
  setupOpenAPIRoutes(app);
191
194
  app.use("/run/*", async (_c, next) => {
192
195
  await next();
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono15 from "hono";
2
+ import * as hono18 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono15.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono18.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types7 from "hono/types";
2
+ import * as hono_types12 from "hono/types";
3
3
 
4
4
  //#region src/domains/evals/workflow/routes.d.ts
5
- declare const workflowRoutes: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
5
+ declare const workflowRoutes: Hono<hono_types12.BlankEnv, hono_types12.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { workflowRoutes };
@@ -0,0 +1,14 @@
1
+ import { z } from "@hono/zod-openapi";
2
+
3
+ //#region src/domains/github/config.d.ts
4
+ declare const GitHubAppConfigSchema: z.ZodObject<{
5
+ appId: z.ZodString;
6
+ privateKey: z.ZodString;
7
+ }, z.core.$strip>;
8
+ type GitHubAppConfig = z.infer<typeof GitHubAppConfigSchema>;
9
+ declare function getGitHubAppConfig(): GitHubAppConfig;
10
+ declare function isGitHubAppConfigured(): boolean;
11
+ declare function validateGitHubAppConfigOnStartup(): void;
12
+ declare function clearConfigCache(): void;
13
+ //#endregion
14
+ export { GitHubAppConfig, clearConfigCache, getGitHubAppConfig, isGitHubAppConfigured, validateGitHubAppConfigOnStartup };
@@ -0,0 +1,47 @@
1
+ import { getLogger } from "../../logger.js";
2
+ import { z } from "@hono/zod-openapi";
3
+
4
+ //#region src/domains/github/config.ts
5
+ const logger = getLogger("github-config");
6
+ const GitHubAppConfigSchema = z.object({
7
+ appId: z.string().min(1, "GITHUB_APP_ID is required"),
8
+ privateKey: z.string().min(1, "GITHUB_APP_PRIVATE_KEY is required")
9
+ });
10
+ let cachedConfig = null;
11
+ function getGitHubAppConfig() {
12
+ if (cachedConfig) return cachedConfig;
13
+ const appId = process.env.GITHUB_APP_ID;
14
+ const privateKey = process.env.GITHUB_APP_PRIVATE_KEY?.replace(/\\n/g, "\n");
15
+ const result = GitHubAppConfigSchema.safeParse({
16
+ appId,
17
+ privateKey
18
+ });
19
+ if (!result.success) {
20
+ const errorMessage = `GitHub App credentials are not configured. ${result.error.issues.map((issue) => issue.message).join(". ")}. Please set GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY environment variables.`;
21
+ logger.error({}, errorMessage);
22
+ throw new Error(errorMessage);
23
+ }
24
+ cachedConfig = result.data;
25
+ logger.info({}, "GitHub App credentials loaded successfully");
26
+ return cachedConfig;
27
+ }
28
+ function isGitHubAppConfigured() {
29
+ return Boolean(process.env.GITHUB_APP_ID && process.env.GITHUB_APP_PRIVATE_KEY);
30
+ }
31
+ function validateGitHubAppConfigOnStartup() {
32
+ if (!isGitHubAppConfigured()) {
33
+ logger.warn({}, "GitHub App credentials not configured. Token exchange endpoint will return 500 errors. Set GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY to enable the feature.");
34
+ return;
35
+ }
36
+ try {
37
+ getGitHubAppConfig();
38
+ } catch (error) {
39
+ logger.error({ error }, "GitHub App credentials are invalid. Token exchange endpoint will return 500 errors.");
40
+ }
41
+ }
42
+ function clearConfigCache() {
43
+ cachedConfig = null;
44
+ }
45
+
46
+ //#endregion
47
+ export { clearConfigCache, getGitHubAppConfig, isGitHubAppConfigured, validateGitHubAppConfigOnStartup };
@@ -0,0 +1,12 @@
1
+ import { GitHubAppConfig, getGitHubAppConfig, isGitHubAppConfigured } from "./config.js";
2
+ import { GenerateInstallationAccessTokenResult, GenerateTokenError, GenerateTokenResult, InstallationAccessToken, InstallationInfo, LookupInstallationError, LookupInstallationForRepoResult, LookupInstallationResult, generateInstallationAccessToken, lookupInstallationForRepo } from "./installation.js";
3
+ import { GetJwkResult, JwksError, JwksResult, clearJwksCache, getJwkForToken, getJwksCacheStatus } from "./jwks.js";
4
+ import { GitHubOidcClaims, ValidateOidcTokenResult, ValidateTokenError, ValidateTokenResult, validateOidcToken } from "./oidcToken.js";
5
+ import { Hono } from "hono";
6
+ import * as hono_types5 from "hono/types";
7
+
8
+ //#region src/domains/github/index.d.ts
9
+ declare function createGithubRoutes(): Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
10
+ declare const githubRoutes: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
11
+ //#endregion
12
+ export { type GenerateInstallationAccessTokenResult, type GenerateTokenError, type GenerateTokenResult, type GetJwkResult, type GitHubAppConfig, type GitHubOidcClaims, type InstallationAccessToken, type InstallationInfo, type JwksError, type JwksResult, type LookupInstallationError, type LookupInstallationForRepoResult, type LookupInstallationResult, type ValidateOidcTokenResult, type ValidateTokenError, type ValidateTokenResult, clearJwksCache, createGithubRoutes, generateInstallationAccessToken, getGitHubAppConfig, getJwkForToken, getJwksCacheStatus, githubRoutes, isGitHubAppConfigured, lookupInstallationForRepo, validateOidcToken };
@@ -0,0 +1,18 @@
1
+ import { getGitHubAppConfig, isGitHubAppConfigured, validateGitHubAppConfigOnStartup } from "./config.js";
2
+ import { generateInstallationAccessToken, lookupInstallationForRepo } from "./installation.js";
3
+ import { clearJwksCache, getJwkForToken, getJwksCacheStatus } from "./jwks.js";
4
+ import { validateOidcToken } from "./oidcToken.js";
5
+ import tokenExchange_default from "./routes/tokenExchange.js";
6
+ import { Hono } from "hono";
7
+
8
+ //#region src/domains/github/index.ts
9
+ function createGithubRoutes() {
10
+ validateGitHubAppConfigOnStartup();
11
+ const app = new Hono();
12
+ app.route("/token-exchange", tokenExchange_default);
13
+ return app;
14
+ }
15
+ const githubRoutes = createGithubRoutes();
16
+
17
+ //#endregion
18
+ export { clearJwksCache, createGithubRoutes, generateInstallationAccessToken, getGitHubAppConfig, getJwkForToken, getJwksCacheStatus, githubRoutes, isGitHubAppConfigured, lookupInstallationForRepo, validateOidcToken };
@@ -0,0 +1,34 @@
1
+ //#region src/domains/github/installation.d.ts
2
+ interface InstallationInfo {
3
+ installationId: number;
4
+ accountLogin: string;
5
+ accountType: 'User' | 'Organization';
6
+ }
7
+ interface LookupInstallationResult {
8
+ success: true;
9
+ installation: InstallationInfo;
10
+ }
11
+ interface LookupInstallationError {
12
+ success: false;
13
+ errorType: 'not_installed' | 'api_error' | 'jwt_error';
14
+ message: string;
15
+ }
16
+ type LookupInstallationForRepoResult = LookupInstallationResult | LookupInstallationError;
17
+ interface InstallationAccessToken {
18
+ token: string;
19
+ expiresAt: string;
20
+ }
21
+ interface GenerateTokenResult {
22
+ success: true;
23
+ accessToken: InstallationAccessToken;
24
+ }
25
+ interface GenerateTokenError {
26
+ success: false;
27
+ errorType: 'api_error' | 'jwt_error';
28
+ message: string;
29
+ }
30
+ type GenerateInstallationAccessTokenResult = GenerateTokenResult | GenerateTokenError;
31
+ declare function lookupInstallationForRepo(repositoryOwner: string, repositoryName: string): Promise<LookupInstallationForRepoResult>;
32
+ declare function generateInstallationAccessToken(installationId: number): Promise<GenerateInstallationAccessTokenResult>;
33
+ //#endregion
34
+ export { GenerateInstallationAccessTokenResult, GenerateTokenError, GenerateTokenResult, InstallationAccessToken, InstallationInfo, LookupInstallationError, LookupInstallationForRepoResult, LookupInstallationResult, generateInstallationAccessToken, lookupInstallationForRepo };
@@ -0,0 +1,172 @@
1
+ import { getLogger } from "../../logger.js";
2
+ import { getGitHubAppConfig } from "./config.js";
3
+ import { createPrivateKey } from "node:crypto";
4
+ import { SignJWT } from "jose";
5
+
6
+ //#region src/domains/github/installation.ts
7
+ const logger = getLogger("github-installation");
8
+ const GITHUB_API_BASE = "https://api.github.com";
9
+ async function createAppJwt() {
10
+ const config = getGitHubAppConfig();
11
+ const privateKey = createPrivateKey({
12
+ key: config.privateKey,
13
+ format: "pem"
14
+ });
15
+ const now = Math.floor(Date.now() / 1e3);
16
+ return await new SignJWT({}).setProtectedHeader({ alg: "RS256" }).setIssuedAt(now - 60).setExpirationTime(now + 600).setIssuer(config.appId).sign(privateKey);
17
+ }
18
+ async function lookupInstallationForRepo(repositoryOwner, repositoryName) {
19
+ let appJwt;
20
+ try {
21
+ appJwt = await createAppJwt();
22
+ } catch (error) {
23
+ const message = error instanceof Error ? error.message : "Unknown error";
24
+ logger.error({ error: message }, "Failed to create GitHub App JWT");
25
+ return {
26
+ success: false,
27
+ errorType: "jwt_error",
28
+ message: `Failed to create GitHub App authentication: ${message}`
29
+ };
30
+ }
31
+ const url = `${GITHUB_API_BASE}/repos/${repositoryOwner}/${repositoryName}/installation`;
32
+ try {
33
+ const response = await fetch(url, {
34
+ method: "GET",
35
+ headers: {
36
+ Authorization: `Bearer ${appJwt}`,
37
+ Accept: "application/vnd.github+json",
38
+ "X-GitHub-Api-Version": "2022-11-28",
39
+ "User-Agent": "inkeep-agents-api"
40
+ }
41
+ });
42
+ if (response.status === 404) return {
43
+ success: false,
44
+ errorType: "not_installed",
45
+ message: `GitHub App is not installed on repository ${repositoryOwner}/${repositoryName}. Please install the Inkeep Agents GitHub App on the repository to enable token exchange.`
46
+ };
47
+ if (!response.ok) {
48
+ const errorText = await response.text();
49
+ logger.error({
50
+ status: response.status,
51
+ error: errorText,
52
+ repositoryOwner,
53
+ repositoryName
54
+ }, "GitHub API error looking up installation");
55
+ return {
56
+ success: false,
57
+ errorType: "api_error",
58
+ message: `GitHub API error (${response.status}): Failed to look up installation for repository`
59
+ };
60
+ }
61
+ const data = await response.json();
62
+ const installationId = data.id;
63
+ const accountLogin = data.account?.login;
64
+ const accountType = data.account?.type;
65
+ if (typeof installationId !== "number" || typeof accountLogin !== "string") {
66
+ logger.error({ data }, "Unexpected response format from GitHub API");
67
+ return {
68
+ success: false,
69
+ errorType: "api_error",
70
+ message: "Unexpected response format from GitHub API"
71
+ };
72
+ }
73
+ logger.info({
74
+ installationId,
75
+ accountLogin,
76
+ accountType,
77
+ repositoryOwner,
78
+ repositoryName
79
+ }, "Found GitHub App installation for repository");
80
+ return {
81
+ success: true,
82
+ installation: {
83
+ installationId,
84
+ accountLogin,
85
+ accountType: accountType === "Organization" ? "Organization" : "User"
86
+ }
87
+ };
88
+ } catch (error) {
89
+ const message = error instanceof Error ? error.message : "Unknown error";
90
+ logger.error({
91
+ error: message,
92
+ repositoryOwner,
93
+ repositoryName
94
+ }, "Error calling GitHub API to look up installation");
95
+ return {
96
+ success: false,
97
+ errorType: "api_error",
98
+ message: `Failed to connect to GitHub API: ${message}`
99
+ };
100
+ }
101
+ }
102
+ async function generateInstallationAccessToken(installationId) {
103
+ let appJwt;
104
+ try {
105
+ appJwt = await createAppJwt();
106
+ } catch (error) {
107
+ const message = error instanceof Error ? error.message : "Unknown error";
108
+ logger.error({ error: message }, "Failed to create GitHub App JWT for token generation");
109
+ return {
110
+ success: false,
111
+ errorType: "jwt_error",
112
+ message: `Failed to create GitHub App authentication: ${message}`
113
+ };
114
+ }
115
+ const url = `${GITHUB_API_BASE}/app/installations/${installationId}/access_tokens`;
116
+ try {
117
+ const response = await fetch(url, {
118
+ method: "POST",
119
+ headers: {
120
+ Authorization: `Bearer ${appJwt}`,
121
+ Accept: "application/vnd.github+json",
122
+ "X-GitHub-Api-Version": "2022-11-28",
123
+ "User-Agent": "inkeep-agents-api"
124
+ }
125
+ });
126
+ if (!response.ok) {
127
+ const errorText = await response.text();
128
+ logger.error({
129
+ status: response.status,
130
+ error: errorText,
131
+ installationId
132
+ }, "GitHub API error generating installation access token");
133
+ return {
134
+ success: false,
135
+ errorType: "api_error",
136
+ message: `GitHub API error (${response.status}): Failed to generate installation access token`
137
+ };
138
+ }
139
+ const data = await response.json();
140
+ const token = data.token;
141
+ const expiresAt = data.expires_at;
142
+ if (typeof token !== "string" || typeof expiresAt !== "string") {
143
+ logger.error({ data }, "Unexpected response format from GitHub API for token generation");
144
+ return {
145
+ success: false,
146
+ errorType: "api_error",
147
+ message: "Unexpected response format from GitHub API"
148
+ };
149
+ }
150
+ return {
151
+ success: true,
152
+ accessToken: {
153
+ token,
154
+ expiresAt
155
+ }
156
+ };
157
+ } catch (error) {
158
+ const message = error instanceof Error ? error.message : "Unknown error";
159
+ logger.error({
160
+ error: message,
161
+ installationId
162
+ }, "Error calling GitHub API to generate installation access token");
163
+ return {
164
+ success: false,
165
+ errorType: "api_error",
166
+ message: `Failed to connect to GitHub API: ${message}`
167
+ };
168
+ }
169
+ }
170
+
171
+ //#endregion
172
+ export { generateInstallationAccessToken, lookupInstallationForRepo };
@@ -0,0 +1,20 @@
1
+ import { CryptoKey, JWSHeaderParameters } from "jose";
2
+
3
+ //#region src/domains/github/jwks.d.ts
4
+ interface JwksResult {
5
+ success: true;
6
+ key: CryptoKey;
7
+ }
8
+ interface JwksError {
9
+ success: false;
10
+ error: string;
11
+ }
12
+ type GetJwkResult = JwksResult | JwksError;
13
+ declare function getJwkForToken(header: JWSHeaderParameters): Promise<GetJwkResult>;
14
+ declare function clearJwksCache(): void;
15
+ declare function getJwksCacheStatus(): {
16
+ cached: boolean;
17
+ expiresIn?: number;
18
+ };
19
+ //#endregion
20
+ export { GetJwkResult, JwksError, JwksResult, clearJwksCache, getJwkForToken, getJwksCacheStatus };
@@ -0,0 +1,85 @@
1
+ import { getLogger } from "../../logger.js";
2
+ import { createRemoteJWKSet } from "jose";
3
+
4
+ //#region src/domains/github/jwks.ts
5
+ const logger = getLogger("github-jwks");
6
+ const GITHUB_OIDC_JWKS_URL = "https://token.actions.githubusercontent.com/.well-known/jwks";
7
+ const CACHE_TTL_MS = 3600 * 1e3;
8
+ let jwksCache = null;
9
+ function createJwksWithLogging() {
10
+ logger.info({}, "Creating new JWKS fetch function for GitHub OIDC");
11
+ return createRemoteJWKSet(new URL(GITHUB_OIDC_JWKS_URL), { cacheMaxAge: CACHE_TTL_MS });
12
+ }
13
+ function isCacheExpired() {
14
+ if (!jwksCache) return true;
15
+ return Date.now() - jwksCache.fetchedAt > CACHE_TTL_MS;
16
+ }
17
+ function getOrCreateJwksFunction() {
18
+ if (!jwksCache || isCacheExpired()) jwksCache = {
19
+ jwks: createJwksWithLogging(),
20
+ fetchedAt: Date.now()
21
+ };
22
+ return jwksCache.jwks;
23
+ }
24
+ async function getJwkForToken(header) {
25
+ const kid = header.kid;
26
+ if (!kid) return {
27
+ success: false,
28
+ error: "Token is missing key ID (kid) in header"
29
+ };
30
+ try {
31
+ const key = await getOrCreateJwksFunction()(header);
32
+ logger.debug({ kid }, "Successfully retrieved JWK for token");
33
+ return {
34
+ success: true,
35
+ key
36
+ };
37
+ } catch (error) {
38
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
39
+ if (errorMessage.includes("no applicable key found")) {
40
+ logger.warn({ kid }, "Key ID not found in JWKS, refreshing cache");
41
+ jwksCache = null;
42
+ try {
43
+ const key = await getOrCreateJwksFunction()(header);
44
+ logger.info({ kid }, "Successfully retrieved JWK after cache refresh");
45
+ return {
46
+ success: true,
47
+ key
48
+ };
49
+ } catch (retryError) {
50
+ const retryErrorMessage = retryError instanceof Error ? retryError.message : "Unknown error";
51
+ logger.error({
52
+ kid,
53
+ error: retryErrorMessage
54
+ }, "Failed to retrieve JWK after cache refresh");
55
+ return {
56
+ success: false,
57
+ error: `Key ID '${kid}' not found in GitHub OIDC JWKS`
58
+ };
59
+ }
60
+ }
61
+ logger.error({
62
+ kid,
63
+ error: errorMessage
64
+ }, "Failed to fetch JWKS from GitHub");
65
+ return {
66
+ success: false,
67
+ error: `Failed to fetch GitHub OIDC JWKS: ${errorMessage}`
68
+ };
69
+ }
70
+ }
71
+ function clearJwksCache() {
72
+ jwksCache = null;
73
+ logger.debug({}, "JWKS cache cleared");
74
+ }
75
+ function getJwksCacheStatus() {
76
+ if (!jwksCache) return { cached: false };
77
+ const expiresIn = CACHE_TTL_MS - (Date.now() - jwksCache.fetchedAt);
78
+ return {
79
+ cached: true,
80
+ expiresIn: Math.max(0, expiresIn)
81
+ };
82
+ }
83
+
84
+ //#endregion
85
+ export { clearJwksCache, getJwkForToken, getJwksCacheStatus };
@@ -0,0 +1,22 @@
1
+ //#region src/domains/github/oidcToken.d.ts
2
+ interface GitHubOidcClaims {
3
+ repository: string;
4
+ repository_owner: string;
5
+ repository_id: string;
6
+ workflow: string;
7
+ actor: string;
8
+ ref: string;
9
+ }
10
+ interface ValidateTokenResult {
11
+ success: true;
12
+ claims: GitHubOidcClaims;
13
+ }
14
+ interface ValidateTokenError {
15
+ success: false;
16
+ errorType: 'invalid_signature' | 'expired' | 'wrong_issuer' | 'wrong_audience' | 'malformed' | 'jwks_error';
17
+ message: string;
18
+ }
19
+ type ValidateOidcTokenResult = ValidateTokenResult | ValidateTokenError;
20
+ declare function validateOidcToken(token: string): Promise<ValidateOidcTokenResult>;
21
+ //#endregion
22
+ export { GitHubOidcClaims, ValidateOidcTokenResult, ValidateTokenError, ValidateTokenResult, validateOidcToken };
@@ -0,0 +1,140 @@
1
+ import { getLogger } from "../../logger.js";
2
+ import { getJwkForToken } from "./jwks.js";
3
+ import { decodeProtectedHeader, errors, jwtVerify } from "jose";
4
+
5
+ //#region src/domains/github/oidcToken.ts
6
+ const logger = getLogger("github-oidc-token");
7
+ const GITHUB_OIDC_ISSUER = "https://token.actions.githubusercontent.com";
8
+ const EXPECTED_AUDIENCE = "inkeep-agents-action";
9
+ async function validateOidcToken(token) {
10
+ let header;
11
+ try {
12
+ header = decodeProtectedHeader(token);
13
+ } catch (error) {
14
+ const message = error instanceof Error ? error.message : "Unknown error";
15
+ logger.warn({ error: message }, "Failed to decode JWT header");
16
+ return {
17
+ success: false,
18
+ errorType: "malformed",
19
+ message: "Invalid JWT format: unable to decode token header"
20
+ };
21
+ }
22
+ if (header.alg !== "RS256") {
23
+ logger.warn({ algorithm: header.alg }, "Unexpected JWT algorithm");
24
+ return {
25
+ success: false,
26
+ errorType: "malformed",
27
+ message: `Invalid JWT algorithm: expected RS256, got ${header.alg}`
28
+ };
29
+ }
30
+ const jwkResult = await getJwkForToken(header);
31
+ if (!jwkResult.success) {
32
+ logger.error({ error: jwkResult.error }, "Failed to get JWK for token");
33
+ return {
34
+ success: false,
35
+ errorType: "jwks_error",
36
+ message: jwkResult.error
37
+ };
38
+ }
39
+ try {
40
+ const { payload } = await jwtVerify(token, jwkResult.key, {
41
+ issuer: GITHUB_OIDC_ISSUER,
42
+ audience: EXPECTED_AUDIENCE
43
+ });
44
+ const repository = payload.repository;
45
+ const repositoryOwner = payload.repository_owner;
46
+ const repositoryId = payload.repository_id;
47
+ const workflow = payload.workflow;
48
+ const actor = payload.actor;
49
+ const ref = payload.ref;
50
+ if (typeof repository !== "string" || typeof repositoryOwner !== "string" || typeof repositoryId !== "string" || typeof workflow !== "string" || typeof actor !== "string" || typeof ref !== "string") {
51
+ logger.warn({ payload }, "OIDC token missing required claims");
52
+ return {
53
+ success: false,
54
+ errorType: "malformed",
55
+ message: "OIDC token missing required claims: repository, repository_owner, repository_id, workflow, actor, or ref"
56
+ };
57
+ }
58
+ logger.info({
59
+ repository,
60
+ actor
61
+ }, "Successfully validated OIDC token");
62
+ return {
63
+ success: true,
64
+ claims: {
65
+ repository,
66
+ repository_owner: repositoryOwner,
67
+ repository_id: repositoryId,
68
+ workflow,
69
+ actor,
70
+ ref
71
+ }
72
+ };
73
+ } catch (error) {
74
+ if (error instanceof errors.JWTExpired) {
75
+ logger.warn({}, "OIDC token has expired");
76
+ return {
77
+ success: false,
78
+ errorType: "expired",
79
+ message: "OIDC token has expired"
80
+ };
81
+ }
82
+ if (error instanceof errors.JWTClaimValidationFailed) {
83
+ const claimError = error;
84
+ if (claimError.claim === "iss") {
85
+ logger.warn({ issuer: claimError.reason }, "Invalid OIDC token issuer");
86
+ return {
87
+ success: false,
88
+ errorType: "wrong_issuer",
89
+ message: `Invalid token issuer: expected ${GITHUB_OIDC_ISSUER}`
90
+ };
91
+ }
92
+ if (claimError.claim === "aud") {
93
+ logger.warn({ audience: claimError.reason }, "Invalid OIDC token audience");
94
+ return {
95
+ success: false,
96
+ errorType: "wrong_audience",
97
+ message: `Invalid token audience: expected ${EXPECTED_AUDIENCE}`
98
+ };
99
+ }
100
+ logger.warn({
101
+ claim: claimError.claim,
102
+ reason: claimError.reason
103
+ }, "JWT claim validation failed");
104
+ return {
105
+ success: false,
106
+ errorType: "malformed",
107
+ message: `JWT claim validation failed: ${claimError.claim} ${claimError.reason}`
108
+ };
109
+ }
110
+ if (error instanceof errors.JWSSignatureVerificationFailed) {
111
+ logger.warn({}, "Invalid OIDC token signature");
112
+ return {
113
+ success: false,
114
+ errorType: "invalid_signature",
115
+ message: "Invalid token signature"
116
+ };
117
+ }
118
+ if (error instanceof errors.JOSEError) {
119
+ logger.error({
120
+ error: error.message,
121
+ code: error.code
122
+ }, "JOSE error during token validation");
123
+ return {
124
+ success: false,
125
+ errorType: "malformed",
126
+ message: `Token validation error: ${error.message}`
127
+ };
128
+ }
129
+ const message = error instanceof Error ? error.message : "Unknown error";
130
+ logger.error({ error: message }, "Unexpected error during token validation");
131
+ return {
132
+ success: false,
133
+ errorType: "malformed",
134
+ message: `Token validation error: ${message}`
135
+ };
136
+ }
137
+ }
138
+
139
+ //#endregion
140
+ export { validateOidcToken };
@@ -0,0 +1,7 @@
1
+ import { Hono } from "hono";
2
+ import * as hono_types14 from "hono/types";
3
+
4
+ //#region src/domains/github/routes/tokenExchange.d.ts
5
+ declare const app: Hono<hono_types14.BlankEnv, hono_types14.BlankSchema, "/">;
6
+ //#endregion
7
+ export { app as default };
@@ -0,0 +1,130 @@
1
+ import { getLogger } from "../../../logger.js";
2
+ import { isGitHubAppConfigured } from "../config.js";
3
+ import { generateInstallationAccessToken, lookupInstallationForRepo } from "../installation.js";
4
+ import { validateOidcToken } from "../oidcToken.js";
5
+ import { Hono } from "hono";
6
+ import { z } from "zod";
7
+
8
+ //#region src/domains/github/routes/tokenExchange.ts
9
+ const logger = getLogger("github-token-exchange");
10
+ const TokenExchangeRequestSchema = z.object({ oidc_token: z.string() });
11
+ const app = new Hono();
12
+ /**
13
+ * Exchange GitHub OIDC token for installation token.
14
+ *
15
+ * This is an internal infrastructure endpoint called by the CLI from GitHub Actions.
16
+ * It exchanges a GitHub Actions OIDC token for a GitHub App installation access token.
17
+ * Not included in the public OpenAPI spec.
18
+ */
19
+ app.post("/", async (c) => {
20
+ const rawBody = await c.req.json().catch(() => null);
21
+ const parseResult = TokenExchangeRequestSchema.safeParse(rawBody);
22
+ if (!parseResult.success) {
23
+ const errorMessage = parseResult.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
24
+ c.header("Content-Type", "application/problem+json");
25
+ return c.json({
26
+ title: "Bad Request",
27
+ status: 400,
28
+ detail: errorMessage,
29
+ error: errorMessage
30
+ }, 400);
31
+ }
32
+ const body = parseResult.data;
33
+ logger.info({}, "Processing token exchange request");
34
+ if (!isGitHubAppConfigured()) {
35
+ logger.error({}, "GitHub App credentials not configured");
36
+ const errorMessage = "GitHub App credentials are not configured. Please contact the administrator to set up GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY.";
37
+ c.header("Content-Type", "application/problem+json");
38
+ return c.json({
39
+ title: "GitHub App Not Configured",
40
+ status: 500,
41
+ detail: errorMessage,
42
+ error: errorMessage
43
+ }, 500);
44
+ }
45
+ const validationResult = await validateOidcToken(body.oidc_token);
46
+ if (!validationResult.success) {
47
+ const errorType = validationResult.errorType;
48
+ logger.warn({
49
+ errorType,
50
+ message: validationResult.message
51
+ }, "OIDC token validation failed");
52
+ c.header("Content-Type", "application/problem+json");
53
+ if (errorType === "malformed") return c.json({
54
+ title: "Bad Request",
55
+ status: 400,
56
+ detail: validationResult.message,
57
+ error: validationResult.message
58
+ }, 400);
59
+ return c.json({
60
+ title: "Token Validation Failed",
61
+ status: 401,
62
+ detail: validationResult.message,
63
+ error: validationResult.message
64
+ }, 401);
65
+ }
66
+ const { claims } = validationResult;
67
+ const installationResult = await lookupInstallationForRepo(claims.repository_owner, claims.repository.split("/")[1]);
68
+ if (!installationResult.success) {
69
+ const { errorType, message } = installationResult;
70
+ if (errorType === "not_installed") {
71
+ c.header("Content-Type", "application/problem+json");
72
+ return c.json({
73
+ title: "GitHub App Not Installed",
74
+ status: 403,
75
+ detail: message,
76
+ error: message
77
+ }, 403);
78
+ }
79
+ logger.error({
80
+ errorType,
81
+ message,
82
+ repository: claims.repository
83
+ }, "Failed to look up GitHub App installation");
84
+ c.header("Content-Type", "application/problem+json");
85
+ return c.json({
86
+ title: "Installation Lookup Failed",
87
+ status: 500,
88
+ detail: message,
89
+ error: message
90
+ }, 500);
91
+ }
92
+ const { installation } = installationResult;
93
+ logger.info({
94
+ installationId: installation.installationId,
95
+ repository: claims.repository
96
+ }, "Found GitHub App installation");
97
+ const tokenResult = await generateInstallationAccessToken(installation.installationId);
98
+ if (!tokenResult.success) {
99
+ const { errorType, message } = tokenResult;
100
+ logger.error({
101
+ errorType,
102
+ message,
103
+ installationId: installation.installationId,
104
+ repository: claims.repository
105
+ }, "Failed to generate installation access token");
106
+ c.header("Content-Type", "application/problem+json");
107
+ return c.json({
108
+ title: "Token Generation Failed",
109
+ status: 500,
110
+ detail: message,
111
+ error: message
112
+ }, 500);
113
+ }
114
+ const { accessToken } = tokenResult;
115
+ logger.info({
116
+ installationId: installation.installationId,
117
+ repository: claims.repository,
118
+ expiresAt: accessToken.expiresAt
119
+ }, "Token exchange completed successfully");
120
+ return c.json({
121
+ token: accessToken.token,
122
+ expires_at: accessToken.expiresAt,
123
+ repository: claims.repository,
124
+ installation_id: installation.installationId
125
+ }, 200);
126
+ });
127
+ var tokenExchange_default = app;
128
+
129
+ //#endregion
130
+ export { tokenExchange_default as default };
@@ -1,4 +1,5 @@
1
1
  import { createEvalRoutes, evalRoutes } from "./evals/index.js";
2
+ import { createGithubRoutes, githubRoutes } from "./github/index.js";
2
3
  import { createManageRoutes, manageRoutes } from "./manage/index.js";
3
4
  import { createRunRoutes, runRoutes } from "./run/index.js";
4
- export { createEvalRoutes, createManageRoutes, createRunRoutes, evalRoutes, manageRoutes, runRoutes };
5
+ export { createEvalRoutes, createGithubRoutes, createManageRoutes, createRunRoutes, evalRoutes, githubRoutes, manageRoutes, runRoutes };
@@ -1,5 +1,6 @@
1
1
  import { createEvalRoutes, evalRoutes } from "./evals/index.js";
2
+ import { createGithubRoutes, githubRoutes } from "./github/index.js";
2
3
  import { createManageRoutes, manageRoutes } from "./manage/index.js";
3
4
  import { createRunRoutes, runRoutes } from "./run/index.js";
4
5
 
5
- export { createEvalRoutes, createManageRoutes, createRunRoutes, evalRoutes, manageRoutes, runRoutes };
6
+ export { createEvalRoutes, createGithubRoutes, createManageRoutes, createRunRoutes, evalRoutes, githubRoutes, manageRoutes, runRoutes };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono16 from "hono";
2
+ import * as hono14 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/conversations.d.ts
5
- declare const app: OpenAPIHono<hono16.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono14.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono18 from "hono";
2
+ import * as hono15 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/evals/evaluationResults.d.ts
5
- declare const app: OpenAPIHono<hono18.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono15.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono6 from "hono";
2
+ import * as hono16 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono6.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono16.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types5 from "hono/types";
2
+ import * as hono_types10 from "hono/types";
3
3
 
4
4
  //#region src/domains/manage/routes/mcp.d.ts
5
- declare const app: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types10.BlankEnv, hono_types10.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,8 +1,8 @@
1
1
  import { ContextCache } from "./contextCache.js";
2
2
  import { ContextFetcher, MissingRequiredVariableError } from "./ContextFetcher.js";
3
3
  import { getLogger, getTracer, setSpanWithError } from "@inkeep/agents-core";
4
- import { SpanStatusCode } from "@opentelemetry/api";
5
4
  import crypto from "node:crypto";
5
+ import { SpanStatusCode } from "@opentelemetry/api";
6
6
 
7
7
  //#region src/domains/run/context/ContextResolver.ts
8
8
  const logger = getLogger("context-resolver");
@@ -5,8 +5,8 @@ import { getCompressionConfigForModel } from "../utils/model-context-utils.js";
5
5
  import { tracer } from "../utils/tracer.js";
6
6
  import { agentSessionManager } from "./AgentSession.js";
7
7
  import { getLedgerArtifacts } from "@inkeep/agents-core";
8
- import { SpanStatusCode } from "@opentelemetry/api";
9
8
  import { randomUUID } from "node:crypto";
9
+ import { SpanStatusCode } from "@opentelemetry/api";
10
10
 
11
11
  //#region src/domains/run/services/BaseCompressor.ts
12
12
  const logger = getLogger$1("BaseCompressor");
package/dist/factory.d.ts CHANGED
@@ -795,25 +795,25 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
795
795
  ac: better_auth_plugins0.AccessControl;
796
796
  roles: {
797
797
  member: {
798
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
799
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key];
798
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
799
+ actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
800
800
  connector: "OR" | "AND";
801
801
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
802
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>;
802
+ statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
803
803
  };
804
804
  admin: {
805
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
806
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key];
805
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
806
+ actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
807
807
  connector: "OR" | "AND";
808
808
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
809
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>;
809
+ statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
810
810
  };
811
811
  owner: {
812
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
813
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key];
812
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
813
+ actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
814
814
  connector: "OR" | "AND";
815
815
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
816
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>;
816
+ statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
817
817
  };
818
818
  };
819
819
  membershipLimit: number;
@@ -987,7 +987,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
987
987
  id: string;
988
988
  organizationId: string;
989
989
  email: string;
990
- role: "member" | "owner" | "admin";
990
+ role: "member" | "admin" | "owner";
991
991
  status: better_auth_plugins0.InvitationStatus;
992
992
  inviterId: string;
993
993
  expiresAt: Date;
@@ -996,7 +996,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
996
996
  Member: {
997
997
  id: string;
998
998
  organizationId: string;
999
- role: "member" | "owner" | "admin";
999
+ role: "member" | "admin" | "owner";
1000
1000
  createdAt: Date;
1001
1001
  userId: string;
1002
1002
  user: {
@@ -1012,7 +1012,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
1012
1012
  members: {
1013
1013
  id: string;
1014
1014
  organizationId: string;
1015
- role: "member" | "owner" | "admin";
1015
+ role: "member" | "admin" | "owner";
1016
1016
  createdAt: Date;
1017
1017
  userId: string;
1018
1018
  user: {
@@ -1026,7 +1026,7 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
1026
1026
  id: string;
1027
1027
  organizationId: string;
1028
1028
  email: string;
1029
- role: "member" | "owner" | "admin";
1029
+ role: "member" | "admin" | "owner";
1030
1030
  status: better_auth_plugins0.InvitationStatus;
1031
1031
  inviterId: string;
1032
1032
  expiresAt: Date;
@@ -1104,25 +1104,25 @@ declare function createAgentsAuth(userAuthConfig?: UserAuthConfig): better_auth0
1104
1104
  ac: better_auth_plugins0.AccessControl;
1105
1105
  roles: {
1106
1106
  member: {
1107
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
1108
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key];
1107
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
1108
+ actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
1109
1109
  connector: "OR" | "AND";
1110
1110
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1111
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>;
1111
+ statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
1112
1112
  };
1113
1113
  admin: {
1114
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
1115
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key];
1114
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
1115
+ actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
1116
1116
  connector: "OR" | "AND";
1117
1117
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1118
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>;
1118
+ statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
1119
1119
  };
1120
1120
  owner: {
1121
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key] | {
1122
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>[key];
1121
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key] | {
1122
+ actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>[key];
1123
1123
  connector: "OR" | "AND";
1124
1124
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1125
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins0.Statements>;
1125
+ statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins0.Statements>;
1126
1126
  };
1127
1127
  };
1128
1128
  membershipLimit: number;
package/dist/index.d.ts CHANGED
@@ -796,25 +796,25 @@ declare const auth: better_auth78.Auth<{
796
796
  ac: better_auth_plugins69.AccessControl;
797
797
  roles: {
798
798
  member: {
799
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
800
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key];
799
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
800
+ actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
801
801
  connector: "OR" | "AND";
802
802
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
803
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>;
803
+ statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
804
804
  };
805
805
  admin: {
806
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
807
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key];
806
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
807
+ actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
808
808
  connector: "OR" | "AND";
809
809
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
810
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>;
810
+ statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
811
811
  };
812
812
  owner: {
813
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
814
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key];
813
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
814
+ actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
815
815
  connector: "OR" | "AND";
816
816
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
817
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>;
817
+ statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
818
818
  };
819
819
  };
820
820
  membershipLimit: number;
@@ -988,7 +988,7 @@ declare const auth: better_auth78.Auth<{
988
988
  id: string;
989
989
  organizationId: string;
990
990
  email: string;
991
- role: "member" | "owner" | "admin";
991
+ role: "member" | "admin" | "owner";
992
992
  status: better_auth_plugins69.InvitationStatus;
993
993
  inviterId: string;
994
994
  expiresAt: Date;
@@ -997,7 +997,7 @@ declare const auth: better_auth78.Auth<{
997
997
  Member: {
998
998
  id: string;
999
999
  organizationId: string;
1000
- role: "member" | "owner" | "admin";
1000
+ role: "member" | "admin" | "owner";
1001
1001
  createdAt: Date;
1002
1002
  userId: string;
1003
1003
  user: {
@@ -1013,7 +1013,7 @@ declare const auth: better_auth78.Auth<{
1013
1013
  members: {
1014
1014
  id: string;
1015
1015
  organizationId: string;
1016
- role: "member" | "owner" | "admin";
1016
+ role: "member" | "admin" | "owner";
1017
1017
  createdAt: Date;
1018
1018
  userId: string;
1019
1019
  user: {
@@ -1027,7 +1027,7 @@ declare const auth: better_auth78.Auth<{
1027
1027
  id: string;
1028
1028
  organizationId: string;
1029
1029
  email: string;
1030
- role: "member" | "owner" | "admin";
1030
+ role: "member" | "admin" | "owner";
1031
1031
  status: better_auth_plugins69.InvitationStatus;
1032
1032
  inviterId: string;
1033
1033
  expiresAt: Date;
@@ -1105,25 +1105,25 @@ declare const auth: better_auth78.Auth<{
1105
1105
  ac: better_auth_plugins69.AccessControl;
1106
1106
  roles: {
1107
1107
  member: {
1108
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
1109
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key];
1108
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
1109
+ actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
1110
1110
  connector: "OR" | "AND";
1111
1111
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
1112
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>;
1112
+ statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
1113
1113
  };
1114
1114
  admin: {
1115
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
1116
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key];
1115
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
1116
+ actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
1117
1117
  connector: "OR" | "AND";
1118
1118
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
1119
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>;
1119
+ statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
1120
1120
  };
1121
1121
  owner: {
1122
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "team" | "ac">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key] | {
1123
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>[key];
1122
+ authorize<K_1 extends "organization" | "member" | "invitation" | "ac" | "project" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key] | {
1123
+ actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>[key];
1124
1124
  connector: "OR" | "AND";
1125
1125
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
1126
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "team" | "ac", better_auth_plugins69.Statements>;
1126
+ statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "ac" | "project" | "team", better_auth_plugins69.Statements>;
1127
1127
  };
1128
1128
  };
1129
1129
  membershipLimit: number;
@@ -1,8 +1,8 @@
1
- import * as hono7 from "hono";
1
+ import * as hono6 from "hono";
2
2
  import { BaseExecutionContext } from "@inkeep/agents-core";
3
3
 
4
4
  //#region src/middleware/runAuth.d.ts
5
- declare const runApiKeyAuth: () => hono7.MiddlewareHandler<{
5
+ declare const runApiKeyAuth: () => hono6.MiddlewareHandler<{
6
6
  Variables: {
7
7
  executionContext: BaseExecutionContext;
8
8
  };
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono7.MiddlewareHandler<{
11
11
  * Creates a middleware that applies API key authentication except for specified route patterns
12
12
  * @param skipRouteCheck - Function that returns true if the route should skip authentication
13
13
  */
14
- declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) => hono7.MiddlewareHandler<{
14
+ declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) => hono6.MiddlewareHandler<{
15
15
  Variables: {
16
16
  executionContext: BaseExecutionContext;
17
17
  };
@@ -20,7 +20,7 @@ declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) =
20
20
  * Helper middleware for endpoints that optionally support API key authentication
21
21
  * If no auth header is present, it continues without setting the executionContext
22
22
  */
23
- declare const runOptionalAuth: () => hono7.MiddlewareHandler<{
23
+ declare const runOptionalAuth: () => hono6.MiddlewareHandler<{
24
24
  Variables: {
25
25
  executionContext?: BaseExecutionContext;
26
26
  };
@@ -1,4 +1,4 @@
1
- import * as hono12 from "hono";
1
+ import * as hono9 from "hono";
2
2
 
3
3
  //#region src/middleware/tenantAccess.d.ts
4
4
 
@@ -11,7 +11,7 @@ import * as hono12 from "hono";
11
11
  * - API key user: Access only to the tenant associated with the API key
12
12
  * - Session user: Access based on organization membership
13
13
  */
14
- declare const requireTenantAccess: () => hono12.MiddlewareHandler<{
14
+ declare const requireTenantAccess: () => hono9.MiddlewareHandler<{
15
15
  Variables: {
16
16
  userId: string;
17
17
  tenantId: string;
@@ -1,7 +1,7 @@
1
- import * as hono13 from "hono";
1
+ import * as hono12 from "hono";
2
2
 
3
3
  //#region src/middleware/tracing.d.ts
4
- declare const otelBaggageMiddleware: () => hono13.MiddlewareHandler<any, string, {}, Response>;
5
- declare const executionBaggageMiddleware: () => hono13.MiddlewareHandler<any, string, {}, Response>;
4
+ declare const otelBaggageMiddleware: () => hono12.MiddlewareHandler<any, string, {}, Response>;
5
+ declare const executionBaggageMiddleware: () => hono12.MiddlewareHandler<any, string, {}, Response>;
6
6
  //#endregion
7
7
  export { executionBaggageMiddleware, otelBaggageMiddleware };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-api",
3
- "version": "0.0.0-dev-20260126093157",
3
+ "version": "0.0.0-dev-20260126181806",
4
4
  "description": "Unified Inkeep Agents API - combines management, runtime, and evaluation capabilities",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -67,12 +67,13 @@
67
67
  "hono": "^4.10.4",
68
68
  "hono-pino": "^0.10.1",
69
69
  "jmespath": "^0.16.0",
70
+ "jose": "^6.1.0",
70
71
  "llm-info": "^1.0.69",
71
72
  "openid-client": "^6.8.1",
72
73
  "pg": "^8.16.3",
73
74
  "workflow": "4.0.1-beta.33",
74
- "@inkeep/agents-core": "^0.0.0-dev-20260126093157",
75
- "@inkeep/agents-manage-mcp": "^0.0.0-dev-20260126093157"
75
+ "@inkeep/agents-core": "^0.0.0-dev-20260126181806",
76
+ "@inkeep/agents-manage-mcp": "^0.0.0-dev-20260126181806"
76
77
  },
77
78
  "peerDependencies": {
78
79
  "@hono/zod-openapi": "^1.1.5",