chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -55,7 +55,9 @@ const SessionStatusToolSchema = Type.Object({
function formatApiKeySnippet(apiKey: string): string {
const compact = apiKey.replace(/\s+/g, "");
if (!compact) return "unknown";
if (!compact) {
return "unknown";
}
const edge = compact.length >= 12 ? 6 : 4;
const head = compact.slice(0, edge);
const tail = compact.slice(-edge);
@@ -69,7 +71,9 @@ function resolveModelAuthLabel(params: {
agentDir?: string;
}): string | undefined {
const resolvedProvider = params.provider?.trim();
if (!resolvedProvider) return undefined;
if (!resolvedProvider) {
return undefined;
}
const providerKey = normalizeProviderId(resolvedProvider);
const store = ensureAuthProfileStore(params.agentDir, {
@@ -126,7 +130,9 @@ function resolveSessionEntry(params: {
mainKey: string;
}): { key: string; entry: SessionEntry } | null {
const keyRaw = params.keyRaw.trim();
if (!keyRaw) return null;
if (!keyRaw) {
return null;
}
const internal = resolveInternalSessionKey({
key: keyRaw,
alias: params.alias,
@@ -149,7 +155,9 @@ function resolveSessionEntry(params: {
for (const key of candidates) {
const entry = params.store[key];
if (entry) return { key, entry };
if (entry) {
return { key, entry };
}
}
return null;
@@ -161,11 +169,17 @@ function resolveSessionKeyFromSessionId(params: {
agentId?: string;
}): string | null {
const trimmed = params.sessionId.trim();
if (!trimmed) return null;
if (!trimmed) {
return null;
}
const { store } = loadCombinedSessionStoreForGateway(params.cfg);
const match = Object.entries(store).find(([key, entry]) => {
if (entry?.sessionId !== trimmed) return false;
if (!params.agentId) return true;
if (entry?.sessionId !== trimmed) {
return false;
}
if (!params.agentId) {
return true;
}
return resolveAgentIdFromSessionKey(key) === params.agentId;
});
return match?.[0] ?? null;
@@ -186,8 +200,12 @@ async function resolveModelOverride(params: {
}
> {
const raw = params.raw.trim();
if (!raw) return { kind: "reset" };
if (raw.toLowerCase() === "default") return { kind: "reset" };
if (!raw) {
return { kind: "reset" };
}
if (raw.toLowerCase() === "default") {
return { kind: "reset" };
}
const configDefault = resolveDefaultModelForAgent({
cfg: params.cfg,
@@ -256,7 +274,9 @@ export function createSessionStatusTool(opts?: {
opts?.agentSessionKey ?? requestedKeyRaw,
);
const ensureAgentAccess = (targetAgentId: string) => {
if (targetAgentId === requesterAgentId) return;
if (targetAgentId === requesterAgentId) {
return;
}
// Gate cross-agent access behind tools.agentToAgent settings.
if (!a2aPolicy.enabled) {
throw new Error(