@inkeep/agents-api 0.0.0-dev-20260202060901 → 0.0.0-dev-20260203023016

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 (57) hide show
  1. package/dist/.well-known/workflow/v1/manifest.debug.json +16 -16
  2. package/dist/.well-known/workflow/v1/step.cjs +57211 -56922
  3. package/dist/createApp.d.ts +2 -2
  4. package/dist/createApp.js +3 -3
  5. package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
  6. package/dist/domains/evals/routes/index.d.ts +2 -2
  7. package/dist/domains/evals/workflow/routes.d.ts +2 -2
  8. package/dist/domains/manage/index.js +6 -0
  9. package/dist/domains/manage/routes/conversations.d.ts +2 -2
  10. package/dist/domains/manage/routes/evals/evaluationResults.d.ts +2 -2
  11. package/dist/domains/manage/routes/github.d.ts +16 -0
  12. package/dist/domains/manage/routes/github.js +511 -0
  13. package/dist/domains/manage/routes/index.d.ts +2 -2
  14. package/dist/domains/manage/routes/mcp.d.ts +2 -2
  15. package/dist/domains/manage/routes/mcpToolGithubAccess.d.ts +9 -0
  16. package/dist/domains/manage/routes/mcpToolGithubAccess.js +205 -0
  17. package/dist/domains/manage/routes/projectGithubAccess.d.ts +9 -0
  18. package/dist/domains/manage/routes/projectGithubAccess.js +167 -0
  19. package/dist/domains/manage/routes/tools.js +4 -2
  20. package/dist/domains/mcp/routes/mcp.d.ts +2 -2
  21. package/dist/domains/run/agents/Agent.js +7 -1
  22. package/dist/domains/run/constants/execution-limits/defaults.d.ts +1 -1
  23. package/dist/domains/run/constants/execution-limits/defaults.js +1 -1
  24. package/dist/domains/run/constants/execution-limits/index.d.ts +1 -1
  25. package/dist/domains/run/context/ContextResolver.js +1 -1
  26. package/dist/domains/run/services/AgentSession.js +5 -1
  27. package/dist/domains/run/services/BaseCompressor.js +1 -1
  28. package/dist/domains/run/types/executionContext.js +3 -1
  29. package/dist/env.d.ts +12 -0
  30. package/dist/env.js +7 -1
  31. package/dist/factory.d.ts +261 -261
  32. package/dist/index.d.ts +261 -261
  33. package/dist/middleware/evalsAuth.d.ts +2 -2
  34. package/dist/middleware/manageAuth.d.ts +2 -2
  35. package/dist/middleware/projectAccess.d.ts +2 -2
  36. package/dist/middleware/projectConfig.d.ts +3 -3
  37. package/dist/middleware/requirePermission.d.ts +2 -2
  38. package/dist/middleware/runAuth.d.ts +4 -4
  39. package/dist/middleware/sessionAuth.d.ts +3 -3
  40. package/dist/middleware/tenantAccess.d.ts +2 -2
  41. package/dist/middleware/tracing.d.ts +3 -3
  42. package/dist/openapi.d.ts +1 -0
  43. package/dist/openapi.js +1 -0
  44. package/dist/types/runExecutionContext.js +3 -1
  45. package/package.json +5 -4
  46. package/dist/domains/github/config.d.ts +0 -14
  47. package/dist/domains/github/config.js +0 -47
  48. package/dist/domains/github/index.d.ts +0 -12
  49. package/dist/domains/github/index.js +0 -18
  50. package/dist/domains/github/installation.d.ts +0 -34
  51. package/dist/domains/github/installation.js +0 -172
  52. package/dist/domains/github/jwks.d.ts +0 -20
  53. package/dist/domains/github/jwks.js +0 -85
  54. package/dist/domains/github/oidcToken.d.ts +0 -22
  55. package/dist/domains/github/oidcToken.js +0 -140
  56. package/dist/domains/github/routes/tokenExchange.d.ts +0 -7
  57. package/dist/domains/github/routes/tokenExchange.js +0 -130
@@ -1,140 +0,0 @@
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 };
@@ -1,7 +0,0 @@
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 };
@@ -1,130 +0,0 @@
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 };