diff --git a/src/executor/models.ts b/src/executor/models.ts index 0f20c3d..656964e 100644 --- a/src/executor/models.ts +++ b/src/executor/models.ts @@ -1,11 +1,11 @@ import type { Project, Task } from '../model/types.js'; import type { Complexity } from '../model/complexity.js'; -/** 角色:executor(执行改动)/ reviewer(执行后复审)/ planner(拆解 Hard / 写方案 Medium) */ -export type ModelRole = 'executor' | 'reviewer' | 'planner'; +/** 角色:executor(执行改动)/ reviewer(执行后复审)/ planner(拆解 Hard / 写方案 Medium)/ conflict(冲突裁决) */ +export type ModelRole = 'executor' | 'reviewer' | 'planner' | 'conflict'; /** 模型不可用时的回退链(按序取第一个 ≠ 失败模型的,同一 run 内只重试一次) */ -export const MODEL_FALLBACK_CHAIN = ['claude-opus-4-8', 'claude-sonnet-4-6'] as const; +export const MODEL_FALLBACK_CHAIN = ['claude-fable-5', 'claude-opus-4-8', 'claude-sonnet-4-6'] as const; /** 复杂度 → [env 覆盖变量名, 默认模型] */ const MODEL_TABLE: Record> = { @@ -15,26 +15,36 @@ const MODEL_TABLE: Record/job.json,worker 读它即可执行, * 【无需访问 DB】。携带完整 Task / Project(均 JSON 可序列化),worker 自行 pickModel/buildPrompt。 */ -/** run 类型:executor(在 worktree 执行改动)/ planner-spec(写 Medium 方案)/ planner-decompose(拆解 Hard) */ -export type RunKind = 'executor' | 'planner-spec' | 'planner-decompose'; +/** run 类型:executor(在 worktree 执行改动)/ planner-spec(写 Medium 方案)/ planner-decompose(拆解 Hard)/ conflict(冲突裁决) */ +export type RunKind = 'executor' | 'planner-spec' | 'planner-decompose' | 'conflict'; export interface JobSpec { runId: string; @@ -71,7 +71,12 @@ export interface JobSpec { /** planner-decompose 的拆解产出:plan 文本 + 子任务列表 */ export interface DecomposeResult { plan: string; - subtasks: Array<{ title: string; complexity: 'easy' | 'medium' | 'hard' }>; + subtasks: Array<{ + title: string; + complexity: 'easy' | 'medium' | 'hard'; + priority?: number; // 0=P0最高/1=P1中/2=P2最低,缺省=1 + deps?: number[]; // 引用同列表其他子任务的 0-based 序号,缺省=[] + }>; } export function writeJobSpec(job: JobSpec): void { @@ -115,7 +120,12 @@ export type OutboxRecord = | { seq: number; at: string; type: 'spec-result'; spec: string; transcriptRef: string | null; sessionId: string | null } | { seq: number; at: string; type: 'decompose-result'; - plan: string; subtasks: Array<{ title: string; complexity: 'easy' | 'medium' | 'hard' }>; + plan: string; subtasks: Array<{ + title: string; + complexity: 'easy' | 'medium' | 'hard'; + priority?: number; + deps?: number[]; + }>; transcriptRef: string | null; sessionId: string | null; } | { seq: number; at: string; type: 'done' }; diff --git a/src/model/types.ts b/src/model/types.ts index b9e1305..c6e319c 100644 --- a/src/model/types.ts +++ b/src/model/types.ts @@ -26,6 +26,11 @@ export interface Project { sortOrder: number; // 侧栏排序(小在前) createdAt: string; lastSyncAt: string | null; // 最近一次 todo.json 同步完成时间 + /** 项目级自动放行开关(auto-approved autonomy 下才生效)*/ + autoApprovePlan?: boolean; // decompose 全 easy 时跳过 plan_review(默认 false) + autoApproveExec?: boolean; // 双复审 approve 后跳过 exec_review 自动合并(默认 false) + /** 分项检查命令(JSON,如 {"lint":"npm run lint","typecheck":"npm run typecheck"})*/ + checks?: string | null; } export interface ApprovalRecord {