fix(import): report accurate post-parse progress stages in real time

The UI stayed on "parsing messages" during the whole post-parse phase:
the importer emitted an 'importing' stage the frontend had no text for,
and on CLI Web the synchronous DB writes / index / FTS build starved the
event loop so buffered SSE progress events only arrived after the import
finished.

- Replace 'importing' with 'saving' (message writes) and a new 'indexing'
  stage (indexes / FTS / session index) in ParseProgress, with UI texts
  for all four locales.
- Yield a macrotask between native parser batches and before heavy
  synchronous steps so SSE progress events flush while importing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
diguaandCursor committed 2026-07-05 22:49:38 +08:00
1 parent f7150e2cff
commit c265925e3e
10 files changed
+36 -8

No files matched your search

+4 -1
View File
@@ -108,11 +108,14 @@ export async function streamImport(
stage = 'parsing'
pct = Math.min(Math.round(progress.percentage * 0.7), 70)
break
case 'importing':
case 'saving':
stage = 'saving'
pct = 80
break
case 'indexing':
stage = 'indexing'
pct = 90
break
case 'done':
stage = 'done'
pct = 100