@inkeep/agents-core 0.0.0-dev-20251111181029 → 0.0.0-dev-20251111230615
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-FSGS4BXB.js → chunk-FUJJ4OQ2.js} +1 -1
- package/dist/{chunk-T5TTDZ6L.js → chunk-VSQY72K5.js} +133 -133
- package/dist/{chunk-OFKWNZQL.js → chunk-X6ZMJ3G6.js} +1 -1
- package/dist/client-exports.cjs +211 -211
- package/dist/client-exports.d.cts +3 -3
- package/dist/client-exports.d.ts +3 -3
- package/dist/client-exports.js +2 -2
- package/dist/db/schema.cjs +211 -211
- package/dist/db/schema.d.cts +3 -3
- package/dist/db/schema.d.ts +3 -3
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +363 -331
- package/dist/index.d.cts +109 -104
- package/dist/index.d.ts +109 -104
- package/dist/index.js +104 -73
- package/dist/{schema-lPPu5F4P.d.ts → schema-CuEjPQt7.d.ts} +876 -1014
- package/dist/{schema-WwzWCq2K.d.cts → schema-D1P8r3qm.d.cts} +876 -1014
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/{utility-DJc47Ab9.d.cts → utility-DF5IUC9K.d.cts} +962 -1126
- package/dist/{utility-DJc47Ab9.d.ts → utility-DF5IUC9K.d.ts} +962 -1126
- package/dist/validation/index.cjs +211 -211
- package/dist/validation/index.d.cts +3 -3
- package/dist/validation/index.d.ts +3 -3
- package/dist/validation/index.js +2 -2
- package/drizzle/0000_exotic_mysterio.sql +398 -0
- package/drizzle/meta/0000_snapshot.json +1683 -1223
- package/drizzle/meta/_journal.json +4 -102
- package/package.json +6 -3
- package/drizzle/0000_material_menace.sql +0 -326
- package/drizzle/0001_eminent_fixer.sql +0 -43
- package/drizzle/0002_bumpy_romulus.sql +0 -3
- package/drizzle/0003_soft_forgotten_one.sql +0 -39
- package/drizzle/0004_melted_omega_flight.sql +0 -3
- package/drizzle/0005_wide_shriek.sql +0 -127
- package/drizzle/0006_damp_lenny_balinger.sql +0 -52
- package/drizzle/0007_mighty_typhoid_mary.sql +0 -227
- package/drizzle/0008_mysterious_crusher_hogan.sql +0 -20
- package/drizzle/0009_old_black_cat.sql +0 -1
- package/drizzle/0010_wet_vampiro.sql +0 -2
- package/drizzle/0011_slippery_korg.sql +0 -36
- package/drizzle/0012_salty_psynapse.sql +0 -17
- package/drizzle/0013_shocking_blur.sql +0 -19
- package/drizzle/0014_broad_hellfire_club.sql +0 -29
- package/drizzle/meta/0001_snapshot.json +0 -2435
- package/drizzle/meta/0002_snapshot.json +0 -2428
- package/drizzle/meta/0003_snapshot.json +0 -2559
- package/drizzle/meta/0004_snapshot.json +0 -2547
- package/drizzle/meta/0005_snapshot.json +0 -2558
- package/drizzle/meta/0006_snapshot.json +0 -2751
- package/drizzle/meta/0007_snapshot.json +0 -2766
- package/drizzle/meta/0008_snapshot.json +0 -2753
- package/drizzle/meta/0009_snapshot.json +0 -2744
- package/drizzle/meta/0010_snapshot.json +0 -2751
- package/drizzle/meta/0011_snapshot.json +0 -2849
- package/drizzle/meta/0012_snapshot.json +0 -2985
- package/drizzle/meta/0013_snapshot.json +0 -2988
- package/drizzle/meta/0014_snapshot.json +0 -2992
package/dist/index.cjs
CHANGED
|
@@ -12,10 +12,13 @@ var pinoPretty = require('pino-pretty');
|
|
|
12
12
|
var zodOpenapi = require('@hono/zod-openapi');
|
|
13
13
|
var drizzleZod = require('drizzle-zod');
|
|
14
14
|
var drizzleOrm = require('drizzle-orm');
|
|
15
|
-
var
|
|
15
|
+
var pgCore = require('drizzle-orm/pg-core');
|
|
16
16
|
var jmespath = require('jmespath');
|
|
17
|
-
var
|
|
18
|
-
var
|
|
17
|
+
var nodePostgres = require('drizzle-orm/node-postgres');
|
|
18
|
+
var pg = require('pg');
|
|
19
|
+
var url = require('url');
|
|
20
|
+
var pglite = require('@electric-sql/pglite');
|
|
21
|
+
var pglite$1 = require('drizzle-orm/pglite');
|
|
19
22
|
var nanoid = require('nanoid');
|
|
20
23
|
var crypto = require('crypto');
|
|
21
24
|
var util = require('util');
|
|
@@ -34,6 +37,7 @@ var api = require('@opentelemetry/api');
|
|
|
34
37
|
var Ajv = require('ajv');
|
|
35
38
|
var node = require('@nangohq/node');
|
|
36
39
|
|
|
40
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
37
41
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
38
42
|
|
|
39
43
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
@@ -247,7 +251,7 @@ var require_util = __commonJS({
|
|
|
247
251
|
return path2;
|
|
248
252
|
}
|
|
249
253
|
exports.normalize = normalize;
|
|
250
|
-
function
|
|
254
|
+
function join2(aRoot, aPath) {
|
|
251
255
|
if (aRoot === "") {
|
|
252
256
|
aRoot = ".";
|
|
253
257
|
}
|
|
@@ -279,7 +283,7 @@ var require_util = __commonJS({
|
|
|
279
283
|
}
|
|
280
284
|
return joined;
|
|
281
285
|
}
|
|
282
|
-
exports.join =
|
|
286
|
+
exports.join = join2;
|
|
283
287
|
exports.isAbsolute = function(aPath) {
|
|
284
288
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
285
289
|
};
|
|
@@ -452,7 +456,7 @@ var require_util = __commonJS({
|
|
|
452
456
|
parsed.path = parsed.path.substring(0, index2 + 1);
|
|
453
457
|
}
|
|
454
458
|
}
|
|
455
|
-
sourceURL =
|
|
459
|
+
sourceURL = join2(urlGenerate(parsed), sourceURL);
|
|
456
460
|
}
|
|
457
461
|
return normalize(sourceURL);
|
|
458
462
|
}
|
|
@@ -4467,7 +4471,7 @@ var require_typescript = __commonJS({
|
|
|
4467
4471
|
textSpanOverlapsWith: () => textSpanOverlapsWith,
|
|
4468
4472
|
textSpansEqual: () => textSpansEqual,
|
|
4469
4473
|
textToKeywordObj: () => textToKeywordObj,
|
|
4470
|
-
timestamp: () =>
|
|
4474
|
+
timestamp: () => timestamp2,
|
|
4471
4475
|
toArray: () => toArray,
|
|
4472
4476
|
toBuilderFileEmit: () => toBuilderFileEmit,
|
|
4473
4477
|
toBuilderStateFileInfoForMultiEmit: () => toBuilderStateFileInfoForMultiEmit,
|
|
@@ -7424,7 +7428,7 @@ ${lanes.join("\n")}
|
|
|
7424
7428
|
function tryGetNativePerformanceHooks() {
|
|
7425
7429
|
return nativePerformanceHooks;
|
|
7426
7430
|
}
|
|
7427
|
-
var
|
|
7431
|
+
var timestamp2 = nativePerformanceTime ? () => nativePerformanceTime.now() : Date.now;
|
|
7428
7432
|
var ts_performance_exports = {};
|
|
7429
7433
|
__export2(ts_performance_exports, {
|
|
7430
7434
|
clearMarks: () => clearMarks,
|
|
@@ -7469,7 +7473,7 @@ ${lanes.join("\n")}
|
|
|
7469
7473
|
}
|
|
7470
7474
|
var nullTimer = { enter: noop, exit: noop };
|
|
7471
7475
|
var enabled = false;
|
|
7472
|
-
var timeorigin =
|
|
7476
|
+
var timeorigin = timestamp2();
|
|
7473
7477
|
var marks = /* @__PURE__ */ new Map();
|
|
7474
7478
|
var counts = /* @__PURE__ */ new Map();
|
|
7475
7479
|
var durations = /* @__PURE__ */ new Map();
|
|
@@ -7477,7 +7481,7 @@ ${lanes.join("\n")}
|
|
|
7477
7481
|
if (enabled) {
|
|
7478
7482
|
const count18 = counts.get(markName) ?? 0;
|
|
7479
7483
|
counts.set(markName, count18 + 1);
|
|
7480
|
-
marks.set(markName,
|
|
7484
|
+
marks.set(markName, timestamp2());
|
|
7481
7485
|
performanceImpl == null ? void 0 : performanceImpl.mark(markName);
|
|
7482
7486
|
if (typeof onProfilerEvent === "function") {
|
|
7483
7487
|
onProfilerEvent(markName);
|
|
@@ -7486,7 +7490,7 @@ ${lanes.join("\n")}
|
|
|
7486
7490
|
}
|
|
7487
7491
|
function measure(measureName, startMarkName, endMarkName) {
|
|
7488
7492
|
if (enabled) {
|
|
7489
|
-
const end = (endMarkName !== void 0 ? marks.get(endMarkName) : void 0) ??
|
|
7493
|
+
const end = (endMarkName !== void 0 ? marks.get(endMarkName) : void 0) ?? timestamp2();
|
|
7490
7494
|
const start = (startMarkName !== void 0 ? marks.get(startMarkName) : void 0) ?? timeorigin;
|
|
7491
7495
|
const previousDuration = durations.get(measureName) || 0;
|
|
7492
7496
|
durations.set(measureName, previousDuration + (end - start));
|
|
@@ -7584,7 +7588,7 @@ ${lanes.join("\n")}
|
|
|
7584
7588
|
});
|
|
7585
7589
|
traceFd = fs2.openSync(tracePath, "w");
|
|
7586
7590
|
tracing = tracingEnabled2;
|
|
7587
|
-
const meta = { cat: "__metadata", ph: "M", ts: 1e3 *
|
|
7591
|
+
const meta = { cat: "__metadata", ph: "M", ts: 1e3 * timestamp2(), pid: 1, tid: 1 };
|
|
7588
7592
|
fs2.writeSync(
|
|
7589
7593
|
traceFd,
|
|
7590
7594
|
"[\n" + [{ name: "process_name", args: { name: "tsc" }, ...meta }, { name: "thread_name", args: { name: "Main" }, ...meta }, { name: "TracingStartedInBrowser", ...meta, cat: "disabled-by-default-devtools.timeline" }].map((v) => JSON.stringify(v)).join(",\n")
|
|
@@ -7630,17 +7634,17 @@ ${lanes.join("\n")}
|
|
|
7630
7634
|
if (separateBeginAndEnd) {
|
|
7631
7635
|
writeEvent("B", phase, name, args);
|
|
7632
7636
|
}
|
|
7633
|
-
eventStack.push({ phase, name, args, time: 1e3 *
|
|
7637
|
+
eventStack.push({ phase, name, args, time: 1e3 * timestamp2(), separateBeginAndEnd });
|
|
7634
7638
|
}
|
|
7635
7639
|
tracingEnabled2.push = push;
|
|
7636
7640
|
function pop(results) {
|
|
7637
7641
|
Debug.assert(eventStack.length > 0);
|
|
7638
|
-
writeStackEvent(eventStack.length - 1, 1e3 *
|
|
7642
|
+
writeStackEvent(eventStack.length - 1, 1e3 * timestamp2(), results);
|
|
7639
7643
|
eventStack.length--;
|
|
7640
7644
|
}
|
|
7641
7645
|
tracingEnabled2.pop = pop;
|
|
7642
7646
|
function popAll() {
|
|
7643
|
-
const endTime = 1e3 *
|
|
7647
|
+
const endTime = 1e3 * timestamp2();
|
|
7644
7648
|
for (let i = eventStack.length - 1; i >= 0; i--) {
|
|
7645
7649
|
writeStackEvent(i, endTime);
|
|
7646
7650
|
}
|
|
@@ -7665,7 +7669,7 @@ ${lanes.join("\n")}
|
|
|
7665
7669
|
writeEvent("X", phase, name, { ...args, results }, `"dur":${endTime - time}`, time);
|
|
7666
7670
|
}
|
|
7667
7671
|
}
|
|
7668
|
-
function writeEvent(eventType, phase, name, args, extras, time = 1e3 *
|
|
7672
|
+
function writeEvent(eventType, phase, name, args, extras, time = 1e3 * timestamp2()) {
|
|
7669
7673
|
if (mode === "server" && phase === "checkTypes") return;
|
|
7670
7674
|
mark("beginTracing");
|
|
7671
7675
|
fs2.writeSync(traceFd, `,
|
|
@@ -10373,7 +10377,7 @@ ${lanes.join("\n")}
|
|
|
10373
10377
|
var _a;
|
|
10374
10378
|
timerToUpdateChildWatches = void 0;
|
|
10375
10379
|
sysLog(`sysLog:: onTimerToUpdateChildWatches:: ${cacheToUpdateChildWatches.size}`);
|
|
10376
|
-
const start =
|
|
10380
|
+
const start = timestamp2();
|
|
10377
10381
|
const invokeMap = /* @__PURE__ */ new Map();
|
|
10378
10382
|
while (!timerToUpdateChildWatches && cacheToUpdateChildWatches.size) {
|
|
10379
10383
|
const result = cacheToUpdateChildWatches.entries().next();
|
|
@@ -10383,7 +10387,7 @@ ${lanes.join("\n")}
|
|
|
10383
10387
|
const hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
10384
10388
|
if (!((_a = cache.get(dirPath)) == null ? void 0 : _a.targetWatcher)) invokeCallbacks(dirName, dirPath, invokeMap, hasChanges ? void 0 : fileNames);
|
|
10385
10389
|
}
|
|
10386
|
-
sysLog(`sysLog:: invokingWatchers:: Elapsed:: ${
|
|
10390
|
+
sysLog(`sysLog:: invokingWatchers:: Elapsed:: ${timestamp2() - start}ms:: ${cacheToUpdateChildWatches.size}`);
|
|
10387
10391
|
callbackCache.forEach((callbacks, rootDirName) => {
|
|
10388
10392
|
const existing = invokeMap.get(rootDirName);
|
|
10389
10393
|
if (existing) {
|
|
@@ -10396,7 +10400,7 @@ ${lanes.join("\n")}
|
|
|
10396
10400
|
});
|
|
10397
10401
|
}
|
|
10398
10402
|
});
|
|
10399
|
-
const elapsed =
|
|
10403
|
+
const elapsed = timestamp2() - start;
|
|
10400
10404
|
sysLog(`sysLog:: Elapsed:: ${elapsed}ms:: onTimerToUpdateChildWatches:: ${cacheToUpdateChildWatches.size} ${timerToUpdateChildWatches}`);
|
|
10401
10405
|
}
|
|
10402
10406
|
function removeChildWatches(parentWatcher) {
|
|
@@ -137376,17 +137380,17 @@ ${lanes.join("\n")}
|
|
|
137376
137380
|
function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
137377
137381
|
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
137378
137382
|
log(watchInfo);
|
|
137379
|
-
const start =
|
|
137383
|
+
const start = timestamp2();
|
|
137380
137384
|
const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
137381
|
-
const elapsed =
|
|
137385
|
+
const elapsed = timestamp2() - start;
|
|
137382
137386
|
log(`Elapsed:: ${elapsed}ms ${watchInfo}`);
|
|
137383
137387
|
return {
|
|
137384
137388
|
close: () => {
|
|
137385
137389
|
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
137386
137390
|
log(watchInfo2);
|
|
137387
|
-
const start2 =
|
|
137391
|
+
const start2 = timestamp2();
|
|
137388
137392
|
watcher.close();
|
|
137389
|
-
const elapsed2 =
|
|
137393
|
+
const elapsed2 = timestamp2() - start2;
|
|
137390
137394
|
log(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
|
|
137391
137395
|
}
|
|
137392
137396
|
};
|
|
@@ -137399,13 +137403,13 @@ ${lanes.join("\n")}
|
|
|
137399
137403
|
(...args) => {
|
|
137400
137404
|
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
137401
137405
|
log(triggerredInfo);
|
|
137402
|
-
const start =
|
|
137406
|
+
const start = timestamp2();
|
|
137403
137407
|
cb.call(
|
|
137404
137408
|
/*thisArg*/
|
|
137405
137409
|
void 0,
|
|
137406
137410
|
...args
|
|
137407
137411
|
);
|
|
137408
|
-
const elapsed =
|
|
137412
|
+
const elapsed = timestamp2() - start;
|
|
137409
137413
|
log(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
|
|
137410
137414
|
},
|
|
137411
137415
|
flags,
|
|
@@ -154143,7 +154147,7 @@ ${lanes.join("\n")}
|
|
|
154143
154147
|
));
|
|
154144
154148
|
const autoImportProvider = useAutoImportProvider && ((_a = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a.call(host));
|
|
154145
154149
|
if (autoImportProvider) {
|
|
154146
|
-
const start =
|
|
154150
|
+
const start = timestamp2();
|
|
154147
154151
|
const checker = program.getTypeChecker();
|
|
154148
154152
|
forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, host, (module22, file) => {
|
|
154149
154153
|
if (file && !program.getSourceFile(file.fileName) || !file && !checker.resolveName(
|
|
@@ -154163,7 +154167,7 @@ ${lanes.join("\n")}
|
|
|
154163
154167
|
);
|
|
154164
154168
|
}
|
|
154165
154169
|
});
|
|
154166
|
-
(_b = host.log) == null ? void 0 : _b.call(host, `forEachExternalModuleToImportFrom autoImportProvider: ${
|
|
154170
|
+
(_b = host.log) == null ? void 0 : _b.call(host, `forEachExternalModuleToImportFrom autoImportProvider: ${timestamp2() - start}`);
|
|
154167
154171
|
}
|
|
154168
154172
|
}
|
|
154169
154173
|
function getIsExcludedPatterns(preferences, useCaseSensitiveFileNames2) {
|
|
@@ -154218,7 +154222,7 @@ ${lanes.join("\n")}
|
|
|
154218
154222
|
}
|
|
154219
154223
|
function getExportInfoMap(importingFile, host, program, preferences, cancellationToken) {
|
|
154220
154224
|
var _a, _b, _c, _d, _e;
|
|
154221
|
-
const start =
|
|
154225
|
+
const start = timestamp2();
|
|
154222
154226
|
(_a = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a.call(host);
|
|
154223
154227
|
const cache = ((_b = host.getCachedExportInfoMap) == null ? void 0 : _b.call(host)) || createCacheableExportInfoMap({
|
|
154224
154228
|
getCurrentProgram: () => program,
|
|
@@ -154281,7 +154285,7 @@ ${lanes.join("\n")}
|
|
|
154281
154285
|
cache.clear();
|
|
154282
154286
|
throw err;
|
|
154283
154287
|
}
|
|
154284
|
-
(_e = host.log) == null ? void 0 : _e.call(host, `getExportInfoMap: done in ${
|
|
154288
|
+
(_e = host.log) == null ? void 0 : _e.call(host, `getExportInfoMap: done in ${timestamp2() - start} ms`);
|
|
154285
154289
|
return cache;
|
|
154286
154290
|
}
|
|
154287
154291
|
function getDefaultLikeExportInfo(moduleSymbol, checker) {
|
|
@@ -164904,7 +164908,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164904
164908
|
this.lastCancellationCheckTime = 0;
|
|
164905
164909
|
}
|
|
164906
164910
|
isCancellationRequested() {
|
|
164907
|
-
const time =
|
|
164911
|
+
const time = timestamp2();
|
|
164908
164912
|
const duration = Math.abs(time - this.lastCancellationCheckTime);
|
|
164909
164913
|
if (duration >= this.throttleWaitMilliseconds) {
|
|
164910
164914
|
this.lastCancellationCheckTime = time;
|
|
@@ -165728,13 +165732,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165728
165732
|
return match2 ? [createTextSpanFromNode(token, sourceFile), createTextSpanFromNode(match2, sourceFile)].sort((a, b) => a.start - b.start) : emptyArray;
|
|
165729
165733
|
}
|
|
165730
165734
|
function getIndentationAtPosition(fileName, position, editorOptions) {
|
|
165731
|
-
let start =
|
|
165735
|
+
let start = timestamp2();
|
|
165732
165736
|
const settings = toEditorSettings(editorOptions);
|
|
165733
165737
|
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
|
165734
|
-
log("getIndentationAtPosition: getCurrentSourceFile: " + (
|
|
165735
|
-
start =
|
|
165738
|
+
log("getIndentationAtPosition: getCurrentSourceFile: " + (timestamp2() - start));
|
|
165739
|
+
start = timestamp2();
|
|
165736
165740
|
const result = ts_formatting_exports.SmartIndenter.getIndentation(position, sourceFile, settings);
|
|
165737
|
-
log("getIndentationAtPosition: computeIndentation : " + (
|
|
165741
|
+
log("getIndentationAtPosition: computeIndentation : " + (timestamp2() - start));
|
|
165738
165742
|
return result;
|
|
165739
165743
|
}
|
|
165740
165744
|
function getFormattingEditsForRange(fileName, start, end, options) {
|
|
@@ -179423,7 +179427,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
179423
179427
|
}
|
|
179424
179428
|
function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
|
|
179425
179429
|
var _a, _b, _c, _d;
|
|
179426
|
-
const start =
|
|
179430
|
+
const start = timestamp2();
|
|
179427
179431
|
const needsFullResolution = isForImportStatementCompletion || getResolvePackageJsonExports(program.getCompilerOptions()) || ((_a = preferences.autoImportSpecifierExcludeRegexes) == null ? void 0 : _a.length);
|
|
179428
179432
|
let skippedAny = false;
|
|
179429
179433
|
let ambientCount = 0;
|
|
@@ -179439,7 +179443,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
179439
179443
|
const hitRateMessage = cacheAttemptCount ? ` (${(resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1)}% hit rate)` : "";
|
|
179440
179444
|
(_b = host.log) == null ? void 0 : _b.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`);
|
|
179441
179445
|
(_c = host.log) == null ? void 0 : _c.call(host, `${logPrefix}: response is ${skippedAny ? "incomplete" : "complete"}`);
|
|
179442
|
-
(_d = host.log) == null ? void 0 : _d.call(host, `${logPrefix}: ${
|
|
179446
|
+
(_d = host.log) == null ? void 0 : _d.call(host, `${logPrefix}: ${timestamp2() - start}`);
|
|
179443
179447
|
return result;
|
|
179444
179448
|
function tryResolve(exportInfo, isFromAmbientModule) {
|
|
179445
179449
|
if (isFromAmbientModule) {
|
|
@@ -181026,7 +181030,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
181026
181030
|
}
|
|
181027
181031
|
}
|
|
181028
181032
|
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
|
|
181029
|
-
const start =
|
|
181033
|
+
const start = timestamp2();
|
|
181030
181034
|
const closestSymbolDeclaration = getClosestSymbolDeclaration(contextToken, location);
|
|
181031
181035
|
const useSemicolons = probablyUsesSemicolons(sourceFile);
|
|
181032
181036
|
const typeChecker = program.getTypeChecker();
|
|
@@ -181085,7 +181089,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
181085
181089
|
true
|
|
181086
181090
|
);
|
|
181087
181091
|
}
|
|
181088
|
-
log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (
|
|
181092
|
+
log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (timestamp2() - start));
|
|
181089
181093
|
return {
|
|
181090
181094
|
has: (name) => uniques.has(name),
|
|
181091
181095
|
add: (name) => uniques.set(name, true)
|
|
@@ -181508,12 +181512,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
181508
181512
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
181509
181513
|
const typeChecker = program.getTypeChecker();
|
|
181510
181514
|
const inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
181511
|
-
let start =
|
|
181515
|
+
let start = timestamp2();
|
|
181512
181516
|
let currentToken = getTokenAtPosition(sourceFile, position);
|
|
181513
|
-
log("getCompletionData: Get current token: " + (
|
|
181514
|
-
start =
|
|
181517
|
+
log("getCompletionData: Get current token: " + (timestamp2() - start));
|
|
181518
|
+
start = timestamp2();
|
|
181515
181519
|
const insideComment = isInComment(sourceFile, position, currentToken);
|
|
181516
|
-
log("getCompletionData: Is inside comment: " + (
|
|
181520
|
+
log("getCompletionData: Is inside comment: " + (timestamp2() - start));
|
|
181517
181521
|
let insideJsDocTagTypeExpression = false;
|
|
181518
181522
|
let insideJsDocImportTag = false;
|
|
181519
181523
|
let isInSnippetScope = false;
|
|
@@ -181562,12 +181566,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
181562
181566
|
return void 0;
|
|
181563
181567
|
}
|
|
181564
181568
|
}
|
|
181565
|
-
start =
|
|
181569
|
+
start = timestamp2();
|
|
181566
181570
|
const isJsOnlyLocation = !insideJsDocTagTypeExpression && !insideJsDocImportTag && isSourceFileJS(sourceFile);
|
|
181567
181571
|
const tokens = getRelevantTokens(position, sourceFile);
|
|
181568
181572
|
const previousToken = tokens.previousToken;
|
|
181569
181573
|
let contextToken = tokens.contextToken;
|
|
181570
|
-
log("getCompletionData: Get previous token: " + (
|
|
181574
|
+
log("getCompletionData: Get previous token: " + (timestamp2() - start));
|
|
181571
181575
|
let node = currentToken;
|
|
181572
181576
|
let propertyAccessToConvert;
|
|
181573
181577
|
let isRightOfDot = false;
|
|
@@ -181700,7 +181704,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
181700
181704
|
}
|
|
181701
181705
|
}
|
|
181702
181706
|
}
|
|
181703
|
-
const semanticStart =
|
|
181707
|
+
const semanticStart = timestamp2();
|
|
181704
181708
|
let completionKind = 5;
|
|
181705
181709
|
let hasUnresolvedAutoImports = false;
|
|
181706
181710
|
let symbols = [];
|
|
@@ -181733,7 +181737,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
181733
181737
|
return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierLocation) : void 0;
|
|
181734
181738
|
}
|
|
181735
181739
|
}
|
|
181736
|
-
log("getCompletionData: Semantic work: " + (
|
|
181740
|
+
log("getCompletionData: Semantic work: " + (timestamp2() - semanticStart));
|
|
181737
181741
|
const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker);
|
|
181738
181742
|
const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected;
|
|
181739
181743
|
const literals = !isLiteralExpected ? [] : mapDefined(
|
|
@@ -182278,9 +182282,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
182278
182282
|
return scope;
|
|
182279
182283
|
}
|
|
182280
182284
|
function isCompletionListBlocker(contextToken2) {
|
|
182281
|
-
const start2 =
|
|
182285
|
+
const start2 = timestamp2();
|
|
182282
182286
|
const result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken2) || isSolelyIdentifierDefinitionLocation(contextToken2) || isDotOfNumericLiteral(contextToken2) || isInJsxText(contextToken2) || isBigIntLiteral(contextToken2);
|
|
182283
|
-
log("getCompletionsAtPosition: isCompletionListBlocker: " + (
|
|
182287
|
+
log("getCompletionsAtPosition: isCompletionListBlocker: " + (timestamp2() - start2));
|
|
182284
182288
|
return result;
|
|
182285
182289
|
}
|
|
182286
182290
|
function isInJsxText(contextToken2) {
|
|
@@ -199802,7 +199806,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
199802
199806
|
textSpanOverlapsWith: () => textSpanOverlapsWith,
|
|
199803
199807
|
textSpansEqual: () => textSpansEqual,
|
|
199804
199808
|
textToKeywordObj: () => textToKeywordObj,
|
|
199805
|
-
timestamp: () =>
|
|
199809
|
+
timestamp: () => timestamp2,
|
|
199806
199810
|
toArray: () => toArray,
|
|
199807
199811
|
toBuilderFileEmit: () => toBuilderFileEmit,
|
|
199808
199812
|
toBuilderStateFileInfoForMultiEmit: () => toBuilderStateFileInfoForMultiEmit,
|
|
@@ -202505,7 +202509,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
202505
202509
|
Debug.assert(oldProgram === this.program);
|
|
202506
202510
|
Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
202507
202511
|
this.writeLog(`Starting updateGraphWorker: Project: ${this.getProjectName()}`);
|
|
202508
|
-
const start =
|
|
202512
|
+
const start = timestamp2();
|
|
202509
202513
|
const { hasInvalidatedResolutions, hasInvalidatedLibResolutions } = this.resolutionCache.createHasInvalidatedResolutions(returnFalse, returnFalse);
|
|
202510
202514
|
this.hasInvalidatedResolutions = hasInvalidatedResolutions;
|
|
202511
202515
|
this.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
|
|
@@ -202611,7 +202615,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
202611
202615
|
},
|
|
202612
202616
|
(removed) => this.detachScriptInfoFromProject(removed)
|
|
202613
202617
|
);
|
|
202614
|
-
const elapsed =
|
|
202618
|
+
const elapsed = timestamp2() - start;
|
|
202615
202619
|
this.sendPerformanceEvent("UpdateGraph", elapsed);
|
|
202616
202620
|
this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} projectStateVersion: ${this.projectStateVersion} projectProgramVersion: ${this.projectProgramVersion} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
|
|
202617
202621
|
if (this.projectService.logger.isTestLogger) {
|
|
@@ -203081,7 +203085,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203081
203085
|
const dependencySelection = this.includePackageJsonAutoImports();
|
|
203082
203086
|
if (dependencySelection) {
|
|
203083
203087
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getPackageJsonAutoImportProvider");
|
|
203084
|
-
const start =
|
|
203088
|
+
const start = timestamp2();
|
|
203085
203089
|
this.autoImportProviderHost = AutoImportProviderProject.create(
|
|
203086
203090
|
dependencySelection,
|
|
203087
203091
|
this,
|
|
@@ -203089,7 +203093,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203089
203093
|
) ?? false;
|
|
203090
203094
|
if (this.autoImportProviderHost) {
|
|
203091
203095
|
updateProjectIfDirty(this.autoImportProviderHost);
|
|
203092
|
-
this.sendPerformanceEvent("CreatePackageJsonAutoImportProvider",
|
|
203096
|
+
this.sendPerformanceEvent("CreatePackageJsonAutoImportProvider", timestamp2() - start);
|
|
203093
203097
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
203094
203098
|
return this.autoImportProviderHost.getCurrentProgram();
|
|
203095
203099
|
}
|
|
@@ -203332,7 +203336,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203332
203336
|
if (!program) {
|
|
203333
203337
|
return emptyArray;
|
|
203334
203338
|
}
|
|
203335
|
-
const start =
|
|
203339
|
+
const start = timestamp2();
|
|
203336
203340
|
let dependencyNames;
|
|
203337
203341
|
let rootNames;
|
|
203338
203342
|
const rootFileName = combinePaths(hostProject.currentDirectory, inferredTypesContainingFile);
|
|
@@ -203424,7 +203428,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203424
203428
|
});
|
|
203425
203429
|
}
|
|
203426
203430
|
if (rootNames == null ? void 0 : rootNames.size) {
|
|
203427
|
-
hostProject.log(`AutoImportProviderProject: found ${rootNames.size} root files in ${dependenciesAdded} dependencies ${referencesAddded} referenced projects in ${
|
|
203431
|
+
hostProject.log(`AutoImportProviderProject: found ${rootNames.size} root files in ${dependenciesAdded} dependencies ${referencesAddded} referenced projects in ${timestamp2() - start} ms`);
|
|
203428
203432
|
}
|
|
203429
203433
|
return rootNames ? arrayFrom(rootNames.values()) : emptyArray;
|
|
203430
203434
|
function addRootNames(entrypoints) {
|
|
@@ -209762,7 +209766,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
209762
209766
|
}
|
|
209763
209767
|
semanticCheck(file, project) {
|
|
209764
209768
|
var _a, _b;
|
|
209765
|
-
const diagnosticsStartTime =
|
|
209769
|
+
const diagnosticsStartTime = timestamp2();
|
|
209766
209770
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "semanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
|
|
209767
209771
|
const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file) ? emptyArray2 : project.getLanguageService().getSemanticDiagnostics(file).filter((d) => !!d.file);
|
|
209768
209772
|
this.sendDiagnosticsEvent(file, project, diags, "semanticDiag", diagnosticsStartTime);
|
|
@@ -209770,21 +209774,21 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
209770
209774
|
}
|
|
209771
209775
|
syntacticCheck(file, project) {
|
|
209772
209776
|
var _a, _b;
|
|
209773
|
-
const diagnosticsStartTime =
|
|
209777
|
+
const diagnosticsStartTime = timestamp2();
|
|
209774
209778
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "syntacticCheck", { file, configFilePath: project.canonicalConfigFilePath });
|
|
209775
209779
|
this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag", diagnosticsStartTime);
|
|
209776
209780
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
209777
209781
|
}
|
|
209778
209782
|
suggestionCheck(file, project) {
|
|
209779
209783
|
var _a, _b;
|
|
209780
|
-
const diagnosticsStartTime =
|
|
209784
|
+
const diagnosticsStartTime = timestamp2();
|
|
209781
209785
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "suggestionCheck", { file, configFilePath: project.canonicalConfigFilePath });
|
|
209782
209786
|
this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag", diagnosticsStartTime);
|
|
209783
209787
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
209784
209788
|
}
|
|
209785
209789
|
regionSemanticCheck(file, project, ranges) {
|
|
209786
209790
|
var _a, _b, _c;
|
|
209787
|
-
const diagnosticsStartTime =
|
|
209791
|
+
const diagnosticsStartTime = timestamp2();
|
|
209788
209792
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
|
|
209789
209793
|
let diagnosticsResult;
|
|
209790
209794
|
if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) {
|
|
@@ -209806,7 +209810,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
209806
209810
|
sendDiagnosticsEvent(file, project, diagnostics, kind, diagnosticsStartTime, spans) {
|
|
209807
209811
|
try {
|
|
209808
209812
|
const scriptInfo = Debug.checkDefined(project.getScriptInfo(file));
|
|
209809
|
-
const duration =
|
|
209813
|
+
const duration = timestamp2() - diagnosticsStartTime;
|
|
209810
209814
|
const body = {
|
|
209811
209815
|
file,
|
|
209812
209816
|
diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)),
|
|
@@ -212926,9 +212930,8 @@ var loadEnvironmentFiles = () => {
|
|
|
212926
212930
|
loadEnvironmentFiles();
|
|
212927
212931
|
var envSchema = zod.z.object({
|
|
212928
212932
|
ENVIRONMENT: zod.z.enum(["development", "production", "pentest", "test"]).optional(),
|
|
212929
|
-
|
|
212930
|
-
|
|
212931
|
-
TURSO_AUTH_TOKEN: zod.z.string().optional(),
|
|
212933
|
+
DATABASE_URL: zod.z.string().optional(),
|
|
212934
|
+
POSTGRES_POOL_SIZE: zod.z.string().optional(),
|
|
212932
212935
|
INKEEP_AGENTS_JWT_SIGNING_SECRET: zod.z.string().min(32, "INKEEP_AGENTS_JWT_SIGNING_SECRET must be at least 32 characters").optional()
|
|
212933
212936
|
});
|
|
212934
212937
|
var parseEnv = () => {
|
|
@@ -213658,165 +213661,165 @@ __export(schema_exports, {
|
|
|
213658
213661
|
toolsRelations: () => toolsRelations
|
|
213659
213662
|
});
|
|
213660
213663
|
var tenantScoped = {
|
|
213661
|
-
tenantId:
|
|
213662
|
-
id:
|
|
213664
|
+
tenantId: pgCore.varchar("tenant_id", { length: 256 }).notNull(),
|
|
213665
|
+
id: pgCore.varchar("id", { length: 256 }).notNull()
|
|
213663
213666
|
};
|
|
213664
213667
|
var projectScoped = {
|
|
213665
213668
|
...tenantScoped,
|
|
213666
|
-
projectId:
|
|
213669
|
+
projectId: pgCore.varchar("project_id", { length: 256 }).notNull()
|
|
213667
213670
|
};
|
|
213668
213671
|
var agentScoped = {
|
|
213669
213672
|
...projectScoped,
|
|
213670
|
-
agentId:
|
|
213673
|
+
agentId: pgCore.varchar("agent_id", { length: 256 }).notNull()
|
|
213671
213674
|
};
|
|
213672
213675
|
var subAgentScoped = {
|
|
213673
213676
|
...agentScoped,
|
|
213674
|
-
subAgentId:
|
|
213677
|
+
subAgentId: pgCore.varchar("sub_agent_id", { length: 256 }).notNull()
|
|
213675
213678
|
};
|
|
213676
213679
|
var uiProperties = {
|
|
213677
|
-
name:
|
|
213678
|
-
description:
|
|
213680
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
213681
|
+
description: pgCore.text("description").notNull()
|
|
213679
213682
|
};
|
|
213680
213683
|
var timestamps = {
|
|
213681
|
-
createdAt:
|
|
213682
|
-
updatedAt:
|
|
213684
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow(),
|
|
213685
|
+
updatedAt: pgCore.timestamp("updated_at", { mode: "string" }).notNull().defaultNow()
|
|
213683
213686
|
};
|
|
213684
|
-
var projects =
|
|
213687
|
+
var projects = pgCore.pgTable(
|
|
213685
213688
|
"projects",
|
|
213686
213689
|
{
|
|
213687
213690
|
...tenantScoped,
|
|
213688
213691
|
...uiProperties,
|
|
213689
|
-
models:
|
|
213690
|
-
stopWhen:
|
|
213692
|
+
models: pgCore.jsonb("models").$type(),
|
|
213693
|
+
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
213691
213694
|
...timestamps
|
|
213692
213695
|
},
|
|
213693
|
-
(table) => [
|
|
213696
|
+
(table) => [pgCore.primaryKey({ columns: [table.tenantId, table.id] })]
|
|
213694
213697
|
);
|
|
213695
|
-
var agents =
|
|
213698
|
+
var agents = pgCore.pgTable(
|
|
213696
213699
|
"agent",
|
|
213697
213700
|
{
|
|
213698
213701
|
...projectScoped,
|
|
213699
|
-
name:
|
|
213700
|
-
description:
|
|
213701
|
-
defaultSubAgentId:
|
|
213702
|
-
contextConfigId:
|
|
213703
|
-
models:
|
|
213704
|
-
statusUpdates:
|
|
213705
|
-
prompt:
|
|
213706
|
-
stopWhen:
|
|
213702
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
213703
|
+
description: pgCore.text("description"),
|
|
213704
|
+
defaultSubAgentId: pgCore.varchar("default_sub_agent_id", { length: 256 }),
|
|
213705
|
+
contextConfigId: pgCore.varchar("context_config_id", { length: 256 }),
|
|
213706
|
+
models: pgCore.jsonb("models").$type(),
|
|
213707
|
+
statusUpdates: pgCore.jsonb("status_updates").$type(),
|
|
213708
|
+
prompt: pgCore.text("prompt"),
|
|
213709
|
+
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
213707
213710
|
...timestamps
|
|
213708
213711
|
},
|
|
213709
213712
|
(table) => [
|
|
213710
|
-
|
|
213711
|
-
|
|
213713
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213714
|
+
pgCore.foreignKey({
|
|
213712
213715
|
columns: [table.tenantId, table.projectId],
|
|
213713
213716
|
foreignColumns: [projects.tenantId, projects.id],
|
|
213714
213717
|
name: "agent_project_fk"
|
|
213715
213718
|
}).onDelete("cascade")
|
|
213716
213719
|
]
|
|
213717
213720
|
);
|
|
213718
|
-
var contextConfigs =
|
|
213721
|
+
var contextConfigs = pgCore.pgTable(
|
|
213719
213722
|
"context_configs",
|
|
213720
213723
|
{
|
|
213721
213724
|
...agentScoped,
|
|
213722
|
-
headersSchema:
|
|
213723
|
-
contextVariables:
|
|
213725
|
+
headersSchema: pgCore.jsonb("headers_schema").$type(),
|
|
213726
|
+
contextVariables: pgCore.jsonb("context_variables").$type(),
|
|
213724
213727
|
...timestamps
|
|
213725
213728
|
},
|
|
213726
213729
|
(table) => [
|
|
213727
|
-
|
|
213728
|
-
|
|
213730
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
213731
|
+
pgCore.foreignKey({
|
|
213729
213732
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
213730
213733
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
213731
213734
|
name: "context_configs_agent_fk"
|
|
213732
213735
|
}).onDelete("cascade")
|
|
213733
213736
|
]
|
|
213734
213737
|
);
|
|
213735
|
-
var contextCache =
|
|
213738
|
+
var contextCache = pgCore.pgTable(
|
|
213736
213739
|
"context_cache",
|
|
213737
213740
|
{
|
|
213738
213741
|
...projectScoped,
|
|
213739
|
-
conversationId:
|
|
213740
|
-
contextConfigId:
|
|
213741
|
-
contextVariableKey:
|
|
213742
|
-
value:
|
|
213743
|
-
requestHash:
|
|
213744
|
-
fetchedAt:
|
|
213745
|
-
fetchSource:
|
|
213746
|
-
fetchDurationMs:
|
|
213742
|
+
conversationId: pgCore.varchar("conversation_id", { length: 256 }).notNull(),
|
|
213743
|
+
contextConfigId: pgCore.varchar("context_config_id", { length: 256 }).notNull(),
|
|
213744
|
+
contextVariableKey: pgCore.varchar("context_variable_key", { length: 256 }).notNull(),
|
|
213745
|
+
value: pgCore.jsonb("value").$type().notNull(),
|
|
213746
|
+
requestHash: pgCore.varchar("request_hash", { length: 256 }),
|
|
213747
|
+
fetchedAt: pgCore.timestamp("fetched_at", { mode: "string" }).notNull().defaultNow(),
|
|
213748
|
+
fetchSource: pgCore.varchar("fetch_source", { length: 256 }),
|
|
213749
|
+
fetchDurationMs: pgCore.integer("fetch_duration_ms"),
|
|
213747
213750
|
...timestamps
|
|
213748
213751
|
},
|
|
213749
213752
|
(table) => [
|
|
213750
|
-
|
|
213751
|
-
|
|
213753
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213754
|
+
pgCore.foreignKey({
|
|
213752
213755
|
columns: [table.tenantId, table.projectId],
|
|
213753
213756
|
foreignColumns: [projects.tenantId, projects.id],
|
|
213754
213757
|
name: "context_cache_project_fk"
|
|
213755
213758
|
}).onDelete("cascade"),
|
|
213756
|
-
|
|
213759
|
+
pgCore.index("context_cache_lookup_idx").on(
|
|
213757
213760
|
table.conversationId,
|
|
213758
213761
|
table.contextConfigId,
|
|
213759
213762
|
table.contextVariableKey
|
|
213760
213763
|
)
|
|
213761
213764
|
]
|
|
213762
213765
|
);
|
|
213763
|
-
var subAgents =
|
|
213766
|
+
var subAgents = pgCore.pgTable(
|
|
213764
213767
|
"sub_agents",
|
|
213765
213768
|
{
|
|
213766
213769
|
...agentScoped,
|
|
213767
213770
|
...uiProperties,
|
|
213768
|
-
prompt:
|
|
213769
|
-
conversationHistoryConfig:
|
|
213770
|
-
|
|
213771
|
-
|
|
213772
|
-
models:
|
|
213773
|
-
stopWhen:
|
|
213771
|
+
prompt: pgCore.text("prompt").notNull(),
|
|
213772
|
+
conversationHistoryConfig: pgCore.jsonb(
|
|
213773
|
+
"conversation_history_config"
|
|
213774
|
+
).$type(),
|
|
213775
|
+
models: pgCore.jsonb("models").$type(),
|
|
213776
|
+
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
213774
213777
|
...timestamps
|
|
213775
213778
|
},
|
|
213776
213779
|
(table) => [
|
|
213777
|
-
|
|
213778
|
-
|
|
213780
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
213781
|
+
pgCore.foreignKey({
|
|
213779
213782
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
213780
213783
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
213781
213784
|
name: "sub_agents_agents_fk"
|
|
213782
213785
|
}).onDelete("cascade")
|
|
213783
213786
|
]
|
|
213784
213787
|
);
|
|
213785
|
-
var subAgentRelations =
|
|
213788
|
+
var subAgentRelations = pgCore.pgTable(
|
|
213786
213789
|
"sub_agent_relations",
|
|
213787
213790
|
{
|
|
213788
213791
|
...agentScoped,
|
|
213789
|
-
sourceSubAgentId:
|
|
213790
|
-
targetSubAgentId:
|
|
213791
|
-
relationType:
|
|
213792
|
+
sourceSubAgentId: pgCore.varchar("source_sub_agent_id", { length: 256 }).notNull(),
|
|
213793
|
+
targetSubAgentId: pgCore.varchar("target_sub_agent_id", { length: 256 }),
|
|
213794
|
+
relationType: pgCore.varchar("relation_type", { length: 256 }),
|
|
213792
213795
|
...timestamps
|
|
213793
213796
|
},
|
|
213794
213797
|
(table) => [
|
|
213795
|
-
|
|
213796
|
-
|
|
213798
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
213799
|
+
pgCore.foreignKey({
|
|
213797
213800
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
213798
213801
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
213799
213802
|
name: "sub_agent_relations_agent_fk"
|
|
213800
213803
|
}).onDelete("cascade")
|
|
213801
213804
|
]
|
|
213802
213805
|
);
|
|
213803
|
-
var externalAgents =
|
|
213806
|
+
var externalAgents = pgCore.pgTable(
|
|
213804
213807
|
"external_agents",
|
|
213805
213808
|
{
|
|
213806
213809
|
...projectScoped,
|
|
213807
213810
|
...uiProperties,
|
|
213808
|
-
baseUrl:
|
|
213809
|
-
credentialReferenceId:
|
|
213811
|
+
baseUrl: pgCore.text("base_url").notNull(),
|
|
213812
|
+
credentialReferenceId: pgCore.varchar("credential_reference_id", { length: 256 }),
|
|
213810
213813
|
...timestamps
|
|
213811
213814
|
},
|
|
213812
213815
|
(table) => [
|
|
213813
|
-
|
|
213814
|
-
|
|
213816
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213817
|
+
pgCore.foreignKey({
|
|
213815
213818
|
columns: [table.tenantId, table.projectId],
|
|
213816
213819
|
foreignColumns: [projects.tenantId, projects.id],
|
|
213817
213820
|
name: "external_agents_project_fk"
|
|
213818
213821
|
}).onDelete("cascade"),
|
|
213819
|
-
|
|
213822
|
+
pgCore.foreignKey({
|
|
213820
213823
|
columns: [table.tenantId, table.projectId, table.credentialReferenceId],
|
|
213821
213824
|
foreignColumns: [
|
|
213822
213825
|
credentialReferences.tenantId,
|
|
@@ -213824,118 +213827,118 @@ var externalAgents = sqliteCore.sqliteTable(
|
|
|
213824
213827
|
credentialReferences.id
|
|
213825
213828
|
],
|
|
213826
213829
|
name: "external_agents_credential_reference_fk"
|
|
213827
|
-
}).onDelete("
|
|
213830
|
+
}).onDelete("cascade")
|
|
213828
213831
|
]
|
|
213829
213832
|
);
|
|
213830
|
-
var tasks =
|
|
213833
|
+
var tasks = pgCore.pgTable(
|
|
213831
213834
|
"tasks",
|
|
213832
213835
|
{
|
|
213833
213836
|
...subAgentScoped,
|
|
213834
|
-
contextId:
|
|
213835
|
-
status:
|
|
213836
|
-
metadata:
|
|
213837
|
+
contextId: pgCore.varchar("context_id", { length: 256 }).notNull(),
|
|
213838
|
+
status: pgCore.varchar("status", { length: 256 }).notNull(),
|
|
213839
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
213837
213840
|
...timestamps
|
|
213838
213841
|
},
|
|
213839
213842
|
(table) => [
|
|
213840
|
-
|
|
213841
|
-
|
|
213843
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213844
|
+
pgCore.foreignKey({
|
|
213842
213845
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
213843
213846
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
213844
213847
|
name: "tasks_sub_agent_fk"
|
|
213845
213848
|
}).onDelete("cascade")
|
|
213846
213849
|
]
|
|
213847
213850
|
);
|
|
213848
|
-
var taskRelations =
|
|
213851
|
+
var taskRelations = pgCore.pgTable(
|
|
213849
213852
|
"task_relations",
|
|
213850
213853
|
{
|
|
213851
213854
|
...projectScoped,
|
|
213852
|
-
parentTaskId:
|
|
213853
|
-
childTaskId:
|
|
213854
|
-
relationType:
|
|
213855
|
+
parentTaskId: pgCore.varchar("parent_task_id", { length: 256 }).notNull(),
|
|
213856
|
+
childTaskId: pgCore.varchar("child_task_id", { length: 256 }).notNull(),
|
|
213857
|
+
relationType: pgCore.varchar("relation_type", { length: 256 }).default("parent_child"),
|
|
213855
213858
|
...timestamps
|
|
213856
213859
|
},
|
|
213857
213860
|
(table) => [
|
|
213858
|
-
|
|
213859
|
-
|
|
213861
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213862
|
+
pgCore.foreignKey({
|
|
213860
213863
|
columns: [table.tenantId, table.projectId],
|
|
213861
213864
|
foreignColumns: [projects.tenantId, projects.id],
|
|
213862
213865
|
name: "task_relations_project_fk"
|
|
213863
213866
|
}).onDelete("cascade")
|
|
213864
213867
|
]
|
|
213865
213868
|
);
|
|
213866
|
-
var dataComponents =
|
|
213869
|
+
var dataComponents = pgCore.pgTable(
|
|
213867
213870
|
"data_components",
|
|
213868
213871
|
{
|
|
213869
213872
|
...projectScoped,
|
|
213870
213873
|
...uiProperties,
|
|
213871
|
-
props:
|
|
213872
|
-
render:
|
|
213874
|
+
props: pgCore.jsonb("props").$type(),
|
|
213875
|
+
render: pgCore.jsonb("render").$type(),
|
|
213873
213876
|
...timestamps
|
|
213874
213877
|
},
|
|
213875
213878
|
(table) => [
|
|
213876
|
-
|
|
213877
|
-
|
|
213879
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213880
|
+
pgCore.foreignKey({
|
|
213878
213881
|
columns: [table.tenantId, table.projectId],
|
|
213879
213882
|
foreignColumns: [projects.tenantId, projects.id],
|
|
213880
213883
|
name: "data_components_project_fk"
|
|
213881
213884
|
}).onDelete("cascade")
|
|
213882
213885
|
]
|
|
213883
213886
|
);
|
|
213884
|
-
var subAgentDataComponents =
|
|
213887
|
+
var subAgentDataComponents = pgCore.pgTable(
|
|
213885
213888
|
"sub_agent_data_components",
|
|
213886
213889
|
{
|
|
213887
213890
|
...subAgentScoped,
|
|
213888
|
-
dataComponentId:
|
|
213889
|
-
createdAt:
|
|
213891
|
+
dataComponentId: pgCore.varchar("data_component_id", { length: 256 }).notNull(),
|
|
213892
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
213890
213893
|
},
|
|
213891
213894
|
(table) => [
|
|
213892
|
-
|
|
213893
|
-
|
|
213895
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213896
|
+
pgCore.foreignKey({
|
|
213894
213897
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
213895
213898
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
213896
213899
|
name: "sub_agent_data_components_sub_agent_fk"
|
|
213897
213900
|
}).onDelete("cascade"),
|
|
213898
|
-
|
|
213901
|
+
pgCore.foreignKey({
|
|
213899
213902
|
columns: [table.tenantId, table.projectId, table.dataComponentId],
|
|
213900
213903
|
foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
|
|
213901
213904
|
name: "sub_agent_data_components_data_component_fk"
|
|
213902
213905
|
}).onDelete("cascade")
|
|
213903
213906
|
]
|
|
213904
213907
|
);
|
|
213905
|
-
var artifactComponents =
|
|
213908
|
+
var artifactComponents = pgCore.pgTable(
|
|
213906
213909
|
"artifact_components",
|
|
213907
213910
|
{
|
|
213908
213911
|
...projectScoped,
|
|
213909
213912
|
...uiProperties,
|
|
213910
|
-
props:
|
|
213913
|
+
props: pgCore.jsonb("props").$type(),
|
|
213911
213914
|
...timestamps
|
|
213912
213915
|
},
|
|
213913
213916
|
(table) => [
|
|
213914
|
-
|
|
213915
|
-
|
|
213917
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213918
|
+
pgCore.foreignKey({
|
|
213916
213919
|
columns: [table.tenantId, table.projectId],
|
|
213917
213920
|
foreignColumns: [projects.tenantId, projects.id],
|
|
213918
213921
|
name: "artifact_components_project_fk"
|
|
213919
213922
|
}).onDelete("cascade")
|
|
213920
213923
|
]
|
|
213921
213924
|
);
|
|
213922
|
-
var subAgentArtifactComponents =
|
|
213925
|
+
var subAgentArtifactComponents = pgCore.pgTable(
|
|
213923
213926
|
"sub_agent_artifact_components",
|
|
213924
213927
|
{
|
|
213925
213928
|
...subAgentScoped,
|
|
213926
|
-
artifactComponentId:
|
|
213927
|
-
createdAt:
|
|
213929
|
+
artifactComponentId: pgCore.varchar("artifact_component_id", { length: 256 }).notNull(),
|
|
213930
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
213928
213931
|
},
|
|
213929
213932
|
(table) => [
|
|
213930
|
-
|
|
213933
|
+
pgCore.primaryKey({
|
|
213931
213934
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId, table.id]
|
|
213932
213935
|
}),
|
|
213933
|
-
|
|
213936
|
+
pgCore.foreignKey({
|
|
213934
213937
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
213935
213938
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
213936
213939
|
name: "sub_agent_artifact_components_sub_agent_fk"
|
|
213937
213940
|
}).onDelete("cascade"),
|
|
213938
|
-
|
|
213941
|
+
pgCore.foreignKey({
|
|
213939
213942
|
columns: [table.tenantId, table.projectId, table.artifactComponentId],
|
|
213940
213943
|
foreignColumns: [
|
|
213941
213944
|
artifactComponents.tenantId,
|
|
@@ -213946,152 +213949,152 @@ var subAgentArtifactComponents = sqliteCore.sqliteTable(
|
|
|
213946
213949
|
}).onDelete("cascade")
|
|
213947
213950
|
]
|
|
213948
213951
|
);
|
|
213949
|
-
var tools =
|
|
213952
|
+
var tools = pgCore.pgTable(
|
|
213950
213953
|
"tools",
|
|
213951
213954
|
{
|
|
213952
213955
|
...projectScoped,
|
|
213953
|
-
name:
|
|
213954
|
-
description:
|
|
213955
|
-
config:
|
|
213956
|
-
credentialReferenceId:
|
|
213957
|
-
headers:
|
|
213958
|
-
imageUrl:
|
|
213959
|
-
capabilities:
|
|
213960
|
-
lastError:
|
|
213956
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
213957
|
+
description: pgCore.text("description"),
|
|
213958
|
+
config: pgCore.jsonb("config").$type().notNull(),
|
|
213959
|
+
credentialReferenceId: pgCore.varchar("credential_reference_id", { length: 256 }),
|
|
213960
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
213961
|
+
imageUrl: pgCore.text("image_url"),
|
|
213962
|
+
capabilities: pgCore.jsonb("capabilities").$type(),
|
|
213963
|
+
lastError: pgCore.text("last_error"),
|
|
213961
213964
|
...timestamps
|
|
213962
213965
|
},
|
|
213963
213966
|
(table) => [
|
|
213964
|
-
|
|
213965
|
-
|
|
213967
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
213968
|
+
pgCore.foreignKey({
|
|
213966
213969
|
columns: [table.tenantId, table.projectId],
|
|
213967
213970
|
foreignColumns: [projects.tenantId, projects.id],
|
|
213968
213971
|
name: "tools_project_fk"
|
|
213969
213972
|
}).onDelete("cascade")
|
|
213970
213973
|
]
|
|
213971
213974
|
);
|
|
213972
|
-
var functionTools =
|
|
213975
|
+
var functionTools = pgCore.pgTable(
|
|
213973
213976
|
"function_tools",
|
|
213974
213977
|
{
|
|
213975
213978
|
...agentScoped,
|
|
213976
|
-
name:
|
|
213977
|
-
description:
|
|
213978
|
-
functionId:
|
|
213979
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
213980
|
+
description: pgCore.text("description"),
|
|
213981
|
+
functionId: pgCore.varchar("function_id", { length: 256 }).notNull(),
|
|
213979
213982
|
...timestamps
|
|
213980
213983
|
},
|
|
213981
213984
|
(table) => [
|
|
213982
|
-
|
|
213983
|
-
|
|
213985
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
213986
|
+
pgCore.foreignKey({
|
|
213984
213987
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
213985
213988
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
213986
213989
|
name: "function_tools_agent_fk"
|
|
213987
213990
|
}).onDelete("cascade"),
|
|
213988
|
-
|
|
213991
|
+
pgCore.foreignKey({
|
|
213989
213992
|
columns: [table.tenantId, table.projectId, table.functionId],
|
|
213990
213993
|
foreignColumns: [functions.tenantId, functions.projectId, functions.id],
|
|
213991
213994
|
name: "function_tools_function_fk"
|
|
213992
213995
|
}).onDelete("cascade")
|
|
213993
213996
|
]
|
|
213994
213997
|
);
|
|
213995
|
-
var functions =
|
|
213998
|
+
var functions = pgCore.pgTable(
|
|
213996
213999
|
"functions",
|
|
213997
214000
|
{
|
|
213998
214001
|
...projectScoped,
|
|
213999
|
-
inputSchema:
|
|
214000
|
-
executeCode:
|
|
214001
|
-
dependencies:
|
|
214002
|
+
inputSchema: pgCore.jsonb("input_schema").$type(),
|
|
214003
|
+
executeCode: pgCore.text("execute_code").notNull(),
|
|
214004
|
+
dependencies: pgCore.jsonb("dependencies").$type(),
|
|
214002
214005
|
...timestamps
|
|
214003
214006
|
},
|
|
214004
214007
|
(table) => [
|
|
214005
|
-
|
|
214006
|
-
|
|
214008
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
214009
|
+
pgCore.foreignKey({
|
|
214007
214010
|
columns: [table.tenantId, table.projectId],
|
|
214008
214011
|
foreignColumns: [projects.tenantId, projects.id],
|
|
214009
214012
|
name: "functions_project_fk"
|
|
214010
214013
|
}).onDelete("cascade")
|
|
214011
214014
|
]
|
|
214012
214015
|
);
|
|
214013
|
-
var subAgentToolRelations =
|
|
214016
|
+
var subAgentToolRelations = pgCore.pgTable(
|
|
214014
214017
|
"sub_agent_tool_relations",
|
|
214015
214018
|
{
|
|
214016
214019
|
...subAgentScoped,
|
|
214017
|
-
toolId:
|
|
214018
|
-
selectedTools:
|
|
214019
|
-
headers:
|
|
214020
|
+
toolId: pgCore.varchar("tool_id", { length: 256 }).notNull(),
|
|
214021
|
+
selectedTools: pgCore.jsonb("selected_tools").$type(),
|
|
214022
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
214020
214023
|
...timestamps
|
|
214021
214024
|
},
|
|
214022
214025
|
(table) => [
|
|
214023
|
-
|
|
214024
|
-
|
|
214026
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
214027
|
+
pgCore.foreignKey({
|
|
214025
214028
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
214026
214029
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
214027
214030
|
name: "sub_agent_tool_relations_agent_fk"
|
|
214028
214031
|
}).onDelete("cascade"),
|
|
214029
|
-
|
|
214032
|
+
pgCore.foreignKey({
|
|
214030
214033
|
columns: [table.tenantId, table.projectId, table.toolId],
|
|
214031
214034
|
foreignColumns: [tools.tenantId, tools.projectId, tools.id],
|
|
214032
214035
|
name: "sub_agent_tool_relations_tool_fk"
|
|
214033
214036
|
}).onDelete("cascade")
|
|
214034
214037
|
]
|
|
214035
214038
|
);
|
|
214036
|
-
var subAgentExternalAgentRelations =
|
|
214039
|
+
var subAgentExternalAgentRelations = pgCore.pgTable(
|
|
214037
214040
|
"sub_agent_external_agent_relations",
|
|
214038
214041
|
{
|
|
214039
214042
|
...subAgentScoped,
|
|
214040
|
-
externalAgentId:
|
|
214041
|
-
headers:
|
|
214043
|
+
externalAgentId: pgCore.varchar("external_agent_id", { length: 256 }).notNull(),
|
|
214044
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
214042
214045
|
...timestamps
|
|
214043
214046
|
},
|
|
214044
214047
|
(table) => [
|
|
214045
|
-
|
|
214046
|
-
|
|
214048
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
214049
|
+
pgCore.foreignKey({
|
|
214047
214050
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
214048
214051
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
214049
214052
|
name: "sub_agent_external_agent_relations_sub_agent_fk"
|
|
214050
214053
|
}).onDelete("cascade"),
|
|
214051
|
-
|
|
214054
|
+
pgCore.foreignKey({
|
|
214052
214055
|
columns: [table.tenantId, table.projectId, table.externalAgentId],
|
|
214053
214056
|
foreignColumns: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
|
|
214054
214057
|
name: "sub_agent_external_agent_relations_external_agent_fk"
|
|
214055
214058
|
}).onDelete("cascade")
|
|
214056
214059
|
]
|
|
214057
214060
|
);
|
|
214058
|
-
var subAgentTeamAgentRelations =
|
|
214061
|
+
var subAgentTeamAgentRelations = pgCore.pgTable(
|
|
214059
214062
|
"sub_agent_team_agent_relations",
|
|
214060
214063
|
{
|
|
214061
214064
|
...subAgentScoped,
|
|
214062
|
-
targetAgentId:
|
|
214063
|
-
headers:
|
|
214065
|
+
targetAgentId: pgCore.varchar("target_agent_id", { length: 256 }).notNull(),
|
|
214066
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
214064
214067
|
...timestamps
|
|
214065
214068
|
},
|
|
214066
214069
|
(table) => [
|
|
214067
|
-
|
|
214068
|
-
|
|
214070
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
214071
|
+
pgCore.foreignKey({
|
|
214069
214072
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
214070
214073
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
214071
214074
|
name: "sub_agent_team_agent_relations_sub_agent_fk"
|
|
214072
214075
|
}).onDelete("cascade"),
|
|
214073
|
-
|
|
214076
|
+
pgCore.foreignKey({
|
|
214074
214077
|
columns: [table.tenantId, table.projectId, table.targetAgentId],
|
|
214075
214078
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
214076
214079
|
name: "sub_agent_team_agent_relations_target_agent_fk"
|
|
214077
214080
|
}).onDelete("cascade")
|
|
214078
214081
|
]
|
|
214079
214082
|
);
|
|
214080
|
-
var subAgentFunctionToolRelations =
|
|
214083
|
+
var subAgentFunctionToolRelations = pgCore.pgTable(
|
|
214081
214084
|
"sub_agent_function_tool_relations",
|
|
214082
214085
|
{
|
|
214083
214086
|
...subAgentScoped,
|
|
214084
|
-
functionToolId:
|
|
214087
|
+
functionToolId: pgCore.varchar("function_tool_id", { length: 256 }).notNull(),
|
|
214085
214088
|
...timestamps
|
|
214086
214089
|
},
|
|
214087
214090
|
(table) => [
|
|
214088
|
-
|
|
214089
|
-
|
|
214091
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
214092
|
+
pgCore.foreignKey({
|
|
214090
214093
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
214091
214094
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
214092
214095
|
name: "sub_agent_function_tool_relations_sub_agent_fk"
|
|
214093
214096
|
}).onDelete("cascade"),
|
|
214094
|
-
|
|
214097
|
+
pgCore.foreignKey({
|
|
214095
214098
|
columns: [table.tenantId, table.projectId, table.agentId, table.functionToolId],
|
|
214096
214099
|
foreignColumns: [
|
|
214097
214100
|
functionTools.tenantId,
|
|
@@ -214103,134 +214106,134 @@ var subAgentFunctionToolRelations = sqliteCore.sqliteTable(
|
|
|
214103
214106
|
}).onDelete("cascade")
|
|
214104
214107
|
]
|
|
214105
214108
|
);
|
|
214106
|
-
var conversations =
|
|
214109
|
+
var conversations = pgCore.pgTable(
|
|
214107
214110
|
"conversations",
|
|
214108
214111
|
{
|
|
214109
214112
|
...projectScoped,
|
|
214110
|
-
userId:
|
|
214111
|
-
activeSubAgentId:
|
|
214112
|
-
title:
|
|
214113
|
-
lastContextResolution:
|
|
214114
|
-
metadata:
|
|
214113
|
+
userId: pgCore.varchar("user_id", { length: 256 }),
|
|
214114
|
+
activeSubAgentId: pgCore.varchar("active_sub_agent_id", { length: 256 }).notNull(),
|
|
214115
|
+
title: pgCore.text("title"),
|
|
214116
|
+
lastContextResolution: pgCore.timestamp("last_context_resolution", { mode: "string" }),
|
|
214117
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
214115
214118
|
...timestamps
|
|
214116
214119
|
},
|
|
214117
214120
|
(table) => [
|
|
214118
|
-
|
|
214119
|
-
|
|
214121
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
214122
|
+
pgCore.foreignKey({
|
|
214120
214123
|
columns: [table.tenantId, table.projectId],
|
|
214121
214124
|
foreignColumns: [projects.tenantId, projects.id],
|
|
214122
214125
|
name: "conversations_project_fk"
|
|
214123
214126
|
}).onDelete("cascade")
|
|
214124
214127
|
]
|
|
214125
214128
|
);
|
|
214126
|
-
var messages =
|
|
214129
|
+
var messages = pgCore.pgTable(
|
|
214127
214130
|
"messages",
|
|
214128
214131
|
{
|
|
214129
214132
|
...projectScoped,
|
|
214130
|
-
conversationId:
|
|
214131
|
-
role:
|
|
214132
|
-
fromSubAgentId:
|
|
214133
|
-
toSubAgentId:
|
|
214134
|
-
fromExternalAgentId:
|
|
214135
|
-
toExternalAgentId:
|
|
214136
|
-
fromTeamAgentId:
|
|
214137
|
-
toTeamAgentId:
|
|
214138
|
-
content:
|
|
214139
|
-
visibility:
|
|
214140
|
-
messageType:
|
|
214141
|
-
taskId:
|
|
214142
|
-
parentMessageId:
|
|
214143
|
-
a2aTaskId:
|
|
214144
|
-
a2aSessionId:
|
|
214145
|
-
metadata:
|
|
214133
|
+
conversationId: pgCore.varchar("conversation_id", { length: 256 }).notNull(),
|
|
214134
|
+
role: pgCore.varchar("role", { length: 256 }).notNull(),
|
|
214135
|
+
fromSubAgentId: pgCore.varchar("from_sub_agent_id", { length: 256 }),
|
|
214136
|
+
toSubAgentId: pgCore.varchar("to_sub_agent_id", { length: 256 }),
|
|
214137
|
+
fromExternalAgentId: pgCore.varchar("from_external_sub_agent_id", { length: 256 }),
|
|
214138
|
+
toExternalAgentId: pgCore.varchar("to_external_sub_agent_id", { length: 256 }),
|
|
214139
|
+
fromTeamAgentId: pgCore.varchar("from_team_agent_id", { length: 256 }),
|
|
214140
|
+
toTeamAgentId: pgCore.varchar("to_team_agent_id", { length: 256 }),
|
|
214141
|
+
content: pgCore.jsonb("content").$type().notNull(),
|
|
214142
|
+
visibility: pgCore.varchar("visibility", { length: 256 }).notNull().default("user-facing"),
|
|
214143
|
+
messageType: pgCore.varchar("message_type", { length: 256 }).notNull().default("chat"),
|
|
214144
|
+
taskId: pgCore.varchar("task_id", { length: 256 }),
|
|
214145
|
+
parentMessageId: pgCore.varchar("parent_message_id", { length: 256 }),
|
|
214146
|
+
a2aTaskId: pgCore.varchar("a2a_task_id", { length: 256 }),
|
|
214147
|
+
a2aSessionId: pgCore.varchar("a2a_session_id", { length: 256 }),
|
|
214148
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
214146
214149
|
...timestamps
|
|
214147
214150
|
},
|
|
214148
214151
|
(table) => [
|
|
214149
|
-
|
|
214150
|
-
|
|
214152
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
214153
|
+
pgCore.foreignKey({
|
|
214151
214154
|
columns: [table.tenantId, table.projectId],
|
|
214152
214155
|
foreignColumns: [projects.tenantId, projects.id],
|
|
214153
214156
|
name: "messages_project_fk"
|
|
214154
214157
|
}).onDelete("cascade")
|
|
214155
214158
|
]
|
|
214156
214159
|
);
|
|
214157
|
-
var ledgerArtifacts =
|
|
214160
|
+
var ledgerArtifacts = pgCore.pgTable(
|
|
214158
214161
|
"ledger_artifacts",
|
|
214159
214162
|
{
|
|
214160
214163
|
...projectScoped,
|
|
214161
|
-
taskId:
|
|
214162
|
-
toolCallId:
|
|
214163
|
-
contextId:
|
|
214164
|
-
type:
|
|
214165
|
-
name:
|
|
214166
|
-
description:
|
|
214167
|
-
parts:
|
|
214168
|
-
metadata:
|
|
214169
|
-
summary:
|
|
214170
|
-
mime:
|
|
214171
|
-
visibility:
|
|
214172
|
-
allowedAgents:
|
|
214173
|
-
derivedFrom:
|
|
214164
|
+
taskId: pgCore.varchar("task_id", { length: 256 }).notNull(),
|
|
214165
|
+
toolCallId: pgCore.varchar("tool_call_id", { length: 256 }),
|
|
214166
|
+
contextId: pgCore.varchar("context_id", { length: 256 }).notNull(),
|
|
214167
|
+
type: pgCore.varchar("type", { length: 256 }).notNull().default("source"),
|
|
214168
|
+
name: pgCore.varchar("name", { length: 256 }),
|
|
214169
|
+
description: pgCore.text("description"),
|
|
214170
|
+
parts: pgCore.jsonb("parts").$type(),
|
|
214171
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
214172
|
+
summary: pgCore.text("summary"),
|
|
214173
|
+
mime: pgCore.jsonb("mime").$type(),
|
|
214174
|
+
visibility: pgCore.varchar("visibility", { length: 256 }).default("context"),
|
|
214175
|
+
allowedAgents: pgCore.jsonb("allowed_agents").$type(),
|
|
214176
|
+
derivedFrom: pgCore.varchar("derived_from", { length: 256 }),
|
|
214174
214177
|
...timestamps
|
|
214175
214178
|
},
|
|
214176
214179
|
(table) => [
|
|
214177
|
-
|
|
214178
|
-
|
|
214180
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
|
|
214181
|
+
pgCore.foreignKey({
|
|
214179
214182
|
columns: [table.tenantId, table.projectId],
|
|
214180
214183
|
foreignColumns: [projects.tenantId, projects.id],
|
|
214181
214184
|
name: "ledger_artifacts_project_fk"
|
|
214182
214185
|
}).onDelete("cascade"),
|
|
214183
|
-
|
|
214184
|
-
|
|
214185
|
-
|
|
214186
|
-
|
|
214186
|
+
pgCore.index("ledger_artifacts_task_id_idx").on(table.taskId),
|
|
214187
|
+
pgCore.index("ledger_artifacts_tool_call_id_idx").on(table.toolCallId),
|
|
214188
|
+
pgCore.index("ledger_artifacts_context_id_idx").on(table.contextId),
|
|
214189
|
+
pgCore.unique("ledger_artifacts_task_context_name_unique").on(
|
|
214187
214190
|
table.taskId,
|
|
214188
214191
|
table.contextId,
|
|
214189
214192
|
table.name
|
|
214190
214193
|
)
|
|
214191
214194
|
]
|
|
214192
214195
|
);
|
|
214193
|
-
var apiKeys =
|
|
214196
|
+
var apiKeys = pgCore.pgTable(
|
|
214194
214197
|
"api_keys",
|
|
214195
214198
|
{
|
|
214196
214199
|
...agentScoped,
|
|
214197
|
-
publicId:
|
|
214198
|
-
keyHash:
|
|
214199
|
-
keyPrefix:
|
|
214200
|
-
name:
|
|
214201
|
-
lastUsedAt:
|
|
214202
|
-
expiresAt:
|
|
214200
|
+
publicId: pgCore.varchar("public_id", { length: 256 }).notNull().unique(),
|
|
214201
|
+
keyHash: pgCore.varchar("key_hash", { length: 256 }).notNull(),
|
|
214202
|
+
keyPrefix: pgCore.varchar("key_prefix", { length: 256 }).notNull(),
|
|
214203
|
+
name: pgCore.varchar("name", { length: 256 }),
|
|
214204
|
+
lastUsedAt: pgCore.timestamp("last_used_at", { mode: "string" }),
|
|
214205
|
+
expiresAt: pgCore.timestamp("expires_at", { mode: "string" }),
|
|
214203
214206
|
...timestamps
|
|
214204
214207
|
},
|
|
214205
214208
|
(t) => [
|
|
214206
|
-
|
|
214209
|
+
pgCore.foreignKey({
|
|
214207
214210
|
columns: [t.tenantId, t.projectId],
|
|
214208
214211
|
foreignColumns: [projects.tenantId, projects.id],
|
|
214209
214212
|
name: "api_keys_project_fk"
|
|
214210
214213
|
}).onDelete("cascade"),
|
|
214211
|
-
|
|
214214
|
+
pgCore.foreignKey({
|
|
214212
214215
|
columns: [t.tenantId, t.projectId, t.agentId],
|
|
214213
214216
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
214214
214217
|
name: "api_keys_agent_fk"
|
|
214215
214218
|
}).onDelete("cascade"),
|
|
214216
|
-
|
|
214217
|
-
|
|
214218
|
-
|
|
214219
|
+
pgCore.index("api_keys_tenant_agent_idx").on(t.tenantId, t.agentId),
|
|
214220
|
+
pgCore.index("api_keys_prefix_idx").on(t.keyPrefix),
|
|
214221
|
+
pgCore.index("api_keys_public_id_idx").on(t.publicId)
|
|
214219
214222
|
]
|
|
214220
214223
|
);
|
|
214221
|
-
var credentialReferences =
|
|
214224
|
+
var credentialReferences = pgCore.pgTable(
|
|
214222
214225
|
"credential_references",
|
|
214223
214226
|
{
|
|
214224
214227
|
...projectScoped,
|
|
214225
|
-
name:
|
|
214226
|
-
type:
|
|
214227
|
-
credentialStoreId:
|
|
214228
|
-
retrievalParams:
|
|
214228
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
214229
|
+
type: pgCore.varchar("type", { length: 256 }).notNull(),
|
|
214230
|
+
credentialStoreId: pgCore.varchar("credential_store_id", { length: 256 }).notNull(),
|
|
214231
|
+
retrievalParams: pgCore.jsonb("retrieval_params").$type(),
|
|
214229
214232
|
...timestamps
|
|
214230
214233
|
},
|
|
214231
214234
|
(t) => [
|
|
214232
|
-
|
|
214233
|
-
|
|
214235
|
+
pgCore.primaryKey({ columns: [t.tenantId, t.projectId, t.id] }),
|
|
214236
|
+
pgCore.foreignKey({
|
|
214234
214237
|
columns: [t.tenantId, t.projectId],
|
|
214235
214238
|
foreignColumns: [projects.tenantId, projects.id],
|
|
214236
214239
|
name: "credential_references_project_fk"
|
|
@@ -216167,20 +216170,38 @@ var CredentialStuffer = class {
|
|
|
216167
216170
|
};
|
|
216168
216171
|
}
|
|
216169
216172
|
};
|
|
216170
|
-
|
|
216171
|
-
|
|
216172
|
-
|
|
216173
|
-
|
|
216173
|
+
var __filename2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
216174
|
+
path.dirname(__filename2);
|
|
216175
|
+
function createTestDatabaseClientNoMigrations() {
|
|
216176
|
+
const client = new pglite.PGlite();
|
|
216177
|
+
const db = pglite$1.drizzle(client, { schema: schema_exports });
|
|
216178
|
+
return db;
|
|
216179
|
+
}
|
|
216180
|
+
|
|
216181
|
+
// src/db/client.ts
|
|
216182
|
+
loadEnvironmentFiles();
|
|
216183
|
+
function createDatabaseClient(config = {}) {
|
|
216184
|
+
const connectionString = config.connectionString || process.env.DATABASE_URL;
|
|
216185
|
+
if (env.ENVIRONMENT === "test") {
|
|
216186
|
+
return createTestDatabaseClientNoMigrations();
|
|
216187
|
+
}
|
|
216188
|
+
if (!connectionString) {
|
|
216189
|
+
throw new Error(
|
|
216190
|
+
"DATABASE_URL environment variable is required. Please set it to your PostgreSQL connection string."
|
|
216191
|
+
);
|
|
216192
|
+
}
|
|
216193
|
+
const pool = new pg.Pool({
|
|
216194
|
+
connectionString,
|
|
216195
|
+
max: config.poolSize || Number(env.POSTGRES_POOL_SIZE) || 10
|
|
216174
216196
|
});
|
|
216175
|
-
|
|
216197
|
+
pool.on("error", (err) => {
|
|
216198
|
+
console.error("Unexpected PostgreSQL pool error:", err);
|
|
216199
|
+
});
|
|
216200
|
+
return nodePostgres.drizzle(pool, {
|
|
216176
216201
|
schema: schema_exports,
|
|
216177
216202
|
logger: config.logger
|
|
216178
216203
|
});
|
|
216179
216204
|
}
|
|
216180
|
-
function createInMemoryDatabaseClient() {
|
|
216181
|
-
const db = createDatabaseClient({ url: ":memory:" });
|
|
216182
|
-
return db;
|
|
216183
|
-
}
|
|
216184
216205
|
var generateId = nanoid.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789", 21);
|
|
216185
216206
|
function getConversationId() {
|
|
216186
216207
|
return generateId();
|
|
@@ -217273,8 +217294,8 @@ var deleteSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
|
217273
217294
|
drizzleOrm.eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId),
|
|
217274
217295
|
drizzleOrm.eq(subAgentExternalAgentRelations.id, params.relationId)
|
|
217275
217296
|
)
|
|
217276
|
-
);
|
|
217277
|
-
return
|
|
217297
|
+
).returning();
|
|
217298
|
+
return result.length > 0;
|
|
217278
217299
|
};
|
|
217279
217300
|
var deleteSubAgentExternalAgentRelationsBySubAgent = (db) => async (params) => {
|
|
217280
217301
|
const result = await db.delete(subAgentExternalAgentRelations).where(
|
|
@@ -217284,8 +217305,8 @@ var deleteSubAgentExternalAgentRelationsBySubAgent = (db) => async (params) => {
|
|
|
217284
217305
|
drizzleOrm.eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId),
|
|
217285
217306
|
drizzleOrm.eq(subAgentExternalAgentRelations.subAgentId, params.scopes.subAgentId)
|
|
217286
217307
|
)
|
|
217287
|
-
);
|
|
217288
|
-
return
|
|
217308
|
+
).returning();
|
|
217309
|
+
return result.length > 0;
|
|
217289
217310
|
};
|
|
217290
217311
|
var deleteSubAgentExternalAgentRelationsByAgent = (db) => async (params) => {
|
|
217291
217312
|
const result = await db.delete(subAgentExternalAgentRelations).where(
|
|
@@ -217294,8 +217315,8 @@ var deleteSubAgentExternalAgentRelationsByAgent = (db) => async (params) => {
|
|
|
217294
217315
|
drizzleOrm.eq(subAgentExternalAgentRelations.projectId, params.scopes.projectId),
|
|
217295
217316
|
drizzleOrm.eq(subAgentExternalAgentRelations.agentId, params.scopes.agentId)
|
|
217296
217317
|
)
|
|
217297
|
-
);
|
|
217298
|
-
return
|
|
217318
|
+
).returning();
|
|
217319
|
+
return result.length > 0;
|
|
217299
217320
|
};
|
|
217300
217321
|
var getAgentRelationById = (db) => async (params) => {
|
|
217301
217322
|
return db.query.subAgentRelations.findFirst({
|
|
@@ -217482,8 +217503,8 @@ var deleteSubAgentRelation = (db) => async (params) => {
|
|
|
217482
217503
|
drizzleOrm.eq(subAgentRelations.agentId, params.scopes.agentId),
|
|
217483
217504
|
drizzleOrm.eq(subAgentRelations.id, params.relationId)
|
|
217484
217505
|
)
|
|
217485
|
-
);
|
|
217486
|
-
return
|
|
217506
|
+
).returning();
|
|
217507
|
+
return result.length > 0;
|
|
217487
217508
|
};
|
|
217488
217509
|
var deleteAgentRelationsByAgent = (db) => async (params) => {
|
|
217489
217510
|
const result = await db.delete(subAgentRelations).where(
|
|
@@ -217491,8 +217512,8 @@ var deleteAgentRelationsByAgent = (db) => async (params) => {
|
|
|
217491
217512
|
drizzleOrm.eq(subAgentRelations.tenantId, params.scopes.tenantId),
|
|
217492
217513
|
drizzleOrm.eq(subAgentRelations.agentId, params.scopes.agentId)
|
|
217493
217514
|
)
|
|
217494
|
-
);
|
|
217495
|
-
return
|
|
217515
|
+
).returning();
|
|
217516
|
+
return result.length > 0;
|
|
217496
217517
|
};
|
|
217497
217518
|
var createAgentToolRelation = (db) => async (params) => {
|
|
217498
217519
|
const finalRelationId = params.relationId ?? generateId();
|
|
@@ -217531,8 +217552,8 @@ var deleteAgentToolRelation = (db) => async (params) => {
|
|
|
217531
217552
|
drizzleOrm.eq(subAgentToolRelations.agentId, params.scopes.agentId),
|
|
217532
217553
|
drizzleOrm.eq(subAgentToolRelations.id, params.relationId)
|
|
217533
217554
|
)
|
|
217534
|
-
);
|
|
217535
|
-
return
|
|
217555
|
+
).returning();
|
|
217556
|
+
return result.length > 0;
|
|
217536
217557
|
};
|
|
217537
217558
|
var deleteAgentToolRelationByAgent = (db) => async (params) => {
|
|
217538
217559
|
const result = await db.delete(subAgentToolRelations).where(
|
|
@@ -217542,8 +217563,8 @@ var deleteAgentToolRelationByAgent = (db) => async (params) => {
|
|
|
217542
217563
|
drizzleOrm.eq(subAgentToolRelations.agentId, params.scopes.agentId),
|
|
217543
217564
|
drizzleOrm.eq(subAgentToolRelations.subAgentId, params.scopes.subAgentId)
|
|
217544
217565
|
)
|
|
217545
|
-
);
|
|
217546
|
-
return
|
|
217566
|
+
).returning();
|
|
217567
|
+
return result.length > 0;
|
|
217547
217568
|
};
|
|
217548
217569
|
var getAgentToolRelationById = (db) => async (params) => {
|
|
217549
217570
|
return await db.query.subAgentToolRelations.findFirst({
|
|
@@ -218145,8 +218166,8 @@ var deleteSubAgentTeamAgentRelation = (db) => async (params) => {
|
|
|
218145
218166
|
drizzleOrm.eq(subAgentTeamAgentRelations.subAgentId, params.scopes.subAgentId),
|
|
218146
218167
|
drizzleOrm.eq(subAgentTeamAgentRelations.id, params.relationId)
|
|
218147
218168
|
)
|
|
218148
|
-
);
|
|
218149
|
-
return
|
|
218169
|
+
).returning();
|
|
218170
|
+
return result.length > 0;
|
|
218150
218171
|
};
|
|
218151
218172
|
var deleteSubAgentTeamAgentRelationsBySubAgent = (db) => async (params) => {
|
|
218152
218173
|
const result = await db.delete(subAgentTeamAgentRelations).where(
|
|
@@ -218156,8 +218177,8 @@ var deleteSubAgentTeamAgentRelationsBySubAgent = (db) => async (params) => {
|
|
|
218156
218177
|
drizzleOrm.eq(subAgentTeamAgentRelations.agentId, params.scopes.agentId),
|
|
218157
218178
|
drizzleOrm.eq(subAgentTeamAgentRelations.subAgentId, params.scopes.subAgentId)
|
|
218158
218179
|
)
|
|
218159
|
-
);
|
|
218160
|
-
return
|
|
218180
|
+
).returning();
|
|
218181
|
+
return result.length > 0;
|
|
218161
218182
|
};
|
|
218162
218183
|
var deleteSubAgentTeamAgentRelationsByAgent = (db) => async (params) => {
|
|
218163
218184
|
const result = await db.delete(subAgentTeamAgentRelations).where(
|
|
@@ -218166,8 +218187,8 @@ var deleteSubAgentTeamAgentRelationsByAgent = (db) => async (params) => {
|
|
|
218166
218187
|
drizzleOrm.eq(subAgentTeamAgentRelations.projectId, params.scopes.projectId),
|
|
218167
218188
|
drizzleOrm.eq(subAgentTeamAgentRelations.agentId, params.scopes.agentId)
|
|
218168
218189
|
)
|
|
218169
|
-
);
|
|
218170
|
-
return
|
|
218190
|
+
).returning();
|
|
218191
|
+
return result.length > 0;
|
|
218171
218192
|
};
|
|
218172
218193
|
var scryptAsync = util.promisify(crypto.scrypt);
|
|
218173
218194
|
var logger5 = getLogger("api-key");
|
|
@@ -218399,6 +218420,18 @@ var detectAuthenticationRequired = async ({
|
|
|
218399
218420
|
logger15?.debug({ error: error?.message }, "No MCP OAuth authentication requirement detected");
|
|
218400
218421
|
return false;
|
|
218401
218422
|
};
|
|
218423
|
+
|
|
218424
|
+
// src/utils/date.ts
|
|
218425
|
+
function normalizeDateString(dateString) {
|
|
218426
|
+
if (typeof dateString !== "string") {
|
|
218427
|
+
return dateString;
|
|
218428
|
+
}
|
|
218429
|
+
const pgTimestampPattern = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(\.\d{1,3})?$/;
|
|
218430
|
+
if (pgTimestampPattern.test(dateString)) {
|
|
218431
|
+
return dateString.replace(" ", "T") + "Z";
|
|
218432
|
+
}
|
|
218433
|
+
return dateString;
|
|
218434
|
+
}
|
|
218402
218435
|
var ErrorCode = zodOpenapi.z.enum([
|
|
218403
218436
|
"bad_request",
|
|
218404
218437
|
"unauthorized",
|
|
@@ -219320,8 +219353,8 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry) => {
|
|
|
219320
219353
|
availableTools: [],
|
|
219321
219354
|
capabilities: capabilities || void 0,
|
|
219322
219355
|
credentialReferenceId: credentialReferenceId || void 0,
|
|
219323
|
-
createdAt: new Date(createdAt),
|
|
219324
|
-
updatedAt: new Date(dbResult.updatedAt),
|
|
219356
|
+
createdAt: new Date(normalizeDateString(createdAt)),
|
|
219357
|
+
updatedAt: new Date(normalizeDateString(dbResult.updatedAt)),
|
|
219325
219358
|
lastError: null,
|
|
219326
219359
|
headers: headers2 || void 0,
|
|
219327
219360
|
imageUrl: imageUrl || void 0
|
|
@@ -219354,7 +219387,7 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry) => {
|
|
|
219354
219387
|
} else if (credentialStore.type === CredentialStoreType.keychain) {
|
|
219355
219388
|
const oauthTokens = JSON.parse(credentialDataString);
|
|
219356
219389
|
if (oauthTokens.expires_at) {
|
|
219357
|
-
expiresAt = new Date(oauthTokens.expires_at);
|
|
219390
|
+
expiresAt = new Date(normalizeDateString(oauthTokens.expires_at));
|
|
219358
219391
|
}
|
|
219359
219392
|
}
|
|
219360
219393
|
}
|
|
@@ -219391,7 +219424,7 @@ var dbResultToMcpTool = async (dbResult, dbClient, credentialStoreRegistry) => {
|
|
|
219391
219424
|
availableTools,
|
|
219392
219425
|
capabilities: capabilities || void 0,
|
|
219393
219426
|
credentialReferenceId: credentialReferenceId || void 0,
|
|
219394
|
-
createdAt: new Date(createdAt),
|
|
219427
|
+
createdAt: new Date(normalizeDateString(createdAt)),
|
|
219395
219428
|
updatedAt: new Date(now),
|
|
219396
219429
|
expiresAt,
|
|
219397
219430
|
lastError: lastErrorComputed,
|
|
@@ -219953,8 +219986,8 @@ var getFullAgentDefinition = (db) => async ({
|
|
|
219953
219986
|
description: agent.description,
|
|
219954
219987
|
defaultSubAgentId: agent.defaultSubAgentId,
|
|
219955
219988
|
subAgents: agentsObject,
|
|
219956
|
-
createdAt: agent.createdAt && !Number.isNaN(new Date(agent.createdAt).getTime()) ? new Date(agent.createdAt)
|
|
219957
|
-
updatedAt: agent.updatedAt && !Number.isNaN(new Date(agent.updatedAt).getTime()) ? new Date(agent.updatedAt)
|
|
219989
|
+
createdAt: agent.createdAt && !Number.isNaN(new Date(agent.createdAt).getTime()) ? new Date(agent.createdAt) : /* @__PURE__ */ new Date(),
|
|
219990
|
+
updatedAt: agent.updatedAt && !Number.isNaN(new Date(agent.updatedAt).getTime()) ? new Date(agent.updatedAt) : /* @__PURE__ */ new Date()
|
|
219958
219991
|
};
|
|
219959
219992
|
if (Object.keys(externalAgentsObject).length > 0) {
|
|
219960
219993
|
result.externalAgents = externalAgentsObject;
|
|
@@ -220363,8 +220396,8 @@ var deleteAgentArtifactComponentRelationByAgent = (db) => async (params) => {
|
|
|
220363
220396
|
drizzleOrm.eq(subAgentArtifactComponents.agentId, params.scopes.agentId),
|
|
220364
220397
|
drizzleOrm.eq(subAgentArtifactComponents.subAgentId, params.scopes.subAgentId)
|
|
220365
220398
|
)
|
|
220366
|
-
);
|
|
220367
|
-
return
|
|
220399
|
+
).returning();
|
|
220400
|
+
return result.length > 0;
|
|
220368
220401
|
};
|
|
220369
220402
|
var getAgentsUsingArtifactComponent = (db) => async (params) => {
|
|
220370
220403
|
return await db.select({
|
|
@@ -220734,8 +220767,8 @@ var deleteAgentDataComponentRelationByAgent = (db) => async (params) => {
|
|
|
220734
220767
|
drizzleOrm.eq(subAgentDataComponents.agentId, params.scopes.agentId),
|
|
220735
220768
|
drizzleOrm.eq(subAgentDataComponents.subAgentId, params.scopes.subAgentId)
|
|
220736
220769
|
)
|
|
220737
|
-
);
|
|
220738
|
-
return
|
|
220770
|
+
).returning();
|
|
220771
|
+
return result.length > 0;
|
|
220739
220772
|
};
|
|
220740
220773
|
var getAgentsUsingDataComponent = (db) => async (params) => {
|
|
220741
220774
|
return await db.select({
|
|
@@ -221819,8 +221852,8 @@ var updateFullAgentServerSide = (db, logger15 = defaultLogger) => async (scopes,
|
|
|
221819
221852
|
drizzleOrm.eq(subAgentToolRelations.agentId, finalAgentId),
|
|
221820
221853
|
drizzleOrm.eq(subAgentToolRelations.subAgentId, subAgentId)
|
|
221821
221854
|
)
|
|
221822
|
-
);
|
|
221823
|
-
deletedCount = result.
|
|
221855
|
+
).returning();
|
|
221856
|
+
deletedCount = result.length;
|
|
221824
221857
|
} else {
|
|
221825
221858
|
const result = await db.delete(subAgentToolRelations).where(
|
|
221826
221859
|
drizzleOrm.and(
|
|
@@ -221830,8 +221863,8 @@ var updateFullAgentServerSide = (db, logger15 = defaultLogger) => async (scopes,
|
|
|
221830
221863
|
drizzleOrm.eq(subAgentToolRelations.subAgentId, subAgentId),
|
|
221831
221864
|
drizzleOrm.not(drizzleOrm.inArray(subAgentToolRelations.id, Array.from(incomingRelationshipIds)))
|
|
221832
221865
|
)
|
|
221833
|
-
);
|
|
221834
|
-
deletedCount = result.
|
|
221866
|
+
).returning();
|
|
221867
|
+
deletedCount = result.length;
|
|
221835
221868
|
}
|
|
221836
221869
|
if (deletedCount > 0) {
|
|
221837
221870
|
logger15.info({ subAgentId, deletedCount }, "Deleted orphaned agent-tool relations");
|
|
@@ -222289,6 +222322,7 @@ var deleteApiKey = (db) => async (params) => {
|
|
|
222289
222322
|
id: params.id
|
|
222290
222323
|
});
|
|
222291
222324
|
if (!existingKey) {
|
|
222325
|
+
console.error("API key not found", { params });
|
|
222292
222326
|
return false;
|
|
222293
222327
|
}
|
|
222294
222328
|
await db.delete(apiKeys).where(
|
|
@@ -222419,8 +222453,8 @@ var clearConversationCache = (db) => async (params) => {
|
|
|
222419
222453
|
drizzleOrm.eq(contextCache.projectId, params.scopes.projectId),
|
|
222420
222454
|
drizzleOrm.eq(contextCache.conversationId, params.conversationId)
|
|
222421
222455
|
)
|
|
222422
|
-
);
|
|
222423
|
-
return result.
|
|
222456
|
+
).returning();
|
|
222457
|
+
return result.length;
|
|
222424
222458
|
};
|
|
222425
222459
|
var clearContextConfigCache = (db) => async (params) => {
|
|
222426
222460
|
const result = await db.delete(contextCache).where(
|
|
@@ -222429,8 +222463,8 @@ var clearContextConfigCache = (db) => async (params) => {
|
|
|
222429
222463
|
drizzleOrm.eq(contextCache.projectId, params.scopes.projectId),
|
|
222430
222464
|
drizzleOrm.eq(contextCache.contextConfigId, params.contextConfigId)
|
|
222431
222465
|
)
|
|
222432
|
-
);
|
|
222433
|
-
return result.
|
|
222466
|
+
).returning();
|
|
222467
|
+
return result.length;
|
|
222434
222468
|
};
|
|
222435
222469
|
var cleanupTenantCache = (db) => async (params) => {
|
|
222436
222470
|
const result = await db.delete(contextCache).where(
|
|
@@ -222438,8 +222472,8 @@ var cleanupTenantCache = (db) => async (params) => {
|
|
|
222438
222472
|
drizzleOrm.eq(contextCache.tenantId, params.scopes.tenantId),
|
|
222439
222473
|
drizzleOrm.eq(contextCache.projectId, params.scopes.projectId)
|
|
222440
222474
|
)
|
|
222441
|
-
);
|
|
222442
|
-
return result.
|
|
222475
|
+
).returning();
|
|
222476
|
+
return result.length;
|
|
222443
222477
|
};
|
|
222444
222478
|
var invalidateHeadersCache = (db) => async (params) => {
|
|
222445
222479
|
const result = await db.delete(contextCache).where(
|
|
@@ -222450,8 +222484,8 @@ var invalidateHeadersCache = (db) => async (params) => {
|
|
|
222450
222484
|
drizzleOrm.eq(contextCache.contextConfigId, params.contextConfigId),
|
|
222451
222485
|
drizzleOrm.eq(contextCache.contextVariableKey, "headers")
|
|
222452
222486
|
)
|
|
222453
|
-
);
|
|
222454
|
-
return result.
|
|
222487
|
+
).returning();
|
|
222488
|
+
return result.length;
|
|
222455
222489
|
};
|
|
222456
222490
|
var invalidateInvocationDefinitionsCache = (db) => async (params) => {
|
|
222457
222491
|
let totalRowsAffected = 0;
|
|
@@ -222464,8 +222498,8 @@ var invalidateInvocationDefinitionsCache = (db) => async (params) => {
|
|
|
222464
222498
|
drizzleOrm.eq(contextCache.contextConfigId, params.contextConfigId),
|
|
222465
222499
|
drizzleOrm.eq(contextCache.contextVariableKey, definitionId)
|
|
222466
222500
|
)
|
|
222467
|
-
);
|
|
222468
|
-
totalRowsAffected += result.
|
|
222501
|
+
).returning();
|
|
222502
|
+
totalRowsAffected += result.length;
|
|
222469
222503
|
}
|
|
222470
222504
|
return totalRowsAffected;
|
|
222471
222505
|
};
|
|
@@ -222884,7 +222918,7 @@ var addLedgerArtifacts = (db) => async (params) => {
|
|
|
222884
222918
|
return;
|
|
222885
222919
|
} catch (error) {
|
|
222886
222920
|
lastError = error;
|
|
222887
|
-
const isRetryable = error.code === "
|
|
222921
|
+
const isRetryable = error.cause.code === "40P01" || error.cause.code === "40001" || error.cause.code === "55P03" || error.message?.includes("database is locked") || error.message?.includes("busy") || error.message?.includes("timeout") || error.message?.includes("deadlock") || error.message?.includes("serialization failure");
|
|
222888
222922
|
if (!isRetryable || attempt === maxRetries) {
|
|
222889
222923
|
await tryFallbackInsert(db, rows);
|
|
222890
222924
|
return;
|
|
@@ -223302,9 +223336,7 @@ var createFullProjectServerSide = (db, logger15 = defaultLogger2) => async (scop
|
|
|
223302
223336
|
description: typed.description || "",
|
|
223303
223337
|
models: typed.models,
|
|
223304
223338
|
stopWhen: typed.stopWhen,
|
|
223305
|
-
tenantId
|
|
223306
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
223307
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
223339
|
+
tenantId
|
|
223308
223340
|
};
|
|
223309
223341
|
logger15.info({ projectId: typed.id }, "Creating project metadata");
|
|
223310
223342
|
await createProject(db)(projectPayload);
|
|
@@ -227094,7 +227126,6 @@ exports.createExternalAgent = createExternalAgent;
|
|
|
227094
227126
|
exports.createFullAgentServerSide = createFullAgentServerSide;
|
|
227095
227127
|
exports.createFullProjectServerSide = createFullProjectServerSide;
|
|
227096
227128
|
exports.createFunctionTool = createFunctionTool;
|
|
227097
|
-
exports.createInMemoryDatabaseClient = createInMemoryDatabaseClient;
|
|
227098
227129
|
exports.createKeyChainStore = createKeyChainStore;
|
|
227099
227130
|
exports.createMessage = createMessage;
|
|
227100
227131
|
exports.createNangoCredentialStore = createNangoCredentialStore;
|
|
@@ -227290,6 +227321,7 @@ exports.loggerFactory = loggerFactory;
|
|
|
227290
227321
|
exports.maskApiKey = maskApiKey;
|
|
227291
227322
|
exports.messages = messages;
|
|
227292
227323
|
exports.messagesRelations = messagesRelations;
|
|
227324
|
+
exports.normalizeDateString = normalizeDateString;
|
|
227293
227325
|
exports.preview = preview;
|
|
227294
227326
|
exports.problemDetailsSchema = problemDetailsSchema;
|
|
227295
227327
|
exports.projectExists = projectExists;
|