@edihasaj/recall 1.4.21 → 2.0.0
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 +6 -1
- package/dist/{chunk-HKH2A5MQ.js → chunk-3QYS57WE.js} +22 -16
- package/dist/chunk-3QYS57WE.js.map +1 -0
- package/dist/{chunk-7C3MVO4N.js → chunk-5OINDHZX.js} +274 -264
- package/dist/chunk-5OINDHZX.js.map +1 -0
- package/dist/{chunk-FZTOMGN4.js → chunk-5TKJMYHL.js} +23 -35
- package/dist/chunk-5TKJMYHL.js.map +1 -0
- package/dist/{chunk-M7EDOBC4.js → chunk-7NNSGT54.js} +7 -7
- package/dist/{chunk-RYOHHVJF.js → chunk-A4BPE5JF.js} +5 -5
- package/dist/{chunk-FIHRWLLC.js → chunk-B6CMONK7.js} +2 -2
- package/dist/{chunk-4D5MTK66.js → chunk-DBT75RQV.js} +3 -3
- package/dist/{chunk-WB7ZIESD.js → chunk-FODMIXSP.js} +2 -2
- package/dist/{chunk-QBAK3LLT.js → chunk-HN4D2DY5.js} +3 -3
- package/dist/{chunk-N2Z2RXIA.js → chunk-IFQ6XGEJ.js} +5 -5
- package/dist/{chunk-3FHPDDSC.js → chunk-KZD2JDE6.js} +214 -106
- package/dist/chunk-KZD2JDE6.js.map +1 -0
- package/dist/{chunk-M4HFQVRF.js → chunk-NOYIFPKZ.js} +10 -3
- package/dist/chunk-NOYIFPKZ.js.map +1 -0
- package/dist/{chunk-SPA5ED52.js → chunk-OZ745MJO.js} +3 -3
- package/dist/{chunk-2BEW4B7D.js → chunk-SIPPH6BQ.js} +2 -2
- package/dist/{chunk-MW3PYU57.js → chunk-U3FQMZ3L.js} +2 -2
- package/dist/{chunk-KHLG4LBX.js → chunk-VQUBZHJ3.js} +2 -2
- package/dist/{chunk-KHLG4LBX.js.map → chunk-VQUBZHJ3.js.map} +1 -1
- package/dist/{chunk-JAV2SSSL.js → chunk-XBRSGU75.js} +241 -70
- package/dist/chunk-XBRSGU75.js.map +1 -0
- package/dist/{chunk-LKSC4JTU.js → chunk-Y247NGUR.js} +97 -16
- package/dist/chunk-Y247NGUR.js.map +1 -0
- package/dist/{cleanup-45S5Q6WX.js → cleanup-IY4BJS2F.js} +11 -11
- package/dist/cli.js +43 -43
- package/dist/{codex-trust-JCPCL3QI.js → codex-trust-RY3H4ZFY.js} +4 -4
- package/dist/daemon.js +21 -21
- package/dist/dispatcher-PAHW6SUJ.js +22 -0
- package/dist/{embeddings-3QFO2LC7.js → embeddings-LDYSUVMQ.js} +5 -5
- package/dist/ingest-ZFDMRBZP.js +20 -0
- package/dist/{keychain-M2SNOTJG.js → keychain-RVIDTJNO.js} +3 -3
- package/dist/mcp.js +15 -15
- package/dist/{memory-value-4BAP2O4R.js → memory-value-5FVSRSHI.js} +11 -11
- package/dist/{provenance-RTA6LBL2.js → provenance-A7QFX2EV.js} +9 -9
- package/dist/quality-UPL7DJFO.js +25 -0
- package/dist/retrieval-ZUBK33XA.js +15 -0
- package/dist/{store-BDSVSIRD.js → store-X7E4MC7X.js} +4 -4
- package/dist/sync-server.js +2 -2
- package/dist/{tasks-6FVDXYEP.js → tasks-KBGHP3YX.js} +15 -11
- package/dist/{usage-NKVHLHWY.js → usage-XRBNDA56.js} +4 -4
- package/drizzle/0012_memory_notes.sql +1 -0
- package/drizzle/meta/0012_snapshot.json +2719 -0
- package/drizzle/meta/_journal.json +8 -1
- package/package.json +1 -1
- package/dist/chunk-3FHPDDSC.js.map +0 -1
- package/dist/chunk-7C3MVO4N.js.map +0 -1
- package/dist/chunk-FZTOMGN4.js.map +0 -1
- package/dist/chunk-HKH2A5MQ.js.map +0 -1
- package/dist/chunk-JAV2SSSL.js.map +0 -1
- package/dist/chunk-LKSC4JTU.js.map +0 -1
- package/dist/chunk-M4HFQVRF.js.map +0 -1
- package/dist/dispatcher-6QIVLH3D.js +0 -22
- package/dist/ingest-QOFPUBDB.js +0 -20
- package/dist/quality-XRXGLQAK.js +0 -25
- package/dist/retrieval-OQBN7365.js +0 -15
- /package/dist/{chunk-M7EDOBC4.js.map → chunk-7NNSGT54.js.map} +0 -0
- /package/dist/{chunk-RYOHHVJF.js.map → chunk-A4BPE5JF.js.map} +0 -0
- /package/dist/{chunk-FIHRWLLC.js.map → chunk-B6CMONK7.js.map} +0 -0
- /package/dist/{chunk-4D5MTK66.js.map → chunk-DBT75RQV.js.map} +0 -0
- /package/dist/{chunk-WB7ZIESD.js.map → chunk-FODMIXSP.js.map} +0 -0
- /package/dist/{chunk-QBAK3LLT.js.map → chunk-HN4D2DY5.js.map} +0 -0
- /package/dist/{chunk-N2Z2RXIA.js.map → chunk-IFQ6XGEJ.js.map} +0 -0
- /package/dist/{chunk-SPA5ED52.js.map → chunk-OZ745MJO.js.map} +0 -0
- /package/dist/{chunk-2BEW4B7D.js.map → chunk-SIPPH6BQ.js.map} +0 -0
- /package/dist/{chunk-MW3PYU57.js.map → chunk-U3FQMZ3L.js.map} +0 -0
- /package/dist/{cleanup-45S5Q6WX.js.map → cleanup-IY4BJS2F.js.map} +0 -0
- /package/dist/{codex-trust-JCPCL3QI.js.map → codex-trust-RY3H4ZFY.js.map} +0 -0
- /package/dist/{dispatcher-6QIVLH3D.js.map → dispatcher-PAHW6SUJ.js.map} +0 -0
- /package/dist/{embeddings-3QFO2LC7.js.map → embeddings-LDYSUVMQ.js.map} +0 -0
- /package/dist/{ingest-QOFPUBDB.js.map → ingest-ZFDMRBZP.js.map} +0 -0
- /package/dist/{keychain-M2SNOTJG.js.map → keychain-RVIDTJNO.js.map} +0 -0
- /package/dist/{memory-value-4BAP2O4R.js.map → memory-value-5FVSRSHI.js.map} +0 -0
- /package/dist/{provenance-RTA6LBL2.js.map → provenance-A7QFX2EV.js.map} +0 -0
- /package/dist/{quality-XRXGLQAK.js.map → quality-UPL7DJFO.js.map} +0 -0
- /package/dist/{retrieval-OQBN7365.js.map → retrieval-ZUBK33XA.js.map} +0 -0
- /package/dist/{store-BDSVSIRD.js.map → store-X7E4MC7X.js.map} +0 -0
- /package/dist/{tasks-6FVDXYEP.js.map → tasks-KBGHP3YX.js.map} +0 -0
- /package/dist/{usage-NKVHLHWY.js.map → usage-XRBNDA56.js.map} +0 -0
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
processCorrection,
|
|
10
10
|
redactSensitiveValue,
|
|
11
11
|
seedScannedConfidence
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Y247NGUR.js";
|
|
13
13
|
import {
|
|
14
14
|
recordInjectionValueEvents,
|
|
15
15
|
recordMemoryInjections,
|
|
16
16
|
recordOutcomeValueEvent,
|
|
17
17
|
resolveMemoryInjectionOutcome
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-7NNSGT54.js";
|
|
19
19
|
import {
|
|
20
20
|
textMatchScore
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-SIPPH6BQ.js";
|
|
22
22
|
import {
|
|
23
23
|
activityEventDedupeKey,
|
|
24
24
|
confirmMemory,
|
|
@@ -36,33 +36,42 @@ import {
|
|
|
36
36
|
recordAudit,
|
|
37
37
|
recordFeedback,
|
|
38
38
|
rejectMemory,
|
|
39
|
+
setMemoryNote,
|
|
39
40
|
statusFromConfidence
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-5TKJMYHL.js";
|
|
41
42
|
import {
|
|
42
43
|
asc,
|
|
43
44
|
desc
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-DBT75RQV.js";
|
|
45
46
|
import {
|
|
46
47
|
BACKGROUND_INDEX_BATCH_SIZE,
|
|
47
48
|
CONFIDENCE,
|
|
48
49
|
RetrievalEvalCase,
|
|
49
50
|
RetrievalEvalFile,
|
|
50
|
-
atomicWriteUtf8File,
|
|
51
51
|
bootstrapEmbeddings,
|
|
52
|
+
callLlm,
|
|
52
53
|
generateEmbedding,
|
|
53
54
|
generateEmbeddings,
|
|
54
55
|
getEmbeddingCacheRoot,
|
|
55
56
|
getSynonyms,
|
|
56
57
|
hybridSearch,
|
|
58
|
+
isRerankerEnabled,
|
|
57
59
|
load,
|
|
58
60
|
loadEmbeddingConfigFromEnv,
|
|
59
61
|
processInResponsiveBatches,
|
|
60
62
|
projectEmbeddingToIndex,
|
|
61
63
|
queueMemoryEmbeddingSync,
|
|
62
64
|
readUtf8FileIfExists,
|
|
65
|
+
rerankCompanionRatio,
|
|
66
|
+
rerankMinScore,
|
|
63
67
|
resolveProvider,
|
|
68
|
+
retrievalText,
|
|
64
69
|
tagActivitySource
|
|
65
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-XBRSGU75.js";
|
|
71
|
+
import {
|
|
72
|
+
hasProviderConfigured,
|
|
73
|
+
init_keychain
|
|
74
|
+
} from "./chunk-B6CMONK7.js";
|
|
66
75
|
import {
|
|
67
76
|
Column,
|
|
68
77
|
Columns,
|
|
@@ -126,10 +135,10 @@ import {
|
|
|
126
135
|
policyRules,
|
|
127
136
|
schema_exports,
|
|
128
137
|
sql
|
|
129
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-NOYIFPKZ.js";
|
|
130
139
|
import {
|
|
131
140
|
init_define_RECALL_BUILD_INFO
|
|
132
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-VQUBZHJ3.js";
|
|
133
142
|
|
|
134
143
|
// src/db/client.ts
|
|
135
144
|
init_define_RECALL_BUILD_INFO();
|
|
@@ -1700,7 +1709,7 @@ var SQLiteSelectQueryBuilderBase = class extends TypedQueryBuilder {
|
|
|
1700
1709
|
const baseTableName = this.tableName;
|
|
1701
1710
|
const tableName = getTableLikeName(table);
|
|
1702
1711
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
1703
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
1712
|
+
if (typeof tableName === "string" && this.config.joins?.some((join4) => join4.alias === tableName)) {
|
|
1704
1713
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
1705
1714
|
}
|
|
1706
1715
|
if (!this.isPartialSelect) {
|
|
@@ -2560,7 +2569,7 @@ var SQLiteUpdateBase = class extends QueryPromise {
|
|
|
2560
2569
|
createJoin(joinType) {
|
|
2561
2570
|
return (table, on) => {
|
|
2562
2571
|
const tableName = getTableLikeName(table);
|
|
2563
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
2572
|
+
if (typeof tableName === "string" && this.config.joins.some((join4) => join4.alias === tableName)) {
|
|
2564
2573
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
2565
2574
|
}
|
|
2566
2575
|
if (typeof on === "function") {
|
|
@@ -3247,14 +3256,14 @@ var ExecuteResultSync = class extends QueryPromise {
|
|
|
3247
3256
|
}
|
|
3248
3257
|
};
|
|
3249
3258
|
var SQLitePreparedQuery = class {
|
|
3250
|
-
constructor(mode, executeMethod, query,
|
|
3259
|
+
constructor(mode, executeMethod, query, cache2, queryMetadata, cacheConfig) {
|
|
3251
3260
|
this.mode = mode;
|
|
3252
3261
|
this.executeMethod = executeMethod;
|
|
3253
3262
|
this.query = query;
|
|
3254
|
-
this.cache =
|
|
3263
|
+
this.cache = cache2;
|
|
3255
3264
|
this.queryMetadata = queryMetadata;
|
|
3256
3265
|
this.cacheConfig = cacheConfig;
|
|
3257
|
-
if (
|
|
3266
|
+
if (cache2 && cache2.strategy() === "all" && cacheConfig === void 0) {
|
|
3258
3267
|
this.cacheConfig = { enable: true, autoInvalidate: true };
|
|
3259
3268
|
}
|
|
3260
3269
|
if (!this.cacheConfig?.enable) {
|
|
@@ -3478,8 +3487,8 @@ var BetterSQLiteTransaction = class _BetterSQLiteTransaction extends SQLiteTrans
|
|
|
3478
3487
|
}
|
|
3479
3488
|
};
|
|
3480
3489
|
var PreparedQuery = class extends SQLitePreparedQuery {
|
|
3481
|
-
constructor(stmt, query, logger,
|
|
3482
|
-
super("sync", executeMethod, query,
|
|
3490
|
+
constructor(stmt, query, logger, cache2, queryMetadata, cacheConfig, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
|
|
3491
|
+
super("sync", executeMethod, query, cache2, queryMetadata, cacheConfig);
|
|
3483
3492
|
this.stmt = stmt;
|
|
3484
3493
|
this.logger = logger;
|
|
3485
3494
|
this.fields = fields;
|
|
@@ -3633,7 +3642,7 @@ import { join, dirname } from "path";
|
|
|
3633
3642
|
import { mkdirSync, existsSync, rmSync, statSync } from "fs";
|
|
3634
3643
|
import { fileURLToPath } from "url";
|
|
3635
3644
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
3636
|
-
var RECALL_DB_USER_VERSION =
|
|
3645
|
+
var RECALL_DB_USER_VERSION = 13;
|
|
3637
3646
|
function getDbPath() {
|
|
3638
3647
|
const dataDir = process.env.RECALL_DATA_DIR ?? join(
|
|
3639
3648
|
process.env.HOME ?? process.env.USERPROFILE ?? ".",
|
|
@@ -4532,6 +4541,117 @@ function walkRepos(dir, depthRemaining, seen, repos) {
|
|
|
4532
4541
|
}
|
|
4533
4542
|
}
|
|
4534
4543
|
|
|
4544
|
+
// src/session/lifecycle.ts
|
|
4545
|
+
init_define_RECALL_BUILD_INFO();
|
|
4546
|
+
function resolveLifecycleSource(input) {
|
|
4547
|
+
if (input.source) return input.source;
|
|
4548
|
+
return input.client ? tagActivitySource("hook", input.client) : "daemon";
|
|
4549
|
+
}
|
|
4550
|
+
function startSessionLifecycle(db, input) {
|
|
4551
|
+
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
4552
|
+
const bootstrap = ensureRepoBootstrapped(db, {
|
|
4553
|
+
repo,
|
|
4554
|
+
repoPathHint: input.repo_path
|
|
4555
|
+
});
|
|
4556
|
+
if (bootstrap.status === "bootstrapped" || bootstrap.status === "scanned_empty") {
|
|
4557
|
+
createActivityEvent(db, {
|
|
4558
|
+
session_id: input.session_id,
|
|
4559
|
+
repo: bootstrap.repo,
|
|
4560
|
+
path: input.path ?? null,
|
|
4561
|
+
source: resolveLifecycleSource(input),
|
|
4562
|
+
event_type: "scan",
|
|
4563
|
+
memory_ids: bootstrap.created_ids,
|
|
4564
|
+
request: {
|
|
4565
|
+
repo_path: bootstrap.repo_path,
|
|
4566
|
+
client: input.client ?? null,
|
|
4567
|
+
trigger: "session_start_bootstrap"
|
|
4568
|
+
},
|
|
4569
|
+
result: {
|
|
4570
|
+
created: bootstrap.created_ids.length,
|
|
4571
|
+
status: bootstrap.status
|
|
4572
|
+
}
|
|
4573
|
+
});
|
|
4574
|
+
}
|
|
4575
|
+
if (bootstrap.status === "already_known" && bootstrap.repo && input.repo_path) {
|
|
4576
|
+
try {
|
|
4577
|
+
refreshKnownRepoScan(db, bootstrap.repo, input.repo_path);
|
|
4578
|
+
} catch {
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
createActivityEvent(db, {
|
|
4582
|
+
session_id: input.session_id,
|
|
4583
|
+
repo: bootstrap.repo,
|
|
4584
|
+
path: input.path ?? null,
|
|
4585
|
+
source: resolveLifecycleSource(input),
|
|
4586
|
+
event_type: "session_start",
|
|
4587
|
+
request: {
|
|
4588
|
+
client: input.client ?? null,
|
|
4589
|
+
repo_path: bootstrap.repo_path ?? input.repo_path ?? null,
|
|
4590
|
+
meta: input.meta ?? {}
|
|
4591
|
+
},
|
|
4592
|
+
result: {
|
|
4593
|
+
bootstrap_status: bootstrap.status,
|
|
4594
|
+
created: bootstrap.created_ids.length,
|
|
4595
|
+
artifact_path: null,
|
|
4596
|
+
artifact_written: false
|
|
4597
|
+
}
|
|
4598
|
+
});
|
|
4599
|
+
return {
|
|
4600
|
+
session_id: input.session_id,
|
|
4601
|
+
repo: bootstrap.repo,
|
|
4602
|
+
repo_path: bootstrap.repo_path ?? input.repo_path ?? null,
|
|
4603
|
+
bootstrap_status: bootstrap.status,
|
|
4604
|
+
created_ids: bootstrap.created_ids
|
|
4605
|
+
};
|
|
4606
|
+
}
|
|
4607
|
+
function recordSessionLifecycleEvent(db, input) {
|
|
4608
|
+
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
4609
|
+
createActivityEvent(db, {
|
|
4610
|
+
session_id: input.session_id,
|
|
4611
|
+
repo,
|
|
4612
|
+
path: input.path ?? null,
|
|
4613
|
+
source: resolveLifecycleSource(input),
|
|
4614
|
+
event_type: "session_event",
|
|
4615
|
+
request: {
|
|
4616
|
+
client: input.client ?? null,
|
|
4617
|
+
name: input.name,
|
|
4618
|
+
repo_path: input.repo_path ?? null,
|
|
4619
|
+
meta: input.meta ?? {}
|
|
4620
|
+
},
|
|
4621
|
+
result: input.payload ?? {}
|
|
4622
|
+
});
|
|
4623
|
+
return {
|
|
4624
|
+
session_id: input.session_id,
|
|
4625
|
+
repo,
|
|
4626
|
+
repo_path: input.repo_path ?? null,
|
|
4627
|
+
bootstrap_status: "skipped",
|
|
4628
|
+
created_ids: []
|
|
4629
|
+
};
|
|
4630
|
+
}
|
|
4631
|
+
function endSessionLifecycle(db, input) {
|
|
4632
|
+
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
4633
|
+
createActivityEvent(db, {
|
|
4634
|
+
session_id: input.session_id,
|
|
4635
|
+
repo,
|
|
4636
|
+
path: input.path ?? null,
|
|
4637
|
+
source: resolveLifecycleSource(input),
|
|
4638
|
+
event_type: "session_end",
|
|
4639
|
+
request: {
|
|
4640
|
+
client: input.client ?? null,
|
|
4641
|
+
repo_path: input.repo_path ?? null,
|
|
4642
|
+
meta: input.meta ?? {}
|
|
4643
|
+
},
|
|
4644
|
+
result: input.payload ?? {}
|
|
4645
|
+
});
|
|
4646
|
+
return {
|
|
4647
|
+
session_id: input.session_id,
|
|
4648
|
+
repo,
|
|
4649
|
+
repo_path: input.repo_path ?? null,
|
|
4650
|
+
bootstrap_status: "skipped",
|
|
4651
|
+
created_ids: []
|
|
4652
|
+
};
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4535
4655
|
// src/history/snippets.ts
|
|
4536
4656
|
init_define_RECALL_BUILD_INFO();
|
|
4537
4657
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -5135,6 +5255,94 @@ function listInjectedHistoryIdsForSession(db, sessionId) {
|
|
|
5135
5255
|
return new Set(rows.map((row) => row.snippet_id));
|
|
5136
5256
|
}
|
|
5137
5257
|
|
|
5258
|
+
// src/embeddings/llm-judge.ts
|
|
5259
|
+
init_define_RECALL_BUILD_INFO();
|
|
5260
|
+
import { createHash as createHash3 } from "crypto";
|
|
5261
|
+
init_keychain();
|
|
5262
|
+
function llmJudgeCandidates() {
|
|
5263
|
+
const parsed = Number.parseInt(process.env.RECALL_RELEVANCE_LLM_CANDIDATES ?? "", 10);
|
|
5264
|
+
return Number.isInteger(parsed) && parsed > 0 && parsed <= 32 ? parsed : 8;
|
|
5265
|
+
}
|
|
5266
|
+
var CACHE_MAX = 256;
|
|
5267
|
+
var cache = /* @__PURE__ */ new Map();
|
|
5268
|
+
var judgeOverride = null;
|
|
5269
|
+
var SYSTEM = [
|
|
5270
|
+
"You decide which remembered facts or rules should change how a careful coding assistant handles a request.",
|
|
5271
|
+
"Imagine handling the request twice, once without the memory and once knowing it. Grade each memory:",
|
|
5272
|
+
"0 = no difference (irrelevant, or only shares a topic); 1 = at most a passing mention;",
|
|
5273
|
+
"2 = it changes some details, steps or caveats; 3 = it changes the plan, prevents a mistake, or makes the naive answer wrong.",
|
|
5274
|
+
"Judge each memory independently. Reply with JSON only."
|
|
5275
|
+
].join(" ");
|
|
5276
|
+
function provider() {
|
|
5277
|
+
for (const candidate of ["anthropic", "azure-openai", "openai"]) {
|
|
5278
|
+
if (hasProviderConfigured(candidate)) return candidate;
|
|
5279
|
+
}
|
|
5280
|
+
return null;
|
|
5281
|
+
}
|
|
5282
|
+
function llmJudgeMinGrade() {
|
|
5283
|
+
const parsed = Number.parseInt(process.env.RECALL_RELEVANCE_LLM_MIN_GRADE ?? "", 10);
|
|
5284
|
+
return [1, 2, 3].includes(parsed) ? parsed : 3;
|
|
5285
|
+
}
|
|
5286
|
+
function isLlmJudgeEnabled() {
|
|
5287
|
+
return process.env.RECALL_RELEVANCE_LLM === "true" && (judgeOverride !== null || provider() !== null);
|
|
5288
|
+
}
|
|
5289
|
+
function timeoutMs() {
|
|
5290
|
+
const parsed = Number.parseInt(process.env.RECALL_RELEVANCE_LLM_TIMEOUT_MS ?? "", 10);
|
|
5291
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 8e3;
|
|
5292
|
+
}
|
|
5293
|
+
function parseGrades(text, memories4) {
|
|
5294
|
+
const match = text.match(/\{[\s\S]*\}/);
|
|
5295
|
+
if (!match) return null;
|
|
5296
|
+
try {
|
|
5297
|
+
const parsed = JSON.parse(match[0]);
|
|
5298
|
+
const grades = /* @__PURE__ */ new Map();
|
|
5299
|
+
for (const entry of parsed.grades ?? []) {
|
|
5300
|
+
const i = Number(entry.i);
|
|
5301
|
+
const grade = Number(entry.grade);
|
|
5302
|
+
if (Number.isInteger(i) && i >= 0 && i < memories4.length && [0, 1, 2, 3].includes(grade)) {
|
|
5303
|
+
grades.set(memories4[i].id, grade);
|
|
5304
|
+
}
|
|
5305
|
+
}
|
|
5306
|
+
return grades.size > 0 ? grades : null;
|
|
5307
|
+
} catch {
|
|
5308
|
+
return null;
|
|
5309
|
+
}
|
|
5310
|
+
}
|
|
5311
|
+
async function callJudge(db, query, memories4) {
|
|
5312
|
+
const chosen = provider();
|
|
5313
|
+
if (!chosen) return null;
|
|
5314
|
+
const user = [
|
|
5315
|
+
`REQUEST: ${JSON.stringify(query)}`,
|
|
5316
|
+
"",
|
|
5317
|
+
...memories4.map((memory, i) => `${i}. ${JSON.stringify(retrievalText(memory))}`),
|
|
5318
|
+
"",
|
|
5319
|
+
`Reply as JSON: {"grades": [{"i": <index>, "grade": 0|1|2|3}, ...]} with one entry for each of the ${memories4.length} memories.`
|
|
5320
|
+
].join("\n");
|
|
5321
|
+
const call = callLlm(db, {
|
|
5322
|
+
provider: chosen,
|
|
5323
|
+
system: SYSTEM,
|
|
5324
|
+
user,
|
|
5325
|
+
max_output_tokens: 1500,
|
|
5326
|
+
json_output: true,
|
|
5327
|
+
task_kind: "relevance_judge"
|
|
5328
|
+
}).then((result) => parseGrades(result.text, memories4));
|
|
5329
|
+
const timeout = new Promise((resolve2) => setTimeout(() => resolve2(null), timeoutMs()).unref());
|
|
5330
|
+
return Promise.race([call.catch(() => null), timeout]);
|
|
5331
|
+
}
|
|
5332
|
+
async function judgeRelevance(db, query, memories4) {
|
|
5333
|
+
if (!isLlmJudgeEnabled() || memories4.length === 0) return null;
|
|
5334
|
+
const candidates = memories4.slice(0, llmJudgeCandidates());
|
|
5335
|
+
const key = createHash3("sha256").update(JSON.stringify([query, candidates.map((m) => [m.id, retrievalText(m)])])).digest("hex");
|
|
5336
|
+
const cached = cache.get(key);
|
|
5337
|
+
if (cached) return cached;
|
|
5338
|
+
const grades = judgeOverride ? await judgeOverride(query, candidates) : await callJudge(db, query, candidates);
|
|
5339
|
+
if (grades) {
|
|
5340
|
+
if (cache.size >= CACHE_MAX) cache.delete(cache.keys().next().value);
|
|
5341
|
+
cache.set(key, grades);
|
|
5342
|
+
}
|
|
5343
|
+
return grades;
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5138
5346
|
// src/repo/aliases.ts
|
|
5139
5347
|
init_define_RECALL_BUILD_INFO();
|
|
5140
5348
|
function memoryRepoAliases(db, repo) {
|
|
@@ -5405,12 +5613,13 @@ async function compileContextHybrid(db, req) {
|
|
|
5405
5613
|
}
|
|
5406
5614
|
const retrieval = effectiveQuery ? await hybridSearch(db, effectiveQuery, embeddingConfig, {
|
|
5407
5615
|
repo: req.repo,
|
|
5408
|
-
|
|
5616
|
+
// The LLM judge (when on) can grade more candidates than the local path keeps.
|
|
5617
|
+
limit: isLlmJudgeEnabled() ? Math.max(QUERY_RESULT_LIMIT, llmJudgeCandidates()) : QUERY_RESULT_LIMIT
|
|
5409
5618
|
}) : [];
|
|
5410
5619
|
const retrievalById = new Map(
|
|
5411
5620
|
retrieval.map((item) => [item.memory.id, item])
|
|
5412
5621
|
);
|
|
5413
|
-
if (effectiveQuery) {
|
|
5622
|
+
if (effectiveQuery && !isRerankerEnabled()) {
|
|
5414
5623
|
for (const memory of passing) {
|
|
5415
5624
|
const lexical = textMatchScore(effectiveQuery, memory.text);
|
|
5416
5625
|
if (lexical.score < QUERY_TEXT_MATCH_FLOOR) continue;
|
|
@@ -5430,12 +5639,19 @@ async function compileContextHybrid(db, req) {
|
|
|
5430
5639
|
);
|
|
5431
5640
|
}
|
|
5432
5641
|
}
|
|
5642
|
+
const judged = effectiveQuery ? await judgeRelevance(
|
|
5643
|
+
db,
|
|
5644
|
+
effectiveQuery,
|
|
5645
|
+
passing.filter((memory) => retrievalById.has(memory.id)).sort((a, b) => (retrievalById.get(b.id)?.score ?? 0) - (retrievalById.get(a.id)?.score ?? 0))
|
|
5646
|
+
) : null;
|
|
5433
5647
|
const summaries = getMemoryFeedbackSummaries(db, passing.map((m) => m.id));
|
|
5434
5648
|
const emptySummary = { followed: 0, overridden: 0, contradicted: 0, ignored: 0, resolved: 0 };
|
|
5435
5649
|
const ranked = passing.filter((memory) => {
|
|
5436
5650
|
const retrievalItem = retrievalById.get(memory.id);
|
|
5437
5651
|
if (effectiveQuery) {
|
|
5438
5652
|
if (!retrievalItem) return false;
|
|
5653
|
+
if (judged) return (judged.get(memory.id) ?? 0) >= llmJudgeMinGrade();
|
|
5654
|
+
if (retrievalItem.reranked) return retrievalItem.score >= rerankMinScore(passing.length);
|
|
5439
5655
|
const hasStrongLexicalMatch = retrievalItem.lexical_score >= QUERY_TEXT_MATCH_FLOOR;
|
|
5440
5656
|
if (embeddingConfig && retrievalItem.similarity < QUERY_VECTOR_RELEVANCE_FLOOR && !hasStrongLexicalMatch) {
|
|
5441
5657
|
return false;
|
|
@@ -5446,7 +5662,8 @@ async function compileContextHybrid(db, req) {
|
|
|
5446
5662
|
const retrievalScore = retrievalItem?.score ?? 0;
|
|
5447
5663
|
return retrievalScore >= 0.2;
|
|
5448
5664
|
}).map((memory) => {
|
|
5449
|
-
const
|
|
5665
|
+
const judgedGrade = judged?.get(memory.id);
|
|
5666
|
+
const retrievalScore = judgedGrade !== void 0 ? judgedGrade / 3 : retrievalById.get(memory.id)?.score ?? 0;
|
|
5450
5667
|
const weighted = feedbackWeightedScore(memory.confidence, summaries.get(memory.id) ?? emptySummary);
|
|
5451
5668
|
const score = effectiveQuery ? retrievalScore * 0.45 + weighted * 0.25 + scopeScore(memory, req.path) * 0.15 + freshnessScore(memory) * 0.05 + typeScore(memory.type) * 0.1 : weighted * 0.55 + scopeScore(memory, req.path) * 0.2 + freshnessScore(memory) * 0.1 + typeScore(memory.type) * 0.15;
|
|
5452
5669
|
return { memory, score };
|
|
@@ -5456,9 +5673,15 @@ async function compileContextHybrid(db, req) {
|
|
|
5456
5673
|
let commandCount = 0;
|
|
5457
5674
|
let gotchaCount = 0;
|
|
5458
5675
|
let lineCount = 0;
|
|
5676
|
+
const companionRatio = effectiveQuery && !judged && isRerankerEnabled() ? rerankCompanionRatio() : 0;
|
|
5459
5677
|
for (const item of dedupedRanked) {
|
|
5460
5678
|
if (effectiveQuery && selected.length >= QUERY_SELECTION_LIMIT) break;
|
|
5461
5679
|
const memory = item.memory;
|
|
5680
|
+
if (companionRatio > 0 && selected.length > 0) {
|
|
5681
|
+
const first = retrievalById.get(selected[0].id);
|
|
5682
|
+
const candidate = retrievalById.get(memory.id);
|
|
5683
|
+
if (first?.reranked && candidate?.reranked && candidate.score < first.score * companionRatio) continue;
|
|
5684
|
+
}
|
|
5462
5685
|
const memLines = renderMemoryText(memory).split("\n").length;
|
|
5463
5686
|
if (lineCount + memLines > config.max_lines) continue;
|
|
5464
5687
|
if (memory.type === "command" && commandCount >= config.max_commands) continue;
|
|
@@ -5723,223 +5946,6 @@ function filterSessionScoped(memories4, sessionId) {
|
|
|
5723
5946
|
});
|
|
5724
5947
|
}
|
|
5725
5948
|
|
|
5726
|
-
// src/adapters/markdown.ts
|
|
5727
|
-
init_define_RECALL_BUILD_INFO();
|
|
5728
|
-
function exportMarkdown(db, repo) {
|
|
5729
|
-
const result = compileContext(db, { repo });
|
|
5730
|
-
if (!result.text) {
|
|
5731
|
-
return `# ${repo}
|
|
5732
|
-
|
|
5733
|
-
No active memories above confidence threshold.
|
|
5734
|
-
`;
|
|
5735
|
-
}
|
|
5736
|
-
return result.text;
|
|
5737
|
-
}
|
|
5738
|
-
function exportClaude(db, repo) {
|
|
5739
|
-
const result = compileContext(db, { repo });
|
|
5740
|
-
if (!result.text) return "";
|
|
5741
|
-
return `# CLAUDE.md \u2014 Auto-generated by Recall
|
|
5742
|
-
# Do not edit manually. Run \`recall export -r ${repo} -f claude\` to regenerate.
|
|
5743
|
-
|
|
5744
|
-
${result.text}`;
|
|
5745
|
-
}
|
|
5746
|
-
function exportCodex(db, repo) {
|
|
5747
|
-
const result = compileContext(db, { repo });
|
|
5748
|
-
if (!result.text) return "";
|
|
5749
|
-
return `# AGENTS.md \u2014 Auto-generated by Recall
|
|
5750
|
-
# Do not edit manually. Run \`recall export -r ${repo} -f codex\` to regenerate.
|
|
5751
|
-
|
|
5752
|
-
${result.text}`;
|
|
5753
|
-
}
|
|
5754
|
-
|
|
5755
|
-
// src/artifacts/context.ts
|
|
5756
|
-
init_define_RECALL_BUILD_INFO();
|
|
5757
|
-
import { mkdirSync as mkdirSync2 } from "fs";
|
|
5758
|
-
import { isAbsolute, join as join4, resolve as resolve2 } from "path";
|
|
5759
|
-
import { execFileSync as execFileSync3 } from "child_process";
|
|
5760
|
-
function getRepoContextArtifactPath(repoPath) {
|
|
5761
|
-
return join4(repoPath, ".recall", "context.md");
|
|
5762
|
-
}
|
|
5763
|
-
function renderRepoContextArtifact(db, repo) {
|
|
5764
|
-
const compiled = exportMarkdown(db, repo).trimEnd();
|
|
5765
|
-
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5766
|
-
return [
|
|
5767
|
-
"<!-- Auto-generated by Recall. Do not edit manually. -->",
|
|
5768
|
-
`<!-- Generated at: ${generatedAt} -->`,
|
|
5769
|
-
"",
|
|
5770
|
-
"# Recall Context",
|
|
5771
|
-
"",
|
|
5772
|
-
`Repo: \`${repo}\``,
|
|
5773
|
-
"",
|
|
5774
|
-
"Read this file before making repo-specific assumptions.",
|
|
5775
|
-
"",
|
|
5776
|
-
compiled,
|
|
5777
|
-
""
|
|
5778
|
-
].join("\n");
|
|
5779
|
-
}
|
|
5780
|
-
function writeRepoContextArtifact(db, input) {
|
|
5781
|
-
const repo = input.repo ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5782
|
-
const repoPath = input.repo_path ?? (repo ? resolveLocalRepoPath(repo) : null);
|
|
5783
|
-
if (!repo || !repoPath) {
|
|
5784
|
-
return {
|
|
5785
|
-
repo,
|
|
5786
|
-
repo_path: repoPath,
|
|
5787
|
-
output_path: null,
|
|
5788
|
-
written: false
|
|
5789
|
-
};
|
|
5790
|
-
}
|
|
5791
|
-
const outputPath = getRepoContextArtifactPath(repoPath);
|
|
5792
|
-
mkdirSync2(join4(repoPath, ".recall"), { recursive: true });
|
|
5793
|
-
ensureRepoContextExcluded(repoPath);
|
|
5794
|
-
const content = renderRepoContextArtifact(db, repo);
|
|
5795
|
-
const existing = readUtf8FileIfExists(outputPath);
|
|
5796
|
-
if (existing !== content) {
|
|
5797
|
-
atomicWriteUtf8File(outputPath, content);
|
|
5798
|
-
}
|
|
5799
|
-
return {
|
|
5800
|
-
repo,
|
|
5801
|
-
repo_path: repoPath,
|
|
5802
|
-
output_path: outputPath,
|
|
5803
|
-
written: existing !== content
|
|
5804
|
-
};
|
|
5805
|
-
}
|
|
5806
|
-
function ensureRepoContextExcluded(repoPath) {
|
|
5807
|
-
try {
|
|
5808
|
-
const excludePath = execFileSync3(
|
|
5809
|
-
"git",
|
|
5810
|
-
["-C", repoPath, "rev-parse", "--git-path", "info/exclude"],
|
|
5811
|
-
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
5812
|
-
).trim();
|
|
5813
|
-
if (!excludePath) return;
|
|
5814
|
-
const absoluteExcludePath = isAbsolute(excludePath) ? excludePath : resolve2(repoPath, excludePath);
|
|
5815
|
-
const existing = readUtf8FileIfExists(absoluteExcludePath) ?? "";
|
|
5816
|
-
if (existing.split("\n").some((line) => line.trim() === ".recall/")) return;
|
|
5817
|
-
const prefix = existing && !existing.endsWith("\n") ? "\n" : "";
|
|
5818
|
-
atomicWriteUtf8File(
|
|
5819
|
-
absoluteExcludePath,
|
|
5820
|
-
`${existing}${prefix}# Recall generated context
|
|
5821
|
-
.recall/
|
|
5822
|
-
`
|
|
5823
|
-
);
|
|
5824
|
-
} catch {
|
|
5825
|
-
}
|
|
5826
|
-
}
|
|
5827
|
-
|
|
5828
|
-
// src/session/lifecycle.ts
|
|
5829
|
-
init_define_RECALL_BUILD_INFO();
|
|
5830
|
-
function resolveLifecycleSource(input) {
|
|
5831
|
-
if (input.source) return input.source;
|
|
5832
|
-
return input.client ? tagActivitySource("hook", input.client) : "daemon";
|
|
5833
|
-
}
|
|
5834
|
-
function startSessionLifecycle(db, input) {
|
|
5835
|
-
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5836
|
-
const bootstrap = ensureRepoBootstrapped(db, {
|
|
5837
|
-
repo,
|
|
5838
|
-
repoPathHint: input.repo_path
|
|
5839
|
-
});
|
|
5840
|
-
if (bootstrap.status === "bootstrapped" || bootstrap.status === "scanned_empty") {
|
|
5841
|
-
createActivityEvent(db, {
|
|
5842
|
-
session_id: input.session_id,
|
|
5843
|
-
repo: bootstrap.repo,
|
|
5844
|
-
path: input.path ?? null,
|
|
5845
|
-
source: resolveLifecycleSource(input),
|
|
5846
|
-
event_type: "scan",
|
|
5847
|
-
memory_ids: bootstrap.created_ids,
|
|
5848
|
-
request: {
|
|
5849
|
-
repo_path: bootstrap.repo_path,
|
|
5850
|
-
client: input.client ?? null,
|
|
5851
|
-
trigger: "session_start_bootstrap"
|
|
5852
|
-
},
|
|
5853
|
-
result: {
|
|
5854
|
-
created: bootstrap.created_ids.length,
|
|
5855
|
-
status: bootstrap.status
|
|
5856
|
-
}
|
|
5857
|
-
});
|
|
5858
|
-
}
|
|
5859
|
-
if (bootstrap.status === "already_known" && bootstrap.repo && input.repo_path) {
|
|
5860
|
-
try {
|
|
5861
|
-
refreshKnownRepoScan(db, bootstrap.repo, input.repo_path);
|
|
5862
|
-
} catch {
|
|
5863
|
-
}
|
|
5864
|
-
}
|
|
5865
|
-
const artifact = writeRepoContextArtifact(db, {
|
|
5866
|
-
repo: bootstrap.repo,
|
|
5867
|
-
repo_path: bootstrap.repo_path ?? input.repo_path ?? null
|
|
5868
|
-
});
|
|
5869
|
-
createActivityEvent(db, {
|
|
5870
|
-
session_id: input.session_id,
|
|
5871
|
-
repo: bootstrap.repo,
|
|
5872
|
-
path: input.path ?? null,
|
|
5873
|
-
source: resolveLifecycleSource(input),
|
|
5874
|
-
event_type: "session_start",
|
|
5875
|
-
request: {
|
|
5876
|
-
client: input.client ?? null,
|
|
5877
|
-
repo_path: bootstrap.repo_path ?? input.repo_path ?? null,
|
|
5878
|
-
meta: input.meta ?? {}
|
|
5879
|
-
},
|
|
5880
|
-
result: {
|
|
5881
|
-
bootstrap_status: bootstrap.status,
|
|
5882
|
-
created: bootstrap.created_ids.length,
|
|
5883
|
-
artifact_path: artifact.output_path,
|
|
5884
|
-
artifact_written: artifact.written
|
|
5885
|
-
}
|
|
5886
|
-
});
|
|
5887
|
-
return {
|
|
5888
|
-
session_id: input.session_id,
|
|
5889
|
-
repo: bootstrap.repo,
|
|
5890
|
-
repo_path: bootstrap.repo_path ?? input.repo_path ?? null,
|
|
5891
|
-
bootstrap_status: bootstrap.status,
|
|
5892
|
-
created_ids: bootstrap.created_ids
|
|
5893
|
-
};
|
|
5894
|
-
}
|
|
5895
|
-
function recordSessionLifecycleEvent(db, input) {
|
|
5896
|
-
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5897
|
-
createActivityEvent(db, {
|
|
5898
|
-
session_id: input.session_id,
|
|
5899
|
-
repo,
|
|
5900
|
-
path: input.path ?? null,
|
|
5901
|
-
source: resolveLifecycleSource(input),
|
|
5902
|
-
event_type: "session_event",
|
|
5903
|
-
request: {
|
|
5904
|
-
client: input.client ?? null,
|
|
5905
|
-
name: input.name,
|
|
5906
|
-
repo_path: input.repo_path ?? null,
|
|
5907
|
-
meta: input.meta ?? {}
|
|
5908
|
-
},
|
|
5909
|
-
result: input.payload ?? {}
|
|
5910
|
-
});
|
|
5911
|
-
return {
|
|
5912
|
-
session_id: input.session_id,
|
|
5913
|
-
repo,
|
|
5914
|
-
repo_path: input.repo_path ?? null,
|
|
5915
|
-
bootstrap_status: "skipped",
|
|
5916
|
-
created_ids: []
|
|
5917
|
-
};
|
|
5918
|
-
}
|
|
5919
|
-
function endSessionLifecycle(db, input) {
|
|
5920
|
-
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5921
|
-
createActivityEvent(db, {
|
|
5922
|
-
session_id: input.session_id,
|
|
5923
|
-
repo,
|
|
5924
|
-
path: input.path ?? null,
|
|
5925
|
-
source: resolveLifecycleSource(input),
|
|
5926
|
-
event_type: "session_end",
|
|
5927
|
-
request: {
|
|
5928
|
-
client: input.client ?? null,
|
|
5929
|
-
repo_path: input.repo_path ?? null,
|
|
5930
|
-
meta: input.meta ?? {}
|
|
5931
|
-
},
|
|
5932
|
-
result: input.payload ?? {}
|
|
5933
|
-
});
|
|
5934
|
-
return {
|
|
5935
|
-
session_id: input.session_id,
|
|
5936
|
-
repo,
|
|
5937
|
-
repo_path: input.repo_path ?? null,
|
|
5938
|
-
bootstrap_status: "skipped",
|
|
5939
|
-
created_ids: []
|
|
5940
|
-
};
|
|
5941
|
-
}
|
|
5942
|
-
|
|
5943
5949
|
// src/eval/harness.ts
|
|
5944
5950
|
init_define_RECALL_BUILD_INFO();
|
|
5945
5951
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
@@ -6129,9 +6135,9 @@ function loadRetrievalEvalFile(path) {
|
|
|
6129
6135
|
async function runRetrievalEval(db, input, options = {}) {
|
|
6130
6136
|
const providers = options.providers?.length ? options.providers : ["current"];
|
|
6131
6137
|
const providerReports = [];
|
|
6132
|
-
for (const
|
|
6138
|
+
for (const provider2 of providers) {
|
|
6133
6139
|
const cases = [];
|
|
6134
|
-
const embeddingConfig =
|
|
6140
|
+
const embeddingConfig = provider2 === "current" ? loadEmbeddingConfigFromEnv() : embeddingConfigForProvider(provider2);
|
|
6135
6141
|
if (embeddingConfig) {
|
|
6136
6142
|
await bootstrapEmbeddings(db, embeddingConfig);
|
|
6137
6143
|
}
|
|
@@ -6174,7 +6180,7 @@ async function runRetrievalEval(db, input, options = {}) {
|
|
|
6174
6180
|
const hybridForbiddenHits = cases.filter((item) => item.hybrid.forbidden_hits.length > 0).length;
|
|
6175
6181
|
const reciprocalRanks = cases.map((item) => item.hybrid.first_expected_rank).filter((rank) => rank != null).map((rank) => 1 / rank);
|
|
6176
6182
|
providerReports.push({
|
|
6177
|
-
provider,
|
|
6183
|
+
provider: provider2,
|
|
6178
6184
|
summary: {
|
|
6179
6185
|
total_cases: total,
|
|
6180
6186
|
baseline_passed: baselinePassed,
|
|
@@ -6297,14 +6303,14 @@ function formatRetrievalEvalReport(report) {
|
|
|
6297
6303
|
"",
|
|
6298
6304
|
"## Provider Comparison"
|
|
6299
6305
|
];
|
|
6300
|
-
for (const
|
|
6306
|
+
for (const provider2 of report.provider_reports) {
|
|
6301
6307
|
lines.push(
|
|
6302
|
-
`- ${
|
|
6308
|
+
`- ${provider2.provider}: passed=${provider2.summary.hybrid_passed}/${provider2.summary.total_cases} recall@k=${pct(provider2.metrics.recall_at_k)} mrr=${provider2.metrics.mrr.toFixed(3)} override=${pct(provider2.metrics.override_rate)}`
|
|
6303
6309
|
);
|
|
6304
6310
|
}
|
|
6305
|
-
for (const
|
|
6306
|
-
lines.push("", `## ${
|
|
6307
|
-
lines.push(formatSingleProviderReport(
|
|
6311
|
+
for (const provider2 of report.provider_reports) {
|
|
6312
|
+
lines.push("", `## ${provider2.provider}`);
|
|
6313
|
+
lines.push(formatSingleProviderReport(provider2.summary, provider2.cases));
|
|
6308
6314
|
}
|
|
6309
6315
|
return lines.join("\n");
|
|
6310
6316
|
}
|
|
@@ -6429,20 +6435,20 @@ function firstNonEmpty(...values) {
|
|
|
6429
6435
|
}
|
|
6430
6436
|
return void 0;
|
|
6431
6437
|
}
|
|
6432
|
-
function embeddingConfigForProvider(
|
|
6438
|
+
function embeddingConfigForProvider(provider2) {
|
|
6433
6439
|
const overrideDimensions = process.env.RECALL_EMBEDDING_DIMS ? parseInt(process.env.RECALL_EMBEDDING_DIMS, 10) : null;
|
|
6434
|
-
if (
|
|
6440
|
+
if (provider2 === "bge-small-en-v1.5") {
|
|
6435
6441
|
return {
|
|
6436
|
-
provider,
|
|
6442
|
+
provider: provider2,
|
|
6437
6443
|
model: "Xenova/bge-small-en-v1.5",
|
|
6438
6444
|
dimensions: overrideDimensions ?? 384,
|
|
6439
6445
|
version: "eval",
|
|
6440
6446
|
similarity_threshold: 0.8
|
|
6441
6447
|
};
|
|
6442
6448
|
}
|
|
6443
|
-
if (
|
|
6449
|
+
if (provider2 === "multilingual-e5") {
|
|
6444
6450
|
return {
|
|
6445
|
-
provider,
|
|
6451
|
+
provider: provider2,
|
|
6446
6452
|
model: "Xenova/multilingual-e5-small",
|
|
6447
6453
|
dimensions: overrideDimensions ?? 384,
|
|
6448
6454
|
version: "eval",
|
|
@@ -6461,7 +6467,7 @@ function embeddingConfigForProvider(provider) {
|
|
|
6461
6467
|
// src/feedback/implicit.ts
|
|
6462
6468
|
init_define_RECALL_BUILD_INFO();
|
|
6463
6469
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
6464
|
-
import { execFileSync as
|
|
6470
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
6465
6471
|
var SIGNAL_WEIGHTS = {
|
|
6466
6472
|
test_pass: 0.03,
|
|
6467
6473
|
test_fail: -0.15,
|
|
@@ -6839,6 +6845,12 @@ function formatPruneReport(result, dryRun) {
|
|
|
6839
6845
|
|
|
6840
6846
|
// src/mcp/fallback.ts
|
|
6841
6847
|
init_define_RECALL_BUILD_INFO();
|
|
6848
|
+
function attachNote(db, ids, affects) {
|
|
6849
|
+
if (!affects?.trim()) return;
|
|
6850
|
+
for (const id of ids) {
|
|
6851
|
+
if (!getMemory(db, id)?.note) setMemoryNote(db, id, affects);
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6842
6854
|
async function captureCorrectionFallback(db, input, source) {
|
|
6843
6855
|
const sessionId = input.session_id ?? `${source}-capture`;
|
|
6844
6856
|
const { ids, pendingTaskId, blockedByRejectedExemplar } = await processCorrection(db, input.text, {
|
|
@@ -6848,8 +6860,10 @@ async function captureCorrectionFallback(db, input, source) {
|
|
|
6848
6860
|
agent: input.agent,
|
|
6849
6861
|
prev_assistant_turn: input.prev_assistant_turn,
|
|
6850
6862
|
recent_tool_calls: input.recent_tool_calls,
|
|
6851
|
-
force_semantic_capture: true
|
|
6863
|
+
force_semantic_capture: true,
|
|
6864
|
+
affects: input.affects
|
|
6852
6865
|
});
|
|
6866
|
+
attachNote(db, ids, input.affects);
|
|
6853
6867
|
createActivityEvent(db, {
|
|
6854
6868
|
session_id: sessionId,
|
|
6855
6869
|
repo: input.repo ?? null,
|
|
@@ -6955,8 +6969,15 @@ export {
|
|
|
6955
6969
|
listActivitySessions,
|
|
6956
6970
|
scanAndStore,
|
|
6957
6971
|
ensureRepoBootstrapped,
|
|
6972
|
+
resolveLocalRepoPath,
|
|
6958
6973
|
inferRepoSlugFromPath,
|
|
6959
6974
|
discoverLocalRepos,
|
|
6975
|
+
startSessionLifecycle,
|
|
6976
|
+
recordSessionLifecycleEvent,
|
|
6977
|
+
endSessionLifecycle,
|
|
6978
|
+
captureCorrectionFallback,
|
|
6979
|
+
signalOutcomeFallback,
|
|
6980
|
+
sessionEndFallback,
|
|
6960
6981
|
listInjectedHistoryIdsForSession,
|
|
6961
6982
|
createHistorySnippet,
|
|
6962
6983
|
listHistorySnippets,
|
|
@@ -6971,17 +6992,6 @@ export {
|
|
|
6971
6992
|
searchHistorySnippets,
|
|
6972
6993
|
compileContext,
|
|
6973
6994
|
compileContextHybrid,
|
|
6974
|
-
exportMarkdown,
|
|
6975
|
-
exportClaude,
|
|
6976
|
-
exportCodex,
|
|
6977
|
-
getRepoContextArtifactPath,
|
|
6978
|
-
writeRepoContextArtifact,
|
|
6979
|
-
startSessionLifecycle,
|
|
6980
|
-
recordSessionLifecycleEvent,
|
|
6981
|
-
endSessionLifecycle,
|
|
6982
|
-
captureCorrectionFallback,
|
|
6983
|
-
signalOutcomeFallback,
|
|
6984
|
-
sessionEndFallback,
|
|
6985
6995
|
startEvalSession,
|
|
6986
6996
|
endEvalSession,
|
|
6987
6997
|
incrementEvalCounter,
|
|
@@ -7006,4 +7016,4 @@ export {
|
|
|
7006
7016
|
pruneMemories,
|
|
7007
7017
|
formatPruneReport
|
|
7008
7018
|
};
|
|
7009
|
-
//# sourceMappingURL=chunk-
|
|
7019
|
+
//# sourceMappingURL=chunk-5OINDHZX.js.map
|