@hivemagnus/hivemem-sdk 1.1.0 → 1.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to `@hivemagnus/hivemem-sdk`.
4
4
 
5
+ ## [1.1.1] - 2026-11-12
6
+
7
+ ### Fixed
8
+
9
+ - An error response whose body is not JSON, such as a proxy's HTML 502, is reported with its
10
+ status and text. The body was read twice, and the second read failed with "Body is unusable".
11
+ An empty error body is reported as "HiveMem answered HTTP <status>".
12
+
5
13
  ## [1.1.0] - 2026-11-12
6
14
 
7
15
  ### Added
package/dist/client.js CHANGED
@@ -87,14 +87,21 @@ export class HiveMem {
87
87
  if (!response.ok) {
88
88
  let details;
89
89
  let message = response.statusText;
90
+ // Read the body once: a proxy's HTML or plain-text error is not JSON, and a second
91
+ // read of the same body would fail and hide the status.
92
+ const text = await response.text().catch(() => "");
90
93
  try {
91
- details = await response.json();
94
+ details = JSON.parse(text);
92
95
  if (details && typeof details === "object" && "detail" in details)
93
96
  message = String(details.detail);
94
97
  }
95
98
  catch {
96
- message = await response.text();
99
+ details = undefined;
100
+ if (text.trim())
101
+ message = text;
97
102
  }
103
+ if (!message)
104
+ message = `HiveMem answered HTTP ${response.status}`;
98
105
  throw new HiveMemHTTPError(response.status, message, details);
99
106
  }
100
107
  if (response.status === 204)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hivemagnus/hivemem-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "TypeScript client for HiveMem, the shared long-term memory service for AI agents",
5
5
  "keywords": [
6
6
  "hivemem",