Skip to content

feat: add composer attachments with owned storage - #157

Merged
BunsDev merged 13 commits into
mainfrom
attachments
Oct 11, 2026
Merged

BunsDev merged 13 commits into
mainfrom
attachments

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Adds composer attachments through the existing Claude and Codex CLIs: pick, drop or paste files, remove chips, and send with or without text. App-owned drafts preserve text and files across thread/project switches and failed sends; pending copies block submission. The responsive composer now reaches 960px and rests at 109px.

Main owns private copies, validates metadata and byte limits, enforces 20 attachments per message and 5 MiB image/25 MiB file limits, and checks file identity during claim, access and cleanup. Authenticated development uploads use the same store. Raster thumbnails reject forged image content, and opening an attachment reveals its location. Store attachments report unavailable in both offline and connected modes.

Validation:

  • Build, typecheck and unit/HTTP/Store suites: 621 passed, one existing optional skip.
  • Two native integration checks passed for Space project drafts and Streamer masking with original metadata/bytes preserved.
  • Full MODEX_TEST_OPEN_KNOWLEDGE=1 E2E: 199 desktop tests and 7 site tests passed, zero failures or skips.
  • Real Claude Code 2.1.289 and codex-cli 0.162.1 runs read the controlled image and text file correctly, preserving exact bytes. Receipts match all 20 source/build hashes on the final reviewed runtime.
  • Whole-integration SPEC and QUALITY passed, including the ownership-safe cleanup repair and final test corrections.

An earlier full run had a stale menu-order assertion and an unexplained Space resize mismatch. The menu assertion was corrected; five instrumented diagnostics, the focused original panel sequence, and the final full run passed without changing resize code or relaxing its exact width assertion. The original resize cause remains unproven and is retained in the evidence.

Issue #159 acceptance and live CLI evidence are recorded in the review. Store attachments remain unavailable, including connected mode. Fresh protected current-head CI is required before landing.

@vercel

vercel Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 11, 2026 11:16am UTC

Request Review

