@co0ontty/wand 1.1.4 → 1.1.5

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/dist/server.js CHANGED
@@ -481,9 +481,15 @@ export async function startServer(config, configPath) {
481
481
  res.status(500).json({ error: getErrorMessage(error, "检查更新失败。") });
482
482
  }
483
483
  });
484
+ let updateInFlight = false;
484
485
  app.post("/api/update", async (_req, res) => {
486
+ if (updateInFlight) {
487
+ res.status(409).json({ error: "更新正在进行中,请稍候。" });
488
+ return;
489
+ }
490
+ updateInFlight = true;
485
491
  try {
486
- const { updateAvailable, latest } = await checkNpmLatestVersion();
492
+ const { updateAvailable, latest } = await checkNpmLatestVersion(true);
487
493
  if (!updateAvailable) {
488
494
  res.json({ ok: true, message: "已经是最新版本。" });
489
495
  return;
@@ -494,6 +500,9 @@ export async function startServer(config, configPath) {
494
500
  catch (error) {
495
501
  res.status(500).json({ error: getErrorMessage(error, "更新失败。") });
496
502
  }
503
+ finally {
504
+ updateInFlight = false;
505
+ }
497
506
  });
498
507
  app.get("/api/sessions", (_req, res) => {
499
508
  res.json(processes.list());
@@ -3403,7 +3403,11 @@
3403
3403
  updateShellChrome();
3404
3404
 
3405
3405
  var selectedSession = state.sessions.find(function(s) { return s.id === id; });
3406
- state.currentMessages = [];
3406
+ if (data.messages && data.messages.length > 0) {
3407
+ state.currentMessages = data.messages;
3408
+ } else {
3409
+ state.currentMessages = [];
3410
+ }
3407
3411
 
3408
3412
  if (state.terminal) {
3409
3413
  syncTerminalBuffer(id, data.output || "", { mode: "replace" });
@@ -3849,7 +3853,8 @@
3849
3853
  function performUpdate() {
3850
3854
  var msgEl = document.getElementById("update-message");
3851
3855
  var updateBtn = document.getElementById("do-update-button");
3852
- if (updateBtn) updateBtn.disabled = true;
3856
+ if (!updateBtn) return;
3857
+ updateBtn.disabled = true;
3853
3858
  if (msgEl) {
3854
3859
  msgEl.textContent = "正在更新,请稍候...";
3855
3860
  msgEl.style.color = "var(--text-secondary)";
@@ -3869,9 +3874,9 @@
3869
3874
  msgEl.classList.remove("hidden");
3870
3875
  }
3871
3876
  if (data.error) {
3872
- if (updateBtn) updateBtn.disabled = false;
3877
+ updateBtn.disabled = false;
3873
3878
  } else {
3874
- if (updateBtn) updateBtn.classList.add("hidden");
3879
+ updateBtn.classList.add("hidden");
3875
3880
  }
3876
3881
  })
3877
3882
  .catch(function() {
@@ -3880,7 +3885,7 @@
3880
3885
  msgEl.style.color = "var(--error)";
3881
3886
  msgEl.classList.remove("hidden");
3882
3887
  }
3883
- if (updateBtn) updateBtn.disabled = false;
3888
+ updateBtn.disabled = false;
3884
3889
  });
3885
3890
  }
3886
3891
 
@@ -6583,7 +6588,11 @@
6583
6588
  }
6584
6589
  updateSessionSnapshot(snapshot);
6585
6590
  if (msg.sessionId === state.selectedId) {
6591
+ if (msg.data.messages && msg.data.messages.length > 0) {
6592
+ state.currentMessages = msg.data.messages;
6593
+ }
6586
6594
  updateTaskDisplay();
6595
+ scheduleChatRender();
6587
6596
  }
6588
6597
 
6589
6598
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@co0ontty/wand",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "A web terminal for local CLI tools like Claude.",
5
5
  "type": "module",
6
6
  "bin": {