@deepseek-ai/dsh-plugin-manager 0.2.1-rc.5 → 0.2.2-alpha.3

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.
Files changed (41) hide show
  1. package/README.i18n.yaml +13 -10
  2. package/README.md +43 -8
  3. package/README.zh.md +43 -8
  4. package/lib/index.js +974 -139
  5. package/lib/typert.host.js +513 -55
  6. package/lib/typert.remote-client.d.ts +11 -1
  7. package/lib/typert.remote-client.js +411 -48
  8. package/lib/types/build-approval.d.ts +5 -5
  9. package/lib/types/build-approval.js +23 -10
  10. package/lib/types/bundle-detail.d.ts +40 -0
  11. package/lib/types/bundle-detail.js +85 -0
  12. package/lib/types/diagnostic.d.ts +17 -0
  13. package/lib/types/diagnostic.js +72 -0
  14. package/lib/types/git-transport.d.ts +27 -0
  15. package/lib/types/git-transport.js +65 -0
  16. package/lib/types/github-connection.d.ts +15 -3
  17. package/lib/types/github-connection.js +13 -3
  18. package/lib/types/index.d.ts +91 -2
  19. package/lib/types/index.js +530 -101
  20. package/lib/types/install-failure.js +1 -1
  21. package/lib/types/install-spec.d.ts +2 -0
  22. package/lib/types/install-spec.js +1 -1
  23. package/lib/types/operations.d.ts +5 -1
  24. package/lib/types/operations.js +31 -6
  25. package/lib/types/tools.js +5 -1
  26. package/lib/types/types.d.ts +169 -7
  27. package/lib/types/versions.d.ts +40 -0
  28. package/lib/types/versions.js +61 -0
  29. package/locale/de.json +6 -0
  30. package/locale/es.json +6 -0
  31. package/locale/fr.json +6 -0
  32. package/locale/ja.json +6 -0
  33. package/locale/pt.json +6 -0
  34. package/locale/ru.json +6 -0
  35. package/locale/tools/de.json +5 -0
  36. package/locale/tools/es.json +5 -0
  37. package/locale/tools/fr.json +5 -0
  38. package/locale/tools/ja.json +5 -0
  39. package/locale/tools/pt.json +5 -0
  40. package/locale/tools/ru.json +5 -0
  41. package/package.json +48 -34
@@ -6,7 +6,7 @@
6
6
  */
7
7
  /** Patterns in the order they decide: a specific code before the generic network family. */
