mirror of
https://gh-proxy.org/https://github.com/klinsmaya/CLIProxyAPI.git
synced 2026-11-09 18:06:50 +08:00
- Implemented command-line flag registration and execution for plugins with priority-based conflict resolution. - Enabled plugin-owned command-line flag execution and persistence of plugin-auth data. - Added new `Host` methods to support command-line capabilities, including flag normalization, validation, and execution state management. - Introduced unit tests to ensure coverage for command-line plugin functionality, including auth data persistence. - Updated configs to normalize plugins during initialization.
30 lines
888 B
Go
30 lines
888 B
Go
package synthesizer
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/router-for-me/CLIProxyAPI/v7/internal/config"
|
|
coreauth "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/auth"
|
|
"github.com/router-for-me/CLIProxyAPI/v7/sdk/pluginapi"
|
|
)
|
|
|
|
// PluginAuthParser parses auth JSON owned by plugin providers.
|
|
type PluginAuthParser interface {
|
|
ParseAuth(context.Context, pluginapi.AuthParseRequest) (*coreauth.Auth, bool, error)
|
|
}
|
|
|
|
// SynthesisContext provides the context needed for auth synthesis.
|
|
type SynthesisContext struct {
|
|
// Config is the current configuration
|
|
Config *config.Config
|
|
// AuthDir is the directory containing auth files
|
|
AuthDir string
|
|
// Now is the current time for timestamps
|
|
Now time.Time
|
|
// IDGenerator generates stable IDs for auth entries
|
|
IDGenerator *StableIDGenerator
|
|
// PluginAuthParser parses plugin-owned auth files
|
|
PluginAuthParser PluginAuthParser
|
|
}
|