@inkeep/agents-api 0.0.1 → 0.43.0

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 (150) hide show
  1. package/dist/.well-known/workflow/v1/flow.cjs +43 -106
  2. package/dist/.well-known/workflow/v1/flow.cjs.debug.json +2 -4
  3. package/dist/.well-known/workflow/v1/manifest.debug.json +17 -55
  4. package/dist/.well-known/workflow/v1/step.cjs +45938 -45976
  5. package/dist/.well-known/workflow/v1/step.cjs.debug.json +2 -4
  6. package/dist/_virtual/rolldown_runtime.js +7 -0
  7. package/dist/createApp.js +40 -12
  8. package/dist/domains/evals/api/.well-known/workflow/v1/flow.d.ts +4 -0
  9. package/dist/domains/evals/api/.well-known/workflow/v1/flow.js +12 -0
  10. package/dist/domains/evals/api/.well-known/workflow/v1/step.d.ts +4 -0
  11. package/dist/domains/evals/api/.well-known/workflow/v1/step.js +12 -0
  12. package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
  13. package/dist/domains/evals/routes/index.d.ts +2 -2
  14. package/dist/domains/evals/scripts/build-workflow.js +2 -2
  15. package/dist/domains/evals/workflow/functions/evaluateConversation.d.ts +4 -1
  16. package/dist/domains/evals/workflow/functions/evaluateConversation.js +2 -1
  17. package/dist/domains/evals/workflow/functions/runDatasetItem.d.ts +4 -1
  18. package/dist/domains/evals/workflow/functions/runDatasetItem.js +2 -1
  19. package/dist/domains/evals/workflow/routes.d.ts +2 -2
  20. package/dist/domains/evals/workflow/world.js +3 -2
  21. package/dist/domains/github/config.d.ts +14 -0
  22. package/dist/domains/github/config.js +47 -0
  23. package/dist/domains/github/index.d.ts +12 -0
  24. package/dist/domains/github/index.js +18 -0
  25. package/dist/domains/github/installation.d.ts +34 -0
  26. package/dist/domains/github/installation.js +172 -0
  27. package/dist/domains/github/jwks.d.ts +20 -0
  28. package/dist/domains/github/jwks.js +85 -0
  29. package/dist/domains/github/oidcToken.d.ts +22 -0
  30. package/dist/domains/github/oidcToken.js +140 -0
  31. package/dist/domains/github/routes/tokenExchange.d.ts +7 -0
  32. package/dist/domains/github/routes/tokenExchange.js +130 -0
  33. package/dist/domains/manage/index.js +0 -2
  34. package/dist/domains/manage/routes/agent.js +9 -4
  35. package/dist/domains/manage/routes/agentFull.js +9 -6
  36. package/dist/domains/manage/routes/apiKeys.js +1 -2
  37. package/dist/domains/manage/routes/artifactComponents.js +5 -5
  38. package/dist/domains/manage/routes/cliAuth.js +3 -3
  39. package/dist/domains/manage/routes/contextConfigs.js +5 -5
  40. package/dist/domains/manage/routes/conversations.d.ts +2 -2
  41. package/dist/domains/manage/routes/credentialStores.js +2 -2
  42. package/dist/domains/manage/routes/credentials.js +6 -7
  43. package/dist/domains/manage/routes/dataComponents.js +6 -7
  44. package/dist/domains/manage/routes/externalAgents.js +1 -2
  45. package/dist/domains/manage/routes/index.d.ts +2 -2
  46. package/dist/domains/manage/routes/index.js +4 -0
  47. package/dist/domains/manage/routes/invitations.js +1 -1
  48. package/dist/domains/manage/routes/mcp.d.ts +2 -2
  49. package/dist/domains/manage/routes/playgroundToken.js +1 -2
  50. package/dist/domains/manage/routes/projectFull.js +33 -11
  51. package/dist/domains/manage/routes/projectMembers.js +16 -35
  52. package/dist/domains/manage/routes/projectPermissions.js +17 -10
  53. package/dist/domains/manage/routes/projects.js +4 -5
  54. package/dist/domains/manage/routes/signoz.d.ts +2 -2
  55. package/dist/domains/manage/routes/signoz.js +6 -3
  56. package/dist/domains/manage/routes/subAgentArtifactComponents.js +5 -5
  57. package/dist/domains/manage/routes/subAgentDataComponents.js +5 -5
  58. package/dist/domains/manage/routes/subAgentExternalAgentRelations.js +5 -5
  59. package/dist/domains/manage/routes/subAgentFunctionTools.js +5 -5
  60. package/dist/domains/manage/routes/subAgentRelations.js +6 -6
  61. package/dist/domains/manage/routes/subAgentTeamAgentRelations.js +6 -6
  62. package/dist/domains/manage/routes/subAgentToolRelations.js +6 -6
  63. package/dist/domains/manage/routes/subAgents.js +5 -5
  64. package/dist/domains/manage/routes/tools.js +24 -3
  65. package/dist/domains/manage/routes/triggers.js +82 -25
  66. package/dist/domains/manage/routes/userOrganizations.js +4 -4
  67. package/dist/domains/manage/routes/{agentToolRelations.d.ts → userProjectMemberships.d.ts} +1 -1
  68. package/dist/domains/manage/routes/userProjectMemberships.js +45 -0
  69. package/dist/domains/mcp/routes/mcp.d.ts +7 -0
  70. package/dist/domains/mcp/routes/mcp.js +45 -0
  71. package/dist/domains/run/a2a/handlers.js +2 -10
  72. package/dist/domains/run/a2a/types.d.ts +2 -6
  73. package/dist/domains/run/agents/Agent.d.ts +1 -0
  74. package/dist/domains/run/agents/Agent.js +207 -44
  75. package/dist/domains/run/agents/generateTaskHandler.js +14 -2
  76. package/dist/domains/run/context/ContextFetcher.js +8 -7
  77. package/dist/domains/run/context/ContextResolver.js +1 -1
  78. package/dist/domains/run/handlers/executionHandler.d.ts +3 -1
  79. package/dist/domains/run/handlers/executionHandler.js +149 -84
  80. package/dist/domains/run/routes/agents.js +1 -1
  81. package/dist/domains/run/routes/chat.js +47 -1
  82. package/dist/domains/run/routes/chatDataStream.js +107 -14
  83. package/dist/domains/run/routes/webhooks.js +40 -329
  84. package/dist/domains/run/services/AgentSession.d.ts +3 -0
  85. package/dist/domains/run/services/AgentSession.js +9 -0
  86. package/dist/domains/run/services/BaseCompressor.js +1 -1
  87. package/dist/domains/run/services/ToolApprovalUiBus.d.ts +28 -0
  88. package/dist/domains/run/services/ToolApprovalUiBus.js +44 -0
  89. package/dist/domains/run/services/TriggerService.d.ts +31 -0
  90. package/dist/domains/run/services/TriggerService.js +543 -0
  91. package/dist/domains/run/tools/NativeSandboxExecutor.d.ts +3 -2
  92. package/dist/domains/run/tools/NativeSandboxExecutor.js +76 -48
  93. package/dist/domains/run/tools/SandboxExecutorFactory.d.ts +11 -1
  94. package/dist/domains/run/tools/SandboxExecutorFactory.js +27 -3
  95. package/dist/domains/run/tools/VercelSandboxExecutor.d.ts +3 -11
  96. package/dist/domains/run/tools/VercelSandboxExecutor.js +137 -127
  97. package/dist/domains/run/types/xml.d.ts +1 -5
  98. package/dist/domains/run/utils/stream-helpers.d.ts +134 -0
  99. package/dist/domains/run/utils/stream-helpers.js +182 -0
  100. package/dist/factory.d.ts +278 -272
  101. package/dist/index.d.ts +275 -269
  102. package/dist/index.js +16 -1
  103. package/dist/initialization.js +9 -2
  104. package/dist/middleware/cors.js +1 -1
  105. package/dist/middleware/evalsAuth.d.ts +2 -2
  106. package/dist/middleware/manageAuth.d.ts +2 -2
  107. package/dist/middleware/projectAccess.d.ts +4 -11
  108. package/dist/middleware/projectAccess.js +1 -17
  109. package/dist/middleware/projectConfig.d.ts +3 -3
  110. package/dist/middleware/requirePermission.d.ts +2 -2
  111. package/dist/middleware/runAuth.d.ts +4 -4
  112. package/dist/middleware/sessionAuth.d.ts +3 -3
  113. package/dist/middleware/tenantAccess.d.ts +2 -2
  114. package/dist/middleware/tenantAccess.js +4 -4
  115. package/dist/middleware/tracing.d.ts +3 -3
  116. package/dist/openapi.d.ts +35 -1
  117. package/dist/openapi.js +39 -95
  118. package/dist/routes/healthChecks.d.ts +10 -0
  119. package/dist/routes/healthChecks.js +75 -0
  120. package/dist/templates/v1/phase1/system-prompt.js +1 -1
  121. package/dist/templates/v1/phase1/thinking-preparation.js +1 -1
  122. package/dist/templates/v1/phase1/tool.js +1 -1
  123. package/dist/templates/v1/phase2/data-component.js +1 -1
  124. package/dist/templates/v1/phase2/data-components.js +1 -1
  125. package/dist/templates/v1/phase2/system-prompt.js +1 -1
  126. package/dist/templates/v1/shared/artifact-retrieval-guidance.js +1 -1
  127. package/dist/templates/v1/shared/artifact.js +1 -1
  128. package/dist/types/app.d.ts +2 -0
  129. package/dist/utils/healthChecks.d.ts +8 -0
  130. package/dist/utils/healthChecks.js +38 -0
  131. package/dist/utils/signozHelpers.d.ts +2 -2
  132. package/dist/utils/signozHelpers.js +15 -3
  133. package/package.json +25 -28
  134. package/dist/domains/evals/services/startEvaluation.d.ts +0 -19
  135. package/dist/domains/evals/services/startEvaluation.js +0 -18
  136. package/dist/domains/index.d.ts +0 -4
  137. package/dist/domains/index.js +0 -5
  138. package/dist/domains/manage/routes/agentToolRelations.js +0 -289
  139. package/dist/domains/run/agents/ModelFactory.d.ts +0 -63
  140. package/dist/domains/run/agents/ModelFactory.js +0 -194
  141. package/dist/domains/run/data/agent.d.ts +0 -7
  142. package/dist/domains/run/data/agent.js +0 -67
  143. package/dist/domains/run/services/evaluationRunConfigMatcher.d.ts +0 -4
  144. package/dist/domains/run/services/evaluationRunConfigMatcher.js +0 -7
  145. package/dist/domains/run/utils/cleanup.d.ts +0 -21
  146. package/dist/domains/run/utils/cleanup.js +0 -59
  147. package/dist/utils/tempApiKeys.d.ts +0 -17
  148. package/dist/utils/tempApiKeys.js +0 -26
  149. package/dist/utils/workflowApiHelpers.d.ts +0 -1
  150. package/dist/utils/workflowApiHelpers.js +0 -1
