Airsc miễn phí cho tất cả. Nếu nó giúp bạn, hãy ủng hộ $2–$20.

Ủng hộ
PluginCẩn thậnTự động trình duyệt & dữ liệu webDễ cho người mới

terminal-browser

zenbu-labs · zenbu-labs/terminal-browser

Terminal-browser là một plugin của Claude Code chạy trình duyệt đầy đủ bên trong terminal của bạn, cho phép các tác nhân AI tương tác với nội dung web trực tiếp trong môi trường mã hóa.

Một trình duyệt bên trong terminal của bạn

3.7k sao172Giấy phép: MITCập nhật 13 ngày trước0 lượt mở

Xem trước

▍

Bạn có thể làm gì với nó

  • Yêu cầu một tác nhân mã hóa AI duyệt tài liệu hoặc hướng dẫn trên một trang web trong cùng một tab terminal.
  • Cho phép một tác nhân tương tác với các ứng dụng web, điền biểu mẫu hoặc trích xuất dữ liệu từ các trang web.
  • Xem xét các kế hoạch HTML do tác nhân tạo ra bằng cách tự động mở chúng trong một khung chia đôi bên cạnh đầu ra của tác nhân.

Kiểm tra an toàn

Cẩn thận

Dùng được, nhưng nên đọc ghi chú trước.

  • ●Gói npm tự chạy script khi cài đặt.package.json
  • ●Trình cài đặt tải script từ xa và chạy thẳng bằng shell.README.md

Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.

Trích từ README

terminal-browser

A real browser that runs inside your terminal

Installation

curl (macOS & Linux):

curl -fsSL https://terminal-browser.sh/install | bash

Note: Run terminal-browser upgrade to upgrade versions

Homebrew (macOS & Linux):

brew install terminal-browser

Windows

To install on Windows you must be using WSL. Terminals with kitty graphics support are also very limited on Windows, the following are terminals I have tested that terminal-browser will work on inside Windows:

curl -fsSL https://terminal-browser.sh/install | bash

Claude code plugin

Install instructions here

Usage

terminal-browser # launches the browser
terminal-browser open <url> # opens the browser at a url
terminal-browser --split right # opens the browser in a split pane to the right
terminal-browser open --ssh <user@host> <url> # performs all network requests through a remote server
terminal-browser open --transparent <url> # the terminal background will show through pages without a background color
terminal-browser ls # lists open browsers
terminal-browser action # an agent-browser compatible cli for interacting with open terminal-browsers
terminal-browser upgrade # upgrade to the latest version

Use cases:

  • You can have a coding agent and website scoped to the same terminal tab
  • Your agent has full access to interact with open terminal-browsers, which gives your agent the capability to use the web
  • You can ask an agent to make HTML plans and then open them inside terminal-browser, which will automatically open in a split pane next to your agent
  • terminal-browser works over SSH, which allows you to preview websites running on remote machines easily

Shortcuts

ActionmacOSLinux
Quitctrl+q or ctrl+cctrl+q
New tabcmd+tctrl+t
Edit URLcmd+lctrl+l
Command palettecmd+pctrl+k or alt+k
Find in pagecmd+shift+fctrl+shift+f
Next / previous matchenter / shift+enterenter / shift+enter
Reloadcmd+rctrl+r
Back / forwardcmd+[ / cmd+] or ctrl+[ / ctrl+]ctrl+[ / ctrl+]
Zoom in / out / resetyour terminal's zoom keybindyour terminal's zoom keybind
Devtoolscmd+shift+i or f12ctrl+shift+i or f12
Devtools consolecmd+alt+jctrl+alt+j
Copy / paste / cutcmd+c / cmd+v / cmd+xctrl+c / ctrl+v / ctrl+x
Record page (start/stop)ctrl+rctrl+shift+r
Complete recording reviewctrl+enterctrl+enter
Start element selection (send to agent)ctrl+gctrl+g
Close popup / overlayescapeescape

How does it work?

Terminals that support the kitty graphics protocol, including ghostty, kitty, cmux, vscode and many more, allow a program running in a terminal to display pixels in your terminal. We use this capability to display pixels generated by chromium.

We use electrons offscreen rendering API to read pixels generated by chromium directly from the GPU. Any time a website visually changes, terminal-browser only sends small patches to the terminal that cover changed regions. These choices allows terminal-browser to render smoothly without dropping any frames.

After the browser engine starts and is displaying pixels in the terminal, it needs to be able to read user input for websites to actually work. terminal-browser listens to mouse clicks, mouse position, and keyboard events from the terminal, and then sends synthetic events to chromium based on that data. For any user input events that are not retrievable from the terminal, we read directly from the operating system using a background swift app to listen for input events (non intrusively). This is what allows terminal-browser to implement smooth scrolling, and listen to trackpad events (websites with infinite canvases work great inside terminal-browser!)

The outer UI of the browser is implemented using a graphics engine built on top of rust. The actual UI is defined inside react with a custom react renderer, which allows us to build the UI for the browser using typescript. The UI of the outer browser and the browser content itself is all drawn to the same shared canvas inside the rust engine, which allows us to layer UI on top of the browser.

The underlying logic described here has been abstracted into a javascript library that you can use to build your own graphical applications in the terminal - pixel

SSH

The recommended way to use terminal-browser over ssh is running terminal-browser --ssh <ssh arguments>.

The alternative is running terminal-browser directly on the machine you are shh'd into. This will work, but:

  • requires every single frame drawn by the website to be sent over the network
  • all user input must be sent over the network before a website can react
  • misses out some extra optimizations

terminal-browser --ssh improves on this by running the website on your local device, and simply proxying all network requests made by the browser via the remote machine over ssh. This means you can load any website running on localhost of the remote machine on your local device.

Embedded mode

terminal-browser supports embedding inside of existing TUIs. See examples/embedded for a reference implementation

Telemetry

terminal-browser collects psuedo-anonymous usage events that gives me the ability to see how many people are using the project, which is extremely helpful information for improving the project.

telemetry can be disabled by any of the following:

  • DO_NOT_TRACK=1
  • TERMINAL_BROWSER_NO_TELEMETRY=1
  • disabling via the settings GUI in general
  • terminal-browser config set te
Xem mã nguồn trên GitHub