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

Function upsertJob

plugins/codex/scripts/lib/state.mjs:129–147  ·  view source on GitHub ↗
(cwd, jobPatch)

Source from the content-addressed store, hash-verified

127}
128
129export function upsertJob(cwd, jobPatch) {
130 return updateState(cwd, (state) => {
131 const timestamp = nowIso();
132 const existingIndex = state.jobs.findIndex((job) => job.id === jobPatch.id);
133 if (existingIndex === -1) {
134 state.jobs.unshift({
135 createdAt: timestamp,
136 updatedAt: timestamp,
137 ...jobPatch
138 });
139 return;
140 }
141 state.jobs[existingIndex] = {
142 ...state.jobs[existingIndex],
143 ...jobPatch,
144 updatedAt: timestamp
145 };
146 });
147}
148
149export function listJobs(cwd) {
150 return loadState(cwd).jobs;

Callers 4

enqueueBackgroundTaskFunction · 0.90
handleCancelFunction · 0.90
createJobProgressUpdaterFunction · 0.90
runTrackedJobFunction · 0.90

Calls 2

updateStateFunction · 0.85
nowIsoFunction · 0.70

Tested by

no test coverage detected