execution-rail.ts2.4 KBView on GitHub
/**
 * Whether opening a task turns the left rail into the task list ("execution mode").
 *
 * Turned OFF after customer feedback that the surface is the single most confusing thing
 * about working tasks: the rail showed every OTHER task while you were meant to be doing
 * one, on top of a centre column that already carried the task's own context and Execute
 * button. A non-technical AE could not tell which of the two lists was the thing to act
 * on.
 *
 * With it off, a task behaves like an email: click in, work it, go BACK for the next one.
 * The rail stays plain navigation and never swaps itself out from under you.
 *
 * Deliberately a constant rather than deleted code. The list and its j/k navigation still
 * work; only the entry points below are closed, so restoring the surface is flipping this to
 * `true` — no rebuild of TaskExecutionList. Its lane switcher is gone for good, though: with
 * the rail closed there was nothing for a "which lane does it show" control to do.
 * The `?task=` and `?group=` params are still written and still drive the pinned task card
 * in the centre column (OpenTaskExecutionCard), which is the half of execution mode that
 * people liked.
 */
export const TASK_EXECUTION_RAIL_ENABLED = false;

/**
 * Whether the rail should replace itself with the open group's task list.
 *
 * `?group=` is still written when a task is opened, so the flag — not the absence of the
 * param — is what keeps the rail as navigation.
 */
export function shouldShowTaskExecutionRail({
  expanded,
  groupParam,
}: {
  /** The rail is only ever the task list in its expanded form. */
  expanded: boolean;
  /** The `?group=` lane whose tasks the rail would list. */
  groupParam: string | null;
}): boolean {
  return TASK_EXECUTION_RAIL_ENABLED && expanded && Boolean(groupParam);
}

/**
 * Whether an open task should force the rail expanded, overriding the user's own collapse
 * preference — it did so to keep the task list travelling with you. With the rail off there
 * is no list to keep visible, so a collapsed rail must stay collapsed when a task opens.
 */
export function shouldForceRailExpandedForTask({
  taskParam,
  onAgentScreen,
}: {
  /** The `?task=` task open in the centre column. */
  taskParam: string | null;
  /** /agent's left rail is its own freely-collapsible surface and never forced. */
  onAgentScreen: boolean;
}): boolean {
  return TASK_EXECUTION_RAIL_ENABLED && Boolean(taskParam) && !onAgentScreen;
}