mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 06:04:43 +00:00
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import type { AppConfig } from "@sandbox-agent/factory-shared";
|
|
import type { BackendDriver } from "../driver.js";
|
|
import type { NotificationService } from "../notifications/index.js";
|
|
import type { ProviderRegistry } from "../providers/index.js";
|
|
|
|
let runtimeConfig: AppConfig | null = null;
|
|
let providerRegistry: ProviderRegistry | null = null;
|
|
let notificationService: NotificationService | null = null;
|
|
let runtimeDriver: BackendDriver | null = null;
|
|
|
|
export function initActorRuntimeContext(
|
|
config: AppConfig,
|
|
providers: ProviderRegistry,
|
|
notifications?: NotificationService,
|
|
driver?: BackendDriver
|
|
): void {
|
|
runtimeConfig = config;
|
|
providerRegistry = providers;
|
|
notificationService = notifications ?? null;
|
|
runtimeDriver = driver ?? null;
|
|
}
|
|
|
|
export function getActorRuntimeContext(): {
|
|
config: AppConfig;
|
|
providers: ProviderRegistry;
|
|
notifications: NotificationService | null;
|
|
driver: BackendDriver;
|
|
} {
|
|
if (!runtimeConfig || !providerRegistry) {
|
|
throw new Error("Actor runtime context not initialized");
|
|
}
|
|
|
|
if (!runtimeDriver) {
|
|
throw new Error("Actor runtime context missing driver");
|
|
}
|
|
|
|
return {
|
|
config: runtimeConfig,
|
|
providers: providerRegistry,
|
|
notifications: notificationService,
|
|
driver: runtimeDriver,
|
|
};
|
|
}
|