style: format touched code

This commit is contained in:
Peter Steinberger
2026-04-22 04:23:27 +01:00
parent 2b09c3c7c7
commit b0734664f8
14 changed files with 33 additions and 24 deletions

View File

@@ -1,12 +1,12 @@
import fsPromises from "node:fs/promises";
import path from "node:path";
import { writeFileWithinRoot } from "openclaw/plugin-sdk/infra-runtime";
import type {
SandboxFsBridge,
SandboxFsStat,
SandboxResolvedPath,
} from "openclaw/plugin-sdk/sandbox";
import { createWritableRenameTargetResolver } from "openclaw/plugin-sdk/sandbox";
import { writeFileWithinRoot } from "openclaw/plugin-sdk/infra-runtime";
import type { OpenShellFsBridgeContext, OpenShellSandboxBackend } from "./backend.types.js";
import { movePathWithCopyFallback } from "./mirror.js";

View File

@@ -23,13 +23,13 @@ import {
} from "../../engine/approval/index.js";
import { getMessageApi, accountToCreds } from "../../engine/messaging/sender.js";
import type { ChatScope, InlineKeyboard, MessageResponse } from "../../engine/types.js";
import { ensurePlatformAdapter } from "../bootstrap.js";
import {
matchesQQBotApprovalAccount,
resolveQQBotExecApprovalConfig,
isQQBotExecApprovalClientEnabled,
shouldHandleQQBotExecApprovalRequest,
} from "../../exec-approvals.js";
import { ensurePlatformAdapter } from "../bootstrap.js";
import { resolveQQBotAccount } from "../config.js";
import { getBridgeLogger } from "../logger.js";

View File

