(opts: LoopOptions)
| 39 | } |
| 40 | |
| 41 | export 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 | } |
no test coverage detected