MCPcopy Create free account
hub / github.com/ConsortiumAI/Consortium / loop

Function loop

packages/consortium-cli/src/claude/loop.ts:41–68  ·  view source on GitHub ↗
(opts: LoopOptions)

Source from the content-addressed store, hash-verified

39}
40
41export async function loop(opts: LoopOptions): Promise<number> {
42 const logPath = logger.logFilePath;
43 let session = new Session({
44 api: opts.api,
45 client: opts.session,
46 path: opts.path,
47 sessionId: null,
48 claudeEnvVars: opts.claudeEnvVars,
49 claudeArgs: opts.claudeArgs,
50 mcpServers: opts.mcpServers,
51 logPath: logPath,
52 messageQueue: opts.messageQueue,
53 allowedTools: opts.allowedTools,
54 onModeChange: opts.onModeChange,
55 });
56
57 opts.onSessionReady?.(session)
58
59 // Remote only - no local mode switching
60 while (true) {
61 logger.debug(`[loop] Iteration in remote mode`);
62 const reason = await claudeRemoteLauncher(session);
63 if (reason === 'exit') {
64 return 0;
65 }
66 // 'switch' just continues the loop in remote mode
67 }
68}

Callers 1

runClaudeFunction · 0.90

Calls 2

claudeRemoteLauncherFunction · 0.90
debugMethod · 0.80

Tested by

no test coverage detected