mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
feat: 实现 4 个 NAPI 包 — modifiers/image-processor/audio-capture/url-handler
- modifiers-napi: 使用 Bun FFI 调用 macOS CGEventSourceFlagsState 检测修饰键 - image-processor-napi: 集成 sharp 库,macOS 剪贴板图像读取 (osascript) - audio-capture-napi: 基于 SoX/arecord 的跨平台音频录制 - url-handler-napi: 完善函数签名(保持 null fallback) - 修复 image-processor 类型兼容性问题 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,10 +106,10 @@ export async function hasImageInClipboard(): Promise<boolean> {
|
||||
// as an unhandled rejection in useClipboardImageHint's setTimeout.
|
||||
try {
|
||||
const { getNativeModule } = await import('image-processor-napi')
|
||||
const nativeModule = getNativeModule() as Record<string, Function> | null
|
||||
const hasImage = nativeModule?.hasClipboardImage
|
||||
if (hasImage) {
|
||||
return hasImage()
|
||||
const nativeModule = getNativeModule()
|
||||
if (nativeModule && 'hasClipboardImage' in nativeModule) {
|
||||
const hasImage = (nativeModule as unknown as Record<string, Function>).hasClipboardImage
|
||||
if (hasImage) return hasImage()
|
||||
}
|
||||
} catch (e) {
|
||||
logError(e as Error)
|
||||
@@ -136,8 +136,10 @@ export async function getImageFromClipboard(): Promise<ImageWithDimensions | nul
|
||||
) {
|
||||
try {
|
||||
const { getNativeModule } = await import('image-processor-napi')
|
||||
const nativeModule = getNativeModule() as Record<string, Function> | null
|
||||
const readClipboard = nativeModule?.readClipboardImage
|
||||
const nativeModule = getNativeModule()
|
||||
const readClipboard = nativeModule && 'readClipboardImage' in nativeModule
|
||||
? (nativeModule as unknown as Record<string, Function>).readClipboardImage
|
||||
: undefined
|
||||
if (!readClipboard) {
|
||||
throw new Error('native clipboard reader unavailable')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user