feat: align provider runtimes with cliproxyapi

This commit is contained in:
lpf
2026-03-12 17:57:00 +08:00
parent 1775b0ec86
commit 92fba9eb74
13 changed files with 5101 additions and 45 deletions

View File

@@ -65,6 +65,18 @@ type ResponsesCompactor interface {
BuildSummaryViaResponsesCompact(ctx context.Context, model string, existingSummary string, messages []Message, maxSummaryChars int) (string, error)
}
// TokenCounter is an optional capability for providers that expose a native
// token counting endpoint.
type TokenCounter interface {
CountTokens(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*UsageInfo, error)
}
// ExecutionSessionCloser is an optional capability for providers that keep
// reusable upstream execution sessions, such as websocket-backed Codex sessions.
type ExecutionSessionCloser interface {
CloseExecutionSession(sessionID string)
}
type ToolDefinition struct {
Type string `json:"type"`
Name string `json:"name,omitempty"`