chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -1,7 +1,4 @@
import {
getChannelPlugin,
normalizeChannelId,
} from "../../channels/plugins/index.js";
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
import type { ClawdbotConfig } from "../../config/config.js";
const ANNOUNCE_SKIP_TOKEN = "ANNOUNCE_SKIP";
@@ -15,14 +12,9 @@ export type AnnounceTarget = {
accountId?: string;
};
export function resolveAnnounceTargetFromKey(
sessionKey: string,
): AnnounceTarget | null {
export function resolveAnnounceTargetFromKey(sessionKey: string): AnnounceTarget | null {
const rawParts = sessionKey.split(":").filter(Boolean);
const parts =
rawParts.length >= 3 && rawParts[0] === "agent"
? rawParts.slice(2)
: rawParts;
const parts = rawParts.length >= 3 && rawParts[0] === "agent" ? rawParts.slice(2) : rawParts;
if (parts.length < 3) return null;
const [channelRaw, kind, ...rest] = parts;
if (kind !== "group" && kind !== "channel") return null;
@@ -37,9 +29,7 @@ export function resolveAnnounceTargetFromKey(
: `group:${id}`
: id;
const normalized = normalizedChannel
? getChannelPlugin(normalizedChannel)?.messaging?.normalizeTarget?.(
kindTarget,
)
? getChannelPlugin(normalizedChannel)?.messaging?.normalizeTarget?.(kindTarget)
: undefined;
return { channel, to: normalized ?? kindTarget };
}
@@ -72,9 +62,7 @@ export function buildAgentToAgentReplyContext(params: {
maxTurns: number;
}) {
const currentLabel =
params.currentRole === "requester"
? "Agent 1 (requester)"
: "Agent 2 (target)";
params.currentRole === "requester" ? "Agent 1 (requester)" : "Agent 2 (target)";
const lines = [
"Agent-to-agent reply step:",
`Current agent: ${currentLabel}.`,
@@ -86,9 +74,7 @@ export function buildAgentToAgentReplyContext(params: {
? `Agent 1 (requester) channel: ${params.requesterChannel}.`
: undefined,
`Agent 2 (target) session: ${params.targetSessionKey}.`,
params.targetChannel
? `Agent 2 (target) channel: ${params.targetChannel}.`
: undefined,
params.targetChannel ? `Agent 2 (target) channel: ${params.targetChannel}.` : undefined,
`If you want to stop the ping-pong, reply exactly "${REPLY_SKIP_TOKEN}".`,
].filter(Boolean);
return lines.join("\n");
@@ -112,16 +98,12 @@ export function buildAgentToAgentAnnounceContext(params: {
? `Agent 1 (requester) channel: ${params.requesterChannel}.`
: undefined,
`Agent 2 (target) session: ${params.targetSessionKey}.`,
params.targetChannel
? `Agent 2 (target) channel: ${params.targetChannel}.`
: undefined,
params.targetChannel ? `Agent 2 (target) channel: ${params.targetChannel}.` : undefined,
`Original request: ${params.originalMessage}`,
params.roundOneReply
? `Round 1 reply: ${params.roundOneReply}`
: "Round 1 reply: (not available).",
params.latestReply
? `Latest reply: ${params.latestReply}`
: "Latest reply: (not available).",
params.latestReply ? `Latest reply: ${params.latestReply}` : "Latest reply: (not available).",
`If you want to remain silent, reply exactly "${ANNOUNCE_SKIP_TOKEN}".`,
"Any other reply will be posted to the target channel.",
"After this reply, the agent-to-agent conversation is over.",