feat: wire ExternalSystem, Database, and Notify APIs into script runtime

IServiceProvider now flows through the actor chain (DeploymentManagerActor
→ InstanceActor → ScriptActor → ScriptExecutionActor) so scripts can
resolve IExternalSystemClient, IDatabaseGateway, and
INotificationDeliveryService from DI. ScriptGlobals exposes ExternalSystem,
Database, Notify, and Scripts as top-level properties so scripts can use
them without the Instance. prefix.
This commit is contained in:
Joseph Doherty
2026-03-18 02:41:18 -04:00
parent 8095c8efbe
commit 899dec6b6f
12 changed files with 767 additions and 100 deletions

View File

@@ -32,6 +32,7 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
private readonly ILogger<DeploymentManagerActor> _logger;
private readonly IActorRef? _dclManager;
private readonly ISiteHealthCollector? _healthCollector;
private readonly IServiceProvider? _serviceProvider;
private readonly Dictionary<string, IActorRef> _instanceActors = new();
private int _totalDeployedCount;
@@ -45,7 +46,8 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
SiteRuntimeOptions options,
ILogger<DeploymentManagerActor> logger,
IActorRef? dclManager = null,
ISiteHealthCollector? healthCollector = null)
ISiteHealthCollector? healthCollector = null,
IServiceProvider? serviceProvider = null)
{
_storage = storage;
_compilationService = compilationService;
@@ -54,6 +56,7 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
_options = options;
_dclManager = dclManager;
_healthCollector = healthCollector;
_serviceProvider = serviceProvider;
_logger = logger;
// Lifecycle commands
@@ -561,7 +564,8 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
_options,
loggerFactory.CreateLogger<InstanceActor>(),
_dclManager,
_healthCollector));
_healthCollector,
_serviceProvider));
var actorRef = Context.ActorOf(props, instanceName);
_instanceActors[instanceName] = actorRef;