mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-20 21:23:23 +00:00
fix(plugins): clean fifth channel lint batch
This commit is contained in:
@@ -43,7 +43,7 @@ function createApi() {
|
||||
registerGatewayMethod,
|
||||
registerService,
|
||||
registerTool,
|
||||
}) as OpenClawPluginApi;
|
||||
});
|
||||
return { api, registerCli, registerGatewayMethod, registerService, registerTool };
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { danger, defaultRuntime, shortenHomePath } from "./core-api.js";
|
||||
|
||||
function runBrowserObserve(action: () => Promise<void>) {
|
||||
return runCommandWithRuntime(defaultRuntime, action, (err) => {
|
||||
defaultRuntime.error(danger(String(err as unknown)));
|
||||
defaultRuntime.error(danger(String(err)));
|
||||
defaultRuntime.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ type DebugContext = {
|
||||
|
||||
function runBrowserDebug(action: () => Promise<void>) {
|
||||
return runCommandWithRuntime(defaultRuntime, action, (err) => {
|
||||
defaultRuntime.error(danger(String(err as unknown)));
|
||||
defaultRuntime.error(danger(String(err)));
|
||||
defaultRuntime.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ async function runBrowserToggle(
|
||||
|
||||
function runBrowserCommand(action: () => Promise<void>) {
|
||||
return runCommandWithRuntime(defaultRuntime, action, (err) => {
|
||||
defaultRuntime.error(danger(String(err as unknown)));
|
||||
defaultRuntime.error(danger(String(err)));
|
||||
defaultRuntime.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ function parseOnOff(raw: string): boolean | null {
|
||||
|
||||
function runBrowserCommand(action: () => Promise<void>) {
|
||||
return runCommandWithRuntime(defaultRuntime, action, (err) => {
|
||||
defaultRuntime.error(danger(String(err as unknown)));
|
||||
defaultRuntime.error(danger(String(err)));
|
||||
defaultRuntime.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ export async function handleDiscordMessagingAction(
|
||||
: undefined;
|
||||
const withReactionRuntimeOptions = <T extends Record<string, unknown>>(extra?: T) => ({
|
||||
...(reactionRuntimeOptions ?? cfgOptions),
|
||||
...(extra ?? {}),
|
||||
...extra,
|
||||
});
|
||||
const normalizeMessage = (message: unknown) => {
|
||||
if (!message || typeof message !== "object") {
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
} from "./component-custom-id.js";
|
||||
// Some test-only module graphs partially mock `@buape/carbon` and can drop `Modal`.
|
||||
// Keep dynamic form definitions loadable instead of crashing unrelated suites.
|
||||
const ModalBase: typeof Modal = (Modal ?? class {}) as typeof Modal;
|
||||
const ModalBase: typeof Modal = Modal ?? class {};
|
||||
|
||||
export const DISCORD_COMPONENT_ATTACHMENT_PREFIX = "attachment://";
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export async function listDiscordDirectoryGroupsLive(
|
||||
if (!access) {
|
||||
return [];
|
||||
}
|
||||
const { token, query, accountId } = access;
|
||||
const { token, query } = access;
|
||||
const guilds = await listDiscordGuilds(token);
|
||||
const rows: ChannelDirectoryEntry[] = [];
|
||||
|
||||
|
||||
@@ -23,13 +23,11 @@ import {
|
||||
formatInboundEnvelope,
|
||||
resolveEnvelopeFormatOptions,
|
||||
} from "openclaw/plugin-sdk/channel-inbound";
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import type { DiscordAccountConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
|
||||
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
||||
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime";
|
||||
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
||||
import { createNonExitingRuntime, type RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
|
||||
import { createNonExitingRuntime } from "openclaw/plugin-sdk/runtime-env";
|
||||
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
||||
import { logDebug, logError } from "openclaw/plugin-sdk/text-runtime";
|
||||
import { resolveDiscordMaxLinesPerMessage } from "../accounts.js";
|
||||
@@ -38,7 +36,6 @@ import {
|
||||
parseDiscordModalCustomIdForCarbon,
|
||||
} from "../component-custom-id.js";
|
||||
import { resolveDiscordComponentEntry, resolveDiscordModalEntry } from "../components-registry.js";
|
||||
import type { DiscordComponentEntry, DiscordModalEntry } from "../components.js";
|
||||
import { type DiscordInteractiveHandlerContext } from "../interactive-dispatch.js";
|
||||
import { dispatchDiscordPluginInteractiveHandler } from "../interactive-dispatch.js";
|
||||
import { editDiscordComponentMessage } from "../send.components.js";
|
||||
@@ -46,8 +43,6 @@ import {
|
||||
AGENT_BUTTON_KEY,
|
||||
AGENT_SELECT_KEY,
|
||||
ackComponentInteraction,
|
||||
buildAgentButtonCustomId,
|
||||
buildAgentSelectCustomId,
|
||||
type AgentComponentContext,
|
||||
type AgentComponentInteraction,
|
||||
type AgentComponentMessageInteraction,
|
||||
@@ -69,7 +64,6 @@ import {
|
||||
resolveInteractionCustomId,
|
||||
resolveModalFieldValues,
|
||||
resolvePinnedMainDmOwnerFromAllowlist,
|
||||
type DiscordUser,
|
||||
} from "./agent-components-helpers.js";
|
||||
import {
|
||||
enqueueSystemEvent,
|
||||
@@ -77,7 +71,6 @@ import {
|
||||
resolveStorePath,
|
||||
} from "./agent-components.deps.runtime.js";
|
||||
import {
|
||||
type DiscordGuildEntryResolved,
|
||||
normalizeDiscordAllowList,
|
||||
resolveDiscordChannelConfigWithFallback,
|
||||
resolveDiscordGuildEntry,
|
||||
@@ -92,7 +85,6 @@ import { deliverDiscordReply } from "./reply-delivery.js";
|
||||
|
||||
let conversationRuntimePromise: Promise<typeof import("./agent-components.runtime.js")> | undefined;
|
||||
let componentsRuntimePromise: Promise<typeof import("../components.js")> | undefined;
|
||||
let replyRuntimePromise: Promise<typeof import("openclaw/plugin-sdk/reply-runtime")> | undefined;
|
||||
let replyPipelineRuntimePromise:
|
||||
| Promise<typeof import("openclaw/plugin-sdk/channel-reply-pipeline")>
|
||||
| undefined;
|
||||
@@ -108,10 +100,6 @@ async function loadComponentsRuntime() {
|
||||
return await componentsRuntimePromise;
|
||||
}
|
||||
|
||||
async function loadReplyRuntime() {
|
||||
replyRuntimePromise ??= import("openclaw/plugin-sdk/reply-runtime");
|
||||
return await replyRuntimePromise;
|
||||
}
|
||||
async function loadReplyPipelineRuntime() {
|
||||
replyPipelineRuntimePromise ??= import("openclaw/plugin-sdk/channel-reply-pipeline");
|
||||
return await replyPipelineRuntimePromise;
|
||||
|
||||
@@ -94,7 +94,7 @@ function sanitizeRecentModels(models: string[] | undefined, limit: number): stri
|
||||
}
|
||||
|
||||
async function readPreferencesStore(filePath: string): Promise<ModelPickerPreferencesStore> {
|
||||
const { value } = await readJsonFileWithFallback<ModelPickerPreferencesStore>(filePath, {
|
||||
const { value } = await readJsonFileWithFallback(filePath, {
|
||||
version: 1,
|
||||
entries: {},
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ function withImplicitComponentAttachmentBlock(
|
||||
...(spec.blocks ?? []),
|
||||
{
|
||||
type: "file",
|
||||
file: `attachment://${attachmentName}` as `attachment://${string}`,
|
||||
file: `attachment://${attachmentName}`,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -130,7 +130,7 @@ function createSpawnEvent(overrides?: {
|
||||
...overrides,
|
||||
requester: {
|
||||
...base.requester,
|
||||
...(overrides?.requester ?? {}),
|
||||
...overrides?.requester,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -71,9 +71,7 @@ export async function authorizeDiscordVoiceIngress(params: {
|
||||
};
|
||||
}
|
||||
|
||||
const channelAllowed = channelConfig
|
||||
? channelConfig.allowed !== false
|
||||
: !channelAllowlistConfigured;
|
||||
const channelAllowed = channelConfig ? channelConfig.allowed : !channelAllowlistConfigured;
|
||||
if (
|
||||
!isDiscordGroupAllowedByPolicy({
|
||||
groupPolicy,
|
||||
|
||||
@@ -202,7 +202,7 @@ export function createIMessageConversationBindingManager(params: {
|
||||
},
|
||||
unbindBySessionKey: (targetSessionKey) => {
|
||||
const removed: IMessageConversationBindingRecord[] = [];
|
||||
for (const record of [...getState().bindingsByAccountConversation.values()]) {
|
||||
for (const record of getState().bindingsByAccountConversation.values()) {
|
||||
if (record.accountId !== accountId || record.targetSessionKey !== targetSessionKey) {
|
||||
continue;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ export function createIMessageConversationBindingManager(params: {
|
||||
return removed;
|
||||
},
|
||||
stop: () => {
|
||||
for (const key of [...getState().bindingsByAccountConversation.keys()]) {
|
||||
for (const key of getState().bindingsByAccountConversation.keys()) {
|
||||
if (key.startsWith(`${accountId}:`)) {
|
||||
getState().bindingsByAccountConversation.delete(key);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
listLineAccountIds,
|
||||
resolveDefaultLineAccountId,
|
||||
resolveLineAccount,
|
||||
type OpenClawConfig,
|
||||
type ResolvedLineAccount,
|
||||
} from "./channel-api.js";
|
||||
|
||||
@@ -13,8 +12,7 @@ export function normalizeLineAllowFrom(entry: string): string {
|
||||
|
||||
export const lineConfigAdapter = createScopedChannelConfigAdapter<
|
||||
ResolvedLineAccount,
|
||||
ResolvedLineAccount,
|
||||
OpenClawConfig
|
||||
ResolvedLineAccount
|
||||
>({
|
||||
sectionKey: "line",
|
||||
listAccountIds: listLineAccountIds,
|
||||
|
||||
@@ -200,7 +200,7 @@ export const lineOutboundAdapter: NonNullable<ChannelPlugin<ResolvedLineAccount>
|
||||
}
|
||||
|
||||
for (const flexMsg of processed.flexMessages) {
|
||||
const flexContents = flexMsg.contents as Parameters<typeof sendFlex>[2];
|
||||
const flexContents = flexMsg.contents;
|
||||
lastResult = await sendFlex(to, flexMsg.altText, flexContents, {
|
||||
verbose: false,
|
||||
cfg,
|
||||
@@ -322,7 +322,7 @@ export const lineOutboundAdapter: NonNullable<ChannelPlugin<ResolvedLineAccount>
|
||||
result = { messageId: "processed", chatId: to };
|
||||
}
|
||||
for (const flexMsg of processed.flexMessages) {
|
||||
const flexContents = flexMsg.contents as Parameters<typeof sendFlex>[2];
|
||||
const flexContents = flexMsg.contents;
|
||||
await sendFlex(to, flexMsg.altText, flexContents, {
|
||||
verbose: false,
|
||||
cfg,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import ts from "typescript";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { bundledPluginRoot } from "../../../test/helpers/bundled-plugin-paths.js";
|
||||
import { loadRuntimeApiExportTypesViaJiti } from "../../../test/helpers/plugins/jiti-runtime-api.ts";
|
||||
import {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import { createMockIncomingRequest } from "../../../test/helpers/mock-incoming-request.js";
|
||||
import { createLineNodeWebhookHandler } from "./webhook-node.js";
|
||||
import { readLineWebhookRequestBody } from "./webhook-node.js";
|
||||
import { createLineWebhookMiddleware, startLineWebhook } from "./webhook.js";
|
||||
import { createLineWebhookMiddleware } from "./webhook.js";
|
||||
|
||||
const sign = (body: string, secret: string) =>
|
||||
crypto.createHmac("SHA256", secret).update(body).digest("base64");
|
||||
|
||||
Reference in New Issue
Block a user