@inkeep/agents-api 0.42.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.well-known/workflow/v1/manifest.debug.json +6 -6
- package/dist/.well-known/workflow/v1/step.cjs +220467 -203416
- package/dist/_virtual/rolldown_runtime.js +7 -0
- package/dist/createApp.js +47 -17
- package/dist/domains/evals/api/.well-known/workflow/v1/flow.d.ts +4 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/flow.js +12 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/step.d.ts +4 -0
- package/dist/domains/evals/api/.well-known/workflow/v1/step.js +12 -0
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/scripts/build-workflow.js +2 -2
- package/dist/domains/evals/workflow/world.js +3 -2
- package/dist/domains/manage/index.js +6 -2
- package/dist/domains/manage/routes/agent.js +7 -4
- package/dist/domains/manage/routes/agentFull.js +9 -6
- package/dist/domains/manage/routes/apiKeys.js +1 -2
- package/dist/domains/manage/routes/artifactComponents.js +5 -5
- package/dist/domains/manage/routes/cliAuth.js +3 -3
- package/dist/domains/manage/routes/contextConfigs.js +5 -5
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/credentialStores.js +2 -2
- package/dist/domains/manage/routes/credentials.js +6 -7
- package/dist/domains/manage/routes/dataComponents.js +6 -7
- package/dist/domains/manage/routes/externalAgents.js +1 -2
- package/dist/domains/manage/routes/github.d.ts +16 -0
- package/dist/domains/manage/routes/github.js +511 -0
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/index.js +4 -0
- package/dist/domains/manage/routes/invitations.js +1 -1
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/{agentToolRelations.d.ts → mcpToolGithubAccess.d.ts} +1 -1
- package/dist/domains/manage/routes/mcpToolGithubAccess.js +205 -0
- package/dist/domains/manage/routes/playgroundToken.js +1 -2
- package/dist/domains/manage/routes/projectFull.js +33 -11
- package/dist/domains/manage/routes/projectGithubAccess.d.ts +9 -0
- package/dist/domains/manage/routes/projectGithubAccess.js +167 -0
- package/dist/domains/manage/routes/projectMembers.js +12 -44
- package/dist/domains/manage/routes/projectPermissions.js +11 -11
- package/dist/domains/manage/routes/projects.js +15 -18
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.js +7 -4
- package/dist/domains/manage/routes/subAgentArtifactComponents.js +5 -5
- package/dist/domains/manage/routes/subAgentDataComponents.js +5 -5
- package/dist/domains/manage/routes/subAgentExternalAgentRelations.js +5 -5
- package/dist/domains/manage/routes/subAgentFunctionTools.js +5 -5
- package/dist/domains/manage/routes/subAgentRelations.js +6 -6
- package/dist/domains/manage/routes/subAgentTeamAgentRelations.js +6 -6
- package/dist/domains/manage/routes/subAgentToolRelations.js +6 -6
- package/dist/domains/manage/routes/subAgents.js +5 -5
- package/dist/domains/manage/routes/tools.js +28 -5
- package/dist/domains/manage/routes/triggers.js +49 -24
- package/dist/domains/manage/routes/userOrganizations.js +4 -4
- package/dist/domains/manage/routes/userProjectMemberships.d.ts +9 -0
- package/dist/domains/manage/routes/userProjectMemberships.js +44 -0
- package/dist/domains/mcp/routes/mcp.d.ts +7 -0
- package/dist/domains/mcp/routes/mcp.js +45 -0
- package/dist/domains/run/agents/Agent.d.ts +1 -0
- package/dist/domains/run/agents/Agent.js +235 -45
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/constants/execution-limits/defaults.d.ts +1 -1
- package/dist/domains/run/constants/execution-limits/defaults.js +1 -1
- package/dist/domains/run/constants/execution-limits/index.d.ts +1 -1
- package/dist/domains/run/context/ContextFetcher.js +8 -7
- package/dist/domains/run/context/validation.d.ts +1 -1
- package/dist/domains/run/handlers/executionHandler.js +143 -79
- package/dist/domains/run/routes/agents.js +1 -1
- package/dist/domains/run/routes/chat.js +47 -1
- package/dist/domains/run/routes/chatDataStream.js +107 -14
- package/dist/domains/run/routes/webhooks.js +40 -348
- package/dist/domains/run/services/AgentSession.d.ts +3 -0
- package/dist/domains/run/services/AgentSession.js +14 -1
- package/dist/domains/run/services/ToolApprovalUiBus.d.ts +28 -0
- package/dist/domains/run/services/ToolApprovalUiBus.js +44 -0
- package/dist/domains/run/services/TriggerService.d.ts +31 -0
- package/dist/domains/run/services/TriggerService.js +545 -0
- package/dist/domains/run/tools/NativeSandboxExecutor.d.ts +3 -2
- package/dist/domains/run/tools/NativeSandboxExecutor.js +76 -48
- package/dist/domains/run/tools/SandboxExecutorFactory.d.ts +11 -1
- package/dist/domains/run/tools/SandboxExecutorFactory.js +27 -3
- package/dist/domains/run/tools/VercelSandboxExecutor.d.ts +3 -11
- package/dist/domains/run/tools/VercelSandboxExecutor.js +137 -127
- package/dist/domains/run/tools/sandbox-utils.js +1 -1
- package/dist/domains/run/types/executionContext.js +3 -1
- package/dist/domains/run/utils/stream-helpers.d.ts +134 -0
- package/dist/domains/run/utils/stream-helpers.js +182 -0
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/env.d.ts +12 -2
- package/dist/env.js +37 -32
- package/dist/factory.d.ts +31 -31
- package/dist/factory.js +4 -10
- package/dist/index.d.ts +30 -29
- package/dist/index.js +3 -5
- package/dist/middleware/branchScopedDb.d.ts +1 -1
- package/dist/middleware/cors.js +1 -1
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +4 -20
- package/dist/middleware/projectAccess.js +7 -49
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/ref.d.ts +1 -1
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/requirePermission.js +1 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/sessionAuth.js +1 -2
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tenantAccess.js +4 -4
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/openapi.d.ts +36 -1
- package/dist/openapi.js +40 -95
- package/dist/routes/healthChecks.d.ts +10 -0
- package/dist/routes/healthChecks.js +75 -0
- package/dist/types/app.d.ts +2 -0
- package/dist/types/runExecutionContext.js +3 -1
- package/dist/utils/healthChecks.d.ts +8 -0
- package/dist/utils/healthChecks.js +38 -0
- package/dist/utils/signozHelpers.d.ts +2 -2
- package/dist/utils/signozHelpers.js +15 -3
- package/package.json +8 -9
- package/dist/domains/evals/services/startEvaluation.d.ts +0 -19
- package/dist/domains/evals/services/startEvaluation.js +0 -18
- package/dist/domains/index.d.ts +0 -4
- package/dist/domains/index.js +0 -5
- package/dist/domains/manage/routes/agentToolRelations.js +0 -289
- package/dist/domains/run/agents/ModelFactory.d.ts +0 -63
- package/dist/domains/run/agents/ModelFactory.js +0 -194
- package/dist/domains/run/data/agent.d.ts +0 -7
- package/dist/domains/run/data/agent.js +0 -67
- package/dist/domains/run/services/evaluationRunConfigMatcher.d.ts +0 -4
- package/dist/domains/run/services/evaluationRunConfigMatcher.js +0 -7
- package/dist/domains/run/utils/cleanup.d.ts +0 -21
- package/dist/domains/run/utils/cleanup.js +0 -59
- package/dist/initialization.d.ts +0 -6
- package/dist/initialization.js +0 -65
- package/dist/utils/tempApiKeys.d.ts +0 -17
- package/dist/utils/tempApiKeys.js +0 -26
- package/dist/utils/workflowApiHelpers.d.ts +0 -1
- package/dist/utils/workflowApiHelpers.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
2
|
+
import { env } from "../../../env.js";
|
|
2
3
|
import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
3
4
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
4
5
|
import { AGENT_EXECUTION_MAX_GENERATION_STEPS, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS } from "../constants/execution-limits/index.js";
|
|
@@ -15,6 +16,7 @@ import { IncrementalStreamParser } from "../services/IncrementalStreamParser.js"
|
|
|
15
16
|
import { MidGenerationCompressor } from "../services/MidGenerationCompressor.js";
|
|
16
17
|
import { pendingToolApprovalManager } from "../services/PendingToolApprovalManager.js";
|
|
17
18
|
import { ResponseFormatter } from "../services/ResponseFormatter.js";
|
|
19
|
+
import { toolApprovalUiBus } from "../services/ToolApprovalUiBus.js";
|
|
18
20
|
import { generateToolId } from "../utils/agent-operations.js";
|
|
19
21
|
import { jsonSchemaToZod } from "../utils/data-component-schema.js";
|
|
20
22
|
import { ArtifactCreateSchema, ArtifactReferenceSchema } from "../utils/artifact-component-schema.js";
|
|
@@ -25,7 +27,7 @@ import { SystemPromptBuilder } from "./SystemPromptBuilder.js";
|
|
|
25
27
|
import { Phase1Config, V1_BREAKDOWN_SCHEMA } from "./versions/v1/Phase1Config.js";
|
|
26
28
|
import { Phase2Config } from "./versions/v1/Phase2Config.js";
|
|
27
29
|
import { z } from "@hono/zod-openapi";
|
|
28
|
-
import { CredentialStuffer, JsonTransformer, MCPServerType, MCPTransportType, McpClient, ModelFactory, TemplateEngine, createMessage, generateId, getFunctionToolsForSubAgent, getLedgerArtifacts, listTaskIdsByContextId, parseEmbeddedJson, withRef } from "@inkeep/agents-core";
|
|
30
|
+
import { CredentialStuffer, JsonTransformer, MCPServerType, MCPTransportType, McpClient, ModelFactory, TemplateEngine, buildComposioMCPUrl, createMessage, generateId, getFunctionToolsForSubAgent, getLedgerArtifacts, isGithubWorkAppTool, listTaskIdsByContextId, parseEmbeddedJson, withRef } from "@inkeep/agents-core";
|
|
29
31
|
import { Output, generateText, streamText, tool } from "ai";
|
|
30
32
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
31
33
|
|
|
@@ -66,6 +68,7 @@ var Agent = class {
|
|
|
66
68
|
mcpConnectionLocks = /* @__PURE__ */ new Map();
|
|
67
69
|
currentCompressor = null;
|
|
68
70
|
executionContext;
|
|
71
|
+
functionToolRelationshipIdByName = /* @__PURE__ */ new Map();
|
|
69
72
|
constructor(config, executionContext, credentialStoreRegistry) {
|
|
70
73
|
this.artifactComponents = config.artifactComponents || [];
|
|
71
74
|
this.executionContext = executionContext;
|
|
@@ -135,6 +138,7 @@ var Agent = class {
|
|
|
135
138
|
if (tool$1.config.mcp.activeTools?.includes(toolName)) return true;
|
|
136
139
|
return tool$1.name === toolName;
|
|
137
140
|
}))?.relationshipId;
|
|
141
|
+
if (toolType === "tool") return this.functionToolRelationshipIdByName.get(toolName);
|
|
138
142
|
if (toolType === "delegation") return this.config.delegateRelations.find((relation) => this.#createRelationToolName("delegate", relation.config.id) === toolName)?.config.relationId;
|
|
139
143
|
}
|
|
140
144
|
/**
|
|
@@ -221,6 +225,12 @@ var Agent = class {
|
|
|
221
225
|
execute: async (args, context$1) => {
|
|
222
226
|
const startTime = Date.now();
|
|
223
227
|
const toolCallId = context$1?.toolCallId || generateToolId();
|
|
228
|
+
const streamHelper = this.getStreamingHelper();
|
|
229
|
+
const chunkString = (s, size = 16) => {
|
|
230
|
+
const out = [];
|
|
231
|
+
for (let i = 0; i < s.length; i += size) out.push(s.slice(i, i + size));
|
|
232
|
+
return out;
|
|
233
|
+
};
|
|
224
234
|
const activeSpan = trace.getActiveSpan();
|
|
225
235
|
if (activeSpan) {
|
|
226
236
|
const attributes = {
|
|
@@ -235,14 +245,32 @@ var Agent = class {
|
|
|
235
245
|
if (options?.mcpServerName) attributes["ai.toolCall.mcpServerName"] = options.mcpServerName;
|
|
236
246
|
activeSpan.setAttributes(attributes);
|
|
237
247
|
}
|
|
238
|
-
const
|
|
248
|
+
const isInternalToolForUi = toolName.includes("save_tool_result") || toolName.includes("thinking_complete") || toolName.startsWith("transfer_to_") || toolName.startsWith("delegate_to_");
|
|
239
249
|
const needsApproval = options?.needsApproval || false;
|
|
240
|
-
if (streamRequestId && !
|
|
250
|
+
if (streamRequestId && streamHelper && !isInternalToolForUi) {
|
|
251
|
+
const inputText = JSON.stringify(args ?? {});
|
|
252
|
+
await streamHelper.writeToolInputStart({
|
|
253
|
+
toolCallId,
|
|
254
|
+
toolName
|
|
255
|
+
});
|
|
256
|
+
for (const part of chunkString(inputText, 16)) await streamHelper.writeToolInputDelta({
|
|
257
|
+
toolCallId,
|
|
258
|
+
inputTextDelta: part
|
|
259
|
+
});
|
|
260
|
+
await streamHelper.writeToolInputAvailable({
|
|
261
|
+
toolCallId,
|
|
262
|
+
toolName,
|
|
263
|
+
input: args ?? {},
|
|
264
|
+
providerMetadata: context$1?.providerMetadata
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
if (streamRequestId && !isInternalToolForUi) {
|
|
241
268
|
const toolCallData = {
|
|
242
269
|
toolName,
|
|
243
270
|
input: args,
|
|
244
271
|
toolCallId,
|
|
245
|
-
relationshipId
|
|
272
|
+
relationshipId,
|
|
273
|
+
inDelegatedAgent: this.isDelegatedAgent
|
|
246
274
|
};
|
|
247
275
|
if (needsApproval) {
|
|
248
276
|
toolCallData.needsApproval = true;
|
|
@@ -254,7 +282,7 @@ var Agent = class {
|
|
|
254
282
|
const result = await originalExecute(args, context$1);
|
|
255
283
|
const duration = Date.now() - startTime;
|
|
256
284
|
const toolResultConversationId = this.getToolResultConversationId();
|
|
257
|
-
if (streamRequestId && !
|
|
285
|
+
if (streamRequestId && !isInternalToolForUi && toolResultConversationId) try {
|
|
258
286
|
const messagePayload = {
|
|
259
287
|
id: generateId(),
|
|
260
288
|
tenantId: this.config.tenantId,
|
|
@@ -282,26 +310,38 @@ var Agent = class {
|
|
|
282
310
|
conversationId: toolResultConversationId
|
|
283
311
|
}, "Failed to store tool result in conversation history");
|
|
284
312
|
}
|
|
285
|
-
if (streamRequestId && !
|
|
313
|
+
if (streamRequestId && !isInternalToolForUi) agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
|
|
286
314
|
toolName,
|
|
287
315
|
output: result,
|
|
288
316
|
toolCallId,
|
|
289
317
|
duration,
|
|
290
318
|
relationshipId,
|
|
291
|
-
needsApproval
|
|
319
|
+
needsApproval,
|
|
320
|
+
inDelegatedAgent: this.isDelegatedAgent
|
|
321
|
+
});
|
|
322
|
+
const isDeniedResult = !!result && typeof result === "object" && "__inkeepToolDenied" in result && result.__inkeepToolDenied === true;
|
|
323
|
+
if (streamRequestId && streamHelper && !isInternalToolForUi) if (isDeniedResult) await streamHelper.writeToolOutputDenied({ toolCallId });
|
|
324
|
+
else await streamHelper.writeToolOutputAvailable({
|
|
325
|
+
toolCallId,
|
|
326
|
+
output: result
|
|
292
327
|
});
|
|
293
328
|
return result;
|
|
294
329
|
} catch (error) {
|
|
295
330
|
const duration = Date.now() - startTime;
|
|
296
331
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
297
|
-
if (streamRequestId && !
|
|
332
|
+
if (streamRequestId && !isInternalToolForUi) agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
|
|
298
333
|
toolName,
|
|
299
334
|
output: null,
|
|
300
335
|
toolCallId,
|
|
301
336
|
duration,
|
|
302
337
|
error: errorMessage,
|
|
303
338
|
relationshipId,
|
|
304
|
-
needsApproval
|
|
339
|
+
needsApproval,
|
|
340
|
+
inDelegatedAgent: this.isDelegatedAgent
|
|
341
|
+
});
|
|
342
|
+
if (streamRequestId && streamHelper && !isInternalToolForUi) await streamHelper.writeToolOutputError({
|
|
343
|
+
toolCallId,
|
|
344
|
+
errorText: errorMessage
|
|
305
345
|
});
|
|
306
346
|
throw error;
|
|
307
347
|
}
|
|
@@ -372,7 +412,7 @@ var Agent = class {
|
|
|
372
412
|
const sessionWrappedTool = tool({
|
|
373
413
|
description: originalTool.description,
|
|
374
414
|
inputSchema: originalTool.inputSchema,
|
|
375
|
-
execute: async (args, { toolCallId }) => {
|
|
415
|
+
execute: async (args, { toolCallId, providerMetadata }) => {
|
|
376
416
|
let processedArgs;
|
|
377
417
|
try {
|
|
378
418
|
processedArgs = parseEmbeddedJson(args);
|
|
@@ -410,22 +450,52 @@ var Agent = class {
|
|
|
410
450
|
requestSpan.setStatus({ code: SpanStatusCode.OK });
|
|
411
451
|
requestSpan.end();
|
|
412
452
|
});
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
"subAgent.id": this.config.id,
|
|
418
|
-
"subAgent.name": this.config.name
|
|
419
|
-
} }, (denialSpan) => {
|
|
420
|
-
logger.info({
|
|
421
|
-
toolName,
|
|
422
|
-
toolCallId,
|
|
423
|
-
reason: approvalResult.reason
|
|
424
|
-
}, "Tool execution denied by user");
|
|
425
|
-
denialSpan.setStatus({ code: SpanStatusCode.OK });
|
|
426
|
-
denialSpan.end();
|
|
427
|
-
return `User denied approval to run this tool: ${approvalResult.reason}`;
|
|
453
|
+
const streamHelper = this.getStreamingHelper();
|
|
454
|
+
if (streamHelper) await streamHelper.writeToolApprovalRequest({
|
|
455
|
+
approvalId: `aitxt-${toolCallId}`,
|
|
456
|
+
toolCallId
|
|
428
457
|
});
|
|
458
|
+
else if (this.isDelegatedAgent) {
|
|
459
|
+
const streamRequestId$1 = this.getStreamRequestId();
|
|
460
|
+
if (streamRequestId$1) await toolApprovalUiBus.publish(streamRequestId$1, {
|
|
461
|
+
type: "approval-needed",
|
|
462
|
+
toolCallId,
|
|
463
|
+
toolName,
|
|
464
|
+
input: finalArgs,
|
|
465
|
+
providerMetadata,
|
|
466
|
+
approvalId: `aitxt-${toolCallId}`
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
const approvalResult = await pendingToolApprovalManager.waitForApproval(toolCallId, toolName, args, this.conversationId || "unknown", this.config.id);
|
|
470
|
+
if (!approvalResult.approved) {
|
|
471
|
+
if (!streamHelper && this.isDelegatedAgent) {
|
|
472
|
+
const streamRequestId$1 = this.getStreamRequestId();
|
|
473
|
+
if (streamRequestId$1) await toolApprovalUiBus.publish(streamRequestId$1, {
|
|
474
|
+
type: "approval-resolved",
|
|
475
|
+
toolCallId,
|
|
476
|
+
approved: false
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
return tracer.startActiveSpan("tool.approval_denied", { attributes: {
|
|
480
|
+
"tool.name": toolName,
|
|
481
|
+
"tool.callId": toolCallId,
|
|
482
|
+
"subAgent.id": this.config.id,
|
|
483
|
+
"subAgent.name": this.config.name
|
|
484
|
+
} }, (denialSpan) => {
|
|
485
|
+
logger.info({
|
|
486
|
+
toolName,
|
|
487
|
+
toolCallId,
|
|
488
|
+
reason: approvalResult.reason
|
|
489
|
+
}, "Tool execution denied by user");
|
|
490
|
+
denialSpan.setStatus({ code: SpanStatusCode.OK });
|
|
491
|
+
denialSpan.end();
|
|
492
|
+
return {
|
|
493
|
+
__inkeepToolDenied: true,
|
|
494
|
+
toolCallId,
|
|
495
|
+
reason: approvalResult.reason
|
|
496
|
+
};
|
|
497
|
+
});
|
|
498
|
+
}
|
|
429
499
|
tracer.startActiveSpan("tool.approval_approved", { attributes: {
|
|
430
500
|
"tool.name": toolName,
|
|
431
501
|
"tool.callId": toolCallId,
|
|
@@ -439,6 +509,14 @@ var Agent = class {
|
|
|
439
509
|
approvedSpan.setStatus({ code: SpanStatusCode.OK });
|
|
440
510
|
approvedSpan.end();
|
|
441
511
|
});
|
|
512
|
+
if (!streamHelper && this.isDelegatedAgent) {
|
|
513
|
+
const streamRequestId$1 = this.getStreamRequestId();
|
|
514
|
+
if (streamRequestId$1) await toolApprovalUiBus.publish(streamRequestId$1, {
|
|
515
|
+
type: "approval-resolved",
|
|
516
|
+
toolCallId,
|
|
517
|
+
approved: true
|
|
518
|
+
});
|
|
519
|
+
}
|
|
442
520
|
}
|
|
443
521
|
logger.debug({
|
|
444
522
|
toolName,
|
|
@@ -475,7 +553,8 @@ var Agent = class {
|
|
|
475
553
|
toolCallId,
|
|
476
554
|
errorMessage,
|
|
477
555
|
relationshipId
|
|
478
|
-
}
|
|
556
|
+
},
|
|
557
|
+
relationshipId
|
|
479
558
|
});
|
|
480
559
|
}
|
|
481
560
|
const activeSpan = trace.getActiveSpan();
|
|
@@ -498,10 +577,7 @@ var Agent = class {
|
|
|
498
577
|
result: enhancedResult,
|
|
499
578
|
timestamp: Date.now()
|
|
500
579
|
});
|
|
501
|
-
return
|
|
502
|
-
result: enhancedResult,
|
|
503
|
-
toolCallId
|
|
504
|
-
};
|
|
580
|
+
return enhancedResult;
|
|
505
581
|
} catch (error) {
|
|
506
582
|
logger.error({
|
|
507
583
|
toolName,
|
|
@@ -606,12 +682,12 @@ var Agent = class {
|
|
|
606
682
|
headers: agentToolRelationHeaders
|
|
607
683
|
};
|
|
608
684
|
}
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
685
|
+
if (isGithubWorkAppTool(tool$1)) serverConfig.headers = {
|
|
686
|
+
...serverConfig.headers,
|
|
687
|
+
"x-inkeep-tool-id": tool$1.id,
|
|
688
|
+
Authorization: `Bearer ${env.GITHUB_MCP_API_KEY}`
|
|
689
|
+
};
|
|
690
|
+
if (serverConfig.url) serverConfig.url = buildComposioMCPUrl(serverConfig.url.toString(), this.config.tenantId, this.config.projectId, isUserScoped ? "user" : "project", userId);
|
|
615
691
|
if (this.config.forwardedHeaders && Object.keys(this.config.forwardedHeaders).length > 0) serverConfig.headers = {
|
|
616
692
|
...serverConfig.headers,
|
|
617
693
|
...this.config.forwardedHeaders
|
|
@@ -670,6 +746,7 @@ var Agent = class {
|
|
|
670
746
|
"project.id": this.config.projectId || "unknown"
|
|
671
747
|
} }, (span) => {
|
|
672
748
|
setSpanWithError$1(span, /* @__PURE__ */ new Error(`0 effective tools available for ${tool$1.name}`));
|
|
749
|
+
const relationshipId = this.#getRelationshipIdForTool(tool$1.name, "mcp");
|
|
673
750
|
agentSessionManager.recordEvent(streamRequestId, "error", this.config.id, {
|
|
674
751
|
message: `MCP server has 0 effective tools. Double check the selected tools in your graph and the active tools in the MCP server configuration.`,
|
|
675
752
|
code: "no_tools_available",
|
|
@@ -678,7 +755,8 @@ var Agent = class {
|
|
|
678
755
|
toolName: tool$1.name,
|
|
679
756
|
serverUrl: tool$1.config.type === "mcp" ? tool$1.config.mcp.server.url : "unknown",
|
|
680
757
|
operation: "mcp_tool_discovery"
|
|
681
|
-
}
|
|
758
|
+
},
|
|
759
|
+
relationshipId
|
|
682
760
|
});
|
|
683
761
|
span.end();
|
|
684
762
|
});
|
|
@@ -727,8 +805,11 @@ var Agent = class {
|
|
|
727
805
|
});
|
|
728
806
|
})).data ?? [];
|
|
729
807
|
if (functionToolsData.length === 0) return functionTools;
|
|
808
|
+
this.functionToolRelationshipIdByName = new Map(functionToolsData.flatMap((t) => {
|
|
809
|
+
return t.relationshipId ? [[t.name, t.relationshipId]] : [];
|
|
810
|
+
}));
|
|
730
811
|
const { SandboxExecutorFactory } = await import("../tools/SandboxExecutorFactory.js");
|
|
731
|
-
const sandboxExecutor = SandboxExecutorFactory.
|
|
812
|
+
const sandboxExecutor = sessionId ? SandboxExecutorFactory.getForSession(sessionId) : new SandboxExecutorFactory();
|
|
732
813
|
for (const functionToolDef of functionToolsData) {
|
|
733
814
|
const functionId = functionToolDef.functionId;
|
|
734
815
|
if (!functionId) {
|
|
@@ -744,10 +825,12 @@ var Agent = class {
|
|
|
744
825
|
continue;
|
|
745
826
|
}
|
|
746
827
|
const zodSchema = jsonSchemaToZod(functionData.inputSchema);
|
|
828
|
+
const toolPolicies = functionToolDef.toolPolicies;
|
|
829
|
+
const needsApproval = !!toolPolicies?.["*"]?.needsApproval || !!toolPolicies?.[functionToolDef.name]?.needsApproval;
|
|
747
830
|
const aiTool = tool({
|
|
748
831
|
description: functionToolDef.description || functionToolDef.name,
|
|
749
832
|
inputSchema: zodSchema,
|
|
750
|
-
execute: async (args, { toolCallId }) => {
|
|
833
|
+
execute: async (args, { toolCallId, providerMetadata }) => {
|
|
751
834
|
let processedArgs;
|
|
752
835
|
try {
|
|
753
836
|
processedArgs = parseEmbeddedJson(args);
|
|
@@ -764,6 +847,95 @@ var Agent = class {
|
|
|
764
847
|
processedArgs = args;
|
|
765
848
|
}
|
|
766
849
|
const finalArgs = processedArgs;
|
|
850
|
+
if (needsApproval) {
|
|
851
|
+
logger.info({
|
|
852
|
+
toolName: functionToolDef.name,
|
|
853
|
+
toolCallId,
|
|
854
|
+
args: finalArgs
|
|
855
|
+
}, "Function tool requires approval - waiting for user response");
|
|
856
|
+
const currentSpan = trace.getActiveSpan();
|
|
857
|
+
if (currentSpan) currentSpan.addEvent("tool.approval.requested", {
|
|
858
|
+
"tool.name": functionToolDef.name,
|
|
859
|
+
"tool.callId": toolCallId,
|
|
860
|
+
"subAgent.id": this.config.id
|
|
861
|
+
});
|
|
862
|
+
tracer.startActiveSpan("tool.approval_requested", { attributes: {
|
|
863
|
+
"tool.name": functionToolDef.name,
|
|
864
|
+
"tool.callId": toolCallId,
|
|
865
|
+
"subAgent.id": this.config.id,
|
|
866
|
+
"subAgent.name": this.config.name
|
|
867
|
+
} }, (requestSpan) => {
|
|
868
|
+
requestSpan.setStatus({ code: SpanStatusCode.OK });
|
|
869
|
+
requestSpan.end();
|
|
870
|
+
});
|
|
871
|
+
const streamHelper = this.getStreamingHelper();
|
|
872
|
+
if (streamHelper) await streamHelper.writeToolApprovalRequest({
|
|
873
|
+
approvalId: `aitxt-${toolCallId}`,
|
|
874
|
+
toolCallId
|
|
875
|
+
});
|
|
876
|
+
else if (this.isDelegatedAgent) {
|
|
877
|
+
const streamRequestId$1 = this.getStreamRequestId();
|
|
878
|
+
if (streamRequestId$1) await toolApprovalUiBus.publish(streamRequestId$1, {
|
|
879
|
+
type: "approval-needed",
|
|
880
|
+
toolCallId,
|
|
881
|
+
toolName: functionToolDef.name,
|
|
882
|
+
input: finalArgs,
|
|
883
|
+
providerMetadata,
|
|
884
|
+
approvalId: `aitxt-${toolCallId}`
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
const approvalResult = await pendingToolApprovalManager.waitForApproval(toolCallId, functionToolDef.name, args, this.conversationId || "unknown", this.config.id);
|
|
888
|
+
if (!approvalResult.approved) {
|
|
889
|
+
if (!streamHelper && this.isDelegatedAgent) {
|
|
890
|
+
const streamRequestId$1 = this.getStreamRequestId();
|
|
891
|
+
if (streamRequestId$1) await toolApprovalUiBus.publish(streamRequestId$1, {
|
|
892
|
+
type: "approval-resolved",
|
|
893
|
+
toolCallId,
|
|
894
|
+
approved: false
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
return tracer.startActiveSpan("tool.approval_denied", { attributes: {
|
|
898
|
+
"tool.name": functionToolDef.name,
|
|
899
|
+
"tool.callId": toolCallId,
|
|
900
|
+
"subAgent.id": this.config.id,
|
|
901
|
+
"subAgent.name": this.config.name
|
|
902
|
+
} }, (denialSpan) => {
|
|
903
|
+
logger.info({
|
|
904
|
+
toolName: functionToolDef.name,
|
|
905
|
+
toolCallId,
|
|
906
|
+
reason: approvalResult.reason
|
|
907
|
+
}, "Function tool execution denied by user");
|
|
908
|
+
denialSpan.setStatus({ code: SpanStatusCode.OK });
|
|
909
|
+
denialSpan.end();
|
|
910
|
+
return {
|
|
911
|
+
__inkeepToolDenied: true,
|
|
912
|
+
toolCallId,
|
|
913
|
+
reason: approvalResult.reason
|
|
914
|
+
};
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
tracer.startActiveSpan("tool.approval_approved", { attributes: {
|
|
918
|
+
"tool.name": functionToolDef.name,
|
|
919
|
+
"tool.callId": toolCallId,
|
|
920
|
+
"subAgent.id": this.config.id,
|
|
921
|
+
"subAgent.name": this.config.name
|
|
922
|
+
} }, (approvedSpan) => {
|
|
923
|
+
logger.info({
|
|
924
|
+
toolName: functionToolDef.name,
|
|
925
|
+
toolCallId
|
|
926
|
+
}, "Function tool approved, continuing with execution");
|
|
927
|
+
approvedSpan.setStatus({ code: SpanStatusCode.OK });
|
|
928
|
+
approvedSpan.end();
|
|
929
|
+
});
|
|
930
|
+
if (!streamHelper && this.isDelegatedAgent) {
|
|
931
|
+
const streamRequestId$1 = this.getStreamRequestId();
|
|
932
|
+
if (streamRequestId$1) await toolApprovalUiBus.publish(streamRequestId$1, {
|
|
933
|
+
type: "approval-resolved",
|
|
934
|
+
toolCallId,
|
|
935
|
+
approved: true
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
}
|
|
767
939
|
logger.debug({
|
|
768
940
|
toolName: functionToolDef.name,
|
|
769
941
|
toolCallId,
|
|
@@ -790,10 +962,7 @@ var Agent = class {
|
|
|
790
962
|
result,
|
|
791
963
|
timestamp: Date.now()
|
|
792
964
|
});
|
|
793
|
-
return
|
|
794
|
-
result,
|
|
795
|
-
toolCallId
|
|
796
|
-
};
|
|
965
|
+
return result;
|
|
797
966
|
} catch (error) {
|
|
798
967
|
logger.error({
|
|
799
968
|
toolName: functionToolDef.name,
|
|
@@ -804,7 +973,7 @@ var Agent = class {
|
|
|
804
973
|
}
|
|
805
974
|
}
|
|
806
975
|
});
|
|
807
|
-
functionTools[functionToolDef.name] = this.wrapToolWithStreaming(functionToolDef.name, aiTool, streamRequestId || "", "tool");
|
|
976
|
+
functionTools[functionToolDef.name] = this.wrapToolWithStreaming(functionToolDef.name, aiTool, streamRequestId || "", "tool", { needsApproval });
|
|
808
977
|
}
|
|
809
978
|
} catch (error) {
|
|
810
979
|
logger.error({ error }, "Failed to load function tools from database");
|
|
@@ -1817,7 +1986,28 @@ ${typeof cleanResult === "string" ? cleanResult : JSON.stringify(cleanResult, nu
|
|
|
1817
1986
|
if (includeThinkingComplete && hasThinkingComplete && "toolResults" in currentStep && currentStep.toolResults) return true;
|
|
1818
1987
|
}
|
|
1819
1988
|
}
|
|
1820
|
-
|
|
1989
|
+
const maxSteps = this.getMaxGenerationSteps();
|
|
1990
|
+
if (steps.length >= maxSteps) {
|
|
1991
|
+
logger.warn({
|
|
1992
|
+
subAgentId: this.config.id,
|
|
1993
|
+
agentId: this.config.agentId,
|
|
1994
|
+
stepsCompleted: steps.length,
|
|
1995
|
+
maxSteps,
|
|
1996
|
+
conversationId: this.conversationId
|
|
1997
|
+
}, "Sub-agent reached maximum generation steps limit");
|
|
1998
|
+
tracer.startActiveSpan("agent.max_steps_reached", { attributes: {
|
|
1999
|
+
"agent.max_steps_reached": true,
|
|
2000
|
+
"agent.steps_completed": steps.length,
|
|
2001
|
+
"agent.max_steps": maxSteps,
|
|
2002
|
+
"agent.id": this.config.agentId,
|
|
2003
|
+
"subAgent.id": this.config.id
|
|
2004
|
+
} }, (span) => {
|
|
2005
|
+
span.addEvent("max_generation_steps_reached", { message: `Sub-agent "${this.config.id}" reached maximum generation steps (${steps.length}/${maxSteps})` });
|
|
2006
|
+
span.end();
|
|
2007
|
+
});
|
|
2008
|
+
return true;
|
|
2009
|
+
}
|
|
2010
|
+
return false;
|
|
1821
2011
|
}
|
|
1822
2012
|
setupStreamParser(sessionId, contextId) {
|
|
1823
2013
|
const streamHelper = this.getStreamingHelper();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentConfig, DelegateRelation } from "./Agent.js";
|
|
2
2
|
import { InternalRelation } from "../utils/project.js";
|
|
3
|
-
import * as
|
|
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:
|
|
47
|
+
result: _inkeep_agents_core2.Message | _inkeep_agents_core2.Task;
|
|
48
48
|
}>;
|
|
49
49
|
/**
|
|
50
50
|
* Parameters for building a transfer relation config
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
declare const executionLimitsDefaults: {
|
|
7
7
|
readonly AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3;
|
|
8
|
-
readonly AGENT_EXECUTION_MAX_GENERATION_STEPS:
|
|
8
|
+
readonly AGENT_EXECUTION_MAX_GENERATION_STEPS: 50;
|
|
9
9
|
readonly LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 270000;
|
|
10
10
|
readonly LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 90000;
|
|
11
11
|
readonly LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 90000;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const executionLimitsDefaults = {
|
|
7
7
|
AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3,
|
|
8
|
-
AGENT_EXECUTION_MAX_GENERATION_STEPS:
|
|
8
|
+
AGENT_EXECUTION_MAX_GENERATION_STEPS: 50,
|
|
9
9
|
LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 27e4,
|
|
10
10
|
LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 9e4,
|
|
11
11
|
LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 9e4,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { executionLimitsDefaults } from "./defaults.js";
|
|
2
2
|
|
|
3
3
|
//#region src/domains/run/constants/execution-limits/index.d.ts
|
|
4
|
-
declare const AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3, AGENT_EXECUTION_MAX_GENERATION_STEPS:
|
|
4
|
+
declare const AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS: 3, AGENT_EXECUTION_MAX_GENERATION_STEPS: 50, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING: 270000, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING: 90000, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS: 90000, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS: 600000, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT: 30000, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT: 4, FUNCTION_TOOL_SANDBOX_POOL_TTL_MS: 300000, FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT: 50, FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES: 1048576, FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS: 30000, FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS: 60000, MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT: 60000, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS: 100, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS: 10000, DELEGATION_TOOL_BACKOFF_EXPONENT: 2, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS: 20000, A2A_BACKOFF_INITIAL_INTERVAL_MS: 500, A2A_BACKOFF_MAX_INTERVAL_MS: 60000, A2A_BACKOFF_EXPONENT: 1.5, A2A_BACKOFF_MAX_ELAPSED_TIME_MS: 30000, ARTIFACT_GENERATION_MAX_RETRIES: 3, ARTIFACT_SESSION_MAX_PENDING: 100, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES: 3, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS: 1000, ARTIFACT_GENERATION_BACKOFF_MAX_MS: 10000, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS: 300000, SESSION_CLEANUP_INTERVAL_MS: 60000, STATUS_UPDATE_DEFAULT_NUM_EVENTS: 1, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS: 2, STREAM_PARSER_MAX_SNAPSHOT_SIZE: 100, STREAM_PARSER_MAX_STREAMED_SIZE: 1000, STREAM_PARSER_MAX_COLLECTED_PARTS: 10000, STREAM_BUFFER_MAX_SIZE_BYTES: 5242880, STREAM_TEXT_GAP_THRESHOLD_MS: 2000, STREAM_MAX_LIFETIME_MS: 600000, CONVERSATION_HISTORY_DEFAULT_LIMIT: 50, CONVERSATION_ARTIFACTS_LIMIT: 12, COMPRESSION_HARD_LIMIT: 120000, COMPRESSION_SAFETY_BUFFER: 20000, COMPRESSION_ENABLED: true;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { A2A_BACKOFF_EXPONENT, A2A_BACKOFF_INITIAL_INTERVAL_MS, A2A_BACKOFF_MAX_ELAPSED_TIME_MS, A2A_BACKOFF_MAX_INTERVAL_MS, AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS, AGENT_EXECUTION_MAX_GENERATION_STEPS, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS, ARTIFACT_GENERATION_BACKOFF_MAX_MS, ARTIFACT_GENERATION_MAX_RETRIES, ARTIFACT_SESSION_MAX_PENDING, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES, COMPRESSION_ENABLED, COMPRESSION_HARD_LIMIT, COMPRESSION_SAFETY_BUFFER, CONVERSATION_ARTIFACTS_LIMIT, CONVERSATION_HISTORY_DEFAULT_LIMIT, DELEGATION_TOOL_BACKOFF_EXPONENT, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, FUNCTION_TOOL_SANDBOX_CLEANUP_INTERVAL_MS, FUNCTION_TOOL_SANDBOX_MAX_OUTPUT_SIZE_BYTES, FUNCTION_TOOL_SANDBOX_MAX_USE_COUNT, FUNCTION_TOOL_SANDBOX_POOL_TTL_MS, FUNCTION_TOOL_SANDBOX_QUEUE_WAIT_TIMEOUT_MS, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS, MCP_TOOL_REQUEST_TIMEOUT_MS_DEFAULT, SESSION_CLEANUP_INTERVAL_MS, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS, STATUS_UPDATE_DEFAULT_NUM_EVENTS, STREAM_BUFFER_MAX_SIZE_BYTES, STREAM_MAX_LIFETIME_MS, STREAM_PARSER_MAX_COLLECTED_PARTS, STREAM_PARSER_MAX_SNAPSHOT_SIZE, STREAM_PARSER_MAX_STREAMED_SIZE, STREAM_TEXT_GAP_THRESHOLD_MS, executionLimitsDefaults };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validationHelper } from "./validation.js";
|
|
2
2
|
import { CredentialStuffer, JsonTransformer, TemplateEngine, getLogger } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/run/context/ContextFetcher.ts
|
|
@@ -228,16 +228,17 @@ var ContextFetcher = class {
|
|
|
228
228
|
* Validate response against JSON Schema
|
|
229
229
|
*/
|
|
230
230
|
validateResponseWithJsonSchema(data, jsonSchema, definitionId) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
231
|
+
const validate = validationHelper(jsonSchema);
|
|
232
|
+
if (!validate(data)) {
|
|
233
|
+
const errors = validate.errors || [];
|
|
234
|
+
const formattedErrors = errors.map((e) => `${e.instancePath || "/"}: ${e.message}`).join("; ");
|
|
235
235
|
logger.error({
|
|
236
236
|
definitionId,
|
|
237
237
|
jsonSchema,
|
|
238
|
-
|
|
238
|
+
errors,
|
|
239
|
+
formattedErrors
|
|
239
240
|
}, "JSON Schema response validation failed");
|
|
240
|
-
throw new Error(`Response validation failed: ${
|
|
241
|
+
throw new Error(`Response validation failed: ${formattedErrors}`);
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
/**
|