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,551 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile filesystem reads — everything the market learns from a dsh
|
|
3
|
+
* profile directory (manifest, lockfile, installed package trees). Pure
|
|
4
|
+
* functions of the directory contents; no processes, no network.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether a profile name follows DSH's own directory-name contract.
|
|
8
|
+
*
|
|
9
|
+
* Keep this aligned with `@deepseek-ai/dsh-app-boot`'s
|
|
10
|
+
* `resolveProfileDir`: dots, spaces, and Unicode are ordinary name
|
|
11
|
+
* characters; only empty, traversal-shaped, launcher-owned, or
|
|
12
|
+
* separator-bearing names are refused.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isDshProfileName(profile: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a profile name to its directory under DSH_HOME (default ~/.dsh).
|
|
17
|
+
* An explicit directory is used by hosts, such as DSH Desktop, that own the
|
|
18
|
+
* active profile location rather than deriving it from process environment.
|
|
19
|
+
*/
|
|
20
|
+
export declare function profileDir(profile: string, explicitDir?: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* The in-box bundles dsh's profile templates install themselves — the ONLY
|
|
23
|
+
* names the market hides from the installed list. Community plugins may
|
|
24
|
+
* legitimately publish under the official scope (#28), so a whole-scope
|
|
25
|
+
* filter would make them invisible and fail install validation.
|
|
26
|
+
* (Diagnosis and fix proposed in #28 by @Lograthmic.)
|
|
27
|
+
*/
|
|
28
|
+
export declare const INBOX_BUNDLES: Set<string>;
|
|
29
|
+
/** Community dependencies of the profile (in-box bundles filtered out). */
|
|
30
|
+
export declare function readInstalled(profile: string, explicitDir?: string): Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* Packages this profile's desktop host manages as generations (#874).
|
|
33
|
+
*
|
|
34
|
+
* DSH Desktop materialises such a plugin under
|
|
35
|
+
* `profiles/.generations/live/<name>+<version>+<hash>` and points the profile
|
|
36
|
+
* at it with a `link:` in `pnpm.overrides`, while `dependencies` keeps the
|
|
37
|
+
* plain version. Before IT runs pnpm, the host's own installer suspends that
|
|
38
|
+
* projection — the names leave `dependencies` / `overrides` for the duration
|
|
39
|
+
* of the run — and the profile's pnpm-lock.yaml therefore NEVER records them.
|
|
40
|
+
* That is by design, so a lockfile with no entry for the package is not
|
|
41
|
+
* evidence about its exact source, and reading it as if it were turned a
|
|
42
|
+
* completed rollback into "automatic rollback is unavailable" with advice the
|
|
43
|
+
* user cannot carry out (#874).
|
|
44
|
+
*
|
|
45
|
+
* Two declarations are accepted because either can stand alone: the
|
|
46
|
+
* generation link itself (in `dependencies` or in `pnpm.overrides`), and the
|
|
47
|
+
* host's own projection list (`dsh.desktop.generationProjection.plugins`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function generationManagedNames(profile: string, explicitDir?: string): Set<string>;
|
|
50
|
+
/**
|
|
51
|
+
* RAW dependency map of the profile manifest — including the in-box bundles
|
|
52
|
+
* readInstalled() filters out. This is the rollback snapshot (#65): restoring
|
|
53
|
+
* a filtered view would delete @deepseek-ai/dsh-base and friends.
|
|
54
|
+
*/
|
|
55
|
+
export declare function readManifestDeps(profile: string, explicitDir?: string): Record<string, string>;
|
|
56
|
+
/**
|
|
57
|
+
* For each installed package, the OTHER installed package that declares it —
|
|
58
|
+
* as a dependency, an optional dependency, or a peer dependency — in its own
|
|
59
|
+
* manifest.
|
|
60
|
+
*
|
|
61
|
+
* pnpm's auto-install-peers writes a plugin's peers into the profile manifest
|
|
62
|
+
* as direct dependencies, so a native binding a plugin needs shows up in the
|
|
63
|
+
* installed list looking exactly like a plugin the user chose (#634). What
|
|
64
|
+
* separates them is that somebody else asked for it. Optional dependencies
|
|
65
|
+
* count for the same reason (#941): a platform-specific binary a plugin lists
|
|
66
|
+
* under `optionalDependencies` is payload, not a plugin the user chose, even
|
|
67
|
+
* when pnpm installed that package and the card rendered.
|
|
68
|
+
*
|
|
69
|
+
* Ownership is decided by the first owner in sorted order, so the answer does
|
|
70
|
+
* not depend on the manifest's key order. A package that declares itself is
|
|
71
|
+
* ignored, and so is a cycle's other half once one owner is chosen.
|
|
72
|
+
*/
|
|
73
|
+
export declare function readDependencyOwners(profile: string, names: readonly string[], explicitDir?: string): Record<string, string>;
|
|
74
|
+
/** Exact rollback state owned by one profile package operation. */
|
|
75
|
+
export interface ProfileManifestSnapshot {
|
|
76
|
+
dependencies: Record<string, string>;
|
|
77
|
+
profileBundles: {
|
|
78
|
+
present: false;
|
|
79
|
+
} | {
|
|
80
|
+
present: true;
|
|
81
|
+
value: unknown;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Read dependencies and the exact `dsh.profile.bundles` field before a package operation. */
|
|
85
|
+
export declare function readProfileManifestSnapshot(profile: string, explicitDir?: string): ProfileManifestSnapshot;
|
|
86
|
+
/**
|
|
87
|
+
* Packages a package operation took out of `dsh.profile.bundles` while they are
|
|
88
|
+
* STILL declared in `dependencies` (#720).
|
|
89
|
+
*
|
|
90
|
+
* That combination is the quiet one. A package that is gone from both was
|
|
91
|
+
* uninstalled; a package in both is composed. A package that is still installed
|
|
92
|
+
* but no longer in the bundle list stays on disk, stays declared, and simply
|
|
93
|
+
* stops loading — the only trace is a boot warning about a dangling patch row
|
|
94
|
+
* (`patch: entry "better-sidebar" not found`), often days later.
|
|
95
|
+
*
|
|
96
|
+
* Pure and read-only on purpose. It does not put anything back: the bundle list
|
|
97
|
+
* is also how the official plugin page switches a package off (#696), so
|
|
98
|
+
* restoring "what was there before" would undo a deliberate removal. It only
|
|
99
|
+
* names what changed, so the next occurrence arrives with evidence — which
|
|
100
|
+
* operation, which package — instead of a user noticing the symptom later.
|
|
101
|
+
*
|
|
102
|
+
* Packages the operation itself touched (`except`) are excluded: removing one
|
|
103
|
+
* from the list is part of what that operation does.
|
|
104
|
+
*/
|
|
105
|
+
export declare function bundlesDroppedFromProfile(before: ProfileManifestSnapshot, profile: string, explicitDir: string | undefined, except?: ReadonlySet<string>): string[];
|
|
106
|
+
/**
|
|
107
|
+
* Restore the profile manifest fields a package operation may mutate:
|
|
108
|
+
* `dependencies` and `dsh.profile.bundles`. pnpm and `dsh plugin add` can
|
|
109
|
+
* write both before a later fetch or build-script failure (#65, #69, #339),
|
|
110
|
+
* leaving either an unresolvable dependency or a bundle the next boot cannot
|
|
111
|
+
* activate. Every unrelated manifest field remains untouched. The lockfile is
|
|
112
|
+
* left as-is; pnpm reconciles it from the manifest on the next run.
|
|
113
|
+
*
|
|
114
|
+
* The write is atomic because rollback runs after another operation already
|
|
115
|
+
* failed; a partial repair must not turn a valid profile into invalid JSON.
|
|
116
|
+
* @returns names whose entries were dropped or reverted, empty when nothing changed.
|
|
117
|
+
*/
|
|
118
|
+
export declare function restoreProfileManifest(profile: string, snapshot: ProfileManifestSnapshot, explicitDir?: string): string[];
|
|
119
|
+
/**
|
|
120
|
+
* Declare one dependency at an exact value, leaving every other manifest field
|
|
121
|
+
* alone.
|
|
122
|
+
*
|
|
123
|
+
* Needed for the duration of a package operation that has to be identifiable
|
|
124
|
+
* afterwards. DSH's desktop plugin manager names the package a run installed by
|
|
125
|
+
* diffing the manifest before and after pnpm; an operation whose specifier is
|
|
126
|
+
* byte-identical before and after leaves that diff empty, and its fallback only
|
|
127
|
+
* recognises a `name@…` spec — so a floating git re-resolve, which is sent as
|
|
128
|
+
* the bare remote URL, matches neither and fails as `ambiguous-install` after
|
|
129
|
+
* pnpm has already re-resolved and built the new commit.
|
|
130
|
+
*
|
|
131
|
+
* Declaring the package at the commit already on disk gives the diff exactly
|
|
132
|
+
* one entry, and pnpm writes the floating specifier back as it re-resolves, so
|
|
133
|
+
* the durable declaration is unchanged.
|
|
134
|
+
*
|
|
135
|
+
* The write is atomic, because it runs immediately before a package operation
|
|
136
|
+
* that may itself fail.
|
|
137
|
+
* @returns true when the declaration was written.
|
|
138
|
+
*/
|
|
139
|
+
export declare function declareProfileDependency(profile: string, name: string, value: string, explicitDir?: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Remove a package from BOTH manifest lists — dependencies and
|
|
142
|
+
* dsh.profile.bundles. The uninstall counterpart of restoreProfileManifest:
|
|
143
|
+
* pnpm can fail a remove after deleting node_modules but before saving
|
|
144
|
+
* package.json (the #65 write-order's mirror image — a file locked mid-
|
|
145
|
+
* unlink aborts the run), leaving the manifest pointing at a package that
|
|
146
|
+
* no longer exists on disk. The next boot then fails to activate the ghost
|
|
147
|
+
* dependency. When disk truth says the package is gone, this finishes the
|
|
148
|
+
* removal the CLI could not. Every other manifest field is untouched.
|
|
149
|
+
*
|
|
150
|
+
* Written atomically because it runs only after something already went wrong
|
|
151
|
+
* mid-uninstall, so it is the worst place to leave a half-written manifest.
|
|
152
|
+
* @returns true when either list still mentioned the package.
|
|
153
|
+
*/
|
|
154
|
+
export declare function dropFromManifest(profile: string, name: string, explicitDir?: string): boolean;
|
|
155
|
+
/** The version actually present in the profile's node_modules, or null. */
|
|
156
|
+
export declare function readInstalledVersion(profile: string, name: string, explicitDir?: string): string | null;
|
|
157
|
+
/**
|
|
158
|
+
* The `name` in the package.json of the directory a dependency is installed
|
|
159
|
+
* under, or null. DSH Desktop requires it to equal the dependency key (#694).
|
|
160
|
+
*/
|
|
161
|
+
export declare function readInstalledPackageName(profile: string, name: string, explicitDir?: string): string | null;
|
|
162
|
+
/** The installed package manifest, or null when absent or malformed. */
|
|
163
|
+
export declare function readInstalledManifest(profile: string, name: string, explicitDir?: string): unknown | null;
|
|
164
|
+
/**
|
|
165
|
+
* Whether a package or one of its direct dependencies (including
|
|
166
|
+
* optionalDependencies) ships a native addon.
|
|
167
|
+
*
|
|
168
|
+
* The question behind it: can unloading this plugin actually free its files?
|
|
169
|
+
* For ordinary JavaScript, yes — and on POSIX it does not even matter,
|
|
170
|
+
* because replacing an open file leaves the old inode to whoever holds it.
|
|
171
|
+
* For a native addon it is no on both counts: Node has no dlclose, so once a
|
|
172
|
+
* `.node` is loaded the process holds it until it exits. On Windows that
|
|
173
|
+
* turns "uninstall, then install again" into an EPERM on the rename, which
|
|
174
|
+
* is what @yandidan1 hit with node-hid (#441) — and no amount of disabling,
|
|
175
|
+
* unmounting or uninstalling from inside the running process can fix it.
|
|
176
|
+
*
|
|
177
|
+
* Deliberately a cheap structural check rather than a scan. Walking a
|
|
178
|
+
* dependency's tree for `*.node` means recursing through packages that can
|
|
179
|
+
* be tens of thousands of files, on the uninstall path, to answer a question
|
|
180
|
+
* three `existsSync` calls answer for every native module built or shipped
|
|
181
|
+
* the conventional way: node-gyp's `build/Release`, prebuild's `prebuilds/`,
|
|
182
|
+
* and the `binding.gyp` that names the addon in the first place.
|
|
183
|
+
*
|
|
184
|
+
* Direct `dependencies` and `optionalDependencies` are included because
|
|
185
|
+
* that is where these live: the plugin is JavaScript and the addon is a
|
|
186
|
+
* package it depends on, hoisted to the profile root beside it.
|
|
187
|
+
* optionalDependencies is the same kind of direct declaration —
|
|
188
|
+
* SinglePlayer ships node-hid there (#441), and asking only `dependencies`
|
|
189
|
+
* treated that uninstall as ordinary JavaScript.
|
|
190
|
+
* @param profile - profile name.
|
|
191
|
+
* @param name - the installed package to ask about.
|
|
192
|
+
* @param explicitDir - resolved profile directory, when the caller has it.
|
|
193
|
+
* @returns true when a native addon is present in the package or a direct (optional) dependency.
|
|
194
|
+
*/
|
|
195
|
+
export declare function holdsNativeAddon(profile: string, name: string, explicitDir?: string): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Strong repository identities for a locally linked dependency (#141).
|
|
198
|
+
* Explicit github: specs already carry this evidence; only link:/file: need
|
|
199
|
+
* filesystem discovery. This compatibility wrapper returns only declared
|
|
200
|
+
* package.json identities; Git origins are exposed separately as hints.
|
|
201
|
+
*/
|
|
202
|
+
export declare function readInstalledRepoIdentities(profile: string, name: string, spec: string, explicitDir?: string): string[];
|
|
203
|
+
export interface InstalledRepoEvidence {
|
|
204
|
+
identities: string[];
|
|
205
|
+
hints: string[];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Discover declared repository identities and weaker local-origin hints. A
|
|
209
|
+
* package.json repository declaration is authoritative; Git origin is only a
|
|
210
|
+
* disambiguation hint because a checkout may legitimately point at a fork.
|
|
211
|
+
*
|
|
212
|
+
* Read for local AND registry specs, but never for a spec that already names
|
|
213
|
+
* its own source (#544 by @QinYupan; boundary from @bulingbuling688 in #548).
|
|
214
|
+
*
|
|
215
|
+
* The bug: two same-named catalog entries and an ordinary npm install. The
|
|
216
|
+
* manifest's `repository` — `git+https://github.com/MrmoLabs/dsh-mermaid.git`
|
|
217
|
+
* — is the one fact that says WHICH of the two is installed, and it sits in
|
|
218
|
+
* the same package.json for an npm install as for a local one. This returned
|
|
219
|
+
* empty for anything not `link:`/`file:`, so the client fell back to name
|
|
220
|
+
* matching, found two candidates, and matched NEITHER: the Discover card kept
|
|
221
|
+
* offering Install on a plugin that was running.
|
|
222
|
+
*
|
|
223
|
+
* Why a `github:`/URL install must NOT be read the same way: its spec already
|
|
224
|
+
* states the source, and the manifest can disagree with it. A fork installed
|
|
225
|
+
* as `github:myfork/plugin` usually still declares the UPSTREAM repository,
|
|
226
|
+
* because almost nobody edits that field when forking. Adding it as an
|
|
227
|
+
* identity made the upstream's card read as installed — measured, and the
|
|
228
|
+
* same mistake as #485: a weaker signal allowed to outvote a definite one.
|
|
229
|
+
* The first version of this fix widened to every spec kind and had exactly
|
|
230
|
+
* that hole.
|
|
231
|
+
*
|
|
232
|
+
* What stays local-only for the same reason it always was: the git-origin
|
|
233
|
+
* hint (there is no checkout to read for a registry install) and the local
|
|
234
|
+
* source directory walk.
|
|
235
|
+
*/
|
|
236
|
+
export declare function readInstalledRepoEvidence(profile: string, name: string, spec: string, explicitDir?: string): InstalledRepoEvidence;
|
|
237
|
+
/**
|
|
238
|
+
* Pinned commit per `host/owner/repo` from the archive tarball URLs in the
|
|
239
|
+
* profile lockfile.
|
|
240
|
+
*
|
|
241
|
+
* Keyed by host, not by `owner/repo` alone: gitlab.com and bitbucket.org
|
|
242
|
+
* hand out the same short owner/repo names GitHub does, and an unqualified
|
|
243
|
+
* key would let one host's commit answer for a plugin installed from
|
|
244
|
+
* another — reporting a rollback or an update check against a repository
|
|
245
|
+
* the user never installed. `hostedRepoKey` builds the same key from a
|
|
246
|
+
* spec, and is how callers should look one up.
|
|
247
|
+
*/
|
|
248
|
+
export declare function readLockCommits(profile: string, explicitDir?: string): Map<string, string>;
|
|
249
|
+
/**
|
|
250
|
+
* Commit recorded for a non-codeload git resolution (`type: git` in pnpm's
|
|
251
|
+
* lockfile). Matched against the install spec so a Gitea/GitLab URL can
|
|
252
|
+
* compare HEAD without mistaking a same-named npm package (#525).
|
|
253
|
+
*
|
|
254
|
+
* Two packages of one monorepo resolve from the SAME remote and differ only
|
|
255
|
+
* by pnpm's `path:` selector, so the spec's subpath has to match too — and
|
|
256
|
+
* when the spec names no subpath while several entries of that remote do,
|
|
257
|
+
* there is no answer rather than the first sibling's commit (#632).
|
|
258
|
+
*
|
|
259
|
+
* The key on both sides of the comparison is `hostedRepoKey`, the identity
|
|
260
|
+
* the rest of the market already compares specs by (#851). This function
|
|
261
|
+
* used to derive its own, and that second spelling lost every install pnpm
|
|
262
|
+
* writes the shorthand back for: it demanded an `https?://` prefix or a
|
|
263
|
+
* `.git` suffix, so `github:owner/repo` keyed to nothing at all, and it kept
|
|
264
|
+
* the `.git` suffix, so the spec side `https://github.com/o/r` could never
|
|
265
|
+
* equal the lockfile side pnpm writes as `git@github.com:o/r.git`. A floating
|
|
266
|
+
* shorthand therefore had no commit, and with no commit the update route
|
|
267
|
+
* refuses to roll back — the market reports "cannot confirm the commit before
|
|
268
|
+
* the update" for a lockfile that states it plainly.
|
|
269
|
+
*/
|
|
270
|
+
export declare function readGitResolutionCommit(profile: string, spec: string, explicitDir?: string): string | null;
|
|
271
|
+
/** True when the installed package's manifest declares a dsh plugin surface. */
|
|
272
|
+
export declare function hasDshManifest(dir: string): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* True when the package's declared entry artifact actually exists — github
|
|
275
|
+
* source checkouts of build-required plugins ship no lib/, and promoting one
|
|
276
|
+
* into the bundle layer bricks the next boot (ERR_MODULE_NOT_FOUND kills the
|
|
277
|
+
* whole profile, #18).
|
|
278
|
+
*/
|
|
279
|
+
export declare function entryArtifactExists(dir: string): boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Package names a bundle patch mounts — the `name:` rows of the package's
|
|
282
|
+
* declared `dsh.bundle.patch` file. Line-wise on purpose: the strict
|
|
283
|
+
* hot-mount parser rejects config/expression rows, but for "what does this
|
|
284
|
+
* bundle bring in" any name row counts.
|
|
285
|
+
*/
|
|
286
|
+
export declare function bundlePatchTargets(dir: string): string[];
|
|
287
|
+
/**
|
|
288
|
+
* Loader entry ids a bundle patch inserts. Cordis refuses to boot a tree
|
|
289
|
+
* with a duplicate entry id ("duplicate loader entry id: storage", #122), so
|
|
290
|
+
* these are what two bundles can collide on.
|
|
291
|
+
*/
|
|
292
|
+
export declare function bundlePatchEntryIds(dir: string): string[];
|
|
293
|
+
/**
|
|
294
|
+
* Loader entry ids the patch INSERTS — the rows the package owns, as opposed
|
|
295
|
+
* to rows of OTHER plugins it merely configures (#147).
|
|
296
|
+
*
|
|
297
|
+
* A bundle patch has two kinds of entry:
|
|
298
|
+
*
|
|
299
|
+
* - insert: ← rows this package brings into the tree
|
|
300
|
+
* - id: vision-router
|
|
301
|
+
* name: dsh-vision-router
|
|
302
|
+
* - id: attachment-local ← someone else's row, only reconfigured
|
|
303
|
+
* config: { maxImageBytes: … }
|
|
304
|
+
*
|
|
305
|
+
* Treating both as "this package's rows" made disabling one plugin write
|
|
306
|
+
* `disabled: true` onto the official rows it tuned — killing attachments and
|
|
307
|
+
* the DeepSeek model with it.
|
|
308
|
+
*/
|
|
309
|
+
export declare function bundlePatchInsertedIds(dir: string): string[];
|
|
310
|
+
/**
|
|
311
|
+
* Row ids a package's OWN patch layer ships switched OFF — its opt-in rows.
|
|
312
|
+
*
|
|
313
|
+
* A bundle may ship rows `disabled: true` on purpose, and say so in a comment
|
|
314
|
+
* right there: dsh-mnemon's four `mnemon-strategy-*` rows are "opt-in" and
|
|
315
|
+
* "stay off until selected". A user patch layer repeating that same
|
|
316
|
+
* `disabled: true` therefore changes nothing about the package — but counting
|
|
317
|
+
* it as "the user turned this off" put 「已停用 / 重启后保持关闭」 on a card
|
|
318
|
+
* whose plugin was demonstrably running (#876). Layer order is the whole
|
|
319
|
+
* reason: the bundle's own default is the floor, and the market has to ask
|
|
320
|
+
* what the user did ABOVE it.
|
|
321
|
+
*
|
|
322
|
+
* Reads both patch sources like the other readers here — the declared
|
|
323
|
+
* `dsh.bundle.patch` (one file, or an ordered LIST, #792) and the
|
|
324
|
+
* conventional root cordis.patch.yml a package may ship instead.
|
|
325
|
+
*/
|
|
326
|
+
export declare function bundleOptOutRowIds(dir: string): string[];
|
|
327
|
+
/**
|
|
328
|
+
* Row ids a package's own patch sources decide with an EXPRESSION rather
|
|
329
|
+
* than a literal — `disabled: !!js …` (#1043). The bundle's default for
|
|
330
|
+
* these rows is whatever the condition evaluates to on the host that
|
|
331
|
+
* composes the profile, so no literal the market writes above the bundle
|
|
332
|
+
* layer can stand in for the user: force-writing `disabled: false` switches
|
|
333
|
+
* on a row the environment keeps off (a TUI row on a Desktop without the TUI
|
|
334
|
+
* services), which then holds the package pending at activation and fails
|
|
335
|
+
* the next install's check.
|
|
336
|
+
*
|
|
337
|
+
* Reads the same two patch sources as `bundleOptOutRowIds` above.
|
|
338
|
+
*/
|
|
339
|
+
export declare function bundleExpressionRowIds(dir: string): string[];
|
|
340
|
+
/**
|
|
341
|
+
* Row ids the installed copy of a package DECLARES it inserts (#1012).
|
|
342
|
+
*
|
|
343
|
+
* The evidence half of `rowIdsForPackage`: the same two patch sources (the
|
|
344
|
+
* declared `dsh.bundle.patch`, one file or an ordered list, and the
|
|
345
|
+
* conventional root `cordis.patch.yml`), insert rows only, and — unlike that
|
|
346
|
+
* reader — no live loader rows.
|
|
347
|
+
*
|
|
348
|
+
* Live rows are exactly what this cannot use. A rename transaction asks the
|
|
349
|
+
* question twice: of the old package just before it is removed (whose rows are
|
|
350
|
+
* still live, but whose patch files are about to be the only copy left) and of
|
|
351
|
+
* the new package right after its first install (which has never been booted,
|
|
352
|
+
* so the loader has never heard of it). Only the package's own declaration can
|
|
353
|
+
* answer for both.
|
|
354
|
+
*
|
|
355
|
+
* That is the same question, and the same parser, as `renamePredecessor` asks
|
|
356
|
+
* on the install path — an install never boots the package either, so it
|
|
357
|
+
* compares declarations too and the two refusals agree on what "one plugin"
|
|
358
|
+
* means (#1012). Where they differ is the root `cordis.patch.yml`: see
|
|
359
|
+
* `declaredPatchRowIds` for why this reader covers it and that gate's
|
|
360
|
+
* declared-only reader does not.
|
|
361
|
+
*/
|
|
362
|
+
export declare function shippedInsertedRowIds(dir: string): string[];
|
|
363
|
+
/**
|
|
364
|
+
* Rows of one patch file. Exported because a package may ship its patch at
|
|
365
|
+
* the conventional path INSTEAD of declaring `dsh.bundle.patch`, and the
|
|
366
|
+
* patch layer has to read that one by the same rules — a second hand-rolled
|
|
367
|
+
* scan drifted from this one and re-introduced #147 on that path (it closed
|
|
368
|
+
* the insert block only on `id:` lines, so `- disable:` followed by nested
|
|
369
|
+
* ids claimed the neighbour's rows).
|
|
370
|
+
*
|
|
371
|
+
* Line-wise on purpose: the strict hot-mount parser rejects config/expression
|
|
372
|
+
* rows, but for "what does this bundle bring in" any row counts. `insertedIds`
|
|
373
|
+
* is the subset under an `insert:` key (#147) — and "under `insert:`" is not
|
|
374
|
+
* the same as "deeper than it", because a row's `config:` carries its payload
|
|
375
|
+
* (#841). `expressionIds` (#1043) is the subset whose `disabled` is decided
|
|
376
|
+
* by an expression rather than a literal — a row the market must never
|
|
377
|
+
* answer with a literal of its own, because the host re-evaluates the
|
|
378
|
+
* condition on every compose and no user-layer value can stand in for it.
|
|
379
|
+
*/
|
|
380
|
+
export declare function parsePatchRows(text: string): {
|
|
381
|
+
names: string[];
|
|
382
|
+
ids: string[];
|
|
383
|
+
insertedIds: string[];
|
|
384
|
+
disabledIds: string[];
|
|
385
|
+
expressionIds: string[];
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Where a package's bundle patches live, according to the package itself.
|
|
389
|
+
*
|
|
390
|
+
* `dsh.bundle.patch` is the package's own declaration and the only place the
|
|
391
|
+
* answer is written down. The host accepts a string (one file) or an ordered
|
|
392
|
+
* array of files — official dsh-web-app ships five — and composes them in
|
|
393
|
+
* order (`bundlePatchFiles` in dsh-app-boot). The market's read side hands
|
|
394
|
+
* down no verdict, so an array contributes its string items in order and an
|
|
395
|
+
* unreadable manifest or a declaration that is neither string nor array
|
|
396
|
+
* answers none instead of throwing (#792) — the same tolerance check.ts's
|
|
397
|
+
* `declaredList` applies to the boot check (#676). The path may name a
|
|
398
|
+
* subdirectory (`aegis` declares `./extensions/dsh/cordis.patch.yml`), not
|
|
399
|
+
* just the package root — callers that assumed the root file made a plugin
|
|
400
|
+
* with a declared patch look like one with none (#646) — so the resolution
|
|
401
|
+
* rule lives here, once.
|
|
402
|
+
*
|
|
403
|
+
* @param dir - the installed package directory.
|
|
404
|
+
* @returns the declared patch files' paths in declaration order, empty when
|
|
405
|
+
* the manifest names none (or cannot be read).
|
|
406
|
+
*/
|
|
407
|
+
export declare function declaredBundlePatchFiles(dir: string): string[];
|
|
408
|
+
/** The profile manifest's `dsh.profile.bundles` — what the CLI reconciled. */
|
|
409
|
+
export declare function readProfileBundles(profileDirectory: string): string[];
|
|
410
|
+
/**
|
|
411
|
+
* Drop one bundle from the profile manifest's `dsh.profile.bundles`, leaving
|
|
412
|
+
* the package installed as a dependency. This is the carrier-bundle half of a
|
|
413
|
+
* toggle-off (#224): a bundle whose patch reconfigures plugins it does NOT own
|
|
414
|
+
* (dsh-postgres-backends disables session-persistence-jsonl and reroutes
|
|
415
|
+
* storage-domain) keeps applying those side-effect rows on every boot while it
|
|
416
|
+
* stays in the stack, and the #147 ownership rule deliberately never writes
|
|
417
|
+
* them — so removing the bundle from the stack is the only thing that stops
|
|
418
|
+
* them all at once. The package itself stays installed; enabling re-adds it.
|
|
419
|
+
* @returns true when the bundle was present and removed.
|
|
420
|
+
*/
|
|
421
|
+
export declare function removeProfileBundle(profileDirectory: string, name: string): boolean;
|
|
422
|
+
/**
|
|
423
|
+
* Re-add a bundle to `dsh.profile.bundles` after a carrier toggle-off (#224).
|
|
424
|
+
* Idempotent: a bundle already present is left untouched. The name is appended
|
|
425
|
+
* (the install flow appends too); the loader re-validates ordering on the next
|
|
426
|
+
* composition, so a declared before/after rule surfaces there rather than here.
|
|
427
|
+
* @returns true when the bundle was added, false when it was already present.
|
|
428
|
+
*/
|
|
429
|
+
export declare function addProfileBundle(profileDirectory: string, name: string): boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Loader entry ids a newly added package would collide on with bundles the
|
|
432
|
+
* profile ALREADY loads (#122).
|
|
433
|
+
*
|
|
434
|
+
* Cordis hard-fails the whole tree on a duplicate id, so this is not a
|
|
435
|
+
* cosmetic conflict: installing a TUI bundle into a web profile (both
|
|
436
|
+
* declare `id: storage`) leaves DSH unable to start at all, with an error
|
|
437
|
+
* naming neither plugin. Checked against the profile's own bundle list so a
|
|
438
|
+
* package is never compared with itself.
|
|
439
|
+
* @returns colliding ids mapped to the already-installed bundle that owns them.
|
|
440
|
+
*/
|
|
441
|
+
export declare function conflictingEntryIds(profileDirectory: string, candidate: string, installedBundles: readonly string[]): {
|
|
442
|
+
id: string;
|
|
443
|
+
owner: string;
|
|
444
|
+
}[];
|
|
445
|
+
/**
|
|
446
|
+
* Whether the loader has anything to load for this package: its own entry
|
|
447
|
+
* artifact, or — for CARRIER bundles — patch rows naming other packages that
|
|
448
|
+
* do have one.
|
|
449
|
+
*
|
|
450
|
+
* Carriers are why `entryArtifactExists` alone is the wrong test (#103):
|
|
451
|
+
* `@linxin666/dsh-skins` ships skin assets plus a patch mounting
|
|
452
|
+
* `@linxin666/dsh-client-ui-skin-center`, and declares no main/exports/
|
|
453
|
+
* index.js of its own. Judged by its own entry it looks like the
|
|
454
|
+
* source-only checkout the #18 guard removes — so the market both flagged it
|
|
455
|
+
* broken AND uninstalled it right after installing.
|
|
456
|
+
* @param profileDirectory - resolved profile directory (host-authoritative under Desktop).
|
|
457
|
+
* @param name - installed package name.
|
|
458
|
+
*/
|
|
459
|
+
export declare function hasLoadableEntry(profileDirectory: string, name: string, hostDirectory?: string | null): boolean;
|
|
460
|
+
/** Plugin subdirectories (depth 2) of a collection checkout, as relative paths. */
|
|
461
|
+
export declare function pluginSubdirs(root: string): string[];
|
|
462
|
+
/**
|
|
463
|
+
* Allow the given packages' build scripts in the profile's
|
|
464
|
+
* pnpm-workspace.yaml `allowBuilds` block (the key dsh profiles use),
|
|
465
|
+
* merging with existing entries and leaving the rest of the yaml intact.
|
|
466
|
+
* (#6 by @qichuang321.)
|
|
467
|
+
* @returns every package now allowed.
|
|
468
|
+
*/
|
|
469
|
+
export declare function setAllowBuilds(profile: string, packages: string[], explicitDir?: string): string[];
|
|
470
|
+
/**
|
|
471
|
+
* Remove the allowBuilds keys pnpm cannot parse as a version range, and say
|
|
472
|
+
* which (#698).
|
|
473
|
+
*
|
|
474
|
+
* pnpm reads an allowBuilds key as `name@<version union>`, and on 10.26 to
|
|
475
|
+
* the latest 10.x and on 11.0 to 11.5 a git or archive source there —
|
|
476
|
+
* `name@git+https://…`, `name@https://codeload…` — is rejected as
|
|
477
|
+
* "Invalid versions union … Use exact versions only". Not the one entry: the
|
|
478
|
+
* whole workspace file, so EVERY later pnpm command in the profile fails,
|
|
479
|
+
* including installs that have nothing to do with it. Measured on 9.15,
|
|
480
|
+
* 10.0 through 10.29, 11.0 through 11.8, 11.21 and 12.4; 10.25 and below
|
|
481
|
+
* ignore allowBuilds and 11.6 and above accept these keys.
|
|
482
|
+
*
|
|
483
|
+
* Those are exactly the keys the market writes for a git source (#68, #285,
|
|
484
|
+
* #637), because the pnpm versions that need them to authorize anything
|
|
485
|
+
* read them fine. On the versions in between, a bare name is what
|
|
486
|
+
* authorizes a git dependency — measured on 10.29 — and it is kept.
|
|
487
|
+
*
|
|
488
|
+
* @returns the keys removed; empty when nothing matched, in which case the
|
|
489
|
+
* file is left untouched.
|
|
490
|
+
*/
|
|
491
|
+
export declare function dropUnparseableBuildKeys(profile: string, explicitDir?: string): string[];
|
|
492
|
+
/**
|
|
493
|
+
* Make a profile's `minimumReleaseAgeExclude` readable again (#732).
|
|
494
|
+
*
|
|
495
|
+
* pnpm appends a second rule for a package that already has one, while its
|
|
496
|
+
* `evaluateVersionPolicy` honours only the FIRST rule per package name — so
|
|
497
|
+
* its own new entry is dead, the young version stays unexcluded, and every
|
|
498
|
+
* later command in that profile fails lockfile verification with
|
|
499
|
+
* ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION, including commands that have nothing
|
|
500
|
+
* to do with that package.
|
|
501
|
+
*
|
|
502
|
+
* (#733 reported a separate, unexplained 80 GiB allocation abort on pnpm
|
|
503
|
+
* 12.4.1 that its author first tied to the union spelling. Review on that
|
|
504
|
+
* issue — and the reporter's own follow-up, which could no longer reproduce it
|
|
505
|
+
* — settled that `name@a || b` is a documented pnpm form, that the validator's
|
|
506
|
+
* "Use exact versions only" is about ranges and name patterns, and that the
|
|
507
|
+
* abort is not this market's to fix. Do not "repair" a union into a bare name
|
|
508
|
+
* on the strength of it: see below.)
|
|
509
|
+
*
|
|
510
|
+
* pnpm WRITES this key itself, and one of the forms it writes is what breaks a
|
|
511
|
+
* profile (#732): pnpm 11.7.0 APPENDS a second rule for a package that already
|
|
512
|
+
* has one, while its `evaluateVersionPolicy` honours only the FIRST rule per
|
|
513
|
+
* package name. Its own new entry is therefore dead, the young version stays
|
|
514
|
+
* unexcluded, and every later command in that profile fails lockfile
|
|
515
|
+
* verification with ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION — installs, updates
|
|
516
|
+
* and uninstalls alike, including ones that have nothing to do with that
|
|
517
|
+
* package. Merging the same-name rules into one makes the file readable again.
|
|
518
|
+
*
|
|
519
|
+
* The merge keeps the UNION of the versions the file already lists
|
|
520
|
+
* (`name@1.2.3 || 1.4.0`), which is a documented pnpm spelling. What this
|
|
521
|
+
* deliberately does NOT do is collapse a version list to a bare package name:
|
|
522
|
+
* a bare name exempts EVERY version of that package from the cooldown, which
|
|
523
|
+
* is wider than what the file says, and the market pins exact versions
|
|
524
|
+
* precisely so a fresh install cannot silently land on an older release
|
|
525
|
+
* (#594). A form the file cannot be read exactly from is left alone.
|
|
526
|
+
*
|
|
527
|
+
* @returns the package names whose rules were merged; empty when the file
|
|
528
|
+
* needed no repair or could not be repaired, in which case it is left
|
|
529
|
+
* byte-for-byte as it was.
|
|
530
|
+
*/
|
|
531
|
+
/**
|
|
532
|
+
* Remove one package's `minimumReleaseAgeExclude` rows (#1093).
|
|
533
|
+
*
|
|
534
|
+
* pnpm writes this key itself when it installs a version still inside the
|
|
535
|
+
* fresh-release wait, and it writes one row for the package plus one per
|
|
536
|
+
* platform subpackage. Uninstalling took the dependency out of the manifest
|
|
537
|
+
* and the lockfile but left those rows behind, pinned to versions of a package
|
|
538
|
+
* the profile no longer has. They are not only noise: they read as live policy
|
|
539
|
+
* to anyone diagnosing a release-age refusal months later.
|
|
540
|
+
*
|
|
541
|
+
* Only rows naming this package are dropped. A platform subpackage
|
|
542
|
+
* (`@typescript/typescript-darwin-arm64`) is a DIFFERENT package name, and
|
|
543
|
+
* nothing in the file says which main package it belongs to — guessing would
|
|
544
|
+
* delete policy that may still be in effect for something installed.
|
|
545
|
+
*
|
|
546
|
+
* @returns the entries removed, for the caller to log; empty when there is no
|
|
547
|
+
* such block, no such row, or the file cannot be read exactly (in which case
|
|
548
|
+
* it is left byte-for-byte as it was).
|
|
549
|
+
*/
|
|
550
|
+
export declare function dropReleaseAgeExcludes(profile: string, name: string, explicitDir?: string): string[];
|
|
551
|
+
export declare function mergeDuplicateReleaseAgeExcludes(profile: string, explicitDir?: string): string[];
|