@wrongstack/tools 0.296.3 → 0.296.4
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/builtin.js +1253 -1220
- package/dist/builtin.js.map +4 -4
- package/dist/codebase-index/background-indexer.d.ts.map +1 -1
- package/dist/codebase-index/index.d.ts +1 -0
- package/dist/codebase-index/index.d.ts.map +1 -1
- package/dist/codebase-index/index.js +1233 -1197
- package/dist/codebase-index/index.js.map +4 -4
- package/dist/codebase-index/project-server-client.d.ts +13 -1
- package/dist/codebase-index/project-server-client.d.ts.map +1 -1
- package/dist/codebase-index/project-server-endpoint.d.ts +29 -1
- package/dist/codebase-index/project-server-endpoint.d.ts.map +1 -1
- package/dist/codebase-index/project-server.js +4 -5
- package/dist/codebase-index/project-server.js.map +2 -2
- package/dist/codebase-index/refs-extractor.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1220 -1184
- package/dist/index.js.map +4 -4
- package/dist/pack.js +1253 -1220
- package/dist/pack.js.map +4 -4
- package/dist/read.js +40 -9
- package/dist/read.js.map +2 -2
- package/dist/tool-tier.js +1253 -1220
- package/dist/tool-tier.js.map +4 -4
- package/package.json +3 -3
package/dist/read.js
CHANGED
|
@@ -4535,6 +4535,7 @@ import { spawn as spawn4 } from "node:child_process";
|
|
|
4535
4535
|
import * as fs10 from "node:fs";
|
|
4536
4536
|
import * as net from "node:net";
|
|
4537
4537
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4538
|
+
import { checkUnixSocketPath } from "@wrongstack/core/utils";
|
|
4538
4539
|
|
|
4539
4540
|
// src/codebase-index/project-server-endpoint.ts
|
|
4540
4541
|
import { createHash as createHash2 } from "node:crypto";
|
|
@@ -4542,8 +4543,10 @@ import * as fs9 from "node:fs";
|
|
|
4542
4543
|
import * as os3 from "node:os";
|
|
4543
4544
|
import * as path13 from "node:path";
|
|
4544
4545
|
import { fileURLToPath } from "node:url";
|
|
4546
|
+
import { assertUnixSocketPathWithinLimit } from "@wrongstack/core/utils";
|
|
4545
4547
|
var PROJECT_INDEX_SERVER_PROTOCOL_VERSION = 1;
|
|
4546
4548
|
var PROJECT_INDEX_SERVER_METADATA_FILE = "server.json";
|
|
4549
|
+
var PROJECT_INDEX_SERVER_SOCKET_DIR = `wsci-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}`;
|
|
4547
4550
|
var buildIdCache;
|
|
4548
4551
|
function projectIndexServerBuildId(entrypoint) {
|
|
4549
4552
|
const file = entrypoint instanceof URL || entrypoint.startsWith("file:") ? fileURLToPath(entrypoint) : path13.resolve(entrypoint);
|
|
@@ -4572,11 +4575,7 @@ function projectIndexServerEndpoint(projectRoot, indexDir) {
|
|
|
4572
4575
|
if (process.platform === "win32") {
|
|
4573
4576
|
return `\\\\.\\pipe\\wrongstack-codebase-index-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}-${key}`;
|
|
4574
4577
|
}
|
|
4575
|
-
return path13.join(
|
|
4576
|
-
os3.tmpdir(),
|
|
4577
|
-
`wrongstack-codebase-index-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}`,
|
|
4578
|
-
`${key}.sock`
|
|
4579
|
-
);
|
|
4578
|
+
return path13.join(os3.tmpdir(), PROJECT_INDEX_SERVER_SOCKET_DIR, `${key}.sock`);
|
|
4580
4579
|
}
|
|
4581
4580
|
function projectIndexServerMetadataPath(projectRoot, indexDir) {
|
|
4582
4581
|
return path13.join(
|
|
@@ -4612,20 +4611,35 @@ var latestConnectionState = {
|
|
|
4612
4611
|
status: "offline",
|
|
4613
4612
|
connected: false
|
|
4614
4613
|
};
|
|
4615
|
-
function resolveProjectIndexDaemonAvailability() {
|
|
4614
|
+
function resolveProjectIndexDaemonAvailability(projectRoot, indexDir) {
|
|
4616
4615
|
if (process.env["WRONGSTACK_INDEX_INLINE"] || process.env["WRONGSTACK_INDEX_SERVER"] === "0") {
|
|
4617
4616
|
return { kind: "inline-requested" };
|
|
4618
4617
|
}
|
|
4618
|
+
let builtUrl = null;
|
|
4619
4619
|
for (const rel of ["./project-server.js", "./codebase-index/project-server.js"]) {
|
|
4620
4620
|
try {
|
|
4621
4621
|
const url = new URL(rel, import.meta.url);
|
|
4622
4622
|
if (url.protocol === "file:" && fs10.existsSync(fileURLToPath2(url))) {
|
|
4623
|
-
|
|
4623
|
+
builtUrl = url;
|
|
4624
|
+
break;
|
|
4624
4625
|
}
|
|
4625
4626
|
} catch {
|
|
4626
4627
|
}
|
|
4627
4628
|
}
|
|
4628
|
-
return { kind: "missing-build" };
|
|
4629
|
+
if (builtUrl === null) return { kind: "missing-build" };
|
|
4630
|
+
if (projectRoot !== void 0) {
|
|
4631
|
+
const endpoint = projectIndexServerEndpoint(projectRoot, indexDir);
|
|
4632
|
+
const check = checkUnixSocketPath(endpoint);
|
|
4633
|
+
if (!check.ok) {
|
|
4634
|
+
return {
|
|
4635
|
+
kind: "endpoint-invalid",
|
|
4636
|
+
endpoint,
|
|
4637
|
+
byteLength: check.byteLength,
|
|
4638
|
+
maxBytes: check.maxBytes
|
|
4639
|
+
};
|
|
4640
|
+
}
|
|
4641
|
+
}
|
|
4642
|
+
return { kind: "available", url: builtUrl };
|
|
4629
4643
|
}
|
|
4630
4644
|
function resolveProjectServerUrl() {
|
|
4631
4645
|
const availability = resolveProjectIndexDaemonAvailability();
|
|
@@ -5259,8 +5273,17 @@ function terminateWorker(reason) {
|
|
|
5259
5273
|
if (w) void w.terminate().catch(() => {
|
|
5260
5274
|
});
|
|
5261
5275
|
}
|
|
5276
|
+
var warnedInvalidEndpoints = /* @__PURE__ */ new Set();
|
|
5277
|
+
function warnEndpointInvalidOnce(availability) {
|
|
5278
|
+
if (warnedInvalidEndpoints.has(availability.endpoint)) return;
|
|
5279
|
+
warnedInvalidEndpoints.add(availability.endpoint);
|
|
5280
|
+
process.stderr.write(
|
|
5281
|
+
`codebase-index: socket path is ${availability.byteLength} bytes, over this platform's ${availability.maxBytes}-byte sun_path limit (${availability.endpoint}). Subsequent calls will reject until TMPDIR is shortened to restore the shared daemon.
|
|
5282
|
+
`
|
|
5283
|
+
);
|
|
5284
|
+
}
|
|
5262
5285
|
function callIndexOp(op, args, opts) {
|
|
5263
|
-
const availability = resolveProjectIndexDaemonAvailability();
|
|
5286
|
+
const availability = resolveProjectIndexDaemonAvailability(args.projectRoot, args.indexDir);
|
|
5264
5287
|
if (availability.kind === "available") {
|
|
5265
5288
|
return callProjectIndexServer(op, args, opts);
|
|
5266
5289
|
}
|
|
@@ -5271,6 +5294,14 @@ function callIndexOp(op, args, opts) {
|
|
|
5271
5294
|
)
|
|
5272
5295
|
);
|
|
5273
5296
|
}
|
|
5297
|
+
if (availability.kind === "endpoint-invalid") {
|
|
5298
|
+
warnEndpointInvalidOnce(availability);
|
|
5299
|
+
return Promise.reject(
|
|
5300
|
+
new Error(
|
|
5301
|
+
`codebase-index: socket path is ${availability.byteLength} bytes, over this platform's ${availability.maxBytes}-byte sun_path limit (${availability.endpoint}). Set a shorter TMPDIR to relocate the shared daemon, or set WRONGSTACK_INDEX_INLINE=1 to explicitly opt into a process-local index.`
|
|
5302
|
+
)
|
|
5303
|
+
);
|
|
5304
|
+
}
|
|
5274
5305
|
const w = ensureWorker();
|
|
5275
5306
|
if (!w) return callInline(op, args, opts);
|
|
5276
5307
|
if (opts.signal?.aborted) {
|