Public: anyone can read this; the crew can change it.
An approved message opens ready to send in the agent's own Mail or Messages app, from the lead's page #62
Check · Review · Land · Live done — Landed and live in production.
Each sent message in a lead's history now has an "Open in Mail" or "Open in Messages" link that opens it, ready to send, in the agent's own app. The new tests pass (src/handoff.test.ts), as do the README, notes and quiet-hours suites.
shipped production is serving it deploy aba151a
Each sent message in a lead's history now has an "Open in Mail" or "Open in Messages" link that opens it, ready to send, in the agent's own app. The new tests pass (src/handoff.test.ts), as do the README, notes and quiet-hours suites. I did not run bun x tsc --noEmit: the repo has no tsconfig.json, and in this sandbox tsc only printed its help text. There is no scripts/gate.ts or scripts/fast.ts. I ran scripts/lint-design.ts; it printed nothing.
What changed
src/handoff.ts: new module, one function,handoff(message, lead). It returns{href, label}or null.
- Email: mailto:<to>?subject=…&body=…. The body is the approved text, a blank line, then the signature. The subject is "Re: your inquiry" for the first reply and "Following up" for follow-ups.
- Text: sms:<digits>?body=…, with a leading + kept. The body is the same approved text plus signature.
- Encoding: every value goes through encodeURIComponent, so &, #, newlines and quotes are encoded.
src/pages/lead.ts: each sent message in the history gets the link under its words. Thehrefis HTML-escaped, so&between parts becomes&. There is no new JavaScript and the Content-Security-Policy is unchanged.- No link in these cases:
- drafts, scheduled, due, held and skipped messages (only sent gets one);
- a text to a lead who opted out;
- an email or a text when the lead has no address or number for that channel.
README.md: "What is real and what is not" now says the link is how a message actually leaves, and documents thesms:choice.src/handoff.test.ts: covers the exact URLs for email and text, the encoding of&,#, newlines and quotes, and no link for unapproved drafts, opted-out texts or missing addresses. It also checks the rendered lead page, including the escaped attribute and that the Messages link disappears after an opt-out.
Choices
sms:body syntax: I used?body=, which Android and current iOS read. I did not write the older iOS form?&body=. This is in the README.- Subjects: the email subjects above are my own wording. Nothing in the repo stores a subject for a message, so I chose these.
- Contract: no cell loosened and no actions changed. This is read-only rendering.
To try it: open a lead, send its first reply, and look at the History card. A lead with consent gets "Open in Messages"; one without gets "Open in Mail". Marking the lead as having asked to stop texts removes the Messages link.
🤖 Generated with Claude Code
Clean, read-only rendering: one small module, fixed mailto:/sms: schemes (no injection via lead data), every value encodeURIComponent-ed, href HTML-escaped, no JS, CSP untouched, no contract cell touched, tests cover URLs, encoding, drafts, opt-out and the rendered page. README updated.
Each sent message in a lead's history now has an "Open in Mail" or "Open in Messages" link that opens it, ready to send, in the agent's own app. The new tests pass (
src/handoff.test.ts), as do the README, notes and quiet-hours suites. I did not runbun x tsc --noEmit: the repo has notsconfig.json, and in this sandboxtsconly printed its help text. There is noscripts/gate.tsorscripts/fast.ts. I ranscripts/lint-design.ts; it printed nothing.What changed
src/handoff.ts: new module, one function,handoff(message, lead). It returns{href, label}or null.- Email:
mailto:<to>?subject=…&body=…. The body is the approved text, a blank line, then the signature. The subject is "Re: your inquiry" for the first reply and "Following up" for follow-ups. - Text:sms:<digits>?body=…, with a leading+kept. The body is the same approved text plus signature. - Encoding: every value goes throughencodeURIComponent, so&,#, newlines and quotes are encoded.src/pages/lead.ts: each sent message in the history gets the link under its words. Thehrefis HTML-escaped, so&between parts becomes&. There is no new JavaScript and the Content-Security-Policy is unchanged.- drafts, scheduled, due, held and skipped messages (only
sentgets one); - a text to a lead who opted out; - an email or a text when the lead has no address or number for that channel.README.md: "What is real and what is not" now says the link is how a message actually leaves, and documents thesms:choice.src/handoff.test.ts: covers the exact URLs for email and text, the encoding of&,#, newlines and quotes, and no link for unapproved drafts, opted-out texts or missing addresses. It also checks the rendered lead page, including the escaped attribute and that the Messages link disappears after an opt-out.Choices
sms:body syntax: I used?body=, which Android and current iOS read. I did not write the older iOS form?&body=. This is in the README.To try it: open a lead, send its first reply, and look at the History card. A lead with consent gets "Open in Messages"; one without gets "Open in Mail". Marking the lead as having asked to stop texts removes the Messages link.
🤖 Generated with Claude Code
Closes #60