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

Function handleTaskWorker

plugins/codex/scripts/codex-companion.mjs:838–881  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

836}
837
838async function handleTaskWorker(argv) {
839 const { options } = parseCommandInput(argv, {
840 valueOptions: ["cwd", "job-id"]
841 });
842
843 if (!options["job-id"]) {
844 throw new Error("Missing required --job-id for task-worker.");
845 }
846
847 const cwd = resolveCommandCwd(options);
848 const workspaceRoot = resolveCommandWorkspace(options);
849 const storedJob = readStoredJob(workspaceRoot, options["job-id"]);
850 if (!storedJob) {
851 throw new Error(`No stored job found for ${options["job-id"]}.`);
852 }
853
854 const request = storedJob.request;
855 if (!request || typeof request !== "object") {
856 throw new Error(`Stored job ${options["job-id"]} is missing its task request payload.`);
857 }
858
859 const { logFile, progress } = createTrackedProgress(
860 {
861 ...storedJob,
862 workspaceRoot
863 },
864 {
865 logFile: storedJob.logFile ?? null
866 }
867 );
868 await runTrackedJob(
869 {
870 ...storedJob,
871 workspaceRoot,
872 logFile
873 },
874 () =>
875 executeTaskRun({
876 ...request,
877 onProgress: progress
878 }),
879 { logFile }
880 );
881}
882
883async function handleStatus(argv) {
884 const { options, positionals } = parseCommandInput(argv, {

Callers 1

mainFunction · 0.85

Calls 7

readStoredJobFunction · 0.90
runTrackedJobFunction · 0.90
parseCommandInputFunction · 0.85
resolveCommandCwdFunction · 0.85
resolveCommandWorkspaceFunction · 0.85
createTrackedProgressFunction · 0.85
executeTaskRunFunction · 0.85

Tested by

no test coverage detected