Commit Graph
20 Commits
Author SHA1 Message Date
Jason Xu fc7744a509 fix(warp): add opt-in anonymous proxy fallback and retirement handling (#196) 2026-11-30 04:40:43 +08:00
Jason Xu fac8dd3d7c feat(stream): safely continue interrupted anonymous chat streams (#75) 2026-11-30 04:40:43 +08:00
Jason Xu 30d6c08a9c feat(logging): add safe hot-reloadable rotating file sink (#116) 2026-11-30 04:40:43 +08:00
Jason Xu 9b44a031ca feat(models): add collision-safe aliases and model echoes (#125) 2026-11-30 04:40:43 +08:00
Jason Xu a0fbd6b6cb feat(proxy): pin manual keys to direct routes (#113) 2026-11-30 04:40:43 +08:00
Jason Xu e2b2a7c281 refactor: harden gateway and document Go/Zen OAuth
Preserve Go and Zen OAuth routing while fixing authentication, secret redaction, streaming, transport, and configuration issues.

Refresh README and management guides in four languages while preserving sponsors, LinuxDo acknowledgements, and Linux/Docker quick start instructions.
2026-11-18 03:01:56 +08:00
Jason Xu 0d05fe9393 feat(admin): add bulk proxy management and opt-in anonymous access 2026-11-17 06:14:45 +08:00
Jason Xu 159d7fdf0f feat(go): add browser device OAuth subscription sign-in
Add WebUI device authorization, organization selection, persisted token refresh, and fail-closed official Go subscription routing. Preserve manual keys without PAYG fallback and keep OAuth quota unknown.

Validation: offline regression checks, go vet, JavaScript syntax, and Windows/Linux amd64 compilation passed. Live subscription authorization and inference are not yet verified.

Refs #168
2026-11-17 05:28:09 +08:00
Jason Xu 46eb13ea03 fix(gateway): restore the build after #169 and tidy the merged batch
#169 called anonymousNodes.CursorForOffset, warp.Pool.ReportWithRetryAfter and
warp.Pool.HasUntriedActive without defining them, so main did not compile.
Add the three methods: an attempt offset shifts the anonymous start node, a
longer Retry-After extends the egress cooldown, and HasUntriedActive matches
the pool's egress keys.

Also:
- rewrite title.go in house style: named limits, a prompt table, no issue
  numbers in comments, and a titleFallback helper shared by both lanes
- document the held-back tool-call helpers in protocol/stream.go
- gofmt internal/admin/server.go
- drop the _test.go files from #169, #170 and #171
2026-11-05 12:09:28 +08:00
NEKOMYAandNekomyaDev 6fbe12c4df feat(gateway): add optional per-key proxy binding with fail-closed routing (fixes #149) (#170)
- Allow operators to associate Zen and Go credentials with configured proxy
  routes via optional proxy_bindings in config.
- Keys are mapped to their 16-hex fingerprint during normalization so
  secrets are never stored twice or exposed in diagnostics.
- Bound credentials fail closed: when their assigned proxy becomes unavailable,
  they do not silently migrate to other proxies or fall back to direct egress.
- When an assigned proxy recovers, traffic resumes immediately without
  changing bindings.
- Removed or invalid proxy references fail config validation, leaving the
  previous running runtime untouched on failed reloads.
- Unbound configurations, anonymous routing, and session affinity continue
  to behave exactly as before.
- Note in config documentation that binding to a #pool proxy endpoint pins the
  transport route and does not guarantee a static public egress IP.
- Add unit and acceptance tests covering binding resolution, fail-closed isolation,
  persistence, and secret masking.

Co-authored-by: NekomyaDev <neko@nekomya.dev>
2026-11-05 11:41:44 +08:00
Jason Xu 58f56676ba feat(webui): theme toggle, paged ledger, working refresh status, and collapsed proxy chips
- Dark theme: an auto/light/dark cycle in the topbar, persisted per
  browser and applied before first paint by an inline head script; the
  dark palette moves behind data-theme so the runtime choice wins over
  the media query (#122).
- Request routing and upstream attempts tables are paged (50/100/200/500
  rows per page) instead of a hard last-100 cap, with translated pager
  controls (#122).
- Free-model refresh status now calls POST /api/models/probe, which
  marks every automatic model due and wakes the probe loop, then reloads
  the snapshot; the button re-probes instead of only rereading the cache
  (#122).
- The config page renders long key/proxy lists collapsed behind a
  100-chip cap with an expand toggle, so a large proxy pool no longer
  freezes the page (#146).
- New strings translated for en/vi/it; READMEs document the new
  admin endpoint.
2026-10-30 04:16:18 +08:00
Jason Xu 4438acb8e7 feat(egress): route free-model traffic through userspace WARP
Free-tier requests now optionally leave through a Cloudflare WARP tunnel that runs inside the gateway process: WireGuard over UDP plus a gVisor netstack, so no TUN device, root, NET_ADMIN, or route changes are needed. Adapted from github.com/sudogeeker/ai-route (MIT).

- warp.enabled/pool_size/stack in config, the WebUI, config.example.json and all READMEs; startup and hot reload fail closed when WARP cannot initialize.
- Anonymous lane, free-model Zen-key fallback, free-model probes and the anonymous catalog refresh send no proxy traffic while enabled; Go keys and paid models keep their proxies.
- Per-attempt leases feed 403/429 rotation and broken-tunnel failures back into the pool; /healthz and /api/monitor expose the pool state and readiness requires an active exit.
- errWARPUnavailable maps to a 503 warp_unavailable response.
2026-10-25 05:51:00 +08:00
Quheng DengandWengeLiu101 05874a5bf0 fix(webui): stop browsers serving a stale embedded UI after upgrade (#112)
The management UI is embedded in the binary (//go:embed) and served through
http.FileServerFS. Those responses carry no Cache-Control, and the embed FS
reports a zero modification time, so there is no Last-Modified or ETag either.
Browsers are therefore free to apply heuristic caching and keep an old
index.html/app.js/styles.css for hours.

That is invisible until the operator upgrades the binary: the new backend then
serves requests that the cached old frontend does not know about, so newly
added pages never appear (or the UI breaks) until the cache expires or the user
hard-refreshes.

Set Cache-Control: no-cache on the embedded assets so the browser always
revalidates. Revalidation is cheap against a local server, and it makes the UI
version follow the binary version, which is the invariant the embed implies.

Co-authored-by: WengeLiu101 <233876084+WengeLiu101@users.noreply.github.com>
2026-10-23 09:24:48 +08:00
Jason Xu 81ad2842c7 refactor: drop new prefixes, unify v1/v2 lane naming, audit comments
- Remove the new/New prefix from constructors; rename the colliding
  types semantically (ModelCatalog, RuntimeController, Metrics,
  LogBroker, Redactor, proxyTransports, upstreamNodes, ...).
- Unify upstream lane naming on v1 (/zen, OpenCode 1.x shape) and v2
  (/inference and /zen/go, 2.x CLI shape); add models.IsV1Upstream and
  drop the duplicated lane detection.
- Fix inaccurate, truncated and stale comments across all packages and
  document exported symbols plus non-obvious internals.
- Fix anthropicThinking passing "enabled"/"adaptive" through as an
  effort; derive the level from the budget instead.
- Delete dead code (identity.StableID, unused protocol decoders and
  stream parser wrappers).
- Export EffectiveListeners, rename modelsDev* metadata constants, and
  describe the metadata source as the OpenCode endpoint.
- Rename the forced-collapse log event to stream_collapse_failed and
  add an anonymous field.
- Correct the README upstream.zen default and add upstream.anonymous.
2026-10-19 03:46:09 +08:00
CheerC 1e2702f6e0 fix: preserve manual control of free models (#57)
Keep manually restored free models enabled until automatic control is selected.
Persist the control mode and expose an authenticated per-model toggle in the WebUI and admin API.
Preserve disable evidence, renew expired 24-hour retries after inconclusive probes, and keep mode changes idempotent.

Validation: local regression checks, go vet/build, formatting and WebUI syntax passed; all five GitHub Checks passed. Test files were removed after validation.

Closes #56
2026-10-08 22:12:40 +08:00
Jason Xu df119c48e4 发布准备:合入 #36、#46、#48、#49、#50、#53;修复 #42、#44、#51、#52,并添加 GPL-3.0-or-later。
保留 reasoning 配置,新增免费模型可用性探测 / 手动恢复、首 SSE 事件超时,元数据改用官方地址。按维护者要求,最终文件树排除测试文件。

验证:本地 Go 回归、go vet / build、Prettier、JS / shell 语法及独立实例管理端验收通过。
2026-10-07 19:55:34 +08:00
Jason Xu 31c35704be Merge pull request #36: model rotation, quotas and API key management 2026-10-07 19:37:30 +08:00
Jason Xu 683b7e9af0 feat: expose configurable reasoning effort 2026-09-21 14:34:00 +08:00
haverainlilili 3440273f43 feat: 新增模型轮转、额度看板和密钥管理 2026-09-21 10:18:21 +08:00
Jason Xu 46def7fedc refactor: organize Go packages and remove test files
Move the command to cmd/opencode2api and group production code into
configuration, gateway, protocol, model, admin, telemetry and helper packages.
Keep shared state private behind context, metrics and runtime interfaces.

Remove the requested test files and replace test-only CI jobs with vet/build
checks. Update Docker and release build paths, preserve version injection and
make the WebUI an explicit embedded asset package.

Add directory trees and source reading guides to both READMEs. Anchor binary
ignore rules so the command package is tracked.
2026-09-15 01:28:44 +08:00