@cerefox/memory 1.1.0-beta.7 → 1.1.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/dist/bin/cerefox.js +51 -10
- package/dist/server-assets/_shared/ef-meta/index.ts +1 -1
- package/dist/server-assets/db/migrations/0017_retention_default_120h.sql +28 -0
- package/dist/server-assets/db/rpcs.sql +5 -3
- package/dist/server-assets/db/schema.sql +1 -1
- package/docs/guides/configuration.md +9 -10
- package/docs/guides/setup-local.md +3 -1
- package/docs/guides/upgrading.md +48 -11
- package/package.json +1 -1
package/dist/bin/cerefox.js
CHANGED
|
@@ -7438,7 +7438,7 @@ var exports_meta = {};
|
|
|
7438
7438
|
__export(exports_meta, {
|
|
7439
7439
|
PKG_VERSION: () => PKG_VERSION
|
|
7440
7440
|
});
|
|
7441
|
-
var PKG_VERSION = "1.1.0
|
|
7441
|
+
var PKG_VERSION = "1.1.0";
|
|
7442
7442
|
var init_meta = () => {};
|
|
7443
7443
|
|
|
7444
7444
|
// ../../_shared/config/paths.ts
|
|
@@ -25858,7 +25858,7 @@ async function checkServerCompatibility(opts) {
|
|
|
25858
25858
|
var COMPATIBILITY;
|
|
25859
25859
|
var init_compatibility = __esm(() => {
|
|
25860
25860
|
COMPATIBILITY = {
|
|
25861
|
-
minSchema: "0.3
|
|
25861
|
+
minSchema: "0.10.3",
|
|
25862
25862
|
minEdgeFunctions: "0.6.0"
|
|
25863
25863
|
};
|
|
25864
25864
|
});
|
|
@@ -75610,7 +75610,7 @@ import { homedir as homedir6 } from "node:os";
|
|
|
75610
75610
|
import { join as join9 } from "node:path";
|
|
75611
75611
|
|
|
75612
75612
|
// ../../_shared/ef-meta/index.ts
|
|
75613
|
-
var EF_VERSION = "1.1.0
|
|
75613
|
+
var EF_VERSION = "1.1.0";
|
|
75614
75614
|
var EF_LAST_CHANGED = "1.1.0-beta.7";
|
|
75615
75615
|
|
|
75616
75616
|
// src/cli/util/checks.ts
|
|
@@ -75712,19 +75712,60 @@ var RETIRED_ENV_VARS = [
|
|
|
75712
75712
|
{ name: "CEREFOX_MIN_TERM_COVERAGE", configKey: "min_term_coverage", since: "v1.1.0" },
|
|
75713
75713
|
{ name: "CEREFOX_SEARCH_ALPHA", configKey: "search_alpha", since: "v1.1.0" }
|
|
75714
75714
|
];
|
|
75715
|
-
function checkRetiredEnvVars() {
|
|
75715
|
+
async function checkRetiredEnvVars() {
|
|
75716
75716
|
const set = RETIRED_ENV_VARS.filter((v) => (process.env[v.name] ?? "").trim() !== "");
|
|
75717
75717
|
if (set.length === 0) {
|
|
75718
75718
|
return { name: "retired env", status: "ok", detail: "no retired variables set" };
|
|
75719
75719
|
}
|
|
75720
|
-
const
|
|
75721
|
-
|
|
75720
|
+
const settings = loadSettings();
|
|
75721
|
+
const stored = new Map;
|
|
75722
|
+
if (settings.supabaseUrl && settings.supabaseKey) {
|
|
75723
|
+
await Promise.all(set.map(async (v) => {
|
|
75724
|
+
try {
|
|
75725
|
+
const resp = await fetch(`${settings.supabaseUrl.replace(/\/$/, "")}/rest/v1/rpc/cerefox_get_config`, {
|
|
75726
|
+
method: "POST",
|
|
75727
|
+
headers: {
|
|
75728
|
+
"Content-Type": "application/json",
|
|
75729
|
+
apikey: settings.supabaseKey,
|
|
75730
|
+
Authorization: `Bearer ${settings.supabaseKey}`
|
|
75731
|
+
},
|
|
75732
|
+
body: JSON.stringify({ p_key: v.configKey })
|
|
75733
|
+
});
|
|
75734
|
+
if (!resp.ok)
|
|
75735
|
+
return;
|
|
75736
|
+
const body = await resp.json();
|
|
75737
|
+
stored.set(v.configKey, typeof body === "string" ? body : null);
|
|
75738
|
+
} catch {}
|
|
75739
|
+
}));
|
|
75740
|
+
}
|
|
75741
|
+
const sameNumber = (a, b2) => {
|
|
75742
|
+
const x = Number(a);
|
|
75743
|
+
const y = Number(b2);
|
|
75744
|
+
return Number.isFinite(x) && Number.isFinite(y) ? x === y : a.trim() === b2.trim();
|
|
75745
|
+
};
|
|
75746
|
+
const pending = set.filter((v) => {
|
|
75747
|
+
const dbValue = stored.get(v.configKey);
|
|
75748
|
+
if (dbValue == null)
|
|
75749
|
+
return true;
|
|
75750
|
+
return !sameNumber(dbValue, (process.env[v.name] ?? "").trim());
|
|
75751
|
+
});
|
|
75722
75752
|
const names = set.map((v) => v.name).join(", ");
|
|
75723
|
-
const
|
|
75753
|
+
const isAre = set.length === 1 ? "is" : "are";
|
|
75754
|
+
if (pending.length === 0) {
|
|
75755
|
+
return {
|
|
75756
|
+
name: "retired env",
|
|
75757
|
+
status: "skipped",
|
|
75758
|
+
detail: `${names} ${isAre} set in your .env but no longer read — the store already has the same value.`,
|
|
75759
|
+
hint: "Safe to delete those lines; nothing reads them."
|
|
75760
|
+
};
|
|
75761
|
+
}
|
|
75762
|
+
const moves = pending.map((v) => `cerefox config set ${v.configKey} ${(process.env[v.name] ?? "").trim()}`).join(`
|
|
75763
|
+
`);
|
|
75764
|
+
const prunedWasDisabled = pending.some((v) => v.configKey.startsWith("version_"));
|
|
75724
75765
|
return {
|
|
75725
75766
|
name: "retired env",
|
|
75726
75767
|
status: "warn",
|
|
75727
|
-
detail: `${names} ${
|
|
75768
|
+
detail: `${names} ${isAre} set in your .env but ${isAre} no longer read ` + `(moved into the database in ${set[0].since}).`,
|
|
75728
75769
|
hint: "These are server-side settings, so they now live in the database and one value " + `governs every client.
|
|
75729
75770
|
` + (prunedWasDisabled ? `Your data is safe: the upgrade switched version pruning OFF and deleted nothing.
|
|
75730
75771
|
` : "") + `To carry your settings over, run:
|
|
@@ -82454,9 +82495,9 @@ var CONFIG_CATALOG = [
|
|
|
82454
82495
|
},
|
|
82455
82496
|
{
|
|
82456
82497
|
key: "version_retention_hours",
|
|
82457
|
-
description: "How long to keep archived versions of a document. The most recent version and any explicitly archived one are always kept, whatever this says.",
|
|
82498
|
+
description: "How long to keep archived versions of a document (hours). The most recent version and any explicitly archived one are always kept, whatever this says.",
|
|
82458
82499
|
kind: "number",
|
|
82459
|
-
defaultValue: "
|
|
82500
|
+
defaultValue: "120",
|
|
82460
82501
|
min: 0,
|
|
82461
82502
|
group: "Retention"
|
|
82462
82503
|
},
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
-- 0017_retention_default_120h.sql — raise the built-in version-retention window
|
|
2
|
+
-- from 48 to 120 hours.
|
|
3
|
+
--
|
|
4
|
+
-- 48 hours does not survive a weekend: a bad edit made on Friday afternoon is
|
|
5
|
+
-- unrecoverable by Monday morning, which is exactly when someone would look for
|
|
6
|
+
-- it. 120 hours (5 days) covers that gap while still bounding growth — versions
|
|
7
|
+
-- carry embeddings and are the largest rows in a busy store.
|
|
8
|
+
--
|
|
9
|
+
-- This is only the FALLBACK used when the store has expressed no preference. An
|
|
10
|
+
-- explicit `version_retention_hours` in cerefox_config is untouched, as is the
|
|
11
|
+
-- `version_cleanup_enabled=false` fail-safe that migration 0016 seeds on
|
|
12
|
+
-- existing stores.
|
|
13
|
+
--
|
|
14
|
+
-- Unchanged: cleanup never deletes the most recent version, nor any version
|
|
15
|
+
-- marked `archived`.
|
|
16
|
+
--
|
|
17
|
+
-- The value lives in `rpcs.sql`, which `cerefox server deploy` re-applies. This
|
|
18
|
+
-- migration exists so the schema version moves and operators are told to
|
|
19
|
+
-- redeploy.
|
|
20
|
+
--
|
|
21
|
+
-- Idempotent: safe to re-run.
|
|
22
|
+
|
|
23
|
+
DO $$
|
|
24
|
+
BEGIN
|
|
25
|
+
RAISE NOTICE
|
|
26
|
+
'Migration 0017: default version retention is now 120 hours (was 48). '
|
|
27
|
+
'An explicit version_retention_hours setting is unaffected.';
|
|
28
|
+
END $$;
|
|
@@ -941,7 +941,9 @@ $$;
|
|
|
941
941
|
-- p_document_id : Document to snapshot
|
|
942
942
|
-- p_source : How the update was triggered ('file','paste','agent','manual')
|
|
943
943
|
-- p_retention_hours : Retention window in hours. NULL (default) reads
|
|
944
|
-
-- `version_retention_hours` from cerefox_config, else
|
|
944
|
+
-- `version_retention_hours` from cerefox_config, else 120
|
|
945
|
+
-- (5 days — long enough that a bad edit made on a Friday
|
|
946
|
+
-- is still recoverable on Monday; 48h was not).
|
|
945
947
|
-- A non-NULL value overrides the store policy for this
|
|
946
948
|
-- call only.
|
|
947
949
|
--
|
|
@@ -982,7 +984,7 @@ DECLARE
|
|
|
982
984
|
-- data. Same COALESCE(param, config, default) shape the retrieval tunables
|
|
983
985
|
-- already use.
|
|
984
986
|
v_retention INT := COALESCE(p_retention_hours,
|
|
985
|
-
cerefox_config_int('version_retention_hours',
|
|
987
|
+
cerefox_config_int('version_retention_hours', 120));
|
|
986
988
|
v_cleanup BOOLEAN := COALESCE(p_cleanup_enabled,
|
|
987
989
|
cerefox_config_bool('version_cleanup_enabled', TRUE));
|
|
988
990
|
BEGIN
|
|
@@ -2323,7 +2325,7 @@ SET search_path = public, pg_catalog
|
|
|
2323
2325
|
AS $$
|
|
2324
2326
|
-- Keep in lockstep with the `@version:` marker in schema.sql (cut_release.ts
|
|
2325
2327
|
-- enforces it). Bump whenever schema.sql OR rpcs.sql changes.
|
|
2326
|
-
SELECT '0.10.
|
|
2328
|
+
SELECT '0.10.4'::TEXT;
|
|
2327
2329
|
$$;
|
|
2328
2330
|
|
|
2329
2331
|
-- ── cerefox_content_format_stats ─────────────────────────────────────────────
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
-- Requires extensions: vector (pgvector), uuid-ossp
|
|
6
6
|
-- These are enabled at the top of db_deploy.py before this file is applied.
|
|
7
7
|
--
|
|
8
|
-
-- @version: 0.10.
|
|
8
|
+
-- @version: 0.10.4
|
|
9
9
|
-- The `@version` marker above is read by the schema-version-mismatch banner
|
|
10
10
|
-- (see /api/v1/schema-version). Bump it whenever schema.sql OR rpcs.sql
|
|
11
11
|
-- changes in a way that requires `cerefox server deploy` to be re-run —
|
|
@@ -140,10 +140,10 @@ This handles intermittent OpenAI API errors (500s) that would otherwise cause se
|
|
|
140
140
|
|
|
141
141
|
> **Which paths read these?** Client-side tunables in this section are read
|
|
142
142
|
> from *your* `.env` by the **CLI**, the **local MCP server**, and `cerefox
|
|
143
|
-
> web`. Since
|
|
144
|
-
>
|
|
145
|
-
>
|
|
146
|
-
> the
|
|
143
|
+
> web`. **Since v1.1.0 these are database settings only** — the `CEREFOX_*`
|
|
144
|
+
> variables and the equivalent Supabase **Function secrets** are no longer read,
|
|
145
|
+
> on any path. One `cerefox config set` (or the Settings page) governs the CLI,
|
|
146
|
+
> the web UI, local and remote MCP, and the Edge Functions alike. Per-call
|
|
147
147
|
> parameters (`min_score`, `min_term_coverage`, `alpha` on `cerefox_search`)
|
|
148
148
|
> override both. A single setting that governs every path without secrets is
|
|
149
149
|
> tracked as issue #133 (DB-backed config).
|
|
@@ -248,7 +248,7 @@ Cerefox automatically archives previous document content whenever a document is
|
|
|
248
248
|
When a document's content changes during ingestion, Cerefox calls the `cerefox_snapshot_version` database function before writing new chunks. This function:
|
|
249
249
|
1. Creates a version record in `cerefox_document_versions`
|
|
250
250
|
2. Moves all current chunks to that version (by setting their `version_id`)
|
|
251
|
-
3. If `
|
|
251
|
+
3. If `version_cleanup_enabled` is `true`, deletes versions older than `version_retention_hours` — skipping archived versions and always keeping the most recent one. Both are `cerefox_config` settings (v1.1.0+); before that they came from each client's environment.
|
|
252
252
|
|
|
253
253
|
Metadata-only updates (same content, different title or project) do **not** create a new version.
|
|
254
254
|
|
|
@@ -413,11 +413,10 @@ Two things the page does deliberately:
|
|
|
413
413
|
`require_requestor_identity` starts rejecting agents that don't identify
|
|
414
414
|
themselves. Neither is a bare toggle — you get a dialog naming the
|
|
415
415
|
consequence first.
|
|
416
|
-
- **
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
server isn't using. The page never edits `.env` — that file holds your
|
|
416
|
+
- **Retired `.env` lines are flagged.** If a variable that used to control a
|
|
417
|
+
setting is still present in the server's environment, the row says so — it no
|
|
418
|
+
longer does anything, and the value shown is what actually runs. The page
|
|
419
|
+
never edits `.env` — that file holds your
|
|
421
420
|
service-role key, OpenAI key and database password, and the server only reads
|
|
422
421
|
it at boot.
|
|
423
422
|
|
|
@@ -62,7 +62,9 @@ data volume, so it survives `cerefox-local upgrade`.
|
|
|
62
62
|
|
|
63
63
|
> Scores are calibrated per embedder: with the local model the default semantic
|
|
64
64
|
> threshold is **0.6** (vs 0.5 for OpenAI) because nomic scores unrelated text
|
|
65
|
-
> higher.
|
|
65
|
+
> higher. The container seeds `min_search_score = 0.6` into its own config at
|
|
66
|
+
> first boot; change it with `cerefox config set min_search_score <value>` or the
|
|
67
|
+
> Settings page, or override a single query with `--min-score`.
|
|
66
68
|
|
|
67
69
|
---
|
|
68
70
|
|
package/docs/guides/upgrading.md
CHANGED
|
@@ -20,18 +20,55 @@ to re-run.
|
|
|
20
20
|
|
|
21
21
|
## End-user upgrade
|
|
22
22
|
|
|
23
|
-
>
|
|
24
|
-
> releases let you postpone the server step. This one should not be postponed:
|
|
25
|
-
> schema **0.10.2** fixes a defect where a stale or blank
|
|
26
|
-
> `expected_content_hash` raised its conflict under a SQLSTATE that infrastructure
|
|
27
|
-
> treats as *retryable*. Because the conflict is permanent, retry-aware layers
|
|
28
|
-
> could replay the request without limit — one report reached ~47 million calls
|
|
29
|
-
> over about a day and exhausted the project's disk-IO budget. The fix lives in
|
|
30
|
-
> `rpcs.sql`, so **upgrading the client alone does not apply it**; the database
|
|
31
|
-
> keeps the old behaviour until the RPCs are redeployed. `cerefox doctor` will
|
|
32
|
-
> say so, and the web UI shows a banner.
|
|
23
|
+
> ### Upgrading to v1.1.0 — `cerefox server deploy` is required
|
|
33
24
|
>
|
|
34
|
-
>
|
|
25
|
+
> Most releases let you postpone the server step. **This one does not.** Until
|
|
26
|
+
> you redeploy, the client and the database disagree in ways that cost data:
|
|
27
|
+
>
|
|
28
|
+
> - The conflict fix that stops [unbounded retry
|
|
29
|
+
> storms](../../CHANGELOG.md) lives in `rpcs.sql`, so upgrading the client
|
|
30
|
+
> alone leaves the defect live.
|
|
31
|
+
> - The v1.1.0 client stops sending retention and retrieval settings and expects
|
|
32
|
+
> the **server** to resolve them from `cerefox_config`. An older server does
|
|
33
|
+
> not read those keys, so a store configured to "keep every version" silently
|
|
34
|
+
> reverts to pruning — quiet data loss.
|
|
35
|
+
>
|
|
36
|
+
> Because of that second point, v1.1.0 raises the **minimum supported schema**
|
|
37
|
+
> to `0.10.3` — the version where the RPCs began resolving those settings from
|
|
38
|
+
> `cerefox_config`. (The release ships schema `0.10.4`; the extra step only
|
|
39
|
+
> changed a default value, which degrades gracefully, so it is not part of the
|
|
40
|
+
> minimum. A schema bump does **not** normally raise the minimum.) What the
|
|
41
|
+
> minimum actually gates:
|
|
42
|
+
>
|
|
43
|
+
> | Surface | Below the minimum |
|
|
44
|
+
> |---|---|
|
|
45
|
+
> | `cerefox web` | **Refuses to start** — "Refusing to start: the deployed Cerefox server is incompatible with this client" |
|
|
46
|
+
> | `cerefox doctor` | Reports an error and exits non-zero |
|
|
47
|
+
> | Web UI banner | Red, blocking |
|
|
48
|
+
> | CLI commands (`search`, `document`, `ingest`, …) | **Keep working** |
|
|
49
|
+
> | MCP servers (local and remote) | **Keep working** |
|
|
50
|
+
>
|
|
51
|
+
> So the practical effect is: **your web UI is unavailable between upgrading the
|
|
52
|
+
> client and running `server deploy`.** Run them together and the window is
|
|
53
|
+
> seconds. Nothing is destroyed by being in that state — it exists to stop you
|
|
54
|
+
> operating a mismatched pair for days without noticing.
|
|
55
|
+
>
|
|
56
|
+
> **After redeploying**, carry over any settings you had tuned in `.env`.
|
|
57
|
+
> `cerefox doctor` lists them with the exact commands, and stops mentioning them
|
|
58
|
+
> once the store matches. The five retired variables are
|
|
59
|
+
> `CEREFOX_MIN_SEARCH_SCORE`, `CEREFOX_MIN_TERM_COVERAGE`, `CEREFOX_SEARCH_ALPHA`,
|
|
60
|
+
> `CEREFOX_VERSION_RETENTION_HOURS`, `CEREFOX_VERSION_CLEANUP_ENABLED`.
|
|
61
|
+
>
|
|
62
|
+
> **Version pruning is switched off on existing stores** by migration 0016, so
|
|
63
|
+
> the change above cannot quietly discard history. Nothing is deleted. Re-enable
|
|
64
|
+
> when you have chosen a policy:
|
|
65
|
+
> `cerefox config set version_cleanup_enabled true`. The default retention
|
|
66
|
+
> window is now 120 hours (was 48) — long enough that a Friday mistake is still
|
|
67
|
+
> recoverable on Monday.
|
|
68
|
+
>
|
|
69
|
+
> **Cerefox Local** users need no separate step: the schema ships inside the
|
|
70
|
+
> image, so `cerefox-local upgrade` moves both halves together.
|
|
71
|
+
|
|
35
72
|
|
|
36
73
|
```bash
|
|
37
74
|
cerefox self-update # or: re-run the installer, or bun/npm update -g @cerefox/memory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerefox/memory",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Cerefox — user-owned shared memory for AI agents. CLI + stdio MCP server + web UI + ingestion for a knowledge base on your own Supabase project (or fully self-hosted with Cerefox Local).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/fstamatelopoulos/cerefox",
|