ValheimCli
Experimental local CLI bridge: JSON status, loaded players and opt-in host self-teleport. Loopback only; no AI or arbitrary console commands. Windows Valheim 1.0.17 smoke-tested.
模組介紹 作者原文
ValheimCli
An experimental BepInEx plugin for a local command-line client. A shell-capable AI agent can call the client and parse JSON. No AI model or autonomous gameplay is bundled.
Version 0.1.0, MIT license. Windows Valheim 1.0.17 and Gale 1.23.1 were smoke-tested on 2026-10-10. Compilation references target Valheim 1.0.16. Other game versions/platforms and multiplayer behavior have not been verified in game.
What it does
- status: local player/world state, position, host and teleport permissions.
- players: currently loaded player objects, not the full server roster.
- teleport X Y Z --confirm: opt-in teleport of the local host's own living character.
Joining clients cannot teleport through this release, even if they are server admins. No admin grants, mining, building, combat, arbitrary console or shell commands, remote endpoint, world-file editing, or outbound AI connections.
Upgrading from the old name
This package replaces swear01-ValheimCliBridge. Uninstall the old package before installing ValheimCli; both contain the same bridge DLL. Keep your existing config and token private. The internal plugin name, DLL and configuration filenames still use ValheimCliBridge and are unchanged, so existing CLI commands continue to work.
Installation
Install this package and its BepInEx dependency with Gale, r2modman or Mod Manager, then launch the modded game. Only the computer running the CLI needs this bridge. It is a client game plugin; dedicated-server automation is not supported.
For manual installation, place ValheimCliBridge.dll in BepInEx/plugins/swear01-ValheimCliBridge/ in the game/profile. Exit the game before installing or replacing the DLL. Avoid installing two copies of the bridge.
The command-line client requires Node.js 22+ on the same computer as Valheim. Download valheim-agent-cli-0.1.0.tgz from GitHub Releases, then run:
npm install -g.\valheim-agent-cli-0.1.0.tgz
valheim status --profile "C:\path\to\your\profile"
valheim players --profile "C:\path\to\your\profile"
The CLI is distributed as a GitHub release tarball. Do not assume an npm registry release exists. Installing the CLI tarball has no install hooks; this mod package does not install Node.js or run npm for you.
On first game launch the bridge generates BepInEx/config/swear01.ValheimCliBridge.cfg and a random swear01.ValheimCliBridge.token. Keep the token local. Never share it or include it in exported profiles/modpacks. It inherits the profile folder's OS permissions; restrict that folder if other users share your computer.
Teleport permission
Teleport is off by default:
[Permissions]
AllowTeleport = false
With a configuration manager already installed, open F10 / Mods settings → Valheim CLI Bridge and toggle AllowTeleport. This permission updates immediately through the in-game UI. Alternatively, exit the game, edit the config, and relaunch. Bridge Enabled / Port changes require a restart.
valheim teleport 120 45 -230 --profile "C:\path\to\your\profile" --confirm
Coordinates are X, Y (height), Z. Use a known safe standing position in a test/backup world. Valid coordinate bounds do not guarantee safe ground. A state: "started" response is only the start of a teleport; query status afterward and check teleporting and actual position for arrival.
After a timeout or dropped connection, never automatically retry a write. Inspect the game state. Use --request-id to preserve an operation ID. Started or uncertain write IDs are retained until restart, up to 256; reusing one is rejected. Restart clears this history, so this is not persistent exactly-once delivery.
Connection and removal
The bridge listens only on 127.0.0.1:28761 and authenticates every request with the profile token. It exposes no LAN/Internet service. Do not forward the port. For a custom config Port, pass the same port via CLI --port.
If the CLI cannot connect, confirm the correct modded profile is running and the bridge loaded. A successful BepInEx load alone
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。
下面這些內容需要先安裝,否則該模組不會生效: