@linxin666/dsh-client-ui-plugin-manager 0.4.12 → 0.4.14

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.
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The "Built-in plugins" group at the bottom of the official Plugins page.
3
+ *
4
+ * By default it lists every global Loader entry no installed bundle contributes —
5
+ * the rows a profile patch inserts itself (the Computer Use pair among them) and
6
+ * the rows the host ships globally — each with the official manager's own switch,
7
+ * so a row is enabled or disabled by exactly the call the official page makes.
8
+ * One control widens that list to every Loader entry and names, on each row a
9
+ * bundle adds, the bundle that adds it: those rows are the ones a reader also
10
+ * meets on that bundle's own page, and the answer to "why is this here twice" is
11
+ * that sentence. Below it, the agent preset compositions the same inventory
12
+ * reports are rendered read-only: a preset's rows are composed per session and
13
+ * only a Loader context can decide a `!!js` condition, so nothing here offers
14
+ * them a switch.
15
+ *
16
+ * Every state shown is the Loader's own: after an accepted write the group
17
+ * re-reads instead of trusting the answer, a refusal is named by the code the
18
+ * manager returned, and a locked row says which lock it is.
19
+ * @module @linxin666/dsh-client-ui-plugin-manager/client
20
+ */
21
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
22
+ import { type DisplayText } from '../core/builtin.ts';
23
+ import type { RemoteSnapshot } from './native-faces.ts';
24
+ /** The operations the group drives, all of them the official manager's own. */
25
+ export interface BuiltinPluginsInjected {
26
+ /** The official faces, sampled on every render; its `version` moves on change. */
27
+ remote: RemoteSnapshot;
28
+ /**
29
+ * Resolve package metadata text through the language the GUI is showing. The
30
+ * inventory hands back translations, not strings, and the mount owns no
31
+ * language of its own.
32
+ */
33
+ resolveText: (text: DisplayText) => string;
34
+ }
35
+ /** Full component props. */
36
+ export type BuiltinPluginsProps = PropsLocale<'settings.pluginManager'> & BuiltinPluginsInjected;
37
+ /**
38
+ * The group itself. All state is local: the page around it owns the plugin list,
39
+ * and the Loader is the only truth this component reports.
40
+ */
41
+ export declare function BuiltinPlugins(props: BuiltinPluginsProps): import("react").JSX.Element;
@@ -16,7 +16,7 @@
16
16
  * @module @linxin666/dsh-client-ui-plugin-manager/client
17
17
  */
18
18
  import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
19
- import type { PluginUpdateItem, PluginUpdateResult, RestartMode } from '../core/protocol.ts';
19
+ import type { PluginUpdateItem, PluginUpdateResult, RestartMode, RestartPlanWire } from '../core/protocol.ts';
20
20
  /** The operations the toolbar drives (the package's dual-channel face). */
