@yanhaidao/wecom 2.3.160 → 2.3.180

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +235 -399
  2. package/SKILLS_CAL.md +895 -0
  3. package/SKILLS_DOC.md +2136 -0
  4. package/changelog/v2.3.18.md +22 -0
  5. package/index.ts +39 -3
  6. package/package.json +2 -3
  7. package/src/agent/handler.event-filter.test.ts +11 -0
  8. package/src/agent/handler.ts +732 -643
  9. package/src/app/account-runtime.ts +46 -20
  10. package/src/app/index.ts +19 -1
  11. package/src/capability/calendar/SKILLS_CHECKLIST.md +251 -0
  12. package/src/capability/calendar/client.ts +815 -0
  13. package/src/capability/calendar/index.ts +3 -0
  14. package/src/capability/calendar/schema.ts +417 -0
  15. package/src/capability/calendar/tool.ts +417 -0
  16. package/src/capability/calendar/types.ts +309 -0
  17. package/src/capability/doc/client.ts +567 -62
  18. package/src/capability/doc/schema.ts +419 -318
  19. package/src/capability/doc/tool.ts +1510 -1178
  20. package/src/capability/doc/types.ts +130 -14
  21. package/src/capability/mcp/index.ts +10 -0
  22. package/src/capability/mcp/schema.ts +107 -0
  23. package/src/capability/mcp/tool.ts +170 -0
  24. package/src/capability/mcp/transport.ts +394 -0
  25. package/src/channel.ts +70 -28
  26. package/src/config/schema.ts +71 -102
  27. package/src/outbound.test.ts +91 -14
  28. package/src/outbound.ts +143 -30
  29. package/src/runtime/reply-orchestrator.test.ts +35 -2
  30. package/src/runtime/reply-orchestrator.ts +14 -2
  31. package/src/runtime/session-manager.ts +20 -6
  32. package/src/runtime/source-registry.ts +165 -0
  33. package/src/transport/bot-ws/media.ts +269 -0
  34. package/src/transport/bot-ws/reply.test.ts +85 -17
  35. package/src/transport/bot-ws/reply.ts +109 -21
  36. package/src/transport/bot-ws/sdk-adapter.test.ts +64 -1
  37. package/src/transport/bot-ws/sdk-adapter.ts +88 -12
  38. package/.claude/settings.local.json +0 -11
  39. package/docs/update-content-fix.md +0 -135
@@ -1,427 +1,479 @@
1
1
  const accountIdProperty = {
2
- type: "string",
3
- minLength: 1,
4
- description: "可选:指定企业微信账号 ID;不填时按 agent 账号/默认账号自动选择",
2
+ type: "string",
3
+ minLength: 1,
4
+ description:
5
+ "可选:指定企业微信账号 ID;不填时按 agent 账号/默认账号自动选择",
5
6
  };
6
7
 
7
8
  const docTypeProperty = {
8
- oneOf: [
9
- {
10
- type: "string",
11
- enum: ["doc", "spreadsheet", "smart_table"],
12
- },
13
- {
14
- type: "integer",
15
- enum: [3, 4, 10],
16
- },
17
- ],
18
- default: "doc",
19
- description: "文档类型:doc=文档,spreadsheet=表格,smart_table=智能表格",
9
+ oneOf: [
10
+ {
11
+ type: "string",
12
+ enum: ["doc", "spreadsheet", "smart_table"],
13
+ },
14
+ {
15
+ type: "integer",
16
+ enum: [3, 4, 10],
17
+ },
18
+ ],
19
+ default: "doc",
20
+ description: "文档类型:doc=文档,spreadsheet=表格,smart_table=智能表格",
20
21
  };
21
22
 
22
23
  const sheetIdProperty = {
23
- type: "string",
24
- minLength: 1,
25
- description: "子表 ID (sheet_id)",
24
+ type: "string",
25
+ minLength: 1,
26
+ description: "子表 ID (sheet_id)",
26
27
  };
27
28
 
28
29
  const docIdProperty = {
29
- type: "string",
30
- minLength: 1,
31
- description: "文档 docid",
30
+ type: "string",
31
+ minLength: 1,
32
+ description: "文档 docid",
32
33
  };
33
34
 
34
35
  const formIdProperty = {
35
- type: "string",
36
- minLength: 1,
37
- description: "收集表 formid",
36
+ type: "string",
37
+ minLength: 1,
38
+ description: "收集表 formid",
38
39
  };
39
40
 
40
41
  const shareUrlProperty = {
41
- type: "string",
42
- minLength: 1,
43
- description: "企业微信文档分享链接",
42
+ type: "string",
43
+ minLength: 1,
44
+ description: "企业微信文档分享链接",
44
45
  };
45
46
 
46
47
  const genericObjectProperty = {
47
- type: "object",
48
- additionalProperties: true,
48
+ type: "object",
49
+ additionalProperties: true,
49
50
  };
50
51
 
