@softtynet/zplus-worker 1.0.0 → 1.0.4

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.
Files changed (35) hide show
  1. package/README.md +27 -55
  2. package/dist/cli.js +1 -1408
  3. package/package.json +3 -3
  4. package/dist/automation/HeadlessAutomationEngine.d.ts +0 -12
  5. package/dist/automation/HeadlessAutomationEngine.js +0 -34
  6. package/dist/channels/ChannelRunnerRegistry.d.ts +0 -14
  7. package/dist/channels/ChannelRunnerRegistry.js +0 -65
  8. package/dist/channels/IChannelRunner.d.ts +0 -10
  9. package/dist/channels/IChannelRunner.js +0 -2
  10. package/dist/channels/index.d.ts +0 -6
  11. package/dist/channels/index.js +0 -22
  12. package/dist/channels/runners/FacebookChannelRunner.d.ts +0 -19
  13. package/dist/channels/runners/FacebookChannelRunner.js +0 -47
  14. package/dist/channels/runners/TelegramChannelRunner.d.ts +0 -19
  15. package/dist/channels/runners/TelegramChannelRunner.js +0 -47
  16. package/dist/channels/runners/WhatsAppChannelRunner.d.ts +0 -19
  17. package/dist/channels/runners/WhatsAppChannelRunner.js +0 -47
  18. package/dist/channels/runners/ZaloChannelRunner.d.ts +0 -22
  19. package/dist/channels/runners/ZaloChannelRunner.js +0 -50
  20. package/dist/cli.d.ts +0 -6
  21. package/dist/config/WorkerConfig.d.ts +0 -16
  22. package/dist/config/WorkerConfig.js +0 -21
  23. package/dist/engine/WorkerEngine.d.ts +0 -38
  24. package/dist/engine/WorkerEngine.js +0 -157
  25. package/dist/index.d.ts +0 -9
  26. package/dist/lock/DistributedLockManager.d.ts +0 -40
  27. package/dist/lock/DistributedLockManager.js +0 -113
  28. package/dist/notifications/PushNotificationDispatcher.d.ts +0 -14
  29. package/dist/notifications/PushNotificationDispatcher.js +0 -31
  30. package/dist/server/WorkerHttpServer.d.ts +0 -25
  31. package/dist/server/WorkerHttpServer.js +0 -205
  32. package/dist/sync/CloudPendingMessageQueue.d.ts +0 -27
  33. package/dist/sync/CloudPendingMessageQueue.js +0 -69
  34. package/dist/sync/CloudSyncWorker.d.ts +0 -19
  35. package/dist/sync/CloudSyncWorker.js +0 -53
package/README.md CHANGED
@@ -1,35 +1,32 @@
1
1
  # @softtynet/zplus-worker
2
2
 
3
- ZPlus 24/7 Headless Omnichannel Engine & Automation Worker.
3
+ ZPlus 24/7 Headless Automation & Omnichannel Worker Engine.
4
4
 
5
5
  ---
6
6
 
7
- ## 🌟 Tổng Quan (Overview)
7
+ ## 🌟 Giới Thiệu (Introduction)
8
8
 
9
- `@softtynet/zplus-worker` là tiến trình chạy nền độc lập 24/7 cho hệ sinh thái ZPlus Enterprise, chịu trách nhiệm:
10
-
11
- - **Active-Passive Redundancy & Master Preemption (< 1s)**: Hoạt động song song với ZPlus Desktop Client, tự động đảm nhận điều khiển khi Desktop tắt và ngay lập tức nhường quyền khi Desktop mở lại.
12
- - **Duy trì kết nối WSS / Webhook liên tục**: Giữ phiên hoạt động cho các tài khoản đa kênh (**Zalo, Facebook Messenger, Telegram, WhatsApp**) thông qua proxy dân cư độc lập (Resident Proxy).
13
- - **Thực thi kịch bản tự động hóa 24/7**: Phản hồi tin nhắn tự động ban đêm (AI Auto-Reply), phân luồng CSKH, gắn thẻ hội thoại ngay cả khi người dùng tắt máy tính cá nhân.
14
- - **Delta Sync & Message Staging**: Lưu trữ hàng đợi tin nhắn đêm và đồng bộ lại vào cơ sở dữ liệu cục bộ khi ZPlus Desktop khởi động.
9
+ `@softtynet/zplus-worker` là tiến trình chạy nền độc lập 24/7 cho hệ sinh thái ZPlus Enterprise. Phân hệ chịu trách nhiệm duy trì phiên kết nối mạng xã hội, tiếp nhận tin nhắn và thực thi kịch bản tự động hóa liên tục ngay cả khi người dùng không mở máy tính cá nhân.
15
10
 
16
11
  ---
17
12
 
18
- ## 🚀 Các Phương Thức Triển Khai (Deployment Options)
19
-
20
- ### Cách 1: Chạy trực tiếp qua NPM / NPX (Zero Config, Siêu Nhẹ)
13
+ ## 🚀 Hướng Dẫn Cài Đặt & Sử Dụng (Quickstart)
21
14
 
22
- Không cần cài đặt Docker nặng nề, thể chạy trên bất kỳ VPS, Raspberry Pi, homelab hoặc máy chủ nào có Node.js >= 18:
15
+ ### Cách 1: Chạy trực tiếp qua NPX (Không cần cài đặt)
23
16
 
