@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
|
@@ -4102,6 +4102,10 @@ var ProjectServerConnection = class {
|
|
|
4102
4102
|
isConnected() {
|
|
4103
4103
|
return this.socket !== null && !this.socket.destroyed && this.info !== null;
|
|
4104
4104
|
}
|
|
4105
|
+
/** Safe LRU candidate: no request, connect, or health probe is in flight. */
|
|
4106
|
+
isEvictable() {
|
|
4107
|
+
return this.pending.size === 0 && this.connecting === null && this.healthCheck === null;
|
|
4108
|
+
}
|
|
4105
4109
|
async checkHealth(spawnIfMissing = false, timeoutMs = SERVER_HEALTH_TIMEOUT_MS) {
|
|
4106
4110
|
await this.ensureConnected(spawnIfMissing);
|
|
4107
4111
|
if (this.healthCheck) return this.healthCheck;
|
|
@@ -4500,7 +4504,26 @@ var ProjectServerConnection = class {
|
|
|
4500
4504
|
}
|
|
4501
4505
|
};
|
|
4502
4506
|
var connections = /* @__PURE__ */ new Map();
|
|
4507
|
+
var MAX_CACHED_CONNECTIONS = 8;
|
|
4503
4508
|
var heartbeatTimer;
|
|
4509
|
+
function forgetConnection(endpoint, connection) {
|
|
4510
|
+
if (connections.get(endpoint) === connection) connections.delete(endpoint);
|
|
4511
|
+
connection.close();
|
|
4512
|
+
connectionStates.delete(endpoint);
|
|
4513
|
+
if (latestConnectionState.endpoint !== endpoint) return;
|
|
4514
|
+
latestConnectionState = [...connectionStates.values()].at(-1) ?? {
|
|
4515
|
+
status: isProjectIndexServerAvailable() ? "offline" : "unavailable",
|
|
4516
|
+
connected: false
|
|
4517
|
+
};
|
|
4518
|
+
}
|
|
4519
|
+
function trimConnectionCache(protectedConnection) {
|
|
4520
|
+
if (connections.size <= MAX_CACHED_CONNECTIONS) return;
|
|
4521
|
+
for (const [endpoint, connection] of connections) {
|
|
4522
|
+
if (connections.size <= MAX_CACHED_CONNECTIONS) break;
|
|
4523
|
+
if (connection === protectedConnection || !connection.isEvictable()) continue;
|
|
4524
|
+
forgetConnection(endpoint, connection);
|
|
4525
|
+
}
|
|
4526
|
+
}
|
|
4504
4527
|
function ensureHeartbeatLoop() {
|
|
4505
4528
|
if (heartbeatTimer) return;
|
|
4506
4529
|
heartbeatTimer = setInterval(() => {
|
|
@@ -4523,7 +4546,11 @@ function connectionFor(projectRoot, indexDir) {
|
|
|
4523
4546
|
if (!connection) {
|
|
4524
4547
|
connection = new ProjectServerConnection(projectRoot, indexDir, endpoint);
|
|
4525
4548
|
connections.set(endpoint, connection);
|
|
4549
|
+
} else {
|
|
4550
|
+
connections.delete(endpoint);
|
|
4551
|
+
connections.set(endpoint, connection);
|
|
4526
4552
|
}
|
|
4553
|
+
trimConnectionCache(connection);
|
|
4527
4554
|
return connection;
|
|
4528
4555
|
}
|
|
4529
4556
|
function callProjectIndexServer(op, args, options) {
|