dsh-crate 0.5.1 → 0.5.3

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.
@@ -402,6 +402,30 @@ export declare function isStaleUpdate(check: {
402
402
  * node_modules yet (the fetcher rejects before materialization, #68).
403
403
  */
404
404
  export declare function parsePrepareNotAllowed(stdout: string, stderr: string): string | null;
405
+ /**
406
+ * Undo the line wrapping of pnpm 12's boxed error text (#1156).
407
+ *
408
+ * pnpm 12 prints a failure as
409
+ *
410
+ * Error: ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED
411
+ *
412
+ * × adding a new package
413
+ * ╰─▶ The git-hosted package "x@1.0.0" needs to execute build
414
+ * scripts but is not in the "allowBuilds" allowlist.
415
+ * help: …
416
+ *
417
+ * and wraps it at about 80 columns — through the middle of a sentence, and
418
+ * through the middle of a package key at a `/` or `-`. Every sentence this
419
+ * file matches then has a line break where its single space was, so the
420
+ * refusal was classified correctly and still yielded no package name, no
421
+ * key, and therefore no approve-and-retry button. Continuation lines are
422
+ * indented deeper than the line they continue; join them back, without a
423
+ * space when the break fell inside a token.
424
+ *
425
+ * Output that never wraps this way (pnpm 10/11, ndjson) has no such lines
426
+ * and comes back unchanged.
427
+ */
428
+ export declare function unwrapPnpmErrors(text: string): string;
405
429
  /**
406
430
  * The allowBuilds key pnpm itself printed for a prepare refusal, when it
407
431
  * printed one (#698).
@@ -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/lib/verify.js CHANGED
@@ -72,6 +72,20 @@ function profilePatchMentions(activeProfileDir, name) {
72
72
  };
73
73
  return rows.some(visit);
74
74
  }
75
+ const isRow = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
76
+ /** The Agent presets in the profile's own patch that mount this package (#1144).
77
+ * A preset owns its plugin rows and mounts them per session, so nothing there
78
+ * ever reaches the loader — this row is the only evidence it runs, and where. */
79
+ function presetLoadsReason(dir, name) {
80
+ const rows = parsePatchFile(join(dir, 'cordis.patch.yml')) ?? [];
81
+ const ids = rows.flatMap(row => !isRow(row) || row.id !== 'agent-preset' || !isRow(row.config) || !Array.isArray(row.config.presets) ? []
82
+ : row.config.presets.flatMap(preset => !isRow(preset) || typeof preset.id !== 'string' || !Array.isArray(preset.plugins) ? []
83
+ : preset.plugins.some(p => isRow(p) && nameMatchesPackage(p.name, name)) ? [preset.id] : []));
84
+ if (ids.length === 0)
85
+ return null;
86
+ const list = [...new Set(ids)];
87
+ return `已装入预设组合(${list.join('、')}):运行于这些预设的会话会加载它 / loaded by these Agent presets (${list.join(', ')}): sessions running them load it`;
88
+ }
75
89
  /** The profile manifest's `dsh.profile.bundles` — what the CLI reconciled. */
76
90
  function readBundles(profile, explicitDir) {
77
91
  try {
@@ -476,6 +490,11 @@ loaderNeverStarted = false) {
476
490
  const more = carried.length > 3 ? `等 ${carried.length} 个` : '';
477
491
  const shownEn = carried.slice(0, 3).join(', ');
478
492
  const moreEn = carried.length > 3 ? ` and ${carried.length - 3} more` : '';
493
+ // #1144: a dependency with no dsh field loads per session when an Agent
494
+ // preset names it — nothing else can show that.
495
+ const reason = carried.length === 0 ? presetLoadsReason(activeProfileDir, name) : null;
496
+ if (reason !== null)
497
+ return { state: 'inert', loadedByProfile: true, reasons: [reason], bundle: false, hot: false };
479
498
  return {
480
499
  state: 'inert',
481
500
  reasons: [carried.length > 0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-crate",
3
3
  "description": "逛一逛,点一下,装好。浏览和搜索 DeepSeek Harness 社区插件,看详情、一键安装,收藏和更新都在一处。",
4
- "version": "0.5.1",
4
+ "version": "0.5.3",
5
5
  "icon": "assets/logo.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",