File size: 684 Bytes
68d7816
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import type { IAgentScopeHandle } from '#/_base/di/scope';
import type { AgentContext } from '#/agent/agentContext/agentContext';
import { AgentSpaceImpl } from '#/agent/agentContext/agentSpace';
import type { MachineEngineAttachBundle } from '#/agent/loop/machine/engine';
import type { AgentActorRef } from '#human/session/machine';

export class ManagedAgent {
  active = false;
  closing = false;
  ref?: AgentActorRef;
  bundle?: MachineEngineAttachBundle;

  constructor(
    readonly context: AgentContext,
    readonly handle: IAgentScopeHandle,
  ) {}

  killSpace(): void {
    const space = this.context.space;
    if (space instanceof AgentSpaceImpl) space._kill();
  }
}