51
52
  const nonEmptyObjectProperty = {
52
- ...genericObjectProperty,
53
- minProperties: 1,
53
+ ...genericObjectProperty,
54
+ minProperties: 1,
55
+ };
56
+
57
+ // --- Form Statistics Schema ---
58
+
59
+ const formStatisticRequestSchema = {
60
+ type: "object",
61
+ required: ["req_type", "repeated_id"],
62
+ properties: {
63
+ req_type: {
64
+ type: "integer",
65
+ enum: [1, 2, 3],
66
+ description: "统计类型:1-仅获取统计结果,2-获取已提交列表(需 start_time 和 end_time),3-获取未提交列表"
67
+ },
68
+ repeated_id: { type: "string", description: "收集表 repeated_id" },
69
+ start_time: { type: "integer", description: "可选:开始时间戳(毫秒),req_type=2 时必填" },
70
+ end_time: { type: "integer", description: "可选:结束时间戳(毫秒),req_type=2 时必填" },
71
+ limit: { type: "integer", description: "可选:分页大小,最大 10000" },
72
+ cursor: { type: "integer", description: "可选:分页游标" },
73
+ },
54
74
  };
55
75
 
56
76
  // --- Doc Permission Schemas ---
57
77
 
58
78
  const coAuthListProperty = {
59
- type: "array",
60
- items: {
61
- type: "object",
62
- required: ["departmentid", "auth", "type"],
63
- properties: {
64
- departmentid: { type: "integer", description: "特定部门id" },
65
- auth: { type: "integer", enum: [1, 2], description: "1:只读, 2:读写" },
66
- type: { type: "integer", const: 2, description: "2:部门" }
67
- }
68
- }
79
+ type: "array",
80
+ items: {
81
+ type: "object",
82
+ required: ["departmentid", "auth", "type"],
83
+ properties: {
84
+ departmentid: { type: "integer", description: "特定部门id" },
85
+ auth: { type: "integer", enum: [1, 2], description: "1:只读, 2:读写" },
86
+ type: { type: "integer", const: 2, description: "2:部门" },
87
+ },
88
+ },
69
89
  };
70
90
 
71
91
  const docMemberListProperty = {
72
- type: "array",
73
- items: {
74
- type: "object",
75
- required: ["type", "auth"],
76
- properties: {
77
- type: { type: "integer", const: 1, description: "1:用户" },
78
- userid: { type: "string", description: "企业成员userid" },
79
- tmp_external_userid: { type: "string", description: "外部用户临时id" },
80
- auth: { type: "integer", enum: [1, 2, 7], description: "1:只读 2:读写 7:管理员" }
81
- }
82
- }
92
+ type: "array",
93
+ items: {
94
+ type: "object",
95
+ required: ["type", "auth"],
96
+ properties: {
97
+ type: { type: "integer", const: 1, description: "1:用户" },
98
+ userid: { type: "string", description: "企业成员userid" },
99
+ tmp_external_userid: { type: "string", description: "外部用户临时id" },
100
+ auth: {
101
+ type: "integer",
102
+ enum: [1, 2, 7],
103
+ description: "1:只读 2:读写 7:管理员",
104
+ },
105
+ },
106
+ },
83
107
  };
84
108
 
85
109
  const delDocMemberListProperty = {
86
- type: "array",
87
- items: {
88
- type: "object",
89
- required: ["type"],
90
- properties: {
91
- type: { type: "integer", const: 1 },
92
- userid: { type: "string" },
93
- tmp_external_userid: { type: "string" }
94
- }
95
- }
110
+ type: "array",
111
+ items: {
112
+ type: "object",
113
+ required: ["type"],
114
+ properties: {
115
+ type: { type: "integer", const: 1 },
116
+ userid: { type: "string" },
117
+ tmp_external_userid: { type: "string" },
118
+ },
119
+ },
96
120
  };
97
121
 
98
122
  const watermarkProperty = {
99
- type: "object",
100
- properties: {
101
- margin_type: { type: "integer", enum: [1, 2], description: "1:稀疏, 2:紧密" },
102
- show_visitor_name: { type: "boolean" },
103
- show_text: { type: "boolean" },
104
- text: { type: "string" }
105
- }
123
+ type: "object",
124
+ properties: {
125
+ margin_type: {
126
+ type: "integer",
127
+ enum: [1, 2],
128
+ description: "1:稀疏, 2:紧密",
129
+ },
130
+ show_visitor_name: { type: "boolean" },
131
+ show_text: { type: "boolean" },
132
+ text: { type: "string" },
133
+ },
106
134
  };
107
135
 
108
136
  // --- Smartsheet Permission Schemas ---
109
137
 
110
138
  const fieldRuleListSchema = {
111
- type: "array",
112
- items: {
113
- type: "object",
114
- required: ["field_id", "can_edit", "can_insert", "can_view"],
115
- properties: {
116
- field_id: { type: "string" },
117
- field_type: { type: "string" },
118
- can_edit: { type: "boolean" },
119
- can_insert: { type: "boolean" },
120
- can_view: { type: "boolean" }
121
- }
122
- }
139
+ type: "array",
140
+ items: {
141
+ type: "object",
142
+ required: ["field_id", "can_edit", "can_insert", "can_view"],
143
+ properties: {
144
+ field_id: { type: "string" },
145
+ field_type: { type: "string" },
146
+ can_edit: { type: "boolean" },
147
+ can_insert: { type: "boolean" },
148
+ can_view: { type: "boolean" },
149
+ },
150
+ },
123
151
  };
