Commit Graph
100 Commits
Author SHA1 Message Date
darmanandClaude Opus 5.5 59b291d000 chore(mars): bump honcho-console to phase 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 23:08:49 +02:00
darmanandClaude Opus 5.5 ca725c73b5 feat(mars): honcho-console, tailnet-only web UI for luna's Honcho
Own repo (darman/honcho-console) as a flake input; its module runs on
mars with a SELECT-only grant on Honcho's database, at
http://mars.orbit.sol:8095 with the port closed on the LAN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 22:45:43 +02:00
darmanandClaude Opus 5.5 1db3105d50 fix(mars): directional Honcho observation so luna's own messages are derived
A honcho.json host block without observationMode counts as a legacy config
and gets "unified" (ai observe_me off), so the seed and everything luna
says were never derived.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 21:03:16 +02:00
darmanandClaude Opus 5.5 2b376d5035 secrets(mars): rotate darman's password
The old one leaked into a session transcript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 20:34:29 +02:00
darmanandClaude Opus 5.5 a5a07a8792 chore(scripts): edit_secrets opens Zed when installed
Takes precedence over the shell's $EDITOR (nano on terra); falls back to
the old $EDITOR/nano logic elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 20:31:06 +02:00
darmanandClaude Opus 5.5 53a19c6b54 feat(terra): luna's voice rules live in luna-voiced's system prompt
Audio-tag and speech-stripping rules moved here from her SOUL.md: only
luna-voiced sends [voice], so they no longer ride along in every
Telegram prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 20:25:45 +02:00
darmanandClaude Opus 5.5 df7696ae60 feat(mars): pin luna's minimal SOUL.md; full persona seeds Honcho
- prepare-dirs writes hosts/mars/luna-soul.md over her SOUL.md on every
  start: a short anchor (identity, register, non-negotiables). Her own
  approved edits no longer stick; a broken one corrupted the file on
  2026-09-24 with GLM tool-call markup.
- luna-soul-full.md keeps the full persona. It seeded her Honcho
  identity (hermes honcho identity), minus the voice rules, which moved
  to luna-voiced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 20:25:45 +02:00
darmanandClaude Opus 5.5 ed2ce8fafc feat(terra): stored Hermes sessions for luna's voice
- Each daemon run creates a Hermes session (source "desktop") on its
  first turn, so voice chats show in the dashboard's default Chats view.
  Hermes only allows a fixed set of sources; unknown ones become the
  hidden api_server.
- Turns carry X-Hermes-Session-Id (Hermes keeps the transcript) and
  X-Hermes-Session-Key: voice (one Honcho memory session for voice).
- With a stored session only the base prompt and what's new since her
  last reply are sent; falls back to full client-side history if the
  session can't be created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:53:12 +02:00
darmanandClaude Opus 5.5 b2a700571f feat(mars): switch luna's memory provider to Honcho
- prepare-dirs pins memory.provider = honcho in Hermes's config.yaml and
  merges the local server into honcho.json (workspace/aiPeer luna, user
  peer darman). Only those keys are asserted; Hermes's own additions stay.
- The SDK installs itself into the image's durable lazy-install target
  (/opt/data/lazy-packages), so nothing to package here.
- Hermes starts after Honcho but doesn't require it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:23:51 +02:00
darmanandClaude Opus 5.5 99e5260619 feat(mars): self-hosted Honcho memory server for luna
Honcho v3.2.2 (API + deriver containers) on loopback, with native
Postgres/pgvector and Ollama embeddings. Not wired into Hermes yet;
Mnemosyne stays her memory provider until the switch.

- Peer auth over the Postgres socket: the containers run as the host's
  honcho uid, so there is no DB password.
- Embeddings: qwen3-embedding:0.6b (1024 dims, fixed at first migration).
  The API runs configure_embeddings on start to resize Honcho's default
  vector(1536) schema.
- LLMs via OpenRouter: glm-5.3-flash:nitro at minimal reasoning for the
  deriver and quick dialectic, deepseek-v4-pro for deep dialectic and
  dreams (which maintain the peer cards).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 18:15:18 +02:00
darmanandClaude Opus 5.5 2523494d10 fix(mercury): disable pihole's DNS rate limit
Steam's query bursts got terra rate-limited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 02:23:07 +02:00
darmanandClaude Opus 5.5 48aa11eab5 fix(terra): surface empty Hermes replies, reconnect the voice widget
- luna-voice treats an empty reply or a stream error frame as a failure,
  so a dead provider key notifies instead of speaking "".
- The Luna widget reads `luna-voice watch` instead of Quickshell's
  Socket, which never retries after one failed connect and left the
  widget OFFLINE after a daemon restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 02:23:07 +02:00
darmanandClaude Opus 5.5 a9022fa8fc fix(mars): make a rotated OpenCode key actually reach Hermes
Luna went silent after the OpenCode Go subscription lapsed, and a new key
still 401'd after deploying it.

- Rotate opencode_go_api_key.
- prepare-dirs writes it into Hermes's .env like the other keys, so a
  stale line there can no longer override the container env.
- Changing the key restarts prepare-dirs and the container; podman only
  reads --env-file at start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 02:23:07 +02:00
darmanandClaude Opus 5.5 6f1262b0fe chore: bump flake inputs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 21:22:07 +02:00
darmanandClaude Opus 5.5 bee9b49ce1 fix(terra): surface Claude usage errors and retry sooner
The CLD panel went blank with no reason when Claude Code's saved OAuth
token had expired and the widget's own renewal was refused.

- Collapsed panel shows EXPIRED/ERR instead of dashes; failures are
  logged to `qs log`.
- Retry every minute after a failure instead of every 5.
- claude-usage identifies as claude-cli, the suspected cause of the
  refresh 429s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 21:21:20 +02:00
darmanandClaude Opus 5.5 c33d184228 chore: bump flake inputs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 01:27:27 +02:00
darmanandClaude Opus 5.5 896368ef56 feat(terra): launcher most-used sort, power buttons, SUPER opens rail
- Launcher sorts by launch count by default (persisted in quickshell's
  state dir); Ctrl+S or the sort chip toggles A–Z.
- Logout/Reboot/Shutdown in the footer, each needing a confirming click.
- SUPER now opens the launcher with the rail expanded; closing the
  launcher collapses the rail again unless it was already open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 01:26:44 +02:00
darmanandClaude Opus 5.5 f84611bc6e feat(terra): Claude subscription limits panel on the rail
CLD panel next to luna showing the 5-hour and weekly usage windows (plus
any per-model weekly caps), polled every 5 min via a new `claude-usage`
script that reuses Claude Code's OAuth login and refreshes it when expired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 01:26:44 +02:00
darmanandClaude Opus 5.5 13e8db74ce fix(mercury): register DHCP clients under .sol
pihole v6 made dns.domain an object and silently ignores a bare
FTLCONF_dns_domain, so every lease resolved as <host>.lan and names like
mars.sol (luna's apps) did not resolve at all. Set dns.domain.name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:58:57 +02:00
darmanandClaude Opus 5.5 e4ee637ccd feat(terra): luna v3 voice, channel marker and rail panel
- TTS defaults to eleven_v3_conversational over the Text to Dialogue
  socket: performs audio tags and gets her German right. Flash still
  works via the TTS socket.
- Every spoken message is prefixed with a [voice] marker so luna's
  profile on mars can tell the channel apart.
- LunaIndicator/LunaCall replaced by a LunaPanel in the bar rail, with
  captions; headless test updated to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:52:03 +02:00
darmanandClaude Opus 5.5 386a46c4fe feat(terra): ROCm blender
pkgsRocm build so Cycles can render on the RX 6800 XT over HIP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:52:03 +02:00
darmanandClaude Opus 5.5 f8a7b61280 feat(terra): Claude Desktop with Cowork
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:52:03 +02:00
darmanandClaude Opus 5.5 4adb9347b8 feat(jupiter): tailnet-only gitea MCP server
gitea-mcp in HTTP mode on :8093, reachable only over tailscale0. It
holds no token; each client sends its own PAT as a Bearer header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:52:03 +02:00
darmanandClaude Opus 5.5 565308a448 chore: bump flake inputs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 00:52:03 +02:00
darmanandClaude Opus 5 b3200d965d docs: record the voice-loop traps
Three that each cost a debugging round, and none of which looks like its
cause: terra's mic levels (every default threshold was above the user's
speech), the noise floor chasing a rising sound, and `try_recv()` popping
a command that an `if let Ok(Cancel)` then throws away — which is why
SUPER+V during her reply did nothing at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 23:38:06 +02:00
darmanandClaude Opus 5 ef1be8a7d9 feat(terra): luna voice-mode readout in quickshell
Top-left under the rail: whether the mic is open, whether she is
thinking, and whether she is talking — the states a 5s reply makes you
want to see. No avatar yet; the meter is a placeholder for it, and the
states and their colours are the part that has to read correctly first.

LunaIndicator is Item-rooted so render.sh can shoot all five states
offscreen (tests/LunaIndicatorHeadless.qml); LunaCall is the thin
PanelWindow. Beside the notification stack rather than among the modals:
it never takes the keyboard and raises no scrim, so it is deliberately
absent from `modalOpen`.

