agentCommand property

String get agentCommand

Like command, but also reports the exit code of the command that ran just before it as a 5th tab field, used by the AI agent to detect failures when it runs a command in the interactive session.

$? is saved into a variable first (before the $(git …) substitutions clobber it) and emitted as the trailing field.

Implementation

String get agentCommand {
  final (a, b) = tokenHalves;
  return r"__omny_ec=$?; "
      "printf '%s%s%s\\t%s\\t%s\\t%s\\t%s\\n' '$a' '$b' "
      '$_pwd $_branch $_status $_priv "\$__omny_ec"';
}