@linxin666/dsh-client-ui-plugin-manager 0.4.7 → 0.4.8

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.
@@ -61,6 +61,31 @@ export interface PluginUpdatePatchInjected {
61
61
  }
62
62
  /** Full component props assembled by the Plugins page's section renderer. */
63
63
  export type PluginUpdatePatchProps = PropsRuntime<'plugins.detail.section'> & PropsLocale<'settings.pluginManager'> & InjectFace<PluginUpdatePatchInjected>;
64
+ /**
65
+ * What the host's compatibility verdict amounts to for one update row.
66
+ *
67
+ * `compatible === false` on its own does not mean "this DSH is too old": the
68
+ * host leaves `hostVersion` off a blocked row whenever it could not read its
69
+ * own runtime version (issue #1819) and whenever it could not evaluate the
70
+ * declared range at all — an empty declaration, a range node-semver rejects, a
71
+ * host string that is not one version (issue #1899). Only a row that carries a
72
+ * host version was actually compared against that version, so only that row
73
+ * may send the user to upgrade DSH.
74
+ *
75
+ * The verdict is derived here once and shared by both surfaces that render it
76
+ * (this section and the list-level toolbar) so the two cannot drift apart:
77
+ * that drift is what left the "cannot verify" case telling users to upgrade a
78
+ * DSH the host never checked.
79
+ */
80
+ export type DshGate = 'open' | 'below-minimum' | 'unverified';
81
+ /**
82
+ * Read the gate state out of one wire row.
83
+ * @param item - the update row, or undefined when no check has answered yet.
84
+ * @returns `open` when nothing blocks the update, otherwise the reason it is
85
+ * held back: `below-minimum` only when the host compared a version it read,
86
+ * `unverified` when it could not make that comparison.
87
+ */
88
+ export declare function dshGateOf(item: Pick<PluginUpdateItem, 'compatible' | 'hostVersion'> | undefined): DshGate;
64
89
  /**
65
90
  * The update block on one official Plugins page: one check action, the verdict
66
91
  * for this page's bundle, and the update action it unlocks. The check is
@@ -21,6 +21,7 @@ declare const STATIC_ZH: {
21
21
  updateRequiresDsh: string;
22
22
  updateBlockedDsh: string;
23
23
  updateUnverifiedDsh: string;
24
+ updateUnverifiedDshUnknownRange: string;
24
25
  restartHint: string;
25
26
  updatesAvailable: string;
26
27
  updateAll: string;
@@ -59,6 +60,7 @@ export declare const zh: {
59
60
  updateRequiresDsh: string;
60
61
  updateBlockedDsh: string;
61
62
  updateUnverifiedDsh: string;
63
+ updateUnverifiedDshUnknownRange: string;
62
64
  restartHint: string;
63
65
  updatesAvailable: string;
64
66
  updateAll: string;
@@ -97,6 +99,7 @@ export declare const en: {
97
99
  updateRequiresDsh: string;
98
100
  updateBlockedDsh: string;
99
101
  updateUnverifiedDsh: string;
102
+ updateUnverifiedDshUnknownRange: string;
100
103
  restartHint: string;
101
104
  updatesAvailable: string;
102
105
  updateAll: string;
@@ -6,8 +6,12 @@
6
6
  * The payload carries no conversation data and no identifiers beyond a random
7
7
  * UUID generated in localStorage; the server hashes it with a deployment salt
8
8
  * before storage and never persists IP addresses. Sends are fire-and-forget:
9
- * failures stay silent and simply retry on a later mount or day. The system
10
- * is documented in docs/telemetry.md.
9
+ * failures stay silent and simply retry on a later mount or day. Frames where
10
+ * storage is unavailable report nothing.
11
+ *
12
+ * The family-wide opt-out and the browser's Do Not Track signal both suppress
13
+ * the heartbeat; the Web Plugins settings switch writes the same localStorage
14
+ * key. The system is documented in docs/telemetry.md.
11
15
  */
