chore(lint): restore zero-error eslint baseline

This commit is contained in:
William Valentin
2026-02-15 22:25:29 -08:00
parent 8b529a18f2
commit 46538e71a8
11 changed files with 184 additions and 160 deletions
+1 -1
View File
@@ -504,7 +504,7 @@ export class AgentOrchestrator {
private _restoreHistory(messages: Message[]): void {
if (this._session) {
this._session.replaceHistory(messages);
return;
}
// No session available; nothing safe to do here.
}
+25 -25
View File
@@ -232,33 +232,33 @@ export function registerTuiCommand(program: Command): void {
process.exit(0);
});
if (opts.fullscreen) {
await startFullscreenTui({
session,
modelClient: modelRouter,
modelRouter,
systemPrompt,
model: config.models.default.model,
agent,
hookEngine,
modelProviderConfigs,
onExit: cleanup,
});
} else {
if (opts.fullscreen) {
await startFullscreenTui({
session,
modelClient: modelRouter,
modelRouter,
systemPrompt,
model: config.models.default.model,
agent,
hookEngine,
modelProviderConfigs,
onExit: cleanup,
});
} else {
let switchingToFullscreen = false;
const tui = new MinimalTui({
session,
modelClient: modelRouter,
modelRouter,
systemPrompt,
agent,
hookEngine,
pairingManager,
localProviders: config.models.local_providers,
modelProviderConfigs,
currentLocalProvider: config.models.local?.provider,
onTransfer: (target) => {
const tui = new MinimalTui({
session,
modelClient: modelRouter,
modelRouter,
systemPrompt,
agent,
hookEngine,
pairingManager,
localProviders: config.models.local_providers,
modelProviderConfigs,
currentLocalProvider: config.models.local?.provider,
onTransfer: (target) => {
if (target === 'telegram') {
if (config.telegram && config.telegram.allowed_chat_ids.length > 0) {
const telegramUserId = String(config.telegram.allowed_chat_ids[0]);
+96 -96
View File
@@ -57,115 +57,115 @@ function resolveZaiCredential(cfg: ModelConfig): string {
export function createClientFromConfig(cfg: ModelConfig): ModelClient {
switch (cfg.provider) {
case 'anthropic':
{
const authMode = getEffectiveAuthMode(cfg);
if (authMode === 'oauth') {
const token = cfg.auth_token ?? getAnthropicAuthToken();
if (!token) {
throw new Error(
'Anthropic auth token not configured (auth_mode: oauth). ' +
'Set ANTHROPIC_AUTH_TOKEN, run `flynn anthropic-auth --token`, or provide auth_token in config.',
);
}
return new AnthropicClient({
model: cfg.model,
authToken: token,
});
}
if (authMode === 'api_key') {
const apiKey = cfg.api_key ?? getAnthropicApiKey();
if (!apiKey) {
throw new Error(
'Anthropic API key not configured (auth_mode: api_key). ' +
'Set ANTHROPIC_API_KEY, run `flynn anthropic-auth`, or provide api_key in config.',
);
}
return new AnthropicClient({
model: cfg.model,
apiKey,
});
}
// auto: prefer API key, then token
const apiKey = cfg.api_key ?? getAnthropicApiKey();
if (apiKey) {
return new AnthropicClient({
model: cfg.model,
apiKey,
});
}
{
const authMode = getEffectiveAuthMode(cfg);
if (authMode === 'oauth') {
const token = cfg.auth_token ?? getAnthropicAuthToken();
if (token) {
return new AnthropicClient({
model: cfg.model,
authToken: token,
});
if (!token) {
throw new Error(
'Anthropic auth token not configured (auth_mode: oauth). ' +
'Set ANTHROPIC_AUTH_TOKEN, run `flynn anthropic-auth --token`, or provide auth_token in config.',
);
}
return new AnthropicClient({
model: cfg.model,
authToken: token,
});
}
throw new Error(
'Anthropic credentials not configured (auth_mode: auto). ' +
if (authMode === 'api_key') {
const apiKey = cfg.api_key ?? getAnthropicApiKey();
if (!apiKey) {
throw new Error(
'Anthropic API key not configured (auth_mode: api_key). ' +
'Set ANTHROPIC_API_KEY, run `flynn anthropic-auth`, or provide api_key in config.',
);
}
return new AnthropicClient({
model: cfg.model,
apiKey,
});
}
// auto: prefer API key, then token
const apiKey = cfg.api_key ?? getAnthropicApiKey();
if (apiKey) {
return new AnthropicClient({
model: cfg.model,
apiKey,
});
}
const token = cfg.auth_token ?? getAnthropicAuthToken();
if (token) {
return new AnthropicClient({
model: cfg.model,
authToken: token,
});
}
throw new Error(
'Anthropic credentials not configured (auth_mode: auto). ' +
'Set ANTHROPIC_API_KEY (or run `flynn anthropic-auth`), ' +
'or set ANTHROPIC_AUTH_TOKEN (or run `flynn anthropic-auth --token`).',
);
}
);
}
case 'openai':
{
const authMode = getEffectiveAuthMode(cfg);
if (authMode === 'oauth') {
const existing = loadStoredOpenAIAuth();
if (!existing) {
throw new Error(
'OpenAI OAuth is not configured (auth_mode: oauth). ' +
'Run `flynn openai-auth` to authenticate.',
);
}
return new OpenAIClient({
model: cfg.model,
useOAuth: true,
});
}
if (authMode === 'api_key') {
const apiKey = cfg.api_key ?? getOpenAIApiKey();
if (!apiKey) {
throw new Error(
'OpenAI API key not configured (auth_mode: api_key). ' +
'Set OPENAI_API_KEY, run `flynn openai-key`, or provide api_key in config.',
);
}
return new OpenAIClient({
model: cfg.model,
apiKey,
});
}
// auto: prefer API key, then OAuth
const apiKey = cfg.api_key ?? getOpenAIApiKey();
if (apiKey) {
return new OpenAIClient({
model: cfg.model,
apiKey,
});
}
{
const authMode = getEffectiveAuthMode(cfg);
if (authMode === 'oauth') {
const existing = loadStoredOpenAIAuth();
if (existing) {
return new OpenAIClient({
model: cfg.model,
useOAuth: true,
});
if (!existing) {
throw new Error(
'OpenAI OAuth is not configured (auth_mode: oauth). ' +
'Run `flynn openai-auth` to authenticate.',
);
}
return new OpenAIClient({
model: cfg.model,
useOAuth: true,
});
}
throw new Error(
'OpenAI credentials not configured (auth_mode: auto). ' +
if (authMode === 'api_key') {
const apiKey = cfg.api_key ?? getOpenAIApiKey();
if (!apiKey) {
throw new Error(
'OpenAI API key not configured (auth_mode: api_key). ' +
'Set OPENAI_API_KEY, run `flynn openai-key`, or provide api_key in config.',
);
}
return new OpenAIClient({
model: cfg.model,
apiKey,
});
}
// auto: prefer API key, then OAuth
const apiKey = cfg.api_key ?? getOpenAIApiKey();
if (apiKey) {
return new OpenAIClient({
model: cfg.model,
apiKey,
});
}
const existing = loadStoredOpenAIAuth();
if (existing) {
return new OpenAIClient({
model: cfg.model,
useOAuth: true,
});
}
throw new Error(
'OpenAI credentials not configured (auth_mode: auto). ' +
'Set OPENAI_API_KEY (or run `flynn openai-key`), ' +
'or run `flynn openai-auth` for OAuth.',
);
}
);
}
case 'ollama':
return new OllamaClient({
model: cfg.model,
+14 -14
View File
@@ -199,7 +199,7 @@ export function createMessageRouter(deps: {
effectiveToolRegistry = effectiveToolRegistry.clone();
effectiveToolRegistry.register(createMediaSendTool(collector));
const orchestrator = new AgentOrchestrator({
const orchestrator = new AgentOrchestrator({
modelRouter: deps.modelRouter,
systemPrompt: effectiveSystemPrompt,
session,
@@ -221,19 +221,19 @@ export function createMessageRouter(deps: {
memoryAutoExtract: deps.config.memory?.auto_extract,
memoryInjectionStrategy: deps.config.memory?.injection_strategy,
memoryMaxInjectionTokens: deps.config.memory?.max_injection_tokens,
toolPolicyContext: {
agent: effectiveTier,
provider: effectiveProvider,
sessionId: session.id,
channel,
sender: senderId,
tier: effectiveTier,
autonomyLevel: deps.config.agents.autonomy_level ?? 'standard',
skillName: activeSkillName,
skillPermissions: activeSkill?.manifest.permissions,
allowedSecretScopes: activeSkill?.manifest.permissions?.secrets,
executionEnvironment,
},
toolPolicyContext: {
agent: effectiveTier,
provider: effectiveProvider,
sessionId: session.id,
channel,
sender: senderId,
tier: effectiveTier,
autonomyLevel: deps.config.agents.autonomy_level ?? 'standard',
skillName: activeSkillName,
skillPermissions: activeSkill?.manifest.permissions,
allowedSecretScopes: activeSkill?.manifest.permissions?.secrets,
executionEnvironment,
},
attachmentCollector: collector,
});
entry = { orchestrator, collector };
+1 -1
View File
@@ -117,7 +117,7 @@ export function App({
if (!hookEngine) {return;}
hookEngine.setInteractiveConfirmer(async (pending) => {
return await new Promise<HookResult>((resolve) => {
return new Promise<HookResult>((resolve) => {
confirmResolveRef.current = resolve;
setConfirmation({ tool: pending.tool, args: pending.args });
});
+1 -1
View File
@@ -8,7 +8,7 @@ import type { GatewayResponse, GatewayError, GatewayEvent } from './protocol.js'
import { ErrorCode } from './protocol.js';
async function canListenOnLocalhost(): Promise<boolean> {
return await new Promise((resolvePromise) => {
return new Promise((resolvePromise) => {
const s = createServer();
s.once('error', () => resolvePromise(false));
s.listen(0, '127.0.0.1', () => {
+14 -14
View File
@@ -17,7 +17,7 @@ let _el = null;
async function loadSettings() {
if (!_client || !_el) {return;}
let config, tools, channels;
let config, tools, channels;
let services;
try {
@@ -101,18 +101,18 @@ async function loadSettings() {
${serviceList.length > 0 ? `
<div class="services-grid">
${serviceList.map(svc => {
const typeIcon = svc.type === 'channel' ? '📡' : svc.type === 'automation' ? '⚙️' : '🔧';
const statusClass = svc.status === 'connected'
? 'connected'
: svc.status === 'configured'
? 'configured'
: svc.status === 'error'
? 'error'
: svc.status === 'not_configured'
? 'not-configured'
: 'disconnected';
const itemCount = svc.itemCount ? ` (${svc.itemCount})` : '';
return `
const typeIcon = svc.type === 'channel' ? '📡' : svc.type === 'automation' ? '⚙️' : '🔧';
const statusClass = svc.status === 'connected'
? 'connected'
: svc.status === 'configured'
? 'configured'
: svc.status === 'error'
? 'error'
: svc.status === 'not_configured'
? 'not-configured'
: 'disconnected';
const itemCount = svc.itemCount ? ` (${svc.itemCount})` : '';
return `
<div class="service-card service-${statusClass}">
<span class="service-type-icon">${typeIcon}</span>
<span class="service-name">${escapeHtml(svc.name)}${itemCount}</span>
@@ -120,7 +120,7 @@ async function loadSettings() {
<span class="service-description text-muted text-xs">${escapeHtml(svc.description ?? '')}</span>
</div>
`;
}).join('')}
}).join('')}
</div>
` : '<div class="text-muted text-sm">No services found</div>'}
</div>
+1 -1
View File
@@ -48,7 +48,7 @@ export class HookEngine {
const id = randomUUID();
if (this.interactiveConfirmer) {
return await this.interactiveConfirmer({ id, tool, args });
return this.interactiveConfirmer({ id, tool, args });
}
return new Promise((resolve) => {
+2 -2
View File
@@ -47,7 +47,7 @@ const cancellableTool: Tool = {
description: 'Long-running cancellable tool',
inputSchema: { type: 'object', properties: {} },
execute: async (_args, context) => {
return await new Promise((resolve) => {
return new Promise((resolve) => {
const onAbort = () => resolve({ success: false, output: '', error: 'aborted' });
if (context?.signal?.aborted) {
onAbort();
@@ -65,7 +65,7 @@ function createSideEffectTool(sideEffect: { fired: boolean }): Tool {
description: 'Cancellable side effect',
inputSchema: { type: 'object', properties: {} },
execute: async (_args, context) => {
return await new Promise((resolve) => {
return new Promise((resolve) => {
const timer = setTimeout(() => {
sideEffect.fired = true;
resolve({ success: true, output: 'side effect fired' });