import { type ApiSuccess } from '../../types/api/success';
import { type DataAppTemplate } from './types';
export declare const currentDataAppCodeVersion: 1;
export declare const MAX_DECLARED_DEPENDENCIES = 60;
export declare const MAX_LOCKFILE_BYTES: number;
export type DataAppManifest = {
    codeVersion: 1;
    appUuid: string;
    projectUuid: string;
    version: number;
    name: string;
    description: string;
    template: Exclude<DataAppTemplate, 'custom'> | null;
    downloadedAt: string;
    scaffoldingVersion?: string;
};
export type DataAppCodeFile = {
    path: string;
    contentBase64: string;
};
export type DataAppDependencies = {
    packageJson: string;
    lockfile: string;
};
export type DataAppCode = {
    manifest: DataAppManifest;
    files: DataAppCodeFile[];
    dependencies?: DataAppDependencies;
};
export type DataAppContextFile = {
    path: string;
    contentBase64: string;
};
export type DataAppThemeContext = {
    instructions: DataAppContextFile | null;
    assets: DataAppContextFile[];
    skippedAssetCount: number;
};
export type DataAppContext = {
    semanticLayer: DataAppContextFile;
    parameters: DataAppContextFile | null;
    promptHistory: DataAppContextFile;
    theme: DataAppThemeContext;
};
export type DataAppCodeDownload = DataAppCode & {
    context: DataAppContext;
};
export type ApiGetAppCodeResponse = ApiSuccess<DataAppCodeDownload>;
export type ImportAppCodeRequestBody = {
    code: DataAppCode;
    targetAppUuid?: string;
    spaceUuid?: string;
};
export type ApiImportAppCodeResponse = ApiSuccess<{
    appUuid: string;
    version: number;
    action: 'create' | 'append';
}>;
export type DataAppDepsValidationResult = {
    customDeps: Record<string, string>;
};
export type LockfilePackage = {
    name: string;
    version: string;
};
/**
 * Splits a pnpm lockfile package key (`name@version`, optionally scoped and/or
 * with a `(peer@x)` suffix) into name + version. Returns null for anything
 * that doesn't parse — e.g. link:/file: entries that carry no registry version.
 */
export declare function parseLockfilePackageKey(key: string): LockfilePackage | null;
/**
 * Extracts every resolved package (direct AND transitive) from a pnpm
 * lockfile's `packages:` section as { name, version } pairs. Pure/structural —
 * used by backend guards that check declared deps against registry metadata or
 * advisory feeds. Returns [] when the lockfile can't be parsed.
 */
export declare function extractLockfilePackages(lockfile: string): LockfilePackage[];
/**
 * Returns `packageJson` with its `scripts` replaced by the trusted template
 * scripts. The build sandbox runs `pnpm build` against this file, and download
 * round-trips it to other developers' machines — in both places the script
 * commands must stay server-controlled, not uploader-controlled.
 */
export declare function sanitizeAppPackageJsonScripts(packageJson: string, templateScripts: Record<string, string>): string;
/**
 * Validates a declared dependency set against an optional template baseline.
 *
 * Rules enforced:
 *  1. `packageJson` parses as JSON with a `dependencies` object.
 *  2. Every spec is a registry semver spec (git+/file:/workspace:/http(s): rejected).
 *  3. Direct-dependency count ≤ MAX_DECLARED_DEPENDENCIES.
 *  4. `lockfile` is non-empty, ≤ MAX_LOCKFILE_BYTES, and mentions every custom
 *     package name (cheap consistency guard).
 *
 * Returns the "custom set": declared deps whose name+version differ from the
 * template baseline (new packages or version overrides).
 */
export declare function validateDataAppDependencies(deps: unknown, opts: {
    templateDependencies: Record<string, string>;
    allowedTarballHosts?: string[];
}): DataAppDepsValidationResult;
export declare function validateDataAppCode(value: unknown, opts?: {
    templateDependencies?: Record<string, string>;
}): DataAppCode;
//# sourceMappingURL=code.d.ts.map