mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-08-11 05:50:21 +02:00
* feat(worker): record token, cache, and turn usage per agent * feat: replace model tiers with a single SHANNON_AI_MODEL across five providers * feat(cli): rebuild the setup wizard for provider and model selection * docs: document single-model selection and supported providers * feat(worker): use chat completions for OpenAI behind a custom base URL * feat: add SHANNON_AI_OPENAI_FORMAT to pick the wire API for OpenAI gateways * refactor(cli): drop endpoint path hints from the gateway format picker * feat(worker): enable pi in-session provider retry with retry-after backoff * refactor(worker): hand provider error classification to pi and drop the Anthropic ladders * refactor: remove the subscription retry preset and pipeline config section * fix(worker): validate Bedrock credentials with the same live probe as other providers * feat(worker): render the report from structured findings instead of agent-written markdown * fix(worker): dispose the credential probe session on every path * fix(worker): refuse to replace the assembled report with an empty one * refactor(worker): catch post-processing throws across the whole finalization block * revert(worker): drop the report zero-findings guard * docs(worker): correct the retry split and Bedrock credential claims * docs: regenerate llms-full.txt from current sources * feat(cli): build and run the npx flow from a clone * refactor(cli): flatten the setup summary output * feat(cli): reject runs with more than one provider configured * fix(worker): say a rejected bash call never ran * chore(cli): drop grok-4.3 and gpt-5.6-luna from the setup suggestions * feat(worker): capture structured finding locations for SARIF output * fix(worker): enumerate queue confidence so the report inherits it verbatim * feat(worker): give the reporting phase a mode-specific output schema * feat(worker): emit a SARIF 2.1.0 log for exploitative runs * fix(worker): correct SARIF locations and defer fingerprinting to the upload action * fix(worker): drop the confidence suffix from the analysis-mode summary list * feat(worker): give exploit findings a dedicated code location field * feat(worker): carry structured code locations from the vuln queue to the report * fix(worker): join code locations from the vuln queue instead of re-asking agents * fix(worker): spell out the finding_id to category mapping in the tool schema * feat: drop Google/Gemini as a supported AI provider * fix(worker): stop asking the report agent for code locations * docs: correct the provider list and drop the removed rate-limit settings * docs: add provider cyber safeguards and suggested models per provider * docs: document the SARIF output and the report rating thresholds
97 lines
3.6 KiB
TypeScript
97 lines
3.6 KiB
TypeScript
import { defineQuery } from '@temporalio/workflow';
|
|
|
|
export type { AgentMetrics } from '../types/metrics.js';
|
|
|
|
import type { DistributedConfig, VulnClass } from '../types/config.js';
|
|
import type { ErrorCode } from '../types/errors.js';
|
|
import type { AgentMetrics } from '../types/metrics.js';
|
|
|
|
export interface PipelineInput {
|
|
webUrl: string;
|
|
repoPath: string;
|
|
configPath?: string;
|
|
outputPath?: string;
|
|
pipelineTestingMode?: boolean;
|
|
workflowId?: string; // 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
|
|
|
|
// Config fields — serializable, flow through to ActivityInput → getOrCreateContainer()
|
|
configYAML?: string; // Raw YAML string (parsed in activity, not workflow — workflow sandbox can't use Node.js)
|
|
configData?: DistributedConfig; // Pre-parsed config (bypasses file loading)
|
|
deliverablesSubdir?: string; // Override deliverables path (default: '.shannon/deliverables')
|
|
auditDir?: string; // Override audit log directory (default: './workspaces')
|
|
promptDir?: string; // Override prompt template directory
|
|
sastSarifPath?: string; // Optional path for consumer-supplied findings input
|
|
checkpointsEnabled?: boolean; // Enable checkpoint activities (default: false)
|
|
vulnClasses?: VulnClass[]; // omitted = all five
|
|
exploit?: boolean; // false skips the exploitation phase
|
|
}
|
|
|
|
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' | 'cancelled' | 'partial';
|
|
currentPhase: string | null;
|
|
currentAgent: string | null;
|
|
completedAgents: string[];
|
|
// Vuln classes whose pipeline failed while at least one other succeeded. Drives the
|
|
// partial terminal status so a crashed class isn't reported as if it fully passed.
|
|
failedPipelines: { vulnType: VulnClass; error: string }[];
|
|
failedAgent: string | null;
|
|
error: string | null;
|
|
errorCode?: ErrorCode;
|
|
startTime: number;
|
|
agentMetrics: Record<string, AgentMetrics>;
|
|
summary: PipelineSummary | null;
|
|
}
|
|
|
|
/**
|
|
* Thrown by pentestPipeline() when the run fails, carrying the fully-populated
|
|
* PipelineState (real agentMetrics, completedAgents, summary) so a consumer can
|
|
* report actual spend instead of synthesizing a zeroed failed state. `cause`
|
|
* preserves the original error for classification and Temporal failure reporting.
|
|
*/
|
|
export class PipelineExecutionError extends Error {
|
|
override name = 'PipelineExecutionError' as const;
|
|
readonly state: PipelineState;
|
|
constructor(message: string, state: PipelineState, options?: { cause?: unknown }) {
|
|
super(message, options);
|
|
this.state = state;
|
|
}
|
|
}
|
|
|
|
// 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: VulnClass;
|
|
vulnMetrics: AgentMetrics | null;
|
|
exploitMetrics: AgentMetrics | null;
|
|
exploitDecision: {
|
|
shouldExploit: boolean;
|
|
vulnerabilityCount: number;
|
|
} | null;
|
|
error: string | null;
|
|
}
|
|
|
|
export const getProgress = defineQuery<PipelineProgress>('getProgress');
|