124
152
 
125
153
  const fieldPrivSchema = {
126
- type: "object",
127
- required: ["field_range_type", "field_rule_list"],
128
- properties: {
129
- field_range_type: { type: "integer", enum: [1, 2], description: "1-所有字段;2-部分字段" },
130
- field_rule_list: fieldRuleListSchema,
131
- field_default_rule: {
132
- type: "object",
133
- properties: {
134
- can_edit: { type: "boolean" },
135
- can_insert: { type: "boolean" },
136
- can_view: { type: "boolean" }
137
- }
138
- }
139
- }
154
+ type: "object",
155
+ required: ["field_range_type", "field_rule_list"],
156
+ properties: {
157
+ field_range_type: {
158
+ type: "integer",
159
+ enum: [1, 2],
160
+ description: "1-所有字段;2-部分字段",
161
+ },
162
+ field_rule_list: fieldRuleListSchema,
163
+ field_default_rule: {
164
+ type: "object",
165
+ properties: {
166
+ can_edit: { type: "boolean" },
167
+ can_insert: { type: "boolean" },
168
+ can_view: { type: "boolean" },
169
+ },
170
+ },
171
+ },
140
172
  };
141
173
 
142
174
  const recordRuleListSchema = {
143
- type: "array",
144
- items: {
145
- type: "object",
146
- required: ["field_id", "oper_type"],
147
- properties: {
148
- field_id: { type: "string" },
149
- field_type: { type: "string" },
150
- oper_type: { type: "integer", description: "1-包含自己; 2-包含value; 3-不包含; 4-等于; 5-不等于; 6-为空; 7-非空" },
151
- value: { type: "array", items: { type: "string" } }
152
- }
153
- }
175
+ type: "array",
176
+ items: {
177
+ type: "object",
178
+ required: ["field_id", "oper_type"],
179
+ properties: {
180
+ field_id: { type: "string" },
181
+ field_type: { type: "string" },
182
+ oper_type: {
183
+ type: "integer",
184
+ description:
185
+ "1-包含自己; 2-包含value; 3-不包含; 4-等于; 5-不等于; 6-为空; 7-非空",
186
+ },
187
+ value: { type: "array", items: { type: "string" } },
188
+ },
189
+ },
154
190
  };
155
191
 
156
192
  const recordPrivSchema = {
157
- type: "object",
158
- required: ["record_range_type"],
159
- properties: {
160
- record_range_type: { type: "integer", enum: [1, 2, 3], description: "1-全部; 2-任意条件; 3-全部条件" },
161
- record_rule_list: recordRuleListSchema,
162
- other_priv: { type: "integer", enum: [1, 2], description: "1-不可编辑; 2-不可查看" }
163
- }
193
+ type: "object",
194
+ required: ["record_range_type"],
195
+ properties: {
196
+ record_range_type: {
197
+ type: "integer",
198
+ enum: [1, 2, 3],
199
+ description: "1-全部; 2-任意条件; 3-全部条件",
200
+ },
201
+ record_rule_list: recordRuleListSchema,
202
+ other_priv: {
203
+ type: "integer",
204
+ enum: [1, 2],
205
+ description: "1-不可编辑; 2-不可查看",
206
+ },
207
+ },
164
208
  };
165
209
 
166
210
  const privListSchema = {
167
- type: "array",
168
- items: {
169
- type: "object",
170
- required: ["sheet_id", "priv"],
171
- properties: {
172
- sheet_id: { type: "string" },
173
- priv: {
174
- oneOf: [{ type: "string" }, { type: "integer" }],
175
- description: "1-全部权限;2-可编辑;3-仅浏览;4-无权限"
176
- },
177
- can_insert_record: { type: "boolean" },
178
- can_delete_record: { type: "boolean" },
179
- can_create_modify_delete_view: { type: "boolean" },
180
- field_priv: fieldPrivSchema,
181
- record_priv: recordPrivSchema,
182
- clear: { type: "boolean" }
183
- }
184
- }
211
+ type: "array",
212
+ items: {
213
+ type: "object",
214
+ required: ["sheet_id", "priv"],
215
+ properties: {
216
+ sheet_id: { type: "string" },
217
+ priv: {
218
+ oneOf: [{ type: "string" }, { type: "integer" }],
219
+ description: "1-全部权限;2-可编辑;3-仅浏览;4-无权限",
220
+ },
221
+ can_insert_record: { type: "boolean" },
222
+ can_delete_record: { type: "boolean" },
223
+ can_create_modify_delete_view: { type: "boolean" },
224
+ field_priv: fieldPrivSchema,
225
+ record_priv: recordPrivSchema,
226
+ clear: { type: "boolean" },
227
+ },
228
+ },
185
229
  };
