@deepseek-ai/dsh-app-boot 0.1.6-alpha.2 → 0.1.7-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +32 -13
- package/README.zh.md +32 -13
- package/lib/index.js +1647 -681
- package/lib/types/config-schema/collect.d.ts +16 -0
- package/lib/types/config-schema/document.d.ts +13 -0
- package/lib/types/config-schema/index.d.ts +20 -0
- package/lib/types/config-schema/native.d.ts +9 -0
- package/lib/types/config-schema/pattern.d.ts +8 -0
- package/lib/types/config-schema/projector.d.ts +20 -0
- package/lib/types/config-schema/types.d.ts +95 -0
- package/lib/types/index.d.ts +13 -1
- package/lib/types/package-meta.d.ts +25 -0
- package/lib/types/profile-resolution/legacy-links.d.ts +1 -28
- package/lib/types/profile-resolution/resolver.d.ts +18 -19
- package/lib/types/profile-resolution/service.d.ts +17 -12
- package/lib/types/profile-resolution/worker-bootstrap.d.ts +1 -1
- package/lib/types/profile.d.ts +71 -63
- package/lib/worker/profile-resolution-bootstrap.js +255 -357
- package/package.json +20 -18
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Boot-free inspection of declared plugin Config schemas using profile module resolution. */
|
|
2
|
+
import type { Profile, RuntimeResolution } from '../profile.ts';
|
|
3
|
+
import type { ConfigSchemaDiagnostic, ConfigSchemaDump } from './types.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Generate JSON Schema from parsed entry rows and root-tree patches without applying plugins or evaluating expressions.
|
|
6
|
+
* Imports, Config getters, and lazy schema builders execute trusted plugin code; transform callbacks do not. Calls must not overlap
|
|
7
|
+
* another profile-resolution interception; module imports remain cached after the interception is released.
|
|
8
|
+
* @param profile - prepared profile whose directory anchors root module and include resolution.
|
|
9
|
+
* @param entries - unvalidated rows from profile composition; malformed rows become positioned diagnostics without losing siblings.
|
|
10
|
+
* @param resolution - the same immutable package resolution used for profile boot.
|
|
11
|
+
* @param diagnostics - existing composition diagnostics; copied into the returned catalog.
|
|
12
|
+
* @returns a JSON Schema document with partial-result diagnostics and Config references under `x-cordis`.
|
|
13
|
+
* @throws when Node's profile module resolution cannot be installed.
|
|
14
|
+
*/
|
|
15
|
+
export declare function collectConfigSchemas(profile: Profile, entries: readonly unknown[], resolution: RuntimeResolution, diagnostics?: readonly ConfigSchemaDiagnostic[]): Promise<ConfigSchemaDump>;
|
|
16
|
+
//# sourceMappingURL=collect.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Compose Loader entry/patch structure and discovered plugin input schemas into one JSON Schema document. */
|
|
2
|
+
import type { CollectedConfigEntry, ConfigSchemaDiagnostic, ConfigSchemaDump } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Build a schema for the composed entry list and a separately addressable root-tree patch list.
|
|
5
|
+
* Unknown plugin names remain open; only collected schemas supply plugin-specific constraints.
|
|
6
|
+
* @param profile - selected profile name.
|
|
7
|
+
* @param collected - declarations discovered without mounting plugins, including include descendants.
|
|
8
|
+
* @param targets - last-id-wins patch targets from the root tree's patch index, excluding include descendants.
|
|
9
|
+
* @param initialDiagnostics - composition and import diagnostics already collected.
|
|
10
|
+
* @returns one JSON Schema document with explicit collection and projection annotations.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildConfigSchemaDocument(profile: string, collected: readonly CollectedConfigEntry[], targets: ReadonlyMap<string, CollectedConfigEntry>, initialDiagnostics: readonly ConfigSchemaDiagnostic[]): Promise<ConfigSchemaDump>;
|
|
13
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Profile schema generation: composition diagnostics, runtime resolution, and boot-free discovery. */
|
|
2
|
+
import type { PatchOptions } from '@deepseek-ai/cordis-plugin-include';
|
|
3
|
+
import { type Profile } from '../profile.ts';
|
|
4
|
+
import type { ConfigSchemaDump } from './types.ts';
|
|
5
|
+
export type { ConfigSchemaDump, NativeConfigSchema } from './types.ts';
|
|
6
|
+
/**
|
|
7
|
+
* Generate JSON Schema for a prepared profile's ordered patch layers without mounting plugins or evaluating expressions.
|
|
8
|
+
* Reads the profile manifest; imports, Config getters, and lazy builders execute trusted code. Native validators and
|
|
9
|
+
* transform callbacks are not executed. Calls must not overlap another profile-resolution interception; collection
|
|
10
|
+
* releases its interception on success or rejection, while Node retains imported modules. Supplied layers are not mutated.
|
|
11
|
+
* Profile preparation, layer selection, process streams, and exit policy belong to the caller.
|
|
12
|
+
* @param binName - the diagnostic prefix on thrown manifest errors.
|
|
13
|
+
* @param profile - prepared on-disk profile whose directory anchors root module and include resolution.
|
|
14
|
+
* @param layers - already parsed patch lists in application order, including caller-selected home and argv overlays.
|
|
15
|
+
* @param installAnchor - package manifest anchoring the installation's runtime dependencies.
|
|
16
|
+
* @returns a JSON Schema document with declaration references, partial results, and diagnostics under `x-cordis`.
|
|
17
|
+
* @throws when profile metadata, composition, or runtime resolution cannot be prepared.
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateConfigSchema(binName: string, profile: Profile, layers: readonly PatchOptions[][], installAnchor: string): Promise<ConfigSchemaDump>;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Identity checks at the plugin-export and lazy-builder boundaries. */
|
|
2
|
+
import type { NativeConfigSchema } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Recognize the native Schemastery graph protocol without invoking a validator or serialization hook.
|
|
5
|
+
* @param value - plugin Config export or lazy-builder result.
|
|
6
|
+
* @returns whether native schema fields can be inspected.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isNativeConfigSchema(value: unknown): value is NativeConfigSchema;
|
|
9
|
+
//# sourceMappingURL=native.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Conservative compatibility checks between native RegExp validation and Unicode JSON Schema patterns. */
|
|
2
|
+
/**
|
|
3
|
+
* Create a checker for patterns that can retain native acceptance under Unicode regex semantics.
|
|
4
|
+
* Unrecognized flagless syntax stays explicitly partial rather than becoming a misleading constraint.
|
|
5
|
+
* @returns the compatibility predicate; parsing never executes the regular expression against config values.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createPatternCheck(): Promise<(source: string, flags?: string) => boolean>;
|
|
8
|
+
//# sourceMappingURL=pattern.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Project native Config input constraints without executing their validators or transform callbacks. */
|
|
2
|
+
import type { ConfigJsonSchema, ConfigJsonSchemaObject, NativeConfigSchema } from './types.ts';
|
|
3
|
+
/** Definition that projected value positions reference as `#/$defs/loaderExpression`; an enclosing document must define it. */
|
|
4
|
+
export declare const LOADER_EXPRESSION_SCHEMA: ConfigJsonSchemaObject;
|
|
5
|
+
/** One Config projection; unknown omission behavior is explicit rather than an invented default. */
|
|
6
|
+
export interface ConfigProjection {
|
|
7
|
+
/** Object-form root: value positions are wrapped in `anyOf` with the loader-expression reference. */
|
|
8
|
+
schema: ConfigJsonSchemaObject;
|
|
9
|
+
definitions: Record<string, ConfigJsonSchema>;
|
|
10
|
+
acceptsMissing: boolean | 'unknown';
|
|
11
|
+
limitations: string[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create an invocation-local projector. Ajv checks only literal defaults against generated schemas;
|
|
15
|
+
* it does not fill defaults, coerce input, or call native plugin validators. Opaque input or metadata effects
|
|
16
|
+
* widen validation with explicit limitations instead of simulating native mutation.
|
|
17
|
+
* @returns a function projecting one trusted native Config graph into the enclosing document's definitions.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createConfigProjector(): Promise<(root: NativeConfigSchema, prefix: string) => ConfigProjection>;
|
|
20
|
+
//# sourceMappingURL=projector.d.ts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/** JSON Schema output and native graph inputs for boot-free configuration inspection. */
|
|
2
|
+
/** JSON Schema 2020-12, including annotations that standard validators may ignore. */
|
|
3
|
+
export type ConfigJsonSchema = boolean | ConfigJsonSchemaObject;
|
|
4
|
+
/** Object-form JSON Schema; vocabulary extensions are annotations, not executable validators. */
|
|
5
|
+
export interface ConfigJsonSchemaObject {
|
|
6
|
+
[keyword: string]: unknown;
|
|
7
|
+
$schema?: string;
|
|
8
|
+
$ref?: string;
|
|
9
|
+
$defs?: Record<string, ConfigJsonSchema>;
|
|
10
|
+
type?: string | string[];
|
|
11
|
+
properties?: Record<string, ConfigJsonSchema>;
|
|
12
|
+
required?: string[];
|
|
13
|
+
items?: ConfigJsonSchema;
|
|
14
|
+
prefixItems?: ConfigJsonSchema[];
|
|
15
|
+
additionalProperties?: ConfigJsonSchema;
|
|
16
|
+
propertyNames?: ConfigJsonSchema;
|
|
17
|
+
anyOf?: ConfigJsonSchema[];
|
|
18
|
+
allOf?: ConfigJsonSchema[];
|
|
19
|
+
not?: ConfigJsonSchema;
|
|
20
|
+
if?: ConfigJsonSchema;
|
|
21
|
+
then?: ConfigJsonSchema;
|
|
22
|
+
default?: unknown;
|
|
23
|
+
description?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A collection or projection diagnostic, without independently collected config values. */
|
|
26
|
+
export interface ConfigSchemaDiagnostic {
|
|
27
|
+
level: 'warning' | 'error';
|
|
28
|
+
/** Structural position in the discovered entry tree, when applicable. */
|
|
29
|
+
path?: string;
|
|
30
|
+
message: string;
|
|
31
|
+
}
|
|
32
|
+
/** One declared entry and its generated Config reference; include paths describe discovery, not root JSON pointers. */
|
|
33
|
+
export interface ConfigSchemaEntry {
|
|
34
|
+
path: string;
|
|
35
|
+
id?: string;
|
|
36
|
+
/** Omitted when a malformed row has no literal plugin name. */
|
|
37
|
+
name?: string;
|
|
38
|
+
status: 'schema' | 'partial' | 'absent' | 'unsupported' | 'error';
|
|
39
|
+
configRef?: string;
|
|
40
|
+
/** Native Loader carrier, whose config is not interpolated as an ordinary plugin config. */
|
|
41
|
+
tree?: 'group' | 'include';
|
|
42
|
+
}
|
|
43
|
+
/** JSON Schema for a composed entry list; `$defs.patchList` describes profile overlays. */
|
|
44
|
+
export interface ConfigSchemaDump extends ConfigJsonSchemaObject {
|
|
45
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema';
|
|
46
|
+
$defs: Record<string, ConfigJsonSchema>;
|
|
47
|
+
'x-cordis': {
|
|
48
|
+
profile: string;
|
|
49
|
+
/** False for error diagnostics, partial/unsupported/error entries, or ambiguous plugin-name schemas; includes disabled declarations. */
|
|
50
|
+
complete: boolean;
|
|
51
|
+
entries: ConfigSchemaEntry[];
|
|
52
|
+
diagnostics: ConfigSchemaDiagnostic[];
|
|
53
|
+
patchSchema: '#/$defs/patchList';
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Native Schemastery graph protocol after its identity marker has been checked. */
|
|
57
|
+
export interface NativeConfigSchema {
|
|
58
|
+
type: string;
|
|
59
|
+
meta: {
|
|
60
|
+
role?: string;
|
|
61
|
+
extra?: unknown;
|
|
62
|
+
hidden?: boolean;
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
collapse?: boolean;
|
|
65
|
+
link?: string;
|
|
66
|
+
comment?: string;
|
|
67
|
+
badges?: {
|
|
68
|
+
text: string;
|
|
69
|
+
type: string;
|
|
70
|
+
}[];
|
|
71
|
+
required?: boolean;
|
|
72
|
+
volatile?: boolean;
|
|
73
|
+
default?: unknown;
|
|
74
|
+
min?: number;
|
|
75
|
+
max?: number;
|
|
76
|
+
step?: number;
|
|
77
|
+
pattern?: {
|
|
78
|
+
source: string;
|
|
79
|
+
flags?: string;
|
|
80
|
+
};
|
|
81
|
+
description?: string | Record<string, string>;
|
|
82
|
+
loose?: boolean;
|
|
83
|
+
};
|
|
84
|
+
dict?: Record<string, NativeConfigSchema>;
|
|
85
|
+
inner?: NativeConfigSchema;
|
|
86
|
+
sKey?: NativeConfigSchema;
|
|
87
|
+
list?: NativeConfigSchema[];
|
|
88
|
+
value?: unknown;
|
|
89
|
+
builder?: unknown;
|
|
90
|
+
}
|
|
91
|
+
/** Collected declaration used only while constructing the JSON Schema document. */
|
|
92
|
+
export interface CollectedConfigEntry extends ConfigSchemaEntry {
|
|
93
|
+
native?: NativeConfigSchema;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=types.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -12,14 +12,26 @@ import { dshHomePath } from '@deepseek-ai/dsh-home-paths';
|
|
|
12
12
|
import { type LaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment';
|
|
13
13
|
export { readProfilePatches, resolveTelemetryPatch, type ProfileContext, type ProfilePnpmInvocation } from './profile-context.ts';
|
|
14
14
|
export { sanitizeProfile } from './profile-sanitize.ts';
|
|
15
|
+
export { readPluginMeta } from './package-meta.ts';
|
|
16
|
+
export { generateConfigSchema, type ConfigSchemaDump, type NativeConfigSchema } from './config-schema/index.ts';
|
|
17
|
+
export { createConfigProjector, LOADER_EXPRESSION_SCHEMA, type ConfigProjection } from './config-schema/projector.ts';
|
|
18
|
+
export { isNativeConfigSchema } from './config-schema/native.ts';
|
|
15
19
|
export { readProfilePlugins, reconcileProfilePlugins, writeProfileBundles, type ProfilePluginLocation, type ProfilePluginDependency, type ProfilePluginInventory, type ProfilePluginReconciliation, } from './profile-plugins.ts';
|
|
16
20
|
declare module '@deepseek-ai/cordis' {
|
|
17
21
|
interface Context {
|
|
18
22
|
/** Harness-home path resolver available to Loader `!!js` config expressions. */
|
|
19
23
|
dshHomePath?: typeof dshHomePath;
|
|
20
24
|
}
|
|
25
|
+
interface Events {
|
|
26
|
+
/**
|
|
27
|
+
* Profile patches were reconciled into the running Loader tree: every entry update settled and no new
|
|
28
|
+
* inactive entry was introduced. Carries no diff; listeners re-read Loader entries.
|
|
29
|
+
* @mode emit
|
|
30
|
+
*/
|
|
31
|
+
'app-boot/config-reload'(): void;
|
|
32
|
+
}
|
|
21
33
|
}
|
|
22
|
-
export { composeEntries,
|
|
34
|
+
export { composeEntries, createRuntimeResolution, DEFAULT_PROFILE_BUNDLES, OPTIONAL_BUNDLES, bundlePatchFiles, bundlePatchPaths, initProfile, removeLinkProjections, loadProfile, loadProfileDirectory, PROFILE_PATCH_FILENAME, PROFILE_TEMPLATES, PROFILES_DIR, readProfileManifest, resolveBundleDir, resolveProfileDir, writeProfileManifest, type Profile, type ProfileLayer, type ProfileManifest, type LinkedRoot, type RuntimeResolutionOptions, type RuntimeResolutionEntry, type RuntimeResolution, type ProfileTemplate, } from './profile.ts';
|
|
23
35
|
export { PluginPackages, type PluginPackage, type PluginPackagesConfig, } from './profile-resolution/service.ts';
|
|
24
36
|
/**
|
|
25
37
|
* Resolve the config to boot. Replay swaps a `cordis.yml` basename for
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Read plugin display text and icons through exported resources without evaluating plugin code. */
|
|
2
|
+
import type { PluginLocalizedMeta } from '@deepseek-ai/dsh-package-manifest';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a plugin resource through the active Node ESM resolver without evaluating it.
|
|
5
|
+
* @param specifier - complete resource module specifier, including its locale filename.
|
|
6
|
+
* @param parentURL - owning module-resolution base.
|
|
7
|
+
* @returns the local filesystem path selected by Node and the active profile.
|
|
8
|
+
* @throws when the resolver is unavailable or the resource cannot resolve to a local file.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolvePluginResource(specifier: string, parentURL: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Read localized display text and the icon declared in a plugin's exported package.json.
|
|
13
|
+
* Icons are manifest-relative SVG, PNG, JPEG, or WebP files of at most 256 KiB,
|
|
14
|
+
* contained in the manifest directory after realpath resolution. Icon failures retain display text.
|
|
15
|
+
* Non-package specifiers are skipped without invoking the resource resolver.
|
|
16
|
+
* Language files share the directory containing the resolved English resource;
|
|
17
|
+
* each file is resolved through the complete plugin specifier before reading.
|
|
18
|
+
* Missing fields use the same address's package.json name/description. Translation
|
|
19
|
+
* maps retain an English fallback, ultimately the full module specifier for titles and empty for descriptions.
|
|
20
|
+
* @param specifier - configured plugin module name, including any package subpath.
|
|
21
|
+
* @param parentURL - owning Loader tree's module-resolution base.
|
|
22
|
+
* @returns display fields and any icon diagnostic, or undefined for non-package specifiers or absent metadata.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readPluginMeta(specifier: string, parentURL: string): PluginLocalizedMeta | undefined;
|
|
25
|
+
//# sourceMappingURL=package-meta.d.ts.map
|
|
@@ -1,35 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
/** Profile-private package links projected into its pnpm-managed node_modules. */
|
|
3
|
-
export declare const PROFILE_MODULE_FALLBACK_DIR = ".dsh-module-fallback";
|
|
4
|
-
/**
|
|
5
|
-
* Return whether the process reads application modules from pkg's virtual filesystem.
|
|
6
|
-
* @returns whether pkg owns the module filesystem.
|
|
7
|
-
*/
|
|
8
|
-
export declare function isPackagedExecutable(): boolean;
|
|
1
|
+
/** Package directory canonicalization through the active runtime carrier's filesystem. */
|
|
9
2
|
/**
|
|
10
3
|
* Resolve a directory through the active carrier's filesystem implementation.
|
|
11
4
|
* @param path - directory path to canonicalize.
|
|
12
5
|
* @returns the canonical directory path.
|
|
13
6
|
*/
|
|
14
7
|
export declare function realModuleDirectory(path: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* Resolve a link target without following the final path component.
|
|
17
|
-
* @param path - candidate path whose parent is canonicalized.
|
|
18
|
-
* @returns the canonical candidate, or undefined when its parent is absent.
|
|
19
|
-
*/
|
|
20
|
-
export declare function canonicalLinkPath(path: string): string | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Return whether a symlink or junction points at the same path as `target`.
|
|
23
|
-
* @param link - symlink or junction to inspect.
|
|
24
|
-
* @param target - expected target path.
|
|
25
|
-
* @returns whether both paths identify the same entry.
|
|
26
|
-
*/
|
|
27
|
-
export declare function symlinkPointsTo(link: string, target: string): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Return whether an observed profile package must not claim local precedence.
|
|
30
|
-
* @param profileDir - profile directory containing the package projection.
|
|
31
|
-
* @param packageName - bare package name to inspect.
|
|
32
|
-
* @returns whether the entry is a managed fallback link or disappeared during inspection.
|
|
33
|
-
*/
|
|
34
|
-
export declare function isProfileModuleFallbackLink(profileDir: string, packageName: string): boolean;
|
|
35
8
|
//# sourceMappingURL=legacy-links.d.ts.map
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/** In-memory profile package routing for Node's default ESM and CommonJS loaders. */
|
|
2
|
-
import type {
|
|
3
|
-
/**
|
|
4
|
-
export
|
|
5
|
-
/** Active resolver registration in one Node isolate. */
|
|
6
|
-
export interface ProfileResolutionRegistration {
|
|
2
|
+
import type { RuntimeResolution } from '../profile.ts';
|
|
3
|
+
/** Active interception in one Node isolate. */
|
|
4
|
+
export interface RuntimeInterception {
|
|
7
5
|
/**
|
|
8
6
|
* Locate a bare package without requiring one of its exports.
|
|
7
|
+
* A package subpath selects its package directory without resolving or validating the requested file.
|
|
9
8
|
* @param specifier - bare package or package-subpath specifier.
|
|
10
9
|
* @param parentURL - file URL whose lookup order applies.
|
|
11
10
|
* @returns selected package directory, or undefined when it is absent.
|
|
12
11
|
*/
|
|
13
12
|
packageDir(specifier: string, parentURL: string): string | undefined;
|
|
14
13
|
/**
|
|
15
|
-
* Atomically publish
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
14
|
+
* Atomically publish a complete successor and fresh caches. Linked roots may be added or removed.
|
|
15
|
+
* Removed roots stop intercepting uncovered directories; existing modules and Node caches remain intact.
|
|
16
|
+
* @param successor - fully constructed generation retaining existing package mappings and local names.
|
|
17
|
+
* @throws when the profile scope or existing mappings change, local names are removed or override
|
|
18
|
+
* existing mappings, or a previously published link name selects a different real directory.
|
|
18
19
|
*/
|
|
19
|
-
replace(
|
|
20
|
-
/** Restore the native resolver methods.
|
|
20
|
+
replace(successor: RuntimeResolution): void;
|
|
21
|
+
/** Restore the native resolver methods. Interceptions dispose in reverse order. */
|
|
21
22
|
dispose(): void;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
@@ -27,17 +28,15 @@ export interface ProfileResolutionRegistration {
|
|
|
27
28
|
*/
|
|
28
29
|
export declare function barePackageName(request: string): string | undefined;
|
|
29
30
|
/**
|
|
30
|
-
* Install one
|
|
31
|
-
* @param
|
|
32
|
-
* @
|
|
33
|
-
* @returns a registration that replaces the generation or restores the native methods.
|
|
31
|
+
* Install one runtime resolution as the interception on Node's default ESM and CommonJS resolvers.
|
|
32
|
+
* @param resolution - complete package table and profile scope.
|
|
33
|
+
* @returns an interception that publishes a successor or restores the native methods.
|
|
34
34
|
*/
|
|
35
|
-
export declare function
|
|
35
|
+
export declare function installRuntimeInterception(resolution: RuntimeResolution): RuntimeInterception;
|
|
36
36
|
/**
|
|
37
|
-
* Publish one
|
|
38
|
-
* @param
|
|
39
|
-
* @param behavior - enforce or verify the generation in newly created Workers.
|
|
37
|
+
* Publish one runtime resolution for Harness-owned Workers.
|
|
38
|
+
* @param resolution - complete package table and profile scope.
|
|
40
39
|
* @returns a disposer restoring the previous thread environment data.
|
|
41
40
|
*/
|
|
42
|
-
export declare function registerWorkerResolution(
|
|
41
|
+
export declare function registerWorkerResolution(resolution: RuntimeResolution): () => void;
|
|
43
42
|
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** Package metadata resolved through one
|
|
1
|
+
/** Package metadata resolved through one runtime interception. */
|
|
2
2
|
import { Service, type Context } from '@deepseek-ai/cordis';
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
3
|
+
import type { PluginLocalizedMeta } from '@deepseek-ai/dsh-package-manifest';
|
|
4
|
+
import type { RuntimeResolution } from '../profile.ts';
|
|
5
5
|
declare module '@deepseek-ai/cordis' {
|
|
6
6
|
interface Context {
|
|
7
7
|
/** Deterministic package lookup for configured plugin specifiers. */
|
|
@@ -21,25 +21,23 @@ export interface PluginPackage {
|
|
|
21
21
|
/** Parsed manifest shared by metadata readers. */
|
|
22
22
|
manifest: Record<string, unknown>;
|
|
23
23
|
}
|
|
24
|
-
/** Optional runtime
|
|
24
|
+
/** Optional runtime interception installed and owned by {@link PluginPackages}. */
|
|
25
25
|
export interface PluginPackagesConfig {
|
|
26
26
|
/** Complete package table; omit it to expose native package lookup only. */
|
|
27
|
-
|
|
28
|
-
/** Enforce the table or compare it with a materialized fallback. */
|
|
29
|
-
behavior?: ProfileResolutionBehavior;
|
|
27
|
+
resolution?: RuntimeResolution;
|
|
30
28
|
}
|
|
31
29
|
/** Package lookup shared by metadata consumers in one profile process. */
|
|
32
30
|
export declare class PluginPackages extends Service {
|
|
33
31
|
private packages;
|
|
34
|
-
private readonly
|
|
35
|
-
private readonly behavior;
|
|
32
|
+
private readonly interception;
|
|
36
33
|
private disposeWorkerResolution;
|
|
37
34
|
constructor(ctx: Context, config?: PluginPackagesConfig);
|
|
38
35
|
/**
|
|
39
|
-
* Publish
|
|
40
|
-
*
|
|
36
|
+
* Publish a complete successor generation for this process and subsequently created Workers.
|
|
37
|
+
* Linked roots may be removed without unloading modules or clearing Node caches.
|
|
38
|
+
* @param successor - fully constructed generation accepted by {@link RuntimeInterception.replace}.
|
|
41
39
|
*/
|
|
42
|
-
replace(
|
|
40
|
+
replace(successor: RuntimeResolution): void;
|
|
43
41
|
/**
|
|
44
42
|
* Locate the package named by a specifier without requiring a package export.
|
|
45
43
|
* @param specifier - module specifier whose package owns the requested module.
|
|
@@ -47,5 +45,12 @@ export declare class PluginPackages extends Service {
|
|
|
47
45
|
* @returns the parsed package, or undefined when no package owns the request.
|
|
48
46
|
*/
|
|
49
47
|
packageOf(specifier: string, parentURL: string): PluginPackage | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Read display metadata without loading or activating the target plugin.
|
|
50
|
+
* @param specifier - configured package module, including package subpaths.
|
|
51
|
+
* @param parentURL - owning Loader tree's resolution base.
|
|
52
|
+
* @returns local display metadata or its diagnostic; undefined for non-package requests or absent metadata.
|
|
53
|
+
*/
|
|
54
|
+
metaOf(specifier: string, parentURL: string): PluginLocalizedMeta | undefined;
|
|
50
55
|
}
|
|
51
56
|
//# sourceMappingURL=service.d.ts.map
|
package/lib/types/profile.d.ts
CHANGED
|
@@ -7,24 +7,22 @@
|
|
|
7
7
|
* `dsh.profile` with its ordered `bundles` list) and a `cordis.patch.yml`
|
|
8
8
|
* (the user's own patch layer, applied after every bundle layer). Bundles are
|
|
9
9
|
* npm packages whose manifest declares
|
|
10
|
-
* `"dsh": { "bundle": { "patch": "./cordis.patch.yml" } }
|
|
11
|
-
* composed by applying each bundle's patch
|
|
12
|
-
* an empty entry list, then the
|
|
13
|
-
* layers (`--patch` files and
|
|
10
|
+
* `"dsh": { "bundle": { "patch": "./cordis.patch.yml" } }` (one file, or an
|
|
11
|
+
* ordered list of files); the tree is composed by applying each bundle's patch
|
|
12
|
+
* lists in `dsh.profile.bundles` order over an empty entry list, then the
|
|
13
|
+
* profile's own patches, then any launcher layers (`--patch` files and
|
|
14
|
+
* flag-derived patches).
|
|
14
15
|
*
|
|
15
16
|
* Module resolution is two-anchor by construction: a bundle name resolves
|
|
16
17
|
* first from the dsh installation (the launcher's own package), then from the
|
|
17
18
|
* profile directory. Pnpm-managed entries in the profile's `node_modules`
|
|
18
|
-
* resolve first.
|
|
19
|
-
* bundles
|
|
20
|
-
* dependency closure through Node's ordinary parent-walk. Plain Node uses
|
|
21
|
-
* symlinks for that shared fallback; packaged executables use ESM proxies so
|
|
22
|
-
* external plugins retain the installation's module instances.
|
|
19
|
+
* resolve first. The runtime resolution supplies packages carried by the
|
|
20
|
+
* installation and selected bundles to Node's ESM and CommonJS resolvers.
|
|
23
21
|
* @module @deepseek-ai/dsh-app-boot/profile
|
|
24
22
|
*/
|
|
25
23
|
import type { EntryOptions } from '@deepseek-ai/cordis-plugin-loader';
|
|
26
24
|
import { type PatchOptions } from '@deepseek-ai/cordis-plugin-include';
|
|
27
|
-
import type { DshPackageManifest } from '@deepseek-ai/dsh-package-manifest';
|
|
25
|
+
import type { DshBundleManifest, DshPackageManifest } from '@deepseek-ai/dsh-package-manifest';
|
|
28
26
|
/** Directory under the Harness home holding every profile. */
|
|
29
27
|
export declare const PROFILES_DIR = "profiles";
|
|
30
28
|
/** The user patch layer inside a profile directory (hot-reloaded on long-lived surfaces). */
|
|
@@ -36,15 +34,31 @@ export interface ProfileTemplate {
|
|
|
36
34
|
}
|
|
37
35
|
/** Package metadata accepted by the profile reader; local profiles need no published identity. */
|
|
38
36
|
export type ProfileManifest = Partial<DshPackageManifest>;
|
|
37
|
+
/**
|
|
38
|
+
* The patch files a bundle declares, as written: one file for a string
|
|
39
|
+
* `patch`, the listed files in order for an array.
|
|
40
|
+
* @param bundle - the bundle's `dsh.bundle` declaration, as read from package.json.
|
|
41
|
+
* @returns the package-relative patch file paths in application order.
|
|
42
|
+
* @throws {Error} when `patch` is neither a string nor a list of strings.
|
|
43
|
+
*/
|
|
44
|
+
export declare function bundlePatchFiles(bundle: DshBundleManifest): string[];
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a bundle declaration to its ordered absolute patch files.
|
|
47
|
+
* @param packageDir - absolute directory of the bundle package.
|
|
48
|
+
* @param bundle - the bundle's `dsh.bundle` declaration, as read from package.json.
|
|
49
|
+
* @returns the absolute patch file paths in application order.
|
|
50
|
+
* @throws {Error} when `patch` is neither a string nor a list of strings.
|
|
51
|
+
*/
|
|
52
|
+
export declare function bundlePatchPaths(packageDir: string, bundle: DshBundleManifest): string[];
|
|
39
53
|
/** One resolved bundle layer of a profile. */
|
|
40
54
|
export interface ProfileLayer {
|
|
41
55
|
/** The bundle's package name, as listed in `dsh.profile.bundles`. */
|
|
42
56
|
packageName: string;
|
|
43
57
|
/** Absolute directory of the resolved bundle package. */
|
|
44
58
|
packageDir: string;
|
|
45
|
-
/** Absolute
|
|
46
|
-
|
|
47
|
-
/** The parsed patch
|
|
59
|
+
/** Absolute paths of the bundle's patch files, in application order. */
|
|
60
|
+
patchPaths: readonly string[];
|
|
61
|
+
/** The parsed patch lists of every file, concatenated in application order. */
|
|
48
62
|
patches: PatchOptions[];
|
|
49
63
|
}
|
|
50
64
|
/** A loaded profile: resolved bundle layers plus the user's own patch layer. */
|
|
@@ -60,8 +74,8 @@ export interface Profile {
|
|
|
60
74
|
/** The profile's own patches; empty when the file is absent. */
|
|
61
75
|
patches: PatchOptions[];
|
|
62
76
|
}
|
|
63
|
-
/** One package
|
|
64
|
-
export interface
|
|
77
|
+
/** One package the runtime resolution supplies at the interception layer. */
|
|
78
|
+
export interface RuntimeResolutionEntry {
|
|
65
79
|
/** Bare package name. */
|
|
66
80
|
readonly name: string;
|
|
67
81
|
/** Package directory selected by the existing dependency traversal. */
|
|
@@ -70,22 +84,32 @@ export interface ProfileResolutionEntry {
|
|
|
70
84
|
readonly version: string | undefined;
|
|
71
85
|
/** Manifest whose dependency edge selected this package. */
|
|
72
86
|
readonly declarer: string;
|
|
73
|
-
/** Whether every profile or only the active profile receives this
|
|
87
|
+
/** Whether every profile or only the active profile receives this entry. */
|
|
74
88
|
readonly scope: 'installation' | 'profile';
|
|
75
89
|
}
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
90
|
+
/**
|
|
91
|
+
* A profile node_modules entry linked to a directory outside the shared profiles tree and the active profile.
|
|
92
|
+
* Importers below `realPath` use Node's real ancestor chain, with peer mappings read at each node_modules position.
|
|
93
|
+
*/
|
|
94
|
+
export interface LinkedRoot {
|
|
95
|
+
/** Package name of the profile `node_modules` entry, including its scope. */
|
|
96
|
+
readonly name: string;
|
|
97
|
+
/** Real directory outside the shared profiles tree and active profile; a package.json is optional. */
|
|
98
|
+
readonly realPath: string;
|
|
99
|
+
}
|
|
100
|
+
/** Complete immutable package table for one profile launch. */
|
|
101
|
+
export interface RuntimeResolution {
|
|
102
|
+
/** Directory containing every profile; its node_modules is the interception layer. */
|
|
79
103
|
readonly profilesDir: string;
|
|
80
|
-
/** Active profile directory, when
|
|
104
|
+
/** Active profile directory, when profile-scope entries were included. */
|
|
81
105
|
readonly profileDir: string | undefined;
|
|
82
|
-
/** Profile-declared packages
|
|
106
|
+
/** Profile-declared packages installed in the profile's own node_modules. */
|
|
83
107
|
readonly localPackageNames: readonly string[];
|
|
84
|
-
/** Installation entries followed by
|
|
85
|
-
readonly entries: readonly
|
|
108
|
+
/** Installation-scope entries followed by profile-scope entries in precedence order. */
|
|
109
|
+
readonly entries: readonly RuntimeResolutionEntry[];
|
|
110
|
+
/** Active profile links to external directories, sorted by name. */
|
|
111
|
+
readonly linkedRoots: readonly LinkedRoot[];
|
|
86
112
|
}
|
|
87
|
-
/** Startup backend selection for one computed profile resolution generation. */
|
|
88
|
-
export type ProfileResolutionMode = 'link' | 'dual' | 'runtime';
|
|
89
113
|
/**
|
|
90
114
|
* Resolve a profile's directory under the Harness home.
|
|
91
115
|
* @param name - the profile name (`dsh --profile <name>`).
|
|
@@ -112,52 +136,36 @@ export declare const OPTIONAL_BUNDLES: readonly string[];
|
|
|
112
136
|
* @param bundles - the initial `dsh.profile.bundles` layer list.
|
|
113
137
|
*/
|
|
114
138
|
export declare function initProfile(dir: string, bundles: readonly string[]): void;
|
|
115
|
-
/**
|
|
116
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Remove the package projections a link-backend launch left in a profile.
|
|
141
|
+
* Only symlinks under the profile's `node_modules` whose target lies inside
|
|
142
|
+
* `<profile>/.dsh-module-fallback/node_modules` are unlinked, then that directory is removed;
|
|
143
|
+
* pnpm-installed packages and every other symlink stay. A profile without the directory is untouched.
|
|
144
|
+
* @param dir - the profile directory.
|
|
145
|
+
*/
|
|
146
|
+
export declare function removeLinkProjections(dir: string): void;
|
|
147
|
+
/** Inputs for {@link createRuntimeResolution}. */
|
|
148
|
+
export interface RuntimeResolutionOptions {
|
|
117
149
|
/** Absolute package.json path of the running dsh installation. */
|
|
118
150
|
installAnchor: string;
|
|
119
151
|
/** Loaded profile whose selected bundles may carry profile-local plugins. */
|
|
120
152
|
profile?: Profile;
|
|
121
153
|
/** Harness home; defaults to {@link resolveDshHome}. */
|
|
122
154
|
home?: string;
|
|
123
|
-
/** Whether to materialize the computed generation; defaults to true. */
|
|
124
|
-
materialize?: boolean;
|
|
125
155
|
}
|
|
126
156
|
/**
|
|
127
|
-
*
|
|
128
|
-
* `$DSH_HOME/profiles/node_modules` mirrors the dsh installation dependency
|
|
129
|
-
* closure. Plain Node writes symlinks; a packaged executable writes ESM
|
|
130
|
-
* proxies under a cross-process lock because operating-system links cannot
|
|
131
|
-
* enter pkg's virtual filesystem. Missing packages carried only by selected
|
|
132
|
-
* bundles are linked through a profile-owned directory into that profile's
|
|
133
|
-
* `node_modules`; pnpm-managed entries remain authoritative, and another
|
|
134
|
-
* profile's links cannot change its resolution.
|
|
157
|
+
* Compute the runtime resolution without writing module-resolution files.
|
|
135
158
|
* @param options - installation anchor, optional loaded profile, and Harness home.
|
|
136
|
-
* @returns the
|
|
137
|
-
*/
|
|
138
|
-
export declare function healProfilesModuleFallback(options: ProfileModuleFallbackOptions): Promise<ProfileResolutionGeneration>;
|
|
139
|
-
/**
|
|
140
|
-
* Compute a profile resolution generation without materializing links or proxies.
|
|
141
|
-
* @param options - installation anchor, profile, and optional Harness home.
|
|
142
|
-
* @returns the complete immutable generation.
|
|
143
|
-
*/
|
|
144
|
-
export declare function createProfileResolutionGeneration(options: Omit<ProfileModuleFallbackOptions, 'materialize'>): Promise<ProfileResolutionGeneration>;
|
|
145
|
-
/**
|
|
146
|
-
* Supply an application-owned profile with filesystem packages from its installation and selected bundles.
|
|
147
|
-
* All fallback links belong to the profile; no shared Harness-home directory is written.
|
|
148
|
-
* Existing pnpm-managed packages remain authoritative. The caller serializes profile mutations.
|
|
149
|
-
* @param options - owning installation package.json and the loaded application profile.
|
|
159
|
+
* @returns the complete immutable runtime resolution.
|
|
150
160
|
*/
|
|
151
|
-
export declare function
|
|
152
|
-
installAnchor: string;
|
|
153
|
-
profile: Profile;
|
|
154
|
-
}): void;
|
|
161
|
+
export declare function createRuntimeResolution(options: RuntimeResolutionOptions): Promise<RuntimeResolution>;
|
|
155
162
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* @param
|
|
163
|
+
* Identify selected bundles that did not produce a loaded layer.
|
|
164
|
+
* @param profile - loaded profile, when present.
|
|
165
|
+
* @param manifest - its parsed manifest, when present.
|
|
166
|
+
* @returns selected bundle names missing from the loaded layers, for resolution and diagnostics.
|
|
159
167
|
*/
|
|
160
|
-
export declare function
|
|
168
|
+
export declare function skippedProfileBundles(profile: Profile | undefined, manifest: ProfileManifest | undefined): ReadonlySet<string>;
|
|
161
169
|
/**
|
|
162
170
|
* Read a profile's manifest.
|
|
163
171
|
* @param binName - the diagnostic prefix on the thrown error.
|
|
@@ -188,20 +196,20 @@ export declare function resolveBundleDir(binName: string, packageName: string, i
|
|
|
188
196
|
* Load an already initialized profile directory without resolving it through
|
|
189
197
|
* the shared Harness home. This is used by application-owned profiles whose
|
|
190
198
|
* package project and lifecycle belong to that application.
|
|
199
|
+
* Unreadable bundles are reported on stderr and skipped without changing the manifest.
|
|
191
200
|
* @param binName - the diagnostic prefix on thrown errors.
|
|
192
201
|
* @param dir - absolute profile package directory.
|
|
193
202
|
* @param installAnchor - absolute path of the owning dsh app's package.json.
|
|
194
203
|
* @param options - `userLayer: false` skips reading `cordis.patch.yml`.
|
|
195
|
-
* @returns the
|
|
204
|
+
* @returns the successfully loaded bundle layers and optional user patch layer.
|
|
196
205
|
*/
|
|
197
206
|
export declare function loadProfileDirectory(binName: string, dir: string, installAnchor: string, options?: {
|
|
198
207
|
userLayer?: boolean;
|
|
199
208
|
}): Profile;
|
|
200
209
|
/**
|
|
201
210
|
* Load a profile: resolve every `dsh.profile.bundles` entry to its patch
|
|
202
|
-
* layer and parse the profile's own patch file.
|
|
203
|
-
*
|
|
204
|
-
* is a misconfiguration, not "no patches".
|
|
211
|
+
* layer and parse the profile's own patch file. Unreadable bundles are reported
|
|
212
|
+
* on stderr and skipped; profile manifest and user patch errors still throw.
|
|
205
213
|
* @param binName - the diagnostic prefix on thrown errors.
|
|
206
214
|
* @param name - the profile name.
|
|
207
215
|
* @param installAnchor - absolute path of the dsh app's package.json (first resolution anchor).
|