MCPcopy Create free account
hub / github.com/agent-tower/core / parseCursorAgentListModelsOutput

Function parseCursorAgentListModelsOutput

packages/server/src/routes/system.ts:18–43  ·  view source on GitHub ↗
(stdout: string)

Source from the content-addressed store, hash-verified

16 let inList = false;
17 for (const line of lines) {
18 const t = line.trim();
19 if (!t) continue;
20 if (t === 'Available models') {
21 inList = true;
22 continue;
23 }
24 if (t.startsWith('Tip:')) break;
25 if (!inList) continue;
26 const m = /^([a-zA-Z0-9][a-zA-Z0-9._-]*)\s*-\s*(.+)$/.exec(t);
27 if (m) {
28 const label = m[2]
29 .trim()
30 .replace(/\s*\(current\)\s*$/i, '')
31 .replace(/\s*\(default\)\s*$/i, '')
32 .trim();
33 models.push({ id: m[1], label });
34 }
35 }
36 return models;
37}
38
39export async function systemRoutes(app: FastifyInstance) {
40 // 健康检查
41 app.get('/health', async () => {
42 return { status: 'ok', timestamp: new Date().toISOString() };
43 });
44
45 // 获取可用的 AI 代理列表
46 app.get('/agents', async () => {

Callers 1

systemRoutesFunction · 0.85

Calls 3

stripAnsiSequencesFunction · 0.85
trimMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected