Documentation
¶
Overview ¶
Package types defines public extension points shared by registry components and external integrations.
Index ¶
- Constants
- Variables
- func DefaultApplyFingerprint(ctx context.Context, in ApplyInput, opts ApplyFingerprintOptions) (string, error)
- type Admission
- type AdmissionInput
- type AdmissionResult
- type AppOptions
- type ApplyDependencySnapshot
- type ApplyFingerprintOptions
- type ApplyFingerprintResult
- type ApplyInput
- type ApplyResult
- type Auditor
- type AuthorizeInput
- type Authorizer
- type CLITokenProvider
- type CLITokenProviderFactory
- type DatabaseFactory
- type DeleteAdmission
- type DeleteAdmissionInput
- type DeleteAdmissionResult
- type DeploymentAdapter
- type DeploymentDesiredFingerprinter
- type DeploymentDiscoverySource
- type DiscoverInput
- type DiscoveryResult
- type EmptyResponse
- type HTTPServerFactory
- type ListFilter
- type LogLine
- type LogsInput
- type PostDelete
- type PostUpsert
- type Prepare
- type RemoveInput
- type RemoveResult
- type ResourceRouteContext
- type Response
- type RuntimeAdapter
- type Server
Constants ¶
const ( DefaultNPMRunnerImage = "node:24-alpine3.21" DefaultPyPIRunnerImage = "ghcr.io/astral-sh/uv:debian" )
Default runner image refs for non-OCI MCPPackage origins. Exported so out-of-tree consumers reuse the same values rather than maintaining a parallel copy.
const ( AdmissionSourceApply = "apply" AdmissionSourceDelete = "delete" AdmissionSourceImport = "import" )
Variables ¶
var ErrCLINoStoredToken = errors.New("no stored authentication token")
ErrCLINoStoredToken is returned when no stored authentication token is found. This is expected for CLI commands that do not require authentication (e.g. `arctl init`).
var ErrNoOIDCDefined = errors.New("OIDC is not defined")
ErrNoOIDCDefined is returned when OIDC is not defined. This is expected for CLI commands that do not require authentication (e.g. `arctl init`) when the user/extension has not configured OIDC.
Functions ¶
func DefaultApplyFingerprint ¶ added in v0.4.0
func DefaultApplyFingerprint(ctx context.Context, in ApplyInput, opts ApplyFingerprintOptions) (string, error)
DefaultApplyFingerprint returns a deterministic fingerprint of the resolved desired apply input. It intentionally excludes status, labels, annotations, finalizers, timestamps, and other controller bookkeeping. The fingerprint is based on declared intent, not remote drift; for example, a Deployment that names a git branch without a commit SHA keeps the same fingerprint as that branch's HEAD moves, and operators should change the spec or use the controller force token when they want a rebuild from the new HEAD.
Types ¶
type Admission ¶ added in v0.4.0
type Admission func(ctx context.Context, in AdmissionInput) (AdmissionResult, error)
Admission owns the final write decision for an apply request after authz, validation, reference resolution, and registry checks have passed. The OSS default writes to production; downstream integrations can wrap that behavior to stage, reject, or otherwise route the write.
TODO(controller): this belongs to the synchronous handler architecture. Prefer a reconciler-owned admission/staging model and delete this bridge once no downstream route depends on it.
type AdmissionInput ¶ added in v0.4.0
type AdmissionResult ¶ added in v0.4.0
type AppOptions ¶
type AppOptions struct {
// OpenAPISchemaNamer overrides Huma's default schema naming function.
// Use this when an application exposes same-named Go types from different
// packages; Huma's default namer omits package paths and panics on those
// collisions. Nil preserves Huma's default schema names.
OpenAPISchemaNamer func(reflect.Type, string) string
// DatabaseFactory is an optional function to create a database that
// adds new functionality. The factory receives the base database and
// can run additional migrations. If nil, uses the default PostgreSQL
// database.
DatabaseFactory DatabaseFactory
// SkipMigrations skips the server's startup OSS migrator (the
// v1alpha1 migration set inside internaldb.NewPostgreSQL) so the
// server boots against a schema that was already migrated by
// `arctl db migrate up` (typically from CI/CD ahead of the
// rollout). DatabaseFactory-supplied migrators are NOT
// automatically skipped — downstream factories that run their own
// migrations should consult this same flag (e.g. via closure
// capture from AppOptions construction) to honor the operator's
// intent. Wins over the SKIP_MIGRATIONS env var when set true.
SkipMigrations bool
// RuntimeAdapters registers per-type PostUpsert/PostDelete
// hooks for the KindRuntime resource handler, keyed by the
// lowercase canonical Runtime.Spec.Type ("bedrockagentcore",
// "geminiagentruntime", "kagent", ...). Used by downstream builds
// to mirror Runtime apply/delete into a type-specific sidecar
// table. Missing types = no sidecar reconciliation for that type
// — the v1alpha1 Runtime row still persists.
RuntimeAdapters map[string]RuntimeAdapter
// DeploymentAdapters registers v1alpha1 DeploymentAdapter
// implementations keyed by lowercase Runtime.Spec.Type ("local",
// "kubernetes", ...). The Deployment controller and adjacent adapter
// resolver look up by the type string; downstream builds inject
// additional adapters here.
DeploymentAdapters map[string]DeploymentAdapter
// DeploymentDependencyKinds registers additional resource kinds whose
// durable control-plane events may change a Deployment's desired inputs.
// The Deployment controller requeues current Deployments for these events;
// its apply fingerprint still suppresses unchanged adapter work.
DeploymentDependencyKinds map[string]bool
// Authorizers gates every read + write operation on the
// generic v1alpha1 resource handler, keyed by canonical Kind name
// (v1alpha1.KindAgent, v1alpha1.KindMCPServer, etc.). Downstream
// builds wire their RBAC engine here so reader / publisher / admin
// gates fire on the OSS-registered Agent / MCPServer / Skill /
// Prompt / Runtime / Deployment endpoints. Missing keys behave
// like "no per-kind gate" — the resource handler's default permits
// the call, with API-level authn middleware still applying.
Authorizers map[string]Authorizer
// ListFilters injects per-kind ExtraWhere predicates into
// list queries. Use this for row-level visibility (e.g. RBAC
// filtering: a reader without a grant for a given resource never
// sees the row in a list response). The (string, []any) tuple is
// passed straight through to v1alpha1store.ListOpts.ExtraWhere /
// ExtraArgs — see that docstring for placeholder rules.
ListFilters map[string]ListFilter
// PostUpserts run after the generic resource handler PUTs a
// row, per kind. Downstream applications wire this for kinds that need
// runtime side-effects on apply — Runtime apply mirroring spec
// into a per-type sidecar table, for example. Missing keys =
// no post-upsert hook for that kind.
//
// Hook errors fail the request with 500 (the row is already
// persisted, so a hook failure indicates degraded state).
PostUpserts map[string]PostUpsert
// PostDeletes mirror PostUpserts on the delete path.
PostDeletes map[string]PostDelete
// Prepares run per-kind after validation and before Store.Upsert on
// both the dedicated PUT route and the batch /v0/apply path. Keyed by
// canonical Kind. Used to mutate the decoded object before persistence
// (e.g. strip sensitive spec fields). Missing keys = no prepare
// hook for that kind.
Prepares map[string]Prepare
// Admission optionally accepts a validated write before the row reaches
// production storage. Nil preserves normal direct writes.
// TODO(controller): temporary synchronous-handler bridge; remove with
// reconciler admission/staging.
Admission Admission
// DeleteAdmission optionally accepts an authorized delete before the row is
// removed from production storage. Nil preserves normal direct deletes.
// TODO(controller): temporary synchronous-handler bridge; remove with
// reconciler admission/staging.
DeleteAdmission DeleteAdmission
// ResolverWrapper decorates the shared ResourceRef resolver before route
// registration. Nil preserves the default store-backed resolver.
// TODO(controller): temporary bridge for pending staged refs in HTTP apply.
ResolverWrapper func(v1alpha1.ResolverFunc) v1alpha1.ResolverFunc
// V1Alpha1StoreTables registers additional v1alpha1 kinds with their
// backing PostgreSQL tables. Downstream builds that add their own
// Scheme kinds should populate this so the shared /v0/apply,
// resolver, and generic route plumbing can see the same store map
// as any ExtraRoutes they register.
//
// A bare "table" resolves in the OSS schema. To place a kind in
// another schema, qualify the value as "schema.table"; the schema
// segment must be a valid lowercase identifier (^[a-z_][a-z0-9_]*$)
// or server startup panics.
V1Alpha1StoreTables map[string]string
// V1Alpha1MutableStoreKinds marks extra v1alpha1 kinds that use mutable
// namespace/name object behavior instead of tagged artifact semantics.
// Downstream control-plane/config kinds are v1alpha1-shaped but are not
// content artifacts.
V1Alpha1MutableStoreKinds map[string]bool
// RegistryValidator overrides the per-package registry
// validator (the dispatcher consulted on apply to confirm
// each declared package — npm / pypi / oci — exists
// and (for OCI) carries the
// `LABEL io.modelcontextprotocol.server.name` ownership annotation
// proving the publisher controls the OCI namespace).
//
// Default (nil) is registries.Dispatcher, which fans out to every
// per-registry validator and matches the public-catalogue contract
// the upstream modelcontextprotocol/registry project ships. That's
// the right behavior for the OSS public catalogue but not for
// private deployments where:
//
// - images live in private ECR / GCR / ACR that anonymous fetch
// can't reach;
// - server names aren't claims against a public namespace, so the
// ownership-annotation requirement is moot;
// - synthetic test names mean no public image can satisfy the
// annotation match.
//
// Pass a custom RegistryValidatorFunc to filter out origin types
// the build doesn't want enforced (e.g. wrap registries.Dispatcher
// and short-circuit when origin.OCI != nil), or pass an explicit
// no-op (`func(...) error { return nil }`) to disable per-package
// registry validation entirely. Cross-kind ResourceRef checks still
// run regardless.
RegistryValidator v1alpha1.RegistryValidatorFunc
// ExtraRoutes allows external integrations to register additional HTTP
// routes using the same API instance and path prefix as OSS core
// routes.
ExtraRoutes func(api huma.API, pathPrefix string)
// ExtraResourceRoutes is like ExtraRoutes, but runs after the v1alpha1
// resource route context has been finalized.
// TODO(controller): temporary bridge for downstream synchronous approval routes.
ExtraResourceRoutes func(api huma.API, pathPrefix string, ctx ResourceRouteContext)
// HTTPServerFactory is an optional function to create a server that
// adds new API routes.
HTTPServerFactory HTTPServerFactory
// OnHTTPServerCreated is an optional callback that receives the
// created server (potentially extended via HTTPServerFactory).
OnHTTPServerCreated func(Server)
// UIHandler is an optional HTTP handler for serving a custom UI at
// the root path ("/"). If provided, this handler will be used instead
// of the default redirect to docs. API routes will still take
// precedence over the UI handler.
UIHandler http.Handler
// AuthnProvider is an optional authentication provider. Nil disables HTTP
// authentication middleware, which is the permissive default.
AuthnProvider auth.AuthnProvider
// AuthzProvider is an optional authorization provider. Nil selects the
// permissive default provider.
AuthzProvider auth.AuthzProvider
// MCPProtectedResourceMetadata, when non-nil, makes the MCP bridge serve
// RFC 9728 protected-resource metadata at the well-known path. Nil disables
// OAuth discovery. Authentication and authorization enforcement are
// determined by the configured providers.
MCPProtectedResourceMetadata *oauthex.ProtectedResourceMetadata
// MCPResourceMetadataURL is the external URL of that metadata document,
// emitted as the resource_metadata parameter of the bridge's 401
// WWW-Authenticate challenge. Empty omits the hint.
MCPResourceMetadataURL string
// MCPAuthnProvider optionally overrides AuthnProvider for the MCP bridge
// only, letting a build apply bridge-specific validation (e.g. audience
// binding to the MCP resource). Nil falls back to AuthnProvider.
MCPAuthnProvider auth.AuthnProvider
// Auditor receives audit events from the v1alpha1 store layer
// (e.g. ResourceTagCreated on Upsert creates). The default OSS
// behavior is a no-op; downstream builds plug in a real audit sink.
// If nil, NoopAuditor is used.
Auditor Auditor
// InitialFinalizers seeds finalizers atomically on create for kinds
// whose external teardown must be protected from a concurrent delete.
InitialFinalizers map[string]func(v1alpha1.Object) []string
}
AppOptions contains configuration for the registry app. All fields are optional and allow external developers to extend functionality.
This type lives in pkg/types (rather than pkg/registry or internal/registry) so that both the public entrypoint (pkg/registry/registry_app.go) and the internal implementation (internal/registry/registry_app.go) can reference it without a cyclic import.
type ApplyDependencySnapshot ¶ added in v0.4.0
type ApplyDependencySnapshot struct {
Kind string `json:"kind"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
Tag string `json:"tag,omitempty"`
UID string `json:"uid,omitempty"`
Generation int64 `json:"generation,omitempty"`
MaterialHash string `json:"materialHash,omitempty"`
}
ApplyDependencySnapshot is the operator-visible identity of one resolved resource that influenced a Deployment apply fingerprint.
type ApplyFingerprintOptions ¶ added in v0.4.0
ApplyFingerprintOptions carries adapter-owned inputs that are not already represented by ApplyInput. Dependencies are additional resolved resources the adapter will read while materializing the target.
type ApplyFingerprintResult ¶ added in v0.4.0
type ApplyFingerprintResult struct {
Fingerprint string
Dependencies []ApplyDependencySnapshot
}
ApplyFingerprintResult carries the fingerprint plus the resolved dependency evidence used to build it.
func DefaultApplyFingerprintResult ¶ added in v0.4.0
func DefaultApplyFingerprintResult(ctx context.Context, in ApplyInput, opts ApplyFingerprintOptions) (ApplyFingerprintResult, error)
DefaultApplyFingerprintResult returns the same deterministic fingerprint as DefaultApplyFingerprint, plus snapshots of resolved dependency resources that participated in the fingerprint payload.
type ApplyInput ¶ added in v0.4.0
type ApplyInput struct {
// Deployment is the resource being applied.
Deployment *v1alpha1.Deployment
// Target is the resolved TargetRef — either *v1alpha1.Agent or
// *v1alpha1.MCPServer. Adapters type-switch on it.
Target v1alpha1.Object
// Runtime is the resolved RuntimeRef.
Runtime *v1alpha1.Runtime
// Resolver is passed so adapters can check nested ref existence
// mid-Apply (blank-namespace refs inherit from the referencing
// object — same rules as v1alpha1.Object ResolveRefs).
Resolver v1alpha1.ResolverFunc
// Getter fetches the typed Object for a ResourceRef. Adapters use
// this when they need the target's Spec (not just an existence
// check) — for example, resolving a Deployment's effective ModelRef or
// walking AgentSpec.MCPServers to build agentgateway upstream config.
Getter v1alpha1.GetterFunc
}
ApplyInput carries everything Apply needs without the adapter reaching into the Store directly — the reconciler pre-resolves refs and hands in concrete objects.
type ApplyResult ¶ added in v0.4.0
type ApplyResult struct {
// Conditions to merge into Deployment.Status via
// Store.PatchStatus. Canonical types:
// - "Progressing" — workload is being created/updated
// - "Ready" — workload is running + serving
// - "RuntimeConfigured" — Runtime.Config parsed and connectable
// - "Degraded" — transient failure, will retry
Conditions []v1alpha1.Condition
// RuntimeMetadata carries adapter-internal state to persist
// into Deployment.Metadata.Annotations (keyed under
// runtimes.agentregistry.solo.io/<type>/*). Callers marshal
// to string values since Annotations is map[string]string.
RuntimeMetadata map[string]string
// Details is a map of top-level keys to JSON-encoded values to merge into
// Deployment.Status.Details via Status.SetDetailsKeyJSON. Each adapter owns its
// own top-level key; other keys in Status.Details are preserved across
// the patch. A nil value at a key removes that key.
//
// Use Details for structured state that Conditions cannot express cleanly;
// stable, typed status should still be modeled as Conditions.
Details map[string]json.RawMessage
}
ApplyResult captures the status + annotation deltas the reconciler should persist after Apply.
type Auditor ¶ added in v0.4.0
type Auditor interface {
// ResourceTagCreated is invoked when Store.Upsert creates a new tag row
// for a content-registry kind. Mutable-object kinds do not produce this
// event.
ResourceTagCreated(ctx context.Context, kind, namespace, name, tag string)
}
Auditor receives audit events for state changes that the OSS layer considers significant. The default OSS implementation is a no-op; downstream builds plug in a real audit sink via NewStore options.
Audit completeness is enforced at the source: every code path that produces a recordable state change calls into Auditor directly, rather than relying on observers (PostUpsert hooks, etc.) to remember to log.
var NoopAuditor Auditor = noopAuditor{}
NoopAuditor is the default Auditor used when none is plugged in.
type AuthorizeInput ¶ added in v0.4.0
type AuthorizeInput struct {
// Verb is one of "get", "list", "apply", "delete".
Verb string
// Kind is the canonical Kind name (v1alpha1.KindAgent, etc.).
Kind string
// Namespace is the URL-scoped namespace; "" for cross-namespace list.
Namespace string
// Name is the resource name; "" for list verbs.
Name string
// Tag is the resource tag for content kinds; "" for list/get-latest.
Tag string
}
AuthorizeInput is the per-call context handed to Authorizer + ListFilter callbacks. Mirrors resource.AuthorizeInput field-for-field; declared here to keep AppOptions free of internal-package imports.
type Authorizer ¶ added in v0.4.0
type Authorizer func(ctx context.Context, in AuthorizeInput) error
Authorizer gates a single resource handler invocation. Return nil to allow; a huma error to set the response status; any other error to surface as 500. Wired into resource.Config.Authorize.
type CLITokenProvider ¶ added in v0.4.0
type CLITokenProvider interface {
// Token returns a token for API calls.
Token(ctx context.Context) (token string, err error)
}
CLITokenProvider provides tokens for CLI commands. External libraries can implement this to support fetching tokens from defined sources.
type CLITokenProviderFactory ¶ added in v0.4.0
type CLITokenProviderFactory func(root *cobra.Command) (CLITokenProvider, error)
CLITokenProviderFactory is a function type that creates a CLI token provider. The factory optionally receives the root command so the implementation can read command-specific configuration (e.g. flags).
type DatabaseFactory ¶ added in v0.1.14
type DatabaseFactory func(ctx context.Context, databaseURL string, baseStore database.Store, authz auth.Authorizer) (database.Store, error)
DatabaseFactory is a function type that creates a store implementation. This allows implementors to run additional migrations and wrap the base store.
type DeleteAdmission ¶ added in v0.4.0
type DeleteAdmission func(ctx context.Context, in DeleteAdmissionInput) (DeleteAdmissionResult, error)
DeleteAdmission owns the final delete decision after authz has passed. The OSS default deletes from production; downstream integrations can stage, reject, or otherwise route the delete before production storage is touched.
TODO(controller): temporary synchronous-handler bridge; remove with reconciler admission/staging.
type DeleteAdmissionInput ¶ added in v0.4.0
type DeleteAdmissionResult ¶ added in v0.4.0
type DeploymentAdapter ¶ added in v0.4.0
type DeploymentAdapter interface {
// Type returns the canonical CamelCase discriminator string
// ("Local", "Kubernetes", "BedrockAgentCore", ...). Runtime.Validate
// canonicalizes Spec.Type at admission, so the reconciler's adapter
// lookup compares Type() against Spec.Type with exact-match equality.
Type() string
// SupportedTargetKinds lists the v1alpha1 Kinds this adapter can
// deploy. Typically []string{KindAgent, KindMCPServer}. Used by
// the reconciler to early-reject a Deployment whose TargetRef
// points at a kind the adapter doesn't handle.
SupportedTargetKinds() []string
// Apply ensures the Deployment's runtime matches its desired
// state. DesiredState == "deployed" or "" (default) ⇒ run.
// DesiredState == "undeployed" ⇒ reconciler routes to Remove
// directly; adapters can assume Apply is only called with a
// run-intent.
//
// Idempotent. Safe to call repeatedly with the same input.
// Returns the initial conditions to persist (typically
// Progressing=True). The adapter's async watch loop later refines
// the conditions via PatchStatus.
Apply(ctx context.Context, in ApplyInput) (*ApplyResult, error)
// Remove tears down runtime resources. Called when:
// - Deployment.Metadata.DeletionTimestamp != nil (soft-delete)
// - Deployment.Spec.DesiredState == "undeployed"
// Idempotent: safe to call when nothing exists. Row lifetime is
// owned by the soft-delete + GC path; the adapter only handles
// external-state teardown.
Remove(ctx context.Context, in RemoveInput) (*RemoveResult, error)
// Logs streams runtime logs from the deployed workload. The
// returned channel closes when streaming ends; caller cancels via
// ctx.
Logs(ctx context.Context, in LogsInput) (<-chan LogLine, error)
}
DeploymentAdapter is the v1alpha1 runtime surface for deploying Agent or MCPServer targets onto a concrete runtime (local docker daemon, Kubernetes, hosted cloud runtimes, etc.).
One adapter per runtime type. Adapters are registered at app boot in a map keyed by Type() string; the reconciler looks up by Runtime.Spec.Type when a Deployment apply arrives.
Lifecycle contract (see design-docs/V1ALPHA1_RUNTIME_ADAPTERS.md):
- apply handler validates + resolves refs + Upserts the Deployment row; reconciler observes NOTIFY.
- reconciler calls DeploymentAdapter.Apply with the resolved Target + Runtime objects.
- Apply returns immediately with a Progressing condition. Adapter spawns its own watch loop to later PatchStatus with Ready=True when the workload converges.
- on Deployment delete, Store.Delete sets DeletionTimestamp; the reconciler calls DeploymentAdapter.Remove for external-state teardown. Row lifetime is owned by soft-delete + GC, not by adapter-returned tokens — Remove is purely an external-state hook.
Apply is ALWAYS ASYNC. Apply returns quickly; convergence is tracked via the adapter's own watch loop writing status. The reconciler doesn't block on convergence.
Adapters with expensive Apply paths can also implement DeploymentDesiredFingerprinter to make unchanged reconciles cheap after the same resolved input has already been accepted. Adapters that can enumerate provider-observed workloads implement DeploymentDiscoverySource separately; discovery is intentionally opt-in and is not part of the lifecycle contract.
type DeploymentDesiredFingerprinter ¶ added in v0.4.0
type DeploymentDesiredFingerprinter interface {
DesiredFingerprint(ctx context.Context, in ApplyInput) (string, error)
}
DeploymentDesiredFingerprinter lets an adapter define exactly which resolved inputs determine its external output. Adapters that do not implement this hook use DefaultApplyFingerprint.
type DeploymentDiscoverySource ¶ added in v0.4.0
type DeploymentDiscoverySource interface {
Discover(ctx context.Context, in DiscoverInput) ([]DiscoveryResult, error)
}
DeploymentDiscoverySource is an optional adapter capability for runtimes that can list provider-observed workloads. Implementers MUST NOT write directly to Deployment storage; the discovery controller is the single writer for discovered Deployment rows.
type DiscoverInput ¶ added in v0.4.0
DiscoverInput scopes a Discover call.
type DiscoveryResult ¶ added in v0.4.0
type DiscoveryResult struct {
// TargetKind is the v1alpha1 Kind this workload looks like —
// Agent or MCPServer. Empty if the adapter can't infer.
TargetKind string
// Namespace, Name, Tag identify the workload in the
// registry's naming scheme. Blank fields mean "unmanaged" —
// workload exists on the runtime but has no corresponding
// Deployment row.
Namespace string
Name string
Tag string
// RuntimeMetadata mirrors what Apply writes so the caller can
// correlate this discovery with an existing Deployment's
// annotations.
RuntimeMetadata map[string]string
}
DiscoveryResult describes one out-of-band workload the adapter observed under the Runtime. The discovery controller correlates these entries with existing managed Deployments and materializes unmanaged entries as discovered Deployment rows.
type EmptyResponse ¶ added in v0.1.19
type EmptyResponse struct {
Message string `json:"message" doc:"Success message" example:"Operation completed successfully"`
}
EmptyResponse represents a simple success response with a message.
type HTTPServerFactory ¶
HTTPServerFactory is a function type that creates a server implementation that adds new API routes and handlers.
The factory receives a Server interface and should return a Server after registering new routes using base.HumaAPI() or base.Mux().
type ListFilter ¶ added in v0.4.0
type ListFilter func(ctx context.Context, in AuthorizeInput) (extraWhere string, extraArgs []any, err error)
ListFilter returns a SQL predicate fragment + bind args to inject into the list query as ListOpts.ExtraWhere / ExtraArgs. Wired into resource.Config.ListFilter. Return ("", nil, nil) for "no filter"; non-nil err short-circuits the list.
type LogLine ¶ added in v0.4.0
type LogLine struct {
Timestamp time.Time
Stream string // "stdout" | "stderr" | runtime-specific
Line string
}
LogLine is a single emitted log record from the workload.
type LogsInput ¶ added in v0.4.0
type LogsInput struct {
Deployment *v1alpha1.Deployment
// Follow ⇒ stream indefinitely until ctx is cancelled. !Follow ⇒
// return the available backlog and close.
Follow bool
// TailLines bounds the initial backlog; 0 means unbounded.
TailLines int
}
LogsInput selects a log stream for the deployed workload.
type PostDelete ¶ added in v0.4.0
PostDelete runs after a successful DELETE on a v1alpha1 resource. Wired into resource.Config.PostDelete + the apply batch's per-doc delete hook.
type PostUpsert ¶ added in v0.4.0
PostUpsert runs after a successful PUT or apply on a v1alpha1 resource. Wired into resource.Config.PostUpsert and the matching per-doc apply hook on /v0/apply. Hook errors propagate to the caller (500 on the per-kind PUT path, ApplyStatusFailed on the batch path).
type Prepare ¶ added in v0.4.0
Prepare runs after validation and before Store.Upsert on a v1alpha1 resource. Wired into resource.Config.Prepare + the apply batch's per-doc prepare hook. Used to mutate the decoded object before persistence (e.g. strip sensitive spec fields).
type RemoveInput ¶ added in v0.4.0
type RemoveInput struct {
Deployment *v1alpha1.Deployment
Runtime *v1alpha1.Runtime
}
RemoveInput carries the Deployment being torn down plus its resolved Runtime (the Target has already been dereferenced and is not included; teardown operates on the recorded runtime state).
type RemoveResult ¶ added in v0.4.0
type RemoveResult struct {
// Conditions to merge into Deployment.Status (typically
// Progressing with Reason="Terminating", then Ready=False with
// Reason="Removed" on completion).
Conditions []v1alpha1.Condition
}
RemoveResult describes the outcome of a Remove call. The reconciler merges Conditions into Deployment.Status; idempotent re-Remove on a completed teardown is the expected pattern (no separate finalizer drain — soft-delete + GC handle the lifetime).
type ResourceRouteContext ¶ added in v0.4.0
type ResourceRouteContext struct {
Stores map[string]any
Resolver v1alpha1.ResolverFunc
RegistryValidator v1alpha1.RegistryValidatorFunc
Apply func(ctx context.Context, obj v1alpha1.Object, dryRun bool) v0.ApplyResult
Delete func(ctx context.Context, obj v1alpha1.Object, dryRun bool) v0.ApplyResult
}
ResourceRouteContext exposes the finalized v1alpha1 route wiring to downstream integrations that need adjacent routes against the same stores and hooks as /v0/apply.
TODO(controller): this is a temporary way for downstream synchronous routes to reuse production apply wiring. Reconciler-owned staging should make this unnecessary outside HTTP route callbacks.
type Response ¶ added in v0.1.19
type Response[T any] struct { Body T }
Response is a generic wrapper for Huma responses. Usage: Response[HealthBody] instead of HealthOutput.
type RuntimeAdapter ¶ added in v0.4.0
type RuntimeAdapter interface {
// Type returns the canonical CamelCase discriminator string
// ("Local", "Kubernetes", "BedrockAgentCore", "GeminiAgentRuntime",
// ...). Runtime.Validate canonicalizes Spec.Type at admission so
// dispatch can compare with exact-match equality.
Type() string
// ApplyRuntime runs after the v1alpha1 store has persisted a
// Runtime on PUT or batch apply. Must be idempotent — re-apply
// with rotated config must converge sidecar state, not error.
ApplyRuntime(ctx context.Context, runtime *v1alpha1.Runtime) error
// RemoveRuntime runs after the v1alpha1 store has soft-deleted a
// Runtime. runtimeID is the metadata.name (the v1alpha1 row's
// stable identity). Must tolerate missing sidecar rows for
// idempotency.
RemoveRuntime(ctx context.Context, runtimeID string) error
}
RuntimeAdapter is the per-type side-effect hook fired after a Runtime PUT/DELETE on the v1alpha1 generic resource handler. The v1alpha1 store is the source of truth for the Runtime row itself; the adapter exists purely to reconcile any per-type sidecar state (downstream connection tables, credential caches, etc.) so other lookups — gateway credential resolution, type-specific deploy paths — can read those tables consistently.
One adapter per runtime type discriminator (runtime.Spec.Type). Downstream builds register adapters via AppOptions.RuntimeAdapters; the registry app maps that into per-kind PostUpsert/PostDelete on KindRuntime, dispatching by exact-match against Spec.Type (Runtime.Validate canonicalizes user-supplied case at admission).
Hook errors propagate back to the API caller (500 on the per-kind PUT path; ApplyStatusFailed on the batch path) — the v1alpha1 row is already persisted, so a hook failure indicates degraded sidecar state.
type Server ¶
type Server interface {
// HumaAPI returns the Huma API instance, allowing registration of new
// routes that will appear in the OpenAPI documentation.
HumaAPI() huma.API
// Mux returns the HTTP ServeMux, allowing registration of custom HTTP
// handlers.
Mux() *http.ServeMux
// Start begins listening for incoming HTTP requests.
Start() error
// Shutdown gracefully shuts down the server.
Shutdown(ctx context.Context) error
}
Server represents the HTTP server and provides access to the Huma API and HTTP mux for registering new routes and handlers.
This interface allows external packages to extend the server functionality by adding new endpoints without accessing internal implementation details.