Logo Portal Expose

Portal Expose

Tổ chức
gosuda
portal-expose

Expose, preview, protect with x402 payments, or keep a local web app, static site, HTTP route set, or explicitly requested TCP/UDP service reachable through Portal, then verify the public endpoint and report its lifecycle. This is the app side of Portal, the same flow as the quick-start form on a relay website (install, run one portal expose command built from the app settings, open the public URL). Use when the user asks to deploy, publish, share, tunnel, expose, or connect a local app to Portal or to a specific relay, create a public preview, add a paid route, configure x402, needs an HTTPS URL on a phone or another device because a browser feature such as microphone, camera, geolocation, or PWA install refuses to work over a LAN http address, or wants a Go app to embed the Portal SDK. Do not use for deploying a Portal relay, generic cloud hosting, publishing this plugin, or reaching a service that someone else already published (portal-connect).

Tổng quan

Nhà phát hànhgosuda
Kho mãportal-tunnel
Tên kỹ năngportal-expose
Sao
288
Bản fork
30
Tệp đi kèm
6
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 6 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được gosuda công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Portal Expose trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/gosuda/portal-tunnel/tree/main/plugins/portal-deploy/skills/portal-expose
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/gosuda/portal-tunnel.git /tmp/portal-tunnel
mkdir -p .claude/skills
cp -r /tmp/portal-tunnel/plugins/portal-deploy/skills/portal-expose .claude/skills/portal-expose
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Portal Expose trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Portal Expose ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Portal Expose với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Expose an App with Portal

Portal publishes a service that is already running on the user's machine. It does not build the app or move it to a cloud host. Treat a successful tunnel as dependent on both the local app and the Portal process or agent remaining available. This is the app side of Portal: every relay website offers the same three steps (paste what to share, run one install-and-expose command built from the app settings, open the public URL), and this skill performs those steps for the app with verification around them. Any other program that reaches the published URL needs nothing from Portal.

Run the workflow in order. Open a reference only when that branch is taken: references/x402.md for a paid route, references/safety-and-verification.md for an authenticated, sensitive/high-risk, or non-HTTP service, references/game-hosting.md for a game server, references/portal-cli.md when choosing persistent-agent configuration or checking a flag, references/sdk-embed.md only for a Go app that should run the tunnel inside its own process. Use the installed portal CLI for flags.

Choose the Mode

Use the smallest mode that satisfies the request:

  • Temporary web preview: portal expose <target>.
  • Connect the app to a relay the user picked, as its website's quick start does: install Portal from the official GitHub installer if it is missing, then portal expose <target> --name <name> --relays <relay-url>, with --discovery=false when only that relay should carry the app.
  • Trusted static directory or HTML entry: portal expose --serve <path>.
  • Multiple local HTTP services under one URL: repeat --http-route.
  • Paid HTTP path: routed HTTP with an explicit x402 payment contract; never enable payment implicitly.
  • Durable tunnel that should survive terminal or login restarts: an explicit portal agent config and managed service.
  • Session-owned durable tunnel without an OS service: portal agent run --foreground.
  • Game server (Minecraft, Terraria, Palworld, or any dedicated game server): always start from references/game-hosting.md — raw TCP/UDP transport has different prerequisites and verification than HTTP.
  • Go app that should carry the tunnel in-process instead of running the CLI next to it: references/sdk-embed.md. The CLI stays the default even for Go; embedding is for users who ask for it.

Default to a temporary preview when the user says only "share", "preview", or "deploy locally". Do not install an OS service unless the user asks for a persistent, managed, or restart-surviving tunnel and accepts that portal agent run without --foreground installs a per-user launchd or systemd unit.

Workflow

1. Inspect the Project

  • Read the applicable repository instructions before running or changing anything.
  • Determine the app directory, start command, expected protocol, loopback target, and a meaningful health path.
  • Prefer declared scripts and documented ports over guessing from process lists.
  • Do not expose a port merely because it is listening. Tie it to the requested app.
  • If the project is already running, preserve its process. If it is not running and deployment was requested, start it with the project's normal command and retain the terminal/session handle.

Ask one concise question only when the target, desired lifetime, or transport cannot be discovered safely. An explicit request to deploy, publish, expose, tunnel, or share authorizes creating the public tunnel for the named app; it does not authorize exposing adjacent services.

For x402, do not guess the protected path, payment methods, amount, network, recipient, or network-specific asset. Collect any missing consequential value before building the command or config. Treat an omitted method list as charging every method on the route and confirm that scope when it was not explicit.

2. Verify the Local Service

  • Wait for the app's real readiness signal, not only for the process to exist.
  • Make a bounded local request to the selected target. For HTTP, record the URL and status. For TCP/UDP, use a protocol-appropriate check that does not mutate application data.
  • Stop before opening a tunnel if the local health check fails.
  • Warn and require explicit direction before exposing databases, container daemons, debug consoles, unauthenticated admin panels, or services containing sensitive data.
  • Before opening the tunnel, say that the public hostname is enumerable through each participating relay's GET /api/state unless the user asked for --hide, and that relays which enable their directory page show it there too.