186
230
 
187
231
  const memberRangeSchema = {
188
- type: "object",
189
- properties: {
190
- userid_list: { type: "array", items: { type: "string" } }
191
- }
232
+ type: "object",
233
+ properties: {
234
+ userid_list: { type: "array", items: { type: "string" } },
235
+ },
192
236
  };
193
237
 
194
238
  // --- Doc Content Update Schemas ---
195
239
 
196
240
  const locationProperty = {
197
- type: "object",
198
- required: ["index"],
199
- properties: {
200
- index: { type: "integer", minimum: 0, description: "位置索引" }
201
- }
241
+ type: "object",
242
+ required: ["index"],
243
+ properties: {
244
+ index: { type: "integer", minimum: 0, description: "位置索引" },
245
+ },
202
246
  };
203
247
 
204
248
  const rangeProperty = {
205
- type: "object",
206
- required: ["start_index", "length"],
207
- properties: {
208
- start_index: { type: "integer", minimum: 0, description: "起始位置" },
209
- length: { type: "integer", minimum: 1, description: "长度" }
210
- }
249
+ type: "object",
250
+ required: ["start_index", "length"],
251
+ properties: {
252
+ start_index: { type: "integer", minimum: 0, description: "起始位置" },
253
+ length: { type: "integer", minimum: 1, description: "长度" },
254
+ },
211
255
  };
212
256
 
213
257
  const textPropertySchema = {
214
- type: "object",
215
- description: "文本属性",
216
- properties: {
217
- bold: { type: "boolean" },
218
- italics: { type: "boolean" },
219
- underline: { type: "boolean" },
220
- strike: { type: "boolean" },
221
- color: { type: "string", pattern: "^[0-9A-Fa-f]{6}$", description: "RRGGBB 格式颜色" },
222
- background_color: { type: "string", pattern: "^[0-9A-Fa-f]{6}$", description: "RRGGBB 格式背景色" },
223
- size: { type: "integer", description: "字体大小(half-points)" }
224
- }
258
+ type: "object",
259
+ description: "文本属性",
260
+ properties: {
261
+ bold: { type: "boolean" },
262
+ italics: { type: "boolean" },
263
+ underline: { type: "boolean" },
264
+ strike: { type: "boolean" },
265
+ color: {
266
+ type: "string",
267
+ pattern: "^[0-9A-Fa-f]{6}$",
268
+ description: "RRGGBB 格式颜色",
269
+ },
270
+ background_color: {
271
+ type: "string",
272
+ pattern: "^[0-9A-Fa-f]{6}$",
273
+ description: "RRGGBB 格式背景色",
274
+ },
275
+ size: { type: "integer", description: "字体大小(half-points)" },
276
+ },
225
277
  };
226
278
 
227
279
  const insertTextRequest = {
228
- type: "object",
229
- required: ["text", "location"],
230
- properties: {
231
- text: { type: "string", minLength: 1 },
232
- location: locationProperty
233
- }
280
+ type: "object",
281
+ required: ["text", "location"],
282
+ properties: {
283
+ text: { type: "string", minLength: 1 },
284
+ location: locationProperty,
285
+ },
234
286
  };
235
287
 
236
288
  const replaceTextRequest = {
237
- type: "object",
238
- required: ["text", "ranges"],
239
- properties: {
240
- text: { type: "string" },
241
- ranges: { type: "array", items: rangeProperty, minItems: 1 }
242
- }
289
+ type: "object",
290
+ required: ["text", "ranges"],
291
+ properties: {
292
+ text: { type: "string" },
293
+ ranges: { type: "array", items: rangeProperty, minItems: 1 },
294
+ },
243
295
  };
244
296
 
245
297
  const deleteContentRequest = {
246
- type: "object",
247
- required: ["range"],
248
- properties: {
249
- range: rangeProperty
250
- }
298
+ type: "object",
299
+ required: ["range"],
300
+ properties: {
301
+ range: rangeProperty,
302
+ },
251
303
  };
252
304
 
253
305
  const updateTextPropertyRequest = {
254
- type: "object",
255
- required: ["text_property", "ranges"],
256
- properties: {
257
- text_property: textPropertySchema,
258
- ranges: { type: "array", items: rangeProperty, minItems: 1 }
259
- }
306
+ type: "object",
307
+ required: ["text_property", "ranges"],
308
+ properties: {
309
+ text_property: textPropertySchema,
310
+ ranges: { type: "array", items: rangeProperty, minItems: 1 },
311
+ },
260
312
  };
261
313
 
262
314
  const insertImageRequest = {
263
- type: "object",
264
- required: ["image_id", "location"],
265
- properties: {
266
- image_id: { type: "string", description: "上传图片获得的 image_id/url" },
267
- location: locationProperty,
268
- width: { type: "integer", description: "宽(px)" },
269
- height: { type: "integer", description: "高(px)" }
270
- }
315
+ type: "object",
316
+ required: ["image_id", "location"],
317
+ properties: {
318
+ image_id: { type: "string", description: "上传图片获得的 image_id/url" },
319
+ location: locationProperty,
320
+ width: { type: "integer", description: "宽(px)" },
321
+ height: { type: "integer", description: "高(px)" },
322
+ },
271
323
  };
