@inkeep/agents-core 0.0.0-dev-20250911210702 → 0.0.0-dev-20250911212652
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 +28 -11
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +28 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -84,7 +84,11 @@ var LoggerFactory = class {
|
|
|
84
84
|
*/
|
|
85
85
|
getLogger(name) {
|
|
86
86
|
if (this.loggers.has(name)) {
|
|
87
|
-
|
|
87
|
+
const logger12 = this.loggers.get(name);
|
|
88
|
+
if (!logger12) {
|
|
89
|
+
throw new Error(`Logger '${name}' not found in cache`);
|
|
90
|
+
}
|
|
91
|
+
return logger12;
|
|
88
92
|
}
|
|
89
93
|
let logger11;
|
|
90
94
|
if (this.config.loggerFactory) {
|
|
@@ -2762,6 +2766,9 @@ var upsertAgent = (db) => async (params) => {
|
|
|
2762
2766
|
stopWhen: params.data.stopWhen
|
|
2763
2767
|
}
|
|
2764
2768
|
});
|
|
2769
|
+
if (!updated) {
|
|
2770
|
+
throw new Error("Failed to update agent - no rows affected");
|
|
2771
|
+
}
|
|
2765
2772
|
return updated;
|
|
2766
2773
|
} else {
|
|
2767
2774
|
return await createAgent(db)(params.data);
|
|
@@ -3048,6 +3055,9 @@ var upsertExternalAgent = (db) => async (params) => {
|
|
|
3048
3055
|
headers: params.data.headers
|
|
3049
3056
|
}
|
|
3050
3057
|
});
|
|
3058
|
+
if (!updated) {
|
|
3059
|
+
throw new Error("Failed to update external agent - no rows affected");
|
|
3060
|
+
}
|
|
3051
3061
|
return updated;
|
|
3052
3062
|
} else {
|
|
3053
3063
|
return await createExternalAgent(db)(params.data);
|
|
@@ -4542,6 +4552,9 @@ var upsertCredentialReference = (db) => async (params) => {
|
|
|
4542
4552
|
retrievalParams: params.data.retrievalParams
|
|
4543
4553
|
}
|
|
4544
4554
|
});
|
|
4555
|
+
if (!updated) {
|
|
4556
|
+
throw new Error("Failed to update credential reference - no rows affected");
|
|
4557
|
+
}
|
|
4545
4558
|
return updated;
|
|
4546
4559
|
} else {
|
|
4547
4560
|
return await createCredentialReference(db)(params.data);
|
|
@@ -7181,7 +7194,7 @@ function getTracer(serviceName, serviceVersion) {
|
|
|
7181
7194
|
|
|
7182
7195
|
// package.json
|
|
7183
7196
|
var package_default = {
|
|
7184
|
-
version: "0.0.0-dev-
|
|
7197
|
+
version: "0.0.0-dev-20250911212652"};
|
|
7185
7198
|
|
|
7186
7199
|
// src/utils/tracer.ts
|
|
7187
7200
|
var tracer = getTracer("agents-core", package_default.version);
|
|
@@ -7865,7 +7878,15 @@ async function fetchExistingRequestContext({
|
|
|
7865
7878
|
"No request context found in cache. Please provide requestContext in request body."
|
|
7866
7879
|
);
|
|
7867
7880
|
}
|
|
7868
|
-
async function validateRequestContext(
|
|
7881
|
+
async function validateRequestContext({
|
|
7882
|
+
tenantId,
|
|
7883
|
+
projectId,
|
|
7884
|
+
graphId,
|
|
7885
|
+
conversationId,
|
|
7886
|
+
parsedRequest,
|
|
7887
|
+
dbClient,
|
|
7888
|
+
credentialStores
|
|
7889
|
+
}) {
|
|
7869
7890
|
try {
|
|
7870
7891
|
const agentGraph2 = await getAgentGraphWithDefaultAgent(dbClient)({
|
|
7871
7892
|
scopes: { tenantId, projectId },
|
|
@@ -7908,10 +7929,7 @@ async function validateRequestContext(tenantId, projectId, graphId, conversation
|
|
|
7908
7929
|
}
|
|
7909
7930
|
try {
|
|
7910
7931
|
const schema = contextConfig2.requestContextSchema;
|
|
7911
|
-
logger7.debug(
|
|
7912
|
-
{ contextConfigId: contextConfig2.id },
|
|
7913
|
-
"Using headers schema validation"
|
|
7914
|
-
);
|
|
7932
|
+
logger7.debug({ contextConfigId: contextConfig2.id }, "Using headers schema validation");
|
|
7915
7933
|
const httpRequest = parsedRequest;
|
|
7916
7934
|
const validationResult = await validateHttpRequestHeaders(schema, httpRequest);
|
|
7917
7935
|
if (validationResult.valid) {
|
|
@@ -7994,14 +8012,15 @@ function contextValidationMiddleware(dbClient) {
|
|
|
7994
8012
|
const parsedRequest = {
|
|
7995
8013
|
headers
|
|
7996
8014
|
};
|
|
7997
|
-
const validationResult = await validateRequestContext(
|
|
8015
|
+
const validationResult = await validateRequestContext({
|
|
7998
8016
|
tenantId,
|
|
7999
8017
|
projectId,
|
|
8000
8018
|
graphId,
|
|
8001
8019
|
conversationId,
|
|
8002
8020
|
parsedRequest,
|
|
8003
8021
|
dbClient,
|
|
8004
|
-
credentialStores
|
|
8022
|
+
credentialStores
|
|
8023
|
+
});
|
|
8005
8024
|
if (!validationResult.valid) {
|
|
8006
8025
|
logger7.warn(
|
|
8007
8026
|
{
|
|
@@ -8068,13 +8087,11 @@ var ContextFetcher = class {
|
|
|
8068
8087
|
__publicField(this, "tenantId");
|
|
8069
8088
|
__publicField(this, "projectId");
|
|
8070
8089
|
__publicField(this, "defaultTimeout");
|
|
8071
|
-
__publicField(this, "credentialStoreRegistry");
|
|
8072
8090
|
__publicField(this, "credentialStuffer");
|
|
8073
8091
|
__publicField(this, "dbClient");
|
|
8074
8092
|
this.tenantId = tenantId;
|
|
8075
8093
|
this.projectId = projectId;
|
|
8076
8094
|
this.defaultTimeout = defaultTimeout;
|
|
8077
|
-
this.credentialStoreRegistry = credentialStoreRegistry;
|
|
8078
8095
|
if (credentialStoreRegistry) {
|
|
8079
8096
|
this.credentialStuffer = new CredentialStuffer(credentialStoreRegistry);
|
|
8080
8097
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -169,7 +169,6 @@ declare class ContextFetcher {
|
|
|
169
169
|
private tenantId;
|
|
170
170
|
private projectId;
|
|
171
171
|
private defaultTimeout;
|
|
172
|
-
private credentialStoreRegistry?;
|
|
173
172
|
private credentialStuffer?;
|
|
174
173
|
private dbClient;
|
|
175
174
|
constructor(tenantId: string, projectId: string, dbClient: DatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, defaultTimeout?: number);
|
|
@@ -3336,7 +3335,15 @@ declare function validateHttpRequestHeaders(headersSchema: any, httpRequest: Par
|
|
|
3336
3335
|
* Validates request context against the JSON Schema stored in context configuration
|
|
3337
3336
|
* Supports both legacy simple schemas and new comprehensive HTTP request schemas
|
|
3338
3337
|
*/
|
|
3339
|
-
declare function validateRequestContext(tenantId
|
|
3338
|
+
declare function validateRequestContext({ tenantId, projectId, graphId, conversationId, parsedRequest, dbClient, credentialStores, }: {
|
|
3339
|
+
tenantId: string;
|
|
3340
|
+
projectId: string;
|
|
3341
|
+
graphId: string;
|
|
3342
|
+
conversationId: string;
|
|
3343
|
+
parsedRequest: ParsedHttpRequest;
|
|
3344
|
+
dbClient: DatabaseClient;
|
|
3345
|
+
credentialStores?: CredentialStoreRegistry;
|
|
3346
|
+
}): Promise<ContextValidationResult>;
|
|
3340
3347
|
/**
|
|
3341
3348
|
* Hono middleware for context validation
|
|
3342
3349
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -169,7 +169,6 @@ declare class ContextFetcher {
|
|
|
169
169
|
private tenantId;
|
|
170
170
|
private projectId;
|
|
171
171
|
private defaultTimeout;
|
|
172
|
-
private credentialStoreRegistry?;
|
|
173
172
|
private credentialStuffer?;
|
|
174
173
|
private dbClient;
|
|
175
174
|
constructor(tenantId: string, projectId: string, dbClient: DatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, defaultTimeout?: number);
|
|
@@ -3336,7 +3335,15 @@ declare function validateHttpRequestHeaders(headersSchema: any, httpRequest: Par
|
|
|
3336
3335
|
* Validates request context against the JSON Schema stored in context configuration
|
|
3337
3336
|
* Supports both legacy simple schemas and new comprehensive HTTP request schemas
|
|
3338
3337
|
*/
|
|
3339
|
-
declare function validateRequestContext(tenantId
|
|
3338
|
+
declare function validateRequestContext({ tenantId, projectId, graphId, conversationId, parsedRequest, dbClient, credentialStores, }: {
|
|
3339
|
+
tenantId: string;
|
|
3340
|
+
projectId: string;
|
|
3341
|
+
graphId: string;
|
|
3342
|
+
conversationId: string;
|
|
3343
|
+
parsedRequest: ParsedHttpRequest;
|
|
3344
|
+
dbClient: DatabaseClient;
|
|
3345
|
+
credentialStores?: CredentialStoreRegistry;
|
|
3346
|
+
}): Promise<ContextValidationResult>;
|
|
3340
3347
|
/**
|
|
3341
3348
|
* Hono middleware for context validation
|
|
3342
3349
|
*/
|
package/dist/index.js
CHANGED
|
@@ -74,7 +74,11 @@ var LoggerFactory = class {
|
|
|
74
74
|
*/
|
|
75
75
|
getLogger(name) {
|
|
76
76
|
if (this.loggers.has(name)) {
|
|
77
|
-
|
|
77
|
+
const logger12 = this.loggers.get(name);
|
|
78
|
+
if (!logger12) {
|
|
79
|
+
throw new Error(`Logger '${name}' not found in cache`);
|
|
80
|
+
}
|
|
81
|
+
return logger12;
|
|
78
82
|
}
|
|
79
83
|
let logger11;
|
|
80
84
|
if (this.config.loggerFactory) {
|
|
@@ -1349,6 +1353,9 @@ var upsertAgent = (db) => async (params) => {
|
|
|
1349
1353
|
stopWhen: params.data.stopWhen
|
|
1350
1354
|
}
|
|
1351
1355
|
});
|
|
1356
|
+
if (!updated) {
|
|
1357
|
+
throw new Error("Failed to update agent - no rows affected");
|
|
1358
|
+
}
|
|
1352
1359
|
return updated;
|
|
1353
1360
|
} else {
|
|
1354
1361
|
return await createAgent(db)(params.data);
|
|
@@ -1635,6 +1642,9 @@ var upsertExternalAgent = (db) => async (params) => {
|
|
|
1635
1642
|
headers: params.data.headers
|
|
1636
1643
|
}
|
|
1637
1644
|
});
|
|
1645
|
+
if (!updated) {
|
|
1646
|
+
throw new Error("Failed to update external agent - no rows affected");
|
|
1647
|
+
}
|
|
1638
1648
|
return updated;
|
|
1639
1649
|
} else {
|
|
1640
1650
|
return await createExternalAgent(db)(params.data);
|
|
@@ -3129,6 +3139,9 @@ var upsertCredentialReference = (db) => async (params) => {
|
|
|
3129
3139
|
retrievalParams: params.data.retrievalParams
|
|
3130
3140
|
}
|
|
3131
3141
|
});
|
|
3142
|
+
if (!updated) {
|
|
3143
|
+
throw new Error("Failed to update credential reference - no rows affected");
|
|
3144
|
+
}
|
|
3132
3145
|
return updated;
|
|
3133
3146
|
} else {
|
|
3134
3147
|
return await createCredentialReference(db)(params.data);
|
|
@@ -5663,7 +5676,7 @@ function getTracer(serviceName, serviceVersion) {
|
|
|
5663
5676
|
|
|
5664
5677
|
// package.json
|
|
5665
5678
|
var package_default = {
|
|
5666
|
-
version: "0.0.0-dev-
|
|
5679
|
+
version: "0.0.0-dev-20250911212652"};
|
|
5667
5680
|
|
|
5668
5681
|
// src/utils/tracer.ts
|
|
5669
5682
|
var tracer = getTracer("agents-core", package_default.version);
|
|
@@ -6347,7 +6360,15 @@ async function fetchExistingRequestContext({
|
|
|
6347
6360
|
"No request context found in cache. Please provide requestContext in request body."
|
|
6348
6361
|
);
|
|
6349
6362
|
}
|
|
6350
|
-
async function validateRequestContext(
|
|
6363
|
+
async function validateRequestContext({
|
|
6364
|
+
tenantId,
|
|
6365
|
+
projectId,
|
|
6366
|
+
graphId,
|
|
6367
|
+
conversationId,
|
|
6368
|
+
parsedRequest,
|
|
6369
|
+
dbClient,
|
|
6370
|
+
credentialStores
|
|
6371
|
+
}) {
|
|
6351
6372
|
try {
|
|
6352
6373
|
const agentGraph2 = await getAgentGraphWithDefaultAgent(dbClient)({
|
|
6353
6374
|
scopes: { tenantId, projectId },
|
|
@@ -6390,10 +6411,7 @@ async function validateRequestContext(tenantId, projectId, graphId, conversation
|
|
|
6390
6411
|
}
|
|
6391
6412
|
try {
|
|
6392
6413
|
const schema = contextConfig2.requestContextSchema;
|
|
6393
|
-
logger7.debug(
|
|
6394
|
-
{ contextConfigId: contextConfig2.id },
|
|
6395
|
-
"Using headers schema validation"
|
|
6396
|
-
);
|
|
6414
|
+
logger7.debug({ contextConfigId: contextConfig2.id }, "Using headers schema validation");
|
|
6397
6415
|
const httpRequest = parsedRequest;
|
|
6398
6416
|
const validationResult = await validateHttpRequestHeaders(schema, httpRequest);
|
|
6399
6417
|
if (validationResult.valid) {
|
|
@@ -6476,14 +6494,15 @@ function contextValidationMiddleware(dbClient) {
|
|
|
6476
6494
|
const parsedRequest = {
|
|
6477
6495
|
headers
|
|
6478
6496
|
};
|
|
6479
|
-
const validationResult = await validateRequestContext(
|
|
6497
|
+
const validationResult = await validateRequestContext({
|
|
6480
6498
|
tenantId,
|
|
6481
6499
|
projectId,
|
|
6482
6500
|
graphId,
|
|
6483
6501
|
conversationId,
|
|
6484
6502
|
parsedRequest,
|
|
6485
6503
|
dbClient,
|
|
6486
|
-
credentialStores
|
|
6504
|
+
credentialStores
|
|
6505
|
+
});
|
|
6487
6506
|
if (!validationResult.valid) {
|
|
6488
6507
|
logger7.warn(
|
|
6489
6508
|
{
|
|
@@ -6550,13 +6569,11 @@ var ContextFetcher = class {
|
|
|
6550
6569
|
__publicField(this, "tenantId");
|
|
6551
6570
|
__publicField(this, "projectId");
|
|
6552
6571
|
__publicField(this, "defaultTimeout");
|
|
6553
|
-
__publicField(this, "credentialStoreRegistry");
|
|
6554
6572
|
__publicField(this, "credentialStuffer");
|
|
6555
6573
|
__publicField(this, "dbClient");
|
|
6556
6574
|
this.tenantId = tenantId;
|
|
6557
6575
|
this.projectId = projectId;
|
|
6558
6576
|
this.defaultTimeout = defaultTimeout;
|
|
6559
|
-
this.credentialStoreRegistry = credentialStoreRegistry;
|
|
6560
6577
|
if (credentialStoreRegistry) {
|
|
6561
6578
|
this.credentialStuffer = new CredentialStuffer(credentialStoreRegistry);
|
|
6562
6579
|
}
|
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-20250911212652",
|
|
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",
|