Expand description
The plugin host in the server (Go sdk/cliproxy/service_plugins.go,
internal/api/server_management.go): one cpa_plugin::Host per runtime, synced
with every published config by a single worker so the latest config always wins.
Structs§
- Plugin
Runtime - The host plus the config it should converge on.
- Scheduler
Context - The request facts a plugin scheduler receives (Go
SchedulerPickRequest.StreamandOptions: the client headers and the execution metadata, JSON values only).
Functions§
- applied
- Waits until the plugin worker started by
starthas applied every config published so far (Go applies plugin config synchronously while it applies a config). - reload_
plugin_ auth_ files - Go loads plugins while it builds the service, so its first auth-folder load already
asks plugin auth providers (sdk/cliproxy/builder.go
ApplyConfig, thencoreManager.LoadinService.Run). Credentials load before plugins start here, so the binary calls this once they have: while a plugin offers an auth provider, the auth folder and config credentials load again, before serving. Not in Home mode, whose credentials come from Home. Published as the watcher publishes a scan: a file changed after the scan read it (a token refresh committed meanwhile) keeps its current credential, and so does a file the scan read half-written. Plugins parse on a blocking thread, holding no lock: a parse can make host callbacks that need the async runtime, even with one worker thread. This load registers the credentials as Go’s first one does, so it replaces the startup load’s refresh schedules (crate::runtime::CredentialStore::end_bootstrap). - reserved_
management_ routes - Go
registeredManagementRouteKeys: every built-in/v0/managementroute as gin lists it. Plugins cannot register these keys even where this server does not implement the route, so a plugin keeps the same routes under both servers. ponytail: Go registers these only once a management secret exists; until then it lets plugins claim them. The full list is used unconditionally. - start
- Syncs the current config now, then follows every later publish. Call once at startup, before serving (Go applies plugins before the server starts).
- sync
- Go’s startup and reload sequence (
syncPluginRuntimeConfigForConfigandRefreshPluginManagementRoutes): apply the config, register the client-key and plugin frontend auth providers, then rebuild the plugin management routes around the built-in ones, then register plugin models and executors (syncPluginModelRuntime). Go runs that last step only once its listener is up; here it completes before serving.