MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / runOne

Function runOne

apps/webuiapps/src/lib/appGeneratorPlugin.ts:309–397  ·  view source on GitHub ↗
(app: AppInput)

Source from the content-addressed store, hash-verified

307 });
308
309 const runOne = async (app: AppInput) => {
310 if (state.closed) return;
311 const appId = app.id;
312 console.log(`${LOG_PREFIX} -- Starting app: ${appId} --`);
313 sendEvent({ type: 'summarizing', appId, name: app.name });
314
315 try {
316 console.log(`${LOG_PREFIX} [${appId}] Step 1: Summarizing...`);
317 const summary = await summarizeApp(app, llmConfig);
318 if (state.closed) {
319 console.log(
320 `${LOG_PREFIX} [${appId}] Aborted (client disconnected after summarize)`,
321 );
322 return;
323 }
324 console.log(
325 `${LOG_PREFIX} [${appId}] Step 1 done. Scenario: ${summary.scenario.slice(0, 60)}...`,
326 );
327 sendEvent({ type: 'summarized', appId, summary });
328
329 const appPascalName = summary.englishName;
330 const prompt = buildAgentPrompt(app, summary);
331 const sysPrompt = [
332 `You are building App ID: ${appPascalName}`,
333 `You may ONLY create and modify files under src/pages/${appPascalName}/.`,
334 `Do NOT read or modify any other App directories under src/pages/.`,
335 `Concurrent builds are in progress — other Apps are being generated simultaneously. Strictly limit your operations to your own scope.`,
336 ].join('\n');
337 console.log(
338 `${LOG_PREFIX} [${appId}] Step 2: Agent SDK query (englishName=${appPascalName}, prompt length=${prompt.length})`,
339 );
340
341 sendEvent({ type: 'started', appId });
342 let result = '';
343 let messageCount = 0;
344 for await (const message of queryFn({
345 prompt,
346 options: {
347 cwd: projectRoot,
348 allowedTools: ['Read', 'Write', 'Edit', 'Glob', 'Grep', 'Bash', 'Skill'],
349 settingSources: ['user', 'project', 'local'],
350 permissionMode: 'bypassPermissions',
351 allowDangerouslySkipPermissions: true,
352 maxTurns: 100,
353 systemPrompt: sysPrompt,
354 },
355 })) {
356 messageCount++;
357 if (state.closed) {
358 console.log(
359 `${LOG_PREFIX} [${appId}] Aborted (client disconnected, after ${messageCount} messages)`,
360 );
361 return;
362 }
363 if ('result' in message) {
364 result = message.result;
365 console.log(
366 `${LOG_PREFIX} [${appId}] -- Result (#${messageCount}): ${String(result).slice(0, 200)}`,

Callers 1

configureServerFunction · 0.85

Calls 6

sendEventFunction · 0.85
summarizeAppFunction · 0.85
buildAgentPromptFunction · 0.85
getToolPreviewFunction · 0.85
logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected