clawgram 2.4.1 → 2.4.2

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
@@ -1292,21 +1292,38 @@ const createChannelPlugin = (runtimes) => {
1292
1292
  },
1293
1293
  },
1294
1294
  outbound: {
1295
+ // Core's agent-delivery path (`--deliver`, subagent announces) calls this
1296
+ // with `to: undefined` whenever a delivery has no explicit target and the
1297
+ // session route yielded none — and it does not catch a rejection from
1298
+ // here. A throw is therefore an unhandled rejection that takes down the
1299
+ // entire gateway process, which is exactly what happened on 2026-08-06
1300
+ // (systemd: Main process exited, status=1). The contract, read from
1301
+ // core's resolveOutboundTargetWithPlugin: answer { ok: false, error } for
1302
+ // anything unresolvable. Never throw.
1295
1303
  async resolveTarget(ctx) {
1296
- actionLog.info("clawgram outbound resolveTarget", {
1297
- accountId: ctx.accountId,
1298
- rawTo: ctx.to,
1299
- });
1300
- const gram = runtimes.get(ctx.accountId);
1301
- if (!gram) {
1302
- throw new Error(`clawgram: runtime not found for account ${ctx.accountId}`);
1304
+ try {
1305
+ const raw = typeof ctx.to === "string" ? ctx.to.trim() : "";
1306
+ actionLog.info("clawgram outbound resolveTarget", {
1307
+ accountId: ctx.accountId,
1308
+ rawTo: raw || null,
1309
+ });
1310
+ if (!raw) {
1311
+ return { ok: false, error: "clawgram: no delivery target — pass `to` or use a session with a bound chat" };
1312
+ }
1313
+ const gram = runtimes.get(ctx.accountId);
1314
+ if (!gram) {
1315
+ return { ok: false, error: `clawgram: runtime not found for account ${ctx.accountId}` };
1316
+ }
1317
+ const targetKind = (0, helpers_1.inferOutboundTargetKind)(raw);
1318
+ const target = (0, helpers_1.normalizeOutboundTarget)(raw);
1319
+ return {
1320
+ ok: true,
1321
+ to: (await gram.resolvePeer(target, { kind: targetKind })).chatId ?? target,
1322
+ };
1323
+ }
1324
+ catch (err) {
1325
+ return { ok: false, error: `clawgram: target resolution failed: ${String(err)}` };
1303
1326
  }
1304
- const targetKind = (0, helpers_1.inferOutboundTargetKind)(ctx.to);
1305
- const target = (0, helpers_1.normalizeOutboundTarget)(ctx.to);
1306
- return {
1307
- ok: true,
1308
- to: (await gram.resolvePeer(target, { kind: targetKind })).chatId ?? target,
1309
- };
1310
1327
  },
1311
1328
  async sendText(ctx) {
1312
1329
  // Never log `text`: outbound bodies are private correspondence and the
@@ -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.4.1",
5
+ "version": "2.4.2",
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.4.1",
3
+ "version": "2.4.2",
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": {