@inkeep/agents-api 0.0.0-dev-20260206080126 → 0.0.0-dev-20260206203908

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 (43) hide show
  1. package/dist/.well-known/workflow/v1/step.cjs +10 -16
  2. package/dist/createApp.d.ts +2 -2
  3. package/dist/createApp.js +1 -3
  4. package/dist/data/db/manageDbClient.d.ts +2 -2
  5. package/dist/data/db/runDbClient.d.ts +2 -2
  6. package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
  7. package/dist/domains/evals/routes/index.d.ts +2 -2
  8. package/dist/domains/evals/services/EvaluationService.js +1 -2
  9. package/dist/domains/evals/workflow/routes.d.ts +2 -2
  10. package/dist/domains/manage/index.js +4 -2
  11. package/dist/domains/manage/routes/availableAgents.d.ts +2 -2
  12. package/dist/domains/manage/routes/availableAgents.js +2 -2
  13. package/dist/domains/manage/routes/conversations.d.ts +2 -2
  14. package/dist/domains/manage/routes/invitations.d.ts +2 -2
  15. package/dist/domains/manage/routes/invitations.js +59 -0
  16. package/dist/domains/manage/routes/mcp.d.ts +2 -2
  17. package/dist/domains/manage/routes/passwordResetLinks.d.ts +10 -0
  18. package/dist/domains/manage/routes/passwordResetLinks.js +61 -0
  19. package/dist/domains/manage/routes/signoz.d.ts +2 -2
  20. package/dist/domains/manage/routes/users.d.ts +10 -0
  21. package/dist/domains/manage/routes/users.js +78 -0
  22. package/dist/domains/mcp/routes/mcp.d.ts +2 -2
  23. package/dist/domains/run/a2a/client.d.ts +0 -2
  24. package/dist/domains/run/a2a/client.js +5 -7
  25. package/dist/domains/run/agents/relationTools.d.ts +2 -2
  26. package/dist/domains/run/agents/relationTools.js +1 -3
  27. package/dist/domains/run/handlers/executionHandler.js +8 -12
  28. package/dist/domains/run/utils/token-estimator.d.ts +2 -2
  29. package/dist/factory.d.ts +59 -25
  30. package/dist/index.d.ts +128 -94
  31. package/dist/middleware/evalsAuth.d.ts +2 -2
  32. package/dist/middleware/manageAuth.d.ts +2 -2
  33. package/dist/middleware/projectAccess.d.ts +2 -2
  34. package/dist/middleware/projectConfig.d.ts +3 -3
  35. package/dist/middleware/requirePermission.d.ts +2 -2
  36. package/dist/middleware/runAuth.d.ts +4 -4
  37. package/dist/middleware/sessionAuth.d.ts +3 -3
  38. package/dist/middleware/tenantAccess.d.ts +2 -2
  39. package/package.json +5 -5
  40. package/dist/domains/manage/routes/userOrganizations.d.ts +0 -10
  41. package/dist/domains/manage/routes/userOrganizations.js +0 -29
  42. package/dist/utils/in-process-fetch.d.ts +0 -22
  43. package/dist/utils/in-process-fetch.js +0 -32
@@ -121233,6 +121233,10 @@ function index(name18) {
121233
121233
  return new IndexBuilderOn(false, name18);
121234
121234
  }
121235
121235
  __name(index, "index");
121236
+ function uniqueIndex(name18) {
121237
+ return new IndexBuilderOn(true, name18);
121238
+ }
121239
+ __name(uniqueIndex, "uniqueIndex");
121236
121240
 
121237
121241
  // ../node_modules/.pnpm/drizzle-orm@0.44.7_@electric-sql+pglite@0.3.14_@opentelemetry+api@1.9.0_@types+pg@8.16._05619ac069f36c30135eeb6e4342bbf4/node_modules/drizzle-orm/casing.js
