@@ -18,6 +18,7 @@ import type { PluginLogger } from "../types.js";
1818
1919const log = createSubsystemLogger ( "plugins" ) ;
2020
21+ /** Resolved plugin runtime load context shared by runtime loader callers. */
2122export type PluginRuntimeLoadContext = {
2223 rawConfig : OpenClawConfig ;
2324 config : OpenClawConfig ;
@@ -30,6 +31,7 @@ export type PluginRuntimeLoadContext = {
3031 installRecords ?: Record < string , PluginInstallRecord > ;
3132} ;
3233
34+ /** Runtime load option values that can be passed directly to plugin loading. */
3335export type PluginRuntimeResolvedLoadValues = Pick <
3436 PluginLoadOptions ,
3537 | "config"
@@ -42,6 +44,7 @@ export type PluginRuntimeResolvedLoadValues = Pick<
4244 | "installRecords"
4345> ;
4446
47+ /** Options accepted while resolving plugin runtime load context. */
4548export type PluginRuntimeLoadContextOptions = {
4649 config ?: OpenClawConfig ;
4750 activationSourceConfig ?: OpenClawConfig ;
@@ -51,6 +54,7 @@ export type PluginRuntimeLoadContextOptions = {
5154 manifestRegistry ?: PluginManifestRegistry ;
5255} ;
5356
57+ /** Creates the default plugin runtime loader logger. */
5458export function createPluginRuntimeLoaderLogger ( ) : PluginLogger {
5559 return {
5660 info : ( message ) => log . info ( message ) ,
@@ -60,6 +64,7 @@ export function createPluginRuntimeLoaderLogger(): PluginLogger {
6064 } ;
6165}
6266
67+ /** Resolves config, manifests, install records, and auto-enable state for runtime loads. */
6368export function resolvePluginRuntimeLoadContext (
6469 options ?: PluginRuntimeLoadContextOptions ,
6570) : PluginRuntimeLoadContext {
@@ -93,6 +98,7 @@ export function resolvePluginRuntimeLoadContext(
9398 const workspaceDir =
9499 options ?. workspaceDir ?? resolveAgentWorkspaceDir ( config , resolveDefaultAgentId ( config ) ) ;
95100 if ( metadataSnapshot ) {
101+ // Reusable snapshots stay available to later manifest-policy lookups for this runtime load.
96102 if ( isReusableCurrentPluginMetadataSnapshot ( metadataSnapshot ) ) {
97103 setCurrentPluginMetadataSnapshot ( metadataSnapshot , {
98104 config : rawConfig ,
@@ -117,13 +123,15 @@ export function resolvePluginRuntimeLoadContext(
117123 } ;
118124}
119125
126+ /** Builds plugin load options from a resolved runtime load context. */
120127export function buildPluginRuntimeLoadOptions (
121128 context : PluginRuntimeLoadContext ,
122129 overrides ?: Partial < PluginLoadOptions > ,
123130) : PluginLoadOptions {
124131 return buildPluginRuntimeLoadOptionsFromValues ( context , overrides ) ;
125132}
126133
134+ /** Builds plugin load options from explicit runtime load values. */
127135export function buildPluginRuntimeLoadOptionsFromValues (
128136 values : PluginRuntimeResolvedLoadValues ,
129137 overrides ?: Partial < PluginLoadOptions > ,
0 commit comments