@mux/ai 0.54.0 → 0.56.0
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-CmTC1w4V.d.ts → index-Bav9fNtf.d.ts} +1 -1
- package/dist/{index-cbaPe-aE.d.ts → index-DiuqBw6I.d.ts} +1 -1
- package/dist/index.d.ts +28 -9
- package/dist/index.js +241 -126
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/primitives/index.js +44 -9
- package/dist/primitives/index.js.map +1 -1
- package/dist/{transcripts-BCtzC8hZ.d.ts → transcripts-Brw74qlV.d.ts} +8 -2
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +240 -121
- package/dist/workflows/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DEFAULT_STORYBOARD_WIDTH, H as HeatmapOptions, a as HeatmapResponse, T as ThumbnailOptions, V as VTTCueBudgetChunkingOptions, b as VTTDurationChunk, c as VTTDurationChunkingOptions, d as chunkByTokens, e as chunkText, f as chunkVTTCues, g as chunkVTTCuesByBudget, h as chunkVTTCuesByDuration, j as estimateTokenCount, k as getHeatmapForAsset, l as getHeatmapForPlaybackId, m as getHeatmapForVideo, n as getStoryboardUrl, o as getThumbnailUrls } from '../index-
|
|
2
|
-
export { r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, q as VTTCue, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from '../transcripts-
|
|
1
|
+
export { D as DEFAULT_STORYBOARD_WIDTH, H as HeatmapOptions, a as HeatmapResponse, T as ThumbnailOptions, V as VTTCueBudgetChunkingOptions, b as VTTDurationChunk, c as VTTDurationChunkingOptions, d as chunkByTokens, e as chunkText, f as chunkVTTCues, g as chunkVTTCuesByBudget, h as chunkVTTCuesByDuration, j as estimateTokenCount, k as getHeatmapForAsset, l as getHeatmapForPlaybackId, m as getHeatmapForVideo, n as getStoryboardUrl, o as getThumbnailUrls } from '../index-DiuqBw6I.js';
|
|
2
|
+
export { r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, q as VTTCue, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from '../transcripts-Brw74qlV.js';
|
|
3
3
|
import '@mux/ts';
|
package/dist/primitives/index.js
CHANGED
|
@@ -685,6 +685,10 @@ async function fetchHotspots(identifierType, id, options) {
|
|
|
685
685
|
};
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
+
// node_modules/@workflow/serde/dist/index.js
|
|
689
|
+
var WORKFLOW_SERIALIZE = /* @__PURE__ */ Symbol.for("workflow-serialize");
|
|
690
|
+
var WORKFLOW_DESERIALIZE = /* @__PURE__ */ Symbol.for("workflow-deserialize");
|
|
691
|
+
|
|
688
692
|
// src/lib/prompt-fragments.ts
|
|
689
693
|
import dedent from "dedent";
|
|
690
694
|
var promptDedent = dedent.withOptions({ alignValues: true });
|
|
@@ -916,7 +920,7 @@ function getErrorTokenUsage(error) {
|
|
|
916
920
|
}
|
|
917
921
|
|
|
918
922
|
// src/lib/mux-ai-error.ts
|
|
919
|
-
var MuxAiError = class extends Error {
|
|
923
|
+
var MuxAiError = class _MuxAiError extends Error {
|
|
920
924
|
constructor(message, opts) {
|
|
921
925
|
super(message);
|
|
922
926
|
/** Structural brand for duck-type identification. */
|
|
@@ -932,6 +936,32 @@ var MuxAiError = class extends Error {
|
|
|
932
936
|
static is(value) {
|
|
933
937
|
return typeof value === "object" && value !== null && "__robots_error" in value && value.__robots_error === true;
|
|
934
938
|
}
|
|
939
|
+
static [WORKFLOW_SERIALIZE](instance) {
|
|
940
|
+
const incomplete = instance;
|
|
941
|
+
return {
|
|
942
|
+
message: instance.publicMessage,
|
|
943
|
+
publicType: instance.publicType,
|
|
944
|
+
retryable: instance.retryable,
|
|
945
|
+
stack: instance.stack,
|
|
946
|
+
usage: getErrorTokenUsage(instance),
|
|
947
|
+
finishReason: incomplete.finishReason,
|
|
948
|
+
rawFinishReason: incomplete.rawFinishReason,
|
|
949
|
+
diagnostics: instance.diagnostics
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
static [WORKFLOW_DESERIALIZE](value) {
|
|
953
|
+
const error = new _MuxAiError(value.message, { type: value.publicType, retryable: value.retryable });
|
|
954
|
+
Object.assign(error, {
|
|
955
|
+
usage: value.usage,
|
|
956
|
+
diagnostics: value.diagnostics,
|
|
957
|
+
...value.finishReason !== void 0 && { finishReason: value.finishReason },
|
|
958
|
+
...value.rawFinishReason !== void 0 && { rawFinishReason: value.rawFinishReason }
|
|
959
|
+
});
|
|
960
|
+
if (value.stack !== void 0) {
|
|
961
|
+
error.stack = value.stack;
|
|
962
|
+
}
|
|
963
|
+
return error;
|
|
964
|
+
}
|
|
935
965
|
};
|
|
936
966
|
function extractErrorDetail(error) {
|
|
937
967
|
if (error instanceof Error && error.message) {
|
|
@@ -1873,14 +1903,13 @@ function extractTextFromVTT(vttContent) {
|
|
|
1873
1903
|
textLines.join(" ").replace(/\s+/g, " ").trim()
|
|
1874
1904
|
);
|
|
1875
1905
|
}
|
|
1906
|
+
var VTT_TIMESTAMP_RE = /^(?:(\d+):)?(\d{2}):(\d{2})(?:\.(\d{3}))?$/;
|
|
1876
1907
|
function vttTimestampToSeconds(timestamp) {
|
|
1877
|
-
const
|
|
1878
|
-
if (
|
|
1879
|
-
return 0;
|
|
1880
|
-
const hours =
|
|
1881
|
-
|
|
1882
|
-
const seconds = Number.parseFloat(parts[2]) || 0;
|
|
1883
|
-
return hours * 3600 + minutes * 60 + seconds;
|
|
1908
|
+
const match = VTT_TIMESTAMP_RE.exec(timestamp);
|
|
1909
|
+
if (!match)
|
|
1910
|
+
return void 0;
|
|
1911
|
+
const [, hours = "0", minutes, seconds, millis = "0"] = match;
|
|
1912
|
+
return Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds) + Number(millis) / 1e3;
|
|
1884
1913
|
}
|
|
1885
1914
|
function secondsToTimestamp(seconds) {
|
|
1886
1915
|
const rounded = Math.max(0, Math.floor(seconds));
|
|
@@ -1903,6 +1932,8 @@ function extractTimestampedTranscript(vttContent) {
|
|
|
1903
1932
|
if (line.includes("-->")) {
|
|
1904
1933
|
const startTime = line.split(" --> ")[0].trim();
|
|
1905
1934
|
const timeInSeconds = vttTimestampToSeconds(startTime);
|
|
1935
|
+
if (timeInSeconds === void 0)
|
|
1936
|
+
continue;
|
|
1906
1937
|
let j = i + 1;
|
|
1907
1938
|
while (j < lines.length && !lines[j].trim()) {
|
|
1908
1939
|
j++;
|
|
@@ -1931,13 +1962,17 @@ function parseVTTCues(vttContent, options = {}) {
|
|
|
1931
1962
|
if (isTimingLine(line)) {
|
|
1932
1963
|
const [startStr, endStr] = line.split(" --> ").map((s) => s.trim());
|
|
1933
1964
|
const startTime = vttTimestampToSeconds(startStr);
|
|
1934
|
-
const endTime = vttTimestampToSeconds(endStr
|
|
1965
|
+
const endTime = vttTimestampToSeconds(endStr?.split(/\s+/)[0] ?? "");
|
|
1935
1966
|
const currentCueIdentifierLine = lines[i - 1]?.trim() ?? "";
|
|
1936
1967
|
const currentCueIdentifier = isLikelyCueIdentifier({
|
|
1937
1968
|
line: currentCueIdentifierLine,
|
|
1938
1969
|
nextLine: line,
|
|
1939
1970
|
previousCueIdentifier
|
|
1940
1971
|
}) ? parseNumericCueIdentifier(currentCueIdentifierLine) : null;
|
|
1972
|
+
if (startTime === void 0 || endTime === void 0) {
|
|
1973
|
+
previousCueIdentifier = currentCueIdentifier;
|
|
1974
|
+
continue;
|
|
1975
|
+
}
|
|
1941
1976
|
const rawTextLines = [];
|
|
1942
1977
|
let j = i + 1;
|
|
1943
1978
|
while (j < lines.length && lines[j].trim() && !isTimingLine(lines[j].trim())) {
|