feat(ui): review original-text drafts and explicit task scope

This commit is contained in:
Agent Workbench Dev
2026-11-04 13:38:08 +08:00
parent b963e73301
commit d389b23c99
9 changed files with 235 additions and 23 deletions
+69
View File
@@ -0,0 +1,69 @@
import { useState } from 'react';
import { Modal } from './components';
import type { RequirementDraft, RequirementItem, RequirementView, TaskPlanStep } from './types';
export const requirementRoles = { requirement: '业务要求', reference: '参考资料', prohibition: '禁止事项', unknown: '待澄清' };
const kinds: Record<TaskPlanStep['kind'], string> = { analysis: '研究与读取', changes: '已应用改动', results: '当前文件', checks: '工程检查', browser: '页面断言' };
export const requirementInput = (row: RequirementItem) => ({ key: row.key, title: row.title, criterion: row.criterion,
...(row.role ? { role: row.role } : {}), kind: row.kind, method: row.method,
source: { kind: row.source.kind, id: row.source.id, start: row.source.start, end: row.source.end },
...(row.method === 'scope' ? {} : row.kind === 'analysis' ? { tools: row.tools } : ['changes', 'results'].includes(row.kind) ? { paths: row.paths }
: row.kind === 'checks' ? { checks: row.checks } : { viewport_width: row.viewport_width, actions: row.actions }) });
const evidenceScope = (kind: TaskPlanStep['kind']) => kind === 'analysis' ? { tools: ['read_file'] } : ['changes', 'results'].includes(kind)
? { paths: [] } : kind === 'checks' ? { checks: ['test', 'build'] } : { viewport_width: 1280, actions: ['assert_visible'] };
export function changeRequirementRole(row: RequirementItem, role: NonNullable<RequirementItem['role']>): RequirementItem {
const { tools, paths, checks, actions, viewport_width, ...base } = row;
return role === 'requirement' ? { ...base, role, method: 'evidence', kind: 'analysis', tools: ['read_file'] }
: { ...base, role, kind: 'analysis', method: 'scope' };
}
export function RequirementScopeFields({ row, change, prefix = '' }: { row: RequirementItem; change: (row: RequirementItem) => void; prefix?: string }) {
const updateKind = (kind: TaskPlanStep['kind']) => {
const { tools, paths, checks, actions, viewport_width, ...base } = row;
change({ ...base, kind, ...evidenceScope(kind) });
};
return <>
<label>内容用途<select aria-label={prefix + '内容用途'} value={row.role ?? 'requirement'} onChange={event => change(changeRequirementRole(row, event.target.value as NonNullable<RequirementItem['role']>))}>
{Object.entries(requirementRoles).map(([key, value]) => <option key={key} value={key}>{value}</option>)}</select></label>
{row.method === 'scope' ? <p className="record-footnote">{row.role === 'unknown' ? '尚未确定用途,保存后仍阻止要求复核完成。' : row.role === 'reference' ? '只记录参考用途,不要求修改此文件,也不计为交付成果。' : '保留用户边界供执行和复核使用;记录边界不等于已证明遵守。既有操作审批仍保留。'}</p> : <>
<label>复核方式<select aria-label={prefix + '要求复核方式'} value={row.method} onChange={event => {
const method = event.target.value as RequirementItem['method'];
const { tools, paths, checks, actions, viewport_width, ...base } = row;
change(method === 'not_requested' ? { ...base, method, kind: 'checks', checks: ['test', 'build'] }
: method === 'user' ? { ...base, method, kind: 'analysis', tools: ['read_file'] } : { ...row, method });
}}><option value="evidence">核对实际证据</option><option value="user">用户体验确认</option><option value="not_requested">按用户约定不执行检查</option></select></label>
{row.method === 'evidence' && <><label>证据类别<select aria-label={prefix + '要求证据类别'} value={row.kind} onChange={event => updateKind(event.target.value as TaskPlanStep['kind'])}>{Object.entries(kinds).map(([key, value]) => <option key={key} value={key}>{value}</option>)}</select></label>
{['results', 'changes'].includes(row.kind) && <label>文件范围(每行一项)<textarea aria-label={prefix + '要求文件范围'} required value={row.paths?.join('\n') ?? ''} onChange={event => change({ ...row, paths: event.target.value.split('\n').filter(Boolean) })} /></label>}
{row.kind === 'analysis' && <label>读取工具(逗号分隔)<input aria-label={prefix + '要求读取工具'} required value={row.tools?.join(',') ?? ''} onChange={event => change({ ...row, tools: event.target.value.split(',').map(value => value.trim()) })} /></label>}
{row.kind === 'checks' && <label>检查名称(逗号分隔)<input aria-label={prefix + '要求检查名称'} required value={row.checks?.join(',') ?? ''} onChange={event => change({ ...row, checks: event.target.value.split(',').map(value => value.trim()) })} /></label>}
{row.kind === 'browser' && <label>验收视口<select aria-label={prefix + '要求验收视口'} value={row.viewport_width} onChange={event => change({ ...row, viewport_width: Number(event.target.value) })}><option value={1280}>桌面 · 1280px</option><option value={390}>手机 · 390px</option></select></label>}</>}
</>}
</>;
}
export function RequirementDraftEditor({ value, view, saving, submit, close }: { value: RequirementDraft; view: RequirementView; saving: boolean;
submit: (input: object) => void; close: () => void }) {
const [rows, setRows] = useState<RequirementItem[]>(value.proposal.items.map(row => ({ ...row, role: 'unknown', kind: 'analysis', method: 'scope', depends_on: [] })));
const [reviewed, setReviewed] = useState(false);
const count = view.items.length + rows.filter(row => !view.items.some(old => old.key === row.key)).length;
return <Modal title="审阅原文草案" description="草案只整理原文。逐项确定用途、验收方式和范围后保存;待澄清内容继续保留。" wide onClose={() => { if (!saving) close(); }}>
<form className="plan-editor requirement-editor requirement-draft-editor" onSubmit={event => {
event.preventDefault(); const keys = new Set(rows.map(row => row.key));
submit({ draft_id: value.id, source_set_sha256: value.sourceSetSha256,
reviewed_source_ids: [...new Set([...view.sources.filter(row => !view.unreviewed_sources?.includes(row.id)).map(row => row.id), ...value.proposal.covered_source_ids])],
requirements: [...view.items.filter(row => !keys.has(row.key)).map(requirementInput), ...rows.map(requirementInput)] });
}}>
<p className="record-footnote">{value.proposal.note}</p>
{value.proposal.truncated && <p role="alert" className="plan-problem">草案达到保留上限,部分原文未收录。未完整收录的来源仍保持未审阅,请分小任务或手动核对。</p>}
{count > 24 && <p role="alert" className="plan-problem">合计 {count} 项,超过24项上限。请取消并逐项手动审阅,原草案与旧要求均保留。</p>}
<fieldset disabled={saving} className="requirement-draft-items">{rows.map((row, i) => <section className="plan-editor-step" key={row.key} aria-label={`草案条目 ${i + 1}`}>
<p className="requirement-draft-origin">{row.source.kind === 'goal' ? '原目标' : '追加要求'} · [{row.source.start}, {row.source.end})</p>
<blockquote className="requirement-quote">{row.source.quote}</blockquote>
<label>名称<input aria-label={`草案名称 ${i + 1}`} required maxLength={100} value={row.title} onChange={event => setRows(values => values.map((item, index) => index === i ? { ...item, title: event.target.value } : item))} /></label>
<label>验收条件或范围说明<textarea aria-label={`草案条件 ${i + 1}`} required maxLength={300} rows={2} value={row.criterion} onChange={event => setRows(values => values.map((item, index) => index === i ? { ...item, criterion: event.target.value } : item))} /></label>
<RequirementScopeFields row={row} prefix={`草案${i + 1} `} change={next => setRows(values => values.map((item, index) => index === i ? next : item))} />
</section>)}</fieldset>
<label className="requirement-review-check"><input type="checkbox" required checked={reviewed} disabled={saving} onChange={event => setReviewed(event.target.checked)} />已核对所收录的原文和分类;未确定内容保留为待澄清。</label>
<div className="modal-actions"><button type="button" className="button secondary" disabled={saving} onClick={close}>取消</button><button className="button primary" disabled={saving || !reviewed || count > 24}>审阅并保存</button></div>
</form>
</Modal>;
}
+8 -1
View File
@@ -2,6 +2,13 @@
.requirement-list > li { padding: 14px 0; border-top: 1px solid #dce7e2; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.requirement-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.requirement-heading strong { font-size: 13px; }
.requirement-role, .requirement-draft-origin { color: #526a70; font-size: 11px; margin: 4px 0; }
.requirement-draft-items { border: 0; margin: 0; padding: 0; min-width: 0; }
.requirement-draft-editor .plan-editor-step { border-top: 1px solid #dce7e2; padding-top: 14px; margin-top: 14px; }
.requirement-review-check { display: flex !important; align-items: flex-start; gap: 9px; font-size: 12px; padding: 12px 0; line-height: 1.7; }
.requirement-review-check input { width: auto !important; margin-top: 4px; flex-shrink: 0; }
.requirement-reference_recorded, .requirement-boundary_recorded { color: #526a70; background: #eef1f4; }
.requirement-panel .plan-toolbar { flex-wrap: wrap; }
.requirement-state { color: #674917; background: #fbf2df; padding: 2px 6px; border-radius: 3px; flex-shrink: 0; font-size: 11px; }
.requirement-evidence_verified, .requirement-user_confirmed { color: #154b4a; background: #edf3f1; }
.requirement-list summary, .requirement-history summary { cursor: pointer; color: #526a70; }
@@ -16,4 +23,4 @@
.requirement-offsets { display: flex; gap: 12px; margin: 12px 0; }
.requirement-offsets label { min-width: 0; font-size: 12px; }
.requirement-panel button:focus-visible, .requirement-panel textarea:focus-visible, .requirement-editor :is(input, select, textarea):focus-visible { outline: 2px solid #4664d9; outline-offset: 2px; }
@media (max-width: 600px) { .requirement-heading { flex-direction: column; gap: 4px; } .requirement-panel .button { min-height: 36px; } }
@media (max-width: 600px) { .requirement-heading { flex-direction: column; gap: 4px; } .requirement-panel .button, .requirement-editor button, .requirement-editor select { min-height: 44px; } }
+18 -18
View File
@@ -1,17 +1,15 @@
import { useEffect, useRef, useState } from 'react';
import { Check, FileText, Plus, RefreshCw } from 'lucide-react';
import { Check, FileText, Plus, RefreshCw, ListChecks } from 'lucide-react';
import { api } from './api';
import { Modal } from './components';
import type { RequirementItem, RequirementView, Session, TaskPlanStep } from './types';
import type { RequirementDraft, RequirementItem, RequirementView, Session, TaskPlanStep } from './types';
import { RequirementDraftEditor, RequirementScopeFields, requirementInput as clean, requirementRoles } from './RequirementDraftEditor';
import './RequirementPanel.css';
const states: Record<string, string> = { pending: '待复核', failed: '复核未通过', stale: '依据已失效', unverified: '原记录待核对',
evidence_verified: '所选证据已核对', user_confirmed: '用户已确认', not_requested: '按约定未执行' };
evidence_verified: '所选证据已核对', user_confirmed: '用户已确认', not_requested: '按约定未执行',
scope_unknown: '范围待澄清', reference_recorded: '参考已记录', boundary_recorded: '边界已记录' };
const kinds: Record<TaskPlanStep['kind'], string> = { analysis: '研究与读取', changes: '已应用改动', results: '当前文件', checks: '工程检查', browser: '页面断言' };
const clean = (row: RequirementItem) => ({ key: row.key, title: row.title, criterion: row.criterion, kind: row.kind, method: row.method,
source: { kind: row.source.kind, id: row.source.id, start: row.source.start, end: row.source.end },
...(row.kind === 'analysis' ? { tools: row.tools } : ['changes', 'results'].includes(row.kind) ? { paths: row.paths }
: row.kind === 'checks' ? { checks: row.checks } : { viewport_width: row.viewport_width, actions: row.actions }) });
const scope = (kind: TaskPlanStep['kind']) => kind === 'analysis' ? { tools: ['read_file'] } : ['changes', 'results'].includes(kind)
? { paths: [] } : kind === 'checks' ? { checks: ['test', 'build'] } : { viewport_width: 1280, actions: ['assert_visible'] };
@@ -24,9 +22,10 @@ export function RequirementPanel({ session, busy, onSession, onError, openArtifa
const generation = useRef(0), mutation = useRef(false);
const [view, setView] = useState<RequirementView | null>(null), [loading, setLoading] = useState(false), [saving, setSaving] = useState(false);
const [draft, setDraft] = useState<RequirementItem | null>(null), [picked, setPicked] = useState<Record<string, string>>({}), [notes, setNotes] = useState<Record<string, string>>({});
const [proposal, setProposal] = useState<RequirementDraft | null>(null);
const [notice, setNotice] = useState('');
const disabled = busy || saving || ['running', 'awaiting_approval', 'stopping'].includes(session.status);
useEffect(() => { generation.current++; setView(null); setDraft(null); setPicked({}); setNotes({}); setNotice(''); setSaving(false); mutation.current = false;
useEffect(() => { generation.current++; setView(null); setDraft(null); setProposal(null); setPicked({}); setNotes({}); setNotice(''); setSaving(false); mutation.current = false;
return () => { generation.current++; }; }, [identity]);
useEffect(() => { const timer = setTimeout(() => { void load(); }, 120); return () => clearTimeout(timer); }, [identity, session.revision, session.status]);
async function load() {
@@ -41,12 +40,13 @@ export function RequirementPanel({ session, busy, onSession, onError, openArtifa
if (!task || !run || !view || mutation.current) return;
mutation.current = true; generation.current++; setSaving(true); setNotice(''); const scopeId = identity;
try {
const reply = await api<{ session: Session; requirements: RequirementView; verification?: { status: string; message?: string } }>(`/sessions/${session.id}/${action}`,
const reply = await api<{ session: Session; requirements: RequirementView; draft?: RequirementDraft; verification?: { status: string; message?: string } }>(`/sessions/${session.id}/${action}`,
{ taskId: task.id, runId: run.id, expected_revision: view.revision, ...input });
if (selected.current !== scopeId) return;
setView(reply.requirements); onSession(reply.session);
setNotice(reply.verification?.status === 'error' ? reply.verification.message ?? '复核未通过,原失败已保留。' : action === 'requirements' ? '要求与原文来源已保存。' : '本次复核已记录。');
if (action === 'requirements') setDraft(null);
setNotice(reply.verification?.status === 'error' ? reply.verification.message ?? '复核未通过,原失败已保留。' : action === 'requirements' ? '要求与原文来源已保存。' : action === 'requirement-drafts' ? '草案已整理,尚未成为要求或完成依据。' : '本次复核已记录。');
if (reply.draft) setProposal(reply.draft);
if (action === 'requirements') { setDraft(null); setProposal(null); }
} catch (error) { if (selected.current === scopeId) onError(error); }
finally { if (selected.current === scopeId) { mutation.current = false; setSaving(false); setLoading(false); } }
}
@@ -60,6 +60,7 @@ export function RequirementPanel({ session, busy, onSession, onError, openArtifa
<div className="record-heading"><h3>要求与证据</h3><span>{view?.items.length ?? 0} 项</span></div>
<p className="record-footnote">逐项保留用户原文与实际依据,工程证据和用户体验分别记录。</p>
<div className="plan-toolbar"><button className="text-button" disabled={loading || disabled} onClick={() => void load()}><RefreshCw size={13} />刷新复核</button>
<button className="button secondary" disabled={disabled || !view || view.status === 'unverified'} onClick={() => void mutate('requirement-drafts', { source_set_sha256: view!.source_set_sha256 })}><ListChecks size={13} />从原文整理草案</button>
<button className="button secondary" disabled={disabled || !view || view.status === 'unverified' || (view.items.length >= 24)} onClick={() => edit()}><Plus size={13} />记录要求</button></div>
{notice && <p className="plan-notice" role="status">{notice}</p>}
{view?.error && <p className="plan-problem" role="alert">{view.error}</p>}
@@ -67,6 +68,7 @@ export function RequirementPanel({ session, busy, onSession, onError, openArtifa
{view && !view.items.length && <p className="record-empty">尚未逐项记录要求。模型的完成答复保留在原会话中。</p>}
<ol className="requirement-list">{view?.items.map(row => <li key={row.key}>
<div className="requirement-heading"><strong>{row.title}</strong><span className={'requirement-state requirement-' + row.status}>{states[row.status ?? 'pending'] ?? row.status}</span></div>
<p className="requirement-role">{requirementRoles[row.role ?? 'requirement']}{row.method !== 'scope' ? ' · ' + kinds[row.kind] + (row.paths?.length ? ' · ' + row.paths.join('、') : '') : ''}</p>
<p>{row.criterion}</p>
<details><summary>用户原文 · {row.source.kind === 'goal' ? '原目标' : '追加要求'} · 要求修订 {row.revision}</summary>
<blockquote>{row.source.quote}</blockquote><code>{row.source.id} [{row.source.start}, {row.source.end})</code></details>
@@ -80,23 +82,21 @@ export function RequirementPanel({ session, busy, onSession, onError, openArtifa
{row.method === 'user' && <div className="requirement-confirm"><label>实际体验与结论<textarea aria-label={`用户确认 ${row.title}`} rows={2} maxLength={1000} disabled={disabled} value={notes[row.key] ?? ''} onChange={event => setNotes(values => ({ ...values, [row.key]: event.target.value }))} /></label>
<button className="button secondary" disabled={disabled || !notes[row.key]?.trim()} onClick={() => void mutate('requirement-proofs', { key: row.key, note: notes[row.key] })}>记录用户确认</button></div>}
{row.method === 'not_requested' && <p className="record-footnote">检查未执行,不计为测试通过。</p>}
{row.method === 'scope' && <p className="record-footnote">{row.role === 'unknown' ? '请先澄清原文的用途或验收范围。' : row.role === 'reference' ? '参考资料不计为需要修改或交付的文件。' : '仅记录禁止事项;是否遵守仍需实际证据,不代表验收通过。'}</p>}
</li>)}</ol>
{!!view?.history?.length && <details className="requirement-history"><summary>原复核历史 · {view.history.length} 条</summary>{view.history.map(row => <p key={row.id}><button className="text-button" onClick={() => openArtifact(row.artifact_id)}>{row.key} · 修订 {row.revision} · {row.status === 'rejected' ? '未通过' : '已记录'}</button>{row.error && <span>{row.error}</span>}</p>)}</details>}
{draft && view && <Modal title="记录用户要求" description="选定用户原文、验收范围和复核方式;修订保留旧要求与原失败。" wide onClose={() => { if (!saving) setDraft(null); }}>
<form className="plan-editor requirement-editor" onSubmit={event => { event.preventDefault(); const rows = view.items.some(row => row.key === draft.key) ? view.items.map(row => row.key === draft.key ? clean(draft) : clean(row)) : [...view.items.map(clean), clean(draft)]; void mutate('requirements', { requirements: rows }); }}>
<form className="plan-editor requirement-editor" onSubmit={event => { event.preventDefault(); const rows = view.items.some(row => row.key === draft.key) ? view.items.map(row => row.key === draft.key ? clean(draft) : clean(row)) : [...view.items.map(clean), clean(draft)]; void mutate('requirements', { requirements: rows, source_set_sha256: view.source_set_sha256,
reviewed_source_ids: [...new Set([...view.sources.filter(row => !view.unreviewed_sources?.includes(row.id)).map(row => row.id), ...(source && draft.source.start === 0 && draft.source.end === source.text.length ? [source.id] : [])])] }); }}>
<fieldset disabled={saving} className="plan-editor-step">
<label>要求名称<input aria-label="要求名称" maxLength={100} required value={draft.title} onChange={event => setDraft({ ...draft, title: event.target.value })} /></label>
<label>验收条件<textarea aria-label="要求验收条件" rows={2} required maxLength={300} value={draft.criterion} onChange={event => setDraft({ ...draft, criterion: event.target.value })} /></label>
<label>用户原文来源<select aria-label="要求原文来源" value={draft.source.id} onChange={event => { const row = view.sources.find(value => value.id === event.target.value)!; setDraft({ ...draft, source: { kind: row.kind, id: row.id, start: 0, end: row.text.length } }); }}>{view.sources.map((row, i) => <option key={row.id} value={row.id}>{row.kind === 'goal' ? '原目标' : `追加要求 ${i}`} · {row.text.slice(0, 65)}</option>)}</select></label>
<blockquote className="requirement-quote">{source?.text.slice(draft.source.start, draft.source.end)}</blockquote>
<div className="requirement-offsets"><label>原文起点<input aria-label="原文起点" type="number" min={0} max={Math.max(0, (source?.text.length ?? 1) - 1)} value={draft.source.start} onChange={event => setDraft({ ...draft, source: { ...draft.source, start: Number(event.target.value) } })} /></label><label>原文终点<input aria-label="原文终点" type="number" min={draft.source.start + 1} max={source?.text.length} value={draft.source.end} onChange={event => setDraft({ ...draft, source: { ...draft.source, end: Number(event.target.value) } })} /></label></div>
<label>复核方式<select aria-label="要求复核方式" value={draft.method} onChange={event => setDraft({ ...draft, method: event.target.value as RequirementItem['method'], ...(event.target.value === 'not_requested' ? { kind: 'checks', checks: ['test', 'build'] } : {}) })}><option value="evidence">核对实际证据</option><option value="user">用户体验确认</option><option value="not_requested">按用户约定不执行检查</option></select></label>
{draft.method === 'evidence' && <><label>证据类别<select aria-label="要求证据类别" value={draft.kind} onChange={event => { const kind = event.target.value as TaskPlanStep['kind']; setDraft({ ...draft, kind, ...scope(kind) }); }}>{Object.entries(kinds).map(([key, label]) => <option key={key} value={key}>{label}</option>)}</select></label>
{['results', 'changes'].includes(draft.kind) && <label>文件范围(每行一项)<textarea aria-label="要求文件范围" required value={draft.paths?.join('\n') ?? ''} onChange={event => setDraft({ ...draft, paths: event.target.value.split('\n').filter(Boolean) })} /></label>}
{draft.kind === 'analysis' && <label>读取工具(逗号分隔)<input aria-label="要求读取工具" required value={draft.tools?.join(',') ?? ''} onChange={event => setDraft({ ...draft, tools: event.target.value.split(',').map(value => value.trim()) })} /></label>}
{draft.kind === 'checks' && <label>检查名称(逗号分隔)<input aria-label="要求检查名称" required value={draft.checks?.join(',') ?? ''} onChange={event => setDraft({ ...draft, checks: event.target.value.split(',').map(value => value.trim()) })} /></label>}
{draft.kind === 'browser' && <label>验收视口<select aria-label="要求验收视口" value={draft.viewport_width} onChange={event => setDraft({ ...draft, viewport_width: Number(event.target.value) })}><option value={1280}>桌面 · 1280px</option><option value={390}>手机 · 390px</option></select></label>}</>}
<RequirementScopeFields row={draft} change={setDraft} />
</fieldset><div className="modal-actions"><button type="button" className="button secondary" disabled={saving} onClick={() => setDraft(null)}>取消</button><button className="button primary" disabled={saving}>保存要求</button></div>
</form></Modal>}
{proposal && view && <RequirementDraftEditor value={proposal} view={view} saving={saving} close={() => setProposal(null)} submit={input => void mutate('requirements', input)} />}
</section>;
}
+7 -2
View File
@@ -236,15 +236,20 @@ export interface TaskPlanView {
export interface TaskPlanReply { session: Session; plan: TaskPlanView; verification?: { status: string; reused?: boolean; proof_id: string; message?: string } }
export interface RequirementSource { kind: 'goal' | 'instruction'; id: string; text: string; sha256: string; at: string | null }
export interface RequirementItem extends TaskPlanStep {
method: 'evidence' | 'user' | 'not_requested'; source: { kind: string; id: string; start: number; end: number; quote?: string; sourceSha256?: string; at?: string | null };
role?: 'requirement' | 'reference' | 'prohibition' | 'unknown';
method: 'evidence' | 'user' | 'not_requested' | 'scope'; source: { kind: string; id: string; start: number; end: number; quote?: string; sourceSha256?: string; at?: string | null };
revision?: number; status?: string; error?: string | null; proof_id?: string | null; proof_artifact_id?: string | null; user_note?: string | null;
evidence?: TaskPlanStepView['evidence']; candidates?: TaskPlanStepView['candidates']; last_rejection?: { message: string } | null;
}
export interface RequirementView {
configured: boolean; task_id: string; revision: number; status: string; items: RequirementItem[]; sources: RequirementSource[];
configured: boolean; task_id: string; revision: number; status: string; items: RequirementItem[]; sources: RequirementSource[]; source_set_sha256: string;
all_resolved: boolean; unreviewed_sources?: string[]; error?: string; note: string; contract_artifact_id?: string;
history?: { id: string; key: string; revision: number; status: string; error: string | null; at: string; artifact_id: string }[];
}
export interface RequirementDraft {
id: string; taskId: string; runId: string; expectedRevision: number; sourceSetSha256: string; contractArtifactId: string;
proposal: { items: (Pick<RequirementItem, 'key' | 'title' | 'criterion' | 'source' | 'role'>)[]; covered_source_ids: string[]; truncated: boolean; note: string };
}
export interface ExecutionSnapshot { schemaVersion: number; task: Task | null; run: Run | null; runs: RunBrief[]; progress: { totalTools: number; completedTools: number; requiresVerification: { id: string; tool: string; state: string; callId: string }[] }; artifacts: Artifact[]; checks: CheckJob[]; mcpJobs?: McpJob[]; plans?: CheckPlan[]; deliveries?: DeliveryJob[]; deliveryPlans?: DeliveryPlan[]; changeSets?: ChangeSet[]; contextPlans?: ContextPlan[]; workspaces?: WorkspaceRecord[]; researchTargets?: ResearchTarget[]; researchJobs?: ResearchJob[]; engineJobs?: EngineJob[]; engineRuns?: EngineRunView[]; browserPlans?: BrowserPlan[]; browserJobs?: BrowserJob[]; taskPlans?: TaskPlanRecord[]; taskProofs?: { id: string; planId: string; stepKey: string; status: string }[]; collaborations?: CollaborationGroup[]; workers?: WorkerRecord[]; workspaceIdentity?: WorkspaceIdentity; accountedTaskTokens: number }
export interface WorkerBudget { maxTokens: number; maxSteps: number; maxToolCalls: number }
export interface WorkerDefinition { id: string; label: string; goal: string; paths: string[]; budget: WorkerBudget; workspaceId: string; projectId: string; sessionId: string; taskId: string; engine?: ControlledEngineAvailability }