@inkeep/agents-core 0.0.0-dev-20250911192304 → 0.0.0-dev-20250911210702
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/{chunk-355CYJ6K.js → chunk-M4JXMAG7.js} +1 -0
- package/dist/{chunk-DIBIH44H.js → chunk-PXIJWVD4.js} +4 -2
- package/dist/client-exports.d.cts +1 -1
- package/dist/client-exports.d.ts +1 -1
- package/dist/db/schema.cjs +1 -0
- package/dist/db/schema.d.cts +2 -2
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/{entities-B59eRwT_.d.cts → entities-Cl_yssfC.d.cts} +27 -0
- package/dist/{entities-B59eRwT_.d.ts → entities-Cl_yssfC.d.ts} +27 -0
- package/dist/index.cjs +118 -185
- package/dist/index.d.cts +27 -21
- package/dist/index.d.ts +27 -21
- package/dist/index.js +117 -161
- package/dist/{schema-B3zZJ85n.d.ts → schema-Baa5JhqR.d.ts} +20 -1
- package/dist/{schema-CzRwwW8E.d.cts → schema-BflhLoiw.d.cts} +20 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/validation/index.cjs +4 -1
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { TaskState } from './chunk-H2F72PDA.js';
|
|
2
|
-
import { ContextConfigApiUpdateSchema, validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-
|
|
3
|
-
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, resourceIdSchema, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-
|
|
4
|
-
import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-
|
|
5
|
-
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-
|
|
2
|
+
import { ContextConfigApiUpdateSchema, validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-PXIJWVD4.js';
|
|
3
|
+
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, HeadersScopeSchema, IdParamsSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, resourceIdSchema, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-PXIJWVD4.js';
|
|
4
|
+
import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-M4JXMAG7.js';
|
|
5
|
+
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-M4JXMAG7.js';
|
|
6
6
|
import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-SVGQSPW4.js';
|
|
7
7
|
export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-SVGQSPW4.js';
|
|
8
8
|
import { __publicField } from './chunk-MKBO26DX.js';
|
|
@@ -27,9 +27,6 @@ import { tool } from 'ai';
|
|
|
27
27
|
import { asyncExitHook, gracefulExit } from 'exit-hook';
|
|
28
28
|
import { match } from 'ts-pattern';
|
|
29
29
|
import { z as z$1 } from 'zod';
|
|
30
|
-
import fs from 'fs';
|
|
31
|
-
import path from 'path';
|
|
32
|
-
import * as dotenv from 'dotenv';
|
|
33
30
|
import { Nango } from '@nangohq/node';
|
|
34
31
|
|
|
35
32
|
// src/utils/logger.ts
|
|
@@ -68,8 +65,8 @@ var LoggerFactory = class {
|
|
|
68
65
|
/**
|
|
69
66
|
* Configure the logger factory
|
|
70
67
|
*/
|
|
71
|
-
configure(
|
|
72
|
-
this.config =
|
|
68
|
+
configure(config) {
|
|
69
|
+
this.config = config;
|
|
73
70
|
this.loggers.clear();
|
|
74
71
|
}
|
|
75
72
|
/**
|
|
@@ -102,8 +99,8 @@ var loggerFactory = new LoggerFactory();
|
|
|
102
99
|
function getLogger(name) {
|
|
103
100
|
return loggerFactory.getLogger(name);
|
|
104
101
|
}
|
|
105
|
-
function configureLogging(
|
|
106
|
-
loggerFactory.configure(
|
|
102
|
+
function configureLogging(config) {
|
|
103
|
+
loggerFactory.configure(config);
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
// src/context/ContextConfig.ts
|
|
@@ -416,8 +413,8 @@ var _TemplateEngine = class _TemplateEngine {
|
|
|
416
413
|
* Process variable substitutions {{variable.path}} using JMESPath
|
|
417
414
|
*/
|
|
418
415
|
static processVariables(template, context, options) {
|
|
419
|
-
return template.replace(/\{\{([^}]+)\}\}/g, (match2,
|
|
420
|
-
const trimmedPath =
|
|
416
|
+
return template.replace(/\{\{([^}]+)\}\}/g, (match2, path) => {
|
|
417
|
+
const trimmedPath = path.trim();
|
|
421
418
|
try {
|
|
422
419
|
if (trimmedPath.startsWith("$")) {
|
|
423
420
|
return _TemplateEngine.processBuiltinVariable(trimmedPath);
|
|
@@ -733,7 +730,7 @@ var CredentialStuffer = class {
|
|
|
733
730
|
/**
|
|
734
731
|
* Build MCP server configuration with credentials
|
|
735
732
|
*/
|
|
736
|
-
async buildMcpServerConfig(context, tool2, storeReference) {
|
|
733
|
+
async buildMcpServerConfig(context, tool2, storeReference, selectedTools) {
|
|
737
734
|
let credentialHeaders = {};
|
|
738
735
|
if (storeReference || tool2.headers) {
|
|
739
736
|
credentialHeaders = await this.getCredentialHeaders({
|
|
@@ -746,7 +743,8 @@ var CredentialStuffer = class {
|
|
|
746
743
|
const baseConfig = {
|
|
747
744
|
type: tool2.transport?.type || MCPTransportType.streamableHttp,
|
|
748
745
|
url: tool2.serverUrl,
|
|
749
|
-
activeTools: tool2.activeTools
|
|
746
|
+
activeTools: tool2.activeTools,
|
|
747
|
+
selectedTools
|
|
750
748
|
};
|
|
751
749
|
if (baseConfig.type === MCPTransportType.streamableHttp || baseConfig.type === MCPTransportType.sse) {
|
|
752
750
|
const httpConfig = {
|
|
@@ -762,14 +760,14 @@ var CredentialStuffer = class {
|
|
|
762
760
|
return baseConfig;
|
|
763
761
|
}
|
|
764
762
|
};
|
|
765
|
-
function createDatabaseClient(
|
|
763
|
+
function createDatabaseClient(config) {
|
|
766
764
|
const client = createClient({
|
|
767
|
-
url:
|
|
768
|
-
authToken:
|
|
765
|
+
url: config.url,
|
|
766
|
+
authToken: config.authToken
|
|
769
767
|
});
|
|
770
768
|
return drizzle(client, {
|
|
771
769
|
schema: schema_exports,
|
|
772
|
-
logger:
|
|
770
|
+
logger: config.logger
|
|
773
771
|
});
|
|
774
772
|
}
|
|
775
773
|
function createInMemoryDatabaseClient() {
|
|
@@ -1014,7 +1012,8 @@ var createAgentToolRelation = (db) => async (params) => {
|
|
|
1014
1012
|
tenantId: params.scopes.tenantId,
|
|
1015
1013
|
projectId: params.scopes.projectId,
|
|
1016
1014
|
agentId: params.data.agentId,
|
|
1017
|
-
toolId: params.data.toolId
|
|
1015
|
+
toolId: params.data.toolId,
|
|
1016
|
+
selectedTools: params.data.selectedTools
|
|
1018
1017
|
}).returning();
|
|
1019
1018
|
return relation[0];
|
|
1020
1019
|
};
|
|
@@ -1169,6 +1168,7 @@ var getToolsForAgent = (db) => async (params) => {
|
|
|
1169
1168
|
tenantId: agentToolRelations.tenantId,
|
|
1170
1169
|
agentId: agentToolRelations.agentId,
|
|
1171
1170
|
toolId: agentToolRelations.toolId,
|
|
1171
|
+
selectedTools: agentToolRelations.selectedTools,
|
|
1172
1172
|
createdAt: agentToolRelations.createdAt,
|
|
1173
1173
|
updatedAt: agentToolRelations.updatedAt,
|
|
1174
1174
|
tool: {
|
|
@@ -1216,6 +1216,7 @@ var getAgentsForTool = (db) => async (params) => {
|
|
|
1216
1216
|
tenantId: agentToolRelations.tenantId,
|
|
1217
1217
|
agentId: agentToolRelations.agentId,
|
|
1218
1218
|
toolId: agentToolRelations.toolId,
|
|
1219
|
+
selectedTools: agentToolRelations.selectedTools,
|
|
1219
1220
|
createdAt: agentToolRelations.createdAt,
|
|
1220
1221
|
updatedAt: agentToolRelations.updatedAt,
|
|
1221
1222
|
agent: {
|
|
@@ -1800,14 +1801,14 @@ var deleteAgentGraph = (db) => async (params) => {
|
|
|
1800
1801
|
).returning();
|
|
1801
1802
|
return result.length > 0;
|
|
1802
1803
|
};
|
|
1803
|
-
var fetchComponentRelationships = (db) => async (scopes, agentIds,
|
|
1804
|
+
var fetchComponentRelationships = (db) => async (scopes, agentIds, config) => {
|
|
1804
1805
|
const componentsObject = {};
|
|
1805
1806
|
if (agentIds.length > 0) {
|
|
1806
|
-
const results = await db.select(
|
|
1807
|
+
const results = await db.select(config.selectFields).from(config.relationTable).innerJoin(config.componentTable, eq(config.relationIdField, config.componentIdField)).where(
|
|
1807
1808
|
and(
|
|
1808
|
-
eq(
|
|
1809
|
-
eq(
|
|
1810
|
-
inArray(
|
|
1809
|
+
eq(config.relationTable.tenantId, scopes.tenantId),
|
|
1810
|
+
eq(config.relationTable.projectId, scopes.projectId),
|
|
1811
|
+
inArray(config.relationTable.agentId, agentIds)
|
|
1811
1812
|
)
|
|
1812
1813
|
);
|
|
1813
1814
|
for (const component of results) {
|
|
@@ -1915,7 +1916,8 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
1915
1916
|
lastHealthCheck: tools.lastHealthCheck,
|
|
1916
1917
|
lastError: tools.lastError,
|
|
1917
1918
|
availableTools: tools.availableTools,
|
|
1918
|
-
lastToolsSync: tools.lastToolsSync
|
|
1919
|
+
lastToolsSync: tools.lastToolsSync,
|
|
1920
|
+
selectedTools: agentToolRelations.selectedTools
|
|
1919
1921
|
}).from(agentToolRelations).innerJoin(tools, eq(agentToolRelations.toolId, tools.id)).where(
|
|
1920
1922
|
and(eq(agentToolRelations.tenantId, tenantId), eq(agentToolRelations.agentId, agentId))
|
|
1921
1923
|
);
|
|
@@ -1935,6 +1937,12 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
1935
1937
|
const agentArtifactComponentIds = agentArtifactComponentRelations.map(
|
|
1936
1938
|
(rel) => rel.artifactComponentId
|
|
1937
1939
|
);
|
|
1940
|
+
const selectedTools = {};
|
|
1941
|
+
agentTools.forEach((tool2) => {
|
|
1942
|
+
if (tool2.selectedTools && Array.isArray(tool2.selectedTools)) {
|
|
1943
|
+
selectedTools[tool2.id] = tool2.selectedTools;
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1938
1946
|
return {
|
|
1939
1947
|
id: agent.id,
|
|
1940
1948
|
name: agent.name,
|
|
@@ -1946,6 +1954,7 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
1946
1954
|
canDelegateTo,
|
|
1947
1955
|
dataComponents: agentDataComponentIds,
|
|
1948
1956
|
artifactComponents: agentArtifactComponentIds,
|
|
1957
|
+
...Object.keys(selectedTools).length > 0 && { selectedTools },
|
|
1949
1958
|
tools: agentTools.map((tool2) => ({
|
|
1950
1959
|
id: tool2.id,
|
|
1951
1960
|
name: tool2.name,
|
|
@@ -1994,14 +2003,19 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
1994
2003
|
} else {
|
|
1995
2004
|
const toolsData = agent.tools || [];
|
|
1996
2005
|
const toolIds = [];
|
|
2006
|
+
const agentSelectedTools = {};
|
|
1997
2007
|
for (const tool2 of toolsData) {
|
|
1998
2008
|
toolsObject[tool2.id] = tool2;
|
|
1999
2009
|
toolIds.push(tool2.id);
|
|
2010
|
+
if (tool2.selectedTools !== null && tool2.selectedTools !== void 0) {
|
|
2011
|
+
agentSelectedTools[tool2.id] = tool2.selectedTools;
|
|
2012
|
+
}
|
|
2000
2013
|
}
|
|
2001
2014
|
agentsObject[agent.id] = {
|
|
2002
2015
|
...agent,
|
|
2003
|
-
tools: toolIds
|
|
2016
|
+
tools: toolIds,
|
|
2004
2017
|
// Replace tool objects with tool IDs
|
|
2018
|
+
...Object.keys(agentSelectedTools).length > 0 && { selectedTools: agentSelectedTools }
|
|
2005
2019
|
};
|
|
2006
2020
|
}
|
|
2007
2021
|
}
|
|
@@ -3422,6 +3436,7 @@ var addToolToAgent = (db) => async (params) => {
|
|
|
3422
3436
|
projectId: params.scopes.projectId,
|
|
3423
3437
|
agentId: params.agentId,
|
|
3424
3438
|
toolId: params.toolId,
|
|
3439
|
+
selectedTools: params.selectedTools,
|
|
3425
3440
|
createdAt: now,
|
|
3426
3441
|
updatedAt: now
|
|
3427
3442
|
}).returning();
|
|
@@ -3450,7 +3465,15 @@ var upsertAgentToolRelation = (db) => async (params) => {
|
|
|
3450
3465
|
if (!existing) {
|
|
3451
3466
|
return await addToolToAgent(db)(params);
|
|
3452
3467
|
}
|
|
3453
|
-
return
|
|
3468
|
+
return await updateAgentToolRelation(db)({
|
|
3469
|
+
scopes: params.scopes,
|
|
3470
|
+
relationId: existing.id,
|
|
3471
|
+
data: {
|
|
3472
|
+
agentId: params.agentId,
|
|
3473
|
+
toolId: params.toolId,
|
|
3474
|
+
selectedTools: params.selectedTools
|
|
3475
|
+
}
|
|
3476
|
+
});
|
|
3454
3477
|
};
|
|
3455
3478
|
var updateToolStatus = (db) => async (params) => {
|
|
3456
3479
|
return updateTool(db)({
|
|
@@ -3808,11 +3831,13 @@ var createFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
|
|
|
3808
3831
|
agentToolPromises.push(
|
|
3809
3832
|
(async () => {
|
|
3810
3833
|
try {
|
|
3834
|
+
const selectedTools = agentData.selectedTools?.[toolId];
|
|
3811
3835
|
logger11.info({ agentId, toolId }, "Processing agent-tool relation");
|
|
3812
3836
|
await upsertAgentToolRelation(db)({
|
|
3813
3837
|
scopes: { tenantId, projectId },
|
|
3814
3838
|
agentId,
|
|
3815
|
-
toolId
|
|
3839
|
+
toolId,
|
|
3840
|
+
selectedTools
|
|
3816
3841
|
});
|
|
3817
3842
|
logger11.info({ agentId, toolId }, "Agent-tool relation processed successfully");
|
|
3818
3843
|
} catch (error) {
|
|
@@ -4280,11 +4305,13 @@ var updateFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
|
|
|
4280
4305
|
agentToolPromises.push(
|
|
4281
4306
|
(async () => {
|
|
4282
4307
|
try {
|
|
4308
|
+
const selectedTools = agentData.selectedTools?.[toolId];
|
|
4283
4309
|
await createAgentToolRelation(db)({
|
|
4284
4310
|
scopes: { tenantId, projectId },
|
|
4285
4311
|
data: {
|
|
4286
4312
|
agentId,
|
|
4287
|
-
toolId
|
|
4313
|
+
toolId,
|
|
4314
|
+
selectedTools
|
|
4288
4315
|
}
|
|
4289
4316
|
});
|
|
4290
4317
|
logger11.info({ agentId, toolId }, "Agent-tool relation created");
|
|
@@ -5057,8 +5084,8 @@ var tryWellKnownEndpoints = async (baseUrl, logger11) => {
|
|
|
5057
5084
|
return null;
|
|
5058
5085
|
};
|
|
5059
5086
|
var checkForOAuthEndpoints = async (serverUrl, logger11) => {
|
|
5060
|
-
const
|
|
5061
|
-
return
|
|
5087
|
+
const config = await discoverOAuthEndpoints(serverUrl, logger11);
|
|
5088
|
+
return config !== null;
|
|
5062
5089
|
};
|
|
5063
5090
|
var discoverOAuthEndpoints = async (serverUrl, logger11) => {
|
|
5064
5091
|
try {
|
|
@@ -5438,7 +5465,7 @@ var McpClient = class {
|
|
|
5438
5465
|
}
|
|
5439
5466
|
async connect() {
|
|
5440
5467
|
if (this.connected) return;
|
|
5441
|
-
await match(this.serverConfig).with({ type: MCPTransportType.streamableHttp }, (
|
|
5468
|
+
await match(this.serverConfig).with({ type: MCPTransportType.streamableHttp }, (config) => this.connectHttp(config)).with({ type: MCPTransportType.sse }, (config) => this.connectSSE(config)).exhaustive();
|
|
5442
5469
|
this.connected = true;
|
|
5443
5470
|
const close = this.client.onclose;
|
|
5444
5471
|
this.client.onclose = () => {
|
|
@@ -5450,25 +5477,25 @@ var McpClient = class {
|
|
|
5450
5477
|
asyncExitHook(() => this.disconnect(), { wait: 5e3 });
|
|
5451
5478
|
process.on("SIGTERM", () => gracefulExit());
|
|
5452
5479
|
}
|
|
5453
|
-
async connectSSE(
|
|
5454
|
-
const url = typeof
|
|
5480
|
+
async connectSSE(config) {
|
|
5481
|
+
const url = typeof config.url === "string" ? config.url : config.url.toString();
|
|
5455
5482
|
this.transport = new SSEClientTransport(new URL(url), {
|
|
5456
|
-
eventSourceInit:
|
|
5483
|
+
eventSourceInit: config.eventSourceInit,
|
|
5457
5484
|
requestInit: {
|
|
5458
|
-
headers:
|
|
5485
|
+
headers: config.headers || {}
|
|
5459
5486
|
}
|
|
5460
5487
|
});
|
|
5461
5488
|
await this.client.connect(this.transport, {
|
|
5462
|
-
timeout:
|
|
5489
|
+
timeout: config.timeout ?? this.timeout
|
|
5463
5490
|
});
|
|
5464
5491
|
}
|
|
5465
|
-
async connectHttp(
|
|
5466
|
-
const { url, requestInit } =
|
|
5492
|
+
async connectHttp(config) {
|
|
5493
|
+
const { url, requestInit } = config;
|
|
5467
5494
|
const mergedRequestInit = {
|
|
5468
5495
|
...requestInit,
|
|
5469
5496
|
headers: {
|
|
5470
5497
|
...requestInit?.headers || {},
|
|
5471
|
-
...
|
|
5498
|
+
...config.headers || {}
|
|
5472
5499
|
}
|
|
5473
5500
|
};
|
|
5474
5501
|
const urlObj = new URL(url);
|
|
@@ -5479,9 +5506,9 @@ var McpClient = class {
|
|
|
5479
5506
|
maxReconnectionDelay: 3e4,
|
|
5480
5507
|
initialReconnectionDelay: 1e3,
|
|
5481
5508
|
reconnectionDelayGrowFactor: 1.5,
|
|
5482
|
-
...
|
|
5509
|
+
...config.reconnectionOptions
|
|
5483
5510
|
},
|
|
5484
|
-
sessionId:
|
|
5511
|
+
sessionId: config.sessionId
|
|
5485
5512
|
});
|
|
5486
5513
|
await this.client.connect(this.transport, { timeout: 3e3 });
|
|
5487
5514
|
}
|
|
@@ -5508,11 +5535,18 @@ var McpClient = class {
|
|
|
5508
5535
|
}
|
|
5509
5536
|
async selectTools() {
|
|
5510
5537
|
const { tools: tools2 } = await this.client.listTools({ timeout: this.timeout });
|
|
5511
|
-
const { activeTools } = this.serverConfig;
|
|
5512
|
-
|
|
5538
|
+
const { selectedTools, activeTools } = this.serverConfig;
|
|
5539
|
+
let toolsToFilter;
|
|
5540
|
+
if (selectedTools && selectedTools.length > 0) {
|
|
5541
|
+
toolsToFilter = selectedTools;
|
|
5542
|
+
} else if (activeTools && activeTools.length > 0) {
|
|
5543
|
+
toolsToFilter = activeTools;
|
|
5544
|
+
} else {
|
|
5545
|
+
return tools2;
|
|
5546
|
+
}
|
|
5513
5547
|
const toolNames = tools2.map((tool2) => tool2.name);
|
|
5514
|
-
this.validateSelectedTools(toolNames,
|
|
5515
|
-
return tools2.filter((tool2) =>
|
|
5548
|
+
this.validateSelectedTools(toolNames, toolsToFilter);
|
|
5549
|
+
return tools2.filter((tool2) => toolsToFilter.includes(tool2.name));
|
|
5516
5550
|
}
|
|
5517
5551
|
async tools() {
|
|
5518
5552
|
const tools2 = await this.selectTools();
|
|
@@ -5578,52 +5612,7 @@ var McpClient = class {
|
|
|
5578
5612
|
return results;
|
|
5579
5613
|
}
|
|
5580
5614
|
};
|
|
5581
|
-
dotenv.config({ quiet: true });
|
|
5582
|
-
var environmentSchema = z$1.enum(["development", "pentest", "production", "test"]);
|
|
5583
|
-
var criticalEnv = z$1.object({
|
|
5584
|
-
ENVIRONMENT: environmentSchema
|
|
5585
|
-
}).parse(process.env);
|
|
5586
|
-
var loadEnvFile = () => {
|
|
5587
|
-
const envPath = path.resolve(process.cwd(), `.env.${criticalEnv.ENVIRONMENT}.nonsecret`);
|
|
5588
|
-
if (fs.existsSync(envPath)) {
|
|
5589
|
-
const envConfig = dotenv.parse(fs.readFileSync(envPath));
|
|
5590
|
-
for (const k in envConfig) {
|
|
5591
|
-
if (!(k in process.env)) {
|
|
5592
|
-
process.env[k] = envConfig[k];
|
|
5593
|
-
}
|
|
5594
|
-
}
|
|
5595
|
-
}
|
|
5596
|
-
};
|
|
5597
|
-
loadEnvFile();
|
|
5598
|
-
var envSchema = z$1.object({
|
|
5599
|
-
ENVIRONMENT: z$1.enum(["development", "production", "pentest", "test"]).optional(),
|
|
5600
|
-
DB_FILE_NAME: z$1.string().default("file:../../local.db"),
|
|
5601
|
-
OTEL_TRACES_FORCE_FLUSH_ENABLED: z$1.stringbool().optional()
|
|
5602
|
-
});
|
|
5603
|
-
var parseEnv = () => {
|
|
5604
|
-
try {
|
|
5605
|
-
const parsedEnv = envSchema.parse(process.env);
|
|
5606
|
-
return parsedEnv;
|
|
5607
|
-
} catch (error) {
|
|
5608
|
-
if (error instanceof z$1.ZodError) {
|
|
5609
|
-
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
5610
|
-
throw new Error(
|
|
5611
|
-
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
5612
|
-
${error.message}`
|
|
5613
|
-
);
|
|
5614
|
-
}
|
|
5615
|
-
throw error;
|
|
5616
|
-
}
|
|
5617
|
-
};
|
|
5618
|
-
var env = parseEnv();
|
|
5619
|
-
|
|
5620
|
-
// src/utils/tracer.ts
|
|
5621
5615
|
var logger4 = getLogger("tracer");
|
|
5622
|
-
var FORCE_FLUSH_ENVIRONMENTS = ["development"];
|
|
5623
|
-
var BASE = "inkeep-chat";
|
|
5624
|
-
var SERVICE_NAME = "inkeep-chat";
|
|
5625
|
-
var SERVICE_VERSION = "1.0.0";
|
|
5626
|
-
var createSpanName = (suffix) => `${BASE}.${suffix}`;
|
|
5627
5616
|
var createNoOpSpan = () => ({
|
|
5628
5617
|
setAttributes: () => ({}),
|
|
5629
5618
|
recordException: () => ({}),
|
|
@@ -5652,8 +5641,7 @@ var noopTracer = {
|
|
|
5652
5641
|
return createNoOpSpan();
|
|
5653
5642
|
}
|
|
5654
5643
|
};
|
|
5655
|
-
|
|
5656
|
-
function handleSpanError(span, error, logger11, logMessage) {
|
|
5644
|
+
function setSpanWithError(span, error, logger11, logMessage) {
|
|
5657
5645
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5658
5646
|
span.recordException(error);
|
|
5659
5647
|
span.setStatus({
|
|
@@ -5664,45 +5652,21 @@ function handleSpanError(span, error, logger11, logMessage) {
|
|
|
5664
5652
|
logger11.error({ error: errorMessage }, logMessage);
|
|
5665
5653
|
}
|
|
5666
5654
|
}
|
|
5667
|
-
function
|
|
5668
|
-
if (!globalTracerInstance) {
|
|
5669
|
-
try {
|
|
5670
|
-
globalTracerInstance = trace.getTracer(SERVICE_NAME, SERVICE_VERSION);
|
|
5671
|
-
} catch (error) {
|
|
5672
|
-
logger4.debug(
|
|
5673
|
-
{ error: error instanceof Error ? error.message : "Unknown error" },
|
|
5674
|
-
"OpenTelemetry tracer not available, using no-op tracer"
|
|
5675
|
-
);
|
|
5676
|
-
globalTracerInstance = noopTracer;
|
|
5677
|
-
}
|
|
5678
|
-
}
|
|
5679
|
-
return globalTracerInstance;
|
|
5680
|
-
}
|
|
5681
|
-
async function forceFlushTracer() {
|
|
5682
|
-
const isOtelTracesForceFlushEnabled = env.OTEL_TRACES_FORCE_FLUSH_ENABLED;
|
|
5683
|
-
const isForceFlushEnvironment = env.ENVIRONMENT && FORCE_FLUSH_ENVIRONMENTS.includes(env.ENVIRONMENT);
|
|
5684
|
-
const shouldForceFlush = isOtelTracesForceFlushEnabled === true || isOtelTracesForceFlushEnabled == null && isForceFlushEnvironment;
|
|
5685
|
-
if (!shouldForceFlush) {
|
|
5686
|
-
return;
|
|
5687
|
-
}
|
|
5655
|
+
function getTracer(serviceName, serviceVersion) {
|
|
5688
5656
|
try {
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
{ message: "Tracer provider force flush completed" },
|
|
5694
|
-
"Tracer provider force flush completed"
|
|
5695
|
-
);
|
|
5696
|
-
} else {
|
|
5697
|
-
logger4.debug(
|
|
5698
|
-
{ message: "Tracer provider does not support force flush or is not available" },
|
|
5699
|
-
"Tracer provider does not support force flush or is not available"
|
|
5700
|
-
);
|
|
5701
|
-
}
|
|
5702
|
-
} catch (error) {
|
|
5703
|
-
logger4.warn({ error }, "Failed to force flush tracer");
|
|
5657
|
+
return trace.getTracer(serviceName, serviceVersion);
|
|
5658
|
+
} catch (_error) {
|
|
5659
|
+
logger4.debug({}, "OpenTelemetry tracer not available, using no-op tracer");
|
|
5660
|
+
return noopTracer;
|
|
5704
5661
|
}
|
|
5705
5662
|
}
|
|
5663
|
+
|
|
5664
|
+
// package.json
|
|
5665
|
+
var package_default = {
|
|
5666
|
+
version: "0.0.0-dev-20250911210702"};
|
|
5667
|
+
|
|
5668
|
+
// src/utils/tracer.ts
|
|
5669
|
+
var tracer = getTracer("agents-core", package_default.version);
|
|
5706
5670
|
var logger5 = getLogger("context-cache");
|
|
5707
5671
|
var ContextCache = class {
|
|
5708
5672
|
constructor(tenantId, projectId, dbClient) {
|
|
@@ -5898,7 +5862,6 @@ var ContextCache = class {
|
|
|
5898
5862
|
|
|
5899
5863
|
// src/context/ContextResolver.ts
|
|
5900
5864
|
var logger6 = getLogger("context-resolver");
|
|
5901
|
-
var tracer = getGlobalTracer();
|
|
5902
5865
|
var ContextResolver = class {
|
|
5903
5866
|
constructor(tenantId, projectId, dbClient, credentialStoreRegistry) {
|
|
5904
5867
|
__publicField(this, "fetcher");
|
|
@@ -5931,7 +5894,7 @@ var ContextResolver = class {
|
|
|
5931
5894
|
"Starting context resolution"
|
|
5932
5895
|
);
|
|
5933
5896
|
return tracer.startActiveSpan(
|
|
5934
|
-
|
|
5897
|
+
"context.resolve",
|
|
5935
5898
|
{
|
|
5936
5899
|
attributes: {
|
|
5937
5900
|
"context.config_id": contextConfig2.id,
|
|
@@ -6083,7 +6046,7 @@ var ContextResolver = class {
|
|
|
6083
6046
|
return result;
|
|
6084
6047
|
} catch (error) {
|
|
6085
6048
|
const durationMs = Date.now() - startTime;
|
|
6086
|
-
|
|
6049
|
+
setSpanWithError(parentSpan, error);
|
|
6087
6050
|
logger6.error(
|
|
6088
6051
|
{
|
|
6089
6052
|
contextConfigId: contextConfig2.id,
|
|
@@ -6104,7 +6067,7 @@ var ContextResolver = class {
|
|
|
6104
6067
|
*/
|
|
6105
6068
|
async resolveSingleFetchDefinition(contextConfig2, definition, templateKey, options, requestHash, result) {
|
|
6106
6069
|
return tracer.startActiveSpan(
|
|
6107
|
-
|
|
6070
|
+
"context-resolver.resolve_single_fetch_definition",
|
|
6108
6071
|
{
|
|
6109
6072
|
attributes: {
|
|
6110
6073
|
"context.definition_id": definition.id,
|
|
@@ -6189,7 +6152,7 @@ var ContextResolver = class {
|
|
|
6189
6152
|
"Context variable resolved and cached"
|
|
6190
6153
|
);
|
|
6191
6154
|
} catch (error) {
|
|
6192
|
-
|
|
6155
|
+
setSpanWithError(parentSpan, error);
|
|
6193
6156
|
throw error;
|
|
6194
6157
|
} finally {
|
|
6195
6158
|
parentSpan.end();
|
|
@@ -6780,21 +6743,21 @@ var ContextFetcher = class {
|
|
|
6780
6743
|
/**
|
|
6781
6744
|
* Perform HTTP request
|
|
6782
6745
|
*/
|
|
6783
|
-
async performRequest(
|
|
6746
|
+
async performRequest(config) {
|
|
6784
6747
|
const startTime = Date.now();
|
|
6785
6748
|
try {
|
|
6786
6749
|
logger8.debug(
|
|
6787
6750
|
{
|
|
6788
|
-
url:
|
|
6789
|
-
method:
|
|
6751
|
+
url: config.url,
|
|
6752
|
+
method: config.method
|
|
6790
6753
|
},
|
|
6791
6754
|
"Performing HTTP request"
|
|
6792
6755
|
);
|
|
6793
|
-
const response = await fetch(
|
|
6794
|
-
method:
|
|
6795
|
-
headers:
|
|
6796
|
-
body:
|
|
6797
|
-
signal: AbortSignal.timeout(
|
|
6756
|
+
const response = await fetch(config.url, {
|
|
6757
|
+
method: config.method,
|
|
6758
|
+
headers: config.headers,
|
|
6759
|
+
body: config.body ? JSON.stringify(config.body) : void 0,
|
|
6760
|
+
signal: AbortSignal.timeout(config.timeout || this.defaultTimeout)
|
|
6798
6761
|
});
|
|
6799
6762
|
if (!response.ok) {
|
|
6800
6763
|
const errorText = await response.text();
|
|
@@ -6814,7 +6777,7 @@ var ContextFetcher = class {
|
|
|
6814
6777
|
}
|
|
6815
6778
|
return {
|
|
6816
6779
|
data,
|
|
6817
|
-
source:
|
|
6780
|
+
source: config.url,
|
|
6818
6781
|
durationMs
|
|
6819
6782
|
};
|
|
6820
6783
|
} catch (error) {
|
|
@@ -6822,7 +6785,7 @@ var ContextFetcher = class {
|
|
|
6822
6785
|
const requestError = error instanceof Error ? error : new Error("Unknown error");
|
|
6823
6786
|
logger8.warn(
|
|
6824
6787
|
{
|
|
6825
|
-
url:
|
|
6788
|
+
url: config.url,
|
|
6826
6789
|
error: requestError.message,
|
|
6827
6790
|
durationMs
|
|
6828
6791
|
},
|
|
@@ -6910,7 +6873,6 @@ var ContextFetcher = class {
|
|
|
6910
6873
|
}
|
|
6911
6874
|
};
|
|
6912
6875
|
var logger9 = getLogger("context");
|
|
6913
|
-
var tracer2 = getGlobalTracer();
|
|
6914
6876
|
async function determineContextTrigger(tenantId, projectId, conversationId, dbClient) {
|
|
6915
6877
|
const conversation = await getConversation(dbClient)({
|
|
6916
6878
|
scopes: { tenantId, projectId },
|
|
@@ -6941,8 +6903,8 @@ async function handleContextConfigChange(tenantId, projectId, conversationId, gr
|
|
|
6941
6903
|
}
|
|
6942
6904
|
}
|
|
6943
6905
|
async function handleContextResolution(tenantId, projectId, conversationId, graphId, requestContext, dbClient, credentialStores) {
|
|
6944
|
-
return
|
|
6945
|
-
|
|
6906
|
+
return tracer.startActiveSpan(
|
|
6907
|
+
"context.handle_context_resolution",
|
|
6946
6908
|
{
|
|
6947
6909
|
attributes: {
|
|
6948
6910
|
"context.request_context_keys": Object.keys(requestContext)
|
|
@@ -7017,7 +6979,6 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
7017
6979
|
} else {
|
|
7018
6980
|
parentSpan.setStatus({ code: SpanStatusCode.OK });
|
|
7019
6981
|
}
|
|
7020
|
-
await forceFlushTracer();
|
|
7021
6982
|
logger9.info(
|
|
7022
6983
|
{
|
|
7023
6984
|
conversationId,
|
|
@@ -7035,15 +6996,11 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
7035
6996
|
return resolvedContext;
|
|
7036
6997
|
} catch (error) {
|
|
7037
6998
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
7038
|
-
parentSpan.recordException(error);
|
|
7039
6999
|
parentSpan.setAttributes({
|
|
7040
7000
|
"context.final_status": "failed",
|
|
7041
7001
|
"context.error_message": errorMessage
|
|
7042
7002
|
});
|
|
7043
|
-
parentSpan
|
|
7044
|
-
code: SpanStatusCode.ERROR,
|
|
7045
|
-
message: errorMessage
|
|
7046
|
-
});
|
|
7003
|
+
setSpanWithError(parentSpan, error);
|
|
7047
7004
|
logger9.error(
|
|
7048
7005
|
{
|
|
7049
7006
|
error: errorMessage,
|
|
@@ -7057,7 +7014,6 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
7057
7014
|
},
|
|
7058
7015
|
"Failed to resolve context, proceeding without context resolution"
|
|
7059
7016
|
);
|
|
7060
|
-
await forceFlushTracer();
|
|
7061
7017
|
return null;
|
|
7062
7018
|
} finally {
|
|
7063
7019
|
parentSpan.end();
|
|
@@ -7407,13 +7363,13 @@ function isSupportedAuthMode(mode) {
|
|
|
7407
7363
|
return SUPPORTED_AUTH_MODES.includes(mode);
|
|
7408
7364
|
}
|
|
7409
7365
|
var NangoCredentialStore = class {
|
|
7410
|
-
constructor(id,
|
|
7366
|
+
constructor(id, config) {
|
|
7411
7367
|
__publicField(this, "id");
|
|
7412
7368
|
__publicField(this, "type", CredentialStoreType.nango);
|
|
7413
7369
|
__publicField(this, "nangoConfig");
|
|
7414
7370
|
__publicField(this, "nangoClient");
|
|
7415
7371
|
this.id = id;
|
|
7416
|
-
this.nangoConfig =
|
|
7372
|
+
this.nangoConfig = config;
|
|
7417
7373
|
this.nangoClient = new Nango({
|
|
7418
7374
|
secretKey: this.nangoConfig.secretKey,
|
|
7419
7375
|
host: this.nangoConfig.apiUrl
|
|
@@ -7640,8 +7596,8 @@ var NangoCredentialStore = class {
|
|
|
7640
7596
|
}
|
|
7641
7597
|
}
|
|
7642
7598
|
};
|
|
7643
|
-
function createNangoCredentialStore(id,
|
|
7644
|
-
const nangoSecretKey =
|
|
7599
|
+
function createNangoCredentialStore(id, config) {
|
|
7600
|
+
const nangoSecretKey = config?.secretKey || process.env.NANGO_SECRET_KEY;
|
|
7645
7601
|
if (!nangoSecretKey || nangoSecretKey === "your_nango_secret_key" || nangoSecretKey.includes("mock")) {
|
|
7646
7602
|
throw new Error(
|
|
7647
7603
|
"NANGO_SECRET_KEY environment variable is required and must be a real Nango secret key (not mock/placeholder)"
|
|
@@ -7649,7 +7605,7 @@ function createNangoCredentialStore(id, config2) {
|
|
|
7649
7605
|
}
|
|
7650
7606
|
return new NangoCredentialStore(id, {
|
|
7651
7607
|
apiUrl: "https://api.nango.dev",
|
|
7652
|
-
...
|
|
7608
|
+
...config,
|
|
7653
7609
|
secretKey: nangoSecretKey
|
|
7654
7610
|
});
|
|
7655
7611
|
}
|
|
@@ -7670,4 +7626,4 @@ function createDefaultCredentialStores() {
|
|
|
7670
7626
|
return stores;
|
|
7671
7627
|
}
|
|
7672
7628
|
|
|
7673
|
-
export {
|
|
7629
|
+
export { ConsoleLogger, ContextCache, ContextConfigBuilder, ContextFetcher, ContextResolver, CredentialStoreRegistry, CredentialStuffer, ERROR_DOCS_BASE_URL, ErrorCode, HTTP_REQUEST_PARTS, InMemoryCredentialStore, KeyChainStore, McpClient, NangoCredentialStore, NoOpLogger, TemplateEngine, addLedgerArtifacts, addToolToAgent, associateArtifactComponentWithAgent, associateDataComponentWithAgent, cleanupTenantCache, clearContextConfigCache, clearConversationCache, commonCreateErrorResponses, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, configureLogging, contextConfig, contextValidationMiddleware, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, createAgent, createAgentGraph, createAgentRelation, createAgentToolRelation, createApiError, createApiKey, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDatabaseClient, createDefaultCredentialStores, createExecutionContext, createExternalAgent, createExternalAgentRelation, createFullGraphServerSide, createInMemoryDatabaseClient, createKeyChainStore, createMessage, createNangoCredentialStore, createOrGetConversation, createProject, createTask, createTool, createValidatedDataAccess, dbResultToMcpTool, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentGraph, deleteAgentRelation, deleteAgentRelationsByGraph, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteApiKey, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteExternalAgent, deleteFullGraph, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMessage, deleteProject, deleteTool, detectAuthenticationRequired, determineContextTrigger, discoverOAuthEndpoints, errorResponseSchema, errorSchemaFactory, externalAgentExists, externalAgentUrlExists, extractPublicId, fetchComponentRelationships, fetchDefinition, generateAndCreateApiKey, generateApiKey, getActiveAgentForConversation, getAgentById, getAgentGraph, getAgentGraphById, getAgentGraphWithDefaultAgent, getAgentInGraphContext, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByGraph, getAgentRelationsBySource, getAgentRelationsByTarget, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsByIds, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getCachedValidator, getContextConfigById, getContextConfigCacheEntries, getContextConfigsByName, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithTools, getCredentialStoreLookupKeyFromRetrievalParams, getDataComponent, getDataComponentsForAgent, getExternalAgent, getExternalAgentByUrl, getExternalAgentRelations, getFullGraph, getFullGraphDefinition, getGraphAgentInfos, getHealthyToolsForAgent, getLedgerArtifacts, getLedgerArtifactsByContext, getLogger, getMessageById, getMessagesByConversation, getMessagesByTask, getProject, getProjectResourceCounts, getRelatedAgentsForGraph, getRequestExecutionContext, getTask, getToolById, getToolsByStatus, getToolsForAgent, getTracer, getVisibleMessages, graphHasArtifactComponents, handleApiError, handleContextConfigChange, handleContextResolution, hasApiKey, hasContextConfig, hasCredentialReference, hashApiKey, invalidateInvocationDefinitionsCache, invalidateRequestContextCache, isApiKeyExpired, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isValidHttpRequest, listAgentGraphs, listAgentGraphsPaginated, listAgentRelations, listAgentToolRelations, listAgentToolRelationsByAgent, listAgents, listAgentsPaginated, listApiKeys, listApiKeysPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listExternalAgents, listExternalAgentsPaginated, listMessages, listProjects, listProjectsPaginated, listTaskIdsByContextId, listTools, listToolsByStatus, loggerFactory, maskApiKey, problemDetailsSchema, projectExists, projectExistsInTable, projectHasResources, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeToolFromAgent, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setSpanWithError, updateAgent, updateAgentGraph, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveAgent, updateCredentialReference, updateDataComponent, updateExternalAgent, updateFullGraphServerSide, updateMessage, updateProject, updateTask, updateTool, updateToolStatus, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertAgentGraph, upsertAgentRelation, upsertAgentToolRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertTool, validateAgainstJsonSchema, validateAndGetApiKey, validateApiKey, validateExternalAgent, validateHttpRequestHeaders, validateInternalAgent, validateProjectExists, validateRequestContext, validationHelper, withProjectValidation };
|