BunsDev and others added 2 commits October 9, 2026 20:16
Files are staged under <home>/attachments/staging the moment they arrive (drop anywhere in
the window, paste, or the composer's paperclip), shown as chips whose thumbnails load over
the app's own modex-attachment: scheme (served only from that root), and moved into
attachments/<thread id>/ on send, where the user item records them. Images reach Claude as
base64 blocks on the stream-json user message and Codex as localImage inputs; other files
are named by absolute path in the prompt, with --add-dir so Claude reads them without a
prompt. Limits: 5 MB per image, 25 MB per file, 20 per message. Retry reuses the files;
deleting the thread removes them. The Store demo reports attachments as unavailable.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The layout spec fixes `+` at x 690 and the access pill at x 708, so the paperclip now follows
the pill. The user bubble stays the element it was; attachment chips render as a sibling
below it, right-aligned like the bubble.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@BunsDev BunsDev left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against #159 at 44ac57a.

The desktop attachment flow looks good:

  • Storage is confined to its own folder, and the modex-attachment: scheme resolves only paths inside it.
  • The staging sweep is safe. On macOS, copyFileSync gives the copy a fresh mtime (tested), so the 24h sweep can't remove a file that was just attached.
  • Both CLIs are handled without an API path.
  • CI is green on this head.

Gap: the Store edition when connected to a host. Only the offline demo is handled.

  • apps/store-desktop/src/main/preload.cjs has no pathForFile, so every file goes as base64 through DesktopHost. Its request limit is 1 MB (desktop-host.ts, body()), so files over about 750 KB fail with "Request is too large."
  • attachments:pick is localOnly, so the paperclip fails with "Unknown desktop command."
  • The Store main process doesn't register modex-attachment://, so no thumbnails appear.
  • Fix in progress on this branch: report attachments as unavailable while connected, as the demo does.

Minor:

  • attachments:open calls shell.openPath. Pasted bytes are written without a quarantine mark, so a pasted script opens without a Gatekeeper prompt. showItemInFolder for non-images would avoid that.
  • The 20-per-message limit is enforced only in the renderer.

Not covered here from #159:

  • The composer width (736px → 960px).
  • The live check with each CLI, which is still unticked in the test plan.
  • Add Closes #159 if this PR is meant to close it.

The App Store edition forwards workspace requests to its paired host, but
attachments cannot cross that bridge yet: the host rejects requests over
1 MB, attachments:pick is local-only there, and the Store main process does
not serve modex-attachment: thumbnails. Answer every attachments:* request
in the Store main process instead of forwarding it: stage and pick report
"Attachments are not available in the App Store edition yet.", discard is a
no-op and open throws the same message. The offline demo keeps its own
message, now shared from the same module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Return validated turn-scoped permission profiles for the installed Codex protocol. Deny malformed or declined requests without granting session scope. Include backend and schema validation evidence.
Wait for matching native and renderer content bounds before exact layout assertions; retry Knowledge file visibility across responsive sidebar changes. Keep the scripted demo independent of login-PATH discovery.

Validated on current main with build, unit tests (468 passed, 1 skipped), typecheck, 166 desktop E2E tests including real OpenKnowledge, and 7 site tests. Independent code and integration review passed.

Assisted by Codex.
Track every accepted companion socket and destroy it during close so incomplete TLS handshakes cannot delay dispose. Add the half-open shutdown regression and update status evidence.

Verified local build and 469 unit tests (one skip), independent integration review, and both current-head required macOS and iPhone workflows. The one diagnostic macOS rerun passed; the earlier empty-app close timeout remains unreproduced and unresolved.
Disable the simulator hardware keyboard before its first CI boot and log the resulting setting. This keeps the software keyboard available to the existing focus fallback without changing local Simulator preferences.

Verified unchanged reviewed tree, build and 469 unit tests (one skip), independent review, and all four current-head hosted checks. Both iPhone jobs logged hardware keyboard 0; both macOS jobs passed 166 desktop and 7 site cases.
Identify the optional Jev CLI as unofficial in the README.

Preserve the original one-word wording change on the verified current-main integration.
Align Graphite chat rows, hover details, Space navigation and page controls with the supplied references. Add local comments with per-page drafts and a floating view of the existing CLI chat.

Keep page selections and component identity scoped to each document, and hide the native Knowledge guest while floating chat is open. Preserve composer state, keyboard navigation, saved sidebar widths and local Markdown operations.
Apply pending focus ranges after the committed textarea update so a delayed callback cannot collapse a newer selection. Share the Code command caret position with toolbar insertion.

Verified with build, typecheck, 470 unit tests (one optional skip), 171 desktop E2E tests with real Knowledge, and seven site tests. Native regressions reproduced each original failure before the fixes.
Keep Modex usable in Streamer Mode with display-only secret masking, native editable values and terminal input preserved, and covers scoped to embedded Browser and Knowledge panes. Mask comment excerpts in full without changing saved quotes or clipboard values.

Verified build, typecheck, 475 unit passes (one optional skip), 175 desktop E2E cases including three real Knowledge integrations, seven site tests, and independent source review. Preserve documented heuristic and human-acceptance limits.
Preserve unique historical Space/Knowledge verification outcomes and the original WorkOS/GitHub design proposal beneath a supersession banner. Record which unfinished snapshots are already delivered, while retaining their dirty source and probes.

Three documentation files only. Final independent review, build, typecheck and 475 unit passes (one optional skip); both required hosted macOS checks passed the full 175 desktop and seven site tests. The editor focus failure exposed by the first audit CI was fixed separately in #170.
Integrate private attachment storage, transactional ownership and limits,
project/thread drafts, native and development uploads, and safe previews/reveal.
Preserve incoming Space and Streamer behavior and original attachment ancestry.

Verified with build, typecheck, 621 unit passes plus one existing skip,
199 desktop E2E passes with real OpenKnowledge, seven site passes, and
both installed Claude and Codex CLIs. Preserve the initial failed run and
its unresolved resize observation alongside the final complete passing run.
@BunsDev BunsDev changed the title Attach files to a message: drop, paste or pick, then send to either CLI feat: add composer attachments with owned storage Oct 11, 2026
@BunsDev
BunsDev merged commit 5e80b46 into main Oct 11, 2026
5 checks passed
@BunsDev
BunsDev deleted the attachments branch October 13, 2026 12:48

This branch was successfully deployed

1 active deployment
Preview — 21784a9e Deployed Oct 11, 2026 by vercel[bot]
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