decord/alpha/source/modules/vibegrations/lib/VibegrationsDebugLabels.tsx

210 lines
6.5 KiB
TypeScript
Raw Normal View History

2026-10-03 08:58:59 +00:00
// Module ID: 16738
// Function ID: 16739
// Name: VibegrationsDebugLabels
2026-10-03 08:58:59 +00:00
// Dependencies: [1126, 3723, 16737, 2]
// Exports: analyticsMemoryValue, analyticsRoleLabel, analyticsUnavailableReason, debugEnvLabel, debugLogFilterLabel, debugYesNo, forceCompactionStatus, isRenderableLog, modelCallOutcome
2026-10-03 08:58:59 +00:00
// Module 16738 (VibegrationsDebugLabels)
import intl6 from "intl" /* 1126 */;
import _modDef3723 from "module_3723" /* 3723 */;
import VibegrationsDebugFormat from "VibegrationsDebugFormat" /* 16737 */;
import size from "module_2" /* 2 */;
const set = new Set(["error", "aborted", "length"]);
let closure_4 = {
db() {
2026-10-03 08:58:59 +00:00
return _modDef3723.r6cciE;
},
db_preview() {
2026-10-03 08:58:59 +00:00
return _modDef3723.JmIyL8;
},
runtime() {
2026-10-03 08:58:59 +00:00
return _modDef3723.bzNyv8;
},
runtime_preview() {
2026-10-03 08:58:59 +00:00
return _modDef3723["LONZ/8"];
},
bot() {
2026-10-03 08:58:59 +00:00
return _modDef3723.jdpw3A;
},
bot_preview() {
2026-10-03 08:58:59 +00:00
return _modDef3723["/g6wUz"];
}
};
const result = size.fileFinishedImporting("modules/vibegrations/lib/VibegrationsDebugLabels.tsx");
export const debugEnvLabel = function debugEnvLabel(env) {
2026-10-03 08:58:59 +00:00
let kiOVnt;
const intl = intl6.intl;
const string = intl.string;
if ("preview" === env) {
2026-10-03 08:58:59 +00:00
kiOVnt = _modDef3723["+m8XM6"];
} else {
2026-10-03 08:58:59 +00:00
kiOVnt = _modDef3723.kiOVnt;
}
2026-10-03 08:58:59 +00:00
return string(kiOVnt);
};
export const debugYesNo = function debugYesNo(connected) {
2026-10-03 08:58:59 +00:00
const intl = intl6.intl;
const string = intl.string;
const tmp = _modDef3723;
return string(connected ? tmp["9KlveJ"] : tmp["4tYZVa"]);
};
export const DEBUG_LOG_FILTERS = ["all", "preview", "stable", "web"];
export const debugLogFilterLabel = function debugLogFilterLabel(id) {
2026-10-03 08:58:59 +00:00
let kiOVnt;
if ("preview" !== id) {
if ("stable" !== id) {
if ("web" === id) {
2026-10-03 08:58:59 +00:00
const intl2 = intl6.intl;
return intl2.string(_modDef3723.J2TPCe);
} else {
2026-10-03 08:58:59 +00:00
const intl = intl6.intl;
return intl.string(_modDef3723.humq1B);
}
}
}
2026-10-03 08:58:59 +00:00
const intl3 = intl6.intl;
const string = intl3.string;
if ("preview" === id) {
2026-10-03 08:58:59 +00:00
kiOVnt = _modDef3723["+m8XM6"];
} else {
2026-10-03 08:58:59 +00:00
kiOVnt = _modDef3723.kiOVnt;
}
2026-10-03 08:58:59 +00:00
return string(kiOVnt);
};
export const isRenderableLog = function isRenderableLog(log) {
const message = log.message;
let tmp = typeof message === "string";
if (typeof message === "string") {
tmp = typeof log.level === "string";
}
if (tmp) {
tmp = typeof log.ts === "string";
}
return tmp;
};
export const MAX_MODEL_CALL_ROWS = 30;
export const modelCallOutcome = function modelCallOutcome(call) {
2026-10-03 08:58:59 +00:00
let found;
const hasItem = null != call.stopReason && set.has(call.stopReason);
let formatMsResult = null;
if (null != call.durationMs) {
2026-10-03 08:58:59 +00:00
const obj = VibegrationsDebugFormat;
formatMsResult = obj.formatMs(call.durationMs);
}
const items = [formatMsResult, , ];
2026-10-03 08:58:59 +00:00
const obj2 = VibegrationsDebugFormat;
const formatCountResult = obj2.formatCount(call.inputTokens + call.cacheReadTokens + call.cacheWriteTokens);
const obj3 = VibegrationsDebugFormat;
items[1] = "" + formatCountResult + " \u2192 " + obj3.formatCount(call.outputTokens);
let stopReason = null;
if (hasItem) {
stopReason = call.stopReason;
}
items[2] = stopReason;
2026-10-03 08:58:59 +00:00
const obj4 = { text: found.join(" \u00B7 "), bad: hasItem };
found = items.filter((item) => null != item);
return obj4;
};
export const forceCompactionStatus = function forceCompactionStatus(stateFromStores3) {
if ("idle" === stateFromStores3) {
2026-10-03 08:58:59 +00:00
const intl4 = intl6.intl;
return intl4.string(_modDef3723.wBng42);
} else if ("pending" === stateFromStores3) {
2026-10-03 08:58:59 +00:00
const intl3 = intl6.intl;
return intl3.string(_modDef3723["0tgo31"]);
} else {
2026-10-03 08:58:59 +00:00
const obj3 = VibegrationsDebugFormat;
const formatObservedAtResult = obj3.formatObservedAt(stateFromStores3.observedAt);
if ("compacted" === stateFromStores3.outcome) {
2026-10-03 08:58:59 +00:00
const intl2 = tmp13(1126).intl;
const obj2 = { time: formatObservedAtResult };
2026-10-03 08:58:59 +00:00
return intl2.formatToPlainString(_modDef3723["eL8+rZ"], obj2);
} else {
2026-10-03 08:58:59 +00:00
let v9vZuG6;
if ("declined" === stateFromStores3.outcome) {
2026-10-03 08:58:59 +00:00
v9vZuG6 = _modDef3723["9vZuG6"];
} else if ("busy" === stateFromStores3.outcome) {
2026-10-03 08:58:59 +00:00
v9vZuG6 = _modDef3723.GV4sdd;
} else {
2026-10-03 08:58:59 +00:00
v9vZuG6 = _modDef3723["Y+0nUb"];
}
2026-10-03 08:58:59 +00:00
const intl = tmp13(1126).intl;
let str2 = stateFromStores3.reason;
2026-10-03 08:58:59 +00:00
const formatToPlainString = intl.formatToPlainString;
if (str2 == null) {
str2 = "no reason given";
}
const obj = { reason: str2, time: formatObservedAtResult };
2026-10-03 08:58:59 +00:00
return formatToPlainString(v9vZuG6, obj);
}
}
};
export const analyticsUnavailableReason = function analyticsUnavailableReason(analytics) {
const reason = analytics.reason;
if ("local" === reason) {
2026-10-03 08:58:59 +00:00
const intl5 = intl6.intl;
return intl5.string(_modDef3723.M7Vn6y);
} else if ("unconfigured" === reason) {
2026-10-03 08:58:59 +00:00
const intl4 = intl6.intl;
return intl4.string(_modDef3723.QirpMl);
} else if ("unauthorized" === reason) {
2026-10-03 08:58:59 +00:00
const intl3 = intl6.intl;
return intl3.string(_modDef3723.QZ1e4l);
} else {
2026-10-03 08:58:59 +00:00
let formatToPlainStringResult;
if (null != analytics.detail) {
2026-10-03 08:58:59 +00:00
const intl2 = intl6.intl;
const obj = { detail: analytics.detail };
2026-10-03 08:58:59 +00:00
formatToPlainStringResult = intl2.formatToPlainString(_modDef3723.zUTHf7, obj);
} else {
2026-10-03 08:58:59 +00:00
const intl = intl6.intl;
formatToPlainStringResult = intl.string(_modDef3723.WIAQes);
}
return formatToPlainStringResult;
}
};
export const analyticsMemoryValue = function analyticsMemoryValue(found) {
2026-10-03 08:58:59 +00:00
let formatBytes2;
let formatToPlainStringResult;
let num2;
if (null != found.memory_p50_bytes) {
2026-10-03 08:58:59 +00:00
const intl = intl6.intl;
const formatToPlainString = intl.formatToPlainString;
const SBkDIZ = _modDef3723.SBkDIZ;
let num = found.memory_p50_bytes;
2026-10-03 08:58:59 +00:00
const formatBytes = VibegrationsDebugFormat.formatBytes;
VibegrationsDebugFormat;
if (num == null) {
num = 0;
}
2026-10-03 08:58:59 +00:00
const obj = { p50: formatBytes(num), p999: formatBytes2(num2) };
num2 = found.memory_p999_bytes;
formatBytes2 = tmp2(16737).formatBytes;
VibegrationsDebugFormat;
if (num2 == null) {
num2 = found.memory_p50_bytes;
}
if (num2 == null) {
num2 = 0;
}
2026-10-03 08:58:59 +00:00
formatToPlainStringResult = formatToPlainString(SBkDIZ, obj);
} else {
formatToPlainStringResult = null;
}
return formatToPlainStringResult;
};
export const analyticsRoleLabel = function analyticsRoleLabel(role) {
let tmp = null;
if ("agent" !== role) {
tmp = closure_4[role];
}
let stringResult = null;
if (null != tmp) {
2026-10-03 08:58:59 +00:00
const intl = intl6.intl;
stringResult = intl.string(tmp());
}
return stringResult;
};