@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/index.js
CHANGED
|
@@ -6135,6 +6135,33 @@ async function runPipelineDispatch(args, slots) {
|
|
|
6135
6135
|
};
|
|
6136
6136
|
}
|
|
6137
6137
|
|
|
6138
|
+
// src/pipeline-max-starts.ts
|
|
6139
|
+
function operatorDispatchFromTick(operatorTick) {
|
|
6140
|
+
const body = operatorTick;
|
|
6141
|
+
const dispatch = body.response?.dispatch;
|
|
6142
|
+
return dispatch && typeof dispatch === "object" ? dispatch : null;
|
|
6143
|
+
}
|
|
6144
|
+
function resolvePipelineMaxStarts(resourceGate, operatorTick) {
|
|
6145
|
+
const dispatch = operatorDispatchFromTick(operatorTick);
|
|
6146
|
+
const advised = typeof dispatch?.recommendedMaxStarts === "number" ? Math.max(0, dispatch.recommendedMaxStarts) : null;
|
|
6147
|
+
let maxStarts = resourceGate.slotsAvailable;
|
|
6148
|
+
if (advised !== null) {
|
|
6149
|
+
maxStarts = Math.min(maxStarts, advised);
|
|
6150
|
+
}
|
|
6151
|
+
const underutilized = dispatch?.underutilized === true;
|
|
6152
|
+
const boardAdvancedThisTick = typeof dispatch?.boardAdvancedThisTick === "number" ? dispatch.boardAdvancedThisTick : 0;
|
|
6153
|
+
if (underutilized && resourceGate.slotsAvailable > 0 && maxStarts === 0) {
|
|
6154
|
+
const ready = dispatch?.actionableReady ?? dispatch?.queuedTasks ?? (boardAdvancedThisTick > 0 ? boardAdvancedThisTick : 1);
|
|
6155
|
+
maxStarts = Math.min(resourceGate.slotsAvailable, Math.max(1, ready));
|
|
6156
|
+
}
|
|
6157
|
+
return {
|
|
6158
|
+
maxStarts: Math.max(0, maxStarts),
|
|
6159
|
+
underutilized,
|
|
6160
|
+
advisedStarts: advised,
|
|
6161
|
+
boardAdvancedThisTick
|
|
6162
|
+
};
|
|
6163
|
+
}
|
|
6164
|
+
|
|
6138
6165
|
// src/stale-reconcile.ts
|
|
6139
6166
|
import path33 from "node:path";
|
|
6140
6167
|
var STALE_RECONCILE_HEARTBEAT_MS = 15 * 60 * 1e3;
|
|
@@ -6429,12 +6456,8 @@ async function runPipelineTick(args) {
|
|
|
6429
6456
|
const staleReconcile = reconcileStaleWorkers();
|
|
6430
6457
|
const harnessCleanup = isPipelineCleanupEnabled() ? runPipelineHarnessCleanup(runId) : void 0;
|
|
6431
6458
|
const planProgressSync = await syncActiveWorkerPlanProgress(runId, args);
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
const advised = tickBody.response?.dispatch?.recommendedMaxStarts;
|
|
6435
|
-
if (typeof advised === "number") {
|
|
6436
|
-
maxStarts = Math.min(maxStarts, Math.max(0, advised));
|
|
6437
|
-
}
|
|
6459
|
+
const maxStartsAdvice = resolvePipelineMaxStarts(resourceGate, operatorTick);
|
|
6460
|
+
let maxStarts = maxStartsAdvice.maxStarts;
|
|
6438
6461
|
const sweep = await sweepRun({ run: runId, agentOsId, pipeline: true, ...args });
|
|
6439
6462
|
let dispatch = null;
|
|
6440
6463
|
if (execute && maxStarts > 0) {
|
|
@@ -6455,7 +6478,7 @@ async function runPipelineTick(args) {
|
|
|
6455
6478
|
};
|
|
6456
6479
|
}
|
|
6457
6480
|
const startedCount = dispatch?.startedCount ?? 0;
|
|
6458
|
-
const idle = maxStarts === 0 && completedWorkers.length === 0 && startedCount === 0;
|
|
6481
|
+
const idle = !maxStartsAdvice.underutilized && maxStarts === 0 && completedWorkers.length === 0 && startedCount === 0;
|
|
6459
6482
|
return {
|
|
6460
6483
|
runId,
|
|
6461
6484
|
agentOsId,
|