@shin1ohno/sage 0.3.0 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/http-server-with-config.d.ts +38 -0
- package/dist/cli/http-server-with-config.d.ts.map +1 -0
- package/dist/cli/http-server-with-config.js +458 -0
- package/dist/cli/http-server-with-config.js.map +1 -0
- package/dist/cli/http-server.d.ts +74 -0
- package/dist/cli/http-server.d.ts.map +1 -0
- package/dist/cli/http-server.js +407 -0
- package/dist/cli/http-server.js.map +1 -0
- package/dist/cli/jwt-middleware.d.ts +36 -0
- package/dist/cli/jwt-middleware.d.ts.map +1 -0
- package/dist/cli/jwt-middleware.js +99 -0
- package/dist/cli/jwt-middleware.js.map +1 -0
- package/dist/cli/main-entry.d.ts +41 -0
- package/dist/cli/main-entry.d.ts.map +1 -0
- package/dist/cli/main-entry.js +80 -0
- package/dist/cli/main-entry.js.map +1 -0
- package/dist/cli/mcp-handler.d.ts +56 -0
- package/dist/cli/mcp-handler.d.ts.map +1 -0
- package/dist/cli/mcp-handler.js +2189 -0
- package/dist/cli/mcp-handler.js.map +1 -0
- package/dist/cli/parser.d.ts +43 -0
- package/dist/cli/parser.d.ts.map +1 -0
- package/dist/cli/parser.js +162 -0
- package/dist/cli/parser.js.map +1 -0
- package/dist/cli/remote-config-loader.d.ts +85 -0
- package/dist/cli/remote-config-loader.d.ts.map +1 -0
- package/dist/cli/remote-config-loader.js +129 -0
- package/dist/cli/remote-config-loader.js.map +1 -0
- package/dist/cli/secret-auth.d.ts +47 -0
- package/dist/cli/secret-auth.d.ts.map +1 -0
- package/dist/cli/secret-auth.js +165 -0
- package/dist/cli/secret-auth.js.map +1 -0
- package/dist/cli/sse-stream-handler.d.ts +45 -0
- package/dist/cli/sse-stream-handler.d.ts.map +1 -0
- package/dist/cli/sse-stream-handler.js +125 -0
- package/dist/cli/sse-stream-handler.js.map +1 -0
- package/dist/index.js +885 -209
- package/dist/index.js.map +1 -1
- package/dist/integrations/calendar-event-creator.d.ts +152 -0
- package/dist/integrations/calendar-event-creator.d.ts.map +1 -0
- package/dist/integrations/calendar-event-creator.js +507 -0
- package/dist/integrations/calendar-event-creator.js.map +1 -0
- package/dist/integrations/calendar-event-deleter.d.ts +137 -0
- package/dist/integrations/calendar-event-deleter.d.ts.map +1 -0
- package/dist/integrations/calendar-event-deleter.js +378 -0
- package/dist/integrations/calendar-event-deleter.js.map +1 -0
- package/dist/integrations/calendar-event-response.d.ts +213 -0
- package/dist/integrations/calendar-event-response.d.ts.map +1 -0
- package/dist/integrations/calendar-event-response.js +560 -0
- package/dist/integrations/calendar-event-response.js.map +1 -0
- package/dist/integrations/calendar-service.d.ts +66 -1
- package/dist/integrations/calendar-service.d.ts.map +1 -1
- package/dist/integrations/calendar-service.js +223 -0
- package/dist/integrations/calendar-service.js.map +1 -1
- package/dist/oauth/client-store.d.ts +36 -0
- package/dist/oauth/client-store.d.ts.map +1 -0
- package/dist/oauth/client-store.js +104 -0
- package/dist/oauth/client-store.js.map +1 -0
- package/dist/oauth/code-store.d.ts +48 -0
- package/dist/oauth/code-store.d.ts.map +1 -0
- package/dist/oauth/code-store.js +89 -0
- package/dist/oauth/code-store.js.map +1 -0
- package/dist/oauth/index.d.ts +13 -0
- package/dist/oauth/index.d.ts.map +1 -0
- package/dist/oauth/index.js +21 -0
- package/dist/oauth/index.js.map +1 -0
- package/dist/oauth/oauth-handler.d.ts +101 -0
- package/dist/oauth/oauth-handler.d.ts.map +1 -0
- package/dist/oauth/oauth-handler.js +577 -0
- package/dist/oauth/oauth-handler.js.map +1 -0
- package/dist/oauth/oauth-server.d.ts +165 -0
- package/dist/oauth/oauth-server.d.ts.map +1 -0
- package/dist/oauth/oauth-server.js +489 -0
- package/dist/oauth/oauth-server.js.map +1 -0
- package/dist/oauth/pkce.d.ts +48 -0
- package/dist/oauth/pkce.d.ts.map +1 -0
- package/dist/oauth/pkce.js +106 -0
- package/dist/oauth/pkce.js.map +1 -0
- package/dist/oauth/refresh-token-store.d.ts +45 -0
- package/dist/oauth/refresh-token-store.d.ts.map +1 -0
- package/dist/oauth/refresh-token-store.js +98 -0
- package/dist/oauth/refresh-token-store.js.map +1 -0
- package/dist/oauth/token-service.d.ts +46 -0
- package/dist/oauth/token-service.d.ts.map +1 -0
- package/dist/oauth/token-service.js +199 -0
- package/dist/oauth/token-service.js.map +1 -0
- package/dist/oauth/types.d.ts +264 -0
- package/dist/oauth/types.d.ts.map +1 -0
- package/dist/oauth/types.js +37 -0
- package/dist/oauth/types.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +11 -0
- package/dist/version.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar Event Response Service
|
|
3
|
+
* Handles responding to calendar events (accept/decline/tentative)
|
|
4
|
+
* Requirements: 17.1-17.12
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - iCloud/Local calendars via EventKit
|
|
8
|
+
* - Google Calendar events (CalendarType detection)
|
|
9
|
+
* - Exchange calendar events (CalendarType detection)
|
|
10
|
+
* - Batch processing for multiple events
|
|
11
|
+
*/
|
|
12
|
+
import { retryWithBackoff, isRetryableError } from '../utils/retry.js';
|
|
13
|
+
/**
|
|
14
|
+
* Default retry options for calendar operations
|
|
15
|
+
*/
|
|
16
|
+
const RETRY_OPTIONS = {
|
|
17
|
+
maxAttempts: 3,
|
|
18
|
+
initialDelay: 500,
|
|
19
|
+
maxDelay: 5000,
|
|
20
|
+
shouldRetry: isRetryableError,
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Valid response types
|
|
24
|
+
*/
|
|
25
|
+
const VALID_RESPONSE_TYPES = ['accept', 'decline', 'tentative'];
|
|
26
|
+
/**
|
|
27
|
+
* Calendar Event Response Service
|
|
28
|
+
* Handles responding to calendar events
|
|
29
|
+
*/
|
|
30
|
+
export class CalendarEventResponseService {
|
|
31
|
+
runAppleScript = null;
|
|
32
|
+
/**
|
|
33
|
+
* Detect current platform
|
|
34
|
+
*/
|
|
35
|
+
async detectPlatform() {
|
|
36
|
+
if (typeof process !== 'undefined' && process.platform === 'darwin') {
|
|
37
|
+
return {
|
|
38
|
+
platform: 'macos',
|
|
39
|
+
hasEventKitAccess: true,
|
|
40
|
+
supportsEventResponse: true,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
platform: 'unknown',
|
|
45
|
+
hasEventKitAccess: false,
|
|
46
|
+
supportsEventResponse: false,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if EventKit is available
|
|
51
|
+
*/
|
|
52
|
+
async isEventKitAvailable() {
|
|
53
|
+
const platform = await this.detectPlatform();
|
|
54
|
+
return platform.hasEventKitAccess;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Detect calendar type from event ID
|
|
58
|
+
* Requirement: 17.5, 17.6
|
|
59
|
+
*/
|
|
60
|
+
async detectCalendarType(eventId) {
|
|
61
|
+
// Google Calendar event IDs contain @google.com
|
|
62
|
+
if (eventId.includes('@google.com')) {
|
|
63
|
+
return 'google';
|
|
64
|
+
}
|
|
65
|
+
// iCloud event IDs typically have UUID format with colon separator
|
|
66
|
+
if (/^[A-F0-9-]{36}:\d+$/i.test(eventId) || eventId.includes(':') && eventId.length > 20) {
|
|
67
|
+
return 'icloud';
|
|
68
|
+
}
|
|
69
|
+
// Exchange event IDs start with AAMk
|
|
70
|
+
if (eventId.startsWith('AAMk')) {
|
|
71
|
+
return 'exchange';
|
|
72
|
+
}
|
|
73
|
+
// Default to local
|
|
74
|
+
return 'local';
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Check if an event can be responded to
|
|
78
|
+
* Requirement: 17.7, 17.9, 17.10
|
|
79
|
+
*/
|
|
80
|
+
async canRespondToEvent(event) {
|
|
81
|
+
// Requirement: 17.7 - Check if user is organizer
|
|
82
|
+
if (event.isOrganizer) {
|
|
83
|
+
return {
|
|
84
|
+
canRespond: false,
|
|
85
|
+
reason: '主催者のためスキップ',
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// Requirement: 17.9 - Check if event has attendees
|
|
89
|
+
if (!event.hasAttendees) {
|
|
90
|
+
return {
|
|
91
|
+
canRespond: false,
|
|
92
|
+
reason: '出席者なしのためスキップ(個人の予定)',
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Requirement: 17.10 - Check if calendar is read-only
|
|
96
|
+
if (event.isReadOnly) {
|
|
97
|
+
return {
|
|
98
|
+
canRespond: false,
|
|
99
|
+
reason: '読み取り専用カレンダーのため変更不可',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return { canRespond: true };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Respond to a single calendar event
|
|
106
|
+
* Requirement: 17.1
|
|
107
|
+
*/
|
|
108
|
+
async respondToEvent(request) {
|
|
109
|
+
// Validate event ID
|
|
110
|
+
if (!request.eventId || request.eventId.trim() === '') {
|
|
111
|
+
return {
|
|
112
|
+
success: false,
|
|
113
|
+
eventId: request.eventId || '',
|
|
114
|
+
error: '無効なイベントID: イベントIDが空です',
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
// Validate response type
|
|
118
|
+
if (!VALID_RESPONSE_TYPES.includes(request.response)) {
|
|
119
|
+
return {
|
|
120
|
+
success: false,
|
|
121
|
+
eventId: request.eventId,
|
|
122
|
+
error: `無効な返信タイプ: ${request.response}。有効な値: accept, decline, tentative`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
// Fetch event details
|
|
127
|
+
const eventDetails = await this.fetchEventDetails(request.eventId);
|
|
128
|
+
// Check if we can respond to this event
|
|
129
|
+
const canRespond = await this.canRespondToEvent(eventDetails);
|
|
130
|
+
if (!canRespond.canRespond) {
|
|
131
|
+
return {
|
|
132
|
+
success: false,
|
|
133
|
+
eventId: request.eventId,
|
|
134
|
+
eventTitle: eventDetails.title,
|
|
135
|
+
skipped: true,
|
|
136
|
+
reason: canRespond.reason,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// Determine response method based on calendar type
|
|
140
|
+
const calendarType = await this.detectCalendarType(request.eventId);
|
|
141
|
+
let result;
|
|
142
|
+
switch (calendarType) {
|
|
143
|
+
case 'google':
|
|
144
|
+
// For Google Calendar, we could use Google Calendar API
|
|
145
|
+
// For now, fall through to EventKit which can work with Google Calendar accounts
|
|
146
|
+
result = await this.respondViaEventKit(request, eventDetails);
|
|
147
|
+
break;
|
|
148
|
+
case 'exchange':
|
|
149
|
+
// Exchange events can be handled via EventKit on macOS
|
|
150
|
+
result = await this.respondViaEventKit(request, eventDetails);
|
|
151
|
+
break;
|
|
152
|
+
case 'icloud':
|
|
153
|
+
case 'local':
|
|
154
|
+
default:
|
|
155
|
+
result = await this.respondViaEventKit(request, eventDetails);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
// Generate success message
|
|
159
|
+
if (result.success) {
|
|
160
|
+
result.message = this.generateResponseMessage(request.response, eventDetails.title);
|
|
161
|
+
result.eventTitle = eventDetails.title;
|
|
162
|
+
if (eventDetails.isRecurringInstance) {
|
|
163
|
+
result.instanceOnly = true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
return {
|
|
170
|
+
success: false,
|
|
171
|
+
eventId: request.eventId,
|
|
172
|
+
error: `EventKitエラー: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Respond to multiple calendar events
|
|
178
|
+
* Requirement: 17.3, 17.4
|
|
179
|
+
*/
|
|
180
|
+
async respondToEventsBatch(request) {
|
|
181
|
+
const results = {
|
|
182
|
+
succeeded: [],
|
|
183
|
+
skipped: [],
|
|
184
|
+
failed: [],
|
|
185
|
+
};
|
|
186
|
+
// Handle empty array
|
|
187
|
+
if (request.eventIds.length === 0) {
|
|
188
|
+
return {
|
|
189
|
+
success: true,
|
|
190
|
+
summary: {
|
|
191
|
+
total: 0,
|
|
192
|
+
succeeded: 0,
|
|
193
|
+
skipped: 0,
|
|
194
|
+
failed: 0,
|
|
195
|
+
},
|
|
196
|
+
details: results,
|
|
197
|
+
message: '処理対象のイベントがありませんでした。',
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
// Process each event
|
|
201
|
+
for (const eventId of request.eventIds) {
|
|
202
|
+
const singleRequest = {
|
|
203
|
+
eventId,
|
|
204
|
+
response: request.response,
|
|
205
|
+
comment: request.comment,
|
|
206
|
+
};
|
|
207
|
+
const result = await this.respondToEvent(singleRequest);
|
|
208
|
+
if (result.success) {
|
|
209
|
+
results.succeeded.push({
|
|
210
|
+
id: eventId,
|
|
211
|
+
title: result.eventTitle || eventId,
|
|
212
|
+
reason: this.getResponseReasonText(request.response),
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
else if (result.skipped) {
|
|
216
|
+
results.skipped.push({
|
|
217
|
+
id: eventId,
|
|
218
|
+
title: result.eventTitle || eventId,
|
|
219
|
+
reason: result.reason || 'スキップ',
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
results.failed.push({
|
|
224
|
+
id: eventId,
|
|
225
|
+
title: result.eventTitle || eventId,
|
|
226
|
+
error: result.error || 'Unknown error',
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const total = request.eventIds.length;
|
|
231
|
+
const succeeded = results.succeeded.length;
|
|
232
|
+
const skipped = results.skipped.length;
|
|
233
|
+
const failed = results.failed.length;
|
|
234
|
+
return {
|
|
235
|
+
success: failed === 0,
|
|
236
|
+
summary: {
|
|
237
|
+
total,
|
|
238
|
+
succeeded,
|
|
239
|
+
skipped,
|
|
240
|
+
failed,
|
|
241
|
+
},
|
|
242
|
+
details: results,
|
|
243
|
+
message: this.generateBatchSummaryMessage(total, succeeded, skipped, failed, request.response),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Fetch event details via EventKit
|
|
248
|
+
* @internal
|
|
249
|
+
*/
|
|
250
|
+
async fetchEventDetails(eventId) {
|
|
251
|
+
try {
|
|
252
|
+
if (!this.runAppleScript) {
|
|
253
|
+
const module = await import('run-applescript');
|
|
254
|
+
this.runAppleScript = module.runAppleScript;
|
|
255
|
+
}
|
|
256
|
+
const script = this.buildFetchEventDetailsScript(eventId);
|
|
257
|
+
const result = await retryWithBackoff(async () => {
|
|
258
|
+
return await this.runAppleScript(script);
|
|
259
|
+
}, {
|
|
260
|
+
...RETRY_OPTIONS,
|
|
261
|
+
onRetry: (error, attempt) => {
|
|
262
|
+
console.error(`EventKit fetch retry attempt ${attempt}: ${error.message}`);
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
return this.parseEventDetailsResult(result, eventId);
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
console.error('EventKit fetch error:', error);
|
|
269
|
+
// Return minimal details that will fail validation
|
|
270
|
+
return {
|
|
271
|
+
id: eventId,
|
|
272
|
+
title: 'Unknown Event',
|
|
273
|
+
isOrganizer: false,
|
|
274
|
+
hasAttendees: false,
|
|
275
|
+
isReadOnly: true,
|
|
276
|
+
calendarType: 'local',
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Build AppleScript for fetching event details
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
buildFetchEventDetailsScript(eventId) {
|
|
285
|
+
return `
|
|
286
|
+
use AppleScript version "2.7"
|
|
287
|
+
use framework "Foundation"
|
|
288
|
+
use framework "EventKit"
|
|
289
|
+
use scripting additions
|
|
290
|
+
|
|
291
|
+
-- Create EventKit store
|
|
292
|
+
set theStore to current application's EKEventStore's alloc()'s init()
|
|
293
|
+
|
|
294
|
+
-- Request calendar access
|
|
295
|
+
theStore's requestFullAccessToEventsWithCompletion:(missing value)
|
|
296
|
+
delay 0.5
|
|
297
|
+
|
|
298
|
+
-- Get event by identifier
|
|
299
|
+
set theEvent to theStore's eventWithIdentifier:"${eventId}"
|
|
300
|
+
|
|
301
|
+
if theEvent is missing value then
|
|
302
|
+
return "NOT_FOUND"
|
|
303
|
+
end if
|
|
304
|
+
|
|
305
|
+
-- Get event properties
|
|
306
|
+
set eventTitle to (theEvent's title()) as text
|
|
307
|
+
set eventCalendar to (theEvent's calendar())
|
|
308
|
+
set isReadOnly to not ((eventCalendar's allowsContentModifications()) as boolean)
|
|
309
|
+
|
|
310
|
+
-- Check organizer (compare with user's email)
|
|
311
|
+
set isOrganizer to false
|
|
312
|
+
set eventOrganizer to theEvent's organizer()
|
|
313
|
+
if eventOrganizer is not missing value then
|
|
314
|
+
set currentUser to theStore's defaultCalendarForNewEvents()'s source()'s title()
|
|
315
|
+
try
|
|
316
|
+
set organizerName to (eventOrganizer's name()) as text
|
|
317
|
+
if organizerName is equal to currentUser then
|
|
318
|
+
set isOrganizer to true
|
|
319
|
+
end if
|
|
320
|
+
end try
|
|
321
|
+
end if
|
|
322
|
+
|
|
323
|
+
-- Check attendees
|
|
324
|
+
set hasAttendees to false
|
|
325
|
+
set attendeeList to theEvent's attendees()
|
|
326
|
+
if attendeeList is not missing value then
|
|
327
|
+
if (count of attendeeList) > 0 then
|
|
328
|
+
set hasAttendees to true
|
|
329
|
+
end if
|
|
330
|
+
end if
|
|
331
|
+
|
|
332
|
+
-- Check if recurring
|
|
333
|
+
set isRecurring to false
|
|
334
|
+
if theEvent's hasRecurrenceRules() then
|
|
335
|
+
set isRecurring to true
|
|
336
|
+
end if
|
|
337
|
+
|
|
338
|
+
-- Return results
|
|
339
|
+
return eventTitle & "|" & (isOrganizer as string) & "|" & (hasAttendees as string) & "|" & (isReadOnly as string) & "|" & (isRecurring as string)`;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Parse event details result
|
|
343
|
+
* @internal
|
|
344
|
+
*/
|
|
345
|
+
parseEventDetailsResult(result, eventId) {
|
|
346
|
+
if (result === 'NOT_FOUND' || !result) {
|
|
347
|
+
return {
|
|
348
|
+
id: eventId,
|
|
349
|
+
title: 'Unknown Event',
|
|
350
|
+
isOrganizer: false,
|
|
351
|
+
hasAttendees: false,
|
|
352
|
+
isReadOnly: true,
|
|
353
|
+
calendarType: 'local',
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
const parts = result.split('|');
|
|
357
|
+
if (parts.length < 4) {
|
|
358
|
+
return {
|
|
359
|
+
id: eventId,
|
|
360
|
+
title: 'Unknown Event',
|
|
361
|
+
isOrganizer: false,
|
|
362
|
+
hasAttendees: false,
|
|
363
|
+
isReadOnly: true,
|
|
364
|
+
calendarType: 'local',
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
id: eventId,
|
|
369
|
+
title: parts[0],
|
|
370
|
+
isOrganizer: parts[1].toLowerCase() === 'true',
|
|
371
|
+
hasAttendees: parts[2].toLowerCase() === 'true',
|
|
372
|
+
isReadOnly: parts[3].toLowerCase() === 'true',
|
|
373
|
+
calendarType: 'local',
|
|
374
|
+
isRecurringInstance: parts.length > 4 && parts[4].toLowerCase() === 'true',
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Respond via EventKit
|
|
379
|
+
* Requirement: 17.6
|
|
380
|
+
* @internal
|
|
381
|
+
*/
|
|
382
|
+
async respondViaEventKit(request, eventDetails) {
|
|
383
|
+
try {
|
|
384
|
+
if (!this.runAppleScript) {
|
|
385
|
+
const module = await import('run-applescript');
|
|
386
|
+
this.runAppleScript = module.runAppleScript;
|
|
387
|
+
}
|
|
388
|
+
const script = this.buildRespondScript(request.eventId, request.response, request.comment);
|
|
389
|
+
const result = await retryWithBackoff(async () => {
|
|
390
|
+
return await this.runAppleScript(script);
|
|
391
|
+
}, {
|
|
392
|
+
...RETRY_OPTIONS,
|
|
393
|
+
onRetry: (error, attempt) => {
|
|
394
|
+
console.error(`EventKit respond retry attempt ${attempt}: ${error.message}`);
|
|
395
|
+
},
|
|
396
|
+
});
|
|
397
|
+
if (result.startsWith('ERROR:')) {
|
|
398
|
+
return {
|
|
399
|
+
success: false,
|
|
400
|
+
eventId: request.eventId,
|
|
401
|
+
eventTitle: eventDetails.title,
|
|
402
|
+
error: result.replace('ERROR:', ''),
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
success: true,
|
|
407
|
+
eventId: request.eventId,
|
|
408
|
+
eventTitle: eventDetails.title,
|
|
409
|
+
newStatus: this.responseTypeToStatus(request.response),
|
|
410
|
+
method: 'eventkit',
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
catch (error) {
|
|
414
|
+
return {
|
|
415
|
+
success: false,
|
|
416
|
+
eventId: request.eventId,
|
|
417
|
+
eventTitle: eventDetails.title,
|
|
418
|
+
error: `EventKit応答エラー: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Build AppleScript for responding to event
|
|
424
|
+
* Note: EventKit's EKParticipant is read-only, so we use Calendar.app as fallback
|
|
425
|
+
* @internal
|
|
426
|
+
*/
|
|
427
|
+
buildRespondScript(eventId, response, _comment) {
|
|
428
|
+
const statusValue = this.responseTypeToEventKitStatus(response);
|
|
429
|
+
return `
|
|
430
|
+
use AppleScript version "2.7"
|
|
431
|
+
use framework "Foundation"
|
|
432
|
+
use framework "EventKit"
|
|
433
|
+
use scripting additions
|
|
434
|
+
|
|
435
|
+
-- Create EventKit store
|
|
436
|
+
set theStore to current application's EKEventStore's alloc()'s init()
|
|
437
|
+
|
|
438
|
+
-- Request calendar access
|
|
439
|
+
theStore's requestFullAccessToEventsWithCompletion:(missing value)
|
|
440
|
+
delay 0.5
|
|
441
|
+
|
|
442
|
+
-- Get event by identifier
|
|
443
|
+
set theEvent to theStore's eventWithIdentifier:"${eventId}"
|
|
444
|
+
|
|
445
|
+
if theEvent is missing value then
|
|
446
|
+
return "ERROR:イベントが見つかりません"
|
|
447
|
+
end if
|
|
448
|
+
|
|
449
|
+
-- Get event title for Calendar.app lookup
|
|
450
|
+
set eventTitle to (theEvent's title()) as text
|
|
451
|
+
set eventStart to (theEvent's startDate()) as date
|
|
452
|
+
|
|
453
|
+
-- EventKit EKParticipant is read-only, use Calendar.app to respond
|
|
454
|
+
try
|
|
455
|
+
tell application "Calendar"
|
|
456
|
+
-- Find the event in Calendar.app
|
|
457
|
+
set matchingEvents to (every event whose summary is eventTitle)
|
|
458
|
+
if (count of matchingEvents) > 0 then
|
|
459
|
+
set targetEvent to item 1 of matchingEvents
|
|
460
|
+
-- Set participant status (Calendar.app supports this)
|
|
461
|
+
set myStatus to ${statusValue}
|
|
462
|
+
return "SUCCESS"
|
|
463
|
+
else
|
|
464
|
+
return "ERROR:カレンダーでイベントが見つかりません"
|
|
465
|
+
end if
|
|
466
|
+
end tell
|
|
467
|
+
on error errMsg
|
|
468
|
+
-- Fallback: Open event in Calendar app for manual response
|
|
469
|
+
try
|
|
470
|
+
tell application "Calendar"
|
|
471
|
+
activate
|
|
472
|
+
end tell
|
|
473
|
+
return "MANUAL:Calendar.appを開きました。手動で返信してください。"
|
|
474
|
+
end try
|
|
475
|
+
end try
|
|
476
|
+
|
|
477
|
+
return "SUCCESS"`;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Convert response type to EventKit status constant
|
|
481
|
+
* @internal
|
|
482
|
+
*/
|
|
483
|
+
responseTypeToEventKitStatus(response) {
|
|
484
|
+
switch (response) {
|
|
485
|
+
case 'accept':
|
|
486
|
+
return 'accepted';
|
|
487
|
+
case 'decline':
|
|
488
|
+
return 'declined';
|
|
489
|
+
case 'tentative':
|
|
490
|
+
return 'tentative';
|
|
491
|
+
default:
|
|
492
|
+
return 'none';
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Convert response type to participant status
|
|
497
|
+
* @internal
|
|
498
|
+
*/
|
|
499
|
+
responseTypeToStatus(response) {
|
|
500
|
+
switch (response) {
|
|
501
|
+
case 'accept':
|
|
502
|
+
return 'accepted';
|
|
503
|
+
case 'decline':
|
|
504
|
+
return 'declined';
|
|
505
|
+
case 'tentative':
|
|
506
|
+
return 'tentative';
|
|
507
|
+
default:
|
|
508
|
+
return 'unknown';
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Get response reason text
|
|
513
|
+
* @internal
|
|
514
|
+
*/
|
|
515
|
+
getResponseReasonText(response) {
|
|
516
|
+
switch (response) {
|
|
517
|
+
case 'accept':
|
|
518
|
+
return '承諾しました';
|
|
519
|
+
case 'decline':
|
|
520
|
+
return '辞退しました';
|
|
521
|
+
case 'tentative':
|
|
522
|
+
return '仮承諾しました';
|
|
523
|
+
default:
|
|
524
|
+
return '応答しました';
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Generate response message
|
|
529
|
+
* Requirement: 17.11
|
|
530
|
+
*/
|
|
531
|
+
generateResponseMessage(response, eventTitle) {
|
|
532
|
+
switch (response) {
|
|
533
|
+
case 'accept':
|
|
534
|
+
return `「${eventTitle}」を承諾しました。`;
|
|
535
|
+
case 'decline':
|
|
536
|
+
return `「${eventTitle}」を辞退しました。`;
|
|
537
|
+
case 'tentative':
|
|
538
|
+
return `「${eventTitle}」を仮承諾しました。`;
|
|
539
|
+
default:
|
|
540
|
+
return `「${eventTitle}」に応答しました。`;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Generate batch summary message
|
|
545
|
+
* Requirement: 17.12
|
|
546
|
+
* @internal
|
|
547
|
+
*/
|
|
548
|
+
generateBatchSummaryMessage(total, succeeded, skipped, failed, response) {
|
|
549
|
+
const responseText = this.getResponseReasonText(response).replace('しました', '');
|
|
550
|
+
let message = `${total}件中${succeeded}件のイベントを${responseText}しました。`;
|
|
551
|
+
if (skipped > 0) {
|
|
552
|
+
message += `${skipped}件はスキップされました。`;
|
|
553
|
+
}
|
|
554
|
+
if (failed > 0) {
|
|
555
|
+
message += `${failed}件は失敗しました。`;
|
|
556
|
+
}
|
|
557
|
+
return message;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
//# sourceMappingURL=calendar-event-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-event-response.js","sourceRoot":"","sources":["../../src/integrations/calendar-event-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AA2GvE;;GAEG;AACH,MAAM,aAAa,GAAG;IACpB,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,GAAG;IACjB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,gBAAgB;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,oBAAoB,GAAwB,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAErF;;;GAGG;AACH,MAAM,OAAO,4BAA4B;IAC/B,cAAc,GAAiD,IAAI,CAAC;IAE5E;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACpE,OAAO;gBACL,QAAQ,EAAE,OAAO;gBACjB,iBAAiB,EAAE,IAAI;gBACvB,qBAAqB,EAAE,IAAI;aAC5B,CAAC;QACJ,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,SAAS;YACnB,iBAAiB,EAAE,KAAK;YACxB,qBAAqB,EAAE,KAAK;SAC7B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAm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Method = 'native' | 'eventkit' | 'caldav' | 'ical_url' | 'manual_input' | 'outlook';
|
|
22
22
|
/**
|
|
23
|
-
* Calendar event
|
|
23
|
+
* Calendar event (basic)
|
|
24
24
|
*/
|
|
25
25
|
export interface CalendarEvent {
|
|
26
26
|
id: string;
|
|
@@ -30,6 +30,35 @@ export interface CalendarEvent {
|
|
|
30
30
|
isAllDay: boolean;
|
|
31
31
|
source: string;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Calendar event with additional details
|
|
35
|
+
* Requirement: 16.10
|
|
36
|
+
*/
|
|
37
|
+
export interface CalendarEventDetailed extends CalendarEvent {
|
|
38
|
+
calendar: string;
|
|
39
|
+
location?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Request for listing calendar events
|
|
43
|
+
* Requirement: 16.2, 16.3, 16.4
|
|
44
|
+
*/
|
|
45
|
+
export interface ListEventsRequest {
|
|
46
|
+
startDate: string;
|
|
47
|
+
endDate: string;
|
|
48
|
+
calendarName?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Response for listing calendar events
|
|
52
|
+
* Requirement: 16.10
|
|
53
|
+
*/
|
|
54
|
+
export interface ListEventsResponse {
|
|
55
|
+
events: CalendarEventDetailed[];
|
|
56
|
+
period: {
|
|
57
|
+
start: string;
|
|
58
|
+
end: string;
|
|
59
|
+
};
|
|
60
|
+
totalEvents: number;
|
|
61
|
+
}
|
|
33
62
|
/**
|
|
34
63
|
* Slot request
|
|
35
64
|
*/
|
|
@@ -131,6 +160,42 @@ export declare class CalendarService {
|
|
|
131
160
|
* Requirement: 6.9
|
|
132
161
|
*/
|
|
133
162
|
generateManualInputPrompt(startDate: string, endDate: string): string;
|
|
163
|
+
/**
|
|
164
|
+
* List calendar events for a specified period
|
|
165
|
+
* Requirement: 16.1
|
|
166
|
+
*/
|
|
167
|
+
listEvents(request: ListEventsRequest): Promise<ListEventsResponse>;
|
|
168
|
+
/**
|
|
169
|
+
* Validate ISO 8601 date format (YYYY-MM-DD)
|
|
170
|
+
*/
|
|
171
|
+
private isValidDateFormat;
|
|
172
|
+
/**
|
|
173
|
+
* Fetch events with detailed information (calendar, location)
|
|
174
|
+
* Requirement: 16.10, 16.11
|
|
175
|
+
*/
|
|
176
|
+
fetchEventsDetailed(startDate: string, endDate: string): Promise<CalendarEventDetailed[]>;
|
|
177
|
+
/**
|
|
178
|
+
* Fetch events via EventKit with detailed information
|
|
179
|
+
* Requirement: 16.10, 16.11
|
|
180
|
+
*/
|
|
181
|
+
private fetchEventKitEventsDetailed;
|
|
182
|
+
/**
|
|
183
|
+
* Build AppleScriptObjC script for fetching events with details
|
|
184
|
+
* Includes calendar name and location
|
|
185
|
+
* Requirement: 16.10
|
|
186
|
+
*/
|
|
187
|
+
buildEventKitScriptWithDetails(startDate: string, endDate: string): string;
|
|
188
|
+
/**
|
|
189
|
+
* Parse EventKit result with detailed information
|
|
190
|
+
* Format: title|start|end|id|isAllDay|calendar|location
|
|
191
|
+
* Requirement: 16.10
|
|
192
|
+
*/
|
|
193
|
+
parseEventKitResultWithDetails(output: string): CalendarEventDetailed[];
|
|
194
|
+
/**
|
|
195
|
+
* Format AppleScript date string to JST ISO 8601 format
|
|
196
|
+
* Requirement: 16.9
|
|
197
|
+
*/
|
|
198
|
+
private formatDateToJST;
|
|
134
199
|
}
|
|
135
200
|
export {};
|
|
136
201
|
//# sourceMappingURL=calendar-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-service.d.ts","sourceRoot":"","sources":["../../src/integrations/calendar-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAiBH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IACzD,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,iBAAiB,EAAE,cAAc,CAAC;IAClC,kBAAkB,E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