Merge pull request '新增 AGC 首页策划补全入口' (#369) from feat/entrance into master
Project CI / AI game creator shell Rust shard 4/4 (push) Successful in 5m30s
Project CI / AI game creator shell Rust shard 2/4 (push) Successful in 6m0s
Project CI / AI game creator shell Rust shard 1/4 (push) Successful in 6m12s
Project CI / AI game creator shell Rust shard 3/4 (push) Successful in 6m25s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m40s
Project CI / AI game creator shell Rust crates (push) Successful in 2m13s
Project CI / Repository checks (push) Successful in 3m59s
Project CI / Frontend tests (push) Successful in 5m36s
Project CI / Native shell tests (push) Successful in 6m35s
Project CI / Backend tests (push) Successful in 7m13s
Project CI / AI game creator shell web tests (push) Successful in 3m31s

Reviewed-on: https://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/369
This commit was merged in pull request #369.
This commit is contained in:
2026-09-15 12:29:47 +08:00
5 changed files with 98 additions and 5 deletions
@@ -0,0 +1,12 @@
import type { ProjectStartMode } from '../../app/types';
import type { HomeCreationType } from './useHomeDraftStore';
export function resolveHomeStartMode(
creationType: HomeCreationType,
planningCompletionEnabled: boolean,
): ProjectStartMode {
return creationType === 'doc' ||
(creationType === 'game' && planningCompletionEnabled)
? 'planning'
: 'direct-build';
}
@@ -20,6 +20,7 @@ import {
richTextToAttachments,
richTextToPrompt,
} from './components/RichInputArea/richTextToPrompt';
import { resolveHomeStartMode } from './homeStartMode';
import InspirationGallery from './InspirationGallery';
import {
type HomeCreationType,
@@ -145,14 +146,18 @@ export default function HomeView({
(state) => state.setRichText,
);
const [homeCreationBusy, setHomeCreationBusy] = useState(false);
const [planningCompletionEnabled, setPlanningCompletionEnabled] =
useState(false);
const homeCreationBusyRef = useRef(false);
const activeCreationType =
HOME_CREATION_TYPE_ITEMS.find(
(item) => item.creationType === homeCreationType,
) ?? HOME_CREATION_TYPE_ITEMS[0]!;
// 做方案走立项策划链路做游戏 / 做素材维持既有的直接开建路由
const startMode: ProjectStartMode =
homeCreationType === 'doc' ? 'planning' : 'direct-build';
// 做方案始终走立项策划链路做游戏勾选“策划补全”时复用该链路,做素材保持直接开建。
const startMode = resolveHomeStartMode(
homeCreationType,
planningCompletionEnabled,
);
async function createFromHome() {
if (homeCreationBusyRef.current || creationBusy) {
@@ -241,7 +246,12 @@ export default function HomeView({
type="button"
key={item.creationType}
aria-pressed={isActive}
onClick={() => setHomeCreationType(item.creationType)}
onClick={() => {
setHomeCreationType(item.creationType);
if (item.creationType !== 'game') {
setPlanningCompletionEnabled(false);
}
}}
>
<CreationTypeIcon size={14} aria-hidden="true" />
{item.label}
@@ -262,8 +272,21 @@ export default function HomeView({
}}
>
<div className="grid grid-cols-[1fr_auto] items-center gap-2.5 text-[12px] text-(--platform-text-soft)">
<div className="flex min-w-0 items-center gap-1.5">
<div className="flex min-w-0 items-center gap-3">
<UploadButton />
{homeCreationType === 'game' ? (
<label className="inline-flex cursor-pointer items-center gap-1.5 whitespace-nowrap">
<input
type="checkbox"
checked={planningCompletionEnabled}
onChange={(event) =>
setPlanningCompletionEnabled(event.target.checked)
}
disabled={homeCreationBusy || creationBusy}
/>
<span></span>
</label>
) : null}
</div>
<div className="flex shrink-0 items-center gap-1.5">
<ConversationModelSelect
@@ -0,0 +1,18 @@
import { describe, expect, it } from 'vitest';
import { resolveHomeStartMode } from '../src/view/home/homeStartMode';
describe('AGC 首页启动模式', () => {
it('做游戏勾选策划补全时进入策划 runtime', () => {
expect(resolveHomeStartMode('game', true)).toBe('planning');
});
it('做游戏未勾选策划补全时保持直接创作', () => {
expect(resolveHomeStartMode('game', false)).toBe('direct-build');
});
it('做方案始终进入策划 runtime,其他入口不受影响', () => {
expect(resolveHomeStartMode('doc', false)).toBe('planning');
expect(resolveHomeStartMode('art', true)).toBe('direct-build');
});
});
@@ -0,0 +1,20 @@
Version: 1
Status: active
Date: 2026-09-15
Parent Spec: 【里程碑】AGC首页策划补全入口-2026-09-15.md
## 修改顺序
1.`view/home/index.tsx` 增加本地复选框状态与入口切换清理。
2. 将游戏勾选状态映射到既有 `ProjectStartMode`
3. 增加启动模式纯函数测试,覆盖模式分流;首页显示边界和切换清理作为后续组件测试补充项。
## 验证
- AGC 首页相关定向测试。
- AGC 前端 typecheck。
- `npm run check:encoding``git diff --check`
## 当前验证边界
本次已交付测试覆盖 `planning` / `direct-build` 模式分流;“策划补全”复选框的显示边界及切换创作类型后的状态清理尚未有组件级自动化测试,需后续补充 `HomeView` 测试时完成。
@@ -0,0 +1,20 @@
Version: 1
Status: active
Date: 2026-09-15
Parent Spec: AGC 首页与 Agent Runtime 入口
## 范围
在首页“做游戏”输入框下增加“策划补全”复选框;勾选后复用现有 `planning` 启动模式进入策划 Agent Runtime。
## 验收标准
- 仅“做游戏”显示复选框。
- 勾选时提交 `planning`,未勾选时提交 `direct-build`
- “做方案”原有 `planning` 行为保持不变。
- 切换到其它创作类型时清除游戏专属勾选状态。
## 不做项
- 不新增 runtime 类型、后端接口或持久化字段。
- 不改变现有策划 runtime 内部流程。