Owner Questions
link-owner-questions holds the questions Link asks the owner of this
machine: a sandbox's call or page to open, or a program's question
through an agent's webhook. Each waits in one store until the first
answer, from whichever way it was asked, or until its time is up.
A question
A question names who asks (Asker): a sandbox by its name, or an
agent's webhook. It says what it wants, and lines saying more, such as
a call's arguments. Everything shown is cleaned first, without control
or invisible characters. A line longer than 600 characters is cut, and
a cut question carries a warning, since allowing it allows the part
that can't be seen. A page to open is shown whole, because each of its
characters is what's allowed.
The store
The store is ~/.lnk/questions/, a folder only the owner reads. A
question is <id>.json and its answer <id>.answer. An answer is
written aside, then linked in place, which fails when an answer is
already there, so the first answer is the one taken, across threads and
processes alike. An answer records whether it allowed the question and
which way of asking gave it: desktop, terminal, lnk or a
connection's name.
Its time
Every question expires, as its asker says, and is no once it has. Waiting stops at that deadline, or sooner when the asker stops it, and settles the question either way. A settled question's answer is kept ten minutes, so the other ways it was asked can say how it was answered. An answer to a question past its time is refused.
Where it was asked
The store keeps the chats a question was asked on (<id>.asked), so a
reply answers it only where it was asked. It keeps each owner's turn
under way too, a file under turns/ that its process holds a lock on
while it runs, so a question is asked where the owner is.
Who answers
A way of asking that answers an asker's questions holds a shared lock
while it does: a terminal on answering.<asker>, an agent's chats on
answering.agent-<agent>, which covers every question asked for it.
An asker whose question is refused at once when nobody would see it
checks that lock first.
The code
A question's id is six letters and digits, from an alphabet without lookalikes (no 0, o, 1, l or i). The id is also the code that answers it on a chat. Nothing in a sandbox reads the store, so the code is known only to the owner and to Link's own processes.
A reply
A reply is an answer only when it's the code alone, which allows the
question, or no and the code, which refuses it. Either is trimmed and
read in any case, so No K7M2QX refuses. Any other message is not an
answer.