@pyxmate/memory 1.16.1 → 1.16.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.
package/README.md CHANGED
@@ -55,10 +55,14 @@ for the full CLI contract and exit codes.
55
55
 
56
56
  ## Use it programmatically
57
57
 
58
+ `MemoryClient` connects directly to a pyx-memory instance server (self-hosted
59
+ or a sidecar you run). Hosted pyx-memory access uses MCP via `pyx-mem mcp` or
60
+ the `/mcp` endpoint — not this HTTP client.
61
+
58
62
  ```ts
59
63
  import { MemoryClient } from '@pyxmate/memory';
60
64
 
61
- const memory = new MemoryClient('https://memory.api.pyxmate.com', process.env.MEMORY_API_KEY);
65
+ const memory = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_KEY);
62
66
  await memory.initialize();
63
67
 
64
68
  await memory.store({
@@ -1006,6 +1006,12 @@ var MemoryClient = class {
1006
1006
  );
1007
1007
  }
1008
1008
  if (!body?.success || body.data == null) {
1009
+ if (res.ok && body?.error === void 0) {
1010
+ throw new MemoryServerError(
1011
+ `Memory server returned HTTP ${res.status} without the expected { success, data } API envelope. Check that the base URL points to a pyx-memory instance server; hosted pyx-memory access uses MCP.`,
1012
+ res.status
1013
+ );
1014
+ }
1009
1015
  throw new MemoryServerError(body?.error ?? `Memory server error: ${res.status}`, res.status);
1010
1016
  }
1011
1017
  return body.data;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MemoryClient
3
- } from "./chunk-672SGW22.mjs";
3
+ } from "./chunk-3QDXACBV.mjs";
4
4
 
5
5
  // ../dashboard/src/aggregations/consolidation-analytics.ts
6
6
  function analyzeConsolidationLog(entries) {
@@ -835,7 +835,7 @@ function createProxyServer(client, version, uploadLocalFile) {
835
835
  return server;
836
836
  }
837
837
  async function runMcpProxyServer(opts) {
838
- const version = opts.version ?? (true ? "1.16.1" : "0.0.0-dev");
838
+ const version = opts.version ?? (true ? "1.16.3" : "0.0.0-dev");
839
839
  const read = await opts.readCredentials();
840
840
  if (!read.ok) {
841
841
  const text = read.result.content.map((c) => c.type === "text" ? c.text : "").join(" ").trim();
@@ -11,8 +11,8 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-425XJ6JV.mjs";
15
- import "./chunk-672SGW22.mjs";
14
+ } from "./chunk-X3QODOJV.mjs";
15
+ import "./chunk-3QDXACBV.mjs";
16
16
  import "./chunk-A3L46P2G.mjs";
17
17
  export {
18
18
  DashboardClient,
@@ -19,6 +19,7 @@ var DATA_PLANE_COMPILER_LIMITS = {
19
19
  profileContentBytes: 8192
20
20
  };
21
21
  var MEMORY_TYPES = ["short-term", "long-term", "working", "episodic", "summary"];
22
+ var ENTRY_STATUSES = ["active", "superseded", "archived"];
22
23
  var SENSITIVITY_LEVELS = ["public", "internal", "secret"];
23
24
  var PRINCIPAL_KINDS = ["api_key", "user"];
24
25
  var TENANT_MODES = ["single", "multi"];
@@ -300,6 +301,34 @@ function normalizeEntitySynthesisGet(input, mcp) {
300
301
  requireEnum(value.entityType, ENTITY_TYPES, "input.entityType");
301
302
  return { name };
302
303
  }
304
+ var LIST_CURSOR_MAX_TOKEN_CHARS = 4096;
305
+ var BASE64URL_TOKEN_RE = /^[A-Za-z0-9_-]+$/;
306
+ var ISO_DATE_TIME_PREFIX_RE = /^\d{4}-\d{2}-\d{2}T/;
307
+ function parseListCursorToken(token) {
308
+ if (token.length === 0 || token.length > LIST_CURSOR_MAX_TOKEN_CHARS) {
309
+ throw new Error("cursor token is empty or exceeds the size bound");
310
+ }
311
+ if (!BASE64URL_TOKEN_RE.test(token)) {
312
+ throw new Error("cursor token contains non-base64url characters");
313
+ }
314
+ let decoded;
315
+ try {
316
+ decoded = JSON.parse(Buffer.from(token, "base64url").toString("utf8"));
317
+ } catch {
318
+ throw new Error("cursor token is not base64url-encoded JSON");
319
+ }
320
+ if (typeof decoded !== "object" || decoded === null || Array.isArray(decoded)) {
321
+ throw new Error("cursor token payload must be an object");
322
+ }
323
+ const { c, i } = decoded;
324
+ if (typeof c !== "string" || !ISO_DATE_TIME_PREFIX_RE.test(c) || Number.isNaN(Date.parse(c))) {
325
+ throw new Error("cursor token field `c` must be an ISO-8601 timestamp");
326
+ }
327
+ if (typeof i !== "string" || i.length === 0) {
328
+ throw new Error("cursor token field `i` must be a non-empty entry id");
329
+ }
330
+ return { createdAt: c, id: i };
331
+ }
303
332
  function normalizeRestList(input) {
304
333
  const value = requireObject(input, "input");
305
334
  requireExactKeys(value, ["limit", "offset", "type"], "input");
@@ -335,21 +364,42 @@ function normalizeRestGet(input) {
335
364
  }
336
365
  return normalized;
337
366
  }
367
+ function normalizeMcpListEntries(value, normalized) {
368
+ if (value.since !== void 0) requireString(value.since, "input.since", { nonempty: false });
369
+ withOptional(normalized, "status", optionalEnum(value.status, ENTRY_STATUSES, "input.status"));
370
+ if (value.cursor !== void 0) {
371
+ if (value.page !== void 0) {
372
+ throw new Error("input.cursor and input.page are mutually exclusive");
373
+ }
374
+ if (typeof value.cursor !== "string") throw new Error("input.cursor must be a string");
375
+ parseListCursorToken(value.cursor);
376
+ normalized.cursor = value.cursor;
377
+ } else {
378
+ normalized.page = optionalInteger(value.page, "input.page", 1, Number.MAX_SAFE_INTEGER) ?? 1;
379
+ }
380
+ normalized.limit = optionalClampedPositiveInteger(value.limit, "input.limit", 100) ?? 20;
381
+ withOptional(
382
+ normalized,
383
+ "agentId",
384
+ normalizeAgentId(value.agentId, "input.agentId", null, false)
385
+ );
386
+ }
338
387
  function normalizeMcpList(input, defaultAgentId) {
339
388
  const value = requireObject(input, "input");
340
- requireExactKeys(value, ["mode", "page", "limit", "type", "agentId", "since"], "input");
389
+ requireExactKeys(
390
+ value,
391
+ ["mode", "page", "limit", "cursor", "status", "type", "agentId", "since"],
392
+ "input"
393
+ );
341
394
  const mode = value.mode === void 0 ? "entries" : requireEnum(value.mode, ["entries", "log"], "input.mode");
395
+ if (mode === "log") {
396
+ if (value.cursor !== void 0) throw new Error("input.cursor is only valid in entries mode");
397
+ if (value.status !== void 0) throw new Error("input.status is only valid in entries mode");
398
+ }
342
399
  const normalized = { mode };
343
400
  withOptional(normalized, "type", optionalEnum(value.type, MEMORY_TYPES, "input.type"));
344
401
  if (mode === "entries") {
345
- if (value.since !== void 0) requireString(value.since, "input.since", { nonempty: false });
346
- normalized.page = optionalInteger(value.page, "input.page", 1, Number.MAX_SAFE_INTEGER) ?? 1;
347
- normalized.limit = optionalClampedPositiveInteger(value.limit, "input.limit", 100) ?? 20;
348
- withOptional(
349
- normalized,
350
- "agentId",
351
- normalizeAgentId(value.agentId, "input.agentId", null, false)
352
- );
402
+ normalizeMcpListEntries(value, normalized);
353
403
  } else {
354
404
  if (value.page !== void 0)
355
405
  requireInteger(value.page, "input.page", 1, Number.MAX_SAFE_INTEGER);
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  TAXONOMY_MAX_CATEGORIES,
16
16
  VectorProvider,
17
17
  projectSearchResponseForMcp
18
- } from "./chunk-672SGW22.mjs";
18
+ } from "./chunk-3QDXACBV.mjs";
19
19
  import {
20
20
  mergeExtractedEntities,
21
21
  normalizeGraphLabel,
package/dist/react.mjs CHANGED
@@ -11,8 +11,8 @@ import {
11
11
  toGraphologyFormat,
12
12
  transformGraphData,
13
13
  unreachableHealth
14
- } from "./chunk-425XJ6JV.mjs";
15
- import "./chunk-672SGW22.mjs";
14
+ } from "./chunk-X3QODOJV.mjs";
15
+ import "./chunk-3QDXACBV.mjs";
16
16
  import "./chunk-A3L46P2G.mjs";
17
17
 
18
18
  // ../dashboard/src/hooks/use-consolidation-log.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "1.16.1",
3
+ "version": "1.16.3",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",