90 lines
3.2 KiB
TypeScript
90 lines
3.2 KiB
TypeScript
import type { SourceFreshness } from '../common/app-root.js';
|
|
|
|
export const HARNESS_REPORT_DEFINITIONS = [
|
|
{ id: 'H1', slug: 'context', title: 'H1 · Context', description: 'Context selection, prompt contract and risk classification' },
|
|
{ id: 'H2', slug: 'tool', title: 'H2 · Tool', description: 'Allowlisted tools, actions and execution boundaries' },
|
|
{ id: 'H3', slug: 'evaluation', title: 'H3 · Evaluation', description: 'Quality evaluation, traceability and acceptance evidence' },
|
|
{ id: 'H4', slug: 'security', title: 'H4 · Security', description: 'Input, output and artifact security controls' },
|
|
{ id: 'H5', slug: 'governance', title: 'H5 · Governance', description: 'Policy decisions, approvals and audit integrity' },
|
|
{ id: 'H6', slug: 'agentops', title: 'H6 · AgentOps', description: 'Runtime, token, cost, failure and alert telemetry' },
|
|
{ id: 'H7', slug: 'orchestration', title: 'H7 · Orchestration', description: 'Final outcome, certification and rollback evidence' },
|
|
] as const;
|
|
|
|
export type HarnessReportId = typeof HARNESS_REPORT_DEFINITIONS[number]['id'];
|
|
export type HarnessReportVerdict = 'pass' | 'attention' | 'fail' | 'no_data';
|
|
export type ReportExportFormat = 'json' | 'html';
|
|
|
|
export interface HarnessReportScope {
|
|
project: string | null;
|
|
from: string | null;
|
|
to: string | null;
|
|
run: string | null;
|
|
}
|
|
|
|
export interface HarnessReportFinding {
|
|
severity: 'info' | 'warning' | 'critical';
|
|
code: string;
|
|
message: string;
|
|
metric?: string;
|
|
value?: number | string;
|
|
threshold?: number | string;
|
|
}
|
|
|
|
export interface HarnessReportEvidenceSource extends SourceFreshness {
|
|
records: number;
|
|
}
|
|
|
|
export interface HarnessReport<TSummary, TDetails> {
|
|
schema_version: 1;
|
|
category: 'report_dimension';
|
|
dimension_id: `ReportDimension.${HarnessReportId}`;
|
|
report_id: string;
|
|
harness: HarnessReportId;
|
|
title: string;
|
|
description: string;
|
|
generated_at: string;
|
|
scope: HarnessReportScope;
|
|
verdict: HarnessReportVerdict;
|
|
verdict_reasons: string[];
|
|
freshness: {
|
|
status: 'live' | 'stale' | 'missing';
|
|
stale_after_s: number;
|
|
primary_age_s: number | null;
|
|
sources: HarnessReportEvidenceSource[];
|
|
};
|
|
summary: TSummary;
|
|
thresholds: Record<string, number | string | boolean>;
|
|
findings: HarnessReportFinding[];
|
|
evidence_sources: HarnessReportEvidenceSource[];
|
|
data_quality: {
|
|
status: 'complete' | 'partial' | 'insufficient';
|
|
warnings: string[];
|
|
};
|
|
available_filters: {
|
|
projects: string[];
|
|
runs: string[];
|
|
};
|
|
details: TDetails;
|
|
}
|
|
|
|
export interface HarnessReportCatalogEntry {
|
|
id: HarnessReportId;
|
|
slug: string;
|
|
title: string;
|
|
description: string;
|
|
contract_version: 1;
|
|
category: 'report_dimension';
|
|
dimension_id: `ReportDimension.${HarnessReportId}`;
|
|
endpoint: string;
|
|
availability: 'implemented' | 'contract_ready';
|
|
}
|
|
|
|
export const HARNESS_REPORT_CATALOG: HarnessReportCatalogEntry[] = HARNESS_REPORT_DEFINITIONS.map((definition) => ({
|
|
...definition,
|
|
contract_version: 1,
|
|
category: 'report_dimension',
|
|
dimension_id: `ReportDimension.${definition.id}`,
|
|
endpoint: `/api/v1/reports/${definition.id.toLowerCase()}`,
|
|
availability: definition.id === 'H6' ? 'implemented' : 'contract_ready',
|
|
}));
|