3. Check Portal

  • Run portal version when portal is available.
  • If Portal is missing, present the official GitHub installer and request approval before running it because installation writes outside the project. A relay also serves an installer at <relay>/api/install.sh (install.ps1 on Windows), but the relay then supplies the script, the binary, and the checksum together, so nothing in that download is verified independently of the relay. Use it only when the user explicitly prefers it, and before running the installed binary compare its SHA-256 with the checksums.txt or .sha256 asset of the matching GitHub release, fetched from github.com rather than from the relay. Never run an installer from a relay the user did not choose or from a third-party URL.
  • Do not assume a hard-coded latest release or stale flags. Use the installed Portal version as the compatibility baseline.

4. Build the Command or Agent Config

  • Use loopback targets such as 127.0.0.1:<port> unless the project explicitly needs another address.
  • Use the user's requested name. Otherwise derive a DNS-label-safe name from the app and pass it explicitly, so the public URL https://<name>.<relay-host>/ is known before the tunnel starts; the relay website always emits --name for the same reason. --name applies only when the identity file is created. An existing --identity-path keeps its saved name and silently ignores the flag, so use one identity file per public name.
  • For portal expose, always pass an absolute --identity-path outside the repository. The CLI default is identity.json in the process working directory and that file contains private key material. For portal agent, omit identity_path so the agent stores identity under its state directory; if you set the field, use an absolute path outside the repository.
  • Never print or commit identity JSON, control tokens, facilitator tokens, or wallet secrets.
  • With a user-selected relay on portal expose, pass --relays <https-url> --discovery=false. In persistent mode those flags are not accepted on portal agent run; put relays = ["https://..."] and discovery = false on the [[tunnels]] entry instead.
  • Map the app's settings onto the command the way the relay quick-start form does: a port or host:port is the positional target; an http(s):// URL contributes its host and port; a directory or HTML file becomes --serve <path>; a thumbnail URL, description, tags, or owner that the app or user defines go to --thumbnail, --description, --tags, --owner, all of which are public metadata; a datagram service adds --udp, with --udp-addr when the UDP port differs from the target.
  • The MITM self-probe runs against every relay whose tenant TLS stack exports keying material. Without --ban-mitm / ban_mitm = true, a suspected TLS termination is only logged and the tunnel keeps serving; do not claim the default path blocks a relay. Add --ban-mitm only when the user wants fail-closed handling; it then refuses relays that cannot export keying material instead of serving unprotected. --cache opts out of the probe entirely because it deliberately lets the relay terminate TLS, and it cannot be combined with --ban-mitm.
  • Never add TCP, UDP, payment, --cache, --cache-ttl, or --overlay flags that the user did not request; --cache hands the relay the static files and browser TLS termination. Public metadata flags are fine when their values come from the app's own settings or from the user; do not invent them. --hide is the exception for listing: mention the default public listing, then add --hide or hide = true only when the user wants the tunnel unlisted.
  • For a paid route, follow references/x402.md. Keep payment policy on the smallest requested path, use an explicit network, and never place wallet or facilitator secrets in a command, log, committed file, or final response.

Before executing, show the exact public target and any important exposure consequence when it is not already obvious from the user's request.

5. Start and Observe the Tunnel

  • Run a temporary portal expose in a foreground PTY or managed long-running command session. Do not hide it behind an untracked nohup process.
  • For persistent mode, inspect any existing agent config and running service first. run, restart, and stop are service-wide: they affect every [[tunnels]] entry that the selected service owns. Reuse and merge the existing config when the same agent should keep other tunnels. An isolated second agent needs its own config, service_name, state_dir, and loopback control_addr. Changing only service_name still shares the default state directory and 127.0.0.1:4018. Do not stop or replace an agent that already owns unrelated tunnels.
  • Create or update only the selected agent config, then start it with portal agent run --config <path> after the user accepts OS-service installation (portal agent run requires the file to exist; it never creates one), or portal agent run --foreground --config <path> when the current session should own the process. --foreground opens the interactive dashboard when stdin and stdout are TTYs. Run that command in a non-TTY managed session so logs stay capturable and the TUI does not start.
  • Do not run portal agent dashboard. It is an interactive TUI. Give the user that command in the handoff.
  • Capture bounded output. Redact tokens, identity material, signed payloads, and credentials.
  • HTTP tunnels are ready on a log event with field public_url. The message still starts with service ready at. Relay https:// values in listener_relays / added_relays are not ready. Raw TCP/UDP tunnels log raw transport endpoints allocated with tcp_addr and/or udp_addr instead. Do not wait for an HTTPS URL on a raw transport. A later line starting relay no longer active for retracts a URL; re-verify before handoff if you see one.

