dshmarket 1.73.8 → 1.73.9

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
@@ -8169,6 +8169,28 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
8169
8169
  * interpreted as markup); remaining text arrives as React children or
8170
8170
  * controlled nodes only.
8171
8171
  */
8172
+ /**
8173
+ * An <img> whose src lives on raw.githubusercontent.com, walked through the
8174
+ * raw GitHub route candidates on failure (#1070 follow-up): the update-notes
8175
+ * dialog was the last place still loading those images directly, so on
8176
+ * networks where raw is unreachable the notes rendered with holes. When every
8177
+ * candidate fails the last one is the direct URL, exactly the old behavior.
8178
+ */
8179
+ function GithubRoutedImg({ src, alt, className, key }) {
8180
+ const [routeIndex, setRouteIndex] = (0, react.useState)(0);
8181
+ const candidates = githubRouteCandidates("raw", src);
8182
+ const candidate = candidates[Math.min(routeIndex, candidates.length - 1)];
8183
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8184
+ className,
8185
+ src: candidate.url,
8186
+ alt,
8187
+ loading: "lazy",
8188
+ onLoad: () => rememberGithubRoute("raw", candidate.proxy),
8189
+ onError: () => {
8190
+ if (routeIndex + 1 < candidates.length) setRouteIndex(routeIndex + 1);
8191
+ }
8192
+ }, key);
8193
+ }
8172
8194
  function renderMarkdown(md) {
8173
8195
  const out = [];
8174
8196
  let bullets = null;
@@ -8210,11 +8232,10 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
8210
8232
  const image = releaseNotesHttpsImage(trimmed);
8211
8233
  if (image !== null) {
8212
8234
  flushList();
8213
- out.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8235
+ out.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubRoutedImg, {
8214
8236
  className: Market_module_css_default.notesImg,
8215
8237
  src: image.src,
8216
- alt: image.alt,
8217
- loading: "lazy"
8238
+ alt: image.alt
8218
8239
  }, `i${out.length}`));
8219
8240
  continue;
8220
8241
  }
@@ -8255,17 +8276,26 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
8255
8276
  const [failed, setFailed] = (0, react.useState)(false);
8256
8277
  const [routeIndex, setRouteIndex] = (0, react.useState)(0);
8257
8278
  const [iconFailed, setIconFailed] = (0, react.useState)(false);
8279
+ const [iconRouteIndex, setIconRouteIndex] = (0, react.useState)(0);
8258
8280
  const av = className === void 0 ? Market_module_css_default.av : `${Market_module_css_default.av} ${className}`;
8259
8281
  const tile = iconFailed ? null : safeIcon(icon);
8260
- if (tile !== null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8261
- className: av,
8262
- src: tile,
8263
- alt: "",
8264
- loading: "lazy",
8265
- decoding: "async",
8266
- referrerPolicy: "no-referrer",
8267
- onError: () => setIconFailed(true)
8268
- });
8282
+ if (tile !== null) {
8283
+ const candidates = githubRouteCandidates("raw", tile);
8284
+ const candidate = candidates[Math.min(iconRouteIndex, candidates.length - 1)];
8285
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8286
+ className: av,
8287
+ src: candidate.url,
8288
+ alt: "",
8289
+ loading: "lazy",
8290
+ decoding: "async",
8291
+ referrerPolicy: "no-referrer",
8292
+ onLoad: () => rememberGithubRoute("raw", candidate.proxy),
8293
+ onError: () => {
8294
+ if (iconRouteIndex + 1 < candidates.length) setIconRouteIndex(iconRouteIndex + 1);
8295
+ else setIconFailed(true);
8296
+ }
8297
+ });
8298
+ }
8269
8299
  if (failed || owner === "") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8270
8300
  className: av,
8271
8301
  style: { background: avatarColor(name) },
@@ -9,7 +9,7 @@
9
9
  * counts and time. No prompts, transcripts, tool input, environment values, or
10
10
  * paths.
11
11
  */
