| 1923 | } |
| 1924 | |
| 1925 | func TestCreateSessionRequest_ModeCallbackFlags(t *testing.T) { |
| 1926 | t.Run("sends mode callback flags when handlers are provided", func(t *testing.T) { |
| 1927 | req := createSessionRequest{ |
| 1928 | RequestExitPlanMode: Bool(true), |
| 1929 | RequestAutoModeSwitch: Bool(true), |
| 1930 | } |
| 1931 | data, err := json.Marshal(req) |
| 1932 | if err != nil { |
| 1933 | t.Fatalf("Failed to marshal: %v", err) |
| 1934 | } |
| 1935 | var m map[string]any |
| 1936 | if err := json.Unmarshal(data, &m); err != nil { |
| 1937 | t.Fatalf("Failed to unmarshal: %v", err) |
| 1938 | } |
| 1939 | if m["requestExitPlanMode"] != true { |
| 1940 | t.Errorf("Expected requestExitPlanMode to be true, got %v", m["requestExitPlanMode"]) |
| 1941 | } |
| 1942 | if m["requestAutoModeSwitch"] != true { |
| 1943 | t.Errorf("Expected requestAutoModeSwitch to be true, got %v", m["requestAutoModeSwitch"]) |
| 1944 | } |
| 1945 | }) |
| 1946 | |
| 1947 | t.Run("omits mode callback flags when handlers are not provided", func(t *testing.T) { |
| 1948 | req := createSessionRequest{} |
| 1949 | data, _ := json.Marshal(req) |
| 1950 | var m map[string]any |
| 1951 | json.Unmarshal(data, &m) |
| 1952 | if _, ok := m["requestExitPlanMode"]; ok { |
| 1953 | t.Error("Expected requestExitPlanMode to be omitted when not set") |
| 1954 | } |
| 1955 | if _, ok := m["requestAutoModeSwitch"]; ok { |
| 1956 | t.Error("Expected requestAutoModeSwitch to be omitted when not set") |
| 1957 | } |
| 1958 | }) |
| 1959 | } |
| 1960 | |
| 1961 | func TestResumeSessionRequest_RequestElicitation(t *testing.T) { |
| 1962 | t.Run("sends requestElicitation flag when OnElicitationRequest is provided", func(t *testing.T) { |