/**
 * Network utilities for proxy support and error handling
 *
 * This module provides:
 * - Proxy initialization using undici's EnvHttpProxyAgent
 * - Custom error classes for distinguishing network vs API errors
 * - Error formatting utilities for helpful user-facing messages
 */
/**
 * Custom error class for network-related failures
 * Distinguishes between network connectivity issues and API errors
 */
export declare class NetworkError extends Error {
    readonly code: string;
    readonly isNetworkError = true;
    constructor(message: string, code: string);
}
/**
 * Custom error class for API-related failures (HTTP errors)
 */
export declare class ApiError extends Error {
    readonly statusCode: number;
    readonly isApiError = true;
    constructor(message: string, statusCode: number);
}
/**
 * Resolution action for skill conflicts
 * Must match SkillResolutionAction in registrar.ts
 */
export type SkillResolutionAction = "cancel" | "namespace" | "updateVersion" | "link";
/**
 * One entry in a conflict's per-file change list.
 *
 * Emitted by the registrar on 409 responses so callers can display which files
 * in a skill/subagent bundle would be discarded or overwritten. Paths are
 * normalized (no leading './') and exclude metadata files (nori.json,
 * .nori-version) to match the content-hash contract.
 *
 * existingContent is only present for non-binary modified/removed entries
 * within the per-file (500KB) and aggregate (5MB) server-side caps. When the
 * server truncates or skips the content, existingTruncated is set.
 */
export type FileChange = {
    path: string;
    status: "added" | "modified" | "removed";
    isBinary: boolean;
    existingContent?: string;
    existingTruncated?: boolean;
};
/**
 * Conflict information for a single skill (used in SkillCollisionError)
 */
export type SkillConflictInfo = {
    skillId: string;
    exists: boolean;
    canPublish: boolean;
    latestVersion?: string | null;
    owner?: string | null;
    availableActions: Array<SkillResolutionAction>;
    contentUnchanged?: boolean | null;
    existingSkillMd?: string | null;
    /**
     * Per-file change list (added/modified/removed) between upload and existing
     * latest version. Optional for backwards compatibility with pre-#331
     * registrar instances.
     */
    fileChanges?: ReadonlyArray<FileChange> | null;
};
/**
 * Custom error class for skill collision errors during skillset upload
 * Thrown when inline skills in a skillset conflict with existing registry skills
 */
export declare class SkillCollisionError extends Error {
    readonly conflicts: Array<SkillConflictInfo>;
    readonly requiresVersions: boolean;
    readonly isSkillCollisionError = true;
    constructor(args: {
        message: string;
        conflicts: Array<SkillConflictInfo>;
        requiresVersions?: boolean | null;
    });
}
/**
 * Get the proxy URL from environment variables (for error messages)
 *
 * @returns The proxy URL or null if no proxy is configured
 */
export declare const getProxyUrl: () => string | null;
/**
 * Initialize proxy support for all fetch requests
 *
 * This sets up a global dispatcher using undici's EnvHttpProxyAgent which
 * automatically handles:
 * - HTTPS_PROXY / https_proxy
 * - HTTP_PROXY / http_proxy
 * - NO_PROXY / no_proxy
 *
 * Should be called once at application startup.
 */
export declare const initializeProxySupport: () => void;
/**
 * Format a network error with helpful context
 *
 * @param args - The function arguments
 * @param args.error - The original error
 * @param args.url - The URL that was being fetched
 *
 * @returns A NetworkError with helpful message
 */
export declare const formatNetworkError: (args: {
    error: Error;
    url: string;
}) => NetworkError;
/**
 * Check if an error is a skill collision error
 *
 * @param error - The error to check
 *
 * @returns True if the error is a skill collision error
 */
export declare const isSkillCollisionError: (error: unknown) => error is SkillCollisionError;
/**
 * Resolution action for subagent conflicts
 * Must match SubagentResolutionAction in registrar.ts
 */
export type SubagentResolutionAction = "cancel" | "namespace" | "updateVersion" | "link";
/**
 * Conflict information for a single subagent (used in SubagentCollisionError)
 */
export type SubagentConflictInfo = {
    subagentId: string;
    exists: boolean;
    canPublish: boolean;
    latestVersion?: string | null;
    owner?: string | null;
    availableActions: Array<SubagentResolutionAction>;
    contentUnchanged?: boolean | null;
    existingSubagentMd?: string | null;
    /**
     * Per-file change list (added/modified/removed) between upload and existing
     * latest version. Optional for backwards compatibility with pre-#331
     * registrar instances.
     */
    fileChanges?: ReadonlyArray<FileChange> | null;
};
/**
 * Custom error class for subagent collision errors during skillset upload
 * Thrown when inline subagents in a skillset conflict with existing registry subagents
 */
export declare class SubagentCollisionError extends Error {
    readonly conflicts: Array<SubagentConflictInfo>;
    readonly requiresVersions: boolean;
    readonly isSubagentCollisionError = true;
    constructor(args: {
        message: string;
        conflicts: Array<SubagentConflictInfo>;
        requiresVersions?: boolean | null;
    });
}
/**
 * Check if an error is a subagent collision error
 *
 * @param error - The error to check
 *
 * @returns True if the error is a subagent collision error
 */
export declare const isSubagentCollisionError: (error: unknown) => error is SubagentCollisionError;
//# sourceMappingURL=fetch.d.ts.map