mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 11:48:24 +01:00
* feat(openclaw): the Telegram agent reads screenshots, photos and videos The Telegram agent is OpenClaw on bitbaum, and OpenClaw already describes inbound media before the chat model reads the turn — but on defaults that cut every description at 500 characters and read one attachment per message. A screenshot lost most of its text; an album was read as its first picture; video had a one-line "Describe the video." prompt. - scripts/openclaw/media-understanding.json: versioned tools.media.image and tools.media.video blocks (Gemini; screenshots transcribed verbatim, albums read whole; videos returned as transcript + visuals + claims + authenticity signs so the agent can argue about whether a clip holds up). tools.media.audio is deliberately untouched — voice notes already work. - scripts/openclaw/install-media-understanding.sh: the only way it reaches the box. Refuses without a Gemini key, writes through OpenClaw's own schema-validating `config set`, restarts the gateway, then proves an image (and, where ffmpeg exists, a video) is actually described. - scripts/test/openclaw-media-config.ts: pins the limits and the audio hands-off rule. Validated against openclaw@2026.4.23's schema locally. Not yet applied to the box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD * refactor(actions): share the decision and the enqueue report; let a turn be read-only Groundwork for the MCP server, so it calls the same code the chat seams do instead of a copy of it: - lib/actions/decide-action.ts: approve/reject one draft, lifted out of POST /api/actions/[id]/decision (which now calls it; wire shape unchanged). - lib/actions/enqueue-report.ts: what an enqueue outcome may truthfully be called (auto-approved / awaiting-approval / deduped), lifted out of POST /api/actions/propose (wire shape unchanged). - config/orangecat.ts: the OrangeCat origin and OAuth issuer in a DB-free module; Auth.js and the identity bridge read the issuer from here instead of each re-deriving it. - askLoki / runLokiTurn take `readOnly`: the tool loop drops its propose tools and the OpenClaw gateway fallback is skipped, so a caller granted conversation but not action cannot get Loki to act by asking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD * feat(mcp): a remote MCP server so AI apps can message Loki and have it act POST /api/mcp speaks MCP Streamable HTTP (stateless JSON-RPC 2.0; protocol 2025-11-25 / 2025-06-18 / 2025-03-26). claude.ai and ChatGPT connectors, Claude Code and Cursor can ask Loki, list the approval queue and projects, dispatch work, book appointments and decide queued actions. Auth: a ck_* agent token (both scopes), or an OrangeCat RS256 access token verified with node:crypto against the issuer's JWKS — iss, aud (must be the Loki resource URL, never a client id), exp. `sub` maps to the Loki user via orangecatActorId; an unlinked actor gets the sign-in step, not a 500. A missing or bad token is a 401 whose WWW-Authenticate points at the RFC 9728 metadata served at /.well-known/oauth-protected-resource(/api/mcp). Scopes loki.chat / loki.act and the tool map are SSOT in src/config/mcp.ts. Act tools go through injectPrompt, enqueueAction and decideAction — the functions the Telegram skill's routes call — so the approval queue gates them exactly as it does there. Both paths are excluded from the session middleware (proxy.ts, with the reason), registered in api-route-auth and the demo sandbox. Docs: docs/development/mcp.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD * fix(openclaw): match the installer's smoke output with a here-string, not a pipe printf | grep -q can report a miss on a match under pipefail (grep exits, the writer takes SIGPIPE). no-grep-q-in-a-pipe caught it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD * feat(openclaw): a workflow that installs media understanding on the box install-media-understanding.sh needs SSH to bitbaum and a Gemini key, which a sandboxed agent session has neither of. This workflow_dispatch job has both: it reuses deploy.yml's HETZNER_SSH_KEY / HETZNER_IP, takes the key from the GEMINI_API_KEY repo secret or, failing that, from OrangeCat's env already on the box, writes it into the openclaw user's ~/.openclaw/.env only when none is there, and runs the installer, which proves a describe. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD * fix(openclaw): find the openclaw CLI for a user whose login shell lacks it The first run of the media workflow reached the box, found the Google key already there, and died on `openclaw: command not found`: the CLI is under nvm, which only an interactive .bashrc puts on PATH. Each remote step now sources .bashrc, then falls back to the nvm / npm-global / local bin directories, and refuses loudly if none has the binary. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD * fix(openclaw): hand the remote script to bash on stdin, not through sudo -i `sudo -i` re-joins and re-parses its argument string through the target user's shell, so the multi-line CLI-finding preamble arrived broken on the box ("unexpected end of file from `{'"). The script now travels on stdin to `bash -ls`, which nothing in between re-parses. The local stand-in for sudo now re-parses the same way, so this shape is what the dry run tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD * fix(openclaw): restart the gateway as root through whatever supervises it The third run from GitHub Actions wrote and validated the media config on the box, then died in `openclaw gateway restart`: under `sudo -iu openclaw` the CLI reaches for `systemctl --machine openclaw@ --user`, and the openclaw user's own systemd manager is not running there. The restart is now done as root, by finding the supervisor in order — a system unit named openclaw/ivy, a user unit with a live bus, a user unit whose manager needs linger — and the failure branch prints what it found. "Up" is answering HTTP on :18789, which every supervisor shape shares, instead of a systemd status the CLI may be unable to read. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD * fix(openclaw): match the gateway unit by what it runs, and print what the box has The fourth run restarted `ivy-health-deep.service` — a health probe that merely shares the `ivy` prefix — then waited on :18789, where nothing was listening. The unit is now found by a unit file that mentions openclaw/ivy AND gateway (name match only as a fallback, and only with "gateway" in it), the step prints the units, the gateway process and its listening sockets before touching anything, and "up" accepts a listening gateway process on any port, naming it, when :18789 stays silent. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tsc8Yu7TQR9a6Y5xNYkeD --------- Co-authored-by: Claude <noreply@anthropic.com>