zot/internal/agent/tools
patriceckhart cead9fdff1 telegram: let zot send images and files back through the bridge
The bridge already mirrored the assistant's text reply into the
paired Telegram chat but had no way to push real attachments. A
turn that came in over Telegram could only ever produce a textual
description of an image, never the image itself.

Add two model-facing tools, registered on the running agent only
while the bridge is connected:

- telegram_send_image(path, caption?) uploads a local image
  (png/jpg/gif/webp) as an inline Telegram photo. Telegram
  compresses for preview, which is what you usually want for a
  screenshot or chart.

- telegram_send_file(path, caption?) uploads any local file as a
  document attachment with no compression. Use for non-images or
  when the recipient needs the original bytes.

Plumbing:

- Client.SendPhoto multipart upload mirrors SendDocument, hitting
  sendPhoto so Telegram renders the image inline.
- Bridge.SendImage / SendDocument resolve the paired chat id and
  return a clear error when the bridge is not running or no user
  has paired yet.
- A small TelegramSender interface in package tools keeps the
  tools package free of any telegram dependency; an adapter in
  interactive.go forwards to the live *telegram.Bridge.
- applyTelegramTools mutates the running agent's tool registry on
  /telegram connect / disconnect, on /model swaps, and on login
  rebuilds. Walks the live registry rather than restoring from a
  snapshot so extension or /reload-ext additions survive a later
  disconnect; we only add or strip the two telegram entries.

Both tools respect the sandbox, refuse non-image inputs in
send_image, and reject directories. They return a one-line text
result the model can use to confirm the upload ("sent /path/foo.png
to telegram (1.2 MB)").
2026-04-28 08:23:04 +02:00
..
bash.go fix(bash): kill process group immediately on cancel 2026-04-23 18:47:44 +02:00
bash_unix.go fix(bash): kill entire process group on cancel 2026-04-23 09:43:57 +02:00
bash_windows.go fix(bash): kill entire process group on cancel 2026-04-23 09:43:57 +02:00
edit.go feat(tui): context diffs + framed tool blocks + paced streaming 2026-04-20 15:50:39 +02:00
read.go rename: /lock -> /jail, /unlock -> /unjail 2026-04-20 08:57:40 +02:00
sandbox.go rename: /lock -> /jail, /unlock -> /unjail 2026-04-20 08:57:40 +02:00
sandbox_test.go initial commit 2026-04-17 20:36:38 +02:00
telegram_send.go telegram: let zot send images and files back through the bridge 2026-04-28 08:23:04 +02:00
tools_test.go perf(read): drop line numbers from model-facing output 2026-04-19 17:33:05 +02:00
write.go feat(tui): live-stream file body during write/edit tool calls 2026-04-20 08:37:14 +02:00