21
21
  export interface PluginListToolbarInjected {
22
22
  /** Whether this browser has loopback authority to use the host routes. */
@@ -32,10 +32,11 @@ export interface PluginListToolbarInjected {
32
32
  /**
33
33
  * Read how a restart would be carried out, without carrying it out: the
34
34
  * confirmation must name the same consequence the host will produce (an
35
- * in-place relaunch, the packaged Desktop shell's own recovery dialog, or a
36
- * manual restart), and a plan read has no side effects.
35
+ * in-place relaunch, the packaged Desktop shell's own recovery dialog, a
36
+ * systemd unit restart, or a manual restart), and a plan read has no side
37
+ * effects. A systemd plan carries the unit it would restart.
37
38
  */
38
- restartPlan: () => Promise<RestartMode>;
39
+ restartPlan: () => Promise<RestartPlanWire>;
39
40
  /** Restart the host so an applied update is loaded. */
40
41
  restart: () => Promise<RestartMode>;
41
42
  }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Mounting the built-in plugin group at the bottom of the official Plugins page.
3
+ *
4
+ * The page declares no seat at the list's end: its extension points are
5
+ * `plugins.detail.*` (per page), `plugins.bundle.config` / `plugins.row.config` /
6
+ * `plugins.item` (configuration entries) and `plugins.bundle.activation`. Its
7
+ * list view is `<section data-plugin-panel> <header/> <div class="…_installedPanel">
8
+ * <section data-plugin-group="basic|extensions|bundles"/> … </div> … </section>`,
9
+ * and the class names are CSS-module hashes, so the seat is found through the
10
+ * page's own data attributes plus DOM position: the section after the installed
11
+ * panel, which is a flex column of 32px gaps whose direct children are exactly
12
+ * the width of the groups above.
13
+ *
14
+ * The container is a plain element carrying its own React root, so it can never
15
+ * disturb the page's reconciliation, and it re-seats itself through the
16
+ * page-wide body-mutation hub: a re-render that moves or drops the panel is
17
+ * followed on the next frame, a panel switch that unmounts the list detaches
18
+ * the container until the list returns, and the detail / "all plugins" views
19
+ * (which render no bundles group) leave it off the page entirely.
20
+ * @module @linxin666/dsh-client-ui-plugin-manager/client
21
+ */
22
+ import { type BuiltinPluginsProps } from './BuiltinPlugins.tsx';
23
+ /** Stable attribute identifying the injected container (mount idempotency). */
24
+ export declare const BUILTIN_GROUP_MOUNT_SELECTOR = "[data-dsh-plugin-manager-builtin]";
25
+ /** The mount's inputs. */
26
+ export interface BuiltinGroupMountOptions {
27
+ /** Build the group's props; called on mount and on every locale change. */
28
+ props: () => BuiltinPluginsProps;
29
+ /** Locale change subscription (ctx.locale.subscribe); re-renders the group. */
30
+ subscribe?: (listener: () => void) => () => void;
31
+ }
32
+ /**
33
+ * The official page's installed panel, when the list view is mounted.
34
+ * @returns the element the group belongs after, or undefined off the list view.
35
+ */
36
+ export declare function builtinGroupSeat(): HTMLElement | undefined;
37
+ /**
38
+ * Mount the built-in plugin group after the installed panel.
39
+ * @param options - props factory and the optional locale subscription.
40
+ * @returns disposer removing the container, its observers and its React root.
41
+ */
42
+ export declare function mountBuiltinPluginGroup(options: BuiltinGroupMountOptions): () => void;
@@ -1,8 +1,9 @@
1
1
  /**
2
- * Plugin-manager browser half: contributes the package's one remaining
3
- * surface — the check-for-updates block on the official Plugins page — and
4
- * provides the dual-channel face as the `'pluginManager'` cordis service for
5
- * sibling client plugins.
2
+ * Plugin-manager browser half: contributes this package's surfaces on the
3
+ * official Plugins page — the check-for-updates block, the list-level update
4
+ * toolbar, and the built-in plugin group at the list's bottom — and provides the
5
+ * dual-channel face as the `'pluginManager'` cordis service for sibling client
6
+ * plugins.
6
7
  *
7
8
  * It is dual-channel: on runtimes with the official installer services
8
9
  * (DSHCode, the 1.0.4 checkout web) every operation rides the official
@@ -24,7 +25,7 @@
24
25
  import type { Context as ClientContext } from '@deepseek-ai/cordis';
25
26
  import { type PluginUpdatePatchInjected } from './PluginUpdatePatch.tsx';
26
27
  import { type PluginManagerKey } from './locales.ts';
27
- import { type RestartMode } from '../core/protocol.ts';
28
+ import { type RestartMode, type RestartPlanWire } from '../core/protocol.ts';
28
29
  import { type PluginManagerService } from '../core/service.ts';
29
30
  declare module '@deepseek-ai/dsh-client-ui-slots' {
30
31
  interface LocaleNamespaceMap {
@@ -52,10 +53,11 @@ export type PluginManagerFace = PluginUpdatePatchInjected & PluginManagerService
52
53
  /**
53
54
  * Read how a restart would be carried out without triggering it (the same
54
55
  * 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.
56
+ * packaged Desktop host can say what its system dialog will do, and a
57
+ * systemd host can name the unit that restarts, instead of surprising the
58
+ * user with either.
57
59
  */
58
- restartPlan: () => Promise<RestartMode>;
60
+ restartPlan: () => Promise<RestartPlanWire>;
59
61
  };
