mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-20 09:47:53 +00:00
refactor(channels): remove internal compatibility aliases
This commit is contained in:
@@ -179,7 +179,7 @@ rules:
|
||||
- patterns:
|
||||
- pattern-either:
|
||||
- pattern: getChannelPluginCatalogEntry(...)
|
||||
- pattern: listChannelPluginCatalogEntries(...)
|
||||
- pattern: listRawChannelPluginCatalogEntries(...)
|
||||
- pattern-not-regex: \bexcludeWorkspace\s*:\s*true\b
|
||||
pattern-sanitizers:
|
||||
- patterns:
|
||||
|
||||
@@ -49,7 +49,7 @@ export function normalizeReplyPayloadDirectives(params: {
|
||||
}
|
||||
|
||||
const mediaUrls = params.payload.mediaUrls ?? parsed?.mediaUrls;
|
||||
const mediaUrl = params.payload.mediaUrl ?? parsed?.mediaUrl ?? mediaUrls?.[0];
|
||||
const mediaUrl = params.payload.mediaUrl ?? mediaUrls?.[0];
|
||||
|
||||
const channelData = mergeReactionDirectiveChannelData(
|
||||
params.payload.channelData,
|
||||
|
||||
@@ -7,7 +7,6 @@ import { isSilentReplyPayloadText, SILENT_REPLY_TOKEN } from "../tokens.js";
|
||||
export type ReplyDirectiveParseResult = {
|
||||
text: string;
|
||||
mediaUrls?: string[];
|
||||
mediaUrl?: string;
|
||||
reaction?: {
|
||||
emoji: string;
|
||||
replyToCurrent?: boolean;
|
||||
@@ -109,7 +108,6 @@ export function parseReplyDirectives(
|
||||
return {
|
||||
text,
|
||||
mediaUrls: split.mediaUrls,
|
||||
mediaUrl: split.mediaUrl,
|
||||
reaction: reactionParsed.reaction,
|
||||
replyToId: replyParsed.replyToId ?? reactionParsed.reaction?.replyToId,
|
||||
replyToCurrent:
|
||||
|
||||
@@ -531,17 +531,6 @@ export function listRawChannelPluginCatalogEntries(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `listTrustedChannelPluginCatalogEntries` for execution-facing
|
||||
* paths, or `listRawChannelPluginCatalogEntries` for internal plumbing
|
||||
* that applies its own trust filtering.
|
||||
*/
|
||||
export function listChannelPluginCatalogEntries(
|
||||
options: CatalogOptions = {},
|
||||
): ChannelPluginCatalogEntry[] {
|
||||
return listRawChannelPluginCatalogEntries(options);
|
||||
}
|
||||
|
||||
export function getChannelPluginCatalogEntry(
|
||||
id: string,
|
||||
options: CatalogOptions = {},
|
||||
|
||||
@@ -7,7 +7,7 @@ import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolvePreferredOpenClawTmpDir } from "../../../../infra/tmp-openclaw-dir.js";
|
||||
import { getChannelPluginCatalogEntry, listChannelPluginCatalogEntries } from "../../catalog.js";
|
||||
import { getChannelPluginCatalogEntry, listRawChannelPluginCatalogEntries } from "../../catalog.js";
|
||||
|
||||
type CatalogEntryMeta = {
|
||||
id: string;
|
||||
@@ -48,7 +48,7 @@ export function describeChannelCatalogEntryContract(params: {
|
||||
});
|
||||
|
||||
it("appears in the channel catalog listing", () => {
|
||||
const ids = listChannelPluginCatalogEntries().map((entry) => entry.id);
|
||||
const ids = listRawChannelPluginCatalogEntries().map((entry) => entry.id);
|
||||
expect(ids).toContain(params.channelId);
|
||||
});
|
||||
});
|
||||
@@ -96,7 +96,7 @@ export function describeBundledMetadataOnlyChannelCatalogContract(params: {
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const entry = listChannelPluginCatalogEntries({
|
||||
const entry = listRawChannelPluginCatalogEntries({
|
||||
workspaceDir,
|
||||
env: createCatalogFixtureEnv({ OPENCLAW_DISABLE_BUNDLED_PLUGINS: "1" }),
|
||||
}).find((item) => item.id === params.meta.id);
|
||||
@@ -141,7 +141,7 @@ export function describeOfficialFallbackChannelCatalogContract(params: {
|
||||
}),
|
||||
);
|
||||
|
||||
const entry = listChannelPluginCatalogEntries({
|
||||
const entry = listRawChannelPluginCatalogEntries({
|
||||
env: createCatalogFallbackOnlyEnv(),
|
||||
officialCatalogPaths: [catalogPath],
|
||||
}).find((item) => item.id === params.channelId);
|
||||
@@ -216,7 +216,7 @@ export function describeOfficialFallbackChannelCatalogContract(params: {
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const entry = listChannelPluginCatalogEntries({
|
||||
const entry = listRawChannelPluginCatalogEntries({
|
||||
catalogPaths: [externalCatalogPath],
|
||||
officialCatalogPaths: [officialCatalogPath],
|
||||
env: createCatalogFallbackOnlyEnv(),
|
||||
@@ -252,7 +252,7 @@ export function describeOfficialFallbackChannelCatalogContract(params: {
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const entry = listChannelPluginCatalogEntries({
|
||||
const entry = listRawChannelPluginCatalogEntries({
|
||||
catalogPaths: [catalogPath],
|
||||
officialCatalogPaths: [],
|
||||
env: createCatalogFallbackOnlyEnv(),
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolvePreferredOpenClawTmpDir } from "../../../../infra/tmp-openclaw-dir.js";
|
||||
import { listChannelPluginCatalogEntries } from "../../catalog.js";
|
||||
import { listRawChannelPluginCatalogEntries } from "../../catalog.js";
|
||||
|
||||
function createCatalogEntry(params: {
|
||||
packageName: string;
|
||||
@@ -88,7 +88,7 @@ function expectCatalogIdsContain(params: {
|
||||
catalogPaths?: string[];
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}) {
|
||||
const ids = listChannelPluginCatalogEntries({
|
||||
const ids = listRawChannelPluginCatalogEntries({
|
||||
...(params.catalogPaths ? { catalogPaths: params.catalogPaths } : {}),
|
||||
...(params.env ? { env: params.env } : {}),
|
||||
}).map((entry) => entry.id);
|
||||
@@ -100,7 +100,7 @@ function findCatalogEntry(params: {
|
||||
catalogPaths?: string[];
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}) {
|
||||
return listChannelPluginCatalogEntries({
|
||||
return listRawChannelPluginCatalogEntries({
|
||||
...(params.catalogPaths ? { catalogPaths: params.catalogPaths } : {}),
|
||||
...(params.env ? { env: params.env } : {}),
|
||||
}).find((entry) => entry.id === params.channelId);
|
||||
|
||||
@@ -231,7 +231,7 @@ function createOutboundPayloadPlanEntry(
|
||||
extractMarkdownImages: context.extractMarkdownImages,
|
||||
});
|
||||
const explicitMediaUrls = payload.mediaUrls ?? parsed.mediaUrls;
|
||||
const explicitMediaUrl = payload.mediaUrl ?? parsed.mediaUrl;
|
||||
const explicitMediaUrl = payload.mediaUrl ?? parsed.mediaUrls?.[0];
|
||||
const mergedMedia = mergeMediaUrls(
|
||||
explicitMediaUrls,
|
||||
explicitMediaUrl ? [explicitMediaUrl] : undefined,
|
||||
|
||||
@@ -21,10 +21,8 @@ describe("splitMediaFromOutput", () => {
|
||||
}
|
||||
if ("mediaUrls" in expected) {
|
||||
expect(result.mediaUrls).toEqual(expected.mediaUrls);
|
||||
expect(result.mediaUrl).toBe(expected.mediaUrls?.[0]);
|
||||
} else {
|
||||
expect(result.mediaUrls).toBeUndefined();
|
||||
expect(result.mediaUrl).toBeUndefined();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -489,8 +489,6 @@ export function splitMediaFromOutput(
|
||||
): {
|
||||
text: string;
|
||||
mediaUrls?: string[];
|
||||
/** @deprecated Use mediaUrls[0]. */
|
||||
mediaUrl?: string;
|
||||
audioAsVoice?: boolean; // true if [[audio_as_voice]] tag was found
|
||||
segments?: ParsedMediaOutputSegment[];
|
||||
} {
|
||||
@@ -718,7 +716,6 @@ export function splitMediaFromOutput(
|
||||
return {
|
||||
text: cleanedText,
|
||||
mediaUrls: media,
|
||||
mediaUrl: media[0],
|
||||
segments: segments.length > 0 ? segments : [{ type: "text", text: cleanedText }],
|
||||
...(hasAudioAsVoice ? { audioAsVoice: true } : {}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user