(filePath)
| 3085 | } |
| 3086 | |
| 3087 | async function prepareIMessageModelImage(filePath) { |
| 3088 | const sourcePath = String(filePath || "").trim(); |
| 3089 | if (!sourcePath) return ""; |
| 3090 | await access(sourcePath); |
| 3091 | const extension = extname(sourcePath).toLowerCase(); |
| 3092 | if (extension === ".png") return sourcePath; |
| 3093 | |
| 3094 | await mkdir(imessageScreenshotsDir, { recursive: true }); |
| 3095 | const stamp = new Date().toISOString().replace(/[:.]/g, "-"); |
| 3096 | const outputPath = join(imessageScreenshotsDir, `incoming-${stamp}-${crypto.randomUUID()}.png`); |
| 3097 | await runCommand("/usr/bin/sips", ["-s", "format", "png", sourcePath, "--out", outputPath], { timeout: 15000 }); |
| 3098 | await runCommand("/usr/bin/xattr", ["-c", outputPath], { timeout: 5000, allowFailure: true }); |
| 3099 | await access(outputPath); |
| 3100 | return outputPath; |
| 3101 | } |
| 3102 | |
| 3103 | async function handleIMessageCommand(event) { |
| 3104 | const trusted = state.imessage.trustedHandles.includes(event.handle); |
no test coverage detected