@linxin666/dsh-client-ui-plugin-manager 0.4.3 → 0.4.5

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.
@@ -24,6 +24,7 @@
24
24
  import type { Context as ClientContext } from '@deepseek-ai/cordis';
25
25
  import { type PluginUpdatePatchInjected } from './PluginUpdatePatch.tsx';
26
26
  import { type PluginManagerKey } from './locales.ts';
27
+ import { type RestartMode } from '../core/protocol.ts';
27
28
  import { type PluginManagerService } from '../core/service.ts';
28
29
  declare module '@deepseek-ai/dsh-client-ui-slots' {
29
30
  interface LocaleNamespaceMap {
@@ -39,7 +40,23 @@ export declare const inject: string[];
39
40
  * host still records install conflicts and boot failures; no client surface
40
41
  * consumes either since the tab left, so neither is on this face.
41
42
  */
42
- export type PluginManagerFace = PluginUpdatePatchInjected & PluginManagerService;
43
+ export type PluginManagerFace = PluginUpdatePatchInjected & PluginManagerService & {
44
+ /**
45
+ * Restart DSH so an applied plugin update is loaded. Always rides this
46
+ * package's own loopback route: neither official channel
47
+ * (`/plugin-installer`, `/plugin-control`) has a restart method, and the
48
+ * route answers how the restart was carried out (in-place relaunch, or a
49
+ * packaged Desktop shell that owns the process tree). See host/restart.ts.
50
+ */
51
+ restart: () => Promise<RestartMode>;
52
+ /**
53
+ * Read how a restart would be carried out without triggering it (the same
54
+ * route's plan read). The toolbar words its confirmation from this, so a
55
+ * packaged Desktop host can say what its system dialog will do instead of
56
+ * surprising the user with it.
57
+ */
58
+ restartPlan: () => Promise<RestartMode>;
59
+ };
43
60
  /**
44
61
  * Build the dual-channel face once: official-channel and gateway-channel
45
62
  * implementations, the mode detection that picks between them, and the
@@ -2,8 +2,9 @@
2
2
  * Locale dictionaries for the plugin-manager's official-page patch. The zh
3
3
  * dictionary is the key source; the en dictionary mirrors the exact key set.
4
4
  *
5
- * The key set covers only what this package still renders: the
6
- * check-for-updates block on a bundle's page in the official Plugins panel.
5
+ * The key set covers only what this package renders: the check-for-updates
6
+ * block on a bundle's page in the official Plugins panel, and the list-level
7
+ * update toolbar mounted beside that panel's "Installed" heading.
7
8
  * The former tab's keys (inventory, conflicts, repair seeds, safe mode,
8
9
  * aggregate children) left with that tab.
9
10
  * @module @linxin666/dsh-client-ui-plugin-manager/client
@@ -20,6 +21,23 @@ declare const STATIC_ZH: {
20
21
  updateRequiresDsh: string;
21
22
  updateBlockedDsh: string;
22
23
  restartHint: string;
24
+ updatesAvailable: string;
25
+ updateAll: string;
26
+ updatingAll: string;
27
+ updateAllDone: string;
28
+ updatesPanelTitle: string;
29
+ thirdPartyOnly: string;
30
+ restartNow: string;
31
+ restarting: string;
32
+ restartConfirm: string;
33
+ restartPlanRelaunch: string;
34
+ restartPlanShell: string;
35
+ restartPlanManual: string;
36
+ restartShellWarning: string;
37
+ restartDesktopHint: string;
38
+ restartRelaunchHint: string;
39
+ restartManualHint: string;
40
+ cancel: string;
23
41
  failed: string;
24
42
  fetching: string;
25
43
  downloading: string;
@@ -40,6 +58,23 @@ export declare const zh: {
40
58
  updateRequiresDsh: string;
41
59
  updateBlockedDsh: string;
42
60
  restartHint: string;
61
+ updatesAvailable: string;
62
+ updateAll: string;
63
+ updatingAll: string;
64
+ updateAllDone: string;
65
+ updatesPanelTitle: string;
66
+ thirdPartyOnly: string;
67
+ restartNow: string;
68
+ restarting: string;
69
+ restartConfirm: string;
70
+ restartPlanRelaunch: string;
71
+ restartPlanShell: string;
72
+ restartPlanManual: string;
73
+ restartShellWarning: string;
74
+ restartDesktopHint: string;
75
+ restartRelaunchHint: string;
76
+ restartManualHint: string;
77
+ cancel: string;
43
78
  failed: string;
44
79
  fetching: string;
45
80
  downloading: string;
@@ -60,6 +95,23 @@ export declare const en: {
60
95
  updateRequiresDsh: string;
61
96
  updateBlockedDsh: string;
62
97
  restartHint: string;
98
+ updatesAvailable: string;
99
+ updateAll: string;
100
+ updatingAll: string;
101
+ updateAllDone: string;
102
+ updatesPanelTitle: string;
103
+ thirdPartyOnly: string;
104
+ restartNow: string;
105
+ restarting: string;
106
+ restartConfirm: string;
107
+ restartPlanRelaunch: string;
108
+ restartPlanShell: string;
109
+ restartPlanManual: string;
110
+ restartShellWarning: string;
111
+ restartDesktopHint: string;
112
+ restartRelaunchHint: string;
113
+ restartManualHint: string;
114
+ cancel: string;
63
115
  failed: string;
64
116
  fetching: string;
65
117
  downloading: string;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Mounting the update toolbar beside the official Plugins page's "Installed"
3
+ * heading.
4
+ *
5
+ * The page renders that heading itself — `<section data-plugin-group="bundles">
6
+ * <div class="groupHead"><h3>Installed</h3><span>7</span></div>…` — and declares
7
+ * no seat next to it: its extension points are `plugins.detail.*` (per page),
8
+ * `plugins.bundle.config` / `plugins.row.config` / `plugins.item` (configuration
9
+ * entries) and `plugins.bundle.activation`. A list-level action therefore has
10
+ * to be inserted into the page's own chrome, the same way the sidebar foot card
11
+ * is inserted above the Settings row.
12
+ *
13
+ * The container is a plain element carrying its own React root, so it can never
14
+ * disturb the page's reconciliation, and it re-seats itself through the
15
+ * page-wide body-mutation hub: a re-render that relocates or drops the heading
16
+ * is followed on the next frame, and a panel switch that unmounts the list
17
+ * simply detaches the container until the list returns.
18
+ * @module @linxin666/dsh-client-ui-plugin-manager/client
19
+ */
20
+ import { type PluginListToolbarProps } from './PluginListToolbar.tsx';
21
+ /** Stable attribute identifying the injected container (mount idempotency). */
22
+ export declare const TOOLBAR_MOUNT_SELECTOR = "[data-dsh-plugin-manager-toolbar]";
23
+ /** Toolbar props without the translate function, which is rebuilt per render. */
24
+ export type PluginListToolbarMountInput = Omit<PluginListToolbarProps, 't'> & {
25
+ /** Translate in the namespace, read on every render so a language switch lands. */
26
+ t: PluginListToolbarProps['t'];
27
+ };
28
+ /** The mount's inputs. */
29
+ export interface PluginToolbarMountOptions {
30
+ /** Build the toolbar props; called on mount and on every locale change. */
31
+ props: () => PluginListToolbarMountInput;
32
+ /** Locale change subscription (ctx.locale.subscribe); re-renders the toolbar. */
33
+ subscribe?: (listener: () => void) => () => void;
34
+ }
35
+ /**
36
+ * The official page's "Installed" group heading, when it is mounted. Class
37
+ * names are CSS-module hashes in the official bundle, so the seat is found
38
+ * through the page's own data attributes plus DOM position.
39
+ * @returns the heading element to append into, or undefined off the list view.
40
+ */
41
+ export declare function toolbarSeat(): HTMLElement | undefined;
42
+ /**
43
+ * Mount the toolbar into the Installed heading.
44
+ * @param options - props factory and the optional locale subscription.
45
+ * @returns disposer removing the container, its observers and its React root.
46
+ */
47
+ export declare function mountPluginListToolbar(options: PluginToolbarMountOptions): () => void;
@@ -43,6 +43,13 @@ export interface InstalledPluginItem {
43
43
  */
44
44
  children?: InstalledPluginChild[];
45
45
  }
46
+ /**
47
+ * How the host carried out (or refused) a restart request:
48
+ * `relaunch` — this host re-executes itself in place; `shell` — the packaged
49
+ * Desktop shell owns the process tree and runs its own restart; `manual` —
50
+ * neither is safe here, the user restarts DSH themselves.
51
+ */
52
+ export type RestartMode = 'relaunch' | 'shell' | 'manual';
46
53
  /** Point-in-time install/update progress reported by the host. */
47
54
  export interface InstallProgressItem {
48
55
  kind: 'idle' | 'install' | 'update';
@@ -109,6 +116,12 @@ export declare function parseInstallStatus(value: unknown): InstallProgressItem;
109
116
  * @returns typed update rows.
110
117
  */
111
118
  export declare function parseUpdateList(value: unknown): PluginUpdateItem[];
119
+ /**
120
+ * Validate and normalize a `restart` response value.
121
+ * @param value - decoded but untrusted response value.
122
+ * @returns the mode the host actually used.
123
+ */
124
+ export declare function parseRestartMode(value: unknown): RestartMode;
112
125
  /**
113
126
  * Validate and normalize a `failures` response value.
114
127
  * @param value - decoded but untrusted response value.
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Which update rows the list-level toolbar may act on. Pure, shared by the
3
+ * browser half (the toolbar) and its tests: the host answers with every
4
+ * installed package whose registry source serves a newer release, and the
5
+ * policy of what may be updated in bulk lives here rather than in the host,
6
+ * so the same rows stay available to the per-page update block.
7
+ *
8
+ * Two filters:
9
+ *
10
+ * - **Third-party only.** A package published under the `@deepseek-ai/` scope
11
+ * ships with DSH itself: its version is chosen by the running installation,
12
+ * the official page says an upgrade arrives by upgrading DSH, and a
13
+ * plugin-initiated `pnpm add` of such a package can pull a release the runtime was
14
+ * never tested against. The bulk action therefore never touches it.
15
+ * - **Compatibility gate.** An update whose manifest declares a DSH minimum the
16
+ * running host does not satisfy is listed (the user may still upgrade DSH)
17
+ * but cannot be applied: the host would refuse it with 412 anyway.
18
+ * @module @linxin666/dsh-client-ui-plugin-manager/core
19
+ */
20
+ import type { PluginUpdateItem } from './protocol.ts';
21
+ /** The npm scope DSH's own packages are published under. */
22
+ export declare const OFFICIAL_SCOPE = "@deepseek-ai/";
23
+ /** Whether a package id is a third-party plugin rather than a DSH-shipped one. */
24
+ export declare function isThirdPartyPlugin(id: string): boolean;
25
+ /** The third-party update rows, in host order. */
26
+ export declare function thirdPartyUpdates(items: readonly PluginUpdateItem[]): PluginUpdateItem[];
27
+ /** Whether the running DSH host satisfies the row's declared minimum. */
28
+ export declare function isUpdateApplicable(item: PluginUpdateItem): boolean;
29
+ /** The third-party rows this runtime can actually apply. */
30
+ export declare function applicableUpdates(items: readonly PluginUpdateItem[]): PluginUpdateItem[];
@@ -55,7 +55,9 @@ export declare function meetsMinimumDsh(host: string, minimum: string): boolean
55
55
  export declare function displayMinimumVersion(minimum: string): string;
56
56
  /**
57
57
  * Read the declared DSH minimum from a published registry manifest:
58
- * `dsh.engines.dsh` first, top-level `engines.dsh` as the fallback.
58
+ * `dsh.engines.dsh` first, top-level `engines.dsh` next, and
59
+ * `peerDependencies["@deepseek-ai/dsh"]` last, which is where a package that
60
+ * only declares the host as a peer still gets gated at boot.
59
61
  * Defensive against malformed or untrusted metadata: anything that is not a
60
62
  * non-empty string reads as absent.
61
63
  * @param manifest - the decoded registry version manifest.
@@ -64,4 +66,5 @@ export declare function displayMinimumVersion(minimum: string): string;
64
66
  export declare function dshRequirementOf(manifest: {
65
67
  dsh?: unknown;
66
68
  engines?: unknown;
69
+ peerDependencies?: unknown;
67
70
  }): string | undefined;
@@ -6,6 +6,11 @@
6
6
  * CLI changed (the conflict ledger). The npm web runtime has no installer
7
7
  * service, so this gateway is its write path; on runtimes with official
8
8
  * channels the browser half never calls it.
9
+ *
10
+ * One exception: an application-owned profile (a packaged Desktop launch)
11
+ * cannot be written by the CLI at all — the official launcher refuses it — so
12
+ * installs, updates and removals there run through the official in-process
13
+ * plugin manager instead (see {@link NativePluginManager}).
9
14
  * @module @linxin666/dsh-client-ui-plugin-manager/host
10
15
  */
11
16
  import type { InstalledPluginItem } from '../core/protocol.ts';
@@ -147,13 +152,59 @@ export interface NativePluginManager {
147
152
  * Install or update one package spec through the official manager.
148
153
  * @param spec - package spec (e.g. `@scope/pkg@1.2.3`).
149
154
  * @param options - activation choice and the request id the run is tracked under.
150
- * @returns the manager's own diagnostics (the caller re-reads the profile).
155
+ * @returns the manager's own verdict ({@link NativeManagerOutcome}); the caller
156
+ * re-reads the profile as well, but must read this first — a refusal resolves.
151
157
  */
152
158
  installBundle(spec: string, options?: {
153
159
  enabled?: boolean;
154
160
  requestId?: string;
155
161
  }): Promise<unknown>;
162
+ /**
163
+ * Remove one profile-owned bundle through the official manager.
164
+ * @param name - installed dependency (bundle) name.
165
+ * @returns the manager's own verdict ({@link NativeManagerOutcome}); the caller
166
+ * re-reads the profile as well, but must read this first — a refusal resolves.
167
+ */
168
+ removeBundle(name: string): Promise<unknown>;
156
169
  }
170
+ /**
171
+ * The verdict the official in-process manager returns for one mutation. Its
172
+ * internal `change()` wrapper never rejects a failed operation: it folds the
173
+ * failure into this resolved value (`application: 'failed'` plus `error`), so a
174
+ * resolved promise is not proof the profile moved. Reading only whether the
175
+ * call threw reported a refused pnpm run as "the manager succeeded but nothing
176
+ * changed" and hid the real reason (2026-09-29: `dsh-better-sidebar` update
177
+ * blocked by `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`). Contract observation,
178
+ * shape mirrored from `@deepseek-ai/dsh-plugin-manager`.
179
+ */
180
+ export interface NativeManagerOutcome {
181
+ /** `applied` or `restart-required` on success, `cancelled`, or `failed`. */
182
+ application?: string;
183
+ /** Whether the profile files differ from before the run. */
184
+ changed?: boolean;
185
+ /** Present when `application` is `failed`. */
186
+ error?: {
187
+ /** The manager's own failure code (`operation-error`, `incompatible-version`, …). */
188
+ code?: string;
189
+ /** Raw failure text for `operation-error` (the pnpm output tail). */
190
+ diagnostic?: string;
191
+ /** Packages an `incompatible-version` refusal names. */
192
+ incompatible?: readonly {
193
+ name?: string;
194
+ version?: string;
195
+ runtimeVersion?: string;
196
+ }[];
197
+ };
198
+ }
199
+ /**
200
+ * The official manager's own failure text for one run, or undefined when its
201
+ * verdict is not a failure. The manager resolves a failed run instead of
202
+ * rejecting it, so this is the only place its refusal can be read — the profile
203
+ * re-read afterwards can only say that nothing moved, never why.
204
+ * @param outcome - the resolved value of `installBundle` / `removeBundle`.
205
+ * @returns the failure text to report, or undefined for a run that did not fail.
206
+ */
207
+ export declare function nativeManagerFailure(outcome: unknown): string | undefined;
157
208
  /** The gateway: serializes CLI operations through one job table and one mutation queue. */
158
209
  export declare class CliGateway {
159
210
  private readonly facts;
@@ -200,6 +251,14 @@ export declare class CliGateway {
200
251
  * @returns the manager, or undefined when the CLI should run.
201
252
  */
202
253
  private nativeManager;
254
+ /**
255
+ * Whether this gateway will write through the official in-process manager
256
+ * instead of the CLI (an application-owned profile, see
257
+ * {@link nativeManager}). The HTTP layer reads it so its CLI-availability
258
+ * guard never rejects a job the CLI is not going to run.
259
+ * @returns true when the native writer serves installs, updates and removals.
260
+ */
261
+ usesNativeWriter(): boolean;
203
262
  /** Run one CLI command to completion and return the bounded output. */
204
263
  private runCli;
205
264
  /** Full package spec used when restoring a legacy dependency. */
@@ -210,7 +269,12 @@ export declare class CliGateway {
210
269
  private rollbackMigration;
211
270
  /** Spawn the CLI, through the test seam when present. */
212
271
  private spawnCli;
213
- /** Start an install; the caller polls {@link status}. */
272
+ /**
273
+ * Start an install; the caller polls {@link status}. An application-owned
274
+ * profile runs it through the official in-process manager instead of the CLI
275
+ * (see {@link nativeManager}), exactly like {@link update}; the job table,
276
+ * polling contract and profile verification are identical either way.
277
+ */
214
278
  install(spec: string): {
215
279
  jobId: string;
216
280
  };
@@ -223,6 +287,25 @@ export declare class CliGateway {
223
287
  update(id: string, version: string): {
224
288
  jobId: string;
225
289
  };
290
+ /** Start an install through the official in-process manager. */
291
+ private enqueueNativeInstall;
292
+ /**
293
+ * Run one install through the official in-process manager (an
294
+ * application-owned profile, where the CLI refuses to write). The manager
295
+ * resolves the registry, runs pnpm with the launcher's bundled toolchain and
296
+ * applies the bundle, then this reads the profile the same way the CLI path
297
+ * does: the install is only `done` once the profile carries a dependency it
298
+ * did not carry before, so a green manager call that added nothing is still
299
+ * reported as a failure. Its resolved verdict is read first
300
+ * ({@link nativeManagerFailure}): the manager folds a refused run into that
301
+ * value instead of rejecting, and only the verdict names the reason. The
302
+ * CLI-specific guards are deliberately absent — the official manager
303
+ * validates and applies the bundle itself, exactly as it does for the
304
+ * official Plugins page.
305
+ * @param job - the install job being settled.
306
+ * @param native - the official manager.
307
+ */
308
+ private runNativeInstall;
226
309
  /** Start an in-place update through the official in-process manager. */
227
310
  private enqueueNativeUpdate;
228
311
  /**
@@ -232,6 +315,10 @@ export declare class CliGateway {
232
315
  * this reads the profile the same way the CLI path does: the dependency must
233
316
  * still be there and the installed version must be the one the route resolved,
234
317
  * so a green manager call that changed nothing is still reported as a failure.
318
+ * Its resolved verdict is read first ({@link nativeManagerFailure}): a refused
319
+ * run (pnpm exited non-zero, an incompatible version, a cancellation) resolves
320
+ * with `application: 'failed'`, and only that verdict carries the reason — the
321
+ * profile re-read can only show that the version did not move.
235
322
  * @param job - the update job being settled.
236
323
  * @param native - the official manager.
237
324
  */
@@ -240,10 +327,27 @@ export declare class CliGateway {
240
327
  migrate(sourceId: string, targetId: string, targetVersion: string, targetSpec: string): {
241
328
  jobId: string;
242
329
  };
243
- /** Start a removal; the caller polls {@link status}. */
330
+ /**
331
+ * Start a removal; the caller polls {@link status}. An application-owned
332
+ * profile removes through the official in-process manager, the same writer
333
+ * the install and update paths use there (the CLI refuses that profile).
334
+ */
244
335
  remove(id: string): {
245
336
  jobId: string;
246
337
  };
338
+ /** Start a removal through the official in-process manager. */
339
+ private enqueueNativeRemove;
340
+ /**
341
+ * Run one removal through the official in-process manager (an
342
+ * application-owned profile, where the CLI refuses to write). The removal is
343
+ * only `done` once a dependency the profile carried before is gone, exactly
344
+ * the verification the CLI path performs. Its resolved verdict is read first
345
+ * ({@link nativeManagerFailure}): a refused removal resolves with
346
+ * `application: 'failed'` rather than rejecting.
347
+ * @param job - the removal job being settled.
348
+ * @param native - the official manager.
349
+ */
350
+ private runNativeRemove;
247
351
  /**
248
352
  * Read one job's current state (a shallow copy). Finished jobs beyond the
249
353
  * ring cap are evicted and read as not-found, the same as an id that never
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Restart planning and execution for the plugin-manager gateway.
3
+ *
4
+ * The plugin page's restart action exists to make an applied plugin update
5
+ * effective, which means the DSH host process must come back with the new
6
+ * packages loaded. How that is achieved depends entirely on who launched this
7
+ * process, and the host can only tell that from its own facts:
8
+ *
9
+ * - A packaged Desktop launch (the Electron shell's child process, see
10
+ * isPackagedDesktopArgv / ELECTRON_RUN_AS_NODE) cannot be relaunched by a
11
+ * plugin: Electron owns the process tree, and anything this process spawns
12
+ * would fight the shell for the same port while Electron reports the host as
13
+ * crashed. The plugin therefore stops the host and lets the shell run the
14
+ * restart it already owns (app.relaunch(), the same recovery action the
15
+ * Desktop app offers after installing a downloaded update). Mode 'shell'.
16
+ * - A host this plugin can prove is a terminal launch (an interactive stdio
17
+ * pair, no Electron in the environment) is restarted in place: a detached
18
+ * helper waits for this process to exit and re-executes the same command
19
+ * line, so the port is free before the replacement binds it. Mode 'relaunch'.
20
+ * - Everything else — a supervisor-managed launch with piped stdio, a shell
21
+ * this plugin cannot identify — is left alone: the route answers 'manual'
22
+ * and this process keeps running rather than dying with no replacement.
23
+ * Mode 'manual'.
24
+ *
25
+ * The decision is pure ({@link planRestart}) so the modes are testable without
26
+ * spawning anything; {@link performRestart} is the effectful half.
27
+ * @module @linxin666/dsh-client-ui-plugin-manager/host
28
+ */
29
+ /** How a restart request is carried out. */
30
+ export type RestartMode = 'shell' | 'relaunch' | 'manual';
31
+ /** The command line a relaunch re-executes. */
32
+ export interface RelaunchCommand {
33
+ /** Absolute path of the executable (Node, or the Electron binary in Node mode). */
34
+ execPath: string;
35
+ /** argv after the script path: what `node <argv[0]> <argv[1..]>` ran. */
36
+ argv: string[];
37
+ /** Working directory the replacement starts in. */
38
+ cwd: string;
39
+ /** Environment the replacement and its plugin subprocesses inherit. */
40
+ env: NodeJS.ProcessEnv;
41
+ }
42
+ /** One restart verdict. */
43
+ export interface RestartPlan {
44
+ mode: RestartMode;
45
+ /** Present exactly when mode is 'relaunch'. */
46
+ command?: RelaunchCommand;
47
+ }
48
+ /** The process facts the verdict is derived from. */
49
+ export interface RestartFacts {
50
+ /** Whether the running profile was inferred from the packaged Desktop launcher. */
51
+ desktop?: boolean;
52
+ env: NodeJS.ProcessEnv;
53
+ execPath: string;
54
+ argv: readonly string[];
55
+ execArgv?: readonly string[];
56
+ cwd: string;
57
+ /** Whether stdio is a terminal (a launch a human can see and stop). */
58
+ interactive: boolean;
59
+ }
60
+ /** Grace period between answering the restart request and leaving the process. */
61
+ export declare const RESTART_EXIT_DELAY_MS = 400;
62
+ /** How long the helper waits for this process to disappear before giving up on the wait. */
63
+ export declare const RESTART_WAIT_MS = 30000;
64
+ /**
65
+ * Decide how a restart request is carried out.
66
+ * @param facts - the running process's launch facts.
67
+ * @returns the planned mode, with the relaunch command when one is used.
68
+ */
69
+ export declare function planRestart(facts: RestartFacts): RestartPlan;
70
+ /** Absolute path of the relaunch journal this plugin appends to. */
71
+ export declare function restartLogPath(home?: string): string;
72
+ /**
73
+ * Start the detached relaunch helper.
74
+ * @param command - the command line the replacement runs.
75
+ * @param logPath - journal the helper (and the replacement's output) appends to.
76
+ * @returns true when a helper process was actually created.
77
+ */
78
+ export declare function startRelaunchHelper(command: RelaunchCommand, logPath?: string): boolean;
79
+ /** Effect seams for {@link performRestart} (tests replace them). */
80
+ export interface RestartRuntime {
81
+ /** Start the relaunch helper; false means no replacement was created. */
82
+ startHelper?: (command: RelaunchCommand) => boolean;
83
+ /** Leave this process. */
84
+ exit?: () => void;
85
+ /** Schedule the exit (delay seam). */
86
+ schedule?: (run: () => void, delayMs: number) => void;
87
+ }
88
+ /**
89
+ * Carry out one restart plan.
90
+ * @param plan - the verdict from {@link planRestart}.
91
+ * @param runtime - effect seams; the defaults spawn the helper and exit.
92
+ * @returns the mode actually used: 'relaunch' degrades to 'manual' when the
93
+ * helper could not be started, so a process that cannot be replaced stays up.
94
+ */
95
+ export declare function performRestart(plan: RestartPlan, runtime?: RestartRuntime): RestartMode;
@@ -11,13 +11,18 @@ import type { WebRoute } from '@deepseek-ai/dsh-host-webserver';
11
11
  import { type CliGateway } from './gateway.ts';
12
12
  import { type ProfileFacts } from './profile.ts';
13
13
  import { buildPluginRow } from './state.ts';
14
+ import { type RestartFacts, type RestartRuntime } from './restart.ts';
14
15
  /** Route prefix the browser half mirrors. */
15
16
  export declare const GATEWAY_PREFIX = "/api/plugin-manager";
16
17
  /** Dependencies every route shares. */
17
18
  export interface GatewayRouteDeps {
18
19
  facts: ProfileFacts;
19
20
  gateway: CliGateway;
20
- /** Resolve the dsh binary presence (the CLI is the write path). */
21
+ /**
22
+ * Resolve the dsh binary presence. Only the CLI-backed writer needs it: an
23
+ * application-owned profile writes through the official in-process manager
24
+ * (`gateway.usesNativeWriter()`), so its routes must not demand a binary.
25
+ */
21
26
  cliAvailable: () => boolean;
22
27
  /** Registry fetch seam for update checks (test seam); the default reads the
23
28
  * `/<name>/latest` manifest including the `dsh` / `engines` metadata. */
@@ -26,6 +31,10 @@ export interface GatewayRouteDeps {
26
31
  dshVersion?: () => Promise<string | undefined>;
27
32
  /** Official-channel detection seam (test seam); defaults to the boot dump probe. */
28
33
  officialChannels?: () => Promise<boolean>;
34
+ /** Launch-fact seam for the restart route (test seam); defaults to this process. */
35
+ restartFacts?: () => RestartFacts;
36
+ /** Restart effect seam (test seam); defaults to the detached helper plus a real exit. */
37
+ restartRuntime?: RestartRuntime;
29
38
  }
30
39
  /** The published `/latest` manifest: version plus the compat metadata fields. */
31
40
  export interface RegistryVersionManifest {
@@ -13,7 +13,9 @@ import { type ProfileFacts } from './profile.ts';
13
13
  * itself (the UI performing the write), the family settings surface the tab
14
14
  * injects into, and the aggregate compat face (disabling it unmounts the
15
15
  * whole folded client bundle while host rows keep running — a half-dead
16
- * page). Covers both the standalone and the aggregate row ids.
16
+ * page). Covers both the standalone and the aggregate row ids. The standalone
17
+ * id is this package's own `cordis.patch.yml` insert id, never the official
18
+ * `ui-plugin-manager` row the DSH web-app bundle already claims.
17
19
  */
18
20
  export declare const LOCKED_ENTRY_IDS: ReadonlySet<string>;
19
21
  /** The listing result: plugin rows plus the raw layer snapshot for diffs. */
@@ -12,8 +12,13 @@
12
12
  * @module @linxin666/dsh-client-ui-plugin-manager
13
13
  */
14
14
  import type { Context } from '@deepseek-ai/cordis';
15
- /** Stable cordis plugin name (matches cordis.patch.yml insert id). */
16
- export declare const name = "ui-plugin-manager";
15
+ /**
16
+ * Stable cordis plugin name (matches this package's own cordis.patch.yml
17
+ * insert id). It must not repeat an id another bundle already claims: the
18
+ * loader keeps one entry per id, so a shared id would also give two host
19
+ * halves one cordis plugin name.
20
+ */
21
+ export declare const name = "ui-plugin-manager-update-check";
17
22
  /** Services the gateway needs — the web server seam. */
18
23
  export declare const inject: string[];
19
24
  /** Apply the host half (once per process). */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-client-ui-plugin-manager",
3
3
  "description": "Update checking for the dsh web GUI's official Plugins page: compares installed plugins against the version their registry source serves, gates the update on the DSH runtime minimum the release declares, and drives the update through the official installer channel or this package's loopback CLI gateway.",
4
- "version": "0.4.3",
4
+ "version": "0.4.5",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dsh": {
22
22
  "engines": {
23
- "dsh": ">=0.1.7-rc.2"
23
+ "dsh": ">=0.2.0-rc.2"
24
24
  },
25
25
  "bundle": {
26
26
  "patch": "./cordis.patch.yml"
@@ -34,21 +34,21 @@
34
34
  }
35
35
  },
36
36
  "peerDependencies": {
37
- "@deepseek-ai/dsh": ">=0.1.7-rc.2",
37
+ "@deepseek-ai/dsh": ">=0.2.0-rc.2",
38
38
  "react": "^18.2.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@deepseek-ai/cordis": "^4.0.4",
42
- "@deepseek-ai/dsh-api-session-controller": "^0.1.7-rc.2",
43
- "@deepseek-ai/dsh-api-workspace-controller": "^0.1.7-rc.2",
44
- "@deepseek-ai/dsh-client-connection": "^0.1.7-rc.2",
45
- "@deepseek-ai/dsh-client-locale": "^0.1.7-rc.2",
46
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.7-rc.2",
47
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-rc.2",
48
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.7-rc.2",
49
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.7-rc.2",
50
- "@deepseek-ai/dsh-client-ui-workspace": "^0.1.7-rc.2",
51
- "@deepseek-ai/dsh-host-webserver": "^0.1.7-rc.2",
42
+ "@deepseek-ai/dsh-api-session-controller": "^0.2.0-rc.2",
43
+ "@deepseek-ai/dsh-api-workspace-controller": "^0.2.0-rc.2",
44
+ "@deepseek-ai/dsh-client-connection": "^0.2.0-rc.2",
45
+ "@deepseek-ai/dsh-client-locale": "^0.2.0-rc.2",
46
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.2.0-rc.2",
47
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.0-rc.2",
48
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.0-rc.2",
49
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.0-rc.2",
50
+ "@deepseek-ai/dsh-client-ui-workspace": "^0.2.0-rc.2",
51
+ "@deepseek-ai/dsh-host-webserver": "^0.2.0-rc.2",
52
52
  "@testing-library/react": "^16.1.0",
53
53
  "@types/node": "^22.20.0",
54
54
  "@types/react": "~18.3.1",