repoburg 1.3.186 → 1.3.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-pane/backend/src/codex/codex-provider.ts +105 -2
- package/agent-pane/backend/src/db/index.ts +24 -0
- package/agent-pane/backend/src/db/schema.ts +11 -0
- package/agent-pane/backend/src/index.ts +2 -0
- package/agent-pane/backend/src/routes/sessions.ts +37 -0
- package/agent-pane/backend/src/routes/workspaces.ts +110 -0
- package/agent-pane/frontend/src/api/client.ts +12 -0
- package/agent-pane/frontend/src/api/sessions.ts +17 -1
- package/agent-pane/frontend/src/api/websocket.ts +11 -1
- package/agent-pane/frontend/src/api/workspaces.ts +24 -0
- package/agent-pane/frontend/src/components/CollapsibleToolCalls.tsx +50 -0
- package/agent-pane/frontend/src/components/CommandPalette.tsx +11 -0
- package/agent-pane/frontend/src/components/RenderArea.tsx +61 -48
- package/agent-pane/frontend/src/components/SessionTabs.tsx +6 -3
- package/agent-pane/frontend/src/components/StatusBar.tsx +13 -5
- package/agent-pane/frontend/src/components/Toast.tsx +60 -14
- package/agent-pane/frontend/src/components/TurnContent.tsx +104 -12
- package/agent-pane/frontend/src/components/WorkspaceSidebar.tsx +325 -35
- package/agent-pane/frontend/src/components/panels/ChangesPanel.tsx +6 -2
- package/agent-pane/frontend/src/components/panels/MetricsPanel.tsx +15 -2
- package/agent-pane/frontend/src/components/panels/TurnsPanel.tsx +18 -57
- package/agent-pane/frontend/src/store/store.ts +159 -16
- package/agent-pane/frontend/src/styles/app.css +79 -2
- package/agent-pane/frontend/src/types/index.ts +46 -8
- package/package.json +1 -1
|
@@ -1,60 +1,350 @@
|
|
|
1
|
+
import { useState, useRef, useEffect } from 'react';
|
|
1
2
|
import { useStore } from '../store/store.ts';
|
|
2
|
-
import { statusToDot } from '../types/index.ts';
|
|
3
|
+
import { statusToDot, runtimeIcon } from '../types/index.ts';
|
|
4
|
+
import type { Session, Workspace } from '../types/index.ts';
|
|
3
5
|
import StatusDot from './StatusDot.tsx';
|
|
4
|
-
import
|
|
6
|
+
import RuntimeIcon from './RuntimeIcon.tsx';
|
|
7
|
+
import { Plus, ChevronDown, Folder, FolderPlus, Trash2, Edit3, CheckCircle2, RotateCcw } from 'lucide-react';
|
|
8
|
+
|
|
9
|
+
interface ContextMenuState {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
type: 'workspace' | 'session';
|
|
13
|
+
path?: string;
|
|
14
|
+
sessionId?: string;
|
|
15
|
+
sessionTitle?: string | null;
|
|
16
|
+
sessionLifecycle?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface WorkspaceGroup {
|
|
20
|
+
path: string;
|
|
21
|
+
label: string;
|
|
22
|
+
sessions: Session[];
|
|
23
|
+
workspace: Workspace | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Build workspace groups from active workspaces + session cwd values.
|
|
27
|
+
* Deleted workspace paths are excluded from implicit groups. */
|
|
28
|
+
function buildGroups(workspaces: Workspace[], sessions: Session[]): WorkspaceGroup[] {
|
|
29
|
+
const sessionByCwd = new Map<string, Session[]>();
|
|
30
|
+
|
|
31
|
+
for (const s of sessions) {
|
|
32
|
+
const key = s.cwd || '(no directory)';
|
|
33
|
+
const list = sessionByCwd.get(key) ?? [];
|
|
34
|
+
list.push(s);
|
|
35
|
+
sessionByCwd.set(key, list);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const seenPaths = new Set<string>();
|
|
39
|
+
const deletedPaths = new Set(workspaces.filter((w) => w.deleted === 1).map((w) => w.path));
|
|
40
|
+
const groups: WorkspaceGroup[] = [];
|
|
41
|
+
|
|
42
|
+
// Active explicit workspaces first (deleted = 0)
|
|
43
|
+
for (const ws of workspaces) {
|
|
44
|
+
if (ws.deleted === 1) {
|
|
45
|
+
seenPaths.add(ws.path);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
seenPaths.add(ws.path);
|
|
49
|
+
groups.push({
|
|
50
|
+
path: ws.path,
|
|
51
|
+
label: ws.label || ws.path.split('/').pop() || ws.path,
|
|
52
|
+
sessions: sessionByCwd.get(ws.path) ?? [],
|
|
53
|
+
workspace: ws,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Implicit groups — session cwd values not in any workspace (active or deleted)
|
|
58
|
+
for (const [path, sess] of sessionByCwd) {
|
|
59
|
+
if (seenPaths.has(path) || deletedPaths.has(path)) continue;
|
|
60
|
+
groups.push({
|
|
61
|
+
path,
|
|
62
|
+
label: path === '(no directory)' ? 'Other' : path.split('/').pop() || path,
|
|
63
|
+
sessions: sess,
|
|
64
|
+
workspace: null,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return groups;
|
|
69
|
+
}
|
|
5
70
|
|
|
6
71
|
export default function WorkspaceSidebar() {
|
|
7
|
-
const { sessions, activeSessionId, selectSession,
|
|
72
|
+
const { sessions, workspaces, activeSessionId, selectSession, deleteSession, removeWorkspace, createSessionInWorkspace, pickAndAddWorkspace, renameSession, markFinished, reopenSession } = useStore();
|
|
73
|
+
const [collapsed, setCollapsed] = useState<Set<string>>(new Set());
|
|
74
|
+
const [subCollapsed, setSubCollapsed] = useState<Set<string>>(new Set());
|
|
75
|
+
const [ctxMenu, setCtxMenu] = useState<ContextMenuState | null>(null);
|
|
76
|
+
const [renamingId, setRenamingId] = useState<string | null>(null);
|
|
77
|
+
const [renameValue, setRenameValue] = useState('');
|
|
78
|
+
const ctxRef = useRef<HTMLDivElement>(null);
|
|
79
|
+
const renameRef = useRef<HTMLInputElement>(null);
|
|
80
|
+
|
|
81
|
+
function toggleSection(path: string) {
|
|
82
|
+
setCollapsed((prev) => {
|
|
83
|
+
const next = new Set(prev);
|
|
84
|
+
if (next.has(path)) next.delete(path);
|
|
85
|
+
else next.add(path);
|
|
86
|
+
return next;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function toggleSubGroup(key: string) {
|
|
91
|
+
setSubCollapsed((prev) => {
|
|
92
|
+
const next = new Set(prev);
|
|
93
|
+
if (next.has(key)) next.delete(key);
|
|
94
|
+
else next.add(key);
|
|
95
|
+
return next;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Close context menu on outside click or Escape
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (!ctxMenu) return;
|
|
102
|
+
function handleClick(e: MouseEvent) {
|
|
103
|
+
if (ctxRef.current && !ctxRef.current.contains(e.target as Node)) {
|
|
104
|
+
setCtxMenu(null);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function handleEscape(e: KeyboardEvent) {
|
|
108
|
+
if (e.key === 'Escape') setCtxMenu(null);
|
|
109
|
+
}
|
|
110
|
+
document.addEventListener('mousedown', handleClick);
|
|
111
|
+
document.addEventListener('keydown', handleEscape);
|
|
112
|
+
return () => {
|
|
113
|
+
document.removeEventListener('mousedown', handleClick);
|
|
114
|
+
document.removeEventListener('keydown', handleEscape);
|
|
115
|
+
};
|
|
116
|
+
}, [ctxMenu]);
|
|
117
|
+
|
|
118
|
+
// Focus rename input when it appears
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (renamingId && renameRef.current) {
|
|
121
|
+
renameRef.current.focus();
|
|
122
|
+
renameRef.current.select();
|
|
123
|
+
}
|
|
124
|
+
}, [renamingId]);
|
|
125
|
+
|
|
126
|
+
function startRename(id: string, currentTitle: string) {
|
|
127
|
+
setRenamingId(id);
|
|
128
|
+
setRenameValue(currentTitle || id.slice(0, 8));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function confirmRename() {
|
|
132
|
+
if (renamingId) {
|
|
133
|
+
renameSession(renamingId, renameValue);
|
|
134
|
+
}
|
|
135
|
+
setRenamingId(null);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function cancelRename() {
|
|
139
|
+
setRenamingId(null);
|
|
140
|
+
setRenameValue('');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const groups = buildGroups(workspaces, sessions);
|
|
144
|
+
|
|
145
|
+
function renderSession(s: Session) {
|
|
146
|
+
const isActive = activeSessionId === s.id;
|
|
147
|
+
const isFinished = s.lifecycle === 'finished';
|
|
148
|
+
const dot = statusToDot(s.status, s.is_running === 1, s.has_unreviewed === 1, s.lifecycle);
|
|
149
|
+
const ri = runtimeIcon(s.runtime_type);
|
|
150
|
+
return (
|
|
151
|
+
<div
|
|
152
|
+
key={s.id}
|
|
153
|
+
className={`tree-item ${isActive ? 'active' : ''} ${isFinished ? 'tree-item-finished' : ''}`}
|
|
154
|
+
onClick={() => selectSession(s.id)}
|
|
155
|
+
onContextMenu={(e) => {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
setCtxMenu({ x: e.clientX, y: e.clientY, type: 'session', sessionId: s.id, sessionTitle: s.title, sessionLifecycle: s.lifecycle });
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<RuntimeIcon iconClass={ri.iconClass} iconText={ri.iconText} size={16} />
|
|
161
|
+
{renamingId === s.id ? (
|
|
162
|
+
<input
|
|
163
|
+
ref={renameRef}
|
|
164
|
+
className="tree-rename-input"
|
|
165
|
+
value={renameValue}
|
|
166
|
+
onChange={(e) => setRenameValue(e.target.value)}
|
|
167
|
+
onClick={(e) => e.stopPropagation()}
|
|
168
|
+
onKeyDown={(e) => {
|
|
169
|
+
if (e.key === 'Enter') confirmRename();
|
|
170
|
+
if (e.key === 'Escape') cancelRename();
|
|
171
|
+
}}
|
|
172
|
+
onBlur={confirmRename}
|
|
173
|
+
/>
|
|
174
|
+
) : (
|
|
175
|
+
<span className="tree-label">{s.title || s.id.slice(0, 8)}</span>
|
|
176
|
+
)}
|
|
177
|
+
{dot && <StatusDot status={dot} />}
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
8
181
|
|
|
9
182
|
return (
|
|
10
183
|
<div className="ide-sidebar">
|
|
11
184
|
<div className="sidebar-header">
|
|
12
|
-
<span className="sidebar-header-title">
|
|
13
|
-
<button className="sidebar-add" title="
|
|
185
|
+
<span className="sidebar-header-title">Workspaces</span>
|
|
186
|
+
<button className="sidebar-add" title="Add workspace" onClick={() => pickAndAddWorkspace()}>
|
|
14
187
|
<Plus size={14} />
|
|
15
188
|
</button>
|
|
16
189
|
</div>
|
|
17
190
|
|
|
18
|
-
{
|
|
191
|
+
{groups.length === 0 ? (
|
|
19
192
|
<div className="empty-state" style={{ padding: '16px' }}>
|
|
20
|
-
No
|
|
193
|
+
No workspaces yet. Click + to add one.
|
|
21
194
|
</div>
|
|
22
195
|
) : (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
196
|
+
groups.map((group) => {
|
|
197
|
+
const isCollapsed = collapsed.has(group.path);
|
|
198
|
+
const workingSessions = group.sessions.filter((s) => s.lifecycle !== 'finished');
|
|
199
|
+
const finishedSessions = group.sessions.filter((s) => s.lifecycle === 'finished');
|
|
200
|
+
const finishedKey = `${group.path}:finished`;
|
|
201
|
+
const finishedCollapsed = subCollapsed.has(finishedKey);
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<div key={group.path} className={`tree-section ${isCollapsed ? 'collapsed' : ''}`}>
|
|
28
205
|
<div
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
206
|
+
className="tree-section-header"
|
|
207
|
+
onClick={() => toggleSection(group.path)}
|
|
208
|
+
onContextMenu={(e) => {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
setCtxMenu({ x: e.clientX, y: e.clientY, type: 'workspace', path: group.path });
|
|
211
|
+
}}
|
|
32
212
|
>
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
213
|
+
<ChevronDown size={9} className="tree-chevron" />
|
|
214
|
+
<Folder size={14} />
|
|
215
|
+
<span className="tree-section-label">{group.label}</span>
|
|
216
|
+
<button
|
|
217
|
+
className="tree-section-add"
|
|
218
|
+
title="New session in this workspace"
|
|
219
|
+
onClick={(e) => {
|
|
220
|
+
e.stopPropagation();
|
|
221
|
+
createSessionInWorkspace(group.path);
|
|
222
|
+
}}
|
|
223
|
+
>
|
|
224
|
+
<Plus size={11} />
|
|
225
|
+
</button>
|
|
226
|
+
<span className="tree-count">{group.sessions.length}</span>
|
|
227
|
+
</div>
|
|
228
|
+
<div className="tree-children">
|
|
229
|
+
{/* Working sessions — rendered directly, no sub-group header */}
|
|
230
|
+
{workingSessions.length === 0 && finishedSessions.length === 0 ? (
|
|
231
|
+
<div className="tree-empty">No sessions</div>
|
|
232
|
+
) : (
|
|
233
|
+
workingSessions.map(renderSession)
|
|
234
|
+
)}
|
|
235
|
+
|
|
236
|
+
{/* Finished sub-group — only show if there are finished sessions */}
|
|
237
|
+
{finishedSessions.length > 0 && (
|
|
238
|
+
<div className={`tree-subgroup ${finishedCollapsed ? 'collapsed' : ''}`}>
|
|
239
|
+
<div className="tree-subgroup-header" onClick={() => toggleSubGroup(finishedKey)}>
|
|
240
|
+
<ChevronDown size={8} className="tree-chevron" />
|
|
241
|
+
<span className="tree-subgroup-label">Finished</span>
|
|
242
|
+
<span className="tree-subgroup-count">{finishedSessions.length}</span>
|
|
243
|
+
</div>
|
|
244
|
+
{!finishedCollapsed && (
|
|
245
|
+
<div className="tree-subgroup-items">
|
|
246
|
+
{finishedSessions.map(renderSession)}
|
|
247
|
+
</div>
|
|
248
|
+
)}
|
|
249
|
+
</div>
|
|
46
250
|
)}
|
|
47
251
|
</div>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
252
|
+
</div>
|
|
253
|
+
);
|
|
254
|
+
})
|
|
51
255
|
)}
|
|
52
256
|
|
|
53
|
-
<div className="sidebar-footer">
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
</span>
|
|
257
|
+
<div className="sidebar-footer" onClick={() => pickAndAddWorkspace()}>
|
|
258
|
+
<FolderPlus size={14} />
|
|
259
|
+
<span>Add workspace</span>
|
|
57
260
|
</div>
|
|
261
|
+
|
|
262
|
+
{ctxMenu && (
|
|
263
|
+
<div
|
|
264
|
+
ref={ctxRef}
|
|
265
|
+
className="ctx-menu"
|
|
266
|
+
style={{ position: 'fixed', left: ctxMenu.x, top: ctxMenu.y, zIndex: 500 }}
|
|
267
|
+
>
|
|
268
|
+
{ctxMenu.type === 'workspace' && (
|
|
269
|
+
<>
|
|
270
|
+
<div
|
|
271
|
+
className="ctx-menu-item"
|
|
272
|
+
onClick={() => {
|
|
273
|
+
createSessionInWorkspace(ctxMenu.path!);
|
|
274
|
+
setCtxMenu(null);
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
<Plus size={12} /> New Session
|
|
278
|
+
</div>
|
|
279
|
+
<div
|
|
280
|
+
className="ctx-menu-item ctx-danger"
|
|
281
|
+
onClick={() => {
|
|
282
|
+
removeWorkspace(ctxMenu.path!);
|
|
283
|
+
setCtxMenu(null);
|
|
284
|
+
}}
|
|
285
|
+
>
|
|
286
|
+
<Trash2 size={12} /> Hide Workspace
|
|
287
|
+
</div>
|
|
288
|
+
</>
|
|
289
|
+
)}
|
|
290
|
+
{ctxMenu.type === 'session' && (
|
|
291
|
+
<>
|
|
292
|
+
{ctxMenu.sessionLifecycle !== 'finished' ? (
|
|
293
|
+
<>
|
|
294
|
+
<div
|
|
295
|
+
className="ctx-menu-item"
|
|
296
|
+
onClick={() => {
|
|
297
|
+
startRename(ctxMenu.sessionId!, ctxMenu.sessionTitle ?? '');
|
|
298
|
+
setCtxMenu(null);
|
|
299
|
+
}}
|
|
300
|
+
>
|
|
301
|
+
<Edit3 size={12} /> Rename
|
|
302
|
+
</div>
|
|
303
|
+
<div
|
|
304
|
+
className="ctx-menu-item"
|
|
305
|
+
onClick={() => {
|
|
306
|
+
markFinished(ctxMenu.sessionId!);
|
|
307
|
+
setCtxMenu(null);
|
|
308
|
+
}}
|
|
309
|
+
>
|
|
310
|
+
<CheckCircle2 size={12} /> Mark as Finished
|
|
311
|
+
</div>
|
|
312
|
+
<div
|
|
313
|
+
className="ctx-menu-item ctx-danger"
|
|
314
|
+
onClick={() => {
|
|
315
|
+
deleteSession(ctxMenu.sessionId!);
|
|
316
|
+
setCtxMenu(null);
|
|
317
|
+
}}
|
|
318
|
+
>
|
|
319
|
+
<Trash2 size={12} /> Delete Session
|
|
320
|
+
</div>
|
|
321
|
+
</>
|
|
322
|
+
) : (
|
|
323
|
+
<>
|
|
324
|
+
<div
|
|
325
|
+
className="ctx-menu-item"
|
|
326
|
+
onClick={() => {
|
|
327
|
+
reopenSession(ctxMenu.sessionId!);
|
|
328
|
+
setCtxMenu(null);
|
|
329
|
+
}}
|
|
330
|
+
>
|
|
331
|
+
<RotateCcw size={12} /> Reopen
|
|
332
|
+
</div>
|
|
333
|
+
<div
|
|
334
|
+
className="ctx-menu-item ctx-danger"
|
|
335
|
+
onClick={() => {
|
|
336
|
+
deleteSession(ctxMenu.sessionId!);
|
|
337
|
+
setCtxMenu(null);
|
|
338
|
+
}}
|
|
339
|
+
>
|
|
340
|
+
<Trash2 size={12} /> Delete Session
|
|
341
|
+
</div>
|
|
342
|
+
</>
|
|
343
|
+
)}
|
|
344
|
+
</>
|
|
345
|
+
)}
|
|
346
|
+
</div>
|
|
347
|
+
)}
|
|
58
348
|
</div>
|
|
59
349
|
);
|
|
60
350
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useStore } from '../../store/store.ts';
|
|
2
2
|
|
|
3
3
|
export default function ChangesPanel() {
|
|
4
|
-
const { activeSessionId, sessionDetails, changesScope, setChangesScope, activeTurnIndex } = useStore();
|
|
4
|
+
const { activeSessionId, sessionDetails, changesScope, setChangesScope, activeTurnIndex, setSelectedChangePath } = useStore();
|
|
5
5
|
const detail = activeSessionId ? sessionDetails[activeSessionId] : null;
|
|
6
6
|
const turns = detail?.turns ?? [];
|
|
7
7
|
|
|
@@ -61,7 +61,11 @@ export default function ChangesPanel() {
|
|
|
61
61
|
const dir = entry.path.replace('/' + fileName, '');
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<div
|
|
64
|
+
<div
|
|
65
|
+
key={entry.path}
|
|
66
|
+
className="file-change clickable"
|
|
67
|
+
onClick={() => setSelectedChangePath(entry.path)}
|
|
68
|
+
>
|
|
65
69
|
<span className={`fc-status ${statusClass}`}>{statusChar}</span>
|
|
66
70
|
<span className="fc-name">
|
|
67
71
|
{dir && <span style={{ color: 'var(--text-muted)' }}>{dir}/</span>}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useStore } from '../../store/store.ts';
|
|
2
|
-
import { statusToDot, statusToLabel } from '../../types/index.ts';
|
|
2
|
+
import { statusToDot, statusToLabel, formatDuration } from '../../types/index.ts';
|
|
3
3
|
import StatusDot from '../StatusDot.tsx';
|
|
4
4
|
|
|
5
5
|
export default function MetricsPanel() {
|
|
@@ -31,14 +31,27 @@ export default function MetricsPanel() {
|
|
|
31
31
|
|
|
32
32
|
const turnCount = detail?.turns.length ?? 0;
|
|
33
33
|
|
|
34
|
+
// Calculate duration from first turn created_at to last turn updated_at (or now if running)
|
|
35
|
+
let duration = '—';
|
|
36
|
+
if (detail && detail.turns.length > 0) {
|
|
37
|
+
const firstTurn = detail.turns[0];
|
|
38
|
+
const lastTurn = detail.turns[detail.turns.length - 1];
|
|
39
|
+
const endISO = isRunning ? null : lastTurn.updated_at;
|
|
40
|
+
duration = formatDuration(firstTurn.created_at, endISO);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Repo name = basename of cwd
|
|
44
|
+
const repoName = session.cwd ? session.cwd.split('/').pop() || session.cwd : '—';
|
|
45
|
+
|
|
34
46
|
return (
|
|
35
47
|
<>
|
|
36
48
|
<div className="right-section">
|
|
37
49
|
<div className="right-section-title">Session</div>
|
|
38
50
|
<div className="metric-row"><span className="metric-label">Runtime</span><span className="metric-val">Codex</span></div>
|
|
39
51
|
<div className="metric-row"><span className="metric-label">Model</span><span className="metric-val">{session.model || 'default'}</span></div>
|
|
40
|
-
|
|
52
|
+
<div className="metric-row"><span className="metric-label">Repo</span><span className="metric-val" title={session.cwd || undefined}>{repoName}</span></div>
|
|
41
53
|
<div className="metric-row"><span className="metric-label">Turns</span><span className="metric-val">{turnCount}</span></div>
|
|
54
|
+
<div className="metric-row"><span className="metric-label">Duration</span><span className="metric-val">{duration}</span></div>
|
|
42
55
|
<div className="metric-row">
|
|
43
56
|
<span className="metric-label">Status</span>
|
|
44
57
|
<span className="metric-val">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useStore } from '../../store/store.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { User } from 'lucide-react';
|
|
3
3
|
|
|
4
4
|
export default function TurnsPanel() {
|
|
5
5
|
const { activeSessionId, sessionDetails, activeTurnIndex, setActiveTurnIndex } = useStore();
|
|
@@ -10,72 +10,33 @@ export default function TurnsPanel() {
|
|
|
10
10
|
return <div className="empty-state">No turns yet</div>;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const promptPreview = turn.user_prompt.length > 50
|
|
21
|
-
? turn.user_prompt.slice(0, 50) + '…'
|
|
22
|
-
: turn.user_prompt;
|
|
23
|
-
items.push({ kind: 'user', idx, label: promptPreview });
|
|
24
|
-
|
|
25
|
-
// Count tool-type items
|
|
26
|
-
const toolItems = turn.items.filter(
|
|
27
|
-
(i) => i.type === 'command_execution' || i.type === 'file_change' || i.type === 'mcp_tool_call' || i.type === 'web_search',
|
|
28
|
-
);
|
|
29
|
-
if (toolItems.length > 0) {
|
|
30
|
-
items.push({ kind: 'tools', idx, count: toolItems.length });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Agent response
|
|
34
|
-
if (turn.agent_response || turn.status === 'completed') {
|
|
35
|
-
const label = turn.agent_response
|
|
36
|
-
? (turn.agent_response.length > 50 ? turn.agent_response.slice(0, 50) + '…' : turn.agent_response)
|
|
37
|
-
: 'Agent';
|
|
38
|
-
items.push({ kind: 'agent', idx, label });
|
|
39
|
-
} else if (turn.status === 'running' || turn.status === 'pending') {
|
|
40
|
-
items.push({ kind: 'agent', idx, label: 'Agent thinking…' });
|
|
41
|
-
} else if (turn.status === 'failed') {
|
|
42
|
-
items.push({ kind: 'agent', idx, label: 'Failed' });
|
|
43
|
-
} else if (turn.status === 'aborted') {
|
|
44
|
-
items.push({ kind: 'agent', idx, label: 'Aborted' });
|
|
45
|
-
}
|
|
46
|
-
});
|
|
13
|
+
function handleClick(idx: number) {
|
|
14
|
+
setActiveTurnIndex(idx);
|
|
15
|
+
// Scroll render area to turn position
|
|
16
|
+
requestAnimationFrame(() => {
|
|
17
|
+
document.getElementById(`turn-${idx}`)?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
18
|
+
});
|
|
19
|
+
}
|
|
47
20
|
|
|
48
21
|
return (
|
|
49
22
|
<div className="right-section">
|
|
50
23
|
<div className="right-section-title">Conversation</div>
|
|
51
|
-
{
|
|
52
|
-
const isActive =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
key={`tg-${i}`}
|
|
57
|
-
className={`turn-item ${isActive ? 'active' : ''}`}
|
|
58
|
-
onClick={() => setActiveTurnIndex(item.idx)}
|
|
59
|
-
>
|
|
60
|
-
<span className="turn-item-icon" style={{ background: 'var(--surface-2)', color: 'var(--text-3)' }}>
|
|
61
|
-
<Wrench size={12} style={{ color: 'var(--text-3)' }} />
|
|
62
|
-
</span>
|
|
63
|
-
<span className="turn-item-label">{item.count} tool call{item.count > 1 ? 's' : ''}</span>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
24
|
+
{turns.map((turn, idx) => {
|
|
25
|
+
const isActive = idx === activeTurnIndex;
|
|
26
|
+
const preview = turn.user_prompt.length > 50
|
|
27
|
+
? turn.user_prompt.slice(0, 50) + '…'
|
|
28
|
+
: turn.user_prompt;
|
|
67
29
|
|
|
68
|
-
const isUser = item.kind === 'user';
|
|
69
30
|
return (
|
|
70
31
|
<div
|
|
71
|
-
key={
|
|
32
|
+
key={turn.id}
|
|
72
33
|
className={`turn-item ${isActive ? 'active' : ''}`}
|
|
73
|
-
onClick={() =>
|
|
34
|
+
onClick={() => handleClick(idx)}
|
|
74
35
|
>
|
|
75
|
-
<span className="turn-item-icon" style={
|
|
76
|
-
|
|
36
|
+
<span className="turn-item-icon" style={{ background: 'var(--amber)', color: '#fff' }}>
|
|
37
|
+
<User size={12} />
|
|
77
38
|
</span>
|
|
78
|
-
<span className="turn-item-label">{
|
|
39
|
+
<span className="turn-item-label">{preview}</span>
|
|
79
40
|
</div>
|
|
80
41
|
);
|
|
81
42
|
})}
|