/** * Profile-directory access: locate the running profile, read and write its * manifest, and reconcile the `dsh.profile.bundles` layer list. * * The reconcile rule is a port of `dsh plugin`'s own * (`apps/cli/src/plugin.ts:59-91`), kept behaviourally identical so a plugin * installed from this marketplace is indistinguishable from one installed on * the command line: reconcile by INSTALLED STATE, not by dependency diff, so a * package that gains its `dsh.bundle` declaration in a newer version becomes a * layer on the next update. */ import { type ProfileManifest } from '@deepseek-ai/dsh-app-boot'; /** The subset of an installed plugin's package.json this plugin reads. */ export interface InstalledPackageManifest { readonly name?: string; readonly version?: string; readonly dsh?: { bundle?: { patch?: string; }; client?: unknown; }; readonly dshClient?: unknown; } /** * Locate the profile directory of the running host. * * The loader anchors `ctx.baseUrl` at the directory holding the composed root * config, which is the profile directory itself * (`app-boot/src/index.ts` sets it from `dirname(absoluteConfigPath)`), so no * profile-name guessing or `$DSH_HOME` reconstruction is needed. * @param baseUrl - the context's `baseUrl`, if the loader set one. * @param override - an explicit configuration escape hatch. * @returns the absolute profile directory. * @throws when neither source yields a directory holding a package.json. */ export declare function resolveProfileDirectory(baseUrl: string | undefined, override?: string): string; /** * Read a profile's package.json. * @param profileDir - the profile directory. * @returns the parsed manifest. */ export declare function readManifest(profileDir: string): ProfileManifest; /** * Read an installed package's own manifest. * @param profileDir - the profile the package is installed into. * @param packageName - the dependency name. * @returns the manifest, or undefined when the package does not resolve. */ export declare function readInstalledPackage(profileDir: string, packageName: string): InstalledPackageManifest | undefined; /** * Resolve an installed package's directory. * @param profileDir - the profile directory (second resolution anchor). * @param packageName - the dependency name. * @returns the absolute directory, or undefined when unresolvable. */ export declare function bundleDirectory(profileDir: string, packageName: string): string | undefined; /** * Whether a resolved dependency exports a profile patch, i.e. is a bundle. * @param profileDir - the profile directory. * @param packageName - the dependency name. * @returns true when the package manifest declares `dsh.bundle.patch`. */ export declare function isBundlePackage(profileDir: string, packageName: string): boolean; /** * Whether an installed package ships a browser half. * * Both manifest shapes count: the current deployment's client-module scanner * reads the top-level `dshClient` key while newer builds read nested * `dsh.client`, and plugins in the wild declare one, the other, or both. * @param manifest - the installed package's manifest. * @returns true when a browser bundle will need the page reloaded. */ export declare function declaresClient(manifest: InstalledPackageManifest | undefined): boolean; /** * Reconcile `dsh.profile.bundles` against the installed state. * * pnpm has already written the real installed names, so a git or tarball spec * reconciles by its true package name. A dependency resolving to a * `dsh.bundle`-declaring package joins the layer stack (appended in dependency * order); a dependency-listed name that no longer does leaves it. Template * bundles are not dependencies and are never touched. * @param before - the manifest as it was before pnpm ran. * @param profileDir - the profile directory. * @returns the bundle names added and removed by this reconcile. */ export declare function reconcileBundles(before: ProfileManifest, profileDir: string): { added: string[]; removed: string[]; };