import { defineQuery } from '@temporalio/workflow'; // Re-export AgentMetrics from central types location export type { AgentMetrics } from '../types/metrics.js'; import type { AgentMetrics } from '../types/metrics.js'; // === Types === export interface PipelineInput { webUrl: string; repoPath: string; configPath?: string; outputPath?: string; pipelineTestingMode?: boolean; workflowId?: string; // Added by client, used for audit correlation sessionId?: string; // Workspace directory name (distinct from workflowId for named workspaces) resumeFromWorkspace?: string; // Workspace name to resume from terminatedWorkflows?: string[]; // Workflows terminated during resume } export interface ResumeState { workspaceName: string; originalUrl: string; completedAgents: string[]; checkpointHash: string; originalWorkflowId: string; } export interface PipelineSummary { totalCostUsd: number; totalDurationMs: number; // Wall-clock time (end - start) totalTurns: number; agentCount: number; } export interface PipelineState { status: 'running' | 'completed' | 'failed'; currentPhase: string | null; currentAgent: string | null; completedAgents: string[]; failedAgent: string | null; error: string | null; startTime: number; agentMetrics: Record; summary: PipelineSummary | null; } // Extended state returned by getProgress query (includes computed fields) export interface PipelineProgress extends PipelineState { workflowId: string; elapsedMs: number; } // Result from a single vuln→exploit pipeline export interface VulnExploitPipelineResult { vulnType: string; vulnMetrics: AgentMetrics | null; exploitMetrics: AgentMetrics | null; exploitDecision: { shouldExploit: boolean; vulnerabilityCount: number; } | null; error: string | null; } // === Queries === export const getProgress = defineQuery('getProgress');