|
1 | 1 | # Magec - TODO |
2 | 2 |
|
3 | | -## High Priority |
4 | | - |
5 | | -### Large Message Handling in Telegram and Slack |
| 3 | +## ~~Large Message Handling in Telegram and Slack~~ ✅ |
6 | 4 |
|
7 | | -**Problem**: No validation on inbound message size from Telegram/Slack, and outbound responses to Telegram may exceed the 4096-character message limit. Large inputs could cause excessive memory usage or unexpected behavior, and oversized responses will fail silently or get truncated by the API. |
8 | | - |
9 | | -**Solution**: |
10 | | -- **Inbound**: Add a max input length check in both clients. Reject or truncate messages that exceed a reasonable threshold (e.g. 16K chars) with a user-friendly error. |
11 | | -- **Outbound (Telegram)**: Split responses exceeding 4096 chars into multiple sequential messages. Preserve markdown formatting across splits where possible. |
12 | | -- **Outbound (Slack)**: Slack's limit is ~40K per message block — less urgent but should still have a safety check. |
13 | | - |
14 | | -**Modify**: `server/clients/telegram/bot.go`, `server/clients/slack/bot.go` |
| 5 | +Implemented. See `server/clients/msgutil/` package. |
15 | 6 |
|
16 | 7 | --- |
17 | 8 |
|
| 9 | +## High Priority |
| 10 | + |
18 | 11 | ### Multimodal File/Image Support in Clients |
19 | 12 |
|
20 | 13 | **Problem**: Telegram and Slack clients only handle text and voice messages. Users sending images, documents, PDFs, or other files get silently ignored. |
21 | 14 |
|
22 | 15 | **Solution**: Download files from Telegram/Slack, encode as base64, and send as `inlineData` parts alongside text in the ADK `/run` request. The ADK already supports `genai.Part{InlineData: &Blob{Data, MIMEType}}` — zero backend changes needed. |
23 | 16 |
|
| 17 | +**Adapter support (adk-utils-go v0.3.1)**: |
| 18 | +- **Gemini**: passes all `InlineData` transparently to the API. Unsupported types are rejected by Google's API. |
| 19 | +- **OpenAI**: translates images (JPEG, PNG, GIF, WebP), audio (WAV, MP3, MPEG, WebM), and files (PDF, text/*). Unsupported types return an error. |
| 20 | +- **Anthropic**: translates images (JPEG, PNG, GIF, WebP), PDFs, and text documents (text/*). Unsupported types return an error. |
| 21 | +- All three adapters behave the same: if a MIME type can't be translated, the request fails. No silent drops. |
| 22 | + |
| 23 | +**File size limits**: 5MB per file, 10MB total per message, max 10 files per message. Validated client-side before download. |
| 24 | + |
| 25 | +**Supported types (denominator común)**: JPEG, PNG, GIF, WebP. PDF and text/* work on Gemini + Anthropic. Audio works on Gemini + OpenAI. |
| 26 | + |
24 | 27 | **Telegram** (`server/clients/telegram/bot.go`): |
25 | 28 | - Current state: only `Voice` (dedicated handler) and `Text` (predicate at ~line 171 requires `Text != ""` and `Voice == nil`). Everything else is silently dropped. |
26 | 29 | - Add handler for `Document`, `Photo`, `Video`, `Audio`, `Animation`, `VideoNote`, `Sticker`. All have `FileID` → `bot.GetFile()` → download bytes. |
|
46 | 49 | } |
47 | 50 | ``` |
48 | 51 |
|
49 | | -**File size validation**: Add 20MB limit (denominator común: Gemini 20MB, OpenAI 20MB, Anthropic 5MB for images). Telegram API limits bots to 20MB anyway. Reject oversized files with user-friendly message. |
| 52 | +**File size validation**: 5MB per file, 10MB total per message, max 10 files. Reject oversized files with user-friendly message. |
50 | 53 |
|
51 | 54 | **LLM limitations**: GPT-4o/Claude/Gemini handle images and PDFs natively. For Word/Excel/CSV, the model may not support them — the user gets a natural "I can't process this format" response from the LLM itself. |
52 | 55 |
|
@@ -127,28 +130,9 @@ See `.agents/ADK_TOOLS.md` for protocol details. |
127 | 130 |
|
128 | 131 | --- |
129 | 132 |
|
130 | | -### Artifact Management Toolset |
131 | | - |
132 | | -**Problem**: ADK has artifact storage (versioned, session-scoped) and REST endpoints for clients to download them, but the LLM has no way to create, read, list, or delete artifacts. Without tools that call `ctx.SaveArtifact()` / `ctx.LoadArtifact()`, the artifact system is dead weight. |
133 | | - |
134 | | -**Solution**: Build a base toolset with four Go-native tools using `functiontool`: |
135 | | -- `save_artifact(name, content, mimeType)` — saves content as a versioned artifact in the session |
136 | | -- `load_artifact(name)` — reads an artifact (latest version) back into context |
137 | | -- `list_artifacts()` — lists all artifacts in the current session |
138 | | -- `delete_artifact(name)` — removes an artifact |
139 | | - |
140 | | -**Use cases**: |
141 | | -- LLM generates a report/export → `save_artifact()` → user downloads via Voice UI / Telegram / Slack using existing ADK GET endpoints |
142 | | -- Flow pipelines: step 1 produces data → `save_artifact()`, step 2 reads → `load_artifact()` and transforms |
143 | | -- Combined with a filesystem MCP: `load_artifact()` → process → `write_file()` to persist externally, or `read_file()` → `save_artifact()` to make available for download |
144 | | - |
145 | | -**Design**: |
146 | | -- Configurable per agent (not all agents need it) — toggle in agent config, similar to memory tools |
147 | | -- Sandboxed by session — no security risk, no file system access |
148 | | -- ADK handles versioning and storage automatically |
149 | | -- Replaces `loadartifactstool` from ADK (read-only) with a complete CRUD toolset |
| 133 | +### ~~Artifact Management Toolset~~ ✅ |
150 | 134 |
|
151 | | -**Modify**: `server/agent/agent.go` (register toolset in `buildToolsets`), new file `server/agent/tools/artifacts.go`, `server/store/types.go` (agent config toggle), `frontend/admin-ui/` (agent form toggle) |
| 135 | +Implemented. See `server/agent/tools/artifacts/toolset.go` — provides `save_artifact`, `load_artifact`, and `list_artifacts` tools via `functiontool.New`. Supports text and base64 binary content. Wired into `base_toolset.go` so all agents get it. Filesystem-backed via `adk-utils-go/artifact/filesystem` (persists across restarts). Clients (Telegram and Slack) auto-deliver new artifacts as file attachments after each `/run` response using before/after diff of the artifact list REST endpoint. |
152 | 136 |
|
153 | 137 | --- |
154 | 138 |
|
|
0 commit comments