chore: enforce erasable TypeScript syntax

This commit is contained in:
Mario Zechner
2026-05-19 23:15:39 +02:00
parent 48b6510c18
commit 06c6c324d7
17 changed files with 122 additions and 74 deletions

View File

@@ -67,14 +67,25 @@ function extractUserMessageText(content: string | Array<{ type: string; text?: s
export class AgentSessionRuntime {
private rebindSession?: (session: AgentSession) => Promise<void>;
private beforeSessionInvalidate?: () => void;
private _session: AgentSession;
private _services: AgentSessionServices;
private readonly createRuntime: CreateAgentSessionRuntimeFactory;
private _diagnostics: AgentSessionRuntimeDiagnostic[];
private _modelFallbackMessage?: string;
constructor(
private _session: AgentSession,
private _services: AgentSessionServices,
private readonly createRuntime: CreateAgentSessionRuntimeFactory,
private _diagnostics: AgentSessionRuntimeDiagnostic[] = [],
private _modelFallbackMessage?: string,
) {}
_session: AgentSession,
_services: AgentSessionServices,
createRuntime: CreateAgentSessionRuntimeFactory,
_diagnostics: AgentSessionRuntimeDiagnostic[] = [],
_modelFallbackMessage?: string,
) {
this._session = _session;
this._services = _services;
this.createRuntime = createRuntime;
this._diagnostics = _diagnostics;
this._modelFallbackMessage = _modelFallbackMessage;
}
get services(): AgentSessionServices {
return this._services;

View File

@@ -50,7 +50,11 @@ export interface AuthStorageBackend {
}
export class FileAuthStorageBackend implements AuthStorageBackend {
constructor(private authPath: string = join(getAgentDir(), "auth.json")) {}
private authPath: string;
constructor(authPath: string = join(getAgentDir(), "auth.json")) {
this.authPath = authPath;
}
private ensureParentDir(): void {
const dir = dirname(this.authPath);
@@ -194,8 +198,10 @@ export class AuthStorage {
private fallbackResolver?: (provider: string) => string | undefined;
private loadError: Error | null = null;
private errors: Error[] = [];
private storage: AuthStorageBackend;
private constructor(private storage: AuthStorageBackend) {
private constructor(storage: AuthStorageBackend) {
this.storage = storage;
this.reload();
}

View File

@@ -334,11 +334,12 @@ export class ModelRegistry {
private modelRequestHeaders: Map<string, Record<string, string>> = new Map();
private registeredProviders: Map<string, ProviderConfigInput> = new Map();
private loadError: string | undefined = undefined;
readonly authStorage: AuthStorage;
private modelsJsonPath: string | undefined;
private constructor(
readonly authStorage: AuthStorage,
private modelsJsonPath: string | undefined,
) {
private constructor(authStorage: AuthStorage, modelsJsonPath: string | undefined) {
this.authStorage = authStorage;
this.modelsJsonPath = modelsJsonPath;
this.loadModels();
}