UNPKG

dimensions-ai

Version:

A generalized AI Competition framework that allows you to create any competition you want in any language you want with no hassle.

75 lines (74 loc) 2.25 kB
import express from 'express'; import { Dimension } from '../Dimension'; import { Logger } from '../Logger'; import { Match } from '../Match'; import { Tournament } from '../Tournament'; import { Agent } from '../Agent'; import { Plugin } from '../Plugin'; import { DeepPartial } from '../utils/DeepPartial'; export declare const BOT_DIR: string; declare global { namespace Express { interface Request { data: { dimension?: Dimension; match?: Match; tournament?: Tournament; agent?: Agent; user?: Plugin.Database.User; [x: string]: any; }; } } } export declare class Station { app: express.Application; static _id: number; id: number; name: string; port: number; webport: number; maxAttempts: number; private log; private server; configs: Station.Configs; constructor(name: string, observedDimensions: Dimension | Array<Dimension>, configs?: DeepPartial<Station.Configs>); /** * Try to listen to this.maxAttempts ports. Resolves with the port nunber used */ private tryToListen; setLogLevel(level: Logger.LEVEL): void; /** * Restart Station server / API * Resolves with the port number used */ restart(): Promise<number>; /** * Stop the Station server / API */ stop(): Promise<void>; observe(dimension: Dimension): void; } export declare namespace Station { interface Configs { /** * Whether or not to allow bot uploads through the Station API. Note that you can still upload bots by changing the * row entry for the user's bot and updating the botKey and directly calling {@link Tournament.AddPlayer} and * providing full detils * * @default `false` */ disableUploads: boolean; /** * Logging level of station */ loggingLevel: Logger.LEVEL; /** * Whether or not requests need to be authenticated with a token or not. If false, all requests are assumed to be * the admin * * @default `true` */ requireAuth: boolean; } }