thebird 1.2.5 → 1.2.6

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 (2) hide show
  1. package/CLAUDE.md +22 -17
  2. package/package.json +1 -1
package/CLAUDE.md CHANGED
@@ -42,24 +42,28 @@ Some providers need field adjustments:
42
42
 
43
43
  Applied automatically during request building.
44
44
 
45
- ## gembird — Image Generation via Browser
45
+ ## gembird — Image Generation via Hybrid Approach
46
46
 
47
- **gembird** generates 4-view product images (front, back, left-side, right-side) using Gemini's web UI.
47
+ **gembird** generates 4-view product images (front, back, left-side, right-side) using Gemini's web UI + HTTP API hybrid approach.
48
48
 
49
- ### Why Browser Automation?
49
+ ### Workflow
50
50
 
51
- Gemini API free tier has 0 quota for image generation. Web UI works without limits. Tradeoff: slower than API, depends on UI stability, but no quota needed.
51
+ 1. **Auth via Browser**: Playwright CDP connects to Chrome on `localhost:9222` and navigates to gemini.google.com. User is already logged in.
52
+ 2. **Session Capture**: Intercept network requests to extract session: `{ cookies, xsrf, fsid, template }`. One-time capture, cached in `.gemini-session.json`.
53
+ 3. **HTTP Generation**: For each view, POST prompt to Cloud Code Assist API with captured session. Stream response.
54
+ 4. **Parse Response**: Extract image URLs from streaming response via regex.
55
+ 5. **Download**: Download PNG from `lh3.googleusercontent.com` with cookies. Save to disk.
52
56
 
53
- ### Workflow
57
+ ### Why Hybrid?
58
+
59
+ Gemini API free tier has 0 quota for image generation. Browser provides free auth. HTTP API (Cloud Code Assist) provides faster generation than DOM polling + canvas extraction. Hybrid = free auth + fast generation + no quota limits.
60
+
61
+ ### Performance
54
62
 
55
- 1. Playwright CDP connection to Chrome on `localhost:9222`
56
- 2. Navigate to gemini.google.com
57
- 3. For each view:
58
- - Type prompt asking for that view
59
- - Poll for new `<img alt="AI generated">` (120s timeout)
60
- - Extract via canvas: `canvas.drawImage(img) → canvas.toDataURL('image/png')`
61
- - POST base64 to local HTTP save server
62
- 4. Save 4 PNGs to output dir
63
+ - Browser connection: one-time, 30s
64
+ - HTTP generation per image: ~30-60s (Gemini's generation time, not polling overhead)
65
+ - Download per image: ~5s
66
+ - Total: ~4 images in 2-3 minutes (vs ~8 minutes with browser polling + canvas extraction)
63
67
 
64
68
  ### CLI
65
69
 
@@ -69,13 +73,14 @@ node index.js --image ref.png "prompt"
69
73
  node index.js --output ./dir "prompt"
70
74
  ```
71
75
 
72
- Arguments parsed in index.js lines 144-172.
76
+ Arguments parsed in index.js lines 88-115.
73
77
 
74
78
  ### Observability
75
79
 
76
- - Chrome console logs Gemini errors
77
- - 120s timeout is conservative; real generation ~30-60s
78
- - If extraction fails, check `img[alt*="AI generated"]` selector
80
+ - Session cached in `.gemini-session.json` (expires after 1 hour)
81
+ - HTTP response streamed and parsed for image URLs
82
+ - Download errors logged with context
83
+ - Progress logged per view: `[1/4] front view...`
79
84
 
80
85
  ## Development Constraints
81
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thebird",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Anthropic SDK to Gemini streaming bridge — drop-in proxy that translates Anthropic message format and tool calls to Google Gemini",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",