Skip to content

Add outlook.get_conversation.v1 + binary transfer profile (ERMAIN-501) - #887

Open
bdart wants to merge 2 commits into
mainfrom
feature/ermain-501-get-conversation-transfer-profile
Open

Add outlook.get_conversation.v1 + binary transfer profile (ERMAIN-501)#887
bdart wants to merge 2 commits into
mainfrom
feature/ermain-501-get-conversation-transfer-profile

Conversation

@bdart

@bdart bdart commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What changes

Adds the outlook.get_conversation.v1 method and a binary transfer profile to the desktop-sidecar protocol contract. This is the protocol half of ERMAIN-501; the sidecar implementation is EratoLab/erato-desktop-sidecar #19, which vendors the packaged spec produced here.

The method lets the Outlook add-in load a whole mail thread with bodies and any-size attachments from the local Outlook store, bypassing the makeEwsRequestAsync caps (~1 MB / 5 MB) that degrade Exchange SE thread loading to body-less markers.

Shape (aligned to the ticket's design):

  • Params{ mailboxId, anchor: { internetMessageId }, maxMessages? }. Anchored by RFC 5322 Message-ID, not the Office.js conversationId.
  • Result{ state, mailbox?, messages[], warnings[] }. state is ok | partial (maps to the add-in's ConversationFetchState); partial + a warnings[] entry when maxMessages truncates or an attachment can't be read.
  • MessageinternetMessageId, subject, from/to/cc (recipient objects), sentAtUnixSeconds/receivedAtUnixSeconds, isDraft, conversationIndex, bodyHandle, attachments[].
  • bodyHandle { handle, contentType, size } — the body is not inline; it is fetched via the transfer profile, so a multi-message HTML thread can't blow the 262,144-byte JSON-RPC cap.
  • Attachment{ name, contentType, size, isInline, contentId, sha256?, contentHandle | unavailableReason } — bytes via contentHandle, or unavailableReason when they can't be produced. Embedded messages are reported as contentType: message/rfc822 (converted, no proprietary type).

Transport (TRANSPORT.md): GET /erato/sidecar/transfer/v1/{handle} serves unbounded bytes outside the RPC cap; opaque, runtime-scoped, expirable handles; same Host/Origin/CORS/PNA validation as the RPC endpoint (ERMAIN-500).

New schemas: outlook-get-conversation-v1-{params,result}, outlook/{conversation-message, message-recipient, attachment-reference, body-handle, conversation-warning}; OpenRPC method + x-erato-capability; regenerated TS + AJV validators; reference server.ts handler; package 0.1.5.

Verification

pnpm run check green: prettier, validate (30 schemas + openrpc + examples + conformance), check:generated, tsc, 30 vitest tests. pnpm run package-spec produces erato-desktop-sidecar-protocol-spec-0.1.5.tgz (the artifact the sidecar vendors; release/ stays gitignored).

Follow-up

Reference server.ts mocks the RPC method; a reference transfer-endpoint mock + conformance fixture for the byte profile is a deliberate follow-up (the real, tested implementation is the sidecar).

🤖 Generated with Claude Code

https://claude.ai/code/session_01YNRaKxV2kk7SfPJN6sccME

Comment on lines +55 to +84
`GET` is not accepted on the RPC endpoint, so JSON-RPC payloads cannot appear in
URLs, browser history, or intermediary caches. RPC responses set
`Cache-Control: no-store`. `GET` is used only on the separate binary transfer
endpoint below, whose URLs carry an opaque handle rather than any JSON-RPC
payload.

## Binary transfer profile (unqualified)

Some results reference bytes that exceed the 262,144-byte JSON-RPC body, such as
the attachments and embedded messages of `outlook.get_conversation.v1`. Those
bytes are never base64-encoded into the JSON-RPC response. Instead the method
result carries an opaque transfer handle for each object, and the client fetches
the bytes from a separate loopback endpoint.

| Property | Candidate value |
| --------------------- | ------------------------------------------------------------ |
| URL | `http://127.0.0.1:23123/erato/sidecar/transfer/v1/{handle}` |
| Methods | `GET` for retrieval; `OPTIONS` for browser preflight |
| Response content type | the object's own media type, else `application/octet-stream` |
| Response size | unbounded; the 262,144-byte JSON-RPC cap does not apply |

A handle is minted by the sidecar inside a method result (for example an
attachment's `transferHandle`). It is opaque, unguessable, and valid only within
the same sidecar runtime that issued it; it may expire. The transfer endpoint
enforces the **same** `Host`, `Origin`, and CORS/private-network validation as
the RPC endpoint — an unlisted origin is refused identically — so a handle is
usable only from an allowlisted Erato origin. A successful `GET` returns `200`
with the exact bytes, `Content-Length`, the object's media type, and
`Cache-Control: no-store`. An unknown or expired handle returns `404`. Range
requests are not part of v1; each `GET` returns the whole object.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bdart Please don't let it add new endpoints like this one, that happen outside of JSON-RPC, as that will create a hard-to-maintain interface outside of the JSON-RPC mechanism, where we can create good versioning enforcement.

It appears that the cause for this was some arbitraty body size limit. That limit (which is likely arbitrarily enforced by client or server) should be lifted instead.

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.

2 participants