Repository navigation
Messenger: one-run setup on any glibc 2.34 Linux, sessions from the phone, machine names, approvals in plain words - #422
Merged
Conversation
…m the phone Red before the change: Debian/Raspberry Pi OS refused, no bot profile, no gateway venv, the bridge unable to write the service home, no agent service unit, no create command in the bridge, no neu in the gateway. messenger-requirements.txt pins websockets 17.3 with every PyPI digest (hashed_requirements.py).
Bridge command create: the phone supplies a name only. The folder is DELFIN_MESSENGER_WORKSPACES/<name> (name reduced to [A-Za-z0-9._-], no leading dot, 40 characters; an existing entry is reused only as a real directory, never through a symlink). The session starts with the permission profile default, whatever the configured one is, and is enabled for the messenger so its chat follows without /sync at the computer. Unset root: refused. At most three starts per ten minutes. Gateway: neu NAME[: task] calls create, sets up and invites to the session's chat, and sends the task as the first prompt.
With qrencode on PATH the invitation is also drawn in the terminal (-t ansiutf8, the link as one argument, no shell); without it the link is printed with a note naming the package.
…inux - Platform: Ubuntu 24.04 keeps its build; any other Linux with glibc >= 2.34 (Raspberry Pi OS, Debian 12/13, RHEL 9) takes the Ubuntu 22.04 build, which needs glibc 2.34, OpenSSL 3, libgmp and zlib (ldd and objdump of the pinned v7.0.3 binary). Before, only Ubuntu was recognised and Raspberry Pi OS was refused. - The daemon creates its bot profile (--create-bot-display-name DELFIN --create-bot-allow-files); before, it asked for a name on stdin and stopped. Both first and second start measured with the pinned binary. - The gateway venv is made from Python 3.11 (MESSENGER_PYTHON, uv, or python3.11), filled from messenger-requirements.txt with --require-hashes --no-deps and a root-owned copy of the delfin package through a .pth file: nothing built, nothing unhashed fetched. - The bridge may write the service user's home (ReadWritePaths); with ProtectHome=read-only alone, files from the phone and /sync records could not be written. - delfin-agent-service.service runs the service with the user's DELFIN venv and agent.env, so the bridge has a service without a terminal; KillMode=mixed lets it save its sessions. The bridge carries DELFIN_MESSENGER_WORKSPACES=~/DELFIN-Handy (0700) unless --no-phone-sessions. - --pair pairs the phone at the end of the run.
enable --now leaves a running unit on its old code and unit lines; an update re-run copies new code and the daemon gained flags. The agent service is only enabled: a restart would end its running sessions.
DELFIN_MESSENGER_LABEL (provisioner: --name=LABEL, else the short host name; [A-Za-z0-9_-], 24 characters) goes into the bot's display name DELFIN-<label>, every session chat and the forum. A renamed session keeps it in its chat name. Display only: rooms stay bound by chat and session ID. Without a label the names are as before.
permission.asked carries purpose: the tool call's own one-line description (bash requires one), masked by the preview's line masking and the service redactor (which also finds a bare key; the preview's masking alone did not), one line, 200 characters; absent without one. The bridge passes purpose and the action kind (shell/write/read from the request's flags). The phone text names the action in plain words (a command on DELFIN-<machine>, a file change, a read outside the folder), then the purpose labelled as the agent's unchecked statement, then the full command, which the purpose never replaces.
bun scripts/gen-protocol.ts (Bun 1.4.3); --check: matches the Python definition.
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.
The messenger now sets itself up in one run on any Linux with systemd and glibc >= 2.34. The phone can start sessions, every chat shows which machine it comes from, and an approval says in plain words what it would do.
Setup (
scripts/pi/pi_messenger.sh)Before this, it could not have been run on the Pi:
Platform. Only Ubuntu was recognised, so Raspberry Pi OS was refused.
Bot profile. The daemon used to stop at a name prompt on stdin. It now starts with
--create-bot-display-name DELFIN-<label> --create-bot-allow-files. Measured with the pinned v7.0.3 binary: the first start creates the profile, the second keeps it.Gateway venv. It used to be a manual step. The script now:
MESSENGER_PYTHON, uv, orpython3.11);messenger-requirements.txtwith--require-hashes --no-deps;delfinpackage through a.pthfile. Nothing is built, and nothing unhashed is fetched.Checked for real here: pip installs with the hashes, and the gateway and bridge import from the copy.
Bridge. With
ProtectHome=read-onlyit could write nothing in the service home, so phone files and/syncrecords failed. It now getsReadWritePaths=<service home>; every other home stays read-only.Agent service. New unit
delfin-agent-service. It uses the user's~/delfin/.venvandagent.env, withKillMode=mixedso sessions are saved on stop. The bridge has a service without a terminal open.Re-runs. A re-run restarts the daemon, bridge and gateway (new code, new unit lines). The agent service is never restarted, so running sessions stay.
New options.
--pair: pairs the phone at the end. The invitation is also drawn as a QR code whenqrencodeis installed.--name=LABEL: names the machine (default: the short host name).--no-phone-sessions: turns off sessions started from the phone.New session from the phone:
neu NAME[: task]create. The phone sends a name and nothing else:~/DELFIN-Handy/<name>. The name is reduced to[A-Za-z0-9._-], with no leading dot and at most 40 characters.default, whatever is configured: the session asks before commands and edits.DELFIN_MESSENGER_WORKSPACESset, every start is refused.Machine name in every chat
DELFIN_MESSENGER_LABELappears in the bot name, in every session chat (DELFIN-Pi Butan …) and in the forum (DELFIN Forum Pi).name NAMEkeeps the machine label when it renames a chat.Approvals in plain words
permission.askedcarriespurpose: the tool call's own one-linedescription(bash requires one).Angabe des Agenten (ungeprüft): …— the agent's own statement, marked as not checked.Gate (py3.11 delfin-ci,
-m "not slow")test_a_session_can_be_started_from_the_phonetest_the_messenger_sets_itself_up_in_one_runtest_the_pairing_link_is_shown_as_a_qr_codetest_every_chat_names_the_machine_it_comes_fromtest_a_phone_approval_says_what_it_would_doNot verified: a live run on the Pi or a phone. It is planned on the Pi, the server and the login node. The aarch64 binary on Raspberry Pi OS has been checked by its library needs only, not started.