@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.
@@ -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-m61nenns.js"),
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(connectionFile ?? getDefaultSubcConnectionFile());
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
- logRerankFallback(reasonOf(error));
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
  }
@@ -134,7 +134,7 @@ import {
134
134
  resolveMemoriesByIdsForSearch2,
135
135
  unifiedSearch2,
136
136
  formatSearchResults2
137
- } from "./index-4ss8c8ky.js";
137
+ } from "./index-babadndp.js";
138
138
  import {
139
139
  TODO_STATUSES,
140
140
  TODO_PRIORITIES,