@doist/todoist-mcp 12.5.4 → 12.5.6
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 +25 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/main-http.js +2 -2
- package/dist/main.js +1 -1
- package/dist/{mcp-server-BxS0NkIc.js → mcp-server-Drv9wBc-.js} +966 -963
- package/dist/mcp-server.d.ts +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/{require-valid-todoist-token-D0hjlcRK.js → require-valid-todoist-token-CC6hWyEx.js} +1 -1
- package/dist/tool-registry.d.ts +25 -27
- package/dist/tool-registry.d.ts.map +1 -1
- package/dist/tools/find-activity.d.ts.map +1 -1
- package/dist/tools/get-overview.d.ts +4 -4
- package/dist/tools/get-overview.d.ts.map +1 -1
- package/dist/tools/get-project-activity-stats.d.ts +2 -2
- package/dist/tools/get-project-health.d.ts +17 -17
- package/dist/tools/get-project-health.d.ts.map +1 -1
- package/dist/tools/get-workspace-insights.d.ts +4 -6
- package/dist/tools/get-workspace-insights.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/eval-instructions.ts +150 -42
|
@@ -28,7 +28,7 @@ function zs() {
|
|
|
28
28
|
}
|
|
29
29
|
return console.error("Failed to load task list app HTML from any known path:", e), Bs;
|
|
30
30
|
}
|
|
31
|
-
const Ht = zs(),
|
|
31
|
+
const Ht = zs(), qs = Rt("sha256").update(Ht).digest("hex").slice(0, 12), Le = `ui://todoist/task-list@${qs}`, Ks = "ui://todoist/task-list@{hash}", Ne = "Interactive task list widget", Ys = "https://ai.todoist.net", Me = {
|
|
32
32
|
ui: {
|
|
33
33
|
prefersBorder: !0,
|
|
34
34
|
csp: {
|
|
@@ -69,7 +69,7 @@ function Gs(e) {
|
|
|
69
69
|
async () => pt(Le)
|
|
70
70
|
), e.registerResource(
|
|
71
71
|
"todoist-task-list-hash-fallback",
|
|
72
|
-
new Ds(
|
|
72
|
+
new Ds(Ks, { list: void 0 }),
|
|
73
73
|
{
|
|
74
74
|
description: `${Ne} compatibility fallback`,
|
|
75
75
|
mimeType: Lt,
|
|
@@ -131,7 +131,7 @@ function G(e) {
|
|
|
131
131
|
if (t)
|
|
132
132
|
return R(t);
|
|
133
133
|
if (Array.isArray(e)) {
|
|
134
|
-
const n = e.map((
|
|
134
|
+
const n = e.map((i) => J(i) ? w(i.message) || w(i.error) : w(i)).filter((i) => !!i);
|
|
135
135
|
return n.length > 0 ? R(n.slice(0, 2).join("; ")) : void 0;
|
|
136
136
|
}
|
|
137
137
|
if (!J(e))
|
|
@@ -146,9 +146,9 @@ function G(e) {
|
|
|
146
146
|
if (r)
|
|
147
147
|
return R(r);
|
|
148
148
|
const o = [];
|
|
149
|
-
for (const [n,
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
149
|
+
for (const [n, i] of Object.entries(e)) {
|
|
150
|
+
const a = w(i);
|
|
151
|
+
if (a && (o.push(`${n}: ${a}`), o.length >= 2))
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
return o.length > 0 ? R(o.join("; ")) : void 0;
|
|
@@ -156,8 +156,8 @@ function G(e) {
|
|
|
156
156
|
function Js(e) {
|
|
157
157
|
if (!e)
|
|
158
158
|
return [];
|
|
159
|
-
const t = /* @__PURE__ */ new Set(), r = (
|
|
160
|
-
|
|
159
|
+
const t = /* @__PURE__ */ new Set(), r = (a) => {
|
|
160
|
+
a && t.add(R(a, 120));
|
|
161
161
|
}, o = L(
|
|
162
162
|
w(e.field),
|
|
163
163
|
w(e.parameter),
|
|
@@ -172,46 +172,46 @@ function Js(e) {
|
|
|
172
172
|
e.error_extra
|
|
173
173
|
);
|
|
174
174
|
if (n) {
|
|
175
|
-
const
|
|
175
|
+
const a = L(
|
|
176
176
|
w(n.field),
|
|
177
177
|
w(n.parameter),
|
|
178
178
|
w(n.param),
|
|
179
179
|
w(n.path),
|
|
180
180
|
w(n.argument)
|
|
181
181
|
);
|
|
182
|
-
r(
|
|
182
|
+
r(a);
|
|
183
183
|
}
|
|
184
|
-
const
|
|
185
|
-
if (Array.isArray(
|
|
186
|
-
for (const
|
|
187
|
-
if (!J(
|
|
188
|
-
r(w(
|
|
184
|
+
const i = e.errors;
|
|
185
|
+
if (Array.isArray(i))
|
|
186
|
+
for (const a of i) {
|
|
187
|
+
if (!J(a)) {
|
|
188
|
+
r(w(a));
|
|
189
189
|
continue;
|
|
190
190
|
}
|
|
191
191
|
const c = L(
|
|
192
|
-
w(
|
|
193
|
-
w(
|
|
194
|
-
w(
|
|
195
|
-
w(
|
|
196
|
-
w(
|
|
192
|
+
w(a.field),
|
|
193
|
+
w(a.parameter),
|
|
194
|
+
w(a.param),
|
|
195
|
+
w(a.path),
|
|
196
|
+
w(a.name)
|
|
197
197
|
), d = L(
|
|
198
|
-
w(
|
|
199
|
-
w(
|
|
200
|
-
w(
|
|
201
|
-
w(
|
|
198
|
+
w(a.message),
|
|
199
|
+
w(a.error),
|
|
200
|
+
w(a.detail),
|
|
201
|
+
w(a.description)
|
|
202
202
|
);
|
|
203
203
|
r(c && d ? `${c}: ${d}` : c || d);
|
|
204
204
|
}
|
|
205
|
-
else if (J(
|
|
206
|
-
for (const [
|
|
205
|
+
else if (J(i))
|
|
206
|
+
for (const [a, c] of Object.entries(i)) {
|
|
207
207
|
const d = w(c);
|
|
208
208
|
if (d) {
|
|
209
|
-
r(`${
|
|
209
|
+
r(`${a}: ${d}`);
|
|
210
210
|
continue;
|
|
211
211
|
}
|
|
212
212
|
if (Array.isArray(c)) {
|
|
213
213
|
const l = c.map((u) => w(u)).filter((u) => !!u).join(", ");
|
|
214
|
-
r(l ? `${
|
|
214
|
+
r(l ? `${a}: ${l}` : a);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
return Array.from(t).slice(0, 3);
|
|
@@ -267,7 +267,7 @@ function Ve(e) {
|
|
|
267
267
|
t?.data,
|
|
268
268
|
r?.responseData,
|
|
269
269
|
r?.data
|
|
270
|
-
),
|
|
270
|
+
), i = L(
|
|
271
271
|
E(t?.httpStatusCode),
|
|
272
272
|
E(t?.statusCode),
|
|
273
273
|
E(t?.status),
|
|
@@ -280,7 +280,7 @@ function Ve(e) {
|
|
|
280
280
|
xe(w(t?.message)),
|
|
281
281
|
xe(w(r?.message)),
|
|
282
282
|
xe(typeof e == "string" ? e : void 0)
|
|
283
|
-
),
|
|
283
|
+
), a = L(
|
|
284
284
|
re(n?.errorCode),
|
|
285
285
|
re(n?.error_code),
|
|
286
286
|
re(n?.code),
|
|
@@ -309,9 +309,9 @@ function Ve(e) {
|
|
|
309
309
|
G(n?.errors),
|
|
310
310
|
G(t?.details)
|
|
311
311
|
), p = Js(n);
|
|
312
|
-
return
|
|
313
|
-
statusCode:
|
|
314
|
-
code:
|
|
312
|
+
return i !== void 0 || Zs(n) || c !== void 0 || a !== void 0 || (l ? He(l) : !1) ? {
|
|
313
|
+
statusCode: i,
|
|
314
|
+
code: a,
|
|
315
315
|
tag: c ? R(c, 80) : void 0,
|
|
316
316
|
message: l ? R(l) : void 0,
|
|
317
317
|
details: u ? R(u) : void 0,
|
|
@@ -359,8 +359,8 @@ function rr(e, {
|
|
|
359
359
|
}) {
|
|
360
360
|
if (!r)
|
|
361
361
|
return;
|
|
362
|
-
const n = Ve(e),
|
|
363
|
-
if (!
|
|
362
|
+
const n = Ve(e), a = n?.tag?.toUpperCase() === "INVALID_DUE_STRING", c = !o && /^invalid date format\.?$/i.test(n?.message ?? "");
|
|
363
|
+
if (!a && !c)
|
|
364
364
|
return;
|
|
365
365
|
const d = r.trim().replace(/^recurring(?:\s+|$)/i, "").trim();
|
|
366
366
|
return d !== r.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 !== r.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. Change only \`dueString\` and retry.`;
|
|
@@ -371,7 +371,7 @@ function or(e) {
|
|
|
371
371
|
const t = Ve(e);
|
|
372
372
|
return t ? sr(t) : Bt(e);
|
|
373
373
|
}
|
|
374
|
-
const nr = "12.5.
|
|
374
|
+
const nr = "12.5.6", ir = {
|
|
375
375
|
version: nr
|
|
376
376
|
}, C = {
|
|
377
377
|
/** Default limit for task listings */
|
|
@@ -407,7 +407,7 @@ const nr = "12.5.4", ar = {
|
|
|
407
407
|
}, fe = {
|
|
408
408
|
/** Maximum number of failures to show in detailed error messages */
|
|
409
409
|
MAX_FAILURES_SHOWN: 3
|
|
410
|
-
},
|
|
410
|
+
}, qt = {
|
|
411
411
|
/** Maximum tasks accepted by one task create or update operation */
|
|
412
412
|
TASKS_PER_OPERATION: 25
|
|
413
413
|
}, Be = {
|
|
@@ -446,8 +446,8 @@ function mt(e, { queueTimeoutMs: t = Be.QUEUE_WAIT_MS } = {}) {
|
|
|
446
446
|
o++;
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
449
|
-
await new Promise((
|
|
450
|
-
const d = { admit:
|
|
449
|
+
await new Promise((a, c) => {
|
|
450
|
+
const d = { admit: a, abandon: c };
|
|
451
451
|
r.push(d), !(t <= 0) && (d.timer = setTimeout(() => {
|
|
452
452
|
const l = r.indexOf(d);
|
|
453
453
|
l !== -1 && r.splice(l, 1), d.abandon(
|
|
@@ -458,10 +458,10 @@ function mt(e, { queueTimeoutMs: t = Be.QUEUE_WAIT_MS } = {}) {
|
|
|
458
458
|
}, t), d.timer.unref?.());
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
|
-
function
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
clearTimeout(
|
|
461
|
+
function i() {
|
|
462
|
+
const a = r.shift();
|
|
463
|
+
if (a) {
|
|
464
|
+
clearTimeout(a.timer), a.admit();
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
467
|
o--;
|
|
@@ -471,11 +471,11 @@ function mt(e, { queueTimeoutMs: t = Be.QUEUE_WAIT_MS } = {}) {
|
|
|
471
471
|
try {
|
|
472
472
|
return await c();
|
|
473
473
|
} finally {
|
|
474
|
-
|
|
474
|
+
i();
|
|
475
475
|
}
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Kt() {
|
|
479
479
|
return {
|
|
480
480
|
moves: mt(Be.TASK_MOVES),
|
|
481
481
|
writes: mt(Be.WRITES)
|
|
@@ -483,8 +483,8 @@ function qt() {
|
|
|
483
483
|
}
|
|
484
484
|
const ht = /* @__PURE__ */ new Map(), Yt = /* @__PURE__ */ new WeakMap();
|
|
485
485
|
let ft;
|
|
486
|
-
function
|
|
487
|
-
return ft ??=
|
|
486
|
+
function ar() {
|
|
487
|
+
return ft ??= Kt(), ft;
|
|
488
488
|
}
|
|
489
489
|
function cr(e) {
|
|
490
490
|
return Rt("sha256").update(e).digest("hex");
|
|
@@ -492,10 +492,10 @@ function cr(e) {
|
|
|
492
492
|
function dr(e, t) {
|
|
493
493
|
const r = cr(t);
|
|
494
494
|
let o = ht.get(r);
|
|
495
|
-
o || (o =
|
|
495
|
+
o || (o = Kt(), ht.set(r, o)), Yt.set(e, o);
|
|
496
496
|
}
|
|
497
497
|
function Gt(e) {
|
|
498
|
-
return Yt.get(e) ??
|
|
498
|
+
return Yt.get(e) ?? ar();
|
|
499
499
|
}
|
|
500
500
|
function lr(e) {
|
|
501
501
|
return Gt(e).moves;
|
|
@@ -503,7 +503,7 @@ function lr(e) {
|
|
|
503
503
|
function ur(e) {
|
|
504
504
|
return Gt(e).writes;
|
|
505
505
|
}
|
|
506
|
-
const pr = "todoist-mcp", Je =
|
|
506
|
+
const pr = "todoist-mcp", Je = ir.version, Vt = new Rs(), bt = Us(import.meta.url);
|
|
507
507
|
let Te;
|
|
508
508
|
const mr = async () => {
|
|
509
509
|
const e = bt.resolve("@doist/todoist-sdk"), t = _e(Ut(e), "transport", "http-dispatcher.js");
|
|
@@ -551,9 +551,9 @@ function Tr(e, t) {
|
|
|
551
551
|
}
|
|
552
552
|
};
|
|
553
553
|
if (!e && t !== void 0) {
|
|
554
|
-
const
|
|
554
|
+
const a = new AbortController(), c = setTimeout(() => a.abort(gt()), t);
|
|
555
555
|
return {
|
|
556
|
-
signal:
|
|
556
|
+
signal: a.signal,
|
|
557
557
|
cleanup: () => clearTimeout(c)
|
|
558
558
|
};
|
|
559
559
|
}
|
|
@@ -563,21 +563,21 @@ function Tr(e, t) {
|
|
|
563
563
|
cleanup: () => {
|
|
564
564
|
}
|
|
565
565
|
};
|
|
566
|
-
const r = new AbortController(), o = [], n = (
|
|
567
|
-
r.signal.aborted || r.abort(
|
|
566
|
+
const r = new AbortController(), o = [], n = (a) => {
|
|
567
|
+
r.signal.aborted || r.abort(a);
|
|
568
568
|
};
|
|
569
569
|
if (e?.aborted)
|
|
570
570
|
n(e.reason);
|
|
571
571
|
else if (e) {
|
|
572
|
-
const
|
|
573
|
-
e.addEventListener("abort",
|
|
572
|
+
const a = () => n(e.reason);
|
|
573
|
+
e.addEventListener("abort", a, { once: !0 }), o.push(() => e.removeEventListener("abort", a));
|
|
574
574
|
}
|
|
575
|
-
const
|
|
576
|
-
return o.push(() => clearTimeout(
|
|
575
|
+
const i = setTimeout(() => n(gt()), t);
|
|
576
|
+
return o.push(() => clearTimeout(i)), {
|
|
577
577
|
signal: r.signal,
|
|
578
578
|
cleanup: () => {
|
|
579
|
-
for (const
|
|
580
|
-
|
|
579
|
+
for (const a of o)
|
|
580
|
+
a();
|
|
581
581
|
}
|
|
582
582
|
};
|
|
583
583
|
}
|
|
@@ -606,17 +606,17 @@ function Ir(e) {
|
|
|
606
606
|
};
|
|
607
607
|
}
|
|
608
608
|
function Sr(e = globalThis.fetch, t = {}) {
|
|
609
|
-
const r = e === globalThis.fetch, { enabled: o = !0, platform: n = "mcp", sessionId:
|
|
610
|
-
return async (
|
|
609
|
+
const r = e === globalThis.fetch, { enabled: o = !0, platform: n = "mcp", sessionId: i = Pe() } = t;
|
|
610
|
+
return async (a, c = {}) => {
|
|
611
611
|
const { timeout: d, headers: l, signal: u, ...p } = c, { signal: m, cleanup: h } = Tr(u, d);
|
|
612
612
|
try {
|
|
613
613
|
const y = {
|
|
614
614
|
...p,
|
|
615
615
|
signal: m,
|
|
616
|
-
...o ? { headers: yr(l, { platform: n, sessionId:
|
|
616
|
+
...o ? { headers: yr(l, { platform: n, sessionId: i }) } : l !== void 0 ? { headers: l } : {}
|
|
617
617
|
};
|
|
618
618
|
r && await vr(y);
|
|
619
|
-
const f = await e(
|
|
619
|
+
const f = await e(a, y);
|
|
620
620
|
return Ir(f);
|
|
621
621
|
} finally {
|
|
622
622
|
h();
|
|
@@ -660,27 +660,27 @@ function Pr({
|
|
|
660
660
|
maxDelayMs: r,
|
|
661
661
|
random: o = Math.random
|
|
662
662
|
}) {
|
|
663
|
-
const n = Math.min(t * 2 ** e, r),
|
|
664
|
-
return Math.min(n, Math.max(xr,
|
|
663
|
+
const n = Math.min(t * 2 ** e, r), i = Math.round(o() * n);
|
|
664
|
+
return Math.min(n, Math.max(xr, i));
|
|
665
665
|
}
|
|
666
666
|
function _r(e) {
|
|
667
667
|
return new Promise((t) => setTimeout(t, e));
|
|
668
668
|
}
|
|
669
669
|
async function O(e, t = {}) {
|
|
670
|
-
const r = t.maxRetries ?? Cr, o = t.baseDelayMs ?? $r, n = t.maxDelayMs ?? Dr,
|
|
671
|
-
let
|
|
670
|
+
const r = t.maxRetries ?? Cr, o = t.baseDelayMs ?? $r, n = t.maxDelayMs ?? Dr, i = t.random;
|
|
671
|
+
let a;
|
|
672
672
|
for (let c = 0; c <= r; c++)
|
|
673
673
|
try {
|
|
674
674
|
return await e();
|
|
675
675
|
} catch (d) {
|
|
676
|
-
if (
|
|
677
|
-
const l = Pr({ attempt: c, baseDelayMs: o, maxDelayMs: n, random:
|
|
676
|
+
if (a = d, c < r && Or(d)) {
|
|
677
|
+
const l = Pr({ attempt: c, baseDelayMs: o, maxDelayMs: n, random: i });
|
|
678
678
|
await _r(l);
|
|
679
679
|
continue;
|
|
680
680
|
}
|
|
681
681
|
throw d;
|
|
682
682
|
}
|
|
683
|
-
throw
|
|
683
|
+
throw a;
|
|
684
684
|
}
|
|
685
685
|
function ze(e) {
|
|
686
686
|
if (e == null)
|
|
@@ -775,11 +775,11 @@ function Ur({
|
|
|
775
775
|
structuredContent: t,
|
|
776
776
|
contentItems: r
|
|
777
777
|
}) {
|
|
778
|
-
const o = ze(t), n = {},
|
|
779
|
-
return r &&
|
|
778
|
+
const o = ze(t), n = {}, i = [];
|
|
779
|
+
return r && i.push(...r), !Rr && t && i.push({
|
|
780
780
|
type: "text",
|
|
781
781
|
text: JSON.stringify(o)
|
|
782
|
-
}), e &&
|
|
782
|
+
}), e && i.push({ type: "text", text: e }), i.length > 0 && (n.content = i), t && (n.structuredContent = o), n;
|
|
783
783
|
}
|
|
784
784
|
function Lr(e) {
|
|
785
785
|
return {
|
|
@@ -811,15 +811,15 @@ const Br = [
|
|
|
811
811
|
g.FIND_PROJECT_COLLABORATORS,
|
|
812
812
|
g.FIND_COMPLETED_TASKS
|
|
813
813
|
];
|
|
814
|
-
function
|
|
814
|
+
function qe(e) {
|
|
815
815
|
if (e == null)
|
|
816
816
|
return e;
|
|
817
817
|
if (Array.isArray(e))
|
|
818
|
-
return e.map((t) =>
|
|
818
|
+
return e.map((t) => qe(t));
|
|
819
819
|
if (typeof e == "object") {
|
|
820
820
|
const t = {};
|
|
821
821
|
for (const [r, o] of Object.entries(e))
|
|
822
|
-
r !== "email" && (t[r] =
|
|
822
|
+
r !== "email" && (t[r] = qe(o));
|
|
823
823
|
return t;
|
|
824
824
|
}
|
|
825
825
|
return e;
|
|
@@ -828,19 +828,19 @@ function zr(e) {
|
|
|
828
828
|
const t = /\s*\([^)]*@[^)]+\)/g, r = /\S+@\S+\.\S+/g;
|
|
829
829
|
return e.replace(t, "").replace(r, "[email hidden]");
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function qr({
|
|
832
832
|
tool: e,
|
|
833
833
|
server: t,
|
|
834
834
|
client: r,
|
|
835
835
|
features: o = []
|
|
836
836
|
}) {
|
|
837
|
-
const n = o.some((d) => d.name === "strip_emails") && Br.includes(e.name),
|
|
837
|
+
const n = o.some((d) => d.name === "strip_emails") && Br.includes(e.name), i = e.execute, a = async (d, l) => {
|
|
838
838
|
try {
|
|
839
839
|
let { textContent: u, structuredContent: p, contentItems: m } = await br(
|
|
840
840
|
e.name,
|
|
841
|
-
() => O(() =>
|
|
841
|
+
() => O(() => i(d, r))
|
|
842
842
|
);
|
|
843
|
-
return n && (u && (u = zr(u)), p && (p =
|
|
843
|
+
return n && (u && (u = zr(u)), p && (p = qe(p))), Ur({ textContent: u, structuredContent: p, contentItems: m });
|
|
844
844
|
} catch (u) {
|
|
845
845
|
return console.error(`Error executing tool ${e.name}:`, { args: Mr(d), error: u }), Lr(or(u));
|
|
846
846
|
}
|
|
@@ -859,13 +859,13 @@ function Kr({
|
|
|
859
859
|
...c,
|
|
860
860
|
_meta: e._meta
|
|
861
861
|
},
|
|
862
|
-
|
|
862
|
+
a
|
|
863
863
|
);
|
|
864
864
|
return;
|
|
865
865
|
}
|
|
866
|
-
t.registerTool(e.name, c,
|
|
866
|
+
t.registerTool(e.name, c, a);
|
|
867
867
|
}
|
|
868
|
-
const
|
|
868
|
+
const Kr = {
|
|
869
869
|
period: s.enum(["today", "7d", "14d", "30d", "this-week", "this-month"]).default("7d").describe(
|
|
870
870
|
'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.'
|
|
871
871
|
),
|
|
@@ -904,9 +904,9 @@ function Yr(e, t = /* @__PURE__ */ new Date()) {
|
|
|
904
904
|
};
|
|
905
905
|
}
|
|
906
906
|
case "this-week": {
|
|
907
|
-
const n = t.getUTCDay(),
|
|
908
|
-
return
|
|
909
|
-
since: r(
|
|
907
|
+
const n = t.getUTCDay(), i = new Date(t);
|
|
908
|
+
return i.setDate(t.getDate() - (n + 6) % 7), {
|
|
909
|
+
since: r(i),
|
|
910
910
|
until: o,
|
|
911
911
|
periodDescription: "this week (Monday to today)"
|
|
912
912
|
};
|
|
@@ -1001,7 +1001,7 @@ const he = {
|
|
|
1001
1001
|
name: "productivity-analysis",
|
|
1002
1002
|
title: "Productivity Analysis",
|
|
1003
1003
|
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.",
|
|
1004
|
-
argsSchema:
|
|
1004
|
+
argsSchema: Kr,
|
|
1005
1005
|
callback: Jr
|
|
1006
1006
|
};
|
|
1007
1007
|
class _ extends Error {
|
|
@@ -1019,23 +1019,23 @@ function Xt(e) {
|
|
|
1019
1019
|
if (!r || !r[1] && !r[2])
|
|
1020
1020
|
throw new _(e, 'Use format like "2h", "30m", "2h30m", or "1.5h"');
|
|
1021
1021
|
let o = 0;
|
|
1022
|
-
const [, n,
|
|
1022
|
+
const [, n, i] = r;
|
|
1023
1023
|
if (n) {
|
|
1024
|
-
const
|
|
1025
|
-
if (Number.isNaN(
|
|
1024
|
+
const a = Number.parseFloat(n);
|
|
1025
|
+
if (Number.isNaN(a) || a < 0)
|
|
1026
1026
|
throw new _(e, "Hours must be a positive number");
|
|
1027
|
-
o +=
|
|
1027
|
+
o += a * 60;
|
|
1028
1028
|
}
|
|
1029
|
-
if (
|
|
1030
|
-
const
|
|
1031
|
-
if (Number.isNaN(
|
|
1029
|
+
if (i) {
|
|
1030
|
+
const a = Number.parseFloat(i);
|
|
1031
|
+
if (Number.isNaN(a) || a < 0)
|
|
1032
1032
|
throw new _(e, "Minutes must be a positive number");
|
|
1033
|
-
if (
|
|
1033
|
+
if (a % 1 !== 0)
|
|
1034
1034
|
throw new _(
|
|
1035
1035
|
e,
|
|
1036
1036
|
"Minutes must be a whole number (use decimal hours instead)"
|
|
1037
1037
|
);
|
|
1038
|
-
o +=
|
|
1038
|
+
o += a;
|
|
1039
1039
|
}
|
|
1040
1040
|
if (o = Math.round(o), o === 0)
|
|
1041
1041
|
throw new _(e, "Duration must be greater than 0 minutes");
|
|
@@ -1118,9 +1118,9 @@ class ro {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
if (/^[0-9]+$/.test(o) || /^[a-f0-9-]{8,}$/i.test(o) && o.includes("-") || /^[a-z0-9_]{6,}$/i.test(o) && !/^[a-z]+[\s-]/.test(o) && /[0-9_]/.test(o))
|
|
1120
1120
|
return { userId: o, displayName: o, email: o };
|
|
1121
|
-
const n = await this.getCacheScope(t),
|
|
1122
|
-
if (
|
|
1123
|
-
const c = (d) => (
|
|
1121
|
+
const n = await this.getCacheScope(t), i = this.getCacheKey(n, `user_${o}`), a = i ? Ae.get(i) : void 0;
|
|
1122
|
+
if (a !== void 0) return a;
|
|
1123
|
+
const c = (d) => (i && Ae.set(i, d), d);
|
|
1124
1124
|
try {
|
|
1125
1125
|
let d = await this.getAllCollaborators(t, n);
|
|
1126
1126
|
try {
|
|
@@ -1169,7 +1169,7 @@ class ro {
|
|
|
1169
1169
|
*/
|
|
1170
1170
|
async validateProjectCollaborator(t, r, o) {
|
|
1171
1171
|
try {
|
|
1172
|
-
return (await this.getProjectCollaborators(t, r)).some((
|
|
1172
|
+
return (await this.getProjectCollaborators(t, r)).some((i) => i.id === o);
|
|
1173
1173
|
} catch {
|
|
1174
1174
|
return !1;
|
|
1175
1175
|
}
|
|
@@ -1178,11 +1178,11 @@ class ro {
|
|
|
1178
1178
|
* Get collaborators for a specific project
|
|
1179
1179
|
*/
|
|
1180
1180
|
async getProjectCollaborators(t, r, o) {
|
|
1181
|
-
const n = o === void 0 ? await this.getCacheScope(t) : o,
|
|
1182
|
-
if (
|
|
1181
|
+
const n = o === void 0 ? await this.getCacheScope(t) : o, i = this.getCacheKey(n, `project_${r}`), a = i ? oe.get(i) : void 0;
|
|
1182
|
+
if (a !== void 0) return a;
|
|
1183
1183
|
try {
|
|
1184
1184
|
const c = await t.getProjectCollaborators(r), l = (Array.isArray(c) ? c : c.results || []).filter((u) => u?.id && u.name && u.email);
|
|
1185
|
-
return
|
|
1185
|
+
return i && oe.set(i, l), l;
|
|
1186
1186
|
} catch {
|
|
1187
1187
|
return [];
|
|
1188
1188
|
}
|
|
@@ -1191,8 +1191,8 @@ class ro {
|
|
|
1191
1191
|
* Get all collaborators from all shared projects, deduplicated by user ID.
|
|
1192
1192
|
*/
|
|
1193
1193
|
async getAllCollaborators(t, r) {
|
|
1194
|
-
const o = r === void 0 ? await this.getCacheScope(t) : r, n = this.getCacheKey(o, "all_collaborators"),
|
|
1195
|
-
if (
|
|
1194
|
+
const o = r === void 0 ? await this.getCacheScope(t) : r, n = this.getCacheKey(o, "all_collaborators"), i = n ? oe.get(n) : void 0;
|
|
1195
|
+
if (i !== void 0) return i;
|
|
1196
1196
|
try {
|
|
1197
1197
|
const c = (await M({
|
|
1198
1198
|
apiMethod: t.getProjects.bind(t),
|
|
@@ -1278,15 +1278,15 @@ async function de(e) {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
async function M(e) {
|
|
1280
1280
|
const { apiMethod: t, args: r, limit: o = 100 } = e, n = [];
|
|
1281
|
-
let
|
|
1281
|
+
let i = null;
|
|
1282
1282
|
do {
|
|
1283
|
-
const
|
|
1283
|
+
const a = await t({
|
|
1284
1284
|
...r,
|
|
1285
|
-
cursor:
|
|
1285
|
+
cursor: i,
|
|
1286
1286
|
limit: o
|
|
1287
1287
|
});
|
|
1288
|
-
n.push(...
|
|
1289
|
-
} while (
|
|
1288
|
+
n.push(...a.results), i = a.nextCursor ?? null;
|
|
1289
|
+
} while (i !== null);
|
|
1290
1290
|
return n;
|
|
1291
1291
|
}
|
|
1292
1292
|
function et(e) {
|
|
@@ -1306,19 +1306,19 @@ async function os(e) {
|
|
|
1306
1306
|
limit: C.PROJECTS_MAX
|
|
1307
1307
|
});
|
|
1308
1308
|
}
|
|
1309
|
-
async function
|
|
1309
|
+
async function io(e) {
|
|
1310
1310
|
return M({
|
|
1311
1311
|
apiMethod: e.getArchivedProjects.bind(e),
|
|
1312
1312
|
args: {},
|
|
1313
1313
|
limit: C.PROJECTS_MAX
|
|
1314
1314
|
});
|
|
1315
1315
|
}
|
|
1316
|
-
function
|
|
1317
|
-
const t = (
|
|
1316
|
+
function ao(e) {
|
|
1317
|
+
const t = (i) => i.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = /(?<!\\)(?:\\\\)*\*/.test(e), o = [...e];
|
|
1318
1318
|
let n = "";
|
|
1319
|
-
for (let
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1319
|
+
for (let i = 0; i < o.length; i++) {
|
|
1320
|
+
const a = o[i];
|
|
1321
|
+
a === "\\" && o[i + 1] === "\\" ? (n += "\\\\", i++) : a === "\\" && o[i + 1] === "*" ? (n += "\\*", i++) : a === "*" ? n += ".*" : n += t(a);
|
|
1322
1322
|
}
|
|
1323
1323
|
return new RegExp(r ? `^${n}$` : n, "iu");
|
|
1324
1324
|
}
|
|
@@ -1434,15 +1434,15 @@ async function tt({
|
|
|
1434
1434
|
cursor: o
|
|
1435
1435
|
}) {
|
|
1436
1436
|
try {
|
|
1437
|
-
const { results: n, nextCursor:
|
|
1438
|
-
return { tasks: n.map(P), nextCursor:
|
|
1437
|
+
const { results: n, nextCursor: i } = await e.getTasksByFilter({ query: t, cursor: o, limit: r });
|
|
1438
|
+
return { tasks: n.map(P), nextCursor: i };
|
|
1439
1439
|
} catch (n) {
|
|
1440
|
-
const
|
|
1441
|
-
if (!
|
|
1440
|
+
const i = mo.safeParse(n);
|
|
1441
|
+
if (!i.success)
|
|
1442
1442
|
throw n;
|
|
1443
|
-
const { responseData:
|
|
1444
|
-
throw
|
|
1445
|
-
`${
|
|
1443
|
+
const { responseData: a } = i.data;
|
|
1444
|
+
throw a.errorTag === "INVALID_SEARCH_QUERY" ? new Error(`Invalid filter query: ${t}`) : new Error(
|
|
1445
|
+
`${a.error} (tag: ${a.errorTag}, code: ${a.errorCode})`
|
|
1446
1446
|
);
|
|
1447
1447
|
}
|
|
1448
1448
|
}
|
|
@@ -1539,7 +1539,7 @@ const ue = s.enum(Ie).optional().catch(void 0), F = s.object({
|
|
|
1539
1539
|
sectionOrder: s.number().describe("Ordering index within the project."),
|
|
1540
1540
|
description: s.string().optional().describe("Supports Markdown.")
|
|
1541
1541
|
});
|
|
1542
|
-
function
|
|
1542
|
+
function q({ id: e, name: t, sectionOrder: r, description: o }) {
|
|
1543
1543
|
return { id: e, name: t, sectionOrder: r, description: o ?? void 0 };
|
|
1544
1544
|
}
|
|
1545
1545
|
const bo = s.object({
|
|
@@ -1635,7 +1635,7 @@ const bo = s.object({
|
|
|
1635
1635
|
`Comment ${l + 1}: Cannot provide both taskId and projectId. Choose one.`
|
|
1636
1636
|
);
|
|
1637
1637
|
}
|
|
1638
|
-
const n = r.some((l) => N(l.projectId)) ? await t.getUser() : void 0,
|
|
1638
|
+
const n = r.some((l) => N(l.projectId)) ? await t.getUser() : void 0, i = r.map(async ({ content: l, taskId: u, projectId: p }) => {
|
|
1639
1639
|
const m = await de({
|
|
1640
1640
|
projectId: p,
|
|
1641
1641
|
user: n,
|
|
@@ -1645,7 +1645,7 @@ const bo = s.object({
|
|
|
1645
1645
|
content: l,
|
|
1646
1646
|
...u ? { taskId: u } : { projectId: m }
|
|
1647
1647
|
});
|
|
1648
|
-
}), c = (await Promise.all(
|
|
1648
|
+
}), c = (await Promise.all(i)).map(ge);
|
|
1649
1649
|
return {
|
|
1650
1650
|
textContent: So({ comments: c }),
|
|
1651
1651
|
structuredContent: {
|
|
@@ -1657,14 +1657,14 @@ const bo = s.object({
|
|
|
1657
1657
|
}
|
|
1658
1658
|
};
|
|
1659
1659
|
function So({ comments: e }) {
|
|
1660
|
-
const t = e.filter((
|
|
1660
|
+
const t = e.filter((i) => i.taskId).length, r = e.filter((i) => i.projectId).length, o = [];
|
|
1661
1661
|
if (t > 0) {
|
|
1662
|
-
const
|
|
1663
|
-
o.push(`${t} task ${
|
|
1662
|
+
const i = t > 1 ? "comments" : "comment";
|
|
1663
|
+
o.push(`${t} task ${i}`);
|
|
1664
1664
|
}
|
|
1665
1665
|
if (r > 0) {
|
|
1666
|
-
const
|
|
1667
|
-
o.push(`${r} project ${
|
|
1666
|
+
const i = r > 1 ? "comments" : "comment";
|
|
1667
|
+
o.push(`${r} project ${i}`);
|
|
1668
1668
|
}
|
|
1669
1669
|
return o.length > 0 ? `Added ${o.join(" and ")}` : "No comments added";
|
|
1670
1670
|
}
|
|
@@ -1689,19 +1689,19 @@ const jo = {
|
|
|
1689
1689
|
outputSchema: Co,
|
|
1690
1690
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
1691
1691
|
async execute(e, t) {
|
|
1692
|
-
let o = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((
|
|
1692
|
+
let o = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((a) => !a.isDeleted);
|
|
1693
1693
|
if (e.search) {
|
|
1694
|
-
const
|
|
1695
|
-
o = o.filter((c) => c.name.toLowerCase().includes(
|
|
1694
|
+
const a = e.search.toLowerCase();
|
|
1695
|
+
o = o.filter((c) => c.name.toLowerCase().includes(a));
|
|
1696
1696
|
}
|
|
1697
|
-
o.sort((
|
|
1698
|
-
const n = o.map((
|
|
1699
|
-
id:
|
|
1700
|
-
name:
|
|
1701
|
-
query:
|
|
1702
|
-
color: ue.parse(
|
|
1703
|
-
isFavorite:
|
|
1704
|
-
itemOrder:
|
|
1697
|
+
o.sort((a, c) => a.itemOrder - c.itemOrder);
|
|
1698
|
+
const n = o.map((a) => ({
|
|
1699
|
+
id: a.id,
|
|
1700
|
+
name: a.name,
|
|
1701
|
+
query: a.query,
|
|
1702
|
+
color: ue.parse(a.color),
|
|
1703
|
+
isFavorite: a.isFavorite,
|
|
1704
|
+
itemOrder: a.itemOrder
|
|
1705
1705
|
}));
|
|
1706
1706
|
return {
|
|
1707
1707
|
textContent: Do({ filters: n, search: e.search }),
|
|
@@ -1722,13 +1722,13 @@ function Do({
|
|
|
1722
1722
|
return `${r}: 0 found
|
|
1723
1723
|
|
|
1724
1724
|
Suggestions:
|
|
1725
|
-
${n.map((
|
|
1725
|
+
${n.map((i) => `- ${i}`).join(`
|
|
1726
1726
|
`)}`;
|
|
1727
1727
|
}
|
|
1728
1728
|
const o = [`${r}: ${e.length} found`, ""];
|
|
1729
1729
|
for (const n of e) {
|
|
1730
|
-
const
|
|
1731
|
-
o.push(`• ${n.name}${
|
|
1730
|
+
const i = n.isFavorite ? " ★" : "";
|
|
1731
|
+
o.push(`• ${n.name}${i} (id=${n.id})`), o.push(` Query: ${n.query}`);
|
|
1732
1732
|
}
|
|
1733
1733
|
return o.join(`
|
|
1734
1734
|
`);
|
|
@@ -1761,8 +1761,8 @@ const xo = s.object({
|
|
|
1761
1761
|
...p.isFavorite !== void 0 ? { isFavorite: p.isFavorite } : {}
|
|
1762
1762
|
},
|
|
1763
1763
|
o[m]
|
|
1764
|
-
)),
|
|
1765
|
-
const h = o[m], y = h !== void 0 ?
|
|
1764
|
+
)), a = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
|
|
1765
|
+
const h = o[m], y = h !== void 0 ? a[h] : void 0;
|
|
1766
1766
|
if (!y) return null;
|
|
1767
1767
|
const f = p.color !== void 0 ? ue.parse(p.color) : void 0;
|
|
1768
1768
|
return {
|
|
@@ -1817,32 +1817,32 @@ function Lo({ labels: e }) {
|
|
|
1817
1817
|
return `Added ${t} label${t === 1 ? "" : "s"}:
|
|
1818
1818
|
${r}`;
|
|
1819
1819
|
}
|
|
1820
|
-
function
|
|
1820
|
+
function ae(e = /* @__PURE__ */ new Date()) {
|
|
1821
1821
|
const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0");
|
|
1822
1822
|
return `${t}-${r}-${o}`;
|
|
1823
1823
|
}
|
|
1824
1824
|
function ot(e, t, r = {}) {
|
|
1825
|
-
const { context: o, showDetails: n = !1 } = r,
|
|
1826
|
-
|
|
1825
|
+
const { context: o, showDetails: n = !1 } = r, i = t.length, a = [], d = `${e} ${i} ${i === 1 ? "task" : "tasks"}${o ? ` ${o}` : ""}.`;
|
|
1826
|
+
a.push(d);
|
|
1827
1827
|
const l = 5;
|
|
1828
|
-
if (n ||
|
|
1828
|
+
if (n || i <= l) {
|
|
1829
1829
|
const u = Se(t, l);
|
|
1830
1830
|
if (u.length > 0) {
|
|
1831
|
-
const p =
|
|
1832
|
-
|
|
1831
|
+
const p = i > l ? `, +${i - l} more` : "";
|
|
1832
|
+
a.push(`Tasks:
|
|
1833
1833
|
${u}${p}.`);
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
return
|
|
1836
|
+
return a.join(`
|
|
1837
1837
|
`);
|
|
1838
1838
|
}
|
|
1839
1839
|
function nt(e) {
|
|
1840
|
-
const { action: t, success: r, total: o, successItems: n, successLabel:
|
|
1841
|
-
if (c.push(d), n?.length && n.length <= 5 && c.push(`${
|
|
1840
|
+
const { action: t, success: r, total: o, successItems: n, successLabel: i = "Completed", failures: a } = e, c = [], d = `${t}: ${r}/${o} successful.`;
|
|
1841
|
+
if (c.push(d), n?.length && n.length <= 5 && c.push(`${i}:
|
|
1842
1842
|
${n.map((l) => ` ${l}`).join(`
|
|
1843
|
-
`)}.`),
|
|
1844
|
-
const l =
|
|
1845
|
-
${
|
|
1843
|
+
`)}.`), a?.length) {
|
|
1844
|
+
const l = a.length, u = `Failed (${l}):
|
|
1845
|
+
${a.slice(0, fe.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
|
|
1846
1846
|
`
|
|
1847
1847
|
`
|
|
1848
1848
|
)}${l > fe.MAX_FAILURES_SHOWN ? `, +${l - fe.MAX_FAILURES_SHOWN} more` : ""}.`;
|
|
@@ -1851,27 +1851,27 @@ ${i.slice(0, fe.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}
|
|
|
1851
1851
|
return c.join(`
|
|
1852
1852
|
`);
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1854
|
+
function it(e, t) {
|
|
1855
1855
|
if (t.length === 0)
|
|
1856
1856
|
return e;
|
|
1857
|
-
const r = t.slice(0, fe.MAX_FAILURES_SHOWN), o = t.length - r.length, n = r.map((
|
|
1858
|
-
`),
|
|
1857
|
+
const r = t.slice(0, fe.MAX_FAILURES_SHOWN), o = t.length - r.length, n = r.map((a) => ` ${a.item}: ${a.error}`).join(`
|
|
1858
|
+
`), i = o > 0 ? `
|
|
1859
1859
|
+${o} more` : "";
|
|
1860
1860
|
return `${e}
|
|
1861
1861
|
Failed (${t.length}) - address or drop these items:
|
|
1862
|
-
${n}${
|
|
1862
|
+
${n}${i}`;
|
|
1863
1863
|
}
|
|
1864
1864
|
function No(e) {
|
|
1865
|
-
const t = e.content || e.title || "Untitled", r = e.dueDate ? ` • due ${e.dueDate}` : "", o = e.priority ? ` • ${e.priority.toUpperCase()}` : "", n = e.projectName ? ` • ${e.projectName}` : "",
|
|
1866
|
-
return ` ${t}${r}${o}${n}${
|
|
1865
|
+
const t = e.content || e.title || "Untitled", r = e.dueDate ? ` • due ${e.dueDate}` : "", o = e.priority ? ` • ${e.priority.toUpperCase()}` : "", n = e.projectName ? ` • ${e.projectName}` : "", i = e.id ? ` • id=${e.id}` : "";
|
|
1866
|
+
return ` ${t}${r}${o}${n}${i}`;
|
|
1867
1867
|
}
|
|
1868
1868
|
function Mo(e) {
|
|
1869
1869
|
const t = ` (${e.color})`, r = e.isFavorite ? " • ⭐" : "", o = ` • id=${e.id}`;
|
|
1870
1870
|
return ` ${e.name}${t}${r}${o}`;
|
|
1871
1871
|
}
|
|
1872
1872
|
function Fo(e) {
|
|
1873
|
-
const t = e.inboxProject ? " • Inbox" : "", r = e.isFavorite ? " • ⭐" : "", o = e.isShared ? " • Shared" : "", n = e.isArchived ? " • Archived" : "",
|
|
1874
|
-
return ` ${e.name}${t}${r}${o}${n}${
|
|
1873
|
+
const t = e.inboxProject ? " • Inbox" : "", r = e.isFavorite ? " • ⭐" : "", o = e.isShared ? " • Shared" : "", n = e.isArchived ? " • Archived" : "", i = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", a = ` • id=${e.id}`;
|
|
1874
|
+
return ` ${e.name}${t}${r}${o}${n}${i}${a}`;
|
|
1875
1875
|
}
|
|
1876
1876
|
function Se(e, t = 5) {
|
|
1877
1877
|
const o = e.slice(0, t).map(No).join(`
|
|
@@ -1883,22 +1883,22 @@ function Se(e, t = 5) {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
return o;
|
|
1885
1885
|
}
|
|
1886
|
-
function
|
|
1886
|
+
function K({
|
|
1887
1887
|
subject: e,
|
|
1888
1888
|
count: t,
|
|
1889
1889
|
limit: r,
|
|
1890
1890
|
nextCursor: o,
|
|
1891
1891
|
filterHints: n,
|
|
1892
|
-
previewLines:
|
|
1893
|
-
zeroReasonHints:
|
|
1892
|
+
previewLines: i,
|
|
1893
|
+
zeroReasonHints: a,
|
|
1894
1894
|
nextSteps: c
|
|
1895
1895
|
}) {
|
|
1896
1896
|
const d = [], l = `${e}: ${t}${typeof r == "number" ? ` (limit ${r})` : ""}${o ? ", more available" : ""}.`;
|
|
1897
|
-
return d.push(l), n?.length && d.push(`Filter: ${n.join("; ")}.`),
|
|
1898
|
-
${
|
|
1897
|
+
return d.push(l), n?.length && d.push(`Filter: ${n.join("; ")}.`), i?.length && d.push(`Preview:
|
|
1898
|
+
${i}`), !t && a?.length && d.push(`No results. ${a.join("; ")}.`), (c?.length || o) && d.push(is(c || [], o)), d.join(`
|
|
1899
1899
|
`);
|
|
1900
1900
|
}
|
|
1901
|
-
function
|
|
1901
|
+
function is(e, t) {
|
|
1902
1902
|
const r = [...e];
|
|
1903
1903
|
return t && r.push(`Pass cursor '${t}' to fetch more results.`), `${r.length === 1 ? "Possible suggested next step:" : "Possible suggested next steps:"}
|
|
1904
1904
|
${r.map((n) => `- ${n}`).join(`
|
|
@@ -1937,15 +1937,15 @@ class Bo {
|
|
|
1937
1937
|
const o = r.trim();
|
|
1938
1938
|
if (!o)
|
|
1939
1939
|
throw new Error("Workspace reference cannot be empty");
|
|
1940
|
-
const n = await this.getWorkspaces(t),
|
|
1941
|
-
if (
|
|
1942
|
-
return { workspaceId:
|
|
1940
|
+
const n = await this.getWorkspaces(t), i = n.find((u) => u.id === o);
|
|
1941
|
+
if (i)
|
|
1942
|
+
return { workspaceId: i.id, workspaceName: i.name };
|
|
1943
1943
|
if (Wo(o))
|
|
1944
1944
|
return { workspaceId: o, workspaceName: o };
|
|
1945
|
-
const
|
|
1945
|
+
const a = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === a);
|
|
1946
1946
|
if (c)
|
|
1947
1947
|
return { workspaceId: c.id, workspaceName: c.name };
|
|
1948
|
-
const d = n.filter((u) => u.name.toLowerCase().includes(
|
|
1948
|
+
const d = n.filter((u) => u.name.toLowerCase().includes(a)), l = d.length === 1 ? d[0] : void 0;
|
|
1949
1949
|
if (l)
|
|
1950
1950
|
return { workspaceId: l.id, workspaceName: l.name };
|
|
1951
1951
|
if (d.length > 1) {
|
|
@@ -1968,7 +1968,7 @@ ${u}` + (d.length > 5 ? `
|
|
|
1968
1968
|
this.cache = null;
|
|
1969
1969
|
}
|
|
1970
1970
|
}
|
|
1971
|
-
const
|
|
1971
|
+
const as = new Bo(), zo = s.object({
|
|
1972
1972
|
name: s.string().min(1).describe("The name of the project."),
|
|
1973
1973
|
parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
|
|
1974
1974
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
|
|
@@ -1978,9 +1978,9 @@ const is = new Bo(), zo = s.object({
|
|
|
1978
1978
|
workspace: s.string().trim().min(1).optional().describe(
|
|
1979
1979
|
"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."
|
|
1980
1980
|
)
|
|
1981
|
-
}),
|
|
1981
|
+
}), qo = {
|
|
1982
1982
|
projects: s.array(zo).min(1).describe("The array of projects to add.")
|
|
1983
|
-
},
|
|
1983
|
+
}, Ko = {
|
|
1984
1984
|
projects: s.array(Q).describe("The created projects."),
|
|
1985
1985
|
totalCount: s.number().describe("The total number of projects created."),
|
|
1986
1986
|
failures: s.array(ee).describe(
|
|
@@ -1992,8 +1992,8 @@ const is = new Bo(), zo = s.object({
|
|
|
1992
1992
|
}, Yo = {
|
|
1993
1993
|
name: g.ADD_PROJECTS,
|
|
1994
1994
|
description: "Add one or more new projects.",
|
|
1995
|
-
parameters:
|
|
1996
|
-
outputSchema:
|
|
1995
|
+
parameters: qo,
|
|
1996
|
+
outputSchema: Ko,
|
|
1997
1997
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
1998
1998
|
async execute({ projects: e }, t) {
|
|
1999
1999
|
const r = /* @__PURE__ */ new Map(), o = (l) => {
|
|
@@ -2001,7 +2001,7 @@ const is = new Bo(), zo = s.object({
|
|
|
2001
2001
|
return Promise.resolve(void 0);
|
|
2002
2002
|
let u = r.get(l);
|
|
2003
2003
|
return u || (u = O(
|
|
2004
|
-
() =>
|
|
2004
|
+
() => as.resolveWorkspace(t, l)
|
|
2005
2005
|
).then(({ workspaceId: p }) => p), r.set(l, u)), u;
|
|
2006
2006
|
}, n = await Promise.allSettled(
|
|
2007
2007
|
e.map(async ({ workspace: l, ...u }) => {
|
|
@@ -2010,23 +2010,23 @@ const is = new Bo(), zo = s.object({
|
|
|
2010
2010
|
() => t.addProject({ ...u, ...p ? { workspaceId: p } : {} })
|
|
2011
2011
|
);
|
|
2012
2012
|
})
|
|
2013
|
-
),
|
|
2013
|
+
), i = [], a = [];
|
|
2014
2014
|
n.forEach((l, u) => {
|
|
2015
|
-
l.status === "fulfilled" ?
|
|
2015
|
+
l.status === "fulfilled" ? i.push(l.value) : a.push({
|
|
2016
2016
|
item: e[u]?.name ?? `Project ${u + 1}`,
|
|
2017
2017
|
error: z(l.reason)
|
|
2018
2018
|
});
|
|
2019
2019
|
});
|
|
2020
|
-
const c =
|
|
2020
|
+
const c = i.map(Z);
|
|
2021
2021
|
return {
|
|
2022
|
-
textContent: Go({ projects:
|
|
2022
|
+
textContent: Go({ projects: i, failures: a }),
|
|
2023
2023
|
structuredContent: {
|
|
2024
2024
|
projects: c,
|
|
2025
2025
|
totalCount: c.length,
|
|
2026
|
-
failures:
|
|
2026
|
+
failures: a,
|
|
2027
2027
|
totalRequested: e.length,
|
|
2028
2028
|
successCount: c.length,
|
|
2029
|
-
failureCount:
|
|
2029
|
+
failureCount: a.length
|
|
2030
2030
|
}
|
|
2031
2031
|
};
|
|
2032
2032
|
}
|
|
@@ -2035,10 +2035,10 @@ function Go({
|
|
|
2035
2035
|
projects: e,
|
|
2036
2036
|
failures: t
|
|
2037
2037
|
}) {
|
|
2038
|
-
const r = e.length, o = e.map((
|
|
2038
|
+
const r = e.length, o = e.map((i) => `• ${i.name} (id=${i.id})`).join(`
|
|
2039
2039
|
`), n = r > 0 ? `Added ${r} project${r === 1 ? "" : "s"}:
|
|
2040
2040
|
${o}` : "Added 0 projects";
|
|
2041
|
-
return
|
|
2041
|
+
return it(n, t);
|
|
2042
2042
|
}
|
|
2043
2043
|
const we = 25, je = s.enum(Ms), cs = s.object({
|
|
2044
2044
|
date: s.string().optional().describe("Due date in YYYY-MM-DD format."),
|
|
@@ -2120,13 +2120,13 @@ const we = 25, je = s.enum(Ms), cs = s.object({
|
|
|
2120
2120
|
radius: c.radius
|
|
2121
2121
|
});
|
|
2122
2122
|
}
|
|
2123
|
-
}),
|
|
2123
|
+
}), i = (await Promise.all(o)).map(be);
|
|
2124
2124
|
return {
|
|
2125
|
-
textContent: sn(
|
|
2125
|
+
textContent: sn(i),
|
|
2126
2126
|
structuredContent: {
|
|
2127
|
-
reminders:
|
|
2128
|
-
totalCount:
|
|
2129
|
-
addedReminderIds:
|
|
2127
|
+
reminders: i,
|
|
2128
|
+
totalCount: i.length,
|
|
2129
|
+
addedReminderIds: i.map((c) => c.id)
|
|
2130
2130
|
}
|
|
2131
2131
|
};
|
|
2132
2132
|
}
|
|
@@ -2176,21 +2176,21 @@ const rn = s.object({
|
|
|
2176
2176
|
}) ?? c.projectId;
|
|
2177
2177
|
return O(() => t.addSection({ ...c, projectId: l }));
|
|
2178
2178
|
})
|
|
2179
|
-
), n = [],
|
|
2179
|
+
), n = [], i = [];
|
|
2180
2180
|
return o.forEach((c, d) => {
|
|
2181
|
-
c.status === "fulfilled" ? n.push(c.value) :
|
|
2181
|
+
c.status === "fulfilled" ? n.push(c.value) : i.push({
|
|
2182
2182
|
item: e[d]?.name ?? `Section ${d + 1}`,
|
|
2183
2183
|
error: z(c.reason)
|
|
2184
2184
|
});
|
|
2185
2185
|
}), {
|
|
2186
|
-
textContent: cn({ sections: n, failures:
|
|
2186
|
+
textContent: cn({ sections: n, failures: i }),
|
|
2187
2187
|
structuredContent: {
|
|
2188
|
-
sections: n.map(
|
|
2188
|
+
sections: n.map(q),
|
|
2189
2189
|
totalCount: n.length,
|
|
2190
|
-
failures:
|
|
2190
|
+
failures: i,
|
|
2191
2191
|
totalRequested: e.length,
|
|
2192
2192
|
successCount: n.length,
|
|
2193
|
-
failureCount:
|
|
2193
|
+
failureCount: i.length
|
|
2194
2194
|
}
|
|
2195
2195
|
};
|
|
2196
2196
|
}
|
|
@@ -2199,10 +2199,10 @@ function cn({
|
|
|
2199
2199
|
sections: e,
|
|
2200
2200
|
failures: t
|
|
2201
2201
|
}) {
|
|
2202
|
-
const r = e.length, o = e.map((
|
|
2202
|
+
const r = e.length, o = e.map((i) => `• ${i.name} (id=${i.id}, projectId=${i.projectId})`).join(`
|
|
2203
2203
|
`), n = r > 0 ? `Added ${r} section${r === 1 ? "" : "s"}:
|
|
2204
2204
|
${o}` : "Added 0 sections";
|
|
2205
|
-
return
|
|
2205
|
+
return it(n, t);
|
|
2206
2206
|
}
|
|
2207
2207
|
const ne = {
|
|
2208
2208
|
USER_NOT_FOUND: "USER_NOT_FOUND",
|
|
@@ -2218,15 +2218,15 @@ class dn {
|
|
|
2218
2218
|
* Validate a single assignment operation
|
|
2219
2219
|
*/
|
|
2220
2220
|
async validateAssignment(t, r) {
|
|
2221
|
-
const { taskId: o, projectId: n, responsibleUid:
|
|
2222
|
-
if (!
|
|
2221
|
+
const { taskId: o, projectId: n, responsibleUid: i } = r, a = await W.resolveUser(t, i);
|
|
2222
|
+
if (!a)
|
|
2223
2223
|
return {
|
|
2224
2224
|
isValid: !1,
|
|
2225
2225
|
taskId: o,
|
|
2226
2226
|
projectId: n,
|
|
2227
2227
|
error: {
|
|
2228
2228
|
type: ne.USER_NOT_FOUND,
|
|
2229
|
-
message: `User "${
|
|
2229
|
+
message: `User "${i}" not found`,
|
|
2230
2230
|
suggestions: [
|
|
2231
2231
|
"Check the spelling of the user name or email",
|
|
2232
2232
|
"Ensure the user is a collaborator on at least one shared project",
|
|
@@ -2241,7 +2241,7 @@ class dn {
|
|
|
2241
2241
|
isValid: !1,
|
|
2242
2242
|
taskId: o,
|
|
2243
2243
|
projectId: n,
|
|
2244
|
-
resolvedUser:
|
|
2244
|
+
resolvedUser: a,
|
|
2245
2245
|
error: {
|
|
2246
2246
|
type: ne.PROJECT_NOT_SHARED,
|
|
2247
2247
|
message: `Project "${c.name}" is not shared. Task assignments require a shared project with collaborators. Share the project with at least one other person to enable assignments.`,
|
|
@@ -2254,16 +2254,16 @@ class dn {
|
|
|
2254
2254
|
if (!await W.validateProjectCollaborator(
|
|
2255
2255
|
t,
|
|
2256
2256
|
n,
|
|
2257
|
-
|
|
2257
|
+
a.userId
|
|
2258
2258
|
))
|
|
2259
2259
|
return {
|
|
2260
2260
|
isValid: !1,
|
|
2261
2261
|
taskId: o,
|
|
2262
2262
|
projectId: n,
|
|
2263
|
-
resolvedUser:
|
|
2263
|
+
resolvedUser: a,
|
|
2264
2264
|
error: {
|
|
2265
2265
|
type: ne.USER_NOT_COLLABORATOR,
|
|
2266
|
-
message: `User "${
|
|
2266
|
+
message: `User "${a.displayName}" is not a collaborator on project "${c.name}"`,
|
|
2267
2267
|
suggestions: [
|
|
2268
2268
|
"Invite the user to collaborate on this project first",
|
|
2269
2269
|
"Check if the user has been removed from the project",
|
|
@@ -2279,7 +2279,7 @@ class dn {
|
|
|
2279
2279
|
isValid: !1,
|
|
2280
2280
|
taskId: o,
|
|
2281
2281
|
projectId: n,
|
|
2282
|
-
resolvedUser:
|
|
2282
|
+
resolvedUser: a,
|
|
2283
2283
|
error: {
|
|
2284
2284
|
type: ne.TASK_NOT_FOUND,
|
|
2285
2285
|
message: `Task "${o}" not found or not accessible`,
|
|
@@ -2295,14 +2295,14 @@ class dn {
|
|
|
2295
2295
|
isValid: !0,
|
|
2296
2296
|
taskId: o,
|
|
2297
2297
|
projectId: n,
|
|
2298
|
-
resolvedUser:
|
|
2298
|
+
resolvedUser: a
|
|
2299
2299
|
};
|
|
2300
2300
|
} catch {
|
|
2301
2301
|
return {
|
|
2302
2302
|
isValid: !1,
|
|
2303
2303
|
taskId: o,
|
|
2304
2304
|
projectId: n,
|
|
2305
|
-
resolvedUser:
|
|
2305
|
+
resolvedUser: a,
|
|
2306
2306
|
error: {
|
|
2307
2307
|
type: ne.PERMISSION_DENIED,
|
|
2308
2308
|
message: "Permission denied or API error occurred",
|
|
@@ -2369,8 +2369,8 @@ class dn {
|
|
|
2369
2369
|
* Get detailed assignment eligibility information for troubleshooting
|
|
2370
2370
|
*/
|
|
2371
2371
|
async getAssignmentEligibility(t, r, o, n) {
|
|
2372
|
-
const
|
|
2373
|
-
let
|
|
2372
|
+
const i = [];
|
|
2373
|
+
let a = !1, c;
|
|
2374
2374
|
try {
|
|
2375
2375
|
c = await t.getProject(r);
|
|
2376
2376
|
} catch {
|
|
@@ -2390,18 +2390,18 @@ class dn {
|
|
|
2390
2390
|
collaboratorCount: d.length
|
|
2391
2391
|
};
|
|
2392
2392
|
if (!c.isShared)
|
|
2393
|
-
return
|
|
2393
|
+
return i.push("Share this project to enable task assignments"), { canAssign: !1, projectInfo: l, recommendations: i };
|
|
2394
2394
|
const u = await W.resolveUser(t, o);
|
|
2395
2395
|
if (!u)
|
|
2396
|
-
return
|
|
2396
|
+
return i.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: i };
|
|
2397
2397
|
const p = d.some((y) => y.id === u.userId), m = {
|
|
2398
2398
|
resolvedName: u.displayName,
|
|
2399
2399
|
isCollaborator: p
|
|
2400
2400
|
};
|
|
2401
2401
|
if (!p)
|
|
2402
|
-
return
|
|
2402
|
+
return i.push(
|
|
2403
2403
|
`Invite ${u.displayName} to collaborate on project "${c.name}"`
|
|
2404
|
-
), { canAssign: !1, projectInfo: l, userInfo: m, recommendations:
|
|
2404
|
+
), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: i };
|
|
2405
2405
|
let h;
|
|
2406
2406
|
if (n && n.length > 0) {
|
|
2407
2407
|
let y = 0, f = 0;
|
|
@@ -2411,22 +2411,22 @@ class dn {
|
|
|
2411
2411
|
} catch {
|
|
2412
2412
|
f++;
|
|
2413
2413
|
}
|
|
2414
|
-
h = { accessibleTasks: y, inaccessibleTasks: f }, f > 0 &&
|
|
2414
|
+
h = { accessibleTasks: y, inaccessibleTasks: f }, f > 0 && i.push(`${f} task(s) are not accessible`);
|
|
2415
2415
|
}
|
|
2416
|
-
return
|
|
2417
|
-
canAssign:
|
|
2416
|
+
return a = !0, i.push(`Ready to assign tasks to ${u.displayName}`), {
|
|
2417
|
+
canAssign: a,
|
|
2418
2418
|
projectInfo: l,
|
|
2419
2419
|
userInfo: m,
|
|
2420
2420
|
taskInfo: h,
|
|
2421
|
-
recommendations:
|
|
2421
|
+
recommendations: i
|
|
2422
2422
|
};
|
|
2423
2423
|
}
|
|
2424
2424
|
}
|
|
2425
|
-
const
|
|
2425
|
+
const at = new dn();
|
|
2426
2426
|
function U(e) {
|
|
2427
2427
|
return s.string().transform((t) => t === "" ? void 0 : t).optional().describe(e);
|
|
2428
2428
|
}
|
|
2429
|
-
const Tt =
|
|
2429
|
+
const Tt = qt.TASKS_PER_OPERATION, ln = s.object({
|
|
2430
2430
|
content: s.string().min(1).describe(
|
|
2431
2431
|
'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.'
|
|
2432
2432
|
),
|
|
@@ -2477,7 +2477,7 @@ const Tt = Kt.TASKS_PER_OPERATION, ln = s.object({
|
|
|
2477
2477
|
const y = mn(m), f = o.get(y);
|
|
2478
2478
|
f ? f.push({ task: m, index: h }) : o.set(y, [{ task: m, index: h }]);
|
|
2479
2479
|
});
|
|
2480
|
-
const n = /* @__PURE__ */ new Map(),
|
|
2480
|
+
const n = /* @__PURE__ */ new Map(), a = (await Promise.all(
|
|
2481
2481
|
[...o.values()].map(async (m) => {
|
|
2482
2482
|
const h = [];
|
|
2483
2483
|
for (const { task: y, index: f } of m)
|
|
@@ -2494,7 +2494,7 @@ const Tt = Kt.TASKS_PER_OPERATION, ln = s.object({
|
|
|
2494
2494
|
})
|
|
2495
2495
|
)).flat().sort((m, h) => m.index - h.index), c = [], d = [];
|
|
2496
2496
|
let l = !1;
|
|
2497
|
-
for (const { index: m, result: h } of
|
|
2497
|
+
for (const { index: m, result: h } of a)
|
|
2498
2498
|
h.status === "fulfilled" ? c.push(h.value) : (l ||= h.reason instanceof ve, d.push({
|
|
2499
2499
|
item: r[m]?.content ?? `Task ${m + 1}`,
|
|
2500
2500
|
// Keep API error signals (status/code/tag) — `error.message`
|
|
@@ -2531,8 +2531,8 @@ async function hn(e, t, r) {
|
|
|
2531
2531
|
const {
|
|
2532
2532
|
duration: o,
|
|
2533
2533
|
projectId: n,
|
|
2534
|
-
sectionId:
|
|
2535
|
-
parentId:
|
|
2534
|
+
sectionId: i,
|
|
2535
|
+
parentId: a,
|
|
2536
2536
|
order: c,
|
|
2537
2537
|
responsibleUser: d,
|
|
2538
2538
|
priority: l,
|
|
@@ -2550,13 +2550,13 @@ async function hn(e, t, r) {
|
|
|
2550
2550
|
let y = {
|
|
2551
2551
|
...m,
|
|
2552
2552
|
projectId: h,
|
|
2553
|
-
sectionId:
|
|
2554
|
-
parentId:
|
|
2553
|
+
sectionId: i,
|
|
2554
|
+
parentId: a,
|
|
2555
2555
|
order: c,
|
|
2556
2556
|
labels: u,
|
|
2557
2557
|
deadlineDate: p
|
|
2558
2558
|
};
|
|
2559
|
-
if (l && (y.priority = Zt(l)), d && !h && !
|
|
2559
|
+
if (l && (y.priority = Zt(l)), d && !h && !i && !a)
|
|
2560
2560
|
throw new Error(
|
|
2561
2561
|
`Task "${e.content}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
|
|
2562
2562
|
);
|
|
@@ -2573,23 +2573,23 @@ async function hn(e, t, r) {
|
|
|
2573
2573
|
}
|
|
2574
2574
|
if (d) {
|
|
2575
2575
|
let f = h;
|
|
2576
|
-
if (!f &&
|
|
2576
|
+
if (!f && a)
|
|
2577
2577
|
try {
|
|
2578
|
-
f = (await t.getTask(
|
|
2578
|
+
f = (await t.getTask(a)).projectId;
|
|
2579
2579
|
} catch {
|
|
2580
|
-
throw new Error(`Task "${e.content}": Parent task "${
|
|
2580
|
+
throw new Error(`Task "${e.content}": Parent task "${a}" not found`);
|
|
2581
2581
|
}
|
|
2582
|
-
else if (!f &&
|
|
2583
|
-
const j = await t.getSection(
|
|
2582
|
+
else if (!f && i && (f = r.get(i), !f)) {
|
|
2583
|
+
const j = await t.getSection(i);
|
|
2584
2584
|
if (!j)
|
|
2585
|
-
throw new Error(`Task "${e.content}": Section "${
|
|
2586
|
-
f = j.projectId, r.set(
|
|
2585
|
+
throw new Error(`Task "${e.content}": Section "${i}" not found`);
|
|
2586
|
+
f = j.projectId, r.set(i, j.projectId);
|
|
2587
2587
|
}
|
|
2588
2588
|
if (!f)
|
|
2589
2589
|
throw new Error(
|
|
2590
2590
|
`Task "${e.content}": Cannot determine target project for assignment validation`
|
|
2591
2591
|
);
|
|
2592
|
-
const v = await
|
|
2592
|
+
const v = await at.validateTaskCreationAssignment(
|
|
2593
2593
|
t,
|
|
2594
2594
|
f,
|
|
2595
2595
|
d
|
|
@@ -2619,18 +2619,18 @@ function fn({
|
|
|
2619
2619
|
args: r
|
|
2620
2620
|
}) {
|
|
2621
2621
|
const o = /* @__PURE__ */ new Set();
|
|
2622
|
-
for (const
|
|
2623
|
-
|
|
2622
|
+
for (const i of r.tasks)
|
|
2623
|
+
i.projectId && !N(i.projectId) ? o.add("projects") : i.sectionId ? o.add("sections") : i.parentId ? o.add("subtasks") : o.add("inbox");
|
|
2624
2624
|
let n = "";
|
|
2625
2625
|
if (o.size === 1) {
|
|
2626
|
-
const
|
|
2627
|
-
n =
|
|
2626
|
+
const i = Array.from(o)[0];
|
|
2627
|
+
n = i === "inbox" ? "" : `to ${i}`;
|
|
2628
2628
|
} else o.size > 1 && (n = "to multiple contexts");
|
|
2629
2629
|
return t.length > 0 ? nt({
|
|
2630
2630
|
action: `Added tasks${n ? ` ${n}` : ""}`,
|
|
2631
2631
|
success: e.length,
|
|
2632
2632
|
total: r.tasks.length,
|
|
2633
|
-
successItems: e.map((
|
|
2633
|
+
successItems: e.map((i) => i.content ?? "Untitled"),
|
|
2634
2634
|
successLabel: "Created",
|
|
2635
2635
|
failures: t
|
|
2636
2636
|
}) : ot("Added", e, {
|
|
@@ -2693,13 +2693,13 @@ ${n}`,
|
|
|
2693
2693
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
2694
2694
|
async execute(e, t) {
|
|
2695
2695
|
const r = [], o = [];
|
|
2696
|
-
for (const
|
|
2696
|
+
for (const i of e.ids)
|
|
2697
2697
|
try {
|
|
2698
|
-
await t.closeTask(
|
|
2699
|
-
} catch (
|
|
2700
|
-
const c =
|
|
2698
|
+
await t.closeTask(i), r.push(i);
|
|
2699
|
+
} catch (a) {
|
|
2700
|
+
const c = a instanceof Error ? a.message : "Unknown error";
|
|
2701
2701
|
o.push({
|
|
2702
|
-
item:
|
|
2702
|
+
item: i,
|
|
2703
2703
|
error: c
|
|
2704
2704
|
});
|
|
2705
2705
|
}
|
|
@@ -2823,23 +2823,23 @@ const ls = [
|
|
|
2823
2823
|
// execute() with raw JSON, so schema defaults are not applied on that path.
|
|
2824
2824
|
async execute({ projectId: e, format: t = "file", useRelativeDates: r }, o) {
|
|
2825
2825
|
if (t === "url") {
|
|
2826
|
-
const { fileName:
|
|
2826
|
+
const { fileName: a, fileUrl: c } = await o.exportTemplateAsUrl({
|
|
2827
2827
|
projectId: e,
|
|
2828
2828
|
useRelativeDates: r
|
|
2829
2829
|
});
|
|
2830
2830
|
return {
|
|
2831
|
-
textContent: `Exported project (id=${e}) as template URL: ${
|
|
2831
|
+
textContent: `Exported project (id=${e}) as template URL: ${a}
|
|
2832
2832
|
${c}`,
|
|
2833
|
-
structuredContent: { format: t, fileName:
|
|
2833
|
+
structuredContent: { format: t, fileName: a, fileUrl: c }
|
|
2834
2834
|
};
|
|
2835
2835
|
}
|
|
2836
|
-
const n = await o.exportTemplateAsFile({ projectId: e, useRelativeDates: r }),
|
|
2837
|
-
`).filter((
|
|
2836
|
+
const n = await o.exportTemplateAsFile({ projectId: e, useRelativeDates: r }), i = n.split(`
|
|
2837
|
+
`).filter((a) => a.trim().length > 0);
|
|
2838
2838
|
return {
|
|
2839
2839
|
// The full CSV already ships in structuredContent; a preview here keeps a large
|
|
2840
2840
|
// project from being spelled out twice in the response.
|
|
2841
|
-
textContent: xn({ projectId: e, lines:
|
|
2842
|
-
structuredContent: { format: t, content: n, lineCount:
|
|
2841
|
+
textContent: xn({ projectId: e, lines: i }),
|
|
2842
|
+
structuredContent: { format: t, content: n, lineCount: i.length }
|
|
2843
2843
|
};
|
|
2844
2844
|
}
|
|
2845
2845
|
};
|
|
@@ -2885,42 +2885,42 @@ async function Pn(e, t) {
|
|
|
2885
2885
|
parentId: t,
|
|
2886
2886
|
limit: C.CHILDREN_MAX
|
|
2887
2887
|
}), n = await Promise.allSettled(
|
|
2888
|
-
r.map(({ id:
|
|
2889
|
-
),
|
|
2888
|
+
r.map(({ id: a }) => e.getTasks({ parentId: a, limit: 1 }))
|
|
2889
|
+
), i = n.filter((a) => a.status === "rejected").length;
|
|
2890
2890
|
return {
|
|
2891
2891
|
childCount: r.length,
|
|
2892
|
-
children: r.map((
|
|
2892
|
+
children: r.map((a, c) => {
|
|
2893
2893
|
const d = n[c];
|
|
2894
2894
|
return {
|
|
2895
|
-
id:
|
|
2896
|
-
content:
|
|
2897
|
-
dueDate:
|
|
2898
|
-
checked:
|
|
2895
|
+
id: a.id,
|
|
2896
|
+
content: a.content,
|
|
2897
|
+
dueDate: a.due?.date,
|
|
2898
|
+
checked: a.checked,
|
|
2899
2899
|
hasChildren: d?.status === "fulfilled" && d.value.results.length > 0
|
|
2900
2900
|
};
|
|
2901
2901
|
}),
|
|
2902
2902
|
hasMoreChildren: o ? !0 : void 0,
|
|
2903
|
-
childrenError:
|
|
2903
|
+
childrenError: i ? `Could not check ${i} of ${r.length} subtasks for subtasks of their own; those are reported as hasChildren=false.` : void 0
|
|
2904
2904
|
};
|
|
2905
2905
|
}
|
|
2906
2906
|
async function _n(e, t) {
|
|
2907
2907
|
if (!B(t))
|
|
2908
2908
|
return { childCount: 0, children: [] };
|
|
2909
2909
|
const r = await os(e), o = /* @__PURE__ */ new Map();
|
|
2910
|
-
for (const
|
|
2911
|
-
if (!B(
|
|
2912
|
-
const c = o.get(
|
|
2913
|
-
c.push(
|
|
2910
|
+
for (const a of r) {
|
|
2911
|
+
if (!B(a) || !a.parentId) continue;
|
|
2912
|
+
const c = o.get(a.parentId) ?? [];
|
|
2913
|
+
c.push(a), o.set(a.parentId, c);
|
|
2914
2914
|
}
|
|
2915
|
-
const n = [...o.get(t.id) ?? []].sort((
|
|
2915
|
+
const n = [...o.get(t.id) ?? []].sort((a, c) => a.childOrder - c.childOrder), i = n.slice(0, C.CHILDREN_MAX);
|
|
2916
2916
|
return {
|
|
2917
|
-
childCount:
|
|
2918
|
-
children:
|
|
2919
|
-
id:
|
|
2920
|
-
name:
|
|
2921
|
-
hasChildren: (o.get(
|
|
2917
|
+
childCount: i.length,
|
|
2918
|
+
children: i.map((a) => ({
|
|
2919
|
+
id: a.id,
|
|
2920
|
+
name: a.name,
|
|
2921
|
+
hasChildren: (o.get(a.id)?.length ?? 0) > 0
|
|
2922
2922
|
})),
|
|
2923
|
-
hasMoreChildren: n.length >
|
|
2923
|
+
hasMoreChildren: n.length > i.length ? !0 : void 0
|
|
2924
2924
|
};
|
|
2925
2925
|
}
|
|
2926
2926
|
async function vt(e) {
|
|
@@ -2958,61 +2958,61 @@ const ps = ["task", "project", "comment", "section"], Rn = {
|
|
|
2958
2958
|
try {
|
|
2959
2959
|
switch (r) {
|
|
2960
2960
|
case "task": {
|
|
2961
|
-
const [
|
|
2961
|
+
const [i, a] = await Promise.all([
|
|
2962
2962
|
t.getTask(o),
|
|
2963
2963
|
n ? vt(() => Pn(t, o)) : Promise.resolve({})
|
|
2964
|
-
]), c = P(
|
|
2964
|
+
]), c = P(i);
|
|
2965
2965
|
return {
|
|
2966
|
-
textContent: `Found task: ${c.content} • id=${c.id} • priority=${c.priority} • project=${c.projectId}${It("subtasks",
|
|
2966
|
+
textContent: `Found task: ${c.content} • id=${c.id} • priority=${c.priority} • project=${c.projectId}${It("subtasks", a)}`,
|
|
2967
2967
|
structuredContent: {
|
|
2968
2968
|
type: r,
|
|
2969
2969
|
id: o,
|
|
2970
2970
|
object: c,
|
|
2971
|
-
...
|
|
2971
|
+
...a
|
|
2972
2972
|
}
|
|
2973
2973
|
};
|
|
2974
2974
|
}
|
|
2975
2975
|
case "project": {
|
|
2976
|
-
const
|
|
2976
|
+
const i = await t.getProject(o), a = Z(i), c = n ? await vt(() => _n(t, i)) : {};
|
|
2977
2977
|
return {
|
|
2978
|
-
textContent: `Found project: ${
|
|
2978
|
+
textContent: `Found project: ${a.name} • id=${a.id} • color=${a.color} • viewStyle=${a.viewStyle}${It("subProjects", c)}`,
|
|
2979
2979
|
structuredContent: {
|
|
2980
2980
|
type: r,
|
|
2981
2981
|
id: o,
|
|
2982
|
-
object:
|
|
2982
|
+
object: a,
|
|
2983
2983
|
...c
|
|
2984
2984
|
}
|
|
2985
2985
|
};
|
|
2986
2986
|
}
|
|
2987
2987
|
case "comment": {
|
|
2988
|
-
const
|
|
2988
|
+
const i = await t.getComment(o), a = ge(i), c = a.content.length > 50 ? `${a.content.substring(0, 50)}...` : a.content;
|
|
2989
2989
|
return {
|
|
2990
|
-
textContent: `Found comment • id=${
|
|
2990
|
+
textContent: `Found comment • id=${a.id} • content="${c}" • posted=${a.postedAt}`,
|
|
2991
2991
|
structuredContent: {
|
|
2992
2992
|
type: r,
|
|
2993
2993
|
id: o,
|
|
2994
|
-
object:
|
|
2994
|
+
object: a
|
|
2995
2995
|
}
|
|
2996
2996
|
};
|
|
2997
2997
|
}
|
|
2998
2998
|
case "section": {
|
|
2999
|
-
const
|
|
3000
|
-
if (!
|
|
2999
|
+
const i = await t.getSection(o);
|
|
3000
|
+
if (!i)
|
|
3001
3001
|
throw new Error(`Section ${o} not found.`);
|
|
3002
|
-
const
|
|
3002
|
+
const a = q(i);
|
|
3003
3003
|
return {
|
|
3004
|
-
textContent: `Found section: ${
|
|
3004
|
+
textContent: `Found section: ${a.name} • id=${a.id}`,
|
|
3005
3005
|
structuredContent: {
|
|
3006
3006
|
type: r,
|
|
3007
3007
|
id: o,
|
|
3008
|
-
object:
|
|
3008
|
+
object: a
|
|
3009
3009
|
}
|
|
3010
3010
|
};
|
|
3011
3011
|
}
|
|
3012
3012
|
}
|
|
3013
|
-
} catch (
|
|
3013
|
+
} catch (i) {
|
|
3014
3014
|
throw new Error(
|
|
3015
|
-
`Failed to fetch ${r} with id ${o}: ${
|
|
3015
|
+
`Failed to fetch ${r} with id ${o}: ${i instanceof Error ? i.message : String(i)}`
|
|
3016
3016
|
);
|
|
3017
3017
|
}
|
|
3018
3018
|
}
|
|
@@ -3038,14 +3038,14 @@ const ps = ["task", "project", "comment", "section"], Rn = {
|
|
|
3038
3038
|
throw new Error(
|
|
3039
3039
|
'Invalid ID format. Expected "task:{id}" or "project:{id}". Example: "task:8485093748" or "project:6cfCcrrCFg2xP94Q"'
|
|
3040
3040
|
);
|
|
3041
|
-
let
|
|
3041
|
+
let i;
|
|
3042
3042
|
if (o === "task") {
|
|
3043
|
-
const
|
|
3043
|
+
const a = await t.getTask(n), c = P(a), d = [c.content];
|
|
3044
3044
|
c.description && d.push(`
|
|
3045
3045
|
|
|
3046
3046
|
Description: ${c.description}`), c.dueDate && d.push(`
|
|
3047
3047
|
Due: ${c.dueDate}`), c.labels.length > 0 && d.push(`
|
|
3048
|
-
Labels: ${c.labels.join(", ")}`),
|
|
3048
|
+
Labels: ${c.labels.join(", ")}`), i = {
|
|
3049
3049
|
id: `task:${c.id}`,
|
|
3050
3050
|
title: c.content,
|
|
3051
3051
|
text: d.join(""),
|
|
@@ -3064,13 +3064,13 @@ Labels: ${c.labels.join(", ")}`), a = {
|
|
|
3064
3064
|
}
|
|
3065
3065
|
};
|
|
3066
3066
|
} else {
|
|
3067
|
-
const
|
|
3067
|
+
const a = await t.getProject(n), c = Z(a), d = [c.name];
|
|
3068
3068
|
c.description && d.push(`
|
|
3069
3069
|
|
|
3070
3070
|
Description: ${c.description}`), c.isShared && d.push(`
|
|
3071
3071
|
|
|
3072
3072
|
Shared project`), c.isFavorite && d.push(`
|
|
3073
|
-
Favorite: Yes`),
|
|
3073
|
+
Favorite: Yes`), i = {
|
|
3074
3074
|
id: `project:${c.id}`,
|
|
3075
3075
|
title: c.name,
|
|
3076
3076
|
text: d.join(""),
|
|
@@ -3086,8 +3086,8 @@ Favorite: Yes`), a = {
|
|
|
3086
3086
|
};
|
|
3087
3087
|
}
|
|
3088
3088
|
return {
|
|
3089
|
-
textContent: JSON.stringify(
|
|
3090
|
-
structuredContent:
|
|
3089
|
+
textContent: JSON.stringify(i),
|
|
3090
|
+
structuredContent: i
|
|
3091
3091
|
};
|
|
3092
3092
|
}
|
|
3093
3093
|
}, Hn = s.union([s.iso.date(), s.iso.datetime({ offset: !0 })]);
|
|
@@ -3110,7 +3110,9 @@ const Wn = {
|
|
|
3110
3110
|
]).optional().describe("Type of event to filter by."),
|
|
3111
3111
|
projectId: s.string().optional().describe("Filter events by parent project ID."),
|
|
3112
3112
|
taskId: s.string().optional().describe("Filter events by parent task ID (for subtask events)."),
|
|
3113
|
-
initiatorId: s.string().optional().describe(
|
|
3113
|
+
initiatorId: s.string().optional().describe(
|
|
3114
|
+
'Filter by the user ID who initiated the event. A first-person question ("what did I complete") needs this: without it the results cover every collaborator. Get the ID from user-info when you do not already have it.'
|
|
3115
|
+
),
|
|
3114
3116
|
dateFrom: St(
|
|
3115
3117
|
`Inclusive start of the activity range, as an ISO 8601 date or date-time. For all events on one local calendar day, use that day's start, for example "2026-08-02T00:00:00-04:00". Natural-language dates such as "tomorrow" are not supported.`
|
|
3116
3118
|
),
|
|
@@ -3127,7 +3129,7 @@ const Wn = {
|
|
|
3127
3129
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
3128
3130
|
}, zn = {
|
|
3129
3131
|
name: g.FIND_ACTIVITY,
|
|
3130
|
-
description:
|
|
3132
|
+
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.`,
|
|
3131
3133
|
parameters: Wn,
|
|
3132
3134
|
outputSchema: Bn,
|
|
3133
3135
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
@@ -3136,8 +3138,8 @@ const Wn = {
|
|
|
3136
3138
|
objectType: r,
|
|
3137
3139
|
objectId: o,
|
|
3138
3140
|
eventType: n,
|
|
3139
|
-
projectId:
|
|
3140
|
-
taskId:
|
|
3141
|
+
projectId: i,
|
|
3142
|
+
taskId: a,
|
|
3141
3143
|
initiatorId: c,
|
|
3142
3144
|
dateFrom: d,
|
|
3143
3145
|
dateTo: l,
|
|
@@ -3147,10 +3149,10 @@ const Wn = {
|
|
|
3147
3149
|
limit: u,
|
|
3148
3150
|
cursor: p ?? null
|
|
3149
3151
|
};
|
|
3150
|
-
r && n ? m.objectEventTypes = `${r}:${n}` : r ? m.objectEventTypes = `${r}:` : n && (m.objectEventTypes = `:${n}`), o && o !== "remove" && (m.objectId = o),
|
|
3152
|
+
r && n ? m.objectEventTypes = `${r}:${n}` : r ? m.objectEventTypes = `${r}:` : n && (m.objectEventTypes = `:${n}`), o && o !== "remove" && (m.objectId = o), i && (m.parentProjectId = i), a && (m.parentItemId = a), c && (m.initiatorId = c), d && (m.dateFrom = d), l && (m.dateTo = l);
|
|
3151
3153
|
const { results: h, nextCursor: y } = await t.getActivityLogs(m), f = h.map(po);
|
|
3152
3154
|
return {
|
|
3153
|
-
textContent:
|
|
3155
|
+
textContent: qn({ events: f, args: e, nextCursor: y }),
|
|
3154
3156
|
structuredContent: {
|
|
3155
3157
|
events: f,
|
|
3156
3158
|
nextCursor: y ?? void 0,
|
|
@@ -3161,7 +3163,7 @@ const Wn = {
|
|
|
3161
3163
|
};
|
|
3162
3164
|
}
|
|
3163
3165
|
};
|
|
3164
|
-
function
|
|
3166
|
+
function qn({
|
|
3165
3167
|
events: e,
|
|
3166
3168
|
args: t,
|
|
3167
3169
|
nextCursor: r
|
|
@@ -3173,20 +3175,20 @@ function Kn({
|
|
|
3173
3175
|
n.push(c);
|
|
3174
3176
|
}
|
|
3175
3177
|
n.length > 0 && (o = `Activity: ${n.join(" ")}`);
|
|
3176
|
-
const a = [];
|
|
3177
|
-
t.objectId && a.push(`object ID: ${t.objectId}`), t.projectId && a.push(`project: ${t.projectId}`), t.taskId && a.push(`task: ${t.taskId}`), t.initiatorId && a.push(`initiator: ${t.initiatorId}`), t.dateFrom && a.push(`from: ${t.dateFrom}`), t.dateTo && a.push(`until (exclusive): ${t.dateTo}`);
|
|
3178
3178
|
const i = [];
|
|
3179
|
-
|
|
3179
|
+
t.objectId && i.push(`object ID: ${t.objectId}`), t.projectId && i.push(`project: ${t.projectId}`), t.taskId && i.push(`task: ${t.taskId}`), t.initiatorId && i.push(`initiator: ${t.initiatorId}`), t.dateFrom && i.push(`from: ${t.dateFrom}`), t.dateTo && i.push(`until (exclusive): ${t.dateTo}`);
|
|
3180
|
+
const a = [];
|
|
3181
|
+
return e.length === 0 && (a.push("No activity events match the specified filters"), a.push("Note: Activity logs only show recent events"), t.eventType && a.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && a.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && a.push("Verify the object ID is correct")), K({
|
|
3180
3182
|
subject: o,
|
|
3181
3183
|
count: e.length,
|
|
3182
3184
|
limit: t.limit,
|
|
3183
3185
|
nextCursor: r ?? void 0,
|
|
3184
|
-
filterHints:
|
|
3185
|
-
previewLines:
|
|
3186
|
-
zeroReasonHints:
|
|
3186
|
+
filterHints: i,
|
|
3187
|
+
previewLines: Kn(e, Math.min(e.length, t.limit)),
|
|
3188
|
+
zeroReasonHints: a
|
|
3187
3189
|
});
|
|
3188
3190
|
}
|
|
3189
|
-
function
|
|
3191
|
+
function Kn(e, t = 10) {
|
|
3190
3192
|
const o = e.slice(0, t).map(Yn).join(`
|
|
3191
3193
|
`);
|
|
3192
3194
|
if (e.length > t) {
|
|
@@ -3203,8 +3205,8 @@ function Yn(e) {
|
|
|
3203
3205
|
const c = e.extraData.content || e.extraData.name || e.extraData.last_content;
|
|
3204
3206
|
c && typeof c == "string" && (o = ` • "${c.length > 50 ? `${c.substring(0, 47)}...` : c}"`);
|
|
3205
3207
|
}
|
|
3206
|
-
const n = e.objectId ? ` • id=${e.objectId}` : "",
|
|
3207
|
-
return ` [${t}] ${r}${o}${n}${
|
|
3208
|
+
const n = e.objectId ? ` • id=${e.objectId}` : "", i = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", a = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
|
|
3209
|
+
return ` [${t}] ${r}${o}${n}${i}${a}`;
|
|
3208
3210
|
}
|
|
3209
3211
|
function Gn(e) {
|
|
3210
3212
|
try {
|
|
@@ -3254,40 +3256,40 @@ const Vn = {
|
|
|
3254
3256
|
projectId: e.projectId,
|
|
3255
3257
|
client: t
|
|
3256
3258
|
});
|
|
3257
|
-
let n = !1,
|
|
3259
|
+
let n = !1, i = null, a;
|
|
3258
3260
|
if (e.commentId)
|
|
3259
|
-
|
|
3261
|
+
a = [await t.getComment(e.commentId)];
|
|
3260
3262
|
else if (e.taskId) {
|
|
3261
3263
|
const l = await t.getComments({
|
|
3262
3264
|
taskId: e.taskId,
|
|
3263
3265
|
cursor: e.cursor || null,
|
|
3264
3266
|
limit: e.limit || C.COMMENTS_DEFAULT
|
|
3265
3267
|
});
|
|
3266
|
-
|
|
3268
|
+
a = l.results, n = l.nextCursor !== null, i = l.nextCursor;
|
|
3267
3269
|
} else if (o) {
|
|
3268
3270
|
const l = await t.getComments({
|
|
3269
3271
|
projectId: o,
|
|
3270
3272
|
cursor: e.cursor || null,
|
|
3271
3273
|
limit: e.limit || C.COMMENTS_DEFAULT
|
|
3272
3274
|
});
|
|
3273
|
-
|
|
3275
|
+
a = l.results, n = l.nextCursor !== null, i = l.nextCursor;
|
|
3274
3276
|
} else
|
|
3275
3277
|
throw new Error("Invalid state: no search parameter provided");
|
|
3276
|
-
const c =
|
|
3278
|
+
const c = a.map(ge);
|
|
3277
3279
|
return {
|
|
3278
3280
|
textContent: Zn({
|
|
3279
3281
|
comments: c,
|
|
3280
3282
|
searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
|
|
3281
3283
|
searchId: e.commentId || e.taskId || e.projectId || "",
|
|
3282
3284
|
hasMore: n,
|
|
3283
|
-
nextCursor:
|
|
3285
|
+
nextCursor: i
|
|
3284
3286
|
}),
|
|
3285
3287
|
structuredContent: {
|
|
3286
3288
|
comments: c,
|
|
3287
3289
|
searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
|
|
3288
3290
|
searchId: e.commentId || e.taskId || e.projectId || "",
|
|
3289
3291
|
hasMore: n,
|
|
3290
|
-
nextCursor:
|
|
3292
|
+
nextCursor: i ?? void 0,
|
|
3291
3293
|
totalCount: c.length
|
|
3292
3294
|
}
|
|
3293
3295
|
};
|
|
@@ -3302,22 +3304,22 @@ function Zn({
|
|
|
3302
3304
|
}) {
|
|
3303
3305
|
if (e.length === 0)
|
|
3304
3306
|
return `No comments found for ${t}${t !== "single" ? ` ${r}` : ""}`;
|
|
3305
|
-
let
|
|
3307
|
+
let i;
|
|
3306
3308
|
if (t === "single") {
|
|
3307
|
-
const
|
|
3308
|
-
if (!
|
|
3309
|
+
const a = e[0];
|
|
3310
|
+
if (!a)
|
|
3309
3311
|
return "Comment not found";
|
|
3310
|
-
|
|
3312
|
+
i = `Found comment${a.fileAttachment !== void 0 ? ` • Has attachment: ${a.fileAttachment?.fileName || "file"}` : ""} • id=${a.id}`;
|
|
3311
3313
|
} else {
|
|
3312
|
-
const
|
|
3313
|
-
|
|
3314
|
+
const a = e.filter((l) => l.fileAttachment !== void 0).length, c = a > 0 ? ` (${a} with attachments)` : "", d = e.length === 1 ? "comment" : "comments";
|
|
3315
|
+
i = `Found ${e.length} ${d} for ${t} ${r}${c}`, o && (i += " • More available");
|
|
3314
3316
|
}
|
|
3315
3317
|
if (n) {
|
|
3316
|
-
const
|
|
3317
|
-
return `${
|
|
3318
|
-
${
|
|
3318
|
+
const a = is([], n);
|
|
3319
|
+
return `${i}
|
|
3320
|
+
${a}`;
|
|
3319
3321
|
}
|
|
3320
|
-
return
|
|
3322
|
+
return i;
|
|
3321
3323
|
}
|
|
3322
3324
|
function ms(e) {
|
|
3323
3325
|
const t = e.getUTCFullYear(), r = String(e.getUTCMonth() + 1).padStart(2, "0"), o = String(e.getUTCDate()).padStart(2, "0");
|
|
@@ -3327,45 +3329,45 @@ function Qn(e) {
|
|
|
3327
3329
|
const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
|
|
3328
3330
|
if (!t)
|
|
3329
3331
|
return 0;
|
|
3330
|
-
const [, r, o, n] = t,
|
|
3331
|
-
return r === "-" ? -
|
|
3332
|
+
const [, r, o, n] = t, i = Number(o) * 60 + Number(n);
|
|
3333
|
+
return r === "-" ? -i : i;
|
|
3332
3334
|
}
|
|
3333
|
-
function
|
|
3335
|
+
function ei(e, t) {
|
|
3334
3336
|
const r = new Date(e.getTime() + t * 60 * 1e3);
|
|
3335
3337
|
return ms(r);
|
|
3336
3338
|
}
|
|
3337
3339
|
function jt(e, t) {
|
|
3338
|
-
const [r, o, n] = e.split("-"),
|
|
3339
|
-
if (!Number.isFinite(
|
|
3340
|
+
const [r, o, n] = e.split("-"), i = Number(r), a = Number(o), c = Number(n);
|
|
3341
|
+
if (!Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(c))
|
|
3340
3342
|
throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD.`);
|
|
3341
|
-
const d = new Date(Date.UTC(
|
|
3343
|
+
const d = new Date(Date.UTC(i, a - 1, c));
|
|
3342
3344
|
return d.setUTCDate(d.getUTCDate() + t), ms(d);
|
|
3343
3345
|
}
|
|
3344
|
-
const
|
|
3346
|
+
const ti = ["and", "or"], ct = {
|
|
3345
3347
|
labels: s.string().array().optional().describe("The labels to filter the tasks by"),
|
|
3346
|
-
labelsOperator: s.enum(
|
|
3348
|
+
labelsOperator: s.enum(ti).optional().describe(
|
|
3347
3349
|
'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
|
|
3348
3350
|
)
|
|
3349
3351
|
};
|
|
3350
3352
|
function dt(e = [], t = "or") {
|
|
3351
3353
|
if (e.length === 0) return "";
|
|
3352
3354
|
const r = t === "and" ? " & " : " | ";
|
|
3353
|
-
return `(${e.map((
|
|
3355
|
+
return `(${e.map((i) => i.startsWith("@") ? i : `@${i}`).join(` ${r} `)})`;
|
|
3354
3356
|
}
|
|
3355
|
-
const
|
|
3356
|
-
function
|
|
3357
|
+
const si = 7;
|
|
3358
|
+
function ri({
|
|
3357
3359
|
since: e,
|
|
3358
3360
|
until: t,
|
|
3359
3361
|
userGmtOffset: r,
|
|
3360
3362
|
now: o = /* @__PURE__ */ new Date()
|
|
3361
3363
|
}) {
|
|
3362
|
-
const n = Qn(r),
|
|
3364
|
+
const n = Qn(r), i = ei(o, n), a = si - 1, c = t ?? (e ? jt(e, a) : i);
|
|
3363
3365
|
return {
|
|
3364
|
-
since: e ?? jt(c, -
|
|
3366
|
+
since: e ?? jt(c, -a),
|
|
3365
3367
|
until: c
|
|
3366
3368
|
};
|
|
3367
3369
|
}
|
|
3368
|
-
const
|
|
3370
|
+
const oi = {
|
|
3369
3371
|
getBy: s.enum(["completion", "due"]).default("completion").describe(
|
|
3370
3372
|
'The method to use to get the tasks: "completion" to get tasks by completion date (ie, when the task was actually completed), "due" to get tasks by due date (ie, when the task was due to be completed by).'
|
|
3371
3373
|
),
|
|
@@ -3389,21 +3391,21 @@ const oa = {
|
|
|
3389
3391
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
3390
3392
|
),
|
|
3391
3393
|
...ct
|
|
3392
|
-
},
|
|
3394
|
+
}, ni = {
|
|
3393
3395
|
tasks: s.array(F).describe("The found completed tasks."),
|
|
3394
3396
|
nextCursor: s.string().optional(),
|
|
3395
3397
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
3396
3398
|
hasMore: s.boolean(),
|
|
3397
3399
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
3398
|
-
},
|
|
3400
|
+
}, ii = {
|
|
3399
3401
|
name: g.FIND_COMPLETED_TASKS,
|
|
3400
|
-
description:
|
|
3401
|
-
parameters:
|
|
3402
|
-
outputSchema:
|
|
3402
|
+
description: 'Get completed tasks in a date range. For "what did I complete/get done" questions, use find-activity instead — it reports completion events, including every occurrence of a recurring task, which this tool does not. since/until are optional and default to a 7-day window when omitted. Includes all collaborators by default. Person-specific queries (summaries, plans, reports) require responsibleUser.',
|
|
3403
|
+
parameters: oi,
|
|
3404
|
+
outputSchema: ni,
|
|
3403
3405
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3404
3406
|
async execute(e, t) {
|
|
3405
|
-
const { getBy: r, labels: o, labelsOperator: n, since:
|
|
3406
|
-
if (e.cursor && (!
|
|
3407
|
+
const { getBy: r, labels: o, labelsOperator: n, since: i, until: a, responsibleUser: c, projectId: d, ...l } = e;
|
|
3408
|
+
if (e.cursor && (!i || !a))
|
|
3407
3409
|
throw new Error(
|
|
3408
3410
|
"Cursor pagination requires explicit since and until. Reuse structuredContent.appliedFilters.since and structuredContent.appliedFilters.until from the previous page."
|
|
3409
3411
|
);
|
|
@@ -3413,9 +3415,9 @@ const oa = {
|
|
|
3413
3415
|
const y = await t.getUser(), f = y.tzInfo?.gmtString || "+00:00", v = await de({
|
|
3414
3416
|
projectId: d,
|
|
3415
3417
|
user: y
|
|
3416
|
-
}), j =
|
|
3417
|
-
since:
|
|
3418
|
-
until:
|
|
3418
|
+
}), j = ri({
|
|
3419
|
+
since: i,
|
|
3420
|
+
until: a,
|
|
3419
3421
|
userGmtOffset: f
|
|
3420
3422
|
}), A = `${j.since}T00:00:00${f}`, k = `${j.until}T23:59:59${f}`, I = new Date(A).toISOString(), x = new Date(k).toISOString(), T = {
|
|
3421
3423
|
...e,
|
|
@@ -3435,7 +3437,7 @@ const oa = {
|
|
|
3435
3437
|
...h ? { filterQuery: h, filterLang: "en" } : {}
|
|
3436
3438
|
}), $ = b.map(P);
|
|
3437
3439
|
return {
|
|
3438
|
-
textContent:
|
|
3440
|
+
textContent: ai({
|
|
3439
3441
|
tasks: $,
|
|
3440
3442
|
args: T,
|
|
3441
3443
|
nextCursor: S,
|
|
@@ -3451,33 +3453,33 @@ const oa = {
|
|
|
3451
3453
|
};
|
|
3452
3454
|
}
|
|
3453
3455
|
};
|
|
3454
|
-
function
|
|
3456
|
+
function ai({
|
|
3455
3457
|
tasks: e,
|
|
3456
3458
|
args: t,
|
|
3457
3459
|
nextCursor: r,
|
|
3458
3460
|
assigneeEmail: o
|
|
3459
3461
|
}) {
|
|
3460
|
-
const n = t.getBy === "completion" ? "completed" : "due",
|
|
3461
|
-
if (
|
|
3462
|
+
const n = t.getBy === "completion" ? "completed" : "due", i = `Completed tasks (by ${n} date)`, a = [];
|
|
3463
|
+
if (a.push(`${n} date: ${t.since} to ${t.until}`), t.projectId && a.push(`project: ${t.projectId}`), t.sectionId && a.push(`section: ${t.sectionId}`), t.parentId && a.push(`parent: ${t.parentId}`), t.workspaceId && a.push(`workspace: ${t.workspaceId}`), t.labels && t.labels.length > 0) {
|
|
3462
3464
|
const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
3463
|
-
|
|
3465
|
+
a.push(`labels: ${d}`);
|
|
3464
3466
|
}
|
|
3465
3467
|
if (t.responsibleUser) {
|
|
3466
3468
|
const d = o || t.responsibleUser;
|
|
3467
|
-
|
|
3469
|
+
a.push(`assigned to: ${d}`);
|
|
3468
3470
|
}
|
|
3469
3471
|
const c = [];
|
|
3470
|
-
return e.length === 0 && (c.push("No tasks completed in this date range"), c.push("Try expanding the date range"), (t.projectId || t.sectionId || t.parentId) && c.push("Try removing project/section/parent filters"), t.getBy === "due" && c.push('Try switching to "completion" date instead')),
|
|
3471
|
-
subject:
|
|
3472
|
+
return e.length === 0 && (c.push("No tasks completed in this date range"), c.push("Try expanding the date range"), (t.projectId || t.sectionId || t.parentId) && c.push("Try removing project/section/parent filters"), t.getBy === "due" && c.push('Try switching to "completion" date instead')), K({
|
|
3473
|
+
subject: i,
|
|
3472
3474
|
count: e.length,
|
|
3473
3475
|
limit: t.limit,
|
|
3474
3476
|
nextCursor: r ?? void 0,
|
|
3475
|
-
filterHints:
|
|
3477
|
+
filterHints: a,
|
|
3476
3478
|
previewLines: Se(e, Math.min(e.length, t.limit)),
|
|
3477
3479
|
zeroReasonHints: c
|
|
3478
3480
|
});
|
|
3479
3481
|
}
|
|
3480
|
-
const
|
|
3482
|
+
const ci = {
|
|
3481
3483
|
searchText: s.string().optional().describe(
|
|
3482
3484
|
'Search for a label by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all labels are returned.'
|
|
3483
3485
|
),
|
|
@@ -3485,7 +3487,7 @@ const ca = {
|
|
|
3485
3487
|
cursor: s.string().optional().describe(
|
|
3486
3488
|
"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."
|
|
3487
3489
|
)
|
|
3488
|
-
},
|
|
3490
|
+
}, di = {
|
|
3489
3491
|
labels: s.array(pe).describe("The found personal labels."),
|
|
3490
3492
|
nextCursor: s.string().optional(),
|
|
3491
3493
|
totalCount: s.number().describe("The total number of labels in this page."),
|
|
@@ -3494,11 +3496,11 @@ const ca = {
|
|
|
3494
3496
|
"Names of all shared labels visible to you. These have no IDs or metadata — use their names directly when filtering tasks."
|
|
3495
3497
|
),
|
|
3496
3498
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
3497
|
-
},
|
|
3499
|
+
}, li = {
|
|
3498
3500
|
name: g.FIND_LABELS,
|
|
3499
3501
|
description: "List personal labels and shared labels. Personal labels have full metadata (id, name, color, order, isFavorite) and support pagination and name search (partial, case insensitive). Shared labels are labels used on tasks shared with you — they are returned as names only (no IDs or metadata). When searching, all matching personal labels are fetched across all pages and returned as a single result set (limit and cursor are ignored). When not searching, personal labels are returned with pagination.",
|
|
3500
|
-
parameters:
|
|
3501
|
-
outputSchema:
|
|
3502
|
+
parameters: ci,
|
|
3503
|
+
outputSchema: di,
|
|
3502
3504
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3503
3505
|
async execute(e, t) {
|
|
3504
3506
|
const [r, o] = await Promise.all([
|
|
@@ -3507,53 +3509,53 @@ const ca = {
|
|
|
3507
3509
|
nextCursor: null
|
|
3508
3510
|
})) : t.getLabels({ limit: e.limit, cursor: e.cursor ?? null }),
|
|
3509
3511
|
lo(t)
|
|
3510
|
-
]), { results: n, nextCursor:
|
|
3512
|
+
]), { results: n, nextCursor: i } = r, a = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
|
|
3511
3513
|
return {
|
|
3512
|
-
textContent:
|
|
3514
|
+
textContent: ui({ labels: n, args: e, nextCursor: i, sharedLabels: o }),
|
|
3513
3515
|
structuredContent: {
|
|
3514
3516
|
labels: n.map((c) => pe.parse(c)),
|
|
3515
|
-
nextCursor:
|
|
3517
|
+
nextCursor: i ?? void 0,
|
|
3516
3518
|
totalCount: n.length,
|
|
3517
|
-
hasMore: !!
|
|
3519
|
+
hasMore: !!i,
|
|
3518
3520
|
sharedLabels: o,
|
|
3519
|
-
appliedFilters:
|
|
3521
|
+
appliedFilters: a
|
|
3520
3522
|
}
|
|
3521
3523
|
};
|
|
3522
3524
|
}
|
|
3523
3525
|
};
|
|
3524
|
-
function
|
|
3526
|
+
function ui({
|
|
3525
3527
|
labels: e,
|
|
3526
3528
|
args: t,
|
|
3527
3529
|
nextCursor: r,
|
|
3528
3530
|
sharedLabels: o
|
|
3529
3531
|
}) {
|
|
3530
|
-
const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels",
|
|
3531
|
-
t.searchText &&
|
|
3532
|
-
const
|
|
3533
|
-
`), l = e.length -
|
|
3532
|
+
const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", i = [];
|
|
3533
|
+
t.searchText && i.push(`searchText: "${t.searchText}"`);
|
|
3534
|
+
const a = 10, d = e.slice(0, a).map(Mo).join(`
|
|
3535
|
+
`), l = e.length - a, u = l > 0 ? `${d}
|
|
3534
3536
|
…and ${l} more` : d, p = [];
|
|
3535
3537
|
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"));
|
|
3536
3538
|
const m = o.length > 0 ? `
|
|
3537
3539
|
Shared labels (${o.length}): ${o.join(", ")}` : `
|
|
3538
3540
|
No shared labels.`;
|
|
3539
|
-
return
|
|
3541
|
+
return K({
|
|
3540
3542
|
subject: n,
|
|
3541
3543
|
count: e.length,
|
|
3542
3544
|
limit: t.searchText ? void 0 : t.limit,
|
|
3543
3545
|
nextCursor: r ?? void 0,
|
|
3544
|
-
filterHints:
|
|
3546
|
+
filterHints: i,
|
|
3545
3547
|
previewLines: u,
|
|
3546
3548
|
zeroReasonHints: p
|
|
3547
3549
|
}) + m;
|
|
3548
3550
|
}
|
|
3549
|
-
const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g,
|
|
3551
|
+
const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pi = {
|
|
3550
3552
|
projectId: s.string().min(1).optional().describe(
|
|
3551
3553
|
'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.'
|
|
3552
3554
|
),
|
|
3553
3555
|
searchTerm: s.string().optional().describe(
|
|
3554
3556
|
"Search for a user by name or email (partial and case insensitive match). If omitted, all users are returned."
|
|
3555
3557
|
)
|
|
3556
|
-
},
|
|
3558
|
+
}, mi = {
|
|
3557
3559
|
collaborators: s.array(yo).describe("The found users."),
|
|
3558
3560
|
projectInfo: s.object({
|
|
3559
3561
|
id: s.string().describe("The project ID."),
|
|
@@ -3563,21 +3565,21 @@ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
|
|
|
3563
3565
|
totalCount: s.number().describe("The total number of users found."),
|
|
3564
3566
|
totalAvailable: s.number().optional().describe("The total number of available users before the search filter was applied."),
|
|
3565
3567
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
3566
|
-
},
|
|
3568
|
+
}, hi = {
|
|
3567
3569
|
name: g.FIND_PROJECT_COLLABORATORS,
|
|
3568
3570
|
description: `Find Todoist users (collaborators, teammates) by name or email to look up their user ID. Use this whenever the user asks to find, look up, or identify a person — e.g. "find Carrie's user ID", "who is Ernesto", "look up a user". When projectId is omitted, searches across the collaborators of every shared project the authenticated user has access to, plus the authenticated user themselves — an empty result means the person is not a collaborator on any project you share with them, not necessarily that they do not exist in Todoist. When projectId is provided, searches only that project. Partial, case-insensitive match on name and email.`,
|
|
3569
|
-
parameters:
|
|
3570
|
-
outputSchema:
|
|
3571
|
+
parameters: pi,
|
|
3572
|
+
outputSchema: mi,
|
|
3571
3573
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3572
3574
|
async execute(e, t) {
|
|
3573
3575
|
const { projectId: r, searchTerm: o } = e;
|
|
3574
3576
|
if (!r)
|
|
3575
|
-
return
|
|
3576
|
-
let n = r,
|
|
3577
|
+
return fi({ searchTerm: o, client: t, appliedFilters: e });
|
|
3578
|
+
let n = r, i;
|
|
3577
3579
|
try {
|
|
3578
|
-
if (
|
|
3580
|
+
if (i = await t.getProject(r), !i)
|
|
3579
3581
|
throw new Error(`Project with ID "${r}" not found or not accessible`);
|
|
3580
|
-
if (n =
|
|
3582
|
+
if (n = i.name, !i.isShared)
|
|
3581
3583
|
return {
|
|
3582
3584
|
textContent: `Project "${n}" is not shared and has no collaborators.
|
|
3583
3585
|
|
|
@@ -3600,8 +3602,8 @@ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
|
|
|
3600
3602
|
`Failed to access project "${r}": ${l instanceof Error ? l.message : "Unknown error"}`
|
|
3601
3603
|
);
|
|
3602
3604
|
}
|
|
3603
|
-
const
|
|
3604
|
-
if (
|
|
3605
|
+
const a = await W.getProjectCollaborators(t, r);
|
|
3606
|
+
if (a.length === 0)
|
|
3605
3607
|
return {
|
|
3606
3608
|
textContent: `Project "${n}" has no collaborators or collaborator data is not accessible.
|
|
3607
3609
|
|
|
@@ -3620,13 +3622,13 @@ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
|
|
|
3620
3622
|
appliedFilters: e
|
|
3621
3623
|
}
|
|
3622
3624
|
};
|
|
3623
|
-
const c = gs(
|
|
3625
|
+
const c = gs(a, o);
|
|
3624
3626
|
return {
|
|
3625
3627
|
textContent: ys({
|
|
3626
3628
|
collaborators: c,
|
|
3627
3629
|
projectName: n,
|
|
3628
3630
|
searchTerm: o,
|
|
3629
|
-
totalAvailable:
|
|
3631
|
+
totalAvailable: a.length
|
|
3630
3632
|
}),
|
|
3631
3633
|
structuredContent: {
|
|
3632
3634
|
collaborators: c,
|
|
@@ -3636,18 +3638,18 @@ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
|
|
|
3636
3638
|
isShared: !0
|
|
3637
3639
|
},
|
|
3638
3640
|
totalCount: c.length,
|
|
3639
|
-
totalAvailable:
|
|
3641
|
+
totalAvailable: a.length,
|
|
3640
3642
|
appliedFilters: e
|
|
3641
3643
|
}
|
|
3642
3644
|
};
|
|
3643
3645
|
}
|
|
3644
3646
|
};
|
|
3645
|
-
async function
|
|
3647
|
+
async function fi({
|
|
3646
3648
|
searchTerm: e,
|
|
3647
3649
|
client: t,
|
|
3648
3650
|
appliedFilters: r
|
|
3649
3651
|
}) {
|
|
3650
|
-
const o = await W.getAllCollaborators(t), n = await
|
|
3652
|
+
const o = await W.getAllCollaborators(t), n = await bi(t, o);
|
|
3651
3653
|
if (n.length === 0)
|
|
3652
3654
|
return {
|
|
3653
3655
|
textContent: `No users found. You may have no shared projects, or collaborator data is not accessible.
|
|
@@ -3664,24 +3666,24 @@ async function fa({
|
|
|
3664
3666
|
appliedFilters: r
|
|
3665
3667
|
}
|
|
3666
3668
|
};
|
|
3667
|
-
const
|
|
3669
|
+
const i = gs(n, e);
|
|
3668
3670
|
return {
|
|
3669
3671
|
textContent: ys({
|
|
3670
|
-
collaborators:
|
|
3672
|
+
collaborators: i,
|
|
3671
3673
|
projectName: void 0,
|
|
3672
3674
|
searchTerm: e,
|
|
3673
3675
|
totalAvailable: n.length
|
|
3674
3676
|
}),
|
|
3675
3677
|
structuredContent: {
|
|
3676
|
-
collaborators:
|
|
3678
|
+
collaborators: i,
|
|
3677
3679
|
projectInfo: void 0,
|
|
3678
|
-
totalCount:
|
|
3680
|
+
totalCount: i.length,
|
|
3679
3681
|
totalAvailable: n.length,
|
|
3680
3682
|
appliedFilters: r
|
|
3681
3683
|
}
|
|
3682
3684
|
};
|
|
3683
3685
|
}
|
|
3684
|
-
async function
|
|
3686
|
+
async function bi(e, t) {
|
|
3685
3687
|
try {
|
|
3686
3688
|
const r = await e.getUser();
|
|
3687
3689
|
return !r || t.some((o) => o.id === r.id) ? t : [
|
|
@@ -3706,7 +3708,7 @@ function ys({
|
|
|
3706
3708
|
searchTerm: r,
|
|
3707
3709
|
totalAvailable: o
|
|
3708
3710
|
}) {
|
|
3709
|
-
const n = t ? `project "${t}"` : "workspace",
|
|
3711
|
+
const n = t ? `project "${t}"` : "workspace", i = t ? "Project collaborators" : "Workspace users", a = r ? `${i} matching "${r}"` : i, c = [];
|
|
3710
3712
|
r && c.push(`matching "${r}"`), c.push(`in ${n}`);
|
|
3711
3713
|
let d = [];
|
|
3712
3714
|
e.length > 0 && (d = e.slice(0, 10).map((p) => {
|
|
@@ -3716,8 +3718,8 @@ function ys({
|
|
|
3716
3718
|
const l = [];
|
|
3717
3719
|
e.length === 0 && r && (l.push(`No users match "${r}"`), l.push("Try a broader search term or check spelling"), o > 0 && l.push(`${o} users available without filter`));
|
|
3718
3720
|
const u = [];
|
|
3719
|
-
return e.length > 0 ? (u.push(`Use ${fs} with responsibleUser to assign new tasks`), u.push(`Use ${bs} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${hs} to find other projects`), r && o > 0 && u.push("Try searching without filters to see all users")),
|
|
3720
|
-
subject:
|
|
3721
|
+
return e.length > 0 ? (u.push(`Use ${fs} with responsibleUser to assign new tasks`), u.push(`Use ${bs} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${hs} to find other projects`), r && o > 0 && u.push("Try searching without filters to see all users")), K({
|
|
3722
|
+
subject: a,
|
|
3721
3723
|
count: e.length,
|
|
3722
3724
|
filterHints: c,
|
|
3723
3725
|
previewLines: d.join(`
|
|
@@ -3726,11 +3728,11 @@ function ys({
|
|
|
3726
3728
|
nextSteps: u
|
|
3727
3729
|
});
|
|
3728
3730
|
}
|
|
3729
|
-
const { ADD_PROJECTS: Ct } = g,
|
|
3731
|
+
const { ADD_PROJECTS: Ct } = g, gi = {
|
|
3730
3732
|
active: "projects",
|
|
3731
3733
|
archived: "archived projects",
|
|
3732
3734
|
all: "projects (active and archived)"
|
|
3733
|
-
},
|
|
3735
|
+
}, yi = {
|
|
3734
3736
|
searchText: s.string().optional().describe(
|
|
3735
3737
|
'Search for a project by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all projects are returned.'
|
|
3736
3738
|
),
|
|
@@ -3741,96 +3743,96 @@ const { ADD_PROJECTS: Ct } = g, ga = {
|
|
|
3741
3743
|
archivedStatus: s.enum(["active", "archived", "all"]).optional().describe(
|
|
3742
3744
|
"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')."
|
|
3743
3745
|
)
|
|
3744
|
-
},
|
|
3746
|
+
}, Ti = {
|
|
3745
3747
|
projects: s.array(Q).describe("The found projects."),
|
|
3746
3748
|
nextCursor: s.string().optional(),
|
|
3747
3749
|
totalCount: s.number().describe("The total number of projects in this page."),
|
|
3748
3750
|
hasMore: s.boolean(),
|
|
3749
3751
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
3750
|
-
},
|
|
3752
|
+
}, ki = {
|
|
3751
3753
|
name: g.FIND_PROJECTS,
|
|
3752
3754
|
description: "List all projects or search for projects by name. By default only active projects are returned; use archivedStatus ('archived' or 'all') to include archived projects. When searching or when archivedStatus is 'all', all matching projects are returned (pagination is ignored). Otherwise projects are returned with pagination.",
|
|
3753
|
-
parameters:
|
|
3754
|
-
outputSchema:
|
|
3755
|
+
parameters: yi,
|
|
3756
|
+
outputSchema: Ti,
|
|
3755
3757
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3756
3758
|
async execute(e, t) {
|
|
3757
3759
|
const { searchText: r } = e, o = e.archivedStatus ?? "active";
|
|
3758
|
-
let n,
|
|
3760
|
+
let n, i = null;
|
|
3759
3761
|
if (r || o === "all") {
|
|
3760
3762
|
const c = Promise.resolve([]), [d, l] = await Promise.all([
|
|
3761
3763
|
o === "archived" ? c : r ? rs(t, r) : os(t),
|
|
3762
|
-
o === "active" ? c :
|
|
3763
|
-
]), u = r ?
|
|
3764
|
+
o === "active" ? c : io(t)
|
|
3765
|
+
]), u = r ? ao(r) : null, p = u ? l.filter((m) => u.test(m.name)) : l;
|
|
3764
3766
|
n = [...d, ...p];
|
|
3765
3767
|
} else {
|
|
3766
3768
|
const c = o === "archived" ? await t.getArchivedProjects({
|
|
3767
3769
|
limit: e.limit,
|
|
3768
3770
|
cursor: e.cursor ?? null
|
|
3769
3771
|
}) : await t.getProjects({ limit: e.limit, cursor: e.cursor ?? null });
|
|
3770
|
-
n = c.results,
|
|
3772
|
+
n = c.results, i = c.nextCursor;
|
|
3771
3773
|
}
|
|
3772
|
-
const
|
|
3774
|
+
const a = n.map(Z);
|
|
3773
3775
|
return {
|
|
3774
|
-
textContent:
|
|
3776
|
+
textContent: wi({ projects: a, args: e, nextCursor: i }),
|
|
3775
3777
|
structuredContent: {
|
|
3776
|
-
projects:
|
|
3777
|
-
nextCursor:
|
|
3778
|
-
totalCount:
|
|
3779
|
-
hasMore: !!
|
|
3778
|
+
projects: a,
|
|
3779
|
+
nextCursor: i ?? void 0,
|
|
3780
|
+
totalCount: a.length,
|
|
3781
|
+
hasMore: !!i,
|
|
3780
3782
|
appliedFilters: e
|
|
3781
3783
|
}
|
|
3782
3784
|
};
|
|
3783
3785
|
}
|
|
3784
3786
|
};
|
|
3785
|
-
function
|
|
3787
|
+
function wi({
|
|
3786
3788
|
projects: e,
|
|
3787
3789
|
args: t,
|
|
3788
3790
|
nextCursor: r
|
|
3789
3791
|
}) {
|
|
3790
|
-
const o =
|
|
3791
|
-
t.searchText &&
|
|
3792
|
-
const
|
|
3793
|
-
`), l = e.length -
|
|
3792
|
+
const o = gi[t.archivedStatus ?? "active"], n = t.searchText ? `All ${o} matching "${t.searchText}"` : `${o.charAt(0).toUpperCase()}${o.slice(1)}`, i = [];
|
|
3793
|
+
t.searchText && i.push(`searchText: "${t.searchText}"`), t.archivedStatus && t.archivedStatus !== "active" && i.push(`archivedStatus: "${t.archivedStatus}"`);
|
|
3794
|
+
const a = 10, d = e.slice(0, a).map(Fo).join(`
|
|
3795
|
+
`), l = e.length - a, u = l > 0 ? `${d}
|
|
3794
3796
|
…and ${l} more` : d, p = [];
|
|
3795
|
-
return e.length === 0 && (t.searchText ? (p.push("Try broader search terms"), p.push("Check spelling"), p.push("Remove searchText to see all projects")) : t.archivedStatus === "archived" ? (p.push("No archived projects"), p.push("Use archivedStatus: 'all' to also see active projects")) : t.archivedStatus === "all" ? (p.push("No projects created yet"), p.push(`Use ${Ct} to create a project`)) : (p.push("No active projects"), p.push("Use archivedStatus: 'all' to include archived projects"), p.push(`Use ${Ct} to create a project`))),
|
|
3797
|
+
return e.length === 0 && (t.searchText ? (p.push("Try broader search terms"), p.push("Check spelling"), p.push("Remove searchText to see all projects")) : t.archivedStatus === "archived" ? (p.push("No archived projects"), p.push("Use archivedStatus: 'all' to also see active projects")) : t.archivedStatus === "all" ? (p.push("No projects created yet"), p.push(`Use ${Ct} to create a project`)) : (p.push("No active projects"), p.push("Use archivedStatus: 'all' to include archived projects"), p.push(`Use ${Ct} to create a project`))), K({
|
|
3796
3798
|
subject: n,
|
|
3797
3799
|
count: e.length,
|
|
3798
3800
|
limit: t.searchText || t.archivedStatus === "all" ? void 0 : t.limit,
|
|
3799
3801
|
nextCursor: r ?? void 0,
|
|
3800
|
-
filterHints:
|
|
3802
|
+
filterHints: i,
|
|
3801
3803
|
previewLines: u,
|
|
3802
3804
|
zeroReasonHints: p
|
|
3803
3805
|
});
|
|
3804
3806
|
}
|
|
3805
|
-
const
|
|
3807
|
+
const vi = {
|
|
3806
3808
|
taskId: s.string().optional().describe(
|
|
3807
3809
|
"Find all reminders for a specific task. Returns both time-based and location reminders."
|
|
3808
3810
|
),
|
|
3809
3811
|
reminderId: s.string().optional().describe("Get a specific time-based reminder (relative or absolute) by its ID."),
|
|
3810
3812
|
locationReminderId: s.string().optional().describe("Get a specific location reminder by its ID.")
|
|
3811
|
-
},
|
|
3813
|
+
}, Ii = {
|
|
3812
3814
|
reminders: s.array(st).describe("The found reminders (time-based and location)."),
|
|
3813
3815
|
searchType: s.string().describe('The search type used: "task", "reminder", or "location_reminder".'),
|
|
3814
3816
|
searchId: s.string().describe("The ID used for the search."),
|
|
3815
3817
|
totalCount: s.number().describe("Total reminders in this response.")
|
|
3816
|
-
},
|
|
3818
|
+
}, Si = {
|
|
3817
3819
|
name: g.FIND_REMINDERS,
|
|
3818
3820
|
description: "Find reminders by task ID (returns all reminder types), or get a specific reminder by its ID. Use reminderId for time-based reminders and locationReminderId for location reminders.",
|
|
3819
|
-
parameters:
|
|
3820
|
-
outputSchema:
|
|
3821
|
+
parameters: vi,
|
|
3822
|
+
outputSchema: Ii,
|
|
3821
3823
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3822
3824
|
async execute(e, t) {
|
|
3823
|
-
const { taskId: r, reminderId: o, locationReminderId: n } = e,
|
|
3824
|
-
if (
|
|
3825
|
+
const { taskId: r, reminderId: o, locationReminderId: n } = e, i = [r, o, n].filter(Boolean);
|
|
3826
|
+
if (i.length === 0)
|
|
3825
3827
|
throw new Error("One of taskId, reminderId, or locationReminderId must be provided.");
|
|
3826
|
-
if (
|
|
3828
|
+
if (i.length > 1)
|
|
3827
3829
|
throw new Error(
|
|
3828
3830
|
"Only one of taskId, reminderId, or locationReminderId can be provided at a time."
|
|
3829
3831
|
);
|
|
3830
3832
|
if (o) {
|
|
3831
|
-
const
|
|
3833
|
+
const a = await t.getReminder(o), c = be(a);
|
|
3832
3834
|
return {
|
|
3833
|
-
textContent: `Found ${
|
|
3835
|
+
textContent: `Found ${a.type} reminder (id=${o})`,
|
|
3834
3836
|
structuredContent: {
|
|
3835
3837
|
reminders: [c],
|
|
3836
3838
|
searchType: "reminder",
|
|
@@ -3840,7 +3842,7 @@ const va = {
|
|
|
3840
3842
|
};
|
|
3841
3843
|
}
|
|
3842
3844
|
if (n) {
|
|
3843
|
-
const
|
|
3845
|
+
const a = await t.getLocationReminder(n), c = be(a);
|
|
3844
3846
|
return {
|
|
3845
3847
|
textContent: `Found location reminder (id=${n})`,
|
|
3846
3848
|
structuredContent: {
|
|
@@ -3852,7 +3854,7 @@ const va = {
|
|
|
3852
3854
|
};
|
|
3853
3855
|
}
|
|
3854
3856
|
if (r) {
|
|
3855
|
-
const [
|
|
3857
|
+
const [a, c] = await Promise.all([
|
|
3856
3858
|
M({
|
|
3857
3859
|
apiMethod: (p) => t.getReminders(p),
|
|
3858
3860
|
args: { taskId: r }
|
|
@@ -3861,9 +3863,9 @@ const va = {
|
|
|
3861
3863
|
apiMethod: (p) => t.getLocationReminders(p),
|
|
3862
3864
|
args: { taskId: r }
|
|
3863
3865
|
})
|
|
3864
|
-
]), l = [...
|
|
3866
|
+
]), l = [...a, ...c].map(be);
|
|
3865
3867
|
return {
|
|
3866
|
-
textContent:
|
|
3868
|
+
textContent: ji(l, r),
|
|
3867
3869
|
structuredContent: {
|
|
3868
3870
|
reminders: l,
|
|
3869
3871
|
searchType: "task",
|
|
@@ -3875,36 +3877,36 @@ const va = {
|
|
|
3875
3877
|
throw new Error("One of taskId, reminderId, or locationReminderId must be provided.");
|
|
3876
3878
|
}
|
|
3877
3879
|
};
|
|
3878
|
-
function
|
|
3880
|
+
function ji(e, t) {
|
|
3879
3881
|
if (e.length === 0)
|
|
3880
3882
|
return `No reminders found for task ${t}`;
|
|
3881
3883
|
const { timeBasedCount: r, locationCount: o } = ns(e), n = [];
|
|
3882
3884
|
if (r > 0) {
|
|
3883
|
-
const
|
|
3884
|
-
n.push(`${r} ${
|
|
3885
|
+
const i = r > 1 ? "time-based reminders" : "time-based reminder";
|
|
3886
|
+
n.push(`${r} ${i}`);
|
|
3885
3887
|
}
|
|
3886
3888
|
if (o > 0) {
|
|
3887
|
-
const
|
|
3888
|
-
n.push(`${o} ${
|
|
3889
|
+
const i = o > 1 ? "location reminders" : "location reminder";
|
|
3890
|
+
n.push(`${o} ${i}`);
|
|
3889
3891
|
}
|
|
3890
3892
|
return `Found ${n.join(" and ")} for task ${t}`;
|
|
3891
3893
|
}
|
|
3892
|
-
const { ADD_SECTIONS:
|
|
3894
|
+
const { ADD_SECTIONS: Ci } = g, $i = {
|
|
3893
3895
|
projectId: s.string().min(1).describe(
|
|
3894
3896
|
'The ID of the project to search sections in. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
3895
3897
|
),
|
|
3896
3898
|
searchText: s.string().optional().describe(
|
|
3897
3899
|
'Search for a section by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all sections in the project are returned.'
|
|
3898
3900
|
)
|
|
3899
|
-
},
|
|
3901
|
+
}, Di = {
|
|
3900
3902
|
sections: s.array(X).describe("The found sections."),
|
|
3901
3903
|
totalCount: s.number().describe("The total number of sections found."),
|
|
3902
3904
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
3903
|
-
},
|
|
3905
|
+
}, xi = {
|
|
3904
3906
|
name: g.FIND_SECTIONS,
|
|
3905
3907
|
description: "Search for sections by name or other criteria in a project. When searching, uses server-side search to avoid fetching all sections.",
|
|
3906
|
-
parameters: $
|
|
3907
|
-
outputSchema:
|
|
3908
|
+
parameters: $i,
|
|
3909
|
+
outputSchema: Di,
|
|
3908
3910
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3909
3911
|
async execute(e, t) {
|
|
3910
3912
|
const r = await de({
|
|
@@ -3915,9 +3917,9 @@ const { ADD_SECTIONS: Ca } = g, $a = {
|
|
|
3915
3917
|
e.searchText ? o = await uo(t, e.searchText, r) : o = (await t.getSections({
|
|
3916
3918
|
projectId: r
|
|
3917
3919
|
})).results;
|
|
3918
|
-
const n = o.map(
|
|
3920
|
+
const n = o.map(q);
|
|
3919
3921
|
return {
|
|
3920
|
-
textContent:
|
|
3922
|
+
textContent: Ai({
|
|
3921
3923
|
sections: n,
|
|
3922
3924
|
projectId: e.projectId,
|
|
3923
3925
|
searchText: e.searchText
|
|
@@ -3930,26 +3932,26 @@ const { ADD_SECTIONS: Ca } = g, $a = {
|
|
|
3930
3932
|
};
|
|
3931
3933
|
}
|
|
3932
3934
|
};
|
|
3933
|
-
function
|
|
3935
|
+
function Ai({
|
|
3934
3936
|
sections: e,
|
|
3935
3937
|
projectId: t,
|
|
3936
3938
|
searchText: r
|
|
3937
3939
|
}) {
|
|
3938
3940
|
const o = [];
|
|
3939
|
-
r ? (o.push("Try broader search terms"), o.push("Check spelling"), o.push("Remove searchText to see all sections")) : (o.push("Project has no sections yet"), o.push(`Use ${
|
|
3940
|
-
const n = r ? `Sections in project ${t} matching "${r}"` : `Sections in project ${t}`,
|
|
3941
|
+
r ? (o.push("Try broader search terms"), o.push("Check spelling"), o.push("Remove searchText to see all sections")) : (o.push("Project has no sections yet"), o.push(`Use ${Ci} to create sections`));
|
|
3942
|
+
const n = r ? `Sections in project ${t} matching "${r}"` : `Sections in project ${t}`, i = e.length > 0 ? e.map((a) => ` ${a.name} • id=${a.id}`).join(`
|
|
3941
3943
|
`) : void 0;
|
|
3942
|
-
return
|
|
3944
|
+
return K({
|
|
3943
3945
|
subject: n,
|
|
3944
3946
|
count: e.length,
|
|
3945
|
-
previewLines:
|
|
3947
|
+
previewLines: i,
|
|
3946
3948
|
zeroReasonHints: o
|
|
3947
3949
|
});
|
|
3948
3950
|
}
|
|
3949
3951
|
function Ts(e) {
|
|
3950
3952
|
return /* @__PURE__ */ new Date(`${e}T00:00:00`);
|
|
3951
3953
|
}
|
|
3952
|
-
const
|
|
3954
|
+
const Ei = {
|
|
3953
3955
|
startDate: s.string().regex(/^(\d{4}-\d{2}-\d{2}|today)$/).optional().describe(
|
|
3954
3956
|
"The start date to get the tasks for. Format: YYYY-MM-DD, or 'today', which by default also includes overdue tasks."
|
|
3955
3957
|
),
|
|
@@ -3970,17 +3972,17 @@ const Ea = {
|
|
|
3970
3972
|
"Filter when responsibleUser is omitted. 'assigned'=assigned to others; 'unassignedOrMe'=unassigned+mine; 'all'=everyone. Default: 'unassignedOrMe'."
|
|
3971
3973
|
),
|
|
3972
3974
|
...ct
|
|
3973
|
-
},
|
|
3975
|
+
}, Oi = {
|
|
3974
3976
|
tasks: s.array(F).describe("The found tasks."),
|
|
3975
3977
|
nextCursor: s.string().optional(),
|
|
3976
3978
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
3977
3979
|
hasMore: s.boolean(),
|
|
3978
3980
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
3979
|
-
},
|
|
3981
|
+
}, Pi = {
|
|
3980
3982
|
name: g.FIND_TASKS_BY_DATE,
|
|
3981
3983
|
description: "Get tasks by date range. startDate='today' includes overdue items. Default responsibleUserFiltering='unassignedOrMe' excludes others' tasks. Person-specific queries (summaries, plans, reports) require responsibleUser.",
|
|
3982
|
-
parameters:
|
|
3983
|
-
outputSchema:
|
|
3984
|
+
parameters: Ei,
|
|
3985
|
+
outputSchema: Oi,
|
|
3984
3986
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
3985
3987
|
async execute(e, t) {
|
|
3986
3988
|
if (!e.startDate && e.overdueOption !== "overdue-only")
|
|
@@ -3988,35 +3990,35 @@ const Ea = {
|
|
|
3988
3990
|
"Either startDate must be provided or overdueOption must be set to overdue-only"
|
|
3989
3991
|
);
|
|
3990
3992
|
const r = await Qe(t, e.responsibleUser), o = r?.userId, n = r?.email;
|
|
3991
|
-
let
|
|
3993
|
+
let i = "";
|
|
3992
3994
|
if (e.overdueOption === "overdue-only")
|
|
3993
|
-
|
|
3995
|
+
i = "overdue";
|
|
3994
3996
|
else if (e.startDate === "today")
|
|
3995
3997
|
if (e.daysCount > 1) {
|
|
3996
|
-
const p = /* @__PURE__ */ new Date(), m =
|
|
3997
|
-
|
|
3998
|
+
const p = /* @__PURE__ */ new Date(), m = ae(p), h = Ue(p, e.daysCount), y = lt(h, { representation: "date" }), f = `(due after: ${m} | due: ${m}) & due before: ${y}`;
|
|
3999
|
+
i = e.overdueOption === "exclude-overdue" ? f : `(${f} | overdue)`;
|
|
3998
4000
|
} else
|
|
3999
|
-
|
|
4001
|
+
i = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
|
|
4000
4002
|
else if (e.startDate) {
|
|
4001
4003
|
const p = e.startDate, m = Ue(Ts(p), e.daysCount), h = lt(m, { representation: "date" });
|
|
4002
|
-
|
|
4004
|
+
i = `(due after: ${p} | due: ${p}) & due before: ${h}`;
|
|
4003
4005
|
}
|
|
4004
|
-
const
|
|
4005
|
-
|
|
4006
|
+
const a = dt(e.labels, e.labelsOperator);
|
|
4007
|
+
a.length > 0 && (i = ce(i, `(${a})`));
|
|
4006
4008
|
const c = ss({
|
|
4007
4009
|
resolvedAssigneeId: o,
|
|
4008
4010
|
assigneeEmail: n,
|
|
4009
4011
|
responsibleUserFiltering: e.responsibleUserFiltering
|
|
4010
4012
|
});
|
|
4011
|
-
|
|
4013
|
+
i = ce(i, c);
|
|
4012
4014
|
const { tasks: d, nextCursor: l } = await tt({
|
|
4013
4015
|
client: t,
|
|
4014
|
-
query:
|
|
4016
|
+
query: i,
|
|
4015
4017
|
cursor: e.cursor,
|
|
4016
4018
|
limit: e.limit
|
|
4017
4019
|
});
|
|
4018
4020
|
return {
|
|
4019
|
-
textContent:
|
|
4021
|
+
textContent: _i({ tasks: d, args: e, nextCursor: l, assigneeEmail: n }),
|
|
4020
4022
|
structuredContent: {
|
|
4021
4023
|
tasks: d,
|
|
4022
4024
|
nextCursor: l ?? void 0,
|
|
@@ -4027,7 +4029,7 @@ const Ea = {
|
|
|
4027
4029
|
};
|
|
4028
4030
|
}
|
|
4029
4031
|
};
|
|
4030
|
-
function
|
|
4032
|
+
function _i({
|
|
4031
4033
|
tasks: e,
|
|
4032
4034
|
args: t,
|
|
4033
4035
|
nextCursor: r,
|
|
@@ -4042,7 +4044,7 @@ function _a({
|
|
|
4042
4044
|
`today${c}${t.daysCount > 1 ? ` + ${t.daysCount - 1} more days` : ""}`
|
|
4043
4045
|
);
|
|
4044
4046
|
} else if (t.startDate) {
|
|
4045
|
-
const c = t.daysCount > 1 ? ` to ${
|
|
4047
|
+
const c = t.daysCount > 1 ? ` to ${ae(Ue(Ts(t.startDate), t.daysCount))}` : "";
|
|
4046
4048
|
n.push(`${t.startDate}${c}`);
|
|
4047
4049
|
}
|
|
4048
4050
|
if (t.labels && t.labels.length > 0) {
|
|
@@ -4053,37 +4055,37 @@ function _a({
|
|
|
4053
4055
|
const c = o || t.responsibleUser;
|
|
4054
4056
|
n.push(`assigned to: ${c}`);
|
|
4055
4057
|
}
|
|
4056
|
-
let
|
|
4057
|
-
if (t.overdueOption === "overdue-only" ?
|
|
4058
|
+
let i = "";
|
|
4059
|
+
if (t.overdueOption === "overdue-only" ? i = "Overdue tasks" : t.startDate === "today" ? i = t.overdueOption === "exclude-overdue" ? "Today's tasks" : "Today's tasks + overdue" : t.startDate ? i = `Tasks for ${t.startDate}` : i = "Tasks", t.responsibleUser) {
|
|
4058
4060
|
const c = o || t.responsibleUser;
|
|
4059
|
-
|
|
4061
|
+
i += ` assigned to ${c}`;
|
|
4060
4062
|
}
|
|
4061
|
-
const
|
|
4063
|
+
const a = [];
|
|
4062
4064
|
if (e.length === 0)
|
|
4063
4065
|
if (t.overdueOption === "overdue-only")
|
|
4064
|
-
|
|
4066
|
+
a.push("Great job! No overdue tasks");
|
|
4065
4067
|
else if (t.startDate === "today") {
|
|
4066
4068
|
const c = t.overdueOption === "exclude-overdue" ? "" : " or overdue";
|
|
4067
|
-
|
|
4069
|
+
a.push(`Great job! No tasks for today${c}`);
|
|
4068
4070
|
} else
|
|
4069
|
-
|
|
4070
|
-
return
|
|
4071
|
-
subject:
|
|
4071
|
+
a.push("Expand date range with larger 'daysCount'"), a.push("Check today's tasks with startDate='today'");
|
|
4072
|
+
return K({
|
|
4073
|
+
subject: i,
|
|
4072
4074
|
count: e.length,
|
|
4073
4075
|
limit: t.limit,
|
|
4074
4076
|
nextCursor: r ?? void 0,
|
|
4075
4077
|
filterHints: n,
|
|
4076
4078
|
previewLines: Se(e, Math.min(e.length, t.limit)),
|
|
4077
|
-
zeroReasonHints:
|
|
4079
|
+
zeroReasonHints: a
|
|
4078
4080
|
});
|
|
4079
4081
|
}
|
|
4080
|
-
const
|
|
4081
|
-
class
|
|
4082
|
+
const Ri = 300 * 1e3;
|
|
4083
|
+
class Ui {
|
|
4082
4084
|
constructor() {
|
|
4083
4085
|
this.cache = null;
|
|
4084
4086
|
}
|
|
4085
4087
|
async getFilters(t) {
|
|
4086
|
-
if (this.cache && Date.now() - this.cache.timestamp <
|
|
4088
|
+
if (this.cache && Date.now() - this.cache.timestamp < Ri)
|
|
4087
4089
|
return this.cache.filters;
|
|
4088
4090
|
const o = ((await t.sync({
|
|
4089
4091
|
resourceTypes: ["filters"],
|
|
@@ -4105,17 +4107,17 @@ class Ua {
|
|
|
4105
4107
|
const o = r.trim();
|
|
4106
4108
|
if (!o)
|
|
4107
4109
|
throw new Error("Filter reference cannot be empty");
|
|
4108
|
-
const n = await this.getFilters(t),
|
|
4109
|
-
if (
|
|
4110
|
-
return { filterId:
|
|
4111
|
-
const
|
|
4110
|
+
const n = await this.getFilters(t), i = n.find((u) => u.id === o);
|
|
4111
|
+
if (i)
|
|
4112
|
+
return { filterId: i.id, filterName: i.name, filterQuery: i.query };
|
|
4113
|
+
const a = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === a);
|
|
4112
4114
|
if (c)
|
|
4113
4115
|
return {
|
|
4114
4116
|
filterId: c.id,
|
|
4115
4117
|
filterName: c.name,
|
|
4116
4118
|
filterQuery: c.query
|
|
4117
4119
|
};
|
|
4118
|
-
const d = n.filter((u) => u.name.toLowerCase().includes(
|
|
4120
|
+
const d = n.filter((u) => u.name.toLowerCase().includes(a)), l = d.length === 1 ? d[0] : void 0;
|
|
4119
4121
|
if (l)
|
|
4120
4122
|
return {
|
|
4121
4123
|
filterId: l.id,
|
|
@@ -4140,7 +4142,7 @@ ${u}` + (d.length > 5 ? `
|
|
|
4140
4142
|
this.cache = null;
|
|
4141
4143
|
}
|
|
4142
4144
|
}
|
|
4143
|
-
const
|
|
4145
|
+
const Li = new Ui(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Ni = {
|
|
4144
4146
|
searchText: s.string().optional().describe("The text to search for in tasks."),
|
|
4145
4147
|
projectId: s.string().optional().describe(
|
|
4146
4148
|
'Find tasks in this project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
@@ -4162,25 +4164,25 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
|
|
|
4162
4164
|
"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."
|
|
4163
4165
|
),
|
|
4164
4166
|
...ct
|
|
4165
|
-
},
|
|
4167
|
+
}, Mi = {
|
|
4166
4168
|
tasks: s.array(F).describe("The found tasks."),
|
|
4167
4169
|
nextCursor: s.string().optional(),
|
|
4168
4170
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
4169
4171
|
hasMore: s.boolean(),
|
|
4170
4172
|
appliedFilters: s.record(s.string(), s.unknown())
|
|
4171
|
-
},
|
|
4173
|
+
}, Fi = {
|
|
4172
4174
|
name: g.FIND_TASKS,
|
|
4173
4175
|
description: "Find tasks by text search, project/section/parent container, responsible user, labels, a raw Todoist filter string, or a saved filter by ID or name (filterIdOrName). At least one filter must be provided.",
|
|
4174
|
-
parameters:
|
|
4175
|
-
outputSchema:
|
|
4176
|
+
parameters: Ni,
|
|
4177
|
+
outputSchema: Mi,
|
|
4176
4178
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
4177
4179
|
async execute(e, t) {
|
|
4178
4180
|
const {
|
|
4179
4181
|
searchText: r,
|
|
4180
4182
|
projectId: o,
|
|
4181
4183
|
sectionId: n,
|
|
4182
|
-
parentId:
|
|
4183
|
-
responsibleUser:
|
|
4184
|
+
parentId: i,
|
|
4185
|
+
responsibleUser: a,
|
|
4184
4186
|
responsibleUserFiltering: c,
|
|
4185
4187
|
limit: d,
|
|
4186
4188
|
cursor: l,
|
|
@@ -4189,7 +4191,7 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
|
|
|
4189
4191
|
filter: m,
|
|
4190
4192
|
filterIdOrName: h
|
|
4191
4193
|
} = e, y = await t.getUser(), f = u && u.length > 0;
|
|
4192
|
-
if (!r && !o && !n && !
|
|
4194
|
+
if (!r && !o && !n && !i && !a && !f && !m && !h)
|
|
4193
4195
|
throw new Error(
|
|
4194
4196
|
"At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, labels, filter, or filterIdOrName"
|
|
4195
4197
|
);
|
|
@@ -4197,19 +4199,19 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
|
|
|
4197
4199
|
throw new Error(
|
|
4198
4200
|
"The `filter` and `filterIdOrName` parameters cannot be used together. Provide only one."
|
|
4199
4201
|
);
|
|
4200
|
-
if ((m || h) && (o || n ||
|
|
4202
|
+
if ((m || h) && (o || n || i))
|
|
4201
4203
|
throw new Error(
|
|
4202
4204
|
'The `filter`/`filterIdOrName` parameter cannot be combined with projectId, sectionId, or parentId. Use filter syntax instead (e.g. "##ProjectName").'
|
|
4203
4205
|
);
|
|
4204
4206
|
let v = m;
|
|
4205
|
-
h && (v = (await
|
|
4206
|
-
const j = await Qe(t,
|
|
4207
|
-
if (o || n ||
|
|
4207
|
+
h && (v = (await Li.resolveFilter(t, h)).filterQuery);
|
|
4208
|
+
const j = await Qe(t, a), A = j?.userId, k = j?.email;
|
|
4209
|
+
if (o || n || i) {
|
|
4208
4210
|
const D = {
|
|
4209
4211
|
limit: d,
|
|
4210
4212
|
cursor: l ?? null
|
|
4211
4213
|
};
|
|
4212
|
-
o && (D.projectId = await de({ projectId: o, user: y })), n && (D.sectionId = n),
|
|
4214
|
+
o && (D.projectId = await de({ projectId: o, user: y })), n && (D.sectionId = n), i && (D.parentId = i);
|
|
4213
4215
|
const { results: me, nextCursor: Y } = await t.getTasks(D), $e = me.map(P);
|
|
4214
4216
|
let H = r ? $e.filter(
|
|
4215
4217
|
(te) => te.content.toLowerCase().includes(r.toLowerCase()) || te.description?.toLowerCase().includes(r.toLowerCase())
|
|
@@ -4267,7 +4269,7 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
|
|
|
4267
4269
|
let I = v ? `(${v})` : "";
|
|
4268
4270
|
r && (I = ce(I, `search: ${r}`));
|
|
4269
4271
|
const x = dt(u, p);
|
|
4270
|
-
if (I = ce(I, x), !(h && !
|
|
4272
|
+
if (I = ce(I, x), !(h && !a && !c)) {
|
|
4271
4273
|
const D = ss({
|
|
4272
4274
|
resolvedAssigneeId: A,
|
|
4273
4275
|
assigneeEmail: k,
|
|
@@ -4299,7 +4301,7 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
|
|
|
4299
4301
|
};
|
|
4300
4302
|
}
|
|
4301
4303
|
};
|
|
4302
|
-
function
|
|
4304
|
+
function Hi(e) {
|
|
4303
4305
|
if (e.projectId) {
|
|
4304
4306
|
const t = [
|
|
4305
4307
|
e.searchText ? "No tasks in project match search" : "Project has no tasks yet"
|
|
@@ -4323,27 +4325,27 @@ function Ee({
|
|
|
4323
4325
|
isContainerSearch: o,
|
|
4324
4326
|
assigneeEmail: n
|
|
4325
4327
|
}) {
|
|
4326
|
-
let
|
|
4327
|
-
const
|
|
4328
|
+
let i = "Tasks";
|
|
4329
|
+
const a = [], c = [];
|
|
4328
4330
|
if (o) {
|
|
4329
|
-
if (t.projectId ? (
|
|
4331
|
+
if (t.projectId ? (i = "Tasks in project", a.push(`in project ${t.projectId}`)) : t.sectionId ? (i = "Tasks in section", a.push(`in section ${t.sectionId}`)) : t.parentId ? (i = "Subtasks", a.push(`subtasks of ${t.parentId}`)) : i = "Tasks", t.searchText && (i += ` matching "${t.searchText}"`, a.push(`containing "${t.searchText}"`)), t.responsibleUser) {
|
|
4330
4332
|
const d = n || t.responsibleUser;
|
|
4331
|
-
|
|
4333
|
+
i += ` assigned to ${d}`, a.push(`assigned to ${d}`);
|
|
4332
4334
|
}
|
|
4333
4335
|
if (t.labels && t.labels.length > 0) {
|
|
4334
4336
|
const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
4335
|
-
|
|
4337
|
+
a.push(`labels: ${d}`);
|
|
4336
4338
|
}
|
|
4337
|
-
e.length === 0 && c.push(...
|
|
4339
|
+
e.length === 0 && c.push(...Hi(t));
|
|
4338
4340
|
} else {
|
|
4339
4341
|
const d = n || t.responsibleUser, l = [];
|
|
4340
4342
|
if (t.filter && l.push(`filter: ${t.filter}`), t.searchText && l.push(`"${t.searchText}"`), t.responsibleUser && l.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
|
|
4341
4343
|
const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
4342
4344
|
l.push(`with labels: ${u}`);
|
|
4343
4345
|
}
|
|
4344
|
-
if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (
|
|
4346
|
+
if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (i = `Tasks matching filter: ${t.filter}`, a.push(`filter: ${t.filter}`)) : t.searchText ? (i = `Search results for ${l.join(" ")}`, a.push(`matching "${t.searchText}"`), t.filter && a.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (i = `Tasks assigned to ${d}`, t.filter && a.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (i = `Tasks with labels: ${t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ")}`, t.filter && a.push(`filter: ${t.filter}`)) : i = `Tasks ${l.join(" ")}`, t.responsibleUser && a.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
|
|
4345
4347
|
const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
4346
|
-
|
|
4348
|
+
a.push(`labels: ${u}`);
|
|
4347
4349
|
}
|
|
4348
4350
|
if (e.length === 0) {
|
|
4349
4351
|
if (t.responsibleUser) {
|
|
@@ -4353,17 +4355,17 @@ function Ee({
|
|
|
4353
4355
|
t.searchText && (c.push("Try broader search terms"), c.push("Verify spelling and try partial words"), t.responsibleUser || c.push(`Check completed tasks with ${$t}`));
|
|
4354
4356
|
}
|
|
4355
4357
|
}
|
|
4356
|
-
return
|
|
4357
|
-
subject:
|
|
4358
|
+
return K({
|
|
4359
|
+
subject: i,
|
|
4358
4360
|
count: e.length,
|
|
4359
4361
|
limit: t.limit,
|
|
4360
4362
|
nextCursor: r ?? void 0,
|
|
4361
|
-
filterHints:
|
|
4363
|
+
filterHints: a,
|
|
4362
4364
|
previewLines: Se(e, Math.min(e.length, t.limit)),
|
|
4363
4365
|
zeroReasonHints: c
|
|
4364
4366
|
});
|
|
4365
4367
|
}
|
|
4366
|
-
const
|
|
4368
|
+
const Wi = {
|
|
4367
4369
|
projectId: s.string().min(1).optional().describe(
|
|
4368
4370
|
"Optional project ID. If provided, shows detailed overview of that project. If omitted, shows overview of all projects."
|
|
4369
4371
|
)
|
|
@@ -4382,7 +4384,7 @@ const Wa = {
|
|
|
4382
4384
|
),
|
|
4383
4385
|
children: s.array(ks).describe("Nested child projects.")
|
|
4384
4386
|
})
|
|
4385
|
-
),
|
|
4387
|
+
), Bi = {
|
|
4386
4388
|
type: s.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
|
|
4387
4389
|
totalProjects: s.number().optional().describe("Total number of projects (account overview only)."),
|
|
4388
4390
|
totalTasks: s.number().optional().describe("Total number of tasks."),
|
|
@@ -4400,7 +4402,7 @@ const Wa = {
|
|
|
4400
4402
|
id: s.string().describe("The inbox project ID."),
|
|
4401
4403
|
name: s.string().describe("The inbox project name."),
|
|
4402
4404
|
sections: s.array(X).describe("Sections in the inbox project.")
|
|
4403
|
-
}).
|
|
4405
|
+
}).optional().describe("Inbox information (account overview only)."),
|
|
4404
4406
|
projects: s.array(s.lazy(() => ks)).optional().describe(
|
|
4405
4407
|
"List of projects with hierarchy, folders, and ordering (account overview only)."
|
|
4406
4408
|
),
|
|
@@ -4416,7 +4418,7 @@ const Wa = {
|
|
|
4416
4418
|
tasksWithoutSection: s.number()
|
|
4417
4419
|
}).optional().describe("Statistics object (project overview only).")
|
|
4418
4420
|
};
|
|
4419
|
-
function
|
|
4421
|
+
function zi(e) {
|
|
4420
4422
|
const t = {};
|
|
4421
4423
|
for (const n of e)
|
|
4422
4424
|
t[n.id] = {
|
|
@@ -4426,22 +4428,22 @@ function za(e) {
|
|
|
4426
4428
|
};
|
|
4427
4429
|
const r = [];
|
|
4428
4430
|
for (const n of e) {
|
|
4429
|
-
const
|
|
4430
|
-
if (
|
|
4431
|
+
const i = t[n.id];
|
|
4432
|
+
if (i)
|
|
4431
4433
|
if (B(n) && n.parentId) {
|
|
4432
|
-
const
|
|
4433
|
-
|
|
4434
|
+
const a = t[n.parentId];
|
|
4435
|
+
a ? a.children.push(i) : r.push(i);
|
|
4434
4436
|
} else
|
|
4435
|
-
r.push(
|
|
4437
|
+
r.push(i);
|
|
4436
4438
|
}
|
|
4437
4439
|
function o(n) {
|
|
4438
|
-
n.sort((
|
|
4439
|
-
for (const
|
|
4440
|
-
o(
|
|
4440
|
+
n.sort((i, a) => i.childOrder - a.childOrder);
|
|
4441
|
+
for (const i of n)
|
|
4442
|
+
o(i.children);
|
|
4441
4443
|
}
|
|
4442
4444
|
return o(r), r;
|
|
4443
4445
|
}
|
|
4444
|
-
async function
|
|
4446
|
+
async function qi(e, t) {
|
|
4445
4447
|
const r = {};
|
|
4446
4448
|
return await Promise.all(
|
|
4447
4449
|
t.map(async (o) => {
|
|
@@ -4454,10 +4456,10 @@ function ws(e, t, r = "") {
|
|
|
4454
4456
|
const o = [];
|
|
4455
4457
|
o.push(`${r}- Project: ${e.name} (id=${e.id})`);
|
|
4456
4458
|
const n = t[e.id] || [];
|
|
4457
|
-
for (const
|
|
4458
|
-
o.push(`${r} - Section: ${
|
|
4459
|
-
for (const
|
|
4460
|
-
o.push(...ws(
|
|
4459
|
+
for (const i of n)
|
|
4460
|
+
o.push(`${r} - Section: ${i.name} (id=${i.id})`);
|
|
4461
|
+
for (const i of e.children)
|
|
4462
|
+
o.push(...ws(i, t, `${r} `));
|
|
4461
4463
|
return o;
|
|
4462
4464
|
}
|
|
4463
4465
|
function xt(e) {
|
|
@@ -4472,16 +4474,16 @@ function xt(e) {
|
|
|
4472
4474
|
r.push(n);
|
|
4473
4475
|
continue;
|
|
4474
4476
|
}
|
|
4475
|
-
const
|
|
4476
|
-
|
|
4477
|
+
const i = t[o.parentId];
|
|
4478
|
+
i ? i.children.push(n) : r.push(n);
|
|
4477
4479
|
}
|
|
4478
4480
|
return r;
|
|
4479
4481
|
}
|
|
4480
|
-
function
|
|
4482
|
+
function Ke(e, t = "") {
|
|
4481
4483
|
const r = [];
|
|
4482
4484
|
for (const o of e) {
|
|
4483
|
-
const n = `id=${o.id}`,
|
|
4484
|
-
r.push(`${t}- ${n}${
|
|
4485
|
+
const n = `id=${o.id}`, i = o.dueDate ? `; due=${o.dueDate}` : "", a = `; content=${o.content}`;
|
|
4486
|
+
r.push(`${t}- ${n}${i}${a}`), o.children.length > 0 && r.push(...Ke(o.children, `${t} `));
|
|
4485
4487
|
}
|
|
4486
4488
|
return r;
|
|
4487
4489
|
}
|
|
@@ -4492,38 +4494,38 @@ function vs(e, t) {
|
|
|
4492
4494
|
parentId: B(e) ? e.parentId ?? void 0 : void 0,
|
|
4493
4495
|
folderId: ke(e) ? e.folderId ?? void 0 : void 0,
|
|
4494
4496
|
childOrder: e.childOrder,
|
|
4495
|
-
sections: (t[e.id] || []).map(
|
|
4497
|
+
sections: (t[e.id] || []).map(q),
|
|
4496
4498
|
children: e.children.map(
|
|
4497
4499
|
(r) => vs(r, t)
|
|
4498
4500
|
)
|
|
4499
4501
|
};
|
|
4500
4502
|
}
|
|
4501
|
-
async function
|
|
4503
|
+
async function Ki(e, t) {
|
|
4502
4504
|
let r = [], o;
|
|
4503
4505
|
do {
|
|
4504
|
-
const { results: n, nextCursor:
|
|
4506
|
+
const { results: n, nextCursor: i } = await e.getTasks({
|
|
4505
4507
|
projectId: t,
|
|
4506
4508
|
limit: C.TASKS_BATCH_SIZE,
|
|
4507
4509
|
cursor: o ?? void 0
|
|
4508
4510
|
});
|
|
4509
|
-
r = r.concat(n.map(P)), o =
|
|
4511
|
+
r = r.concat(n.map(P)), o = i ?? void 0;
|
|
4510
4512
|
} while (o);
|
|
4511
4513
|
return r;
|
|
4512
4514
|
}
|
|
4513
|
-
async function
|
|
4515
|
+
async function Yi(e, t) {
|
|
4514
4516
|
const { results: r } = await e.getSections({ projectId: t });
|
|
4515
4517
|
return r;
|
|
4516
4518
|
}
|
|
4517
|
-
async function
|
|
4518
|
-
const { results: t } = await e.getProjects({}), r = t.find((p) => B(p) && p.inboxProject === !0), o = t.filter((p) => !B(p) || p.inboxProject !== !0), n =
|
|
4519
|
+
async function Gi(e) {
|
|
4520
|
+
const { results: t } = await e.getProjects({}), r = t.find((p) => B(p) && p.inboxProject === !0), o = t.filter((p) => !B(p) || p.inboxProject !== !0), n = zi(o), i = t.map((p) => p.id), a = await qi(e, i), c = ["# Personal Projects", ""];
|
|
4519
4521
|
if (r) {
|
|
4520
4522
|
c.push(`- Inbox Project: ${r.name} (id=${r.id})`);
|
|
4521
|
-
for (const p of
|
|
4523
|
+
for (const p of a[r.id] || [])
|
|
4522
4524
|
c.push(` - Section: ${p.name} (id=${p.id})`);
|
|
4523
4525
|
}
|
|
4524
4526
|
if (n.length)
|
|
4525
4527
|
for (const p of n)
|
|
4526
|
-
c.push(...ws(p,
|
|
4528
|
+
c.push(...ws(p, a));
|
|
4527
4529
|
else
|
|
4528
4530
|
c.push("_No projects found._");
|
|
4529
4531
|
c.push("");
|
|
@@ -4538,44 +4540,44 @@ async function Ga(e) {
|
|
|
4538
4540
|
inbox: r ? {
|
|
4539
4541
|
id: r.id,
|
|
4540
4542
|
name: r.name,
|
|
4541
|
-
sections: (
|
|
4542
|
-
} :
|
|
4543
|
+
sections: (a[r.id] || []).map(q)
|
|
4544
|
+
} : void 0,
|
|
4543
4545
|
projects: n.map(
|
|
4544
|
-
(p) => vs(p,
|
|
4546
|
+
(p) => vs(p, a)
|
|
4545
4547
|
),
|
|
4546
4548
|
totalProjects: t.length,
|
|
4547
|
-
totalSections:
|
|
4548
|
-
(p, m) => p + (
|
|
4549
|
+
totalSections: i.reduce(
|
|
4550
|
+
(p, m) => p + (a[m]?.length || 0),
|
|
4549
4551
|
0
|
|
4550
4552
|
),
|
|
4551
4553
|
hasNestedProjects: d
|
|
4552
4554
|
};
|
|
4553
4555
|
return { textContent: l, structuredContent: u };
|
|
4554
4556
|
}
|
|
4555
|
-
async function
|
|
4557
|
+
async function Vi(e, t) {
|
|
4556
4558
|
const [r, o, n] = await Promise.all([
|
|
4557
4559
|
e.getProject(t),
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
]),
|
|
4560
|
+
Yi(e, t),
|
|
4561
|
+
Ki(e, t)
|
|
4562
|
+
]), i = {};
|
|
4561
4563
|
for (const u of o)
|
|
4562
|
-
|
|
4563
|
-
const
|
|
4564
|
+
i[u.id] = [];
|
|
4565
|
+
const a = [];
|
|
4564
4566
|
for (const u of n)
|
|
4565
|
-
(u.sectionId ?
|
|
4567
|
+
(u.sectionId ? i[u.sectionId] ?? a : a).push(u);
|
|
4566
4568
|
const c = [`# ${r.name}`];
|
|
4567
|
-
if (
|
|
4569
|
+
if (a.length > 0) {
|
|
4568
4570
|
c.push("");
|
|
4569
|
-
const u = xt(
|
|
4570
|
-
c.push(...
|
|
4571
|
+
const u = xt(a);
|
|
4572
|
+
c.push(...Ke(u));
|
|
4571
4573
|
}
|
|
4572
4574
|
for (const u of o) {
|
|
4573
4575
|
c.push(""), c.push(`## ${u.name}`);
|
|
4574
|
-
const p =
|
|
4576
|
+
const p = i[u.id];
|
|
4575
4577
|
if (!p?.length)
|
|
4576
4578
|
continue;
|
|
4577
4579
|
const m = xt(p);
|
|
4578
|
-
c.push(...
|
|
4580
|
+
c.push(...Ke(m));
|
|
4579
4581
|
}
|
|
4580
4582
|
const d = c.join(`
|
|
4581
4583
|
`), l = {
|
|
@@ -4584,7 +4586,7 @@ async function Va(e, t) {
|
|
|
4584
4586
|
id: r.id,
|
|
4585
4587
|
name: r.name
|
|
4586
4588
|
},
|
|
4587
|
-
sections: o.map(
|
|
4589
|
+
sections: o.map(q),
|
|
4588
4590
|
tasks: n.map((u) => ({
|
|
4589
4591
|
...u,
|
|
4590
4592
|
children: []
|
|
@@ -4593,32 +4595,32 @@ async function Va(e, t) {
|
|
|
4593
4595
|
stats: {
|
|
4594
4596
|
totalTasks: n.length,
|
|
4595
4597
|
totalSections: o.length,
|
|
4596
|
-
tasksWithoutSection:
|
|
4598
|
+
tasksWithoutSection: a.length
|
|
4597
4599
|
}
|
|
4598
4600
|
};
|
|
4599
4601
|
return { textContent: d, structuredContent: l };
|
|
4600
4602
|
}
|
|
4601
|
-
const
|
|
4603
|
+
const Ji = {
|
|
4602
4604
|
name: g.GET_OVERVIEW,
|
|
4603
4605
|
description: "Get a Markdown overview. If no projectId is provided, shows all projects with hierarchy and sections (useful for navigation). If projectId is provided, shows detailed overview of that specific project including all tasks grouped by sections.",
|
|
4604
|
-
parameters:
|
|
4605
|
-
outputSchema:
|
|
4606
|
+
parameters: Wi,
|
|
4607
|
+
outputSchema: Bi,
|
|
4606
4608
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
4607
4609
|
async execute(e, t) {
|
|
4608
|
-
const r = e.projectId ? await
|
|
4610
|
+
const r = e.projectId ? await Vi(t, e.projectId) : await Gi(t);
|
|
4609
4611
|
return {
|
|
4610
4612
|
textContent: r.textContent,
|
|
4611
4613
|
structuredContent: r.structuredContent
|
|
4612
4614
|
};
|
|
4613
4615
|
}
|
|
4614
|
-
},
|
|
4616
|
+
}, Xi = {}, ie = s.object({
|
|
4615
4617
|
count: s.number().describe("Number of consecutive periods in this streak."),
|
|
4616
4618
|
start: s.string().describe("Start date of the streak."),
|
|
4617
4619
|
end: s.string().describe("End date of the streak.")
|
|
4618
4620
|
}), At = s.object({
|
|
4619
4621
|
id: s.string().describe("Project ID."),
|
|
4620
4622
|
completed: s.number().describe("Number of tasks completed in this project.")
|
|
4621
|
-
}),
|
|
4623
|
+
}), Zi = {
|
|
4622
4624
|
completedCount: s.number().describe("Total number of completed tasks (all-time)."),
|
|
4623
4625
|
daysItems: s.array(
|
|
4624
4626
|
s.object({
|
|
@@ -4638,12 +4640,12 @@ const Ja = {
|
|
|
4638
4640
|
goals: s.object({
|
|
4639
4641
|
dailyGoal: s.number().describe("Daily task completion goal."),
|
|
4640
4642
|
weeklyGoal: s.number().describe("Weekly task completion goal."),
|
|
4641
|
-
currentDailyStreak:
|
|
4642
|
-
currentWeeklyStreak:
|
|
4643
|
-
lastDailyStreak:
|
|
4644
|
-
lastWeeklyStreak:
|
|
4645
|
-
maxDailyStreak:
|
|
4646
|
-
maxWeeklyStreak:
|
|
4643
|
+
currentDailyStreak: ie.describe("Current daily goal streak."),
|
|
4644
|
+
currentWeeklyStreak: ie.describe("Current weekly goal streak."),
|
|
4645
|
+
lastDailyStreak: ie.describe("Previous daily goal streak."),
|
|
4646
|
+
lastWeeklyStreak: ie.describe("Previous weekly goal streak."),
|
|
4647
|
+
maxDailyStreak: ie.describe("Best daily goal streak ever."),
|
|
4648
|
+
maxWeeklyStreak: ie.describe("Best weekly goal streak ever."),
|
|
4647
4649
|
vacationMode: s.boolean().describe("Whether vacation mode is enabled."),
|
|
4648
4650
|
karmaDisabled: s.boolean().describe("Whether karma tracking is disabled.")
|
|
4649
4651
|
}).describe("Goal and streak information."),
|
|
@@ -4667,11 +4669,11 @@ const Ja = {
|
|
|
4667
4669
|
})
|
|
4668
4670
|
).describe("Recent karma change events with reasons."),
|
|
4669
4671
|
projectColors: s.record(s.string(), s.string()).describe("Map of project ID to color key.")
|
|
4670
|
-
},
|
|
4672
|
+
}, Qi = {
|
|
4671
4673
|
name: g.GET_PRODUCTIVITY_STATS,
|
|
4672
|
-
description:
|
|
4673
|
-
parameters:
|
|
4674
|
-
outputSchema:
|
|
4674
|
+
description: 'Get comprehensive productivity statistics including daily/weekly completion breakdowns, goal streaks (current, last, max), karma score and trends, and historical karma data. Useful for productivity analysis and tracking goal progress. Reports counts, streaks and karma only, never the tasks themselves — for "what did I complete", use find-activity.',
|
|
4675
|
+
parameters: Xi,
|
|
4676
|
+
outputSchema: Zi,
|
|
4675
4677
|
annotations: {
|
|
4676
4678
|
readOnlyHint: !0,
|
|
4677
4679
|
destructiveHint: !1,
|
|
@@ -4680,7 +4682,7 @@ const Ja = {
|
|
|
4680
4682
|
async execute(e, t) {
|
|
4681
4683
|
const r = await t.getProductivityStats();
|
|
4682
4684
|
return {
|
|
4683
|
-
textContent:
|
|
4685
|
+
textContent: ea(r),
|
|
4684
4686
|
structuredContent: {
|
|
4685
4687
|
completedCount: r.completedCount,
|
|
4686
4688
|
daysItems: r.daysItems,
|
|
@@ -4707,7 +4709,7 @@ const Ja = {
|
|
|
4707
4709
|
};
|
|
4708
4710
|
}
|
|
4709
4711
|
};
|
|
4710
|
-
function
|
|
4712
|
+
function ea(e) {
|
|
4711
4713
|
const t = [
|
|
4712
4714
|
"# Productivity Statistics",
|
|
4713
4715
|
"",
|
|
@@ -4737,11 +4739,11 @@ function ei(e) {
|
|
|
4737
4739
|
return t.join(`
|
|
4738
4740
|
`);
|
|
4739
4741
|
}
|
|
4740
|
-
const
|
|
4742
|
+
const ta = {
|
|
4741
4743
|
projectId: s.string().min(1).describe("The ID of the project to get activity stats for."),
|
|
4742
4744
|
weeks: s.number().int().min(1).max(12).optional().describe("Number of weeks of activity data to retrieve (1-12, default 2)."),
|
|
4743
4745
|
includeWeeklyCounts: s.boolean().optional().describe("Include weekly rollup counts alongside daily counts.")
|
|
4744
|
-
},
|
|
4746
|
+
}, sa = {
|
|
4745
4747
|
projectId: s.string().describe("The project ID."),
|
|
4746
4748
|
dayItems: s.array(
|
|
4747
4749
|
s.object({
|
|
@@ -4755,9 +4757,9 @@ const ti = {
|
|
|
4755
4757
|
toDate: s.string().describe("End date of the week."),
|
|
4756
4758
|
totalCount: s.number().describe("Number of tasks completed in this week.")
|
|
4757
4759
|
})
|
|
4758
|
-
).
|
|
4760
|
+
).optional().describe("Weekly completion rollups. Only included when includeWeeklyCounts is true.")
|
|
4759
4761
|
};
|
|
4760
|
-
function
|
|
4762
|
+
function ra(e, t) {
|
|
4761
4763
|
const r = [`# Activity Stats: Project ${e}`, ""];
|
|
4762
4764
|
if (t.dayItems.length > 0) {
|
|
4763
4765
|
r.push("## Daily Activity");
|
|
@@ -4773,47 +4775,47 @@ function ri(e, t) {
|
|
|
4773
4775
|
return r.join(`
|
|
4774
4776
|
`);
|
|
4775
4777
|
}
|
|
4776
|
-
const
|
|
4778
|
+
const oa = {
|
|
4777
4779
|
name: g.GET_PROJECT_ACTIVITY_STATS,
|
|
4778
4780
|
description: "Get daily and optional weekly task completion counts for a project over a configurable time window (1-12 weeks). Useful for identifying completion trends and patterns.",
|
|
4779
|
-
parameters:
|
|
4780
|
-
outputSchema:
|
|
4781
|
+
parameters: ta,
|
|
4782
|
+
outputSchema: sa,
|
|
4781
4783
|
annotations: {
|
|
4782
4784
|
readOnlyHint: !0,
|
|
4783
4785
|
destructiveHint: !1,
|
|
4784
4786
|
idempotentHint: !0
|
|
4785
4787
|
},
|
|
4786
4788
|
async execute(e, t) {
|
|
4787
|
-
const { projectId: r, weeks: o, includeWeeklyCounts: n } = e,
|
|
4789
|
+
const { projectId: r, weeks: o, includeWeeklyCounts: n } = e, i = await t.getProjectActivityStats(r, {
|
|
4788
4790
|
weeks: o,
|
|
4789
4791
|
includeWeeklyCounts: n
|
|
4790
4792
|
});
|
|
4791
4793
|
return {
|
|
4792
|
-
textContent:
|
|
4794
|
+
textContent: ra(r, i),
|
|
4793
4795
|
structuredContent: {
|
|
4794
4796
|
projectId: r,
|
|
4795
|
-
dayItems:
|
|
4796
|
-
weekItems:
|
|
4797
|
+
dayItems: i.dayItems,
|
|
4798
|
+
weekItems: i.weekItems ?? void 0
|
|
4797
4799
|
}
|
|
4798
4800
|
};
|
|
4799
4801
|
}
|
|
4800
|
-
},
|
|
4802
|
+
}, na = {
|
|
4801
4803
|
projectId: s.string().min(1).describe("The ID of the project to check health for."),
|
|
4802
4804
|
includeContext: s.boolean().default(!1).describe(
|
|
4803
4805
|
"Include detailed health context with project metrics and task-level data. May produce large output for projects with many tasks."
|
|
4804
4806
|
)
|
|
4805
|
-
},
|
|
4807
|
+
}, ia = s.object({
|
|
4806
4808
|
taskId: s.string().describe("The ID of the task this recommendation is for."),
|
|
4807
4809
|
recommendation: s.string().describe("The recommendation for this task.")
|
|
4808
|
-
}),
|
|
4810
|
+
}), aa = s.object({
|
|
4809
4811
|
id: s.string().describe("The task ID."),
|
|
4810
4812
|
content: s.string().describe("The task content/title."),
|
|
4811
4813
|
priority: s.string().describe("The task priority (1-4)."),
|
|
4812
|
-
due: s.string().
|
|
4813
|
-
deadline: s.string().
|
|
4814
|
+
due: s.string().optional().describe("The due date string, if set."),
|
|
4815
|
+
deadline: s.string().optional().describe("The deadline date string, if set."),
|
|
4814
4816
|
isCompleted: s.boolean().describe("Whether the task is completed."),
|
|
4815
4817
|
labels: s.array(s.string()).describe("Labels applied to this task.")
|
|
4816
|
-
}),
|
|
4818
|
+
}), ca = {
|
|
4817
4819
|
projectId: s.string().describe("The project ID."),
|
|
4818
4820
|
projectName: s.string().describe("The project name."),
|
|
4819
4821
|
progress: s.object({
|
|
@@ -4823,36 +4825,36 @@ const oi = {
|
|
|
4823
4825
|
}).describe("Project completion progress."),
|
|
4824
4826
|
health: s.object({
|
|
4825
4827
|
status: s.enum(Ge).describe("The overall health status of the project."),
|
|
4826
|
-
description: s.string().
|
|
4827
|
-
descriptionSummary: s.string().
|
|
4828
|
-
taskRecommendations: s.array(
|
|
4828
|
+
description: s.string().optional().describe("Detailed description of the health assessment."),
|
|
4829
|
+
descriptionSummary: s.string().optional().describe("Brief summary of the health assessment."),
|
|
4830
|
+
taskRecommendations: s.array(ia).optional().describe("Specific recommendations for individual tasks."),
|
|
4829
4831
|
isStale: s.boolean().describe("Whether the health data is stale and may need refreshing."),
|
|
4830
4832
|
updateInProgress: s.boolean().describe("Whether a health analysis update is currently in progress."),
|
|
4831
|
-
updatedAt: s.string().
|
|
4833
|
+
updatedAt: s.string().optional().describe("When the health assessment was last updated.")
|
|
4832
4834
|
}).describe("Project health assessment."),
|
|
4833
4835
|
context: s.object({
|
|
4834
|
-
projectDescription: s.string().
|
|
4836
|
+
projectDescription: s.string().optional().describe("The project description, if any."),
|
|
4835
4837
|
projectMetrics: s.object({
|
|
4836
4838
|
totalTasks: s.number().describe("Total number of tasks in the project."),
|
|
4837
4839
|
completedTasks: s.number().describe("Number of completed tasks."),
|
|
4838
4840
|
overdueTasks: s.number().describe("Number of overdue tasks."),
|
|
4839
4841
|
tasksCreatedThisWeek: s.number().describe("Tasks created in the current week."),
|
|
4840
4842
|
tasksCompletedThisWeek: s.number().describe("Tasks completed in the current week."),
|
|
4841
|
-
averageCompletionTime: s.number().
|
|
4843
|
+
averageCompletionTime: s.number().optional().describe("Average task completion time in days, if available.")
|
|
4842
4844
|
}).describe("Aggregated project metrics."),
|
|
4843
|
-
tasks: s.array(
|
|
4845
|
+
tasks: s.array(aa).describe("Tasks in the project.")
|
|
4844
4846
|
}).optional().describe(
|
|
4845
4847
|
"Detailed project context with metrics and task data. Only included when includeContext is true."
|
|
4846
4848
|
)
|
|
4847
4849
|
};
|
|
4848
|
-
async function
|
|
4850
|
+
async function da(e, t, r) {
|
|
4849
4851
|
if (r) {
|
|
4850
|
-
const [
|
|
4852
|
+
const [i, a, c] = await Promise.all([
|
|
4851
4853
|
e.getProjectProgress(t),
|
|
4852
4854
|
e.getProjectHealth(t),
|
|
4853
4855
|
e.getProjectHealthContext(t)
|
|
4854
4856
|
]);
|
|
4855
|
-
return { progress:
|
|
4857
|
+
return { progress: i, health: a, context: c };
|
|
4856
4858
|
}
|
|
4857
4859
|
const [o, n] = await Promise.all([
|
|
4858
4860
|
e.getProjectProgress(t),
|
|
@@ -4860,58 +4862,61 @@ async function di(e, t, r) {
|
|
|
4860
4862
|
]);
|
|
4861
4863
|
return { progress: o, health: n };
|
|
4862
4864
|
}
|
|
4863
|
-
function
|
|
4865
|
+
function la(e, { progress: t, health: r, context: o }) {
|
|
4864
4866
|
const n = [`# Project Health: ${e}`, ""];
|
|
4865
4867
|
if (n.push(`**Status:** ${r.status}`), r.isStale && n.push("**Note:** Health data is stale and may not reflect recent changes."), r.updateInProgress && n.push("**Note:** A health analysis update is currently in progress."), r.updatedAt && n.push(`**Last Updated:** ${r.updatedAt.toISOString()}`), n.push(""), n.push("## Progress"), n.push(
|
|
4866
4868
|
`**Completed:** ${t.completedCount} | **Active:** ${t.activeCount} | **Progress:** ${t.progressPercent}%`
|
|
4867
4869
|
), r.description && (n.push(""), n.push("## Health Description"), n.push(r.description)), r.taskRecommendations && r.taskRecommendations.length > 0) {
|
|
4868
4870
|
n.push(""), n.push("## Task Recommendations");
|
|
4869
|
-
for (const
|
|
4870
|
-
n.push(`- **Task ${
|
|
4871
|
+
for (const i of r.taskRecommendations)
|
|
4872
|
+
n.push(`- **Task ${i.taskId}**: ${i.recommendation}`);
|
|
4871
4873
|
}
|
|
4872
4874
|
if (o) {
|
|
4873
4875
|
n.push(""), n.push("## Project Metrics");
|
|
4874
|
-
const
|
|
4875
|
-
if (n.push(`- **Total Tasks:** ${
|
|
4876
|
+
const i = o.projectMetrics;
|
|
4877
|
+
if (n.push(`- **Total Tasks:** ${i.totalTasks}`), n.push(`- **Completed:** ${i.completedTasks}`), n.push(`- **Overdue:** ${i.overdueTasks}`), n.push(`- **Created This Week:** ${i.tasksCreatedThisWeek}`), n.push(`- **Completed This Week:** ${i.tasksCompletedThisWeek}`), i.averageCompletionTime !== null && n.push(`- **Avg Completion Time:** ${i.averageCompletionTime} days`), o.tasks.length > 0) {
|
|
4876
4878
|
n.push(""), n.push(`## Tasks (${o.tasks.length})`);
|
|
4877
|
-
for (const
|
|
4878
|
-
const c = [`id=${
|
|
4879
|
-
|
|
4879
|
+
for (const a of o.tasks) {
|
|
4880
|
+
const c = [`id=${a.id}`, a.content];
|
|
4881
|
+
a.due && c.push(`due=${a.due}`), a.deadline && c.push(`deadline=${a.deadline}`), a.isCompleted && c.push("(completed)"), n.push(`- ${c.join("; ")}`);
|
|
4880
4882
|
}
|
|
4881
4883
|
}
|
|
4882
4884
|
}
|
|
4883
4885
|
return n.join(`
|
|
4884
4886
|
`);
|
|
4885
4887
|
}
|
|
4886
|
-
const
|
|
4888
|
+
const ua = {
|
|
4887
4889
|
name: g.GET_PROJECT_HEALTH,
|
|
4888
4890
|
description: "Get a comprehensive health assessment for a project including completion progress, health status (EXCELLENT, ON_TRACK, AT_RISK, CRITICAL), and optional detailed context with project metrics and task-level recommendations. Use includeContext=true for full detail including task data.",
|
|
4889
|
-
parameters:
|
|
4890
|
-
outputSchema:
|
|
4891
|
+
parameters: na,
|
|
4892
|
+
outputSchema: ca,
|
|
4891
4893
|
annotations: {
|
|
4892
4894
|
readOnlyHint: !0,
|
|
4893
4895
|
destructiveHint: !1,
|
|
4894
4896
|
idempotentHint: !0
|
|
4895
4897
|
},
|
|
4896
4898
|
async execute(e, t) {
|
|
4897
|
-
const { projectId: r, includeContext: o } = e, n = await
|
|
4898
|
-
projectDescription: n.context.projectDescription,
|
|
4899
|
-
projectMetrics:
|
|
4899
|
+
const { projectId: r, includeContext: o } = e, n = await da(t, r, o), i = n.context?.projectName ?? `Project ${r}`, a = la(i, n), c = n.context ? {
|
|
4900
|
+
projectDescription: n.context.projectDescription ?? void 0,
|
|
4901
|
+
projectMetrics: {
|
|
4902
|
+
...n.context.projectMetrics,
|
|
4903
|
+
averageCompletionTime: n.context.projectMetrics.averageCompletionTime ?? void 0
|
|
4904
|
+
},
|
|
4900
4905
|
tasks: n.context.tasks.map((d) => ({
|
|
4901
4906
|
id: d.id,
|
|
4902
4907
|
content: d.content,
|
|
4903
4908
|
priority: d.priority,
|
|
4904
|
-
due: d.due ??
|
|
4905
|
-
deadline: d.deadline ??
|
|
4909
|
+
due: d.due ?? void 0,
|
|
4910
|
+
deadline: d.deadline ?? void 0,
|
|
4906
4911
|
isCompleted: d.isCompleted,
|
|
4907
4912
|
labels: d.labels
|
|
4908
4913
|
}))
|
|
4909
4914
|
} : void 0;
|
|
4910
4915
|
return {
|
|
4911
|
-
textContent:
|
|
4916
|
+
textContent: a,
|
|
4912
4917
|
structuredContent: {
|
|
4913
4918
|
projectId: r,
|
|
4914
|
-
projectName:
|
|
4919
|
+
projectName: i,
|
|
4915
4920
|
progress: {
|
|
4916
4921
|
completedCount: n.progress.completedCount,
|
|
4917
4922
|
activeCount: n.progress.activeCount,
|
|
@@ -4919,69 +4924,68 @@ const ui = {
|
|
|
4919
4924
|
},
|
|
4920
4925
|
health: {
|
|
4921
4926
|
status: n.health.status,
|
|
4922
|
-
description: n.health.description ??
|
|
4923
|
-
descriptionSummary: n.health.descriptionSummary ??
|
|
4924
|
-
taskRecommendations: n.health.taskRecommendations ??
|
|
4927
|
+
description: n.health.description ?? void 0,
|
|
4928
|
+
descriptionSummary: n.health.descriptionSummary ?? void 0,
|
|
4929
|
+
taskRecommendations: n.health.taskRecommendations ?? void 0,
|
|
4925
4930
|
isStale: n.health.isStale,
|
|
4926
4931
|
updateInProgress: n.health.updateInProgress,
|
|
4927
|
-
updatedAt: n.health.updatedAt?.toISOString()
|
|
4932
|
+
updatedAt: n.health.updatedAt?.toISOString()
|
|
4928
4933
|
},
|
|
4929
4934
|
context: c
|
|
4930
4935
|
}
|
|
4931
4936
|
};
|
|
4932
4937
|
}
|
|
4933
|
-
},
|
|
4938
|
+
}, pa = {
|
|
4934
4939
|
workspaceIdOrName: s.string().min(1).describe(
|
|
4935
4940
|
"The workspace ID or name. Supports exact ID, exact name match (case-insensitive), or unique partial name match."
|
|
4936
4941
|
),
|
|
4937
4942
|
projectIds: s.array(s.string().min(1)).min(1).optional().describe("Optional list of project IDs to scope insights to specific projects.")
|
|
4938
|
-
},
|
|
4943
|
+
}, ma = s.object({
|
|
4939
4944
|
projectId: s.string().describe("The project ID."),
|
|
4940
4945
|
health: s.object({
|
|
4941
4946
|
status: s.enum(Ge).describe("The health status of the project."),
|
|
4942
4947
|
isStale: s.boolean().describe("Whether the health data is stale."),
|
|
4943
4948
|
updateInProgress: s.boolean().describe("Whether a health analysis update is in progress.")
|
|
4944
|
-
}).
|
|
4949
|
+
}).optional().describe("Health data for this project. Omitted when the project has none."),
|
|
4945
4950
|
progress: s.object({
|
|
4946
4951
|
completedCount: s.number().describe("Number of completed tasks."),
|
|
4947
4952
|
activeCount: s.number().describe("Number of active tasks."),
|
|
4948
4953
|
progressPercent: s.number().describe("Completion percentage (0-100).")
|
|
4949
|
-
}).
|
|
4950
|
-
}),
|
|
4954
|
+
}).optional().describe("Progress data for this project. Omitted when the project has none.")
|
|
4955
|
+
}), ha = {
|
|
4951
4956
|
workspaceId: s.string().describe("The resolved workspace ID."),
|
|
4952
4957
|
workspaceName: s.string().describe("The resolved workspace name."),
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
}, fi = {
|
|
4958
|
+
projectInsights: s.array(ma).describe("Health and progress insights for each project in the workspace.")
|
|
4959
|
+
}, fa = {
|
|
4956
4960
|
name: g.GET_WORKSPACE_INSIGHTS,
|
|
4957
4961
|
description: "Get aggregated health and progress insights across all projects in a workspace. Accepts workspace name or ID, with optional project ID filtering. Useful for a cross-project health overview.",
|
|
4958
|
-
parameters:
|
|
4959
|
-
outputSchema:
|
|
4962
|
+
parameters: pa,
|
|
4963
|
+
outputSchema: ha,
|
|
4960
4964
|
annotations: {
|
|
4961
4965
|
readOnlyHint: !0,
|
|
4962
4966
|
destructiveHint: !1,
|
|
4963
4967
|
idempotentHint: !0
|
|
4964
4968
|
},
|
|
4965
4969
|
async execute(e, t) {
|
|
4966
|
-
const { workspaceIdOrName: r, projectIds: o } = e, n = await
|
|
4970
|
+
const { workspaceIdOrName: r, projectIds: o } = e, n = await as.resolveWorkspace(t, r), a = (await t.getWorkspaceInsights(n.workspaceId, { projectIds: o })).projectInsights.map((d) => ({
|
|
4967
4971
|
projectId: d.projectId,
|
|
4968
4972
|
health: d.health ? {
|
|
4969
4973
|
status: d.health.status,
|
|
4970
4974
|
isStale: d.health.isStale,
|
|
4971
4975
|
updateInProgress: d.health.updateInProgress
|
|
4972
|
-
} :
|
|
4976
|
+
} : void 0,
|
|
4973
4977
|
progress: d.progress ? {
|
|
4974
4978
|
completedCount: d.progress.completedCount,
|
|
4975
4979
|
activeCount: d.progress.activeCount,
|
|
4976
4980
|
progressPercent: d.progress.progressPercent
|
|
4977
|
-
} :
|
|
4981
|
+
} : void 0
|
|
4978
4982
|
})), c = [
|
|
4979
4983
|
`# Workspace Insights: ${n.workspaceName}`,
|
|
4980
4984
|
"",
|
|
4981
|
-
`**Projects:** ${
|
|
4985
|
+
`**Projects:** ${a.length}`,
|
|
4982
4986
|
""
|
|
4983
4987
|
];
|
|
4984
|
-
for (const d of
|
|
4988
|
+
for (const d of a) {
|
|
4985
4989
|
const l = d.health?.status ?? "N/A", u = d.progress ? `${d.progress.progressPercent}%` : "N/A";
|
|
4986
4990
|
c.push(`- Project ${d.projectId}: status=${l}, progress=${u}`);
|
|
4987
4991
|
}
|
|
@@ -4991,13 +4995,12 @@ const ui = {
|
|
|
4991
4995
|
structuredContent: {
|
|
4992
4996
|
workspaceId: n.workspaceId,
|
|
4993
4997
|
workspaceName: n.workspaceName,
|
|
4994
|
-
|
|
4995
|
-
projectInsights: i
|
|
4998
|
+
projectInsights: a
|
|
4996
4999
|
}
|
|
4997
5000
|
};
|
|
4998
5001
|
}
|
|
4999
5002
|
};
|
|
5000
|
-
function
|
|
5003
|
+
function ba(e) {
|
|
5001
5004
|
const t = e.trim();
|
|
5002
5005
|
if (!/^https?:\/\//i.test(t))
|
|
5003
5006
|
return t;
|
|
@@ -5007,23 +5010,23 @@ function bi(e) {
|
|
|
5007
5010
|
} catch {
|
|
5008
5011
|
throw new Error(`Could not read a template ID from "${t}".`);
|
|
5009
5012
|
}
|
|
5010
|
-
if (!
|
|
5013
|
+
if (!ga(r.hostname))
|
|
5011
5014
|
throw new Error(
|
|
5012
5015
|
`"${r.hostname}" is not a Todoist domain. Pass a todoist.com template URL or the template ID itself.`
|
|
5013
5016
|
);
|
|
5014
5017
|
const o = r.pathname.split("/").filter(Boolean);
|
|
5015
5018
|
if (!o.includes("templates"))
|
|
5016
5019
|
throw new Error(`"${t}" is not a Todoist template URL.`);
|
|
5017
|
-
const n = o.at(-1),
|
|
5018
|
-
if (!
|
|
5020
|
+
const n = o.at(-1), i = n === "view" ? o.at(-2) : n;
|
|
5021
|
+
if (!i)
|
|
5019
5022
|
throw new Error(`Could not read a template ID from "${t}".`);
|
|
5020
|
-
return
|
|
5023
|
+
return i;
|
|
5021
5024
|
}
|
|
5022
|
-
function
|
|
5025
|
+
function ga(e) {
|
|
5023
5026
|
const t = e.toLowerCase();
|
|
5024
5027
|
return t === "todoist.com" || t.endsWith(".todoist.com");
|
|
5025
5028
|
}
|
|
5026
|
-
const
|
|
5029
|
+
const ya = {
|
|
5027
5030
|
projectId: s.string().min(1).describe("The ID of the existing project to import the template into."),
|
|
5028
5031
|
templateId: s.string().optional().describe(
|
|
5029
5032
|
'The template to import — either a gallery slug ("product-launch"), a personal template ID ("UT_28Ex..."), or a full Todoist template URL, which is reduced to the ID automatically. Gallery templates work for anyone; personal templates only for the account that owns them. There is no way to list templates through this server, so only use the ID or URL the user supplied. Provide either this or `csvFileContent`, not both.'
|
|
@@ -5032,57 +5035,57 @@ const yi = {
|
|
|
5032
5035
|
"Raw CSV template content, as produced by export-project-template. Provide either this or `templateId`, not both."
|
|
5033
5036
|
),
|
|
5034
5037
|
locale: s.string().optional().describe('Locale for the imported content when using `templateId`. Defaults to "en".')
|
|
5035
|
-
},
|
|
5038
|
+
}, Ta = {
|
|
5036
5039
|
sections: s.array(X).describe("Sections created by the import."),
|
|
5037
5040
|
tasks: s.array(F).describe("Tasks created by the import."),
|
|
5038
5041
|
comments: s.array(ye).describe("Comments created by the import."),
|
|
5039
5042
|
totalCount: s.number().describe("The total number of objects created by the import.")
|
|
5040
|
-
},
|
|
5043
|
+
}, ka = {
|
|
5041
5044
|
name: g.IMPORT_PROJECT_TEMPLATE,
|
|
5042
5045
|
description: "Import a template into an existing project, adding its tasks, sections and comments to whatever is already there. Source it by template ID/URL or by passing CSV content from export-project-template. To start a new project from a template, create the project with add-projects first, then import into it. This writes immediately and cannot be undone, so only run it against a project the user named.",
|
|
5043
|
-
parameters:
|
|
5044
|
-
outputSchema:
|
|
5046
|
+
parameters: ya,
|
|
5047
|
+
outputSchema: Ta,
|
|
5045
5048
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
5046
5049
|
async execute({ projectId: e, templateId: t, csvFileContent: r, locale: o }, n) {
|
|
5047
5050
|
if (!!t == !!r)
|
|
5048
5051
|
throw new Error(
|
|
5049
5052
|
"Provide exactly one template source: either `templateId` or `csvFileContent`. Templates cannot be listed through this server — ask the user for an ID or template URL."
|
|
5050
5053
|
);
|
|
5051
|
-
const
|
|
5054
|
+
const i = t ? await n.importTemplateFromId({
|
|
5052
5055
|
projectId: e,
|
|
5053
|
-
templateId:
|
|
5056
|
+
templateId: ba(t),
|
|
5054
5057
|
locale: o
|
|
5055
5058
|
}) : await n.importTemplateIntoProject({
|
|
5056
5059
|
projectId: e,
|
|
5057
5060
|
file: r ?? "",
|
|
5058
5061
|
fileName: "template.csv"
|
|
5059
|
-
}),
|
|
5062
|
+
}), a = i.sections.map(q), c = i.tasks.map(P), d = i.comments.map(ge), l = i.projects.length + a.length + c.length + d.length;
|
|
5060
5063
|
return {
|
|
5061
|
-
textContent:
|
|
5064
|
+
textContent: wa({
|
|
5062
5065
|
projectId: e,
|
|
5063
5066
|
counts: {
|
|
5064
|
-
projects:
|
|
5065
|
-
sections:
|
|
5067
|
+
projects: i.projects.length,
|
|
5068
|
+
sections: a.length,
|
|
5066
5069
|
tasks: c.length,
|
|
5067
5070
|
comments: d.length
|
|
5068
5071
|
},
|
|
5069
5072
|
totalCount: l
|
|
5070
5073
|
}),
|
|
5071
|
-
structuredContent: { sections:
|
|
5074
|
+
structuredContent: { sections: a, tasks: c, comments: d, totalCount: l }
|
|
5072
5075
|
};
|
|
5073
5076
|
}
|
|
5074
5077
|
};
|
|
5075
|
-
function
|
|
5078
|
+
function wa({
|
|
5076
5079
|
projectId: e,
|
|
5077
5080
|
counts: t,
|
|
5078
5081
|
totalCount: r
|
|
5079
5082
|
}) {
|
|
5080
5083
|
if (r === 0)
|
|
5081
5084
|
return `Imported template into project (id=${e}), but it created nothing.`;
|
|
5082
|
-
const o = Object.entries(t).filter(([, n]) => n > 0).map(([n,
|
|
5085
|
+
const o = Object.entries(t).filter(([, n]) => n > 0).map(([n, i]) => `${i} ${i === 1 ? n.replace(/s$/, "") : n}`);
|
|
5083
5086
|
return `Imported template into project (id=${e}): ${o.join(", ")}.`;
|
|
5084
5087
|
}
|
|
5085
|
-
const
|
|
5088
|
+
const va = {}, Ia = {
|
|
5086
5089
|
id: s.string().describe("The unique identifier for the workspace."),
|
|
5087
5090
|
name: s.string().describe("The name of the workspace."),
|
|
5088
5091
|
plan: s.enum(Hs).describe("The workspace plan type."),
|
|
@@ -5091,21 +5094,21 @@ const vi = {}, Ii = {
|
|
|
5091
5094
|
isGuestAllowed: s.boolean().describe("Whether guests are allowed in the workspace."),
|
|
5092
5095
|
createdAt: s.string().optional().describe("The ISO 8601 timestamp when the workspace was created."),
|
|
5093
5096
|
creatorId: s.string().describe("The ID of the user who created the workspace.")
|
|
5094
|
-
},
|
|
5097
|
+
}, Sa = {
|
|
5095
5098
|
type: s.literal("workspaces").describe("The type of the response."),
|
|
5096
|
-
workspaces: s.array(s.object(
|
|
5099
|
+
workspaces: s.array(s.object(Ia)).describe("List of workspaces."),
|
|
5097
5100
|
count: s.number().describe("The total number of workspaces.")
|
|
5098
5101
|
};
|
|
5099
|
-
async function
|
|
5100
|
-
const r = (await e.getWorkspaces()).map((
|
|
5101
|
-
id:
|
|
5102
|
-
name:
|
|
5103
|
-
plan:
|
|
5104
|
-
role:
|
|
5105
|
-
isLinkSharingEnabled:
|
|
5106
|
-
isGuestAllowed:
|
|
5107
|
-
createdAt:
|
|
5108
|
-
creatorId:
|
|
5102
|
+
async function ja(e) {
|
|
5103
|
+
const r = (await e.getWorkspaces()).map((a) => ({
|
|
5104
|
+
id: a.id,
|
|
5105
|
+
name: a.name,
|
|
5106
|
+
plan: a.plan,
|
|
5107
|
+
role: a.role,
|
|
5108
|
+
isLinkSharingEnabled: a.isLinkSharingEnabled,
|
|
5109
|
+
isGuestAllowed: a.isGuestAllowed,
|
|
5110
|
+
createdAt: a.createdAt?.toISOString(),
|
|
5111
|
+
creatorId: a.creatorId
|
|
5109
5112
|
})), o = ["# Workspaces", ""];
|
|
5110
5113
|
if (r.length === 0)
|
|
5111
5114
|
o.push("No workspaces found.");
|
|
@@ -5114,35 +5117,35 @@ async function ji(e) {
|
|
|
5114
5117
|
`Found ${r.length} workspace${r.length === 1 ? "" : "s"}:`,
|
|
5115
5118
|
""
|
|
5116
5119
|
);
|
|
5117
|
-
for (const
|
|
5118
|
-
o.push(`## ${
|
|
5119
|
-
`- **Link Sharing:** ${
|
|
5120
|
-
), o.push(`- **Guests Allowed:** ${
|
|
5120
|
+
for (const a of r)
|
|
5121
|
+
o.push(`## ${a.name}`), o.push(`- **ID:** ${a.id}`), o.push(`- **Plan:** ${a.plan}`), a.role && o.push(`- **Your Role:** ${a.role}`), o.push(
|
|
5122
|
+
`- **Link Sharing:** ${a.isLinkSharingEnabled ? "Enabled" : "Disabled"}`
|
|
5123
|
+
), o.push(`- **Guests Allowed:** ${a.isGuestAllowed ? "Yes" : "No"}`), a.createdAt && o.push(`- **Created:** ${a.createdAt}`), o.push(`- **Creator ID:** ${a.creatorId}`), o.push("");
|
|
5121
5124
|
}
|
|
5122
5125
|
const n = o.join(`
|
|
5123
|
-
`),
|
|
5126
|
+
`), i = {
|
|
5124
5127
|
type: "workspaces",
|
|
5125
5128
|
workspaces: r,
|
|
5126
5129
|
count: r.length
|
|
5127
5130
|
};
|
|
5128
|
-
return { textContent: n, structuredContent:
|
|
5131
|
+
return { textContent: n, structuredContent: i };
|
|
5129
5132
|
}
|
|
5130
|
-
const
|
|
5133
|
+
const Ca = {
|
|
5131
5134
|
name: g.LIST_WORKSPACES,
|
|
5132
5135
|
description: "Get all workspaces for the authenticated user. Returns workspace details including ID, name, plan type (STARTER/BUSINESS), user role (ADMIN/MEMBER/GUEST), link sharing settings, guest permissions, creation date, and creator ID.",
|
|
5133
|
-
parameters:
|
|
5134
|
-
outputSchema:
|
|
5136
|
+
parameters: va,
|
|
5137
|
+
outputSchema: Sa,
|
|
5135
5138
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
5136
5139
|
async execute(e, t) {
|
|
5137
|
-
const r = await
|
|
5140
|
+
const r = await ja(t);
|
|
5138
5141
|
return {
|
|
5139
5142
|
textContent: r.textContent,
|
|
5140
5143
|
structuredContent: r.structuredContent
|
|
5141
5144
|
};
|
|
5142
5145
|
}
|
|
5143
|
-
}, { FIND_TASKS: $
|
|
5146
|
+
}, { FIND_TASKS: $a, FIND_PROJECT_COLLABORATORS: Et, UPDATE_TASKS: Da } = g, xa = 50, Aa = {
|
|
5144
5147
|
operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
|
|
5145
|
-
taskIds: s.array(s.string()).min(1).max(
|
|
5148
|
+
taskIds: s.array(s.string()).min(1).max(xa).describe("The IDs of the tasks to operate on (max 50)."),
|
|
5146
5149
|
responsibleUser: s.string().optional().describe(
|
|
5147
5150
|
'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.'
|
|
5148
5151
|
),
|
|
@@ -5150,7 +5153,7 @@ const Ci = {
|
|
|
5150
5153
|
"For reassign operations: the current assignee to reassign from. Can be user ID, name, or email. Optional - if not provided, reassigns from any current assignee."
|
|
5151
5154
|
),
|
|
5152
5155
|
dryRun: s.boolean().optional().default(!1).describe("If true, validates operations without executing them.")
|
|
5153
|
-
},
|
|
5156
|
+
}, Ea = {
|
|
5154
5157
|
results: s.array(
|
|
5155
5158
|
s.object({
|
|
5156
5159
|
taskId: s.string().describe("The ID of the task."),
|
|
@@ -5166,14 +5169,14 @@ const Ci = {
|
|
|
5166
5169
|
failed: s.number().describe("Number of failed operations."),
|
|
5167
5170
|
dryRun: s.boolean().describe("Whether this was a dry run.")
|
|
5168
5171
|
}).optional().describe("Summary of the operation.")
|
|
5169
|
-
},
|
|
5172
|
+
}, Oa = {
|
|
5170
5173
|
name: g.MANAGE_ASSIGNMENTS,
|
|
5171
5174
|
description: "Bulk assignment operations for multiple tasks. Supports assign, unassign, and reassign operations with atomic rollback on failures.",
|
|
5172
|
-
parameters:
|
|
5173
|
-
outputSchema:
|
|
5175
|
+
parameters: Aa,
|
|
5176
|
+
outputSchema: Ea,
|
|
5174
5177
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5175
5178
|
async execute(e, t) {
|
|
5176
|
-
const { operation: r, taskIds: o, responsibleUser: n, fromAssigneeUser:
|
|
5179
|
+
const { operation: r, taskIds: o, responsibleUser: n, fromAssigneeUser: i, dryRun: a } = e;
|
|
5177
5180
|
if ((r === "assign" || r === "reassign") && !n)
|
|
5178
5181
|
throw new Error(`${r} operation requires responsibleUser parameter`);
|
|
5179
5182
|
const c = await Promise.allSettled(
|
|
@@ -5202,7 +5205,7 @@ const Ci = {
|
|
|
5202
5205
|
throw new Error(`All ${l.length} task(s) failed: ${k}`);
|
|
5203
5206
|
}
|
|
5204
5207
|
let u;
|
|
5205
|
-
r === "reassign" &&
|
|
5208
|
+
r === "reassign" && i && (u = (await W.resolveUser(t, i))?.userId || i);
|
|
5206
5209
|
const p = [];
|
|
5207
5210
|
for (const k of d)
|
|
5208
5211
|
r === "reassign" && u && k.responsibleUid !== u || p.push({
|
|
@@ -5212,7 +5215,7 @@ const Ci = {
|
|
|
5212
5215
|
// Will be validated appropriately
|
|
5213
5216
|
});
|
|
5214
5217
|
if (r === "unassign") {
|
|
5215
|
-
if (
|
|
5218
|
+
if (a) {
|
|
5216
5219
|
const b = d.map(($) => ({
|
|
5217
5220
|
taskId: $.id,
|
|
5218
5221
|
success: !0,
|
|
@@ -5272,7 +5275,7 @@ const Ci = {
|
|
|
5272
5275
|
}
|
|
5273
5276
|
};
|
|
5274
5277
|
}
|
|
5275
|
-
const m = await
|
|
5278
|
+
const m = await at.validateBulkAssignment(
|
|
5276
5279
|
t,
|
|
5277
5280
|
p
|
|
5278
5281
|
), h = [], y = [];
|
|
@@ -5333,7 +5336,7 @@ const Ci = {
|
|
|
5333
5336
|
);
|
|
5334
5337
|
return Promise.all(T);
|
|
5335
5338
|
}
|
|
5336
|
-
const v = await f(h, !
|
|
5339
|
+
const v = await f(h, !a), j = [...v, ...y, ...l];
|
|
5337
5340
|
if (j.length > 0 && j.every((k) => !k.success)) {
|
|
5338
5341
|
const k = j.map((I) => `"${I.taskId}": ${I.error}`).join("; ");
|
|
5339
5342
|
throw new Error(`All ${j.length} ${r} operation(s) failed: ${k}`);
|
|
@@ -5342,7 +5345,7 @@ const Ci = {
|
|
|
5342
5345
|
textContent: Oe({
|
|
5343
5346
|
operation: r,
|
|
5344
5347
|
results: j,
|
|
5345
|
-
dryRun:
|
|
5348
|
+
dryRun: a
|
|
5346
5349
|
}),
|
|
5347
5350
|
structuredContent: {
|
|
5348
5351
|
operation: r,
|
|
@@ -5350,7 +5353,7 @@ const Ci = {
|
|
|
5350
5353
|
totalRequested: o.length,
|
|
5351
5354
|
successful: v.filter((k) => k.success).length,
|
|
5352
5355
|
failed: j.filter((k) => !k.success).length,
|
|
5353
|
-
dryRun:
|
|
5356
|
+
dryRun: a
|
|
5354
5357
|
}
|
|
5355
5358
|
};
|
|
5356
5359
|
}
|
|
@@ -5360,7 +5363,7 @@ function Oe({
|
|
|
5360
5363
|
results: t,
|
|
5361
5364
|
dryRun: r
|
|
5362
5365
|
}) {
|
|
5363
|
-
const o = t.filter((d) => d.success), n = t.filter((d) => !d.success),
|
|
5366
|
+
const o = t.filter((d) => d.success), n = t.filter((d) => !d.success), i = r ? "would be" : "were", a = {
|
|
5364
5367
|
assign: "assigned",
|
|
5365
5368
|
unassign: "unassigned",
|
|
5366
5369
|
reassign: "reassigned"
|
|
@@ -5369,7 +5372,7 @@ function Oe({
|
|
|
5369
5372
|
|
|
5370
5373
|
`;
|
|
5371
5374
|
if (o.length > 0) {
|
|
5372
|
-
c += `**${o.length} task${o.length === 1 ? "" : "s"} ${
|
|
5375
|
+
c += `**${o.length} task${o.length === 1 ? "" : "s"} ${i} successfully ${a}**
|
|
5373
5376
|
`;
|
|
5374
5377
|
const d = o.slice(0, 5);
|
|
5375
5378
|
for (const l of d) {
|
|
@@ -5393,8 +5396,8 @@ function Oe({
|
|
|
5393
5396
|
`;
|
|
5394
5397
|
}
|
|
5395
5398
|
return !r && o.length > 0 ? (c += `**Next steps:**
|
|
5396
|
-
`, c += `• Use ${$
|
|
5397
|
-
`, c += `• Use ${
|
|
5399
|
+
`, c += `• Use ${$a} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
|
|
5400
|
+
`, c += `• Use ${Da} for individual assignment changes
|
|
5398
5401
|
`, n.length > 0 && (c += `• Check failed tasks and use ${Et} to verify collaborator access
|
|
5399
5402
|
`)) : r ? (c += `**To execute:**
|
|
5400
5403
|
`, c += `• Remove dryRun parameter and run again to execute changes
|
|
@@ -5406,17 +5409,17 @@ function Oe({
|
|
|
5406
5409
|
`, c += `• Use dryRun=true to validate before executing
|
|
5407
5410
|
`), c;
|
|
5408
5411
|
}
|
|
5409
|
-
const
|
|
5412
|
+
const Pa = {
|
|
5410
5413
|
action: s.enum(["archive", "unarchive"]).describe("The action to perform on the project."),
|
|
5411
5414
|
projectId: s.string().min(1).describe("The ID of the project.")
|
|
5412
|
-
},
|
|
5415
|
+
}, _a = {
|
|
5413
5416
|
project: Q.describe("The updated project."),
|
|
5414
5417
|
success: s.boolean().describe("Whether the action was successful.")
|
|
5415
|
-
},
|
|
5418
|
+
}, Ra = {
|
|
5416
5419
|
name: g.PROJECT_MANAGEMENT,
|
|
5417
5420
|
description: "Archive or unarchive a project by its ID.",
|
|
5418
|
-
parameters:
|
|
5419
|
-
outputSchema:
|
|
5421
|
+
parameters: Pa,
|
|
5422
|
+
outputSchema: _a,
|
|
5420
5423
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
|
|
5421
5424
|
async execute(e, t) {
|
|
5422
5425
|
const r = e.action === "archive" ? await t.archiveProject(e.projectId) : await t.unarchiveProject(e.projectId), o = Z(r);
|
|
@@ -5428,7 +5431,7 @@ const Pi = {
|
|
|
5428
5431
|
}
|
|
5429
5432
|
};
|
|
5430
5433
|
}
|
|
5431
|
-
},
|
|
5434
|
+
}, Ua = {
|
|
5432
5435
|
action: s.enum(["move-to-workspace", "move-to-personal"]).describe("The action to perform on the project."),
|
|
5433
5436
|
projectId: s.string().min(1).describe("The ID of the project to move."),
|
|
5434
5437
|
workspaceId: s.string().min(1).optional().describe("The target workspace ID. Required when action is move-to-workspace."),
|
|
@@ -5436,25 +5439,25 @@ const Pi = {
|
|
|
5436
5439
|
visibility: s.enum(["restricted", "team", "public"]).optional().describe(
|
|
5437
5440
|
"Optional access visibility for the project in the workspace (restricted, team, or public)."
|
|
5438
5441
|
)
|
|
5439
|
-
},
|
|
5442
|
+
}, La = {
|
|
5440
5443
|
project: Q.describe("The moved project."),
|
|
5441
5444
|
success: s.boolean().describe("Whether the move was successful.")
|
|
5442
|
-
},
|
|
5445
|
+
}, Na = {
|
|
5443
5446
|
name: g.PROJECT_MOVE,
|
|
5444
5447
|
description: "Move a project between personal and workspace contexts.",
|
|
5445
|
-
parameters:
|
|
5446
|
-
outputSchema:
|
|
5448
|
+
parameters: Ua,
|
|
5449
|
+
outputSchema: La,
|
|
5447
5450
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
|
|
5448
5451
|
async execute(e, t) {
|
|
5449
5452
|
let r;
|
|
5450
5453
|
if (e.action === "move-to-workspace") {
|
|
5451
5454
|
if (!e.workspaceId)
|
|
5452
5455
|
throw new Error("workspaceId is required when action is move-to-workspace");
|
|
5453
|
-
const
|
|
5456
|
+
const i = {
|
|
5454
5457
|
projectId: e.projectId,
|
|
5455
5458
|
workspaceId: e.workspaceId
|
|
5456
5459
|
};
|
|
5457
|
-
e.folderId && (
|
|
5460
|
+
e.folderId && (i.folderId = e.folderId), e.visibility && (i.access = { visibility: e.visibility }), r = await t.moveProjectToWorkspace(i);
|
|
5458
5461
|
} else
|
|
5459
5462
|
r = await t.moveProjectToPersonal({ projectId: e.projectId });
|
|
5460
5463
|
const o = Z(r);
|
|
@@ -5466,7 +5469,7 @@ const Pi = {
|
|
|
5466
5469
|
}
|
|
5467
5470
|
};
|
|
5468
5471
|
}
|
|
5469
|
-
}, Is = ["project", "section"],
|
|
5472
|
+
}, Is = ["project", "section"], Ma = {
|
|
5470
5473
|
type: s.enum(Is).describe(
|
|
5471
5474
|
'The type of entity to reorder. "project" reorders sibling projects within the same parent (and can move projects to a new parent). "section" reorders sections within the same project.'
|
|
5472
5475
|
),
|
|
@@ -5483,17 +5486,17 @@ const Pi = {
|
|
|
5483
5486
|
).min(1).describe(
|
|
5484
5487
|
"The items to reorder or move. Each item must have at least order or parentId. Items with parentId will be moved first, then items with order will be reordered. All items being reordered should be siblings for predictable results."
|
|
5485
5488
|
)
|
|
5486
|
-
},
|
|
5489
|
+
}, Fa = {
|
|
5487
5490
|
type: s.enum(Is).describe("The type of entity that was reordered/moved."),
|
|
5488
5491
|
movedCount: s.number().describe("The number of entities moved to a new parent."),
|
|
5489
5492
|
reorderedCount: s.number().describe("The number of entities reordered."),
|
|
5490
5493
|
affectedIds: s.array(s.string()).describe("The IDs of all affected entities."),
|
|
5491
5494
|
success: s.boolean().describe("Whether the operation was successful.")
|
|
5492
|
-
},
|
|
5495
|
+
}, Ha = {
|
|
5493
5496
|
name: g.REORDER_OBJECTS,
|
|
5494
5497
|
description: 'Reorder sibling projects or sections, and optionally move projects to a new parent. For projects: set order to reorder siblings, and/or set parentId to move under a new parent (use "root" for top level). For sections: set order to reorder within a project.',
|
|
5495
|
-
parameters:
|
|
5496
|
-
outputSchema:
|
|
5498
|
+
parameters: Ma,
|
|
5499
|
+
outputSchema: Fa,
|
|
5497
5500
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
|
|
5498
5501
|
async execute(e, t) {
|
|
5499
5502
|
const { type: r, items: o } = e, n = /* @__PURE__ */ new Set();
|
|
@@ -5509,10 +5512,10 @@ const Pi = {
|
|
|
5509
5512
|
`parentId is only supported when type is "project", but type is "${r}".`
|
|
5510
5513
|
);
|
|
5511
5514
|
}
|
|
5512
|
-
const
|
|
5513
|
-
for (const p of
|
|
5515
|
+
const i = [], a = o.filter((p) => p.parentId !== void 0);
|
|
5516
|
+
for (const p of a) {
|
|
5514
5517
|
const m = p.parentId;
|
|
5515
|
-
|
|
5518
|
+
i.push(
|
|
5516
5519
|
V("project_move", {
|
|
5517
5520
|
id: p.id,
|
|
5518
5521
|
parentId: m === "root" ? null : m
|
|
@@ -5522,14 +5525,14 @@ const Pi = {
|
|
|
5522
5525
|
const c = o.filter(
|
|
5523
5526
|
(p) => p.order !== void 0
|
|
5524
5527
|
);
|
|
5525
|
-
c.length > 0 && (r === "project" ?
|
|
5528
|
+
c.length > 0 && (r === "project" ? i.push(
|
|
5526
5529
|
V("project_reorder", {
|
|
5527
5530
|
projects: c.map((p) => ({
|
|
5528
5531
|
id: p.id,
|
|
5529
5532
|
childOrder: p.order
|
|
5530
5533
|
}))
|
|
5531
5534
|
})
|
|
5532
|
-
) :
|
|
5535
|
+
) : i.push(
|
|
5533
5536
|
V("section_reorder", {
|
|
5534
5537
|
sections: c.map((p) => ({
|
|
5535
5538
|
id: p.id,
|
|
@@ -5538,39 +5541,39 @@ const Pi = {
|
|
|
5538
5541
|
})
|
|
5539
5542
|
));
|
|
5540
5543
|
try {
|
|
5541
|
-
await t.sync({ commands:
|
|
5544
|
+
await t.sync({ commands: i });
|
|
5542
5545
|
} catch (p) {
|
|
5543
5546
|
const m = p instanceof Error ? p.message : String(p);
|
|
5544
5547
|
throw new Error(`Reorder failed: ${m}`);
|
|
5545
5548
|
}
|
|
5546
5549
|
const d = r === "project" ? "projects" : "sections", l = o.map((p) => p.id), u = [];
|
|
5547
|
-
return
|
|
5550
|
+
return a.length > 0 && u.push(`moved ${a.length}`), c.length > 0 && u.push(`reordered ${c.length}`), {
|
|
5548
5551
|
textContent: `${u.join(" and ")} ${d}: ${l.map((p) => `id=${p}`).join(", ")}`,
|
|
5549
5552
|
structuredContent: {
|
|
5550
5553
|
type: r,
|
|
5551
|
-
movedCount:
|
|
5554
|
+
movedCount: a.length,
|
|
5552
5555
|
reorderedCount: c.length,
|
|
5553
5556
|
affectedIds: l,
|
|
5554
5557
|
success: !0
|
|
5555
5558
|
}
|
|
5556
5559
|
};
|
|
5557
5560
|
}
|
|
5558
|
-
},
|
|
5561
|
+
}, Wa = s.object({
|
|
5559
5562
|
id: s.string().min(1).describe("The ID of the task to reschedule."),
|
|
5560
5563
|
date: s.string().min(1).describe(
|
|
5561
5564
|
"The new date for the task. Use YYYY-MM-DD for date-only, or YYYY-MM-DDTHH:MM:SS for datetime. If date-only is provided and the task already has a specific time, the existing time is preserved."
|
|
5562
5565
|
)
|
|
5563
|
-
}),
|
|
5564
|
-
tasks: s.array(
|
|
5565
|
-
},
|
|
5566
|
+
}), Ba = {
|
|
5567
|
+
tasks: s.array(Wa).min(1).describe("The tasks to reschedule with their new dates.")
|
|
5568
|
+
}, za = {
|
|
5566
5569
|
tasks: s.array(F).describe("The rescheduled tasks."),
|
|
5567
5570
|
totalCount: s.number().describe("The total number of tasks rescheduled."),
|
|
5568
5571
|
rescheduledTaskIds: s.array(s.string()).describe("The IDs of the rescheduled tasks.")
|
|
5569
|
-
},
|
|
5572
|
+
}, qa = {
|
|
5570
5573
|
name: g.RESCHEDULE_TASKS,
|
|
5571
5574
|
description: "Reschedule tasks to new dates while preserving recurring schedules. Unlike update-tasks (which replaces the entire due string and can wipe recurrence), this tool changes only the date, keeping recurrence patterns intact. Use this when moving recurring tasks to a different date without altering their repeat pattern.",
|
|
5572
|
-
parameters:
|
|
5573
|
-
outputSchema:
|
|
5575
|
+
parameters: Ba,
|
|
5576
|
+
outputSchema: za,
|
|
5574
5577
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5575
5578
|
async execute(e, t) {
|
|
5576
5579
|
const { tasks: r } = e, n = (await Promise.all(
|
|
@@ -5583,7 +5586,7 @@ const Pi = {
|
|
|
5583
5586
|
throw new Error(
|
|
5584
5587
|
`Task "${l.content}" (${l.id}) has no due date. Rescheduling requires an existing due date.`
|
|
5585
5588
|
);
|
|
5586
|
-
const u =
|
|
5589
|
+
const u = Ka(d.date, l.due);
|
|
5587
5590
|
return V("item_update", {
|
|
5588
5591
|
id: d.id,
|
|
5589
5592
|
due: {
|
|
@@ -5601,29 +5604,29 @@ const Pi = {
|
|
|
5601
5604
|
const l = d instanceof Error ? d.message : String(d);
|
|
5602
5605
|
throw new Error(`Reschedule failed: ${l}`);
|
|
5603
5606
|
}
|
|
5604
|
-
const
|
|
5607
|
+
const i = await Promise.all(r.map((d) => t.getTask(d.id))), a = i.map(P);
|
|
5605
5608
|
return {
|
|
5606
|
-
textContent: ot("Rescheduled",
|
|
5607
|
-
showDetails:
|
|
5609
|
+
textContent: ot("Rescheduled", a, {
|
|
5610
|
+
showDetails: a.length <= 5
|
|
5608
5611
|
}),
|
|
5609
5612
|
structuredContent: {
|
|
5610
|
-
tasks:
|
|
5611
|
-
totalCount:
|
|
5612
|
-
rescheduledTaskIds:
|
|
5613
|
+
tasks: a,
|
|
5614
|
+
totalCount: a.length,
|
|
5615
|
+
rescheduledTaskIds: i.map((d) => d.id)
|
|
5613
5616
|
}
|
|
5614
5617
|
};
|
|
5615
5618
|
}
|
|
5616
5619
|
};
|
|
5617
|
-
function
|
|
5620
|
+
function Ka(e, t) {
|
|
5618
5621
|
if (/^\d{4}-\d{2}-\d{2}$/.test(e) && t.datetime) {
|
|
5619
5622
|
const o = t.datetime.substring(10);
|
|
5620
5623
|
return e + o;
|
|
5621
5624
|
}
|
|
5622
5625
|
return e;
|
|
5623
5626
|
}
|
|
5624
|
-
const
|
|
5627
|
+
const Ya = {
|
|
5625
5628
|
query: s.string().min(1).describe("The search query string to find tasks and projects.")
|
|
5626
|
-
},
|
|
5629
|
+
}, Ga = {
|
|
5627
5630
|
results: s.array(
|
|
5628
5631
|
s.object({
|
|
5629
5632
|
id: s.string().describe("The ID of the result."),
|
|
@@ -5632,11 +5635,11 @@ const Yi = {
|
|
|
5632
5635
|
})
|
|
5633
5636
|
).describe("The search results."),
|
|
5634
5637
|
totalCount: s.number().describe("Total number of results found.")
|
|
5635
|
-
},
|
|
5638
|
+
}, Va = {
|
|
5636
5639
|
name: g.SEARCH,
|
|
5637
5640
|
description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
|
|
5638
|
-
parameters:
|
|
5639
|
-
outputSchema:
|
|
5641
|
+
parameters: Ya,
|
|
5642
|
+
outputSchema: Ga,
|
|
5640
5643
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
5641
5644
|
async execute(e, t) {
|
|
5642
5645
|
const { query: r } = e, [o, n] = await Promise.all([
|
|
@@ -5647,52 +5650,52 @@ const Yi = {
|
|
|
5647
5650
|
cursor: void 0
|
|
5648
5651
|
}),
|
|
5649
5652
|
rs(t, r)
|
|
5650
|
-
]),
|
|
5651
|
-
for (const
|
|
5652
|
-
|
|
5653
|
-
id: `task:${
|
|
5654
|
-
title:
|
|
5655
|
-
url: Mt(
|
|
5653
|
+
]), i = [];
|
|
5654
|
+
for (const a of o.tasks)
|
|
5655
|
+
i.push({
|
|
5656
|
+
id: `task:${a.id}`,
|
|
5657
|
+
title: a.content,
|
|
5658
|
+
url: Mt(a.id)
|
|
5656
5659
|
});
|
|
5657
|
-
for (const
|
|
5658
|
-
|
|
5659
|
-
id: `project:${
|
|
5660
|
-
title:
|
|
5661
|
-
url: Ft(
|
|
5660
|
+
for (const a of n)
|
|
5661
|
+
i.push({
|
|
5662
|
+
id: `project:${a.id}`,
|
|
5663
|
+
title: a.name,
|
|
5664
|
+
url: Ft(a.id)
|
|
5662
5665
|
});
|
|
5663
5666
|
return {
|
|
5664
|
-
textContent: JSON.stringify({ results:
|
|
5665
|
-
structuredContent: { results:
|
|
5667
|
+
textContent: JSON.stringify({ results: i }),
|
|
5668
|
+
structuredContent: { results: i, totalCount: i.length }
|
|
5666
5669
|
};
|
|
5667
5670
|
}
|
|
5668
|
-
},
|
|
5671
|
+
}, Ja = {
|
|
5669
5672
|
ids: s.array(s.string().min(1)).min(1).describe("The IDs of the tasks to uncomplete.")
|
|
5670
|
-
},
|
|
5673
|
+
}, Xa = {
|
|
5671
5674
|
uncompleted: s.array(s.string()).describe("The IDs of successfully uncompleted tasks."),
|
|
5672
5675
|
failures: s.array(ee).describe("Failed task uncompletion with error details."),
|
|
5673
5676
|
totalRequested: s.number().describe("The total number of tasks requested to uncomplete."),
|
|
5674
5677
|
successCount: s.number().describe("The number of successfully uncompleted tasks."),
|
|
5675
5678
|
failureCount: s.number().describe("The number of failed task uncompletions.")
|
|
5676
|
-
},
|
|
5679
|
+
}, Za = {
|
|
5677
5680
|
name: g.UNCOMPLETE_TASKS,
|
|
5678
5681
|
description: "Uncomplete (reopen) one or more completed tasks by their IDs.",
|
|
5679
|
-
parameters:
|
|
5680
|
-
outputSchema:
|
|
5682
|
+
parameters: Ja,
|
|
5683
|
+
outputSchema: Xa,
|
|
5681
5684
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
5682
5685
|
async execute(e, t) {
|
|
5683
5686
|
const r = [], o = [];
|
|
5684
|
-
for (const
|
|
5687
|
+
for (const i of e.ids)
|
|
5685
5688
|
try {
|
|
5686
|
-
await t.reopenTask(
|
|
5687
|
-
} catch (
|
|
5688
|
-
const c =
|
|
5689
|
+
await t.reopenTask(i), r.push(i);
|
|
5690
|
+
} catch (a) {
|
|
5691
|
+
const c = a instanceof Error ? a.message : "Unknown error";
|
|
5689
5692
|
o.push({
|
|
5690
|
-
item:
|
|
5693
|
+
item: i,
|
|
5691
5694
|
error: c
|
|
5692
5695
|
});
|
|
5693
5696
|
}
|
|
5694
5697
|
return {
|
|
5695
|
-
textContent:
|
|
5698
|
+
textContent: Qa({
|
|
5696
5699
|
uncompleted: r,
|
|
5697
5700
|
failures: o,
|
|
5698
5701
|
args: e
|
|
@@ -5707,7 +5710,7 @@ const Yi = {
|
|
|
5707
5710
|
};
|
|
5708
5711
|
}
|
|
5709
5712
|
};
|
|
5710
|
-
function
|
|
5713
|
+
function Qa({
|
|
5711
5714
|
uncompleted: e,
|
|
5712
5715
|
failures: t,
|
|
5713
5716
|
args: r
|
|
@@ -5740,31 +5743,31 @@ const ec = s.object({
|
|
|
5740
5743
|
outputSchema: sc,
|
|
5741
5744
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5742
5745
|
async execute(e, t) {
|
|
5743
|
-
const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })),
|
|
5746
|
+
const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), i = (await Promise.all(o)).map(ge);
|
|
5744
5747
|
return {
|
|
5745
5748
|
textContent: oc({
|
|
5746
|
-
comments:
|
|
5749
|
+
comments: i
|
|
5747
5750
|
}),
|
|
5748
5751
|
structuredContent: {
|
|
5749
|
-
comments:
|
|
5750
|
-
totalCount:
|
|
5751
|
-
updatedCommentIds:
|
|
5752
|
+
comments: i,
|
|
5753
|
+
totalCount: i.length,
|
|
5754
|
+
updatedCommentIds: i.map((c) => c.id),
|
|
5752
5755
|
appliedOperations: {
|
|
5753
|
-
updateCount:
|
|
5756
|
+
updateCount: i.length
|
|
5754
5757
|
}
|
|
5755
5758
|
}
|
|
5756
5759
|
};
|
|
5757
5760
|
}
|
|
5758
5761
|
};
|
|
5759
5762
|
function oc({ comments: e }) {
|
|
5760
|
-
const t = e.filter((
|
|
5763
|
+
const t = e.filter((i) => i.taskId).length, r = e.filter((i) => i.projectId).length, o = [];
|
|
5761
5764
|
if (t > 0) {
|
|
5762
|
-
const
|
|
5763
|
-
o.push(`${t} task ${
|
|
5765
|
+
const i = t > 1 ? "comments" : "comment";
|
|
5766
|
+
o.push(`${t} task ${i}`);
|
|
5764
5767
|
}
|
|
5765
5768
|
if (r > 0) {
|
|
5766
|
-
const
|
|
5767
|
-
o.push(`${r} project ${
|
|
5769
|
+
const i = r > 1 ? "comments" : "comment";
|
|
5770
|
+
o.push(`${r} project ${i}`);
|
|
5768
5771
|
}
|
|
5769
5772
|
return o.length > 0 ? `Updated ${o.join(" and ")}` : "No comments updated";
|
|
5770
5773
|
}
|
|
@@ -5776,9 +5779,9 @@ const nc = s.object({
|
|
|
5776
5779
|
),
|
|
5777
5780
|
color: le,
|
|
5778
5781
|
isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite.")
|
|
5779
|
-
}),
|
|
5782
|
+
}), ic = {
|
|
5780
5783
|
filters: s.array(nc).min(1).describe("The filters to update.")
|
|
5781
|
-
},
|
|
5784
|
+
}, ac = {
|
|
5782
5785
|
filters: s.array(rt).describe("The updated filters."),
|
|
5783
5786
|
totalCount: s.number().describe("The total number of filters updated."),
|
|
5784
5787
|
updatedFilterIds: s.array(s.string()).describe("The IDs of the updated filters."),
|
|
@@ -5789,25 +5792,25 @@ const nc = s.object({
|
|
|
5789
5792
|
}, cc = {
|
|
5790
5793
|
name: g.UPDATE_FILTERS,
|
|
5791
5794
|
description: "Update one or more existing personal filters with new values.",
|
|
5792
|
-
parameters:
|
|
5793
|
-
outputSchema:
|
|
5795
|
+
parameters: ic,
|
|
5796
|
+
outputSchema: ac,
|
|
5794
5797
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5795
5798
|
async execute(e, t) {
|
|
5796
|
-
const { filters: r } = e, o = [],
|
|
5799
|
+
const { filters: r } = e, o = [], i = r.map((m) => {
|
|
5797
5800
|
const h = lc(m);
|
|
5798
5801
|
return h !== null ? { kind: "skipped", reason: h } : (o.push(m), { kind: "updated", filter: m });
|
|
5799
5802
|
}).filter((m) => m.kind === "skipped").length;
|
|
5800
5803
|
if (o.length === 0)
|
|
5801
5804
|
return {
|
|
5802
|
-
textContent: `Updated 0 filters (${
|
|
5805
|
+
textContent: `Updated 0 filters (${i} skipped - no changes)`,
|
|
5803
5806
|
structuredContent: {
|
|
5804
5807
|
filters: [],
|
|
5805
5808
|
totalCount: 0,
|
|
5806
5809
|
updatedFilterIds: [],
|
|
5807
|
-
appliedOperations: { updateCount: 0, skippedCount:
|
|
5810
|
+
appliedOperations: { updateCount: 0, skippedCount: i }
|
|
5808
5811
|
}
|
|
5809
5812
|
};
|
|
5810
|
-
const
|
|
5813
|
+
const a = o.map((m) => {
|
|
5811
5814
|
const { id: h, color: y, ...f } = m;
|
|
5812
5815
|
return V("filter_update", {
|
|
5813
5816
|
id: h,
|
|
@@ -5815,7 +5818,7 @@ const nc = s.object({
|
|
|
5815
5818
|
...y !== void 0 ? { color: y } : {}
|
|
5816
5819
|
});
|
|
5817
5820
|
});
|
|
5818
|
-
await t.sync({ commands:
|
|
5821
|
+
await t.sync({ commands: a });
|
|
5819
5822
|
const d = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((m) => !m.isDeleted), l = new Set(o.map((m) => m.id)), u = d.filter((m) => l.has(m.id)).map((m) => ({
|
|
5820
5823
|
id: m.id,
|
|
5821
5824
|
name: m.name,
|
|
@@ -5825,14 +5828,14 @@ const nc = s.object({
|
|
|
5825
5828
|
itemOrder: m.itemOrder
|
|
5826
5829
|
}));
|
|
5827
5830
|
return {
|
|
5828
|
-
textContent: dc({ filters: u, skippedCount:
|
|
5831
|
+
textContent: dc({ filters: u, skippedCount: i }),
|
|
5829
5832
|
structuredContent: {
|
|
5830
5833
|
filters: u,
|
|
5831
5834
|
totalCount: u.length,
|
|
5832
5835
|
updatedFilterIds: u.map((m) => m.id),
|
|
5833
5836
|
appliedOperations: {
|
|
5834
5837
|
updateCount: u.length,
|
|
5835
|
-
skippedCount:
|
|
5838
|
+
skippedCount: i
|
|
5836
5839
|
}
|
|
5837
5840
|
}
|
|
5838
5841
|
};
|
|
@@ -5845,7 +5848,7 @@ function dc({
|
|
|
5845
5848
|
const r = e.length;
|
|
5846
5849
|
let o = `Updated ${r} filter${r === 1 ? "" : "s"}`;
|
|
5847
5850
|
if (t > 0 && (o += ` (${t} skipped - no changes)`), r > 0) {
|
|
5848
|
-
const n = e.map((
|
|
5851
|
+
const n = e.map((i) => `• ${i.name} (id=${i.id})`).join(`
|
|
5849
5852
|
`);
|
|
5850
5853
|
o += `:
|
|
5851
5854
|
${n}`;
|
|
@@ -5907,9 +5910,9 @@ const uc = s.object({
|
|
|
5907
5910
|
newName: u.newName
|
|
5908
5911
|
}) ? { kind: "renamed", name: u.name, newName: u.newName } : { kind: "skipped", reason: "not-found" };
|
|
5909
5912
|
})
|
|
5910
|
-
), n = o.filter((u) => u.kind === "updated").map((u) => pe.parse(u.label)),
|
|
5913
|
+
), n = o.filter((u) => u.kind === "updated").map((u) => pe.parse(u.label)), i = o.filter(
|
|
5911
5914
|
(u) => u.kind === "renamed"
|
|
5912
|
-
).map(({ name: u, newName: p }) => ({ name: u, newName: p })),
|
|
5915
|
+
).map(({ name: u, newName: p }) => ({ name: u, newName: p })), a = o.filter((u) => u.kind === "skipped").length, c = o.filter(
|
|
5913
5916
|
(u) => u.kind === "skipped" && u.reason === "no-fields"
|
|
5914
5917
|
).length, d = o.filter(
|
|
5915
5918
|
(u) => u.kind === "skipped" && u.reason === "not-found"
|
|
@@ -5917,18 +5920,18 @@ const uc = s.object({
|
|
|
5917
5920
|
return {
|
|
5918
5921
|
textContent: yc({
|
|
5919
5922
|
updatedLabels: n,
|
|
5920
|
-
renamedSharedLabels:
|
|
5923
|
+
renamedSharedLabels: i,
|
|
5921
5924
|
skippedNoFields: c,
|
|
5922
5925
|
skippedNotFound: d
|
|
5923
5926
|
}),
|
|
5924
5927
|
structuredContent: {
|
|
5925
5928
|
updatedLabels: n,
|
|
5926
|
-
renamedSharedLabels:
|
|
5927
|
-
totalCount: n.length +
|
|
5929
|
+
renamedSharedLabels: i,
|
|
5930
|
+
totalCount: n.length + i.length,
|
|
5928
5931
|
appliedOperations: {
|
|
5929
5932
|
updateCount: n.length,
|
|
5930
|
-
renameCount:
|
|
5931
|
-
skippedCount:
|
|
5933
|
+
renameCount: i.length,
|
|
5934
|
+
skippedCount: a
|
|
5932
5935
|
}
|
|
5933
5936
|
}
|
|
5934
5937
|
};
|
|
@@ -5940,16 +5943,16 @@ function yc({
|
|
|
5940
5943
|
skippedNoFields: r,
|
|
5941
5944
|
skippedNotFound: o
|
|
5942
5945
|
}) {
|
|
5943
|
-
const n = e.length,
|
|
5946
|
+
const n = e.length, i = t.length, a = n + i, c = [];
|
|
5944
5947
|
c.push(
|
|
5945
|
-
`Updated ${
|
|
5948
|
+
`Updated ${a} label${a === 1 ? "" : "s"} (${n} personal, ${i} shared)`
|
|
5946
5949
|
);
|
|
5947
5950
|
const d = [];
|
|
5948
5951
|
if (r > 0 && d.push(`${r} skipped - no changes`), o > 0 && d.push(`${o} skipped - shared label not found`), d.length > 0 && (c[0] += ` (${d.join(", ")})`), n > 0) {
|
|
5949
5952
|
c.push("Personal:");
|
|
5950
5953
|
for (const l of e) c.push(`• ${l.name} (id=${l.id})`);
|
|
5951
5954
|
}
|
|
5952
|
-
if (
|
|
5955
|
+
if (i > 0) {
|
|
5953
5956
|
c.push("Shared:");
|
|
5954
5957
|
for (const l of t) c.push(`• ${l.name} → ${l.newName}`);
|
|
5955
5958
|
}
|
|
@@ -6006,34 +6009,34 @@ const kc = s.object({
|
|
|
6006
6009
|
const { id: p, ...m } = l;
|
|
6007
6010
|
return { kind: "updated", project: await O(() => t.updateProject(p, m)) };
|
|
6008
6011
|
})
|
|
6009
|
-
), n = [],
|
|
6010
|
-
let
|
|
6012
|
+
), n = [], i = [];
|
|
6013
|
+
let a = 0, c = 0;
|
|
6011
6014
|
for (const [l, u] of o.entries()) {
|
|
6012
6015
|
if (u.status === "rejected") {
|
|
6013
|
-
|
|
6016
|
+
i.push({
|
|
6014
6017
|
item: r[l]?.id ?? `Project ${l + 1}`,
|
|
6015
6018
|
error: z(u.reason)
|
|
6016
6019
|
});
|
|
6017
6020
|
continue;
|
|
6018
6021
|
}
|
|
6019
|
-
u.value.kind === "updated" ? n.push(Z(u.value.project)) : u.value.reason === "no-fields" ?
|
|
6022
|
+
u.value.kind === "updated" ? n.push(Z(u.value.project)) : u.value.reason === "no-fields" ? a++ : c++;
|
|
6020
6023
|
}
|
|
6021
6024
|
return {
|
|
6022
6025
|
textContent: Sc({
|
|
6023
6026
|
projects: n,
|
|
6024
|
-
skippedNoFields:
|
|
6027
|
+
skippedNoFields: a,
|
|
6025
6028
|
skippedNoValidValues: c,
|
|
6026
|
-
failures:
|
|
6029
|
+
failures: i
|
|
6027
6030
|
}),
|
|
6028
6031
|
structuredContent: {
|
|
6029
6032
|
projects: n,
|
|
6030
6033
|
totalCount: n.length,
|
|
6031
6034
|
updatedProjectIds: n.map((l) => l.id),
|
|
6032
|
-
failures:
|
|
6035
|
+
failures: i,
|
|
6033
6036
|
appliedOperations: {
|
|
6034
6037
|
updateCount: n.length,
|
|
6035
|
-
skippedCount:
|
|
6036
|
-
failureCount:
|
|
6038
|
+
skippedCount: a + c,
|
|
6039
|
+
failureCount: i.length
|
|
6037
6040
|
}
|
|
6038
6041
|
}
|
|
6039
6042
|
};
|
|
@@ -6045,12 +6048,12 @@ function Sc({
|
|
|
6045
6048
|
skippedNoValidValues: r,
|
|
6046
6049
|
failures: o
|
|
6047
6050
|
}) {
|
|
6048
|
-
const n = e.length,
|
|
6051
|
+
const n = e.length, i = e.map((d) => `• ${d.name} (id=${d.id})`).join(`
|
|
6049
6052
|
`);
|
|
6050
|
-
let
|
|
6053
|
+
let a = `Updated ${n} project${n === 1 ? "" : "s"}`;
|
|
6051
6054
|
const c = [];
|
|
6052
|
-
return t > 0 && c.push(`${t} skipped - no changes`), r > 0 && c.push(`${r} skipped - no valid field values`), c.length > 0 && (
|
|
6053
|
-
${
|
|
6055
|
+
return t > 0 && c.push(`${t} skipped - no changes`), r > 0 && c.push(`${r} skipped - no valid field values`), c.length > 0 && (a += ` (${c.join(", ")})`), n > 0 && (a += `:
|
|
6056
|
+
${i}`), it(a, o);
|
|
6054
6057
|
}
|
|
6055
6058
|
function jc({ id: e, ...t }) {
|
|
6056
6059
|
const r = Object.values(t);
|
|
@@ -6118,13 +6121,13 @@ const Cc = s.object({
|
|
|
6118
6121
|
return await t.updateLocationReminder(l, p);
|
|
6119
6122
|
}
|
|
6120
6123
|
}
|
|
6121
|
-
}),
|
|
6124
|
+
}), i = (await Promise.all(o)).map(be), a = i.length === 1 ? "reminder" : "reminders";
|
|
6122
6125
|
return {
|
|
6123
|
-
textContent: `Updated ${
|
|
6126
|
+
textContent: `Updated ${i.length} ${a}`,
|
|
6124
6127
|
structuredContent: {
|
|
6125
|
-
reminders:
|
|
6126
|
-
totalCount:
|
|
6127
|
-
updatedReminderIds:
|
|
6128
|
+
reminders: i,
|
|
6129
|
+
totalCount: i.length,
|
|
6130
|
+
updatedReminderIds: i.map((d) => d.id)
|
|
6128
6131
|
}
|
|
6129
6132
|
};
|
|
6130
6133
|
}
|
|
@@ -6157,10 +6160,10 @@ const Cc = s.object({
|
|
|
6157
6160
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
6158
6161
|
async execute({ sections: e }, t) {
|
|
6159
6162
|
const r = await Promise.all(
|
|
6160
|
-
e.map(({ id: n, name:
|
|
6163
|
+
e.map(({ id: n, name: i, description: a }) => {
|
|
6161
6164
|
const c = {
|
|
6162
|
-
...
|
|
6163
|
-
...
|
|
6165
|
+
...i !== void 0 ? { name: i } : {},
|
|
6166
|
+
...a !== void 0 ? { description: a === "" ? null : a } : {}
|
|
6164
6167
|
};
|
|
6165
6168
|
return t.updateSection(n, c);
|
|
6166
6169
|
})
|
|
@@ -6170,7 +6173,7 @@ const Cc = s.object({
|
|
|
6170
6173
|
sections: r
|
|
6171
6174
|
}),
|
|
6172
6175
|
structuredContent: {
|
|
6173
|
-
sections: r.map(
|
|
6176
|
+
sections: r.map(q),
|
|
6174
6177
|
totalCount: r.length,
|
|
6175
6178
|
updatedSectionIds: r.map((n) => n.id)
|
|
6176
6179
|
}
|
|
@@ -6204,18 +6207,18 @@ function Hc({
|
|
|
6204
6207
|
const o = Fc(t);
|
|
6205
6208
|
if (o.length === 0)
|
|
6206
6209
|
return { redundantMoveSkipped: !1 };
|
|
6207
|
-
let n = o,
|
|
6210
|
+
let n = o, i = !1;
|
|
6208
6211
|
if (r) {
|
|
6209
|
-
const
|
|
6210
|
-
n = o.filter((c) => !
|
|
6212
|
+
const a = o.length === 1 ? (c) => Ss(r, c) : (c) => Nc(r, c);
|
|
6213
|
+
n = o.filter((c) => !a(c)), i = n.length < o.length;
|
|
6211
6214
|
}
|
|
6212
6215
|
if (n.length === 0)
|
|
6213
|
-
return { redundantMoveSkipped:
|
|
6216
|
+
return { redundantMoveSkipped: i };
|
|
6214
6217
|
if (n.length > 1)
|
|
6215
6218
|
throw new Error(
|
|
6216
6219
|
`Task ${e}: Only one of projectId, sectionId, or parentId can be specified at a time. The Todoist API requires exactly one destination for move operations.`
|
|
6217
6220
|
);
|
|
6218
|
-
return { move: n[0], redundantMoveSkipped:
|
|
6221
|
+
return { move: n[0], redundantMoveSkipped: i };
|
|
6219
6222
|
}
|
|
6220
6223
|
const Wc = s.object({
|
|
6221
6224
|
id: s.string().min(1).describe("The ID of the task to update."),
|
|
@@ -6262,7 +6265,7 @@ const Wc = s.object({
|
|
|
6262
6265
|
isUncompletable: s.boolean().optional().describe(
|
|
6263
6266
|
"Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed."
|
|
6264
6267
|
)
|
|
6265
|
-
}), Bc = (e) => !!(e.projectId || e.sectionId || e.parentId), js = (e) => Object.keys(e).length > 0, zc = ["remove", "no date"],
|
|
6268
|
+
}), Bc = (e) => !!(e.projectId || e.sectionId || e.parentId), js = (e) => Object.keys(e).length > 0, zc = ["remove", "no date"], qc = ["remove", "no date", "no deadline"], Kc = "no date", Ye = qt.TASKS_PER_OPERATION, Ot = {
|
|
6266
6269
|
tasks: s.array(Wc).min(1).max(Ye).describe(`The tasks to update (max ${Ye}).`)
|
|
6267
6270
|
}, Yc = {
|
|
6268
6271
|
tasks: s.array(F).describe("The updated tasks."),
|
|
@@ -6288,17 +6291,17 @@ const Wc = s.object({
|
|
|
6288
6291
|
async execute(e, t) {
|
|
6289
6292
|
const { tasks: r } = s.object(Ot).parse(e), o = r.map(() => ({ kind: "skipped" })), n = (T, b) => {
|
|
6290
6293
|
o[T] = { kind: "failed", error: b };
|
|
6291
|
-
},
|
|
6294
|
+
}, i = (T, b) => {
|
|
6292
6295
|
n(T, z(b));
|
|
6293
|
-
},
|
|
6294
|
-
|
|
6296
|
+
}, a = r.map((T, b) => ({ task: T, index: b })).filter(({ task: T }) => rd(T)), c = await Jc(
|
|
6297
|
+
a.map(({ task: T }) => T),
|
|
6295
6298
|
t
|
|
6296
6299
|
), d = await Promise.allSettled(
|
|
6297
|
-
|
|
6300
|
+
a.map(({ task: T, index: b }) => ed({ task: T, index: b, client: t, inbox: c }))
|
|
6298
6301
|
), l = [];
|
|
6299
6302
|
for (const [T, b] of d.entries()) {
|
|
6300
|
-
const S =
|
|
6301
|
-
b.status === "fulfilled" ? l.push(b.value) :
|
|
6303
|
+
const S = a[T]?.index ?? T;
|
|
6304
|
+
b.status === "fulfilled" ? l.push(b.value) : i(S, b.reason);
|
|
6302
6305
|
}
|
|
6303
6306
|
const u = await Cs({
|
|
6304
6307
|
client: t,
|
|
@@ -6317,7 +6320,7 @@ const Wc = s.object({
|
|
|
6317
6320
|
});
|
|
6318
6321
|
T.redundantMoveSkipped = b.redundantMoveSkipped, b.move && p.push({ item: T, move: b.move });
|
|
6319
6322
|
} catch (b) {
|
|
6320
|
-
|
|
6323
|
+
i(T.index, b), T.failed = !0;
|
|
6321
6324
|
}
|
|
6322
6325
|
const m = /* @__PURE__ */ new Map(), h = [], y = (T) => {
|
|
6323
6326
|
const b = T.filter((S) => !S.failed);
|
|
@@ -6338,7 +6341,7 @@ const Wc = s.object({
|
|
|
6338
6341
|
};
|
|
6339
6342
|
return;
|
|
6340
6343
|
}
|
|
6341
|
-
|
|
6344
|
+
i(S.index, $);
|
|
6342
6345
|
}
|
|
6343
6346
|
})
|
|
6344
6347
|
);
|
|
@@ -6392,17 +6395,17 @@ const Wc = s.object({
|
|
|
6392
6395
|
function Vc({ tasks: e, outcomes: t }) {
|
|
6393
6396
|
const r = [], o = [];
|
|
6394
6397
|
let n = 0;
|
|
6395
|
-
for (const [
|
|
6396
|
-
const c = e[
|
|
6397
|
-
if (
|
|
6398
|
+
for (const [i, a] of t.entries()) {
|
|
6399
|
+
const c = e[i]?.id ?? `Task ${i + 1}`;
|
|
6400
|
+
if (a.kind === "skipped") {
|
|
6398
6401
|
n++;
|
|
6399
6402
|
continue;
|
|
6400
6403
|
}
|
|
6401
|
-
if (
|
|
6402
|
-
o.push({ item: c, error:
|
|
6404
|
+
if (a.kind === "failed") {
|
|
6405
|
+
o.push({ item: c, error: a.error });
|
|
6403
6406
|
continue;
|
|
6404
6407
|
}
|
|
6405
|
-
r.push(
|
|
6408
|
+
r.push(a.task), a.kind === "partial" && o.push({ item: c, error: a.error, code: "PARTIAL_MOVE_APPLIED" });
|
|
6406
6409
|
}
|
|
6407
6410
|
return { updatedTasks: r, failures: o, skippedCount: n };
|
|
6408
6411
|
}
|
|
@@ -6426,9 +6429,9 @@ async function Cs({
|
|
|
6426
6429
|
const o = new Set(t), n = {
|
|
6427
6430
|
ids: t.join(","),
|
|
6428
6431
|
limit: Ye
|
|
6429
|
-
}, { results:
|
|
6430
|
-
for (const
|
|
6431
|
-
o.has(
|
|
6432
|
+
}, { results: i } = await O(() => e.getTasks(n));
|
|
6433
|
+
for (const a of i)
|
|
6434
|
+
o.has(a.id) && r.set(a.id, a);
|
|
6432
6435
|
} catch {
|
|
6433
6436
|
}
|
|
6434
6437
|
return r;
|
|
@@ -6446,36 +6449,36 @@ async function Xc({
|
|
|
6446
6449
|
const d = Mc(c.move), l = n.get(d);
|
|
6447
6450
|
l ? l.push(c) : n.set(d, [c]);
|
|
6448
6451
|
}
|
|
6449
|
-
const
|
|
6452
|
+
const i = lr(e), a = [];
|
|
6450
6453
|
for (const c of n.values()) {
|
|
6451
6454
|
const d = [...new Set(c.map(({ item: p }) => p.id))], l = c[0]?.move, u = c.length === 1 ? c[0] : void 0;
|
|
6452
6455
|
try {
|
|
6453
6456
|
if (u) {
|
|
6454
|
-
const f = await
|
|
6457
|
+
const f = await i(
|
|
6455
6458
|
() => O(() => e.moveTask(u.item.id, l))
|
|
6456
6459
|
);
|
|
6457
6460
|
r.set(u.item.index, { task: f }), o(c);
|
|
6458
6461
|
continue;
|
|
6459
6462
|
}
|
|
6460
|
-
const p = await
|
|
6463
|
+
const p = await i(
|
|
6461
6464
|
() => O(() => e.moveTasks(d, l))
|
|
6462
6465
|
), m = new Map(p.map((f) => [f.id, f])), h = [], y = [];
|
|
6463
6466
|
for (const f of c) {
|
|
6464
6467
|
const v = m.get(f.item.id);
|
|
6465
6468
|
v ? (r.set(f.item.index, { task: v }), y.push(f)) : h.push(f);
|
|
6466
6469
|
}
|
|
6467
|
-
o(y), h.length > 0 &&
|
|
6470
|
+
o(y), h.length > 0 && a.push({ group: h, destination: l });
|
|
6468
6471
|
} catch (p) {
|
|
6469
6472
|
if (u) {
|
|
6470
6473
|
r.set(u.item.index, { error: z(p) }), o(c);
|
|
6471
6474
|
continue;
|
|
6472
6475
|
}
|
|
6473
|
-
|
|
6476
|
+
a.push({ group: c, destination: l, error: p });
|
|
6474
6477
|
}
|
|
6475
6478
|
}
|
|
6476
|
-
if (
|
|
6477
|
-
await Zc({ client: e, unresolved:
|
|
6478
|
-
for (const { group: c } of
|
|
6479
|
+
if (a.length > 0) {
|
|
6480
|
+
await Zc({ client: e, unresolved: a, results: r });
|
|
6481
|
+
for (const { group: c } of a)
|
|
6479
6482
|
o(c);
|
|
6480
6483
|
}
|
|
6481
6484
|
}
|
|
@@ -6484,12 +6487,12 @@ async function Zc({
|
|
|
6484
6487
|
unresolved: t,
|
|
6485
6488
|
results: r
|
|
6486
6489
|
}) {
|
|
6487
|
-
const o = [...new Set(t.flatMap(({ group:
|
|
6488
|
-
for (const { group:
|
|
6490
|
+
const o = [...new Set(t.flatMap(({ group: i }) => i.map(({ item: a }) => a.id)))], n = await Cs({ client: e, ids: o });
|
|
6491
|
+
for (const { group: i, destination: a, error: c } of t) {
|
|
6489
6492
|
const d = c === void 0 ? "Task not returned by the move" : z(c);
|
|
6490
|
-
for (const { item: l } of
|
|
6493
|
+
for (const { item: l } of i) {
|
|
6491
6494
|
const u = n.get(l.id);
|
|
6492
|
-
if (u && Ss(u,
|
|
6495
|
+
if (u && Ss(u, a)) {
|
|
6493
6496
|
r.set(l.index, { task: u });
|
|
6494
6497
|
continue;
|
|
6495
6498
|
}
|
|
@@ -6505,14 +6508,14 @@ async function Qc({
|
|
|
6505
6508
|
}) {
|
|
6506
6509
|
const n = ur(e);
|
|
6507
6510
|
await Promise.all(
|
|
6508
|
-
t.filter((
|
|
6511
|
+
t.filter((i) => js(i.updateArgs)).map(async (i) => {
|
|
6509
6512
|
try {
|
|
6510
|
-
const
|
|
6511
|
-
() => O(() => e.updateTask(
|
|
6513
|
+
const a = await n(
|
|
6514
|
+
() => O(() => e.updateTask(i.id, i.updateArgs))
|
|
6512
6515
|
);
|
|
6513
|
-
r(
|
|
6514
|
-
} catch (
|
|
6515
|
-
o(
|
|
6516
|
+
r(i, a);
|
|
6517
|
+
} catch (a) {
|
|
6518
|
+
o(i, a);
|
|
6516
6519
|
}
|
|
6517
6520
|
})
|
|
6518
6521
|
);
|
|
@@ -6525,8 +6528,8 @@ async function ed({
|
|
|
6525
6528
|
}) {
|
|
6526
6529
|
const {
|
|
6527
6530
|
id: n,
|
|
6528
|
-
projectId:
|
|
6529
|
-
sectionId:
|
|
6531
|
+
projectId: i,
|
|
6532
|
+
sectionId: a,
|
|
6530
6533
|
parentId: c,
|
|
6531
6534
|
dueString: d,
|
|
6532
6535
|
duration: l,
|
|
@@ -6536,9 +6539,9 @@ async function ed({
|
|
|
6536
6539
|
deadlineDate: h,
|
|
6537
6540
|
...y
|
|
6538
6541
|
} = e;
|
|
6539
|
-
if (N(
|
|
6542
|
+
if (N(i) && o.error !== void 0)
|
|
6540
6543
|
throw o.error;
|
|
6541
|
-
const f = N(
|
|
6544
|
+
const f = N(i) ? o.projectId : i;
|
|
6542
6545
|
let v = {
|
|
6543
6546
|
...y,
|
|
6544
6547
|
...m !== void 0 && { labels: m }
|
|
@@ -6547,10 +6550,10 @@ async function ed({
|
|
|
6547
6550
|
const j = Pt(
|
|
6548
6551
|
d,
|
|
6549
6552
|
zc,
|
|
6550
|
-
|
|
6553
|
+
Kc
|
|
6551
6554
|
);
|
|
6552
6555
|
j !== void 0 && (v = { ...v, dueString: j });
|
|
6553
|
-
const A = Pt(h,
|
|
6556
|
+
const A = Pt(h, qc, null);
|
|
6554
6557
|
if (A !== void 0 && (v = { ...v, deadlineDate: A }), l)
|
|
6555
6558
|
try {
|
|
6556
6559
|
const { minutes: k } = Xt(l);
|
|
@@ -6571,7 +6574,7 @@ async function ed({
|
|
|
6571
6574
|
updateArgs: v,
|
|
6572
6575
|
moveRequest: {
|
|
6573
6576
|
projectId: f,
|
|
6574
|
-
sectionId:
|
|
6577
|
+
sectionId: a,
|
|
6575
6578
|
parentId: c
|
|
6576
6579
|
},
|
|
6577
6580
|
redundantMoveSkipped: !1,
|
|
@@ -6581,14 +6584,14 @@ async function ed({
|
|
|
6581
6584
|
async function td(e, t, r) {
|
|
6582
6585
|
if (r === null || r === "unassign")
|
|
6583
6586
|
return null;
|
|
6584
|
-
const o = await
|
|
6587
|
+
const o = await at.validateTaskUpdateAssignment(
|
|
6585
6588
|
e,
|
|
6586
6589
|
t,
|
|
6587
6590
|
r
|
|
6588
6591
|
);
|
|
6589
6592
|
if (!o.isValid) {
|
|
6590
|
-
const n = o.error?.message || "Assignment validation failed",
|
|
6591
|
-
throw new Error(`Task ${t}: ${n}${
|
|
6593
|
+
const n = o.error?.message || "Assignment validation failed", i = o.error?.suggestions?.join(". ") || "";
|
|
6594
|
+
throw new Error(`Task ${t}: ${n}${i ? `. ${i}` : ""}`);
|
|
6592
6595
|
}
|
|
6593
6596
|
return o.resolvedUser?.userId;
|
|
6594
6597
|
}
|
|
@@ -6600,16 +6603,16 @@ function sd({
|
|
|
6600
6603
|
}) {
|
|
6601
6604
|
const n = [];
|
|
6602
6605
|
r > 0 && n.push(`${r} skipped - no changes`), o > 0 && n.push(`${o} already in requested destination`), t.length > 0 && n.push(`${t.length} failed`);
|
|
6603
|
-
const
|
|
6604
|
-
context:
|
|
6606
|
+
const i = n.length > 0 ? ` (${n.join(", ")})` : "", a = ot("Updated", e, {
|
|
6607
|
+
context: i,
|
|
6605
6608
|
showDetails: e.length <= 5
|
|
6606
6609
|
});
|
|
6607
6610
|
if (t.length === 0)
|
|
6608
|
-
return
|
|
6611
|
+
return a;
|
|
6609
6612
|
const c = t.slice(0, fe.MAX_FAILURES_SHOWN), d = t.length - c.length, l = c.map((p) => ` ${p.item}: ${p.error}`).join(`
|
|
6610
6613
|
`), u = d > 0 ? `
|
|
6611
6614
|
+${d} more` : "";
|
|
6612
|
-
return `${
|
|
6615
|
+
return `${a}
|
|
6613
6616
|
Failed (${t.length}) - address or drop these items:
|
|
6614
6617
|
${l}${u}`;
|
|
6615
6618
|
}
|
|
@@ -6641,10 +6644,10 @@ const od = {}, nd = {
|
|
|
6641
6644
|
email: s.string().describe("The email address of the user."),
|
|
6642
6645
|
plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
|
|
6643
6646
|
};
|
|
6644
|
-
function
|
|
6647
|
+
function id(e) {
|
|
6645
6648
|
return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
|
|
6646
6649
|
}
|
|
6647
|
-
function
|
|
6650
|
+
function ad(e, t) {
|
|
6648
6651
|
const o = ((e.getDay() || 7) - t + 7) % 7, n = new Date(e);
|
|
6649
6652
|
return n.setDate(e.getDate() - o), n;
|
|
6650
6653
|
}
|
|
@@ -6683,20 +6686,20 @@ function pd(e, t) {
|
|
|
6683
6686
|
});
|
|
6684
6687
|
}
|
|
6685
6688
|
async function md(e) {
|
|
6686
|
-
const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = $s(r), n = /* @__PURE__ */ new Date(),
|
|
6689
|
+
const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = $s(r), n = /* @__PURE__ */ new Date(), i = pd(n, o), a = t.startDay ?? 1, c = ld(a), d = id(t), l = new Date(n.toLocaleString("en-US", { timeZone: o })), u = ad(l, a), p = cd(u), m = dd(l), y = [
|
|
6687
6690
|
"# User Information",
|
|
6688
6691
|
"",
|
|
6689
6692
|
`**User ID:** ${t.id}`,
|
|
6690
6693
|
`**Full Name:** ${t.fullName}`,
|
|
6691
6694
|
`**Email:** ${t.email}`,
|
|
6692
6695
|
`**Timezone:** ${o}`,
|
|
6693
|
-
`**Current Local Time:** ${
|
|
6696
|
+
`**Current Local Time:** ${i}`,
|
|
6694
6697
|
"",
|
|
6695
6698
|
"## Week Settings",
|
|
6696
|
-
`**Week Start Day:** ${c} (${
|
|
6699
|
+
`**Week Start Day:** ${c} (${a})`,
|
|
6697
6700
|
`**Current Week:** Week ${m}`,
|
|
6698
|
-
`**Week Start Date:** ${
|
|
6699
|
-
`**Week End Date:** ${
|
|
6701
|
+
`**Week Start Date:** ${ae(u)}`,
|
|
6702
|
+
`**Week End Date:** ${ae(p)}`,
|
|
6700
6703
|
"",
|
|
6701
6704
|
"## Daily Progress",
|
|
6702
6705
|
`**Completed Today:** ${t.completedToday}`,
|
|
@@ -6711,11 +6714,11 @@ async function md(e) {
|
|
|
6711
6714
|
userId: t.id,
|
|
6712
6715
|
fullName: t.fullName,
|
|
6713
6716
|
timezone: o,
|
|
6714
|
-
currentLocalTime:
|
|
6715
|
-
startDay:
|
|
6717
|
+
currentLocalTime: i,
|
|
6718
|
+
startDay: a,
|
|
6716
6719
|
startDayName: c,
|
|
6717
|
-
weekStartDate:
|
|
6718
|
-
weekEndDate:
|
|
6720
|
+
weekStartDate: ae(u),
|
|
6721
|
+
weekEndDate: ae(p),
|
|
6719
6722
|
currentWeekNumber: m,
|
|
6720
6723
|
completedToday: t.completedToday,
|
|
6721
6724
|
dailyGoal: t.dailyGoal,
|
|
@@ -6805,15 +6808,15 @@ const vd = {
|
|
|
6805
6808
|
idempotentHint: !0
|
|
6806
6809
|
},
|
|
6807
6810
|
async execute({ fileUrl: e }, t) {
|
|
6808
|
-
const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0,
|
|
6811
|
+
const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, i = wd(e), a = r.headers["content-type"], c = a ? Td(a) : void 0, d = c && c !== "application/octet-stream" ? c : kd(e) ?? c ?? "application/octet-stream";
|
|
6809
6812
|
if (n && n > _t)
|
|
6810
6813
|
return {
|
|
6811
|
-
textContent: `Attachment "${
|
|
6814
|
+
textContent: `Attachment "${i ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`
|
|
6812
6815
|
};
|
|
6813
6816
|
const l = Buffer.from(await r.arrayBuffer()), u = l.byteLength;
|
|
6814
6817
|
if (u > _t)
|
|
6815
6818
|
return {
|
|
6816
|
-
textContent: `Attachment "${
|
|
6819
|
+
textContent: `Attachment "${i ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`
|
|
6817
6820
|
};
|
|
6818
6821
|
const p = yd(d), m = [];
|
|
6819
6822
|
return p === "image" ? m.push({
|
|
@@ -6831,12 +6834,12 @@ const vd = {
|
|
|
6831
6834
|
blob: l.toString("base64")
|
|
6832
6835
|
}
|
|
6833
6836
|
}), {
|
|
6834
|
-
textContent: `Attachment: ${
|
|
6837
|
+
textContent: `Attachment: ${i ?? "unknown"} (${d}, ${(u / 1024).toFixed(1)}KB)`,
|
|
6835
6838
|
contentItems: m
|
|
6836
6839
|
};
|
|
6837
6840
|
}
|
|
6838
6841
|
}, Sd = {
|
|
6839
|
-
...
|
|
6842
|
+
...Pi,
|
|
6840
6843
|
_meta: {
|
|
6841
6844
|
ui: {
|
|
6842
6845
|
resourceUri: Le
|
|
@@ -6846,64 +6849,64 @@ const vd = {
|
|
|
6846
6849
|
// Task management tools
|
|
6847
6850
|
addTasks: pn,
|
|
6848
6851
|
completeTasks: wn,
|
|
6849
|
-
uncompleteTasks:
|
|
6852
|
+
uncompleteTasks: Za,
|
|
6850
6853
|
updateTasks: Gc,
|
|
6851
|
-
rescheduleTasks:
|
|
6852
|
-
findTasks:
|
|
6854
|
+
rescheduleTasks: qa,
|
|
6855
|
+
findTasks: Fi,
|
|
6853
6856
|
findTasksByDate: Sd,
|
|
6854
|
-
findCompletedTasks:
|
|
6857
|
+
findCompletedTasks: ii,
|
|
6855
6858
|
// Project management tools
|
|
6856
6859
|
addProjects: Yo,
|
|
6857
6860
|
updateProjects: Ic,
|
|
6858
|
-
findProjects:
|
|
6859
|
-
projectManagement:
|
|
6860
|
-
projectMove:
|
|
6861
|
+
findProjects: ki,
|
|
6862
|
+
projectManagement: Ra,
|
|
6863
|
+
projectMove: Na,
|
|
6861
6864
|
// Section management tools
|
|
6862
6865
|
addSections: an,
|
|
6863
6866
|
updateSections: Uc,
|
|
6864
|
-
findSections:
|
|
6867
|
+
findSections: xi,
|
|
6865
6868
|
// Comment management tools
|
|
6866
6869
|
addComments: Io,
|
|
6867
6870
|
findComments: Xn,
|
|
6868
6871
|
updateComments: rc,
|
|
6869
6872
|
// Reminder management tools
|
|
6870
6873
|
addReminders: tn,
|
|
6871
|
-
findReminders:
|
|
6874
|
+
findReminders: Si,
|
|
6872
6875
|
updateReminders: Oc,
|
|
6873
6876
|
// Attachment tools
|
|
6874
6877
|
viewAttachment: Id,
|
|
6875
6878
|
// Label management tools
|
|
6876
6879
|
addLabels: Uo,
|
|
6877
6880
|
updateLabels: gc,
|
|
6878
|
-
findLabels:
|
|
6881
|
+
findLabels: li,
|
|
6879
6882
|
// Filter management tools
|
|
6880
6883
|
findFilters: $o,
|
|
6881
6884
|
addFilters: Oo,
|
|
6882
6885
|
updateFilters: cc,
|
|
6883
6886
|
// Activity and audit tools
|
|
6884
6887
|
findActivity: zn,
|
|
6885
|
-
getProductivityStats:
|
|
6888
|
+
getProductivityStats: Qi,
|
|
6886
6889
|
// Health and insights tools
|
|
6887
|
-
getProjectHealth:
|
|
6888
|
-
getProjectActivityStats:
|
|
6890
|
+
getProjectHealth: ua,
|
|
6891
|
+
getProjectActivityStats: oa,
|
|
6889
6892
|
analyzeProjectHealth: yn,
|
|
6890
|
-
getWorkspaceInsights:
|
|
6893
|
+
getWorkspaceInsights: fa,
|
|
6891
6894
|
// General tools
|
|
6892
|
-
getOverview:
|
|
6895
|
+
getOverview: Ji,
|
|
6893
6896
|
deleteObject: jn,
|
|
6894
6897
|
fetchObject: Ln,
|
|
6895
|
-
reorderObjects:
|
|
6898
|
+
reorderObjects: Ha,
|
|
6896
6899
|
userInfo: hd,
|
|
6897
6900
|
// Assignment and collaboration tools
|
|
6898
|
-
findProjectCollaborators:
|
|
6899
|
-
manageAssignments:
|
|
6901
|
+
findProjectCollaborators: hi,
|
|
6902
|
+
manageAssignments: Oa,
|
|
6900
6903
|
// Template tools
|
|
6901
6904
|
exportProjectTemplate: Dn,
|
|
6902
|
-
importProjectTemplate:
|
|
6905
|
+
importProjectTemplate: ka,
|
|
6903
6906
|
// Workspace tools
|
|
6904
|
-
listWorkspaces:
|
|
6907
|
+
listWorkspaces: Ca,
|
|
6905
6908
|
// OpenAI MCP tools
|
|
6906
|
-
search:
|
|
6909
|
+
search: Va,
|
|
6907
6910
|
fetch: Fn
|
|
6908
6911
|
}, Cd = Object.values(jd), $d = `
|
|
6909
6912
|
## Todoist Task and Project Management Tools
|
|
@@ -6929,7 +6932,7 @@ What each tool does and how to fill its parameters is in the tool's own descript
|
|
|
6929
6932
|
|
|
6930
6933
|
**Finding things**
|
|
6931
6934
|
|
|
6932
|
-
- For "what did I complete?",
|
|
6935
|
+
- For "what did I complete?", call **user-info** for the asker's user ID, then **find-activity** with objectType="task", eventType="completed", initiatorId, and dateFrom/dateTo. Without initiatorId the answer covers every collaborator. find-activity reports completion events, including each occurrence of a recurring task; **find-completed-tasks** lists completed tasks, which is not the same question.
|
|
6933
6936
|
- To resolve a person's name or email to a user ID, or to answer "who is X?", use **find-project-collaborators** with just a searchTerm. It covers every shared project you can access plus yourself, so an empty result means they collaborate on none of them — not that they do not exist.
|
|
6934
6937
|
- Before assigning work to someone, call **find-project-collaborators** again with the target projectId. Resolving an ID only proves they collaborate on *some* project you can see; assignment fails unless they collaborate on that one.
|
|
6935
6938
|
- To find out whether a task hides subtasks, use **fetch-object** with includeChildren rather than a speculative **find-tasks** call.
|
|
@@ -6973,9 +6976,9 @@ function Hd({
|
|
|
6973
6976
|
}
|
|
6974
6977
|
), n = jr(e, { baseUrl: t });
|
|
6975
6978
|
Gs(o);
|
|
6976
|
-
const
|
|
6977
|
-
for (const
|
|
6978
|
-
|
|
6979
|
+
const i = { server: o, client: n, features: r };
|
|
6980
|
+
for (const a of Cd)
|
|
6981
|
+
qr({ tool: a, ...i });
|
|
6979
6982
|
return o.registerPrompt(
|
|
6980
6983
|
he.name,
|
|
6981
6984
|
{
|
|
@@ -6988,22 +6991,22 @@ function Hd({
|
|
|
6988
6991
|
}
|
|
6989
6992
|
export {
|
|
6990
6993
|
Er as $,
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6994
|
+
Ji as A,
|
|
6995
|
+
Qi as B,
|
|
6996
|
+
oa as C,
|
|
6997
|
+
ua as D,
|
|
6998
|
+
fa as E,
|
|
6996
6999
|
Fd as F,
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7000
|
+
ka as G,
|
|
7001
|
+
Ca as H,
|
|
7002
|
+
Oa as I,
|
|
7003
|
+
Ra as J,
|
|
7004
|
+
Na as K,
|
|
7002
7005
|
Cd as L,
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7006
|
+
Ha as M,
|
|
7007
|
+
qa as N,
|
|
7008
|
+
Va as O,
|
|
7009
|
+
Za as P,
|
|
7007
7010
|
rc as Q,
|
|
7008
7011
|
cc as R,
|
|
7009
7012
|
gc as S,
|
|
@@ -7031,14 +7034,14 @@ export {
|
|
|
7031
7034
|
Ln as n,
|
|
7032
7035
|
zn as o,
|
|
7033
7036
|
Xn as p,
|
|
7034
|
-
|
|
7037
|
+
ii as q,
|
|
7035
7038
|
$o as r,
|
|
7036
|
-
|
|
7039
|
+
li as s,
|
|
7037
7040
|
jd as t,
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7041
|
+
hi as u,
|
|
7042
|
+
ki as v,
|
|
7043
|
+
Si as w,
|
|
7044
|
+
xi as x,
|
|
7045
|
+
Fi as y,
|
|
7046
|
+
Pi as z
|
|
7044
7047
|
};
|