dsh-crate 0.0.0-stage → 0.5.0
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 +27 -0
- package/README.md +288 -2
- package/README.zh.md +263 -0
- package/UPDATE-API-V1.md +207 -0
- package/assets/logo.svg +37 -0
- package/client/client.js +18964 -0
- package/cordis.patch.yml +4 -0
- package/lib/accelerate.js +194 -0
- package/lib/agents.js +67 -0
- package/lib/backup.js +688 -0
- package/lib/body-progress.js +173 -0
- package/lib/catalog-local-match.js +160 -0
- package/lib/catalog-npm.js +180 -0
- package/lib/changelog.js +462 -0
- package/lib/channels.js +64 -0
- package/lib/check.js +1557 -0
- package/lib/compatibility.js +243 -0
- package/lib/crate-catalog.js +179 -0
- package/lib/diagnostics.js +49 -0
- package/lib/discovery-compatibility.js +447 -0
- package/lib/drain-journal.js +164 -0
- package/lib/drain.js +1043 -0
- package/lib/dsh-cli.js +1373 -0
- package/lib/dsh-install.js +259 -0
- package/lib/entry-identity.js +85 -0
- package/lib/gist.js +369 -0
- package/lib/groups.js +108 -0
- package/lib/home-paths.js +29 -0
- package/lib/host-recovery.js +187 -0
- package/lib/hot.js +871 -0
- package/lib/http.js +252 -0
- package/lib/index.js +394 -0
- package/lib/install.js +1147 -0
- package/lib/lifecycle.js +37 -0
- package/lib/log-redaction.js +24 -0
- package/lib/log.js +204 -0
- package/lib/ndjson.js +154 -0
- package/lib/net.js +174 -0
- package/lib/official-desktop.js +619 -0
- package/lib/order.js +284 -0
- package/lib/patch.js +943 -0
- package/lib/pending-rows.js +142 -0
- package/lib/pending-updates.js +346 -0
- package/lib/pnpm-compat.js +972 -0
- package/lib/presets.js +282 -0
- package/lib/probe-context.js +20 -0
- package/lib/proc-text.js +69 -0
- package/lib/profile.js +1978 -0
- package/lib/recovery.js +1059 -0
- package/lib/region-probe.js +93 -0
- package/lib/regions.js +283 -0
- package/lib/registry.js +308 -0
- package/lib/release-candidates.js +115 -0
- package/lib/release-updates.js +70 -0
- package/lib/restart.js +688 -0
- package/lib/routes.js +7960 -0
- package/lib/settings.js +164 -0
- package/lib/shelfry-catalog.js +179 -0
- package/lib/snapshot.js +506 -0
- package/lib/source-migration.js +164 -0
- package/lib/sources.js +1005 -0
- package/lib/state.js +38 -0
- package/lib/store.js +163 -0
- package/lib/themes.js +350 -0
- package/lib/trial.js +125 -0
- package/lib/types/accelerate.d.ts +85 -0
- package/lib/types/agents.d.ts +52 -0
- package/lib/types/backup.d.ts +171 -0
- package/lib/types/body-progress.d.ts +94 -0
- package/lib/types/catalog-local-match.d.ts +39 -0
- package/lib/types/catalog-npm.d.ts +77 -0
- package/lib/types/changelog.d.ts +131 -0
- package/lib/types/channels.d.ts +56 -0
- package/lib/types/check.d.ts +353 -0
- package/lib/types/compatibility.d.ts +83 -0
- package/lib/types/crate-catalog.d.ts +48 -0
- package/lib/types/diagnostics.d.ts +29 -0
- package/lib/types/discovery-compatibility.d.ts +145 -0
- package/lib/types/drain-journal.d.ts +25 -0
- package/lib/types/drain.d.ts +306 -0
- package/lib/types/dsh-cli.d.ts +481 -0
- package/lib/types/dsh-install.d.ts +106 -0
- package/lib/types/entry-identity.d.ts +68 -0
- package/lib/types/gist.d.ts +79 -0
- package/lib/types/groups.d.ts +34 -0
- package/lib/types/home-paths.d.ts +13 -0
- package/lib/types/host-recovery.d.ts +95 -0
- package/lib/types/hot.d.ts +405 -0
- package/lib/types/http.d.ts +114 -0
- package/lib/types/index.d.ts +52 -0
- package/lib/types/install.d.ts +463 -0
- package/lib/types/lifecycle.d.ts +14 -0
- package/lib/types/log-redaction.d.ts +2 -0
- package/lib/types/log.d.ts +43 -0
- package/lib/types/ndjson.d.ts +52 -0
- package/lib/types/net.d.ts +94 -0
- package/lib/types/official-desktop.d.ts +59 -0
- package/lib/types/order.d.ts +100 -0
- package/lib/types/patch.d.ts +218 -0
- package/lib/types/pending-rows.d.ts +81 -0
- package/lib/types/pending-updates.d.ts +161 -0
- package/lib/types/pnpm-compat.d.ts +102 -0
- package/lib/types/presets.d.ts +94 -0
- package/lib/types/probe-context.d.ts +14 -0
- package/lib/types/proc-text.d.ts +29 -0
- package/lib/types/profile.d.ts +551 -0
- package/lib/types/recovery.d.ts +342 -0
- package/lib/types/region-probe.d.ts +50 -0
- package/lib/types/regions.d.ts +134 -0
- package/lib/types/registry.d.ts +160 -0
- package/lib/types/release-candidates.d.ts +42 -0
- package/lib/types/release-updates.d.ts +15 -0
- package/lib/types/restart.d.ts +279 -0
- package/lib/types/routes.d.ts +130 -0
- package/lib/types/settings.d.ts +112 -0
- package/lib/types/shelfry-catalog.d.ts +48 -0
- package/lib/types/snapshot.d.ts +93 -0
- package/lib/types/source-migration.d.ts +100 -0
- package/lib/types/sources.d.ts +391 -0
- package/lib/types/state.d.ts +20 -0
- package/lib/types/store.d.ts +47 -0
- package/lib/types/themes.d.ts +46 -0
- package/lib/types/trial.d.ts +61 -0
- package/lib/types/update-api-v1.d.ts +83 -0
- package/lib/types/updates.d.ts +273 -0
- package/lib/types/verify.d.ts +277 -0
- package/lib/update-api-v1.js +273 -0
- package/lib/updates.js +981 -0
- package/lib/verify.js +904 -0
- package/locale/en.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +113 -4
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update detection: per-plugin comparison of what the profile has against
|
|
3
|
+
* the source of truth — git HEAD for github installs, the npm latest
|
|
4
|
+
* dist-tag for registry installs — with a TTL cache.
|
|
5
|
+
*/
|
|
6
|
+
import { type Channel } from './channels.ts';
|
|
7
|
+
import { type CatalogReleaseSource } from './release-updates.ts';
|
|
8
|
+
import type { GitToNpmMigration, NpmRenameMigration } from './source-migration.ts';
|
|
9
|
+
export interface UpdateStatus {
|
|
10
|
+
/**
|
|
11
|
+
* `generation` is a `link:` the desktop host wrote (#497): the host
|
|
12
|
+
* installs it and reconciles it at startup, so the market names a newer
|
|
13
|
+
* release under `latest` and never offers to apply it. For that kind
|
|
14
|
+
* `latest` is null when the installed build is current or nothing newer
|
|
15
|
+
* can be confirmed.
|
|
16
|
+
*/
|
|
17
|
+
kind: 'github' | 'npm' | 'linked' | 'generation';
|
|
18
|
+
version: string | null;
|
|
19
|
+
current: string | null;
|
|
20
|
+
latest: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* A NEWER version exists. Forwards only, always — every caller reads it
|
|
23
|
+
* as "there is an upgrade" and labels a button accordingly.
|
|
24
|
+
*/
|
|
25
|
+
updateAvailable: boolean;
|
|
26
|
+
/** Exact mature npm stable target for Desktop; `latest` remains the registry tag. */
|
|
27
|
+
eligibleVersion?: string;
|
|
28
|
+
/**
|
|
29
|
+
* HEAD of the chosen line for a floating git install whose repository has
|
|
30
|
+
* moved without publishing: newer commits exist (current ≠ latest) but the
|
|
31
|
+
* version did not advance, so #824's rule answers `updateAvailable: false`
|
|
32
|
+
* — the update channel installs releases, not arbitrary branch heads.
|
|
33
|
+
*
|
|
34
|
+
* This field keeps the fact visible instead of collapsing it into "up to
|
|
35
|
+
* date": the market shows "有新提交(未发版)<short sha>" so a user who
|
|
36
|
+
* DOES want the unreleased bits knows a rebuild-installed row is behind,
|
|
37
|
+
* while everyone else is not nagged by a permanent update button.
|
|
38
|
+
*/
|
|
39
|
+
unreleasedCommit?: string;
|
|
40
|
+
/**
|
|
41
|
+
* This package is a plain dependency, not a plugin: no `dsh` field, not in
|
|
42
|
+
* `dsh.profile.bundles`, and no row of the user's own patch loads it
|
|
43
|
+
* (#793). A newer release can exist and is reported as `latest`, but it is
|
|
44
|
+
* never `updateAvailable` — the update channel installs a BUNDLE, and
|
|
45
|
+
* handing it a package with no bundle patch is refused by the host as
|
|
46
|
+
* `not-bundle` after the run, with a rollback message that reads as though
|
|
47
|
+
* the profile were damaged when nothing was touched.
|
|
48
|
+
*/
|
|
49
|
+
notAPlugin?: true;
|
|
50
|
+
/**
|
|
51
|
+
* A newer build exists on a tag other than `latest` (#867).
|
|
52
|
+
*
|
|
53
|
+
* Some packages leave `latest` pointing at an older line than the one they
|
|
54
|
+
* actually publish on: `@deepseek-ai/dsh-experimental-agent-team-profile`
|
|
55
|
+
* answers `latest` with 0.1.5-alpha.2 while `alpha` is 0.2.1-alpha.4, so a
|
|
56
|
+
* user who installed 0.2.1-alpha.2 reads "up to date" while the line they
|
|
57
|
+
* are following has moved. Named, and never `updateAvailable`: the market's
|
|
58
|
+
* channels are the market's own, and this is the fact, not an upgrade the
|
|
59
|
+
* market decided to offer.
|
|
60
|
+
*/
|
|
61
|
+
newerPrerelease?: string;
|
|
62
|
+
/** Taking this update replaces a local package source with its matched online release. */
|
|
63
|
+
restoreRequired?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Independent, explicit source switch offered for an installed profile: a
|
|
66
|
+
* verified legacy Git install (#461), or an npm install whose package was
|
|
67
|
+
* renamed and no longer resolves (#1012).
|
|
68
|
+
*/
|
|
69
|
+
sourceMigration?: GitToNpmMigration | NpmRenameMigration;
|
|
70
|
+
/**
|
|
71
|
+
* A newer release exists but this profile's `minimumReleaseAge` will not let
|
|
72
|
+
* pnpm install it yet (#945). The official Desktop takes no one-shot bypass,
|
|
73
|
+
* so offering the update there means offering a button that is guaranteed
|
|
74
|
+
* to fail; the market names the wait instead. `updateAvailable` can still
|
|
75
|
+
* be true if `eligibleVersion` names a different, already mature upgrade.
|
|
76
|
+
* `until` is when the newer held release should become installable.
|
|
77
|
+
*/
|
|
78
|
+
heldUpdate?: {
|
|
79
|
+
latest: string;
|
|
80
|
+
until: string;
|
|
81
|
+
estimated?: true;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* The version this package's channel points at, when it differs from what
|
|
85
|
+
* is installed and is NOT newer.
|
|
86
|
+
*
|
|
87
|
+
* A separate field rather than a second meaning for `updateAvailable`,
|
|
88
|
+
* which was tried and leaked immediately: the market page has three
|
|
89
|
+
* consumers of that flag (the header banner, "update all", the row
|
|
90
|
+
* button) and all three announced a DOWNGRADE as "a new version is
|
|
91
|
+
* available". One field, one meaning; a caller that has not been taught
|
|
92
|
+
* about channel switches simply does not offer one.
|
|
93
|
+
*
|
|
94
|
+
* Only a channel-following package can be in this state, and it is the
|
|
95
|
+
* state that used to be unreachable: picking "stable" while a prerelease
|
|
96
|
+
* was installed compared 1.13.1 against 1.14.0-beta.1, found nothing
|
|
97
|
+
* newer, and answered "up to date" — so there was no way back off a
|
|
98
|
+
* channel the user had just left.
|
|
99
|
+
*/
|
|
100
|
+
channelSwitch?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Whether a direct dependency is a plugin the update channel can apply (#793).
|
|
104
|
+
*
|
|
105
|
+
* The update path installs a BUNDLE: it re-adds the package and lets the host
|
|
106
|
+
* compose its patch. A direct dependency that is only a library or a CLI
|
|
107
|
+
* (`@mnemon-dev/mnemon` — a `bin` and no `dsh` field) is listed because it is
|
|
108
|
+
* in `package.json`, and nothing before this asked what it was, so a newer
|
|
109
|
+
* release made it "updatable" and the click ended in the host's `not-bundle`.
|
|
110
|
+
*
|
|
111
|
+
* Three independent facts each count as "this is a plugin", and a package
|
|
112
|
+
* must have none of them to be left out:
|
|
113
|
+
*
|
|
114
|
+
* - its own manifest declares a `dsh` field;
|
|
115
|
+
* - the profile lists it in `dsh.profile.bundles`;
|
|
116
|
+
* - a row of the user's own `cordis.patch.yml` loads it by name — a package
|
|
117
|
+
* can be a real, working plugin while declaring nothing itself (the
|
|
118
|
+
* official `@deepseek-ai/dsh-tools` has no `dsh` field and is loaded by the
|
|
119
|
+
* base patch), and treating that as a library would silently stop
|
|
120
|
+
* offering its updates.
|
|
121
|
+
*
|
|
122
|
+
* Every uncertainty resolves toward "is a plugin": an unreadable patch, an
|
|
123
|
+
* unreadable manifest, a package that is not installed yet. This only ever
|
|
124
|
+
* REMOVES an offer, so being unsure has to leave the offer standing — the
|
|
125
|
+
* old behaviour — rather than hide an update the user wanted.
|
|
126
|
+
*/
|
|
127
|
+
export declare function isUpdatablePlugin(activeProfileDir: string, name: string, bundles: ReadonlySet<string>): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* HEAD for an arbitrary smart-HTTP git remote (Gitea, GitLab, …). Same
|
|
130
|
+
* advertisement format as GitHub's info/refs; kept here so accelerate.ts
|
|
131
|
+
* does not need to import sources.ts.
|
|
132
|
+
*/
|
|
133
|
+
export declare function resolveGitRemoteHead(spec: string, ref?: string): Promise<string | null>;
|
|
134
|
+
/**
|
|
135
|
+
* Semver precedence: negative / 0 / positive like a comparator, or null when
|
|
136
|
+
* either side isn't a plain semver version. Build metadata is ignored, a
|
|
137
|
+
* release outranks any prerelease of the same core, and prerelease
|
|
138
|
+
* identifiers compare numerically when both are numeric (so `rc.10` > `rc.9`).
|
|
139
|
+
*/
|
|
140
|
+
export declare function compareVersions(a: string, b: string): number | null;
|
|
141
|
+
/**
|
|
142
|
+
* True only when the registry's `latest` is semantically HIGHER than what the
|
|
143
|
+
* profile has (#64 by @ZeroOrigin64). A plain `!==` also fires when a
|
|
144
|
+
* package's `latest` dist-tag is left pointing at an OLDER release than the
|
|
145
|
+
* pinned install — clicking "update" then rewrote the exact pin to `@latest`
|
|
146
|
+
* and downgraded the profile until it no longer booted.
|
|
147
|
+
*
|
|
148
|
+
* Undecidable inputs (missing or non-semver versions) report no update:
|
|
149
|
+
* without a direction we cannot promise the "update" isn't a downgrade.
|
|
150
|
+
*/
|
|
151
|
+
export declare function isUpgrade(installed: string | null, latest: string | null): boolean;
|
|
152
|
+
/** Drop the cached listing (after a successful install/update/uninstall). */
|
|
153
|
+
export declare function invalidateUpdates(): void;
|
|
154
|
+
/**
|
|
155
|
+
* Point update checks at a registry. Called when the download region
|
|
156
|
+
* resolves and whenever it changes.
|
|
157
|
+
*
|
|
158
|
+
* Dropping the cache is the load-bearing half. A mirror can lag the official
|
|
159
|
+
* registry by minutes, so answers gathered from one are not answers from the
|
|
160
|
+
* other — keeping them across a switch would report a version this registry
|
|
161
|
+
* cannot yet serve.
|
|
162
|
+
*/
|
|
163
|
+
export declare function setUpdateRegistry(base: string): void;
|
|
164
|
+
export interface DesktopMatureResult {
|
|
165
|
+
candidate: string | null;
|
|
166
|
+
latest: string | null;
|
|
167
|
+
heldUpdate?: {
|
|
168
|
+
latest: string;
|
|
169
|
+
until: string;
|
|
170
|
+
estimated?: true;
|
|
171
|
+
};
|
|
172
|
+
nextMaturityAt: number | null;
|
|
173
|
+
reason: string;
|
|
174
|
+
}
|
|
175
|
+
/** Shared fresh registry/policy verification for listing and locked execution. */
|
|
176
|
+
export declare function resolveDesktopMatureUpdate(name: string, installed: string | null, profile: string, activeProfileDir: string, endpointLatest: string | null, maxVersion?: string): Promise<DesktopMatureResult>;
|
|
177
|
+
/**
|
|
178
|
+
* The maturity of ONE precisely named version, for the compatibility dialog.
|
|
179
|
+
* "You can update to 1.7.11" is only advice; this answers whether that exact
|
|
180
|
+
* version may be installed right now, and if not, when. Never throws: an
|
|
181
|
+
* unreadable policy or an unreachable registry is reported as unknown so the
|
|
182
|
+
* UI can stay quiet instead of promising something the install would refuse.
|
|
183
|
+
*/
|
|
184
|
+
export interface RequestedVersionMaturity {
|
|
185
|
+
version: string;
|
|
186
|
+
/** true = installable now, false = held, null = not verifiable here. */
|
|
187
|
+
installable: boolean | null;
|
|
188
|
+
held: boolean;
|
|
189
|
+
exempt: boolean;
|
|
190
|
+
publishedAt: string | null;
|
|
191
|
+
nextMaturityAt: string | null;
|
|
192
|
+
releaseAgeMs: number | null;
|
|
193
|
+
reason: 'eligible' | 'held' | 'unknown-age' | 'policy-unknown' | 'registry-unavailable' | 'unknown-version';
|
|
194
|
+
}
|
|
195
|
+
export declare function readVersionMaturity(name: string, version: string, profile: string, activeProfileDir: string, now?: number): Promise<RequestedVersionMaturity>;
|
|
196
|
+
/**
|
|
197
|
+
* Evidence check behind the "wait a day" stale diagnosis (#45): whether the
|
|
198
|
+
* package's CURRENT latest release was published recently enough to sit
|
|
199
|
+
* inside pnpm's default fresh-release window. pnpm's silent hold leaves no
|
|
200
|
+
* trace in its output, so the publish time is the only verifiable signal.
|
|
201
|
+
* @returns true/false when the npm time metadata answers, null when it
|
|
202
|
+
* can't be determined (offline, unpublished, non-npm) — callers must NOT
|
|
203
|
+
* claim the safety wait on null.
|
|
204
|
+
*/
|
|
205
|
+
export declare function latestPublishedRecently(name: string, windowMs?: number): Promise<boolean | null>;
|
|
206
|
+
/** The registry's current `latest` version for a package, or null when it can't be read. */
|
|
207
|
+
/**
|
|
208
|
+
* The version a channel subscriber should be offered: the newest build in
|
|
209
|
+
* the set that channel is willing to receive.
|
|
210
|
+
*
|
|
211
|
+
* A channel is a SET, not a tag. Someone on beta has not stopped accepting
|
|
212
|
+
* releases — they accept releases and prereleases — so beta means
|
|
213
|
+
* {latest, beta} and dev means {latest, beta, dev}. Reading it as one tag
|
|
214
|
+
* gets a real case wrong: once 1.14.0 ships, `beta` still points at
|
|
215
|
+
* 1.14.0-beta.1 until the next prerelease is cut, and following that tag
|
|
216
|
+
* literally would walk a subscriber BACKWARDS onto a build their channel
|
|
217
|
+
* has already moved past.
|
|
218
|
+
*
|
|
219
|
+
* The nesting is also what makes a channel leavable. Going backwards is
|
|
220
|
+
* only ever offered when the user narrows the set — picking stable while a
|
|
221
|
+
* prerelease is installed drops `beta` out of it, so the answer becomes
|
|
222
|
+
* `latest` and the market can finally offer the way back. That case used to
|
|
223
|
+
* be unreachable: comparing 1.13.1 against an installed 1.14.0-beta.1 found
|
|
224
|
+
* nothing newer and answered "up to date", so the control the user had just
|
|
225
|
+
* used appeared to do nothing.
|
|
226
|
+
*
|
|
227
|
+
* @param stable - the `latest` version, already fetched by the caller.
|
|
228
|
+
*/
|
|
229
|
+
export declare function versionOnChannel(name: string, channel: Channel, stable: string | null): Promise<string | null>;
|
|
230
|
+
export declare function fetchNpmLatest(name: string): Promise<string | null>;
|
|
231
|
+
/**
|
|
232
|
+
* The newest build above `installed` that some tag other than `latest`
|
|
233
|
+
* points at, or null (#867).
|
|
234
|
+
*
|
|
235
|
+
* A fact about the registry, not a channel decision: this is what makes the
|
|
236
|
+
* difference visible to someone whose installed pin is ahead of `latest`
|
|
237
|
+
* without the market volunteering anyone's prerelease as an update.
|
|
238
|
+
*/
|
|
239
|
+
export declare function newerPrereleaseFor(name: string, installed: string | null): Promise<string | null>;
|
|
240
|
+
/** Per-plugin update checks; a failed check reports no update rather than failing the listing. */
|
|
241
|
+
export declare function checkUpdates(profile: string, force?: boolean, explicitDir?: string,
|
|
242
|
+
/**
|
|
243
|
+
* Packages that follow a release channel instead of plain `latest`. Only
|
|
244
|
+
* ever the market itself: opting into early builds is volunteering to try
|
|
245
|
+
* THIS plugin early, not a licence to pull every other author's
|
|
246
|
+
* unreleased work.
|
|
247
|
+
*/
|
|
248
|
+
channelFor?: ReadonlyMap<string, Channel>,
|
|
249
|
+
/**
|
|
250
|
+
* Curated npm sources for the installs that carry no registry spec of
|
|
251
|
+
* their own: `file:` packages matched to the market catalog (#429) and
|
|
252
|
+
* the generations the desktop host links in (#497). Any other `link:` is
|
|
253
|
+
* a development workspace and is never opted into online updates.
|
|
254
|
+
*/
|
|
255
|
+
onlineSourceFor?: ReadonlyMap<string, string>,
|
|
256
|
+
/**
|
|
257
|
+
* Registry names an archive-URL install may be checked against, keyed by
|
|
258
|
+
* the GitHub repo (`owner/repo`) the archive came from (#768). Without an
|
|
259
|
+
* entry that owns both the repo and the name, the npm fallback would
|
|
260
|
+
* compare the install with whatever package merely shares its name.
|
|
261
|
+
*/
|
|
262
|
+
catalogNpmByRepo?: ReadonlyMap<string, string>,
|
|
263
|
+
/**
|
|
264
|
+
* Hold back releases that this profile's `minimumReleaseAge` will refuse
|
|
265
|
+
* (#945). Only true where the install path has no bypass: the official
|
|
266
|
+
* Desktop's manager takes no pnpm options, while the CLI path retries once
|
|
267
|
+
* with `--config.minimum-release-age=0` and CAN install a young release.
|
|
268
|
+
* Hiding those on the CLI would suppress updates that work.
|
|
269
|
+
*/
|
|
270
|
+
options?: {
|
|
271
|
+
holdYoungReleases?: boolean;
|
|
272
|
+
releaseSources?: ReadonlyMap<string, CatalogReleaseSource>;
|
|
273
|
+
}): Promise<Record<string, UpdateStatus>>;
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-install activation verification (P0-2): what "installed" actually
|
|
3
|
+
* means for a package in a dsh profile.
|
|
4
|
+
*
|
|
5
|
+
* Two sources of truth, in strict order of authority:
|
|
6
|
+
*
|
|
7
|
+
* 1. The LOADER INVENTORY (observed): whatever the loader is running right
|
|
8
|
+
* now is live, full stop. A plain library with no `dsh` field can be
|
|
9
|
+
* loaded by name from someone else's bundle patch — the official
|
|
10
|
+
* dsh-base patch loads `@deepseek-ai/dsh-tools`, which has no `dsh`
|
|
11
|
+
* field at all — so no manifest check may overrule it (#135).
|
|
12
|
+
* 2. The profile manifest (inferred): `<profile>/package.json` →
|
|
13
|
+
* `dsh.profile.bundles`, what the dsh CLI reconciled. This predicts what
|
|
14
|
+
* the NEXT boot will load, and is the only evidence available for a
|
|
15
|
+
* package that is not currently running.
|
|
16
|
+
*
|
|
17
|
+
* State taxonomy (IMPROVEMENT-PLAN P0-2):
|
|
18
|
+
* live – running in the current composition (hot mount or loader entry)
|
|
19
|
+
* restart – installed and will activate on the next boot, but not live now
|
|
20
|
+
* incompatible – the host's own boot gate will skip it on EVERY boot: its
|
|
21
|
+
* dsh peer range excludes the running runtime (#757). Restarting
|
|
22
|
+
* can never activate it — "restart to apply" would be a lie.
|
|
23
|
+
* inert – installed but not a profile-layer plugin (plain dependency, or
|
|
24
|
+
* client-only — the market shim-mounts those at boot)
|
|
25
|
+
* broken – would fail to load: listed as a bundle without a dsh surface,
|
|
26
|
+
* or a declared entry artifact that is missing
|
|
27
|
+
* missing – not present in node_modules
|
|
28
|
+
*/
|
|
29
|
+
export type ActivationState = 'live' | 'restart' | 'incompatible' | 'inert' | 'broken' | 'failed' | 'missing' | 'disabled';
|
|
30
|
+
export interface ActivationResult {
|
|
31
|
+
state: ActivationState;
|
|
32
|
+
/** Bilingual, user-facing explanations (zh / en joined with " / "). */
|
|
33
|
+
reasons: string[];
|
|
34
|
+
/** True when the package is in the profile's `dsh.profile.bundles`. */
|
|
35
|
+
bundle: boolean;
|
|
36
|
+
/** True when the package is live in the running composition. */
|
|
37
|
+
hot: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The installed package that declares this one, when this package is a
|
|
40
|
+
* plain library somebody else pulled in rather than a plugin the user
|
|
41
|
+
* chose (#634). Only ever set on `inert`.
|
|
42
|
+
*/
|
|
43
|
+
dependencyOf?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Set on `inert` when the package's own bundle patch loads nothing but the
|
|
46
|
+
* user's own patch names it somewhere — an Agent preset's plugin row, say
|
|
47
|
+
* (#813). The market cannot see those trees, so it neither promises a
|
|
48
|
+
* restart nor calls the plugin off; it says where the plugin comes from.
|
|
49
|
+
*/
|
|
50
|
+
loadedByProfile?: true;
|
|
51
|
+
/** The package explicitly declares itself a library, without a plugin surface. */
|
|
52
|
+
library?: true;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Whether every bundle patch the package declares parses to an empty list.
|
|
56
|
+
*
|
|
57
|
+
* Such a bundle row loads nothing at boot: listing it in `dsh.profile.bundles`
|
|
58
|
+
* or taking it out changes nothing, so neither "restart to apply" nor the
|
|
59
|
+
* #696 "removed from bundles means off" inference applies to it (#813). A
|
|
60
|
+
* patch that is missing or unreadable is NOT empty — other verdicts own it.
|
|
61
|
+
*/
|
|
62
|
+
export declare function bundlePatchIsEmpty(packageDir: string): boolean;
|
|
63
|
+
interface PkgDsh {
|
|
64
|
+
bundle?: unknown;
|
|
65
|
+
client?: unknown;
|
|
66
|
+
kind?: unknown;
|
|
67
|
+
}
|
|
68
|
+
/** Manifest-only library declaration; observed loader activity can override its status. */
|
|
69
|
+
export declare function isDeclaredLibraryDsh(dsh: PkgDsh | null | undefined): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* What the running host is, for the #757 boot-gate prediction.
|
|
72
|
+
*
|
|
73
|
+
* The host loader (evaluatePluginCompatibility in @deepseek-ai/dsh-app-boot)
|
|
74
|
+
* semver-checks every bundle's `@deepseek-ai/dsh` / `@deepseek-ai/dsh-*`
|
|
75
|
+
* peerDependencies against the runtime version and silently SKIPS the
|
|
76
|
+
* bundles that fail — on every boot. From the market's side the bundle
|
|
77
|
+
* layer still declares the plugin while the loader inventory never shows
|
|
78
|
+
* it, so it reads exactly like "will activate on restart"… forever. A
|
|
79
|
+
* profile may carry a compatibility.json whose `pkg@version` keys list
|
|
80
|
+
* host versions allowed to load anyway (the host's
|
|
81
|
+
* readProfileVersionExemptions); the market mirrors both halves.
|
|
82
|
+
*/
|
|
83
|
+
export interface HostRuntimeFacts {
|
|
84
|
+
/** @deepseek-ai/dsh-app-boot version the host runs; null = unknown. */
|
|
85
|
+
runtimeVersion: string | null;
|
|
86
|
+
/** `pkg@version` → host versions allowed to load despite the range. */
|
|
87
|
+
exemptions: Record<string, readonly string[]>;
|
|
88
|
+
}
|
|
89
|
+
/** One dsh peer requirement the running host provably fails. */
|
|
90
|
+
export interface PeerGate {
|
|
91
|
+
peer: string;
|
|
92
|
+
range: string;
|
|
93
|
+
runtimeVersion: string;
|
|
94
|
+
/** True when the runtime sits BELOW the range's floor — upgrading the host can satisfy it (#758). */
|
|
95
|
+
hostTooOld: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Predict the host's boot gate for one installed package. Returns the first
|
|
99
|
+
* dsh peer the running runtime fails, or null when the next boot would load
|
|
100
|
+
* it — or when we cannot tell (unknown runtime, unparseable range), because
|
|
101
|
+
* uncertainty must keep the old verdict, not invent a harsher one (#757).
|
|
102
|
+
*
|
|
103
|
+
* satisfiesRange runs with includePrerelease — the host's own semantics,
|
|
104
|
+
* since every published host line is itself a prerelease — and an EMPTY
|
|
105
|
+
* range counts as failing, mirroring the host: absence of a requirement is
|
|
106
|
+
* not permission.
|
|
107
|
+
*
|
|
108
|
+
* Known differences from the host's verdict, kept deliberate (#758): the
|
|
109
|
+
* runtime version comes from the @deepseek-ai/dsh-app-boot package.json
|
|
110
|
+
* this tree can locate, not the host's self-reported getDshRuntimeVersion;
|
|
111
|
+
* when no host is locatable the gate stands aside and the real boot still
|
|
112
|
+
* applies its own. Exemptions mirror readProfileVersionExemptions from the
|
|
113
|
+
* profile's compatibility.json. The FIRST failing dsh peer decides, as the
|
|
114
|
+
* host's skip does — only the reported culprit may differ when several
|
|
115
|
+
* peers fail at once.
|
|
116
|
+
*/
|
|
117
|
+
export declare function hostPeerGate(activeProfileDir: string, name: string, facts: HostRuntimeFacts): PeerGate | null;
|
|
118
|
+
/** The way out of a peer gate, in the direction the versions allow (#758). */
|
|
119
|
+
export declare function peerGateRemedy(gate: PeerGate): {
|
|
120
|
+
zh: string;
|
|
121
|
+
en: string;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* The production HostRuntimeFacts: the discovered runtime version plus the
|
|
125
|
+
* profile's own exemption list. Re-read per call so an edited
|
|
126
|
+
* compatibility.json takes effect without a market restart.
|
|
127
|
+
*/
|
|
128
|
+
export declare function defaultHostRuntimeFacts(activeProfileDir: string): HostRuntimeFacts;
|
|
129
|
+
export declare function verifyActivation(profile: string, name: string, live?: ReadonlySet<string>, explicitDir?: string, isDisabled?: boolean, hostFacts?: HostRuntimeFacts, loaderObserved?: boolean,
|
|
130
|
+
/**
|
|
131
|
+
* The host's OWN row for this package exists and has no fiber (#1023).
|
|
132
|
+
* The loader creates an entry before it imports the module, so an entry
|
|
133
|
+
* that never got a fiber is a row the boot tried and did not activate —
|
|
134
|
+
* "restart to apply" would promise something the next start cannot deliver.
|
|
135
|
+
*/
|
|
136
|
+
loaderNeverStarted?: boolean): ActivationResult;
|
|
137
|
+
/**
|
|
138
|
+
* Correct a post-UPDATE verdict for a plugin that was already running.
|
|
139
|
+
*
|
|
140
|
+
* `verifyActivation` answers "is this name in the live loader inventory".
|
|
141
|
+
* That is the right question after an install and the wrong one after an
|
|
142
|
+
* update: the plugin was already live, so the answer stays "live" while the
|
|
143
|
+
* process keeps serving the module it imported at boot. Replacing files under
|
|
144
|
+
* a running composition does not re-import anything.
|
|
145
|
+
*
|
|
146
|
+
* Measured on a real host rather than reasoned about — updating the market
|
|
147
|
+
* from 1.11.3 to 1.12.2 left `/dsh-crate/status` reporting 1.11.3 with an
|
|
148
|
+
* unchanged boot id, while the update route called it hot-loaded in the same
|
|
149
|
+
* response. The browser half genuinely does refresh (the host re-serves the
|
|
150
|
+
* client bundle from disk), which is what makes the wrong verdict credible:
|
|
151
|
+
* the UI visibly becomes the new version while the server half does not.
|
|
152
|
+
*
|
|
153
|
+
* Only a plugin that was ALREADY live is affected. One that was missing,
|
|
154
|
+
* broken or disabled beforehand has nothing loaded to shadow the new build,
|
|
155
|
+
* so its fresh mount really does run the new code.
|
|
156
|
+
*
|
|
157
|
+
* Client-only packages are excluded for the same reason from the other end:
|
|
158
|
+
* they have no host half to go stale, and the browser fetches their bundle
|
|
159
|
+
* from disk on the next page load. Telling their users to restart would be
|
|
160
|
+
* #156 again, in a narrower place — see `hasHostHalf`.
|
|
161
|
+
* @param result the verdict computed from the loader inventory
|
|
162
|
+
* @param hostHalfWasLive whether a HOST half was live BEFORE the replacement
|
|
163
|
+
*/
|
|
164
|
+
export declare function activationAfterReplace(result: ActivationResult, hostHalfWasLive: boolean): ActivationResult;
|
|
165
|
+
/**
|
|
166
|
+
* Whether a package has a host (Node) half at all.
|
|
167
|
+
*
|
|
168
|
+
* A `dsh.client`-only package — themes, skins, most pure-UI plugins — runs
|
|
169
|
+
* no server code: the market shim-mounts it so the loader has a live row,
|
|
170
|
+
* and the browser re-fetches its bundle from disk on the next page load. An
|
|
171
|
+
* update to one takes effect on refresh, with no restart to ask for.
|
|
172
|
+
*/
|
|
173
|
+
export declare function hasHostHalf(profile: string, name: string, explicitDir?: string): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* The client bundle path a package's `exports["./client"]` names, relative
|
|
176
|
+
* to the package root — or `null` when it cannot be resolved CONFIDENTLY.
|
|
177
|
+
*
|
|
178
|
+
* Returning null is the important half. This feeds a post-install check
|
|
179
|
+
* whose only job is to catch a corrupt bundle, and a resolver that guessed
|
|
180
|
+
* wrong would report a healthy plugin as broken — worse than the silence it
|
|
181
|
+
* replaces. So every shape this does not fully understand resolves to null
|
|
182
|
+
* and the check simply does not run: unresolvable is not evidence of damage.
|
|
183
|
+
*
|
|
184
|
+
* Handles the two shapes real plugins ship: a plain string, and a
|
|
185
|
+
* conditional object. For the object, only `browser` and `default` are
|
|
186
|
+
* consulted — those are the conditions the host's client loader actually
|
|
187
|
+
* activates; `import`/`require` describe a Node resolution this file is not
|
|
188
|
+
* modelling, and picking one of those could name a different artifact.
|
|
189
|
+
* Nested conditions recurse; anything else (arrays, non-relative targets)
|
|
190
|
+
* gives up.
|
|
191
|
+
*/
|
|
192
|
+
export declare function clientBundlePath(exportsField: unknown, depth?: number): string | null;
|
|
193
|
+
/** What a bundle check concluded. `ok` covers "fine" AND "could not tell". */
|
|
194
|
+
export interface BundleCheck {
|
|
195
|
+
ok: boolean;
|
|
196
|
+
/** Populated only when the file was found AND failed to parse. */
|
|
197
|
+
reason: string | null;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Every namespace a client bundle asks its config from (#810).
|
|
201
|
+
*
|
|
202
|
+
* One level of constant propagation, as asked for in the report: the plugin
|
|
203
|
+
* that started this writes `var NAMESPACE = "dsh-comfyui-canvas"` and calls
|
|
204
|
+
* `configForms.get(NAMESPACE)`, so a literal-only scan would miss the very
|
|
205
|
+
* case the check exists for. A name assigned twice is dropped rather than
|
|
206
|
+
* guessed at — which value it holds at the call site is not decidable from
|
|
207
|
+
* text alone, and a wrong guess here would be reported as a plugin defect.
|
|
208
|
+
*/
|
|
209
|
+
export declare function configFormNamespaces(source: string): string[];
|
|
210
|
+
/** A package whose client asks for a namespace nothing in the composition serves (#810). */
|
|
211
|
+
export interface UnservedConfigNamespace {
|
|
212
|
+
/** The installed package whose client bundle asks. */
|
|
213
|
+
name: string;
|
|
214
|
+
/** The namespaces it asks for that no loader entry id answers to. */
|
|
215
|
+
namespaces: string[];
|
|
216
|
+
/** Entry ids this package's own patch declares — the value it meant. */
|
|
217
|
+
ownEntryIds: string[];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Installed plugins whose client reads its config from a name nothing serves
|
|
221
|
+
* (#810).
|
|
222
|
+
*
|
|
223
|
+
* `served` is the entry id set of the WHOLE composition — deliberately not
|
|
224
|
+
* this package's own ids: a package may legitimately mount another one
|
|
225
|
+
* (carrier form), and judging by own ids alone would flag those. `ownIdsOf`
|
|
226
|
+
* answers what the package itself declares, which is the value to write
|
|
227
|
+
* instead — the report asked for the correct spelling to be shown, not just
|
|
228
|
+
* the mistake.
|
|
229
|
+
*
|
|
230
|
+
* The scan reads one bundle per installed plugin. Measured against the same
|
|
231
|
+
* cost the syntax sweep above already pays (0.40ms per plugin on a 385KB
|
|
232
|
+
* bundle), so a 30-plugin profile is ~12ms — this runs on a request a user
|
|
233
|
+
* made, not in a loop.
|
|
234
|
+
*/
|
|
235
|
+
export declare function findUnservedConfigNamespaces(profile: string, served: ReadonlySet<string>, ownIdsOf: (name: string) => string[], explicitDir?: string): UnservedConfigNamespace[];
|
|
236
|
+
/**
|
|
237
|
+
* Every installed plugin whose client bundle will not parse (#222 by
|
|
238
|
+
* @MicroMilo).
|
|
239
|
+
*
|
|
240
|
+
* The per-package check above only ever looked at what an operation added,
|
|
241
|
+
* which misses the failure that was actually reported: pnpm re-extracts the
|
|
242
|
+
* WHOLE tree on any install, so updating one plugin can restore another
|
|
243
|
+
* plugin's pristine — and broken — bundle, or fail to re-apply a patch that
|
|
244
|
+
* was holding it together. The damage then surfaces at the next boot as
|
|
245
|
+
* "failed to load plugins", with nothing connecting it to the install that
|
|
246
|
+
* caused it.
|
|
247
|
+
*
|
|
248
|
+
* Cheap enough to run on every operation: 0.40ms per plugin including the
|
|
249
|
+
* read (measured on a 385KB bundle), so a 30-plugin profile costs ~12ms
|
|
250
|
+
* against an install that takes seconds.
|
|
251
|
+
*
|
|
252
|
+
* Silent on ESM bundles, like the per-package check it calls — see there for
|
|
253
|
+
* why. Widening the sweep is exactly what would have turned that one false
|
|
254
|
+
* "corrupt" into one per ESM plugin in the profile.
|
|
255
|
+
*
|
|
256
|
+
* Callers compare a before-list with an after-list rather than reporting
|
|
257
|
+
* this one directly — a profile can carry a broken bundle indefinitely, and
|
|
258
|
+
* re-reporting a problem the user already had would put them in front of
|
|
259
|
+
* something this operation did not cause and cannot undo.
|
|
260
|
+
*/
|
|
261
|
+
export declare function brokenClientBundles(profile: string, explicitDir?: string): {
|
|
262
|
+
name: string;
|
|
263
|
+
reason: string;
|
|
264
|
+
}[];
|
|
265
|
+
/** Bundles broken after an operation that were intact before it. */
|
|
266
|
+
export declare function newlyBrokenBundles(before: readonly {
|
|
267
|
+
name: string;
|
|
268
|
+
reason: string;
|
|
269
|
+
}[], after: readonly {
|
|
270
|
+
name: string;
|
|
271
|
+
reason: string;
|
|
272
|
+
}[]): {
|
|
273
|
+
name: string;
|
|
274
|
+
reason: string;
|
|
275
|
+
}[];
|
|
276
|
+
export declare function checkClientBundle(profile: string, name: string, explicitDir?: string): BundleCheck;
|
|
277
|
+
export {};
|