@inkeep/agents-api 0.0.0-dev-20260128143522 → 0.0.0-dev-20260128215058
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 +5 -5
- package/dist/data/db/runDbClient.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/github/index.d.ts +3 -3
- package/dist/domains/github/routes/tokenExchange.d.ts +2 -2
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/evals/evaluationResults.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/handlers/executionHandler.js +143 -79
- package/dist/domains/run/services/TriggerService.js +24 -29
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/tracing.d.ts +3 -3
- package/package.json +4 -4
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"workflows": {
|
|
44
|
-
"src/domains/evals/workflow/functions/runDatasetItem.ts": {
|
|
45
|
-
"_runDatasetItemWorkflow": {
|
|
46
|
-
"workflowId": "workflow//src/domains/evals/workflow/functions/runDatasetItem.ts//_runDatasetItemWorkflow"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
44
|
"src/domains/evals/workflow/functions/evaluateConversation.ts": {
|
|
50
45
|
"_evaluateConversationWorkflow": {
|
|
51
46
|
"workflowId": "workflow//src/domains/evals/workflow/functions/evaluateConversation.ts//_evaluateConversationWorkflow"
|
|
52
47
|
}
|
|
48
|
+
},
|
|
49
|
+
"src/domains/evals/workflow/functions/runDatasetItem.ts": {
|
|
50
|
+
"_runDatasetItemWorkflow": {
|
|
51
|
+
"workflowId": "workflow//src/domains/evals/workflow/functions/runDatasetItem.ts//_runDatasetItemWorkflow"
|
|
52
|
+
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core0 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data/db/runDbClient.d.ts
|
|
4
|
-
declare const runDbClient:
|
|
4
|
+
declare const runDbClient: _inkeep_agents_core0.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
|
|
2
|
+
import * as hono8 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono8.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
|
|
2
|
+
import * as hono6 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono6.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -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
|
|
6
|
+
import * as hono_types3 from "hono/types";
|
|
7
7
|
|
|
8
8
|
//#region src/domains/github/index.d.ts
|
|
9
|
-
declare function createGithubRoutes(): Hono<
|
|
10
|
-
declare const githubRoutes: Hono<
|
|
9
|
+
declare function createGithubRoutes(): Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
|
|
10
|
+
declare const githubRoutes: Hono<hono_types3.BlankEnv, hono_types3.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
|
|
2
|
+
import * as hono_types10 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/github/routes/tokenExchange.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types10.BlankEnv, hono_types10.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
|
|
2
|
+
import * as hono7 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
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
|
|
2
|
+
import * as hono18 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/evals/evaluationResults.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono18.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
|
|
2
|
+
import * as hono12 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono12.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
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<
|
|
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
|
|
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
|
-
},
|
|
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
|
|
2
|
+
import * as hono_types14 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/mcp/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types14.BlankEnv, hono_types14.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -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_core1 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_core1.Message | _inkeep_agents_core1.Task;
|
|
48
48
|
}>;
|
|
49
49
|
/**
|
|
50
50
|
* Parameters for building a transfer relation config
|
|
@@ -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
|
|
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
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
|
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
|
|
400
|
-
|
|
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:
|
|
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:
|
|
494
|
+
error: maxTransfersErrorMessage,
|
|
430
495
|
iterations
|
|
431
496
|
};
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
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
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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
|
};
|
|
@@ -320,35 +320,17 @@ async function dispatchExecution(params) {
|
|
|
320
320
|
invocationId,
|
|
321
321
|
conversationId
|
|
322
322
|
}, "Trigger invocation created");
|
|
323
|
-
const executionPromise = (
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
"message.content": userMessageText,
|
|
335
|
-
"message.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
336
|
-
"message.parts": JSON.stringify(messageParts)
|
|
337
|
-
}
|
|
338
|
-
}).end();
|
|
339
|
-
await flushBatchProcessor();
|
|
340
|
-
await executeAgentAsync({
|
|
341
|
-
tenantId,
|
|
342
|
-
projectId,
|
|
343
|
-
agentId,
|
|
344
|
-
triggerId,
|
|
345
|
-
invocationId,
|
|
346
|
-
conversationId,
|
|
347
|
-
userMessage: userMessageText,
|
|
348
|
-
messageParts,
|
|
349
|
-
resolvedRef
|
|
350
|
-
});
|
|
351
|
-
})();
|
|
323
|
+
const executionPromise = executeAgentAsync({
|
|
324
|
+
tenantId,
|
|
325
|
+
projectId,
|
|
326
|
+
agentId,
|
|
327
|
+
triggerId,
|
|
328
|
+
invocationId,
|
|
329
|
+
conversationId,
|
|
330
|
+
userMessage: userMessageText,
|
|
331
|
+
messageParts,
|
|
332
|
+
resolvedRef
|
|
333
|
+
});
|
|
352
334
|
if (waitUntil) waitUntil(executionPromise);
|
|
353
335
|
else executionPromise.catch((error) => {
|
|
354
336
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -396,6 +378,19 @@ async function executeAgentAsync(params) {
|
|
|
396
378
|
"invocation.type": "trigger"
|
|
397
379
|
}
|
|
398
380
|
}, ctxWithBaggage, async (span) => {
|
|
381
|
+
tracer.startSpan("trigger.message_received", { attributes: {
|
|
382
|
+
"tenant.id": tenantId,
|
|
383
|
+
"project.id": projectId,
|
|
384
|
+
"agent.id": agentId,
|
|
385
|
+
"trigger.id": triggerId,
|
|
386
|
+
"trigger.invocation.id": invocationId,
|
|
387
|
+
"conversation.id": conversationId,
|
|
388
|
+
"invocation.type": "trigger",
|
|
389
|
+
"message.content": userMessage,
|
|
390
|
+
"message.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
391
|
+
"message.parts": JSON.stringify(messageParts)
|
|
392
|
+
} }, context.active()).end();
|
|
393
|
+
await flushBatchProcessor();
|
|
399
394
|
logger.info({
|
|
400
395
|
tenantId,
|
|
401
396
|
projectId,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono1 from "hono";
|
|
2
2
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/evalsAuth.d.ts
|
|
@@ -7,7 +7,7 @@ import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
|
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: () =>
|
|
10
|
+
declare const evalApiKeyAuth: () => hono1.MiddlewareHandler<{
|
|
11
11
|
Variables: {
|
|
12
12
|
executionContext: BaseExecutionContext;
|
|
13
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono2 from "hono";
|
|
2
2
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
3
3
|
import { createAuth } from "@inkeep/agents-core/auth";
|
|
4
4
|
|
|
@@ -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: () =>
|
|
15
|
+
declare const manageApiKeyAuth: () => hono2.MiddlewareHandler<{
|
|
16
16
|
Variables: {
|
|
17
17
|
executionContext: BaseExecutionContext;
|
|
18
18
|
userId?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono16 from "hono";
|
|
2
2
|
import { BaseExecutionContext, ResolvedRef } from "@inkeep/agents-core";
|
|
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:
|
|
8
|
+
declare const projectConfigMiddleware: hono16.MiddlewareHandler<{
|
|
9
9
|
Variables: {
|
|
10
10
|
executionContext: BaseExecutionContext;
|
|
11
11
|
resolvedRef: ResolvedRef;
|
|
@@ -15,7 +15,7 @@ declare const projectConfigMiddleware: hono6.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) =>
|
|
18
|
+
declare const projectConfigMiddlewareExcept: (skipRouteCheck: (path: string) => boolean) => hono16.MiddlewareHandler<{
|
|
19
19
|
Variables: {
|
|
20
20
|
executionContext: BaseExecutionContext;
|
|
21
21
|
resolvedRef: ResolvedRef;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono9 from "hono";
|
|
2
2
|
import { BaseExecutionContext } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/runAuth.d.ts
|
|
5
|
-
declare const runApiKeyAuth: () =>
|
|
5
|
+
declare const runApiKeyAuth: () => hono9.MiddlewareHandler<{
|
|
6
6
|
Variables: {
|
|
7
7
|
executionContext: BaseExecutionContext;
|
|
8
8
|
};
|
|
@@ -11,7 +11,7 @@ declare const runApiKeyAuth: () => hono10.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) =>
|
|
14
|
+
declare const runApiKeyAuthExcept: (skipRouteCheck: (path: string) => boolean) => hono9.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: () =>
|
|
23
|
+
declare const runOptionalAuth: () => hono9.MiddlewareHandler<{
|
|
24
24
|
Variables: {
|
|
25
25
|
executionContext?: BaseExecutionContext;
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono14 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/sessionAuth.d.ts
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@ import * as hono1 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: () =>
|
|
10
|
+
declare const sessionAuth: () => hono14.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: () =>
|
|
15
|
+
declare const sessionContext: () => hono14.MiddlewareHandler<any, string, {}, Response>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { sessionAuth, sessionContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono3 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/middleware/tracing.d.ts
|
|
4
|
-
declare const otelBaggageMiddleware: () =>
|
|
5
|
-
declare const executionBaggageMiddleware: () =>
|
|
4
|
+
declare const otelBaggageMiddleware: () => hono3.MiddlewareHandler<any, string, {}, Response>;
|
|
5
|
+
declare const executionBaggageMiddleware: () => hono3.MiddlewareHandler<any, string, {}, Response>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { executionBaggageMiddleware, otelBaggageMiddleware };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260128215058",
|
|
4
4
|
"description": "Unified Inkeep Agents API - combines management, runtime, and evaluation capabilities",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -66,9 +66,9 @@
|
|
|
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-
|
|
70
|
-
"@inkeep/agents-manage-mcp": "^0.0.0-dev-
|
|
71
|
-
"@inkeep/agents-mcp": "^0.0.0-dev-
|
|
69
|
+
"@inkeep/agents-core": "^0.0.0-dev-20260128215058",
|
|
70
|
+
"@inkeep/agents-manage-mcp": "^0.0.0-dev-20260128215058",
|
|
71
|
+
"@inkeep/agents-mcp": "^0.0.0-dev-20260128215058"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@hono/zod-openapi": "^1.1.5",
|