nexus-agents 8.42.0 → 8.42.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.
- package/dist/{ast-rule-runner-WZZIMBA4.js → ast-rule-runner-XDNUUATJ.js} +3 -3
- package/dist/{child-mcp-config-YWUQXUCD.js → child-mcp-config-GVIE47AB.js} +2 -2
- package/dist/{chunk-CGUFF47H.js → chunk-2QX52PCN.js} +2 -2
- package/dist/{chunk-HVQJRRZV.js → chunk-2YWZDKWU.js} +3 -3
- package/dist/{chunk-XJ33UMUQ.js → chunk-3GEOJIOH.js} +2 -2
- package/dist/{chunk-5JJHXRYB.js → chunk-4GSJ3VEK.js} +2 -2
- package/dist/{chunk-Q6MMQJCR.js → chunk-54VOT6BS.js} +3 -3
- package/dist/{chunk-SCIVDNY5.js → chunk-5WMWO6FP.js} +2 -2
- package/dist/{chunk-UOR2YWRA.js → chunk-6KHUREWG.js} +4 -4
- package/dist/{chunk-IVHR3QEK.js → chunk-77LIYHB3.js} +2 -2
- package/dist/{chunk-X6JRNYXF.js → chunk-AP2UGW5H.js} +2 -2
- package/dist/{chunk-FJRVJZSZ.js → chunk-BOQDD57B.js} +5 -5
- package/dist/{chunk-5HOMEIBV.js → chunk-DCDH2Y5M.js} +7 -7
- package/dist/{chunk-FQUSU2QZ.js → chunk-FFF55CF2.js} +6 -6
- package/dist/{chunk-MZIZ2HLF.js → chunk-FG5R43DC.js} +2 -2
- package/dist/{chunk-WBU27C3E.js → chunk-GC5P7ITJ.js} +7 -7
- package/dist/{chunk-Q2NGSVGI.js → chunk-IUOV5HHS.js} +8 -8
- package/dist/{chunk-O6IFENDU.js → chunk-JELX34GE.js} +2 -2
- package/dist/{chunk-YSR3YBI3.js → chunk-JMFEI2VQ.js} +2 -2
- package/dist/{chunk-6X6CJFL5.js → chunk-JQIUIQNW.js} +3 -3
- package/dist/{chunk-BLK2BXWT.js → chunk-K76FW2WI.js} +2 -2
- package/dist/{chunk-7FA6RW5Z.js → chunk-KOC6XT7R.js} +199 -78
- package/dist/chunk-KOC6XT7R.js.map +1 -0
- package/dist/{chunk-UDSIIRAE.js → chunk-MBZ4KBSM.js} +2 -2
- package/dist/{chunk-2EHPCU5R.js → chunk-RCVWWGD5.js} +4 -4
- package/dist/{chunk-HNYF3DFW.js → chunk-U4GAVGTT.js} +5 -5
- package/dist/{chunk-BE44TREE.js → chunk-U4MYND3S.js} +2 -2
- package/dist/{chunk-ZMPQVOAO.js → chunk-UBMZB5LV.js} +2 -2
- package/dist/{chunk-WFW4LX3N.js → chunk-UXQDDA2L.js} +36 -36
- package/dist/{chunk-XKMCPYW4.js → chunk-UZ7XL4OG.js} +4 -4
- package/dist/{chunk-O6IUVD3H.js → chunk-V2OB4NGL.js} +2 -2
- package/dist/{chunk-L5DQZ2G6.js → chunk-VIXTMS4E.js} +2 -2
- package/dist/{chunk-3LLTMGAU.js → chunk-WKGKKQIM.js} +9 -9
- package/dist/{chunk-6BWON54Q.js → chunk-WQIF4VDP.js} +2 -2
- package/dist/{chunk-HYESPHTE.js → chunk-Y7AKWQ32.js} +2 -2
- package/dist/{chunk-E7HUVU7E.js → chunk-Z7POHKXD.js} +3 -3
- package/dist/{chunk-ZUT3ECXF.js → chunk-ZOFQJNCS.js} +2 -2
- package/dist/{cli-circuit-breaker-436JMUYX.js → cli-circuit-breaker-BCLBBOS3.js} +3 -3
- package/dist/cli.js +87 -64
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-M6KZPW2Z.js → composite-router-ZL3R473T.js} +2 -2
- package/dist/{consensus-vote-CHT7XUMY.js → consensus-vote-AMIZFUPK.js} +17 -17
- package/dist/{context-retriever-BUJTL44B.js → context-retriever-Z6BHZKKG.js} +8 -8
- package/dist/{doctor-deep-U7AGOMDC.js → doctor-deep-5NE7QKMY.js} +3 -3
- package/dist/{doctor-live-OOY2TU3U.js → doctor-live-JXSTHE2Z.js} +9 -9
- package/dist/{expert-bridge-62VVOJO7.js → expert-bridge-PJQPAWZM.js} +4 -4
- package/dist/{factory-GIIZN7RZ.js → factory-25AA6KZD.js} +5 -5
- package/dist/{factory-EVGP6LYX.js → factory-VHNM2JBC.js} +9 -9
- package/dist/{improvement-review-SDXZS3GY.js → improvement-review-VJUYFGPH.js} +6 -6
- package/dist/index.js +31 -31
- package/dist/{init-opencode-AP62A77A.js → init-opencode-H2DKPOV4.js} +6 -6
- package/dist/issue-triage-GQ2FBT57.js +17 -0
- package/dist/{pr-reviewer-helpers-4RAI27NR.js → pr-reviewer-helpers-LFFJ5XBW.js} +4 -4
- package/dist/{registry-command-YPAHH22Y.js → registry-command-LVQC2JRE.js} +2 -2
- package/dist/{repo-security-plan-CJCYXEKZ.js → repo-security-plan-TOSB7SWB.js} +3 -3
- package/dist/{research-helpers-synthesize-NVGOFFXI.js → research-helpers-synthesize-GOM3IWPN.js} +4 -4
- package/dist/{routing-memory-EJNTUVBI.js → routing-memory-4VJMGVM3.js} +2 -2
- package/dist/{session-memory-6GOBKFSF.js → session-memory-G2OCK3Y3.js} +3 -3
- package/dist/{setup-config-UR6ZWP2Y.js → setup-config-3CTPCNPS.js} +3 -3
- package/dist/{setup-custom-api-JJ2NMZNY.js → setup-custom-api-QKYNNWKU.js} +4 -4
- package/dist/setup-data-dir-DZPYOR3M.js +29 -0
- package/dist/{tool-memory-XSZKIUZT.js → tool-memory-YBG63GON.js} +5 -5
- package/dist/{unified-registry-VYW7GV56.js → unified-registry-GYJ4TAAP.js} +10 -10
- package/dist/{weather-report-LYVMS2TV.js → weather-report-DEQBWMMT.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-7FA6RW5Z.js.map +0 -1
- package/dist/issue-triage-JEYSHESO.js +0 -17
- package/dist/setup-data-dir-7D4PZTP2.js +0 -29
- /package/dist/{ast-rule-runner-WZZIMBA4.js.map → ast-rule-runner-XDNUUATJ.js.map} +0 -0
- /package/dist/{child-mcp-config-YWUQXUCD.js.map → child-mcp-config-GVIE47AB.js.map} +0 -0
- /package/dist/{chunk-CGUFF47H.js.map → chunk-2QX52PCN.js.map} +0 -0
- /package/dist/{chunk-HVQJRRZV.js.map → chunk-2YWZDKWU.js.map} +0 -0
- /package/dist/{chunk-XJ33UMUQ.js.map → chunk-3GEOJIOH.js.map} +0 -0
- /package/dist/{chunk-5JJHXRYB.js.map → chunk-4GSJ3VEK.js.map} +0 -0
- /package/dist/{chunk-Q6MMQJCR.js.map → chunk-54VOT6BS.js.map} +0 -0
- /package/dist/{chunk-SCIVDNY5.js.map → chunk-5WMWO6FP.js.map} +0 -0
- /package/dist/{chunk-UOR2YWRA.js.map → chunk-6KHUREWG.js.map} +0 -0
- /package/dist/{chunk-IVHR3QEK.js.map → chunk-77LIYHB3.js.map} +0 -0
- /package/dist/{chunk-X6JRNYXF.js.map → chunk-AP2UGW5H.js.map} +0 -0
- /package/dist/{chunk-FJRVJZSZ.js.map → chunk-BOQDD57B.js.map} +0 -0
- /package/dist/{chunk-5HOMEIBV.js.map → chunk-DCDH2Y5M.js.map} +0 -0
- /package/dist/{chunk-FQUSU2QZ.js.map → chunk-FFF55CF2.js.map} +0 -0
- /package/dist/{chunk-MZIZ2HLF.js.map → chunk-FG5R43DC.js.map} +0 -0
- /package/dist/{chunk-WBU27C3E.js.map → chunk-GC5P7ITJ.js.map} +0 -0
- /package/dist/{chunk-Q2NGSVGI.js.map → chunk-IUOV5HHS.js.map} +0 -0
- /package/dist/{chunk-O6IFENDU.js.map → chunk-JELX34GE.js.map} +0 -0
- /package/dist/{chunk-YSR3YBI3.js.map → chunk-JMFEI2VQ.js.map} +0 -0
- /package/dist/{chunk-6X6CJFL5.js.map → chunk-JQIUIQNW.js.map} +0 -0
- /package/dist/{chunk-BLK2BXWT.js.map → chunk-K76FW2WI.js.map} +0 -0
- /package/dist/{chunk-UDSIIRAE.js.map → chunk-MBZ4KBSM.js.map} +0 -0
- /package/dist/{chunk-2EHPCU5R.js.map → chunk-RCVWWGD5.js.map} +0 -0
- /package/dist/{chunk-HNYF3DFW.js.map → chunk-U4GAVGTT.js.map} +0 -0
- /package/dist/{chunk-BE44TREE.js.map → chunk-U4MYND3S.js.map} +0 -0
- /package/dist/{chunk-ZMPQVOAO.js.map → chunk-UBMZB5LV.js.map} +0 -0
- /package/dist/{chunk-WFW4LX3N.js.map → chunk-UXQDDA2L.js.map} +0 -0
- /package/dist/{chunk-XKMCPYW4.js.map → chunk-UZ7XL4OG.js.map} +0 -0
- /package/dist/{chunk-O6IUVD3H.js.map → chunk-V2OB4NGL.js.map} +0 -0
- /package/dist/{chunk-L5DQZ2G6.js.map → chunk-VIXTMS4E.js.map} +0 -0
- /package/dist/{chunk-3LLTMGAU.js.map → chunk-WKGKKQIM.js.map} +0 -0
- /package/dist/{chunk-6BWON54Q.js.map → chunk-WQIF4VDP.js.map} +0 -0
- /package/dist/{chunk-HYESPHTE.js.map → chunk-Y7AKWQ32.js.map} +0 -0
- /package/dist/{chunk-E7HUVU7E.js.map → chunk-Z7POHKXD.js.map} +0 -0
- /package/dist/{chunk-ZUT3ECXF.js.map → chunk-ZOFQJNCS.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-436JMUYX.js.map → cli-circuit-breaker-BCLBBOS3.js.map} +0 -0
- /package/dist/{composite-router-M6KZPW2Z.js.map → composite-router-ZL3R473T.js.map} +0 -0
- /package/dist/{consensus-vote-CHT7XUMY.js.map → consensus-vote-AMIZFUPK.js.map} +0 -0
- /package/dist/{context-retriever-BUJTL44B.js.map → context-retriever-Z6BHZKKG.js.map} +0 -0
- /package/dist/{doctor-deep-U7AGOMDC.js.map → doctor-deep-5NE7QKMY.js.map} +0 -0
- /package/dist/{doctor-live-OOY2TU3U.js.map → doctor-live-JXSTHE2Z.js.map} +0 -0
- /package/dist/{expert-bridge-62VVOJO7.js.map → expert-bridge-PJQPAWZM.js.map} +0 -0
- /package/dist/{factory-EVGP6LYX.js.map → factory-25AA6KZD.js.map} +0 -0
- /package/dist/{factory-GIIZN7RZ.js.map → factory-VHNM2JBC.js.map} +0 -0
- /package/dist/{improvement-review-SDXZS3GY.js.map → improvement-review-VJUYFGPH.js.map} +0 -0
- /package/dist/{init-opencode-AP62A77A.js.map → init-opencode-H2DKPOV4.js.map} +0 -0
- /package/dist/{issue-triage-JEYSHESO.js.map → issue-triage-GQ2FBT57.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-4RAI27NR.js.map → pr-reviewer-helpers-LFFJ5XBW.js.map} +0 -0
- /package/dist/{registry-command-YPAHH22Y.js.map → registry-command-LVQC2JRE.js.map} +0 -0
- /package/dist/{repo-security-plan-CJCYXEKZ.js.map → repo-security-plan-TOSB7SWB.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-NVGOFFXI.js.map → research-helpers-synthesize-GOM3IWPN.js.map} +0 -0
- /package/dist/{routing-memory-EJNTUVBI.js.map → routing-memory-4VJMGVM3.js.map} +0 -0
- /package/dist/{session-memory-6GOBKFSF.js.map → session-memory-G2OCK3Y3.js.map} +0 -0
- /package/dist/{setup-config-UR6ZWP2Y.js.map → setup-config-3CTPCNPS.js.map} +0 -0
- /package/dist/{setup-custom-api-JJ2NMZNY.js.map → setup-custom-api-QKYNNWKU.js.map} +0 -0
- /package/dist/{setup-data-dir-7D4PZTP2.js.map → setup-data-dir-DZPYOR3M.js.map} +0 -0
- /package/dist/{tool-memory-XSZKIUZT.js.map → tool-memory-YBG63GON.js.map} +0 -0
- /package/dist/{unified-registry-VYW7GV56.js.map → unified-registry-GYJ4TAAP.js.map} +0 -0
- /package/dist/{weather-report-LYVMS2TV.js.map → weather-report-DEQBWMMT.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-7LP6VJRP.js";
|
|
6
6
|
import {
|
|
7
7
|
SessionMemory
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JMFEI2VQ.js";
|
|
9
9
|
import {
|
|
10
10
|
StatsOnlyAdapter,
|
|
11
11
|
ensureSharedMemoryRegistry
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-YYJFZ7TO.js";
|
|
16
16
|
import {
|
|
17
17
|
generateId
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VIXTMS4E.js";
|
|
19
19
|
import {
|
|
20
20
|
ErrorCode,
|
|
21
21
|
NexusError,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
ok,
|
|
30
30
|
openSqliteDatabase,
|
|
31
31
|
setSharedMobiMemDbPathResolver
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-Z7POHKXD.js";
|
|
33
33
|
import {
|
|
34
34
|
nexusDataPath
|
|
35
35
|
} from "./chunk-JVNJJ2VL.js";
|
|
@@ -719,13 +719,13 @@ var HindsightBeliefMemory = class {
|
|
|
719
719
|
domainIndex = /* @__PURE__ */ new Map();
|
|
720
720
|
config;
|
|
721
721
|
logger;
|
|
722
|
-
constructor(config,
|
|
722
|
+
constructor(config, logger8) {
|
|
723
723
|
const validation = BeliefMemoryConfigSchema.safeParse(config ?? {});
|
|
724
724
|
if (!validation.success) {
|
|
725
725
|
throw new MemoryError(`Invalid BeliefMemoryConfig: ${formatZodError(validation.error)}`);
|
|
726
726
|
}
|
|
727
727
|
this.config = { ...DEFAULT_BELIEF_CONFIG, ...config };
|
|
728
|
-
this.logger =
|
|
728
|
+
this.logger = logger8 ?? createLogger({ component: "HindsightBeliefMemory" });
|
|
729
729
|
this.logger.info("HindsightBeliefMemory initialized", { config: this.config });
|
|
730
730
|
}
|
|
731
731
|
get auditStores() {
|
|
@@ -1192,9 +1192,9 @@ import { z as z6 } from "zod";
|
|
|
1192
1192
|
import * as fs from "node:fs";
|
|
1193
1193
|
import * as path from "node:path";
|
|
1194
1194
|
var MemoryMarkdownHelper = class {
|
|
1195
|
-
constructor(markdownDir,
|
|
1195
|
+
constructor(markdownDir, logger8) {
|
|
1196
1196
|
this.markdownDir = markdownDir;
|
|
1197
|
-
this.logger =
|
|
1197
|
+
this.logger = logger8;
|
|
1198
1198
|
}
|
|
1199
1199
|
markdownDir;
|
|
1200
1200
|
logger;
|
|
@@ -1334,7 +1334,7 @@ function rowToEntry(row) {
|
|
|
1334
1334
|
function sanitizeFtsQuery(query) {
|
|
1335
1335
|
return query.replace(/[*:^"(){}[\]]/g, " ").replace(/\bAND\b/gi, " ").replace(/\bOR\b/gi, " ").replace(/\bNOT\b/gi, " ").replace(/\bNEAR\b/gi, " ").replace(/\s+/g, " ").trim();
|
|
1336
1336
|
}
|
|
1337
|
-
function cleanupExpiredEntries(rows, database, autoExpire,
|
|
1337
|
+
function cleanupExpiredEntries(rows, database, autoExpire, logger8) {
|
|
1338
1338
|
const now = getTimeProvider().now();
|
|
1339
1339
|
const entries = [];
|
|
1340
1340
|
const expiredKeys = [];
|
|
@@ -1350,7 +1350,7 @@ function cleanupExpiredEntries(rows, database, autoExpire, logger7) {
|
|
|
1350
1350
|
`DELETE FROM memories WHERE key IN (${expiredKeys.map(() => "?").join(",")})`
|
|
1351
1351
|
);
|
|
1352
1352
|
deleteStmt.run(...expiredKeys);
|
|
1353
|
-
|
|
1353
|
+
logger8.debug("Auto-expired memories", { count: expiredKeys.length });
|
|
1354
1354
|
}
|
|
1355
1355
|
return { entries, expiredCount: expiredKeys.length };
|
|
1356
1356
|
}
|
|
@@ -1364,24 +1364,24 @@ function countMemories(database) {
|
|
|
1364
1364
|
return err(new MemoryError("Failed to count memories", { cause: causeError }));
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
|
-
function expireAllEntries(database,
|
|
1367
|
+
function expireAllEntries(database, logger8) {
|
|
1368
1368
|
try {
|
|
1369
1369
|
const stmt = database.prepare(
|
|
1370
1370
|
"DELETE FROM memories WHERE expires_at IS NOT NULL AND expires_at < ?"
|
|
1371
1371
|
);
|
|
1372
1372
|
const result = stmt.run(getTimeProvider().now());
|
|
1373
|
-
|
|
1373
|
+
logger8.info("Expired memories", { count: result.changes });
|
|
1374
1374
|
return ok(result.changes);
|
|
1375
1375
|
} catch (error) {
|
|
1376
1376
|
const causeError = error instanceof Error ? error : new Error(String(error));
|
|
1377
1377
|
return err(new MemoryError("Failed to expire memories", { cause: causeError }));
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
1380
|
-
function pruneOldEntries(database, olderThan,
|
|
1380
|
+
function pruneOldEntries(database, olderThan, logger8) {
|
|
1381
1381
|
try {
|
|
1382
1382
|
const stmt = database.prepare("DELETE FROM memories WHERE created_at < ?");
|
|
1383
1383
|
const result = stmt.run(olderThan.getTime());
|
|
1384
|
-
|
|
1384
|
+
logger8.info("Pruned old memories", {
|
|
1385
1385
|
olderThan: olderThan.toISOString(),
|
|
1386
1386
|
count: result.changes
|
|
1387
1387
|
});
|
|
@@ -1738,18 +1738,51 @@ function safeJsonParse(json, fallback, context) {
|
|
|
1738
1738
|
return fallback;
|
|
1739
1739
|
}
|
|
1740
1740
|
}
|
|
1741
|
+
function parseMetadata(row) {
|
|
1742
|
+
let raw;
|
|
1743
|
+
try {
|
|
1744
|
+
raw = JSON.parse(row.metadata);
|
|
1745
|
+
} catch (error) {
|
|
1746
|
+
return err({
|
|
1747
|
+
key: row.key,
|
|
1748
|
+
reason: "metadata_not_json",
|
|
1749
|
+
detail: error instanceof Error ? error.message : String(error)
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
const parsed = MemoryMetadataSchema.loose().safeParse(raw);
|
|
1753
|
+
if (!parsed.success) {
|
|
1754
|
+
return err({
|
|
1755
|
+
key: row.key,
|
|
1756
|
+
reason: "metadata_wrong_shape",
|
|
1757
|
+
detail: parsed.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ")
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
const { importance, tags, ttl, ...rest } = parsed.data;
|
|
1761
|
+
const metadata = {
|
|
1762
|
+
...rest,
|
|
1763
|
+
importance,
|
|
1764
|
+
...tags !== void 0 && { tags },
|
|
1765
|
+
...ttl !== void 0 && { ttl }
|
|
1766
|
+
};
|
|
1767
|
+
return ok(metadata);
|
|
1768
|
+
}
|
|
1741
1769
|
function memoryRowToEntry(row) {
|
|
1742
|
-
|
|
1770
|
+
const metadata = parseMetadata(row);
|
|
1771
|
+
if (!metadata.ok) {
|
|
1772
|
+
logger.warn("Unreadable metadata in memory database row", {
|
|
1773
|
+
key: row.key,
|
|
1774
|
+
reason: metadata.error.reason,
|
|
1775
|
+
detail: metadata.error.detail
|
|
1776
|
+
});
|
|
1777
|
+
return metadata;
|
|
1778
|
+
}
|
|
1779
|
+
return ok({
|
|
1743
1780
|
key: row.key,
|
|
1744
1781
|
value: safeJsonParse(row.value, row.value, `value for key="${row.key}"`),
|
|
1745
|
-
metadata:
|
|
1746
|
-
row.metadata,
|
|
1747
|
-
{ importance: MemoryImportance.MEDIUM },
|
|
1748
|
-
`metadata for key="${row.key}"`
|
|
1749
|
-
),
|
|
1782
|
+
metadata: metadata.value,
|
|
1750
1783
|
createdAt: new Date(row.created_at),
|
|
1751
1784
|
accessedAt: new Date(row.accessed_at)
|
|
1752
|
-
};
|
|
1785
|
+
});
|
|
1753
1786
|
}
|
|
1754
1787
|
function memoryExists(db, key) {
|
|
1755
1788
|
const stmt = db.prepare(
|
|
@@ -1761,7 +1794,10 @@ function memoryExists(db, key) {
|
|
|
1761
1794
|
function getMemoryEntry(db, key) {
|
|
1762
1795
|
const stmt = db.prepare("SELECT * FROM memories WHERE key = ?");
|
|
1763
1796
|
const row = stmt.get(key);
|
|
1764
|
-
|
|
1797
|
+
if (row === void 0) return err({ kind: "not_found", key });
|
|
1798
|
+
const entry = memoryRowToEntry(row);
|
|
1799
|
+
if (!entry.ok) return err({ kind: "unreadable", unreadable: entry.error });
|
|
1800
|
+
return entry;
|
|
1765
1801
|
}
|
|
1766
1802
|
function getMemoryRow(db, key) {
|
|
1767
1803
|
const stmt = db.prepare("SELECT * FROM memories WHERE key = ?");
|
|
@@ -1773,6 +1809,7 @@ function getAllMemoryRows(db, limit) {
|
|
|
1773
1809
|
}
|
|
1774
1810
|
|
|
1775
1811
|
// src/context/graph-memory-helpers.ts
|
|
1812
|
+
var logger2 = createLogger({ component: "GraphMemoryHelpers" });
|
|
1776
1813
|
var CREATE_EDGES_TABLE_SQL = `
|
|
1777
1814
|
CREATE TABLE IF NOT EXISTS graph_edges (
|
|
1778
1815
|
from_key TEXT NOT NULL,
|
|
@@ -1866,6 +1903,21 @@ function buildTraversalResult(entry, depth, path4, edge) {
|
|
|
1866
1903
|
}
|
|
1867
1904
|
return { entry, depth, path: path4 };
|
|
1868
1905
|
}
|
|
1906
|
+
function lookUpVisitedNode(db, current) {
|
|
1907
|
+
const looked = getMemoryEntry(db, current.key);
|
|
1908
|
+
if (looked.ok) {
|
|
1909
|
+
return buildTraversalResult(looked.value, current.depth, current.path, current.edge);
|
|
1910
|
+
}
|
|
1911
|
+
noteSkippedNode(current.key, looked.error);
|
|
1912
|
+
return void 0;
|
|
1913
|
+
}
|
|
1914
|
+
function noteSkippedNode(key, failure) {
|
|
1915
|
+
if (failure.kind !== "unreadable") return;
|
|
1916
|
+
logger2.warn("Graph traversal skipped a node with unreadable metadata", {
|
|
1917
|
+
key,
|
|
1918
|
+
reason: failure.unreadable.reason
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1869
1921
|
function bfsTraverse(config) {
|
|
1870
1922
|
const { db, startKey, opts } = config;
|
|
1871
1923
|
const state = {
|
|
@@ -1877,10 +1929,8 @@ function bfsTraverse(config) {
|
|
|
1877
1929
|
const current = state.queue.shift();
|
|
1878
1930
|
if (current === void 0) break;
|
|
1879
1931
|
if (current.depth > 0 || opts.includeStart) {
|
|
1880
|
-
const
|
|
1881
|
-
if (
|
|
1882
|
-
state.results.push(buildTraversalResult(entry, current.depth, current.path, current.edge));
|
|
1883
|
-
}
|
|
1932
|
+
const result = lookUpVisitedNode(db, current);
|
|
1933
|
+
if (result !== void 0) state.results.push(result);
|
|
1884
1934
|
}
|
|
1885
1935
|
if (current.depth >= opts.maxDepth) continue;
|
|
1886
1936
|
const edges = getEdgesForKey({ db, key: current.key, direction: opts.direction });
|
|
@@ -1920,7 +1970,7 @@ function findShortestPath(db, from, to, opts) {
|
|
|
1920
1970
|
}
|
|
1921
1971
|
|
|
1922
1972
|
// src/context/graph-memory.ts
|
|
1923
|
-
var
|
|
1973
|
+
var logger3 = createLogger({ component: "GraphMemoryBackend" });
|
|
1924
1974
|
var GraphMemoryBackend = class {
|
|
1925
1975
|
config;
|
|
1926
1976
|
log;
|
|
@@ -1935,7 +1985,7 @@ var GraphMemoryBackend = class {
|
|
|
1935
1985
|
throw new MemoryError(`Invalid GraphMemoryBackend config: ${msg}`);
|
|
1936
1986
|
}
|
|
1937
1987
|
this.config = { ...DEFAULT_GRAPH_MEMORY_CONFIG, ...config };
|
|
1938
|
-
this.log =
|
|
1988
|
+
this.log = logger3;
|
|
1939
1989
|
this.base = new HybridMemoryBackend({ dbPath: config.dbPath, markdownDir: config.markdownDir });
|
|
1940
1990
|
}
|
|
1941
1991
|
async initialize() {
|
|
@@ -2431,7 +2481,7 @@ function mergeLinkingConfig(partial) {
|
|
|
2431
2481
|
}
|
|
2432
2482
|
|
|
2433
2483
|
// src/context/agentic-memory-db-helpers.ts
|
|
2434
|
-
var
|
|
2484
|
+
var logger4 = createLogger({ component: "AgenticMemoryDbHelpers" });
|
|
2435
2485
|
function safeExtractAttributes(amem) {
|
|
2436
2486
|
if (!Array.isArray(amem.keywords) || amem.attributesUpdatedAt === void 0) return null;
|
|
2437
2487
|
const updatedAt = amem.attributesUpdatedAt;
|
|
@@ -2451,17 +2501,36 @@ function parseAmemAttributes(metadata) {
|
|
|
2451
2501
|
return safeExtractAttributes(meta.amem);
|
|
2452
2502
|
}
|
|
2453
2503
|
function memoryRowToAgenticEntry(row, extractionConfig) {
|
|
2454
|
-
const
|
|
2504
|
+
const converted = memoryRowToEntry(row);
|
|
2505
|
+
if (!converted.ok) return converted;
|
|
2506
|
+
const baseEntry = converted.value;
|
|
2455
2507
|
let parsedMeta = {};
|
|
2456
2508
|
try {
|
|
2457
2509
|
parsedMeta = JSON.parse(row.metadata);
|
|
2458
2510
|
} catch {
|
|
2459
|
-
|
|
2511
|
+
logger4.warn("Corrupt metadata JSON in memory row, using fallback extraction", {
|
|
2460
2512
|
key: row.key
|
|
2461
2513
|
});
|
|
2462
2514
|
}
|
|
2463
2515
|
const attributes = parseAmemAttributes(parsedMeta) ?? extractAttributes(baseEntry.value, extractionConfig);
|
|
2464
|
-
return { ...baseEntry, attributes };
|
|
2516
|
+
return ok({ ...baseEntry, attributes });
|
|
2517
|
+
}
|
|
2518
|
+
function collectReadable(rows, extractionConfig, context) {
|
|
2519
|
+
const entries = [];
|
|
2520
|
+
const skipped = [];
|
|
2521
|
+
for (const row of rows) {
|
|
2522
|
+
const converted = memoryRowToAgenticEntry(row, extractionConfig);
|
|
2523
|
+
if (converted.ok) entries.push(converted.value);
|
|
2524
|
+
else skipped.push(converted.error.key);
|
|
2525
|
+
}
|
|
2526
|
+
if (skipped.length > 0) {
|
|
2527
|
+
logger4.warn("Skipped memory rows with unreadable metadata", {
|
|
2528
|
+
context,
|
|
2529
|
+
skipped: skipped.length,
|
|
2530
|
+
keys: skipped
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
return entries;
|
|
2465
2534
|
}
|
|
2466
2535
|
function searchWithAttributes(db, query, limit, extractionConfig) {
|
|
2467
2536
|
const sanitized = query.replace(/[*()":^]/g, "").replace(/\s+/g, " ").trim();
|
|
@@ -2472,7 +2541,7 @@ function searchWithAttributes(db, query, limit, extractionConfig) {
|
|
|
2472
2541
|
WHERE memories_fts MATCH ? ORDER BY rank LIMIT ?
|
|
2473
2542
|
`);
|
|
2474
2543
|
const rows = stmt.all(sanitized, limit);
|
|
2475
|
-
return rows
|
|
2544
|
+
return collectReadable(rows, extractionConfig, "searchWithAttributes");
|
|
2476
2545
|
}
|
|
2477
2546
|
function getAttributeSet(attrs, type) {
|
|
2478
2547
|
switch (type) {
|
|
@@ -2489,7 +2558,7 @@ function getAttributesFromRow(row, extractionConfig) {
|
|
|
2489
2558
|
try {
|
|
2490
2559
|
meta = JSON.parse(row.metadata);
|
|
2491
2560
|
} catch {
|
|
2492
|
-
|
|
2561
|
+
logger4.warn("Corrupt metadata JSON in getAttributesFromRow, using value extraction", {
|
|
2493
2562
|
key: row.key
|
|
2494
2563
|
});
|
|
2495
2564
|
}
|
|
@@ -2501,7 +2570,7 @@ function getAttributesFromRow(row, extractionConfig) {
|
|
|
2501
2570
|
try {
|
|
2502
2571
|
parsedValue = JSON.parse(row.value);
|
|
2503
2572
|
} catch {
|
|
2504
|
-
|
|
2573
|
+
logger4.warn("Corrupt value JSON in getAttributesFromRow, using raw string", {
|
|
2505
2574
|
key: row.key
|
|
2506
2575
|
});
|
|
2507
2576
|
}
|
|
@@ -2509,13 +2578,26 @@ function getAttributesFromRow(row, extractionConfig) {
|
|
|
2509
2578
|
}
|
|
2510
2579
|
function findMatchingMemories(rows, sourceSet, attributeType, extractionConfig) {
|
|
2511
2580
|
const matches = [];
|
|
2581
|
+
const skipped = [];
|
|
2512
2582
|
for (const row of rows) {
|
|
2513
2583
|
const attrs = getAttributesFromRow(row, extractionConfig);
|
|
2514
2584
|
const targetSet = getAttributeSet(attrs, attributeType);
|
|
2515
2585
|
let overlap = 0;
|
|
2516
2586
|
for (const item of sourceSet) if (targetSet.has(item)) overlap++;
|
|
2517
|
-
if (overlap
|
|
2518
|
-
|
|
2587
|
+
if (overlap === 0) continue;
|
|
2588
|
+
const converted = memoryRowToAgenticEntry(row, extractionConfig);
|
|
2589
|
+
if (!converted.ok) {
|
|
2590
|
+
skipped.push(converted.error.key);
|
|
2591
|
+
continue;
|
|
2592
|
+
}
|
|
2593
|
+
matches.push({ entry: converted.value, overlap });
|
|
2594
|
+
}
|
|
2595
|
+
if (skipped.length > 0) {
|
|
2596
|
+
logger4.warn("Skipped memory rows with unreadable metadata", {
|
|
2597
|
+
context: "findMatchingMemories",
|
|
2598
|
+
skipped: skipped.length,
|
|
2599
|
+
keys: skipped
|
|
2600
|
+
});
|
|
2519
2601
|
}
|
|
2520
2602
|
matches.sort((a, b) => b.overlap - a.overlap);
|
|
2521
2603
|
return matches;
|
|
@@ -2591,7 +2673,7 @@ function buildAgenticEntry(key, value, metadata, attributes, createdAt) {
|
|
|
2591
2673
|
}
|
|
2592
2674
|
|
|
2593
2675
|
// src/context/agentic-memory.ts
|
|
2594
|
-
var
|
|
2676
|
+
var logger5 = createLogger({ component: "AgenticMemoryBackend" });
|
|
2595
2677
|
var AgenticMemoryBackend = class {
|
|
2596
2678
|
config;
|
|
2597
2679
|
log;
|
|
@@ -2609,7 +2691,7 @@ var AgenticMemoryBackend = class {
|
|
|
2609
2691
|
throw new MemoryError(`Invalid AgenticMemoryBackend config: ${msg}`);
|
|
2610
2692
|
}
|
|
2611
2693
|
this.config = config;
|
|
2612
|
-
this.log =
|
|
2694
|
+
this.log = logger5;
|
|
2613
2695
|
this.extractionConfig = mergeExtractionConfig(config.extraction);
|
|
2614
2696
|
this.linkingConfig = mergeLinkingConfig(config.linking);
|
|
2615
2697
|
this.base = new HybridMemoryBackend({
|
|
@@ -2706,8 +2788,17 @@ var AgenticMemoryBackend = class {
|
|
|
2706
2788
|
this.ensureInit();
|
|
2707
2789
|
const row = queryMemoryByKey(this.getDb(), key);
|
|
2708
2790
|
if (row === void 0) return Promise.resolve(ok(null));
|
|
2709
|
-
const
|
|
2710
|
-
|
|
2791
|
+
const converted = memoryRowToAgenticEntry(row, this.extractionConfig);
|
|
2792
|
+
if (!converted.ok) {
|
|
2793
|
+
return Promise.resolve(
|
|
2794
|
+
err(
|
|
2795
|
+
new MemoryError(`Unreadable metadata for key: ${key}`, {
|
|
2796
|
+
context: { reason: converted.error.reason, detail: converted.error.detail }
|
|
2797
|
+
})
|
|
2798
|
+
)
|
|
2799
|
+
);
|
|
2800
|
+
}
|
|
2801
|
+
return Promise.resolve(ok(converted.value));
|
|
2711
2802
|
} catch (error) {
|
|
2712
2803
|
const cause = error instanceof Error ? error : new Error(String(error));
|
|
2713
2804
|
return Promise.resolve(err(new MemoryError("Failed to retrieve with attributes", { cause })));
|
|
@@ -3057,10 +3148,17 @@ function touchMemory(db, key) {
|
|
|
3057
3148
|
const result = stmt.run(getTimeProvider().now(), key);
|
|
3058
3149
|
return result.changes > 0;
|
|
3059
3150
|
}
|
|
3060
|
-
function
|
|
3151
|
+
function scoreRows(rows, opts, config) {
|
|
3061
3152
|
const now = new Date(getTimeProvider().now());
|
|
3062
|
-
const scored =
|
|
3063
|
-
|
|
3153
|
+
const scored = [];
|
|
3154
|
+
const unreadable = [];
|
|
3155
|
+
for (const row of rows) {
|
|
3156
|
+
const converted = memoryRowToEntry(row);
|
|
3157
|
+
if (!converted.ok) {
|
|
3158
|
+
unreadable.push(converted.error);
|
|
3159
|
+
continue;
|
|
3160
|
+
}
|
|
3161
|
+
const entry = converted.value;
|
|
3064
3162
|
const priority = calculatePriorityScore({
|
|
3065
3163
|
entry,
|
|
3066
3164
|
now,
|
|
@@ -3068,8 +3166,12 @@ function scoreAndSortEntries(rows, opts, config) {
|
|
|
3068
3166
|
...opts?.query !== void 0 && { query: opts.query },
|
|
3069
3167
|
...opts?.weights !== void 0 && { weightOverrides: opts.weights }
|
|
3070
3168
|
});
|
|
3071
|
-
|
|
3072
|
-
}
|
|
3169
|
+
scored.push({ entry, priority });
|
|
3170
|
+
}
|
|
3171
|
+
return { scored, unreadable };
|
|
3172
|
+
}
|
|
3173
|
+
function scoreAndSortEntries(rows, opts, config) {
|
|
3174
|
+
const { scored, unreadable } = scoreRows(rows, opts, config);
|
|
3073
3175
|
const filterConfig = {
|
|
3074
3176
|
...opts?.minScore !== void 0 && { minScore: opts.minScore },
|
|
3075
3177
|
...opts?.importanceFilter !== void 0 && { importanceFilter: opts.importanceFilter },
|
|
@@ -3078,7 +3180,7 @@ function scoreAndSortEntries(rows, opts, config) {
|
|
|
3078
3180
|
const filtered = filterScoredEntries(scored, filterConfig);
|
|
3079
3181
|
filtered.sort((a, b) => b.priority.score - a.priority.score);
|
|
3080
3182
|
const limit = opts?.limit ?? 100;
|
|
3081
|
-
return filtered.slice(0, limit);
|
|
3183
|
+
return { entries: filtered.slice(0, limit), unreadable };
|
|
3082
3184
|
}
|
|
3083
3185
|
function mergeScoringConfig(partial) {
|
|
3084
3186
|
if (partial === void 0) return DEFAULT_SCORING_CONFIG;
|
|
@@ -3090,7 +3192,7 @@ function mergeScoringConfig(partial) {
|
|
|
3090
3192
|
}
|
|
3091
3193
|
|
|
3092
3194
|
// src/context/adaptive-memory.ts
|
|
3093
|
-
var
|
|
3195
|
+
var logger6 = createLogger({ component: "AdaptiveMemoryBackend" });
|
|
3094
3196
|
var AdaptiveMemoryBackend = class {
|
|
3095
3197
|
config;
|
|
3096
3198
|
log;
|
|
@@ -3106,7 +3208,7 @@ var AdaptiveMemoryBackend = class {
|
|
|
3106
3208
|
throw new MemoryError(`Invalid AdaptiveMemoryBackend config: ${msg}`);
|
|
3107
3209
|
}
|
|
3108
3210
|
this.config = config;
|
|
3109
|
-
this.log =
|
|
3211
|
+
this.log = logger6;
|
|
3110
3212
|
this.scoringConfig = mergeScoringConfig(config.scoring);
|
|
3111
3213
|
this.base = new HybridMemoryBackend({ dbPath: config.dbPath, markdownDir: config.markdownDir });
|
|
3112
3214
|
}
|
|
@@ -3171,8 +3273,18 @@ var AdaptiveMemoryBackend = class {
|
|
|
3171
3273
|
const maxFetch = (opts?.limit ?? 100) * 2;
|
|
3172
3274
|
const rows = getAllMemoryRows(db, maxFetch);
|
|
3173
3275
|
const scored = scoreAndSortEntries(rows, opts, this.scoringConfig);
|
|
3174
|
-
|
|
3175
|
-
|
|
3276
|
+
if (scored.unreadable.length > 0) {
|
|
3277
|
+
this.log.warn("Skipped memory rows with unreadable metadata", {
|
|
3278
|
+
skipped: scored.unreadable.length,
|
|
3279
|
+
keys: scored.unreadable.map((u) => u.key)
|
|
3280
|
+
});
|
|
3281
|
+
}
|
|
3282
|
+
this.log.debug("Retrieved by priority", {
|
|
3283
|
+
count: scored.entries.length,
|
|
3284
|
+
skipped: scored.unreadable.length,
|
|
3285
|
+
query: opts?.query
|
|
3286
|
+
});
|
|
3287
|
+
return Promise.resolve(ok(scored.entries));
|
|
3176
3288
|
} catch (error) {
|
|
3177
3289
|
const cause = error instanceof Error ? error : new Error(String(error));
|
|
3178
3290
|
return Promise.resolve(err(new MemoryError("Failed to retrieve by priority", { cause })));
|
|
@@ -3189,9 +3301,18 @@ var AdaptiveMemoryBackend = class {
|
|
|
3189
3301
|
if (row === void 0) {
|
|
3190
3302
|
return Promise.resolve(err(new MemoryError(`Key not found: ${key}`)));
|
|
3191
3303
|
}
|
|
3192
|
-
const
|
|
3304
|
+
const converted = memoryRowToEntry(row);
|
|
3305
|
+
if (!converted.ok) {
|
|
3306
|
+
return Promise.resolve(
|
|
3307
|
+
err(
|
|
3308
|
+
new MemoryError(`Unreadable metadata for key: ${key}`, {
|
|
3309
|
+
context: { reason: converted.error.reason, detail: converted.error.detail }
|
|
3310
|
+
})
|
|
3311
|
+
)
|
|
3312
|
+
);
|
|
3313
|
+
}
|
|
3193
3314
|
const priority = calculatePriorityScore({
|
|
3194
|
-
entry,
|
|
3315
|
+
entry: converted.value,
|
|
3195
3316
|
now: new Date(getTimeProvider().now()),
|
|
3196
3317
|
config: this.scoringConfig,
|
|
3197
3318
|
...query !== void 0 && { query }
|
|
@@ -3510,23 +3631,23 @@ function getSnapshotFiles() {
|
|
|
3510
3631
|
return [];
|
|
3511
3632
|
}
|
|
3512
3633
|
}
|
|
3513
|
-
function enforceRetention(
|
|
3634
|
+
function enforceRetention(logger8) {
|
|
3514
3635
|
try {
|
|
3515
3636
|
const files = getSnapshotFiles();
|
|
3516
3637
|
if (files.length <= MAX_SNAPSHOT_FILES) return;
|
|
3517
3638
|
const toDelete = files.slice(MAX_SNAPSHOT_FILES);
|
|
3518
3639
|
for (const file of toDelete) fs2.unlinkSync(path2.join(getBeliefsDir(), file));
|
|
3519
|
-
|
|
3640
|
+
logger8.debug("Belief snapshot retention enforced", {
|
|
3520
3641
|
kept: MAX_SNAPSHOT_FILES,
|
|
3521
3642
|
deleted: toDelete.length
|
|
3522
3643
|
});
|
|
3523
3644
|
} catch (error) {
|
|
3524
|
-
|
|
3645
|
+
logger8.debug("Belief snapshot retention cleanup failed", {
|
|
3525
3646
|
error: getErrorMessage(error)
|
|
3526
3647
|
});
|
|
3527
3648
|
}
|
|
3528
3649
|
}
|
|
3529
|
-
function saveBeliefSnapshot(data,
|
|
3650
|
+
function saveBeliefSnapshot(data, logger8) {
|
|
3530
3651
|
try {
|
|
3531
3652
|
ensureBeliefsDir();
|
|
3532
3653
|
const snapshot = createSnapshot(data);
|
|
@@ -3534,20 +3655,20 @@ function saveBeliefSnapshot(data, logger7) {
|
|
|
3534
3655
|
const filename = `beliefs-${timestamp}.json`;
|
|
3535
3656
|
const filepath = path2.join(getBeliefsDir(), filename);
|
|
3536
3657
|
fs2.writeFileSync(filepath, JSON.stringify(snapshot, null, 2), "utf-8");
|
|
3537
|
-
|
|
3538
|
-
enforceRetention(
|
|
3658
|
+
logger8.info("Belief memory snapshot saved", { filename, beliefs: snapshot.beliefs.length });
|
|
3659
|
+
enforceRetention(logger8);
|
|
3539
3660
|
return ok(filepath);
|
|
3540
3661
|
} catch (error) {
|
|
3541
3662
|
const message = getErrorMessage(error);
|
|
3542
3663
|
return err(new Error(`Failed to save belief snapshot: ${message}`));
|
|
3543
3664
|
}
|
|
3544
3665
|
}
|
|
3545
|
-
function loadBeliefSnapshot(
|
|
3666
|
+
function loadBeliefSnapshot(logger8) {
|
|
3546
3667
|
try {
|
|
3547
3668
|
ensureBeliefsDir();
|
|
3548
3669
|
const files = getSnapshotFiles();
|
|
3549
3670
|
if (files.length === 0) {
|
|
3550
|
-
|
|
3671
|
+
logger8.debug("No belief snapshots found");
|
|
3551
3672
|
return ok(null);
|
|
3552
3673
|
}
|
|
3553
3674
|
for (const file of files.slice(0, 3)) {
|
|
@@ -3556,20 +3677,20 @@ function loadBeliefSnapshot(logger7) {
|
|
|
3556
3677
|
const raw = JSON.parse(fs2.readFileSync(filepath, "utf-8"));
|
|
3557
3678
|
const validation = BeliefSnapshotSchema.safeParse(raw);
|
|
3558
3679
|
if (!validation.success) {
|
|
3559
|
-
|
|
3680
|
+
logger8.warn("Invalid belief snapshot file", { file, errors: validation.error.issues });
|
|
3560
3681
|
continue;
|
|
3561
3682
|
}
|
|
3562
3683
|
const hydrated = hydrateSnapshot(validation.data);
|
|
3563
|
-
|
|
3684
|
+
logger8.info("Belief memory snapshot loaded", { file, beliefs: hydrated.beliefs.size });
|
|
3564
3685
|
return ok(hydrated);
|
|
3565
3686
|
} catch (error) {
|
|
3566
|
-
|
|
3687
|
+
logger8.warn("Failed to load belief snapshot file", {
|
|
3567
3688
|
file,
|
|
3568
3689
|
error: getErrorMessage(error)
|
|
3569
3690
|
});
|
|
3570
3691
|
}
|
|
3571
3692
|
}
|
|
3572
|
-
|
|
3693
|
+
logger8.warn("All recent belief snapshots are invalid");
|
|
3573
3694
|
return ok(null);
|
|
3574
3695
|
} catch (error) {
|
|
3575
3696
|
const message = getErrorMessage(error);
|
|
@@ -3971,7 +4092,7 @@ var KnowledgeVaultImpl = class {
|
|
|
3971
4092
|
};
|
|
3972
4093
|
|
|
3973
4094
|
// src/context/typed-memory.ts
|
|
3974
|
-
var
|
|
4095
|
+
var logger7 = createLogger({ component: "typed-memory" });
|
|
3975
4096
|
var STATS_SEARCH_CAP = 1e3;
|
|
3976
4097
|
var TypedMemory = class {
|
|
3977
4098
|
core;
|
|
@@ -3993,7 +4114,7 @@ var TypedMemory = class {
|
|
|
3993
4114
|
this.resource = new ResourceMemoryImpl(backend);
|
|
3994
4115
|
this.vault = new KnowledgeVaultImpl(backend);
|
|
3995
4116
|
this.belief = new HindsightBeliefMemory();
|
|
3996
|
-
|
|
4117
|
+
logger7.info("TypedMemory initialized");
|
|
3997
4118
|
}
|
|
3998
4119
|
async queryByType(type, query, limit = 20) {
|
|
3999
4120
|
const result = await this.backend.search(`${type} ${query}`, limit);
|
|
@@ -4056,7 +4177,7 @@ var TypedMemory = class {
|
|
|
4056
4177
|
async pruneExpired() {
|
|
4057
4178
|
const result = await this.backend.prune(new Date(getTimeProvider().now()));
|
|
4058
4179
|
if (!result.ok) return result;
|
|
4059
|
-
|
|
4180
|
+
logger7.info("Pruned expired entries", { count: result.value });
|
|
4060
4181
|
return ok({
|
|
4061
4182
|
prunedCount: result.value,
|
|
4062
4183
|
prunedByType: {
|
|
@@ -4099,11 +4220,11 @@ var MemoryPromoter = class {
|
|
|
4099
4220
|
agentic;
|
|
4100
4221
|
config;
|
|
4101
4222
|
log;
|
|
4102
|
-
constructor(beliefs, agentic, config = {},
|
|
4223
|
+
constructor(beliefs, agentic, config = {}, logger8) {
|
|
4103
4224
|
this.beliefs = beliefs;
|
|
4104
4225
|
this.agentic = agentic;
|
|
4105
4226
|
this.config = { ...DEFAULT_PROMOTION_CONFIG, ...config };
|
|
4106
|
-
this.log =
|
|
4227
|
+
this.log = logger8 ?? createLogger({ component: "MemoryPromoter" });
|
|
4107
4228
|
}
|
|
4108
4229
|
/**
|
|
4109
4230
|
* Promote high-confidence session learnings to structured beliefs.
|
|
@@ -4256,8 +4377,8 @@ var DEFAULT_DECAY_CONFIG2 = {
|
|
|
4256
4377
|
var CrossReferenceTracker = class {
|
|
4257
4378
|
references = /* @__PURE__ */ new Map();
|
|
4258
4379
|
log;
|
|
4259
|
-
constructor(
|
|
4260
|
-
this.log =
|
|
4380
|
+
constructor(logger8) {
|
|
4381
|
+
this.log = logger8 ?? createLogger({ component: "CrossReferenceTracker" });
|
|
4261
4382
|
}
|
|
4262
4383
|
/**
|
|
4263
4384
|
* Register a cross-reference between two memories.
|
|
@@ -4342,9 +4463,9 @@ var MemoryDecayManager = class {
|
|
|
4342
4463
|
agentic = null;
|
|
4343
4464
|
adaptive = null;
|
|
4344
4465
|
mobimem = null;
|
|
4345
|
-
constructor(config = {},
|
|
4466
|
+
constructor(config = {}, logger8) {
|
|
4346
4467
|
this.config = { ...DEFAULT_DECAY_CONFIG2, ...config };
|
|
4347
|
-
this.log =
|
|
4468
|
+
this.log = logger8 ?? createLogger({ component: "MemoryDecayManager" });
|
|
4348
4469
|
this.tracker = new CrossReferenceTracker(this.log);
|
|
4349
4470
|
}
|
|
4350
4471
|
/**
|
|
@@ -4744,8 +4865,8 @@ function attachToRegistry(domain, backend) {
|
|
|
4744
4865
|
} catch {
|
|
4745
4866
|
}
|
|
4746
4867
|
}
|
|
4747
|
-
function getToolMemory(
|
|
4748
|
-
sharedInstance ??= new ToolMemoryManager(
|
|
4868
|
+
function getToolMemory(logger8) {
|
|
4869
|
+
sharedInstance ??= new ToolMemoryManager(logger8, pendingOptions);
|
|
4749
4870
|
return sharedInstance;
|
|
4750
4871
|
}
|
|
4751
4872
|
function configureToolMemory(options) {
|
|
@@ -4785,8 +4906,8 @@ var ToolMemoryManager = class {
|
|
|
4785
4906
|
decayConfig;
|
|
4786
4907
|
decaySource;
|
|
4787
4908
|
initPromise = null;
|
|
4788
|
-
constructor(
|
|
4789
|
-
this.log =
|
|
4909
|
+
constructor(logger8, options = {}) {
|
|
4910
|
+
this.log = logger8 ?? createLogger({ component: "ToolMemory" });
|
|
4790
4911
|
this.decayConfig = definedDecayOverrides(options.decay ?? {});
|
|
4791
4912
|
this.decaySource = options.decaySource ?? DECAY_SOURCE_NEVER_CONFIGURED;
|
|
4792
4913
|
this.memory = new SessionMemory({
|
|
@@ -5684,4 +5805,4 @@ export {
|
|
|
5684
5805
|
reinitializeMemoryBackends,
|
|
5685
5806
|
ToolMemoryManager
|
|
5686
5807
|
};
|
|
5687
|
-
//# sourceMappingURL=chunk-
|
|
5808
|
+
//# sourceMappingURL=chunk-KOC6XT7R.js.map
|