autosnippet
Version:
Extract code patterns into a knowledge base for AI coding assistants
73 lines (72 loc) • 1.8 kB
TypeScript
/**
* ScreenCaptureService — macOS 原生截图服务
*
* 使用 ScreenCaptureKit (via Swift CLI) 截取窗口/屏幕画面。
* 息屏可用,无需 OBS。
*
* 依赖:resources/native-ui/screenshot.swift 编译产物
*/
/** 截图选项 */
interface ScreenshotOptions {
windowTitle?: string;
format?: 'jpeg' | 'png';
scale?: number;
outputPath?: string;
}
/** 截图工具返回结果 */
interface ScreenshotToolResult {
path?: string;
width?: number;
height?: number;
format?: string;
bytes?: number;
error?: string;
}
/**
* 截取屏幕或窗口画面(核心功能 — 息屏可用)
*
* @param [opts.windowTitle] 窗口标题关键词(模糊匹配),默认截整屏
* @param [opts.format] 'jpeg' | 'png'
* @param [opts.scale] 缩放因子 (0.25-2.0)
* @param [opts.outputPath] 输出路径,默认临时目录
* @returns >}
*/
export declare function screenshot(opts?: ScreenshotOptions): Promise<{
success: boolean;
path: string | undefined;
width: number | undefined;
height: number | undefined;
format: string | undefined;
bytes: number | undefined;
error?: undefined;
} | {
success: boolean;
error: string | undefined;
path?: undefined;
width?: undefined;
height?: undefined;
format?: undefined;
bytes?: undefined;
}>;
/**
* 列出所有可截取的窗口
* @returns >}
*/
export declare function listWindows(): Promise<{
success: boolean;
windows: ScreenshotToolResult;
error?: undefined;
} | {
success: boolean;
error: string | undefined;
windows?: undefined;
}>;
/**
* 检查截图服务是否可用
* @returns }
*/
export declare function isScreenCaptureAvailable(): {
available: boolean;
error: string | undefined;
};
export {};