Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(calendar): tell the agent when to ask which inbox's copy to change (#8700)

gbirmande673be119d6
diff --git a/apps/docs/AI/mcp/tools/delete-calendar-event.mdx b/apps/docs/AI/mcp/tools/delete-calendar-event.mdx
index 5a50b1511a..52850e6eaa 100644
--- a/apps/docs/AI/mcp/tools/delete-calendar-event.mdx
+++ b/apps/docs/AI/mcp/tools/delete-calendar-event.mdx
@@ -10,6 +10,8 @@ Delete an event from the user's calendar. The deletion is written to the calenda
For recurring events, `scope` controls how much is removed: "all" (default) removes the whole series, "this_event" removes one occurrence, and "this_and_following" ends the series from an occurrence onward. The scoped variants require `recurrenceId` from the targeted occurrence's ListCalendarEvents entry.
+When the meeting is on several of the user's inboxes (one ListCalendarEvents entry per inbox), ask which inbox's copy to delete unless the user named one or only one copy is writable (`isReadOnly` false), in which case delete that one and say why. Deleting the copy the user organizes cancels the meeting for every guest, while deleting a copy where they are a guest only takes it off that inbox's calendar.
+
## Parameters
| Parameter | Type | Required | Description |
diff --git a/apps/docs/AI/mcp/tools/list-calendar-events.mdx b/apps/docs/AI/mcp/tools/list-calendar-events.mdx
index 0aa7359518..8b0d5a2950 100644
--- a/apps/docs/AI/mcp/tools/list-calendar-events.mdx
+++ b/apps/docs/AI/mcp/tools/list-calendar-events.mdx
@@ -13,6 +13,8 @@ Use this to answer questions about the user's schedule ("what's on my calendar t
Each entry names the calendar (`calendarName`) and connected inbox (`inbox`) holding that copy of the event, and `myRole` says whether the user organizes it or is a guest there. A meeting on several of the user's inboxes appears once per inbox, each with its own `eventId`, and what the user may do can differ between them. When asking which one the user means, describe each by its inbox and role, never by id; when the user names an inbox, act on the entry whose `inbox` matches.
+When the user does not name an inbox, choose the copy by what the change does. Reminders belong to one copy only, so set them on one copy without asking and say which inbox you used. Answer an invitation on the copy where the user is a guest; when they are a guest through more than one inbox, ask which inbox answers, since each answers only for itself. Any other change reaches the meeting differently from each copy: the title, time, description, location, recurrence or conference, adding or removing guests, guest permissions, and deleting. Never pick a copy for such a change silently. If only one copy allows it (`viewerCan`, or for deleting, `isReadOnly` false), use that copy and say why (for example, only the copy the user organizes can move the meeting). If more than one can, ask which inbox, saying what the change would do from each, such as deleting the organizer's copy cancelling the meeting for everyone while deleting a guest's copy only takes it off that inbox's calendar.
+
## Parameters
| Parameter | Type | Required | Description |
diff --git a/apps/docs/AI/mcp/tools/update-calendar-event.mdx b/apps/docs/AI/mcp/tools/update-calendar-event.mdx
index e0ba8c756b..9f0feb5563 100644
--- a/apps/docs/AI/mcp/tools/update-calendar-event.mdx
+++ b/apps/docs/AI/mcp/tools/update-calendar-event.mdx
@@ -16,6 +16,8 @@ A guest without modify rights (`viewerCan.editDetails` false while `viewerCan.rs
`rsvp` sets the user's own response to an invitation and is independent of the field edits — it can be the only thing this call changes. It applies at the same `scope` as the rest of the call and answers as the connected inbox the event's copy belongs to, so it only works when that inbox is an attendee.
+When the meeting is on several of the user's inboxes, ListCalendarEvents lists one entry per inbox; pick the copy by its rule. Reminders may go to one copy and an `rsvp` to the copy where the user is a guest, naming the inbox in your reply. Any other change goes to the only copy whose `viewerCan` allows it, with the reason, or to the copy the user chooses when more than one could make it. One call changes one copy, so an edit on one copy and an `rsvp` on another take two calls.
+
## Parameters
| Parameter | Type | Required | Description |
diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts b/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts
index 93619afa4c..9971f0a383 100644
--- a/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts
+++ b/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts
@@ -8281,6 +8281,8 @@ export interface DeleteBotResponse {
* Delete an event from the user's calendar. The deletion is written to the calendar provider immediately and attendees are notified, so confirm with the user before deleting — it cannot be undone. Get the `eventId` from ListCalendarEvents.
*
* For recurring events, `scope` controls how much is removed: "all" (default) removes the whole series, "this_event" removes one occurrence, and "this_and_following" ends the series from an occurrence onward. The scoped variants require `recurrenceId` from the targeted occurrence's ListCalendarEvents entry.
+ *
+ * When the meeting is on several of the user's inboxes (one ListCalendarEvents entry per inbox), ask which inbox's copy to delete unless the user named one or only one copy is writable (`isReadOnly` false), in which case delete that one and say why. Deleting the copy the user organizes cancels the meeting for every guest, while deleting a copy where they are a guest only takes it off that inbox's calendar.
*/
export interface DeleteCalendarEvent {
/**
@@ -10983,6 +10985,8 @@ export interface ListBotsResponse {
* Use this to answer questions about the user's schedule ("what's on my calendar tomorrow?"), to find an event the user wants changed or removed, and to check for conflicts before creating an event. Keep the window as narrow as the request allows — a day or a week — since wide windows truncate at 200 occurrences. The window must be at most 370 days and within one year past to two years future. If `syncStatus` is `syncing`, tell the user results may still be incomplete.
*
* Each entry names the calendar (`calendarName`) and connected inbox (`inbox`) holding that copy of the event, and `myRole` says whether the user organizes it or is a guest there. A meeting on several of the user's inboxes appears once per inbox, each with its own `eventId`, and what the user may do can differ between them. When asking which one the user means, describe each by its inbox and role, never by id; when the user names an inbox, act on the entry whose `inbox` matches.
+ *
+ * When the user does not name an inbox, choose the copy by what the change does. Reminders belong to one copy only, so set them on one copy without asking and say which inbox you used. Answer an invitation on the copy where the user is a guest; when they are a guest through more than one inbox, ask which inbox answers, since each answers only for itself. Any other change reaches the meeting differently from each copy: the title, time, description, location, recurrence or conference, adding or removing guests, guest permissions, and deleting. Never pick a copy for such a change silently. If only one copy allows it (`viewerCan`, or for deleting, `isReadOnly` false), use that copy and say why (for example, only the copy the user organizes can move the meeting). If more than one can, ask which inbox, saying what the change would do from each, such as deleting the organizer's copy cancelling the meeting for everyone while deleting a guest's copy only takes it off that inbox's calendar.
*/
export interface ListCalendarEvents {
/**
@@ -15127,6 +15131,8 @@ export interface UpdateBookingSettings {
* A guest without modify rights (`viewerCan.editDetails` false while `viewerCan.rsvp` is true) may only change their own `reminders`, add guests where `viewerCan.inviteGuests` allows it, and answer with `rsvp`; changing the title, time, description, location, recurrence or conference fails because the organizer doesn't let guests change the event.
*
* `rsvp` sets the user's own response to an invitation and is independent of the field edits — it can be the only thing this call changes. It applies at the same `scope` as the rest of the call and answers as the connected inbox the event's copy belongs to, so it only works when that inbox is an attendee.
+ *
+ * When the meeting is on several of the user's inboxes, ListCalendarEvents lists one entry per inbox; pick the copy by its rule. Reminders may go to one copy and an `rsvp` to the copy where the user is a guest, naming the inbox in your reply. Any other change goes to the only copy whose `viewerCan` allows it, with the reason, or to the copy the user chooses when more than one could make it. One call changes one copy, so an edit on one copy and an `rsvp` on another take two calls.
*/
export interface UpdateCalendarEvent {
/**
diff --git a/crates/calendar_events/AGENTS.md b/crates/calendar_events/AGENTS.md
index 53783140ca..93ccaf9e18 100644
--- a/crates/calendar_events/AGENTS.md
+++ b/crates/calendar_events/AGENTS.md
@@ -142,6 +142,11 @@ reminder dispatch, team availability, and provider/Postgres persistence.
Since one meeting on two inboxes is two entities, the agent tools label every
event they return with its calendar's name, its `inbox` and the user's
`myRole` there (`ToolEventRole::of`), so the agent can ask or pick by inbox.
+ Their descriptions set the rule: reminders and an answer may go to one copy
+ if the reply names its inbox (an answer asks first when the user is a guest
+ through several inboxes); a change whose effect differs by copy (details,
+ guests, permissions, deleting) goes to the only copy allowed to make it, with
+ the reason, or the agent asks.
- Preserve the conservative OOO refresh hint on write outcomes and sync reports;
its contract is in [team sharing](../../docs/design/calendar-team-sharing.md).
- The team out-of-office overlay (`src/outbound/pg_team/ooo.rs`) starts from
diff --git a/crates/calendar_events/src/inbound/toolset/delete_calendar_event.rs b/crates/calendar_events/src/inbound/toolset/delete_calendar_event.rs
index 7b4835c58b..879beec55c 100644
--- a/crates/calendar_events/src/inbound/toolset/delete_calendar_event.rs
+++ b/crates/calendar_events/src/inbound/toolset/delete_calendar_event.rs
@@ -49,7 +49,13 @@ the `eventId` from ListCalendarEvents.\n\
For recurring events, `scope` controls how much is removed: \"all\" (default) removes the \
whole series, \"this_event\" removes one occurrence, and \"this_and_following\" ends the \
series from an occurrence onward. The scoped variants require `recurrenceId` from the \
-targeted occurrence's ListCalendarEvents entry."
+targeted occurrence's ListCalendarEvents entry.\n\
+\n\
+When the meeting is on several of the user's inboxes (one ListCalendarEvents entry per \
+inbox), ask which inbox's copy to delete unless the user named one or only one copy is \
+writable (`isReadOnly` false), in which case delete that one and say why. Deleting the copy \
+the user organizes cancels the meeting for every guest, while deleting a copy where they are \
+a guest only takes it off that inbox's calendar."
)]
pub struct DeleteCalendarEvent {
/// Event to delete.
diff --git a/crates/calendar_events/src/inbound/toolset/list_calendar_events.rs b/crates/calendar_events/src/inbound/toolset/list_calendar_events.rs
index 61035864ff..146b5b2078 100644
--- a/crates/calendar_events/src/inbound/toolset/list_calendar_events.rs
+++ b/crates/calendar_events/src/inbound/toolset/list_calendar_events.rs
@@ -157,7 +157,20 @@ copy of the event, and `myRole` says whether the user organizes it or is a guest
meeting on several of the user's inboxes appears once per inbox, each with its own \
`eventId`, and what the user may do can differ between them. When asking which one the user \
means, describe each by its inbox and role, never by id; when the user names an inbox, act \
-on the entry whose `inbox` matches."
+on the entry whose `inbox` matches.\n\
+\n\
+When the user does not name an inbox, choose the copy by what the change does. Reminders \
+belong to one copy only, so set them on one copy without asking and say which inbox you used. \
+Answer an invitation on the copy where the user is a guest; when they are a guest through \
+more than one inbox, ask which inbox answers, since each answers only for itself. Any other \
+change reaches the meeting differently from each copy: the title, time, description, \
+location, recurrence or conference, adding or removing guests, guest permissions, and \
+deleting. Never pick a copy for such a change silently. If only one copy allows it \
+(`viewerCan`, or for deleting, `isReadOnly` false), use that copy and say why (for example, \
+only the copy the user organizes can move the meeting). If more than one can, \
+ask which inbox, saying what the change would do from each, such as deleting the organizer's \
+copy cancelling the meeting for everyone while deleting a guest's copy only takes it off that \
+inbox's calendar."
)]
pub struct ListCalendarEvents {
/// Inclusive window start.
diff --git a/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs b/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs
index c19b6b9c10..8ff663e8c2 100644
--- a/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs
+++ b/crates/calendar_events/src/inbound/toolset/update_calendar_event.rs
@@ -116,7 +116,14 @@ event.\n\
`rsvp` sets the user's own response to an invitation and is independent of the field \
edits — it can be the only thing this call changes. It applies at the same `scope` as \
the rest of the call and answers as the connected inbox the event's copy belongs to, so \
-it only works when that inbox is an attendee."
+it only works when that inbox is an attendee.\n\
+\n\
+When the meeting is on several of the user's inboxes, ListCalendarEvents lists one entry per \
+inbox; pick the copy by its rule. Reminders may go to one copy and an `rsvp` to the copy \
+where the user is a guest, naming the inbox in your reply. Any other change goes to the only \
+copy whose `viewerCan` allows it, with the reason, or to the copy the user chooses when more \
+than one could make it. One call changes one copy, so an edit on one copy and an `rsvp` on \
+another take two calls."
)]
pub struct UpdateCalendarEvent {
/// Event to update.