@inkeep/agents-core 0.0.0-dev-20250911195722 → 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/index.cjs +65 -172
- package/dist/index.d.cts +5 -15
- package/dist/index.d.ts +5 -15
- package/dist/index.js +68 -149
- package/dist/validation/index.js +1 -1
- package/package.json +1 -1
- package/dist/{chunk-G6FJN6G5.js → chunk-PXIJWVD4.js} +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,37 +23,13 @@ var ai = require('ai');
|
|
|
23
23
|
var exitHook = require('exit-hook');
|
|
24
24
|
var tsPattern = require('ts-pattern');
|
|
25
25
|
var zod = require('zod');
|
|
26
|
-
var fs = require('fs');
|
|
27
|
-
var path = require('path');
|
|
28
|
-
var dotenv = require('dotenv');
|
|
29
26
|
var node = require('@nangohq/node');
|
|
30
27
|
|
|
31
28
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
32
29
|
|
|
33
|
-
function _interopNamespace(e) {
|
|
34
|
-
if (e && e.__esModule) return e;
|
|
35
|
-
var n = Object.create(null);
|
|
36
|
-
if (e) {
|
|
37
|
-
Object.keys(e).forEach(function (k) {
|
|
38
|
-
if (k !== 'default') {
|
|
39
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
40
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () { return e[k]; }
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
n.default = e;
|
|
48
|
-
return Object.freeze(n);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
30
|
var jmespath__default = /*#__PURE__*/_interopDefault(jmespath);
|
|
52
31
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
53
32
|
var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
|
|
54
|
-
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
55
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
56
|
-
var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
|
|
57
33
|
|
|
58
34
|
var __defProp = Object.defineProperty;
|
|
59
35
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -99,8 +75,8 @@ var LoggerFactory = class {
|
|
|
99
75
|
/**
|
|
100
76
|
* Configure the logger factory
|
|
101
77
|
*/
|
|
102
|
-
configure(
|
|
103
|
-
this.config =
|
|
78
|
+
configure(config) {
|
|
79
|
+
this.config = config;
|
|
104
80
|
this.loggers.clear();
|
|
105
81
|
}
|
|
106
82
|
/**
|
|
@@ -133,8 +109,8 @@ var loggerFactory = new LoggerFactory();
|
|
|
133
109
|
function getLogger(name) {
|
|
134
110
|
return loggerFactory.getLogger(name);
|
|
135
111
|
}
|
|
136
|
-
function configureLogging(
|
|
137
|
-
loggerFactory.configure(
|
|
112
|
+
function configureLogging(config) {
|
|
113
|
+
loggerFactory.configure(config);
|
|
138
114
|
}
|
|
139
115
|
|
|
140
116
|
// src/db/schema.ts
|
|
@@ -1836,8 +1812,8 @@ var _TemplateEngine = class _TemplateEngine {
|
|
|
1836
1812
|
* Process variable substitutions {{variable.path}} using JMESPath
|
|
1837
1813
|
*/
|
|
1838
1814
|
static processVariables(template, context, options) {
|
|
1839
|
-
return template.replace(/\{\{([^}]+)\}\}/g, (match2,
|
|
1840
|
-
const trimmedPath =
|
|
1815
|
+
return template.replace(/\{\{([^}]+)\}\}/g, (match2, path) => {
|
|
1816
|
+
const trimmedPath = path.trim();
|
|
1841
1817
|
try {
|
|
1842
1818
|
if (trimmedPath.startsWith("$")) {
|
|
1843
1819
|
return _TemplateEngine.processBuiltinVariable(trimmedPath);
|
|
@@ -2197,14 +2173,14 @@ var CredentialStuffer = class {
|
|
|
2197
2173
|
return baseConfig;
|
|
2198
2174
|
}
|
|
2199
2175
|
};
|
|
2200
|
-
function createDatabaseClient(
|
|
2176
|
+
function createDatabaseClient(config) {
|
|
2201
2177
|
const client$1 = client.createClient({
|
|
2202
|
-
url:
|
|
2203
|
-
authToken:
|
|
2178
|
+
url: config.url,
|
|
2179
|
+
authToken: config.authToken
|
|
2204
2180
|
});
|
|
2205
2181
|
return libsql.drizzle(client$1, {
|
|
2206
2182
|
schema: schema_exports,
|
|
2207
|
-
logger:
|
|
2183
|
+
logger: config.logger
|
|
2208
2184
|
});
|
|
2209
2185
|
}
|
|
2210
2186
|
function createInMemoryDatabaseClient() {
|
|
@@ -3238,14 +3214,14 @@ var deleteAgentGraph = (db) => async (params) => {
|
|
|
3238
3214
|
).returning();
|
|
3239
3215
|
return result.length > 0;
|
|
3240
3216
|
};
|
|
3241
|
-
var fetchComponentRelationships = (db) => async (scopes, agentIds,
|
|
3217
|
+
var fetchComponentRelationships = (db) => async (scopes, agentIds, config) => {
|
|
3242
3218
|
const componentsObject = {};
|
|
3243
3219
|
if (agentIds.length > 0) {
|
|
3244
|
-
const results = await db.select(
|
|
3220
|
+
const results = await db.select(config.selectFields).from(config.relationTable).innerJoin(config.componentTable, drizzleOrm.eq(config.relationIdField, config.componentIdField)).where(
|
|
3245
3221
|
drizzleOrm.and(
|
|
3246
|
-
drizzleOrm.eq(
|
|
3247
|
-
drizzleOrm.eq(
|
|
3248
|
-
drizzleOrm.inArray(
|
|
3222
|
+
drizzleOrm.eq(config.relationTable.tenantId, scopes.tenantId),
|
|
3223
|
+
drizzleOrm.eq(config.relationTable.projectId, scopes.projectId),
|
|
3224
|
+
drizzleOrm.inArray(config.relationTable.agentId, agentIds)
|
|
3249
3225
|
)
|
|
3250
3226
|
);
|
|
3251
3227
|
for (const component of results) {
|
|
@@ -6626,8 +6602,8 @@ var tryWellKnownEndpoints = async (baseUrl, logger11) => {
|
|
|
6626
6602
|
return null;
|
|
6627
6603
|
};
|
|
6628
6604
|
var checkForOAuthEndpoints = async (serverUrl, logger11) => {
|
|
6629
|
-
const
|
|
6630
|
-
return
|
|
6605
|
+
const config = await discoverOAuthEndpoints(serverUrl, logger11);
|
|
6606
|
+
return config !== null;
|
|
6631
6607
|
};
|
|
6632
6608
|
var discoverOAuthEndpoints = async (serverUrl, logger11) => {
|
|
6633
6609
|
try {
|
|
@@ -7007,7 +6983,7 @@ var McpClient = class {
|
|
|
7007
6983
|
}
|
|
7008
6984
|
async connect() {
|
|
7009
6985
|
if (this.connected) return;
|
|
7010
|
-
await tsPattern.match(this.serverConfig).with({ type: MCPTransportType.streamableHttp }, (
|
|
6986
|
+
await tsPattern.match(this.serverConfig).with({ type: MCPTransportType.streamableHttp }, (config) => this.connectHttp(config)).with({ type: MCPTransportType.sse }, (config) => this.connectSSE(config)).exhaustive();
|
|
7011
6987
|
this.connected = true;
|
|
7012
6988
|
const close = this.client.onclose;
|
|
7013
6989
|
this.client.onclose = () => {
|
|
@@ -7019,25 +6995,25 @@ var McpClient = class {
|
|
|
7019
6995
|
exitHook.asyncExitHook(() => this.disconnect(), { wait: 5e3 });
|
|
7020
6996
|
process.on("SIGTERM", () => exitHook.gracefulExit());
|
|
7021
6997
|
}
|
|
7022
|
-
async connectSSE(
|
|
7023
|
-
const url = typeof
|
|
6998
|
+
async connectSSE(config) {
|
|
6999
|
+
const url = typeof config.url === "string" ? config.url : config.url.toString();
|
|
7024
7000
|
this.transport = new sse_js.SSEClientTransport(new URL(url), {
|
|
7025
|
-
eventSourceInit:
|
|
7001
|
+
eventSourceInit: config.eventSourceInit,
|
|
7026
7002
|
requestInit: {
|
|
7027
|
-
headers:
|
|
7003
|
+
headers: config.headers || {}
|
|
7028
7004
|
}
|
|
7029
7005
|
});
|
|
7030
7006
|
await this.client.connect(this.transport, {
|
|
7031
|
-
timeout:
|
|
7007
|
+
timeout: config.timeout ?? this.timeout
|
|
7032
7008
|
});
|
|
7033
7009
|
}
|
|
7034
|
-
async connectHttp(
|
|
7035
|
-
const { url, requestInit } =
|
|
7010
|
+
async connectHttp(config) {
|
|
7011
|
+
const { url, requestInit } = config;
|
|
7036
7012
|
const mergedRequestInit = {
|
|
7037
7013
|
...requestInit,
|
|
7038
7014
|
headers: {
|
|
7039
7015
|
...requestInit?.headers || {},
|
|
7040
|
-
...
|
|
7016
|
+
...config.headers || {}
|
|
7041
7017
|
}
|
|
7042
7018
|
};
|
|
7043
7019
|
const urlObj = new URL(url);
|
|
@@ -7048,9 +7024,9 @@ var McpClient = class {
|
|
|
7048
7024
|
maxReconnectionDelay: 3e4,
|
|
7049
7025
|
initialReconnectionDelay: 1e3,
|
|
7050
7026
|
reconnectionDelayGrowFactor: 1.5,
|
|
7051
|
-
...
|
|
7027
|
+
...config.reconnectionOptions
|
|
7052
7028
|
},
|
|
7053
|
-
sessionId:
|
|
7029
|
+
sessionId: config.sessionId
|
|
7054
7030
|
});
|
|
7055
7031
|
await this.client.connect(this.transport, { timeout: 3e3 });
|
|
7056
7032
|
}
|
|
@@ -7154,52 +7130,7 @@ var McpClient = class {
|
|
|
7154
7130
|
return results;
|
|
7155
7131
|
}
|
|
7156
7132
|
};
|
|
7157
|
-
dotenv__namespace.config({ quiet: true });
|
|
7158
|
-
var environmentSchema = zod.z.enum(["development", "pentest", "production", "test"]);
|
|
7159
|
-
var criticalEnv = zod.z.object({
|
|
7160
|
-
ENVIRONMENT: environmentSchema
|
|
7161
|
-
}).parse(process.env);
|
|
7162
|
-
var loadEnvFile = () => {
|
|
7163
|
-
const envPath = path__default.default.resolve(process.cwd(), `.env.${criticalEnv.ENVIRONMENT}.nonsecret`);
|
|
7164
|
-
if (fs__default.default.existsSync(envPath)) {
|
|
7165
|
-
const envConfig = dotenv__namespace.parse(fs__default.default.readFileSync(envPath));
|
|
7166
|
-
for (const k in envConfig) {
|
|
7167
|
-
if (!(k in process.env)) {
|
|
7168
|
-
process.env[k] = envConfig[k];
|
|
7169
|
-
}
|
|
7170
|
-
}
|
|
7171
|
-
}
|
|
7172
|
-
};
|
|
7173
|
-
loadEnvFile();
|
|
7174
|
-
var envSchema = zod.z.object({
|
|
7175
|
-
ENVIRONMENT: zod.z.enum(["development", "production", "pentest", "test"]).optional(),
|
|
7176
|
-
DB_FILE_NAME: zod.z.string().default("file:../../local.db"),
|
|
7177
|
-
OTEL_TRACES_FORCE_FLUSH_ENABLED: zod.z.stringbool().optional()
|
|
7178
|
-
});
|
|
7179
|
-
var parseEnv = () => {
|
|
7180
|
-
try {
|
|
7181
|
-
const parsedEnv = envSchema.parse(process.env);
|
|
7182
|
-
return parsedEnv;
|
|
7183
|
-
} catch (error) {
|
|
7184
|
-
if (error instanceof zod.z.ZodError) {
|
|
7185
|
-
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
7186
|
-
throw new Error(
|
|
7187
|
-
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
7188
|
-
${error.message}`
|
|
7189
|
-
);
|
|
7190
|
-
}
|
|
7191
|
-
throw error;
|
|
7192
|
-
}
|
|
7193
|
-
};
|
|
7194
|
-
var env = parseEnv();
|
|
7195
|
-
|
|
7196
|
-
// src/utils/tracer.ts
|
|
7197
7133
|
var logger4 = getLogger("tracer");
|
|
7198
|
-
var FORCE_FLUSH_ENVIRONMENTS = ["development"];
|
|
7199
|
-
var BASE = "inkeep-chat";
|
|
7200
|
-
var SERVICE_NAME = "inkeep-chat";
|
|
7201
|
-
var SERVICE_VERSION = "1.0.0";
|
|
7202
|
-
var createSpanName = (suffix) => `${BASE}.${suffix}`;
|
|
7203
7134
|
var createNoOpSpan = () => ({
|
|
7204
7135
|
setAttributes: () => ({}),
|
|
7205
7136
|
recordException: () => ({}),
|
|
@@ -7228,8 +7159,7 @@ var noopTracer = {
|
|
|
7228
7159
|
return createNoOpSpan();
|
|
7229
7160
|
}
|
|
7230
7161
|
};
|
|
7231
|
-
|
|
7232
|
-
function handleSpanError(span, error, logger11, logMessage) {
|
|
7162
|
+
function setSpanWithError(span, error, logger11, logMessage) {
|
|
7233
7163
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
7234
7164
|
span.recordException(error);
|
|
7235
7165
|
span.setStatus({
|
|
@@ -7240,45 +7170,21 @@ function handleSpanError(span, error, logger11, logMessage) {
|
|
|
7240
7170
|
logger11.error({ error: errorMessage }, logMessage);
|
|
7241
7171
|
}
|
|
7242
7172
|
}
|
|
7243
|
-
function
|
|
7244
|
-
if (!globalTracerInstance) {
|
|
7245
|
-
try {
|
|
7246
|
-
globalTracerInstance = api.trace.getTracer(SERVICE_NAME, SERVICE_VERSION);
|
|
7247
|
-
} catch (error) {
|
|
7248
|
-
logger4.debug(
|
|
7249
|
-
{ error: error instanceof Error ? error.message : "Unknown error" },
|
|
7250
|
-
"OpenTelemetry tracer not available, using no-op tracer"
|
|
7251
|
-
);
|
|
7252
|
-
globalTracerInstance = noopTracer;
|
|
7253
|
-
}
|
|
7254
|
-
}
|
|
7255
|
-
return globalTracerInstance;
|
|
7256
|
-
}
|
|
7257
|
-
async function forceFlushTracer() {
|
|
7258
|
-
const isOtelTracesForceFlushEnabled = env.OTEL_TRACES_FORCE_FLUSH_ENABLED;
|
|
7259
|
-
const isForceFlushEnvironment = env.ENVIRONMENT && FORCE_FLUSH_ENVIRONMENTS.includes(env.ENVIRONMENT);
|
|
7260
|
-
const shouldForceFlush = isOtelTracesForceFlushEnabled === true || isOtelTracesForceFlushEnabled == null && isForceFlushEnvironment;
|
|
7261
|
-
if (!shouldForceFlush) {
|
|
7262
|
-
return;
|
|
7263
|
-
}
|
|
7173
|
+
function getTracer(serviceName, serviceVersion) {
|
|
7264
7174
|
try {
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
{ message: "Tracer provider force flush completed" },
|
|
7270
|
-
"Tracer provider force flush completed"
|
|
7271
|
-
);
|
|
7272
|
-
} else {
|
|
7273
|
-
logger4.debug(
|
|
7274
|
-
{ message: "Tracer provider does not support force flush or is not available" },
|
|
7275
|
-
"Tracer provider does not support force flush or is not available"
|
|
7276
|
-
);
|
|
7277
|
-
}
|
|
7278
|
-
} catch (error) {
|
|
7279
|
-
logger4.warn({ error }, "Failed to force flush tracer");
|
|
7175
|
+
return api.trace.getTracer(serviceName, serviceVersion);
|
|
7176
|
+
} catch (_error) {
|
|
7177
|
+
logger4.debug({}, "OpenTelemetry tracer not available, using no-op tracer");
|
|
7178
|
+
return noopTracer;
|
|
7280
7179
|
}
|
|
7281
7180
|
}
|
|
7181
|
+
|
|
7182
|
+
// package.json
|
|
7183
|
+
var package_default = {
|
|
7184
|
+
version: "0.0.0-dev-20250911210702"};
|
|
7185
|
+
|
|
7186
|
+
// src/utils/tracer.ts
|
|
7187
|
+
var tracer = getTracer("agents-core", package_default.version);
|
|
7282
7188
|
var logger5 = getLogger("context-cache");
|
|
7283
7189
|
var ContextCache = class {
|
|
7284
7190
|
constructor(tenantId, projectId, dbClient) {
|
|
@@ -7474,7 +7380,6 @@ var ContextCache = class {
|
|
|
7474
7380
|
|
|
7475
7381
|
// src/context/ContextResolver.ts
|
|
7476
7382
|
var logger6 = getLogger("context-resolver");
|
|
7477
|
-
var tracer = getGlobalTracer();
|
|
7478
7383
|
var ContextResolver = class {
|
|
7479
7384
|
constructor(tenantId, projectId, dbClient, credentialStoreRegistry) {
|
|
7480
7385
|
__publicField(this, "fetcher");
|
|
@@ -7507,7 +7412,7 @@ var ContextResolver = class {
|
|
|
7507
7412
|
"Starting context resolution"
|
|
7508
7413
|
);
|
|
7509
7414
|
return tracer.startActiveSpan(
|
|
7510
|
-
|
|
7415
|
+
"context.resolve",
|
|
7511
7416
|
{
|
|
7512
7417
|
attributes: {
|
|
7513
7418
|
"context.config_id": contextConfig2.id,
|
|
@@ -7659,7 +7564,7 @@ var ContextResolver = class {
|
|
|
7659
7564
|
return result;
|
|
7660
7565
|
} catch (error) {
|
|
7661
7566
|
const durationMs = Date.now() - startTime;
|
|
7662
|
-
|
|
7567
|
+
setSpanWithError(parentSpan, error);
|
|
7663
7568
|
logger6.error(
|
|
7664
7569
|
{
|
|
7665
7570
|
contextConfigId: contextConfig2.id,
|
|
@@ -7680,7 +7585,7 @@ var ContextResolver = class {
|
|
|
7680
7585
|
*/
|
|
7681
7586
|
async resolveSingleFetchDefinition(contextConfig2, definition, templateKey, options, requestHash, result) {
|
|
7682
7587
|
return tracer.startActiveSpan(
|
|
7683
|
-
|
|
7588
|
+
"context-resolver.resolve_single_fetch_definition",
|
|
7684
7589
|
{
|
|
7685
7590
|
attributes: {
|
|
7686
7591
|
"context.definition_id": definition.id,
|
|
@@ -7765,7 +7670,7 @@ var ContextResolver = class {
|
|
|
7765
7670
|
"Context variable resolved and cached"
|
|
7766
7671
|
);
|
|
7767
7672
|
} catch (error) {
|
|
7768
|
-
|
|
7673
|
+
setSpanWithError(parentSpan, error);
|
|
7769
7674
|
throw error;
|
|
7770
7675
|
} finally {
|
|
7771
7676
|
parentSpan.end();
|
|
@@ -8356,21 +8261,21 @@ var ContextFetcher = class {
|
|
|
8356
8261
|
/**
|
|
8357
8262
|
* Perform HTTP request
|
|
8358
8263
|
*/
|
|
8359
|
-
async performRequest(
|
|
8264
|
+
async performRequest(config) {
|
|
8360
8265
|
const startTime = Date.now();
|
|
8361
8266
|
try {
|
|
8362
8267
|
logger8.debug(
|
|
8363
8268
|
{
|
|
8364
|
-
url:
|
|
8365
|
-
method:
|
|
8269
|
+
url: config.url,
|
|
8270
|
+
method: config.method
|
|
8366
8271
|
},
|
|
8367
8272
|
"Performing HTTP request"
|
|
8368
8273
|
);
|
|
8369
|
-
const response = await fetch(
|
|
8370
|
-
method:
|
|
8371
|
-
headers:
|
|
8372
|
-
body:
|
|
8373
|
-
signal: AbortSignal.timeout(
|
|
8274
|
+
const response = await fetch(config.url, {
|
|
8275
|
+
method: config.method,
|
|
8276
|
+
headers: config.headers,
|
|
8277
|
+
body: config.body ? JSON.stringify(config.body) : void 0,
|
|
8278
|
+
signal: AbortSignal.timeout(config.timeout || this.defaultTimeout)
|
|
8374
8279
|
});
|
|
8375
8280
|
if (!response.ok) {
|
|
8376
8281
|
const errorText = await response.text();
|
|
@@ -8390,7 +8295,7 @@ var ContextFetcher = class {
|
|
|
8390
8295
|
}
|
|
8391
8296
|
return {
|
|
8392
8297
|
data,
|
|
8393
|
-
source:
|
|
8298
|
+
source: config.url,
|
|
8394
8299
|
durationMs
|
|
8395
8300
|
};
|
|
8396
8301
|
} catch (error) {
|
|
@@ -8398,7 +8303,7 @@ var ContextFetcher = class {
|
|
|
8398
8303
|
const requestError = error instanceof Error ? error : new Error("Unknown error");
|
|
8399
8304
|
logger8.warn(
|
|
8400
8305
|
{
|
|
8401
|
-
url:
|
|
8306
|
+
url: config.url,
|
|
8402
8307
|
error: requestError.message,
|
|
8403
8308
|
durationMs
|
|
8404
8309
|
},
|
|
@@ -8486,7 +8391,6 @@ var ContextFetcher = class {
|
|
|
8486
8391
|
}
|
|
8487
8392
|
};
|
|
8488
8393
|
var logger9 = getLogger("context");
|
|
8489
|
-
var tracer2 = getGlobalTracer();
|
|
8490
8394
|
async function determineContextTrigger(tenantId, projectId, conversationId, dbClient) {
|
|
8491
8395
|
const conversation = await getConversation(dbClient)({
|
|
8492
8396
|
scopes: { tenantId, projectId },
|
|
@@ -8517,8 +8421,8 @@ async function handleContextConfigChange(tenantId, projectId, conversationId, gr
|
|
|
8517
8421
|
}
|
|
8518
8422
|
}
|
|
8519
8423
|
async function handleContextResolution(tenantId, projectId, conversationId, graphId, requestContext, dbClient, credentialStores) {
|
|
8520
|
-
return
|
|
8521
|
-
|
|
8424
|
+
return tracer.startActiveSpan(
|
|
8425
|
+
"context.handle_context_resolution",
|
|
8522
8426
|
{
|
|
8523
8427
|
attributes: {
|
|
8524
8428
|
"context.request_context_keys": Object.keys(requestContext)
|
|
@@ -8593,7 +8497,6 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
8593
8497
|
} else {
|
|
8594
8498
|
parentSpan.setStatus({ code: api.SpanStatusCode.OK });
|
|
8595
8499
|
}
|
|
8596
|
-
await forceFlushTracer();
|
|
8597
8500
|
logger9.info(
|
|
8598
8501
|
{
|
|
8599
8502
|
conversationId,
|
|
@@ -8611,15 +8514,11 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
8611
8514
|
return resolvedContext;
|
|
8612
8515
|
} catch (error) {
|
|
8613
8516
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
8614
|
-
parentSpan.recordException(error);
|
|
8615
8517
|
parentSpan.setAttributes({
|
|
8616
8518
|
"context.final_status": "failed",
|
|
8617
8519
|
"context.error_message": errorMessage
|
|
8618
8520
|
});
|
|
8619
|
-
parentSpan
|
|
8620
|
-
code: api.SpanStatusCode.ERROR,
|
|
8621
|
-
message: errorMessage
|
|
8622
|
-
});
|
|
8521
|
+
setSpanWithError(parentSpan, error);
|
|
8623
8522
|
logger9.error(
|
|
8624
8523
|
{
|
|
8625
8524
|
error: errorMessage,
|
|
@@ -8633,7 +8532,6 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
8633
8532
|
},
|
|
8634
8533
|
"Failed to resolve context, proceeding without context resolution"
|
|
8635
8534
|
);
|
|
8636
|
-
await forceFlushTracer();
|
|
8637
8535
|
return null;
|
|
8638
8536
|
} finally {
|
|
8639
8537
|
parentSpan.end();
|
|
@@ -8983,13 +8881,13 @@ function isSupportedAuthMode(mode) {
|
|
|
8983
8881
|
return SUPPORTED_AUTH_MODES.includes(mode);
|
|
8984
8882
|
}
|
|
8985
8883
|
var NangoCredentialStore = class {
|
|
8986
|
-
constructor(id,
|
|
8884
|
+
constructor(id, config) {
|
|
8987
8885
|
__publicField(this, "id");
|
|
8988
8886
|
__publicField(this, "type", CredentialStoreType.nango);
|
|
8989
8887
|
__publicField(this, "nangoConfig");
|
|
8990
8888
|
__publicField(this, "nangoClient");
|
|
8991
8889
|
this.id = id;
|
|
8992
|
-
this.nangoConfig =
|
|
8890
|
+
this.nangoConfig = config;
|
|
8993
8891
|
this.nangoClient = new node.Nango({
|
|
8994
8892
|
secretKey: this.nangoConfig.secretKey,
|
|
8995
8893
|
host: this.nangoConfig.apiUrl
|
|
@@ -9216,8 +9114,8 @@ var NangoCredentialStore = class {
|
|
|
9216
9114
|
}
|
|
9217
9115
|
}
|
|
9218
9116
|
};
|
|
9219
|
-
function createNangoCredentialStore(id,
|
|
9220
|
-
const nangoSecretKey =
|
|
9117
|
+
function createNangoCredentialStore(id, config) {
|
|
9118
|
+
const nangoSecretKey = config?.secretKey || process.env.NANGO_SECRET_KEY;
|
|
9221
9119
|
if (!nangoSecretKey || nangoSecretKey === "your_nango_secret_key" || nangoSecretKey.includes("mock")) {
|
|
9222
9120
|
throw new Error(
|
|
9223
9121
|
"NANGO_SECRET_KEY environment variable is required and must be a real Nango secret key (not mock/placeholder)"
|
|
@@ -9225,7 +9123,7 @@ function createNangoCredentialStore(id, config2) {
|
|
|
9225
9123
|
}
|
|
9226
9124
|
return new NangoCredentialStore(id, {
|
|
9227
9125
|
apiUrl: "https://api.nango.dev",
|
|
9228
|
-
...
|
|
9126
|
+
...config,
|
|
9229
9127
|
secretKey: nangoSecretKey
|
|
9230
9128
|
});
|
|
9231
9129
|
}
|
|
@@ -9315,7 +9213,6 @@ exports.ArtifactComponentApiUpdateSchema = ArtifactComponentApiUpdateSchema;
|
|
|
9315
9213
|
exports.ArtifactComponentInsertSchema = ArtifactComponentInsertSchema;
|
|
9316
9214
|
exports.ArtifactComponentSelectSchema = ArtifactComponentSelectSchema;
|
|
9317
9215
|
exports.ArtifactComponentUpdateSchema = ArtifactComponentUpdateSchema;
|
|
9318
|
-
exports.BASE = BASE;
|
|
9319
9216
|
exports.ConsoleLogger = ConsoleLogger;
|
|
9320
9217
|
exports.ContextCache = ContextCache;
|
|
9321
9218
|
exports.ContextCacheApiInsertSchema = ContextCacheApiInsertSchema;
|
|
@@ -9412,8 +9309,6 @@ exports.ProjectModelSchema = ProjectModelSchema;
|
|
|
9412
9309
|
exports.ProjectSelectSchema = ProjectSelectSchema;
|
|
9413
9310
|
exports.ProjectUpdateSchema = ProjectUpdateSchema;
|
|
9414
9311
|
exports.RemovedResponseSchema = RemovedResponseSchema;
|
|
9415
|
-
exports.SERVICE_NAME = SERVICE_NAME;
|
|
9416
|
-
exports.SERVICE_VERSION = SERVICE_VERSION;
|
|
9417
9312
|
exports.SingleResponseSchema = SingleResponseSchema;
|
|
9418
9313
|
exports.StatusComponentSchema = StatusComponentSchema;
|
|
9419
9314
|
exports.StatusUpdateSchema = StatusUpdateSchema;
|
|
@@ -9513,7 +9408,6 @@ exports.createMessage = createMessage;
|
|
|
9513
9408
|
exports.createNangoCredentialStore = createNangoCredentialStore;
|
|
9514
9409
|
exports.createOrGetConversation = createOrGetConversation;
|
|
9515
9410
|
exports.createProject = createProject;
|
|
9516
|
-
exports.createSpanName = createSpanName;
|
|
9517
9411
|
exports.createTask = createTask;
|
|
9518
9412
|
exports.createTool = createTool;
|
|
9519
9413
|
exports.createValidatedDataAccess = createValidatedDataAccess;
|
|
@@ -9554,7 +9448,6 @@ exports.externalAgentsRelations = externalAgentsRelations;
|
|
|
9554
9448
|
exports.extractPublicId = extractPublicId;
|
|
9555
9449
|
exports.fetchComponentRelationships = fetchComponentRelationships;
|
|
9556
9450
|
exports.fetchDefinition = fetchDefinition;
|
|
9557
|
-
exports.forceFlushTracer = forceFlushTracer;
|
|
9558
9451
|
exports.generateAndCreateApiKey = generateAndCreateApiKey;
|
|
9559
9452
|
exports.generateApiKey = generateApiKey;
|
|
9560
9453
|
exports.generateIdFromName = generateIdFromName;
|
|
@@ -9600,7 +9493,6 @@ exports.getExternalAgentByUrl = getExternalAgentByUrl;
|
|
|
9600
9493
|
exports.getExternalAgentRelations = getExternalAgentRelations;
|
|
9601
9494
|
exports.getFullGraph = getFullGraph;
|
|
9602
9495
|
exports.getFullGraphDefinition = getFullGraphDefinition;
|
|
9603
|
-
exports.getGlobalTracer = getGlobalTracer;
|
|
9604
9496
|
exports.getGraphAgentInfos = getGraphAgentInfos;
|
|
9605
9497
|
exports.getHealthyToolsForAgent = getHealthyToolsForAgent;
|
|
9606
9498
|
exports.getLedgerArtifacts = getLedgerArtifacts;
|
|
@@ -9617,12 +9509,12 @@ exports.getTask = getTask;
|
|
|
9617
9509
|
exports.getToolById = getToolById;
|
|
9618
9510
|
exports.getToolsByStatus = getToolsByStatus;
|
|
9619
9511
|
exports.getToolsForAgent = getToolsForAgent;
|
|
9512
|
+
exports.getTracer = getTracer;
|
|
9620
9513
|
exports.getVisibleMessages = getVisibleMessages;
|
|
9621
9514
|
exports.graphHasArtifactComponents = graphHasArtifactComponents;
|
|
9622
9515
|
exports.handleApiError = handleApiError;
|
|
9623
9516
|
exports.handleContextConfigChange = handleContextConfigChange;
|
|
9624
9517
|
exports.handleContextResolution = handleContextResolution;
|
|
9625
|
-
exports.handleSpanError = handleSpanError;
|
|
9626
9518
|
exports.hasApiKey = hasApiKey;
|
|
9627
9519
|
exports.hasContextConfig = hasContextConfig;
|
|
9628
9520
|
exports.hasCredentialReference = hasCredentialReference;
|
|
@@ -9683,6 +9575,7 @@ exports.resourceIdSchema = resourceIdSchema;
|
|
|
9683
9575
|
exports.setActiveAgentForConversation = setActiveAgentForConversation;
|
|
9684
9576
|
exports.setActiveAgentForThread = setActiveAgentForThread;
|
|
9685
9577
|
exports.setCacheEntry = setCacheEntry;
|
|
9578
|
+
exports.setSpanWithError = setSpanWithError;
|
|
9686
9579
|
exports.taskRelations = taskRelations;
|
|
9687
9580
|
exports.taskRelationsRelations = taskRelationsRelations;
|
|
9688
9581
|
exports.tasks = tasks;
|
package/dist/index.d.cts
CHANGED
|
@@ -3968,27 +3968,17 @@ declare function createExecutionContext(params: {
|
|
|
3968
3968
|
*/
|
|
3969
3969
|
declare function getRequestExecutionContext(c: Context): ExecutionContext;
|
|
3970
3970
|
|
|
3971
|
-
declare const BASE = "inkeep-chat";
|
|
3972
|
-
declare const SERVICE_NAME = "inkeep-chat";
|
|
3973
|
-
declare const SERVICE_VERSION = "1.0.0";
|
|
3974
|
-
declare const createSpanName: (suffix: string) => string;
|
|
3975
3971
|
/**
|
|
3976
3972
|
* Helper function to handle span errors consistently
|
|
3977
3973
|
* Records the exception, sets error status, and optionally logs
|
|
3978
3974
|
*/
|
|
3979
|
-
declare function
|
|
3975
|
+
declare function setSpanWithError(span: Span, error: unknown, logger?: {
|
|
3980
3976
|
error: (obj: any, msg?: string) => void;
|
|
3981
3977
|
}, logMessage?: string): void;
|
|
3982
3978
|
/**
|
|
3983
|
-
* Get
|
|
3984
|
-
*
|
|
3979
|
+
* Get a tracer instance for the specified service
|
|
3980
|
+
* Returns a no-op tracer if OpenTelemetry is not available
|
|
3985
3981
|
*/
|
|
3986
|
-
declare function
|
|
3987
|
-
/**
|
|
3988
|
-
* Force flush the tracer provider to ensure critical spans are sent immediately
|
|
3989
|
-
* This is useful for critical operations where we want to ensure telemetry data
|
|
3990
|
-
* is sent before the operation completes or fails
|
|
3991
|
-
*/
|
|
3992
|
-
declare function forceFlushTracer(): Promise<void>;
|
|
3982
|
+
declare function getTracer(serviceName: string, serviceVersion?: string): Tracer;
|
|
3993
3983
|
|
|
3994
|
-
export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate,
|
|
3984
|
+
export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ConsoleLogger, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithTools, type CredentialResolverInput, CredentialStore, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, type DatabaseClient, type DatabaseConfig, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentRelationInsert, ExternalAgentSelect, ExternalAgentUpdate, FetchDefinition, type FetchResult, FullGraphDefinition, type GraphLogger, HTTP_REQUEST_PARTS, type HttpRequestPart, InMemoryCredentialStore, KeyChainStore, LedgerArtifactSelect, type Logger$1 as Logger, type LoggerFactoryConfig, MCPToolConfig, MCPTransportType, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, McpToolDefinition, McpToolStatus, MessageContent, MessageInsert, MessageMetadata, MessageUpdate, MessageVisibility, NangoCredentialStore, NoOpLogger, type OAuthConfig, PaginationConfig, PaginationResult, type ParsedHttpRequest, type ProblemDetails, ProjectInfo, ProjectInsert, ProjectResourceCounts, ProjectSelect, ProjectUpdate, type ResolvedContext, ScopeConfig, TaskInsert, TaskMetadataConfig, TaskSelect, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -3968,27 +3968,17 @@ declare function createExecutionContext(params: {
|
|
|
3968
3968
|
*/
|
|
3969
3969
|
declare function getRequestExecutionContext(c: Context): ExecutionContext;
|
|
3970
3970
|
|
|
3971
|
-
declare const BASE = "inkeep-chat";
|
|
3972
|
-
declare const SERVICE_NAME = "inkeep-chat";
|
|
3973
|
-
declare const SERVICE_VERSION = "1.0.0";
|
|
3974
|
-
declare const createSpanName: (suffix: string) => string;
|
|
3975
3971
|
/**
|
|
3976
3972
|
* Helper function to handle span errors consistently
|
|
3977
3973
|
* Records the exception, sets error status, and optionally logs
|
|
3978
3974
|
*/
|
|
3979
|
-
declare function
|
|
3975
|
+
declare function setSpanWithError(span: Span, error: unknown, logger?: {
|
|
3980
3976
|
error: (obj: any, msg?: string) => void;
|
|
3981
3977
|
}, logMessage?: string): void;
|
|
3982
3978
|
/**
|
|
3983
|
-
* Get
|
|
3984
|
-
*
|
|
3979
|
+
* Get a tracer instance for the specified service
|
|
3980
|
+
* Returns a no-op tracer if OpenTelemetry is not available
|
|
3985
3981
|
*/
|
|
3986
|
-
declare function
|
|
3987
|
-
/**
|
|
3988
|
-
* Force flush the tracer provider to ensure critical spans are sent immediately
|
|
3989
|
-
* This is useful for critical operations where we want to ensure telemetry data
|
|
3990
|
-
* is sent before the operation completes or fails
|
|
3991
|
-
*/
|
|
3992
|
-
declare function forceFlushTracer(): Promise<void>;
|
|
3982
|
+
declare function getTracer(serviceName: string, serviceVersion?: string): Tracer;
|
|
3993
3983
|
|
|
3994
|
-
export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate,
|
|
3984
|
+
export { AgentGraphInsert, AgentGraphUpdate, AgentInsert, AgentRelationInsert, AgentRelationUpdate, AgentSelect, AgentToolRelationUpdate, AgentUpdate, ApiKeyCreateResult, type ApiKeyGenerationResult, ApiKeyInsert, ApiKeySelect, ApiKeyUpdate, Artifact, ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate, type CommonCreateErrorResponses, type CommonDeleteErrorResponses, type CommonGetErrorResponses, type CommonUpdateErrorResponses, ConsoleLogger, ContextCache, ContextCacheInsert, ContextCacheSelect, ContextConfigBuilder, type ContextConfigBuilderOptions, ContextConfigInsert, ContextConfigSelect, ContextConfigUpdate, ContextFetchDefinition, ContextFetcher, type ContextResolutionOptions, type ContextResolutionResult, ContextResolver, type ContextResolverInterface, type ContextValidationError, type ContextValidationResult, ConversationHistoryConfig, ConversationInsert, ConversationMetadata, ConversationSelect, ConversationUpdate, CreateApiKeyParams, type CredentialContext, type CredentialData, CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, type CredentialReferenceWithTools, type CredentialResolverInput, CredentialStore, type CredentialStoreReference, CredentialStoreRegistry, CredentialStoreType, CredentialStuffer, DataComponentInsert, DataComponentSelect, DataComponentUpdate, type DatabaseClient, type DatabaseConfig, ERROR_DOCS_BASE_URL, ErrorCode, type ErrorCodes, type ErrorResponse, ExecutionContext, ExternalAgentInsert, ExternalAgentRelationInsert, ExternalAgentSelect, ExternalAgentUpdate, FetchDefinition, type FetchResult, FullGraphDefinition, type GraphLogger, HTTP_REQUEST_PARTS, type HttpRequestPart, InMemoryCredentialStore, KeyChainStore, LedgerArtifactSelect, type Logger$1 as Logger, type LoggerFactoryConfig, MCPToolConfig, MCPTransportType, McpClient, type McpClientOptions, type McpSSEConfig, type McpServerConfig, type McpStreamableHttpConfig, McpTool, McpToolDefinition, McpToolStatus, MessageContent, MessageInsert, MessageMetadata, MessageUpdate, MessageVisibility, NangoCredentialStore, NoOpLogger, type OAuthConfig, PaginationConfig, PaginationResult, type ParsedHttpRequest, type ProblemDetails, ProjectInfo, ProjectInsert, ProjectResourceCounts, ProjectSelect, ProjectUpdate, type ResolvedContext, ScopeConfig, TaskInsert, TaskMetadataConfig, TaskSelect, type TemplateContext, TemplateEngine, type TemplateRenderOptions, ToolInsert, ToolMcpConfig, ToolSelect, ToolServerCapabilities, ToolUpdate, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-SVGQSPW4.js';
|
|
5
|
-
export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-SVGQSPW4.js';
|
|
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';
|
|
6
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';
|
|
7
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
|
+
import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-SVGQSPW4.js';
|
|
7
|
+
export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-SVGQSPW4.js';
|
|
8
8
|
import { __publicField } from './chunk-MKBO26DX.js';
|
|
9
9
|
import { z as z$2 } from 'zod/v4';
|
|
10
10
|
import jmespath from 'jmespath';
|
|
@@ -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);
|
|
@@ -763,14 +760,14 @@ var CredentialStuffer = class {
|
|
|
763
760
|
return baseConfig;
|
|
764
761
|
}
|
|
765
762
|
};
|
|
766
|
-
function createDatabaseClient(
|
|
763
|
+
function createDatabaseClient(config) {
|
|
767
764
|
const client = createClient({
|
|
768
|
-
url:
|
|
769
|
-
authToken:
|
|
765
|
+
url: config.url,
|
|
766
|
+
authToken: config.authToken
|
|
770
767
|
});
|
|
771
768
|
return drizzle(client, {
|
|
772
769
|
schema: schema_exports,
|
|
773
|
-
logger:
|
|
770
|
+
logger: config.logger
|
|
774
771
|
});
|
|
775
772
|
}
|
|
776
773
|
function createInMemoryDatabaseClient() {
|
|
@@ -1804,14 +1801,14 @@ var deleteAgentGraph = (db) => async (params) => {
|
|
|
1804
1801
|
).returning();
|
|
1805
1802
|
return result.length > 0;
|
|
1806
1803
|
};
|
|
1807
|
-
var fetchComponentRelationships = (db) => async (scopes, agentIds,
|
|
1804
|
+
var fetchComponentRelationships = (db) => async (scopes, agentIds, config) => {
|
|
1808
1805
|
const componentsObject = {};
|
|
1809
1806
|
if (agentIds.length > 0) {
|
|
1810
|
-
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(
|
|
1811
1808
|
and(
|
|
1812
|
-
eq(
|
|
1813
|
-
eq(
|
|
1814
|
-
inArray(
|
|
1809
|
+
eq(config.relationTable.tenantId, scopes.tenantId),
|
|
1810
|
+
eq(config.relationTable.projectId, scopes.projectId),
|
|
1811
|
+
inArray(config.relationTable.agentId, agentIds)
|
|
1815
1812
|
)
|
|
1816
1813
|
);
|
|
1817
1814
|
for (const component of results) {
|
|
@@ -5087,8 +5084,8 @@ var tryWellKnownEndpoints = async (baseUrl, logger11) => {
|
|
|
5087
5084
|
return null;
|
|
5088
5085
|
};
|
|
5089
5086
|
var checkForOAuthEndpoints = async (serverUrl, logger11) => {
|
|
5090
|
-
const
|
|
5091
|
-
return
|
|
5087
|
+
const config = await discoverOAuthEndpoints(serverUrl, logger11);
|
|
5088
|
+
return config !== null;
|
|
5092
5089
|
};
|
|
5093
5090
|
var discoverOAuthEndpoints = async (serverUrl, logger11) => {
|
|
5094
5091
|
try {
|
|
@@ -5468,7 +5465,7 @@ var McpClient = class {
|
|
|
5468
5465
|
}
|
|
5469
5466
|
async connect() {
|
|
5470
5467
|
if (this.connected) return;
|
|
5471
|
-
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();
|
|
5472
5469
|
this.connected = true;
|
|
5473
5470
|
const close = this.client.onclose;
|
|
5474
5471
|
this.client.onclose = () => {
|
|
@@ -5480,25 +5477,25 @@ var McpClient = class {
|
|
|
5480
5477
|
asyncExitHook(() => this.disconnect(), { wait: 5e3 });
|
|
5481
5478
|
process.on("SIGTERM", () => gracefulExit());
|
|
5482
5479
|
}
|
|
5483
|
-
async connectSSE(
|
|
5484
|
-
const url = typeof
|
|
5480
|
+
async connectSSE(config) {
|
|
5481
|
+
const url = typeof config.url === "string" ? config.url : config.url.toString();
|
|
5485
5482
|
this.transport = new SSEClientTransport(new URL(url), {
|
|
5486
|
-
eventSourceInit:
|
|
5483
|
+
eventSourceInit: config.eventSourceInit,
|
|
5487
5484
|
requestInit: {
|
|
5488
|
-
headers:
|
|
5485
|
+
headers: config.headers || {}
|
|
5489
5486
|
}
|
|
5490
5487
|
});
|
|
5491
5488
|
await this.client.connect(this.transport, {
|
|
5492
|
-
timeout:
|
|
5489
|
+
timeout: config.timeout ?? this.timeout
|
|
5493
5490
|
});
|
|
5494
5491
|
}
|
|
5495
|
-
async connectHttp(
|
|
5496
|
-
const { url, requestInit } =
|
|
5492
|
+
async connectHttp(config) {
|
|
5493
|
+
const { url, requestInit } = config;
|
|
5497
5494
|
const mergedRequestInit = {
|
|
5498
5495
|
...requestInit,
|
|
5499
5496
|
headers: {
|
|
5500
5497
|
...requestInit?.headers || {},
|
|
5501
|
-
...
|
|
5498
|
+
...config.headers || {}
|
|
5502
5499
|
}
|
|
5503
5500
|
};
|
|
5504
5501
|
const urlObj = new URL(url);
|
|
@@ -5509,9 +5506,9 @@ var McpClient = class {
|
|
|
5509
5506
|
maxReconnectionDelay: 3e4,
|
|
5510
5507
|
initialReconnectionDelay: 1e3,
|
|
5511
5508
|
reconnectionDelayGrowFactor: 1.5,
|
|
5512
|
-
...
|
|
5509
|
+
...config.reconnectionOptions
|
|
5513
5510
|
},
|
|
5514
|
-
sessionId:
|
|
5511
|
+
sessionId: config.sessionId
|
|
5515
5512
|
});
|
|
5516
5513
|
await this.client.connect(this.transport, { timeout: 3e3 });
|
|
5517
5514
|
}
|
|
@@ -5615,52 +5612,7 @@ var McpClient = class {
|
|
|
5615
5612
|
return results;
|
|
5616
5613
|
}
|
|
5617
5614
|
};
|
|
5618
|
-
dotenv.config({ quiet: true });
|
|
5619
|
-
var environmentSchema = z$1.enum(["development", "pentest", "production", "test"]);
|
|
5620
|
-
var criticalEnv = z$1.object({
|
|
5621
|
-
ENVIRONMENT: environmentSchema
|
|
5622
|
-
}).parse(process.env);
|
|
5623
|
-
var loadEnvFile = () => {
|
|
5624
|
-
const envPath = path.resolve(process.cwd(), `.env.${criticalEnv.ENVIRONMENT}.nonsecret`);
|
|
5625
|
-
if (fs.existsSync(envPath)) {
|
|
5626
|
-
const envConfig = dotenv.parse(fs.readFileSync(envPath));
|
|
5627
|
-
for (const k in envConfig) {
|
|
5628
|
-
if (!(k in process.env)) {
|
|
5629
|
-
process.env[k] = envConfig[k];
|
|
5630
|
-
}
|
|
5631
|
-
}
|
|
5632
|
-
}
|
|
5633
|
-
};
|
|
5634
|
-
loadEnvFile();
|
|
5635
|
-
var envSchema = z$1.object({
|
|
5636
|
-
ENVIRONMENT: z$1.enum(["development", "production", "pentest", "test"]).optional(),
|
|
5637
|
-
DB_FILE_NAME: z$1.string().default("file:../../local.db"),
|
|
5638
|
-
OTEL_TRACES_FORCE_FLUSH_ENABLED: z$1.stringbool().optional()
|
|
5639
|
-
});
|
|
5640
|
-
var parseEnv = () => {
|
|
5641
|
-
try {
|
|
5642
|
-
const parsedEnv = envSchema.parse(process.env);
|
|
5643
|
-
return parsedEnv;
|
|
5644
|
-
} catch (error) {
|
|
5645
|
-
if (error instanceof z$1.ZodError) {
|
|
5646
|
-
const missingVars = error.issues.map((issue) => issue.path.join("."));
|
|
5647
|
-
throw new Error(
|
|
5648
|
-
`\u274C Invalid environment variables: ${missingVars.join(", ")}
|
|
5649
|
-
${error.message}`
|
|
5650
|
-
);
|
|
5651
|
-
}
|
|
5652
|
-
throw error;
|
|
5653
|
-
}
|
|
5654
|
-
};
|
|
5655
|
-
var env = parseEnv();
|
|
5656
|
-
|
|
5657
|
-
// src/utils/tracer.ts
|
|
5658
5615
|
var logger4 = getLogger("tracer");
|
|
5659
|
-
var FORCE_FLUSH_ENVIRONMENTS = ["development"];
|
|
5660
|
-
var BASE = "inkeep-chat";
|
|
5661
|
-
var SERVICE_NAME = "inkeep-chat";
|
|
5662
|
-
var SERVICE_VERSION = "1.0.0";
|
|
5663
|
-
var createSpanName = (suffix) => `${BASE}.${suffix}`;
|
|
5664
5616
|
var createNoOpSpan = () => ({
|
|
5665
5617
|
setAttributes: () => ({}),
|
|
5666
5618
|
recordException: () => ({}),
|
|
@@ -5689,8 +5641,7 @@ var noopTracer = {
|
|
|
5689
5641
|
return createNoOpSpan();
|
|
5690
5642
|
}
|
|
5691
5643
|
};
|
|
5692
|
-
|
|
5693
|
-
function handleSpanError(span, error, logger11, logMessage) {
|
|
5644
|
+
function setSpanWithError(span, error, logger11, logMessage) {
|
|
5694
5645
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5695
5646
|
span.recordException(error);
|
|
5696
5647
|
span.setStatus({
|
|
@@ -5701,45 +5652,21 @@ function handleSpanError(span, error, logger11, logMessage) {
|
|
|
5701
5652
|
logger11.error({ error: errorMessage }, logMessage);
|
|
5702
5653
|
}
|
|
5703
5654
|
}
|
|
5704
|
-
function
|
|
5705
|
-
if (!globalTracerInstance) {
|
|
5706
|
-
try {
|
|
5707
|
-
globalTracerInstance = trace.getTracer(SERVICE_NAME, SERVICE_VERSION);
|
|
5708
|
-
} catch (error) {
|
|
5709
|
-
logger4.debug(
|
|
5710
|
-
{ error: error instanceof Error ? error.message : "Unknown error" },
|
|
5711
|
-
"OpenTelemetry tracer not available, using no-op tracer"
|
|
5712
|
-
);
|
|
5713
|
-
globalTracerInstance = noopTracer;
|
|
5714
|
-
}
|
|
5715
|
-
}
|
|
5716
|
-
return globalTracerInstance;
|
|
5717
|
-
}
|
|
5718
|
-
async function forceFlushTracer() {
|
|
5719
|
-
const isOtelTracesForceFlushEnabled = env.OTEL_TRACES_FORCE_FLUSH_ENABLED;
|
|
5720
|
-
const isForceFlushEnvironment = env.ENVIRONMENT && FORCE_FLUSH_ENVIRONMENTS.includes(env.ENVIRONMENT);
|
|
5721
|
-
const shouldForceFlush = isOtelTracesForceFlushEnabled === true || isOtelTracesForceFlushEnabled == null && isForceFlushEnvironment;
|
|
5722
|
-
if (!shouldForceFlush) {
|
|
5723
|
-
return;
|
|
5724
|
-
}
|
|
5655
|
+
function getTracer(serviceName, serviceVersion) {
|
|
5725
5656
|
try {
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
{ message: "Tracer provider force flush completed" },
|
|
5731
|
-
"Tracer provider force flush completed"
|
|
5732
|
-
);
|
|
5733
|
-
} else {
|
|
5734
|
-
logger4.debug(
|
|
5735
|
-
{ message: "Tracer provider does not support force flush or is not available" },
|
|
5736
|
-
"Tracer provider does not support force flush or is not available"
|
|
5737
|
-
);
|
|
5738
|
-
}
|
|
5739
|
-
} catch (error) {
|
|
5740
|
-
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;
|
|
5741
5661
|
}
|
|
5742
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);
|
|
5743
5670
|
var logger5 = getLogger("context-cache");
|
|
5744
5671
|
var ContextCache = class {
|
|
5745
5672
|
constructor(tenantId, projectId, dbClient) {
|
|
@@ -5935,7 +5862,6 @@ var ContextCache = class {
|
|
|
5935
5862
|
|
|
5936
5863
|
// src/context/ContextResolver.ts
|
|
5937
5864
|
var logger6 = getLogger("context-resolver");
|
|
5938
|
-
var tracer = getGlobalTracer();
|
|
5939
5865
|
var ContextResolver = class {
|
|
5940
5866
|
constructor(tenantId, projectId, dbClient, credentialStoreRegistry) {
|
|
5941
5867
|
__publicField(this, "fetcher");
|
|
@@ -5968,7 +5894,7 @@ var ContextResolver = class {
|
|
|
5968
5894
|
"Starting context resolution"
|
|
5969
5895
|
);
|
|
5970
5896
|
return tracer.startActiveSpan(
|
|
5971
|
-
|
|
5897
|
+
"context.resolve",
|
|
5972
5898
|
{
|
|
5973
5899
|
attributes: {
|
|
5974
5900
|
"context.config_id": contextConfig2.id,
|
|
@@ -6120,7 +6046,7 @@ var ContextResolver = class {
|
|
|
6120
6046
|
return result;
|
|
6121
6047
|
} catch (error) {
|
|
6122
6048
|
const durationMs = Date.now() - startTime;
|
|
6123
|
-
|
|
6049
|
+
setSpanWithError(parentSpan, error);
|
|
6124
6050
|
logger6.error(
|
|
6125
6051
|
{
|
|
6126
6052
|
contextConfigId: contextConfig2.id,
|
|
@@ -6141,7 +6067,7 @@ var ContextResolver = class {
|
|
|
6141
6067
|
*/
|
|
6142
6068
|
async resolveSingleFetchDefinition(contextConfig2, definition, templateKey, options, requestHash, result) {
|
|
6143
6069
|
return tracer.startActiveSpan(
|
|
6144
|
-
|
|
6070
|
+
"context-resolver.resolve_single_fetch_definition",
|
|
6145
6071
|
{
|
|
6146
6072
|
attributes: {
|
|
6147
6073
|
"context.definition_id": definition.id,
|
|
@@ -6226,7 +6152,7 @@ var ContextResolver = class {
|
|
|
6226
6152
|
"Context variable resolved and cached"
|
|
6227
6153
|
);
|
|
6228
6154
|
} catch (error) {
|
|
6229
|
-
|
|
6155
|
+
setSpanWithError(parentSpan, error);
|
|
6230
6156
|
throw error;
|
|
6231
6157
|
} finally {
|
|
6232
6158
|
parentSpan.end();
|
|
@@ -6817,21 +6743,21 @@ var ContextFetcher = class {
|
|
|
6817
6743
|
/**
|
|
6818
6744
|
* Perform HTTP request
|
|
6819
6745
|
*/
|
|
6820
|
-
async performRequest(
|
|
6746
|
+
async performRequest(config) {
|
|
6821
6747
|
const startTime = Date.now();
|
|
6822
6748
|
try {
|
|
6823
6749
|
logger8.debug(
|
|
6824
6750
|
{
|
|
6825
|
-
url:
|
|
6826
|
-
method:
|
|
6751
|
+
url: config.url,
|
|
6752
|
+
method: config.method
|
|
6827
6753
|
},
|
|
6828
6754
|
"Performing HTTP request"
|
|
6829
6755
|
);
|
|
6830
|
-
const response = await fetch(
|
|
6831
|
-
method:
|
|
6832
|
-
headers:
|
|
6833
|
-
body:
|
|
6834
|
-
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)
|
|
6835
6761
|
});
|
|
6836
6762
|
if (!response.ok) {
|
|
6837
6763
|
const errorText = await response.text();
|
|
@@ -6851,7 +6777,7 @@ var ContextFetcher = class {
|
|
|
6851
6777
|
}
|
|
6852
6778
|
return {
|
|
6853
6779
|
data,
|
|
6854
|
-
source:
|
|
6780
|
+
source: config.url,
|
|
6855
6781
|
durationMs
|
|
6856
6782
|
};
|
|
6857
6783
|
} catch (error) {
|
|
@@ -6859,7 +6785,7 @@ var ContextFetcher = class {
|
|
|
6859
6785
|
const requestError = error instanceof Error ? error : new Error("Unknown error");
|
|
6860
6786
|
logger8.warn(
|
|
6861
6787
|
{
|
|
6862
|
-
url:
|
|
6788
|
+
url: config.url,
|
|
6863
6789
|
error: requestError.message,
|
|
6864
6790
|
durationMs
|
|
6865
6791
|
},
|
|
@@ -6947,7 +6873,6 @@ var ContextFetcher = class {
|
|
|
6947
6873
|
}
|
|
6948
6874
|
};
|
|
6949
6875
|
var logger9 = getLogger("context");
|
|
6950
|
-
var tracer2 = getGlobalTracer();
|
|
6951
6876
|
async function determineContextTrigger(tenantId, projectId, conversationId, dbClient) {
|
|
6952
6877
|
const conversation = await getConversation(dbClient)({
|
|
6953
6878
|
scopes: { tenantId, projectId },
|
|
@@ -6978,8 +6903,8 @@ async function handleContextConfigChange(tenantId, projectId, conversationId, gr
|
|
|
6978
6903
|
}
|
|
6979
6904
|
}
|
|
6980
6905
|
async function handleContextResolution(tenantId, projectId, conversationId, graphId, requestContext, dbClient, credentialStores) {
|
|
6981
|
-
return
|
|
6982
|
-
|
|
6906
|
+
return tracer.startActiveSpan(
|
|
6907
|
+
"context.handle_context_resolution",
|
|
6983
6908
|
{
|
|
6984
6909
|
attributes: {
|
|
6985
6910
|
"context.request_context_keys": Object.keys(requestContext)
|
|
@@ -7054,7 +6979,6 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
7054
6979
|
} else {
|
|
7055
6980
|
parentSpan.setStatus({ code: SpanStatusCode.OK });
|
|
7056
6981
|
}
|
|
7057
|
-
await forceFlushTracer();
|
|
7058
6982
|
logger9.info(
|
|
7059
6983
|
{
|
|
7060
6984
|
conversationId,
|
|
@@ -7072,15 +6996,11 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
7072
6996
|
return resolvedContext;
|
|
7073
6997
|
} catch (error) {
|
|
7074
6998
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
7075
|
-
parentSpan.recordException(error);
|
|
7076
6999
|
parentSpan.setAttributes({
|
|
7077
7000
|
"context.final_status": "failed",
|
|
7078
7001
|
"context.error_message": errorMessage
|
|
7079
7002
|
});
|
|
7080
|
-
parentSpan
|
|
7081
|
-
code: SpanStatusCode.ERROR,
|
|
7082
|
-
message: errorMessage
|
|
7083
|
-
});
|
|
7003
|
+
setSpanWithError(parentSpan, error);
|
|
7084
7004
|
logger9.error(
|
|
7085
7005
|
{
|
|
7086
7006
|
error: errorMessage,
|
|
@@ -7094,7 +7014,6 @@ async function handleContextResolution(tenantId, projectId, conversationId, grap
|
|
|
7094
7014
|
},
|
|
7095
7015
|
"Failed to resolve context, proceeding without context resolution"
|
|
7096
7016
|
);
|
|
7097
|
-
await forceFlushTracer();
|
|
7098
7017
|
return null;
|
|
7099
7018
|
} finally {
|
|
7100
7019
|
parentSpan.end();
|
|
@@ -7444,13 +7363,13 @@ function isSupportedAuthMode(mode) {
|
|
|
7444
7363
|
return SUPPORTED_AUTH_MODES.includes(mode);
|
|
7445
7364
|
}
|
|
7446
7365
|
var NangoCredentialStore = class {
|
|
7447
|
-
constructor(id,
|
|
7366
|
+
constructor(id, config) {
|
|
7448
7367
|
__publicField(this, "id");
|
|
7449
7368
|
__publicField(this, "type", CredentialStoreType.nango);
|
|
7450
7369
|
__publicField(this, "nangoConfig");
|
|
7451
7370
|
__publicField(this, "nangoClient");
|
|
7452
7371
|
this.id = id;
|
|
7453
|
-
this.nangoConfig =
|
|
7372
|
+
this.nangoConfig = config;
|
|
7454
7373
|
this.nangoClient = new Nango({
|
|
7455
7374
|
secretKey: this.nangoConfig.secretKey,
|
|
7456
7375
|
host: this.nangoConfig.apiUrl
|
|
@@ -7677,8 +7596,8 @@ var NangoCredentialStore = class {
|
|
|
7677
7596
|
}
|
|
7678
7597
|
}
|
|
7679
7598
|
};
|
|
7680
|
-
function createNangoCredentialStore(id,
|
|
7681
|
-
const nangoSecretKey =
|
|
7599
|
+
function createNangoCredentialStore(id, config) {
|
|
7600
|
+
const nangoSecretKey = config?.secretKey || process.env.NANGO_SECRET_KEY;
|
|
7682
7601
|
if (!nangoSecretKey || nangoSecretKey === "your_nango_secret_key" || nangoSecretKey.includes("mock")) {
|
|
7683
7602
|
throw new Error(
|
|
7684
7603
|
"NANGO_SECRET_KEY environment variable is required and must be a real Nango secret key (not mock/placeholder)"
|
|
@@ -7686,7 +7605,7 @@ function createNangoCredentialStore(id, config2) {
|
|
|
7686
7605
|
}
|
|
7687
7606
|
return new NangoCredentialStore(id, {
|
|
7688
7607
|
apiUrl: "https://api.nango.dev",
|
|
7689
|
-
...
|
|
7608
|
+
...config,
|
|
7690
7609
|
secretKey: nangoSecretKey
|
|
7691
7610
|
});
|
|
7692
7611
|
}
|
|
@@ -7707,4 +7626,4 @@ function createDefaultCredentialStores() {
|
|
|
7707
7626
|
return stores;
|
|
7708
7627
|
}
|
|
7709
7628
|
|
|
7710
|
-
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 };
|
package/dist/validation/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-core",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250911210702",
|
|
4
4
|
"description": "Core database schema, types, and validation schemas for Inkeep Agent Framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-SVGQSPW4.js';
|
|
2
1
|
import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-M4JXMAG7.js';
|
|
2
|
+
import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-SVGQSPW4.js';
|
|
3
3
|
import { z } from '@hono/zod-openapi';
|
|
4
4
|
import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
|
|
5
5
|
|