121238
121242
  function toSnakeCase(input) {
@@ -126222,7 +126226,9 @@ var organization = pgTable("organization", {
126222
126226
  logo: text("logo"),
126223
126227
  createdAt: timestamp("created_at").notNull(),
126224
126228
  metadata: text("metadata")
126225
- });
126229
+ }, (table) => [
126230
+ uniqueIndex("organization_slug_uidx").on(table.slug)
126231
+ ]);
126226
126232
  var member = pgTable("member", {
126227
126233
  id: text("id").primaryKey(),
126228
126234
  organizationId: text("organization_id").notNull().references(() => organization.id, {
@@ -126249,7 +126255,8 @@ var invitation = pgTable("invitation", {
126249
126255
  createdAt: timestamp("created_at").defaultNow().notNull(),
126250
126256
  inviterId: text("inviter_id").notNull().references(() => user.id, {
126251
126257
  onDelete: "cascade"
126252
- })
126258
+ }),
126259
+ authMethod: text("auth_method")
126253
126260
  }, (table) => [
126254
126261
  index("invitation_organizationId_idx").on(table.organizationId),
126255
126262
  index("invitation_email_idx").on(table.email)
@@ -228857,19 +228864,6 @@ var runDbClient = createAgentsRunDatabaseClient({
228857
228864
  });
228858
228865
  var runDbClient_default = runDbClient;
228859
228866
 
228860
- // src/utils/in-process-fetch.ts
228861
- var _appFetch;
228862
- function getInProcessFetch() {
228863
- if (!_appFetch) {
228864
- if (process.env.ENVIRONMENT === "test") {
228865
- return fetch;
228866
- }
228867
- throw new Error("[in-process-fetch] App fetch not registered. Call registerAppFetch() during app initialization before handling requests.");
228868
- }
228869
- return _appFetch;
228870
- }
228871
- __name(getInProcessFetch, "getInProcessFetch");
228872
-
228873
228867
  // src/domains/evals/services/EvaluationService.ts
228874
228868
  var logger21 = getLogger("EvaluationService");
228875
228869
  var EvaluationService = class {
@@ -228964,7 +228958,7 @@ var EvaluationService = class {
228964
228958
  datasetRunId,
228965
228959
  conversationId
228966
228960
  }, "Running dataset item through chat API");
228967
- const response = await getInProcessFetch()(chatUrl, {
228961
+ const response = await fetch(chatUrl, {
228968
228962
  method: "POST",
228969
228963
  headers: headers2,
228970
228964
  body: JSON.stringify(chatPayload)
@@ -1,10 +1,10 @@
1
1
  import { AppConfig } from "./types/app.js";
2
2
  import "./types/index.js";
3
3
  import { Hono } from "hono";
4
- import * as hono_types0 from "hono/types";
4
+ import * as hono_types3 from "hono/types";
5
5
 
6
6
  //#region src/createApp.d.ts
7
7
  declare const isWebhookRoute: (path: string) => boolean;
8
- declare function createAgentsHono(config: AppConfig): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
8
+ declare function createAgentsHono(config: AppConfig): Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { createAgentsHono, isWebhookRoute };
package/dist/createApp.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { getLogger as getLogger$1 } from "./logger.js";
2
2
  import { env } from "./env.js";
3
- import { getInProcessFetch, registerAppFetch } from "./utils/in-process-fetch.js";
4
3
  import { evalRoutes } from "./domains/evals/index.js";
5
4
  import { workflowRoutes } from "./domains/evals/workflow/routes.js";
6
5
  import { sessionAuth, sessionContext } from "./middleware/sessionAuth.js";
@@ -182,7 +181,7 @@ function createAgentsHono(config) {
182
181
  headers: new Headers(c.req.raw.headers),
183
182
  body: bodyBuffer
184
183
  });
185
- return getInProcessFetch()(forwardedRequest);
184
+ return fetch(forwardedRequest);
186
185
  });
187
186
  app.route("/evals", evalRoutes);
188
187
  app.route("/work-apps/github", githubRoutes);
@@ -194,7 +193,6 @@ function createAgentsHono(config) {
194
193
  });
195
194
  const base = new Hono();
196
195
  base.route("/", app);
197
- registerAppFetch(base.request.bind(base));
198
196
  return base;
199
197
  }
200
198
 
@@ -1,6 +1,6 @@
1
- import * as _inkeep_agents_core0 from "@inkeep/agents-core";
1
+ import * as _inkeep_agents_core2 from "@inkeep/agents-core";
2
2
 
3
3
  //#region src/data/db/manageDbClient.d.ts
4
- declare const manageDbClient: _inkeep_agents_core0.AgentsManageDatabaseClient;
4
+ declare const manageDbClient: _inkeep_agents_core2.AgentsManageDatabaseClient;
5
5
  //#endregion
6
6
  export { manageDbClient as default };
@@ -1,6 +1,6 @@
1
- import * as _inkeep_agents_core0 from "@inkeep/agents-core";
1
+ import * as _inkeep_agents_core3 from "@inkeep/agents-core";
2
2
 
3
3
  //#region src/data/db/runDbClient.d.ts
4
- declare const runDbClient: _inkeep_agents_core0.AgentsRunDatabaseClient;
4
+ declare const runDbClient: _inkeep_agents_core3.AgentsRunDatabaseClient;
5
5
  //#endregion
6
6
  export { runDbClient as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono11 from "hono";
2
+ import * as hono16 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/datasetTriggers.d.ts
5
- declare const app: OpenAPIHono<hono11.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono16.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 hono13 from "hono";
2
+ import * as hono17 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono13.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono17.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -3,7 +3,6 @@ import { env } from "../../../env.js";
3
3
  import manageDbClient_default from "../../../data/db/manageDbClient.js";
4
4
  import manageDbPool_default from "../../../data/db/manageDbPool.js";
5
5
  import runDbClient_default from "../../../data/db/runDbClient.js";
6
- import { getInProcessFetch } from "../../../utils/in-process-fetch.js";
7
6
  import { ModelFactory, createEvaluationResult, createEvaluationRun, filterConversationsForJob, generateId, getConversationHistory, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluatorById, getFullAgent, getProjectScopedRef, resolveRef, updateEvaluationResult, withRef } from "@inkeep/agents-core";
8
7
  import { generateObject, generateText } from "ai";
9
8
  import { z } from "zod";
@@ -87,7 +86,7 @@ var EvaluationService = class {
87
86
  datasetRunId,
88
87
  conversationId
89
88
  }, "Running dataset item through chat API");
90
- const response = await getInProcessFetch()(chatUrl, {
89
+ const response = await fetch(chatUrl, {
91
90
  method: "POST",
92
91
  headers: headers$1,
93
92
  body: JSON.stringify(chatPayload)
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types5 from "hono/types";
2
+ import * as hono_types6 from "hono/types";
3
3
 
4
4
  //#region src/domains/evals/workflow/routes.d.ts
5
- declare const workflowRoutes: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
5
+ declare const workflowRoutes: Hono<hono_types6.BlankEnv, hono_types6.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { workflowRoutes };
@@ -6,20 +6,22 @@ import invitations_default from "./routes/invitations.js";
6
6
  import mcp_default from "./routes/mcp.js";
7
7
  import mcpToolGithubAccess_default from "./routes/mcpToolGithubAccess.js";
8
8
  import oauth_default from "./routes/oauth.js";
9
+ import passwordResetLinks_default from "./routes/passwordResetLinks.js";
9
10
  import playgroundToken_default from "./routes/playgroundToken.js";
10
11
  import projectFull_default from "./routes/projectFull.js";
11
12
  import projectGithubAccess_default from "./routes/projectGithubAccess.js";
12
13
  import signoz_default from "./routes/signoz.js";
13
- import userOrganizations_default from "./routes/userOrganizations.js";
14
+ import users_default from "./routes/users.js";
14
15
  import { OpenAPIHono } from "@hono/zod-openapi";
15
16
 
16
17
  //#region src/domains/manage/index.ts
17
18
  function createManageRoutes() {
18
19
  const app = new OpenAPIHono();
19
- app.route("/api/users/:userId/organizations", userOrganizations_default);
20
+ app.route("/api/users", users_default);
20
21
  app.route("/api/cli", cliAuth_default);
21
22
  app.route("/api/invitations", invitations_default);
22
23
  app.route("/tenants/:tenantId", routes_default);
24
+ app.route("/tenants/:tenantId/password-reset-links", passwordResetLinks_default);
23
25
  app.route("/tenants/:tenantId/playground/token", playgroundToken_default);
24
26
  app.route("/tenants/:tenantId/signoz", signoz_default);
25
27
  app.route("/tenants/:tenantId/github", github_default);
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono17 from "hono";
2
+ import * as hono14 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/availableAgents.d.ts
5
- declare const app: OpenAPIHono<hono17.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono14.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -2,7 +2,7 @@ import { getLogger as getLogger$1 } from "../../../logger.js";
2
2
  import { env } from "../../../env.js";
3
3
  import manageDbClient_default from "../../../data/db/manageDbClient.js";
4
4
  import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
5
- import { createApiError, listAgentsAcrossProjectBranches, listUsableProjectIds, verifyTempToken } from "@inkeep/agents-core";
5
+ import { createApiError, listAgentsAcrossProjectMainBranches, listUsableProjectIds, verifyTempToken } from "@inkeep/agents-core";
6
6
 
7
7
  //#region src/domains/manage/routes/availableAgents.ts
8
8
  const logger = getLogger$1("availableAgents");
@@ -77,7 +77,7 @@ app.openapi(createRoute({
77
77
  const { userId, tenantId } = user;
78
78
  const projectIds = await listUsableProjectIds({ userId });
79
79
  if (projectIds.length === 0) return c.json({ data: [] });
80
- const agents = await listAgentsAcrossProjectBranches(manageDbClient_default, {
80
+ const agents = await listAgentsAcrossProjectMainBranches(manageDbClient_default, {
81
81
  tenantId,
82
82
  projectIds
83
83
  });
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono16 from "hono";
2
+ import * as hono15 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<hono15.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,10 +1,10 @@
1
1
  import { ManageAppVariables } from "../../../types/app.js";
2
2
  import { Hono } from "hono";
3
- import * as hono_types12 from "hono/types";
3
+ import * as hono_types11 from "hono/types";
4
4
 
5
5
  //#region src/domains/manage/routes/invitations.d.ts
6
6
  declare const invitationsRoutes: Hono<{
7
7
  Variables: ManageAppVariables;
8
- }, hono_types12.BlankSchema, "/">;
8
+ }, hono_types11.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { invitationsRoutes as default };
@@ -2,9 +2,68 @@ import runDbClient_default from "../../../data/db/runDbClient.js";
2
2
  import { sessionAuth } from "../../../middleware/sessionAuth.js";
3
3
  import { createApiError, getPendingInvitationsByEmail } from "@inkeep/agents-core";
4
4
  import { Hono } from "hono";
5
+ import { HTTPException } from "hono/http-exception";
5
6
 
6
7
  //#region src/domains/manage/routes/invitations.ts
7
8
  const invitationsRoutes = new Hono();
9
+ /**
10
+ * GET /api/invitations/verify?email=user@example.com&id=xxx
11
+ *
12
+ * Unauthenticated endpoint to validate an invitation exists and get preview info.
13
+ * Used by the accept-invitation page to pre-populate signup forms.
14
+ *
15
+ * Returns limited info: email, organizationName, organizationId, role, expiresAt
16
+ */
17
+ invitationsRoutes.get("/verify", async (c) => {
18
+ const email = c.req.query("email");
19
+ const invitationId = c.req.query("id");
20
+ if (!email) throw createApiError({
21
+ code: "bad_request",
22
+ message: "Email parameter is required"
23
+ });
24
+ if (!invitationId) throw createApiError({
25
+ code: "bad_request",
26
+ message: "Invitation ID parameter is required"
27
+ });
28
+ const auth = c.get("auth");
29
+ if (!auth) throw createApiError({
30
+ code: "internal_server_error",
31
+ message: "Auth not configured"
32
+ });
33
+ try {
34
+ const invitations = await auth.api.listUserInvitations({ query: { email } });
35
+ const invitation = Array.isArray(invitations) ? invitations.find((inv) => inv.id === invitationId) : null;
36
+ if (!invitation) throw createApiError({
37
+ code: "not_found",
38
+ message: "Invitation not found"
39
+ });
40
+ const expiresAt = invitation.expiresAt ? new Date(invitation.expiresAt) : null;
41
+ const isExpired = expiresAt && expiresAt < /* @__PURE__ */ new Date();
42
+ if (!(invitation.status === "pending")) throw createApiError({
43
+ code: "not_found",
44
+ message: "Invitation is no longer valid"
45
+ });
46
+ if (isExpired) throw createApiError({
47
+ code: "not_found",
48
+ message: "Invitation has expired"
49
+ });
50
+ return c.json({
51
+ valid: true,
52
+ email: invitation.email,
53
+ organizationName: invitation.organizationName || null,
54
+ organizationId: invitation.organizationId,
55
+ role: invitation.role,
56
+ expiresAt: invitation.expiresAt
57
+ });
58
+ } catch (error) {
59
+ if (error instanceof HTTPException) throw error;
60
+ console.error("[invitations/verify] Error fetching invitation:", error);
61
+ throw createApiError({
62
+ code: "internal_server_error",
63
+ message: "Failed to validate invitation"
64
+ });
65
+ }
66
+ });
8
67
  invitationsRoutes.use("*", sessionAuth());
9
68
  invitationsRoutes.get("/pending", async (c) => {
10
69
  const email = c.req.query("email");
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types9 from "hono/types";
2
+ import * as hono_types12 from "hono/types";
3
3
 
4
4
  //#region src/domains/manage/routes/mcp.d.ts
5
- declare const app: Hono<hono_types9.BlankEnv, hono_types9.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types12.BlankEnv, hono_types12.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -0,0 +1,10 @@
1
+ import { ManageAppVariables } from "../../../types/app.js";
2
+ import { Hono } from "hono";
3
+ import * as hono_types14 from "hono/types";
4
+
5
+ //#region src/domains/manage/routes/passwordResetLinks.d.ts
6
+ declare const passwordResetLinksRoutes: Hono<{
7
+ Variables: ManageAppVariables;
8
+ }, hono_types14.BlankSchema, "/">;
9
+ //#endregion
10
+ export { passwordResetLinksRoutes as default };
@@ -0,0 +1,61 @@
1
+ import { env } from "../../../env.js";
2
+ import { sessionAuth } from "../../../middleware/sessionAuth.js";
3
+ import { OrgRoles, createApiError, waitForPasswordResetLink } from "@inkeep/agents-core";
4
+ import { Hono } from "hono";
5
+
6
+ //#region src/domains/manage/routes/passwordResetLinks.ts
7
+ const passwordResetLinksRoutes = new Hono();
8
+ passwordResetLinksRoutes.use("*", sessionAuth());
9
+ passwordResetLinksRoutes.post("/", async (c) => {
10
+ const tenantId = c.req.param("tenantId");
11
+ const { email } = await c.req.json().catch(() => ({}));
12
+ const userId = c.get("userId");
13
+ if (!tenantId) throw createApiError({
14
+ code: "bad_request",
15
+ message: "Tenant ID is required"
16
+ });
17
+ if (!userId) throw createApiError({
18
+ code: "unauthorized",
19
+ message: "Authentication required"
20
+ });
21
+ if (!email) throw createApiError({
22
+ code: "bad_request",
23
+ message: "Email is required"
24
+ });
25
+ const tenantRole = c.get("tenantRole");
26
+ if (!tenantRole || tenantRole !== OrgRoles.ADMIN && tenantRole !== OrgRoles.OWNER) throw createApiError({
27
+ code: "forbidden",
28
+ message: "Admin access required"
29
+ });
30
+ const auth = c.get("auth");
31
+ if (!auth) throw createApiError({
32
+ code: "internal_server_error",
33
+ message: "Auth not configured"
34
+ });
35
+ if (!(await auth.api.listMembers({
36
+ query: { organizationId: tenantId },
37
+ headers: c.req.raw.headers
38
+ })).members.some((m) => m.user.email === email)) throw createApiError({
39
+ code: "forbidden",
40
+ message: "User is not a member of this organization"
41
+ });
42
+ const redirectTo = `${env.INKEEP_AGENTS_MANAGE_UI_URL || "http://localhost:3000"}/reset-password`;
43
+ const linkPromise = waitForPasswordResetLink(email);
44
+ await auth.api.requestPasswordReset({ body: {
45
+ email,
46
+ redirectTo
47
+ } });
48
+ try {
49
+ const link = await linkPromise;
50
+ return c.json({ url: link.url });
51
+ } catch {
52
+ throw createApiError({
53
+ code: "internal_server_error",
54
+ message: "Reset link not available"
55
+ });
56
+ }
57
+ });
58
+ var passwordResetLinks_default = passwordResetLinksRoutes;
59
+
60
+ //#endregion
61
+ export { passwordResetLinks_default as default };
@@ -1,10 +1,10 @@
1
1
  import { ManageAppVariables } from "../../../types/app.js";
2
2
  import { Hono } from "hono";
3
- import * as hono_types11 from "hono/types";
3
+ import * as hono_types10 from "hono/types";
4
4
 
5
5
  //#region src/domains/manage/routes/signoz.d.ts
6
6
  declare const app: Hono<{
7
7
  Variables: ManageAppVariables;
8
- }, hono_types11.BlankSchema, "/">;
8
+ }, hono_types10.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { app as default };
@@ -0,0 +1,10 @@
1
+ import { ManageAppVariables } from "../../../types/app.js";
2
+ import { Hono } from "hono";
3
+ import * as hono_types5 from "hono/types";
4
+
5
+ //#region src/domains/manage/routes/users.d.ts
6
+ declare const usersRoutes: Hono<{
7
+ Variables: ManageAppVariables;
8
+ }, hono_types5.BlankSchema, "/">;
9
+ //#endregion
10
+ export { usersRoutes as default };
@@ -0,0 +1,78 @@
1
+ import runDbClient_default from "../../../data/db/runDbClient.js";
2
+ import { sessionAuth } from "../../../middleware/sessionAuth.js";
3
+ import { OrgRoles, createApiError, getUserOrganizationsFromDb, getUserProvidersFromDb } from "@inkeep/agents-core";
4
+ import { Hono } from "hono";
5
+
6
+ //#region src/domains/manage/routes/users.ts
7
+ const usersRoutes = new Hono();
8
+ usersRoutes.use("*", sessionAuth());
9
+ /**
10
+ * GET /api/users/:userId/organizations
11
+ *
12
+ * List all organizations for a user.
13
+ * Only allows querying own organizations.
14
+ */
15
+ usersRoutes.get("/:userId/organizations", async (c) => {
16
+ const userId = c.req.param("userId");
17
+ const authenticatedUserId = c.get("userId");
18
+ if (!userId) throw createApiError({
19
+ code: "bad_request",
20
+ message: "User ID is required"
21
+ });
22
+ if (userId !== authenticatedUserId) throw createApiError({
23
+ code: "forbidden",
24
+ message: "Cannot access another user's organizations"
25
+ });
26
+ const userOrganizations = (await getUserOrganizationsFromDb(runDbClient_default)(userId)).map((org) => ({
27
+ ...org,
28
+ createdAt: org.createdAt.toISOString()
29
+ }));
30
+ return c.json(userOrganizations);
31
+ });
32
+ /**
33
+ * POST /api/users/providers
34
+ *
35
+ * Get authentication providers for a list of users.
36
+ * Returns which providers each user has (e.g., 'credential', 'google', 'auth0').
37
+ * Restricted to org admins/owners querying members of their organization.
38
+ *
39
+ * Body: { userIds: string[], organizationId: string }
40
+ * Response: UserProviderInfo[]
41
+ */
42
+ usersRoutes.post("/providers", async (c) => {
43
+ const { userIds, organizationId } = await c.req.json();
44
+ const authenticatedUserId = c.get("userId");
45
+ if (!organizationId) throw createApiError({
46
+ code: "bad_request",
47
+ message: "organizationId is required"
48
+ });
49
+ if (!userIds || !Array.isArray(userIds)) throw createApiError({
50
+ code: "bad_request",
51
+ message: "userIds array is required"
52
+ });
53
+ if (userIds.length === 0) return c.json([]);
54
+ const orgAccess = (await getUserOrganizationsFromDb(runDbClient_default)(authenticatedUserId)).find((org) => org.organizationId === organizationId);
55
+ if (!orgAccess) throw createApiError({
56
+ code: "forbidden",
57
+ message: "Access denied to this organization"
58
+ });
59
+ const role = orgAccess.role;
60
+ if (role !== OrgRoles.ADMIN && role !== OrgRoles.OWNER) throw createApiError({
61
+ code: "forbidden",
62
+ message: "Admin access required"
63
+ });
64
+ try {
65
+ const providers = await getUserProvidersFromDb(runDbClient_default)(userIds);
66
+ return c.json(providers);
67
+ } catch (error) {
68
+ console.error("[users/providers] Error fetching providers:", error);
69
+ throw createApiError({
70
+ code: "internal_server_error",
71
+ message: "Failed to fetch user providers"
72
+ });
73
+ }
74
+ });
75
+ var users_default = usersRoutes;
76
+
77
+ //#endregion
78
+ export { users_default as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types7 from "hono/types";
2
+ import * as hono_types8 from "hono/types";
3
3
 
4
4
  //#region src/domains/mcp/routes/mcp.d.ts
5
- declare const app: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types8.BlankEnv, hono_types8.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -20,7 +20,6 @@ interface A2AClientOptions {
20
20
  retryConfig?: RetryConfig;
21
21
  ref?: ResolvedRef;
22
22
  headers?: Record<string, string>;
23
- fetchFn?: typeof fetch;
24
23
  }
25
24
  /**
26
25
  * A2AClient is a TypeScript HTTP client for interacting with A2A-compliant agents.
@@ -65,7 +64,6 @@ declare class A2AClient {
65
64
  private requestIdCounter;
66
65
  private serviceEndpointUrl?;
67
66
  private options;
68
- private fetchFn;
69
67
  /**
70
68
  * Constructs an A2AClient instance.
71
69
  * It initiates fetching the agent card from the provided agent baseUrl.
@@ -82,7 +82,6 @@ var A2AClient = class {
82
82
  requestIdCounter = 1;
83
83
  serviceEndpointUrl;
84
84
  options;
85
- fetchFn;
86
85
  /**
87
86
  * Constructs an A2AClient instance.
88
87
  * It initiates fetching the agent card from the provided agent baseUrl.
@@ -93,7 +92,6 @@ var A2AClient = class {
93
92
  */
94
93
  constructor(agentBaseUrl, options) {
95
94
  this.agentBaseUrl = agentBaseUrl.replace(/\/$/, "");
96
- this.fetchFn = options?.fetchFn ?? fetch;
97
95
  this.options = {
98
96
  retryConfig: {
99
97
  strategy: "backoff",
@@ -119,7 +117,7 @@ var A2AClient = class {
119
117
  agentBaseUrl: this.agentBaseUrl
120
118
  }, "agentCardUrl");
121
119
  try {
122
- const response = await this.fetchFn(url.toString(), { headers: {
120
+ const response = await fetch(url.toString(), { headers: {
123
121
  Accept: "application/json",
124
122
  ...this.options.headers || {}
125
123
  } });
@@ -146,7 +144,7 @@ var A2AClient = class {
146
144
  const agentCardUrl = `${agentBaseUrl.replace(/\/$/, "")}/.well-known/agent.json`;
147
145
  const url = new URL(agentCardUrl);
148
146
  if (this.options.ref) url.searchParams.set("ref", this.options.ref.name);
149
- const response = await this.fetchFn(url.toString(), { headers: {
147
+ const response = await fetch(url.toString(), { headers: {
150
148
  Accept: "application/json",
151
149
  ...this.options.headers || {}
152
150
  } });
@@ -286,7 +284,7 @@ var A2AClient = class {
286
284
  id: requestId
287
285
  };
288
286
  const httpResponse = await this.retry(async () => {
289
- return this.fetchFn(endpoint, {
287
+ return fetch(endpoint, {
290
288
  method: "POST",
291
289
  headers: {
292
290
  "Content-Type": "application/json",
@@ -349,7 +347,7 @@ var A2AClient = class {
349
347
  params,
350
348
  id: clientRequestId
351
349
  };
352
- const response = await this.fetchFn(endpoint, {
350
+ const response = await fetch(endpoint, {
353
351
  method: "POST",
354
352
  headers: {
355
353
  "Content-Type": "application/json",
@@ -424,7 +422,7 @@ var A2AClient = class {
424
422
  params,
425
423
  id: clientRequestId
426
424
  };
427
- const response = await this.fetchFn(endpoint, {
425
+ const response = await fetch(endpoint, {
428
426
  method: "POST",
429
427
  headers: {
430
428
  "Content-Type": "application/json",
@@ -1,6 +1,6 @@
1
1
  import { AgentConfig, DelegateRelation } from "./Agent.js";
2
2
  import { InternalRelation } from "../utils/project.js";
3
- import * as _inkeep_agents_core1 from "@inkeep/agents-core";
3
+ import * as _inkeep_agents_core0 from "@inkeep/agents-core";
4
4
  import { CredentialStoreRegistry, FullExecutionContext } from "@inkeep/agents-core";
5
5
  import * as ai0 from "ai";
6
6
 
@@ -44,7 +44,7 @@ declare function createDelegateToAgentTool({
44
44
  message: string;
45
45
  }, {
46
46
  toolCallId: any;
47
- result: _inkeep_agents_core1.Message | _inkeep_agents_core1.Task;
47
+ result: _inkeep_agents_core0.Message | _inkeep_agents_core0.Task;
48
48
  }>;
49
49
  /**
50
50
  * Parameters for building a transfer relation config
@@ -1,7 +1,6 @@
1
1
  import { getLogger as getLogger$1 } from "../../../logger.js";
2
2
  import manageDbPool_default from "../../../data/db/manageDbPool.js";
3
3
  import runDbClient_default from "../../../data/db/runDbClient.js";
4
- import { getInProcessFetch } from "../../../utils/in-process-fetch.js";
5
4
  import { DELEGATION_TOOL_BACKOFF_EXPONENT, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS } from "../constants/execution-limits/index.js";
6
5
  import { toolSessionManager } from "./ToolSessionManager.js";
7
6
  import { saveA2AMessageResponse } from "../data/conversations.js";
@@ -207,8 +206,7 @@ function createDelegateToAgentTool({ delegateConfig, callingAgentId, executionCo
207
206
  exponent: DELEGATION_TOOL_BACKOFF_EXPONENT,
208
207
  maxElapsedTime: DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS
209
208
  }
210
- },
211
- ...isInternal || isTeam ? { fetchFn: getInProcessFetch() } : {}
209
+ }
212
210
  });
213
211
  const messageToSend = {
214
212
  role: "agent",