@@ -5,17 +5,17 @@ import {
55 ActivityType ,
66 Agent ,
77 type Priority ,
8- Tools ,
8+ type Tools ,
99} from "@plotday/sdk" ;
1010import type {
1111 Calendar ,
1212 CalendarAuth ,
1313 CalendarTool ,
1414 SyncOptions ,
1515} from "@plotday/sdk/common/calendar" ;
16+ import { Plot } from "@plotday/sdk/tools/plot" ;
1617import { GoogleCalendar } from "@plotday/tool-google-calendar" ;
1718import { OutlookCalendar } from "@plotday/tool-outlook-calendar" ;
18- import { Plot } from "@plotday/sdk/tools/plot" ;
1919
2020type CalendarProvider = "google" | "outlook" ;
2121
@@ -36,8 +36,8 @@ export default class extends Agent {
3636 private outlookCalendar : OutlookCalendar ;
3737 private plot : Plot ;
3838
39- constructor ( protected tools : Tools ) {
40- super ( tools ) ;
39+ constructor ( id : string , protected tools : Tools ) {
40+ super ( id , tools ) ;
4141 this . googleCalendar = tools . get ( GoogleCalendar ) ;
4242 this . outlookCalendar = tools . get ( OutlookCalendar ) ;
4343 this . plot = tools . get ( Plot ) ;
@@ -61,7 +61,7 @@ export default class extends Agent {
6161
6262 private async addStoredAuth (
6363 provider : CalendarProvider ,
64- authToken : string ,
64+ authToken : string
6565 ) : Promise < void > {
6666 const auths = await this . getStoredAuths ( ) ;
6767 const existingIndex = auths . findIndex ( ( auth ) => auth . provider === provider ) ;
@@ -76,7 +76,7 @@ export default class extends Agent {
7676 }
7777
7878 private async getAuthToken (
79- provider : CalendarProvider ,
79+ provider : CalendarProvider
8080 ) : Promise < string | null > {
8181 const auths = await this . getStoredAuths ( ) ;
8282 const auth = auths . find ( ( auth ) => auth . provider === provider ) ;
@@ -98,10 +98,12 @@ export default class extends Agent {
9898 } ) ;
9999
100100 // Get auth links from both calendar tools
101- const googleAuthLink =
102- await this . googleCalendar . requestAuth ( googleCallback ) ;
103- const outlookAuthLink =
104- await this . outlookCalendar . requestAuth ( outlookCallback ) ;
101+ const googleAuthLink = await this . googleCalendar . requestAuth (
102+ googleCallback
103+ ) ;
104+ const outlookAuthLink = await this . outlookCalendar . requestAuth (
105+ outlookCallback
106+ ) ;
105107
106108 // Create activity with both auth links
107109 const connectActivity = await this . plot . createActivity ( {
@@ -129,7 +131,7 @@ export default class extends Agent {
129131 async startSync (
130132 provider : CalendarProvider ,
131133 calendarId : string ,
132- options ?: SyncOptions ,
134+ options ?: SyncOptions
133135 ) : Promise < void > {
134136 const authToken = await this . getAuthToken ( provider ) ;
135137 if ( ! authToken ) {
@@ -149,7 +151,7 @@ export default class extends Agent {
149151
150152 async stopSync (
151153 provider : CalendarProvider ,
152- calendarId : string ,
154+ calendarId : string
153155 ) : Promise < void > {
154156 const authToken = await this . getAuthToken ( provider ) ;
155157 if ( ! authToken ) {
@@ -211,7 +213,7 @@ export default class extends Agent {
211213 await this . createCalendarSelectionActivity (
212214 provider ,
213215 calendars ,
214- authResult . authToken ,
216+ authResult . authToken
215217 ) ;
216218 } catch ( error ) {
217219 console . error ( `Failed to fetch calendars for ${ provider } :` , error ) ;
@@ -221,7 +223,7 @@ export default class extends Agent {
221223 private async createCalendarSelectionActivity (
222224 provider : CalendarProvider ,
223225 calendars : Calendar [ ] ,
224- authToken : string ,
226+ authToken : string
225227 ) : Promise < void > {
226228 const links : ActivityLink [ ] = [ ] ;
227229
@@ -261,7 +263,7 @@ export default class extends Agent {
261263
262264 async onCalendarSelected (
263265 _link : ActivityLink ,
264- context : CalendarSelectionContext ,
266+ context : CalendarSelectionContext
265267 ) : Promise < void > {
266268 console . log ( "Calendar selectedwith context:" , context ) ;
267269 if ( ! context ) {
@@ -282,11 +284,11 @@ export default class extends Agent {
282284 await tool . startSync (
283285 context . authToken ,
284286 context . calendarId ,
285- eventCallback ,
287+ eventCallback
286288 ) ;
287289
288290 console . log (
289- `Started syncing ${ context . provider } calendar: ${ context . calendarName } ` ,
291+ `Started syncing ${ context . provider } calendar: ${ context . calendarName } `
290292 ) ;
291293
292294 await this . plot . createActivity ( {
@@ -297,7 +299,7 @@ export default class extends Agent {
297299 } catch ( error ) {
298300 console . error (
299301 `Failed to start sync for calendar ${ context . calendarName } :` ,
300- error ,
302+ error
301303 ) ;
302304 }
303305 }
0 commit comments