@clawling/clawchat-plugin-openclaw 2026.9.7-1 → 2026.9.8-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/README.md +1 -1
- package/dist/src/commands.js +21 -3
- package/package.json +1 -1
- package/src/commands.ts +24 -3
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Install and activate the ClawChat plugin from npm package @clawling/clawchat-plu
|
|
|
31
31
|
Pick one of these invite-code activation paths after the plugin is loaded
|
|
32
32
|
into OpenClaw:
|
|
33
33
|
|
|
34
|
-
- **Runtime slash command (recommended).** Send `/clawchat-activate
|
|
34
|
+
- **Runtime slash command (recommended).** Send `/clawchat-activate K7RM4TQP`
|
|
35
35
|
in the chat where OpenClaw is running. Not a shell command — running
|
|
36
36
|
`openclaw clawchat-activate` is expected to fail. This is the reliable
|
|
37
37
|
first-time activation path on OpenClaw 2026.5.5 and newer.
|
package/dist/src/commands.js
CHANGED
|
@@ -4,9 +4,27 @@ const ACTIVATION_FLAGS = ["--new-account", "--repair"];
|
|
|
4
4
|
function stripActivationFlags(raw) {
|
|
5
5
|
return ACTIVATION_FLAGS.reduce((acc, flag) => acc.split(flag).join(" "), raw);
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* A whole argument token that looks like a ClawChat connect code.
|
|
9
|
+
*
|
|
10
|
+
* member-backend mints **8** characters drawn from
|
|
11
|
+
* `ABCDEFGHJKLMNPQRSTUVWXYZ23456789`, with 0/1/I/O excluded so humans can
|
|
12
|
+
* transcribe them. This deliberately accepts a band around that length rather
|
|
13
|
+
* than exactly 8: the length is the server's to choose, and pinning it here is
|
|
14
|
+
* what previously broke activation outright. A too-long or too-short token is left for the server to reject —
|
|
15
|
+
* the code is checked there anyway, so a permissive local filter costs nothing
|
|
16
|
+
* while a strict one silently swallows valid codes.
|
|
17
|
+
*
|
|
18
|
+
* Matching whole tokens (not a substring scan) is what keeps the command word
|
|
19
|
+
* itself out of the result when `ctx.args` is absent and we fall back to
|
|
20
|
+
* `ctx.commandBody`, which still carries `/clawchat-activate`.
|
|
21
|
+
*/
|
|
22
|
+
const INVITE_CODE_PATTERN = /^[A-Z0-9]{6,12}$/u;
|
|
7
23
|
function extractInviteCode(value) {
|
|
8
24
|
const raw = typeof value === "string" ? value.trim() : "";
|
|
9
|
-
return stripActivationFlags(raw)
|
|
25
|
+
return (stripActivationFlags(raw)
|
|
26
|
+
.split(/\s+/u)
|
|
27
|
+
.find((token) => INVITE_CODE_PATTERN.test(token)) ?? "");
|
|
10
28
|
}
|
|
11
29
|
/**
|
|
12
30
|
* Read the activation intent from the command args.
|
|
@@ -102,14 +120,14 @@ function formatOutputVisibilityResult(outputVisibility) {
|
|
|
102
120
|
export function registerOpenclawClawlingCommands(api) {
|
|
103
121
|
api.registerCommand({
|
|
104
122
|
name: "clawchat-activate",
|
|
105
|
-
description: "Activate ClawChat with an invite code, e.g. /clawchat-activate
|
|
123
|
+
description: "Activate ClawChat with an invite code, e.g. /clawchat-activate K7RM4TQP.",
|
|
106
124
|
acceptsArgs: true,
|
|
107
125
|
requireAuth: true,
|
|
108
126
|
async handler(ctx) {
|
|
109
127
|
const rawArgs = ctx.args ?? ctx.commandBody;
|
|
110
128
|
const code = extractInviteCode(rawArgs);
|
|
111
129
|
if (!code) {
|
|
112
|
-
return { text: "ClawChat invite code is required. Usage: /clawchat-activate
|
|
130
|
+
return { text: "ClawChat invite code is required. Usage: /clawchat-activate K7RM4TQP" };
|
|
113
131
|
}
|
|
114
132
|
const intent = extractActivationIntent(rawArgs);
|
|
115
133
|
try {
|
package/package.json
CHANGED
package/src/commands.ts
CHANGED
|
@@ -10,9 +10,30 @@ function stripActivationFlags(raw: string): string {
|
|
|
10
10
|
return ACTIVATION_FLAGS.reduce((acc, flag) => acc.split(flag).join(" "), raw);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* A whole argument token that looks like a ClawChat connect code.
|
|
15
|
+
*
|
|
16
|
+
* member-backend mints **8** characters drawn from
|
|
17
|
+
* `ABCDEFGHJKLMNPQRSTUVWXYZ23456789`, with 0/1/I/O excluded so humans can
|
|
18
|
+
* transcribe them. This deliberately accepts a band around that length rather
|
|
19
|
+
* than exactly 8: the length is the server's to choose, and pinning it here is
|
|
20
|
+
* what previously broke activation outright. A too-long or too-short token is left for the server to reject —
|
|
21
|
+
* the code is checked there anyway, so a permissive local filter costs nothing
|
|
22
|
+
* while a strict one silently swallows valid codes.
|
|
23
|
+
*
|
|
24
|
+
* Matching whole tokens (not a substring scan) is what keeps the command word
|
|
25
|
+
* itself out of the result when `ctx.args` is absent and we fall back to
|
|
26
|
+
* `ctx.commandBody`, which still carries `/clawchat-activate`.
|
|
27
|
+
*/
|
|
28
|
+
const INVITE_CODE_PATTERN = /^[A-Z0-9]{6,12}$/u;
|
|
29
|
+
|
|
13
30
|
function extractInviteCode(value: unknown): string {
|
|
14
31
|
const raw = typeof value === "string" ? value.trim() : "";
|
|
15
|
-
return
|
|
32
|
+
return (
|
|
33
|
+
stripActivationFlags(raw)
|
|
34
|
+
.split(/\s+/u)
|
|
35
|
+
.find((token) => INVITE_CODE_PATTERN.test(token)) ?? ""
|
|
36
|
+
);
|
|
16
37
|
}
|
|
17
38
|
|
|
18
39
|
/**
|
|
@@ -118,14 +139,14 @@ function formatOutputVisibilityResult(outputVisibility: OutputVisibility): strin
|
|
|
118
139
|
export function registerOpenclawClawlingCommands(api: Pick<OpenClawPluginApi, "registerCommand" | "logger" | "runtime">): void {
|
|
119
140
|
api.registerCommand({
|
|
120
141
|
name: "clawchat-activate",
|
|
121
|
-
description: "Activate ClawChat with an invite code, e.g. /clawchat-activate
|
|
142
|
+
description: "Activate ClawChat with an invite code, e.g. /clawchat-activate K7RM4TQP.",
|
|
122
143
|
acceptsArgs: true,
|
|
123
144
|
requireAuth: true,
|
|
124
145
|
async handler(ctx) {
|
|
125
146
|
const rawArgs = ctx.args ?? ctx.commandBody;
|
|
126
147
|
const code = extractInviteCode(rawArgs);
|
|
127
148
|
if (!code) {
|
|
128
|
-
return { text: "ClawChat invite code is required. Usage: /clawchat-activate
|
|
149
|
+
return { text: "ClawChat invite code is required. Usage: /clawchat-activate K7RM4TQP" };
|
|
129
150
|
}
|
|
130
151
|
const intent = extractActivationIntent(rawArgs);
|
|
131
152
|
try {
|