@edihasaj/recall 2.0.16 → 2.0.18
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 +34 -4
- package/dist/{chunk-MLC3KO2O.js → chunk-2YFC2U6M.js} +7 -7
- package/dist/{chunk-YELXEWKH.js → chunk-CGZP6FXD.js} +3 -3
- package/dist/{chunk-LEOXFQJJ.js → chunk-EJNIQVIJ.js} +2 -2
- package/dist/{chunk-EKFOHVHS.js → chunk-HKA2KAB2.js} +233 -28
- package/dist/chunk-HKA2KAB2.js.map +1 -0
- package/dist/{chunk-VRAG5V66.js → chunk-JMAWDCQM.js} +1091 -48
- package/dist/chunk-JMAWDCQM.js.map +1 -0
- package/dist/{chunk-GDN44ZC7.js → chunk-LGM46TRO.js} +2 -2
- package/dist/{chunk-SEXZABB2.js → chunk-MXF255YS.js} +5 -5
- package/dist/{chunk-GCMP2YYN.js → chunk-OIIAMDOT.js} +4 -3
- package/dist/{chunk-GCMP2YYN.js.map → chunk-OIIAMDOT.js.map} +1 -1
- package/dist/{chunk-FYMMTODQ.js → chunk-PVEH3GEI.js} +2 -2
- package/dist/{chunk-FYMMTODQ.js.map → chunk-PVEH3GEI.js.map} +1 -1
- package/dist/{chunk-DAW6FUGL.js → chunk-SARDP34D.js} +5 -5
- package/dist/{chunk-SYSSACWJ.js → chunk-SHS4CTN3.js} +43 -20
- package/dist/chunk-SHS4CTN3.js.map +1 -0
- package/dist/{chunk-DOYTMHDI.js → chunk-SYYBKTWO.js} +2 -2
- package/dist/{chunk-Q2F7EQCA.js → chunk-UNKEHYFD.js} +2 -2
- package/dist/{chunk-7UWVXXTU.js → chunk-VNKQBRLB.js} +3 -3
- package/dist/{chunk-QPR77YXP.js → chunk-XBYAK7LC.js} +13 -11
- package/dist/chunk-XBYAK7LC.js.map +1 -0
- package/dist/{chunk-THC7QOAK.js → chunk-XOKSI4EY.js} +7 -7
- package/dist/{chunk-DVLQYARZ.js → chunk-YFK2AD34.js} +3 -3
- package/dist/{chunk-ZF23OPYV.js → chunk-Z2NS4E63.js} +31 -38
- package/dist/chunk-Z2NS4E63.js.map +1 -0
- package/dist/{cleanup-WJFE6IVP.js → cleanup-PYF3MQXT.js} +11 -11
- package/dist/cli.js +58 -191
- package/dist/cli.js.map +1 -1
- package/dist/{codex-trust-3BFTJFRD.js → codex-trust-JTJSVDJ4.js} +4 -4
- package/dist/daemon.js +1213 -188
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-JZKQYPLF.js +22 -0
- package/dist/{embeddings-H352GFKD.js → embeddings-3NAF5DFW.js} +5 -5
- package/dist/ingest-KWIQFV6X.js +20 -0
- package/dist/{keychain-A2Z7D7YE.js → keychain-FLEYJZCO.js} +3 -3
- package/dist/mcp.js +15 -15
- package/dist/{memory-value-M3TA7SEK.js → memory-value-DT5DNGJA.js} +11 -11
- package/dist/{provenance-CXU6LZK7.js → provenance-ZBYCDVTO.js} +9 -9
- package/dist/quality-UQME7OTQ.js +25 -0
- package/dist/retrieval-V7TY5HRU.js +15 -0
- package/dist/{store-YCVWABSH.js → store-UQFDKVUA.js} +4 -4
- package/dist/sync-server.js +2 -2
- package/dist/{tasks-4UL2FIAQ.js → tasks-2LMQ3ZXB.js} +11 -11
- package/dist/{usage-HZ27RG53.js → usage-ZXD4DO5J.js} +4 -4
- package/package.json +2 -1
- package/vendor/recall-cloud-sync/PROVENANCE.md +40 -0
- package/vendor/recall-cloud-sync/managed-worker.mjs +48 -0
- package/vendor/recall-cloud-sync/private-token.mjs +95 -0
- package/vendor/recall-cloud-sync/recall-sync-local.mjs +415 -0
- package/vendor/recall-cloud-sync/recall-sync.mjs +1300 -0
- package/dist/chunk-EKFOHVHS.js.map +0 -1
- package/dist/chunk-QPR77YXP.js.map +0 -1
- package/dist/chunk-SYSSACWJ.js.map +0 -1
- package/dist/chunk-VRAG5V66.js.map +0 -1
- package/dist/chunk-ZF23OPYV.js.map +0 -1
- package/dist/dispatcher-5JVGZNWT.js +0 -22
- package/dist/ingest-NVYEOSVZ.js +0 -20
- package/dist/quality-4CG6U273.js +0 -25
- package/dist/retrieval-42CPYUDW.js +0 -15
- /package/dist/{chunk-MLC3KO2O.js.map → chunk-2YFC2U6M.js.map} +0 -0
- /package/dist/{chunk-YELXEWKH.js.map → chunk-CGZP6FXD.js.map} +0 -0
- /package/dist/{chunk-LEOXFQJJ.js.map → chunk-EJNIQVIJ.js.map} +0 -0
- /package/dist/{chunk-GDN44ZC7.js.map → chunk-LGM46TRO.js.map} +0 -0
- /package/dist/{chunk-SEXZABB2.js.map → chunk-MXF255YS.js.map} +0 -0
- /package/dist/{chunk-DAW6FUGL.js.map → chunk-SARDP34D.js.map} +0 -0
- /package/dist/{chunk-DOYTMHDI.js.map → chunk-SYYBKTWO.js.map} +0 -0
- /package/dist/{chunk-Q2F7EQCA.js.map → chunk-UNKEHYFD.js.map} +0 -0
- /package/dist/{chunk-7UWVXXTU.js.map → chunk-VNKQBRLB.js.map} +0 -0
- /package/dist/{chunk-THC7QOAK.js.map → chunk-XOKSI4EY.js.map} +0 -0
- /package/dist/{chunk-DVLQYARZ.js.map → chunk-YFK2AD34.js.map} +0 -0
- /package/dist/{cleanup-WJFE6IVP.js.map → cleanup-PYF3MQXT.js.map} +0 -0
- /package/dist/{codex-trust-3BFTJFRD.js.map → codex-trust-JTJSVDJ4.js.map} +0 -0
- /package/dist/{dispatcher-5JVGZNWT.js.map → dispatcher-JZKQYPLF.js.map} +0 -0
- /package/dist/{embeddings-H352GFKD.js.map → embeddings-3NAF5DFW.js.map} +0 -0
- /package/dist/{ingest-NVYEOSVZ.js.map → ingest-KWIQFV6X.js.map} +0 -0
- /package/dist/{keychain-A2Z7D7YE.js.map → keychain-FLEYJZCO.js.map} +0 -0
- /package/dist/{memory-value-M3TA7SEK.js.map → memory-value-DT5DNGJA.js.map} +0 -0
- /package/dist/{provenance-CXU6LZK7.js.map → provenance-ZBYCDVTO.js.map} +0 -0
- /package/dist/{quality-4CG6U273.js.map → quality-UQME7OTQ.js.map} +0 -0
- /package/dist/{retrieval-42CPYUDW.js.map → retrieval-V7TY5HRU.js.map} +0 -0
- /package/dist/{store-YCVWABSH.js.map → store-UQFDKVUA.js.map} +0 -0
- /package/dist/{tasks-4UL2FIAQ.js.map → tasks-2LMQ3ZXB.js.map} +0 -0
- /package/dist/{usage-HZ27RG53.js.map → usage-ZXD4DO5J.js.map} +0 -0
package/README.md
CHANGED
|
@@ -44,7 +44,19 @@ The bundled web dashboard (open via the menu bar item *Open Dashboard in Browser
|
|
|
44
44
|
- **Timeline** — filterable feed of every daemon event (compile, query, scan, correction, feedback, tool calls…). Click a row to expand the full request/result JSON; jump straight to the linked memories or pivot into the session view.
|
|
45
45
|
- **Sessions** — every distinct session Recall has seen across MCP, hooks, and CLI traffic, with duration, event count, and type breakdown. Expand a session to see its events inline or hand it off to the Timeline filtered by `session_id`.
|
|
46
46
|
|
|
47
|
-
## Benchmarks
|
|
47
|
+
## Benchmarks
|
|
48
|
+
|
|
49
|
+
### LongMemEval-S answer accuracy
|
|
50
|
+
|
|
51
|
+
Recall answered **474 of 500** LongMemEval-S questions correctly (**94.8%**) in its best experimental run.
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
Best of two runs of the same setup (474 and 470), answered and judged with Qwen. Other scores are as published by [Hindsight](https://github.com/vectorize-io/hindsight) with different models, so this is not a head-to-head test. See the [results, everything we tried and how we measured it](benchmark/LONGMEMEVAL.md).
|
|
56
|
+
|
|
57
|
+
A separate Cloud Linux backend evidence evaluation also scored **474/500**, with Qwen answering and judging. See its [configuration and scope](benchmark/LONGMEMEVAL.md#cloud-backend-evaluation).
|
|
58
|
+
|
|
59
|
+
### Retrieval vs agentmemory
|
|
48
60
|
|
|
49
61
|
LongMemEval-S, N=500, including 30 unanswerable question IDs. Same dataset
|
|
50
62
|
agentmemory publishes; these are retrieval metrics, not answer accuracy.
|
|
@@ -59,11 +71,24 @@ The MiniLM row isolates the system contribution (same embedding model agentmemor
|
|
|
59
71
|
|
|
60
72
|
## Install
|
|
61
73
|
|
|
74
|
+
Cloud is optional. Connecting a server-readable Cloud account enables syncing
|
|
75
|
+
and online retrieval, which sends agent question text to your configured Cloud.
|
|
76
|
+
Turn retrieval off independently in the Cloud tab or with `recall cloud-query off`.
|
|
77
|
+
Existing explicit off settings are preserved.
|
|
78
|
+
|
|
79
|
+
For private backup and device sync, choose **Private sync · local search** in
|
|
80
|
+
the Mac app. Memory text, notes and evidence are encrypted before upload;
|
|
81
|
+
search runs on your device, including offline after sync and indexing. Save
|
|
82
|
+
the same passphrase for every device. Hosted MCP and Cloud search require
|
|
83
|
+
the separate server-readable mode. See [private Cloud sync](docs/private-cloud.md)
|
|
84
|
+
for recovery and the limits of this privacy boundary.
|
|
85
|
+
|
|
62
86
|
### Mac App Store edition
|
|
63
87
|
|
|
64
|
-
The sandboxed store edition, **Recall: Coding Memory
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
The sandboxed store edition, **Recall: Coding Memory**, has the same window as
|
|
89
|
+
the direct app. Version 2.0.7 was rejected on 15 October 2026 (Guidelines 4.3
|
|
90
|
+
and 4.2.6); 2.0.14 (1) was uploaded on 23 October 2026 and is not yet
|
|
91
|
+
submitted. It will be free and publish automatically after approval.
|
|
67
92
|
It includes its own runtime and connects agents through local HTTP. Memory is
|
|
68
93
|
stored in the app container, and repository access is granted through a folder
|
|
69
94
|
picker. See [store release and connection details](docs/mac-app-store.md).
|
|
@@ -583,3 +608,8 @@ npm run build
|
|
|
583
608
|
```
|
|
584
609
|
|
|
585
610
|
Release and Homebrew publishing notes live in [docs/RELEASING.md](docs/RELEASING.md). The landing page is static HTML/CSS in [docs/](docs/) and deploys with GitHub Pages. Public crawl configuration lives in [docs/robots.txt](docs/robots.txt), with canonical landing-page URLs listed in [docs/sitemap.xml](docs/sitemap.xml).
|
|
611
|
+
|
|
612
|
+
IndexNow ownership is not committed to the repository. The Pages workflow writes
|
|
613
|
+
the public `/<key>.txt` verification file into the uploaded site at deploy time
|
|
614
|
+
from the repository secret `COMPASS_INDEXNOW_KEY`, the shared Compass portfolio
|
|
615
|
+
key. Runs without that secret skip the step and publish the site unchanged.
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
textMatchScore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EJNIQVIJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getMemory,
|
|
6
6
|
promoteMemory,
|
|
7
7
|
queryMemories
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XOKSI4EY.js";
|
|
9
9
|
import {
|
|
10
10
|
asc,
|
|
11
11
|
desc
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YFK2AD34.js";
|
|
13
13
|
import {
|
|
14
14
|
cosineSimilarity,
|
|
15
15
|
generateEmbedding,
|
|
16
16
|
loadEmbedding,
|
|
17
17
|
loadEmbeddingConfigFromEnv
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SHS4CTN3.js";
|
|
19
19
|
import {
|
|
20
20
|
and,
|
|
21
21
|
eq,
|
|
@@ -26,10 +26,10 @@ import {
|
|
|
26
26
|
memoryInjections,
|
|
27
27
|
memoryValueEvents,
|
|
28
28
|
sql
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-OIIAMDOT.js";
|
|
30
30
|
import {
|
|
31
31
|
init_define_RECALL_BUILD_INFO
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-PVEH3GEI.js";
|
|
33
33
|
|
|
34
34
|
// src/models/memory-value.ts
|
|
35
35
|
init_define_RECALL_BUILD_INFO();
|
|
@@ -617,4 +617,4 @@ export {
|
|
|
617
617
|
detectAndRecordRetrievalMissesSemantic,
|
|
618
618
|
computeMemoryValueReport
|
|
619
619
|
};
|
|
620
|
-
//# sourceMappingURL=chunk-
|
|
620
|
+
//# sourceMappingURL=chunk-2YFC2U6M.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineOwn,
|
|
3
3
|
deleteOwn
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SYYBKTWO.js";
|
|
5
5
|
import {
|
|
6
6
|
init_define_RECALL_BUILD_INFO
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PVEH3GEI.js";
|
|
8
8
|
|
|
9
9
|
// src/agents/codex.ts
|
|
10
10
|
init_define_RECALL_BUILD_INFO();
|
|
@@ -591,4 +591,4 @@ export {
|
|
|
591
591
|
installCodexHooks,
|
|
592
592
|
uninstallCodexHooks
|
|
593
593
|
};
|
|
594
|
-
//# sourceMappingURL=chunk-
|
|
594
|
+
//# sourceMappingURL=chunk-CGZP6FXD.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_define_RECALL_BUILD_INFO
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PVEH3GEI.js";
|
|
4
4
|
|
|
5
5
|
// src/text/match.ts
|
|
6
6
|
init_define_RECALL_BUILD_INFO();
|
|
@@ -116,4 +116,4 @@ export {
|
|
|
116
116
|
textMatchScore,
|
|
117
117
|
matchTokens
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=chunk-
|
|
119
|
+
//# sourceMappingURL=chunk-EJNIQVIJ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
matchTokens,
|
|
3
3
|
textMatchScore
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EJNIQVIJ.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-XOKSI4EY.js";
|
|
28
28
|
import {
|
|
29
29
|
desc
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-YFK2AD34.js";
|
|
31
31
|
import {
|
|
32
32
|
defineOwn
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-SYYBKTWO.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-SHS4CTN3.js";
|
|
45
45
|
import {
|
|
46
46
|
hasProviderConfigured,
|
|
47
47
|
init_keychain
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-LGM46TRO.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-OIIAMDOT.js";
|
|
71
71
|
import {
|
|
72
72
|
init_define_RECALL_BUILD_INFO
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-PVEH3GEI.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,
|
|
@@ -4554,6 +4758,8 @@ function releaseTask(db, taskId, agent, reason) {
|
|
|
4554
4758
|
}
|
|
4555
4759
|
|
|
4556
4760
|
export {
|
|
4761
|
+
redactSensitiveText,
|
|
4762
|
+
redactSensitiveValue,
|
|
4557
4763
|
computeHealthScore,
|
|
4558
4764
|
computeAllHealthScores,
|
|
4559
4765
|
formatHealthReport,
|
|
@@ -4606,6 +4812,7 @@ export {
|
|
|
4606
4812
|
autoResolveContradictions,
|
|
4607
4813
|
listContradictions,
|
|
4608
4814
|
evaluateScannedMemory,
|
|
4815
|
+
isAutomatedCodexThread,
|
|
4609
4816
|
runDeterministicCleanup,
|
|
4610
4817
|
planDedupeExact,
|
|
4611
4818
|
planRejectFragments,
|
|
@@ -4620,12 +4827,10 @@ export {
|
|
|
4620
4827
|
revertCleanupRun,
|
|
4621
4828
|
listCleanupRuns,
|
|
4622
4829
|
formatCleanupReport,
|
|
4623
|
-
redactSensitiveText,
|
|
4624
|
-
redactSensitiveValue,
|
|
4625
4830
|
isTriggerTemplateRule,
|
|
4626
4831
|
isHighRiskRule,
|
|
4627
4832
|
detectCorrections,
|
|
4628
4833
|
processCorrection,
|
|
4629
4834
|
processReviewFeedback
|
|
4630
4835
|
};
|
|
4631
|
-
//# sourceMappingURL=chunk-
|
|
4836
|
+
//# sourceMappingURL=chunk-HKA2KAB2.js.map
|