mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-19 13:01:48 +00:00
Integrate OpenHandoff factory workspace (#212)
This commit is contained in:
parent
3d9476ed0b
commit
bf282199b5
251 changed files with 42824 additions and 692 deletions
43
factory/packages/backend/src/actors/context.ts
Normal file
43
factory/packages/backend/src/actors/context.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import type { AppConfig } from "@openhandoff/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,
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue