@orbit-build/cli 0.4.8 → 0.4.10

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.
Files changed (2) hide show
  1. package/dist/index.js +42 -7
  2. 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((left, right) => right.startedAt - left.startedAt).map((task) => this.snapshot(task));
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((left, right) => right.startedAt - left.startedAt).map((task) => this.summary(task));
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((left, right) => right.startedAt - left.startedAt).map((task) => this.summary(task));
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((left, right) => right.startedAt - left.startedAt);
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((left, right) => left.startedAt - right.startedAt);
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;
@@ -253960,11 +253968,12 @@ import fs3 from "fs";
253960
253968
  import os22 from "os";
253961
253969
  import path22 from "path";
253962
253970
  var DANGEROUS_COMMAND_REGEXES = [
253963
- /\brm\s+-rf\b/i,
253964
- /\brm\s+.*(?:--recursive|-r)\b/i,
253971
+ /\brm\b[^\r\n;&|]*\s-[a-z]*r[a-z]*(?=\s|$)/i,
253972
+ /\brm\b[^\r\n;&|]*--recursive\b/i,
253965
253973
  /\bdel\s+\/s\b/i,
253966
253974
  /\b(?:rmdir|rd)\s+\/s\b/i,
253967
253975
  /\bremove-item\b.*(?:-recurse|-force)\b/i,
253976
+ /\b(?:ri|rmdir|rd|del|erase)\b[^\r\n;&|]*(?:-recurse\b|\s-r[a-z]*(?=\s|$))/i,
253968
253977
  /\bchmod\s+-R\b/i,
253969
253978
  /\bchown\s+-R\b/i,
253970
253979
  /\bsudo\b/i,
@@ -254382,6 +254391,32 @@ var PermissionEngine = class {
254382
254391
  risk
254383
254392
  };
254384
254393
  }
254394
+ const linkedWorkspaceEscape = commandPaths.pathTokens.find((token) => {
254395
+ const resolved = resolveCommandPathCandidate(token, workspaceRoot);
254396
+ if (resolved === null || !checkWorkspaceBoundary(workspaceRoot, resolved) || !fs3.existsSync(workspaceRoot)) {
254397
+ return false;
254398
+ }
254399
+ try {
254400
+ resolveSafePath(workspaceRoot, resolved);
254401
+ return false;
254402
+ } catch {
254403
+ return true;
254404
+ }
254405
+ });
254406
+ if (linkedWorkspaceEscape) {
254407
+ if (mode === "strict") {
254408
+ return {
254409
+ action: "deny",
254410
+ reason: `Command path "${linkedWorkspaceEscape}" does not resolve safely inside the workspace, blocked under strict mode.`,
254411
+ risk
254412
+ };
254413
+ }
254414
+ return {
254415
+ action: "ask",
254416
+ reason: `Command path "${linkedWorkspaceEscape}" does not resolve safely inside the workspace. It may traverse a symbolic link or junction.`,
254417
+ risk
254418
+ };
254419
+ }
254385
254420
  const outsidePath = commandPaths.pathTokens.find((token) => {
254386
254421
  const resolved = resolveCommandPathCandidate(token, workspaceRoot);
254387
254422
  return resolved !== null && !checkWorkspaceBoundary(workspaceRoot, resolved) && !trustedRoots.some(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-build/cli",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "description": "Local-first AI coding agent CLI, TUI, Web UI, diagnostics, and LSP runtime",
5
5
  "keywords": [
6
6
  "ai",