@kynver-app/runtime 0.1.60 → 0.1.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +30 -7
- package/dist/cli.js.map +3 -3
- package/dist/index.js +30 -7
- package/dist/index.js.map +3 -3
- package/dist/pipeline-max-starts.d.ts +19 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5096,6 +5096,33 @@ async function runPipelineDispatch(args, slots) {
|
|
|
5096
5096
|
};
|
|
5097
5097
|
}
|
|
5098
5098
|
|
|
5099
|
+
// src/pipeline-max-starts.ts
|
|
5100
|
+
function operatorDispatchFromTick(operatorTick) {
|
|
5101
|
+
const body = operatorTick;
|
|
5102
|
+
const dispatch = body.response?.dispatch;
|
|
5103
|
+
return dispatch && typeof dispatch === "object" ? dispatch : null;
|
|
5104
|
+
}
|
|
5105
|
+
function resolvePipelineMaxStarts(resourceGate, operatorTick) {
|
|
5106
|
+
const dispatch = operatorDispatchFromTick(operatorTick);
|
|
5107
|
+
const advised = typeof dispatch?.recommendedMaxStarts === "number" ? Math.max(0, dispatch.recommendedMaxStarts) : null;
|
|
5108
|
+
let maxStarts = resourceGate.slotsAvailable;
|
|
5109
|
+
if (advised !== null) {
|
|
5110
|
+
maxStarts = Math.min(maxStarts, advised);
|
|
5111
|
+
}
|
|
5112
|
+
const underutilized = dispatch?.underutilized === true;
|
|
5113
|
+
const boardAdvancedThisTick = typeof dispatch?.boardAdvancedThisTick === "number" ? dispatch.boardAdvancedThisTick : 0;
|
|
5114
|
+
if (underutilized && resourceGate.slotsAvailable > 0 && maxStarts === 0) {
|
|
5115
|
+
const ready = dispatch?.actionableReady ?? dispatch?.queuedTasks ?? (boardAdvancedThisTick > 0 ? boardAdvancedThisTick : 1);
|
|
5116
|
+
maxStarts = Math.min(resourceGate.slotsAvailable, Math.max(1, ready));
|
|
5117
|
+
}
|
|
5118
|
+
return {
|
|
5119
|
+
maxStarts: Math.max(0, maxStarts),
|
|
5120
|
+
underutilized,
|
|
5121
|
+
advisedStarts: advised,
|
|
5122
|
+
boardAdvancedThisTick
|
|
5123
|
+
};
|
|
5124
|
+
}
|
|
5125
|
+
|
|
5099
5126
|
// src/stale-reconcile.ts
|
|
5100
5127
|
import path25 from "node:path";
|
|
5101
5128
|
|
|
@@ -6145,12 +6172,8 @@ async function runPipelineTick(args) {
|
|
|
6145
6172
|
const staleReconcile = reconcileStaleWorkers();
|
|
6146
6173
|
const harnessCleanup = isPipelineCleanupEnabled() ? runPipelineHarnessCleanup(runId) : void 0;
|
|
6147
6174
|
const planProgressSync = await syncActiveWorkerPlanProgress(runId, args);
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
const advised = tickBody.response?.dispatch?.recommendedMaxStarts;
|
|
6151
|
-
if (typeof advised === "number") {
|
|
6152
|
-
maxStarts = Math.min(maxStarts, Math.max(0, advised));
|
|
6153
|
-
}
|
|
6175
|
+
const maxStartsAdvice = resolvePipelineMaxStarts(resourceGate, operatorTick);
|
|
6176
|
+
let maxStarts = maxStartsAdvice.maxStarts;
|
|
6154
6177
|
const sweep = await sweepRun({ run: runId, agentOsId, pipeline: true, ...args });
|
|
6155
6178
|
let dispatch = null;
|
|
6156
6179
|
if (execute && maxStarts > 0) {
|
|
@@ -6171,7 +6194,7 @@ async function runPipelineTick(args) {
|
|
|
6171
6194
|
};
|
|
6172
6195
|
}
|
|
6173
6196
|
const startedCount = dispatch?.startedCount ?? 0;
|
|
6174
|
-
const idle = maxStarts === 0 && completedWorkers.length === 0 && startedCount === 0;
|
|
6197
|
+
const idle = !maxStartsAdvice.underutilized && maxStarts === 0 && completedWorkers.length === 0 && startedCount === 0;
|
|
6175
6198
|
return {
|
|
6176
6199
|
runId,
|
|
6177
6200
|
agentOsId,
|