@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
@@ -0,0 +1,309 @@
1
+ // ============================================================================
2
+ // Calendar Types (日历类型定义)
3
+ // 完整参考企业微信官方 API 文档:https://developer.work.weixin.qq.com/document/path/93329
4
+ // ============================================================================
5
+
6
+ // --- Calendar Interfaces ---
7
+
8
+ export interface CalendarSharesEntry {
9
+ userid: string;
10
+ permission?: 1 | 3; // 1: 可查看,3: 仅查看闲忙状态
11
+ }
12
+
13
+ export interface CalendarPublicRange {
14
+ userids?: string[]; // 公开的成员列表,最多 1000 个
15
+ partyids?: number[]; // 公开的部门列表,最多 100 个
16
+ }
17
+
18
+ export interface CreateCalendarRequest {
19
+ calendar: {
20
+ admins?: string[]; // 日历管理员,最多 3 人
21
+ set_as_default?: 0 | 1; // 是否设为默认日历,第三方应用不支持
22
+ summary: string; // 日历标题,1-128 字符
23
+ color: string; // RGB 颜色编码,如 "#0000FF"
24
+ description?: string; // 日历描述,0-512 字符
25
+ shares?: CalendarSharesEntry[]; // 通知范围成员,最多 2000 人
26
+ is_public?: 0 | 1; // 是否公共日历
27
+ public_range?: CalendarPublicRange; // 公开范围
28
+ is_corp_calendar?: 0 | 1; // 是否全员日历
29
+ };
30
+ agentid?: number;
31
+ }
32
+
33
+ export interface UpdateCalendarRequest {
34
+ skip_public_range?: 0 | 1;
35
+ calendar: {
36
+ cal_id: string;
37
+ admins?: string[];
38
+ summary: string;
39
+ color: string;
40
+ description?: string;
41
+ shares?: CalendarSharesEntry[];
42
+ public_range?: CalendarPublicRange;
43
+ };
44
+ }
45
+
46
+ export interface GetCalendarRequest {
47
+ cal_id_list: string[];
48
+ }
49
+
50
+ export interface DeleteCalendarRequest {
51
+ cal_id: string;
52
+ }
53
+
54
+ export interface CalendarInfo {
55
+ cal_id: string;
56
+ admins?: string[];
57
+ summary: string;
58
+ color: string;
59
+ description?: string;
60
+ shares?: CalendarSharesEntry[];
61
+ is_public?: 0 | 1;
62
+ public_range?: CalendarPublicRange;
63
+ is_corp_calendar?: 0 | 1;
64
+ }
65
+
66
+ // --- Schedule Interfaces ---
67
+
68
+ export interface ScheduleAttendee {
69
+ userid: string;
70
+ }
71
+
72
+ export interface ScheduleReminders {
73
+ is_remind?: 0 | 1;
74
+ is_repeat?: 0 | 1;
75
+ remind_before_event_secs?: number;
76
+ remind_time_diffs?: number[];
77
+ repeat_type?: 0 | 1 | 2 | 5 | 7;
78
+ repeat_until?: number;
79
+ is_custom_repeat?: 0 | 1;
80
+ repeat_interval?: number;
81
+ repeat_day_of_week?: number[];
82
+ repeat_day_of_month?: number[];
83
+ timezone?: number;
84
+ exclude_time_list?: Array<{ start_time: number }>;
85
+ }
86
+
87
+ export interface CreateScheduleRequest {
88
+ schedule: {
89
+ admins?: string[];
90
+ start_time: number;
91
+ end_time: number;
92
+ is_whole_day?: 0 | 1;
93
+ attendees?: ScheduleAttendee[];
94
+ summary?: string;
95
+ description?: string;
96
+ reminders?: ScheduleReminders;
97
+ location?: string;
98
+ cal_id?: string;
99
+ };
100
+ agentid?: number;
101
+ }
102
+
103
+ export interface UpdateScheduleRequest {
104
+ skip_attendees?: 0 | 1;
105
+ op_mode?: 0 | 1 | 2;
106
+ op_start_time?: number;
107
+ schedule: {
108
+ schedule_id: string;
109
+ admins?: string[];
110
+ start_time: number;
111
+ end_time: number;
112
+ is_whole_day?: 0 | 1;
113
+ attendees?: ScheduleAttendee[];
114
+ summary?: string;
115
+ description?: string;
116
+ reminders?: ScheduleReminders;
117
+ location?: string;
118
+ };
119
+ }
120
+
121
+ export interface AddScheduleAttendeesRequest {
122
+ schedule_id: string;
123
+ attendees: ScheduleAttendee[];
124
+ }
125
+
126
+ export interface DeleteScheduleAttendeesRequest {
127
+ schedule_id: string;
128
+ attendees: ScheduleAttendee[];
129
+ }
130
+
131
+ export interface GetScheduleByCalendarRequest {
132
+ cal_id: string;
133
+ offset?: number;
134
+ limit?: number;
135
+ }
136
+
137
+ export interface GetScheduleRequest {
138
+ schedule_id_list: string[];
139
+ }
140
+
141
+ export interface DeleteScheduleRequest {
142
+ schedule_id: string;
143
+ op_mode?: 0 | 1 | 2;
144
+ op_start_time?: number;
145
+ }
146
+
147
+ export interface ScheduleAttendeeWithStatus {
148
+ userid: string;
149
+ response_status: 0 | 1 | 2 | 3 | 4;
150
+ }
151
+
152
+ export interface ScheduleInfo {
153
+ schedule_id: string;
154
+ sequence?: number;
155
+ admins?: string[];
156
+ organizer?: string;
157
+ attendees?: ScheduleAttendeeWithStatus[];
158
+ summary?: string;
159
+ description?: string;
160
+ reminders?: ScheduleReminders;
161
+ location?: string;
162
+ start_time: number;
163
+ end_time: number;
164
+ status?: 0 | 1;
165
+ cal_id?: string;
166
+ is_whole_day?: 0 | 1;
167
+ meetingroom_id?: string;
168
+ }
169
+
170
+ // --- System Calendar Interfaces ---
171
+
172
+ export interface GetSystemCalendarIdRequest {
173
+ userid: string;
174
+ }
175
+
176
+ export interface CreateSystemScheduleRequest {
177
+ schedule: {
178
+ organizer: string;
179
+ start_time: number;
180
+ end_time: number;
181
+ is_whole_day?: 0 | 1;
182
+ attendees?: ScheduleAttendee[];
183
+ summary?: string;
184
+ description?: string;
185
+ reminders?: ScheduleReminders;
186
+ location?: string;
187
+ };
188
+ }
189
+
190
+ export interface RespondScheduleRequest {
191
+ schedule_id: string;
192
+ op_mode?: 0 | 1 | 2;
193
+ op_start_time?: number;
194
+ attendee: string;
195
+ response_status: 1 | 2 | 4;
196
+ }
197
+
198
+ export interface SyncScheduleRequest {
199
+ cal_id: string;
200
+ cursor?: string;
201
+ limit?: number;
202
+ }
203
+
204
+ // --- Response Interfaces ---
205
+
206
+ export interface CreateCalendarResponse {
207
+ errcode: number;
208
+ errmsg: string;
209
+ cal_id: string;
210
+ fail_result?: { shares?: Array<{ errcode: number; errmsg: string; userid: string; }>; };
211
+ }
212
+
213
+ export interface UpdateCalendarResponse {
214
+ errcode: number;
215
+ errmsg: string;
216
+ fail_result?: { shares?: Array<{ errcode: number; errmsg: string; userid: string; }>; };
217
+ }
218
+
219
+ export interface GetCalendarResponse {
220
+ errcode: number;
221
+ errmsg: string;
222
+ calendar_list: CalendarInfo[];
223
+ }
224
+
225
+ export interface DeleteCalendarResponse {
226
+ errcode: number;
227
+ errmsg: string;
228
+ }
229
+
230
+ export interface CreateScheduleResponse {
231
+ errcode: number;
232
+ errmsg: string;
233
+ schedule_id: string;
234
+ }
235
+
236
+ export interface UpdateScheduleResponse {
237
+ errcode: number;
238
+ errmsg: string;
239
+ schedule_id?: string;
240
+ }
241
+
242
+ export interface GetScheduleByCalendarResponse {
243
+ errcode: number;
244
+ errmsg: string;
245
+ schedule_list: ScheduleInfo[];
246
+ }
247
+
248
+ export interface GetScheduleResponse {
249
+ errcode: number;
250
+ errmsg: string;
251
+ schedule_list: ScheduleInfo[];
252
+ meeting_code?: string;
253
+ meeting_link?: string;
254
+ }
255
+
256
+ export interface DeleteScheduleResponse {
257
+ errcode: number;
258
+ errmsg: string;
259
+ }
260
+
261
+ export interface AddScheduleAttendeesResponse {
262
+ errcode: number;
263
+ errmsg: string;
264
+ }
265
+
266
+ export interface DeleteScheduleAttendeesResponse {
267
+ errcode: number;
268
+ errmsg: string;
269
+ }
270
+
271
+ export interface GetSystemCalendarIdResponse {
272
+ errcode: number;
273
+ errmsg: string;
274
+ cal_id: string;
275
+ }
276
+
277
+ export interface RespondScheduleResponse {
278
+ errcode: number;
279
+ errmsg: string;
280
+ }
281
+
282
+ export interface SyncScheduleResponse {
283
+ errcode: number;
284
+ errmsg: string;
285
+ next_cursor: string;
286
+ schedule_list: ScheduleInfo[];
287
+ }
288
+
289
+ // --- Callback Event Types ---
290
+
291
+ export interface CalendarCallbackEvent {
292
+ ToUserName: string;
293
+ FromUserName: string;
294
+ CreateTime: number;
295
+ MsgType: "event";
296
+ Event: "delete_calendar" | "modify_calendar" | "modify_schedule" | "delete_schedule" | "respond_schedule" | "add_schedule";
297
+ CalId: string;
298
+ ScheduleId?: string;
299
+ }
300
+
301
+ // --- Constants ---
302
+
303
+ export const REMINDER_BEFORE_EVENT_VALUES = [0, 300, 900, 3600, 86400] as const;
304
+ export const REMINDER_TIME_DIFFS_VALUES = [0, -300, -900, -3600, -86400, 32400, -172800, -604800] as const;
305
+ export const REPEAT_TYPE = { DAILY: 0, WEEKLY: 1, MONTHLY: 2, YEARLY: 5, WORKDAY: 7 } as const;
306
+ export const PERMISSION_TYPE = { VIEW: 1, BUSY_ONLY: 3 } as const;
307
+ export const SCHEDULE_RESPONSE_STATUS = { UNPROCESSED: 0, TENTATIVE: 1, ACCEPTED: 2, ACCEPTED_ONCE: 3, DECLINED: 4 } as const;
308
+ export const OP_MODE = { ALL: 0, THIS_ONLY: 1, FUTURE: 2 } as const;
309
+ export const SCHEDULE_STATUS = { NORMAL: 0, CANCELLED: 1 } as const;