dshmarket 1.73.6 → 1.73.7

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/README.md CHANGED
@@ -32,6 +32,14 @@ One-click themes: install, switch live, no restart.
32
32
  profile name: `dsh plugin --profile <profile> add dshmarket`. Follow your
33
33
  host's restart instructions.
34
34
 
35
+ - **From the GitHub source (no build):** `add github:dsh-market/dsh-market`
36
+ makes pnpm ask before running the package's build scripts. The prebuilt
37
+ tarball attached to the same release installs without that step:
38
+
39
+ ```sh
40
+ dsh plugin --profile <profile> add https://github.com/dsh-market/dsh-market/releases/download/v<version>/dshmarket-<version>.tgz
41
+ ```
42
+
35
43
  On a machine with DSH Desktop, running `dsh plugin --profile web add dshmarket`
36
44
  may report success but installs the market into `profiles/web`, **not** the
37
45
  profile used by the Desktop app. It will not appear in Desktop. Install through
package/README.zh.md CHANGED
@@ -30,6 +30,13 @@
30
30
  - **自定义 profile:** 把命令里的 `web` 换成宿主实际使用的 profile 名称:
31
31
  `dsh plugin --profile <profile> add dshmarket`。之后按宿主的说明重启。
32
32
 
33
+ - **从 GitHub 源码安装(免构建):** `add github:dsh-market/dsh-market` 会让
34
+ pnpm 先征求构建脚本授权。改用同一版本 Release 附带的预构建包,就不需要这一步:
35
+
36
+ ```sh
37
+ dsh plugin --profile <profile> add https://github.com/dsh-market/dsh-market/releases/download/v<version>/dshmarket-<version>.tgz
38
+ ```
39
+
33
40
  在装有 DSH Desktop 的电脑上执行 `dsh plugin --profile web add dshmarket`,
34
41
  命令可能提示成功,但市场装进的是 `profiles/web`,**不是**桌面应用使用的
35
42
  profile,因此不会出现在桌面端。请通过应用内的 **设置 → 插件** 安装;桌面端
package/client/client.js CHANGED
@@ -8724,6 +8724,38 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
8724
8724
  * already-downloaded image shown bigger — there is no separate "thumbnail"
8725
8725
  * vs "full size" asset to fetch.
8726
8726
  */
8727
+ /**
8728
+ * The full-size screenshot, loaded through the configured GitHub route (#1070).
8729
+ *
8730
+ * Screenshots are GitHub-hosted, and on a mainland connection
8731
+ * `raw.githubusercontent.com` is the slowest part of the page — the avatars
8732
+ * next to them already go through the proxy the user chose, while this one
8733
+ * still went direct. The thumbnail keeps its own resizer; this is the one
8734
+ * place that wants the original bytes, so it is the one place the proxy
8735
+ * itself is worth a hop.
8736
+ *
8737
+ * The route order is the same one avatars use: the prefix that last worked
8738
+ * first, then the region's other prefixes, then direct. A failed load walks
8739
+ * the list rather than leaving a blank image.
8740
+ */
8741
+ function LightboxImage({ src, className, onClick }) {
8742
+ const [routeIndex, setRouteIndex] = (0, react.useState)(0);
8743
+ (0, react.useEffect)(() => {
8744
+ setRouteIndex(0);
8745
+ }, [src]);
8746
+ const candidates = githubRouteCandidates("raw", src);
8747
+ const candidate = candidates[Math.min(routeIndex, candidates.length - 1)];
8748
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8749
+ className,
8750
+ src: candidate.url,
8751
+ alt: "",
8752
+ onClick,
8753
+ onLoad: () => rememberGithubRoute("raw", candidate.proxy),
8754
+ onError: () => {
8755
+ if (routeIndex + 1 < candidates.length) setRouteIndex((current) => current + 1);
8756
+ }
8757
+ });
8758
+ }
8727
8759
  function ScreenshotLightbox({ shots, startIndex, onClose, t }) {
8728
8760
  const [index, setIndex] = useAutoCarousel(shots.length, startIndex, 0);
8729
8761
  const titlebarHeight = useWindowTitlebarHeight();
@@ -8755,10 +8787,9 @@ window.__ModuleLoader__.load({ id: "dshmarket", factory: (require) => {
8755
8787
  onClick: onClose,
8756
8788
  children: "×"
8757
8789
  }),
8758
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8790
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LightboxImage, {
8759
8791
  className: Market_module_css_default.lightboxImg,
8760
8792
  src: shots[index],
8761
- alt: "",
8762
8793
  onClick: (e) => e.stopPropagation()
8763
8794
  }),
8764
8795
  shots.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
package/lib/patch.js CHANGED
@@ -243,6 +243,30 @@ export function userPatchPackageReferences(patchPath, packageName) {
243
243
  }
244
244
  return [...insertedNames].filter(reference => reference === packageName || reference.startsWith(`${packageName}/`));
245
245
  }
