MCPcopy
hub / github.com/openai/codex-plugin-cc / startThread

Function startThread

plugins/codex/scripts/lib/codex.mjs:732–748  ·  view source on GitHub ↗
(client, cwd, options = {})

Source from the content-addressed store, hash-verified

730}
731
732async function startThread(client, cwd, options = {}) {
733 const response = await client.request("thread/start", buildThreadParams(cwd, options));
734 const threadId = response.thread.id;
735 if (options.threadName) {
736 try {
737 await client.request("thread/name/set", { threadId, name: options.threadName });
738 } catch (err) {
739 // Only suppress "unknown variant/method" errors from older CLI versions
740 // that don't support thread/name/set. Rethrow auth, network, or server errors.
741 const msg = String(err?.message ?? err ?? "");
742 if (!msg.includes("unknown variant") && !msg.includes("unknown method")) {
743 throw err;
744 }
745 }
746 }
747 return response;
748}
749
750async function resumeThread(client, threadId, cwd, options = {}) {
751 return client.request("thread/resume", buildResumeParams(threadId, cwd, options));

Callers 2

runAppServerReviewFunction · 0.85
runAppServerTurnFunction · 0.85

Calls 2

buildThreadParamsFunction · 0.85
requestMethod · 0.80

Tested by

no test coverage detected