@linxin666/dsh-client-ui-plugin-manager 0.4.5 → 0.4.7
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/README.i18n.yaml +2 -2
- package/README.md +5 -5
- package/README.zh.md +5 -5
- package/lib/client.js +12 -3
- package/lib/client.js.map +1 -1
- package/lib/index.js +613 -67
- package/lib/types/client/locales.d.ts +3 -0
- package/lib/types/core/protocol.d.ts +6 -0
- package/lib/types/host/detached-work.d.ts +44 -0
- package/lib/types/host/gateway.d.ts +162 -7
- package/lib/types/host/profile.d.ts +28 -0
- package/lib/types/host/routes.d.ts +11 -1
- package/lib/types/host/rows.d.ts +32 -0
- package/package.json +20 -17
|
@@ -20,6 +20,7 @@ declare const STATIC_ZH: {
|
|
|
20
20
|
latest: string;
|
|
21
21
|
updateRequiresDsh: string;
|
|
22
22
|
updateBlockedDsh: string;
|
|
23
|
+
updateUnverifiedDsh: string;
|
|
23
24
|
restartHint: string;
|
|
24
25
|
updatesAvailable: string;
|
|
25
26
|
updateAll: string;
|
|
@@ -57,6 +58,7 @@ export declare const zh: {
|
|
|
57
58
|
latest: string;
|
|
58
59
|
updateRequiresDsh: string;
|
|
59
60
|
updateBlockedDsh: string;
|
|
61
|
+
updateUnverifiedDsh: string;
|
|
60
62
|
restartHint: string;
|
|
61
63
|
updatesAvailable: string;
|
|
62
64
|
updateAll: string;
|
|
@@ -94,6 +96,7 @@ export declare const en: {
|
|
|
94
96
|
latest: string;
|
|
95
97
|
updateRequiresDsh: string;
|
|
96
98
|
updateBlockedDsh: string;
|
|
99
|
+
updateUnverifiedDsh: string;
|
|
97
100
|
restartHint: string;
|
|
98
101
|
updatesAvailable: string;
|
|
99
102
|
updateAll: string;
|
|
@@ -73,6 +73,12 @@ export interface PluginUpdateItem {
|
|
|
73
73
|
requiresDsh?: string;
|
|
74
74
|
/** Whether the running DSH host satisfies requiresDsh; absent when unknown. */
|
|
75
75
|
compatible?: boolean;
|
|
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).
|
|
80
|
+
*/
|
|
81
|
+
hostVersion?: string;
|
|
76
82
|
}
|
|
77
83
|
/** One recorded plugin boot failure served by the host. */
|
|
78
84
|
export interface PluginFailureItem {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run one piece of work outside the caller's async context.
|
|
3
|
+
*
|
|
4
|
+
* A Host mutation that runs inside `hmr.runExclusive` marks the running async
|
|
5
|
+
* context with an AsyncLocalStorage store. Side effects on that path that write
|
|
6
|
+
* a file the HMR config watcher refreshes from - `cordis.patch.yml` above all -
|
|
7
|
+
* must not run under that mark, or the watcher's refresh re-enters the
|
|
8
|
+
* exclusive transaction and is refused with "HMR transactions cannot be nested"
|
|
9
|
+
* (#1751, #1754, #1816).
|
|
10
|
+
*
|
|
11
|
+
* Deferring is NOT enough, and the earlier belt that this one replaces was
|
|
12
|
+
* built on a disproven premise: Node propagates an AsyncLocalStorage store into
|
|
13
|
+
* `setImmediate`, into `node:timers`, into promise continuations, and into any
|
|
14
|
+
* AsyncResource scoped to the current async id. Measured on Node 24:
|
|
15
|
+
*
|
|
16
|
+
* ```
|
|
17
|
+
* als.run(true, () => setImmediate(() => als.getStore())) // -> true
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* What DOES start clean is an AsyncResource whose `triggerAsyncId` is not the
|
|
21
|
+
* transaction. A resource created once at module scope - that is, before any
|
|
22
|
+
* transaction existed - carries no store, and everything it schedules inherits
|
|
23
|
+
* that emptiness rather than the caller's mark:
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* const detached = new AsyncResource('...') // module scope
|
|
27
|
+
* als.run(true, () => detached.runInAsyncScope(() => setImmediate(() => als.getStore())))
|
|
28
|
+
* // -> undefined
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @module dsh-web-shared/host/detached-work
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Run `work` outside the caller's AsyncLocalStorage context.
|
|
35
|
+
*
|
|
36
|
+
* The call itself is synchronous - this schedules, it does not defer. Work that
|
|
37
|
+
* must not block the caller should schedule its own `setImmediate` inside
|
|
38
|
+
* `work`, which then also starts clean because it inherits this resource's
|
|
39
|
+
* empty context rather than the caller's.
|
|
40
|
+
*
|
|
41
|
+
* @param work - the side effect to detach from the caller's async context.
|
|
42
|
+
* @returns whatever `work` returns.
|
|
43
|
+
*/
|
|
44
|
+
export declare function runDetached<T>(work: () => T): T;
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
* plugin manager instead (see {@link NativePluginManager}).
|
|
14
14
|
* @module @linxin666/dsh-client-ui-plugin-manager/host
|
|
15
15
|
*/
|
|
16
|
+
import { type ChildProcess } from 'node:child_process';
|
|
16
17
|
import type { InstalledPluginItem } from '../core/protocol.ts';
|
|
17
18
|
import type { ControlChange } from '../core/conflict.ts';
|
|
18
19
|
import { type ProfileFacts } from './profile.ts';
|
|
20
|
+
import { type OutputCapture } from './console-output.ts';
|
|
19
21
|
/**
|
|
20
22
|
* Validate an install spec or package id against shell metacharacters.
|
|
21
23
|
* @param spec - the user-supplied spec or id.
|
|
@@ -52,7 +54,7 @@ export interface GatewayJob {
|
|
|
52
54
|
error?: string;
|
|
53
55
|
}
|
|
54
56
|
/** The binary search roots for the dsh CLI. */
|
|
55
|
-
export declare function findDshBinary(env?: NodeJS.ProcessEnv, platform?: string, exists?: (path: string) => boolean, hostEntryPath?: string | undefined): string | null;
|
|
57
|
+
export declare function findDshBinary(env?: NodeJS.ProcessEnv, platform?: string, exists?: (path: string) => boolean, hostEntryPath?: string | undefined, resourcesPath?: string | undefined): string | null;
|
|
56
58
|
/**
|
|
57
59
|
* Read a file's leading bytes for the shebang probe. Every failure — a missing
|
|
58
60
|
* file, a directory, a permission error, an unreadable asar entry — reads as
|
|
@@ -94,6 +96,24 @@ export declare function dshSpawnCommand(binary: string, platform?: string, local
|
|
|
94
96
|
command: string;
|
|
95
97
|
argsPrefix: string[];
|
|
96
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Absolute path of the Windows command processor, resolved from an environment
|
|
101
|
+
* rather than from PATH.
|
|
102
|
+
*
|
|
103
|
+
* Every `.cmd` shim still has to be executed through cmd.exe, and a bare
|
|
104
|
+
* `cmd.exe` spawn resolves through the host PATH: a GUI-launched host whose PATH
|
|
105
|
+
* carries no `%SystemRoot%\system32` (a packaged Desktop launch, a service, a
|
|
106
|
+
* stripped environment) gets ENOENT for a name that is present on disk, and the
|
|
107
|
+
* whole feature fails with it (issue #1857). ComSpec is the variable Windows
|
|
108
|
+
* itself uses for this and names the real binary, so it is preferred; otherwise
|
|
109
|
+
* the system root is read from `SystemRoot` or `windir`, with the conventional
|
|
110
|
+
* `C:\Windows` as the last resort.
|
|
111
|
+
*
|
|
112
|
+
* Only the Windows branch needs it — a POSIX host spawns the CLI directly.
|
|
113
|
+
* @param env - the environment to resolve from.
|
|
114
|
+
* @returns the absolute cmd.exe path.
|
|
115
|
+
*/
|
|
116
|
+
export declare function windowsCmdPath(env?: NodeJS.ProcessEnv): string;
|
|
97
117
|
/** Build the exact cmd.exe command line required to execute a trusted .cmd shim. */
|
|
98
118
|
export declare function windowsCmdShimArgs(binary: string, args: readonly string[]): string[];
|
|
99
119
|
/**
|
|
@@ -108,6 +128,53 @@ export declare function windowsCmdShimArgs(binary: string, args: readonly string
|
|
|
108
128
|
* @returns a new environment with one normalized, prepended PATH.
|
|
109
129
|
*/
|
|
110
130
|
export declare function withPrependedPath(env: NodeJS.ProcessEnv, dir: string, platform?: string): NodeJS.ProcessEnv;
|
|
131
|
+
/**
|
|
132
|
+
* Exit code reported for a child that never became a process. Node delivers a
|
|
133
|
+
* failed spawn as an `error` event whose `close` may never follow, and every
|
|
134
|
+
* consumer of a spawned child waits for `close` alone.
|
|
135
|
+
*/
|
|
136
|
+
export declare const SPAWN_FAILURE_EXIT_CODE = -1;
|
|
137
|
+
/**
|
|
138
|
+
* Attach the error fallback every spawn outlet needs.
|
|
139
|
+
*
|
|
140
|
+
* A ChildProcess without an `error` listener turns a spawn failure into an
|
|
141
|
+
* unhandled `error` event, which is an uncaught exception: the failure of one
|
|
142
|
+
* CLI call took the whole dsh host process down with it. This records the
|
|
143
|
+
* reason and, when the child never closed, settles it as a failed exit so a
|
|
144
|
+
* caller that only waits for `close` neither hangs nor crashes (issue #1857).
|
|
145
|
+
* @param child - the spawned child.
|
|
146
|
+
* @returns the same child, guarded.
|
|
147
|
+
*/
|
|
148
|
+
export declare function guardSpawnFailure(child: ChildProcess): ChildProcess;
|
|
149
|
+
/** One spawned child's exit verdict. */
|
|
150
|
+
export interface ChildExit {
|
|
151
|
+
/** The process exit code, or {@link SPAWN_FAILURE_EXIT_CODE} when it never started. */
|
|
152
|
+
code: number | null;
|
|
153
|
+
/** The spawn failure reason, present only when no process was created. */
|
|
154
|
+
spawnError?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Wait for a spawned child to close, settling on a spawn failure as well.
|
|
158
|
+
*
|
|
159
|
+
* The listener pair is attached to every child this package waits on, so the
|
|
160
|
+
* wait is safe for a child that arrived through a seam ({@link guardSpawnFailure}
|
|
161
|
+
* guards the real spawn outlets, an injected one may skip it).
|
|
162
|
+
* @param child - the spawned child.
|
|
163
|
+
* @returns the exit verdict.
|
|
164
|
+
*/
|
|
165
|
+
export declare function awaitChildExit(child: ChildProcess): Promise<ChildExit>;
|
|
166
|
+
/**
|
|
167
|
+
* Wait for one spawned CLI child, folding a spawn failure into its output.
|
|
168
|
+
*
|
|
169
|
+
* Every caller already reports a non-zero exit through the captured output, so
|
|
170
|
+
* a process that never started is reported the same readable way instead of as
|
|
171
|
+
* a silent failure or a hang.
|
|
172
|
+
* @param child - the spawned child.
|
|
173
|
+
* @param output - the bounded capture the failure text is appended to.
|
|
174
|
+
* @param timeoutMs - kill the child after this long; omitted for no deadline.
|
|
175
|
+
* @returns the exit code, or null when a signal ended the child.
|
|
176
|
+
*/
|
|
177
|
+
export declare function awaitCliExit(child: ChildProcess, output: OutputCapture, timeoutMs?: number): Promise<number | null>;
|
|
111
178
|
/**
|
|
112
179
|
* Spawn the dsh CLI with piped stdio and no shell parsing (see
|
|
113
180
|
* {@link dshSpawnCommand}).
|
|
@@ -118,12 +185,26 @@ export declare function withPrependedPath(env: NodeJS.ProcessEnv, dir: string, p
|
|
|
118
185
|
* `dsh plugin` to pnpm, so without this the update would start and then fail on
|
|
119
186
|
* a missing pnpm instead. This mirrors the packaged Desktop launcher, which
|
|
120
187
|
* prepends its bundled runtime bin to the host it spawns.
|
|
188
|
+
*
|
|
189
|
+
* Every child leaves here guarded ({@link guardSpawnFailure}), so a spawn that
|
|
190
|
+
* fails settles as a non-zero exit instead of raising an unhandled error.
|
|
121
191
|
* @param binary - the resolved dsh CLI path.
|
|
122
192
|
* @param args - arguments after the interpreter/script prefix.
|
|
123
193
|
* @param env - the host environment.
|
|
124
194
|
* @returns the spawned child process.
|
|
125
195
|
*/
|
|
126
|
-
export declare function spawnDsh(binary: string, args: string[], env: NodeJS.ProcessEnv):
|
|
196
|
+
export declare function spawnDsh(binary: string, args: string[], env: NodeJS.ProcessEnv): ChildProcess;
|
|
197
|
+
/**
|
|
198
|
+
* The entry ids of a composed profile dump (`dsh --profile <name>
|
|
199
|
+
* --dump-config`). The dump prints one YAML block per patch layer under a
|
|
200
|
+
* `# ==` header, with the composed entries as column-0 `- id:` items — an
|
|
201
|
+
* entry a profile patch overrides appears once, carrying the override's keys,
|
|
202
|
+
* so those lines are exactly the loader's own entry set. Nested config keeps
|
|
203
|
+
* its own `id` keys indented and is never mistaken for an entry.
|
|
204
|
+
* @param dump - the dump's captured text.
|
|
205
|
+
* @returns the composed entry ids, or undefined when the dump carried none.
|
|
206
|
+
*/
|
|
207
|
+
export declare function composedEntryIdsOf(dump: string): Set<string> | undefined;
|
|
127
208
|
/**
|
|
128
209
|
* Detect whether the official installer channels exist on this runtime by
|
|
129
210
|
* dumping the boot composition once: the npm-published web never contains
|
|
@@ -149,7 +230,10 @@ export declare function detectOfficialChannels(binary: string, profileName: stri
|
|
|
149
230
|
*/
|
|
150
231
|
export interface NativePluginManager {
|
|
151
232
|
/**
|
|
152
|
-
* Install
|
|
233
|
+
* Install one package spec through the official manager. Since 0.2.1-rc.2 it
|
|
234
|
+
* refuses a package the profile already carries while the host mounts the `hmr`
|
|
235
|
+
* service (`already-installed`), which is every profile host, so an in-place
|
|
236
|
+
* update cannot be one call there.
|
|
153
237
|
* @param spec - package spec (e.g. `@scope/pkg@1.2.3`).
|
|
154
238
|
* @param options - activation choice and the request id the run is tracked under.
|
|
155
239
|
* @returns the manager's own verdict ({@link NativeManagerOutcome}); the caller
|
|
@@ -205,6 +289,16 @@ export interface NativeManagerOutcome {
|
|
|
205
289
|
* @returns the failure text to report, or undefined for a run that did not fail.
|
|
206
290
|
*/
|
|
207
291
|
export declare function nativeManagerFailure(outcome: unknown): string | undefined;
|
|
292
|
+
/**
|
|
293
|
+
* The official manager's own refusal code for one run, or undefined when its
|
|
294
|
+
* verdict is not a failure. {@link nativeManagerFailure} renders the code for the
|
|
295
|
+
* person; this is the same verdict read for a decision, which is how the update
|
|
296
|
+
* path recognises the `already-installed` refusal it has to answer with a
|
|
297
|
+
* two-phase replacement.
|
|
298
|
+
* @param outcome - the resolved value of `installBundle` / `removeBundle`.
|
|
299
|
+
* @returns the manager's failure code, or undefined for a run that did not fail.
|
|
300
|
+
*/
|
|
301
|
+
export declare function nativeManagerRefusalCode(outcome: unknown): string | undefined;
|
|
208
302
|
/** The gateway: serializes CLI operations through one job table and one mutation queue. */
|
|
209
303
|
export declare class CliGateway {
|
|
210
304
|
private readonly facts;
|
|
@@ -319,10 +413,34 @@ export declare class CliGateway {
|
|
|
319
413
|
* run (pnpm exited non-zero, an incompatible version, a cancellation) resolves
|
|
320
414
|
* with `application: 'failed'`, and only that verdict carries the reason — the
|
|
321
415
|
* profile re-read can only show that the version did not move.
|
|
416
|
+
*
|
|
417
|
+
* An `already-installed` refusal is answered by {@link replaceInstalled}: the
|
|
418
|
+
* manager refuses to install a dependency the profile already carries while the
|
|
419
|
+
* host mounts `hmr` (0.2.1-rc.2, and dsh-base mounts that service on every
|
|
420
|
+
* profile host), so an in-place update there is only expressible as its two
|
|
421
|
+
* phases. The single call stays first so the day the manager accepts an
|
|
422
|
+
* in-place update this path needs no change.
|
|
322
423
|
* @param job - the update job being settled.
|
|
323
424
|
* @param native - the official manager.
|
|
324
425
|
*/
|
|
325
426
|
private runNativeUpdate;
|
|
427
|
+
/**
|
|
428
|
+
* Replace an installed bundle with the update job's target spec through the
|
|
429
|
+
* official manager, the only writer an application-owned profile accepts.
|
|
430
|
+
* Removing first is what makes the install possible: the manager's
|
|
431
|
+
* `already-installed` guard reads the profile, so the same name is a fresh
|
|
432
|
+
* dependency once the old one is gone.
|
|
433
|
+
*
|
|
434
|
+
* A failed second phase reinstalls the spec the profile carried before the run,
|
|
435
|
+
* so an update that cannot land leaves a working plugin behind instead of an
|
|
436
|
+
* empty slot; the report says which of the two happened.
|
|
437
|
+
* @param job - the update job whose spec is installed.
|
|
438
|
+
* @param native - the official manager.
|
|
439
|
+
* @param targetId - the installed bundle being replaced.
|
|
440
|
+
* @param previousSpec - the dependency spec the profile carried before the run.
|
|
441
|
+
* @returns the failure to report, or undefined once the target spec landed.
|
|
442
|
+
*/
|
|
443
|
+
private replaceInstalled;
|
|
326
444
|
/** Start a deterministic legacy aggregate migration. */
|
|
327
445
|
migrate(sourceId: string, targetId: string, targetVersion: string, targetSpec: string): {
|
|
328
446
|
jobId: string;
|
|
@@ -376,6 +494,38 @@ export declare class CliGateway {
|
|
|
376
494
|
* @returns the stripped entries, or undefined when the job failed.
|
|
377
495
|
*/
|
|
378
496
|
private stripDuplicateMounts;
|
|
497
|
+
/**
|
|
498
|
+
* Compose the profile with the CLI's read-only `--dump-config` probe and
|
|
499
|
+
* return the dump text. Composition writes nothing and binds no port, so it
|
|
500
|
+
* is safe on every runtime — including an application-owned profile whose
|
|
501
|
+
* *writes* the CLI refuses. A run that cannot compose (no CLI on this
|
|
502
|
+
* runtime, a non-zero exit, a spawn failure) reports undefined, and the
|
|
503
|
+
* caller must then leave the profile alone instead of guessing at the entry
|
|
504
|
+
* set.
|
|
505
|
+
* @returns the composed dump text, or undefined when it is unavailable.
|
|
506
|
+
*/
|
|
507
|
+
private compositionOf;
|
|
508
|
+
/**
|
|
509
|
+
* 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`.
|
|
517
|
+
*
|
|
518
|
+
* Nothing is written when nothing is orphaned — a second run over a pruned
|
|
519
|
+
* profile returns the input text untouched, so no write and no second backup
|
|
520
|
+
* happen — and an unobtainable composition leaves the file as it is instead
|
|
521
|
+
* of emptying it. A write that does fail settles the job as an error the way
|
|
522
|
+
* every other post-mutation patch write in this transaction does, with the
|
|
523
|
+
* backup the write helper takes first left in place.
|
|
524
|
+
* @param job - the settling job (error target on write failure).
|
|
525
|
+
* @param dumpText - an already captured composition, when the caller has one.
|
|
526
|
+
* @returns the pruned entry ids, or undefined when the job failed.
|
|
527
|
+
*/
|
|
528
|
+
private pruneOrphanOverrides;
|
|
379
529
|
/**
|
|
380
530
|
* Roll back a freshly installed dependency through the official remove
|
|
381
531
|
* path (which also drops its bundle), then settle the job as an error.
|
|
@@ -398,10 +548,15 @@ export declare class CliGateway {
|
|
|
398
548
|
/** Whether the new install claims an entry id another plugin already holds. */
|
|
399
549
|
private detectDuplicateClaims;
|
|
400
550
|
/**
|
|
401
|
-
* Boot preflight after an install: compose the profile with the
|
|
402
|
-
* `--dump-config` (resolves every entry without binding the port). A
|
|
403
|
-
* that implicates the new plugin disables it so the next start
|
|
404
|
-
* an unrelated failure is reported without touching anything.
|
|
551
|
+
* Boot preflight after an install or update: compose the profile with the
|
|
552
|
+
* CLI's `--dump-config` (resolves every entry without binding the port). A
|
|
553
|
+
* failure that implicates the new plugin disables it so the next start
|
|
554
|
+
* cannot fail; an unrelated failure is reported without touching anything.
|
|
555
|
+
* The captured dump is returned on success so the update path can read the
|
|
556
|
+
* composed entry set from the same probe (see {@link pruneOrphanOverrides}).
|
|
557
|
+
* @returns the composed dump text, or undefined when the preflight did not
|
|
558
|
+
* produce one (no CLI on this runtime, or a failure the caller must read
|
|
559
|
+
* from `job`).
|
|
405
560
|
*/
|
|
406
561
|
private verifyBoot;
|
|
407
562
|
}
|
|
@@ -22,6 +22,14 @@ export interface LaunchedProfile {
|
|
|
22
22
|
name?: unknown;
|
|
23
23
|
dir?: unknown;
|
|
24
24
|
patchPath?: unknown;
|
|
25
|
+
/**
|
|
26
|
+
* Absolute path of the running installation's own `@deepseek-ai/dsh`
|
|
27
|
+
* package.json — the launcher's install anchor. Its `version` IS the version
|
|
28
|
+
* of the DSH this process booted, so it answers the compatibility question
|
|
29
|
+
* without spawning anything; on a packaged Desktop install it is the only
|
|
30
|
+
* source that does, because no `dsh` reaches that host's PATH (issue #1819).
|
|
31
|
+
*/
|
|
32
|
+
installAnchor?: unknown;
|
|
25
33
|
}
|
|
26
34
|
/** Resolved locations of one profile's writable surface. */
|
|
27
35
|
export interface ProfileFacts {
|
|
@@ -43,6 +51,26 @@ export interface ProfileFacts {
|
|
|
43
51
|
export declare function stripBom(text: string): string;
|
|
44
52
|
/** Read the packaged desktop app's persisted active profile, when present. */
|
|
45
53
|
export declare function desktopSelectedProfile(env?: NodeJS.ProcessEnv): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The running installation's own `@deepseek-ai/dsh` package.json, as the
|
|
56
|
+
* launcher published it on `profileContext`, or undefined when the host
|
|
57
|
+
* publishes none (or publishes something unusable). This is a READ-ONLY
|
|
58
|
+
* fact — unlike the profile directory and the patch path it is never a write
|
|
59
|
+
* target — but it still arrives from outside this package, so it must be an
|
|
60
|
+
* absolute, traversal-free path before anything reads a version out of it.
|
|
61
|
+
* @param launched - the profile facts the Host published, when available.
|
|
62
|
+
* @returns the validated anchor path, or undefined.
|
|
63
|
+
*/
|
|
64
|
+
export declare function launchedInstallAnchor(launched: LaunchedProfile | undefined): string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Read the `version` field of one package manifest, tolerating every failure:
|
|
67
|
+
* a missing file, an unreadable one (a stripped asar entry), malformed JSON, or
|
|
68
|
+
* a non-string version all read as "no version". Callers fall back to their next
|
|
69
|
+
* source rather than reporting a version nobody declared.
|
|
70
|
+
* @param manifestPath - absolute path of a package.json.
|
|
71
|
+
* @returns the declared version, or undefined.
|
|
72
|
+
*/
|
|
73
|
+
export declare function readManifestVersion(manifestPath: string): string | undefined;
|
|
46
74
|
/**
|
|
47
75
|
* Whether the host argv names the packaged Desktop launcher, whose entry
|
|
48
76
|
* script is `@deepseek-ai/dsh-desktop-host`. The Desktop client boots the
|
|
@@ -27,8 +27,18 @@ export interface GatewayRouteDeps {
|
|
|
27
27
|
/** Registry fetch seam for update checks (test seam); the default reads the
|
|
28
28
|
* `/<name>/latest` manifest including the `dsh` / `engines` metadata. */
|
|
29
29
|
fetchManifest?: (name: string) => Promise<RegistryVersionManifest | undefined>;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Running DSH host version seam (test seam). The default reads the version of
|
|
32
|
+
* the running installation in process, then falls back to `dsh --version`.
|
|
33
|
+
*/
|
|
31
34
|
dshVersion?: () => Promise<string | undefined>;
|
|
35
|
+
/**
|
|
36
|
+
* The running installation's own `@deepseek-ai/dsh` package.json, when the
|
|
37
|
+
* launcher published one. It is the primary version source: the file belongs
|
|
38
|
+
* to the runtime this process booted, so reading it needs no subprocess and no
|
|
39
|
+
* PATH — which a packaged Desktop host does not have (issue #1819).
|
|
40
|
+
*/
|
|
41
|
+
installAnchor?: string;
|
|
32
42
|
/** Official-channel detection seam (test seam); defaults to the boot dump probe. */
|
|
33
43
|
officialChannels?: () => Promise<boolean>;
|
|
34
44
|
/** Launch-fact seam for the restart route (test seam); defaults to this process. */
|
package/lib/types/host/rows.d.ts
CHANGED
|
@@ -120,3 +120,35 @@ export declare function findInsertRow(root: YAMLSeq, id: string): YAMLMap | unde
|
|
|
120
120
|
* @returns the new file text.
|
|
121
121
|
*/
|
|
122
122
|
export declare function setRowEnabled(text: string, filename: string, id: string, name: string, enabled: boolean, baseEnabled?: boolean): string;
|
|
123
|
+
/**
|
|
124
|
+
* The entry id of an enablement override row this package owns, when the item
|
|
125
|
+
* is one: a bare row carrying a string `id`, a boolean `disabled`, and no
|
|
126
|
+
* other key. Anything else is somebody else's row — a config row carrying
|
|
127
|
+
* options, a row with an unknown shape, an insert wrapper — and the manager
|
|
128
|
+
* never edits or removes it.
|
|
129
|
+
* @param item - one top-level patch item.
|
|
130
|
+
* @returns the override's entry id, or undefined when the item is not ours.
|
|
131
|
+
*/
|
|
132
|
+
export declare function overrideRowId(item: unknown): string | undefined;
|
|
133
|
+
/** The rewritten patch text and the entry ids that were dropped. */
|
|
134
|
+
export interface PrunedOverrides {
|
|
135
|
+
/** The new file text; the original text when nothing was pruned. */
|
|
136
|
+
readonly text: string;
|
|
137
|
+
/** The pruned entry ids, in file order. */
|
|
138
|
+
readonly pruned: string[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Drop this package's own enablement overrides whose entry id the composed
|
|
142
|
+
* profile no longer carries — a retired row leaves a stale override behind,
|
|
143
|
+
* which the loader reports on every boot as `patch: entry "<id>" not found`.
|
|
144
|
+
* The prunable set is decided by the caller from the composed entry ids: an
|
|
145
|
+
* id the composition does not carry has no row left to override. Only rows
|
|
146
|
+
* {@link overrideRowId} recognizes are removed, comments and every other row
|
|
147
|
+
* are kept, and an already-pruned file returns its input text unchanged so the
|
|
148
|
+
* caller can skip the write entirely.
|
|
149
|
+
* @param text - current patch file text.
|
|
150
|
+
* @param filename - absolute path (diagnostics only).
|
|
151
|
+
* @param composedIds - the entry ids the composed profile carries.
|
|
152
|
+
* @returns the rewritten text and the pruned ids.
|
|
153
|
+
*/
|
|
154
|
+
export declare function pruneOrphanRowOverrides(text: string, filename: string, composedIds: ReadonlySet<string>): PrunedOverrides;
|
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.
|
|
4
|
+
"version": "0.4.7",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dsh": {
|
|
22
22
|
"engines": {
|
|
23
|
-
"dsh": ">=0.2.
|
|
23
|
+
"dsh": ">=0.2.1-rc.2"
|
|
24
24
|
},
|
|
25
25
|
"bundle": {
|
|
26
26
|
"patch": "./cordis.patch.yml"
|
|
@@ -34,21 +34,21 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@deepseek-ai/dsh": ">=0.2.
|
|
37
|
+
"@deepseek-ai/dsh": ">=0.2.1-rc.2",
|
|
38
38
|
"react": "^18.2.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
42
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.2.
|
|
43
|
-
"@deepseek-ai/dsh-api-workspace-controller": "^0.2.
|
|
44
|
-
"@deepseek-ai/dsh-client-connection": "^0.2.
|
|
45
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.
|
|
46
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.
|
|
47
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.
|
|
48
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.
|
|
49
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.
|
|
50
|
-
"@deepseek-ai/dsh-client-ui-workspace": "^0.2.
|
|
51
|
-
"@deepseek-ai/dsh-host-webserver": "^0.2.
|
|
41
|
+
"@deepseek-ai/cordis": "^4.0.5",
|
|
42
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.2.1-rc.2",
|
|
43
|
+
"@deepseek-ai/dsh-api-workspace-controller": "^0.2.1-rc.2",
|
|
44
|
+
"@deepseek-ai/dsh-client-connection": "^0.2.1-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.2",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.2.1-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.2",
|
|
50
|
+
"@deepseek-ai/dsh-client-ui-workspace": "^0.2.1-rc.2",
|
|
51
|
+
"@deepseek-ai/dsh-host-webserver": "^0.2.1-rc.2",
|
|
52
52
|
"@testing-library/react": "^16.1.0",
|
|
53
53
|
"@types/node": "^22.20.0",
|
|
54
54
|
"@types/react": "~18.3.1",
|
|
@@ -61,7 +61,10 @@
|
|
|
61
61
|
"vitest": "^4.1.1"
|
|
62
62
|
},
|
|
63
63
|
"files": [
|
|
64
|
-
"lib",
|
|
64
|
+
"lib/**/*.js",
|
|
65
|
+
"lib/**/*.js.map",
|
|
66
|
+
"lib/**/*.d.ts",
|
|
67
|
+
"lib/**/*.d.ts.map",
|
|
65
68
|
"cordis.patch.yml",
|
|
66
69
|
"README.md",
|
|
67
70
|
"README.zh.md",
|
|
@@ -73,9 +76,9 @@
|
|
|
73
76
|
"yaml": "^2.8.2"
|
|
74
77
|
},
|
|
75
78
|
"scripts": {
|
|
76
|
-
"build": "tsc -
|
|
79
|
+
"build": "tsc -b tsconfig.build.json && tsdown",
|
|
77
80
|
"watch": "tsdown --watch",
|
|
78
81
|
"test": "vitest run",
|
|
79
|
-
"typecheck": "
|
|
82
|
+
"typecheck": "tsgo --noEmit"
|
|
80
83
|
}
|
|
81
84
|
}
|