Documentation
¶
Overview ¶
Package access stores validated, invocation-scoped generation access state.
Index ¶
- Variables
- func WithAuthenticated(ctx context.Context, info AuthenticatedInfo) (context.Context, error)
- func WithDirect(ctx context.Context, options ...DirectOption) context.Context
- type AuthenticatedInfo
- type DirectOption
- type GeneratedLicense
- type Mode
- type State
- func (s State) AccountType() (shared.AccountType, bool)
- func (s State) BillingAddOns() []shared.BillingAddOn
- func (s State) GeneratedLicense() GeneratedLicense
- func (s State) HasBillingAddOn(addOn shared.BillingAddOn) bool
- func (s State) Mode() Mode
- func (s State) TelemetryDisabled() bool
- func (s State) WorkspaceCreatedAt() *time.Time
- func (s State) WorkspaceID() (string, bool)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAuthenticatedInfo = errors.New("invalid authenticated generation access")
ErrInvalidAuthenticatedInfo indicates that authenticated state was incomplete or contained an unsupported value.
Functions ¶
func WithAuthenticated ¶
WithAuthenticated validates and records authenticated generation state. On validation failure it returns the original context unchanged.
func WithDirect ¶
func WithDirect(ctx context.Context, options ...DirectOption) context.Context
WithDirect records explicit direct generation. Direct output is always AGPL licensed; commercial output requires authenticated caller input.
Types ¶
type AuthenticatedInfo ¶
type AuthenticatedInfo struct {
AccountType shared.AccountType
BillingAddOns []shared.BillingAddOn
WorkspaceCreatedAt *time.Time
WorkspaceID string
TelemetryDisabled bool
GeneratedLicense GeneratedLicense
}
AuthenticatedInfo contains metadata already validated or decided by the authenticating caller. It does not contain credentials or entitlement rules.
type DirectOption ¶
type DirectOption interface {
// contains filtered or unexported methods
}
DirectOption configures explicit direct generation.
func DisableTelemetry ¶
func DisableTelemetry() DirectOption
DisableTelemetry explicitly opts direct generation out of usage telemetry.
type GeneratedLicense ¶
type GeneratedLicense string
GeneratedLicense identifies the license selected for generated output.
const ( GeneratedLicenseAGPL GeneratedLicense = "agpl" GeneratedLicenseCommercial GeneratedLicense = "commercial" )
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is immutable generation access state. Construct it with WithDirect or WithAuthenticated and retrieve it with StateFromContext.
func StateFromContext ¶
StateFromContext returns a defensive copy of the explicit access state.
func (State) AccountType ¶
func (s State) AccountType() (shared.AccountType, bool)
AccountType returns authenticated account metadata. Direct state has no account type.
func (State) BillingAddOns ¶
func (s State) BillingAddOns() []shared.BillingAddOn
BillingAddOns returns a defensive copy of authenticated billing add-ons.
func (State) GeneratedLicense ¶
func (s State) GeneratedLicense() GeneratedLicense
GeneratedLicense returns the caller-decided generated-output license.
func (State) HasBillingAddOn ¶
func (s State) HasBillingAddOn(addOn shared.BillingAddOn) bool
HasBillingAddOn checks authenticated billing add-ons without allocating a copy.
func (State) TelemetryDisabled ¶
TelemetryDisabled reports whether usage telemetry is disabled for this invocation.
func (State) WorkspaceCreatedAt ¶
WorkspaceCreatedAt returns a defensive copy of authenticated workspace metadata.
func (State) WorkspaceID ¶
WorkspaceID returns authenticated workspace identity. Direct state has no workspace ID.