dsh-plugin-upgrader 1.0.2 → 1.1.1
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/CHANGELOG.md +134 -0
- package/README.en.md +29 -3
- package/README.md +24 -3
- package/lib/client.js +178 -26
- package/lib/host/install.d.ts +11 -1
- package/lib/host/install.d.ts.map +1 -1
- package/lib/host/install.js +189 -6
- package/lib/host/install.js.map +1 -1
- package/lib/host/manager.d.ts +35 -0
- package/lib/host/manager.d.ts.map +1 -1
- package/lib/host/manager.js.map +1 -1
- package/lib/host/overview.d.ts.map +1 -1
- package/lib/host/overview.js +68 -5
- package/lib/host/overview.js.map +1 -1
- package/lib/host/progress.d.ts +28 -0
- package/lib/host/progress.d.ts.map +1 -0
- package/lib/host/progress.js +21 -0
- package/lib/host/progress.js.map +1 -0
- package/lib/host/registry.d.ts +48 -1
- package/lib/host/registry.d.ts.map +1 -1
- package/lib/host/registry.js +124 -22
- package/lib/host/registry.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +174 -30
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
package/lib/host/install.js
CHANGED
|
@@ -1,5 +1,168 @@
|
|
|
1
1
|
/** Allowed per-step actions. */
|
|
2
2
|
export const ACTIONS = new Set(['upgrade', 'switch']);
|
|
3
|
+
/** The manager's code for "a live loader fiber still owns this bundle". */
|
|
4
|
+
const IN_USE = 'bundle-in-use';
|
|
5
|
+
/**
|
|
6
|
+
* Read the manager's failure code off a result or a throw.
|
|
7
|
+
*
|
|
8
|
+
* `change()` folds operation failures into `result.error`; only a lock or
|
|
9
|
+
* disposal fault rejects, so both spellings have to be checked.
|
|
10
|
+
*
|
|
11
|
+
* @param failure - a result or an error.
|
|
12
|
+
* @returns the code, when one is present.
|
|
13
|
+
*/
|
|
14
|
+
function codeOf(failure) {
|
|
15
|
+
if (failure === null || typeof failure !== 'object')
|
|
16
|
+
return undefined;
|
|
17
|
+
const record = failure;
|
|
18
|
+
if (typeof record.code === 'string')
|
|
19
|
+
return record.code;
|
|
20
|
+
return typeof record.error?.code === 'string' ? record.error.code : undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What the operator can do about a bundle the loader will not release.
|
|
24
|
+
*
|
|
25
|
+
* Attached as the failure's `diagnostic` so the panel can say something better
|
|
26
|
+
* than the bare code: the removal was refused on the host, and no amount of
|
|
27
|
+
* retrying inside one process changes it. Both languages travel together
|
|
28
|
+
* because the job log is a single stream shared by every display language —
|
|
29
|
+
* the existing `statusMessage` copy is split the same way.
|
|
30
|
+
*
|
|
31
|
+
* @param enabled - what the manager reads the bundle as, when known.
|
|
32
|
+
* @returns one bilingual sentence.
|
|
33
|
+
*/
|
|
34
|
+
function restartHint(enabled) {
|
|
35
|
+
const disabled = enabled === false;
|
|
36
|
+
const zh = disabled
|
|
37
|
+
? '它读起来是禁用状态,但加载器仍持有它的插件行;重启 DSH 后再升级'
|
|
38
|
+
: '加载器仍持有它的插件行;重启 DSH 后再升级';
|
|
39
|
+
const en = disabled
|
|
40
|
+
? 'the loader still holds its plugin row even though the bundle reads as disabled; restart DSH and upgrade again'
|
|
41
|
+
: 'the loader still holds its plugin row; restart DSH and upgrade again';
|
|
42
|
+
return `${zh} / ${en}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Read whether the manager currently reads a bundle as enabled.
|
|
46
|
+
*
|
|
47
|
+
* The distinction matters: a bundle the manager already reads as disabled
|
|
48
|
+
* cannot be unloaded by asking for disabled again, because that request changes
|
|
49
|
+
* nothing and therefore disposes nothing.
|
|
50
|
+
*
|
|
51
|
+
* @param manager - the plugin manager.
|
|
52
|
+
* @param name - the bundle to read.
|
|
53
|
+
* @returns the flag, or `undefined` when the list could not be read.
|
|
54
|
+
*/
|
|
55
|
+
async function readsAsEnabled(manager, name) {
|
|
56
|
+
try {
|
|
57
|
+
const bundles = await manager.listBundles();
|
|
58
|
+
const list = Array.isArray(bundles) ? bundles : [];
|
|
59
|
+
return list.find((item) => item?.name === name)?.enabled;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Call `setBundleEnabled`, reporting a refusal instead of throwing it.
|
|
67
|
+
*
|
|
68
|
+
* @param manager - the plugin manager.
|
|
69
|
+
* @param name - the bundle to toggle.
|
|
70
|
+
* @param enabled - the state to ask for.
|
|
71
|
+
* @param log - progress sink.
|
|
72
|
+
* @returns the manager's code, or `undefined` when the call succeeded.
|
|
73
|
+
*/
|
|
74
|
+
async function toggle(manager, name, enabled, log) {
|
|
75
|
+
try {
|
|
76
|
+
return codeOf(await manager.setBundleEnabled(name, enabled));
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const code = codeOf(error);
|
|
80
|
+
log(` ! ${enabled ? `enable ${name}` : 'unload'} failed: ${code ?? (error instanceof Error ? error.message : String(error))}`);
|
|
81
|
+
return code ?? 'operation-error';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Remove a bundle, clearing the loader fiber the manager will not unload.
|
|
86
|
+
*
|
|
87
|
+
* `removeBundle` deselects and reloads only when it reads the bundle as
|
|
88
|
+
* enabled, and the deselect step of a *selection change* is what lets the
|
|
89
|
+
* reload drop the rows: `reconcileProfile` disposes exactly the rows that the
|
|
90
|
+
* previous patch list had and the new one does not. A bundle the manager
|
|
91
|
+
* already reads as disabled therefore cannot be unloaded by asking for
|
|
92
|
+
* disabled again — the manifest does not change, so nothing is dropped, so the
|
|
93
|
+
* fiber survives and the retry is refused for the same reason. Re-selecting it
|
|
94
|
+
* and then deselecting it does produce that change, which is the only lever a
|
|
95
|
+
* live process has; a fiber that outlives even that needs a restart.
|
|
96
|
+
*
|
|
97
|
+
* @param manager - the plugin manager.
|
|
98
|
+
* @param name - the bundle to remove.
|
|
99
|
+
* @param log - progress sink.
|
|
100
|
+
* @returns the removal result.
|
|
101
|
+
*/
|
|
102
|
+
async function removeForReplacement(manager, name, log) {
|
|
103
|
+
let first;
|
|
104
|
+
let thrown;
|
|
105
|
+
try {
|
|
106
|
+
first = await manager.removeBundle(name);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
thrown = error;
|
|
110
|
+
}
|
|
111
|
+
const code = codeOf(first) ?? codeOf(thrown);
|
|
112
|
+
if (code !== IN_USE) {
|
|
113
|
+
if (thrown !== undefined)
|
|
114
|
+
throw thrown;
|
|
115
|
+
return first;
|
|
116
|
+
}
|
|
117
|
+
const enabled = await readsAsEnabled(manager, name);
|
|
118
|
+
log(` ! ${name} is still loaded; unloading it before the retry`);
|
|
119
|
+
if (enabled === false) {
|
|
120
|
+
log(` ! ${name} already reads as disabled, so deselecting it again would change nothing`);
|
|
121
|
+
const reselect = await toggle(manager, name, true, log);
|
|
122
|
+
if (reselect !== undefined) {
|
|
123
|
+
log(` ! could not re-select ${name} (${reselect}); the removal cannot clear its fiber`);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
const deselect = await toggle(manager, name, false, log);
|
|
127
|
+
if (deselect !== undefined) {
|
|
128
|
+
log(` ! ${name} may have been left enabled; turn it off again from the Installed tab`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const unload = await toggle(manager, name, false, log);
|
|
134
|
+
if (unload !== undefined)
|
|
135
|
+
log(` ! unload reported ${unload}`);
|
|
136
|
+
}
|
|
137
|
+
// Once the plugin has been switched off, a second refusal needs the job log
|
|
138
|
+
// to say so: from the outside, an unload that reported `bundle-in-use` and a
|
|
139
|
+
// removal that refused for the same reason look identical otherwise.
|
|
140
|
+
let retried;
|
|
141
|
+
let retryThrown;
|
|
142
|
+
try {
|
|
143
|
+
retried = await manager.removeBundle(name);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
retryThrown = error;
|
|
147
|
+
}
|
|
148
|
+
const retryCode = codeOf(retried) ?? codeOf(retryThrown);
|
|
149
|
+
if (retryCode !== IN_USE) {
|
|
150
|
+
if (retryThrown !== undefined)
|
|
151
|
+
throw retryThrown;
|
|
152
|
+
return retried;
|
|
153
|
+
}
|
|
154
|
+
log(` ! ${name} is still loaded after unloading; it needs a restart`);
|
|
155
|
+
const detail = restartHint(enabled);
|
|
156
|
+
if (retryThrown !== undefined) {
|
|
157
|
+
// Keep the manager's own code on the line the panel reads, and carry the
|
|
158
|
+
// hint beside it: the caller turns both into the step's outcome.
|
|
159
|
+
if (retryThrown !== null && typeof retryThrown === 'object') {
|
|
160
|
+
Object.assign(retryThrown, { code: IN_USE, detail });
|
|
161
|
+
}
|
|
162
|
+
throw retryThrown;
|
|
163
|
+
}
|
|
164
|
+
return { ...retried, error: { code: IN_USE, diagnostic: detail } };
|
|
165
|
+
}
|
|
3
166
|
/**
|
|
4
167
|
* Re-apply the enabled state a step asked for after the package was replaced.
|
|
5
168
|
*
|
|
@@ -50,11 +213,13 @@ export async function restoreEnabledState(manager, step, wanted, log) {
|
|
|
50
213
|
* @param manager - the plugin manager.
|
|
51
214
|
* @param step - the requested change.
|
|
52
215
|
* @param log - progress sink.
|
|
216
|
+
* @param announce - receives the request id the step installs under.
|
|
53
217
|
* @returns the outcome record.
|
|
54
218
|
*/
|
|
55
|
-
export async function runStep(manager, step, log) {
|
|
219
|
+
export async function runStep(manager, step, log, announce) {
|
|
56
220
|
const spec = `${step.name}@${step.version}`;
|
|
57
221
|
const requestId = globalThis.crypto?.randomUUID?.() ?? `pu-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
222
|
+
announce?.(requestId);
|
|
58
223
|
const buildApproval = Array.isArray(step.approveBuilds) && step.approveBuilds.length > 0
|
|
59
224
|
? { approvedBuilds: step.approveBuilds }
|
|
60
225
|
: {};
|
|
@@ -82,15 +247,24 @@ export async function runStep(manager, step, log) {
|
|
|
82
247
|
log(`remove ${step.name} (replacing an installed dependency)`);
|
|
83
248
|
let removed;
|
|
84
249
|
try {
|
|
85
|
-
removed = await manager
|
|
250
|
+
removed = await removeForReplacement(manager, step.name, log);
|
|
86
251
|
}
|
|
87
252
|
catch (error) {
|
|
253
|
+
/**
|
|
254
|
+
* A refused removal rejects only when the manager could not fold the
|
|
255
|
+
* failure into a result. The code and the restart hint still belong on
|
|
256
|
+
* the outcome: without them the panel shows "removal failed: …" and the
|
|
257
|
+
* operator has nothing to act on.
|
|
258
|
+
*/
|
|
259
|
+
const code = codeOf(error);
|
|
260
|
+
const diagnostic = error?.detail;
|
|
88
261
|
return {
|
|
89
262
|
...base,
|
|
90
263
|
ok: false,
|
|
91
264
|
stage: 'remove',
|
|
92
265
|
application: 'failed',
|
|
93
|
-
message: `removal failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
266
|
+
message: code ?? `removal failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
267
|
+
...(typeof diagnostic === 'string' ? { detail: diagnostic } : {}),
|
|
94
268
|
};
|
|
95
269
|
}
|
|
96
270
|
if (removed?.application === 'failed' || removed?.error !== undefined) {
|
|
@@ -103,12 +277,17 @@ export async function runStep(manager, step, log) {
|
|
|
103
277
|
detail: removed?.error?.diagnostic,
|
|
104
278
|
};
|
|
105
279
|
}
|
|
280
|
+
// A fresh id, not `undefined`: the re-install has to stay cancellable, and
|
|
281
|
+
// reusing the first one races the manager dropping the settled request.
|
|
282
|
+
const retryId = globalThis.crypto?.randomUUID?.() ?? `pu-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
283
|
+
announce?.(retryId);
|
|
106
284
|
try {
|
|
107
|
-
result = await manager.installBundle(spec, { ...options, requestId:
|
|
285
|
+
result = await manager.installBundle(spec, { ...options, requestId: retryId });
|
|
108
286
|
}
|
|
109
287
|
catch (error) {
|
|
110
288
|
return {
|
|
111
289
|
...base,
|
|
290
|
+
requestId: retryId,
|
|
112
291
|
ok: false,
|
|
113
292
|
stage: 'install',
|
|
114
293
|
application: 'failed',
|
|
@@ -116,11 +295,15 @@ export async function runStep(manager, step, log) {
|
|
|
116
295
|
};
|
|
117
296
|
}
|
|
118
297
|
}
|
|
119
|
-
|
|
298
|
+
// Only a change that landed has an enabled state to restore: a failed install
|
|
299
|
+
// left nothing behind, and asking to toggle it would report a second, louder
|
|
300
|
+
// error (`operation-error`) for a package that was never added.
|
|
301
|
+
const installed = result?.application === 'applied' || result?.application === 'restart-required';
|
|
302
|
+
const enabled = installed ? await restoreEnabledState(manager, step, restoreEnabled, log) : undefined;
|
|
120
303
|
return {
|
|
121
304
|
...base,
|
|
122
305
|
...(enabled === undefined ? {} : { enabled }),
|
|
123
|
-
ok:
|
|
306
|
+
ok: installed,
|
|
124
307
|
application: result?.application,
|
|
125
308
|
changed: result?.changed === true,
|
|
126
309
|
stage: result?.stage,
|
package/lib/host/install.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/host/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/host/install.ts"],"names":[],"mappings":"AAgDA,gCAAgC;AAChC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE7D,2EAA2E;AAC3E,MAAM,MAAM,GAAG,eAAe,CAAA;AAE9B;;;;;;;;GAQG;AACH,SAAS,MAAM,CAAC,OAAgB;IAC9B,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IACrE,MAAM,MAAM,GAAG,OAAyD,CAAA;IACxE,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,IAAI,CAAA;IACvD,OAAO,OAAO,MAAM,CAAC,KAAK,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS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C,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;oBAC1C,CAAC,CAAC,SAAS;aAChB;KACR,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,cAAc,CAAA;IACpE,MAAM,MAAM,GAAG,IAA+B,CAAA;IAC9C,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,cAAc,CAAA;IAChG,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,gBAAgB,CAAA;IAC/F,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
package/lib/host/manager.d.ts
CHANGED
|
@@ -113,10 +113,45 @@ export interface PluginManager {
|
|
|
113
113
|
status: 'cancelled' | 'too-late' | 'not-running';
|
|
114
114
|
}>;
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* One chunk of a pnpm run's output.
|
|
118
|
+
*
|
|
119
|
+
* The manager streams these while a package operation runs, which is the only
|
|
120
|
+
* way to see what pnpm is doing: an upgrade that stalls on a registry timeout
|
|
121
|
+
* reports nothing else for minutes.
|
|
122
|
+
*/
|
|
123
|
+
export interface InstallLogChunk {
|
|
124
|
+
/** The installation the run belongs to, when its caller supplied an id. */
|
|
125
|
+
requestId?: string;
|
|
126
|
+
jobId: string;
|
|
127
|
+
argv: readonly string[];
|
|
128
|
+
cwd: string;
|
|
129
|
+
stream: 'stdout' | 'stderr';
|
|
130
|
+
text: string;
|
|
131
|
+
/** Present on the run's last chunk. */
|
|
132
|
+
exitCode?: number | null;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The phase one installation moved into.
|
|
136
|
+
*
|
|
137
|
+
* `installing` is announced once per registry the installation asks, so
|
|
138
|
+
* `attempt` is the only place a fallback retry becomes visible.
|
|
139
|
+
*/
|
|
140
|
+
export interface InstallState {
|
|
141
|
+
requestId: string;
|
|
142
|
+
phase: 'installing' | 'cancelling' | 'applying';
|
|
143
|
+
attempt?: {
|
|
144
|
+
registry: string | null;
|
|
145
|
+
index: number;
|
|
146
|
+
total: number;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
116
149
|
/** The host plugin context, as far as this plugin reads it. */
|
|
117
150
|
export interface HostContext {
|
|
118
151
|
get(name: string, strict: false): unknown;
|
|
119
152
|
effect(callback: () => () => void, label?: string): void;
|
|
153
|
+
on(name: 'plugin-manager/install-log', listener: (chunk: InstallLogChunk) => void): () => void;
|
|
154
|
+
on(name: 'plugin-manager/install-state', listener: (state: InstallState) => void): () => void;
|
|
120
155
|
webServer: WebServer;
|
|
121
156
|
}
|
|
122
157
|
/** The host web-server service. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/host/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAAG,eAAe,CAAA;AAEpE,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,yCAAyC;AACzC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wEAAwE;AACxE,MAAM,WAAW,UAAU;IAC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AAS;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAA;CACtC;AAED,wCAAwC;AACxC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;IACxB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,WAAW,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,WAAW,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACrH;AAED,6DAA6D;AAC7D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,CAAA;CACd;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAOzE"}
|
package/lib/host/manager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/host/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/host/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA4LH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IACjE,MAAM,SAAS,GAAG,KAA+B,CAAA;IACjD,IAAI,OAAO,SAAS,CAAC,WAAW,KAAK,UAAU,IAAI,OAAO,SAAS,CAAC,aAAa,KAAK,UAAU,EAAE,CAAC;QACjG,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,SAA0B,CAAA;AACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../src/host/overview.ts"],"names":[],"mappings":"AAWA,OAAO,EAAkD,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7F,OAAO,
|
|
1
|
+
{"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../src/host/overview.ts"],"names":[],"mappings":"AAWA,OAAO,EAAkD,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7F,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,UAAU,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAuC9G,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,KAAK,EAAE,eAAe,GAAG,IAAI,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wCAAwC;AACxC,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,gBAAgB,CAAA;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,OAAO,EAAE,WAAW,EAAE,CAAA;CACvB;AAED,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAClC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,QAAQ,CAAC,CAwHnB"}
|
package/lib/host/overview.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The overview payload the Versions tab renders.
|
|
3
3
|
*
|
|
4
|
-
* One request answers everything the tab needs
|
|
5
|
-
* published versions, which of them are upgradable
|
|
4
|
+
* One request answers everything the tab needs 鈥?installed bundles, their
|
|
5
|
+
* published versions, which of them are upgradable 鈥?because a per-bundle
|
|
6
6
|
* request would turn one page open into a dozen round trips.
|
|
7
7
|
*
|
|
8
8
|
* @module dsh-plugin-upgrader/lib/overview
|
|
@@ -10,9 +10,39 @@
|
|
|
10
10
|
import { compareVersions } from './version.js';
|
|
11
11
|
import { repoUrlOf } from './repo.js';
|
|
12
12
|
import { inlineIcon, pickText, registryBase, sourceKind } from './bundle.js';
|
|
13
|
-
import { cachedTags, fetchPackument, shapePackument, } from './registry.js';
|
|
13
|
+
import { cachedTags, fetchPackument, shapePackument, PACKUMENT_CONCURRENCY, } from './registry.js';
|
|
14
14
|
/** Inline data-URL icons above this size are dropped from the overview payload. */
|
|
15
15
|
const INLINE_ICON_LIMIT = 2048;
|
|
16
|
+
/**
|
|
17
|
+
* Run `task` over every item, with at most `limit` running at once.
|
|
18
|
+
*
|
|
19
|
+
* The first version of this used `Promise.all`, which fired every package
|
|
20
|
+
* lookup at the mirror simultaneously. Eleven concurrent connections to
|
|
21
|
+
* `registry.npmmirror.com` timed out, while the same eleven asked one at a time
|
|
22
|
+
* answered in under 1.2 s 鈥?and each timeout rendered as a plugin with no
|
|
23
|
+
* version history. The cap is what keeps one page load from becoming a burst.
|
|
24
|
+
*
|
|
25
|
+
* @param items - the work items.
|
|
26
|
+
* @param limit - how many may run at once.
|
|
27
|
+
* @param task - the work itself.
|
|
28
|
+
* @returns the results, in the order the items were given.
|
|
29
|
+
*/
|
|
30
|
+
async function mapLimited(items, limit, task) {
|
|
31
|
+
const results = new Array(items.length);
|
|
32
|
+
let next = 0;
|
|
33
|
+
const workers = Array.from({ length: Math.max(1, Math.min(limit, items.length)) }, async () => {
|
|
34
|
+
for (;;) {
|
|
35
|
+
const index = next;
|
|
36
|
+
next += 1;
|
|
37
|
+
const item = items[index];
|
|
38
|
+
if (item === undefined)
|
|
39
|
+
return;
|
|
40
|
+
results[index] = await task(item);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
await Promise.all(workers);
|
|
44
|
+
return results;
|
|
45
|
+
}
|
|
16
46
|
/**
|
|
17
47
|
* Build the overview the tab renders.
|
|
18
48
|
*
|
|
@@ -30,7 +60,8 @@ export async function buildOverview(ctx, cache, tagCache, options) {
|
|
|
30
60
|
const [bundles, registries] = await Promise.all([manager.listBundles(), manager.registries()]);
|
|
31
61
|
const base = registryBase(registries);
|
|
32
62
|
const locale = options.locale === 'zh' ? 'zh' : 'en';
|
|
33
|
-
const
|
|
63
|
+
const installed = bundles.filter((bundle) => bundle.installed === true);
|
|
64
|
+
const rows = await mapLimited(installed, PACKUMENT_CONCURRENCY, async (bundle) => {
|
|
34
65
|
const kind = sourceKind(bundle.source);
|
|
35
66
|
/** Official rows live inside the installation and cannot be replaced. */
|
|
36
67
|
const managed = bundle.availability === 'profile' && bundle.installed === true;
|
|
@@ -66,6 +97,38 @@ export async function buildOverview(ctx, cache, tagCache, options) {
|
|
|
66
97
|
entry.versionError = 'not a profile-managed package';
|
|
67
98
|
return entry;
|
|
68
99
|
}
|
|
100
|
+
if (kind === 'path') {
|
|
101
|
+
/**
|
|
102
|
+
* A `link:`/`file:` dependency has no published history of its own, but it
|
|
103
|
+
* is not an unanswerable row either: the local directory has a version and
|
|
104
|
+
* the registry may publish the same package name. Saying only "path
|
|
105
|
+
* source" left the row with an arrow and no numbers at all, which reads as
|
|
106
|
+
* a broken plugin. Ask the registry anyway and keep the local version as
|
|
107
|
+
* what is installed.
|
|
108
|
+
*/
|
|
109
|
+
const { data } = await fetchPackument(base, bundle.name, cache, options.force === true);
|
|
110
|
+
if (data === undefined) {
|
|
111
|
+
entry.versionError = 'local path install: the registry has no published copy';
|
|
112
|
+
return entry;
|
|
113
|
+
}
|
|
114
|
+
/*
|
|
115
|
+
* Pass the installed version through even though this package did not come
|
|
116
|
+
* from the registry: `shapePackument` uses it to mark which row is the one
|
|
117
|
+
* actually loaded. Omitting it left every row `current: false`, so the
|
|
118
|
+
* version the user already has still offered a "back to latest" button.
|
|
119
|
+
*/
|
|
120
|
+
const shaped = shapePackument(data, bundle.version, undefined);
|
|
121
|
+
entry.latest = shaped.latest;
|
|
122
|
+
entry.repoUrl = shaped.repoUrl;
|
|
123
|
+
entry.versions = shaped.versions;
|
|
124
|
+
entry.tags = shaped.tags;
|
|
125
|
+
entry.totalVersions = shaped.totalVersions ?? shaped.versions.length;
|
|
126
|
+
entry.versionError = 'local path install: the version comes from the directory, not the registry';
|
|
127
|
+
// Never upgradable: replacing a `link:` with a registry tarball would
|
|
128
|
+
// change how the plugin is installed, which is not an upgrade.
|
|
129
|
+
entry.upgradable = false;
|
|
130
|
+
return entry;
|
|
131
|
+
}
|
|
69
132
|
if (kind !== 'registry' && kind !== 'unknown') {
|
|
70
133
|
entry.versionError = `${kind} source: no registry history`;
|
|
71
134
|
return entry;
|
|
@@ -89,7 +152,7 @@ export async function buildOverview(ctx, cache, tagCache, options) {
|
|
|
89
152
|
entry.upgradable =
|
|
90
153
|
entry.latest !== undefined && compareVersions(entry.latest, bundle.version) > 0;
|
|
91
154
|
return entry;
|
|
92
|
-
})
|
|
155
|
+
});
|
|
93
156
|
rows.sort((left, right) => {
|
|
94
157
|
if (left.upgradable !== right.upgradable)
|
|
95
158
|
return left.upgradable ? -1 : 1;
|
package/lib/host/overview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview.js","sourceRoot":"","sources":["../../src/host/overview.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAsB,MAAM,WAAW,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAmB,MAAM,aAAa,CAAA;AAC7F,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,
|
|
1
|
+
{"version":3,"file":"overview.js","sourceRoot":"","sources":["../../src/host/overview.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAsB,MAAM,WAAW,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAmB,MAAM,aAAa,CAAA;AAC7F,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,qBAAqB,GAKtB,MAAM,e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AAO,EAAE,IAAI;KACd,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deriving a job's phase from the raw package-manager output.
|
|
3
|
+
*
|
|
4
|
+
* The manager announces its phases through `plugin-manager/install-state`, but
|
|
5
|
+
* that event is optional: a host that does not emit it leaves the panel stuck
|
|
6
|
+
* on whatever `runStep` last wrote, which is `waiting` — the tab then shows
|
|
7
|
+
* "preparing" for the entire install, however long that is. The log itself is
|
|
8
|
+
* the fallback signal: the moment pnpm prints anything, the step is installing,
|
|
9
|
+
* not preparing.
|
|
10
|
+
*
|
|
11
|
+
* @module dsh-plugin-upgrader/lib/progress
|
|
12
|
+
*/
|
|
13
|
+
import type { InstallLogChunk, InstallState } from './manager.ts';
|
|
14
|
+
/** The phase a job reports, including the state before the step starts. */
|
|
15
|
+
export type Phase = InstallState['phase'] | 'waiting';
|
|
16
|
+
/**
|
|
17
|
+
* The phase a log chunk puts a job in.
|
|
18
|
+
*
|
|
19
|
+
* Only the pre-start state is ever overwritten here. `applying` and
|
|
20
|
+
* `cancelling` come from the manager and are more specific than anything pnpm's
|
|
21
|
+
* own output could imply, so a late chunk must not walk them back.
|
|
22
|
+
*
|
|
23
|
+
* @param current - the phase the job is in now.
|
|
24
|
+
* @param chunk - the chunk that just arrived.
|
|
25
|
+
* @returns the phase to report.
|
|
26
|
+
*/
|
|
27
|
+
export declare function nextPhase(current: Phase | undefined, chunk: InstallLogChunk): Phase;
|
|
28
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/host/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEjE,2EAA2E;AAC3E,MAAM,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,CAAA;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,EAAE,eAAe,GAAG,KAAK,CAOnF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The phase a log chunk puts a job in.
|
|
3
|
+
*
|
|
4
|
+
* Only the pre-start state is ever overwritten here. `applying` and
|
|
5
|
+
* `cancelling` come from the manager and are more specific than anything pnpm's
|
|
6
|
+
* own output could imply, so a late chunk must not walk them back.
|
|
7
|
+
*
|
|
8
|
+
* @param current - the phase the job is in now.
|
|
9
|
+
* @param chunk - the chunk that just arrived.
|
|
10
|
+
* @returns the phase to report.
|
|
11
|
+
*/
|
|
12
|
+
export function nextPhase(current, chunk) {
|
|
13
|
+
if (current === 'applying' || current === 'cancelling' || current === 'installing') {
|
|
14
|
+
return current;
|
|
15
|
+
}
|
|
16
|
+
// A whitespace-only chunk is a keep-alive, not evidence of work.
|
|
17
|
+
if (typeof chunk.text !== 'string' || chunk.text.trim() === '')
|
|
18
|
+
return current ?? 'waiting';
|
|
19
|
+
return 'installing';
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/host/progress.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,OAA0B,EAAE,KAAsB;IAC1E,IAAI,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,YAAY,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;QACnF,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,iEAAiE;IACjE,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,OAAO,IAAI,SAAS,CAAA;IAC3F,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
package/lib/host/registry.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { type PackumentLike, type RepoManifest } from './repo.ts';
|
|
2
2
|
/** How long one registry packument stays fresh. */
|
|
3
3
|
export declare const PACKUMENT_TTL_MS: number;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Registry lookups must not hang a page render.
|
|
6
|
+
*
|
|
7
|
+
* Raised from 10 s once the documents were measured: the largest package in a
|
|
8
|
+
* normal profile (`billion-context`, 6 624 versions) is a 26 MB JSON document
|
|
9
|
+
* and 10 MB even abbreviated, which takes a second on a fast mirror and much
|
|
10
|
+
* longer on a busy one. A deadline that the healthy case can miss is not a
|
|
11
|
+
* deadline, it is a coin flip — and its losing side was being drawn as "this
|
|
12
|
+
* plugin has no version history".
|
|
13
|
+
*/
|
|
5
14
|
export declare const PACKUMENT_TIMEOUT_MS: number;
|
|
6
15
|
/** Version lists are capped so one huge package cannot flood the tab. */
|
|
7
16
|
export declare const MAX_VERSIONS = 80;
|
|
@@ -36,6 +45,8 @@ export interface FullPackument extends PackumentLike {
|
|
|
36
45
|
export interface PackumentEntry {
|
|
37
46
|
at: number;
|
|
38
47
|
data: unknown;
|
|
48
|
+
/** Set when the last attempt failed, so a later render can say why. */
|
|
49
|
+
error?: string;
|
|
39
50
|
}
|
|
40
51
|
/** One cached tag lookup. */
|
|
41
52
|
export interface TagEntry {
|
|
@@ -43,6 +54,18 @@ export interface TagEntry {
|
|
|
43
54
|
tags?: Set<string>;
|
|
44
55
|
error?: string;
|
|
45
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* How long a failed packument lookup is remembered.
|
|
59
|
+
*
|
|
60
|
+
* A failure has to be remembered at all: the tab rebuilds the overview on every
|
|
61
|
+
* mount, and retrying a mirror that just timed out on every mount turns one
|
|
62
|
+
* slow render into a permanently slow page. It is kept much shorter than a
|
|
63
|
+
* successful entry, though — the failure is usually contention, not a broken
|
|
64
|
+
* package, so the next open should get a fresh chance.
|
|
65
|
+
*/
|
|
66
|
+
export declare const PACKUMENT_RETRY_MS: number;
|
|
67
|
+
/** How many package lookups may be in flight at once. */
|
|
68
|
+
export declare const PACKUMENT_CONCURRENCY = 4;
|
|
46
69
|
/** One version line the tab renders. */
|
|
47
70
|
export interface VersionRow {
|
|
48
71
|
version: string;
|
|
@@ -62,10 +85,25 @@ export interface ShapedPackument {
|
|
|
62
85
|
tags: Record<string, string>;
|
|
63
86
|
totalVersions?: number;
|
|
64
87
|
versionError?: string;
|
|
88
|
+
/** The `dist-tags.latest` that was rejected as broken, when there was one. */
|
|
89
|
+
staleTag?: string;
|
|
65
90
|
}
|
|
66
91
|
/**
|
|
67
92
|
* Fetch one package's packument, with a short-lived cache.
|
|
68
93
|
*
|
|
94
|
+
* Two failure modes were measured on the npmmirror mirror, and both produced
|
|
95
|
+
* the same symptom — a plugin drawn with no version history at all:
|
|
96
|
+
*
|
|
97
|
+
* - the tab asks for every installed package at once, and eleven concurrent
|
|
98
|
+
* connections to the mirror time out at a 10 s deadline while the same
|
|
99
|
+
* eleven asked one at a time answer in under 1.2 s;
|
|
100
|
+
* - the largest document in a normal profile is 26 MB, so even a healthy
|
|
101
|
+
* request is slow enough to lose that race.
|
|
102
|
+
*
|
|
103
|
+
* The abbreviated document cuts the transfer, the deadline was raised, and a
|
|
104
|
+
* timeout is retried once — a `UND_ERR_CONNECT_TIMEOUT` is contention on the
|
|
105
|
+
* socket, not a verdict about the package.
|
|
106
|
+
*
|
|
69
107
|
* @param base - registry base URL.
|
|
70
108
|
* @param packageName - package name.
|
|
71
109
|
* @param cache - shared cache.
|
|
@@ -107,6 +145,15 @@ export declare function cachedTags(repoUrl: string, cache: Map<string, TagEntry>
|
|
|
107
145
|
/**
|
|
108
146
|
* Trim one packument down to what the tab renders.
|
|
109
147
|
*
|
|
148
|
+
* `dist-tags.latest` is normally the newest stable release, and it is trusted as
|
|
149
|
+
* is — a prerelease above it must NOT become "latest", or every `-next` build
|
|
150
|
+
* would advertise itself over the stable line. The one case it cannot be
|
|
151
|
+
* trusted is a tag that sorts *below the version already installed*: that is not
|
|
152
|
+
* a release decision, it is a broken tag. npmmirror serves
|
|
153
|
+
* `@deepseek-ai/dsh-subagent-codex` with `latest: 0.0.1-rc.1` while the profile
|
|
154
|
+
* runs `0.2.1-rc.3`, which made the row claim the installed build was newer than
|
|
155
|
+
* latest and offered an "upgrade" that was really a downgrade.
|
|
156
|
+
*
|
|
110
157
|
* @param packument - the full registry document.
|
|
111
158
|
* @param installedVersion - the version in the profile.
|
|
112
159
|
* @param tagNames - the repository's tag names, when known.
|