@doist/todoist-ai 5.2.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +272 -901
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/main.js +1 -1
- package/dist/mcp-helpers.d.ts.map +1 -1
- package/dist/{mcp-server-D0ROki3I.js → mcp-server-BwerBJpX.js} +117 -127
- package/dist/tools/add-comments.d.ts +9 -82
- package/dist/tools/add-comments.d.ts.map +1 -1
- package/dist/tools/add-projects.d.ts +11 -73
- package/dist/tools/add-projects.d.ts.map +1 -1
- package/dist/tools/add-sections.d.ts +2 -14
- package/dist/tools/add-sections.d.ts.map +1 -1
- package/dist/tools/add-tasks.d.ts +24 -76
- package/dist/tools/add-tasks.d.ts.map +1 -1
- package/dist/tools/complete-tasks.d.ts +3 -11
- package/dist/tools/complete-tasks.d.ts.map +1 -1
- package/dist/tools/delete-object.d.ts +15 -11
- package/dist/tools/delete-object.d.ts.map +1 -1
- package/dist/tools/fetch.d.ts.map +1 -1
- package/dist/tools/find-activity.d.ts +25 -31
- package/dist/tools/find-activity.d.ts.map +1 -1
- package/dist/tools/find-comments.d.ts +9 -74
- package/dist/tools/find-comments.d.ts.map +1 -1
- package/dist/tools/find-completed-tasks.d.ts +28 -53
- package/dist/tools/find-completed-tasks.d.ts.map +1 -1
- package/dist/tools/find-project-collaborators.d.ts +2 -18
- package/dist/tools/find-project-collaborators.d.ts.map +1 -1
- package/dist/tools/find-projects.d.ts +3 -21
- package/dist/tools/find-projects.d.ts.map +1 -1
- package/dist/tools/find-sections.d.ts +1 -7
- package/dist/tools/find-sections.d.ts.map +1 -1
- package/dist/tools/find-tasks-by-date.d.ts +34 -54
- package/dist/tools/find-tasks-by-date.d.ts.map +1 -1
- package/dist/tools/find-tasks.d.ts +31 -55
- package/dist/tools/find-tasks.d.ts.map +1 -1
- package/dist/tools/get-overview.d.ts +8 -15
- package/dist/tools/get-overview.d.ts.map +1 -1
- package/dist/tools/manage-assignments.d.ts +9 -27
- package/dist/tools/manage-assignments.d.ts.map +1 -1
- package/dist/tools/search.d.ts +1 -9
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/update-comments.d.ts +10 -85
- package/dist/tools/update-comments.d.ts.map +1 -1
- package/dist/tools/update-projects.d.ts +12 -80
- package/dist/tools/update-projects.d.ts.map +1 -1
- package/dist/tools/update-sections.d.ts +4 -16
- package/dist/tools/update-sections.d.ts.map +1 -1
- package/dist/tools/update-tasks.d.ts +25 -87
- package/dist/tools/update-tasks.d.ts.map +1 -1
- package/dist/tools/user-info.d.ts +6 -2
- package/dist/tools/user-info.d.ts.map +1 -1
- package/dist/utils/labels.d.ts +5 -2
- package/dist/utils/labels.d.ts.map +1 -1
- package/dist/utils/output-schemas.d.ts +20 -176
- package/dist/utils/output-schemas.d.ts.map +1 -1
- package/dist/utils/priorities.d.ts +6 -1
- package/dist/utils/priorities.d.ts.map +1 -1
- package/package.json +11 -11
- package/scripts/validate-schemas.ts +66 -65
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { getTaskUrl as
|
|
1
|
+
import { getTaskUrl as fe, getProjectUrl as be, TodoistApi as Ae } from "@doist/todoist-api-typescript";
|
|
2
2
|
import { McpServer as Ue } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import F, { z as s } from "zod";
|
|
4
|
-
import { addDays as
|
|
5
|
-
function
|
|
4
|
+
import { addDays as ge, formatISO as Pe } from "date-fns";
|
|
5
|
+
function Z(e) {
|
|
6
6
|
if (e == null)
|
|
7
7
|
return e;
|
|
8
8
|
if (Array.isArray(e))
|
|
9
|
-
return e.map((t) =>
|
|
9
|
+
return e.map((t) => Z(t));
|
|
10
10
|
if (typeof e == "object") {
|
|
11
11
|
const t = {};
|
|
12
12
|
for (const [o, n] of Object.entries(e))
|
|
13
13
|
if (n !== null) {
|
|
14
|
-
const r =
|
|
14
|
+
const r = Z(n);
|
|
15
15
|
if (r !== null && typeof r == "object" && !Array.isArray(r) && Object.keys(r).length === 0)
|
|
16
16
|
continue;
|
|
17
17
|
t[o] = r;
|
|
@@ -25,7 +25,7 @@ function Oe({
|
|
|
25
25
|
textContent: e,
|
|
26
26
|
structuredContent: t
|
|
27
27
|
}) {
|
|
28
|
-
const o =
|
|
28
|
+
const o = Z(t), n = {};
|
|
29
29
|
if (e && (n.content = [{ type: "text", text: e }]), t && (n.structuredContent = o), !Ee && t) {
|
|
30
30
|
const r = JSON.stringify(o);
|
|
31
31
|
n.content || (n.content = []), n.content.push({
|
|
@@ -102,7 +102,7 @@ const S = {
|
|
|
102
102
|
ACTIVITY_DEFAULT: 20,
|
|
103
103
|
/** Maximum limit for activity log search and list operations */
|
|
104
104
|
ACTIVITY_MAX: 100
|
|
105
|
-
},
|
|
105
|
+
}, q = {
|
|
106
106
|
/** Maximum number of failures to show in detailed error messages */
|
|
107
107
|
MAX_FAILURES_SHOWN: 3
|
|
108
108
|
};
|
|
@@ -111,7 +111,7 @@ class U extends Error {
|
|
|
111
111
|
super(`Invalid duration format "${t}": ${o}`), this.name = "DurationParseError";
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Te(e) {
|
|
115
115
|
if (!e || typeof e != "string")
|
|
116
116
|
throw new U(e, "Duration must be a non-empty string");
|
|
117
117
|
const t = e.trim().toLowerCase().replace(/\s+/g, "");
|
|
@@ -150,16 +150,14 @@ function Me(e) {
|
|
|
150
150
|
const t = Math.floor(e / 60), o = e % 60;
|
|
151
151
|
return t === 0 ? `${o}m` : o === 0 ? `${t}h` : `${t}h${o}m`;
|
|
152
152
|
}
|
|
153
|
-
const Fe = ["p1", "p2", "p3", "p4"],
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
function Te(e) {
|
|
153
|
+
const Fe = ["p1", "p2", "p3", "p4"], ee = s.enum(Fe).describe("Task priority: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)");
|
|
154
|
+
function ye(e) {
|
|
157
155
|
return { p1: 4, p2: 3, p3: 2, p4: 1 }[e];
|
|
158
156
|
}
|
|
159
157
|
function Re(e) {
|
|
160
158
|
return { 4: "p1", 3: "p2", 2: "p3", 1: "p4" }[e];
|
|
161
159
|
}
|
|
162
|
-
const A = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(),
|
|
160
|
+
const A = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), J = 300 * 1e3;
|
|
163
161
|
class Le {
|
|
164
162
|
/**
|
|
165
163
|
* Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
|
|
@@ -169,7 +167,7 @@ class Le {
|
|
|
169
167
|
if (!o || o.trim().length === 0)
|
|
170
168
|
return null;
|
|
171
169
|
const n = o.trim(), r = A.get(n);
|
|
172
|
-
if (r && Date.now() - r.timestamp <
|
|
170
|
+
if (r && Date.now() - r.timestamp < J)
|
|
173
171
|
return r.result;
|
|
174
172
|
if (/^[0-9]+$/.test(n) || /^[a-f0-9-]{8,}$/i.test(n) && n.includes("-") || /^[a-z0-9_]{6,}$/i.test(n) && !/^[a-z]+[\s-]/.test(n) && /[0-9_]/.test(n)) {
|
|
175
173
|
const i = { userId: n, displayName: n, email: n };
|
|
@@ -218,7 +216,7 @@ class Le {
|
|
|
218
216
|
*/
|
|
219
217
|
async getProjectCollaborators(t, o) {
|
|
220
218
|
const n = `project_${o}`, r = R.get(n);
|
|
221
|
-
if (r && Date.now() - r.timestamp <
|
|
219
|
+
if (r && Date.now() - r.timestamp < J)
|
|
222
220
|
return r.result;
|
|
223
221
|
try {
|
|
224
222
|
const i = await t.getProjectCollaborators(o), a = (Array.isArray(i) ? i : i.results || []).filter((d) => d?.id && d.name && d.email);
|
|
@@ -235,7 +233,7 @@ class Le {
|
|
|
235
233
|
*/
|
|
236
234
|
async getAllCollaborators(t) {
|
|
237
235
|
const o = "all_collaborators", n = R.get(o);
|
|
238
|
-
if (n && Date.now() - n.timestamp <
|
|
236
|
+
if (n && Date.now() - n.timestamp < J)
|
|
239
237
|
return n.result;
|
|
240
238
|
try {
|
|
241
239
|
const { results: r } = await t.getProjects({}), i = r.filter((u) => u.isShared);
|
|
@@ -269,8 +267,8 @@ const _ = new Le();
|
|
|
269
267
|
async function We(e, t) {
|
|
270
268
|
return _.resolveUser(e, t);
|
|
271
269
|
}
|
|
272
|
-
const
|
|
273
|
-
async function
|
|
270
|
+
const Ie = ["assigned", "unassignedOrMe", "all"];
|
|
271
|
+
async function te(e, t) {
|
|
274
272
|
if (!t)
|
|
275
273
|
return;
|
|
276
274
|
const o = await We(e, t);
|
|
@@ -290,7 +288,7 @@ function Be({
|
|
|
290
288
|
}) {
|
|
291
289
|
return e && t ? `assigned to: ${t}` : o === "unassignedOrMe" ? "!assigned to: others" : o === "assigned" ? "assigned to: others" : "";
|
|
292
290
|
}
|
|
293
|
-
function
|
|
291
|
+
function le({
|
|
294
292
|
tasks: e,
|
|
295
293
|
resolvedAssigneeId: t,
|
|
296
294
|
currentUserId: o,
|
|
@@ -301,7 +299,7 @@ function de({
|
|
|
301
299
|
function W(e) {
|
|
302
300
|
return "inboxProject" in e;
|
|
303
301
|
}
|
|
304
|
-
async function
|
|
302
|
+
async function ke(e) {
|
|
305
303
|
const { apiMethod: t, args: o, limit: n = 100 } = e, r = [];
|
|
306
304
|
let i = null;
|
|
307
305
|
do {
|
|
@@ -314,14 +312,14 @@ async function Ie(e) {
|
|
|
314
312
|
} while (i !== null);
|
|
315
313
|
return r;
|
|
316
314
|
}
|
|
317
|
-
async function
|
|
318
|
-
return
|
|
315
|
+
async function we(e) {
|
|
316
|
+
return ke({
|
|
319
317
|
apiMethod: (t) => e.getProjects(t),
|
|
320
318
|
limit: S.PROJECTS_MAX
|
|
321
319
|
});
|
|
322
320
|
}
|
|
323
321
|
async function ze(e, t) {
|
|
324
|
-
return
|
|
322
|
+
return ke({
|
|
325
323
|
apiMethod: (o) => e.getSections(o),
|
|
326
324
|
args: t ? { projectId: t } : {},
|
|
327
325
|
limit: S.SECTIONS_MAX
|
|
@@ -362,7 +360,7 @@ function O(e) {
|
|
|
362
360
|
completedAt: e.completedAt ?? void 0
|
|
363
361
|
};
|
|
364
362
|
}
|
|
365
|
-
function
|
|
363
|
+
function K(e) {
|
|
366
364
|
return {
|
|
367
365
|
id: e.id,
|
|
368
366
|
name: e.name,
|
|
@@ -374,7 +372,7 @@ function we(e) {
|
|
|
374
372
|
viewStyle: e.viewStyle
|
|
375
373
|
};
|
|
376
374
|
}
|
|
377
|
-
function
|
|
375
|
+
function se(e) {
|
|
378
376
|
return {
|
|
379
377
|
id: e.id,
|
|
380
378
|
taskId: e.taskId ?? void 0,
|
|
@@ -419,7 +417,7 @@ const Ke = F.object({
|
|
|
419
417
|
errorTag: F.string()
|
|
420
418
|
})
|
|
421
419
|
});
|
|
422
|
-
async function
|
|
420
|
+
async function oe({
|
|
423
421
|
client: e,
|
|
424
422
|
query: t,
|
|
425
423
|
limit: o,
|
|
@@ -445,7 +443,7 @@ const B = s.object({
|
|
|
445
443
|
dueDate: s.string().optional().describe("The due date of the task (ISO 8601 format)."),
|
|
446
444
|
recurring: s.union([s.boolean(), s.string()]).describe("Whether the task is recurring, or the recurrence string."),
|
|
447
445
|
deadlineDate: s.string().optional().describe("The deadline date of the task (ISO 8601 format)."),
|
|
448
|
-
priority:
|
|
446
|
+
priority: ee.describe(
|
|
449
447
|
"The priority level: p1 (highest), p2 (high), p3 (medium), p4 (lowest)."
|
|
450
448
|
),
|
|
451
449
|
projectId: s.string().describe("The ID of the project this task belongs to."),
|
|
@@ -458,7 +456,7 @@ const B = s.object({
|
|
|
458
456
|
assignedByUid: s.string().optional().describe("The UID of the user who assigned this task."),
|
|
459
457
|
checked: s.boolean().describe("Whether the task is checked/completed."),
|
|
460
458
|
completedAt: s.string().optional().describe("When the task was completed (ISO 8601 format).")
|
|
461
|
-
}),
|
|
459
|
+
}), ne = s.object({
|
|
462
460
|
id: s.string().describe("The unique ID of the project."),
|
|
463
461
|
name: s.string().describe("The name of the project."),
|
|
464
462
|
color: s.string().describe("The color of the project."),
|
|
@@ -467,7 +465,7 @@ const B = s.object({
|
|
|
467
465
|
parentId: s.string().optional().describe("The ID of the parent project (for sub-projects)."),
|
|
468
466
|
inboxProject: s.boolean().describe("Whether this is the inbox project."),
|
|
469
467
|
viewStyle: s.string().describe("The view style of the project (list, board, calendar).")
|
|
470
|
-
}),
|
|
468
|
+
}), re = s.object({
|
|
471
469
|
id: s.string().describe("The unique ID of the section."),
|
|
472
470
|
name: s.string().describe("The name of the section.")
|
|
473
471
|
}), Ve = s.object({
|
|
@@ -483,7 +481,7 @@ const B = s.object({
|
|
|
483
481
|
image: s.string().optional().describe("The image URL for image resource types."),
|
|
484
482
|
imageWidth: s.number().optional().describe("The width of the image in pixels."),
|
|
485
483
|
imageHeight: s.number().optional().describe("The height of the image in pixels.")
|
|
486
|
-
}),
|
|
484
|
+
}), ie = s.object({
|
|
487
485
|
id: s.string().describe("The unique ID of the comment."),
|
|
488
486
|
taskId: s.string().optional().describe("The ID of the task this comment belongs to."),
|
|
489
487
|
projectId: s.string().optional().describe("The ID of the project this comment belongs to."),
|
|
@@ -500,7 +498,7 @@ const B = s.object({
|
|
|
500
498
|
parentProjectId: s.string().optional().describe("The ID of the parent project."),
|
|
501
499
|
parentItemId: s.string().optional().describe("The ID of the parent item."),
|
|
502
500
|
initiatorId: s.string().optional().describe("The ID of the user who initiated this event."),
|
|
503
|
-
extraData: s.record(s.unknown()).optional().describe("Additional event data.")
|
|
501
|
+
extraData: s.record(s.string(), s.unknown()).optional().describe("Additional event data.")
|
|
504
502
|
}), qe = s.object({
|
|
505
503
|
id: s.string().describe("The unique ID of the user."),
|
|
506
504
|
name: s.string().describe("The full name of the user."),
|
|
@@ -550,7 +548,7 @@ const B = s.object({
|
|
|
550
548
|
}), Ze = {
|
|
551
549
|
comments: s.array(Xe).min(1).describe("The array of comments to add.")
|
|
552
550
|
}, Qe = {
|
|
553
|
-
comments: s.array(
|
|
551
|
+
comments: s.array(ie).describe("The created comments."),
|
|
554
552
|
totalCount: s.number().describe("The total number of comments created."),
|
|
555
553
|
addedCommentIds: s.array(s.string()).describe("The IDs of the added comments.")
|
|
556
554
|
}, et = {
|
|
@@ -577,7 +575,7 @@ const B = s.object({
|
|
|
577
575
|
content: l,
|
|
578
576
|
...u ? { taskId: u } : { projectId: b }
|
|
579
577
|
});
|
|
580
|
-
}), a = (await Promise.all(i)).map(
|
|
578
|
+
}), a = (await Promise.all(i)).map(se);
|
|
581
579
|
return {
|
|
582
580
|
textContent: tt({ comments: a }),
|
|
583
581
|
structuredContent: {
|
|
@@ -608,7 +606,7 @@ const st = s.object({
|
|
|
608
606
|
}), ot = {
|
|
609
607
|
projects: s.array(st).min(1).describe("The array of projects to add.")
|
|
610
608
|
}, nt = {
|
|
611
|
-
projects: s.array(
|
|
609
|
+
projects: s.array(ne).describe("The created projects."),
|
|
612
610
|
totalCount: s.number().describe("The total number of projects created.")
|
|
613
611
|
}, rt = {
|
|
614
612
|
name: g.ADD_PROJECTS,
|
|
@@ -617,11 +615,7 @@ const st = s.object({
|
|
|
617
615
|
outputSchema: nt,
|
|
618
616
|
mutability: "additive",
|
|
619
617
|
async execute({ projects: e }, t) {
|
|
620
|
-
const o = await Promise.all(e.map((i) => t.addProject(i))), n = it({ projects: o }), r = o.map(
|
|
621
|
-
...i,
|
|
622
|
-
parentId: "parentId" in i ? i.parentId ?? void 0 : void 0,
|
|
623
|
-
inboxProject: "inboxProject" in i ? i.inboxProject : !1
|
|
624
|
-
}));
|
|
618
|
+
const o = await Promise.all(e.map((i) => t.addProject(i))), n = it({ projects: o }), r = o.map(K);
|
|
625
619
|
return {
|
|
626
620
|
textContent: n,
|
|
627
621
|
structuredContent: {
|
|
@@ -645,7 +639,7 @@ const at = s.object({
|
|
|
645
639
|
}), ct = {
|
|
646
640
|
sections: s.array(at).min(1).describe("The array of sections to add.")
|
|
647
641
|
}, dt = {
|
|
648
|
-
sections: s.array(
|
|
642
|
+
sections: s.array(re).describe("The created sections."),
|
|
649
643
|
totalCount: s.number().describe("The total number of sections created.")
|
|
650
644
|
}, lt = {
|
|
651
645
|
name: g.ADD_SECTIONS,
|
|
@@ -893,7 +887,7 @@ class pt {
|
|
|
893
887
|
};
|
|
894
888
|
}
|
|
895
889
|
}
|
|
896
|
-
const
|
|
890
|
+
const ae = new pt();
|
|
897
891
|
function ht(e = /* @__PURE__ */ new Date()) {
|
|
898
892
|
return e.toISOString().split("T")[0] ?? "";
|
|
899
893
|
}
|
|
@@ -902,7 +896,7 @@ function je(e, t, o = {}) {
|
|
|
902
896
|
c.push(d);
|
|
903
897
|
const l = 5;
|
|
904
898
|
if (r || i <= l) {
|
|
905
|
-
const u =
|
|
899
|
+
const u = V(t, l);
|
|
906
900
|
if (u.length > 0) {
|
|
907
901
|
const p = i > l ? `, +${i - l} more` : "";
|
|
908
902
|
c.push(`Tasks:
|
|
@@ -918,10 +912,10 @@ function mt(e) {
|
|
|
918
912
|
${r.map((d) => ` ${d}`).join(`
|
|
919
913
|
`)}.`), i?.length) {
|
|
920
914
|
const d = i.length, l = `Failed (${d}):
|
|
921
|
-
${i.slice(0,
|
|
915
|
+
${i.slice(0, q.MAX_FAILURES_SHOWN).map((u) => ` ${u.item} (Error: ${u.error}${u.code ? ` [${u.code}]` : ""})`).join(
|
|
922
916
|
`
|
|
923
917
|
`
|
|
924
|
-
)}${d >
|
|
918
|
+
)}${d > q.MAX_FAILURES_SHOWN ? `, +${d - q.MAX_FAILURES_SHOWN} more` : ""}.`;
|
|
925
919
|
c.push(l);
|
|
926
920
|
}
|
|
927
921
|
return c.join(`
|
|
@@ -935,7 +929,7 @@ function bt(e) {
|
|
|
935
929
|
const t = e.inboxProject ? " • Inbox" : "", o = e.isFavorite ? " • ⭐" : "", n = e.isShared ? " • Shared" : "", r = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", i = ` • id=${e.id}`;
|
|
936
930
|
return ` ${e.name}${t}${o}${n}${r}${i}`;
|
|
937
931
|
}
|
|
938
|
-
function
|
|
932
|
+
function V(e, t = 5) {
|
|
939
933
|
const n = e.slice(0, t).map(ft).join(`
|
|
940
934
|
`);
|
|
941
935
|
if (e.length > t) {
|
|
@@ -973,7 +967,7 @@ const gt = s.object({
|
|
|
973
967
|
description: s.string().optional().describe(
|
|
974
968
|
"Additional details, notes, or context for the task. Use this for longer content rather than putting it in the task name. Supports Markdown."
|
|
975
969
|
),
|
|
976
|
-
priority:
|
|
970
|
+
priority: ee.optional().describe(
|
|
977
971
|
"The priority of the task: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)."
|
|
978
972
|
),
|
|
979
973
|
dueString: s.string().optional().describe("The due date for the task, in natural language."),
|
|
@@ -1042,13 +1036,13 @@ async function kt(e, t) {
|
|
|
1042
1036
|
labels: d,
|
|
1043
1037
|
deadlineDate: l
|
|
1044
1038
|
};
|
|
1045
|
-
if (a && (b.priority =
|
|
1039
|
+
if (a && (b.priority = ye(a)), c && !p && !r && !i)
|
|
1046
1040
|
throw new Error(
|
|
1047
1041
|
`Task "${e.content}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
|
|
1048
1042
|
);
|
|
1049
1043
|
if (o)
|
|
1050
1044
|
try {
|
|
1051
|
-
const { minutes: m } =
|
|
1045
|
+
const { minutes: m } = Te(o);
|
|
1052
1046
|
b = {
|
|
1053
1047
|
...b,
|
|
1054
1048
|
duration: m,
|
|
@@ -1073,7 +1067,7 @@ async function kt(e, t) {
|
|
|
1073
1067
|
throw new Error(
|
|
1074
1068
|
`Task "${e.content}": Cannot determine target project for assignment validation`
|
|
1075
1069
|
);
|
|
1076
|
-
const y = await
|
|
1070
|
+
const y = await ae.validateTaskCreationAssignment(
|
|
1077
1071
|
t,
|
|
1078
1072
|
m,
|
|
1079
1073
|
c
|
|
@@ -1207,7 +1201,7 @@ const $t = {
|
|
|
1207
1201
|
title: s.string().describe("The title of the document."),
|
|
1208
1202
|
text: s.string().describe("The text content of the document."),
|
|
1209
1203
|
url: s.string().describe("The URL of the document."),
|
|
1210
|
-
metadata: s.record(s.unknown()).optional().describe("Additional metadata about the document.")
|
|
1204
|
+
metadata: s.record(s.string(), s.unknown()).optional().describe("Additional metadata about the document.")
|
|
1211
1205
|
}, Pt = {
|
|
1212
1206
|
name: g.FETCH,
|
|
1213
1207
|
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}".',
|
|
@@ -1231,7 +1225,7 @@ Labels: ${a.labels.join(", ")}`), i = {
|
|
|
1231
1225
|
id: `task:${a.id}`,
|
|
1232
1226
|
title: a.content,
|
|
1233
1227
|
text: d.join(""),
|
|
1234
|
-
url:
|
|
1228
|
+
url: fe(a.id),
|
|
1235
1229
|
metadata: {
|
|
1236
1230
|
priority: a.priority,
|
|
1237
1231
|
projectId: a.projectId,
|
|
@@ -1246,7 +1240,7 @@ Labels: ${a.labels.join(", ")}`), i = {
|
|
|
1246
1240
|
}
|
|
1247
1241
|
};
|
|
1248
1242
|
} else {
|
|
1249
|
-
const c = await t.getProject(r), a =
|
|
1243
|
+
const c = await t.getProject(r), a = K(c), d = [a.name];
|
|
1250
1244
|
a.isShared && d.push(`
|
|
1251
1245
|
|
|
1252
1246
|
Shared project`), a.isFavorite && d.push(`
|
|
@@ -1254,7 +1248,7 @@ Favorite: Yes`), i = {
|
|
|
1254
1248
|
id: `project:${a.id}`,
|
|
1255
1249
|
title: a.name,
|
|
1256
1250
|
text: d.join(""),
|
|
1257
|
-
url:
|
|
1251
|
+
url: be(a.id),
|
|
1258
1252
|
metadata: {
|
|
1259
1253
|
color: a.color,
|
|
1260
1254
|
isFavorite: a.isFavorite,
|
|
@@ -1291,7 +1285,7 @@ Favorite: Yes`), i = {
|
|
|
1291
1285
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1292
1286
|
totalCount: s.number().describe("The total number of events in this page."),
|
|
1293
1287
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1294
|
-
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1288
|
+
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
1295
1289
|
}, _t = {
|
|
1296
1290
|
name: g.FIND_ACTIVITY,
|
|
1297
1291
|
description: "Retrieve recent activity logs to monitor and audit changes in Todoist. Shows events from all users by default (use initiatorId to filter by specific user). Track task completions, updates, deletions, project changes, and more with flexible filtering. Note: Date-based filtering is not supported by the Todoist API.",
|
|
@@ -1384,7 +1378,7 @@ const Lt = {
|
|
|
1384
1378
|
cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
|
|
1385
1379
|
limit: s.number().int().min(1).max(S.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
|
|
1386
1380
|
}, Wt = {
|
|
1387
|
-
comments: s.array(
|
|
1381
|
+
comments: s.array(ie).describe("The found comments."),
|
|
1388
1382
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1389
1383
|
totalCount: s.number().describe("The total number of comments in this page.")
|
|
1390
1384
|
}, Bt = {
|
|
@@ -1421,7 +1415,7 @@ const Lt = {
|
|
|
1421
1415
|
c = l.results, r = l.nextCursor !== null, i = l.nextCursor;
|
|
1422
1416
|
} else
|
|
1423
1417
|
throw new Error("Invalid state: no search parameter provided");
|
|
1424
|
-
const a = c.map(
|
|
1418
|
+
const a = c.map(se);
|
|
1425
1419
|
return {
|
|
1426
1420
|
textContent: zt({
|
|
1427
1421
|
comments: a,
|
|
@@ -1467,13 +1461,13 @@ ${c}`;
|
|
|
1467
1461
|
}
|
|
1468
1462
|
return i;
|
|
1469
1463
|
}
|
|
1470
|
-
const Yt = ["and", "or"],
|
|
1464
|
+
const Yt = ["and", "or"], ce = {
|
|
1471
1465
|
labels: s.string().array().optional().describe("The labels to filter the tasks by"),
|
|
1472
1466
|
labelsOperator: s.enum(Yt).optional().describe(
|
|
1473
1467
|
'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
|
|
1474
1468
|
)
|
|
1475
1469
|
};
|
|
1476
|
-
function
|
|
1470
|
+
function de(e = [], t = "or") {
|
|
1477
1471
|
if (e.length === 0) return "";
|
|
1478
1472
|
const o = t === "and" ? " & " : " | ";
|
|
1479
1473
|
return `(${e.map((i) => i.startsWith("@") ? i : `@${i}`).join(` ${o} `)})`;
|
|
@@ -1497,13 +1491,13 @@ const Ht = {
|
|
|
1497
1491
|
cursor: s.string().optional().describe(
|
|
1498
1492
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1499
1493
|
),
|
|
1500
|
-
...
|
|
1494
|
+
...ce
|
|
1501
1495
|
}, Kt = {
|
|
1502
1496
|
tasks: s.array(B).describe("The found completed tasks."),
|
|
1503
1497
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1504
1498
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1505
1499
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1506
|
-
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1500
|
+
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
1507
1501
|
}, Vt = {
|
|
1508
1502
|
name: g.FIND_COMPLETED_TASKS,
|
|
1509
1503
|
description: "Get completed tasks (includes all collaborators by default—use responsibleUser to narrow).",
|
|
@@ -1511,8 +1505,8 @@ const Ht = {
|
|
|
1511
1505
|
outputSchema: Kt,
|
|
1512
1506
|
mutability: "readonly",
|
|
1513
1507
|
async execute(e, t) {
|
|
1514
|
-
const { getBy: o, labels: n, labelsOperator: r, since: i, until: c, responsibleUser: a, projectId: d, ...l } = e, u = await
|
|
1515
|
-
let m =
|
|
1508
|
+
const { getBy: o, labels: n, labelsOperator: r, since: i, until: c, responsibleUser: a, projectId: d, ...l } = e, u = await te(t, a), p = u?.email;
|
|
1509
|
+
let m = de(n, r);
|
|
1516
1510
|
u && p && (m = H(m, `assigned to: ${p}`));
|
|
1517
1511
|
const y = await t.getUser(), k = y.tzInfo?.gmtString || "+00:00", w = d === "inbox" ? y.inboxProjectId : d, D = `${i}T00:00:00${k}`, P = `${c}T23:59:59${k}`, h = new Date(D).toISOString(), T = new Date(P).toISOString(), { items: C, nextCursor: v } = o === "completion" ? await t.getCompletedTasksByCompletionDate({
|
|
1518
1512
|
...l,
|
|
@@ -1566,7 +1560,7 @@ function Gt({
|
|
|
1566
1560
|
limit: t.limit,
|
|
1567
1561
|
nextCursor: o ?? void 0,
|
|
1568
1562
|
filterHints: c,
|
|
1569
|
-
previewLines:
|
|
1563
|
+
previewLines: V(e, Math.min(e.length, t.limit)),
|
|
1570
1564
|
zeroReasonHints: a
|
|
1571
1565
|
});
|
|
1572
1566
|
}
|
|
@@ -1584,7 +1578,7 @@ const { FIND_PROJECTS: qt, ADD_TASKS: Ce, UPDATE_TASKS: Se } = g, Jt = {
|
|
|
1584
1578
|
}).optional().describe("Information about the project."),
|
|
1585
1579
|
totalCount: s.number().describe("The total number of collaborators found."),
|
|
1586
1580
|
totalAvailable: s.number().optional().describe("The total number of available collaborators in the project."),
|
|
1587
|
-
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1581
|
+
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
1588
1582
|
}, Zt = {
|
|
1589
1583
|
name: g.FIND_PROJECT_COLLABORATORS,
|
|
1590
1584
|
description: "Search for collaborators by name or other criteria in a project.",
|
|
@@ -1703,11 +1697,11 @@ const { ADD_PROJECTS: es } = g, ts = {
|
|
|
1703
1697
|
"The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1704
1698
|
)
|
|
1705
1699
|
}, ss = {
|
|
1706
|
-
projects: s.array(
|
|
1700
|
+
projects: s.array(ne).describe("The found projects."),
|
|
1707
1701
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1708
1702
|
totalCount: s.number().describe("The total number of projects in this page."),
|
|
1709
1703
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1710
|
-
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1704
|
+
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
1711
1705
|
}, os = {
|
|
1712
1706
|
name: g.FIND_PROJECTS,
|
|
1713
1707
|
description: "List all projects or search for projects by name. When searching, all matching projects are returned (pagination is ignored). When not searching, projects are returned with pagination.",
|
|
@@ -1717,7 +1711,7 @@ const { ADD_PROJECTS: es } = g, ts = {
|
|
|
1717
1711
|
async execute(e, t) {
|
|
1718
1712
|
let o, n = null;
|
|
1719
1713
|
if (e.search)
|
|
1720
|
-
o = await
|
|
1714
|
+
o = await we(t), n = null;
|
|
1721
1715
|
else {
|
|
1722
1716
|
const a = await t.getProjects({
|
|
1723
1717
|
limit: e.limit,
|
|
@@ -1725,7 +1719,7 @@ const { ADD_PROJECTS: es } = g, ts = {
|
|
|
1725
1719
|
});
|
|
1726
1720
|
o = a.results, n = a.nextCursor;
|
|
1727
1721
|
}
|
|
1728
|
-
const r = e.search ? e.search.toLowerCase() : void 0, c = (r ? o.filter((a) => a.name.toLowerCase().includes(r)) : o).map(
|
|
1722
|
+
const r = e.search ? e.search.toLowerCase() : void 0, c = (r ? o.filter((a) => a.name.toLowerCase().includes(r)) : o).map(K);
|
|
1729
1723
|
return {
|
|
1730
1724
|
textContent: ns({ projects: c, args: e, nextCursor: n }),
|
|
1731
1725
|
structuredContent: {
|
|
@@ -1766,9 +1760,9 @@ const { ADD_SECTIONS: rs } = g, is = {
|
|
|
1766
1760
|
"Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned."
|
|
1767
1761
|
)
|
|
1768
1762
|
}, as = {
|
|
1769
|
-
sections: s.array(
|
|
1763
|
+
sections: s.array(re).describe("The found sections."),
|
|
1770
1764
|
totalCount: s.number().describe("The total number of sections found."),
|
|
1771
|
-
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1765
|
+
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
1772
1766
|
}, cs = {
|
|
1773
1767
|
name: g.FIND_SECTIONS,
|
|
1774
1768
|
description: "Search for sections by name or other criteria in a project. When searching, all sections in the project are fetched to ensure complete results.",
|
|
@@ -1812,7 +1806,7 @@ function ds({
|
|
|
1812
1806
|
zeroReasonHints: n
|
|
1813
1807
|
});
|
|
1814
1808
|
}
|
|
1815
|
-
const { FIND_COMPLETED_TASKS:
|
|
1809
|
+
const { FIND_COMPLETED_TASKS: ue, ADD_TASKS: pe } = g, ls = {
|
|
1816
1810
|
searchText: s.string().optional().describe("The text to search for in tasks."),
|
|
1817
1811
|
projectId: s.string().optional().describe(
|
|
1818
1812
|
'Find tasks in this project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
@@ -1820,20 +1814,20 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, ls = {
|
|
|
1820
1814
|
sectionId: s.string().optional().describe("Find tasks in this section."),
|
|
1821
1815
|
parentId: s.string().optional().describe("Find subtasks of this parent task."),
|
|
1822
1816
|
responsibleUser: s.string().optional().describe("Find tasks assigned to this user. Can be a user ID, name, or email address."),
|
|
1823
|
-
responsibleUserFiltering: s.enum(
|
|
1817
|
+
responsibleUserFiltering: s.enum(Ie).optional().describe(
|
|
1824
1818
|
'How to filter by responsible user when responsibleUser is not provided. "assigned" = only tasks assigned to others; "unassignedOrMe" = only unassigned tasks or tasks assigned to me; "all" = all tasks regardless of assignment. Default value will be `unassignedOrMe`.'
|
|
1825
1819
|
),
|
|
1826
1820
|
limit: s.number().int().min(1).max(S.TASKS_MAX).default(S.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
|
|
1827
1821
|
cursor: s.string().optional().describe(
|
|
1828
1822
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1829
1823
|
),
|
|
1830
|
-
...
|
|
1824
|
+
...ce
|
|
1831
1825
|
}, us = {
|
|
1832
1826
|
tasks: s.array(B).describe("The found tasks."),
|
|
1833
1827
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1834
1828
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1835
1829
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1836
|
-
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1830
|
+
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
1837
1831
|
}, ps = {
|
|
1838
1832
|
name: g.FIND_TASKS,
|
|
1839
1833
|
description: "Find tasks by text search, or by project/section/parent container/responsible user. At least one filter must be provided.",
|
|
@@ -1857,7 +1851,7 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, ls = {
|
|
|
1857
1851
|
throw new Error(
|
|
1858
1852
|
"At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, or labels"
|
|
1859
1853
|
);
|
|
1860
|
-
const y = await
|
|
1854
|
+
const y = await te(t, c), k = y?.userId, w = y?.email;
|
|
1861
1855
|
if (n || r || i) {
|
|
1862
1856
|
const f = {
|
|
1863
1857
|
limit: d,
|
|
@@ -1868,17 +1862,17 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, ls = {
|
|
|
1868
1862
|
let E = o ? x.filter(
|
|
1869
1863
|
(M) => M.content.toLowerCase().includes(o.toLowerCase()) || M.description?.toLowerCase().includes(o.toLowerCase())
|
|
1870
1864
|
) : x;
|
|
1871
|
-
return E =
|
|
1865
|
+
return E = le({
|
|
1872
1866
|
tasks: E,
|
|
1873
1867
|
resolvedAssigneeId: k,
|
|
1874
1868
|
currentUserId: b.id,
|
|
1875
1869
|
responsibleUserFiltering: a
|
|
1876
1870
|
}), u && u.length > 0 && (E = p === "and" ? E.filter(
|
|
1877
|
-
(M) => u.every((
|
|
1871
|
+
(M) => u.every((G) => M.labels.includes(G))
|
|
1878
1872
|
) : E.filter(
|
|
1879
|
-
(M) => u.some((
|
|
1873
|
+
(M) => u.some((G) => M.labels.includes(G))
|
|
1880
1874
|
)), {
|
|
1881
|
-
textContent:
|
|
1875
|
+
textContent: X({
|
|
1882
1876
|
tasks: E,
|
|
1883
1877
|
args: e,
|
|
1884
1878
|
nextCursor: $,
|
|
@@ -1902,7 +1896,7 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, ls = {
|
|
|
1902
1896
|
cursor: l ?? null
|
|
1903
1897
|
}), $ = f.map(O);
|
|
1904
1898
|
return {
|
|
1905
|
-
textContent:
|
|
1899
|
+
textContent: X({
|
|
1906
1900
|
tasks: $,
|
|
1907
1901
|
args: e,
|
|
1908
1902
|
nextCursor: j,
|
|
@@ -1920,21 +1914,21 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, ls = {
|
|
|
1920
1914
|
}
|
|
1921
1915
|
let D = "";
|
|
1922
1916
|
o && (D = `search: ${o}`);
|
|
1923
|
-
const P =
|
|
1917
|
+
const P = de(u, p);
|
|
1924
1918
|
D = H(D, P);
|
|
1925
|
-
const { tasks: h, nextCursor: T } = await
|
|
1919
|
+
const { tasks: h, nextCursor: T } = await oe({
|
|
1926
1920
|
client: t,
|
|
1927
1921
|
query: D,
|
|
1928
1922
|
cursor: e.cursor,
|
|
1929
1923
|
limit: e.limit
|
|
1930
|
-
}), C =
|
|
1924
|
+
}), C = le({
|
|
1931
1925
|
tasks: h,
|
|
1932
1926
|
resolvedAssigneeId: k,
|
|
1933
1927
|
currentUserId: b.id,
|
|
1934
1928
|
responsibleUserFiltering: a
|
|
1935
1929
|
});
|
|
1936
1930
|
return {
|
|
1937
|
-
textContent:
|
|
1931
|
+
textContent: X({
|
|
1938
1932
|
tasks: C,
|
|
1939
1933
|
args: e,
|
|
1940
1934
|
nextCursor: T,
|
|
@@ -1956,7 +1950,7 @@ function hs(e) {
|
|
|
1956
1950
|
const t = [
|
|
1957
1951
|
e.searchText ? "No tasks in project match search" : "Project has no tasks yet"
|
|
1958
1952
|
];
|
|
1959
|
-
return e.searchText || t.push(`Use ${
|
|
1953
|
+
return e.searchText || t.push(`Use ${pe} to create tasks`), t;
|
|
1960
1954
|
}
|
|
1961
1955
|
if (e.sectionId) {
|
|
1962
1956
|
const t = [e.searchText ? "No tasks in section match search" : "Section is empty"];
|
|
@@ -1964,11 +1958,11 @@ function hs(e) {
|
|
|
1964
1958
|
}
|
|
1965
1959
|
if (e.parentId) {
|
|
1966
1960
|
const t = [e.searchText ? "No subtasks match search" : "No subtasks created yet"];
|
|
1967
|
-
return e.searchText || t.push(`Use ${
|
|
1961
|
+
return e.searchText || t.push(`Use ${pe} with parentId to add subtasks`), t;
|
|
1968
1962
|
}
|
|
1969
1963
|
return [];
|
|
1970
1964
|
}
|
|
1971
|
-
function
|
|
1965
|
+
function X({
|
|
1972
1966
|
tasks: e,
|
|
1973
1967
|
args: t,
|
|
1974
1968
|
nextCursor: o,
|
|
@@ -2000,9 +1994,9 @@ function J({
|
|
|
2000
1994
|
if (e.length === 0) {
|
|
2001
1995
|
if (t.responsibleUser) {
|
|
2002
1996
|
const u = r || t.responsibleUser;
|
|
2003
|
-
a.push(`No tasks assigned to ${u}`), a.push("Check if the user name is correct"), a.push(`Check completed tasks with ${
|
|
1997
|
+
a.push(`No tasks assigned to ${u}`), a.push("Check if the user name is correct"), a.push(`Check completed tasks with ${ue}`);
|
|
2004
1998
|
}
|
|
2005
|
-
t.searchText && (a.push("Try broader search terms"), a.push("Verify spelling and try partial words"), t.responsibleUser || a.push(`Check completed tasks with ${
|
|
1999
|
+
t.searchText && (a.push("Try broader search terms"), a.push("Verify spelling and try partial words"), t.responsibleUser || a.push(`Check completed tasks with ${ue}`));
|
|
2006
2000
|
}
|
|
2007
2001
|
}
|
|
2008
2002
|
return N({
|
|
@@ -2011,7 +2005,7 @@ function J({
|
|
|
2011
2005
|
limit: t.limit,
|
|
2012
2006
|
nextCursor: o ?? void 0,
|
|
2013
2007
|
filterHints: c,
|
|
2014
|
-
previewLines:
|
|
2008
|
+
previewLines: V(e, Math.min(e.length, t.limit)),
|
|
2015
2009
|
zeroReasonHints: a
|
|
2016
2010
|
});
|
|
2017
2011
|
}
|
|
@@ -2028,16 +2022,16 @@ const ms = {
|
|
|
2028
2022
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
2029
2023
|
),
|
|
2030
2024
|
responsibleUser: s.string().optional().describe("Find tasks assigned to this user. Can be a user ID, name, or email address."),
|
|
2031
|
-
responsibleUserFiltering: s.enum(
|
|
2025
|
+
responsibleUserFiltering: s.enum(Ie).optional().describe(
|
|
2032
2026
|
'How to filter by responsible user when responsibleUser is not provided. "assigned" = only tasks assigned to others; "unassignedOrMe" = only unassigned tasks or tasks assigned to me; "all" = all tasks regardless of assignment. Default is "unassignedOrMe".'
|
|
2033
2027
|
),
|
|
2034
|
-
...
|
|
2028
|
+
...ce
|
|
2035
2029
|
}, fs = {
|
|
2036
2030
|
tasks: s.array(B).describe("The found tasks."),
|
|
2037
2031
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
2038
2032
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
2039
2033
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
2040
|
-
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
2034
|
+
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
2041
2035
|
}, bs = {
|
|
2042
2036
|
name: g.FIND_TASKS_BY_DATE,
|
|
2043
2037
|
description: "Get tasks by date range. Use startDate 'today' to get today's tasks including overdue items, or provide a specific date/date range.",
|
|
@@ -2049,17 +2043,17 @@ const ms = {
|
|
|
2049
2043
|
throw new Error(
|
|
2050
2044
|
"Either startDate must be provided or overdueOption must be set to overdue-only"
|
|
2051
2045
|
);
|
|
2052
|
-
const o = await
|
|
2046
|
+
const o = await te(t, e.responsibleUser), n = o?.userId, r = o?.email;
|
|
2053
2047
|
let i = "";
|
|
2054
2048
|
if (e.overdueOption === "overdue-only")
|
|
2055
2049
|
i = "overdue";
|
|
2056
2050
|
else if (e.startDate === "today")
|
|
2057
2051
|
i = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
|
|
2058
2052
|
else if (e.startDate) {
|
|
2059
|
-
const p = e.startDate, b =
|
|
2053
|
+
const p = e.startDate, b = ge(p, e.daysCount), m = Pe(b, { representation: "date" });
|
|
2060
2054
|
i = `(due after: ${p} | due: ${p}) & due before: ${m}`;
|
|
2061
2055
|
}
|
|
2062
|
-
const c =
|
|
2056
|
+
const c = de(e.labels, e.labelsOperator);
|
|
2063
2057
|
c.length > 0 && (i = H(i, `(${c})`));
|
|
2064
2058
|
const a = Be({
|
|
2065
2059
|
resolvedAssigneeId: n,
|
|
@@ -2067,7 +2061,7 @@ const ms = {
|
|
|
2067
2061
|
responsibleUserFiltering: e.responsibleUserFiltering
|
|
2068
2062
|
});
|
|
2069
2063
|
i = H(i, a);
|
|
2070
|
-
const { tasks: d, nextCursor: l } = await
|
|
2064
|
+
const { tasks: d, nextCursor: l } = await oe({
|
|
2071
2065
|
client: t,
|
|
2072
2066
|
query: i,
|
|
2073
2067
|
cursor: e.cursor,
|
|
@@ -2100,7 +2094,7 @@ function gs({
|
|
|
2100
2094
|
`today${a}${t.daysCount > 1 ? ` + ${t.daysCount - 1} more days` : ""}`
|
|
2101
2095
|
);
|
|
2102
2096
|
} else if (t.startDate) {
|
|
2103
|
-
const a = t.daysCount > 1 ? ` to ${ht(
|
|
2097
|
+
const a = t.daysCount > 1 ? ` to ${ht(ge(t.startDate, t.daysCount))}` : "";
|
|
2104
2098
|
r.push(`${t.startDate}${a}`);
|
|
2105
2099
|
}
|
|
2106
2100
|
if (t.labels && t.labels.length > 0) {
|
|
@@ -2131,7 +2125,7 @@ function gs({
|
|
|
2131
2125
|
limit: t.limit,
|
|
2132
2126
|
nextCursor: o ?? void 0,
|
|
2133
2127
|
filterHints: r,
|
|
2134
|
-
previewLines:
|
|
2128
|
+
previewLines: V(e, Math.min(e.length, t.limit)),
|
|
2135
2129
|
zeroReasonHints: c
|
|
2136
2130
|
});
|
|
2137
2131
|
}
|
|
@@ -2204,7 +2198,7 @@ function $e(e, t, o = "") {
|
|
|
2204
2198
|
n.push(...$e(i, t, `${o} `));
|
|
2205
2199
|
return n;
|
|
2206
2200
|
}
|
|
2207
|
-
function
|
|
2201
|
+
function he(e) {
|
|
2208
2202
|
const t = {};
|
|
2209
2203
|
for (const n of e)
|
|
2210
2204
|
t[n.id] = { ...n, children: [] };
|
|
@@ -2221,11 +2215,11 @@ function pe(e) {
|
|
|
2221
2215
|
}
|
|
2222
2216
|
return o;
|
|
2223
2217
|
}
|
|
2224
|
-
function
|
|
2218
|
+
function Q(e, t = "") {
|
|
2225
2219
|
const o = [];
|
|
2226
2220
|
for (const n of e) {
|
|
2227
2221
|
const r = `id=${n.id}`, i = n.dueDate ? `; due=${n.dueDate}` : "", c = `; content=${n.content}`;
|
|
2228
|
-
o.push(`${t}- ${r}${i}${c}`), n.children.length > 0 && o.push(...
|
|
2222
|
+
o.push(`${t}- ${r}${i}${c}`), n.children.length > 0 && o.push(...Q(n.children, `${t} `));
|
|
2229
2223
|
}
|
|
2230
2224
|
return o;
|
|
2231
2225
|
}
|
|
@@ -2302,16 +2296,16 @@ async function Cs(e, t) {
|
|
|
2302
2296
|
const a = [`# ${o.name}`];
|
|
2303
2297
|
if (c.length > 0) {
|
|
2304
2298
|
a.push("");
|
|
2305
|
-
const u =
|
|
2306
|
-
a.push(...
|
|
2299
|
+
const u = he(c);
|
|
2300
|
+
a.push(...Q(u));
|
|
2307
2301
|
}
|
|
2308
2302
|
for (const u of n) {
|
|
2309
2303
|
a.push(""), a.push(`## ${u.name}`);
|
|
2310
2304
|
const p = i[u.id];
|
|
2311
2305
|
if (!p?.length)
|
|
2312
2306
|
continue;
|
|
2313
|
-
const b =
|
|
2314
|
-
a.push(...
|
|
2307
|
+
const b = he(p);
|
|
2308
|
+
a.push(...Q(b));
|
|
2315
2309
|
}
|
|
2316
2310
|
const d = a.join(`
|
|
2317
2311
|
`), l = {
|
|
@@ -2347,7 +2341,7 @@ const Ss = {
|
|
|
2347
2341
|
structuredContent: o.structuredContent
|
|
2348
2342
|
};
|
|
2349
2343
|
}
|
|
2350
|
-
}, { FIND_TASKS: $s, FIND_PROJECT_COLLABORATORS:
|
|
2344
|
+
}, { FIND_TASKS: $s, FIND_PROJECT_COLLABORATORS: me, UPDATE_TASKS: Ds } = g, xs = 50, As = {
|
|
2351
2345
|
operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
|
|
2352
2346
|
taskIds: s.array(s.string()).min(1).max(xs).describe("The IDs of the tasks to operate on (max 50)."),
|
|
2353
2347
|
responsibleUser: s.string().optional().describe(
|
|
@@ -2487,7 +2481,7 @@ const Ss = {
|
|
|
2487
2481
|
}
|
|
2488
2482
|
};
|
|
2489
2483
|
}
|
|
2490
|
-
const b = await
|
|
2484
|
+
const b = await ae.validateBulkAssignment(
|
|
2491
2485
|
t,
|
|
2492
2486
|
p
|
|
2493
2487
|
), m = [], y = [];
|
|
@@ -2606,13 +2600,13 @@ function z({
|
|
|
2606
2600
|
return !o && n.length > 0 ? (a += `**Next steps:**
|
|
2607
2601
|
`, a += `• Use ${$s} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
|
|
2608
2602
|
`, a += `• Use ${Ds} for individual assignment changes
|
|
2609
|
-
`, r.length > 0 && (a += `• Check failed tasks and use ${
|
|
2603
|
+
`, r.length > 0 && (a += `• Check failed tasks and use ${me} to verify collaborator access
|
|
2610
2604
|
`)) : o ? (a += `**To execute:**
|
|
2611
2605
|
`, a += `• Remove dryRun parameter and run again to execute changes
|
|
2612
2606
|
`, n.length > 0 && (a += `• ${n.length} task${n.length === 1 ? "" : "s"} ready for ${e} operation
|
|
2613
2607
|
`), r.length > 0 && (a += `• Fix ${r.length} validation error${r.length === 1 ? "" : "s"} before executing
|
|
2614
2608
|
`)) : n.length === 0 && (a += `**Suggestions:**
|
|
2615
|
-
`, a += `• Use ${
|
|
2609
|
+
`, a += `• Use ${me} to find valid assignees
|
|
2616
2610
|
`, a += `• Check task IDs and assignee permissions
|
|
2617
2611
|
`, a += `• Use dryRun=true to validate before executing
|
|
2618
2612
|
`), a;
|
|
@@ -2636,13 +2630,13 @@ const Es = {
|
|
|
2636
2630
|
mutability: "readonly",
|
|
2637
2631
|
async execute(e, t) {
|
|
2638
2632
|
const { query: o } = e, [n, r] = await Promise.all([
|
|
2639
|
-
|
|
2633
|
+
oe({
|
|
2640
2634
|
client: t,
|
|
2641
2635
|
query: `search: ${o}`,
|
|
2642
2636
|
limit: S.TASKS_MAX,
|
|
2643
2637
|
cursor: void 0
|
|
2644
2638
|
}),
|
|
2645
|
-
|
|
2639
|
+
we(t)
|
|
2646
2640
|
]), i = o.toLowerCase(), c = r.filter(
|
|
2647
2641
|
(d) => d.name.toLowerCase().includes(i)
|
|
2648
2642
|
), a = [];
|
|
@@ -2650,13 +2644,13 @@ const Es = {
|
|
|
2650
2644
|
a.push({
|
|
2651
2645
|
id: `task:${d.id}`,
|
|
2652
2646
|
title: d.content,
|
|
2653
|
-
url:
|
|
2647
|
+
url: fe(d.id)
|
|
2654
2648
|
});
|
|
2655
2649
|
for (const d of c)
|
|
2656
2650
|
a.push({
|
|
2657
2651
|
id: `project:${d.id}`,
|
|
2658
2652
|
title: d.name,
|
|
2659
|
-
url:
|
|
2653
|
+
url: be(d.id)
|
|
2660
2654
|
});
|
|
2661
2655
|
return {
|
|
2662
2656
|
textContent: JSON.stringify({ results: a }),
|
|
@@ -2669,7 +2663,7 @@ const Es = {
|
|
|
2669
2663
|
}), Ms = {
|
|
2670
2664
|
comments: s.array(Ns).min(1).describe("The comments to update.")
|
|
2671
2665
|
}, Fs = {
|
|
2672
|
-
comments: s.array(
|
|
2666
|
+
comments: s.array(ie).describe("The updated comments."),
|
|
2673
2667
|
totalCount: s.number().describe("The total number of comments updated."),
|
|
2674
2668
|
updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
|
|
2675
2669
|
appliedOperations: s.object({
|
|
@@ -2682,7 +2676,7 @@ const Es = {
|
|
|
2682
2676
|
outputSchema: Fs,
|
|
2683
2677
|
mutability: "mutating",
|
|
2684
2678
|
async execute(e, t) {
|
|
2685
|
-
const { comments: o } = e, n = o.map(async (a) => await t.updateComment(a.id, { content: a.content })), i = (await Promise.all(n)).map(
|
|
2679
|
+
const { comments: o } = e, n = o.map(async (a) => await t.updateComment(a.id, { content: a.content })), i = (await Promise.all(n)).map(se);
|
|
2686
2680
|
return {
|
|
2687
2681
|
textContent: Ls({
|
|
2688
2682
|
comments: i
|
|
@@ -2718,7 +2712,7 @@ const Ws = s.object({
|
|
|
2718
2712
|
}), Bs = {
|
|
2719
2713
|
projects: s.array(Ws).min(1).describe("The projects to update.")
|
|
2720
2714
|
}, zs = {
|
|
2721
|
-
projects: s.array(
|
|
2715
|
+
projects: s.array(ne).describe("The updated projects."),
|
|
2722
2716
|
totalCount: s.number().describe("The total number of projects updated."),
|
|
2723
2717
|
updatedProjectIds: s.array(s.string()).describe("The IDs of the updated projects."),
|
|
2724
2718
|
appliedOperations: s.object({
|
|
@@ -2739,11 +2733,7 @@ const Ws = s.object({
|
|
|
2739
2733
|
return await t.updateProject(a, d);
|
|
2740
2734
|
}), r = (await Promise.all(n)).filter(
|
|
2741
2735
|
(c) => c !== void 0
|
|
2742
|
-
).map(
|
|
2743
|
-
...c,
|
|
2744
|
-
parentId: "parentId" in c ? c.parentId ?? void 0 : void 0,
|
|
2745
|
-
inboxProject: "inboxProject" in c ? c.inboxProject : !1
|
|
2746
|
-
}));
|
|
2736
|
+
).map(K);
|
|
2747
2737
|
return {
|
|
2748
2738
|
textContent: Hs({
|
|
2749
2739
|
projects: r,
|
|
@@ -2780,7 +2770,7 @@ const Vs = s.object({
|
|
|
2780
2770
|
}), Gs = {
|
|
2781
2771
|
sections: s.array(Vs).min(1).describe("The sections to update.")
|
|
2782
2772
|
}, qs = {
|
|
2783
|
-
sections: s.array(
|
|
2773
|
+
sections: s.array(re).describe("The updated sections."),
|
|
2784
2774
|
totalCount: s.number().describe("The total number of sections updated."),
|
|
2785
2775
|
updatedSectionIds: s.array(s.string()).describe("The IDs of the updated sections.")
|
|
2786
2776
|
}, Js = {
|
|
@@ -2825,7 +2815,7 @@ const Zs = s.object({
|
|
|
2825
2815
|
sectionId: s.string().optional().describe("The new section ID for the task."),
|
|
2826
2816
|
parentId: s.string().optional().describe("The new parent task ID (for subtasks)."),
|
|
2827
2817
|
order: s.number().optional().describe("The new order of the task within its parent/section."),
|
|
2828
|
-
priority:
|
|
2818
|
+
priority: ee.optional().describe(
|
|
2829
2819
|
"The new priority of the task: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)."
|
|
2830
2820
|
),
|
|
2831
2821
|
dueString: s.string().optional().describe("The new due date for the task, in natural language (e.g., 'tomorrow at 5pm')."),
|
|
@@ -2880,9 +2870,9 @@ const Zs = s.object({
|
|
|
2880
2870
|
...D,
|
|
2881
2871
|
...k !== void 0 && { labels: k }
|
|
2882
2872
|
};
|
|
2883
|
-
if (y && (h.priority =
|
|
2873
|
+
if (y && (h.priority = ye(y)), w !== void 0 && (w === null || w === "remove" ? h = { ...h, deadlineDate: null } : h = { ...h, deadlineDate: w }), b)
|
|
2884
2874
|
try {
|
|
2885
|
-
const { minutes: v } =
|
|
2875
|
+
const { minutes: v } = Te(b);
|
|
2886
2876
|
h = {
|
|
2887
2877
|
...h,
|
|
2888
2878
|
duration: v,
|
|
@@ -2895,7 +2885,7 @@ const Zs = s.object({
|
|
|
2895
2885
|
if (m === null || m === "unassign")
|
|
2896
2886
|
h = { ...h, assigneeId: null };
|
|
2897
2887
|
else {
|
|
2898
|
-
const v = await
|
|
2888
|
+
const v = await ae.validateTaskUpdateAssignment(
|
|
2899
2889
|
t,
|
|
2900
2890
|
d,
|
|
2901
2891
|
m
|