@inkeep/agents-api 0.0.0-dev-20260206004636 → 0.0.0-dev-20260206015755

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 (33) hide show
  1. package/dist/.well-known/workflow/v1/manifest.debug.json +14 -14
  2. package/dist/.well-known/workflow/v1/step.cjs +14 -1
  3. package/dist/createApp.d.ts +2 -2
  4. package/dist/createApp.js +3 -1
  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/services/EvaluationService.js +2 -1
  8. package/dist/domains/evals/workflow/routes.d.ts +2 -2
  9. package/dist/domains/manage/routes/availableAgents.d.ts +2 -2
  10. package/dist/domains/manage/routes/conversations.d.ts +2 -2
  11. package/dist/domains/manage/routes/invitations.d.ts +2 -2
  12. package/dist/domains/manage/routes/mcp.d.ts +2 -2
  13. package/dist/domains/manage/routes/signoz.d.ts +2 -2
  14. package/dist/domains/manage/routes/userOrganizations.d.ts +2 -2
  15. package/dist/domains/mcp/routes/mcp.d.ts +2 -2
  16. package/dist/domains/run/a2a/client.d.ts +2 -0
  17. package/dist/domains/run/a2a/client.js +7 -5
  18. package/dist/domains/run/agents/relationTools.js +3 -1
  19. package/dist/domains/run/handlers/executionHandler.js +12 -8
  20. package/dist/factory.d.ts +3 -3
  21. package/dist/index.d.ts +2 -2
  22. package/dist/middleware/evalsAuth.d.ts +2 -2
  23. package/dist/middleware/manageAuth.d.ts +2 -2
  24. package/dist/middleware/projectAccess.d.ts +2 -2
  25. package/dist/middleware/projectConfig.d.ts +3 -3
  26. package/dist/middleware/requirePermission.d.ts +2 -2
  27. package/dist/middleware/runAuth.d.ts +4 -4
  28. package/dist/middleware/sessionAuth.d.ts +3 -3
  29. package/dist/middleware/tenantAccess.d.ts +2 -2
  30. package/dist/middleware/tracing.d.ts +3 -3
  31. package/dist/utils/in-process-fetch.d.ts +22 -0
  32. package/dist/utils/in-process-fetch.js +32 -0
  33. package/package.json +5 -5
@@ -11,20 +11,6 @@
11
11
  "stepId": "__builtin_response_text"
12
12
  }
13
13
  },
14
- "src/domains/evals/workflow/functions/runDatasetItem.ts": {
15
- "callChatApiStep": {
16
- "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//callChatApiStep"
17
- },
18
- "createRelationStep": {
19
- "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//createRelationStep"
20
- },
21
- "executeEvaluatorStep": {
22
- "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//executeEvaluatorStep"
23
- },
24
- "logStep": {
25
- "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//logStep"
26
- }
27
- },
28
14
  "src/domains/evals/workflow/functions/evaluateConversation.ts": {
29
15
  "executeEvaluatorStep": {
30
16
  "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//executeEvaluatorStep"
@@ -38,6 +24,20 @@
38
24
  "logStep": {
39
25
  "stepId": "step//src/domains/evals/workflow/functions/evaluateConversation.ts//logStep"
40
26
  }
27
+ },
28
+ "src/domains/evals/workflow/functions/runDatasetItem.ts": {
29
+ "callChatApiStep": {
30
+ "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//callChatApiStep"
31
+ },
32
+ "createRelationStep": {
33
+ "stepId": "step//src/domains/evals/workflow/functions/runDatasetItem.ts//createRelationStep"
34
+ },
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
+ }
41
41
  }
42
42
  },
