(opts: LoopOptions)
| 32 | } |
| 33 | |
| 34 | export async function loop(opts: LoopOptions): Promise<void> { |
| 35 | const logPath = logger.getLogPath(); |
| 36 | const startedBy = opts.startedBy ?? 'terminal'; |
| 37 | const startingMode = opts.startingMode ?? 'local'; |
| 38 | const session = new CursorSession({ |
| 39 | api: opts.api, |
| 40 | client: opts.session, |
| 41 | path: opts.path, |
| 42 | sessionId: opts.resumeSessionId ?? null, |
| 43 | logPath, |
| 44 | messageQueue: opts.messageQueue, |
| 45 | onModeChange: opts.onModeChange, |
| 46 | mode: startingMode, |
| 47 | startedBy, |
| 48 | startingMode, |
| 49 | cursorArgs: opts.cursorArgs, |
| 50 | model: opts.model, |
| 51 | permissionMode: opts.permissionMode ?? 'default' |
| 52 | }); |
| 53 | |
| 54 | await runLocalRemoteSession({ |
| 55 | session, |
| 56 | startingMode: opts.startingMode, |
| 57 | logTag: 'cursor-loop', |
| 58 | runLocal: cursorLocalLauncher, |
| 59 | runRemote: (session) => cursorRemoteLauncher(session, opts.sessionMetadata), |
| 60 | onSessionReady: opts.onSessionReady |
| 61 | }); |
| 62 | } |
no test coverage detected