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

Function interruptAppServerTurn

plugins/codex/scripts/lib/codex.mjs:960–1000  ·  view source on GitHub ↗
(cwd, { threadId, turnId })

Source from the content-addressed store, hash-verified

958}
959
960export async function interruptAppServerTurn(cwd, { threadId, turnId }) {
961 if (!threadId || !turnId) {
962 return {
963 attempted: false,
964 interrupted: false,
965 transport: null,
966 detail: "missing threadId or turnId"
967 };
968 }
969
970 const availability = getCodexAvailability(cwd);
971 if (!availability.available) {
972 return {
973 attempted: false,
974 interrupted: false,
975 transport: null,
976 detail: availability.detail
977 };
978 }
979
980 let client = null;
981 try {
982 client = await CodexAppServerClient.connect(cwd, { reuseExistingBroker: true });
983 await client.request("turn/interrupt", { threadId, turnId });
984 return {
985 attempted: true,
986 interrupted: true,
987 transport: client.transport,
988 detail: `Interrupted ${turnId} on ${threadId}.`
989 };
990 } catch (error) {
991 return {
992 attempted: true,
993 interrupted: false,
994 transport: client?.transport ?? null,
995 detail: error instanceof Error ? error.message : String(error)
996 };
997 } finally {
998 await client?.close().catch(() => {});
999 }
1000}
1001
1002export async function runAppServerReview(cwd, options = {}) {
1003 const availability = getCodexAvailability(cwd);

Callers 1

handleCancelFunction · 0.90

Calls 4

getCodexAvailabilityFunction · 0.85
connectMethod · 0.80
requestMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected