@wrongstack/tools 0.268.0 → 0.270.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/bash.js +11 -2
- package/dist/bash.js.map +1 -1
- package/dist/batch-tool-use.js.map +1 -1
- package/dist/builtin.js +25 -12
- package/dist/builtin.js.map +1 -1
- package/dist/codebase-index/index.js +14 -10
- package/dist/codebase-index/index.js.map +1 -1
- package/dist/codebase-index/worker.js +14 -10
- package/dist/codebase-index/worker.js.map +1 -1
- package/dist/fetch.js.map +1 -1
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/dist/pack.js +25 -12
- package/dist/pack.js.map +1 -1
- package/dist/search.js.map +1 -1
- package/package.json +2 -2
package/dist/pack.js
CHANGED
|
@@ -1179,8 +1179,7 @@ var bashTool = {
|
|
|
1179
1179
|
// Windows children survive parent exit either way. POSIX keeps
|
|
1180
1180
|
// detached for the process-group kill semantics.
|
|
1181
1181
|
detached: !isWin3,
|
|
1182
|
-
windowsHide: true
|
|
1183
|
-
signal: opts.signal
|
|
1182
|
+
windowsHide: true
|
|
1184
1183
|
});
|
|
1185
1184
|
const pid2 = child2.pid;
|
|
1186
1185
|
if (typeof pid2 === "number") {
|
|
@@ -1208,7 +1207,17 @@ var bashTool = {
|
|
|
1208
1207
|
};
|
|
1209
1208
|
child2.stdout?.on("data", onBgData);
|
|
1210
1209
|
child2.stderr?.on("data", onBgData);
|
|
1210
|
+
const cleanupBackground = () => {
|
|
1211
|
+
child2.stdout?.off("data", onBgData);
|
|
1212
|
+
child2.stderr?.off("data", onBgData);
|
|
1213
|
+
};
|
|
1214
|
+
child2.on("error", () => {
|
|
1215
|
+
cleanupBackground();
|
|
1216
|
+
if (typeof pid2 === "number") registry.unregister(pid2);
|
|
1217
|
+
registry.afterCall(Date.now() - startedAt, true, bypassBreaker);
|
|
1218
|
+
});
|
|
1211
1219
|
child2.on("close", () => {
|
|
1220
|
+
cleanupBackground();
|
|
1212
1221
|
registry.afterCall(Date.now() - startedAt, false, bypassBreaker);
|
|
1213
1222
|
});
|
|
1214
1223
|
if (typeof pid2 === "number") child2.unref();
|
|
@@ -1813,7 +1822,7 @@ var IndexStore = class {
|
|
|
1813
1822
|
throw new LockError(`SQLite lock conflict after ${MAX_LOCK_RETRIES} retries: ${msg}`);
|
|
1814
1823
|
}
|
|
1815
1824
|
const delay = Math.min(
|
|
1816
|
-
LOCK_RETRY_BASE_DELAY_MS *
|
|
1825
|
+
LOCK_RETRY_BASE_DELAY_MS * 2 ** attempt,
|
|
1817
1826
|
LOCK_RETRY_MAX_DELAY_MS
|
|
1818
1827
|
);
|
|
1819
1828
|
sleepSync(delay);
|
|
@@ -2106,14 +2115,15 @@ var IndexStore = class {
|
|
|
2106
2115
|
if (!query2.trim()) {
|
|
2107
2116
|
return { results: candidates.slice(0, limit), total: candidates.length };
|
|
2108
2117
|
}
|
|
2118
|
+
const candidateById = new Map(candidates.map((c) => [c.id, c]));
|
|
2109
2119
|
const bm25 = buildBm25Index(
|
|
2110
2120
|
candidates.map((c) => ({ id: c.id, text: buildIndexableText(c.name, c.signature, c.docComment) }))
|
|
2111
2121
|
);
|
|
2112
|
-
const scored = bm25.score(query2, (id) =>
|
|
2122
|
+
const scored = bm25.score(query2, (id) => candidateById.has(id));
|
|
2113
2123
|
scored.sort((a, b) => b.score - a.score);
|
|
2114
2124
|
const qTokens = tokenise(query2);
|
|
2115
2125
|
const results = scored.slice(0, limit).map(({ id, score }) => {
|
|
2116
|
-
const c = expectDefined(
|
|
2126
|
+
const c = expectDefined(candidateById.get(id));
|
|
2117
2127
|
return { ...c, score, snippet: bm25.extractSnippet(id, qTokens) };
|
|
2118
2128
|
});
|
|
2119
2129
|
return { results, total: candidates.length };
|
|
@@ -3685,6 +3695,10 @@ async function runIndexerWithStore(store, opts) {
|
|
|
3685
3695
|
if (!stat11.isFile()) return { file, stat: stat11, lang: "", parsed: null };
|
|
3686
3696
|
const lang = detectLang(file);
|
|
3687
3697
|
if (!lang) return { file, stat: stat11, lang: "", parsed: null };
|
|
3698
|
+
const meta = existingMeta.get(file);
|
|
3699
|
+
if (!force && meta && meta.mtimeMs === Math.floor(stat11.mtimeMs)) {
|
|
3700
|
+
return { file, stat: stat11, lang, parsed: null, skippedMeta: meta };
|
|
3701
|
+
}
|
|
3688
3702
|
let content;
|
|
3689
3703
|
try {
|
|
3690
3704
|
content = await fs14.readFile(file, { encoding: "utf8", signal });
|
|
@@ -3717,6 +3731,12 @@ async function runIndexerWithStore(store, opts) {
|
|
|
3717
3731
|
continue;
|
|
3718
3732
|
}
|
|
3719
3733
|
const { stat: stat11, lang, parsed } = result;
|
|
3734
|
+
if (result.skippedMeta) {
|
|
3735
|
+
langStats[lang] = (langStats[lang] ?? 0) + result.skippedMeta.symbolCount;
|
|
3736
|
+
symbolsIndexed += result.skippedMeta.symbolCount;
|
|
3737
|
+
filesIndexed++;
|
|
3738
|
+
continue;
|
|
3739
|
+
}
|
|
3720
3740
|
if (!lang || !parsed) {
|
|
3721
3741
|
if (lang) {
|
|
3722
3742
|
store.upsertFile({ file, lang, mtimeMs: Math.floor(stat11.mtimeMs), symbolCount: 0, lastIndexed: Date.now() });
|
|
@@ -3724,13 +3744,6 @@ async function runIndexerWithStore(store, opts) {
|
|
|
3724
3744
|
}
|
|
3725
3745
|
continue;
|
|
3726
3746
|
}
|
|
3727
|
-
const meta = existingMeta.get(file);
|
|
3728
|
-
if (!force && meta && meta.mtimeMs === Math.floor(stat11.mtimeMs)) {
|
|
3729
|
-
langStats[lang] = (langStats[lang] ?? 0) + meta.symbolCount;
|
|
3730
|
-
symbolsIndexed += meta.symbolCount;
|
|
3731
|
-
filesIndexed++;
|
|
3732
|
-
continue;
|
|
3733
|
-
}
|
|
3734
3747
|
store.deleteRefsForFile(file);
|
|
3735
3748
|
store.deleteSymbolsForFile(file);
|
|
3736
3749
|
if (parsed.symbols.length === 0) {
|