@inkeep/agents-api 0.0.0-dev-20260212152525 → 0.0.0-dev-20260212154015

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 (38) hide show
  1. package/dist/.well-known/workflow/v1/manifest.debug.json +11 -11
  2. package/dist/.well-known/workflow/v1/step.cjs +251 -225
  3. package/dist/createApp.d.ts +2 -2
  4. package/dist/createApp.js +3 -1
  5. package/dist/data/db/manageDbClient.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/index.d.ts +2 -2
  12. package/dist/domains/manage/routes/invitations.d.ts +2 -2
  13. package/dist/domains/manage/routes/mcp.d.ts +2 -2
  14. package/dist/domains/manage/routes/passwordResetLinks.d.ts +2 -2
  15. package/dist/domains/manage/routes/signoz.d.ts +2 -2
  16. package/dist/domains/manage/routes/users.d.ts +2 -2
  17. package/dist/domains/mcp/routes/mcp.d.ts +2 -2
  18. package/dist/domains/run/a2a/client.d.ts +2 -0
  19. package/dist/domains/run/a2a/client.js +7 -5
  20. package/dist/domains/run/agents/relationTools.d.ts +2 -2
  21. package/dist/domains/run/agents/relationTools.js +3 -1
  22. package/dist/domains/run/handlers/executionHandler.js +12 -8
  23. package/dist/domains/run/utils/token-estimator.d.ts +2 -2
  24. package/dist/factory.d.ts +263 -263
  25. package/dist/index.d.ts +262 -262
  26. package/dist/middleware/evalsAuth.d.ts +2 -2
  27. package/dist/middleware/manageAuth.d.ts +2 -2
  28. package/dist/middleware/projectAccess.d.ts +2 -2
  29. package/dist/middleware/projectConfig.d.ts +3 -3
  30. package/dist/middleware/requirePermission.d.ts +2 -2
  31. package/dist/middleware/runAuth.d.ts +4 -4
  32. package/dist/middleware/sessionAuth.d.ts +3 -3
  33. package/dist/middleware/tenantAccess.d.ts +2 -2
  34. package/dist/middleware/tracing.d.ts +3 -3
  35. package/dist/middleware/tracing.js +1 -1
  36. package/dist/utils/in-process-fetch.d.ts +30 -0
  37. package/dist/utils/in-process-fetch.js +51 -0
  38. package/package.json +5 -5
@@ -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_types1 from "hono/types";
4
+ import * as hono_types13 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_types1.BlankEnv, hono_types1.BlankSchema, "/">;
8
+ declare function createAgentsHono(config: AppConfig): Hono<hono_types13.BlankEnv, hono_types13.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";
@@ -189,7 +190,7 @@ function createAgentsHono(config) {
189
190
  headers: new Headers(c.req.raw.headers),
190
191
  body: bodyBuffer
191
192
  });
192
- return fetch(forwardedRequest);
193
+ return getInProcessFetch()(forwardedRequest);
193
194
  });
194
195
  app.route("/evals", evalRoutes);
195
196
  app.route("/work-apps/github", githubRoutes);
@@ -204,6 +205,7 @@ function createAgentsHono(config) {
204
205
  });
205
206
  const base = new Hono();
206
207
  base.route("/", app);
208
+ registerAppFetch(base.request.bind(base));
207
209
  return base;
208
210
  }
209
211
 
@@ -1,6 +1,6 @@
1
- import * as _inkeep_agents_core3 from "@inkeep/agents-core";
1
+ import * as _inkeep_agents_core0 from "@inkeep/agents-core";
2
2
 
3
3
  //#region src/data/db/manageDbClient.d.ts
4
- declare const manageDbClient: _inkeep_agents_core3.AgentsManageDatabaseClient;
4
+ declare const manageDbClient: _inkeep_agents_core0.AgentsManageDatabaseClient;
5
5
  //#endregion
6
6
  export { manageDbClient as default };
