AgentKit
Tài liệuBộ kitTham chiếu CLIỨng dụng Desktop

host

ak host gate

Chờ máy hết quá tải, rồi chạy một lệnh nặng ở độ ưu tiên thấp.

Dùng ak host gate -- <cmd> cho build, bộ test, preflight và cài đặt. Khi verdict là hold hoặc clean, lệnh chờ với backoff; throttle, go và unknown không bao giờ chặn, và sau --max-wait lệnh vẫn chạy kèm cảnh báo, nên gate không bao giờ làm treo script. Sau đó lệnh chạy ở độ ưu tiên CPU và I/O thấp, và mã thoát của nó được trả nguyên. Từ AgentKit CLI v3.3.0-beta.20, --pause-on-hold còn tạm dừng lệnh đang chạy khi máy vẫn ở hold. Xem ak host để biết các verdict.

Phần help nguyên bản dưới đây giữ nguyên thuật ngữ, cú pháp, tác động và điều kiện thực thi của CLI để đối chiếu chính xác.

Contract và help của lệnh

Wait out a saturated host, then run a heavy command at low priority

Synopsis

Checks host status (the watcher's snapshot when fresh, else a 3-second sample). While the verdict is hold, or clean (a watched volume is low on space), it waits with backoff 15 s, 30 s, then 60 s, printing one stderr line per wait with the verdict, its reasons and the top I/O process (its write rate; on Windows the rate counts all I/O, network and pipes included, and says so). throttle, go and unknown never block. --max-wait 0 skips the check entirely. After --max-wait it runs anyway with a warning, so a gate never hangs a script. A watcher notice for the current worktree is printed once and deleted.

The command then runs with this terminal's stdin, stdout and stderr at low priority (disable with --low-priority=false): on Windows it starts suspended in the below-normal priority class, inherited by its children, gets low I/O priority, then resumes; on Linux nice 10 plus the idle I/O class, both inherited; on macOS under taskpolicy -b. It is started directly, never through a shell. ak forwards Ctrl-C, SIGTERM and SIGHUP to it (on Linux it also gets SIGTERM if ak dies), waits, and passes its exit status on.

--pause-on-hold also pauses the running command and its child processes when two checks 30 s apart both read hold (SIGSTOP on Linux and macOS, NtSuspendProcess on Windows), and resumes them when the hold ends, after --max-pause, or before ak forwards a signal or exits. After a pause that reached --max-pause it does not pause again for the same length of time. Suits builds and installs; a test with timeouts may count paused time.

Effects: Runs the given command, which may change anything that command changes. Reads host status and deletes the current worktree's inbox notice; never reaches the network itself.

Exit status: 0 the command exited 0; any other status it exits with is passed on (128 plus the signal number if a signal ended it) 2 invalid flags or no command after -- 5 the command could not be started, or the wait was interrupted before it started

ak host gate [flags] -- <cmd> [args...]

Examples

  ak host gate -- go test ./...
  ak host gate --max-wait 10m -- pnpm build
  ak host gate --max-wait 0 -- make lint
  ak host gate --pause-on-hold -- pnpm install

Options

  -h, --help                 help for gate
      --json                 Emit machine-readable JSON (implies --no-interactive)
      --low-priority         Run the command at low CPU and I/O priority (default true)
      --max-pause duration   Longest single pause with --pause-on-hold (default 10m0s)
      --max-wait duration    Longest time to wait for the host before running anyway (0 runs at once) (default 30m0s)
      --no-interactive       Disable interactive prompts (CI-safe)
      --pause-on-hold        Pause the running command while the host stays on hold
  -q, --quiet                Suppress non-error output on stderr
  -V, --verbose              Extra diagnostic output on stderr (loses to --quiet)
  -y, --yes                  Assume yes for all prompts

SEE ALSO

  • ak host - Inspect host pressure before starting parallel work