@edihasaj/recall 1.4.1 → 1.4.14
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 +17 -7
- package/dist/{chunk-EAFRT7RX.js → chunk-22KM2YEO.js} +7 -2
- package/dist/{chunk-EAFRT7RX.js.map → chunk-22KM2YEO.js.map} +1 -1
- package/dist/{chunk-PUMEMKGF.js → chunk-47CB7PKL.js} +7 -1
- package/dist/{chunk-PUMEMKGF.js.map → chunk-47CB7PKL.js.map} +1 -1
- package/dist/{chunk-FHEH6QDU.js → chunk-7Z3CCCS2.js} +6 -1
- package/dist/{chunk-FHEH6QDU.js.map → chunk-7Z3CCCS2.js.map} +1 -1
- package/dist/chunk-AQOI4FCW.js +23 -0
- package/dist/chunk-AQOI4FCW.js.map +1 -0
- package/dist/{chunk-ZBQGZCFL.js → chunk-BWKFROGW.js} +99 -9
- package/dist/chunk-BWKFROGW.js.map +1 -0
- package/dist/{chunk-JYWURG5T.js → chunk-CYAODQOH.js} +12 -2
- package/dist/chunk-CYAODQOH.js.map +1 -0
- package/dist/{chunk-LWY4Z626.js → chunk-DJNJQA7L.js} +8 -4
- package/dist/{chunk-LWY4Z626.js.map → chunk-DJNJQA7L.js.map} +1 -1
- package/dist/{chunk-T274LVWB.js → chunk-GGUWKT6I.js} +15 -11
- package/dist/chunk-GGUWKT6I.js.map +1 -0
- package/dist/{chunk-NAYFAUSM.js → chunk-HFHNPOBW.js} +61 -21
- package/dist/chunk-HFHNPOBW.js.map +1 -0
- package/dist/{chunk-ZXCKMEJA.js → chunk-HRUNR5JJ.js} +11 -6
- package/dist/{chunk-ZXCKMEJA.js.map → chunk-HRUNR5JJ.js.map} +1 -1
- package/dist/{chunk-TA4WSV6A.js → chunk-HUMJTWWT.js} +40 -11
- package/dist/chunk-HUMJTWWT.js.map +1 -0
- package/dist/{chunk-7CFX774S.js → chunk-JFUMA4WV.js} +306 -167
- package/dist/chunk-JFUMA4WV.js.map +1 -0
- package/dist/{chunk-AFD43EOE.js → chunk-KOBZIF2X.js} +8 -4
- package/dist/{chunk-AFD43EOE.js.map → chunk-KOBZIF2X.js.map} +1 -1
- package/dist/{chunk-4UHRAQFG.js → chunk-M3ASNCVM.js} +207 -43
- package/dist/chunk-M3ASNCVM.js.map +1 -0
- package/dist/chunk-Q2KCBLJO.js +594 -0
- package/dist/chunk-Q2KCBLJO.js.map +1 -0
- package/dist/{chunk-CW3XJDH7.js → chunk-RWEX4VJE.js} +6 -2
- package/dist/{chunk-CW3XJDH7.js.map → chunk-RWEX4VJE.js.map} +1 -1
- package/dist/{chunk-LUIYWYOT.js → chunk-VSEAVK7X.js} +51 -3
- package/dist/chunk-VSEAVK7X.js.map +1 -0
- package/dist/{chunk-WZWXYBP6.js → chunk-XCFTE74H.js} +6 -3
- package/dist/{chunk-WZWXYBP6.js.map → chunk-XCFTE74H.js.map} +1 -1
- package/dist/{cleanup-RTL2UETA.js → cleanup-YCYA6BJB.js} +11 -10
- package/dist/cli.js +639 -784
- package/dist/cli.js.map +1 -1
- package/dist/codex-trust-Z7LNNRVT.js +74 -0
- package/dist/codex-trust-Z7LNNRVT.js.map +1 -0
- package/dist/daemon.js +174 -54
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-FP3WS74F.js +22 -0
- package/dist/{embeddings-MILTROKW.js → embeddings-VZPCFCEY.js} +7 -5
- package/dist/ingest-QEKMNVL7.js +20 -0
- package/dist/{keychain-5KXUHKMF.js → keychain-2PXI2EGF.js} +3 -3
- package/dist/mcp.js +18 -14
- package/dist/mcp.js.map +1 -1
- package/dist/{memory-value-WXI2Q6TO.js → memory-value-XSPRH6KY.js} +11 -10
- package/dist/provenance-GJR7S7VA.js +50 -0
- package/dist/provenance-GJR7S7VA.js.map +1 -0
- package/dist/quality-TWOC3UMF.js +25 -0
- package/dist/retrieval-RW6YBQ6P.js +15 -0
- package/dist/{store-5C7ZKKZF.js → store-HIM5US7B.js} +4 -4
- package/dist/sync-server.js +5 -2
- package/dist/sync-server.js.map +1 -1
- package/dist/{tasks-7SE6VHSQ.js → tasks-TAXJSUKB.js} +11 -10
- package/dist/{usage-VQ5LJCNH.js → usage-XMYRFJBJ.js} +7 -4
- package/dist/{usage-VQ5LJCNH.js.map → usage-XMYRFJBJ.js.map} +1 -1
- package/drizzle/0011_compact_telemetry_dedupe_keys.sql +25 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +15 -12
- package/dist/chunk-4UHRAQFG.js.map +0 -1
- package/dist/chunk-7CFX774S.js.map +0 -1
- package/dist/chunk-LUIYWYOT.js.map +0 -1
- package/dist/chunk-NAYFAUSM.js.map +0 -1
- package/dist/chunk-T274LVWB.js.map +0 -1
- package/dist/chunk-TA4WSV6A.js.map +0 -1
- package/dist/chunk-ZBQGZCFL.js.map +0 -1
- package/dist/dispatcher-PP5OKOLS.js +0 -21
- package/dist/ingest-HEXVIAL6.js +0 -19
- package/dist/quality-VKQUCL66.js +0 -24
- package/dist/retrieval-4MEIABHC.js +0 -14
- package/dist/tasks-7SE6VHSQ.js.map +0 -1
- /package/dist/{chunk-JYWURG5T.js.map → cleanup-YCYA6BJB.js.map} +0 -0
- /package/dist/{cleanup-RTL2UETA.js.map → dispatcher-FP3WS74F.js.map} +0 -0
- /package/dist/{dispatcher-PP5OKOLS.js.map → embeddings-VZPCFCEY.js.map} +0 -0
- /package/dist/{embeddings-MILTROKW.js.map → ingest-QEKMNVL7.js.map} +0 -0
- /package/dist/{ingest-HEXVIAL6.js.map → keychain-2PXI2EGF.js.map} +0 -0
- /package/dist/{keychain-5KXUHKMF.js.map → memory-value-XSPRH6KY.js.map} +0 -0
- /package/dist/{memory-value-WXI2Q6TO.js.map → quality-TWOC3UMF.js.map} +0 -0
- /package/dist/{quality-VKQUCL66.js.map → retrieval-RW6YBQ6P.js.map} +0 -0
- /package/dist/{retrieval-4MEIABHC.js.map → store-HIM5US7B.js.map} +0 -0
- /package/dist/{store-5C7ZKKZF.js.map → tasks-TAXJSUKB.js.map} +0 -0
|
@@ -2,27 +2,33 @@ import {
|
|
|
2
2
|
computeHealthScore,
|
|
3
3
|
evaluateScannedMemory,
|
|
4
4
|
getRepoQualityProfile,
|
|
5
|
+
isEphemeralTaskConstraint,
|
|
6
|
+
isHighRiskRule,
|
|
7
|
+
isNonUserCaptureContext,
|
|
5
8
|
processCorrection,
|
|
6
9
|
redactSensitiveValue,
|
|
7
10
|
seedScannedConfidence
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HUMJTWWT.js";
|
|
9
12
|
import {
|
|
10
13
|
recordInjectionValueEvents,
|
|
11
14
|
recordMemoryInjections,
|
|
12
15
|
recordOutcomeValueEvent,
|
|
13
16
|
resolveMemoryInjectionOutcome
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HRUNR5JJ.js";
|
|
15
18
|
import {
|
|
16
19
|
textMatchScore
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7Z3CCCS2.js";
|
|
18
21
|
import {
|
|
19
22
|
activityEventDedupeKey,
|
|
20
23
|
confirmMemory,
|
|
24
|
+
containsGeneratedHistory,
|
|
21
25
|
createMemory,
|
|
22
26
|
demoteMemory,
|
|
23
27
|
feedbackWeightedScore,
|
|
24
28
|
getMemory,
|
|
25
29
|
getMemoryFeedbackSummaries,
|
|
30
|
+
hasDirectCorrectionEvidence,
|
|
31
|
+
hasNonDurableProvenance,
|
|
26
32
|
historySnippetDedupeKey,
|
|
27
33
|
promoteMemory,
|
|
28
34
|
queryMemories,
|
|
@@ -30,11 +36,11 @@ import {
|
|
|
30
36
|
recordFeedback,
|
|
31
37
|
rejectMemory,
|
|
32
38
|
statusFromConfidence
|
|
33
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-HFHNPOBW.js";
|
|
34
40
|
import {
|
|
35
41
|
asc,
|
|
36
42
|
desc
|
|
37
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-RWEX4VJE.js";
|
|
38
44
|
import {
|
|
39
45
|
BACKGROUND_INDEX_BATCH_SIZE,
|
|
40
46
|
CONFIDENCE,
|
|
@@ -47,6 +53,7 @@ import {
|
|
|
47
53
|
getEmbeddingCacheRoot,
|
|
48
54
|
getSynonyms,
|
|
49
55
|
hybridSearch,
|
|
56
|
+
load,
|
|
50
57
|
loadEmbeddingConfigFromEnv,
|
|
51
58
|
processInResponsiveBatches,
|
|
52
59
|
projectEmbeddingToIndex,
|
|
@@ -54,7 +61,7 @@ import {
|
|
|
54
61
|
readUtf8FileIfExists,
|
|
55
62
|
resolveProvider,
|
|
56
63
|
tagActivitySource
|
|
57
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-BWKFROGW.js";
|
|
58
65
|
import {
|
|
59
66
|
Column,
|
|
60
67
|
Columns,
|
|
@@ -118,15 +125,22 @@ import {
|
|
|
118
125
|
policyRules,
|
|
119
126
|
schema_exports,
|
|
120
127
|
sql
|
|
121
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-VSEAVK7X.js";
|
|
129
|
+
import {
|
|
130
|
+
init_define_RECALL_BUILD_INFO
|
|
131
|
+
} from "./chunk-CYAODQOH.js";
|
|
122
132
|
|
|
123
133
|
// src/db/client.ts
|
|
134
|
+
init_define_RECALL_BUILD_INFO();
|
|
124
135
|
import Database from "better-sqlite3";
|
|
136
|
+
import { createHash } from "crypto";
|
|
125
137
|
|
|
126
138
|
// node_modules/drizzle-orm/better-sqlite3/driver.js
|
|
139
|
+
init_define_RECALL_BUILD_INFO();
|
|
127
140
|
import Client from "better-sqlite3";
|
|
128
141
|
|
|
129
142
|
// node_modules/drizzle-orm/logger.js
|
|
143
|
+
init_define_RECALL_BUILD_INFO();
|
|
130
144
|
var ConsoleLogWriter = class {
|
|
131
145
|
static [entityKind] = "ConsoleLogWriter";
|
|
132
146
|
write(message) {
|
|
@@ -157,7 +171,14 @@ var NoopLogger = class {
|
|
|
157
171
|
}
|
|
158
172
|
};
|
|
159
173
|
|
|
174
|
+
// node_modules/drizzle-orm/relations.js
|
|
175
|
+
init_define_RECALL_BUILD_INFO();
|
|
176
|
+
|
|
177
|
+
// node_modules/drizzle-orm/pg-core/primary-keys.js
|
|
178
|
+
init_define_RECALL_BUILD_INFO();
|
|
179
|
+
|
|
160
180
|
// node_modules/drizzle-orm/pg-core/table.js
|
|
181
|
+
init_define_RECALL_BUILD_INFO();
|
|
161
182
|
var InlineForeignKeys = /* @__PURE__ */ Symbol.for("drizzle:PgInlineForeignKeys");
|
|
162
183
|
var EnableRLS = /* @__PURE__ */ Symbol.for("drizzle:EnableRLS");
|
|
163
184
|
var PgTable = class extends Table {
|
|
@@ -468,7 +489,14 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
|
|
|
468
489
|
return result;
|
|
469
490
|
}
|
|
470
491
|
|
|
492
|
+
// node_modules/drizzle-orm/sqlite-core/db.js
|
|
493
|
+
init_define_RECALL_BUILD_INFO();
|
|
494
|
+
|
|
495
|
+
// node_modules/drizzle-orm/selection-proxy.js
|
|
496
|
+
init_define_RECALL_BUILD_INFO();
|
|
497
|
+
|
|
471
498
|
// node_modules/drizzle-orm/alias.js
|
|
499
|
+
init_define_RECALL_BUILD_INFO();
|
|
472
500
|
var ColumnAliasProxyHandler = class {
|
|
473
501
|
constructor(table) {
|
|
474
502
|
this.table = table;
|
|
@@ -632,7 +660,11 @@ var SelectionProxyHandler = class _SelectionProxyHandler {
|
|
|
632
660
|
}
|
|
633
661
|
};
|
|
634
662
|
|
|
663
|
+
// node_modules/drizzle-orm/sqlite-core/query-builders/delete.js
|
|
664
|
+
init_define_RECALL_BUILD_INFO();
|
|
665
|
+
|
|
635
666
|
// node_modules/drizzle-orm/query-promise.js
|
|
667
|
+
init_define_RECALL_BUILD_INFO();
|
|
636
668
|
var QueryPromise = class {
|
|
637
669
|
static [entityKind] = "QueryPromise";
|
|
638
670
|
[Symbol.toStringTag] = "QueryPromise";
|
|
@@ -657,6 +689,7 @@ var QueryPromise = class {
|
|
|
657
689
|
};
|
|
658
690
|
|
|
659
691
|
// node_modules/drizzle-orm/sqlite-core/utils.js
|
|
692
|
+
init_define_RECALL_BUILD_INFO();
|
|
660
693
|
function extractUsedTable(table) {
|
|
661
694
|
if (is(table, SQLiteTable)) {
|
|
662
695
|
return [`${table[Table.Symbol.BaseName]}`];
|
|
@@ -784,7 +817,17 @@ var SQLiteDeleteBase = class extends QueryPromise {
|
|
|
784
817
|
}
|
|
785
818
|
};
|
|
786
819
|
|
|
820
|
+
// node_modules/drizzle-orm/sqlite-core/query-builders/insert.js
|
|
821
|
+
init_define_RECALL_BUILD_INFO();
|
|
822
|
+
|
|
823
|
+
// node_modules/drizzle-orm/sqlite-core/query-builders/query-builder.js
|
|
824
|
+
init_define_RECALL_BUILD_INFO();
|
|
825
|
+
|
|
826
|
+
// node_modules/drizzle-orm/sqlite-core/dialect.js
|
|
827
|
+
init_define_RECALL_BUILD_INFO();
|
|
828
|
+
|
|
787
829
|
// node_modules/drizzle-orm/casing.js
|
|
830
|
+
init_define_RECALL_BUILD_INFO();
|
|
788
831
|
function toSnakeCase(input) {
|
|
789
832
|
const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
|
|
790
833
|
return words.map((word) => word.toLowerCase()).join("_");
|
|
@@ -837,6 +880,7 @@ var CasingCache = class {
|
|
|
837
880
|
};
|
|
838
881
|
|
|
839
882
|
// node_modules/drizzle-orm/errors.js
|
|
883
|
+
init_define_RECALL_BUILD_INFO();
|
|
840
884
|
var DrizzleError = class extends Error {
|
|
841
885
|
static [entityKind] = "DrizzleError";
|
|
842
886
|
constructor({ message, cause }) {
|
|
@@ -864,6 +908,7 @@ var TransactionRollbackError = class extends DrizzleError {
|
|
|
864
908
|
};
|
|
865
909
|
|
|
866
910
|
// node_modules/drizzle-orm/sqlite-core/view-base.js
|
|
911
|
+
init_define_RECALL_BUILD_INFO();
|
|
867
912
|
var SQLiteViewBase = class extends View {
|
|
868
913
|
static [entityKind] = "SQLiteViewBase";
|
|
869
914
|
};
|
|
@@ -1558,7 +1603,11 @@ var SQLiteAsyncDialect = class extends SQLiteDialect {
|
|
|
1558
1603
|
}
|
|
1559
1604
|
};
|
|
1560
1605
|
|
|
1606
|
+
// node_modules/drizzle-orm/sqlite-core/query-builders/select.js
|
|
1607
|
+
init_define_RECALL_BUILD_INFO();
|
|
1608
|
+
|
|
1561
1609
|
// node_modules/drizzle-orm/query-builders/query-builder.js
|
|
1610
|
+
init_define_RECALL_BUILD_INFO();
|
|
1562
1611
|
var TypedQueryBuilder = class {
|
|
1563
1612
|
static [entityKind] = "TypedQueryBuilder";
|
|
1564
1613
|
/** @internal */
|
|
@@ -2474,6 +2523,7 @@ var SQLiteInsertBase = class extends QueryPromise {
|
|
|
2474
2523
|
};
|
|
2475
2524
|
|
|
2476
2525
|
// node_modules/drizzle-orm/sqlite-core/query-builders/update.js
|
|
2526
|
+
init_define_RECALL_BUILD_INFO();
|
|
2477
2527
|
var SQLiteUpdateBuilder = class {
|
|
2478
2528
|
constructor(table, session, dialect, withList) {
|
|
2479
2529
|
this.table = table;
|
|
@@ -2640,6 +2690,7 @@ var SQLiteUpdateBase = class extends QueryPromise {
|
|
|
2640
2690
|
};
|
|
2641
2691
|
|
|
2642
2692
|
// node_modules/drizzle-orm/sqlite-core/query-builders/count.js
|
|
2693
|
+
init_define_RECALL_BUILD_INFO();
|
|
2643
2694
|
var SQLiteCountBuilder = class _SQLiteCountBuilder extends SQL {
|
|
2644
2695
|
constructor(params) {
|
|
2645
2696
|
super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
|
|
@@ -2684,6 +2735,7 @@ var SQLiteCountBuilder = class _SQLiteCountBuilder extends SQL {
|
|
|
2684
2735
|
};
|
|
2685
2736
|
|
|
2686
2737
|
// node_modules/drizzle-orm/sqlite-core/query-builders/query.js
|
|
2738
|
+
init_define_RECALL_BUILD_INFO();
|
|
2687
2739
|
var RelationalQueryBuilder = class {
|
|
2688
2740
|
constructor(mode, fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session) {
|
|
2689
2741
|
this.mode = mode;
|
|
@@ -2828,6 +2880,7 @@ var SQLiteSyncRelationalQuery = class extends SQLiteRelationalQuery {
|
|
|
2828
2880
|
};
|
|
2829
2881
|
|
|
2830
2882
|
// node_modules/drizzle-orm/sqlite-core/query-builders/raw.js
|
|
2883
|
+
init_define_RECALL_BUILD_INFO();
|
|
2831
2884
|
var SQLiteRaw = class extends QueryPromise {
|
|
2832
2885
|
constructor(execute, getSQL, action, dialect, mapBatchResult) {
|
|
2833
2886
|
super();
|
|
@@ -3146,7 +3199,11 @@ var BaseSQLiteDatabase = class {
|
|
|
3146
3199
|
}
|
|
3147
3200
|
};
|
|
3148
3201
|
|
|
3202
|
+
// node_modules/drizzle-orm/better-sqlite3/session.js
|
|
3203
|
+
init_define_RECALL_BUILD_INFO();
|
|
3204
|
+
|
|
3149
3205
|
// node_modules/drizzle-orm/cache/core/cache.js
|
|
3206
|
+
init_define_RECALL_BUILD_INFO();
|
|
3150
3207
|
var Cache = class {
|
|
3151
3208
|
static [entityKind] = "Cache";
|
|
3152
3209
|
};
|
|
@@ -3174,6 +3231,7 @@ async function hashQuery(sql2, params) {
|
|
|
3174
3231
|
}
|
|
3175
3232
|
|
|
3176
3233
|
// node_modules/drizzle-orm/sqlite-core/session.js
|
|
3234
|
+
init_define_RECALL_BUILD_INFO();
|
|
3177
3235
|
var ExecuteResultSync = class extends QueryPromise {
|
|
3178
3236
|
constructor(resultCb) {
|
|
3179
3237
|
super();
|
|
@@ -3527,7 +3585,11 @@ function drizzle(...params) {
|
|
|
3527
3585
|
drizzle2.mock = mock;
|
|
3528
3586
|
})(drizzle || (drizzle = {}));
|
|
3529
3587
|
|
|
3588
|
+
// node_modules/drizzle-orm/better-sqlite3/migrator.js
|
|
3589
|
+
init_define_RECALL_BUILD_INFO();
|
|
3590
|
+
|
|
3530
3591
|
// node_modules/drizzle-orm/migrator.js
|
|
3592
|
+
init_define_RECALL_BUILD_INFO();
|
|
3531
3593
|
import crypto2 from "crypto";
|
|
3532
3594
|
import fs from "fs";
|
|
3533
3595
|
function readMigrationFiles(config) {
|
|
@@ -3570,7 +3632,7 @@ import { join, dirname } from "path";
|
|
|
3570
3632
|
import { mkdirSync, existsSync, rmSync, statSync } from "fs";
|
|
3571
3633
|
import { fileURLToPath } from "url";
|
|
3572
3634
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
3573
|
-
var RECALL_DB_USER_VERSION =
|
|
3635
|
+
var RECALL_DB_USER_VERSION = 12;
|
|
3574
3636
|
function getDbPath() {
|
|
3575
3637
|
const dataDir = process.env.RECALL_DATA_DIR ?? join(
|
|
3576
3638
|
process.env.HOME ?? process.env.USERPROFILE ?? ".",
|
|
@@ -3602,8 +3664,14 @@ var STARTUP_WAL_TRUNCATE_BYTES = (() => {
|
|
|
3602
3664
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
3603
3665
|
})();
|
|
3604
3666
|
function applyPragmas(sqlite) {
|
|
3667
|
+
sqlite.pragma("busy_timeout = 15000");
|
|
3605
3668
|
sqlite.pragma("journal_mode = WAL");
|
|
3606
3669
|
sqlite.pragma("foreign_keys = ON");
|
|
3670
|
+
sqlite.function(
|
|
3671
|
+
"recall_sha256",
|
|
3672
|
+
{ deterministic: true },
|
|
3673
|
+
(value) => createHash("sha256").update(value).digest("hex")
|
|
3674
|
+
);
|
|
3607
3675
|
truncateWalIfLarge(sqlite);
|
|
3608
3676
|
}
|
|
3609
3677
|
function truncateWalIfLarge(sqlite) {
|
|
@@ -3629,6 +3697,12 @@ function getDb(dbPath) {
|
|
|
3629
3697
|
}
|
|
3630
3698
|
return _db;
|
|
3631
3699
|
}
|
|
3700
|
+
function createStandaloneDb(dbPath) {
|
|
3701
|
+
const sqlite = new Database(dbPath);
|
|
3702
|
+
applyPragmas(sqlite);
|
|
3703
|
+
const db = makeDb(sqlite);
|
|
3704
|
+
return { db, sqlite };
|
|
3705
|
+
}
|
|
3632
3706
|
function migrateIfNeeded(db) {
|
|
3633
3707
|
const current = Number(db.$client.pragma("user_version", { simple: true }) ?? 0);
|
|
3634
3708
|
if (current >= RECALL_DB_USER_VERSION) return;
|
|
@@ -3640,6 +3714,11 @@ function initDb(dbPath) {
|
|
|
3640
3714
|
migrateIfNeeded(db);
|
|
3641
3715
|
return db;
|
|
3642
3716
|
}
|
|
3717
|
+
function initStandaloneDb(dbPath) {
|
|
3718
|
+
const { db } = createStandaloneDb(dbPath);
|
|
3719
|
+
migrateIfNeeded(db);
|
|
3720
|
+
return db;
|
|
3721
|
+
}
|
|
3643
3722
|
function closeDb() {
|
|
3644
3723
|
if (_sqlite) {
|
|
3645
3724
|
_sqlite.close();
|
|
@@ -3675,6 +3754,7 @@ function resetDb(dbPath, options = {}) {
|
|
|
3675
3754
|
}
|
|
3676
3755
|
|
|
3677
3756
|
// src/models/activity.ts
|
|
3757
|
+
init_define_RECALL_BUILD_INFO();
|
|
3678
3758
|
import { randomUUID } from "crypto";
|
|
3679
3759
|
function createActivityEvent(db, input) {
|
|
3680
3760
|
const safeInput = {
|
|
@@ -3793,6 +3873,7 @@ function rowToActivityEvent(row) {
|
|
|
3793
3873
|
}
|
|
3794
3874
|
|
|
3795
3875
|
// src/scanner/repo.ts
|
|
3876
|
+
init_define_RECALL_BUILD_INFO();
|
|
3796
3877
|
import { existsSync as existsSync2 } from "fs";
|
|
3797
3878
|
import { join as join2, basename } from "path";
|
|
3798
3879
|
import { execFileSync } from "child_process";
|
|
@@ -4115,10 +4196,23 @@ function makeGotcha(text, repo, file) {
|
|
|
4115
4196
|
}
|
|
4116
4197
|
|
|
4117
4198
|
// src/repo/discovery.ts
|
|
4199
|
+
init_define_RECALL_BUILD_INFO();
|
|
4118
4200
|
import { existsSync as existsSync3, readdirSync } from "fs";
|
|
4119
4201
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
4120
4202
|
import { join as join3, resolve } from "path";
|
|
4121
4203
|
var repoPathCache = /* @__PURE__ */ new Map();
|
|
4204
|
+
function runGit(args) {
|
|
4205
|
+
const binaries = ["git", ...process.platform === "darwin" && existsSync3("/opt/homebrew/bin/git") ? ["/opt/homebrew/bin/git"] : []];
|
|
4206
|
+
let failure;
|
|
4207
|
+
for (const binary of binaries) {
|
|
4208
|
+
try {
|
|
4209
|
+
return execFileSync2(binary, args, { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"], timeout: 5e3 }).trim();
|
|
4210
|
+
} catch (error) {
|
|
4211
|
+
failure = error;
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4214
|
+
throw failure;
|
|
4215
|
+
}
|
|
4122
4216
|
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
4123
4217
|
".git",
|
|
4124
4218
|
"node_modules",
|
|
@@ -4209,11 +4303,7 @@ function inferRepoSlugFromPath(repoPath) {
|
|
|
4209
4303
|
const root = normalizeRepoPathHint(repoPath);
|
|
4210
4304
|
if (!root) return null;
|
|
4211
4305
|
try {
|
|
4212
|
-
const remote =
|
|
4213
|
-
"git",
|
|
4214
|
-
["-C", root, "remote", "get-url", "origin"],
|
|
4215
|
-
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
4216
|
-
).trim();
|
|
4306
|
+
const remote = runGit(["-C", root, "remote", "get-url", "origin"]);
|
|
4217
4307
|
return extractRepoSlugFromRemote2(remote);
|
|
4218
4308
|
} catch {
|
|
4219
4309
|
const parts = root.split("/").filter(Boolean);
|
|
@@ -4253,11 +4343,7 @@ function normalizeRepoPathHint(repoPath) {
|
|
|
4253
4343
|
if (!repoPath) return null;
|
|
4254
4344
|
const expanded = repoPath.trim().replace(/^~(?=\/)/, process.env.HOME ?? "~");
|
|
4255
4345
|
try {
|
|
4256
|
-
const root =
|
|
4257
|
-
"git",
|
|
4258
|
-
["-C", expanded, "rev-parse", "--show-toplevel"],
|
|
4259
|
-
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
4260
|
-
).trim();
|
|
4346
|
+
const root = runGit(["-C", expanded, "rev-parse", "--show-toplevel"]);
|
|
4261
4347
|
return root || null;
|
|
4262
4348
|
} catch {
|
|
4263
4349
|
const resolved = resolve(expanded);
|
|
@@ -4299,6 +4385,7 @@ function walkRepos(dir, depthRemaining, seen, repos) {
|
|
|
4299
4385
|
}
|
|
4300
4386
|
|
|
4301
4387
|
// src/history/snippets.ts
|
|
4388
|
+
init_define_RECALL_BUILD_INFO();
|
|
4302
4389
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
4303
4390
|
function createHistorySnippet(db, input) {
|
|
4304
4391
|
const dedupeKey = historySnippetDedupeKey(input);
|
|
@@ -4386,10 +4473,11 @@ function rowToHistorySnippet(row) {
|
|
|
4386
4473
|
}
|
|
4387
4474
|
|
|
4388
4475
|
// src/history/retrieval.ts
|
|
4389
|
-
|
|
4476
|
+
init_define_RECALL_BUILD_INFO();
|
|
4477
|
+
import { createHash as createHash2 } from "crypto";
|
|
4390
4478
|
|
|
4391
4479
|
// src/vector/sqlite-vec-history.ts
|
|
4392
|
-
|
|
4480
|
+
init_define_RECALL_BUILD_INFO();
|
|
4393
4481
|
var VEC_HISTORY_INDEX = "vec_history_index";
|
|
4394
4482
|
var loadedClients = /* @__PURE__ */ new WeakSet();
|
|
4395
4483
|
function getSqlite(db) {
|
|
@@ -4403,7 +4491,7 @@ function hasHistoryVecIndex(db) {
|
|
|
4403
4491
|
function ensureLoaded(db) {
|
|
4404
4492
|
const sqlite = getSqlite(db);
|
|
4405
4493
|
if (loadedClients.has(sqlite)) return;
|
|
4406
|
-
|
|
4494
|
+
load(sqlite);
|
|
4407
4495
|
loadedClients.add(sqlite);
|
|
4408
4496
|
}
|
|
4409
4497
|
function getHistoryVecDimension(rows) {
|
|
@@ -4436,8 +4524,8 @@ function ensureHistoryVecIndex(db, dimensions) {
|
|
|
4436
4524
|
`);
|
|
4437
4525
|
}
|
|
4438
4526
|
function removeHistoryVecRow(db, snippetId) {
|
|
4439
|
-
ensureLoaded(db);
|
|
4440
4527
|
if (!hasHistoryVecIndex(db)) return;
|
|
4528
|
+
ensureLoaded(db);
|
|
4441
4529
|
getSqlite(db).prepare(`delete from ${VEC_HISTORY_INDEX} where snippet_id = ?`).run(snippetId);
|
|
4442
4530
|
}
|
|
4443
4531
|
async function rebuildHistoryVecIndexResponsive(db, config, options = {}) {
|
|
@@ -4540,6 +4628,7 @@ function searchHistoryVecIndex(db, queryEmbedding, options = {}) {
|
|
|
4540
4628
|
}
|
|
4541
4629
|
|
|
4542
4630
|
// src/vector/sqlite-fts-history.ts
|
|
4631
|
+
init_define_RECALL_BUILD_INFO();
|
|
4543
4632
|
var FTS_HISTORY_INDEX = "fts_history_index";
|
|
4544
4633
|
var FTS_TOKENIZER = `porter unicode61 remove_diacritics 2`;
|
|
4545
4634
|
function getSqlite2(db) {
|
|
@@ -4708,7 +4797,7 @@ function searchHistoryFtsIndex(db, query, options = {}) {
|
|
|
4708
4797
|
|
|
4709
4798
|
// src/history/retrieval.ts
|
|
4710
4799
|
function hashText(text) {
|
|
4711
|
-
return
|
|
4800
|
+
return createHash2("sha256").update(text).digest("hex");
|
|
4712
4801
|
}
|
|
4713
4802
|
function version(config) {
|
|
4714
4803
|
return config.version || `${config.provider}:${config.model}:${config.dimensions}`;
|
|
@@ -4779,8 +4868,19 @@ async function bootstrapHistoryEmbeddings(db, config, options = {}) {
|
|
|
4779
4868
|
return total;
|
|
4780
4869
|
}
|
|
4781
4870
|
function verifyHistoryEmbeddings(db, config, options = {}) {
|
|
4782
|
-
const rows = db.select(
|
|
4783
|
-
|
|
4871
|
+
const rows = db.select({
|
|
4872
|
+
id: historySnippets.id,
|
|
4873
|
+
repo: historySnippets.repo,
|
|
4874
|
+
text: historySnippets.text
|
|
4875
|
+
}).from(historySnippets).all().filter((row) => !options.repo || row.repo === options.repo);
|
|
4876
|
+
const embeddings = db.select({
|
|
4877
|
+
snippet_id: historySnippetEmbeddings.snippet_id,
|
|
4878
|
+
model: historySnippetEmbeddings.model,
|
|
4879
|
+
embedding_dimensions: historySnippetEmbeddings.embedding_dimensions,
|
|
4880
|
+
index_dimensions: historySnippetEmbeddings.index_dimensions,
|
|
4881
|
+
version: historySnippetEmbeddings.version,
|
|
4882
|
+
content_hash: historySnippetEmbeddings.content_hash
|
|
4883
|
+
}).from(historySnippetEmbeddings).all();
|
|
4784
4884
|
const byId = new Map(embeddings.map((row) => [row.snippet_id, row]));
|
|
4785
4885
|
let eligible = 0;
|
|
4786
4886
|
let stale = 0;
|
|
@@ -4858,7 +4958,11 @@ async function searchHistorySnippets(db, query, options = {}) {
|
|
|
4858
4958
|
return [...merged.values()].sort((a, b) => b.score - a.score).slice(0, limit);
|
|
4859
4959
|
}
|
|
4860
4960
|
|
|
4961
|
+
// src/compiler/context.ts
|
|
4962
|
+
init_define_RECALL_BUILD_INFO();
|
|
4963
|
+
|
|
4861
4964
|
// src/models/history-injections.ts
|
|
4965
|
+
init_define_RECALL_BUILD_INFO();
|
|
4862
4966
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
4863
4967
|
function recordHistoryInjections(db, input) {
|
|
4864
4968
|
if (!input.session_id || input.snippet_ids.length === 0) return 0;
|
|
@@ -4883,6 +4987,18 @@ function listInjectedHistoryIdsForSession(db, sessionId) {
|
|
|
4883
4987
|
return new Set(rows.map((row) => row.snippet_id));
|
|
4884
4988
|
}
|
|
4885
4989
|
|
|
4990
|
+
// src/repo/aliases.ts
|
|
4991
|
+
init_define_RECALL_BUILD_INFO();
|
|
4992
|
+
function memoryRepoAliases(db, repo) {
|
|
4993
|
+
if (!repo) return [repo];
|
|
4994
|
+
const known = db.selectDistinct({ repo: memories.repo }).from(memories).all().map((row) => row.repo).filter((name) => Boolean(name));
|
|
4995
|
+
const basename2 = repo.split("/").at(-1);
|
|
4996
|
+
const qualified = known.filter((name) => name.includes("/") && name.split("/").at(-1) === basename2);
|
|
4997
|
+
if (repo.includes("/") && !qualified.includes(repo)) qualified.push(repo);
|
|
4998
|
+
if (qualified.length !== 1) return [repo];
|
|
4999
|
+
return [.../* @__PURE__ */ new Set([repo, basename2, qualified[0]])];
|
|
5000
|
+
}
|
|
5001
|
+
|
|
4886
5002
|
// src/compiler/context.ts
|
|
4887
5003
|
var DEFAULT_CONFIG = {
|
|
4888
5004
|
confidence_threshold: CONFIDENCE.ACTIVE_MIN,
|
|
@@ -4984,17 +5100,17 @@ function compileContext(db, req) {
|
|
|
4984
5100
|
confidence_threshold: req.config?.confidence_threshold ?? profile.compile_confidence_threshold
|
|
4985
5101
|
};
|
|
4986
5102
|
const selectedHistory = selectRepoHistory(db, req.repo, config.max_history_snippets);
|
|
4987
|
-
const repoActive = queryMemories(db, {
|
|
4988
|
-
repo
|
|
5103
|
+
const repoActive = memoryRepoAliases(db, req.repo).flatMap((repo) => queryMemories(db, {
|
|
5104
|
+
repo,
|
|
4989
5105
|
status: "active",
|
|
4990
5106
|
auto_inject: true
|
|
4991
|
-
});
|
|
5107
|
+
}));
|
|
4992
5108
|
const globalActive = queryMemories(db, {
|
|
4993
5109
|
scope: "global",
|
|
4994
5110
|
status: "active",
|
|
4995
5111
|
auto_inject: true
|
|
4996
5112
|
});
|
|
4997
|
-
const allActive = dedupeById([...repoActive, ...globalActive]);
|
|
5113
|
+
const allActive = dedupeById([...repoActive, ...globalActive]).filter((m) => !hasNonDurableProvenance(m));
|
|
4998
5114
|
const sessionScoped = filterSessionScoped(allActive, req.session_id);
|
|
4999
5115
|
const scoped = req.path ? sessionScoped.filter((m) => pathMatches(m, req.path)) : sessionScoped;
|
|
5000
5116
|
const passing = scoped.filter(
|
|
@@ -5095,29 +5211,39 @@ async function compileContextHybrid(db, req) {
|
|
|
5095
5211
|
const normalizedQuery = req.query_text ? normalizeQueryForRetrieval(req.query_text) : "";
|
|
5096
5212
|
const effectiveQuery = normalizedQuery.length > 0 ? normalizedQuery : void 0;
|
|
5097
5213
|
const selectedHistory = effectiveQuery ? await selectRelevantHistory(db, req.repo, effectiveQuery, config.max_history_snippets) : selectRepoHistory(db, req.repo, config.max_history_snippets);
|
|
5098
|
-
const repoMemories = queryMemories(db, { repo
|
|
5214
|
+
const repoMemories = memoryRepoAliases(db, req.repo).flatMap((repo) => queryMemories(db, { repo }));
|
|
5099
5215
|
const globalMemories = queryMemories(db, { scope: "global" });
|
|
5216
|
+
const eligibleCandidate = (memory) => {
|
|
5217
|
+
if (req.config?.include_candidates === false) return false;
|
|
5218
|
+
if (isHighRiskRule(memory.text)) return false;
|
|
5219
|
+
if (req.config?.include_candidates === true) return true;
|
|
5220
|
+
return Boolean(effectiveQuery) && hasDirectCorrectionEvidence(memory) && memory.evidence.some((entry) => entry.type === "session_correction" && Boolean(entry.context) && !isNonUserCaptureContext(entry.context ?? "") && !isEphemeralTaskConstraint(memory.text, entry.context ?? ""));
|
|
5221
|
+
};
|
|
5100
5222
|
const allMemories = dedupeById([...repoMemories, ...globalMemories]).filter((memory) => {
|
|
5101
|
-
|
|
5223
|
+
if (hasNonDurableProvenance(memory)) return false;
|
|
5224
|
+
const statusEligible = memory.status === "active" || memory.status === "candidate" && eligibleCandidate(memory);
|
|
5102
5225
|
if (!statusEligible) return false;
|
|
5103
5226
|
if (memory.auto_inject) return true;
|
|
5104
|
-
return Boolean(effectiveQuery) && memory.status === "active";
|
|
5227
|
+
return Boolean(effectiveQuery) && (memory.status === "active" || eligibleCandidate(memory));
|
|
5105
5228
|
});
|
|
5106
5229
|
const sessionScoped = filterSessionScoped(allMemories, req.session_id);
|
|
5107
5230
|
const scoped = req.path ? sessionScoped.filter((memory) => pathMatches(memory, req.path)) : sessionScoped;
|
|
5108
|
-
const candidateConfidenceFloor = Math.min(config.confidence_threshold, 0.
|
|
5231
|
+
const candidateConfidenceFloor = Math.min(config.confidence_threshold, 0.35);
|
|
5109
5232
|
const passing = scoped.filter((memory) => {
|
|
5110
5233
|
if (memory.status === "active") {
|
|
5111
5234
|
return memory.confidence + CONFIDENCE_EPSILON >= config.confidence_threshold;
|
|
5112
5235
|
}
|
|
5113
|
-
if (memory.status === "candidate" &&
|
|
5236
|
+
if (memory.status === "candidate" && eligibleCandidate(memory)) {
|
|
5114
5237
|
return memory.confidence >= candidateConfidenceFloor;
|
|
5115
5238
|
}
|
|
5116
5239
|
return false;
|
|
5117
5240
|
});
|
|
5118
5241
|
const passingIds = new Set(passing.map((memory) => memory.id));
|
|
5119
5242
|
const dropped = scoped.filter((memory) => !passingIds.has(memory.id));
|
|
5120
|
-
const hybridNearMisses = collectNearMisses(
|
|
5243
|
+
const hybridNearMisses = collectNearMisses(
|
|
5244
|
+
dropped.filter((memory) => !effectiveQuery || textMatchScore(effectiveQuery, memory.text).score >= QUERY_TEXT_MATCH_FLOOR),
|
|
5245
|
+
config.confidence_threshold
|
|
5246
|
+
);
|
|
5121
5247
|
if (passing.length === 0 && selectedHistory.length === 0) {
|
|
5122
5248
|
return {
|
|
5123
5249
|
confidence_threshold: config.confidence_threshold,
|
|
@@ -5291,7 +5417,8 @@ ${sections.join("\n\n")}
|
|
|
5291
5417
|
}
|
|
5292
5418
|
function renderMemoryBullet(memory) {
|
|
5293
5419
|
const prefix = memory.scope === "global" ? "[global] " : "";
|
|
5294
|
-
|
|
5420
|
+
const pending = memory.status === "candidate" ? "[unconfirmed preference; not authorization] " : "";
|
|
5421
|
+
return `- ${prefix}${pending}${renderMemoryText(memory)}`;
|
|
5295
5422
|
}
|
|
5296
5423
|
function renderMemoryText(memory) {
|
|
5297
5424
|
const text = memory.text.replace(/\r\n/g, "\n").trim();
|
|
@@ -5343,7 +5470,7 @@ var HISTORY_KINDS = /* @__PURE__ */ new Set([
|
|
|
5343
5470
|
]);
|
|
5344
5471
|
function selectRepoHistory(db, repo, limit) {
|
|
5345
5472
|
if (limit <= 0) return [];
|
|
5346
|
-
return listHistorySnippets(db, { repo, limit: Math.max(limit * 3, 6) }).filter((snippet) => !snippet.session_id && HISTORY_KINDS.has(snippet.kind)).slice(0, limit);
|
|
5473
|
+
return listHistorySnippets(db, { repo, limit: Math.max(limit * 3, 6) }).filter((snippet) => !snippet.session_id && HISTORY_KINDS.has(snippet.kind) && !containsGeneratedHistory(snippet.text)).slice(0, limit);
|
|
5347
5474
|
}
|
|
5348
5475
|
async function selectRelevantHistory(db, repo, query, limit) {
|
|
5349
5476
|
if (limit <= 0) return [];
|
|
@@ -5353,7 +5480,7 @@ async function selectRelevantHistory(db, repo, query, limit) {
|
|
|
5353
5480
|
});
|
|
5354
5481
|
return results.filter(
|
|
5355
5482
|
(result) => result.lexical_score >= HISTORY_LEXICAL_RELEVANCE_FLOOR || result.similarity >= HISTORY_VECTOR_RELEVANCE_FLOOR
|
|
5356
|
-
).map((result) => result.snippet).filter((snippet) => HISTORY_KINDS.has(snippet.kind)).slice(0, limit);
|
|
5483
|
+
).map((result) => result.snippet).filter((snippet) => HISTORY_KINDS.has(snippet.kind) && !containsGeneratedHistory(snippet.text)).slice(0, limit);
|
|
5357
5484
|
}
|
|
5358
5485
|
var HISTORY_ENTRY_MAX_CHARS = 120;
|
|
5359
5486
|
var HISTORY_MAX_ENTRIES_PER_SNIPPET = 2;
|
|
@@ -5449,6 +5576,7 @@ function filterSessionScoped(memories4, sessionId) {
|
|
|
5449
5576
|
}
|
|
5450
5577
|
|
|
5451
5578
|
// src/adapters/markdown.ts
|
|
5579
|
+
init_define_RECALL_BUILD_INFO();
|
|
5452
5580
|
function exportMarkdown(db, repo) {
|
|
5453
5581
|
const result = compileContext(db, { repo });
|
|
5454
5582
|
if (!result.text) {
|
|
@@ -5477,6 +5605,7 @@ ${result.text}`;
|
|
|
5477
5605
|
}
|
|
5478
5606
|
|
|
5479
5607
|
// src/artifacts/context.ts
|
|
5608
|
+
init_define_RECALL_BUILD_INFO();
|
|
5480
5609
|
import { mkdirSync as mkdirSync2 } from "fs";
|
|
5481
5610
|
import { isAbsolute, join as join4, resolve as resolve2 } from "path";
|
|
5482
5611
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
@@ -5549,12 +5678,13 @@ function ensureRepoContextExcluded(repoPath) {
|
|
|
5549
5678
|
}
|
|
5550
5679
|
|
|
5551
5680
|
// src/session/lifecycle.ts
|
|
5681
|
+
init_define_RECALL_BUILD_INFO();
|
|
5552
5682
|
function resolveLifecycleSource(input) {
|
|
5553
5683
|
if (input.source) return input.source;
|
|
5554
5684
|
return input.client ? tagActivitySource("hook", input.client) : "daemon";
|
|
5555
5685
|
}
|
|
5556
5686
|
function startSessionLifecycle(db, input) {
|
|
5557
|
-
const repo = input.repo ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5687
|
+
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5558
5688
|
const bootstrap = ensureRepoBootstrapped(db, {
|
|
5559
5689
|
repo,
|
|
5560
5690
|
repoPathHint: input.repo_path
|
|
@@ -5609,7 +5739,7 @@ function startSessionLifecycle(db, input) {
|
|
|
5609
5739
|
};
|
|
5610
5740
|
}
|
|
5611
5741
|
function recordSessionLifecycleEvent(db, input) {
|
|
5612
|
-
const repo = input.repo ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5742
|
+
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5613
5743
|
createActivityEvent(db, {
|
|
5614
5744
|
session_id: input.session_id,
|
|
5615
5745
|
repo,
|
|
@@ -5633,7 +5763,7 @@ function recordSessionLifecycleEvent(db, input) {
|
|
|
5633
5763
|
};
|
|
5634
5764
|
}
|
|
5635
5765
|
function endSessionLifecycle(db, input) {
|
|
5636
|
-
const repo = input.repo ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5766
|
+
const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
|
|
5637
5767
|
createActivityEvent(db, {
|
|
5638
5768
|
session_id: input.session_id,
|
|
5639
5769
|
repo,
|
|
@@ -5657,6 +5787,7 @@ function endSessionLifecycle(db, input) {
|
|
|
5657
5787
|
}
|
|
5658
5788
|
|
|
5659
5789
|
// src/eval/harness.ts
|
|
5790
|
+
init_define_RECALL_BUILD_INFO();
|
|
5660
5791
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
5661
5792
|
function startEvalSession(db, repo) {
|
|
5662
5793
|
const id = randomUUID4();
|
|
@@ -5836,6 +5967,7 @@ function formatMetricsReport(metrics) {
|
|
|
5836
5967
|
}
|
|
5837
5968
|
|
|
5838
5969
|
// src/eval/retrieval.ts
|
|
5970
|
+
init_define_RECALL_BUILD_INFO();
|
|
5839
5971
|
import { readFileSync } from "fs";
|
|
5840
5972
|
function loadRetrievalEvalFile(path) {
|
|
5841
5973
|
return RetrievalEvalFile.parse(JSON.parse(readFileSync(path, "utf8")));
|
|
@@ -6173,6 +6305,7 @@ function embeddingConfigForProvider(provider) {
|
|
|
6173
6305
|
}
|
|
6174
6306
|
|
|
6175
6307
|
// src/feedback/implicit.ts
|
|
6308
|
+
init_define_RECALL_BUILD_INFO();
|
|
6176
6309
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
6177
6310
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
6178
6311
|
var SIGNAL_WEIGHTS = {
|
|
@@ -6221,6 +6354,7 @@ function getSignalStats(db, memoryId) {
|
|
|
6221
6354
|
}
|
|
6222
6355
|
|
|
6223
6356
|
// src/policy/engine.ts
|
|
6357
|
+
init_define_RECALL_BUILD_INFO();
|
|
6224
6358
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
6225
6359
|
function createPolicy(db, orgId, ruleType, config) {
|
|
6226
6360
|
const id = randomUUID6();
|
|
@@ -6382,7 +6516,9 @@ function rowToPolicy(row) {
|
|
|
6382
6516
|
}
|
|
6383
6517
|
|
|
6384
6518
|
// src/pruning/pruner.ts
|
|
6519
|
+
init_define_RECALL_BUILD_INFO();
|
|
6385
6520
|
var DEFAULT_CONFIG2 = {
|
|
6521
|
+
candidate_unconfirmed_days: 30,
|
|
6386
6522
|
stale_days: 90,
|
|
6387
6523
|
rejected_retention_days: 30,
|
|
6388
6524
|
transient_retention_days: 7,
|
|
@@ -6397,18 +6533,43 @@ function pruneMemories(db, config = {}) {
|
|
|
6397
6533
|
const now2 = Date.now();
|
|
6398
6534
|
const dayMs = 864e5;
|
|
6399
6535
|
const result = {
|
|
6536
|
+
unconfirmed_archived: [],
|
|
6400
6537
|
stale_archived: [],
|
|
6401
6538
|
rejected_pruned: [],
|
|
6402
6539
|
transient_pruned: [],
|
|
6403
6540
|
unhealthy_demoted: [],
|
|
6404
6541
|
total: 0
|
|
6405
6542
|
};
|
|
6543
|
+
const unconfirmedCutoff = new Date(
|
|
6544
|
+
now2 - cfg.candidate_unconfirmed_days * dayMs
|
|
6545
|
+
).toISOString();
|
|
6546
|
+
const unconfirmed = queryMemories(db, {
|
|
6547
|
+
repo: cfg.repo,
|
|
6548
|
+
status: "candidate",
|
|
6549
|
+
auto_inject: true
|
|
6550
|
+
}).filter(
|
|
6551
|
+
(mem) => mem.created_at < unconfirmedCutoff && mem.repetition_count < 2 && mem.injection_count === 0
|
|
6552
|
+
);
|
|
6553
|
+
for (const mem of unconfirmed) {
|
|
6554
|
+
if (!cfg.dry_run) {
|
|
6555
|
+
db.update(memories).set({ auto_inject: false, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).where(eq(memories.id, mem.id)).run();
|
|
6556
|
+
recordAudit(
|
|
6557
|
+
db,
|
|
6558
|
+
mem.id,
|
|
6559
|
+
"demoted",
|
|
6560
|
+
"auto-pruner",
|
|
6561
|
+
`Archived unconfirmed candidate after ${cfg.candidate_unconfirmed_days}d without selection or repetition`
|
|
6562
|
+
);
|
|
6563
|
+
}
|
|
6564
|
+
result.unconfirmed_archived.push(mem.id);
|
|
6565
|
+
}
|
|
6406
6566
|
const staleCutoff = new Date(now2 - cfg.stale_days * dayMs).toISOString();
|
|
6407
6567
|
const staleCandidates = queryMemories(db, {
|
|
6408
6568
|
repo: cfg.repo,
|
|
6409
6569
|
limit: void 0
|
|
6410
6570
|
}).filter((mem) => mem.status !== "rejected" && mem.status !== "transient");
|
|
6411
6571
|
for (const mem of staleCandidates) {
|
|
6572
|
+
if (result.unconfirmed_archived.includes(mem.id)) continue;
|
|
6412
6573
|
const lastActivity = mem.last_validated_at ?? mem.last_injected_at ?? mem.updated_at;
|
|
6413
6574
|
if (lastActivity < staleCutoff && mem.auto_inject) {
|
|
6414
6575
|
if (!cfg.dry_run) {
|
|
@@ -6479,7 +6640,7 @@ function pruneMemories(db, config = {}) {
|
|
|
6479
6640
|
result.unhealthy_demoted.push(mem.id);
|
|
6480
6641
|
}
|
|
6481
6642
|
}
|
|
6482
|
-
result.total = result.stale_archived.length + result.rejected_pruned.length + result.transient_pruned.length + result.unhealthy_demoted.length;
|
|
6643
|
+
result.total = result.unconfirmed_archived.length + result.stale_archived.length + result.rejected_pruned.length + result.transient_pruned.length + result.unhealthy_demoted.length;
|
|
6483
6644
|
return result;
|
|
6484
6645
|
}
|
|
6485
6646
|
function deleteMemoryAndDependents(db, memoryId) {
|
|
@@ -6500,6 +6661,7 @@ function formatPruneReport(result, dryRun) {
|
|
|
6500
6661
|
const lines = [
|
|
6501
6662
|
`${prefix}Prune Report`,
|
|
6502
6663
|
``,
|
|
6664
|
+
`Unconfirmed archived:${String(result.unconfirmed_archived.length).padStart(5)}`,
|
|
6503
6665
|
`Stale archived: ${result.stale_archived.length}`,
|
|
6504
6666
|
`Rejected pruned: ${result.rejected_pruned.length}`,
|
|
6505
6667
|
`Transient pruned: ${result.transient_pruned.length}`,
|
|
@@ -6522,6 +6684,7 @@ function formatPruneReport(result, dryRun) {
|
|
|
6522
6684
|
}
|
|
6523
6685
|
|
|
6524
6686
|
// src/mcp/fallback.ts
|
|
6687
|
+
init_define_RECALL_BUILD_INFO();
|
|
6525
6688
|
async function captureCorrectionFallback(db, input, source) {
|
|
6526
6689
|
const sessionId = input.session_id ?? `${source}-capture`;
|
|
6527
6690
|
const { ids, pendingTaskId, blockedByRejectedExemplar } = await processCorrection(db, input.text, {
|
|
@@ -6629,6 +6792,7 @@ export {
|
|
|
6629
6792
|
RECALL_DB_USER_VERSION,
|
|
6630
6793
|
getDbPath,
|
|
6631
6794
|
initDb,
|
|
6795
|
+
initStandaloneDb,
|
|
6632
6796
|
closeDb,
|
|
6633
6797
|
getDbUserVersion,
|
|
6634
6798
|
resetDb,
|
|
@@ -6688,4 +6852,4 @@ export {
|
|
|
6688
6852
|
pruneMemories,
|
|
6689
6853
|
formatPruneReport
|
|
6690
6854
|
};
|
|
6691
|
-
//# sourceMappingURL=chunk-
|
|
6855
|
+
//# sourceMappingURL=chunk-M3ASNCVM.js.map
|