zephex 2.0.14 → 2.0.15
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 +19831 -11881
- package/dist/tools/architecture/index.js +5 -2
- package/dist/tools/context/index.js +5 -2
- package/dist/tools/reader/readCode.js +1012 -107
- package/dist/tools/scope_task/index.js +54 -4
- package/dist/tools/search/findCode.js +66 -7
- package/dist/tools/server.js +1072 -141
- package/dist/tools/thinking/index.js +5 -2
- package/package.json +2 -1
|
@@ -25486,10 +25486,13 @@ function getSupabaseClient() {
|
|
|
25486
25486
|
},
|
|
25487
25487
|
global: {
|
|
25488
25488
|
fetch: (url3, options = {}) => {
|
|
25489
|
+
const controller = new AbortController;
|
|
25490
|
+
const timeout = setTimeout(() => controller.abort(), 8000);
|
|
25489
25491
|
return fetch(url3, {
|
|
25490
25492
|
...options,
|
|
25491
|
-
keepalive: true
|
|
25492
|
-
|
|
25493
|
+
keepalive: true,
|
|
25494
|
+
signal: controller.signal
|
|
25495
|
+
}).finally(() => clearTimeout(timeout));
|
|
25493
25496
|
},
|
|
25494
25497
|
headers: {
|
|
25495
25498
|
Connection: "keep-alive",
|
|
@@ -32150,8 +32153,15 @@ async function getParser(lang) {
|
|
|
32150
32153
|
if (wasmRuntimePoisoned)
|
|
32151
32154
|
return null;
|
|
32152
32155
|
await initParser();
|
|
32153
|
-
|
|
32156
|
+
const uses = parserUseCount.get(lang) ?? 0;
|
|
32157
|
+
if (parsers.has(lang) && uses >= PARSER_RECYCLE_THRESHOLD) {
|
|
32158
|
+
parsers.delete(lang);
|
|
32159
|
+
parserUseCount.set(lang, 0);
|
|
32160
|
+
}
|
|
32161
|
+
if (parsers.has(lang)) {
|
|
32162
|
+
parserUseCount.set(lang, uses + 1);
|
|
32154
32163
|
return parsers.get(lang);
|
|
32164
|
+
}
|
|
32155
32165
|
if (unsupportedParsers.has(lang))
|
|
32156
32166
|
return null;
|
|
32157
32167
|
const language = await loadLanguage(lang);
|
|
@@ -32235,6 +32245,35 @@ function extractSymbols(tree, code, lang) {
|
|
|
32235
32245
|
}
|
|
32236
32246
|
}
|
|
32237
32247
|
visit(tree.rootNode);
|
|
32248
|
+
const exportedNames = new Set;
|
|
32249
|
+
function collectExportedNames(node) {
|
|
32250
|
+
if (node.type === "export_statement") {
|
|
32251
|
+
for (let i2 = 0;i2 < node.childCount; i2++) {
|
|
32252
|
+
const child = node.child(i2);
|
|
32253
|
+
if (child.type === "export_clause") {
|
|
32254
|
+
for (let j = 0;j < child.childCount; j++) {
|
|
32255
|
+
const spec = child.child(j);
|
|
32256
|
+
if (spec.type === "export_specifier") {
|
|
32257
|
+
const nameNode = spec.childForFieldName("name");
|
|
32258
|
+
if (nameNode)
|
|
32259
|
+
exportedNames.add(nameNode.text);
|
|
32260
|
+
}
|
|
32261
|
+
}
|
|
32262
|
+
}
|
|
32263
|
+
}
|
|
32264
|
+
}
|
|
32265
|
+
for (let i2 = 0;i2 < node.childCount; i2++) {
|
|
32266
|
+
collectExportedNames(node.child(i2));
|
|
32267
|
+
}
|
|
32268
|
+
}
|
|
32269
|
+
collectExportedNames(tree.rootNode);
|
|
32270
|
+
if (exportedNames.size > 0) {
|
|
32271
|
+
for (const sym of symbols) {
|
|
32272
|
+
if (!sym.isExported && exportedNames.has(sym.name)) {
|
|
32273
|
+
sym.isExported = true;
|
|
32274
|
+
}
|
|
32275
|
+
}
|
|
32276
|
+
}
|
|
32238
32277
|
return symbols;
|
|
32239
32278
|
}
|
|
32240
32279
|
function returnsJSX(node) {
|
|
@@ -32917,7 +32956,17 @@ async function isParserReady() {
|
|
|
32917
32956
|
return false;
|
|
32918
32957
|
}
|
|
32919
32958
|
}
|
|
32920
|
-
|
|
32959
|
+
async function parseFile(filePath, content) {
|
|
32960
|
+
const lang = detectLanguage(filePath);
|
|
32961
|
+
if (!lang)
|
|
32962
|
+
return null;
|
|
32963
|
+
const tree = await parseCode(content, lang);
|
|
32964
|
+
if (!tree)
|
|
32965
|
+
return null;
|
|
32966
|
+
const symbols = extractSymbols(tree, content, lang);
|
|
32967
|
+
return { symbols };
|
|
32968
|
+
}
|
|
32969
|
+
var import_tree_sitter_0_24_3, __dirname2, LegacyParser, initialized = false, parsers, languages, parserUseCount, PARSER_RECYCLE_THRESHOLD = 500, WASM_DIR, LANG_WASM_MAP, unsupportedParsers, wasmRuntimePoisoned = false, KEYWORD_PSEUDO_CALLS;
|
|
32921
32970
|
var init_parser = __esm(() => {
|
|
32922
32971
|
init_logger();
|
|
32923
32972
|
import_tree_sitter_0_24_3 = __toESM(require_tree_sitter_0_24_3(), 1);
|
|
@@ -32925,6 +32974,7 @@ var init_parser = __esm(() => {
|
|
|
32925
32974
|
LegacyParser = import_tree_sitter_0_24_3.default;
|
|
32926
32975
|
parsers = new Map;
|
|
32927
32976
|
languages = new Map;
|
|
32977
|
+
parserUseCount = new Map;
|
|
32928
32978
|
WASM_DIR = getWasmDir();
|
|
32929
32979
|
LANG_WASM_MAP = {
|
|
32930
32980
|
typescript: "tree-sitter-typescript.wasm",
|
|
@@ -12313,10 +12313,13 @@ function getSupabaseClient() {
|
|
|
12313
12313
|
},
|
|
12314
12314
|
global: {
|
|
12315
12315
|
fetch: (url2, options = {}) => {
|
|
12316
|
+
const controller = new AbortController;
|
|
12317
|
+
const timeout = setTimeout(() => controller.abort(), 8000);
|
|
12316
12318
|
return fetch(url2, {
|
|
12317
12319
|
...options,
|
|
12318
|
-
keepalive: true
|
|
12319
|
-
|
|
12320
|
+
keepalive: true,
|
|
12321
|
+
signal: controller.signal
|
|
12322
|
+
}).finally(() => clearTimeout(timeout));
|
|
12320
12323
|
},
|
|
12321
12324
|
headers: {
|
|
12322
12325
|
Connection: "keep-alive",
|
|
@@ -86452,8 +86455,15 @@ async function getParser(lang) {
|
|
|
86452
86455
|
if (wasmRuntimePoisoned)
|
|
86453
86456
|
return null;
|
|
86454
86457
|
await initParser();
|
|
86455
|
-
|
|
86458
|
+
const uses = parserUseCount.get(lang) ?? 0;
|
|
86459
|
+
if (parsers.has(lang) && uses >= PARSER_RECYCLE_THRESHOLD) {
|
|
86460
|
+
parsers.delete(lang);
|
|
86461
|
+
parserUseCount.set(lang, 0);
|
|
86462
|
+
}
|
|
86463
|
+
if (parsers.has(lang)) {
|
|
86464
|
+
parserUseCount.set(lang, uses + 1);
|
|
86456
86465
|
return parsers.get(lang);
|
|
86466
|
+
}
|
|
86457
86467
|
if (unsupportedParsers.has(lang))
|
|
86458
86468
|
return null;
|
|
86459
86469
|
const language = await loadLanguage(lang);
|
|
@@ -86537,6 +86547,35 @@ function extractSymbols(tree, code, lang) {
|
|
|
86537
86547
|
}
|
|
86538
86548
|
}
|
|
86539
86549
|
visit2(tree.rootNode);
|
|
86550
|
+
const exportedNames = new Set;
|
|
86551
|
+
function collectExportedNames(node2) {
|
|
86552
|
+
if (node2.type === "export_statement") {
|
|
86553
|
+
for (let i2 = 0;i2 < node2.childCount; i2++) {
|
|
86554
|
+
const child = node2.child(i2);
|
|
86555
|
+
if (child.type === "export_clause") {
|
|
86556
|
+
for (let j2 = 0;j2 < child.childCount; j2++) {
|
|
86557
|
+
const spec = child.child(j2);
|
|
86558
|
+
if (spec.type === "export_specifier") {
|
|
86559
|
+
const nameNode = spec.childForFieldName("name");
|
|
86560
|
+
if (nameNode)
|
|
86561
|
+
exportedNames.add(nameNode.text);
|
|
86562
|
+
}
|
|
86563
|
+
}
|
|
86564
|
+
}
|
|
86565
|
+
}
|
|
86566
|
+
}
|
|
86567
|
+
for (let i2 = 0;i2 < node2.childCount; i2++) {
|
|
86568
|
+
collectExportedNames(node2.child(i2));
|
|
86569
|
+
}
|
|
86570
|
+
}
|
|
86571
|
+
collectExportedNames(tree.rootNode);
|
|
86572
|
+
if (exportedNames.size > 0) {
|
|
86573
|
+
for (const sym of symbols) {
|
|
86574
|
+
if (!sym.isExported && exportedNames.has(sym.name)) {
|
|
86575
|
+
sym.isExported = true;
|
|
86576
|
+
}
|
|
86577
|
+
}
|
|
86578
|
+
}
|
|
86540
86579
|
return symbols;
|
|
86541
86580
|
}
|
|
86542
86581
|
function returnsJSX(node2) {
|
|
@@ -87219,7 +87258,17 @@ async function isParserReady() {
|
|
|
87219
87258
|
return false;
|
|
87220
87259
|
}
|
|
87221
87260
|
}
|
|
87222
|
-
|
|
87261
|
+
async function parseFile(filePath, content) {
|
|
87262
|
+
const lang = detectLanguage(filePath);
|
|
87263
|
+
if (!lang)
|
|
87264
|
+
return null;
|
|
87265
|
+
const tree = await parseCode(content, lang);
|
|
87266
|
+
if (!tree)
|
|
87267
|
+
return null;
|
|
87268
|
+
const symbols = extractSymbols(tree, content, lang);
|
|
87269
|
+
return { symbols };
|
|
87270
|
+
}
|
|
87271
|
+
var import_tree_sitter_0_24_3, __dirname2, LegacyParser, initialized = false, parsers, languages, parserUseCount, PARSER_RECYCLE_THRESHOLD = 500, WASM_DIR, LANG_WASM_MAP, unsupportedParsers, wasmRuntimePoisoned = false, KEYWORD_PSEUDO_CALLS;
|
|
87223
87272
|
var init_parser = __esm(() => {
|
|
87224
87273
|
init_logger();
|
|
87225
87274
|
import_tree_sitter_0_24_3 = __toESM(require_tree_sitter_0_24_3(), 1);
|
|
@@ -87227,6 +87276,7 @@ var init_parser = __esm(() => {
|
|
|
87227
87276
|
LegacyParser = import_tree_sitter_0_24_3.default;
|
|
87228
87277
|
parsers = new Map;
|
|
87229
87278
|
languages = new Map;
|
|
87279
|
+
parserUseCount = new Map;
|
|
87230
87280
|
WASM_DIR = getWasmDir();
|
|
87231
87281
|
LANG_WASM_MAP = {
|
|
87232
87282
|
typescript: "tree-sitter-typescript.wasm",
|
|
@@ -87327,10 +87377,12 @@ function checkAndMark(sessionId, blockRef) {
|
|
|
87327
87377
|
if (!entry) {
|
|
87328
87378
|
entry = {
|
|
87329
87379
|
seen_blocks: new Set,
|
|
87330
|
-
created_at: Date.now()
|
|
87380
|
+
created_at: Date.now(),
|
|
87381
|
+
last_accessed: Date.now()
|
|
87331
87382
|
};
|
|
87332
87383
|
sessions.set(sessionId, entry);
|
|
87333
87384
|
}
|
|
87385
|
+
entry.last_accessed = Date.now();
|
|
87334
87386
|
if (entry.seen_blocks.has(blockRef)) {
|
|
87335
87387
|
return true;
|
|
87336
87388
|
}
|
|
@@ -87340,7 +87392,14 @@ function checkAndMark(sessionId, blockRef) {
|
|
|
87340
87392
|
function cleanExpiredSessions() {
|
|
87341
87393
|
const now = Date.now();
|
|
87342
87394
|
for (const [id, entry] of sessions) {
|
|
87343
|
-
if (now - entry.created_at > SESSION_TTL_MS) {
|
|
87395
|
+
if (now - entry.created_at > SESSION_TTL_MS || now - entry.last_accessed > SESSION_IDLE_TTL_MS) {
|
|
87396
|
+
sessions.delete(id);
|
|
87397
|
+
}
|
|
87398
|
+
}
|
|
87399
|
+
if (sessions.size > MAX_SESSIONS) {
|
|
87400
|
+
const sorted = [...sessions.entries()].sort((a, b) => a[1].last_accessed - b[1].last_accessed);
|
|
87401
|
+
const toRemove = sorted.slice(0, sessions.size - MAX_SESSIONS);
|
|
87402
|
+
for (const [id] of toRemove) {
|
|
87344
87403
|
sessions.delete(id);
|
|
87345
87404
|
}
|
|
87346
87405
|
}
|
|
@@ -87351,7 +87410,7 @@ function createFindCodeBlockRef(file2, blockStart, blockEnd) {
|
|
|
87351
87410
|
function createReadCodeBlockRef(symbolName, file2, startLine) {
|
|
87352
87411
|
return `${symbolName}@${file2}:${startLine}`;
|
|
87353
87412
|
}
|
|
87354
|
-
var sessions, SESSION_TTL_MS = 3600000;
|
|
87413
|
+
var sessions, SESSION_TTL_MS = 3600000, SESSION_IDLE_TTL_MS = 1800000, MAX_SESSIONS = 200;
|
|
87355
87414
|
var init_sessionStore = __esm(() => {
|
|
87356
87415
|
sessions = new Map;
|
|
87357
87416
|
});
|