60
62
  /**
61
63
  * Build the dual-channel face once: official-channel and gateway-channel
@@ -35,6 +35,7 @@ declare const STATIC_ZH: {
35
35
  restartConfirm: string;
36
36
  restartPlanRelaunch: string;
37
37
  restartPlanShell: string;
38
+ restartPlanSystemd: string;
38
39
  restartPlanManual: string;
39
40
  restartShellWarning: string;
40
41
  restartDesktopHint: string;
@@ -47,6 +48,36 @@ declare const STATIC_ZH: {
47
48
  downloadingPercent: string;
48
49
  extracting: string;
49
50
  writing: string;
51
+ builtinGroup: string;
52
+ builtinReading: string;
53
+ builtinEmpty: string;
54
+ builtinUnavailable: string;
55
+ builtinFailed: string;
56
+ builtinUnconfirmed: string;
57
+ builtinScopeExpand: string;
58
+ builtinScopeCollapse: string;
59
+ builtinOwnedBy: string;
60
+ builtinToggle: string;
61
+ builtinFailedEnable: string;
62
+ builtinFailedDisable: string;
63
+ builtinReasonManagementRequired: string;
64
+ builtinReasonUnaddressable: string;
65
+ builtinReasonUnknown: string;
66
+ builtinRestartRequired: string;
67
+ builtinOverridden: string;
68
+ builtinRestartUnnamed: string;
69
+ builtinRestartNoHmr: string;
70
+ builtinRestartPackageMoved: string;
71
+ builtinRestartHostModule: string;
72
+ builtinRestartUnmanagedPlugin: string;
73
+ builtinRestartModuleComparison: string;
74
+ presetGroup: string;
75
+ presetDefault: string;
76
+ presetBroken: string;
77
+ presetRowOn: string;
78
+ presetRowOff: string;
79
+ presetRowConditional: string;
80
+ presetRowConditionalUnnamed: string;
50
81
  localOnlyTitle: string;
51
82
  localOnlyBody: string;
52
83
  };
@@ -75,6 +106,7 @@ export declare const zh: {
75
106
  restartConfirm: string;
76
107
  restartPlanRelaunch: string;
77
108
  restartPlanShell: string;
109
+ restartPlanSystemd: string;
78
110
  restartPlanManual: string;
79
111
  restartShellWarning: string;
80
112
  restartDesktopHint: string;
@@ -87,6 +119,36 @@ export declare const zh: {
87
119
  downloadingPercent: string;
88
120
  extracting: string;
89
121
  writing: string;
122
+ builtinGroup: string;
123
+ builtinReading: string;
124
+ builtinEmpty: string;
125
+ builtinUnavailable: string;
126
+ builtinFailed: string;
127
+ builtinUnconfirmed: string;
128
+ builtinScopeExpand: string;
129
+ builtinScopeCollapse: string;
130
+ builtinOwnedBy: string;
131
+ builtinToggle: string;
132
+ builtinFailedEnable: string;
133
+ builtinFailedDisable: string;
134
+ builtinReasonManagementRequired: string;
135
+ builtinReasonUnaddressable: string;
136
+ builtinReasonUnknown: string;
137
+ builtinRestartRequired: string;
138
+ builtinOverridden: string;
139
+ builtinRestartUnnamed: string;
140
+ builtinRestartNoHmr: string;
141
+ builtinRestartPackageMoved: string;
142
+ builtinRestartHostModule: string;
143
+ builtinRestartUnmanagedPlugin: string;
144
+ builtinRestartModuleComparison: string;
145
+ presetGroup: string;
146
+ presetDefault: string;
147
+ presetBroken: string;
148
+ presetRowOn: string;
149
+ presetRowOff: string;
150
+ presetRowConditional: string;
151
+ presetRowConditionalUnnamed: string;
90
152
  localOnlyTitle: string;
91
153
  localOnlyBody: string;
92
154
  };
@@ -115,6 +177,7 @@ export declare const en: {
115
177
  restartConfirm: string;
116
178
  restartPlanRelaunch: string;
117
179
  restartPlanShell: string;
180
+ restartPlanSystemd: string;
118
181
  restartPlanManual: string;
119
182
  restartShellWarning: string;
120
183
  restartDesktopHint: string;
@@ -127,6 +190,36 @@ export declare const en: {
127
190
  downloadingPercent: string;
128
191
  extracting: string;
129
192
  writing: string;
193
+ builtinGroup: string;
194
+ builtinReading: string;
195
+ builtinEmpty: string;
196
+ builtinUnavailable: string;
197
+ builtinFailed: string;
198
+ builtinUnconfirmed: string;
199
+ builtinScopeExpand: string;
200
+ builtinScopeCollapse: string;
201
+ builtinOwnedBy: string;
202
+ builtinToggle: string;
203
+ builtinFailedEnable: string;
204
+ builtinFailedDisable: string;
205
+ builtinReasonManagementRequired: string;
206
+ builtinReasonUnaddressable: string;
207
+ builtinReasonUnknown: string;
208
+ builtinRestartRequired: string;
209
+ builtinOverridden: string;
210
+ builtinRestartUnnamed: string;
211
+ builtinRestartNoHmr: string;
212
+ builtinRestartPackageMoved: string;
213
+ builtinRestartHostModule: string;
214
+ builtinRestartUnmanagedPlugin: string;
215
+ builtinRestartModuleComparison: string;
216
+ presetGroup: string;
217
+ presetDefault: string;
218
+ presetBroken: string;
219
+ presetRowOn: string;
220
+ presetRowOff: string;
221
+ presetRowConditional: string;
222
+ presetRowConditionalUnnamed: string;
130
223
  localOnlyTitle: string;
131
224
  localOnlyBody: string;
132
225
  };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Bridge to the official remote namespaces the built-in plugin group reads
3
+ * through, and to the event that says the host rewrote the profile.
4
+ *
5
+ * - `remote.pluginInventory` — the Loader snapshot (entries and, when a roster is
6
+ * composed, each agent preset's rows).
7
+ * - `remote.pluginManager` — the very manager the official Plugins page drives:
8
+ * per-row writability, the installed bundle roster, and enable/disable.
9
+ * - `plugin-manager/changed` — forwarded on the `remote` root after a write, so a
10
+ * second page (or the official page's own switch) re-reads instead of showing
11
+ * a stale toggle.
12
+ *
13
+ * Every face is OPTIONAL: `ctx.inject` runs the effect when the namespace is
14
+ * published and disposes it when it goes away, which clears the snapshot. An
15
+ * absent face leaves the group's read-only "unavailable" state, never a write.
16
+ *
17
+ * CONTRACT OBSERVATION: cross-package value imports are forbidden and this
18
+ * package does not depend on the api-remotes assembly types, so the members
19
+ * called here are re-declared. Their shapes are the official manager's own
20
+ * schemas, not ones this package invented.
21
+ * @module @linxin666/dsh-client-ui-plugin-manager/client
22
+ */
23
+ import type { Context } from '@deepseek-ai/cordis';
24
+ /** The inventory namespace's one method. */
25
+ export interface InventoryFace {
26
+ /** Read the Loader, and every composed preset's rows, on each call. */
27
+ list(): Promise<unknown>;
28
+ }
29
+ /** The manager namespace's methods this package calls. */
30
+ export interface ManagerFace {
31
+ /** Every Loader entry with its `patchId` or the reason it cannot be written. */
32
+ listPlugins(): Promise<unknown>;
33
+ /** Every installed bundle, with the rows its patch inserts. */
34
+ listBundles(): Promise<unknown>;
35
+ /** Enable or disable one Loader entry through the official manager. */
36
+ setPluginEnabled(entryId: string, enabled: boolean): Promise<unknown>;
37
+ }
38
+ /** The `remote` root's forwarded-event subscription. */
39
+ export interface RemoteEventFace {
40
+ $on?(event: string, listener: (payload: unknown) => void): () => void;
41
+ }
42
+ /** What the group reads, sampled per render; `version` moves on every change. */
43
+ export interface RemoteSnapshot {
44
+ readonly version: number;
45
+ readonly inventory: InventoryFace | null;
46
+ readonly manager: ManagerFace | null;
47
+ }
48
+ /** The current snapshot (stable reference between changes). */
49
+ export declare function getRemoteSnapshot(): RemoteSnapshot;
50
+ /**
51
+ * Subscribe to snapshot changes.
52
+ * @param listener - called after every face swap or forwarded change event.
53
+ * @returns the unsubscribe function.
54
+ */
55
+ export declare function subscribeRemote(listener: () => void): () => void;
56
+ /**
57
+ * Bridge the official faces into the snapshot. Uses `ctx.inject` (not the
58
+ * plugin's module-level inject array) so each face stays optional.
59
+ * @param ctx - the client context the plugin runs in.
60
+ */
61
+ export declare function bridgeRemoteNamespaces(ctx: Context): void;
@@ -0,0 +1,178 @@
1
+ /**
2
+ * The built-in plugin group's pure logic: which global Loader entries no
3
+ * installed bundle contributes, how each one may be written, and the two answer
4
+ * shapes the official remote namespaces return.
5
+ *
6
+ * "Built-in" is a subtraction, not a roster of ours: the inventory's Loader
7
+ * entries minus every entry an installed bundle's patch inserts. That covers the
8
+ * rows a profile patch inserts itself — the Computer Use pair among them — and
9
+ * the rows the host ships globally, without this package keeping a list that
10
+ * would drift. The modules the official manager protects are refused by the
11
+ * manager itself and reported per row as `readOnlyReason`, so no second
12
+ * whitelist lives here.
13
+ * @module @linxin666/dsh-client-ui-plugin-manager/client
14
+ */
15
+ /** Literal text or translations indexed by language id, as package metadata carries it. */
16
+ export type DisplayText = string | {
17
+ readonly en: string;
18
+ readonly [locale: string]: string;
19
+ };
20
+ /** Display metadata the inventory attaches to a Loader entry. */
21
+ export interface EntryMeta {
22
+ readonly title?: DisplayText;
23
+ readonly description?: DisplayText;
24
+ readonly icon?: string;
25
+ readonly error?: string;
26
+ }
27
+ /** A Loader entry's fiber phase, or null when the entry has no live root. */
28
+ export type FiberPhase = null | 'failed' | 'pending' | 'active' | 'loading' | 'unloading';
29
+ /** One Loader entry as `pluginInventory.list()` reports it. */
30
+ export interface LoaderEntry {
31
+ readonly entryId: string;
32
+ readonly moduleName: string;
33
+ readonly meta?: EntryMeta;
34
+ readonly enabled: boolean;
35
+ readonly fiberPhase: FiberPhase;
36
+ }
37
+ /** One composition row of an agent preset. */
38
+ export interface AgentPresetRow {
39
+ readonly entryId: string | null;
40
+ readonly moduleName: string;
41
+ readonly meta?: EntryMeta;
42
+ readonly enabled: boolean | 'conditional';
43
+ /** The row's own `!!js` disabled expression, when it carries one. */
44
+ readonly condition?: string;
45
+ readonly fiberPhase: FiberPhase;
46
+ }
47
+ /** One composed agent preset. */
48
+ export interface AgentPreset {
49
+ readonly id: string;
50
+ readonly name?: string;
51
+ readonly isDefault: boolean;
52
+ /** Why this preset's composition cannot be read; absent when rows answer. */
53
+ readonly broken?: string;
54
+ readonly rows: readonly AgentPresetRow[];
55
+ }
56
+ /** The `pluginInventory.list()` snapshot this group consumes. */
57
+ export interface PluginInventory {
58
+ readonly managementAvailable?: boolean;
59
+ readonly entries: readonly LoaderEntry[];
60
+ readonly agentPresets?: readonly AgentPreset[];
61
+ }
62
+ /** The slice of `pluginManager.listBundles()` this group subtracts. */
63
+ export interface BundleFacts {
64
+ /** The installed bundle's package name; the row's owner reads as this. */
65
+ readonly name?: string;
66
+ /**
67
+ * Whether the profile actually declares this bundle. The roster also reports
68
+ * bundles that are only available, and their declared rows are no mounted
69
+ * Loader entries — counting them would take a live row out of the default scope
70
+ * over a package that is not even installed, so `false` is skipped. Absent
71
+ * keeps the bundle in play, which is how the manager always answers.
72
+ */
73
+ readonly installed?: boolean;
74
+ readonly rows?: readonly {
75
+ readonly entryId?: string;
76
+ }[];
77
+ }
78
+ /** The slice of `pluginManager.listPlugins()` that decides a row's writability. */
79
+ export interface PluginFacts {
80
+ readonly entryId: string;
81
+ readonly readOnlyReason?: 'management-required' | 'unaddressable';
82
+ }
83
+ /** Why a row's switch is locked, or that the manager will take a write. */
84
+ export type WriteState = 'writable' | 'management-required' | 'unaddressable' | 'unknown';
85
+ /** One row of the built-in group, in whichever scope it is shown. */
86
+ export interface BuiltinRow {
87
+ readonly entryId: string;
88
+ readonly moduleName: string;
89
+ readonly meta?: EntryMeta;
90
+ readonly enabled: boolean;
91
+ readonly write: WriteState;
92
+ /**
93
+ * The installed bundle whose patch inserts this entry, by package name. Absent
94
+ * on a row no bundle contributes — the rows the group lists by default.
95
+ */
96
+ readonly ownedBy?: string;
97
+ }
98
+ /** The group's two scopes, the ownership behind them, and the roster state. */
99
+ export interface BuiltinSelection {
100
+ /** The default scope: the entries no installed bundle contributes. */
101
+ readonly rows: readonly BuiltinRow[];
102
+ /**
103
+ * Every Loader entry in Loader order, with `ownedBy` on the ones a bundle
104
+ * contributes. Same row shape as {@link BuiltinSelection.rows}, so the two
105
+ * scopes render through one path.
106
+ */
107
+ readonly allRows: readonly BuiltinRow[];
108
+ /** Loader entry id to the package name of the bundle that inserts it. */
109
+ readonly owners: ReadonlyMap<string, string>;
110
+ /**
111
+ * `confirmed` when every installed bundle was read and its rows subtracted;
112
+ * `unconfirmed` when that read failed and every entry is listed instead.
113
+ */
114
+ readonly bundles: 'confirmed' | 'unconfirmed';
115
+ }
116
+ /**
117
+ * Select the built-in group's two scopes in one pass: every Loader entry, the
118
+ * ones no installed bundle contributes, and which bundle contributes the rest.
119
+ *
120
+ * The default scope is the subtraction the group shipped with; the wider scope is
121
+ * the same rows plus the ones a bundle's patch inserts, each named after that
122
+ * bundle — the reason a reader meets them again on the bundle's own page.
123
+ * @param inventory - the Loader snapshot.
124
+ * @param bundles - every installed bundle, or undefined when `listBundles()`
125
+ * failed; both scopes then list every entry and the group says so.
126
+ * @param plugins - the manager's plugin rows, or undefined when that read
127
+ * failed; an unread row is reported as `unknown` rather than guessed writable.
128
+ * @returns both scopes, the ownership map behind them, and the roster state.
129
+ */
130
+ export declare function selectBuiltinEntries(inventory: PluginInventory, bundles: readonly BundleFacts[] | undefined, plugins: readonly PluginFacts[] | undefined): BuiltinSelection;
131
+ /** One official remote answer: the gateway's envelope, or a bare value. */
132
+ export type RemoteAnswer<T> = {
133
+ readonly ok: true;
134
+ readonly value: T;
135
+ } | {
136
+ readonly ok: false;
137
+ readonly code?: string;
138
+ };
139
+ /**
140
+ * Read one `remote.<namespace>` answer.
141
+ *
142
+ * The API gateway wraps every namespace result as `{ ok, value | error }`, and a
143
+ * carrier that hands the bare value back must not be mistaken for a failure —
144
+ * so an object is treated as an envelope only when its `ok` really is a boolean,
145
+ * and anything else passes through as the value itself.
146
+ * @param raw - the resolved answer, exactly as the namespace returned it.
147
+ * @returns the unwrapped value, or the envelope's error code.
148
+ */
149
+ export declare function readRemoteAnswer<T>(raw: unknown): RemoteAnswer<T>;
150
+ /** The applications one write can end in. */
151
+ export type ChangeApplication = 'applied' | 'restart-required' | 'overridden' | 'failed' | 'cancelled';
152
+ /**
153
+ * What a write achieved: the application the host settled on, or the code it
154
+ * failed with. `overridden` is a resolved write a higher profile layer wins
155
+ * over — the official page reports it as its own notice rather than a failure,
156
+ * because the manager did accept the call.
157
+ */
158
+ export type ChangeOutcome = {
159
+ readonly ok: true;
160
+ readonly application: 'applied' | 'overridden' | 'restart-required';
161
+ /** Why `restart-required`, as the host named it. */
162
+ readonly restartReason?: string;
163
+ } | {
164
+ readonly ok: false;
165
+ readonly code: string;
166
+ };
167
+ /**
168
+ * Read one `setPluginEnabled` answer.
169
+ *
170
+ * The official manager folds a refusal into the resolved result
171
+ * (`application: 'failed'` with an `error.code`) instead of rejecting, so a
172
+ * resolved promise is not a success. Both answer shapes are accepted because
173
+ * the gateway's envelope and the bare `ChangeResult` are the same call seen
174
+ * through two carriers.
175
+ * @param raw - the resolved answer.
176
+ * @returns the outcome the switch should show.
177
+ */
178
+ export declare function readChangeResult(raw: unknown): ChangeOutcome;
@@ -46,10 +46,27 @@ export interface InstalledPluginItem {
46
46
  /**
47
47
  * How the host carried out (or refused) a restart request:
48
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.
49
+ * Desktop shell owns the process tree and runs its own restart; `systemd` —
50
+ * this host runs as a systemd service and asks its own unit to restart it;
51
+ * `manual` — none of these is possible here, the user restarts DSH themselves.
51
52
  */
52
- export type RestartMode = 'relaunch' | 'shell' | 'manual';
53
+ export type RestartMode = 'relaunch' | 'shell' | 'systemd' | 'manual';
54
+ /** Whether a value is a systemd unit name this package asks systemd to restart. */
55
+ export declare function isSystemdUnitName(value: string): boolean;
56
+ /**
57
+ * What the host would do with a restart request, as the plan read answers it.
58
+ *
59
+ * A discriminated union rather than a mode beside an optional unit: a systemd
60
+ * plan always names the unit it restarts (the parser refuses one that does
61
+ * not) and no other mode carries a unit at all, so the confirmation reads the
62
+ * unit off the plan instead of guarding a field that cannot be missing.
63
+ */
64
+ export type RestartPlanWire = {
65
+ mode: 'systemd';
66
+ unit: string;
67
+ } | {
68
+ mode: 'relaunch' | 'shell' | 'manual';
69
+ };
53
70
  /**
54
71
  * The result of one applied update: the installed row, plus the host's verdict
55
72
  * on whether this process can serve it without a restart.
@@ -159,11 +176,23 @@ export declare function parseInstallStatus(value: unknown): InstallProgressItem;
159
176
  */
160
177
  export declare function parseUpdateList(value: unknown): PluginUpdateItem[];
161
178
  /**
162
- * Validate and normalize a `restart` response value.
179
+ * Validate and normalize a `restart` response value, reading the mode a POST
180
+ * answer carries.
163
181
  * @param value - decoded but untrusted response value.
164
182
  * @returns the mode the host actually used.
165
183
  */
166
184
  export declare function parseRestartMode(value: unknown): RestartMode;
185
+ /**
186
+ * Validate and normalize a restart PLAN response value (the GET answer).
187
+ *
188
+ * The plan is read before the confirmation is shown, so this parser fails
189
+ * closed: an unknown mode, or a systemd plan that does not name a unit of the
190
+ * accepted shape, throws instead of letting the panel promise a restart the
191
+ * host cannot actually perform.
192
+ * @param value - decoded but untrusted response value.
193
+ * @returns the plan the host would carry out.
194
+ */
195
+ export declare function parseRestartPlan(value: unknown): RestartPlanWire;
167
196
  /**
168
197
  * Validate and normalize a `failures` response value.
169
198
  * @param value - decoded but untrusted response value.
@@ -12,7 +12,7 @@
12
12
  * such duplicate mounts; the gateway strips exactly those entries back out.
13
13
  * @module @linxin666/dsh-client-ui-plugin-manager/host
14
14
  */
15
- import type { ProfileFacts } from './profile.ts';
15
+ import { type ProfileFacts } from './profile.ts';
16
16
  /** The before-state composition facts the guard reads. */
17
17
  export interface GuardSnapshot {
18
18
  /** The profile patch text captured before the mutation. */
@@ -51,3 +51,14 @@ export declare function rowMountedPackageNames(facts: ProfileFacts, before: Guar
51
51
  * @returns the entries to remove from `dsh.profile.bundles`.
52
52
  */
53
53
  export declare function duplicateMountBundles(facts: ProfileFacts, before: GuardSnapshot, beforeBundles: readonly string[], afterBundles: readonly string[]): Promise<string[]>;
54
+ /**
55
+ * Whether an installed dependency declares its own bundle patch (`dsh.bundle`
56
+ * in its package.json) — the fact the official CLI's reconciliation selects a
57
+ * dependency on. A package that declares none is a plain dependency of some
58
+ * mounted bundle and never enters the selection.
59
+ * @param facts - resolved profile locations.
60
+ * @param name - dependency name (possibly scoped).
61
+ * @returns whether the installed package declares `dsh.bundle`; a package that
62
+ * cannot be read proves nothing and answers false.
63
+ */
64
+ export declare function declaresBundle(facts: ProfileFacts, name: string): Promise<boolean>;