12
- import { appendFileSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
12
+ import { appendFileSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, statSync, writeFileSync } from 'node:fs';
13
13
  import { dirname } from 'node:path';
14
14
  import { redactHomePaths } from './log-redaction.js';
15
15
  const MAX_BYTES = 64 * 1024;
@@ -58,6 +58,32 @@ function parseLine(line) {
58
58
  agentsAtEnd: row.agentsAtEnd,
59
59
  };
60
60
  }
61
+ /**
62
+ * Whether the file is empty or its last byte is a newline — i.e. whether an
63
+ * append starts a line of its own. Reads one byte rather than the file: this
64
+ * runs on every completed operation, and the journal is bounded but not tiny.
65
+ */
66
+ function endsWithNewline(file) {
67
+ try {
68
+ const size = statSync(file).size;
69
+ if (size === 0)
70
+ return true;
71
+ const fd = openSync(file, 'r');
72
+ try {
73
+ const last = Buffer.alloc(1);
74
+ readSync(fd, last, 0, 1, size - 1);
75
+ return last[0] === 0x0a;
76
+ }
77
+ finally {
78
+ closeSync(fd);
79
+ }
80
+ }
81
+ catch {
82
+ // No file yet (a fresh append creates it) or unreadable: appending a
83
+ // leading newline to a missing file would only add a blank line.
84
+ return true;
85
+ }
86
+ }
61
87
  export class DrainJournal {
62
88
  file;
63
89
  maxBytes;
@@ -82,7 +108,12 @@ export class DrainJournal {
82
108
  if (this.records.length > MAX_RECORDS)
83
109
  this.records.splice(0, this.records.length - MAX_RECORDS);
84
110
  mkdirSync(dirname(this.file), { recursive: true });
85
- appendFileSync(this.file, `${JSON.stringify(cleaned)}\n`);
111
+ // An interrupted write leaves a tail without its newline. Appending to it
112
+ // would glue this record onto the damaged one, so the file would carry a
113
+ // single unparseable line and BOTH would be lost on reopen — the record
114
+ // this append just completed included (#1084). The damaged tail is
115
+ // dropped by load() on its own; this only keeps the next record separate.
116
+ appendFileSync(this.file, `${endsWithNewline(this.file) ? '' : '\n'}${JSON.stringify(cleaned)}\n`);
86
117
  if (existsSync(this.file) && statSync(this.file).size > this.maxBytes)
87
118
  this.trim();
88
119
  }
package/lib/updates.js CHANGED
@@ -885,7 +885,18 @@ options = {}) {
885
885
  const mayFollowATag = !upgrade
886
886
  && (version?.includes('-') === true || (stable !== null && version !== null && isUpgrade(stable, version) === false && stable !== version));
887
887
  const newerPrerelease = mayFollowATag ? await newerPrereleaseFor(name, version) : null;
888
- const desktopStable = options.holdYoungReleases === true && channel === undefined
888
+ // `channel === undefined` used to stand for "this row follows `latest`",
889
+ // and the market itself always has a channel (it is the one package
890
+ // the setting is for), so the mature-release fallback (#1019) skipped
891
+ // exactly the package that needs it most. The market releases about
892
+ // daily: every release restarted the age window on `/latest`, so the
893
+ // row showed "up to date" while releases from the previous two days
894
+ // were long past the window (#1087). What the guard actually means is
895
+ // "the target this row follows IS `latest`" — true on the stable
896
+ // channel, and false only when beta/dev resolve something newer, where
897
+ // a mature stable candidate is not the version the user asked for.
898
+ const followsLatest = channel === undefined || (stable !== null && latest === stable);
899
+ const desktopStable = options.holdYoungReleases === true && followsLatest
889
900
  && isStableReleaseVersion(version)
890
901
  && !/^https?:/i.test(spec) && !spec.includes(':') && !spec.includes('/');
891
902
  const mature = desktopStable && upgrade
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.8",
4
+ "version": "1.73.9",
5
5
  "icon": "assets/logo.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",