dshmarket 1.73.18 → 1.73.19

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.
@@ -22,7 +22,9 @@ const FAILURE_COOLDOWN_MS = 5 * 60 * 1000;
22
22
  const OUTAGE_COOLDOWN_MS = 30 * 1000;
23
23
  const FETCH_TIMEOUT_MS = 8_000;
24
24
  const DEFAULT_CONCURRENCY = 8;
25
- const MAX_CACHE_ENTRIES = 5_000;
25
+ // Larger than the catalog (10k+ and growing). A cap below the catalog size
26
+ // made a full scan evict its own first half, so no scan ever stayed cached (#1170).
27
+ const MAX_CACHE_ENTRIES = 20_000;
26
28
  const MAX_RANGE_LENGTH = 256;
27
29
  /** Reuse catalog facts only for this repository's exact pinned install asset. */
28
30
  export function catalogReleaseManifest(source) {
package/lib/drain.js CHANGED
@@ -52,6 +52,15 @@ function record(value) {
52
52
  function text(value) {
53
53
  return typeof value === 'string' && value.trim() !== '' ? value.trim() : null;
54
54
  }
55
+ /** True when the executor reported a completed change. */
56
+ function landed(result) {
57
+ const payload = record(result.payload);
58
+ return result.status >= 200 && result.status < 300 && payload?.ok !== false && payload?.cancelled !== true;
59
+ }
60
+ /** Mark a finished result as having outlived its market instance. */
61
+ function markReloaded(result) {
62
+ return { ...result, payload: { ...(record(result.payload) ?? {}), marketReloaded: true } };
63
+ }
55
64
  /** User-facing failure text, stripped of control characters and home paths. */
56
65
  function safeMessage(value) {
57
66
  const raw = text(value);
@@ -431,7 +440,13 @@ export class DrainCoordinator {
431
440
  if (this.disposeRequested)
432
441
  this.detach();
433
442
  }
434
- if (this.disposeRequested) {
443
+ if (this.disposeRequested && !operation.cancelRequested && !this.barrierBroken && landed(result)) {
444
+ // The executor returned success: the package is on disk. The market being
445
+ // unloaded afterwards does not make that a cancellation (#1151).
446
+ result = markReloaded(result);
447
+ this.finishFromResult(operation, result);
448
+ }
449
+ else if (this.disposeRequested) {
435
450
  result = {
436
451
  status: 503,
437
452
  payload: {
@@ -455,12 +470,12 @@ export class DrainCoordinator {
455
470
  payload: {
456
471
  ok: false,
457
472
  failureCode: 'AGENT_BARRIER_LOST',
458
- error: 'an Agent could not be held at the maintenance boundary; verify the installed files before retrying',
473
+ error: '有会话在操作进行中恢复了活动,文件可能已经改动。先在「已安装」里看看结果,等会话空闲后再试。 / A session became active while the operation ran, so files may have changed. Check Installed for the result, then retry once sessions are idle.',
459
474
  },
460
475
  };
461
476
  this.finish(operation, 'failed', {
462
477
  code: 'AGENT_BARRIER_LOST',
463
- message: 'an Agent could not be held at the maintenance boundary; verify the installed files before retrying',
478
+ message: '有会话在操作进行中恢复了活动,文件可能已经改动。先在「已安装」里看看结果,等会话空闲后再试。 / A session became active while the operation ran, so files may have changed. Check Installed for the result, then retry once sessions are idle.',
464
479
  }, null);
465
480
  }
466
481
  else {
@@ -479,7 +494,7 @@ export class DrainCoordinator {
479
494
  if (this.barrierBroken) {
480
495
  this.finish(operation, 'failed', {
481
496
  code: 'AGENT_BARRIER_LOST',
482
- message: 'an Agent could not be held at the maintenance boundary; the plugin operation was not started',
497
+ message: '有会话恢复了活动,这次没有改任何文件。等会话空闲后再试。 / A session became active; nothing was changed. Retry once sessions are idle.',
483
498
  }, null);
484
499
  return;
485
500
  }
@@ -491,7 +506,7 @@ export class DrainCoordinator {
491
506
  else if (this.barrierBroken) {
492
507
  this.finish(operation, 'failed', {
493
508
  code: 'AGENT_BARRIER_LOST',
494
- message: 'an Agent could not be held at the maintenance boundary; the plugin operation was not started',
509
+ message: '有会话恢复了活动,这次没有改任何文件。等会话空闲后再试。 / A session became active; nothing was changed. Retry once sessions are idle.',
495
510
  }, null);
496
511
  }
497
512
  else {
@@ -544,9 +559,13 @@ export class DrainCoordinator {
544
559
  operation.startedAt = this.now();
545
560
  this.notify(operation);
546
561
  const result = await operation.execute(operation.intent, operation.onPhase);
547
- // The executor can return success after a cancel or unload landed too
548
- // late for its last gate. The Host's state wins: the user asked to stop
549
- // or the market is gone, so this is not reported as a completed change.
562
+ // A cancel wins over a late success: the user asked to stop. An unload
563
+ // does not: a success result means the package command finished and the
564
+ // files are on disk, so it is recorded as done (#1151).
565
+ if (this.disposeRequested && !operation.cancelRequested && !this.barrierBroken && landed(result)) {
566
+ this.finishFromResult(operation, markReloaded(result));
567
+ return;
568
+ }
550
569
  if (this.disposeRequested) {
551
570
  this.finish(operation, 'cancelled', {
552
571
  code: 'MARKET_UNLOADED',
@@ -561,7 +580,7 @@ export class DrainCoordinator {
561
580
  if (this.barrierBroken) {
562
581
  this.finish(operation, 'failed', {
563
582
  code: 'AGENT_BARRIER_LOST',
564
- message: 'an Agent started work while the package operation was running; verify the installed files before retrying',
583
+ message: '有会话在操作进行中恢复了活动,文件可能已经改动。先在「已安装」里看看结果,等会话空闲后再试。 / A session became active while the operation ran, so files may have changed. Check Installed for the result, then retry once sessions are idle.',
565
584
  }, null);
566
585
  return;
567
586
  }
package/lib/patch.js CHANGED
@@ -579,7 +579,13 @@ export function packagePatchFlags(host, profileDirectory, names, state) {
579
579
  // host, so it is not a decision about this package (#1113): the shape a
580
580
  // package rename leaves behind.
581
581
  const applies = (id) => rowFlagApplies(state, id, composedRowName(host, id));
582
- if (rows.some(id => decidedByUser(id) && applies(id) && state.disables.includes(id)))
582
+ // A package counts as off only when nothing of it is left running: a
583
+ // multi-component plugin with some components switched off is still on
584
+ // (#1150). One disabled row used to flip the whole package, which kept
585
+ // it out of 「全部更新」.
586
+ // Rows that name another module do not count either way (#1113).
587
+ const decidedRows = rows.filter(id => decidedByUser(id) && applies(id));
588
+ if (decidedRows.length > 0 && decidedRows.every(id => state.disables.includes(id)))
583
589
  disabled.push(name);
584
590
  if (rows.some(id => decidedByUser(id) && applies(id) && state.forced.includes(id)))
585
591
  forced.push(name);
package/lib/profile.js CHANGED
@@ -1891,11 +1891,14 @@ function readReleaseAgeBlock(file) {
1891
1891
  * nothing in the file says which main package it belongs to — guessing would
1892
1892
  * delete policy that may still be in effect for something installed.
1893
1893
  *
1894
+ * With `keepVersion` (the update path) the rows that name that version are
1895
+ * kept and only the older ones go.
1896
+ *
1894
1897
  * @returns the entries removed, for the caller to log; empty when there is no
1895
1898
  * such block, no such row, or the file cannot be read exactly (in which case
1896
1899
  * it is left byte-for-byte as it was).
1897
1900
  */
1898
- export function dropReleaseAgeExcludes(profile, name, explicitDir) {
1901
+ export function dropReleaseAgeExcludes(profile, name, explicitDir, keepVersion) {
1899
1902
  const block = readReleaseAgeBlock(join(profileDir(profile, explicitDir), 'pnpm-workspace.yaml'));
1900
1903
  if (block === null)
1901
1904
  return [];
@@ -1906,6 +1909,19 @@ export function dropReleaseAgeExcludes(profile, name, explicitDir) {
1906
1909
  return [item.line];
1907
1910
  if (item.rule.name !== name)
1908
1911
  return [item.original];
1912
+ // After an update (#1093) only rows that do not name the installed version
1913
+ // are stale. A row that names it stays whole — it may be the one pnpm just
1914
+ // wrote for this very update, which the next install's age check needs. A
1915
+ // union that also lists older versions stays too: it is kept or dropped as
1916
+ // written, never rewritten, so nothing here can loosen the gate. A bare
1917
+ // name already covers every version; that is a policy someone chose, not a
1918
+ // leftover.
1919
+ if (keepVersion !== undefined) {
1920
+ if (item.rule.selector === null)
1921
+ return [item.original];
1922
+ if (item.rule.selector.split('||').some(version => version.trim() === keepVersion))
1923
+ return [item.original];
1924
+ }
1909
1925
  dropped.push(item.rule.selector === null ? item.rule.name : `${item.rule.name}@${item.rule.selector}`);
1910
1926
  return [];
1911
1927
  });
package/lib/routes.js CHANGED
@@ -6141,6 +6141,25 @@ export function mountMarketRoutes(host, config, commandRuntime, agentsLookup, ho
6141
6141
  const ignoredBuilds = ok || cancelled || !failedOnBlockedBuilds(result) ? undefined : blockedBuilds(result);
6142
6142
  if (ok)
6143
6143
  clearBrokenPlugin(name);
6144
+ // #1093: the same leftover rows, on the update side. The old
6145
+ // version's `minimumReleaseAgeExclude` row outlives the update and
6146
+ // points at a build that is no longer on disk. Rows naming the
6147
+ // version that IS installed stay: a fresh release may need exactly
6148
+ // that row at the next install.
6149
+ if (ok && !restore) {
6150
+ try {
6151
+ const installedNow = readInstalledVersion(config.profile, name, activeProfileDir);
6152
+ if (installedNow !== null) {
6153
+ const staleExcludes = dropReleaseAgeExcludes(config.profile, name, activeProfileDir, installedNow);
6154
+ if (staleExcludes.length > 0) {
6155
+ logEvent('info', 'update', `${name}: dropped ${String(staleExcludes.length)} minimumReleaseAgeExclude row(s) for versions no longer installed`);
6156
+ }
6157
+ }
6158
+ }
6159
+ catch (error) {
6160
+ logEvent('warn', 'update', `${name}: could not clear old minimumReleaseAgeExclude rows — ${error instanceof Error ? error.message : String(error)}`);
6161
+ }
6162
+ }
6144
6163
  // A package still installed but no longer in dsh.profile.bundles
6145
6164
  // after this run stops loading and says nothing (#720). The market
6146
6165
  // does not write that list from anything but the current list, so
@@ -543,9 +543,12 @@ export declare function dropUnparseableBuildKeys(profile: string, explicitDir?:
543
543
  * nothing in the file says which main package it belongs to — guessing would
544
544
  * delete policy that may still be in effect for something installed.
545
545
  *
546
+ * With `keepVersion` (the update path) the rows that name that version are
547
+ * kept and only the older ones go.
548
+ *
546
549
  * @returns the entries removed, for the caller to log; empty when there is no
547
550
  * such block, no such row, or the file cannot be read exactly (in which case
548
551
  * it is left byte-for-byte as it was).
549
552
  */
550
- export declare function dropReleaseAgeExcludes(profile: string, name: string, explicitDir?: string): string[];
553
+ export declare function dropReleaseAgeExcludes(profile: string, name: string, explicitDir?: string, keepVersion?: string): string[];
551
554
  export declare function mergeDuplicateReleaseAgeExcludes(profile: string, explicitDir?: string): string[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dshmarket",
3
3
  "description": "Visual plugin market inside DeepSeek Harness — browse, search, and one-click install community plugins. · DSH 可视化插件市场:逛一逛,点一下,装好。",
4
- "version": "1.73.18",
4
+ "version": "1.73.19",
5
5
  "icon": "assets/logo.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",