File size: 2,305 Bytes
a36db1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"use client";
import { Shield, Eye, Wrench, SkipForward, Brain, Cpu, Square, Sparkles } from "lucide-react";
import type { ActionType, AutoPolicy } from "../lib/types";

const ACTIONS: { id: ActionType; label: string; icon: typeof Shield }[] = [
  { id: "delegate",            label: "Delegate",   icon: Shield },
  { id: "verify",              label: "Verify",     icon: Eye },
  { id: "solve_independently", label: "Self Solve", icon: Wrench },
  { id: "skip",                label: "Skip",       icon: SkipForward },
];

export default function ActionCenter({
  recommended,
  running,
  done,
  onStep,
  onAutoRun,
  onStop,
}: {
  recommended: { action: ActionType; specialist: string; trust: number };
  running: boolean;
  done: boolean;
  onStep: (action: ActionType) => void;
  onAutoRun: (policy: AutoPolicy) => void;
  onStop: () => void;
}) {
  return (
    <>
      <div className="ac-grid">
        {ACTIONS.map((a) => {
          const isRec = a.id === recommended.action;
          return (
            <button
              key={a.id}
              className={`ac-btn${isRec ? " rec" : ""}`}
              disabled={running || done}
              onClick={() => onStep(a.id)}
            >
              <a.icon size={16} />
              {a.label}
              {isRec && a.id !== "skip" && (
                <span style={{ fontSize: 10, color: "var(--ink3)" }}>→ {recommended.specialist}</span>
              )}
            </button>
          );
        })}
      </div>
      <div className="ac-auto">
        {running ? (
          <button className="btn btn-danger btn-block" onClick={onStop}>
            <Square size={14} /> Stop
          </button>
        ) : (
          <>
            <button className="btn btn-primary btn-block" disabled={running} onClick={() => onAutoRun("heuristic")}>
              <Brain size={14} /> Auto Heuristic
            </button>
            <button className="btn btn-primary btn-block" disabled={running} onClick={() => onAutoRun("trained")}>
              <Sparkles size={14} /> Auto GRPO Replay
            </button>
            <button className="btn btn-block" disabled={running} onClick={() => onAutoRun("random")}>
              <Cpu size={14} /> Auto Random
            </button>
          </>
        )}
      </div>
    </>
  );
}