@edihasaj/recall 2.0.17 → 2.0.19
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/README.md +12 -0
- package/dist/{chunk-VUVFQJWZ.js → chunk-3SI2FCYS.js} +2 -2
- package/dist/{chunk-Q22B7YDQ.js → chunk-5VIPRV3V.js} +5 -5
- package/dist/{chunk-22AJZ7UQ.js → chunk-673NQIZX.js} +2 -2
- package/dist/{chunk-UDLRBKC3.js → chunk-6B7YHOGI.js} +3 -3
- package/dist/{chunk-YIVOTIDF.js → chunk-FH2XQDYL.js} +5 -5
- package/dist/{chunk-KLERXJ47.js → chunk-GENJNVHG.js} +3 -3
- package/dist/{chunk-2COJXGP4.js → chunk-GTHCX5LX.js} +4 -3
- package/dist/{chunk-2COJXGP4.js.map → chunk-GTHCX5LX.js.map} +1 -1
- package/dist/{chunk-EY6HIDG2.js → chunk-J4IWU2BE.js} +9 -9
- package/dist/{chunk-Q7254IPO.js → chunk-J6YBL72P.js} +193 -15
- package/dist/chunk-J6YBL72P.js.map +1 -0
- package/dist/{chunk-YIUBD27J.js → chunk-M4JG3HMA.js} +30 -37
- package/dist/chunk-M4JG3HMA.js.map +1 -0
- package/dist/{chunk-CSBXI3ET.js → chunk-NSXTH2B4.js} +8 -4
- package/dist/chunk-NSXTH2B4.js.map +1 -0
- package/dist/{chunk-ZT67CYDS.js → chunk-QDCIXULL.js} +2 -2
- package/dist/{chunk-ZT67CYDS.js.map → chunk-QDCIXULL.js.map} +1 -1
- package/dist/{chunk-FNIIUNW6.js → chunk-QDONEJJG.js} +2 -2
- package/dist/{chunk-QQ6YHR7I.js → chunk-R5CG3RC4.js} +231 -26
- package/dist/chunk-R5CG3RC4.js.map +1 -0
- package/dist/{chunk-KVZN35JF.js → chunk-WDUYM3NZ.js} +7 -7
- package/dist/{chunk-RAQT2OBR.js → chunk-WPHCCQOC.js} +7 -7
- package/dist/{chunk-GK7OWVRQ.js → chunk-X3EF5QHV.js} +3 -3
- package/dist/{chunk-XRKUJ5B4.js → chunk-ZHJRYVOD.js} +2 -2
- package/dist/{cleanup-4TXIHTJT.js → cleanup-FOGHMRL5.js} +11 -11
- package/dist/cli.js +39 -191
- package/dist/cli.js.map +1 -1
- package/dist/{codex-trust-2JIY66CP.js → codex-trust-C2GOV764.js} +4 -4
- package/dist/daemon.js +143 -39
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-OIINFHQU.js +22 -0
- package/dist/{embeddings-AAS7NKGB.js → embeddings-6Y7KXV5L.js} +5 -5
- package/dist/ingest-QFX3ZEM6.js +20 -0
- package/dist/{keychain-SHRO7W6J.js → keychain-DHS6XKIQ.js} +3 -3
- package/dist/mcp.js +15 -15
- package/dist/{memory-value-R2C7ZSDF.js → memory-value-U6TGLBZB.js} +11 -11
- package/dist/{provenance-I5GIAP7N.js → provenance-PLISLH2V.js} +9 -9
- package/dist/quality-AYWNSDIU.js +25 -0
- package/dist/retrieval-B2DYBYAJ.js +15 -0
- package/dist/{store-X2B6MRBH.js → store-OLSM63EZ.js} +4 -4
- package/dist/sync-server.js +2 -2
- package/dist/{tasks-H4NIS6QO.js → tasks-S5ZMXA5K.js} +11 -11
- package/dist/{usage-35HSDMNT.js → usage-RWS6VQBY.js} +4 -4
- package/package.json +1 -1
- package/vendor/recall-cloud-sync/PROVENANCE.md +18 -5
- package/vendor/recall-cloud-sync/recall-sync-local.mjs +19 -10
- package/vendor/recall-cloud-sync/recall-sync.mjs +40 -6
- package/dist/chunk-CSBXI3ET.js.map +0 -1
- package/dist/chunk-Q7254IPO.js.map +0 -1
- package/dist/chunk-QQ6YHR7I.js.map +0 -1
- package/dist/chunk-YIUBD27J.js.map +0 -1
- package/dist/dispatcher-O6NGADCQ.js +0 -22
- package/dist/ingest-DW3AG4M5.js +0 -20
- package/dist/quality-32MAXPNJ.js +0 -25
- package/dist/retrieval-RKYWWNWC.js +0 -15
- /package/dist/{chunk-VUVFQJWZ.js.map → chunk-3SI2FCYS.js.map} +0 -0
- /package/dist/{chunk-Q22B7YDQ.js.map → chunk-5VIPRV3V.js.map} +0 -0
- /package/dist/{chunk-22AJZ7UQ.js.map → chunk-673NQIZX.js.map} +0 -0
- /package/dist/{chunk-UDLRBKC3.js.map → chunk-6B7YHOGI.js.map} +0 -0
- /package/dist/{chunk-YIVOTIDF.js.map → chunk-FH2XQDYL.js.map} +0 -0
- /package/dist/{chunk-KLERXJ47.js.map → chunk-GENJNVHG.js.map} +0 -0
- /package/dist/{chunk-EY6HIDG2.js.map → chunk-J4IWU2BE.js.map} +0 -0
- /package/dist/{chunk-FNIIUNW6.js.map → chunk-QDONEJJG.js.map} +0 -0
- /package/dist/{chunk-KVZN35JF.js.map → chunk-WDUYM3NZ.js.map} +0 -0
- /package/dist/{chunk-RAQT2OBR.js.map → chunk-WPHCCQOC.js.map} +0 -0
- /package/dist/{chunk-GK7OWVRQ.js.map → chunk-X3EF5QHV.js.map} +0 -0
- /package/dist/{chunk-XRKUJ5B4.js.map → chunk-ZHJRYVOD.js.map} +0 -0
- /package/dist/{cleanup-4TXIHTJT.js.map → cleanup-FOGHMRL5.js.map} +0 -0
- /package/dist/{codex-trust-2JIY66CP.js.map → codex-trust-C2GOV764.js.map} +0 -0
- /package/dist/{dispatcher-O6NGADCQ.js.map → dispatcher-OIINFHQU.js.map} +0 -0
- /package/dist/{embeddings-AAS7NKGB.js.map → embeddings-6Y7KXV5L.js.map} +0 -0
- /package/dist/{ingest-DW3AG4M5.js.map → ingest-QFX3ZEM6.js.map} +0 -0
- /package/dist/{keychain-SHRO7W6J.js.map → keychain-DHS6XKIQ.js.map} +0 -0
- /package/dist/{memory-value-R2C7ZSDF.js.map → memory-value-U6TGLBZB.js.map} +0 -0
- /package/dist/{provenance-I5GIAP7N.js.map → provenance-PLISLH2V.js.map} +0 -0
- /package/dist/{quality-32MAXPNJ.js.map → quality-AYWNSDIU.js.map} +0 -0
- /package/dist/{retrieval-RKYWWNWC.js.map → retrieval-B2DYBYAJ.js.map} +0 -0
- /package/dist/{store-X2B6MRBH.js.map → store-OLSM63EZ.js.map} +0 -0
- /package/dist/{tasks-H4NIS6QO.js.map → tasks-S5ZMXA5K.js.map} +0 -0
- /package/dist/{usage-35HSDMNT.js.map → usage-RWS6VQBY.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
matchTokens,
|
|
3
3
|
textMatchScore
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZHJRYVOD.js";
|
|
5
5
|
import {
|
|
6
6
|
appendEvidence,
|
|
7
7
|
countDistinctCorrectionSessions,
|
|
@@ -24,13 +24,13 @@ import {
|
|
|
24
24
|
restoreAutoInject,
|
|
25
25
|
setMemoryNote,
|
|
26
26
|
updateMemoryCaptureContext
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-WDUYM3NZ.js";
|
|
28
28
|
import {
|
|
29
29
|
desc
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-6B7YHOGI.js";
|
|
31
31
|
import {
|
|
32
32
|
defineOwn
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-3SI2FCYS.js";
|
|
34
34
|
import {
|
|
35
35
|
CONFIDENCE,
|
|
36
36
|
LlmCredentialError,
|
|
@@ -41,11 +41,11 @@ import {
|
|
|
41
41
|
loadEmbeddingConfigFromEnv,
|
|
42
42
|
queueMemoryEmbeddingSync,
|
|
43
43
|
rowToMemory
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-NSXTH2B4.js";
|
|
45
45
|
import {
|
|
46
46
|
hasProviderConfigured,
|
|
47
47
|
init_keychain
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-QDONEJJG.js";
|
|
49
49
|
import {
|
|
50
50
|
activityEvents,
|
|
51
51
|
and,
|
|
@@ -67,19 +67,19 @@ import {
|
|
|
67
67
|
memoryValueEvents,
|
|
68
68
|
or,
|
|
69
69
|
sql
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-GTHCX5LX.js";
|
|
71
71
|
import {
|
|
72
72
|
init_define_RECALL_BUILD_INFO
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-QDCIXULL.js";
|
|
74
74
|
|
|
75
75
|
// src/maintenance/tasks.ts
|
|
76
76
|
init_define_RECALL_BUILD_INFO();
|
|
77
|
-
import { randomUUID as
|
|
77
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
78
78
|
import { z } from "zod";
|
|
79
79
|
|
|
80
80
|
// src/maintenance/appliers.ts
|
|
81
81
|
init_define_RECALL_BUILD_INFO();
|
|
82
|
-
import { randomUUID as
|
|
82
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
83
83
|
|
|
84
84
|
// src/contradictions/supersession.ts
|
|
85
85
|
init_define_RECALL_BUILD_INFO();
|
|
@@ -1141,7 +1141,7 @@ function inferFromGitOwnership(filePath, repoPath) {
|
|
|
1141
1141
|
|
|
1142
1142
|
// src/maintenance/cleanup.ts
|
|
1143
1143
|
init_define_RECALL_BUILD_INFO();
|
|
1144
|
-
import { randomUUID as
|
|
1144
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
1145
1145
|
|
|
1146
1146
|
// src/contradictions/detector.ts
|
|
1147
1147
|
init_define_RECALL_BUILD_INFO();
|
|
@@ -1554,10 +1554,200 @@ function clamp3(n, min = 0, max = 1) {
|
|
|
1554
1554
|
return Math.max(min, Math.min(max, n));
|
|
1555
1555
|
}
|
|
1556
1556
|
|
|
1557
|
-
// src/maintenance/
|
|
1557
|
+
// src/maintenance/agent-authored.ts
|
|
1558
1558
|
init_define_RECALL_BUILD_INFO();
|
|
1559
1559
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1560
1560
|
|
|
1561
|
+
// src/cli/codex-thread-origin.ts
|
|
1562
|
+
init_define_RECALL_BUILD_INFO();
|
|
1563
|
+
import { closeSync, openSync, readdirSync, readSync } from "fs";
|
|
1564
|
+
import { homedir } from "os";
|
|
1565
|
+
import { join as join2 } from "path";
|
|
1566
|
+
var AUTOMATED_SOURCES = /* @__PURE__ */ new Set(["exec", "subagent", "mcp"]);
|
|
1567
|
+
var MAX_META_BYTES = 512 * 1024;
|
|
1568
|
+
var CHUNK_BYTES = 64 * 1024;
|
|
1569
|
+
function readCodexThreadSource(transcriptPath) {
|
|
1570
|
+
if (typeof transcriptPath !== "string" || !transcriptPath.endsWith(".jsonl")) return null;
|
|
1571
|
+
const firstLine = readFirstLine(transcriptPath);
|
|
1572
|
+
if (!firstLine) return null;
|
|
1573
|
+
try {
|
|
1574
|
+
const record = JSON.parse(firstLine);
|
|
1575
|
+
if (record.type !== "session_meta" || !record.payload) return null;
|
|
1576
|
+
const source = record.payload.source;
|
|
1577
|
+
if (typeof source === "string") return source;
|
|
1578
|
+
if (source && typeof source === "object" && !Array.isArray(source)) {
|
|
1579
|
+
return Object.keys(source)[0] ?? null;
|
|
1580
|
+
}
|
|
1581
|
+
return typeof record.payload.thread_source === "string" ? record.payload.thread_source : null;
|
|
1582
|
+
} catch {
|
|
1583
|
+
return null;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
function isAutomatedCodexThread(transcriptPath) {
|
|
1587
|
+
const source = readCodexThreadSource(transcriptPath);
|
|
1588
|
+
return source !== null && AUTOMATED_SOURCES.has(source);
|
|
1589
|
+
}
|
|
1590
|
+
function isAutomatedCodexSource(source) {
|
|
1591
|
+
return source !== null && AUTOMATED_SOURCES.has(source);
|
|
1592
|
+
}
|
|
1593
|
+
var THREAD_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1594
|
+
function createCodexRolloutLocator(codexHome = process.env.CODEX_HOME || join2(homedir(), ".codex")) {
|
|
1595
|
+
const dirCache = /* @__PURE__ */ new Map();
|
|
1596
|
+
const list = (dir) => {
|
|
1597
|
+
let entries = dirCache.get(dir);
|
|
1598
|
+
if (!entries) {
|
|
1599
|
+
try {
|
|
1600
|
+
entries = readdirSync(dir).filter((name) => name.endsWith(".jsonl"));
|
|
1601
|
+
} catch {
|
|
1602
|
+
entries = [];
|
|
1603
|
+
}
|
|
1604
|
+
dirCache.set(dir, entries);
|
|
1605
|
+
}
|
|
1606
|
+
return entries;
|
|
1607
|
+
};
|
|
1608
|
+
return (threadId, startedAt) => {
|
|
1609
|
+
if (!THREAD_ID.test(threadId)) return null;
|
|
1610
|
+
const suffix = `-${threadId}.jsonl`;
|
|
1611
|
+
const hint = startedAt ? Date.parse(startedAt) : Number.NaN;
|
|
1612
|
+
if (Number.isFinite(hint)) {
|
|
1613
|
+
for (const offset of [0, -1, 1]) {
|
|
1614
|
+
const day = new Date(hint + offset * 864e5);
|
|
1615
|
+
const dir = join2(
|
|
1616
|
+
codexHome,
|
|
1617
|
+
"sessions",
|
|
1618
|
+
String(day.getFullYear()),
|
|
1619
|
+
String(day.getMonth() + 1).padStart(2, "0"),
|
|
1620
|
+
String(day.getDate()).padStart(2, "0")
|
|
1621
|
+
);
|
|
1622
|
+
const match2 = list(dir).find((name) => name.endsWith(suffix));
|
|
1623
|
+
if (match2) return join2(dir, match2);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
const archived = join2(codexHome, "archived_sessions");
|
|
1627
|
+
const match = list(archived).find((name) => name.endsWith(suffix));
|
|
1628
|
+
return match ? join2(archived, match) : null;
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
function readFirstLine(path) {
|
|
1632
|
+
let fd;
|
|
1633
|
+
try {
|
|
1634
|
+
fd = openSync(path, "r");
|
|
1635
|
+
const chunks = [];
|
|
1636
|
+
let total = 0;
|
|
1637
|
+
while (total < MAX_META_BYTES) {
|
|
1638
|
+
const chunk = Buffer.alloc(CHUNK_BYTES);
|
|
1639
|
+
const read = readSync(fd, chunk, 0, CHUNK_BYTES, total);
|
|
1640
|
+
if (read <= 0) break;
|
|
1641
|
+
const newline = chunk.subarray(0, read).indexOf(10);
|
|
1642
|
+
if (newline >= 0) {
|
|
1643
|
+
chunks.push(chunk.subarray(0, newline));
|
|
1644
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
1645
|
+
}
|
|
1646
|
+
chunks.push(chunk.subarray(0, read));
|
|
1647
|
+
total += read;
|
|
1648
|
+
}
|
|
1649
|
+
return null;
|
|
1650
|
+
} catch {
|
|
1651
|
+
return null;
|
|
1652
|
+
} finally {
|
|
1653
|
+
if (fd !== void 0) closeSync(fd);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
// src/maintenance/agent-authored.ts
|
|
1658
|
+
var ACTOR = "maintenance:cleanup";
|
|
1659
|
+
function planRejectAgentAuthored(db, opts = {}) {
|
|
1660
|
+
const locate = opts.locate ?? createCodexRolloutLocator();
|
|
1661
|
+
const sourceCache = /* @__PURE__ */ new Map();
|
|
1662
|
+
const sourceOf = (sessionId, startedAt) => {
|
|
1663
|
+
if (!sourceCache.has(sessionId)) {
|
|
1664
|
+
const path = locate(sessionId, startedAt);
|
|
1665
|
+
sourceCache.set(sessionId, path ? readCodexThreadSource(path) : null);
|
|
1666
|
+
}
|
|
1667
|
+
return sourceCache.get(sessionId) ?? null;
|
|
1668
|
+
};
|
|
1669
|
+
const rows = db.select({ id: memories.id, text: memories.text, evidence: memories.evidence }).from(memories).where(and(
|
|
1670
|
+
inArray(memories.status, ["active", "candidate"]),
|
|
1671
|
+
eq(memories.source, "user_correction")
|
|
1672
|
+
)).all();
|
|
1673
|
+
const plans = [];
|
|
1674
|
+
for (const row of rows) {
|
|
1675
|
+
const evidence = parseEvidence(row.evidence);
|
|
1676
|
+
if (evidence.length === 0) continue;
|
|
1677
|
+
const sessions = /* @__PURE__ */ new Map();
|
|
1678
|
+
let eligible = true;
|
|
1679
|
+
for (const entry of evidence) {
|
|
1680
|
+
if (entry.type === "session_correction" && entry.session) {
|
|
1681
|
+
sessions.set(entry.session, entry.timestamp);
|
|
1682
|
+
} else if (entry.type === "repeated_correction" && Array.isArray(entry.sessions) && entry.sessions.length > 0) {
|
|
1683
|
+
for (const session of entry.sessions) {
|
|
1684
|
+
if (!sessions.has(session)) sessions.set(session, entry.timestamp);
|
|
1685
|
+
}
|
|
1686
|
+
} else {
|
|
1687
|
+
eligible = false;
|
|
1688
|
+
break;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
if (!eligible || sessions.size === 0) continue;
|
|
1692
|
+
const origins = [];
|
|
1693
|
+
for (const [sessionId, startedAt] of sessions) {
|
|
1694
|
+
const source = sourceOf(sessionId, startedAt);
|
|
1695
|
+
if (!isAutomatedCodexSource(source)) {
|
|
1696
|
+
eligible = false;
|
|
1697
|
+
break;
|
|
1698
|
+
}
|
|
1699
|
+
origins.push({ session_id: sessionId, source });
|
|
1700
|
+
}
|
|
1701
|
+
if (!eligible) continue;
|
|
1702
|
+
plans.push({ kind: "reject_agent_authored", memory_id: row.id, text: row.text, sessions: origins });
|
|
1703
|
+
}
|
|
1704
|
+
return plans;
|
|
1705
|
+
}
|
|
1706
|
+
function applyRejectAgentAuthored(db, runId, plan) {
|
|
1707
|
+
const before = getMemory(db, plan.memory_id);
|
|
1708
|
+
if (!before || !["active", "candidate"].includes(before.status)) return;
|
|
1709
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1710
|
+
db.update(memories).set({ status: "rejected", dedupe_key: null, updated_at: now }).where(eq(memories.id, plan.memory_id)).run();
|
|
1711
|
+
const after = getMemory(db, plan.memory_id);
|
|
1712
|
+
recordAuditWithSnapshot(
|
|
1713
|
+
db,
|
|
1714
|
+
plan.memory_id,
|
|
1715
|
+
"rejected",
|
|
1716
|
+
ACTOR,
|
|
1717
|
+
`cleanup_agent_authored:run:${runId}`,
|
|
1718
|
+
before,
|
|
1719
|
+
after ?? null
|
|
1720
|
+
);
|
|
1721
|
+
db.insert(maintenanceCleanupLog).values({
|
|
1722
|
+
id: randomUUID2(),
|
|
1723
|
+
run_id: runId,
|
|
1724
|
+
action: "reject_agent_authored",
|
|
1725
|
+
memory_id: plan.memory_id,
|
|
1726
|
+
related_memory_id: null,
|
|
1727
|
+
before_snapshot: before,
|
|
1728
|
+
after_snapshot: after,
|
|
1729
|
+
details: { sessions: plan.sessions },
|
|
1730
|
+
reverted: false,
|
|
1731
|
+
reverted_at: null,
|
|
1732
|
+
created_at: now
|
|
1733
|
+
}).run();
|
|
1734
|
+
}
|
|
1735
|
+
function parseEvidence(value) {
|
|
1736
|
+
const parsed = typeof value === "string" ? safeJson(value) : value;
|
|
1737
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
1738
|
+
}
|
|
1739
|
+
function safeJson(value) {
|
|
1740
|
+
try {
|
|
1741
|
+
return JSON.parse(value);
|
|
1742
|
+
} catch {
|
|
1743
|
+
return null;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
// src/maintenance/promote.ts
|
|
1748
|
+
init_define_RECALL_BUILD_INFO();
|
|
1749
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
1750
|
+
|
|
1561
1751
|
// src/maintenance/promotion-score.ts
|
|
1562
1752
|
init_define_RECALL_BUILD_INFO();
|
|
1563
1753
|
var PROMOTION_SCORE_THRESHOLD = 8;
|
|
@@ -1922,7 +2112,7 @@ function applyPromoteRepeat(db, runId, plan) {
|
|
|
1922
2112
|
if (plan.score !== void 0) details.score = plan.score;
|
|
1923
2113
|
if (plan.explanation) details.explanation = plan.explanation;
|
|
1924
2114
|
db.insert(maintenanceCleanupLog).values({
|
|
1925
|
-
id:
|
|
2115
|
+
id: randomUUID3(),
|
|
1926
2116
|
run_id: runId,
|
|
1927
2117
|
action: "promote_repeat_correction",
|
|
1928
2118
|
memory_id: plan.memory_id,
|
|
@@ -1949,7 +2139,7 @@ var SUPPRESS_INJECTION_FLOOR = 50;
|
|
|
1949
2139
|
var GLOBALIZE_REPO_FLOOR = 3;
|
|
1950
2140
|
var DEFAULT_ACTOR2 = "maintenance:cleanup";
|
|
1951
2141
|
function runDeterministicCleanup(db, opts = { dryRun: true }) {
|
|
1952
|
-
const runId =
|
|
2142
|
+
const runId = randomUUID4();
|
|
1953
2143
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1954
2144
|
const plan = [];
|
|
1955
2145
|
if (!opts.only || opts.only === "dedupe_exact_merge") {
|
|
@@ -1976,6 +2166,9 @@ function runDeterministicCleanup(db, opts = { dryRun: true }) {
|
|
|
1976
2166
|
if (!opts.only || opts.only === "reject_generic_scanned_tooling") {
|
|
1977
2167
|
plan.push(...planRejectGenericScannedTooling(db));
|
|
1978
2168
|
}
|
|
2169
|
+
if (!opts.only || opts.only === "reject_agent_authored") {
|
|
2170
|
+
plan.push(...planRejectAgentAuthored(db));
|
|
2171
|
+
}
|
|
1979
2172
|
const counts = summarize(plan);
|
|
1980
2173
|
if (!opts.dryRun) {
|
|
1981
2174
|
for (const item of plan) {
|
|
@@ -2004,6 +2197,9 @@ function runDeterministicCleanup(db, opts = { dryRun: true }) {
|
|
|
2004
2197
|
case "reject_generic_scanned_tooling":
|
|
2005
2198
|
applyRejectGenericScannedTooling(db, runId, item);
|
|
2006
2199
|
break;
|
|
2200
|
+
case "reject_agent_authored":
|
|
2201
|
+
applyRejectAgentAuthored(db, runId, item);
|
|
2202
|
+
break;
|
|
2007
2203
|
}
|
|
2008
2204
|
}
|
|
2009
2205
|
}
|
|
@@ -2027,6 +2223,7 @@ function summarize(plan) {
|
|
|
2027
2223
|
let testFixtureRejections = 0;
|
|
2028
2224
|
let invalidScopeRejections = 0;
|
|
2029
2225
|
let genericScannedToolingRejections = 0;
|
|
2226
|
+
let agentAuthoredRejections = 0;
|
|
2030
2227
|
let e2eArtifactRejections = 0;
|
|
2031
2228
|
for (const p of plan) {
|
|
2032
2229
|
if (p.kind === "dedupe_exact_merge") {
|
|
@@ -2045,6 +2242,8 @@ function summarize(plan) {
|
|
|
2045
2242
|
testFixtureRejections += 1;
|
|
2046
2243
|
} else if (p.kind === "reject_invalid_scope") {
|
|
2047
2244
|
invalidScopeRejections += 1;
|
|
2245
|
+
} else if (p.kind === "reject_agent_authored") {
|
|
2246
|
+
agentAuthoredRejections += 1;
|
|
2048
2247
|
} else {
|
|
2049
2248
|
genericScannedToolingRejections += 1;
|
|
2050
2249
|
}
|
|
@@ -2063,6 +2262,7 @@ function summarize(plan) {
|
|
|
2063
2262
|
test_fixture_rejections: testFixtureRejections,
|
|
2064
2263
|
invalid_scope_rejections: invalidScopeRejections,
|
|
2065
2264
|
generic_scanned_tooling_rejections: genericScannedToolingRejections,
|
|
2265
|
+
agent_authored_rejections: agentAuthoredRejections,
|
|
2066
2266
|
e2e_artifact_rejections: e2eArtifactRejections
|
|
2067
2267
|
};
|
|
2068
2268
|
}
|
|
@@ -2164,7 +2364,7 @@ function applyDedupeExact(db, runId, plan) {
|
|
|
2164
2364
|
after ?? null
|
|
2165
2365
|
);
|
|
2166
2366
|
db.insert(maintenanceCleanupLog).values({
|
|
2167
|
-
id:
|
|
2367
|
+
id: randomUUID4(),
|
|
2168
2368
|
run_id: runId,
|
|
2169
2369
|
action: "dedupe_exact_merge",
|
|
2170
2370
|
memory_id: loser.id,
|
|
@@ -2360,7 +2560,7 @@ function applyRejectFragment(db, runId, plan) {
|
|
|
2360
2560
|
after ?? null
|
|
2361
2561
|
);
|
|
2362
2562
|
db.insert(maintenanceCleanupLog).values({
|
|
2363
|
-
id:
|
|
2563
|
+
id: randomUUID4(),
|
|
2364
2564
|
run_id: runId,
|
|
2365
2565
|
action: "reject_fragment_candidate",
|
|
2366
2566
|
memory_id: plan.memory_id,
|
|
@@ -2404,7 +2604,7 @@ function applyRejectTestFixtureRepo(db, runId, plan) {
|
|
|
2404
2604
|
after ?? null
|
|
2405
2605
|
);
|
|
2406
2606
|
db.insert(maintenanceCleanupLog).values({
|
|
2407
|
-
id:
|
|
2607
|
+
id: randomUUID4(),
|
|
2408
2608
|
run_id: runId,
|
|
2409
2609
|
action: "reject_test_fixture_repo",
|
|
2410
2610
|
memory_id: plan.memory_id,
|
|
@@ -2473,7 +2673,7 @@ function applyRejectInvalidScope(db, runId, plan) {
|
|
|
2473
2673
|
after ?? null
|
|
2474
2674
|
);
|
|
2475
2675
|
db.insert(maintenanceCleanupLog).values({
|
|
2476
|
-
id:
|
|
2676
|
+
id: randomUUID4(),
|
|
2477
2677
|
run_id: runId,
|
|
2478
2678
|
action: "reject_invalid_scope",
|
|
2479
2679
|
memory_id: plan.memory_id,
|
|
@@ -2532,7 +2732,7 @@ function applyRejectGenericScannedTooling(db, runId, plan) {
|
|
|
2532
2732
|
after ?? null
|
|
2533
2733
|
);
|
|
2534
2734
|
db.insert(maintenanceCleanupLog).values({
|
|
2535
|
-
id:
|
|
2735
|
+
id: randomUUID4(),
|
|
2536
2736
|
run_id: runId,
|
|
2537
2737
|
action: "reject_generic_scanned_tooling",
|
|
2538
2738
|
memory_id: plan.memory_id,
|
|
@@ -2596,7 +2796,7 @@ function applySuppressCommand(db, runId, plan) {
|
|
|
2596
2796
|
after ?? null
|
|
2597
2797
|
);
|
|
2598
2798
|
db.insert(maintenanceCleanupLog).values({
|
|
2599
|
-
id:
|
|
2799
|
+
id: randomUUID4(),
|
|
2600
2800
|
run_id: runId,
|
|
2601
2801
|
action: "suppress_unproductive_command",
|
|
2602
2802
|
memory_id: plan.memory_id,
|
|
@@ -2691,7 +2891,7 @@ function applyGlobalizeCrossRepo(db, runId, plan) {
|
|
|
2691
2891
|
after ?? null
|
|
2692
2892
|
);
|
|
2693
2893
|
db.insert(maintenanceCleanupLog).values({
|
|
2694
|
-
id:
|
|
2894
|
+
id: randomUUID4(),
|
|
2695
2895
|
run_id: runId,
|
|
2696
2896
|
action: "globalize_cross_repo",
|
|
2697
2897
|
memory_id: winner.id,
|
|
@@ -2718,7 +2918,7 @@ function applyGlobalizeCrossRepo(db, runId, plan) {
|
|
|
2718
2918
|
afterLoser ?? null
|
|
2719
2919
|
);
|
|
2720
2920
|
db.insert(maintenanceCleanupLog).values({
|
|
2721
|
-
id:
|
|
2921
|
+
id: randomUUID4(),
|
|
2722
2922
|
run_id: runId,
|
|
2723
2923
|
action: "globalize_cross_repo",
|
|
2724
2924
|
memory_id: loserId,
|
|
@@ -2824,6 +3024,7 @@ function formatCleanupReport(report) {
|
|
|
2824
3024
|
lines.push(` test_fixture_rejects: ${report.counts.test_fixture_rejections}`);
|
|
2825
3025
|
lines.push(` invalid_scope_rejects:${report.counts.invalid_scope_rejections}`);
|
|
2826
3026
|
lines.push(` generic_tool_rejects: ${report.counts.generic_scanned_tooling_rejections}`);
|
|
3027
|
+
lines.push(` agent_authored_rejects: ${report.counts.agent_authored_rejections}`);
|
|
2827
3028
|
lines.push(` e2e_artifact_rejects: ${report.counts.e2e_artifact_rejections}`);
|
|
2828
3029
|
if (report.plan.length === 0) {
|
|
2829
3030
|
lines.push(" (no actions)");
|
|
@@ -2852,6 +3053,9 @@ function formatCleanupReport(report) {
|
|
|
2852
3053
|
} else if (item.kind === "reject_invalid_scope") {
|
|
2853
3054
|
lines.push(` reject-invalid-scope: ${item.memory_id.slice(0, 8)} scope=${item.scope} repo=${item.repo ?? "-"} path=${item.path_scope ?? "-"} reasons=${item.reasons.join(",")}`);
|
|
2854
3055
|
lines.push(` "${truncate(item.text, 80)}"`);
|
|
3056
|
+
} else if (item.kind === "reject_agent_authored") {
|
|
3057
|
+
lines.push(` reject-agent-authored: ${item.memory_id.slice(0, 8)} sources=${[...new Set(item.sessions.map((s) => s.source))].join(",")} sessions=${item.sessions.length}`);
|
|
3058
|
+
lines.push(` "${truncate(item.text, 80)}"`);
|
|
2855
3059
|
} else {
|
|
2856
3060
|
lines.push(` reject-generic-tooling: ${item.memory_id.slice(0, 8)} source=${item.source} type=${item.memory_type}`);
|
|
2857
3061
|
lines.push(` "${truncate(item.text, 80)}"`);
|
|
@@ -3558,7 +3762,7 @@ function applySummarizeSession(db, task, result) {
|
|
|
3558
3762
|
const payload = task.payload;
|
|
3559
3763
|
const sessionId = payload.session_id;
|
|
3560
3764
|
if (!sessionId) throw new ApplyError("payload missing session_id", "invalid-state");
|
|
3561
|
-
const id =
|
|
3765
|
+
const id = randomUUID5();
|
|
3562
3766
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3563
3767
|
db.insert(historySnippets).values({
|
|
3564
3768
|
id,
|
|
@@ -3576,7 +3780,7 @@ function applySynthesizeRepo(db, task, result) {
|
|
|
3576
3780
|
const payload = task.payload;
|
|
3577
3781
|
const repo = payload.repo;
|
|
3578
3782
|
if (!repo) throw new ApplyError("payload missing repo", "invalid-state");
|
|
3579
|
-
const id =
|
|
3783
|
+
const id = randomUUID5();
|
|
3580
3784
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3581
3785
|
db.insert(historySnippets).values({
|
|
3582
3786
|
id,
|
|
@@ -3830,7 +4034,7 @@ function hasActiveTaskForTarget(db, kind, target) {
|
|
|
3830
4034
|
}
|
|
3831
4035
|
function insertTaskIdempotent(db, input) {
|
|
3832
4036
|
if (hasActiveTaskForTarget(db, input.kind, input.target)) return null;
|
|
3833
|
-
const id =
|
|
4037
|
+
const id = randomUUID6();
|
|
3834
4038
|
db.insert(memoryMaintenanceTasks).values({
|
|
3835
4039
|
id,
|
|
3836
4040
|
kind: input.kind,
|
|
@@ -4608,6 +4812,7 @@ export {
|
|
|
4608
4812
|
autoResolveContradictions,
|
|
4609
4813
|
listContradictions,
|
|
4610
4814
|
evaluateScannedMemory,
|
|
4815
|
+
isAutomatedCodexThread,
|
|
4611
4816
|
runDeterministicCleanup,
|
|
4612
4817
|
planDedupeExact,
|
|
4613
4818
|
planRejectFragments,
|
|
@@ -4628,4 +4833,4 @@ export {
|
|
|
4628
4833
|
processCorrection,
|
|
4629
4834
|
processReviewFeedback
|
|
4630
4835
|
};
|
|
4631
|
-
//# sourceMappingURL=chunk-
|
|
4836
|
+
//# sourceMappingURL=chunk-R5CG3RC4.js.map
|