UNPKG

autosnippet

Version:

Extract code patterns into a knowledge base for AI coding assistants

60 lines (59 loc) 2.13 kB
/** * ProposalExecutor — 到期自动执行引擎 * * 核心职责: * 1. 扫描所有 observing 状态的 Proposal,检查是否到期 * 2. 到期 → 收集观察期表现数据 → 评估执行判据 * 3. 通过 → 执行操作(merge/deprecate/enhance/...) * 4. 不通过 → 拒绝 Proposal,Recipe 恢复原状态 * * 触发时机:UiStartupTasks Stage 5 * * 安全边界: * - Agent 只做分析,ProposalExecutor 做执行 * - merge/enhance 执行后 Recipe → staging(走正常路径) * - contradiction/reorganize 始终等开发者确认(不自动执行) * - 到期无判据 → expired */ import type { SignalBus } from '../../infrastructure/signal/SignalBus.js'; import type { ProposalRepository, ProposalType } from '../../repository/evolution/ProposalRepository.js'; import type { KnowledgeEdgeRepositoryImpl } from '../../repository/knowledge/KnowledgeEdgeRepository.js'; import type KnowledgeRepositoryImpl from '../../repository/knowledge/KnowledgeRepository.impl.js'; import type { ContentPatcher } from './ContentPatcher.js'; import type { RecipeLifecycleSupervisor } from './RecipeLifecycleSupervisor.js'; export interface ProposalExecutionResult { executed: { id: string; type: ProposalType; targetRecipeId: string; }[]; rejected: { id: string; type: ProposalType; reason: string; }[]; expired: { id: string; type: ProposalType; }[]; skipped: { id: string; type: ProposalType; reason: string; }[]; } export declare class ProposalExecutor { #private; constructor(knowledgeRepo: KnowledgeRepositoryImpl, repo: ProposalRepository, options?: { signalBus?: SignalBus; contentPatcher?: ContentPatcher; supervisor?: RecipeLifecycleSupervisor; knowledgeEdgeRepo?: KnowledgeEdgeRepositoryImpl; }); /** * 定期调用(UiStartupTasks Stage 5) * * 扫描所有到期 Proposal → 评估 → 执行/拒绝/过期 */ checkAndExecute(): Promise<ProposalExecutionResult>; }