删除退役策划 V2 前端审批面板
移除旧版 GDD 审批卡和策划运行条组件 项目总控视图仅保留新版 Design Agent 与通用运行面板
This commit is contained in:
File diff suppressed because it is too large
Load Diff
-171
@@ -1,171 +0,0 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import type {
|
||||
AgentRuntimeState,
|
||||
AgentRuntimeUserInputRequest,
|
||||
} from '../../app/types';
|
||||
import {
|
||||
AgentRuntimeUserInputCard,
|
||||
projectRuntimeVisibleError,
|
||||
} from '../agent-runtime';
|
||||
|
||||
type PlanningLaneRuntimeStripProps = {
|
||||
runtime: AgentRuntimeState | null;
|
||||
error: string;
|
||||
controlBusy: boolean;
|
||||
readOnly?: boolean;
|
||||
onSupervisorRetry: (runtime: AgentRuntimeState) => Promise<string>;
|
||||
onUserInput: (
|
||||
request: AgentRuntimeUserInputRequest,
|
||||
responseId: string,
|
||||
answers: Record<string, string>,
|
||||
) => void | Promise<void>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 立项策划链路下替代 `ProjectSupervisorRuntimePanel` 的窄条。
|
||||
*
|
||||
* 完整面板是为做游戏链路设计的:十几个专业 Agent、多步计划、逐 Agent 重试。套到
|
||||
* 策划链路上,子 Agent 永远只有 `project-planning` 一个,计划永远一两步,「专业
|
||||
* Agent 协作:1」永远是 1——它把 D11 的「总控 + 委派子 Run」拓扑整个漏给了用户,而
|
||||
* 用户的心智模型是在跟一个策划聊天。状态本身由顶部的 `PlanGddStageProgress` 承担。
|
||||
*
|
||||
* 这里只画真正需要用户动手的两样:澄清问答卡,以及失败后的恢复入口。其余时候
|
||||
* 返回 null,不占一行。
|
||||
*
|
||||
* 完整面板在 `waiting-for-user-input` 却读不到 `userInputRequest` 时会画一句
|
||||
* 「待回答问题未能读取」。策划链路里这个组合出现在子 Run 退出到父 Run 醒来之间的
|
||||
* 瞬时窗口,以及审批等待(交互面是审批卡)——两种都不是读取失败,所以这里不画。
|
||||
*/
|
||||
export function PlanningLaneRuntimeStrip({
|
||||
runtime,
|
||||
error,
|
||||
controlBusy,
|
||||
readOnly = false,
|
||||
onSupervisorRetry,
|
||||
onUserInput,
|
||||
}: PlanningLaneRuntimeStripProps) {
|
||||
const [retrySubmitting, setRetrySubmitting] = useState(false);
|
||||
const [retryAccepted, setRetryAccepted] = useState(false);
|
||||
const [retryFeedback, setRetryFeedback] = useState('');
|
||||
useEffect(() => {
|
||||
setRetrySubmitting(false);
|
||||
setRetryAccepted(false);
|
||||
if (runtime?.status === 'failed' || runtime?.phase === 'failed') {
|
||||
setRetryFeedback('');
|
||||
}
|
||||
}, [runtime?.phase, runtime?.runId, runtime?.status]);
|
||||
|
||||
const userInputRequest = readOnly
|
||||
? null
|
||||
: (runtime?.userInputRequest ?? null);
|
||||
const needsReconciliation = Boolean(
|
||||
runtime &&
|
||||
(runtime.status === 'needs-reconciliation' ||
|
||||
runtime.phase === 'needs-reconciliation'),
|
||||
);
|
||||
// Planning V2 has no supported manual retry path. Its Provider failure is
|
||||
// terminal for the current session; exposing the generic Supervisor retry
|
||||
// would incorrectly enter the retired V1 Runtime and report a busy service.
|
||||
const showRecovery = false;
|
||||
// 与完整面板同源:App 层的操作错误(如「请先回答当前的澄清问题」)优先,其次是
|
||||
// run 自己记下的失败原因。这是原面板里唯一真正面向用户的一行文字,照搬。
|
||||
const rawErrorDetail = error || runtime?.error || '';
|
||||
const errorDetail = rawErrorDetail
|
||||
? projectRuntimeVisibleError(rawErrorDetail, '项目总控 Agent', true)
|
||||
: '';
|
||||
|
||||
if (!userInputRequest && !showRecovery && !errorDetail) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
className="agent-runtime-status planning-lane-runtime-strip"
|
||||
aria-label="立项策划运行状态"
|
||||
>
|
||||
{errorDetail ? (
|
||||
<small className="project-runtime-error" role="alert">
|
||||
{errorDetail}
|
||||
</small>
|
||||
) : null}
|
||||
{showRecovery && runtime ? (
|
||||
<div
|
||||
className="project-runtime-recovery"
|
||||
aria-label={
|
||||
needsReconciliation ? '立项策划待核对恢复' : '立项策划失败恢复'
|
||||
}
|
||||
>
|
||||
<span>
|
||||
{needsReconciliation ? (
|
||||
<>
|
||||
本轮工具动作的结果不确定,需要先结束旧任务。
|
||||
<small>不会直接重试,避免重复执行未核对的动作。</small>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
本轮策划已停止。
|
||||
<small>在当前项目重新启动策划,不会新建项目。</small>
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
disabled={controlBusy || retrySubmitting || retryAccepted}
|
||||
onClick={() => {
|
||||
setRetryFeedback(
|
||||
needsReconciliation
|
||||
? '正在结束待核对的旧任务…'
|
||||
: '正在重新启动策划…',
|
||||
);
|
||||
setRetrySubmitting(true);
|
||||
void onSupervisorRetry(runtime)
|
||||
.then((message) => {
|
||||
setRetryAccepted(true);
|
||||
setRetryFeedback(message);
|
||||
})
|
||||
.catch((retryError) => {
|
||||
setRetryAccepted(false);
|
||||
setRetryFeedback(
|
||||
projectRuntimeVisibleError(
|
||||
retryError instanceof Error
|
||||
? retryError.message
|
||||
: String(retryError),
|
||||
'项目总控 Agent',
|
||||
true,
|
||||
),
|
||||
);
|
||||
})
|
||||
.finally(() => setRetrySubmitting(false));
|
||||
}}
|
||||
>
|
||||
{retrySubmitting
|
||||
? needsReconciliation
|
||||
? '正在结束旧任务…'
|
||||
: '正在重新启动…'
|
||||
: retryAccepted
|
||||
? needsReconciliation
|
||||
? '旧任务结束请求已受理'
|
||||
: '重试已受理'
|
||||
: needsReconciliation
|
||||
? '已核对,结束旧任务'
|
||||
: '重新启动策划'}
|
||||
</button>
|
||||
{retryFeedback ? (
|
||||
<small className="project-runtime-retry-feedback" role="status">
|
||||
{retryFeedback}
|
||||
</small>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
{userInputRequest && !controlBusy ? (
|
||||
<AgentRuntimeUserInputCard
|
||||
key={`${userInputRequest.requestId}:${userInputRequest.responseId ?? 'pending'}`}
|
||||
request={userInputRequest}
|
||||
controlBusy={controlBusy}
|
||||
onSubmit={onUserInput}
|
||||
/>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
+7
-57
@@ -13,8 +13,6 @@ import type {
|
||||
GameCreatorDirectTurnUpdateStatus,
|
||||
PendingCommand,
|
||||
PendingUiConfirmation,
|
||||
PlanGddDecisionAction,
|
||||
PlanGddStateViewV1,
|
||||
} from '../../app/types';
|
||||
import type { DesignClarificationRequest, DesignView } from '../../app/types';
|
||||
import { ChatMarkdownMessage } from '../../components/ChatMarkdownMessage';
|
||||
@@ -35,13 +33,10 @@ import {
|
||||
DesignAgentPendingActions,
|
||||
DesignAgentPhaseStatus,
|
||||
} from './DesignAgentSurface';
|
||||
import { PlanGddSurface } from './GddApprovalCard';
|
||||
import {
|
||||
pendingCommandDetail,
|
||||
pendingCommandTitle,
|
||||
} from './pendingCommandPresentation';
|
||||
import { isPlanningLaneRuntime } from './planningLane';
|
||||
import { PlanningLaneRuntimeStrip } from './PlanningLaneRuntimeStrip';
|
||||
import { resolvePendingCommandProjectPath } from './projectCommandPolicy';
|
||||
import {
|
||||
ResourceReferenceInput,
|
||||
@@ -100,17 +95,6 @@ type ProjectSupervisorViewProps = RuntimePanelProps & {
|
||||
visibleMessages: ChatMessage[];
|
||||
visibleProfessionalAgentCards: AgentStatusCard[];
|
||||
workspaceStatus: string;
|
||||
planGddState: PlanGddStateViewV1 | null;
|
||||
planGddHydrateBusy: boolean;
|
||||
planGddDecisionBusy: boolean;
|
||||
planGddError: string | null;
|
||||
planningLane?: boolean;
|
||||
onPlanGddRefresh: () => void;
|
||||
onPlanGddDecision: (
|
||||
action: PlanGddDecisionAction,
|
||||
comment: string | null,
|
||||
) => Promise<void>;
|
||||
onMakeGameFromApprovedGdd?: () => Promise<void>;
|
||||
versions?: import('../../../../../packages/shared/src/contracts/gameCreationApp').GameIterationVersion[];
|
||||
designView?: DesignView | null;
|
||||
onDesignApprove?: (requestId: string, approved: boolean) => void;
|
||||
@@ -152,14 +136,6 @@ export function ProjectSupervisorView({
|
||||
visibleMessages,
|
||||
visibleProfessionalAgentCards,
|
||||
workspaceStatus,
|
||||
planGddState,
|
||||
planGddHydrateBusy,
|
||||
planGddDecisionBusy,
|
||||
planGddError,
|
||||
planningLane = false,
|
||||
onPlanGddRefresh,
|
||||
onPlanGddDecision,
|
||||
onMakeGameFromApprovedGdd,
|
||||
versions,
|
||||
designView = null,
|
||||
onDesignApprove,
|
||||
@@ -167,8 +143,6 @@ export function ProjectSupervisorView({
|
||||
onDesignRetry,
|
||||
...runtimePanelProps
|
||||
}: ProjectSupervisorViewProps) {
|
||||
const planningSurfaceActive =
|
||||
planningLane || isPlanningLaneRuntime(runtimePanelProps.runtime);
|
||||
const [expandedProcessKey, setExpandedProcessKey] = useState<string | null>(
|
||||
null,
|
||||
);
|
||||
@@ -217,25 +191,13 @@ export function ProjectSupervisorView({
|
||||
{designView || onDesignApprove ? (
|
||||
<DesignAgentPhaseStatus
|
||||
view={designView}
|
||||
busy={runtimePanelProps.controlBusy || planGddDecisionBusy}
|
||||
error={planGddError}
|
||||
busy={runtimePanelProps.controlBusy}
|
||||
error={runtimePanelProps.error}
|
||||
onApprove={onDesignApprove ?? (() => undefined)}
|
||||
onClarify={onDesignClarify ?? (() => undefined)}
|
||||
onRetry={onDesignRetry ?? (() => undefined)}
|
||||
/>
|
||||
) : (
|
||||
<PlanGddSurface
|
||||
state={planGddState}
|
||||
active={planningSurfaceActive}
|
||||
projectPath={projectPath}
|
||||
hydrateBusy={planGddHydrateBusy}
|
||||
decisionBusy={planGddDecisionBusy}
|
||||
error={planGddError}
|
||||
onRefresh={onPlanGddRefresh}
|
||||
onDecision={onPlanGddDecision}
|
||||
onMakeGame={onMakeGameFromApprovedGdd}
|
||||
/>
|
||||
)}
|
||||
) : null}
|
||||
<div
|
||||
ref={messagesRef}
|
||||
className="message-list project-supervisor-message-list"
|
||||
@@ -343,20 +305,8 @@ export function ProjectSupervisorView({
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
{directCodex ? null : planningSurfaceActive ? (
|
||||
<PlanningLaneRuntimeStrip
|
||||
runtime={runtimePanelProps.runtime}
|
||||
error={runtimePanelProps.error}
|
||||
controlBusy={runtimePanelProps.controlBusy}
|
||||
readOnly={runtimePanelProps.readOnly}
|
||||
onSupervisorRetry={runtimePanelProps.onSupervisorRetry}
|
||||
onUserInput={runtimePanelProps.onUserInput}
|
||||
/>
|
||||
) : (
|
||||
<ProjectSupervisorRuntimePanel
|
||||
{...runtimePanelProps}
|
||||
planGddAwaitingDecision={Boolean(planGddState?.pendingApproval)}
|
||||
/>
|
||||
{directCodex ? null : (
|
||||
<ProjectSupervisorRuntimePanel {...runtimePanelProps} />
|
||||
)}
|
||||
{pendingCommand ? (
|
||||
<div className="pending-command">
|
||||
@@ -399,8 +349,8 @@ export function ProjectSupervisorView({
|
||||
{designView || onDesignApprove ? (
|
||||
<DesignAgentPendingActions
|
||||
view={designView}
|
||||
busy={runtimePanelProps.controlBusy || planGddDecisionBusy}
|
||||
error={planGddError}
|
||||
busy={runtimePanelProps.controlBusy}
|
||||
error={runtimePanelProps.error}
|
||||
onApprove={onDesignApprove ?? (() => undefined)}
|
||||
onClarify={onDesignClarify ?? (() => undefined)}
|
||||
onRetry={onDesignRetry ?? (() => undefined)}
|
||||
|
||||
Reference in New Issue
Block a user