@cerefox/memory 0.9.11 → 0.10.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.
@@ -7184,7 +7184,7 @@ var exports_meta = {};
7184
7184
  __export(exports_meta, {
7185
7185
  PKG_VERSION: () => PKG_VERSION
7186
7186
  });
7187
- var PKG_VERSION = "0.9.11";
7187
+ var PKG_VERSION = "0.10.0";
7188
7188
  var init_meta = () => {};
7189
7189
 
7190
7190
  // ../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.js
@@ -81323,6 +81323,51 @@ function registerMetaRoutes(app, ctx) {
81323
81323
  });
81324
81324
  }
81325
81325
 
81326
+ // src/web/routes/postgrest-proxy.ts
81327
+ var STRIP_RESPONSE_HEADERS = [
81328
+ "connection",
81329
+ "keep-alive",
81330
+ "transfer-encoding",
81331
+ "content-length",
81332
+ "content-encoding",
81333
+ "te",
81334
+ "trailer",
81335
+ "upgrade",
81336
+ "proxy-authenticate",
81337
+ "proxy-authorization"
81338
+ ];
81339
+ function registerPostgrestProxy(app) {
81340
+ const upstream = (process.env.CEREFOX_POSTGREST_UPSTREAM ?? "").trim().replace(/\/+$/, "");
81341
+ if (!upstream)
81342
+ return;
81343
+ app.all("/rest/v1/*", async (c2) => {
81344
+ const url = new URL(c2.req.url);
81345
+ const path = url.pathname.replace(/^\/rest\/v1/, "");
81346
+ const target = `${upstream}${path}${url.search}`;
81347
+ const headers = new Headers(c2.req.raw.headers);
81348
+ headers.delete("host");
81349
+ headers.delete("accept-encoding");
81350
+ const method = c2.req.method;
81351
+ const init = { method, headers };
81352
+ if (method !== "GET" && method !== "HEAD") {
81353
+ init.body = c2.req.raw.body;
81354
+ init.duplex = "half";
81355
+ }
81356
+ let resp;
81357
+ try {
81358
+ resp = await fetch(target, init);
81359
+ } catch (err) {
81360
+ return c2.json({
81361
+ detail: `PostgREST upstream unreachable: ${err instanceof Error ? err.message : String(err)}`
81362
+ }, 502);
81363
+ }
81364
+ const respHeaders = new Headers(resp.headers);
81365
+ for (const h of STRIP_RESPONSE_HEADERS)
81366
+ respHeaders.delete(h);
81367
+ return new Response(resp.body, { status: resp.status, headers: respHeaders });
81368
+ });
81369
+ }
81370
+
81326
81371
  // src/web/routes/preferences.ts
81327
81372
  init_config();
81328
81373
  import { existsSync as existsSync14, mkdirSync as mkdirSync4, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
@@ -81520,6 +81565,7 @@ function buildApp(ctx = buildWebContext()) {
81520
81565
  app.post("/api/v1/ingest/file", ingest503);
81521
81566
  app.post("/api/v1/documents/:document_id/upload", ingest503);
81522
81567
  }
81568
+ registerPostgrestProxy(app);
81523
81569
  const staticDir = resolveStaticDir();
81524
81570
  if (staticDir) {
81525
81571
  app.use("/static/*", serveStatic({
@@ -81893,7 +81939,10 @@ function registerRenameHusks(program2) {
81893
81939
  }
81894
81940
  }
81895
81941
  function buildProgram() {
81896
- const program2 = new Command("cerefox").description("Cerefox — user-owned shared memory for AI agents.").version(PKG_VERSION, "-v, --version", "Print the cerefox version and exit.").addOption(new Option("--json", "Emit machine-readable JSON on stdout instead of the default human text. " + "Available on read commands; ignored on commands without a JSON shape.").hideHelp()).showHelpAfterError("(run `cerefox --help` for usage)").enablePositionalOptions().addHelpText("after", "\nResource groups (run `cerefox <group> --help`):\n" + ` document get · list · edit · delete · restore · ingest · ingest-dir · version {list·archive·unarchive}
81942
+ const progName = process.env.CEREFOX_PROG_NAME || "cerefox";
81943
+ const program2 = new Command(progName).description("Cerefox — user-owned shared memory for AI agents.").version(PKG_VERSION, "-v, --version", `Print the ${progName} version and exit.`).addOption(new Option("--json", "Emit machine-readable JSON on stdout instead of the default human text. " + "Available on read commands; ignored on commands without a JSON shape.").hideHelp()).showHelpAfterError(`(run \`${progName} --help\` for usage)`).enablePositionalOptions().addHelpText("after", `
81944
+ Resource groups (run \`${progName} <group> --help\`):
81945
+ ` + ` document get · list · edit · delete · restore · ingest · ingest-dir · version {list·archive·unarchive}
81897
81946
  ` + ` project list · create · edit · delete
81898
81947
  ` + ` metadata keys · search
81899
81948
  ` + ` audit list
@@ -81915,8 +81964,8 @@ Exit codes:
81915
81964
  ` + ` 1 user error 3 not found (document / version / project)
81916
81965
  ` + `
81917
81966
  Learn more:
81918
- ` + ` cerefox docs --list # bundled docs (offline)
81919
- ` + ` cerefox doctor # diagnose your install
81967
+ ` + ` ${progName} guides list # bundled docs (offline)
81968
+ ` + ` ${progName} doctor # diagnose your install
81920
81969
  ` + ` https://github.com/fstamatelopoulos/cerefox
81921
81970
  `);
81922
81971
  registerSearch(program2);