3b2a16b151
Introduce a minimal operations console reachable on a dedicated UI port (default 8081), kept separate from the OpenAI-compatible API port. - ts_web/ holds the SPA shell (index.html, app.css, vanilla app.js) with sidebar navigation for all views from readme.ui.md and a working Overview page backed by a new /_ui/overview JSON endpoint. - scripts/bundle-ui.ts walks ts_web/ and emits ts_bundled/bundle.ts, a single generated module exporting every asset as base64. Mirrors the @stack.gallery/registry pattern so deno compile binaries embed the entire UI with no external filesystem dependency at runtime. - ts/ui/server.ts (UiServer) serves assets from either the bundled map (default, prod) or directly from ts_web/ on disk (dev). The source is chosen per-config and can be overridden by UI_ASSET_SOURCE=disk|bundle. SPA fallback routes unknown extensionless paths to index.html. - IModelGridConfig.ui block with enabled/port/host/assetSource defaults; config init writes the block, the normalizer fills in defaults on load, and the daemon starts/stops the UI server alongside the API. - deno.json gains a bundle:ui task; compile:all now depends on it so released binaries always contain an up-to-date bundle. dev task sets UI_ASSET_SOURCE=disk for hot edits. - ts_bundled/ is gitignored (generated on build). - test/ui-server.smoke.ts exercises bundle and disk modes end to end (index, app.js, SPA fallback, /_ui/overview, 404).
123 lines
3.2 KiB
TypeScript
123 lines
3.2 KiB
TypeScript
/**
|
|
* ModelGrid configuration interfaces.
|
|
*/
|
|
|
|
import type { IModelCatalog, IModelCatalogEntry } from './catalog.ts';
|
|
import type { IClusterConfig } from './cluster.ts';
|
|
import type { IContainerConfig } from './container.ts';
|
|
|
|
/**
|
|
* API server configuration
|
|
*/
|
|
export interface IApiConfig {
|
|
/** Port to listen on (default: 8080) */
|
|
port: number;
|
|
/** Host to bind to (default: '0.0.0.0') */
|
|
host: string;
|
|
/** Valid API keys for authentication */
|
|
apiKeys: string[];
|
|
/** Rate limit in requests per minute (optional) */
|
|
rateLimit?: number;
|
|
/** Enable CORS (default: false) */
|
|
cors?: boolean;
|
|
/** Allowed origins for CORS */
|
|
corsOrigins?: string[];
|
|
}
|
|
|
|
/**
|
|
* Docker/container runtime configuration
|
|
*/
|
|
export interface IDockerConfig {
|
|
/** Docker network name (default: 'modelgrid') */
|
|
networkName: string;
|
|
/** Container runtime to use */
|
|
runtime: 'docker' | 'podman';
|
|
/** Path to docker/podman socket (optional) */
|
|
socketPath?: string;
|
|
}
|
|
|
|
/**
|
|
* GPU assignment configuration
|
|
*/
|
|
export interface IGpuAssignmentConfig {
|
|
/** Whether to auto-detect GPUs */
|
|
autoDetect: boolean;
|
|
/** Manual GPU to container assignments (gpuId -> containerId) */
|
|
assignments: Record<string, string>;
|
|
}
|
|
|
|
/**
|
|
* Model management configuration
|
|
*/
|
|
export interface IModelConfig {
|
|
/** URL to fetch the public catalog */
|
|
registryUrl: string;
|
|
/** Whether to auto-start a deployment when requested */
|
|
autoDeploy: boolean;
|
|
/** Default engine for new deployments */
|
|
defaultEngine: 'vllm';
|
|
/** Models to auto-load on startup */
|
|
autoLoad: string[];
|
|
}
|
|
|
|
/**
|
|
* Browser-based operations console (UI) configuration.
|
|
* The UI is served on its own port, distinct from the OpenAI API port,
|
|
* so that the data plane stays clean.
|
|
*/
|
|
export interface IUiConfig {
|
|
/** Whether to start the UI server alongside the API */
|
|
enabled: boolean;
|
|
/** Port to bind the UI server to (default: 8081) */
|
|
port: number;
|
|
/** Host to bind the UI server to (default: '0.0.0.0') */
|
|
host: string;
|
|
/**
|
|
* Where UI assets come from.
|
|
* - 'bundle': from the compiled-in `ts_bundled/bundle.ts` (default, required
|
|
* for `deno compile` single-binary builds)
|
|
* - 'disk': read on demand from `ts_web/` for the dev loop
|
|
* Overridden at runtime by the `UI_ASSET_SOURCE` env var.
|
|
*/
|
|
assetSource: 'bundle' | 'disk';
|
|
}
|
|
|
|
/**
|
|
* Main ModelGrid configuration interface
|
|
*/
|
|
export interface IModelGridConfig {
|
|
/** Configuration format version */
|
|
version: string;
|
|
/** API server configuration */
|
|
api: IApiConfig;
|
|
/** UI server configuration */
|
|
ui: IUiConfig;
|
|
/** Docker configuration */
|
|
docker: IDockerConfig;
|
|
/** GPU configuration */
|
|
gpus: IGpuAssignmentConfig;
|
|
/** Container configurations */
|
|
containers: IContainerConfig[];
|
|
/** Model management configuration */
|
|
models: IModelConfig;
|
|
/** Cluster configuration */
|
|
cluster: IClusterConfig;
|
|
/** Health check interval in milliseconds */
|
|
checkInterval: number;
|
|
}
|
|
|
|
export type IRegistryModel = IModelCatalogEntry;
|
|
export type IRegistryCatalog = IModelCatalog;
|
|
|
|
/**
|
|
* Update status information
|
|
*/
|
|
export interface IUpdateStatus {
|
|
/** Current installed version */
|
|
currentVersion: string;
|
|
/** Latest available version */
|
|
latestVersion: string;
|
|
/** Whether an update is available */
|
|
updateAvailable: boolean;
|
|
}
|