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

Function parseParamsList

apps/webuiapps/src/lib/appRegistry.ts:326–378  ·  view source on GitHub ↗
(
  lines: string[],
  startI: number,
  params: AppActionDef['params'],
  setI: (i: number) => void,
)

Source from the content-addressed store, hash-verified

324}
325
326function parseParamsList(
327 lines: string[],
328 startI: number,
329 params: AppActionDef['params'],
330 setI: (i: number) => void,
331): void {
332 let i = startI;
333 while (i < lines.length) {
334 const l = lines[i];
335 // Parameter items start with " - name:"
336 const paramNameMatch = l.match(/^\s+-\s+name:\s+(\S+)/);
337 if (!paramNameMatch) break;
338
339 const param: AppActionDef['params'][0] = {
340 name: paramNameMatch[1],
341 type: 'string',
342 description: paramNameMatch[1],
343 };
344 i++;
345 while (i < lines.length) {
346 const pl = lines[i];
347 if (pl.match(/^\s+-\s+name:\s/) || !pl.match(/^\s{8,}/)) break;
348
349 const typeMatch = pl.match(/^\s+type:\s+(\S+)/);
350 if (typeMatch) {
351 param.type = typeMatch[1];
352 i++;
353 continue;
354 }
355 const descMatch = pl.match(/^\s+description:\s+(.+)$/);
356 if (descMatch) {
357 param.description = descMatch[1].trim();
358 i++;
359 continue;
360 }
361 const reqMatch = pl.match(/^\s+required:\s+(true|false)/);
362 if (reqMatch) {
363 param.required = reqMatch[1] === 'true';
364 i++;
365 continue;
366 }
367 const enumMatch = pl.match(/^\s+enum:\s+\[(.+)\]/);
368 if (enumMatch) {
369 param.enum = enumMatch[1].split(',').map((s) => s.trim().replace(/['"]/g, ''));
370 i++;
371 continue;
372 }
373 i++;
374 }
375 params.push(param);
376 }
377 setI(i);
378}
379
380// ============ Dynamic Loading ============
381

Callers 1

parseStandardActionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected