Download packages/agent-core-v2/src/agent/modeMutex/modeMutexService.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/agent/modeMutex/modeMutexService.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/src/agent/modeMutex/modeMutexService.ts
-
curl -L -o modeMutexService.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/agent/modeMutex/modeMutexService.ts
1.84 kB
| import { Disposable } from '#/_base/di/lifecycle'; | |
| import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; | |
| import { IAgentStateService } from '#/agent/state/agentState'; | |
| import { IEventBus } from '#/app/event/eventBus'; | |
| import { LifecycleScope } from '#/app/scopes'; | |
| import { IAgentPlanService } from '#/features/plan/plan'; | |
| import { PlanModeEnter, planKey } from '#/features/plan/planOps'; | |
| import { IAgentSwarmService } from '#/features/swarm/agent/swarm'; | |
| import { SwarmModeEnter } from '#/features/swarm/swarmOps'; | |
| import { IAgentTowerService } from '#/features/tower/tower'; | |
| import { TowerModeEnter } from '#/features/tower/towerOps'; | |
| import { IAgentModeMutexService } from './modeMutex'; | |
| export class AgentModeMutexService extends Disposable implements IAgentModeMutexService { | |
| declare readonly _serviceBrand: undefined; | |
| constructor( | |
| private readonly plan: IAgentPlanService, | |
| private readonly swarm: IAgentSwarmService, | |
| private readonly tower: IAgentTowerService, | |
| private readonly agentState: IAgentStateService, | |
| eventBus: IEventBus, | |
| ) { | |
| super(); | |
| this._register( | |
| eventBus.subscribe(PlanModeEnter, () => { | |
| if (this.tower.isActive) void this.tower.exit(); | |
| }), | |
| ); | |
| this._register( | |
| eventBus.subscribe(SwarmModeEnter, () => { | |
| if (this.tower.isActive) void this.tower.exit(); | |
| }), | |
| ); | |
| this._register( | |
| eventBus.subscribe(TowerModeEnter, () => { | |
| if (this.agentState.get(planKey).active) this.plan.exit(); | |
| if (this.swarm.isActive) this.swarm.exit(); | |
| }), | |
| ); | |
| } | |
| } | |
| registerScopedService( | |
| LifecycleScope.Agent, | |
| IAgentModeMutexService, | |
| AgentModeMutexService, | |
| ScopeActivation.OnScopeCreated, | |
| 'modeMutex', | |
| ); | |