@inkeep/agents-run-api 0.1.2 → 0.1.3
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/README.md +1 -1
- package/dist/__tests__/setup.d.ts.map +1 -1
- package/dist/__tests__/setup.js +32 -2
- package/dist/__tests__/utils/testProject.js +1 -1
- package/dist/__tests__/utils/testRequest.js +1 -1
- package/dist/__tests__/utils/testTenant.d.ts +3 -3
- package/dist/__tests__/utils/testTenant.js +3 -3
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +1 -1
- package/dist/a2a/handlers.d.ts +1 -1
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +3 -4
- package/dist/a2a/transfer.d.ts +1 -1
- package/dist/a2a/transfer.d.ts.map +1 -1
- package/dist/a2a/transfer.js +2 -2
- package/dist/agents/Agent.d.ts +2 -2
- package/dist/agents/Agent.d.ts.map +1 -1
- package/dist/agents/Agent.js +22 -19
- package/dist/agents/ModelFactory.d.ts.map +1 -1
- package/dist/agents/ModelFactory.js +3 -3
- package/dist/agents/SystemPromptBuilder.d.ts +1 -1
- package/dist/agents/SystemPromptBuilder.d.ts.map +1 -1
- package/dist/agents/SystemPromptBuilder.js +2 -2
- package/dist/agents/ToolSessionManager.js +1 -1
- package/dist/agents/artifactTools.d.ts.map +1 -1
- package/dist/agents/artifactTools.js +4 -4
- package/dist/agents/generateTaskHandler.d.ts +2 -2
- package/dist/agents/generateTaskHandler.d.ts.map +1 -1
- package/dist/agents/generateTaskHandler.js +4 -4
- package/dist/agents/relationTools.d.ts +2 -2
- package/dist/agents/relationTools.d.ts.map +1 -1
- package/dist/agents/relationTools.js +10 -8
- package/dist/agents/types.d.ts +1 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/versions/V1Config.d.ts +1 -1
- package/dist/agents/versions/V1Config.d.ts.map +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +80 -66
- package/dist/data/agentGraph.d.ts +1 -1
- package/dist/data/agentGraph.d.ts.map +1 -1
- package/dist/data/agentGraph.js +2 -2
- package/dist/data/agents.d.ts +2 -2
- package/dist/data/agents.d.ts.map +1 -1
- package/dist/data/agents.js +8 -3
- package/dist/data/conversations.d.ts +1 -1
- package/dist/data/conversations.d.ts.map +1 -1
- package/dist/data/conversations.js +2 -2
- package/dist/data/db/clean.js +3 -3
- package/dist/data/db/dbClient.js +1 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/handlers/executionHandler.d.ts +1 -1
- package/dist/handlers/executionHandler.d.ts.map +1 -1
- package/dist/handlers/executionHandler.js +9 -9
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/instrumentation.js +3 -3
- package/dist/logger.js +1 -1
- package/dist/middleware/api-key-auth.d.ts.map +1 -1
- package/dist/middleware/api-key-auth.js +4 -4
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/openapi.js +1 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +6 -6
- package/dist/routes/chat.d.ts +7 -1
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +7 -8
- package/dist/routes/chatDataStream.d.ts +7 -1
- package/dist/routes/chatDataStream.d.ts.map +1 -1
- package/dist/routes/chatDataStream.js +7 -7
- package/dist/routes/mcp.d.ts +7 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +15 -15
- package/dist/tracer.d.ts.map +1 -1
- package/dist/tracer.js +4 -3
- package/dist/utils/artifact-component-schema.d.ts +1 -1
- package/dist/utils/artifact-component-schema.d.ts.map +1 -1
- package/dist/utils/artifact-component-schema.js +4 -4
- package/dist/utils/artifact-parser.js +2 -2
- package/dist/utils/cleanup.js +1 -1
- package/dist/utils/data-component-schema.js +1 -1
- package/dist/utils/graph-session.d.ts +1 -1
- package/dist/utils/graph-session.d.ts.map +1 -1
- package/dist/utils/graph-session.js +15 -11
- package/dist/utils/incremental-stream-parser.d.ts +2 -2
- package/dist/utils/incremental-stream-parser.d.ts.map +1 -1
- package/dist/utils/incremental-stream-parser.js +5 -3
- package/dist/utils/response-formatter.d.ts.map +1 -1
- package/dist/utils/response-formatter.js +3 -3
- package/dist/utils/stream-helpers.d.ts +1 -1
- package/dist/utils/stream-helpers.d.ts.map +1 -1
- package/dist/utils/stream-registry.d.ts +1 -1
- package/dist/utils/stream-registry.d.ts.map +1 -1
- package/package.json +8 -6
- package/templates/v1/artifact.xml +7 -0
- package/templates/v1/data-component.xml +9 -0
- package/templates/v1/system-prompt.xml +52 -0
- package/templates/v1/thinking-preparation.xml +34 -0
- package/templates/v1/tool.xml +12 -0
package/dist/app.js
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
+
import { handleApiError, } from '@inkeep/agents-core';
|
|
2
3
|
import { context as otelContext, propagation } from '@opentelemetry/api';
|
|
3
4
|
import { cors } from 'hono/cors';
|
|
4
5
|
import { HTTPException } from 'hono/http-exception';
|
|
5
6
|
import { requestId } from 'hono/request-id';
|
|
6
7
|
import { pinoLogger } from 'hono-pino';
|
|
7
|
-
import {
|
|
8
|
-
import { getLogger } from './logger
|
|
9
|
-
import { apiKeyAuth } from './middleware/api-key-auth
|
|
10
|
-
import { setupOpenAPIRoutes } from './openapi
|
|
11
|
-
import agentRoutes from './routes/agents
|
|
12
|
-
import chatRoutes from './routes/chat
|
|
13
|
-
import chatDataRoutes from './routes/chatDataStream
|
|
14
|
-
import mcpRoutes from './routes/mcp
|
|
8
|
+
import { pino } from 'pino';
|
|
9
|
+
import { getLogger } from './logger';
|
|
10
|
+
import { apiKeyAuth } from './middleware/api-key-auth';
|
|
11
|
+
import { setupOpenAPIRoutes } from './openapi';
|
|
12
|
+
import agentRoutes from './routes/agents';
|
|
13
|
+
import chatRoutes from './routes/chat';
|
|
14
|
+
import chatDataRoutes from './routes/chatDataStream';
|
|
15
|
+
import mcpRoutes from './routes/mcp';
|
|
15
16
|
function createExecutionHono(serverConfig, credentialStores) {
|
|
16
17
|
const app = new OpenAPIHono();
|
|
17
18
|
// Request ID middleware
|
|
18
19
|
app.use('*', requestId());
|
|
20
|
+
// Server config and credential stores middleware
|
|
21
|
+
app.use('*', async (c, next) => {
|
|
22
|
+
c.set('serverConfig', serverConfig);
|
|
23
|
+
c.set('credentialStores', credentialStores);
|
|
24
|
+
return next();
|
|
25
|
+
});
|
|
19
26
|
// OpenTelemetry baggage middleware
|
|
20
27
|
app.use('*', async (c, next) => {
|
|
21
28
|
const reqId = c.get('requestId');
|
|
@@ -23,55 +30,17 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
23
30
|
if (!bag) {
|
|
24
31
|
bag = propagation.createBaggage();
|
|
25
32
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
app.use('*', async (c, next) => {
|
|
32
|
-
// Get the API key context if available (set by auth middleware)
|
|
33
|
-
const executionContext = c.get('executionContext');
|
|
34
|
-
if (!executionContext) {
|
|
35
|
-
// No API key context, skip baggage setup
|
|
36
|
-
return next();
|
|
37
|
-
}
|
|
38
|
-
const { tenantId, projectId, graphId } = executionContext;
|
|
39
|
-
// Extract conversation ID from JSON body if present
|
|
40
|
-
let conversationId;
|
|
41
|
-
if (c.req.header('content-type')?.includes('application/json')) {
|
|
42
|
-
try {
|
|
43
|
-
const body = await c.req.json();
|
|
44
|
-
conversationId = body?.conversationId;
|
|
45
|
-
}
|
|
46
|
-
catch (_) {
|
|
47
|
-
// Silently ignore parse errors for non-JSON bodies
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const entries = Object.fromEntries(Object.entries({
|
|
51
|
-
'graph.id': graphId,
|
|
52
|
-
'tenant.id': tenantId,
|
|
53
|
-
'project.id': projectId,
|
|
54
|
-
'conversation.id': conversationId,
|
|
55
|
-
}).filter((entry) => {
|
|
56
|
-
const [, v] = entry;
|
|
57
|
-
return typeof v === 'string' && v.length > 0;
|
|
58
|
-
}));
|
|
59
|
-
if (!Object.keys(entries).length) {
|
|
60
|
-
return next();
|
|
33
|
+
// Safety check for test environment where createBaggage might return undefined
|
|
34
|
+
if (bag && typeof bag.setEntry === 'function') {
|
|
35
|
+
bag = bag.setEntry('request.id', { value: String(reqId ?? 'unknown') });
|
|
36
|
+
const ctxWithBag = propagation.setBaggage(otelContext.active(), bag);
|
|
37
|
+
return otelContext.with(ctxWithBag, () => next());
|
|
61
38
|
}
|
|
62
|
-
const bag = Object.entries(entries).reduce((b, [key, value]) => b.setEntry(key, { value: value || '' }), propagation.getBaggage(otelContext.active()) ?? propagation.createBaggage());
|
|
63
|
-
const ctxWithBag = propagation.setBaggage(otelContext.active(), bag);
|
|
64
|
-
return otelContext.with(ctxWithBag, () => next());
|
|
65
|
-
});
|
|
66
|
-
// Server config and credential stores middleware
|
|
67
|
-
app.use('*', async (c, next) => {
|
|
68
|
-
c.set('serverConfig', serverConfig);
|
|
69
|
-
c.set('credentialStores', credentialStores);
|
|
70
39
|
return next();
|
|
71
40
|
});
|
|
72
41
|
// Logging middleware
|
|
73
42
|
app.use(pinoLogger({
|
|
74
|
-
pino: getLogger(),
|
|
43
|
+
pino: getLogger() || pino({ level: 'debug' }),
|
|
75
44
|
http: {
|
|
76
45
|
onResLevel(c) {
|
|
77
46
|
if (c.res.status >= 500) {
|
|
@@ -117,21 +86,27 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
117
86
|
if (!isExpectedError) {
|
|
118
87
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
119
88
|
const errorStack = err instanceof Error ? err.stack : undefined;
|
|
120
|
-
getLogger()
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
89
|
+
const logger = getLogger();
|
|
90
|
+
if (logger) {
|
|
91
|
+
logger.error({
|
|
92
|
+
error: err,
|
|
93
|
+
message: errorMessage,
|
|
94
|
+
stack: errorStack,
|
|
95
|
+
path: c.req.path,
|
|
96
|
+
requestId,
|
|
97
|
+
}, 'Unexpected server error occurred');
|
|
98
|
+
}
|
|
127
99
|
}
|
|
128
100
|
else {
|
|
129
|
-
getLogger()
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
101
|
+
const logger = getLogger();
|
|
102
|
+
if (logger) {
|
|
103
|
+
logger.error({
|
|
104
|
+
error: err,
|
|
105
|
+
path: c.req.path,
|
|
106
|
+
requestId,
|
|
107
|
+
status,
|
|
108
|
+
}, 'Server error occurred');
|
|
109
|
+
}
|
|
135
110
|
}
|
|
136
111
|
}
|
|
137
112
|
if (isExpectedError) {
|
|
@@ -140,7 +115,10 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
140
115
|
return response;
|
|
141
116
|
}
|
|
142
117
|
catch (responseError) {
|
|
143
|
-
|
|
118
|
+
const logger = getLogger();
|
|
119
|
+
if (logger) {
|
|
120
|
+
logger.error({ error: responseError }, 'Error while handling HTTPException response');
|
|
121
|
+
}
|
|
144
122
|
}
|
|
145
123
|
}
|
|
146
124
|
const { status: respStatus, title, detail, instance } = await handleApiError(err, requestId);
|
|
@@ -175,6 +153,42 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
175
153
|
app.use('/agents/*', apiKeyAuth());
|
|
176
154
|
app.use('/v1/*', apiKeyAuth());
|
|
177
155
|
app.use('/api/*', apiKeyAuth());
|
|
156
|
+
// Baggage middleware for execution API - extracts context from API key authentication
|
|
157
|
+
app.use('*', async (c, next) => {
|
|
158
|
+
// Get the API key context if available (set by auth middleware)
|
|
159
|
+
const executionContext = c.get('executionContext');
|
|
160
|
+
if (!executionContext) {
|
|
161
|
+
// No API key context, skip baggage setup
|
|
162
|
+
return next();
|
|
163
|
+
}
|
|
164
|
+
const { tenantId, projectId, graphId } = executionContext;
|
|
165
|
+
// Extract conversation ID from JSON body if present
|
|
166
|
+
let conversationId;
|
|
167
|
+
if (c.req.header('content-type')?.includes('application/json')) {
|
|
168
|
+
try {
|
|
169
|
+
const body = await c.req.json();
|
|
170
|
+
conversationId = body?.conversationId;
|
|
171
|
+
}
|
|
172
|
+
catch (_) {
|
|
173
|
+
// Silently ignore parse errors for non-JSON bodies
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const entries = Object.fromEntries(Object.entries({
|
|
177
|
+
'graph.id': graphId,
|
|
178
|
+
'tenant.id': tenantId,
|
|
179
|
+
'project.id': projectId,
|
|
180
|
+
'conversation.id': conversationId,
|
|
181
|
+
}).filter((entry) => {
|
|
182
|
+
const [, v] = entry;
|
|
183
|
+
return typeof v === 'string' && v.length > 0;
|
|
184
|
+
}));
|
|
185
|
+
if (!Object.keys(entries).length) {
|
|
186
|
+
return next();
|
|
187
|
+
}
|
|
188
|
+
const bag = Object.entries(entries).reduce((b, [key, value]) => b.setEntry(key, { value: value || '' }), propagation.getBaggage(otelContext.active()) ?? propagation.createBaggage());
|
|
189
|
+
const ctxWithBag = propagation.setBaggage(otelContext.active(), bag);
|
|
190
|
+
return otelContext.with(ctxWithBag, () => next());
|
|
191
|
+
});
|
|
178
192
|
// Health check endpoint (no auth required)
|
|
179
193
|
app.openapi(createRoute({
|
|
180
194
|
method: 'get',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RegisteredAgent } from '../a2a/types.js';
|
|
2
1
|
import type { ExecutionContext } from '@inkeep/agents-core';
|
|
2
|
+
import type { RegisteredAgent } from '../a2a/types';
|
|
3
3
|
export declare function getRegisteredGraph(executionContext: ExecutionContext): Promise<RegisteredAgent | null>;
|
|
4
4
|
//# sourceMappingURL=agentGraph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentGraph.d.ts","sourceRoot":"","sources":["../../src/data/agentGraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"agentGraph.d.ts","sourceRoot":"","sources":["../../src/data/agentGraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA6EpD,wBAAsB,kBAAkB,CACtC,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAUjC"}
|
package/dist/data/agentGraph.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createTaskHandler, createTaskHandlerConfig } from '../agents/generateTaskHandler.js';
|
|
2
1
|
import { getAgentById, getAgentGraph } from '@inkeep/agents-core';
|
|
3
|
-
import
|
|
2
|
+
import { createTaskHandler, createTaskHandlerConfig } from '../agents/generateTaskHandler';
|
|
3
|
+
import dbClient from './db/dbClient';
|
|
4
4
|
// Hydrate graph function
|
|
5
5
|
async function hydrateGraph({ dbGraph, baseUrl, apiKey, }) {
|
|
6
6
|
try {
|
package/dist/data/agents.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type CredentialStoreRegistry, type ExecutionContext } from '@inkeep/agents-core';
|
|
2
|
+
import type { RegisteredAgent } from '../a2a/types';
|
|
3
3
|
export declare function getRegisteredAgent(executionContext: ExecutionContext, credentialStoreRegistry?: CredentialStoreRegistry): Promise<RegisteredAgent | null>;
|
|
4
4
|
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/data/agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/data/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EAItB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,cAAc,CAAC;AA2E/D,wBAAsB,kBAAkB,CACtC,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,CAAC,EAAE,uBAAuB,GAChD,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAsBjC"}
|
package/dist/data/agents.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createTaskHandler, createTaskHandlerConfig } from '../agents/generateTaskHandler.js';
|
|
2
|
-
import dbClient from './db/dbClient.js';
|
|
3
1
|
import { getAgentById, getLogger, } from '@inkeep/agents-core';
|
|
2
|
+
import { createTaskHandler, createTaskHandlerConfig } from '../agents/generateTaskHandler';
|
|
3
|
+
import dbClient from './db/dbClient';
|
|
4
4
|
// Agent hydration functions
|
|
5
5
|
const logger = getLogger('agents');
|
|
6
6
|
/**
|
|
@@ -69,5 +69,10 @@ export async function getRegisteredAgent(executionContext, credentialStoreRegist
|
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
71
|
const agentFrameworkBaseUrl = `${baseUrl}/agents`;
|
|
72
|
-
return hydrateAgent({
|
|
72
|
+
return hydrateAgent({
|
|
73
|
+
dbAgent,
|
|
74
|
+
graphId,
|
|
75
|
+
baseUrl: agentFrameworkBaseUrl,
|
|
76
|
+
credentialStoreRegistry,
|
|
77
|
+
});
|
|
73
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AgentConversationHistoryConfig, type ConversationHistoryConfig, type ConversationScopeOptions } from '@inkeep/agents-core';
|
|
2
2
|
/**
|
|
3
3
|
* Creates default conversation history configuration
|
|
4
4
|
* @param mode - The conversation history mode ('full' | 'scoped' | 'none')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/data/conversations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/data/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAG9B,MAAM,qBAAqB,CAAC;AAI7B;;;;GAIG;AACH,wBAAgB,sCAAsC,CACpD,IAAI,GAAE,MAAM,GAAG,QAAQ,GAAG,MAAe,GACxC,8BAA8B,CAQhC;AAYD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,GAAG,EAAE,2BAA2B;AAC1C,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,cAAc,GAAG,aAAa,CAAC;IAC5C,UAAU,EAAE,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GACA,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAkDrB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,QAAQ,EACR,SAAS,EACT,cAAc,EACd,OAAO,EACP,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAyDjB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,KAAK,SAAK,GACT,OAAO,CAAC,GAAG,EAAE,CAAC,CAUhB;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,GAAG,EAAE,CAAC,CAUhB;AAED;;GAEG;AACH,wBAAsB,+BAA+B,CAAC,EACpD,QAAQ,EACR,SAAS,EACT,cAAc,EACd,cAAc,EACd,OAAO,EACP,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,GAAG,OAAO,CAAC,MAAM,CAAC,CAuDlB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nanoid } from 'nanoid';
|
|
2
|
-
import dbClient from './db/dbClient.js';
|
|
3
1
|
import { createMessage, getConversationHistory, } from '@inkeep/agents-core';
|
|
2
|
+
import { nanoid } from 'nanoid';
|
|
3
|
+
import dbClient from './db/dbClient';
|
|
4
4
|
/**
|
|
5
5
|
* Creates default conversation history configuration
|
|
6
6
|
* @param mode - The conversation history mode ('full' | 'scoped' | 'none')
|
package/dist/data/db/clean.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
|
2
|
-
import { env } from '../../env.js';
|
|
3
1
|
import { agentArtifactComponents, agentDataComponents, agentGraph, agentRelations, agents, agentToolRelations, artifactComponents, contextCache, contextConfigs, conversations, credentialReferences, dataComponents, externalAgents, ledgerArtifacts, messages, taskRelations, tasks, tools, } from '@inkeep/agents-core';
|
|
4
|
-
import
|
|
2
|
+
import { sql } from 'drizzle-orm';
|
|
3
|
+
import { env } from '../../env';
|
|
4
|
+
import dbClient from './dbClient';
|
|
5
5
|
/**
|
|
6
6
|
* Truncates all tables in the database, respecting foreign key constraints
|
|
7
7
|
* Tables are cleared in dependency order (child tables first, then parent tables)
|
package/dist/data/db/dbClient.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { env } from '../../env.js';
|
|
2
1
|
import { createDatabaseClient } from '@inkeep/agents-core';
|
|
2
|
+
import { env } from '../../env';
|
|
3
3
|
// Create database URL - use in-memory for tests, file for other environments
|
|
4
4
|
const getDbUrl = () => {
|
|
5
5
|
// Use in-memory database for tests - each worker gets its own isolated database
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkCxB,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAeb,CAAC;AAuBH,eAAO,MAAM,GAAG;;;;;;;;;;;;CAAa,CAAC;AAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StreamHelper } from '../utils/stream-helpers.js';
|
|
2
1
|
import type { ExecutionContext } from '@inkeep/agents-core';
|
|
2
|
+
import type { StreamHelper } from '../utils/stream-helpers';
|
|
3
3
|
interface ExecutionHandlerParams {
|
|
4
4
|
executionContext: ExecutionContext;
|
|
5
5
|
conversationId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executionHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/executionHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executionHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/executionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAyB5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAM5D,UAAU,sBAAsB;IAC9B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,YAAY,CAAC;CACzB;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAK;IAEhC;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC;CA8cxE"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { createMessage, createTask, getActiveAgentForConversation, getFullGraph, getTask, updateTask, } from '@inkeep/agents-core';
|
|
1
2
|
import { trace } from '@opentelemetry/api';
|
|
2
|
-
import { A2AClient } from '../a2a/client.js';
|
|
3
|
-
import { executeTransfer, isTransferResponse } from '../a2a/transfer.js';
|
|
4
|
-
import { createMessage, getActiveAgentForConversation, createTask, getTask, updateTask, getFullGraph, } from '@inkeep/agents-core';
|
|
5
|
-
import { getLogger } from '../logger.js';
|
|
6
|
-
import { agentInitializingOp, agentReadyOp, agentThinkingOp, completionOp, errorOp, } from '../utils/agent-operations.js';
|
|
7
|
-
import { graphSessionManager } from '../utils/graph-session.js';
|
|
8
|
-
import { MCPStreamHelper } from '../utils/stream-helpers.js';
|
|
9
|
-
import { registerStreamHelper, unregisterStreamHelper } from '../utils/stream-registry.js';
|
|
10
|
-
import dbClient from '../data/db/dbClient.js';
|
|
11
3
|
import { nanoid } from 'nanoid';
|
|
4
|
+
import { A2AClient } from '../a2a/client';
|
|
5
|
+
import { executeTransfer, isTransferResponse } from '../a2a/transfer';
|
|
6
|
+
import dbClient from '../data/db/dbClient';
|
|
7
|
+
import { getLogger } from '../logger';
|
|
8
|
+
import { agentInitializingOp, agentReadyOp, agentThinkingOp, completionOp, errorOp, } from '../utils/agent-operations';
|
|
9
|
+
import { graphSessionManager } from '../utils/graph-session';
|
|
10
|
+
import { MCPStreamHelper } from '../utils/stream-helpers';
|
|
11
|
+
import { registerStreamHelper, unregisterStreamHelper } from '../utils/stream-registry';
|
|
12
12
|
const logger = getLogger('ExecutionHandler');
|
|
13
13
|
export class ExecutionHandler {
|
|
14
14
|
// Hardcoded error limit - separate from configurable stopWhen
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import './instrumentation
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import './instrumentation';
|
|
2
|
+
import { type CredentialStore, CredentialStoreRegistry, type ServerConfig } from '@inkeep/agents-core';
|
|
3
|
+
import { createExecutionHono } from './app';
|
|
4
4
|
declare const app: import("@hono/zod-openapi").OpenAPIHono<{
|
|
5
5
|
Variables: {
|
|
6
6
|
executionContext: import("@inkeep/agents-core").ExecutionContext;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,uBAAuB,EAEvB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAiB5C,QAAA,MAAM,GAAG;;;;;;WAAsD,CAAC;AAGhE,eAAe,GAAG,CAAC;AAGnB,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAG/B,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE;IAC1C,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;;;;;;YAMA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import './instrumentation
|
|
2
|
-
import { createExecutionHono } from './app.js';
|
|
1
|
+
import './instrumentation';
|
|
3
2
|
import { CredentialStoreRegistry, createDefaultCredentialStores, } from '@inkeep/agents-core';
|
|
3
|
+
import { createExecutionHono } from './app';
|
|
4
4
|
// Create default configuration
|
|
5
5
|
const defaultConfig = {
|
|
6
6
|
port: 3003,
|
package/dist/instrumentation.js
CHANGED
|
@@ -29,9 +29,9 @@ const spanProcessor = new FanOutSpanProcessor([
|
|
|
29
29
|
new BatchSpanProcessor(otlpExporter, {
|
|
30
30
|
maxExportBatchSize: 1, // Send immediately (vs 512)
|
|
31
31
|
scheduledDelayMillis: 100, // 100ms delay (vs 5000ms)
|
|
32
|
-
exportTimeoutMillis: 5000, // 5s timeout (vs 30s)
|
|
33
|
-
maxQueueSize: 512 // Smaller queue
|
|
34
|
-
})
|
|
32
|
+
exportTimeoutMillis: 5000, // 5s timeout (vs 30s)
|
|
33
|
+
maxQueueSize: 512, // Smaller queue
|
|
34
|
+
}),
|
|
35
35
|
]);
|
|
36
36
|
export const sdk = new NodeSDK({
|
|
37
37
|
serviceName: 'inkeep-chat',
|
package/dist/logger.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import { pino } from 'pino';
|
|
3
3
|
// import { createGcpLoggingPinoConfig } from '@google-cloud/pino-logging-gcp-config';
|
|
4
|
-
import { env } from './env
|
|
4
|
+
import { env } from './env';
|
|
5
5
|
const logger = pino({
|
|
6
6
|
level: env.LOG_LEVEL,
|
|
7
7
|
serializers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-auth.d.ts","sourceRoot":"","sources":["../../src/middleware/api-key-auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-key-auth.d.ts","sourceRoot":"","sources":["../../src/middleware/api-key-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAmC,MAAM,qBAAqB,CAAC;AAQ7F;;;;GAIG;AACH,eAAO,MAAM,UAAU;eAER;QACT,gBAAgB,EAAE,gBAAgB,CAAC;KACpC;cAoHD,CAAC;AAEL,eAAO,MAAM,wBAAwB,GAAU,QAAQ,MAAM,8BAgB5D,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,YAAY;eAEV;QACT,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC;cAYD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { getLogger, validateAndGetApiKey } from '@inkeep/agents-core';
|
|
1
2
|
import { createMiddleware } from 'hono/factory';
|
|
2
3
|
import { HTTPException } from 'hono/http-exception';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { createExecutionContext } from '../types/execution-context
|
|
6
|
-
import { env } from '../env.js';
|
|
4
|
+
import dbClient from '../data/db/dbClient';
|
|
5
|
+
import { env } from '../env';
|
|
6
|
+
import { createExecutionContext } from '../types/execution-context';
|
|
7
7
|
const logger = getLogger('env-key-auth');
|
|
8
8
|
/**
|
|
9
9
|
* Middleware to authenticate API requests using Bearer token authentication
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './api-key-auth
|
|
1
|
+
export * from './api-key-auth';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/middleware/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './api-key-auth
|
|
1
|
+
export * from './api-key-auth';
|
package/dist/openapi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/routes/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/routes/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,KAAK,uBAAuB,EAI7B,MAAM,qBAAqB,CAAC;AAS7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AAqM3D,eAAe,GAAG,CAAC"}
|
package/dist/routes/agents.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { a2aHandler } from '../a2a/handlers.js';
|
|
4
2
|
import { getAgentGraphWithDefaultAgent, getRequestExecutionContext, HeadersScopeSchema, } from '@inkeep/agents-core';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { a2aHandler } from '../a2a/handlers';
|
|
5
|
+
import { getRegisteredGraph } from '../data/agentGraph';
|
|
6
|
+
import { getRegisteredAgent } from '../data/agents';
|
|
7
|
+
import dbClient from '../data/db/dbClient';
|
|
8
|
+
import { getLogger } from '../logger';
|
|
9
9
|
const app = new OpenAPIHono();
|
|
10
10
|
const logger = getLogger('agents');
|
|
11
11
|
// A2A Agent Card Discovery (REST with OpenAPI)
|
package/dist/routes/chat.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import { CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
credentialStores: CredentialStoreRegistry;
|
|
5
|
+
};
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
3
9
|
export default app;
|
|
4
10
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/routes/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAIL,uBAAuB,EAQxB,MAAM,qBAAqB,CAAC;AAY7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AA2W3D,eAAe,GAAG,CAAC"}
|
package/dist/routes/chat.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
+
import { contextValidationMiddleware, createMessage, createOrGetConversation, getActiveAgentForConversation, getAgentById, getAgentGraphWithDefaultAgent, getFullGraph, getRequestExecutionContext, handleContextResolution, setActiveAgentForConversation, } from '@inkeep/agents-core';
|
|
2
3
|
// import { Hono } from 'hono';
|
|
3
4
|
import { trace } from '@opentelemetry/api';
|
|
4
5
|
import { streamSSE } from 'hono/streaming';
|
|
5
6
|
import { nanoid } from 'nanoid';
|
|
6
7
|
import { z } from 'zod';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { contextValidationMiddleware } from '@inkeep/agents-core';
|
|
12
|
-
import { createSSEStreamHelper } from '../utils/stream-helpers.js';
|
|
13
|
-
import dbClient from '../data/db/dbClient.js';
|
|
8
|
+
import dbClient from '../data/db/dbClient';
|
|
9
|
+
import { ExecutionHandler } from '../handlers/executionHandler';
|
|
10
|
+
import { getLogger } from '../logger';
|
|
11
|
+
import { createSSEStreamHelper } from '../utils/stream-helpers';
|
|
14
12
|
const app = new OpenAPIHono();
|
|
15
13
|
const logger = getLogger('completionsHandler');
|
|
16
14
|
// Define the OpenAPI route schema
|
|
@@ -211,8 +209,9 @@ app.openapi(chatCompletionsRoute, async (c) => {
|
|
|
211
209
|
}
|
|
212
210
|
// Get validated context from middleware (falls back to body.context if no validation)
|
|
213
211
|
const validatedContext = c.get('validatedContext') || body.requestContext || {};
|
|
212
|
+
const credentialStores = c.get('credentialStores');
|
|
214
213
|
// Context resolution with intelligent conversation state detection
|
|
215
|
-
await handleContextResolution(tenantId, projectId, conversationId, graphId, validatedContext, dbClient);
|
|
214
|
+
await handleContextResolution(tenantId, projectId, conversationId, graphId, validatedContext, dbClient, credentialStores);
|
|
216
215
|
logger.info({
|
|
217
216
|
tenantId,
|
|
218
217
|
graphId,
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import { CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
credentialStores: CredentialStoreRegistry;
|
|
5
|
+
};
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
3
9
|
export default app;
|
|
4
10
|
//# sourceMappingURL=chatDataStream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatDataStream.d.ts","sourceRoot":"","sources":["../../src/routes/chatDataStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"chatDataStream.d.ts","sourceRoot":"","sources":["../../src/routes/chatDataStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAIL,uBAAuB,EAOxB,MAAM,qBAAqB,CAAC;AAU7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AAuM3D,eAAe,GAAG,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi';
|
|
2
|
+
import { commonGetErrorResponses, contextValidationMiddleware, createMessage, getActiveAgentForConversation, getAgentById, getAgentGraphWithDefaultAgent, getRequestExecutionContext, handleContextResolution, setActiveAgentForConversation, } from '@inkeep/agents-core';
|
|
2
3
|
import { trace } from '@opentelemetry/api';
|
|
3
4
|
import { createUIMessageStream, JsonToSseTransformStream } from 'ai';
|
|
4
5
|
import { stream } from 'hono/streaming';
|
|
5
6
|
import { nanoid } from 'nanoid';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { createVercelStreamHelper } from '../utils/stream-helpers.js';
|
|
11
|
-
import dbClient from '../data/db/dbClient.js';
|
|
7
|
+
import dbClient from '../data/db/dbClient';
|
|
8
|
+
import { ExecutionHandler } from '../handlers/executionHandler';
|
|
9
|
+
import { getLogger } from '../logger';
|
|
10
|
+
import { createVercelStreamHelper } from '../utils/stream-helpers';
|
|
12
11
|
const app = new OpenAPIHono();
|
|
13
12
|
const logger = getLogger('chatDataStream');
|
|
14
13
|
const chatDataStreamRoute = createRoute({
|
|
@@ -108,8 +107,9 @@ app.openapi(chatDataStreamRoute, async (c) => {
|
|
|
108
107
|
}
|
|
109
108
|
// Get validated context from middleware (falls back to body.context if no validation)
|
|
110
109
|
const validatedContext = c.get('validatedContext') || body.requestContext || {};
|
|
110
|
+
const credentialStores = c.get('credentialStores');
|
|
111
111
|
// Context resolution with intelligent conversation state detection
|
|
112
|
-
await handleContextResolution(tenantId, projectId, conversationId, graphId, validatedContext, dbClient);
|
|
112
|
+
await handleContextResolution(tenantId, projectId, conversationId, graphId, validatedContext, dbClient, credentialStores);
|
|
113
113
|
// Store last user message
|
|
114
114
|
const lastUserMessage = body.messages.filter((m) => m.role === 'user').slice(-1)[0];
|
|
115
115
|
const userText = typeof lastUserMessage?.content === 'string'
|
package/dist/routes/mcp.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
-
|
|
2
|
+
import { CredentialStoreRegistry } from '@inkeep/agents-core';
|
|
3
|
+
type AppVariables = {
|
|
4
|
+
credentialStores: CredentialStoreRegistry;
|
|
5
|
+
};
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: AppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
3
9
|
export default app;
|
|
4
10
|
//# sourceMappingURL=mcp.d.ts.map
|
package/dist/routes/mcp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/routes/mcp.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/routes/mcp.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAa7D,OAAO,EACL,uBAAuB,EASxB,MAAM,qBAAqB,CAAC;AAgX7B,KAAK,YAAY,GAAG;IAClB,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,GAAG;eAAgC,YAAY;WAAK,CAAC;AA6T3D,eAAe,GAAG,CAAC"}
|