Public: anyone can read this; the crew can change it.
The terminal registers, rotates and revokes an app too #30
commented
While this is in flight: a registration made in the terminal will not reach an open page, because src/live.ts is the web process's bus and the terminal is a second process on the same file. That is not this issue's job to fix — #65 adds the watcher that closes it — so don't build a second notification path here. Say plainly in the pull that a terminal registration shows on the next load until #65 lands, and keep calling the same actions so the watcher picks the row up unchanged.
Sign in to join this conversation.
Pull #22 gave the page and the JSON API the full set — register, rotate, revoke — and the terminal only
p, a read-only listing. AGENTS.md says what a person can do on the page they can do insrc/tty.ts, so the terminal is a door short of the others. The pull says so plainly and the README documents the limit; this is the follow-up it points at.Done looks like
src/tty.tsgrows the writes besidep: a key to register (prompt for an id, then a name, the same two-field flow the page has), a key to rotate the app under the cursor, a key to revoke it. They callregisterApp,rotateAppKeyandrevokeAppand decide nothing themselves — the admin-only rule already lives in the actions, so a guest or a plain user pressing them sees the action's own refusal on the status line, exactly aspdoes now.ptoggles between notes and apps; whichever, the key legend at the foot says what is available to the role at the keyboard, as it does today.said, which is redrawn on every keystroke.src/tty.tsneeds its identity key the waysrc/routes.tsnow takes one:appSecretis threaded, not read from the environment inside the module.src/env.tsalready exportsidentityKeyfor the process that has one; read it once at the top oftty.tsand pass it in, and print the action'sunavailablemessage when there is none.src/tty.tshas no seam for one today (it opens the database and grabs stdin at import). Give it one — a function that takes(db, who, identityKey)and returns the key handler — and test that a non-admin's keypress refuses, that a register prints a key once, and that a second redraw does not contain it.Files:
src/tty.ts,src/tty.test.ts,README.mdRisks: the status line is redrawn constantly, so a key held in
saidwould be printed over and over — keep the issued key out of any redrawn state. Prompting for two fields in a raw-mode handler is the fiddly part; the existingtypingflow is the pattern to copy.