删除按已退役工作台壳聊天入口编写的预览与 Run 历史用例
- 删除 apps/ai-game-creator-shell/tests/appSurface/project-preview.suite.ts 及其下 preview-shortcuts.suite / run-history.suite 与全部辅助模块(fixtures、invoke-mock、message-bubble、四个 assert-* 流程) - 删除 tests/appSurface.test.ts 里对应的 import 与注册 - 这些用例断言的是已退役的 Supervisor 工作台壳:项目摘要面板、开发环境、LLM 状态、Agent 状态、编排 Trace、`/runs` `/read` 聊天命令,以及 `chat_with_game_creator_agent`;这些对象在当前源码里都已不存在
This commit is contained in:
@@ -17,7 +17,6 @@ import {
|
||||
registerProjectWorkbenchFoundationTests,
|
||||
registerProjectWorkbenchNavigationTests,
|
||||
} from './appSurface/project-development.suite';
|
||||
import { registerProjectPreviewAndRunHistoryTests } from './appSurface/project-preview.suite';
|
||||
import {
|
||||
registerAgentStatusDerivationTests,
|
||||
registerRuntimeSettingsTests,
|
||||
@@ -47,7 +46,6 @@ describe('AI 游戏创作 App 界面边界', () => {
|
||||
registerRuntimeSettingsTests();
|
||||
registerRecentProjectsTests();
|
||||
registerProjectWorkbenchNavigationTests();
|
||||
registerProjectPreviewAndRunHistoryTests();
|
||||
registerProjectConversationTests();
|
||||
registerProjectAgentStatusTests();
|
||||
registerPlanGddApprovalTests();
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { registerProjectPreviewShortcutTests } from './project-preview/preview-shortcuts.suite';
|
||||
import { registerProjectRunHistoryTests } from './project-preview/run-history.suite';
|
||||
|
||||
export function registerProjectPreviewAndRunHistoryTests() {
|
||||
registerProjectPreviewShortcutTests();
|
||||
registerProjectRunHistoryTests();
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
import { it } from '../harness';
|
||||
import { openPreviewShortcutProject } from './preview-shortcuts/actions';
|
||||
import { arrangePreviewShortcutTest } from './preview-shortcuts/arrange';
|
||||
import { assertPlanningAndStatusShortcutFlow } from './preview-shortcuts/assert-planning-and-status-shortcuts';
|
||||
import { assertPlaytestAndReleaseShortcutFlow } from './preview-shortcuts/assert-playtest-and-release-shortcuts';
|
||||
import { assertProjectAndDesignShortcutFlow } from './preview-shortcuts/assert-project-and-design-shortcuts';
|
||||
import { assertProjectToolsAndPreviewFlow } from './preview-shortcuts/assert-project-tools-and-preview';
|
||||
|
||||
export function registerProjectPreviewShortcutTests() {
|
||||
it('runs preview shortcuts from the main project window', async () => {
|
||||
const { invoke } = arrangePreviewShortcutTest();
|
||||
|
||||
openPreviewShortcutProject();
|
||||
|
||||
await assertProjectAndDesignShortcutFlow(invoke);
|
||||
await assertPlanningAndStatusShortcutFlow(invoke);
|
||||
await assertPlaytestAndReleaseShortcutFlow(invoke);
|
||||
await assertProjectToolsAndPreviewFlow(invoke);
|
||||
}, 60000);
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
import { renderAppAt } from '../../harness';
|
||||
|
||||
export function openPreviewShortcutProject() {
|
||||
renderAppAt('/?main&projectPath=%2Ftmp%2Fauthorized-game');
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
import { createPreviewShortcutFixture } from './fixtures';
|
||||
import { createPreviewShortcutInvoke } from './invoke-mock';
|
||||
|
||||
export function arrangePreviewShortcutTest() {
|
||||
const fixture = createPreviewShortcutFixture();
|
||||
const invoke = createPreviewShortcutInvoke(fixture);
|
||||
window.__TAURI__ = { core: { invoke } };
|
||||
|
||||
return { invoke };
|
||||
}
|
||||
-1705
File diff suppressed because it is too large
Load Diff
-1807
File diff suppressed because it is too large
Load Diff
-1557
File diff suppressed because it is too large
Load Diff
-832
File diff suppressed because it is too large
Load Diff
-122
@@ -1,122 +0,0 @@
|
||||
import {
|
||||
createGameCreationAppManifest,
|
||||
createGameCreationAppSeedTasks,
|
||||
GAME_CREATION_AGENT_RUN_SCHEMA_VERSION,
|
||||
type GameCreationAgentRunTrace,
|
||||
} from '../../harness';
|
||||
|
||||
export interface PreviewShortcutFixture {
|
||||
manifest: ReturnType<typeof createGameCreationAppManifest>;
|
||||
trace: GameCreationAgentRunTrace;
|
||||
}
|
||||
|
||||
export function createPreviewShortcutFixture(): PreviewShortcutFixture {
|
||||
const manifest = createGameCreationAppManifest(
|
||||
'local-project-draft',
|
||||
'未命名游戏原型',
|
||||
);
|
||||
manifest.goal = '做一个厨房弹幕游戏';
|
||||
manifest.assets.push({
|
||||
id: 'asset-hero',
|
||||
kind: 'uploaded',
|
||||
mediaType: 'text/plain',
|
||||
localPath: 'assets/uploads/hero.txt',
|
||||
source: { kind: 'uploaded' },
|
||||
});
|
||||
manifest.assets.push({
|
||||
id: 'asset-canvas',
|
||||
kind: 'canvas',
|
||||
mediaType: 'image/png',
|
||||
localPath: 'assets/canvas-sync/tiles.png',
|
||||
source: { kind: 'canvas', canvasProjectId: 'canvas-1' },
|
||||
});
|
||||
manifest.commandRuns = [
|
||||
{
|
||||
commandId: 'game.static_smoke',
|
||||
status: 'completed',
|
||||
output: 'static smoke passed',
|
||||
logPath: '.agent/logs/command.log',
|
||||
updatedAt: 1700000003,
|
||||
},
|
||||
];
|
||||
const trace: GameCreationAgentRunTrace = {
|
||||
schemaVersion: GAME_CREATION_AGENT_RUN_SCHEMA_VERSION,
|
||||
runId: 'run-main-shortcut-trace',
|
||||
commandId: 'game.generate_draft',
|
||||
status: 'passed',
|
||||
lifecycleStatus: 'done',
|
||||
passes: 1,
|
||||
maxPasses: 3,
|
||||
toolCallCount: 1,
|
||||
maxToolCalls: 128,
|
||||
stopReason: 'evaluator-passed',
|
||||
goal: '做一个厨房弹幕游戏',
|
||||
coordination: 'Planner -> Generator',
|
||||
steps: [
|
||||
{
|
||||
pass: 1,
|
||||
agent: 'Generator',
|
||||
phase: 'generate',
|
||||
status: 'completed',
|
||||
inputPaths: ['.agent/spec.md'],
|
||||
outputPaths: ['.agent/passes/pass-1/draft.json'],
|
||||
summary: '生成可运行草案',
|
||||
toolCalls: [
|
||||
{
|
||||
toolId: 'llm.chat.generator',
|
||||
status: 'ok',
|
||||
summary: 'Generator 生成草案',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
pass: 1,
|
||||
agent: 'Evaluator',
|
||||
phase: 'evaluation',
|
||||
status: 'passed',
|
||||
inputPaths: ['.agent/passes/pass-1/draft.json', '.agent/findings.md'],
|
||||
outputPaths: ['.agent/findings.md'],
|
||||
summary: '质量评审通过',
|
||||
toolCalls: [
|
||||
{
|
||||
toolId: 'agent.evaluate',
|
||||
status: 'ok',
|
||||
summary: 'Evaluator 质量评审',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
artifacts: [
|
||||
{
|
||||
path: 'exports/README.md',
|
||||
sizeBytes: 128,
|
||||
checksum: 'fnv1a64:exports',
|
||||
},
|
||||
{
|
||||
path: '.agent/passes/pass-1/agenda.md',
|
||||
sizeBytes: 96,
|
||||
checksum: 'fnv1a64:agenda',
|
||||
},
|
||||
{
|
||||
path: '.agent/passes/pass-1/groups/art/asset.md',
|
||||
sizeBytes: 192,
|
||||
checksum: 'fnv1a64:art-asset',
|
||||
},
|
||||
],
|
||||
taskGraph: {
|
||||
goal: '做一个厨房弹幕游戏',
|
||||
readyTaskIds: ['art-asset-plan'],
|
||||
activeTaskIds: [],
|
||||
carriedTaskIds: [],
|
||||
repairFocus: [],
|
||||
repairRoutes: [],
|
||||
tasks: createGameCreationAppSeedTasks(),
|
||||
},
|
||||
passPlans: [],
|
||||
nextStep: 'preview',
|
||||
error: null,
|
||||
updatedAt: 1,
|
||||
};
|
||||
|
||||
return { manifest, trace };
|
||||
}
|
||||
-302
@@ -1,302 +0,0 @@
|
||||
import { emptyProjectPolicy, vi } from '../../harness';
|
||||
import type { PreviewShortcutFixture } from './fixtures';
|
||||
|
||||
export function createPreviewShortcutInvoke({
|
||||
manifest,
|
||||
trace,
|
||||
}: PreviewShortcutFixture) {
|
||||
const invoke = vi.fn(
|
||||
async (command: string, args?: Record<string, unknown>) => {
|
||||
if (command === 'append_local_permission_log') {
|
||||
return {};
|
||||
}
|
||||
if (command === 'read_project_permission_policy') {
|
||||
return emptyProjectPolicy();
|
||||
}
|
||||
if (command === 'init_local_game_project') {
|
||||
const projectPath = String(args?.projectPath ?? '');
|
||||
return {
|
||||
projectPath,
|
||||
manifestPath: `${projectPath}/.agent/manifest.json`,
|
||||
manifest,
|
||||
};
|
||||
}
|
||||
if (command === 'read_local_conversation') {
|
||||
return {
|
||||
path: '/tmp/authorized-game/.agent/conversations/project.jsonl',
|
||||
agentId: null,
|
||||
messages: [],
|
||||
};
|
||||
}
|
||||
if (command === 'run_limited_local_command') {
|
||||
return {
|
||||
commandId: 'game.static_smoke',
|
||||
status: 'completed',
|
||||
output: 'static smoke passed',
|
||||
logPath: '.agent/logs/command.log',
|
||||
};
|
||||
}
|
||||
if (command === 'start_local_game_preview') {
|
||||
return {
|
||||
status: 'running',
|
||||
url: 'http://127.0.0.1:3210/',
|
||||
port: 3210,
|
||||
root: String(args?.projectPath ?? ''),
|
||||
};
|
||||
}
|
||||
if (command === 'activate_local_game_preview') {
|
||||
return {
|
||||
status: 'running',
|
||||
url: 'http://127.0.0.1:3210/',
|
||||
port: 3210,
|
||||
root: String(args?.projectPath ?? ''),
|
||||
};
|
||||
}
|
||||
if (command === 'get_local_game_preview_status') {
|
||||
return {
|
||||
status: 'running',
|
||||
url: 'http://127.0.0.1:3210/',
|
||||
port: 3210,
|
||||
root: String(args?.projectPath ?? ''),
|
||||
};
|
||||
}
|
||||
if (command === 'stop_local_game_preview') {
|
||||
return {
|
||||
status: 'stopped',
|
||||
url: null,
|
||||
port: null,
|
||||
root: null,
|
||||
};
|
||||
}
|
||||
if (command === 'get_local_game_manifest') {
|
||||
return manifest;
|
||||
}
|
||||
if (command === 'get_game_creation_agent_capabilities') {
|
||||
return [
|
||||
{
|
||||
id: 'native-only-capability',
|
||||
area: 'agent-runtime',
|
||||
title: 'Native Runtime 能力',
|
||||
},
|
||||
];
|
||||
}
|
||||
if (command === 'get_limited_local_commands') {
|
||||
return [{ id: 'game.static_smoke', title: '静态入口自检' }];
|
||||
}
|
||||
if (command === 'check_game_creator_llm_config') {
|
||||
return {
|
||||
agentMode: 'codex_app_server',
|
||||
configured: true,
|
||||
accountCredentialState: 'available',
|
||||
officialRouteLocked: true,
|
||||
baseUrl: 'https://router.genarrative.world/v1',
|
||||
model: 'gpt-5.6-sol',
|
||||
apiKind: 'openai_responses',
|
||||
reasoningEffort: 'high',
|
||||
stream: false,
|
||||
webSearchEnabled: false,
|
||||
error: null,
|
||||
agents: [
|
||||
{
|
||||
agentId: 'planner',
|
||||
label: 'Planner',
|
||||
agentMode: 'codex_app_server',
|
||||
configured: true,
|
||||
accountCredentialState: 'available',
|
||||
officialRouteLocked: true,
|
||||
baseUrl: 'https://router.genarrative.world/v1',
|
||||
model: 'gpt-5.6-sol',
|
||||
apiKind: 'openai_responses',
|
||||
reasoningEffort: 'medium',
|
||||
stream: true,
|
||||
webSearchEnabled: false,
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
agentId: 'art-asset-plan',
|
||||
label: '美术组 / Asset',
|
||||
agentMode: 'codex_app_server',
|
||||
configured: true,
|
||||
accountCredentialState: 'available',
|
||||
officialRouteLocked: true,
|
||||
baseUrl: 'https://router.genarrative.world/v1',
|
||||
model: 'gpt-5.6-sol',
|
||||
apiKind: 'openai_responses',
|
||||
reasoningEffort: 'high',
|
||||
stream: true,
|
||||
webSearchEnabled: true,
|
||||
error: null,
|
||||
},
|
||||
{
|
||||
agentId: 'audio-asset-plan',
|
||||
label: '音乐组 / SFX',
|
||||
agentMode: 'codex_app_server',
|
||||
configured: true,
|
||||
accountCredentialState: 'available',
|
||||
officialRouteLocked: true,
|
||||
baseUrl: 'https://router.genarrative.world/v1',
|
||||
model: 'gpt-5.6-sol',
|
||||
apiKind: 'openai_responses',
|
||||
reasoningEffort: 'high',
|
||||
stream: false,
|
||||
webSearchEnabled: false,
|
||||
error: null,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
if (command === 'list_local_project_files') {
|
||||
return {
|
||||
projectPath: String(args?.projectPath ?? ''),
|
||||
files: [
|
||||
{
|
||||
path: 'game/index.html',
|
||||
kind: 'file',
|
||||
size: 256,
|
||||
modifiedAt: 1700000001,
|
||||
},
|
||||
{
|
||||
path: 'assets',
|
||||
kind: 'directory',
|
||||
size: 0,
|
||||
modifiedAt: 1700000000,
|
||||
},
|
||||
{
|
||||
path: '.agent/checkpoints/checkpoint-main/manifest.json',
|
||||
kind: 'file',
|
||||
size: 96,
|
||||
modifiedAt: 1700000002,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
if (command === 'build_local_project_index') {
|
||||
return {
|
||||
projectPath: String(args?.projectPath ?? ''),
|
||||
indexPath: '.agent/project.index.json',
|
||||
fileCount: 2,
|
||||
totalBytes: 384,
|
||||
files: [
|
||||
{ path: 'game/index.html', size: 256, checksum: 'fnv1a64:game' },
|
||||
{
|
||||
path: 'assets/uploads/hero.png',
|
||||
size: 128,
|
||||
checksum: 'fnv1a64:hero',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
if (command === 'read_local_game_memory') {
|
||||
const scope = String(args?.scope ?? 'long');
|
||||
if (scope === 'short') {
|
||||
return {
|
||||
scope,
|
||||
path: 'memory/session.md',
|
||||
content: '# 短期记忆\n- 本轮偏动作反馈\n',
|
||||
exists: true,
|
||||
};
|
||||
}
|
||||
if (scope === 'blackboard') {
|
||||
return {
|
||||
scope,
|
||||
path: 'memory/blackboard.md',
|
||||
content: '# 项目黑板\n- 跨 agent 共享约束\n',
|
||||
exists: true,
|
||||
};
|
||||
}
|
||||
return {
|
||||
scope,
|
||||
path: 'memory/project.md',
|
||||
content: '# 项目长期记忆\n- 保留厨房主题\n',
|
||||
exists: true,
|
||||
};
|
||||
}
|
||||
if (command === 'read_local_agent_memory') {
|
||||
return {
|
||||
taskId: String(args?.taskId ?? ''),
|
||||
path: 'memory/agents/art/asset.md',
|
||||
content: '# 美术私有记忆\n- 使用厨房像素素材\n',
|
||||
exists: true,
|
||||
};
|
||||
}
|
||||
if (command === 'read_local_project_file') {
|
||||
if (args?.relativePath === 'game/index.html') {
|
||||
return {
|
||||
path: 'game/index.html',
|
||||
absolutePath: `${String(args?.projectPath ?? '')}/game/index.html`,
|
||||
content: '<canvas></canvas>',
|
||||
};
|
||||
}
|
||||
if (args?.relativePath === 'assets/uploads/hero.txt') {
|
||||
return {
|
||||
path: 'assets/uploads/hero.txt',
|
||||
absolutePath: `${String(args?.projectPath ?? '')}/assets/uploads/hero.txt`,
|
||||
content: 'hero asset',
|
||||
};
|
||||
}
|
||||
if (
|
||||
args?.relativePath ===
|
||||
'.agent/checkpoints/checkpoint-main/manifest.json'
|
||||
) {
|
||||
return {
|
||||
path: '.agent/checkpoints/checkpoint-main/manifest.json',
|
||||
absolutePath: `${String(args?.projectPath ?? '')}/.agent/checkpoints/checkpoint-main/manifest.json`,
|
||||
content: JSON.stringify({
|
||||
checkpointId: 'checkpoint-main',
|
||||
fileCount: 3,
|
||||
totalBytes: 256,
|
||||
createdAt: 1700000002,
|
||||
}),
|
||||
};
|
||||
}
|
||||
return {
|
||||
path: String(args?.relativePath ?? ''),
|
||||
absolutePath: `${String(args?.projectPath ?? '')}/${String(args?.relativePath ?? '')}`,
|
||||
content: JSON.stringify(trace),
|
||||
};
|
||||
}
|
||||
if (command === 'create_local_project_checkpoint') {
|
||||
return {
|
||||
checkpointId: 'checkpoint-main',
|
||||
checkpointPath: '.agent/checkpoints/checkpoint-main',
|
||||
fileCount: 3,
|
||||
totalBytes: 256,
|
||||
};
|
||||
}
|
||||
if (command === 'export_local_project_package') {
|
||||
return {
|
||||
packagePath: `${String(args?.projectPath ?? '')}/exports/playtest-package-unit.zip`,
|
||||
packageRelativePath: 'exports/playtest-package-unit.zip',
|
||||
fileCount: 4,
|
||||
totalBytes: 512,
|
||||
};
|
||||
}
|
||||
if (command === 'list_local_project_export_packages') {
|
||||
return {
|
||||
projectPath: String(args?.projectPath ?? ''),
|
||||
packages: [
|
||||
{
|
||||
packagePath: `${String(args?.projectPath ?? '')}/exports/playtest-package-002.zip`,
|
||||
packageRelativePath: 'exports/playtest-package-002.zip',
|
||||
totalBytes: 2048,
|
||||
modifiedAt: 1700000002000,
|
||||
},
|
||||
{
|
||||
packagePath: `${String(args?.projectPath ?? '')}/exports/playtest-package-001.zip`,
|
||||
packageRelativePath: 'exports/playtest-package-001.zip',
|
||||
totalBytes: 1024,
|
||||
modifiedAt: 1700000001000,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
throw new Error(`unexpected invoke ${command}`);
|
||||
},
|
||||
);
|
||||
|
||||
return invoke;
|
||||
}
|
||||
|
||||
export type PreviewShortcutInvoke = ReturnType<
|
||||
typeof createPreviewShortcutInvoke
|
||||
>;
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
export function messageBubble(element: Element): HTMLElement {
|
||||
const bubble = element.closest<HTMLElement>('.message');
|
||||
if (!bubble) {
|
||||
throw new Error('Expected chat message bubble');
|
||||
}
|
||||
return bubble;
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
import {
|
||||
composerText,
|
||||
createGameCreationAppManifest,
|
||||
createGameCreationAppSeedTasks,
|
||||
emptyProjectPolicy,
|
||||
expect,
|
||||
fireEvent,
|
||||
GAME_CREATION_AGENT_RUN_SCHEMA_VERSION,
|
||||
type GameCreationAgentRunTrace,
|
||||
it,
|
||||
renderAppAt,
|
||||
screen,
|
||||
submitChat,
|
||||
vi,
|
||||
waitFor,
|
||||
} from '../harness';
|
||||
|
||||
export function registerProjectRunHistoryTests() {
|
||||
it('keeps run history out of the regular project chat window', async () => {
|
||||
const manifest = createGameCreationAppManifest(
|
||||
'local-project-draft',
|
||||
'未命名游戏原型',
|
||||
);
|
||||
const trace = {
|
||||
schemaVersion: GAME_CREATION_AGENT_RUN_SCHEMA_VERSION,
|
||||
runId: 'run-hidden-from-chat',
|
||||
commandId: 'game.generate_draft',
|
||||
status: 'passed',
|
||||
lifecycleStatus: 'done',
|
||||
passes: 1,
|
||||
maxPasses: 3,
|
||||
toolCallCount: 0,
|
||||
maxToolCalls: 128,
|
||||
stopReason: 'evaluator-passed',
|
||||
goal: '做一个厨房弹幕游戏',
|
||||
coordination: 'Planner -> Generator',
|
||||
steps: [],
|
||||
artifacts: [],
|
||||
taskGraph: {
|
||||
goal: '做一个厨房弹幕游戏',
|
||||
readyTaskIds: [],
|
||||
activeTaskIds: [],
|
||||
carriedTaskIds: [],
|
||||
repairFocus: [],
|
||||
repairRoutes: [],
|
||||
tasks: createGameCreationAppSeedTasks(),
|
||||
},
|
||||
passPlans: [],
|
||||
nextStep: 'preview',
|
||||
error: null,
|
||||
updatedAt: 1,
|
||||
} satisfies GameCreationAgentRunTrace;
|
||||
const invoke = vi.fn(
|
||||
async (command: string, args?: Record<string, unknown>) => {
|
||||
if (command === 'append_local_permission_log') {
|
||||
return {};
|
||||
}
|
||||
if (command === 'init_local_game_project') {
|
||||
const projectPath = String(args?.projectPath ?? '');
|
||||
return {
|
||||
projectPath,
|
||||
manifestPath: `${projectPath}/.agent/manifest.json`,
|
||||
manifest,
|
||||
};
|
||||
}
|
||||
if (command === 'read_project_permission_policy') {
|
||||
return emptyProjectPolicy();
|
||||
}
|
||||
if (command === 'chat_with_game_creator_agent') {
|
||||
return {
|
||||
replyText: `主聊天回复:${String(args?.prompt ?? '')}`,
|
||||
};
|
||||
}
|
||||
if (command === 'read_local_conversation') {
|
||||
return {
|
||||
path: '/tmp/authorized-game/.agent/conversations/project.jsonl',
|
||||
agentId: null,
|
||||
messages: [],
|
||||
};
|
||||
}
|
||||
if (command === 'list_local_project_files') {
|
||||
return {
|
||||
projectPath: String(args?.projectPath ?? ''),
|
||||
files: [
|
||||
{
|
||||
path: '.agent/runs/run-hidden-from-chat.json',
|
||||
kind: 'file',
|
||||
size: 100,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
if (command === 'read_local_project_file') {
|
||||
return {
|
||||
path: String(args?.relativePath ?? ''),
|
||||
absolutePath: `${String(args?.projectPath ?? '')}/${String(
|
||||
args?.relativePath ?? '',
|
||||
)}`,
|
||||
content: JSON.stringify(trace),
|
||||
};
|
||||
}
|
||||
throw new Error(`unexpected invoke ${command}`);
|
||||
},
|
||||
);
|
||||
window.__TAURI__ = { core: { invoke } };
|
||||
renderAppAt('/?main&projectPath=%2Ftmp%2Fauthorized-game');
|
||||
|
||||
await waitFor(() => {
|
||||
expect(invoke).toHaveBeenCalledWith('list_local_project_files', {
|
||||
projectPath: '/tmp/authorized-game',
|
||||
});
|
||||
});
|
||||
await waitFor(() => {
|
||||
expect(invoke).toHaveBeenCalledWith('read_local_project_file', {
|
||||
projectPath: '/tmp/authorized-game',
|
||||
relativePath: '.agent/runs/run-hidden-from-chat.json',
|
||||
commandId: 'agent.trace_read',
|
||||
});
|
||||
});
|
||||
expect(screen.queryByLabelText('最近 run')).toBeNull();
|
||||
expect(screen.queryByText(/run-hidden-from-chat/)).toBeNull();
|
||||
|
||||
const runReadCountBeforeRunsCommand = invoke.mock.calls.filter(
|
||||
([command]) => command === 'read_local_project_file',
|
||||
).length;
|
||||
await submitChat('/runs');
|
||||
expect(await screen.findByText(/Run 历史读取命令:/)).not.toBeNull();
|
||||
expect(
|
||||
screen.getByText(
|
||||
/run-hidden-from-chat .* \.agent\/runs\/run-hidden-from-chat\.json .*:\/read \.agent\/runs\/run-hidden-from-chat\.json/,
|
||||
),
|
||||
).not.toBeNull();
|
||||
fireEvent.click(screen.getByRole('button', { name: '读取首个历史 Run' }));
|
||||
expect(await composerText()).toBe(
|
||||
'/read .agent/runs/run-hidden-from-chat.json',
|
||||
);
|
||||
expect(
|
||||
invoke.mock.calls.filter(
|
||||
([command]) => command === 'read_local_project_file',
|
||||
),
|
||||
).toHaveLength(runReadCountBeforeRunsCommand);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user