72 lines
2.2 KiB
TypeScript
72 lines
2.2 KiB
TypeScript
// Type declarations for the dependency-free setup helpers in setup-lib.mjs.
|
|
// The browser setup wizard server (src/bridge/setup-api.ts) imports this module
|
|
// at runtime from BOTH the dev (ts-node) and dist layouts via the relative path
|
|
// `../../scripts/setup-lib.mjs`, which resolves to <root>/scripts in either
|
|
// case (Codex P2 #7). These types let TypeScript check that usage.
|
|
|
|
export type ConnectionType = 'direct' | 'aao_gateway';
|
|
|
|
export const ALL_ROLES: readonly ['auto', 'fast', 'quality', 'title', 'reflection'];
|
|
export const CONNECTION_TYPES: readonly ConnectionType[];
|
|
|
|
export function parseEndpoint(
|
|
input: unknown,
|
|
): { endpoint: string; base: string; error?: undefined } | { error: string; endpoint?: undefined; base?: undefined };
|
|
|
|
export interface SnakeWorkerEntry {
|
|
id: string;
|
|
connection_type: ConnectionType;
|
|
endpoint: string;
|
|
model: string;
|
|
roles: string[];
|
|
max_concurrency: number;
|
|
enabled: boolean;
|
|
vlm: boolean;
|
|
api_key?: string;
|
|
}
|
|
|
|
export interface CamelWorkerEntry {
|
|
id: string;
|
|
connectionType: ConnectionType;
|
|
endpoint: string;
|
|
model: string;
|
|
roles: string[];
|
|
maxConcurrency: number;
|
|
enabled: boolean;
|
|
vlm: boolean;
|
|
apiKey?: string;
|
|
}
|
|
|
|
export interface BuildWorkerArgs {
|
|
connectionType: ConnectionType;
|
|
endpoint: string;
|
|
model: string;
|
|
apiKey?: string;
|
|
}
|
|
|
|
export function buildWorkerEntry(args: BuildWorkerArgs): SnakeWorkerEntry;
|
|
export function buildLlmWorkerCamel(args: BuildWorkerArgs): CamelWorkerEntry;
|
|
|
|
export function isLlmConfigured(
|
|
workers: ReadonlyArray<{ enabled?: boolean; endpoint?: unknown; model?: unknown } | null | undefined> | unknown,
|
|
): boolean;
|
|
|
|
export function renderConfigYaml(worker: SnakeWorkerEntry): string;
|
|
export function renderDotenv(existingText: string | undefined, opts: { port: number | string }): string;
|
|
|
|
export function parseAnswersFromEnv(
|
|
env: Record<string, string | undefined>,
|
|
): { answers: Record<string, unknown>; error?: undefined } | { error: string; answers?: undefined };
|
|
|
|
export interface ProbeArgs {
|
|
endpoint: string;
|
|
base: string;
|
|
apiKey?: string;
|
|
fetchImpl?: typeof fetch;
|
|
timeoutMs?: number;
|
|
}
|
|
|
|
export function probeModels(
|
|
args: ProbeArgs,
|
|
): Promise<{ ok: boolean; models: string[]; error?: string }>;
|