@dsh-workbench/adapter-probe 1.5.2-alpha.0 → 1.5.2-alpha.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/dist/self-update/self-update-plan.d.ts +4 -1
- package/dist/self-update/self-update-run.d.ts +4 -0
- package/dist/self-update/self-update-run.js +15 -2
- package/dist/self-update/self-update-view.js +15 -1
- package/package.json +5 -5
- package/dist/runtime/store-mismatch.d.ts +0 -1
- package/dist/runtime/store-mismatch.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SelfUpdatePaths, SelfUpdateRequest, SelfUpdateStart, UpdateJournalState } from '@dsh-workbench/shared/host';
|
|
2
2
|
import { type SelfUpdateCli } from './self-update-cli.js';
|
|
3
|
-
import type { SelfUpdateReason, SelfUpdateState } from '@dsh-workbench/shared/contract/protocol/bundle-install';
|
|
3
|
+
import type { SelfUpdateFailure, SelfUpdateReason, SelfUpdateState } from '@dsh-workbench/shared/contract/protocol/bundle-install';
|
|
4
4
|
export declare const SELF_UPDATE_PACKAGES: ("@dsh-workbench/adapter-probe" | "@dsh-workbench/adapter-profile" | "@dsh-workbench/adapter-runtime" | "@dsh-workbench/adapter-supply" | "@dsh-workbench/adapters-default" | "@dsh-workbench/core" | "@dsh-workbench/shared")[];
|
|
5
5
|
export declare const CORE_ARTIFACTS: readonly ["client.js", "dist/client/index.js", "dist/host/index.js"];
|
|
6
6
|
export type { SelfUpdatePaths, SelfUpdateRequest, SelfUpdateStart };
|
|
@@ -10,6 +10,9 @@ export interface SelfUpdateMarker extends SelfUpdateRequest {
|
|
|
10
10
|
readonly migration?: boolean | undefined;
|
|
11
11
|
readonly version: string;
|
|
12
12
|
readonly reason?: SelfUpdateReason | undefined;
|
|
13
|
+
readonly failure?: SelfUpdateFailure | undefined;
|
|
14
|
+
readonly requirements?: Readonly<Record<string, string>> | undefined;
|
|
15
|
+
readonly runtimeVersion?: string | undefined;
|
|
13
16
|
readonly phase?: UpdateJournalState | undefined;
|
|
14
17
|
readonly committed?: boolean | undefined;
|
|
15
18
|
readonly at: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ProcessHost } from '@dsh-workbench/shared/host';
|
|
2
|
+
import type { SelfUpdateFailure } from '@dsh-workbench/shared/contract/protocol/bundle-install';
|
|
2
3
|
import type { SelfUpdateSteps } from './self-update-steps.js';
|
|
3
4
|
import { type VersionLink } from './version/version-dir.js';
|
|
4
5
|
import { type VersionEntryProbe } from './version/version-gate.js';
|
|
@@ -25,6 +26,9 @@ export interface SelfUpdateRunResult {
|
|
|
25
26
|
readonly state: 'ok' | 'pending' | 'failed';
|
|
26
27
|
readonly detail: string;
|
|
27
28
|
readonly ran: readonly string[];
|
|
29
|
+
readonly failure?: SelfUpdateFailure | undefined;
|
|
30
|
+
readonly requirements?: Readonly<Record<string, string>> | undefined;
|
|
31
|
+
readonly runtimeVersion?: string | undefined;
|
|
28
32
|
}
|
|
29
33
|
export declare function selfUpdateJournalPath(plan: SelfUpdateSteps): string;
|
|
30
34
|
export declare function runSelfUpdateSteps(plan: SelfUpdateSteps, deps: SelfUpdateRunDeps): Promise<SelfUpdateRunResult>;
|
|
@@ -37,17 +37,23 @@ export async function runSelfUpdateSteps(plan, deps) {
|
|
|
37
37
|
writeCommittedMarker(plan, now, log);
|
|
38
38
|
return { ok: true, state: 'pending', detail, ran };
|
|
39
39
|
}
|
|
40
|
+
const failureInfo = {
|
|
41
|
+
failure: outcome.failure,
|
|
42
|
+
requirements: outcome.requirements,
|
|
43
|
+
runtimeVersion: outcome.runtimeVersion,
|
|
44
|
+
};
|
|
40
45
|
writeJsonFile(plan.markerPath, {
|
|
41
46
|
...plan.marker,
|
|
42
47
|
state: 'failed',
|
|
43
48
|
version: plan.marker.from,
|
|
44
49
|
reason: 'incomplete',
|
|
45
50
|
at: now(),
|
|
51
|
+
...failureInfo,
|
|
46
52
|
});
|
|
47
53
|
log(detail);
|
|
48
54
|
log(`救法:${plan.rescue}`);
|
|
49
55
|
noteSelfUpdateFailed(diag, plan.version, detail);
|
|
50
|
-
return { ok: false, state: 'failed', detail, ran };
|
|
56
|
+
return { ok: false, state: 'failed', detail, ran, ...failureInfo };
|
|
51
57
|
}
|
|
52
58
|
ran.push(step.kind);
|
|
53
59
|
log(outcome.detail);
|
|
@@ -162,7 +168,14 @@ async function applyStep(plan, step, deps, now, log, flippedAt) {
|
|
|
162
168
|
}
|
|
163
169
|
if (gate.compatibility.verdict === 'incompatible') {
|
|
164
170
|
const need = gate.compatibility.requirements.map((item) => `${item.pkg} 要 ${item.range}`).join('、');
|
|
165
|
-
|
|
171
|
+
const requirements = Object.fromEntries(gate.compatibility.requirements.map((item) => [item.source === 'engines' ? 'engines.dsh' : item.pkg, item.range]));
|
|
172
|
+
return {
|
|
173
|
+
ok: false,
|
|
174
|
+
detail: `新版本跟这一台 dsh ${plan.dshVersion ?? ''} 不兼容(${need}),不切过去`,
|
|
175
|
+
failure: 'incompatible',
|
|
176
|
+
requirements,
|
|
177
|
+
...(plan.dshVersion === undefined ? {} : { runtimeVersion: plan.dshVersion }),
|
|
178
|
+
};
|
|
166
179
|
}
|
|
167
180
|
if (gate.compatibility.verdict === 'unknown') {
|
|
168
181
|
log(`兼容性未知(${gate.compatibility.reason}),已经做过隔离入口检查`);
|
|
@@ -2,7 +2,7 @@ import { closeSync, openSync, readFileSync, readSync, statSync } from 'node:fs';
|
|
|
2
2
|
import { readBootRecord, readReinstallRecord, reinstallRecordFile, updateLeaseActive, } from '@dsh-workbench/shared/host';
|
|
3
3
|
import { selfUpdatePaths, selfUpdateUpFile } from './self-update-plan.js';
|
|
4
4
|
import { pidAlive } from './self-update-alive.js';
|
|
5
|
-
import { SELF_UPDATE_REASONS, SELF_UPDATE_STATES, } from '@dsh-workbench/shared/contract/protocol/bundle-install';
|
|
5
|
+
import { SELF_UPDATE_FAILURES, SELF_UPDATE_REASONS, SELF_UPDATE_STATES, } from '@dsh-workbench/shared/contract/protocol/bundle-install';
|
|
6
6
|
function asText(value) {
|
|
7
7
|
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
8
8
|
}
|
|
@@ -61,6 +61,9 @@ export function readSelfUpdateView(profile) {
|
|
|
61
61
|
const version = asText(record.version);
|
|
62
62
|
const at = asText(record.at);
|
|
63
63
|
const reason = asText(record.reason);
|
|
64
|
+
const failure = asText(record.failure);
|
|
65
|
+
const requirements = requirementsOf(record.requirements);
|
|
66
|
+
const runtimeVersion = asText(record.runtimeVersion);
|
|
64
67
|
const tail = readTail(paths.log);
|
|
65
68
|
const confirmed = state === 'pending-restart' &&
|
|
66
69
|
version !== undefined &&
|
|
@@ -82,9 +85,20 @@ export function readSelfUpdateView(profile) {
|
|
|
82
85
|
: reason === undefined || !SELF_UPDATE_REASONS.includes(reason)
|
|
83
86
|
? {}
|
|
84
87
|
: { reason: reason }),
|
|
88
|
+
...(failure === undefined || !SELF_UPDATE_FAILURES.includes(failure)
|
|
89
|
+
? {}
|
|
90
|
+
: { failure: failure }),
|
|
91
|
+
...(requirements === undefined ? {} : { requirements }),
|
|
92
|
+
...(runtimeVersion === undefined ? {} : { runtimeVersion }),
|
|
85
93
|
...(tail === undefined ? {} : { tail }),
|
|
86
94
|
};
|
|
87
95
|
}
|
|
96
|
+
function requirementsOf(raw) {
|
|
97
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
98
|
+
return undefined;
|
|
99
|
+
const found = Object.entries(raw).filter((entry) => typeof entry[1] === 'string');
|
|
100
|
+
return found.length === 0 ? undefined : Object.fromEntries(found);
|
|
101
|
+
}
|
|
88
102
|
function reinstallOf(root, owner) {
|
|
89
103
|
const record = readReinstallRecord(reinstallRecordFile(root));
|
|
90
104
|
if (record === undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-workbench/adapter-probe",
|
|
3
|
-
"version": "1.5.2-alpha.
|
|
3
|
+
"version": "1.5.2-alpha.1",
|
|
4
4
|
"description": "Workbench adapter-probe adapter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"proper-lockfile": "^4.1.2",
|
|
17
|
-
"@dsh-workbench/adapter-profile": "1.5.2-alpha.
|
|
18
|
-
"@dsh-workbench/adapter-supply": "1.5.2-alpha.
|
|
19
|
-
"@dsh-workbench/adapter-runtime": "1.5.2-alpha.
|
|
20
|
-
"@dsh-workbench/shared": "1.5.2-alpha.
|
|
17
|
+
"@dsh-workbench/adapter-profile": "1.5.2-alpha.1",
|
|
18
|
+
"@dsh-workbench/adapter-supply": "1.5.2-alpha.1",
|
|
19
|
+
"@dsh-workbench/adapter-runtime": "1.5.2-alpha.1",
|
|
20
|
+
"@dsh-workbench/shared": "1.5.2-alpha.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^24.19.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function storeMismatchIn(detail: string): boolean;
|