| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A sleek, transparent desktop overlay that automatically triggers a beautiful Warp Speed particle animation when using OpenCode — any provider (xAI/Grok, and more).
⚠️ Actively developed. Contributions and feedback are welcome!
Status: stable for daily use — OpenCode TUI works normally, particles auto show/hide, no [EVENT] spam on chat (logs go to file / settings diagnostics).
| Settings panel | Generating (warp particles) |
|---|---|
![]() |
![]() |
Media: public/. Full setup guide (Windows + macOS) below.
📖 Docs site (GitHub Pages): sonht113.github.io/overlayagent-opencode
Agent Overlay là cửa sổ desktop trong suốt (Tauri) hiển thị animation particles khi OpenCode đang generate. Có 11 style (mặc định Hyperspace; Signal = sóng đồng tâm) và chỉnh alpha theo style.
| Trạng thái | Hành vi |
|---|---|
| Idle | Window ẩn — chỉ còn icon tray |
| Generating | Window hiện, chỉ particles (không cướp focus IDE) — xem demo-2 |
| Multi-gen | Nhiều process OpenCode cùng lúc → overlay any-active (ẩn khi tất cả xong) |
| Settings | Right-click / tray → panel (style, alpha, speed, …) — xem demo-1 |
Luồng tự động (Windows / macOS giống nhau):
Login
→ start-overlay (autostart) → tray, window ẩn, HTTP :9876
Terminal (cwd = project của bạn)
→ gõ: opencode (hoặc oc)
→ shim/oc set PYTHONPATH + AGENT_TOOL_ROOT (không cd tool root)
→ opencode_bridge → OpenCode TUI (thật, đúng project)
→ generate → POST event (+ bridge_pid, session_id) → Overlay particles
→ generation_end (per session) → khi không còn session → fade → ẩn
| OS | Install / launcher | Shim |
|---|---|---|
| Windows | *.ps1, oc.cmd | shim\opencode.cmd |
| macOS | *.sh, oc.sh | shim/opencode |
Env chung: AGENT_TOOL_ROOT, OPENCODE_CMD, OPENCODE_REAL, TAURI_EVENT_URL, OPENCODE_DB / OPENCODE_DATA_DIR / OPENCODE_LOG_DIR.
| Thành phần | Windows | macOS |
|---|---|---|
| OS | Windows 10/11 (đã test) | macOS 12+ (Apple Silicon / Intel) |
| Node.js 18+ | ✓ | ✓ (brew install node) |
| Rust | + MSVC Build Tools | rustup + Xcode CLT |
| Python 3.x | py -3 hoặc python | python3 |
| OpenCode | npm i -g opencode-ai | cùng / brew |
| curl | — | có sẵn (health check scripts) |
Tool root: clone repo bất kỳ đâu. oc.ps1 / shim / start-overlay resolve root theo vị trí script (hoặc AGENT_TOOL_ROOT). Không bắt buộc C:\Work\Tool — các ví dụ bên dưới dùng path đó chỉ mang tính minh họa.
Làm tuần tự. Sau bước 2–4 nên đóng hết terminal rồi mở lại.
# Clone repo rồi cd vào thư mục đó (ví dụ $env:AGENT_TOOL_ROOT)
cd $env:AGENT_TOOL_ROOT\agent-overlay # hoặc: cd path\to\overlayagent-opencode\agent-overlay
npm install
# Production binary (khuyến nghị cho dùng thật)
npm run tauri build
# Hoặc dev (hot reload, chậm lần đầu)
# npm run tauri devThành công: icon Agent Overlay trên system tray, window ẩn.
Kiểm tra HTTP bridge:
Invoke-RestMethod http://127.0.0.1:9876/health
# Kỳ vọng: ok=true, service=agent-overlay, port=9876Nếu chưa có exe release, start-overlay.ps1 vẫn dùng target\debug\agent-overlay.exe nếu đã tauri dev / cargo build trước đó.
cd C:\Work\Tool
powershell -ExecutionPolicy Bypass -File .\install-shim.ps1Script sẽ:
powershell -ExecutionPolicy Bypass -File .\install-autostart.ps1Optional — thêm daemon giữ overlay sống:
powershell -ExecutionPolicy Bypass -File .\install-autostart.ps1 -WithDaemonTạo shortcut trong thư mục Startup của Windows.
notepad $PROFILEThêm:
. C:\Work\Tool\profile-snippet.ps1Lưu → restart Warp / PowerShell.
Profile cung cấp:
Trong terminal mới:
where.exe opencode
# Dòng đầu: C:\Work\Tool\shim\opencode.cmd
Get-Content C:\Work\Tool\.agent-bridge\config.json
# opencode_cmd trỏ tới ...\opencode.exe (không phải shim)
Invoke-RestMethod http://127.0.0.1:9876/health
# Mở TUI (phải vào giao diện OpenCode, chat sạch)
opencodeLàm trên MacBook (bash/zsh). Repo path ví dụ: ~/Tool hoặc clone git.
# Xcode command line tools (nếu chưa)
xcode-select --install
# Node, Python (Homebrew)
brew install node python rustup
rustup default stable
# OpenCode
npm install -g opencode-ai
# hoặc theo hướng dẫn opencode.aiexport AGENT_TOOL_ROOT=/path/to/Tool # thư mục chứa opencode_bridge + agent-overlay
cd "$AGENT_TOOL_ROOT/agent-overlay"
npm install
npm run tauri build
# → …/src-tauri/target/release/bundle/macos/Agent Overlay.appDev (hot reload):
npm run tauri devcd "$AGENT_TOOL_ROOT"
chmod +x start-overlay.sh oc.sh install-shim.sh install-autostart.sh shim/opencode
./install-shim.shScript sẽ:
source ~/.zshrc
which opencode
# …/Tool/shim/opencode./install-autostart.sh
# LaunchAgent: ~/Library/LaunchAgents/com.agent.overlay.plist# ~/.zshrc
export AGENT_TOOL_ROOT=/path/to/Tool
source $AGENT_TOOL_ROOT/profile-snippet.zshHelpers: oc, start-agent-overlay, enable-agent-monitor, get-agent-status.
./start-overlay.sh
curl -s http://127.0.0.1:9876/health
# {"ok":true,"service":"agent-overlay",…}
opencode
# hoặc: ./oc.shexport AGENT_TOOL_ROOT=/path/to/Tool
export OPENCODE_CMD="$(command -v opencode)" # binary thật, trước khi prepend shim
cd "$AGENT_TOOL_ROOT"
./start-overlay.sh
python3 -m opencode_bridge runopencodehoặc:
oc| Lệnh | Ý nghĩa |
|---|---|
| opencode / oc | Mở TUI interactive (+ monitor overlay) |
| opencode run "prompt" / oc run "prompt" | Chạy một prompt non-interactive |
| oc "hello" | OpenCode hiểu "hello" là project path, không phải nội dung chat |
| Mục | Việc |
|---|---|
| Show settings / double-click tray | Hiện window + mở panel settings |
| Hide overlay | Ẩn window |
| Quit | Thoát app |
Mặc định im lặng trên console để không phá TUI. Muốn xem log event trên terminal:
# Windows
$env:AGENT_BRIDGE_VERBOSE = "1"
opencode# macOS
export AGENT_BRIDGE_VERBOSE=1
opencodeEvent vẫn luôn được ghi vào:
# Windows
Invoke-RestMethod -Method POST http://127.0.0.1:9876/event `
-ContentType "application/json" `
-Body '{"event":"generation_start","data":{"model":"test","provider":"xai"}}'# macOS
curl -s -X POST http://127.0.0.1:9876/event \
-H "Content-Type: application/json" \
-d '{"event":"generation_start","data":{"model":"test","provider":"xai"}}'Hoặc tray → Show settings → Test warp.
Mở panel: Right-click lên overlay (khi đang generate) · tray → Show settings · double-click tray.
Settings được persist trong localStorage (agent-overlay.settings) — style, alpha từng style, opacity, intensity, speed, hướng. (Debounce khi kéo slider.)
| Setting | Phạm vi | Mặc định | Ý nghĩa |
|---|---|---|---|
| Animation style | 11 presets | Hyperspace | Kiểu particle field |
| Style alpha | 0.15–1.5× | 1× | Độ sáng particle của style đang chọn (nhớ riêng từng style) |
| Token flow on stream | on/off | on | Chip +N / total trôi theo particle stream khi token tăng |
| Show token count | on/off | off | Số token tĩnh giữa màn (bổ sung) |
| Opacity | 25–100% | 100% | Độ mờ shell (cả cửa sổ) |
| Particle intensity | 0.35–1.5× | 1× | Mật độ / độ mạnh field (kết hợp token) |
| Speed | 0.4–2× | 1× | Tốc độ particle |
| Motion direction | 0–360° + preset | theo style | Hướng chính (ẩn với style radial) |
| Motion spread | 0–60° | theo style | Độ xòe (ẩn với style radial) |
| Test warp | — | — | Bật/tắt animation tay |
| Hide overlay | — | — | Ẩn window (force-idle) |
| Recent events | — | — | Log event gần đây |
| OpenCode bridge status | — | — | Port / model / generating |
Phân biệt Opacity vs Style alpha
| Control | Tác động |
|---|---|
| Opacity | CSS cả window (mờ toàn shell) |
| Style alpha | Chỉ độ sáng/alpha particle style hiện tại |
| Particle intensity | Mật độ + strength field (token-driven) |
| Style | ID | Mô tả | Direction UI |
|---|---|---|---|
| Hyperspace | tunnel | Radial từ tâm, burst lúc start (default) | Ẩn (radial) |
| Signal | signal | Vòng sóng đồng tâm · ambient soft bloom | Ẩn (radial) |
| Classic | streaks | Streaks theo hướng | Hiện |
| Aurora | aurora | Cong, glow mềm | Hiện |
| Neon rain | rain | Mưa dọc, mật độ cao | Hiện (mặc định ↓) |
| Embers | embers | Tàn lửa bay lên, size to dần | Hiện (mặc định ↑) |
| Comet | comet | Ít particle, đuôi dài | Hiện |
| Spark | spark | Nổ ngắn từ nhiều điểm | Ẩn |
| Orbit | orbit | Vòng quanh tâm | Ẩn |
| Vortex | vortex | Xoáy bung ra | Ẩn |
| Datastream | datastream | Làn packet (data flow), soft bloom | Hiện (mặc định →) |
| Giai đoạn / sự kiện | Hiệu ứng |
|---|---|
| Start | Burst + intensity kick ~0.55s |
| 0 tokens (đang gen) | Idle shimmer / breath (field nhẹ hơn full peak) |
| Token tăng | Heartbeat intensity; Signal: ring có cooldown (không spam) |
| Nhiều session | Density + hue tint theo số gen concurrent |
| End | Completion bloom (ring ngắn) → fade → ẩn khi không còn session |
| Stuck session | Stale TTL ~90s → clear + có thể auto-hide |
Chỉ áp dụng style không ẩn motion (Classic, Aurora, Rain, Embers, Comet, Datastream).
Radial (không hiện direction): Hyperspace, Signal, Spark, Orbit, Vortex.
| Góc | Hướng |
|---|---|
| 270° | ↑ Lên |
| 0° | → Phải |
| 90° | ↓ Xuống |
| 180° | ← Trái |
Preset nút: ↑ Up / → Right / ↓ Down / ← Left.
Từ repo root (set PYTHONPATH hoặc cd vào root):
# Windows
cd C:\Work\Tool
py -3 -m opencode_bridge status
py -3 -m opencode_bridge enable
py -3 -m opencode_bridge disable
py -3 -m opencode_bridge run
py -3 -m opencode_bridge daemon# macOS
cd "$AGENT_TOOL_ROOT"
python3 -m opencode_bridge status
python3 -m opencode_bridge enable|disable|run|daemonProfile helpers:
| Windows (profile-snippet.ps1) | macOS (profile-snippet.zsh) |
|---|---|
| Get-AgentStatus | get-agent-status |
| Enable-AgentMonitor | enable-agent-monitor |
| Disable-AgentMonitor | disable-agent-monitor |
| Start-AgentOverlay | start-agent-overlay |
| oc | oc |
| Windows | macOS | Việc |
|---|---|---|
| oc.cmd / oc.ps1 | oc.sh | Health overlay → bridge run |
| start-overlay.ps1 | start-overlay.sh | Chỉ bật overlay |
| install-shim.ps1 | install-shim.sh | PATH shim |
| install-autostart.ps1 | install-autostart.sh | Login autostart |
| profile-snippet.ps1 | profile-snippet.zsh | Shell helpers |
| shim\opencode.cmd | shim/opencode | Intercept opencode |
| Biến | Ý nghĩa |
|---|---|
| AGENT_TOOL_ROOT | Root repo (chứa opencode_bridge, agent-overlay) |
| AGENT_BRIDGE_STATE | Thư mục state (mặc định $ROOT/.agent-bridge) |
| OPENCODE_CMD / OPENCODE_REAL | Binary OpenCode thật |
| OPENCODE_DB | Path SQLite OpenCode (override) |
| OPENCODE_DATA_DIR | Root data OpenCode (DB/logs parent; auto-detect XDG / LocalAppData) |
| OPENCODE_LOG_DIR | Thư mục *.log structured logs |
| TAURI_EVENT_URL | Mặc định http://127.0.0.1:9876/event |
| AGENT_OVERLAY_HEALTH | Mặc định http://127.0.0.1:9876/health |
| AGENT_OPENCODE_SHIM_DIR | Shim dir (strip khỏi PATH child process) |
| AGENT_BRIDGE_VERBOSE | 1 = log event ra stderr |
| AGENT_BRIDGE_FORCE_LOG_TAIL | 1 = force tail log sớm hơn |
Base: http://127.0.0.1:9876 (chỉ localhost)
| Endpoint | Method | Mô tả |
|---|---|---|
| /health | GET | Liveness |
| /event | POST | Nhận event từ monitor |
| /events | GET | Ring buffer event (diagnostics) |
Payload event:
{
"event": "generation_start",
"timestamp": "2026-07-16T00:00:00",
"data": {
"provider": "xai",
"model": "grok-4.5",
"session_id": "ses_xxx",
"bridge_pid": 12345
}
}| event | Hành vi overlay |
|---|---|
| generation_start | Track session (bridge_pid + session_id), show particles, không setFocus |
| tokens_update | Cập nhật tokens theo session; intensity = tổng active; bridge coalesce tick |
| generation_end | Kết thúc một session; ẩn window chỉ khi không còn session (fade ~0.9s+, min-visible) |
Token realtime: log INFO không còn emit tokens.* giữa stream. Bridge poll OpenCode SQLite (message + stream estimate + session delta) ~0.4s khi có session_id. Path: OPENCODE_DB hoặc $OPENCODE_DATA_DIR/opencode.db (mặc định ~/.local/share/opencode/…).
┌─────────────────────────────────────────────────────────┐
│ Agent Overlay (Tauri 2 + Svelte 5) │
│ • Tray + autostart + single-instance │
│ • HTTP 127.0.0.1:9876 (/health /event /events) │
│ • Canvas: 11 styles + reactive phases + multi-session │
└──────────────────────────▲──────────────────────────────┘
│ POST JSON (+ bridge_pid)
┌──────────────────────────┴──────────────────────────────┐
│ opencode_bridge (Python) │
│ • detect: stream start/end (legacy + OpenCode ≥1.15) │
│ • emit: HTTP (config cache, coalesce tokens) + jsonl │
│ • runner: TUI inherit + stderr + claimed log tail │
│ • log_claims / status.bridges[pid] (multi-process) │
│ • db_tokens: SQLite RO poll │
└──────────────────────────▲──────────────────────────────┘
│
shim (opencode.cmd | opencode) hoặc oc
(giữ cwd caller + PYTHONPATH)
│
OpenCode binary (TUI)
| Sai (cũ) | Đúng (hiện tại) |
|---|---|
| stdout=PIPE → OpenCode không vào UI | stdout/stdin inherit → TUI đầy đủ |
| print([EVENT]) đè chat | Không print console; log file + overlay panel |
| Binary mơ hồ / shim đệ quy | Ưu tiên binary thật; strip shim khỏi PATH child |
| cd tool root khi oc | Giữ cwd project + PYTHONPATH / AGENT_TOOL_ROOT |
Detect generation:
Multi-process:
python3 -m opencode_bridge disable # hoặc py -3 trên Windows
python3 -m opencode_bridge enableFile: $AGENT_TOOL_ROOT/.agent-bridge/monitoring.enabled (1 / 0).
| Thành phần | Portable? |
|---|---|
| opencode_bridge (Python) | Có — TOOL_ROOT từ env hoặc script/repo parent |
| Overlay UI (Svelte) | Có — build per OS |
| Tauri tray / transparent | Có — mac cần macOSPrivateApi (đã bật) |
| Install / launcher scripts | Tách: .ps1 Win · .sh mac · root script-relative |
| OpenCode data paths | OPENCODE_DATA_DIR / auto XDG + Windows LocalAppData candidates |
Tool/ (AGENT_TOOL_ROOT — script-relative hoặc env)
├── README.md / README-oc.md
├── public/ # demo media (README)
│ ├── demo.gif # Animation demo
│ ├── demo-1.png # Settings panel
│ └── demo-2.png # Generating particles
├── docs/ # GitHub Pages site
│ ├── index.html
│ ├── guide.html
│ ├── content.md
│ └── assets/
├── tests/ # test_detect, test_log_claim, test_session_keys
├── oc.cmd / oc.ps1 / oc.sh
├── start-overlay.ps1 / .bat / start-overlay.sh
├── install-shim.ps1 / install-shim.sh
├── install-autostart.ps1 / install-autostart.sh
├── profile-snippet.ps1 / profile-snippet.zsh
├── opencode_monitor.py
├── opencode_bridge/ # Python (cross-platform)
│ ├── config.py # paths, status, log claims, PID liveness
│ ├── runner.py # TUI + dual feed + claim log
│ ├── detect.py / emit.py / daemon.py / db_tokens.py
├── shim/
│ ├── opencode.cmd / opencode.ps1 # Windows
│ └── opencode # macOS / Linux
├── .agent-bridge/ # config, status, log_claims, last_events
└── agent-overlay/ # Tauri app
├── src/ # Svelte + particles
└── src-tauri/
| Triệu chứng | Cách xử |
|---|---|
| where/which opencode không ra shim | Chạy lại install-shim (.ps1 / .sh), mở terminal mới |
| Chỉ in path rồi thoát, không vào TUI | Binary thật trong config.json; không pipe stdout |
| Vào TUI nhưng chat bị đè [EVENT] | Quiet default; tắt AGENT_BRIDGE_VERBOSE |
| Generate nhưng không có particles | Health :9876; tray còn sống? enable monitoring? |
| Overlay không tự bật | start-overlay + install-autostart |
| Path OpenCode sai | Sửa opencode_cmd trong .agent-bridge/config.json |
| Python không chạy | Win: py -3; Mac: python3 |
| Hai instance overlay | Single-instance: lần 2 mở settings |
| Port 9876 bận | Tắt process overlay; hoặc đổi port (khớp URL monitor) |
| Mac: không tìm thấy .app | cd agent-overlay && npm run tauri build |
| Mac: transparent/tray lạ | Đã bật macOSPrivateApi; thử tauri dev log |
| Win/Mac: đổi UI nhưng bản cũ | npm run tauri build + Quit tray rồi mở lại release |
| Signal “không thấy” | Settings → chọn Signal (default vẫn Hyperspace) |
| 2 OpenCode · overlay ẩn sớm / lộn session | Cần bridge multi-session; xem log_claims.json + bridge_pid |
| Overlay kẹt sau gen | Tray Hide; stale session TTL ~90s; restart overlay |
| Log/token miss (đặc biệt Win) | OPENCODE_LOG_DIR / OPENCODE_DATA_DIR / OPENCODE_DB; AGENT_BRIDGE_VERBOSE=1 |
| oc mở sai project | Cập nhật shim/oc (giữ cwd); không cd tool root |
| Unit tests bridge | python3 -m tests.test_detect · test_log_claim · test_session_keys |
Invoke-RestMethod http://127.0.0.1:9876/health
Invoke-RestMethod http://127.0.0.1:9876/events
Get-Content $env:AGENT_TOOL_ROOT\.agent-bridge\last_events.jsonl -Tail 10
py -3 -m opencode_bridge statuscurl -s http://127.0.0.1:9876/health
tail -10 "$AGENT_TOOL_ROOT/.agent-bridge/last_events.jsonl"
python3 -m opencode_bridge status# Windows (từ repo root)
powershell -File .\install-shim.ps1 -Uninstall
powershell -File .\install-autostart.ps1 -Uninstall
# Tray → Quit
# Remove-Item -Recurse .\.agent-bridge# macOS
./install-shim.sh --uninstall
./install-autostart.sh --uninstall
# Tray → Quit
# rm -rf "$AGENT_TOOL_ROOT/.agent-bridge"Gỡ dòng source …/profile-snippet trong shell profile nếu đã thêm.
cd agent-overlay
npm install
npm run tauri dev # hot reload UI
npm run check
# Sau khi đổi particles/UI cho bản cài đặt:
npm run tauri build # rồi Quit tray + mở lại Agent Overlay.app / exe
# start-overlay ưu tiên release bundle — không hot-reload bản release| File | Việc |
|---|---|
| src/lib/particles/config.ts | Tunables WARP + reactive/signal |
| src/lib/particles/presets.ts | 11 styles + palette / softBloom |
| src/lib/particles/ParticleSystem.ts | Engine spawn/update/draw · phases · rings |
| src/lib/stores/generation.svelte.ts | activeSessions, style alpha, localStorage |
| src/lib/components/SettingsPanel.svelte | UI settings |
| src/lib/bridge/opencode.ts | Listen Tauri events · show/hide |
| src-tauri/src/event_server.rs | HTTP :9876 |
| opencode_bridge/* | detect / emit / runner / claims |
Chi tiết app: agent-overlay/README.md.
| Back | FazBrowse Home | New Git URL |