Skip to Content
harness-kit

keep-awake

The built-in Policy keep-awake, against the machine sleeping while the agent works: its defaults, its options and a configuration that writes it.

To learn what it guards against and see it at work, read the guide: Keep awake.

Defaults

DefaultValue
On by defaultno: an entry turns it on
Fail modeopen
Timeout5000 ms
EventsStop, UserPromptSubmit
Toolsevery tool, or as its options set
Agent typesevery agent, or as its options set

Options

OptionTypeDefaultDescription
commandstring[]—The keep-awake command, its program and arguments; when absent, the first the machine has of caffeinate -i -t 3600 and systemd-inhibit --what=idle … sleep 3600.
rearmOnStopBlockboolean—Whether a stop that a stop check blocks keeps the machine awake for the turn that goes on (true when absent); false releases it at every stop.

Example

A configuration that writes every option, a comment above each:

import { defineConfig } from '@microeinhundert/harness-kit';

export default defineConfig({
  // The Policy entries, in the order their Decisions merge in.
  policies: [
    {
      // The Policy's name, unique in the configuration; messages and logs name the Policy by it.
      id: 'keep-awake',
      // The constructor's options, which it decodes.
      options: {
        // The keep-awake command, its program and arguments; when absent, the first the machine has
        // of `caffeinate -i -t 3600` and `systemd-inhibit --what=idle … sleep 3600`.
        command: ['caffeinate'],
        // Whether a stop that a stop check blocks keeps the machine awake for the turn that goes on
        // (`true` when absent); `false` releases it at every stop.
        rearmOnStopBlock: true,
      },
      // The name of the kit's Policy constructor that builds the Policy.
      use: 'keep-awake',
    },
  ],
});

On this page