chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
export type ThinkLevel =
|
||||
| "off"
|
||||
| "minimal"
|
||||
| "low"
|
||||
| "medium"
|
||||
| "high"
|
||||
| "xhigh";
|
||||
export type ThinkLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
||||
export type VerboseLevel = "off" | "on";
|
||||
export type ElevatedLevel = "off" | "on";
|
||||
export type ReasoningLevel = "off" | "on" | "stream";
|
||||
@@ -16,9 +10,7 @@ export const XHIGH_MODEL_REFS = [
|
||||
"openai-codex/gpt-5.1-codex",
|
||||
] as const;
|
||||
|
||||
const XHIGH_MODEL_SET = new Set(
|
||||
XHIGH_MODEL_REFS.map((entry) => entry.toLowerCase()),
|
||||
);
|
||||
const XHIGH_MODEL_SET = new Set(XHIGH_MODEL_REFS.map((entry) => entry.toLowerCase()));
|
||||
const XHIGH_MODEL_IDS = new Set(
|
||||
XHIGH_MODEL_REFS.map((entry) => entry.split("/")[1]?.toLowerCase()).filter(
|
||||
(entry): entry is string => Boolean(entry),
|
||||
@@ -26,42 +18,22 @@ const XHIGH_MODEL_IDS = new Set(
|
||||
);
|
||||
|
||||
// Normalize user-provided thinking level strings to the canonical enum.
|
||||
export function normalizeThinkLevel(
|
||||
raw?: string | null,
|
||||
): ThinkLevel | undefined {
|
||||
export function normalizeThinkLevel(raw?: string | null): ThinkLevel | undefined {
|
||||
if (!raw) return undefined;
|
||||
const key = raw.toLowerCase();
|
||||
if (["off"].includes(key)) return "off";
|
||||
if (["min", "minimal"].includes(key)) return "minimal";
|
||||
if (["low", "thinkhard", "think-hard", "think_hard"].includes(key))
|
||||
return "low";
|
||||
if (
|
||||
["mid", "med", "medium", "thinkharder", "think-harder", "harder"].includes(
|
||||
key,
|
||||
)
|
||||
)
|
||||
if (["low", "thinkhard", "think-hard", "think_hard"].includes(key)) return "low";
|
||||
if (["mid", "med", "medium", "thinkharder", "think-harder", "harder"].includes(key))
|
||||
return "medium";
|
||||
if (
|
||||
[
|
||||
"high",
|
||||
"ultra",
|
||||
"ultrathink",
|
||||
"think-hard",
|
||||
"thinkhardest",
|
||||
"highest",
|
||||
"max",
|
||||
].includes(key)
|
||||
)
|
||||
if (["high", "ultra", "ultrathink", "think-hard", "thinkhardest", "highest", "max"].includes(key))
|
||||
return "high";
|
||||
if (["xhigh", "x-high", "x_high"].includes(key)) return "xhigh";
|
||||
if (["think"].includes(key)) return "minimal";
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function supportsXHighThinking(
|
||||
provider?: string | null,
|
||||
model?: string | null,
|
||||
): boolean {
|
||||
export function supportsXHighThinking(provider?: string | null, model?: string | null): boolean {
|
||||
const modelKey = model?.trim().toLowerCase();
|
||||
if (!modelKey) return false;
|
||||
const providerKey = provider?.trim().toLowerCase();
|
||||
@@ -71,10 +43,7 @@ export function supportsXHighThinking(
|
||||
return XHIGH_MODEL_IDS.has(modelKey);
|
||||
}
|
||||
|
||||
export function listThinkingLevels(
|
||||
provider?: string | null,
|
||||
model?: string | null,
|
||||
): ThinkLevel[] {
|
||||
export function listThinkingLevels(provider?: string | null, model?: string | null): ThinkLevel[] {
|
||||
const levels: ThinkLevel[] = ["off", "minimal", "low", "medium", "high"];
|
||||
if (supportsXHighThinking(provider, model)) levels.push("xhigh");
|
||||
return levels;
|
||||
@@ -97,9 +66,7 @@ export function formatXHighModelHint(): string {
|
||||
}
|
||||
|
||||
// Normalize verbose flags used to toggle agent verbosity.
|
||||
export function normalizeVerboseLevel(
|
||||
raw?: string | null,
|
||||
): VerboseLevel | undefined {
|
||||
export function normalizeVerboseLevel(raw?: string | null): VerboseLevel | undefined {
|
||||
if (!raw) return undefined;
|
||||
const key = raw.toLowerCase();
|
||||
if (["off", "false", "no", "0"].includes(key)) return "off";
|
||||
@@ -108,22 +75,16 @@ export function normalizeVerboseLevel(
|
||||
}
|
||||
|
||||
// Normalize response-usage display flags used to toggle cost/token lines.
|
||||
export function normalizeUsageDisplay(
|
||||
raw?: string | null,
|
||||
): UsageDisplayLevel | undefined {
|
||||
export function normalizeUsageDisplay(raw?: string | null): UsageDisplayLevel | undefined {
|
||||
if (!raw) return undefined;
|
||||
const key = raw.toLowerCase();
|
||||
if (["off", "false", "no", "0", "disable", "disabled"].includes(key))
|
||||
return "off";
|
||||
if (["on", "true", "yes", "1", "enable", "enabled"].includes(key))
|
||||
return "on";
|
||||
if (["off", "false", "no", "0", "disable", "disabled"].includes(key)) return "off";
|
||||
if (["on", "true", "yes", "1", "enable", "enabled"].includes(key)) return "on";
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Normalize elevated flags used to toggle elevated bash permissions.
|
||||
export function normalizeElevatedLevel(
|
||||
raw?: string | null,
|
||||
): ElevatedLevel | undefined {
|
||||
export function normalizeElevatedLevel(raw?: string | null): ElevatedLevel | undefined {
|
||||
if (!raw) return undefined;
|
||||
const key = raw.toLowerCase();
|
||||
if (["off", "false", "no", "0"].includes(key)) return "off";
|
||||
@@ -132,30 +93,12 @@ export function normalizeElevatedLevel(
|
||||
}
|
||||
|
||||
// Normalize reasoning visibility flags used to toggle reasoning exposure.
|
||||
export function normalizeReasoningLevel(
|
||||
raw?: string | null,
|
||||
): ReasoningLevel | undefined {
|
||||
export function normalizeReasoningLevel(raw?: string | null): ReasoningLevel | undefined {
|
||||
if (!raw) return undefined;
|
||||
const key = raw.toLowerCase();
|
||||
if (
|
||||
[
|
||||
"off",
|
||||
"false",
|
||||
"no",
|
||||
"0",
|
||||
"hide",
|
||||
"hidden",
|
||||
"disable",
|
||||
"disabled",
|
||||
].includes(key)
|
||||
)
|
||||
if (["off", "false", "no", "0", "hide", "hidden", "disable", "disabled"].includes(key))
|
||||
return "off";
|
||||
if (
|
||||
["on", "true", "yes", "1", "show", "visible", "enable", "enabled"].includes(
|
||||
key,
|
||||
)
|
||||
)
|
||||
return "on";
|
||||
if (["on", "true", "yes", "1", "show", "visible", "enable", "enabled"].includes(key)) return "on";
|
||||
if (["stream", "streaming", "draft", "live"].includes(key)) return "stream";
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user