An app profile writes drafts and asks HEY to send, which waits for you
Merged
JE
14d ago+1528+1528+0123456789012345678901234567890123456789-43-43-01234567890123456789
Context
- On a profile whose endpoint is the HEY app (#646), every write is refused: an agent can read the Imbox, the Screener and the drafts, but can't screen a sender, write a draft or ask for one to go.
- The door serves
screener.decide,draft.write,draft.replyandmessage.send; a send never goes on its own, it waits in HEY's window for the person to press Send. - Second of three: reads were #646; this is the writes and the wait; setup and the skill come after. Stacked on #646 (base
app-endpoint).
Change
- Under
HEY_EXPERIMENTAL=app, on an app profile: hey screener approve|deny <sender id or address>runsscreener.decide. An address is looked up in the app's own Screener, waiting and decided, any case; nobody there is exit 2. The answer is the server's shape (a list of the decided) withmeta.id_kind: "sender".hey compose --draft --to --subject -mrunsdraft.write;hey reply <thread> --draft -mrunsdraft.reply(<thread>istopic_idfromhey box view imbox). Both answer the draft underhey draft list's field names, say nothing has been sent, and suggesthey -P <profile> draft send <id>where HEY would send it.hey draft send <id>runsmessage.send: it answersmeta.status: "pending"with the confirmation and snapshot, says "Waiting in HEY for the person to press Send: nothing has been sent", and exits 9. Any other answer is exit 7, never read as a send.composeandreplywithout--draft,bulk-reply sendandforwardare refused before anything happens (exit 1), pointing at--draftand thenhey draft send.- Flags the door has no field for are refused, not dropped:
--cc,--bcc,--attach,--message-html,--from,--no-name-tagand--thread-idon compose;--to,--cc,--bcc,--replace-recipients,--from,--attach,--message-htmland--dry-runon reply;--box,--seen,--spamand more than one sender on the Screener. - The door's write refusals say what to do:
not_an_address,not_saved,not_a_sender,disabledand an id it does not hold (with the ids it would take);saved_not_listedandsession_endedare worded as "may have been done", never as refused. hey help exit-codeslists 9 under the gate only.- On every profile:
hey screener approve|denyalso take a sender's email address, looked up among the clearances waiting and then those decided (help,docs/cli.mdand the skill say so). - Where this follows #646 over the routing design (
routing-design.md, 11-11): the switch is the profile'sendpoint: appunderHEY_EXPERIMENTAL=app, not--local/HEY_LOCALunderHEY_EXPERIMENTAL=local; envelopes namemeta.endpoint: "app", notmeta.transport: "local"; the Screener's ids are named bymeta.id_kind: "sender", not acontact_id/clearance_idfield; the refusal points at--draftin the app's words, not "local mode"; a breadcrumb names-P <profile>where #640's named--socket.
Verification
internal/cmd/app_writes_test.go(21 tests) and four inscreener_test.go, against #646's fake door and a server that fails the test if reached.- Each behaviour red first against #646's head (cfd5879), 18 of 21 new app tests and all 4 server ones; the 3 flag-refusal tests already held there, since #646 refuses every write, and stay as guards.
TestAppWritesNeverReachHEYsServersetsHEY_TOKEN, so a fall-through would reach the server, and runs every verb above, answered and refused by the app; shown red by removingdraft send's app branch (2 requests reached the server).make checkgreen;.surfaceunchanged;GOOS=darwin,windows,linuxbuild.- A fresh review in its own context: no High; two Mediums and four Lows. Fixed in the second commit, each red first: an id the app doesn't hold is exit 2 (was 1); a capped address lookup is exit 7, not "not found"; a send cut off by the session's end says nothing has been sent without you; a disabled send with no
arghints the draft. Declined: the Markdown and--ids-onlypoints below. A second review of those fixes found one Medium and one Low in them (the draft named on every send refusal; the cap read from the cursor), fixed in the third commit, each red first; a third review of that fix found no High or Medium. - Bot review (cubic, Copilot): 9 threads, 6 fixed (one already by 6724516), 3 declined, 1 in part, with reasons in their threads; fixes in 9154df1, five tests red first.
- Unrun: a check against a running HEY Linux app with its door open.
Alternatives
- Turning a send into a draft quietly on the app: rejected, the word send would mean two things.
- Several senders per screening on the app: refused instead; the door decides one at a time, and a loop would need its own partial-failure report.
compose --thread-id --draftmapped todraft.reply: refused, pointing athey reply <thread> --draft, so a reply has one route.- The server's address lookup reads the waiting list and, only if needed, the decided list, each up to 100 pages; an address past that is not found.
- Breadcrumbs on a server profile keep no
-P: unchanged here; only the app's carry it, since an app draft id run on a server profile could name a draft HEY would send at once. -mreaches the door as written, though it is Markdown on the server: the door takes plain text, and converting throughhtmlutil.ToTextdrops every link's URL, changing the words the person is asked to send. Written as is, they read every character in HEY's window before pressing Send.--ids-onlyon a pending send prints the confirmation id, which may be a number: kept, as it is the one id a pending answer has; exit 9 and the stderr line say it waits.- A pending send's envelope is
ok: truewithmeta.status: "pending"and exit 9, not an error envelope: nothing failed, and a script tells it apart by the exit code ormeta.status, never byokalone.