246
+ /**
247
+ * A loader entry's id as a string, or '' when it has none.
248
+ *
249
+ * `EntryOptions.id` is a TypeScript interface, not a runtime check: an
250
+ * unquoted `- id: 1` in `cordis.patch.yml` is parsed by YAML as the NUMBER 1,
251
+ * the host's loader accepts it, and every `.split(':')` on it then throws —
252
+ * `/dsh-market/installed` answered 400 with an empty body and the UI showed
253
+ * "no community plugins installed" (#1071). The market's own regex parser
254
+ * only ever produces strings, so this is reachable only through the loader.
255
+ *
256
+ * Numbers are stringified rather than dropped: `id: 1` names the same entry
257
+ * the user wrote, and the market's own row comparisons are string-keyed.
258
+ *
259
+ * @param entry - a host loader entry.
260
+ * @returns the id as a string, '' when absent or not a string/number.
261
+ */
262
+ export function loaderEntryId(entry) {
263
+ const id = entry?.options?.id;
264
+ if (typeof id === 'string')
265
+ return id;
266
+ if (typeof id === 'number' && Number.isFinite(id))
267
+ return String(id);
268
+ return '';
269
+ }
246
270
  /** The include entry's id prefix (loader entry ids look like `include:X`). */
247
271
  function includePrefix(host) {
248
272
  for (const entry of host.loader.entries()) {
@@ -289,7 +313,7 @@ export function rowIdsForPackage(host, profileDirectory, packageName) {
289
313
  for (const entry of host.loader.entries()) {
290
314
  if (entry.options?.name !== packageName)
291
315
  continue;
292
- let id = entry.options.id ?? '';
316
+ let id = loaderEntryId(entry);
293
317
  if (id === '')
294
318
  continue;
295
319
  if (prefix !== '' && id.startsWith(prefix))
package/lib/routes.js CHANGED
@@ -51,7 +51,7 @@ import { readJsonBody, refuseUnadmitted, sameOrigin, sendJson } from './http.js'
51
51
  import { resolveDshHome } from './home-paths.js';
52
52
  import { detectedDebugger, detectedSupervisor, restartAllowed, scheduleRestart, servingPort, trustedRestartRequest, trustedDownloadRequest, trustedSelfUninstallRequest, selfUninstallReachableFrom, restartReachableFrom } from './restart.js';
53
53
  import { activationAfterReplace, brokenClientBundles, bundlePatchIsEmpty, checkClientBundle, defaultHostRuntimeFacts, findUnservedConfigNamespaces, hasHostHalf, hostPeerGate, isDeclaredLibraryDsh, newlyBrokenBundles, peerGateRemedy, verifyActivation } from './verify.js';
54
- import { carrierRowIds, disableRow, enableRow, findUserPatchPath, foreignRowIds, isProtectedModule, packagePatchFlags, readUserPatchState, removeRowBlocks, rowIdsForPackage, userPatchPackageReferences, } from './patch.js';
54
+ import { carrierRowIds, disableRow, enableRow, findUserPatchPath, foreignRowIds, isProtectedModule, loaderEntryId, packagePatchFlags, readUserPatchState, removeRowBlocks, rowIdsForPackage, userPatchPackageReferences, } from './patch.js';
55
55
  import { createProfileBackup, downloadWebdav, MAX_BACKUP_BYTES, mergeRestoreManifest, restoreProfileBackup, unportableDeps, uploadWebdav, WebdavUrlError, } from './backup.js';
56
56
  import { createGist, fitsGistLimit, GistError, gistErrorCode, parseGistId, readGist, resolveGistTokenSource, updateGist, verifyGistToken, } from './gist.js';
57
57
  import { MAX_UPDATE_OPERATIONS_V1, UpdateOperationStoreV1, UPDATE_API_V1_SCHEMA } from './update-api-v1.js';
@@ -1250,11 +1250,15 @@ export function mountMarketRoutes(host, config, commandRuntime, agentsLookup, ho
1250
1250
  // here — but the id it created does, and that id is unique to its
1251
1251
  // patch. Verification needs both, and putting them in one set means
1252
1252
  // no call site can pass the names and forget the ids.
1253
- if (entry.options.id !== undefined && entry.options.id !== '') {
1254
- live.add(`#${entry.options.id}`);
1253
+ // `id: 1` in the patch file is a NUMBER by the time the loader holds
1254
+ // it, and `.split` on it took the whole `/installed` handler down with
1255
+ // a 400 and an empty body (#1071).
1256
+ const entryId = loaderEntryId(entry);
1257
+ if (entryId !== '') {
1258
+ live.add(`#${entryId}`);
1255
1259
  // Loader ids may carry an include prefix (`include:archify-…`).
1256
- const bare = entry.options.id.split(':').pop();
1257
- if (bare !== undefined && bare !== entry.options.id)
1260
+ const bare = entryId.split(':').pop();
1261
+ if (bare !== undefined && bare !== entryId)
1258
1262
  live.add(`#${bare}`);
1259
1263
  }
1260
1264
  }
@@ -3168,8 +3172,9 @@ export function mountMarketRoutes(host, config, commandRuntime, agentsLookup, ho
3168
3172
  for (const id of ids)
3169
3173
  servedEntryIds.add(id);
3170
3174
  for (const entry of host.loader.entries()) {
3171
- const id = entry.options?.id;
3172
- if (id === undefined || id === '')
3175
+ // Same numeric-id trap as `liveNames()` (#1071).
3176
+ const id = loaderEntryId(entry);
3177
+ if (id === '')
3173
3178
  continue;
3174
3179
  servedEntryIds.add(id);
3175
3180
  const bare = id.split(':').pop();
package/lib/themes.js CHANGED
@@ -9,6 +9,7 @@ import { join } from 'node:path';
9
9
  import { loadRegistry, pluginCategories } from './registry.js';
10
10
  import { hotMount, hotUnmount, listHotMounts, writeDisabled } from './hot.js';
11
11
  import { logEvent } from './log.js';
12
+ import { loaderEntryId } from './patch.js';
12
13
  import { LifecyclePendingError, LifecycleWaitError, waitForLifecycle } from './lifecycle.js';
13
14
  import { nameMatchesPackage } from './entry-identity.js';
14
15
  import { bundlePatchInsertedIds, profileDir, readInstalled } from './profile.js';
@@ -54,8 +55,10 @@ function ownsLoaderEntry(entry, packageName, ownedIds) {
54
55
  const entryName = entry.options.name;
55
56
  if (nameMatchesPackage(entryName, packageName))
56
57
  return true;
57
- const id = entry.options.id;
58
- if (id === undefined || id === '')
58
+ // A YAML `id: 1` reaches the loader as a NUMBER (#1071); `.split` on it
59
+ // threw and took the caller down.
60
+ const id = loaderEntryId(entry);
61
+ if (id === '')
59
62
  return false;
60
63
  // Loader ids may carry an include prefix (`include:<key>:<id>`); the bare
61
64
  // id is what a bundle patch declares.
@@ -74,6 +74,27 @@ export declare function readUserPatchState(patchPath: string): PatchState;
74
74
  * that as indeterminate and refuse the destructive step.
75
75
  */
76
76
  export declare function userPatchPackageReferences(patchPath: string, packageName: string): string[] | null;
77
+ /**
78
+ * A loader entry's id as a string, or '' when it has none.
79
+ *
80
+ * `EntryOptions.id` is a TypeScript interface, not a runtime check: an
81
+ * unquoted `- id: 1` in `cordis.patch.yml` is parsed by YAML as the NUMBER 1,
82
+ * the host's loader accepts it, and every `.split(':')` on it then throws —
83
+ * `/dsh-market/installed` answered 400 with an empty body and the UI showed
84
+ * "no community plugins installed" (#1071). The market's own regex parser
85
+ * only ever produces strings, so this is reachable only through the loader.
86
+ *
87
+ * Numbers are stringified rather than dropped: `id: 1` names the same entry
88
+ * the user wrote, and the market's own row comparisons are string-keyed.
89
+ *
90
+ * @param entry - a host loader entry.
91
+ * @returns the id as a string, '' when absent or not a string/number.
92
+ */
93
+ export declare function loaderEntryId(entry: {
94
+ options?: {
95
+ id?: unknown;
96
+ };
97
+ } | null | undefined): string;
77
98
  /**
78
99
  * The user-patch row ids one installed package owns: its bundle patch's
79
100
  * insert rows, plus the loader entries currently carrying its name.
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.6",
4
+ "version": "1.73.7",
5
5
  "icon": "assets/logo.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",