24
17
  ```bash
25
- # 1. Chạy tức thì không cần cài đặt:
26
18
  npx @softtynet/zplus-worker
19
+ ```
20
+
21
+ ### Cách 2: Cài đặt toàn cục trên máy chủ VPS / Linux
27
22
 
28
- # 2. Hoặc cài đặt global trên VPS / Server:
23
+ ```bash
29
24
  npm install -g @softtynet/zplus-worker
30
25
  zplus-worker
26
+ ```
31
27
 
32
- # 3. Chạy nền quản lý tiến trình với PM2 (Khuyên dùng trên VPS Linux):
28
+ #### Khuyên dùng: Quản lý tiến trình nền bằng PM2 trên VPS
29
+ ```bash
33
30
  npm install -g pm2
34
31
  pm2 start zplus-worker --name "zplus-worker" --time
35
32
  pm2 save && pm2 startup
@@ -37,30 +34,20 @@ pm2 save && pm2 startup
37
34
 
38
35
  ---
39
36
 
40
- ### Cách 2: Triển khai bằng Docker & Docker Compose
41
-
42
- Docker Image được build đa kiến trúc (`linux/amd64`, `linux/arm64`) và lưu trữ chính thức trên GitHub Container Registry (`ghcr.io/softtynet/zplus-worker:latest`):
43
-
44
- #### A. Chạy nhanh 1 lệnh:
37
+ ### Cách 3: Chạy với Docker & Docker Compose
45
38
 
39
+ #### A. Chạy nhanh 1 lệnh Container:
46
40
  ```bash
47
41
  docker run -d \
48
42
  --name zplus-worker \
49
43
  --restart always \
50
44
  -p 8080:8080 \
51
- -e WORKER_ID=vps_singapore_01 \
45
+ -e WORKER_ID=vps_node_1 \
52
46
  -e DESKTOP_SECRET=your_secure_secret \
53
47
  ghcr.io/softtynet/zplus-worker:latest
54
48
  ```
55
49
 
56
- #### B. Triển khai trọn gói với Docker Compose (kèm Redis Distributed Lock):
57
-
58
- ```bash
59
- cd apps/worker
60
- docker compose up -d
61
- ```
62
-
63
- File `docker-compose.yml` mẫu:
50
+ #### B. Khởi chạy trọn gói qua Docker Compose:
64
51
  ```yaml
65
52
  version: "3.8"
66
53
 
@@ -96,41 +83,26 @@ volumes:
96
83
  redis_data:
97
84
  ```
98
85
 
86
+ ```bash
87
+ docker compose up -d
88
+ ```
89
+
99
90
  ---
100
91
 
101
92
  ## ⚙️ Biến Môi Trường (Environment Variables)
102
93
 
103
94
  | Biến | Mặc định | Mô tả |
104
95
  | :--- | :--- | :--- |
96
+ | `PORT` | `8080` | Cổng HTTP Ingress & Healthcheck |
105
97
  | `WORKER_ID` | `worker_<pid>` | Tên định danh duy nhất của Worker Node |
106
- | `PORT` | `8080` | Port HTTP Ingress & Healthcheck |
107
98
  | `DESKTOP_SECRET` | `zplus_shared_secret_token` | Khóa xác thực an toàn giữa Desktop và Worker |
108
- | `REDIS_URL` | `undefined` | URL Redis cho Distributed Lock (Tùy chọn) |
109
- | `DATA_DIR` | `./data` | Thư mục lưu trữ database SQLite và session cache |
110
- | `HEARTBEAT_INTERVAL_MS` | `30000` | Chu kỳ gửi Heartbeat (ms) |
99
+ | `REDIS_URL` | `undefined` | URL Redis cho Distributed Lock (Tùy chọn khi chạy cụm) |
100
+ | `DATA_DIR` | `./data` | Thư mục lưu trữ database cục bộ và session cache |
111
101
 
112
102
  ---
113
103
 
114
- ## 🚢 Tự Động Hóa Release qua GitHub Actions & GitHub CLI (`gh`)
115
-
116
- Hệ thống đã cấu hình 2 luồng CI/CD GitHub Actions:
117
- 1. `.github/workflows/publish-worker-npm.yml` - Tự động test, bundle và publish lên NPM Registry.
118
- 2. `.github/workflows/publish-worker-docker.yml` - Tự động build multi-arch và push lên GitHub Container Registry (`ghcr.io`).
119
-
120
- ### Cách kích hoạt Release:
104
+ ## 🛡️ Bản Quyền & Hỗ Trợ (License & Support)
121
105
 
122
- #### Cách A: Bằng GitHub CLI (`gh`)
123
- ```bash
124
- # 1. Kích hoạt publish NPM:
125
- gh workflow run publish-worker-npm.yml
126
-
127
- # 2. Kích hoạt build Docker Image lên GHCR:
128
- gh workflow run publish-worker-docker.yml
129
- ```
130
-
131
- #### Cách B: Bằng Git Tag
132
- ```bash
133
- git tag worker-v1.0.0
134
- git push origin worker-v1.0.0
135
- ```
136
- *(Cả 2 workflow NPM và Docker sẽ tự động kích hoạt song song khi tag `worker-v*` được đẩy lên)*.
106
+ Sản phẩm thuộc bản quyền của **SOFTTY.NET COMPANY LIMITED**.
107
+ Website chính thức: [https://softty.net](https://softty.net)
108
+ Hỗ trợ kỹ thuật: [support@softty.net](mailto:support@softty.net)