@cerefox/memory 1.0.0-rc.4 → 1.0.1-beta.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/README.md +1 -1
- package/dist/bin/cerefox.js +425 -161
- package/dist/frontend/assets/index-6DS5ujj2.js.map +1 -1
- package/dist/server-assets/db/migrations/0013_explicit_grants.sql +32 -0
- package/dist/server-assets/db/rpcs.sql +1 -1
- package/dist/server-assets/db/schema.sql +31 -1
- package/docs/guides/configuration.md +7 -4
- package/docs/guides/migration-1.0.md +2 -5
- package/docs/guides/operational-cost.md +5 -2
- package/package.json +2 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
-- 0013_explicit_grants.sql — issue #26: explicit Data API grants for service_role
|
|
2
|
+
-- (Supabase implicit-grant removal). Idempotent; safe on existing deployments.
|
|
3
|
+
|
|
4
|
+
-- ── Explicit Data API grants (issue #26; schema 0.8.2) ─────────────────────────
|
|
5
|
+
-- Supabase is removing the implicit privileges the Data API roles get on
|
|
6
|
+
-- `public` tables (default for projects created after 2026-05-30; enforced on
|
|
7
|
+
-- existing projects 2026-10-30). Without explicit GRANTs a table is invisible
|
|
8
|
+
-- to PostgREST even for service_role (42501). Cerefox grants ONLY service_role
|
|
9
|
+
-- (the CLI / MCP / web all use service-role-equivalent keys; anon/authenticated
|
|
10
|
+
-- deliberately get nothing, matching the RPC EXECUTE posture from iter-28B).
|
|
11
|
+
-- Guarded: on the local (World B) stack this file deploys BEFORE roles.sql
|
|
12
|
+
-- creates service_role, so missing-role must be a no-op (roles.sql re-runs the
|
|
13
|
+
-- grants implicitly via its own PostgREST wiring; the next deploy picks them up).
|
|
14
|
+
DO $$
|
|
15
|
+
DECLARE t TEXT;
|
|
16
|
+
BEGIN
|
|
17
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'service_role') THEN
|
|
18
|
+
GRANT USAGE ON SCHEMA public TO service_role;
|
|
19
|
+
FOREACH t IN ARRAY ARRAY[
|
|
20
|
+
'cerefox_projects', 'cerefox_documents', 'cerefox_document_versions',
|
|
21
|
+
'cerefox_audit_log', 'cerefox_document_projects', 'cerefox_chunks',
|
|
22
|
+
'cerefox_migrations', 'cerefox_config', 'cerefox_usage_log'
|
|
23
|
+
] LOOP
|
|
24
|
+
IF to_regclass('public.' || t) IS NOT NULL THEN
|
|
25
|
+
EXECUTE format('GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE public.%I TO service_role', t);
|
|
26
|
+
END IF;
|
|
27
|
+
END LOOP;
|
|
28
|
+
-- Future cerefox_* tables created by the deploying role keep working.
|
|
29
|
+
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
|
30
|
+
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO service_role;
|
|
31
|
+
END IF;
|
|
32
|
+
END $$;
|
|
@@ -1776,7 +1776,7 @@ SET search_path = public, pg_catalog
|
|
|
1776
1776
|
AS $$
|
|
1777
1777
|
-- Keep in lockstep with the `@version:` marker in schema.sql (cut_release.ts
|
|
1778
1778
|
-- enforces it). Bump whenever schema.sql OR rpcs.sql changes.
|
|
1779
|
-
SELECT '0.8.
|
|
1779
|
+
SELECT '0.8.2'::TEXT;
|
|
1780
1780
|
$$;
|
|
1781
1781
|
|
|
1782
1782
|
-- ── 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.8.
|
|
8
|
+
-- @version: 0.8.2
|
|
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 —
|
|
@@ -386,3 +386,33 @@ ALTER TABLE cerefox_audit_log ENABLE ROW LEVEL SECURITY;
|
|
|
386
386
|
ALTER TABLE cerefox_migrations ENABLE ROW LEVEL SECURITY;
|
|
387
387
|
ALTER TABLE cerefox_config ENABLE ROW LEVEL SECURITY;
|
|
388
388
|
ALTER TABLE cerefox_usage_log ENABLE ROW LEVEL SECURITY;
|
|
389
|
+
|
|
390
|
+
-- ── Explicit Data API grants (issue #26; schema 0.8.2) ─────────────────────────
|
|
391
|
+
-- Supabase is removing the implicit privileges the Data API roles get on
|
|
392
|
+
-- `public` tables (default for projects created after 2026-05-30; enforced on
|
|
393
|
+
-- existing projects 2026-10-30). Without explicit GRANTs a table is invisible
|
|
394
|
+
-- to PostgREST even for service_role (42501). Cerefox grants ONLY service_role
|
|
395
|
+
-- (the CLI / MCP / web all use service-role-equivalent keys; anon/authenticated
|
|
396
|
+
-- deliberately get nothing, matching the RPC EXECUTE posture from iter-28B).
|
|
397
|
+
-- Guarded: on the local (World B) stack this file deploys BEFORE roles.sql
|
|
398
|
+
-- creates service_role, so missing-role must be a no-op (roles.sql re-runs the
|
|
399
|
+
-- grants implicitly via its own PostgREST wiring; the next deploy picks them up).
|
|
400
|
+
DO $$
|
|
401
|
+
DECLARE t TEXT;
|
|
402
|
+
BEGIN
|
|
403
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'service_role') THEN
|
|
404
|
+
GRANT USAGE ON SCHEMA public TO service_role;
|
|
405
|
+
FOREACH t IN ARRAY ARRAY[
|
|
406
|
+
'cerefox_projects', 'cerefox_documents', 'cerefox_document_versions',
|
|
407
|
+
'cerefox_audit_log', 'cerefox_document_projects', 'cerefox_chunks',
|
|
408
|
+
'cerefox_migrations', 'cerefox_config', 'cerefox_usage_log'
|
|
409
|
+
] LOOP
|
|
410
|
+
IF to_regclass('public.' || t) IS NOT NULL THEN
|
|
411
|
+
EXECUTE format('GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE public.%I TO service_role', t);
|
|
412
|
+
END IF;
|
|
413
|
+
END LOOP;
|
|
414
|
+
-- Future cerefox_* tables created by the deploying role keep working.
|
|
415
|
+
ALTER DEFAULT PRIVILEGES IN SCHEMA public
|
|
416
|
+
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO service_role;
|
|
417
|
+
END IF;
|
|
418
|
+
END $$;
|
|
@@ -118,7 +118,10 @@ This handles intermittent OpenAI API errors (500s) that would otherwise cause se
|
|
|
118
118
|
| Variable | Default | Description |
|
|
119
119
|
|----------|---------|-------------|
|
|
120
120
|
| `CEREFOX_MAX_RESPONSE_BYTES` | `200000` | Maximum bytes in a single search response (local MCP path). See explanation below. |
|
|
121
|
-
| `CEREFOX_MIN_SEARCH_SCORE` | `0.50` | Minimum cosine similarity for hybrid and semantic search results (0.0–1.0). In **hybrid search**, chunks that matched the FTS keyword operator (`@@`) always pass through regardless of their vector score — the threshold only filters vector-only results. In **semantic search**, all results are filtered. The pure **FTS search** mode is unaffected. Increase for stricter precision; decrease for wider recall. |
|
|
121
|
+
| `CEREFOX_MIN_SEARCH_SCORE` | `0.50` (`0.60` with the local embedder) | Minimum cosine similarity for hybrid and semantic search results (0.0–1.0). The default is embedder-aware: nomic scores unrelated text higher than OpenAI, so `CEREFOX_EMBEDDER=local` raises the floor to 0.60. In **hybrid search**, chunks that matched the FTS keyword operator (`@@`) always pass through regardless of their vector score — the threshold only filters vector-only results. In **semantic search**, all results are filtered. The pure **FTS search** mode is unaffected. Increase for stricter precision; decrease for wider recall. |
|
|
122
|
+
| `CEREFOX_EMBED_MAX_INPUT_CHARS` | `20000` | Safety cap on the characters sent to the embedding model per input. The full chunk content is always stored and reconstructed untouched; only the embedding uses the (rare) truncated prefix, so an oversized chunk can never fail an ingest. |
|
|
123
|
+
| `CEREFOX_MODELS_DIR` | `~/.cerefox/models` (in-container: inside the data volume) | Where the local embedder caches downloaded model weights (Cerefox Local; `CEREFOX_EMBEDDER=local`). |
|
|
124
|
+
| `CEREFOX_ONNX_BATCH` | `4` | Texts per local-embedder inference call. Peak memory scales with this; the small default keeps ingest/reindex safe on small Docker VMs. |
|
|
122
125
|
|
|
123
126
|
### Metadata filter
|
|
124
127
|
|
|
@@ -257,9 +260,9 @@ OPENAI_API_KEY=sk-...
|
|
|
257
260
|
# All other settings use defaults
|
|
258
261
|
```
|
|
259
262
|
|
|
260
|
-
> **Fireworks is not wired
|
|
261
|
-
>
|
|
262
|
-
>
|
|
263
|
+
> **Fireworks is not wired yet** — `CEREFOX_EMBEDDER=fireworks` / `CEREFOX_FIREWORKS_*`
|
|
264
|
+
> are documented but currently no-ops. The wired embedders are `openai` (default) and
|
|
265
|
+
> `local` (Cerefox Local only). Fireworks is tracked for a future release.
|
|
263
266
|
|
|
264
267
|
---
|
|
265
268
|
|
|
@@ -4,9 +4,6 @@ Cerefox 1.0.0 is the first stable release. Two changes need attention when you
|
|
|
4
4
|
upgrade an existing Supabase deployment; a third is automatic. **Nothing here
|
|
5
5
|
affects the local/self-hosted (World B) backend.**
|
|
6
6
|
|
|
7
|
-
Pre-releases are published on the `1.0.0-beta.N` line (breaking changes may still
|
|
8
|
-
occur between betas) leading up to `1.0.0`.
|
|
9
|
-
|
|
10
7
|
## 1. Edge Function auth: anon key → Cerefox access token (action required)
|
|
11
8
|
|
|
12
9
|
The legacy Supabase **anon JWT** is no longer accepted for calling Cerefox Edge
|
|
@@ -52,7 +49,7 @@ Claude uses OAuth).
|
|
|
52
49
|
Rotating the token later: `cerefox token rotate` (accepts new + old for zero-downtime),
|
|
53
50
|
then `cerefox token rotate --finalize` once every client is on the new token.
|
|
54
51
|
|
|
55
|
-
## 2. New schema (
|
|
52
|
+
## 2. New schema (→ 0.8.1): document reconstruction fix (redeploy required, no data action)
|
|
56
53
|
|
|
57
54
|
1.0.0 fixes a document-reconstruction bug that could corrupt documents containing large
|
|
58
55
|
tables or blank-line-free paragraphs. It adds a `content_format` column on
|
|
@@ -90,7 +87,7 @@ unaffected — they are not Python and remain the source of truth for the schema
|
|
|
90
87
|
```bash
|
|
91
88
|
cerefox self-update # or: npm install -g @cerefox/memory@latest
|
|
92
89
|
cerefox token generate # change #1: mint + set the access token
|
|
93
|
-
cerefox server deploy # changes #1 + #2: token-gated EFs + schema 0.8.
|
|
90
|
+
cerefox server deploy # changes #1 + #2: token-gated EFs + schema 0.8.1
|
|
94
91
|
cerefox doctor # verify (edge-functions green; content-format ℹ)
|
|
95
92
|
# then: update GPT Actions / remote MCP clients to the token; revoke the anon key
|
|
96
93
|
```
|
|
@@ -142,8 +142,11 @@ embedding costs" below.
|
|
|
142
142
|
|
|
143
143
|
If you want to keep costs as low as possible:
|
|
144
144
|
|
|
145
|
-
- **
|
|
146
|
-
|
|
145
|
+
- **Zero-cost embeddings (Cerefox Local)**: the self-hosted backend can run a local
|
|
146
|
+
embedding model in-container (`CEREFOX_EMBEDDER=local`) — no API key, no per-token
|
|
147
|
+
cost at all. See [setup-local.md](setup-local.md#choose-your-embedder-openai-vs-fully-local).
|
|
148
|
+
- **Cheaper cloud models**: a lower-cost OpenAI-compatible provider (e.g. Fireworks AI)
|
|
149
|
+
is on the roadmap — not yet wired.
|
|
147
150
|
- **Batch ingest, don't re-ingest**: Cerefox deduplicates by content hash — re-ingesting the
|
|
148
151
|
same file twice costs nothing. Only new or changed content triggers embedding calls.
|
|
149
152
|
- **`cerefox server reindex`**: Re-embeds all existing chunks if you switch embedders. Run this once
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerefox/memory",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Cerefox — user-owned shared memory for AI agents.
|
|
3
|
+
"version": "1.0.1-beta.1",
|
|
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",
|
|
7
7
|
"repository": {
|