@prom.codes/memory-mcp 0.11.1 → 0.11.2

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.
Files changed (2) hide show
  1. package/dist/bin.js +35 -8
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -1076,6 +1076,7 @@ var DEFAULT_BATCH4 = 100;
1076
1076
  var DEFAULT_BATCH_CHARS2 = 4e5;
1077
1077
  var DEFAULT_RETRIES4 = 4;
1078
1078
  var DEFAULT_BACKOFF4 = 250;
1079
+ var DEFAULT_TIMEOUT_MS2 = 15e3;
1079
1080
  function sleep4(ms, signal) {
1080
1081
  return new Promise((resolve3, reject) => {
1081
1082
  if (signal?.aborted === true) {
@@ -1108,6 +1109,7 @@ var PrometheusRerankProvider = class {
1108
1109
  #maxBatchChars;
1109
1110
  #maxRetries;
1110
1111
  #retryBaseMs;
1112
+ #timeoutMs;
1111
1113
  #fetch;
1112
1114
  #creditsUsed = 0;
1113
1115
  constructor(opts) {
@@ -1124,8 +1126,12 @@ var PrometheusRerankProvider = class {
1124
1126
  this.#url = `${(opts.baseUrl ?? DEFAULT_BASE2).replace(/\/+$/, "")}/rerank`;
1125
1127
  this.#batchSize = opts.batchSize ?? DEFAULT_BATCH4;
1126
1128
  this.#maxBatchChars = opts.maxBatchChars ?? DEFAULT_BATCH_CHARS2;
1129
+ if (opts.timeoutMs !== void 0 && (!Number.isInteger(opts.timeoutMs) || opts.timeoutMs < 0)) {
1130
+ throw new Error(`PrometheusRerankProvider: timeoutMs must be a non-negative integer (0 disables), got ${opts.timeoutMs}`);
1131
+ }
1127
1132
  this.#maxRetries = opts.maxRetries ?? DEFAULT_RETRIES4;
1128
1133
  this.#retryBaseMs = opts.retryBaseMs ?? DEFAULT_BACKOFF4;
1134
+ this.#timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
1129
1135
  this.#fetch = opts.fetch ?? fetch;
1130
1136
  }
1131
1137
  /** Cumulative credits charged across all rerank calls of this instance. */
@@ -1184,8 +1190,6 @@ var PrometheusRerankProvider = class {
1184
1190
  },
1185
1191
  body: JSON.stringify({ query, documents: batch.map((c) => c.text) })
1186
1192
  };
1187
- if (signal !== void 0)
1188
- init.signal = signal;
1189
1193
  const payload = await this.#requestJson(init, signal);
1190
1194
  if (payload?.ok !== true || !Array.isArray(payload.results)) {
1191
1195
  throw nonRetryable4("prometheus-rerank: malformed rerank response");
@@ -1217,8 +1221,25 @@ var PrometheusRerankProvider = class {
1217
1221
  let attempt = 0;
1218
1222
  let lastError = null;
1219
1223
  while (attempt <= this.#maxRetries) {
1224
+ const controller = new AbortController();
1225
+ let timedOut = false;
1226
+ let timer;
1227
+ if (this.#timeoutMs > 0) {
1228
+ timer = setTimeout(() => {
1229
+ timedOut = true;
1230
+ controller.abort();
1231
+ }, this.#timeoutMs);
1232
+ timer.unref?.();
1233
+ }
1234
+ const onParentAbort = () => controller.abort();
1235
+ if (signal !== void 0) {
1236
+ if (signal.aborted)
1237
+ controller.abort();
1238
+ else
1239
+ signal.addEventListener("abort", onParentAbort, { once: true });
1240
+ }
1220
1241
  try {
1221
- const res = await this.#fetch(this.#url, init);
1242
+ const res = await this.#fetch(this.#url, { ...init, signal: controller.signal });
1222
1243
  if (res.status >= 500 && res.status < 600) {
1223
1244
  lastError = new Error(`prometheus-rerank: HTTP ${res.status}`);
1224
1245
  attempt += 1;
@@ -1234,15 +1255,21 @@ var PrometheusRerankProvider = class {
1234
1255
  }
1235
1256
  return await res.json();
1236
1257
  } catch (err) {
1237
- if (err?.name === "AbortError")
1258
+ if (err?.name === "AbortError" && !timedOut)
1238
1259
  throw err;
1239
1260
  if (err?.nonRetryable === true)
1240
1261
  throw err;
1262
+ const retryErr = timedOut ? new Error(`prometheus-rerank: request timed out after ${this.#timeoutMs}ms`) : err;
1241
1263
  if (attempt >= this.#maxRetries)
1242
- throw err;
1243
- lastError = err;
1264
+ throw retryErr;
1265
+ lastError = retryErr;
1244
1266
  attempt += 1;
1245
1267
  await sleep4(this.#retryBaseMs * 2 ** (attempt - 1), signal);
1268
+ } finally {
1269
+ if (timer !== void 0)
1270
+ clearTimeout(timer);
1271
+ if (signal !== void 0)
1272
+ signal.removeEventListener("abort", onParentAbort);
1246
1273
  }
1247
1274
  }
1248
1275
  throw lastError instanceof Error ? lastError : new Error(`prometheus-rerank: exhausted ${this.#maxRetries} retries`);
@@ -3371,7 +3398,7 @@ ${f.value}`);
3371
3398
  embeddingsError = err instanceof Error ? err.message : String(err);
3372
3399
  }
3373
3400
  }
3374
- const update = await buildUpdateStatus("@prom.codes/memory-mcp", "0.11.1", { isDevBuild: false });
3401
+ const update = await buildUpdateStatus("@prom.codes/memory-mcp", "0.11.2", { isDevBuild: false });
3375
3402
  const summary = deps.rootIsHomeOrFsRoot ? `Memory at ${dbPath}: ${stats.total} records, but the workspace resolved to ${workspaceRoot} (home/root) \u2014 open a project folder so memories scope and mirror correctly.` : `Memory at ${dbPath}: ${stats.total} records for project "${projectName}".${update.updateAvailable === true ? ` Update available: ${update.current} \u2192 ${update.latest} (ask me to run update via the context server's update_servers tool).` : ""}`;
3376
3403
  return textResult({
3377
3404
  installed: true,
@@ -3407,7 +3434,7 @@ ${f.value}`);
3407
3434
  // dist/server.js
3408
3435
  var SERVER_IDENTITY = {
3409
3436
  name: "prometheus-memory-mcp",
3410
- version: "0.11.1",
3437
+ version: "0.11.2",
3411
3438
  title: "prom.codes Memory"
3412
3439
  };
3413
3440
  var SERVER_INSTRUCTIONS = "Persistent agent memory for this workspace \u2014 USE IT PROACTIVELY; the user will not tell you to. Protocol:\n1. ONE-TIME: if this workspace has no Prometheus memory rule yet, call memory_setup now (idempotent) so the protocol is installed into the runtime rule files and survives future sessions. (The server also auto-installs it on startup when a project rule file already exists \u2014 memory_setup covers the rest.)\n2. SESSION START: before any non-trivial task, call memory_read to recall facts, decisions and procedures from earlier sessions.\n3. DURING WORK: when the user states a durable preference, decision, correction or project fact, store it with memory_write (semantic for facts, procedural for how-tos) \u2014 without being asked.\n4. LOOK-UP: use memory_search for keyword recall when memory_read is not specific enough.\n5. SESSION END: consolidate what was learned with memory_capture.\nCall memory_status anytime to check what is stored and whether the rule is installed. Never store secrets, API keys or credentials \u2014 such writes are rejected.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prom.codes/memory-mcp",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "description": "prom.codes Memory — persistent, local-first agent memory as an MCP server.",
5
5
  "type": "module",
6
6
  "bin": {