@todoist/mcp 0.0.0-stage → 15.0.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 +232 -2
- package/dist/filter-helpers.d.ts +53 -0
- package/dist/filter-helpers.d.ts.map +1 -0
- package/dist/http-app.d.ts +28 -0
- package/dist/http-app.d.ts.map +1 -0
- package/dist/index.d.ts +4347 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/main-http.d.ts +3 -0
- package/dist/main-http.d.ts.map +1 -0
- package/dist/main-http.js +133 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +16 -0
- package/dist/mcp-apps/index.html +116 -0
- package/dist/mcp-helpers.d.ts +62 -0
- package/dist/mcp-helpers.d.ts.map +1 -0
- package/dist/mcp-server-y4HhlBJW.js +8152 -0
- package/dist/mcp-server.d.ts +16 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/middleware/require-trusted-host.d.ts +44 -0
- package/dist/middleware/require-trusted-host.d.ts.map +1 -0
- package/dist/middleware/require-valid-todoist-token.d.ts +39 -0
- package/dist/middleware/require-valid-todoist-token.d.ts.map +1 -0
- package/dist/prompts/productivity-analysis.d.ts +58 -0
- package/dist/prompts/productivity-analysis.d.ts.map +1 -0
- package/dist/require-valid-todoist-token-I1jh7sbd.js +63 -0
- package/dist/todoist-tool.d.ts +15 -0
- package/dist/todoist-tool.d.ts.map +1 -0
- package/dist/tool-execution-error.d.ts +27 -0
- package/dist/tool-execution-error.d.ts.map +1 -0
- package/dist/tool-helpers.d.ts +318 -0
- package/dist/tool-helpers.d.ts.map +1 -0
- package/dist/tool-registry.d.ts +4307 -0
- package/dist/tool-registry.d.ts.map +1 -0
- package/dist/tools/add-comments.d.ts +104 -0
- package/dist/tools/add-comments.d.ts.map +1 -0
- package/dist/tools/add-filters.d.ts +113 -0
- package/dist/tools/add-filters.d.ts.map +1 -0
- package/dist/tools/add-labels.d.ts +107 -0
- package/dist/tools/add-labels.d.ts.map +1 -0
- package/dist/tools/add-projects.d.ts +134 -0
- package/dist/tools/add-projects.d.ts.map +1 -0
- package/dist/tools/add-reminders.d.ts +174 -0
- package/dist/tools/add-reminders.d.ts.map +1 -0
- package/dist/tools/add-sections.d.ts +61 -0
- package/dist/tools/add-sections.d.ts.map +1 -0
- package/dist/tools/add-tasks.d.ts +123 -0
- package/dist/tools/add-tasks.d.ts.map +1 -0
- package/dist/tools/analyze-project-health.d.ts +45 -0
- package/dist/tools/analyze-project-health.d.ts.map +1 -0
- package/dist/tools/complete-tasks.d.ts +42 -0
- package/dist/tools/complete-tasks.d.ts.map +1 -0
- package/dist/tools/delete-object.d.ts +54 -0
- package/dist/tools/delete-object.d.ts.map +1 -0
- package/dist/tools/export-project-template.d.ts +54 -0
- package/dist/tools/export-project-template.d.ts.map +1 -0
- package/dist/tools/fetch-object.d.ts +243 -0
- package/dist/tools/fetch-object.d.ts.map +1 -0
- package/dist/tools/fetch.d.ts +41 -0
- package/dist/tools/fetch.d.ts.map +1 -0
- package/dist/tools/find-activity.d.ts +98 -0
- package/dist/tools/find-activity.d.ts.map +1 -0
- package/dist/tools/find-comments.d.ts +91 -0
- package/dist/tools/find-comments.d.ts.map +1 -0
- package/dist/tools/find-completed-tasks.d.ts +119 -0
- package/dist/tools/find-completed-tasks.d.ts.map +1 -0
- package/dist/tools/find-filters.d.ts +95 -0
- package/dist/tools/find-filters.d.ts.map +1 -0
- package/dist/tools/find-labels.d.ts +81 -0
- package/dist/tools/find-labels.d.ts.map +1 -0
- package/dist/tools/find-project-collaborators.d.ts +94 -0
- package/dist/tools/find-project-collaborators.d.ts.map +1 -0
- package/dist/tools/find-projects.d.ts +98 -0
- package/dist/tools/find-projects.d.ts.map +1 -0
- package/dist/tools/find-reminders.d.ts +99 -0
- package/dist/tools/find-reminders.d.ts.map +1 -0
- package/dist/tools/find-sections.d.ts +45 -0
- package/dist/tools/find-sections.d.ts.map +1 -0
- package/dist/tools/find-tasks-by-date.d.ts +137 -0
- package/dist/tools/find-tasks-by-date.d.ts.map +1 -0
- package/dist/tools/find-tasks.d.ts +120 -0
- package/dist/tools/find-tasks.d.ts.map +1 -0
- package/dist/tools/get-overview.d.ts +121 -0
- package/dist/tools/get-overview.d.ts.map +1 -0
- package/dist/tools/get-productivity-stats.d.ts +160 -0
- package/dist/tools/get-productivity-stats.d.ts.map +1 -0
- package/dist/tools/get-project-activity-stats.d.ts +48 -0
- package/dist/tools/get-project-activity-stats.d.ts.map +1 -0
- package/dist/tools/get-project-health.d.ts +104 -0
- package/dist/tools/get-project-health.d.ts.map +1 -0
- package/dist/tools/get-user-status.d.ts +35 -0
- package/dist/tools/get-user-status.d.ts.map +1 -0
- package/dist/tools/get-workspace-insights.d.ts +63 -0
- package/dist/tools/get-workspace-insights.d.ts.map +1 -0
- package/dist/tools/import-project-template.d.ts +148 -0
- package/dist/tools/import-project-template.d.ts.map +1 -0
- package/dist/tools/list-workspaces.d.ts +54 -0
- package/dist/tools/list-workspaces.d.ts.map +1 -0
- package/dist/tools/manage-assignments.d.ts +73 -0
- package/dist/tools/manage-assignments.d.ts.map +1 -0
- package/dist/tools/project-management.d.ts +82 -0
- package/dist/tools/project-management.d.ts.map +1 -0
- package/dist/tools/project-move.d.ts +92 -0
- package/dist/tools/project-move.d.ts.map +1 -0
- package/dist/tools/reorder-objects.d.ts +61 -0
- package/dist/tools/reorder-objects.d.ts.map +1 -0
- package/dist/tools/reschedule-tasks.d.ts +95 -0
- package/dist/tools/reschedule-tasks.d.ts.map +1 -0
- package/dist/tools/search.d.ts +43 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/set-user-status.d.ts +51 -0
- package/dist/tools/set-user-status.d.ts.map +1 -0
- package/dist/tools/uncomplete-tasks.d.ts +42 -0
- package/dist/tools/uncomplete-tasks.d.ts.map +1 -0
- package/dist/tools/update-comments.d.ts +100 -0
- package/dist/tools/update-comments.d.ts.map +1 -0
- package/dist/tools/update-filters.d.ts +121 -0
- package/dist/tools/update-filters.d.ts.map +1 -0
- package/dist/tools/update-labels.d.ts +133 -0
- package/dist/tools/update-labels.d.ts.map +1 -0
- package/dist/tools/update-projects.d.ts +138 -0
- package/dist/tools/update-projects.d.ts.map +1 -0
- package/dist/tools/update-reminders.d.ts +176 -0
- package/dist/tools/update-reminders.d.ts.map +1 -0
- package/dist/tools/update-sections.d.ts +65 -0
- package/dist/tools/update-sections.d.ts.map +1 -0
- package/dist/tools/update-tasks.d.ts +135 -0
- package/dist/tools/update-tasks.d.ts.map +1 -0
- package/dist/tools/user-info.d.ts +57 -0
- package/dist/tools/user-info.d.ts.map +1 -0
- package/dist/tools/view-attachment.d.ts +25 -0
- package/dist/tools/view-attachment.d.ts.map +1 -0
- package/dist/usage-tracking.d.ts +36 -0
- package/dist/usage-tracking.d.ts.map +1 -0
- package/dist/utils/assignment-validator.d.ts +69 -0
- package/dist/utils/assignment-validator.d.ts.map +1 -0
- package/dist/utils/batch-failures.d.ts +25 -0
- package/dist/utils/batch-failures.d.ts.map +1 -0
- package/dist/utils/children.d.ts +68 -0
- package/dist/utils/children.d.ts.map +1 -0
- package/dist/utils/colors.d.ts +68 -0
- package/dist/utils/colors.d.ts.map +1 -0
- package/dist/utils/comment-recipients.d.ts +35 -0
- package/dist/utils/comment-recipients.d.ts.map +1 -0
- package/dist/utils/concurrency.d.ts +35 -0
- package/dist/utils/concurrency.d.ts.map +1 -0
- package/dist/utils/constants.d.ts +93 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/date.d.ts +18 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/duration-parser.d.ts +39 -0
- package/dist/utils/duration-parser.d.ts.map +1 -0
- package/dist/utils/filter-description.d.ts +16 -0
- package/dist/utils/filter-description.d.ts.map +1 -0
- package/dist/utils/filter-resolver.d.ts +27 -0
- package/dist/utils/filter-resolver.d.ts.map +1 -0
- package/dist/utils/host.d.ts +6 -0
- package/dist/utils/host.d.ts.map +1 -0
- package/dist/utils/labels.d.ts +13 -0
- package/dist/utils/labels.d.ts.map +1 -0
- package/dist/utils/move-planner.d.ts +63 -0
- package/dist/utils/move-planner.d.ts.map +1 -0
- package/dist/utils/order-keys.d.ts +36 -0
- package/dist/utils/order-keys.d.ts.map +1 -0
- package/dist/utils/output-schemas.d.ts +209 -0
- package/dist/utils/output-schemas.d.ts.map +1 -0
- package/dist/utils/personal-project-limit.d.ts +31 -0
- package/dist/utils/personal-project-limit.d.ts.map +1 -0
- package/dist/utils/priorities.d.ts +14 -0
- package/dist/utils/priorities.d.ts.map +1 -0
- package/dist/utils/reminder-recipients.d.ts +21 -0
- package/dist/utils/reminder-recipients.d.ts.map +1 -0
- package/dist/utils/reminder-schemas.d.ts +41 -0
- package/dist/utils/reminder-schemas.d.ts.map +1 -0
- package/dist/utils/response-builders.d.ts +103 -0
- package/dist/utils/response-builders.d.ts.map +1 -0
- package/dist/utils/retry.d.ts +39 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/schema-helpers.d.ts +10 -0
- package/dist/utils/schema-helpers.d.ts.map +1 -0
- package/dist/utils/sync-commands.d.ts +21 -0
- package/dist/utils/sync-commands.d.ts.map +1 -0
- package/dist/utils/test-helpers.d.ts +118 -0
- package/dist/utils/test-helpers.d.ts.map +1 -0
- package/dist/utils/tool-names.d.ts +60 -0
- package/dist/utils/tool-names.d.ts.map +1 -0
- package/dist/utils/user-resolver.d.ts +92 -0
- package/dist/utils/user-resolver.d.ts.map +1 -0
- package/dist/utils/user-status.d.ts +32 -0
- package/dist/utils/user-status.d.ts.map +1 -0
- package/dist/utils/validate-todoist-token.d.ts +17 -0
- package/dist/utils/validate-todoist-token.d.ts.map +1 -0
- package/dist/utils/workspace-resolver.d.ts +31 -0
- package/dist/utils/workspace-resolver.d.ts.map +1 -0
- package/package.json +116 -5
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Maximum number of reminders per add/update operation.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MAX_REMINDERS_PER_OPERATION = 25;
|
|
6
|
+
/**
|
|
7
|
+
* Shared schema for reminder delivery service (email or push).
|
|
8
|
+
*/
|
|
9
|
+
export declare const ReminderServiceSchema: z.ZodEnum<{
|
|
10
|
+
push: "push";
|
|
11
|
+
email: "email";
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Shared schema for reminder due date input.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ReminderDueInputSchema: z.ZodObject<{
|
|
17
|
+
date: z.ZodOptional<z.ZodString>;
|
|
18
|
+
string: z.ZodOptional<z.ZodString>;
|
|
19
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
20
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
/**
|
|
23
|
+
* Shared schema for location trigger (on_enter or on_leave).
|
|
24
|
+
*/
|
|
25
|
+
export declare const LocationTriggerSchema: z.ZodEnum<{
|
|
26
|
+
on_enter: "on_enter";
|
|
27
|
+
on_leave: "on_leave";
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Shared schema for the isUrgent flag on time-based reminders (relative and absolute).
|
|
31
|
+
*/
|
|
32
|
+
export declare const ReminderIsUrgentSchema: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Shared schema for who receives a new reminder. Without it, Todoist reminds the user creating it.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ReminderNotifyUserSchema: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
37
|
+
/**
|
|
38
|
+
* Shared schema for a new recipient of an existing reminder. Without it, the recipient is kept.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ReminderNotifyUserUpdateSchema: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
41
|
+
//# sourceMappingURL=reminder-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminder-schemas.d.ts","sourceRoot":"","sources":["../../src/utils/reminder-schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;GAEG;AACH,eAAO,MAAM,2BAA2B,KAAK,CAAA;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;EAAqC,CAAA;AAEvE;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;iBAKjC,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;EAA4B,CAAA;AAE9D;;GAEG;AACH,eAAO,MAAM,sBAAsB,6BAG6D,CAAA;AAKhG;;GAEG;AACH,eAAO,MAAM,wBAAwB,mFAEpC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,mFAE1C,CAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Label } from '@doist/todoist-sdk';
|
|
2
|
+
import { Priority } from './priorities.js';
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to get date string in YYYY-MM-DD format
|
|
5
|
+
*/
|
|
6
|
+
export declare function getDateString(date?: Date): string;
|
|
7
|
+
type TaskLike = {
|
|
8
|
+
id?: string;
|
|
9
|
+
content?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
dueDate?: string;
|
|
12
|
+
priority?: Priority;
|
|
13
|
+
projectName?: string;
|
|
14
|
+
responsibleUid?: string;
|
|
15
|
+
};
|
|
16
|
+
type ProjectLike = {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
color?: string;
|
|
20
|
+
isFavorite?: boolean;
|
|
21
|
+
isShared?: boolean;
|
|
22
|
+
parentId?: string | null;
|
|
23
|
+
inboxProject?: boolean;
|
|
24
|
+
viewStyle?: string;
|
|
25
|
+
isArchived?: boolean;
|
|
26
|
+
};
|
|
27
|
+
type TaskOperationOptions = {
|
|
28
|
+
context?: string;
|
|
29
|
+
showDetails?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type BatchOperationParams = {
|
|
32
|
+
action: string;
|
|
33
|
+
success: number;
|
|
34
|
+
total: number;
|
|
35
|
+
successItems?: string[];
|
|
36
|
+
successLabel?: string;
|
|
37
|
+
failures?: Array<{
|
|
38
|
+
item: string;
|
|
39
|
+
error: string;
|
|
40
|
+
code?: string;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Creates concise, actionable summaries for task operations instead of raw JSON
|
|
45
|
+
*/
|
|
46
|
+
export declare function summarizeTaskOperation(action: string, tasks: TaskLike[], options?: TaskOperationOptions): string;
|
|
47
|
+
/**
|
|
48
|
+
* Creates batch operation summaries with success/failure breakdown
|
|
49
|
+
*/
|
|
50
|
+
export declare function summarizeBatch(params: BatchOperationParams): string;
|
|
51
|
+
/**
|
|
52
|
+
* Appends a per-item failure block to a success summary. Returns the summary unchanged
|
|
53
|
+
* when there are no failures.
|
|
54
|
+
*/
|
|
55
|
+
export declare function appendFailureSummary(summary: string, failures: Array<{
|
|
56
|
+
item: string;
|
|
57
|
+
error: string;
|
|
58
|
+
}>): string;
|
|
59
|
+
/**
|
|
60
|
+
* Formats a single label into a readable preview line
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatLabelPreview(label: Label): string;
|
|
63
|
+
/**
|
|
64
|
+
* Formats a single project-like object into a readable preview line
|
|
65
|
+
*/
|
|
66
|
+
export declare function formatProjectPreview(project: ProjectLike): string;
|
|
67
|
+
/**
|
|
68
|
+
* Creates preview lines for task lists
|
|
69
|
+
*/
|
|
70
|
+
export declare function previewTasks(tasks: TaskLike[], limit?: number, assigneeNames?: ReadonlyMap<string, string>): string;
|
|
71
|
+
type SummarizeListParams = {
|
|
72
|
+
subject: string;
|
|
73
|
+
count: number;
|
|
74
|
+
limit?: number;
|
|
75
|
+
nextCursor?: string;
|
|
76
|
+
filterHints?: string[];
|
|
77
|
+
previewLines?: string;
|
|
78
|
+
zeroReasonHints?: string[];
|
|
79
|
+
nextSteps?: string[];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Creates list summaries with counts, filters, and guidance
|
|
83
|
+
*/
|
|
84
|
+
export declare function summarizeList({ subject, count, limit, nextCursor, filterHints, previewLines, zeroReasonHints, nextSteps, }: SummarizeListParams): string;
|
|
85
|
+
/**
|
|
86
|
+
* Formats next steps array into a consistent "Possible suggested next step(s):" section
|
|
87
|
+
* If nextCursor is provided, adds cursor instruction to the steps
|
|
88
|
+
*/
|
|
89
|
+
export declare function formatNextSteps(nextSteps: string[], nextCursor?: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Helper to generate contextual next steps based on task operations
|
|
92
|
+
*/
|
|
93
|
+
export declare function generateTaskNextSteps(operation: 'added' | 'updated' | 'listed' | 'completed' | 'organized', tasks: TaskLike[], context?: {
|
|
94
|
+
hasToday?: boolean;
|
|
95
|
+
hasOverdue?: boolean;
|
|
96
|
+
hasHighPriority?: boolean;
|
|
97
|
+
projectName?: string;
|
|
98
|
+
count?: number;
|
|
99
|
+
timeOfDay?: 'morning' | 'afternoon' | 'evening';
|
|
100
|
+
isEmptyResult?: boolean;
|
|
101
|
+
}): string[];
|
|
102
|
+
export {};
|
|
103
|
+
//# sourceMappingURL=response-builders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-builders.d.ts","sourceRoot":"","sources":["../../src/utils/response-builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAG/C;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAK7D;AAID,KAAK,QAAQ,GAAG;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,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O,CAAC,EAAE;IACN,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAA;IAC/C,aAAa,CAAC,EAAE,OAAO,CAAA;CAC1B,GACF,MAAM,EAAE,CA6EV"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Floor for a jittered delay so a low random draw can't turn a retry into an
|
|
3
|
+
* immediate re-request. Clamped by the computed ceiling, so an explicit
|
|
4
|
+
* zero-delay config (used by tests) still waits nothing.
|
|
5
|
+
*/
|
|
6
|
+
declare const MIN_RETRY_DELAY_MS = 50;
|
|
7
|
+
type RetryConfig = {
|
|
8
|
+
maxRetries?: number;
|
|
9
|
+
baseDelayMs?: number;
|
|
10
|
+
maxDelayMs?: number;
|
|
11
|
+
/** Injectable randomness for deterministic tests. Defaults to `Math.random`. */
|
|
12
|
+
random?: () => number;
|
|
13
|
+
/** HTTP statuses worth retrying. Defaults to 502, 503 and 504. */
|
|
14
|
+
retryableStatusCodes?: ReadonlySet<number>;
|
|
15
|
+
};
|
|
16
|
+
declare function extractHttpStatusCode(error: unknown): number | undefined;
|
|
17
|
+
declare function isTransientError(error: unknown, retryableStatusCodes?: ReadonlySet<number>): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Exponential backoff with full jitter: the delay is a random point in
|
|
20
|
+
* `[0, cap]` rather than the cap itself.
|
|
21
|
+
*
|
|
22
|
+
* Without jitter, a batch of requests that all fail together retry in lockstep
|
|
23
|
+
* and hit the server as another simultaneous burst — the same contention that
|
|
24
|
+
* caused the first failure. Spreading the retries is what breaks that cycle.
|
|
25
|
+
*/
|
|
26
|
+
declare function getRetryDelay({ attempt, baseDelayMs, maxDelayMs, random, }: {
|
|
27
|
+
attempt: number;
|
|
28
|
+
baseDelayMs: number;
|
|
29
|
+
maxDelayMs: number;
|
|
30
|
+
random?: () => number;
|
|
31
|
+
}): number;
|
|
32
|
+
declare function executeWithRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
|
|
33
|
+
/**
|
|
34
|
+
* {@link executeWithRetry} for a request that creates something, retrying only the
|
|
35
|
+
* statuses that cannot mean it was already created.
|
|
36
|
+
*/
|
|
37
|
+
declare function executeCreateWithRetry<T>(fn: () => Promise<T>, config?: Omit<RetryConfig, 'retryableStatusCodes'>): Promise<T>;
|
|
38
|
+
export { executeCreateWithRetry, executeWithRetry, extractHttpStatusCode, getRetryDelay, isTransientError, MIN_RETRY_DELAY_MS, type RetryConfig, };
|
|
39
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/utils/retry.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,QAAA,MAAM,kBAAkB,KAAK,CAAA;AAY7B,KAAK,WAAW,GAAG;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;IACrB,kEAAkE;IAClE,oBAAoB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAC7C,CAAA;AAED,iBAAS,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CA2BjE;AAED,iBAAS,gBAAgB,CACrB,KAAK,EAAE,OAAO,EACd,oBAAoB,GAAE,WAAW,CAAC,MAAM,CAA0B,GACnE,OAAO,CAGT;AAED;;;;;;;GAOG;AACH,iBAAS,aAAa,CAAC,EACnB,OAAO,EACP,WAAW,EACX,UAAU,EACV,MAAoB,GACvB,EAAE;IACC,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;CACxB,GAAG,MAAM,CAIT;AAMD,iBAAe,gBAAgB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,GAAE,WAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,CAyB7F;AAED;;;GAGG;AACH,iBAAe,sBAAsB,CAAC,CAAC,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,GAAE,IAAI,CAAC,WAAW,EAAE,sBAAsB,CAAM,GACvD,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,WAAW,GACnB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* An optional string schema that converts empty strings to `undefined`.
|
|
4
|
+
* LLMs often send `""` for optional fields instead of omitting them,
|
|
5
|
+
* which causes the Todoist API to reject the request.
|
|
6
|
+
*
|
|
7
|
+
* `.optional()` must be outermost so the field stays optional in `z.infer` output types.
|
|
8
|
+
*/
|
|
9
|
+
export declare function optionalString(description: string): z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
10
|
+
//# sourceMappingURL=schema-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/schema-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,qFAMjD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SyncCommand, TodoistApi } from '@doist/todoist-sdk';
|
|
2
|
+
type SyncCommandResults = {
|
|
3
|
+
/** One entry per command, in the order they were sent. */
|
|
4
|
+
outcomes: PromiseSettledResult<void>[];
|
|
5
|
+
/** Server IDs of the resources the request created, keyed by command `tempId`. */
|
|
6
|
+
tempIdMapping: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sends Sync commands in one request and reports whether each was applied.
|
|
10
|
+
*
|
|
11
|
+
* The Sync API applies commands independently, so a failed command does not undo
|
|
12
|
+
* the ones before it. Settling them per command lets a batch tool report each item
|
|
13
|
+
* the way its REST-backed siblings do, instead of failing the whole batch over the
|
|
14
|
+
* first bad item and hiding the changes that were made.
|
|
15
|
+
*
|
|
16
|
+
* Retrying the request is safe: the Sync API skips commands whose `uuid` it has
|
|
17
|
+
* already processed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function settleSyncCommands(client: TodoistApi, commands: SyncCommand[]): Promise<SyncCommandResults>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=sync-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-commands.d.ts","sourceRoot":"","sources":["../../src/utils/sync-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,WAAW,EAEhB,KAAK,UAAU,EAGlB,MAAM,oBAAoB,CAAA;AAG3B,KAAK,kBAAkB,GAAG;IACtB,0DAA0D;IAC1D,QAAQ,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAA;IACtC,kFAAkF;IAClF,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACxC,CAAA;AAID;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,WAAW,EAAE,GACxB,OAAO,CAAC,kBAAkB,CAAC,CAwC7B"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { CurrentUser, Filter, Label, PersonalProject, Section, SyncCommand, Task, TodoistApi, WorkspaceProject } from '@doist/todoist-sdk';
|
|
2
|
+
import { Mocked } from 'vitest';
|
|
3
|
+
import { MappedTask } from '../tool-helpers';
|
|
4
|
+
import { Priority } from './priorities';
|
|
5
|
+
type TaskWithUserFacingPriority = Omit<Task, 'priority'> & {
|
|
6
|
+
priority: Priority;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Creates a mock Task with all required properties and sensible defaults.
|
|
10
|
+
* Pass only the properties you want to override for your specific test.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createMockTask({ priority, ...overrides }?: Partial<TaskWithUserFacingPriority>): Task;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a mock Section with all required properties and sensible defaults.
|
|
15
|
+
* Pass only the properties you want to override for your specific test.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createMockSection(overrides?: Partial<Section>): Section;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a mock PersonalProject with all required properties and sensible defaults.
|
|
20
|
+
* Pass only the properties you want to override for your specific test.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createMockProject(overrides?: Partial<PersonalProject>): PersonalProject;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a mock WorkspaceProject with all required properties and sensible defaults.
|
|
25
|
+
* Pass only the properties you want to override for your specific test.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createMockWorkspaceProject(overrides?: Partial<WorkspaceProject>): WorkspaceProject;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a mock Label with all required properties and sensible defaults.
|
|
30
|
+
* Pass only the properties you want to override for your specific test.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createMockLabel(overrides?: Partial<Label>): Label;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a mock Filter with all required properties and sensible defaults.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createMockFilter(overrides?: Partial<Filter>): Filter;
|
|
37
|
+
/**
|
|
38
|
+
* The `syncStatus` the Sync API returns when every command was applied.
|
|
39
|
+
*/
|
|
40
|
+
export declare function allApplied(commands?: SyncCommand[]): Record<string, 'ok'>;
|
|
41
|
+
/**
|
|
42
|
+
* Mocks the personal project limit check: the plan allows `maxProjects` active
|
|
43
|
+
* personal projects and the account has `activeCount` of them.
|
|
44
|
+
*/
|
|
45
|
+
export declare function mockPersonalProjectCapacity(client: Mocked<TodoistApi>, { maxProjects, activeCount }: {
|
|
46
|
+
maxProjects: number;
|
|
47
|
+
activeCount: number;
|
|
48
|
+
}): void;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a mock API response object with results and nextCursor.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createMockApiResponse<T>(results: T[], nextCursor?: string | null): {
|
|
53
|
+
results: T[];
|
|
54
|
+
nextCursor: string | null;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Creates a simplified mapped task (matches mapTask output) for filter-based query tests.
|
|
58
|
+
*/
|
|
59
|
+
export declare function createMappedTask(overrides?: Partial<MappedTask>): MappedTask;
|
|
60
|
+
/**
|
|
61
|
+
* Common error messages used across tests.
|
|
62
|
+
*/
|
|
63
|
+
export declare const TEST_ERRORS: {
|
|
64
|
+
readonly API_RATE_LIMIT: "API Error: Rate limit exceeded";
|
|
65
|
+
readonly API_UNAUTHORIZED: "API Error: Unauthorized";
|
|
66
|
+
readonly INVALID_CURSOR: "Invalid cursor format";
|
|
67
|
+
readonly INVALID_FILTER: "Invalid filter query";
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Creates an error shaped like a rejected Todoist API call, so tests exercise the
|
|
71
|
+
* signals `formatBatchItemError` reads (status, `error`, `error_tag`) rather than a
|
|
72
|
+
* bare `Error` whose message collapses to "HTTP 403".
|
|
73
|
+
*/
|
|
74
|
+
export declare function createApiError({ status, error, tag, }: {
|
|
75
|
+
status: number;
|
|
76
|
+
error: string;
|
|
77
|
+
tag?: string;
|
|
78
|
+
}): Error;
|
|
79
|
+
/**
|
|
80
|
+
* Creates multiple test cases for parameterized testing.
|
|
81
|
+
*/
|
|
82
|
+
export declare function createTestCases<T, E = unknown>(cases: Array<{
|
|
83
|
+
name: string;
|
|
84
|
+
input: T;
|
|
85
|
+
expected?: E;
|
|
86
|
+
}>): {
|
|
87
|
+
name: string;
|
|
88
|
+
input: T;
|
|
89
|
+
expected?: E;
|
|
90
|
+
}[];
|
|
91
|
+
/**
|
|
92
|
+
* Common mock IDs used across tests for consistency.
|
|
93
|
+
*/
|
|
94
|
+
export declare const TEST_IDS: {
|
|
95
|
+
readonly TASK_1: "8485093748";
|
|
96
|
+
readonly TASK_2: "8485093749";
|
|
97
|
+
readonly TASK_3: "8485093750";
|
|
98
|
+
readonly PROJECT_INBOX: "inbox-project-id";
|
|
99
|
+
readonly PROJECT_WORK: "work-project-id";
|
|
100
|
+
readonly PROJECT_TEST: "6cfCcrrCFg2xP94Q";
|
|
101
|
+
readonly PROJECT_WORKSPACE: "workspace-project-id";
|
|
102
|
+
readonly SECTION_1: "section-123";
|
|
103
|
+
readonly SECTION_2: "section-456";
|
|
104
|
+
readonly USER_ID: "713437";
|
|
105
|
+
readonly WORKSPACE_1: "workspace-123";
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Fixed date for consistent test snapshots.
|
|
109
|
+
* Use this instead of new Date() in tests to avoid snapshot drift.
|
|
110
|
+
*/
|
|
111
|
+
export declare const TODAY: "2025-08-17";
|
|
112
|
+
/**
|
|
113
|
+
* Creates a mock CurrentUser with all required properties and sensible defaults.
|
|
114
|
+
* Pass only the properties you want to override for your specific test.
|
|
115
|
+
*/
|
|
116
|
+
export declare function createMockUser(overrides?: Partial<CurrentUser>): CurrentUser;
|
|
117
|
+
export {};
|
|
118
|
+
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/test-helpers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tool names module
|
|
3
|
+
*
|
|
4
|
+
* This module provides a single source of truth for all tool names used throughout the codebase.
|
|
5
|
+
* Each tool should import its own name from this module to avoid hardcoded strings.
|
|
6
|
+
* This prevents outdated references when tool names change.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ToolNames: {
|
|
9
|
+
readonly ADD_TASKS: "add-tasks";
|
|
10
|
+
readonly COMPLETE_TASKS: "complete-tasks";
|
|
11
|
+
readonly UNCOMPLETE_TASKS: "uncomplete-tasks";
|
|
12
|
+
readonly UPDATE_TASKS: "update-tasks";
|
|
13
|
+
readonly FIND_TASKS: "find-tasks";
|
|
14
|
+
readonly FIND_TASKS_BY_DATE: "find-tasks-by-date";
|
|
15
|
+
readonly FIND_COMPLETED_TASKS: "find-completed-tasks";
|
|
16
|
+
readonly RESCHEDULE_TASKS: "reschedule-tasks";
|
|
17
|
+
readonly ADD_PROJECTS: "add-projects";
|
|
18
|
+
readonly UPDATE_PROJECTS: "update-projects";
|
|
19
|
+
readonly FIND_PROJECTS: "find-projects";
|
|
20
|
+
readonly PROJECT_MANAGEMENT: "project-management";
|
|
21
|
+
readonly PROJECT_MOVE: "project-move";
|
|
22
|
+
readonly ADD_SECTIONS: "add-sections";
|
|
23
|
+
readonly UPDATE_SECTIONS: "update-sections";
|
|
24
|
+
readonly FIND_SECTIONS: "find-sections";
|
|
25
|
+
readonly ADD_COMMENTS: "add-comments";
|
|
26
|
+
readonly UPDATE_COMMENTS: "update-comments";
|
|
27
|
+
readonly FIND_COMMENTS: "find-comments";
|
|
28
|
+
readonly ADD_REMINDERS: "add-reminders";
|
|
29
|
+
readonly UPDATE_REMINDERS: "update-reminders";
|
|
30
|
+
readonly FIND_REMINDERS: "find-reminders";
|
|
31
|
+
readonly VIEW_ATTACHMENT: "view-attachment";
|
|
32
|
+
readonly FIND_PROJECT_COLLABORATORS: "find-project-collaborators";
|
|
33
|
+
readonly MANAGE_ASSIGNMENTS: "manage-assignments";
|
|
34
|
+
readonly FIND_ACTIVITY: "find-activity";
|
|
35
|
+
readonly GET_PRODUCTIVITY_STATS: "get-productivity-stats";
|
|
36
|
+
readonly GET_PROJECT_HEALTH: "get-project-health";
|
|
37
|
+
readonly GET_PROJECT_ACTIVITY_STATS: "get-project-activity-stats";
|
|
38
|
+
readonly ANALYZE_PROJECT_HEALTH: "analyze-project-health";
|
|
39
|
+
readonly GET_WORKSPACE_INSIGHTS: "get-workspace-insights";
|
|
40
|
+
readonly GET_OVERVIEW: "get-overview";
|
|
41
|
+
readonly DELETE_OBJECT: "delete-object";
|
|
42
|
+
readonly FETCH_OBJECT: "fetch-object";
|
|
43
|
+
readonly REORDER_OBJECTS: "reorder-objects";
|
|
44
|
+
readonly USER_INFO: "user-info";
|
|
45
|
+
readonly GET_USER_STATUS: "get-user-status";
|
|
46
|
+
readonly SET_USER_STATUS: "set-user-status";
|
|
47
|
+
readonly ADD_LABELS: "add-labels";
|
|
48
|
+
readonly UPDATE_LABELS: "update-labels";
|
|
49
|
+
readonly FIND_LABELS: "find-labels";
|
|
50
|
+
readonly FIND_FILTERS: "find-filters";
|
|
51
|
+
readonly ADD_FILTERS: "add-filters";
|
|
52
|
+
readonly UPDATE_FILTERS: "update-filters";
|
|
53
|
+
readonly EXPORT_PROJECT_TEMPLATE: "export-project-template";
|
|
54
|
+
readonly IMPORT_PROJECT_TEMPLATE: "import-project-template";
|
|
55
|
+
readonly LIST_WORKSPACES: "list-workspaces";
|
|
56
|
+
readonly SEARCH: "search";
|
|
57
|
+
readonly FETCH: "fetch";
|
|
58
|
+
};
|
|
59
|
+
export type ToolName = (typeof ToolNames)[keyof typeof ToolNames];
|
|
60
|
+
//# sourceMappingURL=tool-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-names.d.ts","sourceRoot":"","sources":["../../src/utils/tool-names.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+EZ,CAAA;AAGV,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { TodoistApi } from '@doist/todoist-sdk';
|
|
2
|
+
export type ResolvedUser = {
|
|
3
|
+
userId: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
email: string;
|
|
6
|
+
};
|
|
7
|
+
export type ProjectCollaborator = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A bounded, TTL-aware LRU cache. Expired entries are removed when read and
|
|
14
|
+
* when space is needed; the least recently used live entry is then evicted.
|
|
15
|
+
*/
|
|
16
|
+
export declare class BoundedTtlCache<T> {
|
|
17
|
+
private readonly maxEntries;
|
|
18
|
+
private readonly ttl;
|
|
19
|
+
private readonly entries;
|
|
20
|
+
constructor(maxEntries: number, ttl: number);
|
|
21
|
+
get(key: string): T | undefined;
|
|
22
|
+
set(key: string, result: T): void;
|
|
23
|
+
clear(): void;
|
|
24
|
+
get size(): number;
|
|
25
|
+
private pruneExpiredEntries;
|
|
26
|
+
}
|
|
27
|
+
/** Keyword that resolves to the current authenticated user. */
|
|
28
|
+
export declare const SELF_USER_KEYWORD: "me";
|
|
29
|
+
export declare class UserResolver {
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
|
|
32
|
+
* Supports exact name matches, partial matches, email matches, and the "me" keyword.
|
|
33
|
+
*/
|
|
34
|
+
resolveUser(client: TodoistApi, nameOrId: string): Promise<ResolvedUser | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Validate that a user is a collaborator on a specific project
|
|
37
|
+
*/
|
|
38
|
+
validateProjectCollaborator(client: TodoistApi, projectId: string, userId: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Get collaborators for a specific project
|
|
41
|
+
*/
|
|
42
|
+
getProjectCollaborators(client: TodoistApi, projectId: string, cacheScope?: string | null): Promise<ProjectCollaborator[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Get all collaborators from all shared projects, deduplicated by user ID.
|
|
45
|
+
*/
|
|
46
|
+
getAllCollaborators(client: TodoistApi, cacheScope?: string | null): Promise<ProjectCollaborator[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Short display names ("Ada L."), keyed by user ID, for the collaborators of
|
|
49
|
+
* the given projects, abbreviated the same way the Todoist CLI shows them. A
|
|
50
|
+
* project whose collaborators can't be fetched contributes no names, so
|
|
51
|
+
* naming people never fails the tool that asked.
|
|
52
|
+
*
|
|
53
|
+
* Pass the current user's ID as `cacheScope` when it is already known, to
|
|
54
|
+
* save fetching the user again.
|
|
55
|
+
*/
|
|
56
|
+
getUserShortNames(client: TodoistApi, projectIds: Iterable<string>, cacheScope?: string | null): Promise<Map<string, string>>;
|
|
57
|
+
private getCacheScope;
|
|
58
|
+
private getCacheKey;
|
|
59
|
+
/**
|
|
60
|
+
* Clear all caches - useful for testing
|
|
61
|
+
*/
|
|
62
|
+
clearCache(): void;
|
|
63
|
+
}
|
|
64
|
+
export declare const userResolver: UserResolver;
|
|
65
|
+
/**
|
|
66
|
+
* Short display names for the assignees of `tasks`, keyed by user ID. Only
|
|
67
|
+
* projects with an assigned task are looked up, so a list without assignees
|
|
68
|
+
* costs no extra requests. `cacheScope` is as for
|
|
69
|
+
* {@link UserResolver.getUserShortNames}.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getAssigneeShortNames(client: TodoistApi, tasks: {
|
|
72
|
+
projectId: string;
|
|
73
|
+
responsibleUid?: string;
|
|
74
|
+
}[], cacheScope?: string | null): Promise<Map<string, string>>;
|
|
75
|
+
export declare function resolveUserNameToId(client: TodoistApi, nameOrId: string): Promise<ResolvedUser | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve a list of user references — IDs, emails, full names, or the "me"
|
|
78
|
+
* keyword — to users, in one pass.
|
|
79
|
+
*
|
|
80
|
+
* Order of the input is preserved and duplicates are collapsed, so callers can
|
|
81
|
+
* hand the result straight to an API that expects a recipient list. Every
|
|
82
|
+
* reference that cannot be resolved is reported in a single error rather than
|
|
83
|
+
* failing on the first one, so the caller learns about all the bad references
|
|
84
|
+
* at once.
|
|
85
|
+
*
|
|
86
|
+
* @param client - Todoist API client
|
|
87
|
+
* @param refs - User references to resolve
|
|
88
|
+
* @returns The resolved users, deduplicated by user ID
|
|
89
|
+
* @throws Error naming every reference that could not be resolved
|
|
90
|
+
*/
|
|
91
|
+
export declare function resolveUserRefs(client: TodoistApi, refs: string[]): Promise<ResolvedUser[]>;
|
|
92
|
+
//# sourceMappingURL=user-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/user-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,UAAU,EAElB,MAAM,oBAAoB,CAAA;AAG3B,MAAM,MAAM,YAAY,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CAChB,CAAA;AAWD;;;GAGG;AACH,qBAAa,eAAe,CAAC,CAAC;IAItB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG;IAJxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;gBAGtC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM;IAGhC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAe/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,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,EACvD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAM9B;AAGD,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAE9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAgCjG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TodoistApi, UserStatus } from '@doist/todoist-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const StatusOutputSchema: z.ZodObject<{
|
|
4
|
+
message: z.ZodString;
|
|
5
|
+
emoji: z.ZodOptional<z.ZodString>;
|
|
6
|
+
activeUntil: z.ZodOptional<z.ZodString>;
|
|
7
|
+
pauseNotifications: z.ZodBoolean;
|
|
8
|
+
pauseActivity: z.ZodBoolean;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const UserStatusOutputSchema: {
|
|
11
|
+
hasStatus: z.ZodBoolean;
|
|
12
|
+
status: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
message: z.ZodString;
|
|
14
|
+
emoji: z.ZodOptional<z.ZodString>;
|
|
15
|
+
activeUntil: z.ZodOptional<z.ZodString>;
|
|
16
|
+
pauseNotifications: z.ZodBoolean;
|
|
17
|
+
pauseActivity: z.ZodBoolean;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
};
|
|
20
|
+
type StatusOutput = z.infer<typeof StatusOutputSchema>;
|
|
21
|
+
type UserStatusStructured = {
|
|
22
|
+
hasStatus: boolean;
|
|
23
|
+
status?: StatusOutput;
|
|
24
|
+
};
|
|
25
|
+
/** The user's active status, or `null` when there is none or it has expired. */
|
|
26
|
+
declare function fetchUserStatus(client: TodoistApi): Promise<UserStatus | null>;
|
|
27
|
+
declare function buildUserStatusResult(status: UserStatus | null, heading: string): {
|
|
28
|
+
textContent: string;
|
|
29
|
+
structuredContent: UserStatusStructured;
|
|
30
|
+
};
|
|
31
|
+
export { buildUserStatusResult, fetchUserStatus, UserStatusOutputSchema };
|
|
32
|
+
//# sourceMappingURL=user-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-status.d.ts","sourceRoot":"","sources":["../../src/utils/user-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,QAAA,MAAM,kBAAkB;;;;;;iBAMtB,CAAA;AAEF,QAAA,MAAM,sBAAsB;;;;;;;;;CAG3B,CAAA;AAED,KAAK,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEtD,KAAK,oBAAoB,GAAG;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,YAAY,CAAA;CACxB,CAAA;AAUD,gFAAgF;AAChF,iBAAe,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAK7E;AAaD,iBAAS,qBAAqB,CAC1B,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,OAAO,EAAE,MAAM,GAChB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,oBAAoB,CAAA;CAAE,CAuBlE;AAED,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValidateToken } from '@todoist/mcp-core/host';
|
|
2
|
+
/**
|
|
3
|
+
* Validates a Todoist API token with a status-only call to the user endpoint.
|
|
4
|
+
*
|
|
5
|
+
* Resolves `'valid'`, `'invalid'` (401) or `'forbidden'` (403), so a host can answer a token that
|
|
6
|
+
* lacks a scope with an RFC 6750 `insufficient_scope` challenge rather than a blanket 401. The
|
|
7
|
+
* body is never parsed, so a change to the user object can't turn a valid token into an error.
|
|
8
|
+
*
|
|
9
|
+
* The request goes out through the SDK's transport, so it honours the same proxy settings as
|
|
10
|
+
* every tool call, and carries the usage-tracking headers as `auth:validate-token`.
|
|
11
|
+
*
|
|
12
|
+
* @throws {TokenValidationError} (from `@todoist/mcp-core/host`) for any other status, such as a
|
|
13
|
+
* 5xx, carrying it as `httpStatusCode`. Network and timeout errors propagate unchanged.
|
|
14
|
+
*/
|
|
15
|
+
declare const validateTodoistToken: ValidateToken;
|
|
16
|
+
export { validateTodoistToken };
|
|
17
|
+
//# sourceMappingURL=validate-todoist-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-todoist-token.d.ts","sourceRoot":"","sources":["../../src/utils/validate-todoist-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,wBAAwB,CAAA;AAOhF;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAQtB,CAAA;AAEN,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TodoistApi } from '@doist/todoist-sdk';
|
|
2
|
+
export type ResolvedWorkspace = {
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
workspaceName: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Check if a string looks like a workspace ID (purely numeric).
|
|
8
|
+
*/
|
|
9
|
+
export declare function looksLikeWorkspaceId(ref: string): boolean;
|
|
10
|
+
export declare class WorkspaceResolver {
|
|
11
|
+
private stateByClient;
|
|
12
|
+
private getWorkspaces;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a workspace name or ID to a workspace ID and name.
|
|
15
|
+
*
|
|
16
|
+
* Resolution order:
|
|
17
|
+
* 1. Exact ID match (always tried first for any input)
|
|
18
|
+
* 2. If input looks like an ID (numeric) but wasn't found, pass through as-is (API validates)
|
|
19
|
+
* 3. Exact case-insensitive name match
|
|
20
|
+
* 4. Unique partial case-insensitive name match
|
|
21
|
+
* 5. Multiple partial matches → throw ambiguous error
|
|
22
|
+
* 6. No match → throw not-found error
|
|
23
|
+
*/
|
|
24
|
+
resolveWorkspace(client: TodoistApi, nameOrId: string): Promise<ResolvedWorkspace>;
|
|
25
|
+
/**
|
|
26
|
+
* Clear all client caches and detach pending requests — useful for testing.
|
|
27
|
+
*/
|
|
28
|
+
clearCache(): void;
|
|
29
|
+
}
|
|
30
|
+
export declare const workspaceResolver: WorkspaceResolver;
|
|
31
|
+
//# sourceMappingURL=workspace-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/workspace-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,oBAAoB,CAAA;AAE/D,MAAM,MAAM,iBAAiB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACxB,CAAA;AASD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,qBAAa,iBAAiB;IAI1B,OAAO,CAAC,aAAa,CAAoD;YAE3D,aAAa;IA+B3B;;;;;;;;;;OAUG;IACG,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsDxF;;OAEG;IACH,UAAU,IAAI,IAAI;CAGrB;AAGD,eAAO,MAAM,iBAAiB,mBAA0B,CAAA"}
|