@pyxmate/memory 0.31.2 → 0.31.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.
@@ -167,7 +167,7 @@ function getDefaultKeychain() {
167
167
  }
168
168
 
169
169
  // src/cli/probe.ts
170
- var PROBE_PATH = "/api/memory/stats";
170
+ var PROBE_PATH = "/api/memory/entries?limit=1";
171
171
  var PROBE_TIMEOUT_MS = 8e3;
172
172
  async function probeCredentials(args) {
173
173
  const fetcher = args.fetcher ?? fetch;
@@ -637,30 +637,10 @@ function createHttpClient(credentials, fetchImpl = fetch) {
637
637
  clearTimeout(timer);
638
638
  }
639
639
  if (res.status === 401 || res.status === 403) {
640
- return { ok: false, result: mcpAuthFailed(res.status) };
640
+ return { ok: false, status: res.status, result: mcpAuthFailed(res.status) };
641
641
  }
642
642
  const text = await res.text().catch(() => "");
643
- if (res.status >= 500) {
644
- return { ok: false, result: mcpServerError(res.status, text) };
645
- }
646
- let parsed;
647
- if (text.length > 0) {
648
- try {
649
- parsed = JSON.parse(text);
650
- } catch {
651
- if (!res.ok) return { ok: false, result: mcpHttpError(res.status, text || "no body") };
652
- return { ok: true, status: res.status, data: text };
653
- }
654
- }
655
- if (!res.ok) {
656
- const message = extractEnvelopeError(parsed) ?? text ?? `HTTP ${res.status}`;
657
- return { ok: false, result: mcpHttpError(res.status, message) };
658
- }
659
- const envelopeError = extractEnvelopeError(parsed);
660
- if (envelopeError) {
661
- return { ok: false, result: mcpEnvelopeError(envelopeError) };
662
- }
663
- return { ok: true, status: res.status, data: parsed };
643
+ return parseHttpResponse(res, text);
664
644
  }
665
645
  return {
666
646
  async requestJson(input) {
@@ -677,6 +657,39 @@ function createHttpClient(credentials, fetchImpl = fetch) {
677
657
  }
678
658
  };
679
659
  }
660
+ function parseHttpResponse(res, text) {
661
+ if (res.status >= 500) {
662
+ return { ok: false, status: res.status, result: mcpServerError(res.status, text) };
663
+ }
664
+ const parsed = parseJsonText(text);
665
+ if (!parsed.ok) {
666
+ if (!res.ok) {
667
+ return {
668
+ ok: false,
669
+ status: res.status,
670
+ result: mcpHttpError(res.status, text || "no body")
671
+ };
672
+ }
673
+ return { ok: true, status: res.status, data: text };
674
+ }
675
+ if (!res.ok) {
676
+ const message = extractEnvelopeError(parsed.value) ?? text ?? `HTTP ${res.status}`;
677
+ return { ok: false, status: res.status, result: mcpHttpError(res.status, message) };
678
+ }
679
+ const envelopeError = extractEnvelopeError(parsed.value);
680
+ if (envelopeError) {
681
+ return { ok: false, status: res.status, result: mcpEnvelopeError(envelopeError) };
682
+ }
683
+ return { ok: true, status: res.status, data: parsed.value };
684
+ }
685
+ function parseJsonText(text) {
686
+ if (text.length === 0) return { ok: true, value: void 0 };
687
+ try {
688
+ return { ok: true, value: JSON.parse(text) };
689
+ } catch {
690
+ return { ok: false };
691
+ }
692
+ }
680
693
  function extractEnvelopeError(parsed) {
681
694
  if (parsed === null || typeof parsed !== "object") return null;
682
695
  const obj = parsed;
@@ -1051,7 +1064,7 @@ var statusTool = {
1051
1064
  name: "status",
1052
1065
  config: {
1053
1066
  title: "Get pyx-memory topology",
1054
- description: "Fetch the running pyx-memory server topology: build variant (cloud|full), declared deployment role, server version, embedding location (inline|remote), and active model profile. HTTP proxy to GET /status \u2014 no in-process branch.",
1067
+ description: "Fetch the running pyx-memory server topology from GET /status when available. Hosted gateways that expose /health but not /status return an explicit topologyUnavailable result with the health payload.",
1055
1068
  inputSchema: inputShape6,
1056
1069
  annotations: { readOnlyHint: true, openWorldHint: true }
1057
1070
  },
@@ -1060,7 +1073,17 @@ var statusTool = {
1060
1073
  if (!creds.ok) return creds.result;
1061
1074
  const http = createHttpClient(creds.credentials, deps.fetchImpl);
1062
1075
  const res = await http.requestJson({ method: "GET", path: "/status" });
1063
- return res.ok ? mcpJson(res.data) : res.result;
1076
+ if (res.ok) return mcpJson(res.data);
1077
+ if (res.status !== 404) return res.result;
1078
+ const health = await http.requestJson({ method: "GET", path: "/health" });
1079
+ if (!health.ok) return res.result;
1080
+ return mcpJson({
1081
+ topologyUnavailable: true,
1082
+ reason: "GET /status returned 404; this endpoint exposes /health but not topology status.",
1083
+ statusEndpoint: "/status",
1084
+ healthEndpoint: "/health",
1085
+ health: health.data
1086
+ });
1064
1087
  }
1065
1088
  };
1066
1089
 
@@ -1301,7 +1324,7 @@ var ALL_TOOL_NAMES = ALL_TOOLS.map((t) => t.name);
1301
1324
  // src/mcp/server.ts
1302
1325
  async function runMcpServer(opts) {
1303
1326
  const fetchImpl = opts.fetchImpl ?? fetch;
1304
- const version = opts.version ?? (true ? "0.31.2" : "0.0.0-dev");
1327
+ const version = opts.version ?? (true ? "0.31.3" : "0.0.0-dev");
1305
1328
  const server = new McpServer(
1306
1329
  { name: "pyx-memory", version },
1307
1330
  { instructions: PYX_MEMORY_INSTRUCTIONS, capabilities: { tools: {} } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",