mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-28 21:03:34 +08:00
Negotiate the scheduler protocol from Home config and use it to gate Codex continuity through Home instead of a local plugin scheduler. Send transport-safe scheduler context with auth dispatch and propagate the returned selection ID through execution metadata and usage reporting, preserving scheduler completion feedback even when local statistics are disabled. Run pre-admission and pre-output 429 continuity gates with bounded cooldown waits for Home streaming and non-streaming execution, handle scheduler_rejected as a terminal pick failure preferring the last upstream error, and preserve the upstream attempt provider across retry-round errors.
29 lines
696 B
Go
29 lines
696 B
Go
package pluginhost
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/router-for-me/CLIProxyAPI/v8/sdk/pluginapi"
|
|
)
|
|
|
|
func TestExternalUsagePublicSurface(t *testing.T) {
|
|
var sink interface {
|
|
HasUsagePlugins() bool
|
|
HandleUsage(context.Context, pluginapi.UsageRecord) error
|
|
} = (*Host)(nil)
|
|
if sink.HasUsagePlugins() {
|
|
t.Fatal("nil host has usage plugins")
|
|
}
|
|
if errDelivery := sink.HandleUsage(t.Context(), pluginapi.UsageRecord{}); errDelivery != nil {
|
|
t.Fatal(errDelivery)
|
|
}
|
|
host := New()
|
|
if host.HasUsagePlugins() {
|
|
t.Fatal("empty host has usage plugins")
|
|
}
|
|
if errDelivery := host.HandleUsage(t.Context(), pluginapi.UsageRecord{}); errDelivery != nil {
|
|
t.Fatal(errDelivery)
|
|
}
|
|
}
|