12
16
  export type TelemetryChannel = 'market' | 'npm' | 'unknown';
13
17
  export interface TelemetryItem {
@@ -18,6 +22,14 @@ export interface TelemetryItem {
18
22
  /** Install channel when determinable (market = Workshop install). */
19
23
  channel?: TelemetryChannel;
20
24
  }
25
+ /** localStorage key carrying the family-wide telemetry opt-out ('1' = off). */
26
+ export declare const TELEMETRY_OPT_OUT_KEY = "dsh-web-ui-telemetry-opt-out";
27
+ /** Whether the user switched the family-wide opt-out on (reads storage only). */
28
+ export declare function isTelemetryOptedOut(): boolean;
29
+ /** Turn the family-wide opt-out on or off (writing '1' / removing the key); never throws. */
30
+ export declare function setTelemetryOptedOut(optedOut: boolean): void;
31
+ /** Whether a heartbeat must be suppressed right now: opt-out stored, or the browser asks not to be tracked. */
32
+ export declare function isTelemetrySuppressed(): boolean;
21
33
  /**
22
34
  * Fire the daily heartbeat for the given items at most once per UTC day per
23
35
  * browser. Never throws and never blocks the caller. Items without an explicit
@@ -74,9 +74,11 @@ export interface PluginUpdateItem {
74
74
  /** Whether the running DSH host satisfies requiresDsh; absent when unknown. */
75
75
  compatible?: boolean;
76
76
  /**
77
- * The running DSH version the verdict was made from, when the host could read
78
- * it. Its absence is what separates "this host is too old" from "this host
79
- * could not be asked" — different problems, with different copy (issue #1819).
77
+ * The running DSH version the verdict was made from, present only when the
78
+ * host compared it and found it below the declaration. Its absence is what
79
+ * separates "this host is too old" from "we could not verify" — a host that
80
+ * could not be read, or a declaration that could not be parsed; different
81
+ * problems, with different copy (issues #1819 and #1899).
80
82
  */
81
83
  hostVersion?: string;
82
84
  }
@@ -1,17 +1,23 @@
1
1
  /**
2
- * DSH host version parsing and comparison for the update compatibility
2
+ * Version parsing plus the requirement reader for the update compatibility
3
3
  * check. The declared minimum lives in the published package manifest under
4
- * `dsh.engines.dsh`, falling back to the top-level `engines.dsh`; the only
5
- * supported form is `>=X.Y.Z[-prerelease]`.
4
+ * `dsh.engines.dsh`, falling back to the top-level `engines.dsh` and then to
5
+ * the `@deepseek-ai/dsh` peer; the range forms a manifest may use are the
6
+ * full node-semver range grammar.
6
7
  *
7
- * Comparison deliberately uses plain semver ordering instead of
8
- * `semver.satisfies`: npm's prerelease rule only allows a prerelease version
9
- * to satisfy a comparator set carrying a prerelease on the same
10
- * major.minor.patch tuple, which would reject a newer host line (0.1.1-rc.2)
11
- * against a declared `>=0.1.0-rc.8` — exactly the cross-cohort upgrade path
12
- * this check must allow. Everything here is pure and tolerant of untrusted
13
- * input: a malformed value means "cannot verify", which the callers treat as
14
- * a fail-closed verdict when a requirement was declared (issue #754).
8
+ * This module is shared by both halves and therefore stays free of `semver`,
9
+ * which is a node package: it parses and compares a single `X.Y.Z[-pre]`
10
+ * version, which is all the browser half needs to render a declared range
11
+ * (`displayMinimumVersion`) and all the host half needs to accept a probed
12
+ * host version (`parseDshVersion`). The range verdict itself lives in the
13
+ * host-only `../host/dsh-compat.ts`, which evaluates the declaration with
14
+ * `semver.satisfies(host, range, { includePrerelease: true })` — the exact
15
+ * call the official boot gate makes, so `||`, `^`, `~`, multi-comparator
16
+ * and x-ranges all decide the same way here as they do at boot.
17
+ *
18
+ * Everything here is pure and tolerant of untrusted input: a malformed value
19
+ * means "cannot verify", which the callers treat as a fail-closed verdict
20
+ * when a requirement was declared (issue #754).
15
21
  * @module @linxin666/dsh-client-ui-plugin-manager/core
16
22
  */
