chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -11,10 +11,7 @@ export function resolveFinalAssistantText(params: {
|
||||
return "(no output)";
|
||||
}
|
||||
|
||||
function extractTextBlocks(
|
||||
content: unknown,
|
||||
opts?: { includeThinking?: boolean },
|
||||
): string {
|
||||
function extractTextBlocks(content: unknown, opts?: { includeThinking?: boolean }): string {
|
||||
if (typeof content === "string") return content.trim();
|
||||
if (!Array.isArray(content)) return "";
|
||||
const parts: string[] = [];
|
||||
@@ -52,9 +49,7 @@ export function formatTokens(total?: number | null, context?: number | null) {
|
||||
typeof total === "number" && context > 0
|
||||
? Math.min(999, Math.round((total / context) * 100))
|
||||
: null;
|
||||
return `tokens ${totalLabel}/${formatTokenCount(context)}${
|
||||
pct !== null ? ` (${pct}%)` : ""
|
||||
}`;
|
||||
return `tokens ${totalLabel}/${formatTokenCount(context)}${pct !== null ? ` (${pct}%)` : ""}`;
|
||||
}
|
||||
|
||||
export function formatContextUsageLine(params: {
|
||||
@@ -63,18 +58,11 @@ export function formatContextUsageLine(params: {
|
||||
remaining?: number | null;
|
||||
percent?: number | null;
|
||||
}) {
|
||||
const totalLabel =
|
||||
typeof params.total === "number" ? formatTokenCount(params.total) : "?";
|
||||
const ctxLabel =
|
||||
typeof params.context === "number" ? formatTokenCount(params.context) : "?";
|
||||
const pct =
|
||||
typeof params.percent === "number"
|
||||
? Math.min(999, Math.round(params.percent))
|
||||
: null;
|
||||
const totalLabel = typeof params.total === "number" ? formatTokenCount(params.total) : "?";
|
||||
const ctxLabel = typeof params.context === "number" ? formatTokenCount(params.context) : "?";
|
||||
const pct = typeof params.percent === "number" ? Math.min(999, Math.round(params.percent)) : null;
|
||||
const remainingLabel =
|
||||
typeof params.remaining === "number"
|
||||
? `${formatTokenCount(params.remaining)} left`
|
||||
: null;
|
||||
typeof params.remaining === "number" ? `${formatTokenCount(params.remaining)} left` : null;
|
||||
const pctLabel = pct !== null ? `${pct}%` : null;
|
||||
const extra = [remainingLabel, pctLabel].filter(Boolean).join(", ");
|
||||
return `tokens ${totalLabel}/${ctxLabel}${extra ? ` (${extra})` : ""}`;
|
||||
|
||||
Reference in New Issue
Block a user