@newbase-clawchat/openclaw-clawchat 2026.5.4 → 2026.5.12-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/INSTALL.md +64 -0
- package/README.md +121 -19
- package/dist/index.js +10 -19
- package/dist/setup-entry.js +3 -0
- package/dist/src/api-client.js +78 -10
- package/dist/src/api-types.test-d.js +10 -0
- package/dist/src/channel.js +25 -156
- package/dist/src/channel.setup.js +120 -0
- package/dist/src/client.js +37 -41
- package/dist/src/config.js +75 -17
- package/dist/src/inbound.js +79 -61
- package/dist/src/login.runtime.js +84 -19
- package/dist/src/media-runtime.js +8 -8
- package/dist/src/message-mapper.js +1 -1
- package/dist/src/mock-transport.js +31 -0
- package/dist/src/outbound.js +410 -26
- package/dist/src/protocol-types.js +63 -0
- package/dist/src/protocol-types.typecheck.js +1 -0
- package/dist/src/protocol.js +2 -7
- package/dist/src/reply-dispatcher.js +157 -54
- package/dist/src/runtime.js +795 -119
- package/dist/src/storage.js +689 -0
- package/dist/src/tools-schema.js +98 -16
- package/dist/src/tools.js +422 -135
- package/dist/src/ws-alignment.js +178 -0
- package/dist/src/ws-client.js +588 -0
- package/dist/src/ws-log.js +19 -0
- package/index.ts +10 -22
- package/openclaw.plugin.json +37 -2
- package/package.json +17 -4
- package/setup-entry.ts +4 -0
- package/skills/clawchat/SKILL.md +88 -0
- package/src/api-client.test.ts +274 -14
- package/src/api-client.ts +138 -23
- package/src/api-types.test-d.ts +12 -0
- package/src/api-types.ts +90 -4
- package/src/buffered-stream.test.ts +14 -12
- package/src/buffered-stream.ts +1 -1
- package/src/channel.outbound.test.ts +269 -60
- package/src/channel.setup.ts +146 -0
- package/src/channel.test.ts +130 -24
- package/src/channel.ts +30 -186
- package/src/client.test.ts +197 -11
- package/src/client.ts +50 -57
- package/src/config.test.ts +108 -6
- package/src/config.ts +95 -24
- package/src/inbound.test.ts +288 -37
- package/src/inbound.ts +96 -84
- package/src/login.runtime.test.ts +347 -13
- package/src/login.runtime.ts +105 -23
- package/src/manifest.test.ts +146 -74
- package/src/media-runtime.test.ts +57 -2
- package/src/media-runtime.ts +26 -17
- package/src/message-mapper.test.ts +2 -2
- package/src/message-mapper.ts +2 -2
- package/src/mock-transport.test.ts +35 -0
- package/src/mock-transport.ts +38 -0
- package/src/outbound.test.ts +694 -73
- package/src/outbound.ts +484 -31
- package/src/plugin-entry.test.ts +1 -0
- package/src/protocol-types.test.ts +69 -0
- package/src/protocol-types.ts +296 -0
- package/src/protocol-types.typecheck.ts +89 -0
- package/src/protocol.test.ts +1 -6
- package/src/protocol.ts +2 -7
- package/src/reply-dispatcher.test.ts +819 -119
- package/src/reply-dispatcher.ts +202 -60
- package/src/runtime.test.ts +2120 -41
- package/src/runtime.ts +935 -142
- package/src/scripts.test.ts +85 -0
- package/src/storage.test.ts +793 -0
- package/src/storage.ts +1095 -0
- package/src/streaming.test.ts +9 -8
- package/src/streaming.ts +1 -1
- package/src/tools-schema.ts +148 -20
- package/src/tools.test.ts +377 -50
- package/src/tools.ts +574 -154
- package/src/ws-alignment.test.ts +103 -0
- package/src/ws-alignment.ts +275 -0
- package/src/ws-client.test.ts +1218 -0
- package/src/ws-client.ts +662 -0
- package/src/ws-log.test.ts +32 -0
- package/src/ws-log.ts +31 -0
- package/skills/clawchat-account-tools/SKILL.md +0 -26
- package/skills/clawchat-activate/SKILL.md +0 -47
package/src/ws-log.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type WsLogFieldValue = string | number | boolean | null | undefined;
|
|
2
|
+
|
|
3
|
+
export interface WsLogInput {
|
|
4
|
+
event: string;
|
|
5
|
+
accountId: string;
|
|
6
|
+
attempt: number;
|
|
7
|
+
reconnectCount: number;
|
|
8
|
+
state: string;
|
|
9
|
+
action: string;
|
|
10
|
+
fields?: Array<[string, WsLogFieldValue]>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function optionalField(value: WsLogFieldValue): string {
|
|
14
|
+
if (value === null || value === undefined || value === "") return "-";
|
|
15
|
+
return String(value);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function formatWsLog(input: WsLogInput): string {
|
|
19
|
+
const base: Array<[string, WsLogFieldValue]> = [
|
|
20
|
+
["event", input.event],
|
|
21
|
+
["account_id", input.accountId],
|
|
22
|
+
["attempt", input.attempt],
|
|
23
|
+
["reconnect_count", input.reconnectCount],
|
|
24
|
+
["state", input.state],
|
|
25
|
+
["action", input.action],
|
|
26
|
+
];
|
|
27
|
+
return [...base, ...(input.fields ?? [])]
|
|
28
|
+
.map(([key, value]) => `${key}=${optionalField(value)}`)
|
|
29
|
+
.join(" ")
|
|
30
|
+
.replace(/^/, "clawchat.ws ");
|
|
31
|
+
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: clawchat-account-tools
|
|
3
|
-
description: Use when a user asks to view or update the configured ClawChat account profile, inspect a ClawChat user profile, list account friends, change avatar/bio/nickname, or upload/share ClawChat media files.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# ClawChat Account Tools
|
|
7
|
-
|
|
8
|
-
Use these tools for ClawChat account/profile, friends, avatar, and media-file requests. The configured ClawChat account is not the OpenClaw agent persona.
|
|
9
|
-
|
|
10
|
-
## Tool Selection
|
|
11
|
-
|
|
12
|
-
| User intent | Tool | Notes |
|
|
13
|
-
| --- | --- | --- |
|
|
14
|
-
| View the configured ClawChat account profile | `clawchat_get_account_profile` | Returns account user id, nickname/display name, avatar, and bio. |
|
|
15
|
-
| Inspect another ClawChat user profile | `clawchat_get_user_profile` | Requires a concrete `userId`; do not infer it from nicknames. |
|
|
16
|
-
| List account friends or contacts | `clawchat_list_account_friends` | Use `page` and `pageSize` when paging through results. |
|
|
17
|
-
| Update account nickname, avatar URL, or bio | `clawchat_update_account_profile` | Pass at least one of `nickname`, `avatar_url`, or `bio`. |
|
|
18
|
-
| Upload a local avatar image | `clawchat_upload_avatar_image` | Returns a hosted avatar URL; then call `clawchat_update_account_profile` with `avatar_url` to set it. |
|
|
19
|
-
| Upload/share a non-avatar local media file | `clawchat_upload_media_file` | Returns a public URL. If the file should be sent in chat, use the message tool with `media`. |
|
|
20
|
-
|
|
21
|
-
## Boundaries
|
|
22
|
-
|
|
23
|
-
- Do not treat ClawChat account profile changes as OpenClaw agent persona changes.
|
|
24
|
-
- Use avatar upload only for account avatar/profile-picture changes.
|
|
25
|
-
- Use media upload for non-avatar local files.
|
|
26
|
-
- For activation, login, or invite-code requests, use the activation skill instead.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: clawchat-activate
|
|
3
|
-
description: |
|
|
4
|
-
Activate or log in OpenClaw ClawChat. Use when the user asks to activate, connect, bind, or log in ClawChat, or provides a ClawChat invite code (six uppercase letters/digits, e.g. A1B2C3).
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# ClawChat Activation
|
|
8
|
-
|
|
9
|
-
Activation should use the `clawchat_activate` tool when that tool is available. The tool runs the same invite-code login runtime as OpenClaw channel login and persists credentials into `channels.openclaw-clawchat`.
|
|
10
|
-
|
|
11
|
-
If the tool is not available because the Gateway has not loaded this plugin yet, fall back to OpenClaw channel add for first-time CLI activation. Do not edit config files manually and do not try to execute slash commands from this skill.
|
|
12
|
-
|
|
13
|
-
## Workflow
|
|
14
|
-
|
|
15
|
-
1. Check whether the user is trying to activate or log in ClawChat.
|
|
16
|
-
2. If `clawchat_activate` is available and the invite code is known, call it with the invite code.
|
|
17
|
-
3. If the invite code is not known, ask the user for it before calling `clawchat_activate`.
|
|
18
|
-
4. If `clawchat_activate` is not available, execute the channel add command with the invite code:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
openclaw channels add --channel openclaw-clawchat --token "$CLAWCHAT_INVITE_CODE"
|
|
22
|
-
```
|
|
23
|
-
5. `channels add --token` is the first-time CLI activation path; the token argument is the ClawChat invite code on this setup path.
|
|
24
|
-
6. Use `openclaw channels login --channel openclaw-clawchat` only to refresh credentials later after the channel already exists.
|
|
25
|
-
7. After activation succeeds, rely on OpenClaw's `channels.*` config hot reload when the plugin is already loaded. Verify channel status if available:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
openclaw channels status --probe
|
|
29
|
-
```
|
|
30
|
-
8. Execute the Gateway restart command only when the plugin was just installed/updated, the tool was unavailable because the running Gateway had not loaded the plugin, config reload is disabled, or the probe does not become healthy:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
openclaw gateway restart
|
|
34
|
-
```
|
|
35
|
-
9. Tell the user activation completes after channel add/login succeeds and either config hot reload/probe succeeds or Gateway restart succeeds.
|
|
36
|
-
|
|
37
|
-
## Trigger Examples
|
|
38
|
-
|
|
39
|
-
- `activate ClawChat with invite code A1B2C3`
|
|
40
|
-
- `login to ClawChat with invite code A1B2C3`
|
|
41
|
-
- `connect ClawChat using invite code A1B2C3`
|
|
42
|
-
- `绑定 ClawChat,邀请码 A1B2C3`
|
|
43
|
-
- `激活 ClawChat`
|
|
44
|
-
|
|
45
|
-
Do not ask the user to enter a bare ClawChat command. If activation is requested and `clawchat_activate` is available, call that tool yourself. If the tool is unavailable, execute `openclaw channels add --channel openclaw-clawchat --token "$CLAWCHAT_INVITE_CODE"` yourself, then probe channel status and restart the Gateway only when needed.
|
|
46
|
-
|
|
47
|
-
When the user asks to activate ClawChat without including a code, ask for the invite code before calling `clawchat_activate` or falling back to channel add.
|