chore: format + regenerate protocol

This commit is contained in:
Peter Steinberger
2026-01-17 03:40:49 +00:00
parent 09bed2ccde
commit a82217a5f3
20 changed files with 79 additions and 74 deletions

View File

@@ -157,7 +157,10 @@ describe("runMessageAction context isolation", () => {
to: "imessage:+15551230000",
message: "hi",
},
toolContext: { currentChannelId: "imessage:+15551234567", currentChannelProvider: "imessage" },
toolContext: {
currentChannelId: "imessage:+15551234567",
currentChannelProvider: "imessage",
},
dryRun: true,
});

View File

@@ -13,7 +13,10 @@ import type {
} from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { GatewayClientMode, GatewayClientName } from "../../utils/message-channel.js";
import { listConfiguredMessageChannels, resolveMessageChannelSelection } from "./channel-selection.js";
import {
listConfiguredMessageChannels,
resolveMessageChannelSelection,
} from "./channel-selection.js";
import type { OutboundSendDeps } from "./deliver.js";
import type { MessagePollResult, MessageSendResult } from "./message.js";
import { sendMessage, sendPoll } from "./message.js";

View File

@@ -77,7 +77,8 @@ export function enforceCrossContextPolicy(params: {
if (params.cfg.tools?.message?.allowCrossContextSend) return;
const currentProvider = params.toolContext?.currentChannelProvider;
const allowWithinProvider = params.cfg.tools?.message?.crossContext?.allowWithinProvider !== false;
const allowWithinProvider =
params.cfg.tools?.message?.crossContext?.allowWithinProvider !== false;
const allowAcrossProviders =
params.cfg.tools?.message?.crossContext?.allowAcrossProviders === true;
@@ -132,7 +133,7 @@ export async function buildCrossContextDecoration(params: {
const adapter = getChannelMessageAdapter(params.channel);
const embeds = adapter.supportsEmbeds
? adapter.buildCrossContextEmbeds?.(originLabel) ?? undefined
? (adapter.buildCrossContextEmbeds?.(originLabel) ?? undefined)
: undefined;
return { prefix, suffix, embeds };

View File

@@ -31,7 +31,10 @@ function normalizeQuery(value: string): string {
}
function stripTargetPrefixes(value: string): string {
return value.replace(/^(channel|group|user):/i, "").replace(/^[@#]/, "").trim();
return value
.replace(/^(channel|group|user):/i, "")
.replace(/^[@#]/, "")
.trim();
}
function preserveTargetCase(channel: ChannelId, raw: string, normalized: string): string {
@@ -132,7 +135,7 @@ async function listDirectoryEntries(params: {
const runtime = params.runtime ?? defaultRuntime;
const useLive = params.source === "live";
if (params.kind === "user") {
const fn = useLive ? directory.listPeersLive ?? directory.listPeers : directory.listPeers;
const fn = useLive ? (directory.listPeersLive ?? directory.listPeers) : directory.listPeers;
if (!fn) return [];
return await fn({
cfg: params.cfg,
@@ -142,7 +145,7 @@ async function listDirectoryEntries(params: {
runtime,
});
}
const fn = useLive ? directory.listGroupsLive ?? directory.listGroups : directory.listGroups;
const fn = useLive ? (directory.listGroupsLive ?? directory.listGroups) : directory.listGroups;
if (!fn) return [];
return await fn({
cfg: params.cfg,
@@ -254,9 +257,7 @@ export async function resolveMessagingTarget(params: {
if (match.kind === "ambiguous") {
return {
ok: false,
error: new Error(
`Ambiguous target "${raw}". Provide a unique name or an explicit id.`,
),
error: new Error(`Ambiguous target "${raw}". Provide a unique name or an explicit id.`),
candidates: match.entries,
};
}