@agenticmail/enterprise 0.5.316 → 0.5.318

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 (36) hide show
  1. package/dist/agent-tools-263HM5QU.js +13949 -0
  2. package/dist/agent-tools-AT4D276V.js +13949 -0
  3. package/dist/chunk-36XNMIHA.js +5087 -0
  4. package/dist/chunk-6G5SXLXC.js +4921 -0
  5. package/dist/chunk-6PWDS7KY.js +5087 -0
  6. package/dist/chunk-D24JY75H.js +1519 -0
  7. package/dist/chunk-MMYBDHDB.js +4921 -0
  8. package/dist/chunk-OW4GLBHP.js +1519 -0
  9. package/dist/cli-agent-FNMDJN7T.js +2357 -0
  10. package/dist/cli-agent-ZSHUPBBN.js +2357 -0
  11. package/dist/cli-serve-DTQLN5UI.js +140 -0
  12. package/dist/cli-serve-LNTT73P2.js +140 -0
  13. package/dist/cli.js +3 -3
  14. package/dist/index.js +17 -17
  15. package/dist/integrations-TF4EBCJ7.js +43830 -0
  16. package/dist/microsoft-HPLA5ZL5.js +2414 -0
  17. package/dist/microsoft-UFLZBEAC.js +1619 -0
  18. package/dist/runtime-HTIM7GZR.js +45 -0
  19. package/dist/runtime-QQ6LAY4U.js +45 -0
  20. package/dist/server-DFR7FI3Q.js +28 -0
  21. package/dist/server-TXV3ZVVR.js +28 -0
  22. package/dist/setup-ADSKKBGV.js +20 -0
  23. package/dist/setup-LW4MLU2N.js +20 -0
  24. package/package.json +1 -1
  25. package/src/agent-tools/index.ts +7 -2
  26. package/src/agent-tools/tools/microsoft/contacts.ts +176 -0
  27. package/src/agent-tools/tools/microsoft/excel.ts +261 -0
  28. package/src/agent-tools/tools/microsoft/graph-api.ts +50 -0
  29. package/src/agent-tools/tools/microsoft/index.ts +79 -0
  30. package/src/agent-tools/tools/microsoft/onedrive.ts +228 -0
  31. package/src/agent-tools/tools/microsoft/onenote.ts +186 -0
  32. package/src/agent-tools/tools/microsoft/outlook-calendar.ts +286 -0
  33. package/src/agent-tools/tools/microsoft/outlook-mail.ts +431 -0
  34. package/src/agent-tools/tools/microsoft/sharepoint.ts +328 -0
  35. package/src/agent-tools/tools/microsoft/teams.ts +244 -0
  36. package/src/agent-tools/tools/microsoft/todo.ts +181 -0
