@todoist/mcp 17.3.8 → 17.3.9
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/index.js +3 -3
- package/dist/main-http.js +2 -2
- package/dist/main.js +1 -1
- package/dist/mcp-apps/index.html +44 -43
- package/dist/{mcp-server-DiOGG87N.js → mcp-server-Ci7ZsOc9.js} +341 -341
- package/dist/{require-valid-todoist-token-NpvxaPGy.js → require-valid-todoist-token-Da2KnaWY.js} +1 -1
- package/package.json +2 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResourceTemplate as hr, McpServer as mr } from "@modelcontextprotocol/server";
|
|
2
2
|
import { createHash as zo, randomUUID as Ce } from "node:crypto";
|
|
3
3
|
import { readFileSync as fr } from "node:fs";
|
|
4
|
-
import {
|
|
4
|
+
import { join as ct, dirname as qo } from "node:path";
|
|
5
5
|
import { fileURLToPath as br } from "node:url";
|
|
6
6
|
import { RESOURCE_MIME_TYPE as dt } from "@modelcontextprotocol/ext-apps/server";
|
|
7
7
|
import { createToolRegistrar as gr } from "@todoist/mcp-core";
|
|
@@ -11,169 +11,10 @@ import { createRequire as Tr } from "node:module";
|
|
|
11
11
|
import { TodoistApi as kr, formatUserShortName as Go, isWorkspaceProject as W, isPersonalProject as Q, colors as lt, LOCATION_TRIGGERS as Yo, REMINDER_TYPES as Ir, TodoistSyncError as vr, TodoistRequestError as Sr, createCommand as Y, PROJECT_ICONS as Vo, PROJECT_VIEW_STYLES as Jo, REMINDER_DELIVERY_SERVICES as Cr, HEALTH_STATUSES as $t, getTaskUrl as Xo, getProjectUrl as Zo, ACTIVITY_EVENT_TYPES as jr, ACTIVITY_OBJECT_TYPES as Qo, escapeFilterToken as Et, parseTodoistUrl as $r, WORKSPACE_ROLES as Er, WORKSPACE_PLANS as Ar } from "@todoist/sdk";
|
|
12
12
|
import { addDays as es, formatISO as Dr } from "date-fns";
|
|
13
13
|
import { generateNKeysBetween as ts } from "fractional-indexing";
|
|
14
|
-
const At = 3600 * 1e3, xr = 365 * 24 * At, $ = {
|
|
15
|
-
/** Default limit for task listings */
|
|
16
|
-
TASKS_DEFAULT: 10,
|
|
17
|
-
/** Maximum limit for task search and list operations */
|
|
18
|
-
TASKS_MAX: 100,
|
|
19
|
-
/** Largest page of tasks the API returns, for reading past tasks a tool filters out */
|
|
20
|
-
TASKS_PAGE_MAX: 200,
|
|
21
|
-
/** Default limit for completed tasks */
|
|
22
|
-
COMPLETED_TASKS_DEFAULT: 50,
|
|
23
|
-
/** Maximum limit for completed tasks */
|
|
24
|
-
COMPLETED_TASKS_MAX: 200,
|
|
25
|
-
/** Default limit for project listings */
|
|
26
|
-
PROJECTS_DEFAULT: 50,
|
|
27
|
-
/** Maximum limit for project listings */
|
|
28
|
-
PROJECTS_MAX: 200,
|
|
29
|
-
/** Maximum limit for section listings */
|
|
30
|
-
SECTIONS_MAX: 200,
|
|
31
|
-
/** Page size for reading a workspace's folders */
|
|
32
|
-
FOLDERS_MAX: 200,
|
|
33
|
-
/** Batch size for fetching all tasks in a project */
|
|
34
|
-
TASKS_BATCH_SIZE: 50,
|
|
35
|
-
/** Maximum number of direct children returned when children are requested alongside an object */
|
|
36
|
-
CHILDREN_MAX: 25,
|
|
37
|
-
/** Default limit for comment listings */
|
|
38
|
-
COMMENTS_DEFAULT: 10,
|
|
39
|
-
/** Maximum limit for comment search and list operations */
|
|
40
|
-
COMMENTS_MAX: 10,
|
|
41
|
-
/** Maximum number of users a single comment can notify */
|
|
42
|
-
NOTIFY_USERS_MAX: 25,
|
|
43
|
-
/** Default limit for activity log listings */
|
|
44
|
-
ACTIVITY_DEFAULT: 20,
|
|
45
|
-
/** Maximum limit for activity log search and list operations */
|
|
46
|
-
ACTIVITY_MAX: 100,
|
|
47
|
-
/** Default limit for label listings */
|
|
48
|
-
LABELS_DEFAULT: 50,
|
|
49
|
-
/** Maximum limit for label listings */
|
|
50
|
-
LABELS_MAX: 200,
|
|
51
|
-
/** Maximum values in one list-valued filter parameter, such as labels or project IDs */
|
|
52
|
-
FILTER_VALUES_MAX: 50
|
|
53
|
-
}, _e = {
|
|
54
|
-
/** Maximum number of failures to show in detailed error messages */
|
|
55
|
-
MAX_FAILURES_SHOWN: 3
|
|
56
|
-
}, Or = {
|
|
57
|
-
/** Maximum number of failed items named in one log line */
|
|
58
|
-
MAX_FAILURES_LOGGED: 5
|
|
59
|
-
}, D = {
|
|
60
|
-
/** Maximum tasks accepted by one task update operation */
|
|
61
|
-
TASKS_PER_OPERATION: 25,
|
|
62
|
-
/**
|
|
63
|
-
* Maximum tasks one add-tasks call creates. They go out as one Sync request,
|
|
64
|
-
* which takes at most 100 commands.
|
|
65
|
-
*/
|
|
66
|
-
TASK_CREATES_PER_OPERATION: 100,
|
|
67
|
-
/** Maximum projects, sections, comments, labels or filters created or updated by one call */
|
|
68
|
-
ITEMS_PER_OPERATION: 25,
|
|
69
|
-
/**
|
|
70
|
-
* Maximum existing objects one bulk action takes by ID, such as completing,
|
|
71
|
-
* rescheduling, reordering or assigning. A sync-backed reschedule sends one
|
|
72
|
-
* command per task, which keeps it under the Sync API's 100 commands per
|
|
73
|
-
* request. A reorder is not bounded that way: it can rekey every sibling of
|
|
74
|
-
* the objects it moves, so its command count depends on the sibling list.
|
|
75
|
-
*/
|
|
76
|
-
BULK_ACTIONS_PER_OPERATION: 50,
|
|
77
|
-
/** Maximum labels set on one task by one call */
|
|
78
|
-
LABELS_PER_TASK: 50
|
|
79
|
-
}, ut = {
|
|
80
|
-
/**
|
|
81
|
-
* In-flight task-move requests per account, per process.
|
|
82
|
-
*
|
|
83
|
-
* Kept at 1 because the API locks the whole task tree for a move, and a tree
|
|
84
|
-
* spans a task's source as well as its destination — two moves of sibling
|
|
85
|
-
* subtasks contend even when they target different projects, and the loser
|
|
86
|
-
* fails. Batching same-destination moves into a single request means
|
|
87
|
-
* serialising costs little in practice. One per process is the smallest
|
|
88
|
-
* contribution a process can make; see the note above for the global picture.
|
|
89
|
-
*/
|
|
90
|
-
TASK_MOVES: 1,
|
|
91
|
-
/** In-flight non-move write requests per account, per process. */
|
|
92
|
-
WRITES: 4,
|
|
93
|
-
/**
|
|
94
|
-
* How long a request may wait for a slot before it is abandoned unsent.
|
|
95
|
-
*
|
|
96
|
-
* Matches the SDK's own 30s request timeout, which only starts once a request
|
|
97
|
-
* actually goes out: a task that has already waited that long would be
|
|
98
|
-
* answering a caller who has given up. Comfortably above the worst realistic
|
|
99
|
-
* queue (serialised moves to 100 distinct destinations is roughly 15s).
|
|
100
|
-
*/
|
|
101
|
-
QUEUE_WAIT_MS: 3e4
|
|
102
|
-
}, so = qo(br(import.meta.url)), _r = [
|
|
103
|
-
ct(so, "task-list", "index.html"),
|
|
104
|
-
ct(so, "mcp-apps", "index.html")
|
|
105
|
-
], Pr = `<!doctype html>
|
|
106
|
-
<html>
|
|
107
|
-
<body>
|
|
108
|
-
<p>Task list app is missing. Run "npm run build" to generate it.</p>
|
|
109
|
-
</body>
|
|
110
|
-
</html>`;
|
|
111
|
-
function Rr() {
|
|
112
|
-
const e = [];
|
|
113
|
-
for (const t of _r)
|
|
114
|
-
try {
|
|
115
|
-
return fr(t, "utf-8");
|
|
116
|
-
} catch (o) {
|
|
117
|
-
e.push(o);
|
|
118
|
-
}
|
|
119
|
-
return console.error("Failed to load task list app HTML from any known path:", e), Pr;
|
|
120
|
-
}
|
|
121
|
-
const os = Rr(), Ur = zo("sha256").update(os).digest("hex").slice(0, 12), pt = `ui://todoist/task-list@${Ur}`, Nr = "ui://todoist/task-list@{hash}", ht = "Interactive task list widget", Lr = "https://ai.todoist.net", mt = {
|
|
122
|
-
ui: {
|
|
123
|
-
prefersBorder: !0,
|
|
124
|
-
csp: {
|
|
125
|
-
// The widget is bundled into one HTML file and does not fetch or load external assets.
|
|
126
|
-
connectDomains: [],
|
|
127
|
-
resourceDomains: []
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
"openai/widgetDescription": ht,
|
|
131
|
-
"openai/widgetPrefersBorder": !0,
|
|
132
|
-
"openai/widgetCSP": {
|
|
133
|
-
connect_domains: [],
|
|
134
|
-
resource_domains: []
|
|
135
|
-
},
|
|
136
|
-
"openai/widgetDomain": Lr
|
|
137
|
-
}, Mr = { ttlMs: xr, cacheScope: "public" }, Fr = { ttlMs: At, cacheScope: "private" };
|
|
138
|
-
function ro(e) {
|
|
139
|
-
return {
|
|
140
|
-
contents: [
|
|
141
|
-
{
|
|
142
|
-
uri: e,
|
|
143
|
-
mimeType: dt,
|
|
144
|
-
text: os,
|
|
145
|
-
_meta: mt
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function Hr(e) {
|
|
151
|
-
e.registerResource(
|
|
152
|
-
"todoist-task-list",
|
|
153
|
-
pt,
|
|
154
|
-
{
|
|
155
|
-
description: ht,
|
|
156
|
-
mimeType: dt,
|
|
157
|
-
_meta: mt,
|
|
158
|
-
cacheHint: Mr
|
|
159
|
-
},
|
|
160
|
-
async () => ro(pt)
|
|
161
|
-
), e.registerResource(
|
|
162
|
-
"todoist-task-list-hash-fallback",
|
|
163
|
-
new hr(Nr, { list: void 0 }),
|
|
164
|
-
{
|
|
165
|
-
description: `${ht} compatibility fallback`,
|
|
166
|
-
mimeType: dt,
|
|
167
|
-
_meta: mt,
|
|
168
|
-
cacheHint: Fr
|
|
169
|
-
},
|
|
170
|
-
async (t) => ro(t.toString())
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
14
|
function ue(e) {
|
|
174
15
|
return typeof e == "object" && e !== null;
|
|
175
16
|
}
|
|
176
|
-
function
|
|
17
|
+
function ut(...e) {
|
|
177
18
|
return e.find(ue);
|
|
178
19
|
}
|
|
179
20
|
function X(...e) {
|
|
@@ -197,17 +38,17 @@ function ye(e) {
|
|
|
197
38
|
const t = B(e);
|
|
198
39
|
return t !== void 0 ? t : C(e);
|
|
199
40
|
}
|
|
200
|
-
function
|
|
41
|
+
function xr(e) {
|
|
201
42
|
return e.replace(/\b(Bearer)\s+[A-Za-z0-9._~+/=-]+/gi, "$1 [REDACTED]").replace(
|
|
202
43
|
/\b(token|api[_-]?key|authorization)\s*[:=]\s*["']?[A-Za-z0-9._~+/=-]{6,}["']?/gi,
|
|
203
44
|
"$1: [REDACTED]"
|
|
204
45
|
).replace(/([?&](?:token|api[_-]?key|authorization)=)[^&\s]+/gi, "$1[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[REDACTED]");
|
|
205
46
|
}
|
|
206
47
|
function G(e, t = 220) {
|
|
207
|
-
const o =
|
|
48
|
+
const o = xr(e).replace(/\s+/g, " ").trim();
|
|
208
49
|
return o.length <= t ? o : `${o.slice(0, t - 3)}...`;
|
|
209
50
|
}
|
|
210
|
-
function
|
|
51
|
+
function pt(e) {
|
|
211
52
|
const t = e.trim();
|
|
212
53
|
return /\bHTTP\s*\d{3}\b/i.test(t) || /\bstatus code \d{3}\b/i.test(t) || /^bad request$/i.test(t) || /^unauthorized$/i.test(t) || /^forbidden$/i.test(t) || /^not found$/i.test(t);
|
|
213
54
|
}
|
|
@@ -245,7 +86,7 @@ function ce(e) {
|
|
|
245
86
|
}
|
|
246
87
|
return r.length > 0 ? G(r.join("; ")) : void 0;
|
|
247
88
|
}
|
|
248
|
-
function
|
|
89
|
+
function Or(e) {
|
|
249
90
|
if (!e)
|
|
250
91
|
return [];
|
|
251
92
|
const t = /* @__PURE__ */ new Set(), o = (i) => {
|
|
@@ -257,7 +98,7 @@ function Br(e) {
|
|
|
257
98
|
C(e.path)
|
|
258
99
|
);
|
|
259
100
|
o(r);
|
|
260
|
-
const n =
|
|
101
|
+
const n = ut(
|
|
261
102
|
e.details,
|
|
262
103
|
e.errorDetails,
|
|
263
104
|
e.errorExtra,
|
|
@@ -308,7 +149,7 @@ function Br(e) {
|
|
|
308
149
|
}
|
|
309
150
|
return Array.from(t).slice(0, 3);
|
|
310
151
|
}
|
|
311
|
-
const
|
|
152
|
+
const _r = [
|
|
312
153
|
"error",
|
|
313
154
|
"error_code",
|
|
314
155
|
"error_tag",
|
|
@@ -319,22 +160,22 @@ const Kr = [
|
|
|
319
160
|
"httpCode",
|
|
320
161
|
"errorExtra"
|
|
321
162
|
];
|
|
322
|
-
function
|
|
323
|
-
return e ?
|
|
163
|
+
function Pr(e) {
|
|
164
|
+
return e ? _r.some((t) => e[t] !== void 0) : !1;
|
|
324
165
|
}
|
|
325
|
-
const
|
|
166
|
+
const os = 'A due string must name one specific date or recurrence, such as "tomorrow", "Friday at 3pm", "2026-12-01" or "every weekday"; a period such as "this week" is not a date.', ze = {
|
|
326
167
|
// Seen for a deadline sent by a free-plan user (task creates and updates), for
|
|
327
168
|
// activity older than the plan's history limit, and for location reminders.
|
|
328
169
|
PREMIUM_ONLY: "The user's Todoist plan does not include a feature this request used. It is not an authentication or permission problem, and retrying the same request will not help. Most often it is a deadline on a free plan: retry without `deadlineDate`. Activity history only goes back as far as the plan allows: retry with a more recent date range. Tell the user what was left out and that it needs a plan upgrade.",
|
|
329
170
|
// Seen for an unparseable due string on a create, and for a reschedule sent
|
|
330
171
|
// "today" or a malformed time where an ISO date belongs.
|
|
331
|
-
INVALID_DATE: `Todoist could not parse a date in this request. ${
|
|
172
|
+
INVALID_DATE: `Todoist could not parse a date in this request. ${os} Where a field asks for YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS, send exactly that, not words such as "today". Change only the date and retry.`,
|
|
332
173
|
MAX_ITEMS_LIMIT_REACHED: "This project has reached the maximum number of active tasks per project (subtasks count toward it; completed tasks do not). The cap is the same on every Todoist plan — upgrading will not raise it — and it is not an authentication or permission problem. Complete, delete, or move existing tasks out of the project, or add the task to a different project, then retry.",
|
|
333
174
|
USER_CANNOT_VIEW_TEMPLATE: "This template exists but belongs to another account. Personal templates are private to whoever saved them, and a link to one cannot be used by anyone else. Use a public gallery template instead, or ask the owner to export it with export-project-template and share the CSV."
|
|
334
|
-
},
|
|
175
|
+
}, Rr = {
|
|
335
176
|
PREMIUM_ONLY: "The user's Todoist plan does not include a feature this item used. It is not an authentication or permission problem, and retrying the same item will not help. On a task it is most often a deadline on a free plan: retry without `deadlineDate`. Tell the user what was left out and that it needs a plan upgrade."
|
|
336
177
|
};
|
|
337
|
-
function
|
|
178
|
+
function Ur(...e) {
|
|
338
179
|
for (const t of e) {
|
|
339
180
|
if (!t)
|
|
340
181
|
continue;
|
|
@@ -345,23 +186,23 @@ function Gr(...e) {
|
|
|
345
186
|
return r;
|
|
346
187
|
}
|
|
347
188
|
}
|
|
348
|
-
function
|
|
189
|
+
function ss(e) {
|
|
349
190
|
const t = e.tag?.toUpperCase();
|
|
350
|
-
return t && ze[t] ? t :
|
|
191
|
+
return t && ze[t] ? t : Ur(...e.rawText ?? [], e.message, e.details);
|
|
351
192
|
}
|
|
352
|
-
function
|
|
353
|
-
const t =
|
|
193
|
+
function Nr(e) {
|
|
194
|
+
const t = ss(e);
|
|
354
195
|
return t ? ze[t] : void 0;
|
|
355
196
|
}
|
|
356
|
-
function
|
|
357
|
-
const t =
|
|
197
|
+
function Lr(e) {
|
|
198
|
+
const t = Nr(e);
|
|
358
199
|
if (t)
|
|
359
200
|
return t;
|
|
360
201
|
const { statusCode: o } = e, r = e.fieldHints.length > 0;
|
|
361
202
|
return o === 401 ? "Authentication failed. Verify your API token, then retry." : o === 403 ? "Access denied. Retrying the same request will not help. If it's a scope/access problem (for example, insufficient token scope), use a token or account with the required access. Otherwise, change the request or target instead." : o === 404 ? "Confirm the referenced IDs exist and are accessible, then retry." : o === 429 ? "Rate limit reached. Wait briefly and retry." : o !== void 0 && o >= 500 ? "Todoist API may be temporarily unavailable. Retry shortly." : r ? "Fix the field hints above and retry." : o === 400 || o === 422 ? "Check parameter values and formats, then retry." : "Check the request parameters and retry.";
|
|
362
203
|
}
|
|
363
|
-
function
|
|
364
|
-
const t = ue(e) ? e : void 0, o = e instanceof Error && ue(e.cause) ? e.cause : void 0, r =
|
|
204
|
+
function At(e) {
|
|
205
|
+
const t = ue(e) ? e : void 0, o = e instanceof Error && ue(e.cause) ? e.cause : void 0, r = ut(t?.response, o?.response), n = ut(
|
|
365
206
|
t?.responseData,
|
|
366
207
|
r?.data,
|
|
367
208
|
t?.data,
|
|
@@ -401,15 +242,15 @@ function Dt(e) {
|
|
|
401
242
|
C(t?.message),
|
|
402
243
|
C(o?.message),
|
|
403
244
|
e instanceof Error ? e.message : C(e)
|
|
404
|
-
].filter((h) => !!h), u = d.find((h) => !
|
|
245
|
+
].filter((h) => !!h), u = d.find((h) => !pt(h)) || d[0], l = X(
|
|
405
246
|
ce(n?.errorExtra),
|
|
406
247
|
ce(n?.error_extra),
|
|
407
248
|
ce(n?.details),
|
|
408
249
|
ce(n?.errorDetails),
|
|
409
250
|
ce(n?.errors),
|
|
410
251
|
ce(t?.details)
|
|
411
|
-
), p =
|
|
412
|
-
return a !== void 0 ||
|
|
252
|
+
), p = Or(n);
|
|
253
|
+
return a !== void 0 || Pr(n) || c !== void 0 || i !== void 0 || (u ? pt(u) : !1) ? {
|
|
413
254
|
statusCode: a,
|
|
414
255
|
code: i,
|
|
415
256
|
tag: c ? G(c, 80) : void 0,
|
|
@@ -419,21 +260,21 @@ function Dt(e) {
|
|
|
419
260
|
fieldHints: p
|
|
420
261
|
} : null;
|
|
421
262
|
}
|
|
422
|
-
function
|
|
263
|
+
function rs(e) {
|
|
423
264
|
const t = [];
|
|
424
265
|
return e.statusCode !== void 0 && t.push(`HTTP ${e.statusCode}`), e.code !== void 0 && t.push(`code ${e.code}`), e.tag && t.push(`tag ${e.tag}`), t;
|
|
425
266
|
}
|
|
426
|
-
function
|
|
427
|
-
const t =
|
|
267
|
+
function Mr(e) {
|
|
268
|
+
const t = rs(e), o = [
|
|
428
269
|
t.length > 0 ? `Todoist API request failed (${t.join(", ")}).` : "Todoist API request failed."
|
|
429
270
|
];
|
|
430
|
-
return e.message && o.push(`Message: ${e.message}`), e.details && e.details !== e.message && o.push(`Details: ${e.details}`), e.fieldHints.length > 0 && o.push(`Field hints: ${e.fieldHints.join("; ")}`), o.push(`Try next: ${
|
|
271
|
+
return e.message && o.push(`Message: ${e.message}`), e.details && e.details !== e.message && o.push(`Details: ${e.details}`), e.fieldHints.length > 0 && o.push(`Field hints: ${e.fieldHints.join("; ")}`), o.push(`Try next: ${Lr(e)}`), o.join(`
|
|
431
272
|
`);
|
|
432
273
|
}
|
|
433
|
-
function
|
|
274
|
+
function ns(e) {
|
|
434
275
|
return e instanceof Error ? G(e.message) : typeof e == "string" ? G(e) : "An unknown error occurred";
|
|
435
276
|
}
|
|
436
|
-
class
|
|
277
|
+
class Dt extends Error {
|
|
437
278
|
constructor(t) {
|
|
438
279
|
super(t), this.name = "DueStringParseError";
|
|
439
280
|
}
|
|
@@ -444,41 +285,129 @@ class de extends Error {
|
|
|
444
285
|
}
|
|
445
286
|
}
|
|
446
287
|
function K(e) {
|
|
447
|
-
const { summary: t, hint: o } =
|
|
288
|
+
const { summary: t, hint: o } = as(e);
|
|
448
289
|
return o ? `${t}. ${o.text}` : t;
|
|
449
290
|
}
|
|
450
|
-
function
|
|
451
|
-
if (e instanceof
|
|
291
|
+
function as(e) {
|
|
292
|
+
if (e instanceof Dt || e instanceof de)
|
|
452
293
|
return { summary: e.message };
|
|
453
|
-
const t =
|
|
294
|
+
const t = At(e);
|
|
454
295
|
if (!t)
|
|
455
|
-
return { summary:
|
|
456
|
-
const o =
|
|
296
|
+
return { summary: ns(e) };
|
|
297
|
+
const o = rs(t), r = t.message && !(o.length > 0 && pt(t.message)) ? t.message : "Todoist API request failed", n = o.length > 0 ? `${r} (${o.join(", ")})` : r, a = ss(t), i = a ? Rr[a] ?? ze[a] : void 0;
|
|
457
298
|
return a && i ? { summary: n, hint: { tag: a, text: i } } : { summary: n };
|
|
458
299
|
}
|
|
459
|
-
function
|
|
300
|
+
function Fr(e, {
|
|
460
301
|
taskContent: t,
|
|
461
302
|
dueString: o,
|
|
462
303
|
deadlineDate: r
|
|
463
304
|
}) {
|
|
464
305
|
if (!o)
|
|
465
306
|
return;
|
|
466
|
-
const n =
|
|
307
|
+
const n = At(e), a = n?.tag?.toUpperCase(), i = a === "INVALID_DUE_STRING", c = !r && (a === "INVALID_DATE" || /^invalid date format\.?$/i.test(n?.message ?? ""));
|
|
467
308
|
if (!i && !c)
|
|
468
309
|
return;
|
|
469
310
|
const d = o.trim().replace(/^recurring(?:\s+|$)/i, "").trim();
|
|
470
|
-
return d !== o.trim() && d ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use Todoist recurrence syntax, for example \`${d}\`; don't prefix it with \`recurring\`. Change only \`dueString\` and retry.` : d !== o.trim() ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use a complete Todoist recurrence expression; \`recurring\` alone is not valid. Change only \`dueString\` and retry.` : `Task "${t}" wasn't created because \`dueString\` could not be parsed. ${
|
|
311
|
+
return d !== o.trim() && d ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use Todoist recurrence syntax, for example \`${d}\`; don't prefix it with \`recurring\`. Change only \`dueString\` and retry.` : d !== o.trim() ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use a complete Todoist recurrence expression; \`recurring\` alone is not valid. Change only \`dueString\` and retry.` : `Task "${t}" wasn't created because \`dueString\` could not be parsed. ${os} Change only \`dueString\` and retry.`;
|
|
471
312
|
}
|
|
472
|
-
function
|
|
473
|
-
if (e instanceof yr || e instanceof
|
|
313
|
+
function Hr(e) {
|
|
314
|
+
if (e instanceof yr || e instanceof Dt || e instanceof de)
|
|
474
315
|
return e.message;
|
|
475
|
-
const t =
|
|
476
|
-
return t ?
|
|
316
|
+
const t = At(e);
|
|
317
|
+
return t ? Mr(t) : ns(e);
|
|
477
318
|
}
|
|
478
|
-
const
|
|
479
|
-
version:
|
|
319
|
+
const Wr = "17.3.9", Br = {
|
|
320
|
+
version: Wr
|
|
321
|
+
}, xt = 3600 * 1e3, Kr = 365 * 24 * xt, $ = {
|
|
322
|
+
/** Default limit for task listings */
|
|
323
|
+
TASKS_DEFAULT: 10,
|
|
324
|
+
/** Maximum limit for task search and list operations */
|
|
325
|
+
TASKS_MAX: 100,
|
|
326
|
+
/** Largest page of tasks the API returns, for reading past tasks a tool filters out */
|
|
327
|
+
TASKS_PAGE_MAX: 200,
|
|
328
|
+
/** Default limit for completed tasks */
|
|
329
|
+
COMPLETED_TASKS_DEFAULT: 50,
|
|
330
|
+
/** Maximum limit for completed tasks */
|
|
331
|
+
COMPLETED_TASKS_MAX: 200,
|
|
332
|
+
/** Default limit for project listings */
|
|
333
|
+
PROJECTS_DEFAULT: 50,
|
|
334
|
+
/** Maximum limit for project listings */
|
|
335
|
+
PROJECTS_MAX: 200,
|
|
336
|
+
/** Maximum limit for section listings */
|
|
337
|
+
SECTIONS_MAX: 200,
|
|
338
|
+
/** Page size for reading a workspace's folders */
|
|
339
|
+
FOLDERS_MAX: 200,
|
|
340
|
+
/** Batch size for fetching all tasks in a project */
|
|
341
|
+
TASKS_BATCH_SIZE: 50,
|
|
342
|
+
/** Maximum number of direct children returned when children are requested alongside an object */
|
|
343
|
+
CHILDREN_MAX: 25,
|
|
344
|
+
/** Default limit for comment listings */
|
|
345
|
+
COMMENTS_DEFAULT: 10,
|
|
346
|
+
/** Maximum limit for comment search and list operations */
|
|
347
|
+
COMMENTS_MAX: 10,
|
|
348
|
+
/** Maximum number of users a single comment can notify */
|
|
349
|
+
NOTIFY_USERS_MAX: 25,
|
|
350
|
+
/** Default limit for activity log listings */
|
|
351
|
+
ACTIVITY_DEFAULT: 20,
|
|
352
|
+
/** Maximum limit for activity log search and list operations */
|
|
353
|
+
ACTIVITY_MAX: 100,
|
|
354
|
+
/** Default limit for label listings */
|
|
355
|
+
LABELS_DEFAULT: 50,
|
|
356
|
+
/** Maximum limit for label listings */
|
|
357
|
+
LABELS_MAX: 200,
|
|
358
|
+
/** Maximum values in one list-valued filter parameter, such as labels or project IDs */
|
|
359
|
+
FILTER_VALUES_MAX: 50
|
|
360
|
+
}, _e = {
|
|
361
|
+
/** Maximum number of failures to show in detailed error messages */
|
|
362
|
+
MAX_FAILURES_SHOWN: 3
|
|
363
|
+
}, zr = {
|
|
364
|
+
/** Maximum number of failed items named in one log line */
|
|
365
|
+
MAX_FAILURES_LOGGED: 5
|
|
366
|
+
}, D = {
|
|
367
|
+
/** Maximum tasks accepted by one task update operation */
|
|
368
|
+
TASKS_PER_OPERATION: 25,
|
|
369
|
+
/**
|
|
370
|
+
* Maximum tasks one add-tasks call creates. They go out as one Sync request,
|
|
371
|
+
* which takes at most 100 commands.
|
|
372
|
+
*/
|
|
373
|
+
TASK_CREATES_PER_OPERATION: 100,
|
|
374
|
+
/** Maximum projects, sections, comments, labels or filters created or updated by one call */
|
|
375
|
+
ITEMS_PER_OPERATION: 25,
|
|
376
|
+
/**
|
|
377
|
+
* Maximum existing objects one bulk action takes by ID, such as completing,
|
|
378
|
+
* rescheduling, reordering or assigning. A sync-backed reschedule sends one
|
|
379
|
+
* command per task, which keeps it under the Sync API's 100 commands per
|
|
380
|
+
* request. A reorder is not bounded that way: it can rekey every sibling of
|
|
381
|
+
* the objects it moves, so its command count depends on the sibling list.
|
|
382
|
+
*/
|
|
383
|
+
BULK_ACTIONS_PER_OPERATION: 50,
|
|
384
|
+
/** Maximum labels set on one task by one call */
|
|
385
|
+
LABELS_PER_TASK: 50
|
|
386
|
+
}, ht = {
|
|
387
|
+
/**
|
|
388
|
+
* In-flight task-move requests per account, per process.
|
|
389
|
+
*
|
|
390
|
+
* Kept at 1 because the API locks the whole task tree for a move, and a tree
|
|
391
|
+
* spans a task's source as well as its destination — two moves of sibling
|
|
392
|
+
* subtasks contend even when they target different projects, and the loser
|
|
393
|
+
* fails. Batching same-destination moves into a single request means
|
|
394
|
+
* serialising costs little in practice. One per process is the smallest
|
|
395
|
+
* contribution a process can make; see the note above for the global picture.
|
|
396
|
+
*/
|
|
397
|
+
TASK_MOVES: 1,
|
|
398
|
+
/** In-flight non-move write requests per account, per process. */
|
|
399
|
+
WRITES: 4,
|
|
400
|
+
/**
|
|
401
|
+
* How long a request may wait for a slot before it is abandoned unsent.
|
|
402
|
+
*
|
|
403
|
+
* Matches the SDK's own 30s request timeout, which only starts once a request
|
|
404
|
+
* actually goes out: a task that has already waited that long would be
|
|
405
|
+
* answering a caller who has given up. Comfortably above the worst realistic
|
|
406
|
+
* queue (serialised moves to 100 distinct destinations is roughly 15s).
|
|
407
|
+
*/
|
|
408
|
+
QUEUE_WAIT_MS: 3e4
|
|
480
409
|
};
|
|
481
|
-
function
|
|
410
|
+
function so(e, { queueTimeoutMs: t = ht.QUEUE_WAIT_MS } = {}) {
|
|
482
411
|
if (!Number.isInteger(e) || e < 1)
|
|
483
412
|
throw new Error(
|
|
484
413
|
`maxConcurrent must be a positive integer, received ${String(e)}`
|
|
@@ -522,75 +451,75 @@ function no(e, { queueTimeoutMs: t = ut.QUEUE_WAIT_MS } = {}) {
|
|
|
522
451
|
}
|
|
523
452
|
function Ot() {
|
|
524
453
|
return {
|
|
525
|
-
moves:
|
|
526
|
-
writes:
|
|
454
|
+
moves: so(ht.TASK_MOVES),
|
|
455
|
+
writes: so(ht.WRITES)
|
|
527
456
|
};
|
|
528
457
|
}
|
|
529
|
-
const
|
|
530
|
-
let
|
|
531
|
-
const
|
|
532
|
-
let
|
|
533
|
-
function
|
|
534
|
-
return
|
|
458
|
+
const qr = 1e4, Gr = 5 * 6e4, Z = /* @__PURE__ */ new Map();
|
|
459
|
+
let Yr = qr;
|
|
460
|
+
const is = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new Map();
|
|
461
|
+
let ro, no;
|
|
462
|
+
function Vr() {
|
|
463
|
+
return ro ??= Ot(), ro;
|
|
535
464
|
}
|
|
536
|
-
function
|
|
537
|
-
return
|
|
465
|
+
function ao() {
|
|
466
|
+
return no ??= Ot(), no;
|
|
538
467
|
}
|
|
539
|
-
function
|
|
468
|
+
function Jr(e) {
|
|
540
469
|
return zo("sha256").update(e).digest("hex");
|
|
541
470
|
}
|
|
542
|
-
function
|
|
471
|
+
function Xr({ moves: e, writes: t }) {
|
|
543
472
|
return e.isIdle() && t.isIdle();
|
|
544
473
|
}
|
|
545
|
-
function
|
|
546
|
-
return e.leases === 0 &&
|
|
474
|
+
function cs(e) {
|
|
475
|
+
return e.leases === 0 && Xr(e.limiters);
|
|
547
476
|
}
|
|
548
|
-
function
|
|
477
|
+
function Zr(e, t, o) {
|
|
549
478
|
Z.delete(e), t.lastUsedAt = o, Z.set(e, t);
|
|
550
479
|
}
|
|
551
|
-
function
|
|
480
|
+
function Qr(e) {
|
|
552
481
|
for (const [t, o] of Z) {
|
|
553
|
-
if (e - o.lastUsedAt <
|
|
482
|
+
if (e - o.lastUsedAt < Gr)
|
|
554
483
|
break;
|
|
555
|
-
|
|
484
|
+
cs(o) && Z.delete(t);
|
|
556
485
|
}
|
|
557
486
|
}
|
|
558
|
-
function
|
|
487
|
+
function en() {
|
|
559
488
|
for (const [e, t] of Z)
|
|
560
|
-
if (
|
|
489
|
+
if (cs(t))
|
|
561
490
|
return Z.delete(e), !0;
|
|
562
491
|
return !1;
|
|
563
492
|
}
|
|
564
|
-
function
|
|
493
|
+
function ds(e, t) {
|
|
565
494
|
if (le.has(e))
|
|
566
495
|
return;
|
|
567
496
|
const o = Z.get(e);
|
|
568
497
|
if (o)
|
|
569
|
-
return
|
|
570
|
-
if (
|
|
498
|
+
return Zr(e, o, t), o;
|
|
499
|
+
if (Qr(t), Z.size >= Yr && !en())
|
|
571
500
|
return;
|
|
572
501
|
const r = { limiters: Ot(), lastUsedAt: t, leases: 0 };
|
|
573
502
|
return Z.set(e, r), r;
|
|
574
503
|
}
|
|
575
|
-
function
|
|
504
|
+
function tn(e) {
|
|
576
505
|
const t = le.get(e);
|
|
577
506
|
if (t !== void 0)
|
|
578
507
|
return le.set(e, t + 1), {
|
|
579
|
-
limiters:
|
|
580
|
-
release: () =>
|
|
508
|
+
limiters: ao(),
|
|
509
|
+
release: () => io(e)
|
|
581
510
|
};
|
|
582
|
-
const o =
|
|
511
|
+
const o = ds(e, Date.now());
|
|
583
512
|
return o ? (o.leases++, {
|
|
584
513
|
limiters: o.limiters,
|
|
585
514
|
release: () => {
|
|
586
515
|
o.leases--;
|
|
587
516
|
}
|
|
588
517
|
}) : (le.set(e, 1), {
|
|
589
|
-
limiters:
|
|
590
|
-
release: () =>
|
|
518
|
+
limiters: ao(),
|
|
519
|
+
release: () => io(e)
|
|
591
520
|
});
|
|
592
521
|
}
|
|
593
|
-
function
|
|
522
|
+
function io(e) {
|
|
594
523
|
const t = le.get(e);
|
|
595
524
|
if (t === void 0 || t <= 1) {
|
|
596
525
|
le.delete(e);
|
|
@@ -598,51 +527,51 @@ function lo(e) {
|
|
|
598
527
|
}
|
|
599
528
|
le.set(e, t - 1);
|
|
600
529
|
}
|
|
601
|
-
function
|
|
602
|
-
const o =
|
|
603
|
-
|
|
530
|
+
function on(e, t) {
|
|
531
|
+
const o = Jr(t);
|
|
532
|
+
is.set(e, o);
|
|
604
533
|
}
|
|
605
|
-
function
|
|
606
|
-
const o =
|
|
607
|
-
return o ? (
|
|
608
|
-
const n =
|
|
534
|
+
function ls(e, t) {
|
|
535
|
+
const o = is.get(e);
|
|
536
|
+
return o ? (ds(o, Date.now()), async (r) => {
|
|
537
|
+
const n = tn(o);
|
|
609
538
|
try {
|
|
610
539
|
return await n.limiters[t](r);
|
|
611
540
|
} finally {
|
|
612
541
|
n.release();
|
|
613
542
|
}
|
|
614
|
-
}) :
|
|
543
|
+
}) : Vr()[t];
|
|
615
544
|
}
|
|
616
|
-
function
|
|
617
|
-
return
|
|
545
|
+
function sn(e) {
|
|
546
|
+
return ls(e, "moves");
|
|
618
547
|
}
|
|
619
548
|
function _t(e) {
|
|
620
|
-
return
|
|
549
|
+
return ls(e, "writes");
|
|
621
550
|
}
|
|
622
|
-
const
|
|
551
|
+
const rn = "todoist-mcp", Pt = Br.version, us = new wr(), co = Tr(import.meta.url);
|
|
623
552
|
let He;
|
|
624
|
-
const
|
|
625
|
-
const e =
|
|
626
|
-
return
|
|
553
|
+
const nn = async () => {
|
|
554
|
+
const e = co.resolve("@todoist/sdk"), t = ct(qo(e), "transport", "http-dispatcher.js");
|
|
555
|
+
return co(t);
|
|
627
556
|
};
|
|
628
|
-
let
|
|
629
|
-
function
|
|
630
|
-
return `${
|
|
557
|
+
let an = nn;
|
|
558
|
+
function cn() {
|
|
559
|
+
return `${rn}/${Pt}`;
|
|
631
560
|
}
|
|
632
|
-
function
|
|
561
|
+
function ps(e) {
|
|
633
562
|
return e.trim().toLowerCase();
|
|
634
563
|
}
|
|
635
|
-
function
|
|
636
|
-
return
|
|
564
|
+
function dn(e, t) {
|
|
565
|
+
return us.run(ps(e), t);
|
|
637
566
|
}
|
|
638
|
-
function
|
|
567
|
+
function ln({
|
|
639
568
|
label: e,
|
|
640
569
|
platform: t = "mcp",
|
|
641
570
|
sessionId: o = Ce()
|
|
642
571
|
} = {}) {
|
|
643
|
-
const r = e ?
|
|
572
|
+
const r = e ? ps(e) : us.getStore();
|
|
644
573
|
return {
|
|
645
|
-
"User-Agent":
|
|
574
|
+
"User-Agent": cn(),
|
|
646
575
|
"doist-platform": t,
|
|
647
576
|
"doist-version": Pt,
|
|
648
577
|
"request-id": Ce(),
|
|
@@ -650,16 +579,16 @@ function wn({
|
|
|
650
579
|
"mcp-tool": r ?? "unknown"
|
|
651
580
|
};
|
|
652
581
|
}
|
|
653
|
-
function
|
|
582
|
+
function un(e, t) {
|
|
654
583
|
const o = new Headers(e);
|
|
655
|
-
for (const [r, n] of Object.entries(
|
|
584
|
+
for (const [r, n] of Object.entries(ln(t)))
|
|
656
585
|
o.set(r, n);
|
|
657
586
|
return Object.fromEntries(o.entries());
|
|
658
587
|
}
|
|
659
|
-
function
|
|
588
|
+
function lo() {
|
|
660
589
|
return new DOMException("The operation was aborted due to timeout", "TimeoutError");
|
|
661
590
|
}
|
|
662
|
-
function
|
|
591
|
+
function pn(e, t) {
|
|
663
592
|
if (!e && t === void 0)
|
|
664
593
|
return {
|
|
665
594
|
signal: void 0,
|
|
@@ -667,7 +596,7 @@ function kn(e, t) {
|
|
|
667
596
|
}
|
|
668
597
|
};
|
|
669
598
|
if (!e && t !== void 0) {
|
|
670
|
-
const i = new AbortController(), c = setTimeout(() => i.abort(
|
|
599
|
+
const i = new AbortController(), c = setTimeout(() => i.abort(lo()), t);
|
|
671
600
|
return {
|
|
672
601
|
signal: i.signal,
|
|
673
602
|
cleanup: () => clearTimeout(c)
|
|
@@ -688,7 +617,7 @@ function kn(e, t) {
|
|
|
688
617
|
const i = () => n(e.reason);
|
|
689
618
|
e.addEventListener("abort", i, { once: !0 }), r.push(() => e.removeEventListener("abort", i));
|
|
690
619
|
}
|
|
691
|
-
const a = setTimeout(() => n(
|
|
620
|
+
const a = setTimeout(() => n(lo()), t);
|
|
692
621
|
return r.push(() => clearTimeout(a)), {
|
|
693
622
|
signal: o.signal,
|
|
694
623
|
cleanup: () => {
|
|
@@ -697,26 +626,26 @@ function kn(e, t) {
|
|
|
697
626
|
}
|
|
698
627
|
};
|
|
699
628
|
}
|
|
700
|
-
async function
|
|
701
|
-
if (
|
|
702
|
-
return He || (He =
|
|
629
|
+
async function hn() {
|
|
630
|
+
if (mn())
|
|
631
|
+
return He || (He = an().then((e) => e.getDefaultTransport()).catch((e) => {
|
|
703
632
|
throw He = void 0, e;
|
|
704
633
|
})), He;
|
|
705
634
|
}
|
|
706
|
-
function
|
|
635
|
+
function mn() {
|
|
707
636
|
return typeof process < "u" && !!process.versions?.node;
|
|
708
637
|
}
|
|
709
|
-
async function
|
|
638
|
+
async function hs(e, t) {
|
|
710
639
|
if ("dispatcher" in t)
|
|
711
640
|
return e;
|
|
712
|
-
const o = await
|
|
641
|
+
const o = await hn();
|
|
713
642
|
return o ? (t.dispatcher = o.dispatcher, o.fetch ?? e) : e;
|
|
714
643
|
}
|
|
715
644
|
async function yh(e, t) {
|
|
716
645
|
const o = { ...t };
|
|
717
|
-
return (await
|
|
646
|
+
return (await hs(globalThis.fetch, o))(e, o);
|
|
718
647
|
}
|
|
719
|
-
function
|
|
648
|
+
function fn(e) {
|
|
720
649
|
return {
|
|
721
650
|
ok: e.ok,
|
|
722
651
|
status: e.status,
|
|
@@ -727,33 +656,33 @@ function Sn(e) {
|
|
|
727
656
|
arrayBuffer: () => e.arrayBuffer()
|
|
728
657
|
};
|
|
729
658
|
}
|
|
730
|
-
function
|
|
659
|
+
function bn(e = globalThis.fetch, t = {}) {
|
|
731
660
|
const o = e === globalThis.fetch, { enabled: r = !0, platform: n = "mcp", sessionId: a = Ce() } = t;
|
|
732
661
|
return async (i, c = {}) => {
|
|
733
|
-
const { timeout: d, headers: u, signal: l, ...p } = c, { signal: f, cleanup: h } =
|
|
662
|
+
const { timeout: d, headers: u, signal: l, ...p } = c, { signal: f, cleanup: h } = pn(l, d);
|
|
734
663
|
try {
|
|
735
664
|
const m = {
|
|
736
665
|
...p,
|
|
737
666
|
signal: f,
|
|
738
|
-
...r ? { headers:
|
|
739
|
-
}, g = await (o ? await
|
|
740
|
-
return
|
|
667
|
+
...r ? { headers: un(u, { platform: n, sessionId: a }) } : u !== void 0 ? { headers: u } : {}
|
|
668
|
+
}, g = await (o ? await hs(e, m) : e)(i, m);
|
|
669
|
+
return fn(g);
|
|
741
670
|
} finally {
|
|
742
671
|
h();
|
|
743
672
|
}
|
|
744
673
|
};
|
|
745
674
|
}
|
|
746
|
-
function
|
|
675
|
+
function gn(e, {
|
|
747
676
|
baseUrl: t,
|
|
748
677
|
tracking: o
|
|
749
678
|
} = {}) {
|
|
750
679
|
const r = new kr(e, {
|
|
751
|
-
customFetch:
|
|
680
|
+
customFetch: bn(globalThis.fetch, o),
|
|
752
681
|
...t ? { baseUrl: t } : {}
|
|
753
682
|
});
|
|
754
|
-
return
|
|
683
|
+
return on(r, e), r;
|
|
755
684
|
}
|
|
756
|
-
const
|
|
685
|
+
const yn = 2, wn = 500, Tn = 2e3, kn = 50, In = /* @__PURE__ */ new Set([502, 503, 504]), vn = /* @__PURE__ */ new Set([503]);
|
|
757
686
|
function qe(e) {
|
|
758
687
|
if (e == null || typeof e != "object")
|
|
759
688
|
return;
|
|
@@ -770,32 +699,32 @@ function qe(e) {
|
|
|
770
699
|
return Number(o[1]);
|
|
771
700
|
}
|
|
772
701
|
}
|
|
773
|
-
function
|
|
702
|
+
function Sn(e, t = In) {
|
|
774
703
|
const o = qe(e);
|
|
775
704
|
return o !== void 0 && t.has(o);
|
|
776
705
|
}
|
|
777
|
-
function
|
|
706
|
+
function Cn({
|
|
778
707
|
attempt: e,
|
|
779
708
|
baseDelayMs: t,
|
|
780
709
|
maxDelayMs: o,
|
|
781
710
|
random: r = Math.random
|
|
782
711
|
}) {
|
|
783
712
|
const n = Math.min(t * 2 ** e, o), a = Math.round(r() * n);
|
|
784
|
-
return Math.min(n, Math.max(
|
|
713
|
+
return Math.min(n, Math.max(kn, a));
|
|
785
714
|
}
|
|
786
|
-
function
|
|
715
|
+
function jn(e) {
|
|
787
716
|
return new Promise((t) => setTimeout(t, e));
|
|
788
717
|
}
|
|
789
718
|
async function j(e, t = {}) {
|
|
790
|
-
const o = t.maxRetries ??
|
|
719
|
+
const o = t.maxRetries ?? yn, r = t.baseDelayMs ?? wn, n = t.maxDelayMs ?? Tn, a = t.random;
|
|
791
720
|
let i;
|
|
792
721
|
for (let c = 0; c <= o; c++)
|
|
793
722
|
try {
|
|
794
723
|
return await e();
|
|
795
724
|
} catch (d) {
|
|
796
|
-
if (i = d, c < o &&
|
|
797
|
-
const u =
|
|
798
|
-
await
|
|
725
|
+
if (i = d, c < o && Sn(d, t.retryableStatusCodes)) {
|
|
726
|
+
const u = Cn({ attempt: c, baseDelayMs: r, maxDelayMs: n, random: a });
|
|
727
|
+
await jn(u);
|
|
799
728
|
continue;
|
|
800
729
|
}
|
|
801
730
|
throw d;
|
|
@@ -803,7 +732,7 @@ async function j(e, t = {}) {
|
|
|
803
732
|
throw i;
|
|
804
733
|
}
|
|
805
734
|
async function se(e, t = {}) {
|
|
806
|
-
return j(e, { ...t, retryableStatusCodes:
|
|
735
|
+
return j(e, { ...t, retryableStatusCodes: vn });
|
|
807
736
|
}
|
|
808
737
|
const y = {
|
|
809
738
|
// Task management tools
|
|
@@ -880,39 +809,39 @@ const y = {
|
|
|
880
809
|
* Affects: find-project-collaborators, find-completed-tasks
|
|
881
810
|
*/
|
|
882
811
|
STRIP_EMAILS: "strip_emails"
|
|
883
|
-
},
|
|
884
|
-
function
|
|
812
|
+
}, $n = process.env.USE_STRUCTURED_CONTENT === "true" || process.env.NODE_ENV === "test", En = /* @__PURE__ */ new Set(["file"]);
|
|
813
|
+
function An(e) {
|
|
885
814
|
return !e || typeof e != "object" || Array.isArray(e) ? e : Object.fromEntries(
|
|
886
815
|
Object.entries(e).map(
|
|
887
|
-
([t, o]) =>
|
|
816
|
+
([t, o]) => En.has(t) && o !== void 0 ? [t, "[redacted]"] : [t, o]
|
|
888
817
|
)
|
|
889
818
|
);
|
|
890
819
|
}
|
|
891
|
-
const
|
|
820
|
+
const Dn = [
|
|
892
821
|
y.FIND_PROJECT_COLLABORATORS,
|
|
893
822
|
y.FIND_COMPLETED_TASKS
|
|
894
823
|
];
|
|
895
|
-
function
|
|
824
|
+
function mt(e) {
|
|
896
825
|
if (e == null)
|
|
897
826
|
return e;
|
|
898
827
|
if (Array.isArray(e))
|
|
899
|
-
return e.map((t) =>
|
|
828
|
+
return e.map((t) => mt(t));
|
|
900
829
|
if (typeof e == "object") {
|
|
901
830
|
const t = {};
|
|
902
831
|
for (const [o, r] of Object.entries(e))
|
|
903
|
-
o !== "email" && (t[o] =
|
|
832
|
+
o !== "email" && (t[o] = mt(r));
|
|
904
833
|
return t;
|
|
905
834
|
}
|
|
906
835
|
return e;
|
|
907
836
|
}
|
|
908
|
-
function
|
|
837
|
+
function xn(e) {
|
|
909
838
|
const t = /\s*\([^)]*@[^)]+\)/g, o = /\S+@\S+\.\S+/g;
|
|
910
839
|
return e.replace(t, "").replace(o, "[email hidden]");
|
|
911
840
|
}
|
|
912
|
-
function
|
|
913
|
-
return
|
|
841
|
+
function On(e) {
|
|
842
|
+
return Dn.includes(e);
|
|
914
843
|
}
|
|
915
|
-
function
|
|
844
|
+
function _n({
|
|
916
845
|
tools: e,
|
|
917
846
|
server: t,
|
|
918
847
|
client: o,
|
|
@@ -921,23 +850,94 @@ function Wn({
|
|
|
921
850
|
const n = r.some((i) => i.name === "strip_emails"), a = gr({
|
|
922
851
|
titlePrefix: "Todoist",
|
|
923
852
|
createContext: () => o,
|
|
924
|
-
formatError:
|
|
925
|
-
structuredContentAsText:
|
|
853
|
+
formatError: Hr,
|
|
854
|
+
structuredContentAsText: !$n,
|
|
926
855
|
wrapExecute: async (i, c) => {
|
|
927
|
-
const d = await
|
|
928
|
-
return !n || !
|
|
856
|
+
const d = await dn(i.name, () => j(c));
|
|
857
|
+
return !n || !On(i.name) ? d : {
|
|
929
858
|
...d,
|
|
930
|
-
textContent: d.textContent &&
|
|
931
|
-
structuredContent: d.structuredContent &&
|
|
859
|
+
textContent: d.textContent && xn(d.textContent),
|
|
860
|
+
structuredContent: d.structuredContent && mt(d.structuredContent)
|
|
932
861
|
};
|
|
933
862
|
},
|
|
934
863
|
onError: ({ tool: i, args: c, error: d }) => {
|
|
935
|
-
console.error(`Error executing tool ${i.name}:`, { args:
|
|
864
|
+
console.error(`Error executing tool ${i.name}:`, { args: An(c), error: d });
|
|
936
865
|
}
|
|
937
866
|
});
|
|
938
867
|
for (const i of e)
|
|
939
868
|
a(t, i);
|
|
940
869
|
}
|
|
870
|
+
const uo = qo(br(import.meta.url)), Pn = [
|
|
871
|
+
ct(uo, "task-list", "index.html"),
|
|
872
|
+
ct(uo, "mcp-apps", "index.html")
|
|
873
|
+
], Rn = `<!doctype html>
|
|
874
|
+
<html>
|
|
875
|
+
<body>
|
|
876
|
+
<p>Task list app is missing. Run "npm run build" to generate it.</p>
|
|
877
|
+
</body>
|
|
878
|
+
</html>`;
|
|
879
|
+
function Un() {
|
|
880
|
+
const e = [];
|
|
881
|
+
for (const t of Pn)
|
|
882
|
+
try {
|
|
883
|
+
return fr(t, "utf-8");
|
|
884
|
+
} catch (o) {
|
|
885
|
+
e.push(o);
|
|
886
|
+
}
|
|
887
|
+
return console.error("Failed to load task list app HTML from any known path:", e), Rn;
|
|
888
|
+
}
|
|
889
|
+
const ms = Un(), Nn = zo("sha256").update(ms).digest("hex").slice(0, 12), ft = `ui://todoist/task-list@${Nn}`, Ln = "ui://todoist/task-list@{hash}", bt = "Interactive task list widget", Mn = "https://ai.todoist.net", gt = {
|
|
890
|
+
ui: {
|
|
891
|
+
prefersBorder: !0,
|
|
892
|
+
csp: {
|
|
893
|
+
// The widget is bundled into one HTML file and does not fetch or load external assets.
|
|
894
|
+
connectDomains: [],
|
|
895
|
+
resourceDomains: []
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
"openai/widgetDescription": bt,
|
|
899
|
+
"openai/widgetPrefersBorder": !0,
|
|
900
|
+
"openai/widgetCSP": {
|
|
901
|
+
connect_domains: [],
|
|
902
|
+
resource_domains: []
|
|
903
|
+
},
|
|
904
|
+
"openai/widgetDomain": Mn
|
|
905
|
+
}, Fn = { ttlMs: Kr, cacheScope: "public" }, Hn = { ttlMs: xt, cacheScope: "private" };
|
|
906
|
+
function po(e) {
|
|
907
|
+
return {
|
|
908
|
+
contents: [
|
|
909
|
+
{
|
|
910
|
+
uri: e,
|
|
911
|
+
mimeType: dt,
|
|
912
|
+
text: ms,
|
|
913
|
+
_meta: gt
|
|
914
|
+
}
|
|
915
|
+
]
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
function Wn(e) {
|
|
919
|
+
e.registerResource(
|
|
920
|
+
"todoist-task-list",
|
|
921
|
+
ft,
|
|
922
|
+
{
|
|
923
|
+
description: bt,
|
|
924
|
+
mimeType: dt,
|
|
925
|
+
_meta: gt,
|
|
926
|
+
cacheHint: Fn
|
|
927
|
+
},
|
|
928
|
+
async () => po(ft)
|
|
929
|
+
), e.registerResource(
|
|
930
|
+
"todoist-task-list-hash-fallback",
|
|
931
|
+
new hr(Ln, { list: void 0 }),
|
|
932
|
+
{
|
|
933
|
+
description: `${bt} compatibility fallback`,
|
|
934
|
+
mimeType: dt,
|
|
935
|
+
_meta: gt,
|
|
936
|
+
cacheHint: Hn
|
|
937
|
+
},
|
|
938
|
+
async (t) => po(t.toString())
|
|
939
|
+
);
|
|
940
|
+
}
|
|
941
941
|
const Bn = s.object({
|
|
942
942
|
period: s.enum(["today", "7d", "14d", "30d", "this-week", "this-month"]).default("7d").describe(
|
|
943
943
|
'Time period for the analysis. "today" analyzes the current day, "7d"/"14d"/"30d" analyze the last N days, "this-week" and "this-month" analyze the current week or month.'
|
|
@@ -1763,7 +1763,7 @@ function P(e, t, o) {
|
|
|
1763
1763
|
r.push({ item: i, index: c, value: d.value });
|
|
1764
1764
|
return;
|
|
1765
1765
|
}
|
|
1766
|
-
const { summary: u, hint: l } =
|
|
1766
|
+
const { summary: u, hint: l } = as(d?.reason);
|
|
1767
1767
|
let p = u;
|
|
1768
1768
|
l && (p = a.has(l.tag) ? `${u}. Same cause and fix as the first ${l.tag} failure in this list.` : `${u}. ${l.text}`, a.add(l.tag)), n.push({ item: o(i, c), error: p });
|
|
1769
1769
|
}), { succeeded: r, failures: n };
|
|
@@ -1772,7 +1772,7 @@ const go = "[redacted]", ma = /"[^"]*"/g;
|
|
|
1772
1772
|
function O(e, t, o, r = {}) {
|
|
1773
1773
|
if (o.length === 0)
|
|
1774
1774
|
return;
|
|
1775
|
-
const n = o.slice(0,
|
|
1775
|
+
const n = o.slice(0, zr.MAX_FAILURES_LOGGED);
|
|
1776
1776
|
console.error(`${e}: items failed`, {
|
|
1777
1777
|
failed: o.length,
|
|
1778
1778
|
of: t,
|
|
@@ -3408,12 +3408,12 @@ async function Ri(e, t) {
|
|
|
3408
3408
|
return o;
|
|
3409
3409
|
}
|
|
3410
3410
|
function Ui(e, t) {
|
|
3411
|
-
const o =
|
|
3411
|
+
const o = Fr(e, {
|
|
3412
3412
|
taskContent: t.content,
|
|
3413
3413
|
dueString: t.dueString,
|
|
3414
3414
|
deadlineDate: t.deadlineDate
|
|
3415
3415
|
});
|
|
3416
|
-
return o ? new
|
|
3416
|
+
return o ? new Dt(o) : e;
|
|
3417
3417
|
}
|
|
3418
3418
|
const ko = "* ";
|
|
3419
3419
|
function Ni(e) {
|
|
@@ -8206,7 +8206,7 @@ async function jp({
|
|
|
8206
8206
|
const d = mp(c.move), u = n.get(d);
|
|
8207
8207
|
u ? u.push(c) : n.set(d, [c]);
|
|
8208
8208
|
}
|
|
8209
|
-
const a =
|
|
8209
|
+
const a = sn(e), i = [];
|
|
8210
8210
|
for (const c of n.values()) {
|
|
8211
8211
|
const d = [...new Set(c.map(({ item: p }) => p.id))], u = c[0]?.move, l = c.length === 1 ? c[0] : void 0;
|
|
8212
8212
|
try {
|
|
@@ -8600,7 +8600,7 @@ const Xp = /^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl
|
|
|
8600
8600
|
...Td,
|
|
8601
8601
|
_meta: {
|
|
8602
8602
|
ui: {
|
|
8603
|
-
resourceUri:
|
|
8603
|
+
resourceUri: ft
|
|
8604
8604
|
}
|
|
8605
8605
|
}
|
|
8606
8606
|
}, th = {
|
|
@@ -8729,7 +8729,7 @@ What each tool does and how to fill its parameters is in the tool's own descript
|
|
|
8729
8729
|
For a productivity review, call **get-productivity-stats**, then find what the user completed as described under "Finding things".
|
|
8730
8730
|
|
|
8731
8731
|
Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
|
|
8732
|
-
`, De = { ttlMs:
|
|
8732
|
+
`, De = { ttlMs: xt, cacheScope: "private" };
|
|
8733
8733
|
function Th({
|
|
8734
8734
|
token: e,
|
|
8735
8735
|
baseUrl: t,
|
|
@@ -8751,8 +8751,8 @@ function Th({
|
|
|
8751
8751
|
"resources/templates/list": De
|
|
8752
8752
|
}
|
|
8753
8753
|
}
|
|
8754
|
-
), n =
|
|
8755
|
-
return
|
|
8754
|
+
), n = gn(e, { baseUrl: t });
|
|
8755
|
+
return Wn(r), _n({ tools: oh, server: r, client: n, features: o }), r.registerPrompt(
|
|
8756
8756
|
Ae.name,
|
|
8757
8757
|
{
|
|
8758
8758
|
title: Ae.title,
|
|
@@ -8764,8 +8764,8 @@ function Th({
|
|
|
8764
8764
|
}
|
|
8765
8765
|
export {
|
|
8766
8766
|
Ip as $,
|
|
8767
|
-
|
|
8768
|
-
|
|
8767
|
+
Td as A,
|
|
8768
|
+
Th as B,
|
|
8769
8769
|
Kd as C,
|
|
8770
8770
|
Gd as D,
|
|
8771
8771
|
Zd as E,
|
|
@@ -8795,30 +8795,30 @@ export {
|
|
|
8795
8795
|
Bp as a0,
|
|
8796
8796
|
Qp as a1,
|
|
8797
8797
|
yh as a2,
|
|
8798
|
-
|
|
8798
|
+
ln as a3,
|
|
8799
8799
|
Wa as b,
|
|
8800
8800
|
Za as c,
|
|
8801
8801
|
si as d,
|
|
8802
8802
|
di as e,
|
|
8803
8803
|
ki as f,
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8804
|
+
ji as g,
|
|
8805
|
+
xi as h,
|
|
8806
|
+
Hi as i,
|
|
8807
|
+
Ki as j,
|
|
8808
|
+
Xi as k,
|
|
8809
|
+
ec as l,
|
|
8810
|
+
pc as m,
|
|
8811
|
+
dc as n,
|
|
8812
|
+
bc as o,
|
|
8813
|
+
vc as p,
|
|
8814
|
+
Pc as q,
|
|
8815
|
+
Na as r,
|
|
8816
|
+
Wc as s,
|
|
8817
8817
|
th as t,
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8818
|
+
Gc as u,
|
|
8819
|
+
Xc as v,
|
|
8820
|
+
rd as w,
|
|
8821
|
+
ld as x,
|
|
8822
|
+
fd as y,
|
|
8823
|
+
xd as z
|
|
8824
8824
|
};
|