refactor: keep plugin sdk owner seams explicit

This commit is contained in:
Peter Steinberger
2026-04-27 12:50:25 +01:00
parent 189535308f
commit eaae63d288
10 changed files with 192 additions and 16 deletions

View File

@@ -1,5 +1,4 @@
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
import { buildCommandsPaginationKeyboard } from "openclaw/plugin-sdk/telegram-command-ui";
import {
buildBrowseProvidersButton,
buildModelsKeyboard,
@@ -7,7 +6,35 @@ import {
type ProviderInfo,
} from "./model-buttons.js";
export { buildCommandsPaginationKeyboard };
export function buildCommandsPaginationKeyboard(
currentPage: number,
totalPages: number,
agentId?: string,
): Array<Array<{ text: string; callback_data: string }>> {
const buttons: Array<{ text: string; callback_data: string }> = [];
const suffix = agentId ? `:${agentId}` : "";
if (currentPage > 1) {
buttons.push({
text: "◀ Prev",
callback_data: `commands_page_${currentPage - 1}${suffix}`,
});
}
buttons.push({
text: `${currentPage}/${totalPages}`,
callback_data: `commands_page_noop${suffix}`,
});
if (currentPage < totalPages) {
buttons.push({
text: "Next ▶",
callback_data: `commands_page_${currentPage + 1}${suffix}`,
});
}
return [buttons];
}
export function buildTelegramModelsMenuButtons(params: { providers: ProviderInfo[] }) {
return buildProviderKeyboard(params.providers);