@cerefox/memory 1.9.0 → 1.9.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.
@@ -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.9.0";
7441
+ var PKG_VERSION = "1.9.1";
7442
7442
  var init_meta = () => {};
7443
7443
 
7444
7444
  // ../../_shared/config/paths.ts
@@ -25802,7 +25802,7 @@ var init_bundled_docs = __esm(() => {
25802
25802
  });
25803
25803
 
25804
25804
  // ../../_shared/ef-meta/index.ts
25805
- var EF_VERSION = "1.9.0", CEREFOX_VERSION = "1.9.0", EF_LAST_CHANGED = "1.9.0";
25805
+ var EF_VERSION = "1.9.1", CEREFOX_VERSION = "1.9.1", EF_LAST_CHANGED = "1.9.0";
25806
25806
  var init_ef_meta = () => {};
25807
25807
 
25808
25808
  // ../../_shared/compatibility/index.ts
@@ -18,7 +18,7 @@
18
18
  * doesn't touch `supabase/functions/` leaves it alone).
19
19
  */
20
20
 
21
- export const EF_VERSION = "1.9.0";
21
+ export const EF_VERSION = "1.9.1";
22
22
 
23
23
  /**
24
24
  * The Cerefox RELEASE version — what `cerefox --version` reports and what npm
@@ -36,7 +36,7 @@ export const EF_VERSION = "1.9.0";
36
36
  * is imported by the Deno Edge Functions, which cannot reach into the npm
37
37
  * package.
38
38
  */
39
- export const CEREFOX_VERSION = "1.9.0";
39
+ export const CEREFOX_VERSION = "1.9.1";
40
40
 
