clawgram 2.12.1 → 2.13.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
@@ -1305,7 +1305,11 @@ const createChannelPlugin = (runtimes, pluginRuntime) => {
1305
1305
  };
1306
1306
  },
1307
1307
  extractToolSend: ({ args }) => (0, tool_send_1.extractToolSend)(args, "sendMessage"),
1308
- handleAction: async ({ action, params, cfg, accountId, dryRun, toolContext }) => {
1308
+ handleAction: async ({ action, params, cfg, accountId, dryRun: dryRunFlag, toolContext }) => {
1309
+ // Core passes the flag beside `params`; callers write it inside.
1310
+ // Both count, because a rehearsal flag that is silently ignored puts
1311
+ // a real message in a real chat — twice, so far (2.13.1).
1312
+ const dryRun = (0, helpers_1.resolveDryRun)(dryRunFlag, params);
1309
1313
  // `read` is what OpenClaw core dispatches (`openclaw message read`,
1310
1314
  // MCP `messages_read`). `list` is accepted as a synonym so a caller that
1311
1315
  // guessed the other obvious name is not silently refused.
@@ -1783,7 +1787,10 @@ const createChannelPlugin = (runtimes, pluginRuntime) => {
1783
1787
  const replyToId = (0, param_readers_1.readStringOrNumberParam)(params, "replyToId") ?? (0, param_readers_1.readStringOrNumberParam)(params, "replyTo");
1784
1788
  const threadId = (0, param_readers_1.readStringOrNumberParam)(params, "threadId");
1785
1789
  const messageThreadId = parseOptionalThreadId(threadId);
1786
- const parseMode = (0, helpers_1.normalizeParseMode)(params?.parseMode);
1790
+ // Omitting parseMode inherits the account's configured mode rather
1791
+ // than falling back to plain text (2.13.0): an account set to `html`
1792
+ // used to render replies as HTML and these sends as raw markup.
1793
+ const parseMode = (0, helpers_1.resolveOutboundParseMode)(params, cfg, (0, helpers_1.resolveConfiguredAccountId)(cfg, accountId) ?? accountId ?? "default");
1787
1794
  actionLog.info("clawgram handleAction send", {
1788
1795
  requestedAccountId: accountId,
1789
1796
  dryRun: dryRun === true,
package/dist/helpers.js CHANGED
@@ -37,6 +37,8 @@ exports.resolveSenderProfile = resolveSenderProfile;
37
37
  exports.resolveSenderProfileWithTimeout = resolveSenderProfileWithTimeout;
38
38
  exports.normalizeParseMode = normalizeParseMode;
39
39
  exports.resolveReplyParseMode = resolveReplyParseMode;
40
+ exports.resolveOutboundParseMode = resolveOutboundParseMode;
41
+ exports.resolveDryRun = resolveDryRun;
40
42
  const node_fs_1 = require("node:fs");
41
43
  const node_path_1 = __importDefault(require("node:path"));
42
44
  const core_1 = require("openclaw/plugin-sdk/core");
@@ -577,3 +579,48 @@ function resolveReplyParseMode(cfg, accountId) {
577
579
  const account = channel?.accounts?.[accountId] ?? channel;
578
580
  return normalizeParseMode(account?.replyParseMode);
579
581
  }
582
+ /**
583
+ * Whether this call is a rehearsal, from either position the flag can arrive.
584
+ *
585
+ * Core passes `dryRun` as a sibling of `params`. Callers put it inside
586
+ * `params`, next to `to` and `text`, because that is where every other
587
+ * parameter lives — and there it used to be read by nobody: the flag vanished
588
+ * and the send happened for real.
589
+ *
590
+ * That is the worst possible failure mode for a safety flag, and it has cost
591
+ * two irreversible messages in a work chat (2026-08-08, note 0066; and
592
+ * 2026-08-10 at 02:49 UTC, a bare "ping" the agent then could not delete,
593
+ * because this channel has no delete action). Either position now counts, and
594
+ * a disagreement resolves toward **not** sending: a caller who wrote
595
+ * "dry run" anywhere meant it somewhere.
596
+ */
597
+ function resolveDryRun(dryRun, params) {
598
+ const fromParams = params?.dryRun;
599
+ return dryRun === true || dryRun === "true" || fromParams === true || fromParams === "true";
600
+ }
601
+ /**
602
+ * Parse mode for the `send` action (2.13.0).
603
+ *
604
+ * The per-call parameter still wins — a caller that knows its text is markdown
605
+ * has to be able to say so, and `parseMode: ""` still means "exactly as typed".
606
+ * What changed is the default: an omitted parameter now inherits the account's
607
+ * configured mode instead of silently sending plain text.
608
+ *
609
+ * Before this, the two send paths disagreed. An account set to `html` rendered
610
+ * replies as HTML and tool-driven sends as plain text, so an answer written in
611
+ * markup arrived with its markup showing — which is what happened on
612
+ * 2026-08-09 at 22:30 UTC, in a work chat, to a long answer. Two sends half an
613
+ * hour earlier had passed `parseMode` by hand and looked right; that is the
614
+ * tell, not the reassurance. Correctness that depends on remembering a
615
+ * parameter on every call is correctness that will lapse.
616
+ */
617
+ function resolveOutboundParseMode(params, cfg, accountId) {
618
+ const raw = params?.parseMode;
619
+ // An explicitly empty value is a decision, not an omission: send it raw.
620
+ if (raw === "" || raw === null) {
621
+ return undefined;
622
+ }
623
+ return raw === undefined
624
+ ? resolveReplyParseMode(cfg, accountId)
625
+ : normalizeParseMode(raw);
626
+ }
@@ -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.12.1",
5
+ "version": "2.13.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.12.1",
3
+ "version": "2.13.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": {