mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-07-01 11:05:36 +02:00
581c208b84
* feat: add ReportOutputProvider for consumer-extended report artifacts * fix: thread deliverablesSubdir through report assembly * fix: produce structured report JSON on resume path * fix: fail loud on structured report output provider errors * feat: extend checkpoint provider and container DI for consumer-specific backends * fix: pre-create .shannon overlay mount points on all platforms * chore: drop claude-code-router mode * fix: drop 'resets' keyword from spending-cap text patterns
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
/**
|
|
* CheckpointProvider — injectable interface for external state persistence.
|
|
*
|
|
* Called before and after each agent to support skip-guard (resume) and
|
|
* post-agent artifact persistence. During the concurrent vulnerability-exploitation
|
|
* phase, 5 pipelines run in parallel — methods fire per-agent for granular control.
|
|
*
|
|
* Default: no-op (skip nothing, persist nothing).
|
|
*/
|
|
|
|
import type { AgentMetrics, PipelineState } from '../temporal/shared.js';
|
|
|
|
/** Result of a pre-agent skip check. */
|
|
export interface SkipDecision {
|
|
readonly skip: boolean;
|
|
readonly metrics?: AgentMetrics; // Required when skip=true
|
|
}
|
|
|
|
/** File-system context passed after agent completion for artifact persistence. */
|
|
export interface CheckpointContext {
|
|
readonly repoPath: string;
|
|
readonly sessionId: string;
|
|
readonly deliverablesSubdir: string;
|
|
readonly outputPath?: string;
|
|
}
|
|
|
|
export interface CheckpointProvider {
|
|
/**
|
|
* Called before an agent activity executes.
|
|
* Return { skip: true, metrics } to skip the agent (e.g., output files already exist).
|
|
* Return { skip: false } to run normally.
|
|
*/
|
|
shouldSkipAgent(
|
|
agentName: string,
|
|
repoPath: string,
|
|
deliverablesSubdir: string,
|
|
): Promise<SkipDecision>;
|
|
|
|
/**
|
|
* Called after an agent activity succeeds.
|
|
* Receives pipeline state and optional file context for artifact persistence.
|
|
*/
|
|
onAgentComplete(
|
|
agentName: string,
|
|
phase: string,
|
|
state: PipelineState,
|
|
context?: CheckpointContext,
|
|
): Promise<void>;
|
|
}
|
|
|
|
/** Default no-op implementation — no external checkpointing. */
|
|
export class NoOpCheckpointProvider implements CheckpointProvider {
|
|
async shouldSkipAgent(): Promise<SkipDecision> {
|
|
return { skip: false };
|
|
}
|
|
|
|
async onAgentComplete(): Promise<void> {
|
|
// No-op
|
|
}
|
|
}
|