43
43
  "workflows": {
@@ -228857,6 +228857,19 @@ var runDbClient = createAgentsRunDatabaseClient({
228857
228857
  });
228858
228858
  var runDbClient_default = runDbClient;
228859
228859
 
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
+
228860
228873
  // src/domains/evals/services/EvaluationService.ts
228861
228874
  var logger21 = getLogger("EvaluationService");
228862
228875
  var EvaluationService = class {
@@ -228951,7 +228964,7 @@ var EvaluationService = class {
228951
228964
  datasetRunId,
228952
228965
  conversationId
228953
228966
  }, "Running dataset item through chat API");
228954
- const response = await fetch(chatUrl, {
228967
+ const response = await getInProcessFetch()(chatUrl, {
228955
228968
  method: "POST",
228956
228969
  headers: headers2,
228957
228970
  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_types12 from "hono/types";
4
+ import * as hono_types0 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_types12.BlankEnv, hono_types12.BlankSchema, "/">;
8
+ declare function createAgentsHono(config: AppConfig): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { createAgentsHono, isWebhookRoute };
package/dist/createApp.js CHANGED
@@ -1,5 +1,6 @@
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";
3
4
  import { evalRoutes } from "./domains/evals/index.js";
4
5
  import { workflowRoutes } from "./domains/evals/workflow/routes.js";
5
6
  import { sessionAuth, sessionContext } from "./middleware/sessionAuth.js";
@@ -181,7 +182,7 @@ function createAgentsHono(config) {
181
182
  headers: new Headers(c.req.raw.headers),
182
183
  body: bodyBuffer
183
184
  });
184
- return fetch(forwardedRequest);
185
+ return getInProcessFetch()(forwardedRequest);
185
186
  });
186
187
  app.route("/evals", evalRoutes);
187
188
  app.route("/work-apps/github", githubRoutes);
@@ -193,6 +194,7 @@ function createAgentsHono(config) {
193
194
  });
194
195
  const base = new Hono();
195
196
  base.route("/", app);
197
+ registerAppFetch(base.request.bind(base));
196
198
  return base;
197
199
  }
198
200
 
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono15 from "hono";
2
+ import * as hono11 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/datasetTriggers.d.ts
5
- declare const app: OpenAPIHono<hono15.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono11.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 hono16 from "hono";
2
+ import * as hono13 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono16.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono13.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -3,6 +3,7 @@ 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";
6
7
  import { ModelFactory, createEvaluationResult, createEvaluationRun, filterConversationsForJob, generateId, getConversationHistory, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluatorById, getFullAgent, getProjectScopedRef, resolveRef, updateEvaluationResult, withRef } from "@inkeep/agents-core";
7
8
  import { generateObject, generateText } from "ai";
8
9
  import { z } from "zod";
@@ -86,7 +87,7 @@ var EvaluationService = class {
86
87
  datasetRunId,
87
88
  conversationId
88
89
  }, "Running dataset item through chat API");
