@linxin666/dsh-client-ui-plugin-manager 0.2.2
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.
- package/LICENSE +29 -0
- package/README.i18n.yaml +6 -0
- package/README.md +81 -0
- package/README.zh.md +81 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.js +1464 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +1425 -0
- package/lib/types/client/PluginManagerTab.d.ts +38 -0
- package/lib/types/client/index.d.ts +42 -0
- package/lib/types/client/locales.d.ts +245 -0
- package/lib/types/core/conflict.d.ts +43 -0
- package/lib/types/core/patch-diff.d.ts +46 -0
- package/lib/types/core/protocol.d.ts +99 -0
- package/lib/types/core/repair.d.ts +71 -0
- package/lib/types/core/service.d.ts +45 -0
- package/lib/types/host/bundle-guard.d.ts +53 -0
- package/lib/types/host/dsh-home.d.ts +16 -0
- package/lib/types/host/gateway.d.ts +156 -0
- package/lib/types/host/loopback.d.ts +24 -0
- package/lib/types/host/profile.d.ts +60 -0
- package/lib/types/host/routes.d.ts +34 -0
- package/lib/types/host/rows.d.ts +101 -0
- package/lib/types/host/state.d.ts +58 -0
- package/lib/types/index.d.ts +22 -0
- package/lib/types/mount-once.d.ts +24 -0
- package/package.json +73 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import { type ControlChange } from '../core/conflict.ts';
|
|
3
|
+
import type { InstallProgressItem, InstalledPluginItem, PluginControlItem, PluginFailuresSnapshot, PluginUpdateItem } from '../core/protocol.ts';
|
|
4
|
+
/** Registration-side wire face used by the tab. */
|
|
5
|
+
export interface PluginManagerTabInjected {
|
|
6
|
+
/** Whether this browser has loopback authority to use the host routes. */
|
|
7
|
+
isLoopback: boolean;
|
|
8
|
+
/** Read the installed snapshot. */
|
|
9
|
+
list: () => Promise<InstalledPluginItem[]>;
|
|
10
|
+
/** Install one plugin from an npm spec or git URL. */
|
|
11
|
+
install: (spec: string) => Promise<InstalledPluginItem>;
|
|
12
|
+
/** Re-install one plugin from its recorded source. */
|
|
13
|
+
update: (id: string) => Promise<InstalledPluginItem>;
|
|
14
|
+
/** Remove one plugin. */
|
|
15
|
+
uninstall: (id: string) => Promise<InstalledPluginItem[]>;
|
|
16
|
+
/** Persist one user plugin's next-start enablement. */
|
|
17
|
+
setEnabled: (id: string, enabled: boolean) => Promise<InstalledPluginItem>;
|
|
18
|
+
/** Compare installed versions against their sources. */
|
|
19
|
+
checkUpdates: () => Promise<PluginUpdateItem[]>;
|
|
20
|
+
/** Read the current install/update progress. */
|
|
21
|
+
status: () => Promise<InstallProgressItem>;
|
|
22
|
+
/** Read the recorded boot failures, plugin root, and safe-mode state. */
|
|
23
|
+
failures: () => Promise<PluginFailuresSnapshot>;
|
|
24
|
+
/** Persist the safe-mode marker (web: applied at the next manual restart). */
|
|
25
|
+
setSafeMode: (enabled: boolean) => Promise<void>;
|
|
26
|
+
/** Start a repair conversation over the plugin install root. */
|
|
27
|
+
repairPlugin: (pluginRoot: string, message: string) => Promise<void>;
|
|
28
|
+
/** Read the deployment-configured built-in product switches. */
|
|
29
|
+
controlsList: () => Promise<PluginControlItem[]>;
|
|
30
|
+
/** Persist one product's next-start enablement. */
|
|
31
|
+
controlsSetEnabled: (pluginId: string, enabled: boolean) => Promise<PluginControlItem[]>;
|
|
32
|
+
/** Conflicts the gateway host computed around the last install (gateway mode only). */
|
|
33
|
+
lastInstallConflicts?: () => readonly ControlChange[];
|
|
34
|
+
}
|
|
35
|
+
/** Full component props assembled by the Settings slot renderer. */
|
|
36
|
+
export type PluginManagerTabProps = PropsRuntime<'settings.plugins.tab'> & PropsLocale<'settings.pluginManager'> & InjectFace<PluginManagerTabInjected>;
|
|
37
|
+
/** The plugin-manager settings tab. */
|
|
38
|
+
export declare function PluginManagerTab(props: PluginManagerTabProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin-manager browser half: contributes the family plugin-manager tab to
|
|
3
|
+
* the official Plugins settings section (`settings.plugins.tab` slot) and
|
|
4
|
+
* provides the same dual-channel face as the `'pluginManager'` cordis
|
|
5
|
+
* service for sibling client plugins. It is dual-channel: on runtimes with
|
|
6
|
+
* the official installer services (DSHCode, the 1.0.4 checkout web) every
|
|
7
|
+
* operation rides the official `/plugin-installer` and `/plugin-control`
|
|
8
|
+
* loopback RPC channels (the single writer); on the npm-published web runtime
|
|
9
|
+
* those channels do not exist, so the same face falls back to this package's
|
|
10
|
+
* own loopback HTTP gateway, which spawns the official CLI for writes.
|
|
11
|
+
* Neither the tab nor service consumers know which mode the face runs in.
|
|
12
|
+
* @module @linxin666/dsh-client-ui-plugin-manager/client
|
|
13
|
+
*/
|
|
14
|
+
import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
|
|
15
|
+
import { type PluginManagerTabInjected } from './PluginManagerTab.tsx';
|
|
16
|
+
import { type PluginManagerKey } from './locales.ts';
|
|
17
|
+
import { type PluginManagerService } from '../core/service.ts';
|
|
18
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
19
|
+
interface LocaleNamespaceMap {
|
|
20
|
+
/** Copy for the family plugin-manager tab. */
|
|
21
|
+
'settings.pluginManager': PluginManagerKey;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Services required by the slot registration and both channels. */
|
|
25
|
+
export declare const inject: string[];
|
|
26
|
+
/**
|
|
27
|
+
* The face the Plugin manager tab and the `'pluginManager'` cordis service
|
|
28
|
+
* share: the full tab surface plus the cross-plugin service contract.
|
|
29
|
+
*/
|
|
30
|
+
export type PluginManagerFace = PluginManagerTabInjected & PluginManagerService;
|
|
31
|
+
/**
|
|
32
|
+
* Build the dual-channel face once: official-channel and gateway-channel
|
|
33
|
+
* implementations, the mode detection that picks between them, the repair
|
|
34
|
+
* handoff, and the change-notification listener set. The returned face is
|
|
35
|
+
* both the tab's injected props and the value provided as the
|
|
36
|
+
* `'pluginManager'` cordis service.
|
|
37
|
+
* @param ctx - the client context (connection, workspaces, sessions).
|
|
38
|
+
* @returns the shared face.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createPluginManagerFace(ctx: ClientContext): PluginManagerFace;
|
|
41
|
+
/** Contribute the family plugin-manager tab and provide the shared face. */
|
|
42
|
+
export declare function apply(ctx: ClientContext): void;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale dictionaries for the plugin-manager tab. The zh dictionary is the
|
|
3
|
+
* key source; the en dictionary mirrors the exact key set.
|
|
4
|
+
* @module @linxin666/dsh-client-ui-plugin-manager/client
|
|
5
|
+
*/
|
|
6
|
+
/** Simplified Chinese copy (the key-set source of truth). */
|
|
7
|
+
declare const STATIC_ZH: {
|
|
8
|
+
tab: string;
|
|
9
|
+
loading: string;
|
|
10
|
+
empty: string;
|
|
11
|
+
userPlugins: string;
|
|
12
|
+
products: string;
|
|
13
|
+
conflictTitle: string;
|
|
14
|
+
conflictDisabled: string;
|
|
15
|
+
conflictEnabled: string;
|
|
16
|
+
conflictChanged: string;
|
|
17
|
+
undoConflict: string;
|
|
18
|
+
conflictHint: string;
|
|
19
|
+
installPlaceholder: string;
|
|
20
|
+
install: string;
|
|
21
|
+
installing: string;
|
|
22
|
+
installHint: string;
|
|
23
|
+
version: string;
|
|
24
|
+
latest: string;
|
|
25
|
+
update: string;
|
|
26
|
+
updating: string;
|
|
27
|
+
checkUpdates: string;
|
|
28
|
+
checking: string;
|
|
29
|
+
noUpdates: string;
|
|
30
|
+
uninstall: string;
|
|
31
|
+
uninstallConfirmTitle: string;
|
|
32
|
+
uninstallConfirmBody: string;
|
|
33
|
+
confirm: string;
|
|
34
|
+
cancel: string;
|
|
35
|
+
restartHint: string;
|
|
36
|
+
failed: string;
|
|
37
|
+
enabled: string;
|
|
38
|
+
disabled: string;
|
|
39
|
+
mixed: string;
|
|
40
|
+
unavailable: string;
|
|
41
|
+
uninstalled: string;
|
|
42
|
+
source: string;
|
|
43
|
+
applying: string;
|
|
44
|
+
fetching: string;
|
|
45
|
+
downloading: string;
|
|
46
|
+
downloadingPercent: string;
|
|
47
|
+
extracting: string;
|
|
48
|
+
writing: string;
|
|
49
|
+
localOnlyTitle: string;
|
|
50
|
+
localOnlyBody: string;
|
|
51
|
+
failureBadge: string;
|
|
52
|
+
failureGroupTitle: string;
|
|
53
|
+
repair: string;
|
|
54
|
+
repairing: string;
|
|
55
|
+
copyError: string;
|
|
56
|
+
copied: string;
|
|
57
|
+
safeModeBanner: string;
|
|
58
|
+
exitSafeMode: string;
|
|
59
|
+
npmSource: string;
|
|
60
|
+
gitSource: string;
|
|
61
|
+
enableSwitch: string;
|
|
62
|
+
disableSwitch: string;
|
|
63
|
+
repairInstallTitle: string;
|
|
64
|
+
repairInstallSpecLabel: string;
|
|
65
|
+
repairInstallErrorLabel: string;
|
|
66
|
+
repairInstallAsk: string;
|
|
67
|
+
repairFailureTitle: string;
|
|
68
|
+
repairFailurePluginLabel: string;
|
|
69
|
+
repairFailureKindLabel: string;
|
|
70
|
+
repairFailureAtLabel: string;
|
|
71
|
+
repairFailureMessageLabel: string;
|
|
72
|
+
repairFailureStackLabel: string;
|
|
73
|
+
repairFailurePathLabel: string;
|
|
74
|
+
repairFailureAsk: string;
|
|
75
|
+
repairKindLoad: string;
|
|
76
|
+
repairKindHang: string;
|
|
77
|
+
repairKindLate: string;
|
|
78
|
+
repairConflictTitle: string;
|
|
79
|
+
repairConflictPluginLabel: string;
|
|
80
|
+
repairConflictChangeLabel: string;
|
|
81
|
+
repairConflictAsk: string;
|
|
82
|
+
repairStateEnabled: string;
|
|
83
|
+
repairStateDisabled: string;
|
|
84
|
+
repairStateUninstalled: string;
|
|
85
|
+
};
|
|
86
|
+
export declare const zh: {
|
|
87
|
+
tab: string;
|
|
88
|
+
loading: string;
|
|
89
|
+
empty: string;
|
|
90
|
+
userPlugins: string;
|
|
91
|
+
products: string;
|
|
92
|
+
conflictTitle: string;
|
|
93
|
+
conflictDisabled: string;
|
|
94
|
+
conflictEnabled: string;
|
|
95
|
+
conflictChanged: string;
|
|
96
|
+
undoConflict: string;
|
|
97
|
+
conflictHint: string;
|
|
98
|
+
installPlaceholder: string;
|
|
99
|
+
install: string;
|
|
100
|
+
installing: string;
|
|
101
|
+
installHint: string;
|
|
102
|
+
version: string;
|
|
103
|
+
latest: string;
|
|
104
|
+
update: string;
|
|
105
|
+
updating: string;
|
|
106
|
+
checkUpdates: string;
|
|
107
|
+
checking: string;
|
|
108
|
+
noUpdates: string;
|
|
109
|
+
uninstall: string;
|
|
110
|
+
uninstallConfirmTitle: string;
|
|
111
|
+
uninstallConfirmBody: string;
|
|
112
|
+
confirm: string;
|
|
113
|
+
cancel: string;
|
|
114
|
+
restartHint: string;
|
|
115
|
+
failed: string;
|
|
116
|
+
enabled: string;
|
|
117
|
+
disabled: string;
|
|
118
|
+
mixed: string;
|
|
119
|
+
unavailable: string;
|
|
120
|
+
uninstalled: string;
|
|
121
|
+
source: string;
|
|
122
|
+
applying: string;
|
|
123
|
+
fetching: string;
|
|
124
|
+
downloading: string;
|
|
125
|
+
downloadingPercent: string;
|
|
126
|
+
extracting: string;
|
|
127
|
+
writing: string;
|
|
128
|
+
localOnlyTitle: string;
|
|
129
|
+
localOnlyBody: string;
|
|
130
|
+
failureBadge: string;
|
|
131
|
+
failureGroupTitle: string;
|
|
132
|
+
repair: string;
|
|
133
|
+
repairing: string;
|
|
134
|
+
copyError: string;
|
|
135
|
+
copied: string;
|
|
136
|
+
safeModeBanner: string;
|
|
137
|
+
exitSafeMode: string;
|
|
138
|
+
npmSource: string;
|
|
139
|
+
gitSource: string;
|
|
140
|
+
enableSwitch: string;
|
|
141
|
+
disableSwitch: string;
|
|
142
|
+
repairInstallTitle: string;
|
|
143
|
+
repairInstallSpecLabel: string;
|
|
144
|
+
repairInstallErrorLabel: string;
|
|
145
|
+
repairInstallAsk: string;
|
|
146
|
+
repairFailureTitle: string;
|
|
147
|
+
repairFailurePluginLabel: string;
|
|
148
|
+
repairFailureKindLabel: string;
|
|
149
|
+
repairFailureAtLabel: string;
|
|
150
|
+
repairFailureMessageLabel: string;
|
|
151
|
+
repairFailureStackLabel: string;
|
|
152
|
+
repairFailurePathLabel: string;
|
|
153
|
+
repairFailureAsk: string;
|
|
154
|
+
repairKindLoad: string;
|
|
155
|
+
repairKindHang: string;
|
|
156
|
+
repairKindLate: string;
|
|
157
|
+
repairConflictTitle: string;
|
|
158
|
+
repairConflictPluginLabel: string;
|
|
159
|
+
repairConflictChangeLabel: string;
|
|
160
|
+
repairConflictAsk: string;
|
|
161
|
+
repairStateEnabled: string;
|
|
162
|
+
repairStateDisabled: string;
|
|
163
|
+
repairStateUninstalled: string;
|
|
164
|
+
};
|
|
165
|
+
export declare const en: {
|
|
166
|
+
tab: string;
|
|
167
|
+
loading: string;
|
|
168
|
+
empty: string;
|
|
169
|
+
userPlugins: string;
|
|
170
|
+
products: string;
|
|
171
|
+
conflictTitle: string;
|
|
172
|
+
conflictDisabled: string;
|
|
173
|
+
conflictEnabled: string;
|
|
174
|
+
conflictChanged: string;
|
|
175
|
+
undoConflict: string;
|
|
176
|
+
conflictHint: string;
|
|
177
|
+
installPlaceholder: string;
|
|
178
|
+
install: string;
|
|
179
|
+
installing: string;
|
|
180
|
+
installHint: string;
|
|
181
|
+
version: string;
|
|
182
|
+
latest: string;
|
|
183
|
+
update: string;
|
|
184
|
+
updating: string;
|
|
185
|
+
checkUpdates: string;
|
|
186
|
+
checking: string;
|
|
187
|
+
noUpdates: string;
|
|
188
|
+
uninstall: string;
|
|
189
|
+
uninstallConfirmTitle: string;
|
|
190
|
+
uninstallConfirmBody: string;
|
|
191
|
+
confirm: string;
|
|
192
|
+
cancel: string;
|
|
193
|
+
restartHint: string;
|
|
194
|
+
failed: string;
|
|
195
|
+
enabled: string;
|
|
196
|
+
disabled: string;
|
|
197
|
+
mixed: string;
|
|
198
|
+
unavailable: string;
|
|
199
|
+
uninstalled: string;
|
|
200
|
+
source: string;
|
|
201
|
+
applying: string;
|
|
202
|
+
fetching: string;
|
|
203
|
+
downloading: string;
|
|
204
|
+
downloadingPercent: string;
|
|
205
|
+
extracting: string;
|
|
206
|
+
writing: string;
|
|
207
|
+
localOnlyTitle: string;
|
|
208
|
+
localOnlyBody: string;
|
|
209
|
+
failureBadge: string;
|
|
210
|
+
failureGroupTitle: string;
|
|
211
|
+
repair: string;
|
|
212
|
+
repairing: string;
|
|
213
|
+
copyError: string;
|
|
214
|
+
copied: string;
|
|
215
|
+
safeModeBanner: string;
|
|
216
|
+
exitSafeMode: string;
|
|
217
|
+
npmSource: string;
|
|
218
|
+
gitSource: string;
|
|
219
|
+
enableSwitch: string;
|
|
220
|
+
disableSwitch: string;
|
|
221
|
+
repairInstallTitle: string;
|
|
222
|
+
repairInstallSpecLabel: string;
|
|
223
|
+
repairInstallErrorLabel: string;
|
|
224
|
+
repairInstallAsk: string;
|
|
225
|
+
repairFailureTitle: string;
|
|
226
|
+
repairFailurePluginLabel: string;
|
|
227
|
+
repairFailureKindLabel: string;
|
|
228
|
+
repairFailureAtLabel: string;
|
|
229
|
+
repairFailureMessageLabel: string;
|
|
230
|
+
repairFailureStackLabel: string;
|
|
231
|
+
repairFailurePathLabel: string;
|
|
232
|
+
repairFailureAsk: string;
|
|
233
|
+
repairKindLoad: string;
|
|
234
|
+
repairKindHang: string;
|
|
235
|
+
repairKindLate: string;
|
|
236
|
+
repairConflictTitle: string;
|
|
237
|
+
repairConflictPluginLabel: string;
|
|
238
|
+
repairConflictChangeLabel: string;
|
|
239
|
+
repairConflictAsk: string;
|
|
240
|
+
repairStateEnabled: string;
|
|
241
|
+
repairStateDisabled: string;
|
|
242
|
+
repairStateUninstalled: string;
|
|
243
|
+
};
|
|
244
|
+
export type PluginManagerKey = keyof typeof STATIC_ZH;
|
|
245
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conflict-ledger diffing. The official host applies structural conflict
|
|
3
|
+
* rules at install time (disableControlsOnInstall: installing the dsh-web-ui
|
|
4
|
+
* family disables the built-in web-ui product rows so the two never
|
|
5
|
+
* double-mount), but no UI surfaces what the rules just did. This module
|
|
6
|
+
* diffs the plugin-control snapshots taken before and after an install and
|
|
7
|
+
* classifies every state change so the tab can render it as a reversible,
|
|
8
|
+
* attributable conflict notice.
|
|
9
|
+
*
|
|
10
|
+
* The install-time authority ends here: duplicate insert-id claims between
|
|
11
|
+
* two user plugins carry no at-install signal through the RPC channels (the
|
|
12
|
+
* Loader only re-reads the composition at the next start), so that failure
|
|
13
|
+
* shape is left to the boot-failure ring — the real start is the authoritative
|
|
14
|
+
* conflict detector.
|
|
15
|
+
* @module @linxin666/dsh-client-ui-plugin-manager/core
|
|
16
|
+
*/
|
|
17
|
+
import type { PluginControlItem } from './protocol.ts';
|
|
18
|
+
/** One observed product-control state change between two snapshots. */
|
|
19
|
+
export interface ControlChange {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
from: PluginControlItem['state'];
|
|
23
|
+
to: PluginControlItem['state'];
|
|
24
|
+
}
|
|
25
|
+
/** Meaningful change kinds a conflict notice distinguishes. */
|
|
26
|
+
export type ControlChangeKind = 'rule-disabled' | 'rule-enabled' | 'state-change';
|
|
27
|
+
/**
|
|
28
|
+
* Diff two plugin-control snapshots by id. Only entries present in both
|
|
29
|
+
* snapshots with a changed state are reported; entries appearing or
|
|
30
|
+
* disappearing are ordinary install/uninstall outcomes, not conflicts.
|
|
31
|
+
* @param before - snapshot taken before the install.
|
|
32
|
+
* @param after - snapshot taken after the install.
|
|
33
|
+
* @returns one change per id whose state moved, in id order.
|
|
34
|
+
*/
|
|
35
|
+
export declare function diffControls(before: readonly PluginControlItem[], after: readonly PluginControlItem[]): ControlChange[];
|
|
36
|
+
/**
|
|
37
|
+
* Classify one control-state change for messaging. A change into `disabled`
|
|
38
|
+
* is the conflict rule's action (reversible by re-enabling); a change out of
|
|
39
|
+
* `disabled` is a manual undo; anything else is reported neutrally.
|
|
40
|
+
* @param change - one diff entry.
|
|
41
|
+
* @returns the message kind.
|
|
42
|
+
*/
|
|
43
|
+
export declare function classifyChange(change: ControlChange): ControlChangeKind;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer diffing for the gateway host half: the profile patch rows and the
|
|
3
|
+
* bundle list before an install are compared with the state after the
|
|
4
|
+
* official CLI finishes, so the tab can render exactly what the install
|
|
5
|
+
* changed — rows disabled or claimed, bundles added or removed — as a
|
|
6
|
+
* reversible, attributable notice. Pure logic shared by both halves.
|
|
7
|
+
* @module @linxin666/dsh-client-ui-plugin-manager/core
|
|
8
|
+
*/
|
|
9
|
+
/** Row/bundle membership state used by the diff. */
|
|
10
|
+
export type LayerState = 'enabled' | 'disabled' | 'uninstalled';
|
|
11
|
+
/** One layer snapshot: row enablement by id plus the bundle list. */
|
|
12
|
+
export interface LayerSnapshot {
|
|
13
|
+
rows: ReadonlyMap<string, boolean>;
|
|
14
|
+
bundles: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
/** One observed membership change between two snapshots. */
|
|
17
|
+
export interface LayerChange {
|
|
18
|
+
id: string;
|
|
19
|
+
from: LayerState;
|
|
20
|
+
to: LayerState;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Diff two layer snapshots by id. Only entries whose membership state moved
|
|
24
|
+
* are reported; unchanged entries are skipped.
|
|
25
|
+
* @param before - snapshot taken before the operation.
|
|
26
|
+
* @param after - snapshot taken after the operation.
|
|
27
|
+
* @returns one change per moved id, sorted by id.
|
|
28
|
+
*/
|
|
29
|
+
export declare function diffLayer(before: LayerSnapshot, after: LayerSnapshot): LayerChange[];
|
|
30
|
+
/**
|
|
31
|
+
* Drop the normal install outcome — entries that merely appear (a new plugin
|
|
32
|
+
* mounting is the point of an install, not a conflict) — and keep every
|
|
33
|
+
* change to an entry that existed before.
|
|
34
|
+
* @param changes - the raw layer diff.
|
|
35
|
+
* @returns the conflict-worthy changes.
|
|
36
|
+
*/
|
|
37
|
+
export declare function significantChanges(changes: LayerChange[]): LayerChange[];
|
|
38
|
+
/**
|
|
39
|
+
* The ids of `claimed` already held by another entry. Bundle rows with the
|
|
40
|
+
* same insert id double-mount at the next boot (duplicate entry id), so an
|
|
41
|
+
* install claiming a taken id is a boot-blocking conflict.
|
|
42
|
+
* @param claimed - the new plugin's claimed entry ids.
|
|
43
|
+
* @param taken - every id already claimed by other plugins and patch rows.
|
|
44
|
+
* @returns the overlapping ids, in claim order.
|
|
45
|
+
*/
|
|
46
|
+
export declare function overlappingIds(claimed: readonly string[], taken: ReadonlySet<string>): string[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire parsing for the official plugin-installer / plugin-control RPC
|
|
3
|
+
* channels. This package is a browser-side consumer of those channels: every
|
|
4
|
+
* response is decoded but untrusted, so each parser validates the shape it
|
|
5
|
+
* needs and throws a typed error on mismatch. Callers treat a parse failure
|
|
6
|
+
* as "channel unavailable or drifted" and degrade to command hints.
|
|
7
|
+
*
|
|
8
|
+
* The shapes mirror the official web installer tab's wire protocol (see the
|
|
9
|
+
* DSH checkout's packages/client/ui-settings-plugin-installer/src/client/
|
|
10
|
+
* protocol.ts); they are a contract observation, not an import.
|
|
11
|
+
* @module @linxin666/dsh-client-ui-plugin-manager/core
|
|
12
|
+
*/
|
|
13
|
+
/** One installed user-plugin row served by `/plugin-installer list`. */
|
|
14
|
+
export interface InstalledPluginItem {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
source: {
|
|
19
|
+
kind: 'npm' | 'git';
|
|
20
|
+
spec: string;
|
|
21
|
+
};
|
|
22
|
+
installedAt: string;
|
|
23
|
+
/** Saved next-start enablement from the managed profile patch row. */
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
commit?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Point-in-time install/update progress reported by the host. */
|
|
28
|
+
export interface InstallProgressItem {
|
|
29
|
+
kind: 'idle' | 'install' | 'update';
|
|
30
|
+
stage: 'fetch' | 'download' | 'extract' | 'write';
|
|
31
|
+
percent?: number;
|
|
32
|
+
}
|
|
33
|
+
/** One plugin with a newer version available. */
|
|
34
|
+
export interface PluginUpdateItem {
|
|
35
|
+
id: string;
|
|
36
|
+
current: string;
|
|
37
|
+
latest: string;
|
|
38
|
+
}
|
|
39
|
+
/** One recorded plugin boot failure served by the host. */
|
|
40
|
+
export interface PluginFailureItem {
|
|
41
|
+
/** Installed plugin id (package name); empty for unattributable failures. */
|
|
42
|
+
pluginId: string;
|
|
43
|
+
kind: 'load-failure' | 'hang' | 'late-rejection';
|
|
44
|
+
message: string;
|
|
45
|
+
stack: string;
|
|
46
|
+
installPath: string;
|
|
47
|
+
at: string;
|
|
48
|
+
}
|
|
49
|
+
/** Recovery facts served by the host: the failure ring, the plugin root, and safe mode. */
|
|
50
|
+
export interface PluginFailuresSnapshot {
|
|
51
|
+
items: PluginFailureItem[];
|
|
52
|
+
/** Absolute plugin install root — the repair conversation's workspace. */
|
|
53
|
+
pluginRoot: string;
|
|
54
|
+
/** Whether the host is running in safe mode (user plugins skipped). */
|
|
55
|
+
safeMode: boolean;
|
|
56
|
+
}
|
|
57
|
+
/** One deployment-configured logical product switch. */
|
|
58
|
+
export interface PluginControlItem {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
repository: string;
|
|
62
|
+
state: 'enabled' | 'disabled' | 'mixed' | 'unavailable' | 'uninstalled';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Validate and normalize a `list` / `uninstall` response value.
|
|
66
|
+
* @param value - decoded but untrusted response value.
|
|
67
|
+
* @returns typed installed-plugin rows.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parsePluginList(value: unknown): InstalledPluginItem[];
|
|
70
|
+
/**
|
|
71
|
+
* Validate and normalize an `install` / `update` / `set-enabled` response value.
|
|
72
|
+
* @param value - decoded but untrusted response value.
|
|
73
|
+
* @returns the typed installed-plugin row.
|
|
74
|
+
*/
|
|
75
|
+
export declare function parseInstalledPlugin(value: unknown): InstalledPluginItem;
|
|
76
|
+
/**
|
|
77
|
+
* Validate and normalize a plugin-control `list` / `set-enabled` response value.
|
|
78
|
+
* @param value - decoded but untrusted response value.
|
|
79
|
+
* @returns the typed control items.
|
|
80
|
+
*/
|
|
81
|
+
export declare function parsePluginControlSnapshot(value: unknown): PluginControlItem[];
|
|
82
|
+
/**
|
|
83
|
+
* Validate and normalize a `status` response value.
|
|
84
|
+
* @param value - decoded but untrusted response value.
|
|
85
|
+
* @returns the typed progress state.
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseInstallStatus(value: unknown): InstallProgressItem;
|
|
88
|
+
/**
|
|
89
|
+
* Validate and normalize a `check-updates` response value.
|
|
90
|
+
* @param value - decoded but untrusted response value.
|
|
91
|
+
* @returns typed update rows.
|
|
92
|
+
*/
|
|
93
|
+
export declare function parseUpdateList(value: unknown): PluginUpdateItem[];
|
|
94
|
+
/**
|
|
95
|
+
* Validate and normalize a `failures` response value.
|
|
96
|
+
* @param value - decoded but untrusted response value.
|
|
97
|
+
* @returns the typed failures snapshot.
|
|
98
|
+
*/
|
|
99
|
+
export declare function parseFailuresSnapshot(value: unknown): PluginFailuresSnapshot;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repair-conversation seed text. Two failure surfaces hand off to the agent
|
|
3
|
+
* through the same shape: a failed install (target spec + install error) and
|
|
4
|
+
* a recorded boot failure (the failure-ring row). The seeded message must be
|
|
5
|
+
* self-contained — the repair session's workspace is the plugin install root,
|
|
6
|
+
* so the agent's file tools reach the plugin code without leaving the
|
|
7
|
+
* workspace boundary.
|
|
8
|
+
*
|
|
9
|
+
* Secret discipline: the seed carries only the spec, the host's truncated
|
|
10
|
+
* failure message/stack, and paths. Callers must never append credentials,
|
|
11
|
+
* tokens, or environment contents; the failure ring is the host's bounded,
|
|
12
|
+
* pruned record and nothing else is added.
|
|
13
|
+
* @module @linxin666/dsh-client-ui-plugin-manager/core
|
|
14
|
+
*/
|
|
15
|
+
import type { PluginFailureItem } from './protocol.ts';
|
|
16
|
+
import type { LayerState } from './patch-diff.ts';
|
|
17
|
+
/** Localized fragments the builders assemble. */
|
|
18
|
+
export interface RepairCopy {
|
|
19
|
+
installTitle: string;
|
|
20
|
+
installSpecLabel: string;
|
|
21
|
+
installErrorLabel: string;
|
|
22
|
+
installAsk: string;
|
|
23
|
+
failureTitle: string;
|
|
24
|
+
failurePluginLabel: string;
|
|
25
|
+
failureKindLabel: string;
|
|
26
|
+
failureAtLabel: string;
|
|
27
|
+
failureMessageLabel: string;
|
|
28
|
+
failureStackLabel: string;
|
|
29
|
+
failurePathLabel: string;
|
|
30
|
+
failureAsk: string;
|
|
31
|
+
conflictTitle: string;
|
|
32
|
+
conflictPluginLabel: string;
|
|
33
|
+
conflictChangeLabel: string;
|
|
34
|
+
conflictAsk: string;
|
|
35
|
+
/** Localized names of the failure kinds. */
|
|
36
|
+
kindNames: Record<PluginFailureItem['kind'], string>;
|
|
37
|
+
/** Localized names of the layer states a conflict change traverses. */
|
|
38
|
+
stateNames: Record<LayerState, string>;
|
|
39
|
+
}
|
|
40
|
+
/** Default copy (zh): the package's zh dictionary keys map onto these strings. */
|
|
41
|
+
export declare const DEFAULT_REPAIR_COPY: RepairCopy;
|
|
42
|
+
/**
|
|
43
|
+
* Seed text for a failed install: the target and the rendered error,
|
|
44
|
+
* self-contained for the agent.
|
|
45
|
+
* @param spec - the install target (npm spec or git URL) that failed.
|
|
46
|
+
* @param error - the rendered install error text.
|
|
47
|
+
* @param copy - localized fragments.
|
|
48
|
+
* @returns the repair prompt text.
|
|
49
|
+
*/
|
|
50
|
+
export declare function installRepairMessage(spec: string, error: string, copy?: RepairCopy): string;
|
|
51
|
+
/**
|
|
52
|
+
* Seed text for one boot-failure ring row: the failure record, so the agent
|
|
53
|
+
* can attribute and fix it in place.
|
|
54
|
+
* @param failure - the recorded failure row.
|
|
55
|
+
* @param copy - localized fragments.
|
|
56
|
+
* @returns the repair prompt text.
|
|
57
|
+
*/
|
|
58
|
+
export declare function failureRepairMessage(failure: PluginFailureItem, copy?: RepairCopy): string;
|
|
59
|
+
/**
|
|
60
|
+
* Seed text for one install-conflict notice: the entry and its state change,
|
|
61
|
+
* so the agent can attribute the conflict and resolve the double mount.
|
|
62
|
+
* @param change - the conflict change (id, display name, from/to states).
|
|
63
|
+
* @param copy - localized fragments.
|
|
64
|
+
* @returns the repair prompt text.
|
|
65
|
+
*/
|
|
66
|
+
export declare function conflictRepairMessage(change: {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
from: LayerState;
|
|
70
|
+
to: LayerState;
|
|
71
|
+
}, copy?: RepairCopy): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cordis service contract this package exposes to sibling client plugins
|
|
3
|
+
* under the name `'pluginManager'`. The browser half builds one dual-channel
|
|
4
|
+
* face (official /plugin-installer + /plugin-control RPC channels when
|
|
5
|
+
* available, else this package's loopback HTTP gateway) and provides it via
|
|
6
|
+
* `ctx.provide('pluginManager', face)`; consumers resolve it with
|
|
7
|
+
* `ctx.inject(['pluginManager'], cb)` and read `ctx.pluginManager`.
|
|
8
|
+
*
|
|
9
|
+
* The interface is intentionally narrower than the face the Plugin manager
|
|
10
|
+
* tab receives (`PluginManagerFace` in the client half): it is the stable
|
|
11
|
+
* cross-plugin surface, so it only carries the operations a sibling plugin
|
|
12
|
+
* needs to observe and drive the installed-plugin set.
|
|
13
|
+
* @module @linxin666/dsh-client-ui-plugin-manager/core
|
|
14
|
+
*/
|
|
15
|
+
import type { InstallProgressItem, InstalledPluginItem } from './protocol.ts';
|
|
16
|
+
/** The cordis service name the browser half provides the face under. */
|
|
17
|
+
export declare const PLUGIN_MANAGER_SERVICE = "pluginManager";
|
|
18
|
+
/**
|
|
19
|
+
* The dual-channel plugin-management face, shared between the Plugin manager
|
|
20
|
+
* tab and sibling client plugins.
|
|
21
|
+
*/
|
|
22
|
+
export interface PluginManagerService {
|
|
23
|
+
/** Whether this browser has loopback authority to use the host routes. */
|
|
24
|
+
readonly isLoopback: boolean;
|
|
25
|
+
/** Read the installed snapshot. */
|
|
26
|
+
list(): Promise<InstalledPluginItem[]>;
|
|
27
|
+
/** Install one plugin from an npm spec or git URL. */
|
|
28
|
+
install(spec: string): Promise<InstalledPluginItem>;
|
|
29
|
+
/** Remove one plugin. */
|
|
30
|
+
uninstall(id: string): Promise<InstalledPluginItem[]>;
|
|
31
|
+
/** Read the current install/update progress. */
|
|
32
|
+
status(): Promise<InstallProgressItem>;
|
|
33
|
+
/**
|
|
34
|
+
* Subscribe to successful mutations: the callback runs after install(),
|
|
35
|
+
* update(), uninstall(), or setEnabled() resolves. One listener throwing
|
|
36
|
+
* never breaks the others. Returns the unsubscribe function.
|
|
37
|
+
*/
|
|
38
|
+
onChange(cb: () => void): () => void;
|
|
39
|
+
}
|
|
40
|
+
declare module '@deepseek-ai/cordis' {
|
|
41
|
+
interface Context {
|
|
42
|
+
/** The plugin-manager face (provided by the dsh-plugin-manager client half). */
|
|
43
|
+
pluginManager: PluginManagerService;
|
|
44
|
+
}
|
|
45
|
+
}
|