@todoist/mcp 17.3.4 → 17.3.5
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-server-BVhK5N9T.js → mcp-server-ClrzOBwq.js} +839 -837
- package/dist/{require-valid-todoist-token-CvLBOq5Z.js → require-valid-todoist-token-C1RhvIDW.js} +1 -1
- package/dist/tools/find-tasks.d.ts.map +1 -1
- package/dist/utils/labels.d.ts +6 -0
- package/dist/utils/labels.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ResourceTemplate as
|
|
2
|
-
import { createHash as No, randomUUID as
|
|
3
|
-
import { readFileSync as
|
|
4
|
-
import { dirname as Lo, join as
|
|
5
|
-
import { fileURLToPath as
|
|
6
|
-
import { RESOURCE_MIME_TYPE as
|
|
7
|
-
import { createToolRegistrar as
|
|
8
|
-
import
|
|
9
|
-
import { AsyncLocalStorage as
|
|
10
|
-
import { createRequire as
|
|
11
|
-
import { TodoistApi as
|
|
12
|
-
import { addDays as zo, formatISO as
|
|
1
|
+
import { ResourceTemplate as tr, McpServer as or } from "@modelcontextprotocol/server";
|
|
2
|
+
import { createHash as No, randomUUID as ve } from "node:crypto";
|
|
3
|
+
import { readFileSync as sr } from "node:fs";
|
|
4
|
+
import { dirname as Lo, join as ot } from "node:path";
|
|
5
|
+
import { fileURLToPath as rr } from "node:url";
|
|
6
|
+
import { RESOURCE_MIME_TYPE as st } from "@modelcontextprotocol/ext-apps/server";
|
|
7
|
+
import { createToolRegistrar as nr } from "@todoist/mcp-core";
|
|
8
|
+
import fe, { ZodError as ar, z as s } from "zod";
|
|
9
|
+
import { AsyncLocalStorage as ir } from "node:async_hooks";
|
|
10
|
+
import { createRequire as cr } from "node:module";
|
|
11
|
+
import { TodoistApi as dr, formatUserShortName as Mo, isWorkspaceProject as F, isPersonalProject as Z, colors as rt, LOCATION_TRIGGERS as Fo, REMINDER_TYPES as lr, TodoistSyncError as ur, TodoistRequestError as pr, createCommand as Y, PROJECT_ICONS as Ho, PROJECT_VIEW_STYLES as Wo, REMINDER_DELIVERY_SERVICES as hr, HEALTH_STATUSES as wt, getTaskUrl as Bo, getProjectUrl as Ko, ACTIVITY_EVENT_TYPES as mr, ACTIVITY_OBJECT_TYPES as qo, escapeFilterToken as Tt, parseTodoistUrl as fr, WORKSPACE_ROLES as br, WORKSPACE_PLANS as gr } from "@todoist/sdk";
|
|
12
|
+
import { addDays as zo, formatISO as yr } from "date-fns";
|
|
13
13
|
import { generateNKeysBetween as Yo } from "fractional-indexing";
|
|
14
|
-
const
|
|
14
|
+
const kt = 3600 * 1e3, wr = 365 * 24 * kt, E = {
|
|
15
15
|
/** Default limit for task listings */
|
|
16
16
|
TASKS_DEFAULT: 10,
|
|
17
17
|
/** Maximum limit for task search and list operations */
|
|
@@ -48,10 +48,10 @@ const It = 3600 * 1e3, Tr = 365 * 24 * It, E = {
|
|
|
48
48
|
LABELS_MAX: 200,
|
|
49
49
|
/** Maximum values in one list-valued filter parameter, such as labels or project IDs */
|
|
50
50
|
FILTER_VALUES_MAX: 50
|
|
51
|
-
},
|
|
51
|
+
}, xe = {
|
|
52
52
|
/** Maximum number of failures to show in detailed error messages */
|
|
53
53
|
MAX_FAILURES_SHOWN: 3
|
|
54
|
-
},
|
|
54
|
+
}, Tr = {
|
|
55
55
|
/** Maximum number of failed items named in one log line */
|
|
56
56
|
MAX_FAILURES_LOGGED: 5
|
|
57
57
|
}, D = {
|
|
@@ -74,7 +74,7 @@ const It = 3600 * 1e3, Tr = 365 * 24 * It, E = {
|
|
|
74
74
|
BULK_ACTIONS_PER_OPERATION: 50,
|
|
75
75
|
/** Maximum labels set on one task by one call */
|
|
76
76
|
LABELS_PER_TASK: 50
|
|
77
|
-
},
|
|
77
|
+
}, nt = {
|
|
78
78
|
/**
|
|
79
79
|
* In-flight task-move requests per account, per process.
|
|
80
80
|
*
|
|
@@ -97,26 +97,26 @@ const It = 3600 * 1e3, Tr = 365 * 24 * It, E = {
|
|
|
97
97
|
* queue (serialised moves to 100 distinct destinations is roughly 15s).
|
|
98
98
|
*/
|
|
99
99
|
QUEUE_WAIT_MS: 3e4
|
|
100
|
-
}, Jt = Lo(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
],
|
|
100
|
+
}, Jt = Lo(rr(import.meta.url)), kr = [
|
|
101
|
+
ot(Jt, "task-list", "index.html"),
|
|
102
|
+
ot(Jt, "mcp-apps", "index.html")
|
|
103
|
+
], Ir = `<!doctype html>
|
|
104
104
|
<html>
|
|
105
105
|
<body>
|
|
106
106
|
<p>Task list app is missing. Run "npm run build" to generate it.</p>
|
|
107
107
|
</body>
|
|
108
108
|
</html>`;
|
|
109
|
-
function
|
|
109
|
+
function vr() {
|
|
110
110
|
const e = [];
|
|
111
|
-
for (const t of
|
|
111
|
+
for (const t of kr)
|
|
112
112
|
try {
|
|
113
|
-
return
|
|
113
|
+
return sr(t, "utf-8");
|
|
114
114
|
} catch (o) {
|
|
115
115
|
e.push(o);
|
|
116
116
|
}
|
|
117
|
-
return console.error("Failed to load task list app HTML from any known path:", e),
|
|
117
|
+
return console.error("Failed to load task list app HTML from any known path:", e), Ir;
|
|
118
118
|
}
|
|
119
|
-
const Go =
|
|
119
|
+
const Go = vr(), Sr = No("sha256").update(Go).digest("hex").slice(0, 12), at = `ui://todoist/task-list@${Sr}`, Cr = "ui://todoist/task-list@{hash}", it = "Interactive task list widget", jr = "https://ai.todoist.net", ct = {
|
|
120
120
|
ui: {
|
|
121
121
|
prefersBorder: !0,
|
|
122
122
|
csp: {
|
|
@@ -125,45 +125,45 @@ const Go = Sr(), Cr = No("sha256").update(Go).digest("hex").slice(0, 12), it = `
|
|
|
125
125
|
resourceDomains: []
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
|
-
"openai/widgetDescription":
|
|
128
|
+
"openai/widgetDescription": it,
|
|
129
129
|
"openai/widgetPrefersBorder": !0,
|
|
130
130
|
"openai/widgetCSP": {
|
|
131
131
|
connect_domains: [],
|
|
132
132
|
resource_domains: []
|
|
133
133
|
},
|
|
134
|
-
"openai/widgetDomain":
|
|
135
|
-
},
|
|
134
|
+
"openai/widgetDomain": jr
|
|
135
|
+
}, $r = { ttlMs: wr, cacheScope: "public" }, Er = { ttlMs: kt, cacheScope: "private" };
|
|
136
136
|
function Xt(e) {
|
|
137
137
|
return {
|
|
138
138
|
contents: [
|
|
139
139
|
{
|
|
140
140
|
uri: e,
|
|
141
|
-
mimeType:
|
|
141
|
+
mimeType: st,
|
|
142
142
|
text: Go,
|
|
143
|
-
_meta:
|
|
143
|
+
_meta: ct
|
|
144
144
|
}
|
|
145
145
|
]
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function Ar(e) {
|
|
149
149
|
e.registerResource(
|
|
150
150
|
"todoist-task-list",
|
|
151
|
-
|
|
151
|
+
at,
|
|
152
152
|
{
|
|
153
|
-
description:
|
|
154
|
-
mimeType:
|
|
155
|
-
_meta:
|
|
156
|
-
cacheHint:
|
|
153
|
+
description: it,
|
|
154
|
+
mimeType: st,
|
|
155
|
+
_meta: ct,
|
|
156
|
+
cacheHint: $r
|
|
157
157
|
},
|
|
158
|
-
async () => Xt(
|
|
158
|
+
async () => Xt(at)
|
|
159
159
|
), e.registerResource(
|
|
160
160
|
"todoist-task-list-hash-fallback",
|
|
161
|
-
new
|
|
161
|
+
new tr(Cr, { list: void 0 }),
|
|
162
162
|
{
|
|
163
|
-
description: `${
|
|
164
|
-
mimeType:
|
|
165
|
-
_meta:
|
|
166
|
-
cacheHint:
|
|
163
|
+
description: `${it} compatibility fallback`,
|
|
164
|
+
mimeType: st,
|
|
165
|
+
_meta: ct,
|
|
166
|
+
cacheHint: Er
|
|
167
167
|
},
|
|
168
168
|
async (t) => Xt(t.toString())
|
|
169
169
|
);
|
|
@@ -171,7 +171,7 @@ function Dr(e) {
|
|
|
171
171
|
function ue(e) {
|
|
172
172
|
return typeof e == "object" && e !== null;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function dt(...e) {
|
|
175
175
|
return e.find(ue);
|
|
176
176
|
}
|
|
177
177
|
function J(...e) {
|
|
@@ -191,25 +191,25 @@ function C(e) {
|
|
|
191
191
|
if (typeof e == "number" || typeof e == "boolean")
|
|
192
192
|
return String(e);
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function be(e) {
|
|
195
195
|
const t = W(e);
|
|
196
196
|
return t !== void 0 ? t : C(e);
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function Dr(e) {
|
|
199
199
|
return e.replace(/\b(Bearer)\s+[A-Za-z0-9._~+/=-]+/gi, "$1 [REDACTED]").replace(
|
|
200
200
|
/\b(token|api[_-]?key|authorization)\s*[:=]\s*["']?[A-Za-z0-9._~+/=-]{6,}["']?/gi,
|
|
201
201
|
"$1: [REDACTED]"
|
|
202
202
|
).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]");
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
const o =
|
|
204
|
+
function z(e, t = 220) {
|
|
205
|
+
const o = Dr(e).replace(/\s+/g, " ").trim();
|
|
206
206
|
return o.length <= t ? o : `${o.slice(0, t - 3)}...`;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function lt(e) {
|
|
209
209
|
const t = e.trim();
|
|
210
210
|
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);
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function Ve(e) {
|
|
213
213
|
if (!e)
|
|
214
214
|
return;
|
|
215
215
|
const t = e.match(/\b(?:HTTP|status code)\s*[:#-]?\s*(\d{3})\b/i);
|
|
@@ -219,10 +219,10 @@ function Je(e) {
|
|
|
219
219
|
function ce(e) {
|
|
220
220
|
const t = C(e);
|
|
221
221
|
if (t)
|
|
222
|
-
return
|
|
222
|
+
return z(t);
|
|
223
223
|
if (Array.isArray(e)) {
|
|
224
224
|
const n = e.map((a) => ue(a) ? C(a.message) || C(a.error) : C(a)).filter((a) => !!a);
|
|
225
|
-
return n.length > 0 ?
|
|
225
|
+
return n.length > 0 ? z(n.slice(0, 2).join("; ")) : void 0;
|
|
226
226
|
}
|
|
227
227
|
if (!ue(e))
|
|
228
228
|
return;
|
|
@@ -234,20 +234,20 @@ function ce(e) {
|
|
|
234
234
|
C(e.description)
|
|
235
235
|
);
|
|
236
236
|
if (o)
|
|
237
|
-
return
|
|
237
|
+
return z(o);
|
|
238
238
|
const r = [];
|
|
239
239
|
for (const [n, a] of Object.entries(e)) {
|
|
240
240
|
const i = C(a);
|
|
241
241
|
if (i && (r.push(`${n}: ${i}`), r.length >= 2))
|
|
242
242
|
break;
|
|
243
243
|
}
|
|
244
|
-
return r.length > 0 ?
|
|
244
|
+
return r.length > 0 ? z(r.join("; ")) : void 0;
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function xr(e) {
|
|
247
247
|
if (!e)
|
|
248
248
|
return [];
|
|
249
249
|
const t = /* @__PURE__ */ new Set(), o = (i) => {
|
|
250
|
-
i && t.add(
|
|
250
|
+
i && t.add(z(i, 120));
|
|
251
251
|
}, r = J(
|
|
252
252
|
C(e.field),
|
|
253
253
|
C(e.parameter),
|
|
@@ -255,7 +255,7 @@ function Or(e) {
|
|
|
255
255
|
C(e.path)
|
|
256
256
|
);
|
|
257
257
|
o(r);
|
|
258
|
-
const n =
|
|
258
|
+
const n = dt(
|
|
259
259
|
e.details,
|
|
260
260
|
e.errorDetails,
|
|
261
261
|
e.errorExtra,
|
|
@@ -306,7 +306,7 @@ function Or(e) {
|
|
|
306
306
|
}
|
|
307
307
|
return Array.from(t).slice(0, 3);
|
|
308
308
|
}
|
|
309
|
-
const
|
|
309
|
+
const Or = [
|
|
310
310
|
"error",
|
|
311
311
|
"error_code",
|
|
312
312
|
"error_tag",
|
|
@@ -317,8 +317,8 @@ const _r = [
|
|
|
317
317
|
"httpCode",
|
|
318
318
|
"errorExtra"
|
|
319
319
|
];
|
|
320
|
-
function
|
|
321
|
-
return e ?
|
|
320
|
+
function _r(e) {
|
|
321
|
+
return e ? Or.some((t) => e[t] !== void 0) : !1;
|
|
322
322
|
}
|
|
323
323
|
const Vo = '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.', We = {
|
|
324
324
|
// Seen for a deadline sent by a free-plan user (task creates and updates), for
|
|
@@ -329,10 +329,10 @@ const Vo = 'A due string must name one specific date or recurrence, such as "tom
|
|
|
329
329
|
INVALID_DATE: `Todoist could not parse a date in this request. ${Vo} 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.`,
|
|
330
330
|
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.",
|
|
331
331
|
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."
|
|
332
|
-
},
|
|
332
|
+
}, Pr = {
|
|
333
333
|
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."
|
|
334
334
|
};
|
|
335
|
-
function
|
|
335
|
+
function Ur(...e) {
|
|
336
336
|
for (const t of e) {
|
|
337
337
|
if (!t)
|
|
338
338
|
continue;
|
|
@@ -345,21 +345,21 @@ function Rr(...e) {
|
|
|
345
345
|
}
|
|
346
346
|
function Jo(e) {
|
|
347
347
|
const t = e.tag?.toUpperCase();
|
|
348
|
-
return t && We[t] ? t :
|
|
348
|
+
return t && We[t] ? t : Ur(...e.rawText ?? [], e.message, e.details);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Rr(e) {
|
|
351
351
|
const t = Jo(e);
|
|
352
352
|
return t ? We[t] : void 0;
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
const t =
|
|
354
|
+
function Nr(e) {
|
|
355
|
+
const t = Rr(e);
|
|
356
356
|
if (t)
|
|
357
357
|
return t;
|
|
358
358
|
const { statusCode: o } = e, r = e.fieldHints.length > 0;
|
|
359
359
|
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.";
|
|
360
360
|
}
|
|
361
|
-
function
|
|
362
|
-
const t = ue(e) ? e : void 0, o = e instanceof Error && ue(e.cause) ? e.cause : void 0, r =
|
|
361
|
+
function It(e) {
|
|
362
|
+
const t = ue(e) ? e : void 0, o = e instanceof Error && ue(e.cause) ? e.cause : void 0, r = dt(t?.response, o?.response), n = dt(
|
|
363
363
|
t?.responseData,
|
|
364
364
|
r?.data,
|
|
365
365
|
t?.data,
|
|
@@ -375,16 +375,16 @@ function vt(e) {
|
|
|
375
375
|
W(n?.status),
|
|
376
376
|
W(n?.httpCode),
|
|
377
377
|
W(n?.http_code),
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
Ve(C(t?.message)),
|
|
379
|
+
Ve(C(o?.message)),
|
|
380
|
+
Ve(typeof e == "string" ? e : void 0)
|
|
381
381
|
), i = J(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
382
|
+
be(n?.errorCode),
|
|
383
|
+
be(n?.error_code),
|
|
384
|
+
be(n?.code),
|
|
385
|
+
be(t?.errorCode),
|
|
386
|
+
be(t?.error_code),
|
|
387
|
+
be(t?.code)
|
|
388
388
|
), c = J(
|
|
389
389
|
C(n?.errorTag),
|
|
390
390
|
C(n?.error_tag),
|
|
@@ -399,20 +399,20 @@ function vt(e) {
|
|
|
399
399
|
C(t?.message),
|
|
400
400
|
C(o?.message),
|
|
401
401
|
e instanceof Error ? e.message : C(e)
|
|
402
|
-
].filter((h) => !!h), u = d.find((h) => !
|
|
402
|
+
].filter((h) => !!h), u = d.find((h) => !lt(h)) || d[0], l = J(
|
|
403
403
|
ce(n?.errorExtra),
|
|
404
404
|
ce(n?.error_extra),
|
|
405
405
|
ce(n?.details),
|
|
406
406
|
ce(n?.errorDetails),
|
|
407
407
|
ce(n?.errors),
|
|
408
408
|
ce(t?.details)
|
|
409
|
-
), p =
|
|
410
|
-
return a !== void 0 ||
|
|
409
|
+
), p = xr(n);
|
|
410
|
+
return a !== void 0 || _r(n) || c !== void 0 || i !== void 0 || (u ? lt(u) : !1) ? {
|
|
411
411
|
statusCode: a,
|
|
412
412
|
code: i,
|
|
413
|
-
tag: c ?
|
|
414
|
-
message: u ?
|
|
415
|
-
details: l ?
|
|
413
|
+
tag: c ? z(c, 80) : void 0,
|
|
414
|
+
message: u ? z(u) : void 0,
|
|
415
|
+
details: l ? z(l) : void 0,
|
|
416
416
|
rawText: d,
|
|
417
417
|
fieldHints: p
|
|
418
418
|
} : null;
|
|
@@ -421,17 +421,17 @@ function Xo(e) {
|
|
|
421
421
|
const t = [];
|
|
422
422
|
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;
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function Lr(e) {
|
|
425
425
|
const t = Xo(e), o = [
|
|
426
426
|
t.length > 0 ? `Todoist API request failed (${t.join(", ")}).` : "Todoist API request failed."
|
|
427
427
|
];
|
|
428
|
-
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: ${
|
|
428
|
+
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: ${Nr(e)}`), o.join(`
|
|
429
429
|
`);
|
|
430
430
|
}
|
|
431
431
|
function Zo(e) {
|
|
432
|
-
return e instanceof Error ?
|
|
432
|
+
return e instanceof Error ? z(e.message) : typeof e == "string" ? z(e) : "An unknown error occurred";
|
|
433
433
|
}
|
|
434
|
-
class
|
|
434
|
+
class vt extends Error {
|
|
435
435
|
constructor(t) {
|
|
436
436
|
super(t), this.name = "DueStringParseError";
|
|
437
437
|
}
|
|
@@ -446,37 +446,37 @@ function B(e) {
|
|
|
446
446
|
return o ? `${t}. ${o.text}` : t;
|
|
447
447
|
}
|
|
448
448
|
function Qo(e) {
|
|
449
|
-
if (e instanceof
|
|
449
|
+
if (e instanceof vt || e instanceof de)
|
|
450
450
|
return { summary: e.message };
|
|
451
|
-
const t =
|
|
451
|
+
const t = It(e);
|
|
452
452
|
if (!t)
|
|
453
453
|
return { summary: Zo(e) };
|
|
454
|
-
const o = Xo(t), r = t.message && !(o.length > 0 &&
|
|
454
|
+
const o = Xo(t), r = t.message && !(o.length > 0 && lt(t.message)) ? t.message : "Todoist API request failed", n = o.length > 0 ? `${r} (${o.join(", ")})` : r, a = Jo(t), i = a ? Pr[a] ?? We[a] : void 0;
|
|
455
455
|
return a && i ? { summary: n, hint: { tag: a, text: i } } : { summary: n };
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function Mr(e, {
|
|
458
458
|
taskContent: t,
|
|
459
459
|
dueString: o,
|
|
460
460
|
deadlineDate: r
|
|
461
461
|
}) {
|
|
462
462
|
if (!o)
|
|
463
463
|
return;
|
|
464
|
-
const n =
|
|
464
|
+
const n = It(e), a = n?.tag?.toUpperCase(), i = a === "INVALID_DUE_STRING", c = !r && (a === "INVALID_DATE" || /^invalid date format\.?$/i.test(n?.message ?? ""));
|
|
465
465
|
if (!i && !c)
|
|
466
466
|
return;
|
|
467
467
|
const d = o.trim().replace(/^recurring(?:\s+|$)/i, "").trim();
|
|
468
468
|
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. ${Vo} Change only \`dueString\` and retry.`;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
if (e instanceof
|
|
470
|
+
function Fr(e) {
|
|
471
|
+
if (e instanceof ar || e instanceof vt || e instanceof de)
|
|
472
472
|
return e.message;
|
|
473
|
-
const t =
|
|
474
|
-
return t ?
|
|
473
|
+
const t = It(e);
|
|
474
|
+
return t ? Lr(t) : Zo(e);
|
|
475
475
|
}
|
|
476
|
-
const
|
|
477
|
-
version:
|
|
476
|
+
const Hr = "17.3.5", Wr = {
|
|
477
|
+
version: Hr
|
|
478
478
|
};
|
|
479
|
-
function Zt(e, { queueTimeoutMs: t =
|
|
479
|
+
function Zt(e, { queueTimeoutMs: t = nt.QUEUE_WAIT_MS } = {}) {
|
|
480
480
|
if (!Number.isInteger(e) || e < 1)
|
|
481
481
|
throw new Error(
|
|
482
482
|
`maxConcurrent must be a positive integer, received ${String(e)}`
|
|
@@ -518,42 +518,42 @@ function Zt(e, { queueTimeoutMs: t = at.QUEUE_WAIT_MS } = {}) {
|
|
|
518
518
|
};
|
|
519
519
|
return i.isIdle = () => r === 0 && o.length === 0, i;
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function St() {
|
|
522
522
|
return {
|
|
523
|
-
moves: Zt(
|
|
524
|
-
writes: Zt(
|
|
523
|
+
moves: Zt(nt.TASK_MOVES),
|
|
524
|
+
writes: Zt(nt.WRITES)
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
const
|
|
528
|
-
let
|
|
527
|
+
const Br = 1e4, Kr = 5 * 6e4, X = /* @__PURE__ */ new Map();
|
|
528
|
+
let qr = Br;
|
|
529
529
|
const es = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new Map();
|
|
530
530
|
let Qt, eo;
|
|
531
|
-
function
|
|
532
|
-
return Qt ??=
|
|
531
|
+
function zr() {
|
|
532
|
+
return Qt ??= St(), Qt;
|
|
533
533
|
}
|
|
534
534
|
function to() {
|
|
535
|
-
return eo ??=
|
|
535
|
+
return eo ??= St(), eo;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function Yr(e) {
|
|
538
538
|
return No("sha256").update(e).digest("hex");
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function Gr({ moves: e, writes: t }) {
|
|
541
541
|
return e.isIdle() && t.isIdle();
|
|
542
542
|
}
|
|
543
543
|
function ts(e) {
|
|
544
|
-
return e.leases === 0 &&
|
|
544
|
+
return e.leases === 0 && Gr(e.limiters);
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Vr(e, t, o) {
|
|
547
547
|
X.delete(e), t.lastUsedAt = o, X.set(e, t);
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function Jr(e) {
|
|
550
550
|
for (const [t, o] of X) {
|
|
551
|
-
if (e - o.lastUsedAt <
|
|
551
|
+
if (e - o.lastUsedAt < Kr)
|
|
552
552
|
break;
|
|
553
553
|
ts(o) && X.delete(t);
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function Xr() {
|
|
557
557
|
for (const [e, t] of X)
|
|
558
558
|
if (ts(t))
|
|
559
559
|
return X.delete(e), !0;
|
|
@@ -564,13 +564,13 @@ function os(e, t) {
|
|
|
564
564
|
return;
|
|
565
565
|
const o = X.get(e);
|
|
566
566
|
if (o)
|
|
567
|
-
return
|
|
568
|
-
if (
|
|
567
|
+
return Vr(e, o, t), o;
|
|
568
|
+
if (Jr(t), X.size >= qr && !Xr())
|
|
569
569
|
return;
|
|
570
|
-
const r = { limiters:
|
|
570
|
+
const r = { limiters: St(), lastUsedAt: t, leases: 0 };
|
|
571
571
|
return X.set(e, r), r;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Zr(e) {
|
|
574
574
|
const t = le.get(e);
|
|
575
575
|
if (t !== void 0)
|
|
576
576
|
return le.set(e, t + 1), {
|
|
@@ -596,68 +596,68 @@ function oo(e) {
|
|
|
596
596
|
}
|
|
597
597
|
le.set(e, t - 1);
|
|
598
598
|
}
|
|
599
|
-
function
|
|
600
|
-
const o =
|
|
599
|
+
function Qr(e, t) {
|
|
600
|
+
const o = Yr(t);
|
|
601
601
|
es.set(e, o);
|
|
602
602
|
}
|
|
603
603
|
function ss(e, t) {
|
|
604
604
|
const o = es.get(e);
|
|
605
605
|
return o ? (os(o, Date.now()), async (r) => {
|
|
606
|
-
const n =
|
|
606
|
+
const n = Zr(o);
|
|
607
607
|
try {
|
|
608
608
|
return await n.limiters[t](r);
|
|
609
609
|
} finally {
|
|
610
610
|
n.release();
|
|
611
611
|
}
|
|
612
|
-
}) :
|
|
612
|
+
}) : zr()[t];
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function en(e) {
|
|
615
615
|
return ss(e, "moves");
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function Ct(e) {
|
|
618
618
|
return ss(e, "writes");
|
|
619
619
|
}
|
|
620
|
-
const
|
|
620
|
+
const tn = "todoist-mcp", jt = Wr.version, rs = new ir(), so = cr(import.meta.url);
|
|
621
621
|
let Le;
|
|
622
|
-
const
|
|
623
|
-
const e = so.resolve("@todoist/sdk"), t =
|
|
622
|
+
const on = async () => {
|
|
623
|
+
const e = so.resolve("@todoist/sdk"), t = ot(Lo(e), "transport", "http-dispatcher.js");
|
|
624
624
|
return so(t);
|
|
625
625
|
};
|
|
626
|
-
let
|
|
627
|
-
function
|
|
628
|
-
return `${
|
|
626
|
+
let sn = on;
|
|
627
|
+
function rn() {
|
|
628
|
+
return `${tn}/${jt}`;
|
|
629
629
|
}
|
|
630
630
|
function ns(e) {
|
|
631
631
|
return e.trim().toLowerCase();
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function nn(e, t) {
|
|
634
634
|
return rs.run(ns(e), t);
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function an({
|
|
637
637
|
label: e,
|
|
638
638
|
platform: t = "mcp",
|
|
639
|
-
sessionId: o =
|
|
639
|
+
sessionId: o = ve()
|
|
640
640
|
} = {}) {
|
|
641
641
|
const r = e ? ns(e) : rs.getStore();
|
|
642
642
|
return {
|
|
643
|
-
"User-Agent":
|
|
643
|
+
"User-Agent": rn(),
|
|
644
644
|
"doist-platform": t,
|
|
645
|
-
"doist-version":
|
|
646
|
-
"request-id":
|
|
645
|
+
"doist-version": jt,
|
|
646
|
+
"request-id": ve(),
|
|
647
647
|
"session-id": o,
|
|
648
648
|
"mcp-tool": r ?? "unknown"
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function cn(e, t) {
|
|
652
652
|
const o = new Headers(e);
|
|
653
|
-
for (const [r, n] of Object.entries(
|
|
653
|
+
for (const [r, n] of Object.entries(an(t)))
|
|
654
654
|
o.set(r, n);
|
|
655
655
|
return Object.fromEntries(o.entries());
|
|
656
656
|
}
|
|
657
657
|
function ro() {
|
|
658
658
|
return new DOMException("The operation was aborted due to timeout", "TimeoutError");
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function dn(e, t) {
|
|
661
661
|
if (!e && t === void 0)
|
|
662
662
|
return {
|
|
663
663
|
signal: void 0,
|
|
@@ -695,26 +695,26 @@ function ln(e, t) {
|
|
|
695
695
|
}
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
|
-
async function
|
|
699
|
-
if (
|
|
700
|
-
return Le || (Le =
|
|
698
|
+
async function ln() {
|
|
699
|
+
if (un())
|
|
700
|
+
return Le || (Le = sn().then((e) => e.getDefaultTransport()).catch((e) => {
|
|
701
701
|
throw Le = void 0, e;
|
|
702
702
|
})), Le;
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function un() {
|
|
705
705
|
return typeof process < "u" && !!process.versions?.node;
|
|
706
706
|
}
|
|
707
707
|
async function as(e, t) {
|
|
708
708
|
if ("dispatcher" in t)
|
|
709
709
|
return e;
|
|
710
|
-
const o = await
|
|
710
|
+
const o = await ln();
|
|
711
711
|
return o ? (t.dispatcher = o.dispatcher, o.fetch ?? e) : e;
|
|
712
712
|
}
|
|
713
713
|
async function Jp(e, t) {
|
|
714
714
|
const o = { ...t };
|
|
715
715
|
return (await as(globalThis.fetch, o))(e, o);
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function pn(e) {
|
|
718
718
|
return {
|
|
719
719
|
ok: e.ok,
|
|
720
720
|
status: e.status,
|
|
@@ -725,33 +725,33 @@ function hn(e) {
|
|
|
725
725
|
arrayBuffer: () => e.arrayBuffer()
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
|
-
function
|
|
729
|
-
const o = e === globalThis.fetch, { enabled: r = !0, platform: n = "mcp", sessionId: a =
|
|
728
|
+
function hn(e = globalThis.fetch, t = {}) {
|
|
729
|
+
const o = e === globalThis.fetch, { enabled: r = !0, platform: n = "mcp", sessionId: a = ve() } = t;
|
|
730
730
|
return async (i, c = {}) => {
|
|
731
|
-
const { timeout: d, headers: u, signal: l, ...p } = c, { signal: f, cleanup: h } =
|
|
731
|
+
const { timeout: d, headers: u, signal: l, ...p } = c, { signal: f, cleanup: h } = dn(l, d);
|
|
732
732
|
try {
|
|
733
733
|
const m = {
|
|
734
734
|
...p,
|
|
735
735
|
signal: f,
|
|
736
|
-
...r ? { headers:
|
|
736
|
+
...r ? { headers: cn(u, { platform: n, sessionId: a }) } : u !== void 0 ? { headers: u } : {}
|
|
737
737
|
}, g = await (o ? await as(e, m) : e)(i, m);
|
|
738
|
-
return
|
|
738
|
+
return pn(g);
|
|
739
739
|
} finally {
|
|
740
740
|
h();
|
|
741
741
|
}
|
|
742
742
|
};
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function mn(e, {
|
|
745
745
|
baseUrl: t,
|
|
746
746
|
tracking: o
|
|
747
747
|
} = {}) {
|
|
748
|
-
const r = new
|
|
749
|
-
customFetch:
|
|
748
|
+
const r = new dr(e, {
|
|
749
|
+
customFetch: hn(globalThis.fetch, o),
|
|
750
750
|
...t ? { baseUrl: t } : {}
|
|
751
751
|
});
|
|
752
|
-
return
|
|
752
|
+
return Qr(r, e), r;
|
|
753
753
|
}
|
|
754
|
-
const
|
|
754
|
+
const fn = 2, bn = 500, gn = 2e3, yn = 50, wn = /* @__PURE__ */ new Set([502, 503, 504]), Tn = /* @__PURE__ */ new Set([503]);
|
|
755
755
|
function Be(e) {
|
|
756
756
|
if (e == null || typeof e != "object")
|
|
757
757
|
return;
|
|
@@ -768,32 +768,32 @@ function Be(e) {
|
|
|
768
768
|
return Number(o[1]);
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function kn(e, t = wn) {
|
|
772
772
|
const o = Be(e);
|
|
773
773
|
return o !== void 0 && t.has(o);
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function In({
|
|
776
776
|
attempt: e,
|
|
777
777
|
baseDelayMs: t,
|
|
778
778
|
maxDelayMs: o,
|
|
779
779
|
random: r = Math.random
|
|
780
780
|
}) {
|
|
781
781
|
const n = Math.min(t * 2 ** e, o), a = Math.round(r() * n);
|
|
782
|
-
return Math.min(n, Math.max(
|
|
782
|
+
return Math.min(n, Math.max(yn, a));
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function vn(e) {
|
|
785
785
|
return new Promise((t) => setTimeout(t, e));
|
|
786
786
|
}
|
|
787
787
|
async function j(e, t = {}) {
|
|
788
|
-
const o = t.maxRetries ??
|
|
788
|
+
const o = t.maxRetries ?? fn, r = t.baseDelayMs ?? bn, n = t.maxDelayMs ?? gn, a = t.random;
|
|
789
789
|
let i;
|
|
790
790
|
for (let c = 0; c <= o; c++)
|
|
791
791
|
try {
|
|
792
792
|
return await e();
|
|
793
793
|
} catch (d) {
|
|
794
|
-
if (i = d, c < o &&
|
|
795
|
-
const u =
|
|
796
|
-
await
|
|
794
|
+
if (i = d, c < o && kn(d, t.retryableStatusCodes)) {
|
|
795
|
+
const u = In({ attempt: c, baseDelayMs: r, maxDelayMs: n, random: a });
|
|
796
|
+
await vn(u);
|
|
797
797
|
continue;
|
|
798
798
|
}
|
|
799
799
|
throw d;
|
|
@@ -801,7 +801,7 @@ async function j(e, t = {}) {
|
|
|
801
801
|
throw i;
|
|
802
802
|
}
|
|
803
803
|
async function oe(e, t = {}) {
|
|
804
|
-
return j(e, { ...t, retryableStatusCodes:
|
|
804
|
+
return j(e, { ...t, retryableStatusCodes: Tn });
|
|
805
805
|
}
|
|
806
806
|
const y = {
|
|
807
807
|
// Task management tools
|
|
@@ -878,65 +878,65 @@ const y = {
|
|
|
878
878
|
* Affects: find-project-collaborators, find-completed-tasks
|
|
879
879
|
*/
|
|
880
880
|
STRIP_EMAILS: "strip_emails"
|
|
881
|
-
},
|
|
882
|
-
function
|
|
881
|
+
}, Sn = process.env.USE_STRUCTURED_CONTENT === "true" || process.env.NODE_ENV === "test", Cn = /* @__PURE__ */ new Set(["file"]);
|
|
882
|
+
function jn(e) {
|
|
883
883
|
return !e || typeof e != "object" || Array.isArray(e) ? e : Object.fromEntries(
|
|
884
884
|
Object.entries(e).map(
|
|
885
|
-
([t, o]) =>
|
|
885
|
+
([t, o]) => Cn.has(t) && o !== void 0 ? [t, "[redacted]"] : [t, o]
|
|
886
886
|
)
|
|
887
887
|
);
|
|
888
888
|
}
|
|
889
|
-
const
|
|
889
|
+
const $n = [
|
|
890
890
|
y.FIND_PROJECT_COLLABORATORS,
|
|
891
891
|
y.FIND_COMPLETED_TASKS
|
|
892
892
|
];
|
|
893
|
-
function
|
|
893
|
+
function ut(e) {
|
|
894
894
|
if (e == null)
|
|
895
895
|
return e;
|
|
896
896
|
if (Array.isArray(e))
|
|
897
|
-
return e.map((t) =>
|
|
897
|
+
return e.map((t) => ut(t));
|
|
898
898
|
if (typeof e == "object") {
|
|
899
899
|
const t = {};
|
|
900
900
|
for (const [o, r] of Object.entries(e))
|
|
901
|
-
o !== "email" && (t[o] =
|
|
901
|
+
o !== "email" && (t[o] = ut(r));
|
|
902
902
|
return t;
|
|
903
903
|
}
|
|
904
904
|
return e;
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function En(e) {
|
|
907
907
|
const t = /\s*\([^)]*@[^)]+\)/g, o = /\S+@\S+\.\S+/g;
|
|
908
908
|
return e.replace(t, "").replace(o, "[email hidden]");
|
|
909
909
|
}
|
|
910
|
-
function
|
|
911
|
-
return
|
|
910
|
+
function An(e) {
|
|
911
|
+
return $n.includes(e);
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function Dn({
|
|
914
914
|
tools: e,
|
|
915
915
|
server: t,
|
|
916
916
|
client: o,
|
|
917
917
|
features: r = []
|
|
918
918
|
}) {
|
|
919
|
-
const n = r.some((i) => i.name === "strip_emails"), a =
|
|
919
|
+
const n = r.some((i) => i.name === "strip_emails"), a = nr({
|
|
920
920
|
titlePrefix: "Todoist",
|
|
921
921
|
createContext: () => o,
|
|
922
|
-
formatError:
|
|
923
|
-
structuredContentAsText: !
|
|
922
|
+
formatError: Fr,
|
|
923
|
+
structuredContentAsText: !Sn,
|
|
924
924
|
wrapExecute: async (i, c) => {
|
|
925
|
-
const d = await
|
|
926
|
-
return !n || !
|
|
925
|
+
const d = await nn(i.name, () => j(c));
|
|
926
|
+
return !n || !An(i.name) ? d : {
|
|
927
927
|
...d,
|
|
928
|
-
textContent: d.textContent &&
|
|
929
|
-
structuredContent: d.structuredContent &&
|
|
928
|
+
textContent: d.textContent && En(d.textContent),
|
|
929
|
+
structuredContent: d.structuredContent && ut(d.structuredContent)
|
|
930
930
|
};
|
|
931
931
|
},
|
|
932
932
|
onError: ({ tool: i, args: c, error: d }) => {
|
|
933
|
-
console.error(`Error executing tool ${i.name}:`, { args:
|
|
933
|
+
console.error(`Error executing tool ${i.name}:`, { args: jn(c), error: d });
|
|
934
934
|
}
|
|
935
935
|
});
|
|
936
936
|
for (const i of e)
|
|
937
937
|
a(t, i);
|
|
938
938
|
}
|
|
939
|
-
const
|
|
939
|
+
const xn = s.object({
|
|
940
940
|
period: s.enum(["today", "7d", "14d", "30d", "this-week", "this-month"]).default("7d").describe(
|
|
941
941
|
'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.'
|
|
942
942
|
),
|
|
@@ -945,7 +945,7 @@ const On = s.object({
|
|
|
945
945
|
),
|
|
946
946
|
projectId: s.string().optional().describe("Optional project ID to scope the analysis to a specific project.")
|
|
947
947
|
});
|
|
948
|
-
function
|
|
948
|
+
function On(e, t = /* @__PURE__ */ new Date()) {
|
|
949
949
|
const o = (n) => n.toISOString().slice(0, 10), r = o(t);
|
|
950
950
|
switch (e) {
|
|
951
951
|
case "today":
|
|
@@ -992,7 +992,7 @@ function _n(e, t = /* @__PURE__ */ new Date()) {
|
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function _n(e) {
|
|
996
996
|
const t = {
|
|
997
997
|
goals: `### Goal Tracking
|
|
998
998
|
- Compare tasks completed today vs the daily goal
|
|
@@ -1023,8 +1023,8 @@ function Pn(e) {
|
|
|
1023
1023
|
|
|
1024
1024
|
`) : t[e] ?? "";
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const { since: t, until: o, periodDescription: r } =
|
|
1026
|
+
function Pn(e) {
|
|
1027
|
+
const { since: t, until: o, periodDescription: r } = On(e.period), n = e.projectId ? `
|
|
1028
1028
|
Scope this analysis to project ID: ${e.projectId}. Pass this projectId when calling find-completed-tasks and get-overview.` : "";
|
|
1029
1029
|
return `Analyze my Todoist productivity for ${r} (${t} to ${o}).${n}
|
|
1030
1030
|
|
|
@@ -1045,7 +1045,7 @@ ${e.focus === "overall" || e.focus === "projects" ? `4. **get-overview** — Get
|
|
|
1045
1045
|
|
|
1046
1046
|
Using the collected data, produce an analysis covering the following sections:
|
|
1047
1047
|
|
|
1048
|
-
${
|
|
1048
|
+
${_n(e.focus)}
|
|
1049
1049
|
|
|
1050
1050
|
### Step 3: Format
|
|
1051
1051
|
|
|
@@ -1055,32 +1055,32 @@ Present the analysis as a clear, well-structured markdown report with:
|
|
|
1055
1055
|
- Specific numbers and comparisons (not vague statements)
|
|
1056
1056
|
- Actionable takeaways highlighted clearly`;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function Un(e) {
|
|
1059
1059
|
return {
|
|
1060
1060
|
messages: [
|
|
1061
1061
|
{
|
|
1062
1062
|
role: "user",
|
|
1063
1063
|
content: {
|
|
1064
1064
|
type: "text",
|
|
1065
|
-
text:
|
|
1065
|
+
text: Pn(e)
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
1068
|
]
|
|
1069
1069
|
};
|
|
1070
1070
|
}
|
|
1071
|
-
const
|
|
1071
|
+
const $e = {
|
|
1072
1072
|
name: "productivity-analysis",
|
|
1073
1073
|
title: "Productivity Analysis",
|
|
1074
1074
|
description: "Analyze your Todoist productivity with insights on completion trends, goal streaks, project distribution, and actionable recommendations. Gathers data from multiple tools and synthesizes a comprehensive report.",
|
|
1075
|
-
argsSchema:
|
|
1076
|
-
callback:
|
|
1075
|
+
argsSchema: xn,
|
|
1076
|
+
callback: Un
|
|
1077
1077
|
}, is = 'The duration of the task. Use format: "2h" (hours), "90m" (minutes), "2h30m" (combined), "1.5h" (decimal hours), or "3d" (whole days; days cannot be combined with hours or minutes). Todoist apps only display durations under 24 hours: a longer or day-based duration is stored and reported by this server, but the apps show the task as having no duration.', cs = 'Use format like "2h", "30m", "2h30m", "1.5h", or "3d"';
|
|
1078
1078
|
class N extends Error {
|
|
1079
1079
|
constructor(t, o) {
|
|
1080
1080
|
super(`Invalid duration format "${t}": ${o}`), this.name = "DurationParseError";
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1083
|
+
function Rn(e) {
|
|
1084
1084
|
if (!e || typeof e != "string")
|
|
1085
1085
|
throw new N(e, "Duration must be a non-empty string");
|
|
1086
1086
|
const t = e.trim().toLowerCase().replace(/\s+/g, "");
|
|
@@ -1088,31 +1088,31 @@ function Nn(e) {
|
|
|
1088
1088
|
throw new N(e, "Duration must be a non-empty string");
|
|
1089
1089
|
const o = t.match(/^(\d+(?:\.\d+)?)d$/)?.[1];
|
|
1090
1090
|
if (o !== void 0)
|
|
1091
|
-
return { amount:
|
|
1092
|
-
if (
|
|
1091
|
+
return { amount: Ln(e, o), unit: "day" };
|
|
1092
|
+
if (Nn(t))
|
|
1093
1093
|
throw new N(
|
|
1094
1094
|
e,
|
|
1095
1095
|
`${cs} (days cannot be combined with hours or minutes)`
|
|
1096
1096
|
);
|
|
1097
|
-
return { amount:
|
|
1097
|
+
return { amount: Mn(e, t), unit: "minute" };
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function Nn(e) {
|
|
1100
1100
|
return /^(?:\d+(?:\.\d+)?[dhm])+$/.test(e) && /d/.test(e) && /[hm]/.test(e);
|
|
1101
1101
|
}
|
|
1102
|
-
const
|
|
1103
|
-
function
|
|
1102
|
+
const pt = "Duration is too large";
|
|
1103
|
+
function Ln(e, t) {
|
|
1104
1104
|
const o = Number.parseFloat(t);
|
|
1105
1105
|
if (Number.isNaN(o) || o < 0)
|
|
1106
1106
|
throw new N(e, "Days must be a positive number");
|
|
1107
1107
|
if (!Number.isFinite(o))
|
|
1108
|
-
throw new N(e,
|
|
1108
|
+
throw new N(e, pt);
|
|
1109
1109
|
if (o % 1 !== 0)
|
|
1110
1110
|
throw new N(e, "Days must be a whole number");
|
|
1111
1111
|
if (o === 0)
|
|
1112
1112
|
throw new N(e, "Duration must be at least 1 day");
|
|
1113
1113
|
return o;
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function Mn(e, t) {
|
|
1116
1116
|
const o = t.match(/^(?:(\d+(?:\.\d+)?)h)?(?:(\d+(?:\.\d+)?)m)?$/);
|
|
1117
1117
|
if (!o || !o[1] && !o[2])
|
|
1118
1118
|
throw new N(e, cs);
|
|
@@ -1129,7 +1129,7 @@ function Fn(e, t) {
|
|
|
1129
1129
|
if (Number.isNaN(i) || i < 0)
|
|
1130
1130
|
throw new N(e, "Minutes must be a positive number");
|
|
1131
1131
|
if (!Number.isFinite(i))
|
|
1132
|
-
throw new N(e,
|
|
1132
|
+
throw new N(e, pt);
|
|
1133
1133
|
if (i % 1 !== 0)
|
|
1134
1134
|
throw new N(
|
|
1135
1135
|
e,
|
|
@@ -1138,33 +1138,33 @@ function Fn(e, t) {
|
|
|
1138
1138
|
r += i;
|
|
1139
1139
|
}
|
|
1140
1140
|
if (r = Math.round(r), !Number.isFinite(r))
|
|
1141
|
-
throw new N(e,
|
|
1141
|
+
throw new N(e, pt);
|
|
1142
1142
|
if (r === 0)
|
|
1143
1143
|
throw new N(e, "Duration must be greater than 0 minutes");
|
|
1144
1144
|
return r;
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function $t(e, t) {
|
|
1147
1147
|
try {
|
|
1148
|
-
return
|
|
1148
|
+
return Rn(t);
|
|
1149
1149
|
} catch (o) {
|
|
1150
1150
|
throw o instanceof N ? new Error(`${e}: ${o.message}`) : o;
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
|
-
function
|
|
1153
|
+
function Fn(e, t = "minute") {
|
|
1154
1154
|
if (t === "day")
|
|
1155
1155
|
return `${e}d`;
|
|
1156
1156
|
if (e <= 0) return "0m";
|
|
1157
1157
|
const o = Math.floor(e / 60), r = e % 60;
|
|
1158
1158
|
return o === 0 ? `${r}m` : r === 0 ? `${o}h` : `${o}h${r}m`;
|
|
1159
1159
|
}
|
|
1160
|
-
const
|
|
1160
|
+
const Hn = ["p1", "p2", "p3", "p4"], Et = 'Task priority as a string: "p1" (highest), "p2" (high), "p3" (medium), or "p4" (lowest/default). Integers like 1, 2, 3, or 4 are not accepted.', At = s.enum(Hn).describe(Et);
|
|
1161
1161
|
function ds(e) {
|
|
1162
1162
|
return { p1: 4, p2: 3, p3: 2, p4: 1 }[e];
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1164
|
+
function Wn(e) {
|
|
1165
1165
|
return { 4: "p1", 3: "p2", 2: "p3", 1: "p4" }[e];
|
|
1166
1166
|
}
|
|
1167
|
-
const ls = 300 * 1e3,
|
|
1167
|
+
const ls = 300 * 1e3, Bn = 1e4, Kn = 1e3;
|
|
1168
1168
|
class us {
|
|
1169
1169
|
constructor(t, o) {
|
|
1170
1170
|
this.maxEntries = t, this.ttl = o, this.entries = /* @__PURE__ */ new Map();
|
|
@@ -1198,20 +1198,20 @@ class us {
|
|
|
1198
1198
|
t - r.timestamp >= this.ttl && this.entries.delete(o);
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1201
|
+
const Je = new us(
|
|
1202
|
+
Bn,
|
|
1203
1203
|
ls
|
|
1204
|
-
),
|
|
1205
|
-
|
|
1204
|
+
), ge = new us(
|
|
1205
|
+
Kn,
|
|
1206
1206
|
ls
|
|
1207
|
-
),
|
|
1207
|
+
), Ae = /* @__PURE__ */ new Map();
|
|
1208
1208
|
function no(e, t) {
|
|
1209
|
-
const o =
|
|
1209
|
+
const o = Ae.get(e);
|
|
1210
1210
|
if (o) return o;
|
|
1211
1211
|
const r = t().finally(() => {
|
|
1212
|
-
|
|
1212
|
+
Ae.get(e) === r && Ae.delete(e);
|
|
1213
1213
|
});
|
|
1214
|
-
return
|
|
1214
|
+
return Ae.set(e, r), r;
|
|
1215
1215
|
}
|
|
1216
1216
|
function ps(e) {
|
|
1217
1217
|
return /^[0-9]+$/.test(e) || /^[a-f0-9-]{8,}$/i.test(e) && e.includes("-") || /^[a-z0-9_]{6,}$/i.test(e) && !/^[a-z]+[\s-]/.test(e) && /[0-9_]/.test(e);
|
|
@@ -1230,8 +1230,8 @@ function io(e) {
|
|
|
1230
1230
|
email: e.email
|
|
1231
1231
|
};
|
|
1232
1232
|
}
|
|
1233
|
-
const Me = /* @__PURE__ */ new WeakMap(),
|
|
1234
|
-
class
|
|
1233
|
+
const Me = /* @__PURE__ */ new WeakMap(), ht = "me";
|
|
1234
|
+
class qn {
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
|
|
1237
1237
|
* Supports exact name matches, partial matches, email matches, and the "me" keyword.
|
|
@@ -1240,7 +1240,7 @@ class zn {
|
|
|
1240
1240
|
if (!o || o.trim().length === 0)
|
|
1241
1241
|
return null;
|
|
1242
1242
|
const r = o.trim();
|
|
1243
|
-
if (r.toLowerCase() ===
|
|
1243
|
+
if (r.toLowerCase() === ht)
|
|
1244
1244
|
try {
|
|
1245
1245
|
const l = await t.getUser();
|
|
1246
1246
|
return {
|
|
@@ -1251,9 +1251,9 @@ class zn {
|
|
|
1251
1251
|
} catch {
|
|
1252
1252
|
return null;
|
|
1253
1253
|
}
|
|
1254
|
-
const a = ps(r) ? { userId: r, displayName: r, email: r } : null, i = await this.getCacheScope(t), c = this.getCacheKey(i, `user_${r}`), d = c ?
|
|
1254
|
+
const a = ps(r) ? { userId: r, displayName: r, email: r } : null, i = await this.getCacheScope(t), c = this.getCacheKey(i, `user_${r}`), d = c ? Je.get(c) : void 0;
|
|
1255
1255
|
if (d !== void 0) return d;
|
|
1256
|
-
const u = (l) => (c &&
|
|
1256
|
+
const u = (l) => (c && Je.set(c, l), l);
|
|
1257
1257
|
try {
|
|
1258
1258
|
let l = await this.getAllCollaborators(t, i);
|
|
1259
1259
|
try {
|
|
@@ -1287,7 +1287,7 @@ class zn {
|
|
|
1287
1287
|
*/
|
|
1288
1288
|
async resolveProjectCollaborator(t, o, r) {
|
|
1289
1289
|
const n = r.trim();
|
|
1290
|
-
if (!n || n.toLowerCase() ===
|
|
1290
|
+
if (!n || n.toLowerCase() === ht)
|
|
1291
1291
|
return null;
|
|
1292
1292
|
const a = await this.getProjectCollaborators(t, o), i = ao(a, n, { partial: !1 });
|
|
1293
1293
|
return i ? io(i) : null;
|
|
@@ -1306,7 +1306,7 @@ class zn {
|
|
|
1306
1306
|
* Get collaborators for a specific project
|
|
1307
1307
|
*/
|
|
1308
1308
|
async getProjectCollaborators(t, o, r) {
|
|
1309
|
-
const n = r === void 0 ? await this.getCacheScope(t) : r, a = this.getCacheKey(n, `project_${o}`), i = a ?
|
|
1309
|
+
const n = r === void 0 ? await this.getCacheScope(t) : r, a = this.getCacheKey(n, `project_${o}`), i = a ? ge.get(a) : void 0;
|
|
1310
1310
|
return i !== void 0 ? i : a ? no(
|
|
1311
1311
|
a,
|
|
1312
1312
|
() => this.fetchProjectCollaborators(t, o, a)
|
|
@@ -1317,7 +1317,7 @@ class zn {
|
|
|
1317
1317
|
const a = (await H({
|
|
1318
1318
|
apiMethod: (i) => t.getProjectCollaborators(o, i)
|
|
1319
1319
|
})).filter((i) => i?.id && i.name && i.email);
|
|
1320
|
-
return r &&
|
|
1320
|
+
return r && ge.set(r, a), a;
|
|
1321
1321
|
} catch {
|
|
1322
1322
|
return [];
|
|
1323
1323
|
}
|
|
@@ -1326,7 +1326,7 @@ class zn {
|
|
|
1326
1326
|
* Get all collaborators from all shared projects, deduplicated by user ID.
|
|
1327
1327
|
*/
|
|
1328
1328
|
async getAllCollaborators(t, o) {
|
|
1329
|
-
const r = o === void 0 ? await this.getCacheScope(t) : o, n = this.getCacheKey(r, "all_collaborators"), a = n ?
|
|
1329
|
+
const r = o === void 0 ? await this.getCacheScope(t) : o, n = this.getCacheKey(r, "all_collaborators"), a = n ? ge.get(n) : void 0;
|
|
1330
1330
|
return a !== void 0 ? a : n ? no(
|
|
1331
1331
|
n,
|
|
1332
1332
|
() => this.fetchAllCollaborators(t, r, n)
|
|
@@ -1340,7 +1340,7 @@ class zn {
|
|
|
1340
1340
|
})).filter((l) => l.isShared);
|
|
1341
1341
|
if (a.length === 0) {
|
|
1342
1342
|
const l = [];
|
|
1343
|
-
return r &&
|
|
1343
|
+
return r && ge.set(r, l), l;
|
|
1344
1344
|
}
|
|
1345
1345
|
const i = [], c = /* @__PURE__ */ new Set(), d = a.map(
|
|
1346
1346
|
(l) => this.getProjectCollaborators(t, l.id, o)
|
|
@@ -1349,7 +1349,7 @@ class zn {
|
|
|
1349
1349
|
if (l.status === "fulfilled")
|
|
1350
1350
|
for (const p of l.value)
|
|
1351
1351
|
p && !c.has(p.id) && (i.push(p), c.add(p.id));
|
|
1352
|
-
return r &&
|
|
1352
|
+
return r && ge.set(r, i), i;
|
|
1353
1353
|
} catch {
|
|
1354
1354
|
return [];
|
|
1355
1355
|
}
|
|
@@ -1399,18 +1399,18 @@ class zn {
|
|
|
1399
1399
|
* Clear all caches - useful for testing
|
|
1400
1400
|
*/
|
|
1401
1401
|
clearCache() {
|
|
1402
|
-
|
|
1402
|
+
Je.clear(), ge.clear(), Ae.clear();
|
|
1403
1403
|
}
|
|
1404
1404
|
}
|
|
1405
|
-
const L = new
|
|
1406
|
-
function
|
|
1405
|
+
const L = new qn();
|
|
1406
|
+
function ke(e, t, o) {
|
|
1407
1407
|
return L.getUserShortNames(
|
|
1408
1408
|
e,
|
|
1409
1409
|
t.filter((r) => r.responsibleUid).map((r) => r.projectId),
|
|
1410
1410
|
o
|
|
1411
1411
|
);
|
|
1412
1412
|
}
|
|
1413
|
-
async function
|
|
1413
|
+
async function zn(e, t) {
|
|
1414
1414
|
return L.resolveUser(e, t);
|
|
1415
1415
|
}
|
|
1416
1416
|
async function hs(e, t) {
|
|
@@ -1435,20 +1435,20 @@ async function hs(e, t) {
|
|
|
1435
1435
|
return n;
|
|
1436
1436
|
}
|
|
1437
1437
|
const ms = ["assigned", "unassignedOrMe", "all"];
|
|
1438
|
-
async function
|
|
1438
|
+
async function Dt(e, t) {
|
|
1439
1439
|
if (!t)
|
|
1440
1440
|
return;
|
|
1441
|
-
const o = await
|
|
1441
|
+
const o = await zn(e, t);
|
|
1442
1442
|
if (!o)
|
|
1443
1443
|
throw new Error(
|
|
1444
1444
|
`Could not find user: "${t}". Make sure the user is a collaborator on a shared project.`
|
|
1445
1445
|
);
|
|
1446
1446
|
return { userId: o.userId, email: o.email };
|
|
1447
1447
|
}
|
|
1448
|
-
function
|
|
1448
|
+
function Ie(e, t) {
|
|
1449
1449
|
return t.length === 0 ? e : e.length === 0 ? t : `${e} & ${t}`;
|
|
1450
1450
|
}
|
|
1451
|
-
function
|
|
1451
|
+
function mt({
|
|
1452
1452
|
resolvedAssigneeId: e,
|
|
1453
1453
|
assigneeEmail: t,
|
|
1454
1454
|
currentUserId: o,
|
|
@@ -1457,7 +1457,7 @@ function ft({
|
|
|
1457
1457
|
const n = !!(e && t) && e === o;
|
|
1458
1458
|
return e && t && !n ? `assigned to: ${t}` : n || r === "unassignedOrMe" ? "!assigned to: others" : r === "assigned" ? "assigned to: others" : "";
|
|
1459
1459
|
}
|
|
1460
|
-
function
|
|
1460
|
+
function Yn({
|
|
1461
1461
|
tasks: e,
|
|
1462
1462
|
resolvedAssigneeId: t,
|
|
1463
1463
|
currentUserId: o,
|
|
@@ -1491,13 +1491,13 @@ async function H(e) {
|
|
|
1491
1491
|
} while (a !== null);
|
|
1492
1492
|
return n;
|
|
1493
1493
|
}
|
|
1494
|
-
function
|
|
1494
|
+
function xt(e) {
|
|
1495
1495
|
return /(?<!\\)(?:\\\\)*\*/.test(e) ? e : `*${e.replaceAll(/\\(?!\*)/g, "\\\\")}*`;
|
|
1496
1496
|
}
|
|
1497
1497
|
async function fs(e, t) {
|
|
1498
1498
|
return H({
|
|
1499
1499
|
apiMethod: e.searchProjects.bind(e),
|
|
1500
|
-
args: { query:
|
|
1500
|
+
args: { query: xt(t) },
|
|
1501
1501
|
limit: E.PROJECTS_MAX
|
|
1502
1502
|
});
|
|
1503
1503
|
}
|
|
@@ -1508,7 +1508,7 @@ async function bs(e, t) {
|
|
|
1508
1508
|
limit: E.PROJECTS_MAX
|
|
1509
1509
|
});
|
|
1510
1510
|
}
|
|
1511
|
-
async function
|
|
1511
|
+
async function Ot(e) {
|
|
1512
1512
|
const t = await j(() => e.getWorkspaces());
|
|
1513
1513
|
return (await Promise.all(
|
|
1514
1514
|
t.map(
|
|
@@ -1520,23 +1520,23 @@ async function _t(e) {
|
|
|
1520
1520
|
)
|
|
1521
1521
|
)).flat().filter((r) => r.role === null);
|
|
1522
1522
|
}
|
|
1523
|
-
async function re(e, t, o = () =>
|
|
1523
|
+
async function re(e, t, o = () => Ot(e)) {
|
|
1524
1524
|
try {
|
|
1525
1525
|
return await e.getProject(t);
|
|
1526
1526
|
} catch (r) {
|
|
1527
|
-
throw Be(r) !== 404 ? r : await
|
|
1527
|
+
throw Be(r) !== 404 ? r : await Vn(t, o);
|
|
1528
1528
|
}
|
|
1529
1529
|
}
|
|
1530
|
-
function
|
|
1530
|
+
function Gn(e) {
|
|
1531
1531
|
const t = /* @__PURE__ */ new Map();
|
|
1532
1532
|
let o;
|
|
1533
|
-
const r = () => o ??=
|
|
1533
|
+
const r = () => o ??= Ot(e);
|
|
1534
1534
|
return (n) => {
|
|
1535
1535
|
let a = t.get(n);
|
|
1536
1536
|
return a || (a = j(() => re(e, n, r)), t.set(n, a)), a;
|
|
1537
1537
|
};
|
|
1538
1538
|
}
|
|
1539
|
-
async function
|
|
1539
|
+
async function Vn(e, t) {
|
|
1540
1540
|
let o;
|
|
1541
1541
|
try {
|
|
1542
1542
|
o = (await t()).find((r) => r.id === e);
|
|
@@ -1551,7 +1551,7 @@ async function Jn(e, t) {
|
|
|
1551
1551
|
`Project ${e} was not found. It isn't one of the user's projects or a workspace project they can join: the ID may be wrong, the project may have been archived or deleted, or it may be restricted to people who were invited.`
|
|
1552
1552
|
);
|
|
1553
1553
|
}
|
|
1554
|
-
async function
|
|
1554
|
+
async function Jn(e) {
|
|
1555
1555
|
return H({
|
|
1556
1556
|
apiMethod: e.getArchivedProjects.bind(e),
|
|
1557
1557
|
args: {},
|
|
@@ -1567,22 +1567,22 @@ function gs(e) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
return new RegExp(o ? `^${n}$` : n, "iu");
|
|
1569
1569
|
}
|
|
1570
|
-
async function
|
|
1570
|
+
async function Xn(e, t) {
|
|
1571
1571
|
return H({
|
|
1572
1572
|
apiMethod: e.searchLabels.bind(e),
|
|
1573
|
-
args: { query:
|
|
1573
|
+
args: { query: xt(t) },
|
|
1574
1574
|
limit: E.LABELS_MAX
|
|
1575
1575
|
});
|
|
1576
1576
|
}
|
|
1577
|
-
async function
|
|
1577
|
+
async function Zn(e) {
|
|
1578
1578
|
return H({
|
|
1579
1579
|
apiMethod: e.getSharedLabels.bind(e),
|
|
1580
1580
|
args: {},
|
|
1581
1581
|
limit: E.LABELS_MAX
|
|
1582
1582
|
});
|
|
1583
1583
|
}
|
|
1584
|
-
async function
|
|
1585
|
-
const r =
|
|
1584
|
+
async function Qn(e, t, o) {
|
|
1585
|
+
const r = xt(t);
|
|
1586
1586
|
return H({
|
|
1587
1587
|
apiMethod: e.searchSections.bind(e),
|
|
1588
1588
|
args: o ? { query: r, projectId: o } : { query: r },
|
|
@@ -1597,12 +1597,12 @@ function K(e) {
|
|
|
1597
1597
|
dueDate: e.due?.date,
|
|
1598
1598
|
recurring: e.due?.isRecurring && e.due.string ? e.due.string : !1,
|
|
1599
1599
|
deadlineDate: e.deadline?.date,
|
|
1600
|
-
priority:
|
|
1600
|
+
priority: Wn(e.priority) ?? "p4",
|
|
1601
1601
|
projectId: e.projectId,
|
|
1602
1602
|
sectionId: e.sectionId ?? void 0,
|
|
1603
1603
|
parentId: e.parentId ?? void 0,
|
|
1604
1604
|
labels: e.labels,
|
|
1605
|
-
duration: e.duration ?
|
|
1605
|
+
duration: e.duration ? Fn(e.duration.amount, e.duration.unit) : void 0,
|
|
1606
1606
|
responsibleUid: e.responsibleUid ?? void 0,
|
|
1607
1607
|
assignedByUid: e.assignedByUid ?? void 0,
|
|
1608
1608
|
// Only emitted when true: a deleted task is the exception, and every list
|
|
@@ -1631,7 +1631,7 @@ function he(e) {
|
|
|
1631
1631
|
isArchived: e.isArchived
|
|
1632
1632
|
};
|
|
1633
1633
|
}
|
|
1634
|
-
function
|
|
1634
|
+
function Pe(e) {
|
|
1635
1635
|
return {
|
|
1636
1636
|
id: e.id,
|
|
1637
1637
|
taskId: e.taskId ?? void 0,
|
|
@@ -1656,7 +1656,7 @@ function Ue(e) {
|
|
|
1656
1656
|
} : void 0
|
|
1657
1657
|
};
|
|
1658
1658
|
}
|
|
1659
|
-
function
|
|
1659
|
+
function ea(e) {
|
|
1660
1660
|
return {
|
|
1661
1661
|
id: e.id ?? void 0,
|
|
1662
1662
|
objectType: e.objectType,
|
|
@@ -1669,19 +1669,19 @@ function ta(e) {
|
|
|
1669
1669
|
extraData: e.extraData ?? void 0
|
|
1670
1670
|
};
|
|
1671
1671
|
}
|
|
1672
|
-
const
|
|
1673
|
-
httpStatusCode:
|
|
1674
|
-
responseData:
|
|
1675
|
-
error:
|
|
1676
|
-
errorCode:
|
|
1677
|
-
errorTag:
|
|
1672
|
+
const ta = fe.object({
|
|
1673
|
+
httpStatusCode: fe.number(),
|
|
1674
|
+
responseData: fe.object({
|
|
1675
|
+
error: fe.string(),
|
|
1676
|
+
errorCode: fe.number(),
|
|
1677
|
+
errorTag: fe.string()
|
|
1678
1678
|
})
|
|
1679
1679
|
});
|
|
1680
1680
|
function Ke(e) {
|
|
1681
1681
|
const t = e?.trim();
|
|
1682
1682
|
return t && t !== "0" ? e : void 0;
|
|
1683
1683
|
}
|
|
1684
|
-
async function
|
|
1684
|
+
async function _t({
|
|
1685
1685
|
client: e,
|
|
1686
1686
|
query: t,
|
|
1687
1687
|
limit: o,
|
|
@@ -1691,7 +1691,7 @@ async function Pt({
|
|
|
1691
1691
|
const { results: n, nextCursor: a } = await e.getTasksByFilter({ query: t, cursor: r, limit: o });
|
|
1692
1692
|
return { tasks: n.map(K), nextCursor: a };
|
|
1693
1693
|
} catch (n) {
|
|
1694
|
-
const a =
|
|
1694
|
+
const a = ta.safeParse(n);
|
|
1695
1695
|
if (!a.success)
|
|
1696
1696
|
throw n;
|
|
1697
1697
|
const { responseData: i } = a.data;
|
|
@@ -1709,7 +1709,7 @@ function co(e) {
|
|
|
1709
1709
|
timezone: e.timezone ?? void 0
|
|
1710
1710
|
};
|
|
1711
1711
|
}
|
|
1712
|
-
function
|
|
1712
|
+
function Oe(e) {
|
|
1713
1713
|
const t = {
|
|
1714
1714
|
id: e.id,
|
|
1715
1715
|
taskId: e.itemId,
|
|
@@ -1760,27 +1760,27 @@ function P(e, t, o) {
|
|
|
1760
1760
|
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 });
|
|
1761
1761
|
}), { succeeded: r, failures: n };
|
|
1762
1762
|
}
|
|
1763
|
-
const lo = "[redacted]",
|
|
1763
|
+
const lo = "[redacted]", oa = /"[^"]*"/g;
|
|
1764
1764
|
function O(e, t, o, r = {}) {
|
|
1765
1765
|
if (o.length === 0)
|
|
1766
1766
|
return;
|
|
1767
|
-
const n = o.slice(0,
|
|
1767
|
+
const n = o.slice(0, Tr.MAX_FAILURES_LOGGED);
|
|
1768
1768
|
console.error(`${e}: items failed`, {
|
|
1769
1769
|
failed: o.length,
|
|
1770
1770
|
of: t,
|
|
1771
1771
|
sample: n.map((a) => ({
|
|
1772
1772
|
...a,
|
|
1773
1773
|
item: r.redactItems ? lo : a.item,
|
|
1774
|
-
error: a.error.replace(
|
|
1774
|
+
error: a.error.replace(oa, `"${lo}"`)
|
|
1775
1775
|
}))
|
|
1776
1776
|
});
|
|
1777
1777
|
}
|
|
1778
1778
|
const ws = "none";
|
|
1779
|
-
function
|
|
1779
|
+
function sa(e) {
|
|
1780
1780
|
return e.length === 1 && e[0]?.trim().toLowerCase() === ws;
|
|
1781
1781
|
}
|
|
1782
|
-
async function
|
|
1783
|
-
const n = await
|
|
1782
|
+
async function ra(e, t, o, r = (n) => e.getTask(n)) {
|
|
1783
|
+
const n = await na(e, t);
|
|
1784
1784
|
if (n)
|
|
1785
1785
|
return uo(
|
|
1786
1786
|
[...n.uidsToNotify ?? [], n.postedUid],
|
|
@@ -1791,7 +1791,7 @@ async function na(e, t, o, r = (n) => e.getTask(n)) {
|
|
|
1791
1791
|
const a = await r(t.taskId);
|
|
1792
1792
|
return uo([a.responsibleUid, a.assignedByUid, a.addedByUid], o);
|
|
1793
1793
|
}
|
|
1794
|
-
async function
|
|
1794
|
+
async function na(e, t) {
|
|
1795
1795
|
let o, r = null;
|
|
1796
1796
|
do {
|
|
1797
1797
|
const n = await e.getComments({
|
|
@@ -1810,22 +1810,22 @@ function uo(e, t) {
|
|
|
1810
1810
|
r && r !== t && o.add(r);
|
|
1811
1811
|
return [...o];
|
|
1812
1812
|
}
|
|
1813
|
-
const qe =
|
|
1814
|
-
function
|
|
1813
|
+
const qe = rt.map((e) => e.key);
|
|
1814
|
+
function aa(e) {
|
|
1815
1815
|
if (typeof e != "string") return;
|
|
1816
1816
|
const t = e.toLowerCase();
|
|
1817
|
-
return (
|
|
1817
|
+
return (rt.find((r) => r.key === t) ?? rt.find((r) => r.displayName.toLowerCase() === t))?.key;
|
|
1818
1818
|
}
|
|
1819
|
-
const
|
|
1819
|
+
const ia = `Color for the entity. Accepts a color key (e.g. "berry_red") or display name (e.g. "Berry Red"). Valid colors: ${qe.join(", ")}. Unrecognized colors are omitted and charcoal will be used as the default.`, Se = s.preprocess(aa, s.enum(qe).optional()).describe(ia);
|
|
1820
1820
|
s.enum(qe);
|
|
1821
|
-
const
|
|
1821
|
+
const Ce = s.enum(qe).optional().catch(void 0), ee = s.object({
|
|
1822
1822
|
id: s.string(),
|
|
1823
1823
|
content: s.string().describe("Task title."),
|
|
1824
1824
|
description: s.string(),
|
|
1825
1825
|
dueDate: s.string().optional().describe("ISO 8601."),
|
|
1826
1826
|
recurring: s.union([s.boolean(), s.string()]).describe("False when not recurring, otherwise the recurrence string."),
|
|
1827
1827
|
deadlineDate: s.string().optional().describe("ISO 8601."),
|
|
1828
|
-
priority:
|
|
1828
|
+
priority: At.describe("p1 is highest, p4 lowest."),
|
|
1829
1829
|
projectId: s.string(),
|
|
1830
1830
|
sectionId: s.string().optional(),
|
|
1831
1831
|
parentId: s.string().optional(),
|
|
@@ -1842,7 +1842,7 @@ const je = s.enum(qe).optional().catch(void 0), ee = s.object({
|
|
|
1842
1842
|
id: s.string(),
|
|
1843
1843
|
name: s.string(),
|
|
1844
1844
|
description: s.string().describe("Empty string when none."),
|
|
1845
|
-
color:
|
|
1845
|
+
color: Ce,
|
|
1846
1846
|
icon: s.string().optional(),
|
|
1847
1847
|
isFavorite: s.boolean(),
|
|
1848
1848
|
isShared: s.boolean(),
|
|
@@ -1862,15 +1862,15 @@ const je = s.enum(qe).optional().catch(void 0), ee = s.object({
|
|
|
1862
1862
|
function ne({ id: e, name: t, sectionOrder: o, description: r }) {
|
|
1863
1863
|
return { id: e, name: t, sectionOrder: o, description: r ?? void 0 };
|
|
1864
1864
|
}
|
|
1865
|
-
const
|
|
1865
|
+
const Pt = s.object({
|
|
1866
1866
|
id: s.string(),
|
|
1867
1867
|
name: s.string(),
|
|
1868
1868
|
workspaceId: s.string()
|
|
1869
1869
|
});
|
|
1870
|
-
function
|
|
1870
|
+
function Ut({ id: e, name: t, workspaceId: o }) {
|
|
1871
1871
|
return { id: e, name: t, workspaceId: o };
|
|
1872
1872
|
}
|
|
1873
|
-
const
|
|
1873
|
+
const ca = s.object({
|
|
1874
1874
|
resourceType: s.string().describe("file, url, image, etc."),
|
|
1875
1875
|
fileName: s.string().optional(),
|
|
1876
1876
|
fileSize: s.number().optional().describe("Bytes."),
|
|
@@ -1883,7 +1883,7 @@ const da = s.object({
|
|
|
1883
1883
|
image: s.string().optional().describe("For image resource types."),
|
|
1884
1884
|
imageWidth: s.number().optional().describe("Pixels."),
|
|
1885
1885
|
imageHeight: s.number().optional().describe("Pixels.")
|
|
1886
|
-
}),
|
|
1886
|
+
}), Ue = s.object({
|
|
1887
1887
|
id: s.string(),
|
|
1888
1888
|
taskId: s.string().optional(),
|
|
1889
1889
|
projectId: s.string().optional(),
|
|
@@ -1891,8 +1891,8 @@ const da = s.object({
|
|
|
1891
1891
|
postedAt: s.string().describe("ISO 8601."),
|
|
1892
1892
|
postedUid: s.string().optional(),
|
|
1893
1893
|
notifiedUserIds: s.array(s.string()).optional().describe("Users notified about this comment. Absent when nobody was notified."),
|
|
1894
|
-
fileAttachment:
|
|
1895
|
-
}),
|
|
1894
|
+
fileAttachment: ca.optional()
|
|
1895
|
+
}), da = s.object({
|
|
1896
1896
|
id: s.string().optional(),
|
|
1897
1897
|
objectType: s.string().describe("task, project, etc."),
|
|
1898
1898
|
objectId: s.string(),
|
|
@@ -1902,29 +1902,29 @@ const da = s.object({
|
|
|
1902
1902
|
parentItemId: s.string().optional(),
|
|
1903
1903
|
initiatorId: s.string().optional().describe("User who initiated the event."),
|
|
1904
1904
|
extraData: s.record(s.string(), s.unknown()).optional()
|
|
1905
|
-
}),
|
|
1905
|
+
}), la = s.object({
|
|
1906
1906
|
id: s.string(),
|
|
1907
1907
|
name: s.string(),
|
|
1908
1908
|
email: s.string()
|
|
1909
|
-
}),
|
|
1909
|
+
}), je = s.object({
|
|
1910
1910
|
id: s.string(),
|
|
1911
1911
|
name: s.string(),
|
|
1912
|
-
color:
|
|
1912
|
+
color: Ce,
|
|
1913
1913
|
order: s.number().optional().catch(void 0).describe("Display order."),
|
|
1914
1914
|
isFavorite: s.boolean()
|
|
1915
|
-
}),
|
|
1915
|
+
}), ua = s.object({
|
|
1916
1916
|
isRecurring: s.boolean(),
|
|
1917
1917
|
string: s.string().describe("Human-readable due string."),
|
|
1918
1918
|
date: s.string().describe("ISO 8601."),
|
|
1919
1919
|
datetime: s.string().optional().describe("ISO 8601."),
|
|
1920
1920
|
timezone: s.string().optional()
|
|
1921
|
-
}),
|
|
1921
|
+
}), Rt = s.object({
|
|
1922
1922
|
id: s.string(),
|
|
1923
1923
|
taskId: s.string(),
|
|
1924
|
-
type: s.enum(
|
|
1924
|
+
type: s.enum(lr),
|
|
1925
1925
|
notifyUid: s.string().optional().describe("User ID the reminder notifies."),
|
|
1926
1926
|
minuteOffset: s.number().optional().describe("Minutes before due. Relative reminders only."),
|
|
1927
|
-
due:
|
|
1927
|
+
due: ua.optional().describe("Absolute, and sometimes relative, reminders."),
|
|
1928
1928
|
name: s.string().optional().describe("Location name. Location reminders only."),
|
|
1929
1929
|
locLat: s.string().optional().describe("Location reminders only."),
|
|
1930
1930
|
locLong: s.string().optional().describe("Location reminders only."),
|
|
@@ -1936,11 +1936,11 @@ const da = s.object({
|
|
|
1936
1936
|
error: s.string(),
|
|
1937
1937
|
code: s.string().optional()
|
|
1938
1938
|
});
|
|
1939
|
-
function
|
|
1939
|
+
function De(e = /* @__PURE__ */ new Date()) {
|
|
1940
1940
|
const t = e.getFullYear(), o = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
|
|
1941
1941
|
return `${t}-${o}-${r}`;
|
|
1942
1942
|
}
|
|
1943
|
-
function
|
|
1943
|
+
function Nt(e, t, o = {}) {
|
|
1944
1944
|
const { context: r, showDetails: n = !1 } = o, a = t.length, i = [], d = `${e} ${a} ${a === 1 ? "task" : "tasks"}${r ? ` ${r}` : ""}.`;
|
|
1945
1945
|
i.push(d);
|
|
1946
1946
|
const u = 5;
|
|
@@ -1955,16 +1955,16 @@ ${l}${p}.`);
|
|
|
1955
1955
|
return i.join(`
|
|
1956
1956
|
`);
|
|
1957
1957
|
}
|
|
1958
|
-
function
|
|
1958
|
+
function Lt(e) {
|
|
1959
1959
|
const { action: t, success: o, total: r, successItems: n, successLabel: a = "Completed", failures: i } = e, c = [], d = `${t}: ${o}/${r} successful.`;
|
|
1960
1960
|
if (c.push(d), n?.length && n.length <= 5 && c.push(`${a}:
|
|
1961
1961
|
${n.map((u) => ` ${u}`).join(`
|
|
1962
1962
|
`)}.`), i?.length) {
|
|
1963
1963
|
const u = i.length, l = `Failed (${u}):
|
|
1964
|
-
${i.slice(0,
|
|
1964
|
+
${i.slice(0, xe.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
|
|
1965
1965
|
`
|
|
1966
1966
|
`
|
|
1967
|
-
)}${u >
|
|
1967
|
+
)}${u > xe.MAX_FAILURES_SHOWN ? `, +${u - xe.MAX_FAILURES_SHOWN} more` : ""}.`;
|
|
1968
1968
|
c.push(l);
|
|
1969
1969
|
}
|
|
1970
1970
|
return c.join(`
|
|
@@ -1973,27 +1973,27 @@ ${i.slice(0, Oe.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}
|
|
|
1973
1973
|
function R(e, t) {
|
|
1974
1974
|
if (t.length === 0)
|
|
1975
1975
|
return e;
|
|
1976
|
-
const o = t.slice(0,
|
|
1976
|
+
const o = t.slice(0, xe.MAX_FAILURES_SHOWN), r = t.length - o.length, n = o.map((i) => ` ${i.item}: ${i.error}`).join(`
|
|
1977
1977
|
`), a = r > 0 ? `
|
|
1978
1978
|
+${r} more` : "";
|
|
1979
1979
|
return `${e}
|
|
1980
1980
|
Failed (${t.length}) - address or drop these items:
|
|
1981
1981
|
${n}${a}`;
|
|
1982
1982
|
}
|
|
1983
|
-
function
|
|
1983
|
+
function pa(e, t) {
|
|
1984
1984
|
const o = e.content || e.title || "Untitled", r = e.dueDate ? ` • due ${e.dueDate}` : "", n = e.priority ? ` • ${e.priority.toUpperCase()}` : "", a = e.projectName ? ` • ${e.projectName}` : "", i = t && e.responsibleUid ? ` • +${t.get(e.responsibleUid) ?? e.responsibleUid}` : "", c = e.id ? ` • id=${e.id}` : "";
|
|
1985
1985
|
return ` ${o}${r}${n}${a}${i}${c}`;
|
|
1986
1986
|
}
|
|
1987
|
-
function
|
|
1987
|
+
function ha(e) {
|
|
1988
1988
|
const t = ` (${e.color})`, o = e.isFavorite ? " • ⭐" : "", r = ` • id=${e.id}`;
|
|
1989
1989
|
return ` ${e.name}${t}${o}${r}`;
|
|
1990
1990
|
}
|
|
1991
|
-
function
|
|
1991
|
+
function ma(e) {
|
|
1992
1992
|
const t = e.inboxProject ? " • Inbox" : "", o = e.isFavorite ? " • ⭐" : "", r = e.isShared ? " • Shared" : "", n = e.isArchived ? " • Archived" : "", a = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", i = ` • id=${e.id}`;
|
|
1993
1993
|
return ` ${e.name}${t}${o}${r}${n}${a}${i}`;
|
|
1994
1994
|
}
|
|
1995
1995
|
function ze(e, t = 5, o) {
|
|
1996
|
-
const n = e.slice(0, t).map((a) =>
|
|
1996
|
+
const n = e.slice(0, t).map((a) => pa(a, o)).join(`
|
|
1997
1997
|
`);
|
|
1998
1998
|
if (e.length > t) {
|
|
1999
1999
|
const a = e.length - t;
|
|
@@ -2024,7 +2024,7 @@ function Ts(e, t) {
|
|
|
2024
2024
|
${o.map((n) => `- ${n}`).join(`
|
|
2025
2025
|
`)}`;
|
|
2026
2026
|
}
|
|
2027
|
-
const
|
|
2027
|
+
const fa = s.object({
|
|
2028
2028
|
taskId: s.string().optional().describe("The ID of the task to comment on."),
|
|
2029
2029
|
projectId: s.string().optional().describe(
|
|
2030
2030
|
'The ID of the project to comment on. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
@@ -2033,10 +2033,10 @@ const ba = s.object({
|
|
|
2033
2033
|
notifyUsers: s.array(s.string().min(1)).min(1).max(E.NOTIFY_USERS_MAX).optional().describe(
|
|
2034
2034
|
`Who to notify about this comment — a user ID, email, full name, or "me" for each person. Set this whenever the comment mentions someone; the text of an @mention notifies nobody on its own. Omit to notify whoever the Todoist apps would (the task's assignee, assigner and creator on a first comment, or the previous comment's participants on a reply). Pass ["${ws}"] to notify nobody.`
|
|
2035
2035
|
)
|
|
2036
|
-
}),
|
|
2037
|
-
comments: s.array(
|
|
2038
|
-
},
|
|
2039
|
-
comments: s.array(
|
|
2036
|
+
}), ba = {
|
|
2037
|
+
comments: s.array(fa).min(1).max(D.ITEMS_PER_OPERATION).describe("The array of comments to add.")
|
|
2038
|
+
}, ga = {
|
|
2039
|
+
comments: s.array(Ue).describe("The created comments."),
|
|
2040
2040
|
totalCount: s.number().describe("The total number of comments created."),
|
|
2041
2041
|
addedCommentIds: s.array(s.string()).describe("The IDs of the added comments."),
|
|
2042
2042
|
failures: s.array(_).describe(
|
|
@@ -2045,11 +2045,11 @@ const ba = s.object({
|
|
|
2045
2045
|
totalRequested: s.number(),
|
|
2046
2046
|
successCount: s.number(),
|
|
2047
2047
|
failureCount: s.number()
|
|
2048
|
-
},
|
|
2048
|
+
}, ya = {
|
|
2049
2049
|
name: y.ADD_COMMENTS,
|
|
2050
2050
|
description: "Add multiple comments to tasks or projects, optionally notifying collaborators. Each comment must specify either taskId or projectId.",
|
|
2051
|
-
parameters:
|
|
2052
|
-
outputSchema:
|
|
2051
|
+
parameters: ba,
|
|
2052
|
+
outputSchema: ga,
|
|
2053
2053
|
// Open world: a comment notifies other people.
|
|
2054
2054
|
annotations: {
|
|
2055
2055
|
readOnlyHint: !1,
|
|
@@ -2068,14 +2068,14 @@ const ba = s.object({
|
|
|
2068
2068
|
const c = /* @__PURE__ */ new Map();
|
|
2069
2069
|
async function d({ notifyUsers: g }, w) {
|
|
2070
2070
|
if (g)
|
|
2071
|
-
return
|
|
2071
|
+
return sa(g) ? [] : (await j(() => hs(t, g))).map((q) => q.userId);
|
|
2072
2072
|
const { id: I } = await n(), k = w.taskId ? `task:${w.taskId}` : `project:${w.projectId}`;
|
|
2073
2073
|
let S = c.get(k);
|
|
2074
|
-
return S || (S =
|
|
2074
|
+
return S || (S = ra(t, w, I, i), c.set(k, S)), await S;
|
|
2075
2075
|
}
|
|
2076
2076
|
const u = await Promise.allSettled(
|
|
2077
2077
|
o.map(async (g) => {
|
|
2078
|
-
const w = await
|
|
2078
|
+
const w = await wa(g, n), I = await d(g, w);
|
|
2079
2079
|
return { target: w, uidsToNotify: I };
|
|
2080
2080
|
})
|
|
2081
2081
|
), l = await Promise.allSettled(
|
|
@@ -2097,15 +2097,15 @@ const ba = s.object({
|
|
|
2097
2097
|
o,
|
|
2098
2098
|
l,
|
|
2099
2099
|
(g) => g.content
|
|
2100
|
-
), h = p.map(({ value: g }) =>
|
|
2100
|
+
), h = p.map(({ value: g }) => Pe(g));
|
|
2101
2101
|
O(y.ADD_COMMENTS, o.length, f, { redactItems: !0 });
|
|
2102
|
-
const m = await
|
|
2102
|
+
const m = await Ta(t, h, {
|
|
2103
2103
|
getTask: i,
|
|
2104
2104
|
getCurrentUser: n
|
|
2105
2105
|
});
|
|
2106
2106
|
return {
|
|
2107
2107
|
textContent: R(
|
|
2108
|
-
|
|
2108
|
+
ka({ comments: h, notifiedNames: m }),
|
|
2109
2109
|
f
|
|
2110
2110
|
),
|
|
2111
2111
|
structuredContent: {
|
|
@@ -2120,7 +2120,7 @@ const ba = s.object({
|
|
|
2120
2120
|
};
|
|
2121
2121
|
}
|
|
2122
2122
|
};
|
|
2123
|
-
async function
|
|
2123
|
+
async function wa(e, t) {
|
|
2124
2124
|
if (!e.taskId && !e.projectId)
|
|
2125
2125
|
throw new Error("Either taskId or projectId must be provided.");
|
|
2126
2126
|
if (e.taskId && e.projectId)
|
|
@@ -2130,7 +2130,7 @@ async function Ta(e, t) {
|
|
|
2130
2130
|
user: Q(e.projectId) ? await t() : void 0
|
|
2131
2131
|
}) };
|
|
2132
2132
|
}
|
|
2133
|
-
async function
|
|
2133
|
+
async function Ta(e, t, {
|
|
2134
2134
|
getTask: o,
|
|
2135
2135
|
getCurrentUser: r
|
|
2136
2136
|
}) {
|
|
@@ -2148,7 +2148,7 @@ async function ka(e, t, {
|
|
|
2148
2148
|
i
|
|
2149
2149
|
).catch(() => /* @__PURE__ */ new Map());
|
|
2150
2150
|
}
|
|
2151
|
-
function
|
|
2151
|
+
function ka({
|
|
2152
2152
|
comments: e,
|
|
2153
2153
|
notifiedNames: t
|
|
2154
2154
|
}) {
|
|
@@ -2167,14 +2167,14 @@ function Ia({
|
|
|
2167
2167
|
function M(e) {
|
|
2168
2168
|
return s.string().transform((t) => t === "" ? void 0 : t).optional().describe(e);
|
|
2169
2169
|
}
|
|
2170
|
-
const
|
|
2171
|
-
async function
|
|
2170
|
+
const Ia = { status: "fulfilled", value: void 0 };
|
|
2171
|
+
async function G(e, t, { limit: o = (r) => r() } = {}) {
|
|
2172
2172
|
let r, n;
|
|
2173
2173
|
try {
|
|
2174
2174
|
const i = await j(() => o(() => e.sync({ commands: t })));
|
|
2175
2175
|
r = i.syncStatus ?? {}, n = i.tempIdMapping ?? {};
|
|
2176
2176
|
} catch (i) {
|
|
2177
|
-
if (!(i instanceof
|
|
2177
|
+
if (!(i instanceof ur))
|
|
2178
2178
|
return {
|
|
2179
2179
|
outcomes: t.map(() => ({ status: "rejected", reason: i })),
|
|
2180
2180
|
tempIdMapping: {},
|
|
@@ -2184,40 +2184,40 @@ async function V(e, t, { limit: o = (r) => r() } = {}) {
|
|
|
2184
2184
|
}
|
|
2185
2185
|
return { outcomes: t.map((i) => {
|
|
2186
2186
|
const c = r[i.uuid];
|
|
2187
|
-
return c === "ok" ?
|
|
2187
|
+
return c === "ok" ? Ia : c === void 0 ? {
|
|
2188
2188
|
status: "rejected",
|
|
2189
2189
|
reason: new Error("Todoist did not report whether this change was applied")
|
|
2190
2190
|
} : {
|
|
2191
2191
|
status: "rejected",
|
|
2192
|
-
reason: new
|
|
2192
|
+
reason: new pr(c.error, c.httpCode, c)
|
|
2193
2193
|
};
|
|
2194
2194
|
}), tempIdMapping: n, requestFailed: !1 };
|
|
2195
2195
|
}
|
|
2196
2196
|
function ks(e) {
|
|
2197
2197
|
return e.description || void 0;
|
|
2198
2198
|
}
|
|
2199
|
-
const
|
|
2199
|
+
const va = {
|
|
2200
2200
|
search: s.string().optional().describe(
|
|
2201
2201
|
"Search for a filter by name (partial and case insensitive match). If omitted, all filters are returned."
|
|
2202
2202
|
)
|
|
2203
|
-
},
|
|
2203
|
+
}, Mt = s.object({
|
|
2204
2204
|
id: s.string().describe("The unique ID of the filter."),
|
|
2205
2205
|
name: s.string().describe("The name of the filter."),
|
|
2206
2206
|
query: s.string().describe('The filter query string (e.g. "today & p1", "#Work & overdue").'),
|
|
2207
2207
|
description: s.string().optional().describe(
|
|
2208
2208
|
"A markdown description explaining what the filter is for. Omitted when the filter has none."
|
|
2209
2209
|
),
|
|
2210
|
-
color:
|
|
2210
|
+
color: Ce,
|
|
2211
2211
|
isFavorite: s.boolean().describe("Whether the filter is marked as favorite."),
|
|
2212
2212
|
itemOrder: s.number().describe("The display order of the filter.")
|
|
2213
|
-
}),
|
|
2214
|
-
filters: s.array(
|
|
2213
|
+
}), Sa = {
|
|
2214
|
+
filters: s.array(Mt).describe("The found filters."),
|
|
2215
2215
|
totalCount: s.number().describe("The total number of filters returned.")
|
|
2216
|
-
},
|
|
2216
|
+
}, Ca = {
|
|
2217
2217
|
name: y.FIND_FILTERS,
|
|
2218
2218
|
description: 'List all personal filters or search for filters by name. Filters are saved custom views that use query syntax to organize tasks (e.g. "today & p1", "#Work & overdue").',
|
|
2219
|
-
parameters:
|
|
2220
|
-
outputSchema:
|
|
2219
|
+
parameters: va,
|
|
2220
|
+
outputSchema: Sa,
|
|
2221
2221
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
2222
2222
|
async execute(e, t) {
|
|
2223
2223
|
let r = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((i) => !i.isDeleted);
|
|
@@ -2231,12 +2231,12 @@ const Sa = {
|
|
|
2231
2231
|
name: i.name,
|
|
2232
2232
|
query: i.query,
|
|
2233
2233
|
description: ks(i),
|
|
2234
|
-
color:
|
|
2234
|
+
color: Ce.parse(i.color),
|
|
2235
2235
|
isFavorite: i.isFavorite,
|
|
2236
2236
|
itemOrder: i.itemOrder
|
|
2237
2237
|
}));
|
|
2238
2238
|
return {
|
|
2239
|
-
textContent:
|
|
2239
|
+
textContent: ja({ filters: n, search: e.search }),
|
|
2240
2240
|
structuredContent: {
|
|
2241
2241
|
filters: n,
|
|
2242
2242
|
totalCount: n.length
|
|
@@ -2244,7 +2244,7 @@ const Sa = {
|
|
|
2244
2244
|
};
|
|
2245
2245
|
}
|
|
2246
2246
|
};
|
|
2247
|
-
function
|
|
2247
|
+
function ja({
|
|
2248
2248
|
filters: e,
|
|
2249
2249
|
search: t
|
|
2250
2250
|
}) {
|
|
@@ -2265,31 +2265,31 @@ ${n.map((a) => `- ${a}`).join(`
|
|
|
2265
2265
|
return r.join(`
|
|
2266
2266
|
`);
|
|
2267
2267
|
}
|
|
2268
|
-
const
|
|
2268
|
+
const $a = s.object({
|
|
2269
2269
|
name: s.string().min(1).describe("The name of the filter."),
|
|
2270
2270
|
query: s.string().min(1).describe(
|
|
2271
2271
|
'The filter query string. Examples: "today & p1", "#Work & overdue", "@email & today", "(p1 | p2) & !assigned". Operators: | (OR), & (AND), ! (NOT), () grouping, , (multiple queries).'
|
|
2272
2272
|
),
|
|
2273
2273
|
description: M("A markdown description explaining what the filter is for."),
|
|
2274
|
-
color:
|
|
2274
|
+
color: Se,
|
|
2275
2275
|
isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite. Defaults to false.")
|
|
2276
|
-
}),
|
|
2277
|
-
filters: s.array(
|
|
2278
|
-
},
|
|
2279
|
-
filters: s.array(
|
|
2276
|
+
}), Ea = {
|
|
2277
|
+
filters: s.array($a).min(1).max(D.ITEMS_PER_OPERATION).describe("The array of filters to add.")
|
|
2278
|
+
}, Aa = {
|
|
2279
|
+
filters: s.array(Mt).describe("The created filters."),
|
|
2280
2280
|
totalCount: s.number().describe("The total number of filters created."),
|
|
2281
2281
|
failures: s.array(_).describe("Filters that could not be created, with the reason for each."),
|
|
2282
2282
|
totalRequested: s.number(),
|
|
2283
2283
|
successCount: s.number(),
|
|
2284
2284
|
failureCount: s.number()
|
|
2285
|
-
},
|
|
2285
|
+
}, Da = {
|
|
2286
2286
|
name: y.ADD_FILTERS,
|
|
2287
2287
|
description: "Add one or more new personal filters. Filters are saved custom views using query syntax to organize tasks.",
|
|
2288
|
-
parameters:
|
|
2289
|
-
outputSchema:
|
|
2288
|
+
parameters: Ea,
|
|
2289
|
+
outputSchema: Aa,
|
|
2290
2290
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
2291
2291
|
async execute({ filters: e }, t) {
|
|
2292
|
-
const o = Date.now(), r = e.map((m, b) => `tempFilterAdd${b}${o}`), n = e.map((m, b) =>
|
|
2292
|
+
const o = Date.now(), r = e.map((m, b) => `tempFilterAdd${b}${o}`), n = e.map((m, b) => Y(
|
|
2293
2293
|
"filter_add",
|
|
2294
2294
|
{
|
|
2295
2295
|
name: m.name,
|
|
@@ -2299,7 +2299,7 @@ const Ea = s.object({
|
|
|
2299
2299
|
...m.isFavorite !== void 0 ? { isFavorite: m.isFavorite } : {}
|
|
2300
2300
|
},
|
|
2301
2301
|
r[b]
|
|
2302
|
-
)), { outcomes: a, tempIdMapping: i } = await
|
|
2302
|
+
)), { outcomes: a, tempIdMapping: i } = await G(t, n), c = e.map((m, b) => {
|
|
2303
2303
|
const g = a[b];
|
|
2304
2304
|
if (g?.status === "rejected")
|
|
2305
2305
|
return g;
|
|
@@ -2317,7 +2317,7 @@ const Ea = s.object({
|
|
|
2317
2317
|
// with `removeNullFields`, so a null would be stripped and then fail
|
|
2318
2318
|
// validation against the declared output schema.
|
|
2319
2319
|
...m.description ? { description: m.description } : {},
|
|
2320
|
-
color: m.color !== void 0 ?
|
|
2320
|
+
color: m.color !== void 0 ? Ce.parse(m.color) : void 0,
|
|
2321
2321
|
isFavorite: m.isFavorite ?? !1,
|
|
2322
2322
|
itemOrder: 0
|
|
2323
2323
|
})
|
|
@@ -2338,17 +2338,17 @@ ${f}` : "Added 0 filters";
|
|
|
2338
2338
|
}
|
|
2339
2339
|
};
|
|
2340
2340
|
}
|
|
2341
|
-
},
|
|
2342
|
-
function
|
|
2341
|
+
}, xa = 300 * 1e3;
|
|
2342
|
+
function Oa(e) {
|
|
2343
2343
|
return /^\d+$/.test(e);
|
|
2344
2344
|
}
|
|
2345
|
-
class
|
|
2345
|
+
class _a {
|
|
2346
2346
|
constructor() {
|
|
2347
2347
|
this.stateByClient = /* @__PURE__ */ new WeakMap();
|
|
2348
2348
|
}
|
|
2349
2349
|
async getWorkspaces(t) {
|
|
2350
2350
|
let o = this.stateByClient.get(t);
|
|
2351
|
-
if (o || (o = { cache: null, inFlightWorkspaces: null }, this.stateByClient.set(t, o)), o.cache && Date.now() - o.cache.timestamp <
|
|
2351
|
+
if (o || (o = { cache: null, inFlightWorkspaces: null }, this.stateByClient.set(t, o)), o.cache && Date.now() - o.cache.timestamp < xa)
|
|
2352
2352
|
return o.cache.workspaces;
|
|
2353
2353
|
if (o.inFlightWorkspaces)
|
|
2354
2354
|
return o.inFlightWorkspaces;
|
|
@@ -2375,7 +2375,7 @@ class Pa {
|
|
|
2375
2375
|
const n = await this.getWorkspaces(t), a = n.find((l) => l.id === r);
|
|
2376
2376
|
if (a)
|
|
2377
2377
|
return { workspaceId: a.id, workspaceName: a.name };
|
|
2378
|
-
if (
|
|
2378
|
+
if (Oa(r))
|
|
2379
2379
|
return { workspaceId: r, workspaceName: r };
|
|
2380
2380
|
const i = r.toLowerCase(), c = n.find((l) => l.name.toLowerCase() === i);
|
|
2381
2381
|
if (c)
|
|
@@ -2413,27 +2413,27 @@ ${l}` + (d.length > 5 ? `
|
|
|
2413
2413
|
this.stateByClient = /* @__PURE__ */ new WeakMap();
|
|
2414
2414
|
}
|
|
2415
2415
|
}
|
|
2416
|
-
const
|
|
2416
|
+
const _e = new _a(), { ADD_PROJECTS: Pa, LIST_WORKSPACES: Ua, UPDATE_PROJECTS: Ra } = y, Na = s.object({
|
|
2417
2417
|
name: s.string().min(1).describe("The name of the folder."),
|
|
2418
|
-
workspace: s.string().trim().min(1).describe(`The workspace to create the folder in, by name or ID (see ${
|
|
2419
|
-
}),
|
|
2420
|
-
folders: s.array(
|
|
2421
|
-
},
|
|
2422
|
-
folders: s.array(
|
|
2418
|
+
workspace: s.string().trim().min(1).describe(`The workspace to create the folder in, by name or ID (see ${Ua}).`)
|
|
2419
|
+
}), La = {
|
|
2420
|
+
folders: s.array(Na).min(1).max(D.ITEMS_PER_OPERATION).describe("The folders to add.")
|
|
2421
|
+
}, Ma = {
|
|
2422
|
+
folders: s.array(Pt).describe("The created folders."),
|
|
2423
2423
|
failures: s.array(_).describe("Folders that could not be created, with the reason for each."),
|
|
2424
2424
|
successCount: s.number(),
|
|
2425
2425
|
failureCount: s.number()
|
|
2426
|
-
},
|
|
2426
|
+
}, Fa = {
|
|
2427
2427
|
name: y.ADD_FOLDERS,
|
|
2428
|
-
description: `Add one or more folders to group a workspace's projects. Put projects in one with ${
|
|
2429
|
-
parameters:
|
|
2430
|
-
outputSchema:
|
|
2428
|
+
description: `Add one or more folders to group a workspace's projects. Put projects in one with ${Pa} or ${Ra} folderId.`,
|
|
2429
|
+
parameters: La,
|
|
2430
|
+
outputSchema: Ma,
|
|
2431
2431
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
2432
2432
|
async execute({ folders: e }, t) {
|
|
2433
2433
|
const o = /* @__PURE__ */ new Map(), r = (d) => {
|
|
2434
2434
|
let u = o.get(d);
|
|
2435
2435
|
return u || (u = j(
|
|
2436
|
-
() =>
|
|
2436
|
+
() => _e.resolveWorkspace(t, d)
|
|
2437
2437
|
).then(({ workspaceId: l }) => l), o.set(d, u)), u;
|
|
2438
2438
|
}, n = await Promise.allSettled(
|
|
2439
2439
|
e.map(async ({ name: d, workspace: u }) => {
|
|
@@ -2442,9 +2442,9 @@ const Pe = new Pa(), { ADD_PROJECTS: Ua, LIST_WORKSPACES: Ra, UPDATE_PROJECTS: N
|
|
|
2442
2442
|
})
|
|
2443
2443
|
), { succeeded: a, failures: i } = P(e, n, (d) => d.name), c = a.map(({ value: d }) => d);
|
|
2444
2444
|
return O(y.ADD_FOLDERS, e.length, i, { redactItems: !0 }), {
|
|
2445
|
-
textContent:
|
|
2445
|
+
textContent: Ha(c, i),
|
|
2446
2446
|
structuredContent: {
|
|
2447
|
-
folders: c.map(
|
|
2447
|
+
folders: c.map(Ut),
|
|
2448
2448
|
failures: i,
|
|
2449
2449
|
successCount: c.length,
|
|
2450
2450
|
failureCount: i.length
|
|
@@ -2452,7 +2452,7 @@ const Pe = new Pa(), { ADD_PROJECTS: Ua, LIST_WORKSPACES: Ra, UPDATE_PROJECTS: N
|
|
|
2452
2452
|
};
|
|
2453
2453
|
}
|
|
2454
2454
|
};
|
|
2455
|
-
function
|
|
2455
|
+
function Ha(e, t) {
|
|
2456
2456
|
const o = e.length, r = e.map(
|
|
2457
2457
|
(a) => `• ${a.name} (id=${a.id}, workspaceId=${a.workspaceId})`
|
|
2458
2458
|
), n = o > 0 ? `Added ${o} folder${o === 1 ? "" : "s"}:
|
|
@@ -2460,34 +2460,34 @@ ${r.join(`
|
|
|
2460
2460
|
`)}` : "Added 0 folders";
|
|
2461
2461
|
return R(n, t);
|
|
2462
2462
|
}
|
|
2463
|
-
const
|
|
2463
|
+
const Wa = s.object({
|
|
2464
2464
|
name: s.string().min(1).max(128).describe("The name of the label."),
|
|
2465
|
-
color:
|
|
2465
|
+
color: Se,
|
|
2466
2466
|
order: s.number().int().optional().describe("The position of the label in the label list."),
|
|
2467
2467
|
isFavorite: s.boolean().optional().describe("Whether the label is a favorite. Defaults to false.")
|
|
2468
|
-
}),
|
|
2469
|
-
labels: s.array(
|
|
2470
|
-
},
|
|
2471
|
-
labels: s.array(
|
|
2468
|
+
}), Ba = {
|
|
2469
|
+
labels: s.array(Wa).min(1).max(D.ITEMS_PER_OPERATION).describe("The array of labels to add.")
|
|
2470
|
+
}, Ka = {
|
|
2471
|
+
labels: s.array(je).describe("The created labels."),
|
|
2472
2472
|
totalCount: s.number().describe("The total number of labels created."),
|
|
2473
2473
|
failures: s.array(_).describe("Labels that could not be created, with the reason for each."),
|
|
2474
2474
|
totalRequested: s.number(),
|
|
2475
2475
|
successCount: s.number(),
|
|
2476
2476
|
failureCount: s.number()
|
|
2477
|
-
},
|
|
2477
|
+
}, qa = {
|
|
2478
2478
|
name: y.ADD_LABELS,
|
|
2479
2479
|
description: "Add one or more new personal labels.",
|
|
2480
|
-
parameters:
|
|
2481
|
-
outputSchema:
|
|
2480
|
+
parameters: Ba,
|
|
2481
|
+
outputSchema: Ka,
|
|
2482
2482
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
2483
2483
|
async execute({ labels: e }, t) {
|
|
2484
2484
|
const o = await Promise.allSettled(
|
|
2485
2485
|
e.map((c) => oe(() => t.addLabel(c)))
|
|
2486
2486
|
), { succeeded: r, failures: n } = P(e, o, (c) => c.name), a = r.map(({ value: c }) => c);
|
|
2487
2487
|
return O(y.ADD_LABELS, e.length, n, { redactItems: !0 }), {
|
|
2488
|
-
textContent:
|
|
2488
|
+
textContent: za({ labels: a, failures: n }),
|
|
2489
2489
|
structuredContent: {
|
|
2490
|
-
labels: a.map((c) =>
|
|
2490
|
+
labels: a.map((c) => je.parse(c)),
|
|
2491
2491
|
totalCount: a.length,
|
|
2492
2492
|
failures: n,
|
|
2493
2493
|
totalRequested: e.length,
|
|
@@ -2497,7 +2497,7 @@ const Ba = s.object({
|
|
|
2497
2497
|
};
|
|
2498
2498
|
}
|
|
2499
2499
|
};
|
|
2500
|
-
function
|
|
2500
|
+
function za({
|
|
2501
2501
|
labels: e,
|
|
2502
2502
|
failures: t
|
|
2503
2503
|
}) {
|
|
@@ -2506,7 +2506,7 @@ function Ya({
|
|
|
2506
2506
|
${r}` : "Added 0 labels";
|
|
2507
2507
|
return R(n, t);
|
|
2508
2508
|
}
|
|
2509
|
-
async function
|
|
2509
|
+
async function Ft(e, t) {
|
|
2510
2510
|
try {
|
|
2511
2511
|
const { maxProjects: o, activeCount: r } = await j(
|
|
2512
2512
|
() => e.getPersonalProjectCapacity()
|
|
@@ -2517,7 +2517,7 @@ async function Ht(e, t) {
|
|
|
2517
2517
|
return;
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
|
-
function
|
|
2520
|
+
function Ht(e, t) {
|
|
2521
2521
|
if (!e)
|
|
2522
2522
|
throw new Error(`Could not verify your personal project limit. ${t} Retry later.`);
|
|
2523
2523
|
if (e.activeCount >= e.maxProjects)
|
|
@@ -2525,44 +2525,44 @@ function Wt(e, t) {
|
|
|
2525
2525
|
`Your account has reached its limit of ${e.maxProjects} active personal projects. ${t} Archive or delete a personal project, or upgrade to a plan with a higher limit, then retry.`
|
|
2526
2526
|
);
|
|
2527
2527
|
}
|
|
2528
|
-
const { FIND_FOLDERS:
|
|
2528
|
+
const { FIND_FOLDERS: Ya } = y, Ga = s.object({
|
|
2529
2529
|
name: s.string().min(1).describe("The name of the project."),
|
|
2530
2530
|
parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
|
|
2531
2531
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
|
|
2532
2532
|
viewStyle: s.enum(Wo).optional().describe('The project view style. Defaults to "list".'),
|
|
2533
2533
|
description: s.string().optional().describe("The description of the project. Supports Markdown."),
|
|
2534
|
-
color:
|
|
2534
|
+
color: Se,
|
|
2535
2535
|
icon: s.enum(Ho).optional().describe("The project icon. Omit for the default # icon."),
|
|
2536
2536
|
workspace: s.string().trim().min(1).optional().describe(
|
|
2537
2537
|
"The workspace to create the project in. Accepts a workspace name or workspace ID. If not provided, creates a personal project. Use list-workspaces to see available workspaces."
|
|
2538
2538
|
),
|
|
2539
2539
|
folderId: s.string().min(1).optional().describe(
|
|
2540
|
-
`Create it in this workspace folder (see ${
|
|
2540
|
+
`Create it in this workspace folder (see ${Ya}). The folder sets the workspace, so workspace can be omitted.`
|
|
2541
2541
|
)
|
|
2542
|
-
}),
|
|
2543
|
-
projects: s.array(
|
|
2544
|
-
},
|
|
2542
|
+
}), Va = {
|
|
2543
|
+
projects: s.array(Ga).min(1).max(D.ITEMS_PER_OPERATION).describe("The array of projects to add.")
|
|
2544
|
+
}, Ja = {
|
|
2545
2545
|
projects: s.array(me).describe("The created projects."),
|
|
2546
2546
|
totalCount: s.number().describe("The total number of projects created."),
|
|
2547
2547
|
failures: s.array(_).describe("Projects that could not be created, with the reason for each."),
|
|
2548
2548
|
totalRequested: s.number(),
|
|
2549
2549
|
successCount: s.number(),
|
|
2550
2550
|
failureCount: s.number()
|
|
2551
|
-
},
|
|
2551
|
+
}, Xa = {
|
|
2552
2552
|
name: y.ADD_PROJECTS,
|
|
2553
2553
|
description: "Add one or more new projects.",
|
|
2554
|
-
parameters:
|
|
2555
|
-
outputSchema:
|
|
2554
|
+
parameters: Va,
|
|
2555
|
+
outputSchema: Ja,
|
|
2556
2556
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
2557
2557
|
async execute({ projects: e }, t) {
|
|
2558
|
-
const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n =
|
|
2559
|
-
() =>
|
|
2558
|
+
const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n = ei(
|
|
2559
|
+
() => Ft(t, y.ADD_PROJECTS)
|
|
2560
2560
|
), a = (g) => {
|
|
2561
2561
|
if (!g)
|
|
2562
2562
|
return Promise.resolve(void 0);
|
|
2563
2563
|
let w = o.get(g);
|
|
2564
2564
|
return w || (w = j(
|
|
2565
|
-
() =>
|
|
2565
|
+
() => _e.resolveWorkspace(t, g)
|
|
2566
2566
|
).then(({ workspaceId: I }) => I), o.set(g, w)), w;
|
|
2567
2567
|
}, i = (g) => {
|
|
2568
2568
|
let w = r.get(g);
|
|
@@ -2572,9 +2572,9 @@ const { FIND_FOLDERS: Ga } = y, Va = s.object({
|
|
|
2572
2572
|
), d = e.flatMap(
|
|
2573
2573
|
({ folderId: g, ...w }, I) => g ? [] : [{ index: I, project: w }]
|
|
2574
2574
|
), l = (await Promise.all([
|
|
2575
|
-
|
|
2575
|
+
Za(t, c, { lookupFolder: i, resolveWorkspaceId: a }),
|
|
2576
2576
|
...d.map(async ({ project: { workspace: g, ...w }, index: I }) => {
|
|
2577
|
-
const k = await
|
|
2577
|
+
const k = await ft(async () => {
|
|
2578
2578
|
const S = await a(g), $ = () => oe(
|
|
2579
2579
|
() => t.addProject({ ...w, ...S ? { workspaceId: S } : {} })
|
|
2580
2580
|
);
|
|
@@ -2588,7 +2588,7 @@ const { FIND_FOLDERS: Ga } = y, Va = s.object({
|
|
|
2588
2588
|
(g) => g.name
|
|
2589
2589
|
), h = p.map(({ value: g }) => g), m = h.map(he);
|
|
2590
2590
|
return O(y.ADD_PROJECTS, e.length, f, { redactItems: !0 }), {
|
|
2591
|
-
textContent:
|
|
2591
|
+
textContent: oi({ projects: h, failures: f }),
|
|
2592
2592
|
structuredContent: {
|
|
2593
2593
|
projects: m,
|
|
2594
2594
|
totalCount: m.length,
|
|
@@ -2600,14 +2600,14 @@ const { FIND_FOLDERS: Ga } = y, Va = s.object({
|
|
|
2600
2600
|
};
|
|
2601
2601
|
}
|
|
2602
2602
|
};
|
|
2603
|
-
async function
|
|
2603
|
+
async function ft(e) {
|
|
2604
2604
|
try {
|
|
2605
2605
|
return { status: "fulfilled", value: await e() };
|
|
2606
2606
|
} catch (t) {
|
|
2607
2607
|
return { status: "rejected", reason: t };
|
|
2608
2608
|
}
|
|
2609
2609
|
}
|
|
2610
|
-
async function
|
|
2610
|
+
async function Za(e, t, {
|
|
2611
2611
|
lookupFolder: o,
|
|
2612
2612
|
resolveWorkspaceId: r
|
|
2613
2613
|
}) {
|
|
@@ -2615,8 +2615,8 @@ async function Qa(e, t, {
|
|
|
2615
2615
|
t.map(async ({ index: l, project: { workspace: p, ...f }, folderId: h }) => ({
|
|
2616
2616
|
index: l,
|
|
2617
2617
|
project: f,
|
|
2618
|
-
tempId:
|
|
2619
|
-
folder: await
|
|
2618
|
+
tempId: ve(),
|
|
2619
|
+
folder: await ft(async () => {
|
|
2620
2620
|
const m = await o(h);
|
|
2621
2621
|
if (p && await r(p) !== m.workspaceId)
|
|
2622
2622
|
throw new Error(
|
|
@@ -2635,25 +2635,25 @@ async function Qa(e, t, {
|
|
|
2635
2635
|
i.push({
|
|
2636
2636
|
index: l,
|
|
2637
2637
|
tempId: f,
|
|
2638
|
-
command:
|
|
2638
|
+
command: Y("project_add", { ...p, workspaceId: m, folderId: b }, f)
|
|
2639
2639
|
});
|
|
2640
2640
|
}
|
|
2641
2641
|
if (i.length === 0)
|
|
2642
2642
|
return a;
|
|
2643
|
-
const { outcomes: c, tempIdMapping: d } = await
|
|
2643
|
+
const { outcomes: c, tempIdMapping: d } = await G(
|
|
2644
2644
|
e,
|
|
2645
2645
|
i.map(({ command: l }) => l)
|
|
2646
2646
|
), u = await Promise.all(
|
|
2647
2647
|
i.map(async ({ index: l, tempId: p }, f) => ({
|
|
2648
2648
|
index: l,
|
|
2649
|
-
outcome: await
|
|
2650
|
-
() =>
|
|
2649
|
+
outcome: await ft(
|
|
2650
|
+
() => Qa(e, c[f], d[p])
|
|
2651
2651
|
)
|
|
2652
2652
|
}))
|
|
2653
2653
|
);
|
|
2654
2654
|
return [...a, ...u];
|
|
2655
2655
|
}
|
|
2656
|
-
async function
|
|
2656
|
+
async function Qa(e, t, o) {
|
|
2657
2657
|
if (t?.status === "rejected")
|
|
2658
2658
|
throw t.reason;
|
|
2659
2659
|
if (!o)
|
|
@@ -2668,19 +2668,19 @@ async function ei(e, t, o) {
|
|
|
2668
2668
|
);
|
|
2669
2669
|
}
|
|
2670
2670
|
}
|
|
2671
|
-
function
|
|
2671
|
+
function ei(e) {
|
|
2672
2672
|
let t, o = 0, r = [];
|
|
2673
2673
|
return async function(a) {
|
|
2674
2674
|
t ??= e();
|
|
2675
2675
|
const i = await t;
|
|
2676
2676
|
for (; i && o > 0 && i.activeCount + o >= i.maxProjects; )
|
|
2677
2677
|
await new Promise((c) => r.push(c));
|
|
2678
|
-
|
|
2678
|
+
Ht(i, "This project was not created."), o++;
|
|
2679
2679
|
try {
|
|
2680
2680
|
const c = await a();
|
|
2681
2681
|
return i.activeCount++, c;
|
|
2682
2682
|
} catch (c) {
|
|
2683
|
-
throw
|
|
2683
|
+
throw ti(c) && i.activeCount++, c;
|
|
2684
2684
|
} finally {
|
|
2685
2685
|
o--;
|
|
2686
2686
|
const c = r;
|
|
@@ -2690,11 +2690,11 @@ function ti(e) {
|
|
|
2690
2690
|
}
|
|
2691
2691
|
};
|
|
2692
2692
|
}
|
|
2693
|
-
function
|
|
2693
|
+
function ti(e) {
|
|
2694
2694
|
const t = Be(e);
|
|
2695
2695
|
return t === void 0 || t >= 500 && t !== 503;
|
|
2696
2696
|
}
|
|
2697
|
-
function
|
|
2697
|
+
function oi({
|
|
2698
2698
|
projects: e,
|
|
2699
2699
|
failures: t
|
|
2700
2700
|
}) {
|
|
@@ -2707,7 +2707,7 @@ async function Is(e, t) {
|
|
|
2707
2707
|
const o = /* @__PURE__ */ new Map();
|
|
2708
2708
|
for (const a of t) {
|
|
2709
2709
|
const i = a?.trim();
|
|
2710
|
-
i && !o.has(
|
|
2710
|
+
i && !o.has(Xe(i)) && o.set(Xe(i), i);
|
|
2711
2711
|
}
|
|
2712
2712
|
const r = /* @__PURE__ */ new Map();
|
|
2713
2713
|
for (const [a, i] of o)
|
|
@@ -2719,10 +2719,10 @@ async function Is(e, t) {
|
|
|
2719
2719
|
}
|
|
2720
2720
|
const n = { status: "fulfilled", value: void 0 };
|
|
2721
2721
|
return t.map(
|
|
2722
|
-
(a) => a?.trim() ? r.get(
|
|
2722
|
+
(a) => a?.trim() ? r.get(Xe(a)) ?? n : n
|
|
2723
2723
|
);
|
|
2724
2724
|
}
|
|
2725
|
-
function
|
|
2725
|
+
function Xe(e) {
|
|
2726
2726
|
return e.trim().toLowerCase();
|
|
2727
2727
|
}
|
|
2728
2728
|
function vs(e, t) {
|
|
@@ -2733,16 +2733,16 @@ function vs(e, t) {
|
|
|
2733
2733
|
];
|
|
2734
2734
|
});
|
|
2735
2735
|
}
|
|
2736
|
-
const Fe = 25, Ye = s.enum(
|
|
2736
|
+
const Fe = 25, Ye = s.enum(hr), Ss = s.object({
|
|
2737
2737
|
date: s.string().optional().describe("Due date in YYYY-MM-DD format."),
|
|
2738
2738
|
string: s.string().optional().describe('Natural language due string, e.g. "tomorrow at 3pm".'),
|
|
2739
2739
|
timezone: s.string().optional().describe('Timezone for the reminder, e.g. "America/New_York".'),
|
|
2740
2740
|
lang: s.string().optional().describe('Language for parsing the due string, e.g. "en".')
|
|
2741
|
-
}), Cs = s.enum(Fo), Ge = s.boolean().optional().describe("Whether this is an urgent reminder. Applies to relative and absolute reminders."), js = `Who to remind: user ID, email, name, or "me". Must collaborate on the task's project.`,
|
|
2741
|
+
}), Cs = s.enum(Fo), Ge = s.boolean().optional().describe("Whether this is an urgent reminder. Applies to relative and absolute reminders."), js = `Who to remind: user ID, email, name, or "me". Must collaborate on the task's project.`, Wt = M(
|
|
2742
2742
|
`${js} Defaults to the creator.`
|
|
2743
|
-
),
|
|
2743
|
+
), Bt = M(
|
|
2744
2744
|
`${js} Omit to keep the current one.`
|
|
2745
|
-
),
|
|
2745
|
+
), si = s.object({
|
|
2746
2746
|
type: s.literal("relative"),
|
|
2747
2747
|
taskId: s.string().min(1).describe("The ID of the task to set a reminder for."),
|
|
2748
2748
|
minuteOffset: s.number().int().min(0).describe(
|
|
@@ -2752,8 +2752,8 @@ const Fe = 25, Ye = s.enum(mr), Ss = s.object({
|
|
|
2752
2752
|
'Delivery method: "email" or "push" notification. Defaults to push.'
|
|
2753
2753
|
),
|
|
2754
2754
|
isUrgent: Ge,
|
|
2755
|
-
notifyUser:
|
|
2756
|
-
}),
|
|
2755
|
+
notifyUser: Wt
|
|
2756
|
+
}), ri = s.object({
|
|
2757
2757
|
type: s.literal("absolute"),
|
|
2758
2758
|
taskId: s.string().min(1).describe("The ID of the task to set a reminder for."),
|
|
2759
2759
|
due: Ss.describe("The specific date/time for the reminder."),
|
|
@@ -2761,8 +2761,8 @@ const Fe = 25, Ye = s.enum(mr), Ss = s.object({
|
|
|
2761
2761
|
'Delivery method: "email" or "push" notification. Defaults to push.'
|
|
2762
2762
|
),
|
|
2763
2763
|
isUrgent: Ge,
|
|
2764
|
-
notifyUser:
|
|
2765
|
-
}),
|
|
2764
|
+
notifyUser: Wt
|
|
2765
|
+
}), ni = s.object({
|
|
2766
2766
|
type: s.literal("location"),
|
|
2767
2767
|
taskId: s.string().min(1).describe("The ID of the task to set a reminder for."),
|
|
2768
2768
|
name: s.string().min(1).describe('Name of the location, e.g. "Office", "Home".'),
|
|
@@ -2772,28 +2772,28 @@ const Fe = 25, Ye = s.enum(mr), Ss = s.object({
|
|
|
2772
2772
|
'When to trigger: "on_enter" (arriving) or "on_leave" (departing).'
|
|
2773
2773
|
),
|
|
2774
2774
|
radius: s.number().int().optional().describe("Radius in meters for the geofence. Defaults to server default."),
|
|
2775
|
-
notifyUser:
|
|
2776
|
-
}),
|
|
2775
|
+
notifyUser: Wt
|
|
2776
|
+
}), ai = s.discriminatedUnion("type", [
|
|
2777
|
+
si,
|
|
2777
2778
|
ri,
|
|
2778
|
-
ni
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
reminders: s.array(ii).min(1).max(Fe).describe(
|
|
2779
|
+
ni
|
|
2780
|
+
]), ii = {
|
|
2781
|
+
reminders: s.array(ai).min(1).max(Fe).describe(
|
|
2782
2782
|
`Array of reminders to create (max ${Fe}). Each reminder must specify a type: "relative" (minutes before due), "absolute" (specific date/time), or "location" (geofence trigger).`
|
|
2783
2783
|
)
|
|
2784
|
-
},
|
|
2785
|
-
reminders: s.array(
|
|
2784
|
+
}, ci = {
|
|
2785
|
+
reminders: s.array(Rt).describe("The created reminders."),
|
|
2786
2786
|
totalCount: s.number().describe("Total number of reminders created."),
|
|
2787
2787
|
addedReminderIds: s.array(s.string()).describe("IDs of the created reminders."),
|
|
2788
2788
|
failures: s.array(_).describe("Reminders that could not be created, with the reason for each."),
|
|
2789
2789
|
totalRequested: s.number(),
|
|
2790
2790
|
successCount: s.number(),
|
|
2791
2791
|
failureCount: s.number()
|
|
2792
|
-
},
|
|
2792
|
+
}, di = {
|
|
2793
2793
|
name: y.ADD_REMINDERS,
|
|
2794
2794
|
description: 'Add reminders to tasks. Supports three types: "relative" (minutes before due), "absolute" (specific date/time), or "location" (geofence-triggered). Each reminder must specify a taskId. Reminders notify their creator unless notifyUser says otherwise.',
|
|
2795
|
-
parameters:
|
|
2796
|
-
outputSchema:
|
|
2795
|
+
parameters: ii,
|
|
2796
|
+
outputSchema: ci,
|
|
2797
2797
|
annotations: {
|
|
2798
2798
|
readOnlyHint: !1,
|
|
2799
2799
|
destructiveHint: !1,
|
|
@@ -2851,14 +2851,14 @@ const Fe = 25, Ye = s.enum(mr), Ss = s.object({
|
|
|
2851
2851
|
o,
|
|
2852
2852
|
n,
|
|
2853
2853
|
(l, p) => `Reminder ${p + 1} on task ${l.taskId}`
|
|
2854
|
-
), c = a.map(({ value: l }) =>
|
|
2854
|
+
), c = a.map(({ value: l }) => Oe(l)), d = a.map(({ index: l }) => {
|
|
2855
2855
|
const p = r[l];
|
|
2856
2856
|
return p?.status === "fulfilled" ? p.value : void 0;
|
|
2857
2857
|
});
|
|
2858
2858
|
return O(y.ADD_REMINDERS, o.length, i), {
|
|
2859
2859
|
textContent: R(
|
|
2860
2860
|
[
|
|
2861
|
-
|
|
2861
|
+
li(c),
|
|
2862
2862
|
...vs(c, d)
|
|
2863
2863
|
].join(`
|
|
2864
2864
|
`),
|
|
@@ -2876,7 +2876,7 @@ const Fe = 25, Ye = s.enum(mr), Ss = s.object({
|
|
|
2876
2876
|
};
|
|
2877
2877
|
}
|
|
2878
2878
|
};
|
|
2879
|
-
function
|
|
2879
|
+
function li(e) {
|
|
2880
2880
|
const { timeBasedCount: t, locationCount: o } = ys(e), r = [];
|
|
2881
2881
|
if (t > 0) {
|
|
2882
2882
|
const n = t > 1 ? "reminders" : "reminder";
|
|
@@ -2888,26 +2888,26 @@ function ui(e) {
|
|
|
2888
2888
|
}
|
|
2889
2889
|
return r.length > 0 ? `Added ${r.join(" and ")}` : "No reminders added";
|
|
2890
2890
|
}
|
|
2891
|
-
const
|
|
2891
|
+
const ui = s.object({
|
|
2892
2892
|
name: s.string().min(1).describe("The name of the section."),
|
|
2893
2893
|
projectId: s.string().min(1).describe(
|
|
2894
2894
|
'The ID of the project to add the section to. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
2895
2895
|
),
|
|
2896
2896
|
description: s.string().optional().describe("The description of the section. Supports Markdown.")
|
|
2897
|
-
}),
|
|
2898
|
-
sections: s.array(
|
|
2899
|
-
},
|
|
2897
|
+
}), pi = {
|
|
2898
|
+
sections: s.array(ui).min(1).max(D.ITEMS_PER_OPERATION).describe("The array of sections to add.")
|
|
2899
|
+
}, hi = {
|
|
2900
2900
|
sections: s.array(se).describe("The created sections."),
|
|
2901
2901
|
totalCount: s.number().describe("The total number of sections created."),
|
|
2902
2902
|
failures: s.array(_).describe("Sections that could not be created, with the reason for each."),
|
|
2903
2903
|
totalRequested: s.number(),
|
|
2904
2904
|
successCount: s.number(),
|
|
2905
2905
|
failureCount: s.number()
|
|
2906
|
-
},
|
|
2906
|
+
}, mi = {
|
|
2907
2907
|
name: y.ADD_SECTIONS,
|
|
2908
2908
|
description: "Add one or more new sections to projects.",
|
|
2909
|
-
parameters:
|
|
2910
|
-
outputSchema:
|
|
2909
|
+
parameters: pi,
|
|
2910
|
+
outputSchema: hi,
|
|
2911
2911
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
2912
2912
|
async execute({ sections: e }, t) {
|
|
2913
2913
|
const o = e.some((d) => Q(d.projectId)) ? j(() => t.getUser()) : void 0, r = await Promise.allSettled(
|
|
@@ -2925,7 +2925,7 @@ const pi = s.object({
|
|
|
2925
2925
|
(d) => d.name
|
|
2926
2926
|
), i = n.map(({ value: d }) => d);
|
|
2927
2927
|
return O(y.ADD_SECTIONS, e.length, a, { redactItems: !0 }), {
|
|
2928
|
-
textContent:
|
|
2928
|
+
textContent: fi({ sections: i, failures: a }),
|
|
2929
2929
|
structuredContent: {
|
|
2930
2930
|
sections: i.map(ne),
|
|
2931
2931
|
totalCount: i.length,
|
|
@@ -2937,7 +2937,7 @@ const pi = s.object({
|
|
|
2937
2937
|
};
|
|
2938
2938
|
}
|
|
2939
2939
|
};
|
|
2940
|
-
function
|
|
2940
|
+
function fi({
|
|
2941
2941
|
sections: e,
|
|
2942
2942
|
failures: t
|
|
2943
2943
|
}) {
|
|
@@ -2946,7 +2946,7 @@ function bi({
|
|
|
2946
2946
|
${r}` : "Added 0 sections";
|
|
2947
2947
|
return R(n, t);
|
|
2948
2948
|
}
|
|
2949
|
-
const
|
|
2949
|
+
const ye = {
|
|
2950
2950
|
USER_NOT_FOUND: "USER_NOT_FOUND",
|
|
2951
2951
|
USER_NOT_COLLABORATOR: "USER_NOT_COLLABORATOR",
|
|
2952
2952
|
PROJECT_NOT_SHARED: "PROJECT_NOT_SHARED",
|
|
@@ -2955,7 +2955,7 @@ const we = {
|
|
|
2955
2955
|
PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND",
|
|
2956
2956
|
TASK_NOT_FOUND: "TASK_NOT_FOUND"
|
|
2957
2957
|
};
|
|
2958
|
-
class
|
|
2958
|
+
class bi {
|
|
2959
2959
|
/**
|
|
2960
2960
|
* Validate a single assignment operation
|
|
2961
2961
|
*/
|
|
@@ -2967,7 +2967,7 @@ class gi {
|
|
|
2967
2967
|
taskId: n,
|
|
2968
2968
|
projectId: a,
|
|
2969
2969
|
error: {
|
|
2970
|
-
type:
|
|
2970
|
+
type: ye.USER_NOT_FOUND,
|
|
2971
2971
|
message: `User "${i}" not found`,
|
|
2972
2972
|
suggestions: [
|
|
2973
2973
|
"Check the spelling of the user name or email",
|
|
@@ -2985,7 +2985,7 @@ class gi {
|
|
|
2985
2985
|
projectId: a,
|
|
2986
2986
|
resolvedUser: c,
|
|
2987
2987
|
error: {
|
|
2988
|
-
type:
|
|
2988
|
+
type: ye.PROJECT_NOT_SHARED,
|
|
2989
2989
|
message: `Project "${d.name}" is not shared. Task assignments require a shared project with collaborators. Share the project with at least one other person to enable assignments.`,
|
|
2990
2990
|
suggestions: [
|
|
2991
2991
|
"Share the project with at least one collaborator to enable assignments",
|
|
@@ -3004,7 +3004,7 @@ class gi {
|
|
|
3004
3004
|
projectId: a,
|
|
3005
3005
|
resolvedUser: c,
|
|
3006
3006
|
error: {
|
|
3007
|
-
type:
|
|
3007
|
+
type: ye.USER_NOT_COLLABORATOR,
|
|
3008
3008
|
message: `User "${c.displayName}" is not a collaborator on project "${d.name}"`,
|
|
3009
3009
|
suggestions: [
|
|
3010
3010
|
"Invite the user to collaborate on this project first",
|
|
@@ -3023,7 +3023,7 @@ class gi {
|
|
|
3023
3023
|
projectId: a,
|
|
3024
3024
|
resolvedUser: c,
|
|
3025
3025
|
error: {
|
|
3026
|
-
type:
|
|
3026
|
+
type: ye.TASK_NOT_FOUND,
|
|
3027
3027
|
message: `Task "${n}" not found or not accessible`,
|
|
3028
3028
|
suggestions: [
|
|
3029
3029
|
"Verify the task ID is correct",
|
|
@@ -3046,7 +3046,7 @@ class gi {
|
|
|
3046
3046
|
projectId: a,
|
|
3047
3047
|
resolvedUser: c,
|
|
3048
3048
|
error: {
|
|
3049
|
-
type:
|
|
3049
|
+
type: ye.PERMISSION_DENIED,
|
|
3050
3050
|
message: "Permission denied or API error occurred",
|
|
3051
3051
|
suggestions: [
|
|
3052
3052
|
"Check your API permissions",
|
|
@@ -3093,7 +3093,7 @@ class gi {
|
|
|
3093
3093
|
isValid: !1,
|
|
3094
3094
|
taskId: o,
|
|
3095
3095
|
error: {
|
|
3096
|
-
type:
|
|
3096
|
+
type: ye.TASK_NOT_FOUND,
|
|
3097
3097
|
message: `Task "${o}" not found or not accessible`,
|
|
3098
3098
|
suggestions: [
|
|
3099
3099
|
"Verify the task ID is correct",
|
|
@@ -3161,14 +3161,14 @@ class gi {
|
|
|
3161
3161
|
};
|
|
3162
3162
|
}
|
|
3163
3163
|
}
|
|
3164
|
-
const
|
|
3164
|
+
const Kt = new bi(), po = D.TASK_CREATES_PER_OPERATION, gi = s.object({
|
|
3165
3165
|
content: s.string().min(1).describe(
|
|
3166
3166
|
'The task name/title. Should be concise and actionable (e.g., "Review PR #123", "Call dentist"). For longer content, use the description field instead. Supports Markdown.'
|
|
3167
3167
|
),
|
|
3168
3168
|
description: M(
|
|
3169
3169
|
"Additional details, notes, or context for the task. Use this for longer content rather than putting it in the task name. Supports Markdown."
|
|
3170
3170
|
),
|
|
3171
|
-
priority:
|
|
3171
|
+
priority: At.optional().describe(Et),
|
|
3172
3172
|
dueString: M(
|
|
3173
3173
|
'The due date for the task, in natural language. Also use natural language for recurrences; do not prefix it with "recurring".'
|
|
3174
3174
|
),
|
|
@@ -3190,19 +3190,19 @@ const qt = new gi(), po = D.TASK_CREATES_PER_OPERATION, yi = s.object({
|
|
|
3190
3190
|
"Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed."
|
|
3191
3191
|
)
|
|
3192
3192
|
}), ho = {
|
|
3193
|
-
tasks: s.array(
|
|
3194
|
-
},
|
|
3193
|
+
tasks: s.array(gi).min(1).max(po).describe(`The array of tasks to add (max ${po}).`)
|
|
3194
|
+
}, yi = {
|
|
3195
3195
|
tasks: s.array(ee).describe("The created tasks."),
|
|
3196
3196
|
totalCount: s.number().describe("The total number of tasks created."),
|
|
3197
3197
|
failures: s.array(_).describe("Tasks that could not be created, with the reason for each."),
|
|
3198
3198
|
totalRequested: s.number(),
|
|
3199
3199
|
successCount: s.number(),
|
|
3200
3200
|
failureCount: s.number()
|
|
3201
|
-
},
|
|
3201
|
+
}, wi = {
|
|
3202
3202
|
name: y.ADD_TASKS,
|
|
3203
3203
|
description: "Add one or more tasks to a project, section, or parent. Supports assignment to project collaborators.",
|
|
3204
3204
|
parameters: ho,
|
|
3205
|
-
outputSchema:
|
|
3205
|
+
outputSchema: yi,
|
|
3206
3206
|
// Open world: assigning a task notifies the new assignee.
|
|
3207
3207
|
annotations: {
|
|
3208
3208
|
readOnlyHint: !1,
|
|
@@ -3211,17 +3211,17 @@ const qt = new gi(), po = D.TASK_CREATES_PER_OPERATION, yi = s.object({
|
|
|
3211
3211
|
openWorldHint: !0
|
|
3212
3212
|
},
|
|
3213
3213
|
async execute(e, t) {
|
|
3214
|
-
const { tasks: o } = s.object(ho).parse(e), r =
|
|
3214
|
+
const { tasks: o } = s.object(ho).parse(e), r = Ti(t), n = await Promise.allSettled(o.map((h) => ki(h, r))), a = n.flatMap((h, m) => {
|
|
3215
3215
|
const b = o[m];
|
|
3216
3216
|
return h.status === "fulfilled" && b ? [{ index: m, task: b, ...h.value }] : [];
|
|
3217
|
-
}), i = await
|
|
3217
|
+
}), i = await vi(t, a), c = n.map(
|
|
3218
3218
|
(h, m) => h.status === "rejected" ? h : i.get(m) ?? {
|
|
3219
3219
|
status: "rejected",
|
|
3220
3220
|
reason: new Error("Todoist did not report whether this task was created")
|
|
3221
3221
|
}
|
|
3222
3222
|
), { succeeded: d, failures: u } = P(o, c, (h) => h.content), l = d.map(({ value: h }) => h), p = l.map(K);
|
|
3223
3223
|
return O(y.ADD_TASKS, o.length, u, { redactItems: !0 }), {
|
|
3224
|
-
textContent:
|
|
3224
|
+
textContent: ji({
|
|
3225
3225
|
tasks: p,
|
|
3226
3226
|
failures: u,
|
|
3227
3227
|
args: { tasks: o }
|
|
@@ -3237,13 +3237,13 @@ const qt = new gi(), po = D.TASK_CREATES_PER_OPERATION, yi = s.object({
|
|
|
3237
3237
|
};
|
|
3238
3238
|
}
|
|
3239
3239
|
};
|
|
3240
|
-
function
|
|
3240
|
+
function Ti(e) {
|
|
3241
3241
|
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
3242
3242
|
function n(i, c, d) {
|
|
3243
3243
|
let u = i.get(c);
|
|
3244
3244
|
return u || (u = d(), i.set(c, u)), u;
|
|
3245
3245
|
}
|
|
3246
|
-
const a =
|
|
3246
|
+
const a = Gn(e);
|
|
3247
3247
|
return {
|
|
3248
3248
|
lookUpProject: a,
|
|
3249
3249
|
lookUpSectionProject: (i) => n(t, i, async () => (await j(() => e.getSection(i)))?.projectId),
|
|
@@ -3252,7 +3252,7 @@ function ki(e) {
|
|
|
3252
3252
|
checkAssignee: (i, c) => n(
|
|
3253
3253
|
r,
|
|
3254
3254
|
JSON.stringify([i, c]),
|
|
3255
|
-
() =>
|
|
3255
|
+
() => Kt.validateTaskCreationAssignment(
|
|
3256
3256
|
e,
|
|
3257
3257
|
i,
|
|
3258
3258
|
c,
|
|
@@ -3261,7 +3261,7 @@ function ki(e) {
|
|
|
3261
3261
|
)
|
|
3262
3262
|
};
|
|
3263
3263
|
}
|
|
3264
|
-
async function
|
|
3264
|
+
async function ki(e, t) {
|
|
3265
3265
|
const {
|
|
3266
3266
|
content: o,
|
|
3267
3267
|
description: r,
|
|
@@ -3288,14 +3288,14 @@ async function Ii(e, t) {
|
|
|
3288
3288
|
throw new Error(
|
|
3289
3289
|
`Task "${o}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
|
|
3290
3290
|
);
|
|
3291
|
-
const g = n ?
|
|
3291
|
+
const g = n ? $t(`Task "${o}"`, n) : void 0;
|
|
3292
3292
|
let w;
|
|
3293
|
-
u && (w = await
|
|
3294
|
-
const I =
|
|
3295
|
-
return { command:
|
|
3293
|
+
u && (w = await Ii(e, t, b));
|
|
3294
|
+
const I = ve();
|
|
3295
|
+
return { command: Y(
|
|
3296
3296
|
"item_add",
|
|
3297
3297
|
{
|
|
3298
|
-
content: m ?
|
|
3298
|
+
content: m ? Ci(o) : o,
|
|
3299
3299
|
description: r,
|
|
3300
3300
|
projectId: b,
|
|
3301
3301
|
sectionId: i,
|
|
@@ -3314,7 +3314,7 @@ async function Ii(e, t) {
|
|
|
3314
3314
|
I
|
|
3315
3315
|
), tempId: I };
|
|
3316
3316
|
}
|
|
3317
|
-
async function
|
|
3317
|
+
async function Ii(e, t, o) {
|
|
3318
3318
|
const { content: r, sectionId: n, parentId: a, responsibleUser: i } = e;
|
|
3319
3319
|
if (!i)
|
|
3320
3320
|
return;
|
|
@@ -3338,11 +3338,11 @@ async function vi(e, t, o) {
|
|
|
3338
3338
|
}
|
|
3339
3339
|
return d.resolvedUser?.userId;
|
|
3340
3340
|
}
|
|
3341
|
-
async function
|
|
3341
|
+
async function vi(e, t) {
|
|
3342
3342
|
const o = /* @__PURE__ */ new Map();
|
|
3343
3343
|
if (t.length === 0)
|
|
3344
3344
|
return o;
|
|
3345
|
-
const { outcomes: r, tempIdMapping: n, requestFailed: a } = await
|
|
3345
|
+
const { outcomes: r, tempIdMapping: n, requestFailed: a } = await G(
|
|
3346
3346
|
e,
|
|
3347
3347
|
t.map(({ command: u }) => u)
|
|
3348
3348
|
), i = /* @__PURE__ */ new Map();
|
|
@@ -3353,7 +3353,7 @@ async function Si(e, t) {
|
|
|
3353
3353
|
status: "rejected",
|
|
3354
3354
|
// Only Todoist's answer about this task's own command can blame its
|
|
3355
3355
|
// due string; a failed request says nothing about any one task.
|
|
3356
|
-
reason: a ? h?.reason :
|
|
3356
|
+
reason: a ? h?.reason : Si(h?.reason, l)
|
|
3357
3357
|
});
|
|
3358
3358
|
return;
|
|
3359
3359
|
}
|
|
@@ -3399,19 +3399,19 @@ async function Si(e, t) {
|
|
|
3399
3399
|
}
|
|
3400
3400
|
return o;
|
|
3401
3401
|
}
|
|
3402
|
-
function
|
|
3403
|
-
const o =
|
|
3402
|
+
function Si(e, t) {
|
|
3403
|
+
const o = Mr(e, {
|
|
3404
3404
|
taskContent: t.content,
|
|
3405
3405
|
dueString: t.dueString,
|
|
3406
3406
|
deadlineDate: t.deadlineDate
|
|
3407
3407
|
});
|
|
3408
|
-
return o ? new
|
|
3408
|
+
return o ? new vt(o) : e;
|
|
3409
3409
|
}
|
|
3410
3410
|
const mo = "* ";
|
|
3411
|
-
function
|
|
3411
|
+
function Ci(e) {
|
|
3412
3412
|
return e.startsWith(mo) ? e : `${mo}${e}`;
|
|
3413
3413
|
}
|
|
3414
|
-
function
|
|
3414
|
+
function ji({
|
|
3415
3415
|
tasks: e,
|
|
3416
3416
|
failures: t,
|
|
3417
3417
|
args: o
|
|
@@ -3424,35 +3424,35 @@ function $i({
|
|
|
3424
3424
|
const a = Array.from(r)[0];
|
|
3425
3425
|
n = a === "inbox" ? "" : `to ${a}`;
|
|
3426
3426
|
} else r.size > 1 && (n = "to multiple contexts");
|
|
3427
|
-
return t.length > 0 ?
|
|
3427
|
+
return t.length > 0 ? Lt({
|
|
3428
3428
|
action: `Added tasks${n ? ` ${n}` : ""}`,
|
|
3429
3429
|
success: e.length,
|
|
3430
3430
|
total: o.tasks.length,
|
|
3431
3431
|
successItems: e.map((a) => a.content ?? "Untitled"),
|
|
3432
3432
|
successLabel: "Created",
|
|
3433
3433
|
failures: t
|
|
3434
|
-
}) :
|
|
3434
|
+
}) : Nt("Added", e, {
|
|
3435
3435
|
context: n,
|
|
3436
3436
|
showDetails: !0
|
|
3437
3437
|
});
|
|
3438
3438
|
}
|
|
3439
|
-
const
|
|
3439
|
+
const $i = {
|
|
3440
3440
|
projectId: s.string().min(1).describe(
|
|
3441
3441
|
"The ID of the project to analyze. This triggers a new health analysis which may take some time to complete."
|
|
3442
3442
|
)
|
|
3443
|
-
},
|
|
3443
|
+
}, Ei = {
|
|
3444
3444
|
projectId: s.string().describe("The project ID."),
|
|
3445
3445
|
health: s.object({
|
|
3446
|
-
status: s.enum(
|
|
3446
|
+
status: s.enum(wt).describe("The health status after triggering analysis."),
|
|
3447
3447
|
isStale: s.boolean().describe("Whether the health data is still stale after the request."),
|
|
3448
3448
|
updateInProgress: s.boolean().describe("Whether an analysis update is currently in progress.")
|
|
3449
3449
|
}).describe("The health response returned after triggering analysis."),
|
|
3450
3450
|
message: s.string().describe("A human-readable message about the analysis status.")
|
|
3451
|
-
},
|
|
3451
|
+
}, Ai = {
|
|
3452
3452
|
name: y.ANALYZE_PROJECT_HEALTH,
|
|
3453
3453
|
description: "Trigger a new health analysis for a project. Use this when the health data is stale or you want a fresh assessment. The analysis may take time to complete — use get-project-health afterward to see updated results.",
|
|
3454
|
-
parameters:
|
|
3455
|
-
outputSchema:
|
|
3454
|
+
parameters: $i,
|
|
3455
|
+
outputSchema: Ei,
|
|
3456
3456
|
annotations: {
|
|
3457
3457
|
readOnlyHint: !1,
|
|
3458
3458
|
destructiveHint: !1,
|
|
@@ -3475,24 +3475,24 @@ ${n}`,
|
|
|
3475
3475
|
}
|
|
3476
3476
|
};
|
|
3477
3477
|
}
|
|
3478
|
-
},
|
|
3478
|
+
}, Di = {
|
|
3479
3479
|
ids: s.array(s.string().min(1)).min(1).max(D.BULK_ACTIONS_PER_OPERATION).describe("The IDs of the tasks to complete.")
|
|
3480
|
-
},
|
|
3480
|
+
}, xi = {
|
|
3481
3481
|
completed: s.array(s.string()).describe("The IDs of successfully completed tasks."),
|
|
3482
3482
|
failures: s.array(_).describe("Failed task completions with error details."),
|
|
3483
3483
|
totalRequested: s.number().describe("The total number of tasks requested to complete."),
|
|
3484
3484
|
successCount: s.number().describe("The number of successfully completed tasks."),
|
|
3485
3485
|
failureCount: s.number().describe("The number of failed task completions.")
|
|
3486
|
-
},
|
|
3486
|
+
}, Oi = {
|
|
3487
3487
|
name: y.COMPLETE_TASKS,
|
|
3488
3488
|
description: "Complete one or more tasks by their IDs.",
|
|
3489
|
-
parameters:
|
|
3490
|
-
outputSchema:
|
|
3489
|
+
parameters: Di,
|
|
3490
|
+
outputSchema: xi,
|
|
3491
3491
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
3492
3492
|
async execute(e, t) {
|
|
3493
|
-
const o = await
|
|
3493
|
+
const o = await _i(t, e.ids), { succeeded: r, failures: n } = P(e.ids, o, (c) => c), a = r.map(({ item: c }) => c);
|
|
3494
3494
|
return O(y.COMPLETE_TASKS, e.ids.length, n), {
|
|
3495
|
-
textContent:
|
|
3495
|
+
textContent: Ri({
|
|
3496
3496
|
completed: a,
|
|
3497
3497
|
failures: n,
|
|
3498
3498
|
args: e
|
|
@@ -3507,11 +3507,11 @@ ${n}`,
|
|
|
3507
3507
|
};
|
|
3508
3508
|
}
|
|
3509
3509
|
};
|
|
3510
|
-
async function
|
|
3510
|
+
async function _i(e, t) {
|
|
3511
3511
|
const o = [...new Set(t)];
|
|
3512
3512
|
let r;
|
|
3513
3513
|
try {
|
|
3514
|
-
r = await
|
|
3514
|
+
r = await Ui(e, o);
|
|
3515
3515
|
} catch (i) {
|
|
3516
3516
|
return t.map(() => ({ status: "rejected", reason: i }));
|
|
3517
3517
|
}
|
|
@@ -3522,10 +3522,10 @@ async function Pi(e, t) {
|
|
|
3522
3522
|
if (n.length > 0) {
|
|
3523
3523
|
const i = n.map((d) => ({
|
|
3524
3524
|
type: "item_close",
|
|
3525
|
-
uuid:
|
|
3525
|
+
uuid: ve(),
|
|
3526
3526
|
args: { id: d }
|
|
3527
|
-
})), { outcomes: c } = await
|
|
3528
|
-
limit:
|
|
3527
|
+
})), { outcomes: c } = await G(e, i, {
|
|
3528
|
+
limit: Ct(e)
|
|
3529
3529
|
});
|
|
3530
3530
|
for (const [d, u] of n.entries()) {
|
|
3531
3531
|
const l = c[d];
|
|
@@ -3534,15 +3534,15 @@ async function Pi(e, t) {
|
|
|
3534
3534
|
}
|
|
3535
3535
|
return t.map((i) => {
|
|
3536
3536
|
const c = r.get(i);
|
|
3537
|
-
return c?.status === "rejected" ? c : a.get(i) ?? { status: "rejected", reason:
|
|
3537
|
+
return c?.status === "rejected" ? c : a.get(i) ?? { status: "rejected", reason: Pi(c?.value) };
|
|
3538
3538
|
});
|
|
3539
3539
|
}
|
|
3540
|
-
function
|
|
3540
|
+
function Pi(e) {
|
|
3541
3541
|
return e === "completed" ? new Error("Task is already completed.") : new Error(
|
|
3542
3542
|
`Task not found, or already completed. Look for it with ${y.FIND_TASKS}, or ${y.FIND_COMPLETED_TASKS} if it may be done.`
|
|
3543
3543
|
);
|
|
3544
3544
|
}
|
|
3545
|
-
async function
|
|
3545
|
+
async function Ui(e, t) {
|
|
3546
3546
|
try {
|
|
3547
3547
|
const { results: r } = await j(
|
|
3548
3548
|
() => e.getTasks({ ids: t, limit: t.length })
|
|
@@ -3577,12 +3577,12 @@ async function Ri(e, t) {
|
|
|
3577
3577
|
function fo(e) {
|
|
3578
3578
|
return e.checked ? "completed" : "open";
|
|
3579
3579
|
}
|
|
3580
|
-
function
|
|
3580
|
+
function Ri({
|
|
3581
3581
|
completed: e,
|
|
3582
3582
|
failures: t,
|
|
3583
3583
|
args: o
|
|
3584
3584
|
}) {
|
|
3585
|
-
return
|
|
3585
|
+
return Lt({
|
|
3586
3586
|
action: "Completed tasks",
|
|
3587
3587
|
success: e.length,
|
|
3588
3588
|
total: o.ids.length,
|
|
@@ -3600,20 +3600,20 @@ const $s = [
|
|
|
3600
3600
|
"folder",
|
|
3601
3601
|
"reminder",
|
|
3602
3602
|
"location_reminder"
|
|
3603
|
-
],
|
|
3603
|
+
], Ni = {
|
|
3604
3604
|
type: s.enum($s).describe("The type of entity to delete."),
|
|
3605
3605
|
id: s.string().min(1).describe("The ID of the entity to delete.")
|
|
3606
|
-
},
|
|
3606
|
+
}, Li = {
|
|
3607
3607
|
deletedEntity: s.object({
|
|
3608
3608
|
type: s.enum($s).describe("The type of deleted entity."),
|
|
3609
3609
|
id: s.string().describe("The ID of the deleted entity.")
|
|
3610
3610
|
}).describe("Information about the deleted entity."),
|
|
3611
3611
|
success: s.boolean().describe("Whether the deletion was successful.")
|
|
3612
|
-
},
|
|
3612
|
+
}, Mi = {
|
|
3613
3613
|
name: y.DELETE_OBJECT,
|
|
3614
3614
|
description: "Delete a project, section, task, comment, label, filter, folder, reminder, or location_reminder by its ID. Projects can be deleted whether active or archived (find archived ones via find-projects with archivedStatus); note a workspace project must be archived before it can be deleted, while personal projects can be deleted regardless. Deleting a folder keeps its projects, moving them to the top level of the workspace.",
|
|
3615
|
-
parameters:
|
|
3616
|
-
outputSchema:
|
|
3615
|
+
parameters: Ni,
|
|
3616
|
+
outputSchema: Li,
|
|
3617
3617
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !0 },
|
|
3618
3618
|
async execute(e, t) {
|
|
3619
3619
|
switch (e.type) {
|
|
@@ -3659,7 +3659,7 @@ const $s = [
|
|
|
3659
3659
|
}
|
|
3660
3660
|
};
|
|
3661
3661
|
}
|
|
3662
|
-
}, bo = 5, Es = ["file", "url"],
|
|
3662
|
+
}, bo = 5, Es = ["file", "url"], Fi = {
|
|
3663
3663
|
projectId: s.string().min(1).describe("The ID of the project to export as a template."),
|
|
3664
3664
|
format: s.enum(Es).default("file").describe(
|
|
3665
3665
|
'How to return the template. "file" returns the CSV content, which can be passed straight back to import-project-template. "url" returns a shareable download link instead, and is the better choice for large projects because it does not return the whole file.'
|
|
@@ -3667,17 +3667,17 @@ const $s = [
|
|
|
3667
3667
|
useRelativeDates: s.boolean().optional().describe(
|
|
3668
3668
|
'Export due dates relative to the import date (e.g. "day 3") instead of absolute dates. Defaults to false.'
|
|
3669
3669
|
)
|
|
3670
|
-
},
|
|
3670
|
+
}, Hi = {
|
|
3671
3671
|
format: s.enum(Es).describe("The format the template was exported in."),
|
|
3672
3672
|
content: s.string().optional().describe('The template as CSV content. Only present when format is "file".'),
|
|
3673
3673
|
lineCount: s.number().optional().describe('Number of rows in the exported CSV. Only present when format is "file".'),
|
|
3674
3674
|
fileName: s.string().optional().describe('The generated template file name. Only present when format is "url".'),
|
|
3675
3675
|
fileUrl: s.string().optional().describe('The shareable download URL. Only present when format is "url".')
|
|
3676
|
-
},
|
|
3676
|
+
}, Wi = {
|
|
3677
3677
|
name: y.EXPORT_PROJECT_TEMPLATE,
|
|
3678
3678
|
description: 'Export an existing project as a Todoist template, either as CSV content or as a shareable URL. Use it to duplicate a project, share its structure, or hand the CSV to import-project-template. To read a project rather than export it, use find-tasks instead — it returns structured tasks rather than raw CSV. The project itself is not modified, but the "url" format uploads a copy and returns a link that anyone holding it can open.',
|
|
3679
|
-
parameters:
|
|
3680
|
-
outputSchema:
|
|
3679
|
+
parameters: Fi,
|
|
3680
|
+
outputSchema: Hi,
|
|
3681
3681
|
// Not read-only and open world: the "url" format uploads the CSV and returns a public link.
|
|
3682
3682
|
annotations: {
|
|
3683
3683
|
readOnlyHint: !1,
|
|
@@ -3704,12 +3704,12 @@ ${c}`,
|
|
|
3704
3704
|
return {
|
|
3705
3705
|
// The full CSV already ships in structuredContent; a preview here keeps a large
|
|
3706
3706
|
// project from being spelled out twice in the response.
|
|
3707
|
-
textContent:
|
|
3707
|
+
textContent: Bi({ projectId: e, lines: a }),
|
|
3708
3708
|
structuredContent: { format: t, content: n, lineCount: a.length }
|
|
3709
3709
|
};
|
|
3710
3710
|
}
|
|
3711
3711
|
};
|
|
3712
|
-
function
|
|
3712
|
+
function Bi({ projectId: e, lines: t }) {
|
|
3713
3713
|
const o = `Exported project (id=${e}) as a template file (${t.length} row${t.length === 1 ? "" : "s"}).`, r = t.slice(0, bo).join(`
|
|
3714
3714
|
`), n = t.length - bo;
|
|
3715
3715
|
return n > 0 ? `${o}
|
|
@@ -3719,7 +3719,7 @@ ${r}
|
|
|
3719
3719
|
|
|
3720
3720
|
${r}`;
|
|
3721
3721
|
}
|
|
3722
|
-
const
|
|
3722
|
+
const Ki = ee.pick({
|
|
3723
3723
|
id: !0,
|
|
3724
3724
|
content: !0,
|
|
3725
3725
|
dueDate: !0,
|
|
@@ -3728,15 +3728,15 @@ const qi = ee.pick({
|
|
|
3728
3728
|
hasChildren: s.boolean().describe(
|
|
3729
3729
|
"Whether this subtask has subtasks of its own. Fetch it with includeChildren to expand."
|
|
3730
3730
|
)
|
|
3731
|
-
}),
|
|
3731
|
+
}), qi = me.pick({ id: !0, name: !0 }).extend({
|
|
3732
3732
|
hasChildren: s.boolean().describe(
|
|
3733
3733
|
"Whether this sub-project has sub-projects of its own. Fetch it with includeChildren to expand."
|
|
3734
3734
|
)
|
|
3735
|
-
}),
|
|
3735
|
+
}), zi = {
|
|
3736
3736
|
childCount: s.number().optional().describe(
|
|
3737
3737
|
"The number of direct children listed in children. Only present when children were requested and the type supports them. 0 means the object definitively has none."
|
|
3738
3738
|
),
|
|
3739
|
-
children: s.array(s.union([
|
|
3739
|
+
children: s.array(s.union([Ki, qi])).optional().describe(
|
|
3740
3740
|
"Direct children only: subtasks for a task, sub-projects for a project. Completed subtasks and archived sub-projects are excluded."
|
|
3741
3741
|
),
|
|
3742
3742
|
hasMoreChildren: s.boolean().optional().describe(
|
|
@@ -3746,7 +3746,7 @@ const qi = ee.pick({
|
|
|
3746
3746
|
'Present when the children lookup failed or returned incomplete information. When no children are listed alongside it, childCount is unknown - do not read its absence as "no children".'
|
|
3747
3747
|
)
|
|
3748
3748
|
};
|
|
3749
|
-
async function
|
|
3749
|
+
async function Yi(e, t) {
|
|
3750
3750
|
const { results: o, nextCursor: r } = await e.getTasks({
|
|
3751
3751
|
parentId: t,
|
|
3752
3752
|
limit: E.CHILDREN_MAX
|
|
@@ -3769,7 +3769,7 @@ async function Gi(e, t) {
|
|
|
3769
3769
|
childrenError: a ? `Could not check ${a} of ${o.length} subtasks for subtasks of their own; those are reported as hasChildren=false.` : void 0
|
|
3770
3770
|
};
|
|
3771
3771
|
}
|
|
3772
|
-
async function
|
|
3772
|
+
async function Gi(e, t) {
|
|
3773
3773
|
if (!Z(t))
|
|
3774
3774
|
return { childCount: 0, children: [] };
|
|
3775
3775
|
const o = await bs(e), r = /* @__PURE__ */ new Map();
|
|
@@ -3802,22 +3802,22 @@ function yo(e, t) {
|
|
|
3802
3802
|
const o = t.hasMoreChildren ? "+" : "", r = t.childrenError ? " (partial)" : "";
|
|
3803
3803
|
return ` • ${e}=${t.childCount}${o}${r}`;
|
|
3804
3804
|
}
|
|
3805
|
-
const As = ["task", "project", "comment", "section"],
|
|
3805
|
+
const As = ["task", "project", "comment", "section"], Vi = {
|
|
3806
3806
|
type: s.enum(As).describe("The type of object to fetch."),
|
|
3807
3807
|
id: s.string().min(1).describe("The unique ID of the object to fetch."),
|
|
3808
3808
|
includeChildren: s.boolean().optional().describe(
|
|
3809
3809
|
"Also return the direct children of the object: subtasks for a task, sub-projects for a project. Returns childCount plus a compact list, flagging each child that has children of its own. Use this to check whether a task hides subtasks instead of a speculative find-tasks lookup. Ignored for comments and sections."
|
|
3810
3810
|
)
|
|
3811
|
-
},
|
|
3811
|
+
}, Ji = {
|
|
3812
3812
|
type: s.enum(As).describe("The type of object fetched."),
|
|
3813
3813
|
id: s.string().describe("The ID of the fetched object."),
|
|
3814
|
-
object: s.union([ee, me,
|
|
3815
|
-
...
|
|
3816
|
-
},
|
|
3814
|
+
object: s.union([ee, me, Ue, se]).describe("The fetched object data."),
|
|
3815
|
+
...zi
|
|
3816
|
+
}, Xi = {
|
|
3817
3817
|
name: y.FETCH_OBJECT,
|
|
3818
3818
|
description: "Fetch a single task, project, comment, or section by its ID. Use this when you have a specific object ID and want to retrieve its full details. Set includeChildren to also get its direct subtasks or sub-projects.",
|
|
3819
|
-
parameters:
|
|
3820
|
-
outputSchema:
|
|
3819
|
+
parameters: Vi,
|
|
3820
|
+
outputSchema: Ji,
|
|
3821
3821
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3822
3822
|
async execute(e, t) {
|
|
3823
3823
|
const { type: o, id: r, includeChildren: n } = e;
|
|
@@ -3826,7 +3826,7 @@ const As = ["task", "project", "comment", "section"], Ji = {
|
|
|
3826
3826
|
case "task": {
|
|
3827
3827
|
const [a, i] = await Promise.all([
|
|
3828
3828
|
t.getTask(r),
|
|
3829
|
-
n ? go(() =>
|
|
3829
|
+
n ? go(() => Yi(t, r)) : Promise.resolve({})
|
|
3830
3830
|
]), c = K(a);
|
|
3831
3831
|
return {
|
|
3832
3832
|
textContent: `Found task: ${c.content} • id=${c.id} • priority=${c.priority} • project=${c.projectId}${yo("subtasks", i)}`,
|
|
@@ -3839,7 +3839,7 @@ const As = ["task", "project", "comment", "section"], Ji = {
|
|
|
3839
3839
|
};
|
|
3840
3840
|
}
|
|
3841
3841
|
case "project": {
|
|
3842
|
-
const a = await re(t, r), i = he(a), c = n ? await go(() =>
|
|
3842
|
+
const a = await re(t, r), i = he(a), c = n ? await go(() => Gi(t, a)) : {};
|
|
3843
3843
|
return {
|
|
3844
3844
|
textContent: `Found project: ${i.name} • id=${i.id} • color=${i.color}${i.icon ? ` • icon=${i.icon}` : ""} • viewStyle=${i.viewStyle}${yo("subProjects", c)}`,
|
|
3845
3845
|
structuredContent: {
|
|
@@ -3851,7 +3851,7 @@ const As = ["task", "project", "comment", "section"], Ji = {
|
|
|
3851
3851
|
};
|
|
3852
3852
|
}
|
|
3853
3853
|
case "comment": {
|
|
3854
|
-
const a = await t.getComment(r), i =
|
|
3854
|
+
const a = await t.getComment(r), i = Pe(a), c = i.content.length > 50 ? `${i.content.substring(0, 50)}...` : i.content;
|
|
3855
3855
|
return {
|
|
3856
3856
|
textContent: `Found comment • id=${i.id} • content="${c}" • posted=${i.postedAt}`,
|
|
3857
3857
|
structuredContent: {
|
|
@@ -3882,21 +3882,21 @@ const As = ["task", "project", "comment", "section"], Ji = {
|
|
|
3882
3882
|
);
|
|
3883
3883
|
}
|
|
3884
3884
|
}
|
|
3885
|
-
},
|
|
3885
|
+
}, Zi = {
|
|
3886
3886
|
id: s.string().min(1).describe(
|
|
3887
3887
|
'A unique identifier for the document in the format "task:{id}" or "project:{id}".'
|
|
3888
3888
|
)
|
|
3889
|
-
},
|
|
3889
|
+
}, Qi = {
|
|
3890
3890
|
id: s.string().describe("The ID of the fetched document."),
|
|
3891
3891
|
title: s.string().describe("The title of the document."),
|
|
3892
3892
|
text: s.string().describe("The text content of the document."),
|
|
3893
3893
|
url: s.string().describe("The URL of the document."),
|
|
3894
3894
|
metadata: s.record(s.string(), s.unknown()).optional().describe("Additional metadata about the document.")
|
|
3895
|
-
},
|
|
3895
|
+
}, ec = {
|
|
3896
3896
|
name: y.FETCH,
|
|
3897
3897
|
description: 'Fetch the full contents of a task or project by its ID. The ID should be in the format "task:{id}" or "project:{id}". (Comments may exist; use find-comments to retrieve them.)',
|
|
3898
|
-
parameters:
|
|
3899
|
-
outputSchema:
|
|
3898
|
+
parameters: Zi,
|
|
3899
|
+
outputSchema: Qi,
|
|
3900
3900
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3901
3901
|
async execute(e, t) {
|
|
3902
3902
|
const { id: o } = e, [r, n] = o.split(":", 2);
|
|
@@ -3959,14 +3959,14 @@ Favorite: Yes`), a = {
|
|
|
3959
3959
|
structuredContent: a
|
|
3960
3960
|
};
|
|
3961
3961
|
}
|
|
3962
|
-
},
|
|
3962
|
+
}, tc = s.union([s.iso.date(), s.iso.datetime({ offset: !0 })]);
|
|
3963
3963
|
function wo(e) {
|
|
3964
|
-
return M(e).pipe(
|
|
3964
|
+
return M(e).pipe(tc.optional());
|
|
3965
3965
|
}
|
|
3966
|
-
const
|
|
3966
|
+
const oc = {
|
|
3967
3967
|
objectType: s.enum(qo).optional().describe("Type of object to filter by."),
|
|
3968
3968
|
objectId: s.string().optional().describe("Filter by specific object ID (task, project, or comment). Requires objectType."),
|
|
3969
|
-
eventType: s.enum(
|
|
3969
|
+
eventType: s.enum(mr).optional().describe("Type of event to filter by."),
|
|
3970
3970
|
projectId: s.string().optional().describe("Filter events by parent project ID."),
|
|
3971
3971
|
taskId: s.string().optional().describe("Filter events by parent task ID (for subtask events)."),
|
|
3972
3972
|
initiatorId: s.string().optional().describe(
|
|
@@ -3980,17 +3980,17 @@ const sc = {
|
|
|
3980
3980
|
),
|
|
3981
3981
|
limit: s.number().int().min(1).max(E.ACTIVITY_MAX).default(E.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
|
|
3982
3982
|
cursor: s.string().optional().describe("Pagination cursor for retrieving the next page of results.")
|
|
3983
|
-
},
|
|
3984
|
-
events: s.array(
|
|
3983
|
+
}, sc = {
|
|
3984
|
+
events: s.array(da).describe("The activity events."),
|
|
3985
3985
|
nextCursor: s.string().optional(),
|
|
3986
3986
|
totalCount: s.number().describe("The total number of events in this page."),
|
|
3987
3987
|
hasMore: s.boolean(),
|
|
3988
3988
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
3989
|
-
},
|
|
3989
|
+
}, rc = {
|
|
3990
3990
|
name: y.FIND_ACTIVITY,
|
|
3991
3991
|
description: `Retrieve activity logs to monitor and audit changes in Todoist. Shows events from all users by default (use initiatorId to filter by specific user). To answer what someone completed in a period, including recurring task occurrences, use objectType "task", eventType "completed", and dateFrom/dateTo. For a first-person question ("what did I get done"), also set initiatorId to the current user from user-info, or the answer includes collaborators' completions. Track task completions, updates, deletions, project changes, and more with flexible filtering. Activity history availability and retention depend on the user plan.`,
|
|
3992
|
-
parameters:
|
|
3993
|
-
outputSchema:
|
|
3992
|
+
parameters: oc,
|
|
3993
|
+
outputSchema: sc,
|
|
3994
3994
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3995
3995
|
async execute(e, t) {
|
|
3996
3996
|
const {
|
|
@@ -4014,14 +4014,14 @@ const sc = {
|
|
|
4014
4014
|
cursor: p ?? null
|
|
4015
4015
|
};
|
|
4016
4016
|
o && n ? f.objectEventTypes = `${o}:${n}` : o ? f.objectEventTypes = `${o}:` : n && (f.objectEventTypes = `:${n}`), r && r !== "remove" && (f.objectId = r), a && (f.parentProjectId = a), i && (f.parentItemId = i), c && (f.initiatorId = c), d && (f.dateFrom = d), u && (f.dateTo = u);
|
|
4017
|
-
const { results: h, nextCursor: m } = await t.getActivityLogs(f), b = h.map(
|
|
4017
|
+
const { results: h, nextCursor: m } = await t.getActivityLogs(f), b = h.map(ea), g = await L.getUserShortNames(
|
|
4018
4018
|
t,
|
|
4019
4019
|
b.flatMap(
|
|
4020
4020
|
(I) => I.initiatorId && I.parentProjectId ? [I.parentProjectId] : []
|
|
4021
4021
|
)
|
|
4022
4022
|
);
|
|
4023
4023
|
return {
|
|
4024
|
-
textContent:
|
|
4024
|
+
textContent: nc({ events: b, args: e, nextCursor: m, initiatorNames: g }),
|
|
4025
4025
|
structuredContent: {
|
|
4026
4026
|
events: b,
|
|
4027
4027
|
nextCursor: m ?? void 0,
|
|
@@ -4032,7 +4032,7 @@ const sc = {
|
|
|
4032
4032
|
};
|
|
4033
4033
|
}
|
|
4034
4034
|
};
|
|
4035
|
-
function
|
|
4035
|
+
function nc({
|
|
4036
4036
|
events: e,
|
|
4037
4037
|
args: t,
|
|
4038
4038
|
nextCursor: o,
|
|
@@ -4054,7 +4054,7 @@ function ac({
|
|
|
4054
4054
|
limit: t.limit,
|
|
4055
4055
|
nextCursor: o ?? void 0,
|
|
4056
4056
|
filterHints: i,
|
|
4057
|
-
previewLines:
|
|
4057
|
+
previewLines: ac(
|
|
4058
4058
|
e,
|
|
4059
4059
|
r,
|
|
4060
4060
|
Math.min(e.length, t.limit)
|
|
@@ -4062,8 +4062,8 @@ function ac({
|
|
|
4062
4062
|
zeroReasonHints: c
|
|
4063
4063
|
});
|
|
4064
4064
|
}
|
|
4065
|
-
function
|
|
4066
|
-
const n = e.slice(0, o).map((a) =>
|
|
4065
|
+
function ac(e, t, o = 10) {
|
|
4066
|
+
const n = e.slice(0, o).map((a) => ic(a, t)).join(`
|
|
4067
4067
|
`);
|
|
4068
4068
|
if (e.length > o) {
|
|
4069
4069
|
const a = e.length - o;
|
|
@@ -4072,8 +4072,8 @@ function ic(e, t, o = 10) {
|
|
|
4072
4072
|
}
|
|
4073
4073
|
return n;
|
|
4074
4074
|
}
|
|
4075
|
-
function
|
|
4076
|
-
const o =
|
|
4075
|
+
function ic(e, t) {
|
|
4076
|
+
const o = cc(e.eventDate), r = `${e.eventType} ${e.objectType}`;
|
|
4077
4077
|
let n = "";
|
|
4078
4078
|
if (e.extraData) {
|
|
4079
4079
|
const d = e.extraData.content || e.extraData.name || e.extraData.last_content;
|
|
@@ -4088,7 +4088,7 @@ function cc(e, t) {
|
|
|
4088
4088
|
const c = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
|
|
4089
4089
|
return ` [${o}] ${r}${n}${a}${i}${c}`;
|
|
4090
4090
|
}
|
|
4091
|
-
function
|
|
4091
|
+
function cc(e) {
|
|
4092
4092
|
try {
|
|
4093
4093
|
const t = new Date(e), o = t.toLocaleDateString("en-US", { month: "short", timeZone: "UTC" }), r = t.toLocaleDateString("en-US", { day: "numeric", timeZone: "UTC" }), n = t.toLocaleTimeString("en-US", {
|
|
4094
4094
|
hour: "2-digit",
|
|
@@ -4101,7 +4101,7 @@ function dc(e) {
|
|
|
4101
4101
|
return e;
|
|
4102
4102
|
}
|
|
4103
4103
|
}
|
|
4104
|
-
const
|
|
4104
|
+
const dc = {
|
|
4105
4105
|
taskId: s.string().optional().describe("Find comments for a specific task."),
|
|
4106
4106
|
projectId: s.string().optional().describe(
|
|
4107
4107
|
'Find comments for a specific project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
@@ -4109,8 +4109,8 @@ const lc = {
|
|
|
4109
4109
|
commentId: s.string().optional().describe("Get a specific comment by ID."),
|
|
4110
4110
|
cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
|
|
4111
4111
|
limit: s.number().int().min(1).max(E.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
|
|
4112
|
-
},
|
|
4113
|
-
comments: s.array(
|
|
4112
|
+
}, lc = {
|
|
4113
|
+
comments: s.array(Ue).describe("The found comments."),
|
|
4114
4114
|
searchType: s.string().describe(
|
|
4115
4115
|
'The type of search performed: "single" (comment ID), "task" (task ID), or "project" (project ID).'
|
|
4116
4116
|
),
|
|
@@ -4118,11 +4118,11 @@ const lc = {
|
|
|
4118
4118
|
hasMore: s.boolean(),
|
|
4119
4119
|
nextCursor: s.string().optional(),
|
|
4120
4120
|
totalCount: s.number().describe("The total number of comments in this page.")
|
|
4121
|
-
},
|
|
4121
|
+
}, uc = {
|
|
4122
4122
|
name: y.FIND_COMMENTS,
|
|
4123
4123
|
description: "Find comments by task, project, or get a specific comment by ID. Exactly one of taskId, projectId, or commentId must be provided.",
|
|
4124
|
-
parameters:
|
|
4125
|
-
outputSchema:
|
|
4124
|
+
parameters: dc,
|
|
4125
|
+
outputSchema: lc,
|
|
4126
4126
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
4127
4127
|
async execute(e, t) {
|
|
4128
4128
|
const o = Ke(e.cursor), r = [e.taskId, e.projectId, e.commentId].filter(Boolean);
|
|
@@ -4155,9 +4155,9 @@ const lc = {
|
|
|
4155
4155
|
c = l.results, a = l.nextCursor !== null, i = l.nextCursor;
|
|
4156
4156
|
} else
|
|
4157
4157
|
throw new Error("Invalid state: no search parameter provided");
|
|
4158
|
-
const d = c.map(
|
|
4158
|
+
const d = c.map(Pe);
|
|
4159
4159
|
return {
|
|
4160
|
-
textContent:
|
|
4160
|
+
textContent: pc({
|
|
4161
4161
|
comments: d,
|
|
4162
4162
|
searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
|
|
4163
4163
|
searchId: e.commentId || e.taskId || e.projectId || "",
|
|
@@ -4175,7 +4175,7 @@ const lc = {
|
|
|
4175
4175
|
};
|
|
4176
4176
|
}
|
|
4177
4177
|
};
|
|
4178
|
-
function
|
|
4178
|
+
function pc({
|
|
4179
4179
|
comments: e,
|
|
4180
4180
|
searchType: t,
|
|
4181
4181
|
searchId: o,
|
|
@@ -4205,7 +4205,7 @@ function Ds(e) {
|
|
|
4205
4205
|
const t = e.getUTCFullYear(), o = String(e.getUTCMonth() + 1).padStart(2, "0"), r = String(e.getUTCDate()).padStart(2, "0");
|
|
4206
4206
|
return `${t}-${o}-${r}`;
|
|
4207
4207
|
}
|
|
4208
|
-
function
|
|
4208
|
+
function qt(e) {
|
|
4209
4209
|
const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
|
|
4210
4210
|
if (!t)
|
|
4211
4211
|
return 0;
|
|
@@ -4223,23 +4223,27 @@ function He(e, t) {
|
|
|
4223
4223
|
const d = new Date(Date.UTC(a, i - 1, c));
|
|
4224
4224
|
return d.setUTCDate(d.getUTCDate() + t), Ds(d);
|
|
4225
4225
|
}
|
|
4226
|
-
const
|
|
4226
|
+
const hc = ["and", "or"], zt = {
|
|
4227
4227
|
labels: s.string().array().max(E.FILTER_VALUES_MAX).optional().describe("The labels to filter the tasks by"),
|
|
4228
|
-
labelsOperator: s.enum(
|
|
4228
|
+
labelsOperator: s.enum(hc).optional().describe(
|
|
4229
4229
|
'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
|
|
4230
4230
|
)
|
|
4231
4231
|
};
|
|
4232
|
-
function
|
|
4232
|
+
function Yt(e) {
|
|
4233
4233
|
const t = e.trim();
|
|
4234
4234
|
return t.startsWith("@") ? t.slice(1) : t;
|
|
4235
4235
|
}
|
|
4236
4236
|
function Gt(e = [], t = "or") {
|
|
4237
4237
|
if (e.length === 0) return "";
|
|
4238
4238
|
const o = t === "and" ? " & " : " | ";
|
|
4239
|
-
return `(${e.map((a) => `@${
|
|
4239
|
+
return `(${e.map((a) => `@${Tt(Yt(a))}`).join(` ${o} `)})`;
|
|
4240
4240
|
}
|
|
4241
|
-
function
|
|
4242
|
-
|
|
4241
|
+
function mc(e, t, o = "or") {
|
|
4242
|
+
const r = t.map(Yt);
|
|
4243
|
+
return o === "and" ? r.every((n) => e.includes(n)) : r.some((n) => e.includes(n));
|
|
4244
|
+
}
|
|
4245
|
+
function Te(e, t = "or") {
|
|
4246
|
+
return e.map((o) => `@${Yt(o)}`).join(t === "and" ? " & " : " | ");
|
|
4243
4247
|
}
|
|
4244
4248
|
const { FIND_ACTIVITY: To } = y, fc = 7;
|
|
4245
4249
|
function bc({
|
|
@@ -4248,7 +4252,7 @@ function bc({
|
|
|
4248
4252
|
userGmtOffset: o,
|
|
4249
4253
|
now: r = /* @__PURE__ */ new Date()
|
|
4250
4254
|
}) {
|
|
4251
|
-
const n =
|
|
4255
|
+
const n = qt(o), a = xs(r, n), i = fc - 1, c = t ?? (e ? He(e, i) : a);
|
|
4252
4256
|
return {
|
|
4253
4257
|
since: e ?? He(c, -i),
|
|
4254
4258
|
until: c
|
|
@@ -4277,7 +4281,7 @@ const gc = {
|
|
|
4277
4281
|
cursor: s.string().optional().describe(
|
|
4278
4282
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
4279
4283
|
),
|
|
4280
|
-
...
|
|
4284
|
+
...zt
|
|
4281
4285
|
}, yc = {
|
|
4282
4286
|
tasks: s.array(ee).describe("The found completed tasks."),
|
|
4283
4287
|
nextCursor: s.string().optional(),
|
|
@@ -4306,9 +4310,9 @@ const gc = {
|
|
|
4306
4310
|
throw new Error(
|
|
4307
4311
|
"Cursor pagination requires explicit since and until. Reuse structuredContent.appliedFilters.since and structuredContent.appliedFilters.until from the previous page."
|
|
4308
4312
|
);
|
|
4309
|
-
const f = await
|
|
4313
|
+
const f = await Dt(t, c), h = f?.email;
|
|
4310
4314
|
let b = Gt(r, n);
|
|
4311
|
-
f && h && (b =
|
|
4315
|
+
f && h && (b = Ie(b, `assigned to: ${h}`));
|
|
4312
4316
|
const g = await t.getUser(), w = g.tzInfo?.gmtString || "+00:00", I = await pe({
|
|
4313
4317
|
projectId: d,
|
|
4314
4318
|
user: g
|
|
@@ -4342,7 +4346,7 @@ const gc = {
|
|
|
4342
4346
|
userGmtOffset: w,
|
|
4343
4347
|
nextCursor: x,
|
|
4344
4348
|
assigneeEmail: h,
|
|
4345
|
-
assigneeNames: await
|
|
4349
|
+
assigneeNames: await ke(t, U, g.id)
|
|
4346
4350
|
}),
|
|
4347
4351
|
structuredContent: {
|
|
4348
4352
|
tasks: U,
|
|
@@ -4364,7 +4368,7 @@ function Tc({
|
|
|
4364
4368
|
}) {
|
|
4365
4369
|
const i = t.getBy === "completion" ? "completed" : "due", c = `Completed tasks (by ${i} date)`, d = [];
|
|
4366
4370
|
if (d.push(`${i} date: ${t.since} to ${t.until}`), t.projectId && d.push(`project: ${t.projectId}`), t.sectionId && d.push(`section: ${t.sectionId}`), t.parentId && d.push(`parent: ${t.parentId}`), t.workspaceId && d.push(`workspace: ${t.workspaceId}`), t.labels && t.labels.length > 0) {
|
|
4367
|
-
const l =
|
|
4371
|
+
const l = Te(t.labels, t.labelsOperator);
|
|
4368
4372
|
d.push(`labels: ${l}`);
|
|
4369
4373
|
}
|
|
4370
4374
|
if (t.responsibleUser) {
|
|
@@ -4399,7 +4403,7 @@ const { ADD_FOLDERS: Ic, FIND_PROJECTS: vc, LIST_WORKSPACES: Sc } = y, Cc = {
|
|
|
4399
4403
|
`The workspace to list folders for, by name or ID (see ${Sc}). Omit to list the folders of every workspace.`
|
|
4400
4404
|
)
|
|
4401
4405
|
}, jc = {
|
|
4402
|
-
folders: s.array(
|
|
4406
|
+
folders: s.array(Pt).describe("In sidebar order within each workspace."),
|
|
4403
4407
|
totalCount: s.number()
|
|
4404
4408
|
}, $c = {
|
|
4405
4409
|
name: y.FIND_FOLDERS,
|
|
@@ -4408,7 +4412,7 @@ const { ADD_FOLDERS: Ic, FIND_PROJECTS: vc, LIST_WORKSPACES: Sc } = y, Cc = {
|
|
|
4408
4412
|
outputSchema: jc,
|
|
4409
4413
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
4410
4414
|
async execute({ workspace: e }, t) {
|
|
4411
|
-
const o = e ? [await
|
|
4415
|
+
const o = e ? [await _e.resolveWorkspace(t, e)] : await _e.listWorkspaces(t), r = await Promise.all(
|
|
4412
4416
|
o.map(async (a) => ({
|
|
4413
4417
|
...a,
|
|
4414
4418
|
folders: await Ec(t, a.workspaceId)
|
|
@@ -4425,7 +4429,7 @@ async function Ec(e, t) {
|
|
|
4425
4429
|
apiMethod: (r) => j(() => e.getFolders(r)),
|
|
4426
4430
|
args: { workspaceId: t },
|
|
4427
4431
|
limit: E.FOLDERS_MAX
|
|
4428
|
-
})).sort((r, n) => r.defaultOrder - n.defaultOrder).map(
|
|
4432
|
+
})).sort((r, n) => r.defaultOrder - n.defaultOrder).map(Ut);
|
|
4429
4433
|
}
|
|
4430
4434
|
function Ac(e) {
|
|
4431
4435
|
return e.length === 0 ? "The user is not in any workspace. Folders exist only in workspaces; personal projects nest under a parent project instead." : e.map(
|
|
@@ -4451,7 +4455,7 @@ const Dc = {
|
|
|
4451
4455
|
"The cursor to get the next page of labels (cursor is obtained from the previous call to this tool, with the same parameters). Ignored when searchText is provided."
|
|
4452
4456
|
)
|
|
4453
4457
|
}, xc = {
|
|
4454
|
-
labels: s.array(
|
|
4458
|
+
labels: s.array(je).describe("The found personal labels."),
|
|
4455
4459
|
nextCursor: s.string().optional(),
|
|
4456
4460
|
totalCount: s.number().describe("The total number of labels in this page."),
|
|
4457
4461
|
hasMore: s.boolean(),
|
|
@@ -4467,16 +4471,16 @@ const Dc = {
|
|
|
4467
4471
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
4468
4472
|
async execute(e, t) {
|
|
4469
4473
|
const [o, r] = await Promise.all([
|
|
4470
|
-
e.searchText ?
|
|
4474
|
+
e.searchText ? Xn(t, e.searchText).then((c) => ({
|
|
4471
4475
|
results: c,
|
|
4472
4476
|
nextCursor: null
|
|
4473
4477
|
})) : t.getLabels({ limit: e.limit, cursor: e.cursor ?? null }),
|
|
4474
|
-
|
|
4478
|
+
Zn(t)
|
|
4475
4479
|
]), { results: n, nextCursor: a } = o, i = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
|
|
4476
4480
|
return {
|
|
4477
4481
|
textContent: _c({ labels: n, args: e, nextCursor: a, sharedLabels: r }),
|
|
4478
4482
|
structuredContent: {
|
|
4479
|
-
labels: n.map((c) =>
|
|
4483
|
+
labels: n.map((c) => je.parse(c)),
|
|
4480
4484
|
nextCursor: a ?? void 0,
|
|
4481
4485
|
totalCount: n.length,
|
|
4482
4486
|
hasMore: !!a,
|
|
@@ -4494,7 +4498,7 @@ function _c({
|
|
|
4494
4498
|
}) {
|
|
4495
4499
|
const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", a = [];
|
|
4496
4500
|
t.searchText && a.push(`searchText: "${t.searchText}"`);
|
|
4497
|
-
const i = 10, d = e.slice(0, i).map(
|
|
4501
|
+
const i = 10, d = e.slice(0, i).map(ha).join(`
|
|
4498
4502
|
`), u = e.length - i, l = u > 0 ? `${d}
|
|
4499
4503
|
…and ${u} more` : d, p = [];
|
|
4500
4504
|
e.length === 0 && (t.searchText ? (p.push("Try broader search terms"), p.push("Check spelling"), p.push("Remove searchText to see all labels")) : p.push("No personal labels created yet"));
|
|
@@ -4511,7 +4515,7 @@ No shared labels.`;
|
|
|
4511
4515
|
zeroReasonHints: p
|
|
4512
4516
|
}) + f;
|
|
4513
4517
|
}
|
|
4514
|
-
const { FIND_PROJECTS:
|
|
4518
|
+
const { FIND_PROJECTS: Os, ADD_TASKS: _s, UPDATE_TASKS: Ps } = y, Pc = {
|
|
4515
4519
|
projectId: s.string().min(1).optional().describe(
|
|
4516
4520
|
'Optional. If provided, searches only collaborators of this project. If omitted, searches across the collaborators of all shared projects the authenticated user can access (plus the authenticated user themselves) — use this for general "find a user" / "who is X" lookups.'
|
|
4517
4521
|
),
|
|
@@ -4519,7 +4523,7 @@ const { FIND_PROJECTS: _s, ADD_TASKS: Ps, UPDATE_TASKS: Us } = y, Pc = {
|
|
|
4519
4523
|
"Search for a user by name or email (partial and case insensitive match). If omitted, all users are returned."
|
|
4520
4524
|
)
|
|
4521
4525
|
}, Uc = {
|
|
4522
|
-
collaborators: s.array(
|
|
4526
|
+
collaborators: s.array(la).describe("The found users."),
|
|
4523
4527
|
projectInfo: s.object({
|
|
4524
4528
|
id: s.string().describe("The project ID."),
|
|
4525
4529
|
name: s.string().describe("The project name."),
|
|
@@ -4548,7 +4552,7 @@ const { FIND_PROJECTS: _s, ADD_TASKS: Ps, UPDATE_TASKS: Us } = y, Pc = {
|
|
|
4548
4552
|
|
|
4549
4553
|
**Next steps:**
|
|
4550
4554
|
• Share the project to enable collaboration
|
|
4551
|
-
• Use ${
|
|
4555
|
+
• Use ${_s} and ${Ps} for assignment features once shared`,
|
|
4552
4556
|
structuredContent: {
|
|
4553
4557
|
collaborators: [],
|
|
4554
4558
|
projectInfo: {
|
|
@@ -4585,9 +4589,9 @@ const { FIND_PROJECTS: _s, ADD_TASKS: Ps, UPDATE_TASKS: Us } = y, Pc = {
|
|
|
4585
4589
|
appliedFilters: e
|
|
4586
4590
|
}
|
|
4587
4591
|
};
|
|
4588
|
-
const c =
|
|
4592
|
+
const c = Us(i, r);
|
|
4589
4593
|
return {
|
|
4590
|
-
textContent:
|
|
4594
|
+
textContent: Rs({
|
|
4591
4595
|
collaborators: c,
|
|
4592
4596
|
projectName: n,
|
|
4593
4597
|
searchTerm: r,
|
|
@@ -4618,7 +4622,7 @@ async function Nc({
|
|
|
4618
4622
|
textContent: `No users found. You may have no shared projects, or collaborator data is not accessible.
|
|
4619
4623
|
|
|
4620
4624
|
**Next steps:**
|
|
4621
|
-
• Use ${
|
|
4625
|
+
• Use ${Os} to find shared projects
|
|
4622
4626
|
• Share a project to add collaborators
|
|
4623
4627
|
• Ensure you have permission to view collaborators`,
|
|
4624
4628
|
structuredContent: {
|
|
@@ -4629,9 +4633,9 @@ async function Nc({
|
|
|
4629
4633
|
appliedFilters: o
|
|
4630
4634
|
}
|
|
4631
4635
|
};
|
|
4632
|
-
const a =
|
|
4636
|
+
const a = Us(n, e);
|
|
4633
4637
|
return {
|
|
4634
|
-
textContent:
|
|
4638
|
+
textContent: Rs({
|
|
4635
4639
|
collaborators: a,
|
|
4636
4640
|
projectName: void 0,
|
|
4637
4641
|
searchTerm: e,
|
|
@@ -4657,7 +4661,7 @@ async function Lc(e, t) {
|
|
|
4657
4661
|
return t;
|
|
4658
4662
|
}
|
|
4659
4663
|
}
|
|
4660
|
-
function
|
|
4664
|
+
function Us(e, t) {
|
|
4661
4665
|
if (!t)
|
|
4662
4666
|
return e;
|
|
4663
4667
|
const o = t.toLowerCase().trim();
|
|
@@ -4665,7 +4669,7 @@ function Rs(e, t) {
|
|
|
4665
4669
|
(r) => r.name.toLowerCase().includes(o) || r.email.toLowerCase().includes(o)
|
|
4666
4670
|
);
|
|
4667
4671
|
}
|
|
4668
|
-
function
|
|
4672
|
+
function Rs({
|
|
4669
4673
|
collaborators: e,
|
|
4670
4674
|
projectName: t,
|
|
4671
4675
|
searchTerm: o,
|
|
@@ -4681,7 +4685,7 @@ function Ns({
|
|
|
4681
4685
|
const u = [];
|
|
4682
4686
|
e.length === 0 && o && (u.push(`No users match "${o}"`), u.push("Try a broader search term or check spelling"), r > 0 && u.push(`${r} users available without filter`));
|
|
4683
4687
|
const l = [];
|
|
4684
|
-
return e.length > 0 ? (l.push(`Use ${
|
|
4688
|
+
return e.length > 0 ? (l.push(`Use ${_s} with responsibleUser to assign new tasks`), l.push(`Use ${Ps} with responsibleUser to reassign existing tasks`), l.push("Use user names, emails, or IDs for assignments")) : (l.push(`Use ${Os} to find other projects`), o && r > 0 && l.push("Try searching without filters to see all users")), te({
|
|
4685
4689
|
subject: i,
|
|
4686
4690
|
count: e.length,
|
|
4687
4691
|
filterHints: c,
|
|
@@ -4691,7 +4695,7 @@ function Ns({
|
|
|
4691
4695
|
nextSteps: l
|
|
4692
4696
|
});
|
|
4693
4697
|
}
|
|
4694
|
-
const { ADD_PROJECTS: ko, FIND_FOLDERS:
|
|
4698
|
+
const { ADD_PROJECTS: ko, FIND_FOLDERS: Ns, PROJECT_MANAGEMENT: Ls } = y, Mc = {
|
|
4695
4699
|
active: "projects",
|
|
4696
4700
|
archived: "archived projects",
|
|
4697
4701
|
all: "projects (active and archived)"
|
|
@@ -4706,9 +4710,9 @@ const { ADD_PROJECTS: ko, FIND_FOLDERS: Ls, PROJECT_MANAGEMENT: Ms } = y, Mc = {
|
|
|
4706
4710
|
archivedStatus: s.enum(["active", "archived", "all"]).optional().describe(
|
|
4707
4711
|
"Which projects to return by archive status: 'active' (default, non-archived only), 'archived' (archived only), or 'all' (both active and archived). Each project includes an isArchived field. Archived projects can be deleted via the delete-object tool (type: 'project')."
|
|
4708
4712
|
),
|
|
4709
|
-
folderId: s.string().min(1).optional().describe(`Only projects in this workspace folder (see ${
|
|
4713
|
+
folderId: s.string().min(1).optional().describe(`Only projects in this workspace folder (see ${Ns}).`),
|
|
4710
4714
|
includeUnjoined: s.boolean().optional().describe(
|
|
4711
|
-
`Also list workspace projects the user can join but hasn't, in unjoinedProjects (first page only). They can't be read until joined; join with ${
|
|
4715
|
+
`Also list workspace projects the user can join but hasn't, in unjoinedProjects (first page only). They can't be read until joined; join with ${Ls} (action 'join') only when the user asks.`
|
|
4712
4716
|
)
|
|
4713
4717
|
}, Hc = s.object({
|
|
4714
4718
|
id: s.string(),
|
|
@@ -4735,7 +4739,7 @@ const { ADD_PROJECTS: ko, FIND_FOLDERS: Ls, PROJECT_MANAGEMENT: Ms } = y, Mc = {
|
|
|
4735
4739
|
if (Vt(e)) {
|
|
4736
4740
|
const d = Promise.resolve([]), [u, l] = await Promise.all([
|
|
4737
4741
|
r === "archived" ? d : o ? fs(t, o) : bs(t, e.folderId),
|
|
4738
|
-
r === "active" ? d :
|
|
4742
|
+
r === "active" ? d : Jn(t)
|
|
4739
4743
|
]), p = o ? gs(o) : null, f = p ? l.filter((b) => p.test(b.name)) : l, { folderId: h } = e, m = [...u, ...f];
|
|
4740
4744
|
n = h ? m.filter(
|
|
4741
4745
|
(b) => F(b) && b.folderId === h
|
|
@@ -4769,16 +4773,16 @@ const { ADD_PROJECTS: ko, FIND_FOLDERS: Ls, PROJECT_MANAGEMENT: Ms } = y, Mc = {
|
|
|
4769
4773
|
function Vt({ searchText: e, archivedStatus: t, folderId: o }) {
|
|
4770
4774
|
return !!e || t === "all" || !!o && t === "archived";
|
|
4771
4775
|
}
|
|
4772
|
-
function
|
|
4776
|
+
function Ms(e) {
|
|
4773
4777
|
return e.archivedStatus === "archived" ? !1 : Vt(e) || !e.cursor;
|
|
4774
4778
|
}
|
|
4775
4779
|
async function Kc(e, t, o) {
|
|
4776
4780
|
const { includeUnjoined: r, searchText: n, limit: a } = t, i = !!n && o === 0;
|
|
4777
|
-
if (!
|
|
4781
|
+
if (!Ms(t) || !(r || i))
|
|
4778
4782
|
return;
|
|
4779
4783
|
let c;
|
|
4780
4784
|
try {
|
|
4781
|
-
c = await
|
|
4785
|
+
c = await Ot(e);
|
|
4782
4786
|
} catch (p) {
|
|
4783
4787
|
if (r) throw p;
|
|
4784
4788
|
return;
|
|
@@ -4799,14 +4803,14 @@ function zc({
|
|
|
4799
4803
|
}) {
|
|
4800
4804
|
const n = Mc[t.archivedStatus ?? "active"], a = t.searchText ? `All ${n} matching "${t.searchText}"` : `${n.charAt(0).toUpperCase()}${n.slice(1)}`, i = [];
|
|
4801
4805
|
t.searchText && i.push(`searchText: "${t.searchText}"`), t.archivedStatus && t.archivedStatus !== "active" && i.push(`archivedStatus: "${t.archivedStatus}"`), t.folderId && i.push(`folderId: "${t.folderId}"`);
|
|
4802
|
-
const c = 10, u = e.slice(0, c).map(
|
|
4806
|
+
const c = 10, u = e.slice(0, c).map(ma).join(`
|
|
4803
4807
|
`), l = e.length - c, p = l > 0 ? `${u}
|
|
4804
4808
|
…and ${l} more` : u, f = [], h = t.folderId ? " in this folder" : "";
|
|
4805
|
-
e.length === 0 && (t.searchText && r?.total ? f.push("None of the projects the user has joined match") : t.searchText ? (r ? f.push("No workspace project the user hasn't joined matches either") :
|
|
4809
|
+
e.length === 0 && (t.searchText && r?.total ? f.push("None of the projects the user has joined match") : t.searchText ? (r ? f.push("No workspace project the user hasn't joined matches either") : Ms(t) && f.push(
|
|
4806
4810
|
"Set includeUnjoined to also search workspace projects the user hasn't joined"
|
|
4807
4811
|
), f.push("Try broader search terms"), f.push("Check spelling"), f.push("Remove searchText to see all projects")) : t.folderId && r?.total ? f.push("None of the projects the user has joined are in this folder") : t.archivedStatus === "archived" ? (f.push(`No archived projects${h}`), f.push("Use archivedStatus: 'all' to also see active projects")) : t.archivedStatus === "all" ? (f.push(
|
|
4808
4812
|
t.folderId ? "No projects in this folder" : "No projects created yet"
|
|
4809
|
-
), t.folderId || f.push(`Use ${ko} to create a project`)) : (f.push(`No active projects${h}`), f.push("Use archivedStatus: 'all' to include archived projects"), t.folderId || f.push(`Use ${ko} to create a project`)), t.folderId && !r?.total && f.push(`Use ${
|
|
4813
|
+
), t.folderId || f.push(`Use ${ko} to create a project`)) : (f.push(`No active projects${h}`), f.push("Use archivedStatus: 'all' to include archived projects"), t.folderId || f.push(`Use ${ko} to create a project`)), t.folderId && !r?.total && f.push(`Use ${Ns} to check the folder ID`));
|
|
4810
4814
|
const m = te({
|
|
4811
4815
|
subject: a,
|
|
4812
4816
|
count: e.length,
|
|
@@ -4825,7 +4829,7 @@ function zc({
|
|
|
4825
4829
|
m,
|
|
4826
4830
|
`Workspace projects the user hasn't joined (${r.total}):`,
|
|
4827
4831
|
...b,
|
|
4828
|
-
`Their tasks, comments and activity can't be read until the user joins. Ask the user before joining one with ${
|
|
4832
|
+
`Their tasks, comments and activity can't be read until the user joins. Ask the user before joining one with ${Ls} (action: "join").`
|
|
4829
4833
|
].join(`
|
|
4830
4834
|
`);
|
|
4831
4835
|
}
|
|
@@ -4836,7 +4840,7 @@ const Yc = {
|
|
|
4836
4840
|
reminderId: s.string().optional().describe("Get a specific time-based reminder (relative or absolute) by its ID."),
|
|
4837
4841
|
locationReminderId: s.string().optional().describe("Get a specific location reminder by its ID.")
|
|
4838
4842
|
}, Gc = {
|
|
4839
|
-
reminders: s.array(
|
|
4843
|
+
reminders: s.array(Rt).describe("The found reminders (time-based and location)."),
|
|
4840
4844
|
searchType: s.string().describe('The search type used: "task", "reminder", or "location_reminder".'),
|
|
4841
4845
|
searchId: s.string().describe("The ID used for the search."),
|
|
4842
4846
|
totalCount: s.number().describe("Total reminders in this response.")
|
|
@@ -4855,7 +4859,7 @@ const Yc = {
|
|
|
4855
4859
|
"Only one of taskId, reminderId, or locationReminderId can be provided at a time."
|
|
4856
4860
|
);
|
|
4857
4861
|
if (r) {
|
|
4858
|
-
const i = await t.getReminder(r), c =
|
|
4862
|
+
const i = await t.getReminder(r), c = Oe(i);
|
|
4859
4863
|
return {
|
|
4860
4864
|
textContent: `Found ${i.type} reminder (id=${r})`,
|
|
4861
4865
|
structuredContent: {
|
|
@@ -4867,7 +4871,7 @@ const Yc = {
|
|
|
4867
4871
|
};
|
|
4868
4872
|
}
|
|
4869
4873
|
if (n) {
|
|
4870
|
-
const i = await t.getLocationReminder(n), c =
|
|
4874
|
+
const i = await t.getLocationReminder(n), c = Oe(i);
|
|
4871
4875
|
return {
|
|
4872
4876
|
textContent: `Found location reminder (id=${n})`,
|
|
4873
4877
|
structuredContent: {
|
|
@@ -4888,7 +4892,7 @@ const Yc = {
|
|
|
4888
4892
|
apiMethod: (p) => t.getLocationReminders(p),
|
|
4889
4893
|
args: { taskId: o }
|
|
4890
4894
|
})
|
|
4891
|
-
]), u = [...i, ...c].map(
|
|
4895
|
+
]), u = [...i, ...c].map(Oe);
|
|
4892
4896
|
return {
|
|
4893
4897
|
textContent: Jc(u, o),
|
|
4894
4898
|
structuredContent: {
|
|
@@ -4939,7 +4943,7 @@ const { ADD_SECTIONS: Xc } = y, Zc = {
|
|
|
4939
4943
|
client: t
|
|
4940
4944
|
});
|
|
4941
4945
|
let r;
|
|
4942
|
-
e.searchText ? r = await
|
|
4946
|
+
e.searchText ? r = await Qn(t, e.searchText, o) : r = (await t.getSections({
|
|
4943
4947
|
projectId: o
|
|
4944
4948
|
})).results;
|
|
4945
4949
|
const n = r.map(ne);
|
|
@@ -4973,20 +4977,20 @@ function td({
|
|
|
4973
4977
|
zeroReasonHints: r
|
|
4974
4978
|
});
|
|
4975
4979
|
}
|
|
4976
|
-
function
|
|
4980
|
+
function Fs(e) {
|
|
4977
4981
|
return /* @__PURE__ */ new Date(`${e}T00:00:00`);
|
|
4978
4982
|
}
|
|
4979
|
-
const
|
|
4983
|
+
const Ze = "+00:00";
|
|
4980
4984
|
async function od(e, t) {
|
|
4981
4985
|
if (t)
|
|
4982
|
-
return t.tzInfo?.gmtString ||
|
|
4986
|
+
return t.tzInfo?.gmtString || Ze;
|
|
4983
4987
|
try {
|
|
4984
|
-
return (await j(() => e.getUser())).tzInfo?.gmtString ||
|
|
4988
|
+
return (await j(() => e.getUser())).tzInfo?.gmtString || Ze;
|
|
4985
4989
|
} catch (o) {
|
|
4986
4990
|
return console.error(
|
|
4987
4991
|
`${y.FIND_TASKS_BY_DATE}: could not load the user's timezone, using UTC`,
|
|
4988
4992
|
o
|
|
4989
|
-
),
|
|
4993
|
+
), Ze;
|
|
4990
4994
|
}
|
|
4991
4995
|
}
|
|
4992
4996
|
const sd = {
|
|
@@ -5009,7 +5013,7 @@ const sd = {
|
|
|
5009
5013
|
responsibleUserFiltering: s.enum(ms).optional().describe(
|
|
5010
5014
|
"Filter when responsibleUser is omitted. 'assigned'=assigned to others; 'unassignedOrMe'=unassigned+mine; 'all'=everyone. Default: 'unassignedOrMe'."
|
|
5011
5015
|
),
|
|
5012
|
-
...
|
|
5016
|
+
...zt
|
|
5013
5017
|
}, rd = {
|
|
5014
5018
|
tasks: s.array(ee).describe("The found tasks."),
|
|
5015
5019
|
nextCursor: s.string().optional(),
|
|
@@ -5023,30 +5027,30 @@ const sd = {
|
|
|
5023
5027
|
outputSchema: rd,
|
|
5024
5028
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
5025
5029
|
async execute(e, t) {
|
|
5026
|
-
const o = e.startDate !== void 0 || e.overdueOption === "overdue-only" ? e : { ...e, startDate: "today" }, r = Ke(o.cursor), n = await
|
|
5030
|
+
const o = e.startDate !== void 0 || e.overdueOption === "overdue-only" ? e : { ...e, startDate: "today" }, r = Ke(o.cursor), n = await Dt(t, o.responsibleUser), a = n?.userId, i = n?.email, c = o.responsibleUser?.trim().toLowerCase() === ht, d = a && !c ? await t.getUser() : void 0, u = c ? a : d?.id;
|
|
5027
5031
|
let l = "";
|
|
5028
5032
|
if (o.overdueOption === "overdue-only")
|
|
5029
5033
|
l = "overdue";
|
|
5030
5034
|
else if (o.startDate === "today")
|
|
5031
5035
|
if (o.daysCount > 1) {
|
|
5032
|
-
const g = await od(t, d), w = xs(/* @__PURE__ */ new Date(),
|
|
5036
|
+
const g = await od(t, d), w = xs(/* @__PURE__ */ new Date(), qt(g)), I = He(w, o.daysCount), k = `(due after: ${w} | due: ${w}) & due before: ${I}`;
|
|
5033
5037
|
l = o.overdueOption === "exclude-overdue" ? k : `(${k} | overdue)`;
|
|
5034
5038
|
} else
|
|
5035
5039
|
l = o.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
|
|
5036
5040
|
else if (o.startDate) {
|
|
5037
|
-
const g = o.startDate, w = zo(
|
|
5041
|
+
const g = o.startDate, w = zo(Fs(g), o.daysCount), I = yr(w, { representation: "date" });
|
|
5038
5042
|
l = `(due after: ${g} | due: ${g}) & due before: ${I}`;
|
|
5039
5043
|
}
|
|
5040
5044
|
const p = Gt(o.labels, o.labelsOperator);
|
|
5041
|
-
p.length > 0 && (l =
|
|
5042
|
-
const f =
|
|
5045
|
+
p.length > 0 && (l = Ie(l, `(${p})`));
|
|
5046
|
+
const f = mt({
|
|
5043
5047
|
resolvedAssigneeId: a,
|
|
5044
5048
|
assigneeEmail: i,
|
|
5045
5049
|
currentUserId: u,
|
|
5046
5050
|
responsibleUserFiltering: o.responsibleUserFiltering
|
|
5047
5051
|
});
|
|
5048
|
-
l =
|
|
5049
|
-
const { tasks: h, nextCursor: m } = await
|
|
5052
|
+
l = Ie(l, f);
|
|
5053
|
+
const { tasks: h, nextCursor: m } = await _t({
|
|
5050
5054
|
client: t,
|
|
5051
5055
|
query: l,
|
|
5052
5056
|
cursor: r,
|
|
@@ -5058,7 +5062,7 @@ const sd = {
|
|
|
5058
5062
|
args: o,
|
|
5059
5063
|
nextCursor: m,
|
|
5060
5064
|
assigneeEmail: i,
|
|
5061
|
-
assigneeNames: await
|
|
5065
|
+
assigneeNames: await ke(t, h, u)
|
|
5062
5066
|
}),
|
|
5063
5067
|
structuredContent: {
|
|
5064
5068
|
tasks: h,
|
|
@@ -5086,11 +5090,11 @@ function ad({
|
|
|
5086
5090
|
`today${d}${t.daysCount > 1 ? ` + ${t.daysCount - 1} more days` : ""}`
|
|
5087
5091
|
);
|
|
5088
5092
|
} else if (t.startDate) {
|
|
5089
|
-
const d = t.daysCount > 1 ? ` to ${
|
|
5093
|
+
const d = t.daysCount > 1 ? ` to ${De(zo(Fs(t.startDate), t.daysCount))}` : "";
|
|
5090
5094
|
a.push(`${t.startDate}${d}`);
|
|
5091
5095
|
}
|
|
5092
5096
|
if (t.labels && t.labels.length > 0) {
|
|
5093
|
-
const d =
|
|
5097
|
+
const d = Te(t.labels, t.labelsOperator);
|
|
5094
5098
|
a.push(`labels: ${d}`);
|
|
5095
5099
|
}
|
|
5096
5100
|
if (t.responsibleUser) {
|
|
@@ -5208,7 +5212,7 @@ const dd = new cd(), { FIND_COMPLETED_TASKS: Io, ADD_TASKS: vo } = y, ld = {
|
|
|
5208
5212
|
filterIdOrName: s.string().optional().describe(
|
|
5209
5213
|
"The ID or name of a saved Todoist filter. The filter's query will be fetched and used to find tasks. Cannot be used with the `filter` parameter, projectId, sectionId, or parentId."
|
|
5210
5214
|
),
|
|
5211
|
-
...
|
|
5215
|
+
...zt
|
|
5212
5216
|
}, ud = {
|
|
5213
5217
|
tasks: s.array(ee).describe("The found tasks."),
|
|
5214
5218
|
nextCursor: s.string().optional(),
|
|
@@ -5246,64 +5250,62 @@ const dd = new cd(), { FIND_COMPLETED_TASKS: Io, ADD_TASKS: vo } = y, ld = {
|
|
|
5246
5250
|
);
|
|
5247
5251
|
let w = f;
|
|
5248
5252
|
h && (w = (await dd.resolveFilter(t, h)).filterQuery);
|
|
5249
|
-
const I = await
|
|
5253
|
+
const I = await Dt(t, i), k = I?.userId, S = I?.email;
|
|
5250
5254
|
if (r || n || a) {
|
|
5251
5255
|
const U = {
|
|
5252
5256
|
limit: d,
|
|
5253
5257
|
cursor: m ?? null
|
|
5254
5258
|
};
|
|
5255
5259
|
r && (U.projectId = await pe({ projectId: r, user: b })), n && (U.sectionId = n), a && (U.parentId = a);
|
|
5256
|
-
const { results:
|
|
5257
|
-
let
|
|
5258
|
-
(
|
|
5260
|
+
const { results: Re, nextCursor: ae } = await t.getTasks(U), ie = Re.map(K);
|
|
5261
|
+
let V = o ? ie.filter(
|
|
5262
|
+
(Ne) => Ne.content.toLowerCase().includes(o.toLowerCase()) || Ne.description?.toLowerCase().includes(o.toLowerCase())
|
|
5259
5263
|
) : ie;
|
|
5260
|
-
return
|
|
5261
|
-
tasks:
|
|
5264
|
+
return V = Yn({
|
|
5265
|
+
tasks: V,
|
|
5262
5266
|
resolvedAssigneeId: k,
|
|
5263
5267
|
currentUserId: b.id,
|
|
5264
5268
|
responsibleUserFiltering: c
|
|
5265
|
-
}), l && l.length > 0 && (
|
|
5266
|
-
(
|
|
5267
|
-
) : z.filter(
|
|
5268
|
-
(fe) => l.some((Ve) => fe.labels.includes(Ve))
|
|
5269
|
+
}), l && l.length > 0 && (V = V.filter(
|
|
5270
|
+
(Ne) => mc(Ne.labels, l, p)
|
|
5269
5271
|
)), {
|
|
5270
|
-
textContent:
|
|
5271
|
-
tasks:
|
|
5272
|
+
textContent: Qe({
|
|
5273
|
+
tasks: V,
|
|
5272
5274
|
args: e,
|
|
5273
5275
|
nextCursor: ae,
|
|
5274
5276
|
isContainerSearch: !0,
|
|
5275
5277
|
assigneeEmail: S,
|
|
5276
|
-
assigneeNames: await
|
|
5278
|
+
assigneeNames: await ke(t, V, b.id)
|
|
5277
5279
|
}),
|
|
5278
5280
|
structuredContent: {
|
|
5279
|
-
tasks:
|
|
5281
|
+
tasks: V,
|
|
5280
5282
|
nextCursor: ae ?? void 0,
|
|
5281
|
-
totalCount:
|
|
5283
|
+
totalCount: V.length,
|
|
5282
5284
|
hasMore: !!ae,
|
|
5283
5285
|
appliedFilters: e
|
|
5284
5286
|
}
|
|
5285
5287
|
};
|
|
5286
5288
|
}
|
|
5287
5289
|
if (k && !o && !g && !w) {
|
|
5288
|
-
const U =
|
|
5290
|
+
const U = mt({
|
|
5289
5291
|
resolvedAssigneeId: k,
|
|
5290
5292
|
assigneeEmail: S,
|
|
5291
5293
|
currentUserId: b.id,
|
|
5292
5294
|
responsibleUserFiltering: c
|
|
5293
|
-
}), { results:
|
|
5295
|
+
}), { results: Re, nextCursor: ae } = await t.getTasksByFilter({
|
|
5294
5296
|
query: U,
|
|
5295
5297
|
lang: "en",
|
|
5296
5298
|
limit: d,
|
|
5297
5299
|
cursor: m ?? null
|
|
5298
|
-
}), ie =
|
|
5300
|
+
}), ie = Re.map(K);
|
|
5299
5301
|
return {
|
|
5300
|
-
textContent:
|
|
5302
|
+
textContent: Qe({
|
|
5301
5303
|
tasks: ie,
|
|
5302
5304
|
args: e,
|
|
5303
5305
|
nextCursor: ae,
|
|
5304
5306
|
isContainerSearch: !1,
|
|
5305
5307
|
assigneeEmail: S,
|
|
5306
|
-
assigneeNames: await
|
|
5308
|
+
assigneeNames: await ke(t, ie, b.id)
|
|
5307
5309
|
}),
|
|
5308
5310
|
structuredContent: {
|
|
5309
5311
|
tasks: ie,
|
|
@@ -5315,31 +5317,31 @@ const dd = new cd(), { FIND_COMPLETED_TASKS: Io, ADD_TASKS: vo } = y, ld = {
|
|
|
5315
5317
|
};
|
|
5316
5318
|
}
|
|
5317
5319
|
let $ = w ? `(${w})` : "";
|
|
5318
|
-
o && ($ =
|
|
5320
|
+
o && ($ = Ie($, `search: ${Tt(o)}`));
|
|
5319
5321
|
const q = Gt(l, p);
|
|
5320
|
-
if ($ =
|
|
5321
|
-
const U =
|
|
5322
|
+
if ($ = Ie($, q), !(h && !i && !c)) {
|
|
5323
|
+
const U = mt({
|
|
5322
5324
|
resolvedAssigneeId: k,
|
|
5323
5325
|
assigneeEmail: S,
|
|
5324
5326
|
currentUserId: b.id,
|
|
5325
5327
|
responsibleUserFiltering: c
|
|
5326
5328
|
});
|
|
5327
|
-
$ =
|
|
5329
|
+
$ = Ie($, U);
|
|
5328
5330
|
}
|
|
5329
|
-
const { tasks: v, nextCursor: A } = await
|
|
5331
|
+
const { tasks: v, nextCursor: A } = await _t({
|
|
5330
5332
|
client: t,
|
|
5331
5333
|
query: $ || "all",
|
|
5332
5334
|
cursor: m,
|
|
5333
5335
|
limit: e.limit
|
|
5334
5336
|
});
|
|
5335
5337
|
return {
|
|
5336
|
-
textContent:
|
|
5338
|
+
textContent: Qe({
|
|
5337
5339
|
tasks: v,
|
|
5338
5340
|
args: e,
|
|
5339
5341
|
nextCursor: A,
|
|
5340
5342
|
isContainerSearch: !1,
|
|
5341
5343
|
assigneeEmail: S,
|
|
5342
|
-
assigneeNames: await
|
|
5344
|
+
assigneeNames: await ke(t, v, b.id)
|
|
5343
5345
|
}),
|
|
5344
5346
|
structuredContent: {
|
|
5345
5347
|
tasks: v,
|
|
@@ -5368,7 +5370,7 @@ function hd(e) {
|
|
|
5368
5370
|
}
|
|
5369
5371
|
return [];
|
|
5370
5372
|
}
|
|
5371
|
-
function
|
|
5373
|
+
function Qe({
|
|
5372
5374
|
tasks: e,
|
|
5373
5375
|
args: t,
|
|
5374
5376
|
nextCursor: o,
|
|
@@ -5384,18 +5386,18 @@ function et({
|
|
|
5384
5386
|
i += ` assigned to ${u}`, c.push(`assigned to ${u}`);
|
|
5385
5387
|
}
|
|
5386
5388
|
if (t.labels && t.labels.length > 0) {
|
|
5387
|
-
const u =
|
|
5389
|
+
const u = Te(t.labels, t.labelsOperator);
|
|
5388
5390
|
c.push(`labels: ${u}`);
|
|
5389
5391
|
}
|
|
5390
5392
|
e.length === 0 && d.push(...hd(t));
|
|
5391
5393
|
} else {
|
|
5392
5394
|
const u = n || t.responsibleUser, l = [];
|
|
5393
5395
|
if (t.filter && l.push(`filter: ${t.filter}`), t.searchText && l.push(`"${t.searchText}"`), t.responsibleUser && l.push(`assigned to ${u}`), t.labels && t.labels.length > 0) {
|
|
5394
|
-
const p =
|
|
5396
|
+
const p = Te(t.labels, t.labelsOperator);
|
|
5395
5397
|
l.push(`with labels: ${p}`);
|
|
5396
5398
|
}
|
|
5397
|
-
if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (i = `Tasks matching filter: ${t.filter}`, c.push(`filter: ${t.filter}`)) : t.searchText ? (i = `Search results for ${l.join(" ")}`, c.push(`matching "${t.searchText}"`), t.filter && c.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (i = `Tasks assigned to ${u}`, t.filter && c.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (i = `Tasks with labels: ${
|
|
5398
|
-
const p =
|
|
5399
|
+
if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (i = `Tasks matching filter: ${t.filter}`, c.push(`filter: ${t.filter}`)) : t.searchText ? (i = `Search results for ${l.join(" ")}`, c.push(`matching "${t.searchText}"`), t.filter && c.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (i = `Tasks assigned to ${u}`, t.filter && c.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (i = `Tasks with labels: ${Te(t.labels, t.labelsOperator)}`, t.filter && c.push(`filter: ${t.filter}`)) : i = `Tasks ${l.join(" ")}`, t.responsibleUser && c.push(`assigned to ${u}`), t.labels && t.labels.length > 0) {
|
|
5400
|
+
const p = Te(t.labels, t.labelsOperator);
|
|
5399
5401
|
c.push(`labels: ${p}`);
|
|
5400
5402
|
}
|
|
5401
5403
|
if (e.length === 0) {
|
|
@@ -5420,7 +5422,7 @@ const md = {
|
|
|
5420
5422
|
projectId: s.string().min(1).optional().describe(
|
|
5421
5423
|
`Optional project ID. Use "inbox" for the Inbox. If provided, returns that project's tasks grouped by section. If omitted, returns the project and section structure for the whole account with no tasks.`
|
|
5422
5424
|
)
|
|
5423
|
-
},
|
|
5425
|
+
}, Hs = s.lazy(
|
|
5424
5426
|
() => s.object({
|
|
5425
5427
|
id: s.string().describe("The project ID."),
|
|
5426
5428
|
name: s.string().describe("The project name."),
|
|
@@ -5428,7 +5430,7 @@ const md = {
|
|
|
5428
5430
|
folderId: s.string().optional().describe("The folder ID this project belongs to (workspace projects only)."),
|
|
5429
5431
|
childOrder: s.number().describe("The ordering index among siblings."),
|
|
5430
5432
|
sections: s.array(se),
|
|
5431
|
-
children: s.array(
|
|
5433
|
+
children: s.array(Hs).describe("Nested child projects.")
|
|
5432
5434
|
})
|
|
5433
5435
|
), fd = {
|
|
5434
5436
|
type: s.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
|
|
@@ -5449,7 +5451,7 @@ const md = {
|
|
|
5449
5451
|
name: s.string().describe("The inbox project name."),
|
|
5450
5452
|
sections: s.array(se).describe("Sections in the inbox project.")
|
|
5451
5453
|
}).optional().describe("Inbox information (account overview only)."),
|
|
5452
|
-
projects: s.array(s.lazy(() =>
|
|
5454
|
+
projects: s.array(s.lazy(() => Hs)).optional().describe(
|
|
5453
5455
|
"List of projects with hierarchy, folders, and ordering (account overview only)."
|
|
5454
5456
|
),
|
|
5455
5457
|
project: s.object({
|
|
@@ -5498,14 +5500,14 @@ async function gd(e, t) {
|
|
|
5498
5500
|
})
|
|
5499
5501
|
), o;
|
|
5500
5502
|
}
|
|
5501
|
-
function
|
|
5503
|
+
function Ws(e, t, o = "") {
|
|
5502
5504
|
const r = [];
|
|
5503
5505
|
r.push(`${o}- Project: ${e.name} (id=${e.id})`);
|
|
5504
5506
|
const n = t[e.id] || [];
|
|
5505
5507
|
for (const a of n)
|
|
5506
5508
|
r.push(`${o} - Section: ${a.name} (id=${a.id})`);
|
|
5507
5509
|
for (const a of e.children)
|
|
5508
|
-
r.push(...
|
|
5510
|
+
r.push(...Ws(a, t, `${o} `));
|
|
5509
5511
|
return r;
|
|
5510
5512
|
}
|
|
5511
5513
|
function So(e) {
|
|
@@ -5525,15 +5527,15 @@ function So(e) {
|
|
|
5525
5527
|
}
|
|
5526
5528
|
return o;
|
|
5527
5529
|
}
|
|
5528
|
-
function
|
|
5530
|
+
function bt(e, t, o = "") {
|
|
5529
5531
|
const r = [];
|
|
5530
5532
|
for (const n of e) {
|
|
5531
5533
|
const a = `id=${n.id}`, i = n.dueDate ? `; due=${n.dueDate}` : "", c = n.responsibleUid ? `; assignee=${t.get(n.responsibleUid) ?? n.responsibleUid}` : "", d = `; content=${n.content}`;
|
|
5532
|
-
r.push(`${o}- ${a}${i}${c}${d}`), n.children.length > 0 && r.push(...
|
|
5534
|
+
r.push(`${o}- ${a}${i}${c}${d}`), n.children.length > 0 && r.push(...bt(n.children, t, `${o} `));
|
|
5533
5535
|
}
|
|
5534
5536
|
return r;
|
|
5535
5537
|
}
|
|
5536
|
-
function
|
|
5538
|
+
function Bs(e, t) {
|
|
5537
5539
|
return {
|
|
5538
5540
|
id: e.id,
|
|
5539
5541
|
name: e.name,
|
|
@@ -5542,7 +5544,7 @@ function Ks(e, t) {
|
|
|
5542
5544
|
childOrder: e.childOrder,
|
|
5543
5545
|
sections: (t[e.id] || []).map(ne),
|
|
5544
5546
|
children: e.children.map(
|
|
5545
|
-
(o) =>
|
|
5547
|
+
(o) => Bs(o, t)
|
|
5546
5548
|
)
|
|
5547
5549
|
};
|
|
5548
5550
|
}
|
|
@@ -5571,7 +5573,7 @@ async function Td(e) {
|
|
|
5571
5573
|
}
|
|
5572
5574
|
if (n.length)
|
|
5573
5575
|
for (const p of n)
|
|
5574
|
-
c.push(...
|
|
5576
|
+
c.push(...Ws(p, i));
|
|
5575
5577
|
else
|
|
5576
5578
|
c.push("_No projects found._");
|
|
5577
5579
|
c.push(""), c.push(
|
|
@@ -5592,7 +5594,7 @@ async function Td(e) {
|
|
|
5592
5594
|
sections: (i[o.id] || []).map(ne)
|
|
5593
5595
|
} : void 0,
|
|
5594
5596
|
projects: n.map(
|
|
5595
|
-
(p) =>
|
|
5597
|
+
(p) => Bs(p, i)
|
|
5596
5598
|
),
|
|
5597
5599
|
totalProjects: t.length,
|
|
5598
5600
|
totalSections: a.reduce(
|
|
@@ -5610,7 +5612,7 @@ async function kd(e, t) {
|
|
|
5610
5612
|
o,
|
|
5611
5613
|
r(wd(e, t)),
|
|
5612
5614
|
r(yd(e, t))
|
|
5613
|
-
]), c = await
|
|
5615
|
+
]), c = await ke(e, i), d = {};
|
|
5614
5616
|
for (const h of a)
|
|
5615
5617
|
d[h.id] = [];
|
|
5616
5618
|
const u = [];
|
|
@@ -5620,7 +5622,7 @@ async function kd(e, t) {
|
|
|
5620
5622
|
if (u.length > 0) {
|
|
5621
5623
|
l.push("");
|
|
5622
5624
|
const h = So(u);
|
|
5623
|
-
l.push(...
|
|
5625
|
+
l.push(...bt(h, c));
|
|
5624
5626
|
}
|
|
5625
5627
|
for (const h of a) {
|
|
5626
5628
|
l.push(""), l.push(`## ${h.name}`);
|
|
@@ -5628,7 +5630,7 @@ async function kd(e, t) {
|
|
|
5628
5630
|
if (!m?.length)
|
|
5629
5631
|
continue;
|
|
5630
5632
|
const b = So(m);
|
|
5631
|
-
l.push(...
|
|
5633
|
+
l.push(...bt(b, c));
|
|
5632
5634
|
}
|
|
5633
5635
|
const p = l.join(`
|
|
5634
5636
|
`), f = {
|
|
@@ -5664,7 +5666,7 @@ const Id = {
|
|
|
5664
5666
|
structuredContent: r.structuredContent
|
|
5665
5667
|
};
|
|
5666
5668
|
}
|
|
5667
|
-
}, vd = {},
|
|
5669
|
+
}, vd = {}, we = s.object({
|
|
5668
5670
|
count: s.number().describe("Number of consecutive periods in this streak."),
|
|
5669
5671
|
start: s.string().describe("Start date of the streak."),
|
|
5670
5672
|
end: s.string().describe("End date of the streak.")
|
|
@@ -5691,12 +5693,12 @@ const Id = {
|
|
|
5691
5693
|
goals: s.object({
|
|
5692
5694
|
dailyGoal: s.number().describe("Daily task completion goal."),
|
|
5693
5695
|
weeklyGoal: s.number().describe("Weekly task completion goal."),
|
|
5694
|
-
currentDailyStreak:
|
|
5695
|
-
currentWeeklyStreak:
|
|
5696
|
-
lastDailyStreak:
|
|
5697
|
-
lastWeeklyStreak:
|
|
5698
|
-
maxDailyStreak:
|
|
5699
|
-
maxWeeklyStreak:
|
|
5696
|
+
currentDailyStreak: we.describe("Current daily goal streak."),
|
|
5697
|
+
currentWeeklyStreak: we.describe("Current weekly goal streak."),
|
|
5698
|
+
lastDailyStreak: we.describe("Previous daily goal streak."),
|
|
5699
|
+
lastWeeklyStreak: we.describe("Previous weekly goal streak."),
|
|
5700
|
+
maxDailyStreak: we.describe("Best daily goal streak ever."),
|
|
5701
|
+
maxWeeklyStreak: we.describe("Best weekly goal streak ever."),
|
|
5700
5702
|
vacationMode: s.boolean().describe("Whether vacation mode is enabled."),
|
|
5701
5703
|
karmaDisabled: s.boolean().describe("Whether karma tracking is disabled.")
|
|
5702
5704
|
}).describe("Goal and streak information."),
|
|
@@ -5861,7 +5863,7 @@ const Dd = {
|
|
|
5861
5863
|
progressPercent: s.number().describe("Completion percentage (0-100).")
|
|
5862
5864
|
}).describe("Project completion progress."),
|
|
5863
5865
|
health: s.object({
|
|
5864
|
-
status: s.enum(
|
|
5866
|
+
status: s.enum(wt).describe("The overall health status of the project."),
|
|
5865
5867
|
description: s.string().optional().describe("Detailed description of the health assessment."),
|
|
5866
5868
|
descriptionSummary: s.string().optional().describe("Brief summary of the health assessment."),
|
|
5867
5869
|
isStale: s.boolean().describe("Whether the health data is stale and may need refreshing."),
|
|
@@ -5918,7 +5920,7 @@ const Pd = {
|
|
|
5918
5920
|
activeUntil: s.string().optional().describe("ISO 8601 end. Omitted when it has no end."),
|
|
5919
5921
|
pauseNotifications: s.boolean().describe("Comms notifications held back."),
|
|
5920
5922
|
pauseActivity: s.boolean().describe("Karma and streaks paused.")
|
|
5921
|
-
}),
|
|
5923
|
+
}), Ks = {
|
|
5922
5924
|
hasStatus: s.boolean(),
|
|
5923
5925
|
status: Ud.optional().describe("Omitted when there is no active status.")
|
|
5924
5926
|
};
|
|
@@ -5927,7 +5929,7 @@ function Rd(e) {
|
|
|
5927
5929
|
throw new Error("Todoist did not return the user, so the status is unknown.");
|
|
5928
5930
|
return e.user.status ?? null;
|
|
5929
5931
|
}
|
|
5930
|
-
async function
|
|
5932
|
+
async function qs(e) {
|
|
5931
5933
|
const t = await j(
|
|
5932
5934
|
() => e.sync({ resourceTypes: ["user"], syncToken: "*" })
|
|
5933
5935
|
);
|
|
@@ -5943,7 +5945,7 @@ function Nd(e) {
|
|
|
5943
5945
|
pauseActivity: !!e.effects?.pauseActivity
|
|
5944
5946
|
};
|
|
5945
5947
|
}
|
|
5946
|
-
function
|
|
5948
|
+
function gt(e, t) {
|
|
5947
5949
|
if (!e)
|
|
5948
5950
|
return {
|
|
5949
5951
|
textContent: `${t}: none`,
|
|
@@ -5965,10 +5967,10 @@ const Ld = {}, Md = {
|
|
|
5965
5967
|
name: y.GET_USER_STATUS,
|
|
5966
5968
|
description: "Get the user's status, the message and emoji shown next to their name in Todoist and Comms, with when it ends and whether it pauses Comms notifications or Karma and streaks. Returns no status when none is set or it has expired.",
|
|
5967
5969
|
parameters: Ld,
|
|
5968
|
-
outputSchema:
|
|
5970
|
+
outputSchema: Ks,
|
|
5969
5971
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
5970
5972
|
async execute(e, t) {
|
|
5971
|
-
return
|
|
5973
|
+
return gt(await qs(t), "Status");
|
|
5972
5974
|
}
|
|
5973
5975
|
}, Fd = {
|
|
5974
5976
|
workspaceIdOrName: s.string().min(1).describe(
|
|
@@ -5978,7 +5980,7 @@ const Ld = {}, Md = {
|
|
|
5978
5980
|
}, Hd = s.object({
|
|
5979
5981
|
projectId: s.string().describe("The project ID."),
|
|
5980
5982
|
health: s.object({
|
|
5981
|
-
status: s.enum(
|
|
5983
|
+
status: s.enum(wt).describe("The health status of the project."),
|
|
5982
5984
|
isStale: s.boolean().describe("Whether the health data is stale."),
|
|
5983
5985
|
updateInProgress: s.boolean().describe("Whether a health analysis update is in progress.")
|
|
5984
5986
|
}).optional().describe("Health data for this project. Omitted when the project has none."),
|
|
@@ -6002,7 +6004,7 @@ const Ld = {}, Md = {
|
|
|
6002
6004
|
idempotentHint: !0
|
|
6003
6005
|
},
|
|
6004
6006
|
async execute(e, t) {
|
|
6005
|
-
const { workspaceIdOrName: o, projectIds: r } = e, n = await
|
|
6007
|
+
const { workspaceIdOrName: o, projectIds: r } = e, n = await _e.resolveWorkspace(t, o), i = (await t.getWorkspaceInsights(n.workspaceId, { projectIds: r })).projectInsights.map((d) => ({
|
|
6006
6008
|
projectId: d.projectId,
|
|
6007
6009
|
health: d.health ? {
|
|
6008
6010
|
status: d.health.status,
|
|
@@ -6050,7 +6052,7 @@ function Kd(e) {
|
|
|
6050
6052
|
`"${o.hostname}" is not a Todoist domain. Pass a todoist.com template URL or the template ID itself.`
|
|
6051
6053
|
);
|
|
6052
6054
|
o.hostname = "todoist.com";
|
|
6053
|
-
const r =
|
|
6055
|
+
const r = fr(o.toString());
|
|
6054
6056
|
if (r?.type !== "template")
|
|
6055
6057
|
throw new Error(`"${t}" is not a Todoist template URL.`);
|
|
6056
6058
|
return r.id;
|
|
@@ -6078,7 +6080,7 @@ const zd = new RegExp(
|
|
|
6078
6080
|
}, Gd = {
|
|
6079
6081
|
sections: s.array(se).describe("Sections created by the import."),
|
|
6080
6082
|
tasks: s.array(ee).describe("Tasks created by the import."),
|
|
6081
|
-
comments: s.array(
|
|
6083
|
+
comments: s.array(Ue).describe("Comments created by the import."),
|
|
6082
6084
|
totalCount: s.number().describe("The total number of objects created by the import.")
|
|
6083
6085
|
}, Vd = {
|
|
6084
6086
|
name: y.IMPORT_PROJECT_TEMPLATE,
|
|
@@ -6100,7 +6102,7 @@ const zd = new RegExp(
|
|
|
6100
6102
|
// The SDK treats strings as filesystem paths, not file content.
|
|
6101
6103
|
file: new Blob([o ?? ""], { type: "text/csv" }),
|
|
6102
6104
|
fileName: "template.csv"
|
|
6103
|
-
}), i = a.sections.map(ne), c = a.tasks.map(K), d = a.comments.map(
|
|
6105
|
+
}), i = a.sections.map(ne), c = a.tasks.map(K), d = a.comments.map(Pe), u = a.projects.length + i.length + c.length + d.length;
|
|
6104
6106
|
return {
|
|
6105
6107
|
textContent: Jd({
|
|
6106
6108
|
projectId: e,
|
|
@@ -6129,8 +6131,8 @@ function Jd({
|
|
|
6129
6131
|
const Xd = {}, Zd = {
|
|
6130
6132
|
id: s.string().describe("The unique identifier for the workspace."),
|
|
6131
6133
|
name: s.string().describe("The name of the workspace."),
|
|
6132
|
-
plan: s.enum(
|
|
6133
|
-
role: s.enum(
|
|
6134
|
+
plan: s.enum(gr).describe("The workspace plan type."),
|
|
6135
|
+
role: s.enum(br).optional().describe("The user's role in the workspace, if available."),
|
|
6134
6136
|
isLinkSharingEnabled: s.boolean().describe("Whether link sharing is enabled for the workspace."),
|
|
6135
6137
|
isGuestAllowed: s.boolean().describe("Whether guests are allowed in the workspace."),
|
|
6136
6138
|
createdAt: s.string().optional().describe("The ISO 8601 timestamp when the workspace was created."),
|
|
@@ -6184,9 +6186,9 @@ const tl = {
|
|
|
6184
6186
|
structuredContent: o.structuredContent
|
|
6185
6187
|
};
|
|
6186
6188
|
}
|
|
6187
|
-
}, { FIND_TASKS: ol, FIND_PROJECT_COLLABORATORS: $o, UPDATE_TASKS: sl } = y,
|
|
6189
|
+
}, { FIND_TASKS: ol, FIND_PROJECT_COLLABORATORS: $o, UPDATE_TASKS: sl } = y, zs = D.BULK_ACTIONS_PER_OPERATION, rl = {
|
|
6188
6190
|
operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
|
|
6189
|
-
taskIds: s.array(s.string()).min(1).max(
|
|
6191
|
+
taskIds: s.array(s.string()).min(1).max(zs).describe("The IDs of the tasks to operate on (max 50)."),
|
|
6190
6192
|
responsibleUser: s.string().optional().describe(
|
|
6191
6193
|
'The user to assign tasks to. Can be "me" (assigns to current user), a user ID, name, or email. Required for assign and reassign operations.'
|
|
6192
6194
|
),
|
|
@@ -6212,7 +6214,7 @@ const tl = {
|
|
|
6212
6214
|
}).optional().describe("Summary of the operation.")
|
|
6213
6215
|
}, al = {
|
|
6214
6216
|
name: y.MANAGE_ASSIGNMENTS,
|
|
6215
|
-
description: `Assign, unassign or reassign up to ${
|
|
6217
|
+
description: `Assign, unassign or reassign up to ${zs} tasks at once. Assigning notifies the new assignee. Each task is updated independently, so one failure does not undo the others; failures are reported per task. Use dryRun to check the changes first.`,
|
|
6216
6218
|
parameters: rl,
|
|
6217
6219
|
outputSchema: nl,
|
|
6218
6220
|
// Open world: assigning a task notifies the new assignee.
|
|
@@ -6270,7 +6272,7 @@ const tl = {
|
|
|
6270
6272
|
newAssigneeId: void 0
|
|
6271
6273
|
}));
|
|
6272
6274
|
return {
|
|
6273
|
-
textContent:
|
|
6275
|
+
textContent: et({
|
|
6274
6276
|
operation: o,
|
|
6275
6277
|
results: T,
|
|
6276
6278
|
dryRun: !0
|
|
@@ -6307,7 +6309,7 @@ const tl = {
|
|
|
6307
6309
|
throw new Error(`All ${$.length} unassign operation(s) failed: ${T}`);
|
|
6308
6310
|
}
|
|
6309
6311
|
return {
|
|
6310
|
-
textContent:
|
|
6312
|
+
textContent: et({
|
|
6311
6313
|
operation: o,
|
|
6312
6314
|
results: $,
|
|
6313
6315
|
dryRun: !1
|
|
@@ -6322,7 +6324,7 @@ const tl = {
|
|
|
6322
6324
|
}
|
|
6323
6325
|
};
|
|
6324
6326
|
}
|
|
6325
|
-
const f = await
|
|
6327
|
+
const f = await Kt.validateBulkAssignment(
|
|
6326
6328
|
t,
|
|
6327
6329
|
p
|
|
6328
6330
|
), h = [], m = [];
|
|
@@ -6389,7 +6391,7 @@ const tl = {
|
|
|
6389
6391
|
throw new Error(`All ${w.length} ${o} operation(s) failed: ${k}`);
|
|
6390
6392
|
}
|
|
6391
6393
|
return {
|
|
6392
|
-
textContent:
|
|
6394
|
+
textContent: et({
|
|
6393
6395
|
operation: o,
|
|
6394
6396
|
results: w,
|
|
6395
6397
|
dryRun: i
|
|
@@ -6405,7 +6407,7 @@ const tl = {
|
|
|
6405
6407
|
};
|
|
6406
6408
|
}
|
|
6407
6409
|
};
|
|
6408
|
-
function
|
|
6410
|
+
function et({
|
|
6409
6411
|
operation: e,
|
|
6410
6412
|
results: t,
|
|
6411
6413
|
dryRun: o
|
|
@@ -6489,8 +6491,8 @@ async function pl({ action: e, projectId: t }, o) {
|
|
|
6489
6491
|
return o.archiveProject(t);
|
|
6490
6492
|
case "unarchive": {
|
|
6491
6493
|
const r = await re(o, t);
|
|
6492
|
-
return Z(r) && r.isArchived &&
|
|
6493
|
-
await
|
|
6494
|
+
return Z(r) && r.isArchived && Ht(
|
|
6495
|
+
await Ft(o, y.PROJECT_MANAGEMENT),
|
|
6494
6496
|
"This project was not unarchived."
|
|
6495
6497
|
), o.unarchiveProject(t);
|
|
6496
6498
|
}
|
|
@@ -6530,8 +6532,8 @@ const hl = {
|
|
|
6530
6532
|
e.folderId && (a.folderId = e.folderId), e.visibility && (a.access = { visibility: e.visibility }), o = await t.moveProjectToWorkspace(a);
|
|
6531
6533
|
} else {
|
|
6532
6534
|
const a = await re(t, e.projectId);
|
|
6533
|
-
F(a) && !a.isArchived &&
|
|
6534
|
-
await
|
|
6535
|
+
F(a) && !a.isArchived && Ht(
|
|
6536
|
+
await Ft(t, y.PROJECT_MOVE),
|
|
6535
6537
|
"This project was not moved."
|
|
6536
6538
|
), o = await t.moveProjectToPersonal({ projectId: e.projectId });
|
|
6537
6539
|
}
|
|
@@ -6545,7 +6547,7 @@ const hl = {
|
|
|
6545
6547
|
};
|
|
6546
6548
|
}
|
|
6547
6549
|
};
|
|
6548
|
-
function
|
|
6550
|
+
function Ys(e, t) {
|
|
6549
6551
|
const o = new Map(e.map((f) => [f.id, f])), r = new Set(t.map((f) => f.id));
|
|
6550
6552
|
for (const f of r)
|
|
6551
6553
|
if (!o.has(f))
|
|
@@ -6613,7 +6615,7 @@ function wl(e, t) {
|
|
|
6613
6615
|
function Tl(e, t) {
|
|
6614
6616
|
return e.legacyOrder - t.legacyOrder;
|
|
6615
6617
|
}
|
|
6616
|
-
const
|
|
6618
|
+
const Gs = ["project", "section"], kl = s.object({
|
|
6617
6619
|
id: s.string().min(1).describe("The ID of the entity."),
|
|
6618
6620
|
order: s.number().int().min(0).optional().describe(
|
|
6619
6621
|
"0-based position among its siblings after the reorder: 0 is first, past the end is last. Unlisted siblings keep their relative order."
|
|
@@ -6622,14 +6624,14 @@ const Vs = ["project", "section"], kl = s.object({
|
|
|
6622
6624
|
'Move a personal project under this parent project ID, or "root" for the top level. Personal projects only.'
|
|
6623
6625
|
)
|
|
6624
6626
|
}), Il = {
|
|
6625
|
-
type: s.enum(
|
|
6627
|
+
type: s.enum(Gs).describe(
|
|
6626
6628
|
'"project": personal projects among the siblings under their parent, or workspace projects within their folder. "section": sections within their project.'
|
|
6627
6629
|
),
|
|
6628
6630
|
items: s.array(kl).min(1).max(D.BULK_ACTIONS_PER_OPERATION).describe(
|
|
6629
6631
|
"Each item needs order and/or parentId. Moves happen first, so order is a position under the new parent."
|
|
6630
6632
|
)
|
|
6631
6633
|
}, vl = {
|
|
6632
|
-
type: s.enum(
|
|
6634
|
+
type: s.enum(Gs).describe("The type of entity that was reordered/moved."),
|
|
6633
6635
|
movedCount: s.number().describe("The number of entities moved to a new parent."),
|
|
6634
6636
|
reorderedCount: s.number().describe("The number of entities reordered."),
|
|
6635
6637
|
affectedIds: s.array(s.string()).describe("The IDs of the entities moved or reordered."),
|
|
@@ -6683,10 +6685,10 @@ async function Cl(e, t) {
|
|
|
6683
6685
|
}
|
|
6684
6686
|
const c = i.filter((m) => m.parentId !== void 0), d = /* @__PURE__ */ new Set();
|
|
6685
6687
|
if (c.length > 0) {
|
|
6686
|
-
const { outcomes: m } = await
|
|
6688
|
+
const { outcomes: m } = await G(
|
|
6687
6689
|
e,
|
|
6688
6690
|
c.map(
|
|
6689
|
-
(b) =>
|
|
6691
|
+
(b) => Y("project_move", {
|
|
6690
6692
|
id: b.id,
|
|
6691
6693
|
parentId: b.parentId === "root" ? null : b.parentId
|
|
6692
6694
|
})
|
|
@@ -6714,7 +6716,7 @@ async function Cl(e, t) {
|
|
|
6714
6716
|
});
|
|
6715
6717
|
return { movedIds: o, reorderedIds: r, failures: n };
|
|
6716
6718
|
}
|
|
6717
|
-
const l =
|
|
6719
|
+
const l = Vs([...a.values()].filter(El), Ao), p = /* @__PURE__ */ new Map(), f = [];
|
|
6718
6720
|
for (const m of u) {
|
|
6719
6721
|
const b = a.get(m.id);
|
|
6720
6722
|
if (!b) {
|
|
@@ -6727,22 +6729,22 @@ async function Cl(e, t) {
|
|
|
6727
6729
|
}
|
|
6728
6730
|
const h = [];
|
|
6729
6731
|
for (const [m, b] of p) {
|
|
6730
|
-
const g = l.get(m) ?? [], w =
|
|
6732
|
+
const g = l.get(m) ?? [], w = Ys(g.map(Al), b);
|
|
6731
6733
|
for (const [I, k] of w) {
|
|
6732
6734
|
const S = a.get(I);
|
|
6733
6735
|
h.push({
|
|
6734
6736
|
id: I,
|
|
6735
|
-
command:
|
|
6737
|
+
command: Y(
|
|
6736
6738
|
"project_update",
|
|
6737
6739
|
S && F(S) ? { id: I, defaultOrderKey: k } : { id: I, orderKey: k }
|
|
6738
6740
|
)
|
|
6739
6741
|
});
|
|
6740
6742
|
}
|
|
6741
6743
|
}
|
|
6742
|
-
return await
|
|
6744
|
+
return await Js(e, h, f, r, n), { movedIds: o, reorderedIds: r, failures: n };
|
|
6743
6745
|
}
|
|
6744
6746
|
async function jl(e, t) {
|
|
6745
|
-
const o = /* @__PURE__ */ new Set(), r = [], n = await Dl(e), a =
|
|
6747
|
+
const o = /* @__PURE__ */ new Set(), r = [], n = await Dl(e), a = Vs(
|
|
6746
6748
|
[...n.values()].filter((l) => !l.isDeleted && !l.isArchived),
|
|
6747
6749
|
(l) => l.projectId
|
|
6748
6750
|
), i = t.filter((l) => l.order !== void 0), c = /* @__PURE__ */ new Map(), d = [];
|
|
@@ -6765,7 +6767,7 @@ async function jl(e, t) {
|
|
|
6765
6767
|
}
|
|
6766
6768
|
const u = [];
|
|
6767
6769
|
for (const [l, p] of c) {
|
|
6768
|
-
const f = a.get(l) ?? [], h =
|
|
6770
|
+
const f = a.get(l) ?? [], h = Ys(
|
|
6769
6771
|
f.map((m) => ({
|
|
6770
6772
|
id: m.id,
|
|
6771
6773
|
key: m.orderKey ?? null,
|
|
@@ -6774,11 +6776,11 @@ async function jl(e, t) {
|
|
|
6774
6776
|
p
|
|
6775
6777
|
);
|
|
6776
6778
|
for (const [m, b] of h)
|
|
6777
|
-
u.push({ id: m, command:
|
|
6779
|
+
u.push({ id: m, command: Y("section_update", { id: m, orderKey: b }) });
|
|
6778
6780
|
}
|
|
6779
|
-
return await
|
|
6781
|
+
return await Js(e, u, d, o, r), { movedIds: /* @__PURE__ */ new Set(), reorderedIds: o, failures: r };
|
|
6780
6782
|
}
|
|
6781
|
-
function
|
|
6783
|
+
function Vs(e, t) {
|
|
6782
6784
|
const o = /* @__PURE__ */ new Map();
|
|
6783
6785
|
for (const r of e) {
|
|
6784
6786
|
const n = t(r), a = o.get(n) ?? [];
|
|
@@ -6786,10 +6788,10 @@ function Js(e, t) {
|
|
|
6786
6788
|
}
|
|
6787
6789
|
return o;
|
|
6788
6790
|
}
|
|
6789
|
-
async function
|
|
6791
|
+
async function Js(e, t, o, r, n) {
|
|
6790
6792
|
const a = /* @__PURE__ */ new Set();
|
|
6791
6793
|
if (t.length > 0) {
|
|
6792
|
-
const { outcomes: i } = await
|
|
6794
|
+
const { outcomes: i } = await G(
|
|
6793
6795
|
e,
|
|
6794
6796
|
t.map((c) => c.command)
|
|
6795
6797
|
);
|
|
@@ -6857,7 +6859,7 @@ const xl = s.object({
|
|
|
6857
6859
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
6858
6860
|
async execute(e, t) {
|
|
6859
6861
|
const { tasks: o } = e, r = o.map(
|
|
6860
|
-
(h) => h.duration ?
|
|
6862
|
+
(h) => h.duration ? $t(`Task ${h.id}`, h.duration) : void 0
|
|
6861
6863
|
), n = [], a = await Promise.allSettled(
|
|
6862
6864
|
o.map((h) => j(() => t.getTask(h.id)))
|
|
6863
6865
|
), i = P(o, a, (h) => h.id);
|
|
@@ -6867,7 +6869,7 @@ const xl = s.object({
|
|
|
6867
6869
|
const g = Ul(h.date, b);
|
|
6868
6870
|
g && c.push({
|
|
6869
6871
|
id: h.id,
|
|
6870
|
-
command:
|
|
6872
|
+
command: Y("item_update", {
|
|
6871
6873
|
id: h.id,
|
|
6872
6874
|
...g,
|
|
6873
6875
|
...r[m] && { duration: r[m] }
|
|
@@ -6876,7 +6878,7 @@ const xl = s.object({
|
|
|
6876
6878
|
}
|
|
6877
6879
|
const d = [];
|
|
6878
6880
|
if (c.length > 0) {
|
|
6879
|
-
const { outcomes: h } = await
|
|
6881
|
+
const { outcomes: h } = await G(
|
|
6880
6882
|
t,
|
|
6881
6883
|
c.map(({ command: b }) => b)
|
|
6882
6884
|
), m = P(c, h, ({ id: b }) => b);
|
|
@@ -6903,7 +6905,7 @@ const xl = s.object({
|
|
|
6903
6905
|
});
|
|
6904
6906
|
}
|
|
6905
6907
|
const f = p ? `Rescheduled ${d.length} task${d.length === 1 ? "" : "s"}: ${d.join(", ")}
|
|
6906
|
-
Could not read back ${l.join(", ")}: ${p}` :
|
|
6908
|
+
Could not read back ${l.join(", ")}: ${p}` : Nt("Rescheduled", u, {
|
|
6907
6909
|
showDetails: u.length <= 5
|
|
6908
6910
|
});
|
|
6909
6911
|
return {
|
|
@@ -6957,9 +6959,9 @@ const Nl = {
|
|
|
6957
6959
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
6958
6960
|
async execute(e, t) {
|
|
6959
6961
|
const { query: o } = e, [r, n] = await Promise.all([
|
|
6960
|
-
|
|
6962
|
+
_t({
|
|
6961
6963
|
client: t,
|
|
6962
|
-
query: `search: ${
|
|
6964
|
+
query: `search: ${Tt(o)}`,
|
|
6963
6965
|
limit: E.TASKS_MAX,
|
|
6964
6966
|
cursor: void 0
|
|
6965
6967
|
}),
|
|
@@ -6992,7 +6994,7 @@ const Nl = {
|
|
|
6992
6994
|
pauseActivity: s.boolean().optional().describe("Pause Karma and streaks while active."),
|
|
6993
6995
|
clear: s.boolean().optional().describe("Remove the status. Use alone.")
|
|
6994
6996
|
}, Wl = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|([+-])(\d{2}):(\d{2}))$/i, Bl = -720, Kl = 840;
|
|
6995
|
-
function
|
|
6997
|
+
function tt(e) {
|
|
6996
6998
|
return new Error(
|
|
6997
6999
|
`activeUntil must be an ISO 8601 timestamp with Z or an offset, such as "2026-11-10T00:00:00+00:00". Got "${e}".`
|
|
6998
7000
|
);
|
|
@@ -7000,15 +7002,15 @@ function ot(e) {
|
|
|
7000
7002
|
function ql(e, t) {
|
|
7001
7003
|
const o = Wl.exec(e);
|
|
7002
7004
|
if (!o)
|
|
7003
|
-
throw
|
|
7005
|
+
throw tt(e);
|
|
7004
7006
|
const [, r, n, a, i, c, d = "0", u = ""] = o, [l, p, f, h, m, b] = [r, n, a, i, c, d].map(Number), g = /* @__PURE__ */ new Date(0);
|
|
7005
7007
|
g.setUTCFullYear(l, p - 1, f), g.setUTCHours(h, m, b);
|
|
7006
|
-
const w = g.getUTCFullYear() === l && g.getUTCMonth() === p - 1 && g.getUTCDate() === f && g.getUTCHours() === h && g.getUTCMinutes() === m && g.getUTCSeconds() === b, I = u.toUpperCase() === "Z" ? 0 :
|
|
7008
|
+
const w = g.getUTCFullYear() === l && g.getUTCMonth() === p - 1 && g.getUTCDate() === f && g.getUTCHours() === h && g.getUTCMinutes() === m && g.getUTCSeconds() === b, I = u.toUpperCase() === "Z" ? 0 : qt(u);
|
|
7007
7009
|
if (!w || I < Bl || I > Kl)
|
|
7008
|
-
throw
|
|
7010
|
+
throw tt(e);
|
|
7009
7011
|
const k = new Date(e);
|
|
7010
7012
|
if (Number.isNaN(k.getTime()))
|
|
7011
|
-
throw
|
|
7013
|
+
throw tt(e);
|
|
7012
7014
|
if (k.getTime() <= t.getTime())
|
|
7013
7015
|
throw new Error(`activeUntil must be in the future. Got "${e}".`);
|
|
7014
7016
|
return k.toISOString();
|
|
@@ -7049,7 +7051,7 @@ const Gl = {
|
|
|
7049
7051
|
name: y.SET_USER_STATUS,
|
|
7050
7052
|
description: "Set or clear the user's status, shown next to their name in Todoist and Comms. It needs a message, an emoji or both. Replaces the whole status: any field omitted is removed, not kept. Use clear to remove the status.",
|
|
7051
7053
|
parameters: Hl,
|
|
7052
|
-
outputSchema:
|
|
7054
|
+
outputSchema: Ks,
|
|
7053
7055
|
annotations: {
|
|
7054
7056
|
readOnlyHint: !1,
|
|
7055
7057
|
destructiveHint: !0,
|
|
@@ -7059,10 +7061,10 @@ const Gl = {
|
|
|
7059
7061
|
async execute(e, t) {
|
|
7060
7062
|
const o = zl(e, /* @__PURE__ */ new Date()), {
|
|
7061
7063
|
outcomes: [r]
|
|
7062
|
-
} = await
|
|
7064
|
+
} = await G(t, [Y("user_update", { status: o })]);
|
|
7063
7065
|
if (r?.status !== "fulfilled")
|
|
7064
7066
|
throw r?.reason ?? new Error("Todoist did not report whether the status was applied.");
|
|
7065
|
-
const n = await
|
|
7067
|
+
const n = await qs(t).catch(() => {
|
|
7066
7068
|
throw new Error(
|
|
7067
7069
|
`The status was written, but reading it back failed, so it is unconfirmed. Use ${y.GET_USER_STATUS} to check it.`
|
|
7068
7070
|
);
|
|
@@ -7072,7 +7074,7 @@ const Gl = {
|
|
|
7072
7074
|
throw new Error(
|
|
7073
7075
|
`Todoist accepted the clear but still reports a status. Another app may have set it at the same moment; use ${y.GET_USER_STATUS} to see it.`
|
|
7074
7076
|
);
|
|
7075
|
-
return
|
|
7077
|
+
return gt(null, "Status cleared");
|
|
7076
7078
|
}
|
|
7077
7079
|
if (!n)
|
|
7078
7080
|
throw new Error(
|
|
@@ -7082,7 +7084,7 @@ const Gl = {
|
|
|
7082
7084
|
throw new Error(
|
|
7083
7085
|
`Todoist accepted the status but reports a different one. Another app may have changed it at the same moment; use ${y.GET_USER_STATUS} to see it.`
|
|
7084
7086
|
);
|
|
7085
|
-
return
|
|
7087
|
+
return gt(n, "Status set");
|
|
7086
7088
|
}
|
|
7087
7089
|
}, Vl = {
|
|
7088
7090
|
ids: s.array(s.string().min(1)).min(1).max(D.BULK_ACTIONS_PER_OPERATION).describe("The IDs of the tasks to uncomplete.")
|
|
@@ -7117,10 +7119,10 @@ const Gl = {
|
|
|
7117
7119
|
}
|
|
7118
7120
|
};
|
|
7119
7121
|
async function Zl(e, t) {
|
|
7120
|
-
const o = [...new Set(t)], { outcomes: r } = await
|
|
7122
|
+
const o = [...new Set(t)], { outcomes: r } = await G(
|
|
7121
7123
|
e,
|
|
7122
|
-
o.map((a) =>
|
|
7123
|
-
{ limit:
|
|
7124
|
+
o.map((a) => Y("item_uncomplete", { id: a })),
|
|
7125
|
+
{ limit: Ct(e) }
|
|
7124
7126
|
), n = new Map(o.map((a, i) => [a, r[i]]));
|
|
7125
7127
|
return t.map(
|
|
7126
7128
|
(a) => n.get(a) ?? {
|
|
@@ -7134,7 +7136,7 @@ function Ql({
|
|
|
7134
7136
|
failures: t,
|
|
7135
7137
|
args: o
|
|
7136
7138
|
}) {
|
|
7137
|
-
return
|
|
7139
|
+
return Lt({
|
|
7138
7140
|
action: "Uncompleted tasks",
|
|
7139
7141
|
success: e.length,
|
|
7140
7142
|
total: o.ids.length,
|
|
@@ -7149,7 +7151,7 @@ const eu = s.object({
|
|
|
7149
7151
|
}), tu = {
|
|
7150
7152
|
comments: s.array(eu).min(1).max(D.ITEMS_PER_OPERATION).describe("The comments to update.")
|
|
7151
7153
|
}, ou = {
|
|
7152
|
-
comments: s.array(
|
|
7154
|
+
comments: s.array(Ue).describe("The updated comments."),
|
|
7153
7155
|
totalCount: s.number().describe("The total number of comments updated."),
|
|
7154
7156
|
updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
|
|
7155
7157
|
failures: s.array(_).describe("Comments that could not be updated, with the reason for each."),
|
|
@@ -7170,7 +7172,7 @@ const eu = s.object({
|
|
|
7170
7172
|
() => t.updateComment(d.id, { content: d.content })
|
|
7171
7173
|
)
|
|
7172
7174
|
)
|
|
7173
|
-
), { succeeded: n, failures: a } = P(o, r, (d) => d.id), i = n.map(({ value: d }) =>
|
|
7175
|
+
), { succeeded: n, failures: a } = P(o, r, (d) => d.id), i = n.map(({ value: d }) => Pe(d));
|
|
7174
7176
|
return O(y.UPDATE_COMMENTS, o.length, a), {
|
|
7175
7177
|
textContent: R(
|
|
7176
7178
|
ru({ comments: i }),
|
|
@@ -7214,12 +7216,12 @@ const nu = s.object({
|
|
|
7214
7216
|
'A markdown description explaining what the filter is for. Use "remove" to clear the description; omit the field to leave it unchanged.'
|
|
7215
7217
|
)
|
|
7216
7218
|
).optional(),
|
|
7217
|
-
color:
|
|
7219
|
+
color: Se,
|
|
7218
7220
|
isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite.")
|
|
7219
7221
|
}), au = {
|
|
7220
7222
|
filters: s.array(nu).min(1).max(D.ITEMS_PER_OPERATION).describe("The filters to update.")
|
|
7221
7223
|
}, iu = {
|
|
7222
|
-
filters: s.array(
|
|
7224
|
+
filters: s.array(Mt).describe(
|
|
7223
7225
|
"The updated filters, as read back after the update. Empty if they could not be read back; updatedFilterIds still lists what was updated."
|
|
7224
7226
|
),
|
|
7225
7227
|
totalCount: s.number().describe("The total number of filters updated."),
|
|
@@ -7254,14 +7256,14 @@ const nu = s.object({
|
|
|
7254
7256
|
};
|
|
7255
7257
|
const i = r.map((m) => {
|
|
7256
7258
|
const { id: b, color: g, description: w, ...I } = m;
|
|
7257
|
-
return
|
|
7259
|
+
return Y("filter_update", {
|
|
7258
7260
|
id: b,
|
|
7259
7261
|
...I,
|
|
7260
7262
|
// "remove" is the house sentinel for clearing a field; the API clears on null.
|
|
7261
7263
|
...w !== void 0 ? { description: w === "remove" ? null : w } : {},
|
|
7262
7264
|
...g !== void 0 ? { color: g } : {}
|
|
7263
7265
|
});
|
|
7264
|
-
}), { outcomes: c } = await
|
|
7266
|
+
}), { outcomes: c } = await G(t, i), { succeeded: d, failures: u } = P(r, c, (m) => m.id), l = d.map(({ item: m }) => m.id);
|
|
7265
7267
|
O(y.UPDATE_FILTERS, o.length, u);
|
|
7266
7268
|
let p = [], f;
|
|
7267
7269
|
if (l.length > 0) {
|
|
@@ -7308,7 +7310,7 @@ function du(e, t) {
|
|
|
7308
7310
|
name: o.name,
|
|
7309
7311
|
query: o.query,
|
|
7310
7312
|
description: ks(o),
|
|
7311
|
-
color:
|
|
7313
|
+
color: Ce.parse(o.color),
|
|
7312
7314
|
isFavorite: o.isFavorite,
|
|
7313
7315
|
itemOrder: o.itemOrder
|
|
7314
7316
|
}));
|
|
@@ -7341,7 +7343,7 @@ const pu = s.object({
|
|
|
7341
7343
|
}), hu = {
|
|
7342
7344
|
folders: s.array(pu).min(1).max(D.ITEMS_PER_OPERATION).describe("The folders to rename.")
|
|
7343
7345
|
}, mu = {
|
|
7344
|
-
folders: s.array(
|
|
7346
|
+
folders: s.array(Pt).describe("The renamed folders."),
|
|
7345
7347
|
failures: s.array(_).describe("Folders that could not be renamed, with the reason for each."),
|
|
7346
7348
|
successCount: s.number(),
|
|
7347
7349
|
failureCount: s.number()
|
|
@@ -7360,7 +7362,7 @@ const pu = s.object({
|
|
|
7360
7362
|
return O(y.UPDATE_FOLDERS, e.length, n), {
|
|
7361
7363
|
textContent: bu(a, n),
|
|
7362
7364
|
structuredContent: {
|
|
7363
|
-
folders: a.map(
|
|
7365
|
+
folders: a.map(Ut),
|
|
7364
7366
|
failures: n,
|
|
7365
7367
|
successCount: a.length,
|
|
7366
7368
|
failureCount: n.length
|
|
@@ -7378,7 +7380,7 @@ const gu = s.object({
|
|
|
7378
7380
|
labelType: s.literal("personal").describe("Update a personal label, identified by its ID."),
|
|
7379
7381
|
id: s.string().min(1).describe("The ID of the personal label to update."),
|
|
7380
7382
|
name: s.string().min(1).max(128).optional().describe("The new name of the label."),
|
|
7381
|
-
color:
|
|
7383
|
+
color: Se,
|
|
7382
7384
|
order: s.number().int().optional().describe("The new position of the label in the label list."),
|
|
7383
7385
|
isFavorite: s.boolean().optional().describe("Whether to mark the label as a favorite.")
|
|
7384
7386
|
}), yu = s.object({
|
|
@@ -7398,7 +7400,7 @@ const gu = s.object({
|
|
|
7398
7400
|
name: s.string().describe("The previous name of the shared label."),
|
|
7399
7401
|
newName: s.string().describe("The new name of the shared label.")
|
|
7400
7402
|
}), Iu = {
|
|
7401
|
-
updatedLabels: s.array(
|
|
7403
|
+
updatedLabels: s.array(je).describe("The updated personal labels."),
|
|
7402
7404
|
renamedSharedLabels: s.array(ku).describe("The shared labels that were renamed."),
|
|
7403
7405
|
totalCount: s.number().describe("The total number of successful operations (personal + shared)."),
|
|
7404
7406
|
failures: s.array(_).describe(
|
|
@@ -7435,7 +7437,7 @@ const gu = s.object({
|
|
|
7435
7437
|
(h) => h.labelType === "personal" ? h.id : h.name
|
|
7436
7438
|
), i = n.map(({ value: h }) => h);
|
|
7437
7439
|
O(y.UPDATE_LABELS, o.length, a, { redactItems: !0 });
|
|
7438
|
-
const c = i.filter((h) => h.kind === "updated").map((h) =>
|
|
7440
|
+
const c = i.filter((h) => h.kind === "updated").map((h) => je.parse(h.label)), d = i.filter(
|
|
7439
7441
|
(h) => h.kind === "renamed"
|
|
7440
7442
|
).map(({ name: h, newName: m }) => ({ name: h, newName: m })), u = i.filter((h) => h.kind === "skipped").length, l = i.filter(
|
|
7441
7443
|
(h) => h.kind === "skipped" && h.reason === "no-fields"
|
|
@@ -7510,7 +7512,7 @@ const { FIND_FOLDERS: ju } = y, $u = s.object({
|
|
|
7510
7512
|
"The description of the project (Markdown). Pass null (or an empty string) to clear it."
|
|
7511
7513
|
)
|
|
7512
7514
|
).optional(),
|
|
7513
|
-
color:
|
|
7515
|
+
color: Se,
|
|
7514
7516
|
icon: s.enum([...Ho, "remove"]).optional().describe('The project icon, or "remove" to restore the default # icon.'),
|
|
7515
7517
|
folderId: s.string().min(1).optional().describe(
|
|
7516
7518
|
`Move a workspace project into this folder (see ${ju}), or "remove" for the workspace's top level.`
|
|
@@ -7593,14 +7595,14 @@ const _u = s.object({
|
|
|
7593
7595
|
minuteOffset: s.number().int().min(0).optional().describe("New minute offset before task due time."),
|
|
7594
7596
|
service: Ye.optional().describe('New delivery method: "email" or "push".'),
|
|
7595
7597
|
isUrgent: Ge,
|
|
7596
|
-
notifyUser:
|
|
7598
|
+
notifyUser: Bt
|
|
7597
7599
|
}), Pu = s.object({
|
|
7598
7600
|
type: s.literal("absolute"),
|
|
7599
7601
|
id: s.string().min(1).describe("The ID of the absolute reminder to update."),
|
|
7600
7602
|
due: Ss.optional().describe("New due date/time for the reminder."),
|
|
7601
7603
|
service: Ye.optional().describe('New delivery method: "email" or "push".'),
|
|
7602
7604
|
isUrgent: Ge,
|
|
7603
|
-
notifyUser:
|
|
7605
|
+
notifyUser: Bt
|
|
7604
7606
|
}), Uu = s.object({
|
|
7605
7607
|
type: s.literal("location"),
|
|
7606
7608
|
id: s.string().min(1).describe("The ID of the location reminder to update."),
|
|
@@ -7611,7 +7613,7 @@ const _u = s.object({
|
|
|
7611
7613
|
'New trigger condition: "on_enter" or "on_leave".'
|
|
7612
7614
|
),
|
|
7613
7615
|
radius: s.number().int().optional().describe("New radius in meters."),
|
|
7614
|
-
notifyUser:
|
|
7616
|
+
notifyUser: Bt
|
|
7615
7617
|
}), Ru = s.discriminatedUnion("type", [
|
|
7616
7618
|
_u,
|
|
7617
7619
|
Pu,
|
|
@@ -7621,7 +7623,7 @@ const _u = s.object({
|
|
|
7621
7623
|
`Array of reminders to update (max ${Fe}). Each must include the reminder type and ID. Only include fields that need to change.`
|
|
7622
7624
|
)
|
|
7623
7625
|
}, Lu = {
|
|
7624
|
-
reminders: s.array(
|
|
7626
|
+
reminders: s.array(Rt).describe("The updated reminders."),
|
|
7625
7627
|
totalCount: s.number().describe("Total reminders updated."),
|
|
7626
7628
|
updatedReminderIds: s.array(s.string()).describe("IDs of updated reminders."),
|
|
7627
7629
|
failures: s.array(_).describe("Reminders that could not be updated, with the reason for each."),
|
|
@@ -7683,7 +7685,7 @@ const _u = s.object({
|
|
|
7683
7685
|
o,
|
|
7684
7686
|
n,
|
|
7685
7687
|
(p) => p.id
|
|
7686
|
-
), c = a.map(({ value: p }) =>
|
|
7688
|
+
), c = a.map(({ value: p }) => Oe(p)), d = a.map(({ index: p }) => {
|
|
7687
7689
|
const f = r[p];
|
|
7688
7690
|
return f?.status === "fulfilled" ? f.value : void 0;
|
|
7689
7691
|
});
|
|
@@ -7779,7 +7781,7 @@ function Ku({
|
|
|
7779
7781
|
${r}` : "Updated 0 sections";
|
|
7780
7782
|
return R(n, t);
|
|
7781
7783
|
}
|
|
7782
|
-
function
|
|
7784
|
+
function Xs(e, t) {
|
|
7783
7785
|
return t.projectId !== void 0 ? e.projectId === t.projectId && !e.sectionId && !e.parentId : t.sectionId !== void 0 ? e.sectionId === t.sectionId && !e.parentId : e.parentId === t.parentId;
|
|
7784
7786
|
}
|
|
7785
7787
|
function qu(e, t) {
|
|
@@ -7802,7 +7804,7 @@ function Gu({
|
|
|
7802
7804
|
return { redundantMoveSkipped: !1 };
|
|
7803
7805
|
let n = r, a = !1;
|
|
7804
7806
|
if (o) {
|
|
7805
|
-
const i = r.length === 1 ? (c) =>
|
|
7807
|
+
const i = r.length === 1 ? (c) => Xs(o, c) : (c) => qu(o, c);
|
|
7806
7808
|
n = r.filter((c) => !i(c)), a = n.length < r.length;
|
|
7807
7809
|
}
|
|
7808
7810
|
if (n.length === 0)
|
|
@@ -7829,7 +7831,7 @@ const Vu = s.object({
|
|
|
7829
7831
|
),
|
|
7830
7832
|
parentId: s.string().optional().describe("Make the task a subtask of this task ID. Omit unless the parent should change."),
|
|
7831
7833
|
order: s.number().optional().describe("The new order of the task within its parent/section."),
|
|
7832
|
-
priority:
|
|
7834
|
+
priority: At.optional().describe(Et),
|
|
7833
7835
|
dueString: s.preprocess(
|
|
7834
7836
|
// Keep accepting legacy null while exposing a Gemini-compatible string schema.
|
|
7835
7837
|
(e) => e === null ? "remove" : e,
|
|
@@ -7859,8 +7861,8 @@ const Vu = s.object({
|
|
|
7859
7861
|
isUncompletable: s.boolean().optional().describe(
|
|
7860
7862
|
"Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed."
|
|
7861
7863
|
)
|
|
7862
|
-
}), Ju = (e) => !!(e.projectId || e.sectionId || e.parentId),
|
|
7863
|
-
tasks: s.array(Vu).min(1).max(
|
|
7864
|
+
}), Ju = (e) => !!(e.projectId || e.sectionId || e.parentId), Zs = (e) => Object.keys(e).length > 0, Xu = ["remove", "no date"], Zu = ["remove", "no date", "no deadline"], _o = "no date", yt = D.TASKS_PER_OPERATION, Po = {
|
|
7865
|
+
tasks: s.array(Vu).min(1).max(yt).describe(`The tasks to update (max ${yt}).`)
|
|
7864
7866
|
}, Qu = {
|
|
7865
7867
|
tasks: s.array(ee).describe("The updated tasks."),
|
|
7866
7868
|
totalCount: s.number().describe("The total number of tasks updated."),
|
|
@@ -7901,7 +7903,7 @@ const Vu = s.object({
|
|
|
7901
7903
|
const A = i[T]?.index ?? T;
|
|
7902
7904
|
v.status === "fulfilled" ? u.push(v.value) : a(A, v.reason);
|
|
7903
7905
|
}
|
|
7904
|
-
const { states: l, readFailed: p } = await
|
|
7906
|
+
const { states: l, readFailed: p } = await Qs({
|
|
7905
7907
|
client: t,
|
|
7906
7908
|
ids: [
|
|
7907
7909
|
...new Set(
|
|
@@ -7974,7 +7976,7 @@ const Vu = s.object({
|
|
|
7974
7976
|
}
|
|
7975
7977
|
}), await Promise.all(m);
|
|
7976
7978
|
for (const T of u) {
|
|
7977
|
-
if (T.failed ||
|
|
7979
|
+
if (T.failed || Zs(T.updateArgs))
|
|
7978
7980
|
continue;
|
|
7979
7981
|
const v = h.get(T.index);
|
|
7980
7982
|
v && "task" in v && (r[T.index] = { kind: "updated", task: v.task });
|
|
@@ -8028,7 +8030,7 @@ async function op(e, t) {
|
|
|
8028
8030
|
return { error: o };
|
|
8029
8031
|
}
|
|
8030
8032
|
}
|
|
8031
|
-
async function
|
|
8033
|
+
async function Qs({
|
|
8032
8034
|
client: e,
|
|
8033
8035
|
ids: t
|
|
8034
8036
|
}) {
|
|
@@ -8036,7 +8038,7 @@ async function er({
|
|
|
8036
8038
|
if (t.length === 0)
|
|
8037
8039
|
return { states: o, readFailed: !1 };
|
|
8038
8040
|
try {
|
|
8039
|
-
const r = new Set(t), n = { ids: t, limit:
|
|
8041
|
+
const r = new Set(t), n = { ids: t, limit: yt }, { results: a } = await j(() => e.getTasks(n));
|
|
8040
8042
|
for (const i of a)
|
|
8041
8043
|
r.has(i.id) && o.set(i.id, i);
|
|
8042
8044
|
} catch {
|
|
@@ -8067,7 +8069,7 @@ async function rp({
|
|
|
8067
8069
|
const d = zu(c.move), u = n.get(d);
|
|
8068
8070
|
u ? u.push(c) : n.set(d, [c]);
|
|
8069
8071
|
}
|
|
8070
|
-
const a =
|
|
8072
|
+
const a = en(e), i = [];
|
|
8071
8073
|
for (const c of n.values()) {
|
|
8072
8074
|
const d = [...new Set(c.map(({ item: p }) => p.id))], u = c[0]?.move, l = c.length === 1 ? c[0] : void 0;
|
|
8073
8075
|
try {
|
|
@@ -8105,12 +8107,12 @@ async function np({
|
|
|
8105
8107
|
unresolved: t,
|
|
8106
8108
|
results: o
|
|
8107
8109
|
}) {
|
|
8108
|
-
const r = [...new Set(t.flatMap(({ group: a }) => a.map(({ item: i }) => i.id)))], { states: n } = await
|
|
8110
|
+
const r = [...new Set(t.flatMap(({ group: a }) => a.map(({ item: i }) => i.id)))], { states: n } = await Qs({ client: e, ids: r });
|
|
8109
8111
|
for (const { group: a, destination: i, error: c } of t) {
|
|
8110
8112
|
const d = c === void 0 ? "Task not returned by the move" : B(c);
|
|
8111
8113
|
for (const { item: u } of a) {
|
|
8112
8114
|
const l = n.get(u.id);
|
|
8113
|
-
if (l &&
|
|
8115
|
+
if (l && Xs(l, i)) {
|
|
8114
8116
|
o.set(u.index, { task: l });
|
|
8115
8117
|
continue;
|
|
8116
8118
|
}
|
|
@@ -8124,9 +8126,9 @@ async function ap({
|
|
|
8124
8126
|
onUpdated: o,
|
|
8125
8127
|
onFailed: r
|
|
8126
8128
|
}) {
|
|
8127
|
-
const n =
|
|
8129
|
+
const n = Ct(e);
|
|
8128
8130
|
await Promise.all(
|
|
8129
|
-
t.filter((a) =>
|
|
8131
|
+
t.filter((a) => Zs(a.updateArgs)).map(async (a) => {
|
|
8130
8132
|
try {
|
|
8131
8133
|
const i = await n(
|
|
8132
8134
|
() => j(() => e.updateTask(a.id, a.updateArgs))
|
|
@@ -8174,7 +8176,7 @@ async function ip({
|
|
|
8174
8176
|
I !== void 0 && (w = { ...w, dueString: I });
|
|
8175
8177
|
const k = Uo(h, Zu, null);
|
|
8176
8178
|
if (k !== void 0 && (w = { ...w, deadlineDate: k }), u) {
|
|
8177
|
-
const { amount: S, unit: $ } =
|
|
8179
|
+
const { amount: S, unit: $ } = $t(`Task ${n}`, u);
|
|
8178
8180
|
w = { ...w, duration: S, durationUnit: $ };
|
|
8179
8181
|
}
|
|
8180
8182
|
return l !== void 0 && (w = {
|
|
@@ -8197,7 +8199,7 @@ async function ip({
|
|
|
8197
8199
|
async function cp(e, t, o) {
|
|
8198
8200
|
if (o === null || o === "unassign")
|
|
8199
8201
|
return null;
|
|
8200
|
-
const r = await
|
|
8202
|
+
const r = await Kt.validateTaskUpdateAssignment(
|
|
8201
8203
|
e,
|
|
8202
8204
|
t,
|
|
8203
8205
|
o
|
|
@@ -8216,13 +8218,13 @@ function dp({
|
|
|
8216
8218
|
}) {
|
|
8217
8219
|
const n = [];
|
|
8218
8220
|
o > 0 && n.push(`${o} skipped - no changes`), r > 0 && n.push(`${r} already in requested destination`), t.length > 0 && n.push(`${t.length} failed`);
|
|
8219
|
-
const a = n.length > 0 ? ` (${n.join(", ")})` : "", i =
|
|
8221
|
+
const a = n.length > 0 ? ` (${n.join(", ")})` : "", i = Nt("Updated", e, {
|
|
8220
8222
|
context: a,
|
|
8221
8223
|
showDetails: e.length <= 5
|
|
8222
8224
|
});
|
|
8223
8225
|
if (t.length === 0)
|
|
8224
8226
|
return i;
|
|
8225
|
-
const c = t.slice(0,
|
|
8227
|
+
const c = t.slice(0, xe.MAX_FAILURES_SHOWN), d = t.length - c.length, u = c.map((p) => ` ${p.item}: ${p.error}`).join(`
|
|
8226
8228
|
`), l = d > 0 ? `
|
|
8227
8229
|
+${d} more` : "";
|
|
8228
8230
|
return `${i}
|
|
@@ -8286,11 +8288,11 @@ function yp(e) {
|
|
|
8286
8288
|
return !1;
|
|
8287
8289
|
}
|
|
8288
8290
|
}
|
|
8289
|
-
function
|
|
8291
|
+
function er(e) {
|
|
8290
8292
|
return yp(e) ? e : "UTC";
|
|
8291
8293
|
}
|
|
8292
8294
|
function wp(e, t) {
|
|
8293
|
-
const o =
|
|
8295
|
+
const o = er(t);
|
|
8294
8296
|
return e.toLocaleString("en-US", {
|
|
8295
8297
|
timeZone: o,
|
|
8296
8298
|
year: "numeric",
|
|
@@ -8303,7 +8305,7 @@ function wp(e, t) {
|
|
|
8303
8305
|
});
|
|
8304
8306
|
}
|
|
8305
8307
|
async function Tp(e) {
|
|
8306
|
-
const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", r =
|
|
8308
|
+
const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", r = er(o), n = /* @__PURE__ */ new Date(), a = wp(n, r), i = t.startDay ?? 1, c = gp(i), d = hp(t), u = new Date(n.toLocaleString("en-US", { timeZone: r })), l = mp(u, i), p = fp(l), f = bp(u), m = [
|
|
8307
8309
|
"# User Information",
|
|
8308
8310
|
"",
|
|
8309
8311
|
`**User ID:** ${t.id}`,
|
|
@@ -8315,8 +8317,8 @@ async function Tp(e) {
|
|
|
8315
8317
|
"## Week Settings",
|
|
8316
8318
|
`**Week Start Day:** ${c} (${i})`,
|
|
8317
8319
|
`**Current Week:** Week ${f}`,
|
|
8318
|
-
`**Week Start Date:** ${
|
|
8319
|
-
`**Week End Date:** ${
|
|
8320
|
+
`**Week Start Date:** ${De(l)}`,
|
|
8321
|
+
`**Week End Date:** ${De(p)}`,
|
|
8320
8322
|
"",
|
|
8321
8323
|
"## Daily Progress",
|
|
8322
8324
|
`**Completed Today:** ${t.completedToday}`,
|
|
@@ -8334,8 +8336,8 @@ async function Tp(e) {
|
|
|
8334
8336
|
currentLocalTime: a,
|
|
8335
8337
|
startDay: i,
|
|
8336
8338
|
startDayName: c,
|
|
8337
|
-
weekStartDate:
|
|
8338
|
-
weekEndDate:
|
|
8339
|
+
weekStartDate: De(l),
|
|
8340
|
+
weekEndDate: De(p),
|
|
8339
8341
|
currentWeekNumber: f,
|
|
8340
8342
|
completedToday: t.completedToday,
|
|
8341
8343
|
dailyGoal: t.dailyGoal,
|
|
@@ -8461,13 +8463,13 @@ const Ap = /^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl
|
|
|
8461
8463
|
...nd,
|
|
8462
8464
|
_meta: {
|
|
8463
8465
|
ui: {
|
|
8464
|
-
resourceUri:
|
|
8466
|
+
resourceUri: at
|
|
8465
8467
|
}
|
|
8466
8468
|
}
|
|
8467
8469
|
}, _p = {
|
|
8468
8470
|
// Task management tools
|
|
8469
|
-
addTasks:
|
|
8470
|
-
completeTasks:
|
|
8471
|
+
addTasks: wi,
|
|
8472
|
+
completeTasks: Oi,
|
|
8471
8473
|
uncompleteTasks: Xl,
|
|
8472
8474
|
updateTasks: ep,
|
|
8473
8475
|
rescheduleTasks: Pl,
|
|
@@ -8475,49 +8477,49 @@ const Ap = /^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl
|
|
|
8475
8477
|
findTasksByDate: Op,
|
|
8476
8478
|
findCompletedTasks: wc,
|
|
8477
8479
|
// Project management tools
|
|
8478
|
-
addProjects:
|
|
8480
|
+
addProjects: Xa,
|
|
8479
8481
|
updateProjects: Du,
|
|
8480
8482
|
findProjects: Bc,
|
|
8481
8483
|
projectManagement: ul,
|
|
8482
8484
|
projectMove: fl,
|
|
8483
8485
|
// Folder management tools
|
|
8484
|
-
addFolders:
|
|
8486
|
+
addFolders: Fa,
|
|
8485
8487
|
updateFolders: fu,
|
|
8486
8488
|
findFolders: $c,
|
|
8487
8489
|
// Section management tools
|
|
8488
|
-
addSections:
|
|
8490
|
+
addSections: mi,
|
|
8489
8491
|
updateSections: Bu,
|
|
8490
8492
|
findSections: ed,
|
|
8491
8493
|
// Comment management tools
|
|
8492
|
-
addComments:
|
|
8493
|
-
findComments:
|
|
8494
|
+
addComments: ya,
|
|
8495
|
+
findComments: uc,
|
|
8494
8496
|
updateComments: su,
|
|
8495
8497
|
// Reminder management tools
|
|
8496
|
-
addReminders:
|
|
8498
|
+
addReminders: di,
|
|
8497
8499
|
findReminders: Vc,
|
|
8498
8500
|
updateReminders: Mu,
|
|
8499
8501
|
// Attachment tools
|
|
8500
8502
|
viewAttachment: xp,
|
|
8501
8503
|
// Label management tools
|
|
8502
|
-
addLabels:
|
|
8504
|
+
addLabels: qa,
|
|
8503
8505
|
updateLabels: vu,
|
|
8504
8506
|
findLabels: Oc,
|
|
8505
8507
|
// Filter management tools
|
|
8506
|
-
findFilters:
|
|
8507
|
-
addFilters:
|
|
8508
|
+
findFilters: Ca,
|
|
8509
|
+
addFilters: Da,
|
|
8508
8510
|
updateFilters: cu,
|
|
8509
8511
|
// Activity and audit tools
|
|
8510
|
-
findActivity:
|
|
8512
|
+
findActivity: rc,
|
|
8511
8513
|
getProductivityStats: Cd,
|
|
8512
8514
|
// Health and insights tools
|
|
8513
8515
|
getProjectHealth: Pd,
|
|
8514
8516
|
getProjectActivityStats: Dd,
|
|
8515
|
-
analyzeProjectHealth:
|
|
8517
|
+
analyzeProjectHealth: Ai,
|
|
8516
8518
|
getWorkspaceInsights: Bd,
|
|
8517
8519
|
// General tools
|
|
8518
8520
|
getOverview: Id,
|
|
8519
|
-
deleteObject:
|
|
8520
|
-
fetchObject:
|
|
8521
|
+
deleteObject: Mi,
|
|
8522
|
+
fetchObject: Xi,
|
|
8521
8523
|
reorderObjects: Sl,
|
|
8522
8524
|
userInfo: kp,
|
|
8523
8525
|
getUserStatus: Md,
|
|
@@ -8526,13 +8528,13 @@ const Ap = /^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl
|
|
|
8526
8528
|
findProjectCollaborators: Rc,
|
|
8527
8529
|
manageAssignments: al,
|
|
8528
8530
|
// Template tools
|
|
8529
|
-
exportProjectTemplate:
|
|
8531
|
+
exportProjectTemplate: Wi,
|
|
8530
8532
|
importProjectTemplate: Vd,
|
|
8531
8533
|
// Workspace tools
|
|
8532
8534
|
listWorkspaces: tl,
|
|
8533
8535
|
// OpenAI MCP tools
|
|
8534
8536
|
search: Ml,
|
|
8535
|
-
fetch:
|
|
8537
|
+
fetch: ec
|
|
8536
8538
|
}, Pp = Object.values(_p), Up = `
|
|
8537
8539
|
## Todoist Task and Project Management Tools
|
|
8538
8540
|
|
|
@@ -8590,14 +8592,14 @@ What each tool does and how to fill its parameters is in the tool's own descript
|
|
|
8590
8592
|
For a productivity review, call **get-productivity-stats**, then find what the user completed as described under "Finding things".
|
|
8591
8593
|
|
|
8592
8594
|
Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
|
|
8593
|
-
`,
|
|
8595
|
+
`, Ee = { ttlMs: kt, cacheScope: "private" };
|
|
8594
8596
|
function Zp({
|
|
8595
8597
|
token: e,
|
|
8596
8598
|
baseUrl: t,
|
|
8597
8599
|
features: o = []
|
|
8598
8600
|
}) {
|
|
8599
|
-
const r = new
|
|
8600
|
-
{ name: "todoist-mcp-server", version:
|
|
8601
|
+
const r = new or(
|
|
8602
|
+
{ name: "todoist-mcp-server", version: jt },
|
|
8601
8603
|
{
|
|
8602
8604
|
capabilities: {
|
|
8603
8605
|
tools: { listChanged: !0 },
|
|
@@ -8605,22 +8607,22 @@ function Zp({
|
|
|
8605
8607
|
},
|
|
8606
8608
|
instructions: Up,
|
|
8607
8609
|
cacheHints: {
|
|
8608
|
-
"server/discover":
|
|
8609
|
-
"tools/list":
|
|
8610
|
-
"prompts/list":
|
|
8611
|
-
"resources/list":
|
|
8612
|
-
"resources/templates/list":
|
|
8610
|
+
"server/discover": Ee,
|
|
8611
|
+
"tools/list": Ee,
|
|
8612
|
+
"prompts/list": Ee,
|
|
8613
|
+
"resources/list": Ee,
|
|
8614
|
+
"resources/templates/list": Ee
|
|
8613
8615
|
}
|
|
8614
8616
|
}
|
|
8615
|
-
), n =
|
|
8616
|
-
return
|
|
8617
|
-
|
|
8617
|
+
), n = mn(e, { baseUrl: t });
|
|
8618
|
+
return Ar(r), Dn({ tools: Pp, server: r, client: n, features: o }), r.registerPrompt(
|
|
8619
|
+
$e.name,
|
|
8618
8620
|
{
|
|
8619
|
-
title:
|
|
8620
|
-
description:
|
|
8621
|
-
argsSchema:
|
|
8621
|
+
title: $e.title,
|
|
8622
|
+
description: $e.description,
|
|
8623
|
+
argsSchema: $e.argsSchema
|
|
8622
8624
|
},
|
|
8623
|
-
|
|
8625
|
+
$e.callback
|
|
8624
8626
|
), r;
|
|
8625
8627
|
}
|
|
8626
8628
|
export {
|
|
@@ -8652,29 +8654,29 @@ export {
|
|
|
8652
8654
|
Du as Y,
|
|
8653
8655
|
Mu as Z,
|
|
8654
8656
|
Bu as _,
|
|
8655
|
-
|
|
8657
|
+
ya as a,
|
|
8656
8658
|
kp as a0,
|
|
8657
8659
|
xp as a1,
|
|
8658
8660
|
Jp as a2,
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8661
|
+
an as a3,
|
|
8662
|
+
Da as b,
|
|
8663
|
+
Fa as c,
|
|
8664
|
+
qa as d,
|
|
8665
|
+
Xa as e,
|
|
8666
|
+
di as f,
|
|
8665
8667
|
Zp as g,
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8668
|
+
mi as h,
|
|
8669
|
+
wi as i,
|
|
8670
|
+
Ai as j,
|
|
8671
|
+
Oi as k,
|
|
8672
|
+
Mi as l,
|
|
8673
|
+
Wi as m,
|
|
8674
|
+
ec as n,
|
|
8675
|
+
Xi as o,
|
|
8676
|
+
rc as p,
|
|
8677
|
+
uc as q,
|
|
8676
8678
|
wc as r,
|
|
8677
|
-
|
|
8679
|
+
Ca as s,
|
|
8678
8680
|
_p as t,
|
|
8679
8681
|
$c as u,
|
|
8680
8682
|
Oc as v,
|