Matthias Nott
2026-03-24 96c8bb5db1a2e0ced999a366e3cf28f9895ec39f
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
class Session {
  final String id;
  final int index;
  final String name;
  final String type; // "claude" or "terminal"
  final String? kind; // "api" or "visual"
  final bool isActive;
  const Session({
    required this.id,
    required this.index,
    required this.name,
    required this.type,
    this.kind,
    this.isActive = false,
  });
  Session copyWith({
    String? name,
    bool? isActive,
    String? kind,
  }) {
    return Session(
      id: id,
      index: index,
      name: name ?? this.name,
      type: type,
      kind: kind ?? this.kind,
      isActive: isActive ?? this.isActive,
    );
  }
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'index': index,
      'name': name,
      'type': type,
      if (kind != null) 'kind': kind,
      'isActive': isActive,
    };
  }
  factory Session.fromJson(Map<String, dynamic> json) {
    return Session(
      id: json['id'] as String? ?? 'session-${json['index']}',
      index: json['index'] as int? ?? 0,
      name: json['name'] as String? ?? 'Session',
      type: json['type'] as String? ?? 'claude',
      kind: json['kind'] as String?,
      isActive: json['isActive'] as bool? ?? false,
    );
  }
  /// Icon for this session type.
  String get icon {
    if (type == 'terminal') return '\u{1F4BB}'; // laptop
    if (kind == 'api') return '\u{1F916}'; // robot
    return '\u{1F4AC}'; // speech bubble
  }
}