41
41
  /**
42
42
  * The most recent version whose EF-side SOURCE actually changed (#127).
@@ -0,0 +1,105 @@
1
+ -- Migration 0029 — fix cerefox_update_project's description-change audit
2
+ -- (schema 0.14.1)
3
+ --
4
+ -- v1.9.0's cerefox_update_project appended the audit-diff fragment with
5
+ -- `v_changes || 'description changed'`; Postgres resolves the untyped
6
+ -- literal via the array||array overload and raises `malformed array
7
+ -- literal`, rolling back EVERY project edit that changes a description
8
+ -- (rename-only edits worked — their concatenation is typed TEXT). Found
9
+ -- live in the v1.9.0 staging dress rehearsal before any production
10
+ -- deployment. The fix is array_append on both branches.
11
+ --
12
+ -- The full corrected body ships inside this migration (repair-path closure,
13
+ -- as 0027/0028), plus the same ACL lockdown 0028 gave the original.
14
+ -- Re-runnable.
15
+
16
+ DROP FUNCTION IF EXISTS cerefox_update_project(UUID, TEXT, TEXT, TEXT, TEXT);
17
+
18
+ CREATE FUNCTION cerefox_update_project(
19
+ p_project_id UUID,
20
+ -- NULL = keep the current value (the #191/#204 "NULL means not provided"
21
+ -- convention). An explicit empty name is rejected.
22
+ p_name TEXT DEFAULT NULL,
23
+ p_description TEXT DEFAULT NULL,
24
+ p_author TEXT DEFAULT 'unknown',
25
+ p_author_type TEXT DEFAULT 'user'
26
+ )
27
+ RETURNS TABLE (
28
+ project_id UUID,
29
+ project_name TEXT,
30
+ project_description TEXT,
31
+ created_at TIMESTAMPTZ,
32
+ updated_at TIMESTAMPTZ
33
+ )
34
+ LANGUAGE plpgsql
35
+ SECURITY DEFINER
36
+ SET search_path = public, pg_catalog
37
+ AS $$
38
+ DECLARE
39
+ v_old cerefox_projects%ROWTYPE;
40
+ v_new cerefox_projects%ROWTYPE;
41
+ v_changes TEXT[] := '{}';
42
+ BEGIN
43
+ IF p_name IS NULL AND p_description IS NULL THEN
44
+ RAISE EXCEPTION 'Nothing to update: pass p_name and/or p_description' USING ERRCODE = '22023';
45
+ END IF;
46
+ IF p_name IS NOT NULL AND NULLIF(BTRIM(p_name), '') IS NULL THEN
47
+ RAISE EXCEPTION 'Project name cannot be empty' USING ERRCODE = '22023';
48
+ END IF;
49
+
50
+ SELECT p.* INTO v_old FROM cerefox_projects p WHERE p.id = p_project_id FOR UPDATE;
51
+ IF NOT FOUND THEN
52
+ RAISE EXCEPTION 'Project not found: %', p_project_id USING ERRCODE = '22023';
53
+ END IF;
54
+
55
+ UPDATE cerefox_projects SET
56
+ name = COALESCE(BTRIM(p_name), name),
57
+ description = COALESCE(p_description, description),
58
+ updated_at = NOW()
59
+ WHERE id = p_project_id
60
+ RETURNING * INTO v_new;
61
+
62
+ -- The trail records what actually changed, not which arguments arrived.
63
+ -- array_append, NOT `||`: with an untyped string literal on the right,
64
+ -- `TEXT[] || 'literal'` resolves to the array||array overload and dies
65
+ -- with `malformed array literal` — found LIVE on staging (v1.9.0; every
66
+ -- description-only edit failed; the rename branch only survived because
67
+ -- its parenthesized concatenation is typed TEXT).
68
+ IF v_new.name <> v_old.name THEN
69
+ v_changes := array_append(v_changes, 'renamed ''' || v_old.name || ''' → ''' || v_new.name || '''');
70
+ END IF;
71
+ IF COALESCE(v_new.description, '') <> COALESCE(v_old.description, '') THEN
72
+ v_changes := array_append(v_changes, 'description changed');
73
+ END IF;
74
+
75
+ PERFORM cerefox_create_audit_entry(
76
+ p_operation := 'project-edit',
77
+ p_author := p_author,
78
+ p_author_type := p_author_type,
79
+ p_description := 'Project ''' || v_new.name || ''' edited ('
80
+ || COALESCE(NULLIF(array_to_string(v_changes, '; '), ''), 'no-op') || ')'
81
+ );
82
+ RETURN QUERY SELECT v_new.id, v_new.name, v_new.description,
83
+ v_new.created_at, v_new.updated_at;
84
+ END;
85
+ $$;
86
+
87
+ DO $$
88
+ DECLARE
89
+ r TEXT;
90
+ BEGIN
91
+ REVOKE EXECUTE ON FUNCTION cerefox_update_project(UUID, TEXT, TEXT, TEXT, TEXT) FROM PUBLIC;
92
+ FOREACH r IN ARRAY ARRAY['anon', 'authenticated'] LOOP
93
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = r) THEN
94
+ EXECUTE format('REVOKE EXECUTE ON FUNCTION cerefox_update_project(UUID, TEXT, TEXT, TEXT, TEXT) FROM %I', r);
95
+ END IF;
96
+ END LOOP;
97
+ IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'service_role') THEN
98
+ GRANT EXECUTE ON FUNCTION cerefox_update_project(UUID, TEXT, TEXT, TEXT, TEXT) TO service_role;
99
+ END IF;
100
+ END $$;
101
+
102
+ DO $$
103
+ BEGIN
104
+ RAISE NOTICE 'Migration 0029: fixed the project-edit description audit (array_append; description-only edits no longer fail).';
105
+ END $$;
@@ -2118,11 +2118,16 @@ BEGIN
2118
2118
  RETURNING * INTO v_new;
2119
2119
 
2120
2120
  -- The trail records what actually changed, not which arguments arrived.
2121
+ -- array_append, NOT `||`: with an untyped string literal on the right,
2122
+ -- `TEXT[] || 'literal'` resolves to the array||array overload and dies
2123
+ -- with `malformed array literal` — found LIVE on staging (v1.9.0; every
2124
+ -- description-only edit failed; the rename branch only survived because
2125
+ -- its parenthesized concatenation is typed TEXT).
2121
2126
  IF v_new.name <> v_old.name THEN
2122
- v_changes := v_changes || ('renamed ''' || v_old.name || ''' → ''' || v_new.name || '''');
2127
+ v_changes := array_append(v_changes, 'renamed ''' || v_old.name || ''' → ''' || v_new.name || '''');
2123
2128
  END IF;
2124
2129
  IF COALESCE(v_new.description, '') <> COALESCE(v_old.description, '') THEN
2125
- v_changes := v_changes || 'description changed';
2130
+ v_changes := array_append(v_changes, 'description changed');
2126
2131
  END IF;
2127
2132
 
2128
2133
  PERFORM cerefox_create_audit_entry(
@@ -3012,7 +3017,7 @@ AS $$
3012
3017
  -- 0.11.0 supersedes 0.10.6 (v1.2.1, #191): this branch carries that fix plus
3013
3018
  -- the partial-edit surface, and both migrations (0019, 0020) are in the
3014
3019
  -- sequence, so a store deploying this gets everything from both lines.
3015
- SELECT '0.14.0'::TEXT;
3020
+ SELECT '0.14.1'::TEXT;
3016
3021
  $$;
3017
3022
 
3018
3023
  -- ── cerefox_find_dead_links ──────────────────────────────────────────────────
@@ -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.14.0
8
+ -- @version: 0.14.1
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.9.0",
3
+ "version": "1.9.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",