272
324
 
273
325
  const insertPageBreakRequest = {
274
- type: "object",
275
- required: ["location"],
276
- properties: {
277
- location: locationProperty
278
- }
326
+ type: "object",
327
+ required: ["location"],
328
+ properties: {
329
+ location: locationProperty,
330
+ },
279
331
  };
280
332
 
281
333
  const insertTableRequest = {
282
- type: "object",
283
- required: ["rows", "cols", "location"],
284
- properties: {
285
- rows: { type: "integer", minimum: 1, maximum: 100 },
286
- cols: { type: "integer", minimum: 1, maximum: 60 },
287
- location: locationProperty
288
- }
334
+ type: "object",
335
+ required: ["rows", "cols", "location"],
336
+ properties: {
337
+ rows: { type: "integer", minimum: 1, maximum: 100 },
338
+ cols: { type: "integer", minimum: 1, maximum: 60 },
339
+ location: locationProperty,
340
+ },
289
341
  };
290
342
 
291
343
  const insertParagraphRequest = {
292
- type: "object",
293
- description: "在指定位置插入段落。注意:请使用此操作来分段,而不是在 insert_text 中使用换行符。",
294
- required: ["location"],
295
- properties: {
296
- location: locationProperty
297
- }
344
+ type: "object",
345
+ description:
346
+ "在指定位置插入段落。注意:请使用此操作来分段,而不是在 insert_text 中使用换行符。",
347
+ required: ["location"],
348
+ properties: {
349
+ location: locationProperty,
350
+ },
298
351
  };
299
352
 
300
353
  // --- Spreadsheet Update Schemas ---
301
354
 
302
355
  const addSheetRequest = {
303
- type: "object",
304
- required: ["title"],
305
- properties: {
306
- title: { type: "string", minLength: 1 },
307
- row_count: { type: "integer", minimum: 1 },
308
- column_count: { type: "integer", minimum: 1 }
309
- }
356
+ type: "object",
357
+ required: ["title"],
358
+ properties: {
359
+ title: { type: "string", minLength: 1 },
360
+ row_count: { type: "integer", minimum: 1 },
361
+ column_count: { type: "integer", minimum: 1 },
362
+ },
310
363
  };
311
364
 
312
365
  const deleteSheetRequest = {
313
- type: "object",
314
- required: ["sheet_id"],
315
- properties: {
316
- sheet_id: { type: "string", minLength: 1 }
317
- }
366
+ type: "object",
367
+ required: ["sheet_id"],
368
+ properties: {
369
+ sheet_id: { type: "string", minLength: 1 },
370
+ },
318
371
  };
319
372
 
320
373
  const deleteDimensionRequest = {
321
- type: "object",
322
- required: ["sheet_id", "dimension", "start_index", "end_index"],
323
- properties: {
324
- sheet_id: { type: "string" },
325
- dimension: { type: "string", enum: ["ROW", "COLUMN"] },
326
- start_index: { type: "integer", minimum: 1 },
327
- end_index: { type: "integer", minimum: 2 }
328
- }
374
+ type: "object",
375
+ required: ["sheet_id", "dimension", "start_index", "end_index"],
376
+ properties: {
377
+ sheet_id: { type: "string" },
378
+ dimension: { type: "string", enum: ["ROW", "COLUMN"] },
379
+ start_index: { type: "integer", minimum: 1 },
380
+ end_index: { type: "integer", minimum: 2 },
381
+ },
329
382
  };
330
383
 
331
384
  const cellValueSchema = {
332
- type: "object",
333
- properties: {
385
+ type: "object",
386
+ properties: {
387
+ text: { type: "string" },
388
+ link: {
389
+ type: "object",
390
+ required: ["text", "url"],
391
+ properties: {
334
392
  text: { type: "string" },
335
- link: {
336
- type: "object",
337
- required: ["text", "url"],
338
- properties: {
339
- text: { type: "string" },
340
- url: { type: "string" }
341
- }
342
- }
343
- }
393
+ url: { type: "string" },
394
+ },
395
+ },
396
+ },
344
397
  };
345
398
 
