Skip to content

Release v0.4.7#21

Merged
code-crusher merged 2 commits into
mainfrom
release/v0.4.7
Jul 13, 2026
Merged

Release v0.4.7#21
code-crusher merged 2 commits into
mainfrom
release/v0.4.7

Conversation

@code-crusher

Copy link
Copy Markdown
Member

What's new

This release introduces a file attachment system — users can now attach documents and images to their prompts for richer context.

Features

  • File picker — use /attach or Ctrl+F to open the native OS file picker (macOS, Windows, Linux)
  • Drag-and-drop — files pasted from the terminal are automatically detected as attachments (only when every pasted token is a supported file, so ordinary text is unaffected)
  • Document extraction — text is extracted from PDF, DOCX, XLSX, CSV, TSV, JSON, XML, YAML, Markdown, and plain-text files, bounded to 200K chars per file (500K total)
  • Image support — PNG, JPEG, and WebP images are validated by signature and sent as data URLs for vision-capable models; unsupported models show a clear warning
  • Composer UI — attached files are shown inline with indicators for type (📎), image vs document, and truncation; backspace on an empty prompt removes the last file; escape clears the composer
  • Attachment limits — 20 files max, 10 MB per file, 25 MB total source bytes; prevents abuse and keeps context manageable
  • Session persistence — attachment summaries are stored in transcript entries so they survive session save/resume

Dependencies added

  • mammoth — DOCX text extraction
  • pdf-parse — PDF text extraction
  • read-excel-file — XLSX text extraction

code-crusher and others added 2 commits July 14, 2026 00:18
…document extraction

Introduce a comprehensive attachment system that allows users to attach
files to their prompts via the native OS file picker (/attach or Ctrl+F),
drag-and-drop from the terminal, or the programmatic API.

Key changes:
- New src/attachments.ts module with file parsing, validation, and
  text extraction for CSV, DOCX, JSON, MD, PDF, TXT, XLSX, and images
  (PNG, JPEG, WebP)
- Document text extraction using mammoth (DOCX), pdf-parse (PDF),
  and read-excel-file (XLSX); plain-text fallback for other formats
- Image signature validation with proper MIME type detection
- Size and count limits: 20 files, 10 MB per file, 25 MB total,
  200K chars per file, 500K chars total
- AI SDK client updated to send image parts as data URLs for
  vision-capable models
- Agent runTurn now accepts attachments, formats them as XML context
  blocks, and sends images as multi-part content when the model
  supports them
- UI composer shows attached files with visual indicators, supports
  backspace-to-remove and escape-to-clear
- Drag-and-drop detection: multi-file paths pasted from the terminal
  are consumed as attachments only when every token is a supported file
- Queue system updated to carry attachments through multi-turn flows
- Session transcript stores attachment summaries for history/resume
- Updated README with attachment feature documentation
- Added test:attachments npm script and unit tests for path parsing,
  document extraction, and content limits
- Added dependencies: mammoth, pdf-parse, read-excel-file
@matterai-app

matterai-app Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary By MatterAI MatterAI logo

🔄 What Changed

This PR introduces comprehensive file attachment support to the OrbCode CLI. It adds the ability to attach images (JPEG, PNG, WebP) and documents (PDF, DOCX, XLSX, CSV, etc.) via a new /attach command, system file pickers, or terminal drag-and-drop. The core agent now handles multi-modal content, and the TUI has been updated to display attachment status and summaries.

🔍 Impact of the Change

Users can now provide rich context to the AI directly from the terminal. The system automatically extracts text from complex document formats and validates image integrity. This significantly expands the agent's utility for data analysis and vision-based tasks while maintaining strict resource limits (10MB per file, 500k characters total) to ensure performance.

📁 Total Files Changed

Click to Expand
File ChangeLog
Version Bump package.json Updated to v0.4.7; added mammoth, pdf-parse, and read-excel-file dependencies.
Multi-modal Client src/api/aiSdkClient.ts Added support for ImagePart in user messages for Vercel AI SDK integration.
Attachment Logic src/attachments.ts New utility for file picking, text extraction (PDF/DOCX/XLSX), and image validation.
Logo Colors src/branding.ts Defined immutable orbital colors for consistent branding across themes.
Agent Loop src/core/agent.ts Integrated attachment handling into the conversation turn and system prompt context.
Session Types src/core/sessions.ts Updated transcript types to include attachment summaries.
UI Orchestration src/ui/App.tsx Added message queuing for attachments and updated TUI layout for file display.
Branding UI src/ui/components/Header.tsx Updated header to use new immutable branding colors.
Input Handling src/ui/components/InputBox.tsx Implemented file drag-and-drop, /attach command, and attachment status display.
Row Rendering src/ui/components/rows.tsx Updated user block rendering to display attached file icons and names.
Attachment Tests test/attachments.test.ts New tests for path parsing, text extraction limits, and image signature checks.

🧪 Test Added/Recommended

Added

  • test/attachments.test.ts: Validates shell-escaped path recognition, text extraction from CSV, image signature validation, and character truncation logic.

Recommended

  • Add integration tests for the /attach command flow within the InputBox component.
  • Add unit tests for truncateExtractedText to ensure edge cases (very small limits) are handled correctly.

🔒 Security Vulnerabilities

  • Resource Exhaustion: Mitigated by MAX_SOURCE_FILE_BYTES and MAX_EXTRACTED_CHARACTERS_TOTAL limits.
  • File Injection: Image signature validation (validateImageSignature) prevents spoofed extensions.
  • Path Traversal: path.resolve and fs.statSync checks in droppedAttachmentPaths ensure only valid files are processed.

@code-crusher code-crusher merged commit 9235ea3 into main Jul 13, 2026
1 check passed
@code-crusher code-crusher deleted the release/v0.4.7 branch July 13, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant