@keychat-io/keychat 0.1.24 → 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.
- package/index.ts +1 -1
- package/package.json +1 -1
- package/scripts/install.sh +1 -1
- package/scripts/postinstall.mjs +2 -2
- package/scripts/setup.sh +1 -1
- package/src/bridge-client.ts +2 -2
- package/src/channel.ts +17 -5
- package/src/ensure-binary.ts +1 -1
package/index.ts
CHANGED
|
@@ -31,7 +31,7 @@ function downloadBinary(url: string): Promise<Buffer> {
|
|
|
31
31
|
/** Ensure bridge binary exists, download if missing. */
|
|
32
32
|
async function ensureBinary(): Promise<void> {
|
|
33
33
|
const binaryDir = join(__dirname, "bridge", "target", "release");
|
|
34
|
-
const binaryPath = join(binaryDir, "keychat-
|
|
34
|
+
const binaryPath = join(binaryDir, "keychat-openclaw");
|
|
35
35
|
|
|
36
36
|
if (existsSync(binaryPath)) return;
|
|
37
37
|
|
package/package.json
CHANGED
package/scripts/install.sh
CHANGED
|
@@ -5,7 +5,7 @@ set -e
|
|
|
5
5
|
|
|
6
6
|
REPO="keychat-io/keychat-openclaw"
|
|
7
7
|
INSTALL_DIR="${OPENCLAW_EXTENSIONS:-$HOME/.openclaw/extensions}/keychat"
|
|
8
|
-
BINARY="$INSTALL_DIR/bridge/target/release/keychat-
|
|
8
|
+
BINARY="$INSTALL_DIR/bridge/target/release/keychat-openclaw"
|
|
9
9
|
|
|
10
10
|
echo "🔑 Installing Keychat"
|
|
11
11
|
echo ""
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import https from "node:https";
|
|
|
12
12
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
13
|
const REPO = "keychat-io/keychat-openclaw";
|
|
14
14
|
const BINARY_DIR = join(__dirname, "..", "bridge", "target", "release");
|
|
15
|
-
const BINARY_PATH = join(BINARY_DIR, "keychat-
|
|
15
|
+
const BINARY_PATH = join(BINARY_DIR, "keychat-openclaw");
|
|
16
16
|
|
|
17
17
|
import { statSync } from "node:fs";
|
|
18
18
|
|
|
@@ -29,7 +29,7 @@ const currentVersion = existsSync(versionFile)
|
|
|
29
29
|
const pluginDir = join(__dirname, "..");
|
|
30
30
|
const pluginDirName = pluginDir.split("/").pop();
|
|
31
31
|
const scriptInstallDir = join(pluginDir, "..", "keychat");
|
|
32
|
-
if (pluginDirName === "keychat-
|
|
32
|
+
if (pluginDirName === "keychat-openclaw" && existsSync(scriptInstallDir)) {
|
|
33
33
|
console.log(`[keychat] Removing conflicting script-installed copy...`);
|
|
34
34
|
try { rmSync(scriptInstallDir, { recursive: true, force: true }); } catch {}
|
|
35
35
|
}
|
package/scripts/setup.sh
CHANGED
package/src/bridge-client.ts
CHANGED
|
@@ -101,7 +101,7 @@ export class KeychatBridgeClient {
|
|
|
101
101
|
"bridge",
|
|
102
102
|
"target",
|
|
103
103
|
"release",
|
|
104
|
-
"keychat-
|
|
104
|
+
"keychat-openclaw",
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -113,7 +113,7 @@ export class KeychatBridgeClient {
|
|
|
113
113
|
|
|
114
114
|
if (!existsSync(this.bridgePath)) {
|
|
115
115
|
throw new Error(
|
|
116
|
-
`keychat-
|
|
116
|
+
`keychat-openclaw binary not found at ${this.bridgePath}. Run 'cargo build --release' in the bridge directory.`,
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
|
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
|
|
@@ -614,7 +626,7 @@ export const keychatPlugin: ChannelPlugin<ResolvedKeychatAccount> = {
|
|
|
614
626
|
"bridge",
|
|
615
627
|
"target",
|
|
616
628
|
"release",
|
|
617
|
-
"keychat-
|
|
629
|
+
"keychat-openclaw",
|
|
618
630
|
);
|
|
619
631
|
if (!existsSync(bridgePath)) {
|
|
620
632
|
issues.push({
|
|
@@ -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);
|