docs: generalize core channel examples

This commit is contained in:
Peter Steinberger
2026-04-22 06:46:58 +01:00
parent 9f5dc4045c
commit b70531bf24
5 changed files with 13 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ import { readStringParam } from "./common.js";
const TtsToolSchema = Type.Object({
text: Type.String({ description: "Text to convert to speech." }),
channel: Type.Optional(
Type.String({ description: "Optional channel id to pick output format (e.g. telegram)." }),
Type.String({ description: "Optional channel id to pick output format." }),
),
});

View File

@@ -58,7 +58,7 @@ export type MessageReceivedHookContext = {
content: string;
/** Unix timestamp when the message was received */
timestamp?: number;
/** Channel identifier (e.g., "telegram", "whatsapp") */
/** Channel identifier (for example "chat" or "support-chat") */
channelId: string;
/** Provider account ID for multi-account setups */
accountId?: string;
@@ -85,7 +85,7 @@ export type MessageSentHookContext = {
success: boolean;
/** Error message if sending failed */
error?: string;
/** Channel identifier (e.g., "telegram", "whatsapp") */
/** Channel identifier (for example "chat" or "support-chat") */
channelId: string;
/** Provider account ID for multi-account setups */
accountId?: string;
@@ -116,7 +116,7 @@ type MessageEnrichedBodyHookContext = {
bodyForAgent?: string;
/** Unix timestamp when the message was received */
timestamp?: number;
/** Channel identifier (e.g., "telegram", "whatsapp") */
/** Channel identifier (for example "chat" or "support-chat") */
channelId: string;
/** Conversation/chat ID */
conversationId?: string;

View File

@@ -177,7 +177,7 @@ async function assertExplicitProxyAllowed(
// The proxy hostname is operator-configured, not user input.
// Clear the target-scoped hostnameAllowlist so configured proxies
// like localhost or internal hosts aren't rejected by an allowlist
// that was built for the target URL (e.g. api.telegram.org).
// that was built for the target URL (for example api.example.test).
// Private-network IP checks still apply via allowPrivateNetwork.
...policy,
allowPrivateNetwork: true,

View File

@@ -54,7 +54,7 @@ describe("redactSensitiveText", () => {
expect(output).toBe("Authorization: Bearer abcdef…ghij");
});
it("masks Telegram-style tokens", () => {
it("masks bot-style tokens", () => {
const input = "123456:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef";
const output = redactSensitiveText(input, {
mode: "tools",
@@ -63,14 +63,14 @@ describe("redactSensitiveText", () => {
expect(output).toBe("123456…cdef");
});
it("masks Telegram Bot API URL tokens", () => {
it("masks bot API URL tokens", () => {
const input =
"GET https://api.telegram.org/bot123456:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef/getMe HTTP/1.1";
"GET https://api.example.test/bot123456:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef/getMe HTTP/1.1";
const output = redactSensitiveText(input, {
mode: "tools",
patterns: defaults,
});
expect(output).toBe("GET https://api.telegram.org/bot123456…cdef/getMe HTTP/1.1");
expect(output).toBe("GET https://api.example.test/bot123456…cdef/getMe HTTP/1.1");
});
it("redacts short tokens fully", () => {

View File

@@ -1675,11 +1675,11 @@ export type OpenClawPluginGatewayMethod = {
* Context passed to plugin command handlers.
*/
export type PluginCommandContext = {
/** The sender's identifier (e.g., Telegram user ID) */
/** The sender's identifier (for example a channel-scoped user ID) */
senderId?: string;
/** The channel/surface (e.g., "telegram", "discord") */
/** The channel/surface (for example "chat" or "team-chat") */
channel: string;
/** Provider channel id (e.g., "telegram") */
/** Provider channel id */
channelId?: ChannelId;
/** Whether the sender is on the allowlist */
isAuthorizedSender: boolean;
@@ -1735,7 +1735,7 @@ export type OpenClawPluginCommandDefinition = {
/**
* Optional native-command aliases for slash/menu surfaces.
* `default` applies to all native providers unless a provider-specific
* override exists (for example `{ default: "talkvoice", discord: "voice2" }`).
* override exists (for example `{ default: "talkvoice", teamChat: "voice2" }`).
*/
nativeNames?: Partial<Record<string, string>> & { default?: string };
/**