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
This commit is contained in:
Jason Xu committed 2026-11-05 12:09:28 +08:00
1 parent cee32f7047
commit 46eb13ea03
12 files changed
+215 -1416

No files matched your search

+28 -28
View File
@@ -136,25 +136,25 @@ type SecretView struct {
// masked, plus the listeners that are actually in effect and the fields whose
// change needs a restart.
type ConfigView struct {
Listen string `json:"listen"`
ServerKeys []SecretView `json:"server_keys"`
ZenKeys []SecretView `json:"zen_keys"`
GoKeys []SecretView `json:"go_keys"`
Anonymous bool `json:"anonymous"`
Warp config.WarpConfig `json:"warp"`
Listen string `json:"listen"`
ServerKeys []SecretView `json:"server_keys"`
ZenKeys []SecretView `json:"zen_keys"`
GoKeys []SecretView `json:"go_keys"`
Anonymous bool `json:"anonymous"`
Warp config.WarpConfig `json:"warp"`
Proxies []SecretView `json:"proxies"`
ProxyFile string `json:"proxyfile"`
ProxyBindings map[string]string `json:"proxy_bindings,omitempty"`
Upstream config.UpstreamConfig `json:"upstream"`
Retry config.RetryConfig `json:"retry"`
Models config.ModelsConfig `json:"models"`
Performance config.PerformanceConfig `json:"performance"`
Logging config.LoggingConfig `json:"logging"`
Prefer config.Tier `json:"prefer"`
Reasoning config.ReasoningConfig `json:"reasoning"`
WebUI WebUIView `json:"webui"`
Effective EffectiveView `json:"effective"`
Restart []string `json:"restart_required_fields,omitempty"`
Retry config.RetryConfig `json:"retry"`
Models config.ModelsConfig `json:"models"`
Performance config.PerformanceConfig `json:"performance"`
Logging config.LoggingConfig `json:"logging"`
Prefer config.Tier `json:"prefer"`
Reasoning config.ReasoningConfig `json:"reasoning"`
WebUI WebUIView `json:"webui"`
Effective EffectiveView `json:"effective"`
Restart []string `json:"restart_required_fields,omitempty"`
}
// EffectiveView is the set of listeners the running process actually bound,
@@ -185,21 +185,21 @@ type SecretInput struct {
// value or the ID of the existing one. The WebUI username and password are
// not changed here; they go through /api/account.
type ConfigUpdate struct {
Listen string `json:"listen"`
ServerKeys []SecretInput `json:"server_keys"`
ZenKeys []SecretInput `json:"zen_keys"`
GoKeys []SecretInput `json:"go_keys"`
Anonymous bool `json:"anonymous"`
Warp config.WarpConfig `json:"warp"`
Listen string `json:"listen"`
ServerKeys []SecretInput `json:"server_keys"`
ZenKeys []SecretInput `json:"zen_keys"`
GoKeys []SecretInput `json:"go_keys"`
Anonymous bool `json:"anonymous"`
Warp config.WarpConfig `json:"warp"`
Proxies []SecretInput `json:"proxies"`
ProxyFile string `json:"proxyfile"`
ProxyBindings map[string]string `json:"proxy_bindings,omitempty"`
Upstream config.UpstreamConfig `json:"upstream"`
Retry config.RetryConfig `json:"retry"`
Models config.ModelsConfig `json:"models"`
Performance config.PerformanceConfig `json:"performance"`
Logging config.LoggingConfig `json:"logging"`
Prefer config.Tier `json:"prefer"`
Retry config.RetryConfig `json:"retry"`
Models config.ModelsConfig `json:"models"`
Performance config.PerformanceConfig `json:"performance"`
Logging config.LoggingConfig `json:"logging"`
Prefer config.Tier `json:"prefer"`
// A pointer distinguishes an omitted field (legacy clients should keep the
// current reasoning configuration) from an explicit empty object (clear it).
Reasoning *config.ReasoningConfig `json:"reasoning,omitempty"`
@@ -255,8 +255,8 @@ func (a *Server) handlePutConfig(w http.ResponseWriter, r *http.Request) {
ServerKeyMetadata: current.ServerKeyMetadata,
Rotation: current.Rotation,
Listen: update.Listen, ServerKeys: serverKeys, ZenKeys: zenKeys, GoKeys: goKeys, Anonymous: update.Anonymous, Warp: update.Warp, Proxies: proxies, ProxyFile: update.ProxyFile,
ProxyBindings: proxyBindings,
Upstream: update.Upstream, Retry: update.Retry, Models: update.Models, Performance: update.Performance, Logging: update.Logging, Prefer: update.Prefer,
ProxyBindings: proxyBindings,
Upstream: update.Upstream, Retry: update.Retry, Models: update.Models, Performance: update.Performance, Logging: update.Logging, Prefer: update.Prefer,
Reasoning: reasoning,
WebUI: config.WebUIConfig{Enabled: update.WebUI.Enabled, Listen: update.WebUI.Listen, Username: current.WebUI.Username, PasswordHash: current.WebUI.PasswordHash, SessionTTLMinutes: update.WebUI.SessionTTLMinutes},
}