/**
 * Resolve workflow-level `registries:` and `installEnv:` declarations into the
 * per-dispatch fields the agent needs to authenticate `npm install` against
 * private registries.
 *
 * Each `tokenSecret` / `installEnv[]` entry uses the qualified
 * `<environment>:<secret-name>` syntax. The resolver:
 *
 *   1. Parses every qualified ref and groups by environment name.
 *   2. Fires the per-environment protection-rule pipeline once per unique env
 *      (branch / trust / concurrency / reviewer / wait-timer). Any non-pass
 *      result rejects the whole workflow dispatch — v1 does not yet support
 *      workflow-scoped held-runs, so a `hold` from the reviewer-gate is
 *      surfaced as a reject with a clear reason.
 *   3. Resolves secrets per environment via `secretResolver.resolveForJob`
 *      (which writes its own audit log lines).
 *   4. Validates each registry URL scheme: HTTPS always allowed; `http://`
 *      allowed only for loopback / `*.local` hosts OR when the org operator
 *      has flipped `org_settings.allow_http_npm_registries=true`.
 *   5. Strips the resolved auth entirely when the contributor-trust tier is
 *      not `trusted` (defense in depth: even if a misconfigured environment
 *      lets an unknown contributor through the protection-pipeline trust
 *      gate, this strip ensures fork PRs never see registry tokens — the
 *      install fails naturally because the deps are unreachable).
 *
 * Pure helper: no imports of the dispatch giant. Tested in isolation in
 * `install-secrets-resolver.test.ts`.
 */
import type { LockRegistry } from '@kici-dev/engine';
import type { TrustResolution } from '../security/trust-resolver.js';
import type { SecretResolver } from '../secrets/secret-resolver.js';
import type { EnvironmentStore } from '../environments/environment-store.js';
import { type JobDispatchContext } from '../environments/protection/pipeline.js';
/** Registry spec carried on the dispatch message (token already resolved). */
export interface NpmRegistrySpec {
    url: string;
    scope?: string;
    alwaysAuth: boolean;
    token: string;
}
export interface ResolveInstallSecretsArgs {
    registries: readonly LockRegistry[] | undefined;
    installEnv: readonly string[] | undefined;
    allowHttpNpmRegistries: boolean;
    resolvedOrgId: string;
    trustResolution: TrustResolution | undefined;
    environmentStore: EnvironmentStore | undefined;
    secretResolver: SecretResolver | undefined;
    protectionContext: JobDispatchContext;
}
export type ResolveInstallSecretsResult = {
    decision: 'pass';
    npmRegistries: NpmRegistrySpec[] | undefined;
    installEnvSecrets: Record<string, string> | undefined;
    contributorStripped: boolean;
} | {
    decision: 'reject';
    reason: string;
};
/** Parse `<environment>:<secret-name>`. Returns null on malformed input. */
export declare function parseQualifiedSecretRef(ref: string): {
    envName: string;
    secretName: string;
} | null;
/** Validate a registry URL's scheme against the org's http allow-toggle. */
export declare function validateRegistryUrlScheme(url: string, allowHttp: boolean): {
    ok: true;
} | {
    ok: false;
    reason: string;
};
export declare function resolveInstallSecrets(args: ResolveInstallSecretsArgs): Promise<ResolveInstallSecretsResult>;
//# sourceMappingURL=install-secrets-resolver.d.ts.map