@@ -0,0 +1,286 @@
1
+ /**
2
+ * Microsoft Outlook Calendar Tools
3
+ *
4
+ * CRUD for events, free/busy lookup, and calendar listing via Microsoft Graph API.
5
+ */
6
+
7
+ import type { AnyAgentTool, ToolCreationOptions } from '../../types.js';
8
+ import { jsonResult, errorResult } from '../../common.js';
9
+ import type { MicrosoftToolsConfig } from './index.js';
10
+ import { graph } from './graph-api.js';
11
+
12
+ export function createOutlookCalendarTools(config: MicrosoftToolsConfig, _options?: ToolCreationOptions): AnyAgentTool[] {
13
+ const tp = config.tokenProvider;
14
+
15
+ return [
16
+ {
17
+ name: 'outlook_calendar_list',
18
+ description: 'List all calendars the agent has access to.',
19
+ category: 'utility' as const,
20
+ parameters: { type: 'object' as const, properties: {}, required: [] },
21
+ async execute(_id: string) {
22
+ try {
23
+ const token = await tp.getAccessToken();
24
+ const data = await graph(token, '/me/calendars');
25
+ const cals = (data.value || []).map((c: any) => ({
26
+ id: c.id, name: c.name, color: c.color,
27
+ isDefaultCalendar: c.isDefaultCalendar, canEdit: c.canEdit,
28
+ owner: c.owner?.address,
29
+ }));
30
+ return jsonResult({ calendars: cals, count: cals.length });
31
+ } catch (e: any) { return errorResult(e.message); }
32
+ },
33
+ },
34
+
35
+ {
36
+ name: 'outlook_calendar_events',
37
+ description: 'List upcoming events from a calendar. Defaults to the primary calendar.',
38
+ category: 'utility' as const,
39
+ parameters: {
40
+ type: 'object' as const,
41
+ properties: {
42
+ calendarId: { type: 'string', description: 'Calendar ID (omit for default calendar)' },
43
+ timeMin: { type: 'string', description: 'Start of time range (ISO 8601, default: now)' },
44
+ timeMax: { type: 'string', description: 'End of time range (ISO 8601, default: +7 days)' },
45
+ maxResults: { type: 'number', description: 'Max events (default: 20)' },
46
+ },
47
+ required: [],
48
+ },
49
+ async execute(_id: string, params: any) {
50
+ try {
51
+ const token = await tp.getAccessToken();
52
+ const now = new Date();
53
+ const timeMin = params.timeMin || now.toISOString();
54
+ const weekLater = new Date(now.getTime() + 7 * 86400000);
55
+ const timeMax = params.timeMax || weekLater.toISOString();
56
+ const top = params.maxResults || 20;
57
+
58
+ const basePath = params.calendarId
59
+ ? `/me/calendars/${params.calendarId}/calendarView`
60
+ : '/me/calendarView';
61
+
62
+ const data = await graph(token, basePath, {
63
+ query: {
64
+ startDateTime: timeMin,
65
+ endDateTime: timeMax,
66
+ '$top': String(top),
67
+ '$orderby': 'start/dateTime',
68
+ '$select': 'id,subject,start,end,location,organizer,attendees,isAllDay,isCancelled,showAs,importance,bodyPreview,onlineMeeting,webLink',
69
+ }
70
+ });
71
+
72
+ const events = (data.value || []).map((e: any) => ({
73
+ id: e.id,
74
+ subject: e.subject,
75
+ start: e.start?.dateTime,
76
+ startTimeZone: e.start?.timeZone,
77
+ end: e.end?.dateTime,
78
+ endTimeZone: e.end?.timeZone,
79
+ isAllDay: e.isAllDay,
80
+ location: e.location?.displayName,
81
+ organizer: e.organizer?.emailAddress?.address,
82
+ attendees: e.attendees?.map((a: any) => ({
83
+ email: a.emailAddress?.address,
84
+ name: a.emailAddress?.name,
85
+ status: a.status?.response,
86
+ type: a.type,
87
+ })),
88
+ showAs: e.showAs,
89
+ isCancelled: e.isCancelled,
90
+ preview: e.bodyPreview,
91
+ meetingUrl: e.onlineMeeting?.joinUrl,
92
+ webLink: e.webLink,
93
+ }));
94
+ return jsonResult({ events, count: events.length });
95
+ } catch (e: any) { return errorResult(e.message); }
96
+ },
97
+ },
98
+
99
+ {
100
+ name: 'outlook_calendar_create',
101
+ description: 'Create a new calendar event. Supports attendees, location, online meeting (Teams), and recurrence.',
102
+ category: 'utility' as const,
103
+ parameters: {
104
+ type: 'object' as const,
105
+ properties: {
106
+ subject: { type: 'string', description: 'Event subject/title' },
107
+ start: { type: 'string', description: 'Start time (ISO 8601)' },
108
+ end: { type: 'string', description: 'End time (ISO 8601)' },
109
+ timeZone: { type: 'string', description: 'Time zone (default: UTC)' },
110
+ location: { type: 'string', description: 'Location name' },
111
+ body: { type: 'string', description: 'Event body/description' },
112
+ attendees: { type: 'string', description: 'Attendee emails, comma-separated' },
113
+ isOnlineMeeting: { type: 'boolean', description: 'Create a Teams meeting link (default: false)' },
114
+ isAllDay: { type: 'boolean', description: 'All-day event' },
115
+ importance: { type: 'string', description: 'low, normal, or high' },
116
+ reminderMinutes: { type: 'number', description: 'Reminder before event in minutes (default: 15)' },
117
+ calendarId: { type: 'string', description: 'Calendar ID (omit for default)' },
118
+ },
119
+ required: ['subject', 'start', 'end'],
120
+ },
121
+ async execute(_id: string, params: any) {
122
+ try {
123
+ const token = await tp.getAccessToken();
124
+ const tz = params.timeZone || 'UTC';
125
+ const event: any = {
126
+ subject: params.subject,
127
+ start: { dateTime: params.start, timeZone: tz },
128
+ end: { dateTime: params.end, timeZone: tz },
129
+ };
130
+ if (params.location) event.location = { displayName: params.location };
131
+ if (params.body) event.body = { contentType: 'HTML', content: params.body };
132
+ if (params.attendees) {
133
+ event.attendees = params.attendees.split(',').map((e: string) => ({
134
+ emailAddress: { address: e.trim() },
135
+ type: 'required',
136
+ }));
137
+ }
138
+ if (params.isOnlineMeeting) {
139
+ event.isOnlineMeeting = true;
140
+ event.onlineMeetingProvider = 'teamsForBusiness';
141
+ }
142
+ if (params.isAllDay) event.isAllDay = true;
143
+ if (params.importance) event.importance = params.importance;
144
+ if (params.reminderMinutes !== undefined) {
145
+ event.isReminderOn = true;
146
+ event.reminderMinutesBefore = params.reminderMinutes;
147
+ }
148
+
149
+ const basePath = params.calendarId
150
+ ? `/me/calendars/${params.calendarId}/events`
151
+ : '/me/events';
152
+
153
+ const created = await graph(token, basePath, { method: 'POST', body: event });
154
+ return jsonResult({
155
+ id: created.id,
156
+ subject: created.subject,
157
+ start: created.start?.dateTime,
158
+ end: created.end?.dateTime,
159
+ meetingUrl: created.onlineMeeting?.joinUrl,
160
+ webLink: created.webLink,
161
+ });
162
+ } catch (e: any) { return errorResult(e.message); }
163
+ },
164
+ },
165
+
166
+ {
167
+ name: 'outlook_calendar_update',
168
+ description: 'Update an existing calendar event.',
169
+ category: 'utility' as const,
170
+ parameters: {
171
+ type: 'object' as const,
172
+ properties: {
173
+ eventId: { type: 'string', description: 'Event ID to update' },
174
+ subject: { type: 'string', description: 'New subject' },
175
+ start: { type: 'string', description: 'New start time (ISO 8601)' },
176
+ end: { type: 'string', description: 'New end time (ISO 8601)' },
177
+ timeZone: { type: 'string', description: 'Time zone' },
178
+ location: { type: 'string', description: 'New location' },
179
+ body: { type: 'string', description: 'New body content' },
180
+ },
181
+ required: ['eventId'],
182
+ },
183
+ async execute(_id: string, params: any) {
184
+ try {
185
+ const token = await tp.getAccessToken();
186
+ const update: any = {};
187
+ if (params.subject) update.subject = params.subject;
188
+ if (params.start) update.start = { dateTime: params.start, timeZone: params.timeZone || 'UTC' };
189
+ if (params.end) update.end = { dateTime: params.end, timeZone: params.timeZone || 'UTC' };
190
+ if (params.location) update.location = { displayName: params.location };
191
+ if (params.body) update.body = { contentType: 'HTML', content: params.body };
192
+
193
+ const updated = await graph(token, `/me/events/${params.eventId}`, { method: 'PATCH', body: update });
194
+ return jsonResult({ id: updated.id, subject: updated.subject, updated: true });
195
+ } catch (e: any) { return errorResult(e.message); }
196
+ },
197
+ },
198
+
199
+ {
200
+ name: 'outlook_calendar_delete',
201
+ description: 'Delete a calendar event.',
202
+ category: 'utility' as const,
203
+ parameters: {
204
+ type: 'object' as const,
205
+ properties: {
206
+ eventId: { type: 'string', description: 'Event ID to delete' },
207
+ },
208
+ required: ['eventId'],
209
+ },
210
+ async execute(_id: string, params: any) {
211
+ try {
212
+ const token = await tp.getAccessToken();
213
+ await graph(token, `/me/events/${params.eventId}`, { method: 'DELETE' });
214
+ return jsonResult({ deleted: true, eventId: params.eventId });
215
+ } catch (e: any) { return errorResult(e.message); }
216
+ },
217
+ },
218
+
219
+ {
220
+ name: 'outlook_calendar_respond',
221
+ description: 'Respond to a calendar event invitation (accept, tentatively accept, or decline).',
222
+ category: 'utility' as const,
223
+ parameters: {
224
+ type: 'object' as const,
225
+ properties: {
226
+ eventId: { type: 'string', description: 'Event ID to respond to' },
227
+ response: { type: 'string', description: 'accept, tentativelyAccept, or decline' },
228
+ comment: { type: 'string', description: 'Optional response message' },
229
+ sendResponse: { type: 'boolean', description: 'Send response to organizer (default: true)' },
230
+ },
231
+ required: ['eventId', 'response'],
232
+ },
233
+ async execute(_id: string, params: any) {
234
+ try {
235
+ const token = await tp.getAccessToken();
236
+ const body: any = { sendResponse: params.sendResponse !== false };
237
+ if (params.comment) body.comment = params.comment;
238
+ await graph(token, `/me/events/${params.eventId}/${params.response}`, { method: 'POST', body });
239
+ return jsonResult({ responded: true, eventId: params.eventId, response: params.response });
240
+ } catch (e: any) { return errorResult(e.message); }
241
+ },
242
+ },
243
+
244
+ {
245
+ name: 'outlook_calendar_freebusy',
246
+ description: 'Check free/busy availability for one or more users.',
247
+ category: 'utility' as const,
248
+ parameters: {
249
+ type: 'object' as const,
250
+ properties: {
251
+ emails: { type: 'string', description: 'Email addresses to check, comma-separated' },
252
+ start: { type: 'string', description: 'Start of range (ISO 8601)' },
253
+ end: { type: 'string', description: 'End of range (ISO 8601)' },
254
+ timeZone: { type: 'string', description: 'Time zone (default: UTC)' },
255
+ },
256
+ required: ['emails', 'start', 'end'],
257
+ },
258
+ async execute(_id: string, params: any) {
259
+ try {
260
+ const token = await tp.getAccessToken();
261
+ const schedules = params.emails.split(',').map((e: string) => e.trim());
262
+ const data = await graph(token, '/me/calendar/getSchedule', {
263
+ method: 'POST',
264
+ body: {
265
+ schedules,
266
+ startTime: { dateTime: params.start, timeZone: params.timeZone || 'UTC' },
267
+ endTime: { dateTime: params.end, timeZone: params.timeZone || 'UTC' },
268
+ availabilityViewInterval: 30,
269
+ },
270
+ });
271
+ const results = (data.value || []).map((s: any) => ({
272
+ email: s.scheduleId,
273
+ availability: s.availabilityView,
274
+ items: s.scheduleItems?.map((i: any) => ({
275
+ status: i.status,
276
+ subject: i.subject,
277
+ start: i.start?.dateTime,
278
+ end: i.end?.dateTime,
279
+ })),
280
+ }));
281
+ return jsonResult({ schedules: results });
282
+ } catch (e: any) { return errorResult(e.message); }
283
+ },
284
+ },
285
+ ];
286
+ }