Android chat file attachments¶
The composer attachment button opens a two-level panel: a horizontal strip of recent images, newest first, above Camera, Gallery and Files icon buttons. Select recent images and tap Add to attach them. Recent images require photo access and support Android 14 partial access; the system gallery picker works without library permission. Gallery and Files support multiple selections; camera captures join the current conversation draft. Draft cards show import, parsing, ready and failure states with retry/removal. Send files alone or together with a question and images. Image protocol and vision requirements remain compatible.
Supported formats: Markdown/plain text (UTF-8, optionally BOM; UTF-16 LE/BE with BOM), CSV with quoted multiline records, text PDF (page locations), and DOCX paragraphs, headings, lists and tab-separated tables. Unsupported encodings, binary content, damaged/encrypted PDFs and unsupported formats report explicit errors. Scanned PDF OCR and legacy DOC are outside the confirmed first release.
Limits: 4 files, 20 MiB each, 50 MiB combined per message; 2 million parsed UTF-16 units; 300 PDF pages; 65536 UTF-16 units per CSV record/PDF page. DOCX allows 2000 ZIP entries and 8 MiB of main XML, rejecting DTD/entity declarations. Precise Word layout and embedded pictures are not reconstructed.
Automatic excerpts have an 8000-character per-file and 16000-character per-message budget, conservatively measured in UTF-16 on Android. Large documents provide up to 1000 preview characters. CSV records and PDF pages remain whole; if the first unit exceeds the preview budget, metadata provides the starting position instead. Every excerpt explicitly reports next and eof.
The App keeps original copies and parsed caches under private filesDir/chat-file-attachments. An atomic manifest scopes drafts and access by gateway address plus the actual session ID. Interrupted imports are retryable after restart; send failures retain drafts. Referenced files survive draft removal. Currently unused copies are retained conservatively rather than garbage-collected.
Both /api/status and WebSocket session_start advertise file_attachments_supported; absence means unsupported. The SDK rejects file sends to older gateways. Existing image attachments remain unchanged. A separate files array carries ID, original name, MIME type, byte size, format, parse status, unit count and bounded excerpt. SQLite adds messages.files_json without deleting existing data; history responses restore file cards. The Agent expands file excerpts in user-role model inputs, keeping original question text and metadata in durable history. Regeneration preserves file metadata.
attachment_read takes attachment_id, start, and count, with no path or session argument. The handler authorizes against the session bound to its connection. Offsets are zero-based and end-exclusive: Unicode code points for text/DOCX, records for CSV (header at index 0), pages for PDF. Returns attachment_id, unit, start, next, total, eof, content; continue from next. Count is 1..16000; responses normally contain up to 16000 characters. A single intact record/page may contain up to 65536 characters plus source labels. Missing files, unauthorized IDs, failed parsing and invalid ranges return tool errors.
Additional reading requires the originating Android App and session connection online; gateways do not access phone paths. Reconnection registers the tool again. Cross-device and unattended reads need future gateway storage.
PDF extraction uses PdfBox-Android 2.0.27.0, Apache-2.0, without new native ABI libraries or optional JPX image decoding. DOCX uses platform ZIP/SAX. Release retains the project's disabled minification setting; R8-enabled builds are not claimed as verified.
Tests: cargo test -p clawseed-api -p clawseed-agent -p clawseed-gateway --lib; from clients/android, ./gradlew -PattachmentTestBuildType=release :app:testReleaseUnitTest :app:assembleReleaseAndroidTest :sdk:core:test :sdk:android:testDebugUnitTest. Release instrumentation uses an isolated cache directory. Verify compatible APK signatures, install both APKs with adb install -r, then run adb shell am instrument -w dev.clawseed.demo.test/androidx.test.runner.AndroidJUnitRunner. Never uninstall or clear the existing App to run tests. Device acceptance and artifact details are recorded separately in the working directory.
Image imports first persist the original and display a preview with a processing state, then encode and upload in the background. Preview publication does not wait for a gateway status request. JPEG photos use JPEG encoding while PNG screenshots retain lossless encoding. Interrupted preparation keeps the original for retry; failed uploads can be retried.
Receive Android shares¶
Choose ClawSeed in the system gallery or file manager share sheet to open a new conversation with attachment drafts and optional shared text. Single, multiple and mixed image/document shares are supported. The user sends the message explicitly; existing conversation drafts are preserved.
The receiver merges and deduplicates EXTRA_STREAM and ClipData URIs, copies temporary content grants into private storage, and uses stable receipt/item IDs for restoration without duplicate imports. A share supports up to four images and four documents: 50 MiB per original image, 20 MiB per document, 50 MiB total documents and 100 MiB overall. The processed-image upload limit remains 5 MiB. Source apps must grant URI read access; library-wide photo permission is not required. Unsupported or unreadable items report errors, and durable copies wait for the gateway connection before draft import.