@massa-ai/tools-api 1.17.0 → 1.19.0
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.js +1091 -910
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -13461,6 +13461,16 @@ var init_index_manager = __esm(() => {
|
|
|
13461
13461
|
globAsync = glob;
|
|
13462
13462
|
});
|
|
13463
13463
|
|
|
13464
|
+
// ../../packages/core/dist/services/cache/lru-evict.js
|
|
13465
|
+
function evictOldest(cache, maxRetained) {
|
|
13466
|
+
while (cache.size > maxRetained) {
|
|
13467
|
+
const oldest = cache.keys().next().value;
|
|
13468
|
+
if (oldest === undefined)
|
|
13469
|
+
break;
|
|
13470
|
+
cache.delete(oldest);
|
|
13471
|
+
}
|
|
13472
|
+
}
|
|
13473
|
+
|
|
13464
13474
|
// ../../packages/core/dist/services/search/file-filter-cache.js
|
|
13465
13475
|
class FileFilterCache {
|
|
13466
13476
|
cache = new Map;
|
|
@@ -13529,18 +13539,7 @@ class FileFilterCache {
|
|
|
13529
13539
|
return parts.join("|");
|
|
13530
13540
|
}
|
|
13531
13541
|
evictOldest() {
|
|
13532
|
-
|
|
13533
|
-
let oldestTime = Infinity;
|
|
13534
|
-
for (const [key, entry] of this.cache.entries()) {
|
|
13535
|
-
if (entry.createdAt < oldestTime) {
|
|
13536
|
-
oldestTime = entry.createdAt;
|
|
13537
|
-
oldestKey = key;
|
|
13538
|
-
}
|
|
13539
|
-
}
|
|
13540
|
-
if (oldestKey) {
|
|
13541
|
-
this.cache.delete(oldestKey);
|
|
13542
|
-
logger.debug("Evicted oldest filter cache entry", { key: oldestKey });
|
|
13543
|
-
}
|
|
13542
|
+
evictOldest(this.cache, this.MAX_CACHE_SIZE);
|
|
13544
13543
|
}
|
|
13545
13544
|
invalidateProject(projectId) {
|
|
13546
13545
|
let removed = 0;
|
|
@@ -110963,7 +110962,7 @@ var init_memory_repository_factory = __esm(() => {
|
|
|
110963
110962
|
init_memory_repository_pg();
|
|
110964
110963
|
});
|
|
110965
110964
|
|
|
110966
|
-
// ../../packages/core/dist/services/graph/graph-store-pg.js
|
|
110965
|
+
// ../../packages/core/dist/services/memory-graph/graph-store-pg.js
|
|
110967
110966
|
function metadataForEdge(edge) {
|
|
110968
110967
|
return {
|
|
110969
110968
|
autoExtracted: edge.autoExtracted ?? false,
|
|
@@ -111279,7 +111278,7 @@ var init_graph_store_pg = __esm(() => {
|
|
|
111279
111278
|
graphStorePg = GraphStorePg.getInstance();
|
|
111280
111279
|
});
|
|
111281
111280
|
|
|
111282
|
-
// ../../packages/core/dist/services/graph/graph-store-factory.js
|
|
111281
|
+
// ../../packages/core/dist/services/memory-graph/graph-store-factory.js
|
|
111283
111282
|
function getGraphStore() {
|
|
111284
111283
|
if (cachedStore2)
|
|
111285
111284
|
return cachedStore2;
|
|
@@ -122213,16 +122212,16 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
122213
122212
|
const seen = new Set;
|
|
122214
122213
|
const out = [];
|
|
122215
122214
|
for (const e of httpEdges) {
|
|
122216
|
-
const
|
|
122217
|
-
if (!
|
|
122215
|
+
const path19 = e.route;
|
|
122216
|
+
if (!path19)
|
|
122218
122217
|
continue;
|
|
122219
122218
|
const method = (e.method ?? "ANY").toUpperCase();
|
|
122220
|
-
const key = method + " " +
|
|
122219
|
+
const key = method + " " + path19;
|
|
122221
122220
|
if (seen.has(key))
|
|
122222
122221
|
continue;
|
|
122223
122222
|
seen.add(key);
|
|
122224
122223
|
out.push({
|
|
122225
|
-
path:
|
|
122224
|
+
path: path19,
|
|
122226
122225
|
method: e.method,
|
|
122227
122226
|
file: e.fromFile,
|
|
122228
122227
|
handler: e.targetFqn ?? e.symbolName
|
|
@@ -122233,12 +122232,12 @@ function detectRoutes(httpEdges, defs, opts = {}) {
|
|
|
122233
122232
|
continue;
|
|
122234
122233
|
const parsed = parseRouteName(d.name);
|
|
122235
122234
|
const method = parsed?.method ?? "ANY";
|
|
122236
|
-
const
|
|
122237
|
-
const key = method + " " +
|
|
122235
|
+
const path19 = parsed?.path ?? d.name;
|
|
122236
|
+
const key = method + " " + path19;
|
|
122238
122237
|
if (seen.has(key))
|
|
122239
122238
|
continue;
|
|
122240
122239
|
seen.add(key);
|
|
122241
|
-
out.push({ path:
|
|
122240
|
+
out.push({ path: path19, method: parsed?.method, file: d.filePath, handler: d.name });
|
|
122242
122241
|
}
|
|
122243
122242
|
for (const d of defs) {
|
|
122244
122243
|
const parsed = parseRouteName(d.name);
|
|
@@ -122459,7 +122458,7 @@ __export(exports_symbol_graph_service, {
|
|
|
122459
122458
|
symbolGraphService: () => symbolGraphService,
|
|
122460
122459
|
SymbolGraphService: () => SymbolGraphService
|
|
122461
122460
|
});
|
|
122462
|
-
import
|
|
122461
|
+
import path19 from "path";
|
|
122463
122462
|
import fs9 from "fs/promises";
|
|
122464
122463
|
|
|
122465
122464
|
class SymbolGraphService {
|
|
@@ -122813,7 +122812,7 @@ class SymbolGraphService {
|
|
|
122813
122812
|
}
|
|
122814
122813
|
async resolveToAbsolute(relativePath, projectId) {
|
|
122815
122814
|
const root = await this.getProjectRoot(projectId);
|
|
122816
|
-
return root ?
|
|
122815
|
+
return root ? path19.resolve(root, relativePath) : relativePath;
|
|
122817
122816
|
}
|
|
122818
122817
|
async getProjectRoot(projectId) {
|
|
122819
122818
|
const cached2 = this.projectRootCache.get(projectId);
|
|
@@ -122833,12 +122832,7 @@ class SymbolGraphService {
|
|
|
122833
122832
|
return null;
|
|
122834
122833
|
}
|
|
122835
122834
|
evictOldestProjectRoot() {
|
|
122836
|
-
|
|
122837
|
-
const oldest = this.projectRootCache.keys().next().value;
|
|
122838
|
-
if (oldest === undefined)
|
|
122839
|
-
break;
|
|
122840
|
-
this.projectRootCache.delete(oldest);
|
|
122841
|
-
}
|
|
122835
|
+
evictOldest(this.projectRootCache, this.PROJECT_ROOT_CACHE_MAX_ENTRIES - 1);
|
|
122842
122836
|
}
|
|
122843
122837
|
clearProjectRoot(projectId) {
|
|
122844
122838
|
this.projectRootCache.delete(projectId);
|
|
@@ -123130,7 +123124,7 @@ var init_memory_service = __esm(() => {
|
|
|
123130
123124
|
init_decay();
|
|
123131
123125
|
});
|
|
123132
123126
|
|
|
123133
|
-
// ../../packages/core/dist/services/graph/relation-extractor.js
|
|
123127
|
+
// ../../packages/core/dist/services/memory-graph/relation-extractor.js
|
|
123134
123128
|
class RelationExtractor {
|
|
123135
123129
|
graphStore;
|
|
123136
123130
|
constructor(graphStore) {
|
|
@@ -123368,7 +123362,7 @@ var init_relation_extractor = __esm(() => {
|
|
|
123368
123362
|
];
|
|
123369
123363
|
});
|
|
123370
123364
|
|
|
123371
|
-
// ../../packages/core/dist/services/graph/graph-queries.js
|
|
123365
|
+
// ../../packages/core/dist/services/memory-graph/graph-queries.js
|
|
123372
123366
|
class GraphQueries {
|
|
123373
123367
|
graphStore;
|
|
123374
123368
|
constructor(graphStore) {
|
|
@@ -123588,7 +123582,7 @@ var init_graph_queries = __esm(() => {
|
|
|
123588
123582
|
};
|
|
123589
123583
|
});
|
|
123590
123584
|
|
|
123591
|
-
// ../../packages/core/dist/services/graph/memory-graph.service.js
|
|
123585
|
+
// ../../packages/core/dist/services/memory-graph/memory-graph.service.js
|
|
123592
123586
|
class MemoryGraphService {
|
|
123593
123587
|
static instance = null;
|
|
123594
123588
|
store;
|
|
@@ -126808,31 +126802,31 @@ class TracePathService {
|
|
|
126808
126802
|
const chains = [];
|
|
126809
126803
|
const seen = new Set;
|
|
126810
126804
|
let walks = 0;
|
|
126811
|
-
const walk = (fqn,
|
|
126805
|
+
const walk = (fqn, path22) => {
|
|
126812
126806
|
if (chains.length >= CHAIN_CAP)
|
|
126813
126807
|
return;
|
|
126814
126808
|
if (walks >= MAX_WALKS)
|
|
126815
126809
|
return;
|
|
126816
126810
|
walks++;
|
|
126817
|
-
const key =
|
|
126811
|
+
const key = path22.join("\u2192");
|
|
126818
126812
|
if (seen.has(key))
|
|
126819
126813
|
return;
|
|
126820
126814
|
seen.add(key);
|
|
126821
126815
|
const next = adj.get(fqn);
|
|
126822
126816
|
if (!next || next.length === 0 || !whoHasChild.has(fqn)) {
|
|
126823
|
-
if (
|
|
126824
|
-
chains.push(
|
|
126817
|
+
if (path22.length > 1)
|
|
126818
|
+
chains.push(path22.map((n2) => this.fqnToName(n2)).join(" \u2192 "));
|
|
126825
126819
|
return;
|
|
126826
126820
|
}
|
|
126827
126821
|
for (const child of next) {
|
|
126828
126822
|
if (chains.length >= CHAIN_CAP || walks >= MAX_WALKS)
|
|
126829
126823
|
return;
|
|
126830
|
-
if (
|
|
126831
|
-
const cycled = [...
|
|
126824
|
+
if (path22.includes(child)) {
|
|
126825
|
+
const cycled = [...path22, `${this.fqnToName(child)}\u21BA`];
|
|
126832
126826
|
chains.push(cycled.map((n2) => n2).join(" \u2192 "));
|
|
126833
126827
|
continue;
|
|
126834
126828
|
}
|
|
126835
|
-
walk(child, [...
|
|
126829
|
+
walk(child, [...path22, child]);
|
|
126836
126830
|
}
|
|
126837
126831
|
};
|
|
126838
126832
|
for (const seed of seeds) {
|
|
@@ -129976,7 +129970,7 @@ var init_l1_memory_cache = __esm(() => {
|
|
|
129976
129970
|
// ../../packages/core/dist/services/health/local-health-checker.js
|
|
129977
129971
|
import fs12 from "fs/promises";
|
|
129978
129972
|
import { existsSync as existsSync3 } from "fs";
|
|
129979
|
-
import
|
|
129973
|
+
import path24 from "path";
|
|
129980
129974
|
|
|
129981
129975
|
class LocalHealthChecker {
|
|
129982
129976
|
ollamaBaseUrl = process.env.OLLAMA_BASE_URL || "http://localhost:11434";
|
|
@@ -130011,7 +130005,7 @@ class LocalHealthChecker {
|
|
|
130011
130005
|
try {
|
|
130012
130006
|
if (!existsSync3(this.dataDir))
|
|
130013
130007
|
await fs12.mkdir(this.dataDir, { recursive: true });
|
|
130014
|
-
const probe2 =
|
|
130008
|
+
const probe2 = path24.join(this.dataDir, ".health-check-test");
|
|
130015
130009
|
await fs12.writeFile(probe2, "ok");
|
|
130016
130010
|
await fs12.unlink(probe2);
|
|
130017
130011
|
return { available: true, latency: Date.now() - start, details: { path: this.dataDir, writable: true } };
|
|
@@ -131925,7 +131919,7 @@ var init_scheduler2 = __esm(() => {
|
|
|
131925
131919
|
// ../../packages/core/dist/services/pricing/models-dev-client.js
|
|
131926
131920
|
import fs13 from "fs/promises";
|
|
131927
131921
|
import { existsSync as existsSync4 } from "fs";
|
|
131928
|
-
import
|
|
131922
|
+
import path25 from "path";
|
|
131929
131923
|
function getModelsDevClient() {
|
|
131930
131924
|
if (!clientInstance) {
|
|
131931
131925
|
clientInstance = new ModelsDevClient;
|
|
@@ -131945,7 +131939,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
131945
131939
|
memoryCacheTimestamp = 0;
|
|
131946
131940
|
getLocalCachePath() {
|
|
131947
131941
|
const dataDir = config.get("dataDir");
|
|
131948
|
-
return
|
|
131942
|
+
return path25.join(dataDir, ModelsDevClient.LOCAL_CACHE_FILE);
|
|
131949
131943
|
}
|
|
131950
131944
|
async loadLocalCache() {
|
|
131951
131945
|
const cachePath = this.getLocalCachePath();
|
|
@@ -131980,7 +131974,7 @@ var init_models_dev_client = __esm(() => {
|
|
|
131980
131974
|
async saveLocalCache(models) {
|
|
131981
131975
|
const cachePath = this.getLocalCachePath();
|
|
131982
131976
|
try {
|
|
131983
|
-
const dir =
|
|
131977
|
+
const dir = path25.dirname(cachePath);
|
|
131984
131978
|
await fs13.mkdir(dir, { recursive: true });
|
|
131985
131979
|
const data = {
|
|
131986
131980
|
timestamp: Date.now(),
|
|
@@ -137871,33 +137865,33 @@ var require_URL = __commonJS((exports, module) => {
|
|
|
137871
137865
|
else
|
|
137872
137866
|
return basepath.substring(0, lastslash + 1) + refpath;
|
|
137873
137867
|
}
|
|
137874
|
-
function remove_dot_segments(
|
|
137875
|
-
if (!
|
|
137876
|
-
return
|
|
137868
|
+
function remove_dot_segments(path26) {
|
|
137869
|
+
if (!path26)
|
|
137870
|
+
return path26;
|
|
137877
137871
|
var output = "";
|
|
137878
|
-
while (
|
|
137879
|
-
if (
|
|
137880
|
-
|
|
137872
|
+
while (path26.length > 0) {
|
|
137873
|
+
if (path26 === "." || path26 === "..") {
|
|
137874
|
+
path26 = "";
|
|
137881
137875
|
break;
|
|
137882
137876
|
}
|
|
137883
|
-
var twochars =
|
|
137884
|
-
var threechars =
|
|
137885
|
-
var fourchars =
|
|
137877
|
+
var twochars = path26.substring(0, 2);
|
|
137878
|
+
var threechars = path26.substring(0, 3);
|
|
137879
|
+
var fourchars = path26.substring(0, 4);
|
|
137886
137880
|
if (threechars === "../") {
|
|
137887
|
-
|
|
137881
|
+
path26 = path26.substring(3);
|
|
137888
137882
|
} else if (twochars === "./") {
|
|
137889
|
-
|
|
137883
|
+
path26 = path26.substring(2);
|
|
137890
137884
|
} else if (threechars === "/./") {
|
|
137891
|
-
|
|
137892
|
-
} else if (twochars === "/." &&
|
|
137893
|
-
|
|
137894
|
-
} else if (fourchars === "/../" || threechars === "/.." &&
|
|
137895
|
-
|
|
137885
|
+
path26 = "/" + path26.substring(3);
|
|
137886
|
+
} else if (twochars === "/." && path26.length === 2) {
|
|
137887
|
+
path26 = "/";
|
|
137888
|
+
} else if (fourchars === "/../" || threechars === "/.." && path26.length === 3) {
|
|
137889
|
+
path26 = "/" + path26.substring(4);
|
|
137896
137890
|
output = output.replace(/\/?[^\/]*$/, "");
|
|
137897
137891
|
} else {
|
|
137898
|
-
var segment =
|
|
137892
|
+
var segment = path26.match(/(\/?([^\/]*))/)[0];
|
|
137899
137893
|
output += segment;
|
|
137900
|
-
|
|
137894
|
+
path26 = path26.substring(segment.length);
|
|
137901
137895
|
}
|
|
137902
137896
|
}
|
|
137903
137897
|
return output;
|
|
@@ -149967,21 +149961,21 @@ function jsonToKeyPathChunks(value, label = "$") {
|
|
|
149967
149961
|
walk(value, label, out);
|
|
149968
149962
|
return out;
|
|
149969
149963
|
}
|
|
149970
|
-
function walk(val,
|
|
149964
|
+
function walk(val, path26, out) {
|
|
149971
149965
|
if (val === null || val === undefined)
|
|
149972
149966
|
return;
|
|
149973
149967
|
if (Array.isArray(val)) {
|
|
149974
149968
|
if (val.length === 0) {
|
|
149975
|
-
out.push({ path:
|
|
149969
|
+
out.push({ path: path26, content: `**${path26}** = _[]_` });
|
|
149976
149970
|
return;
|
|
149977
149971
|
}
|
|
149978
149972
|
if (val.every((v) => v !== null && typeof v === "object")) {
|
|
149979
|
-
val.forEach((v, i) => walk(v, `${
|
|
149973
|
+
val.forEach((v, i) => walk(v, `${path26}[${i}]`, out));
|
|
149980
149974
|
return;
|
|
149981
149975
|
}
|
|
149982
149976
|
const items = val.map((v) => `- \`${String(v)}\``).join(`
|
|
149983
149977
|
`);
|
|
149984
|
-
out.push({ path:
|
|
149978
|
+
out.push({ path: path26, content: `**${path26}**
|
|
149985
149979
|
|
|
149986
149980
|
${items}` });
|
|
149987
149981
|
return;
|
|
@@ -149989,16 +149983,16 @@ ${items}` });
|
|
|
149989
149983
|
if (typeof val === "object") {
|
|
149990
149984
|
const entries = Object.entries(val);
|
|
149991
149985
|
if (entries.length === 0) {
|
|
149992
|
-
out.push({ path:
|
|
149986
|
+
out.push({ path: path26, content: `**${path26}** = _{}_` });
|
|
149993
149987
|
return;
|
|
149994
149988
|
}
|
|
149995
149989
|
for (const [k2, v] of entries) {
|
|
149996
149990
|
const safeKey = /^[A-Za-z_$][\w$]*$/.test(k2) ? k2 : JSON.stringify(k2);
|
|
149997
|
-
walk(v, `${
|
|
149991
|
+
walk(v, `${path26}.${safeKey}`, out);
|
|
149998
149992
|
}
|
|
149999
149993
|
return;
|
|
150000
149994
|
}
|
|
150001
|
-
out.push({ path:
|
|
149995
|
+
out.push({ path: path26, content: `**${path26}** = \`${String(val)}\`` });
|
|
150002
149996
|
}
|
|
150003
149997
|
var gfm, STRIP_SELECTORS, tdCache = null;
|
|
150004
149998
|
var init_html_to_md = __esm(() => {
|
|
@@ -150264,12 +150258,7 @@ class WebController {
|
|
|
150264
150258
|
markIndexed: (key, ts) => {
|
|
150265
150259
|
this.cache.delete(key);
|
|
150266
150260
|
this.cache.set(key, ts);
|
|
150267
|
-
|
|
150268
|
-
const oldest = this.cache.keys().next().value;
|
|
150269
|
-
if (oldest === undefined)
|
|
150270
|
-
break;
|
|
150271
|
-
this.cache.delete(oldest);
|
|
150272
|
-
}
|
|
150261
|
+
evictOldest(this.cache, WEB_CACHE_MAX_ENTRIES);
|
|
150273
150262
|
}
|
|
150274
150263
|
};
|
|
150275
150264
|
}
|
|
@@ -151103,70 +151092,199 @@ class TypeBoxError extends Error {
|
|
|
151103
151092
|
super(message);
|
|
151104
151093
|
}
|
|
151105
151094
|
}
|
|
151095
|
+
|
|
151096
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
151097
|
+
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
151098
|
+
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
151099
|
+
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
151100
|
+
var Hint = Symbol.for("TypeBox.Hint");
|
|
151101
|
+
var Kind = Symbol.for("TypeBox.Kind");
|
|
151102
|
+
|
|
151103
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
151104
|
+
function IsReadonly(value) {
|
|
151105
|
+
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
151106
|
+
}
|
|
151107
|
+
function IsOptional(value) {
|
|
151108
|
+
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
151109
|
+
}
|
|
151110
|
+
function IsAny(value) {
|
|
151111
|
+
return IsKindOf(value, "Any");
|
|
151112
|
+
}
|
|
151113
|
+
function IsArgument(value) {
|
|
151114
|
+
return IsKindOf(value, "Argument");
|
|
151115
|
+
}
|
|
151116
|
+
function IsArray3(value) {
|
|
151117
|
+
return IsKindOf(value, "Array");
|
|
151118
|
+
}
|
|
151119
|
+
function IsAsyncIterator3(value) {
|
|
151120
|
+
return IsKindOf(value, "AsyncIterator");
|
|
151121
|
+
}
|
|
151122
|
+
function IsBigInt3(value) {
|
|
151123
|
+
return IsKindOf(value, "BigInt");
|
|
151124
|
+
}
|
|
151125
|
+
function IsBoolean3(value) {
|
|
151126
|
+
return IsKindOf(value, "Boolean");
|
|
151127
|
+
}
|
|
151128
|
+
function IsComputed(value) {
|
|
151129
|
+
return IsKindOf(value, "Computed");
|
|
151130
|
+
}
|
|
151131
|
+
function IsConstructor(value) {
|
|
151132
|
+
return IsKindOf(value, "Constructor");
|
|
151133
|
+
}
|
|
151134
|
+
function IsDate3(value) {
|
|
151135
|
+
return IsKindOf(value, "Date");
|
|
151136
|
+
}
|
|
151137
|
+
function IsFunction3(value) {
|
|
151138
|
+
return IsKindOf(value, "Function");
|
|
151139
|
+
}
|
|
151140
|
+
function IsInteger2(value) {
|
|
151141
|
+
return IsKindOf(value, "Integer");
|
|
151142
|
+
}
|
|
151143
|
+
function IsIntersect(value) {
|
|
151144
|
+
return IsKindOf(value, "Intersect");
|
|
151145
|
+
}
|
|
151146
|
+
function IsIterator3(value) {
|
|
151147
|
+
return IsKindOf(value, "Iterator");
|
|
151148
|
+
}
|
|
151149
|
+
function IsKindOf(value, kind) {
|
|
151150
|
+
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
151151
|
+
}
|
|
151152
|
+
function IsLiteralValue(value) {
|
|
151153
|
+
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
151154
|
+
}
|
|
151155
|
+
function IsLiteral(value) {
|
|
151156
|
+
return IsKindOf(value, "Literal");
|
|
151157
|
+
}
|
|
151158
|
+
function IsMappedKey(value) {
|
|
151159
|
+
return IsKindOf(value, "MappedKey");
|
|
151160
|
+
}
|
|
151161
|
+
function IsMappedResult(value) {
|
|
151162
|
+
return IsKindOf(value, "MappedResult");
|
|
151163
|
+
}
|
|
151164
|
+
function IsNever(value) {
|
|
151165
|
+
return IsKindOf(value, "Never");
|
|
151166
|
+
}
|
|
151167
|
+
function IsNot(value) {
|
|
151168
|
+
return IsKindOf(value, "Not");
|
|
151169
|
+
}
|
|
151170
|
+
function IsNull3(value) {
|
|
151171
|
+
return IsKindOf(value, "Null");
|
|
151172
|
+
}
|
|
151173
|
+
function IsNumber3(value) {
|
|
151174
|
+
return IsKindOf(value, "Number");
|
|
151175
|
+
}
|
|
151176
|
+
function IsObject3(value) {
|
|
151177
|
+
return IsKindOf(value, "Object");
|
|
151178
|
+
}
|
|
151179
|
+
function IsPromise2(value) {
|
|
151180
|
+
return IsKindOf(value, "Promise");
|
|
151181
|
+
}
|
|
151182
|
+
function IsRecord(value) {
|
|
151183
|
+
return IsKindOf(value, "Record");
|
|
151184
|
+
}
|
|
151185
|
+
function IsRef(value) {
|
|
151186
|
+
return IsKindOf(value, "Ref");
|
|
151187
|
+
}
|
|
151188
|
+
function IsRegExp2(value) {
|
|
151189
|
+
return IsKindOf(value, "RegExp");
|
|
151190
|
+
}
|
|
151191
|
+
function IsString3(value) {
|
|
151192
|
+
return IsKindOf(value, "String");
|
|
151193
|
+
}
|
|
151194
|
+
function IsSymbol3(value) {
|
|
151195
|
+
return IsKindOf(value, "Symbol");
|
|
151196
|
+
}
|
|
151197
|
+
function IsTemplateLiteral(value) {
|
|
151198
|
+
return IsKindOf(value, "TemplateLiteral");
|
|
151199
|
+
}
|
|
151200
|
+
function IsThis(value) {
|
|
151201
|
+
return IsKindOf(value, "This");
|
|
151202
|
+
}
|
|
151203
|
+
function IsTransform(value) {
|
|
151204
|
+
return IsObject(value) && TransformKind in value;
|
|
151205
|
+
}
|
|
151206
|
+
function IsTuple(value) {
|
|
151207
|
+
return IsKindOf(value, "Tuple");
|
|
151208
|
+
}
|
|
151209
|
+
function IsUndefined3(value) {
|
|
151210
|
+
return IsKindOf(value, "Undefined");
|
|
151211
|
+
}
|
|
151212
|
+
function IsUnion(value) {
|
|
151213
|
+
return IsKindOf(value, "Union");
|
|
151214
|
+
}
|
|
151215
|
+
function IsUint8Array3(value) {
|
|
151216
|
+
return IsKindOf(value, "Uint8Array");
|
|
151217
|
+
}
|
|
151218
|
+
function IsUnknown(value) {
|
|
151219
|
+
return IsKindOf(value, "Unknown");
|
|
151220
|
+
}
|
|
151221
|
+
function IsUnsafe(value) {
|
|
151222
|
+
return IsKindOf(value, "Unsafe");
|
|
151223
|
+
}
|
|
151224
|
+
function IsVoid(value) {
|
|
151225
|
+
return IsKindOf(value, "Void");
|
|
151226
|
+
}
|
|
151227
|
+
function IsKind(value) {
|
|
151228
|
+
return IsObject(value) && Kind in value && IsString(value[Kind]);
|
|
151229
|
+
}
|
|
151230
|
+
function IsSchema(value) {
|
|
151231
|
+
return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed(value) || IsConstructor(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect(value) || IsIterator3(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull3(value) || IsNumber3(value) || IsObject3(value) || IsPromise2(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array3(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
|
|
151232
|
+
}
|
|
151106
151233
|
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
|
|
151107
151234
|
var exports_type = {};
|
|
151108
151235
|
__export(exports_type, {
|
|
151109
151236
|
TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError,
|
|
151110
|
-
IsVoid: () =>
|
|
151111
|
-
IsUnsafe: () =>
|
|
151112
|
-
IsUnknown: () =>
|
|
151237
|
+
IsVoid: () => IsVoid2,
|
|
151238
|
+
IsUnsafe: () => IsUnsafe2,
|
|
151239
|
+
IsUnknown: () => IsUnknown2,
|
|
151113
151240
|
IsUnionLiteral: () => IsUnionLiteral,
|
|
151114
|
-
IsUnion: () =>
|
|
151115
|
-
IsUndefined: () =>
|
|
151116
|
-
IsUint8Array: () =>
|
|
151117
|
-
IsTuple: () =>
|
|
151118
|
-
IsTransform: () =>
|
|
151119
|
-
IsThis: () =>
|
|
151120
|
-
IsTemplateLiteral: () =>
|
|
151121
|
-
IsSymbol: () =>
|
|
151122
|
-
IsString: () =>
|
|
151123
|
-
IsSchema: () =>
|
|
151124
|
-
IsRegExp: () =>
|
|
151125
|
-
IsRef: () =>
|
|
151241
|
+
IsUnion: () => IsUnion2,
|
|
151242
|
+
IsUndefined: () => IsUndefined4,
|
|
151243
|
+
IsUint8Array: () => IsUint8Array4,
|
|
151244
|
+
IsTuple: () => IsTuple2,
|
|
151245
|
+
IsTransform: () => IsTransform2,
|
|
151246
|
+
IsThis: () => IsThis2,
|
|
151247
|
+
IsTemplateLiteral: () => IsTemplateLiteral2,
|
|
151248
|
+
IsSymbol: () => IsSymbol4,
|
|
151249
|
+
IsString: () => IsString4,
|
|
151250
|
+
IsSchema: () => IsSchema2,
|
|
151251
|
+
IsRegExp: () => IsRegExp3,
|
|
151252
|
+
IsRef: () => IsRef2,
|
|
151126
151253
|
IsRecursive: () => IsRecursive,
|
|
151127
|
-
IsRecord: () =>
|
|
151128
|
-
IsReadonly: () =>
|
|
151254
|
+
IsRecord: () => IsRecord2,
|
|
151255
|
+
IsReadonly: () => IsReadonly2,
|
|
151129
151256
|
IsProperties: () => IsProperties,
|
|
151130
|
-
IsPromise: () =>
|
|
151131
|
-
IsOptional: () =>
|
|
151132
|
-
IsObject: () =>
|
|
151133
|
-
IsNumber: () =>
|
|
151134
|
-
IsNull: () =>
|
|
151135
|
-
IsNot: () =>
|
|
151136
|
-
IsNever: () =>
|
|
151137
|
-
IsMappedResult: () =>
|
|
151138
|
-
IsMappedKey: () =>
|
|
151139
|
-
IsLiteralValue: () =>
|
|
151257
|
+
IsPromise: () => IsPromise3,
|
|
151258
|
+
IsOptional: () => IsOptional2,
|
|
151259
|
+
IsObject: () => IsObject4,
|
|
151260
|
+
IsNumber: () => IsNumber4,
|
|
151261
|
+
IsNull: () => IsNull4,
|
|
151262
|
+
IsNot: () => IsNot2,
|
|
151263
|
+
IsNever: () => IsNever2,
|
|
151264
|
+
IsMappedResult: () => IsMappedResult2,
|
|
151265
|
+
IsMappedKey: () => IsMappedKey2,
|
|
151266
|
+
IsLiteralValue: () => IsLiteralValue2,
|
|
151140
151267
|
IsLiteralString: () => IsLiteralString,
|
|
151141
151268
|
IsLiteralNumber: () => IsLiteralNumber,
|
|
151142
151269
|
IsLiteralBoolean: () => IsLiteralBoolean,
|
|
151143
|
-
IsLiteral: () =>
|
|
151144
|
-
IsKindOf: () =>
|
|
151145
|
-
IsKind: () =>
|
|
151146
|
-
IsIterator: () =>
|
|
151147
|
-
IsIntersect: () =>
|
|
151148
|
-
IsInteger: () =>
|
|
151270
|
+
IsLiteral: () => IsLiteral2,
|
|
151271
|
+
IsKindOf: () => IsKindOf2,
|
|
151272
|
+
IsKind: () => IsKind2,
|
|
151273
|
+
IsIterator: () => IsIterator4,
|
|
151274
|
+
IsIntersect: () => IsIntersect2,
|
|
151275
|
+
IsInteger: () => IsInteger3,
|
|
151149
151276
|
IsImport: () => IsImport,
|
|
151150
|
-
IsFunction: () =>
|
|
151151
|
-
IsDate: () =>
|
|
151152
|
-
IsConstructor: () =>
|
|
151153
|
-
IsComputed: () =>
|
|
151154
|
-
IsBoolean: () =>
|
|
151155
|
-
IsBigInt: () =>
|
|
151156
|
-
IsAsyncIterator: () =>
|
|
151157
|
-
IsArray: () =>
|
|
151158
|
-
IsArgument: () =>
|
|
151159
|
-
IsAny: () =>
|
|
151277
|
+
IsFunction: () => IsFunction4,
|
|
151278
|
+
IsDate: () => IsDate4,
|
|
151279
|
+
IsConstructor: () => IsConstructor2,
|
|
151280
|
+
IsComputed: () => IsComputed2,
|
|
151281
|
+
IsBoolean: () => IsBoolean4,
|
|
151282
|
+
IsBigInt: () => IsBigInt4,
|
|
151283
|
+
IsAsyncIterator: () => IsAsyncIterator4,
|
|
151284
|
+
IsArray: () => IsArray4,
|
|
151285
|
+
IsArgument: () => IsArgument2,
|
|
151286
|
+
IsAny: () => IsAny2
|
|
151160
151287
|
});
|
|
151161
|
-
|
|
151162
|
-
// ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
151163
|
-
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
151164
|
-
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
151165
|
-
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
151166
|
-
var Hint = Symbol.for("TypeBox.Hint");
|
|
151167
|
-
var Kind = Symbol.for("TypeBox.Kind");
|
|
151168
|
-
|
|
151169
|
-
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
|
|
151170
151288
|
class TypeGuardUnknownTypeError extends TypeBoxError {
|
|
151171
151289
|
}
|
|
151172
151290
|
var KnownTypes = [
|
|
@@ -151226,7 +151344,7 @@ function IsControlCharacterFree(value) {
|
|
|
151226
151344
|
return true;
|
|
151227
151345
|
}
|
|
151228
151346
|
function IsAdditionalProperties(value) {
|
|
151229
|
-
return IsOptionalBoolean(value) ||
|
|
151347
|
+
return IsOptionalBoolean(value) || IsSchema2(value);
|
|
151230
151348
|
}
|
|
151231
151349
|
function IsOptionalBigInt(value) {
|
|
151232
151350
|
return IsUndefined(value) || IsBigInt(value);
|
|
@@ -151247,160 +151365,160 @@ function IsOptionalFormat(value) {
|
|
|
151247
151365
|
return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
|
|
151248
151366
|
}
|
|
151249
151367
|
function IsOptionalSchema(value) {
|
|
151250
|
-
return IsUndefined(value) ||
|
|
151368
|
+
return IsUndefined(value) || IsSchema2(value);
|
|
151251
151369
|
}
|
|
151252
|
-
function
|
|
151370
|
+
function IsReadonly2(value) {
|
|
151253
151371
|
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
151254
151372
|
}
|
|
151255
|
-
function
|
|
151373
|
+
function IsOptional2(value) {
|
|
151256
151374
|
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
151257
151375
|
}
|
|
151258
|
-
function
|
|
151259
|
-
return
|
|
151376
|
+
function IsAny2(value) {
|
|
151377
|
+
return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
|
|
151260
151378
|
}
|
|
151261
|
-
function
|
|
151262
|
-
return
|
|
151379
|
+
function IsArgument2(value) {
|
|
151380
|
+
return IsKindOf2(value, "Argument") && IsNumber(value.index);
|
|
151263
151381
|
}
|
|
151264
|
-
function
|
|
151265
|
-
return
|
|
151382
|
+
function IsArray4(value) {
|
|
151383
|
+
return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
|
|
151266
151384
|
}
|
|
151267
|
-
function
|
|
151268
|
-
return
|
|
151385
|
+
function IsAsyncIterator4(value) {
|
|
151386
|
+
return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
|
|
151269
151387
|
}
|
|
151270
|
-
function
|
|
151271
|
-
return
|
|
151388
|
+
function IsBigInt4(value) {
|
|
151389
|
+
return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
|
|
151272
151390
|
}
|
|
151273
|
-
function
|
|
151274
|
-
return
|
|
151391
|
+
function IsBoolean4(value) {
|
|
151392
|
+
return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
|
|
151275
151393
|
}
|
|
151276
|
-
function
|
|
151277
|
-
return
|
|
151394
|
+
function IsComputed2(value) {
|
|
151395
|
+
return IsKindOf2(value, "Computed") && IsString(value.target) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema));
|
|
151278
151396
|
}
|
|
151279
|
-
function
|
|
151280
|
-
return
|
|
151397
|
+
function IsConstructor2(value) {
|
|
151398
|
+
return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
151281
151399
|
}
|
|
151282
|
-
function
|
|
151283
|
-
return
|
|
151400
|
+
function IsDate4(value) {
|
|
151401
|
+
return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
|
|
151284
151402
|
}
|
|
151285
|
-
function
|
|
151286
|
-
return
|
|
151403
|
+
function IsFunction4(value) {
|
|
151404
|
+
return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
151287
151405
|
}
|
|
151288
151406
|
function IsImport(value) {
|
|
151289
|
-
return
|
|
151407
|
+
return IsKindOf2(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
|
|
151290
151408
|
}
|
|
151291
|
-
function
|
|
151292
|
-
return
|
|
151409
|
+
function IsInteger3(value) {
|
|
151410
|
+
return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
151293
151411
|
}
|
|
151294
151412
|
function IsProperties(value) {
|
|
151295
|
-
return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) &&
|
|
151413
|
+
return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
|
|
151296
151414
|
}
|
|
151297
|
-
function
|
|
151298
|
-
return
|
|
151415
|
+
function IsIntersect2(value) {
|
|
151416
|
+
return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
|
|
151299
151417
|
}
|
|
151300
|
-
function
|
|
151301
|
-
return
|
|
151418
|
+
function IsIterator4(value) {
|
|
151419
|
+
return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
|
|
151302
151420
|
}
|
|
151303
|
-
function
|
|
151421
|
+
function IsKindOf2(value, kind) {
|
|
151304
151422
|
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
151305
151423
|
}
|
|
151306
151424
|
function IsLiteralString(value) {
|
|
151307
|
-
return
|
|
151425
|
+
return IsLiteral2(value) && IsString(value.const);
|
|
151308
151426
|
}
|
|
151309
151427
|
function IsLiteralNumber(value) {
|
|
151310
|
-
return
|
|
151428
|
+
return IsLiteral2(value) && IsNumber(value.const);
|
|
151311
151429
|
}
|
|
151312
151430
|
function IsLiteralBoolean(value) {
|
|
151313
|
-
return
|
|
151431
|
+
return IsLiteral2(value) && IsBoolean(value.const);
|
|
151314
151432
|
}
|
|
151315
|
-
function
|
|
151316
|
-
return
|
|
151433
|
+
function IsLiteral2(value) {
|
|
151434
|
+
return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue2(value.const);
|
|
151317
151435
|
}
|
|
151318
|
-
function
|
|
151436
|
+
function IsLiteralValue2(value) {
|
|
151319
151437
|
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
151320
151438
|
}
|
|
151321
|
-
function
|
|
151322
|
-
return
|
|
151439
|
+
function IsMappedKey2(value) {
|
|
151440
|
+
return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
|
|
151323
151441
|
}
|
|
151324
|
-
function
|
|
151325
|
-
return
|
|
151442
|
+
function IsMappedResult2(value) {
|
|
151443
|
+
return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
|
|
151326
151444
|
}
|
|
151327
|
-
function
|
|
151328
|
-
return
|
|
151445
|
+
function IsNever2(value) {
|
|
151446
|
+
return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
|
|
151329
151447
|
}
|
|
151330
|
-
function
|
|
151331
|
-
return
|
|
151448
|
+
function IsNot2(value) {
|
|
151449
|
+
return IsKindOf2(value, "Not") && IsSchema2(value.not);
|
|
151332
151450
|
}
|
|
151333
|
-
function
|
|
151334
|
-
return
|
|
151451
|
+
function IsNull4(value) {
|
|
151452
|
+
return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
|
|
151335
151453
|
}
|
|
151336
|
-
function
|
|
151337
|
-
return
|
|
151454
|
+
function IsNumber4(value) {
|
|
151455
|
+
return IsKindOf2(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
151338
151456
|
}
|
|
151339
|
-
function
|
|
151340
|
-
return
|
|
151457
|
+
function IsObject4(value) {
|
|
151458
|
+
return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
|
|
151341
151459
|
}
|
|
151342
|
-
function
|
|
151343
|
-
return
|
|
151460
|
+
function IsPromise3(value) {
|
|
151461
|
+
return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
|
|
151344
151462
|
}
|
|
151345
|
-
function
|
|
151346
|
-
return
|
|
151463
|
+
function IsRecord2(value) {
|
|
151464
|
+
return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
|
|
151347
151465
|
const keys = Object.getOwnPropertyNames(schema.patternProperties);
|
|
151348
|
-
return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) &&
|
|
151466
|
+
return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
|
|
151349
151467
|
})(value);
|
|
151350
151468
|
}
|
|
151351
151469
|
function IsRecursive(value) {
|
|
151352
151470
|
return IsObject(value) && Hint in value && value[Hint] === "Recursive";
|
|
151353
151471
|
}
|
|
151354
|
-
function
|
|
151355
|
-
return
|
|
151472
|
+
function IsRef2(value) {
|
|
151473
|
+
return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
151356
151474
|
}
|
|
151357
|
-
function
|
|
151358
|
-
return
|
|
151475
|
+
function IsRegExp3(value) {
|
|
151476
|
+
return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
|
|
151359
151477
|
}
|
|
151360
|
-
function
|
|
151361
|
-
return
|
|
151478
|
+
function IsString4(value) {
|
|
151479
|
+
return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
|
|
151362
151480
|
}
|
|
151363
|
-
function
|
|
151364
|
-
return
|
|
151481
|
+
function IsSymbol4(value) {
|
|
151482
|
+
return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
|
|
151365
151483
|
}
|
|
151366
|
-
function
|
|
151367
|
-
return
|
|
151484
|
+
function IsTemplateLiteral2(value) {
|
|
151485
|
+
return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
|
|
151368
151486
|
}
|
|
151369
|
-
function
|
|
151370
|
-
return
|
|
151487
|
+
function IsThis2(value) {
|
|
151488
|
+
return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
151371
151489
|
}
|
|
151372
|
-
function
|
|
151490
|
+
function IsTransform2(value) {
|
|
151373
151491
|
return IsObject(value) && TransformKind in value;
|
|
151374
151492
|
}
|
|
151375
|
-
function
|
|
151376
|
-
return
|
|
151493
|
+
function IsTuple2(value) {
|
|
151494
|
+
return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && (IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
|
|
151377
151495
|
}
|
|
151378
|
-
function
|
|
151379
|
-
return
|
|
151496
|
+
function IsUndefined4(value) {
|
|
151497
|
+
return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
|
|
151380
151498
|
}
|
|
151381
151499
|
function IsUnionLiteral(value) {
|
|
151382
|
-
return
|
|
151500
|
+
return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
|
|
151383
151501
|
}
|
|
151384
|
-
function
|
|
151385
|
-
return
|
|
151502
|
+
function IsUnion2(value) {
|
|
151503
|
+
return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
|
|
151386
151504
|
}
|
|
151387
|
-
function
|
|
151388
|
-
return
|
|
151505
|
+
function IsUint8Array4(value) {
|
|
151506
|
+
return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
|
|
151389
151507
|
}
|
|
151390
|
-
function
|
|
151391
|
-
return
|
|
151508
|
+
function IsUnknown2(value) {
|
|
151509
|
+
return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
|
|
151392
151510
|
}
|
|
151393
|
-
function
|
|
151394
|
-
return
|
|
151511
|
+
function IsUnsafe2(value) {
|
|
151512
|
+
return IsKindOf2(value, "Unsafe");
|
|
151395
151513
|
}
|
|
151396
|
-
function
|
|
151397
|
-
return
|
|
151514
|
+
function IsVoid2(value) {
|
|
151515
|
+
return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
|
|
151398
151516
|
}
|
|
151399
|
-
function
|
|
151517
|
+
function IsKind2(value) {
|
|
151400
151518
|
return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
|
|
151401
151519
|
}
|
|
151402
|
-
function
|
|
151403
|
-
return IsObject(value) && (
|
|
151520
|
+
function IsSchema2(value) {
|
|
151521
|
+
return IsObject(value) && (IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean4(value) || IsBigInt4(value) || IsAsyncIterator4(value) || IsComputed2(value) || IsConstructor2(value) || IsDate4(value) || IsFunction4(value) || IsInteger3(value) || IsIntersect2(value) || IsIterator4(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull4(value) || IsNumber4(value) || IsObject4(value) || IsPromise3(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString4(value) || IsSymbol4(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array4(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
|
|
151404
151522
|
}
|
|
151405
151523
|
// ../../node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
|
|
151406
151524
|
var PatternBoolean = "(true|false)";
|
|
@@ -151557,143 +151675,12 @@ function UnionCreate(T2, options) {
|
|
|
151557
151675
|
return CreateType({ [Kind]: "Union", anyOf: T2 }, options);
|
|
151558
151676
|
}
|
|
151559
151677
|
|
|
151560
|
-
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
151561
|
-
function IsReadonly2(value) {
|
|
151562
|
-
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
151563
|
-
}
|
|
151564
|
-
function IsOptional2(value) {
|
|
151565
|
-
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
151566
|
-
}
|
|
151567
|
-
function IsAny2(value) {
|
|
151568
|
-
return IsKindOf2(value, "Any");
|
|
151569
|
-
}
|
|
151570
|
-
function IsArgument2(value) {
|
|
151571
|
-
return IsKindOf2(value, "Argument");
|
|
151572
|
-
}
|
|
151573
|
-
function IsArray4(value) {
|
|
151574
|
-
return IsKindOf2(value, "Array");
|
|
151575
|
-
}
|
|
151576
|
-
function IsAsyncIterator4(value) {
|
|
151577
|
-
return IsKindOf2(value, "AsyncIterator");
|
|
151578
|
-
}
|
|
151579
|
-
function IsBigInt4(value) {
|
|
151580
|
-
return IsKindOf2(value, "BigInt");
|
|
151581
|
-
}
|
|
151582
|
-
function IsBoolean4(value) {
|
|
151583
|
-
return IsKindOf2(value, "Boolean");
|
|
151584
|
-
}
|
|
151585
|
-
function IsComputed2(value) {
|
|
151586
|
-
return IsKindOf2(value, "Computed");
|
|
151587
|
-
}
|
|
151588
|
-
function IsConstructor2(value) {
|
|
151589
|
-
return IsKindOf2(value, "Constructor");
|
|
151590
|
-
}
|
|
151591
|
-
function IsDate4(value) {
|
|
151592
|
-
return IsKindOf2(value, "Date");
|
|
151593
|
-
}
|
|
151594
|
-
function IsFunction4(value) {
|
|
151595
|
-
return IsKindOf2(value, "Function");
|
|
151596
|
-
}
|
|
151597
|
-
function IsInteger3(value) {
|
|
151598
|
-
return IsKindOf2(value, "Integer");
|
|
151599
|
-
}
|
|
151600
|
-
function IsIntersect2(value) {
|
|
151601
|
-
return IsKindOf2(value, "Intersect");
|
|
151602
|
-
}
|
|
151603
|
-
function IsIterator4(value) {
|
|
151604
|
-
return IsKindOf2(value, "Iterator");
|
|
151605
|
-
}
|
|
151606
|
-
function IsKindOf2(value, kind) {
|
|
151607
|
-
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
151608
|
-
}
|
|
151609
|
-
function IsLiteralValue2(value) {
|
|
151610
|
-
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
151611
|
-
}
|
|
151612
|
-
function IsLiteral2(value) {
|
|
151613
|
-
return IsKindOf2(value, "Literal");
|
|
151614
|
-
}
|
|
151615
|
-
function IsMappedKey2(value) {
|
|
151616
|
-
return IsKindOf2(value, "MappedKey");
|
|
151617
|
-
}
|
|
151618
|
-
function IsMappedResult2(value) {
|
|
151619
|
-
return IsKindOf2(value, "MappedResult");
|
|
151620
|
-
}
|
|
151621
|
-
function IsNever2(value) {
|
|
151622
|
-
return IsKindOf2(value, "Never");
|
|
151623
|
-
}
|
|
151624
|
-
function IsNot2(value) {
|
|
151625
|
-
return IsKindOf2(value, "Not");
|
|
151626
|
-
}
|
|
151627
|
-
function IsNull4(value) {
|
|
151628
|
-
return IsKindOf2(value, "Null");
|
|
151629
|
-
}
|
|
151630
|
-
function IsNumber4(value) {
|
|
151631
|
-
return IsKindOf2(value, "Number");
|
|
151632
|
-
}
|
|
151633
|
-
function IsObject4(value) {
|
|
151634
|
-
return IsKindOf2(value, "Object");
|
|
151635
|
-
}
|
|
151636
|
-
function IsPromise3(value) {
|
|
151637
|
-
return IsKindOf2(value, "Promise");
|
|
151638
|
-
}
|
|
151639
|
-
function IsRecord2(value) {
|
|
151640
|
-
return IsKindOf2(value, "Record");
|
|
151641
|
-
}
|
|
151642
|
-
function IsRef2(value) {
|
|
151643
|
-
return IsKindOf2(value, "Ref");
|
|
151644
|
-
}
|
|
151645
|
-
function IsRegExp3(value) {
|
|
151646
|
-
return IsKindOf2(value, "RegExp");
|
|
151647
|
-
}
|
|
151648
|
-
function IsString4(value) {
|
|
151649
|
-
return IsKindOf2(value, "String");
|
|
151650
|
-
}
|
|
151651
|
-
function IsSymbol4(value) {
|
|
151652
|
-
return IsKindOf2(value, "Symbol");
|
|
151653
|
-
}
|
|
151654
|
-
function IsTemplateLiteral2(value) {
|
|
151655
|
-
return IsKindOf2(value, "TemplateLiteral");
|
|
151656
|
-
}
|
|
151657
|
-
function IsThis2(value) {
|
|
151658
|
-
return IsKindOf2(value, "This");
|
|
151659
|
-
}
|
|
151660
|
-
function IsTransform2(value) {
|
|
151661
|
-
return IsObject(value) && TransformKind in value;
|
|
151662
|
-
}
|
|
151663
|
-
function IsTuple2(value) {
|
|
151664
|
-
return IsKindOf2(value, "Tuple");
|
|
151665
|
-
}
|
|
151666
|
-
function IsUndefined4(value) {
|
|
151667
|
-
return IsKindOf2(value, "Undefined");
|
|
151668
|
-
}
|
|
151669
|
-
function IsUnion2(value) {
|
|
151670
|
-
return IsKindOf2(value, "Union");
|
|
151671
|
-
}
|
|
151672
|
-
function IsUint8Array4(value) {
|
|
151673
|
-
return IsKindOf2(value, "Uint8Array");
|
|
151674
|
-
}
|
|
151675
|
-
function IsUnknown2(value) {
|
|
151676
|
-
return IsKindOf2(value, "Unknown");
|
|
151677
|
-
}
|
|
151678
|
-
function IsUnsafe2(value) {
|
|
151679
|
-
return IsKindOf2(value, "Unsafe");
|
|
151680
|
-
}
|
|
151681
|
-
function IsVoid2(value) {
|
|
151682
|
-
return IsKindOf2(value, "Void");
|
|
151683
|
-
}
|
|
151684
|
-
function IsKind2(value) {
|
|
151685
|
-
return IsObject(value) && Kind in value && IsString(value[Kind]);
|
|
151686
|
-
}
|
|
151687
|
-
function IsSchema2(value) {
|
|
151688
|
-
return IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean4(value) || IsBigInt4(value) || IsAsyncIterator4(value) || IsComputed2(value) || IsConstructor2(value) || IsDate4(value) || IsFunction4(value) || IsInteger3(value) || IsIntersect2(value) || IsIterator4(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull4(value) || IsNumber4(value) || IsObject4(value) || IsPromise3(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString4(value) || IsSymbol4(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array4(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value);
|
|
151689
|
-
}
|
|
151690
|
-
|
|
151691
151678
|
// ../../node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
|
|
151692
151679
|
function IsUnionOptional(types) {
|
|
151693
|
-
return types.some((type) =>
|
|
151680
|
+
return types.some((type) => IsOptional(type));
|
|
151694
151681
|
}
|
|
151695
151682
|
function RemoveOptionalFromRest(types) {
|
|
151696
|
-
return types.map((left) =>
|
|
151683
|
+
return types.map((left) => IsOptional(left) ? RemoveOptionalFromType(left) : left);
|
|
151697
151684
|
}
|
|
151698
151685
|
function RemoveOptionalFromType(T2) {
|
|
151699
151686
|
return Discard(T2, [OptionalKind]);
|
|
@@ -151962,7 +151949,7 @@ function Escape(value) {
|
|
|
151962
151949
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
151963
151950
|
}
|
|
151964
151951
|
function Visit2(schema, acc) {
|
|
151965
|
-
return
|
|
151952
|
+
return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber3(schema) ? `${acc}${PatternNumber}` : IsInteger2(schema) ? `${acc}${PatternNumber}` : IsBigInt3(schema) ? `${acc}${PatternNumber}` : IsString3(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean3(schema) ? `${acc}${PatternBoolean}` : (() => {
|
|
151966
151953
|
throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
|
|
151967
151954
|
})();
|
|
151968
151955
|
}
|
|
@@ -151998,7 +151985,7 @@ function FromLiteral(literalValue) {
|
|
|
151998
151985
|
return [literalValue.toString()];
|
|
151999
151986
|
}
|
|
152000
151987
|
function IndexPropertyKeys(type) {
|
|
152001
|
-
return [...new Set(
|
|
151988
|
+
return [...new Set(IsTemplateLiteral(type) ? FromTemplateLiteral(type) : IsUnion(type) ? FromUnion2(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : IsNumber3(type) ? ["[number]"] : IsInteger2(type) ? ["[number]"] : [])];
|
|
152002
151989
|
}
|
|
152003
151990
|
|
|
152004
151991
|
// ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
|
|
@@ -152022,13 +152009,13 @@ function FromRest(types, key) {
|
|
|
152022
152009
|
return types.map((type) => IndexFromPropertyKey(type, key));
|
|
152023
152010
|
}
|
|
152024
152011
|
function FromIntersectRest(types) {
|
|
152025
|
-
return types.filter((type) => !
|
|
152012
|
+
return types.filter((type) => !IsNever(type));
|
|
152026
152013
|
}
|
|
152027
152014
|
function FromIntersect(types, key) {
|
|
152028
152015
|
return IntersectEvaluated(FromIntersectRest(FromRest(types, key)));
|
|
152029
152016
|
}
|
|
152030
152017
|
function FromUnionRest(types) {
|
|
152031
|
-
return types.some((L) =>
|
|
152018
|
+
return types.some((L) => IsNever(L)) ? [] : types;
|
|
152032
152019
|
}
|
|
152033
152020
|
function FromUnion3(types, key) {
|
|
152034
152021
|
return UnionEvaluated(FromUnionRest(FromRest(types, key)));
|
|
@@ -152043,7 +152030,7 @@ function FromProperty(properties, propertyKey) {
|
|
|
152043
152030
|
return propertyKey in properties ? properties[propertyKey] : Never();
|
|
152044
152031
|
}
|
|
152045
152032
|
function IndexFromPropertyKey(type, propertyKey) {
|
|
152046
|
-
return
|
|
152033
|
+
return IsIntersect(type) ? FromIntersect(type.allOf, propertyKey) : IsUnion(type) ? FromUnion3(type.anyOf, propertyKey) : IsTuple(type) ? FromTuple(type.items ?? [], propertyKey) : IsArray3(type) ? FromArray(type.items, propertyKey) : IsObject3(type) ? FromProperty(type.properties, propertyKey) : Never();
|
|
152047
152034
|
}
|
|
152048
152035
|
function IndexFromPropertyKeys(type, propertyKeys) {
|
|
152049
152036
|
return propertyKeys.map((propertyKey) => IndexFromPropertyKey(type, propertyKey));
|
|
@@ -152052,17 +152039,17 @@ function FromSchema(type, propertyKeys) {
|
|
|
152052
152039
|
return UnionEvaluated(IndexFromPropertyKeys(type, propertyKeys));
|
|
152053
152040
|
}
|
|
152054
152041
|
function Index(type, key, options) {
|
|
152055
|
-
if (
|
|
152042
|
+
if (IsRef(type) || IsRef(key)) {
|
|
152056
152043
|
const error = `Index types using Ref parameters require both Type and Key to be of TSchema`;
|
|
152057
|
-
if (!
|
|
152044
|
+
if (!IsSchema(type) || !IsSchema(key))
|
|
152058
152045
|
throw new TypeBoxError(error);
|
|
152059
152046
|
return Computed("Index", [type, key]);
|
|
152060
152047
|
}
|
|
152061
|
-
if (
|
|
152048
|
+
if (IsMappedResult(key))
|
|
152062
152049
|
return IndexFromMappedResult(type, key, options);
|
|
152063
|
-
if (
|
|
152050
|
+
if (IsMappedKey(key))
|
|
152064
152051
|
return IndexFromMappedKey(type, key, options);
|
|
152065
|
-
return CreateType(
|
|
152052
|
+
return CreateType(IsSchema(key) ? FromSchema(type, IndexPropertyKeys(key)) : FromSchema(type, key), options);
|
|
152066
152053
|
}
|
|
152067
152054
|
|
|
152068
152055
|
// ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
|
|
@@ -152089,7 +152076,7 @@ function Iterator(items, options) {
|
|
|
152089
152076
|
|
|
152090
152077
|
// ../../node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
|
|
152091
152078
|
function RequiredArray(properties) {
|
|
152092
|
-
return globalThis.Object.keys(properties).filter((key) => !
|
|
152079
|
+
return globalThis.Object.keys(properties).filter((key) => !IsOptional(properties[key]));
|
|
152093
152080
|
}
|
|
152094
152081
|
function _Object(properties, options) {
|
|
152095
152082
|
const required = RequiredArray(properties);
|
|
@@ -152115,7 +152102,7 @@ function ReadonlyWithFlag(schema, F) {
|
|
|
152115
152102
|
}
|
|
152116
152103
|
function Readonly(schema, enable) {
|
|
152117
152104
|
const F = enable ?? true;
|
|
152118
|
-
return
|
|
152105
|
+
return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
|
|
152119
152106
|
}
|
|
152120
152107
|
|
|
152121
152108
|
// ../../node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
|
|
@@ -152169,7 +152156,7 @@ function FromProperties3(K, T2) {
|
|
|
152169
152156
|
}
|
|
152170
152157
|
function FromSchemaType(K, T2) {
|
|
152171
152158
|
const options = { ...T2 };
|
|
152172
|
-
return
|
|
152159
|
+
return IsOptional(T2) ? Optional(FromSchemaType(K, Discard(T2, [OptionalKind]))) : IsReadonly(T2) ? Readonly(FromSchemaType(K, Discard(T2, [ReadonlyKind]))) : IsMappedResult(T2) ? FromMappedResult3(K, T2.properties) : IsMappedKey(T2) ? FromMappedKey(K, T2.keys) : IsConstructor(T2) ? Constructor(FromRest2(K, T2.parameters), FromSchemaType(K, T2.returns), options) : IsFunction3(T2) ? Function2(FromRest2(K, T2.parameters), FromSchemaType(K, T2.returns), options) : IsAsyncIterator3(T2) ? AsyncIterator(FromSchemaType(K, T2.items), options) : IsIterator3(T2) ? Iterator(FromSchemaType(K, T2.items), options) : IsIntersect(T2) ? Intersect(FromRest2(K, T2.allOf), options) : IsUnion(T2) ? Union(FromRest2(K, T2.anyOf), options) : IsTuple(T2) ? Tuple(FromRest2(K, T2.items ?? []), options) : IsObject3(T2) ? Object2(FromProperties3(K, T2.properties), options) : IsArray3(T2) ? Array2(FromSchemaType(K, T2.items), options) : IsPromise2(T2) ? Promise2(FromSchemaType(K, T2.item), options) : T2;
|
|
152173
152160
|
}
|
|
152174
152161
|
function MappedFunctionReturnType(K, T2) {
|
|
152175
152162
|
const Acc = {};
|
|
@@ -152178,7 +152165,7 @@ function MappedFunctionReturnType(K, T2) {
|
|
|
152178
152165
|
return Acc;
|
|
152179
152166
|
}
|
|
152180
152167
|
function Mapped(key, map3, options) {
|
|
152181
|
-
const K =
|
|
152168
|
+
const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
152182
152169
|
const RT = map3({ [Kind]: "MappedKey", keys: K });
|
|
152183
152170
|
const R = MappedFunctionReturnType(K, RT);
|
|
152184
152171
|
return Object2(R, options);
|
|
@@ -152196,7 +152183,7 @@ function OptionalWithFlag(schema, F) {
|
|
|
152196
152183
|
}
|
|
152197
152184
|
function Optional(schema, enable) {
|
|
152198
152185
|
const F = enable ?? true;
|
|
152199
|
-
return
|
|
152186
|
+
return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
|
|
152200
152187
|
}
|
|
152201
152188
|
|
|
152202
152189
|
// ../../node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
|
|
@@ -152216,20 +152203,20 @@ function OptionalFromMappedResult(R, F) {
|
|
|
152216
152203
|
|
|
152217
152204
|
// ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
|
|
152218
152205
|
function IntersectCreate(T2, options = {}) {
|
|
152219
|
-
const allObjects = T2.every((schema) =>
|
|
152220
|
-
const clonedUnevaluatedProperties =
|
|
152221
|
-
return CreateType(options.unevaluatedProperties === false ||
|
|
152206
|
+
const allObjects = T2.every((schema) => IsObject3(schema));
|
|
152207
|
+
const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: options.unevaluatedProperties } : {};
|
|
152208
|
+
return CreateType(options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: T2 } : { ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: T2 }, options);
|
|
152222
152209
|
}
|
|
152223
152210
|
|
|
152224
152211
|
// ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
|
|
152225
152212
|
function IsIntersectOptional(types) {
|
|
152226
|
-
return types.every((left) =>
|
|
152213
|
+
return types.every((left) => IsOptional(left));
|
|
152227
152214
|
}
|
|
152228
152215
|
function RemoveOptionalFromType2(type) {
|
|
152229
152216
|
return Discard(type, [OptionalKind]);
|
|
152230
152217
|
}
|
|
152231
152218
|
function RemoveOptionalFromRest2(types) {
|
|
152232
|
-
return types.map((left) =>
|
|
152219
|
+
return types.map((left) => IsOptional(left) ? RemoveOptionalFromType2(left) : left);
|
|
152233
152220
|
}
|
|
152234
152221
|
function ResolveIntersect(types, options) {
|
|
152235
152222
|
return IsIntersectOptional(types) ? Optional(IntersectCreate(RemoveOptionalFromRest2(types), options)) : IntersectCreate(RemoveOptionalFromRest2(types), options);
|
|
@@ -152239,7 +152226,7 @@ function IntersectEvaluated(types, options = {}) {
|
|
|
152239
152226
|
return CreateType(types[0], options);
|
|
152240
152227
|
if (types.length === 0)
|
|
152241
152228
|
return Never(options);
|
|
152242
|
-
if (types.some((schema) =>
|
|
152229
|
+
if (types.some((schema) => IsTransform(schema)))
|
|
152243
152230
|
throw new Error("Cannot intersect transform types");
|
|
152244
152231
|
return ResolveIntersect(types, options);
|
|
152245
152232
|
}
|
|
@@ -152250,7 +152237,7 @@ function Intersect(types, options) {
|
|
|
152250
152237
|
return CreateType(types[0], options);
|
|
152251
152238
|
if (types.length === 0)
|
|
152252
152239
|
return Never(options);
|
|
152253
|
-
if (types.some((schema) =>
|
|
152240
|
+
if (types.some((schema) => IsTransform(schema)))
|
|
152254
152241
|
throw new Error("Cannot intersect transform types");
|
|
152255
152242
|
return IntersectCreate(types, options);
|
|
152256
152243
|
}
|
|
@@ -152283,7 +152270,7 @@ function FromRest3(types) {
|
|
|
152283
152270
|
return types.map((type) => Awaited(type));
|
|
152284
152271
|
}
|
|
152285
152272
|
function Awaited(type, options) {
|
|
152286
|
-
return CreateType(
|
|
152273
|
+
return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsUnion(type) ? FromUnion4(type.anyOf) : IsPromise2(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options);
|
|
152287
152274
|
}
|
|
152288
152275
|
|
|
152289
152276
|
// ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
|
|
@@ -152321,7 +152308,7 @@ function FromPatternProperties(patternProperties) {
|
|
|
152321
152308
|
});
|
|
152322
152309
|
}
|
|
152323
152310
|
function KeyOfPropertyKeys(type) {
|
|
152324
|
-
return
|
|
152311
|
+
return IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion5(type.anyOf) : IsTuple(type) ? FromTuple2(type.items ?? []) : IsArray3(type) ? FromArray2(type.items) : IsObject3(type) ? FromProperties5(type.properties) : IsRecord(type) ? FromPatternProperties(type.patternProperties) : [];
|
|
152325
152312
|
}
|
|
152326
152313
|
var includePatternProperties = false;
|
|
152327
152314
|
function KeyOfPattern(schema) {
|
|
@@ -152349,7 +152336,7 @@ function KeyOfPropertyKeysToRest(propertyKeys) {
|
|
|
152349
152336
|
return propertyKeys.map((L) => L === "[number]" ? Number2() : Literal(L));
|
|
152350
152337
|
}
|
|
152351
152338
|
function KeyOf(type, options) {
|
|
152352
|
-
return
|
|
152339
|
+
return IsComputed(type) ? FromComputed2(type.target, type.parameters) : IsRef(type) ? FromRef2(type.$ref) : IsMappedResult(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options);
|
|
152353
152340
|
}
|
|
152354
152341
|
|
|
152355
152342
|
// ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
|
|
@@ -152382,7 +152369,7 @@ function CompositeKeys(T2) {
|
|
|
152382
152369
|
return SetDistinct(Acc);
|
|
152383
152370
|
}
|
|
152384
152371
|
function FilterNever(T2) {
|
|
152385
|
-
return T2.filter((L) => !
|
|
152372
|
+
return T2.filter((L) => !IsNever(L));
|
|
152386
152373
|
}
|
|
152387
152374
|
function CompositeProperty(T2, K) {
|
|
152388
152375
|
const Acc = [];
|
|
@@ -152456,7 +152443,7 @@ function Const(T2, options) {
|
|
|
152456
152443
|
|
|
152457
152444
|
// ../../node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
|
|
152458
152445
|
function ConstructorParameters(schema, options) {
|
|
152459
|
-
return
|
|
152446
|
+
return IsConstructor(schema) ? Tuple(schema.parameters, options) : Never(options);
|
|
152460
152447
|
}
|
|
152461
152448
|
|
|
152462
152449
|
// ../../node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
|
|
@@ -152735,7 +152722,7 @@ function ExtendsResolve(left, right, trueType, falseType) {
|
|
|
152735
152722
|
return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
|
|
152736
152723
|
}
|
|
152737
152724
|
function Extends(L, R, T2, F, options) {
|
|
152738
|
-
return
|
|
152725
|
+
return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T2, F, options) : IsMappedKey(L) ? CreateType(ExtendsFromMappedKey(L, R, T2, F, options)) : CreateType(ExtendsResolve(L, R, T2, F), options);
|
|
152739
152726
|
}
|
|
152740
152727
|
|
|
152741
152728
|
// ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
|
|
@@ -152782,11 +152769,11 @@ function ExcludeRest(L, R) {
|
|
|
152782
152769
|
return excluded.length === 1 ? excluded[0] : Union(excluded);
|
|
152783
152770
|
}
|
|
152784
152771
|
function Exclude(L, R, options = {}) {
|
|
152785
|
-
if (
|
|
152772
|
+
if (IsTemplateLiteral(L))
|
|
152786
152773
|
return CreateType(ExcludeFromTemplateLiteral(L, R), options);
|
|
152787
|
-
if (
|
|
152774
|
+
if (IsMappedResult(L))
|
|
152788
152775
|
return CreateType(ExcludeFromMappedResult(L, R), options);
|
|
152789
|
-
return CreateType(
|
|
152776
|
+
return CreateType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
|
|
152790
152777
|
}
|
|
152791
152778
|
|
|
152792
152779
|
// ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
|
|
@@ -152815,11 +152802,11 @@ function ExtractRest(L, R) {
|
|
|
152815
152802
|
return extracted.length === 1 ? extracted[0] : Union(extracted);
|
|
152816
152803
|
}
|
|
152817
152804
|
function Extract(L, R, options) {
|
|
152818
|
-
if (
|
|
152805
|
+
if (IsTemplateLiteral(L))
|
|
152819
152806
|
return CreateType(ExtractFromTemplateLiteral(L, R), options);
|
|
152820
|
-
if (
|
|
152807
|
+
if (IsMappedResult(L))
|
|
152821
152808
|
return CreateType(ExtractFromMappedResult(L, R), options);
|
|
152822
|
-
return CreateType(
|
|
152809
|
+
return CreateType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
|
|
152823
152810
|
}
|
|
152824
152811
|
|
|
152825
152812
|
// ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
|
|
@@ -152839,7 +152826,7 @@ function ExtractFromMappedResult(R, T2) {
|
|
|
152839
152826
|
|
|
152840
152827
|
// ../../node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
|
|
152841
152828
|
function InstanceType(schema, options) {
|
|
152842
|
-
return
|
|
152829
|
+
return IsConstructor(schema) ? CreateType(schema.returns, options) : Never(options);
|
|
152843
152830
|
}
|
|
152844
152831
|
|
|
152845
152832
|
// ../../node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
|
|
@@ -152889,7 +152876,7 @@ function FromNumberKey(_2, type, options) {
|
|
|
152889
152876
|
return RecordCreateFromPattern(PatternNumberExact, type, options);
|
|
152890
152877
|
}
|
|
152891
152878
|
function Record(key, type, options = {}) {
|
|
152892
|
-
return
|
|
152879
|
+
return IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral(key) ? FromLiteralKey(key.const, type, options) : IsBoolean3(key) ? FromBooleanKey(key, type, options) : IsInteger2(key) ? FromIntegerKey(key, type, options) : IsNumber3(key) ? FromNumberKey(key, type, options) : IsRegExp2(key) ? FromRegExpKey(key, type, options) : IsString3(key) ? FromStringKey(key, type, options) : IsAny(key) ? FromAnyKey(key, type, options) : IsNever(key) ? FromNeverKey(key, type, options) : Never(options);
|
|
152893
152880
|
}
|
|
152894
152881
|
function RecordPattern(record) {
|
|
152895
152882
|
return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
|
|
@@ -152957,8 +152944,8 @@ function FromArgument(args, argument) {
|
|
|
152957
152944
|
return argument.index in args ? args[argument.index] : Unknown();
|
|
152958
152945
|
}
|
|
152959
152946
|
function FromProperty2(args, type) {
|
|
152960
|
-
const isReadonly =
|
|
152961
|
-
const isOptional =
|
|
152947
|
+
const isReadonly = IsReadonly(type);
|
|
152948
|
+
const isOptional = IsOptional(type);
|
|
152962
152949
|
const mapped = FromType(args, type);
|
|
152963
152950
|
return isReadonly && isOptional ? ReadonlyOptional(mapped) : isReadonly && !isOptional ? Readonly(mapped) : !isReadonly && isOptional ? Optional(mapped) : mapped;
|
|
152964
152951
|
}
|
|
@@ -152971,7 +152958,7 @@ function FromTypes(args, types) {
|
|
|
152971
152958
|
return types.map((type) => FromType(args, type));
|
|
152972
152959
|
}
|
|
152973
152960
|
function FromType(args, type) {
|
|
152974
|
-
return
|
|
152961
|
+
return IsConstructor(type) ? FromConstructor2(args, type) : IsFunction3(type) ? FromFunction2(args, type) : IsIntersect(type) ? FromIntersect5(args, type) : IsUnion(type) ? FromUnion7(args, type) : IsTuple(type) ? FromTuple4(args, type) : IsArray3(type) ? FromArray5(args, type) : IsAsyncIterator3(type) ? FromAsyncIterator2(args, type) : IsIterator3(type) ? FromIterator2(args, type) : IsPromise2(type) ? FromPromise3(args, type) : IsObject3(type) ? FromObject2(args, type) : IsRecord(type) ? FromRecord2(args, type) : IsArgument(type) ? FromArgument(args, type) : type;
|
|
152975
152962
|
}
|
|
152976
152963
|
function Instantiate(type, args) {
|
|
152977
152964
|
return FromType(args, CloneType(type));
|
|
@@ -153035,7 +153022,7 @@ function FromRest5(T2, M) {
|
|
|
153035
153022
|
return T2.map((L) => Intrinsic(L, M));
|
|
153036
153023
|
}
|
|
153037
153024
|
function Intrinsic(schema, mode, options = {}) {
|
|
153038
|
-
return
|
|
153025
|
+
return IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, options) : IsUnion(schema) ? Union(FromRest5(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : CreateType(schema, options);
|
|
153039
153026
|
}
|
|
153040
153027
|
|
|
153041
153028
|
// ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
|
|
@@ -153093,18 +153080,18 @@ function FromObject3(type, propertyKeys, properties) {
|
|
|
153093
153080
|
return Object2(mappedProperties, options);
|
|
153094
153081
|
}
|
|
153095
153082
|
function UnionFromPropertyKeys(propertyKeys) {
|
|
153096
|
-
const result = propertyKeys.reduce((result2, key) =>
|
|
153083
|
+
const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
|
|
153097
153084
|
return Union(result);
|
|
153098
153085
|
}
|
|
153099
153086
|
function OmitResolve(type, propertyKeys) {
|
|
153100
|
-
return
|
|
153087
|
+
return IsIntersect(type) ? Intersect(FromIntersect6(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion8(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject3(type, propertyKeys, type.properties) : Object2({});
|
|
153101
153088
|
}
|
|
153102
153089
|
function Omit(type, key, options) {
|
|
153103
153090
|
const typeKey = IsArray(key) ? UnionFromPropertyKeys(key) : key;
|
|
153104
|
-
const propertyKeys =
|
|
153105
|
-
const isTypeRef =
|
|
153106
|
-
const isKeyRef =
|
|
153107
|
-
return
|
|
153091
|
+
const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
153092
|
+
const isTypeRef = IsRef(type);
|
|
153093
|
+
const isKeyRef = IsRef(key);
|
|
153094
|
+
return IsMappedResult(type) ? OmitFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? OmitFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Omit", [type, typeKey], options) : CreateType({ ...OmitResolve(type, propertyKeys), ...options });
|
|
153108
153095
|
}
|
|
153109
153096
|
|
|
153110
153097
|
// ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
|
|
@@ -153159,18 +153146,18 @@ function FromObject4(Type, keys, properties) {
|
|
|
153159
153146
|
return Object2(mappedProperties, options);
|
|
153160
153147
|
}
|
|
153161
153148
|
function UnionFromPropertyKeys2(propertyKeys) {
|
|
153162
|
-
const result = propertyKeys.reduce((result2, key) =>
|
|
153149
|
+
const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
|
|
153163
153150
|
return Union(result);
|
|
153164
153151
|
}
|
|
153165
153152
|
function PickResolve(type, propertyKeys) {
|
|
153166
|
-
return
|
|
153153
|
+
return IsIntersect(type) ? Intersect(FromIntersect7(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion9(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject4(type, propertyKeys, type.properties) : Object2({});
|
|
153167
153154
|
}
|
|
153168
153155
|
function Pick(type, key, options) {
|
|
153169
153156
|
const typeKey = IsArray(key) ? UnionFromPropertyKeys2(key) : key;
|
|
153170
|
-
const propertyKeys =
|
|
153171
|
-
const isTypeRef =
|
|
153172
|
-
const isKeyRef =
|
|
153173
|
-
return
|
|
153157
|
+
const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
153158
|
+
const isTypeRef = IsRef(type);
|
|
153159
|
+
const isKeyRef = IsRef(key);
|
|
153160
|
+
return IsMappedResult(type) ? PickFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? PickFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Pick", [type, typeKey], options) : CreateType({ ...PickResolve(type, propertyKeys), ...options });
|
|
153174
153161
|
}
|
|
153175
153162
|
|
|
153176
153163
|
// ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
|
|
@@ -153214,10 +153201,10 @@ function FromRest6(types) {
|
|
|
153214
153201
|
return types.map((type) => PartialResolve(type));
|
|
153215
153202
|
}
|
|
153216
153203
|
function PartialResolve(type) {
|
|
153217
|
-
return
|
|
153204
|
+
return IsComputed(type) ? FromComputed3(type.target, type.parameters) : IsRef(type) ? FromRef3(type.$ref) : IsIntersect(type) ? Intersect(FromRest6(type.allOf)) : IsUnion(type) ? Union(FromRest6(type.anyOf)) : IsObject3(type) ? FromObject5(type, type.properties) : IsBigInt3(type) ? type : IsBoolean3(type) ? type : IsInteger2(type) ? type : IsLiteral(type) ? type : IsNull3(type) ? type : IsNumber3(type) ? type : IsString3(type) ? type : IsSymbol3(type) ? type : IsUndefined3(type) ? type : Object2({});
|
|
153218
153205
|
}
|
|
153219
153206
|
function Partial(type, options) {
|
|
153220
|
-
if (
|
|
153207
|
+
if (IsMappedResult(type)) {
|
|
153221
153208
|
return PartialFromMappedResult(type, options);
|
|
153222
153209
|
} else {
|
|
153223
153210
|
return CreateType({ ...PartialResolve(type), ...options });
|
|
@@ -153261,10 +153248,10 @@ function FromRest7(types) {
|
|
|
153261
153248
|
return types.map((type) => RequiredResolve(type));
|
|
153262
153249
|
}
|
|
153263
153250
|
function RequiredResolve(type) {
|
|
153264
|
-
return
|
|
153251
|
+
return IsComputed(type) ? FromComputed4(type.target, type.parameters) : IsRef(type) ? FromRef4(type.$ref) : IsIntersect(type) ? Intersect(FromRest7(type.allOf)) : IsUnion(type) ? Union(FromRest7(type.anyOf)) : IsObject3(type) ? FromObject6(type, type.properties) : IsBigInt3(type) ? type : IsBoolean3(type) ? type : IsInteger2(type) ? type : IsLiteral(type) ? type : IsNull3(type) ? type : IsNumber3(type) ? type : IsString3(type) ? type : IsSymbol3(type) ? type : IsUndefined3(type) ? type : Object2({});
|
|
153265
153252
|
}
|
|
153266
153253
|
function Required(type, options) {
|
|
153267
|
-
if (
|
|
153254
|
+
if (IsMappedResult(type)) {
|
|
153268
153255
|
return RequiredFromMappedResult(type, options);
|
|
153269
153256
|
} else {
|
|
153270
153257
|
return CreateType({ ...RequiredResolve(type), ...options });
|
|
@@ -153289,11 +153276,11 @@ function RequiredFromMappedResult(R, options) {
|
|
|
153289
153276
|
// ../../node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs
|
|
153290
153277
|
function DereferenceParameters(moduleProperties, types) {
|
|
153291
153278
|
return types.map((type) => {
|
|
153292
|
-
return
|
|
153279
|
+
return IsRef(type) ? Dereference(moduleProperties, type.$ref) : FromType2(moduleProperties, type);
|
|
153293
153280
|
});
|
|
153294
153281
|
}
|
|
153295
153282
|
function Dereference(moduleProperties, ref) {
|
|
153296
|
-
return ref in moduleProperties ?
|
|
153283
|
+
return ref in moduleProperties ? IsRef(moduleProperties[ref]) ? Dereference(moduleProperties, moduleProperties[ref].$ref) : FromType2(moduleProperties, moduleProperties[ref]) : Never();
|
|
153297
153284
|
}
|
|
153298
153285
|
function FromAwaited(parameters) {
|
|
153299
153286
|
return Awaited(parameters[0]);
|
|
@@ -153350,7 +153337,7 @@ function FromRecord3(moduleProperties, type) {
|
|
|
153350
153337
|
return result;
|
|
153351
153338
|
}
|
|
153352
153339
|
function FromTransform(moduleProperties, transform) {
|
|
153353
|
-
return
|
|
153340
|
+
return IsRef(transform) ? { ...Dereference(moduleProperties, transform.$ref), [TransformKind]: transform[TransformKind] } : transform;
|
|
153354
153341
|
}
|
|
153355
153342
|
function FromTuple5(moduleProperties, types) {
|
|
153356
153343
|
return Tuple(FromTypes2(moduleProperties, types));
|
|
@@ -153362,7 +153349,7 @@ function FromTypes2(moduleProperties, types) {
|
|
|
153362
153349
|
return types.map((type) => FromType2(moduleProperties, type));
|
|
153363
153350
|
}
|
|
153364
153351
|
function FromType2(moduleProperties, type) {
|
|
153365
|
-
return
|
|
153352
|
+
return IsOptional(type) ? CreateType(FromType2(moduleProperties, Discard(type, [OptionalKind])), type) : IsReadonly(type) ? CreateType(FromType2(moduleProperties, Discard(type, [ReadonlyKind])), type) : IsTransform(type) ? CreateType(FromTransform(moduleProperties, type), type) : IsArray3(type) ? CreateType(FromArray6(moduleProperties, type.items), type) : IsAsyncIterator3(type) ? CreateType(FromAsyncIterator3(moduleProperties, type.items), type) : IsComputed(type) ? CreateType(FromComputed5(moduleProperties, type.target, type.parameters)) : IsConstructor(type) ? CreateType(FromConstructor3(moduleProperties, type.parameters, type.returns), type) : IsFunction3(type) ? CreateType(FromFunction3(moduleProperties, type.parameters, type.returns), type) : IsIntersect(type) ? CreateType(FromIntersect8(moduleProperties, type.allOf), type) : IsIterator3(type) ? CreateType(FromIterator3(moduleProperties, type.items), type) : IsObject3(type) ? CreateType(FromObject7(moduleProperties, type.properties), type) : IsRecord(type) ? CreateType(FromRecord3(moduleProperties, type)) : IsTuple(type) ? CreateType(FromTuple5(moduleProperties, type.items || []), type) : IsUnion(type) ? CreateType(FromUnion10(moduleProperties, type.anyOf), type) : type;
|
|
153366
153353
|
}
|
|
153367
153354
|
function ComputeType(moduleProperties, key) {
|
|
153368
153355
|
return key in moduleProperties ? FromType2(moduleProperties, moduleProperties[key]) : Never();
|
|
@@ -153401,7 +153388,7 @@ function Not2(type, options) {
|
|
|
153401
153388
|
|
|
153402
153389
|
// ../../node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
|
|
153403
153390
|
function Parameters(schema, options) {
|
|
153404
|
-
return
|
|
153391
|
+
return IsFunction3(schema) ? Tuple(schema.parameters, options) : Never();
|
|
153405
153392
|
}
|
|
153406
153393
|
|
|
153407
153394
|
// ../../node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
|
|
@@ -153422,7 +153409,7 @@ function RegExp2(unresolved, options) {
|
|
|
153422
153409
|
|
|
153423
153410
|
// ../../node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
|
|
153424
153411
|
function RestResolve(T2) {
|
|
153425
|
-
return
|
|
153412
|
+
return IsIntersect(T2) ? T2.allOf : IsUnion(T2) ? T2.anyOf : IsTuple(T2) ? T2.items ?? [] : [];
|
|
153426
153413
|
}
|
|
153427
153414
|
function Rest(T2) {
|
|
153428
153415
|
return RestResolve(T2);
|
|
@@ -153430,7 +153417,7 @@ function Rest(T2) {
|
|
|
153430
153417
|
|
|
153431
153418
|
// ../../node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
|
|
153432
153419
|
function ReturnType(schema, options) {
|
|
153433
|
-
return
|
|
153420
|
+
return IsFunction3(schema) ? CreateType(schema.returns, options) : Never(options);
|
|
153434
153421
|
}
|
|
153435
153422
|
|
|
153436
153423
|
// ../../node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
|
|
@@ -153459,7 +153446,7 @@ class TransformEncodeBuilder {
|
|
|
153459
153446
|
return { ...schema, [TransformKind]: Codec };
|
|
153460
153447
|
}
|
|
153461
153448
|
Encode(encode) {
|
|
153462
|
-
return
|
|
153449
|
+
return IsTransform(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema);
|
|
153463
153450
|
}
|
|
153464
153451
|
}
|
|
153465
153452
|
function Transform(schema) {
|
|
@@ -153984,7 +153971,7 @@ function FromIntersect9(schema, references, value) {
|
|
|
153984
153971
|
const keyPattern = new RegExp(KeyOfPattern(schema));
|
|
153985
153972
|
const check2 = Object.getOwnPropertyNames(value).every((key) => keyPattern.test(key));
|
|
153986
153973
|
return check1 && check2;
|
|
153987
|
-
} else if (
|
|
153974
|
+
} else if (IsSchema(schema.unevaluatedProperties)) {
|
|
153988
153975
|
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
153989
153976
|
const check2 = Object.getOwnPropertyNames(value).every((key) => keyCheck.test(key) || Visit5(schema.unevaluatedProperties, references, value[key]));
|
|
153990
153977
|
return check1 && check2;
|
|
@@ -155509,7 +155496,7 @@ function Cast(...args) {
|
|
|
155509
155496
|
}
|
|
155510
155497
|
// ../../node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs
|
|
155511
155498
|
function IsCheckable(schema) {
|
|
155512
|
-
return
|
|
155499
|
+
return IsKind(schema) && schema[Kind] !== "Unsafe";
|
|
155513
155500
|
}
|
|
155514
155501
|
function FromArray12(schema, references, value) {
|
|
155515
155502
|
if (!IsArray2(value))
|
|
@@ -155525,7 +155512,7 @@ function FromIntersect13(schema, references, value) {
|
|
|
155525
155512
|
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
155526
155513
|
const intersections = schema.allOf.map((schema2) => Visit9(schema2, references, Clone2(value)));
|
|
155527
155514
|
const composite = intersections.reduce((acc, value2) => IsObject2(value2) ? { ...acc, ...value2 } : value2, {});
|
|
155528
|
-
if (!IsObject2(value) || !IsObject2(composite) || !
|
|
155515
|
+
if (!IsObject2(value) || !IsObject2(composite) || !IsKind(unevaluatedProperties))
|
|
155529
155516
|
return composite;
|
|
155530
155517
|
const knownkeys = KeyOfPropertyKeys(schema);
|
|
155531
155518
|
for (const key of Object.getOwnPropertyNames(value)) {
|
|
@@ -155546,7 +155533,7 @@ function FromObject13(schema, references, value) {
|
|
|
155546
155533
|
value[key] = Visit9(schema.properties[key], references, value[key]);
|
|
155547
155534
|
continue;
|
|
155548
155535
|
}
|
|
155549
|
-
if (
|
|
155536
|
+
if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
155550
155537
|
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
155551
155538
|
continue;
|
|
155552
155539
|
}
|
|
@@ -155566,7 +155553,7 @@ function FromRecord8(schema, references, value) {
|
|
|
155566
155553
|
value[key] = Visit9(propertySchema, references, value[key]);
|
|
155567
155554
|
continue;
|
|
155568
155555
|
}
|
|
155569
|
-
if (
|
|
155556
|
+
if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
155570
155557
|
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
155571
155558
|
continue;
|
|
155572
155559
|
}
|
|
@@ -155860,7 +155847,7 @@ class TransformDecodeError extends TypeBoxError {
|
|
|
155860
155847
|
}
|
|
155861
155848
|
function Default3(schema, path6, value) {
|
|
155862
155849
|
try {
|
|
155863
|
-
return
|
|
155850
|
+
return IsTransform(schema) ? schema[TransformKind].Decode(value) : value;
|
|
155864
155851
|
} catch (error) {
|
|
155865
155852
|
throw new TransformDecodeError(schema, path6, value, error);
|
|
155866
155853
|
}
|
|
@@ -155878,7 +155865,7 @@ function FromIntersect15(schema, references, path6, value) {
|
|
|
155878
155865
|
if (knownKey in knownProperties) {
|
|
155879
155866
|
knownProperties[knownKey] = Visit11(knownSchema, references, `${path6}/${knownKey}`, knownProperties[knownKey]);
|
|
155880
155867
|
}
|
|
155881
|
-
if (!
|
|
155868
|
+
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
155882
155869
|
return Default3(schema, path6, knownProperties);
|
|
155883
155870
|
}
|
|
155884
155871
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -155907,11 +155894,11 @@ function FromObject15(schema, references, path6, value) {
|
|
|
155907
155894
|
for (const key of knownKeys) {
|
|
155908
155895
|
if (!HasPropertyKey2(knownProperties, key))
|
|
155909
155896
|
continue;
|
|
155910
|
-
if (IsUndefined2(knownProperties[key]) && (!
|
|
155897
|
+
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
155911
155898
|
continue;
|
|
155912
155899
|
knownProperties[key] = Visit11(schema.properties[key], references, `${path6}/${key}`, knownProperties[key]);
|
|
155913
155900
|
}
|
|
155914
|
-
if (!
|
|
155901
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
155915
155902
|
return Default3(schema, path6, knownProperties);
|
|
155916
155903
|
}
|
|
155917
155904
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -155933,7 +155920,7 @@ function FromRecord10(schema, references, path6, value) {
|
|
|
155933
155920
|
if (knownKeys.test(key)) {
|
|
155934
155921
|
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path6}/${key}`, knownProperties[key]);
|
|
155935
155922
|
}
|
|
155936
|
-
if (!
|
|
155923
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
155937
155924
|
return Default3(schema, path6, knownProperties);
|
|
155938
155925
|
}
|
|
155939
155926
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -156020,7 +156007,7 @@ class TransformEncodeError extends TypeBoxError {
|
|
|
156020
156007
|
}
|
|
156021
156008
|
function Default4(schema, path6, value) {
|
|
156022
156009
|
try {
|
|
156023
|
-
return
|
|
156010
|
+
return IsTransform(schema) ? schema[TransformKind].Encode(value) : value;
|
|
156024
156011
|
} catch (error) {
|
|
156025
156012
|
throw new TransformEncodeError(schema, path6, value, error);
|
|
156026
156013
|
}
|
|
@@ -156046,7 +156033,7 @@ function FromIntersect16(schema, references, path6, value) {
|
|
|
156046
156033
|
if (knownKey in knownProperties) {
|
|
156047
156034
|
knownProperties[knownKey] = Visit12(knownSchema, references, `${path6}/${knownKey}`, knownProperties[knownKey]);
|
|
156048
156035
|
}
|
|
156049
|
-
if (!
|
|
156036
|
+
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
156050
156037
|
return knownProperties;
|
|
156051
156038
|
}
|
|
156052
156039
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -156070,11 +156057,11 @@ function FromObject16(schema, references, path6, value) {
|
|
|
156070
156057
|
for (const key of knownKeys) {
|
|
156071
156058
|
if (!HasPropertyKey2(knownProperties, key))
|
|
156072
156059
|
continue;
|
|
156073
|
-
if (IsUndefined2(knownProperties[key]) && (!
|
|
156060
|
+
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
156074
156061
|
continue;
|
|
156075
156062
|
knownProperties[key] = Visit12(schema.properties[key], references, `${path6}/${key}`, knownProperties[key]);
|
|
156076
156063
|
}
|
|
156077
|
-
if (!
|
|
156064
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
156078
156065
|
return knownProperties;
|
|
156079
156066
|
}
|
|
156080
156067
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -156097,7 +156084,7 @@ function FromRecord11(schema, references, path6, value) {
|
|
|
156097
156084
|
if (knownKeys.test(key)) {
|
|
156098
156085
|
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path6}/${key}`, knownProperties[key]);
|
|
156099
156086
|
}
|
|
156100
|
-
if (!
|
|
156087
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
156101
156088
|
return knownProperties;
|
|
156102
156089
|
}
|
|
156103
156090
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
@@ -156172,57 +156159,57 @@ function TransformEncode(schema, references, value) {
|
|
|
156172
156159
|
|
|
156173
156160
|
// ../../node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs
|
|
156174
156161
|
function FromArray16(schema, references) {
|
|
156175
|
-
return
|
|
156162
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
156176
156163
|
}
|
|
156177
156164
|
function FromAsyncIterator7(schema, references) {
|
|
156178
|
-
return
|
|
156165
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
156179
156166
|
}
|
|
156180
156167
|
function FromConstructor8(schema, references) {
|
|
156181
|
-
return
|
|
156168
|
+
return IsTransform(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
156182
156169
|
}
|
|
156183
156170
|
function FromFunction7(schema, references) {
|
|
156184
|
-
return
|
|
156171
|
+
return IsTransform(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
156185
156172
|
}
|
|
156186
156173
|
function FromIntersect17(schema, references) {
|
|
156187
|
-
return
|
|
156174
|
+
return IsTransform(schema) || IsTransform(schema.unevaluatedProperties) || schema.allOf.some((schema2) => Visit13(schema2, references));
|
|
156188
156175
|
}
|
|
156189
156176
|
function FromImport9(schema, references) {
|
|
156190
156177
|
const additional = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => [...result, schema.$defs[key]], []);
|
|
156191
156178
|
const target = schema.$defs[schema.$ref];
|
|
156192
|
-
return
|
|
156179
|
+
return IsTransform(schema) || Visit13(target, [...additional, ...references]);
|
|
156193
156180
|
}
|
|
156194
156181
|
function FromIterator7(schema, references) {
|
|
156195
|
-
return
|
|
156182
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
156196
156183
|
}
|
|
156197
156184
|
function FromNot7(schema, references) {
|
|
156198
|
-
return
|
|
156185
|
+
return IsTransform(schema) || Visit13(schema.not, references);
|
|
156199
156186
|
}
|
|
156200
156187
|
function FromObject17(schema, references) {
|
|
156201
|
-
return
|
|
156188
|
+
return IsTransform(schema) || Object.values(schema.properties).some((schema2) => Visit13(schema2, references)) || IsSchema(schema.additionalProperties) && Visit13(schema.additionalProperties, references);
|
|
156202
156189
|
}
|
|
156203
156190
|
function FromPromise7(schema, references) {
|
|
156204
|
-
return
|
|
156191
|
+
return IsTransform(schema) || Visit13(schema.item, references);
|
|
156205
156192
|
}
|
|
156206
156193
|
function FromRecord12(schema, references) {
|
|
156207
156194
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
156208
156195
|
const property = schema.patternProperties[pattern];
|
|
156209
|
-
return
|
|
156196
|
+
return IsTransform(schema) || Visit13(property, references) || IsSchema(schema.additionalProperties) && IsTransform(schema.additionalProperties);
|
|
156210
156197
|
}
|
|
156211
156198
|
function FromRef13(schema, references) {
|
|
156212
|
-
if (
|
|
156199
|
+
if (IsTransform(schema))
|
|
156213
156200
|
return true;
|
|
156214
156201
|
return Visit13(Deref(schema, references), references);
|
|
156215
156202
|
}
|
|
156216
156203
|
function FromThis9(schema, references) {
|
|
156217
|
-
if (
|
|
156204
|
+
if (IsTransform(schema))
|
|
156218
156205
|
return true;
|
|
156219
156206
|
return Visit13(Deref(schema, references), references);
|
|
156220
156207
|
}
|
|
156221
156208
|
function FromTuple14(schema, references) {
|
|
156222
|
-
return
|
|
156209
|
+
return IsTransform(schema) || !IsUndefined2(schema.items) && schema.items.some((schema2) => Visit13(schema2, references));
|
|
156223
156210
|
}
|
|
156224
156211
|
function FromUnion19(schema, references) {
|
|
156225
|
-
return
|
|
156212
|
+
return IsTransform(schema) || schema.anyOf.some((schema2) => Visit13(schema2, references));
|
|
156226
156213
|
}
|
|
156227
156214
|
function Visit13(schema, references) {
|
|
156228
156215
|
const references_ = Pushref(schema, references);
|
|
@@ -156263,7 +156250,7 @@ function Visit13(schema, references) {
|
|
|
156263
156250
|
case "Union":
|
|
156264
156251
|
return FromUnion19(schema_, references_);
|
|
156265
156252
|
default:
|
|
156266
|
-
return
|
|
156253
|
+
return IsTransform(schema);
|
|
156267
156254
|
}
|
|
156268
156255
|
}
|
|
156269
156256
|
var visited = new Set;
|
|
@@ -156286,7 +156273,7 @@ function ValueOrDefault(schema, value) {
|
|
|
156286
156273
|
return IsUndefined2(value) ? clone : IsObject2(value) && IsObject2(clone) ? Object.assign(clone, value) : value;
|
|
156287
156274
|
}
|
|
156288
156275
|
function HasDefaultProperty(schema) {
|
|
156289
|
-
return
|
|
156276
|
+
return IsKind(schema) && "default" in schema;
|
|
156290
156277
|
}
|
|
156291
156278
|
function FromArray17(schema, references, value) {
|
|
156292
156279
|
if (IsArray2(value)) {
|
|
@@ -157024,8 +157011,8 @@ var TypeCompiler;
|
|
|
157024
157011
|
yield `${value}.length >= ${schema.minItems}`;
|
|
157025
157012
|
const elementExpression = CreateExpression(schema.items, references, "value");
|
|
157026
157013
|
yield `((array) => { for(const ${parameter} of array) if(!(${elementExpression})) { return false }; return true; })(${value})`;
|
|
157027
|
-
if (
|
|
157028
|
-
const containsSchema =
|
|
157014
|
+
if (IsSchema2(schema.contains) || IsNumber2(schema.minContains) || IsNumber2(schema.maxContains)) {
|
|
157015
|
+
const containsSchema = IsSchema2(schema.contains) ? schema.contains : Never();
|
|
157029
157016
|
const checkExpression = CreateExpression(containsSchema, references, "value");
|
|
157030
157017
|
const checkMinContains = IsNumber2(schema.minContains) ? [`(count >= ${schema.minContains})`] : [];
|
|
157031
157018
|
const checkMaxContains = IsNumber2(schema.maxContains) ? [`(count <= ${schema.maxContains})`] : [];
|
|
@@ -157102,7 +157089,7 @@ var TypeCompiler;
|
|
|
157102
157089
|
const keyCheck = CreateVariable(`${new RegExp(KeyOfPattern(schema))};`);
|
|
157103
157090
|
const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key))`;
|
|
157104
157091
|
yield `(${check1} && ${check2})`;
|
|
157105
|
-
} else if (
|
|
157092
|
+
} else if (IsSchema2(schema.unevaluatedProperties)) {
|
|
157106
157093
|
const keyCheck = CreateVariable(`${new RegExp(KeyOfPattern(schema))};`);
|
|
157107
157094
|
const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key) || ${CreateExpression(schema.unevaluatedProperties, references, `${value}[key]`)})`;
|
|
157108
157095
|
yield `(${check1} && ${check2})`;
|
|
@@ -157188,7 +157175,7 @@ var TypeCompiler;
|
|
|
157188
157175
|
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
|
157189
157176
|
const variable = CreateVariable(`${new RegExp(patternKey)}`);
|
|
157190
157177
|
const check1 = CreateExpression(patternSchema, references, "value");
|
|
157191
|
-
const check2 =
|
|
157178
|
+
const check2 = IsSchema2(schema.additionalProperties) ? CreateExpression(schema.additionalProperties, references, value) : schema.additionalProperties === false ? "false" : "true";
|
|
157192
157179
|
const expression = `(${variable}.test(key) ? ${check1} : ${check2})`;
|
|
157193
157180
|
yield `(Object.entries(${value}).every(([key, value]) => ${expression}))`;
|
|
157194
157181
|
}
|
|
@@ -157406,10 +157393,10 @@ var TypeCompiler;
|
|
|
157406
157393
|
state.variables.clear();
|
|
157407
157394
|
state.functions.clear();
|
|
157408
157395
|
state.instances.clear();
|
|
157409
|
-
if (!
|
|
157396
|
+
if (!IsSchema2(schema))
|
|
157410
157397
|
throw new TypeCompilerTypeGuardError(schema);
|
|
157411
157398
|
for (const schema2 of references)
|
|
157412
|
-
if (!
|
|
157399
|
+
if (!IsSchema2(schema2))
|
|
157413
157400
|
throw new TypeCompilerTypeGuardError(schema2);
|
|
157414
157401
|
return Build(schema, references, options);
|
|
157415
157402
|
}
|
|
@@ -172886,14 +172873,113 @@ var cors = (config2) => {
|
|
|
172886
172873
|
init_contextual_search_rlm();
|
|
172887
172874
|
init_dist();
|
|
172888
172875
|
init_index_job_tracker();
|
|
172876
|
+
|
|
172877
|
+
// ../../packages/core/dist/services/indexing/execute-indexing.js
|
|
172878
|
+
init_dist();
|
|
172879
|
+
init_index_job_tracker();
|
|
172889
172880
|
init_pipeline();
|
|
172890
|
-
|
|
172891
|
-
|
|
172881
|
+
async function executeIndexing(request) {
|
|
172882
|
+
const { jobId, projectId, projectPath, forceReindex, warmCache, warmupQueries, include_tests = false, managedRunLease, warmupCache: warmupCache2 } = request;
|
|
172883
|
+
const startTime = Date.now();
|
|
172884
|
+
try {
|
|
172885
|
+
indexJobTracker.updateStatus(jobId, "running");
|
|
172886
|
+
logger.info("Starting project indexing via ETL Pipeline", {
|
|
172887
|
+
jobId,
|
|
172888
|
+
projectPath,
|
|
172889
|
+
projectId,
|
|
172890
|
+
forceReindex,
|
|
172891
|
+
warmCache,
|
|
172892
|
+
include_tests
|
|
172893
|
+
});
|
|
172894
|
+
const etlResult = await EtlPipeline.getInstance().run({
|
|
172895
|
+
projectId,
|
|
172896
|
+
projectPath,
|
|
172897
|
+
jobId,
|
|
172898
|
+
forceReindex,
|
|
172899
|
+
include_tests,
|
|
172900
|
+
managedRunLease
|
|
172901
|
+
});
|
|
172902
|
+
const duration3 = Date.now() - startTime;
|
|
172903
|
+
logger.info("ETL Pipeline completed", {
|
|
172904
|
+
jobId,
|
|
172905
|
+
projectId,
|
|
172906
|
+
duration: duration3,
|
|
172907
|
+
filesIndexed: etlResult.filesIndexed,
|
|
172908
|
+
filesSkipped: etlResult.filesSkipped,
|
|
172909
|
+
chunksIndexed: etlResult.chunksIndexed,
|
|
172910
|
+
symbolsIndexed: etlResult.symbolsIndexed,
|
|
172911
|
+
errors: etlResult.errors,
|
|
172912
|
+
stageTimings: etlResult.stageTimings
|
|
172913
|
+
});
|
|
172914
|
+
if (warmCache) {
|
|
172915
|
+
logger.info("Starting cache warmup", { jobId, projectId });
|
|
172916
|
+
const warmupStats = await warmupCache2(projectId, projectPath, warmupQueries);
|
|
172917
|
+
logger.info("Cache warmup completed", { jobId, projectId, ...warmupStats });
|
|
172918
|
+
}
|
|
172919
|
+
indexJobTracker.updateProgress(jobId, etlResult.filesIndexed, etlResult.filesIndexed);
|
|
172920
|
+
await indexJobTracker.setResultAndFlush(jobId, {
|
|
172921
|
+
filesIndexed: etlResult.filesIndexed,
|
|
172922
|
+
chunksIndexed: etlResult.chunksIndexed,
|
|
172923
|
+
errors: etlResult.errors,
|
|
172924
|
+
duration: duration3,
|
|
172925
|
+
activatedGraphGenerationId: etlResult.activatedGraphGenerationId,
|
|
172926
|
+
parserDiagnostics: etlResult.parserDiagnostics
|
|
172927
|
+
});
|
|
172928
|
+
} catch (error51) {
|
|
172929
|
+
const duration3 = Date.now() - startTime;
|
|
172930
|
+
logger.error("Project indexing failed", error51, {
|
|
172931
|
+
jobId,
|
|
172932
|
+
projectPath,
|
|
172933
|
+
projectId,
|
|
172934
|
+
duration: duration3
|
|
172935
|
+
});
|
|
172936
|
+
indexJobTracker.setResult(jobId, {
|
|
172937
|
+
filesIndexed: 0,
|
|
172938
|
+
chunksIndexed: 0,
|
|
172939
|
+
errors: 1,
|
|
172940
|
+
duration: duration3
|
|
172941
|
+
}, error51.message);
|
|
172942
|
+
}
|
|
172943
|
+
}
|
|
172944
|
+
|
|
172945
|
+
// ../../packages/core/dist/services/indexing/acquire-indexing-lease.js
|
|
172946
|
+
init_dist();
|
|
172947
|
+
init_index_job_tracker();
|
|
172892
172948
|
init_managed_run_repository_pg();
|
|
172949
|
+
async function acquireIndexingLease(request) {
|
|
172950
|
+
const { jobId, projectId } = request;
|
|
172951
|
+
const eventId = `index:${jobId}`;
|
|
172952
|
+
const managedRunRepo = ManagedRunRepositoryPg.getInstance();
|
|
172953
|
+
try {
|
|
172954
|
+
const beginOutcome = await managedRunRepo.begin({
|
|
172955
|
+
projectId,
|
|
172956
|
+
runKind: "indexing",
|
|
172957
|
+
eventId
|
|
172958
|
+
});
|
|
172959
|
+
if (beginOutcome.status === "busy") {
|
|
172960
|
+
indexJobTracker.setResult(jobId, { filesIndexed: 0, chunksIndexed: 0, errors: 0, duration: 0 }, `indexing_busy:${beginOutcome.activeRunId}`);
|
|
172961
|
+
return {
|
|
172962
|
+
status: "busy",
|
|
172963
|
+
activeRunId: beginOutcome.activeRunId,
|
|
172964
|
+
leaseExpiresAt: beginOutcome.leaseExpiresAt
|
|
172965
|
+
};
|
|
172966
|
+
}
|
|
172967
|
+
return { status: "acquired", lease: beginOutcome.lease };
|
|
172968
|
+
} catch (beginError) {
|
|
172969
|
+
logger.error("managed_runs begin failed", beginError, {
|
|
172970
|
+
jobId,
|
|
172971
|
+
projectId
|
|
172972
|
+
});
|
|
172973
|
+
indexJobTracker.setResult(jobId, { filesIndexed: 0, chunksIndexed: 0, errors: 1, duration: 0 }, `managed_runs_begin_failed:${beginError.message}`);
|
|
172974
|
+
return { status: "failed", message: beginError.message };
|
|
172975
|
+
}
|
|
172976
|
+
}
|
|
172977
|
+
|
|
172978
|
+
// ../../packages/core/dist/services/project-identity/project-root-identity.js
|
|
172893
172979
|
import { realpath as realpath2 } from "fs/promises";
|
|
172894
|
-
import
|
|
172980
|
+
import path18 from "path";
|
|
172895
172981
|
async function canonicalizeProjectRoot(projectPath, canonicalize = realpath2) {
|
|
172896
|
-
return canonicalize(
|
|
172982
|
+
return canonicalize(path18.resolve(projectPath));
|
|
172897
172983
|
}
|
|
172898
172984
|
async function assertProjectRootReuse(options) {
|
|
172899
172985
|
if (!options.storedProjectPath || options.forceReindex)
|
|
@@ -172901,15 +172987,20 @@ async function assertProjectRootReuse(options) {
|
|
|
172901
172987
|
const canonicalize = options.canonicalize ?? realpath2;
|
|
172902
172988
|
let storedCanonical;
|
|
172903
172989
|
try {
|
|
172904
|
-
storedCanonical = await canonicalize(
|
|
172990
|
+
storedCanonical = await canonicalize(path18.resolve(options.storedProjectPath));
|
|
172905
172991
|
} catch {
|
|
172906
|
-
storedCanonical =
|
|
172992
|
+
storedCanonical = path18.resolve(options.storedProjectPath);
|
|
172907
172993
|
}
|
|
172908
172994
|
if (storedCanonical !== options.canonicalProjectPath) {
|
|
172909
172995
|
throw new Error(`Project ID "${options.projectId}" already indexes canonical root ` + `"${storedCanonical}", not "${options.canonicalProjectPath}"; ` + "use forceReindex only after verifying ownership of the existing project");
|
|
172910
172996
|
}
|
|
172911
172997
|
}
|
|
172912
172998
|
|
|
172999
|
+
// ../../packages/core/dist/tools/index_project.js
|
|
173000
|
+
init_workspace_manager();
|
|
173001
|
+
init_parser_readiness();
|
|
173002
|
+
import path20 from "path";
|
|
173003
|
+
|
|
172913
173004
|
class IndexProjectTool {
|
|
172914
173005
|
name = "index_project";
|
|
172915
173006
|
description = "Index a project directory for contextual code search with semantic embeddings";
|
|
@@ -172956,7 +173047,7 @@ class IndexProjectTool {
|
|
|
172956
173047
|
try {
|
|
172957
173048
|
await assertParserReadyForIndexing();
|
|
172958
173049
|
const canonicalProjectPath = await canonicalizeProjectRoot(projectPath);
|
|
172959
|
-
const finalProjectId = projectId ||
|
|
173050
|
+
const finalProjectId = projectId || path20.basename(canonicalProjectPath) || "default";
|
|
172960
173051
|
const existing = await workspaceManager.getWorkspace(finalProjectId);
|
|
172961
173052
|
await assertProjectRootReuse({
|
|
172962
173053
|
projectId: finalProjectId,
|
|
@@ -172970,40 +173061,42 @@ class IndexProjectTool {
|
|
|
172970
173061
|
projectPath: canonicalProjectPath,
|
|
172971
173062
|
projectId: finalProjectId
|
|
172972
173063
|
});
|
|
172973
|
-
const
|
|
172974
|
-
|
|
172975
|
-
|
|
172976
|
-
|
|
172977
|
-
|
|
172978
|
-
projectId: finalProjectId,
|
|
172979
|
-
runKind: "indexing",
|
|
172980
|
-
eventId
|
|
172981
|
-
});
|
|
172982
|
-
if (beginOutcome.status === "busy") {
|
|
172983
|
-
indexJobTracker.setResult(job.jobId, { filesIndexed: 0, chunksIndexed: 0, errors: 0, duration: 0 }, `indexing_busy:${beginOutcome.activeRunId}`);
|
|
172984
|
-
return {
|
|
172985
|
-
success: false,
|
|
172986
|
-
error: `indexing_busy:${beginOutcome.activeRunId}`,
|
|
172987
|
-
data: {
|
|
172988
|
-
jobId: job.jobId,
|
|
172989
|
-
projectId: finalProjectId,
|
|
172990
|
-
status: "busy",
|
|
172991
|
-
activeRunId: beginOutcome.activeRunId,
|
|
172992
|
-
leaseExpiresAt: beginOutcome.leaseExpiresAt,
|
|
172993
|
-
message: "Another indexing run is active for this project. Poll get_index_status(activeRunId)."
|
|
172994
|
-
}
|
|
172995
|
-
};
|
|
172996
|
-
}
|
|
172997
|
-
lease = beginOutcome.lease;
|
|
172998
|
-
} catch (beginError) {
|
|
172999
|
-
logger.error("managed_runs begin failed", beginError, { jobId: job.jobId, projectId: finalProjectId });
|
|
173000
|
-
indexJobTracker.setResult(job.jobId, { filesIndexed: 0, chunksIndexed: 0, errors: 1, duration: 0 }, `managed_runs_begin_failed:${beginError.message}`);
|
|
173064
|
+
const leaseOutcome = await acquireIndexingLease({
|
|
173065
|
+
jobId: job.jobId,
|
|
173066
|
+
projectId: finalProjectId
|
|
173067
|
+
});
|
|
173068
|
+
if (leaseOutcome.status === "busy") {
|
|
173001
173069
|
return {
|
|
173002
173070
|
success: false,
|
|
173003
|
-
error: `
|
|
173071
|
+
error: `indexing_busy:${leaseOutcome.activeRunId}`,
|
|
173072
|
+
data: {
|
|
173073
|
+
jobId: job.jobId,
|
|
173074
|
+
projectId: finalProjectId,
|
|
173075
|
+
status: "busy",
|
|
173076
|
+
activeRunId: leaseOutcome.activeRunId,
|
|
173077
|
+
leaseExpiresAt: leaseOutcome.leaseExpiresAt,
|
|
173078
|
+
message: "Another indexing run is active for this project. Poll get_index_status(activeRunId)."
|
|
173079
|
+
}
|
|
173004
173080
|
};
|
|
173005
173081
|
}
|
|
173006
|
-
|
|
173082
|
+
if (leaseOutcome.status === "failed") {
|
|
173083
|
+
return {
|
|
173084
|
+
success: false,
|
|
173085
|
+
error: `Failed to acquire indexing lease: ${leaseOutcome.message}`
|
|
173086
|
+
};
|
|
173087
|
+
}
|
|
173088
|
+
const lease = leaseOutcome.lease;
|
|
173089
|
+
executeIndexing({
|
|
173090
|
+
jobId: job.jobId,
|
|
173091
|
+
projectId: finalProjectId,
|
|
173092
|
+
projectPath: canonicalProjectPath,
|
|
173093
|
+
forceReindex,
|
|
173094
|
+
warmCache,
|
|
173095
|
+
warmupQueries,
|
|
173096
|
+
include_tests,
|
|
173097
|
+
managedRunLease: lease,
|
|
173098
|
+
warmupCache: this.contextualSearch.warmupCache.bind(this.contextualSearch)
|
|
173099
|
+
}).catch((error51) => {
|
|
173007
173100
|
logger.error("Background indexing failed", error51, {
|
|
173008
173101
|
jobId: job.jobId
|
|
173009
173102
|
});
|
|
@@ -173030,68 +173123,6 @@ class IndexProjectTool {
|
|
|
173030
173123
|
};
|
|
173031
173124
|
}
|
|
173032
173125
|
}
|
|
173033
|
-
async executeIndexing(jobId, projectId, projectPath, forceReindex, warmCache, warmupQueries, include_tests = false, managedRunLease) {
|
|
173034
|
-
const startTime = Date.now();
|
|
173035
|
-
try {
|
|
173036
|
-
indexJobTracker.updateStatus(jobId, "running");
|
|
173037
|
-
logger.info("Starting project indexing via ETL Pipeline", {
|
|
173038
|
-
jobId,
|
|
173039
|
-
projectPath,
|
|
173040
|
-
projectId,
|
|
173041
|
-
forceReindex,
|
|
173042
|
-
warmCache,
|
|
173043
|
-
include_tests
|
|
173044
|
-
});
|
|
173045
|
-
const etlResult = await EtlPipeline.getInstance().run({
|
|
173046
|
-
projectId,
|
|
173047
|
-
projectPath,
|
|
173048
|
-
jobId,
|
|
173049
|
-
forceReindex,
|
|
173050
|
-
include_tests,
|
|
173051
|
-
managedRunLease
|
|
173052
|
-
});
|
|
173053
|
-
const duration3 = Date.now() - startTime;
|
|
173054
|
-
logger.info("ETL Pipeline completed", {
|
|
173055
|
-
jobId,
|
|
173056
|
-
projectId,
|
|
173057
|
-
duration: duration3,
|
|
173058
|
-
filesIndexed: etlResult.filesIndexed,
|
|
173059
|
-
filesSkipped: etlResult.filesSkipped,
|
|
173060
|
-
chunksIndexed: etlResult.chunksIndexed,
|
|
173061
|
-
symbolsIndexed: etlResult.symbolsIndexed,
|
|
173062
|
-
errors: etlResult.errors,
|
|
173063
|
-
stageTimings: etlResult.stageTimings
|
|
173064
|
-
});
|
|
173065
|
-
if (warmCache) {
|
|
173066
|
-
logger.info("Starting cache warmup", { jobId, projectId });
|
|
173067
|
-
const warmupStats = await this.contextualSearch.warmupCache(projectId, projectPath, warmupQueries);
|
|
173068
|
-
logger.info("Cache warmup completed", { jobId, projectId, ...warmupStats });
|
|
173069
|
-
}
|
|
173070
|
-
indexJobTracker.updateProgress(jobId, etlResult.filesIndexed, etlResult.filesIndexed);
|
|
173071
|
-
await indexJobTracker.setResultAndFlush(jobId, {
|
|
173072
|
-
filesIndexed: etlResult.filesIndexed,
|
|
173073
|
-
chunksIndexed: etlResult.chunksIndexed,
|
|
173074
|
-
errors: etlResult.errors,
|
|
173075
|
-
duration: duration3,
|
|
173076
|
-
activatedGraphGenerationId: etlResult.activatedGraphGenerationId,
|
|
173077
|
-
parserDiagnostics: etlResult.parserDiagnostics
|
|
173078
|
-
});
|
|
173079
|
-
} catch (error51) {
|
|
173080
|
-
const duration3 = Date.now() - startTime;
|
|
173081
|
-
logger.error("Project indexing failed", error51, {
|
|
173082
|
-
jobId,
|
|
173083
|
-
projectPath,
|
|
173084
|
-
projectId,
|
|
173085
|
-
duration: duration3
|
|
173086
|
-
});
|
|
173087
|
-
indexJobTracker.setResult(jobId, {
|
|
173088
|
-
filesIndexed: 0,
|
|
173089
|
-
chunksIndexed: 0,
|
|
173090
|
-
errors: 1,
|
|
173091
|
-
duration: duration3
|
|
173092
|
-
}, error51.message);
|
|
173093
|
-
}
|
|
173094
|
-
}
|
|
173095
173126
|
}
|
|
173096
173127
|
// ../../packages/core/dist/tools/get_index_status.js
|
|
173097
173128
|
init_index_job_tracker();
|
|
@@ -173570,17 +173601,17 @@ function applyReplacer(root, replacer) {
|
|
|
173570
173601
|
return transformChildren(root, replacer, []);
|
|
173571
173602
|
return transformChildren(normalizeValue(replacedRoot), replacer, []);
|
|
173572
173603
|
}
|
|
173573
|
-
function transformChildren(value, replacer,
|
|
173604
|
+
function transformChildren(value, replacer, path21) {
|
|
173574
173605
|
if (isJsonObject(value))
|
|
173575
|
-
return transformObject(value, replacer,
|
|
173606
|
+
return transformObject(value, replacer, path21);
|
|
173576
173607
|
if (isJsonArray(value))
|
|
173577
|
-
return transformArray(value, replacer,
|
|
173608
|
+
return transformArray(value, replacer, path21);
|
|
173578
173609
|
return value;
|
|
173579
173610
|
}
|
|
173580
|
-
function transformObject(obj, replacer,
|
|
173611
|
+
function transformObject(obj, replacer, path21) {
|
|
173581
173612
|
const result = {};
|
|
173582
173613
|
for (const [key, value] of Object.entries(obj)) {
|
|
173583
|
-
const childPath = [...
|
|
173614
|
+
const childPath = [...path21, key];
|
|
173584
173615
|
const replacedValue = replacer(key, value, childPath);
|
|
173585
173616
|
if (replacedValue === undefined)
|
|
173586
173617
|
continue;
|
|
@@ -173588,11 +173619,11 @@ function transformObject(obj, replacer, path20) {
|
|
|
173588
173619
|
}
|
|
173589
173620
|
return result;
|
|
173590
173621
|
}
|
|
173591
|
-
function transformArray(arr, replacer,
|
|
173622
|
+
function transformArray(arr, replacer, path21) {
|
|
173592
173623
|
const result = [];
|
|
173593
173624
|
for (let i = 0;i < arr.length; i++) {
|
|
173594
173625
|
const value = arr[i];
|
|
173595
|
-
const childPath = [...
|
|
173626
|
+
const childPath = [...path21, i];
|
|
173596
173627
|
const replacedValue = replacer(String(i), value, childPath);
|
|
173597
173628
|
if (replacedValue === undefined)
|
|
173598
173629
|
continue;
|
|
@@ -174974,7 +175005,7 @@ init_db_connection();
|
|
|
174974
175005
|
init_alias_resolver();
|
|
174975
175006
|
import fs10 from "fs";
|
|
174976
175007
|
import os3 from "os";
|
|
174977
|
-
import
|
|
175008
|
+
import path21 from "path";
|
|
174978
175009
|
|
|
174979
175010
|
// ../../packages/core/dist/services/hooks/session-pin-store.js
|
|
174980
175011
|
var DEFAULT_MAX_SIZE = 1000;
|
|
@@ -175076,7 +175107,7 @@ class AttributionResolver {
|
|
|
175076
175107
|
this.pins = options.pins ?? new SessionPinStore;
|
|
175077
175108
|
this.canonicalize = options.canonicalize ?? defaultCanonicalize;
|
|
175078
175109
|
this.homedir = options.homedir ?? os3.homedir;
|
|
175079
|
-
this.fsRoot = options.fsRoot ?? (() =>
|
|
175110
|
+
this.fsRoot = options.fsRoot ?? (() => path21.parse(path21.sep).root);
|
|
175080
175111
|
}
|
|
175081
175112
|
async resolve(input) {
|
|
175082
175113
|
const caller = input.callerProjectId;
|
|
@@ -175129,7 +175160,7 @@ class AttributionResolver {
|
|
|
175129
175160
|
}
|
|
175130
175161
|
let bestPath = null;
|
|
175131
175162
|
for (const candidate2 of byPath.keys()) {
|
|
175132
|
-
if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(
|
|
175163
|
+
if (canonicalCwd === candidate2 || canonicalCwd.startsWith(candidate2.endsWith(path21.sep) ? candidate2 : candidate2 + path21.sep)) {
|
|
175133
175164
|
if (bestPath === null || candidate2.length > bestPath.length) {
|
|
175134
175165
|
bestPath = candidate2;
|
|
175135
175166
|
}
|
|
@@ -175152,7 +175183,7 @@ class AttributionResolver {
|
|
|
175152
175183
|
return projectPath2;
|
|
175153
175184
|
const fsRoot = this.fsRoot();
|
|
175154
175185
|
let normalized = projectPath2;
|
|
175155
|
-
while (normalized.length > fsRoot.length && normalized.endsWith(
|
|
175186
|
+
while (normalized.length > fsRoot.length && normalized.endsWith(path21.sep)) {
|
|
175156
175187
|
normalized = normalized.slice(0, -1);
|
|
175157
175188
|
}
|
|
175158
175189
|
return normalized;
|
|
@@ -175163,7 +175194,7 @@ function defaultCanonicalize(cwd) {
|
|
|
175163
175194
|
return fs10.realpathSync(cwd);
|
|
175164
175195
|
} catch {
|
|
175165
175196
|
try {
|
|
175166
|
-
return
|
|
175197
|
+
return path21.resolve(cwd);
|
|
175167
175198
|
} catch {
|
|
175168
175199
|
return;
|
|
175169
175200
|
}
|
|
@@ -175176,6 +175207,69 @@ function getAttributionResolver() {
|
|
|
175176
175207
|
return sharedResolver2;
|
|
175177
175208
|
}
|
|
175178
175209
|
|
|
175210
|
+
// ../../packages/core/dist/kernel/sanitize/credential-scrub.js
|
|
175211
|
+
function markerFor(id) {
|
|
175212
|
+
return `[REDACTED:${id}]`;
|
|
175213
|
+
}
|
|
175214
|
+
function fullMatchRule(id, pattern) {
|
|
175215
|
+
const marker26 = markerFor(id);
|
|
175216
|
+
return {
|
|
175217
|
+
id,
|
|
175218
|
+
replace(text3) {
|
|
175219
|
+
let count = 0;
|
|
175220
|
+
const replaced = text3.replace(pattern, () => {
|
|
175221
|
+
count++;
|
|
175222
|
+
return marker26;
|
|
175223
|
+
});
|
|
175224
|
+
return { text: replaced, count };
|
|
175225
|
+
}
|
|
175226
|
+
};
|
|
175227
|
+
}
|
|
175228
|
+
var PEM_PATTERN = /-----BEGIN [A-Z ]{0,32}PRIVATE KEY-----[\s\S]{0,8192}?-----END [A-Z ]{0,32}PRIVATE KEY-----/g;
|
|
175229
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g;
|
|
175230
|
+
var AWS_KEY_PATTERN = /\b(?:AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}\b/g;
|
|
175231
|
+
var SK_KEY_PATTERN = /\bsk-[A-Za-z0-9_-]{20,}\b/g;
|
|
175232
|
+
var GITHUB_TOKEN_PATTERN = /\bgh[pousr]_[A-Za-z0-9]{36,}\b|\bgithub_pat_[A-Za-z0-9_]{22,}\b/g;
|
|
175233
|
+
var SLACK_TOKEN_PATTERN = /\bxox[baprs]-[A-Za-z0-9-]{18,}\b/g;
|
|
175234
|
+
var BEARER_PATTERN = /(Bearer\s+)([A-Za-z0-9._~+/=-]{20,})/g;
|
|
175235
|
+
var RULES = [
|
|
175236
|
+
fullMatchRule("pem", PEM_PATTERN),
|
|
175237
|
+
fullMatchRule("jwt", JWT_PATTERN),
|
|
175238
|
+
fullMatchRule("aws-key", AWS_KEY_PATTERN),
|
|
175239
|
+
fullMatchRule("sk-key", SK_KEY_PATTERN),
|
|
175240
|
+
fullMatchRule("github-token", GITHUB_TOKEN_PATTERN),
|
|
175241
|
+
fullMatchRule("slack-token", SLACK_TOKEN_PATTERN),
|
|
175242
|
+
{
|
|
175243
|
+
id: "bearer",
|
|
175244
|
+
replace(text3) {
|
|
175245
|
+
let count = 0;
|
|
175246
|
+
const replaced = text3.replace(BEARER_PATTERN, (_m, prefix) => {
|
|
175247
|
+
count++;
|
|
175248
|
+
return `${prefix}${markerFor("bearer")}`;
|
|
175249
|
+
});
|
|
175250
|
+
return { text: replaced, count };
|
|
175251
|
+
}
|
|
175252
|
+
}
|
|
175253
|
+
];
|
|
175254
|
+
var RULE_IDS = RULES.map((r2) => r2.id);
|
|
175255
|
+
function scrubCredentials(payloadJson) {
|
|
175256
|
+
const redactions = {};
|
|
175257
|
+
for (const id of RULE_IDS)
|
|
175258
|
+
redactions[id] = 0;
|
|
175259
|
+
let text3 = payloadJson;
|
|
175260
|
+
for (const rule of RULES) {
|
|
175261
|
+
const { text: next, count } = rule.replace(text3);
|
|
175262
|
+
text3 = next;
|
|
175263
|
+
redactions[rule.id] += count;
|
|
175264
|
+
}
|
|
175265
|
+
const total = Object.values(redactions).reduce((sum, n2) => sum + n2, 0);
|
|
175266
|
+
return {
|
|
175267
|
+
sanitized: text3,
|
|
175268
|
+
redactions,
|
|
175269
|
+
total
|
|
175270
|
+
};
|
|
175271
|
+
}
|
|
175272
|
+
|
|
175179
175273
|
// ../../packages/core/dist/tools/compact_snapshot.js
|
|
175180
175274
|
class CompactSnapshotTool {
|
|
175181
175275
|
name = "compact_snapshot";
|
|
@@ -175227,19 +175321,26 @@ class CompactSnapshotTool {
|
|
|
175227
175321
|
persistedId = newObservationId();
|
|
175228
175322
|
try {
|
|
175229
175323
|
const attribution = await (this.resolverOverride ?? getAttributionResolver()).resolve({ callerProjectId: projectId, sessionId, cwd });
|
|
175324
|
+
const scrub = scrubCredentials(JSON.stringify({
|
|
175325
|
+
snapshot: snapshot.xml,
|
|
175326
|
+
eventCount: snapshot.eventCount,
|
|
175327
|
+
compactCount: snapshot.compactCount,
|
|
175328
|
+
generatedAt: snapshot.generatedAt,
|
|
175329
|
+
sectionCount: snapshot.sections.length
|
|
175330
|
+
}));
|
|
175331
|
+
if (scrub.total > 0) {
|
|
175332
|
+
logger.debug("compact_snapshot payload redacted before persist", {
|
|
175333
|
+
redactions: scrub.redactions,
|
|
175334
|
+
total: scrub.total
|
|
175335
|
+
});
|
|
175336
|
+
}
|
|
175230
175337
|
store4.insert({
|
|
175231
175338
|
id: persistedId,
|
|
175232
175339
|
projectId: attribution.projectId,
|
|
175233
175340
|
sessionId,
|
|
175234
175341
|
source: "pre-compact",
|
|
175235
175342
|
category: "compaction-snapshots",
|
|
175236
|
-
payloadJson:
|
|
175237
|
-
snapshot: snapshot.xml,
|
|
175238
|
-
eventCount: snapshot.eventCount,
|
|
175239
|
-
compactCount: snapshot.compactCount,
|
|
175240
|
-
generatedAt: snapshot.generatedAt,
|
|
175241
|
-
sectionCount: snapshot.sections.length
|
|
175242
|
-
}),
|
|
175343
|
+
payloadJson: scrub.sanitized,
|
|
175243
175344
|
importance: 0.8,
|
|
175244
175345
|
createdAt: Date.now(),
|
|
175245
175346
|
attributionSource: attribution.source
|
|
@@ -175684,310 +175785,22 @@ class GetArchitectureTool {
|
|
|
175684
175785
|
}
|
|
175685
175786
|
// ../../packages/core/dist/tools/read_file.js
|
|
175686
175787
|
init_dist();
|
|
175788
|
+
|
|
175789
|
+
// ../../packages/core/dist/services/file-read/read-file.service.js
|
|
175687
175790
|
init_dist();
|
|
175688
175791
|
init_code_compressor();
|
|
175689
|
-
|
|
175690
|
-
|
|
175792
|
+
|
|
175793
|
+
// ../../packages/core/dist/services/file-read/file-content-cache.js
|
|
175794
|
+
init_dist();
|
|
175691
175795
|
import fs11 from "fs/promises";
|
|
175692
|
-
import path21 from "path";
|
|
175693
|
-
var MASSA_AI_READ_FILE_MAX_LINES = (() => {
|
|
175694
|
-
const v = Number(process.env.MASSA_AI_READ_FILE_MAX_LINES);
|
|
175695
|
-
return Number.isFinite(v) && v > 0 ? Math.floor(v) : 500;
|
|
175696
|
-
})();
|
|
175697
175796
|
|
|
175698
|
-
class
|
|
175699
|
-
|
|
175700
|
-
description = "Read file with automatic compression, caching, and symbol metadata. " + "Use with search results for 60% token savings.";
|
|
175701
|
-
inputSchema = {
|
|
175702
|
-
type: "object",
|
|
175703
|
-
properties: {
|
|
175704
|
-
filePath: {
|
|
175705
|
-
type: "string",
|
|
175706
|
-
description: "File path (absolute or relative to project root)"
|
|
175707
|
-
},
|
|
175708
|
-
projectId: {
|
|
175709
|
-
type: "string",
|
|
175710
|
-
description: "Project ID for symbol metadata (optional)"
|
|
175711
|
-
},
|
|
175712
|
-
offset: {
|
|
175713
|
-
type: "number",
|
|
175714
|
-
description: "Start line number (1-indexed)"
|
|
175715
|
-
},
|
|
175716
|
-
limit: {
|
|
175717
|
-
type: "number",
|
|
175718
|
-
description: "Number of lines to read"
|
|
175719
|
-
},
|
|
175720
|
-
lineStart: {
|
|
175721
|
-
type: "number",
|
|
175722
|
-
description: "Start line (alternative to offset)"
|
|
175723
|
-
},
|
|
175724
|
-
lineEnd: {
|
|
175725
|
-
type: "number",
|
|
175726
|
-
description: "End line (alternative to limit)"
|
|
175727
|
-
},
|
|
175728
|
-
compress: {
|
|
175729
|
-
type: "boolean",
|
|
175730
|
-
description: "Auto-compress content > 100 lines (default: true)",
|
|
175731
|
-
default: true
|
|
175732
|
-
},
|
|
175733
|
-
targetRatio: {
|
|
175734
|
-
type: "number",
|
|
175735
|
-
description: "Compression target ratio (0.3 = 70% reduction)",
|
|
175736
|
-
default: 0.3
|
|
175737
|
-
},
|
|
175738
|
-
format: {
|
|
175739
|
-
type: "string",
|
|
175740
|
-
enum: ["json", "toon"],
|
|
175741
|
-
description: "Output format",
|
|
175742
|
-
default: "json"
|
|
175743
|
-
},
|
|
175744
|
-
fields: {
|
|
175745
|
-
type: "array",
|
|
175746
|
-
items: { type: "string" },
|
|
175747
|
-
description: "Projection \u2014 keep only these keys (dotted paths supported, e.g. ['nodes.symbol']). Absent/empty \u2192 full data."
|
|
175748
|
-
},
|
|
175749
|
-
includeSymbols: {
|
|
175750
|
-
type: "boolean",
|
|
175751
|
-
description: "Include symbol metadata from graph (default: true)",
|
|
175752
|
-
default: true
|
|
175753
|
-
},
|
|
175754
|
-
includeImports: {
|
|
175755
|
-
type: "boolean",
|
|
175756
|
-
description: "Extract and show import statements (default: true)",
|
|
175757
|
-
default: true
|
|
175758
|
-
}
|
|
175759
|
-
},
|
|
175760
|
-
required: ["filePath"]
|
|
175761
|
-
};
|
|
175762
|
-
compressor;
|
|
175763
|
-
symbolGraph;
|
|
175797
|
+
class FileContentCache {
|
|
175798
|
+
extractMetadata;
|
|
175764
175799
|
fileCache = new Map;
|
|
175765
|
-
projectRootCache = new Map;
|
|
175766
175800
|
CACHE_TTL = 60000;
|
|
175767
|
-
ROOT_CACHE_TTL = 300000;
|
|
175768
175801
|
FILE_CACHE_MAX_ENTRIES = 512;
|
|
175769
|
-
constructor(
|
|
175770
|
-
this.
|
|
175771
|
-
this.symbolGraph = symbolGraph;
|
|
175772
|
-
eventBus.subscribe("indexing:started", ({ projectId, projectPath: projectPath2 }) => {
|
|
175773
|
-
this.projectRootCache.delete(projectId);
|
|
175774
|
-
this.evictOldest(this.projectRootCache);
|
|
175775
|
-
this.projectRootCache.set(projectId, projectPath2);
|
|
175776
|
-
});
|
|
175777
|
-
}
|
|
175778
|
-
async handle(params) {
|
|
175779
|
-
const p = params;
|
|
175780
|
-
const shouldCompress = p.compress !== false;
|
|
175781
|
-
const targetRatio = p.targetRatio || 0.3;
|
|
175782
|
-
const format = p.format || "json";
|
|
175783
|
-
const { fields } = p;
|
|
175784
|
-
const includeSymbols = p.includeSymbols !== false;
|
|
175785
|
-
const includeImports = p.includeImports !== false;
|
|
175786
|
-
try {
|
|
175787
|
-
const resolved = await this.resolveFilePath(p.filePath, p.projectId);
|
|
175788
|
-
if (resolved === null) {
|
|
175789
|
-
return {
|
|
175790
|
-
success: false,
|
|
175791
|
-
error: "Relative filePath requires a projectId (to resolve against the workspace) or an absolute path."
|
|
175792
|
-
};
|
|
175793
|
-
}
|
|
175794
|
-
const filePath = resolved;
|
|
175795
|
-
const containment = await this.checkPathContainment(filePath, p.projectId);
|
|
175796
|
-
if (!containment.allowed) {
|
|
175797
|
-
return {
|
|
175798
|
-
success: false,
|
|
175799
|
-
error: containment.error
|
|
175800
|
-
};
|
|
175801
|
-
}
|
|
175802
|
-
const relativePath = p.filePath;
|
|
175803
|
-
const range = this.calculateRange(p);
|
|
175804
|
-
const { content, metadata } = await this.readFileWithCache(filePath, {
|
|
175805
|
-
includeSymbols,
|
|
175806
|
-
includeImports,
|
|
175807
|
-
projectId: p.projectId,
|
|
175808
|
-
relativePath
|
|
175809
|
-
});
|
|
175810
|
-
const lines = content.split(`
|
|
175811
|
-
`);
|
|
175812
|
-
const totalLines = lines.length;
|
|
175813
|
-
const adjustedRange = this.adjustRange(range, totalLines);
|
|
175814
|
-
let selectedContent = this.extractLines(lines, adjustedRange);
|
|
175815
|
-
let selectedLineCount = selectedContent.split(`
|
|
175816
|
-
`).length;
|
|
175817
|
-
let source_clipped = false;
|
|
175818
|
-
if (selectedLineCount > MASSA_AI_READ_FILE_MAX_LINES) {
|
|
175819
|
-
const cappedLines = lines.slice(adjustedRange.start - 1, adjustedRange.start - 1 + MASSA_AI_READ_FILE_MAX_LINES);
|
|
175820
|
-
selectedContent = cappedLines.join(`
|
|
175821
|
-
`);
|
|
175822
|
-
selectedLineCount = selectedContent.split(`
|
|
175823
|
-
`).length;
|
|
175824
|
-
source_clipped = true;
|
|
175825
|
-
}
|
|
175826
|
-
const shouldAutoCompress = shouldCompress && selectedLineCount > 100 && targetRatio < 1;
|
|
175827
|
-
const result = {
|
|
175828
|
-
filePath: p.filePath,
|
|
175829
|
-
absolutePath: filePath,
|
|
175830
|
-
lineRange: {
|
|
175831
|
-
requested: {
|
|
175832
|
-
start: range.start,
|
|
175833
|
-
end: range.end === Infinity ? null : range.end
|
|
175834
|
-
},
|
|
175835
|
-
actual: {
|
|
175836
|
-
start: adjustedRange.start,
|
|
175837
|
-
end: source_clipped ? adjustedRange.start + selectedLineCount - 1 : adjustedRange.end,
|
|
175838
|
-
total: totalLines
|
|
175839
|
-
},
|
|
175840
|
-
selected: selectedLineCount
|
|
175841
|
-
},
|
|
175842
|
-
source_clipped,
|
|
175843
|
-
metadata: {
|
|
175844
|
-
totalLines,
|
|
175845
|
-
language: metadata.language,
|
|
175846
|
-
...metadata.symbols && { symbols: metadata.symbols },
|
|
175847
|
-
...metadata.imports && { imports: metadata.imports }
|
|
175848
|
-
},
|
|
175849
|
-
compressed: shouldAutoCompress,
|
|
175850
|
-
recommendations: []
|
|
175851
|
-
};
|
|
175852
|
-
if (shouldAutoCompress) {
|
|
175853
|
-
const compressed = await this.compressor.compress(selectedContent, "code_structure");
|
|
175854
|
-
const originalTokens = estimateTokens(selectedContent, "code");
|
|
175855
|
-
const compressedTokens = estimateTokens(compressed.compressed, "code");
|
|
175856
|
-
const actualRatio = compressedTokens / originalTokens;
|
|
175857
|
-
result.content = compressed.compressed;
|
|
175858
|
-
result.tokens = {
|
|
175859
|
-
original: originalTokens,
|
|
175860
|
-
compressed: compressedTokens,
|
|
175861
|
-
saved: originalTokens - compressedTokens,
|
|
175862
|
-
savingsPercent: Math.round((1 - actualRatio) * 100)
|
|
175863
|
-
};
|
|
175864
|
-
result.compressionRatio = actualRatio;
|
|
175865
|
-
result.recommendations.push(`\u2713 Auto-compressed ${selectedLineCount} lines (${result.tokens.savingsPercent}% reduction)`);
|
|
175866
|
-
} else {
|
|
175867
|
-
result.content = selectedContent;
|
|
175868
|
-
result.tokens = {
|
|
175869
|
-
original: estimateTokens(selectedContent, "code"),
|
|
175870
|
-
compressed: estimateTokens(selectedContent, "code"),
|
|
175871
|
-
saved: 0,
|
|
175872
|
-
savingsPercent: 0
|
|
175873
|
-
};
|
|
175874
|
-
if (selectedLineCount > 100) {
|
|
175875
|
-
result.recommendations.push("\uD83D\uDCA1 Content > 100 lines. Consider compress=true for token savings");
|
|
175876
|
-
}
|
|
175877
|
-
}
|
|
175878
|
-
if (range.start === 1 && range.end === Infinity) {
|
|
175879
|
-
result.recommendations.push("\uD83D\uDCA1 Use lineStart/lineEnd or offset/limit to read specific sections (60% token savings)");
|
|
175880
|
-
}
|
|
175881
|
-
if (metadata.symbols && metadata.symbols.definitions > 0) {
|
|
175882
|
-
result.recommendations.push(`\uD83D\uDCA1 Use get_references() to find usages of ${metadata.symbols.definitions} symbols in this file`);
|
|
175883
|
-
}
|
|
175884
|
-
return serializeToolResponse(result, { format, fields });
|
|
175885
|
-
} catch (error51) {
|
|
175886
|
-
logger.error("Failed to read file", error51, {
|
|
175887
|
-
filePath: p.filePath
|
|
175888
|
-
});
|
|
175889
|
-
return {
|
|
175890
|
-
success: false,
|
|
175891
|
-
error: `Failed to read file: ${error51.message}`
|
|
175892
|
-
};
|
|
175893
|
-
}
|
|
175894
|
-
}
|
|
175895
|
-
async resolveFilePath(filePath, projectId) {
|
|
175896
|
-
if (path21.isAbsolute(filePath)) {
|
|
175897
|
-
return path21.resolve(filePath);
|
|
175898
|
-
}
|
|
175899
|
-
if (projectId) {
|
|
175900
|
-
const root = await this.getProjectRoot(projectId);
|
|
175901
|
-
if (root) {
|
|
175902
|
-
const cleaned = sanitizeFilePath(filePath);
|
|
175903
|
-
return path21.resolve(root, cleaned);
|
|
175904
|
-
}
|
|
175905
|
-
return null;
|
|
175906
|
-
}
|
|
175907
|
-
return null;
|
|
175908
|
-
}
|
|
175909
|
-
async checkPathContainment(absoluteFilePath, projectId) {
|
|
175910
|
-
const roots = [];
|
|
175911
|
-
if (projectId) {
|
|
175912
|
-
const root = await this.getProjectRoot(projectId);
|
|
175913
|
-
if (root)
|
|
175914
|
-
roots.push(path21.resolve(root));
|
|
175915
|
-
}
|
|
175916
|
-
roots.push(path21.resolve(process.cwd()));
|
|
175917
|
-
const envRoots = (process.env.MASSA_AI_READ_FILE_ROOTS ?? "").split(":").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
175918
|
-
for (const extra of envRoots) {
|
|
175919
|
-
roots.push(path21.resolve(extra));
|
|
175920
|
-
}
|
|
175921
|
-
const target = path21.resolve(absoluteFilePath);
|
|
175922
|
-
for (const root of roots) {
|
|
175923
|
-
const rel = path21.relative(root, target);
|
|
175924
|
-
if (rel !== "" && !rel.startsWith("..") && !path21.isAbsolute(rel)) {
|
|
175925
|
-
return { allowed: true };
|
|
175926
|
-
}
|
|
175927
|
-
if (rel === "")
|
|
175928
|
-
return { allowed: true };
|
|
175929
|
-
}
|
|
175930
|
-
const validRootsList = roots.map((r2) => ` - ${r2}`).join(`
|
|
175931
|
-
`);
|
|
175932
|
-
return {
|
|
175933
|
-
allowed: false,
|
|
175934
|
-
error: `read_file path containment: "${target}" is outside the allowed roots.
|
|
175935
|
-
` + `Valid roots (project root + cwd + MASSA_AI_READ_FILE_ROOTS):
|
|
175936
|
-
${validRootsList}
|
|
175937
|
-
` + `Provide a filePath that resolves under one of these roots.`
|
|
175938
|
-
};
|
|
175939
|
-
}
|
|
175940
|
-
async getProjectRoot(projectId) {
|
|
175941
|
-
const cached2 = this.projectRootCache.get(projectId);
|
|
175942
|
-
if (cached2 !== undefined) {
|
|
175943
|
-
this.projectRootCache.delete(projectId);
|
|
175944
|
-
this.projectRootCache.set(projectId, cached2);
|
|
175945
|
-
return cached2;
|
|
175946
|
-
}
|
|
175947
|
-
try {
|
|
175948
|
-
const workspace = await workspaceManager.getWorkspace(projectId);
|
|
175949
|
-
if (workspace?.project_path) {
|
|
175950
|
-
this.evictOldest(this.projectRootCache);
|
|
175951
|
-
this.projectRootCache.set(projectId, workspace.project_path);
|
|
175952
|
-
return workspace.project_path;
|
|
175953
|
-
}
|
|
175954
|
-
} catch (error51) {
|
|
175955
|
-
logger.warn("Failed to look up project root", { projectId, error: error51.message });
|
|
175956
|
-
}
|
|
175957
|
-
return null;
|
|
175958
|
-
}
|
|
175959
|
-
evictOldest(cache) {
|
|
175960
|
-
while (cache.size >= this.FILE_CACHE_MAX_ENTRIES) {
|
|
175961
|
-
const oldest = cache.keys().next().value;
|
|
175962
|
-
if (oldest === undefined)
|
|
175963
|
-
break;
|
|
175964
|
-
cache.delete(oldest);
|
|
175965
|
-
}
|
|
175966
|
-
}
|
|
175967
|
-
calculateRange(params) {
|
|
175968
|
-
if (params.lineStart !== undefined && params.lineEnd !== undefined) {
|
|
175969
|
-
return {
|
|
175970
|
-
start: Math.max(1, params.lineStart),
|
|
175971
|
-
end: params.lineEnd
|
|
175972
|
-
};
|
|
175973
|
-
}
|
|
175974
|
-
if (params.offset !== undefined) {
|
|
175975
|
-
const offset = Math.max(1, params.offset);
|
|
175976
|
-
const limit = params.limit || 1000;
|
|
175977
|
-
return {
|
|
175978
|
-
start: offset,
|
|
175979
|
-
end: offset + limit - 1
|
|
175980
|
-
};
|
|
175981
|
-
}
|
|
175982
|
-
return {
|
|
175983
|
-
start: 1,
|
|
175984
|
-
end: Infinity
|
|
175985
|
-
};
|
|
175986
|
-
}
|
|
175987
|
-
adjustRange(range, totalLines) {
|
|
175988
|
-
const start = Math.max(1, Math.min(range.start, totalLines));
|
|
175989
|
-
const end = range.end === Infinity ? totalLines : Math.min(range.end, totalLines);
|
|
175990
|
-
return { start, end };
|
|
175802
|
+
constructor(extractMetadata) {
|
|
175803
|
+
this.extractMetadata = extractMetadata;
|
|
175991
175804
|
}
|
|
175992
175805
|
async readFileWithCache(filePath, options) {
|
|
175993
175806
|
const cacheKey = JSON.stringify({
|
|
@@ -176014,7 +175827,7 @@ ${validRootsList}
|
|
|
176014
175827
|
}
|
|
176015
175828
|
const content = await fs11.readFile(filePath, "utf-8");
|
|
176016
175829
|
const metadata = await this.extractMetadata(content, filePath, options);
|
|
176017
|
-
|
|
175830
|
+
evictOldest(this.fileCache, this.FILE_CACHE_MAX_ENTRIES - 1);
|
|
176018
175831
|
this.fileCache.set(cacheKey, {
|
|
176019
175832
|
content,
|
|
176020
175833
|
timestamp: Date.now(),
|
|
@@ -176023,6 +175836,17 @@ ${validRootsList}
|
|
|
176023
175836
|
logger.debug("File read and cached", { filePath });
|
|
176024
175837
|
return { content, metadata };
|
|
176025
175838
|
}
|
|
175839
|
+
}
|
|
175840
|
+
|
|
175841
|
+
// ../../packages/core/dist/services/file-read/file-metadata.js
|
|
175842
|
+
init_dist();
|
|
175843
|
+
import path22 from "path";
|
|
175844
|
+
|
|
175845
|
+
class FileMetadataExtractor {
|
|
175846
|
+
symbolGraph;
|
|
175847
|
+
constructor(symbolGraph) {
|
|
175848
|
+
this.symbolGraph = symbolGraph;
|
|
175849
|
+
}
|
|
176026
175850
|
async extractMetadata(content, filePath, options) {
|
|
176027
175851
|
const lines = content.split(`
|
|
176028
175852
|
`);
|
|
@@ -176051,18 +175875,8 @@ ${validRootsList}
|
|
|
176051
175875
|
}
|
|
176052
175876
|
return metadata;
|
|
176053
175877
|
}
|
|
176054
|
-
extractLines(lines, range) {
|
|
176055
|
-
const start = range.start - 1;
|
|
176056
|
-
const end = range.end;
|
|
176057
|
-
const selectedLines = lines.slice(start, end);
|
|
176058
|
-
return selectedLines.map((line, index) => {
|
|
176059
|
-
const lineNum = start + index + 1;
|
|
176060
|
-
return `${lineNum.toString().padStart(6, " ")}: ${line}`;
|
|
176061
|
-
}).join(`
|
|
176062
|
-
`);
|
|
176063
|
-
}
|
|
176064
175878
|
detectLanguage(filePath) {
|
|
176065
|
-
const ext2 =
|
|
175879
|
+
const ext2 = path22.extname(filePath).toLowerCase();
|
|
176066
175880
|
const languageMap2 = {
|
|
176067
175881
|
".ts": "TypeScript",
|
|
176068
175882
|
".tsx": "TypeScript",
|
|
@@ -176120,6 +175934,366 @@ ${validRootsList}
|
|
|
176120
175934
|
return imports;
|
|
176121
175935
|
}
|
|
176122
175936
|
}
|
|
175937
|
+
|
|
175938
|
+
// ../../packages/core/dist/services/file-read/line-range.js
|
|
175939
|
+
var MASSA_AI_READ_FILE_MAX_LINES = (() => {
|
|
175940
|
+
const v = Number(process.env.MASSA_AI_READ_FILE_MAX_LINES);
|
|
175941
|
+
return Number.isFinite(v) && v > 0 ? Math.floor(v) : 500;
|
|
175942
|
+
})();
|
|
175943
|
+
function calculateRange(params) {
|
|
175944
|
+
if (params.lineStart !== undefined && params.lineEnd !== undefined) {
|
|
175945
|
+
return {
|
|
175946
|
+
start: Math.max(1, params.lineStart),
|
|
175947
|
+
end: params.lineEnd
|
|
175948
|
+
};
|
|
175949
|
+
}
|
|
175950
|
+
if (params.offset !== undefined) {
|
|
175951
|
+
const offset = Math.max(1, params.offset);
|
|
175952
|
+
const limit = params.limit || 1000;
|
|
175953
|
+
return {
|
|
175954
|
+
start: offset,
|
|
175955
|
+
end: offset + limit - 1
|
|
175956
|
+
};
|
|
175957
|
+
}
|
|
175958
|
+
return {
|
|
175959
|
+
start: 1,
|
|
175960
|
+
end: Infinity
|
|
175961
|
+
};
|
|
175962
|
+
}
|
|
175963
|
+
function adjustRange(range, totalLines) {
|
|
175964
|
+
const start = Math.max(1, Math.min(range.start, totalLines));
|
|
175965
|
+
const end = range.end === Infinity ? totalLines : Math.min(range.end, totalLines);
|
|
175966
|
+
return { start, end };
|
|
175967
|
+
}
|
|
175968
|
+
function extractLines(lines, range) {
|
|
175969
|
+
const start = range.start - 1;
|
|
175970
|
+
const end = range.end;
|
|
175971
|
+
const selectedLines = lines.slice(start, end);
|
|
175972
|
+
return selectedLines.map((line, index) => {
|
|
175973
|
+
const lineNum = start + index + 1;
|
|
175974
|
+
return `${lineNum.toString().padStart(6, " ")}: ${line}`;
|
|
175975
|
+
}).join(`
|
|
175976
|
+
`);
|
|
175977
|
+
}
|
|
175978
|
+
function selectLines(lines, range) {
|
|
175979
|
+
let content = extractLines(lines, range);
|
|
175980
|
+
let lineCount = content.split(`
|
|
175981
|
+
`).length;
|
|
175982
|
+
let clipped = false;
|
|
175983
|
+
if (lineCount > MASSA_AI_READ_FILE_MAX_LINES) {
|
|
175984
|
+
const cappedLines = lines.slice(range.start - 1, range.start - 1 + MASSA_AI_READ_FILE_MAX_LINES);
|
|
175985
|
+
content = cappedLines.join(`
|
|
175986
|
+
`);
|
|
175987
|
+
lineCount = content.split(`
|
|
175988
|
+
`).length;
|
|
175989
|
+
clipped = true;
|
|
175990
|
+
}
|
|
175991
|
+
return { content, lineCount, clipped };
|
|
175992
|
+
}
|
|
175993
|
+
|
|
175994
|
+
// ../../packages/core/dist/services/file-read/path-containment.js
|
|
175995
|
+
init_dist();
|
|
175996
|
+
import path23 from "path";
|
|
175997
|
+
|
|
175998
|
+
class PathContainment {
|
|
175999
|
+
projectRoots;
|
|
176000
|
+
constructor(projectRoots) {
|
|
176001
|
+
this.projectRoots = projectRoots;
|
|
176002
|
+
}
|
|
176003
|
+
async resolveFilePath(filePath, projectId) {
|
|
176004
|
+
if (path23.isAbsolute(filePath)) {
|
|
176005
|
+
return path23.resolve(filePath);
|
|
176006
|
+
}
|
|
176007
|
+
if (projectId) {
|
|
176008
|
+
const root = await this.projectRoots.getProjectRoot(projectId);
|
|
176009
|
+
if (root) {
|
|
176010
|
+
const cleaned = sanitizeFilePath(filePath);
|
|
176011
|
+
return path23.resolve(root, cleaned);
|
|
176012
|
+
}
|
|
176013
|
+
return null;
|
|
176014
|
+
}
|
|
176015
|
+
return null;
|
|
176016
|
+
}
|
|
176017
|
+
async checkPathContainment(absoluteFilePath, projectId) {
|
|
176018
|
+
const roots = [];
|
|
176019
|
+
if (projectId) {
|
|
176020
|
+
const root = await this.projectRoots.getProjectRoot(projectId);
|
|
176021
|
+
if (root)
|
|
176022
|
+
roots.push(path23.resolve(root));
|
|
176023
|
+
}
|
|
176024
|
+
roots.push(path23.resolve(process.cwd()));
|
|
176025
|
+
const envRoots = (process.env.MASSA_AI_READ_FILE_ROOTS ?? "").split(":").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
176026
|
+
for (const extra of envRoots) {
|
|
176027
|
+
roots.push(path23.resolve(extra));
|
|
176028
|
+
}
|
|
176029
|
+
const target = path23.resolve(absoluteFilePath);
|
|
176030
|
+
for (const root of roots) {
|
|
176031
|
+
const rel = path23.relative(root, target);
|
|
176032
|
+
if (rel !== "" && !rel.startsWith("..") && !path23.isAbsolute(rel)) {
|
|
176033
|
+
return { allowed: true };
|
|
176034
|
+
}
|
|
176035
|
+
if (rel === "")
|
|
176036
|
+
return { allowed: true };
|
|
176037
|
+
}
|
|
176038
|
+
const validRootsList = roots.map((r2) => ` - ${r2}`).join(`
|
|
176039
|
+
`);
|
|
176040
|
+
return {
|
|
176041
|
+
allowed: false,
|
|
176042
|
+
error: `read_file path containment: "${target}" is outside the allowed roots.
|
|
176043
|
+
` + `Valid roots (project root + cwd + MASSA_AI_READ_FILE_ROOTS):
|
|
176044
|
+
${validRootsList}
|
|
176045
|
+
` + `Provide a filePath that resolves under one of these roots.`
|
|
176046
|
+
};
|
|
176047
|
+
}
|
|
176048
|
+
}
|
|
176049
|
+
|
|
176050
|
+
// ../../packages/core/dist/services/file-read/project-root-cache.js
|
|
176051
|
+
init_dist();
|
|
176052
|
+
init_event_bus();
|
|
176053
|
+
init_workspace_manager();
|
|
176054
|
+
|
|
176055
|
+
class ProjectRootCache {
|
|
176056
|
+
projectRootCache = new Map;
|
|
176057
|
+
ROOT_CACHE_TTL = 300000;
|
|
176058
|
+
PROJECT_ROOT_CACHE_MAX_ENTRIES = 512;
|
|
176059
|
+
constructor() {
|
|
176060
|
+
eventBus.subscribe("indexing:started", ({ projectId, projectPath: projectPath2 }) => {
|
|
176061
|
+
this.projectRootCache.delete(projectId);
|
|
176062
|
+
evictOldest(this.projectRootCache, this.PROJECT_ROOT_CACHE_MAX_ENTRIES - 1);
|
|
176063
|
+
this.projectRootCache.set(projectId, projectPath2);
|
|
176064
|
+
});
|
|
176065
|
+
}
|
|
176066
|
+
async getProjectRoot(projectId) {
|
|
176067
|
+
const cached2 = this.projectRootCache.get(projectId);
|
|
176068
|
+
if (cached2 !== undefined) {
|
|
176069
|
+
this.projectRootCache.delete(projectId);
|
|
176070
|
+
this.projectRootCache.set(projectId, cached2);
|
|
176071
|
+
return cached2;
|
|
176072
|
+
}
|
|
176073
|
+
try {
|
|
176074
|
+
const workspace = await workspaceManager.getWorkspace(projectId);
|
|
176075
|
+
if (workspace?.project_path) {
|
|
176076
|
+
evictOldest(this.projectRootCache, this.PROJECT_ROOT_CACHE_MAX_ENTRIES - 1);
|
|
176077
|
+
this.projectRootCache.set(projectId, workspace.project_path);
|
|
176078
|
+
return workspace.project_path;
|
|
176079
|
+
}
|
|
176080
|
+
} catch (error51) {
|
|
176081
|
+
logger.warn("Failed to look up project root", { projectId, error: error51.message });
|
|
176082
|
+
}
|
|
176083
|
+
return null;
|
|
176084
|
+
}
|
|
176085
|
+
}
|
|
176086
|
+
|
|
176087
|
+
// ../../packages/core/dist/services/file-read/read-file.service.js
|
|
176088
|
+
function readFileOptions(p) {
|
|
176089
|
+
const shouldCompress = p.compress !== false;
|
|
176090
|
+
const targetRatio = p.targetRatio || 0.3;
|
|
176091
|
+
const format = p.format || "json";
|
|
176092
|
+
const { fields } = p;
|
|
176093
|
+
const includeSymbols = p.includeSymbols !== false;
|
|
176094
|
+
const includeImports = p.includeImports !== false;
|
|
176095
|
+
return { shouldCompress, targetRatio, format, fields, includeSymbols, includeImports };
|
|
176096
|
+
}
|
|
176097
|
+
|
|
176098
|
+
class ReadFileService {
|
|
176099
|
+
compressor;
|
|
176100
|
+
symbolGraph;
|
|
176101
|
+
projectRoots;
|
|
176102
|
+
pathContainment;
|
|
176103
|
+
fileMetadata;
|
|
176104
|
+
fileContent;
|
|
176105
|
+
constructor(symbolGraph) {
|
|
176106
|
+
this.compressor = new CodeCompressor;
|
|
176107
|
+
this.symbolGraph = symbolGraph;
|
|
176108
|
+
this.projectRoots = new ProjectRootCache;
|
|
176109
|
+
this.pathContainment = new PathContainment(this.projectRoots);
|
|
176110
|
+
this.fileMetadata = new FileMetadataExtractor(symbolGraph);
|
|
176111
|
+
this.fileContent = new FileContentCache((content, filePath, options) => this.fileMetadata.extractMetadata(content, filePath, options));
|
|
176112
|
+
}
|
|
176113
|
+
async read(p, options) {
|
|
176114
|
+
const { shouldCompress, targetRatio, includeSymbols, includeImports } = options;
|
|
176115
|
+
const resolved = await this.pathContainment.resolveFilePath(p.filePath, p.projectId);
|
|
176116
|
+
if (resolved === null) {
|
|
176117
|
+
return {
|
|
176118
|
+
ok: false,
|
|
176119
|
+
error: "Relative filePath requires a projectId (to resolve against the workspace) or an absolute path."
|
|
176120
|
+
};
|
|
176121
|
+
}
|
|
176122
|
+
const filePath = resolved;
|
|
176123
|
+
const containment = await this.pathContainment.checkPathContainment(filePath, p.projectId);
|
|
176124
|
+
if (!containment.allowed) {
|
|
176125
|
+
return {
|
|
176126
|
+
ok: false,
|
|
176127
|
+
error: containment.error
|
|
176128
|
+
};
|
|
176129
|
+
}
|
|
176130
|
+
const relativePath = p.filePath;
|
|
176131
|
+
const range = calculateRange(p);
|
|
176132
|
+
const { content, metadata } = await this.fileContent.readFileWithCache(filePath, {
|
|
176133
|
+
includeSymbols,
|
|
176134
|
+
includeImports,
|
|
176135
|
+
projectId: p.projectId,
|
|
176136
|
+
relativePath
|
|
176137
|
+
});
|
|
176138
|
+
const lines = content.split(`
|
|
176139
|
+
`);
|
|
176140
|
+
const totalLines = lines.length;
|
|
176141
|
+
const adjustedRange = adjustRange(range, totalLines);
|
|
176142
|
+
const { content: selectedContent, lineCount: selectedLineCount, clipped: source_clipped } = selectLines(lines, adjustedRange);
|
|
176143
|
+
const shouldAutoCompress = shouldCompress && selectedLineCount > 100 && targetRatio < 1;
|
|
176144
|
+
const result = {
|
|
176145
|
+
filePath: p.filePath,
|
|
176146
|
+
absolutePath: filePath,
|
|
176147
|
+
lineRange: {
|
|
176148
|
+
requested: {
|
|
176149
|
+
start: range.start,
|
|
176150
|
+
end: range.end === Infinity ? null : range.end
|
|
176151
|
+
},
|
|
176152
|
+
actual: {
|
|
176153
|
+
start: adjustedRange.start,
|
|
176154
|
+
end: source_clipped ? adjustedRange.start + selectedLineCount - 1 : adjustedRange.end,
|
|
176155
|
+
total: totalLines
|
|
176156
|
+
},
|
|
176157
|
+
selected: selectedLineCount
|
|
176158
|
+
},
|
|
176159
|
+
source_clipped,
|
|
176160
|
+
metadata: {
|
|
176161
|
+
totalLines,
|
|
176162
|
+
language: metadata.language,
|
|
176163
|
+
...metadata.symbols && { symbols: metadata.symbols },
|
|
176164
|
+
...metadata.imports && { imports: metadata.imports }
|
|
176165
|
+
},
|
|
176166
|
+
compressed: shouldAutoCompress,
|
|
176167
|
+
recommendations: []
|
|
176168
|
+
};
|
|
176169
|
+
if (shouldAutoCompress) {
|
|
176170
|
+
const compressed = await this.compressor.compress(selectedContent, "code_structure");
|
|
176171
|
+
const originalTokens = estimateTokens(selectedContent, "code");
|
|
176172
|
+
const compressedTokens = estimateTokens(compressed.compressed, "code");
|
|
176173
|
+
const actualRatio = compressedTokens / originalTokens;
|
|
176174
|
+
result.content = compressed.compressed;
|
|
176175
|
+
result.tokens = {
|
|
176176
|
+
original: originalTokens,
|
|
176177
|
+
compressed: compressedTokens,
|
|
176178
|
+
saved: originalTokens - compressedTokens,
|
|
176179
|
+
savingsPercent: Math.round((1 - actualRatio) * 100)
|
|
176180
|
+
};
|
|
176181
|
+
result.compressionRatio = actualRatio;
|
|
176182
|
+
result.recommendations.push(`\u2713 Auto-compressed ${selectedLineCount} lines (${result.tokens.savingsPercent}% reduction)`);
|
|
176183
|
+
} else {
|
|
176184
|
+
result.content = selectedContent;
|
|
176185
|
+
result.tokens = {
|
|
176186
|
+
original: estimateTokens(selectedContent, "code"),
|
|
176187
|
+
compressed: estimateTokens(selectedContent, "code"),
|
|
176188
|
+
saved: 0,
|
|
176189
|
+
savingsPercent: 0
|
|
176190
|
+
};
|
|
176191
|
+
if (selectedLineCount > 100) {
|
|
176192
|
+
result.recommendations.push("\uD83D\uDCA1 Content > 100 lines. Consider compress=true for token savings");
|
|
176193
|
+
}
|
|
176194
|
+
}
|
|
176195
|
+
if (range.start === 1 && range.end === Infinity) {
|
|
176196
|
+
result.recommendations.push("\uD83D\uDCA1 Use lineStart/lineEnd or offset/limit to read specific sections (60% token savings)");
|
|
176197
|
+
}
|
|
176198
|
+
if (metadata.symbols && metadata.symbols.definitions > 0) {
|
|
176199
|
+
result.recommendations.push(`\uD83D\uDCA1 Use get_references() to find usages of ${metadata.symbols.definitions} symbols in this file`);
|
|
176200
|
+
}
|
|
176201
|
+
return { ok: true, data: result };
|
|
176202
|
+
}
|
|
176203
|
+
}
|
|
176204
|
+
|
|
176205
|
+
// ../../packages/core/dist/tools/read_file.js
|
|
176206
|
+
class ReadFileTool {
|
|
176207
|
+
name = "read_file";
|
|
176208
|
+
description = "Read file with automatic compression, caching, and symbol metadata. " + "Use with search results for 60% token savings.";
|
|
176209
|
+
inputSchema = {
|
|
176210
|
+
type: "object",
|
|
176211
|
+
properties: {
|
|
176212
|
+
filePath: {
|
|
176213
|
+
type: "string",
|
|
176214
|
+
description: "File path (absolute or relative to project root)"
|
|
176215
|
+
},
|
|
176216
|
+
projectId: {
|
|
176217
|
+
type: "string",
|
|
176218
|
+
description: "Project ID for symbol metadata (optional)"
|
|
176219
|
+
},
|
|
176220
|
+
offset: {
|
|
176221
|
+
type: "number",
|
|
176222
|
+
description: "Start line number (1-indexed)"
|
|
176223
|
+
},
|
|
176224
|
+
limit: {
|
|
176225
|
+
type: "number",
|
|
176226
|
+
description: "Number of lines to read"
|
|
176227
|
+
},
|
|
176228
|
+
lineStart: {
|
|
176229
|
+
type: "number",
|
|
176230
|
+
description: "Start line (alternative to offset)"
|
|
176231
|
+
},
|
|
176232
|
+
lineEnd: {
|
|
176233
|
+
type: "number",
|
|
176234
|
+
description: "End line (alternative to limit)"
|
|
176235
|
+
},
|
|
176236
|
+
compress: {
|
|
176237
|
+
type: "boolean",
|
|
176238
|
+
description: "Auto-compress content > 100 lines (default: true)",
|
|
176239
|
+
default: true
|
|
176240
|
+
},
|
|
176241
|
+
targetRatio: {
|
|
176242
|
+
type: "number",
|
|
176243
|
+
description: "Compression target ratio (0.3 = 70% reduction)",
|
|
176244
|
+
default: 0.3
|
|
176245
|
+
},
|
|
176246
|
+
format: {
|
|
176247
|
+
type: "string",
|
|
176248
|
+
enum: ["json", "toon"],
|
|
176249
|
+
description: "Output format",
|
|
176250
|
+
default: "json"
|
|
176251
|
+
},
|
|
176252
|
+
fields: {
|
|
176253
|
+
type: "array",
|
|
176254
|
+
items: { type: "string" },
|
|
176255
|
+
description: "Projection \u2014 keep only these keys (dotted paths supported, e.g. ['nodes.symbol']). Absent/empty \u2192 full data."
|
|
176256
|
+
},
|
|
176257
|
+
includeSymbols: {
|
|
176258
|
+
type: "boolean",
|
|
176259
|
+
description: "Include symbol metadata from graph (default: true)",
|
|
176260
|
+
default: true
|
|
176261
|
+
},
|
|
176262
|
+
includeImports: {
|
|
176263
|
+
type: "boolean",
|
|
176264
|
+
description: "Extract and show import statements (default: true)",
|
|
176265
|
+
default: true
|
|
176266
|
+
}
|
|
176267
|
+
},
|
|
176268
|
+
required: ["filePath"]
|
|
176269
|
+
};
|
|
176270
|
+
service;
|
|
176271
|
+
constructor(symbolGraph) {
|
|
176272
|
+
this.service = new ReadFileService(symbolGraph);
|
|
176273
|
+
}
|
|
176274
|
+
async handle(params) {
|
|
176275
|
+
const p = params;
|
|
176276
|
+
const options = readFileOptions(p);
|
|
176277
|
+
try {
|
|
176278
|
+
const outcome2 = await this.service.read(p, options);
|
|
176279
|
+
if (!outcome2.ok) {
|
|
176280
|
+
return { success: false, error: outcome2.error };
|
|
176281
|
+
}
|
|
176282
|
+
return serializeToolResponse(outcome2.data, {
|
|
176283
|
+
format: options.format,
|
|
176284
|
+
fields: options.fields
|
|
176285
|
+
});
|
|
176286
|
+
} catch (error51) {
|
|
176287
|
+
logger.error("Failed to read file", error51, {
|
|
176288
|
+
filePath: p.filePath
|
|
176289
|
+
});
|
|
176290
|
+
return {
|
|
176291
|
+
success: false,
|
|
176292
|
+
error: `Failed to read file: ${error51.message}`
|
|
176293
|
+
};
|
|
176294
|
+
}
|
|
176295
|
+
}
|
|
176296
|
+
}
|
|
176123
176297
|
// ../../packages/core/dist/tools/execute.js
|
|
176124
176298
|
class ExecuteTool {
|
|
176125
176299
|
name = "execute";
|
|
@@ -176594,13 +176768,20 @@ class HookService {
|
|
|
176594
176768
|
});
|
|
176595
176769
|
const id = this.idFactory();
|
|
176596
176770
|
this.queue.enqueue(async () => {
|
|
176771
|
+
const scrub = scrubCredentials(JSON.stringify(ev.payload));
|
|
176772
|
+
if (scrub.total > 0) {
|
|
176773
|
+
logger.debug("hook payload redacted before persist", {
|
|
176774
|
+
redactions: scrub.redactions,
|
|
176775
|
+
total: scrub.total
|
|
176776
|
+
});
|
|
176777
|
+
}
|
|
176597
176778
|
const obs = {
|
|
176598
176779
|
id,
|
|
176599
176780
|
projectId: attribution.projectId,
|
|
176600
176781
|
sessionId: ev.sessionId,
|
|
176601
176782
|
source: ev.event,
|
|
176602
176783
|
category: extractCategory(ev.event, ev.payload),
|
|
176603
|
-
payloadJson:
|
|
176784
|
+
payloadJson: scrub.sanitized,
|
|
176604
176785
|
importance: ev.importance,
|
|
176605
176786
|
createdAt: ev.ts,
|
|
176606
176787
|
agentId: ev.agentId,
|
|
@@ -176684,7 +176865,7 @@ init_llm_client();
|
|
|
176684
176865
|
init_symbol_graph_service();
|
|
176685
176866
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
176686
176867
|
import fs14 from "fs";
|
|
176687
|
-
import
|
|
176868
|
+
import path26 from "path";
|
|
176688
176869
|
import { spawn as spawn2 } from "child_process";
|
|
176689
176870
|
var FALLBACK_BOOTSTRAP = {
|
|
176690
176871
|
enabled: true,
|
|
@@ -176868,7 +177049,7 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
176868
177049
|
}
|
|
176869
177050
|
try {
|
|
176870
177051
|
for (const name26 of README_CANDIDATES) {
|
|
176871
|
-
const p =
|
|
177052
|
+
const p = path26.join(projectRoot, name26);
|
|
176872
177053
|
if (fs14.existsSync(p) && fs14.statSync(p).isFile()) {
|
|
176873
177054
|
const buf = fs14.readFileSync(p);
|
|
176874
177055
|
signals.readme = buf.slice(0, MAX_README_BYTES).toString("utf8");
|
|
@@ -176879,14 +177060,14 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
176879
177060
|
logger.debug("bootstrap scan: README read failed", { error: e.message });
|
|
176880
177061
|
}
|
|
176881
177062
|
try {
|
|
176882
|
-
const docsDir =
|
|
177063
|
+
const docsDir = path26.join(projectRoot, "docs");
|
|
176883
177064
|
if (fs14.existsSync(docsDir) && fs14.statSync(docsDir).isDirectory()) {
|
|
176884
177065
|
const entries = walkMarkdown(docsDir).slice(0, MAX_DOCS);
|
|
176885
177066
|
for (const rel of entries) {
|
|
176886
177067
|
try {
|
|
176887
177068
|
const buf = fs14.readFileSync(rel);
|
|
176888
177069
|
signals.docs.push({
|
|
176889
|
-
path:
|
|
177070
|
+
path: path26.relative(projectRoot, rel),
|
|
176890
177071
|
snippet: buf.slice(0, MAX_DOC_BYTES).toString("utf8")
|
|
176891
177072
|
});
|
|
176892
177073
|
} catch {}
|
|
@@ -176897,7 +177078,7 @@ async function scanSignals(_projectId, projectRoot, caps, symbolGraph, gitRunner
|
|
|
176897
177078
|
}
|
|
176898
177079
|
try {
|
|
176899
177080
|
for (const name26 of MANIFEST_FILES) {
|
|
176900
|
-
const p =
|
|
177081
|
+
const p = path26.join(projectRoot, name26);
|
|
176901
177082
|
if (!fs14.existsSync(p) || !fs14.statSync(p).isFile())
|
|
176902
177083
|
continue;
|
|
176903
177084
|
const raw2 = fs14.readFileSync(p).slice(0, MAX_MANIFEST_BYTES).toString("utf8");
|
|
@@ -176945,7 +177126,7 @@ function walkMarkdown(dir) {
|
|
|
176945
177126
|
continue;
|
|
176946
177127
|
}
|
|
176947
177128
|
for (const e of entries) {
|
|
176948
|
-
const full =
|
|
177129
|
+
const full = path26.join(cur, e.name);
|
|
176949
177130
|
if (e.isDirectory()) {
|
|
176950
177131
|
if (e.name === "node_modules" || e.name.startsWith("."))
|
|
176951
177132
|
continue;
|
|
@@ -177979,7 +178160,7 @@ var checkpointRoutes = new Elysia({ prefix: "/api/v1/checkpoints" }).post("/list
|
|
|
177979
178160
|
// src/routes/project.ts
|
|
177980
178161
|
init_dist();
|
|
177981
178162
|
import fs15 from "fs/promises";
|
|
177982
|
-
import
|
|
178163
|
+
import path27 from "path";
|
|
177983
178164
|
var indexProjectTool = null;
|
|
177984
178165
|
var indexStatusTool = null;
|
|
177985
178166
|
var projectIdentityService = null;
|
|
@@ -178188,21 +178369,21 @@ var projectRoutes = new Elysia({ prefix: "/api/v1/project" }).get("/list", async
|
|
|
178188
178369
|
}).post("/upload-and-index", async ({ body }) => {
|
|
178189
178370
|
const rawBase = body.projectId || body.projectPath.replace(/\\/g, "/").split("/").filter(Boolean).pop() || "default";
|
|
178190
178371
|
const finalProjectId = rawBase.replace(/[^a-zA-Z0-9_.-]/g, "_").slice(0, 128);
|
|
178191
|
-
const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR ||
|
|
178192
|
-
const stagingDir =
|
|
178372
|
+
const uploadRoot = process.env.MASSA_AI_UPLOAD_DIR || path27.join(getGlobalDataDir(), "uploads");
|
|
178373
|
+
const stagingDir = path27.resolve(uploadRoot, finalProjectId);
|
|
178193
178374
|
await fs15.rm(stagingDir, { recursive: true, force: true });
|
|
178194
178375
|
await fs15.mkdir(stagingDir, { recursive: true });
|
|
178195
178376
|
const WRITE_BATCH = 20;
|
|
178196
178377
|
for (let i = 0;i < body.files.length; i += WRITE_BATCH) {
|
|
178197
178378
|
await Promise.all(body.files.slice(i, i + WRITE_BATCH).map(async (file3) => {
|
|
178198
|
-
if (
|
|
178379
|
+
if (path27.isAbsolute(file3.relativePath) || file3.relativePath.includes("..")) {
|
|
178199
178380
|
throw new Error(`Invalid file path: ${file3.relativePath}`);
|
|
178200
178381
|
}
|
|
178201
|
-
const dest =
|
|
178202
|
-
if (!dest.startsWith(stagingDir +
|
|
178382
|
+
const dest = path27.resolve(stagingDir, file3.relativePath.replace(/\//g, path27.sep));
|
|
178383
|
+
if (!dest.startsWith(stagingDir + path27.sep)) {
|
|
178203
178384
|
throw new Error(`Path escapes staging directory: ${file3.relativePath}`);
|
|
178204
178385
|
}
|
|
178205
|
-
await fs15.mkdir(
|
|
178386
|
+
await fs15.mkdir(path27.dirname(dest), { recursive: true });
|
|
178206
178387
|
await fs15.writeFile(dest, file3.content, "utf-8");
|
|
178207
178388
|
}));
|
|
178208
178389
|
}
|
|
@@ -178357,7 +178538,7 @@ var analyticsRoutes = new Elysia({ prefix: "/api/v1/analytics" }).post("/", asyn
|
|
|
178357
178538
|
|
|
178358
178539
|
// src/routes/system.ts
|
|
178359
178540
|
init_dist();
|
|
178360
|
-
import
|
|
178541
|
+
import path28 from "path";
|
|
178361
178542
|
import fs16 from "fs";
|
|
178362
178543
|
import os4 from "os";
|
|
178363
178544
|
function databaseUrlParts() {
|
|
@@ -178432,7 +178613,7 @@ var systemRoutes = new Elysia({ prefix: "/api/v1/system" }).get("/info", async (
|
|
|
178432
178613
|
description: "Check PostgreSQL, pgvector, Ollama, and local artifact directory health"
|
|
178433
178614
|
}
|
|
178434
178615
|
}).get("/metrics", async () => {
|
|
178435
|
-
const metricsPath =
|
|
178616
|
+
const metricsPath = path28.join(process.cwd(), "data", "metrics.json");
|
|
178436
178617
|
let metrics2 = {};
|
|
178437
178618
|
if (fs16.existsSync(metricsPath)) {
|
|
178438
178619
|
try {
|
|
@@ -178587,7 +178768,7 @@ var eventsRoutes = new Elysia({ prefix: "/api/v1" }).get("/events", async ({ que
|
|
|
178587
178768
|
|
|
178588
178769
|
// src/routes/workspace.ts
|
|
178589
178770
|
import fs17 from "fs/promises";
|
|
178590
|
-
import
|
|
178771
|
+
import path29 from "path";
|
|
178591
178772
|
import { realpathSync as realpathSync4 } from "fs";
|
|
178592
178773
|
var indexProjectTool2 = null;
|
|
178593
178774
|
function getIndexProjectTool2() {
|
|
@@ -178629,7 +178810,7 @@ function realpathSafe(p) {
|
|
|
178629
178810
|
try {
|
|
178630
178811
|
return realpathSync4(p);
|
|
178631
178812
|
} catch {
|
|
178632
|
-
return
|
|
178813
|
+
return path29.resolve(p);
|
|
178633
178814
|
}
|
|
178634
178815
|
}
|
|
178635
178816
|
var graphController = null;
|
|
@@ -178980,8 +179161,8 @@ var workspaceRoutes = new Elysia({ prefix: "/api/v1" }).get("/workspace/list", a
|
|
|
178980
179161
|
}
|
|
178981
179162
|
const registeredRoot = realpathSafe(workspace.project_path);
|
|
178982
179163
|
const callerRoot = realpathSafe(projectPath2);
|
|
178983
|
-
const rel =
|
|
178984
|
-
const escapes = rel.startsWith("..") ||
|
|
179164
|
+
const rel = path29.relative(registeredRoot, callerRoot);
|
|
179165
|
+
const escapes = rel.startsWith("..") || path29.isAbsolute(rel);
|
|
178985
179166
|
if (registeredRoot !== callerRoot && escapes) {
|
|
178986
179167
|
return {
|
|
178987
179168
|
success: false,
|
|
@@ -179111,7 +179292,7 @@ var workspaceRoutes = new Elysia({ prefix: "/api/v1" }).get("/workspace/list", a
|
|
|
179111
179292
|
} else {
|
|
179112
179293
|
end = start + 20;
|
|
179113
179294
|
}
|
|
179114
|
-
const absolutePath =
|
|
179295
|
+
const absolutePath = path29.join(workspace.project_path, file3);
|
|
179115
179296
|
const content = await fs17.readFile(absolutePath, "utf-8");
|
|
179116
179297
|
const lines = content.split(/\r?\n/);
|
|
179117
179298
|
const slice = lines.slice(start - 1, Math.min(lines.length, end));
|
|
@@ -180028,7 +180209,7 @@ var webRoutes = new Elysia({ prefix: "/api/v1/web" }).post("/fetch_and_index", a
|
|
|
180028
180209
|
|
|
180029
180210
|
// src/routes/web-ui.ts
|
|
180030
180211
|
import fs18 from "fs/promises";
|
|
180031
|
-
import
|
|
180212
|
+
import path30 from "path";
|
|
180032
180213
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
180033
180214
|
|
|
180034
180215
|
// src/web-ui-trust.ts
|
|
@@ -180072,9 +180253,9 @@ function buildStaticDirCandidates(moduleDir, cwd) {
|
|
|
180072
180253
|
for (const root2 of [moduleDir, cwd]) {
|
|
180073
180254
|
let dir = root2;
|
|
180074
180255
|
for (let i = 0;i < 10; i++) {
|
|
180075
|
-
candidates2.push(
|
|
180076
|
-
candidates2.push(
|
|
180077
|
-
const parent =
|
|
180256
|
+
candidates2.push(path30.resolve(dir, "apps/web-ui/src/static"));
|
|
180257
|
+
candidates2.push(path30.resolve(dir, "web-ui/src/static"));
|
|
180258
|
+
const parent = path30.dirname(dir);
|
|
180078
180259
|
if (parent === dir)
|
|
180079
180260
|
break;
|
|
180080
180261
|
dir = parent;
|
|
@@ -180082,7 +180263,7 @@ function buildStaticDirCandidates(moduleDir, cwd) {
|
|
|
180082
180263
|
}
|
|
180083
180264
|
return [...new Set(candidates2)];
|
|
180084
180265
|
}
|
|
180085
|
-
var STATIC_DIR_CANDIDATES = buildStaticDirCandidates(
|
|
180266
|
+
var STATIC_DIR_CANDIDATES = buildStaticDirCandidates(path30.dirname(fileURLToPath3(import.meta.url)), process.cwd());
|
|
180086
180267
|
async function resolveStaticDir() {
|
|
180087
180268
|
for (const dir of STATIC_DIR_CANDIDATES) {
|
|
180088
180269
|
try {
|
|
@@ -180107,7 +180288,7 @@ var CONTENT_TYPES = {
|
|
|
180107
180288
|
".woff2": "font/woff2"
|
|
180108
180289
|
};
|
|
180109
180290
|
function contentTypeFor(filePath) {
|
|
180110
|
-
const ext2 =
|
|
180291
|
+
const ext2 = path30.extname(filePath).toLowerCase();
|
|
180111
180292
|
return CONTENT_TYPES[ext2] ?? "application/octet-stream";
|
|
180112
180293
|
}
|
|
180113
180294
|
function webUiDisabled() {
|
|
@@ -180118,9 +180299,9 @@ function webUiDisabled() {
|
|
|
180118
180299
|
}
|
|
180119
180300
|
async function resolveSafePath(staticDir, sub) {
|
|
180120
180301
|
const cleaned = sub.replace(/^\/+/, "");
|
|
180121
|
-
const abs =
|
|
180122
|
-
const rel =
|
|
180123
|
-
if (rel.startsWith("..") ||
|
|
180302
|
+
const abs = path30.resolve(staticDir, cleaned);
|
|
180303
|
+
const rel = path30.relative(staticDir, abs);
|
|
180304
|
+
if (rel.startsWith("..") || path30.isAbsolute(rel)) {
|
|
180124
180305
|
return null;
|
|
180125
180306
|
}
|
|
180126
180307
|
try {
|
|
@@ -180164,7 +180345,7 @@ var webUiRoutes = new Elysia().get("/ui", async ({ set: set3, request }) => {
|
|
|
180164
180345
|
set3.status = 500;
|
|
180165
180346
|
return { status: 500, error: "web ui static dir not found" };
|
|
180166
180347
|
}
|
|
180167
|
-
const indexPath =
|
|
180348
|
+
const indexPath = path30.join(dir, "index.html");
|
|
180168
180349
|
try {
|
|
180169
180350
|
const body = await readShell(indexPath, remoteAddressOf(request));
|
|
180170
180351
|
set3.headers["content-type"] = contentTypeFor(indexPath);
|
|
@@ -180206,7 +180387,7 @@ var webUiRoutes = new Elysia().get("/ui", async ({ set: set3, request }) => {
|
|
|
180206
180387
|
}
|
|
180207
180388
|
}
|
|
180208
180389
|
try {
|
|
180209
|
-
const body = await readShell(
|
|
180390
|
+
const body = await readShell(path30.join(dir, "index.html"), remoteAddressOf(request));
|
|
180210
180391
|
set3.headers["content-type"] = "text/html; charset=utf-8";
|
|
180211
180392
|
return body;
|
|
180212
180393
|
} catch {
|