@cortexkit/pi-magic-context 0.49.50 → 0.49.51
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/auto-search-worker.js +1 -1
- package/dist/{index-4ss8c8ky.js → index-babadndp.js} +22 -4
- package/dist/{index-38bm78h4.js → index-sm51c9bc.js} +1 -1
- package/dist/index.js +3779 -2020
- package/dist/{search-m61nenns.js → search-7w8m1snz.js} +1 -1
- package/dist/subagent-entry.js +2 -2
- package/package.json +3 -1
|
@@ -31,7 +31,7 @@ serveWorkerJobs(async (initial, port) => {
|
|
|
31
31
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
32
32
|
import("./storage-memory-0ndn65fm.js"),
|
|
33
33
|
import("./project-embedding-registry-hpca84nz.js"),
|
|
34
|
-
import("./search-
|
|
34
|
+
import("./search-7w8m1snz.js"),
|
|
35
35
|
import("./compartment-chunk-embedding-wg7emg3z.js"),
|
|
36
36
|
import("./embedding-activity-ew6dshfd.js"),
|
|
37
37
|
import("./harness-9872e0ym.js"),
|
|
@@ -1891,6 +1891,8 @@ function getDefaultSubcConnectionFile() {
|
|
|
1891
1891
|
var RERANK_MODEL = "gte-reranker-modernbert-base-f32";
|
|
1892
1892
|
var RERANK_LANE_LIMIT = 25;
|
|
1893
1893
|
var DEADLINE_MS = 1500;
|
|
1894
|
+
var SYNAPSE_RESTART_BACKOFF_MS = 30000;
|
|
1895
|
+
var SYNAPSE_ABSENT_BACKOFF_MS = 10 * 60000;
|
|
1894
1896
|
var DOCUMENT_BYTES = 1024;
|
|
1895
1897
|
var proseWordSegmenter = new Intl.Segmenter(undefined, { granularity: "word" });
|
|
1896
1898
|
function isProseQuery(query) {
|
|
@@ -2033,10 +2035,11 @@ async function bounded(promise) {
|
|
|
2033
2035
|
}
|
|
2034
2036
|
}
|
|
2035
2037
|
var connections = new Map;
|
|
2038
|
+
var synapseRetryAt = new Map;
|
|
2036
2039
|
async function connect(connectionFile) {
|
|
2037
2040
|
let connection = connections.get(connectionFile);
|
|
2038
2041
|
if (!connection) {
|
|
2039
|
-
connection = inRootAsyncContext2(() => SubcClient.connect({ connectionFile }));
|
|
2042
|
+
connection = inRootAsyncContext2(() => SubcClient.connect({ connectionFile, routeOpenRetryDeadlineMs: 0 }));
|
|
2040
2043
|
connections.set(connectionFile, connection);
|
|
2041
2044
|
connection.catch(() => connections.delete(connectionFile));
|
|
2042
2045
|
}
|
|
@@ -2106,24 +2109,39 @@ function remoteRerankSkipped(reason, onSkipped) {
|
|
|
2106
2109
|
logRerankFallback(safe);
|
|
2107
2110
|
onSkipped?.(line);
|
|
2108
2111
|
}
|
|
2109
|
-
async function prepareReranker(projectRoot, sessionId, connectionFile, injectedClient, config) {
|
|
2112
|
+
async function prepareReranker(projectRoot, sessionId, connectionFile, injectedClient, config, now = Date.now) {
|
|
2110
2113
|
if (config?.provider === "off")
|
|
2111
2114
|
return null;
|
|
2112
2115
|
if (config?.provider === "remote")
|
|
2113
2116
|
return { remote: config };
|
|
2117
|
+
const daemonFile = connectionFile ?? getDefaultSubcConnectionFile();
|
|
2118
|
+
const rememberAbsence = injectedClient === undefined;
|
|
2119
|
+
if (rememberAbsence && (synapseRetryAt.get(daemonFile) ?? 0) > now())
|
|
2120
|
+
return null;
|
|
2121
|
+
let catalogRequested = false;
|
|
2114
2122
|
try {
|
|
2115
2123
|
if (injectedClient === null)
|
|
2116
2124
|
throw new RerankFailure("missing_synapse");
|
|
2117
|
-
const client = injectedClient ?? await connect(
|
|
2125
|
+
const client = injectedClient ?? await connect(daemonFile);
|
|
2118
2126
|
const identity = {
|
|
2119
2127
|
project_root: projectRoot,
|
|
2120
2128
|
harness: "magic-context",
|
|
2121
2129
|
session: sessionId
|
|
2122
2130
|
};
|
|
2131
|
+
catalogRequested = true;
|
|
2123
2132
|
const lane = pinReranker(await bounded(client.call("synapse", "models.list", {}, { timeoutMs: DEADLINE_MS, targetKind: "management_surface", identity })));
|
|
2133
|
+
if (rememberAbsence)
|
|
2134
|
+
synapseRetryAt.delete(daemonFile);
|
|
2124
2135
|
return { client, lane, identity };
|
|
2125
2136
|
} catch (error) {
|
|
2126
|
-
|
|
2137
|
+
const reason = reasonOf(error);
|
|
2138
|
+
if (rememberAbsence && catalogRequested && reason === "unknown_module") {
|
|
2139
|
+
const failedAt = now();
|
|
2140
|
+
const previousRetryAt = synapseRetryAt.get(daemonFile);
|
|
2141
|
+
const backoff = previousRetryAt !== undefined && failedAt - previousRetryAt < SYNAPSE_ABSENT_BACKOFF_MS ? SYNAPSE_ABSENT_BACKOFF_MS : SYNAPSE_RESTART_BACKOFF_MS;
|
|
2142
|
+
synapseRetryAt.set(daemonFile, failedAt + backoff);
|
|
2143
|
+
}
|
|
2144
|
+
logRerankFallback(reason);
|
|
2127
2145
|
return null;
|
|
2128
2146
|
}
|
|
2129
2147
|
}
|