diff --git a/apps/worker/src/ai/claude-executor.ts b/apps/worker/src/ai/claude-executor.ts index 1a9454c..32f4b49 100644 --- a/apps/worker/src/ai/claude-executor.ts +++ b/apps/worker/src/ai/claude-executor.ts @@ -178,7 +178,8 @@ export async function runClaudePrompt( sdkEnv.CLAUDE_CODE_USE_VERTEX = '1'; if (providerConfig.gcpRegion) sdkEnv.CLOUD_ML_REGION = providerConfig.gcpRegion; if (providerConfig.gcpProjectId) sdkEnv.ANTHROPIC_VERTEX_PROJECT_ID = providerConfig.gcpProjectId; - if (providerConfig.gcpCredentialsPath) sdkEnv.GOOGLE_APPLICATION_CREDENTIALS = providerConfig.gcpCredentialsPath; + if (providerConfig.gcpCredentialsPath) + sdkEnv.GOOGLE_APPLICATION_CREDENTIALS = providerConfig.gcpCredentialsPath; break; case 'litellm_router': if (providerConfig.baseUrl) sdkEnv.ANTHROPIC_BASE_URL = providerConfig.baseUrl; diff --git a/apps/worker/src/interfaces/checkpoint-provider.ts b/apps/worker/src/interfaces/checkpoint-provider.ts index e6a0161..158bcb1 100644 --- a/apps/worker/src/interfaces/checkpoint-provider.ts +++ b/apps/worker/src/interfaces/checkpoint-provider.ts @@ -11,11 +11,7 @@ import type { PipelineState } from '../temporal/shared.js'; export interface CheckpointProvider { - onAgentComplete( - agentName: string, - phase: string, - state: PipelineState, - ): Promise; + onAgentComplete(agentName: string, phase: string, state: PipelineState): Promise; } /** Default no-op implementation — no external checkpointing. */ diff --git a/apps/worker/src/interfaces/findings-provider.ts b/apps/worker/src/interfaces/findings-provider.ts index f1e01e7..e111839 100644 --- a/apps/worker/src/interfaces/findings-provider.ts +++ b/apps/worker/src/interfaces/findings-provider.ts @@ -11,11 +11,7 @@ import type { ActivityInput } from '../temporal/activities.js'; import type { VulnType } from '../types/agents.js'; export interface FindingsProvider { - mergeFindingsIntoQueue( - repoPath: string, - vulnType: VulnType, - input: ActivityInput, - ): Promise<{ mergedCount: number }>; + mergeFindingsIntoQueue(repoPath: string, vulnType: VulnType, input: ActivityInput): Promise<{ mergedCount: number }>; } /** Default no-op implementation — no external findings to merge. */ diff --git a/apps/worker/src/services/agent-execution.ts b/apps/worker/src/services/agent-execution.ts index e45d22f..88fce4b 100644 --- a/apps/worker/src/services/agent-execution.ts +++ b/apps/worker/src/services/agent-execution.ts @@ -95,7 +95,19 @@ export class AgentExecutionService { auditSession: AuditSession, logger: ActivityLogger, ): Promise> { - const { webUrl, repoPath, deliverablesPath, configPath, configData, configYAML, pipelineTestingMode = false, attemptNumber, apiKey, promptDir, providerConfig } = input; + const { + webUrl, + repoPath, + deliverablesPath, + configPath, + configData, + configYAML, + pipelineTestingMode = false, + attemptNumber, + apiKey, + promptDir, + providerConfig, + } = input; // 1. Load config (pre-parsed configData → raw YAML → file path) const configResult = await this.configLoader.loadOptional(configPath, configData, configYAML); @@ -108,7 +120,14 @@ export class AgentExecutionService { const promptTemplate = AGENTS[agentName].promptTemplate; let prompt: string; try { - prompt = await loadPrompt(promptTemplate, { webUrl, repoPath }, distributedConfig, pipelineTestingMode, logger, promptDir); + prompt = await loadPrompt( + promptTemplate, + { webUrl, repoPath }, + distributedConfig, + pipelineTestingMode, + logger, + promptDir, + ); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return err( diff --git a/apps/worker/src/services/config-loader.ts b/apps/worker/src/services/config-loader.ts index 7f2200c..c38e723 100644 --- a/apps/worker/src/services/config-loader.ts +++ b/apps/worker/src/services/config-loader.ts @@ -81,7 +81,13 @@ export class ConfigLoaderService { } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return err( - new PentestError(`Failed to parse config YAML: ${errorMessage}`, 'config', false, { originalError: errorMessage }, ErrorCode.CONFIG_PARSE_ERROR), + new PentestError( + `Failed to parse config YAML: ${errorMessage}`, + 'config', + false, + { originalError: errorMessage }, + ErrorCode.CONFIG_PARSE_ERROR, + ), ); } } diff --git a/apps/worker/src/services/preflight.ts b/apps/worker/src/services/preflight.ts index 01c134a..1ce0944 100644 --- a/apps/worker/src/services/preflight.ts +++ b/apps/worker/src/services/preflight.ts @@ -39,7 +39,11 @@ function isLoopbackAddress(address: string): boolean { // === Repository Validation === -async function validateRepo(repoPath: string, logger: ActivityLogger, skipGitCheck?: boolean): Promise> { +async function validateRepo( + repoPath: string, + logger: ActivityLogger, + skipGitCheck?: boolean, +): Promise> { logger.info('Checking repository path...', { repoPath }); // 1. Check repo directory exists @@ -184,11 +188,17 @@ function classifySdkError(sdkError: SDKAssistantMessageError, authType: string): } /** Validate credentials via a minimal Claude Agent SDK query. */ -async function validateCredentials(logger: ActivityLogger, apiKey?: string, providerConfig?: import('../types/config.js').ProviderConfig): Promise> { +async function validateCredentials( + logger: ActivityLogger, + apiKey?: string, + providerConfig?: import('../types/config.js').ProviderConfig, +): Promise> { // 0. If providerConfig is present, credentials are managed by the caller. // The executor will map providerConfig directly to sdkEnv — no process.env needed. if (providerConfig) { - logger.info(`Provider config present (type: ${providerConfig.providerType || 'anthropic_api'}) — skipping env-based credential validation`); + logger.info( + `Provider config present (type: ${providerConfig.providerType || 'anthropic_api'}) — skipping env-based credential validation`, + ); return ok(undefined); } diff --git a/apps/worker/src/temporal/activities.ts b/apps/worker/src/temporal/activities.ts index d84afc2..18e229b 100644 --- a/apps/worker/src/temporal/activities.ts +++ b/apps/worker/src/temporal/activities.ts @@ -22,7 +22,7 @@ import { AuditSession } from '../audit/index.js'; import type { ResumeAttempt } from '../audit/metrics-tracker.js'; import type { SessionMetadata } from '../audit/utils.js'; import type { WorkflowSummary } from '../audit/workflow-logger.js'; -import type { ContainerConfig, ProviderConfig } from '../types/config.js'; +import { DEFAULT_DELIVERABLES_SUBDIR, deliverablesDir } from '../paths.js'; import { getContainer, getOrCreateContainer, removeContainer } from '../services/container.js'; import { classifyErrorForTemporal, PentestError } from '../services/error-handling.js'; import { ExploitationCheckerService } from '../services/exploitation-checker.js'; @@ -33,9 +33,9 @@ import { assembleFinalReport, injectModelIntoReport } from '../services/reportin import { AGENTS } from '../session-manager.js'; import type { AgentName } 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 { isErr } from '../types/result.js'; -import { DEFAULT_DELIVERABLES_SUBDIR, deliverablesDir } from '../paths.js'; import { fileExists, readJson } from '../utils/file-io.js'; import { createActivityLogger } from './activity-logger.js'; import type { AgentMetrics, PipelineState, ResumeState } from './shared.js'; @@ -306,7 +306,15 @@ export async function runPreflightValidation(input: ActivityInput): Promise !resumeState?.completedAgents.includes(agentName), ) as AgentName[]; - await a.restoreGitCheckpoint(input.repoPath, resumeState.checkpointHash, incompleteAgents, input.deliverablesSubdir); + await a.restoreGitCheckpoint( + input.repoPath, + resumeState.checkpointHash, + incompleteAgents, + input.deliverablesSubdir, + ); // 3. Short-circuit if all agents already completed if (resumeState.completedAgents.length === ALL_AGENTS.length) {