@@ -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/evals/routes/index.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 };
@@ -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, parseSSEResponse, 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_types10 from "hono/types";
2
+ import * as hono_types1 from "hono/types";
3
3
 
4
4
  //#region src/domains/evals/workflow/routes.d.ts
5
- declare const workflowRoutes: Hono<hono_types10.BlankEnv, hono_types10.BlankSchema, "/">;
5
+ declare const workflowRoutes: Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { workflowRoutes };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono2 from "hono";
2
+ import * as hono16 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/availableAgents.d.ts
5
- declare const app: OpenAPIHono<hono2.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 hono3 from "hono";
2
+ import * as hono17 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/conversations.d.ts
5
- declare const app: OpenAPIHono<hono3.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 hono5 from "hono";
2
+ import * as hono18 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono5.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono18.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_types6 from "hono/types";
3
+ import * as hono_types10 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_types6.BlankSchema, "/">;
8
+ }, hono_types10.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { invitationsRoutes 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/manage/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 };
@@ -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_types6 from "hono/types";
4
4
 
5
5
  //#region src/domains/manage/routes/passwordResetLinks.d.ts
6
6
  declare const passwordResetLinksRoutes: Hono<{
7
7
  Variables: ManageAppVariables;
8
- }, hono_types9.BlankSchema, "/">;
8
+ }, hono_types6.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { passwordResetLinksRoutes 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_types5 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_types12.BlankSchema, "/">;
8
+ }, hono_types5.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_types3 from "hono/types";
3
+ import * as hono_types7 from "hono/types";
4
4
 
5
5
  //#region src/domains/manage/routes/users.d.ts
6
6
  declare const usersRoutes: Hono<{
7
7
  Variables: ManageAppVariables;
8
- }, hono_types3.BlankSchema, "/">;
8
+ }, hono_types7.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { usersRoutes as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types4 from "hono/types";
2
+ import * as hono_types3 from "hono/types";
3
3
 
4
4
  //#region src/domains/mcp/routes/mcp.d.ts
5
- declare const app: Hono<hono_types4.BlankEnv, hono_types4.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types3.BlankEnv, hono_types3.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,6 @@
1
1
  import { AgentConfig, DelegateRelation } from "./Agent.js";
2
2
  import { InternalRelation } from "../utils/project.js";
3
- import * as _inkeep_agents_core0 from "@inkeep/agents-core";
3
+ import * as _inkeep_agents_core2 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_core0.Message | _inkeep_agents_core0.Task;
47
+ result: _inkeep_agents_core2.Message | _inkeep_agents_core2.Task;
48
48
  }>;
49
49
  /**
50
50
  * Parameters for building a transfer relation config
@@ -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 { A2AClient } from "../a2a/client.js";
5
6
  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
7
  import { toolSessionManager } from "./ToolSessionManager.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 { flushBatchProcessor } from "../../../instrumentation.js";
4
5
  import { triggerConversationEvaluation } from "../../evals/services/conversationEvaluation.js";
5
6
  import { A2AClient } from "../a2a/client.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,
@@ -1,4 +1,4 @@
1
- import * as _inkeep_agents_core2 from "@inkeep/agents-core";
1
+ import * as _inkeep_agents_core1 from "@inkeep/agents-core";
2
2
  import { BreakdownComponentDef, ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown } from "@inkeep/agents-core";
3
3
 
4
4
  //#region src/domains/run/utils/token-estimator.d.ts
@@ -17,7 +17,7 @@ interface AssembleResult {
17
17
  /** The assembled prompt string */
18
18
  prompt: string;
19
19
  /** Token breakdown for each component */
20
- breakdown: _inkeep_agents_core2.ContextBreakdown;
20
+ breakdown: _inkeep_agents_core1.ContextBreakdown;
21
21
  }
22
22
  //#endregion
23
23
  export { AssembleResult, type BreakdownComponentDef, type ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown, estimateTokens };