@cerefox/memory 1.2.0 → 1.2.1
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
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.2.
|
|
7441
|
+
var PKG_VERSION = "1.2.1";
|
|
7442
7442
|
var init_meta = () => {};
|
|
7443
7443
|
|
|
7444
7444
|
// ../../_shared/config/paths.ts
|
|
@@ -75699,7 +75699,7 @@ import { homedir as homedir6 } from "node:os";
|
|
|
75699
75699
|
import { join as join9 } from "node:path";
|
|
75700
75700
|
|
|
75701
75701
|
// ../../_shared/ef-meta/index.ts
|
|
75702
|
-
var EF_VERSION = "1.2.
|
|
75702
|
+
var EF_VERSION = "1.2.1";
|
|
75703
75703
|
var EF_LAST_CHANGED = "1.2.0";
|
|
75704
75704
|
|
|
75705
75705
|
// src/cli/util/checks.ts
|
|
@@ -76927,6 +76927,7 @@ class IngestionPipeline {
|
|
|
76927
76927
|
text,
|
|
76928
76928
|
title,
|
|
76929
76929
|
source = "paste",
|
|
76930
|
+
sourceLabel,
|
|
76930
76931
|
sourcePath: sourcePathOpt,
|
|
76931
76932
|
projectName,
|
|
76932
76933
|
projectId,
|
|
@@ -76957,6 +76958,7 @@ class IngestionPipeline {
|
|
|
76957
76958
|
text,
|
|
76958
76959
|
title,
|
|
76959
76960
|
source,
|
|
76961
|
+
sourceLabel,
|
|
76960
76962
|
projectIds: fullSetResolved,
|
|
76961
76963
|
metadata,
|
|
76962
76964
|
author,
|
|
@@ -76995,6 +76997,7 @@ class IngestionPipeline {
|
|
|
76995
76997
|
text,
|
|
76996
76998
|
title,
|
|
76997
76999
|
source,
|
|
77000
|
+
sourceLabel,
|
|
76998
77001
|
projectIds: fullSetResolved,
|
|
76999
77002
|
metadata,
|
|
77000
77003
|
author,
|
|
@@ -77082,6 +77085,7 @@ class IngestionPipeline {
|
|
|
77082
77085
|
text,
|
|
77083
77086
|
title,
|
|
77084
77087
|
source = "manual",
|
|
77088
|
+
sourceLabel,
|
|
77085
77089
|
projectId,
|
|
77086
77090
|
projectIds,
|
|
77087
77091
|
metadata,
|
|
@@ -77198,7 +77202,7 @@ class IngestionPipeline {
|
|
|
77198
77202
|
contentFormat: CONTENT_FORMAT_BLIND_STITCH,
|
|
77199
77203
|
author,
|
|
77200
77204
|
authorType,
|
|
77201
|
-
sourceLabel: source,
|
|
77205
|
+
sourceLabel: sourceLabel ?? source,
|
|
77202
77206
|
expectedContentHash: expectedContentHash ?? (forceRechunk && contentUnchanged ? existing.content_hash : null),
|
|
77203
77207
|
lastWriteWins
|
|
77204
77208
|
});
|
|
@@ -78375,7 +78379,8 @@ async function action28(options) {
|
|
|
78375
78379
|
text: doc2.full_content,
|
|
78376
78380
|
title: doc2.doc_title,
|
|
78377
78381
|
documentId: id,
|
|
78378
|
-
source:
|
|
78382
|
+
source: doc2.doc_source,
|
|
78383
|
+
sourceLabel: "migrate-format",
|
|
78379
78384
|
author,
|
|
78380
78385
|
authorType,
|
|
78381
78386
|
expectedContentHash: doc2.content_hash,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
-- 0020_ingest_preserves_source.sql — stop content updates from silently
|
|
2
|
+
-- overwriting a document's provenance (#191, reported by @tdebasis).
|
|
3
|
+
--
|
|
4
|
+
-- `cerefox_ingest_document`'s UPDATE branch assigned the source column
|
|
5
|
+
-- unconditionally:
|
|
6
|
+
--
|
|
7
|
+
-- source = p_source -- unconditional
|
|
8
|
+
-- source_path = COALESCE(p_source_path, source_path) -- preserved
|
|
9
|
+
-- metadata = COALESCE(p_metadata, metadata) -- preserved
|
|
10
|
+
--
|
|
11
|
+
-- with `p_source TEXT DEFAULT 'agent'` in the signature. The two columns either
|
|
12
|
+
-- side of it already implement the "absent means keep" rule — metadata got it in
|
|
13
|
+
-- v0.11.1, after content updates without metadata were found to be wiping tags.
|
|
14
|
+
-- source was left out of that fix.
|
|
15
|
+
--
|
|
16
|
+
-- Two consequences, both silent:
|
|
17
|
+
--
|
|
18
|
+
-- * Any caller that updates a document without passing p_source rewrites that
|
|
19
|
+
-- document's source to the parameter default 'agent'. Nothing in the RPC's
|
|
20
|
+
-- output, the audit entry, or the version row records that it happened: the
|
|
21
|
+
-- audit operation is 'update-content', and version rows carry their own
|
|
22
|
+
-- source label rather than the document's prior value.
|
|
23
|
+
-- * `cerefox server migrate-format` hit this at corpus scale. It hardcoded
|
|
24
|
+
-- source: "migrate-format" for every document it converted, even though it
|
|
25
|
+
-- reads each document first and cerefox_get_document returns doc_source. A
|
|
26
|
+
-- format conversion is not a change of origin, so every converted document
|
|
27
|
+
-- lost the label it came in with.
|
|
28
|
+
--
|
|
29
|
+
-- Reported impact on one store: 1,317 documents rewritten to 'migrate-format' in
|
|
30
|
+
-- a single run, 201 of which carried no metadata.source_agent and so had no
|
|
31
|
+
-- other provenance field to fall back on. A second store on the same instance
|
|
32
|
+
-- independently reported 509 of 553. Recovery required a point-in-time dump from
|
|
33
|
+
-- before the run.
|
|
34
|
+
--
|
|
35
|
+
-- Fix: p_source defaults to NULL and the UPDATE branch coalesces, matching
|
|
36
|
+
-- metadata and source_path exactly. The CREATE path keeps 'agent' as its
|
|
37
|
+
-- concrete fallback via COALESCE(p_source, 'agent'), so new documents are
|
|
38
|
+
-- unchanged. An explicit value still relabels, so deliberate callers are
|
|
39
|
+
-- unaffected.
|
|
40
|
+
--
|
|
41
|
+
-- Note the distinction this preserves: p_source is the document's origin, while
|
|
42
|
+
-- p_source_label records how a particular write was triggered and is stored on
|
|
43
|
+
-- the version row. migrate-format now passes the document's own source for the
|
|
44
|
+
-- former and keeps "migrate-format" for the latter, so the version history still
|
|
45
|
+
-- shows which run performed the conversion.
|
|
46
|
+
--
|
|
47
|
+
-- Lives in rpcs.sql, which `cerefox server deploy` re-applies. This migration
|
|
48
|
+
-- exists so the schema version moves and operators are told to redeploy.
|
|
49
|
+
--
|
|
50
|
+
-- Idempotent: safe to re-run.
|
|
51
|
+
|
|
52
|
+
DO $$
|
|
53
|
+
BEGIN
|
|
54
|
+
RAISE NOTICE
|
|
55
|
+
'Migration 0020: cerefox_ingest_document now preserves a document''s '
|
|
56
|
+
'source when p_source is omitted. Before this, any content update '
|
|
57
|
+
'without an explicit source silently rewrote provenance to ''agent'', '
|
|
58
|
+
'and migrate-format relabelled every document it converted (#191).';
|
|
59
|
+
END $$;
|
|
@@ -1258,7 +1258,12 @@ $$;
|
|
|
1258
1258
|
--
|
|
1259
1259
|
-- Parameters:
|
|
1260
1260
|
-- p_document_id : NULL for create, UUID for update
|
|
1261
|
-
-- p_title,
|
|
1261
|
+
-- p_title, p_source_path, p_content_hash : document fields
|
|
1262
|
+
-- p_source : origin label. NULL = "not provided" → create uses
|
|
1263
|
+
-- 'agent', update keeps the existing source (#191). Pass a
|
|
1264
|
+
-- value explicitly to relabel. Distinct from
|
|
1265
|
+
-- p_source_label, which records how THIS write was
|
|
1266
|
+
-- triggered and is stored on the version row.
|
|
1262
1267
|
-- p_metadata : JSONB metadata. NULL = "not provided" → create uses '{}',
|
|
1263
1268
|
-- update keeps the existing metadata (v0.11.1). Pass '{}'
|
|
1264
1269
|
-- explicitly to clear all metadata.
|
|
@@ -1291,7 +1296,10 @@ DROP FUNCTION IF EXISTS cerefox_ingest_document(UUID, TEXT, TEXT, TEXT, TEXT, JS
|
|
|
1291
1296
|
CREATE FUNCTION cerefox_ingest_document(
|
|
1292
1297
|
p_document_id UUID DEFAULT NULL,
|
|
1293
1298
|
p_title TEXT DEFAULT 'Untitled',
|
|
1294
|
-
|
|
1299
|
+
-- NULL = "not provided": create uses 'agent', update KEEPS the existing
|
|
1300
|
+
-- source (#191 — a content update without a source used to overwrite the
|
|
1301
|
+
-- document's provenance). Pass a value to relabel deliberately.
|
|
1302
|
+
p_source TEXT DEFAULT NULL,
|
|
1295
1303
|
p_source_path TEXT DEFAULT NULL,
|
|
1296
1304
|
p_content_hash TEXT DEFAULT '',
|
|
1297
1305
|
-- NULL = "not provided": create uses '{}', update KEEPS existing metadata
|
|
@@ -1445,9 +1453,11 @@ BEGIN
|
|
|
1445
1453
|
|
|
1446
1454
|
-- Update document record. metadata: NULL = keep existing (v0.11.1 —
|
|
1447
1455
|
-- a content update without metadata must not wipe the document's tags).
|
|
1456
|
+
-- source: same rule, same reason (#191 — a content update without a
|
|
1457
|
+
-- source must not wipe the document's provenance).
|
|
1448
1458
|
UPDATE cerefox_documents SET
|
|
1449
1459
|
title = p_title,
|
|
1450
|
-
source = p_source,
|
|
1460
|
+
source = COALESCE(p_source, source),
|
|
1451
1461
|
source_path = COALESCE(p_source_path, source_path),
|
|
1452
1462
|
content_hash = p_content_hash,
|
|
1453
1463
|
metadata = COALESCE(p_metadata, metadata),
|
|
@@ -1465,7 +1475,7 @@ BEGIN
|
|
|
1465
1475
|
title, source, source_path, content_hash, metadata,
|
|
1466
1476
|
chunk_count, total_chars, review_status
|
|
1467
1477
|
) VALUES (
|
|
1468
|
-
p_title, p_source, p_source_path, p_content_hash, COALESCE(p_metadata, '{}'::JSONB),
|
|
1478
|
+
p_title, COALESCE(p_source, 'agent'), p_source_path, p_content_hash, COALESCE(p_metadata, '{}'::JSONB),
|
|
1469
1479
|
v_chunk_count, v_total_chars, v_status
|
|
1470
1480
|
)
|
|
1471
1481
|
RETURNING id INTO v_doc_id;
|
|
@@ -2333,7 +2343,7 @@ SET search_path = public, pg_catalog
|
|
|
2333
2343
|
AS $$
|
|
2334
2344
|
-- Keep in lockstep with the `@version:` marker in schema.sql (cut_release.ts
|
|
2335
2345
|
-- enforces it). Bump whenever schema.sql OR rpcs.sql changes.
|
|
2336
|
-
SELECT '0.10.
|
|
2346
|
+
SELECT '0.10.6'::TEXT;
|
|
2337
2347
|
$$;
|
|
2338
2348
|
|
|
2339
2349
|
-- ── 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.6
|
|
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 —
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerefox/memory",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
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",
|