@@ -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_types13 from "hono/types";
3
+
4
+ //#region src/domains/github/routes/tokenExchange.d.ts
5
+ declare const app: Hono<hono_types13.BlankEnv, hono_types13.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,5 +1,4 @@
1
1
  import cliAuth_default from "./routes/cliAuth.js";
2
- import evals_default from "./routes/evals/index.js";
3
2
  import routes_default from "./routes/index.js";
4
3
  import invitations_default from "./routes/invitations.js";
5
4
  import mcp_default from "./routes/mcp.js";
@@ -20,7 +19,6 @@ function createManageRoutes() {
20
19
  app.route("/tenants/:tenantId/playground/token", playgroundToken_default);
21
20
  app.route("/tenants/:tenantId/signoz", signoz_default);
22
21
  app.route("/tenants/:tenantId", projectFull_default);
23
- app.route("/tenants/:tenantId/projects/:projectId/evals", evals_default);
24
22
  app.route("/oauth", oauth_default);
25
23
  app.route("/mcp", mcp_default);
26
24
  return app;
@@ -11,8 +11,11 @@ app.use("/", async (c, next) => {
11
11
  return next();
12
12
  });
13
13
  app.use("/:id", async (c, next) => {
14
- if (c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
15
- if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
14
+ if ([
15
+ "PUT",
16
+ "PATCH",
17
+ "DELETE"
18
+ ].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
16
19
  return next();
17
20
  });
18
21
  app.openapi(createRoute({
@@ -82,7 +85,7 @@ app.openapi(createRoute({
82
85
  path: "/{agentId}/sub-agents/{subAgentId}/related",
83
86
  summary: "Get Related Agent Infos",
84
87
  operationId: "get-related-agent-infos",
85
- tags: ["Agent"],
88
+ tags: ["Agents"],
86
89
  request: { params: TenantProjectAgentSubAgentParamsSchema },
87
90
  responses: {
88
91
  200: {
@@ -116,7 +119,7 @@ app.openapi(createRoute({
116
119
  path: "/{agentId}/full",
117
120
  summary: "Get Full Agent Definition",
118
121
  operationId: "get-full-agent-definition",
119
- tags: ["Agent"],
122
+ tags: ["Agents"],
120
123
  request: { params: TenantProjectAgentParamsSchema },
121
124
  responses: {
122
125
  200: {
@@ -206,6 +209,8 @@ app.openapi(createRoute({
206
209
  agentId: id
207
210
  },
208
211
  data: {
212
+ name: validatedBody.name,
213
+ description: validatedBody.description,
209
214
  defaultSubAgentId: validatedBody.defaultSubAgentId,
210
215
  contextConfigId: validatedBody.contextConfigId ?? void 0
211
216
  }
@@ -12,8 +12,11 @@ app.use("/", async (c, next) => {
12
12
  return next();
13
13
  });
14
14
  app.use("/:agentId", async (c, next) => {
15
- if (c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
16
- if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
15
+ if ([
16
+ "PUT",
17
+ "PATCH",
18
+ "DELETE"
19
+ ].includes(c.req.method)) return requireProjectPermission("edit")(c, next);
17
20
  return next();
18
21
  });
19
22
  app.openapi(createRoute({
@@ -21,7 +24,7 @@ app.openapi(createRoute({
21
24
  path: "/",
22
25
  summary: "Create Full Agent",
23
26
  operationId: "create-full-agent",
24
- tags: ["Full Agent"],
27
+ tags: ["Agents"],
25
28
  description: "Create a complete agent with all agents, tools, and relationships from JSON definition",
26
29
  request: {
27
30
  params: TenantProjectParamsSchema,
@@ -54,7 +57,7 @@ app.openapi(createRoute({
54
57
  path: "/{agentId}",
55
58
  summary: "Get Full Agent",
56
59
  operationId: "get-full-agent",
57
- tags: ["Full Agent"],
60
+ tags: ["Agents"],
58
61
  description: "Retrieve a complete agent definition with all agents, tools, and relationships",
59
62
  request: { params: TenantProjectAgentParamsSchema },
60
63
  responses: {
@@ -94,7 +97,7 @@ app.openapi(createRoute({
94
97
  path: "/{agentId}",
95
98
  summary: "Update Full Agent",
96
99
  operationId: "update-full-agent",
97
- tags: ["Full Agent"],
100
+ tags: ["Agents"],
98
101
  description: "Update or create a complete agent with all agents, tools, and relationships from JSON definition",
99
102
  request: {
100
103
  params: TenantProjectAgentParamsSchema,
@@ -155,7 +158,7 @@ app.openapi(createRoute({
155
158
  path: "/{agentId}",
156
159
  summary: "Delete Full Agent",
157
160
  operationId: "delete-full-agent",
158
- tags: ["Full Agent"],
161
+ tags: ["Agents"],
159
162
  description: "Delete a complete agent and cascade to all related entities (relationships, not other agents/tools)",
160
163
  request: { params: TenantProjectAgentParamsSchema },
161
164
  responses: {
@@ -11,8 +11,7 @@ app.use("/", async (c, next) => {
11
11
  return next();
12
12
  });
13
13
  app.use("/:id", async (c, next) => {
14
- if (c.req.method === "PATCH") return requireProjectPermission("edit")(c, next);
15
- if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
14
+ if (c.req.method === "PUT" || c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
16
15
  return next();
17
16
  });
18
17
  app.openapi(createRoute({
@@ -19,7 +19,7 @@ app.openapi(createRoute({
19
19
  path: "/",
20
20
  summary: "List Artifact Components",
21
21
  operationId: "list-artifact-components",
22
- tags: ["Artifact Component"],
22
+ tags: ["Artifact Components"],
23
23
  request: {
24
24
  params: TenantProjectParamsSchema,
25
25
  query: PaginationQueryParamsSchema
@@ -54,7 +54,7 @@ app.openapi(createRoute({
54
54
  path: "/{id}",
55
55
  summary: "Get Artifact Component",
56
56
  operationId: "get-artifact-component-by-id",
57
- tags: ["Artifact Component"],
57
+ tags: ["Artifact Components"],
58
58
  request: { params: TenantProjectIdParamsSchema },
59
59
  responses: {
60
60
  200: {
@@ -84,7 +84,7 @@ app.openapi(createRoute({
84
84
  path: "/",
85
85
  summary: "Create Artifact Component",
86
86
  operationId: "create-artifact-component",
87
- tags: ["Artifact Component"],
87
+ tags: ["Artifact Components"],
88
88
  request: {
89
89
  params: TenantProjectParamsSchema,
90
90
  body: { content: { "application/json": { schema: ArtifactComponentApiInsertSchema } } }
@@ -133,7 +133,7 @@ app.openapi(createRoute({
133
133
  path: "/{id}",
134
134
  summary: "Update Artifact Component",
135
135
  operationId: "update-artifact-component",
136
- tags: ["Artifact Component"],
136
+ tags: ["Artifact Components"],
137
137
  request: {
138
138
  params: TenantProjectIdParamsSchema,
139
139
  body: { content: { "application/json": { schema: ArtifactComponentApiUpdateSchema } } }
@@ -180,7 +180,7 @@ app.openapi(createRoute({
180
180
  path: "/{id}",
181
181
  summary: "Delete Artifact Component",
182
182
  operationId: "delete-artifact-component",
183
- tags: ["Artifact Component"],
183
+ tags: ["Artifact Components"],
184
184
  request: { params: TenantProjectIdParamsSchema },
185
185
  responses: {
186
186
  204: { description: "Artifact component deleted successfully" },
@@ -1,7 +1,7 @@
1
1
  import runDbClient_default from "../../../data/db/runDbClient.js";
2
2
  import { sessionAuth } from "../../../middleware/sessionAuth.js";
3
3
  import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
4
- import { getUserOrganizations } from "@inkeep/agents-core";
4
+ import { getUserOrganizationsFromDb } from "@inkeep/agents-core";
5
5
 
6
6
  //#region src/domains/manage/routes/cliAuth.ts
7
7
  const cliAuthRoutes = new OpenAPIHono();
@@ -21,7 +21,7 @@ const CLIMeResponseSchema = z.object({
21
21
  cliAuthRoutes.openapi(createRoute({
22
22
  method: "get",
23
23
  path: "/me",
24
- tags: ["cli"],
24
+ tags: ["CLI"],
25
25
  summary: "Get CLI user info",
26
26
  description: "Get the current authenticated user and their organization for CLI usage",
27
27
  middleware: [sessionAuth()],
@@ -37,7 +37,7 @@ cliAuthRoutes.openapi(createRoute({
37
37
  const user = c.get("user");
38
38
  const userId = c.get("userId");
39
39
  if (!user || !userId) return c.json({ error: "Not authenticated" }, 401);
40
- const organizations = await getUserOrganizations(runDbClient_default)(userId);
40
+ const organizations = await getUserOrganizationsFromDb(runDbClient_default)(userId);
41
41
  if (organizations.length === 0) return c.json({ error: "User has no organization" }, 404);
42
42
  const org = organizations[0];
43
43
  return c.json({
@@ -20,7 +20,7 @@ app.openapi(createRoute({
20
20
  path: "/",
21
21
  summary: "List Context Configurations",
22
22
  operationId: "list-context-configs",
23
- tags: ["Context Config"],
23
+ tags: ["Context Configs"],
24
24
  request: {
25
25
  params: TenantProjectAgentParamsSchema,
26
26
  query: PaginationQueryParamsSchema
@@ -56,7 +56,7 @@ app.openapi(createRoute({
56
56
  path: "/{id}",
57
57
  summary: "Get Context Configuration",
58
58
  operationId: "get-context-config-by-id",
59
- tags: ["Context Config"],
59
+ tags: ["Context Configs"],
60
60
  request: { params: TenantProjectAgentIdParamsSchema },
61
61
  responses: {
62
62
  200: {
@@ -87,7 +87,7 @@ app.openapi(createRoute({
87
87
  path: "/",
88
88
  summary: "Create Context Configuration",
89
89
  operationId: "create-context-config",
90
- tags: ["Context Config"],
90
+ tags: ["Context Configs"],
91
91
  request: {
92
92
  params: TenantProjectAgentParamsSchema,
93
93
  body: { content: { "application/json": { schema: ContextConfigApiInsertSchema } } }
@@ -116,7 +116,7 @@ app.openapi(createRoute({
116
116
  path: "/{id}",
117
117
  summary: "Update Context Configuration",
118
118
  operationId: "update-context-config",
119
- tags: ["Context Config"],
119
+ tags: ["Context Configs"],
120
120
  request: {
121
121
  params: TenantProjectAgentIdParamsSchema,
122
122
  body: { content: { "application/json": { schema: ContextConfigApiUpdateSchema } } }
@@ -152,7 +152,7 @@ app.openapi(createRoute({
152
152
  path: "/{id}",
153
153
  summary: "Delete Context Configuration",
154
154
  operationId: "delete-context-config",
155
- tags: ["Context Config"],
155
+ tags: ["Context Configs"],
156
156
  request: { params: TenantProjectAgentIdParamsSchema },
157
157
  responses: {
158
158
  204: { description: "Context configuration deleted successfully" },
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono17 from "hono";
2
+ import * as hono16 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/conversations.d.ts
5
- declare const app: OpenAPIHono<hono17.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono16.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -13,7 +13,7 @@ app.openapi(createRoute({
13
13
  path: "/",
14
14
  summary: "List Credential Stores",
15
15
  operationId: "list-credential-stores",
16
- tags: ["Credential Store"],
16
+ tags: ["Credential Stores"],
17
17
  request: { params: TenantProjectParamsSchema },
18
18
  responses: {
19
19
  200: {
@@ -40,7 +40,7 @@ app.openapi(createRoute({
40
40
  path: "/{id}/credentials",
41
41
  summary: "Create Credential in Store",
42
42
  operationId: "create-credential-in-store",
43
- tags: ["Credential Store"],
43
+ tags: ["Credential Stores"],
44
44
  request: {
45
45
  params: TenantProjectIdParamsSchema,
46
46
  body: { content: { "application/json": { schema: CreateCredentialInStoreRequestSchema } } }