MCPcopy Create free account
hub / github.com/tiann/hapi / loop

Function loop

cli/src/cursor/loop.ts:34–62  ·  view source on GitHub ↗
(opts: LoopOptions)

Source from the content-addressed store, hash-verified

32}
33
34export 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}

Callers 1

runCursorFunction · 0.90

Calls 3

runLocalRemoteSessionFunction · 0.90
cursorRemoteLauncherFunction · 0.90
getLogPathMethod · 0.80

Tested by

no test coverage detected