feat(trace-workbench): reveal the session's jsonl in the file manager

POST /api/sessions/:id/reveal resolves the file server-side (execFile,
argv array — no shell) and opens the platform file manager; the header
button shows the full path on hover.
This commit is contained in:
NI0317
2026-07-18 14:37:35 +08:00
parent 5c0d741531
commit aa18e2a9b2
5 changed files with 44 additions and 0 deletions

View File

@@ -442,6 +442,8 @@ function renderChrome() {
? `<button class="crumb" data-load-session="${escapeHtml(session.parent.id)}" title="Open the session that spawned this one">↳ spawned by: ${escapeHtml(truncate(session.parent.title ?? session.parent.id, 48))}</button>`
: ''
}
const reveal = $('#revealSession')
if (reveal) reveal.title = session.header.path ?? ''
}
/* ── Trajectory: step-grouped rows + navigation tree ─────────────────────────
@@ -1510,6 +1512,12 @@ document.addEventListener('click', async (event) => {
return
}
if (event.target.closest('#revealSession')) {
const result = await postJson(`/api/sessions/${encodeURIComponent(state.session.header.id)}/reveal`, {})
toast(result.ok ? '已在文件管理器中显示' : result.error ?? '无法定位文件')
return
}
if (event.target.closest('#newSessionButton')) {
const result = await postJson('/api/sessions', {})
toast(result.error ?? 'New session created')