28 lines
732 B
JavaScript
28 lines
732 B
JavaScript
function trimToDefined(value) {
|
|
const text = typeof value === "string" ? value.trim() : "";
|
|
return text || undefined;
|
|
}
|
|
|
|
function isActiveMasterTask(runtime = {}) {
|
|
const active = runtime.activeMasterTask;
|
|
return (
|
|
runtime.masterTaskBusy === true ||
|
|
active?.status === "running" ||
|
|
active?.status === "active"
|
|
);
|
|
}
|
|
|
|
export function shouldSkipCodexAppServerDiscovery({ config = {}, runtime = {} } = {}) {
|
|
if (config.codexAppServerDiscoveryWhileMasterTaskBusy === true) {
|
|
return { skip: false };
|
|
}
|
|
if (!isActiveMasterTask(runtime)) {
|
|
return { skip: false };
|
|
}
|
|
return {
|
|
skip: true,
|
|
reason: "master_task_running",
|
|
activeTaskId: trimToDefined(runtime.activeMasterTask?.taskId),
|
|
};
|
|
}
|