File size: 1,446 Bytes
11bf9b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React from 'react';
import { ArrowDown } from 'lucide-react';

/**
 * Fixed-position attention cue rendered along the bottom edge of the
 * viewport when the orchestrator is waiting for the human's input.
 *
 * Per the spec we do NOT auto-scroll - the user might be reading
 * earlier messages and resent the page jumping under them. We just
 * surface a persistent green pulse + arrow + name so they can scroll
 * down to the input slot on their own when ready.
 *
 * Clicking the indicator scrolls the input slot into view (best
 * effort: we look for [data-human-slot] in the DOM).
 */
export default function HumanTurnIndicator({ awaiting }) {
  if (!awaiting) return null;
  const name = awaiting.speaker_name || 'you';
  const handleClick = () => {
    const target = document.querySelector('[data-human-slot]');
    if (target) {
      target.scrollIntoView({ behavior: 'smooth', block: 'center' });
      const ta = target.querySelector('textarea');
      if (ta) ta.focus({ preventScroll: true });
    }
  };
  return (
    <button
      type="button"
      className="ccai-human-indicator"
      onClick={handleClick}
      title={`Jump to ${name}'s input slot`}
    >
      <ArrowDown
        size={16}
        strokeWidth={2.5}
        className="ccai-human-indicator-arrow"
      />
      <span className="ccai-human-indicator-text">
        {name}, the discussion is waiting for your input
      </span>
    </button>
  );
}