recappi 0.1.41 → 0.1.42
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 +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -65,10 +65,14 @@ function applyRecordingEventToTelemetry(telemetry, event) {
|
|
|
65
65
|
return { ...telemetry, level: { ...telemetry.level, system: level } };
|
|
66
66
|
}
|
|
67
67
|
if (event.type === "error") {
|
|
68
|
+
if (isLiveCaptionSidecarError(event.code)) return telemetry;
|
|
68
69
|
return { ...telemetry, status: "error", error: event.message };
|
|
69
70
|
}
|
|
70
71
|
return telemetry;
|
|
71
72
|
}
|
|
73
|
+
function isLiveCaptionSidecarError(code) {
|
|
74
|
+
return code?.startsWith("live_caption.") === true;
|
|
75
|
+
}
|
|
72
76
|
function recordingArtifactFromRecordData(data) {
|
|
73
77
|
const artifact = data.artifacts.find((item) => item.kind === "recording_session") ?? data.artifacts[0];
|
|
74
78
|
const metadata = isRecord5(artifact?.metadata) ? artifact.metadata : {};
|
|
@@ -453,7 +457,7 @@ function sidecarToLiveCaptionEvent(event) {
|
|
|
453
457
|
return { kind: "partial", text: event.text };
|
|
454
458
|
}
|
|
455
459
|
case "error":
|
|
456
|
-
return { kind: "error", message: event.message };
|
|
460
|
+
return event.code.startsWith("live_caption.") ? { kind: "error", message: event.message } : null;
|
|
457
461
|
case "audio.level":
|
|
458
462
|
case "local_artifact.upserted":
|
|
459
463
|
return null;
|
|
@@ -688,8 +692,9 @@ function HeroCaptions({ state }) {
|
|
|
688
692
|
const MAX_LINES = 3;
|
|
689
693
|
const recent = state.lines.slice(-MAX_LINES);
|
|
690
694
|
const hasPartial = Boolean(state.partial && state.partial.length > 0);
|
|
695
|
+
const captionError = state.status === "error" ? `Captions unavailable: ${state.error ?? "Live captions unavailable."}` : null;
|
|
691
696
|
if (recent.length === 0 && !hasPartial) {
|
|
692
|
-
return /* @__PURE__ */ jsx3(Text2, { dimColor:
|
|
697
|
+
return /* @__PURE__ */ jsx3(Text2, { color: captionError ? "yellow" : void 0, dimColor: !captionError, children: captionError ?? (state.status === "live" ? "Listening for speech\u2026" : liveCaptionStatusLabel(state.status)) });
|
|
693
698
|
}
|
|
694
699
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
695
700
|
recent.map((line) => /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", alignItems: "center", children: [
|
|
@@ -700,7 +705,8 @@ function HeroCaptions({ state }) {
|
|
|
700
705
|
line.translation ? /* @__PURE__ */ jsx3(Text2, { dimColor: true, wrap: "truncate-end", children: `\u21B3 ${line.translation}` }) : null
|
|
701
706
|
] }, line.id)),
|
|
702
707
|
hasPartial ? /* @__PURE__ */ jsx3(Text2, { dimColor: true, wrap: "truncate-end", children: state.partial }) : null,
|
|
703
|
-
state.translationPartial ? /* @__PURE__ */ jsx3(Text2, { dimColor: true, wrap: "truncate-end", children: `\u21B3 ${state.translationPartial}` }) : null
|
|
708
|
+
state.translationPartial ? /* @__PURE__ */ jsx3(Text2, { dimColor: true, wrap: "truncate-end", children: `\u21B3 ${state.translationPartial}` }) : null,
|
|
709
|
+
captionError ? /* @__PURE__ */ jsx3(Text2, { color: "yellow", wrap: "truncate-end", children: captionError }) : null
|
|
704
710
|
] });
|
|
705
711
|
}
|
|
706
712
|
function stoppedHandoffCopy(artifact, canTranscribe) {
|