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

Function loop

cli/src/codex/loop.ts:40–72  ·  view source on GitHub ↗
(opts: LoopOptions)

Source from the content-addressed store, hash-verified

38}
39
40export async function loop(opts: LoopOptions): Promise<void> {
41 const logPath = logger.getLogPath();
42 const startedBy = opts.startedBy ?? 'terminal';
43 const startingMode = opts.startingMode ?? 'local';
44 const session = new CodexSession({
45 api: opts.api,
46 client: opts.session,
47 path: opts.path,
48 sessionId: opts.resumeSessionId ?? null,
49 logPath,
50 messageQueue: opts.messageQueue,
51 onModeChange: opts.onModeChange,
52 mode: startingMode,
53 startedBy,
54 startingMode,
55 codexArgs: opts.codexArgs,
56 codexCliOverrides: opts.codexCliOverrides,
57 permissionMode: opts.permissionMode ?? 'default',
58 model: opts.model,
59 modelReasoningEffort: opts.modelReasoningEffort,
60 collaborationMode: opts.collaborationMode ?? 'default',
61 replayTranscriptHistoryOnStart: opts.replayTranscriptHistoryOnStart ?? false
62 });
63
64 await runLocalRemoteSession({
65 session,
66 startingMode: opts.startingMode,
67 logTag: 'codex-loop',
68 runLocal: codexLocalLauncher,
69 runRemote: codexRemoteLauncher,
70 onSessionReady: opts.onSessionReady
71 });
72}

Callers 1

runCodexFunction · 0.90

Calls 2

runLocalRemoteSessionFunction · 0.90
getLogPathMethod · 0.80

Tested by

no test coverage detected