@inkeep/agents-run-api 0.7.2 → 0.8.1
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.
|
@@ -8,6 +8,8 @@ var envSchema = z.object({
|
|
|
8
8
|
NODE_ENV: z.enum(["development", "production", "test"]).optional(),
|
|
9
9
|
ENVIRONMENT: z.enum(["development", "production", "pentest", "test"]).optional().default("development"),
|
|
10
10
|
DB_FILE_NAME: z.string(),
|
|
11
|
+
TURSO_DATABASE_URL: z.string().optional(),
|
|
12
|
+
TURSO_AUTH_TOKEN: z.string().optional(),
|
|
11
13
|
AGENTS_RUN_API_URL: z.string().optional().default("http://localhost:3003"),
|
|
12
14
|
LOG_LEVEL: z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
|
|
13
15
|
NANGO_SECRET_KEY: z.string().optional(),
|
|
@@ -33,13 +35,21 @@ ${error.message}`
|
|
|
33
35
|
var env = parseEnv();
|
|
34
36
|
|
|
35
37
|
// src/data/db/dbClient.ts
|
|
36
|
-
var
|
|
38
|
+
var getDbConfig = () => {
|
|
37
39
|
if (env.ENVIRONMENT === "test") {
|
|
38
|
-
return ":memory:";
|
|
40
|
+
return { url: ":memory:" };
|
|
39
41
|
}
|
|
40
|
-
|
|
42
|
+
if (env.TURSO_DATABASE_URL && env.TURSO_AUTH_TOKEN) {
|
|
43
|
+
return {
|
|
44
|
+
url: env.TURSO_DATABASE_URL,
|
|
45
|
+
authToken: env.TURSO_AUTH_TOKEN
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
url: env.DB_FILE_NAME
|
|
50
|
+
};
|
|
41
51
|
};
|
|
42
|
-
var dbClient = createDatabaseClient(
|
|
52
|
+
var dbClient = createDatabaseClient(getDbConfig());
|
|
43
53
|
var dbClient_default = dbClient;
|
|
44
54
|
|
|
45
55
|
// src/data/conversations.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createDefaultConversationHistoryConfig, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-
|
|
1
|
+
export { createDefaultConversationHistoryConfig, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-ETRXGI47.js';
|
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,8 @@ var init_env = __esm({
|
|
|
64
64
|
NODE_ENV: z5.z.enum(["development", "production", "test"]).optional(),
|
|
65
65
|
ENVIRONMENT: z5.z.enum(["development", "production", "pentest", "test"]).optional().default("development"),
|
|
66
66
|
DB_FILE_NAME: z5.z.string(),
|
|
67
|
+
TURSO_DATABASE_URL: z5.z.string().optional(),
|
|
68
|
+
TURSO_AUTH_TOKEN: z5.z.string().optional(),
|
|
67
69
|
AGENTS_RUN_API_URL: z5.z.string().optional().default("http://localhost:3003"),
|
|
68
70
|
LOG_LEVEL: z5.z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
|
|
69
71
|
NANGO_SECRET_KEY: z5.z.string().optional(),
|
|
@@ -89,17 +91,25 @@ ${error.message}`
|
|
|
89
91
|
env = parseEnv();
|
|
90
92
|
}
|
|
91
93
|
});
|
|
92
|
-
var
|
|
94
|
+
var getDbConfig, dbClient, dbClient_default;
|
|
93
95
|
var init_dbClient = __esm({
|
|
94
96
|
"src/data/db/dbClient.ts"() {
|
|
95
97
|
init_env();
|
|
96
|
-
|
|
98
|
+
getDbConfig = () => {
|
|
97
99
|
if (env.ENVIRONMENT === "test") {
|
|
98
|
-
return ":memory:";
|
|
100
|
+
return { url: ":memory:" };
|
|
99
101
|
}
|
|
100
|
-
|
|
102
|
+
if (env.TURSO_DATABASE_URL && env.TURSO_AUTH_TOKEN) {
|
|
103
|
+
return {
|
|
104
|
+
url: env.TURSO_DATABASE_URL,
|
|
105
|
+
authToken: env.TURSO_AUTH_TOKEN
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
url: env.DB_FILE_NAME
|
|
110
|
+
};
|
|
101
111
|
};
|
|
102
|
-
dbClient = agentsCore.createDatabaseClient(
|
|
112
|
+
dbClient = agentsCore.createDatabaseClient(getDbConfig());
|
|
103
113
|
dbClient_default = dbClient;
|
|
104
114
|
}
|
|
105
115
|
});
|
|
@@ -5529,7 +5539,7 @@ var Agent = class {
|
|
|
5529
5539
|
/**
|
|
5530
5540
|
* Convert database McpTool to builder MCPToolConfig format
|
|
5531
5541
|
*/
|
|
5532
|
-
convertToMCPToolConfig(tool4) {
|
|
5542
|
+
convertToMCPToolConfig(tool4, agentToolRelationHeaders) {
|
|
5533
5543
|
return {
|
|
5534
5544
|
id: tool4.id,
|
|
5535
5545
|
name: tool4.name,
|
|
@@ -5539,7 +5549,10 @@ var Agent = class {
|
|
|
5539
5549
|
activeTools: tool4.config.mcp.activeTools,
|
|
5540
5550
|
mcpType: tool4.config.mcp.server.url.includes("api.nango.dev") ? agentsCore.MCPServerType.nango : agentsCore.MCPServerType.generic,
|
|
5541
5551
|
transport: tool4.config.mcp.transport,
|
|
5542
|
-
headers:
|
|
5552
|
+
headers: {
|
|
5553
|
+
...tool4.headers,
|
|
5554
|
+
...agentToolRelationHeaders
|
|
5555
|
+
}
|
|
5543
5556
|
};
|
|
5544
5557
|
}
|
|
5545
5558
|
async getMcpTool(tool4) {
|
|
@@ -5552,6 +5565,7 @@ var Agent = class {
|
|
|
5552
5565
|
agentId: this.config.id
|
|
5553
5566
|
}
|
|
5554
5567
|
});
|
|
5568
|
+
const agentToolRelationHeaders = toolsForAgent.data.find((t) => t.toolId === tool4.id)?.headers || void 0;
|
|
5555
5569
|
const selectedTools = toolsForAgent.data.find((t) => t.toolId === tool4.id)?.selectedTools || void 0;
|
|
5556
5570
|
let serverConfig;
|
|
5557
5571
|
if (credentialReferenceId && this.credentialStuffer) {
|
|
@@ -5576,7 +5590,7 @@ var Agent = class {
|
|
|
5576
5590
|
contextConfigId: this.config.contextConfigId || void 0,
|
|
5577
5591
|
conversationId: this.conversationId || void 0
|
|
5578
5592
|
},
|
|
5579
|
-
this.convertToMCPToolConfig(tool4),
|
|
5593
|
+
this.convertToMCPToolConfig(tool4, agentToolRelationHeaders),
|
|
5580
5594
|
storeReference,
|
|
5581
5595
|
selectedTools
|
|
5582
5596
|
);
|
|
@@ -5588,7 +5602,7 @@ var Agent = class {
|
|
|
5588
5602
|
contextConfigId: this.config.contextConfigId || void 0,
|
|
5589
5603
|
conversationId: this.conversationId || void 0
|
|
5590
5604
|
},
|
|
5591
|
-
this.convertToMCPToolConfig(tool4),
|
|
5605
|
+
this.convertToMCPToolConfig(tool4, agentToolRelationHeaders),
|
|
5592
5606
|
void 0,
|
|
5593
5607
|
selectedTools
|
|
5594
5608
|
);
|
|
@@ -5597,7 +5611,8 @@ var Agent = class {
|
|
|
5597
5611
|
type: tool4.config.mcp.transport?.type || agentsCore.MCPTransportType.streamableHttp,
|
|
5598
5612
|
url: tool4.config.mcp.server.url,
|
|
5599
5613
|
activeTools: tool4.config.mcp.activeTools,
|
|
5600
|
-
selectedTools
|
|
5614
|
+
selectedTools,
|
|
5615
|
+
headers: agentToolRelationHeaders
|
|
5601
5616
|
};
|
|
5602
5617
|
}
|
|
5603
5618
|
logger15.info(
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultBatchProcessor } from './chunk-5RGAMXUL.js';
|
|
2
|
-
import { dbClient_default, getFormattedConversationHistory, env, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-
|
|
2
|
+
import { dbClient_default, getFormattedConversationHistory, env, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-ETRXGI47.js';
|
|
3
3
|
import { __publicField } from './chunk-PKBMQBKP.js';
|
|
4
4
|
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, dbResultToMcpTool, validateAndGetApiKey, getProject, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getContextConfigById, getFullGraphDefinition, TemplateEngine, graphHasArtifactComponents, MCPTransportType, getExternalAgent } from '@inkeep/agents-core';
|
|
5
5
|
import { otel } from '@hono/otel';
|
|
@@ -2087,7 +2087,7 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
2087
2087
|
);
|
|
2088
2088
|
}
|
|
2089
2089
|
span.setAttributes({ "validation.passed": true });
|
|
2090
|
-
const { getFormattedConversationHistory: getFormattedConversationHistory2 } = await import('./conversations-
|
|
2090
|
+
const { getFormattedConversationHistory: getFormattedConversationHistory2 } = await import('./conversations-I6KHD42D.js');
|
|
2091
2091
|
const conversationHistory = await getFormattedConversationHistory2({
|
|
2092
2092
|
tenantId: artifactData.tenantId,
|
|
2093
2093
|
projectId: artifactData.projectId,
|
|
@@ -5198,7 +5198,7 @@ var Agent = class {
|
|
|
5198
5198
|
/**
|
|
5199
5199
|
* Convert database McpTool to builder MCPToolConfig format
|
|
5200
5200
|
*/
|
|
5201
|
-
convertToMCPToolConfig(tool4) {
|
|
5201
|
+
convertToMCPToolConfig(tool4, agentToolRelationHeaders) {
|
|
5202
5202
|
return {
|
|
5203
5203
|
id: tool4.id,
|
|
5204
5204
|
name: tool4.name,
|
|
@@ -5208,7 +5208,10 @@ var Agent = class {
|
|
|
5208
5208
|
activeTools: tool4.config.mcp.activeTools,
|
|
5209
5209
|
mcpType: tool4.config.mcp.server.url.includes("api.nango.dev") ? MCPServerType.nango : MCPServerType.generic,
|
|
5210
5210
|
transport: tool4.config.mcp.transport,
|
|
5211
|
-
headers:
|
|
5211
|
+
headers: {
|
|
5212
|
+
...tool4.headers,
|
|
5213
|
+
...agentToolRelationHeaders
|
|
5214
|
+
}
|
|
5212
5215
|
};
|
|
5213
5216
|
}
|
|
5214
5217
|
async getMcpTool(tool4) {
|
|
@@ -5221,6 +5224,7 @@ var Agent = class {
|
|
|
5221
5224
|
agentId: this.config.id
|
|
5222
5225
|
}
|
|
5223
5226
|
});
|
|
5227
|
+
const agentToolRelationHeaders = toolsForAgent.data.find((t) => t.toolId === tool4.id)?.headers || void 0;
|
|
5224
5228
|
const selectedTools = toolsForAgent.data.find((t) => t.toolId === tool4.id)?.selectedTools || void 0;
|
|
5225
5229
|
let serverConfig;
|
|
5226
5230
|
if (credentialReferenceId && this.credentialStuffer) {
|
|
@@ -5245,7 +5249,7 @@ var Agent = class {
|
|
|
5245
5249
|
contextConfigId: this.config.contextConfigId || void 0,
|
|
5246
5250
|
conversationId: this.conversationId || void 0
|
|
5247
5251
|
},
|
|
5248
|
-
this.convertToMCPToolConfig(tool4),
|
|
5252
|
+
this.convertToMCPToolConfig(tool4, agentToolRelationHeaders),
|
|
5249
5253
|
storeReference,
|
|
5250
5254
|
selectedTools
|
|
5251
5255
|
);
|
|
@@ -5257,7 +5261,7 @@ var Agent = class {
|
|
|
5257
5261
|
contextConfigId: this.config.contextConfigId || void 0,
|
|
5258
5262
|
conversationId: this.conversationId || void 0
|
|
5259
5263
|
},
|
|
5260
|
-
this.convertToMCPToolConfig(tool4),
|
|
5264
|
+
this.convertToMCPToolConfig(tool4, agentToolRelationHeaders),
|
|
5261
5265
|
void 0,
|
|
5262
5266
|
selectedTools
|
|
5263
5267
|
);
|
|
@@ -5266,7 +5270,8 @@ var Agent = class {
|
|
|
5266
5270
|
type: tool4.config.mcp.transport?.type || MCPTransportType.streamableHttp,
|
|
5267
5271
|
url: tool4.config.mcp.server.url,
|
|
5268
5272
|
activeTools: tool4.config.mcp.activeTools,
|
|
5269
|
-
selectedTools
|
|
5273
|
+
selectedTools,
|
|
5274
|
+
headers: agentToolRelationHeaders
|
|
5270
5275
|
};
|
|
5271
5276
|
}
|
|
5272
5277
|
logger15.info(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
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",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"traverse": "^0.6.11",
|
|
53
53
|
"ts-pattern": "^5.7.1",
|
|
54
54
|
"zod": "^4.1.5",
|
|
55
|
-
"@inkeep/agents-core": "^0.
|
|
55
|
+
"@inkeep/agents-core": "^0.8.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@hono/vite-dev-server": "^0.20.1",
|