@michengai/dsh-archive-manager 1.2.8 → 1.3.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/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getEntryLocation, getOnlineUpdate, getSidebarFavoriteStar, setEntryLocation, setOnlineUpdate, setSidebarFavoriteStar } from "./plugin-settings.js";
1
+ import { getEntryLocation, getOnlineUpdate, getSidebarFavoriteStarMode, setEntryLocation, setOnlineUpdate, setSidebarFavoriteStarMode } from "./plugin-settings.js";
2
2
  import { isTrustedUpdateRequest, rawService, registerPluginUpdater, releaseUpdateRoute } from "./plugin-updater.js";
3
3
  import { apply as installHost, inject as hostInject } from "./host-install.js";
4
4
  import { authorizeExplorerPath } from "./explorer-path-policy.js";
@@ -85,8 +85,8 @@ function registerSettingsRoutes(ctx, hostUpdateDisabled) {
85
85
  path: SIDEBAR_FAVORITE_STAR_ENDPOINT,
86
86
  handler: async (request, response) => {
87
87
  if (request.method === "GET" || request.method === "HEAD") {
88
- const enabled = await getSidebarFavoriteStar();
89
- sendJson(response, 200, { ok: true, enabled });
88
+ const mode = await getSidebarFavoriteStarMode();
89
+ sendJson(response, 200, { ok: true, mode, enabled: mode !== "none" });
90
90
  return;
91
91
  }
92
92
  if (request.method === "POST") {
@@ -95,12 +95,25 @@ function registerSettingsRoutes(ctx, hostUpdateDisabled) {
95
95
  return;
96
96
  }
97
97
  const body = await readJsonBody(request);
98
- if (!body || typeof body.enabled !== "boolean") {
99
- sendJson(response, 400, { ok: false, error: "enabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C" });
98
+ if (!body) {
99
+ sendJson(response, 400, { ok: false, error: "\u8BF7\u6C42\u4F53\u4E0D\u80FD\u4E3A\u7A7A" });
100
100
  return;
101
101
  }
102
- const enabled = await setSidebarFavoriteStar(body.enabled);
103
- sendJson(response, 200, { ok: true, enabled });
102
+ let targetMode;
103
+ if (typeof body.mode === "string") {
104
+ if (body.mode !== "all" && body.mode !== "favorites" && body.mode !== "none") {
105
+ sendJson(response, 400, { ok: false, error: "mode \u5FC5\u987B\u662F all\u3001favorites \u6216 none" });
106
+ return;
107
+ }
108
+ targetMode = body.mode;
109
+ } else if (typeof body.enabled === "boolean") {
110
+ targetMode = body.enabled ? "all" : "none";
111
+ } else {
112
+ sendJson(response, 400, { ok: false, error: "\u7F3A\u5C11\u5408\u6CD5\u7684 mode \u6216 enabled \u53C2\u6570" });
113
+ return;
114
+ }
115
+ const mode = await setSidebarFavoriteStarMode(targetMode);
116
+ sendJson(response, 200, { ok: true, mode, enabled: mode !== "none" });
104
117
  return;
105
118
  }
106
119
  response.writeHead(405, { allow: "GET, HEAD, POST" });
@@ -3,6 +3,11 @@ import { existsSync, mkdirSync } from "node:fs";
3
3
  import { readFile, rename, unlink, writeFile } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
+ function normalizeFavoriteStarMode(value) {
7
+ if (value === "all" || value === "favorites" || value === "none") return value;
8
+ if (value === false) return "none";
9
+ return "all";
10
+ }
6
11
  function resolveDshHome() {
7
12
  const custom = process.env.DSH_HOME;
8
13
  if (typeof custom === "string" && custom.trim() !== "") {
@@ -62,7 +67,7 @@ async function readSettings() {
62
67
  entryLocation: "settings",
63
68
  sidebarEntry: false,
64
69
  onlineUpdate: true,
65
- sidebarFavoriteStar: true
70
+ sidebarFavoriteStar: "all"
66
71
  };
67
72
  if (!existsSync(path)) {
68
73
  return defaultSettings;
@@ -86,7 +91,7 @@ async function readSettings() {
86
91
  entryLocation,
87
92
  sidebarEntry: entryLocation !== "settings",
88
93
  onlineUpdate: typeof item.onlineUpdate === "boolean" ? item.onlineUpdate : true,
89
- sidebarFavoriteStar: typeof item.sidebarFavoriteStar === "boolean" ? item.sidebarFavoriteStar : true
94
+ sidebarFavoriteStar: normalizeFavoriteStarMode(item.sidebarFavoriteStar)
90
95
  };
91
96
  } catch {
92
97
  return defaultSettings;
@@ -99,7 +104,7 @@ async function writeSettings(next) {
99
104
  entryLocation: location,
100
105
  sidebarEntry: location !== "settings",
101
106
  onlineUpdate: next.onlineUpdate !== false,
102
- sidebarFavoriteStar: next.sidebarFavoriteStar !== false
107
+ sidebarFavoriteStar: normalizeFavoriteStarMode(next.sidebarFavoriteStar)
103
108
  };
104
109
  const serialized = `${JSON.stringify(normalized, null, 2)}
105
110
  `;
@@ -153,31 +158,49 @@ async function setOnlineUpdate(enabled) {
153
158
  return enabled;
154
159
  });
155
160
  }
156
- async function getSidebarFavoriteStar() {
161
+ async function getSidebarFavoriteStarMode() {
157
162
  const current = await readSettings();
158
- return current.sidebarFavoriteStar !== false;
163
+ return normalizeFavoriteStarMode(current.sidebarFavoriteStar);
159
164
  }
160
- async function setSidebarFavoriteStar(enabled) {
161
- if (typeof enabled !== "boolean") {
162
- throw new TypeError("sidebarFavoriteStar must be a boolean");
165
+ async function setSidebarFavoriteStarMode(mode) {
166
+ if (mode !== "all" && mode !== "favorites" && mode !== "none") {
167
+ throw new TypeError("sidebarFavoriteStar mode must be 'all', 'favorites', or 'none'");
163
168
  }
164
169
  return enqueueWrite(async () => {
165
170
  const current = await readSettings();
166
- current.sidebarFavoriteStar = enabled;
171
+ current.sidebarFavoriteStar = mode;
167
172
  await writeSettings(current);
168
- return enabled;
173
+ return mode;
169
174
  });
170
175
  }
176
+ async function getSidebarFavoriteStar() {
177
+ const mode = await getSidebarFavoriteStarMode();
178
+ return mode !== "none";
179
+ }
180
+ async function setSidebarFavoriteStar(value) {
181
+ if (typeof value !== "boolean" && value !== "all" && value !== "favorites" && value !== "none") {
182
+ throw new TypeError("sidebarFavoriteStar must be 'all', 'favorites', 'none', or a boolean");
183
+ }
184
+ if (typeof value === "boolean") {
185
+ const mode = value ? "all" : "none";
186
+ await setSidebarFavoriteStarMode(mode);
187
+ return value;
188
+ }
189
+ return setSidebarFavoriteStarMode(value);
190
+ }
171
191
  export {
172
192
  getEntryLocation,
173
193
  getOnlineUpdate,
174
194
  getSidebarEntry,
175
195
  getSidebarFavoriteStar,
196
+ getSidebarFavoriteStarMode,
176
197
  managerSettingsPath,
198
+ normalizeFavoriteStarMode,
177
199
  readSettings,
178
200
  setEntryLocation,
179
201
  setOnlineUpdate,
180
202
  setSidebarEntry,
181
203
  setSidebarFavoriteStar,
204
+ setSidebarFavoriteStarMode,
182
205
  writeSettings
183
206
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { IconArchiveOutlineMedium, SegmentedControl, Switch as PrimitiveSwitch } from "@deepseek-ai/dsh-client-ui-primitives";
2
+ import { IconArchiveOutlineMedium, SegmentedControl } from "@deepseek-ai/dsh-client-ui-primitives";
3
3
  const h = React.createElement;
4
4
  const BUNDLE_KEY = "@michengai/dsh-archive-manager";
5
5
  const SIDEBAR_PANEL_ID = "archived-sessions";
@@ -37,15 +37,14 @@ function ArchiveBundleConfigCard(props) {
37
37
  enabled = false,
38
38
  onToggle,
39
39
  disabled,
40
- onlineUpdateEnabled = true,
41
- onToggleOnlineUpdate,
42
- onlineUpdateDisabled,
43
- onlineUpdateLocked = false,
44
40
  sidebarFavoriteStarEnabled = true,
45
41
  onToggleSidebarFavoriteStar,
46
- sidebarFavoriteStarDisabled
42
+ sidebarFavoriteStarDisabled,
43
+ sidebarFavoriteStarMode: propStarMode,
44
+ onSidebarFavoriteStarModeChange
47
45
  } = props;
48
46
  const effectiveLocation = propLocation ?? (enabled ? "both" : "settings");
47
+ const effectiveStarMode = propStarMode ?? (sidebarFavoriteStarEnabled === false ? "none" : "all");
49
48
  const handleLocationChange = (next) => {
50
49
  if (next === "both" || next === "sidebar" || next === "settings") {
51
50
  if (typeof onLocationChange === "function") {
@@ -55,6 +54,15 @@ function ArchiveBundleConfigCard(props) {
55
54
  }
56
55
  }
57
56
  };
57
+ const handleStarModeChange = (next) => {
58
+ if (next === "all" || next === "favorites" || next === "none") {
59
+ if (typeof onSidebarFavoriteStarModeChange === "function") {
60
+ onSidebarFavoriteStarModeChange(next);
61
+ } else if (typeof onToggleSidebarFavoriteStar === "function") {
62
+ onToggleSidebarFavoriteStar(next !== "none");
63
+ }
64
+ }
65
+ };
58
66
  const rows = [
59
67
  h(
60
68
  "div",
@@ -80,29 +88,7 @@ function ArchiveBundleConfigCard(props) {
80
88
  })
81
89
  )
82
90
  ];
83
- if (typeof onToggleOnlineUpdate === "function") {
84
- const updateDesc = onlineUpdateLocked ? `${t("update.entry.desc")} (${t("update.entry.locked")})` : t("update.entry.desc");
85
- rows.push(
86
- h(
87
- "div",
88
- { key: "online-update", className: "dsham_bundle_row" },
89
- h(
90
- "div",
91
- { className: "dsham_bundle_label_box" },
92
- h("span", { className: "dsham_bundle_title" }, t("update.entry.title")),
93
- h("span", { className: "dsham_bundle_desc" }, updateDesc)
94
- ),
95
- h(PrimitiveSwitch, {
96
- checked: onlineUpdateEnabled,
97
- onChange: onToggleOnlineUpdate,
98
- label: t("update.entry.toggle"),
99
- disabled: onlineUpdateDisabled || onlineUpdateLocked,
100
- title: onlineUpdateLocked ? t("update.entry.locked") : void 0
101
- })
102
- )
103
- );
104
- }
105
- if (typeof onToggleSidebarFavoriteStar === "function") {
91
+ if (typeof onSidebarFavoriteStarModeChange === "function" || typeof onToggleSidebarFavoriteStar === "function") {
106
92
  rows.push(
107
93
  h(
108
94
  "div",
@@ -113,11 +99,17 @@ function ArchiveBundleConfigCard(props) {
113
99
  h("span", { className: "dsham_bundle_title" }, t("sidebar.favoriteStar.title")),
114
100
  h("span", { className: "dsham_bundle_desc" }, t("sidebar.favoriteStar.desc"))
115
101
  ),
116
- h(PrimitiveSwitch, {
117
- checked: sidebarFavoriteStarEnabled,
118
- onChange: onToggleSidebarFavoriteStar,
119
- label: t("sidebar.favoriteStar.toggle"),
120
- disabled: sidebarFavoriteStarDisabled
102
+ h(SegmentedControl, {
103
+ id: "dsham-bundle-favorite-star-mode",
104
+ value: effectiveStarMode,
105
+ onChange: handleStarModeChange,
106
+ label: t("sidebar.favoriteStar.title"),
107
+ disabled: sidebarFavoriteStarDisabled ?? disabled,
108
+ options: [
109
+ { value: "all", label: t("sidebar.favoriteStar.all") },
110
+ { value: "favorites", label: t("sidebar.favoriteStar.favorites") },
111
+ { value: "none", label: t("sidebar.favoriteStar.none") }
112
+ ]
121
113
  })
122
114
  )
123
115
  );
@@ -126,25 +118,23 @@ function ArchiveBundleConfigCard(props) {
126
118
  }
127
119
  function ArchiveBundleConfigCardWrapper(props) {
128
120
  const [location, setLocation] = React.useState(props.getLocation);
129
- const [onlineUpdateEnabled, setOnlineUpdateEnabled] = React.useState(props.getOnlineUpdateEnabled ? props.getOnlineUpdateEnabled : () => true);
130
- const [onlineUpdateLocked, setOnlineUpdateLocked] = React.useState(props.getOnlineUpdateLocked ? props.getOnlineUpdateLocked : () => false);
131
- const [sidebarFavoriteStarEnabled, setSidebarFavoriteStarEnabled] = React.useState(props.getSidebarFavoriteStarEnabled ? props.getSidebarFavoriteStarEnabled : () => true);
121
+ const resolveInitialStarMode = () => {
122
+ if (props.getSidebarFavoriteStarMode) return props.getSidebarFavoriteStarMode();
123
+ if (props.getSidebarFavoriteStarEnabled) return props.getSidebarFavoriteStarEnabled() ? "all" : "none";
124
+ return "all";
125
+ };
126
+ const [sidebarFavoriteStarMode, setSidebarFavoriteStarMode] = React.useState(resolveInitialStarMode);
132
127
  const [saveError, setSaveError] = React.useState(null);
133
128
  const [savingLocation, setSavingLocation] = React.useState(false);
134
- const [savingUpdate, setSavingUpdate] = React.useState(false);
135
129
  const [savingFavoriteStar, setSavingFavoriteStar] = React.useState(false);
136
130
  React.useEffect(() => {
137
131
  const syncState = () => {
138
132
  setLocation(props.getLocation());
139
133
  setSaveError(null);
140
- if (props.getOnlineUpdateEnabled) {
141
- setOnlineUpdateEnabled(props.getOnlineUpdateEnabled());
142
- }
143
- if (props.getOnlineUpdateLocked) {
144
- setOnlineUpdateLocked(props.getOnlineUpdateLocked());
145
- }
146
- if (props.getSidebarFavoriteStarEnabled) {
147
- setSidebarFavoriteStarEnabled(props.getSidebarFavoriteStarEnabled());
134
+ if (props.getSidebarFavoriteStarMode) {
135
+ setSidebarFavoriteStarMode(props.getSidebarFavoriteStarMode());
136
+ } else if (props.getSidebarFavoriteStarEnabled) {
137
+ setSidebarFavoriteStarMode(props.getSidebarFavoriteStarEnabled() ? "all" : "none");
148
138
  }
149
139
  };
150
140
  syncState();
@@ -162,25 +152,12 @@ function ArchiveBundleConfigCardWrapper(props) {
162
152
  setSavingLocation(false);
163
153
  });
164
154
  };
165
- const onToggleOnlineUpdate = props.setOnlineUpdate ? (next) => {
166
- if (props.getOnlineUpdateLocked?.()) return;
167
- setSavingUpdate(true);
168
- setOnlineUpdateEnabled(next);
169
- props.setOnlineUpdate(next).catch(() => {
170
- if (props.getOnlineUpdateEnabled) {
171
- setOnlineUpdateEnabled(props.getOnlineUpdateEnabled());
172
- }
173
- }).finally(() => {
174
- setSavingUpdate(false);
175
- });
176
- } : void 0;
177
- const onToggleSidebarFavoriteStar = props.setSidebarFavoriteStar ? (next) => {
155
+ const onSidebarFavoriteStarModeChange = props.setSidebarFavoriteStarMode || props.setSidebarFavoriteStar ? (next) => {
178
156
  setSavingFavoriteStar(true);
179
- setSidebarFavoriteStarEnabled(next);
180
- props.setSidebarFavoriteStar(next).catch(() => {
181
- if (props.getSidebarFavoriteStarEnabled) {
182
- setSidebarFavoriteStarEnabled(props.getSidebarFavoriteStarEnabled());
183
- }
157
+ setSidebarFavoriteStarMode(next);
158
+ const savePromise = props.setSidebarFavoriteStarMode ? props.setSidebarFavoriteStarMode(next) : props.setSidebarFavoriteStar(next !== "none");
159
+ savePromise.catch(() => {
160
+ setSidebarFavoriteStarMode(resolveInitialStarMode());
184
161
  }).finally(() => {
185
162
  setSavingFavoriteStar(false);
186
163
  });
@@ -191,13 +168,11 @@ function ArchiveBundleConfigCardWrapper(props) {
191
168
  errorMessage: saveError,
192
169
  disabled: savingLocation,
193
170
  onLocationChange,
194
- onlineUpdateEnabled,
195
- onlineUpdateDisabled: savingUpdate || onlineUpdateLocked,
196
- onlineUpdateLocked,
197
- onToggleOnlineUpdate,
198
- sidebarFavoriteStarEnabled,
171
+ sidebarFavoriteStarMode,
172
+ sidebarFavoriteStarEnabled: sidebarFavoriteStarMode !== "none",
199
173
  sidebarFavoriteStarDisabled: savingFavoriteStar,
200
- onToggleSidebarFavoriteStar
174
+ onSidebarFavoriteStarModeChange,
175
+ onToggleSidebarFavoriteStar: onSidebarFavoriteStarModeChange ? (enabled) => onSidebarFavoriteStarModeChange(enabled ? "all" : "none") : void 0
201
176
  });
202
177
  }
203
178
  function setupSidebarEntry(ctx, options) {
@@ -210,11 +185,10 @@ function setupSidebarEntry(ctx, options) {
210
185
  isEnabled: () => false,
211
186
  isSupported: () => false,
212
187
  setEnabled: async () => false,
213
- isOnlineUpdateEnabled: () => true,
214
- isOnlineUpdateLocked: () => false,
215
- setOnlineUpdate: async () => false,
216
188
  isSidebarFavoriteStarEnabled: () => true,
217
189
  setSidebarFavoriteStar: async () => false,
190
+ getSidebarFavoriteStarMode: () => "all",
191
+ setSidebarFavoriteStarMode: async () => "all",
218
192
  destroy: () => {
219
193
  }
220
194
  };
@@ -341,57 +315,22 @@ function setupSidebarEntry(ctx, options) {
341
315
  await setLocation(next ? "both" : "settings");
342
316
  return isSidebarEnabled();
343
317
  };
344
- let onlineUpdateEnabled = true;
345
- let onlineUpdateLocked = false;
346
- let updateEpoch = 0;
347
- const setOnlineUpdate = async (next) => {
348
- if (destroyed || onlineUpdateLocked) return onlineUpdateEnabled;
349
- const currentEpoch = ++updateEpoch;
350
- onlineUpdateEnabled = next;
318
+ let sidebarFavoriteStarMode = "all";
319
+ let favoriteStarEpoch = 0;
320
+ const setSidebarFavoriteStarMode = async (next) => {
321
+ if (destroyed) return sidebarFavoriteStarMode;
322
+ const currentEpoch = ++favoriteStarEpoch;
323
+ const previous = sidebarFavoriteStarMode;
324
+ sidebarFavoriteStarMode = next;
351
325
  notify();
352
- if (typeof options.onOnlineUpdateChange === "function") {
326
+ if (typeof options.onSidebarFavoriteStarModeChange === "function") {
353
327
  try {
354
- options.onOnlineUpdateChange(next);
328
+ options.onSidebarFavoriteStarModeChange(next);
355
329
  } catch {
356
330
  }
357
- }
358
- try {
359
- await callApi("/online-update", {
360
- method: "POST",
361
- headers: { "content-type": "application/json" },
362
- body: JSON.stringify({ enabled: next })
363
- });
364
- if (currentEpoch === updateEpoch && typeof options.onOnlineUpdateChange === "function") {
365
- try {
366
- options.onOnlineUpdateChange(next);
367
- } catch {
368
- }
369
- }
370
- return next;
371
- } catch (err) {
372
- if (currentEpoch === updateEpoch) {
373
- onlineUpdateEnabled = !next;
374
- notify();
375
- if (typeof options.onOnlineUpdateChange === "function") {
376
- try {
377
- options.onOnlineUpdateChange(!next);
378
- } catch {
379
- }
380
- }
381
- }
382
- throw err;
383
- }
384
- };
385
- let sidebarFavoriteStarEnabled = true;
386
- let favoriteStarEpoch = 0;
387
- const setSidebarFavoriteStar = async (next) => {
388
- if (destroyed) return sidebarFavoriteStarEnabled;
389
- const currentEpoch = ++favoriteStarEpoch;
390
- sidebarFavoriteStarEnabled = next;
391
- notify();
392
- if (typeof options.onSidebarFavoriteStarChange === "function") {
331
+ } else if (typeof options.onSidebarFavoriteStarChange === "function") {
393
332
  try {
394
- options.onSidebarFavoriteStarChange(next);
333
+ options.onSidebarFavoriteStarChange(next !== "none");
395
334
  } catch {
396
335
  }
397
336
  }
@@ -399,16 +338,21 @@ function setupSidebarEntry(ctx, options) {
399
338
  await callApi("/sidebar-favorite-star", {
400
339
  method: "POST",
401
340
  headers: { "content-type": "application/json" },
402
- body: JSON.stringify({ enabled: next })
341
+ body: JSON.stringify({ mode: next, enabled: next !== "none" })
403
342
  });
404
343
  return next;
405
344
  } catch (err) {
406
345
  if (currentEpoch === favoriteStarEpoch) {
407
- sidebarFavoriteStarEnabled = !next;
346
+ sidebarFavoriteStarMode = previous;
408
347
  notify();
409
- if (typeof options.onSidebarFavoriteStarChange === "function") {
348
+ if (typeof options.onSidebarFavoriteStarModeChange === "function") {
410
349
  try {
411
- options.onSidebarFavoriteStarChange(!next);
350
+ options.onSidebarFavoriteStarModeChange(previous);
351
+ } catch {
352
+ }
353
+ } else if (typeof options.onSidebarFavoriteStarChange === "function") {
354
+ try {
355
+ options.onSidebarFavoriteStarChange(previous !== "none");
412
356
  } catch {
413
357
  }
414
358
  }
@@ -416,6 +360,10 @@ function setupSidebarEntry(ctx, options) {
416
360
  throw err;
417
361
  }
418
362
  };
363
+ const setSidebarFavoriteStar = async (next) => {
364
+ const res = await setSidebarFavoriteStarMode(next ? "all" : "none");
365
+ return res !== "none";
366
+ };
419
367
  const loadEpoch = epoch;
420
368
  callApi("/sidebar-entry").then((res) => {
421
369
  if (!destroyed && epoch === loadEpoch && res) {
@@ -435,29 +383,23 @@ function setupSidebarEntry(ctx, options) {
435
383
  }
436
384
  }).catch(() => {
437
385
  });
438
- const loadUpdateEpoch = updateEpoch;
439
- callApi("/online-update").then((res) => {
440
- if (!destroyed && updateEpoch === loadUpdateEpoch && res && typeof res.enabled === "boolean") {
441
- onlineUpdateEnabled = res.enabled;
442
- if (res.locked === true) onlineUpdateLocked = true;
386
+ const loadFavoriteStarEpoch = favoriteStarEpoch;
387
+ callApi("/sidebar-favorite-star").then((res) => {
388
+ if (!destroyed && favoriteStarEpoch === loadFavoriteStarEpoch && res) {
389
+ if (res.mode === "all" || res.mode === "favorites" || res.mode === "none") {
390
+ sidebarFavoriteStarMode = res.mode;
391
+ } else if (typeof res.enabled === "boolean") {
392
+ sidebarFavoriteStarMode = res.enabled ? "all" : "none";
393
+ }
443
394
  notify();
444
- if (typeof options.onOnlineUpdateChange === "function") {
395
+ if (typeof options.onSidebarFavoriteStarModeChange === "function") {
445
396
  try {
446
- options.onOnlineUpdateChange(onlineUpdateEnabled);
397
+ options.onSidebarFavoriteStarModeChange(sidebarFavoriteStarMode);
447
398
  } catch {
448
399
  }
449
- }
450
- }
451
- }).catch(() => {
452
- });
453
- const loadFavoriteStarEpoch = favoriteStarEpoch;
454
- callApi("/sidebar-favorite-star").then((res) => {
455
- if (!destroyed && favoriteStarEpoch === loadFavoriteStarEpoch && res && typeof res.enabled === "boolean") {
456
- sidebarFavoriteStarEnabled = res.enabled;
457
- notify();
458
- if (typeof options.onSidebarFavoriteStarChange === "function") {
400
+ } else if (typeof options.onSidebarFavoriteStarChange === "function") {
459
401
  try {
460
- options.onSidebarFavoriteStarChange(sidebarFavoriteStarEnabled);
402
+ options.onSidebarFavoriteStarChange(sidebarFavoriteStarMode !== "none");
461
403
  } catch {
462
404
  }
463
405
  }
@@ -502,11 +444,10 @@ function setupSidebarEntry(ctx, options) {
502
444
  setLocation,
503
445
  getEnabled: () => isSidebarEnabled(),
504
446
  setSidebar: setEnabled,
505
- getOnlineUpdateEnabled: () => onlineUpdateEnabled,
506
- setOnlineUpdate,
507
- getOnlineUpdateLocked: () => onlineUpdateLocked,
508
- getSidebarFavoriteStarEnabled: () => sidebarFavoriteStarEnabled,
447
+ getSidebarFavoriteStarEnabled: () => sidebarFavoriteStarMode !== "none",
509
448
  setSidebarFavoriteStar,
449
+ getSidebarFavoriteStarMode: () => sidebarFavoriteStarMode,
450
+ setSidebarFavoriteStarMode,
510
451
  subscribe: (fn) => {
511
452
  listeners.add(fn);
512
453
  return () => {
@@ -523,16 +464,14 @@ function setupSidebarEntry(ctx, options) {
523
464
  isEnabled: () => isSidebarEnabled(),
524
465
  isSupported: () => sidebarSupported,
525
466
  setEnabled,
526
- isOnlineUpdateEnabled: () => onlineUpdateEnabled,
527
- isOnlineUpdateLocked: () => onlineUpdateLocked,
528
- setOnlineUpdate,
529
- isSidebarFavoriteStarEnabled: () => sidebarFavoriteStarEnabled,
467
+ isSidebarFavoriteStarEnabled: () => sidebarFavoriteStarMode !== "none",
530
468
  setSidebarFavoriteStar,
469
+ getSidebarFavoriteStarMode: () => sidebarFavoriteStarMode,
470
+ setSidebarFavoriteStarMode,
531
471
  destroy: () => {
532
472
  if (destroyed) return;
533
473
  destroyed = true;
534
474
  epoch++;
535
- updateEpoch++;
536
475
  favoriteStarEpoch++;
537
476
  layoutService = void 0;
538
477
  listeners.clear();
package/locale/de.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Archive Manager",
4
+ "description": "Sitzungen archivieren, wiederherstellen, als Favorit markieren und endgültig löschen sowie beschädigte Sitzungsprotokolle diagnostizieren.",
5
+ "detail": "README.de.md"
6
+ }
7
+ }
package/locale/en.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Archive Manager",
4
- "description": "Archive, restore, favorite, and permanently delete sessions, and diagnose damaged session logs."
4
+ "description": "Archive, restore, favorite, and permanently delete sessions, and diagnose damaged session logs.",
5
+ "detail": "README.en.md"
5
6
  }
6
7
  }
package/locale/es.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Archive Manager",
4
+ "description": "Archivar, restaurar, marcar como favoritos y eliminar permanentemente sesiones, y diagnosticar registros de sesión dañados.",
5
+ "detail": "README.es.md"
6
+ }
7
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Archive Manager",
4
+ "description": "Archiver, restaurer, ajouter aux favoris et supprimer définitivement des sessions, et diagnostiquer les journaux de session endommagés.",
5
+ "detail": "README.fr.md"
6
+ }
7
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Archive Manager",
4
+ "description": "セッションのアーカイブ、復元、お気に入り、完全削除、および破損したセッションログの診断。",
5
+ "detail": "README.ja.md"
6
+ }
7
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Archive Manager",
4
+ "description": "Arquivar, restaurar, favoritar e excluir permanentemente sessões, e diagnosticar registros de sessão danificados.",
5
+ "detail": "README.pt.md"
6
+ }
7
+ }
package/locale/ru.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Archive Manager",
4
- "description": "Архивируйте, восстанавливайте, добавляйте в избранное и окончательно удаляйте сессии, а также диагностируйте повреждённые журналы сессий."
4
+ "description": "Архивируйте, восстанавливайте, добавляйте в избранное и окончательно удаляйте сессии, а также диагностируйте повреждённые журналы сессий.",
5
+ "detail": "README.ru.md"
5
6
  }
6
7
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Archive Manager",
4
- "description": "归档、恢复、收藏和永久删除会话,并诊断损坏的会话日志。"
4
+ "description": "归档、恢复、收藏和永久删除会话,并诊断损坏的会话日志。",
5
+ "detail": "README.zh-CN.md"
5
6
  }
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-archive-manager",
3
- "version": "1.2.8",
3
+ "version": "1.3.1",
4
4
  "description": "归档、恢复、收藏和永久删除会话,并诊断损坏的会话日志。 · Archive, restore, favorite, and permanently delete sessions, and diagnose damaged session logs.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.22.0",
@@ -15,6 +15,7 @@
15
15
  "./projcache": "./lib/projcache.js",
16
16
  "./host": "./lib/host-install.js",
17
17
  "./client": "./lib/client.js",
18
+ "./icon": "./assets/icon.svg",
18
19
  "./package.json": "./package.json",
19
20
  "./locale/*.json": "./locale/*.json"
20
21
  },
@@ -25,7 +26,12 @@
25
26
  "cordis.patch.yml",
26
27
  "README.md",
27
28
  "README.en.md",
29
+ "README.ja.md",
30
+ "README.es.md",
31
+ "README.fr.md",
32
+ "README.de.md",
28
33
  "README.ru.md",
34
+ "README.pt.md",
29
35
  "README.zh-CN.md",
30
36
  "LICENSE",
31
37
  "CHANGELOG.md",
@@ -106,7 +112,9 @@
106
112
  "zustand": "4.4.7"
107
113
  },
108
114
  "license": "Apache-2.0",
115
+ "author": "MichengAI",
109
116
  "dsh": {
117
+ "manifestVersion": 1,
110
118
  "bundle": {
111
119
  "patch": "./cordis.patch.yml"
112
120
  },
@@ -136,6 +144,9 @@
136
144
  "dsh-plugin",
137
145
  "archive",
138
146
  "session-management",
147
+ "diagnose",
148
+ "favorites",
149
+ "restore",
139
150
  "cordis",
140
151
  "typert",
141
152
  "workspace",