@shin1ohno/sage 0.1.0
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/LICENSE +21 -0
- package/README.md +168 -0
- package/dist/config/loader.d.ts +37 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +95 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/storage/file-storage.d.ts +35 -0
- package/dist/config/storage/file-storage.d.ts.map +1 -0
- package/dist/config/storage/file-storage.js +76 -0
- package/dist/config/storage/file-storage.js.map +1 -0
- package/dist/config/storage/index.d.ts +8 -0
- package/dist/config/storage/index.d.ts.map +1 -0
- package/dist/config/storage/index.js +8 -0
- package/dist/config/storage/index.js.map +1 -0
- package/dist/config/storage/session-storage.d.ts +35 -0
- package/dist/config/storage/session-storage.d.ts.map +1 -0
- package/dist/config/storage/session-storage.js +44 -0
- package/dist/config/storage/session-storage.js.map +1 -0
- package/dist/config/storage/storage-factory.d.ts +32 -0
- package/dist/config/storage/storage-factory.d.ts.map +1 -0
- package/dist/config/storage/storage-factory.js +78 -0
- package/dist/config/storage/storage-factory.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/sage-core.d.ts +80 -0
- package/dist/core/sage-core.d.ts.map +1 -0
- package/dist/core/sage-core.js +190 -0
- package/dist/core/sage-core.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +901 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/apple-reminders.d.ts +96 -0
- package/dist/integrations/apple-reminders.d.ts.map +1 -0
- package/dist/integrations/apple-reminders.js +250 -0
- package/dist/integrations/apple-reminders.js.map +1 -0
- package/dist/integrations/calendar-service.d.ts +126 -0
- package/dist/integrations/calendar-service.d.ts.map +1 -0
- package/dist/integrations/calendar-service.js +295 -0
- package/dist/integrations/calendar-service.js.map +1 -0
- package/dist/integrations/notion-mcp.d.ts +121 -0
- package/dist/integrations/notion-mcp.d.ts.map +1 -0
- package/dist/integrations/notion-mcp.js +281 -0
- package/dist/integrations/notion-mcp.js.map +1 -0
- package/dist/integrations/reminder-manager.d.ts +90 -0
- package/dist/integrations/reminder-manager.d.ts.map +1 -0
- package/dist/integrations/reminder-manager.js +182 -0
- package/dist/integrations/reminder-manager.js.map +1 -0
- package/dist/platform/adapter-factory.d.ts +22 -0
- package/dist/platform/adapter-factory.d.ts.map +1 -0
- package/dist/platform/adapter-factory.js +41 -0
- package/dist/platform/adapter-factory.js.map +1 -0
- package/dist/platform/adapters/mcp-adapter.d.ts +32 -0
- package/dist/platform/adapters/mcp-adapter.d.ts.map +1 -0
- package/dist/platform/adapters/mcp-adapter.js +52 -0
- package/dist/platform/adapters/mcp-adapter.js.map +1 -0
- package/dist/platform/adapters/skills-adapter-ios.d.ts +38 -0
- package/dist/platform/adapters/skills-adapter-ios.d.ts.map +1 -0
- package/dist/platform/adapters/skills-adapter-ios.js +59 -0
- package/dist/platform/adapters/skills-adapter-ios.js.map +1 -0
- package/dist/platform/adapters/skills-adapter-web.d.ts +36 -0
- package/dist/platform/adapters/skills-adapter-web.d.ts.map +1 -0
- package/dist/platform/adapters/skills-adapter-web.js +56 -0
- package/dist/platform/adapters/skills-adapter-web.js.map +1 -0
- package/dist/platform/detector.d.ts +60 -0
- package/dist/platform/detector.d.ts.map +1 -0
- package/dist/platform/detector.js +217 -0
- package/dist/platform/detector.js.map +1 -0
- package/dist/platform/index.d.ts +11 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +11 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/types.d.ts +205 -0
- package/dist/platform/types.d.ts.map +1 -0
- package/dist/platform/types.js +33 -0
- package/dist/platform/types.js.map +1 -0
- package/dist/setup/questions.d.ts +15 -0
- package/dist/setup/questions.d.ts.map +1 -0
- package/dist/setup/questions.js +131 -0
- package/dist/setup/questions.js.map +1 -0
- package/dist/setup/wizard.d.ts +51 -0
- package/dist/setup/wizard.d.ts.map +1 -0
- package/dist/setup/wizard.js +210 -0
- package/dist/setup/wizard.js.map +1 -0
- package/dist/tools/analyze-tasks.d.ts +61 -0
- package/dist/tools/analyze-tasks.d.ts.map +1 -0
- package/dist/tools/analyze-tasks.js +258 -0
- package/dist/tools/analyze-tasks.js.map +1 -0
- package/dist/types/config.d.ts +126 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +118 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/errors.d.ts +39 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +83 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/task.d.ts +69 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/task.js +5 -0
- package/dist/types/task.js.map +1 -0
- package/dist/utils/estimation.d.ts +49 -0
- package/dist/utils/estimation.d.ts.map +1 -0
- package/dist/utils/estimation.js +244 -0
- package/dist/utils/estimation.js.map +1 -0
- package/dist/utils/priority.d.ts +68 -0
- package/dist/utils/priority.d.ts.map +1 -0
- package/dist/utils/priority.js +243 -0
- package/dist/utils/priority.js.map +1 -0
- package/dist/utils/retry.d.ts +62 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +161 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/stakeholders.d.ts +61 -0
- package/dist/utils/stakeholders.d.ts.map +1 -0
- package/dist/utils/stakeholders.js +301 -0
- package/dist/utils/stakeholders.js.map +1 -0
- package/dist/utils/task-splitter.d.ts +45 -0
- package/dist/utils/task-splitter.d.ts.map +1 -0
- package/dist/utils/task-splitter.js +321 -0
- package/dist/utils/task-splitter.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion MCP Service
|
|
3
|
+
* Notion integration via MCP Server
|
|
4
|
+
* Requirements: 8.1-8.5
|
|
5
|
+
*
|
|
6
|
+
* 現行実装: Notion MCP Server経由(Desktop/Code)
|
|
7
|
+
* 将来対応予定: iOS/iPadOS Notion Connector統合(Claude Skills APIが対応した時点)
|
|
8
|
+
*/
|
|
9
|
+
import { retryWithBackoff, isRetryableError } from '../utils/retry.js';
|
|
10
|
+
/**
|
|
11
|
+
* Default retry options for Notion operations
|
|
12
|
+
*/
|
|
13
|
+
const RETRY_OPTIONS = {
|
|
14
|
+
maxAttempts: 3,
|
|
15
|
+
initialDelay: 1000,
|
|
16
|
+
maxDelay: 10000,
|
|
17
|
+
shouldRetry: isRetryableError,
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Notion MCP Service
|
|
21
|
+
* Provides platform-adaptive Notion integration
|
|
22
|
+
* - Desktop/Code: MCP経由
|
|
23
|
+
* - iOS/iPadOS: Notion Connector経由
|
|
24
|
+
* - Web: フォールバック
|
|
25
|
+
*/
|
|
26
|
+
export class NotionMCPService {
|
|
27
|
+
/**
|
|
28
|
+
* Detect the current platform for Notion integration
|
|
29
|
+
*/
|
|
30
|
+
async detectPlatform() {
|
|
31
|
+
// Check for MCP environment (Desktop/Code)
|
|
32
|
+
if (typeof process !== 'undefined' && process.env?.MCP_SERVER === 'true') {
|
|
33
|
+
return {
|
|
34
|
+
platform: 'mcp',
|
|
35
|
+
method: 'mcp',
|
|
36
|
+
available: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Check for Notion Connector (iOS/iPadOS Skills)
|
|
40
|
+
if (typeof window !== 'undefined' && window.claude?.notion) {
|
|
41
|
+
return {
|
|
42
|
+
platform: 'connector',
|
|
43
|
+
method: 'connector',
|
|
44
|
+
available: true,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// Web or unknown - fallback only
|
|
48
|
+
return {
|
|
49
|
+
platform: 'web',
|
|
50
|
+
method: 'fallback',
|
|
51
|
+
available: false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if Notion integration is available
|
|
56
|
+
*/
|
|
57
|
+
async isAvailable() {
|
|
58
|
+
const platform = await this.detectPlatform();
|
|
59
|
+
return platform.available;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a page in Notion
|
|
63
|
+
* Routes to appropriate integration based on platform
|
|
64
|
+
* Requirement: 8.1, 8.2, 8.3
|
|
65
|
+
*/
|
|
66
|
+
async createPage(request) {
|
|
67
|
+
const platform = await this.detectPlatform();
|
|
68
|
+
switch (platform.method) {
|
|
69
|
+
case 'mcp':
|
|
70
|
+
return this.createPageViaMCP(request);
|
|
71
|
+
case 'connector':
|
|
72
|
+
return this.createPageViaConnector(request);
|
|
73
|
+
case 'fallback':
|
|
74
|
+
default:
|
|
75
|
+
return {
|
|
76
|
+
success: false,
|
|
77
|
+
method: 'fallback',
|
|
78
|
+
error: 'Notion統合が利用できません。',
|
|
79
|
+
fallbackText: this.generateFallbackTemplate({
|
|
80
|
+
title: request.title,
|
|
81
|
+
...request.properties,
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Create page via MCP (Desktop/Code)
|
|
88
|
+
*/
|
|
89
|
+
async createPageViaMCP(request) {
|
|
90
|
+
try {
|
|
91
|
+
// Build and validate request format
|
|
92
|
+
this.buildMCPRequest(request);
|
|
93
|
+
// Use retry with exponential backoff for MCP calls
|
|
94
|
+
const result = await retryWithBackoff(async () => {
|
|
95
|
+
// TODO: Actually call MCP server when connected
|
|
96
|
+
// return await this.mcpClient.request(mcpRequest);
|
|
97
|
+
throw new Error('MCP統合は実装中です。MCPクライアント接続が必要です。');
|
|
98
|
+
}, {
|
|
99
|
+
...RETRY_OPTIONS,
|
|
100
|
+
onRetry: (error, attempt) => {
|
|
101
|
+
console.error(`Notion MCP retry attempt ${attempt}: ${error.message}`);
|
|
102
|
+
},
|
|
103
|
+
shouldRetry: (error) => {
|
|
104
|
+
if (error.message.includes('実装中')) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return isRetryableError(error);
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
success: true,
|
|
112
|
+
method: 'mcp',
|
|
113
|
+
pageId: result.pageId,
|
|
114
|
+
pageUrl: result.pageUrl,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
return {
|
|
119
|
+
success: false,
|
|
120
|
+
method: 'mcp',
|
|
121
|
+
error: `Notion MCP エラー: ${error.message}`,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create page via Notion Connector (iOS/iPadOS Skills)
|
|
127
|
+
* 🔮 将来対応予定: Claude Skills APIがデバイスAPIへのアクセスを提供した時点で実装
|
|
128
|
+
* 現時点では window.claude?.notion API は存在しません
|
|
129
|
+
* Requirement: 8.1, 8.2
|
|
130
|
+
*/
|
|
131
|
+
async createPageViaConnector(request) {
|
|
132
|
+
// 🔮 将来対応予定: Notion Connector統合
|
|
133
|
+
// 現時点では、iOS/iPadOSでの実行時はフォールバックを返す
|
|
134
|
+
return {
|
|
135
|
+
success: false,
|
|
136
|
+
method: 'connector',
|
|
137
|
+
error: 'Notion Connector統合は将来対応予定です。現在はNotion MCP Server経由のみサポートしています。',
|
|
138
|
+
fallbackText: this.generateFallbackTemplate({
|
|
139
|
+
title: request.title,
|
|
140
|
+
...request.properties,
|
|
141
|
+
}),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Build MCP request for Notion page creation
|
|
146
|
+
*/
|
|
147
|
+
buildMCPRequest(request) {
|
|
148
|
+
const children = request.content?.map((block) => this.buildNotionBlock(block)) || [];
|
|
149
|
+
return {
|
|
150
|
+
method: 'tools/call',
|
|
151
|
+
params: {
|
|
152
|
+
name: 'create_page',
|
|
153
|
+
arguments: {
|
|
154
|
+
database_id: request.databaseId,
|
|
155
|
+
properties: request.properties,
|
|
156
|
+
children,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Build Notion block format
|
|
163
|
+
*/
|
|
164
|
+
buildNotionBlock(block) {
|
|
165
|
+
switch (block.type) {
|
|
166
|
+
case 'paragraph':
|
|
167
|
+
return {
|
|
168
|
+
object: 'block',
|
|
169
|
+
type: 'paragraph',
|
|
170
|
+
paragraph: {
|
|
171
|
+
rich_text: [{ type: 'text', text: { content: block.content } }],
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
case 'heading':
|
|
175
|
+
return {
|
|
176
|
+
object: 'block',
|
|
177
|
+
type: 'heading_2',
|
|
178
|
+
heading_2: {
|
|
179
|
+
rich_text: [{ type: 'text', text: { content: block.content } }],
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
case 'bulleted_list_item':
|
|
183
|
+
return {
|
|
184
|
+
object: 'block',
|
|
185
|
+
type: 'bulleted_list_item',
|
|
186
|
+
bulleted_list_item: {
|
|
187
|
+
rich_text: [{ type: 'text', text: { content: block.content } }],
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
default:
|
|
191
|
+
return {
|
|
192
|
+
object: 'block',
|
|
193
|
+
type: 'paragraph',
|
|
194
|
+
paragraph: {
|
|
195
|
+
rich_text: [{ type: 'text', text: { content: block.content } }],
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Build Notion properties format
|
|
202
|
+
*/
|
|
203
|
+
buildNotionProperties(taskInfo) {
|
|
204
|
+
const properties = {
|
|
205
|
+
Name: {
|
|
206
|
+
title: [
|
|
207
|
+
{
|
|
208
|
+
text: {
|
|
209
|
+
content: taskInfo.title,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
if (taskInfo.priority) {
|
|
216
|
+
properties.Priority = {
|
|
217
|
+
select: {
|
|
218
|
+
name: taskInfo.priority,
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
if (taskInfo.deadline) {
|
|
223
|
+
properties.DueDate = {
|
|
224
|
+
date: {
|
|
225
|
+
start: taskInfo.deadline,
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
if (taskInfo.estimatedMinutes) {
|
|
230
|
+
properties.EstimatedTime = {
|
|
231
|
+
number: taskInfo.estimatedMinutes,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
if (taskInfo.stakeholders && taskInfo.stakeholders.length > 0) {
|
|
235
|
+
properties.Stakeholders = {
|
|
236
|
+
multi_select: taskInfo.stakeholders.map((s) => ({ name: s })),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return properties;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Generate fallback template for manual Notion copy
|
|
243
|
+
* Requirement: 8.4
|
|
244
|
+
*/
|
|
245
|
+
generateFallbackTemplate(taskInfo) {
|
|
246
|
+
let template = `📋 Notionに追加するタスク\n\n`;
|
|
247
|
+
template += `**タイトル:** ${taskInfo.title}\n`;
|
|
248
|
+
if (taskInfo.priority) {
|
|
249
|
+
template += `**優先度:** ${taskInfo.priority}\n`;
|
|
250
|
+
}
|
|
251
|
+
if (taskInfo.deadline) {
|
|
252
|
+
template += `**期限:** ${taskInfo.deadline}\n`;
|
|
253
|
+
}
|
|
254
|
+
if (taskInfo.estimatedMinutes) {
|
|
255
|
+
template += `**見積時間:** ${taskInfo.estimatedMinutes}分\n`;
|
|
256
|
+
}
|
|
257
|
+
if (taskInfo.stakeholders && taskInfo.stakeholders.length > 0) {
|
|
258
|
+
template += `**関係者:** ${taskInfo.stakeholders.join(', ')}\n`;
|
|
259
|
+
}
|
|
260
|
+
if (taskInfo.description) {
|
|
261
|
+
template += `\n**詳細:**\n${taskInfo.description}\n`;
|
|
262
|
+
}
|
|
263
|
+
template += `\n---\nこのテキストをNotionにコピーしてページを作成してください。`;
|
|
264
|
+
return template;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Determine if a task should be synced to Notion based on deadline
|
|
268
|
+
* Requirement: 8.1 (8日以上先のタスク)
|
|
269
|
+
*/
|
|
270
|
+
shouldSyncToNotion(deadline, thresholdDays = 8) {
|
|
271
|
+
if (!deadline) {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
const deadlineDate = new Date(deadline);
|
|
275
|
+
const now = new Date();
|
|
276
|
+
const diffMs = deadlineDate.getTime() - now.getTime();
|
|
277
|
+
const diffDays = diffMs / (1000 * 60 * 60 * 24);
|
|
278
|
+
return diffDays >= thresholdDays;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=notion-mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-mcp.js","sourceRoot":"","sources":["../../src/integrations/notion-mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKvE;;GAEG;AACH,MAAM,aAAa,GAAG;IACpB,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,gBAAgB;CAC9B,CAAC;AAgEF;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,2CAA2C;QAC3C,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,UAAU,KAAK,MAAM,EAAE,CAAC;YACzE,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,MAAM,EAAE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GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAEhD,OAAO,QAAQ,IAAI,aAAa,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reminder Manager
|
|
3
|
+
* Orchestrates reminder creation across Apple Reminders and Notion
|
|
4
|
+
* Requirements: 5.1-5.6
|
|
5
|
+
*/
|
|
6
|
+
import type { Priority } from '../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Reminder configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface ReminderConfig {
|
|
11
|
+
appleRemindersThreshold: number;
|
|
12
|
+
notionThreshold: number;
|
|
13
|
+
defaultList: string;
|
|
14
|
+
notionDatabaseId: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reminder request
|
|
18
|
+
*/
|
|
19
|
+
export interface ReminderRequest {
|
|
20
|
+
taskTitle: string;
|
|
21
|
+
reminderType?: string;
|
|
22
|
+
targetDate?: string;
|
|
23
|
+
list?: string;
|
|
24
|
+
priority?: Priority;
|
|
25
|
+
notes?: string;
|
|
26
|
+
stakeholders?: string[];
|
|
27
|
+
estimatedMinutes?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Reminder result
|
|
31
|
+
*/
|
|
32
|
+
export interface ReminderResult {
|
|
33
|
+
success: boolean;
|
|
34
|
+
destination: 'apple_reminders' | 'notion_mcp';
|
|
35
|
+
method?: 'native' | 'applescript' | 'mcp' | 'fallback';
|
|
36
|
+
reminderId?: string;
|
|
37
|
+
reminderUrl?: string;
|
|
38
|
+
pageUrl?: string;
|
|
39
|
+
error?: string;
|
|
40
|
+
fallbackText?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Reminder time
|
|
44
|
+
*/
|
|
45
|
+
export interface ReminderTime {
|
|
46
|
+
type: string;
|
|
47
|
+
time: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Reminder Manager
|
|
51
|
+
* Decides where to create reminders based on deadline
|
|
52
|
+
*/
|
|
53
|
+
export declare class ReminderManager {
|
|
54
|
+
private config;
|
|
55
|
+
private appleReminders;
|
|
56
|
+
private notionMCP;
|
|
57
|
+
constructor(config: ReminderConfig);
|
|
58
|
+
/**
|
|
59
|
+
* Determine destination based on deadline
|
|
60
|
+
* Requirement: 5.2, 5.3
|
|
61
|
+
*/
|
|
62
|
+
determineDestination(deadline: string | undefined): 'apple' | 'notion';
|
|
63
|
+
/**
|
|
64
|
+
* Set a reminder
|
|
65
|
+
* Requirement: 5.1, 5.4, 5.5
|
|
66
|
+
*/
|
|
67
|
+
setReminder(request: ReminderRequest): Promise<ReminderResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Create Apple Reminder
|
|
70
|
+
*/
|
|
71
|
+
private createAppleReminder;
|
|
72
|
+
/**
|
|
73
|
+
* Create Notion entry
|
|
74
|
+
*/
|
|
75
|
+
private createNotionEntry;
|
|
76
|
+
/**
|
|
77
|
+
* Calculate reminder times based on types
|
|
78
|
+
* Requirement: 5.4
|
|
79
|
+
*/
|
|
80
|
+
calculateReminderTimes(deadline: string, types: string[]): ReminderTime[];
|
|
81
|
+
/**
|
|
82
|
+
* Calculate a single reminder time
|
|
83
|
+
*/
|
|
84
|
+
private calculateSingleReminderTime;
|
|
85
|
+
/**
|
|
86
|
+
* Map sage priority to Apple Reminders priority
|
|
87
|
+
*/
|
|
88
|
+
mapPriorityToApple(priority: Priority | undefined): 'low' | 'medium' | 'high';
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=reminder-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminder-manager.d.ts","sourceRoot":"","sources":["../../src/integrations/reminder-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7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AAG,OAAO,CAAC,cAAc,CAAC;IAUpE;;OAEG;YACW,mBAAmB;IA4BjC;;OAEG;YACW,iBAAiB;IA2C/B;;;OAGG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE;IAoBzE;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAgCnC;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM;CAgB9E"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reminder Manager
|
|
3
|
+
* Orchestrates reminder creation across Apple Reminders and Notion
|
|
4
|
+
* Requirements: 5.1-5.6
|
|
5
|
+
*/
|
|
6
|
+
import { AppleRemindersService } from './apple-reminders.js';
|
|
7
|
+
import { NotionMCPService } from './notion-mcp.js';
|
|
8
|
+
/**
|
|
9
|
+
* Reminder Manager
|
|
10
|
+
* Decides where to create reminders based on deadline
|
|
11
|
+
*/
|
|
12
|
+
export class ReminderManager {
|
|
13
|
+
config;
|
|
14
|
+
appleReminders;
|
|
15
|
+
notionMCP;
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.config = config;
|
|
18
|
+
this.appleReminders = new AppleRemindersService();
|
|
19
|
+
this.notionMCP = new NotionMCPService();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Determine destination based on deadline
|
|
23
|
+
* Requirement: 5.2, 5.3
|
|
24
|
+
*/
|
|
25
|
+
determineDestination(deadline) {
|
|
26
|
+
if (!deadline) {
|
|
27
|
+
return 'apple';
|
|
28
|
+
}
|
|
29
|
+
const deadlineDate = new Date(deadline);
|
|
30
|
+
const now = new Date();
|
|
31
|
+
const diffMs = deadlineDate.getTime() - now.getTime();
|
|
32
|
+
const diffDays = diffMs / (1000 * 60 * 60 * 24);
|
|
33
|
+
if (diffDays >= this.config.notionThreshold) {
|
|
34
|
+
return 'notion';
|
|
35
|
+
}
|
|
36
|
+
return 'apple';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Set a reminder
|
|
40
|
+
* Requirement: 5.1, 5.4, 5.5
|
|
41
|
+
*/
|
|
42
|
+
async setReminder(request) {
|
|
43
|
+
const destination = this.determineDestination(request.targetDate);
|
|
44
|
+
if (destination === 'notion') {
|
|
45
|
+
return this.createNotionEntry(request);
|
|
46
|
+
}
|
|
47
|
+
return this.createAppleReminder(request);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create Apple Reminder
|
|
51
|
+
*/
|
|
52
|
+
async createAppleReminder(request) {
|
|
53
|
+
const result = await this.appleReminders.createReminder({
|
|
54
|
+
title: request.taskTitle,
|
|
55
|
+
notes: request.notes,
|
|
56
|
+
dueDate: request.targetDate,
|
|
57
|
+
list: request.list || this.config.defaultList,
|
|
58
|
+
priority: this.mapPriorityToApple(request.priority),
|
|
59
|
+
});
|
|
60
|
+
if (result.success) {
|
|
61
|
+
return {
|
|
62
|
+
success: true,
|
|
63
|
+
destination: 'apple_reminders',
|
|
64
|
+
method: result.method,
|
|
65
|
+
reminderId: result.reminderId,
|
|
66
|
+
reminderUrl: result.reminderUrl,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
success: false,
|
|
71
|
+
destination: 'apple_reminders',
|
|
72
|
+
method: result.method,
|
|
73
|
+
error: result.error,
|
|
74
|
+
fallbackText: result.fallbackText,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create Notion entry
|
|
79
|
+
*/
|
|
80
|
+
async createNotionEntry(request) {
|
|
81
|
+
const properties = this.notionMCP.buildNotionProperties({
|
|
82
|
+
title: request.taskTitle,
|
|
83
|
+
priority: request.priority,
|
|
84
|
+
deadline: request.targetDate,
|
|
85
|
+
stakeholders: request.stakeholders,
|
|
86
|
+
estimatedMinutes: request.estimatedMinutes,
|
|
87
|
+
});
|
|
88
|
+
const result = await this.notionMCP.createPage({
|
|
89
|
+
databaseId: this.config.notionDatabaseId,
|
|
90
|
+
title: request.taskTitle,
|
|
91
|
+
properties,
|
|
92
|
+
});
|
|
93
|
+
if (result.success) {
|
|
94
|
+
return {
|
|
95
|
+
success: true,
|
|
96
|
+
destination: 'notion_mcp',
|
|
97
|
+
method: 'mcp',
|
|
98
|
+
reminderId: result.pageId,
|
|
99
|
+
pageUrl: result.pageUrl,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
// Generate fallback template
|
|
103
|
+
const fallbackText = this.notionMCP.generateFallbackTemplate({
|
|
104
|
+
title: request.taskTitle,
|
|
105
|
+
priority: request.priority,
|
|
106
|
+
deadline: request.targetDate,
|
|
107
|
+
stakeholders: request.stakeholders,
|
|
108
|
+
estimatedMinutes: request.estimatedMinutes,
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
destination: 'notion_mcp',
|
|
113
|
+
method: 'fallback',
|
|
114
|
+
error: result.error,
|
|
115
|
+
fallbackText,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Calculate reminder times based on types
|
|
120
|
+
* Requirement: 5.4
|
|
121
|
+
*/
|
|
122
|
+
calculateReminderTimes(deadline, types) {
|
|
123
|
+
const deadlineDate = new Date(deadline);
|
|
124
|
+
const now = new Date();
|
|
125
|
+
const times = [];
|
|
126
|
+
for (const type of types) {
|
|
127
|
+
const reminderTime = this.calculateSingleReminderTime(deadlineDate, type);
|
|
128
|
+
// Only include future reminder times
|
|
129
|
+
if (reminderTime > now) {
|
|
130
|
+
times.push({
|
|
131
|
+
type,
|
|
132
|
+
time: reminderTime.toISOString(),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return times;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Calculate a single reminder time
|
|
140
|
+
*/
|
|
141
|
+
calculateSingleReminderTime(deadline, type) {
|
|
142
|
+
const reminderDate = new Date(deadline);
|
|
143
|
+
switch (type) {
|
|
144
|
+
case '1_hour_before':
|
|
145
|
+
reminderDate.setHours(reminderDate.getHours() - 1);
|
|
146
|
+
break;
|
|
147
|
+
case '3_hours_before':
|
|
148
|
+
reminderDate.setHours(reminderDate.getHours() - 3);
|
|
149
|
+
break;
|
|
150
|
+
case '1_day_before':
|
|
151
|
+
reminderDate.setDate(reminderDate.getDate() - 1);
|
|
152
|
+
break;
|
|
153
|
+
case '3_days_before':
|
|
154
|
+
reminderDate.setDate(reminderDate.getDate() - 3);
|
|
155
|
+
break;
|
|
156
|
+
case '1_week_before':
|
|
157
|
+
reminderDate.setDate(reminderDate.getDate() - 7);
|
|
158
|
+
break;
|
|
159
|
+
default:
|
|
160
|
+
// Default to 1 day before
|
|
161
|
+
reminderDate.setDate(reminderDate.getDate() - 1);
|
|
162
|
+
}
|
|
163
|
+
return reminderDate;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Map sage priority to Apple Reminders priority
|
|
167
|
+
*/
|
|
168
|
+
mapPriorityToApple(priority) {
|
|
169
|
+
switch (priority) {
|
|
170
|
+
case 'P0':
|
|
171
|
+
case 'P1':
|
|
172
|
+
return 'high';
|
|
173
|
+
case 'P2':
|
|
174
|
+
return 'medium';
|
|
175
|
+
case 'P3':
|
|
176
|
+
return 'low';
|
|
177
|
+
default:
|
|
178
|
+
return 'medium';
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=reminder-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminder-manager.js","sourceRoot":"","sources":["../../src/integrations/reminder-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAiDnD;;;GAGG;AACH,MAAM,OA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
|
|
5
|
+
*/
|
|
6
|
+
import type { PlatformAdapter, PlatformType } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Factory for creating platform-specific adapters
|
|
9
|
+
*/
|
|
10
|
+
export declare class PlatformAdapterFactory {
|
|
11
|
+
/**
|
|
12
|
+
* Create adapter based on detected platform
|
|
13
|
+
* Automatically detects the current platform and creates the appropriate adapter
|
|
14
|
+
*/
|
|
15
|
+
static create(): Promise<PlatformAdapter>;
|
|
16
|
+
/**
|
|
17
|
+
* Create adapter for a specific platform type
|
|
18
|
+
* Useful for testing or when platform type is already known
|
|
19
|
+
*/
|
|
20
|
+
static createForPlatform(platformType: PlatformType): PlatformAdapter;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=adapter-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-factory.d.ts","sourceRoot":"","sources":["../../src/platform/adapter-factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAMhE;;GAEG;AACH,qBAAa,sBAAsB;IACjC;;;OAGG;WACU,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC;IAK/C;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,eAAe;CAkBtE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Adapter Factory
|
|
3
|
+
* Creates appropriate platform adapter based on detected environment
|
|
4
|
+
* Requirements: 7.3, 7.4, 7.5
|
|
5
|
+
*/
|
|
6
|
+
import { PlatformDetector } from './detector.js';
|
|
7
|
+
import { MCPAdapter } from './adapters/mcp-adapter.js';
|
|
8
|
+
import { SkillsAdapteriOS } from './adapters/skills-adapter-ios.js';
|
|
9
|
+
import { SkillsAdapterWeb } from './adapters/skills-adapter-web.js';
|
|
10
|
+
/**
|
|
11
|
+
* Factory for creating platform-specific adapters
|
|
12
|
+
*/
|
|
13
|
+
export class PlatformAdapterFactory {
|
|
14
|
+
/**
|
|
15
|
+
* Create adapter based on detected platform
|
|
16
|
+
* Automatically detects the current platform and creates the appropriate adapter
|
|
17
|
+
*/
|
|
18
|
+
static async create() {
|
|
19
|
+
const platformInfo = await PlatformDetector.detect();
|
|
20
|
+
return this.createForPlatform(platformInfo.type);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create adapter for a specific platform type
|
|
24
|
+
* Useful for testing or when platform type is already known
|
|
25
|
+
*/
|
|
26
|
+
static createForPlatform(platformType) {
|
|
27
|
+
switch (platformType) {
|
|
28
|
+
case 'desktop_mcp':
|
|
29
|
+
return new MCPAdapter();
|
|
30
|
+
case 'ios_skills':
|
|
31
|
+
return new SkillsAdapteriOS('ios_skills');
|
|
32
|
+
case 'ipados_skills':
|
|
33
|
+
return new SkillsAdapteriOS('ipados_skills');
|
|
34
|
+
case 'web_skills':
|
|
35
|
+
return new SkillsAdapterWeb();
|
|
36
|
+
default:
|
|
37
|
+
throw new Error(`Unsupported platform type: ${platformType}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=adapter-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-factory.js","sourceRoot":"","sources":["../../src/platform/adapter-factory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACjC;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM;QACjB,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,MAAM,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,YAA0B;QACjD,QAAQ,YAAY,EAAE,CAAC;YACrB,KAAK,aAAa;gBAChB,OAAO,IAAI,UAAU,EAAE,CAAC;YAE1B,KAAK,YAAY;gBACf,OAAO,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAAC;YAE5C,KAAK,eAAe;gBAClB,OAAO,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAAC;YAE/C,KAAK,YAAY;gBACf,OAAO,IAAI,gBAAgB,EAAE,CAAC;YAEhC;gBACE,MAAM,IAAI,KAAK,CAAC,8BAA8B,YAAY,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Adapter
|
|
3
|
+
* Platform adapter for Desktop/Code MCP environment
|
|
4
|
+
* Requirements: 7.1, 7.4
|
|
5
|
+
*/
|
|
6
|
+
import type { PlatformAdapter, PlatformInfo, FeatureSet } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Adapter for MCP (Model Context Protocol) server environment
|
|
9
|
+
* Used in Claude Desktop and Claude Code
|
|
10
|
+
*/
|
|
11
|
+
export declare class MCPAdapter implements PlatformAdapter {
|
|
12
|
+
private platformInfo;
|
|
13
|
+
private featureSet;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Get platform information
|
|
17
|
+
*/
|
|
18
|
+
getPlatformInfo(): PlatformInfo;
|
|
19
|
+
/**
|
|
20
|
+
* Get available features on this platform
|
|
21
|
+
*/
|
|
22
|
+
getAvailableFeatures(): FeatureSet;
|
|
23
|
+
/**
|
|
24
|
+
* Initialize the adapter
|
|
25
|
+
*/
|
|
26
|
+
initialize(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a specific capability is available
|
|
29
|
+
*/
|
|
30
|
+
isCapabilityAvailable(capability: string): boolean;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=mcp-adapter.d.ts.map
|