// AgenTeam type definitions — single source of truth export type WorkflowPhase = "idle" | "triaged" | "executing" | "done" export type LogSource = "enforcer" | "tool" | "agent" | "plugin" | "system" export type MemoryCategory = "product" | "technical" | "architecture" | "convention" export interface MemoryEntry { id: string category: MemoryCategory title: string content: string tags: string[] project: string created_at: string source: "manual" } export interface MemoryConfig { enabled: boolean embedding_model: string max_auto_results: number max_auto_tokens: number similarity_threshold: number auto_inject_on_triage: boolean } export interface MemorySearchResult { entry: MemoryEntry score: number } export interface DebugLogEntry { ts: number source: LogSource event: string payload?: unknown } export interface AgenteamConfig { models: { cheap: string; smart: string } limits: { max_review_retries: number escalation: "smart" | "user" | "fail" } triage: { simple_max_files: number risk_keywords: string[] } review: { lint_command: string | null always_adversary: boolean } adversary_model: string memory: MemoryConfig } export const DEFAULT_CONFIG: AgenteamConfig = { models: { cheap: "zai-coding-plan/glm-4.7", smart: "zai-coding-plan/glm-5.1" }, limits: { max_review_retries: 3, escalation: "smart", }, triage: { simple_max_files: 2, risk_keywords: [ "refactor", "migrate", "security", "auth", "database", "schema", "deploy", "infrastructure", ], }, review: { lint_command: null, always_adversary: true }, adversary_model: "smart", memory: { enabled: false, embedding_model: "Xenova/all-MiniLM-L6-v2", max_auto_results: 5, max_auto_tokens: 100, similarity_threshold: 0.7, auto_inject_on_triage: true, }, } export interface TriageResult { complexity: "simple" | "complex" risk: "low" | "high" files: string[] suggested_tier: "cheap" | "smart" } export interface TaskNode { id: string desc: string tier: "cheap" | "smart" files: string[] deps: string[] status: "pending" | "running" | "done" | "failed" review: { attempts: number review_passed: boolean } started_at?: number completed_at?: number } export interface LogEntry { ts: number task_id: string | null event: string detail?: string source?: LogSource } export interface ProjectState { goal: string phase: WorkflowPhase triage_result: TriageResult | null tasks: TaskNode[] active_tasks: string[] log: LogEntry[] memory_context?: string } export const EMPTY_STATE: ProjectState = { goal: "", phase: "idle", triage_result: null, tasks: [], active_tasks: [], log: [], memory_context: undefined, }