@inkeep/agents-api 0.0.0-dev-20260128152604 → 0.0.0-dev-20260129102805

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "steps": {
3
- "node_modules/.pnpm/workflow@4.0.1-beta.33_@aws-sdk+client-sts@3.970.0_@opentelemetry+api@1.9.0_@types+reac_d0e39273ec53983ee1a59c0952eb17f2/node_modules/workflow/dist/internal/builtins.js": {
3
+ "node_modules/.pnpm/workflow@4.0.1-beta.33_@aws-sdk+client-sts@3.970.0_@opentelemetry+api@1.9.0_@types+reac_c3fd21eb4e661cd5cc8d67d9c0f6cfda/node_modules/workflow/dist/internal/builtins.js": {
4
4
  "__builtin_response_array_buffer": {
5
5
  "stepId": "__builtin_response_array_buffer"
6
6
  },
@@ -101663,7 +101663,7 @@ function getStepFunction(stepId) {
101663
101663
  }
101664
101664
  __name(getStepFunction, "getStepFunction");
101665
101665
 
101666
- // ../node_modules/.pnpm/workflow@4.0.1-beta.33_@aws-sdk+client-sts@3.970.0_@opentelemetry+api@1.9.0_@types+reac_d0e39273ec53983ee1a59c0952eb17f2/node_modules/workflow/dist/internal/builtins.js
101666
+ // ../node_modules/.pnpm/workflow@4.0.1-beta.33_@aws-sdk+client-sts@3.970.0_@opentelemetry+api@1.9.0_@types+reac_c3fd21eb4e661cd5cc8d67d9c0f6cfda/node_modules/workflow/dist/internal/builtins.js
101667
101667
  async function __builtin_response_array_buffer(res) {
101668
101668
  return res.arrayBuffer();
101669
101669
  }
@@ -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_types14 from "hono/types";
4
+ import * as hono_types1 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_types14.BlankEnv, hono_types14.BlankSchema, "/">;
8
+ declare function createAgentsHono(config: AppConfig): Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { createAgentsHono, isWebhookRoute };
@@ -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 hono0 from "hono";
2
+ import * as hono9 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/datasetTriggers.d.ts
5
- declare const app: OpenAPIHono<hono0.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono9.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 hono2 from "hono";
2
+ import * as hono8 from "hono";
3
3
 
4
4
  //#region src/domains/evals/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono2.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono8.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types7 from "hono/types";
2
+ import * as hono_types3 from "hono/types";
3
3
 
4
4
  //#region src/domains/evals/workflow/routes.d.ts
5
- declare const workflowRoutes: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
5
+ declare const workflowRoutes: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { workflowRoutes };
@@ -3,10 +3,10 @@ import { GenerateInstallationAccessTokenResult, GenerateTokenError, GenerateToke
3
3
  import { GetJwkResult, JwksError, JwksResult, clearJwksCache, getJwkForToken, getJwksCacheStatus } from "./jwks.js";
4
4
  import { GitHubOidcClaims, ValidateOidcTokenResult, ValidateTokenError, ValidateTokenResult, validateOidcToken } from "./oidcToken.js";
5
5
  import { Hono } from "hono";
6
- import * as hono_types1 from "hono/types";
6
+ import * as hono_types14 from "hono/types";
7
7
 
8
8
  //#region src/domains/github/index.d.ts
9
- declare function createGithubRoutes(): Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
10
- declare const githubRoutes: Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
9
+ declare function createGithubRoutes(): Hono<hono_types14.BlankEnv, hono_types14.BlankSchema, "/">;
10
+ declare const githubRoutes: Hono<hono_types14.BlankEnv, hono_types14.BlankSchema, "/">;
11
11
  //#endregion
12
12
  export { type GenerateInstallationAccessTokenResult, type GenerateTokenError, type GenerateTokenResult, type GetJwkResult, type GitHubAppConfig, type GitHubOidcClaims, type InstallationAccessToken, type InstallationInfo, type JwksError, type JwksResult, type LookupInstallationError, type LookupInstallationForRepoResult, type LookupInstallationResult, type ValidateOidcTokenResult, type ValidateTokenError, type ValidateTokenResult, clearJwksCache, createGithubRoutes, generateInstallationAccessToken, getGitHubAppConfig, getJwkForToken, getJwksCacheStatus, githubRoutes, isGitHubAppConfigured, lookupInstallationForRepo, validateOidcToken };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types9 from "hono/types";
2
+ import * as hono_types5 from "hono/types";
3
3
 
4
4
  //#region src/domains/github/routes/tokenExchange.d.ts
5
- declare const app: Hono<hono_types9.BlankEnv, hono_types9.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { OpenAPIHono } from "@hono/zod-openapi";
2
- import * as hono15 from "hono";
2
+ import * as hono6 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/conversations.d.ts
5
- declare const app: OpenAPIHono<hono15.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono6.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 hono7 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/evals/evaluationResults.d.ts
5
- declare const app: OpenAPIHono<hono17.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono7.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 hono5 from "hono";
3
3
 
4
4
  //#region src/domains/manage/routes/index.d.ts
5
- declare const app: OpenAPIHono<hono16.Env, {}, "/">;
5
+ declare const app: OpenAPIHono<hono5.Env, {}, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types11 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_types11.BlankEnv, hono_types11.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types12.BlankEnv, hono_types12.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_types13 from "hono/types";
3
+ import * as hono_types9 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_types13.BlankSchema, "/">;
8
+ }, hono_types9.BlankSchema, "/">;
9
9
  //#endregion
10
10
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types5 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_types5.BlankEnv, hono_types5.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -207,30 +207,45 @@ var ExecutionHandler = class {
207
207
  fullResponse: messageResponse
208
208
  }, `No response from agent ${currentAgentId} on iteration ${iterations} (error ${errorCount}/${this.MAX_ERRORS})`);
209
209
  if (errorCount >= this.MAX_ERRORS) {
210
- const errorMessage$1 = `Maximum error limit (${this.MAX_ERRORS}) reached`;
210
+ const errorMessage = `Maximum error limit (${this.MAX_ERRORS}) reached`;
211
211
  logger.error({
212
212
  maxErrors: this.MAX_ERRORS,
213
213
  errorCount
214
- }, errorMessage$1);
215
- await sseHelper.writeOperation(errorOp(errorMessage$1, currentAgentId || "system"));
216
- if (task) await updateTask(runDbClient_default)({
217
- taskId: task.id,
218
- data: {
219
- status: "failed",
220
- metadata: {
221
- ...task.metadata,
222
- failed_at: (/* @__PURE__ */ new Date()).toISOString(),
223
- error: errorMessage$1
224
- }
214
+ }, errorMessage);
215
+ return tracer.startActiveSpan("execution_handler.execute", {}, async (span) => {
216
+ try {
217
+ span.setAttributes({
218
+ "ai.response.content": `Hmm.. It seems I might be having some issues right now. Please clear the chat and try again.`,
219
+ "ai.response.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
220
+ "subAgent.name": agent?.subAgents[currentAgentId]?.name,
221
+ "subAgent.id": currentAgentId
222
+ });
223
+ setSpanWithError(span, new Error(errorMessage));
224
+ await sseHelper.writeOperation(errorOp(errorMessage, currentAgentId || "system"));
225
+ if (task) await updateTask(runDbClient_default)({
226
+ taskId: task.id,
227
+ data: {
228
+ status: "failed",
229
+ metadata: {
230
+ ...task.metadata,
231
+ failed_at: (/* @__PURE__ */ new Date()).toISOString(),
232
+ error: errorMessage
233
+ }
234
+ }
235
+ });
236
+ await agentSessionManager.endSession(requestId);
237
+ unregisterStreamHelper(requestId);
238
+ return {
239
+ success: false,
240
+ error: errorMessage,
241
+ iterations
242
+ };
243
+ } finally {
244
+ span.end();
245
+ await new Promise((resolve) => setImmediate(resolve));
246
+ await flushBatchProcessor();
225
247
  }
226
248
  });
227
- await agentSessionManager.endSession(requestId);
228
- unregisterStreamHelper(requestId);
229
- return {
230
- success: false,
231
- error: errorMessage$1,
232
- iterations
233
- };
234
249
  }
235
250
  continue;
236
251
  }
@@ -392,12 +407,75 @@ var ExecutionHandler = class {
392
407
  errorCount
393
408
  }, `No valid response or transfer on iteration ${iterations} (error ${errorCount}/${this.MAX_ERRORS})`);
394
409
  if (errorCount >= this.MAX_ERRORS) {
395
- const errorMessage$1 = `Maximum error limit (${this.MAX_ERRORS}) reached`;
410
+ const errorMessage = `Maximum error limit (${this.MAX_ERRORS}) reached`;
396
411
  logger.error({
397
412
  maxErrors: this.MAX_ERRORS,
398
413
  errorCount
399
- }, errorMessage$1);
400
- await sseHelper.writeOperation(errorOp(errorMessage$1, currentAgentId || "system"));
414
+ }, errorMessage);
415
+ return tracer.startActiveSpan("execution_handler.execute", {}, async (span) => {
416
+ try {
417
+ span.setAttributes({
418
+ "ai.response.content": "Hmm.. It seems I might be having some issues right now. Please clear the chat and try again.",
419
+ "ai.response.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
420
+ "subAgent.name": agent?.subAgents[currentAgentId]?.name,
421
+ "subAgent.id": currentAgentId
422
+ });
423
+ setSpanWithError(span, new Error(errorMessage));
424
+ await sseHelper.writeOperation(errorOp(errorMessage, currentAgentId || "system"));
425
+ if (task) await updateTask(runDbClient_default)({
426
+ taskId: task.id,
427
+ data: {
428
+ status: "failed",
429
+ metadata: {
430
+ ...task.metadata,
431
+ failed_at: /* @__PURE__ */ new Date(),
432
+ error: errorMessage
433
+ }
434
+ }
435
+ });
436
+ await agentSessionManager.endSession(requestId);
437
+ unregisterStreamHelper(requestId);
438
+ if (!params.datasetRunId) triggerConversationEvaluation({
439
+ tenantId,
440
+ projectId,
441
+ conversationId,
442
+ resolvedRef
443
+ }).catch((evalError) => {
444
+ logger.error({
445
+ error: evalError,
446
+ conversationId,
447
+ tenantId,
448
+ projectId
449
+ }, "Failed to trigger conversation evaluation (non-blocking)");
450
+ });
451
+ return {
452
+ success: false,
453
+ error: errorMessage,
454
+ iterations
455
+ };
456
+ } finally {
457
+ span.end();
458
+ await new Promise((resolve) => setImmediate(resolve));
459
+ await flushBatchProcessor();
460
+ }
461
+ });
462
+ }
463
+ }
464
+ const maxTransfersErrorMessage = `Maximum transfer limit (${maxTransfers}) reached without completion`;
465
+ logger.error({
466
+ maxTransfers,
467
+ iterations
468
+ }, maxTransfersErrorMessage);
469
+ return tracer.startActiveSpan("execution_handler.execute", {}, async (span) => {
470
+ try {
471
+ span.setAttributes({
472
+ "ai.response.content": "Hmm.. It seems I might be having some issues right now. Please clear the chat and try again.",
473
+ "ai.response.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
474
+ "subAgent.name": agent?.subAgents[currentAgentId]?.name,
475
+ "subAgent.id": currentAgentId
476
+ });
477
+ setSpanWithError(span, new Error(maxTransfersErrorMessage));
478
+ await sseHelper.writeOperation(errorOp(maxTransfersErrorMessage, currentAgentId || "system"));
401
479
  if (task) await updateTask(runDbClient_default)({
402
480
  taskId: task.id,
403
481
  data: {
@@ -405,78 +483,64 @@ var ExecutionHandler = class {
405
483
  metadata: {
406
484
  ...task.metadata,
407
485
  failed_at: /* @__PURE__ */ new Date(),
408
- error: errorMessage$1
486
+ error: maxTransfersErrorMessage
409
487
  }
410
488
  }
411
489
  });
412
490
  await agentSessionManager.endSession(requestId);
413
491
  unregisterStreamHelper(requestId);
414
- if (!params.datasetRunId) triggerConversationEvaluation({
415
- tenantId,
416
- projectId,
417
- conversationId,
418
- resolvedRef
419
- }).catch((error) => {
420
- logger.error({
421
- error,
422
- conversationId,
423
- tenantId,
424
- projectId
425
- }, "Failed to trigger conversation evaluation (non-blocking)");
426
- });
427
492
  return {
428
493
  success: false,
429
- error: errorMessage$1,
494
+ error: maxTransfersErrorMessage,
430
495
  iterations
431
496
  };
432
- }
433
- }
434
- const errorMessage = `Maximum transfer limit (${maxTransfers}) reached without completion`;
435
- logger.error({
436
- maxTransfers,
437
- iterations
438
- }, errorMessage);
439
- await sseHelper.writeOperation(errorOp(errorMessage, currentAgentId || "system"));
440
- if (task) await updateTask(runDbClient_default)({
441
- taskId: task.id,
442
- data: {
443
- status: "failed",
444
- metadata: {
445
- ...task.metadata,
446
- failed_at: /* @__PURE__ */ new Date(),
447
- error: errorMessage
448
- }
497
+ } finally {
498
+ span.end();
499
+ await new Promise((resolve) => setImmediate(resolve));
500
+ await flushBatchProcessor();
449
501
  }
450
502
  });
451
- await agentSessionManager.endSession(requestId);
452
- unregisterStreamHelper(requestId);
453
- return {
454
- success: false,
455
- error: errorMessage,
456
- iterations
457
- };
458
503
  } catch (error) {
459
- logger.error({ error }, "Error in execution handler");
460
504
  const errorMessage = error instanceof Error ? error.message : "Unknown execution error";
461
- await sseHelper.writeOperation(errorOp(`Execution error: ${errorMessage}`, currentAgentId || "system"));
462
- if (task) await updateTask(runDbClient_default)({
463
- taskId: task.id,
464
- data: {
465
- status: "failed",
466
- metadata: {
467
- ...task.metadata,
468
- failed_at: /* @__PURE__ */ new Date(),
469
- error: errorMessage
470
- }
505
+ const errorStack = error instanceof Error ? error.stack : void 0;
506
+ logger.error({
507
+ errorMessage,
508
+ errorStack
509
+ }, "Error in execution handler");
510
+ return tracer.startActiveSpan("execution_handler.execute", {}, async (span) => {
511
+ try {
512
+ span.setAttributes({
513
+ "ai.response.content": "Hmm.. It seems I might be having some issues right now. Please clear the chat and try again.",
514
+ "ai.response.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
515
+ "subAgent.name": agent?.subAgents[currentAgentId]?.name,
516
+ "subAgent.id": currentAgentId
517
+ });
518
+ setSpanWithError(span, error instanceof Error ? error : new Error(errorMessage));
519
+ await sseHelper.writeOperation(errorOp(`Execution error: ${errorMessage}`, currentAgentId || "system"));
520
+ if (task) await updateTask(runDbClient_default)({
521
+ taskId: task.id,
522
+ data: {
523
+ status: "failed",
524
+ metadata: {
525
+ ...task.metadata,
526
+ failed_at: /* @__PURE__ */ new Date(),
527
+ error: errorMessage
528
+ }
529
+ }
530
+ });
531
+ await agentSessionManager.endSession(requestId);
532
+ unregisterStreamHelper(requestId);
533
+ return {
534
+ success: false,
535
+ error: errorMessage,
536
+ iterations
537
+ };
538
+ } finally {
539
+ span.end();
540
+ await new Promise((resolve) => setImmediate(resolve));
541
+ await flushBatchProcessor();
471
542
  }
472
543
  });
473
- await agentSessionManager.endSession(requestId);
474
- unregisterStreamHelper(requestId);
475
- return {
476
- success: false,
477
- error: errorMessage,
478
- iterations
479
- };
480
544
  }
481
545
  }
482
546
  };
@@ -12,7 +12,7 @@ function createExecutionWrapper(executeCode, args) {
12
12
  const args = ${JSON.stringify(args, null, 2)};
13
13
 
14
14
  // User's function code
15
- const execute = ${executeCode}
15
+ const execute = ${executeCode};
16
16
 
17
17
  // Execute the function and output the result
18
18
  (async () => {
@@ -1,4 +1,4 @@
1
- import * as _inkeep_agents_core3 from "@inkeep/agents-core";
1
+ import * as _inkeep_agents_core0 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_core3.ContextBreakdown;
20
+ breakdown: _inkeep_agents_core0.ContextBreakdown;
21
21
  }
22
22
  //#endregion
23
23
  export { AssembleResult, type BreakdownComponentDef, type ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown, estimateTokens };