Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const todoBasis = {
provider_revision: z.string().min(1),
source_authority: z.enum(["file_v0", "sqlite_v0"]),
registry_sha256: digest,
source_identity: digest.optional(),
};

// Decode existing backend contracts; effect authority and stale-source checks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export const ChannelTimeline = memo(function ChannelTimeline({
return (
<Fragment key={item.id}><button className={`personal-proposal-row is-${item.proposal.status}`} data-action-kind={item.proposal.actionKind} onClick={() => onSelect({ item: item.proposal, kind: "proposal" })} type="button">
<span><Sparkles size={17} /></span>
<span><small>{pendingOperation ? t(`proposal.kind.${item.proposal.actionKind}`)
<span><small>{pendingOperation || item.proposal.reviewPlan?.reason === "todo_creation_retry" ? t(`proposal.kind.${item.proposal.actionKind}`)
: taskReceipt ? t("drawer.taskLaunchReceipt")
: appliedTeamPlan ? (locale === "zh-CN" ? "团队分配 · 已记录" : "Team assignment · Recorded")
: `${t(`proposal.kind.${item.proposal.actionKind}`)} · ${t(`proposal.status.${item.proposal.status}`)}`}</small><strong>{item.proposal.title}</strong>{item.proposal.impact ? <p>{item.proposal.impact}</p> : null}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ export function ContextDrawer({ agents, attentionHistory = [], onSelectAttention
const visibleProposalFields = selection.kind === "proposal"
? selection.item.fields.filter(field => !completionProofFields.includes(field)) : [];
const proposalTarget = selection.kind === "proposal" ? selection.item : null;
const recoveringTodoCreation = proposalTarget?.reviewPlan?.reason === "todo_creation_retry";
const preserveOriginalProposal = proposalTarget?.reviewPlan?.prohibitRegeneration === true;
const retainedTodoGate = preserveOriginalProposal && proposalTarget?.actionKind === "todo.create"
&& proposalTarget.gate?.kind === "canonical_authority_required" ? proposalTarget.gate : null;
const shownProposalFields = retainedTodoGate ? [] : recoveringTodoCreation
? visibleProposalFields.filter(field => field.key !== "text" && field.key !== "goal_id")
: visibleProposalFields;
const taskExecution = proposalTarget?.status === "applied" && !proposalReadbackUnavailable && !readOnly
? proposalTarget.reviewPlan?.taskExecution : undefined;
const proposalRequests = proposalTarget?.todoId
Expand Down Expand Up @@ -347,6 +354,8 @@ export function ContextDrawer({ agents, attentionHistory = [], onSelectAttention
&& selection.item.reviewPlan?.operationFrame?.kind === "result"
&& selection.item.reviewPlan.operationFrame.resultKind === "unknown";
const decisionFrame = selection.kind === "proposal" ? selection.item.reviewPlan?.decisionFrame : undefined;
const completedTodoCreation = proposalTarget?.actionKind === "todo.create"
&& proposalTarget.reviewPlan?.interaction === "completed";
const title = taskExecution ? t("drawer.taskLaunchReceipt")
: selection.kind === "attention" ? t("drawer.titleAttention")
: selection.kind === "todo" ? t("drawer.taskDetails")
Expand Down Expand Up @@ -1224,17 +1233,19 @@ export function ContextDrawer({ agents, attentionHistory = [], onSelectAttention
? <div role="status" className="personal-proposal-state is-error" data-testid="operation-readback-unavailable"><p>{t("proposal.readbackUnavailable")}</p>
{onRetryProposalReadback ? <button type="button" className="personal-secondary-action" disabled={proposalReadbackFetching} onClick={onRetryProposalReadback}>{t("proposal.readbackRetry")}</button> : null}</div> : null}
{selection.item.actionKind === "team.plan" && selection.item.status === "applied" ? <TeamPlanResult proposal={selection.item} t={t} /> : <section className="personal-proposal-card">
{!taskExecution ? <small>{selection.item.reviewPlan?.operationFrame?.kind === "pending"
{!taskExecution ? <small>{(selection.item.reviewPlan?.operationFrame?.kind === "pending" || recoveringTodoCreation)
? t(`proposal.kind.${selection.item.actionKind}`)
: `${t(`proposal.kind.${selection.item.actionKind}`)} · ${t(`proposal.status.${selection.item.status}`)}`}</small> : null}
{decisionFrame ? <span className={`personal-decision-chip is-${decisionFrame.decision}`}>{t(`proposal.decision.${decisionFrame.decision}`)}</span> : null}
<h3>{selection.item.title}</h3>
{selection.item.todoId && (selection.item.actionKind === "gate.resolve" || selection.item.actionKind === "todo.update")
? <div className="personal-attention-meta"><AttentionProvenance detail={proposalRequests.length === 1 ? proposalRequests[0].details : undefined} /></div> : null}
{selection.item.reviewPlan?.retryOriginal && selection.item.errorMessage
{retainedTodoGate ? <div className="personal-proposal-state is-gated" role="status">
<span>{retainedTodoGate.summary}{retainedTodoGate.nextAction ? <small>{retainedTodoGate.nextAction}</small> : null}</span>
</div> : selection.item.reviewPlan?.retryOriginal && selection.item.errorMessage
? <p className="personal-proposal-state is-error" role="status">{selection.item.errorMessage}</p>
: selection.item.impact ? <p>{selection.item.impact}</p> : null}
{selection.item.reviewPlan && !selection.item.reviewPlan.creationExecution && !selection.item.reviewPlan.retryOriginal && !taskExecution && selection.item.actionKind !== "team.plan" && !(decisionFrame && ["ready", "applied"].includes(selection.item.status)) ? <p className="personal-proposal-explainer" data-action-review={selection.item.reviewPlan.interaction}>{operationUnknown
{selection.item.reviewPlan && !retainedTodoGate && !selection.item.reviewPlan.creationExecution && !selection.item.reviewPlan.retryOriginal && !taskExecution && selection.item.actionKind !== "team.plan" && !(decisionFrame && ["ready", "applied"].includes(selection.item.status)) ? <p className="personal-proposal-explainer" data-action-review={selection.item.reviewPlan.interaction}>{operationUnknown
? t("actionReview.operation_reconcile_original")
: selection.item.reviewPlan.operationFrame?.kind === "inactive"
? t(`actionReview.${selection.item.reviewPlan.operationFrame.reason}`)
Expand All @@ -1247,7 +1258,7 @@ export function ContextDrawer({ agents, attentionHistory = [], onSelectAttention
: t(`actionReview.${selection.item.reviewPlan.reason}`)}</p> : null}
{selection.item.status === "ready" && !selection.item.reviewPlan?.creationExecution && selection.item.actionKind !== "team.plan" && !decisionFrame ? <p className="personal-proposal-explainer">{t("drawer.proposalExplainer")}</p> : null}
{selection.item.reviewPlan?.creationExecution ? <GoalCreationExecution execution={selection.item.reviewPlan.creationExecution}/> : null}
{!taskExecution && visibleProposalFields.length ? <dl>{visibleProposalFields.map((field) => <div key={field.key}><dt>{field.label}</dt><dd>{field.value}</dd></div>)}</dl> : null}
{!taskExecution && shownProposalFields.length ? <dl>{shownProposalFields.map((field) => <div key={field.key}><dt>{field.label}</dt><dd>{field.value}</dd></div>)}</dl> : null}
</section>}
{selection.item.reviewPlan?.creationProgress?.goalId && selection.item.status !== "applied" ? <div className="personal-proposal-state is-applied" role="status" data-testid="goal-creation-committed"><Check size={16} /><span>
<strong>{t("proposal.field.goalId")}: {selection.item.reviewPlan.creationProgress.goalId} · {t("proposal.status.applied")}</strong>
Expand All @@ -1268,10 +1279,23 @@ export function ContextDrawer({ agents, attentionHistory = [], onSelectAttention
? <p className="personal-proposal-state is-stale">{t("proposal.primary.operationCancelled")}</p> : null}
{selection.item.status === "deferred" ? <p className="personal-proposal-state is-gated">{t("drawer.proposalDeferred")}</p> : null}
{selection.item.status === "gated" && selection.item.actionKind === "gate.resolve" ? <div className="personal-proposal-state is-gated"><span><strong>{t("drawer.gateDecisionRecheckTitle")}</strong>{t("drawer.gateDecisionRecheck")}</span></div>
: selection.item.status === "gated" ? <div className="personal-proposal-state is-gated"><span><strong>{selection.item.actionKind === "operation.execute" ? selection.item.primaryLabel : selection.item.workspaceCandidates?.length || selection.item.gate?.kind === "agent_unavailable" ? selection.item.title : t("drawer.gateRequiresHost")}</strong>{selection.item.actionKind === "operation.execute" || selection.item.workspaceCandidates?.length || selection.item.gate?.kind === "agent_unavailable" ? selection.item.impact : t("drawer.gateRequiresHostDescription")}</span>{selection.item.gate?.nextAction ? <small>{selection.item.gate.nextAction}</small> : null}</div> : null}
: selection.item.status === "gated" && !retainedTodoGate ? <div className="personal-proposal-state is-gated"><span><strong>{selection.item.actionKind === "operation.execute" ? selection.item.primaryLabel : selection.item.workspaceCandidates?.length || selection.item.gate?.kind === "agent_unavailable" ? selection.item.title : t("drawer.gateRequiresHost")}</strong>{selection.item.actionKind === "operation.execute" || selection.item.workspaceCandidates?.length || selection.item.gate?.kind === "agent_unavailable" ? selection.item.impact : t("drawer.gateRequiresHostDescription")}</span>{selection.item.gate?.nextAction ? <small>{selection.item.gate.nextAction}</small> : null}</div> : null}
{!readOnly && selection.item.workspaceCandidates?.length ? <div className="personal-workspace-candidates" aria-label={t("drawer.workspaceCandidates")}>{selection.item.workspaceCandidates.map((candidate) => <button key={candidate.workspaceRef} onClick={() => void callbacks.onSelectWorkspaceCandidate?.(selection.item, candidate.workspaceRef)} type="button"><strong>{candidate.label}</strong><small>{t("proposal.workspaceGate.candidateValue")}</small></button>)}</div> : null}
{!readOnly && selection.item.actionKind !== "operation.execute" && selection.item.status === "error" && (!["team.plan", "goal.create"].includes(selection.item.actionKind) || (selection.item.reviewPlan?.retryOriginal && selection.item.reviewPlan.canApply)) ? <button className="personal-primary-action" onClick={() => void (selection.item.reviewPlan?.retryOriginal ? callbacks.onApplyProposal?.(selection.item) : callbacks.onTransitionProposal?.(selection.item, "regenerate"))} type="button"><RotateCcw size={17} />{t(selection.item.reviewPlan?.retryOriginal ? "drawer.retryOriginal" : "drawer.proposalRegenerate")}</button> : !readOnly && selection.item.actionKind !== "operation.execute" && selection.item.status !== "gated" && !(["team.plan", "goal.create"].includes(selection.item.actionKind) && ["error", "stale"].includes(selection.item.status)) && !((selection.item.actionKind === "team.plan" || decisionFrame || taskExecution) && selection.item.status === "applied") ? <button className="personal-primary-action" disabled={!['ready', 'deferred'].includes(selection.item.status) || selection.item.reviewPlan?.canApply === false} onClick={() => void callbacks.onApplyProposal?.(selection.item)} type="button"><Check size={17} />{selection.item.status === "applying" ? t("drawer.applying") : selection.item.primaryLabel ?? t("drawer.apply")}</button> : null}
{!readOnly && selection.item.actionKind !== "operation.execute" && !selection.item.reviewPlan?.creationProgress?.goalId && (["stale", "gated", "rejected"].includes(selection.item.status) || (selection.item.status === "ready" && selection.item.reviewPlan?.canApply === false)) ? <button className="personal-secondary-action" onClick={() => void callbacks.onTransitionProposal?.(selection.item, "regenerate")} type="button"><RotateCcw size={16} />{t("drawer.proposalRecheck")}</button> : null}
{!readOnly && selection.item.actionKind !== "operation.execute" && selection.item.status === "error"
&& ((selection.item.reviewPlan?.retryOriginal && selection.item.reviewPlan.canApply)
|| (!preserveOriginalProposal && !["team.plan", "goal.create"].includes(selection.item.actionKind)))
? <button className="personal-primary-action" onClick={() => void (selection.item.reviewPlan?.retryOriginal ? callbacks.onApplyProposal?.(selection.item) : callbacks.onTransitionProposal?.(selection.item, "regenerate"))} type="button"><RotateCcw size={17} />{t(selection.item.reviewPlan?.retryOriginal ? "drawer.retryOriginal" : "drawer.proposalRegenerate")}</button>
: !readOnly && selection.item.actionKind !== "operation.execute" && selection.item.status !== "gated"
&& !((preserveOriginalProposal || ["team.plan", "goal.create"].includes(selection.item.actionKind))
&& ["error", "stale"].includes(selection.item.status))
&& !((selection.item.actionKind === "team.plan" || decisionFrame || taskExecution || completedTodoCreation)
&& selection.item.status === "applied")
? <button className="personal-primary-action" disabled={!['ready', 'deferred'].includes(selection.item.status) || selection.item.reviewPlan?.canApply === false} onClick={() => void callbacks.onApplyProposal?.(selection.item)} type="button"><Check size={17} />{selection.item.status === "applying" ? t("drawer.applying") : selection.item.primaryLabel ?? t("drawer.apply")}</button>
: null}
{!readOnly && selection.item.actionKind !== "operation.execute" && !preserveOriginalProposal
&& !selection.item.reviewPlan?.creationProgress?.goalId && (["stale", "gated", "rejected"].includes(selection.item.status)
|| (selection.item.status === "ready" && selection.item.reviewPlan?.canApply === false))
? <button className="personal-secondary-action" onClick={() => void callbacks.onTransitionProposal?.(selection.item, "regenerate")} type="button"><RotateCcw size={16} />{t("drawer.proposalRecheck")}</button> : null}
{!readOnly && selection.item.persisted !== false && selection.item.actionKind !== "operation.execute" && selection.item.actionKind !== "gate.resolve" && ["ready", "gated"].includes(selection.item.status) ? <div className="personal-drawer-action-grid"><button className="personal-secondary-action" onClick={() => void callbacks.onTransitionProposal?.(selection.item, "defer")} type="button">{t("drawer.proposalDefer")}</button><button className="personal-secondary-action" onClick={() => void callbacks.onTransitionProposal?.(selection.item, "reject")} type="button">{t("drawer.decisionReject")}</button></div> : null}
{!["applied", "applying"].includes(selection.item.status) ? <button className="personal-secondary-action" onClick={onClose} type="button">{t("drawer.proposalClose")}</button> : null}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ const en = {
"actionReview.canonical_update_retry": "The edit is not yet verified. Retry this operation to recover its result.",
"actionReview.goal_creation_retry": "Goal initialization is incomplete. Retry the original creation; its recorded storage choice is preserved.",
"actionReview.task_start_retry": "The Task was saved. Retry its original start to continue with that Task.",
"actionReview.todo_creation_retry": "Confirmation submitted. Retry to recover the original result.",
"actionReview.canonical_update_projection_pending": "The operation was committed; display delivery is pending. Retry this operation to restore the current view.",
"actionReview.team_plan_retry": "Retry this assignment using the original plan. Current state is checked again, and any tasks already created are recovered without duplication.",
"actionReview.apply_failed": "Execution did not complete. Check the failure and regenerate the preview before retrying.",
Expand Down Expand Up @@ -2587,6 +2588,7 @@ const zhCN: Record<WorkspaceMessageKey, string> = {
"actionReview.canonical_update_retry": "编辑结果尚未确认。重试此操作以恢复原结果。",
"actionReview.goal_creation_retry": "Goal 初始化尚未完成。请重试原创建操作,已记录的存储选择会保留。",
"actionReview.task_start_retry": "任务已保存。重试原操作以继续启动这个任务。",
"actionReview.todo_creation_retry": "已提交创建确认。重试本次确认以取回结果。",
"actionReview.canonical_update_projection_pending": "操作已提交,展示尚未同步。重试此操作以恢复当前视图。",
"actionReview.team_plan_retry": "可以从同一提案重试分配。系统会重新核验当前状态,并恢复已记录的结果,不会重复创建任务。",
"actionReview.apply_failed": "执行未完成。请检查失败原因并重新生成预览后再试。",
Expand Down
Loading
Loading