tuxevil-rotator 3.10.0 → 3.11.0

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [3.11.0] - 2026-10-03
6
+
7
+ ### Added
8
+
9
+ - **Automatic agent installation**: `install-agent` configures detected or selected OpenCode, Hermes, Pi, and Codex clients locally or over SSH. `install-opencode` installs the bundled discovery plugin, which reads `/v1/models` and adds model limits and capabilities to OpenCode.
10
+
11
+ ### Improved
12
+
13
+ - **OpenCode Zen request compatibility**: Requests use a consistent User-Agent and forward the authentic OpenCode session context upstream.
14
+
15
+ ### Changed
16
+
17
+ - Updated the locked `undici` dependency to `7.29.1`.
18
+
5
19
  ## [3.10.0] - 2026-09-28
6
20
 
7
21
  ### Added
package/README.md CHANGED
@@ -53,6 +53,7 @@ Originally built as a multi-account rotator for Google Antigravity. It now gener
53
53
 
54
54
  ## Current Model Update
55
55
 
56
+ - **v3.11.0: automatic agent setup and OpenCode model discovery**: Configure detected or selected agents locally or over SSH with `install-agent`; OpenCode can populate its model catalog from the rotator's live `/v1/models` endpoint. OpenCode Zen requests also forward the real session context and use a consistent User-Agent. ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v3.11.0))
56
57
  - **v3.10.0: Claude tools, account-flag diagnostics, and audio reliability**: Fixed Claude Opus 4.6 Thinking tool-schema errors; account verification reasons now persist and flow into anonymous telemetry with a protected recent-incidents dashboard; audio transcription and WebSocket streaming use active Antigravity accounts with Language Server fallback. ([Release notes](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v3.10.0); audio hardening in [PR #36](https://github.com/tuxevil/tuxevil-rotator/pull/36) by [@javargasm](https://github.com/javargasm))
57
58
  - **Rotator-Backed Audio Transcription and Live-Streaming Hardening**: Batch transcription and live WebSocket sessions use active Antigravity accounts with Language Server fallback after rotator errors and timeouts. Virtual-key scopes follow the executed model; live streams preserve segment order, echo Ping payloads, and avoid fallback after client cancellation. ([PR #36](https://github.com/tuxevil/tuxevil-rotator/pull/36) by [@javargasm](https://github.com/javargasm))
58
59
  - **OpenAI Codex GPT-6 catalog**: Added GPT-6 Astra, Sol, and Luna to the Codex options while keeping GPT-5.6 Sol, Terra, and Luna available. ([v3.9.0](https://github.com/tuxevil/tuxevil-rotator/releases/tag/v3.9.0))
@@ -220,6 +221,14 @@ Dashboard opens at `http://localhost:51200/dashboard`
220
221
 
221
222
  Point any OpenAI-compatible agent to `http://localhost:51200/v1` with API key `tuxevil` (or a [Virtual Key](docs/virtual-keys.md)):
222
223
 
224
+ You can configure supported local agents automatically with:
225
+
226
+ ```bash
227
+ tuxevil-rotator install-agent --target auto
228
+ ```
229
+
230
+ Use `--target all` or a comma-separated list (`opencode,hermes,pi,codex`) to choose clients. Add `--host <hostname> --user <ssh-user>` to configure them over SSH, or `--dry-run` to review the generated installer first. For OpenCode's live model catalog, use `tuxevil-rotator install-opencode`; see the [OpenCode integration guide](docs/integrations/opencode.md).
231
+
223
232
  | Agent | Guide |
224
233
  |-------|-------|
225
234
  | Pi | [docs/integrations/pi.md](docs/integrations/pi.md) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuxevil-rotator",
3
- "version": "3.10.0",
3
+ "version": "3.11.0",
4
4
  "description": "Multi-provider, multi-account AI proxy rotator with per-model routing, real-time quota tracking, and infringement detection (Google Antigravity, Ollama Cloud)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -4,6 +4,8 @@ export const OPENCODE_ZEN_BASE_URL = "https://opencode.ai/zen/v1";
4
4
  export const OPENCODE_ZEN_MODELS_URL = "https://opencode.ai/zen/v1/models";
5
5
  export const OPENCODE_ZEN_CHAT_URL = "https://opencode.ai/zen/v1/chat/completions";
6
6
  export const OPENCODE_ZEN_RESPONSES_URL = "https://opencode.ai/zen/v1/responses";
7
+ export const OPENCODE_ZEN_USER_AGENT =
8
+ "opencode/1.18.31 ai-sdk/provider-utils/4.0.23 runtime/bun/1.3.14";
7
9
 
8
10
  export const OPENCODE_ZEN_FREE_MODELS = [
9
11
  "big-pickle",
@@ -14,6 +14,7 @@ import {
14
14
  isOpenCodeZenResponsesModel,
15
15
  OPENCODE_ZEN_CHAT_URL,
16
16
  OPENCODE_ZEN_RESPONSES_URL,
17
+ OPENCODE_ZEN_USER_AGENT,
17
18
  } from "./catalog.js";
18
19
  import { isRecord } from "../../compat/schema-sanitizer.js";
19
20
  import type {
@@ -244,26 +245,28 @@ function buildOpenCodeZenHeaders(
244
245
  !HOP_BY_HOP.has(lower) &&
245
246
  lower !== "authorization" &&
246
247
  lower !== "content-type" &&
247
- lower !== "accept"
248
+ lower !== "accept" &&
249
+ lower !== "user-agent"
248
250
  ) {
249
251
  headers[key] = value;
250
252
  }
251
253
  }
252
254
 
253
- // OpenCode's free tier requires these context headers. Native OpenCode
254
- // emits them only for provider IDs beginning with `opencode`; the rotator
255
- // is commonly configured under a custom provider ID, so fill safe defaults.
256
- if (!headerValue(headers, "x-opencode-session")) {
257
- headers["x-opencode-session"] = `zen-session-${body.requestId || randomUUID()}`;
258
- }
259
- if (!headerValue(headers, "x-opencode-request")) {
260
- headers["x-opencode-request"] = `zen-request-${body.requestId || randomUUID()}`;
261
- }
262
- if (!headerValue(headers, "x-opencode-client")) {
263
- headers["x-opencode-client"] = "tuxevil-rotator";
264
- }
265
- if (!headerValue(headers, "user-agent")) {
266
- headers["User-Agent"] = "tuxevil-rotator/opencode-zen";
255
+ headers["User-Agent"] = OPENCODE_ZEN_USER_AGENT;
256
+
257
+ // OpenCode sends x-opencode-session directly for provider IDs beginning
258
+ // with `opencode`. For custom provider IDs it sends the same real session
259
+ // under x-session-affinity and X-Session-Id. Forward that value under the
260
+ // upstream's expected name only when the incoming User-Agent is OpenCode.
261
+ const userAgent = headerValue(originalHeaders, "user-agent");
262
+ if (
263
+ !headerValue(headers, "x-opencode-session") &&
264
+ userAgent?.toLowerCase().startsWith("opencode/")
265
+ ) {
266
+ const sessionId =
267
+ headerValue(headers, "x-session-affinity") ??
268
+ headerValue(headers, "x-session-id");
269
+ if (sessionId) headers["x-opencode-session"] = sessionId;
267
270
  }
268
271
 
269
272
  headers.Authorization = `Bearer ${getOpenCodeZenApiKey(account.config) ?? ""}`;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { createInterface } from "node:readline";
4
4
  import type { AccountConfig } from "../../types.js";
5
- import { OPENCODE_ZEN_MODELS_URL } from "./catalog.js";
5
+ import { OPENCODE_ZEN_MODELS_URL, OPENCODE_ZEN_USER_AGENT } from "./catalog.js";
6
6
  import { defaultAccountEmail, OPENCODE_ZEN_PROVIDER_ID } from "./credentials.js";
7
7
 
8
8
  function askQuestion(prompt: string): Promise<string> {
@@ -24,6 +24,7 @@ export async function validateApiKey(
24
24
  headers: {
25
25
  Authorization: `Bearer ${apiKey}`,
26
26
  Accept: "application/json",
27
+ "User-Agent": OPENCODE_ZEN_USER_AGENT,
27
28
  },
28
29
  });
29
30
 
@@ -4,7 +4,7 @@ import { fetchWithRetry } from "../../fetch-with-retry.js";
4
4
  import type { AccountRuntime, ModelQuota } from "../../types.js";
5
5
  import type { QuotaFetchContext } from "../adapter.js";
6
6
  import { getAccountProxyDispatcher } from "../proxy-dispatcher.js";
7
- import { OPENCODE_ZEN_MODELS_URL } from "./catalog.js";
7
+ import { OPENCODE_ZEN_MODELS_URL, OPENCODE_ZEN_USER_AGENT } from "./catalog.js";
8
8
  import { getOpenCodeZenApiKey, OPENCODE_ZEN_PROVIDER_ID } from "./credentials.js";
9
9
  import { sortQuotaPools } from "../registry.js";
10
10
 
@@ -21,6 +21,7 @@ export async function fetchOpenCodeZenQuota(
21
21
  headers: {
22
22
  Authorization: `Bearer ${apiKey}`,
23
23
  Accept: "application/json",
24
+ "User-Agent": OPENCODE_ZEN_USER_AGENT,
24
25
  },
25
26
  timeoutMs: 8000,
26
27
  dispatcher: getAccountProxyDispatcher(account, OPENCODE_ZEN_PROVIDER_ID),