@wrongstack/tools 0.296.4 → 0.297.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/audit.js +15 -0
- package/dist/audit.js.map +2 -2
- package/dist/bash.js +15 -0
- package/dist/bash.js.map +2 -2
- package/dist/builtin.js +42 -0
- package/dist/builtin.js.map +2 -2
- package/dist/codebase-index/index.js +27 -0
- package/dist/codebase-index/index.js.map +2 -2
- package/dist/codebase-index/project-server-client.d.ts.map +1 -1
- package/dist/codebase-index/project-server.js +16 -0
- package/dist/codebase-index/project-server.js.map +2 -2
- package/dist/exec.js +15 -0
- package/dist/exec.js.map +2 -2
- package/dist/format.js +15 -0
- package/dist/format.js.map +2 -2
- package/dist/index.js +42 -0
- package/dist/index.js.map +2 -2
- package/dist/install.js +15 -0
- package/dist/install.js.map +2 -2
- package/dist/languages/index.js +15 -0
- package/dist/languages/index.js.map +2 -2
- package/dist/lint.js +15 -0
- package/dist/lint.js.map +2 -2
- package/dist/next-steps.d.ts +23 -0
- package/dist/next-steps.d.ts.map +1 -1
- package/dist/next-steps.js +4 -0
- package/dist/next-steps.js.map +2 -2
- package/dist/outdated.js +15 -0
- package/dist/outdated.js.map +2 -2
- package/dist/pack.js +42 -0
- package/dist/pack.js.map +2 -2
- package/dist/process-registry.d.ts +9 -0
- package/dist/process-registry.d.ts.map +1 -1
- package/dist/process-registry.js +15 -0
- package/dist/process-registry.js.map +2 -2
- package/dist/ps-slash.js +15 -0
- package/dist/ps-slash.js.map +2 -2
- package/dist/read.js +27 -0
- package/dist/read.js.map +2 -2
- package/dist/test.js +15 -0
- package/dist/test.js.map +2 -2
- package/dist/tool-tier.js +42 -0
- package/dist/tool-tier.js.map +2 -2
- package/dist/typecheck.js +15 -0
- package/dist/typecheck.js.map +2 -2
- package/package.json +3 -3
package/dist/tool-tier.js
CHANGED
|
@@ -479,6 +479,7 @@ var init_process_registry = __esm({
|
|
|
479
479
|
}
|
|
480
480
|
/** Get all tracked processes. */
|
|
481
481
|
list() {
|
|
482
|
+
this._pruneAllStale();
|
|
482
483
|
return Array.from(this.processes.values());
|
|
483
484
|
}
|
|
484
485
|
/** Get processes filtered by name (e.g. 'bash', 'exec'). */
|
|
@@ -509,6 +510,7 @@ var init_process_registry = __esm({
|
|
|
509
510
|
* Combined stats for observability — used by /ps and the TUI status bar.
|
|
510
511
|
*/
|
|
511
512
|
stats() {
|
|
513
|
+
this._pruneAllStale();
|
|
512
514
|
return {
|
|
513
515
|
activeCount: this.activeCount,
|
|
514
516
|
backgroundCount: this.activeBackgroundCount,
|
|
@@ -748,6 +750,19 @@ var init_process_registry = __esm({
|
|
|
748
750
|
this.processes.delete(pid);
|
|
749
751
|
}
|
|
750
752
|
}
|
|
753
|
+
/**
|
|
754
|
+
* Remove every stale entry, not just one PID. `list()`/`stats()` — the
|
|
755
|
+
* surfaces the TUI status bar and `/ps` poll — must prune too: a child
|
|
756
|
+
* whose 'close' event never fires (e.g. Windows grandchildren holding stdio
|
|
757
|
+
* open) would otherwise linger in the registry until someone looks up its
|
|
758
|
+
* exact PID, and PID reuse meanwhile makes `get()`/`kill()` target the
|
|
759
|
+
* wrong process. RAM-leak audit 2026-07-31, MEDIUM.
|
|
760
|
+
*/
|
|
761
|
+
_pruneAllStale() {
|
|
762
|
+
for (const [pid, entry] of this.processes) {
|
|
763
|
+
if (this._isStaleEntry(entry)) this.processes.delete(pid);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
751
766
|
};
|
|
752
767
|
}
|
|
753
768
|
});
|
|
@@ -11870,6 +11885,10 @@ var ProjectServerConnection = class {
|
|
|
11870
11885
|
isConnected() {
|
|
11871
11886
|
return this.socket !== null && !this.socket.destroyed && this.info !== null;
|
|
11872
11887
|
}
|
|
11888
|
+
/** Safe LRU candidate: no request, connect, or health probe is in flight. */
|
|
11889
|
+
isEvictable() {
|
|
11890
|
+
return this.pending.size === 0 && this.connecting === null && this.healthCheck === null;
|
|
11891
|
+
}
|
|
11873
11892
|
async checkHealth(spawnIfMissing = false, timeoutMs = SERVER_HEALTH_TIMEOUT_MS) {
|
|
11874
11893
|
await this.ensureConnected(spawnIfMissing);
|
|
11875
11894
|
if (this.healthCheck) return this.healthCheck;
|
|
@@ -12268,7 +12287,26 @@ var ProjectServerConnection = class {
|
|
|
12268
12287
|
}
|
|
12269
12288
|
};
|
|
12270
12289
|
var connections = /* @__PURE__ */ new Map();
|
|
12290
|
+
var MAX_CACHED_CONNECTIONS = 8;
|
|
12271
12291
|
var heartbeatTimer;
|
|
12292
|
+
function forgetConnection(endpoint, connection) {
|
|
12293
|
+
if (connections.get(endpoint) === connection) connections.delete(endpoint);
|
|
12294
|
+
connection.close();
|
|
12295
|
+
connectionStates.delete(endpoint);
|
|
12296
|
+
if (latestConnectionState.endpoint !== endpoint) return;
|
|
12297
|
+
latestConnectionState = [...connectionStates.values()].at(-1) ?? {
|
|
12298
|
+
status: isProjectIndexServerAvailable() ? "offline" : "unavailable",
|
|
12299
|
+
connected: false
|
|
12300
|
+
};
|
|
12301
|
+
}
|
|
12302
|
+
function trimConnectionCache(protectedConnection) {
|
|
12303
|
+
if (connections.size <= MAX_CACHED_CONNECTIONS) return;
|
|
12304
|
+
for (const [endpoint, connection] of connections) {
|
|
12305
|
+
if (connections.size <= MAX_CACHED_CONNECTIONS) break;
|
|
12306
|
+
if (connection === protectedConnection || !connection.isEvictable()) continue;
|
|
12307
|
+
forgetConnection(endpoint, connection);
|
|
12308
|
+
}
|
|
12309
|
+
}
|
|
12272
12310
|
function ensureHeartbeatLoop() {
|
|
12273
12311
|
if (heartbeatTimer) return;
|
|
12274
12312
|
heartbeatTimer = setInterval(() => {
|
|
@@ -12291,7 +12329,11 @@ function connectionFor(projectRoot, indexDir) {
|
|
|
12291
12329
|
if (!connection) {
|
|
12292
12330
|
connection = new ProjectServerConnection(projectRoot, indexDir, endpoint);
|
|
12293
12331
|
connections.set(endpoint, connection);
|
|
12332
|
+
} else {
|
|
12333
|
+
connections.delete(endpoint);
|
|
12334
|
+
connections.set(endpoint, connection);
|
|
12294
12335
|
}
|
|
12336
|
+
trimConnectionCache(connection);
|
|
12295
12337
|
return connection;
|
|
12296
12338
|
}
|
|
12297
12339
|
function callProjectIndexServer(op, args, options) {
|