import { IJSONSchema } from "../../../../../base/common/jsonSchema.js";
import { URI } from "../../../../../base/common/uri.js";
import { OperatingSystem } from "../../../../../base/common/platform.js";
import { HookType } from "./hookTypes.js";
import { Target } from "./promptTypes.js";
import { IMapValue } from "./promptFileParser.js";
/**
 * A single hook command configuration.
 */
export interface IHookCommand {
    readonly type: "command";
    /** Cross-platform command to execute. */
    readonly command?: string;
    /** Windows-specific command override. */
    readonly windows?: string;
    /** Linux-specific command override. */
    readonly linux?: string;
    /** macOS-specific command override. */
    readonly osx?: string;
    /** Resolved working directory URI. */
    readonly cwd?: URI;
    readonly env?: Record<string, string>;
    readonly timeout?: number;
    /** Original JSON field name that provided the windows command. */
    readonly windowsSource?: "windows" | "powershell";
    /** Original JSON field name that provided the linux command. */
    readonly linuxSource?: "linux" | "bash";
    /** Original JSON field name that provided the osx command. */
    readonly osxSource?: "osx" | "bash";
}
/**
 * Collected hooks for a chat request, organized by hook type.
 * This is passed to the extension host so it knows what hooks are available.
 */
export type ChatRequestHooks = {
    readonly [K in HookType]?: readonly IHookCommand[];
};
/**
 * Merges two sets of hooks by concatenating the command arrays for each hook type.
 * Additional hooks are appended after the base hooks.
 */
export declare function mergeHooks(base: ChatRequestHooks | undefined, additional: ChatRequestHooks): ChatRequestHooks;
/**
 * Descriptions for hook command fields, used by both the JSON schema and the hover provider.
 */
export declare const HOOK_COMMAND_FIELD_DESCRIPTIONS: Record<string, string>;
export declare const hookFileSchema: IJSONSchema;
/**
 * URI for the hook schema registration.
 */
export declare const HOOK_SCHEMA_URI = "vscode://schemas/hooks";
/**
 * Normalizes a raw hook type identifier to the canonical HookType enum value.
 * Only matches exact enum values. For tool-specific naming conventions (e.g., Claude, Copilot CLI),
 * use the corresponding compat module's resolver function.
 */
export declare function toHookType(rawHookTypeId: string): HookType | undefined;
/**
 * Gets a label for the given platform.
 */
export declare function getPlatformLabel(os: OperatingSystem): string;
/**
 * Resolves the effective command for the given platform.
 * This applies OS-specific overrides (windows, linux, osx) to get the actual command that will be executed.
 * Similar to how launch.json handles platform-specific configurations in debugAdapter.ts.
 */
export declare function resolveEffectiveCommand(hook: IHookCommand, os: OperatingSystem): string | undefined;
/**
 * Checks if the hook is using a platform-specific command override.
 */
export declare function isUsingPlatformOverride(hook: IHookCommand, os: OperatingSystem): boolean;
/**
 * Gets the source shell type for the effective command on the given platform.
 * Returns 'powershell' if the Windows command came from a powershell field,
 * 'bash' if the Linux/macOS command came from a bash field,
 * or undefined for default shell handling.
 */
export declare function getEffectiveCommandSource(hook: IHookCommand, os: OperatingSystem): "powershell" | "bash" | undefined;
/**
 * Gets the original JSON field key name for the given platform's command.
 * Returns the actual field name from the JSON (e.g., 'bash' instead of 'osx' if bash was used).
 * This is used for editor focus to highlight the correct field.
 */
export declare function getEffectiveCommandFieldKey(hook: IHookCommand, os: OperatingSystem): string;
/**
 * Formats a hook command for display.
 * Resolves OS-specific overrides to show the effective command for the given platform.
 * If using a platform-specific override, includes the platform as a prefix badge.
 */
export declare function formatHookCommandLabel(hook: IHookCommand, os: OperatingSystem): string;
/**
 * Resolves a raw hook command object to the canonical IHookCommand format.
 * Normalizes the command and resolves the cwd path relative to the workspace root.
 * @param raw The raw hook command object from JSON
 * @param workspaceRootUri The workspace root URI to resolve relative cwd paths against
 * @param userHome The user's home directory path for tilde expansion
 */
export declare function resolveHookCommand(raw: Record<string, unknown>, workspaceRootUri: URI | undefined, userHome: string): IHookCommand | undefined;
/**
 * Helper to extract hook commands from an item that could be:
 * 1. A direct command object: { type: 'command', command: '...' }
 * 2. A nested structure with matcher (Claude style): { matcher: '...', hooks: [{ type: 'command', command: '...' }] }
 *
 * This allows Copilot format to handle Claude-style entries if pasted.
 * Also handles Claude's leniency where 'type' field can be omitted.
 */
export declare function extractHookCommandsFromItem(item: unknown, workspaceRootUri: URI | undefined, userHome: string): IHookCommand[];
/**
 * Parses hooks from a subagent's YAML frontmatter `hooks` attribute.
 *
 * Supports two formats for hook entries:
 *
 * 1. **Direct command** (our format, without matcher):
 * ```yaml
 * hooks:
 *   PreToolUse:
 *     - type: command
 *       command: "./scripts/validate.sh"
 * ```
 *
 * 2. **Nested with matcher** (Claude Code format):
 * ```yaml
 * hooks:
 *   PreToolUse:
 *     - matcher: "Bash"
 *       hooks:
 *         - type: command
 *           command: "./scripts/validate.sh"
 * ```
 *
 * @param hooksMap The raw YAML map value from the `hooks` frontmatter attribute.
 * @param workspaceRootUri Workspace root for resolving relative `cwd` paths.
 * @param userHome User home directory path for tilde expansion.
 * @param target The agent's target, used to resolve hook type names correctly.
 * @returns Resolved hooks organized by hook type, ready for use in {@link ChatRequestHooks}.
 */
export declare function parseSubagentHooksFromYaml(hooksMap: IMapValue, workspaceRootUri: URI | undefined, userHome: string, target?: Target): ChatRequestHooks;
