mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 04:01:05 +00:00
fix(plugins): clean first channel lint batch
This commit is contained in:
@@ -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 [];
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user