All files / scripts/types workflow.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88                                                                                                                                                                               
/**
 * @module Types/Workflow
 * @description Workflow state and coordination types for multi-workflow synchronization.
 */
 
// ---------------------------------------------------------------------------
// MCP query cache
// ---------------------------------------------------------------------------
 
/** A single cached MCP query result */
export interface MCPCacheEntry {
  timestamp: string;
  ttl?: number;
  resultHash: string;
  result: unknown;
}
 
// ---------------------------------------------------------------------------
// Recent articles
// ---------------------------------------------------------------------------
 
/** A recently generated article stored for deduplication */
export interface RecentArticleEntry {
  slug: string;
  timestamp: string;
  workflow: string;
  title: string;
  topics: string[];
  mcpQueries: string[];
}
 
/** Input shape for adding an article to recent-article tracking */
export interface RecentArticleInput {
  slug: string;
  workflow?: string;
  title: string;
  topics?: string[];
  mcpQueries?: string[];
  timestamp?: string;
}
 
// ---------------------------------------------------------------------------
// Deduplication
// ---------------------------------------------------------------------------
 
/** Result of a duplicate-article check */
export interface DuplicateCheckResult {
  isDuplicate: boolean;
  matchedArticle: RecentArticleEntry | null;
  similarityScore: number;
}
 
// ---------------------------------------------------------------------------
// Workflow execution records
// ---------------------------------------------------------------------------
 
/** Optional metadata attached to a workflow execution */
export interface WorkflowExecutionMetadata {
  articlesGenerated?: number;
  errors?: number;
  [key: string]: unknown;
}
 
/** Persistent record of a single workflow's run history */
export interface WorkflowRecord {
  lastRun: string | null;
  runCount: number;
  articlesGenerated: number;
}
 
// ---------------------------------------------------------------------------
// Top-level state
// ---------------------------------------------------------------------------
 
/** Full persisted state managed by WorkflowStateCoordinator */
export interface WorkflowState {
  lastUpdate: string | null;
  recentArticles: RecentArticleEntry[];
  mcpQueryCache: Record<string, MCPCacheEntry>;
  workflows: Record<string, WorkflowRecord>;
}
 
/** Aggregated statistics returned by getWorkflowStatistics() */
export type WorkflowStatistics = Record<string, WorkflowRecord | number> & {
  cacheSize: number;
  recentArticlesCount: number;
};