346
399
  const cellFormatSchema = {
347
- type: "object",
348
- properties: {
349
- text_format: {
350
- type: "object",
351
- properties: {
352
- bold: { type: "boolean" },
353
- italic: { type: "boolean" },
354
- strikethrough: { type: "boolean" },
355
- underline: { type: "boolean" },
356
- color: {
357
- type: "object",
358
- required: ["red", "green", "blue"],
359
- properties: {
360
- red: { type: "integer", minimum: 0, maximum: 255 },
361
- green: { type: "integer", minimum: 0, maximum: 255 },
362
- blue: { type: "integer", minimum: 0, maximum: 255 },
363
- alpha: { type: "integer", minimum: 0, maximum: 255 }
364
- }
365
- },
366
- font_size: { type: "integer" }
367
- }
368
- }
369
- }
400
+ type: "object",
401
+ properties: {
402
+ text_format: {
403
+ type: "object",
404
+ properties: {
405
+ bold: { type: "boolean" },
406
+ italic: { type: "boolean" },
407
+ strikethrough: { type: "boolean" },
408
+ underline: { type: "boolean" },
409
+ color: {
410
+ type: "object",
411
+ required: ["red", "green", "blue"],
412
+ properties: {
413
+ red: { type: "integer", minimum: 0, maximum: 255 },
414
+ green: { type: "integer", minimum: 0, maximum: 255 },
415
+ blue: { type: "integer", minimum: 0, maximum: 255 },
416
+ alpha: { type: "integer", minimum: 0, maximum: 255 },
417
+ },
418
+ },
419
+ font_size: { type: "integer" },
420
+ },
421
+ },
422
+ },
370
423
  };
371
424
 
372
425
  const cellDataSchema = {
373
- type: "object",
374
- properties: {
375
- cell_value: cellValueSchema,
376
- cell_format: cellFormatSchema
377
- }
426
+ type: "object",
427
+ properties: {
428
+ cell_value: cellValueSchema,
429
+ cell_format: cellFormatSchema,
430
+ },
378
431
  };
379
432
 
380
433
  const rowDataSchema = {
381
- type: "object",
382
- required: ["values"],
383
- properties: {
384
- values: {
385
- type: "array",
386
- items: cellDataSchema
387
- }
388
- }
434
+ type: "object",
435
+ required: ["values"],
436
+ properties: {
437
+ values: {
438
+ type: "array",
439
+ items: cellDataSchema,
440
+ },
441
+ },
389
442
  };
390
443
 
391
444
  const gridDataSchema = {
392
- type: "object",
393
- required: ["rows"],
394
- properties: {
395
- start_row: { type: "integer", default: 0 },
396
- start_column: { type: "integer", default: 0 },
397
- rows: {
398
- type: "array",
399
- items: rowDataSchema
400
- }
401
- }
445
+ type: "object",
446
+ required: ["rows"],
447
+ properties: {
448
+ start_row: { type: "integer", default: 0 },
449
+ start_column: { type: "integer", default: 0 },
450
+ rows: {
451
+ type: "array",
452
+ items: rowDataSchema,
453
+ },
454
+ },
402
455
  };
403
456
 
404
457
  const updateRangeRequest = {
405
- type: "object",
406
- required: ["sheet_id", "grid_data"],
407
- properties: {
408
- sheet_id: { type: "string" },
409
- grid_data: gridDataSchema
410
- }
458
+ type: "object",
459
+ required: ["sheet_id", "grid_data"],
460
+ properties: {
461
+ sheet_id: { type: "string" },
462
+ grid_data: gridDataSchema,
463
+ },
411
464
  };
412
465
 
413
-
414
466
  const docMemberEntryProperty = {
415
- oneOf: [
416
- { type: "string", minLength: 1 },
417
- { type: "object", additionalProperties: true, minProperties: 1 },
418
- ],
467
+ oneOf: [
468
+ { type: "string", minLength: 1 },
469
+ { type: "object", additionalProperties: true, minProperties: 1 },
470
+ ],
419
471
  };
420
472
 
421
473
  const docMemberEntryArrayProperty = {
422
- type: "array",
423
- minItems: 1,
424
- items: docMemberEntryProperty,
474
+ type: "array",
475
+ minItems: 1,
476
+ items: docMemberEntryProperty,
425
477
  };
426
478
 
