clawgram 2.19.0 → 2.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -748,11 +748,12 @@ attachment *metadata* — kind, file name, size, duration — and fetch nothing.
748
748
  out: an image posted in a chat before the agent was addressed, and any reuse of an image at all,
749
749
  because the file the inbound path read is deleted the moment the reading ends.
750
750
 
751
- `fetch-media` covers both. It takes one message and returns what is attached to it.
751
+ `fetch-media` covers both. It takes one message and returns what is attached to it. The action
752
+ also answers to **`download-file`**, core's own name for it — see the note on naming below.
752
753
 
753
754
  | Parameter | Aliases | Notes |
754
755
  |---|---|---|
755
- | `chatId` | `target`, `to`, `chat` | Same targets as everywhere else: `@username`, numeric id, `me` |
756
+ | `chatId` | `chat` | The chat: `@username`, numeric id, `me`. **Not `target`** — core reserves that for actions in its own vocabulary and refuses it here |
756
757
  | `messageId` | `id`, `message`, `msgId` | The id `read` reported for the message |
757
758
  | `mode` | — | `both` (default), `read`, `file` |
758
759
 
@@ -768,6 +769,15 @@ The action is confined by `readChats`, the same scope that gates history and mem
768
769
  account may not read history from cannot be a source of bytes either. The action name also answers
769
770
  to `fetchMedia`, `download-media`, `downloadMedia` and `getMedia`.
770
771
 
772
+ **On the two names.** Core keys its target policy by its own action vocabulary
773
+ (`CHANNEL_MESSAGE_ACTION_NAMES`), and an action outside it is treated as both *requiring* a target
774
+ and *not accepting* one — the same lookup returns `undefined` for the first check and defaults to
775
+ `"none"` for the second. A caller then gets `Action fetch-media requires a target.` without a
776
+ target and `Action fetch-media does not accept a target.` with one, whatever it tries.
777
+ `download-file` is in that vocabulary and maps to `"none"`, so the contradiction does not arise;
778
+ `fetch-media` is made usable by declaring `chatId` as its destination param
779
+ (`messageActionTargetAliases`). Both names run the same code.
780
+
771
781
  What comes back is `ok: true` with `media` (the same metadata `read` reports), `understanding`
772
782
  (`description` or `transcript`), and `text` and/or `filePath` per the mode. A fetch that yields
773
783
  nothing is not an error — it says which nothing it was:
package/dist/channel.js CHANGED
@@ -408,7 +408,7 @@ const createChannelPlugin = (runtimes, pluginRuntime) => {
408
408
  "Use the `chatInfo` action to learn what a chat is — title, type, member count, description, pinned message — instead of guessing from its id.",
409
409
  "Use the `topics` action to list a forum's topics by name (optional `query` narrows by title); that is where a `threadId` comes from when someone names a topic instead of quoting a message in it.",
410
410
  "Pass that `threadId` to `read` as well: without it a forum read returns every topic interleaved rather than the one that was asked about.",
411
- "Use the `fetch-media` action (chatId + messageId) to fetch the attachment on a message `read` reported: `mode: \"read\"` returns a description of an image or a transcript of a voice note, `\"file\"` returns a path to reuse, `\"both\"` (default) returns both. `read` only says an attachment exists; this is what brings it.",
411
+ "Use the `download-file` action (or its alias `fetch-media`) to fetch the attachment on a message `read` reported. Name the chat with `chatId` and the message with `messageId`; do not pass `target` — core refuses it for this action: `mode: \"read\"` returns a description of an image or a transcript of a voice note, `\"file\"` returns a path to reuse, `\"both\"` (default) returns both. `read` only says an attachment exists; this is what brings it.",
412
412
  "Use the `dialogs` action to find out which group chats this account is actually in — including ones nobody has configured yet. It reports id, title and type only, never direct chats, and only when the account enables `discoverChats`.",
413
413
  "Use `createGroup` (title, optional about, optional users) to create a new Telegram supergroup; `addMembers`/`removeMember` change who is in a managed chat, `promoteAdmin`/`demoteAdmin` grant or revoke admin rights, `transferOwnership` hands the chat over, `inviteLink` issues an invite link for people Telegram refused to add directly.",
414
414
  ],
