@inkeep/agents-run-api 0.0.0-dev-20250913024156 → 0.0.0-dev-20250913032042
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/index.cjs +21 -12
- package/dist/index.js +21 -12
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -16,9 +16,9 @@ var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
|
16
16
|
var semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
17
17
|
var resources = require('@opentelemetry/resources');
|
|
18
18
|
var contextAsyncHooks = require('@opentelemetry/context-async-hooks');
|
|
19
|
-
var hono = require('hono');
|
|
20
19
|
var zodOpenapi = require('@hono/zod-openapi');
|
|
21
20
|
var api = require('@opentelemetry/api');
|
|
21
|
+
var hono = require('hono');
|
|
22
22
|
var cors = require('hono/cors');
|
|
23
23
|
var httpException = require('hono/http-exception');
|
|
24
24
|
var requestId = require('hono/request-id');
|
|
@@ -549,7 +549,7 @@ init_dbClient();
|
|
|
549
549
|
var logger2 = agentsCore.getLogger("a2aHandler");
|
|
550
550
|
async function a2aHandler(c, agent) {
|
|
551
551
|
try {
|
|
552
|
-
const rpcRequest =
|
|
552
|
+
const rpcRequest = c.get("requestBody");
|
|
553
553
|
if (rpcRequest.jsonrpc !== "2.0") {
|
|
554
554
|
return c.json({
|
|
555
555
|
jsonrpc: "2.0",
|
|
@@ -7975,7 +7975,7 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
7975
7975
|
},
|
|
7976
7976
|
"Extracted chat parameters from API key context"
|
|
7977
7977
|
);
|
|
7978
|
-
const body = c.
|
|
7978
|
+
const body = c.get("requestBody") || {};
|
|
7979
7979
|
const conversationId = body.conversationId || nanoid.nanoid();
|
|
7980
7980
|
const fullGraph = await agentsCore.getFullGraph(dbClient_default)({
|
|
7981
7981
|
scopes: { tenantId, projectId },
|
|
@@ -8188,7 +8188,7 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
8188
8188
|
try {
|
|
8189
8189
|
const executionContext = agentsCore.getRequestExecutionContext(c);
|
|
8190
8190
|
const { tenantId, projectId, graphId } = executionContext;
|
|
8191
|
-
const body =
|
|
8191
|
+
const body = c.get("requestBody") || {};
|
|
8192
8192
|
const conversationId = body.conversationId || nanoid.nanoid();
|
|
8193
8193
|
const activeSpan = api.trace.getActiveSpan();
|
|
8194
8194
|
if (activeSpan) {
|
|
@@ -8762,7 +8762,7 @@ app4.openapi(
|
|
|
8762
8762
|
return paramValidation.response;
|
|
8763
8763
|
}
|
|
8764
8764
|
const { executionContext } = paramValidation;
|
|
8765
|
-
const body =
|
|
8765
|
+
const body = c.get("requestBody") || {};
|
|
8766
8766
|
logger21.info({ body, bodyKeys: Object.keys(body || {}) }, "Parsed request body");
|
|
8767
8767
|
const isInitRequest = body.method === "initialize";
|
|
8768
8768
|
const { req, res } = fetchToNode.toReqRes(c.req.raw);
|
|
@@ -8839,6 +8839,17 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
8839
8839
|
c.set("credentialStores", credentialStores);
|
|
8840
8840
|
return next();
|
|
8841
8841
|
});
|
|
8842
|
+
app6.use("*", async (c, next) => {
|
|
8843
|
+
if (c.req.header("content-type")?.includes("application/json")) {
|
|
8844
|
+
try {
|
|
8845
|
+
const body = await c.req.json();
|
|
8846
|
+
c.set("requestBody", body);
|
|
8847
|
+
} catch (error) {
|
|
8848
|
+
logger22.debug({ error }, "Failed to parse JSON body, continuing without parsed body");
|
|
8849
|
+
}
|
|
8850
|
+
}
|
|
8851
|
+
return next();
|
|
8852
|
+
});
|
|
8842
8853
|
app6.use("*", async (c, next) => {
|
|
8843
8854
|
const reqId = c.get("requestId");
|
|
8844
8855
|
let bag = api.propagation.getBaggage(api.context.active());
|
|
@@ -8956,13 +8967,11 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
8956
8967
|
}
|
|
8957
8968
|
const { tenantId, projectId, graphId } = executionContext;
|
|
8958
8969
|
let conversationId;
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
} catch (_) {
|
|
8965
|
-
logger22.debug({}, "Conversation ID not found in JSON body");
|
|
8970
|
+
const requestBody = c.get("requestBody") || {};
|
|
8971
|
+
if (requestBody) {
|
|
8972
|
+
conversationId = requestBody.conversationId;
|
|
8973
|
+
if (!conversationId) {
|
|
8974
|
+
logger22.debug({}, "No conversation ID found in request body");
|
|
8966
8975
|
}
|
|
8967
8976
|
}
|
|
8968
8977
|
const entries = Object.fromEntries(
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,9 @@ import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
|
8
8
|
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
9
9
|
import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';
|
|
10
10
|
import { getLogger, getTracer, HeadersScopeSchema, getRequestExecutionContext, getAgentGraphWithDefaultAgent, contextValidationMiddleware, getFullGraph, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getAgentById, handleContextResolution, createMessage, commonGetErrorResponses, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, getAgentGraph, createTask, updateTask, updateConversation, handleApiError, setSpanWithError, TaskState, setActiveAgentForThread, getConversation, getRelatedAgentsForGraph, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, validateAndGetApiKey, getProject, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getContextConfigById, getFullGraphDefinition, TemplateEngine, graphHasArtifactComponents, MCPTransportType, getExternalAgent } from '@inkeep/agents-core';
|
|
11
|
-
import { Hono } from 'hono';
|
|
12
11
|
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
13
12
|
import { trace, propagation, context, SpanStatusCode } from '@opentelemetry/api';
|
|
13
|
+
import { Hono } from 'hono';
|
|
14
14
|
import { cors } from 'hono/cors';
|
|
15
15
|
import { HTTPException } from 'hono/http-exception';
|
|
16
16
|
import { requestId } from 'hono/request-id';
|
|
@@ -248,7 +248,7 @@ function setupOpenAPIRoutes(app6) {
|
|
|
248
248
|
var logger2 = getLogger("a2aHandler");
|
|
249
249
|
async function a2aHandler(c, agent) {
|
|
250
250
|
try {
|
|
251
|
-
const rpcRequest =
|
|
251
|
+
const rpcRequest = c.get("requestBody");
|
|
252
252
|
if (rpcRequest.jsonrpc !== "2.0") {
|
|
253
253
|
return c.json({
|
|
254
254
|
jsonrpc: "2.0",
|
|
@@ -7643,7 +7643,7 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
7643
7643
|
},
|
|
7644
7644
|
"Extracted chat parameters from API key context"
|
|
7645
7645
|
);
|
|
7646
|
-
const body = c.
|
|
7646
|
+
const body = c.get("requestBody") || {};
|
|
7647
7647
|
const conversationId = body.conversationId || nanoid();
|
|
7648
7648
|
const fullGraph = await getFullGraph(dbClient_default)({
|
|
7649
7649
|
scopes: { tenantId, projectId },
|
|
@@ -7853,7 +7853,7 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
7853
7853
|
try {
|
|
7854
7854
|
const executionContext = getRequestExecutionContext(c);
|
|
7855
7855
|
const { tenantId, projectId, graphId } = executionContext;
|
|
7856
|
-
const body =
|
|
7856
|
+
const body = c.get("requestBody") || {};
|
|
7857
7857
|
const conversationId = body.conversationId || nanoid();
|
|
7858
7858
|
const activeSpan = trace.getActiveSpan();
|
|
7859
7859
|
if (activeSpan) {
|
|
@@ -8424,7 +8424,7 @@ app4.openapi(
|
|
|
8424
8424
|
return paramValidation.response;
|
|
8425
8425
|
}
|
|
8426
8426
|
const { executionContext } = paramValidation;
|
|
8427
|
-
const body =
|
|
8427
|
+
const body = c.get("requestBody") || {};
|
|
8428
8428
|
logger21.info({ body, bodyKeys: Object.keys(body || {}) }, "Parsed request body");
|
|
8429
8429
|
const isInitRequest = body.method === "initialize";
|
|
8430
8430
|
const { req, res } = toReqRes(c.req.raw);
|
|
@@ -8501,6 +8501,17 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
8501
8501
|
c.set("credentialStores", credentialStores);
|
|
8502
8502
|
return next();
|
|
8503
8503
|
});
|
|
8504
|
+
app6.use("*", async (c, next) => {
|
|
8505
|
+
if (c.req.header("content-type")?.includes("application/json")) {
|
|
8506
|
+
try {
|
|
8507
|
+
const body = await c.req.json();
|
|
8508
|
+
c.set("requestBody", body);
|
|
8509
|
+
} catch (error) {
|
|
8510
|
+
logger22.debug({ error }, "Failed to parse JSON body, continuing without parsed body");
|
|
8511
|
+
}
|
|
8512
|
+
}
|
|
8513
|
+
return next();
|
|
8514
|
+
});
|
|
8504
8515
|
app6.use("*", async (c, next) => {
|
|
8505
8516
|
const reqId = c.get("requestId");
|
|
8506
8517
|
let bag = propagation.getBaggage(context.active());
|
|
@@ -8618,13 +8629,11 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
8618
8629
|
}
|
|
8619
8630
|
const { tenantId, projectId, graphId } = executionContext;
|
|
8620
8631
|
let conversationId;
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
} catch (_) {
|
|
8627
|
-
logger22.debug({}, "Conversation ID not found in JSON body");
|
|
8632
|
+
const requestBody = c.get("requestBody") || {};
|
|
8633
|
+
if (requestBody) {
|
|
8634
|
+
conversationId = requestBody.conversationId;
|
|
8635
|
+
if (!conversationId) {
|
|
8636
|
+
logger22.debug({}, "No conversation ID found in request body");
|
|
8628
8637
|
}
|
|
8629
8638
|
}
|
|
8630
8639
|
const entries = Object.fromEntries(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250913032042",
|
|
4
4
|
"description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"traverse": "^0.6.11",
|
|
43
43
|
"ts-pattern": "^5.7.1",
|
|
44
44
|
"zod": "^4.1.5",
|
|
45
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
45
|
+
"@inkeep/agents-core": "^0.0.0-dev-20250913032042"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@hono/vite-dev-server": "^0.20.1",
|