Public: anyone can read this; the crew can change it.
The agent keeps a few saved replies (lender intro, open-house details) and drops one into any draft before approving it #83
Check · Review · Land · Live done — Landed and live in production.
The profile now keeps saved replies, and a lead's draft editor can insert one into the draft. The full bun test run passes (396 tests). I did not run tsc because the repo has no tsconfig.json.
shipped production is serving it deploy aba151a
The profile now keeps saved replies, and a lead's draft editor can insert one into the draft. The full bun test run passes (396 tests). I did not run tsc because the repo has no tsconfig.json. There is no scripts/gate.ts or scripts/fast.ts, and bun scripts/lint-design.ts printed nothing.
What changed
- New module:
src/replies.tsholds the limits, the two sample replies, the{first_name}fill, and the append logic. Only{first_name}is replaced. - Profile: the profile page lists and edits up to 12 replies, each a name of at most 40 characters and text of at most 1,000. They are saved with the profile, so the existing admin-only profile-update rule applies and no contract cell loosens. Over-limit input gets 422 at the boundary.
- Lead page:
POST /leads/{id}/insertappends the chosen reply to the draft and returns the page, unsent, with all output escaped. A text draft joins with a space and an email with a blank line. - Client script:
static/replies.jsdoes the same insert in place with JavaScript, and the plain form works without it. - Text length: the existing text-length handling still applies to an inserted reply.
- API and MCP:
- GET /profile returns the list and POST /profile accepts it.
- The MCP insert_saved_reply tool is new, and set_profile accepts replies.
- Both are documented in openapi.
- Samples: the sample profile ships a lender intro and an open-house invite until the agent saves a list of their own.
- README: it gains a short Saved replies section.
Tests
src/saved-replies.test.ts covers the 422 refusals, the {first_name} fill, <script> escaping, and insert leaving the draft unsent. I corrected three expectations in it that were wrong, not the code: a text draft joins with a space rather than a blank line, an anonymous caller gets signin_required, and MCP output is JSON-escaped.
Left out
No reordering of saved replies and no placeholders beyond {first_name}.
To try
Run the app, sign in as admin, open /profile to edit the replies, then open a lead with an unsent draft, choose Edit, and press Insert saved reply.
Clean. Saved replies live in the profile and go through the existing admin-only profile update, so no contract cell loosens. The insert door asks permit for lead update and is same-origin checked. Limits are refused with 422 at the boundary, and {first_name} is filled in one pass with nothing else interpolated. Output is escaped, and the tests cover <script> in a reply and an insert that leaves the draft unsent. Inserts into a text count against the text-length limit. The API, MCP tool, openapi and README are all updated, and two samples ship. I could not sign in to the preview, so this rests on the code and the tests. Minor, not blocking: a refused profile preview does not re-show typed replies.
The profile now keeps saved replies, and a lead's draft editor can insert one into the draft. The full
bun testrun passes (396 tests). I did not runtscbecause the repo has notsconfig.json. There is noscripts/gate.tsorscripts/fast.ts, andbun scripts/lint-design.tsprinted nothing.What changed
src/replies.tsholds the limits, the two sample replies, the{first_name}fill, and the append logic. Only{first_name}is replaced.POST /leads/{id}/insertappends the chosen reply to the draft and returns the page, unsent, with all output escaped. A text draft joins with a space and an email with a blank line.static/replies.jsdoes the same insert in place with JavaScript, and the plain form works without it.-
GET /profilereturns the list andPOST /profileaccepts it. - The MCPinsert_saved_replytool is new, andset_profileaccepts replies. - Both are documented in openapi.Tests
src/saved-replies.test.tscovers the 422 refusals, the{first_name}fill,<script>escaping, and insert leaving the draft unsent. I corrected three expectations in it that were wrong, not the code: a text draft joins with a space rather than a blank line, an anonymous caller getssignin_required, and MCP output is JSON-escaped.Left out No reordering of saved replies and no placeholders beyond
{first_name}.To try Run the app, sign in as admin, open
/profileto edit the replies, then open a lead with an unsent draft, choose Edit, and press Insert saved reply.Closes #78