feat: Phase1 核心——模型/状态机 + SQLite Store(守卫+审批闸) + REST/WS API + daemon
- src/model: 复杂度分级、16 状态状态机、实体类型 - src/store: better-sqlite3 接 schema,transition 受 canTransition 守卫, decide 审批闸(reject 必带改进意见),事件订阅广播,nextExecutable - src/api: Fastify REST + ws 事件广播(/ws) - src/daemon: maestrod 入口(env 配置,默认 ~/.maestro :4517) - test: 9 个生命周期单测全过;typecheck/build 干净;REST+WS 端到端实跑验证 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/** 任务复杂度:Hard / Medium / Easy(对应旧 todo skill 的 tier 1/2/3) */
|
||||
export type Complexity = 'hard' | 'medium' | 'easy';
|
||||
|
||||
export const COMPLEXITY_ORDER: Record<Complexity, number> = { hard: 1, medium: 2, easy: 3 };
|
||||
export const COMPLEXITY_LABEL: Record<Complexity, string> = { hard: 'Hard', medium: 'Medium', easy: 'Easy' };
|
||||
|
||||
/** 旧 todo skill 的 tier(1/2/3) ↔ 复杂度,用于迁移导入 */
|
||||
export const TIER_TO_COMPLEXITY: Record<number, Complexity> = { 1: 'hard', 2: 'medium', 3: 'easy' };
|
||||
export const COMPLEXITY_TO_TIER: Record<Complexity, number> = { hard: 1, medium: 2, easy: 3 };
|
||||
|
||||
/** 前置闸:执行前是否需要用户确认(Hard / Medium 需要,Easy 不需要) */
|
||||
export function requiresPreGate(c: Complexity): boolean {
|
||||
return c === 'hard' || c === 'medium';
|
||||
}
|
||||
|
||||
/** Hard 必须先进 plan 分析 + 任务拆解 */
|
||||
export function mustDecompose(c: Complexity): boolean {
|
||||
return c === 'hard';
|
||||
}
|
||||
|
||||
export function isComplexity(v: unknown): v is Complexity {
|
||||
return v === 'hard' || v === 'medium' || v === 'easy';
|
||||
}
|
||||
Reference in New Issue
Block a user