fix: lint and format issues from backported upstream code

Auto-fix import ordering and formatting via biome. Fix noVoidTypeReturn
in DockerOrchestrator adapter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 13:49:14 -04:00
parent 9e0410ca41
commit f2442563d9
7 changed files with 28 additions and 30 deletions
+4 -4
View File
@@ -12,7 +12,7 @@ import path from 'node:path';
import { setTimeout as sleep } from 'node:timers/promises'; import { setTimeout as sleep } from 'node:timers/promises';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { getMode } from './mode.js'; import { getMode } from './mode.js';
import type { Orchestrator, WorkerHandle, WorkerOptions as OrchestratorWorkerOptions } from './orchestrator.js'; import type { Orchestrator, WorkerOptions as OrchestratorWorkerOptions, WorkerHandle } from './orchestrator.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -301,7 +301,7 @@ export class DockerOrchestrator implements Orchestrator {
return ensureInfra(); return ensureInfra();
} }
ensureImage(version: string): void { ensureImage(version: string): void {
return ensureImage(version); ensureImage(version);
} }
spawnWorker(opts: OrchestratorWorkerOptions): WorkerHandle { spawnWorker(opts: OrchestratorWorkerOptions): WorkerHandle {
const proc = spawnWorker(opts as WorkerOptions); const proc = spawnWorker(opts as WorkerOptions);
@@ -315,10 +315,10 @@ export class DockerOrchestrator implements Orchestrator {
}; };
} }
stopWorkers(): void { stopWorkers(): void {
return stopWorkers(); stopWorkers();
} }
stopInfra(clean: boolean): void { stopInfra(clean: boolean): void {
return stopInfra(clean); stopInfra(clean);
} }
listRunningWorkers(): string { listRunningWorkers(): string {
return listRunningWorkers(); return listRunningWorkers();
@@ -30,22 +30,13 @@ export interface CheckpointProvider {
* Return { skip: true, metrics } to skip the agent (e.g., output files already exist). * Return { skip: true, metrics } to skip the agent (e.g., output files already exist).
* Return { skip: false } to run normally. * Return { skip: false } to run normally.
*/ */
shouldSkipAgent( shouldSkipAgent(agentName: string, repoPath: string, deliverablesSubdir: string): Promise<SkipDecision>;
agentName: string,
repoPath: string,
deliverablesSubdir: string,
): Promise<SkipDecision>;
/** /**
* Called after an agent activity succeeds. * Called after an agent activity succeeds.
* Receives pipeline state and optional file context for artifact persistence. * Receives pipeline state and optional file context for artifact persistence.
*/ */
onAgentComplete( onAgentComplete(agentName: string, phase: string, state: PipelineState, context?: CheckpointContext): Promise<void>;
agentName: string,
phase: string,
state: PipelineState,
context?: CheckpointContext,
): Promise<void>;
} }
/** Default no-op implementation — no external checkpointing. */ /** Default no-op implementation — no external checkpointing. */
+1 -1
View File
@@ -5,7 +5,7 @@
* Consumers can provide alternate implementations via the DI container. * Consumers can provide alternate implementations via the DI container.
*/ */
export type { CheckpointProvider, CheckpointContext, SkipDecision } from './checkpoint-provider.js'; export type { CheckpointContext, CheckpointProvider, SkipDecision } from './checkpoint-provider.js';
export { NoOpCheckpointProvider } from './checkpoint-provider.js'; export { NoOpCheckpointProvider } from './checkpoint-provider.js';
export type { FindingsProvider } from './findings-provider.js'; export type { FindingsProvider } from './findings-provider.js';
export { NoOpFindingsProvider } from './findings-provider.js'; export { NoOpFindingsProvider } from './findings-provider.js';
+1 -5
View File
@@ -99,11 +99,7 @@ const DEFAULT_CONFIG: ContainerConfig = {
* setContainerFactory() at worker startup to inject custom provider * setContainerFactory() at worker startup to inject custom provider
* implementations into every container. * implementations into every container.
*/ */
type ContainerFactory = ( type ContainerFactory = (workflowId: string, sessionMetadata: SessionMetadata, config: ContainerConfig) => Container;
workflowId: string,
sessionMetadata: SessionMetadata,
config: ContainerConfig,
) => Container;
let containerFactory: ContainerFactory = (_workflowId, sessionMetadata, config) => let containerFactory: ContainerFactory = (_workflowId, sessionMetadata, config) =>
new Container({ sessionMetadata, config }); new Container({ sessionMetadata, config });
+2 -3
View File
@@ -11,14 +11,13 @@
* Services are pure domain logic with no Temporal dependencies. * Services are pure domain logic with no Temporal dependencies.
*/ */
export type { ClaudePromptResult } from '../ai/claude-executor.js';
export { runClaudePrompt } from '../ai/claude-executor.js';
export type { AgentExecutionInput } from './agent-execution.js'; export type { AgentExecutionInput } from './agent-execution.js';
export { AgentExecutionService } from './agent-execution.js'; export { AgentExecutionService } from './agent-execution.js';
export { ConfigLoaderService } from './config-loader.js'; export { ConfigLoaderService } from './config-loader.js';
export type { ContainerDependencies } from './container.js'; export type { ContainerDependencies } from './container.js';
export { Container, getContainer, getOrCreateContainer, removeContainer, setContainerFactory } from './container.js'; export { Container, getContainer, getOrCreateContainer, removeContainer, setContainerFactory } from './container.js';
export { ExploitationCheckerService } from './exploitation-checker.js'; export { ExploitationCheckerService } from './exploitation-checker.js';
export { loadPrompt } from './prompt-manager.js'; export { loadPrompt } from './prompt-manager.js';
export { assembleFinalReport, injectModelIntoReport } from './reporting.js'; export { assembleFinalReport, injectModelIntoReport } from './reporting.js';
export type { ClaudePromptResult } from '../ai/claude-executor.js';
export { runClaudePrompt } from '../ai/claude-executor.js';
+4 -1
View File
@@ -123,7 +123,10 @@ export async function injectModelIntoReport(
logger.info(`Injecting model info into report: ${modelStr}`); logger.info(`Injecting model info into report: ${modelStr}`);
// 3. Read the final report // 3. Read the final report
const reportPath = path.join(deliverablesDir(repoPath, deliverablesSubdir), 'comprehensive_security_assessment_report.md'); const reportPath = path.join(
deliverablesDir(repoPath, deliverablesSubdir),
'comprehensive_security_assessment_report.md',
);
if (!(await fs.pathExists(reportPath))) { if (!(await fs.pathExists(reportPath))) {
logger.warn('Final report not found, skipping model injection'); logger.warn('Final report not found, skipping model injection');
+14 -5
View File
@@ -22,8 +22,8 @@ import { AuditSession } from '../audit/index.js';
import type { ResumeAttempt } from '../audit/metrics-tracker.js'; import type { ResumeAttempt } from '../audit/metrics-tracker.js';
import type { SessionMetadata } from '../audit/utils.js'; import type { SessionMetadata } from '../audit/utils.js';
import type { WorkflowSummary } from '../audit/workflow-logger.js'; import type { WorkflowSummary } from '../audit/workflow-logger.js';
import type { ContainerConfig, ProviderConfig } from '../types/config.js';
import type { CheckpointContext } from '../interfaces/checkpoint-provider.js'; import type { CheckpointContext } from '../interfaces/checkpoint-provider.js';
import { DEFAULT_DELIVERABLES_SUBDIR, deliverablesDir } from '../paths.js';
import { getContainer, getOrCreateContainer, removeContainer } from '../services/container.js'; import { getContainer, getOrCreateContainer, removeContainer } from '../services/container.js';
import { classifyErrorForTemporal, PentestError } from '../services/error-handling.js'; import { classifyErrorForTemporal, PentestError } from '../services/error-handling.js';
import { ExploitationCheckerService } from '../services/exploitation-checker.js'; import { ExploitationCheckerService } from '../services/exploitation-checker.js';
@@ -34,9 +34,9 @@ import { assembleFinalReport, injectModelIntoReport } from '../services/reportin
import { AGENTS } from '../session-manager.js'; import { AGENTS } from '../session-manager.js';
import type { AgentName } from '../types/agents.js'; import type { AgentName } from '../types/agents.js';
import { ALL_AGENTS } from '../types/agents.js'; import { ALL_AGENTS } from '../types/agents.js';
import type { ContainerConfig, ProviderConfig } from '../types/config.js';
import { ErrorCode } from '../types/errors.js'; import { ErrorCode } from '../types/errors.js';
import { isErr } from '../types/result.js'; import { isErr } from '../types/result.js';
import { DEFAULT_DELIVERABLES_SUBDIR, deliverablesDir } from '../paths.js';
import { fileExists, readJson } from '../utils/file-io.js'; import { fileExists, readJson } from '../utils/file-io.js';
import { createActivityLogger } from './activity-logger.js'; import { createActivityLogger } from './activity-logger.js';
import type { AgentMetrics, PipelineState, ResumeState } from './shared.js'; import type { AgentMetrics, PipelineState, ResumeState } from './shared.js';
@@ -135,7 +135,8 @@ async function runAgentActivity(agentName: AgentName, input: ActivityInput): Pro
// Skip guard: the checkpoint provider decides whether to run the agent. // Skip guard: the checkpoint provider decides whether to run the agent.
// The default NoOp provider always returns { skip: false }. // The default NoOp provider always returns { skip: false }.
const skipContainer = getContainer(workflowId) ?? const skipContainer =
getContainer(workflowId) ??
getOrCreateContainer(workflowId, buildSessionMetadata(input), buildContainerConfig(input)); getOrCreateContainer(workflowId, buildSessionMetadata(input), buildContainerConfig(input));
const decision = await skipContainer.checkpointProvider.shouldSkipAgent( const decision = await skipContainer.checkpointProvider.shouldSkipAgent(
agentName, agentName,
@@ -321,7 +322,15 @@ export async function runPreflightValidation(input: ActivityInput): Promise<void
const logger = createActivityLogger(); const logger = createActivityLogger();
logger.info('Running preflight validation...', { attempt: attemptNumber }); logger.info('Running preflight validation...', { attempt: attemptNumber });
const result = await runPreflightChecks(input.webUrl, input.repoPath, input.configPath, logger, input.skipGitCheck, input.apiKey, input.providerConfig); const result = await runPreflightChecks(
input.webUrl,
input.repoPath,
input.configPath,
logger,
input.skipGitCheck,
input.apiKey,
input.providerConfig,
);
if (isErr(result)) { if (isErr(result)) {
const classified = classifyErrorForTemporal(result.error); const classified = classifyErrorForTemporal(result.error);
@@ -605,7 +614,7 @@ export async function restoreGitCheckpoint(
await executeGitCommandWithRetry( await executeGitCommandWithRetry(
['git', 'rev-parse', '--verify', checkpointHash], ['git', 'rev-parse', '--verify', checkpointHash],
repoPath, repoPath,
'verify checkpoint hash exists' 'verify checkpoint hash exists',
); );
} catch { } catch {
logger.info(`Checkpoint hash not found in clone, skipping git reset: ${checkpointHash}`); logger.info(`Checkpoint hash not found in clone, skipping git reset: ${checkpointHash}`);