mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 09:30:20 +00:00
fix(plugins): clean bundled extension lint tail
This commit is contained in:
@@ -21,7 +21,7 @@ export default definePluginEntry({
|
|||||||
catalog: {
|
catalog: {
|
||||||
order: "simple",
|
order: "simple",
|
||||||
run: async (ctx) => {
|
run: async (ctx) => {
|
||||||
const implicit = await resolveImplicitAnthropicVertexProvider({
|
const implicit = resolveImplicitAnthropicVertexProvider({
|
||||||
env: ctx.env,
|
env: ctx.env,
|
||||||
});
|
});
|
||||||
if (!implicit) {
|
if (!implicit) {
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await sdk.start();
|
sdk.start();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.logger.error(`diagnostics-otel: failed to start SDK: ${formatError(err)}`);
|
ctx.logger.error(`diagnostics-otel: failed to start SDK: ${formatError(err)}`);
|
||||||
throw err;
|
throw err;
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ export class DiffArtifactStore {
|
|||||||
id: string,
|
id: string,
|
||||||
fileName: ArtifactMetaFileName,
|
fileName: ArtifactMetaFileName,
|
||||||
context: string,
|
context: string,
|
||||||
): Promise<unknown | null> {
|
): Promise<unknown> {
|
||||||
try {
|
try {
|
||||||
const raw = await fs.readFile(this.metaFilePath(id, fileName), "utf8");
|
const raw = await fs.readFile(this.metaFilePath(id, fileName), "utf8");
|
||||||
return JSON.parse(raw) as unknown;
|
return JSON.parse(raw) as unknown;
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ export default defineBundledChannelEntry({
|
|||||||
});
|
});
|
||||||
api.on("subagent_delivery_target", async (event) => {
|
api.on("subagent_delivery_target", async (event) => {
|
||||||
const { handleFeishuSubagentDeliveryTarget } = await loadFeishuSubagentHooksModule();
|
const { handleFeishuSubagentDeliveryTarget } = await loadFeishuSubagentHooksModule();
|
||||||
return await handleFeishuSubagentDeliveryTarget(event);
|
return handleFeishuSubagentDeliveryTarget(event);
|
||||||
});
|
});
|
||||||
api.on("subagent_ended", async (event) => {
|
api.on("subagent_ended", async (event) => {
|
||||||
const { handleFeishuSubagentEnded } = await loadFeishuSubagentHooksModule();
|
const { handleFeishuSubagentEnded } = await loadFeishuSubagentHooksModule();
|
||||||
await handleFeishuSubagentEnded(event);
|
handleFeishuSubagentEnded(event);
|
||||||
});
|
});
|
||||||
registerFeishuDocTools(api);
|
registerFeishuDocTools(api);
|
||||||
registerFeishuChatTools(api);
|
registerFeishuChatTools(api);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const CONTROL_CHARS_RE = /[\u0000-\u001f\u007f]/;
|
const CONTROL_CHARS_RE = /\p{Cc}/u;
|
||||||
const MAX_EXTERNAL_KEY_LENGTH = 512;
|
const MAX_EXTERNAL_KEY_LENGTH = 512;
|
||||||
|
|
||||||
export function normalizeFeishuExternalKey(value: unknown): string | undefined {
|
export function normalizeFeishuExternalKey(value: unknown): string | undefined {
|
||||||
|
|||||||
@@ -1730,7 +1730,8 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
|
|||||||
unregisterInteractions?.();
|
unregisterInteractions?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slashShutdownCleanup) {
|
const slashShutdownCleanupPromise = slashShutdownCleanup;
|
||||||
await slashShutdownCleanup;
|
if (slashShutdownCleanupPromise) {
|
||||||
|
await Promise.resolve(slashShutdownCleanupPromise);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -726,47 +726,71 @@ export class MemoryIndexManager extends MemoryManagerEmbeddingOps implements Mem
|
|||||||
sessionFiles?: string[];
|
sessionFiles?: string[];
|
||||||
progress?: (update: MemorySyncProgressUpdate) => void;
|
progress?: (update: MemorySyncProgressUpdate) => void;
|
||||||
}): Promise<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 = {
|
const state: MemoryReadonlyRecoveryState = {
|
||||||
get closed() {
|
get closed() {
|
||||||
return thisManager.closed;
|
return getClosed();
|
||||||
},
|
},
|
||||||
get db() {
|
get db() {
|
||||||
return thisManager.db;
|
return getDb();
|
||||||
},
|
},
|
||||||
set db(value) {
|
set db(value) {
|
||||||
thisManager.db = value;
|
setDb(value);
|
||||||
},
|
},
|
||||||
get vectorReady() {
|
get vectorReady() {
|
||||||
return thisManager.vectorReady;
|
return getVectorReady();
|
||||||
},
|
},
|
||||||
set vectorReady(value) {
|
set vectorReady(value) {
|
||||||
thisManager.vectorReady = value;
|
setVectorReady(value);
|
||||||
},
|
},
|
||||||
vector: this.vector,
|
vector: this.vector,
|
||||||
get readonlyRecoveryAttempts() {
|
get readonlyRecoveryAttempts() {
|
||||||
return thisManager.readonlyRecoveryAttempts;
|
return getReadonlyRecoveryAttempts();
|
||||||
},
|
},
|
||||||
set readonlyRecoveryAttempts(value) {
|
set readonlyRecoveryAttempts(value) {
|
||||||
thisManager.readonlyRecoveryAttempts = value;
|
setReadonlyRecoveryAttempts(value);
|
||||||
},
|
},
|
||||||
get readonlyRecoverySuccesses() {
|
get readonlyRecoverySuccesses() {
|
||||||
return thisManager.readonlyRecoverySuccesses;
|
return getReadonlyRecoverySuccesses();
|
||||||
},
|
},
|
||||||
set readonlyRecoverySuccesses(value) {
|
set readonlyRecoverySuccesses(value) {
|
||||||
thisManager.readonlyRecoverySuccesses = value;
|
setReadonlyRecoverySuccesses(value);
|
||||||
},
|
},
|
||||||
get readonlyRecoveryFailures() {
|
get readonlyRecoveryFailures() {
|
||||||
return thisManager.readonlyRecoveryFailures;
|
return getReadonlyRecoveryFailures();
|
||||||
},
|
},
|
||||||
set readonlyRecoveryFailures(value) {
|
set readonlyRecoveryFailures(value) {
|
||||||
thisManager.readonlyRecoveryFailures = value;
|
setReadonlyRecoveryFailures(value);
|
||||||
},
|
},
|
||||||
get readonlyRecoveryLastError() {
|
get readonlyRecoveryLastError() {
|
||||||
return thisManager.readonlyRecoveryLastError;
|
return getReadonlyRecoveryLastError();
|
||||||
},
|
},
|
||||||
set readonlyRecoveryLastError(value) {
|
set readonlyRecoveryLastError(value) {
|
||||||
thisManager.readonlyRecoveryLastError = value;
|
setReadonlyRecoveryLastError(value);
|
||||||
},
|
},
|
||||||
runSync: (nextParams) => this.runSync(nextParams),
|
runSync: (nextParams) => this.runSync(nextParams),
|
||||||
openDatabase: () => this.openDatabase(),
|
openDatabase: () => this.openDatabase(),
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ export function buildFoundryV1BaseUrl(endpoint: string): string {
|
|||||||
export function resolveFoundryApi(
|
export function resolveFoundryApi(
|
||||||
modelId: string,
|
modelId: string,
|
||||||
modelNameHint?: string | null,
|
modelNameHint?: string | null,
|
||||||
configuredApi?: ModelApi | string | null,
|
configuredApi?: ModelApi | null,
|
||||||
): FoundryProviderApi {
|
): FoundryProviderApi {
|
||||||
if (isFoundryProviderApi(configuredApi)) {
|
if (isFoundryProviderApi(configuredApi)) {
|
||||||
return configuredApi;
|
return configuredApi;
|
||||||
@@ -198,7 +198,7 @@ export function buildFoundryProviderBaseUrl(
|
|||||||
endpoint: string,
|
endpoint: string,
|
||||||
_modelId: string,
|
_modelId: string,
|
||||||
_modelNameHint?: string | null,
|
_modelNameHint?: string | null,
|
||||||
_configuredApi?: ModelApi | string | null,
|
_configuredApi?: ModelApi | null,
|
||||||
): string {
|
): string {
|
||||||
return buildFoundryV1BaseUrl(endpoint);
|
return buildFoundryV1BaseUrl(endpoint);
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,7 @@ export function extractFoundryEndpoint(baseUrl: string | null | undefined): stri
|
|||||||
export function buildFoundryModelCompat(
|
export function buildFoundryModelCompat(
|
||||||
modelId: string,
|
modelId: string,
|
||||||
modelNameHint?: string | null,
|
modelNameHint?: string | null,
|
||||||
configuredApi?: ModelApi | string | null,
|
configuredApi?: ModelApi | null,
|
||||||
): FoundryModelCompat | undefined {
|
): FoundryModelCompat | undefined {
|
||||||
const resolvedApi = resolveFoundryApi(modelId, modelNameHint, configuredApi);
|
const resolvedApi = resolveFoundryApi(modelId, modelNameHint, configuredApi);
|
||||||
const configuredModelName = resolveConfiguredModelNameHint(modelId, modelNameHint);
|
const configuredModelName = resolveConfiguredModelNameHint(modelId, modelNameHint);
|
||||||
@@ -234,7 +234,7 @@ export function buildFoundryModelCompat(
|
|||||||
export function resolveFoundryModelCapabilities(
|
export function resolveFoundryModelCapabilities(
|
||||||
modelId: string,
|
modelId: string,
|
||||||
modelNameHint?: string | null,
|
modelNameHint?: string | null,
|
||||||
configuredApi?: ModelApi | string | null,
|
configuredApi?: ModelApi | null,
|
||||||
existingInput?: unknown,
|
existingInput?: unknown,
|
||||||
): FoundryModelCapabilities {
|
): FoundryModelCapabilities {
|
||||||
const modelName = resolveConfiguredModelNameHint(modelId, modelNameHint) ?? modelId;
|
const modelName = resolveConfiguredModelNameHint(modelId, modelNameHint) ?? modelId;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const TEAMS_MAX_CHARS = 4000;
|
|||||||
*/
|
*/
|
||||||
const MAX_STREAM_AGE_MS = 45_000;
|
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 = {
|
export type TeamsStreamOptions = {
|
||||||
/** Function to send an activity (POST to Bot Framework). */
|
/** Function to send an activity (POST to Bot Framework). */
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const activeBuses = new Map<string, NostrBusHandle>();
|
|||||||
// Store metrics snapshots per account (for status reporting)
|
// Store metrics snapshots per account (for status reporting)
|
||||||
const metricsSnapshots = new Map<string, MetricsSnapshot>();
|
const metricsSnapshots = new Map<string, MetricsSnapshot>();
|
||||||
|
|
||||||
function normalizeNostrAllowEntry(entry: string): string | "*" | null {
|
function normalizeNostrAllowEntry(entry: string): string | null {
|
||||||
const trimmed = entry.trim();
|
const trimmed = entry.trim();
|
||||||
if (!trimmed) {
|
if (!trimmed) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -182,8 +182,7 @@ export async function publishProfileEvent(
|
|||||||
setTimeout(() => reject(new Error("timeout")), RELAY_PUBLISH_TIMEOUT_MS);
|
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);
|
successes.push(relay);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -169,7 +169,6 @@ class OpenShellSandboxBackendImpl {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
asHandle(): OpenShellSandboxBackend {
|
asHandle(): OpenShellSandboxBackend {
|
||||||
const self = this;
|
|
||||||
return {
|
return {
|
||||||
id: "openshell",
|
id: "openshell",
|
||||||
runtimeId: this.params.execContext.sandboxName,
|
runtimeId: this.params.execContext.sandboxName,
|
||||||
@@ -182,7 +181,7 @@ class OpenShellSandboxBackendImpl {
|
|||||||
remoteWorkspaceDir: this.params.remoteWorkspaceDir,
|
remoteWorkspaceDir: this.params.remoteWorkspaceDir,
|
||||||
remoteAgentWorkspaceDir: this.params.remoteAgentWorkspaceDir,
|
remoteAgentWorkspaceDir: this.params.remoteAgentWorkspaceDir,
|
||||||
buildExecSpec: async ({ command, workdir, env, usePty }) => {
|
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 {
|
return {
|
||||||
argv: pending.argv,
|
argv: pending.argv,
|
||||||
env: buildOpenShellSshExecEnv(),
|
env: buildOpenShellSshExecEnv(),
|
||||||
@@ -191,22 +190,22 @@ class OpenShellSandboxBackendImpl {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
finalizeExec: async ({ token }) => {
|
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 }) =>
|
createFsBridge: ({ sandbox }) =>
|
||||||
this.params.execContext.config.mode === "remote"
|
this.params.execContext.config.mode === "remote"
|
||||||
? createRemoteShellSandboxFsBridge({
|
? createRemoteShellSandboxFsBridge({
|
||||||
sandbox,
|
sandbox,
|
||||||
runtime: self.asHandle(),
|
runtime: this.asHandle(),
|
||||||
})
|
})
|
||||||
: createOpenShellFsBridge({
|
: createOpenShellFsBridge({
|
||||||
sandbox,
|
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) =>
|
syncLocalPathToRemote: async (localPath, remotePath) =>
|
||||||
await self.syncLocalPathToRemote(localPath, remotePath),
|
await this.syncLocalPathToRemote(localPath, remotePath),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export async function dispatchSynologyChatInboundTurn(params: {
|
|||||||
log?: SynologyChannelLog;
|
log?: SynologyChannelLog;
|
||||||
}): Promise<null> {
|
}): Promise<null> {
|
||||||
const rt = getSynologyRuntime();
|
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
|
// The Chat API user_id (for sending) may differ from the webhook
|
||||||
// user_id (used for sessions/pairing). Use chatUserId for API calls.
|
// user_id (used for sessions/pairing). Use chatUserId for API calls.
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function ensureNestedRecord(owner: Record<string, unknown>, key: string): Record
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sanitizeForLog(value: string): string {
|
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 {
|
function describeUnknownError(error: unknown): string {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export const telegramPairingText = {
|
|||||||
message: string;
|
message: string;
|
||||||
accountId?: string | null;
|
accountId?: string | null;
|
||||||
}) => {
|
}) => {
|
||||||
const resolveToken = await resolveTelegramTokenHelper();
|
const resolveToken = resolveTelegramTokenHelper();
|
||||||
const { token } = await resolveToken(cfg, { accountId });
|
const { token } = await resolveToken(cfg, { accountId });
|
||||||
if (!token) {
|
if (!token) {
|
||||||
throw new Error("telegram token not configured");
|
throw new Error("telegram token not configured");
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function asObjectRecord(value: unknown): Record<string, unknown> | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sanitizeForLog(value: string): string {
|
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 {
|
function hasLegacyZalouserGroupAllowAlias(value: unknown): boolean {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { TextStyle, type Style } from "./zca-constants.js";
|
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 InlineStyle = (typeof TextStyle)[keyof typeof TextStyle];
|
||||||
|
|
||||||
type LineStyle = {
|
type LineStyle = {
|
||||||
@@ -262,7 +265,7 @@ export function parseZalouserTextStyles(input: string): { text: string; styles:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (escapeMap.length > 0) {
|
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 }> = [];
|
const shifts: Array<{ pos: number; delta: number }> = [];
|
||||||
let cumulativeDelta = 0;
|
let cumulativeDelta = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user