fix(plugins): clean first channel lint batch

This commit is contained in:
Vincent Koc
2026-04-06 14:27:34 +01:00
parent 9afcbbec5e
commit c3edcfd46e
15 changed files with 23 additions and 53 deletions

View File

@@ -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[] = [];
@@ -82,7 +82,7 @@ export async function listDiscordDirectoryPeersLive(
if (!access) {
return [];
}
const { token, query, accountId } = access;
const { token, query } = access;
if (!query) {
return [];
}

View File

@@ -1,5 +1,4 @@
import type { ChannelDoctorLegacyConfigRule } from "openclaw/plugin-sdk/channel-contract";
import { resolveDiscordPreviewStreamMode } from "./preview-streaming.js";
function asObjectRecord(value: unknown): Record<string, unknown> | null {
return value && typeof value === "object" && !Array.isArray(value)

View File

@@ -30,7 +30,6 @@ import type {
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { logDebug, logError } from "openclaw/plugin-sdk/text-runtime";
import {
createDiscordNativeApprovalAdapter,
createDiscordApprovalCapability,
shouldHandleDiscordApprovalRequest,
} from "../approval-native.js";
@@ -198,15 +197,15 @@ class ExecApprovalActionRow extends Row<Button> {
ask?: string | null;
allowedDecisions?: readonly ExecApprovalDecision[];
}) {
super([
...buildExecApprovalActionDescriptors({
super(
buildExecApprovalActionDescriptors({
approvalCommandId: params.approvalId,
ask: params.ask,
allowedDecisions: params.allowedDecisions,
}).map(
(descriptor) => new ExecApprovalActionButton({ approvalId: params.approvalId, descriptor }),
),
]);
);
}
}
@@ -476,9 +475,7 @@ export class DiscordExecApprovalHandler {
this.runtime = createChannelNativeApprovalRuntime<
PendingApproval,
PreparedDeliveryTarget,
DiscordPendingDelivery,
ApprovalRequest,
ApprovalResolved
DiscordPendingDelivery
>({
label: "discord/exec-approvals",
clientDisplayName: "Discord Exec Approvals",
@@ -563,7 +560,7 @@ export class DiscordExecApprovalHandler {
},
};
},
deliverTarget: async ({ plannedTarget, preparedTarget, pendingContent, request }) => {
deliverTarget: async ({ plannedTarget, preparedTarget, pendingContent }) => {
const { rest, request: discordRequest } = createDiscordClient(
{ token: this.opts.token, accountId: this.opts.accountId },
this.opts.cfg,

View File

@@ -18,7 +18,6 @@ import {
recordPendingHistoryEntryIfEnabled,
type HistoryEntry,
} from "openclaw/plugin-sdk/reply-history";
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
import { logVerbose, shouldLogVerbose } from "openclaw/plugin-sdk/runtime-env";
import { getChildLogger } from "openclaw/plugin-sdk/runtime-env";
import { logDebug } from "openclaw/plugin-sdk/text-runtime";
@@ -272,9 +271,10 @@ function mergeFetchedDiscordMessage(base: Message, fetched: APIMessage): Message
globalName: mention.global_name ?? undefined,
}))
: undefined;
const baseReferencedMessage = (base as { referencedMessage?: object }).referencedMessage;
const referencedMessage = fetched.referenced_message
? ({
...((base as { referencedMessage?: object }).referencedMessage ?? {}),
...baseReferencedMessage,
...fetched.referenced_message,
mentionedUsers: Array.isArray(fetched.referenced_message.mentions)
? fetched.referenced_message.mentions.map((mention) => ({
@@ -288,18 +288,14 @@ function mergeFetchedDiscordMessage(base: Message, fetched: APIMessage): Message
fetched.referenced_message.mention_everyone ?? baseReferenced?.mentionedEveryone ?? false,
} satisfies Record<string, unknown>)
: (base as { referencedMessage?: Message }).referencedMessage;
const baseRawData = (base as { rawData?: Record<string, unknown> }).rawData;
const rawData = {
...((base as { rawData?: Record<string, unknown> }).rawData ?? {}),
message_snapshots:
fetched.message_snapshots ??
(base as { rawData?: { message_snapshots?: unknown } }).rawData?.message_snapshots,
...baseRawData,
message_snapshots: fetched.message_snapshots ?? baseRawData?.message_snapshots,
sticker_items:
(fetched as { sticker_items?: unknown }).sticker_items ??
(base as { rawData?: { sticker_items?: unknown } }).rawData?.sticker_items,
(fetched as { sticker_items?: unknown }).sticker_items ?? baseRawData?.sticker_items,
};
return {
...base,
...fetched,
return Object.assign(Object.create(Object.getPrototypeOf(base)), base, fetched, {
content: fetched.content ?? base.content,
attachments: fetched.attachments ?? base.attachments,
embeds: fetched.embeds ?? base.embeds,
@@ -312,7 +308,7 @@ function mergeFetchedDiscordMessage(base: Message, fetched: APIMessage): Message
mentionedEveryone: fetched.mention_everyone ?? base.mentionedEveryone,
referencedMessage,
rawData,
} as unknown as Message;
}) as Message;
}
async function hydrateDiscordMessageIfEmpty(params: {

View File

@@ -25,7 +25,6 @@ import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-runtime
import {
buildCommandTextFromArgs,
findCommandByNativeName,
listChatCommands,
parseCommandArgs,
resolveCommandArgChoices,
resolveCommandArgMenu,
@@ -53,7 +52,6 @@ import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
import { resolveDiscordMaxLinesPerMessage } from "../accounts.js";
import { chunkDiscordTextWithMode } from "../chunk.js";
import {
isDiscordGroupAllowedByPolicy,
normalizeDiscordAllowList,
normalizeDiscordSlug,
resolveDiscordChannelPolicyCommandAuthorizer,

View File

@@ -6,10 +6,8 @@ import { createStandardChannelSetupStatus } from "openclaw/plugin-sdk/setup-runt
import { formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
import {
inspectDiscordSetupAccount,
listDiscordSetupAccountIds,
resolveDiscordSetupAccountConfig,
} from "./setup-account-state.js";
import { discordSetupAdapter } from "./setup-adapter.js";
import {
createAccountScopedAllowFromSection,
createAccountScopedGroupAccessSection,

View File

@@ -10,12 +10,7 @@ import {
resolveDefaultDiscordSetupAccountId,
resolveDiscordSetupAccountConfig,
} from "./setup-account-state.js";
import {
createDiscordSetupWizardBase,
DISCORD_TOKEN_HELP_LINES,
parseDiscordAllowFromId,
setDiscordGuildChannelAllowlist,
} from "./setup-core.js";
import { createDiscordSetupWizardBase, parseDiscordAllowFromId } from "./setup-core.js";
import {
promptLegacyChannelAllowFromForAccount,
resolveEntriesWithOptionalToken,

View File

@@ -3,7 +3,6 @@ import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared";
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
import { sanitizeForPlainText } from "openclaw/plugin-sdk/outbound-runtime";
import { resolveOutboundSendDep } from "openclaw/plugin-sdk/outbound-runtime";
import { buildOutboundBaseSessionKey, type RoutePeer } from "openclaw/plugin-sdk/routing";
import {
createComputedAccountStatusAdapter,
@@ -32,7 +31,6 @@ import type { IMessageProbe } from "./probe.js";
import { imessageSetupAdapter } from "./setup-core.js";
import {
createIMessagePluginBase,
imessageConfigAdapter,
imessageSecurityAdapter,
imessageSetupWizard,
} from "./shared.js";

View File

@@ -18,11 +18,7 @@ import type {
ChannelSetupWizardTextInput,
} from "openclaw/plugin-sdk/setup-runtime";
import { formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
import {
listIMessageAccountIds,
resolveDefaultIMessageAccountId,
resolveIMessageAccount,
} from "./accounts.js";
import { resolveDefaultIMessageAccountId, resolveIMessageAccount } from "./accounts.js";
import { normalizeIMessageHandle } from "./targets.js";
const channel = "imessage" as const;

View File

@@ -4,7 +4,7 @@ import {
type ChannelSetupWizard,
} from "openclaw/plugin-sdk/setup";
import { detectBinary } from "openclaw/plugin-sdk/setup-tools";
import { listIMessageAccountIds, resolveIMessageAccount } from "./accounts.js";
import { resolveIMessageAccount } from "./accounts.js";
import {
createIMessageCliPathTextInput,
imessageCompletionNote,

View File

@@ -1,8 +1,6 @@
import { describeWebhookAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
import { hasLineCredentials, parseLineAllowFromId } from "./account-helpers.js";
import {
DEFAULT_ACCOUNT_ID,
normalizeAccountId,
resolveLineAccount,
type ChannelPlugin,
type OpenClawConfig,

View File

@@ -6,7 +6,6 @@ import {
createChannelApproverDmTargetResolver,
createChannelNativeOriginTargetResolver,
} from "openclaw/plugin-sdk/approval-native-runtime";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { ExecApprovalRequest, PluginApprovalRequest } from "openclaw/plugin-sdk/infra-runtime";
import { listSlackAccountIds } from "./accounts.js";
import { isSlackApprovalAuthorizedSender } from "./approval-auth.js";

View File

@@ -93,7 +93,7 @@ export function buildSlackInteractiveBlocks(interactive?: InteractiveReply): Sla
),
emoji: true,
},
options: block.options.map((option, choiceIndex) => ({
options: block.options.map((option) => ({
text: {
type: "plain_text",
text: truncateSlackText(option.label, SLACK_PLAIN_TEXT_MAX),

View File

@@ -15,7 +15,6 @@ import {
import { logError } from "openclaw/plugin-sdk/text-runtime";
import { slackNativeApprovalAdapter } from "../approval-native.js";
import {
getSlackExecApprovalApprovers,
isSlackExecApprovalClientEnabled,
normalizeSlackApproverId,
shouldHandleSlackExecApprovalRequest,
@@ -221,7 +220,7 @@ function buildSlackExpiredBlocks(request: ExecApprovalRequest): SlackBlock[] {
}
export class SlackExecApprovalHandler {
private readonly runtime: ExecApprovalChannelRuntime<ExecApprovalRequest, ExecApprovalResolved>;
private readonly runtime: ExecApprovalChannelRuntime;
private readonly opts: SlackExecApprovalHandlerOpts;
constructor(opts: SlackExecApprovalHandlerOpts) {
@@ -229,9 +228,7 @@ export class SlackExecApprovalHandler {
this.runtime = createChannelNativeApprovalRuntime<
SlackPendingApproval,
{ to: string; threadTs?: string },
SlackPendingDelivery,
ExecApprovalRequest,
ExecApprovalResolved
SlackPendingDelivery
>({
label: "slack/exec-approvals",
clientDisplayName: "Slack Exec Approvals",
@@ -267,7 +264,7 @@ export class SlackExecApprovalHandler {
: undefined,
},
}),
deliverTarget: async ({ preparedTarget, pendingContent, request }) => {
deliverTarget: async ({ preparedTarget, pendingContent }) => {
const message = await sendMessageSlack(preparedTarget.to, pendingContent.text, {
cfg: this.opts.cfg,
accountId: this.opts.accountId,

View File

@@ -16,11 +16,10 @@ import {
type ChannelSetupAdapter,
type ChannelSetupDmPolicy,
type ChannelSetupWizard,
type ChannelSetupWizardAllowFromEntry,
} from "openclaw/plugin-sdk/setup-runtime";
import { formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
import { inspectSlackAccount } from "./account-inspect.js";
import { listSlackAccountIds, resolveSlackAccount, type ResolvedSlackAccount } from "./accounts.js";
import { resolveSlackAccount } from "./accounts.js";
import {
buildSlackSetupLines,
isSlackSetupAccountConfigured,