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

@@ -31,6 +31,7 @@ public class ScriptActor : ReceiveActor, IWithTimers
private readonly SiteRuntimeOptions _options;
private readonly ILogger _logger;
private readonly ISiteHealthCollector? _healthCollector;
private readonly IServiceProvider? _serviceProvider;
private Script<object?>? _compiledScript;
private ScriptTriggerConfig? _triggerConfig;
@@ -49,7 +50,8 @@ public class ScriptActor : ReceiveActor, IWithTimers
SharedScriptLibrary sharedScriptLibrary,
SiteRuntimeOptions options,
ILogger logger,
ISiteHealthCollector? healthCollector = null)
ISiteHealthCollector? healthCollector = null,
IServiceProvider? serviceProvider = null)
{
_scriptName = scriptName;
_instanceName = instanceName;
@@ -59,6 +61,7 @@ public class ScriptActor : ReceiveActor, IWithTimers
_options = options;
_logger = logger;
_healthCollector = healthCollector;
_serviceProvider = serviceProvider;
_minTimeBetweenRuns = scriptConfig.MinTimeBetweenRuns;
// Parse trigger configuration
@@ -212,7 +215,8 @@ public class ScriptActor : ReceiveActor, IWithTimers
replyTo,
correlationId,
_logger,
_healthCollector));
_healthCollector,
_serviceProvider));
Context.ActorOf(props, executionId);
}