@keychat-io/keychat 0.1.25 → 0.1.26

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/channel.ts +16 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keychat-io/keychat",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Keychat — E2E encrypted chat + Lightning wallet for OpenClaw agents",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
package/src/channel.ts CHANGED
@@ -17,6 +17,18 @@ import {
17
17
  formatPairingApproveHint,
18
18
  type ChannelPlugin,
19
19
  } from "openclaw/plugin-sdk";
20
+
21
+ /**
22
+ * Strip "Reasoning:\n_..._" prefix that OpenClaw core prepends when
23
+ * reasoning display is enabled. Keychat has no collapsible UI for it,
24
+ * so we silently drop it to keep messages clean.
25
+ */
26
+ function stripReasoningPrefix(text: string): string {
27
+ // Matches the exact format from formatReasoningMessage():
28
+ // "Reasoning:\n_line1_\n_line2_\n\nActual answer..."
29
+ const re = /^Reasoning:\n(?:_[^\n]*_\n?)+\n*/;
30
+ return text.replace(re, "").trim();
31
+ }
20
32
  import { KeychatConfigSchema } from "./config-schema.js";
21
33
  import { getKeychatRuntime } from "./runtime.js";
22
34
  import {
@@ -435,7 +447,7 @@ export const keychatPlugin: ChannelPlugin<ResolvedKeychatAccount> = {
435
447
  channel: "keychat",
436
448
  accountId: aid,
437
449
  });
438
- const message = core.channel.text.convertMarkdownTables(text ?? "", tableMode);
450
+ const message = stripReasoningPrefix(core.channel.text.convertMarkdownTables(text ?? "", tableMode));
439
451
  const normalizedTo = normalizePubkey(to);
440
452
 
441
453
  // Handle /reset signal command — reset Signal session and re-send hello
@@ -1690,7 +1702,7 @@ async function dispatchMlsGroupToAgent(
1690
1702
  ...prefixOptions,
1691
1703
  deliver: async (payload: { text?: string }) => {
1692
1704
  if (!payload.text) return;
1693
- const message = core.channel.text.convertMarkdownTables(payload.text, tableMode);
1705
+ const message = stripReasoningPrefix(core.channel.text.convertMarkdownTables(payload.text, tableMode));
1694
1706
  deliverBuffer.push(message);
1695
1707
  if (deliverTimer) clearTimeout(deliverTimer);
1696
1708
  deliverTimer = setTimeout(() => { flushDeliverBuffer(); }, DELIVER_DEBOUNCE_MS);
@@ -2255,7 +2267,7 @@ async function dispatchToAgent(
2255
2267
  ...prefixOptions,
2256
2268
  deliver: async (payload: { text?: string }) => {
2257
2269
  if (!payload.text) return;
2258
- const message = core.channel.text.convertMarkdownTables(payload.text, tableMode);
2270
+ const message = stripReasoningPrefix(core.channel.text.convertMarkdownTables(payload.text, tableMode));
2259
2271
  deliverBuffer.push(message);
2260
2272
  // Reset debounce timer — wait for more chunks before sending
2261
2273
  if (deliverTimer) clearTimeout(deliverTimer);
@@ -2378,7 +2390,7 @@ async function dispatchGroupToAgent(
2378
2390
  ...prefixOptions,
2379
2391
  deliver: async (payload: { text?: string }) => {
2380
2392
  if (!payload.text) return;
2381
- const message = core.channel.text.convertMarkdownTables(payload.text, tableMode);
2393
+ const message = stripReasoningPrefix(core.channel.text.convertMarkdownTables(payload.text, tableMode));
2382
2394
  deliverBuffer.push(message);
2383
2395
  if (deliverTimer) clearTimeout(deliverTimer);
2384
2396
  deliverTimer = setTimeout(() => { flushDeliverBuffer(); }, DELIVER_DEBOUNCE_MS);