vg-coder-cli 2.0.58 → 2.0.59

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 CHANGED
@@ -66,6 +66,32 @@ Mỗi Google account muốn dùng → 1 Chrome profile riêng:
66
66
  > curl -s http://127.0.0.1:6868/api/workers | jq
67
67
  > ```
68
68
 
69
+ ### Deploy AIChat scripts (Firebase RTDB)
70
+
71
+ ⚠️ **Quan trọng cho dev sửa code AIChat**: file
72
+ `vetgo-auto/scripts/aistudio.google.com/main.js` (định nghĩa `window.AIChat` —
73
+ core scraping logic: model selection, file upload, send prompt, copy markdown)
74
+ **KHÔNG** bundle vào npm package. Extension fetch script tại runtime từ
75
+ **Firebase Realtime Database** (`vetgo-chrome-default-rtdb`, path
76
+ `ENV/VGCODER`).
77
+
78
+ Hệ quả:
79
+ - Bump `vg-coder-cli` version + `npm publish` **KHÔNG** đẩy code AIChat mới.
80
+ - Phải chạy `cd vetgo-auto && node deploy-scripts.js` để PUT script lên Firebase.
81
+ - Test fix nhanh: deploy Firebase + restart Chromium (extension re-fetch script
82
+ lúc init). Không cần rebuild image / restart container.
83
+ - CI publish workflow (v2.0.58+) đã add step `npm run deploy-scripts` → bump
84
+ version trên git sẽ auto-deploy Firebase.
85
+
86
+ ```bash
87
+ # Deploy local (dev) — sửa main.js xong:
88
+ cd vetgo-auto && node deploy-scripts.js
89
+ # → PUT https://...firebaseio.../ENV/VGCODER.json
90
+
91
+ # Restart chromium ở target server để re-fetch:
92
+ ssh ... "docker exec chrome-mcp-vgcoder supervisorctl restart chromium"
93
+ ```
94
+
69
95
  ## REST API
70
96
 
71
97
  ### POST `/api/tasks` — submit task
package/bugs/bug1.md CHANGED
@@ -434,17 +434,60 @@ runtime từ Firebase. CI `publish.yml` chỉ chạy `build:extension` + `build:
434
434
  **Fix CI**: add `npm run deploy-scripts` step vào `publish.yml` (commit
435
435
  83186ba). Lần sau bump version → CI tự push Firebase.
436
436
 
437
+ ### Round 7 — File upload race (server4 Windows-specific)
438
+
439
+ Sau bug1 fix work cả 3 server cho text-only task, test multimodal:
440
+ - server2/3 (Linux native): image + PDF Pro work ✅
441
+ - server4 (Docker Desktop Windows): cả image + PDF → model trả "chưa upload
442
+ file" mặc dù chip hiển thị file đã attach trong UI.
443
+
444
+ User screenshot 2 lần show:
445
+ 1. Chip "feline-xray-chest7.jpg Loading..." — file đang upload
446
+ 2. Chip "feline-xray-chest7.jpg 1,101 tokens" — upload xong, nhưng textarea
447
+ vẫn trống, worker chưa paste prompt
448
+
449
+ DOM inspect tìm thấy chip element là `<ms-prompt-media>` /
450
+ `[data-test-id="prompt-media-container"]` — KHÔNG match selector cũ
451
+ `ms-prompt-chip-file, ms-file-chip, ms-attachment-chip`. Wait loop pass với
452
+ `chips=0`, fall through 30s timeout → submit Run trước khi tokenize xong → AI
453
+ Studio drop file silent.
454
+
455
+ **Cause cụ thể**: 2 vấn đề chồng nhau:
456
+ 1. Selector outdated (AI Studio đã rename element 2026)
457
+ 2. Không có check token-count finalize (chip hiện ngay sau drop, tokenize 5-15s
458
+ sau đặc biệt trên Windows fs latency)
459
+
460
+ **Fix v2.0.58**:
461
+ - Update CHIP_SELECTORS thêm `ms-prompt-media`, `[data-test-id="prompt-media-container"]`
462
+ - Add wait loop: chip text phải match `/[\d,]+ tokens/` (support comma) VÀ
463
+ KHÔNG có `Calculating|Processing|Uploading|Loading`
464
+ - Timeout 60s → proceed anyway
465
+
466
+ **Result**: server4 image task 105s → 23s sau fix selector + regex chuẩn. Cả 3
467
+ server multimodal Pro work end-to-end.
468
+
437
469
  ### Lesson learned
438
470
 
439
471
  - **Quan sát visual (noVNC) > eval DOM async**: User report "tab reload trước
440
- khi chat" clue quyết định. Eval DOM tại các thời điểm khác nhau cho data
441
- rời rạc khó ráp.
472
+ khi chat" + screenshot chip "Loading..." "1,101 tokens" textarea trống
473
+ clue quyết định. Eval DOM tại các thời điểm khác nhau cho data rời rạc khó
474
+ ráp — visual real-time mới thấy state transitions.
442
475
  - **Grep hardcode constant trước khi đoán external behavior**: 4 round đầu đoán
443
- AI Studio làm gì đó (redirect, strip query). Round 5 tìm thấy hardcode trong
444
- chính code mình.
476
+ AI Studio làm gì đó (redirect, strip query). Round 5 tìm thấy hardcode
477
+ `VG_DEFAULT_MODEL` trong chính code mình.
445
478
  - **Verify deploy artifact trên target server**: Round 6 chỉ ra version bump
446
479
  KHÔNG đảm bảo code mới chạy nếu deploy pipeline có gap. Sau mỗi fix, grep
447
480
  symbol mới trong file production thực — không tin "CI passed = code chạy".
481
+ - **Selector update qua thời gian (round 7)**: AI Studio Angular rename
482
+ tag/class qua mỗi version. Match cả new + legacy selector trong array. Khi
483
+ wait loop pass với count=0 (warning ignored) → có thể selector đã chết.
484
+ - **Multi-issue stacking**: Round 7 có 2 cause chồng nhau (selector outdated
485
+ AND tokenize race). Fix 1 cause không đủ — verify fully E2E sau mỗi fix.
448
486
  - **Multiple layer detection có giá trị**: `actualModel` (DOM scrape) là
449
487
  source-of-truth đúng đắn ngay từ v2.0.53 — confirm bug có thật, định nghĩa
450
488
  expected behavior cho fix, không phụ thuộc fix nào fail.
489
+ - **Firebase deploy không đồng bộ với npm publish**: code AIChat ở
490
+ `vetgo-auto/scripts/aistudio.google.com/*.js` deploy qua Firebase RTDB
491
+ riêng. Bump npm package version KHÔNG đẩy code này (trước v2.0.58 CI fix).
492
+ Test fix nhanh: `cd vetgo-auto && node deploy-scripts.js` + restart Chromium
493
+ — KHÔNG cần rebuild image hay update package.