LunaState is read-only — the toggle runs the CLI — and treats a missing
socket as normal, since the daemon is a user service that may start after
the shell or not be installed at all.

Two things measurement decided rather than reasoning. ExclusionMode
.Ignore put it OVER the bar (it ignores other surfaces' zones, not just
its own), and switching to Normal was not enough either: the rail's
exclusive zone still left it at y=8 against a bar occupying 0..147. So
the shell passes bar.contentHeight down, the same value the backdrop
already reads. And the card is one chamfered path rather than a
rectangle with a triangle over its corner, which left the square border
showing underneath and read as an artifact.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 23:38:01 +02:00
darmanandClaude Opus 5 67dd30eb72 feat(terra): hands-free voice mode, toggled with SUPER+V
The key is a toggle rather than push-to-talk, because "voice mode is
active" has to be a state something can display; a held key cannot
sustain one. So the daemon grew a VAD loop: speech starts a capture,
`silenceMs` of quiet ends it. A turn is awaited inline, which is also
what stops her hearing herself — the tick cannot fire while she speaks.

The keybind runs the CLI, not a quickshell GlobalShortcut, so the mic can
still be switched off while the shell is reloading and a QML error can
never leave it open with nothing on screen saying so.

Every threshold had to be resized for terra's mic, which is QUIET:
0.001-0.002 ambient against 0.0045 speaking, about 6dB apart. The VAD
floor of 0.006 and whisper's own 0.015 gate both sat ABOVE the user's
voice, and a 3.5x multiplier cannot separate signals that close — three
independent reasons nothing could ever trigger. Hence vadMult 1.8,
vadFloor 0.0025, and stt::normalize lifting the clip (capped at 30x, so
near-silence is not amplified into words) before whisper sees it.

The floor tracker also had to stop feeding on everything: a rising sound
dragged its own threshold up faster than it rose, and a tone peaking at
0.029 was outrun by a threshold that reached 0.018. Only samples below
the current trigger update it now.

Four diagnostics, because none of the above was visible while it was
failing: `watch` prints the socket protocol, `say` runs a turn from typed
text (a broken mic vs a broken pipeline), `level` is a live meter with
the trigger marked, `devices` lists the inputs. Amplitude is now emitted
on every tick, not only while she speaks — a meter that moves only during
playback cannot answer "is it hearing me".

Also: connect-time replay of mode/state, so restarting the shell while
voice mode is on does not leave it blind until the next event, which in
an idle conversation is never.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 23:37:51 +02:00
darmanandClaude Opus 5 d089743f75 feat(terra): talk to luna with push-to-talk
luna-voiced: mic -> whisper-cpp (local, vulkan) -> Hermes' API on mars ->
ElevenLabs streaming TTS -> speaker, bound to SUPER+V. State, amplitude
and a viseme timeline are published on a unix socket; nothing consumes
that yet, but it is the data source the quickshell avatar will read.

STT stays local on purpose. mars already runs faster-whisper for Telegram
voice notes, but routing the mic through it would put every spoken word
on the network for no latency win.

Shape notes, all of them things the first live runs decided:

  - Viseme offsets are relative to speech_start (emitted when the first
    PCM frame reaches the speaker), never wall clock, so the shell and
    the daemon never have to compare clocks. ElevenLabs sends character
    alignment, not visemes, so the mapping is ours; the glTF morph target
    names are the contract.
  - clean_for_speech is a whitelist. She writes "(¬‿¬)", whose characters
    live in Latin-1 and punctuation blocks rather than any emoji range,
    so enumerating what to drop never converges. Em dashes become commas
    because they are a pause — dropping one ran two clauses together and
    changed what a sentence meant.
  - whisper invents words out of silence ("you", "Thank you."), and a
    held key over a quiet room is long AND empty, so has_speech gates on
    the loudest 100ms window rather than on duration.
  - Beeps on key down/up and a distinct low tone for "heard nothing":
    push-to-talk with no acknowledgement is indistinguishable from broken,
    and a dead mic must not feel like a slow reply.
  - A warmup request at startup: her first reply after the container
    starts costs ~16s against ~5s warm, and the first one is always the
    one you are waiting for.
  - `luna-voice watch` prints the socket protocol and `luna-voice say`
    runs a turn from typed text, which is how a broken mic is told apart
    from a broken pipeline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 22:45:17 +02:00
darmanandClaude Opus 5 8dc3affdda feat(mars): expose luna over the OpenAI-compatible API server
API_SERVER_ENABLED/HOST/PORT in the env template, bound 0.0.0.0 for the
same reason the dashboard is: the container is --network=host and nothing
opens 8642 in the firewall, so it is reachable over tailscale0 only.

API_SERVER_KEY has to go through .env like the ElevenLabs key did
(461d6cc). Confirmed the same way: with the key set only in the container
env the server came up — so API_SERVER_ENABLED/HOST *did* pass through —
but answered every bearer token with "Invalid gateway API key". The s6
passthrough list carries the plain API_SERVER_* vars and drops the secret
one. The .env write is now a write_env_key helper so both keys share it.

restartUnits gains prepare-dirs, which is what writes the .env line; the
container then has to come back up to read it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 22:45:05 +02:00
darmanandClaude Opus 5 9566624686 secrets(mars,terra): add the Hermes API server key
hermes_api_server_key is the bearer token for Hermes' OpenAI-compatible
API server, generated once and stored in both vaults: mars serves it,
terra is its only client.

elevenlabs_api_key is mirrored into terra for the same reason — terra
calls ElevenLabs directly (the client-direct path Hermes documents)
rather than relaying audio through mars, so both hosts need the value
and a rotation touches two files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 22:44:57 +02:00
darmanandClaude Opus 5 10046bf846 fix(mars): restart hermes when prepare-dirs' script changes
prepare-dirs is an inactive oneshot and switch-to-configuration only
restarts active units, so the .env delivery added in 461d6cc deployed
cleanly and then did nothing — the container kept running with the old
script until something else restarted it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 18:36:21 +02:00
darmanandClaude Opus 5 461d6cc441 fix(mars): deliver the ElevenLabs key through Hermes' .env
The image's s6 init hands the gateway a fixed set of container env vars;
ELEVENLABS_API_KEY is not one of them, so --env-file alone left
text_to_speech reporting it unset even though the var was in the
container config and the resolver read os.environ fine.

prepare-dirs now merges the single line into ${hermesHome}/.env
(HERMES_HOME=/opt/data), as uid 986 so root never writes into hermesHome,
with the key on an fd opened as root so it stays out of argv and the journal.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 18:35:13 +02:00
darmanandClaude Opus 5 1dd8edcbb0 fix(mars): restart hermes when the ElevenLabs key rotates
podman reads --env-file only at container creation, so re-rendering
hermes-agent.env left the running container on its old environment and
TTS kept reporting ELEVENLABS_API_KEY not set after the key landed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 18:10:04 +02:00
darmanandClaude Opus 5 b4c60b9f7b secrets(mars): add luna's ElevenLabs API key
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 17:42:31 +02:00
darmanandClaude Opus 5 1bdd70fc4d feat(mars): provision luna's ElevenLabs API key via sops
ELEVENLABS_API_KEY is the only env override ElevenLabs takes; provider,
voice_id and model_id are config.yaml-only. Seeds tts.provider through the
existing prepare-dirs yq merge so it defaults to elevenlabs without pinning
it — KittenTTS stays provisioned as the offline fallback.

Needs elevenlabs_api_key in secrets/mars.yaml before the next deploy, or
sops-nix fails activation on the missing key.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 17:28:27 +02:00
darmanandClaude Opus 5 a723222223 Merge origin/master (KittenTTS + local STT) into the unpushed mars fixes
origin/master gained PRs #7/#8 on a base that never received the three
local commits, so it still carried FORWARDED_ALLOW_IPS="*" and lacked
jupiter-reachable.service.

