recappi 0.1.72 → 0.1.74

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/dist/index.js CHANGED
@@ -1252,10 +1252,10 @@ function RecordingDetailView({
1252
1252
  scrollable ? " \xB7 \u2191\u2193 scroll" : "",
1253
1253
  ready ? " \xB7 " : "",
1254
1254
  `o open \xB7 d download \xB7 f finder`,
1255
- " \xB7 T re-transcribe \xB7 S re-summarize",
1255
+ " \xB7 T re-transcribe \xB7 s re-summarize",
1256
1256
  item.activeTranscriptId ? " \xB7 t full" : "",
1257
1257
  links.webUrl ? " \xB7 w web" : "",
1258
- " \xB7 esc back"
1258
+ " \xB7 r refresh \xB7 esc back"
1259
1259
  ] }) })
1260
1260
  ] });
1261
1261
  }
@@ -2034,6 +2034,7 @@ function AppShell({
2034
2034
  );
2035
2035
  const [audioCache, setAudioCache] = useState8(() => /* @__PURE__ */ new Map());
2036
2036
  const [downloadedIds, setDownloadedIds] = useState8(() => /* @__PURE__ */ new Set());
2037
+ const summaryRefreshRef = useRef3(null);
2037
2038
  const [liveRecord, setLiveRecord] = useState8(void 0);
2038
2039
  const [recordSetupInputs, setRecordSetupInputs] = useState8({
2039
2040
  sources: DEFAULT_RECORDING_SOURCES,
@@ -2423,6 +2424,18 @@ function AppShell({
2423
2424
  },
2424
2425
  [onRetranscribe, refresh]
2425
2426
  );
2427
+ const refetchTranscript = useCallback(
2428
+ (transcriptId) => {
2429
+ setTranscriptCache((m) => new Map(m).set(transcriptId, "loading"));
2430
+ setSummaryCache((m) => {
2431
+ const next = new Map(m);
2432
+ next.delete(transcriptId);
2433
+ return next;
2434
+ });
2435
+ fetchTranscript(transcriptId).then((tr) => setTranscriptCache((m) => new Map(m).set(transcriptId, tr))).catch(() => setTranscriptCache((m) => new Map(m).set(transcriptId, "error")));
2436
+ },
2437
+ [fetchTranscript]
2438
+ );
2426
2439
  const resummarizeExistingRecording = useCallback(
2427
2440
  async (recordingId) => {
2428
2441
  if (!onResummarize) {
@@ -2431,14 +2444,19 @@ function AppShell({
2431
2444
  }
2432
2445
  setNotice("Re-summarize started\u2026");
2433
2446
  try {
2434
- await onResummarize(recordingId);
2435
- setNotice("Re-summarize started \u2014 the summary will refresh shortly.");
2447
+ const data = await onResummarize(recordingId);
2448
+ setNotice("Re-summarize started \u2014 the summary updates here as it finishes.");
2436
2449
  await refresh({ resetRecordings: true });
2450
+ const transcriptId = data.transcriptId ?? recordings.find((r) => r.recordingId === recordingId)?.activeTranscriptId;
2451
+ if (transcriptId) {
2452
+ summaryRefreshRef.current = { transcriptId, until: now() + 12e4 };
2453
+ refetchTranscript(transcriptId);
2454
+ }
2437
2455
  } catch (error51) {
2438
2456
  setNotice(transcribeHandoffErrorCopy(error51));
2439
2457
  }
2440
2458
  },
2441
- [onResummarize, refresh]
2459
+ [onResummarize, refresh, recordings, now, refetchTranscript]
2442
2460
  );
2443
2461
  useEffect4(() => {
2444
2462
  if (liveRecord?.kind !== "stopped") return;
@@ -2481,6 +2499,26 @@ function AppShell({
2481
2499
  const id = setInterval(() => void refresh(), pollMs);
2482
2500
  return () => clearInterval(id);
2483
2501
  }, [refresh, pollMs]);
2502
+ const transcriptCacheRef = useRef3(transcriptCache);
2503
+ transcriptCacheRef.current = transcriptCache;
2504
+ useEffect4(() => {
2505
+ const id = setInterval(() => {
2506
+ const pending = summaryRefreshRef.current;
2507
+ if (!pending) return;
2508
+ if (now() >= pending.until) {
2509
+ summaryRefreshRef.current = null;
2510
+ return;
2511
+ }
2512
+ const cached2 = transcriptCacheRef.current.get(pending.transcriptId);
2513
+ const summary = cached2 && cached2 !== "loading" && cached2 !== "error" ? cached2.summary : void 0;
2514
+ if (summary?.status === "succeeded") {
2515
+ summaryRefreshRef.current = null;
2516
+ return;
2517
+ }
2518
+ refetchTranscript(pending.transcriptId);
2519
+ }, 3e3);
2520
+ return () => clearInterval(id);
2521
+ }, [now, refetchTranscript]);
2484
2522
  const hasRunning = jobs.some((item) => item.status === "running");
2485
2523
  useEffect4(() => {
2486
2524
  if (!hasRunning && loaded) return;
@@ -2665,14 +2703,21 @@ function AppShell({
2665
2703
  }
2666
2704
  return;
2667
2705
  }
2668
- if (input === "r") return void refresh({ resetRecordings: true });
2706
+ if (input === "r") {
2707
+ void refresh({ resetRecordings: true });
2708
+ if (screen.kind === "recordingDetail") {
2709
+ const detailRec = recordings.find((r) => r.recordingId === screen.recordingId);
2710
+ if (detailRec?.activeTranscriptId) refetchTranscript(detailRec.activeTranscriptId);
2711
+ }
2712
+ return;
2713
+ }
2669
2714
  if (screen.kind === "overview") {
2670
2715
  if (input === "g") setSelected(0);
2671
2716
  if (input === "G") setSelected(Math.max(0, recordings.length - 1));
2672
2717
  if (key.upArrow || input === "k") setSelected((i) => Math.max(0, i - 1));
2673
2718
  if (key.downArrow || input === "j") setSelected((i) => Math.min(recordings.length - 1, i + 1));
2674
2719
  const rec = recordings[selected];
2675
- if (key.return && rec)
2720
+ if ((key.return || key.rightArrow) && rec)
2676
2721
  setStack((st) => [...st, { kind: "recordingDetail", recordingId: rec.recordingId }]);
2677
2722
  if (input === "t" && rec?.activeTranscriptId) void openTranscript(rec.activeTranscriptId);
2678
2723
  return;
@@ -2683,7 +2728,8 @@ function AppShell({
2683
2728
  if (key.upArrow || input === "k") setSelected((i) => Math.max(0, i - 1));
2684
2729
  if (key.downArrow || input === "j") setSelected((i) => Math.min(jobs.length - 1, i + 1));
2685
2730
  const job = jobs[selected];
2686
- if (key.return && job) setStack((st) => [...st, { kind: "jobDetail", jobId: job.jobId }]);
2731
+ if ((key.return || key.rightArrow) && job)
2732
+ setStack((st) => [...st, { kind: "jobDetail", jobId: job.jobId }]);
2687
2733
  if (input === "t" && job?.transcriptId) void openTranscript(job.transcriptId);
2688
2734
  return;
2689
2735
  }
@@ -2703,7 +2749,7 @@ function AppShell({
2703
2749
  const rec = recordings.find((r) => r.recordingId === screen.recordingId);
2704
2750
  const links = rec ? resolveRecordingLinks(rec.recordingId, rec.origin) : {};
2705
2751
  if (input === "T" && rec) void retranscribeExistingRecording(rec.recordingId);
2706
- else if (input === "S" && rec) void resummarizeExistingRecording(rec.recordingId);
2752
+ else if ((input === "s" || input === "S") && rec) void resummarizeExistingRecording(rec.recordingId);
2707
2753
  else if (input === "t" && rec?.activeTranscriptId) void openTranscript(rec.activeTranscriptId);
2708
2754
  else if (input === "o" && rec) void runAudio(rec.recordingId, "open");
2709
2755
  else if (input === "d" && rec) void runAudio(rec.recordingId, "download");