mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
chore(lint): enable additional cleanup rules
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
"eslint/no-useless-concat": "error",
|
||||
"eslint/no-useless-constructor": "error",
|
||||
"eslint/no-useless-rename": "error",
|
||||
"eslint/no-useless-return": "error",
|
||||
"eslint/no-unused-vars": "off",
|
||||
"eslint/no-warning-comments": "error",
|
||||
"eslint/no-unmodified-loop-condition": "error",
|
||||
@@ -72,6 +73,7 @@
|
||||
"typescript/no-extraneous-class": "error",
|
||||
"typescript/no-import-type-side-effects": "error",
|
||||
"typescript/no-meaningless-void-operator": "error",
|
||||
"typescript/no-inferrable-types": "error",
|
||||
"typescript/no-non-null-asserted-nullish-coalescing": "error",
|
||||
"typescript/no-unnecessary-qualifier": "error",
|
||||
"typescript/no-unnecessary-type-assertion": "error",
|
||||
@@ -112,6 +114,7 @@
|
||||
"unicorn/no-new-buffer": "error",
|
||||
"unicorn/no-thenable": "error",
|
||||
"unicorn/no-typeof-undefined": "error",
|
||||
"unicorn/no-unreadable-array-destructuring": "error",
|
||||
"unicorn/no-unnecessary-array-flat-depth": "error",
|
||||
"unicorn/no-unnecessary-array-splice-count": "error",
|
||||
"unicorn/no-unnecessary-slice-end": "error",
|
||||
|
||||
@@ -223,9 +223,7 @@ describe("cdp internal", () => {
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (replyToViewportCommandOrScreenshot(msg, socket, "FULL")) {
|
||||
return;
|
||||
}
|
||||
replyToViewportCommandOrScreenshot(msg, socket, "FULL");
|
||||
});
|
||||
wss = server.wss;
|
||||
const buf = await captureScreenshot({ wsUrl: server.wsUrl, fullPage: true });
|
||||
@@ -1060,9 +1058,7 @@ describe("cdp internal", () => {
|
||||
socket.send(JSON.stringify({ id: msg.id, result: { result: { value: {} } } }));
|
||||
return;
|
||||
}
|
||||
if (replyToViewportCommandOrScreenshot(msg, socket, "C")) {
|
||||
return;
|
||||
}
|
||||
replyToViewportCommandOrScreenshot(msg, socket, "C");
|
||||
});
|
||||
wss = server.wss;
|
||||
const buf = await captureScreenshot({ wsUrl: server.wsUrl, fullPage: true });
|
||||
|
||||
@@ -53,7 +53,9 @@ function matchInteractiveSnapshotLine(
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
const [, , roleRaw, name, suffix] = match;
|
||||
const roleRaw = match[2];
|
||||
const name = match[3];
|
||||
const suffix = match[4];
|
||||
if (roleRaw.startsWith("/")) {
|
||||
return null;
|
||||
}
|
||||
@@ -384,7 +386,9 @@ export function buildRoleSnapshotFromAiSnapshot(
|
||||
out.push(line);
|
||||
continue;
|
||||
}
|
||||
const [, , roleRaw, name, suffix] = match;
|
||||
const roleRaw = match[2];
|
||||
const name = match[3];
|
||||
const suffix = match[4];
|
||||
if (roleRaw.startsWith("/")) {
|
||||
out.push(line);
|
||||
continue;
|
||||
|
||||
@@ -1806,7 +1806,6 @@ export async function focusPageByTargetIdViaPlaywright(opts: {
|
||||
await send("Page.bringToFront");
|
||||
},
|
||||
});
|
||||
return;
|
||||
} catch {
|
||||
throw err;
|
||||
}
|
||||
|
||||
@@ -186,9 +186,8 @@ function createDeepgramRealtimeTranscriptionSession(
|
||||
case "Error":
|
||||
case "error":
|
||||
config.onError?.(new Error(readErrorDetail(event.error ?? event.message)));
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -898,11 +898,7 @@ function assignOtelModelContentAttributes(
|
||||
);
|
||||
}
|
||||
if (policy.systemPrompt) {
|
||||
assignOtelContentAttribute(
|
||||
attributes,
|
||||
"openclaw.content.system_prompt",
|
||||
content?.systemPrompt,
|
||||
);
|
||||
assignOtelContentAttribute(attributes, "openclaw.content.system_prompt", content?.systemPrompt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1475,13 +1471,10 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
|
||||
description: "Tool execution duration",
|
||||
},
|
||||
);
|
||||
const toolExecutionBlockedCounter = meter.createCounter(
|
||||
"openclaw.tool.execution.blocked",
|
||||
{
|
||||
unit: "1",
|
||||
description: "Tool executions blocked by policy or sandbox diagnostics",
|
||||
},
|
||||
);
|
||||
const toolExecutionBlockedCounter = meter.createCounter("openclaw.tool.execution.blocked", {
|
||||
unit: "1",
|
||||
description: "Tool executions blocked by policy or sandbox diagnostics",
|
||||
});
|
||||
const execProcessDurationHistogram = meter.createHistogram("openclaw.exec.duration_ms", {
|
||||
unit: "ms",
|
||||
description: "Exec process duration",
|
||||
@@ -3208,7 +3201,6 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
|
||||
return;
|
||||
case "model.failover":
|
||||
recordModelFailover(evt, metadata);
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
ctx.logger.error(
|
||||
|
||||
@@ -334,7 +334,9 @@ function modelCallLabels(evt: {
|
||||
};
|
||||
}
|
||||
|
||||
function modelFailoverLabels(evt: Extract<DiagnosticEventPayload, { type: "model.failover" }>): LabelSet {
|
||||
function modelFailoverLabels(
|
||||
evt: Extract<DiagnosticEventPayload, { type: "model.failover" }>,
|
||||
): LabelSet {
|
||||
return {
|
||||
from_model: lowCardinalityLabel(evt.fromModel),
|
||||
from_provider: lowCardinalityLabel(evt.fromProvider),
|
||||
@@ -429,7 +431,9 @@ function webhookLabels(
|
||||
};
|
||||
}
|
||||
|
||||
function sessionStuckLabels(evt: Extract<DiagnosticEventPayload, { type: "session.stuck" }>): LabelSet {
|
||||
function sessionStuckLabels(
|
||||
evt: Extract<DiagnosticEventPayload, { type: "session.stuck" }>,
|
||||
): LabelSet {
|
||||
return {
|
||||
reason: lowCardinalityLabel(evt.reason, "none"),
|
||||
state: evt.state,
|
||||
@@ -463,7 +467,9 @@ function livenessLabels(
|
||||
};
|
||||
}
|
||||
|
||||
function payloadLargeLabels(evt: Extract<DiagnosticEventPayload, { type: "payload.large" }>): LabelSet {
|
||||
function payloadLargeLabels(
|
||||
evt: Extract<DiagnosticEventPayload, { type: "payload.large" }>,
|
||||
): LabelSet {
|
||||
return {
|
||||
action: evt.action,
|
||||
channel: lowCardinalityLabel(evt.channel, "none"),
|
||||
@@ -981,9 +987,7 @@ function recordDiagnosticEvent(
|
||||
numericValue(evt.bytes),
|
||||
BYTE_BUCKETS,
|
||||
);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ const { GatewayIntents, GatewayPlugin } = vi.hoisted(() => {
|
||||
options: unknown;
|
||||
gatewayInfo: unknown;
|
||||
emitter = new TestEmitter();
|
||||
isConnecting: boolean = false;
|
||||
isConnecting = false;
|
||||
heartbeatInterval?: NodeJS.Timeout;
|
||||
firstHeartbeatTimeout?: NodeJS.Timeout;
|
||||
ws?: unknown;
|
||||
@@ -46,11 +46,7 @@ const { GatewayIntents, GatewayPlugin } = vi.hoisted(() => {
|
||||
|
||||
async registerClient(clientForTest: unknown): Promise<void> {}
|
||||
|
||||
connect(_resume = false): void {
|
||||
if (this.isConnecting) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
connect(_resume = false): void {}
|
||||
}
|
||||
|
||||
return { GatewayIntents, GatewayPlugin };
|
||||
|
||||
@@ -166,7 +166,6 @@ export function createDiscordGatewaySupervisor(params: {
|
||||
return;
|
||||
case "buffering":
|
||||
pending.push(event);
|
||||
return;
|
||||
}
|
||||
};
|
||||
emitter.on("error", onGatewayError);
|
||||
|
||||
@@ -347,7 +347,5 @@ export async function recordDiscordModelPickerRecentModel(params: {
|
||||
)
|
||||
.toSorted(comparePreferenceEntries);
|
||||
await Promise.all(scopedEntries.slice(limit).map((entry) => store.delete(entry.key)));
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,6 @@ async function deployDiscordCommands(params: {
|
||||
try {
|
||||
try {
|
||||
await params.client.deployCommands({ mode: "reconcile" });
|
||||
return;
|
||||
} catch (err) {
|
||||
if (isDiscordDeployDailyCreateLimit(err)) {
|
||||
params.runtime.log?.(
|
||||
|
||||
@@ -224,7 +224,6 @@ function createElevenLabsRealtimeTranscriptionSession(
|
||||
if (event.message_type?.includes("error")) {
|
||||
config.onError?.(new Error(readErrorDetail(event)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ async function insertBatch(
|
||||
blocks: FeishuDocxBlock[],
|
||||
firstLevelBlockIds: string[],
|
||||
parentBlockId: string = docToken,
|
||||
index: number = -1,
|
||||
index = -1,
|
||||
): Promise<FeishuDocxBlockChild[]> {
|
||||
const descendants = cleanBlocksForDescendant(blocks);
|
||||
|
||||
@@ -137,7 +137,7 @@ export async function insertBlocksInBatches(
|
||||
firstLevelBlockIds: string[],
|
||||
logger?: Logger,
|
||||
parentBlockId: string = docToken,
|
||||
startIndex: number = -1,
|
||||
startIndex = -1,
|
||||
): Promise<{ children: FeishuDocxBlockChild[]; skipped: string[] }> {
|
||||
const allChildren: FeishuDocxBlockChild[] = [];
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ export async function insertTableRow(
|
||||
client: Lark.Client,
|
||||
docToken: string,
|
||||
blockId: string,
|
||||
rowIndex: number = -1,
|
||||
rowIndex = -1,
|
||||
) {
|
||||
const res = await client.docx.documentBlock.patch({
|
||||
path: { document_id: docToken, block_id: blockId },
|
||||
@@ -238,7 +238,7 @@ export async function insertTableColumn(
|
||||
client: Lark.Client,
|
||||
docToken: string,
|
||||
blockId: string,
|
||||
columnIndex: number = -1,
|
||||
columnIndex = -1,
|
||||
) {
|
||||
const res = await client.docx.documentBlock.patch({
|
||||
path: { document_id: docToken, block_id: blockId },
|
||||
@@ -255,7 +255,7 @@ export async function deleteTableRows(
|
||||
docToken: string,
|
||||
blockId: string,
|
||||
rowStart: number,
|
||||
rowCount: number = 1,
|
||||
rowCount = 1,
|
||||
) {
|
||||
const res = await client.docx.documentBlock.patch({
|
||||
path: { document_id: docToken, block_id: blockId },
|
||||
@@ -272,7 +272,7 @@ export async function deleteTableColumns(
|
||||
docToken: string,
|
||||
blockId: string,
|
||||
columnStart: number,
|
||||
columnCount: number = 1,
|
||||
columnCount = 1,
|
||||
) {
|
||||
const res = await client.docx.documentBlock.patch({
|
||||
path: { document_id: docToken, block_id: blockId },
|
||||
|
||||
@@ -88,11 +88,7 @@ describe("createSequentialQueue", () => {
|
||||
await new Promise<void>((resolve) => setImmediate(resolve));
|
||||
expect(unhandled).toStrictEqual([]);
|
||||
|
||||
await expect(
|
||||
enqueue("feishu:default:chat-1", async () => {
|
||||
return;
|
||||
}),
|
||||
).resolves.toBeUndefined();
|
||||
await expect(enqueue("feishu:default:chat-1", async () => {})).resolves.toBeUndefined();
|
||||
} finally {
|
||||
process.off("unhandledRejection", onUnhandledRejection);
|
||||
}
|
||||
|
||||
@@ -2272,7 +2272,7 @@ describe("google-meet plugin", () => {
|
||||
expectRespondedOk(respond);
|
||||
expect(runCommandWithTimeout).not.toHaveBeenCalled();
|
||||
const openCall = callGatewayFromCli.mock.calls.find(
|
||||
([, , request]) => requireRecord(request, "browser request").path === "/tabs/open",
|
||||
(call) => requireRecord(call[2], "browser request").path === "/tabs/open",
|
||||
);
|
||||
if (!openCall) {
|
||||
throw new Error("Expected browser /tabs/open request");
|
||||
@@ -2287,7 +2287,7 @@ describe("google-meet plugin", () => {
|
||||
expect(openCall[3]).toEqual({ progress: false });
|
||||
expect(
|
||||
callGatewayFromCli.mock.calls.some(
|
||||
([, , request]) => (request as { path?: string }).path === "/permissions/grant",
|
||||
(call) => (call[2] as { path?: string }).path === "/permissions/grant",
|
||||
),
|
||||
).toBe(false);
|
||||
const payload = requireRespondPayload(respond, "join response payload");
|
||||
@@ -2305,7 +2305,7 @@ describe("google-meet plugin", () => {
|
||||
expect(transcriptLine.speaker).toBe("Alice");
|
||||
expect(transcriptLine.text).toBe("Can everyone hear the agent?");
|
||||
const actCall = callGatewayFromCli.mock.calls.find(
|
||||
([, , request]) => (request as { path?: string }).path === "/act",
|
||||
(call) => (call[2] as { path?: string }).path === "/act",
|
||||
);
|
||||
expect(String((actCall?.[2] as { body?: { fn?: string } } | undefined)?.body?.fn)).toContain(
|
||||
"const allowMicrophone = false",
|
||||
@@ -2351,7 +2351,7 @@ describe("google-meet plugin", () => {
|
||||
|
||||
expectRespondedOk(respond);
|
||||
const grantCall = callGatewayFromCli.mock.calls.find(
|
||||
([, , request]) => requireRecord(request, "browser request").path === "/permissions/grant",
|
||||
(call) => requireRecord(call[2], "browser request").path === "/permissions/grant",
|
||||
);
|
||||
if (!grantCall) {
|
||||
throw new Error("Expected browser /permissions/grant request");
|
||||
@@ -2643,7 +2643,7 @@ describe("google-meet plugin", () => {
|
||||
expect(status.session?.chrome?.health?.transcriptLines).toBe(1);
|
||||
expect(status.session?.chrome?.health?.lastCaptionText).toBe("Please capture this.");
|
||||
const focusCall = callGatewayFromCli.mock.calls.find(
|
||||
([, , request]) => requireRecord(request, "browser request").path === "/tabs/focus",
|
||||
(call) => requireRecord(call[2], "browser request").path === "/tabs/focus",
|
||||
);
|
||||
if (!focusCall) {
|
||||
throw new Error("Expected browser /tabs/focus request");
|
||||
@@ -3447,7 +3447,7 @@ describe("google-meet plugin", () => {
|
||||
expect(browser.manualActionRequired).toBe(true);
|
||||
expect(browser.manualActionReason).toBe("meet-admission-required");
|
||||
const focusCall = callGatewayFromCli.mock.calls.find(
|
||||
([, , request]) => requireRecord(request, "browser request").path === "/tabs/focus",
|
||||
(call) => requireRecord(call[2], "browser request").path === "/tabs/focus",
|
||||
);
|
||||
if (!focusCall) {
|
||||
throw new Error("Expected browser /tabs/focus request");
|
||||
|
||||
@@ -770,10 +770,6 @@ class GoogleRealtimeVoiceBridge implements RealtimeVoiceBridge {
|
||||
this.config.onTranscript?.("assistant", part.text, content.turnComplete ?? false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!emittedAssistantText && content.turnComplete && content.waitingForInput === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private handleToolCall(toolCall: LiveServerToolCall): void {
|
||||
|
||||
@@ -1955,7 +1955,6 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
|
||||
logVerboseMessage(
|
||||
`mattermost: drop post (dedupe account=${account.accountId} ids=${allMessageIds.length})`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1978,7 +1978,7 @@ describe("memory cli", () => {
|
||||
});
|
||||
});
|
||||
|
||||
async function waitFor<T>(task: () => Promise<T>, timeoutMs: number = 1500): Promise<T> {
|
||||
async function waitFor<T>(task: () => Promise<T>, timeoutMs = 1500): Promise<T> {
|
||||
let value: T | undefined;
|
||||
await vi.waitFor(
|
||||
async () => {
|
||||
|
||||
@@ -91,7 +91,6 @@ export async function runMemorySyncWithReadonlyRecovery(
|
||||
): Promise<void> {
|
||||
try {
|
||||
await state.runSync(params);
|
||||
return;
|
||||
} catch (err) {
|
||||
if (!isMemoryReadonlyDbError(err) || state.closed) {
|
||||
throw err;
|
||||
|
||||
@@ -36,12 +36,7 @@ function createMockChild(params?: { autoClose?: boolean }): MockChild {
|
||||
return child;
|
||||
}
|
||||
|
||||
function emitAndClose(
|
||||
child: MockChild,
|
||||
stream: "stdout" | "stderr",
|
||||
data: string,
|
||||
code: number = 0,
|
||||
) {
|
||||
function emitAndClose(child: MockChild, stream: "stdout" | "stderr", data: string, code = 0) {
|
||||
queueMicrotask(() => {
|
||||
child[stream].emit("data", data);
|
||||
child.closeWith(code);
|
||||
|
||||
@@ -84,12 +84,7 @@ function createMockChild(params?: { autoClose?: boolean; closeDelayMs?: number }
|
||||
return child;
|
||||
}
|
||||
|
||||
function emitAndClose(
|
||||
child: MockChild,
|
||||
stream: "stdout" | "stderr",
|
||||
data: string,
|
||||
code: number = 0,
|
||||
) {
|
||||
function emitAndClose(child: MockChild, stream: "stdout" | "stderr", data: string, code = 0) {
|
||||
queueMicrotask(() => {
|
||||
child[stream].emit("data", data);
|
||||
child.closeWith(code);
|
||||
|
||||
@@ -147,7 +147,7 @@ type SearchManager = NonNullable<SearchManagerResult["manager"]>;
|
||||
|
||||
function createQmdCfg(
|
||||
agentId: string,
|
||||
workspace: string = "/tmp/workspace",
|
||||
workspace = "/tmp/workspace",
|
||||
qmd: Record<string, unknown> = {},
|
||||
): OpenClawConfig {
|
||||
return {
|
||||
|
||||
@@ -38,7 +38,7 @@ function collectWikiResultPaths(results: readonly { corpus: string; path: string
|
||||
return paths;
|
||||
}
|
||||
|
||||
async function waitFor<T>(task: () => Promise<T>, timeoutMs: number = 1500): Promise<T> {
|
||||
async function waitFor<T>(task: () => Promise<T>, timeoutMs = 1500): Promise<T> {
|
||||
let value: T | undefined;
|
||||
await vi.waitFor(
|
||||
async () => {
|
||||
|
||||
@@ -61,7 +61,7 @@ function applyMinimaxApiConfigWithBaseUrl(
|
||||
|
||||
export function applyMinimaxApiProviderConfig(
|
||||
cfg: OpenClawConfig,
|
||||
modelId: string = "MiniMax-M2.7",
|
||||
modelId = "MiniMax-M2.7",
|
||||
): OpenClawConfig {
|
||||
return applyMinimaxApiProviderConfigWithBaseUrl(cfg, {
|
||||
providerId: "minimax",
|
||||
@@ -72,7 +72,7 @@ export function applyMinimaxApiProviderConfig(
|
||||
|
||||
export function applyMinimaxApiConfig(
|
||||
cfg: OpenClawConfig,
|
||||
modelId: string = "MiniMax-M2.7",
|
||||
modelId = "MiniMax-M2.7",
|
||||
): OpenClawConfig {
|
||||
return applyMinimaxApiConfigWithBaseUrl(cfg, {
|
||||
providerId: "minimax",
|
||||
@@ -83,7 +83,7 @@ export function applyMinimaxApiConfig(
|
||||
|
||||
export function applyMinimaxApiProviderConfigCn(
|
||||
cfg: OpenClawConfig,
|
||||
modelId: string = "MiniMax-M2.7",
|
||||
modelId = "MiniMax-M2.7",
|
||||
): OpenClawConfig {
|
||||
return applyMinimaxApiProviderConfigWithBaseUrl(cfg, {
|
||||
providerId: "minimax",
|
||||
@@ -94,7 +94,7 @@ export function applyMinimaxApiProviderConfigCn(
|
||||
|
||||
export function applyMinimaxApiConfigCn(
|
||||
cfg: OpenClawConfig,
|
||||
modelId: string = "MiniMax-M2.7",
|
||||
modelId = "MiniMax-M2.7",
|
||||
): OpenClawConfig {
|
||||
return applyMinimaxApiConfigWithBaseUrl(cfg, {
|
||||
providerId: "minimax",
|
||||
|
||||
@@ -200,9 +200,8 @@ function createMistralRealtimeTranscriptionSession(
|
||||
return;
|
||||
case "error":
|
||||
config.onError?.(new Error(readErrorDetail(event)));
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ describe("createMSTeamsReplyDispatcher", () => {
|
||||
let lastStreamMock: StreamMock | undefined;
|
||||
|
||||
function createDispatcher(
|
||||
conversationType: string = "personal",
|
||||
conversationType = "personal",
|
||||
msteamsConfig: Record<string, unknown> = {},
|
||||
extraParams: { onSentMessageIds?: (ids: string[]) => void } = {},
|
||||
) {
|
||||
|
||||
@@ -151,7 +151,6 @@ export function createTeamsReplyStreamController(params: {
|
||||
// Starting a reply is not enough to decide that native streaming should
|
||||
// own delivery. Wait for text tokens or explicit progress work so
|
||||
// no-token replies keep the normal block-delivery path.
|
||||
return;
|
||||
},
|
||||
|
||||
onPartialReply(payload: { text?: string }): void {
|
||||
|
||||
@@ -110,7 +110,6 @@ export async function monitorNextcloudTalkProvider(
|
||||
logger.warn(
|
||||
`[nextcloud-talk:${account.accountId}] replayed webhook ignored room=${message.roomToken} messageId=${message.messageId}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
},
|
||||
onMessage: async () => {},
|
||||
|
||||
@@ -218,11 +218,7 @@ export function createMetrics(onMetric?: OnMetricCallback): NostrMetrics {
|
||||
return relay;
|
||||
}
|
||||
|
||||
function emit(
|
||||
name: MetricName,
|
||||
value: number = 1,
|
||||
labels?: Record<string, string | number>,
|
||||
): void {
|
||||
function emit(name: MetricName, value = 1, labels?: Record<string, string | number>): void {
|
||||
// Fire callback if provided
|
||||
if (onMetric) {
|
||||
onMetric({
|
||||
|
||||
@@ -296,7 +296,7 @@ async function refreshAccessToken(
|
||||
}
|
||||
|
||||
async function createAuthorizationFlow(
|
||||
originator: string = "openclaw",
|
||||
originator = "openclaw",
|
||||
): Promise<{ verifier: string; redirectUri: string; state: string; url: string }> {
|
||||
const [{ verifier, challenge }, runtime] = await Promise.all([
|
||||
generatePKCE(),
|
||||
|
||||
@@ -199,11 +199,9 @@ function createOpenAIRealtimeTranscriptionSession(
|
||||
} else {
|
||||
config.onError?.(error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1161,11 +1161,9 @@ class OpenAIRealtimeVoiceBridge implements RealtimeVoiceBridge {
|
||||
return;
|
||||
}
|
||||
this.config.onError?.(new Error(detail));
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -375,15 +375,12 @@ export default definePluginEntry({
|
||||
tick().catch(() => {});
|
||||
}, 15_000);
|
||||
expiryInterval.unref?.();
|
||||
|
||||
return;
|
||||
},
|
||||
stop: async () => {
|
||||
if (expiryInterval) {
|
||||
clearInterval(expiryInterval);
|
||||
expiryInterval = null;
|
||||
}
|
||||
return;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ export async function sendVoice(
|
||||
ctx: MediaTargetContext,
|
||||
voicePath: string,
|
||||
directUploadFormats?: string[],
|
||||
transcodeEnabled: boolean = true,
|
||||
transcodeEnabled = true,
|
||||
): Promise<OutboundResult> {
|
||||
const resolvedMediaPath = resolveOutboundMediaPath(voicePath, "voice", {
|
||||
allowMissingLocalPath: true,
|
||||
|
||||
@@ -37,8 +37,8 @@ function loadSilkWasm(): Promise<SilkWasm | null> {
|
||||
export function pcmToWav(
|
||||
pcmData: Uint8Array,
|
||||
sampleRate: number,
|
||||
channels: number = 1,
|
||||
bitsPerSample: number = 16,
|
||||
channels = 1,
|
||||
bitsPerSample = 16,
|
||||
): Buffer {
|
||||
const byteRate = sampleRate * channels * (bitsPerSample / 8);
|
||||
const blockAlign = channels * (bitsPerSample / 8);
|
||||
@@ -275,8 +275,8 @@ export async function audioFileToSilkBase64(
|
||||
*/
|
||||
export async function waitForFile(
|
||||
filePath: string,
|
||||
timeoutMs: number = 30000,
|
||||
pollMs: number = 500,
|
||||
timeoutMs = 30000,
|
||||
pollMs = 500,
|
||||
): Promise<number> {
|
||||
const start = Date.now();
|
||||
let lastSize = -1;
|
||||
|
||||
@@ -38,7 +38,6 @@ function createAutoAbortController() {
|
||||
const abortController = new AbortController();
|
||||
streamMock.mockImplementation(async () => {
|
||||
abortController.abort();
|
||||
return;
|
||||
});
|
||||
return abortController;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,7 @@ vi.mock("./accounts.js", async () => {
|
||||
});
|
||||
|
||||
// Kept for compatibility with existing tests; mocks install at module evaluation.
|
||||
export function installSlackBlockTestMocks() {
|
||||
return;
|
||||
}
|
||||
export function installSlackBlockTestMocks() {}
|
||||
|
||||
export function createSlackEditTestClient(): SlackEditTestClient {
|
||||
return {
|
||||
|
||||
@@ -1245,10 +1245,6 @@ export async function dispatchPreparedSlackMessage(prepared: PreparedSlackMessag
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
if (result.kind === "preview-finalized") {
|
||||
return;
|
||||
}
|
||||
};
|
||||
const onSlackDeliveryError = (err: unknown, info: { kind: string }) => {
|
||||
runtime.error?.(danger(`slack ${info.kind} reply failed: ${formatSlackError(err)}`));
|
||||
|
||||
@@ -105,7 +105,6 @@ export async function finalizeSlackPreviewEdit(params: {
|
||||
client: params.client,
|
||||
...(params.blocks?.length ? { blocks: params.blocks } : {}),
|
||||
});
|
||||
return;
|
||||
} catch (err) {
|
||||
try {
|
||||
const applied = await didSlackPreviewEditApplyAfterError({
|
||||
|
||||
@@ -53,7 +53,7 @@ describe("deliverReplies identity passthrough", () => {
|
||||
await deliverReplies(baseParams({ identity }));
|
||||
|
||||
expect(sendMock).toHaveBeenCalledOnce();
|
||||
const [, , options] = requireSendCall();
|
||||
const options = requireSendCall()[2];
|
||||
expect(options.identity).toBe(identity);
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ describe("deliverReplies identity passthrough", () => {
|
||||
);
|
||||
|
||||
expect(sendMock).toHaveBeenCalledOnce();
|
||||
const [, , options] = requireSendCall();
|
||||
const options = requireSendCall()[2];
|
||||
expect(options.identity).toBe(identity);
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@ describe("deliverReplies identity passthrough", () => {
|
||||
await deliverReplies(baseParams());
|
||||
|
||||
expect(sendMock).toHaveBeenCalledOnce();
|
||||
const [, , options] = requireSendCall();
|
||||
const options = requireSendCall()[2];
|
||||
expect(options).not.toHaveProperty("identity");
|
||||
});
|
||||
|
||||
@@ -142,7 +142,7 @@ describe("deliverReplies identity passthrough", () => {
|
||||
);
|
||||
|
||||
expect(sendMock).toHaveBeenCalledOnce();
|
||||
const [, , options] = requireSendCall();
|
||||
const options = requireSendCall()[2];
|
||||
const blocks = options.blocks as Array<{
|
||||
type?: string;
|
||||
elements?: Array<{ action_id?: string; style?: string; value?: string }>;
|
||||
|
||||
@@ -48,11 +48,7 @@ function createHarness(config: Record<string, unknown>) {
|
||||
return { command, runtime };
|
||||
}
|
||||
|
||||
function createCommandContext(
|
||||
args: string,
|
||||
channel: string = "discord",
|
||||
gatewayClientScopes?: string[],
|
||||
) {
|
||||
function createCommandContext(args: string, channel = "discord", gatewayClientScopes?: string[]) {
|
||||
return {
|
||||
args,
|
||||
channel,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import { resolveActiveTalkProviderConfig } from "openclaw/plugin-sdk/talk-config-runtime";
|
||||
import { definePluginEntry, type OpenClawPluginApi } from "./api.js";
|
||||
|
||||
function mask(s: string, keep: number = 6): string {
|
||||
function mask(s: string, keep = 6): string {
|
||||
const trimmed = s.trim();
|
||||
if (trimmed.length <= keep) {
|
||||
return "***";
|
||||
|
||||
@@ -350,7 +350,6 @@ export function createTelegramDraftStream(params: {
|
||||
} catch (err) {
|
||||
params.warn?.(`telegram stream preview cleanup failed: ${formatErrorMessage(err)}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -889,9 +889,7 @@ export async function monitorTlonProvider(opts: MonitorTlonOpts = {}): Promise<v
|
||||
});
|
||||
},
|
||||
});
|
||||
if (processed.kind === "duplicate") {
|
||||
return;
|
||||
}
|
||||
void processed;
|
||||
} catch (error: unknown) {
|
||||
runtime.error?.(`[tlon] Error handling channel firehose event: ${formatErrorMessage(error)}`);
|
||||
}
|
||||
@@ -1081,9 +1079,7 @@ export async function monitorTlonProvider(opts: MonitorTlonOpts = {}): Promise<v
|
||||
});
|
||||
},
|
||||
});
|
||||
if (processed.kind === "duplicate") {
|
||||
return;
|
||||
}
|
||||
void processed;
|
||||
} catch (error: unknown) {
|
||||
runtime.error?.(`[tlon] Error handling chat firehose event: ${formatErrorMessage(error)}`);
|
||||
}
|
||||
|
||||
@@ -163,12 +163,7 @@ function mergeAdjacentStrings(inlines: StoryInline[]): StoryInline[] {
|
||||
/**
|
||||
* Create an image block
|
||||
*/
|
||||
export function createImageBlock(
|
||||
src: string,
|
||||
alt: string = "",
|
||||
height: number = 0,
|
||||
width: number = 0,
|
||||
): StoryVerse {
|
||||
export function createImageBlock(src: string, alt = "", height = 0, width = 0): StoryVerse {
|
||||
return {
|
||||
block: {
|
||||
image: { src, height, width, alt },
|
||||
|
||||
@@ -81,7 +81,7 @@ export async function sendMessageTwitchInternal(
|
||||
text: string,
|
||||
cfg: OpenClawConfig,
|
||||
accountId?: string,
|
||||
stripMarkdown: boolean = true,
|
||||
stripMarkdown = true,
|
||||
logger: Console = console,
|
||||
): Promise<SendMessageResult> {
|
||||
const {
|
||||
|
||||
@@ -136,7 +136,6 @@ async function rmDirWithRetries(
|
||||
maxRetries: attempts,
|
||||
retryDelay: delayMs,
|
||||
});
|
||||
return;
|
||||
} catch {
|
||||
// Fall back for older Node implementations (or unexpected retry behavior).
|
||||
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
||||
|
||||
@@ -12,10 +12,7 @@ import {
|
||||
type GroupHistoryEntry,
|
||||
} from "./group-gating.js";
|
||||
|
||||
function makeUnregisteredGroupMsg(
|
||||
conversationId: string,
|
||||
accountId: string = "default",
|
||||
): WebInboundMsg {
|
||||
function makeUnregisteredGroupMsg(conversationId: string, accountId = "default"): WebInboundMsg {
|
||||
return {
|
||||
id: `msg-${conversationId}`,
|
||||
from: conversationId,
|
||||
|
||||
@@ -345,9 +345,7 @@ describe("web monitor inbox", () => {
|
||||
|
||||
it("keeps group inbound alive with cached metadata after reconnect-time metadata fetch failures", async () => {
|
||||
const groupMetadataCache: NonNullable<InboxMonitorOptions["groupMetadataCache"]> = new Map();
|
||||
const onMessage = vi.fn(async (_msg: Parameters<InboxOnMessage>[0]) => {
|
||||
return;
|
||||
});
|
||||
const onMessage = vi.fn(async (_msg: Parameters<InboxOnMessage>[0]) => {});
|
||||
|
||||
const firstSock = getSock();
|
||||
firstSock.groupFetchAllParticipating.mockResolvedValueOnce({
|
||||
@@ -463,9 +461,7 @@ describe("web monitor inbox", () => {
|
||||
resolveHydration = () => resolve({});
|
||||
});
|
||||
sock.groupFetchAllParticipating.mockImplementationOnce(() => pendingHydration);
|
||||
const onMessage = vi.fn(async () => {
|
||||
return;
|
||||
});
|
||||
const onMessage = vi.fn(async () => {});
|
||||
|
||||
const { listener } = await startInboxMonitor(onMessage as InboxOnMessage);
|
||||
sock.ev.emit(
|
||||
@@ -813,9 +809,7 @@ describe("web monitor inbox", () => {
|
||||
});
|
||||
|
||||
it("deduplicates redelivered messages by id", async () => {
|
||||
const onMessage = vi.fn(async () => {
|
||||
return;
|
||||
});
|
||||
const onMessage = vi.fn(async () => {});
|
||||
|
||||
const { listener, sock } = await startInboxMonitor(onMessage as InboxOnMessage);
|
||||
const upsert = buildNotifyMessageUpsert({
|
||||
@@ -867,9 +861,7 @@ describe("web monitor inbox", () => {
|
||||
});
|
||||
|
||||
it("resolves LID JIDs using Baileys LID mapping store", async () => {
|
||||
const onMessage = vi.fn(async () => {
|
||||
return;
|
||||
});
|
||||
const onMessage = vi.fn(async () => {});
|
||||
|
||||
const { listener, sock } = await startInboxMonitor(onMessage as InboxOnMessage);
|
||||
const getPNForLID = vi.spyOn(sock.signalRepository.lidMapping, "getPNForLID");
|
||||
@@ -895,9 +887,7 @@ describe("web monitor inbox", () => {
|
||||
});
|
||||
|
||||
it("resolves LID JIDs via authDir mapping files", async () => {
|
||||
const onMessage = vi.fn(async () => {
|
||||
return;
|
||||
});
|
||||
const onMessage = vi.fn(async () => {});
|
||||
fsSync.writeFileSync(
|
||||
path.join(getAuthDir(), "lid-mapping-555_reverse.json"),
|
||||
JSON.stringify("1555"),
|
||||
@@ -926,9 +916,7 @@ describe("web monitor inbox", () => {
|
||||
});
|
||||
|
||||
it("resolves group participant LID JIDs via Baileys mapping", async () => {
|
||||
const onMessage = vi.fn(async () => {
|
||||
return;
|
||||
});
|
||||
const onMessage = vi.fn(async () => {});
|
||||
|
||||
const { listener, sock } = await startInboxMonitor(onMessage as InboxOnMessage);
|
||||
const getPNForLID = vi.spyOn(sock.signalRepository.lidMapping, "getPNForLID");
|
||||
|
||||
@@ -194,9 +194,8 @@ function createXaiRealtimeTranscriptionSession(
|
||||
}
|
||||
case "error":
|
||||
config.onError?.(new Error(readErrorDetail(event.error ?? event.message)));
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ function getMessageFromEntry(entry: SessionTreeEntry): AgentMessage | undefined
|
||||
/** Prepare branch entries for summarization within an optional token budget. */
|
||||
export function prepareBranchEntries(
|
||||
entries: SessionTreeEntry[],
|
||||
tokenBudget: number = 0,
|
||||
tokenBudget = 0,
|
||||
): BranchPreparation {
|
||||
const messages: AgentMessage[] = [];
|
||||
const fileOps = createFileOps();
|
||||
|
||||
@@ -582,7 +582,7 @@ export class NodeExecutionEnv implements ExecutionEnv {
|
||||
}
|
||||
}
|
||||
|
||||
async createTempDir(prefix: string = "tmp-"): Promise<Result<string, FileError>> {
|
||||
async createTempDir(prefix = "tmp-"): Promise<Result<string, FileError>> {
|
||||
try {
|
||||
return ok(await mkdtemp(join(tmpdir(), prefix)));
|
||||
} catch (error) {
|
||||
|
||||
@@ -30,9 +30,7 @@ async function main() {
|
||||
url: url.toString(),
|
||||
onEvent: (evt) => {
|
||||
// Ignore noisy connect handshakes.
|
||||
if (evt.event === "connect.challenge") {
|
||||
return;
|
||||
}
|
||||
void evt;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1182,7 +1182,9 @@ async function sampleWindowsPidWithTasklist(pid, run) {
|
||||
if (!line) {
|
||||
return null;
|
||||
}
|
||||
const [, processIdRaw, , , memoryRaw] = parseTasklistCsvLine(line);
|
||||
const tasklistFields = parseTasklistCsvLine(line);
|
||||
const processIdRaw = tasklistFields[1];
|
||||
const memoryRaw = tasklistFields[4];
|
||||
const processId = Number.parseInt(processIdRaw ?? "", 10);
|
||||
const memoryKiB = Number.parseInt((memoryRaw ?? "").replace(/[^\d]/gu, ""), 10);
|
||||
if (!Number.isFinite(memoryKiB)) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from "node:fs";
|
||||
|
||||
const [, , wrapperPath, npmBin, logPath = `${process.env.HOME}/openclaw-wrapper-argv.log`] =
|
||||
process.argv;
|
||||
const [wrapperPath, npmBin, logPath = `${process.env.HOME}/openclaw-wrapper-argv.log`] =
|
||||
process.argv.slice(2);
|
||||
|
||||
if (!wrapperPath || !npmBin || !logPath || logPath.startsWith("undefined/")) {
|
||||
console.error("usage: write-wrapper.mjs <wrapper-path> <npm-bin> [log-path]");
|
||||
|
||||
@@ -724,9 +724,7 @@ function killPidTree(pid: number | undefined) {
|
||||
} catch {
|
||||
try {
|
||||
process.kill(pid, "SIGTERM");
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ export function installProcessWarningFilter() {
|
||||
}
|
||||
|
||||
Reflect.apply(originalEmitWarning, process, args);
|
||||
return;
|
||||
};
|
||||
|
||||
globalThis[warningFilterKey] = { installed: true };
|
||||
|
||||
@@ -97,10 +97,8 @@ function printSessionUpdate(notification: SessionNotification): void {
|
||||
if (names) {
|
||||
console.log(`\n[commands] ${names}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1009,7 +1009,7 @@ describe("runBtwSideQuestion", () => {
|
||||
|
||||
expect(result).toEqual({ text: "Bedrock answer." });
|
||||
expect(requireApiKeyMock).not.toHaveBeenCalled();
|
||||
const [, , options] = streamSimpleMock.mock.calls.at(-1) ?? [];
|
||||
const options = streamSimpleMock.mock.calls.at(-1)?.[2];
|
||||
expect((options as { apiKey?: string } | undefined)?.apiKey).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
@@ -606,7 +606,6 @@ function dispatchClaudeCliStreamingToolEvent(params: {
|
||||
params.onToolResult,
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,9 +171,7 @@ describe("sanitizeSessionHistory", () => {
|
||||
const getAssistantContentTypes = (messages: AgentMessage[]) =>
|
||||
getAssistantMessage(messages).content.map((block: { type: string }) => block.type);
|
||||
|
||||
const makeThinkingAndTextAssistantMessages = (
|
||||
thinkingSignature: string = "some_sig",
|
||||
): AgentMessage[] => {
|
||||
const makeThinkingAndTextAssistantMessages = (thinkingSignature = "some_sig"): AgentMessage[] => {
|
||||
const user: UserMessage = {
|
||||
role: "user",
|
||||
content: "hello",
|
||||
|
||||
@@ -50,7 +50,7 @@ export function mockOpenAICodexTemplateModel(discoverModelsMock: DiscoverModelsM
|
||||
}
|
||||
|
||||
export function buildOpenAICodexForwardCompatExpectation(
|
||||
id: string = "gpt-5.3-codex",
|
||||
id = "gpt-5.3-codex",
|
||||
): Partial<ModelDefinitionConfig> & {
|
||||
provider: string;
|
||||
id: string;
|
||||
|
||||
@@ -33,7 +33,6 @@ export function createEmbeddedAgentSessionEventHandler(ctx: EmbeddedAgentSubscri
|
||||
return handler();
|
||||
} catch (err) {
|
||||
ctx.log.debug(`${evt.type} handler failed: ${String(err)}`);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -136,9 +135,7 @@ export function createEmbeddedAgentSessionEventHandler(ctx: EmbeddedAgentSubscri
|
||||
scheduleEvent(evt, () => {
|
||||
return handleAgentEnd(ctx);
|
||||
});
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export function truncateToVisualLines(
|
||||
text: string,
|
||||
maxVisualLines: number,
|
||||
width: number,
|
||||
paddingX: number = 0,
|
||||
paddingX = 0,
|
||||
): VisualTruncateResult {
|
||||
if (!text) {
|
||||
return { visualLines: [], skippedCount: 0 };
|
||||
|
||||
@@ -806,7 +806,7 @@ export function setRegisteredThemes(themes: Theme[]): void {
|
||||
}
|
||||
}
|
||||
|
||||
export function initTheme(themeName?: string, enableWatcher: boolean = false): void {
|
||||
export function initTheme(themeName?: string, enableWatcher = false): void {
|
||||
const name = themeName ?? getDefaultTheme();
|
||||
currentThemeName = name;
|
||||
try {
|
||||
@@ -824,7 +824,7 @@ export function initTheme(themeName?: string, enableWatcher: boolean = false): v
|
||||
|
||||
export function setTheme(
|
||||
name: string,
|
||||
enableWatcher: boolean = false,
|
||||
enableWatcher = false,
|
||||
): { success: boolean; error?: string } {
|
||||
currentThemeName = name;
|
||||
try {
|
||||
|
||||
@@ -65,7 +65,7 @@ function expectGatewayCallFields(
|
||||
method: string,
|
||||
expectedParams: Record<string, unknown>,
|
||||
): Record<string, unknown> {
|
||||
const [, , params] = gatewayCall(method);
|
||||
const params = gatewayCall(method)[2];
|
||||
if (params === undefined) {
|
||||
throw new Error(`Expected gateway call params for ${method}`);
|
||||
}
|
||||
|
||||
@@ -951,9 +951,7 @@ export class DefaultPackageManager implements PackageManager {
|
||||
this.addResource(accumulator.extensions, resolved, metadata, true);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
private parseSource(source: string): ParsedSource {
|
||||
|
||||
@@ -781,7 +781,7 @@ export class DefaultResourceLoader implements ResourceLoader {
|
||||
|
||||
private loadThemes(
|
||||
paths: string[],
|
||||
includeDefaults: boolean = true,
|
||||
includeDefaults = true,
|
||||
): {
|
||||
themes: Theme[];
|
||||
diagnostics: ResourceDiagnostic[];
|
||||
|
||||
@@ -685,12 +685,12 @@ async function listSessionsFromDir(
|
||||
* handles compaction summaries and follows the path from root to current leaf.
|
||||
*/
|
||||
export class SessionManager {
|
||||
private sessionId: string = "";
|
||||
private sessionId = "";
|
||||
private sessionFile: string | undefined;
|
||||
private sessionDir: string;
|
||||
private cwd: string;
|
||||
private shouldPersist: boolean;
|
||||
private flushed: boolean = false;
|
||||
private flushed = false;
|
||||
private fileEntries: FileEntry[] = [];
|
||||
private byId: Map<string, SessionEntry> = new Map();
|
||||
private labelsById: Map<string, string> = new Map();
|
||||
|
||||
@@ -182,12 +182,13 @@ describe("Tool Search", () => {
|
||||
runId: "run-b",
|
||||
});
|
||||
|
||||
const [, , , runACallTool] = createToolSearchTools({
|
||||
const runATools = createToolSearchTools({
|
||||
sessionId: "session-overlap",
|
||||
sessionKey: "agent:main:main",
|
||||
runId: "run-a",
|
||||
config,
|
||||
});
|
||||
const runACallTool = runATools[3];
|
||||
await runACallTool.execute("call-run-a", {
|
||||
id: "fake_run_a",
|
||||
args: { value: "A" },
|
||||
@@ -230,12 +231,13 @@ describe("Tool Search", () => {
|
||||
sessionId: "session-catalog-ref",
|
||||
});
|
||||
|
||||
const [, , , callTool] = createToolSearchTools({
|
||||
const tools = createToolSearchTools({
|
||||
sessionId: "session-catalog-ref",
|
||||
runId: "run-local-ref",
|
||||
catalogRef: localRef,
|
||||
config,
|
||||
});
|
||||
const callTool = tools[3];
|
||||
await callTool.execute("call-local-ref", {
|
||||
id: "fake_local_ref",
|
||||
args: { value: "local" },
|
||||
@@ -454,13 +456,15 @@ describe("Tool Search", () => {
|
||||
sessionKey: "agent:main:main",
|
||||
});
|
||||
|
||||
const [runtimeCodeTool, , , runtimeCallTool] = createToolSearchTools({
|
||||
const runtimeTools = createToolSearchTools({
|
||||
sessionId: "session-lifecycle",
|
||||
sessionKey: "agent:main:main",
|
||||
config: {},
|
||||
abortSignal: abortController.signal,
|
||||
executeTool,
|
||||
});
|
||||
const runtimeCodeTool = runtimeTools[0];
|
||||
const runtimeCallTool = runtimeTools[3];
|
||||
await runtimeCodeTool.execute(
|
||||
"call-lifecycle",
|
||||
{
|
||||
|
||||
@@ -238,9 +238,6 @@ function validateMusicGenerationCapabilities(params: {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!caps) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
type MusicGenerateSandboxConfig = {
|
||||
|
||||
@@ -172,7 +172,8 @@ function listImplicitDefaultDirectFallbackKeys(params: {
|
||||
if (parts.length < 4 || parts[1] !== "default" || parts[2] !== "direct") {
|
||||
return [];
|
||||
}
|
||||
const [channel, , , ...peerParts] = parts;
|
||||
const channel = parts[0];
|
||||
const peerParts = parts.slice(3);
|
||||
if (!channel || peerParts.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -376,10 +376,7 @@ const TERMUX_PACKAGES: Record<string, string> = {
|
||||
|
||||
// Ensure a tool is available, downloading if necessary
|
||||
// Returns the path to the tool, or null if unavailable
|
||||
export async function ensureTool(
|
||||
tool: "fd" | "rg",
|
||||
silent: boolean = false,
|
||||
): Promise<string | undefined> {
|
||||
export async function ensureTool(tool: "fd" | "rg", silent = false): Promise<string | undefined> {
|
||||
const existingPath = getToolPath(tool);
|
||||
if (existingPath) {
|
||||
return existingPath;
|
||||
|
||||
@@ -121,7 +121,7 @@ export function createBlockReplyPipeline(params: {
|
||||
void coalescer?.flush({ force: true });
|
||||
};
|
||||
|
||||
const sendPayload = (payload: ReplyPayload, bypassSeenCheck: boolean = false) => {
|
||||
const sendPayload = (payload: ReplyPayload, bypassSeenCheck = false) => {
|
||||
if (aborted) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,6 @@ describe("channel plugin loader", () => {
|
||||
return;
|
||||
case "missing-outbound":
|
||||
await expectOutboundAdapterMissingCase(testCase.registry);
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -367,7 +367,6 @@ export async function runServiceStart(params: {
|
||||
} catch (err) {
|
||||
const hints = params.renderStartHints();
|
||||
fail(`${params.serviceNoun} start failed: ${String(err)}`, hints);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ describe("system-cli", () => {
|
||||
await runCli(["system", "event", "--text", "ping"]);
|
||||
|
||||
expect(callGatewayFromCli).toHaveBeenCalledTimes(1);
|
||||
const [, , params] = gatewayCall();
|
||||
const params = gatewayCall()[2];
|
||||
expect(params).not.toHaveProperty("sessionKey");
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ describe("system-cli", () => {
|
||||
await runCli(["system", "event", "--text", "ping", "--session-key", " "]);
|
||||
|
||||
expect(callGatewayFromCli).toHaveBeenCalledTimes(1);
|
||||
const [, , params] = gatewayCall();
|
||||
const params = gatewayCall()[2];
|
||||
expect(params).not.toHaveProperty("sessionKey");
|
||||
});
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ export async function promptAuthConfig(
|
||||
prompter: WizardPrompter,
|
||||
): Promise<OpenClawConfig> {
|
||||
let next = cfg;
|
||||
let authChoice: string = "skip";
|
||||
let authChoice = "skip";
|
||||
let preferredProvider: string | undefined;
|
||||
while (true) {
|
||||
authChoice = await promptAuthChoiceGrouped({
|
||||
|
||||
@@ -255,20 +255,15 @@ async function handleMissingSandboxImage(
|
||||
: "Build or pull it first.";
|
||||
note(`Sandbox ${params.kind} image missing: ${params.image}. ${buildHint}`, "Sandbox");
|
||||
|
||||
let built = false;
|
||||
if (params.buildScript) {
|
||||
const build = await prompter.confirmRuntimeRepair({
|
||||
message: `Build ${params.kind} sandbox image now?`,
|
||||
initialValue: true,
|
||||
});
|
||||
if (build) {
|
||||
built = await runSandboxScript(params.buildScript, runtime);
|
||||
await runSandboxScript(params.buildScript, runtime);
|
||||
}
|
||||
}
|
||||
|
||||
if (built) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export async function maybeRepairSandboxImages(
|
||||
|
||||
@@ -149,6 +149,5 @@ export async function resetCommand(runtime: RuntimeEnv, opts: ResetOptions) {
|
||||
);
|
||||
await removeWorkspaceDirs(workspaceDirs, runtime, { dryRun });
|
||||
runtime.log(`Next: ${formatCliCommand("openclaw onboard --install-daemon")}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ async function writeConfig(
|
||||
home: string,
|
||||
dirname: ".openclaw",
|
||||
port: number,
|
||||
filename: string = "openclaw.json",
|
||||
filename = "openclaw.json",
|
||||
) {
|
||||
const dir = path.join(home, dirname);
|
||||
await fs.mkdir(dir, { recursive: true });
|
||||
|
||||
@@ -83,7 +83,6 @@ const AcpBindingSchema = z
|
||||
path: ["match", "peer"],
|
||||
message: "ACP bindings require match.peer.id to target a concrete conversation.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -97,7 +97,6 @@ async function runStopLaunchAgentWithFakeTimers(args: Parameters<typeof stopLaun
|
||||
if (!result.ok) {
|
||||
throw result.error;
|
||||
}
|
||||
return;
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ describe("resolveGatewayProgramArguments", () => {
|
||||
if (target === indexPath || target === indexMjsPath) {
|
||||
throw new Error("missing");
|
||||
}
|
||||
return;
|
||||
});
|
||||
|
||||
const result = await resolveGatewayProgramArguments({ port: 18789 });
|
||||
|
||||
@@ -100,9 +100,7 @@ class MockWebSocket {
|
||||
return;
|
||||
case "error":
|
||||
this.errorHandlers.push(handler as WsEventHandlers["error"]);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ function extractTextMessageContent(content: unknown): string | undefined {
|
||||
|
||||
export async function getRecentSessionContent(
|
||||
sessionFilePath: string,
|
||||
messageCount: number = 15,
|
||||
messageCount = 15,
|
||||
): Promise<string | null> {
|
||||
try {
|
||||
const content = await fs.readFile(sessionFilePath, "utf-8");
|
||||
@@ -63,7 +63,7 @@ export async function getRecentSessionContent(
|
||||
|
||||
export async function getRecentSessionContentWithResetFallback(
|
||||
sessionFilePath: string,
|
||||
messageCount: number = 15,
|
||||
messageCount = 15,
|
||||
): Promise<string | null> {
|
||||
const primary = await getRecentSessionContent(sessionFilePath, messageCount);
|
||||
if (primary) {
|
||||
|
||||
@@ -176,9 +176,8 @@ async function applyApprovalFinalAction(params: {
|
||||
entry: params.wrapped.entry,
|
||||
phase: params.phase,
|
||||
});
|
||||
return;
|
||||
|
||||
case "leave":
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -590,7 +590,7 @@ function evaluateShellWrapperInlineCommand(params: {
|
||||
function evaluateSegments(
|
||||
segments: ExecCommandSegment[],
|
||||
params: ExecAllowlistContext,
|
||||
inlineDepth: number = 0,
|
||||
inlineDepth = 0,
|
||||
): {
|
||||
satisfied: boolean;
|
||||
matches: ExecAllowlistEntry[];
|
||||
|
||||
@@ -560,7 +560,6 @@ function copyExecApprovalsFallback(tempPath: string, filePath: string): void {
|
||||
function renameExecApprovalsWithFallback(tempPath: string, filePath: string): void {
|
||||
try {
|
||||
fs.renameSync(tempPath, filePath);
|
||||
return;
|
||||
} catch (err) {
|
||||
const code = (err as NodeJS.ErrnoException).code;
|
||||
// Windows can reject rename-overwrite when another process has a transient
|
||||
|
||||
@@ -127,9 +127,7 @@ function createFakeProcess() {
|
||||
}
|
||||
|
||||
// Launcher plumbing tests do not need the real runtime artifact copier.
|
||||
async function skipRuntimePostBuild(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
async function skipRuntimePostBuild(): Promise<void> {}
|
||||
|
||||
async function syncBundledPluginMetadata(params?: {
|
||||
cwd?: string;
|
||||
|
||||
@@ -92,7 +92,6 @@ export function installProcessWarningFilter(): void {
|
||||
return;
|
||||
}
|
||||
Reflect.apply(originalEmitWarning, process, args);
|
||||
return;
|
||||
}) as typeof process.emitWarning;
|
||||
|
||||
process.emitWarning = wrappedEmitWarning;
|
||||
|
||||
@@ -377,9 +377,8 @@ function registerDiagnosticRunActivityListener(): void {
|
||||
return;
|
||||
case "run.completed":
|
||||
recordRunCompleted(event);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1029,7 +1029,7 @@ describe("describeImageWithModel", () => {
|
||||
await vi.advanceTimersByTimeAsync(25);
|
||||
await assertion;
|
||||
const firstCall = requireFirstMockCall(completeMock, "timed image completion");
|
||||
const [, , options] = firstCall;
|
||||
const options = firstCall[2];
|
||||
if (!options?.signal) {
|
||||
throw new Error("Expected image completion abort signal");
|
||||
}
|
||||
@@ -1322,7 +1322,7 @@ describe("describeImageWithModel", () => {
|
||||
timeoutMs: 1000,
|
||||
});
|
||||
|
||||
const [, , options] = requireFirstMockCall(completeMock, "image completion");
|
||||
const options = requireFirstMockCall(completeMock, "image completion")[2];
|
||||
expect(options.maxTokens).toBe(4096);
|
||||
});
|
||||
|
||||
@@ -1359,7 +1359,7 @@ describe("describeImageWithModel", () => {
|
||||
timeoutMs: 1000,
|
||||
});
|
||||
|
||||
const [, , options] = requireFirstMockCall(completeMock, "image completion");
|
||||
const options = requireFirstMockCall(completeMock, "image completion")[2];
|
||||
expect(options.maxTokens).toBe(1024);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -722,7 +722,7 @@ export async function readMediaBuffer(
|
||||
* @param id The media ID as returned by SavedMedia.id.
|
||||
* @param subdir The subdirectory the file was saved into (default "inbound").
|
||||
*/
|
||||
export async function deleteMediaBuffer(id: string, subdir: "inbound" = "inbound"): Promise<void> {
|
||||
export async function deleteMediaBuffer(id: string, subdir = "inbound"): Promise<void> {
|
||||
const relativePath = resolveMediaRelativePath(id, subdir, "deleteMediaBuffer");
|
||||
await openMediaStore().remove(relativePath);
|
||||
}
|
||||
|
||||
@@ -1420,7 +1420,6 @@ function discoverFromPath(params: {
|
||||
...(params.managedPluginDirs ? { managedPluginDirs: params.managedPluginDirs } : {}),
|
||||
...(params.skipRootDirKeys ? { skipRootDirKeys: params.skipRootDirKeys } : {}),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -358,7 +358,6 @@ class WebSocketRealtimeTranscriptionSession<Event> implements RealtimeTranscript
|
||||
if (!this.closed) {
|
||||
this.reconnecting = false;
|
||||
await this.attemptReconnect();
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
this.reconnecting = false;
|
||||
|
||||
@@ -52,6 +52,5 @@ export function collectTtsApiKeyAssignments(params: {
|
||||
inactiveReason: params.inactiveReason,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,6 @@ export function createRealtimeVoiceTurnContextTracker<
|
||||
if (!turns.includes(handle)) {
|
||||
turns.push(handle);
|
||||
prune();
|
||||
return;
|
||||
}
|
||||
},
|
||||
close(handle) {
|
||||
|
||||
@@ -865,7 +865,7 @@ export async function runSetupWizard(
|
||||
});
|
||||
|
||||
const { finalizeSetupWizard } = await import("./setup.finalize.js");
|
||||
const { launchedTui } = await finalizeSetupWizard({
|
||||
await finalizeSetupWizard({
|
||||
flow: wizardFlow,
|
||||
opts,
|
||||
baseConfig,
|
||||
@@ -875,7 +875,4 @@ export async function runSetupWizard(
|
||||
prompter,
|
||||
runtime,
|
||||
});
|
||||
if (launchedTui) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user