Conversation
…d the Pi/OpenCode poll fields The server, store and connections for sending a new message to a connected agent (approval record inbox-compose-to-agent): - InboxStore.startPersonThread: a root person message addressed to one live session (started_by_person, to), never a session's default thread; the agent's reply_to answer lands in it. readdressMessage for Send to another session. The list row carries the addressee. - Routes (packages/server/inbox-compose.ts): GET /api/inbox/sessions (every live session, grouped by project), POST /api/inbox/messages (409 session_not_live, nothing written), POST /api/inbox/messages/:id/to, drafts (inbox/drafts/, compare-and-set, outside the event log) and streamed uploads (inbox/uploads/, 100 MB, dotenv refused) that become ordinary attachments at send. - The wake: new_thread on the bridge command and INBOX_NEW_THREAD_INSTRUCTION in the connection contract (mirrored into the mod); older connections fall back to the New message line. - InboxWake (Pi, OpenCode) polls with project_path, started_at, busy and idle_since, and posts state events, as the Claude Code mod does. - Tests: the thread-state model gains personStart and deliver (and trace hand-19), route tests, upload/sweep tests, the mod, the real Pi and the OpenCode wake. Docs: CLAUDE.md, the agent guide, the reference page.
…ressed session; such a reply can be sent to another session
…d the thread, racing Sends leave no files - More words in a thread the person started are stamped with the root's to when written, so no other agent's read_thread or wait_for_reply settles them - A follow-up moved to a session that has seen nothing of the thread wakes it with continues_thread (inboxContinuesLine: read the thread first) - Two Sends racing with one key: the store's replayed is returned, and files copied for a replayed or refused Send are removed - Upload names refuse C1 controls, U+2028/2029 and bidi controls (the thread name's sets) - Sent uploads are copies (a clone where available), not hard links; read-only outside Windows - wait_for_reply's result carries the Attached: lines; re-address refuses an archived thread
…rver # Conflicts: # AGENTS.md
…rver # Conflicts: # AGENTS.md # apps/marketing/src/content/docs/reference/inbox.md
…es to the same session
…rver # Conflicts: # adr/implementation/inbox-thread-state.md # apps/marketing/src/content/docs/reference/inbox.md
…rver # Conflicts: # packages/server/inbox-devices.test.ts
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The server, store and connection half of the owner-approved Inbox compose: sending a new message to a connected agent (approval 2026-10-14, "Yes, as mocked with these answers"; design record
.product/approved/inbox-compose-to-agent/, not in this repo). Part 2 (the window) is #1922, stacked on this branch.What it adds
InboxStore.startPersonThread). The root is the person's message:started_by_person: true,reply_to: null,to: { host, session }, and a subject derived from the body. Question blocks in it stay text, with no question records.indexRootindexes agent roots only. Only areply_toanswer lands in it.isForbyto) and settled only by delivery.addressee, so the window can draw the agent's mark instead of the person's.readdressMessage,POST /api/inbox/messages/:id/to). It re-addresses a person message withtothat no session has taken yet: a thread the person started, a New message, or a redirected reply. The new session must be live in the thread's project. The store writes a new snapshot of the same message. This also closes the documented gap where a New message to a session that ended was never offered elsewhere.isForfollows the root's currentto. Such a reply can also be sent to another session (added in5fab00ff7).packages/server/inbox-compose.ts). Each is a window route: same origin,serverSession, the owner's tailnet page allowed, and no phone-door entry.GET /api/inbox/sessions: every live session, grouped by project. A folder new to the Inbox hasid: null.POST /api/inbox/messages: answers409 session_not_livewhen the session is not live, and writes nothing.GET /api/inbox/drafts,POST /api/inbox/drafts/:id(compare-and-set onupdated_at,409 draft_conflict), andPOST /api/inbox/drafts/:id/delete.POST /api/inbox/uploads: takes the raw body.packages/shared/inbox/drafts.ts). Each draft is one 0600 file underinbox/drafts/, outside the event log. Agents, the MCP, phones, the relay and search never see them. Each list entry carries its chip (live,endedornone). Sending withdraft_iddeletes the draft. Settings' Storage counts the drafts.packages/shared/inbox/uploads.ts).blobs/, never held whole. Over 100 MB is refused, which stays under the 128 MiB request bound. The kind comes fromdecideInboxAttachmentKind.InboxAttachment: a read-only hard link of the blob atinbox/uploads/<att_id>/<name>. The existing tiles, viewers and download routes carry it unchanged.new_thread: true, andinboxWakeTextpicks a new fixed constant,INBOX_NEW_THREAD_INSTRUCTION. The existing instruction bytes are unchanged. It is pasted into the mod'sinbox-contract.ts, and the parity test passes.Attached: <name> (<path>)lines.InboxWakenow sendsproject_path,started_at,busyandidle_since, and postsstateevents, as the Claude Code mod does.project_pathis Pi'sctx.cwd, or OpenCode's sessionlocation.directory. Their sessions are now listed under their real project from the first poll.Tests
store-person-thread.test.ts.personStartanddeliverops in the property runs. The routing-determinism oracle now includes person roots.hand-19-person-started-thread; no existing fixture changed.uploads.test.tscovers the cap, the sweep, and how deletion treats pending and sent uploads.inbox-compose.test.ts:409with nothing written; replay; stale tab; cross-site;already_delivered;InboxWakepoll fields and state events.apps/hook/hooks/mod/inbox.test.ts11.apps/pi-extension/inbox.test.ts02b.inbox-v2-wake.test.ts.bun test packages/shared/inbox packages/server packages/core apps/hook/hooks/mod apps/hook/server/inbox-help.test.ts tests/never-touch-the-real-inbox.test.ts: 2369 pass, 0 fail.bun test apps/opencode-plugin apps/pi-extension/inbox.test.ts: 380 pass, 0 fail.bun run typecheck: clean.Docs
plannotator inbox --help: a line on threads the person starts.drafts/anduploads/on disk.Not in this part
Second review fixes (6d63e4c)
toon their own line (sendReply), so only that session is handed them and only its delivery settles them. Another agent'sread_threadorwait_for_replyno longer settles them.continues_thread: true.inboxWakeTextthen addsinboxContinuesLine, which tells the agent to read the thread first withread_thread.replayedis returned, and the copied files of a replayed or refused Send are removed.COPYFILE_FICLONE, a clone where the filesystem has them), never hard links, so an agent writing to its file cannot change the blob. They are read-only outside Windows.wait_for_reply's result carries theAttached:lines (inboxBodyForAgent, the one helper the bridge uses too). Re-addressing a message in an archived thread is refused withthread_resolved.Main merged again (a3e2efc): #1919, #1921, #1923, #1914
resolveProject. The live sessions use the shared project-root cache, so a session working in a linked worktree is listed under its main repository, and its thread lands in that repository's project.503 project_unresolved("…try the same call again") and writes nothing. The pending uploads stay, so the same Send goes through once git answers. Tests are ininbox-compose.test.ts, "worktrees and a slow git".