@context-engine-bridge/context-engine-mcp-bridge 0.0.12 → 0.0.13
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/package.json +1 -1
- package/src/resultPathMapping.js +14 -7
package/package.json
CHANGED
package/src/resultPathMapping.js
CHANGED
|
@@ -258,10 +258,16 @@ function remapHitPaths(hit, workspaceRoot) {
|
|
|
258
258
|
if (!containerPath && rawPath) {
|
|
259
259
|
containerPath = rawPath;
|
|
260
260
|
}
|
|
261
|
-
const relPath = computeWorkspaceRelativePath(containerPath, hostPath);
|
|
262
261
|
const out = { ...hit };
|
|
263
|
-
if
|
|
264
|
-
|
|
262
|
+
// Respect server's rel_path if already provided and non-empty; only compute if missing
|
|
263
|
+
const serverRelPath = typeof hit.rel_path === "string" ? hit.rel_path.trim() : "";
|
|
264
|
+
if (serverRelPath) {
|
|
265
|
+
out.rel_path = serverRelPath;
|
|
266
|
+
} else {
|
|
267
|
+
const relPath = computeWorkspaceRelativePath(containerPath, hostPath);
|
|
268
|
+
if (relPath) {
|
|
269
|
+
out.rel_path = relPath;
|
|
270
|
+
}
|
|
265
271
|
}
|
|
266
272
|
// Remap related_paths nested under each hit (repo_search/hybrid_search emit this per result).
|
|
267
273
|
try {
|
|
@@ -271,9 +277,10 @@ function remapHitPaths(hit, workspaceRoot) {
|
|
|
271
277
|
} catch {
|
|
272
278
|
// ignore
|
|
273
279
|
}
|
|
274
|
-
|
|
280
|
+
const finalRelPath = out.rel_path || "";
|
|
281
|
+
if (workspaceRoot && finalRelPath) {
|
|
275
282
|
try {
|
|
276
|
-
const relNative = _posixToNative(
|
|
283
|
+
const relNative = _posixToNative(finalRelPath);
|
|
277
284
|
const candidate = path.join(workspaceRoot, relNative);
|
|
278
285
|
const diagnostics = envTruthy(process.env.CTXCE_BRIDGE_PATH_DIAGNOSTICS, false);
|
|
279
286
|
const strictClientPath = envTruthy(process.env.CTXCE_BRIDGE_CLIENT_PATH_STRICT, false);
|
|
@@ -315,8 +322,8 @@ function remapHitPaths(hit, workspaceRoot) {
|
|
|
315
322
|
if (overridePath) {
|
|
316
323
|
if (typeof out.client_path === "string" && out.client_path) {
|
|
317
324
|
out.path = out.client_path;
|
|
318
|
-
} else if (
|
|
319
|
-
out.path =
|
|
325
|
+
} else if (finalRelPath) {
|
|
326
|
+
out.path = finalRelPath;
|
|
320
327
|
}
|
|
321
328
|
}
|
|
322
329
|
return out;
|