Public: anyone can read this; the crew can change it.
Let the agent set their name, brokerage and license from the app #8
Check · Review · Land · Live done — Landed and live in production.
There's now a "Your profile" page at /profile, linked from the header, where an admin can set name, brokerage, license, phone and email. Every signed-in person can read it. bun test passes (78 tests) and bun run lint:design is clean.
shipped production is serving it deploy aba151a
1 earlier comment · 1 event
There's now a "Your profile" page at /profile, linked from the header, where an admin can set name, brokerage, license, phone and email. Every signed-in person can read it. bun test passes (78 tests) and bun run lint:design is clean. bun x tsc --noEmit could not run: the repo has no tsconfig.json or TypeScript dependency, so tsc just printed its help. There's no scripts/gate.ts or scripts/fast.ts, and I didn't try the app in the browser.
What changed
- Storage: the profile is a new
profiletable, added as a forward-only migration insrc/db.ts. The newsrc/profile.tsreads it, falling back to theAGENT_*variables until a profile is saved; after that the saved one wins. - Policy:
contract.jsongets aprofileresource: read isuser, update isadmin, create, delete and list are nobody. No existing cell is loosened, but the new resource means a person reviews this pull. - No
apipath incontract.json: the door turnsGET <api>into the "list" verb, which is nobody for profile. That would have shutGET /profileto everyone. The actions still askpermit, so the policy holds; the cost is that the door's own pre-check and the forge's probe don't cover this route. - Validation:
readAgentinsrc/actions.tschecks every field. All five are required, with length caps, no control characters or line breaks, a phone shape and an email shape. A blank or whitespace-only license is refused. - Saving:
saveProfilegoes throughaudited, so refusals are logged too. It rewrites the body and signature of every message not yet sent (draft, scheduled, due) and emitslead.changedso open pages refresh. Messages already sent are never touched; they keep the signature stored when they went out. - Reach:
- Pages:
layoutnow takes the current agent, so every page and the header show the saved profile. - API:
GETandPOST /profileanswer HTML to a browser and JSON to a script. They are incontract/openapi.json, regenerated withbun run contract:emit. - MCP and terminal: MCP has
get_profileandset_profile. The terminal's header shows the saved agent.
- Pages:
- Docs: the README's "Your profile" section tells people to use the page, and
AGENTS.mdnamessrc/profile.ts.
Tests
- New
src/profile.test.tscovers:- the env default before any save;
- a save changing the next draft and the unsent drafts but not a sent message;
- a user and a stranger being refused;
- a blank license and other bad input being refused;
- audit rows for both the save and the refusal.
src/contract.test.tshas the newprofiledoors, andsrc/server.test.tshas an end-to-end test of the page, the JSON twin and a cross-site POST.- I updated the MCP tool list in
server.test.ts, which enumerates the tools and now has two more.
Not done: there is no terminal command to edit the profile, only to see it. Say if you want one.
Try it: sign in as an admin, open "Your profile", save, then open any lead. The unsent draft's signature has changed, and a message already sent still shows the old one.
🤖 Generated with Claude Code
The web side is solid: permit is asked in the actions, the save is audited, input is validated, unsent drafts are redrafted and sent ones are left alone. Three things need fixing in one round.
- Both doors (fix first). An admin can edit the profile on the page, MCP and JSON, but not in the terminal (src/tty.ts / src/terminal.ts). The terminal only shows the header. Add a profile view and an edit for admins that goes through saveProfile, so the audit and live emit apply. Gate it as the page does: a guest sees nothing private, a user reads, an admin edits. Document it in the README. "Say if you want one" is not a reason to leave it out.
- Tests for the new doors. server.test.ts only checks that get_profile and set_profile appear in the tool list. Add tests that call them: a user calling set_profile is refused, an anon calling get_profile is refused, and an admin set_profile changes what get_profile returns. The terminal edit from item 1 needs a test too.
- contract.json. The profile resource has no api path, so the door pre-check and the forge probe do not cover GET/POST /profile. That is a hole in the audit, not a reason to leave it out. Either give it a path the door can map without turning GET into the list verb (and show the contract test or probe passes), or add a test that fetches /profile as anon, user and admin and compares the results with the table. Also say in the pull that a new resource with read=user and update=admin is added on purpose, because the issue is what authorises it.
Smaller point: layout and the terminal header now show the saved name and brokerage to anyone, guests included, while profile read needs a signed-in user. The old env values were already shown to guests, so this is a judgement call. Show only what the guest welcome page needs, or state that this is intended.
I did not run tsc or the preview. The pull says tsc cannot run in this repo.
All three requested changes are made and pushed. bun test passes (82 tests) and bun run lint:design is clean. tsc still can't run here, since the repo has no tsconfig or TypeScript dependency.
1. Terminal profile view and edit
- Pressing
pon the desk opens the profile throughgetProfile.- A guest gets "Sign in to read the profile" and sees no field values.
- A user reads it, and pressing
etells them only an admin can change it.
- An admin presses
eand types name, brokerage, license, phone and email in turn, with each field prefilled. Enter moves on and the last Enter callssaveProfile, so validation, audit, redrafting of unsent messages and thelead.changedemit all apply. - If validation fails (a blank license, say), the terminal shows the message, saves nothing and returns to the profile view, so the typed input is lost.
- The README documents the key. The screen hints and the
AGENTS.mdterminal notes are updated to match.
2. Tests for the new doors
server.test.tsnow calls the MCP tools:get_profileas anon is refused.set_profileas a user is refused withforbidden.set_profilewith a blank license is refused.- An admin's
set_profilechanges whatget_profilereturns.
terminal.test.tshas three new tests:- A guest sees nothing and a user can't edit.
- An admin edit is saved, audited, and shows up in the signature of an unsent draft.
- A blank license typed in the terminal is refused and nothing is saved.
3. Contract
- I did not add an
apipath, and I disagree with adding one. The door mapsGET <api>to the list verb andPOST <api>to create, and both arenobodyfor this resource. Any path the door can map would shut the page and the JSON twin to everyone, or force me to loosen list or create touser/admin, which the issue doesn't ask for. - Instead, a new test fetches
/profileas anon, user and admin, for both GET and POST. It compares each status withpermit(401 for anon, 403 for user on write) and checks that PATCH, DELETE and PUT are refused. - This is a new resource on purpose. Issue #6 asks for it with read=
userand update=admin, and nothing onleadorauditis loosened.
Guest visibility (smaller point)
Name, brokerage and license stay visible to everyone in the layout, the footer and the terminal header. They are the advertising disclosure, and the env values were already public, so I left that as it was and recorded it in a comment in layout.ts. Phone and email appear only on /profile and in the terminal profile view, and both need a signed-in user.
Earlier asks met: the terminal now reads (p) and edits (e) the profile through getProfile/saveProfile, gated by permit, with guest/user/admin tests; the MCP tools have tests for anon, user, blank license and admin; the contract has a test that compares /profile statuses with permit for all three identities. No existing contract cell is loosened. profile is a new resource (read user, update admin) that the issue asked for, so a person should look at it. The preview boots, / answers 200 and /profile answers 401 to a stranger. I could not diff against 0118e88 because the clone lacks that commit, so I read the whole change. Non-blocking: the terminal blank-license test has a stray , void current in its loop, which should just be t.key("\r") twice. Non-blocking: a failed terminal save drops what was typed. Non-blocking: profile has no api path in contract.json, so the forge probe skips it. The added test covers this, but check the forge accepts it.
There's now a "Your profile" page at
/profile, linked from the header, where an admin can set name, brokerage, license, phone and email. Every signed-in person can read it.bun testpasses (78 tests) andbun run lint:designis clean.bun x tsc --noEmitcould not run: the repo has notsconfig.jsonor TypeScript dependency, sotscjust printed its help. There's noscripts/gate.tsorscripts/fast.ts, and I didn't try the app in the browser.What changed
profiletable, added as a forward-only migration insrc/db.ts. The newsrc/profile.tsreads it, falling back to theAGENT_*variables until a profile is saved; after that the saved one wins.contract.jsongets aprofileresource: read isuser, update isadmin, create, delete and list are nobody. No existing cell is loosened, but the new resource means a person reviews this pull.apipath incontract.json: the door turnsGET <api>into the "list" verb, which is nobody for profile. That would have shutGET /profileto everyone. The actions still askpermit, so the policy holds; the cost is that the door's own pre-check and the forge's probe don't cover this route.readAgentinsrc/actions.tschecks every field. All five are required, with length caps, no control characters or line breaks, a phone shape and an email shape. A blank or whitespace-only license is refused.saveProfilegoes throughaudited, so refusals are logged too. It rewrites the body and signature of every message not yet sent (draft, scheduled, due) and emitslead.changedso open pages refresh. Messages already sent are never touched; they keep the signature stored when they went out.layoutnow takes the current agent, so every page and the header show the saved profile.GETandPOST /profileanswer HTML to a browser and JSON to a script. They are incontract/openapi.json, regenerated withbun run contract:emit.get_profileandset_profile. The terminal's header shows the saved agent.AGENTS.mdnamessrc/profile.ts.Tests
src/profile.test.tscovers:src/contract.test.tshas the newprofiledoors, andsrc/server.test.tshas an end-to-end test of the page, the JSON twin and a cross-site POST.server.test.ts, which enumerates the tools and now has two more.Not done: there is no terminal command to edit the profile, only to see it. Say if you want one.
Try it: sign in as an admin, open "Your profile", save, then open any lead. The unsent draft's signature has changed, and a message already sent still shows the old one.
🤖 Generated with Claude Code
Closes #6