@orbit-build/cli 0.4.8 → 0.4.9
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/index.js +13 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -249249,6 +249249,7 @@ var BackgroundTaskRuntime = class {
|
|
|
249249
249249
|
terminateGraceMs;
|
|
249250
249250
|
workspaceRoot;
|
|
249251
249251
|
onEvent;
|
|
249252
|
+
nextTaskSequence = 0;
|
|
249252
249253
|
disposed = false;
|
|
249253
249254
|
constructor(options) {
|
|
249254
249255
|
this.workspaceRoot = options.workspaceRoot;
|
|
@@ -249322,6 +249323,7 @@ var BackgroundTaskRuntime = class {
|
|
|
249322
249323
|
});
|
|
249323
249324
|
const task = {
|
|
249324
249325
|
id,
|
|
249326
|
+
sequence: ++this.nextTaskSequence,
|
|
249325
249327
|
sessionId: request.sessionId,
|
|
249326
249328
|
command: request.command,
|
|
249327
249329
|
cwd: safeCwd,
|
|
@@ -249383,15 +249385,15 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
|
|
|
249383
249385
|
return selected.map((task) => this.snapshot(task));
|
|
249384
249386
|
}
|
|
249385
249387
|
listTasks(sessionId) {
|
|
249386
|
-
return [...this.tasks.values()].filter((task) => task.sessionId === sessionId).sort(
|
|
249388
|
+
return [...this.tasks.values()].filter((task) => task.sessionId === sessionId).sort(compareNewestTask).map((task) => this.snapshot(task));
|
|
249387
249389
|
}
|
|
249388
249390
|
/** List task metadata without materializing retained process output. */
|
|
249389
249391
|
listTaskSummaries(sessionId) {
|
|
249390
|
-
return [...this.tasks.values()].filter((task) => task.sessionId === sessionId).sort(
|
|
249392
|
+
return [...this.tasks.values()].filter((task) => task.sessionId === sessionId).sort(compareNewestTask).map((task) => this.summary(task));
|
|
249391
249393
|
}
|
|
249392
249394
|
/** Return metadata-only task state across sessions in this workspace runtime. */
|
|
249393
249395
|
listWorkspaceTaskSummaries() {
|
|
249394
|
-
return [...this.tasks.values()].sort(
|
|
249396
|
+
return [...this.tasks.values()].sort(compareNewestTask).map((task) => this.summary(task));
|
|
249395
249397
|
}
|
|
249396
249398
|
async killTask(sessionId, taskId) {
|
|
249397
249399
|
const task = this.requireTask(sessionId, taskId);
|
|
@@ -249422,7 +249424,7 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
|
|
|
249422
249424
|
}
|
|
249423
249425
|
selectTasks(sessionId, taskIds) {
|
|
249424
249426
|
if (!taskIds || taskIds.length === 0) {
|
|
249425
|
-
return [...this.tasks.values()].filter((task) => task.sessionId === sessionId).sort(
|
|
249427
|
+
return [...this.tasks.values()].filter((task) => task.sessionId === sessionId).sort(compareNewestTask);
|
|
249426
249428
|
}
|
|
249427
249429
|
return taskIds.map((taskId) => this.requireTask(sessionId, taskId));
|
|
249428
249430
|
}
|
|
@@ -249540,7 +249542,7 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
|
|
|
249540
249542
|
}
|
|
249541
249543
|
pruneRetainedTasks() {
|
|
249542
249544
|
if (this.tasks.size < this.maxRetainedTasks) return;
|
|
249543
|
-
const terminal = [...this.tasks.values()].filter((task) => task.status !== "running").sort(
|
|
249545
|
+
const terminal = [...this.tasks.values()].filter((task) => task.status !== "running").sort(compareOldestTask);
|
|
249544
249546
|
while (this.tasks.size >= this.maxRetainedTasks && terminal.length > 0) {
|
|
249545
249547
|
const task = terminal.shift();
|
|
249546
249548
|
if (task) this.tasks.delete(task.id);
|
|
@@ -249552,6 +249554,12 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
|
|
|
249552
249554
|
}
|
|
249553
249555
|
}
|
|
249554
249556
|
};
|
|
249557
|
+
function compareNewestTask(left, right) {
|
|
249558
|
+
return right.startedAt - left.startedAt || right.sequence - left.sequence;
|
|
249559
|
+
}
|
|
249560
|
+
function compareOldestTask(left, right) {
|
|
249561
|
+
return left.startedAt - right.startedAt || left.sequence - right.sequence;
|
|
249562
|
+
}
|
|
249555
249563
|
async function signalProcessTree(child, force) {
|
|
249556
249564
|
const pid = child.pid;
|
|
249557
249565
|
if (!pid) return false;
|