89
- const response = await fetch(chatUrl, {
90
+ const response = await getInProcessFetch()(chatUrl, {
90
91
  method: "POST",
91
92
  headers: headers$1,
92
93
  body: JSON.stringify(chatPayload)
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types1 from "hono/types";
2
+ import * as hono_types5 from "hono/types";
3
3
 
4
4
  //#region src/domains/evals/workflow/routes.d.ts
5
- declare const workflowRoutes: Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
5
+ declare const workflowRoutes: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { workflowRoutes };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono14 from "hono";
2
+ import * as hono17 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/availableAgents.d.ts
5
- declare const app: OpenAPIHono<hono14.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono17.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 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 };
@@ -1,10 +1,10 @@
1
1
  import { ManageAppVariables } from "../../../types/app.js";
2
2
  import { Hono } from "hono";
3
- import * as hono_types5 from "hono/types";
3
+ import * as hono_types12 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_types5.BlankSchema, "/">;
8
+ }, hono_types12.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { invitationsRoutes as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types6 from "hono/types";
2
+ import * as hono_types9 from "hono/types";
3
3
 
4
4
  //#region src/domains/manage/routes/mcp.d.ts
5
- declare const app: Hono<hono_types6.BlankEnv, hono_types6.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types9.BlankEnv, hono_types9.BlankSchema, "/">;
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_types8 from "hono/types";
3
+ import * as hono_types11 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_types8.BlankSchema, "/">;
8
+ }, hono_types11.BlankSchema, "/">;
9
9
  //#endregion
10
10
  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_types9 from "hono/types";
3
+ import * as hono_types13 from "hono/types";
4
4
 
5
5
  //#region src/domains/manage/routes/userOrganizations.d.ts
6
6
  declare const userOrganizationsRoutes: Hono<{
7
7
  Variables: ManageAppVariables;
8
- }, hono_types9.BlankSchema, "/">;
8
+ }, hono_types13.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { userOrganizationsRoutes as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types3 from "hono/types";
2
+ import * as hono_types7 from "hono/types";
3
3
 
4
4
  //#region src/domains/mcp/routes/mcp.d.ts
5
- declare const app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -20,6 +20,7 @@ interface A2AClientOptions {
20
20
  retryConfig?: RetryConfig;
21
21
  ref?: ResolvedRef;
22
22
  headers?: Record<string, string>;
23
+ fetchFn?: typeof fetch;
23
24
  }
24
25
  /**
25
26
  * A2AClient is a TypeScript HTTP client for interacting with A2A-compliant agents.
@@ -64,6 +65,7 @@ declare class A2AClient {
64
65
  private requestIdCounter;
65
66
  private serviceEndpointUrl?;
66
67
  private options;
68
+ private fetchFn;
67
69
  /**
68
70
  * Constructs an A2AClient instance.
69
71
  * It initiates fetching the agent card from the provided agent baseUrl.
@@ -82,6 +82,7 @@ var A2AClient = class {
82
82
  requestIdCounter = 1;
83
83
  serviceEndpointUrl;
84
84
  options;
85
+ fetchFn;
85
86
  /**
86
87
  * Constructs an A2AClient instance.
87
88
  * It initiates fetching the agent card from the provided agent baseUrl.
@@ -92,6 +93,7 @@ var A2AClient = class {
92
93
  */
93
94
  constructor(agentBaseUrl, options) {
94
95
  this.agentBaseUrl = agentBaseUrl.replace(/\/$/, "");
96
+ this.fetchFn = options?.fetchFn ?? fetch;
95
97
  this.options = {
96
98
  retryConfig: {
97
99
  strategy: "backoff",
@@ -117,7 +119,7 @@ var A2AClient = class {
117
119
  agentBaseUrl: this.agentBaseUrl
118
120
  }, "agentCardUrl");
119
121
  try {
120
- const response = await fetch(url.toString(), { headers: {
122
+ const response = await this.fetchFn(url.toString(), { headers: {
121
123
  Accept: "application/json",
122
124
  ...this.options.headers || {}
123
125
  } });
@@ -144,7 +146,7 @@ var A2AClient = class {
144
146
  const agentCardUrl = `${agentBaseUrl.replace(/\/$/, "")}/.well-known/agent.json`;
145
147
  const url = new URL(agentCardUrl);
146
148
  if (this.options.ref) url.searchParams.set("ref", this.options.ref.name);
147
- const response = await fetch(url.toString(), { headers: {
149
+ const response = await this.fetchFn(url.toString(), { headers: {
148
150
  Accept: "application/json",
149
151
  ...this.options.headers || {}
150
152
  } });
@@ -284,7 +286,7 @@ var A2AClient = class {
284
286
  id: requestId
285
287
  };
286
288
  const httpResponse = await this.retry(async () => {
287
- return fetch(endpoint, {
289
+ return this.fetchFn(endpoint, {
288
290
  method: "POST",
289
291
  headers: {
290
292
  "Content-Type": "application/json",
@@ -347,7 +349,7 @@ var A2AClient = class {
347
349
  params,
348
350
  id: clientRequestId
349
351
  };
350
- const response = await fetch(endpoint, {
352
+ const response = await this.fetchFn(endpoint, {
351
353
  method: "POST",
352
354
  headers: {
353
355
  "Content-Type": "application/json",
@@ -422,7 +424,7 @@ var A2AClient = class {
422
424
  params,
423
425
  id: clientRequestId
424
426
  };
425
- const response = await fetch(endpoint, {
427
+ const response = await this.fetchFn(endpoint, {
426
428
  method: "POST",
427
429
  headers: {
428
430
  "Content-Type": "application/json",
@@ -1,6 +1,7 @@
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";
4
5
  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";
5
6
  import { toolSessionManager } from "./ToolSessionManager.js";
6
7
  import { saveA2AMessageResponse } from "../data/conversations.js";
@@ -206,7 +207,8 @@ function createDelegateToAgentTool({ delegateConfig, callingAgentId, executionCo
206
207
  exponent: DELEGATION_TOOL_BACKOFF_EXPONENT,
207
208
  maxElapsedTime: DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS
208
209
  }
209
- }
210
+ },
211
+ ...isInternal || isTeam ? { fetchFn: getInProcessFetch() } : {}
210
212
  });
211
213
  const messageToSend = {
212
214
  role: "agent",
@@ -1,5 +1,6 @@
1
1
  import { getLogger as getLogger$1 } from "../../../logger.js";
2
2
  import runDbClient_default from "../../../data/db/runDbClient.js";
3
+ import { getInProcessFetch } from "../../../utils/in-process-fetch.js";
3
4
  import { AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS } from "../constants/execution-limits/index.js";
4
5
  import { tracer } from "../utils/tracer.js";
5
6
  import { registerStreamHelper, unregisterStreamHelper } from "../utils/stream-registry.js";
@@ -164,14 +165,17 @@ var ExecutionHandler = class {
164
165
  currentAgentId = activeAgent.activeSubAgentId;
165
166
  logger.info({ currentAgentId }, `Updated current agent to: ${currentAgentId}`);
166
167
  }
167
- const a2aClient = new A2AClient(`${baseUrl}/run/agents`, { headers: {
168
- Authorization: `Bearer ${apiKey}`,
169
- "x-inkeep-tenant-id": tenantId,
170
- "x-inkeep-project-id": projectId,
171
- "x-inkeep-agent-id": agentId,
172
- "x-inkeep-sub-agent-id": currentAgentId,
173
- ...forwardedHeaders || {}
174
- } });
168
+ const a2aClient = new A2AClient(`${baseUrl}/run/agents`, {
169
+ headers: {
170
+ Authorization: `Bearer ${apiKey}`,
171
+ "x-inkeep-tenant-id": tenantId,
172
+ "x-inkeep-project-id": projectId,
173
+ "x-inkeep-agent-id": agentId,
174
+ "x-inkeep-sub-agent-id": currentAgentId,
175
+ ...forwardedHeaders || {}
176
+ },
177
+ fetchFn: getInProcessFetch()
178
+ });
175
179
  let messageResponse = null;
176
180
  const messageMetadata = {
177
181
  stream_request_id: requestId,
package/dist/factory.d.ts CHANGED
@@ -3,10 +3,10 @@ import "./types/index.js";
3
3
  import { createAgentsHono } from "./createApp.js";
4
4
  import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
5
5
  import { CredentialStore, ServerConfig } from "@inkeep/agents-core";
6
- import * as hono0 from "hono";
6
+ import * as hono10 from "hono";
7
7
  import * as zod0 from "zod";
8
8
  import { SSOProviderConfig, UserAuthConfig } from "@inkeep/agents-core/auth";
9
- import * as hono_types0 from "hono/types";
9
+ import * as hono_types1 from "hono/types";
10
10
  import * as better_auth0 from "better-auth";
11
11
  import * as better_auth_plugins0 from "better-auth/plugins";
12
12
  import * as _better_auth_sso0 from "@better-auth/sso";
@@ -1536,6 +1536,6 @@ declare function createAgentsApp(config?: {
1536
1536
  credentialStores?: CredentialStore[];
1537
1537
  auth?: UserAuthConfig;
1538
1538
  sandboxConfig?: SandboxConfig;
1539
- }): hono0.Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
1539
+ }): hono10.Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
1540
1540
  //#endregion
1541
1541
  export { type SSOProviderConfig, type UserAuthConfig, createAgentsApp, createAgentsAuth, createAgentsHono, createAuth0Provider, createOIDCProvider };
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { createAuth0Provider, createOIDCProvider } from "./ssoHelpers.js";
7
7
  import { SSOProviderConfig, UserAuthConfig, createAgentsApp } from "./factory.js";
8
8
  import { Hono } from "hono";
9
9
  import * as zod205 from "zod";
10
- import * as hono_types10 from "hono/types";
10
+ import * as hono_types3 from "hono/types";
11
11
  import * as better_auth78 from "better-auth";
12
12
  import * as better_auth_plugins69 from "better-auth/plugins";
13
13
  import * as _better_auth_sso10 from "@better-auth/sso";
@@ -1532,6 +1532,6 @@ declare const auth: better_auth78.Auth<{
1532
1532
  }>;
1533
1533
  }];
1534
1534
  }>;
1535
- declare const app: Hono<hono_types10.BlankEnv, hono_types10.BlankSchema, "/">;
1535
+ declare const app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
1536
1536
  //#endregion
1537
1537
  export { type AppConfig, type AppVariables, Hono, type NativeSandboxConfig, type SSOProviderConfig, type SandboxConfig, type UserAuthConfig, type VercelSandboxConfig, auth, createAgentsApp, createAgentsHono, createAuth0Provider, createOIDCProvider, app as default };
@@ -1,5 +1,5 @@
1
1
  import { BaseExecutionContext } from "@inkeep/agents-core";
2
- import * as hono3 from "hono";
2
+ import * as hono9 from "hono";
3
3
 
4
4
  //#region src/middleware/evalsAuth.d.ts
5
5
 
@@ -7,7 +7,7 @@ import * as hono3 from "hono";
7
7
  * Middleware to authenticate API requests using Bearer token authentication
8
8
  * First checks if token matches INKEEP_AGENTS_EVAL_API_BYPASS_SECRET,
9
9
  */
10
- declare const evalApiKeyAuth: () => hono3.MiddlewareHandler<{
10
+ declare const evalApiKeyAuth: () => hono9.MiddlewareHandler<{
11
11
  Variables: {
12
12
  executionContext: BaseExecutionContext;
13
13
  };
@@ -1,5 +1,5 @@
1
1
  import { BaseExecutionContext } from "@inkeep/agents-core";
2
- import * as hono4 from "hono";
2
+ import * as hono8 from "hono";
3
3
  import { createAuth } from "@inkeep/agents-core/auth";
4
4
 
5
5
  //#region src/middleware/manageAuth.d.ts
@@ -12,7 +12,7 @@ import { createAuth } from "@inkeep/agents-core/auth";
12
12
  * 3. Database API key
13
13
  * 4. Internal service token
14
14
  */
15
- declare const manageApiKeyAuth: () => hono4.MiddlewareHandler<{
15
+ declare const manageApiKeyAuth: () => hono8.MiddlewareHandler<{
16
16
  Variables: {
17
17
  executionContext: BaseExecutionContext;
18
18
  userId?: string;
@@ -1,6 +1,6 @@
1
1
  import { ManageAppVariables } from "../types/app.js";
2
2
  import { ProjectPermissionLevel } from "@inkeep/agents-core";
3
- import * as hono8 from "hono";
3
+ import * as hono12 from "hono";
4
4
 
5
5
  //#region src/middleware/projectAccess.d.ts
6
6
  /**
@@ -10,6 +10,6 @@ declare const requireProjectPermission: <Env$1 extends {
10
10
  Variables: ManageAppVariables;
11
11
  } = {
12
12
  Variables: ManageAppVariables;
13
- }>(permission?: ProjectPermissionLevel) => hono8.MiddlewareHandler<Env$1, string, {}, Response>;
13
+ }>(permission?: ProjectPermissionLevel) => hono12.MiddlewareHandler<Env$1, string, {}, Response>;
14
14
  //#endregion
15
15
  export { requireProjectPermission };
@@ -1,11 +1,11 @@
1
1
  import { BaseExecutionContext, ResolvedRef } from "@inkeep/agents-core";
2
- import * as hono5 from "hono";
2
+ import * as hono14 from "hono";
3
3
 
4
4
  //#region src/middleware/projectConfig.d.ts
5
5
  /**
6
6
  * Middleware that fetches the full project definition from the Management API
7
7
  */
8
- declare const projectConfigMiddleware: hono5.MiddlewareHandler<{
8
+ declare const projectConfigMiddleware: hono14.MiddlewareHandler<{
9
9
  Variables: {
10
10
  executionContext: BaseExecutionContext;
11
11
  resolvedRef: ResolvedRef;
@@ -15,7 +15,7 @@ declare const projectConfigMiddleware: hono5.MiddlewareHandler<{
15
15
  * Creates a middleware that applies project config fetching except for specified route patterns
16
16
  * @param skipRouteCheck - Function that returns true if the route should skip the middleware
17
17
  */
18
- declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) => hono5.MiddlewareHandler<{
18
+ declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) => hono14.MiddlewareHandler<{
19
19
  Variables: {
20
20
  executionContext: BaseExecutionContext;
21
21
  resolvedRef: ResolvedRef;
@@ -1,5 +1,5 @@
1
1
  import { ManageAppVariables } from "../types/app.js";
2
- import * as hono7 from "hono";
2
+ import * as hono1 from "hono";
3
3
 
4
4
  //#region src/middleware/requirePermission.d.ts
5
5
  type Permission = {
@@ -9,6 +9,6 @@ declare const requirePermission: <Env$1 extends {
9
9
  Variables: ManageAppVariables;
10
10
  } = {
11
11
  Variables: ManageAppVariables;
12
- }>(permissions: Permission) => hono7.MiddlewareHandler<Env$1, string, {}, Response>;
12
+ }>(permissions: Permission) => hono1.MiddlewareHandler<Env$1, string, {}, Response>;
13
13
  //#endregion
14
14
  export { requirePermission };
@@ -1,8 +1,8 @@
1
1
  import { BaseExecutionContext } from "@inkeep/agents-core";
2
- import * as hono0 from "hono";
2
+ import * as hono2 from "hono";
3
3
 
4
4
  //#region src/middleware/runAuth.d.ts
5
- declare const runApiKeyAuth: () => hono0.MiddlewareHandler<{
5
+ declare const runApiKeyAuth: () => hono2.MiddlewareHandler<{
6
6
  Variables: {
7
7
  executionContext: BaseExecutionContext;
8
8
  };
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono0.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) => hono0.MiddlewareHandler<{
14
+ declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) => hono2.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: () => hono0.MiddlewareHandler<{
23
+ declare const runOptionalAuth: () => hono2.MiddlewareHandler<{
24
24
  Variables: {
25
25
  executionContext?: BaseExecutionContext;
26
26
  };
@@ -1,4 +1,4 @@
1
- import * as hono9 from "hono";
1
+ import * as hono6 from "hono";
2
2
 
3
3
  //#region src/middleware/sessionAuth.d.ts
4
4
 
@@ -7,11 +7,11 @@ import * as hono9 from "hono";
7
7
  * Requires that a user has already been authenticated via Better Auth session.
8
8
  * Used primarily for manage routes that require an active user session.
9
9
  */
10
- declare const sessionAuth: () => hono9.MiddlewareHandler<any, string, {}, Response>;
10
+ declare const sessionAuth: () => hono6.MiddlewareHandler<any, string, {}, Response>;
11
11
  /**
12
12
  * Global session middleware - sets user and session in context for all routes
13
13
  * Used for all routes that require an active user session.
14
14
  */
15
- declare const sessionContext: () => hono9.MiddlewareHandler<any, string, {}, Response>;
15
+ declare const sessionContext: () => hono6.MiddlewareHandler<any, string, {}, Response>;
16
16
  //#endregion
17
17
  export { sessionAuth, sessionContext };
@@ -1,4 +1,4 @@
1
- import * as hono11 from "hono";
1
+ import * as hono5 from "hono";
2
2
 
3
3
  //#region src/middleware/tenantAccess.d.ts
4
4
 
@@ -11,7 +11,7 @@ import * as hono11 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: () => hono11.MiddlewareHandler<{
14
+ declare const requireTenantAccess: () => hono5.MiddlewareHandler<{
15
15
  Variables: {
16
16
  userId: string;
17
17
  tenantId: string;
@@ -1,7 +1,7 @@
1
- import * as hono12 from "hono";
1
+ import * as hono0 from "hono";
2
2
 
3
3
  //#region src/middleware/tracing.d.ts
4
- declare const otelBaggageMiddleware: () => hono12.MiddlewareHandler<any, string, {}, Response>;
5
- declare const executionBaggageMiddleware: () => hono12.MiddlewareHandler<any, string, {}, Response>;
4
+ declare const otelBaggageMiddleware: () => hono0.MiddlewareHandler<any, string, {}, Response>;
5
+ declare const executionBaggageMiddleware: () => hono0.MiddlewareHandler<any, string, {}, Response>;
6
6
  //#endregion
7
7
  export { executionBaggageMiddleware, otelBaggageMiddleware };
@@ -0,0 +1,22 @@
1
+ //#region src/utils/in-process-fetch.d.ts
2
+ /**
3
+ * In-process fetch transport for internal self-calls.
4
+ *
5
+ * Routes requests through the Hono app's full middleware stack in-process
6
+ * rather than over the network. This guarantees same-instance execution,
7
+ * which is critical for features that rely on process-local state
8
+ * (e.g. the stream helper registry for real-time SSE streaming).
9
+ *
10
+ * Drop-in replacement for `fetch()` — same signature, same return type.
11
+ * Throws in production if the app hasn't been registered.
12
+ * Falls back to global `fetch` in test environments where the full app
13
+ * may not be initialized.
14
+ *
15
+ * @example
16
+ * import { getInProcessFetch } from './utils/in-process-fetch';
17
+ * const response = await getInProcessFetch()(url, init);
18
+ */
19
+ declare function registerAppFetch(fn: typeof fetch): void;
20
+ declare function getInProcessFetch(): typeof fetch;
21
+ //#endregion
22
+ export { getInProcessFetch, registerAppFetch };
@@ -0,0 +1,32 @@
1
+ //#region src/utils/in-process-fetch.ts
2
+ /**
3
+ * In-process fetch transport for internal self-calls.
4
+ *
5
+ * Routes requests through the Hono app's full middleware stack in-process
6
+ * rather than over the network. This guarantees same-instance execution,
7
+ * which is critical for features that rely on process-local state
8
+ * (e.g. the stream helper registry for real-time SSE streaming).
9
+ *
10
+ * Drop-in replacement for `fetch()` — same signature, same return type.
11
+ * Throws in production if the app hasn't been registered.
12
+ * Falls back to global `fetch` in test environments where the full app
13
+ * may not be initialized.
14
+ *
15
+ * @example
16
+ * import { getInProcessFetch } from './utils/in-process-fetch';
17
+ * const response = await getInProcessFetch()(url, init);
18
+ */
19
+ let _appFetch;
20
+ function registerAppFetch(fn) {
21
+ _appFetch = fn;
22
+ }
23
+ function getInProcessFetch() {
24
+ if (!_appFetch) {
25
+ if (process.env.ENVIRONMENT === "test") return fetch;
26
+ throw new Error("[in-process-fetch] App fetch not registered. Call registerAppFetch() during app initialization before handling requests.");
27
+ }
28
+ return _appFetch;
29
+ }
30
+
31
+ //#endregion
32
+ export { getInProcessFetch, registerAppFetch };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-api",
3
- "version": "0.0.0-dev-20260206004636",
3
+ "version": "0.0.0-dev-20260206015755",
4
4
  "description": "Unified Inkeep Agents API - combines management, runtime, and evaluation capabilities",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -66,10 +66,10 @@
66
66
  "openid-client": "^6.8.1",
67
67
  "pg": "^8.16.3",
68
68
  "workflow": "4.0.1-beta.33",
69
- "@inkeep/agents-core": "^0.0.0-dev-20260206004636",
70
- "@inkeep/agents-manage-mcp": "^0.0.0-dev-20260206004636",
71
- "@inkeep/agents-mcp": "^0.0.0-dev-20260206004636",
72
- "@inkeep/agents-work-apps": "^0.0.0-dev-20260206004636"
69
+ "@inkeep/agents-core": "^0.0.0-dev-20260206015755",
70
+ "@inkeep/agents-manage-mcp": "^0.0.0-dev-20260206015755",
71
+ "@inkeep/agents-mcp": "^0.0.0-dev-20260206015755",
72
+ "@inkeep/agents-work-apps": "^0.0.0-dev-20260206015755"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "@hono/zod-openapi": "^1.1.5",