@@ -17,7 +17,6 @@ interface QQBotChannelConfig extends QQBotAccountConfig {
defaultAccount?: string;
}
/** List all configured QQBot account IDs. */
export function listQQBotAccountIds(cfg: OpenClawConfig): string[] {
return listAccountIds(cfg as unknown as Record<string, unknown>);

View File

@@ -1,7 +1,3 @@
import {
resolveWhatsAppDirectSystemPrompt,
resolveWhatsAppGroupSystemPrompt,
} from "../../system-prompt.js";
import { getPrimaryIdentityId, getSelfIdentity, getSenderIdentity } from "../../identity.js";
import {
resolveWhatsAppCommandAuthorized,
@@ -10,6 +6,10 @@ import {
} from "../../inbound-policy.js";
import { newConnectionId } from "../../reconnect.js";
import { formatError } from "../../session.js";
import {
resolveWhatsAppDirectSystemPrompt,
resolveWhatsAppGroupSystemPrompt,
} from "../../system-prompt.js";
import { deliverWebReply } from "../deliver-reply.js";
import { whatsappInboundLog } from "../loggers.js";
import type { WebInboundMsg } from "../types.js";

View File

@@ -204,7 +204,8 @@ function trimBootstrapContent(
}
if (headChars === 0 && tailChars === 0 && trimmed.length > 0) {
const singleHeadMarker = resolvedMarkerTemplate(1, 0);
const singleHeadLength = 1 + singleHeadMarker.length + separatorCharsFor(1, 0, singleHeadMarker);
const singleHeadLength =
1 + singleHeadMarker.length + separatorCharsFor(1, 0, singleHeadMarker);
if (singleHeadLength <= maxChars) {
headChars = 1;
marker = singleHeadMarker;

View File

@@ -70,8 +70,8 @@ import {
consumeCompactionSafeguardCancelReason,
setCompactionSafeguardCancelReason,
} from "../pi-hooks/compaction-safeguard-runtime.js";
import { applyPiCompactionSettingsFromConfig } from "../pi-settings.js";
import { createPreparedEmbeddedPiSettingsManager } from "../pi-project-settings.js";
import { applyPiCompactionSettingsFromConfig } from "../pi-settings.js";
import { createOpenClawCodingTools } from "../pi-tools.js";
import { wrapStreamFnTextTransforms } from "../plugin-text-transforms.js";
import { registerProviderStreamForModel } from "../provider-stream.js";

View File

@@ -25,7 +25,11 @@ describe("applyPiCompactionSettingsFromConfig", () => {
it("can restore reserveTokens after a simulated resource loader reload drops them below floor", () => {
const cfg = {
agents: { defaults: { compaction: { reserveTokensFloor: DEFAULT_PI_COMPACTION_RESERVE_TOKENS_FLOOR } } },
agents: {
defaults: {
compaction: { reserveTokensFloor: DEFAULT_PI_COMPACTION_RESERVE_TOKENS_FLOOR },
},
},
} as const;
let reserve = 16_384;
const keep = 20_000;

View File

@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import * as bootstrapCache from "../../agents/bootstrap-cache.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { MsgContext } from "../templating.js";
import * as bootstrapCache from "../../agents/bootstrap-cache.js";
import { maybeHandleResetCommand } from "./commands-reset.js";
import type { HandleCommandsParams } from "./commands-types.js";
import { parseInlineDirectives } from "./directive-handling.parse.js";

View File

@@ -2551,7 +2551,9 @@ describe("gateway server sessions", () => {
expect(deleted.ok).toBe(true);
expect(deleted.payload?.deleted).toBe(true);
expect(subagentLifecycleHookMocks.runSubagentEnded).toHaveBeenCalledTimes(1);
const event = (subagentLifecycleHookMocks.runSubagentEnded.mock.calls as unknown[][])[0]?.[0] as
const event = (
subagentLifecycleHookMocks.runSubagentEnded.mock.calls as unknown[][]
)[0]?.[0] as
| { targetKind?: string; targetSessionKey?: string; reason?: string; outcome?: string }
| undefined;
expect(event).toMatchObject({
@@ -2867,7 +2869,9 @@ describe("gateway server sessions", () => {
expect(reset.payload?.key).toBe("agent:main:subagent:worker");
expect(reset.payload?.entry.sessionId).not.toBe("sess-subagent");
expect(subagentLifecycleHookMocks.runSubagentEnded).toHaveBeenCalledTimes(1);
const event = (subagentLifecycleHookMocks.runSubagentEnded.mock.calls as unknown[][])[0]?.[0] as
const event = (
subagentLifecycleHookMocks.runSubagentEnded.mock.calls as unknown[][]
)[0]?.[0] as
| { targetKind?: string; targetSessionKey?: string; reason?: string; outcome?: string }
| undefined;
expect(event).toMatchObject({

View File

@@ -120,8 +120,7 @@ function isSharedSecretLoopbackLocalEquivalent(params: {
sharedAuthOk: boolean;
authMethod: GatewayAuthResult["method"];
}): boolean {
const usesSharedSecretAuth =
params.authMethod === "token" || params.authMethod === "password";
const usesSharedSecretAuth = params.authMethod === "token" || params.authMethod === "password";
return (
params.sharedAuthOk &&
usesSharedSecretAuth &&

View File

@@ -226,10 +226,7 @@ function splitShellPipeline(command: string): { ok: boolean; reason?: string; se
} else {
const continued = stripUnquotedHeredocLineContinuation(line);
unquotedHeredocLogicalChunks.push(continued.line);
if (
unquotedHeredocLogicalChunks.length >
MAX_UNQUOTED_HEREDOC_CONTINUATION_LINES
) {
if (unquotedHeredocLogicalChunks.length > MAX_UNQUOTED_HEREDOC_CONTINUATION_LINES) {
return {
ok: false,
reason: "heredoc continuation too long",

View File

@@ -1,3 +1,4 @@
import { resolveControlUiAuthHeader } from "./control-ui-auth.ts";
import {
loadChannels,
logoutWhatsApp,
@@ -5,7 +6,6 @@ import {
waitWhatsAppLogin,
type ChannelsState,
} from "./controllers/channels.ts";
import { resolveControlUiAuthHeader } from "./control-ui-auth.ts";
import { loadConfig, saveConfig, type ConfigState } from "./controllers/config.ts";
import type { NostrProfile } from "./types.ts";
import { createNostrProfileFormState } from "./views/channels.nostr-profile-form.ts";

View File

@@ -4,6 +4,7 @@ import { resetToolStream } from "./app-tool-stream.ts";
import type { ChatSideResult } from "./chat/side-result.ts";
import { executeSlashCommand } from "./chat/slash-command-executor.ts";
import { parseSlashCommand, refreshSlashCommands } from "./chat/slash-commands.ts";
import { resolveControlUiAuthHeader } from "./control-ui-auth.ts";
import {
abortChatRun,
loadChatHistory,
@@ -13,7 +14,6 @@ import {
} from "./controllers/chat.ts";
import { loadModels } from "./controllers/models.ts";
import { loadSessions, type SessionsState } from "./controllers/sessions.ts";
import { resolveControlUiAuthHeader } from "./control-ui-auth.ts";
import type { GatewayBrowserClient, GatewayHelloOk } from "./gateway.ts";
import { normalizeBasePath } from "./navigation.ts";
import { parseAgentSessionKey } from "./session-key.ts";
@@ -604,7 +604,10 @@ export async function refreshChatAvatar(host: ChatHost) {
setChatAvatarUrl(host, avatarUrl);
return;
}
const avatarRes = await fetch(avatarUrl, { method: "GET", headers: { Authorization: authHeader } });
const avatarRes = await fetch(avatarUrl, {
method: "GET",
headers: { Authorization: authHeader },
});
if (!avatarRes.ok) {
if (shouldApplyChatAvatarResult(host, requestVersion, sessionKey)) {
clearChatAvatarUrl(host);

View File

@@ -1,7 +1,6 @@
import { html, nothing } from "lit";
import { t } from "../i18n/index.ts";
import { refreshChat, refreshChatAvatar } from "./app-chat.ts";
import { resolveControlUiAuthToken } from "./control-ui-auth.ts";
import { syncUrlWithSessionKey } from "./app-settings.ts";
import type { AppViewState } from "./app-view-state.ts";
import {
@@ -13,6 +12,7 @@ import {
resolveSessionOptionGroups,
} from "./chat/session-controls.ts";
import { refreshSlashCommands } from "./chat/slash-commands.ts";
import { resolveControlUiAuthToken } from "./control-ui-auth.ts";
import { ChatState, loadChatHistory } from "./controllers/chat.ts";
import { loadSessions } from "./controllers/sessions.ts";
import { icons } from "./icons.ts";
@@ -44,7 +44,9 @@ type ChatRefreshHost = AppViewState & {
updateComplete?: Promise<unknown>;
};
export function resolveAssistantAttachmentAuthToken(state: Pick<AppViewState, "hello" | "settings" | "password">) {
export function resolveAssistantAttachmentAuthToken(
state: Pick<AppViewState, "hello" | "settings" | "password">,
) {
return resolveControlUiAuthToken(state);
}