dshmarket 1.76.0 → 1.77.0

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.
@@ -394,6 +394,26 @@ export declare function lastPnpmProbeFailure(): {
394
394
  * publishes a broken invocation cannot make things worse than they were.
395
395
  */
396
396
  export declare function probePnpm(): Promise<boolean>;
397
+ /**
398
+ * The cwd to hand a provisioning child.
399
+ *
400
+ * `corepack enable`, `npm i -g` and `npm prefix -g` read no project files, so
401
+ * they gain nothing from inheriting this process's directory — and a host
402
+ * whose boot directory was deleted loses everything to it: the child dies
403
+ * inside `getcwd()` before running a line of its own logic, which is how a
404
+ * one-click setup ended up reporting `npm -g: exit=7` with `syscall:
405
+ * 'uv_cwd'` (#1270).
406
+ *
407
+ * A readable directory is still inherited unchanged, so a healthy machine
408
+ * behaves exactly as before, including the per-project `.npmrc` npm would
409
+ * read from it. Only an unreadable one is replaced, and then with a directory
410
+ * that exists by definition.
411
+ *
412
+ * `process.cwd()` throws instead of returning a stale path, so the call
413
+ * itself is the test.
414
+ * @returns `undefined` to inherit, or a directory that is known to exist.
415
+ */
416
+ export declare function provisionCwd(): string | undefined;
397
417
  /**
398
418
  * Provision pnpm without user involvement: corepack (ships with Node) first,
399
419
  * a global npm install as fallback.
@@ -13,7 +13,7 @@ export interface Candidate {
13
13
  * most downloaded of the rest fill the list, because a model can still pick
14
14
  * something sensible from popular plugins, and an empty list helps no one.
15
15
  */
16
- export declare function recall(registry: Registry, terms: string[], limit?: number): {
16
+ export declare function recall(registry: Registry, terms: string[], limit?: number, exclude?: ReadonlySet<string>): {
17
17
  candidates: Candidate[];
18
18
  matched: number;
19
19
  };
@@ -39,8 +39,10 @@ export interface FindResult {
39
39
  /** Which model answered, for the card's footnote. */
40
40
  model: string;
41
41
  at: string;
42
+ /** Whether the user's installed and favorited plugins informed the picks (they allowed it). */
43
+ personalized?: boolean;
42
44
  }
43
- export type FindErrorCode = 'empty' | 'catalog' | 'no-model' | 'model-failed';
45
+ export type FindErrorCode = 'empty' | 'catalog' | 'no-model' | 'no-seeds' | 'model-failed';
44
46
  export declare class FindPluginError extends Error {
45
47
  readonly code: FindErrorCode;
46
48
  constructor(code: FindErrorCode, message: string);
@@ -59,6 +61,8 @@ export interface LlmLike {
59
61
  }): AsyncIterable<{
60
62
  type: string;
61
63
  text?: string;
64
+ error?: unknown;
65
+ reason?: unknown;
62
66
  }>;
63
67
  }
64
68
  export interface ModelSelectionLike {
@@ -70,12 +74,12 @@ export interface ModelSelectionLike {
70
74
  export declare function buildPickPrompt(request: string, registry: Registry, found: {
71
75
  candidates: Candidate[];
72
76
  matched: number;
73
- }): {
77
+ }, have?: UserSeeds): {
74
78
  system: string;
75
79
  user: string;
76
80
  };
77
81
  /** Pull the JSON object out of a model reply (it may wrap it in a code fence). */
78
- export declare function parsePickReply(text: string, allowed: Set<string>): {
82
+ export declare function parsePickReply(text: string, allowed: Set<string>, max?: number): {
79
83
  intro: string;
80
84
  picks: Array<{
81
85
  name: string;
@@ -88,6 +92,46 @@ export declare function findPlugins(options: {
88
92
  registry: Registry;
89
93
  llm: LlmLike | undefined;
90
94
  selection: ModelSelectionLike | undefined;
95
+ /** The user's own plugins, only when they allowed reading them. */
96
+ have?: UserSeeds;
97
+ signal?: AbortSignal;
98
+ }): Promise<FindResult>;
99
+ /** How many candidates a recommendation offers the model. */
100
+ export declare const RECOMMEND_CANDIDATES = 40;
101
+ /** How many plugins a recommendation shows. */
102
+ export declare const RECOMMEND_MAX = 10;
103
+ /**
104
+ * The catalog entries the user already has: installed (by package name) or
105
+ * favorited (by repository URL, as favorites are stored).
106
+ */
107
+ export interface UserSeeds {
108
+ installed: RegistryPlugin[];
109
+ favorited: RegistryPlugin[];
110
+ }
111
+ export declare function userSeeds(registry: Registry, have: {
112
+ installed: string[];
113
+ favorites: string[];
114
+ }): UserSeeds;
115
+ /**
116
+ * What to offer the model: entries that share categories and words with what
117
+ * the user has (their taste), plus some popular ones from categories they have
118
+ * not touched (so a recommendation can open a new need, not only repeat one).
119
+ * Never what they already have, what was shown last time, or a deprecated one.
120
+ */
121
+ export declare function recommendCandidates(registry: Registry, seeds: RegistryPlugin[], exclude?: string[], limit?: number): Candidate[];
122
+ export declare function buildRecommendPrompt(registry: Registry, seeds: UserSeeds, candidates: Candidate[], preferZh: boolean): {
123
+ system: string;
124
+ user: string;
125
+ };
126
+ /** Recommend plugins from what the user installed and favorited. Throws FindPluginError. */
127
+ export declare function recommendPlugins(options: {
128
+ registry: Registry;
129
+ installed: string[];
130
+ favorites: string[];
131
+ exclude?: string[];
132
+ preferZh: boolean;
133
+ llm: LlmLike | undefined;
134
+ selection: ModelSelectionLike | undefined;
91
135
  signal?: AbortSignal;
92
136
  }): Promise<FindResult>;
93
137
  /** Plain text of a result, for hosts that draw the command row as text. */
@@ -124,8 +168,29 @@ export interface ModelAccess {
124
168
  /** Set once by the plugin entry; routes read it at request time. */
125
169
  export declare function setModelAccess(next: ModelAccess): void;
126
170
  export declare function modelAccess(): ModelAccess;
171
+ /**
172
+ * Whether AI search and `/find-plugin` may read the user's installed and
173
+ * favorited plugins. Off until the user allows it from a result; one switch
174
+ * for the whole DSH home, kept beside the saved results.
175
+ */
176
+ export declare function consentFile(home?: string): string;
177
+ export declare function usesMyPlugins(file?: string): boolean;
178
+ export declare function setUsesMyPlugins(on: boolean, file?: string): void;
179
+ export interface UserPluginLists {
180
+ installed: string[];
181
+ favorites: string[];
182
+ }
183
+ /** Set by the routes, which know the active profile. */
184
+ export declare function setUserPluginsReader(next: () => UserPluginLists): void;
127
185
  /** The market page's AI search: the same recall and pick, with the default model. */
128
186
  export declare function aiSearch(request: string, loadRegistry: () => Promise<Registry>, signal?: AbortSignal): Promise<FindResult>;
187
+ /** The market page's "recommend for me": what the user has, judged by their default model. */
188
+ export declare function aiRecommend(have: {
189
+ installed: string[];
190
+ favorites: string[];
191
+ exclude?: string[];
192
+ preferZh: boolean;
193
+ }, loadRegistry: () => Promise<Registry>, signal?: AbortSignal): Promise<FindResult>;
129
194
  /** Run one `/find-plugin`. The structured result is kept under the command id for the card renderer. */
130
195
  export declare function runFindPlugin(invocation: FindPluginInvocation, loadRegistry: () => Promise<Registry>, models: ModelAccess): Promise<FindPluginResult>;
131
196
  /** The slice of the host's `commands` service this uses. */
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.76.0",
4
+ "version": "1.77.0",
5
5
  "icon": "assets/logo.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",