Documentation
¶
Overview ¶
Package providers owns provider metadata and explicitly requested HTTP work.
Index ¶
- Constants
- func AccountResourceEndpoint(authentication protocol.Authentication, value string) bool
- func Bundled() protocol.ConversationPresetsCatalog
- func BundledCatalogProvider(endpoint string) (string, error)
- func CatalogEfforts(model protocol.ConversationCatalogModel, api protocol.ConversationModelApi, ...) []protocol.Effort
- func CatalogModel(raw json.RawMessage) (protocol.ConversationCatalogModel, error)
- func CompleteChannelModel(provider protocol.ConversationProvider, model protocol.ConversationModel, ...) protocol.ConversationModel
- func CompleteModel(model protocol.ConversationModel, reference *protocol.ConversationCatalogModel, ...) protocol.ConversationModel
- func Discover(ctx context.Context, provider protocol.ConversationProvider, ...) (protocol.ConversationDiscoveryCatalog, error)
- func Endpoint(value string) (*url.URL, error)
- func Listing(partners protocol.ConversationPresetsCatalog, unavailable bool) protocol.ConversationPresetsListing
- func NormalizeScoreName(name string) string
- func OAuthFields(provider protocol.ConversationProvider) (map[string]string, error)
- func ParsePresets(raw []byte) (protocol.ConversationPresetsCatalog, error)
- func RecoveryAccountIdentity(grant AccountGrant) string
- func RecoveryAuthenticationTarget(provider protocol.ConversationProvider, target *AccountTarget, ...) string
- func RefreshAccountSpeed(provider protocol.ConversationProvider, model protocol.ConversationModel, ...) protocol.ConversationModel
- func ReservedHeader(name string) bool
- func ResolveScore(candidates []string, models []string, aliases map[string]string) *string
- func RouteAPI(protocolType protocol.ConversationPresetsProtocol) protocol.ConversationModelApi
- func RuntimeAccount(provider protocol.ConversationProvider, grant AccountGrant) (protocol.RuntimeCredential, error)
- func RuntimeAccountSecret(value protocol.RuntimeCredential) (*protocol.Secret, error)
- func RuntimeField(name string) bool
- func ValidateBinding(provider protocol.ConversationProvider) error
- func ValidateConfiguration(provider protocol.ConversationProvider) error
- func ValidateFeatures(api protocol.ConversationModelApi, model protocol.ConversationModel, ...) error
- func ValidatePolicy(policy protocol.ConversationPresetsRequestPolicy) error
- func ValidatePreset(preset protocol.ConversationPresetsPreset, builtin bool) error
- func ValidateSelection(provider protocol.ConversationProvider, config protocol.SessionConfig) error
- type AccountGrant
- func AccountHeaders(provider protocol.ConversationProvider, secret *protocol.Secret) (AccountGrant, http.Header, error)
- func AccountResourceHeaders(provider protocol.ConversationProvider, secret *protocol.Secret, target string) (AccountGrant, http.Header, error)
- func DecodeAccount(secret *protocol.Secret, authentication protocol.Authentication) (AccountGrant, error)
- type AccountRecord
- type AccountTarget
- type CatalogDownload
- type CatalogEntry
- type Directory
- type Prepared
- type ScoreEntry
- type ScoresDataset
- type ScoresDownload
- type Work
Constants ¶
const ( DefaultCopilotAgent = "GitHubCopilotChat/0.68.0" DefaultCopilotEditor = "vscode/1.140.0" DefaultCopilotEditorPlugin = "copilot-chat/0.68.0" )
Copilot's service identifies its editor client by these values.
const CatalogURL = "https://models.dev/api.json"
const DefaultCatalogVersion = "0.170.0"
DefaultCatalogVersion tracks the reviewed stable Codex release used to query the ChatGPT account's model catalog.
const DefaultClaudeAgent = "claude-cli/2.1.280 (external, cli)"
const LegacyCatalogVersion = "0.160.1"
Variables ¶
This section is empty.
Functions ¶
func AccountResourceEndpoint ¶
func AccountResourceEndpoint(authentication protocol.Authentication, value string) bool
func Bundled ¶
func Bundled() protocol.ConversationPresetsCatalog
func BundledCatalogProvider ¶
BundledCatalogProvider resolves an unambiguous catalog endpoint from the pinned snapshot independently of which model metadata snapshot is active.
func CatalogEfforts ¶
func CatalogEfforts(model protocol.ConversationCatalogModel, api protocol.ConversationModelApi, output uint32) []protocol.Effort
func CatalogModel ¶
func CatalogModel(raw json.RawMessage) (protocol.ConversationCatalogModel, error)
func CompleteChannelModel ¶
func CompleteChannelModel(provider protocol.ConversationProvider, model protocol.ConversationModel, reference *protocol.ConversationCatalogModel) protocol.ConversationModel
CompleteChannelModel adds the media capabilities of the specific channel.
func CompleteModel ¶
func CompleteModel(model protocol.ConversationModel, reference *protocol.ConversationCatalogModel, api protocol.ConversationModelApi) protocol.ConversationModel
CompleteModel resolves automatic metadata without replacing configured limits, explicit effort choices, user-chosen capability tags or a compaction override.
func Discover ¶
func Discover(ctx context.Context, provider protocol.ConversationProvider, secret *protocol.Secret) (protocol.ConversationDiscoveryCatalog, error)
func Listing ¶
func Listing(partners protocol.ConversationPresetsCatalog, unavailable bool) protocol.ConversationPresetsListing
func NormalizeScoreName ¶
func OAuthFields ¶
func OAuthFields(provider protocol.ConversationProvider) (map[string]string, error)
func ParsePresets ¶
func ParsePresets(raw []byte) (protocol.ConversationPresetsCatalog, error)
func RecoveryAccountIdentity ¶
func RecoveryAccountIdentity(grant AccountGrant) string
RecoveryAccountIdentity names only service-issued principal and workspace identifiers. Missing identifiers cannot be replaced by an email, a label or a token: those do not prove that a fresh login owns the original task.
func RecoveryAuthenticationTarget ¶
func RecoveryAuthenticationTarget(provider protocol.ConversationProvider, target *AccountTarget, grant AccountGrant) string
RecoveryAuthenticationTarget excludes installation-specific package digests while retaining the auth origin, flow and service/client target. The digest is an identity comparison, never an authorization or renewal credential.
func RefreshAccountSpeed ¶ added in v0.2.3
func RefreshAccountSpeed(provider protocol.ConversationProvider, model protocol.ConversationModel, discovered *protocol.ConversationDiscoveryCapabilities) protocol.ConversationModel
RefreshAccountSpeed applies the matched model's native OAuth service tiers without replacing other configured model capabilities.
func ReservedHeader ¶
ReservedHeader reports whether name is set only by the transport.
func ResolveScore ¶
func RouteAPI ¶
func RouteAPI(protocolType protocol.ConversationPresetsProtocol) protocol.ConversationModelApi
func RuntimeAccount ¶
func RuntimeAccount(provider protocol.ConversationProvider, grant AccountGrant) (protocol.RuntimeCredential, error)
RuntimeAccount exports only fields used to execute an already selected model. Plugin extras enter the projection only through declared header injections.
func RuntimeAccountSecret ¶
func RuntimeAccountSecret(value protocol.RuntimeCredential) (*protocol.Secret, error)
func RuntimeField ¶
func ValidateBinding ¶
func ValidateBinding(provider protocol.ConversationProvider) error
func ValidateConfiguration ¶
func ValidateConfiguration(provider protocol.ConversationProvider) error
func ValidateFeatures ¶
func ValidateFeatures(api protocol.ConversationModelApi, model protocol.ConversationModel, selected map[string]string) error
func ValidatePolicy ¶
func ValidatePolicy(policy protocol.ConversationPresetsRequestPolicy) error
func ValidatePreset ¶
func ValidatePreset(preset protocol.ConversationPresetsPreset, builtin bool) error
func ValidateSelection ¶
func ValidateSelection(provider protocol.ConversationProvider, config protocol.SessionConfig) error
Types ¶
type AccountGrant ¶
type AccountGrant struct {
Kind protocol.Authentication `json:"kind"`
Access string `json:"access,omitempty"`
IssuedAtMs *uint64 `json:"issued_at_ms,omitempty"`
Refresh string `json:"refresh,omitempty"`
ExpiresAtMs uint64 `json:"expires_at_ms,omitempty"`
EarliestRefreshAt *uint64 `json:"earliest_refresh_at,omitempty"`
AccountID *string `json:"account_id,omitempty"`
ClientID string `json:"client_id,omitempty"`
Subject string `json:"subject,omitempty"`
Email *string `json:"email,omitempty"`
IDToken string `json:"id_token,omitempty"`
Scopes []string `json:"scopes,omitempty"`
OrgID *string `json:"org_id,omitempty"`
OrgName *string `json:"org_name,omitempty"`
InstallationID *string `json:"installation_id,omitempty"`
Github string `json:"github,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Record *AccountRecord `json:"record,omitempty"`
RenewalPending bool `json:"renewal_pending"`
RenewalUncertain bool `json:"renewal_uncertain,omitempty"`
RenewalRejected bool `json:"renewal_rejected,omitempty"`
Runtime *protocol.RuntimeCredential `json:"runtime,omitempty"`
}
func AccountHeaders ¶
func AccountHeaders(provider protocol.ConversationProvider, secret *protocol.Secret) (AccountGrant, http.Header, error)
func AccountResourceHeaders ¶
func AccountResourceHeaders(provider protocol.ConversationProvider, secret *protocol.Secret, target string) (AccountGrant, http.Header, error)
func DecodeAccount ¶
func DecodeAccount(secret *protocol.Secret, authentication protocol.Authentication) (AccountGrant, error)
func (AccountGrant) Expiry ¶
func (grant AccountGrant) Expiry() *uint64
func (AccountGrant) Label ¶
func (grant AccountGrant) Label() *string
func (AccountGrant) RenewalAt ¶
func (grant AccountGrant) RenewalAt() *uint64
RenewalAt returns the next refresh time without inventing an unknown TTL. Legacy grants retain their former one-minute-before-expiry behavior.
func (AccountGrant) SameAccount ¶
func (grant AccountGrant) SameAccount(other AccountGrant) bool
func (AccountGrant) Secrets ¶
func (grant AccountGrant) Secrets() []protocol.Secret
type AccountRecord ¶
type AccountRecord struct {
Target AccountTarget `json:"target"`
Issued authorization.Issued `json:"issued"`
}
type AccountTarget ¶
type AccountTarget struct {
Provider protocol.ProviderID `json:"provider"`
Package protocol.PluginReference `json:"package"`
Origin protocol.ConversationConsentOrigin `json:"origin"`
Flow string `json:"flow"`
Endpoint string `json:"endpoint"`
Declaration protocol.PluginModelAuthDeclaration `json:"declaration"`
Fields map[string]string `json:"fields"`
}
func (AccountTarget) Matches ¶
func (target AccountTarget) Matches(current AccountTarget) bool
type CatalogDownload ¶
type CatalogDownload struct {
Entries []CatalogEntry
Bytes uint64
Providers uint32
Fault *protocol.Fault
// contains filtered or unexported fields
}
func BundledCatalog ¶
func BundledCatalog() (*CatalogDownload, error)
BundledCatalog provides the build's validated offline metadata snapshot. Its returned entries and bodies are shared and must not be modified.
func ParseCatalog ¶
func ParseCatalog(raw []byte) (*CatalogDownload, error)
type CatalogEntry ¶
type CatalogEntry struct {
Provider string
ID string
Body json.RawMessage
}
type Prepared ¶
type Prepared struct {
Provider *protocol.ConversationProvider
Output *protocol.Output
Catalog *CatalogDownload
Scores *ScoresDownload
ScoreRevision uint64
}
type ScoreEntry ¶
type ScoreEntry struct {
Model string
Effort string
Score protocol.ConversationCatalogScoresEffortScore
}
type ScoresDataset ¶
type ScoresDataset struct {
Batch string
PublishedAt string
Entries []ScoreEntry
Aliases map[string]string
}
func ParseScores ¶
func ParseScores(raw []byte) (*ScoresDataset, error)
type ScoresDownload ¶
type ScoresDownload struct {
Unchanged bool
Dataset *ScoresDataset
ETag *string
Fault *protocol.Fault
}