@@ -63,24 +63,26 @@ type TaskRegistryDeliveryRuntime = Pick<
6363 typeof import ( "./task-registry-delivery-runtime.js" ) ,
6464 "sendMessage"
6565> ;
66- type TaskRegistryControlRuntime = Pick <
67- typeof import ( "./task-registry-control.runtime.js" ) ,
68- "getAcpSessionManager" | "killSubagentRunAdmin"
69- > ;
66+ type TaskRegistryControlRuntime = {
67+ getAcpSessionManager : ( ) => Pick <
68+ ReturnType < ( typeof import ( "./task-registry-control.runtime.js" ) ) [ "getAcpSessionManager" ] > ,
69+ "cancelSession"
70+ > ;
71+ killSubagentRunAdmin : ( typeof import ( "./task-registry-control.runtime.js" ) ) [ "killSubagentRunAdmin" ] ;
72+ } ;
7073const TASK_REGISTRY_DELIVERY_RUNTIME_OVERRIDE_KEY = Symbol . for (
7174 "openclaw.taskRegistry.deliveryRuntimeOverride" ,
7275) ;
7376const TASK_REGISTRY_CONTROL_RUNTIME_OVERRIDE_KEY = Symbol . for (
7477 "openclaw.taskRegistry.controlRuntimeOverride" ,
7578) ;
76- type TaskRegistryGlobalWithDeliveryOverride = typeof globalThis & {
79+ type TaskRegistryGlobalWithRuntimeOverrides = typeof globalThis & {
7780 [ TASK_REGISTRY_DELIVERY_RUNTIME_OVERRIDE_KEY ] ?: TaskRegistryDeliveryRuntime | null ;
7881 [ TASK_REGISTRY_CONTROL_RUNTIME_OVERRIDE_KEY ] ?: TaskRegistryControlRuntime | null ;
7982} ;
8083let deliveryRuntimePromise : Promise < typeof import ( "./task-registry-delivery-runtime.js" ) > | null =
8184 null ;
82- let controlRuntimePromise : Promise < typeof import ( "./task-registry-control.runtime.js" ) > | null =
83- null ;
85+ let controlRuntimePromise : Promise < TaskRegistryControlRuntime > | null = null ;
8486
8587type TaskDeliveryOwner = {
8688 sessionKey ?: string ;
@@ -376,7 +378,7 @@ function appendTaskEvent(event: {
376378}
377379
378380function loadTaskRegistryDeliveryRuntime ( ) {
379- const deliveryRuntimeOverride = ( globalThis as TaskRegistryGlobalWithDeliveryOverride ) [
381+ const deliveryRuntimeOverride = ( globalThis as TaskRegistryGlobalWithRuntimeOverrides ) [
380382 TASK_REGISTRY_DELIVERY_RUNTIME_OVERRIDE_KEY
381383 ] ;
382384 if ( deliveryRuntimeOverride ) {
@@ -387,7 +389,7 @@ function loadTaskRegistryDeliveryRuntime() {
387389}
388390
389391function loadTaskRegistryControlRuntime ( ) {
390- const controlRuntimeOverride = ( globalThis as TaskRegistryGlobalWithDeliveryOverride ) [
392+ const controlRuntimeOverride = ( globalThis as TaskRegistryGlobalWithRuntimeOverrides ) [
391393 TASK_REGISTRY_CONTROL_RUNTIME_OVERRIDE_KEY
392394 ] ;
393395 if ( controlRuntimeOverride ) {
@@ -1978,28 +1980,28 @@ export function resetTaskRegistryForTests(opts?: { persist?: boolean }) {
19781980}
19791981
19801982export function resetTaskRegistryDeliveryRuntimeForTests ( ) {
1981- ( globalThis as TaskRegistryGlobalWithDeliveryOverride ) [
1983+ ( globalThis as TaskRegistryGlobalWithRuntimeOverrides ) [
19821984 TASK_REGISTRY_DELIVERY_RUNTIME_OVERRIDE_KEY
19831985 ] = null ;
19841986 deliveryRuntimePromise = null ;
19851987}
19861988
19871989export function setTaskRegistryDeliveryRuntimeForTests ( runtime : TaskRegistryDeliveryRuntime ) : void {
1988- ( globalThis as TaskRegistryGlobalWithDeliveryOverride ) [
1990+ ( globalThis as TaskRegistryGlobalWithRuntimeOverrides ) [
19891991 TASK_REGISTRY_DELIVERY_RUNTIME_OVERRIDE_KEY
19901992 ] = runtime ;
19911993 deliveryRuntimePromise = null ;
19921994}
19931995
19941996export function resetTaskRegistryControlRuntimeForTests ( ) {
1995- ( globalThis as TaskRegistryGlobalWithDeliveryOverride ) [
1997+ ( globalThis as TaskRegistryGlobalWithRuntimeOverrides ) [
19961998 TASK_REGISTRY_CONTROL_RUNTIME_OVERRIDE_KEY
19971999 ] = null ;
19982000 controlRuntimePromise = null ;
19992001}
20002002
20012003export function setTaskRegistryControlRuntimeForTests ( runtime : TaskRegistryControlRuntime ) : void {
2002- ( globalThis as TaskRegistryGlobalWithDeliveryOverride ) [
2004+ ( globalThis as TaskRegistryGlobalWithRuntimeOverrides ) [
20032005 TASK_REGISTRY_CONTROL_RUNTIME_OVERRIDE_KEY
20042006 ] = runtime ;
20052007 controlRuntimePromise = null ;
0 commit comments