dshmarket 1.14.0 → 1.14.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/client/client.js CHANGED
@@ -94,6 +94,8 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
94
94
  cancelOp: "取消",
95
95
  cancelled: "已取消",
96
96
  busyWait: "已有操作正在进行,请等它结束(同一时间只执行一个安装/更新/卸载)",
97
+ agentBusyUpdate: "有 agent 正在运行,请等它完成或取消后再更新——更新会直接替换插件文件,工作中的 agent 可能中途报错或新旧版本混用。",
98
+ agentBusyInstall: "有 agent 正在运行,请等它完成或取消后再安装——安装会修改插件文件,工作中的 agent 可能中途报错。",
97
99
  approveBuilds: "放行构建脚本并重试",
98
100
  buildsSkipped: "该插件需要运行构建脚本才能工作,出于安全默认被拦下。点击下方按钮为它放行并重装:",
99
101
  restartNow: "立即重启",
@@ -400,6 +402,8 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
400
402
  cancelOp: "Cancel",
401
403
  cancelled: "Cancelled",
402
404
  busyWait: "Another operation is already running — please wait for it to finish (one install/update/uninstall at a time)",
405
+ agentBusyUpdate: "An agent is currently working — wait for it to finish (or cancel it) before updating. Updates replace plugin files in place, so a working agent can fail or mix versions mid-turn.",
406
+ agentBusyInstall: "An agent is currently working — wait for it to finish (or cancel it) before installing. Installing changes plugin files, so a working agent can fail mid-turn.",
403
407
  approveBuilds: "Allow build scripts and retry",
404
408
  buildsSkipped: "This plugin needs its build scripts to run; they are blocked by default for safety. Click below to allow them and reinstall:",
405
409
  restartNow: "Restart now",
@@ -713,11 +717,30 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
713
717
  return plugins.filter((p) => p.category === "theme").sort((a, b) => (b.stars || 0) - (a.stars || 0));
714
718
  }
715
719
  /**
716
- * Category chip order: collapsed with an active non-'all' chip, the active
717
- * one moves to the front so it stays visible inside the two-row clip.
720
+ * Category chip order: collapsed with an active non-'all' chip that would
721
+ * otherwise be clipped out of the two-row preview, the active one moves to
722
+ * the front so it stays visible.
723
+ *
724
+ * Reported as "点了某个分类,标签就跑到前面来了,好奇怪": the earlier version
725
+ * moved the active chip to the front unconditionally, so clicking a category
726
+ * that was ALREADY visible inside the two rows still reshuffled it — and
727
+ * every chip after it — for no reason, since nothing was at risk of being
728
+ * hidden. `visibleCount` is how many chips (the 'all' chip included) the
729
+ * two-row clip fits; a category already within that budget in its natural
730
+ * position is left exactly where it was.
731
+ *
732
+ * `visibleCount === null` (not yet measured, e.g. the very first collapsed
733
+ * render) keeps the old unconditional behaviour: with no measurement to
734
+ * check against, guaranteeing visibility is the safe default.
718
735
  */
719
- function orderedCategories(categories, active, open) {
720
- return open || active === "all" ? categories : [active, ...categories.filter((id) => id !== active)];
736
+ function orderedCategories(categories, active, open, visibleCount = null) {
737
+ if (open || active === "all") return categories;
738
+ if (visibleCount !== null) {
739
+ const budget = Math.max(0, visibleCount - 1);
740
+ const naturalIndex = categories.indexOf(active);
741
+ if (naturalIndex !== -1 && naturalIndex < budget) return categories;
742
+ }
743
+ return [active, ...categories.filter((id) => id !== active)];
721
744
  }
722
745
  /**
723
746
  * Page-number list for the discover pager. With few pages it is simply
@@ -2933,6 +2956,11 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
2933
2956
  refreshInstalled();
2934
2957
  } else {
2935
2958
  if (status === 409) {
2959
+ if (body.agentsBusy === true) {
2960
+ const running = Array.isArray(body.runningAgents) && body.runningAgents.length > 0 ? ` (${body.runningAgents.join(", ")})` : "";
2961
+ setInstallError(t("agentBusyInstall") + running);
2962
+ return;
2963
+ }
2936
2964
  setInstallError(t("busyWait"));
2937
2965
  return;
2938
2966
  }
@@ -3042,6 +3070,11 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
3042
3070
  refreshInstalled();
3043
3071
  } else {
3044
3072
  if (status === 409) {
3073
+ if (body.agentsBusy === true) {
3074
+ const running = Array.isArray(body.runningAgents) && body.runningAgents.length > 0 ? ` (${body.runningAgents.join(", ")})` : "";
3075
+ setInstallError(t("agentBusyUpdate") + running);
3076
+ return;
3077
+ }
3045
3078
  setInstallError(t("busyWait"));
3046
3079
  return;
3047
3080
  }
@@ -4488,7 +4521,7 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
4488
4521
  ref: catsWrapRef,
4489
4522
  className: visibleCats === null ? `${Market_module_css_default.catsWrap} ${Market_module_css_default.catsCollapsed}` : Market_module_css_default.catsWrap,
4490
4523
  children: (() => {
4491
- const ordered = orderedCategories(categories, cat, catsOpen);
4524
+ const ordered = orderedCategories(categories, cat, catsOpen, visibleCats);
4492
4525
  const shown = catsOpen || visibleCats === null ? ordered : ordered.slice(0, Math.max(0, visibleCats - 1));
4493
4526
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
4494
4527
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Pill, {