6. Verify the Public Endpoint

  • Confirm the lease the way the relay website does: GET <relay>/api/state lists the hostname with ready > 0 once the tunnel can serve; ready at zero means registered but not yet connected.
  • For HTTP, make a bounded HTTPS request to every public URL being handed off. A deliberately authenticated app may return 401 or 403; explain that as reachable but protected. Treat unexpected 5xx, TLS errors, or a Portal error page as a failed deployment.
  • For each paid route, make an unpaid request with a protected method and require 402 Payment Required plus a payment-requirements header. Compare the returned network, asset, recipient, amount, and resource with the requested policy. Verify the method scope by requesting an intentionally unprotected method when one exists. Never spend funds merely to verify configuration.
  • For raw TCP or UDP, protocol-probe the allocated tcp_addr/udp_addr without mutating application data. A successful local port open is not enough.
  • When a browser-capable tool is available and the app has UI, load the primary page and check for an obvious render or runtime failure. Do not log in or submit data unless the user requested it.
  • Re-check the local health endpoint if the public request fails so the handoff distinguishes app failure from tunnel or relay failure.

7. Hand Off the Result

Report:

  • Deployment mode and exact local target.
  • Public URL or allocated raw endpoint, and the verified status.
  • Whether the tunnel is listed on public relays or hidden with --hide.
  • Whether MITM handling is detect-only or --ban-mitm.
  • For x402, the protected paths and methods, human amount, network, public recipient, facilitator mode, and whether the unpaid 402 challenge was verified. State explicitly when settlement was not tested.
  • The identity path and that it must stay out of version control.
  • The app and Portal process/session or OS-service ownership.
  • The exact stop or restart command, and whether that command affects other tunnels on the same agent.
  • Anything that remains temporary, unavailable, or unverified.

Do not call the result permanent when the local machine, app process, or foreground tunnel must remain running.

If Portal-specific friction materially affected the task, report one sanitized sentence (command, expected versus actual). Do not initiate GitHub feedback handling, write feedback files, or query extra relays unless the user explicitly requests that follow-up.

Loopback Relay Variant

Use this variant only when the user asks to expose through a relay running on this machine. The relay must already be running; the client never starts one. Do not consult or fall back to the public registry in this mode.

  • Run the client and the relay from the same Portal checkout or release. This pairing is for local development and test harnesses only; production users expose through their relay's public deployment. A mixed pair (for example an installed release against a worktree relay) can register hostnames the relay's SNI router never matches, and the tunnel can stall while the client retries.
  • Point the client at the relay's canonical SNI origin: portal expose <loopback-target> --name <name> --identity-path <absolute-path-outside-repo> --relays https://127.0.0.1:<sni-port> --discovery=false. When port 443 is unavailable, start the same-tree relay with relay-server --portal-url https://127.0.0.1:<port>; SNI_PORT follows the PORTAL_URL port, so pass --sni-port only when the bind port differs from the public one. The SNI router is the relay's single ingress: it serves the root host's Admin/API handler in-process.
  • Treat the tunnel as ready only when the log prints the line starting service ready at carrying public_url. Listener or added-relay https:// URLs in the same output describe relay listeners, not tenant readiness.
  • Verify the emitted public_url itself with one bounded request. *.localhost often resolves to ::1 first, so use curl -sk --ipv4 --connect-timeout 5 --max-time 15 -o /dev/null -w '%{http_code}' <public-url> and accept the app's real status (401 or 403 means reachable and protected).
  • Stop and report instead of improvising when a required fact is missing: no relay admin URL or port, no identity path outside the repository, or no service ready at line within a bounded wait. Do not substitute registry relays or start extra relays to unblock the run.

Failure Rules

  • Local app unhealthy: stop before exposing it and report the failing check.
  • Portal absent and installation not approved: provide the official command without executing it.
  • No ready public URL or allocated raw endpoint: keep the bounded diagnostic output and report the relay/tunnel failure.
  • Paid route returns anything other than the expected 402 challenge: do not describe it as protected or hand it off as ready. Stop only the tunnel created by this workflow, preserve bounded diagnostics, and report the policy mismatch.
  • MITM self-probe warning without --ban-mitm: report the warning and offer --ban-mitm; do not claim the relay was blocked. A self-probe timed out or self-probe failed line is not a detection; report passthrough as unverified.
  • Requested name unavailable: offer an auto-generated or alternative name; do not silently hijack another identity.
  • --name had no effect: the identity file already existed and supplied its saved name. Point --identity-path at a new file for a new name.
  • Existing agent owns other tunnels: do not stop or replace it to publish this app.
  • Cancellation: stop only processes started by this workflow, unless the user explicitly asks to stop an existing app or agent.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Portal Expose làm được gì?

Expose, preview, protect with x402 payments, or keep a local web app, static site, HTTP route set, or explicitly requested TCP/UDP service reachable through Portal, then verify the public endpoint and report its lifecycle. This is the app side of Portal, the same flow as the quick-start form on a relay website (install, run one portal expose command built from the app settings, open the public URL). Use when the user asks to deploy, publish, share, tunnel, expose, or connect a local app to Portal or to a specific relay, create a public preview, add a paid route, configure x402, needs an HTT...

Vì sao nên dùng Portal Expose trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Portal Expose là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Portal Expose trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/gosuda/portal-tunnel/tree/main/plugins/portal-deploy/skills/portal-expose. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Portal Expose?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Portal Expose với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Portal Expose với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Portal Expose có miễn phí không?

Có. Kỹ năng này được gosuda phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