openzca 0.1.47 → 0.1.49
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 +87 -3
- package/dist/cli.js +2793 -97
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -42,6 +42,30 @@ openzca msg send GROUP_ID "Hi @123456789" --group
|
|
|
42
42
|
|
|
43
43
|
# Listen for incoming messages
|
|
44
44
|
openzca listen
|
|
45
|
+
|
|
46
|
+
# Enable the local SQLite DB for this profile
|
|
47
|
+
openzca db enable
|
|
48
|
+
|
|
49
|
+
# Backfill full group history plus recent DM/chat windows into the DB
|
|
50
|
+
openzca db sync
|
|
51
|
+
|
|
52
|
+
# List stored groups
|
|
53
|
+
openzca db group list --json
|
|
54
|
+
|
|
55
|
+
# Show stored info for one group
|
|
56
|
+
openzca db group info GROUP_ID --json
|
|
57
|
+
|
|
58
|
+
# Read the last 24 hours for one group
|
|
59
|
+
openzca db group messages GROUP_ID --since 24h --json
|
|
60
|
+
|
|
61
|
+
# Read an explicit date range
|
|
62
|
+
openzca db group messages GROUP_ID --from 2026-03-21T00:00:00+07:00 --to 2026-03-22T00:00:00+07:00 --json
|
|
63
|
+
|
|
64
|
+
# Read the latest 20 stored rows by default
|
|
65
|
+
openzca db group messages GROUP_ID --json
|
|
66
|
+
|
|
67
|
+
# Read all matching rows
|
|
68
|
+
openzca db group messages GROUP_ID --all --json
|
|
45
69
|
```
|
|
46
70
|
|
|
47
71
|
## Commands
|
|
@@ -50,7 +74,7 @@ openzca listen
|
|
|
50
74
|
|
|
51
75
|
| Command | Description |
|
|
52
76
|
|---------|-------------|
|
|
53
|
-
| `openzca auth login` | Login with QR code (`--qr-path <path>` to save QR image) |
|
|
77
|
+
| `openzca auth login` | Login with QR code (`--qr-path <path>` to save QR image, `--qr-base64` for integration mode) |
|
|
54
78
|
| `openzca auth login-cred [file]` | Login using a credential JSON file |
|
|
55
79
|
| `openzca auth logout` | Remove saved credentials |
|
|
56
80
|
| `openzca auth status` | Show login status |
|
|
@@ -67,7 +91,7 @@ You can also open the saved file manually (for example: `open qr.png` on macOS).
|
|
|
67
91
|
|
|
68
92
|
| Command | Description |
|
|
69
93
|
|---------|-------------|
|
|
70
|
-
| `openzca msg send <threadId> <message>` | Send text
|
|
94
|
+
| `openzca msg send <threadId> <message>` | Send text with formatting (`**bold**`, `*italic*`, `~~strike~~`, etc.) and group @mention resolution (`--raw` to skip formatting) |
|
|
71
95
|
| `openzca msg image <threadId> [file]` | Send image(s) from file or URL |
|
|
72
96
|
| `openzca msg video <threadId> [file]` | Send video(s) from file or URL; single `.mp4` inputs try native video mode |
|
|
73
97
|
| `openzca msg voice <threadId> [file]` | Send voice message from local file or URL (`.aac`, `.mp3`, `.m4a`, `.wav`, `.ogg`) |
|
|
@@ -78,14 +102,20 @@ You can also open the saved file manually (for example: `open qr.png` on macOS).
|
|
|
78
102
|
| `openzca msg typing <threadId>` | Send typing indicator |
|
|
79
103
|
| `openzca msg forward <message> <targets...>` | Forward text to multiple targets |
|
|
80
104
|
| `openzca msg delete <msgId> <cliMsgId> <uidFrom> <threadId>` | Delete a message |
|
|
105
|
+
| `openzca msg edit <msgId> <cliMsgId> <threadId> <message>` | Edit message (undo + resend shim) |
|
|
81
106
|
| `openzca msg undo <msgId> <cliMsgId> <threadId>` | Recall a sent message |
|
|
82
107
|
| `openzca msg upload <arg1> [arg2]` | Upload and send file(s) |
|
|
83
|
-
| `openzca msg recent <threadId>` | List recent messages (`-n`, `--json`, newest-first); group mode prefers direct group-history endpoint (websocket fallback) |
|
|
108
|
+
| `openzca msg recent <threadId>` | List recent messages (`-n`, `--json`, newest-first); defaults to live history, supports `--source live|db|auto`; group mode prefers direct group-history endpoint (websocket fallback) |
|
|
109
|
+
| `openzca msg pin <threadId>` | Pin a conversation |
|
|
110
|
+
| `openzca msg unpin <threadId>` | Unpin a conversation |
|
|
111
|
+
| `openzca msg list-pins` | List pinned conversations |
|
|
112
|
+
| `openzca msg member-info <userId>` | Get member/user profile info |
|
|
84
113
|
|
|
85
114
|
Media commands accept local files, `file://` paths, and repeatable `--url` options. Add `--group` for group threads.
|
|
86
115
|
`openzca msg video` attempts native video send for a single `.mp4` input by uploading the video and thumbnail to Zalo first. If `ffmpeg` is unavailable, the input is not a single `.mp4`, or native send fails, it falls back to the normal attachment send path. Use `--thumbnail <path-or-url>` to supply the preview image explicitly.
|
|
87
116
|
Local paths using `~` are expanded automatically (for positional file args, `--url`, and `OPENZCA_LISTEN_MEDIA_DIR`).
|
|
88
117
|
Group text sends via `openzca msg send --group` resolve unique `@Name` or `@userId` mentions against the current group member list using member ids, display names, and usernames. Mention offsets are computed after formatting markers are parsed, so messages like `**@Alice Nguyen** hello` work. If multiple members share the same label, the command fails instead of guessing.
|
|
118
|
+
`msg recent` keeps the previous live behavior by default. Use `--source db` to read only from the local SQLite store, or `--source auto` to try DB first and fall back to live history.
|
|
89
119
|
|
|
90
120
|
### Debug Logging
|
|
91
121
|
|
|
@@ -167,6 +197,7 @@ Poll creation currently targets group threads only and maps to the existing `zca
|
|
|
167
197
|
| `openzca friend reject <userId>` | Reject friend request |
|
|
168
198
|
| `openzca friend cancel <userId>` | Cancel sent friend request |
|
|
169
199
|
| `openzca friend sent` | List sent requests |
|
|
200
|
+
| `openzca friend request-status <userId>` | Check friend request status for user |
|
|
170
201
|
| `openzca friend remove <userId>` | Remove a friend |
|
|
171
202
|
| `openzca friend alias <userId> <alias>` | Set friend alias |
|
|
172
203
|
| `openzca friend remove-alias <userId>` | Remove alias |
|
|
@@ -175,6 +206,7 @@ Poll creation currently targets group threads only and maps to the existing `zca
|
|
|
175
206
|
| `openzca friend unblock <userId>` | Unblock user |
|
|
176
207
|
| `openzca friend block-feed <userId>` | Block user from viewing your feed |
|
|
177
208
|
| `openzca friend unblock-feed <userId>` | Unblock user from viewing your feed |
|
|
209
|
+
| `openzca friend boards <conversationId>` | Get boards in conversation |
|
|
178
210
|
|
|
179
211
|
### me — Profile
|
|
180
212
|
|
|
@@ -190,6 +222,54 @@ Poll creation currently targets group threads only and maps to the existing `zca
|
|
|
190
222
|
| `openzca me status <online\|offline>` | Set online status |
|
|
191
223
|
| `openzca me last-online <userId>` | Check last online time |
|
|
192
224
|
|
|
225
|
+
### db — Local SQLite source-of-truth
|
|
226
|
+
|
|
227
|
+
| Command | Description |
|
|
228
|
+
|---------|-------------|
|
|
229
|
+
| `openzca db enable` | Enable profile-scoped SQLite persistence (`--path <sqlite-file>` optional) |
|
|
230
|
+
| `openzca db disable` | Disable automatic DB persistence for the active profile |
|
|
231
|
+
| `openzca db status` | Show DB status, counts, and configured path |
|
|
232
|
+
| `openzca db me info` | Show the stored self profile snapshot |
|
|
233
|
+
| `openzca db me id` | Show the stored self user ID |
|
|
234
|
+
| `openzca db group list` | List groups stored in the DB |
|
|
235
|
+
| `openzca db group info <groupId>` | Show stored info for a group |
|
|
236
|
+
| `openzca db group members <groupId>` | List the stored member snapshot for a group |
|
|
237
|
+
| `openzca db group messages <groupId>` | List stored messages for a group (defaults to latest 20 newest-first; use `--all`, `--since <duration>`, `--from`/`--to`, `--limit`, or `--oldest-first`) |
|
|
238
|
+
| `openzca db friend list` | List friends stored in the DB |
|
|
239
|
+
| `openzca db friend find <query>` | Find stored friends by user ID or name |
|
|
240
|
+
| `openzca db friend info <userId>` | Show stored info for a friend |
|
|
241
|
+
| `openzca db friend messages <userId>` | List stored direct-message rows for a friend (defaults to latest 20 newest-first; use `--all`, `--since <duration>`, `--from`/`--to`, `--limit`, or `--oldest-first`) |
|
|
242
|
+
| `openzca db chat list` | List all chats stored in the DB |
|
|
243
|
+
| `openzca db chat info <chatId>` | Show stored info for a chat (`-g` to force group lookup) |
|
|
244
|
+
| `openzca db chat messages <chatId>` | List stored messages for any chat (`-g`; defaults to latest 20 newest-first; use `--all`, `--since <duration>`, `--from`/`--to`, `--limit`, or `--oldest-first`) |
|
|
245
|
+
| `openzca db message get <id>` | Read a single stored message by `msgId`, `cliMsgId`, or internal message uid |
|
|
246
|
+
| `openzca db sync` | Sync full group history, friend directory, and recent DM/chat windows into the DB |
|
|
247
|
+
| `openzca db sync all` | Explicit full sync |
|
|
248
|
+
| `openzca db sync groups` | Sync group directory, members, and full group history |
|
|
249
|
+
| `openzca db sync friends` | Sync friend directory only |
|
|
250
|
+
| `openzca db sync chats` | Sync discoverable chats and recent DM windows |
|
|
251
|
+
| `openzca db sync group <groupId>` | Sync one group with full group history |
|
|
252
|
+
| `openzca db sync chat <chatId>` | Sync one chat |
|
|
253
|
+
|
|
254
|
+
The DB is per-profile and is intended to be a factual local store for later querying. By default it lives at:
|
|
255
|
+
|
|
256
|
+
```text
|
|
257
|
+
~/.openzca/profiles/<profile>/messages.sqlite
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Notes:
|
|
261
|
+
|
|
262
|
+
- DB reads are explicit. Existing live commands keep their current default behavior.
|
|
263
|
+
- If DB is enabled, successful send commands and `listen` write in the background on a best-effort path so normal CLI flow is not blocked by SQLite work.
|
|
264
|
+
- Group sync is thread-scoped and more reliable because it uses the dedicated group history API when available.
|
|
265
|
+
- DM/chat sync is best-effort only. `zca-js` exposes old DM messages by user-message stream, not by exact DM thread, so `db sync chats` and `db sync chat <id>` should be treated as recent-window fills, not perfect historical mirrors.
|
|
266
|
+
- For DMs, the DB stores messages under a stable peer-based conversation key rather than trusting the raw listener `threadId` alone.
|
|
267
|
+
- Time filters accept:
|
|
268
|
+
- exact timestamps like `2026-03-21T10:00:00+07:00`
|
|
269
|
+
- unix seconds or milliseconds
|
|
270
|
+
- unix seconds or milliseconds
|
|
271
|
+
- relative durations like `7m`, `24h`, `1d`, or `1d2h30m`
|
|
272
|
+
|
|
193
273
|
### listen — Real-time listener
|
|
194
274
|
|
|
195
275
|
| Command | Description |
|
|
@@ -199,6 +279,8 @@ Poll creation currently targets group threads only and maps to the existing `zca
|
|
|
199
279
|
| `openzca listen --prefix <prefix>` | Only process messages matching prefix |
|
|
200
280
|
| `openzca listen --webhook <url>` | POST message payload to a webhook URL |
|
|
201
281
|
| `openzca listen --raw` | Output raw JSON per line |
|
|
282
|
+
| `openzca listen --db` | Force DB writes for this listener session |
|
|
283
|
+
| `openzca listen --no-db` | Disable DB writes for this listener session |
|
|
202
284
|
| `openzca listen --keep-alive` | Auto-reconnect on disconnect |
|
|
203
285
|
| `openzca listen --supervised --raw` | Supervisor mode with lifecycle JSON events (`session_id`, `connected`, `heartbeat`, `error`, `closed`) |
|
|
204
286
|
| `openzca listen --keep-alive --recycle-ms <ms>` | Periodically recycle listener process to avoid stale sessions |
|
|
@@ -351,6 +433,8 @@ Profile data is stored in `~/.openzca/` (override with `OPENZCA_HOME`):
|
|
|
351
433
|
profiles.json
|
|
352
434
|
profiles/<name>/credentials.json
|
|
353
435
|
profiles/<name>/cache/*.json
|
|
436
|
+
profiles/<name>/db.json
|
|
437
|
+
profiles/<name>/messages.sqlite
|
|
354
438
|
```
|
|
355
439
|
|
|
356
440
|
## Development
|