Documentation
¶
Overview ¶
Package platform provides the main platform orchestration.
Index ¶
- type APIKeyAuthConfig
- type APIKeyDef
- type AuditConfig
- type AuthConfig
- type CacheConfig
- type Closer
- type Component
- type Config
- type DCRConfig
- type DatabaseConfig
- type InjectionConfig
- type Lifecycle
- func (l *Lifecycle) IsStarted() bool
- func (l *Lifecycle) OnStart(callback func(context.Context) error)
- func (l *Lifecycle) OnStop(callback func(context.Context) error)
- func (l *Lifecycle) RegisterCloser(c Closer)
- func (l *Lifecycle) RegisterComponent(c Component)
- func (l *Lifecycle) Start(ctx context.Context) error
- func (l *Lifecycle) Stop(ctx context.Context) error
- type OAuthClientConfig
- type OAuthConfig
- type OIDCAuthConfig
- type Option
- func WithAuditLogger(logger middleware.AuditLogger) Option
- func WithAuthenticator(auth middleware.Authenticator) Option
- func WithAuthorizer(authz middleware.Authorizer) Option
- func WithConfig(cfg *Config) Option
- func WithDB(db *sql.DB) Option
- func WithPersonaRegistry(reg *persona.Registry) Option
- func WithQueryProvider(provider query.Provider) Option
- func WithRuleEngine(engine *tuning.RuleEngine) Option
- func WithSemanticProvider(provider semantic.Provider) Option
- func WithStorageProvider(provider storage.Provider) Option
- func WithToolkitRegistry(reg *registry.Registry) Option
- type Options
- type PersonaDef
- type PersonasConfig
- type Platform
- func (p *Platform) Close() error
- func (p *Platform) Config() *Config
- func (p *Platform) MCPServer() *mcp.Server
- func (p *Platform) MiddlewareChain() *middleware.Chain
- func (p *Platform) OAuthServer() *oauth.Server
- func (p *Platform) PersonaRegistry() *persona.Registry
- func (p *Platform) QueryProvider() query.Provider
- func (p *Platform) RuleEngine() *tuning.RuleEngine
- func (p *Platform) SemanticProvider() semantic.Provider
- func (p *Platform) Start(ctx context.Context) error
- func (p *Platform) Stop(ctx context.Context) error
- func (p *Platform) StorageProvider() storage.Provider
- func (p *Platform) ToolkitRegistry() *registry.Registry
- type PromptsDef
- type QueryConfig
- type RoleMappingConfig
- type RulesConfig
- type SemanticConfig
- type ServerConfig
- type StorageConfig
- type TLSConfig
- type ToolRulesDef
- type TuningConfig
- type UpstreamIDPConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeyAuthConfig ¶
APIKeyAuthConfig configures API key authentication.
type APIKeyDef ¶
type APIKeyDef struct {
Key string `yaml:"key"`
Name string `yaml:"name"`
Roles []string `yaml:"roles"`
}
APIKeyDef defines an API key.
type AuditConfig ¶
type AuditConfig struct {
Enabled bool `yaml:"enabled"`
LogToolCalls bool `yaml:"log_tool_calls"`
RetentionDays int `yaml:"retention_days"`
}
AuditConfig configures audit logging.
type AuthConfig ¶
type AuthConfig struct {
OIDC OIDCAuthConfig `yaml:"oidc"`
APIKeys APIKeyAuthConfig `yaml:"api_keys"`
AllowAnonymous bool `yaml:"allow_anonymous"` // default: false
}
AuthConfig configures authentication.
type CacheConfig ¶
CacheConfig configures caching.
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"`
Auth AuthConfig `yaml:"auth"`
OAuth OAuthConfig `yaml:"oauth"`
Database DatabaseConfig `yaml:"database"`
Personas PersonasConfig `yaml:"personas"`
Toolkits map[string]any `yaml:"toolkits"`
Semantic SemanticConfig `yaml:"semantic"`
Query QueryConfig `yaml:"query"`
Storage StorageConfig `yaml:"storage"`
Injection InjectionConfig `yaml:"injection"`
Tuning TuningConfig `yaml:"tuning"`
Audit AuditConfig `yaml:"audit"`
}
Config holds the complete platform configuration.
func LoadConfig ¶
LoadConfig loads configuration from a file. The path is expected to come from command line arguments, controlled by the administrator.
type DCRConfig ¶
type DCRConfig struct {
Enabled bool `yaml:"enabled"`
AllowedRedirectPatterns []string `yaml:"allowed_redirect_patterns"`
}
DCRConfig configures Dynamic Client Registration.
type DatabaseConfig ¶
DatabaseConfig configures the database connection.
type InjectionConfig ¶
type InjectionConfig struct {
TrinoSemanticEnrichment bool `yaml:"trino_semantic_enrichment"`
DataHubQueryEnrichment bool `yaml:"datahub_query_enrichment"`
S3SemanticEnrichment bool `yaml:"s3_semantic_enrichment"`
DataHubStorageEnrichment bool `yaml:"datahub_storage_enrichment"`
}
InjectionConfig configures cross-injection.
type Lifecycle ¶
type Lifecycle struct {
// contains filtered or unexported fields
}
Lifecycle manages the startup and shutdown of platform components.
func (*Lifecycle) RegisterCloser ¶
RegisterCloser registers a closer to be closed on shutdown.
func (*Lifecycle) RegisterComponent ¶
RegisterComponent registers a component with the lifecycle.
type OAuthClientConfig ¶ added in v0.3.0
type OAuthClientConfig struct {
ID string `yaml:"id"`
Secret string `yaml:"secret"`
RedirectURIs []string `yaml:"redirect_uris"`
}
OAuthClientConfig defines a pre-registered OAuth client.
type OAuthConfig ¶
type OAuthConfig struct {
Enabled bool `yaml:"enabled"`
Issuer string `yaml:"issuer"`
Clients []OAuthClientConfig `yaml:"clients"`
DCR DCRConfig `yaml:"dcr"`
Upstream *UpstreamIDPConfig `yaml:"upstream,omitempty"`
}
OAuthConfig configures the OAuth server.
type OIDCAuthConfig ¶
type OIDCAuthConfig struct {
Enabled bool `yaml:"enabled"`
Issuer string `yaml:"issuer"`
ClientID string `yaml:"client_id"`
Audience string `yaml:"audience"`
RoleClaimPath string `yaml:"role_claim_path"`
RolePrefix string `yaml:"role_prefix"`
}
OIDCAuthConfig configures OIDC authentication.
type Option ¶
type Option func(*Options)
Option is a functional option for configuring the platform.
func WithAuditLogger ¶
func WithAuditLogger(logger middleware.AuditLogger) Option
WithAuditLogger sets the audit logger.
func WithAuthenticator ¶
func WithAuthenticator(auth middleware.Authenticator) Option
WithAuthenticator sets the authenticator.
func WithAuthorizer ¶
func WithAuthorizer(authz middleware.Authorizer) Option
WithAuthorizer sets the authorizer.
func WithPersonaRegistry ¶
WithPersonaRegistry sets the persona registry.
func WithQueryProvider ¶
WithQueryProvider sets the query provider.
func WithRuleEngine ¶
func WithRuleEngine(engine *tuning.RuleEngine) Option
WithRuleEngine sets the rule engine.
func WithSemanticProvider ¶
WithSemanticProvider sets the semantic provider.
func WithStorageProvider ¶
WithStorageProvider sets the storage provider.
func WithToolkitRegistry ¶
WithToolkitRegistry sets the toolkit registry.
type Options ¶
type Options struct {
// Config is the platform configuration.
Config *Config
// Database connection (optional, will be created from config if not provided).
DB *sql.DB
// SemanticProvider (optional, will be created from config if not provided).
SemanticProvider semantic.Provider
// QueryProvider (optional, will be created from config if not provided).
QueryProvider query.Provider
// StorageProvider (optional, will be created from config if not provided).
StorageProvider storage.Provider
// Authenticator (optional, will be created from config if not provided).
Authenticator middleware.Authenticator
// Authorizer (optional, will be created from config if not provided).
Authorizer middleware.Authorizer
// AuditLogger (optional, will be created from config if not provided).
AuditLogger middleware.AuditLogger
// PersonaRegistry (optional, will be created from config if not provided).
PersonaRegistry *persona.Registry
// ToolkitRegistry (optional, will be created if not provided).
ToolkitRegistry *registry.Registry
// RuleEngine (optional, will be created from config if not provided).
RuleEngine *tuning.RuleEngine
}
Options configures the platform.
type PersonaDef ¶
type PersonaDef struct {
DisplayName string `yaml:"display_name"`
Roles []string `yaml:"roles"`
Tools ToolRulesDef `yaml:"tools"`
Prompts PromptsDef `yaml:"prompts"`
Hints map[string]string `yaml:"hints,omitempty"`
}
PersonaDef defines a persona.
type PersonasConfig ¶
type PersonasConfig struct {
Definitions map[string]PersonaDef `yaml:",inline"`
DefaultPersona string `yaml:"default_persona"`
RoleMapping RoleMappingConfig `yaml:"role_mapping"`
}
PersonasConfig holds persona definitions.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform is the main platform facade.
func (*Platform) MiddlewareChain ¶
func (p *Platform) MiddlewareChain() *middleware.Chain
MiddlewareChain returns the middleware chain.
func (*Platform) OAuthServer ¶ added in v0.3.0
OAuthServer returns the OAuth server, or nil if not enabled.
func (*Platform) PersonaRegistry ¶
PersonaRegistry returns the persona registry.
func (*Platform) QueryProvider ¶
QueryProvider returns the query provider.
func (*Platform) RuleEngine ¶
func (p *Platform) RuleEngine() *tuning.RuleEngine
RuleEngine returns the rule engine.
func (*Platform) SemanticProvider ¶
SemanticProvider returns the semantic provider.
func (*Platform) StorageProvider ¶
StorageProvider returns the storage provider.
func (*Platform) ToolkitRegistry ¶
ToolkitRegistry returns the toolkit registry.
type PromptsDef ¶
type PromptsDef struct {
SystemPrefix string `yaml:"system_prefix,omitempty"`
}
PromptsDef defines prompt customizations.
type QueryConfig ¶
type QueryConfig struct {
Provider string `yaml:"provider"` // "trino", "noop"
Instance string `yaml:"instance"`
}
QueryConfig configures the query provider.
type RoleMappingConfig ¶
type RoleMappingConfig struct {
OIDCToPersona map[string]string `yaml:"oidc_to_persona"`
UserPersonas map[string]string `yaml:"user_personas"`
}
RoleMappingConfig configures role mapping.
type RulesConfig ¶
type RulesConfig struct {
RequireDataHubCheck bool `yaml:"require_datahub_check"`
WarnOnDeprecated bool `yaml:"warn_on_deprecated"`
QualityThreshold float64 `yaml:"quality_threshold"`
}
RulesConfig configures operational rules.
type SemanticConfig ¶
type SemanticConfig struct {
Provider string `yaml:"provider"` // "datahub", "noop"
Instance string `yaml:"instance"`
Cache CacheConfig `yaml:"cache"`
}
SemanticConfig configures the semantic layer.
type ServerConfig ¶
type ServerConfig struct {
Name string `yaml:"name"`
Transport string `yaml:"transport"` // "stdio", "sse", "http"
Address string `yaml:"address"`
TLS TLSConfig `yaml:"tls"`
}
ServerConfig configures the MCP server.
type StorageConfig ¶
type StorageConfig struct {
Provider string `yaml:"provider"` // "s3", "noop"
Instance string `yaml:"instance"`
}
StorageConfig configures the storage provider.
type TLSConfig ¶
type TLSConfig struct {
Enabled bool `yaml:"enabled"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
}
TLSConfig configures TLS.
type ToolRulesDef ¶
ToolRulesDef defines tool access rules.
type TuningConfig ¶
type TuningConfig struct {
Rules RulesConfig `yaml:"rules"`
PromptsDir string `yaml:"prompts_dir"`
}
TuningConfig configures AI tuning.
type UpstreamIDPConfig ¶ added in v0.3.0
type UpstreamIDPConfig struct {
Issuer string `yaml:"issuer"` // Keycloak issuer URL
ClientID string `yaml:"client_id"` // MCP Server's client ID in Keycloak
ClientSecret string `yaml:"client_secret"` // MCP Server's client secret
RedirectURI string `yaml:"redirect_uri"` // Callback URL (e.g., http://localhost:8080/oauth/callback)
}
UpstreamIDPConfig configures the upstream identity provider (e.g., Keycloak).