@keychat-io/keychat-openclaw 0.1.10 → 0.1.13
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/README.md +6 -1
- package/index.ts +27 -13
- package/package.json +1 -2
- package/src/channel.ts +19 -5
- package/src/notify.ts +15 -0
package/README.md
CHANGED
|
@@ -29,17 +29,22 @@ This clones the repo, downloads the binary, registers the plugin, and restarts t
|
|
|
29
29
|
|
|
30
30
|
### Security Warnings
|
|
31
31
|
|
|
32
|
-
During installation, OpenClaw's security scanner may show
|
|
32
|
+
During installation, OpenClaw's security scanner may show three warnings. All are expected:
|
|
33
33
|
|
|
34
34
|
| Warning | Reason |
|
|
35
35
|
|---------|--------|
|
|
36
36
|
| Shell command execution (bridge-client.ts) | Keychat's Signal Protocol and MLS Protocol encryption are implemented in Rust. The plugin spawns a Rust sidecar process to bridge between Node.js and the native crypto layer. |
|
|
37
37
|
| Shell command execution (keychain.ts) | Agent identity mnemonics are stored in the OS keychain (macOS Keychain / Linux libsecret) rather than plain files, which is the more secure option. |
|
|
38
|
+
| Shell command execution (notify.ts) | After startup, the plugin notifies the agent so it can proactively send the Keychat ID and QR code to the user on their active channel (Telegram, webchat, etc). |
|
|
38
39
|
|
|
39
40
|
Source code is fully open: [github.com/keychat-io/keychat-openclaw](https://github.com/keychat-io/keychat-openclaw)
|
|
40
41
|
|
|
41
42
|
### Upgrade
|
|
42
43
|
|
|
44
|
+
**Easiest way:** Just tell your agent "upgrade keychat" in any chat. The agent will handle it and reconnect automatically.
|
|
45
|
+
|
|
46
|
+
Or manually:
|
|
47
|
+
|
|
43
48
|
If you installed via **Option A**:
|
|
44
49
|
|
|
45
50
|
```bash
|
package/index.ts
CHANGED
|
@@ -41,21 +41,35 @@ const plugin = {
|
|
|
41
41
|
],
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
const { generateQRDataUrl } = await import("./src/qrcode.js");
|
|
45
|
+
const results = [];
|
|
46
|
+
const contentParts: Array<{ type: "text"; text: string } | { type: "image"; data: string; mimeType: string }> = [];
|
|
47
|
+
|
|
48
|
+
for (const c of contacts) {
|
|
49
|
+
const qrDataUrl = await generateQRDataUrl(c.npub);
|
|
50
|
+
results.push({
|
|
51
|
+
accountId: c.accountId,
|
|
52
|
+
npub: c.npub,
|
|
53
|
+
contactUrl: c.contactUrl,
|
|
54
|
+
});
|
|
55
|
+
contentParts.push({
|
|
56
|
+
type: "text" as const,
|
|
57
|
+
text: `Account: ${c.accountId}\nnpub: ${c.npub}\nContact: ${c.contactUrl}`,
|
|
58
|
+
});
|
|
59
|
+
if (qrDataUrl) {
|
|
60
|
+
// Extract base64 from data URL: "data:image/png;base64,..."
|
|
61
|
+
const base64 = qrDataUrl.replace(/^data:image\/png;base64,/, "");
|
|
62
|
+
contentParts.push({
|
|
63
|
+
type: "image" as const,
|
|
64
|
+
data: base64,
|
|
65
|
+
mimeType: "image/png",
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
51
70
|
return {
|
|
52
71
|
details: null,
|
|
53
|
-
content:
|
|
54
|
-
{
|
|
55
|
-
type: "text" as const,
|
|
56
|
-
text: JSON.stringify(result, null, 2),
|
|
57
|
-
},
|
|
58
|
-
],
|
|
72
|
+
content: contentParts,
|
|
59
73
|
};
|
|
60
74
|
},
|
|
61
75
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keychat-io/keychat-openclaw",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Keychat — E2E encrypted chat + Lightning wallet for OpenClaw agents",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"zod": "^4.3.6"
|
|
18
18
|
},
|
|
19
19
|
"openclaw": {
|
|
20
|
-
"id": "keychat",
|
|
21
20
|
"extensions": [
|
|
22
21
|
"./index.ts"
|
|
23
22
|
],
|
package/src/channel.ts
CHANGED
|
@@ -826,11 +826,25 @@ export const keychatPlugin: ChannelPlugin<ResolvedKeychatAccount> = {
|
|
|
826
826
|
`═══════════════════════════════════════════════════\n`,
|
|
827
827
|
);
|
|
828
828
|
|
|
829
|
-
//
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
829
|
+
// Notify agent on first install only (not on every restart)
|
|
830
|
+
const { KEYCHAT_DIR } = await import("./paths.js");
|
|
831
|
+
const notifiedMarker = join(KEYCHAT_DIR, `.notified-${account.accountId}`);
|
|
832
|
+
if (!existsSync(notifiedMarker)) {
|
|
833
|
+
try {
|
|
834
|
+
const { sendSystemEvent } = await import("./notify.js");
|
|
835
|
+
await sendSystemEvent(
|
|
836
|
+
`[Keychat Plugin] Agent "${displayName}" (account: ${account.accountId}) is online and ready.\n` +
|
|
837
|
+
`Use the keychat_identity tool to get the agent's Keychat ID, contact link, and QR code.\n` +
|
|
838
|
+
`Then send the contact info to the user on their active channel using the message tool.\n` +
|
|
839
|
+
`The user can open the link or scan the QR code in Keychat app to add this agent as a contact.`,
|
|
840
|
+
);
|
|
841
|
+
// Mark as notified so we don't repeat on restart
|
|
842
|
+
const { writeFileSync } = await import("node:fs");
|
|
843
|
+
writeFileSync(notifiedMarker, new Date().toISOString());
|
|
844
|
+
} catch {
|
|
845
|
+
ctx.log?.warn?.(`[${account.accountId}] Failed to send system event notification`);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
834
848
|
|
|
835
849
|
ctx.setStatus({
|
|
836
850
|
accountId: account.accountId,
|
package/src/notify.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System event notification helper.
|
|
3
|
+
* Isolated to keep child_process out of channel.ts (avoids scanner warnings there).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export async function sendSystemEvent(text: string, timeoutMs = 10_000): Promise<void> {
|
|
7
|
+
const { execFile } = await import("node:child_process");
|
|
8
|
+
const { promisify } = await import("node:util");
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
10
|
+
await execFileAsync("openclaw", [
|
|
11
|
+
"system", "event",
|
|
12
|
+
"--text", text,
|
|
13
|
+
"--mode", "now",
|
|
14
|
+
], { timeout: timeoutMs });
|
|
15
|
+
}
|