Documentation
¶
Overview ¶
Package admin provides REST API endpoints for administrative operations.
Index ¶
- func RequireAdmin(auth Authenticator) func(http.Handler) http.Handler
- func RequirePersona(auth Authenticator) func(http.Handler) http.Handler
- type APICatalogStore
- type APIKeyAuthenticator
- type APIKeyManager
- type AuditMetricsQuerier
- type AuditQuerier
- type Authenticator
- type ConfigStore
- type ConnectionStore
- type Deps
- type EnrichmentEngine
- type EnrichmentStore
- type Handler
- type IndexJobsService
- type KnowledgeHandler
- func (h *KnowledgeHandler) GetChangeset(w http.ResponseWriter, r *http.Request)
- func (h *KnowledgeHandler) GetInsight(w http.ResponseWriter, r *http.Request)
- func (h *KnowledgeHandler) GetStats(w http.ResponseWriter, r *http.Request)
- func (h *KnowledgeHandler) ListChangesets(w http.ResponseWriter, r *http.Request)
- func (h *KnowledgeHandler) ListInsights(w http.ResponseWriter, r *http.Request)
- func (h *KnowledgeHandler) RollbackChangeset(w http.ResponseWriter, r *http.Request)
- func (h *KnowledgeHandler) UpdateInsight(w http.ResponseWriter, r *http.Request)
- func (h *KnowledgeHandler) UpdateInsightStatus(w http.ResponseWriter, r *http.Request)
- type NotificationHistory
- type OAuthKindHandler
- type OAuthKindHandlers
- type PersonaRegistry
- type PlatformAuthOption
- type PlatformAuthenticator
- type PromptInfoProvider
- type PromptRegistrar
- type ReloadNotifier
- type ToolActivityAggregate
- type ToolDetail
- type ToolPersonaAccess
- type ToolkitRegistry
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequireAdmin ¶
func RequireAdmin(auth Authenticator) func(http.Handler) http.Handler
RequireAdmin creates middleware that enforces admin authentication.
func RequirePersona ¶ added in v0.17.0
func RequirePersona(auth Authenticator) func(http.Handler) http.Handler
RequirePersona creates middleware that enforces authentication via an Authenticator (which already includes persona validation).
Types ¶
type APICatalogStore ¶ added in v1.61.5
type APICatalogStore = catalogapi.CatalogStore
APICatalogStore is the subset of apigateway/catalog.Store that the admin API needs. Aliased to the seam's declaration rather than restated so the two cannot drift; see internal/admin/catalogapi for the rationale behind depending on a narrowed interface instead of the concrete store.
type APIKeyAuthenticator ¶
APIKeyAuthenticator validates admin access via API keys.
func (*APIKeyAuthenticator) Authenticate ¶
func (a *APIKeyAuthenticator) Authenticate(r *http.Request) (*User, error)
Authenticate checks the X-API-Key or Authorization header.
type APIKeyManager ¶ added in v0.17.0
type APIKeyManager interface {
ListKeys() []auth.APIKeySummary
GenerateKey(def auth.APIKey) (string, error)
RemoveByName(name string) bool
}
APIKeyManager manages API keys at runtime.
type AuditMetricsQuerier ¶ added in v0.17.1
type AuditMetricsQuerier = auditapi.MetricsQuerier
AuditMetricsQuerier provides aggregate audit metrics. Aliased to the seam's declaration for the same reason.
type AuditQuerier ¶ added in v0.17.0
type AuditQuerier = auditapi.EventQuerier
AuditQuerier queries audit events. Aliased to the seam's declaration rather than restated so the two cannot drift.
type Authenticator ¶
Authenticator validates admin credentials.
type ConfigStore ¶ added in v0.17.0
type ConfigStore interface {
Get(ctx context.Context, key string) (*configstore.Entry, error)
Set(ctx context.Context, key, value, author string) error
Delete(ctx context.Context, key, author string) error
List(ctx context.Context) ([]configstore.Entry, error)
Changelog(ctx context.Context, limit, offset int) ([]configstore.ChangelogEntry, int, error)
Mode() string
}
ConfigStore abstracts configstore.Store for testability.
type ConnectionStore ¶ added in v1.48.0
type ConnectionStore interface {
List(ctx context.Context) ([]platform.ConnectionInstance, error)
Get(ctx context.Context, kind, name string) (*platform.ConnectionInstance, error)
Set(ctx context.Context, inst platform.ConnectionInstance) error
Delete(ctx context.Context, kind, name string) error
}
ConnectionStore abstracts platform.ConnectionStore for testability.
type Deps ¶ added in v0.17.0
type Deps struct {
Config *platform.Config
ConfigStore ConfigStore
FileDefaults map[string]string
PersonaRegistry PersonaRegistry
ToolkitRegistry ToolkitRegistry
ReloadNotifier ReloadNotifier
MCPServer *mcp.Server
AuditQuerier AuditQuerier
AuditMetricsQuerier AuditMetricsQuerier
Knowledge *KnowledgeHandler
APIKeyManager APIKeyManager
BrowserAuth *browsersession.Authenticator
DatabaseAvailable bool
PlatformTools []platform.ToolInfo
AssetStore portal.AssetStore
VersionStore portal.VersionStore
S3Client portal.S3Client
S3Bucket string
ConnectionStore ConnectionStore
ConnectionSources *platform.ConnectionSourceMap
ToolkitsConfig map[string]any
PersonaStore personastore.Store
APIKeyStore platform.APIKeyStore
// UserStore is the known-users directory (#614). nil disables the
// /api/v1/admin/users routes (no database configured).
UserStore user.Store
PromptStore prompt.Store
PromptRegistrar PromptRegistrar
PromptInfoProvider PromptInfoProvider
FilePersonaNames map[string]bool
EnrichmentStore EnrichmentStore
EnrichmentEngine EnrichmentEngine
// PKCEStore holds in-flight authorization_code+PKCE state between
// oauth-start and the callback. Required for the OAuth routes: there is
// no fallback, and oauth-start answers 503 when this is nil. Use a
// pkcestore.MemoryStore for single-replica deployments and a
// pkcestore.PostgresStore for HA, where oauth-start and the callback may
// land on different replicas.
PKCEStore pkcestore.Store
// ConnOAuthStore persists OAuth tokens for every connection kind
// in one shared table (migration 000039's connection_oauth_tokens).
// The unified connection OAuth handler reads and writes through
// this; toolkit Authenticators read through it on every outbound
// request. nil disables the unified OAuth routes.
ConnOAuthStore connoauth.Store
// OAuthKinds maps connection kind ("mcp", "api", future kinds) to
// the per-kind config extractor + post-auth side-effect hook. The
// unified handler dispatches on the {kind} path parameter through
// this registry. New connection kinds register here at startup —
// they do NOT add parallel handler files or token stores.
OAuthKinds OAuthKindHandlers
// AuthEvents writes the durable per-connection OAuth-lifecycle
// audit trail (connect, refresh, rotation, revocation, deletion).
// nil disables event writes — the admin endpoints still work; the
// History panel and "what killed my token at 17:54" diagnostics
// just won't have data. Set this when ConnOAuthStore is set; a
// platform with no DB has no place to write events anyway.
AuthEvents *authevents.Writer
// AuthEventStore is the read surface exposed via the History
// admin endpoint. Distinct from AuthEvents because writes are
// nil-safe (best-effort) while reads need a real implementation
// to return 200 instead of an empty list.
AuthEventStore authevents.Store
// APICatalogStore manages OpenAPI spec bundles referenced by
// api-kind connections via config.catalog_id. nil disables the
// /api/v1/admin/api-catalogs routes; connection saves still
// succeed but catalog_id is unvalidated. Wire this in lockstep
// with the apigateway toolkit's SetCatalogStore so admin writes
// and toolkit reads share one store.
APICatalogStore APICatalogStore
// Embedder is the embedding provider used by the api-catalog
// admin path to compute per-operation vectors at spec-upsert
// time. Nil disables the compute-and-store step: spec writes
// still succeed, but the api-gateway toolkit's semantic and
// hybrid ranking modes fall back to lexical until the operator
// wires an embedder and re-saves (or re-embeds) the spec.
Embedder embedding.Provider
// EmbedJobs is the Postgres-backed job queue for api-catalog
// embedding work. The admin handler enqueues jobs on every
// spec write, cancels them on spec/catalog delete (#998), and
// lets the worker / reconciler / reaper run the actual
// embedding pass off the request path. nil when the platform
// was built without a database; spec writes still succeed in
// that mode but no embeddings are persisted.
EmbedJobs catalogindex.Store
// IndexJobs is the cross-kind read + command surface for the admin
// Indexing dashboard (per-kind job-state counts, coverage, the job
// list / drill-down, and the manual re-index action). It serves
// every index_jobs consumer uniformly, so a new consumer gets
// dashboard visibility for free. nil when no queue is wired (no
// database or no configured embedding provider); the dashboard
// then renders a degraded empty state instead of an error.
IndexJobs IndexJobsService
// NotificationSettings persists the admin SMTP configuration (#631).
// nil disables the /api/v1/admin/settings/smtp routes.
NotificationSettings smtp.SettingsStore
// SendTestEmail delivers a test email through the stored SMTP
// settings. nil disables the test-email route.
SendTestEmail func(ctx context.Context, to string) error
// NotificationPrefs reads per-address notification preferences so the
// SMTP test-send UI can surface a target's opt-out state (#1022). nil
// disables the recipient-status route.
NotificationPrefs notification.PrefsStore
// ReviewQueueAlert persists the knowledge review-queue staleness alert
// threshold, cooldown, and recipients (#803). nil disables the
// /api/v1/admin/settings/review-queue-alert routes.
ReviewQueueAlert reviewalert.SettingsStore
// NotificationHistory reads the delivery history behind the admin
// Notifications tab: what was sent, what failed and why. nil disables
// the /api/v1/admin/notifications routes.
NotificationHistory NotificationHistory
// NotificationRetention is how long a resolved queue row survives, shown
// alongside the history so an admin reads it as a recent window rather
// than a complete record. Zero omits the claim.
NotificationRetention time.Duration
}
Deps holds dependencies for the admin handler.
type EnrichmentEngine ¶ added in v1.57.0
type EnrichmentEngine interface {
Sources() *enrichment.SourceRegistry
}
EnrichmentEngine is the admin-facing surface of an enrichment.Engine. Defined as a small interface here so tests don't need to construct a real Engine.
type EnrichmentStore ¶ added in v1.57.0
type EnrichmentStore interface {
List(ctx context.Context, connection, tool string, enabledOnly bool) ([]enrichment.Rule, error)
Get(ctx context.Context, id string) (*enrichment.Rule, error)
Create(ctx context.Context, r enrichment.Rule) (enrichment.Rule, error)
Update(ctx context.Context, r enrichment.Rule) (enrichment.Rule, error)
Delete(ctx context.Context, id string) error
}
EnrichmentStore abstracts enrichment.Store for the admin handler, so tests can swap in a stub without pulling in a real database.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides admin REST API endpoints.
func NewHandler ¶
NewHandler creates a new admin API handler.
type IndexJobsService ¶ added in v1.73.0
type IndexJobsService interface {
// Kinds returns every registered source kind, sorted.
Kinds() []string
// Counts returns the per-state job rollup for one source kind.
Counts(ctx context.Context, kind string) (*indexjobs.KindCounts, error)
// Coverage returns the indexed-vs-expected rollup for the kind, or
// nil when the kind reports no coverage. Returns
// indexjobs.ErrUnknownKind for an unregistered kind.
Coverage(ctx context.Context, kind string) (*indexjobs.Coverage, error)
// List returns jobs matching the filter, newest first. A zero-value
// SourceKind lists across every kind.
List(ctx context.Context, filter indexjobs.ListFilter) ([]indexjobs.Job, error)
// ActiveFailures returns the units with open (unresolved) failures,
// one entry per unit, most-recently-failed first. An empty kind
// lists across every kind, which the cross-kind triage panel relies
// on.
ActiveFailures(ctx context.Context, kind string, limit int) ([]indexjobs.FailedUnit, error)
// Reindex enqueues manual-retry jobs for the kind (a single unit
// when sourceID is set, every out-of-sync unit otherwise) and
// returns the source ids enqueued. Returns indexjobs.ErrUnknownKind
// for an unregistered kind.
Reindex(ctx context.Context, kind, sourceID string) ([]string, error)
// Resolve dismisses every open failure for the unit, the explicit
// fallback when a failure will never be superseded. Returns the
// number of failed rows resolved (zero is not an error).
Resolve(ctx context.Context, kind, sourceID string) (int, error)
}
IndexJobsService is the cross-kind index-jobs surface the admin Indexing dashboard consumes. Implemented by *indexjobs.Reporter over the shared queue store + kind registry; declared here so admin can mock it without depending on the queue's concrete types beyond its value structs.
type KnowledgeHandler ¶
type KnowledgeHandler struct {
// contains filtered or unexported fields
}
KnowledgeHandler provides admin REST endpoints for knowledge management.
func NewKnowledgeHandler ¶
func NewKnowledgeHandler( insightStore knowledge.InsightStore, changesetStore knowledge.ChangesetStore, writer knowledge.DataHubWriter, pageReverter knowledge.PageReverter, ) *KnowledgeHandler
NewKnowledgeHandler creates a new knowledge admin handler. pageReverter may be nil when knowledge pages are unavailable; rolling back a page promotion then returns a clear "not configured" error rather than mis-reverting.
func (*KnowledgeHandler) GetChangeset ¶
func (h *KnowledgeHandler) GetChangeset(w http.ResponseWriter, r *http.Request)
GetChangeset handles GET /api/v1/admin/knowledge/changesets/{id}.
@Summary Get changeset @Description Returns a single changeset by ID. @Tags Knowledge @Produce json @Param id path string true "Changeset ID" @Success 200 {object} knowledge.Changeset @Failure 404 {object} problemDetail @Security ApiKeyAuth @Security BearerAuth @Router /admin/knowledge/changesets/{id} [get]
func (*KnowledgeHandler) GetInsight ¶
func (h *KnowledgeHandler) GetInsight(w http.ResponseWriter, r *http.Request)
GetInsight handles GET /api/v1/admin/knowledge/insights/{id}.
@Summary Get insight @Description Returns a single insight by ID. @Tags Knowledge @Produce json @Param id path string true "Insight ID" @Success 200 {object} knowledge.Insight @Failure 404 {object} problemDetail @Security ApiKeyAuth @Security BearerAuth @Router /admin/knowledge/insights/{id} [get]
func (*KnowledgeHandler) GetStats ¶
func (h *KnowledgeHandler) GetStats(w http.ResponseWriter, r *http.Request)
GetStats handles GET /api/v1/admin/knowledge/insights/stats.
@Summary Get insight stats @Description Returns aggregated insight statistics by entity, category, confidence, and status. @Tags Knowledge @Produce json @Param status query string false "Filter by status" @Param category query string false "Filter by category" @Param entity_urn query string false "Filter by entity URN" @Param captured_by query string false "Filter by capturer" @Param confidence query string false "Filter by confidence level" @Param since query string false "Insights after this time (RFC 3339)" @Param until query string false "Insights before this time (RFC 3339)" @Success 200 {object} knowledge.InsightStats @Failure 500 {object} problemDetail @Security ApiKeyAuth @Security BearerAuth @Router /admin/knowledge/insights/stats [get]
func (*KnowledgeHandler) ListChangesets ¶
func (h *KnowledgeHandler) ListChangesets(w http.ResponseWriter, r *http.Request)
ListChangesets handles GET /api/v1/admin/knowledge/changesets.
@Summary List changesets @Description Returns paginated changesets with optional filtering. @Tags Knowledge @Produce json @Param entity_urn query string false "Filter by entity URN" @Param applied_by query string false "Filter by applier" @Param rolled_back query boolean false "Filter by rollback state" @Param since query string false "Changesets after this time (RFC 3339)" @Param until query string false "Changesets before this time (RFC 3339)" @Param page query integer false "Page number, 1-based (default: 1)" @Param per_page query integer false "Results per page (default: 20)" @Success 200 {object} changesetListResponse @Failure 500 {object} problemDetail @Security ApiKeyAuth @Security BearerAuth @Router /admin/knowledge/changesets [get]
func (*KnowledgeHandler) ListInsights ¶
func (h *KnowledgeHandler) ListInsights(w http.ResponseWriter, r *http.Request)
ListInsights handles GET /api/v1/admin/knowledge/insights.
@Summary List insights @Description Returns paginated insights with optional filtering. @Tags Knowledge @Produce json @Param status query string false "Filter by status" @Param category query string false "Filter by category" @Param entity_urn query string false "Filter by entity URN" @Param captured_by query string false "Filter by capturer" @Param confidence query string false "Filter by confidence level" @Param since query string false "Insights after this time (RFC 3339)" @Param until query string false "Insights before this time (RFC 3339)" @Param page query integer false "Page number, 1-based (default: 1)" @Param per_page query integer false "Results per page (default: 20)" @Param order query string false "Sort by created_at: 'oldest' for oldest-first, default newest-first" @Success 200 {object} insightListResponse @Failure 500 {object} problemDetail @Security ApiKeyAuth @Security BearerAuth @Router /admin/knowledge/insights [get]
func (*KnowledgeHandler) RollbackChangeset ¶
func (h *KnowledgeHandler) RollbackChangeset(w http.ResponseWriter, r *http.Request)
RollbackChangeset handles POST /api/v1/admin/knowledge/changesets/{id}/rollback.
@Summary Rollback changeset @Description Reverts the DataHub aspects a changeset mutated back to their pre-change @Description state, transitions the source insights to rolled_back, and marks the @Description changeset rolled back. Refused (409) when already rolled back or when a @Description newer changeset has since touched the same aspect, and (422) when the @Description changeset contains change types whose prior state was not captured. @Tags Knowledge @Produce json @Param id path string true "Changeset ID" @Success 200 {object} knowledge.RollbackResult @Failure 404 {object} problemDetail @Failure 409 {object} problemDetail @Failure 422 {object} problemDetail @Failure 500 {object} problemDetail @Security ApiKeyAuth @Security BearerAuth @Router /admin/knowledge/changesets/{id}/rollback [post]
func (*KnowledgeHandler) UpdateInsight ¶
func (h *KnowledgeHandler) UpdateInsight(w http.ResponseWriter, r *http.Request)
UpdateInsight handles PUT /api/v1/admin/knowledge/insights/{id}.
@Summary Update insight @Description Update insight text, category, or confidence. Cannot edit an applied insight. @Tags Knowledge @Accept json @Produce json @Param id path string true "Insight ID" @Param body body insightUpdateRequest true "Fields to update" @Success 200 {object} statusResponse @Failure 400 {object} problemDetail @Failure 404 {object} problemDetail @Failure 409 {object} problemDetail @Failure 500 {object} problemDetail @Security ApiKeyAuth @Security BearerAuth @Router /admin/knowledge/insights/{id} [put]
func (*KnowledgeHandler) UpdateInsightStatus ¶
func (h *KnowledgeHandler) UpdateInsightStatus(w http.ResponseWriter, r *http.Request)
UpdateInsightStatus handles PUT /api/v1/admin/knowledge/insights/{id}/status.
@Summary Update insight status @Description Approve or reject an insight. Status must be 'approved' or 'rejected'. @Tags Knowledge @Accept json @Produce json @Param id path string true "Insight ID" @Param body body statusUpdateRequest true "Status update" @Success 200 {object} statusResponse @Failure 400 {object} problemDetail @Failure 404 {object} problemDetail @Failure 409 {object} problemDetail @Failure 500 {object} problemDetail @Security ApiKeyAuth @Security BearerAuth @Router /admin/knowledge/insights/{id}/status [put]
type NotificationHistory ¶ added in v1.118.0
type NotificationHistory = notifyapi.HistoryStore
NotificationHistory reads the notification delivery history the admin monitoring surface lists. Aliased to the domain contract rather than restated so the two cannot drift.
type OAuthKindHandler ¶ added in v1.60.1
type OAuthKindHandler = connoauthapi.OAuthKindHandler
OAuthKindHandler adapts a kind-specific connection config to the shared connoauth flow. The platform registers one per kind (MCP gateway, HTTP API gateway, future kinds) at startup. Aliased to the seam's declaration rather than restated so the two cannot drift.
New connection kinds add support by implementing this interface (typically in their toolkit package) and registering it in Deps.OAuthKinds — they do NOT add a parallel handler file or a parallel token store.
type OAuthKindHandlers ¶ added in v1.60.1
type OAuthKindHandlers = connoauthapi.OAuthKindHandlers
OAuthKindHandlers is the registry shape passed via Deps, keyed by the kind string (e.g. connoauth.KindMCP). Keep keys aligned with the connection_kind values stored in connection_instances and connection_oauth_tokens.
type PersonaRegistry ¶ added in v0.17.0
type PersonaRegistry interface {
All() []*persona.Persona
Get(name string) (*persona.Persona, bool)
Register(p *persona.Persona) error
Unregister(name string) error
}
PersonaRegistry abstracts persona.Registry for testability.
type PlatformAuthOption ¶ added in v0.32.0
type PlatformAuthOption func(*PlatformAuthenticator)
PlatformAuthOption configures the PlatformAuthenticator.
func WithBrowserSessionAuth ¶ added in v0.32.0
func WithBrowserSessionAuth(ba *browsersession.Authenticator) PlatformAuthOption
WithBrowserSessionAuth adds cookie-based authentication.
type PlatformAuthenticator ¶ added in v0.17.0
type PlatformAuthenticator struct {
// contains filtered or unexported fields
}
PlatformAuthenticator wraps the platform's middleware.Authenticator chain for HTTP admin requests, validating that the resolved persona matches the configured admin persona.
func NewPlatformAuthenticator ¶ added in v0.17.0
func NewPlatformAuthenticator( auth middleware.Authenticator, adminPersona string, registry *persona.Registry, opts ...PlatformAuthOption, ) *PlatformAuthenticator
NewPlatformAuthenticator creates a PlatformAuthenticator that bridges the platform's MCP auth chain to HTTP admin requests.
func (*PlatformAuthenticator) Authenticate ¶ added in v0.17.0
func (pa *PlatformAuthenticator) Authenticate(r *http.Request) (*User, error)
Authenticate extracts credentials from the HTTP request, delegates to the platform authenticator, then checks that the resolved persona matches the admin persona. It checks browser session cookies first, then falls back to token-based authentication.
type PromptInfoProvider ¶ added in v1.51.0
type PromptInfoProvider interface {
AllPromptInfos() []registry.PromptInfo
}
PromptInfoProvider returns metadata about platform-registered prompts (auto, workflow, toolkit, custom config). These are system prompts not stored in the database.
type PromptRegistrar ¶ added in v1.51.0
type PromptRegistrar interface {
RegisterRuntimePrompt(p *prompt.Prompt)
UnregisterRuntimePrompt(name string)
}
PromptRegistrar registers/unregisters prompts with the live MCP server.
type ReloadNotifier ¶ added in v1.70.1
type ReloadNotifier interface {
PublishCatalogReload(catalogID string)
PublishConnectionReload(kind, name string, op platform.ConnectionReloadOp)
PublishPersonaReload()
PublishAPIKeyReload()
}
ReloadNotifier announces an admin-side configuration change to peer replicas so their in-memory state is rebuilt (issue #501). The handler reloads the local replica synchronously as before, then calls the matching method here to broadcast the change. Implemented by *platform.Platform; nil on single-replica or test setups, in which case the broadcast is skipped.
type ToolActivityAggregate ¶ added in v1.57.0
type ToolActivityAggregate struct {
WindowSeconds int64 `json:"window_seconds"`
CallCount int `json:"call_count"`
SuccessRate float64 `json:"success_rate"`
AvgDurationMs float64 `json:"avg_duration_ms"`
}
ToolActivityAggregate is the per-tool audit summary surfaced on the Activity tab. We use the existing Breakdown(by tool_name) aggregator rather than a new percentile query — Count, SuccessRate, and AvgDurationMS are what the breakdown returns natively.
type ToolDetail ¶ added in v1.57.0
type ToolDetail struct {
Name string `json:"name"`
Title string `json:"title,omitempty"`
Description string `json:"description"`
ToolkitKind string `json:"toolkit_kind"`
ToolkitName string `json:"toolkit_name,omitempty"`
Connection string `json:"connection,omitempty"`
// JSON Schema for the tool's input parameters.
InputSchema any `json:"input_schema,omitempty"`
// Persona allow/deny matrix — one entry per database-managed
// persona, with the matched pattern and source recorded.
Personas []ToolPersonaAccess `json:"personas"`
// HiddenByGlobalDeny is true when the platform-level tools.deny
// list matches this tool. GlobalDenyPattern is the matching glob.
HiddenByGlobalDeny bool `json:"hidden_by_global_deny"`
GlobalDenyPattern string `json:"global_deny_pattern,omitempty"`
// HiddenByPersona maps persona name → true for any persona where
// this tool is denied.
HiddenByPersona map[string]bool `json:"hidden_by_persona,omitempty"`
// Description-override status (populated when a
// tool.<name>.description config-entry exists).
DescriptionOverridden bool `json:"description_overridden"`
OverrideAuthor string `json:"override_author,omitempty"`
Activity *ToolActivityAggregate `json:"activity,omitempty"`
// Number of cross-enrichment rules attached to this tool. Only
// meaningful for proxied tools (kind=mcp); zero for native.
EnrichmentRuleCount int `json:"enrichment_rule_count"`
}
ToolDetail is the aggregating response for GET /api/v1/admin/tools/{name}. It joins data scattered across the registry, the description-override middleware, persona definitions, the gateway enrichment store, and the audit aggregator so the admin Tools page can render everything for a tool from a single round-trip.
type ToolPersonaAccess ¶ added in v1.57.0
type ToolPersonaAccess struct {
Persona string `json:"persona"`
Allowed bool `json:"allowed"`
MatchedPattern string `json:"matched_pattern,omitempty"`
Source persona.AccessSource `json:"source"`
ConnectionAllowed bool `json:"connection_allowed"`
}
ToolPersonaAccess records one persona's end-to-end decision for the tool.
Allowed reflects (tool allow/deny) AND (connection allow/deny). The MatchedPattern / Source fields describe the tool-rule decision; when the tool rule allows but the connection rule denies, ConnectionAllowed is false and Allowed is false — surfaced separately so operators can see both halves of the gate.
type ToolkitRegistry ¶ added in v0.17.0
type ToolkitRegistry interface {
All() []registry.Toolkit
AllTools() []string
GetToolkitForTool(toolName string) registry.ToolkitMatch
}
ToolkitRegistry abstracts registry.Registry for testability.
type User ¶
type User struct {
UserID string
Email string
Roles []string
// FromCookie is true when the user authenticated via a browser session
// cookie (as opposed to an API key / Bearer token). Cookie-authenticated
// requests are the only ones subject to CSRF enforcement, since the
// browser attaches the cookie automatically on cross-site requests.
FromCookie bool
}
User holds information about the authenticated admin user.
Source Files
¶
- assets.go
- audit.go
- authkey_handler.go
- catalog_handler.go
- config_handler.go
- connection_handler.go
- connection_oauth_handler.go
- decode.go
- embedding.go
- enrichment_handler.go
- gateway_handler.go
- handler.go
- indexjobs_handler.go
- knowledge.go
- middleware.go
- notifications.go
- persona_handler.go
- prompt_handler.go
- settings_handler.go
- system.go
- tools.go
- tools_detail.go
- user_handler.go