@inkeep/agents-run-api 0.0.0-dev-20250924191551 → 0.0.0-dev-20250924214135
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.
|
@@ -15,8 +15,7 @@ var envSchema = z.object({
|
|
|
15
15
|
NANGO_SECRET_KEY: z.string().optional(),
|
|
16
16
|
OPENAI_API_KEY: z.string().optional(),
|
|
17
17
|
ANTHROPIC_API_KEY: z.string(),
|
|
18
|
-
INKEEP_AGENTS_RUN_API_BYPASS_SECRET: z.string().optional()
|
|
19
|
-
OTEL_MAX_EXPORT_BATCH_SIZE: z.coerce.number().optional()
|
|
18
|
+
INKEEP_AGENTS_RUN_API_BYPASS_SECRET: z.string().optional()
|
|
20
19
|
});
|
|
21
20
|
var parseEnv = () => {
|
|
22
21
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createDefaultConversationHistoryConfig, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-
|
|
1
|
+
export { createDefaultConversationHistoryConfig, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-AFP4EIVB.js';
|
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var agentsCore = require('@inkeep/agents-core');
|
|
6
6
|
var z5 = require('zod');
|
|
7
7
|
var nanoid = require('nanoid');
|
|
8
|
+
var otel = require('@hono/otel');
|
|
9
|
+
var zodOpenapi = require('@hono/zod-openapi');
|
|
10
|
+
var api = require('@opentelemetry/api');
|
|
11
|
+
var hono = require('hono');
|
|
12
|
+
var cors = require('hono/cors');
|
|
13
|
+
var httpException = require('hono/http-exception');
|
|
14
|
+
var requestId = require('hono/request-id');
|
|
8
15
|
var autoInstrumentationsNode = require('@opentelemetry/auto-instrumentations-node');
|
|
9
16
|
var baggageSpanProcessor = require('@opentelemetry/baggage-span-processor');
|
|
10
17
|
var contextAsyncHooks = require('@opentelemetry/context-async-hooks');
|
|
@@ -14,13 +21,6 @@ var resources = require('@opentelemetry/resources');
|
|
|
14
21
|
var sdkNode = require('@opentelemetry/sdk-node');
|
|
15
22
|
var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
16
23
|
var semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
17
|
-
var otel = require('@hono/otel');
|
|
18
|
-
var zodOpenapi = require('@hono/zod-openapi');
|
|
19
|
-
var api = require('@opentelemetry/api');
|
|
20
|
-
var hono = require('hono');
|
|
21
|
-
var cors = require('hono/cors');
|
|
22
|
-
var httpException = require('hono/http-exception');
|
|
23
|
-
var requestId = require('hono/request-id');
|
|
24
24
|
var factory = require('hono/factory');
|
|
25
25
|
var swaggerUi = require('@hono/swagger-ui');
|
|
26
26
|
var streaming = require('hono/streaming');
|
|
@@ -70,8 +70,7 @@ var init_env = __esm({
|
|
|
70
70
|
NANGO_SECRET_KEY: z5.z.string().optional(),
|
|
71
71
|
OPENAI_API_KEY: z5.z.string().optional(),
|
|
72
72
|
ANTHROPIC_API_KEY: z5.z.string(),
|
|
73
|
-
INKEEP_AGENTS_RUN_API_BYPASS_SECRET: z5.z.string().optional()
|
|
74
|
-
OTEL_MAX_EXPORT_BATCH_SIZE: z5.z.coerce.number().optional()
|
|
73
|
+
INKEEP_AGENTS_RUN_API_BYPASS_SECRET: z5.z.string().optional()
|
|
75
74
|
});
|
|
76
75
|
parseEnv = () => {
|
|
77
76
|
try {
|
|
@@ -285,48 +284,48 @@ var init_conversations = __esm({
|
|
|
285
284
|
init_dbClient();
|
|
286
285
|
}
|
|
287
286
|
});
|
|
288
|
-
|
|
289
|
-
// src/instrumentation.ts
|
|
290
|
-
init_env();
|
|
291
|
-
var maxExportBatchSize = env.OTEL_MAX_EXPORT_BATCH_SIZE ?? (env.ENVIRONMENT === "development" ? 1 : 512);
|
|
292
287
|
var otlpExporter = new exporterTraceOtlpHttp.OTLPTraceExporter();
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
});
|
|
296
|
-
var resource = resources.resourceFromAttributes({
|
|
288
|
+
var defaultBatchProcessor = new sdkTraceBase.BatchSpanProcessor(otlpExporter);
|
|
289
|
+
var defaultResource = resources.resourceFromAttributes({
|
|
297
290
|
[semanticConventions.ATTR_SERVICE_NAME]: "inkeep-agents-run-api"
|
|
298
291
|
});
|
|
299
|
-
var
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
"@opentelemetry/instrumentation-http": {
|
|
309
|
-
enabled: true,
|
|
310
|
-
requestHook: (span, request) => {
|
|
311
|
-
const url = request?.url ?? request?.path;
|
|
312
|
-
if (!url) return;
|
|
313
|
-
const u = new URL(url, "http://localhost");
|
|
314
|
-
span.updateName(`${request?.method || "UNKNOWN"} ${u.pathname}`);
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
"@opentelemetry/instrumentation-undici": {
|
|
318
|
-
requestHook: (span) => {
|
|
319
|
-
const method = span.attributes?.["http.request.method"];
|
|
320
|
-
const host = span.attributes?.["server.address"];
|
|
321
|
-
const path = span.attributes?.["url.path"];
|
|
322
|
-
if (method && path)
|
|
323
|
-
span.updateName(host ? `${method} ${host}${path}` : `${method} ${path}`);
|
|
324
|
-
}
|
|
292
|
+
var defaultInstrumentations = [
|
|
293
|
+
autoInstrumentationsNode.getNodeAutoInstrumentations({
|
|
294
|
+
"@opentelemetry/instrumentation-http": {
|
|
295
|
+
enabled: true,
|
|
296
|
+
requestHook: (span, request) => {
|
|
297
|
+
const url = request?.url ?? request?.path;
|
|
298
|
+
if (!url) return;
|
|
299
|
+
const u = new URL(url, "http://localhost");
|
|
300
|
+
span.updateName(`${request?.method || "UNKNOWN"} ${u.pathname}`);
|
|
325
301
|
}
|
|
326
|
-
}
|
|
327
|
-
|
|
302
|
+
},
|
|
303
|
+
"@opentelemetry/instrumentation-undici": {
|
|
304
|
+
requestHook: (span) => {
|
|
305
|
+
const method = span.attributes?.["http.request.method"];
|
|
306
|
+
const host = span.attributes?.["server.address"];
|
|
307
|
+
const path = span.attributes?.["url.path"];
|
|
308
|
+
if (method && path)
|
|
309
|
+
span.updateName(host ? `${method} ${host}${path}` : `${method} ${path}`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
];
|
|
314
|
+
var defaultSpanProcessors = [
|
|
315
|
+
new baggageSpanProcessor.BaggageSpanProcessor(baggageSpanProcessor.ALLOW_ALL_BAGGAGE_KEYS),
|
|
316
|
+
defaultBatchProcessor
|
|
317
|
+
];
|
|
318
|
+
var defaultContextManager = new contextAsyncHooks.AsyncLocalStorageContextManager();
|
|
319
|
+
var defaultTextMapPropagator = new core.CompositePropagator({
|
|
320
|
+
propagators: [new core.W3CTraceContextPropagator(), new core.W3CBaggagePropagator()]
|
|
321
|
+
});
|
|
322
|
+
new sdkNode.NodeSDK({
|
|
323
|
+
resource: defaultResource,
|
|
324
|
+
contextManager: defaultContextManager,
|
|
325
|
+
textMapPropagator: defaultTextMapPropagator,
|
|
326
|
+
spanProcessors: defaultSpanProcessors,
|
|
327
|
+
instrumentations: defaultInstrumentations
|
|
328
328
|
});
|
|
329
|
-
sdk.start();
|
|
330
329
|
init_dbClient();
|
|
331
330
|
init_env();
|
|
332
331
|
|
|
@@ -9204,21 +9203,21 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
9204
9203
|
app6.route("/v1/mcp", mcp_default);
|
|
9205
9204
|
app6.route("/agents", agents_default);
|
|
9206
9205
|
setupOpenAPIRoutes(app6);
|
|
9207
|
-
app6.use("/tenants/*", async (
|
|
9206
|
+
app6.use("/tenants/*", async (_c, next) => {
|
|
9208
9207
|
await next();
|
|
9209
|
-
await
|
|
9208
|
+
await defaultBatchProcessor.forceFlush();
|
|
9210
9209
|
});
|
|
9211
|
-
app6.use("/agents/*", async (
|
|
9210
|
+
app6.use("/agents/*", async (_c, next) => {
|
|
9212
9211
|
await next();
|
|
9213
|
-
await
|
|
9212
|
+
await defaultBatchProcessor.forceFlush();
|
|
9214
9213
|
});
|
|
9215
|
-
app6.use("/v1/*", async (
|
|
9214
|
+
app6.use("/v1/*", async (_c, next) => {
|
|
9216
9215
|
await next();
|
|
9217
|
-
await
|
|
9216
|
+
await defaultBatchProcessor.forceFlush();
|
|
9218
9217
|
});
|
|
9219
|
-
app6.use("/api/*", async (
|
|
9218
|
+
app6.use("/api/*", async (_c, next) => {
|
|
9220
9219
|
await next();
|
|
9221
|
-
await
|
|
9220
|
+
await defaultBatchProcessor.forceFlush();
|
|
9222
9221
|
});
|
|
9223
9222
|
const baseApp = new hono.Hono();
|
|
9224
9223
|
baseApp.route("/", app6);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __publicField, dbClient_default, getFormattedConversationHistory, env, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-AFP4EIVB.js';
|
|
2
|
+
import { getLogger, getTracer, HeadersScopeSchema, getRequestExecutionContext, createApiError, getAgentGraphWithDefaultAgent, contextValidationMiddleware, getFullGraph, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getAgentById, handleContextResolution, createMessage, commonGetErrorResponses, loggerFactory, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, getAgentGraphById, createTask, updateTask, setSpanWithError, updateConversation, handleApiError, TaskState, setActiveAgentForThread, getConversation, getRelatedAgentsForGraph, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, validateAndGetApiKey, getProject, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getContextConfigById, getFullGraphDefinition, TemplateEngine, graphHasArtifactComponents, MCPTransportType, getExternalAgent } from '@inkeep/agents-core';
|
|
3
|
+
import { otel } from '@hono/otel';
|
|
4
|
+
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
5
|
+
import { trace, propagation, context, SpanStatusCode } from '@opentelemetry/api';
|
|
6
|
+
import { Hono } from 'hono';
|
|
7
|
+
import { cors } from 'hono/cors';
|
|
8
|
+
import { HTTPException } from 'hono/http-exception';
|
|
9
|
+
import { requestId } from 'hono/request-id';
|
|
2
10
|
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
|
3
11
|
import { BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS } from '@opentelemetry/baggage-span-processor';
|
|
4
12
|
import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';
|
|
@@ -8,14 +16,6 @@ import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
|
8
16
|
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
9
17
|
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
10
18
|
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
11
|
-
import { getLogger, getTracer, HeadersScopeSchema, getRequestExecutionContext, createApiError, getAgentGraphWithDefaultAgent, contextValidationMiddleware, getFullGraph, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getAgentById, handleContextResolution, createMessage, commonGetErrorResponses, loggerFactory, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, getAgentGraphById, createTask, updateTask, setSpanWithError, updateConversation, handleApiError, TaskState, setActiveAgentForThread, getConversation, getRelatedAgentsForGraph, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, validateAndGetApiKey, getProject, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getContextConfigById, getFullGraphDefinition, TemplateEngine, graphHasArtifactComponents, MCPTransportType, getExternalAgent } from '@inkeep/agents-core';
|
|
12
|
-
import { otel } from '@hono/otel';
|
|
13
|
-
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
14
|
-
import { trace, propagation, context, SpanStatusCode } from '@opentelemetry/api';
|
|
15
|
-
import { Hono } from 'hono';
|
|
16
|
-
import { cors } from 'hono/cors';
|
|
17
|
-
import { HTTPException } from 'hono/http-exception';
|
|
18
|
-
import { requestId } from 'hono/request-id';
|
|
19
19
|
import { createMiddleware } from 'hono/factory';
|
|
20
20
|
import { swaggerUI } from '@hono/swagger-ui';
|
|
21
21
|
import z4, { z } from 'zod';
|
|
@@ -36,45 +36,48 @@ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/
|
|
|
36
36
|
import { z as z$2 } from 'zod/v3';
|
|
37
37
|
import { toReqRes, toFetchResponse } from 'fetch-to-node';
|
|
38
38
|
|
|
39
|
-
var maxExportBatchSize = env.OTEL_MAX_EXPORT_BATCH_SIZE ?? (env.ENVIRONMENT === "development" ? 1 : 512);
|
|
40
39
|
var otlpExporter = new OTLPTraceExporter();
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
});
|
|
44
|
-
var resource = resourceFromAttributes({
|
|
40
|
+
var defaultBatchProcessor = new BatchSpanProcessor(otlpExporter);
|
|
41
|
+
var defaultResource = resourceFromAttributes({
|
|
45
42
|
[ATTR_SERVICE_NAME]: "inkeep-agents-run-api"
|
|
46
43
|
});
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"@opentelemetry/instrumentation-http": {
|
|
57
|
-
enabled: true,
|
|
58
|
-
requestHook: (span, request) => {
|
|
59
|
-
const url = request?.url ?? request?.path;
|
|
60
|
-
if (!url) return;
|
|
61
|
-
const u = new URL(url, "http://localhost");
|
|
62
|
-
span.updateName(`${request?.method || "UNKNOWN"} ${u.pathname}`);
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"@opentelemetry/instrumentation-undici": {
|
|
66
|
-
requestHook: (span) => {
|
|
67
|
-
const method = span.attributes?.["http.request.method"];
|
|
68
|
-
const host = span.attributes?.["server.address"];
|
|
69
|
-
const path = span.attributes?.["url.path"];
|
|
70
|
-
if (method && path)
|
|
71
|
-
span.updateName(host ? `${method} ${host}${path}` : `${method} ${path}`);
|
|
72
|
-
}
|
|
44
|
+
var defaultInstrumentations = [
|
|
45
|
+
getNodeAutoInstrumentations({
|
|
46
|
+
"@opentelemetry/instrumentation-http": {
|
|
47
|
+
enabled: true,
|
|
48
|
+
requestHook: (span, request) => {
|
|
49
|
+
const url = request?.url ?? request?.path;
|
|
50
|
+
if (!url) return;
|
|
51
|
+
const u = new URL(url, "http://localhost");
|
|
52
|
+
span.updateName(`${request?.method || "UNKNOWN"} ${u.pathname}`);
|
|
73
53
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
54
|
+
},
|
|
55
|
+
"@opentelemetry/instrumentation-undici": {
|
|
56
|
+
requestHook: (span) => {
|
|
57
|
+
const method = span.attributes?.["http.request.method"];
|
|
58
|
+
const host = span.attributes?.["server.address"];
|
|
59
|
+
const path = span.attributes?.["url.path"];
|
|
60
|
+
if (method && path)
|
|
61
|
+
span.updateName(host ? `${method} ${host}${path}` : `${method} ${path}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
];
|
|
66
|
+
var defaultSpanProcessors = [
|
|
67
|
+
new BaggageSpanProcessor(ALLOW_ALL_BAGGAGE_KEYS),
|
|
68
|
+
defaultBatchProcessor
|
|
69
|
+
];
|
|
70
|
+
var defaultContextManager = new AsyncLocalStorageContextManager();
|
|
71
|
+
var defaultTextMapPropagator = new CompositePropagator({
|
|
72
|
+
propagators: [new W3CTraceContextPropagator(), new W3CBaggagePropagator()]
|
|
73
|
+
});
|
|
74
|
+
new NodeSDK({
|
|
75
|
+
resource: defaultResource,
|
|
76
|
+
contextManager: defaultContextManager,
|
|
77
|
+
textMapPropagator: defaultTextMapPropagator,
|
|
78
|
+
spanProcessors: defaultSpanProcessors,
|
|
79
|
+
instrumentations: defaultInstrumentations
|
|
76
80
|
});
|
|
77
|
-
sdk.start();
|
|
78
81
|
|
|
79
82
|
// src/types/execution-context.ts
|
|
80
83
|
function createExecutionContext(params) {
|
|
@@ -2123,7 +2126,7 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
2123
2126
|
);
|
|
2124
2127
|
}
|
|
2125
2128
|
span.setAttributes({ "validation.passed": true });
|
|
2126
|
-
const { getFormattedConversationHistory: getFormattedConversationHistory2 } = await import('./conversations-
|
|
2129
|
+
const { getFormattedConversationHistory: getFormattedConversationHistory2 } = await import('./conversations-LKYN44FI.js');
|
|
2127
2130
|
const conversationHistory = await getFormattedConversationHistory2({
|
|
2128
2131
|
tenantId: artifactData.tenantId,
|
|
2129
2132
|
projectId: artifactData.projectId,
|
|
@@ -8907,21 +8910,21 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
8907
8910
|
app6.route("/v1/mcp", mcp_default);
|
|
8908
8911
|
app6.route("/agents", agents_default);
|
|
8909
8912
|
setupOpenAPIRoutes(app6);
|
|
8910
|
-
app6.use("/tenants/*", async (
|
|
8913
|
+
app6.use("/tenants/*", async (_c, next) => {
|
|
8911
8914
|
await next();
|
|
8912
|
-
await
|
|
8915
|
+
await defaultBatchProcessor.forceFlush();
|
|
8913
8916
|
});
|
|
8914
|
-
app6.use("/agents/*", async (
|
|
8917
|
+
app6.use("/agents/*", async (_c, next) => {
|
|
8915
8918
|
await next();
|
|
8916
|
-
await
|
|
8919
|
+
await defaultBatchProcessor.forceFlush();
|
|
8917
8920
|
});
|
|
8918
|
-
app6.use("/v1/*", async (
|
|
8921
|
+
app6.use("/v1/*", async (_c, next) => {
|
|
8919
8922
|
await next();
|
|
8920
|
-
await
|
|
8923
|
+
await defaultBatchProcessor.forceFlush();
|
|
8921
8924
|
});
|
|
8922
|
-
app6.use("/api/*", async (
|
|
8925
|
+
app6.use("/api/*", async (_c, next) => {
|
|
8923
8926
|
await next();
|
|
8924
|
-
await
|
|
8927
|
+
await defaultBatchProcessor.forceFlush();
|
|
8925
8928
|
});
|
|
8926
8929
|
const baseApp = new Hono();
|
|
8927
8930
|
baseApp.route("/", app6);
|
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-20250924214135",
|
|
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",
|
|
@@ -44,11 +44,12 @@
|
|
|
44
44
|
"jmespath": "^0.16.0",
|
|
45
45
|
"keytar": "^7.9.0",
|
|
46
46
|
"nanoid": "^5.1.5",
|
|
47
|
+
"pino": "^9.11.0",
|
|
47
48
|
"traverse": "^0.6.11",
|
|
48
49
|
"ts-pattern": "^5.7.1",
|
|
49
50
|
"zod": "^4.1.5",
|
|
50
|
-
"@inkeep/agents-
|
|
51
|
-
"@inkeep/agents-
|
|
51
|
+
"@inkeep/agents-sdk": "^0.0.0-dev-20250924214135",
|
|
52
|
+
"@inkeep/agents-core": "^0.0.0-dev-20250924214135"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@hono/vite-dev-server": "^0.20.1",
|