request method

bool? request(
  1. AgentWorkPhase from,
  2. AgentWorkPhase to
)

The open state the work asks for when it moves from from to to, or null when it asks for nothing.

This ignores the reader; AgentDisclosureController applies respectReaderToggle.

Implementation

bool? request(AgentWorkPhase from, AgentWorkPhase to) {
  if (from == to) return null;

  return switch (to) {
    AgentWorkPhase.working => openWhileWorking ? true : null,
    AgentWorkPhase.waiting => null,
    AgentWorkPhase.settled => collapseWhenSettled ? false : null,
    AgentWorkPhase.failed =>
      !keepOpenOnFailure && collapseWhenSettled ? false : null,
  };
}