@@ -1392,7 +1392,20 @@ const createChannelPlugin = (runtimes, pluginRuntime) => {
1392
1392
  // Reading an attachment that is already in a chat. `read` reports
1393
1393
  // that a photo exists; this is what turns it into something the
1394
1394
  // agent can look at or pass on.
1395
- "fetch-media",
1395
+ //
1396
+ // Two names on purpose. `download-file` is core's own vocabulary
1397
+ // (`CHANNEL_MESSAGE_ACTION_NAMES`), and core's target policy is
1398
+ // keyed by that vocabulary: an action it does not know is both
1399
+ // "requires a target" (`MESSAGE_ACTION_TARGET_MODE[action] !==
1400
+ // "none"` is true for `undefined`) and "does not accept a target"
1401
+ // (the same lookup defaults to `"none"` when a target is passed).
1402
+ // That contradiction is unresolvable from the caller's side —
1403
+ // measured on 2026-08-24, when the agent tried every combination
1404
+ // and got one of the two errors each time. `download-file` is
1405
+ // mapped to `"none"`, so it has no such contradiction;
1406
+ // `fetch-media` stays as the descriptive name and is made usable
1407
+ // by the alias declaration below.
1408
+ "fetch-media", "download-file",
1396
1409
  // Chat management (2.12.0) — gated by the account's manageChats
1397
1410
  // scope; without it every one of these is refused.
1398
1411
  "createGroup", "addMembers", "removeMember",
@@ -1404,6 +1417,16 @@ const createChannelPlugin = (runtimes, pluginRuntime) => {
1404
1417
  },
1405
1418
  };
1406
1419
  },
1420
+ // Core asks the channel which params name a destination when the action
1421
+ // is not one of its own. Without this, `chatId` is invisible to
1422
+ // `actionHasTarget` and the call is refused as targetless before it ever
1423
+ // reaches `handleAction`. The chat is named by `chatId` rather than
1424
+ // `target` because core reserves `target` for actions in its own
1425
+ // vocabulary and throws on it for everything else.
1426
+ messageActionTargetAliases: {
1427
+ "fetch-media": { aliases: ["chatId"] },
1428
+ "download-file": { aliases: ["chatId"] },
1429
+ },
1407
1430
  extractToolSend: ({ args }) => (0, tool_send_1.extractToolSend)(args, "sendMessage"),
1408
1431
  handleAction: async ({ action, params, cfg, accountId, dryRun: dryRunFlag, toolContext }) => {
1409
1432
  // Core passes the flag beside `params`; callers write it inside.
@@ -1464,7 +1487,7 @@ const createChannelPlugin = (runtimes, pluginRuntime) => {
1464
1487
  // account was never allowed to read.
1465
1488
  if (action === "fetch-media" || action === "fetchMedia" ||
1466
1489
  action === "download-media" || action === "downloadMedia" ||
1467
- action === "getMedia") {
1490
+ action === "getMedia" || action === "download-file") {
1468
1491
  const fetchParams = (0, fetch_media_1.parseFetchMediaParams)(params);
1469
1492
  const fetchAccountId = resolveRuntimeAccountId(cfg, accountId);
1470
1493
  if (!fetchAccountId) {
@@ -2,7 +2,7 @@
2
2
  "id": "clawgram",
3
3
  "name": "Clawgram",
4
4
  "description": "Clawgram — personal Telegram (MTProto userbot) channel for OpenClaw. Your AI assistant reads and responds as you.",
5
- "version": "2.19.0",
5
+ "version": "2.19.1",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawgram",
3
- "version": "2.19.0",
3
+ "version": "2.19.1",
4
4
  "description": "Clawgram — personal Telegram (MTProto userbot) channel for OpenClaw. Your AI assistant reads and responds as you.",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {