vg-coder-cli 2.0.50 → 2.0.52
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/INTEGRATION.md +27 -3
- package/README.md +18 -3
- package/dist/vg-coder-bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +3 -1
- package/src/server/api-server.js +14 -1
- package/src/server/views/js/main.js +13 -1
- package/src/server/views/vg-coder/background.js +59 -2
package/INTEGRATION.md
CHANGED
|
@@ -40,9 +40,13 @@ External Service ◀── POST <webhookUrl> (push, retry 3×)
|
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
npm install -g vg-coder-cli # hoặc: cd repo && npm run build
|
|
43
|
-
vg start # khởi động server :6868
|
|
43
|
+
vg start # khởi động server :6868 (loopback)
|
|
44
|
+
vg start --host 0.0.0.0 # bind LAN/Docker
|
|
45
|
+
vg start --worker # ẩn bubble + dashboard panel trên tab AI Studio
|
|
44
46
|
```
|
|
45
47
|
|
|
48
|
+
> **Worker-only mode** (`--worker`): server inject `window.__VG_WORKER_ONLY__=true` vào bundle khi serve `/dist/vg-coder-bundle.js`. Dashboard sẽ ẩn `#vg-coder-shadow-host` và chỉ chạy `initTaskWorker()` — không render bubble + tool panels. REST API vẫn đầy đủ. Sau khi đổi flag phải **reload tab AI Studio** để bundle mới load.
|
|
49
|
+
|
|
46
50
|
### Worker (browser tab)
|
|
47
51
|
|
|
48
52
|
Mỗi Google account muốn dùng → 1 Chrome profile riêng:
|
|
@@ -180,7 +184,7 @@ Server có thể chủ động list / đóng / mở tab AI Studio trong từng p
|
|
|
180
184
|
|---|---|---|---|
|
|
181
185
|
| `GET` | `/api/launcher/tabs` | `?label=<email>` (optional) | List tabs trong profile (hoặc all profiles nếu bỏ label) |
|
|
182
186
|
| `POST` | `/api/launcher/close-tab` | `{ workerLabel?, tabId? }` | Đóng tab cụ thể, hoặc tất cả tab AI Studio nếu bỏ `tabId` |
|
|
183
|
-
| `POST` | `/api/launcher/open-tab` | `{ workerLabel?, model?, url?, active? }` | Mở tab mới. `model` mặc định `gemini-3-flash-preview` |
|
|
187
|
+
| `POST` | `/api/launcher/open-tab` | `{ workerLabel?, model?, url?, active? }` | Mở tab mới. `model` mặc định `gemini-3-flash-preview`. Response v2.0.52+ kèm `requested_model` / `actual_model` / `fallback_occurred` để detect AI Studio silent-fallback (account thiếu access tới preview model) |
|
|
184
188
|
|
|
185
189
|
```bash
|
|
186
190
|
# List tab tất cả profile
|
|
@@ -193,6 +197,26 @@ curl -X POST -d '{"workerLabel":"alice@gmail.com","model":"gemini-3-flash-previe
|
|
|
193
197
|
-H 'Content-Type: application/json' http://127.0.0.1:6868/api/launcher/open-tab
|
|
194
198
|
```
|
|
195
199
|
|
|
200
|
+
`open-tab` response (v2.0.52+):
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"ok": true,
|
|
205
|
+
"tabId": 477055248,
|
|
206
|
+
"windowId": 477055217,
|
|
207
|
+
"url": "https://aistudio.google.com/prompts/new_chat?model=gemini-3-flash-preview",
|
|
208
|
+
"requested_url": "https://aistudio.google.com/prompts/new_chat?model=gemini-3-pro-preview",
|
|
209
|
+
"requested_model": "gemini-3-pro-preview",
|
|
210
|
+
"actual_model": "gemini-3-flash-preview",
|
|
211
|
+
"fallback_occurred": true
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Khi `fallback_occurred: true` — AI Studio đã redirect sang model khác do account
|
|
216
|
+
không có access. Client nên check field này để fail-fast hoặc retry với model
|
|
217
|
+
khác. Trước v2.0.52, response chỉ trả URL request → silent quality degradation
|
|
218
|
+
không detect được.
|
|
219
|
+
|
|
196
220
|
### Modal auto-handling
|
|
197
221
|
|
|
198
222
|
AI Studio thỉnh thoảng pop modal chặn task. Worker tự detect + click button đúng (poll mỗi 400 ms):
|
|
@@ -403,7 +427,7 @@ User vẫn có thể:
|
|
|
403
427
|
|
|
404
428
|
```bash
|
|
405
429
|
curl http://127.0.0.1:6868/health
|
|
406
|
-
# {"status":"ok","version":"2.0.
|
|
430
|
+
# {"status":"ok","version":"2.0.50"}
|
|
407
431
|
```
|
|
408
432
|
|
|
409
433
|
## End-to-end smoke test
|
package/README.md
CHANGED
|
@@ -73,13 +73,20 @@ vg clean --output ./my-output
|
|
|
73
73
|
|
|
74
74
|
#### 4. **Khởi động API Server** 🆕
|
|
75
75
|
```bash
|
|
76
|
-
# Start server (mặc định port 6868)
|
|
76
|
+
# Start server (mặc định port 6868, bind 127.0.0.1)
|
|
77
77
|
vg start
|
|
78
78
|
vg s # Alias rút gọn
|
|
79
79
|
|
|
80
80
|
# Custom port
|
|
81
81
|
vg start -p 8080
|
|
82
82
|
|
|
83
|
+
# Bind LAN/Docker (cho phép truy cập từ host khác)
|
|
84
|
+
vg start --host 0.0.0.0
|
|
85
|
+
|
|
86
|
+
# Worker-only mode: ẩn bubble + dashboard panel trên tab AI Studio,
|
|
87
|
+
# chỉ chạy task automation (cho server headless điều phối từ xa)
|
|
88
|
+
vg start --worker
|
|
89
|
+
|
|
83
90
|
# Browser tự động mở dashboard tại http://localhost:6868
|
|
84
91
|
```
|
|
85
92
|
|
|
@@ -94,7 +101,7 @@ GET http://localhost:6868/health
|
|
|
94
101
|
```json
|
|
95
102
|
{
|
|
96
103
|
"status": "ok",
|
|
97
|
-
"version": "2.0.
|
|
104
|
+
"version": "2.0.50",
|
|
98
105
|
"timestamp": "2026-05-09T10:07:13.000Z"
|
|
99
106
|
}
|
|
100
107
|
```
|
|
@@ -194,6 +201,8 @@ Content-Type: application/json
|
|
|
194
201
|
| Option | Mô tả | Default |
|
|
195
202
|
|--------|-------|---------|
|
|
196
203
|
| `-p, --port <port>` | Port cho server | 6868 |
|
|
204
|
+
| `--host <host>` | Bind address. Set `0.0.0.0` cho LAN/Docker port-forward (env: `VG_HOST`) | 127.0.0.1 |
|
|
205
|
+
| `--worker` | Worker-only mode: ẩn bubble + dashboard panel trên tab AI Studio, chỉ giữ task automation | false |
|
|
197
206
|
|
|
198
207
|
## 🎨 Dashboard UI
|
|
199
208
|
|
|
@@ -369,7 +378,13 @@ MIT License - xem file [LICENSE](LICENSE) để biết thêm chi tiết.
|
|
|
369
378
|
|
|
370
379
|
## 📊 Version History
|
|
371
380
|
|
|
372
|
-
### v2.0.
|
|
381
|
+
### v2.0.50 (Latest)
|
|
382
|
+
- 🤖 Worker-only mode (`vg start --worker`): server prepend `window.__VG_WORKER_ONLY__=true` vào bundle, dashboard skip bubble + panels, chỉ chạy `initTaskWorker()` — tab AI Studio sạch không bị che bởi UI
|
|
383
|
+
- ⏲️ Idle worker tab TTL (env `VG_WORKER_IDLE_TTL_MS`, default 120 000): không có task mới → launcher đóng tab → CPU container về 0%; task tới sẽ tự mở lại tab
|
|
384
|
+
- 🐳 Configurable bind address: `vg start --host 0.0.0.0` (hoặc env `VG_HOST`) cho LAN/Docker port-forward
|
|
385
|
+
- 🧱 Dynamic CSP bypass via `chrome.declarativeNetRequest.updateDynamicRules` — fix lỗi parse static rules.json trên Chromium 120 (Linux/Docker)
|
|
386
|
+
|
|
387
|
+
### v2.0.48
|
|
373
388
|
- 🤖 Remote Task API: external service push task chat AI Studio + nhận callback (`POST /api/tasks` + webhook)
|
|
374
389
|
- 🧠 Multi-worker pool: mỗi Chrome profile = 1 worker, parallel + auto-failover khi rate-limit
|
|
375
390
|
- 🪟 Launcher SW per profile + tab management API (`GET /api/launcher/tabs`, `POST /api/launcher/{open,close}-tab`)
|