chore: fix lint/format

This commit is contained in:
Peter Steinberger
2026-01-20 13:52:59 +00:00
parent a81989048d
commit d69f246ba7
11 changed files with 25 additions and 43 deletions

View File

@@ -179,9 +179,10 @@ export function syncExternalCliCredentials(
!existingCodex || !existingCodex ||
existingCodex.provider !== "openai-codex" || existingCodex.provider !== "openai-codex" ||
!isExternalProfileFresh(existingCodex, now); !isExternalProfileFresh(existingCodex, now);
const codexCreds = shouldSyncCodex || duplicateExistingId const codexCreds =
? readCodexCliCredentialsCached({ ttlMs: EXTERNAL_CLI_SYNC_TTL_MS }) shouldSyncCodex || duplicateExistingId
: null; ? readCodexCliCredentialsCached({ ttlMs: EXTERNAL_CLI_SYNC_TTL_MS })
: null;
if (codexCreds) { if (codexCreds) {
const duplicateProfileId = findDuplicateCodexProfile(store, codexCreds); const duplicateProfileId = findDuplicateCodexProfile(store, codexCreds);
if (duplicateProfileId) { if (duplicateProfileId) {

View File

@@ -38,9 +38,9 @@ function resolveProviderConfig(
} }
return ( return (
(providers[normalized] as ModelProviderConfig | undefined) ?? (providers[normalized] as ModelProviderConfig | undefined) ??
(Object.entries(providers).find( (Object.entries(providers).find(([key]) => normalizeProviderId(key) === normalized)?.[1] as
([key]) => normalizeProviderId(key) === normalized, | ModelProviderConfig
)?.[1] as ModelProviderConfig | undefined) | undefined)
); );
} }
@@ -353,7 +353,5 @@ export async function getApiKeyForModel(params: {
export function requireApiKey(auth: ResolvedProviderAuth, provider: string): string { export function requireApiKey(auth: ResolvedProviderAuth, provider: string): string {
const key = auth.apiKey?.trim(); const key = auth.apiKey?.trim();
if (key) return key; if (key) return key;
throw new Error( throw new Error(`No API key resolved for provider "${provider}" (auth mode: ${auth.mode}).`);
`No API key resolved for provider "${provider}" (auth mode: ${auth.mode}).`,
);
} }

View File

@@ -55,8 +55,7 @@ export function resolveModel(
const inlineModels = buildInlineProviderModels(providers); const inlineModels = buildInlineProviderModels(providers);
const normalizedProvider = normalizeProviderId(provider); const normalizedProvider = normalizeProviderId(provider);
const inlineMatch = inlineModels.find( const inlineMatch = inlineModels.find(
(entry) => (entry) => normalizeProviderId(entry.provider) === normalizedProvider && entry.id === modelId,
normalizeProviderId(entry.provider) === normalizedProvider && entry.id === modelId,
); );
if (inlineMatch) { if (inlineMatch) {
const normalized = normalizeModelCompat(inlineMatch as Model<Api>); const normalized = normalizeModelCompat(inlineMatch as Model<Api>);

View File

@@ -18,19 +18,13 @@ describe("web_search perplexity baseUrl defaults", () => {
}); });
it("prefers explicit baseUrl over key-based defaults", () => { it("prefers explicit baseUrl over key-based defaults", () => {
expect( expect(resolvePerplexityBaseUrl({ baseUrl: "https://example.com" }, "config", "pplx-123")).toBe(
resolvePerplexityBaseUrl( "https://example.com",
{ baseUrl: "https://example.com" }, );
"config",
"pplx-123",
),
).toBe("https://example.com");
}); });
it("defaults to direct when using PERPLEXITY_API_KEY", () => { it("defaults to direct when using PERPLEXITY_API_KEY", () => {
expect(resolvePerplexityBaseUrl(undefined, "perplexity_env")).toBe( expect(resolvePerplexityBaseUrl(undefined, "perplexity_env")).toBe("https://api.perplexity.ai");
"https://api.perplexity.ai",
);
}); });
it("defaults to OpenRouter when using OPENROUTER_API_KEY", () => { it("defaults to OpenRouter when using OPENROUTER_API_KEY", () => {

View File

@@ -18,7 +18,6 @@ import {
DEFAULT_GIT_CHANNEL, DEFAULT_GIT_CHANNEL,
DEFAULT_PACKAGE_CHANNEL, DEFAULT_PACKAGE_CHANNEL,
normalizeUpdateChannel, normalizeUpdateChannel,
type UpdateChannel,
} from "../infra/update-channels.js"; } from "../infra/update-channels.js";
import { defaultRuntime } from "../runtime.js"; import { defaultRuntime } from "../runtime.js";
import { formatDocsLink } from "../terminal/links.js"; import { formatDocsLink } from "../terminal/links.js";

View File

@@ -309,9 +309,7 @@ describe("config identity defaults", () => {
expect(cfg.messages?.groupChat?.mentionPatterns).toBeUndefined(); expect(cfg.messages?.groupChat?.mentionPatterns).toBeUndefined();
expect(cfg.agents?.list).toBeUndefined(); expect(cfg.agents?.list).toBeUndefined();
expect(cfg.agents?.defaults?.maxConcurrent).toBe(DEFAULT_AGENT_MAX_CONCURRENT); expect(cfg.agents?.defaults?.maxConcurrent).toBe(DEFAULT_AGENT_MAX_CONCURRENT);
expect(cfg.agents?.defaults?.subagents?.maxConcurrent).toBe( expect(cfg.agents?.defaults?.subagents?.maxConcurrent).toBe(DEFAULT_SUBAGENT_MAX_CONCURRENT);
DEFAULT_SUBAGENT_MAX_CONCURRENT,
);
expect(cfg.session).toBeUndefined(); expect(cfg.session).toBeUndefined();
}); });
}); });

View File

@@ -258,9 +258,7 @@ export function createConfigIO(overrides: ConfigIoDeps = {}) {
applyCompactionDefaults( applyCompactionDefaults(
applyContextPruningDefaults( applyContextPruningDefaults(
applyAgentDefaults( applyAgentDefaults(
applySessionDefaults( applySessionDefaults(applyLoggingDefaults(applyMessageDefaults(validated.config))),
applyLoggingDefaults(applyMessageDefaults(validated.config)),
),
), ),
), ),
), ),

View File

@@ -1,5 +1,9 @@
import type { ClawdbotConfig } from "./config.js"; import type { ClawdbotConfig } from "./config.js";
import { getChatChannelMeta, listChatChannels, normalizeChatChannelId } from "../channels/registry.js"; import {
getChatChannelMeta,
listChatChannels,
normalizeChatChannelId,
} from "../channels/registry.js";
import { import {
getChannelPluginCatalogEntry, getChannelPluginCatalogEntry,
listChannelPluginCatalogEntries, listChannelPluginCatalogEntries,

View File

@@ -50,12 +50,7 @@ export const ModelProviderSchema = z
baseUrl: z.string().min(1), baseUrl: z.string().min(1),
apiKey: z.string().optional(), apiKey: z.string().optional(),
auth: z auth: z
.union([ .union([z.literal("api-key"), z.literal("aws-sdk"), z.literal("oauth"), z.literal("token")])
z.literal("api-key"),
z.literal("aws-sdk"),
z.literal("oauth"),
z.literal("token"),
])
.optional(), .optional(),
api: ModelApiSchema.optional(), api: ModelApiSchema.optional(),
headers: z.record(z.string(), z.string()).optional(), headers: z.record(z.string(), z.string()).optional(),

View File

@@ -29,10 +29,7 @@ import {
uniqueSortedStrings, uniqueSortedStrings,
} from "./nodes.helpers.js"; } from "./nodes.helpers.js";
import { loadConfig } from "../../config/config.js"; import { loadConfig } from "../../config/config.js";
import { import { isNodeCommandAllowed, resolveNodeCommandAllowlist } from "../node-command-policy.js";
isNodeCommandAllowed,
resolveNodeCommandAllowlist,
} from "../node-command-policy.js";
import type { GatewayRequestHandlers } from "./types.js"; import type { GatewayRequestHandlers } from "./types.js";
function isNodeEntry(entry: { role?: string; roles?: string[] }) { function isNodeEntry(entry: { role?: string; roles?: string[] }) {

View File

@@ -27,8 +27,7 @@ declare module "pdfjs-dist/legacy/build/pdf.mjs" {
getPage(pageNumber: number): Promise<PDFPageProxy>; getPage(pageNumber: number): Promise<PDFPageProxy>;
}; };
export function getDocument(params: { export function getDocument(params: { data: Uint8Array; disableWorker?: boolean }): {
data: Uint8Array; promise: Promise<PDFDocumentProxy>;
disableWorker?: boolean; };
}): { promise: Promise<PDFDocumentProxy> };
} }