mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 00:28:51 +01:00
widget-drag
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f182e22b56 |
feat(chat): book without a second tap, reminders, notes, agenda, pictures and voice; skill installs itself (#1224)
* feat(chat): book without a second tap, reminders, notes, agenda, pictures and voice; skill installs itself * feat(ops): doctor prints how the gateway sends a message --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
61f73c248f |
fix(openclaw): match the gateway unit by what it runs, and print what the box has (#986)
* 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> |
||
|
|
f525f55ac6 |
fix(openclaw): restart the gateway as root through whatever supervises it (#985)
* 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 --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
1d1c930577 |
fix(openclaw): hand the remote script to bash on stdin, not through sudo -i (#984)
* 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 --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
ce92d74b70 |
fix(openclaw): find the openclaw CLI for a user whose login shell lacks it (#983)
* 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 --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
a1cc13053c |
feat(mcp): message Loki from any AI app; the Telegram agent reads screenshots and videos (#965)
* 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 --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
5f4797ea0a |
fix(notify,install): two silent no-ops found by running the thing (#765)
* feat(approvals): standing approvals + one-tap decisions from Telegram
Asking Loki in Telegram to put an appointment in the calendar did not put an
appointment in the calendar. It sent you to a website.
Three separate causes, all fixed here:
1. THE CHAT HAD NO ROAD TO THE CALENDAR AT ALL. `gog calendar create` is
blocked on the box by the safety shim, and the fleetcrown skill could only
decide drafts that already existed — it had no way to create one. So the
agent hit the shim, read "route it through the approval queue", and passed
that on as advice. Adds `fc.sh book`, which proposes a structured event
through /api/actions/propose, and rewrites the shim's refusal to name it.
The shim still blocks every external Google write; unattended agents have
gained nothing.
2. THE GATE WAS ON THE WRONG SIDE OF THE REVERSIBILITY LINE. The queue enforced
"nothing runs that the operator did not TAP", which is stricter than the rule
it stands for ("nothing runs that the operator did not APPROVE"). For an
event in your own calendar — private, self-only, undone by deleting it — the
difference was pure latency (2026-08-04: proposed 14:15, booked 21:02).
Standing approvals let that yes be given once, in advance, with three rails
in code rather than in a docblock: eligibility is hard-coded (calendar events
and commitments only — never anything that reaches another person), the
payload is re-checked at decision time (guests mean invitations, so those go
back to the queue), and unknown is never yes (no resolvable time, or a slot
already past, queues). Default on for calendar events; toggle at /approvals.
3. THE NOTIFICATION HANDED BACK A CHORE. "2 actions are waiting… <url>" states
a problem and leaves the answer behind a login. Decisions now arrive as a
card carrying what/when/where plus one-tap Approve / Reject / Edit buttons,
backed by HMAC links scoped to one action and one verb — so a decision needs
no session and works when the gateway is down. Still two messages and only
two: one when a decision is owed, one when the effect really happened.
Also fixes a real data bug: propose_action had no event date fields, so the WHEN
of an appointment had nowhere to go and arrived as prose in `body`, which a Groq
pass then had to guess back — a model re-deriving a value the model one step
earlier knew exactly.
Behaviour that did NOT change: emails, messages, dispatches, and person-book
writes still require a per-item yes, and always will — they are ineligible in
code, and a preference row naming one authorises nothing. Every auto-approval is
audited with `via: standing-rule` and announced, so nothing is done in the
operator's name silently.
Tests pin the parts that must not be trusted: 37 cases on the standing-approval
rails (asserted from the side that hurts — a false `auto: true`), 21 on token
forgery and tampering.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(chat-skill): the chat's whole Loki skill was dead, and unversioned
Found while testing the previous commit end-to-end, and it is the largest of
the reasons appointments never got added.
On 2026-09-14 the product was renamed to Loki and `calendar-drain.env`'s keys
were renamed with it. The chat agent's skill script, which reads that file, was
not — because it lived only on the box, where no gate in this repo could see
it. Since then every command it offers has aborted on its first line:
line 14: <OLD>_AGENT_TOKEN: <OLD>_AGENT_TOKEN missing in calendar-drain.env
Verified live on bitbaum just now. So from Telegram the operator could not list
the approval queue, could not approve or reject anything, and could not
dispatch — silently, because a skill that errors just makes the agent talk
about something else instead. The only surviving route to a decision was the
website. That is the complaint, and it had a cause older than the UX.
Fixes:
- Renames the skill to `loki` (the retired product name is forbidden in this
repo by scripts/hetzner/test-no-retired-name.sh — which caught this commit,
correctly, when the box files were first imported verbatim) and reads the
env keys the file actually has.
- The installer REMOVES the superseded skill directory rather than leaving it.
Two skills claiming the same job, one of which cannot run, is how the agent
kept choosing the broken one.
- The installer now runs `loki.sh pending` as the openclaw user and fails if it
cannot authenticate. That is the check which would have caught the rename on
the day it happened: run the thing, as the user who runs it, and require real
output. Every other verification in that script only asserted that files
exist, and files existing is exactly what was true throughout the outage.
Also closes a gap in the previous commit: an auto-approved COMMITMENT executed
without telling anyone, while the comments claimed every auto-approval is
announced. Calendar events are announced from where gog succeeds (asynchronous,
on the box); everything else finishes inside enqueueAction, so that is the only
place that knows it finished at all. A standing approval nobody is told about
is not a standing rule, it is a silent one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(install): keep the gog shim parseable, and prove the block still fires
The replacement text I substituted into the shim carried double quotes. It
lands inside `block(){ echo "…" >&2; }` — a double-quoted bash string — so a
quote in the middle of it closes that string early and leaves the shim a
syntax error. Every gog call on the box would then fail, reads included, and
the calendar drain's real bookings with them: an install step meant to improve
an error message would have taken out the calendar entirely.
Caught by tracing the sed against the shim's actual text rather than running
it. Two checks added so the next one is caught by the machine:
- `bash -n` on the shim after the edit — it is a shell script we just modified
in place, so prove it still parses before trusting anything else about it.
- Actually attempt a calendar write as the openclaw user and require it to be
REFUSED. The old check grepped for the rule's text, and a rule you can read
in a file is not a rule you have seen refuse anything.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(ui): use tokens this design system actually defines
The new approvals control and decision page reached for `text-brand`,
`accent-brand`, `bg-surface-hover` and `rounded-card`. None of those exist in
globals.css — the real names are `accent-text`, `surface-raised` and the
`radius-*` scale. Tailwind emits nothing for an unknown utility and reports no
error, so the checkbox would have rendered browser-default blue and the hover
state simply would not have happened, on a page whose entire job is to be
tapped once and trusted.
The design check passes either way: it forbids arbitrary values (`bg-[#fff]`),
which is a different failure from naming a token that was never defined. Caught
by grepping whether any other component uses these names — none did, which is
the tell.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(notify,install): two silent no-ops found by running the thing
Both found by exercising the deployed feature end to end rather than reading
it, and both are the same failure: a step that could not succeed, reporting
nothing.
1. A REFUSED TELEGRAM SEND WAS INVISIBLE. sendTelegramMessage reports a bad
token, a blocked chat or an API error as `{ok:false}` — an ordinary return
value, not an exception — so the try/catch around it caught the case that
never happens and ignored the case that does. That matters more here than
in a normal notification: the confirmation message IS the review mechanism
for actions a standing rule took without asking. If it stops arriving, the
operator does not notice Loki went quiet; they notice Loki apparently
stopped doing things, which is the opposite of what is true. Both senders
now log a refusal.
2. THE INSTALLER'S CLEANUP STEP CLEANED NOTHING. It globbed the skills
directory as the ssh user, who cannot traverse the openclaw home: the glob
matched nothing, the loop ran zero times, and the script printed its success
banner. The superseded skill was still installed afterwards — the exact
"two skills claiming one job, one of them broken" state the step exists to
prevent, left in place by the step that prevents it.
Fixed by running the loop under sudo, and then ASSERTING no other skill
ships the old entrypoint. Trusting the loop's own silence is what let the
first version pass; verified on the box that it now removes the directory
and that the assertion sees an empty result afterwards.
Verified live on bitbaum after deploying the parent change: booking from the
chat skill returns auto-approved, the drain books it, the row reaches executed,
and the event is really in Google Calendar at the right time. Test event
deleted.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(auth): the one-tap approval link redirected to sign-in
The feature whose entire purpose is "decide from your phone without logging in"
sent you to a login page. Found by tapping it against production, not by
reading it:
GET /a/<token> → 302 /sign-in?callbackUrl=/a/<token>
Route auth here is one negative-lookahead regex in src/proxy.ts listing the
prefixes served without a session, and `a/` was not among them. Every unit test
on the token passed throughout — 21 of them — because they tested the TOKEN.
Nothing tested whether the route could be reached, which is the part that was
broken. A signature that verifies perfectly behind a login is worth nothing.
Adds `a/` with the same justification the file already records for `share/task/`:
the minted token IS the credential, the holder has no account by design, and the
link decides exactly one action with one verb (lib/actions/action-link.ts).
THE TRAILING SLASH IS LOAD-BEARING, and that is why this commit also adds a
gate. The list holds bare prefixes, so `a` instead of `a/` would have made
/approvals, /api/*, /agent — every path starting with that letter — publicly
readable, and nothing would have looked broken: the app would have worked
better, with nobody asked to log in. That is the one direction a reviewer will
not notice.
scripts/test/public-matcher.ts reads the real regex out of the real file and
asserts BOTH directions: what must be reachable without a session, and what must
not. Proven by mutation before committing — with `a` in place of `a/`, eight
assertions fail loudly (/approvals, /api/actions/pending, /api/me/preferences
among them). A test that only checked the public list would have passed just as
happily on a regex that made the whole app public.
Verified: pnpm verify green.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
e6b8a17970 |
feat(approvals): standing approvals + one-tap decisions from Telegram (#761)
* feat(approvals): standing approvals + one-tap decisions from Telegram
Asking Loki in Telegram to put an appointment in the calendar did not put an
appointment in the calendar. It sent you to a website.
Three separate causes, all fixed here:
1. THE CHAT HAD NO ROAD TO THE CALENDAR AT ALL. `gog calendar create` is
blocked on the box by the safety shim, and the fleetcrown skill could only
decide drafts that already existed — it had no way to create one. So the
agent hit the shim, read "route it through the approval queue", and passed
that on as advice. Adds `fc.sh book`, which proposes a structured event
through /api/actions/propose, and rewrites the shim's refusal to name it.
The shim still blocks every external Google write; unattended agents have
gained nothing.
2. THE GATE WAS ON THE WRONG SIDE OF THE REVERSIBILITY LINE. The queue enforced
"nothing runs that the operator did not TAP", which is stricter than the rule
it stands for ("nothing runs that the operator did not APPROVE"). For an
event in your own calendar — private, self-only, undone by deleting it — the
difference was pure latency (2026-08-04: proposed 14:15, booked 21:02).
Standing approvals let that yes be given once, in advance, with three rails
in code rather than in a docblock: eligibility is hard-coded (calendar events
and commitments only — never anything that reaches another person), the
payload is re-checked at decision time (guests mean invitations, so those go
back to the queue), and unknown is never yes (no resolvable time, or a slot
already past, queues). Default on for calendar events; toggle at /approvals.
3. THE NOTIFICATION HANDED BACK A CHORE. "2 actions are waiting… <url>" states
a problem and leaves the answer behind a login. Decisions now arrive as a
card carrying what/when/where plus one-tap Approve / Reject / Edit buttons,
backed by HMAC links scoped to one action and one verb — so a decision needs
no session and works when the gateway is down. Still two messages and only
two: one when a decision is owed, one when the effect really happened.
Also fixes a real data bug: propose_action had no event date fields, so the WHEN
of an appointment had nowhere to go and arrived as prose in `body`, which a Groq
pass then had to guess back — a model re-deriving a value the model one step
earlier knew exactly.
Behaviour that did NOT change: emails, messages, dispatches, and person-book
writes still require a per-item yes, and always will — they are ineligible in
code, and a preference row naming one authorises nothing. Every auto-approval is
audited with `via: standing-rule` and announced, so nothing is done in the
operator's name silently.
Tests pin the parts that must not be trusted: 37 cases on the standing-approval
rails (asserted from the side that hurts — a false `auto: true`), 21 on token
forgery and tampering.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(chat-skill): the chat's whole Loki skill was dead, and unversioned
Found while testing the previous commit end-to-end, and it is the largest of
the reasons appointments never got added.
On 2026-09-14 the product was renamed to Loki and `calendar-drain.env`'s keys
were renamed with it. The chat agent's skill script, which reads that file, was
not — because it lived only on the box, where no gate in this repo could see
it. Since then every command it offers has aborted on its first line:
line 14: <OLD>_AGENT_TOKEN: <OLD>_AGENT_TOKEN missing in calendar-drain.env
Verified live on bitbaum just now. So from Telegram the operator could not list
the approval queue, could not approve or reject anything, and could not
dispatch — silently, because a skill that errors just makes the agent talk
about something else instead. The only surviving route to a decision was the
website. That is the complaint, and it had a cause older than the UX.
Fixes:
- Renames the skill to `loki` (the retired product name is forbidden in this
repo by scripts/hetzner/test-no-retired-name.sh — which caught this commit,
correctly, when the box files were first imported verbatim) and reads the
env keys the file actually has.
- The installer REMOVES the superseded skill directory rather than leaving it.
Two skills claiming the same job, one of which cannot run, is how the agent
kept choosing the broken one.
- The installer now runs `loki.sh pending` as the openclaw user and fails if it
cannot authenticate. That is the check which would have caught the rename on
the day it happened: run the thing, as the user who runs it, and require real
output. Every other verification in that script only asserted that files
exist, and files existing is exactly what was true throughout the outage.
Also closes a gap in the previous commit: an auto-approved COMMITMENT executed
without telling anyone, while the comments claimed every auto-approval is
announced. Calendar events are announced from where gog succeeds (asynchronous,
on the box); everything else finishes inside enqueueAction, so that is the only
place that knows it finished at all. A standing approval nobody is told about
is not a standing rule, it is a silent one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(install): keep the gog shim parseable, and prove the block still fires
The replacement text I substituted into the shim carried double quotes. It
lands inside `block(){ echo "…" >&2; }` — a double-quoted bash string — so a
quote in the middle of it closes that string early and leaves the shim a
syntax error. Every gog call on the box would then fail, reads included, and
the calendar drain's real bookings with them: an install step meant to improve
an error message would have taken out the calendar entirely.
Caught by tracing the sed against the shim's actual text rather than running
it. Two checks added so the next one is caught by the machine:
- `bash -n` on the shim after the edit — it is a shell script we just modified
in place, so prove it still parses before trusting anything else about it.
- Actually attempt a calendar write as the openclaw user and require it to be
REFUSED. The old check grepped for the rule's text, and a rule you can read
in a file is not a rule you have seen refuse anything.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(ui): use tokens this design system actually defines
The new approvals control and decision page reached for `text-brand`,
`accent-brand`, `bg-surface-hover` and `rounded-card`. None of those exist in
globals.css — the real names are `accent-text`, `surface-raised` and the
`radius-*` scale. Tailwind emits nothing for an unknown utility and reports no
error, so the checkbox would have rendered browser-default blue and the hover
state simply would not have happened, on a page whose entire job is to be
tapped once and trusted.
The design check passes either way: it forbids arbitrary values (`bg-[#fff]`),
which is a different failure from naming a token that was never defined. Caught
by grepping whether any other component uses these names — none did, which is
the tell.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|