8
8
  const LOG_KINDS = [
9
- ['build-blocked', /ERR_PNPM_IGNORED_BUILDS|Ignored build scripts/],
9
+ ['build-blocked', /ERR_PNPM_IGNORED_BUILDS|Ignored build scripts|ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED/],
10
10
  ['not-found', /ERR_PNPM_FETCH_404|\bE404\b|404 Not Found|Not Found - GET/],
11
11
  ['no-matching-version', /ERR_PNPM_NO_MATCHING_VERSION|\bETARGET\b|No matching version/],
12
12
  ['disk-full', /\bENOSPC\b|no space left on device/i],
@@ -47,6 +47,8 @@ export declare class InvalidInstallSpecError extends Error {
47
47
  * registry would refuse, or a URL that is neither a git host nor a tarball.
48
48
  */
49
49
  export declare function parseInstallSpec(raw: string): ParsedInstallSpec;
50
+ /** The user information of an http(s) URL, up to the last `@` before the path, which holds a password or access token when present. */
51
+ export declare const HTTP_USER_INFO: RegExp;
50
52
  /**
51
53
  * The spec `pnpm add` accepts for a dependency the profile manifest records. A git address, URL, or other
52
54
  * non-registry protocol is the recorded value without the user information of an http(s) URL, whose query string
@@ -88,7 +88,7 @@ export function parseInstallSpec(raw) {
88
88
  /** A recorded dependency value pnpm resolves outside a registry: a protocol other than a registry alias, or an scp-like git address. */
89
89
  const NON_REGISTRY_VALUE = /^(?!(?:npm|jsr|workspace|catalog):)[a-z][a-z0-9+.-]*:|^[^@/:\s]+@[^:/\s]+:/i;
90
90
  /** The user information of an http(s) URL, up to the last `@` before the path, which holds a password or access token when present. */
91
- const HTTP_USER_INFO = /^((?:git\+)?https?:\/\/)[^/]*@/i;
91
+ export const HTTP_USER_INFO = /^((?:git\+)?https?:\/\/)[^/]*@/i;
92
92
  /**
93
93
  * The spec `pnpm add` accepts for a dependency the profile manifest records. A git address, URL, or other
94
94
  * non-registry protocol is the recorded value without the user information of an http(s) URL, whose query string
@@ -62,6 +62,8 @@ export declare function saveManifest(dir: string, manifest: ProfileManifest): Pr
62
62
  * @param options Output, activation and cancellation policy.
63
63
  * @returns Exit status, whether the silence bound stopped the run, and the diagnostic path.
64
64
  * A compatibility denial returns exit code 1. Service output is bounded; CLI output uses inherited descriptors.
65
+ * Unsupported Host activation returns exit code 1 with named diagnostics; installed dependencies remain,
66
+ * and no bundle selection changes are saved. Other reconciliation or filesystem errors reject.
65
67
  * The diagnostic file is closed on return or rejection, including preparation and spawn failures.
66
68
  */
67
69
  export declare function runProfilePnpm(context: PackageOperationContext, args: readonly string[], options: PackageOperationOptions): Promise<PackageResult>;
@@ -97,6 +99,8 @@ export interface PackageViewOptions {
97
99
  timeoutMs: number;
98
100
  /** The registry asked; null asks the one pnpm's own configuration names. */
99
101
  registry?: Registry;
102
+ /** The manifest fields printed, as `pnpm view` names them; registry-only fields such as `versions`, `time`, and `dist-tags` included. */
103
+ fields: readonly string[];
100
104
  }
101
105
  /**
102
106
  * Read the registry pnpm's own configuration names in the profile: its `.npmrc` chain and workspace settings,
@@ -125,7 +129,7 @@ export declare function registryArguments(registry: Registry): string[];
125
129
  * configured after it are the retry.
126
130
  * @param dir Profile directory.
127
131
  * @param spec One registry spec: a package name with an optional range.
128
- * @param options The registry, cancellation, and the time bound.
132
+ * @param options The fields printed, the registry, cancellation, and the time bound.
129
133
  * @returns pnpm's exit, output, and how the lookup ended.
130
134
  */
131
135
  export declare function viewProfilePackage(dir: string, spec: string, options: PackageViewOptions): Promise<PackageViewResult>;
@@ -57,7 +57,8 @@ import { mkdir, mkdtemp, open, rm } from 'node:fs/promises';
57
57
  import { join, resolve } from 'node:path';
58
58
  import { execa } from 'execa';
59
59
  import { withFileLock, writeFileAtomic } from '@deepseek-ai/dsh-atomic-write';
60
- import { DEFAULT_PROFILE_BUNDLES, bundlePatchPaths, initProfile, PROFILE_TEMPLATES, readProfileManifest, resolveBundleDir, resolveProfileDir, loadOverlayPatches, composeEntries, readProfileVersionExemptions, evaluatePluginCompatibility, pluginCompatibilityWarning, } from '@deepseek-ai/dsh-app-boot';
60
+ import { assertBundlePlatform, UnsupportedBundlePlatformError, bundlePatchPaths, initProfile, readProfileManifest, resolveBundleDir, resolveProfileDir, loadOverlayPatches, composeEntries, readProfileVersionExemptions, evaluatePluginCompatibility, pluginCompatibilityWarning, } from '@deepseek-ai/dsh-app-boot';
61
+ import { PROFILE_TEMPLATES, DEFAULT_PROFILE_BUNDLES } from '@deepseek-ai/dsh-official-bundles';
61
62
  import { scrubbedParentEnv } from '@deepseek-ai/dsh-subprocess';
62
63
  import { parseInstallSpec } from "./install-spec.js";
63
64
  import { awaitTreeGone, leadsOwnGroup, treeAlive } from "./run-tree.js";
@@ -92,12 +93,13 @@ export function bundleManifest(name, dir, anchor) {
92
93
  export async function saveManifest(dir, manifest) {
93
94
  await writeFileAtomic(join(dir, 'package.json'), JSON.stringify(manifest, undefined, 2) + '\n', { mode: 0o600 });
94
95
  }
95
- /** Reconcile package removals and newly installed bundles without re-enabling retained dependencies. */
96
+ /** Reconcile bundle selection, returning platform denials without saving any selection changes. */
96
97
  async function reconcile(before, dir, anchor, options) {
97
98
  const after = readProfileManifest('dsh', dir);
98
99
  const dependencies = Object.keys(after.dependencies ?? {});
99
100
  const beforeDeps = new Set(Object.keys(before.dependencies ?? {}));
100
101
  const previous = after.dsh?.profile?.bundles ?? [];
102
+ const unsupported = [];
101
103
  const bundles = previous.filter((name) => {
102
104
  if (!beforeDeps.has(name) && !dependencies.includes(name))
103
105
  return true;
@@ -111,16 +113,28 @@ async function reconcile(before, dir, anchor, options) {
111
113
  options.onOutput?.(`dsh: warning: ${name} declares no dsh.bundle — installed as a plain dependency, not a profile layer\n`, 'stderr');
112
114
  continue;
113
115
  }
116
+ try {
117
+ assertBundlePlatform(metadata.dsh.bundle.platforms, process.platform);
118
+ }
119
+ catch (error) {
120
+ if (!(error instanceof UnsupportedBundlePlatformError))
121
+ throw error;
122
+ unsupported.push(`${name}: ${error.message}`);
123
+ continue;
124
+ }
114
125
  for (const file of bundlePatchPaths(resolveBundleDir('dsh', name, anchor, dir), metadata.dsh.bundle))
115
126
  loadOverlayPatches('dsh', file);
116
127
  if (!bundles.includes(name)) {
117
128
  bundles.push(name);
118
129
  }
119
130
  }
131
+ if (unsupported.length > 0)
132
+ return unsupported;
120
133
  if (JSON.stringify(previous) === JSON.stringify(bundles))
121
- return;
134
+ return [];
122
135
  after.dsh = { ...after.dsh, profile: { ...after.dsh?.profile, bundles } };
123
136
  await saveManifest(dir, after);
137
+ return [];
124
138
  }
125
139
  /**
126
140
  * How long the pipes keep draining after their process exited, as a fixed part of
@@ -294,6 +308,8 @@ function bundleComponentManifests(manifest, dir, anchor) {
294
308
  * @param options Output, activation and cancellation policy.
295
309
  * @returns Exit status, whether the silence bound stopped the run, and the diagnostic path.
296
310
  * A compatibility denial returns exit code 1. Service output is bounded; CLI output uses inherited descriptors.
311
+ * Unsupported Host activation returns exit code 1 with named diagnostics; installed dependencies remain,
312
+ * and no bundle selection changes are saved. Other reconciliation or filesystem errors reject.
297
313
  * The diagnostic file is closed on return or rejection, including preparation and spawn failures.
298
314
  */
299
315
  export async function runProfilePnpm(context, args, options) {
@@ -491,6 +507,8 @@ export async function runProfilePnpm(context, args, options) {
491
507
  if (result.failed && output.length === 0) {
492
508
  const diagnostic = result.shortMessage ?? 'pnpm failed';
493
509
  await log.write(diagnostic);
510
+ // The run printed nothing, so this diagnostic is the whole of its captured output; stream it as such.
511
+ options.onOutput?.(diagnostic, 'stderr');
494
512
  truncated = Buffer.byteLength(diagnostic) > options.outputBytes;
495
513
  output = Buffer.from(diagnostic).subarray(0, options.outputBytes);
496
514
  }
@@ -556,7 +574,14 @@ export async function runProfilePnpm(context, args, options) {
556
574
  append(Buffer.from(diagnostic));
557
575
  }
558
576
  else if (options.activateNewBundles !== false) {
559
- await reconcile(before, dir, context.installAnchor, options);
577
+ const unsupported = await reconcile(before, dir, context.installAnchor, options);
578
+ if (unsupported.length > 0) {
579
+ exitCode = 1;
580
+ const diagnostic = `\ndsh: bundle activation rejected: ${unsupported.join('\n')}\ndsh: installed dependencies remain; bundle selection is unchanged. Use a supported Host or remove the unwanted dependencies with 'dsh plugin remove <package>'.\n`;
581
+ await log.write(diagnostic);
582
+ options.onOutput?.(diagnostic, 'stderr');
583
+ append(Buffer.from(diagnostic));
584
+ }
560
585
  }
561
586
  }
562
587
  }
@@ -631,12 +656,12 @@ export function registryArguments(registry) {
631
656
  * configured after it are the retry.
632
657
  * @param dir Profile directory.
633
658
  * @param spec One registry spec: a package name with an optional range.
634
- * @param options The registry, cancellation, and the time bound.
659
+ * @param options The fields printed, the registry, cancellation, and the time bound.
635
660
  * @returns pnpm's exit, output, and how the lookup ended.
636
661
  */
637
662
  export async function viewProfilePackage(dir, spec, options) {
638
663
  const result = await execa(options.command ?? 'pnpm', [
639
- ...options.args ?? [], 'view', spec, 'name', 'version', 'description', 'dsh', '--json',
664
+ ...options.args ?? [], 'view', spec, ...options.fields, '--json',
640
665
  ...registryArguments(options.registry ?? null), '--config.fetch-retries=0',
641
666
  ], {
642
667
  cwd: dir, env: { ...scrubbedParentEnv(), ...options.env }, extendEnv: false, reject: false, stdin: 'ignore',
@@ -17,6 +17,7 @@ const ERROR_STEPS = {
17
17
  'bundle-in-use': 'Call list_plugins, disable the entries from other layers that still use this bundle, then retry.',
18
18
  'stale-approval': 'Call install_bundle again without approvedBuilds to read the current pendingBuilds.',
19
19
  'incompatible-version': 'Install a version compatible with the running DSH. A version exemption needs the user\'s explicit acceptance of crash and data-loss risk.',
20
+ 'unsupported-platform': 'This bundle cannot run on the current Host platform; ask the user to use a supported Host.',
20
21
  'operation-error': 'Report the diagnostic to the user; retry only after its cause is addressed.',
21
22
  };
22
23
  /** What the model does next for each package-manager failure. */
@@ -115,7 +116,10 @@ export function apply(ctx) {
115
116
  }
116
117
  const rows = args.action === 'list_plugins' ? await manager.listPlugins() : await manager.listBundles();
117
118
  const entries = rows.slice(offset, offset + limit).map(({ meta: _meta, ...row }) => 'rows' in row
118
- ? { ...row, rows: row.rows.map(({ meta: _rowMeta, ...declared }) => declared) }
119
+ // GUI listing and update eligibility do not change the tool's management operations.
120
+ ? (({ updatable: _updatable, listedByDefault: _listedByDefault, ...bundle }) => ({
121
+ ...bundle, rows: bundle.rows.map(({ meta: _rowMeta, ...declared }) => declared),
122
+ }))(row)
119
123
  : row);
120
124
  return JSON.stringify({ entries, total: rows.length,
121
125
  nextOffset: offset + entries.length < rows.length ? offset + entries.length : null });
@@ -4,6 +4,27 @@ import type { PluginLocalizedMeta } from '@deepseek-ai/dsh-package-manifest';
4
4
  import type { PluginInventoryEntry } from '@deepseek-ai/dsh-host-plugin-inventory/types';
5
5
  export type { PluginEntryId } from '@deepseek-ai/dsh-host-plugin-inventory/types';
6
6
  import type { PluginEntryId } from '@deepseek-ai/dsh-host-plugin-inventory/types';
7
+ import type { DetailFailureReason } from '@deepseek-ai/dsh-plugin-detail/types';
8
+ declare module '@deepseek-ai/dsh-typert-protocol' {
9
+ interface RemoteErrorDetailsMap {
10
+ /** The profile lists no such bundle, or its directory cannot be resolved. */
11
+ 'plugin-manager/unknown-bundle': {
12
+ readonly name: string;
13
+ };
14
+ /** The display language is not a BCP 47 language id. */
15
+ 'plugin-manager/invalid-language': {
16
+ readonly language: string;
17
+ };
18
+ /**
19
+ * A bundle's detail document or image exists but cannot be read: `too-large` beyond a size limit, `network` when the
20
+ * npm file CDNs cannot be reached, `invalid` for a malformed locale file or `meta.detail`, or a named file that does
21
+ * not exist. Bundle files come from local directories and public CDNs, which never answer `denied`.
22
+ */
23
+ 'plugin-manager/detail-unavailable': {
24
+ readonly reason: DetailFailureReason;
25
+ };
26
+ }
27
+ }
7
28
  /** Reasons a profile control cannot modify its target. */
8
29
  export type ReadOnlyReason = 'management-required' | 'unaddressable';
9
30
  /** A package whose declared DSH requirements reject the running DSH version, without an exemption for the exact pair. */
@@ -16,7 +37,7 @@ export interface IncompatiblePlugin {
16
37
  }
17
38
  /** Localizable management failure and optional external diagnostic. */
18
39
  export interface ManagementError {
19
- code: ReadOnlyReason | 'unknown-plugin' | 'invalid-spec' | 'already-installed' | 'ambiguous-install' | 'not-bundle' | 'not-removable' | 'stop-profile' | 'bundle-in-use' | 'stale-approval' | 'incompatible-version' | 'operation-error';
40
+ code: ReadOnlyReason | 'unknown-plugin' | 'invalid-spec' | 'already-installed' | 'ambiguous-install' | 'not-bundle' | 'not-removable' | 'stop-profile' | 'bundle-in-use' | 'stale-approval' | 'incompatible-version' | 'unsupported-platform' | 'operation-error';
20
41
  diagnostic?: string;
21
42
  /** Present with `incompatible-version`: the packages the running DSH version rejects. */
22
43
  incompatible?: IncompatiblePlugin[];
@@ -65,6 +86,8 @@ export interface BundleInfo {
65
86
  meta?: PluginLocalizedMeta;
66
87
  /** Untranslated `description` of this bundle's package manifest. */
67
88
  description?: string;
89
+ /** Default GUI visibility after package and Host checks; selected or profile-installed bundles remain manageable. */
90
+ listedByDefault?: boolean;
68
91
  /** Selected in the profile manifest; a load error means its layer was skipped. */
69
92
  enabled: boolean;
70
93
  /** Whether the profile declares this dependency; availability separately reports whether its files can be read. */
@@ -80,6 +103,11 @@ export interface BundleInfo {
80
103
  */
81
104
  optional: boolean;
82
105
  removable: boolean;
106
+ /**
107
+ * Whether `listVersions` and `updateBundle` accept the bundle: a third-party profile dependency saved as a registry
108
+ * spec under its own name, whose installed manifest declares a semver version, and that carries no plugin management.
109
+ */
110
+ updatable: boolean;
83
111
  readOnlyReason?: ReadOnlyReason;
84
112
  error?: ManagementError;
85
113
  /** The rows the bundle's patch inserts, in declaration order; empty when the patch cannot be read. */
@@ -100,13 +128,18 @@ export interface PluginRegistries {
100
128
  export type PluginInstallFailureKind = 'pnpm-missing' | 'timeout' | 'not-found' | 'no-matching-version' | 'network' | 'disk-full' | 'permission' | 'build-blocked' | 'integrity' | 'unknown';
101
129
  /** Package operation completion, including Git checks and a retrieval path for unabridged diagnostics. */
102
130
  export interface PackageResult {
131
+ /** The status the run is read as having ended with; a run the manager terminated records the coerced status 1. */
103
132
  exitCode: number;
104
133
  output: string;
105
134
  truncated: boolean;
106
135
  logPath: string;
107
136
  /** Present when the run failed: what kind of failure its exit and output describe. */
108
137
  kind?: PluginInstallFailureKind;
109
- /** The manager terminated the run after it printed nothing for its silence bound; `exitCode` still reports how it ended. */
138
+ /**
139
+ * The run outlived its bound: the manager terminated it after it printed nothing for its silence bound, or the GitHub
140
+ * connection check hit its deadline. Such a run reports no exit status of its own, so `exitCode` records the status
141
+ * its failure is read as rather than a status the process returned.
142
+ */
110
143
  timedOut?: boolean;
111
144
  /** Present when a compatibility check refused the run: the packages the running DSH version rejects. */
112
145
  incompatible?: IncompatiblePlugin[];
@@ -130,7 +163,7 @@ export interface ChangeResult {
130
163
  bundle?: string;
131
164
  /** The installed bundle's manifest version, when declared; pnpm's `minimumReleaseAge` can make it older than the newest release. */
132
165
  version?: string;
133
- /** Exact package names awaiting explicit script approval in the profile's pnpm settings, read after a failed run. */
166
+ /** Exact `allowBuilds` keys awaiting explicit script approval in the profile's pnpm settings, read after a failed run. */
134
167
  pendingBuilds?: string[];
135
168
  /** Package script permissions saved before this installation attempt. */
136
169
  approvedBuilds?: string[];
@@ -190,6 +223,81 @@ export type PluginSpecInspection = {
190
223
  /** The registries asked, in order, when the refusal came from asking them; `reason` is the last one's. */
191
224
  readonly registries?: Registry[];
192
225
  };
226
+ /** One registry a lookup asked, in order; the registry that answered carries no problem. */
227
+ export interface RegistryAttempt {
228
+ readonly registry: Registry;
229
+ /** Why this registry gave no usable answer; absent for the registry that answered. */
230
+ readonly problem?: 'not-found' | 'network' | 'unknown';
231
+ /** What pnpm or the registry said, verbatim. */
232
+ readonly reason?: string;
233
+ }
234
+ /** One published version newer than the installed one. */
235
+ export interface PluginVersion {
236
+ readonly version: string;
237
+ /** The registry's publication time, as an ISO 8601 string. */
238
+ readonly publishedAt?: string;
239
+ /** The dist-tags pointing at this version, such as `latest`. */
240
+ readonly tags: readonly string[];
241
+ /** Whether the version carries a semver prerelease suffix. */
242
+ readonly prerelease: boolean;
243
+ /** The registry's deprecation message, when the version is deprecated. */
244
+ readonly deprecated?: string;
245
+ /** Whether the version declares a `dsh.bundle`; a version that does not cannot replace a bundle. */
246
+ readonly bundle: boolean;
247
+ /** Present when the version's `engines.dsh` or DSH peers reject the running DSH version without an exemption for the exact pair. */
248
+ readonly incompatible?: IncompatiblePlugin;
249
+ }
250
+ /** The versions a registry offers for an installed registry package, read without changing the profile. */
251
+ export type PluginVersionList = {
252
+ readonly status: 'listed';
253
+ /** The installed version the list is newer than. */
254
+ readonly installed: string;
255
+ /** The registry that answered; an update installs from it. */
256
+ readonly registry: Registry;
257
+ readonly attempts: readonly RegistryAttempt[];
258
+ /** Published versions newer than `installed`, newest first, at most `versionListLimit` of them. */
259
+ readonly versions: readonly PluginVersion[];
260
+ /** Newer versions beyond `versionListLimit` that the list leaves out. */
261
+ readonly omitted: number;
262
+ } | {
263
+ readonly status: 'refused';
264
+ /** `not-updatable`: the package is not an installed profile dependency resolved from a registry. */
265
+ readonly problem: 'not-updatable' | 'not-found' | 'network' | 'unknown';
266
+ readonly reason: string;
267
+ /** The registries asked, in order; empty for `not-updatable`. */
268
+ readonly attempts: readonly RegistryAttempt[];
269
+ };
270
+ /** Where a version listing asks. */
271
+ export interface ListVersionsOptions {
272
+ /** The registry asked first; absent, the one this process last installed the package from, else the configured one. */
273
+ readonly registry?: Registry;
274
+ }
275
+ /** Where an update asks for its target, and the request id its progress names. */
276
+ export interface UpdateBundleOptions {
277
+ /** The registry asked first, normally the one that answered `listVersions`; absent, as for `listVersions`. */
278
+ readonly registry?: Registry;
279
+ /** Names the update's progress and the target installation's logs; `cancelInstall` stops only that installation. */
280
+ readonly requestId?: PluginInstallRequestId;
281
+ }
282
+ /** The step of an update its Host progress names. */
283
+ export type PluginUpdateStep = 'checking' | 'removing' | 'installing' | 'restoring';
284
+ /** Progress of one update request. */
285
+ export interface PluginUpdateProgress {
286
+ readonly requestId: PluginInstallRequestId;
287
+ readonly step: PluginUpdateStep;
288
+ }
289
+ /**
290
+ * How an update ended. `result` belongs to the last step that ran: the target check, the removal of the installed
291
+ * version, or the target's installation. `restore` is present when the target's installation failed or was cancelled
292
+ * after the installed version was removed, and reports the reinstallation of that version.
293
+ */
294
+ export interface PluginUpdateResult {
295
+ readonly from: string;
296
+ readonly to: string;
297
+ readonly step: 'check' | 'remove' | 'install';
298
+ readonly result: ChangeResult;
299
+ readonly restore?: ChangeResult;
300
+ }
193
301
  /** The Host phase of one installation, before its install call settles; `installing` is announced once per registry asked. */
194
302
  export interface PluginInstallProgress {
195
303
  readonly requestId: PluginInstallRequestId;
@@ -205,28 +313,75 @@ export interface PluginInstallProgress {
205
313
  export interface PluginInstallCancellation {
206
314
  readonly status: 'cancelled' | 'too-late' | 'not-running';
207
315
  }
208
- /** One chunk of a pnpm run's output, as the run produces it. */
316
+ /** One chunk of an installation run's output: a pnpm run, or the GitHub connection check that stopped it. */
209
317
  export interface PluginInstallLogChunk {
210
318
  /** The installation the run belongs to, when its caller supplied a request id. */
211
319
  readonly requestId?: PluginInstallRequestId;
212
320
  /** The run the chunk belongs to. */
213
321
  readonly jobId: string;
214
- /** The command line the run executes: pnpm's command name, then its arguments. */
322
+ /** The command line the run executes: its command name, then its arguments. */
215
323
  readonly argv: readonly string[];
216
324
  /** The directory the run executes in: the profile directory. */
217
325
  readonly cwd: string;
218
326
  readonly stream: 'stdout' | 'stderr';
219
327
  readonly text: string;
220
- /** Present on the run's last chunk: pnpm's exit code, null when it ended without one. */
328
+ /** Present on the chunk that ends a run: its exit code, null when the run ended without one. */
221
329
  readonly exitCode?: number | null;
222
330
  }
331
+ /**
332
+ * A bundle's long description, or `none` when it has neither a `meta.detail` file nor a README. Images resolve beside
333
+ * `path` through `GET /api/plugin-manager/detail-file?bundle=<name>&document=<path>&path=<destination>`.
334
+ */
335
+ export type BundleDetail = {
336
+ readonly status: 'found';
337
+ /** `locale` for the file locale `meta.detail` names, `readme` for the package's README. */
338
+ readonly origin: 'locale' | 'readme';
339
+ /** `/`-separated path of the document inside the package. */
340
+ readonly path: string;
341
+ /** Markdown text without a byte order mark or a leading YAML front matter block. */
342
+ readonly markdown: string;
343
+ } | {
344
+ readonly status: 'none';
345
+ };
223
346
  /** What changed in the profile, for consumers that show it. */
224
347
  export interface PluginChange {
225
348
  /** The operation that changed it. */
226
349
  readonly reason: 'plugin' | 'bundle' | 'install' | 'remove';
227
350
  }
351
+ /** Identifies one manager invocation, including time spent waiting for its profile lock. */
352
+ export type PluginOperationId = Branded<'PluginOperationId'>;
353
+ /** Management facts for diagnostic consumers; recent operations do not establish a crash's cause. */
354
+ export type PluginOperation = {
355
+ readonly id: PluginOperationId;
356
+ readonly time: string;
357
+ readonly reason: PluginChange['reason'];
358
+ /** Known entry id or parsed registry package name; unrecognized targets and raw specs are omitted. */
359
+ readonly target: string | null;
360
+ readonly stage: ChangeResult['stage'];
361
+ readonly enabled?: boolean | undefined;
362
+ /** Request-time or resolved package version; absence means unusable or unavailable, never the latest registry version. */
363
+ readonly version?: string | undefined;
364
+ } & ({
365
+ readonly phase: 'started';
366
+ } | {
367
+ readonly phase: 'settled';
368
+ readonly application: ChangeResult['application'];
369
+ readonly changed: boolean;
370
+ readonly errorCode?: ManagementError['code'] | undefined;
371
+ readonly restartReason?: RestartReason | undefined;
372
+ }
373
+ /** An exception escaped the operation result; persisted or applied changes cannot be inferred. */
374
+ | {
375
+ readonly phase: 'unknown';
376
+ });
228
377
  declare module '@deepseek-ai/cordis' {
229
378
  interface Events {
379
+ /**
380
+ * One manager invocation started or ended; subscribers run independently without delaying management.
381
+ * @mode parallel
382
+ * @param operation - Correlated operation facts; a start without an end has an unknown outcome.
383
+ */
384
+ 'plugin-manager/operation'(operation: PluginOperation): void | Promise<void>;
230
385
  /**
231
386
  * The profile's plugins, bundles, or composition changed: a manager
232
387
  * operation completed. A patch generation applied outside the manager,
@@ -236,7 +391,7 @@ declare module '@deepseek-ai/cordis' {
236
391
  */
237
392
  'plugin-manager/changed'(change: PluginChange): void;
238
393
  /**
239
- * One chunk of a pnpm run's output, streamed as the run produces it.
394
+ * One chunk of an installation run's output, streamed as the run produces it.
240
395
  * @mode emit
241
396
  * @param chunk - the chunk and the run it belongs to.
242
397
  */
@@ -248,6 +403,13 @@ declare module '@deepseek-ai/cordis' {
248
403
  * @param progress - the installation's request id and phase, with the attempt while installing.
249
404
  */
250
405
  'plugin-manager/install-state'(progress: PluginInstallProgress): void;
406
+ /**
407
+ * An update moved to its next step: checking the target, removing the installed version, installing the target,
408
+ * or reinstalling the removed version after the target failed. Announced once per step.
409
+ * @mode emit
410
+ * @param progress - the update's request id and step.
411
+ */
412
+ 'plugin-manager/update-state'(progress: PluginUpdateProgress): void;
251
413
  }
252
414
  }
253
415
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,40 @@
1
+ /** The fields a version listing prints for the package: every version, its publication times, and its dist-tags. */
2
+ export declare const VERSION_LIST_FIELDS: readonly ["versions", "time", "dist-tags"];
3
+ /** The fields read for one version: what decides whether it can replace an installed bundle. */
4
+ export declare const VERSION_FIELDS: readonly ["name", "version", "engines", "peerDependencies", "deprecated", "dsh"];
5
+ /** One published version newer than the installed one, before its own manifest is read. */
6
+ export interface PublishedVersion {
7
+ readonly version: string;
8
+ readonly publishedAt?: string;
9
+ readonly tags: readonly string[];
10
+ readonly prerelease: boolean;
11
+ }
12
+ /** What one version's manifest says about replacing an installed bundle. */
13
+ export interface VersionFacts {
14
+ /** The fields `evaluatePluginCompatibility` reads. */
15
+ readonly manifest: {
16
+ name: string;
17
+ version: string;
18
+ engines?: unknown;
19
+ peerDependencies?: unknown;
20
+ };
21
+ readonly bundle: boolean;
22
+ readonly deprecated?: string;
23
+ }
24
+ /**
25
+ * The published versions newer than the installed one, newest first.
26
+ * @param answer - parsed `pnpm view <name> versions time dist-tags --json` output.
27
+ * @param installed - the installed version.
28
+ * @returns the newer versions with their publication times and dist-tags.
29
+ * @throws when the answer names no versions.
30
+ */
31
+ export declare function newerVersions(answer: unknown, installed: string): PublishedVersion[];
32
+ /**
33
+ * What one exact version's manifest says, from `pnpm view <name>@<version> name version engines peerDependencies deprecated dsh --json`.
34
+ * @param answer - the parsed output.
35
+ * @param name - the package name, used when the answer omits it.
36
+ * @param version - the version asked for, used when the answer omits it.
37
+ * @returns the manifest fields compatibility reads, whether the version declares a bundle, and its deprecation message.
38
+ */
39
+ export declare function versionFacts(answer: unknown, name: string, version: string): VersionFacts;
40
+ //# sourceMappingURL=versions.d.ts.map
@@ -0,0 +1,61 @@
1
+ /** Read `pnpm view` answers about a package's published versions. */
2
+ import semver from 'semver';
3
+ /** The fields a version listing prints for the package: every version, its publication times, and its dist-tags. */
4
+ export const VERSION_LIST_FIELDS = ['versions', 'time', 'dist-tags'];
5
+ /** The fields read for one version: what decides whether it can replace an installed bundle. */
6
+ export const VERSION_FIELDS = ['name', 'version', 'engines', 'peerDependencies', 'deprecated', 'dsh'];
7
+ /** A JSON object, or undefined for anything else. */
8
+ function recordOf(value) {
9
+ return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : undefined;
10
+ }
11
+ /**
12
+ * The published versions newer than the installed one, newest first.
13
+ * @param answer - parsed `pnpm view <name> versions time dist-tags --json` output.
14
+ * @param installed - the installed version.
15
+ * @returns the newer versions with their publication times and dist-tags.
16
+ * @throws when the answer names no versions.
17
+ */
18
+ export function newerVersions(answer, installed) {
19
+ const fields = recordOf(answer);
20
+ // pnpm prints a package with one version as a string rather than a one-element array.
21
+ const listed = typeof fields?.versions === 'string' ? [fields.versions] : fields?.versions;
22
+ if (!Array.isArray(listed))
23
+ throw new Error('pnpm view answered no versions');
24
+ const time = recordOf(fields?.time) ?? {};
25
+ const tags = Object.entries(recordOf(fields?.['dist-tags']) ?? {});
26
+ return listed
27
+ .filter((version) => typeof version === 'string' && semver.valid(version) !== null && semver.gt(version, installed))
28
+ .sort(semver.rcompare)
29
+ .map((version) => {
30
+ const published = time[version];
31
+ return {
32
+ version,
33
+ ...typeof published === 'string' ? { publishedAt: published } : {},
34
+ tags: tags.filter(([, tagged]) => tagged === version).map(([tag]) => tag),
35
+ prerelease: semver.prerelease(version) !== null,
36
+ };
37
+ });
38
+ }
39
+ /**
40
+ * What one exact version's manifest says, from `pnpm view <name>@<version> name version engines peerDependencies deprecated dsh --json`.
41
+ * @param answer - the parsed output.
42
+ * @param name - the package name, used when the answer omits it.
43
+ * @param version - the version asked for, used when the answer omits it.
44
+ * @returns the manifest fields compatibility reads, whether the version declares a bundle, and its deprecation message.
45
+ */
46
+ export function versionFacts(answer, name, version) {
47
+ const fields = recordOf(answer) ?? {};
48
+ const dsh = recordOf(fields.dsh);
49
+ const deprecated = fields.deprecated;
50
+ return {
51
+ manifest: {
52
+ name: typeof fields.name === 'string' ? fields.name : name,
53
+ version: typeof fields.version === 'string' ? fields.version : version,
54
+ ...Object.hasOwn(fields, 'engines') ? { engines: fields.engines } : {},
55
+ ...Object.hasOwn(fields, 'peerDependencies') ? { peerDependencies: fields.peerDependencies } : {},
56
+ },
57
+ bundle: recordOf(dsh?.bundle) !== undefined,
58
+ ...typeof deprecated === 'string' && deprecated !== '' ? { deprecated } : {},
59
+ };
60
+ }
61
+ //# sourceMappingURL=versions.js.map
package/locale/de.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Plug-in-Verwaltungsdienst",
4
+ "description": "Verwalten Sie Plug-Ins und Plug-In-Pakete in der aktuell ausgeführten Konfiguration und unterstützen Sie Installation, Entfernung, Starten und Stoppen."
5
+ }
6
+ }
package/locale/es.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Servicio de gestión de complementos",
4
+ "description": "Administre complementos y paquetes de complementos en la configuración en ejecución actual, admitiendo la instalación, eliminación, inicio y detención."
5
+ }
6
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Service de gestion des plug-ins",
4
+ "description": "Gérez les plug-ins et les packages de plug-ins dans la configuration en cours d'exécution, prenant en charge l'installation, la suppression, le démarrage et l'arrêt."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "プラグイン管理サービス",
4
+ "description": "現在の実行設定にあるプラグインとパッケージを管理し、インストール、削除、有効化、無効化を行います。"
5
+ }
6
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Serviço de gerenciamento de plug-ins",
4
+ "description": "Gerencie plug-ins e pacotes de plug-ins na configuração atual em execução, oferecendo suporte à instalação, remoção, início e parada."
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Служба управления плагинами",
4
+ "description": "Управляйте плагинами и пакетами плагинов в текущей работающей конфигурации, поддерживая установку, удаление, запуск и остановку."
5
+ }
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Werkzeuge zur Plugin-Verwaltung"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Herramientas de gestión de plugins"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Outils de gestion des plugins"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "プラグイン管理ツール"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Ferramentas de gerenciamento de plug-ins"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Инструменты управления плагинами"
4
+ }
5
+ }