From 0e85380e56345d21bab8242d09674c77ea8ad5ea Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 19 Feb 2026 14:26:04 +0100 Subject: [PATCH] style: format files and fix safe-bins e2e typing --- extensions/feishu/src/bot.ts | 4 +-- extensions/feishu/src/media.ts | 2 +- src/agents/pi-tools.safe-bins.e2e.test.ts | 3 ++- src/auto-reply/reply/stage-sandbox-media.ts | 4 +-- src/imessage/accounts.ts | 2 +- src/imessage/monitor/monitor-provider.ts | 2 +- src/infra/exec-approvals-allowlist.ts | 2 +- src/infra/exec-approvals-analysis.ts | 2 +- src/media-understanding/apply.ts | 14 +++++------ src/media-understanding/attachments.ts | 2 +- src/media-understanding/audio-preflight.ts | 2 +- src/media-understanding/runner.ts | 28 ++++++++++----------- 12 files changed, 34 insertions(+), 33 deletions(-) diff --git a/extensions/feishu/src/bot.ts b/extensions/feishu/src/bot.ts index 14b787d36d..621302debf 100644 --- a/extensions/feishu/src/bot.ts +++ b/extensions/feishu/src/bot.ts @@ -7,8 +7,6 @@ import { DEFAULT_GROUP_HISTORY_LIMIT, type HistoryEntry, } from "openclaw/plugin-sdk"; -import type { FeishuMessageContext, FeishuMediaInfo, ResolvedFeishuAccount } from "./types.js"; -import type { DynamicAgentCreationConfig } from "./types.js"; import { resolveFeishuAccount } from "./accounts.js"; import { createFeishuClient } from "./client.js"; import { tryRecordMessage } from "./dedup.js"; @@ -25,6 +23,8 @@ import { import { createFeishuReplyDispatcher } from "./reply-dispatcher.js"; import { getFeishuRuntime } from "./runtime.js"; import { getMessageFeishu, sendMessageFeishu } from "./send.js"; +import type { FeishuMessageContext, FeishuMediaInfo, ResolvedFeishuAccount } from "./types.js"; +import type { DynamicAgentCreationConfig } from "./types.js"; // --- Permission error extraction --- // Extract permission grant URL from Feishu API error response. diff --git a/extensions/feishu/src/media.ts b/extensions/feishu/src/media.ts index a614ee191a..bbe56bbb02 100644 --- a/extensions/feishu/src/media.ts +++ b/extensions/feishu/src/media.ts @@ -1,7 +1,7 @@ import fs from "fs"; -import { withTempDownloadPath, type ClawdbotConfig } from "openclaw/plugin-sdk"; import path from "path"; import { Readable } from "stream"; +import { withTempDownloadPath, type ClawdbotConfig } from "openclaw/plugin-sdk"; import { resolveFeishuAccount } from "./accounts.js"; import { createFeishuClient } from "./client.js"; import { normalizeFeishuExternalKey } from "./external-keys.js"; diff --git a/src/agents/pi-tools.safe-bins.e2e.test.ts b/src/agents/pi-tools.safe-bins.e2e.test.ts index 314d801c69..62487beb9c 100644 --- a/src/agents/pi-tools.safe-bins.e2e.test.ts +++ b/src/agents/pi-tools.safe-bins.e2e.test.ts @@ -187,7 +187,8 @@ describe("createOpenClawCodingTools safeBins", () => { try { const result = await execTool!.execute("call-oracle", { command, workdir: tmpDir }); const text = result.content.find((content) => content.type === "text")?.text ?? ""; - return { kind: "result" as const, status: result.details.status, text }; + const resultDetails = result.details as { status?: string }; + return { kind: "result" as const, status: resultDetails.status, text }; } catch (err) { return { kind: "error" as const, message: String(err) }; } diff --git a/src/auto-reply/reply/stage-sandbox-media.ts b/src/auto-reply/reply/stage-sandbox-media.ts index b8f1ff9b5b..6d88767353 100644 --- a/src/auto-reply/reply/stage-sandbox-media.ts +++ b/src/auto-reply/reply/stage-sandbox-media.ts @@ -2,10 +2,9 @@ import { spawn } from "node:child_process"; import fs from "node:fs/promises"; import path from "node:path"; import { fileURLToPath } from "node:url"; -import type { OpenClawConfig } from "../../config/config.js"; -import type { MsgContext, TemplateContext } from "../templating.js"; import { assertSandboxPath } from "../../agents/sandbox-paths.js"; import { ensureSandboxWorkspaceForSession } from "../../agents/sandbox.js"; +import type { OpenClawConfig } from "../../config/config.js"; import { logVerbose } from "../../globals.js"; import { normalizeScpRemoteHost } from "../../infra/scp-host.js"; import { @@ -14,6 +13,7 @@ import { } from "../../media/inbound-path-policy.js"; import { getMediaDir } from "../../media/store.js"; import { CONFIG_DIR } from "../../utils.js"; +import type { MsgContext, TemplateContext } from "../templating.js"; export async function stageSandboxMedia(params: { ctx: MsgContext; diff --git a/src/imessage/accounts.ts b/src/imessage/accounts.ts index c9c0447fee..6c812ee68a 100644 --- a/src/imessage/accounts.ts +++ b/src/imessage/accounts.ts @@ -1,6 +1,6 @@ +import { createAccountListHelpers } from "../channels/plugins/account-helpers.js"; import type { OpenClawConfig } from "../config/config.js"; import type { IMessageAccountConfig } from "../config/types.js"; -import { createAccountListHelpers } from "../channels/plugins/account-helpers.js"; import { normalizeAccountId } from "../routing/session-key.js"; export type ResolvedIMessageAccount = { diff --git a/src/imessage/monitor/monitor-provider.ts b/src/imessage/monitor/monitor-provider.ts index 80be651930..375ada6ac4 100644 --- a/src/imessage/monitor/monitor-provider.ts +++ b/src/imessage/monitor/monitor-provider.ts @@ -1,5 +1,4 @@ import fs from "node:fs/promises"; -import type { IMessagePayload, MonitorIMessageOpts } from "./types.js"; import { resolveHumanDelayConfig } from "../../agents/identity.js"; import { resolveTextChunkLimit } from "../../auto-reply/chunk.js"; import { hasControlCommand } from "../../auto-reply/command-detection.js"; @@ -46,6 +45,7 @@ import { } from "./inbound-processing.js"; import { parseIMessageNotification } from "./parse-notification.js"; import { normalizeAllowList, resolveRuntime } from "./runtime.js"; +import type { IMessagePayload, MonitorIMessageOpts } from "./types.js"; /** * Try to detect remote host from an SSH wrapper script like: diff --git a/src/infra/exec-approvals-allowlist.ts b/src/infra/exec-approvals-allowlist.ts index 249a885be5..b57f503de0 100644 --- a/src/infra/exec-approvals-allowlist.ts +++ b/src/infra/exec-approvals-allowlist.ts @@ -1,5 +1,4 @@ import path from "node:path"; -import type { ExecAllowlistEntry } from "./exec-approvals.js"; import { DEFAULT_SAFE_BINS, analyzeShellCommand, @@ -11,6 +10,7 @@ import { type CommandResolution, type ExecCommandSegment, } from "./exec-approvals-analysis.js"; +import type { ExecAllowlistEntry } from "./exec-approvals.js"; import { isTrustedSafeBinPath } from "./exec-safe-bin-trust.js"; function isPathLikeToken(value: string): boolean { diff --git a/src/infra/exec-approvals-analysis.ts b/src/infra/exec-approvals-analysis.ts index 29dd80aff4..2a197adbea 100644 --- a/src/infra/exec-approvals-analysis.ts +++ b/src/infra/exec-approvals-analysis.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; -import type { ExecAllowlistEntry } from "./exec-approvals.js"; import { splitShellArgs } from "../utils/shell-argv.js"; +import type { ExecAllowlistEntry } from "./exec-approvals.js"; import { expandHomePrefix } from "./home-dir.js"; export const DEFAULT_SAFE_BINS = ["jq", "cut", "uniq", "head", "tail", "tr", "wc"]; diff --git a/src/media-understanding/apply.ts b/src/media-understanding/apply.ts index 331122665b..5639b17fa8 100644 --- a/src/media-understanding/apply.ts +++ b/src/media-understanding/apply.ts @@ -1,13 +1,7 @@ import path from "node:path"; +import { finalizeInboundContext } from "../auto-reply/reply/inbound-context.js"; import type { MsgContext } from "../auto-reply/templating.js"; import type { OpenClawConfig } from "../config/config.js"; -import type { - MediaUnderstandingCapability, - MediaUnderstandingDecision, - MediaUnderstandingOutput, - MediaUnderstandingProvider, -} from "./types.js"; -import { finalizeInboundContext } from "../auto-reply/reply/inbound-context.js"; import { logVerbose, shouldLogVerbose } from "../globals.js"; import { extractFileContentFromSource, @@ -30,6 +24,12 @@ import { resolveMediaAttachmentLocalRoots, runCapability, } from "./runner.js"; +import type { + MediaUnderstandingCapability, + MediaUnderstandingDecision, + MediaUnderstandingOutput, + MediaUnderstandingProvider, +} from "./types.js"; export type ApplyMediaUnderstandingResult = { outputs: MediaUnderstandingOutput[]; diff --git a/src/media-understanding/attachments.ts b/src/media-understanding/attachments.ts index 62d7862734..ba09c96f28 100644 --- a/src/media-understanding/attachments.ts +++ b/src/media-understanding/attachments.ts @@ -3,7 +3,6 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; import type { MsgContext } from "../auto-reply/templating.js"; import type { MediaUnderstandingAttachmentsConfig } from "../config/types.tools.js"; -import type { MediaAttachment, MediaUnderstandingCapability } from "./types.js"; import { logVerbose, shouldLogVerbose } from "../globals.js"; import { isAbortError } from "../infra/unhandled-rejections.js"; import { fetchRemoteMedia, MediaFetchError } from "../media/fetch.js"; @@ -17,6 +16,7 @@ import { detectMime, getFileExtension, isAudioFileName, kindFromMime } from "../ import { buildRandomTempFilePath } from "../plugin-sdk/temp-path.js"; import { MediaUnderstandingSkipError } from "./errors.js"; import { fetchWithTimeout } from "./providers/shared.js"; +import type { MediaAttachment, MediaUnderstandingCapability } from "./types.js"; type MediaBufferResult = { buffer: Buffer; diff --git a/src/media-understanding/audio-preflight.ts b/src/media-understanding/audio-preflight.ts index 8d730eeaf7..c01ac51f58 100644 --- a/src/media-understanding/audio-preflight.ts +++ b/src/media-understanding/audio-preflight.ts @@ -1,6 +1,5 @@ import type { MsgContext } from "../auto-reply/templating.js"; import type { OpenClawConfig } from "../config/config.js"; -import type { MediaUnderstandingProvider } from "./types.js"; import { logVerbose, shouldLogVerbose } from "../globals.js"; import { isAudioAttachment } from "./attachments.js"; import { @@ -11,6 +10,7 @@ import { resolveMediaAttachmentLocalRoots, runCapability, } from "./runner.js"; +import type { MediaUnderstandingProvider } from "./types.js"; /** * Transcribes the first audio attachment BEFORE mention checking. diff --git a/src/media-understanding/runner.ts b/src/media-understanding/runner.ts index 48f781e3c8..ad7b28328d 100644 --- a/src/media-understanding/runner.ts +++ b/src/media-understanding/runner.ts @@ -2,26 +2,18 @@ import { constants as fsConstants } from "node:fs"; import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; -import type { MsgContext } from "../auto-reply/templating.js"; -import type { OpenClawConfig } from "../config/config.js"; -import type { - MediaUnderstandingConfig, - MediaUnderstandingModelConfig, -} from "../config/types.tools.js"; -import type { - MediaAttachment, - MediaUnderstandingCapability, - MediaUnderstandingDecision, - MediaUnderstandingModelDecision, - MediaUnderstandingOutput, - MediaUnderstandingProvider, -} from "./types.js"; import { resolveApiKeyForProvider } from "../agents/model-auth.js"; import { findModelInCatalog, loadModelCatalog, modelSupportsVision, } from "../agents/model-catalog.js"; +import type { MsgContext } from "../auto-reply/templating.js"; +import type { OpenClawConfig } from "../config/config.js"; +import type { + MediaUnderstandingConfig, + MediaUnderstandingModelConfig, +} from "../config/types.tools.js"; import { logVerbose, shouldLogVerbose } from "../globals.js"; import { mergeInboundPathRoots, @@ -56,6 +48,14 @@ import { runCliEntry, runProviderEntry, } from "./runner.entries.js"; +import type { + MediaAttachment, + MediaUnderstandingCapability, + MediaUnderstandingDecision, + MediaUnderstandingModelDecision, + MediaUnderstandingOutput, + MediaUnderstandingProvider, +} from "./types.js"; export type ActiveMediaModel = { provider: string;