@agent_memory/dsh 0.5.1 → 0.5.2

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/client/client.js CHANGED
@@ -711,7 +711,13 @@ function MemoryPage() {
711
711
  setUpdateBusy(true);
712
712
  setUpdateInfo({ checking: true });
713
713
  fetch("/api/agent-memory/update/check", { headers: { accept: "application/json" } }).then(async (response) => {
714
- const data2 = await response.json();
714
+ const text = await response.text();
715
+ let data2;
716
+ try {
717
+ data2 = JSON.parse(text);
718
+ } catch {
719
+ throw new Error(`更新接口返回非 JSON(HTTP ${response.status}):${text.slice(0, 80)}`);
720
+ }
715
721
  if (!response.ok) throw new Error(data2.error || `HTTP ${response.status}`);
716
722
  return data2;
717
723
  }).then((data2) => setUpdateInfo(data2)).catch((error) => setUpdateInfo({ error: String(error) })).finally(() => setUpdateBusy(false));
@@ -725,7 +731,13 @@ function MemoryPage() {
725
731
  headers: { accept: "application/json", "content-type": "application/json" },
726
732
  body: JSON.stringify({ version: updateInfo.latest })
727
733
  }).then(async (response) => {
728
- const data2 = await response.json();
734
+ const text = await response.text();
735
+ let data2;
736
+ try {
737
+ data2 = JSON.parse(text);
738
+ } catch {
739
+ throw new Error(`更新接口返回非 JSON(HTTP ${response.status}):${text.slice(0, 80)}`);
740
+ }
729
741
  if (!response.ok || data2.ok === false) throw new Error(data2.error || `HTTP ${response.status}`);
730
742
  return data2;
731
743
  }).then((data2) => setUpdateInfo((previous) => ({ ...previous || {}, applied: data2 }))).catch((error) => setUpdateInfo((previous) => ({ ...previous || {}, applyError: String(error) }))).finally(() => setUpdateBusy(false));
package/dist/plugin.mjs CHANGED
@@ -6584,7 +6584,7 @@ function registerGuiRoutes(connection, deps, effect) {
6584
6584
  }
6585
6585
 
6586
6586
  // packages/dsh/src/update.ts
6587
- var PLUGIN_VERSION = "0.5.1";
6587
+ var PLUGIN_VERSION = "0.5.2";
6588
6588
  var PACKAGE_NAME = "@agent_memory/dsh";
6589
6589
  var REGISTRY_LATEST = [
6590
6590
  "https://registry.npmjs.org/@agent_memory%2Fdsh/latest",
@@ -6612,8 +6612,16 @@ function createUpdateService(manager, fetcher = fetch) {
6612
6612
  headers: { accept: "application/json" },
6613
6613
  signal: AbortSignal.timeout(8e3)
6614
6614
  });
6615
- if (!response.ok) throw new Error(`registry returned HTTP ${response.status}`);
6616
- const body = await response.json();
6615
+ const text = await response.text();
6616
+ if (!response.ok) {
6617
+ throw new Error(`registry returned HTTP ${response.status}: ${text.slice(0, 120)}`);
6618
+ }
6619
+ let body;
6620
+ try {
6621
+ body = JSON.parse(text);
6622
+ } catch {
6623
+ throw new Error(`registry returned non-JSON: ${text.slice(0, 120)}`);
6624
+ }
6617
6625
  if (typeof body.version !== "string" || !/^\d+\.\d+\.\d+/.test(body.version)) {
6618
6626
  throw new Error("registry response has no valid version");
6619
6627
  }