feat(FN-1757): clear residual lint debt in engine package
- Remove unused imports across 25 files in engine package - Remove unused variable declarations in ipc-worker.ts, child-process-runtime.ts, and mission-autopilot.ts - Clean up unnecessary imports in agent-instructions.ts, agent-tools.ts, cron-runner.ts, executor.ts, and other modules - Minor cleanup in notifier.ts, peer-exchange-service.ts, pi.ts, plugin-runner.ts, and other files - Improves code quality and reduces potential confusion from unused code
This commit is contained in:
@@ -109,7 +109,7 @@ function formatPerformanceFeedbackSection(ratingSummary: AgentRatingSummary): st
|
||||
if (recentComments.length > 0) {
|
||||
lines.push("- Recent feedback:");
|
||||
for (const rating of recentComments) {
|
||||
lines.push(` - \"${rating.comment?.trim()}\" (score: ${rating.score.toFixed(1)})`);
|
||||
lines.push(` - "${rating.comment?.trim()}" (score: ${rating.score.toFixed(1)})`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,6 +164,7 @@ export function createTaskDocumentWriteTool(store: TaskStore, taskId: string): T
|
||||
}],
|
||||
details: {},
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
return {
|
||||
content: [{
|
||||
@@ -231,6 +232,7 @@ export function createTaskDocumentReadTool(store: TaskStore, taskId: string): To
|
||||
}],
|
||||
details: {},
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
return {
|
||||
content: [{
|
||||
|
||||
@@ -226,6 +226,7 @@ export class CronRunner {
|
||||
startedAt,
|
||||
completedAt: new Date().toISOString(),
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
const stdout = err.stdout ?? "";
|
||||
const stderr = err.stderr ?? "";
|
||||
@@ -333,6 +334,7 @@ export class CronRunner {
|
||||
stepIndex,
|
||||
success: false,
|
||||
output: "",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
error: `Unknown step type: "${(step as any).type}"`,
|
||||
startedAt: stepStartedAt,
|
||||
completedAt: new Date().toISOString(),
|
||||
@@ -377,6 +379,7 @@ export class CronRunner {
|
||||
startedAt,
|
||||
completedAt: new Date().toISOString(),
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
const stdout = err.stdout ?? "";
|
||||
const stderr = err.stderr ?? "";
|
||||
@@ -470,6 +473,7 @@ export class CronRunner {
|
||||
startedAt,
|
||||
completedAt: new Date().toISOString(),
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
const errorMessage = err.message ?? String(err);
|
||||
log.warn(` ✗ AI prompt step "${step.name}" failed: ${errorMessage}`);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { exec } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
@@ -6,7 +7,7 @@ import { join } from "node:path";
|
||||
import { existsSync } from "node:fs";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import type { TaskStore, Task, TaskDetail, StepStatus, Settings, WorkflowStep, MissionStore, Slice, AgentState, AgentCapability, RunMutationContext } from "@fusion/core";
|
||||
import type { AgentStore } from "@fusion/core";
|
||||
|
||||
import { buildExecutionMemoryInstructions, getTaskMergeBlocker, resolveAgentPrompt } from "@fusion/core";
|
||||
import { findWorktreeUser } from "./merger.js";
|
||||
import { generateWorktreeName, slugify } from "./worktree-names.js";
|
||||
@@ -27,7 +28,7 @@ import { computeRecoveryDecision, formatDelay, MAX_RECOVERY_RETRIES } from "./re
|
||||
import type { StuckTaskDetector, StuckTaskEvent } from "./stuck-task-detector.js";
|
||||
import type { PluginRunner } from "./plugin-runner.js";
|
||||
import { isContextLimitError } from "./context-limit-detector.js";
|
||||
import { StepSessionExecutor, type StepSessionExecutorOptions, type StepResult } from "./step-session-executor.js";
|
||||
import { StepSessionExecutor } from "./step-session-executor.js";
|
||||
import { resolveAgentInstructions, buildSystemPromptWithInstructions } from "./agent-instructions.js";
|
||||
import type { AgentReflectionService } from "./agent-reflection.js";
|
||||
import { createRunAuditor, generateSyntheticRunId, type EngineRunContext } from "./run-audit.js";
|
||||
@@ -38,8 +39,6 @@ import {
|
||||
createTaskDocumentReadTool as sharedCreateTaskDocumentReadTool,
|
||||
createTaskDocumentWriteTool as sharedCreateTaskDocumentWriteTool,
|
||||
createTaskLogTool as sharedCreateTaskLogTool,
|
||||
taskCreateParams,
|
||||
taskLogParams,
|
||||
} from "./agent-tools.js";
|
||||
import { getTaskCompletionBlockerForStore } from "./task-completion.js";
|
||||
|
||||
@@ -650,8 +649,8 @@ export class TaskExecutor {
|
||||
*/
|
||||
private async executeReviewHandoff(
|
||||
task: Task,
|
||||
session: AgentSession,
|
||||
sessionEntry: { session: AgentSession; seenSteeringIds: Set<string>; lastModelProvider?: string | null; lastModelId?: string | null },
|
||||
_session: AgentSession,
|
||||
_sessionEntry: { session: AgentSession; seenSteeringIds: Set<string>; lastModelProvider?: string | null; lastModelId?: string | null },
|
||||
): Promise<void> {
|
||||
try {
|
||||
executorLog.log(`Executing review handoff for ${task.id}`);
|
||||
@@ -1292,7 +1291,9 @@ export class TaskExecutor {
|
||||
await execAsync(`git worktree remove "${worktreePath}" --force`, { cwd: this.rootDir });
|
||||
// Audit trail: record worktree removal (FN-1404)
|
||||
await audit.git({ type: "worktree:remove", target: worktreePath });
|
||||
} catch {}
|
||||
} catch (_err) {
|
||||
// Ignore errors during worktree cleanup on stuck kill
|
||||
}
|
||||
}
|
||||
await this.store.updateTask(task.id, {
|
||||
recoveryRetryCount: decision.nextState.recoveryRetryCount,
|
||||
@@ -1341,7 +1342,9 @@ export class TaskExecutor {
|
||||
if (worktreePath && existsSync(worktreePath)) {
|
||||
try {
|
||||
await execAsync(`git worktree remove "${worktreePath}" --force`, { cwd: this.rootDir });
|
||||
} catch {}
|
||||
} catch (_err) {
|
||||
// Ignore errors during worktree cleanup on stuck kill
|
||||
}
|
||||
}
|
||||
await this.store.updateTask(task.id, { status: "stuck-killed", worktree: null, branch: null });
|
||||
if (task.column !== "todo") {
|
||||
@@ -1435,6 +1438,7 @@ export class TaskExecutor {
|
||||
executorInstructions,
|
||||
);
|
||||
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { session, sessionFile } = await createKbAgent({
|
||||
cwd: worktreePath,
|
||||
systemPrompt: executorSystemPrompt,
|
||||
@@ -3477,7 +3481,7 @@ and show an appropriate message to the user.\`
|
||||
cwd: this.rootDir,
|
||||
});
|
||||
await this.store.logEntry(taskId, `Unlocked worktree`, worktreePath);
|
||||
} catch {
|
||||
} catch (_err) {
|
||||
// Unlock failed - worktree wasn't locked, that's fine
|
||||
}
|
||||
|
||||
@@ -3486,10 +3490,8 @@ and show an appropriate message to the user.\`
|
||||
await execAsync(`git worktree remove "${worktreePath}" --force`, {
|
||||
cwd: this.rootDir,
|
||||
});
|
||||
} finally {
|
||||
await this.store.logEntry(taskId, `Removed conflicting worktree`, worktreePath);
|
||||
} catch (e: any) {
|
||||
// Re-throw to be caught by outer catch for proper error logging
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Delete the branch if it exists
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
RuntimeStatus,
|
||||
GlobalMetrics,
|
||||
} from "./project-runtime.js";
|
||||
import type { ProjectManagerEvents } from "./project-manager.js";
|
||||
|
||||
import { hybridExecutorLog } from "./logger.js";
|
||||
|
||||
/**
|
||||
@@ -261,7 +261,7 @@ export class HybridExecutor extends EventEmitter<HybridExecutorEvents> {
|
||||
throw new Error(`Runtime not found for project ${projectId}`);
|
||||
}
|
||||
|
||||
const currentStatus = existingRuntime.getStatus();
|
||||
const _currentStatus = existingRuntime.getStatus();
|
||||
const currentMode =
|
||||
existingRuntime instanceof
|
||||
(await import("./runtimes/child-process-runtime.js")).ChildProcessRuntime
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EventEmitter } from "node:events";
|
||||
import type { ChildProcess } from "node:child_process";
|
||||
import type { IpcMessage, IpcCommandType, IpcResponseType } from "./ipc-protocol.js";
|
||||
import type { IpcMessage, IpcCommandType } from "./ipc-protocol.js";
|
||||
import { OK, ERROR, PONG, generateCorrelationId } from "./ipc-protocol.js";
|
||||
import { ipcLog } from "../logger.js";
|
||||
|
||||
@@ -151,7 +151,7 @@ export class IpcHost extends EventEmitter {
|
||||
this.disconnected = true;
|
||||
|
||||
// Reject all pending commands
|
||||
for (const [id, pending] of this.pendingCommands) {
|
||||
for (const [_id, pending] of this.pendingCommands) {
|
||||
clearTimeout(pending.timeout);
|
||||
pending.reject(new Error(`IPC disconnected: ${error.message}`));
|
||||
}
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
* 3. Worker can also send events unsolicited (task events, health changes)
|
||||
*/
|
||||
|
||||
import type { RuntimeStatus, RuntimeMetrics, ProjectRuntimeConfig } from "../project-runtime.js";
|
||||
import type { Task, TaskStore } from "@fusion/core";
|
||||
import type { Scheduler } from "../scheduler.js";
|
||||
import type { RuntimeStatus, ProjectRuntimeConfig } from "../project-runtime.js";
|
||||
import type { Task } from "@fusion/core";
|
||||
|
||||
// ── Base Message Types ────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -4,12 +4,6 @@ import {
|
||||
OK,
|
||||
ERROR,
|
||||
PONG,
|
||||
START_RUNTIME,
|
||||
STOP_RUNTIME,
|
||||
GET_STATUS,
|
||||
GET_METRICS,
|
||||
GET_TASK_STORE,
|
||||
GET_SCHEDULER,
|
||||
PING,
|
||||
ERROR_EVENT,
|
||||
isIpcCommand,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { execSync, exec } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
@@ -632,8 +633,8 @@ async function attemptInMergeVerificationFix(
|
||||
},
|
||||
settings: Settings,
|
||||
options: MergerOptions,
|
||||
testCommand?: string,
|
||||
buildCommand?: string,
|
||||
_testCommand?: string,
|
||||
_buildCommand?: string,
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
mergerLog.log(`${taskId}: spawning in-merge verification fix agent`);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
import type {
|
||||
TaskStore,
|
||||
MissionStore,
|
||||
Mission,
|
||||
AutopilotState,
|
||||
AutopilotStatus,
|
||||
Slice,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { TaskStore, Task, Column, Settings, MergeResult, NtfyNotificationEvent } from "@fusion/core";
|
||||
import { EventEmitter } from "node:events";
|
||||
import type { Task, Column, Settings, MergeResult, NtfyNotificationEvent } from "@fusion/core";
|
||||
import { schedulerLog } from "./logger.js";
|
||||
|
||||
export interface NtfyNotifierOptions {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CentralCore } from "@fusion/core";
|
||||
import type { NodeConfig, PeerInfo, PeerSyncRequest, PeerSyncResponse } from "@fusion/core";
|
||||
import type { NodeConfig, PeerSyncRequest, PeerSyncResponse } from "@fusion/core";
|
||||
import { peerExchangeLog } from "./logger.js";
|
||||
|
||||
export interface PeerExchangeServiceOptions {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Provides factory functions for creating triage and executor agent sessions.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { exec } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
@@ -396,7 +397,6 @@ export function wrapToolsWithBoundary(
|
||||
}
|
||||
|
||||
// Store the original execute function
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const originalExecute = tool.execute as any;
|
||||
|
||||
|
||||
@@ -404,9 +404,9 @@ export function wrapToolsWithBoundary(
|
||||
...tool,
|
||||
|
||||
execute: async (...args: any[]) => {
|
||||
const toolCallId = args[0] as string;
|
||||
const _toolCallId = args[0] as string;
|
||||
const params = args[1] as Record<string, unknown>;
|
||||
const signal = args[2] as AbortSignal | undefined;
|
||||
const _signal = args[2] as AbortSignal | undefined;
|
||||
|
||||
// Check path argument for file operations
|
||||
const pathArg = params.path as string | undefined;
|
||||
@@ -528,7 +528,6 @@ export async function createKbAgent(options: AgentOptions): Promise<AgentResult>
|
||||
authStorage,
|
||||
modelRegistry,
|
||||
resourceLoader,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
tools: wrappedTools as any,
|
||||
customTools: options.customTools,
|
||||
sessionManager,
|
||||
|
||||
@@ -502,7 +502,7 @@ export class PluginRunner {
|
||||
this.hookTimeoutMs,
|
||||
`Hook ${hookName} timed out`,
|
||||
);
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
// Error already logged by invokeHook
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,6 +296,7 @@ export class PrMonitor {
|
||||
tracked.consecutiveErrors = 0;
|
||||
tracked.lastCheckedAt = new Date();
|
||||
return true;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
tracked.consecutiveErrors++;
|
||||
prMonitorLog.error(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import type {
|
||||
TaskStore,
|
||||
Task,
|
||||
@@ -17,7 +18,7 @@ import { CronRunner, createAiPromptExecutor } from "./cron-runner.js";
|
||||
import { aiMergeTask } from "./merger.js";
|
||||
import { PRIORITY_MERGE } from "./concurrency.js";
|
||||
import { runtimeLog } from "./logger.js";
|
||||
import type { HeartbeatMonitor, HeartbeatTriggerScheduler } from "./agent-heartbeat.js";
|
||||
import type { HeartbeatTriggerScheduler } from "./agent-heartbeat.js";
|
||||
|
||||
/**
|
||||
* Callback for processing pull-request merge strategy.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EventEmitter } from "node:events";
|
||||
import type { Task, CentralCore, RegisteredProject } from "@fusion/core";
|
||||
import type { Task, CentralCore } from "@fusion/core";
|
||||
import { InProcessRuntime } from "./runtimes/in-process-runtime.js";
|
||||
import { ChildProcessRuntime } from "./runtimes/child-process-runtime.js";
|
||||
import { RemoteNodeRuntime } from "./runtimes/remote-node-runtime.js";
|
||||
|
||||
@@ -77,6 +77,7 @@ export async function withRateLimitRetry<T>(
|
||||
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
||||
try {
|
||||
return await fn();
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
const error = err instanceof Error ? err : new Error(String(err));
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ export class RoutineScheduler {
|
||||
// Update next run time
|
||||
if (routine.cronExpression) {
|
||||
try {
|
||||
const nextRun = CronExpressionParser.parse(routine.cronExpression).next();
|
||||
const _nextRun = CronExpressionParser.parse(routine.cronExpression).next();
|
||||
// Note: We can't update nextRunAt directly as it's derived from trigger
|
||||
// The RoutineStore handles this internally
|
||||
} catch (err) {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* This ensures manual/non-run paths are unaffected by audit instrumentation.
|
||||
*/
|
||||
|
||||
import type { TaskStore, RunAuditEventInput, RunAuditDomain } from "@fusion/core";
|
||||
import type { TaskStore, RunAuditEventInput } from "@fusion/core";
|
||||
|
||||
/** Structured context for a run correlation ID. */
|
||||
export interface EngineRunContext {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { fork, type ChildProcess } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname, join } from "node:path";
|
||||
import type {
|
||||
Task,
|
||||
TaskStore,
|
||||
CentralCore,
|
||||
} from "@fusion/core";
|
||||
@@ -19,7 +18,6 @@ import { IpcHost } from "../ipc/ipc-host.js";
|
||||
import {
|
||||
START_RUNTIME,
|
||||
STOP_RUNTIME,
|
||||
GET_STATUS,
|
||||
GET_METRICS,
|
||||
TASK_CREATED,
|
||||
TASK_MOVED,
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* by cleaning oldest idle worktrees when count exceeds 2× maxWorktrees.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { exec } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
import { existsSync, readdirSync, statSync } from "node:fs";
|
||||
|
||||
@@ -385,7 +385,7 @@ export function createSkillsOverrideFromSelection(
|
||||
|
||||
// Log diagnostics if any
|
||||
if (newDiagnostics.length > 0) {
|
||||
const purpose = sessionPurpose ? `[${sessionPurpose}]` : "skills";
|
||||
const _purpose = sessionPurpose ? `[${sessionPurpose}]` : "skills";
|
||||
for (const diag of newDiagnostics) {
|
||||
console.error(`[pi] [skills] ${diag.type}: ${diag.message}`);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import type {
|
||||
TaskStore,
|
||||
Task,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { exec } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
import { existsSync, readdirSync, rmSync } from "node:fs";
|
||||
|
||||
Reference in New Issue
Block a user