Repository navigation
feat(account): connect, reconnect, pending, limits, pause, resume, unblock and delete - #39
Merged
Merged
Conversation
…block and delete
`reply account` gains the verbs that manage the accounts a send goes from, so an agent can have an
email or LinkedIn account connected without opening Reply's web app:
- `connect` and `reconnect` print a link for the person who signs in to open. Email uses Reply's
one-mailbox connection link (`POST /v3/email-accounts/connection-link`, `/{id}/reconnect`),
LinkedIn its connection link and reconnect. A connection link connects one account, works once
and expires.
- On a Reply without the email link routes (404, no code) the email verbs refuse with
`email_link.not_available`. Only `--allow-shared-page` prints the hosted mailbox page from
`GET /v1/SharedPageUrl` instead, the provider's connect with `--provider` and the index without,
with `link_kind: "shared_page"`, `expires_at: null` and a warning: that address does not expire
and lets its holder manage all of the user's mailboxes.
- `pending` lists the unused links of both channels without the links; email answers
`supported: false` where Reply has no such list.
- `limits` reads or changes an email account's safety section or a LinkedIn account's limits.
- `pause` and `resume` read a LinkedIn account's state and toggle only when needed; email has no
pause in Reply's API. `unblock` clears a provider's block on a mailbox.
- `delete` needs `--yes`; `--force` adds Reply's own force for LinkedIn.
A link and any token in it are printed once, in the stdout field `link`. `--verbose` now traces
the account commands' calls, with every link and token in them replaced by `<link redacted>`, and
no error or stderr line carries one; a test runs every link verb with `--verbose` against a stubbed
Reply and fails on any sight of the token. Reply's own refusal code is the error's code.
…e the CLI's error codes The shared page's answer was read only as an object with a url field. A bare string was refused as unreadable, and under --verbose the trace printed it whole, token included, since only link fields of an object were redacted. A string body is now read as the address, and the body of the shared-page call is a secret whatever its shape: the trace never shows it, every address and single-value string in it is redacted wherever else it appears, and a refusal built from it has them replaced too. The secret test gains rows for a bare-string answer, a bare token, text and an object with no address, and a refusal quoting the address. Reply's refusals of the account routes now come under the CLI's own codes, in the form the other work commands use (email_account.not_found, linkedin.account_in_use, linkedin.invalid_cookie, …), with Reply's code in reply_code; one with no code of its own reads as every refusal does, e.g. reply.refused. sharedPage.notEnabled becomes shared_page.not_enabled. The help and README follow.
ArtemKosolap
marked this pull request as ready for review
November 12, 2026 05:52
vigubikReply
requested changes
Nov 12, 2026
…r states before any write Reply's toggle turns an enabled account off and any other state on. A pause from dailyLimitReached therefore turned the account on and then failed with account.status_changed. Pause now flips only from enabled and resume only from disabled. An account already in the asked state is left alone as before; pause at the daily limit is refused with the new account.pause_unavailable, and a state the CLI does not know with account.status_unknown, both before any write.
Without reconnect=true the hosted page counts the sign-in as a new mailbox, so a user with no free mailbox slot was sent to that error instead of reconnecting. account reconnect --allow-shared-page --provider now adds the flag to both the Gmail and the Office 365 connect. The index is printed as before: the hosted page adds the flag itself when a mailbox already on it is reconnected.
vigubikReply
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
reply accountgains eight verbs next tolist, so an agent can have an email or LinkedIn account connected, limited, paused or removed without anyone opening Reply's web app:connect --channel … [--provider gmail|office365] [--name N] [--allow-shared-page]POST /v3/email-accounts/connection-link {provider, name?}POST /v3/linkedin-accounts/connection-link {name}reconnect <id> --channel … [--provider …] [--allow-shared-page]POST /v3/email-accounts/{id}/reconnectPOST /v3/linkedin-accounts/{id}/reconnectpending [--channel …]GET /v3/email-accounts/pendingGET /v3/linkedin-accounts/pending, withoutconnectionLinklimits <id> --channel … [--daily N] [--set <json>]GET/PATCH /v3/email-accounts/{id}safetyPUT /v3/linkedin-accounts/{id}/limits, read back byGET /v3/linkedin-accounts/{id}pause/resume <id> --channel linkedinPOST …/toggle-statusonly fromenabled(pause) ordisabled(resume)unblock <id>POST /v3/email-accounts/{id}/resume-sendingdelete <id> --channel … --yes [--force]DELETE /v3/email-accounts/{id}DELETE /v3/linkedin-accounts/{id}[?force=true]connectandreconnectprint{channel, [id], link, expires_at, pending_id, kind, link_kind}.pendingprints{items: [{channel, id, name, kind, account_id, expires_at, expired}], supported, unsupported_channels}.Why
A person connects a mailbox or a LinkedIn profile on Google's, Microsoft's or LinkedIn's own page, so an agent only needs a link to hand them. Reply's v3 already issues those links for LinkedIn. For email, the one-mailbox link routes are new in Reply and not yet on every environment.
How it works
code),connect/reconnect --channel emailrefuse withemail_link.not_available, exit 1, and print nothing. Only--allow-shared-pagemakes them callGET /v1/SharedPageUrland print the hosted mailbox page, withlink_kind: "shared_page",expires_at: nulland awarning. That address does not expire and lets its holder manage all of the user's mailboxes, deletion included. With--providerit is that provider's connect on the hosted page (ConnectWithGMail?uidToken=…,ConnectWithOffice?uidToken=…&isExchange=false, built from the v1 address's token insrc/operations/shared-page.ts). Forreconnectboth provider forms carry&reconnect=true: the hosted controller checks!reconnect && WouldBuySeatAsync()before it redirects to the provider, so without the flag a user with no free mailbox slot, which the broken mailbox itself takes, would land on the NoFreeMailboxSlots error instead of reconnecting. Without--providerit is the hosted index, unchanged forreconnect: the person reconnects by opening the existing mailbox there, and the hosted page addsreconnect=trueto the provider's connect itself whenever the mailbox it shows already exists, so the controller's free-slot check is skipped the same way.shared_page.not_enabledis the plan without hosted pages (v1 gives no code, so the CLI names it). The v1 answer is read as{url}or as a bare string, and its body is treated as a secret whatever its shape (below).--provider,connect --channel emailis a usage error unless--allow-shared-pageis given. With the flag, a read ofGET /v3/email-accounts/pendingtells the two kinds of Reply apart: one with the links answersemail_link.provider_required, and one without gives the hosted index.link, and never on stderr, in errors or in logs. The global--verbosenow traces the account commands' calls curl-style (request, status, headers, body). Every link Reply answers (connectionLink,url), and every token in it, is replaced there by<link redacted>. That covers headers too.reply_code:emailAccount.notFound(404) isemail_account.not_found,emailAccount.limitReached(409) isemail_account.limit_reached,emailAccount.noFreeMailboxSlots(409) isemail_account.no_free_mailbox_slots,emailAccount.reconnectNotSupported(400) isemail_account.reconnect_not_supported,linkedInAccount.notFound(404) islinkedin.account_not_found,linkedInAccount.limitReached(409) islinkedin.account_limit_reached,linkedInAccount.accountInUse(409) islinkedin.account_in_use, andlinkedInAccount.cookieInvalid(400) islinkedin.invalid_cookie. Any other answer is read the way every other operation reads it (reply.refused,access.feature_unavailable, …).deletehas no prompt: without--yesit is a usage error and nothing is sent.--forcewith email is a usage error.pause/resume: Reply's toggle turnsenabledoff and every other state on, sopausecalls it only fromenabledandresumeonly fromdisabled. An account already in the asked state is left alone (changed: false); at its daily limit an account is active, soresumeleaves it alone andpauseis refused before any write withaccount.pause_unavailable(details.reply_statuscarries Reply's word). They also refuse a disconnected account (linkedin.invalid_cookie), a state the CLI does not know or cannot read (account.status_unknown, also before any write), and a toggle that landed on the wrong state because someone changed it in between (account.status_changed).What it does NOT do
pendingnever prints one.expires_atis null there.account pendingreads the expiry of a LinkedIn connect.Verification
npm run build(tsc, which is also the typecheck): clean. The repo has no separate lint or typecheck script.npm test(vitest): 66 files, 1075 passed, 5 skipped. 63 of the tests are new:account-links.test.ts(25),account-manage.test.ts(17),account-secrets.test.ts(20), plus 1 incommands.test.ts.account-manage.test.tsruns pause and resume from each status Reply gives (one toggle fromenabledfor pause and fromdisabledfor resume, none from any other), pause at the daily limit, and unrecognised or unreadable statuses for both verbs.account-links.test.tschecks the shared page's reconnect form for each provider and the index.account-secrets.test.tsruns every link verb with--verboseagainst a stubbed Reply, using a token generated for each run. The cases are email and LinkedIn connect and reconnect, the shared page for each provider and the index on both connect and reconnect, the shared page answered as a bare string, pending, and six error paths: a shared page in an unreadable form, answered as a bare token, as text, as an object with no address, refused with the address in the refusal, and an answer without a usable link. One case goes through the real program entry point. Each case searches the whole of stderr, the trace and the thrown error for the token, its encoded form and the printed link, and fails on any hit. It also checks that the token is on stdout exactly once, inlink. With the trace redaction disabled, all 13 original cases fail; with the shared-page body not treated as a secret, the four rows whose answer holds no readable address fail.