chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
import { lookupContextTokens } from "../agents/context.js";
|
||||
import {
|
||||
DEFAULT_CONTEXT_TOKENS,
|
||||
DEFAULT_MODEL,
|
||||
DEFAULT_PROVIDER,
|
||||
} from "../agents/defaults.js";
|
||||
import { DEFAULT_CONTEXT_TOKENS, DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
|
||||
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import {
|
||||
@@ -18,18 +14,11 @@ import { resolveHeartbeatSeconds } from "../web/reconnect.js";
|
||||
import { resolveLinkChannelContext } from "./status.link-channel.js";
|
||||
import type { SessionStatus, StatusSummary } from "./status.types.js";
|
||||
|
||||
const classifyKey = (
|
||||
key: string,
|
||||
entry?: SessionEntry,
|
||||
): SessionStatus["kind"] => {
|
||||
const classifyKey = (key: string, entry?: SessionEntry): SessionStatus["kind"] => {
|
||||
if (key === "global") return "global";
|
||||
if (key === "unknown") return "unknown";
|
||||
if (entry?.chatType === "group" || entry?.chatType === "room") return "group";
|
||||
if (
|
||||
key.startsWith("group:") ||
|
||||
key.includes(":group:") ||
|
||||
key.includes(":channel:")
|
||||
) {
|
||||
if (key.startsWith("group:") || key.includes(":group:") || key.includes(":channel:")) {
|
||||
return "group";
|
||||
}
|
||||
return "direct";
|
||||
@@ -38,22 +27,17 @@ const classifyKey = (
|
||||
const buildFlags = (entry: SessionEntry): string[] => {
|
||||
const flags: string[] = [];
|
||||
const think = entry?.thinkingLevel;
|
||||
if (typeof think === "string" && think.length > 0)
|
||||
flags.push(`think:${think}`);
|
||||
if (typeof think === "string" && think.length > 0) flags.push(`think:${think}`);
|
||||
const verbose = entry?.verboseLevel;
|
||||
if (typeof verbose === "string" && verbose.length > 0)
|
||||
flags.push(`verbose:${verbose}`);
|
||||
if (typeof verbose === "string" && verbose.length > 0) flags.push(`verbose:${verbose}`);
|
||||
const reasoning = entry?.reasoningLevel;
|
||||
if (typeof reasoning === "string" && reasoning.length > 0)
|
||||
flags.push(`reasoning:${reasoning}`);
|
||||
if (typeof reasoning === "string" && reasoning.length > 0) flags.push(`reasoning:${reasoning}`);
|
||||
const elevated = entry?.elevatedLevel;
|
||||
if (typeof elevated === "string" && elevated.length > 0)
|
||||
flags.push(`elevated:${elevated}`);
|
||||
if (typeof elevated === "string" && elevated.length > 0) flags.push(`elevated:${elevated}`);
|
||||
if (entry?.systemSent) flags.push("system");
|
||||
if (entry?.abortedLastRun) flags.push("aborted");
|
||||
const sessionId = entry?.sessionId as unknown;
|
||||
if (typeof sessionId === "string" && sessionId.length > 0)
|
||||
flags.push(`id:${sessionId}`);
|
||||
if (typeof sessionId === "string" && sessionId.length > 0) flags.push(`id:${sessionId}`);
|
||||
return flags;
|
||||
};
|
||||
|
||||
@@ -89,15 +73,11 @@ export async function getStatusSummary(): Promise<StatusSummary> {
|
||||
const age = updatedAt ? now - updatedAt : null;
|
||||
const model = entry?.model ?? configModel ?? null;
|
||||
const contextTokens =
|
||||
entry?.contextTokens ??
|
||||
lookupContextTokens(model) ??
|
||||
configContextTokens ??
|
||||
null;
|
||||
entry?.contextTokens ?? lookupContextTokens(model) ?? configContextTokens ?? null;
|
||||
const input = entry?.inputTokens ?? 0;
|
||||
const output = entry?.outputTokens ?? 0;
|
||||
const total = entry?.totalTokens ?? input + output;
|
||||
const remaining =
|
||||
contextTokens != null ? Math.max(0, contextTokens - total) : null;
|
||||
const remaining = contextTokens != null ? Math.max(0, contextTokens - total) : null;
|
||||
const pct =
|
||||
contextTokens && contextTokens > 0
|
||||
? Math.min(999, Math.round((total / contextTokens) * 100))
|
||||
|
||||
Reference in New Issue
Block a user