clawgram 2.5.0 → 2.5.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/dist/channel.js CHANGED
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createChannelPlugin = void 0;
7
7
  const core_1 = require("openclaw/plugin-sdk/core");
8
8
  const node_os_1 = __importDefault(require("node:os"));
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ const node_fs_1 = require("node:fs");
9
11
  /** Attachments above this are left unread: a long recording or a huge image is
10
12
  * a different conversation from a spoken line or a screenshot, and the
11
13
  * transfer is not free. */
@@ -77,6 +79,25 @@ function parseOptionalThreadId(value) {
77
79
  * "you sent something I could not read" than staying silent, which is
78
80
  * indistinguishable from being offline.
79
81
  */
82
+ /**
83
+ * Locates the agent directory that image understanding needs.
84
+ *
85
+ * Image models are called with the agent's own credentials, so the pipeline
86
+ * refuses to run without this path — audio does not need it, which is why
87
+ * voice notes worked before images did. The platform exposes no resolver to
88
+ * plugins, so the documented layout is reconstructed here and checked before
89
+ * use: a wrong guess would fail the read anyway, and returning undefined lets
90
+ * the caller degrade instead of throwing.
91
+ */
92
+ function resolveAgentDirForMedia(cfg) {
93
+ const stateDir = typeof process.env.OPENCLAW_STATE_DIR === "string" && process.env.OPENCLAW_STATE_DIR.trim()
94
+ ? process.env.OPENCLAW_STATE_DIR.trim()
95
+ : node_path_1.default.join(node_os_1.default.homedir(), ".openclaw");
96
+ const configuredId = cfg?.agents?.defaults?.id;
97
+ const agentId = typeof configuredId === "string" && configuredId.trim() ? configuredId.trim() : "main";
98
+ const dir = node_path_1.default.join(stateDir, "agents", agentId, "agent");
99
+ return (0, node_fs_1.existsSync)(dir) ? dir : undefined;
100
+ }
80
101
  async function readInboundAttachment(params) {
81
102
  const media = params.runtime?.mediaUnderstanding;
82
103
  const message = params.event?.message;
@@ -115,6 +136,7 @@ async function readInboundAttachment(params) {
115
136
  filePath: downloaded.path,
116
137
  cfg: params.cfg,
117
138
  mime: downloaded.mimeType,
139
+ agentDir: resolveAgentDirForMedia(params.cfg),
118
140
  });
119
141
  const read = typeof result?.text === "string" ? result.text.trim() : "";
120
142
  if (!read) {
@@ -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.5.0",
5
+ "version": "2.5.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.5.0",
3
+ "version": "2.5.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": {