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

Function findLatestTaskThread

plugins/codex/scripts/lib/codex.mjs:1162–1182  ·  view source on GitHub ↗
(cwd)

Source from the content-addressed store, hash-verified

1160}
1161
1162export async function findLatestTaskThread(cwd) {
1163 const availability = getCodexAvailability(cwd);
1164 if (!availability.available) {
1165 throw new Error("Codex CLI is not installed or is missing required runtime support. Install it with `npm install -g @openai/codex`, then rerun `/codex:setup`.");
1166 }
1167
1168 return withAppServer(cwd, async (client) => {
1169 const response = await client.request("thread/list", {
1170 cwd,
1171 limit: 20,
1172 sortKey: "updated_at",
1173 sourceKinds: ["appServer"],
1174 searchTerm: TASK_THREAD_PREFIX
1175 });
1176
1177 return (
1178 response.data.find((thread) => typeof thread.name === "string" && thread.name.startsWith(TASK_THREAD_PREFIX)) ??
1179 null
1180 );
1181 });
1182}
1183
1184export function buildPersistentTaskThreadName(prompt) {
1185 return buildTaskThreadName(prompt);

Callers 1

Calls 3

getCodexAvailabilityFunction · 0.85
withAppServerFunction · 0.85
requestMethod · 0.80

Tested by

no test coverage detected