427
479
  export const wecomDocToolSchema = {
@@ -798,7 +850,7 @@ export const wecomDocToolSchema = {
798
850
  additionalProperties: false,
799
851
  required: ["action", "formInfo"],
800
852
  properties: {
801
- action: { const: "create_collect" },
853
+ action: { const: "create_form" },
802
854
  accountId: accountIdProperty,
803
855
  formInfo: {
804
856
  ...nonEmptyObjectProperty,
@@ -821,12 +873,12 @@ export const wecomDocToolSchema = {
821
873
  additionalProperties: false,
822
874
  required: ["action", "oper", "formId", "formInfo"],
823
875
  properties: {
824
- action: { const: "modify_collect" },
876
+ action: { const: "modify_form" },
825
877
  accountId: accountIdProperty,
826
878
  oper: {
827
879
  type: "string",
828
880
  minLength: 1,
829
- description: "修改操作类型,按企业微信官方 modify_collect 定义填写",
881
+ description: "修改操作类型:1=全量修改问题,2=全量修改设置(按企业微信官方 modify_form 定义)",
830
882
  },
831
883
  formId: formIdProperty,
832
884
  formInfo: {
@@ -876,8 +928,8 @@ export const wecomDocToolSchema = {
876
928
  requests: {
877
929
  type: "array",
878
930
  minItems: 1,
879
- description: "统计请求列表;每项按企业微信 get_form_statistic 官方结构填写",
880
- items: nonEmptyObjectProperty,
931
+ description: "统计请求列表",
932
+ items: formStatisticRequestSchema,
881
933
  },
882
934
  },
883
935
  },
@@ -1119,9 +1171,16 @@ export const wecomDocToolSchema = {
1119
1171
  accountId: accountIdProperty,
1120
1172
  docId: docIdProperty,
1121
1173
  sheetId: { type: "string", description: "子表 ID" },
1174
+ view_id: { type: "string", description: "可选:视图 ID" },
1122
1175
  record_ids: { type: "array", items: { type: "string" }, description: "可选:指定记录 ID 列表" },
1123
- offset: { type: "integer" },
1124
- limit: { type: "integer" },
1176
+ key_type: { type: "string", enum: ["CELL_VALUE_KEY_TYPE_FIELD_TITLE", "CELL_VALUE_KEY_TYPE_FIELD_ID"], description: "可选:返回记录中单元格的 key 类型" },
1177
+ field_titles: { type: "array", items: { type: "string" }, description: "可选:返回指定列(字段标题),key_type 为 FIELD_TITLE 时有效" },
1178
+ field_ids: { type: "array", items: { type: "string" }, description: "可选:返回指定列(字段 ID),key_type 为 FIELD_ID 时有效" },
1179
+ sort: { type: "array", items: { type: "object" }, description: "可选:对返回记录进行排序" },
1180
+ offset: { type: "integer", description: "可选:偏移量,初始值为 0" },
1181
+ limit: { type: "integer", description: "可选:分页大小,最大 1000" },
1182
+ ver: { type: "integer", description: "可选:版本号" },
1183
+ filter_spec: { type: "object", description: "可选:过滤设置,不支持和 sort 一起使用" },
1125
1184
  },
1126
1185
  },
1127
1186
  {
@@ -1134,6 +1193,10 @@ export const wecomDocToolSchema = {
1134
1193
  docId: docIdProperty,
1135
1194
  sheetId: { type: "string", description: "子表 ID" },
1136
1195
  view_id: { type: "string", description: "可选:视图 ID" },
1196
+ field_ids: { type: "array", items: { type: "string" }, description: "可选:由字段 ID 组成的数组" },
1197
+ field_titles: { type: "array", items: { type: "string" }, description: "可选:由字段标题组成的数组" },
1198
+ offset: { type: "integer", description: "可选:偏移量,初始值为 0" },
1199
+ limit: { type: "integer", maximum: 1000, description: "可选:分页大小,最大 1000" },
1137
1200
  },
1138
1201
  },
1139
1202
  {
@@ -1145,6 +1208,9 @@ export const wecomDocToolSchema = {
1145
1208
  accountId: accountIdProperty,
1146
1209
  docId: docIdProperty,
1147
1210
  sheetId: { type: "string", description: "子表 ID" },
1211
+ view_ids: { type: "array", items: { type: "string" }, description: "可选:需要查询的视图 ID 数组" },
1212
+ offset: { type: "integer", description: "可选:偏移量,初始值为 0" },
1213
+ limit: { type: "integer", description: "可选:分页大小,最大 1000" },
1148
1214
  },
1149
1215
  },
1150
1216
  {
@@ -1155,6 +1221,8 @@ export const wecomDocToolSchema = {
1155
1221
  action: { const: "smartsheet_get_sheets" },
1156
1222
  accountId: accountIdProperty,
1157
1223
  docId: docIdProperty,
1224
+ sheet_id: { type: "string", description: "可选:指定子表 ID 查询" },
1225
+ need_all_type_sheet: { type: "boolean", description: "可选:获取所有类型子表(包含仪表盘和说明页)" },
1158
1226
  },
1159
1227
  },
1160
1228
  {
@@ -1194,7 +1262,7 @@ export const wecomDocToolSchema = {
1194
1262
  },
1195
1263
  {
1196
1264
  type: "object",
1197
- additionalProperties: false,
1265
+ additionalProperties: true,
1198
1266
  required: ["action", "docId", "sheetId", "view_title", "view_type"],
1199
1267
  properties: {
1200
1268
  action: { const: "smartsheet_add_view" },
@@ -1207,13 +1275,26 @@ export const wecomDocToolSchema = {
1207
1275
  enum: ["VIEW_TYPE_GRID", "VIEW_TYPE_KANBAN", "VIEW_TYPE_GALLERY", "VIEW_TYPE_GANTT", "VIEW_TYPE_CALENDAR"],
1208
1276
  description: "视图类型"
1209
1277
  },
1210
- property_gantt: genericObjectProperty,
1211
- property_calendar: genericObjectProperty,
1278
+ property: {
1279
+ type: "object",
1280
+ description: "视图属性(ViewProperty),包含 sort_spec, filter_spec, group_spec 等",
1281
+ additionalProperties: true,
1282
+ },
1283
+ property_gantt: {
1284
+ type: "object",
1285
+ description: "甘特视图属性(已废弃,请使用 property)",
1286
+ additionalProperties: true,
1287
+ },
1288
+ property_calendar: {
1289
+ type: "object",
1290
+ description: "日历视图属性(已废弃,请使用 property)",
1291
+ additionalProperties: true,
1292
+ },
1212
1293
  },
1213
1294
  },
1214
1295
  {
1215
1296
  type: "object",
1216
- additionalProperties: false,
1297
+ additionalProperties: true,
1217
1298
  required: ["action", "docId", "sheetId", "view_id"],
1218
1299
  properties: {
1219
1300
  action: { const: "smartsheet_update_view" },
@@ -1221,9 +1302,22 @@ export const wecomDocToolSchema = {
1221
1302
  docId: docIdProperty,
1222
1303
  sheetId: sheetIdProperty,
1223
1304
  view_id: { type: "string", description: "视图 ID" },
1224
- view_title: { type: "string", description: "视图标题" },
1225
- property_gantt: genericObjectProperty,
1226
- property_calendar: genericObjectProperty,
1305
+ view_title: { type: "string", description: "视图标题(可选)" },
1306
+ property: {
1307
+ type: "object",
1308
+ description: "视图属性(ViewProperty),包含 sort_spec, filter_spec, group_spec, color_config 等",
1309
+ additionalProperties: true,
1310
+ },
1311
+ property_gantt: {
1312
+ type: "object",
1313
+ description: "甘特视图属性(已废弃,请使用 property)",
1314
+ additionalProperties: true,
1315
+ },
1316
+ property_calendar: {
1317
+ type: "object",
1318
+ description: "日历视图属性(已废弃,请使用 property)",
1319
+ additionalProperties: true,
1320
+ },
1227
1321
  },
1228
1322
  },
1229
1323
  {
@@ -1394,16 +1488,23 @@ export const wecomDocToolSchema = {
1394
1488
  },
1395
1489
  {
1396
1490
  type: "object",
1397
- additionalProperties: false,
1491
+ additionalProperties: true,
1398
1492
  required: ["action", "docId", "sheetId"],
1399
1493
  properties: {
1400
1494
  action: { const: "smartsheet_get_records" },
1401
1495
  accountId: accountIdProperty,
1402
1496
  docId: docIdProperty,
1403
1497
  sheetId: { type: "string", description: "子表 ID" },
1498
+ view_id: { type: "string", description: "可选:视图 ID" },
1404
1499
  record_ids: { type: "array", items: { type: "string" }, description: "可选:指定记录 ID 列表" },
1405
- offset: { type: "integer" },
1406
- limit: { type: "integer" },
1500
+ key_type: { type: "string", enum: ["CELL_VALUE_KEY_TYPE_FIELD_TITLE", "CELL_VALUE_KEY_TYPE_FIELD_ID"], description: "可选:返回记录中单元格的 key 类型" },
1501
+ field_titles: { type: "array", items: { type: "string" }, description: "可选:返回指定列(字段标题)" },
1502
+ field_ids: { type: "array", items: { type: "string" }, description: "可选:返回指定列(字段 ID)" },
1503
+ sort: { type: "array", items: { type: "object" }, description: "可选:对返回记录进行排序" },
1504
+ offset: { type: "integer", description: "可选:偏移量,初始值为 0" },
1505
+ limit: { type: "integer", description: "可选:分页大小,最大 1000" },
1506
+ ver: { type: "integer", description: "可选:版本号" },
1507
+ filter_spec: { type: "object", description: "可选:过滤设置,不支持和 sort 一起使用" },
1407
1508
  },
1408
1509
  },
1409
1510
  {
@@ -1430,9 +1531,9 @@ export const wecomDocToolSchema = {
1430
1531
  action: { const: "smartsheet_update_sheet_priv" },
1431
1532
  accountId: accountIdProperty,
1432
1533
  docId: docIdProperty,
1433
- type: { type: "integer", enum: [1, 2], const: 2, description: "必须为2 (额外权限) ? 或支持1? 文档update_sheet_priv支持更新全员(type=1)或额外(type=2)" },
1434
- rule_id: { type: "integer" },
1435
- name: { type: "string" },
1534
+ type: { type: "integer", enum: [1, 2], description: "权限规则类型:1-全员权限,2-额外权限" },
1535
+ rule_id: { type: "integer", description: "当 type=2 时必填(额外权限规则 ID)" },
1536
+ name: { type: "string", description: "权限规则名称(仅 type=2 时有效)" },
1436
1537
  priv_list: privListSchema,
1437
1538
  },
1438
1539
  },
@@ -1498,7 +1599,7 @@ export const wecomDocToolSchema = {
1498
1599
  properties: {
1499
1600
  action: { const: "doc_get_advanced_account_list" },
1500
1601
  accountId: accountIdProperty,
1501
- offset: { type: "integer" },
1602
+ cursor: { type: "integer", description: "分页游标(从 0 开始)" },
1502
1603
  limit: { type: "integer" },
1503
1604
  },
1504
1605
  },