refactor: trim qqbot internal types

This commit is contained in:
Peter Steinberger
2026-05-01 15:47:54 +01:00
parent 42584964ac
commit 0442417e1f
14 changed files with 23 additions and 23 deletions

View File

@@ -27,7 +27,7 @@ const DEFAULT_QUEUE_SNAPSHOT = {
senderPending: 0,
} as const;
export interface BuildFrameworkSlashContextInput {
interface BuildFrameworkSlashContextInput {
ctx: PluginCommandContext;
account: ResolvedQQBotAccount;
from: QQBotFromParseResult;

View File

@@ -19,11 +19,11 @@ import type { QQBotFromParseResult } from "./from-parser.js";
const UNEXPECTED_RESULT_TEXT = "⚠️ 命令返回了意外结果。";
export interface FrameworkSlashReply {
interface FrameworkSlashReply {
text: string;
}
export interface DispatchFrameworkSlashResultInput {
interface DispatchFrameworkSlashResultInput {
result: SlashCommandResult;
account: ResolvedQQBotAccount;
from: QQBotFromParseResult;

View File

@@ -5,7 +5,7 @@
* engine's `debugLog` so that all logs flow through the OpenClaw log system.
*/
export interface BridgeLogger {
interface BridgeLogger {
info: (msg: string) => void;
error: (msg: string) => void;
warn?: (msg: string) => void;

View File

@@ -23,7 +23,7 @@ import {
type QQBotGroupPolicy,
} from "./types.js";
export interface QQBotAccessInput extends EffectivePolicyInput {
interface QQBotAccessInput extends EffectivePolicyInput {
/** Whether the inbound originated in a group (or guild) chat. */
isGroup: boolean;
/** The raw inbound sender id as provided by the QQ event. */

View File

@@ -16,7 +16,7 @@ const DEFAULT_BASE_URL = "https://api.sgroup.qq.com";
const DEFAULT_TIMEOUT_MS = 30_000;
const FILE_UPLOAD_TIMEOUT_MS = 120_000;
export interface RequestOptions {
interface RequestOptions {
/** Request timeout override in milliseconds. */
timeoutMs?: number;
/** Body keys to redact in debug logs (e.g. `['file_data']`). */

View File

@@ -84,7 +84,7 @@ export class UploadDailyLimitExceededError extends Error {
}
/** Chunked-upload progress callback payload. */
export interface ChunkedUploadProgress {
interface ChunkedUploadProgress {
completedParts: number;
totalParts: number;
uploadedBytes: number;
@@ -92,7 +92,7 @@ export interface ChunkedUploadProgress {
}
/** Per-call options for {@link ChunkedMediaApi.uploadChunked}. */
export interface UploadChunkedOptions {
interface UploadChunkedOptions {
scope: ChatScope;
targetId: string;
fileType: MediaFileType;
@@ -110,7 +110,7 @@ export interface UploadChunkedOptions {
}
/** Configuration for the {@link ChunkedMediaApi} constructor. */
export interface ChunkedMediaApiConfig {
interface ChunkedMediaApiConfig {
logger?: EngineLogger;
/** Upload cache adapter (optional; omit to disable caching). */
uploadCache?: UploadCacheAdapter;

View File

@@ -42,7 +42,7 @@ export interface UploadCacheAdapter {
/** File name sanitizer — injected to avoid importing platform-specific utils. */
export type SanitizeFileNameFn = (name: string) => string;
export interface MediaApiConfig {
interface MediaApiConfig {
logger?: EngineLogger;
/** Upload cache adapter (optional, omit to disable caching). */
uploadCache?: UploadCacheAdapter;

View File

@@ -28,7 +28,7 @@ import {
} from "./routes.js";
import { TokenManager } from "./token.js";
export interface MessageApiConfig {
interface MessageApiConfig {
/** Whether the QQ Bot has markdown permission. */
markdownSupport: boolean;
/** Logger for diagnostics. */

View File

@@ -14,7 +14,7 @@ import type { EngineLogger } from "../types.js";
import { formatErrorMessage } from "../utils/format.js";
/** Standard retry policy with exponential or fixed backoff. */
export interface RetryPolicy {
interface RetryPolicy {
/** Maximum retry attempts (excluding the initial attempt). */
maxRetries: number;
/** Base delay in milliseconds. */
@@ -36,7 +36,7 @@ export interface RetryPolicy {
* the standard retry loop into a tight fixed-interval loop bounded
* only by the total timeout.
*/
export interface PersistentRetryPolicy {
interface PersistentRetryPolicy {
/** Total timeout in milliseconds for the persistent retry loop. */
timeoutMs: number;
/** Fixed interval between retries in milliseconds. */

View File

@@ -17,7 +17,7 @@ interface CachedToken {
appId: string;
}
export interface BackgroundRefreshOptions {
interface BackgroundRefreshOptions {
refreshAheadMs?: number;
randomOffsetMs?: number;
minRefreshIntervalMs?: number;

View File

@@ -12,7 +12,7 @@ import { DEFAULT_ACCOUNT_ID } from "./resolve.js";
// ---- Logout: clear all credential fields for an account ----
export interface ClearCredentialsResult {
interface ClearCredentialsResult {
nextCfg: Record<string, unknown>;
cleared: boolean;
changed: boolean;

View File

@@ -24,10 +24,10 @@ import { resolveAccountBase } from "./resolve.js";
* back to its built-in restricted palette.
* - `none`: deny all tools.
*/
export type GroupToolPolicy = "full" | "restricted" | "none";
type GroupToolPolicy = "full" | "restricted" | "none";
/** Per-group configuration — everything that may be overridden per group. */
export interface GroupConfig {
interface GroupConfig {
/** Whether the bot requires @mention to respond. Defaults to true. */
requireMention: boolean;
/**
@@ -225,7 +225,7 @@ export function resolveGroupName(
* (which depend on `agentId`, not on the group itself) and a
* pre-computed display name for logging.
*/
export interface GroupSettings {
interface GroupSettings {
/** Merged group config (specific > wildcard > defaults). */
config: GroupConfig;
/** Display name — `config.name` or the first 8 chars of the openid. */

View File

@@ -41,7 +41,7 @@ interface QQBotChannelConfig {
*
* The outer config.ts layer extends this with clientSecret / secretSource.
*/
export interface ResolvedAccountBase {
interface ResolvedAccountBase {
accountId: string;
name?: string;
enabled: boolean;
@@ -171,7 +171,7 @@ export function resolveAccountBase(
// ---- Account config apply ----
export interface ApplyAccountInput {
interface ApplyAccountInput {
appId?: string;
clientSecret?: string;
clientSecretFile?: string;
@@ -239,7 +239,7 @@ export function applyAccountConfig(
// ---- Account status helpers ----
/** Resolved account shape expected by isAccountConfigured / describeAccount. */
export interface AccountSnapshot {
interface AccountSnapshot {
accountId: string;
name?: string;
enabled: boolean;

View File

@@ -10,7 +10,7 @@ import { applyAccountConfig } from "./resolve.js";
import { DEFAULT_ACCOUNT_ID } from "./resolve.js";
/** Parse an inline "appId:clientSecret" token string. */
export function parseInlineToken(token: string): { appId: string; clientSecret: string } | null {
function parseInlineToken(token: string): { appId: string; clientSecret: string } | null {
const colonIdx = token.indexOf(":");
if (colonIdx <= 0 || colonIdx === token.length - 1) {
return null;
@@ -25,7 +25,7 @@ export function parseInlineToken(token: string): { appId: string; clientSecret:
return { appId, clientSecret };
}
export interface SetupInput {
interface SetupInput {
token?: string;
tokenFile?: string;
useEnv?: boolean;