17
23
  /** One parsed DSH host or package version. */
@@ -34,21 +40,13 @@ export declare function parseDshVersion(value: string): DshVersion | undefined;
34
40
  * @returns -1 / 0 / 1, or undefined when either side is malformed.
35
41
  */
36
42
  export declare function compareVersions(left: string, right: string): number | undefined;
37
- /**
38
- * Whether a host version satisfies a declared `>=X.Y.Z[-prerelease]` minimum.
39
- * @param host - the running DSH host version.
40
- * @param minimum - the declared minimum; any form other than `>=<semver>`
41
- * (plain semver, `^`, `~`, multi-comparator ranges, empty) returns undefined.
42
- * @returns true / false, or undefined when the host version is malformed or
43
- * the minimum uses an unsupported form — callers treat undefined as
44
- * "cannot verify" and fail closed for declared requirements.
45
- */
46
- export declare function meetsMinimumDsh(host: string, minimum: string): boolean | undefined;
47
43
  /**
48
44
  * The bare minimum version for display: strips the `>=` operator (and an
49
45
  * optional leading `v`) from a declared requirement so UI copy that already
50
46
  * contains the comparison operator renders `0.1.1-rc.1` instead of
51
- * `>= >=0.1.1-rc.1`. Unsupported range forms render unchanged.
47
+ * `>= >=0.1.1-rc.1`. Every other range form renders unchanged — the browser
48
+ * half does not evaluate a range (the host does, in `../host/dsh-compat.ts`),
49
+ * so it must not pull a range parser into the client bundle to shorten copy.
52
50
  * @param minimum - the declared minimum range.
53
51
  * @returns the version portion for display.
54
52
  */
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The DSH runtime compatibility verdict for one declared plugin requirement,
3
+ * evaluated the way the official boot gate evaluates it
4
+ * (`evaluatePluginCompatibility` in app-boot's `plugin-compatibility.ts`):
5
+ * the requirement is a node-semver range and the host satisfies it when
6
+ * `semver.satisfies(host, range, { includePrerelease: true })` holds. Every
7
+ * legal range form therefore decides: `||` alternatives, `^` and `~`,
8
+ * whitespace-separated comparators, x-ranges, and prerelease tags compared as
9
+ * ordinary versions.
10
+ *
11
+ * The requirement itself comes from `dshRequirementOf` in
12
+ * `../core/version.ts`, which owns the field priority (this module only
13
+ * decides the verdict). Host-only on purpose: `semver` is a node package and
14
+ * must never be reachable from the browser half, which renders the same
15
+ * declaration through the regex-only `displayMinimumVersion`.
16
+ * @module @linxin666/dsh-client-ui-plugin-manager/host
17
+ */
18
+ /**
19
+ * The verdict for one declared requirement, with its cause kept apart so
20
+ * callers can tell "this host is too old" from "we could not check".
21
+ *
22
+ * The distinction is user-visible: a `host-too-low` verdict is the only one
23
+ * that may tell the user to upgrade DSH, because it is the only one where a
24
+ * running version was actually compared and lost. An `unverifiable` verdict
25
+ * means the question was never answered — an absent declaration, a range
26
+ * node-semver rejects, or a host string that is not one valid version — so
27
+ * telling the user to upgrade would send them after a fix nobody confirmed was
28
+ * needed (issue #1819), and reporting it as "below the minimum" contradicts a
29
+ * declaration that may well be satisfied (issue #1899).
30
+ */
31
+ export type DshCompatibility = {
32
+ verdict: 'satisfied';
33
+ } | {
34
+ verdict: 'host-too-low';
35
+ } | {
36
+ verdict: 'unverifiable';
37
+ };
38
+ /**
39
+ * Decide whether the running DSH host satisfies a declared requirement range.
40
+ * @param host - the running DSH host version.
41
+ * @param range - the declared requirement, in any node-semver range form.
42
+ * @returns `satisfied` when the host satisfies the declaration,
43
+ * `host-too-low` when it was compared and does not, and `unverifiable` when
44
+ * no comparison could be made. Callers fail closed on the last two (issue
45
+ * #754) but must not describe them with the same words.
46
+ */
47
+ export declare function evaluateDshCompatibility(host: string, range: string): DshCompatibility;
@@ -250,6 +250,17 @@ export interface NativePluginManager {
250
250
  * re-reads the profile as well, but must read this first — a refusal resolves.
251
251
  */
252
252
  removeBundle(name: string): Promise<unknown>;
253
+ /**
254
+ * Select or deselect a bundle layer while keeping the installed dependency.
255
+ * Present on every published manager (the official Plugins page drives it),
256
+ * and read here only to undo the deselection a refused removal leaves behind.
257
+ * Optional because the undo is best-effort: a manager without it still
258
+ * refuses the removal, and the report says what to do instead.
259
+ * @param name - installed bundle name.
260
+ * @param enabled - whether the bundle contributes its patch layer.
261
+ * @returns the manager's own verdict ({@link NativeManagerOutcome}).
262
+ */
263
+ setBundleEnabled?(name: string, enabled: boolean): Promise<unknown>;
253
264
  }
254
265
  /**
255
266
  * The verdict the official in-process manager returns for one mutation. Its
@@ -434,6 +445,21 @@ export declare class CliGateway {
434
445
  * A failed second phase reinstalls the spec the profile carried before the run,
435
446
  * so an update that cannot land leaves a working plugin behind instead of an
436
447
  * empty slot; the report says which of the two happened.
448
+ *
449
+ * Two facts make the replacement safe to repeat in one session:
450
+ *
451
+ * - **The bundle keeps its layer index.** A removal drops the name from
452
+ * `dsh.profile.bundles` and the reinstall appends it, so a plain
453
+ * remove-then-install moves the bundle behind every bundle that followed it
454
+ * and its patch layer starts overriding rows it never overrode
455
+ * ({@link restoreBundleIndex} puts it back).
456
+ * - **A `bundle-in-use` refusal is answered once, not repeated.** The
457
+ * official guard deselects the bundle and reloads before it checks whether
458
+ * the bundle's rows still run, so a refusal means the session still holds
459
+ * them: the update is retried exactly once against that settled state, and a
460
+ * second refusal restores the selection and names the restart the person has
461
+ * to do ({@link removeForReplacement}).
462
+ *
437
463
  * @param job - the update job whose spec is installed.
438
464
  * @param native - the official manager.
439
465
  * @param targetId - the installed bundle being replaced.
@@ -441,6 +467,49 @@ export declare class CliGateway {
441
467
  * @returns the failure to report, or undefined once the target spec landed.
442
468
  */
443
469
  private replaceInstalled;
470
+ /**
471
+ * Where a bundle sits in the layer order, read before the removal drops it.
472
+ * @param name - the installed bundle name.
473
+ * @returns the index in `dsh.profile.bundles`, or undefined when the profile
474
+ * does not list it (nothing to restore in that case).
475
+ */
476
+ private bundleIndexOf;
477
+ /**
478
+ * Put a replaced bundle back at the layer index it had before the removal.
479
+ *
480
+ * The loader applies one patch layer per entry of `dsh.profile.bundles`, in
481
+ * that order, so the index is behavior: a bundle that is removed and
482
+ * reinstalled without this lands behind every bundle that followed it, and
483
+ * whole rows start inheriting from a layer that used to come first. The write
484
+ * is the manifest's own backup + tmp + rename path, and nothing is written
485
+ * when the profile already lists the bundle where it belongs.
486
+ * @param name - the reinstalled bundle.
487
+ * @param spec - the dependency spec the reinstall recorded (unused when the bundle is absent).
488
+ * @param index - the position captured before the removal.
489
+ */
490
+ private restoreBundleIndex;
491
+ /**
492
+ * Remove a bundle for the two-phase replacement, answering the official
493
+ * manager's in-use refusal instead of repeating it.
494
+ *
495
+ * Read the official `removeBundle` guard in order: it deselects the bundle,
496
+ * reloads the profile, and only then checks whether the bundle's own rows
497
+ * still hold a running fiber, which it reports as `bundle-in-use`. The
498
+ * deselection is therefore already on disk when the refusal arrives — the
499
+ * guard re-reads the selection on entry, so asking once more after that
500
+ * settled state is idempotent and is the only way an update can continue
501
+ * without a restart. A second refusal means the rows really are still
502
+ * loaded, and the report then names the restart instead of a bare code.
503
+ * @param native - the official manager.
504
+ * @param name - the bundle to remove.
505
+ * @returns the refusal to report, whether the profile lost the selection on the
506
+ * way, and the remedy text for that refusal.
507
+ */
508
+ private removeForReplacement;
509
+ /** Whether a bundle is still an installed dependency but no longer selected. */
510
+ private bundleSelectionLost;
511
+ /** Put a selection back after a refused removal, so the profile is as it was found. */
512
+ private restoreBundleSelection;
444
513
  /** Start a deterministic legacy aggregate migration. */
445
514
  migrate(sourceId: string, targetId: string, targetVersion: string, targetSpec: string): {
446
515
  jobId: string;
@@ -505,15 +574,68 @@ export declare class CliGateway {
505
574
  * @returns the composed dump text, or undefined when it is unavailable.
506
575
  */
507
576
  private compositionOf;
577
+ /**
578
+ * The entry ids a user-layer override may still point at: the composed ids
579
+ * plus every id the profile's own bundle layers still declare.
580
+ *
581
+ * The composition alone does not prove a row is retired. A host that
582
+ * composes while a bundle is being replaced — the remove-then-install half of
583
+ * an application-owned update, or an upgrade whose packages are half
584
+ * installed — composes *without* the rows of the bundle that is momentarily
585
+ * gone, and pruning on that probe deletes the user's override for a row that
586
+ * still exists (0.4.7 lost `web-ui-remote-web-ui` and `ui-schedule` this
587
+ * way). Declarations live in the bundle layers, so they survive that window.
588
+ * @param composed - the entry ids of the composition probe.
589
+ * @returns the ids to keep, or undefined when a declared layer cannot be
590
+ * read, which proves nothing either way and must leave the file alone.
591
+ */
592
+ private liveOverrideIds;
593
+ /**
594
+ * The entry names the installed bundles' own rows carry, by entry id.
595
+ *
596
+ * The loader inserts one row per id and takes that row's name from the
597
+ * bundle's own patch file, so this map is the very fact the loader composes:
598
+ * a profile row naming something else is a row the loader skips.
599
+ *
600
+ * @returns the live names, or undefined when a bundle's patch cannot be read
601
+ * (which proves nothing either way and must leave the profile alone).
602
+ */
603
+ private liveEntryNames;
604
+ /**
605
+ * Point the profile's own rows at the packages that now carry those entry ids.
606
+ *
607
+ * A bundle that renames a row's package leaves every profile row that named
608
+ * the old one dead: the include patch semantics skip a row whose name does
609
+ * not match the inserted row, and the skip takes the whole row with it — a
610
+ * config row stops configuring and a `disabled` override stops disabling,
611
+ * both without a word in the browser. Issue #1901 moved the aggregate's
612
+ * family rows from the `@linxin666/dsh-web-all/<family>` subpath to the
613
+ * real package, so every profile row written before that upgrade went dead
614
+ * with it.
615
+ *
616
+ * The repair is idempotent and writes only when a row actually changed, so a
617
+ * healthy profile is never rewritten.
618
+ *
619
+ * @returns the repaired rows, in file order.
620
+ */
621
+ repairProfileRowNames(): Promise<Array<{
622
+ id: string;
623
+ from: string;
624
+ to: string;
625
+ }>>;
508
626
  /**
509
627
  * Post-update orphan guard: drop this package's own enablement overrides
510
- * whose entry id the composed *target* profile no longer carries. The
511
- * authority is the loader's own composition after the update
512
- * ({@link composedEntryIdsOf}), not the profile patch and not the source
513
- * profile: an override is only orphaned once the target composition stops
514
- * declaring that id, and ids the official base or another bundle still
515
- * mounts stay valid. A retired row would otherwise leave a stale override
516
- * that the loader reports on every boot as `patch: entry "<id>" not found`.
628
+ * whose entry id neither the composed *target* profile nor any bundle layer
629
+ * still declares. The composition is the loader's own after the update
630
+ * ({@link composedEntryIdsOf}), widened by the bundle layers' declarations
631
+ * ({@link liveOverrideIds}) because a composition taken mid-upgrade omits
632
+ * rows that still exist. A retired row would otherwise leave a stale
633
+ * override that the loader reports on every boot as
634
+ * `patch: entry "<id>" not found`.
635
+ *
636
+ * The stale-row-name repair ({@link repairProfileRowNames}) runs first and
637
+ * on its own authority, so a profile whose bundle declarations cannot be
638
+ * resolved is repaired even though the prune then writes nothing.
517
639
  *
518
640
  * Nothing is written when nothing is orphaned — a second run over a pruned
519
641
  * profile returns the input text untouched, so no write and no second backup
@@ -7,6 +7,14 @@
7
7
  * Semantics: RFC 5735 IPv4 127/8, ::1, IPv4-mapped ::ffff:127/8 (matching the
8
8
  * remote-web-ui gate), localhost hostnames, plus the browser same-origin
9
9
  * markers (sec-fetch-site and Origin) for the request-level fence.
10
+ *
11
+ * A reverse proxy in front of the host rewrites the Host header to its own
12
+ * upstream literal (a Cloudflare tunnel, frp and an nginx reverse proxy all
13
+ * dial 127.0.0.1:<port>), and the socket the origin sees is the proxy's, which
14
+ * is loopback by construction. Both halves of the fence then hold for a public
15
+ * request. Forwarding headers are the signal that a hop stands in between: a
16
+ * request that carries CF-Connecting-IP or X-Forwarded-For is answered through
17
+ * a proxy and is never treated as a local one (issue #1906).
10
18
  * @module dsh-web-shared/host/loopback
11
19
  */
12
20
  import type { IncomingMessage } from 'node:http';
@@ -16,9 +24,20 @@ export declare function isIPv4Loopback(v4: string): boolean;
16
24
  export declare function isLoopbackAddress(address: string | undefined): boolean;
17
25
  /** Whether a normalized URL hostname names the loopback authority (localhost, [::1], 127/8). */
18
26
  export declare function isLoopbackHostname(hostname: string): boolean;
27
+ /**
28
+ * Whether a reverse proxy stood between the client and this host: the request
29
+ * carries CF-Connecting-IP or X-Forwarded-For. Either header is stamped by a
30
+ * hop that forwards traffic, so the request did not originate on this machine.
31
+ * @param request - node HTTP request.
32
+ * @returns true when a forwarding header is present.
33
+ */
34
+ export declare function isProxiedRequest(request: IncomingMessage): boolean;
19
35
  /**
20
36
  * Request-level trust fence: a loopback socket address AND a loopback Host
21
37
  * header, plus browser same-origin markers. The socket address is
22
- * authoritative; X-Forwarded-For is never trusted.
38
+ * authoritative for a direct connection; a request that carries a forwarding
39
+ * header is refused outright, because a proxy in front of the host makes both
40
+ * the socket address and the Host header describe the proxy rather than the
41
+ * client. X-Forwarded-For is therefore never evidence *for* loopback.
23
42
  */
24
43
  export declare function isLoopbackRequest(request: IncomingMessage): boolean;
@@ -13,6 +13,12 @@
13
13
  * crashed. The plugin therefore stops the host and lets the shell run the
14
14
  * restart it already owns (app.relaunch(), the same recovery action the
15
15
  * Desktop app offers after installing a downloaded update). Mode 'shell'.
16
+ * That only holds for a shell that ACTUALLY restarts a host that exits. A
17
+ * shell that merely reports the stop leaves a dead window with no host —
18
+ * strictly worse than not restarting at all — so the shell must announce the
19
+ * guarantee in {@link SHELL_RESTART_CAPABILITY_ENV}; a host that sees no such
20
+ * marker answers 'manual' instead of stopping itself (see
21
+ * {@link shellRestartIsSupported}).
16
22
  * - A host this plugin can prove is a terminal launch (an interactive stdio
17
23
  * pair, no Electron in the environment) is restarted in place: a detached
18
24
  * helper waits for this process to exit and re-executes the same command
@@ -59,6 +65,23 @@ export interface RestartFacts {
59
65
  }
60
66
  /** Grace period between answering the restart request and leaving the process. */
61
67
  export declare const RESTART_EXIT_DELAY_MS = 400;
68
+ /**
69
+ * Environment marker a Desktop shell sets when it guarantees that a host which
70
+ * exits is replaced by a fresh host (rather than reported as stopped).
71
+ *
72
+ * The packaged Desktop shell owns the process tree but has no obligation to
73
+ * respawn it: the shipped shell in this repository's compat matrix answers a
74
+ * host exit with `desktop host stopped` and an error page. Stopping ourselves
75
+ * under such a shell turns the restart button into "kill the app", so the mode
76
+ * requires proof of the opposite behaviour.
77
+ */
78
+ export declare const SHELL_RESTART_CAPABILITY_ENV = "DSH_SHELL_RESTARTS_HOST";
79
+ /**
80
+ * Whether the launching shell promises to bring the host back after it exits.
81
+ * @param env - the environment the host was launched with.
82
+ * @returns true only for an opt-in marker value of `1`.
83
+ */
84
+ export declare function shellRestartIsSupported(env: NodeJS.ProcessEnv): boolean;
62
85
  /** How long the helper waits for this process to disappear before giving up on the wait. */
63
86
  export declare const RESTART_WAIT_MS = 30000;
64
87
  /**
@@ -72,6 +72,23 @@ export declare function findBareRow(root: YAMLSeq, id: string): {
72
72
  * @returns the claimed insert ids, in order.
73
73
  */
74
74
  export declare function claimedIdsOf(patchText: string): string[];
75
+ /**
76
+ * Every entry id a layer declares: its top-level `- id:` rows (bare override
77
+ * rows and config rows alike) plus the entries of its `- insert:` lists. Ids
78
+ * nested inside a row's own `config:` are composition children of that entry,
79
+ * not layer entries, and are not declared here.
80
+ *
81
+ * This answers "does this layer still declare that row?" without composing, so
82
+ * it stays true in the states where a composition probe is not: a host that
83
+ * composes mid-upgrade, or while a bundle's package is being replaced, drops
84
+ * rows whose layers still exist.
85
+ * @param patchText - a patch layer's text.
86
+ * @param filename - absolute path (diagnostics only).
87
+ * @returns the declared ids, in file order, without duplicates.
88
+ * @throws when the layer does not parse; a caller must then treat this layer's
89
+ * declarations as unknown rather than empty.
90
+ */
91
+ export declare function declaredRowIds(patchText: string, filename: string): string[];
75
92
  /** One insert entry of a bundle patch: the claimed id and the plugin package name. */
76
93
  export interface InsertRow {
77
94
  id?: string;
@@ -152,3 +169,37 @@ export interface PrunedOverrides {
152
169
  * @returns the rewritten text and the pruned ids.
153
170
  */
154
171
  export declare function pruneOrphanRowOverrides(text: string, filename: string, composedIds: ReadonlySet<string>): PrunedOverrides;
172
+ /** The live entry names by id, and the rows this manager repaired. */
173
+ export interface RepairedRowNames {
174
+ /** The new file text; the original text when nothing was repaired. */
175
+ readonly text: string;
176
+ /** The repaired rows, in file order. */
177
+ readonly repaired: Array<{
178
+ id: string;
179
+ from: string;
180
+ to: string;
181
+ }>;
182
+ }
183
+ /**
184
+ * Point the profile's own rows at the packages that now carry those entry ids.
185
+ *
186
+ * The include patch semantics skip a row whose `name` does not match the name
187
+ * of the row a bundle inserted under that id, and the skip takes the whole row
188
+ * with it: a config row stops configuring anything and a `disabled` override
189
+ * stops disabling anything, both without a word in the browser. A package that
190
+ * changes its name — the aggregate's family rows moved from the
191
+ * `@linxin666/dsh-web-all/<family>` subpath to the real package in issue
192
+ * #1901 — therefore leaves every profile row that named it dead.
193
+ *
194
+ * The live names come from the installed bundles' own patch files, which is
195
+ * where the loader takes the row it inserts, so a repaired row names exactly
196
+ * the package the loader mounts under that id. A row whose id no bundle claims
197
+ * is left alone: its package may still be carried by a layer this manager
198
+ * cannot see, and a name it cannot prove is a name it must not write.
199
+ *
200
+ * @param text - current patch file text.
201
+ * @param filename - absolute path (diagnostics only).
202
+ * @param liveNames - the live entry names, by entry id.
203
+ * @returns the rewritten text and the repaired rows.
204
+ */
205
+ export declare function repairStaleRowNames(text: string, filename: string, liveNames: ReadonlyMap<string, string>): RepairedRowNames;
@@ -10,12 +10,16 @@ import type { LayerSnapshot } from '../core/patch-diff.ts';
10
10
  import { type ProfileFacts } from './profile.ts';
11
11
  /**
12
12
  * Entry rows that must never carry a disabled override: the manager tab
13
- * itself (the UI performing the write), the family settings surface the tab
14
- * injects into, and the aggregate compat face (disabling it unmounts the
15
- * whole folded client bundle while host rows keep running — a half-dead
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.
13
+ * itself (the UI performing the write) and the family settings surface the
14
+ * tab injects into. Covers both the standalone and the aggregate row ids. The
15
+ * standalone id is this package's own `cordis.patch.yml` insert id, never the
16
+ * official `ui-plugin-manager` row the DSH web-app bundle already claims.
17
+ *
18
+ * `web-ui-compat` is deliberately NOT locked (issue #1901). It used to be:
19
+ * the compat row carried the inlined browser half of every family, so
20
+ * disabling it blanked the whole page while the host rows kept running. Family
21
+ * rows mount their own packages now, and the compat row is the optional
22
+ * compatibility patch layer the issue asks users to be able to turn off.
19
23
  */
20
24
  export declare const LOCKED_ENTRY_IDS: ReadonlySet<string>;
21
25
  /** The listing result: plugin rows plus the raw layer snapshot for diffs. */
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.7",
4
+ "version": "0.4.8",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
@@ -53,6 +53,7 @@
53
53
  "@types/node": "^22.20.0",
54
54
  "@types/react": "~18.3.1",
55
55
  "@types/react-dom": "^18.3.5",
56
+ "@types/semver": "^7.8.0",
56
57
  "jsdom": "^26.0.0",
57
58
  "react": "^18.3.1",
58
59
  "react-dom": "^18.3.1",
@@ -73,6 +74,7 @@
73
74
  ],
74
75
  "license": "BSD-3-Clause",
75
76
  "dependencies": {
77
+ "semver": "^7.8.5",
76
78
  "yaml": "^2.8.2"
77
79
  },
78
80
  "scripts": {