diff --git a/apps/ai-game-creator-shell/src/view/project-development/export/state/xhsMinitoolFailure.ts b/apps/ai-game-creator-shell/src/view/project-development/export/state/xhsMinitoolFailure.ts index aa0764118..bf59f3f4f 100644 --- a/apps/ai-game-creator-shell/src/view/project-development/export/state/xhsMinitoolFailure.ts +++ b/apps/ai-game-creator-shell/src/view/project-development/export/state/xhsMinitoolFailure.ts @@ -8,8 +8,13 @@ import { expectNever } from '../../../../app/expectNever'; import type { XHSMiniToolExportError } from '../generated/XHSMiniToolExportError'; import { XHS_MINITOOL_FIELD_LABELS } from './xhsMinitoolFields'; -/** 失败之后最合适的下一步:交给 code agent 修,还是原样重试。 */ -export type XhsMinitoolFailureAction = 'adapt' | 'retry'; +/** + * 失败之后最合适的下一步,也就是那颗按钮干什么: + * - `adapt`:项目还没适配(没有构建脚本),该入队的是首次适配指令; + * - `repair`:适配过了但这次没跑通(脚本非零退出、产物不在、注册表被改坏),该入队的是修复指令; + * - `retry`:不用 agent 掺和,用户自己改或原样重试。 + */ +export type XhsMinitoolFailureAction = 'adapt' | 'repair' | 'retry'; export type XhsMinitoolFailureNotice = { /** 一句话说清哪儿不对。 */ @@ -27,7 +32,7 @@ export function describeXhsMinitoolFailure( return { message: '导出注册表被改成了宿主认不出的形状,宿主拒绝猜测它的内容。', detail: error.cause, - action: 'adapt', + action: 'repair', }; case 'formInvalid': return { @@ -54,13 +59,13 @@ export function describeXhsMinitoolFailure( ? '构建脚本没能启动(沙箱 / 运行环境层面就失败了)。' : `构建脚本没有正常退出(exit code ${error.exitCode})。`, detail: error.outputTail, - action: 'adapt', + action: 'repair', }; case 'artifactMissing': return { message: `构建脚本跑完了,但 ${error.path} 不在。多数是把 zip 写到了别处。`, detail: '', - action: 'adapt', + action: 'repair', }; case 'exportUnavailable': return { diff --git a/apps/ai-game-creator-shell/src/view/project-development/export/tabs/xiaohongshu/ArtifactsPane.tsx b/apps/ai-game-creator-shell/src/view/project-development/export/tabs/xiaohongshu/ArtifactsPane.tsx index f60c33062..ac91fe6c4 100644 --- a/apps/ai-game-creator-shell/src/view/project-development/export/tabs/xiaohongshu/ArtifactsPane.tsx +++ b/apps/ai-game-creator-shell/src/view/project-development/export/tabs/xiaohongshu/ArtifactsPane.tsx @@ -28,6 +28,19 @@ export function ArtifactsPane({ }) { const [downloadNotice, setDownloadNotice] = useState(''); const { form, conflict } = minitool; + /** + * 未适配:那颗按钮搬进提示卡片,说明和入口放一起,用户不用在别处找。 + * + * 判据带上 `form`:`hasScript` 的初值是 `false`,注册表还没读回来(或读失败)时我们不能替项目 + * 下「还没适配」的结论——那种情况只该显示读取中或失败现场。 + * + * 判据带上 `failure`:失败卡片带着宿主的现场和同一颗按钮,两张卡一起出现就是同一件事两个入口。 + */ + const missingScript = + !minitool.loading && + form !== null && + !minitool.hasScript && + minitool.failure === null; const downloadIcon = (): void => { if (!projectPath || !form) return; @@ -55,19 +68,21 @@ export function ArtifactsPane({ aria-label="导出内容区" >
- {`项目里还没有 ${XHS_MINITOOL_SCRIPT_NAME} 脚本。点「适配」把这项工作交给 code agent:它会在项目里实验出能产出平台制品的脚本,并把这套做法固化进项目。`} -
+ {missingScript ? ( ++ {`项目里还没有 \`${XHS_MINITOOL_SCRIPT_NAME}\` 脚本——这就是「还没适配」的判据。这件事只能由 code agent 在项目里实验完成(用哪版 vite 配置、入口在哪、怎么调打包脚本都由它定):`} +
+