惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
GbyAI
GbyAI
博客园_首页
V
Visual Studio Blog
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 叶小钗
腾讯CDC
博客园 - Franky
IT之家
IT之家
Google DeepMind News
Google DeepMind News
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
大猫的无限游戏
大猫的无限游戏
Recent Announcements
Recent Announcements
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
B
Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: validate feishu chat page size · openclaw/openclaw@d...
steipete · 2026-05-29 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,3 +1,4 @@

1+

import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";

12

import { Type, type Static } from "typebox";

23
34

const CHAT_ACTION_VALUES = ["members", "info", "member_info"] as const;

@@ -11,7 +12,10 @@ export const FeishuChatSchema = Type.Object({

1112

}),

1213

chat_id: Type.Optional(Type.String({ description: "Chat ID (from URL or event payload)" })),

1314

member_id: Type.Optional(Type.String({ description: "Member ID for member_info lookups" })),

14-

page_size: Type.Optional(Type.Number({ description: "Page size (1-100, default 50)" })),

15+

page_size: optionalPositiveIntegerSchema({

16+

maximum: 100,

17+

description: "Page size (1-100, default 50)",

18+

}),

1519

page_token: Type.Optional(Type.String({ description: "Pagination token" })),

1620

member_id_type: Type.Optional(

1721

Type.Unsafe<(typeof MEMBER_ID_TYPE_VALUES)[number]>({

Original file line numberDiff line numberDiff line change

@@ -167,6 +167,60 @@ describe("registerFeishuChatTools", () => {

167167

});

168168

});

169169
170+

it("advertises and validates member page_size as a positive integer", async () => {

171+

const registerTool = vi.fn();

172+

registerFeishuChatTools(

173+

createChatToolApi({

174+

config: {

175+

channels: {

176+

feishu: {

177+

enabled: true,

178+

appId: "app_id",

179+

appSecret: "app_secret", // pragma: allowlist secret

180+

tools: { chat: true },

181+

},

182+

},

183+

},

184+

registerTool,

185+

}),

186+

);

187+
188+

const tool = registerTool.mock.calls[0]?.[0];

189+

expect(tool?.parameters.properties.page_size).toMatchObject({

190+

type: "integer",

191+

minimum: 1,

192+

maximum: 100,

193+

});

194+
195+

chatMembersGetMock.mockResolvedValueOnce({

196+

code: 0,

197+

data: { has_more: false, items: [] },

198+

});

199+

await tool.execute("tc_page_size_string", {

200+

action: "members",

201+

chat_id: "oc_1",

202+

page_size: "25",

203+

});

204+

expect(chatMembersGetMock).toHaveBeenLastCalledWith({

205+

path: { chat_id: "oc_1" },

206+

params: {

207+

page_size: 25,

208+

page_token: undefined,

209+

member_id_type: "open_id",

210+

},

211+

});

212+
213+

const invalidResult = await tool.execute("tc_page_size_invalid", {

214+

action: "members",

215+

chat_id: "oc_1",

216+

page_size: 0,

217+

});

218+

expect(invalidResult.details.error).toContain(

219+

"page_size must be a positive integer between 1 and 100",

220+

);

221+

expect(chatMembersGetMock).toHaveBeenCalledTimes(1);

222+

});

223+
170224

it("skips registration when chat tool is disabled", () => {

171225

const registerTool = vi.fn();

172226

registerFeishuChatTools(

Original file line numberDiff line numberDiff line change

@@ -1,4 +1,5 @@

11

import type * as Lark from "@larksuiteoapi/node-sdk";

2+

import { readPositiveIntegerParam } from "openclaw/plugin-sdk/param-readers";

23

import type { OpenClawPluginApi } from "../runtime-api.js";

34

import { listEnabledFeishuAccounts } from "./accounts.js";

45

import { FeishuChatSchema, type FeishuChatParams } from "./chat-schema.js";

@@ -13,6 +14,13 @@ function json(data: unknown) {

1314

};

1415

}

1516
17+

function readChatPageSize(params: Record<string, unknown>): number | undefined {

18+

return readPositiveIntegerParam(params, "page_size", {

19+

max: 100,

20+

message: "page_size must be a positive integer between 1 and 100",

21+

});

22+

}

23+
1624

export async function getChatInfo(client: Lark.Client, chatId: string) {

1725

const res = await client.im.chat.get({ path: { chat_id: chatId } });

1826

if (res.code !== 0) {

@@ -146,6 +154,7 @@ export function registerFeishuChatTools(api: OpenClawPluginApi) {

146154

description: "Feishu chat operations. Actions: members, info, member_info",

147155

parameters: FeishuChatSchema,

148156

async execute(_toolCallId, params) {

157+

const rawParams = params as Record<string, unknown>;

149158

const p = params as FeishuChatParams;

150159

try {

151160

const client = getClient();

@@ -158,7 +167,7 @@ export function registerFeishuChatTools(api: OpenClawPluginApi) {

158167

await getChatMembers(

159168

client,

160169

p.chat_id,

161-

p.page_size,

170+

readChatPageSize(rawParams),

162171

p.page_token,

163172

p.member_id_type,

164173

),