claude-memory-layer 2.5.0 → 2.5.1
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/.claude-plugin/plugin.json +1 -1
- package/dist/.claude-plugin/plugin.json +1 -1
- package/dist/cli/index.js +101 -57
- package/dist/cli/index.js.map +4 -4
- package/dist/core/index.js +72 -14
- package/dist/core/index.js.map +4 -4
- package/dist/hooks/codex-session-import-worker.js +1 -1
- package/dist/hooks/codex-session-start.js +4 -4
- package/dist/hooks/codex-user-prompt-submit.js +2 -2
- package/dist/hooks/post-tool-use.js +1 -1
- package/dist/hooks/semantic-daemon.js +1 -1
- package/dist/hooks/session-end-handler.js +1 -1
- package/dist/hooks/session-end.js +1 -1
- package/dist/hooks/session-start.js +4 -4
- package/dist/hooks/stop.js +1 -1
- package/dist/hooks/user-prompt-submit.js +2 -2
- package/dist/index.js +85 -27
- package/dist/index.js.map +4 -4
- package/dist/mcp/index.js +4 -4
- package/dist/server/api/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/codex-host-ingest.js +1 -1
- package/dist/services/lesson-host-service.js +1 -1
- package/dist/services/memory-service.js +1 -1
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -4481,7 +4481,7 @@ function emptyLatencyAggregate() {
|
|
|
4481
4481
|
return { count: 0, failedCount: 0, totalMs: 0, maxMs: 0 };
|
|
4482
4482
|
}
|
|
4483
4483
|
function runtimeVersion() {
|
|
4484
|
-
const value = "2.5.
|
|
4484
|
+
const value = "2.5.1"?.trim();
|
|
4485
4485
|
return sanitizeRuntimeVersion(value || "development");
|
|
4486
4486
|
}
|
|
4487
4487
|
function sanitizeRuntimeVersion(value) {
|
|
@@ -25385,20 +25385,77 @@ var SyncWorker = class {
|
|
|
25385
25385
|
|
|
25386
25386
|
// src/core/mongo-sync-worker.ts
|
|
25387
25387
|
import { randomUUID as randomUUID27 } from "crypto";
|
|
25388
|
-
import * as
|
|
25388
|
+
import * as os9 from "os";
|
|
25389
25389
|
import { MongoClient } from "mongodb";
|
|
25390
|
+
|
|
25391
|
+
// src/core/mongo-sync-config.ts
|
|
25392
|
+
import * as dns from "dns";
|
|
25393
|
+
import * as os8 from "os";
|
|
25394
|
+
var UNPARSEABLE_URI = "<unparseable MongoDB connection string>";
|
|
25395
|
+
function splitMongoUri(uri) {
|
|
25396
|
+
const match = /^([a-z][a-z0-9+.-]*:\/\/)(.*)$/is.exec(uri);
|
|
25397
|
+
if (!match) return null;
|
|
25398
|
+
const [, scheme, rest] = match;
|
|
25399
|
+
const authorityEnd = rest.search(/[/?]/);
|
|
25400
|
+
const authority = authorityEnd === -1 ? rest : rest.slice(0, authorityEnd);
|
|
25401
|
+
const remainder = authorityEnd === -1 ? "" : rest.slice(authorityEnd);
|
|
25402
|
+
if (remainder.includes("@") || authority.indexOf("@") !== authority.lastIndexOf("@")) return null;
|
|
25403
|
+
const atIdx = authority.indexOf("@");
|
|
25404
|
+
const creds = atIdx === -1 ? null : authority.slice(0, atIdx);
|
|
25405
|
+
const hosts = authority.slice(atIdx + 1);
|
|
25406
|
+
if (!hosts) return null;
|
|
25407
|
+
const colonIdx = creds?.indexOf(":") ?? -1;
|
|
25408
|
+
const queryIdx = remainder.indexOf("?");
|
|
25409
|
+
return {
|
|
25410
|
+
scheme,
|
|
25411
|
+
username: creds === null ? null : colonIdx === -1 ? creds : creds.slice(0, colonIdx),
|
|
25412
|
+
password: creds === null || colonIdx === -1 ? null : creds.slice(colonIdx + 1),
|
|
25413
|
+
hosts,
|
|
25414
|
+
path: queryIdx === -1 ? remainder : remainder.slice(0, queryIdx),
|
|
25415
|
+
query: queryIdx === -1 ? null : remainder.slice(queryIdx + 1)
|
|
25416
|
+
};
|
|
25417
|
+
}
|
|
25390
25418
|
function redactMongoUri(uri) {
|
|
25391
|
-
const
|
|
25392
|
-
if (
|
|
25393
|
-
const
|
|
25394
|
-
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25399
|
-
|
|
25400
|
-
|
|
25419
|
+
const parts = splitMongoUri(uri);
|
|
25420
|
+
if (!parts) return UNPARSEABLE_URI;
|
|
25421
|
+
const creds = parts.username === null ? "" : parts.password === null ? `${parts.username}@` : `${parts.username}:***@`;
|
|
25422
|
+
const query = parts.query === null ? "" : "?***";
|
|
25423
|
+
return `${parts.scheme}${creds}${parts.hosts}${parts.path}${query}`;
|
|
25424
|
+
}
|
|
25425
|
+
var PARSE_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
25426
|
+
"MongoParseError",
|
|
25427
|
+
"MongoInvalidArgumentError",
|
|
25428
|
+
"MongoAPIError",
|
|
25429
|
+
"MongoRuntimeError",
|
|
25430
|
+
"MongoMissingCredentialsError",
|
|
25431
|
+
"TypeError",
|
|
25432
|
+
"URIError"
|
|
25433
|
+
]);
|
|
25434
|
+
var PARSE_HINT = "connection string could not be parsed; percent-encode special characters in the password and check option names";
|
|
25435
|
+
var ERRNO_CODES = /* @__PURE__ */ new Set([
|
|
25436
|
+
...Object.keys(os8.constants.errno),
|
|
25437
|
+
...Object.values(dns).filter((value) => typeof value === "string" && /^E[A-Z_]+$/.test(value)),
|
|
25438
|
+
"EAI_AGAIN"
|
|
25439
|
+
]);
|
|
25440
|
+
function describeMongoConnectionError(error, uri) {
|
|
25441
|
+
const name = error instanceof Error ? error.name : "Error";
|
|
25442
|
+
if (!splitMongoUri(uri) || PARSE_ERROR_NAMES.has(name)) return `${name}: ${PARSE_HINT}`;
|
|
25443
|
+
const facts = connectionErrorFacts(error);
|
|
25444
|
+
return facts.length > 0 ? `${name} (${facts.join(", ")})` : name;
|
|
25445
|
+
}
|
|
25446
|
+
function connectionErrorFacts(error) {
|
|
25447
|
+
const facts = /* @__PURE__ */ new Set();
|
|
25448
|
+
let current = error;
|
|
25449
|
+
for (let depth = 0; depth < 5 && current instanceof Error; depth++) {
|
|
25450
|
+
const { code, codeName } = current;
|
|
25451
|
+
if (typeof code === "string" && ERRNO_CODES.has(code)) facts.add(code);
|
|
25452
|
+
if (typeof codeName === "string" && /^[A-Za-z]+$/.test(codeName)) facts.add(codeName);
|
|
25453
|
+
current = current.cause;
|
|
25454
|
+
}
|
|
25455
|
+
return [...facts];
|
|
25401
25456
|
}
|
|
25457
|
+
|
|
25458
|
+
// src/core/mongo-sync-worker.ts
|
|
25402
25459
|
function isRecord8(value) {
|
|
25403
25460
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25404
25461
|
}
|
|
@@ -25531,7 +25588,8 @@ var MongoSyncWorker = class {
|
|
|
25531
25588
|
this.events = this.db.collection("cml_events");
|
|
25532
25589
|
} catch (err) {
|
|
25533
25590
|
const safeUri = redactMongoUri(this.config.uri);
|
|
25534
|
-
|
|
25591
|
+
const reason = describeMongoConnectionError(err, this.config.uri);
|
|
25592
|
+
throw new Error(`MongoDB connection failed (${safeUri}, db=${this.config.dbName}): ${reason}`);
|
|
25535
25593
|
}
|
|
25536
25594
|
}
|
|
25537
25595
|
async disconnect() {
|
|
@@ -25592,7 +25650,7 @@ var MongoSyncWorker = class {
|
|
|
25592
25650
|
if (batch.length === 0) break;
|
|
25593
25651
|
const startSeq = await this.allocateSeqRange("events", batch.length);
|
|
25594
25652
|
const now = /* @__PURE__ */ new Date();
|
|
25595
|
-
const hostname2 =
|
|
25653
|
+
const hostname2 = os9.hostname();
|
|
25596
25654
|
const ops = batch.map((item, idx) => {
|
|
25597
25655
|
const event = item.event;
|
|
25598
25656
|
const seq = startSeq + idx;
|