Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(teamhub): add Outlook Calendar polling listener

LeoXing7494f818424b
diff --git a/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap b/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap
index 171d530b..0abefaad 100644
--- a/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap
+++ b/apps/teamhub-cli/src/__snapshots__/cli.help-snapshot.test.ts.snap
@@ -2954,7 +2954,7 @@ Options:
--operation-id <value> Stable operation identity for recovery.
",
"schema": "exit 0
-{"command":["routine","create"],"description":"Create a Routine in the configured Room.","read_only":false,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120,"description":"Short name shown in the room Routine list."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"The message posted in this room when the Routine fires."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"tracking_item_id":{"description":"Tracking Item of your Human this Routine serves; deleting the item deletes the Routine.","type":"string","pattern":"^ti_[a-f0-9]{32}$"},"tracking_purpose":{"description":"What this Routine checks or reminds for its Tracking Item.","type":"string","minLength":1,"maxLength":500}},"required":["name","instruction","schedule"],"additionalProperties":false,"description":"Name, message, schedule, and optional mention for a new Routine."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"cli":{"usage":["teamhub routine create [flags]"],"arguments":[],"options":{"--name":{"description":"Routine name."},"--content":{"description":"Inline Markdown body; outside code, \\\\n, \\\\t and \\\\\\\\ are decoded."},"--file":{"description":"Read UTF-8 body from a file or - for stdin."},"--mention-actor-id":{"description":"Current Room Agent Actor ID, or self."},"--schedule":{"description":"Complete daily, weekly, every_n_minutes or once schedule JSON."},"--schedule-file":{"description":"Read schedule JSON from a file or - for stdin."},"--daily":{"description":"Daily local time as HH:MM."},"--weekly":{"description":"Weekly local time as HH:MM."},"--weekday":{"description":"Selected weekday; repeat unique days.","repeatable":true},"--timezone":{"description":"Explicit IANA timezone for daily or weekly."},"--every-minutes":{"description":"Repeat every 10-10080 minutes (multiples of 10)."},"--every-hours":{"description":"Repeat every 1-168 hours (compatibility alias for --every-minutes)."},"--at":{"description":"Fire once at this RFC 3339 time (with offset); done afterwards."},"--tracking-item":{"description":"Tracking Item ID this Routine serves; requires --purpose."},"--purpose":{"description":"What this Routine checks or reminds for its Tracking Item."},"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":[]}}
+{"command":["routine","create"],"description":"Create a Routine in the configured Room.","read_only":false,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120,"description":"Short name shown in the room Routine list."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"The message posted in this room when the Routine fires."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"tracking_item_id":{"description":"Tracking Item of your Human this Routine serves; deleting the item deletes the Routine.","type":"string","pattern":"^ti_[a-f0-9]{32}$"},"tracking_purpose":{"description":"What this Routine checks or reminds for its Tracking Item.","type":"string","minLength":1,"maxLength":500}},"required":["name","instruction","schedule"],"additionalProperties":false,"description":"Name, message, schedule, and optional mention for a new Routine."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","outlook_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"cli":{"usage":["teamhub routine create [flags]"],"arguments":[],"options":{"--name":{"description":"Routine name."},"--content":{"description":"Inline Markdown body; outside code, \\\\n, \\\\t and \\\\\\\\ are decoded."},"--file":{"description":"Read UTF-8 body from a file or - for stdin."},"--mention-actor-id":{"description":"Current Room Agent Actor ID, or self."},"--schedule":{"description":"Complete daily, weekly, every_n_minutes or once schedule JSON."},"--schedule-file":{"description":"Read schedule JSON from a file or - for stdin."},"--daily":{"description":"Daily local time as HH:MM."},"--weekly":{"description":"Weekly local time as HH:MM."},"--weekday":{"description":"Selected weekday; repeat unique days.","repeatable":true},"--timezone":{"description":"Explicit IANA timezone for daily or weekly."},"--every-minutes":{"description":"Repeat every 10-10080 minutes (multiples of 10)."},"--every-hours":{"description":"Repeat every 1-168 hours (compatibility alias for --every-minutes)."},"--at":{"description":"Fire once at this RFC 3339 time (with offset); done afterwards."},"--tracking-item":{"description":"Tracking Item ID this Routine serves; requires --purpose."},"--purpose":{"description":"What this Routine checks or reminds for its Tracking Item."},"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":[]}}
",
},
"routine delete": {
@@ -2992,7 +2992,7 @@ Options:
--operation-id <value> Stable operation identity for recovery.
",
"schema": "exit 0
-{"command":["routine","enable"],"description":"Enable a Routine in the configured Room.","read_only":false,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"routine_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Id of a Routine in this room, from list_routines or create_routine."}},"required":["routine_id"],"additionalProperties":false,"description":"The Routine to change."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"cli":{"usage":["teamhub routine enable [flags]"],"arguments":["<routine-id>"],"options":{"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":[]}}
+{"command":["routine","enable"],"description":"Enable a Routine in the configured Room.","read_only":false,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"routine_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Id of a Routine in this room, from list_routines or create_routine."}},"required":["routine_id"],"additionalProperties":false,"description":"The Routine to change."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","outlook_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"cli":{"usage":["teamhub routine enable [flags]"],"arguments":["<routine-id>"],"options":{"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":[]}}
",
},
"routine list": {
@@ -3007,7 +3007,7 @@ Options:
--schema Show offline input and output schemas.
",
"schema": "exit 0
-{"command":["routine","list"],"description":"List a Routine in the configured Room.","read_only":true,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{},"additionalProperties":false,"description":"Lists every Routine in the current room. No arguments."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"routines":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"description":"Every Routine in this room."}},"required":["routines"],"additionalProperties":false,"description":"The current room's Routines."},"cli":{"usage":["teamhub routine list [flags]"],"arguments":[],"options":{"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true}},"notes":[]}}
+{"command":["routine","list"],"description":"List a Routine in the configured Room.","read_only":true,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{},"additionalProperties":false,"description":"Lists every Routine in the current room. No arguments."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"routines":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","outlook_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"description":"Every Routine in this room."}},"required":["routines"],"additionalProperties":false,"description":"The current room's Routines."},"cli":{"usage":["teamhub routine list [flags]"],"arguments":[],"options":{"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true}},"notes":[]}}
",
},
"routine pause": {
@@ -3026,7 +3026,7 @@ Options:
--operation-id <value> Stable operation identity for recovery.
",
"schema": "exit 0
-{"command":["routine","pause"],"description":"Pause a Routine in the configured Room.","read_only":false,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"routine_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Id of a Routine in this room, from list_routines or create_routine."}},"required":["routine_id"],"additionalProperties":false,"description":"The Routine to change."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"cli":{"usage":["teamhub routine pause [flags]"],"arguments":["<routine-id>"],"options":{"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":[]}}
+{"command":["routine","pause"],"description":"Pause a Routine in the configured Room.","read_only":false,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"routine_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Id of a Routine in this room, from list_routines or create_routine."}},"required":["routine_id"],"additionalProperties":false,"description":"The Routine to change."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","outlook_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"cli":{"usage":["teamhub routine pause [flags]"],"arguments":["<routine-id>"],"options":{"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":[]}}
",
},
"routine run": {
@@ -3045,7 +3045,7 @@ Options:
--operation-id <value> Stable operation identity for recovery.
",
"schema": "exit 0
-{"command":["routine","run"],"description":"Publish a Routine instruction once; this does not prove Agent work completed.","read_only":false,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"routine_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Id of a Routine in this room, from list_routines or create_routine."}},"required":["routine_id"],"additionalProperties":false,"description":"The Routine to change."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"cli":{"usage":["teamhub routine run [flags]"],"arguments":["<routine-id>"],"options":{"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":[]}}
+{"command":["routine","run"],"description":"Publish a Routine instruction once; this does not prove Agent work completed.","read_only":false,"input_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"routine_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Id of a Routine in this room, from list_routines or create_routine."}},"required":["routine_id"],"additionalProperties":false,"description":"The Routine to change."},"output_schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Stable Routine id."},"name":{"type":"string","minLength":1,"maxLength":120,"description":"Routine name."},"instruction":{"type":"string","minLength":1,"maxLength":50000,"description":"Message posted when the Routine fires."},"mention_actor_id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","description":"Omit to post plain text. Use \\"self\\" to wake yourself. Otherwise pass the actor id of an Agent still in this room."},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"daily","description":"Post once every day."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","time","timezone"],"additionalProperties":false,"description":"Post once a day at a local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"weekly","description":"Post on selected weekdays each week."},"weekdays":{"minItems":1,"maxItems":7,"type":"array","items":{"type":"string","enum":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"description":"One selected local weekday."},"uniqueItems":true,"description":"Selected local weekdays. Use one Routine for multiple days at the same time, e.g. Monday through Friday."},"time":{"type":"string","pattern":"^(?:[01]\\\\d|2[0-3]):[0-5]\\\\d$","description":"Local 24-hour time as HH:MM, for example 09:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","weekdays","time","timezone"],"additionalProperties":false,"description":"Post on one or more selected weekdays at the same local clock time."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_minutes","description":"Repeat a fixed number of minutes on a fixed grid."},"interval_minutes":{"type":"integer","minimum":10,"maximum":10080,"multipleOf":10,"description":"How many minutes between posts, from 10 to 10080 in 10-minute increments."}},"required":["kind","interval_minutes"],"additionalProperties":false,"description":"Repeat every N minutes, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"every_n_hours","description":"Repeat a fixed number of whole hours on a fixed grid."},"interval_hours":{"type":"integer","minimum":1,"maximum":168,"description":"How many whole hours between posts, from 1 to 168 (compatibility alias for every_n_minutes)."}},"required":["kind","interval_hours"],"additionalProperties":false,"description":"Repeat every N hours, starting from now."},{"type":"object","properties":{"kind":{"type":"string","const":"once","description":"Post a single time, then stop."},"run_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)))$","description":"The future moment to post, RFC 3339 with offset, for example 2026-10-22T14:30:00-04:00."},"timezone":{"type":"string","minLength":1,"maxLength":255,"description":"IANA timezone for the clock time, such as America/New_York. Use the timezone the user stated."}},"required":["kind","run_at"],"additionalProperties":false,"description":"Post once at a set time, for example a check before a meeting; the Routine is done afterwards."}],"description":"When the Routine posts. daily and weekly use a clock time and timezone. every_n_minutes (or compatibility alias every_n_hours) repeats from now. once posts a single time at run_at."},"listener":{"description":"Present instead of schedule on an app listener. It can only be paused and enabled, and goes away when the Human revokes your access to the app.","type":"object","properties":{"app":{"type":"string","enum":["gmail","outlook","google_calendar","outlook_calendar","slack"],"description":"Connected app whose new events the Routine hands to proactive judgement."}},"required":["app"],"additionalProperties":false},"enabled":{"type":"boolean","description":"Whether the Routine will post on schedule."},"next_run_at":{"description":"UTC time of the next scheduled post. Absent while paused.","type":"string","minLength":1},"tracking_item_id":{"description":"Tracking Item this Routine serves, when it serves one.","type":"string"}},"required":["id","name","instruction","enabled"],"additionalProperties":false,"description":"One Routine in the current room."},"cli":{"usage":["teamhub routine run [flags]"],"arguments":["<routine-id>"],"options":{"--json":{"description":"Return machine-readable JSON.","boolean":true},"--help":{"description":"Show this offline command reference.","boolean":true},"-h":{"description":"Show help.","boolean":true},"--schema":{"description":"Show offline input and output schemas.","boolean":true},"--operation-id":{"description":"Stable operation identity for recovery."}},"notes":[]}}
",
},
"slack channels": {
diff --git a/apps/teamhub-cli/src/domains/collaboration/tools/routines.ts b/apps/teamhub-cli/src/domains/collaboration/tools/routines.ts
index c0c2f54e..62fd709f 100644
--- a/apps/teamhub-cli/src/domains/collaboration/tools/routines.ts
+++ b/apps/teamhub-cli/src/domains/collaboration/tools/routines.ts
@@ -145,7 +145,13 @@ export const routineSchema = z
listener: z
.object({
app: z
- .enum(["gmail", "outlook", "google_calendar", "slack"])
+ .enum([
+ "gmail",
+ "outlook",
+ "google_calendar",
+ "outlook_calendar",
+ "slack",
+ ])
.describe(
"Connected app whose new events the Routine hands to proactive judgement.",
),
diff --git a/apps/teamhub/internal/composio/outlook_poll_test.go b/apps/teamhub/internal/composio/outlook_poll_test.go
index 047c618e..6a3e8e72 100644
--- a/apps/teamhub/internal/composio/outlook_poll_test.go
+++ b/apps/teamhub/internal/composio/outlook_poll_test.go
@@ -3,9 +3,11 @@ package composio
import (
"context"
"encoding/json"
+ "errors"
"net/http"
"net/http/httptest"
"testing"
+ "time"
)
func TestOutlookDeltaReadsHeadersAndKeepsProviderCursor(t *testing.T) {
@@ -74,3 +76,98 @@ func TestGraphPollContinuationKeepsOpaqueValuesAndRejectsOtherHosts(t *testing.T
t.Fatal("foreign continuation host accepted")
}
}
+
+func TestOutlookCalendarDeltaNormalizesEventsAndKeepsContinuation(t *testing.T) {
+ type captured struct {
+ endpoint string
+ params map[string]string
+ headers map[string]string
+ }
+ var calls []captured
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ var request struct {
+ Endpoint string `json:"endpoint"`
+ Parameters []struct {
+ Name string `json:"name"`
+ Value string `json:"value"`
+ Type string `json:"type"`
+ } `json:"parameters"`
+ }
+ if err := json.NewDecoder(r.Body).Decode(&request); err != nil {
+ t.Fatal(err)
+ }
+ entry := captured{endpoint: request.Endpoint, params: map[string]string{}, headers: map[string]string{}}
+ for _, p := range request.Parameters {
+ if p.Type == "header" {
+ entry.headers[p.Name] = p.Value
+ } else {
+ entry.params[p.Name] = p.Value
+ }
+ }
+ calls = append(calls, entry)
+ if len(calls) == 3 {
+ _, _ = w.Write([]byte(`{"status":410,"headers":{},"data":{}}`))
+ return
+ }
+ _, _ = w.Write([]byte(`{"status":200,"headers":{},"data":{"value":[
+ {"id":"evt1","subject":"Design review","isAllDay":false,"isCancelled":false,
+ "createdDateTime":"2026-10-26T08:00:00Z","lastModifiedDateTime":"2026-10-26T09:00:00Z",
+ "start":{"dateTime":"2026-10-27T10:00:00.0000000","timeZone":"UTC"},
+ "end":{"dateTime":"2026-10-27T11:00:00.0000000","timeZone":"UTC"},
+ "location":{"displayName":"Room 2"},
+ "organizer":{"emailAddress":{"name":"Alice","address":"[email protected]"}},
+ "body":{"contentType":"html","content":"<style>noise</style><p>Bring the contract.</p>"}},
+ {"id":"evt2","subject":"Company offsite","isAllDay":true,
+ "start":{"dateTime":"2026-10-28T00:00:00.0000000","timeZone":"UTC"},
+ "end":{"dateTime":"2026-10-29T00:00:00.0000000","timeZone":"UTC"},
+ "body":{"contentType":"html","content":"<div class=\"PlainText\">&nbsp;</div>"},
+ "bodyPreview":"All hands day"},
+ {"id":"evt3","@removed":{"reason":"deleted"}}
+ ],"@odata.deltaLink":"https://graph.microsoft.com/v1.0/me/calendarView/delta?$deltatoken=cal1"}}`))
+ }))
+ defer server.Close()
+
+ client, err := New(Config{BaseURL: server.URL, APIKey: "restricted-key", EnvironmentKey: "test", HTTPClient: server.Client()})
+ if err != nil {
+ t.Fatal(err)
+ }
+ client.SetConnectionAuthority(func(context.Context, string) (ConnectionBinding, error) {
+ return ConnectionBinding{UserID: client.UserIDForAccount("account_1"), ToolkitSlug: "outlook", AuthConfigID: "ac_1"}, nil
+ })
+ start := time.Date(2026, 10, 25, 0, 0, 0, 0, time.UTC)
+ end := time.Date(2027, 4, 25, 0, 0, 0, 0, time.UTC)
+ changes, nextLink, deltaLink, err := client.ListOutlookCalendarDelta(context.Background(), "ca_1", "primary", start, end, "")
+ if err != nil || nextLink != "" || deltaLink == "" || len(changes) != 3 {
+ t.Fatalf("changes=%+v next=%q delta=%q err=%v", changes, nextLink, deltaLink, err)
+ }
+ if calls[0].endpoint != "/v1.0/me/calendarView/delta" ||
+ calls[0].params["startDateTime"] != "2026-10-25T00:00:00Z" ||
+ calls[0].params["endDateTime"] != "2027-04-25T00:00:00Z" ||
+ calls[0].headers["Prefer"] != outlookCalendarPreferHeader {
+ t.Fatalf("initial request=%+v", calls[0])
+ }
+ if changes[0].Start != "2026-10-27T10:00:00Z" || changes[0].End != "2026-10-27T11:00:00Z" ||
+ changes[0].Location != "Room 2" || changes[0].Organizer != "Alice <[email protected]>" ||
+ changes[0].Description != "Bring the contract." {
+ t.Fatalf("event 0=%+v", changes[0])
+ }
+ if changes[1].Start != "2026-10-28" || changes[1].End != "2026-10-29" || changes[1].Description != "All hands day" {
+ t.Fatalf("all-day event=%+v", changes[1])
+ }
+ if !changes[2].Removed || changes[2].RemovedReason != "deleted" {
+ t.Fatalf("removed event=%+v", changes[2])
+ }
+
+ // Continuation follows Graph's deltaLink without re-sending window query params.
+ if _, _, _, err := client.ListOutlookCalendarDelta(context.Background(), "ca_1", "primary", start, end, deltaLink); err != nil {
+ t.Fatal(err)
+ }
+ if calls[1].params["$deltatoken"] != "cal1" || calls[1].params["startDateTime"] != "" || calls[1].headers["Prefer"] != outlookCalendarPreferHeader {
+ t.Fatalf("continuation request=%+v", calls[1])
+ }
+
+ // HTTP 410 Gone signals an expired delta token.
+ if _, _, _, err := client.ListOutlookCalendarDelta(context.Background(), "ca_1", "primary", start, end, deltaLink); !errors.Is(err, ErrOutlookDeltaExpired) {
+ t.Fatalf("410 error=%v, want ErrOutlookDeltaExpired", err)
+ }
+}
diff --git a/apps/teamhub/internal/composio/polls.go b/apps/teamhub/internal/composio/polls.go
index b4812888..539f2e05 100644
--- a/apps/teamhub/internal/composio/polls.go
+++ b/apps/teamhub/internal/composio/polls.go
@@ -319,6 +319,157 @@ func (c *Client) ListOutlookMessageDelta(ctx context.Context, connectedAccountID
const outlookDeltaFields = "subject,from,toRecipients,webLink,isRead,parentFolderId,createdDateTime,receivedDateTime"
+const outlookCalendarPreferHeader = `odata.maxpagesize=50, outlook.timezone="UTC"`
+
+// OutlookCalendarChange is one event entry returned by Microsoft Graph
+// calendarView/delta. Deleted or out-of-window entries set Removed with
+// RemovedReason ("deleted" or "changed") and carry no event fields beyond ID.
+type OutlookCalendarChange struct {
+ ID string
+ Subject string
+ Removed bool
+ RemovedReason string
+ IsCancelled bool
+ IsAllDay bool
+ CreatedAt time.Time
+ LastModified time.Time
+ Start string
+ End string
+ Organizer string
+ Description string
+ Location string
+}
+
+// ListOutlookCalendarDelta reads one page of Microsoft Graph calendarView/delta.
+// On the first call (deltaLink empty), start and end define the bounded view
+// window baked into Graph's continuation tokens; subsequent calls follow the
+// returned nextLink or deltaLink without re-sending query parameters.
+func (c *Client) ListOutlookCalendarDelta(ctx context.Context, connectedAccountID, calendarID string, start, end time.Time, deltaLink string) ([]OutlookCalendarChange, string, string, error) {
+ request, err := graphPollRequest(connectedAccountID, deltaLink)
+ if err != nil {
+ return nil, "", "", err
+ }
+ if deltaLink == "" {
+ if calendarID == "" || calendarID == "primary" {
+ request.Endpoint = "/v1.0/me/calendarView/delta"
+ } else {
+ request.Endpoint = "/v1.0/me/calendars/" + url.PathEscape(calendarID) + "/calendarView/delta"
+ }
+ request.Parameters = []proxyParameter{
+ {Name: "startDateTime", Value: start.UTC().Format(time.RFC3339), Type: "query"},
+ {Name: "endDateTime", Value: end.UTC().Format(time.RFC3339), Type: "query"},
+ }
+ }
+ request.Parameters = append(request.Parameters, proxyParameter{
+ Name: "Prefer", Value: outlookCalendarPreferHeader, Type: "header",
+ })
+
+ var wire struct {
+ Value []struct {
+ ID string `json:"id"`
+ Subject string `json:"subject"`
+ IsAllDay bool `json:"isAllDay"`
+ IsCancelled bool `json:"isCancelled"`
+ CreatedDateTime string `json:"createdDateTime"`
+ LastModifiedDateTime string `json:"lastModifiedDateTime"`
+ Start struct {
+ DateTime string `json:"dateTime"`
+ TimeZone string `json:"timeZone"`
+ } `json:"start"`
+ End struct {
+ DateTime string `json:"dateTime"`
+ TimeZone string `json:"timeZone"`
+ } `json:"end"`
+ Location struct {
+ DisplayName string `json:"displayName"`
+ } `json:"location"`
+ Organizer outlookRecipient `json:"organizer"`
+ Body struct {
+ ContentType string `json:"contentType"`
+ Content string `json:"content"`
+ } `json:"body"`
+ BodyPreview string `json:"bodyPreview"`
+ Removed *struct {
+ Reason string `json:"reason"`
+ } `json:"@removed"`
+ } `json:"value"`
+ NextLink string `json:"@odata.nextLink"`
+ DeltaLink string `json:"@odata.deltaLink"`
+ }
+ if err := c.proxy(ctx, request, &wire, "list Outlook calendar delta"); err != nil {
+ var remote *remoteError
+ if errors.As(err, &remote) && remote.status == http.StatusGone {
+ return nil, "", "", ErrOutlookDeltaExpired
+ }
+ return nil, "", "", err
+ }
+ if (wire.NextLink == "") == (wire.DeltaLink == "") || (wire.NextLink != "" && wire.NextLink == deltaLink) {
+ return nil, "", "", errors.New("Outlook calendar delta returned an invalid continuation")
+ }
+ out := make([]OutlookCalendarChange, 0, len(wire.Value))
+ for _, item := range wire.Value {
+ change := OutlookCalendarChange{
+ ID: item.ID,
+ Subject: item.Subject,
+ IsCancelled: item.IsCancelled,
+ IsAllDay: item.IsAllDay,
+ Start: outlookCalendarTime(item.Start.DateTime, item.Start.TimeZone, item.IsAllDay),
+ End: outlookCalendarTime(item.End.DateTime, item.End.TimeZone, item.IsAllDay),
+ Organizer: item.Organizer.String(),
+ Location: strings.TrimSpace(item.Location.DisplayName),
+ }
+ if item.Removed != nil {
+ change.Removed = true
+ change.RemovedReason = strings.TrimSpace(item.Removed.Reason)
+ }
+ if t, err := time.Parse(time.RFC3339Nano, item.CreatedDateTime); err == nil {
+ change.CreatedAt = t
+ }
+ if t, err := time.Parse(time.RFC3339Nano, item.LastModifiedDateTime); err == nil {
+ change.LastModified = t
+ }
+ description := item.Body.Content
+ if strings.EqualFold(item.Body.ContentType, "html") {
+ description = htmlText(description)
+ }
+ change.Description = pollTextBody(description, false)
+ if change.Description == "" {
+ change.Description = pollTextBody(item.BodyPreview, false)
+ }
+ out = append(out, change)
+ }
+ return out, wire.NextLink, wire.DeltaLink, nil
+}
+
+// outlookCalendarTime normalizes Graph's naive dateTimeTimeZone into an RFC3339
+// instant (or YYYY-MM-DD for all-day events) so downstream callers parse it
+// uniformly alongside Google Calendar timestamps.
+func outlookCalendarTime(dateTime, timeZone string, allDay bool) string {
+ raw := strings.TrimSpace(dateTime)
+ if raw == "" {
+ return ""
+ }
+ if allDay && len(raw) >= len(time.DateOnly) {
+ if _, err := time.Parse(time.DateOnly, raw[:len(time.DateOnly)]); err == nil {
+ return raw[:len(time.DateOnly)]
+ }
+ }
+ if parsed, err := time.Parse(time.RFC3339Nano, raw); err == nil {
+ return parsed.UTC().Format(time.RFC3339)
+ }
+ tz := strings.TrimSpace(timeZone)
+ if tz == "" || strings.EqualFold(tz, "UTC") {
+ if parsed, err := time.Parse("2006-01-02T15:04:05.9999999", raw); err == nil {
+ return parsed.UTC().Format(time.RFC3339)
+ }
+ } else if loc, err := time.LoadLocation(tz); err == nil {
+ if parsed, err := time.ParseInLocation("2006-01-02T15:04:05.9999999", raw, loc); err == nil {
+ return parsed.Format(time.RFC3339)
+ }
+ }
+ return raw
+}
+
type outlookRecipient struct {
EmailAddress struct {
Address string `json:"address"`
diff --git a/apps/teamhub/internal/externalsource/catalog_test.go b/apps/teamhub/internal/externalsource/catalog_test.go
index a0eb00fe..2714afde 100644
--- a/apps/teamhub/internal/externalsource/catalog_test.go
+++ b/apps/teamhub/internal/externalsource/catalog_test.go
@@ -135,7 +135,7 @@ func TestAppCatalogRejectsKeysOutsideTheFixedList(t *testing.T) {
func TestAppCatalogMarksProactiveReminderAppsOnlyWhenConnectable(t *testing.T) {
service := New(nil, &composio.Client{})
service.managed = configuredManagedCatalog(t)
- for key, want := range map[string]bool{"gmail": true, "outlook": true, "notion": false, "linear": false} {
+ for key, want := range map[string]bool{"gmail": true, "outlook": true, "google_calendar": true, "outlook_calendar": true, "notion": false, "linear": false} {
app, ok := service.catalogApp(key)
if !ok {
t.Fatalf("missing app %s", key)
diff --git a/apps/teamhub/internal/proactive/event.go b/apps/teamhub/internal/proactive/event.go
index b440a2bc..0623a0e2 100644
--- a/apps/teamhub/internal/proactive/event.go
+++ b/apps/teamhub/internal/proactive/event.go
@@ -275,7 +275,7 @@ func eventText(label string, event Event, accountLabel string) string {
// An Outlook label is the Microsoft account's sign-in name, which can
// belong to another mail provider; the account value itself stays
// exact so it can be passed to --account.
- if event.Source == "outlook" {
+ if event.Source == reminder.ListenerOutlook || event.Source == reminder.ListenerOutlookCalendar {
facts = append(facts, "account note: Microsoft sign-in name, the mailbox address may differ")
}
}
diff --git a/apps/teamhub/internal/proactive/event_test.go b/apps/teamhub/internal/proactive/event_test.go
index 120f4e32..ac85069c 100644
--- a/apps/teamhub/internal/proactive/event_test.go
+++ b/apps/teamhub/internal/proactive/event_test.go
@@ -66,7 +66,11 @@ func TestEventWakeNamesTheGrantedAccount(t *testing.T) {
if text := eventText("[e]", event, ""); !strings.HasPrefix(text, "[e]\nsource: outlook; kind: new_mail; connection: external_connection_abc\n") {
t.Fatalf("wake text without a label=%q", text)
}
- event.Source = "gmail"
+ event.Source, event.Kind = reminder.ListenerOutlookCalendar, "calendar_created"
+ if text := eventText("[e]", event, "[email protected]"); !strings.HasPrefix(text, "[e]\nsource: outlook_calendar; kind: calendar_created; account: [email protected]; account note: Microsoft sign-in name, the mailbox address may differ; connection: external_connection_abc\n") {
+ t.Fatalf("outlook calendar wake text=%q", text)
+ }
+ event.Source, event.Kind = "gmail", "new_mail"
if text := eventText("[e]", event, "[email protected]"); !strings.HasPrefix(text, "[e]\nsource: gmail; kind: new_mail; account: [email protected]; connection: external_connection_abc\n") {
t.Fatalf("gmail wake text=%q", text)
}
diff --git a/apps/teamhub/internal/proactive/listener.go b/apps/teamhub/internal/proactive/listener.go
index 935f7b41..3af3300b 100644
--- a/apps/teamhub/internal/proactive/listener.go
+++ b/apps/teamhub/internal/proactive/listener.go
@@ -33,19 +33,24 @@ const (
)
type listenerApp struct {
- name string
- spec reminder.ListenerSpec
+ name string
+ specs []reminder.ListenerSpec
}
-// listenerApps maps each listenable provider to the listener AnotherMe gets on
+// listenerApps maps each listenable provider to the listeners AnotherMe gets on
// a connection of it.
var listenerApps = map[string]listenerApp{
// Inbox only: mail the Human sends is not news to them.
- "gmail": {"Gmail inbox watch", reminder.ListenerSpec{Type: reminder.ListenerGmail, Match: &reminder.ListenerMatch{LabelID: "INBOX"}}},
- // The Outlook poller reads the inbox only.
- "outlook": {"Outlook inbox watch", reminder.ListenerSpec{Type: reminder.ListenerOutlook}},
- "google_calendar": {"Google Calendar watch", reminder.ListenerSpec{Type: reminder.ListenerGCal, Events: []string{"created", "updated", "cancelled"}}},
- "slack": {"Slack mention watch", reminder.ListenerSpec{Type: reminder.ListenerSlack, Channel: "*", Match: &reminder.ListenerMatch{Kind: "mention"}}},
+ "gmail": {"Gmail inbox watch", []reminder.ListenerSpec{{Type: reminder.ListenerGmail, Match: &reminder.ListenerMatch{LabelID: "INBOX"}}}},
+ // An Outlook connection covers both inbox mail and calendar events.
+ "outlook": {"Outlook watch", []reminder.ListenerSpec{
+ {Type: reminder.ListenerOutlook},
+ {Type: reminder.ListenerOutlookCalendar, Events: []string{"created", "updated", "cancelled"}},
+ }},
+ "google_calendar": {"Google Calendar watch", []reminder.ListenerSpec{{Type: reminder.ListenerGCal, Events: []string{"created", "updated", "cancelled"}}}},
+ // A calendar-only Outlook Calendar connection watches events without reading mail.
+ "outlook_calendar": {"Outlook Calendar watch", []reminder.ListenerSpec{{Type: reminder.ListenerOutlookCalendar, Events: []string{"created", "updated", "cancelled"}}}},
+ "slack": {"Slack mention watch", []reminder.ListenerSpec{{Type: reminder.ListenerSlack, Channel: "*", Match: &reminder.ListenerMatch{Kind: "mention"}}}},
}
// ListenerProviders lists the providers whose connections get a listener.
@@ -124,9 +129,12 @@ func InstallListenerTx(ctx context.Context, tx pgx.Tx, queries *store.Queries, t
if !ok {
return nil
}
- spec := app.spec
- spec.Account, spec.PollIntervalSeconds = connectionID, listenerPollSeconds
- trigger, err := json.Marshal([]reminder.ListenerSpec{spec})
+ specs := make([]reminder.ListenerSpec, len(app.specs))
+ for i, spec := range app.specs {
+ spec.Account, spec.PollIntervalSeconds = connectionID, listenerPollSeconds
+ specs[i] = spec
+ }
+ trigger, err := json.Marshal(specs)
if err != nil {
return err
}
@@ -183,7 +191,7 @@ func EventFromListener(listened reminder.ListenerEvent) (Event, bool) {
event.ExternalID = firstNonEmpty(listened.ThreadID, listened.MessageID, listened.EventID)
event.State = firstNonEmpty(listened.MessageID, listened.EventID)
event.Summary = summaryLines([2]string{"From", listened.From}, [2]string{"To", listened.To}, [2]string{"Subject", listened.Subject}, [2]string{"Body", listened.Snippet})
- case reminder.ListenerGCal:
+ case reminder.ListenerGCal, reminder.ListenerOutlookCalendar:
event.Kind = "calendar_" + listened.EventKind
event.ExternalID = firstNonEmpty(listened.MessageID, listened.EventID)
event.Summary = summaryLines([2]string{"Event ID", listened.MessageID}, [2]string{"Status", listened.EventKind}, [2]string{"Event", listened.Summary}, [2]string{"Start", listened.Start}, [2]string{"End", listened.End}, [2]string{"Location", listened.Location}, [2]string{"Organizer", listened.Organizer}, [2]string{"Description", listened.Description})
@@ -207,8 +215,8 @@ func EventFromListener(listened reminder.ListenerEvent) (Event, bool) {
return event, event.ExternalID != "" && event.Summary != ""
}
-// calendarTime reads a Google Calendar start: a time, or an all-day date in
-// local time.
+// calendarTime reads a calendar event start: an RFC3339 instant, or an all-day
+// date in local time.
func calendarTime(value string) *time.Time {
if at, err := time.Parse(time.RFC3339, value); err == nil {
return &at
diff --git a/apps/teamhub/internal/proactive/listener_test.go b/apps/teamhub/internal/proactive/listener_test.go
index 9314d0a5..bd7c19b2 100644
--- a/apps/teamhub/internal/proactive/listener_test.go
+++ b/apps/teamhub/internal/proactive/listener_test.go
@@ -14,18 +14,26 @@ import (
func TestListenerAppsHearOnlyWhatIsNewsToTheHuman(t *testing.T) {
for _, check := range []struct {
provider string
+ ordinal int
event reminder.ListenerEvent
want bool
}{
- {"gmail", reminder.ListenerEvent{Source: "gmail", LabelIDs: []string{"INBOX", "UNREAD"}}, true},
- {"gmail", reminder.ListenerEvent{Source: "gmail", LabelIDs: []string{"SENT"}}, false},
- {"outlook", reminder.ListenerEvent{Source: "outlook"}, true},
- {"google_calendar", reminder.ListenerEvent{Source: "gcal", EventKind: "cancelled"}, true},
- {"slack", reminder.ListenerEvent{Source: "slack", EventKind: "message", IsMention: true}, true},
- {"slack", reminder.ListenerEvent{Source: "slack", EventKind: "message"}, false},
+ {"gmail", 0, reminder.ListenerEvent{Source: "gmail", LabelIDs: []string{"INBOX", "UNREAD"}}, true},
+ {"gmail", 0, reminder.ListenerEvent{Source: "gmail", LabelIDs: []string{"SENT"}}, false},
+ {"outlook", 0, reminder.ListenerEvent{Source: "outlook"}, true},
+ {"outlook", 1, reminder.ListenerEvent{Source: "outlook_calendar", EventKind: "updated"}, true},
+ {"outlook", 1, reminder.ListenerEvent{Source: "outlook_calendar", EventKind: "moved"}, false},
+ {"google_calendar", 0, reminder.ListenerEvent{Source: "gcal", EventKind: "cancelled"}, true},
+ {"outlook_calendar", 0, reminder.ListenerEvent{Source: "outlook_calendar", EventKind: "cancelled"}, true},
+ {"slack", 0, reminder.ListenerEvent{Source: "slack", EventKind: "message", IsMention: true}, true},
+ {"slack", 0, reminder.ListenerEvent{Source: "slack", EventKind: "message"}, false},
} {
- if got := reminder.MatchEvent(listenerApps[check.provider].spec, check.event); got != check.want {
- t.Errorf("%s listener heard %+v: %v, want %v", check.provider, check.event, got, check.want)
+ specs := listenerApps[check.provider].specs
+ if check.ordinal >= len(specs) {
+ t.Fatalf("%s missing spec ordinal %d", check.provider, check.ordinal)
+ }
+ if got := reminder.MatchEvent(specs[check.ordinal], check.event); got != check.want {
+ t.Errorf("%s[%d] listener heard %+v: %v, want %v", check.provider, check.ordinal, check.event, got, check.want)
}
}
}
@@ -65,6 +73,10 @@ func TestListenerEventNamesOneMatterPerThreadOrCalendarEvent(t *testing.T) {
if allDay.OccursAt == nil || !allDay.OccursAt.Equal(time.Date(2026, 10, 23, 16, 0, 0, 0, time.UTC)) {
t.Fatalf("all-day start=%v, want Beijing midnight", allDay.OccursAt)
}
+ outlookCal, ok := EventFromListener(reminder.ListenerEvent{Source: reminder.ListenerOutlookCalendar, EventID: "oe1:2026-10-22T01:00:00Z", MessageID: "oe1", EventKind: "created", Summary: "Client sync", Start: "2026-10-23T02:00:00Z", End: "2026-10-23T03:00:00Z", Location: "Room A"})
+ if !ok || outlookCal.Source != reminder.ListenerOutlookCalendar || outlookCal.ExternalID != "oe1" || outlookCal.Kind != "calendar_created" || outlookCal.OccursAt == nil || !outlookCal.OccursAt.Equal(time.Date(2026, 10, 23, 2, 0, 0, 0, time.UTC)) {
+ t.Fatalf("outlook calendar=%+v ok=%v", outlookCal, ok)
+ }
reply, ok := EventFromListener(reminder.ListenerEvent{Source: "slack", EventID: "C1:2.0", ChannelID: "C1", Channel: "sales", MessageID: "2.0", ThreadID: "1.0", Sender: "U2", Text: "<@U1> can the quote go out today?"})
if !ok || reply.ExternalID != "C1:1.0" || reply.State != "2.0" || !strings.Contains(reply.Summary, "Channel: #sales") {
@@ -92,9 +104,11 @@ func TestMailEventRetainsFactsBeyondProviderPreviewAndOldSummaryLimit(t *testing
}
func TestSparseCalendarCancellationStillHasJudgeEvidence(t *testing.T) {
- event, ok := EventFromListener(reminder.ListenerEvent{Source: "gcal", EventID: "cancelled:cancelled", MessageID: "cancelled", EventKind: "cancelled"})
- if !ok || !strings.Contains(event.Summary, "Status: cancelled") || !strings.Contains(event.Summary, "Event ID: cancelled") {
- t.Fatal("sparse cancellation lost before judgment")
+ for _, source := range []string{reminder.ListenerGCal, reminder.ListenerOutlookCalendar} {
+ event, ok := EventFromListener(reminder.ListenerEvent{Source: source, EventID: "cancelled:cancelled", MessageID: "cancelled", EventKind: "cancelled"})
+ if !ok || !strings.Contains(event.Summary, "Status: cancelled") || !strings.Contains(event.Summary, "Event ID: cancelled") {
+ t.Fatalf("%s sparse cancellation lost before judgment", source)
+ }
}
}
diff --git a/apps/teamhub/internal/reminder/listener.go b/apps/teamhub/internal/reminder/listener.go
index d4964885..ed04c637 100644
--- a/apps/teamhub/internal/reminder/listener.go
+++ b/apps/teamhub/internal/reminder/listener.go
@@ -18,11 +18,13 @@ const (
minPollIntervalSec = 60
)
+// Supported Routine listener binding kinds persisted in room_routine_listeners.
const (
- ListenerSlack = "slack"
- ListenerGmail = "gmail"
- ListenerOutlook = "outlook"
- ListenerGCal = "gcal"
+ ListenerSlack = "slack"
+ ListenerGmail = "gmail"
+ ListenerOutlook = "outlook"
+ ListenerGCal = "gcal"
+ ListenerOutlookCalendar = "outlook_calendar"
)
type ListenerSpec struct {
@@ -30,8 +32,8 @@ type ListenerSpec struct {
Account string `json:"account"`
Channel string `json:"channel,omitempty"` // slack: "*"
Match *ListenerMatch `json:"match,omitempty"` // slack kind; optional gmail label
- CalendarID string `json:"calendar_id,omitempty"` // gcal
- Events []string `json:"events,omitempty"` // gcal
+ CalendarID string `json:"calendar_id,omitempty"` // gcal, outlook_calendar
+ Events []string `json:"events,omitempty"` // gcal, outlook_calendar
PollIntervalSeconds int `json:"poll_interval_seconds,omitempty"`
}
@@ -92,9 +94,9 @@ func normalizeListener(spec *ListenerSpec) error {
if match != (ListenerMatch{}) {
return fmt.Errorf("outlook listeners take no match")
}
- case ListenerGCal:
+ case ListenerGCal, ListenerOutlookCalendar:
if match != (ListenerMatch{}) {
- return fmt.Errorf("gcal listeners take no match")
+ return fmt.Errorf("%s listeners take no match", spec.Type)
}
spec.CalendarID = strings.TrimSpace(spec.CalendarID)
if spec.CalendarID == "" {
@@ -123,7 +125,7 @@ type ListenerEvent struct {
Grant *GrantReference `json:"-"`
Source string `json:"source"`
EventID string `json:"event_id"`
- EventKind string `json:"event_kind,omitempty"` // gcal: created|updated|cancelled; slack: message
+ EventKind string `json:"event_kind,omitempty"` // gcal/outlook_calendar: created|updated|cancelled; slack: message
Channel string `json:"channel,omitempty"`
ChannelID string `json:"channel_id,omitempty"`
Sender string `json:"sender,omitempty"`
@@ -154,7 +156,7 @@ func MatchEvent(spec ListenerSpec, event ListenerEvent) bool {
return spec.Match == nil || spec.Match.LabelID == "" || slices.Contains(event.LabelIDs, spec.Match.LabelID)
case ListenerOutlook:
return true
- case ListenerGCal:
+ case ListenerGCal, ListenerOutlookCalendar:
return slices.Contains(spec.Events, event.EventKind)
}
return false
diff --git a/apps/teamhub/internal/reminder/listener_jobs.go b/apps/teamhub/internal/reminder/listener_jobs.go
index 02c7997c..06ac453a 100644
--- a/apps/teamhub/internal/reminder/listener_jobs.go
+++ b/apps/teamhub/internal/reminder/listener_jobs.go
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"log/slog"
+ "maps"
"sort"
"strings"
"time"
@@ -366,10 +367,11 @@ func routineSpecForBinding(ctx context.Context, queries *store.Queries, binding
type pollFetcher func(ctx context.Context, provider *composio.Client, connectedAccountID string, spec ListenerSpec, cursor pollCursor) (pollRead, error)
var pollFetchers = map[string]pollFetcher{
- ListenerSlack: fetchSlack,
- ListenerGmail: fetchGmail,
- ListenerOutlook: fetchOutlook,
- ListenerGCal: fetchGCal,
+ ListenerSlack: fetchSlack,
+ ListenerGmail: fetchGmail,
+ ListenerOutlook: fetchOutlook,
+ ListenerGCal: fetchGCal,
+ ListenerOutlookCalendar: fetchOutlookCalendar,
}
// Slack: per-channel conversations.history with oldest=cursor over every
@@ -633,6 +635,155 @@ func fetchGCal(ctx context.Context, provider *composio.Client, ca string, spec L
return read, nil
}
+const (
+ // Microsoft Graph calendarView/delta binds its token to the initial time
+ // window. Start one day back and cover six months ahead, rolling forward once
+ // less than 30 days of future coverage remain.
+ outlookCalendarWindowPast = 24 * time.Hour
+ outlookCalendarWindowFuture = 180 * 24 * time.Hour
+ outlookCalendarWindowRefresh = 30 * 24 * time.Hour
+ // Exchange may stamp lastModifiedDateTime slightly after createdDateTime on a
+ // newly created event.
+ outlookCalendarCreateSkew = 2 * time.Second
+)
+
+// Outlook Calendar: Graph calendarView/delta. Bootstrap persists the
+// observation boundary and bounded window first, then pages to a deltaLink
+// emitting only events changed after the boundary; incremental polls emit
+// created, updated, and cancelled events.
+func fetchOutlookCalendar(ctx context.Context, provider *composio.Client, ca string, spec ListenerSpec, cursor pollCursor) (pollRead, error) {
+ calendarID := spec.CalendarID
+ if calendarID == "" {
+ calendarID = "primary"
+ }
+ channels := maps.Clone(cursor.Channels)
+ if channels == nil {
+ channels = map[string]string{}
+ }
+ cursor.Channels = channels
+ now := time.Now().UTC()
+ if cursor.Channels["since"] == "" {
+ cursor.Channels["since"] = now.Format(time.RFC3339Nano)
+ cursor.Channels["window_start"] = now.Add(-outlookCalendarWindowPast).Format(time.RFC3339)
+ cursor.Channels["window_end"] = now.Add(outlookCalendarWindowFuture).Format(time.RFC3339)
+ // Commit the boundary before any remote request can fail.
+ return pollRead{cursor: cursor, nextPoll: time.Minute}, nil
+ }
+ since, err := time.Parse(time.RFC3339Nano, cursor.Channels["since"])
+ if err != nil {
+ return pollRead{}, err
+ }
+ windowStart, hasStart := parseRFC3339OK(cursor.Channels["window_start"])
+ windowEnd, hasEnd := parseRFC3339OK(cursor.Channels["window_end"])
+ needsWindowRoll := !hasStart || !hasEnd || now.Add(outlookCalendarWindowRefresh).After(windowEnd)
+ if !hasStart || !hasEnd {
+ windowStart = now.Add(-outlookCalendarWindowPast)
+ windowEnd = now.Add(outlookCalendarWindowFuture)
+ cursor.Channels["window_start"] = windowStart.Format(time.RFC3339)
+ cursor.Channels["window_end"] = windowEnd.Format(time.RFC3339)
+ }
+
+ isInitialSync := cursor.V == ""
+ link := cursor.V
+ if cursor.PageToken != "" {
+ link = cursor.PageToken
+ }
+ changes, nextLink, deltaLink, err := provider.ListOutlookCalendarDelta(ctx, ca, calendarID, windowStart, windowEnd, link)
+ if errors.Is(err, composio.ErrOutlookDeltaExpired) {
+ // Retry a lost continuation from the committed delta; if that expires too,
+ // resync from the original observation boundary. Delivery receipts dedup it.
+ if cursor.PageToken != "" {
+ cursor.PageToken = ""
+ } else {
+ cursor.V = ""
+ cursor.Channels["window_start"] = now.Add(-outlookCalendarWindowPast).Format(time.RFC3339)
+ cursor.Channels["window_end"] = now.Add(outlookCalendarWindowFuture).Format(time.RFC3339)
+ }
+ return pollRead{cursor: cursor, nextPoll: time.Minute}, nil
+ }
+ if err != nil {
+ return pollRead{}, err
+ }
+
+ read := pollRead{cursor: cursor}
+ for _, ch := range changes {
+ if ch.ID == "" {
+ return pollRead{}, errors.New("calendar change missing identity")
+ }
+ if ch.Removed {
+ // Graph emits @removed with reason "changed" when an event moves
+ // outside the view window; only deletions represent cancellations.
+ if ch.RemovedReason != "" && !strings.EqualFold(ch.RemovedReason, "deleted") {
+ continue
+ }
+ if isInitialSync {
+ continue
+ }
+ read.events = append(read.events, ListenerEvent{
+ Source: ListenerOutlookCalendar,
+ EventID: ch.ID + ":cancelled",
+ EventKind: "cancelled",
+ MessageID: ch.ID,
+ })
+ continue
+ }
+ if isInitialSync && !ch.LastModified.After(since) && !ch.CreatedAt.After(since) {
+ continue
+ }
+ kind := "updated"
+ if ch.IsCancelled {
+ kind = "cancelled"
+ } else if !ch.CreatedAt.IsZero() && (ch.LastModified.IsZero() || ch.LastModified.Sub(ch.CreatedAt) <= outlookCalendarCreateSkew) {
+ kind = "created"
+ }
+ revision := ch.LastModified.UTC().Format(time.RFC3339Nano)
+ if ch.LastModified.IsZero() {
+ if kind == "cancelled" {
+ revision = "cancelled"
+ } else if !ch.CreatedAt.IsZero() {
+ revision = ch.CreatedAt.UTC().Format(time.RFC3339Nano)
+ } else {
+ revision = kind
+ }
+ }
+ read.events = append(read.events, ListenerEvent{
+ Source: ListenerOutlookCalendar,
+ EventID: ch.ID + ":" + revision,
+ EventKind: kind,
+ Summary: ch.Subject,
+ Start: ch.Start,
+ End: ch.End,
+ Description: ch.Description,
+ Location: ch.Location,
+ Organizer: ch.Organizer,
+ MessageID: ch.ID,
+ })
+ }
+ cursor.PageToken = nextLink
+ if deltaLink != "" {
+ if !isInitialSync && needsWindowRoll {
+ // Roll the bounded delta window only after draining pending changes
+ // from the expiring delta so nothing in the last poll interval is lost.
+ cursor.V = ""
+ cursor.Channels["since"] = now.Format(time.RFC3339Nano)
+ cursor.Channels["window_start"] = now.Add(-outlookCalendarWindowPast).Format(time.RFC3339)
+ cursor.Channels["window_end"] = now.Add(outlookCalendarWindowFuture).Format(time.RFC3339)
+ read.nextPoll = time.Minute
+ } else {
+ cursor.V = deltaLink
+ }
+ } else {
+ read.nextPoll = time.Minute
+ }
+ read.cursor = cursor
+ return read, nil
+}
+
+func parseRFC3339OK(raw string) (time.Time, bool) {
+ parsed, err := time.Parse(time.RFC3339, raw)
+ return parsed, err == nil
+}
+
func fetchListenerPoll(ctx context.Context, provider *composio.Client, ca string, spec ListenerSpec, cursor pollCursor) (pollRead, error) {
if len(cursor.Pending) > 0 {
return pollRead{cursor: cursor, nextPoll: time.Minute}, nil
diff --git a/apps/teamhub/internal/reminder/listener_recovery_test.go b/apps/teamhub/internal/reminder/listener_recovery_test.go
index 4d024b25..113843cf 100644
--- a/apps/teamhub/internal/reminder/listener_recovery_test.go
+++ b/apps/teamhub/internal/reminder/listener_recovery_test.go
@@ -203,7 +203,7 @@ func TestPendingPollEventsDoNotWaitForProvider(t *testing.T) {
t.Error("provider contacted with saved events pending")
return 503, nil
})
- for _, source := range []string{ListenerGmail, ListenerOutlook, ListenerGCal, ListenerSlack} {
+ for _, source := range []string{ListenerGmail, ListenerOutlook, ListenerGCal, ListenerOutlookCalendar, ListenerSlack} {
cursor := pollCursor{V: "checkpoint", PageToken: "next", Pending: []ListenerEvent{{Source: source, EventID: "saved"}}}
read, err := fetchListenerPoll(t.Context(), provider, "ca", ListenerSpec{Type: source}, cursor)
if err != nil || len(read.cursor.Pending) != 1 || len(read.events) != 0 || read.nextPoll != time.Minute || read.cursor.PageToken != "next" {
@@ -279,3 +279,207 @@ func TestGmailOversizedExternalPlainKeepsReadableHTML(t *testing.T) {
})
}
}
+
+func TestOutlookCalendarBootstrapPersistsPagesAndCapturesNewEvents(t *testing.T) {
+ calls := 0
+ created := time.Now().Add(time.Minute).UTC().Format(time.RFC3339Nano)
+ provider := pollTestProvider(t, func(endpoint string, p map[string]string) (int, any) {
+ calls++
+ page := 1
+ if p["$skiptoken"] != "" {
+ page, _ = strconv.Atoi(p["$skiptoken"])
+ }
+ if page != calls || endpoint != "/v1.0/me/calendarView/delta" {
+ t.Errorf("page %d call %d endpoint %s", page, calls, endpoint)
+ }
+ if page == 1 && (p["startDateTime"] == "" || p["endDateTime"] == "") {
+ t.Errorf("initial sync missing window bounds: %v", p)
+ }
+ items := []any{
+ map[string]any{"id": "old", "subject": "Past review", "createdDateTime": "2000-01-01T00:00:00Z", "lastModifiedDateTime": "2000-01-01T00:00:00Z"},
+ map[string]any{"id": "gone", "@removed": map[string]string{"reason": "deleted"}},
+ }
+ if page == 2 {
+ items = append(items, map[string]any{
+ "id": "new1", "subject": "Board sync",
+ "createdDateTime": created, "lastModifiedDateTime": created,
+ "start": map[string]string{"dateTime": "2026-11-22T09:00:00.0000000", "timeZone": "UTC"},
+ "end": map[string]string{"dateTime": "2026-11-22T10:00:00.0000000", "timeZone": "UTC"},
+ })
+ }
+ wire := map[string]any{"value": items}
+ if page < 3 {
+ wire["@odata.nextLink"] = fmt.Sprintf("https://graph.microsoft.com/v1.0/me/calendarView/delta?$skiptoken=%d", page+1)
+ } else {
+ wire["@odata.deltaLink"] = "https://graph.microsoft.com/v1.0/me/calendarView/delta?$deltatoken=cal_done"
+ }
+ return 200, wire
+ })
+ first, err := fetchOutlookCalendar(t.Context(), provider, "ca", ListenerSpec{}, pollCursor{})
+ if err != nil || calls != 0 || first.cursor.Channels["since"] == "" || first.cursor.Channels["window_end"] == "" {
+ t.Fatalf("observation boundary was not saved before remote reads: %+v calls=%d err=%v", first, calls, err)
+ }
+ cursor := persistedPollCursor(t, first.cursor)
+ boundary := cursor.Channels["since"]
+ for page := 1; page <= 3; page++ {
+ read, err := fetchOutlookCalendar(t.Context(), provider, "ca", ListenerSpec{}, cursor)
+ if err != nil {
+ t.Fatal(err)
+ }
+ cursor = persistedPollCursor(t, read.cursor)
+ if cursor.Channels["since"] != boundary {
+ t.Fatal("bootstrap boundary moved")
+ }
+ if page < 3 && (cursor.V != "" || cursor.PageToken == "" || read.nextPoll != time.Minute) {
+ t.Fatalf("bootstrap lost continuation on page %d: %+v", page, read)
+ }
+ if page == 2 {
+ if len(read.events) != 1 || read.events[0].Source != ListenerOutlookCalendar || read.events[0].EventKind != "created" || read.events[0].Start != "2026-11-22T09:00:00Z" {
+ t.Fatalf("event arriving during bootstrap lost: %+v", read.events)
+ }
+ } else if len(read.events) != 0 {
+ t.Fatalf("pre-existing event or tombstone emitted during bootstrap on page %d: %+v", page, read.events)
+ }
+ }
+ if calls != 3 || cursor.PageToken != "" || !strings.Contains(cursor.V, "cal_done") {
+ t.Fatalf("final cursor=%+v calls=%d", cursor, calls)
+ }
+}
+
+func TestOutlookCalendarPollClassifiesCreatedUpdatedAndCancelled(t *testing.T) {
+ provider := pollTestProvider(t, func(endpoint string, p map[string]string) (int, any) {
+ if endpoint != "/v1.0/me/calendarView/delta" || p["$deltatoken"] != "old" {
+ t.Errorf("unexpected request %s %v", endpoint, p)
+ }
+ return 200, map[string]any{
+ "@odata.deltaLink": "https://graph.microsoft.com/v1.0/me/calendarView/delta?$deltatoken=new",
+ "value": []any{
+ map[string]any{
+ "id": "c1", "subject": "Created meeting",
+ "createdDateTime": "2026-10-29T01:00:00.000Z", "lastModifiedDateTime": "2026-10-29T01:00:00.500Z",
+ "start": map[string]string{"dateTime": "2026-10-30T14:00:00.0000000", "timeZone": "UTC"},
+ "end": map[string]string{"dateTime": "2026-10-30T15:00:00.0000000", "timeZone": "UTC"},
+ "location": map[string]string{"displayName": "Room 3"},
+ "organizer": map[string]any{"emailAddress": map[string]string{"name": "Host", "address": "[email protected]"}},
+ "body": map[string]string{"contentType": "html", "content": "<p>Bring notes.</p>"},
+ },
+ map[string]any{
+ "id": "u1", "subject": "Rescheduled meeting",
+ "createdDateTime": "2026-10-01T00:00:00Z", "lastModifiedDateTime": "2026-10-29T02:00:00Z",
+ "start": map[string]string{"dateTime": "2026-10-31T16:00:00.0000000", "timeZone": "UTC"},
+ },
+ map[string]any{
+ "id": "x1", "subject": "Cancelled meeting", "isCancelled": true,
+ "createdDateTime": "2026-10-01T00:00:00Z", "lastModifiedDateTime": "2026-10-29T03:00:00Z",
+ },
+ map[string]any{"id": "d1", "@removed": map[string]string{"reason": "deleted"}},
+ map[string]any{"id": "m1", "@removed": map[string]string{"reason": "changed"}},
+ },
+ }
+ })
+ cursor := pollCursor{
+ V: "https://graph.microsoft.com/v1.0/me/calendarView/delta?$deltatoken=old",
+ Channels: map[string]string{
+ "since": "2026-10-28T00:00:00Z",
+ "window_start": time.Now().Add(-24 * time.Hour).UTC().Format(time.RFC3339),
+ "window_end": time.Now().Add(180 * 24 * time.Hour).UTC().Format(time.RFC3339),
+ },
+ }
+ read, err := fetchOutlookCalendar(t.Context(), provider, "ca", ListenerSpec{}, cursor)
+ if err != nil || len(read.events) != 4 || !strings.Contains(read.cursor.V, "$deltatoken=new") {
+ t.Fatalf("read=%+v err=%v", read, err)
+ }
+ if read.events[0].EventKind != "created" || read.events[0].Description != "Bring notes." || read.events[0].Location != "Room 3" || read.events[0].Organizer != "Host <[email protected]>" {
+ t.Fatalf("created event=%+v", read.events[0])
+ }
+ if read.events[1].EventKind != "updated" || read.events[1].Start != "2026-10-31T16:00:00Z" {
+ t.Fatalf("updated event=%+v", read.events[1])
+ }
+ if read.events[2].EventKind != "cancelled" || read.events[2].MessageID != "x1" {
+ t.Fatalf("isCancelled event=%+v", read.events[2])
+ }
+ if read.events[3].EventKind != "cancelled" || read.events[3].EventID != "d1:cancelled" {
+ t.Fatalf("removed deleted event=%+v", read.events[3])
+ }
+}
+
+func TestOutlookCalendarExpiredContinuationReplaysThenResyncs(t *testing.T) {
+ calls := 0
+ provider := pollTestProvider(t, func(_ string, p map[string]string) (int, any) {
+ calls++
+ if calls <= 2 {
+ return 410, map[string]any{}
+ }
+ if p["startDateTime"] == "" || p["endDateTime"] == "" {
+ t.Fatalf("expired delta did not restart initial sync: %v", p)
+ }
+ return 200, map[string]any{"@odata.deltaLink": "https://graph.microsoft.com/v1.0/me/calendarView/delta?$deltatoken=fresh"}
+ })
+ cursor := pollCursor{
+ V: "https://graph.microsoft.com/v1.0/me/calendarView/delta?$deltatoken=old",
+ PageToken: "https://graph.microsoft.com/v1.0/me/calendarView/delta?$skiptoken=expired",
+ Channels: map[string]string{
+ "since": "2026-10-28T00:00:00Z",
+ "window_start": time.Now().Add(-24 * time.Hour).UTC().Format(time.RFC3339),
+ "window_end": time.Now().Add(180 * 24 * time.Hour).UTC().Format(time.RFC3339),
+ },
+ }
+ for round := 1; round <= 3; round++ {
+ read, err := fetchOutlookCalendar(t.Context(), provider, "ca", ListenerSpec{}, cursor)
+ if err != nil {
+ t.Fatal(err)
+ }
+ cursor = persistedPollCursor(t, read.cursor)
+ if cursor.Channels["since"] != "2026-10-28T00:00:00Z" {
+ t.Fatal("resync lost original observation boundary")
+ }
+ if round == 1 && (cursor.V == "" || cursor.PageToken != "") {
+ t.Fatal("checkpoint discarded with expired page")
+ }
+ if round == 2 && (cursor.V != "" || cursor.PageToken != "") {
+ t.Fatal("expired checkpoint not reset")
+ }
+ }
+ if !strings.Contains(cursor.V, "fresh") {
+ t.Fatalf("resync did not finish: %+v", cursor)
+ }
+}
+
+func TestOutlookCalendarRollsWindowBeforeCoverageExpires(t *testing.T) {
+ calls := 0
+ provider := pollTestProvider(t, func(endpoint string, p map[string]string) (int, any) {
+ calls++
+ if endpoint != "/v1.0/me/calendarView/delta" || p["$deltatoken"] != "old" {
+ t.Errorf("unexpected request %s %v", endpoint, p)
+ }
+ return 200, map[string]any{
+ "@odata.deltaLink": "https://graph.microsoft.com/v1.0/me/calendarView/delta?$deltatoken=drained",
+ "value": []any{
+ map[string]any{
+ "id": "u_last", "subject": "Moved before roll",
+ "createdDateTime": "2026-06-02T00:00:00Z", "lastModifiedDateTime": "2026-10-29T02:00:00Z",
+ "start": map[string]string{"dateTime": "2026-11-01T10:00:00.0000000", "timeZone": "UTC"},
+ },
+ },
+ }
+ })
+ cursor := pollCursor{
+ V: "https://graph.microsoft.com/v1.0/me/calendarView/delta?$deltatoken=old",
+ Channels: map[string]string{
+ "since": "2026-06-01T00:00:00Z",
+ "window_start": "2026-05-31T00:00:00Z",
+ "window_end": time.Now().Add(10 * 24 * time.Hour).UTC().Format(time.RFC3339),
+ },
+ }
+ read, err := fetchOutlookCalendar(t.Context(), provider, "ca", ListenerSpec{}, cursor)
+ if err != nil || calls != 1 || len(read.events) != 1 || read.events[0].MessageID != "u_last" || read.cursor.V != "" || read.nextPoll != time.Minute {
+ t.Fatalf("window roll must drain pending delta before resetting cursor: %+v calls=%d err=%v", read, calls, err)
+ }
+ if cursor.Channels["since"] != "2026-06-01T00:00:00Z" {
+ t.Fatal("input cursor channels mutated before persistence")
+ }
+ nextEnd, err := time.Parse(time.RFC3339, read.cursor.Channels["window_end"])
+ if err != nil || nextEnd.Before(time.Now().Add(150*24*time.Hour)) {
+ t.Fatalf("rolled window_end too soon: %q err=%v", read.cursor.Channels["window_end"], err)
+ }
+}
diff --git a/apps/teamhub/internal/reminder/listener_service.go b/apps/teamhub/internal/reminder/listener_service.go
index a175e595..e930ee7a 100644
--- a/apps/teamhub/internal/reminder/listener_service.go
+++ b/apps/teamhub/internal/reminder/listener_service.go
@@ -92,7 +92,11 @@ func DeleteTemplateRoutinesTx(ctx context.Context, queries *store.Queries, key s
// lockListenerConnectionsTx verifies the Agent's grant for every connection
// the listener specs reference and share-locks it for the transaction.
func lockListenerConnectionsTx(ctx context.Context, queries *store.Queries, tenantID, agentActorID string, specs []ListenerSpec) error {
+ locked := make(map[string]bool, len(specs))
for _, spec := range specs {
+ if locked[spec.Account] {
+ continue
+ }
if _, err := queries.LockGrantedConnectionForListener(ctx, store.LockGrantedConnectionForListenerParams{
ConnectionID: spec.Account, AgentActorID: agentActorID, TenantID: tenantID,
}); errors.Is(err, pgx.ErrNoRows) {
@@ -100,6 +104,7 @@ func lockListenerConnectionsTx(ctx context.Context, queries *store.Queries, tena
} else if err != nil {
return err
}
+ locked[spec.Account] = true
}
return nil
}
diff --git a/apps/teamhub/internal/reminder/listener_test.go b/apps/teamhub/internal/reminder/listener_test.go
index a5836d21..099f2213 100644
--- a/apps/teamhub/internal/reminder/listener_test.go
+++ b/apps/teamhub/internal/reminder/listener_test.go
@@ -15,12 +15,14 @@ func TestParseTriggerSpecAcceptsOnlyInstalledShapes(t *testing.T) {
{"type":"gmail","account":"conn_gmail","match":{"label_id":"INBOX"}},
{"type":"gmail","account":"conn_gmail"},
{"type":"outlook","account":"conn_outlook","poll_interval_seconds":600},
- {"type":"gcal","account":"conn_gcal","events":[" created ","cancelled"]}
+ {"type":"gcal","account":"conn_gcal","events":[" created ","cancelled"]},
+ {"type":"outlook_calendar","account":"conn_outlook","events":["created"," updated ","cancelled"]}
]`))
if err != nil {
t.Fatal(err)
}
- if specs[0].Account != "conn_slack" || specs[4].CalendarID != "primary" || specs[4].Events[0] != "created" {
+ if specs[0].Account != "conn_slack" || specs[4].CalendarID != "primary" || specs[4].Events[0] != "created" ||
+ specs[5].CalendarID != "primary" || specs[5].Events[1] != "updated" {
t.Fatalf("not normalized: %+v", specs)
}
if !strings.Contains(string(canonical), `"calendar_id":"primary"`) {
@@ -28,18 +30,21 @@ func TestParseTriggerSpecAcceptsOnlyInstalledShapes(t *testing.T) {
}
nine := "[" + strings.TrimSuffix(strings.Repeat(`{"type":"outlook","account":"a"},`, 9), ",") + "]"
for name, raw := range map[string]string{
- "object": `{"type":"gmail","account":"a"}`,
- "empty": `[]`,
- "nine listeners": nine,
- "no account": `[{"type":"gmail"}]`,
- "slack channel": `[{"type":"slack","account":"a","channel":"C1","match":{"kind":"mention"}}]`,
- "slack keyword": `[{"type":"slack","account":"a","channel":"*","match":{"kind":"keyword"}}]`,
- "gmail kind": `[{"type":"gmail","account":"a","match":{"kind":"mention"}}]`,
- "outlook match": `[{"type":"outlook","account":"a","match":{"label_id":"INBOX"}}]`,
- "gcal without event": `[{"type":"gcal","account":"a"}]`,
- "gcal unknown event": `[{"type":"gcal","account":"a","events":["moved"]}]`,
- "teams": `[{"type":"teams","account":"a"}]`,
- "fast poll": `[{"type":"outlook","account":"a","poll_interval_seconds":30}]`,
+ "object": `{"type":"gmail","account":"a"}`,
+ "empty": `[]`,
+ "nine listeners": nine,
+ "no account": `[{"type":"gmail"}]`,
+ "slack channel": `[{"type":"slack","account":"a","channel":"C1","match":{"kind":"mention"}}]`,
+ "slack keyword": `[{"type":"slack","account":"a","channel":"*","match":{"kind":"keyword"}}]`,
+ "gmail kind": `[{"type":"gmail","account":"a","match":{"kind":"mention"}}]`,
+ "outlook match": `[{"type":"outlook","account":"a","match":{"label_id":"INBOX"}}]`,
+ "gcal without event": `[{"type":"gcal","account":"a"}]`,
+ "gcal unknown event": `[{"type":"gcal","account":"a","events":["moved"]}]`,
+ "outlook_calendar without event": `[{"type":"outlook_calendar","account":"a"}]`,
+ "outlook_calendar unknown event": `[{"type":"outlook_calendar","account":"a","events":["moved"]}]`,
+ "outlook_calendar match": `[{"type":"outlook_calendar","account":"a","events":["created"],"match":{"label_id":"INBOX"}}]`,
+ "teams": `[{"type":"teams","account":"a"}]`,
+ "fast poll": `[{"type":"outlook","account":"a","poll_interval_seconds":30}]`,
} {
if _, _, err := parseTriggerSpec(json.RawMessage(raw)); !errors.Is(err, ErrInvalid) {
t.Errorf("%s: err=%v, want ErrInvalid", name, err)
@@ -50,6 +55,7 @@ func TestParseTriggerSpecAcceptsOnlyInstalledShapes(t *testing.T) {
func TestMatchEventAppliesTheSpecFilter(t *testing.T) {
inbox := ListenerSpec{Type: ListenerGmail, Match: &ListenerMatch{LabelID: "INBOX"}}
calendar := ListenerSpec{Type: ListenerGCal, Events: []string{"created", "cancelled"}}
+ outlookCalendar := ListenerSpec{Type: ListenerOutlookCalendar, Events: []string{"created", "cancelled"}}
for _, tc := range []struct {
name string
spec ListenerSpec
@@ -64,6 +70,8 @@ func TestMatchEventAppliesTheSpecFilter(t *testing.T) {
{"outlook", ListenerSpec{Type: ListenerOutlook}, ListenerEvent{}, true},
{"calendar created", calendar, ListenerEvent{EventKind: "created"}, true},
{"calendar updated", calendar, ListenerEvent{EventKind: "updated"}, false},
+ {"outlook calendar created", outlookCalendar, ListenerEvent{EventKind: "created"}, true},
+ {"outlook calendar updated", outlookCalendar, ListenerEvent{EventKind: "updated"}, false},
{"unknown type", ListenerSpec{Type: "teams"}, ListenerEvent{}, false},
} {
if got := MatchEvent(tc.spec, tc.event); got != tc.want {
@@ -75,9 +83,11 @@ func TestMatchEventAppliesTheSpecFilter(t *testing.T) {
// A listener Routine is listed by its connection provider.
func TestListenerOfNamesTheProvider(t *testing.T) {
for trigger, want := range map[string]string{
- `[{"type":"gcal","account":"a","events":["created"]}]`: "google_calendar",
- `[{"type":"gmail","account":"a"}]`: "gmail",
- `[{"type":"slack","account":"a"}]`: "slack",
+ `[{"type":"gcal","account":"a","events":["created"]}]`: "google_calendar",
+ `[{"type":"outlook_calendar","account":"a","events":["created"]}]`: "outlook_calendar",
+ `[{"type":"outlook","account":"a"},{"type":"outlook_calendar","account":"a","events":["created"]}]`: "outlook",
+ `[{"type":"gmail","account":"a"}]`: "gmail",
+ `[{"type":"slack","account":"a"}]`: "slack",
} {
if got := listenerOf([]byte(trigger)); got == nil || got.App != want {
t.Errorf("%s: listener=%+v, want %s", trigger, got, want)
diff --git a/apps/teamhub/internal/reminder/model.go b/apps/teamhub/internal/reminder/model.go
index 38e2631e..31895887 100644
--- a/apps/teamhub/internal/reminder/model.go
+++ b/apps/teamhub/internal/reminder/model.go
@@ -85,8 +85,8 @@ func routineTimezone(cadence Cadence) string {
return cadence.Timezone
}
-// listenerOf names the app of a listener Routine's trigger. The installer
-// gives every listener one spec.
+// listenerOf names the app of a listener Routine's trigger. Multi-spec
+// listeners such as Outlook keep their connection provider on the first spec.
func listenerOf(trigger []byte) *Listener {
var specs []ListenerSpec
if json.Unmarshal(trigger, &specs) != nil || len(specs) == 0 {
diff --git a/apps/teamhub/internal/reminder/types.go b/apps/teamhub/internal/reminder/types.go
index 2f1fe95a..212fb8f6 100644
--- a/apps/teamhub/internal/reminder/types.go
+++ b/apps/teamhub/internal/reminder/types.go
@@ -89,7 +89,7 @@ type Reminder struct {
// Listener names the connected app an app listener Routine listens to.
type Listener struct {
- // App is the connection provider: gmail, outlook, google_calendar, slack.
+ // App is the connection provider: gmail, outlook, google_calendar, outlook_calendar, slack.
App string `json:"app"`
}
diff --git a/apps/teamhub/migrations/00886_outlook_calendar_listener.sql b/apps/teamhub/migrations/00886_outlook_calendar_listener.sql
new file mode 100644
index 00000000..a00042d6
--- /dev/null
+++ b/apps/teamhub/migrations/00886_outlook_calendar_listener.sql
@@ -0,0 +1,57 @@
+-- +goose Up
+-- Routine listeners may poll Outlook Calendar alongside Outlook inbox mail.
+ALTER TABLE room_routine_listeners DROP CONSTRAINT room_routine_listeners_kind_check;
+ALTER TABLE room_routine_listeners ADD CONSTRAINT room_routine_listeners_kind_check CHECK (
+ kind = ANY (ARRAY['slack'::text, 'gmail'::text, 'outlook'::text, 'gcal'::text, 'outlook_calendar'::text])
+);
+
+-- Add the calendar binding to existing Outlook listener Routines while keeping
+-- their inbox delta cursors intact. Running the trigger update and binding
+-- insert in one CTE guarantees both touch the exact same Routines.
+WITH upgraded AS (
+ UPDATE room_reminders r
+ SET trigger = r.trigger || jsonb_build_array(
+ jsonb_build_object(
+ 'type', 'outlook_calendar',
+ 'account', l.connection_id,
+ 'calendar_id', 'primary',
+ 'events', jsonb_build_array('created', 'updated', 'cancelled'),
+ 'poll_interval_seconds', l.poll_interval_seconds
+ )
+ ),
+ updated_at = clock_timestamp()
+ FROM room_routine_listeners l
+ WHERE l.routine_id = r.id
+ AND l.ordinal = 0
+ AND l.kind = 'outlook'
+ AND r.template_routine_key LIKE 'anotherme_proactive_listener:%'
+ AND r.trigger IS NOT NULL
+ AND jsonb_array_length(r.trigger) = 1
+ AND NOT EXISTS (
+ SELECT 1 FROM room_routine_listeners existing
+ WHERE existing.routine_id = r.id
+ AND (existing.kind = 'outlook_calendar' OR existing.ordinal = 1)
+ )
+ RETURNING l.tenant_id, l.room_id, l.routine_id, l.connection_id, l.poll_interval_seconds
+)
+INSERT INTO room_routine_listeners (
+ id, tenant_id, room_id, routine_id, ordinal, kind, connection_id,
+ poll_cursor, poll_next_at, poll_interval_seconds
+)
+SELECT
+ 'lstr_' || md5(u.routine_id || ':outlook_calendar'),
+ u.tenant_id,
+ u.room_id,
+ u.routine_id,
+ 1,
+ 'outlook_calendar',
+ u.connection_id,
+ NULL,
+ clock_timestamp(),
+ u.poll_interval_seconds
+FROM upgraded u;
+
+-- +goose Down
+-- +goose StatementBegin
+DO $$ BEGIN RAISE EXCEPTION 'the Outlook Calendar listener migration is forward-only'; END $$;
+-- +goose StatementEnd
diff --git a/apps/teamhub/tests/integration/outlook_calendar_listener_migration_test.go b/apps/teamhub/tests/integration/outlook_calendar_listener_migration_test.go
new file mode 100644
index 00000000..4305b7c0
--- /dev/null
+++ b/apps/teamhub/tests/integration/outlook_calendar_listener_migration_test.go
@@ -0,0 +1,132 @@
+//go:build integration_migration_history
+
+package integration_test
+
+import (
+ "context"
+ "encoding/json"
+ "os"
+ "testing"
+
+ "github.com/jackc/pgx/v5/pgtype"
+ "github.com/jackc/pgx/v5/pgxpool"
+ "github.com/pressly/goose/v3"
+ "github.com/simplexai-labs/linger/apps/teamhub/internal/reminder"
+)
+
+// Existing Outlook proactive listener Routines gain an ordinal-1
+// outlook_calendar spec and binding while keeping their live inbox delta cursor
+// intact; Gmail listeners and Routines whose trigger already has multiple
+// entries are left untouched.
+func TestOutlookCalendarListenerMigrationUpgradesSingleSpecOutlookRoutines(t *testing.T) {
+ ctx := context.Background()
+ databaseURL := newEmptyDatabase(t, "outlook_cal_listener")
+ db := openMigrationTestDatabase(t, databaseURL)
+ provider, err := goose.NewProvider(goose.DialectPostgres, db, os.DirFS(teamHubMigrationDirectory(t)))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := provider.UpTo(ctx, 885); err != nil {
+ t.Fatal(err)
+ }
+ insertUnifiedDocumentIdentityFixture(t, ctx, db)
+ pool, err := pgxpool.New(ctx, databaseURL)
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(pool.Close)
+
+ inboxCursor := `{"v":"https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages/delta?$deltatoken=inbox1","channels":{"since":"2026-10-28T00:00:00Z"}}`
+ if _, err := pool.Exec(ctx, `
+ INSERT INTO rooms(id,tenant_id,name,created_by_actor_id)
+ VALUES('room_outlook_mig','tenant_document_a','Direct','actor_human_a');
+
+ INSERT INTO room_reminders(
+ id,tenant_id,room_id,created_by_actor_id,name,instruction,mention_actor_id,
+ timezone,enabled,template_agent_actor_id,template_routine_key,trigger
+ ) VALUES
+ ('routine_outlook_single','tenant_document_a','room_outlook_mig','actor_agent_a',
+ 'Outlook inbox watch','Judge events','actor_agent_a','UTC',true,
+ 'actor_agent_a','anotherme_proactive_listener:conn_outlook',
+ '[{"type":"outlook","account":"conn_outlook","poll_interval_seconds":600}]'::jsonb),
+ ('routine_gmail_single','tenant_document_a','room_outlook_mig','actor_agent_a',
+ 'Gmail inbox watch','Judge events','actor_agent_a','UTC',true,
+ 'actor_agent_a','anotherme_proactive_listener:conn_gmail',
+ '[{"type":"gmail","account":"conn_gmail","poll_interval_seconds":600}]'::jsonb),
+ ('routine_outlook_multi','tenant_document_a','room_outlook_mig','actor_agent_a',
+ 'Multi trigger','Judge events','actor_agent_a','UTC',true,
+ 'actor_agent_a','anotherme_proactive_listener:conn_outlook_multi',
+ '[{"type":"outlook","account":"conn_outlook_multi","poll_interval_seconds":600},{"type":"gmail","account":"conn_gmail","poll_interval_seconds":600}]'::jsonb);
+
+ INSERT INTO room_routine_listeners(
+ id,tenant_id,room_id,routine_id,ordinal,kind,connection_id,poll_cursor,poll_next_at,poll_interval_seconds
+ ) VALUES
+ ('lstr_00000000000000000000000000000001','tenant_document_a','room_outlook_mig','routine_outlook_single',
+ 0,'outlook','conn_outlook',$1,now(),600),
+ ('lstr_00000000000000000000000000000002','tenant_document_a','room_outlook_mig','routine_gmail_single',
+ 0,'gmail','conn_gmail','{"v":"100"}',now(),600),
+ ('lstr_00000000000000000000000000000003','tenant_document_a','room_outlook_mig','routine_outlook_multi',
+ 0,'outlook','conn_outlook_multi',$1,now(),600);
+ `, inboxCursor); err != nil {
+ t.Fatal(err)
+ }
+
+ if _, err := provider.Up(ctx); err != nil {
+ t.Fatal(err)
+ }
+
+ var rawTrigger []byte
+ if err := pool.QueryRow(ctx, `SELECT trigger FROM room_reminders WHERE id='routine_outlook_single'`).Scan(&rawTrigger); err != nil {
+ t.Fatal(err)
+ }
+ var specs []reminder.ListenerSpec
+ if err := json.Unmarshal(rawTrigger, &specs); err != nil {
+ t.Fatal(err)
+ }
+ if len(specs) != 2 || specs[0].Type != reminder.ListenerOutlook ||
+ specs[1].Type != reminder.ListenerOutlookCalendar ||
+ specs[1].Account != "conn_outlook" ||
+ specs[1].CalendarID != "primary" ||
+ specs[1].PollIntervalSeconds != 600 ||
+ len(specs[1].Events) != 3 {
+ t.Fatalf("upgraded trigger=%+v", specs)
+ }
+
+ var inboxAfter pgtype.Text
+ if err := pool.QueryRow(ctx, `SELECT poll_cursor FROM room_routine_listeners WHERE routine_id='routine_outlook_single' AND ordinal=0`).Scan(&inboxAfter); err != nil {
+ t.Fatal(err)
+ }
+ if !inboxAfter.Valid || inboxAfter.String != inboxCursor {
+ t.Fatalf("inbox cursor changed: got %+v, want %q", inboxAfter, inboxCursor)
+ }
+
+ var calKind, calConn string
+ var calCursor pgtype.Text
+ var calInterval int32
+ if err := pool.QueryRow(ctx, `SELECT kind,connection_id,poll_cursor,poll_interval_seconds FROM room_routine_listeners WHERE routine_id='routine_outlook_single' AND ordinal=1`).Scan(&calKind, &calConn, &calCursor, &calInterval); err != nil {
+ t.Fatal(err)
+ }
+ if calKind != reminder.ListenerOutlookCalendar || calConn != "conn_outlook" || calCursor.Valid || calInterval != 600 {
+ t.Fatalf("calendar binding kind=%q conn=%q cursor=%+v interval=%d", calKind, calConn, calCursor, calInterval)
+ }
+
+ for _, untouched := range []struct {
+ routineID string
+ wantTrigger int
+ }{
+ {"routine_gmail_single", 1},
+ {"routine_outlook_multi", 2},
+ } {
+ var triggerLen, bindingCount int
+ if err := pool.QueryRow(ctx, `
+ SELECT jsonb_array_length(r.trigger),
+ (SELECT count(*) FROM room_routine_listeners l WHERE l.routine_id=r.id)
+ FROM room_reminders r WHERE r.id=$1
+ `, untouched.routineID).Scan(&triggerLen, &bindingCount); err != nil {
+ t.Fatal(err)
+ }
+ if triggerLen != untouched.wantTrigger || bindingCount != 1 {
+ t.Fatalf("%s modified: triggerLen=%d bindings=%d", untouched.routineID, triggerLen, bindingCount)
+ }
+ }
+}
diff --git a/apps/teamhub/tests/integration/proactive_test.go b/apps/teamhub/tests/integration/proactive_test.go
index 2dbab10e..953ef405 100644
--- a/apps/teamhub/tests/integration/proactive_test.go
+++ b/apps/teamhub/tests/integration/proactive_test.go
@@ -339,7 +339,8 @@ func TestProactiveRoutinesEventsAndListeners(t *testing.T) {
if err := proactive.New(pool, nil, nil).SweepListeners(t.Context()); err != nil {
t.Fatal(err)
}
- waitUntil("app listeners not installed", func() bool { return appListeners() == 4 })
+ // Gmail, Google Calendar, Slack (1 binding each) plus Outlook (inbox + calendar = 2 bindings).
+ waitUntil("app listeners not installed", func() bool { return appListeners() == 5 })
if countRows(t, env, `SELECT count(*) FROM room_routine_listeners WHERE connection_id='connection_alice_notion'`) != 0 {
t.Fatal("Notion got a listener")
}
diff --git a/contracts/generated/go/teamhubagentapi/openapi.gen.go b/contracts/generated/go/teamhubagentapi/openapi.gen.go
index a60fbb1f..e7c7c4b6 100644
--- a/contracts/generated/go/teamhubagentapi/openapi.gen.go
+++ b/contracts/generated/go/teamhubagentapi/openapi.gen.go
@@ -682,10 +682,11 @@ func (e AgentReferenceMessageSegmentTargetType) Valid() bool {
// Defines values for AgentRoutineListenerApp.
const (
- Gmail AgentRoutineListenerApp = "gmail"
- GoogleCalendar AgentRoutineListenerApp = "google_calendar"
- Outlook AgentRoutineListenerApp = "outlook"
- Slack AgentRoutineListenerApp = "slack"
+ Gmail AgentRoutineListenerApp = "gmail"
+ GoogleCalendar AgentRoutineListenerApp = "google_calendar"
+ Outlook AgentRoutineListenerApp = "outlook"
+ OutlookCalendar AgentRoutineListenerApp = "outlook_calendar"
+ Slack AgentRoutineListenerApp = "slack"
)
// Valid indicates whether the value is a known member of the AgentRoutineListenerApp enum.
@@ -697,6 +698,8 @@ func (e AgentRoutineListenerApp) Valid() bool {
return true
case Outlook:
return true
+ case OutlookCalendar:
+ return true
case Slack:
return true
default:
diff --git a/contracts/generated/go/teamhubpublic/openapi.gen.go b/contracts/generated/go/teamhubpublic/openapi.gen.go
index c7746f8c..36f90f7a 100644
--- a/contracts/generated/go/teamhubpublic/openapi.gen.go
+++ b/contracts/generated/go/teamhubpublic/openapi.gen.go
@@ -3475,10 +3475,11 @@ func (e RoutineChangedPayloadChangeKind) Valid() bool {
// Defines values for RoutineListenerApp.
const (
- RoutineListenerAppGmail RoutineListenerApp = "gmail"
- RoutineListenerAppGoogleCalendar RoutineListenerApp = "google_calendar"
- RoutineListenerAppOutlook RoutineListenerApp = "outlook"
- RoutineListenerAppSlack RoutineListenerApp = "slack"
+ RoutineListenerAppGmail RoutineListenerApp = "gmail"
+ RoutineListenerAppGoogleCalendar RoutineListenerApp = "google_calendar"
+ RoutineListenerAppOutlook RoutineListenerApp = "outlook"
+ RoutineListenerAppOutlookCalendar RoutineListenerApp = "outlook_calendar"
+ RoutineListenerAppSlack RoutineListenerApp = "slack"
)
// Valid indicates whether the value is a known member of the RoutineListenerApp enum.
@@ -3490,6 +3491,8 @@ func (e RoutineListenerApp) Valid() bool {
return true
case RoutineListenerAppOutlook:
return true
+ case RoutineListenerAppOutlookCalendar:
+ return true
case RoutineListenerAppSlack:
return true
default:
diff --git a/contracts/generated/typescript/src/generated/teamhub-agent-api/types.ts b/contracts/generated/typescript/src/generated/teamhub-agent-api/types.ts
index 607fa1c8..d3da72d6 100644
--- a/contracts/generated/typescript/src/generated/teamhub-agent-api/types.ts
+++ b/contracts/generated/typescript/src/generated/teamhub-agent-api/types.ts
@@ -2526,7 +2526,12 @@ export interface components {
* @description Connected app whose new events the Routine hands to proactive judgement.
* @enum {string}
*/
- app: "gmail" | "outlook" | "google_calendar" | "slack";
+ app:
+ | "gmail"
+ | "outlook"
+ | "google_calendar"
+ | "outlook_calendar"
+ | "slack";
};
/** @description A Routine has exactly one of schedule and listener. A listener Routine is an app listener; it can only be paused and enabled, and goes away when the Human revokes AnotherMe's access to the app. */
AgentRoutine: {
diff --git a/contracts/generated/typescript/src/generated/teamhub-public/types.ts b/contracts/generated/typescript/src/generated/teamhub-public/types.ts
index 4f7c924f..061c6e88 100644
--- a/contracts/generated/typescript/src/generated/teamhub-public/types.ts
+++ b/contracts/generated/typescript/src/generated/teamhub-public/types.ts
@@ -5967,7 +5967,12 @@ export interface components {
* @description Connected app whose new events the Routine hands to proactive judgement.
* @enum {string}
*/
- app: "gmail" | "outlook" | "google_calendar" | "slack";
+ app:
+ | "gmail"
+ | "outlook"
+ | "google_calendar"
+ | "outlook_calendar"
+ | "slack";
};
/** @description A Routine has exactly one of cadence and listener. A listener Routine is AnotherMe's app listener; it can only be paused and resumed, and goes away when the Human revokes AnotherMe's access to the app. */
Routine: {
diff --git a/contracts/openapi/components/agent-collaboration.yaml b/contracts/openapi/components/agent-collaboration.yaml
index ba3b8043..3a552e24 100644
--- a/contracts/openapi/components/agent-collaboration.yaml
+++ b/contracts/openapi/components/agent-collaboration.yaml
@@ -1457,7 +1457,7 @@ components:
properties:
app:
type: string
- enum: [gmail, outlook, google_calendar, slack]
+ enum: [gmail, outlook, google_calendar, outlook_calendar, slack]
description: Connected app whose new events the Routine hands to proactive judgement.
AgentRoutine:
type: object
diff --git a/contracts/openapi/components/routines.yaml b/contracts/openapi/components/routines.yaml
index 08ee52cb..3ba57e60 100644
--- a/contracts/openapi/components/routines.yaml
+++ b/contracts/openapi/components/routines.yaml
@@ -58,7 +58,7 @@ components:
properties:
app:
type: string
- enum: [gmail, outlook, google_calendar, slack]
+ enum: [gmail, outlook, google_calendar, outlook_calendar, slack]
description: Connected app whose new events the Routine hands to proactive judgement.
Routine:
type: object
diff --git a/docs/proactive.md b/docs/proactive.md
index 47442946..6e433e67 100644
--- a/docs/proactive.md
+++ b/docs/proactive.md
@@ -19,7 +19,7 @@ result.
| Stage | Behavior |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Input | The chat with Another Me in windows of 20 messages; Gmail and Outlook inboxes, Google Calendar changes and Slack mentions, polled every 10 minutes |
+| Input | The chat with Another Me in windows of 20 messages; Gmail and Outlook inboxes, Google and Outlook Calendar changes and Slack mentions, polled every 10 minutes |
| Apps | From 22:00 to 08:00, or after five reminders that day, an app event is only recorded; one item in one state is judged once a day |
| Delivery | Waits until the chat has been quiet for 3 minutes |
| Tell now | Another Me checks the facts that may have changed, then sends one short message: the point, the facts, the next step |