Conflict in hosts/mars/hermes-agent.nix resolved by keeping this side's
narrower dashboard trust (trusted_proxies + HERMES_DASHBOARD_PUBLIC_URL,
fec8d7c) and dropping the wildcard it replaced, while keeping both
KittenTTS env vars and PR #8's PYTHONPATH.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 17:27:03 +02:00
darman 71900ddfcf Merge pull request 'mars(kittentts): local STT add-on — faster-whisper in the audio side-venv' (#8) from feat/mars-hermes-kittentts-stt into master
Reviewed-on: #8
2026-09-20 17:24:41 +02:00
darman a0519b5004 Merge pull request 'mars: add KittenTTS voice provider (CPU-only, offline mini model)' (#7) from feat/mars-hermes-kittentts into master
Reviewed-on: #7
2026-09-20 17:24:27 +02:00
darmanandClaude Opus 5 22caa06904 mars(kittentts): patch venv .so RPATHs so numpy/onnxruntime load
The venv's python is Nix python313 (also inside the container, via the
/nix/store mount), whose loader never searches /usr/lib, so PyPI manylinux
wheels failed with "libstdc++.so.6: cannot open shared object file".
auto-patchelf the staged venv against gcc-lib + zlib; RPATHs are store
paths, so the delivered copy works in the container too. The lib paths join
the input hash so a toolchain bump rebuilds.

Verified locally with mars's exact uv/python313: construct offline from the
staged hub layout and synthesize with voice "Luna".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 15:05:01 +02:00
darmanandClaude Opus 5 812c1af1f2 mars(kittentts): install the wheel under its real filename
uv reads the version from the wheel filename, and the fetchurl store path's
hash prefix made it reject the file ("invalid version"). Expose it via a
linkFarm under kittentts-0.8.1-py3-none-any.whl.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 14:59:01 +02:00
darmanandClaude Opus 5 e0f5c6b37b mars(kittentts): fix review round 3 — eval, delivery and stale-venv bugs
- pkgs.setpriv does not exist (mars failed to eval); setpriv is in util-linux.
- `sh` is not on a unit's PATH; call ${pkgs.runtimeShell} directly.
- Drop `env HOME="$hermesHome"`: unset shell var under `set -u`, and unneeded.
- Staging dir 0700 -> 0755: the uid-986 delivery step could not read it.
- Rebuild the staging venv whenever the stamp misses, else an input bump
  delivered the old venv under the new stamp.
- Add diffutils: `cmp` in the fast path was missing, so every boot re-delivered.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 14:51:05 +02:00
darmanandClaude Opus 5 625938922c fix(mars): wait for jupiter over the tailnet before mounting its share
jupiter resolves to its tailnet IP, but network-online.target fires on
the LAN link before tailscaled routes tailscale0. Hermes'
RequiresMountsFor pulls the mount at boot, so it failed with ENETUNREACH
and took prepare-dirs, the Mnemosyne link and the container down with it,
with nothing retrying. The mount now requires a oneshot that polls
jupiter:445 for up to 5 minutes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 02:25:14 +02:00
darmanandClaude Opus 5 fec8d7cb25 fix(mars): trust only neptun's proxy for the Hermes dashboard
Replaces FORWARDED_ALLOW_IPS="*" with dashboard.trusted_proxies pinned to
neptun's tailnet IP (merged into config.yaml by prepare-dirs via yq) and
pins HERMES_DASHBOARD_PUBLIC_URL so the OIDC redirect_uri stays https.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 02:25:14 +02:00
darmanandClaude Opus 5 be98be0100 feat(quickshell): move notifications into HyprChrome
The notification daemon and popup stack now live under
HyprChrome/Widgets/Notifications and are owned by HyprChromeShell, so
popups land on the rail's monitor below its exclusive zone. Replaces
widgets/notifications; NotificationCard renders headless for tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 02:25:14 +02:00
darman 25e17f163e Merge pull request 'mars: provision the Mnemosyne memory provider for Hermes' (#6) from feat/mars-hermes-mnemosyne into master
Reviewed-on: #6
2026-09-19 02:16:35 +02:00
darmanandClaude Opus 5 9b96d3c6f8 mars(mnemosyne): fix env build and plugin symlink target
- fetchPypi: sdists are published underscore-named, so the hyphenated
  pname 404'd.
- sitePackages is relative; prefix the env path so the unit's -d check
  and the symlink point at the store.
- hermes_memory_provider ships in mnemosyne-memory, not mnemosyne-hermes;
  move the import check accordingly.
- Drop the unused /opt/data/mnemosyne-env mount, the orphaned
  requirements.txt, and trim comments.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 02:09:14 +02:00
darmanandClaude Opus 5 f3dddc9150 feat(terra): replace tuigreet with a quickshell greeter
greetd now runs a throwaway Hyprland hosting dotfiles/quickshell/greeter.qml,
configured per host via homelab.greeter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 23:34:10 +02:00
darmanandClaude Opus 5 4adb59808f fix(mars): unbreak hermes webhook-routes script, bump Hermes to v2026.9.14
An apostrophe in a condensed comment closed the single-quoted jq program,
so the unit script failed to build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 23:32:35 +02:00
darman a5edaab80d Removed comments & mercury tailscale key 2026-09-18 23:03:08 +02:00
darmanandClaude Sonnet 5 7d9bb7d183 fix(common): expose /etc/timezone so flatpak apps stop defaulting to UTC
Flatpak detects the sandbox timezone from /etc/timezone, not the
/etc/localtime symlink NixOS creates by default. Without it every
flatpak app (Telegram included) silently falls back to UTC, showing
message timestamps 2h off from local time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UJqEmY1y3AYX3JoX4Y6b21
2026-09-18 21:36:41 +02:00
darmanandClaude Sonnet 5 6f24ab69ad docs: condense comments across the repo
Comments had drifted into multi-paragraph narrative (git commit
lineage, debugging stories, restated code) in several hot spots
(scripts/deploy, hermes-agent.nix, flake.nix, gitea.nix, headscale.nix).
Trim every comment to its load-bearing "why" — gotchas, safety
warnings, and non-obvious rationale survive verbatim in substance,
just tightened to 1-2 sentences; historical narrative and anything
already covered in CLAUDE.md is cut. No code/logic changed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UJqEmY1y3AYX3JoX4Y6b21
2026-09-18 21:36:30 +02:00
darman 3899290c5b added obsidian flatpak 2026-09-18 20:53:22 +02:00
darman bd0aab4e61 Merge pull request 'feat(quickshell): add dense telemetry bar' (#4) from feat/quickshell-dense-bar into master
Reviewed-on: #4
Reviewed-by: darman <mail@erik-s.dev>
2026-09-18 20:44:10 +02:00
darman 1b2260293b Merge branch 'master' into feat/quickshell-dense-bar 2026-09-18 20:43:46 +02:00
darman f7b12bc7cd WIP 2026-09-18 20:39:06 +02:00
darmanandClaude Opus 5 b3c3cc38f0 feat(quickshell): give the prompt its own panel, ESC handling and placement
PolkitPanel replaces BarPanel as the dialog's chrome. Deliberately not a
subclass or a fork: most of BarPanel is density machinery — summary slot,
animated height, state pair, transitions — that a modal never uses, and
inheriting it would tie the dialog's look to a component whose real job is the
rail, so every restyle here would have to be justified against the panels up
there. It keeps the shell's silhouette (cut corners with detached accent caps,
the accent rules, the header strip) and drops the rail's tick decoration.

ESC closes the rail. The bar had no keyboard focus at all, so this adds it,
gated by the shell rather than left to the compositor to arbitrate between two
exclusive surfaces — that resolves by stacking and would invert silently the
day the layers change:

    grabsKeyboard: shell.expanded && !polkit.prompting

so ESC dismisses the prompt while one is open and closes the rail afterwards.
Verified by instrumenting the handoff: expanded -> true, prompt open -> false,
prompt dismissed -> true, collapsed -> false. Note the rail now takes EXCLUSIVE
keyboard focus while expanded, which is the cost of answering a keypress the
user has not aimed at anything.

The dialog sits a third of the way down rather than centred, panel centre on
the third so it grows symmetrically as the message wraps, floored at a margin
so a tall prompt on a short output cannot be pushed off the top.

Also carries the backdrop tuning: dim 0.75 -> 0.65, gridOpacity 0.15 -> 0.10,
crossOpacity 0.45 -> 0.15, now that the scrim is used by the prompt as well as
the rail.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAq2kKCLazZmrKvkd3akud
2026-09-01 23:38:23 +02:00
darmanandClaude Opus 5 27b924f5e9 docs(quickshell): correct CLAUDE.md's config-path and architecture claims
The file said ~/.config/quickshell is a symlink to this repo and that saving a
file hot-reloads the running shell. Both are wrong and cost real debugging
time: hosts/terra/home.nix ships the tree with xdg.configFile."quickshell",
which COPIES it into the store, so the config dir is a read-only symlink into
/nix/store and the running shell watches the frozen copy. Hot reload only
applies to a working-tree instance, which is what `nix develop` + qs-dev is
for.

Also records the trap that follows from it: a new file must be git-added
before it can be deployed at all, because flakes read the git tree and drop
untracked files silently — producing a deployed config that fails to load,
which does not surface until the next restart because the running shell keeps
serving the store path it resolved at launch.

Architecture section was stale independently of that: shell.qml has not
instantiated Bar/BarTop/BarBottom for a while, there are eleven launcher
variants rather than eight, the HyprChrome tree was undocumented, and there
are TWO Theme singletons — a token added to one does not exist in the other.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAq2kKCLazZmrKvkd3akud
2026-09-01 23:38:09 +02:00
darmanandClaude Opus 5 38608c4008 feat(quickshell): give the shell the polkit agent and one shared scrim
Moves PolkitPrompt from shell.qml into HyprChromeShell. Whether a prompt is
open is shell state by the same rule as the screen and the layer pair: two
surfaces read it.

The prompt no longer carries a backdrop of its own. There is one
ChromeBackdrop per output and a prompt raises them all, so a prompt over an
already-expanded rail reuses the scrim that is there rather than stacking a
second one on it, and a prompt over a collapsed rail expands that same scrim
from its bar-height band to the whole output.

The layer pair now keys off `scrimUp` (expanded OR prompting) rather than off
the density, which keeps bar and backdrop exactly one level apart in every
state. A prompt over a collapsed rail raises both: BACKGROUND sits under
ordinary windows so a scrim there dims nothing, and the bar has to stay one
above the scrim or the shell dims its own chrome. The rail is raised but
stays collapsed — its layer answers to the scrim, its height to `expanded`.

Outputs the rail does not live on get a scrim only while a prompt is up; a
modal that dims one monitor and leaves the others lit does not read as modal.
Expanding the rail still dims only the rail's screen, which is the existing
behaviour and the right one.

The dialog follows Hyprland.focusedMonitor rather than the rail's screen — a
password prompt belongs where the user is looking — matched by name against
Quickshell.screens, falling back to the rail's screen rather than to nothing.

SUPER A is frozen while a prompt is open, and dropped rather than queued, so
the rail does not spring open the moment the dialog goes.

Verified on two monitors via hyprctl layers, both densities, plus the toggle
block with an odd number of presses (two cancel out and prove nothing).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAq2kKCLazZmrKvkd3akud
2026-09-01 23:24:05 +02:00
darmanandClaude Opus 5 05d26e386f feat(quickshell): add polkit authentication agent
Registers a polkit agent for the logind session and presents its requests in
the hyprchrome panel chrome. PolkitPrompt owns the agent, the layer-shell
surface and focus; PolkitPromptContent is the headlessly renderable visual
core, staged by tests/PolkitPromptHeadless.qml.

Replaces terra's hyprpolkitagent autostart, which had been dead for a while:
the unit was never installed, so the start failed silently and the session
ran with no polkit agent at all.

Verified against a live agent — registration, the PAM conversation, retry
after a rejected attempt, and cancellation. Behaviours found by tracing that
the component now documents:

  * registration is ASYNCHRONOUS, so a Component.onCompleted check reports a
    false failure while a change handler cannot see a total failure at all
    (a failed registration never changes the property) — hence the deadline
  * a flow arrives with isResponseRequired false and an empty prompt, so the
    field is still disabled when the window first becomes visible and the
    re-focus on that transition is load bearing
  * concurrent requests SUPERSEDE rather than queue, orphaning the older one.
    Cancelling it from QML trips "QObject::connect(AuthFlow, PolkitAgentImpl):
    invalid nullptr parameter" upstream and costs the live prompt as well, so
    it is deliberately left alone
  * Identity.id is the raw uid, not unix-user:<name>

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAq2kKCLazZmrKvkd3akud
2026-09-01 22:35:23 +02:00
darmanandClaude Opus 5 2bf71494f4 feat(quickshell): cap the rail's open chamfers and trace between them
A chamfer with no neighbour behind it now carries the corner it removed,
put back OUTSIDE the panel as a detached accent triangle. capGap is the
perpendicular distance from the cut, hence the per-axis shift of capGap
over root 2: the cap moves along the cut's normal, not along an axis.

The trace joining two caps belongs to the RAIL, not the panel — the run it
draws is the gap BETWEEN two panels, which no panel can see. HyprChromeBar
filters the row down to panels (a slack Item has no `rightChamfer`, so
spacers drop out, and dropping them is exactly what makes a trace span
them), then joins each right cap to the next left cap: straight, one 45°
step at the midpoint of the gap, straight. It meets the middle of each
cap's outward face rather than its tip.

TestPanel is a staging slot between two spacers. It counts seconds since
load, which is the cheapest proof the panel is live, and standing alone it
exercises a cap and a trace at both ends — something a rail of butted
panels never does.

Restructures the module in the same commit, since the moves and the edits
above land in the same files: folders are PascalCase, the bar and its
widgets moved under Widgets/Bar, and DebugWindow takes the HyprChrome Theme
instead of the legacy one. The two singletons are identical today, so that
is not a visual fix — it is a palette edit reaching the debug stage in
future. Rename detection needs -M40% to follow HyprChromeBar, which grew
past the default similarity threshold.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U19X5LGTxtq4pb4jdNVivv
2026-08-31 00:30:58 +02:00
darmanandClaude Opus 5 3aecaf9de5 feat(quickshell): add HyprChromeShell, workspaces panel, persistent backdrop
HyprChromeShell owns what the rail's surfaces have to agree on: the target
screen, the density and the shortcut that toggles it, and the bar/backdrop
layer PAIR. That pair is why the wrapper exists — the backdrop has to sit
exactly one layer below the bar in both densities, and split across two
files the two assignments drifted apart and put the scrim over the bar.
HyprChromeBar is now just its own surface; ChromeBackdrop takes its layer.

The backdrop renders in both densities instead of fading out: full-screen
while expanded, scoped to the band the rail occupies while collapsed, with
a proportional tail fading off the bottom of that band. Both gradients end
on their solid color when there is no fade — with a zero-length ramp the
start and end stops coincide, Qt sorts stops unstably, and the transparent
one winning turned "no fade" into a ramp across the whole scrim.

WorkspacesPanel, between host and vitals, shows the active workspace per
monitor: one accent box per output collapsed, the full strip with the shown
one filled expanded, lined up in a column behind a fixed-width name cell.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U19X5LGTxtq4pb4jdNVivv
2026-08-30 22:41:30 +02:00
darman 15e081e52d Merge remote-tracking branch 'origin/feat/quickshell-dense-bar' into feat/quickshell-dense-bar 2026-08-30 21:18:05 +02:00
darmanandClaude Opus 5 61da7748af chore(terra): unload hypr-chrome, round corners at 25
Comments out both the plugin and its `plugin.hyprchrome` settings — Hyprland
rejects plugin config for a plugin that is not loaded, so the two have to go
together. The flake input stays, so re-enabling is two uncommented lines.

With the window frames gone, decoration rounding goes 10 -> 25 and
rounding_power 2.0 -> 1.0 (previously unset). Both were applied live first via
`hyprctl eval 'hl.config{...}'`; plain `hyprctl keyword` is refused by the lua
config's non-legacy parser.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
2026-08-29 04:13:54 +02:00
darmanandClaude Opus 5 bbe35dd72e feat(quickshell): join adjacent panels into a continuous rail
At spacing 0 a row of panels read as separate tiles, each closing its own
silhouette. BarPanel can now drop either cut corner — rightChamfer (top-right)
and leftChamfer (bottom-left), the only two the shape cuts — so an edge that a
neighbour butts against runs square into it. The bar turns off the host's right
and the vitals' left; the tray keeps both, since the spacer between them is not
a panel and that edge is free.

A side with its chamfer off also draws a connector: the shared edge restroked
in accent at outlineWidth + 2, so the join reads as a deliberate seam rather
than two outlines that happen to touch. The outline's own width becomes a
property so the connector can be defined against it instead of as a second
literal.

The lower-right accent strip takes accentLineWidth, the same slug-derived width
the upper-left one already used, instead of its own Math.min(49, width / 3).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
2026-08-29 04:13:43 +02:00
darmanandClaude Opus 5 c69aa4fea2 fix(quickshell): stop the bar twitching when a collapse finishes
Two causes, both outside the panel animation itself.

bodyBottom and bodyEndPadding are animated reals, so their sum spends the tail
of every transition on a fraction. A layout rounds that up, then drops a pixel
the moment the animation lands on its exact value — a 1px hop after the motion
has visibly finished. implicitHeight and targetHeight now round.

The rest was the surface. Hyprland animates layer-surface resizes (animations
enabled, `layers` left at its default), and the deferred shrink put that resize
exactly where the panel motion ended. The bar is now sized once to the expanded
rail via the new BarPanel.expandedHeight and never resizes; only exclusiveZone
tracks the state, so the desktop still reflows once per toggle, at the start.
That retires barHeight, the content-height handler and the 340ms shrink timer.

A surface that stays tall would swallow clicks across the screen while the rail
is collapsed, so input is masked to the panel row.

Instrumenting BarPanel per frame ruled the panels themselves out first: slug
and summary hold the same absolute y through an entire collapse.

The bar and scrim also get their own layer namespaces. Nothing depends on them
yet; they are the handle for a layerrule that would exempt the rail from
compositor animations without catching the launchers, which share the default
"quickshell" namespace and do want their fade.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
2026-08-29 03:44:40 +02:00
darmanandClaude Opus 5 e7c30fd39d feat(quickshell): show local and tailnet address in HostPanel
A third line under user // timezone, muted so the identity block stays a
descending three tiers.

Unlike the name, user and zone — none of which can change under a running
shell — addresses can, so this polls on a 30s timer instead of joining the
startup one-shot. The local one is read off the interface holding the default
route with tailscale0 excluded: as an exit node tailscale0 holds that route
itself, and the panel would show the tailnet address on both sides.

Drops the expanded body's `height: 48`. A third line has to grow the panel,
and BarPanel measures the body to decide how tall it is, so a fixed height
would have clipped the new row instead. The bar follows through targetHeight.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
2026-08-29 03:30:35 +02:00
darmanandClaude Opus 5 15698d3a78 feat(devshell): stream quickshell warnings and errors in nix develop
qs-log follows the working-tree instance's log filtered to WARN|ERROR (-a for
everything), and the shellHook starts it in the background once qs-dev is up,
taking it down again in the exit trap alongside qs-prod. A binding loop or a
failed binding is a WARN, and easy to miss when it scrolls past unwatched.

It starts at the end of the log rather than replaying the backlog, and
re-attaches in a loop: `qs log -f` ends when the instance it attached to exits,
and the dev shell outlives individual instances.

Also corrects the hot-reload note added in 7268221, which was wrong on both
counts. Tested against the running shell: `touch` never reloads (mtime is not a
content change) and inode-replacing edits like `sed -i` are picked up fine. The
reliable check is whether `qs log` shows a "Reloading configuration..." line.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
2026-08-29 03:25:26 +02:00
darmanandClaude Opus 5 7eb7b948e8 feat(quickshell): dim the desktop behind the expanded hyprchrome bar
A full-screen scrim carrying the dense bar's drafting grid, shown while the
rail is expanded and faded out with it.

It sits on the TOP layer while the bar moves to OVERLAY. Both on one layer
would stack by surface creation order, which is not something to rely on; a
layer apart makes "above windows, below the bar" a guarantee. The mask is an
empty Region, so the scrim takes no clicks and reserves nothing.

The grid is the dense bar's, at twice the spacing and with registration
crosses on every other intersection. Its 0.018 opacity was tuned against a
near-black panel and is invisible over a scrim on lit windows, so grid and
crosses are both properties rather than constants, and the lines take a
desaturated accent derived from the palette instead of plain text colour.

Cross geometry rounds with Math.floor on both the mark's offset and the bars
inside it. anchors.*Center halves the box unfloored, which put an even-sized
mark half a pixel off the 1px rule it registers against. crossThickness is in
steps for the same reason: 1 -> 1px, 2 -> 3px, 3 -> 5px, since only an odd
width straddles a rule symmetrically.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
2026-08-29 03:25:14 +02:00
darmanandClaude Opus 5 7268221a51 fix(quickshell): drop layout-overridden geometry in HostPanel
The expanded body is a RowLayout, so the divider's `y`/`width`/`height`, the
clock column's `width: 210`, and the user/zone text's `y: 32` were all being
discarded silently — a layout assigns its children's geometry, and a Column
positions its own. Only the anchors among these ever warned.

The divider's 8px inset becomes Layout margins, and `Layout.alignment` goes
from the clock column, where it is ignored while the item fills.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
2026-08-29 02:41:39 +02:00
darmanandClaude Opus 5 e38a8403ac feat(quickshell): add hyprchrome bar with collapsible panels
A second shell chrome under dotfiles/quickshell/hyprchrome, built around a
BarPanel that carries TWO renderings of its data: the default children are the
expanded detail view, `summary` the terse one shown while collapsed. Both stay
bound to the same sources, so the densities cannot disagree, and the panel
cross-fades between them while its height animates.

Panels: HostPanel (hostname, user, timezone, clock), VitalsPanel (CPU load and
temperature, memory, GPU load and temperature, all metered), TrayPanel (system
tray, self-sizing). HyprChromeBar pins them to DP-2 and owns `expanded` for the
whole rail — SUPER A, via GlobalShortcut "chrome".

GPU busy comes off sysfs rather than the node_exporter scrape VitalsData
already does: the hwmon collector carries the card's temps, power and clocks
but not its utilisation.

The bar's height binds to each panel's `targetHeight` — where it will settle,
not where the animation currently is — because the exclusive zone is
window-sized by default, and binding to the animated height relayouts every
tiled window on the output twelve times per toggle. The zone follows the target
immediately so the desktop reflows once, at the start; the surface itself
shrinks only after the panels finish, or it would clip them mid-animation.

DebugWindow stages a widget in the middle of the secondary monitor
(SUPER CTRL D), masked so only the staged widget takes pointer input.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HEtXvseVb5gwAtKNhFx2PU
2026-08-29 02:38:00 +02:00
darman 6406e06330 Auto stash before merge of "feat/quickshell-dense-bar" and "origin/feat/quickshell-dense-bar" 2026-08-28 23:03:36 +02:00
darmanandClaude Opus 5 b16cc93ff6 refactor(quickshell): move every color and font into a Theme singleton
The shell was running two unrelated palettes: an amber one (#FFD063 accent,
#EEEEEE text, #0F1012 panels) hardcoded as ~200 raw hex literals across the
launchers, sidebar, systray, vitals and notifications, and an orange one
(#e8722a) that only the dense bar had, tokenized as per-file properties.

This unifies on the ORANGE values under the AMBER naming scheme, and moves the
lot into widgets/theme/Theme.qml. `surface` takes the dense bar's void
(#0a0a0a) rather than the old panel background. Zero color and font literals
remain anywhere under widgets/ outside Theme.qml.

Collisions resolved, all near-duplicates that wanted to be one token:
  - #0F1012 + #0A0A0C + #0a0a0a -> surface
  - #EEEEEE + #dedede           -> text
  - #7A7B7D + #858585           -> muted
  - #292C30 + #22262C           -> raised
  - #FFD063 + #e8722a           -> accent

Two derived things rather than literals. accentSoft (the pale flash the
top/bottom bars show while a launcher is open) was a hand-picked #FFF3C0
against amber, which is simply wrong against orange; it is now
Qt.tint(accent, white 55%), a ratio checked against the original (amber tinted
55% gives #FFE9B8 vs the hand-picked #FFF3C0). And the dense bar had been
hand-encoding Qt.rgba(0.87,0.87,0.87,a) and Qt.rgba(0.91,0.45,0.16,a), which
are just text and accent at alpha -- now textAlpha(a)/accentAlpha(a), so they
track a palette change instead of silently drifting.

Fonts came along too. Digital-7 Mono is dropped for DepartureMono: it was
never packaged, relying on a manual ~/.dots/fonts/digital_7 install that does
not exist on terra, so `fc-match "Digital-7 Mono"` resolved to DejaVu Sans and
all 38 of those sites -- the launcher lists, sidebar clock, systray labels,
every vitals readout -- were silently rendering in a PROPORTIONAL fallback.
Numeric columns should visibly improve. readoutFont is an alias of displayFont
rather than a second literal so the two roles cannot drift apart.

quickshell/CLAUDE.md updated: it said "No shared theme/tokens file yet" and
told contributors to grep for the existing hex color, which would now
reintroduce exactly what this removes.

Verified: no file references Theme. without the import, none imports it
unused, and the whole shell -- launchers, sidebar, vitals, systray,
notifications, not just the harness -- hot-reloaded clean on terra.
tests/HeadlessSmoke.qml deliberately keeps its own copies; its value is having
no dependencies.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgcWkm3t6BDQktYHQvb8Hx
2026-08-28 07:56:25 +02:00
darmanandClaude Opus 5 01bc169180 refactor(quickshell): rework the panel chrome, extract it as StatusBarPanel
The dense bar's panel chrome gets a squarer outline (top-right and bottom-left
chamfers only, square on the other two corners) and a second accent line in
the lower right to balance the existing upper-left one.

The chrome then moves out of DenseBarContent's inline `component
TelemetryPanel` into its own file. The call sites are unchanged apart from the
name -- children still come from the default property -- and the widgets they
pass in (RadarGauge, NetworkTrace, MetricBlock) stay declared in
DenseBarContent, so their scope is unaffected by moving only the definition.

Two things could not come along and had to be reproduced locally, because a
component in its own file has no access to the enclosing scope:

  - the palette and the two font families, previously read off `root`. They
    are properties with defaults matching DenseBarContent's, which is this
    repo's per-component convention. Duplicated on purpose for now; a shared
    theme singleton is the place to collapse it.
  - MicroText, which is an *inline* component of DenseBarContent and so
    invisible from another file. Expanded to the Text it desugars to.

Also qualified the bare offsetY/chamfer/accentLineThickness references as
panel.*; they resolved through the component scope before, but being explicit
avoids ComponentBehavior: Bound warnings in the new file.

Verified the move was verbatim by normalising the old inline block and the new
file body and diffing them -- the only differences are the relocated property
block, the panel.* qualification and the MicroText expansion. Loads clean both
headlessly and in the real layer-shell shell.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgcWkm3t6BDQktYHQvb8Hx
2026-08-28 07:55:59 +02:00
darmanandClaude Opus 5 54896033c6 feat(flake): add a quickshell hot-reload devShell
hosts/terra/home.nix ships dotfiles/quickshell via xdg.configFile, which
copies the tree into the store: ~/.config/quickshell is a read-only symlink
into /nix/store and every QML tweak costs a nixos-rebuild. quickshell does
hot-reload on file save -- but only for the files it watches, which are those
frozen store copies. `nix develop` now swaps the running shell to the working
tree (`qs -p`) and swaps it back on exit, so QML edits need no rebuild at all.

The swap starts the dev instance FIRST and kills the packaged one only once
dev is confirmed up. A QML error in the working tree then leaves you on your
normal bar instead of no bar, which matters because a broken save is exactly
when you would be running this. Liveness is "did `qs list -j` return json" --
it exits 0 whether or not it found anything, so the exit code says nothing.

Every kill is scoped to one config (`qs kill` = default, `qs kill -p` = that
path). A blanket kill would also take out unrelated instances; pkgs/rishot.nix
is one.

Three guards on the auto-swap, all learned by testing it:
  - interactive only. `nix develop --command X` EXECs X, replacing the shell
    that set the `trap ... EXIT`, so the restore never runs and you are left
    on the dev instance. Non-interactive use gets `nix develop -c qs-dev`.
  - WAYLAND_DISPLAY, so entering the shell over ssh cannot kill the desktop's
    bar and leave nothing in its place.
  - a sentinel, so a nested `nix develop` does not swap and restore twice.

Deliberately not wired to direnv (no .envrc): programs.direnv is enabled for
this user, so a `use flake` would swap the running desktop shell on every `cd`
into the checkout.

Verified end to end on terra: swap, hot-reload of a working-tree edit, and
restore, plus both the interactive and non-interactive paths.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgcWkm3t6BDQktYHQvb8Hx
2026-08-28 07:55:03 +02:00
darman 45e08e35a2 Merge pull request 'Feat/obsidian livesync' (#5) from feat/obsidian-livesync into master
Reviewed-on: #5
2026-08-28 05:16:36 +02:00
darmanandClaude Opus 5 a8a1cffa3e mars: mirror luna's Obsidian vault to disk with livesync-bridge
Gives the Hermes agent a real directory of markdown for the luna_wiki
vault, at /var/lib/livesync-bridge/vault and mounted into her container at
/opt/data/vault (inside HERMES_WRITE_SAFE_ROOT, so she can write, not only
read). Obsidian itself is an Electron GUI with no headless mode, and an
agent wants files rather than an app.

livesync-bridge is Deno, not packaged, and publishes no image — upstream
ships only a `build: .` compose file. So it comes in as a pinned non-flake
input and runs under systemd. Two things that are not obvious:

  - The source is COPIED to a fixed path rather than run from /nix/store.
    Deno keys localStorage — where the bridge records per-file sync state —
    by the main module's origin. Verified by running one source tree from
    two paths against a single DENO_DIR: two origin directories appear. Run
    from the store, every input bump would silently reset both peers to a
    full rescan.
  - It runs as uid 986/gid 983, the same identity the hermes container
    uses. Two uids in a shared group only works while every file stays
    group-writable, and one 0644 file dropped by the agent would stall sync
    on that path.

Talks to CouchDB over the tailnet (jupiter.orbit.sol:5984), so neptun's
vhost, its TLS and its path allowlist are all out of the picture.

Verified before deploying: `deno check` passes on nixpkgs' 2.8.3 (upstream
pins 2.6.9), and the bridge starts, reads LSB_CONFIG, detects a file and
writes its health heartbeat. Both directions confirmed working on mars
afterwards.

Credentials are currently the `obsidian` admin account and the personal
vault's passphrase, which means mars can decrypt every vault database and
not just luna's. Deliberate reuse of what existed; hosts/mars/secrets.nix
records the two independent ways to narrow it.

⚠️ Upstream has three open, unanswered issues on the storage->couchdb
direction (#50, #23, #46) and all fail silently — the log reports the
upload and the database is never updated. Do not treat this directory as
durable storage for anything luna cannot regenerate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TLN5nkLBtCciD3ZnUwtw2b
2026-08-26 00:10:34 +02:00
darmanandClaude Opus 5 15ae1cf608 obsidian: self-hosted vault sync via CouchDB on jupiter
Adds services/dev/obsidian-livesync.nix — CouchDB 3 from the native
nixpkgs module, tuned as the backend for the Self-hosted LiveSync plugin
— and publishes it as notes.mgaction.town through neptun.

It goes out over the public reverse proxy rather than staying on the LAN
because Obsidian's mobile apps refuse cleartext HTTP and *.jupiter.sol
cannot hold a publicly trusted cert. That makes the hardening load-bearing
rather than decorative:

  - require_valid_user in both [chttpd] and [chttpd_auth], so nothing
    answers unauthenticated on the open internet;
  - neptun's vhost matches on CouchDB's own naming rule (system endpoints
    all begin with `_`, user databases never can), so Fauxton, /_all_dbs
    and /_node/_local/_config — which rewrites the server config given
    admin credentials — 404 at the proxy while any number of per-vault
    databases pass. Verified against both sets of paths with caddy run
    against a stub backend;
  - the plugin's own E2EE carries the actual confidentiality: jupiter only
    ever stores ciphertext. Its passphrase is deliberately NOT in sops —
    it never leaves the clients, and pairing it with the server credential
    would defeat the point.

flush_interval -1 is required, not tuning: replication rides a continuous
_changes feed that caddy would otherwise buffer into a stall.

Storage sits on the array with RequiresMountsFor, since a CouchDB that
starts without /mnt/data would create an empty database on the eMMC and
LiveSync would replicate that emptiness back to every client. Logs go to
journald rather than the unrotated /var/log/couchdb.log, for the same
29G-eMMC reasons as the rest of jupiter.

The admin password reaches CouchDB as an [admins] ini fragment via
extraConfigFiles; services.couchdb.adminPass would have rendered it into
the world-readable store.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TLN5nkLBtCciD3ZnUwtw2b
2026-08-25 23:25:37 +02:00
darmanandClaude Opus 5 94061bd80a monitoring: create the victoriametrics state dir, and pin the scrape timeout
The bind onto /var/lib/private/victoriametrics needs its source to exist or
the mount fails -- and because it is `nofail`, quietly: RequiresMountsFor is
satisfied by /mnt/data itself, so the service would start anyway and write
the TSDB to the eMMC, which is the one thing the bind exists to prevent.
prowlarr.nix has no tmpfiles rule only because its directory predates the
module (migrated from ZimaOS); this is a fresh service, so it creates its
own, same as seerr.nix. Verified on jupiter: the mount is live on md127 and
nothing lands on the OS disk.

scrape_timeout was left implicit at the Prometheus default of 10s, which is
longer than the 5s interval -- VictoriaMetrics clamps it down rather than
erroring, so the config claimed 10s while the scraper used 5s. Say what
actually happens. Checked with `victoria-metrics -promscrape.config.dryRun`,
not just nix eval, which never builds the checked-config derivation.

Also comments: why the bind exists and why `nofail` is load-bearing (the
fileSystems block had none, unlike prowlarr.nix and seerr.nix), and why
mercury needs its own job -- scrape_interval is per-job and job_name must be
unique, so its `job` label will always differ from the other hosts'. Select
on `host` in dashboards or mercury drops out of them silently.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-24 04:58:12 +02:00
darman 15fc18ab50 Merge pull request 'jupiter: add VictoriaMetrics monitoring' (#1) from feat/mars-victoriametrics into master
Reviewed-on: #1
Reviewed-by: darman <mail@erik-s.dev>
2026-08-24 04:48:45 +02:00
darmanandClaude Opus 5 b99337adb7 gitea: subscribe the review hook to pull_request_review
The hook registered with no events at all and delivered nothing.
"pull_request_review_comment" and "pull_request_review_rejected" are real
HookEventTypes and real X-GitHub-Event-Type values, but they are not
things gitea's hook API accepts. updateHookEvents
(routers/api/v1/utils/hook.go) matches a fixed list of api names and
silently ignores anything else, so every event flag stayed false, the POST
succeeded, and the hook sat there inert.

There is no narrower api name: HasEvent (models/webhook/webhook.go)
collapses approved, rejected and review-comment onto
HookEventPullRequestReview, so `pull_request_review` is a single switch for
all three. Approvals consequently cannot be excluded at the hook any more.
They now cross the wire as "pull_request_approved", which is not in the
route's event list, so Hermes ignores them on the event match -- before the
filter script and before any LLM call. Gitea's delivery log will show them
answered 200/ignored, which is intended.

That makes three namespaces for the same event rather than two, so the
tables in both nix files and the README now carry the api column, and the
README warns about the silent-ignore behaviour that hid this.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-24 03:27:52 +02:00
darmanandClaude Opus 5 152c38b56b readme: document both hermes routes and the toolset grant
Fills in the subscription/wire name table for all five mappings rather
than the two prose examples, and records why the routes are written as
config instead of subscribed -- including that the toolset grant is
deliberate but not enforced, since the file it lives in is inside
HERMES_WRITE_SAFE_ROOT.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-24 03:10:43 +02:00
darmanandClaude Opus 5 753573aeea gitea: register a hook per hermes route, and keep both secrets out of argv
One webhook per route, from a list, so adding a route is an entry rather
than a copy of the unit. The PR-review hook subscribes
pull_request_review_comment and pull_request_review_rejected.

The unit runs as the gitea user on a multi-user box, where
/proc/<pid>/cmdline is world-readable for the lifetime of the process, so
`-H "Authorization: token $t"` published the admin token and
`jq --arg secret "$s"` the webhook secret -- which is exactly what the
existing comment claimed to be avoiding by putting the body on stdin. The
token now goes through a 0600 `curl -K` config written with printf (a
shell builtin, so the substitution never reaches an argv) and the secret
through jq --rawfile.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-24 03:10:43 +02:00
darmanandClaude Opus 5 c18413d16d hermes: write the webhook routes as config, and add a PR-review route
`hermes webhook subscribe` has no --toolsets flag, so a webhook run got
Hermes's constrained default (web_search, web_extract, vision_analyze,
clarify) -- no shell, no file access, which meant neither prompt could
actually be carried out: luna was woken, read the comment, and had no way
to act on it. Upstream's documented answer is to add the `toolsets` key to
webhook_subscriptions.json by hand, and a hand edit does not survive this
unit's re-provision. So the whole route definition moves here and the CLI
is not used at all.

The file is written host-side with jq. hermesHome is the bind-mount source
for /opt/data, so the container sees the same inode and hot-reloads it on
the next delivery -- no podman exec, no readiness loop, and no quoting
chain between nix and the prompt text. The merge is per-route: routes this
unit does not name survive, created_at is carried over, and every other
key is replaced outright so a hand-added `deliver_only` or `filters`
cannot linger.

The secret now comes from the sops file directly instead of being read
back out of the container's environment, which drops podman-hermes-agent
from restartUnits (the ordering constraint it existed for is gone) and
takes GITEA_HERMES_WEBHOOK_SECRET out of an env var luna can read.

The new gitea-pr-reviews route covers reviews with a body and
changes-requested. Those are not IssueCommentPayloads: gitea sends a
PullRequestPayload with action "reviewed" and a `review` object of exactly
{type, content} -- no review id, no line comments. So the prompt fetches
them with `tea pulls review-comments` and acts only on ones whose
`resolver` is empty, resolving each as it goes; with no stable id in the
payload, resolved state is the only workable duplicate-delivery guard.
An empty review body is deliberately NOT a drop, unlike in the comment
filter: a review whose substance is entirely in line comments has none.

Approvals are left unsubscribed -- an approval is darman signing off, not
asking for work.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-24 03:10:33 +02:00
darmanandClaude Opus 5 6f99a1fed1 prompt: drop the nix eval validation step
Not executable under the toolset a webhook run actually got: Hermes
defaults those to web_search/web_extract/vision_analyze/clarify, with no
shell. Worth revisiting now that the routes grant `terminal` explicitly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-24 03:10:19 +02:00
darmanandClaude Opus 5 b516a800bf filter: make drops visible in the gateway log
Every drop so far has been silent. The script printed its reason to stderr
and exited 0 with "[SILENT]", but Hermes only logs stderr on the nonzero
path, as

  script ignored webhook path=... code=... stderr=...

so from outside, a deliberate drop, a crash, a timeout and a missing file all
looked identical: {"status":"ignored","reason":"script"} and nothing else.
Finding out which one it was meant re-running the payload through the script
by hand.

Drops now exit 3 with an empty stdout. Both still mean "ignored" to Hermes,
but the reason lands in the log. Exit 3 rather than 1 keeps a deliberate drop
distinguishable from an unhandled exception, which exits 1, so the code alone
says which happened.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 08:55:17 +02:00
darmanandClaude Opus 5 e75f474726 hermes: match --events issue_comment, not pull_request_comment
A timeline comment on a PR never reached the route. Gitea reuses the same
strings in two namespaces and they collide:

  subscription name            wire name (X-GitHub-Event)   what it is
  pull_request_comment         issue_comment                comment on a PR
  issue_comment                issue_comment                comment on an issue
  pull_request_review_comment  pull_request_comment         review on a PR

The hook's `events` array takes the subscription name; Hermes matches
--events against X-GitHub-Event, the wire name, produced by
HookEventType.Event() in modules/webhook/type.go. So --events
pull_request_comment was selecting review submissions and could never match a
comment -- the exact inversion of what it reads like.

That also explains both observed failures. The review submission matched
(wire name pull_request_comment) and reached the filter, which correctly
dropped it on action=reviewed since a PullRequestPayload carries no comment
object. The timeline comment arrived as issue_comment, matched nothing, and
was dropped by the events filter before the script ever ran.

gitea.nix and hermes-agent.nix now deliberately name the same event
differently, so both carry the table and say the other is not a typo.

issue_comment on the wire also covers comments on plain issues. The hook does
not subscribe those, and the filter's is_pull check drops them regardless, so
widening the hook later cannot leak issue comments into the agent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 08:46:31 +02:00
darmanandClaude Opus 5 6116ec4e5a gitea: name the hermes hook and send only PR comments
Names the webhook "PR comments Hermes" (gitea's CreateHookOption/EditHookOption
both carry an optional `name`, so it survives the create and the update path)
and narrows it from all 26 event types to pull_request_comment alone.

Gitea sends pull_request_comment distinctly from issue_comment, so the hook
now covers comments on pull requests and nothing else. Hermes would have
dropped the rest anyway -- its route filters on X-GitHub-Event before any LLM
call -- so this is defence in depth rather than the only gate, but it keeps
traffic that can never be acted on from crossing the wire and reaching the
agent's process at all.

The tradeoff is that event selection now lives on both sides: a second Hermes
route needs its event adding here as well as being subscribed. That is the
right way round for a single-purpose hook, and the comment says so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 08:18:11 +02:00
darmanandClaude Opus 5 2a1a1628e1 relay: remove it; gitea already speaks Hermes's protocol
The relay existed on the premise that Gitea sends no header Hermes can read
an event name from, so something had to copy X-Gitea-Event into
X-GitHub-Event. That premise was wrong. Gitea's addDefaultHeaders sets

  req.Header["X-GitHub-Delivery"]   = []string{t.UUID}
  req.Header["X-GitHub-Event"]      = []string{event}
  req.Header["X-GitHub-Event-Type"] = []string{eventType}

unconditionally, for every webhook type, alongside X-Hub-Signature-256 in
GitHub's exact format. (Direct map assignment rather than .Add() specifically
to keep the "GitHub" casing that canonicalisation would destroy.) Hermes
validates that signature on any route without provider gating and reads the
event name from that header, so gitea and hermes already speak the same
protocol and the translation layer was translating nothing.

Gitea now posts straight at http://mars.orbit.sol:8644/webhooks/gitea-pr-comments.
The URL path is the Hermes route name, so a second subscription is a second
hook and nothing else -- the route-in-path indirection the relay grew was a
reimplementation of something Hermes already had.

Removes the module, the 200-line relay, its test, the mars import, the 8645
listener, and the stale gitea-hermes-webhook-relay.service entry left in the
secret's restartUnits. hermes-agent-webhook-route moves to
hosts/mars/hermes-agent.nix, next to the container and the read-only prompt
and filter mounts it depends on.

Also makes that unit refuse to subscribe when GITEA_HERMES_WEBHOOK_SECRET is
unset in the container, matching the existing empty-prompt check. An empty
secret silently fails every delivery signature check afterwards while the
unit still reports success -- the worst possible failure shape, and one this
setup can actually produce on a first deploy.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 08:09:01 +02:00
darmanandClaude Opus 5 503623551a secrets: rotate gitea_luna_token with the issue scope
The previous token was write:repository only, which clones, fetches and
pushes branches perfectly well and then fails at `tea pr create` — a pull
request is an issue in gitea's data model, so every /pulls endpoint gates on
the issue scope category rather than the repository one.

Regenerated with write:repository,write:issue,read:user. Confirmed against
the running instance: gitea reports the granted set as
  read:activitypub, read:misc, read:notification, read:organization,
  read:package, write:issue, write:repository, read:user
so write:issue is present rather than only read:issue, which would satisfy
the GET half and still fail the POST that opens the PR. The extra read:*
categories are gitea expanding the request, not something asked for.

No manual step on mars: gitea_luna_token already restarts
hermes-agent-prepare-dirs, which does delete-then-add for the tea login on
every start and so picks up the rotation by itself.

The old token is NOT revoked — gitea's CLI cannot delete tokens and the API
route needs basic auth as luna, which nothing here sets. It stays valid until
removed by hand.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 07:58:20 +02:00
darmanandClaude Opus 5 941a6731bb gitea: add a gitea admin CLI alias on jupiter
Mirrors the `hermes` alias on mars. The admin CLI is effectively
undiscoverable without it: the package is not in systemPackages so `gitea` is
not on PATH at all, every admin subcommand needs GITEA_WORK_DIR pointed at a
stateDir that is not the module default, and it has to run as the gitea user
or it drops root-owned files into that directory. Getting any of the three
wrong fails in a different and unhelpful way.

Both the package path and the stateDir come from the config rather than being
written out, so a gitea bump or a stateDir move cannot leave the alias
pointing at something stale — which is exactly what a hardcoded /nix/store
path would do.

Lives in services/dev/gitea.nix, which only jupiter imports, so it does not
leak onto hosts with no gitea to administer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 07:49:05 +02:00
darmanandClaude Opus 5 ee3051f6e4 gitea: allow tailnet webhook targets
Webhook delivery to the hermes relay was refused outright:

  Post "http://mars.orbit.sol:8645/gitea/gitea-pr-comments":
  dial tcp 100.64.0.6:8645: webhook can only call allowed HTTP servers
  (check your security.ALLOWED_HOST_LIST setting),
  deny 'mars.orbit.sol(100.64.0.6:8645)'

ALLOWED_HOST_LIST defaults to `external`, documented as "a valid non-private
unicast IP". Tailscale addresses come from 100.64.0.0/10 — RFC 6598
carrier-grade NAT space — which is not RFC1918 private but does not satisfy
gitea's notion of external either, so every tailnet target is denied by
default. Nothing about the relay or the URL was wrong; the request never left
jupiter.

Sets the tailnet CIDR explicitly and keeps `external`, so a future webhook to
a public service still works without another edit here.

Goes in [security], not [webhook]: the webhook-section key is deprecated in
favour of this one and now merely falls back to it, and [security] is the
name the delivery error itself reports.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 07:35:03 +02:00
darmanandClaude Opus 5 e14571d029 common: add jq to systemPackages
jq was only ever on the `path` of the units that call it, so it was absent
from an interactive shell — which made the hook-migration commands in the
README unrunnable on the host they target. It is a general-purpose tool and
every host already carries curl, so it belongs alongside it rather than being
pulled in per-unit.

Also simplifies those README commands now that jq is present, and uses mars's
existing `hermes` alias instead of spelling out the podman exec.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 07:04:30 +02:00
darmanandClaude Opus 5 3567591ecf provisioning: stop deleting the pre-rename hook and subscription
Retiring gitea-events is a one-off migration, not something worth re-running
on every boot. Both units now only touch what they own: jupiter's creates or
updates its own hook and deletes nothing, and mars's removes only the route
it is about to re-subscribe, as the idempotency step for `subscribe`.

Keeping the deletes would have meant a redeploy could silently remove a hook
or route someone added deliberately -- a real risk now that sibling hooks
for other Hermes routes are the intended pattern.

README carries the manual commands, and the note that both hooks fire until
the old one is removed by hand, so events arrive twice in the meantime.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 06:57:58 +02:00
darmanandClaude Opus 5 f982c6dc14 relay: take the Hermes route from the request path
Renames the subscription to gitea-pr-comments (it handles one event; the old
gitea-events name promised more than it delivered) and drops --deliver.

Rather than move the hardcoded route from one constant to another, the relay
now reads it from the request path: POST /gitea/<route> forwards to
<base>/webhooks/<route>. The route name was the last thing tying this service
to a specific subscription, so a second Hermes route is now a `hermes webhook
subscribe <name>` plus a Gitea hook at /gitea/<name>, with no relay change --
previously it would also have needed a second relay URL baked in here.

The path segment is interpolated into an outbound URL, so it is validated
against ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$ and refused rather than sanitised
when it does not match. The path is matched raw and never URL-decoded, so
percent-encoded separators fail the charset check instead of surviving it;
requiring an alphanumeric first character also rejects "." and "..". Without
this, POST /gitea/..%2fadmin would let anything that can reach the relay
steer it at other Hermes endpoints. Tests cover traversal, encoded traversal,
embedded slashes, leading dot/dash, and the length bound, and assert nothing
reaches the stub Hermes in any of those cases.

Dropping --deliver leaves it at its default of `log`. The prompt tells her to
answer in the pull request, so the PR comment is the delivery and a Telegram
copy would only duplicate it; this also removes the hardcoded chat id that
was a third copy of TELEGRAM_HOME_CHANNEL.

Provisioning retires the pre-rename hook by its EXACT old URL rather than by
"points at the relay". Now that sibling hooks for other routes are the
intended pattern, a prefix match would delete them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 06:52:52 +02:00
darmanandClaude Opus 5 31ba001d06 hermes: give the gitea-events route its prompt and event filter
Completes the subscription: it had a secret, a delivery target and a script,
but no prompt and no event list, so it woke the agent on every forwarded
event with nothing to tell her what to do.

--events pull_request_comment narrows the route to the one event the prompt
handles. This only works because the relay copies X-Gitea-Event into
X-GitHub-Event; without that every delivery arrives as "unknown" and matches
nothing. Gitea sends pull_request_comment distinctly from issue_comment, so
plain issue comments no longer reach the agent at all. The Gitea-side hook
still posts the full event set to the relay and Hermes drops the rest before
any LLM call.

The prompt lives in hosts/mars/gitea-pr-comment-prompt.md, mounted read-only
next to the filter, and is read with $(cat) at subscribe time rather than
passed inline. That is not only about escaping: the text has to survive nix
`` string escaping, the systemd unit file, and `podman exec sh -c '...'`
single-quoting. It contains an apostrophe ("the PR's head branch") that
would terminate that single-quoted string early. Read from a file at runtime
the content never passes through shell source, so it can contain anything.
Verified end to end against the rendered unit with stubbed podman/hermes:
the value reaching --prompt is byte-identical to the repo file apart from
the trailing newline that command substitution strips.

`set -eu` inside the container shell is load-bearing. Without it a missing
prompt file makes cat fail, the substitution yields "", and the subscription
is created with an empty prompt -- a silent failure that still looks like a
healthy unit.

On what read-only does not buy: it protects the sources, and this unit
re-subscribes from them on every start, so a restart restores the intended
prompt, filter and events. The live subscription itself lives in
webhook_subscriptions.json under /opt/data and is hot-reloaded, which is
inside the agent's own write-safe root -- a self-modification would stick
until this unit next runs.

The prompt keeps its own stop conditions even though the filter already drops
those deliveries, and says explicitly that reaching them means the filter
failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 06:41:50 +02:00
darmanandClaude Opus 5 1fc4395068 hermes: add read-only Gitea PR comment filter, break the reply loop
The gitea-events subscription woke the agent on every delivery. That is an
unbounded loop as soon as she is given a prompt that tells her to answer on
the PR: her answer is itself a pull_request_comment, which wakes her again.

Adds a Hermes route script that drops the deliveries that must never reach an
LLM call: luna's own comments (the loop guard), "deleted" actions (the body
is still in the payload, so acting on one means acting on a request that was
explicitly withdrawn), non-pull-request comments, empty bodies, and edits
that did not actually change the body — a label or attachment change fires
"edited" too. Everything else passes through unchanged.

Mounted READ-ONLY from the nix store rather than written into hermesHome.
Hermes resolves route scripts under ~/.hermes/scripts, which here is inside
/opt/data — HERMES_WRITE_SAFE_ROOT — so a filter written there would be a
loop guard sitting in the writable root of the agent it constrains. Deleting
it fails closed (Hermes treats a missing script as "ignore"), but rewriting
it to always-allow would silently restore the loop. Read-only from the store
makes that impossible and keeps the guard in git.

The script also normalises changes.body.from to always exist. Gitea omits
`changes` entirely on created events, and Hermes replaces the prompt payload
with whatever JSON the script emits, so guaranteeing the key here means a
prompt referencing {changes.body.from} renders empty instead of leaving an
unfilled placeholder.

Note the stdout contract (gateway/platforms/webhook.py): only exactly
"[SILENT]", empty output, or a nonzero exit drop a delivery. Any OTHER text
on stdout lets it through and is attached as script_output — so a stray
debug print would silently defeat the filter. All diagnostics go to stderr,
and gitea-pr-comment-filter-test.py asserts that discipline along with each
drop rule (25 cases). Run it after any edit: the fail-closed behaviour means
a syntax error produces silence, not an error.

--events is still unset; event selection remains runtime-tunable policy.
The filter covers only what must not be.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 06:32:31 +02:00
darmanandClaude Opus 5 50f83971de hermes: stop provisioning luna a working copy, fix her git/tea access
Three fixes to how luna's git/tea credentials are set up on mars, all found
against the running instance on 2026-08-23.

Drop the host-side clone. hermes-agent-prepare-dirs used to clone this repo
into ${hermesHome}/workspace/homelab, but nothing ever told luna at runtime
that it was there — she self-manages config/profiles/memories, so a path
baked into this file never reached her. She searched /opt/data/homelab and
/workspace, found neither, and concluded she had no repo at all. The
credentials are what actually grant access; any checkout is hers to make
anywhere inside HERMES_WRITE_SAFE_ROOT. The stale directory left by the old
version is deliberately not cleaned up, just unmanaged from here on.

Point credential.helper at the CONTAINER's path. It was written as the host
path (${hermesHome}/.git-credentials), which does not exist inside the
container where git actually reads the config — broken this way from 3c1f3e5
until now. Nothing host-side consumes those credentials any more, so the
container's view is the only one that has to be right; added `containerHome`
to make the distinction explicit at the point of use.

Chown what the oneshot writes. The image's cont-init only chowns the top
level of hermesHome and its own state — it does not recurse into the
root-owned 0600 files this unit drops there (.git-credentials, and tea's
config.yml, which tea also writes 0600), even though it runs afterwards. The
symptom was not an error but an absence: git reported no credential helper
and tea no login. Uses `if` rather than `[ -d x ] && chown` because under
`set -e` a false test on the left of an && list aborts the unit.

gitea.nix carries the matching comment updates: the luna provisioning unit is
server-side only, and her token needs write:repository,write:issue,read:user.
write:issue is the one that is easy to miss — a pull request IS an issue in
gitea's data model, so /pulls endpoints gate on the issue scope category and
`tea pr create` fails with write:repository alone even though clone, fetch
and push all work.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 06:30:28 +02:00
darmanandClaude Opus 5 2d9be98df7 desktop: add yaak
Desktop API client (REST/GraphQL/gRPC).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 06:30:28 +02:00
darmanandClaude Opus 5 d0aec5b061 secrets: add gitea_hermes_webhook_secret to mars + jupiter
Shared HMAC secret for the Gitea -> Hermes webhook relay merged in #2. Both
hosts need the same value: jupiter signs deliveries with it (the webhook
config registered by gitea-hermes-webhook-provision), and mars verifies them
in the relay and hands it to Hermes through the hermes-agent.env template.

32 random bytes, hex-encoded, stored with no trailing newline — the value
reaches Hermes via an env-file template where a newline would both corrupt
the file and change the key the HMAC is computed with.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S94o42aQ8VkBmEWvDem5xa
2026-08-23 05:18:58 +02:00
darman bdd6107be1 Merge pull request 'mars: add generic Gitea webhook relay' (#2) from feat/mars-gitea-webhook-relay into master
Reviewed-on: #2
Reviewed-by: darman <mail@erik-s.dev>
2026-08-23 05:14:35 +02:00