- attachment-store.ts: pin Dirent<string>[] and pass `encoding: 'utf8'`
so newer @types/node doesn't infer Dirent<NonSharedBuffer>
- feishu/media.ts: drop Readable.from(buffer) and pass Buffer directly
to im.image.create / im.file.create — Lark SDK already accepts Buffer
and the stream wrapper trips the stricter Buffer | ReadStream union
used on the main branch's tsconfig
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address two production issues in the AttachmentStore:
1. TOCTOU race in resolvePath() — concurrent downloads with same filename in
the same millisecond could collide. Fixed by appending a 6-char random suffix
to the timestamp-based path, ensuring millisecond-level collisions never occur.
2. Orphan .part files from crashed writes never cleaned up. Fixed by extending
gc() to recognize .part files and clean them with a shorter grace period
(10 minutes by default) rather than the normal retention window.
Added two test cases covering heavy collision pressure and .part cleanup.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>