fix(plugins): clean bundled extension lint tail

This commit is contained in:
Vincent Koc
2026-04-06 15:21:22 +01:00
parent 07b3ee813a
commit 620537914b
17 changed files with 69 additions and 43 deletions

View File

@@ -21,7 +21,7 @@ export default definePluginEntry({
catalog: {
order: "simple",
run: async (ctx) => {
const implicit = await resolveImplicitAnthropicVertexProvider({
const implicit = resolveImplicitAnthropicVertexProvider({
env: ctx.env,
});
if (!implicit) {

View File

@@ -141,7 +141,7 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
});
try {
await sdk.start();
sdk.start();
} catch (err) {
ctx.logger.error(`diagnostics-otel: failed to start SDK: ${formatError(err)}`);
throw err;

View File

@@ -298,7 +298,7 @@ export class DiffArtifactStore {
id: string,
fileName: ArtifactMetaFileName,
context: string,
): Promise<unknown | null> {
): Promise<unknown> {
try {
const raw = await fs.readFile(this.metaFilePath(id, fileName), "utf8");
return JSON.parse(raw) as unknown;

View File

@@ -81,11 +81,11 @@ export default defineBundledChannelEntry({
});
api.on("subagent_delivery_target", async (event) => {
const { handleFeishuSubagentDeliveryTarget } = await loadFeishuSubagentHooksModule();
return await handleFeishuSubagentDeliveryTarget(event);
return handleFeishuSubagentDeliveryTarget(event);
});
api.on("subagent_ended", async (event) => {
const { handleFeishuSubagentEnded } = await loadFeishuSubagentHooksModule();
await handleFeishuSubagentEnded(event);
handleFeishuSubagentEnded(event);
});
registerFeishuDocTools(api);
registerFeishuChatTools(api);

View File

@@ -1,4 +1,4 @@
const CONTROL_CHARS_RE = /[\u0000-\u001f\u007f]/;
const CONTROL_CHARS_RE = /\p{Cc}/u;
const MAX_EXTERNAL_KEY_LENGTH = 512;
export function normalizeFeishuExternalKey(value: unknown): string | undefined {

View File

@@ -1730,7 +1730,8 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
unregisterInteractions?.();
}
if (slashShutdownCleanup) {
await slashShutdownCleanup;
const slashShutdownCleanupPromise = slashShutdownCleanup;
if (slashShutdownCleanupPromise) {
await Promise.resolve(slashShutdownCleanupPromise);
}
}

View File

@@ -726,47 +726,71 @@ export class MemoryIndexManager extends MemoryManagerEmbeddingOps implements Mem
sessionFiles?: string[];
progress?: (update: MemorySyncProgressUpdate) => void;
}): Promise<void> {
const thisManager = this;
const getClosed = () => this.closed;
const getDb = () => this.db;
const setDb = (value: DatabaseSync) => {
this.db = value;
};
const getVectorReady = () => this.vectorReady;
const setVectorReady = (value: Promise<boolean> | null) => {
this.vectorReady = value;
};
const getReadonlyRecoveryAttempts = () => this.readonlyRecoveryAttempts;
const setReadonlyRecoveryAttempts = (value: number) => {
this.readonlyRecoveryAttempts = value;
};
const getReadonlyRecoverySuccesses = () => this.readonlyRecoverySuccesses;
const setReadonlyRecoverySuccesses = (value: number) => {
this.readonlyRecoverySuccesses = value;
};
const getReadonlyRecoveryFailures = () => this.readonlyRecoveryFailures;
const setReadonlyRecoveryFailures = (value: number) => {
this.readonlyRecoveryFailures = value;
};
const getReadonlyRecoveryLastError = () => this.readonlyRecoveryLastError;
const setReadonlyRecoveryLastError = (value: string | undefined) => {
this.readonlyRecoveryLastError = value;
};
const state: MemoryReadonlyRecoveryState = {
get closed() {
return thisManager.closed;
return getClosed();
},
get db() {
return thisManager.db;
return getDb();
},
set db(value) {
thisManager.db = value;
setDb(value);
},
get vectorReady() {
return thisManager.vectorReady;
return getVectorReady();
},
set vectorReady(value) {
thisManager.vectorReady = value;
setVectorReady(value);
},
vector: this.vector,
get readonlyRecoveryAttempts() {
return thisManager.readonlyRecoveryAttempts;
return getReadonlyRecoveryAttempts();
},
set readonlyRecoveryAttempts(value) {
thisManager.readonlyRecoveryAttempts = value;
setReadonlyRecoveryAttempts(value);
},
get readonlyRecoverySuccesses() {
return thisManager.readonlyRecoverySuccesses;
return getReadonlyRecoverySuccesses();
},
set readonlyRecoverySuccesses(value) {
thisManager.readonlyRecoverySuccesses = value;
setReadonlyRecoverySuccesses(value);
},
get readonlyRecoveryFailures() {
return thisManager.readonlyRecoveryFailures;
return getReadonlyRecoveryFailures();
},
set readonlyRecoveryFailures(value) {
thisManager.readonlyRecoveryFailures = value;
setReadonlyRecoveryFailures(value);
},
get readonlyRecoveryLastError() {
return thisManager.readonlyRecoveryLastError;
return getReadonlyRecoveryLastError();
},
set readonlyRecoveryLastError(value) {
thisManager.readonlyRecoveryLastError = value;
setReadonlyRecoveryLastError(value);
},
runSync: (nextParams) => this.runSync(nextParams),
openDatabase: () => this.openDatabase(),

View File

@@ -185,7 +185,7 @@ export function buildFoundryV1BaseUrl(endpoint: string): string {
export function resolveFoundryApi(
modelId: string,
modelNameHint?: string | null,
configuredApi?: ModelApi | string | null,
configuredApi?: ModelApi | null,
): FoundryProviderApi {
if (isFoundryProviderApi(configuredApi)) {
return configuredApi;
@@ -198,7 +198,7 @@ export function buildFoundryProviderBaseUrl(
endpoint: string,
_modelId: string,
_modelNameHint?: string | null,
_configuredApi?: ModelApi | string | null,
_configuredApi?: ModelApi | null,
): string {
return buildFoundryV1BaseUrl(endpoint);
}
@@ -217,7 +217,7 @@ export function extractFoundryEndpoint(baseUrl: string | null | undefined): stri
export function buildFoundryModelCompat(
modelId: string,
modelNameHint?: string | null,
configuredApi?: ModelApi | string | null,
configuredApi?: ModelApi | null,
): FoundryModelCompat | undefined {
const resolvedApi = resolveFoundryApi(modelId, modelNameHint, configuredApi);
const configuredModelName = resolveConfiguredModelNameHint(modelId, modelNameHint);
@@ -234,7 +234,7 @@ export function buildFoundryModelCompat(
export function resolveFoundryModelCapabilities(
modelId: string,
modelNameHint?: string | null,
configuredApi?: ModelApi | string | null,
configuredApi?: ModelApi | null,
existingInput?: unknown,
): FoundryModelCapabilities {
const modelName = resolveConfiguredModelNameHint(modelId, modelNameHint) ?? modelId;

View File

@@ -27,7 +27,7 @@ const TEAMS_MAX_CHARS = 4000;
*/
const MAX_STREAM_AGE_MS = 45_000;
type StreamSendFn = (activity: Record<string, unknown>) => Promise<{ id?: string } | unknown>;
type StreamSendFn = (activity: Record<string, unknown>) => Promise<unknown>;
export type TeamsStreamOptions = {
/** Function to send an activity (POST to Bot Framework). */

View File

@@ -43,7 +43,7 @@ const activeBuses = new Map<string, NostrBusHandle>();
// Store metrics snapshots per account (for status reporting)
const metricsSnapshots = new Map<string, MetricsSnapshot>();
function normalizeNostrAllowEntry(entry: string): string | "*" | null {
function normalizeNostrAllowEntry(entry: string): string | null {
const trimmed = entry.trim();
if (!trimmed) {
return null;

View File

@@ -182,8 +182,7 @@ export async function publishProfileEvent(
setTimeout(() => reject(new Error("timeout")), RELAY_PUBLISH_TIMEOUT_MS);
});
// oxlint-disable-next-line typescript/no-floating-promises
await Promise.race([pool.publish([relay], event), timeoutPromise]);
await Promise.race([...pool.publish([relay], event), timeoutPromise]);
successes.push(relay);
} catch (err) {

View File

@@ -169,7 +169,6 @@ class OpenShellSandboxBackendImpl {
) {}
asHandle(): OpenShellSandboxBackend {
const self = this;
return {
id: "openshell",
runtimeId: this.params.execContext.sandboxName,
@@ -182,7 +181,7 @@ class OpenShellSandboxBackendImpl {
remoteWorkspaceDir: this.params.remoteWorkspaceDir,
remoteAgentWorkspaceDir: this.params.remoteAgentWorkspaceDir,
buildExecSpec: async ({ command, workdir, env, usePty }) => {
const pending = await self.prepareExec({ command, workdir, env, usePty });
const pending = await this.prepareExec({ command, workdir, env, usePty });
return {
argv: pending.argv,
env: buildOpenShellSshExecEnv(),
@@ -191,22 +190,22 @@ class OpenShellSandboxBackendImpl {
};
},
finalizeExec: async ({ token }) => {
await self.finalizeExec(token as PendingExec | undefined);
await this.finalizeExec(token as PendingExec | undefined);
},
runShellCommand: async (command) => await self.runRemoteShellScript(command),
runShellCommand: async (command) => await this.runRemoteShellScript(command),
createFsBridge: ({ sandbox }) =>
this.params.execContext.config.mode === "remote"
? createRemoteShellSandboxFsBridge({
sandbox,
runtime: self.asHandle(),
runtime: this.asHandle(),
})
: createOpenShellFsBridge({
sandbox,
backend: self.asHandle(),
backend: this.asHandle(),
}),
runRemoteShellScript: async (command) => await self.runRemoteShellScript(command),
runRemoteShellScript: async (command) => await this.runRemoteShellScript(command),
syncLocalPathToRemote: async (localPath, remotePath) =>
await self.syncLocalPathToRemote(localPath, remotePath),
await this.syncLocalPathToRemote(localPath, remotePath),
};
}

View File

@@ -61,7 +61,7 @@ export async function dispatchSynologyChatInboundTurn(params: {
log?: SynologyChannelLog;
}): Promise<null> {
const rt = getSynologyRuntime();
const currentCfg = await rt.config.loadConfig();
const currentCfg = rt.config.loadConfig();
// The Chat API user_id (for sending) may differ from the webhook
// user_id (used for sessions/pairing). Use chatUserId for API calls.

View File

@@ -36,7 +36,7 @@ function ensureNestedRecord(owner: Record<string, unknown>, key: string): Record
}
function sanitizeForLog(value: string): string {
return value.replace(/[\u0000-\u001f\u007f]+/g, " ").trim();
return value.replace(/\p{Cc}+/gu, " ").trim();
}
function describeUnknownError(error: unknown): string {

View File

@@ -18,7 +18,7 @@ export const telegramPairingText = {
message: string;
accountId?: string | null;
}) => {
const resolveToken = await resolveTelegramTokenHelper();
const resolveToken = resolveTelegramTokenHelper();
const { token } = await resolveToken(cfg, { accountId });
if (!token) {
throw new Error("telegram token not configured");

View File

@@ -16,7 +16,7 @@ function asObjectRecord(value: unknown): Record<string, unknown> | null {
}
function sanitizeForLog(value: string): string {
return value.replace(/[\u0000-\u001f\u007f]+/g, " ").trim();
return value.replace(/\p{Cc}+/gu, " ").trim();
}
function hasLegacyZalouserGroupAllowAlias(value: unknown): boolean {

View File

@@ -1,5 +1,8 @@
import { TextStyle, type Style } from "./zca-constants.js";
const ESCAPE_SENTINEL_START = "\u0001";
const ESCAPE_SENTINEL_END = "\u0002";
type InlineStyle = (typeof TextStyle)[keyof typeof TextStyle];
type LineStyle = {
@@ -262,7 +265,7 @@ export function parseZalouserTextStyles(input: string): { text: string; styles:
}
if (escapeMap.length > 0) {
const escapeRegex = /\x01(\d+)\x02/g;
const escapeRegex = new RegExp(`${ESCAPE_SENTINEL_START}(\\d+)${ESCAPE_SENTINEL_END}`, "g");
const shifts: Array<{ pos: number; delta: number }> = [];
let cumulativeDelta = 0;