@cerefox/memory 1.0.0-beta.2 → 1.0.0-beta.3

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.
@@ -15,7 +15,7 @@
15
15
  href="https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&display=swap"
16
16
  />
17
17
  <title>Cerefox</title>
18
- <script type="module" crossorigin src="/app/assets/index-D3FshoP3.js"></script>
18
+ <script type="module" crossorigin src="/app/assets/index-BZdKiyrT.js"></script>
19
19
  <link rel="stylesheet" crossorigin href="/app/assets/index-Asx5wD7g.css">
20
20
  </head>
21
21
  <body>
@@ -18,7 +18,7 @@
18
18
  * doesn't touch `supabase/functions/` leaves it alone).
19
19
  */
20
20
 
21
- export const EF_VERSION = "1.0.0-beta.2";
21
+ export const EF_VERSION = "1.0.0-beta.3";
22
22
 
23
23
  /**
24
24
  * The 8 peer EFs the cerefox-mcp aggregator probes (excludes cerefox-mcp
@@ -93,7 +93,9 @@ Deno.serve(async (req: Request): Promise<Response> => {
93
93
  { status: 400, headers: { ...CORS_HEADERS, "Content-Type": "application/json" } },
94
94
  );
95
95
  }
96
- const limit = body.limit ?? 10;
96
+ // Clamp limit to [1, 500]: response is byte-capped, but bound the row work too
97
+ // so an authenticated caller can't request an unbounded scan. Defensive review, pre-1.0.
98
+ const limit = Math.min(Math.max(1, Math.floor(Number(body.limit)) || 10), 500);
97
99
  const include_content = body.include_content ?? false;
98
100
  const requested_max_bytes = body.max_bytes;
99
101
 
@@ -52,6 +52,11 @@ const EMBEDDING_DIMENSIONS = 768;
52
52
  // ceiling is rarely reached under normal usage at the default match_count=5.
53
53
  const MAX_BYTES = 200_000;
54
54
 
55
+ // Upper bound on match_count. The response is byte-capped separately (MAX_BYTES);
56
+ // this caps the query work (vector sort / FTS ranking) so an authenticated caller
57
+ // cannot request an unbounded LIMIT. Defensive review, pre-1.0.
58
+ const MAX_MATCH_COUNT = 200;
59
+
55
60
 
56
61
  interface SearchRequest {
57
62
  query: string;
@@ -216,7 +221,7 @@ Deno.serve(async (req: Request) => {
216
221
  const {
217
222
  query,
218
223
  project_name,
219
- match_count = 5,
224
+ match_count: raw_match_count = 5,
220
225
  mode = "docs",
221
226
  alpha = 0.7,
222
227
  min_score = 0.5,
@@ -226,6 +231,8 @@ Deno.serve(async (req: Request) => {
226
231
 
227
232
  // Enforce ceiling: agents may request less but never more than MAX_BYTES.
228
233
  const max_bytes = Math.min(requested_max_bytes ?? MAX_BYTES, MAX_BYTES);
234
+ // Clamp match_count to [1, MAX_MATCH_COUNT] (bounds query work; see MAX_MATCH_COUNT).
235
+ const match_count = Math.min(Math.max(1, Math.floor(Number(raw_match_count)) || 5), MAX_MATCH_COUNT);
229
236
 
230
237
  // Validate metadata_filter: must be a plain object (or null/absent).
231
238
  // Reject arrays, strings, and other non-object types to prevent RPC errors.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerefox/memory",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Cerefox — user-owned shared memory for AI agents. The local TypeScript runtime: stdio MCP server in v0.4; CLI binary added in v0.5; in-process web server in v0.6; ingestion pipeline in v0.7.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/fstamatelopoulos/cerefox",