@@ -61,6 +61,12 @@ export interface ArtifactKernelFactoryConfig {
6161 * `process.env.OS_AUTH_SECRET` / `AUTH_SECRET` at construction time.
6262 */
6363 authBaseSecret ?: string ;
64+ /**
65+ * Capability tokens force-mounted on every per-environment kernel, merged
66+ * (and de-duped by the loader) with the artifact's own `requires`. Lets a
67+ * host make a capability ubiquitous across tenants — e.g. `['ai','aiStudio']`.
68+ */
69+ defaultRequires ?: string [ ] ;
6470}
6571
6672/**
@@ -81,12 +87,14 @@ export class ArtifactKernelFactory implements EnvironmentKernelFactory {
8187 private readonly logger : NonNullable < ArtifactKernelFactoryConfig [ 'logger' ] > ;
8288 private readonly kernelConfig ?: ArtifactKernelFactoryConfig [ 'kernelConfig' ] ;
8389 private readonly authBaseSecret : string ;
90+ private readonly defaultRequires : string [ ] ;
8491
8592 constructor ( config : ArtifactKernelFactoryConfig ) {
8693 this . client = config . client ;
8794 this . envRegistry = config . envRegistry ;
8895 this . logger = config . logger ?? console ;
8996 this . kernelConfig = config . kernelConfig ;
97+ this . defaultRequires = config . defaultRequires ?? [ ] ;
9098 this . authBaseSecret = (
9199 config . authBaseSecret
92100 ?? readEnvWithDeprecation ( 'OS_AUTH_SECRET' , [ 'AUTH_SECRET' , 'BETTER_AUTH_SECRET' ] )
@@ -363,8 +371,13 @@ export class ArtifactKernelFactory implements EnvironmentKernelFactory {
363371 ( Array . isArray ( bundle ?. requires ) ? bundle . requires : null ) ??
364372 ( Array . isArray ( sys ?. requires ) ? sys . requires : null ) ??
365373 [ ] ;
366- const requires : string [ ] = ( requiresRaw as unknown [ ] )
367- . filter ( ( x ) : x is string => typeof x === 'string' && x . length > 0 ) ;
374+ // Merge host-forced defaults (e.g. cloud's ['ai','aiStudio']) with the
375+ // artifact's own requires. loadCapabilities de-dupes via a Set, so
376+ // overlap is safe.
377+ const requires : string [ ] = [
378+ ...( requiresRaw as unknown [ ] ) ,
379+ ...this . defaultRequires ,
380+ ] . filter ( ( x ) : x is string => typeof x === 'string' && x . length > 0 ) ;
368381
369382 if ( requires . length > 0 ) {
370383 const installed = await loadCapabilities ( {
0 commit comments