@doist/todoist-ai 8.9.2 → 8.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +121 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -45
- package/dist/main-http.js +2 -2
- package/dist/main.js +1 -1
- package/dist/mcp-apps/index.html +1 -1
- package/dist/{mcp-server-BxCkcyeL.js → mcp-server-DcDkgkMt.js} +608 -498
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/{require-valid-todoist-token-BDvWaAk7.js → require-valid-todoist-token-DAY-GxlD.js} +1 -1
- package/dist/tools/update-labels.d.ts +122 -0
- package/dist/tools/update-labels.d.ts.map +1 -0
- package/dist/utils/tool-names.d.ts +1 -0
- package/dist/utils/tool-names.d.ts.map +1 -1
- package/package.json +4 -4
- package/scripts/run-tool.ts +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isWorkspaceProject as
|
|
1
|
+
import { isWorkspaceProject as me, isPersonalProject as ne, colors as xe, LOCATION_TRIGGERS as pt, REMINDER_TYPES as Ht, createCommand as Y, REMINDER_DELIVERY_SERVICES as Wt, HEALTH_STATUSES as Re, getTaskUrl as mt, getProjectUrl as ht, WORKSPACE_ROLES as Bt, WORKSPACE_PLANS as zt, TodoistApi as Yt } from "@doist/todoist-sdk";
|
|
2
2
|
import { McpServer as Gt } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { createHash as qt } from "node:crypto";
|
|
4
4
|
import { readFileSync as Kt } from "node:fs";
|
|
@@ -79,7 +79,7 @@ function E(e) {
|
|
|
79
79
|
if (typeof e == "string" && /^\d+$/.test(e.trim()))
|
|
80
80
|
return Number(e.trim());
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function k(e) {
|
|
83
83
|
if (typeof e == "string") {
|
|
84
84
|
const t = e.trim();
|
|
85
85
|
return t.length > 0 ? t : void 0;
|
|
@@ -89,7 +89,7 @@ function y(e) {
|
|
|
89
89
|
}
|
|
90
90
|
function Q(e) {
|
|
91
91
|
const t = E(e);
|
|
92
|
-
return t !== void 0 ? t :
|
|
92
|
+
return t !== void 0 ? t : k(e);
|
|
93
93
|
}
|
|
94
94
|
function is(e) {
|
|
95
95
|
return e.replace(/\b(Bearer)\s+[A-Za-z0-9._~+/=-]+/gi, "$1 [REDACTED]").replace(
|
|
@@ -97,7 +97,7 @@ function is(e) {
|
|
|
97
97
|
"$1: [REDACTED]"
|
|
98
98
|
).replace(/([?&](?:token|api[_-]?key|authorization)=)[^&\s]+/gi, "$1[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[REDACTED]");
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function U(e, t = 220) {
|
|
101
101
|
const r = is(e).replace(/\s+/g, " ").trim();
|
|
102
102
|
return r.length <= t ? r : `${r.slice(0, t - 3)}...`;
|
|
103
103
|
}
|
|
@@ -113,42 +113,42 @@ function je(e) {
|
|
|
113
113
|
return E(t[1]);
|
|
114
114
|
}
|
|
115
115
|
function z(e) {
|
|
116
|
-
const t =
|
|
116
|
+
const t = k(e);
|
|
117
117
|
if (t)
|
|
118
|
-
return
|
|
118
|
+
return U(t);
|
|
119
119
|
if (Array.isArray(e)) {
|
|
120
|
-
const n = e.map((a) => G(a) ?
|
|
121
|
-
return n.length > 0 ?
|
|
120
|
+
const n = e.map((a) => G(a) ? k(a.message) || k(a.error) : k(a)).filter((a) => !!a);
|
|
121
|
+
return n.length > 0 ? U(n.slice(0, 2).join("; ")) : void 0;
|
|
122
122
|
}
|
|
123
123
|
if (!G(e))
|
|
124
124
|
return;
|
|
125
125
|
const r = R(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
k(e.detail),
|
|
127
|
+
k(e.details),
|
|
128
|
+
k(e.message),
|
|
129
|
+
k(e.error),
|
|
130
|
+
k(e.description)
|
|
131
131
|
);
|
|
132
132
|
if (r)
|
|
133
|
-
return
|
|
133
|
+
return U(r);
|
|
134
134
|
const o = [];
|
|
135
135
|
for (const [n, a] of Object.entries(e)) {
|
|
136
|
-
const i =
|
|
136
|
+
const i = k(a);
|
|
137
137
|
if (i && (o.push(`${n}: ${i}`), o.length >= 2))
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
|
-
return o.length > 0 ?
|
|
140
|
+
return o.length > 0 ? U(o.join("; ")) : void 0;
|
|
141
141
|
}
|
|
142
142
|
function cs(e) {
|
|
143
143
|
if (!e)
|
|
144
144
|
return [];
|
|
145
145
|
const t = /* @__PURE__ */ new Set(), r = (i) => {
|
|
146
|
-
i && t.add(
|
|
146
|
+
i && t.add(U(i, 120));
|
|
147
147
|
}, o = R(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
k(e.field),
|
|
149
|
+
k(e.parameter),
|
|
150
|
+
k(e.param),
|
|
151
|
+
k(e.path)
|
|
152
152
|
);
|
|
153
153
|
r(o);
|
|
154
154
|
const n = Oe(
|
|
@@ -159,11 +159,11 @@ function cs(e) {
|
|
|
159
159
|
);
|
|
160
160
|
if (n) {
|
|
161
161
|
const i = R(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
k(n.field),
|
|
163
|
+
k(n.parameter),
|
|
164
|
+
k(n.param),
|
|
165
|
+
k(n.path),
|
|
166
|
+
k(n.argument)
|
|
167
167
|
);
|
|
168
168
|
r(i);
|
|
169
169
|
}
|
|
@@ -171,32 +171,32 @@ function cs(e) {
|
|
|
171
171
|
if (Array.isArray(a))
|
|
172
172
|
for (const i of a) {
|
|
173
173
|
if (!G(i)) {
|
|
174
|
-
r(
|
|
174
|
+
r(k(i));
|
|
175
175
|
continue;
|
|
176
176
|
}
|
|
177
177
|
const c = R(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
k(i.field),
|
|
179
|
+
k(i.parameter),
|
|
180
|
+
k(i.param),
|
|
181
|
+
k(i.path),
|
|
182
|
+
k(i.name)
|
|
183
183
|
), d = R(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
k(i.message),
|
|
185
|
+
k(i.error),
|
|
186
|
+
k(i.detail),
|
|
187
|
+
k(i.description)
|
|
188
188
|
);
|
|
189
189
|
r(c && d ? `${c}: ${d}` : c || d);
|
|
190
190
|
}
|
|
191
191
|
else if (G(a))
|
|
192
192
|
for (const [i, c] of Object.entries(a)) {
|
|
193
|
-
const d =
|
|
193
|
+
const d = k(c);
|
|
194
194
|
if (d) {
|
|
195
195
|
r(`${i}: ${d}`);
|
|
196
196
|
continue;
|
|
197
197
|
}
|
|
198
198
|
if (Array.isArray(c)) {
|
|
199
|
-
const l = c.map((
|
|
199
|
+
const l = c.map((u) => k(u)).filter((u) => !!u).join(", ");
|
|
200
200
|
r(l ? `${i}: ${l}` : i);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
@@ -236,8 +236,8 @@ function ps(e) {
|
|
|
236
236
|
E(n?.status),
|
|
237
237
|
E(n?.httpCode),
|
|
238
238
|
E(n?.http_code),
|
|
239
|
-
je(
|
|
240
|
-
je(
|
|
239
|
+
je(k(t?.message)),
|
|
240
|
+
je(k(r?.message)),
|
|
241
241
|
je(typeof e == "string" ? e : void 0)
|
|
242
242
|
), i = R(
|
|
243
243
|
Q(n?.errorCode),
|
|
@@ -247,34 +247,34 @@ function ps(e) {
|
|
|
247
247
|
Q(t?.error_code),
|
|
248
248
|
Q(t?.code)
|
|
249
249
|
), c = R(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
250
|
+
k(n?.errorTag),
|
|
251
|
+
k(n?.error_tag),
|
|
252
|
+
k(n?.tag),
|
|
253
|
+
k(t?.errorTag),
|
|
254
|
+
k(t?.error_tag),
|
|
255
|
+
k(t?.tag)
|
|
256
256
|
), d = [
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
k(n?.error),
|
|
258
|
+
k(n?.message),
|
|
259
259
|
z(n?.message),
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
e instanceof Error ? e.message :
|
|
263
|
-
].filter((h) => !!h), l = d.find((h) => !et(h)) || d[0],
|
|
260
|
+
k(t?.message),
|
|
261
|
+
k(r?.message),
|
|
262
|
+
e instanceof Error ? e.message : k(e)
|
|
263
|
+
].filter((h) => !!h), l = d.find((h) => !et(h)) || d[0], u = R(
|
|
264
264
|
z(n?.errorExtra),
|
|
265
265
|
z(n?.error_extra),
|
|
266
266
|
z(n?.details),
|
|
267
267
|
z(n?.errorDetails),
|
|
268
268
|
z(n?.errors),
|
|
269
269
|
z(t?.details)
|
|
270
|
-
),
|
|
270
|
+
), p = cs(n);
|
|
271
271
|
return a !== void 0 || ls(n) || c !== void 0 || i !== void 0 || (l ? et(l) : !1) ? {
|
|
272
272
|
statusCode: a,
|
|
273
273
|
code: i,
|
|
274
|
-
tag: c ?
|
|
275
|
-
message: l ?
|
|
276
|
-
details:
|
|
277
|
-
fieldHints:
|
|
274
|
+
tag: c ? U(c, 80) : void 0,
|
|
275
|
+
message: l ? U(l) : void 0,
|
|
276
|
+
details: u ? U(u) : void 0,
|
|
277
|
+
fieldHints: p
|
|
278
278
|
} : null;
|
|
279
279
|
}
|
|
280
280
|
function ms(e) {
|
|
@@ -287,7 +287,7 @@ function ms(e) {
|
|
|
287
287
|
`);
|
|
288
288
|
}
|
|
289
289
|
function hs(e) {
|
|
290
|
-
return e instanceof Error ?
|
|
290
|
+
return e instanceof Error ? U(e.message) : typeof e == "string" ? U(e) : "An unknown error occurred";
|
|
291
291
|
}
|
|
292
292
|
function fs(e) {
|
|
293
293
|
if (e instanceof es)
|
|
@@ -343,16 +343,16 @@ async function js(e, t = {}) {
|
|
|
343
343
|
}
|
|
344
344
|
throw a;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function Ue(e) {
|
|
347
347
|
if (e == null)
|
|
348
348
|
return e;
|
|
349
349
|
if (Array.isArray(e))
|
|
350
|
-
return e.map((t) =>
|
|
350
|
+
return e.map((t) => Ue(t));
|
|
351
351
|
if (typeof e == "object") {
|
|
352
352
|
const t = {};
|
|
353
353
|
for (const [r, o] of Object.entries(e))
|
|
354
354
|
if (o !== null) {
|
|
355
|
-
const n =
|
|
355
|
+
const n = Ue(o);
|
|
356
356
|
if (n !== null && typeof n == "object" && !Array.isArray(n) && Object.keys(n).length === 0)
|
|
357
357
|
continue;
|
|
358
358
|
t[r] = n;
|
|
@@ -410,6 +410,7 @@ const f = {
|
|
|
410
410
|
USER_INFO: "user-info",
|
|
411
411
|
// Label management tools
|
|
412
412
|
ADD_LABELS: "add-labels",
|
|
413
|
+
UPDATE_LABELS: "update-labels",
|
|
413
414
|
FIND_LABELS: "find-labels",
|
|
414
415
|
// Filter management tools
|
|
415
416
|
FIND_FILTERS: "find-filters",
|
|
@@ -420,7 +421,7 @@ const f = {
|
|
|
420
421
|
// OpenAI MCP tools
|
|
421
422
|
SEARCH: "search",
|
|
422
423
|
FETCH: "fetch"
|
|
423
|
-
},
|
|
424
|
+
}, qi = {
|
|
424
425
|
/**
|
|
425
426
|
* Strips email addresses from tool outputs that expose user data.
|
|
426
427
|
* Affects: find-project-collaborators, find-completed-tasks
|
|
@@ -432,7 +433,7 @@ function Cs({
|
|
|
432
433
|
structuredContent: t,
|
|
433
434
|
contentItems: r
|
|
434
435
|
}) {
|
|
435
|
-
const o =
|
|
436
|
+
const o = Ue(t), n = {}, a = [];
|
|
436
437
|
if (e && a.push({ type: "text", text: e }), r && a.push(...r), a.length > 0 && (n.content = a), t && (n.structuredContent = o), !Ss && t) {
|
|
437
438
|
const i = JSON.stringify(o);
|
|
438
439
|
n.content || (n.content = []), n.content.push({
|
|
@@ -464,15 +465,15 @@ const Es = [
|
|
|
464
465
|
f.FIND_PROJECT_COLLABORATORS,
|
|
465
466
|
f.FIND_COMPLETED_TASKS
|
|
466
467
|
];
|
|
467
|
-
function
|
|
468
|
+
function Pe(e) {
|
|
468
469
|
if (e == null)
|
|
469
470
|
return e;
|
|
470
471
|
if (Array.isArray(e))
|
|
471
|
-
return e.map((t) =>
|
|
472
|
+
return e.map((t) => Pe(t));
|
|
472
473
|
if (typeof e == "object") {
|
|
473
474
|
const t = {};
|
|
474
475
|
for (const [r, o] of Object.entries(e))
|
|
475
|
-
r !== "email" && (t[r] =
|
|
476
|
+
r !== "email" && (t[r] = Pe(o));
|
|
476
477
|
return t;
|
|
477
478
|
}
|
|
478
479
|
return e;
|
|
@@ -481,7 +482,7 @@ function Os(e) {
|
|
|
481
482
|
const t = /\s*\([^)]*@[^)]+\)/g, r = /\S+@\S+\.\S+/g;
|
|
482
483
|
return e.replace(t, "").replace(r, "[email hidden]");
|
|
483
484
|
}
|
|
484
|
-
function
|
|
485
|
+
function y({
|
|
485
486
|
tool: e,
|
|
486
487
|
server: t,
|
|
487
488
|
client: r,
|
|
@@ -489,10 +490,10 @@ function k({
|
|
|
489
490
|
}) {
|
|
490
491
|
const n = o.some((c) => c.name === "strip_emails") && Es.includes(e.name), a = async (c, d) => {
|
|
491
492
|
try {
|
|
492
|
-
let { textContent: l, structuredContent:
|
|
493
|
+
let { textContent: l, structuredContent: u, contentItems: p } = await js(
|
|
493
494
|
() => e.execute(c, r)
|
|
494
495
|
);
|
|
495
|
-
return n && (l && (l = Os(l)),
|
|
496
|
+
return n && (l && (l = Os(l)), u && (u = Pe(u))), Cs({ textContent: l, structuredContent: u, contentItems: p });
|
|
496
497
|
} catch (l) {
|
|
497
498
|
return console.error(`Error executing tool ${e.name}:`, { args: c, error: l }), $s(fs(l));
|
|
498
499
|
}
|
|
@@ -517,7 +518,7 @@ function k({
|
|
|
517
518
|
}
|
|
518
519
|
t.registerTool(e.name, i, a);
|
|
519
520
|
}
|
|
520
|
-
const
|
|
521
|
+
const Us = {
|
|
521
522
|
period: s.enum(["today", "7d", "14d", "30d", "this-week", "this-month"]).default("7d").describe(
|
|
522
523
|
'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.'
|
|
523
524
|
),
|
|
@@ -526,7 +527,7 @@ const Ps = {
|
|
|
526
527
|
),
|
|
527
528
|
projectId: s.string().optional().describe("Optional project ID to scope the analysis to a specific project.")
|
|
528
529
|
};
|
|
529
|
-
function
|
|
530
|
+
function Ps(e, t = /* @__PURE__ */ new Date()) {
|
|
530
531
|
const r = (n) => n.toISOString().slice(0, 10), o = r(t);
|
|
531
532
|
switch (e) {
|
|
532
533
|
case "today":
|
|
@@ -605,7 +606,7 @@ function _s(e) {
|
|
|
605
606
|
`) : t[e] ?? "";
|
|
606
607
|
}
|
|
607
608
|
function Rs(e) {
|
|
608
|
-
const { since: t, until: r, periodDescription: o } =
|
|
609
|
+
const { since: t, until: r, periodDescription: o } = Ps(e.period), n = e.projectId ? `
|
|
609
610
|
Scope this analysis to project ID: ${e.projectId}. Pass this projectId when calling find-completed-tasks and get-overview.` : "";
|
|
610
611
|
return `Analyze my Todoist productivity for ${o} (${t} to ${r}).${n}
|
|
611
612
|
|
|
@@ -649,11 +650,11 @@ function Ns(e) {
|
|
|
649
650
|
]
|
|
650
651
|
};
|
|
651
652
|
}
|
|
652
|
-
const
|
|
653
|
+
const le = {
|
|
653
654
|
name: "productivity-analysis",
|
|
654
655
|
title: "Productivity Analysis",
|
|
655
656
|
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.",
|
|
656
|
-
argsSchema:
|
|
657
|
+
argsSchema: Us,
|
|
657
658
|
callback: Ns
|
|
658
659
|
}, C = {
|
|
659
660
|
/** Default limit for task listings */
|
|
@@ -771,12 +772,12 @@ class Ws {
|
|
|
771
772
|
try {
|
|
772
773
|
const l = await t.getUser();
|
|
773
774
|
if (l) {
|
|
774
|
-
const
|
|
775
|
+
const u = {
|
|
775
776
|
id: l.id,
|
|
776
777
|
name: l.fullName,
|
|
777
778
|
email: l.email
|
|
778
779
|
};
|
|
779
|
-
a.some((
|
|
780
|
+
a.some((p) => p.id === l.id) || (a = [u, ...a]);
|
|
780
781
|
}
|
|
781
782
|
} catch {
|
|
782
783
|
}
|
|
@@ -848,18 +849,18 @@ class Ws {
|
|
|
848
849
|
const a = (await q({
|
|
849
850
|
apiMethod: t.getProjects.bind(t),
|
|
850
851
|
args: {}
|
|
851
|
-
})).filter((
|
|
852
|
+
})).filter((u) => u.isShared);
|
|
852
853
|
if (a.length === 0) {
|
|
853
|
-
const
|
|
854
|
-
return ee.set(r, { result:
|
|
854
|
+
const u = [];
|
|
855
|
+
return ee.set(r, { result: u, timestamp: Date.now() }), u;
|
|
855
856
|
}
|
|
856
857
|
const i = [], c = /* @__PURE__ */ new Set(), d = a.map(
|
|
857
|
-
(
|
|
858
|
+
(u) => this.getProjectCollaborators(t, u.id)
|
|
858
859
|
), l = await Promise.allSettled(d);
|
|
859
|
-
for (const
|
|
860
|
-
if (
|
|
861
|
-
for (const
|
|
862
|
-
|
|
860
|
+
for (const u of l)
|
|
861
|
+
if (u.status === "fulfilled")
|
|
862
|
+
for (const p of u.value)
|
|
863
|
+
p && !c.has(p.id) && (i.push(p), c.add(p.id));
|
|
863
864
|
return ee.set(r, {
|
|
864
865
|
result: i,
|
|
865
866
|
timestamp: Date.now()
|
|
@@ -908,12 +909,12 @@ function zs({
|
|
|
908
909
|
}) {
|
|
909
910
|
return t ? e.filter((n) => n.responsibleUid === t) : o === "unassignedOrMe" ? e.filter((n) => !n.responsibleUid || n.responsibleUid === r) : o === "assigned" ? e.filter((n) => n.responsibleUid && n.responsibleUid !== r) : e;
|
|
910
911
|
}
|
|
911
|
-
function
|
|
912
|
+
function pe(e) {
|
|
912
913
|
return e?.toLowerCase() === "inbox";
|
|
913
914
|
}
|
|
914
915
|
async function K(e) {
|
|
915
916
|
const { projectId: t, user: r, client: o } = e;
|
|
916
|
-
if (!
|
|
917
|
+
if (!pe(t))
|
|
917
918
|
return t;
|
|
918
919
|
const n = r || (o ? await o.getUser() : null);
|
|
919
920
|
if (!n)
|
|
@@ -980,7 +981,7 @@ function Ks(e, t, r, o) {
|
|
|
980
981
|
if (o) return { parentId: o };
|
|
981
982
|
throw new Error("Unexpected error: No valid move parameter found");
|
|
982
983
|
}
|
|
983
|
-
function
|
|
984
|
+
function P(e) {
|
|
984
985
|
return {
|
|
985
986
|
id: e.id,
|
|
986
987
|
content: e.content,
|
|
@@ -1010,12 +1011,12 @@ function V(e) {
|
|
|
1010
1011
|
parentId: ne(e) ? e.parentId ?? void 0 : void 0,
|
|
1011
1012
|
inboxProject: ne(e) ? e.inboxProject ?? !1 : !1,
|
|
1012
1013
|
viewStyle: e.viewStyle,
|
|
1013
|
-
workspaceId:
|
|
1014
|
-
folderId:
|
|
1014
|
+
workspaceId: me(e) ? e.workspaceId : void 0,
|
|
1015
|
+
folderId: me(e) ? e.folderId ?? void 0 : void 0,
|
|
1015
1016
|
childOrder: e.childOrder
|
|
1016
1017
|
};
|
|
1017
1018
|
}
|
|
1018
|
-
function
|
|
1019
|
+
function fe(e) {
|
|
1019
1020
|
return {
|
|
1020
1021
|
id: e.id,
|
|
1021
1022
|
taskId: e.taskId ?? void 0,
|
|
@@ -1068,7 +1069,7 @@ async function He({
|
|
|
1068
1069
|
}) {
|
|
1069
1070
|
try {
|
|
1070
1071
|
const { results: n, nextCursor: a } = await e.getTasksByFilter({ query: t, cursor: o, limit: r });
|
|
1071
|
-
return { tasks: n.map(
|
|
1072
|
+
return { tasks: n.map(P), nextCursor: a };
|
|
1072
1073
|
} catch (n) {
|
|
1073
1074
|
const a = Js.safeParse(n);
|
|
1074
1075
|
if (!a.success)
|
|
@@ -1088,7 +1089,7 @@ function tt(e) {
|
|
|
1088
1089
|
timezone: e.timezone ?? void 0
|
|
1089
1090
|
};
|
|
1090
1091
|
}
|
|
1091
|
-
function
|
|
1092
|
+
function ue(e) {
|
|
1092
1093
|
const t = {
|
|
1093
1094
|
id: e.id,
|
|
1094
1095
|
taskId: e.itemId,
|
|
@@ -1125,15 +1126,15 @@ function It(e) {
|
|
|
1125
1126
|
).length, r = e.filter((o) => o.type === "location").length;
|
|
1126
1127
|
return { timeBasedCount: t, locationCount: r };
|
|
1127
1128
|
}
|
|
1128
|
-
const
|
|
1129
|
+
const be = xe.map((e) => e.key);
|
|
1129
1130
|
function Xs(e) {
|
|
1130
1131
|
if (typeof e != "string") return;
|
|
1131
1132
|
const t = e.toLowerCase();
|
|
1132
1133
|
return (xe.find((o) => o.key === t) ?? xe.find((o) => o.displayName.toLowerCase() === t))?.key;
|
|
1133
1134
|
}
|
|
1134
|
-
const Zs = `Color for the entity. Accepts a color key (e.g. "berry_red") or display name (e.g. "Berry Red"). Valid colors: ${
|
|
1135
|
-
s.enum(
|
|
1136
|
-
const
|
|
1135
|
+
const Zs = `Color for the entity. Accepts a color key (e.g. "berry_red") or display name (e.g. "Berry Red"). Valid colors: ${be.join(", ")}. Unrecognized colors are omitted and charcoal will be used as the default.`, ae = s.preprocess(Xs, s.enum(be).optional()).describe(Zs);
|
|
1136
|
+
s.enum(be).describe("The color key of the entity.");
|
|
1137
|
+
const ie = s.enum(be).optional().catch(void 0).describe("The color key of the entity."), J = s.object({
|
|
1137
1138
|
id: s.string().describe("The unique ID of the task."),
|
|
1138
1139
|
content: s.string().describe("The task title/content."),
|
|
1139
1140
|
description: s.string().describe("The task description."),
|
|
@@ -1153,10 +1154,10 @@ const ae = s.enum(fe).optional().catch(void 0).describe("The color key of the en
|
|
|
1153
1154
|
assignedByUid: s.string().optional().describe("The UID of the user who assigned this task."),
|
|
1154
1155
|
checked: s.boolean().describe("Whether the task is checked/completed."),
|
|
1155
1156
|
completedAt: s.string().optional().describe("When the task was completed (ISO 8601 format).")
|
|
1156
|
-
}),
|
|
1157
|
+
}), ce = s.object({
|
|
1157
1158
|
id: s.string().describe("The unique ID of the project."),
|
|
1158
1159
|
name: s.string().describe("The name of the project."),
|
|
1159
|
-
color:
|
|
1160
|
+
color: ie,
|
|
1160
1161
|
isFavorite: s.boolean().describe("Whether the project is marked as favorite."),
|
|
1161
1162
|
isShared: s.boolean().describe("Whether the project is shared."),
|
|
1162
1163
|
parentId: s.string().optional().describe("The ID of the parent project (for sub-projects)."),
|
|
@@ -1167,7 +1168,7 @@ const ae = s.enum(fe).optional().catch(void 0).describe("The color key of the en
|
|
|
1167
1168
|
),
|
|
1168
1169
|
folderId: s.string().optional().describe("The ID of the folder this project belongs to (workspace projects only)."),
|
|
1169
1170
|
childOrder: s.number().describe("The ordering index of the project among its siblings.")
|
|
1170
|
-
}),
|
|
1171
|
+
}), ge = s.object({
|
|
1171
1172
|
id: s.string().describe("The unique ID of the section."),
|
|
1172
1173
|
name: s.string().describe("The name of the section.")
|
|
1173
1174
|
}), Qs = s.object({
|
|
@@ -1183,7 +1184,7 @@ const ae = s.enum(fe).optional().catch(void 0).describe("The color key of the en
|
|
|
1183
1184
|
image: s.string().optional().describe("The image URL for image resource types."),
|
|
1184
1185
|
imageWidth: s.number().optional().describe("The width of the image in pixels."),
|
|
1185
1186
|
imageHeight: s.number().optional().describe("The height of the image in pixels.")
|
|
1186
|
-
}),
|
|
1187
|
+
}), ye = s.object({
|
|
1187
1188
|
id: s.string().describe("The unique ID of the comment."),
|
|
1188
1189
|
taskId: s.string().optional().describe("The ID of the task this comment belongs to."),
|
|
1189
1190
|
projectId: s.string().optional().describe("The ID of the project this comment belongs to."),
|
|
@@ -1205,10 +1206,10 @@ const ae = s.enum(fe).optional().catch(void 0).describe("The color key of the en
|
|
|
1205
1206
|
id: s.string().describe("The unique ID of the user."),
|
|
1206
1207
|
name: s.string().describe("The full name of the user."),
|
|
1207
1208
|
email: s.string().describe("The email address of the user.")
|
|
1208
|
-
}),
|
|
1209
|
+
}), de = s.object({
|
|
1209
1210
|
id: s.string().describe("The unique ID of the label."),
|
|
1210
1211
|
name: s.string().describe("The name of the label."),
|
|
1211
|
-
color:
|
|
1212
|
+
color: ie,
|
|
1212
1213
|
order: s.number().optional().catch(void 0).describe("The display order of the label."),
|
|
1213
1214
|
isFavorite: s.boolean().describe("Whether the label is marked as favorite.")
|
|
1214
1215
|
}), sr = s.object({
|
|
@@ -1244,7 +1245,7 @@ const ae = s.enum(fe).optional().catch(void 0).describe("The color key of the en
|
|
|
1244
1245
|
}), or = {
|
|
1245
1246
|
comments: s.array(rr).min(1).describe("The array of comments to add.")
|
|
1246
1247
|
}, nr = {
|
|
1247
|
-
comments: s.array(
|
|
1248
|
+
comments: s.array(ye).describe("The created comments."),
|
|
1248
1249
|
totalCount: s.number().describe("The total number of comments created."),
|
|
1249
1250
|
addedCommentIds: s.array(s.string()).describe("The IDs of the added comments.")
|
|
1250
1251
|
}, ar = {
|
|
@@ -1255,27 +1256,27 @@ const ae = s.enum(fe).optional().catch(void 0).describe("The color key of the en
|
|
|
1255
1256
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
1256
1257
|
async execute(e, t) {
|
|
1257
1258
|
const { comments: r } = e;
|
|
1258
|
-
for (const [l,
|
|
1259
|
-
if (!
|
|
1259
|
+
for (const [l, u] of r.entries()) {
|
|
1260
|
+
if (!u.taskId && !u.projectId)
|
|
1260
1261
|
throw new Error(
|
|
1261
1262
|
`Comment ${l + 1}: Either taskId or projectId must be provided.`
|
|
1262
1263
|
);
|
|
1263
|
-
if (
|
|
1264
|
+
if (u.taskId && u.projectId)
|
|
1264
1265
|
throw new Error(
|
|
1265
1266
|
`Comment ${l + 1}: Cannot provide both taskId and projectId. Choose one.`
|
|
1266
1267
|
);
|
|
1267
1268
|
}
|
|
1268
|
-
const n = r.some((l) =>
|
|
1269
|
+
const n = r.some((l) => pe(l.projectId)) ? await t.getUser() : void 0, a = r.map(async ({ content: l, taskId: u, projectId: p }) => {
|
|
1269
1270
|
const m = await K({
|
|
1270
|
-
projectId:
|
|
1271
|
+
projectId: p,
|
|
1271
1272
|
user: n,
|
|
1272
1273
|
client: n ? void 0 : t
|
|
1273
1274
|
});
|
|
1274
1275
|
return await t.addComment({
|
|
1275
1276
|
content: l,
|
|
1276
|
-
...
|
|
1277
|
+
...u ? { taskId: u } : { projectId: m }
|
|
1277
1278
|
});
|
|
1278
|
-
}), c = (await Promise.all(a)).map(
|
|
1279
|
+
}), c = (await Promise.all(a)).map(fe);
|
|
1279
1280
|
return {
|
|
1280
1281
|
textContent: ir({ comments: c }),
|
|
1281
1282
|
structuredContent: {
|
|
@@ -1306,7 +1307,7 @@ const cr = {
|
|
|
1306
1307
|
id: s.string().describe("The unique ID of the filter."),
|
|
1307
1308
|
name: s.string().describe("The name of the filter."),
|
|
1308
1309
|
query: s.string().describe('The filter query string (e.g. "today & p1", "#Work & overdue").'),
|
|
1309
|
-
color:
|
|
1310
|
+
color: ie,
|
|
1310
1311
|
isFavorite: s.boolean().describe("Whether the filter is marked as favorite."),
|
|
1311
1312
|
itemOrder: s.number().describe("The display order of the filter.")
|
|
1312
1313
|
}), dr = {
|
|
@@ -1329,7 +1330,7 @@ const cr = {
|
|
|
1329
1330
|
id: i.id,
|
|
1330
1331
|
name: i.name,
|
|
1331
1332
|
query: i.query,
|
|
1332
|
-
color:
|
|
1333
|
+
color: ie.parse(i.color),
|
|
1333
1334
|
isFavorite: i.isFavorite,
|
|
1334
1335
|
itemOrder: i.itemOrder
|
|
1335
1336
|
}));
|
|
@@ -1368,7 +1369,7 @@ const pr = s.object({
|
|
|
1368
1369
|
query: s.string().min(1).describe(
|
|
1369
1370
|
'The filter query string. Examples: "today & p1", "#Work & overdue", "@email & today", "(p1 | p2) & !assigned". Operators: | (OR), & (AND), ! (NOT), () grouping, , (multiple queries).'
|
|
1370
1371
|
),
|
|
1371
|
-
color:
|
|
1372
|
+
color: ae,
|
|
1372
1373
|
isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite. Defaults to false.")
|
|
1373
1374
|
}), mr = {
|
|
1374
1375
|
filters: s.array(pr).min(1).describe("The array of filters to add.")
|
|
@@ -1382,28 +1383,28 @@ const pr = s.object({
|
|
|
1382
1383
|
outputSchema: hr,
|
|
1383
1384
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
1384
1385
|
async execute({ filters: e }, t) {
|
|
1385
|
-
const r = Date.now(), o = e.map((
|
|
1386
|
+
const r = Date.now(), o = e.map((p, m) => `tempFilterAdd${m}${r}`), n = e.map((p, m) => Y(
|
|
1386
1387
|
"filter_add",
|
|
1387
1388
|
{
|
|
1388
|
-
name:
|
|
1389
|
-
query:
|
|
1390
|
-
...
|
|
1391
|
-
...
|
|
1389
|
+
name: p.name,
|
|
1390
|
+
query: p.query,
|
|
1391
|
+
...p.color !== void 0 ? { color: p.color } : {},
|
|
1392
|
+
...p.isFavorite !== void 0 ? { isFavorite: p.isFavorite } : {}
|
|
1392
1393
|
},
|
|
1393
1394
|
o[m]
|
|
1394
|
-
)), i = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((
|
|
1395
|
+
)), i = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
|
|
1395
1396
|
const h = o[m], b = h !== void 0 ? i[h] : void 0;
|
|
1396
1397
|
if (!b) return null;
|
|
1397
|
-
const I =
|
|
1398
|
+
const I = p.color !== void 0 ? ie.parse(p.color) : void 0;
|
|
1398
1399
|
return {
|
|
1399
1400
|
id: b,
|
|
1400
|
-
name:
|
|
1401
|
-
query:
|
|
1401
|
+
name: p.name,
|
|
1402
|
+
query: p.query,
|
|
1402
1403
|
color: I,
|
|
1403
|
-
isFavorite:
|
|
1404
|
+
isFavorite: p.isFavorite ?? !1,
|
|
1404
1405
|
itemOrder: 0
|
|
1405
1406
|
};
|
|
1406
|
-
}).filter((
|
|
1407
|
+
}).filter((p) => p !== null), d = c.length, l = c.map((p) => `• ${p.name} (id=${p.id})`).join(`
|
|
1407
1408
|
`);
|
|
1408
1409
|
return {
|
|
1409
1410
|
textContent: `Added ${d} filter${d === 1 ? "" : "s"}:
|
|
@@ -1416,13 +1417,13 @@ ${l}`,
|
|
|
1416
1417
|
}
|
|
1417
1418
|
}, br = s.object({
|
|
1418
1419
|
name: s.string().min(1).max(128).describe("The name of the label."),
|
|
1419
|
-
color:
|
|
1420
|
+
color: ae,
|
|
1420
1421
|
order: s.number().int().optional().describe("The position of the label in the label list."),
|
|
1421
1422
|
isFavorite: s.boolean().optional().describe("Whether the label is a favorite. Defaults to false.")
|
|
1422
1423
|
}), gr = {
|
|
1423
1424
|
labels: s.array(br).min(1).describe("The array of labels to add.")
|
|
1424
1425
|
}, yr = {
|
|
1425
|
-
labels: s.array(
|
|
1426
|
+
labels: s.array(de).describe("The created labels."),
|
|
1426
1427
|
totalCount: s.number().describe("The total number of labels created.")
|
|
1427
1428
|
}, kr = {
|
|
1428
1429
|
name: f.ADD_LABELS,
|
|
@@ -1435,7 +1436,7 @@ ${l}`,
|
|
|
1435
1436
|
return {
|
|
1436
1437
|
textContent: Tr({ labels: r }),
|
|
1437
1438
|
structuredContent: {
|
|
1438
|
-
labels: r.map((n) =>
|
|
1439
|
+
labels: r.map((n) => de.parse(n)),
|
|
1439
1440
|
totalCount: r.length
|
|
1440
1441
|
}
|
|
1441
1442
|
};
|
|
@@ -1476,23 +1477,23 @@ class vr {
|
|
|
1476
1477
|
const o = r.trim();
|
|
1477
1478
|
if (!o)
|
|
1478
1479
|
throw new Error("Workspace reference cannot be empty");
|
|
1479
|
-
const n = await this.getWorkspaces(t), a = n.find((
|
|
1480
|
+
const n = await this.getWorkspaces(t), a = n.find((u) => u.id === o);
|
|
1480
1481
|
if (a)
|
|
1481
1482
|
return { workspaceId: a.id, workspaceName: a.name };
|
|
1482
1483
|
if (Ir(o))
|
|
1483
1484
|
return { workspaceId: o, workspaceName: o };
|
|
1484
|
-
const i = o.toLowerCase(), c = n.find((
|
|
1485
|
+
const i = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === i);
|
|
1485
1486
|
if (c)
|
|
1486
1487
|
return { workspaceId: c.id, workspaceName: c.name };
|
|
1487
|
-
const d = n.filter((
|
|
1488
|
+
const d = n.filter((u) => u.name.toLowerCase().includes(i)), l = d.length === 1 ? d[0] : void 0;
|
|
1488
1489
|
if (l)
|
|
1489
1490
|
return { workspaceId: l.id, workspaceName: l.name };
|
|
1490
1491
|
if (d.length > 1) {
|
|
1491
|
-
const
|
|
1492
|
+
const u = d.slice(0, 5).map((p) => ` - "${p.name}" (id: ${p.id})`).join(`
|
|
1492
1493
|
`);
|
|
1493
1494
|
throw new Error(
|
|
1494
1495
|
`Ambiguous workspace reference "${o}". Multiple workspaces match:
|
|
1495
|
-
${
|
|
1496
|
+
${u}` + (d.length > 5 ? `
|
|
1496
1497
|
... and ${d.length - 5} more` : "")
|
|
1497
1498
|
);
|
|
1498
1499
|
}
|
|
@@ -1512,14 +1513,14 @@ const vt = new vr(), jr = s.object({
|
|
|
1512
1513
|
parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
|
|
1513
1514
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
|
|
1514
1515
|
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe('The project view style. Defaults to "list".'),
|
|
1515
|
-
color:
|
|
1516
|
+
color: ae,
|
|
1516
1517
|
workspace: s.string().trim().min(1).optional().describe(
|
|
1517
1518
|
"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."
|
|
1518
1519
|
)
|
|
1519
1520
|
}), Sr = {
|
|
1520
1521
|
projects: s.array(jr).min(1).describe("The array of projects to add.")
|
|
1521
1522
|
}, Cr = {
|
|
1522
|
-
projects: s.array(
|
|
1523
|
+
projects: s.array(ce).describe("The created projects."),
|
|
1523
1524
|
totalCount: s.number().describe("The total number of projects created.")
|
|
1524
1525
|
}, $r = {
|
|
1525
1526
|
name: f.ADD_PROJECTS,
|
|
@@ -1556,7 +1557,7 @@ function Dr({ projects: e }) {
|
|
|
1556
1557
|
return `Added ${t} project${t === 1 ? "" : "s"}:
|
|
1557
1558
|
${r}`;
|
|
1558
1559
|
}
|
|
1559
|
-
const
|
|
1560
|
+
const he = 25, ke = s.enum(Wt), jt = s.object({
|
|
1560
1561
|
date: s.string().optional().describe("Due date in YYYY-MM-DD format."),
|
|
1561
1562
|
string: s.string().optional().describe('Natural language due string, e.g. "tomorrow at 3pm".'),
|
|
1562
1563
|
timezone: s.string().optional().describe('Timezone for the reminder, e.g. "America/New_York".'),
|
|
@@ -1593,19 +1594,19 @@ const me = 25, ke = s.enum(Wt), jt = s.object({
|
|
|
1593
1594
|
xr,
|
|
1594
1595
|
Ar,
|
|
1595
1596
|
Er
|
|
1596
|
-
]),
|
|
1597
|
-
reminders: s.array(Or).min(1).max(
|
|
1598
|
-
`Array of reminders to create (max ${
|
|
1597
|
+
]), Ur = {
|
|
1598
|
+
reminders: s.array(Or).min(1).max(he).describe(
|
|
1599
|
+
`Array of reminders to create (max ${he}). Each reminder must specify a type: "relative" (minutes before due), "absolute" (specific date/time), or "location" (geofence trigger).`
|
|
1599
1600
|
)
|
|
1600
|
-
},
|
|
1601
|
+
}, Pr = {
|
|
1601
1602
|
reminders: s.array(We).describe("The created reminders."),
|
|
1602
1603
|
totalCount: s.number().describe("Total number of reminders created."),
|
|
1603
1604
|
addedReminderIds: s.array(s.string()).describe("IDs of the created reminders.")
|
|
1604
1605
|
}, _r = {
|
|
1605
1606
|
name: f.ADD_REMINDERS,
|
|
1606
1607
|
description: 'Add reminders to tasks. Supports three types: "relative" (minutes before due), "absolute" (specific date/time), or "location" (geofence-triggered). Each reminder must specify a taskId.',
|
|
1607
|
-
parameters:
|
|
1608
|
-
outputSchema:
|
|
1608
|
+
parameters: Ur,
|
|
1609
|
+
outputSchema: Pr,
|
|
1609
1610
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
1610
1611
|
async execute(e, t) {
|
|
1611
1612
|
const { reminders: r } = e, o = r.map(async (c) => {
|
|
@@ -1636,7 +1637,7 @@ const me = 25, ke = s.enum(Wt), jt = s.object({
|
|
|
1636
1637
|
radius: c.radius
|
|
1637
1638
|
});
|
|
1638
1639
|
}
|
|
1639
|
-
}), a = (await Promise.all(o)).map(
|
|
1640
|
+
}), a = (await Promise.all(o)).map(ue);
|
|
1640
1641
|
return {
|
|
1641
1642
|
textContent: Rr(a),
|
|
1642
1643
|
structuredContent: {
|
|
@@ -1667,7 +1668,7 @@ const Nr = s.object({
|
|
|
1667
1668
|
}), Lr = {
|
|
1668
1669
|
sections: s.array(Nr).min(1).describe("The array of sections to add.")
|
|
1669
1670
|
}, Mr = {
|
|
1670
|
-
sections: s.array(
|
|
1671
|
+
sections: s.array(ge).describe("The created sections."),
|
|
1671
1672
|
totalCount: s.number().describe("The total number of sections created.")
|
|
1672
1673
|
}, Fr = {
|
|
1673
1674
|
name: f.ADD_SECTIONS,
|
|
@@ -1676,7 +1677,7 @@ const Nr = s.object({
|
|
|
1676
1677
|
outputSchema: Mr,
|
|
1677
1678
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
1678
1679
|
async execute({ sections: e }, t) {
|
|
1679
|
-
const o = e.some((c) =>
|
|
1680
|
+
const o = e.some((c) => pe(c.projectId)) ? await t.getUser() : void 0, n = await Promise.all(
|
|
1680
1681
|
e.map(async (c) => ({
|
|
1681
1682
|
...c,
|
|
1682
1683
|
projectId: await K({
|
|
@@ -1890,29 +1891,29 @@ class Wr {
|
|
|
1890
1891
|
};
|
|
1891
1892
|
if (!c.isShared)
|
|
1892
1893
|
return a.push("Share this project to enable task assignments"), { canAssign: !1, projectInfo: l, recommendations: a };
|
|
1893
|
-
const
|
|
1894
|
-
if (!
|
|
1894
|
+
const u = await H.resolveUser(t, o);
|
|
1895
|
+
if (!u)
|
|
1895
1896
|
return a.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: a };
|
|
1896
|
-
const
|
|
1897
|
-
resolvedName:
|
|
1898
|
-
isCollaborator:
|
|
1897
|
+
const p = d.some((b) => b.id === u.userId), m = {
|
|
1898
|
+
resolvedName: u.displayName,
|
|
1899
|
+
isCollaborator: p
|
|
1899
1900
|
};
|
|
1900
|
-
if (!
|
|
1901
|
+
if (!p)
|
|
1901
1902
|
return a.push(
|
|
1902
|
-
`Invite ${
|
|
1903
|
+
`Invite ${u.displayName} to collaborate on project "${c.name}"`
|
|
1903
1904
|
), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: a };
|
|
1904
1905
|
let h;
|
|
1905
1906
|
if (n && n.length > 0) {
|
|
1906
1907
|
let b = 0, I = 0;
|
|
1907
|
-
for (const
|
|
1908
|
+
for (const $ of n)
|
|
1908
1909
|
try {
|
|
1909
|
-
await t.getTask(
|
|
1910
|
+
await t.getTask($), b++;
|
|
1910
1911
|
} catch {
|
|
1911
1912
|
I++;
|
|
1912
1913
|
}
|
|
1913
1914
|
h = { accessibleTasks: b, inaccessibleTasks: I }, I > 0 && a.push(`${I} task(s) are not accessible`);
|
|
1914
1915
|
}
|
|
1915
|
-
return i = !0, a.push(`Ready to assign tasks to ${
|
|
1916
|
+
return i = !0, a.push(`Ready to assign tasks to ${u.displayName}`), {
|
|
1916
1917
|
canAssign: i,
|
|
1917
1918
|
projectInfo: l,
|
|
1918
1919
|
userInfo: m,
|
|
@@ -1931,11 +1932,11 @@ function Ge(e, t, r = {}) {
|
|
|
1931
1932
|
i.push(d);
|
|
1932
1933
|
const l = 5;
|
|
1933
1934
|
if (n || a <= l) {
|
|
1934
|
-
const
|
|
1935
|
-
if (
|
|
1936
|
-
const
|
|
1935
|
+
const u = we(t, l);
|
|
1936
|
+
if (u.length > 0) {
|
|
1937
|
+
const p = a > l ? `, +${a - l} more` : "";
|
|
1937
1938
|
i.push(`Tasks:
|
|
1938
|
-
${
|
|
1939
|
+
${u}${p}.`);
|
|
1939
1940
|
}
|
|
1940
1941
|
}
|
|
1941
1942
|
return i.join(`
|
|
@@ -1946,12 +1947,12 @@ function qe(e) {
|
|
|
1946
1947
|
if (c.push(d), n?.length && n.length <= 5 && c.push(`${a}:
|
|
1947
1948
|
${n.map((l) => ` ${l}`).join(`
|
|
1948
1949
|
`)}.`), i?.length) {
|
|
1949
|
-
const l = i.length,
|
|
1950
|
-
${i.slice(0, Se.MAX_FAILURES_SHOWN).map((
|
|
1950
|
+
const l = i.length, u = `Failed (${l}):
|
|
1951
|
+
${i.slice(0, Se.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
|
|
1951
1952
|
`
|
|
1952
1953
|
`
|
|
1953
1954
|
)}${l > Se.MAX_FAILURES_SHOWN ? `, +${l - Se.MAX_FAILURES_SHOWN} more` : ""}.`;
|
|
1954
|
-
c.push(
|
|
1955
|
+
c.push(u);
|
|
1955
1956
|
}
|
|
1956
1957
|
return c.join(`
|
|
1957
1958
|
`);
|
|
@@ -2047,36 +2048,36 @@ const st = 25, Gr = s.object({
|
|
|
2047
2048
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
|
|
2048
2049
|
async execute(e, t) {
|
|
2049
2050
|
const { tasks: r } = s.object(rt).parse(e), o = /* @__PURE__ */ new Map();
|
|
2050
|
-
r.forEach((
|
|
2051
|
-
const m = Vr(
|
|
2052
|
-
h ? h.push({ task:
|
|
2051
|
+
r.forEach((u, p) => {
|
|
2052
|
+
const m = Vr(u), h = o.get(m);
|
|
2053
|
+
h ? h.push({ task: u, index: p }) : o.set(m, [{ task: u, index: p }]);
|
|
2053
2054
|
});
|
|
2054
2055
|
const a = (await Promise.all(
|
|
2055
|
-
[...o.values()].map(async (
|
|
2056
|
-
const
|
|
2057
|
-
for (const { task: m, index: h } of
|
|
2056
|
+
[...o.values()].map(async (u) => {
|
|
2057
|
+
const p = [];
|
|
2058
|
+
for (const { task: m, index: h } of u)
|
|
2058
2059
|
try {
|
|
2059
2060
|
const b = await Jr(m, t);
|
|
2060
|
-
|
|
2061
|
+
p.push({ index: h, result: { status: "fulfilled", value: b } });
|
|
2061
2062
|
} catch (b) {
|
|
2062
|
-
|
|
2063
|
+
p.push({
|
|
2063
2064
|
index: h,
|
|
2064
2065
|
result: { status: "rejected", reason: b }
|
|
2065
2066
|
});
|
|
2066
2067
|
}
|
|
2067
|
-
return
|
|
2068
|
+
return p;
|
|
2068
2069
|
})
|
|
2069
|
-
)).flat().sort((
|
|
2070
|
-
for (const { index:
|
|
2071
|
-
|
|
2072
|
-
item: r[
|
|
2073
|
-
error:
|
|
2070
|
+
)).flat().sort((u, p) => u.index - p.index), i = [], c = [];
|
|
2071
|
+
for (const { index: u, result: p } of a)
|
|
2072
|
+
p.status === "fulfilled" ? i.push(p.value) : c.push({
|
|
2073
|
+
item: r[u]?.content ?? `Task ${u + 1}`,
|
|
2074
|
+
error: p.reason instanceof Error ? p.reason.message : String(p.reason)
|
|
2074
2075
|
});
|
|
2075
2076
|
if (i.length === 0 && c.length > 0) {
|
|
2076
|
-
const
|
|
2077
|
-
throw new Error(`All ${c.length} task(s) failed to create: ${
|
|
2077
|
+
const u = c.map((p) => `"${p.item}": ${p.error}`).join("; ");
|
|
2078
|
+
throw new Error(`All ${c.length} task(s) failed to create: ${u}`);
|
|
2078
2079
|
}
|
|
2079
|
-
const d = i.map(
|
|
2080
|
+
const d = i.map(P);
|
|
2080
2081
|
return {
|
|
2081
2082
|
textContent: Xr({
|
|
2082
2083
|
tasks: d,
|
|
@@ -2107,9 +2108,9 @@ async function Jr(e, t) {
|
|
|
2107
2108
|
responsibleUser: c,
|
|
2108
2109
|
priority: d,
|
|
2109
2110
|
labels: l,
|
|
2110
|
-
deadlineDate:
|
|
2111
|
-
...
|
|
2112
|
-
} = e, m =
|
|
2111
|
+
deadlineDate: u,
|
|
2112
|
+
...p
|
|
2113
|
+
} = e, m = pe(o) ? void 0 : o;
|
|
2113
2114
|
if (m) {
|
|
2114
2115
|
const b = await t.getProject(m);
|
|
2115
2116
|
if (b.isArchived)
|
|
@@ -2118,13 +2119,13 @@ async function Jr(e, t) {
|
|
|
2118
2119
|
);
|
|
2119
2120
|
}
|
|
2120
2121
|
let h = {
|
|
2121
|
-
...
|
|
2122
|
+
...p,
|
|
2122
2123
|
projectId: m,
|
|
2123
2124
|
sectionId: n,
|
|
2124
2125
|
parentId: a,
|
|
2125
2126
|
order: i,
|
|
2126
2127
|
labels: l,
|
|
2127
|
-
deadlineDate:
|
|
2128
|
+
deadlineDate: u
|
|
2128
2129
|
};
|
|
2129
2130
|
if (d && (h.priority = yt(d)), c && !m && !n && !a)
|
|
2130
2131
|
throw new Error(
|
|
@@ -2163,9 +2164,9 @@ async function Jr(e, t) {
|
|
|
2163
2164
|
c
|
|
2164
2165
|
);
|
|
2165
2166
|
if (!I.isValid) {
|
|
2166
|
-
const
|
|
2167
|
+
const $ = I.error?.message || "Assignment validation failed", D = I.error?.suggestions?.join(". ") || "";
|
|
2167
2168
|
throw new Error(
|
|
2168
|
-
`Task "${e.content}": ${
|
|
2169
|
+
`Task "${e.content}": ${$}${D ? `. ${D}` : ""}`
|
|
2169
2170
|
);
|
|
2170
2171
|
}
|
|
2171
2172
|
h.assigneeId = I.resolvedUser?.userId;
|
|
@@ -2179,7 +2180,7 @@ function Xr({
|
|
|
2179
2180
|
}) {
|
|
2180
2181
|
const o = /* @__PURE__ */ new Set();
|
|
2181
2182
|
for (const a of r.tasks)
|
|
2182
|
-
a.projectId && !
|
|
2183
|
+
a.projectId && !pe(a.projectId) ? o.add("projects") : a.sectionId ? o.add("sections") : a.parentId ? o.add("subtasks") : o.add("inbox");
|
|
2183
2184
|
let n = "";
|
|
2184
2185
|
if (o.size === 1) {
|
|
2185
2186
|
const a = Array.from(o)[0];
|
|
@@ -2319,7 +2320,7 @@ const $t = [
|
|
|
2319
2320
|
switch (e.type) {
|
|
2320
2321
|
case "project": {
|
|
2321
2322
|
const r = await t.getProject(e.id);
|
|
2322
|
-
if (
|
|
2323
|
+
if (me(r) && !r.isArchived)
|
|
2323
2324
|
throw new Error(
|
|
2324
2325
|
`Workspace project "${r.name}" must be archived before it can be deleted. Archive the project first, then delete it.`
|
|
2325
2326
|
);
|
|
@@ -2364,7 +2365,7 @@ const $t = [
|
|
|
2364
2365
|
}, lo = {
|
|
2365
2366
|
type: s.enum(Dt).describe("The type of object fetched."),
|
|
2366
2367
|
id: s.string().describe("The ID of the fetched object."),
|
|
2367
|
-
object: s.union([J,
|
|
2368
|
+
object: s.union([J, ce, ye, ge]).describe("The fetched object data.")
|
|
2368
2369
|
}, uo = {
|
|
2369
2370
|
name: f.FETCH_OBJECT,
|
|
2370
2371
|
description: "Fetch a single task, project, comment, or section by its ID. Use this when you have a specific object ID and want to retrieve its full details.",
|
|
@@ -2376,7 +2377,7 @@ const $t = [
|
|
|
2376
2377
|
try {
|
|
2377
2378
|
switch (r) {
|
|
2378
2379
|
case "task": {
|
|
2379
|
-
const n = await t.getTask(o), a =
|
|
2380
|
+
const n = await t.getTask(o), a = P(n);
|
|
2380
2381
|
return {
|
|
2381
2382
|
textContent: `Found task: ${a.content} • id=${a.id} • priority=${a.priority} • project=${a.projectId}`,
|
|
2382
2383
|
structuredContent: {
|
|
@@ -2398,7 +2399,7 @@ const $t = [
|
|
|
2398
2399
|
};
|
|
2399
2400
|
}
|
|
2400
2401
|
case "comment": {
|
|
2401
|
-
const n = await t.getComment(o), a =
|
|
2402
|
+
const n = await t.getComment(o), a = fe(n), i = a.content.length > 50 ? `${a.content.substring(0, 50)}...` : a.content;
|
|
2402
2403
|
return {
|
|
2403
2404
|
textContent: `Found comment • id=${a.id} • content="${i}" • posted=${a.postedAt}`,
|
|
2404
2405
|
structuredContent: {
|
|
@@ -2456,7 +2457,7 @@ const $t = [
|
|
|
2456
2457
|
);
|
|
2457
2458
|
let a;
|
|
2458
2459
|
if (o === "task") {
|
|
2459
|
-
const i = await t.getTask(n), c =
|
|
2460
|
+
const i = await t.getTask(n), c = P(i), d = [c.content];
|
|
2460
2461
|
c.description && d.push(`
|
|
2461
2462
|
|
|
2462
2463
|
Description: ${c.description}`), c.dueDate && d.push(`
|
|
@@ -2536,12 +2537,12 @@ Favorite: Yes`), a = {
|
|
|
2536
2537
|
outputSchema: bo,
|
|
2537
2538
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
2538
2539
|
async execute(e, t) {
|
|
2539
|
-
const { objectType: r, objectId: o, eventType: n, projectId: a, taskId: i, initiatorId: c, limit: d, cursor: l } = e,
|
|
2540
|
+
const { objectType: r, objectId: o, eventType: n, projectId: a, taskId: i, initiatorId: c, limit: d, cursor: l } = e, u = {
|
|
2540
2541
|
limit: d,
|
|
2541
2542
|
cursor: l ?? null
|
|
2542
2543
|
};
|
|
2543
|
-
r && n ?
|
|
2544
|
-
const { results:
|
|
2544
|
+
r && n ? u.objectEventTypes = `${r}:${n}` : r ? u.objectEventTypes = `${r}:` : n && (u.objectEventTypes = `:${n}`), o && o !== "remove" && (u.objectId = o), a && (u.parentProjectId = a), i && (u.parentItemId = i), c && (u.initiatorId = c);
|
|
2545
|
+
const { results: p, nextCursor: m } = await t.getActivityLogs(u), h = p.map(Vs);
|
|
2545
2546
|
return {
|
|
2546
2547
|
textContent: yo({ events: h, args: e, nextCursor: m }),
|
|
2547
2548
|
structuredContent: {
|
|
@@ -2621,7 +2622,7 @@ const Io = {
|
|
|
2621
2622
|
cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
|
|
2622
2623
|
limit: s.number().int().min(1).max(C.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
|
|
2623
2624
|
}, vo = {
|
|
2624
|
-
comments: s.array(
|
|
2625
|
+
comments: s.array(ye).describe("The found comments."),
|
|
2625
2626
|
searchType: s.string().describe(
|
|
2626
2627
|
'The type of search performed: "single" (comment ID), "task" (task ID), or "project" (project ID).'
|
|
2627
2628
|
),
|
|
@@ -2666,7 +2667,7 @@ const Io = {
|
|
|
2666
2667
|
i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
|
|
2667
2668
|
} else
|
|
2668
2669
|
throw new Error("Invalid state: no search parameter provided");
|
|
2669
|
-
const c = i.map(
|
|
2670
|
+
const c = i.map(fe);
|
|
2670
2671
|
return {
|
|
2671
2672
|
textContent: So({
|
|
2672
2673
|
comments: c,
|
|
@@ -2788,7 +2789,7 @@ const Eo = {
|
|
|
2788
2789
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
2789
2790
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
2790
2791
|
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
2791
|
-
},
|
|
2792
|
+
}, Uo = {
|
|
2792
2793
|
name: f.FIND_COMPLETED_TASKS,
|
|
2793
2794
|
description: "Get completed tasks. 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.",
|
|
2794
2795
|
parameters: Eo,
|
|
@@ -2800,39 +2801,39 @@ const Eo = {
|
|
|
2800
2801
|
throw new Error(
|
|
2801
2802
|
"Cursor pagination requires explicit since and until. Reuse structuredContent.appliedFilters.since and structuredContent.appliedFilters.until from the previous page."
|
|
2802
2803
|
);
|
|
2803
|
-
const
|
|
2804
|
+
const u = await Me(t, c), p = u?.email;
|
|
2804
2805
|
let h = Ve(o, n);
|
|
2805
|
-
|
|
2806
|
-
const b = await t.getUser(), I = b.tzInfo?.gmtString || "+00:00",
|
|
2806
|
+
u && p && (h = oe(h, `assigned to: ${p}`));
|
|
2807
|
+
const b = await t.getUser(), I = b.tzInfo?.gmtString || "+00:00", $ = await K({
|
|
2807
2808
|
projectId: d,
|
|
2808
2809
|
user: b
|
|
2809
|
-
}),
|
|
2810
|
+
}), D = Ao({
|
|
2810
2811
|
since: a,
|
|
2811
2812
|
until: i,
|
|
2812
2813
|
userGmtOffset: I
|
|
2813
|
-
}), N = `${
|
|
2814
|
+
}), N = `${D.since}T00:00:00${I}`, T = `${D.until}T23:59:59${I}`, g = new Date(N).toISOString(), S = new Date(T).toISOString(), _ = {
|
|
2814
2815
|
...e,
|
|
2815
|
-
since:
|
|
2816
|
-
until:
|
|
2816
|
+
since: D.since,
|
|
2817
|
+
until: D.until
|
|
2817
2818
|
}, { items: w, nextCursor: j } = r === "completion" ? await t.getCompletedTasksByCompletionDate({
|
|
2818
2819
|
...l,
|
|
2819
|
-
projectId:
|
|
2820
|
+
projectId: $,
|
|
2820
2821
|
since: g,
|
|
2821
2822
|
until: S,
|
|
2822
2823
|
...h ? { filterQuery: h, filterLang: "en" } : {}
|
|
2823
2824
|
}) : await t.getCompletedTasksByDueDate({
|
|
2824
2825
|
...l,
|
|
2825
|
-
projectId:
|
|
2826
|
+
projectId: $,
|
|
2826
2827
|
since: g,
|
|
2827
2828
|
until: S,
|
|
2828
2829
|
...h ? { filterQuery: h, filterLang: "en" } : {}
|
|
2829
|
-
}), v = w.map(
|
|
2830
|
+
}), v = w.map(P);
|
|
2830
2831
|
return {
|
|
2831
|
-
textContent:
|
|
2832
|
+
textContent: Po({
|
|
2832
2833
|
tasks: v,
|
|
2833
2834
|
args: _,
|
|
2834
2835
|
nextCursor: j,
|
|
2835
|
-
assigneeEmail:
|
|
2836
|
+
assigneeEmail: p
|
|
2836
2837
|
}),
|
|
2837
2838
|
structuredContent: {
|
|
2838
2839
|
tasks: v,
|
|
@@ -2844,7 +2845,7 @@ const Eo = {
|
|
|
2844
2845
|
};
|
|
2845
2846
|
}
|
|
2846
2847
|
};
|
|
2847
|
-
function
|
|
2848
|
+
function Po({
|
|
2848
2849
|
tasks: e,
|
|
2849
2850
|
args: t,
|
|
2850
2851
|
nextCursor: r,
|
|
@@ -2879,7 +2880,7 @@ const _o = {
|
|
|
2879
2880
|
"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."
|
|
2880
2881
|
)
|
|
2881
2882
|
}, Ro = {
|
|
2882
|
-
labels: s.array(
|
|
2883
|
+
labels: s.array(de).describe("The found personal labels."),
|
|
2883
2884
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
2884
2885
|
totalCount: s.number().describe("The total number of labels in this page."),
|
|
2885
2886
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
@@ -2904,7 +2905,7 @@ const _o = {
|
|
|
2904
2905
|
return {
|
|
2905
2906
|
textContent: Lo({ labels: n, args: e, nextCursor: a, sharedLabels: o }),
|
|
2906
2907
|
structuredContent: {
|
|
2907
|
-
labels: n.map((c) =>
|
|
2908
|
+
labels: n.map((c) => de.parse(c)),
|
|
2908
2909
|
nextCursor: a ?? void 0,
|
|
2909
2910
|
totalCount: n.length,
|
|
2910
2911
|
hasMore: !!a,
|
|
@@ -2923,9 +2924,9 @@ function Lo({
|
|
|
2923
2924
|
const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", a = [];
|
|
2924
2925
|
t.searchText && a.push(`searchText: "${t.searchText}"`);
|
|
2925
2926
|
const i = 10, d = e.slice(0, i).map(zr).join(`
|
|
2926
|
-
`), l = e.length - i,
|
|
2927
|
-
…and ${l} more` : d,
|
|
2928
|
-
e.length === 0 && (t.searchText ? (
|
|
2927
|
+
`), l = e.length - i, u = l > 0 ? `${d}
|
|
2928
|
+
…and ${l} more` : d, p = [];
|
|
2929
|
+
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"));
|
|
2929
2930
|
const m = o.length > 0 ? `
|
|
2930
2931
|
Shared labels (${o.length}): ${o.join(", ")}` : `
|
|
2931
2932
|
No shared labels.`;
|
|
@@ -2935,8 +2936,8 @@ No shared labels.`;
|
|
|
2935
2936
|
limit: t.searchText ? void 0 : t.limit,
|
|
2936
2937
|
nextCursor: r ?? void 0,
|
|
2937
2938
|
filterHints: a,
|
|
2938
|
-
previewLines:
|
|
2939
|
-
zeroReasonHints:
|
|
2939
|
+
previewLines: u,
|
|
2940
|
+
zeroReasonHints: p
|
|
2940
2941
|
}) + m;
|
|
2941
2942
|
}
|
|
2942
2943
|
const { FIND_PROJECTS: At, ADD_TASKS: Et, UPDATE_TASKS: Ot } = f, Mo = {
|
|
@@ -3013,9 +3014,9 @@ const { FIND_PROJECTS: At, ADD_TASKS: Et, UPDATE_TASKS: Ot } = f, Mo = {
|
|
|
3013
3014
|
appliedFilters: e
|
|
3014
3015
|
}
|
|
3015
3016
|
};
|
|
3016
|
-
const c =
|
|
3017
|
+
const c = Ut(i, o);
|
|
3017
3018
|
return {
|
|
3018
|
-
textContent:
|
|
3019
|
+
textContent: Pt({
|
|
3019
3020
|
collaborators: c,
|
|
3020
3021
|
projectName: n,
|
|
3021
3022
|
searchTerm: o,
|
|
@@ -3057,9 +3058,9 @@ async function Wo({
|
|
|
3057
3058
|
appliedFilters: r
|
|
3058
3059
|
}
|
|
3059
3060
|
};
|
|
3060
|
-
const a =
|
|
3061
|
+
const a = Ut(n, e);
|
|
3061
3062
|
return {
|
|
3062
|
-
textContent:
|
|
3063
|
+
textContent: Pt({
|
|
3063
3064
|
collaborators: a,
|
|
3064
3065
|
projectName: void 0,
|
|
3065
3066
|
searchTerm: e,
|
|
@@ -3085,7 +3086,7 @@ async function Bo(e, t) {
|
|
|
3085
3086
|
return t;
|
|
3086
3087
|
}
|
|
3087
3088
|
}
|
|
3088
|
-
function
|
|
3089
|
+
function Ut(e, t) {
|
|
3089
3090
|
if (!t)
|
|
3090
3091
|
return e;
|
|
3091
3092
|
const r = t.toLowerCase().trim();
|
|
@@ -3093,7 +3094,7 @@ function Pt(e, t) {
|
|
|
3093
3094
|
(o) => o.name.toLowerCase().includes(r) || o.email.toLowerCase().includes(r)
|
|
3094
3095
|
);
|
|
3095
3096
|
}
|
|
3096
|
-
function
|
|
3097
|
+
function Pt({
|
|
3097
3098
|
collaborators: e,
|
|
3098
3099
|
projectName: t,
|
|
3099
3100
|
searchTerm: r,
|
|
@@ -3102,21 +3103,21 @@ function Ut({
|
|
|
3102
3103
|
const n = t ? `project "${t}"` : "workspace", a = t ? "Project collaborators" : "Workspace users", i = r ? `${a} matching "${r}"` : a, c = [];
|
|
3103
3104
|
r && c.push(`matching "${r}"`), c.push(`in ${n}`);
|
|
3104
3105
|
let d = [];
|
|
3105
|
-
e.length > 0 && (d = e.slice(0, 10).map((
|
|
3106
|
-
const m =
|
|
3107
|
-
return `• ${m} (${h}) - ID: ${
|
|
3106
|
+
e.length > 0 && (d = e.slice(0, 10).map((p) => {
|
|
3107
|
+
const m = p.name || "Unknown Name", h = p.email || "No email";
|
|
3108
|
+
return `• ${m} (${h}) - ID: ${p.id}`;
|
|
3108
3109
|
}), e.length > 10 && d.push(`... and ${e.length - 10} more`));
|
|
3109
3110
|
const l = [];
|
|
3110
3111
|
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`));
|
|
3111
|
-
const
|
|
3112
|
-
return e.length > 0 ? (
|
|
3112
|
+
const u = [];
|
|
3113
|
+
return e.length > 0 ? (u.push(`Use ${Et} with responsibleUser to assign new tasks`), u.push(`Use ${Ot} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${At} to find other projects`), r && o > 0 && u.push("Try searching without filters to see all users")), W({
|
|
3113
3114
|
subject: i,
|
|
3114
3115
|
count: e.length,
|
|
3115
3116
|
filterHints: c,
|
|
3116
3117
|
previewLines: d.join(`
|
|
3117
3118
|
`),
|
|
3118
3119
|
zeroReasonHints: l,
|
|
3119
|
-
nextSteps:
|
|
3120
|
+
nextSteps: u
|
|
3120
3121
|
});
|
|
3121
3122
|
}
|
|
3122
3123
|
const { ADD_PROJECTS: zo } = f, Yo = {
|
|
@@ -3128,7 +3129,7 @@ const { ADD_PROJECTS: zo } = f, Yo = {
|
|
|
3128
3129
|
"The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
3129
3130
|
)
|
|
3130
3131
|
}, Go = {
|
|
3131
|
-
projects: s.array(
|
|
3132
|
+
projects: s.array(ce).describe("The found projects."),
|
|
3132
3133
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
3133
3134
|
totalCount: s.number().describe("The total number of projects in this page."),
|
|
3134
3135
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
@@ -3172,15 +3173,15 @@ function Ko({
|
|
|
3172
3173
|
t.searchText && n.push(`searchText: "${t.searchText}"`);
|
|
3173
3174
|
const a = 10, c = e.slice(0, a).map(Yr).join(`
|
|
3174
3175
|
`), d = e.length - a, l = d > 0 ? `${c}
|
|
3175
|
-
…and ${d} more` : c,
|
|
3176
|
-
return e.length === 0 && (t.searchText ? (
|
|
3176
|
+
…and ${d} more` : c, u = [];
|
|
3177
|
+
return e.length === 0 && (t.searchText ? (u.push("Try broader search terms"), u.push("Check spelling"), u.push("Remove searchText to see all projects")) : (u.push("No projects created yet"), u.push(`Use ${zo} to create a project`))), W({
|
|
3177
3178
|
subject: o,
|
|
3178
3179
|
count: e.length,
|
|
3179
3180
|
limit: t.searchText ? void 0 : t.limit,
|
|
3180
3181
|
nextCursor: r ?? void 0,
|
|
3181
3182
|
filterHints: n,
|
|
3182
3183
|
previewLines: l,
|
|
3183
|
-
zeroReasonHints:
|
|
3184
|
+
zeroReasonHints: u
|
|
3184
3185
|
});
|
|
3185
3186
|
}
|
|
3186
3187
|
const Vo = {
|
|
@@ -3209,7 +3210,7 @@ const Vo = {
|
|
|
3209
3210
|
"Only one of taskId, reminderId, or locationReminderId can be provided at a time."
|
|
3210
3211
|
);
|
|
3211
3212
|
if (o) {
|
|
3212
|
-
const i = await t.getReminder(o), c =
|
|
3213
|
+
const i = await t.getReminder(o), c = ue(i);
|
|
3213
3214
|
return {
|
|
3214
3215
|
textContent: `Found ${i.type} reminder (id=${o})`,
|
|
3215
3216
|
structuredContent: {
|
|
@@ -3221,7 +3222,7 @@ const Vo = {
|
|
|
3221
3222
|
};
|
|
3222
3223
|
}
|
|
3223
3224
|
if (n) {
|
|
3224
|
-
const i = await t.getLocationReminder(n), c =
|
|
3225
|
+
const i = await t.getLocationReminder(n), c = ue(i);
|
|
3225
3226
|
return {
|
|
3226
3227
|
textContent: `Found location reminder (id=${n})`,
|
|
3227
3228
|
structuredContent: {
|
|
@@ -3235,14 +3236,14 @@ const Vo = {
|
|
|
3235
3236
|
if (r) {
|
|
3236
3237
|
const [i, c] = await Promise.all([
|
|
3237
3238
|
q({
|
|
3238
|
-
apiMethod: (
|
|
3239
|
+
apiMethod: (p) => t.getReminders(p),
|
|
3239
3240
|
args: { taskId: r }
|
|
3240
3241
|
}),
|
|
3241
3242
|
q({
|
|
3242
|
-
apiMethod: (
|
|
3243
|
+
apiMethod: (p) => t.getLocationReminders(p),
|
|
3243
3244
|
args: { taskId: r }
|
|
3244
3245
|
})
|
|
3245
|
-
]), l = [...i, ...c].map(
|
|
3246
|
+
]), l = [...i, ...c].map(ue);
|
|
3246
3247
|
return {
|
|
3247
3248
|
textContent: Zo(l, r),
|
|
3248
3249
|
structuredContent: {
|
|
@@ -3278,7 +3279,7 @@ const { ADD_SECTIONS: Qo } = f, en = {
|
|
|
3278
3279
|
'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.'
|
|
3279
3280
|
)
|
|
3280
3281
|
}, tn = {
|
|
3281
|
-
sections: s.array(
|
|
3282
|
+
sections: s.array(ge).describe("The found sections."),
|
|
3282
3283
|
totalCount: s.number().describe("The total number of sections found."),
|
|
3283
3284
|
appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
|
|
3284
3285
|
}, sn = {
|
|
@@ -3372,13 +3373,13 @@ const on = {
|
|
|
3372
3373
|
a = "overdue";
|
|
3373
3374
|
else if (e.startDate === "today")
|
|
3374
3375
|
if (e.daysCount > 1) {
|
|
3375
|
-
const
|
|
3376
|
+
const p = /* @__PURE__ */ new Date(), m = re(p), h = Ae(p, e.daysCount), b = Xe(h, { representation: "date" }), I = `(due after: ${m} | due: ${m}) & due before: ${b}`;
|
|
3376
3377
|
a = e.overdueOption === "exclude-overdue" ? I : `(${I} | overdue)`;
|
|
3377
3378
|
} else
|
|
3378
3379
|
a = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
|
|
3379
3380
|
else if (e.startDate) {
|
|
3380
|
-
const
|
|
3381
|
-
a = `(due after: ${
|
|
3381
|
+
const p = e.startDate, m = Ae(_t(p), e.daysCount), h = Xe(m, { representation: "date" });
|
|
3382
|
+
a = `(due after: ${p} | due: ${p}) & due before: ${h}`;
|
|
3382
3383
|
}
|
|
3383
3384
|
const i = Ve(e.labels, e.labelsOperator);
|
|
3384
3385
|
i.length > 0 && (a = oe(a, `(${i})`));
|
|
@@ -3484,17 +3485,17 @@ class ln {
|
|
|
3484
3485
|
const o = r.trim();
|
|
3485
3486
|
if (!o)
|
|
3486
3487
|
throw new Error("Filter reference cannot be empty");
|
|
3487
|
-
const n = await this.getFilters(t), a = n.find((
|
|
3488
|
+
const n = await this.getFilters(t), a = n.find((u) => u.id === o);
|
|
3488
3489
|
if (a)
|
|
3489
3490
|
return { filterId: a.id, filterName: a.name, filterQuery: a.query };
|
|
3490
|
-
const i = o.toLowerCase(), c = n.find((
|
|
3491
|
+
const i = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === i);
|
|
3491
3492
|
if (c)
|
|
3492
3493
|
return {
|
|
3493
3494
|
filterId: c.id,
|
|
3494
3495
|
filterName: c.name,
|
|
3495
3496
|
filterQuery: c.query
|
|
3496
3497
|
};
|
|
3497
|
-
const d = n.filter((
|
|
3498
|
+
const d = n.filter((u) => u.name.toLowerCase().includes(i)), l = d.length === 1 ? d[0] : void 0;
|
|
3498
3499
|
if (l)
|
|
3499
3500
|
return {
|
|
3500
3501
|
filterId: l.id,
|
|
@@ -3502,11 +3503,11 @@ class ln {
|
|
|
3502
3503
|
filterQuery: l.query
|
|
3503
3504
|
};
|
|
3504
3505
|
if (d.length > 1) {
|
|
3505
|
-
const
|
|
3506
|
+
const u = d.slice(0, 5).map((p) => ` - "${p.name}" (id: ${p.id})`).join(`
|
|
3506
3507
|
`);
|
|
3507
3508
|
throw new Error(
|
|
3508
3509
|
`Ambiguous filter reference "${o}". Multiple filters match:
|
|
3509
|
-
${
|
|
3510
|
+
${u}` + (d.length > 5 ? `
|
|
3510
3511
|
... and ${d.length - 5} more` : "")
|
|
3511
3512
|
);
|
|
3512
3513
|
}
|
|
@@ -3563,11 +3564,11 @@ const un = new ln(), { FIND_COMPLETED_TASKS: nt, ADD_TASKS: at } = f, pn = {
|
|
|
3563
3564
|
responsibleUserFiltering: c,
|
|
3564
3565
|
limit: d,
|
|
3565
3566
|
cursor: l,
|
|
3566
|
-
labels:
|
|
3567
|
-
labelsOperator:
|
|
3567
|
+
labels: u,
|
|
3568
|
+
labelsOperator: p,
|
|
3568
3569
|
filter: m,
|
|
3569
3570
|
filterIdOrName: h
|
|
3570
|
-
} = e, b = await t.getUser(), I =
|
|
3571
|
+
} = e, b = await t.getUser(), I = u && u.length > 0;
|
|
3571
3572
|
if (!r && !o && !n && !a && !i && !I && !m && !h)
|
|
3572
3573
|
throw new Error(
|
|
3573
3574
|
"At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, labels, filter, or filterIdOrName"
|
|
@@ -3580,16 +3581,16 @@ const un = new ln(), { FIND_COMPLETED_TASKS: nt, ADD_TASKS: at } = f, pn = {
|
|
|
3580
3581
|
throw new Error(
|
|
3581
3582
|
'The `filter`/`filterIdOrName` parameter cannot be combined with projectId, sectionId, or parentId. Use filter syntax instead (e.g. "##ProjectName").'
|
|
3582
3583
|
);
|
|
3583
|
-
let
|
|
3584
|
-
h && (
|
|
3585
|
-
const
|
|
3584
|
+
let $ = m;
|
|
3585
|
+
h && ($ = (await un.resolveFilter(t, h)).filterQuery);
|
|
3586
|
+
const D = await Me(t, i), N = D?.userId, T = D?.email;
|
|
3586
3587
|
if (o || n || a) {
|
|
3587
3588
|
const x = {
|
|
3588
3589
|
limit: d,
|
|
3589
3590
|
cursor: l ?? null
|
|
3590
3591
|
};
|
|
3591
3592
|
o && (x.projectId = await K({ projectId: o, user: b })), n && (x.sectionId = n), a && (x.parentId = a);
|
|
3592
|
-
const { results: L, nextCursor: B } = await t.getTasks(x), Ie = L.map(
|
|
3593
|
+
const { results: L, nextCursor: B } = await t.getTasks(x), Ie = L.map(P);
|
|
3593
3594
|
let M = r ? Ie.filter(
|
|
3594
3595
|
(X) => X.content.toLowerCase().includes(r.toLowerCase()) || X.description?.toLowerCase().includes(r.toLowerCase())
|
|
3595
3596
|
) : Ie;
|
|
@@ -3598,10 +3599,10 @@ const un = new ln(), { FIND_COMPLETED_TASKS: nt, ADD_TASKS: at } = f, pn = {
|
|
|
3598
3599
|
resolvedAssigneeId: N,
|
|
3599
3600
|
currentUserId: b.id,
|
|
3600
3601
|
responsibleUserFiltering: c
|
|
3601
|
-
}),
|
|
3602
|
-
(X) =>
|
|
3602
|
+
}), u && u.length > 0 && (M = p === "and" ? M.filter(
|
|
3603
|
+
(X) => u.every((ve) => X.labels.includes(ve))
|
|
3603
3604
|
) : M.filter(
|
|
3604
|
-
(X) =>
|
|
3605
|
+
(X) => u.some((ve) => X.labels.includes(ve))
|
|
3605
3606
|
)), {
|
|
3606
3607
|
textContent: $e({
|
|
3607
3608
|
tasks: M,
|
|
@@ -3619,13 +3620,13 @@ const un = new ln(), { FIND_COMPLETED_TASKS: nt, ADD_TASKS: at } = f, pn = {
|
|
|
3619
3620
|
}
|
|
3620
3621
|
};
|
|
3621
3622
|
}
|
|
3622
|
-
if (N && !r && !I &&
|
|
3623
|
+
if (N && !r && !I && !$) {
|
|
3623
3624
|
const { results: x, nextCursor: L } = await t.getTasksByFilter({
|
|
3624
3625
|
query: `assigned to: ${T}`,
|
|
3625
3626
|
lang: "en",
|
|
3626
3627
|
limit: d,
|
|
3627
3628
|
cursor: l ?? null
|
|
3628
|
-
}), B = x.map(
|
|
3629
|
+
}), B = x.map(P);
|
|
3629
3630
|
return {
|
|
3630
3631
|
textContent: $e({
|
|
3631
3632
|
tasks: B,
|
|
@@ -3643,9 +3644,9 @@ const un = new ln(), { FIND_COMPLETED_TASKS: nt, ADD_TASKS: at } = f, pn = {
|
|
|
3643
3644
|
}
|
|
3644
3645
|
};
|
|
3645
3646
|
}
|
|
3646
|
-
let g =
|
|
3647
|
+
let g = $ ? `(${$})` : "";
|
|
3647
3648
|
r && (g = oe(g, `search: ${r}`));
|
|
3648
|
-
const S = Ve(
|
|
3649
|
+
const S = Ve(u, p);
|
|
3649
3650
|
if (g = oe(g, S), !(h && !i && !c)) {
|
|
3650
3651
|
const x = Tt({
|
|
3651
3652
|
resolvedAssigneeId: N,
|
|
@@ -3717,17 +3718,17 @@ function $e({
|
|
|
3717
3718
|
} else {
|
|
3718
3719
|
const d = n || t.responsibleUser, l = [];
|
|
3719
3720
|
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) {
|
|
3720
|
-
const
|
|
3721
|
-
l.push(`with labels: ${
|
|
3721
|
+
const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
3722
|
+
l.push(`with labels: ${u}`);
|
|
3722
3723
|
}
|
|
3723
|
-
if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (a = `Tasks matching filter: ${t.filter}`, i.push(`filter: ${t.filter}`)) : t.searchText ? (a = `Search results for ${l.join(" ")}`, i.push(`matching "${t.searchText}"`), t.filter && i.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (a = `Tasks assigned to ${d}`, t.filter && i.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (a = `Tasks with labels: ${t.labels.map((
|
|
3724
|
-
const
|
|
3725
|
-
i.push(`labels: ${
|
|
3724
|
+
if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (a = `Tasks matching filter: ${t.filter}`, i.push(`filter: ${t.filter}`)) : t.searchText ? (a = `Search results for ${l.join(" ")}`, i.push(`matching "${t.searchText}"`), t.filter && i.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (a = `Tasks assigned to ${d}`, t.filter && i.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (a = `Tasks with labels: ${t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ")}`, t.filter && i.push(`filter: ${t.filter}`)) : a = `Tasks ${l.join(" ")}`, t.responsibleUser && i.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
|
|
3725
|
+
const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
3726
|
+
i.push(`labels: ${u}`);
|
|
3726
3727
|
}
|
|
3727
3728
|
if (e.length === 0) {
|
|
3728
3729
|
if (t.responsibleUser) {
|
|
3729
|
-
const
|
|
3730
|
-
c.push(`No tasks assigned to ${
|
|
3730
|
+
const u = n || t.responsibleUser;
|
|
3731
|
+
c.push(`No tasks assigned to ${u}`), c.push("Check if the user name is correct"), c.push(`Check completed tasks with ${nt}`);
|
|
3731
3732
|
}
|
|
3732
3733
|
t.searchText && (c.push("Try broader search terms"), c.push("Verify spelling and try partial words"), t.responsibleUser || c.push(`Check completed tasks with ${nt}`));
|
|
3733
3734
|
}
|
|
@@ -3879,7 +3880,7 @@ function Lt(e, t) {
|
|
|
3879
3880
|
id: e.id,
|
|
3880
3881
|
name: e.name,
|
|
3881
3882
|
parentId: ne(e) ? e.parentId ?? void 0 : void 0,
|
|
3882
|
-
folderId:
|
|
3883
|
+
folderId: me(e) ? e.folderId ?? void 0 : void 0,
|
|
3883
3884
|
childOrder: e.childOrder,
|
|
3884
3885
|
sections: t[e.id] || [],
|
|
3885
3886
|
children: e.children.map(
|
|
@@ -3895,7 +3896,7 @@ async function Tn(e, t) {
|
|
|
3895
3896
|
limit: C.TASKS_BATCH_SIZE,
|
|
3896
3897
|
cursor: o ?? void 0
|
|
3897
3898
|
});
|
|
3898
|
-
r = r.concat(n.map(
|
|
3899
|
+
r = r.concat(n.map(P)), o = a ?? void 0;
|
|
3899
3900
|
} while (o);
|
|
3900
3901
|
return r;
|
|
3901
3902
|
}
|
|
@@ -3904,25 +3905,25 @@ async function wn(e, t) {
|
|
|
3904
3905
|
return r;
|
|
3905
3906
|
}
|
|
3906
3907
|
async function In(e) {
|
|
3907
|
-
const { results: t } = await e.getProjects({}), r = t.find((
|
|
3908
|
+
const { results: t } = await e.getProjects({}), r = t.find((p) => ne(p) && p.inboxProject === !0), o = t.filter((p) => !ne(p) || p.inboxProject !== !0), n = yn(o), a = t.map((p) => p.id), i = await kn(e, a), c = ["# Personal Projects", ""];
|
|
3908
3909
|
if (r) {
|
|
3909
3910
|
c.push(`- Inbox Project: ${r.name} (id=${r.id})`);
|
|
3910
|
-
for (const
|
|
3911
|
-
c.push(` - Section: ${
|
|
3911
|
+
for (const p of i[r.id] || [])
|
|
3912
|
+
c.push(` - Section: ${p.name} (id=${p.id})`);
|
|
3912
3913
|
}
|
|
3913
3914
|
if (n.length)
|
|
3914
|
-
for (const
|
|
3915
|
-
c.push(...Nt(
|
|
3915
|
+
for (const p of n)
|
|
3916
|
+
c.push(...Nt(p, i));
|
|
3916
3917
|
else
|
|
3917
3918
|
c.push("_No projects found._");
|
|
3918
3919
|
c.push("");
|
|
3919
|
-
const d = n.some((
|
|
3920
|
+
const d = n.some((p) => p.children.length > 0);
|
|
3920
3921
|
d && c.push(
|
|
3921
3922
|
"_Note: Indentation indicates that a project is a sub-project of the one above it. This allows for organizing projects hierarchically, with parent projects containing related sub-projects._",
|
|
3922
3923
|
""
|
|
3923
3924
|
);
|
|
3924
3925
|
const l = c.join(`
|
|
3925
|
-
`),
|
|
3926
|
+
`), u = {
|
|
3926
3927
|
type: "account_overview",
|
|
3927
3928
|
inbox: r ? {
|
|
3928
3929
|
id: r.id,
|
|
@@ -3930,16 +3931,16 @@ async function In(e) {
|
|
|
3930
3931
|
sections: i[r.id] || []
|
|
3931
3932
|
} : null,
|
|
3932
3933
|
projects: n.map(
|
|
3933
|
-
(
|
|
3934
|
+
(p) => Lt(p, i)
|
|
3934
3935
|
),
|
|
3935
3936
|
totalProjects: t.length,
|
|
3936
3937
|
totalSections: a.reduce(
|
|
3937
|
-
(
|
|
3938
|
+
(p, m) => p + (i[m]?.length || 0),
|
|
3938
3939
|
0
|
|
3939
3940
|
),
|
|
3940
3941
|
hasNestedProjects: d
|
|
3941
3942
|
};
|
|
3942
|
-
return { textContent: l, structuredContent:
|
|
3943
|
+
return { textContent: l, structuredContent: u };
|
|
3943
3944
|
}
|
|
3944
3945
|
async function vn(e, t) {
|
|
3945
3946
|
const [r, o, n] = await Promise.all([
|
|
@@ -3947,23 +3948,23 @@ async function vn(e, t) {
|
|
|
3947
3948
|
wn(e, t),
|
|
3948
3949
|
Tn(e, t)
|
|
3949
3950
|
]), a = {};
|
|
3950
|
-
for (const
|
|
3951
|
-
a[
|
|
3951
|
+
for (const u of o)
|
|
3952
|
+
a[u.id] = [];
|
|
3952
3953
|
const i = [];
|
|
3953
|
-
for (const
|
|
3954
|
-
(
|
|
3954
|
+
for (const u of n)
|
|
3955
|
+
(u.sectionId ? a[u.sectionId] ?? i : i).push(u);
|
|
3955
3956
|
const c = [`# ${r.name}`];
|
|
3956
3957
|
if (i.length > 0) {
|
|
3957
3958
|
c.push("");
|
|
3958
|
-
const
|
|
3959
|
-
c.push(..._e(
|
|
3959
|
+
const u = it(i);
|
|
3960
|
+
c.push(..._e(u));
|
|
3960
3961
|
}
|
|
3961
|
-
for (const
|
|
3962
|
-
c.push(""), c.push(`## ${
|
|
3963
|
-
const
|
|
3964
|
-
if (!
|
|
3962
|
+
for (const u of o) {
|
|
3963
|
+
c.push(""), c.push(`## ${u.name}`);
|
|
3964
|
+
const p = a[u.id];
|
|
3965
|
+
if (!p?.length)
|
|
3965
3966
|
continue;
|
|
3966
|
-
const m = it(
|
|
3967
|
+
const m = it(p);
|
|
3967
3968
|
c.push(..._e(m));
|
|
3968
3969
|
}
|
|
3969
3970
|
const d = c.join(`
|
|
@@ -3974,8 +3975,8 @@ async function vn(e, t) {
|
|
|
3974
3975
|
name: r.name
|
|
3975
3976
|
},
|
|
3976
3977
|
sections: o,
|
|
3977
|
-
tasks: n.map((
|
|
3978
|
-
...
|
|
3978
|
+
tasks: n.map((u) => ({
|
|
3979
|
+
...u,
|
|
3979
3980
|
children: []
|
|
3980
3981
|
// Tasks already include hierarchical info via parentId
|
|
3981
3982
|
})),
|
|
@@ -4186,12 +4187,12 @@ const On = {
|
|
|
4186
4187
|
}
|
|
4187
4188
|
};
|
|
4188
4189
|
}
|
|
4189
|
-
},
|
|
4190
|
+
}, Un = {
|
|
4190
4191
|
projectId: s.string().min(1).describe("The ID of the project to check health for."),
|
|
4191
4192
|
includeContext: s.boolean().default(!1).describe(
|
|
4192
4193
|
"Include detailed health context with project metrics and task-level data. May produce large output for projects with many tasks."
|
|
4193
4194
|
)
|
|
4194
|
-
},
|
|
4195
|
+
}, Pn = s.object({
|
|
4195
4196
|
taskId: s.string().describe("The ID of the task this recommendation is for."),
|
|
4196
4197
|
recommendation: s.string().describe("The recommendation for this task.")
|
|
4197
4198
|
}), _n = s.object({
|
|
@@ -4214,7 +4215,7 @@ const On = {
|
|
|
4214
4215
|
status: s.enum(Re).describe("The overall health status of the project."),
|
|
4215
4216
|
description: s.string().nullable().optional().describe("Detailed description of the health assessment."),
|
|
4216
4217
|
descriptionSummary: s.string().nullable().optional().describe("Brief summary of the health assessment."),
|
|
4217
|
-
taskRecommendations: s.array(
|
|
4218
|
+
taskRecommendations: s.array(Pn).nullable().optional().describe("Specific recommendations for individual tasks."),
|
|
4218
4219
|
isStale: s.boolean().describe("Whether the health data is stale and may need refreshing."),
|
|
4219
4220
|
updateInProgress: s.boolean().describe("Whether a health analysis update is currently in progress."),
|
|
4220
4221
|
updatedAt: s.string().nullable().optional().describe("When the health assessment was last updated.")
|
|
@@ -4275,7 +4276,7 @@ function Ln(e, { progress: t, health: r, context: o }) {
|
|
|
4275
4276
|
const Mn = {
|
|
4276
4277
|
name: f.GET_PROJECT_HEALTH,
|
|
4277
4278
|
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.",
|
|
4278
|
-
parameters:
|
|
4279
|
+
parameters: Un,
|
|
4279
4280
|
outputSchema: Rn,
|
|
4280
4281
|
annotations: {
|
|
4281
4282
|
readOnlyHint: !0,
|
|
@@ -4371,8 +4372,8 @@ const Mn = {
|
|
|
4371
4372
|
""
|
|
4372
4373
|
];
|
|
4373
4374
|
for (const d of i) {
|
|
4374
|
-
const l = d.health?.status ?? "N/A",
|
|
4375
|
-
c.push(`- Project ${d.projectId}: status=${l}, progress=${
|
|
4375
|
+
const l = d.health?.status ?? "N/A", u = d.progress ? `${d.progress.progressPercent}%` : "N/A";
|
|
4376
|
+
c.push(`- Project ${d.projectId}: status=${l}, progress=${u}`);
|
|
4376
4377
|
}
|
|
4377
4378
|
return {
|
|
4378
4379
|
textContent: c.join(`
|
|
@@ -4504,11 +4505,11 @@ const Kn = {
|
|
|
4504
4505
|
const T = l.map((g) => `"${g.taskId}": ${g.error}`).join("; ");
|
|
4505
4506
|
throw new Error(`All ${l.length} task(s) failed: ${T}`);
|
|
4506
4507
|
}
|
|
4507
|
-
let
|
|
4508
|
-
r === "reassign" && a && (
|
|
4509
|
-
const
|
|
4508
|
+
let u;
|
|
4509
|
+
r === "reassign" && a && (u = (await H.resolveUser(t, a))?.userId || a);
|
|
4510
|
+
const p = [];
|
|
4510
4511
|
for (const T of d)
|
|
4511
|
-
r === "reassign" &&
|
|
4512
|
+
r === "reassign" && u && T.responsibleUid !== u || p.push({
|
|
4512
4513
|
taskId: T.id,
|
|
4513
4514
|
projectId: T.projectId,
|
|
4514
4515
|
responsibleUid: n || ""
|
|
@@ -4577,10 +4578,10 @@ const Kn = {
|
|
|
4577
4578
|
}
|
|
4578
4579
|
const m = await Ye.validateBulkAssignment(
|
|
4579
4580
|
t,
|
|
4580
|
-
|
|
4581
|
+
p
|
|
4581
4582
|
), h = [], b = [];
|
|
4582
|
-
for (let T = 0; T <
|
|
4583
|
-
const g =
|
|
4583
|
+
for (let T = 0; T < p.length; T++) {
|
|
4584
|
+
const g = p[T], S = m[T];
|
|
4584
4585
|
g && S?.isValid ? h.push({ assignment: g, validation: S }) : g?.taskId && b.push({
|
|
4585
4586
|
taskId: g.taskId,
|
|
4586
4587
|
success: !1,
|
|
@@ -4636,23 +4637,23 @@ const Kn = {
|
|
|
4636
4637
|
);
|
|
4637
4638
|
return Promise.all(_);
|
|
4638
4639
|
}
|
|
4639
|
-
const
|
|
4640
|
-
if (
|
|
4641
|
-
const T =
|
|
4642
|
-
throw new Error(`All ${
|
|
4640
|
+
const $ = await I(h, !i), D = [...$, ...b, ...l];
|
|
4641
|
+
if (D.length > 0 && D.every((T) => !T.success)) {
|
|
4642
|
+
const T = D.map((g) => `"${g.taskId}": ${g.error}`).join("; ");
|
|
4643
|
+
throw new Error(`All ${D.length} ${r} operation(s) failed: ${T}`);
|
|
4643
4644
|
}
|
|
4644
4645
|
return {
|
|
4645
4646
|
textContent: De({
|
|
4646
4647
|
operation: r,
|
|
4647
|
-
results:
|
|
4648
|
+
results: D,
|
|
4648
4649
|
dryRun: i
|
|
4649
4650
|
}),
|
|
4650
4651
|
structuredContent: {
|
|
4651
4652
|
operation: r,
|
|
4652
|
-
results:
|
|
4653
|
+
results: D,
|
|
4653
4654
|
totalRequested: o.length,
|
|
4654
|
-
successful:
|
|
4655
|
-
failed:
|
|
4655
|
+
successful: $.filter((T) => T.success).length,
|
|
4656
|
+
failed: D.filter((T) => !T.success).length,
|
|
4656
4657
|
dryRun: i
|
|
4657
4658
|
}
|
|
4658
4659
|
};
|
|
@@ -4676,8 +4677,8 @@ function De({
|
|
|
4676
4677
|
`;
|
|
4677
4678
|
const d = o.slice(0, 5);
|
|
4678
4679
|
for (const l of d) {
|
|
4679
|
-
let
|
|
4680
|
-
e === "unassign" ?
|
|
4680
|
+
let u = "";
|
|
4681
|
+
e === "unassign" ? u = " (unassigned from previous assignee)" : l.newAssigneeId && (u = ` → ${l.newAssigneeId}`), c += ` • Task ${l.taskId}${u}
|
|
4681
4682
|
`;
|
|
4682
4683
|
}
|
|
4683
4684
|
o.length > 5 && (c += ` • ... and ${o.length - 5} more
|
|
@@ -4713,7 +4714,7 @@ const ta = {
|
|
|
4713
4714
|
action: s.enum(["archive", "unarchive"]).describe("The action to perform on the project."),
|
|
4714
4715
|
projectId: s.string().min(1).describe("The ID of the project.")
|
|
4715
4716
|
}, sa = {
|
|
4716
|
-
project:
|
|
4717
|
+
project: ce.describe("The updated project."),
|
|
4717
4718
|
success: s.boolean().describe("Whether the action was successful.")
|
|
4718
4719
|
}, ra = {
|
|
4719
4720
|
name: f.PROJECT_MANAGEMENT,
|
|
@@ -4740,7 +4741,7 @@ const ta = {
|
|
|
4740
4741
|
"Optional access visibility for the project in the workspace (restricted, team, or public)."
|
|
4741
4742
|
)
|
|
4742
4743
|
}, na = {
|
|
4743
|
-
project:
|
|
4744
|
+
project: ce.describe("The moved project."),
|
|
4744
4745
|
success: s.boolean().describe("Whether the move was successful.")
|
|
4745
4746
|
}, aa = {
|
|
4746
4747
|
name: f.PROJECT_MOVE,
|
|
@@ -4800,55 +4801,55 @@ const ta = {
|
|
|
4800
4801
|
annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
|
|
4801
4802
|
async execute(e, t) {
|
|
4802
4803
|
const { type: r, items: o } = e, n = /* @__PURE__ */ new Set();
|
|
4803
|
-
for (const
|
|
4804
|
-
if (n.has(
|
|
4805
|
-
throw new Error(`Duplicate item id=${
|
|
4806
|
-
if (n.add(
|
|
4804
|
+
for (const p of o) {
|
|
4805
|
+
if (n.has(p.id))
|
|
4806
|
+
throw new Error(`Duplicate item id=${p.id}. Each item must appear only once.`);
|
|
4807
|
+
if (n.add(p.id), p.order === void 0 && p.parentId === void 0)
|
|
4807
4808
|
throw new Error(
|
|
4808
|
-
`Item id=${
|
|
4809
|
+
`Item id=${p.id} must have at least one of "order" or "parentId".`
|
|
4809
4810
|
);
|
|
4810
|
-
if (
|
|
4811
|
+
if (p.parentId !== void 0 && r !== "project")
|
|
4811
4812
|
throw new Error(
|
|
4812
4813
|
`parentId is only supported when type is "project", but type is "${r}".`
|
|
4813
4814
|
);
|
|
4814
4815
|
}
|
|
4815
|
-
const a = [], i = o.filter((
|
|
4816
|
-
for (const
|
|
4817
|
-
const m =
|
|
4816
|
+
const a = [], i = o.filter((p) => p.parentId !== void 0);
|
|
4817
|
+
for (const p of i) {
|
|
4818
|
+
const m = p.parentId;
|
|
4818
4819
|
a.push(
|
|
4819
4820
|
Y("project_move", {
|
|
4820
|
-
id:
|
|
4821
|
+
id: p.id,
|
|
4821
4822
|
parentId: m === "root" ? null : m
|
|
4822
4823
|
})
|
|
4823
4824
|
);
|
|
4824
4825
|
}
|
|
4825
4826
|
const c = o.filter(
|
|
4826
|
-
(
|
|
4827
|
+
(p) => p.order !== void 0
|
|
4827
4828
|
);
|
|
4828
4829
|
c.length > 0 && (r === "project" ? a.push(
|
|
4829
4830
|
Y("project_reorder", {
|
|
4830
|
-
projects: c.map((
|
|
4831
|
-
id:
|
|
4832
|
-
childOrder:
|
|
4831
|
+
projects: c.map((p) => ({
|
|
4832
|
+
id: p.id,
|
|
4833
|
+
childOrder: p.order
|
|
4833
4834
|
}))
|
|
4834
4835
|
})
|
|
4835
4836
|
) : a.push(
|
|
4836
4837
|
Y("section_reorder", {
|
|
4837
|
-
sections: c.map((
|
|
4838
|
-
id:
|
|
4839
|
-
sectionOrder:
|
|
4838
|
+
sections: c.map((p) => ({
|
|
4839
|
+
id: p.id,
|
|
4840
|
+
sectionOrder: p.order
|
|
4840
4841
|
}))
|
|
4841
4842
|
})
|
|
4842
4843
|
));
|
|
4843
4844
|
try {
|
|
4844
4845
|
await t.sync({ commands: a });
|
|
4845
|
-
} catch (
|
|
4846
|
-
const m =
|
|
4846
|
+
} catch (p) {
|
|
4847
|
+
const m = p instanceof Error ? p.message : String(p);
|
|
4847
4848
|
throw new Error(`Reorder failed: ${m}`);
|
|
4848
4849
|
}
|
|
4849
|
-
const d = r === "project" ? "projects" : "sections", l = o.map((
|
|
4850
|
-
return i.length > 0 &&
|
|
4851
|
-
textContent: `${
|
|
4850
|
+
const d = r === "project" ? "projects" : "sections", l = o.map((p) => p.id), u = [];
|
|
4851
|
+
return i.length > 0 && u.push(`moved ${i.length}`), c.length > 0 && u.push(`reordered ${c.length}`), {
|
|
4852
|
+
textContent: `${u.join(" and ")} ${d}: ${l.map((p) => `id=${p}`).join(", ")}`,
|
|
4852
4853
|
structuredContent: {
|
|
4853
4854
|
type: r,
|
|
4854
4855
|
movedCount: i.length,
|
|
@@ -4886,11 +4887,11 @@ const ta = {
|
|
|
4886
4887
|
throw new Error(
|
|
4887
4888
|
`Task "${l.content}" (${l.id}) has no due date. Rescheduling requires an existing due date.`
|
|
4888
4889
|
);
|
|
4889
|
-
const
|
|
4890
|
+
const u = ha(d.date, l.due);
|
|
4890
4891
|
return Y("item_update", {
|
|
4891
4892
|
id: d.id,
|
|
4892
4893
|
due: {
|
|
4893
|
-
date:
|
|
4894
|
+
date: u,
|
|
4894
4895
|
string: l.due.string,
|
|
4895
4896
|
isRecurring: l.due.isRecurring,
|
|
4896
4897
|
timezone: l.due.timezone ?? void 0,
|
|
@@ -4904,7 +4905,7 @@ const ta = {
|
|
|
4904
4905
|
const l = d instanceof Error ? d.message : String(d);
|
|
4905
4906
|
throw new Error(`Reschedule failed: ${l}`);
|
|
4906
4907
|
}
|
|
4907
|
-
const a = await Promise.all(r.map((d) => t.getTask(d.id))), i = a.map(
|
|
4908
|
+
const a = await Promise.all(r.map((d) => t.getTask(d.id))), i = a.map(P);
|
|
4908
4909
|
return {
|
|
4909
4910
|
textContent: Ge("Rescheduled", i, {
|
|
4910
4911
|
showDetails: i.length <= 5
|
|
@@ -5030,7 +5031,7 @@ const Ia = s.object({
|
|
|
5030
5031
|
}), va = {
|
|
5031
5032
|
comments: s.array(Ia).min(1).describe("The comments to update.")
|
|
5032
5033
|
}, ja = {
|
|
5033
|
-
comments: s.array(
|
|
5034
|
+
comments: s.array(ye).describe("The updated comments."),
|
|
5034
5035
|
totalCount: s.number().describe("The total number of comments updated."),
|
|
5035
5036
|
updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
|
|
5036
5037
|
appliedOperations: s.object({
|
|
@@ -5043,7 +5044,7 @@ const Ia = s.object({
|
|
|
5043
5044
|
outputSchema: ja,
|
|
5044
5045
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5045
5046
|
async execute(e, t) {
|
|
5046
|
-
const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), a = (await Promise.all(o)).map(
|
|
5047
|
+
const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), a = (await Promise.all(o)).map(fe);
|
|
5047
5048
|
return {
|
|
5048
5049
|
textContent: Ca({
|
|
5049
5050
|
comments: a
|
|
@@ -5077,7 +5078,7 @@ const $a = s.object({
|
|
|
5077
5078
|
query: s.string().min(1).optional().describe(
|
|
5078
5079
|
'The new filter query string. Examples: "today & p1", "#Work & overdue", "@email & today".'
|
|
5079
5080
|
),
|
|
5080
|
-
color:
|
|
5081
|
+
color: ae,
|
|
5081
5082
|
isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite.")
|
|
5082
5083
|
}), Da = {
|
|
5083
5084
|
filters: s.array($a).min(1).describe("The filters to update.")
|
|
@@ -5119,22 +5120,22 @@ const $a = s.object({
|
|
|
5119
5120
|
});
|
|
5120
5121
|
});
|
|
5121
5122
|
await t.sync({ commands: i });
|
|
5122
|
-
const d = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((m) => !m.isDeleted), l = new Set(o.map((m) => m.id)),
|
|
5123
|
+
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) => ({
|
|
5123
5124
|
id: m.id,
|
|
5124
5125
|
name: m.name,
|
|
5125
5126
|
query: m.query,
|
|
5126
|
-
color:
|
|
5127
|
+
color: ie.parse(m.color),
|
|
5127
5128
|
isFavorite: m.isFavorite,
|
|
5128
5129
|
itemOrder: m.itemOrder
|
|
5129
5130
|
}));
|
|
5130
5131
|
return {
|
|
5131
|
-
textContent: Ea({ filters:
|
|
5132
|
+
textContent: Ea({ filters: u, skippedCount: a }),
|
|
5132
5133
|
structuredContent: {
|
|
5133
|
-
filters:
|
|
5134
|
-
totalCount:
|
|
5135
|
-
updatedFilterIds:
|
|
5134
|
+
filters: u,
|
|
5135
|
+
totalCount: u.length,
|
|
5136
|
+
updatedFilterIds: u.map((m) => m.id),
|
|
5136
5137
|
appliedOperations: {
|
|
5137
|
-
updateCount:
|
|
5138
|
+
updateCount: u.length,
|
|
5138
5139
|
skippedCount: a
|
|
5139
5140
|
}
|
|
5140
5141
|
}
|
|
@@ -5158,35 +5159,143 @@ ${n}`;
|
|
|
5158
5159
|
function Oa({ id: e, ...t }) {
|
|
5159
5160
|
return Object.values(t).every((o) => o === void 0) ? "no-fields" : null;
|
|
5160
5161
|
}
|
|
5161
|
-
const
|
|
5162
|
+
const Ua = s.object({
|
|
5163
|
+
labelType: s.literal("personal").describe("Update a personal label, identified by its ID."),
|
|
5164
|
+
id: s.string().min(1).describe("The ID of the personal label to update."),
|
|
5165
|
+
name: s.string().min(1).max(128).optional().describe("The new name of the label."),
|
|
5166
|
+
color: ae,
|
|
5167
|
+
order: s.number().int().optional().describe("The new position of the label in the label list."),
|
|
5168
|
+
isFavorite: s.boolean().optional().describe("Whether to mark the label as a favorite.")
|
|
5169
|
+
}), Pa = s.object({
|
|
5170
|
+
labelType: s.literal("shared").describe(
|
|
5171
|
+
"Rename a shared label across all tasks. Shared labels are identified by name; only renaming is supported (no color, order, or favorite)."
|
|
5172
|
+
),
|
|
5173
|
+
name: s.string().min(1).describe("The current name of the shared label."),
|
|
5174
|
+
newName: s.string().min(1).describe("The new name for the shared label.")
|
|
5175
|
+
}), _a = s.discriminatedUnion("labelType", [
|
|
5176
|
+
Ua,
|
|
5177
|
+
Pa
|
|
5178
|
+
]), Ra = {
|
|
5179
|
+
labels: s.array(_a).min(1).describe(
|
|
5180
|
+
'The labels to update. Use labelType="personal" with an ID to update a personal label, or labelType="shared" with name+newName to rename a shared label.'
|
|
5181
|
+
)
|
|
5182
|
+
}, Na = s.object({
|
|
5183
|
+
name: s.string().describe("The previous name of the shared label."),
|
|
5184
|
+
newName: s.string().describe("The new name of the shared label.")
|
|
5185
|
+
}), La = {
|
|
5186
|
+
updatedLabels: s.array(de).describe("The updated personal labels."),
|
|
5187
|
+
renamedSharedLabels: s.array(Na).describe("The shared labels that were renamed."),
|
|
5188
|
+
totalCount: s.number().describe("The total number of successful operations (personal + shared)."),
|
|
5189
|
+
appliedOperations: s.object({
|
|
5190
|
+
updateCount: s.number().describe("Number of personal labels updated."),
|
|
5191
|
+
renameCount: s.number().describe("Number of shared labels renamed."),
|
|
5192
|
+
skippedCount: s.number().describe("Number of operations skipped (no changes or shared label not found).")
|
|
5193
|
+
}).describe("Summary of operations performed.")
|
|
5194
|
+
}, Ma = {
|
|
5195
|
+
name: f.UPDATE_LABELS,
|
|
5196
|
+
description: "Update one or more existing labels. Personal labels (identified by ID) can have their name, color, order, and favorite flag updated. Shared labels (identified by name) can only be renamed.",
|
|
5197
|
+
parameters: Ra,
|
|
5198
|
+
outputSchema: La,
|
|
5199
|
+
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5200
|
+
async execute(e, t) {
|
|
5201
|
+
const { labels: r } = e, o = await Promise.all(
|
|
5202
|
+
r.map(async (u) => {
|
|
5203
|
+
if (u.labelType === "personal") {
|
|
5204
|
+
const m = Ha(u);
|
|
5205
|
+
if (m !== null) return { kind: "skipped", reason: m };
|
|
5206
|
+
const { id: h, labelType: b, ...I } = u;
|
|
5207
|
+
return { kind: "updated", label: await t.updateLabel(h, I) };
|
|
5208
|
+
}
|
|
5209
|
+
return await t.renameSharedLabel({
|
|
5210
|
+
name: u.name,
|
|
5211
|
+
newName: u.newName
|
|
5212
|
+
}) ? { kind: "renamed", name: u.name, newName: u.newName } : { kind: "skipped", reason: "not-found" };
|
|
5213
|
+
})
|
|
5214
|
+
), n = o.filter((u) => u.kind === "updated").map((u) => de.parse(u.label)), a = o.filter(
|
|
5215
|
+
(u) => u.kind === "renamed"
|
|
5216
|
+
).map(({ name: u, newName: p }) => ({ name: u, newName: p })), i = o.filter((u) => u.kind === "skipped").length, c = o.filter(
|
|
5217
|
+
(u) => u.kind === "skipped" && u.reason === "no-fields"
|
|
5218
|
+
).length, d = o.filter(
|
|
5219
|
+
(u) => u.kind === "skipped" && u.reason === "not-found"
|
|
5220
|
+
).length;
|
|
5221
|
+
return {
|
|
5222
|
+
textContent: Fa({
|
|
5223
|
+
updatedLabels: n,
|
|
5224
|
+
renamedSharedLabels: a,
|
|
5225
|
+
skippedNoFields: c,
|
|
5226
|
+
skippedNotFound: d
|
|
5227
|
+
}),
|
|
5228
|
+
structuredContent: {
|
|
5229
|
+
updatedLabels: n,
|
|
5230
|
+
renamedSharedLabels: a,
|
|
5231
|
+
totalCount: n.length + a.length,
|
|
5232
|
+
appliedOperations: {
|
|
5233
|
+
updateCount: n.length,
|
|
5234
|
+
renameCount: a.length,
|
|
5235
|
+
skippedCount: i
|
|
5236
|
+
}
|
|
5237
|
+
}
|
|
5238
|
+
};
|
|
5239
|
+
}
|
|
5240
|
+
};
|
|
5241
|
+
function Fa({
|
|
5242
|
+
updatedLabels: e,
|
|
5243
|
+
renamedSharedLabels: t,
|
|
5244
|
+
skippedNoFields: r,
|
|
5245
|
+
skippedNotFound: o
|
|
5246
|
+
}) {
|
|
5247
|
+
const n = e.length, a = t.length, i = n + a, c = [];
|
|
5248
|
+
c.push(
|
|
5249
|
+
`Updated ${i} label${i === 1 ? "" : "s"} (${n} personal, ${a} shared)`
|
|
5250
|
+
);
|
|
5251
|
+
const d = [];
|
|
5252
|
+
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) {
|
|
5253
|
+
c.push("Personal:");
|
|
5254
|
+
for (const l of e) c.push(`• ${l.name} (id=${l.id})`);
|
|
5255
|
+
}
|
|
5256
|
+
if (a > 0) {
|
|
5257
|
+
c.push("Shared:");
|
|
5258
|
+
for (const l of t) c.push(`• ${l.name} → ${l.newName}`);
|
|
5259
|
+
}
|
|
5260
|
+
return c.join(`
|
|
5261
|
+
`);
|
|
5262
|
+
}
|
|
5263
|
+
function Ha({
|
|
5264
|
+
id: e,
|
|
5265
|
+
labelType: t,
|
|
5266
|
+
...r
|
|
5267
|
+
}) {
|
|
5268
|
+
return Object.values(r).every((n) => n === void 0) ? "no-fields" : null;
|
|
5269
|
+
}
|
|
5270
|
+
const Wa = s.object({
|
|
5162
5271
|
id: s.string().min(1).describe("The ID of the project to update."),
|
|
5163
5272
|
name: s.string().min(1).optional().describe("The new name of the project."),
|
|
5164
5273
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite."),
|
|
5165
5274
|
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe("The project view style."),
|
|
5166
|
-
color:
|
|
5167
|
-
}),
|
|
5168
|
-
projects: s.array(
|
|
5169
|
-
},
|
|
5170
|
-
projects: s.array(
|
|
5275
|
+
color: ae
|
|
5276
|
+
}), Ba = {
|
|
5277
|
+
projects: s.array(Wa).min(1).describe("The projects to update.")
|
|
5278
|
+
}, za = {
|
|
5279
|
+
projects: s.array(ce).describe("The updated projects."),
|
|
5171
5280
|
totalCount: s.number().describe("The total number of projects updated."),
|
|
5172
5281
|
updatedProjectIds: s.array(s.string()).describe("The IDs of the updated projects."),
|
|
5173
5282
|
appliedOperations: s.object({
|
|
5174
5283
|
updateCount: s.number().describe("The number of projects actually updated."),
|
|
5175
5284
|
skippedCount: s.number().describe("The number of projects skipped (no changes).")
|
|
5176
5285
|
}).describe("Summary of operations performed.")
|
|
5177
|
-
},
|
|
5286
|
+
}, Ya = {
|
|
5178
5287
|
name: f.UPDATE_PROJECTS,
|
|
5179
5288
|
description: "Update multiple existing projects with new values.",
|
|
5180
|
-
parameters:
|
|
5181
|
-
outputSchema:
|
|
5289
|
+
parameters: Ba,
|
|
5290
|
+
outputSchema: za,
|
|
5182
5291
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5183
5292
|
async execute(e, t) {
|
|
5184
5293
|
const { projects: r } = e, o = await Promise.all(
|
|
5185
5294
|
r.map(async (d) => {
|
|
5186
|
-
const l =
|
|
5295
|
+
const l = qa(d);
|
|
5187
5296
|
if (l !== null) return { kind: "skipped", reason: l };
|
|
5188
|
-
const { id:
|
|
5189
|
-
return { kind: "updated", project: await t.updateProject(
|
|
5297
|
+
const { id: u, ...p } = d;
|
|
5298
|
+
return { kind: "updated", project: await t.updateProject(u, p) };
|
|
5190
5299
|
})
|
|
5191
5300
|
), n = o.filter(
|
|
5192
5301
|
(d) => d.kind === "updated"
|
|
@@ -5196,7 +5305,7 @@ const Pa = s.object({
|
|
|
5196
5305
|
(d) => d.kind === "skipped" && d.reason === "no-valid-values"
|
|
5197
5306
|
).length;
|
|
5198
5307
|
return {
|
|
5199
|
-
textContent:
|
|
5308
|
+
textContent: Ga({
|
|
5200
5309
|
projects: n,
|
|
5201
5310
|
skippedNoFields: a,
|
|
5202
5311
|
skippedNoValidValues: i
|
|
@@ -5213,7 +5322,7 @@ const Pa = s.object({
|
|
|
5213
5322
|
};
|
|
5214
5323
|
}
|
|
5215
5324
|
};
|
|
5216
|
-
function
|
|
5325
|
+
function Ga({
|
|
5217
5326
|
projects: e,
|
|
5218
5327
|
skippedNoFields: t,
|
|
5219
5328
|
skippedNoValidValues: r
|
|
@@ -5225,23 +5334,23 @@ function Na({
|
|
|
5225
5334
|
return t > 0 && i.push(`${t} skipped - no changes`), r > 0 && i.push(`${r} skipped - no valid field values`), i.length > 0 && (a += ` (${i.join(", ")})`), o > 0 && (a += `:
|
|
5226
5335
|
${n}`), a;
|
|
5227
5336
|
}
|
|
5228
|
-
function
|
|
5337
|
+
function qa({ id: e, ...t }) {
|
|
5229
5338
|
const r = Object.values(t);
|
|
5230
5339
|
return r.length === 0 ? "no-fields" : r.every((o) => o === void 0) ? "no-valid-values" : null;
|
|
5231
5340
|
}
|
|
5232
|
-
const
|
|
5341
|
+
const Ka = s.object({
|
|
5233
5342
|
type: s.literal("relative"),
|
|
5234
5343
|
id: s.string().min(1).describe("The ID of the relative reminder to update."),
|
|
5235
5344
|
minuteOffset: s.number().int().min(0).optional().describe("New minute offset before task due time."),
|
|
5236
5345
|
service: ke.optional().describe('New delivery method: "email" or "push".'),
|
|
5237
5346
|
isUrgent: Te
|
|
5238
|
-
}),
|
|
5347
|
+
}), Va = s.object({
|
|
5239
5348
|
type: s.literal("absolute"),
|
|
5240
5349
|
id: s.string().min(1).describe("The ID of the absolute reminder to update."),
|
|
5241
5350
|
due: jt.optional().describe("New due date/time for the reminder."),
|
|
5242
5351
|
service: ke.optional().describe('New delivery method: "email" or "push".'),
|
|
5243
5352
|
isUrgent: Te
|
|
5244
|
-
}),
|
|
5353
|
+
}), Ja = s.object({
|
|
5245
5354
|
type: s.literal("location"),
|
|
5246
5355
|
id: s.string().min(1).describe("The ID of the location reminder to update."),
|
|
5247
5356
|
name: s.string().optional().describe("New location name."),
|
|
@@ -5251,47 +5360,47 @@ const Ma = s.object({
|
|
|
5251
5360
|
'New trigger condition: "on_enter" or "on_leave".'
|
|
5252
5361
|
),
|
|
5253
5362
|
radius: s.number().int().optional().describe("New radius in meters.")
|
|
5254
|
-
}),
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
]),
|
|
5259
|
-
reminders: s.array(
|
|
5260
|
-
`Array of reminders to update (max ${
|
|
5363
|
+
}), Xa = s.discriminatedUnion("type", [
|
|
5364
|
+
Ka,
|
|
5365
|
+
Va,
|
|
5366
|
+
Ja
|
|
5367
|
+
]), Za = {
|
|
5368
|
+
reminders: s.array(Xa).min(1).max(he).describe(
|
|
5369
|
+
`Array of reminders to update (max ${he}). Each must include the reminder type and ID. Only include fields that need to change.`
|
|
5261
5370
|
)
|
|
5262
|
-
},
|
|
5371
|
+
}, Qa = {
|
|
5263
5372
|
reminders: s.array(We).describe("The updated reminders."),
|
|
5264
5373
|
totalCount: s.number().describe("Total reminders updated."),
|
|
5265
5374
|
updatedReminderIds: s.array(s.string()).describe("IDs of updated reminders.")
|
|
5266
|
-
},
|
|
5375
|
+
}, ei = {
|
|
5267
5376
|
name: f.UPDATE_REMINDERS,
|
|
5268
5377
|
description: 'Update existing reminders. Each reminder must specify its type ("relative", "absolute", or "location") and ID. Only include fields that need to change.',
|
|
5269
|
-
parameters:
|
|
5270
|
-
outputSchema:
|
|
5378
|
+
parameters: Za,
|
|
5379
|
+
outputSchema: Qa,
|
|
5271
5380
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !0 },
|
|
5272
5381
|
async execute(e, t) {
|
|
5273
5382
|
const { reminders: r } = e, o = r.map(async (d) => {
|
|
5274
5383
|
switch (d.type) {
|
|
5275
5384
|
case "relative": {
|
|
5276
|
-
const { id: l, type:
|
|
5385
|
+
const { id: l, type: u, ...p } = d;
|
|
5277
5386
|
return await t.updateReminder(l, {
|
|
5278
5387
|
reminderType: "relative",
|
|
5279
|
-
...
|
|
5388
|
+
...p
|
|
5280
5389
|
});
|
|
5281
5390
|
}
|
|
5282
5391
|
case "absolute": {
|
|
5283
|
-
const { id: l, type:
|
|
5392
|
+
const { id: l, type: u, ...p } = d;
|
|
5284
5393
|
return await t.updateReminder(l, {
|
|
5285
5394
|
reminderType: "absolute",
|
|
5286
|
-
...
|
|
5395
|
+
...p
|
|
5287
5396
|
});
|
|
5288
5397
|
}
|
|
5289
5398
|
case "location": {
|
|
5290
|
-
const { id: l, type:
|
|
5291
|
-
return await t.updateLocationReminder(l,
|
|
5399
|
+
const { id: l, type: u, ...p } = d;
|
|
5400
|
+
return await t.updateLocationReminder(l, p);
|
|
5292
5401
|
}
|
|
5293
5402
|
}
|
|
5294
|
-
}), a = (await Promise.all(o)).map(
|
|
5403
|
+
}), a = (await Promise.all(o)).map(ue), i = a.length === 1 ? "reminder" : "reminders";
|
|
5295
5404
|
return {
|
|
5296
5405
|
textContent: `Updated ${a.length} ${i}`,
|
|
5297
5406
|
structuredContent: {
|
|
@@ -5301,27 +5410,27 @@ const Ma = s.object({
|
|
|
5301
5410
|
}
|
|
5302
5411
|
};
|
|
5303
5412
|
}
|
|
5304
|
-
},
|
|
5413
|
+
}, ti = s.object({
|
|
5305
5414
|
id: s.string().min(1).describe("The ID of the section to update."),
|
|
5306
5415
|
name: s.string().min(1).describe("The new name of the section.")
|
|
5307
|
-
}),
|
|
5308
|
-
sections: s.array(
|
|
5309
|
-
},
|
|
5310
|
-
sections: s.array(
|
|
5416
|
+
}), si = {
|
|
5417
|
+
sections: s.array(ti).min(1).describe("The sections to update.")
|
|
5418
|
+
}, ri = {
|
|
5419
|
+
sections: s.array(ge).describe("The updated sections."),
|
|
5311
5420
|
totalCount: s.number().describe("The total number of sections updated."),
|
|
5312
5421
|
updatedSectionIds: s.array(s.string()).describe("The IDs of the updated sections.")
|
|
5313
|
-
},
|
|
5422
|
+
}, oi = {
|
|
5314
5423
|
name: f.UPDATE_SECTIONS,
|
|
5315
5424
|
description: "Update multiple existing sections with new values.",
|
|
5316
|
-
parameters:
|
|
5317
|
-
outputSchema:
|
|
5425
|
+
parameters: si,
|
|
5426
|
+
outputSchema: ri,
|
|
5318
5427
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5319
5428
|
async execute({ sections: e }, t) {
|
|
5320
5429
|
const r = await Promise.all(
|
|
5321
5430
|
e.map((n) => t.updateSection(n.id, { name: n.name }))
|
|
5322
5431
|
);
|
|
5323
5432
|
return {
|
|
5324
|
-
textContent:
|
|
5433
|
+
textContent: ni({
|
|
5325
5434
|
sections: r
|
|
5326
5435
|
}),
|
|
5327
5436
|
structuredContent: {
|
|
@@ -5332,13 +5441,13 @@ const Ma = s.object({
|
|
|
5332
5441
|
};
|
|
5333
5442
|
}
|
|
5334
5443
|
};
|
|
5335
|
-
function
|
|
5444
|
+
function ni({ sections: e }) {
|
|
5336
5445
|
const t = e.length, r = e.map((n) => `• ${n.name} (id=${n.id}, projectId=${n.projectId})`).join(`
|
|
5337
5446
|
`);
|
|
5338
5447
|
return `Updated ${t} section${t === 1 ? "" : "s"}:
|
|
5339
5448
|
${r}`;
|
|
5340
5449
|
}
|
|
5341
|
-
const
|
|
5450
|
+
const ai = s.object({
|
|
5342
5451
|
id: s.string().min(1).describe("The ID of the task to update."),
|
|
5343
5452
|
content: s.string().optional().describe(
|
|
5344
5453
|
'The new 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.'
|
|
@@ -5377,9 +5486,9 @@ const Xa = s.object({
|
|
|
5377
5486
|
isUncompletable: s.boolean().optional().describe(
|
|
5378
5487
|
"Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed."
|
|
5379
5488
|
)
|
|
5380
|
-
}),
|
|
5381
|
-
tasks: s.array(
|
|
5382
|
-
},
|
|
5489
|
+
}), ii = ["remove", "no date"], ci = ["remove", "no date", "no deadline"], di = "no date", li = {
|
|
5490
|
+
tasks: s.array(ai).min(1).describe("The tasks to update.")
|
|
5491
|
+
}, ui = {
|
|
5383
5492
|
tasks: s.array(J).describe("The updated tasks."),
|
|
5384
5493
|
totalCount: s.number().describe("The total number of tasks updated."),
|
|
5385
5494
|
updatedTaskIds: s.array(s.string()).describe("The IDs of the updated tasks."),
|
|
@@ -5387,27 +5496,27 @@ const Xa = s.object({
|
|
|
5387
5496
|
updateCount: s.number().describe("The number of tasks actually updated."),
|
|
5388
5497
|
skippedCount: s.number().describe("The number of tasks skipped (no changes).")
|
|
5389
5498
|
}).describe("Summary of operations performed.")
|
|
5390
|
-
},
|
|
5499
|
+
}, pi = {
|
|
5391
5500
|
name: f.UPDATE_TASKS,
|
|
5392
5501
|
description: "Update existing tasks including content, dates, priorities, and assignments.",
|
|
5393
|
-
parameters:
|
|
5394
|
-
outputSchema:
|
|
5502
|
+
parameters: li,
|
|
5503
|
+
outputSchema: ui,
|
|
5395
5504
|
annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
|
|
5396
5505
|
async execute(e, t) {
|
|
5397
5506
|
const { tasks: r } = e, o = r.map(async (c) => {
|
|
5398
|
-
if (!
|
|
5507
|
+
if (!hi(c))
|
|
5399
5508
|
return;
|
|
5400
5509
|
const {
|
|
5401
5510
|
id: d,
|
|
5402
5511
|
projectId: l,
|
|
5403
|
-
sectionId:
|
|
5404
|
-
parentId:
|
|
5512
|
+
sectionId: u,
|
|
5513
|
+
parentId: p,
|
|
5405
5514
|
dueString: m,
|
|
5406
5515
|
duration: h,
|
|
5407
5516
|
responsibleUser: b,
|
|
5408
5517
|
priority: I,
|
|
5409
|
-
labels:
|
|
5410
|
-
deadlineDate:
|
|
5518
|
+
labels: $,
|
|
5519
|
+
deadlineDate: D,
|
|
5411
5520
|
...N
|
|
5412
5521
|
} = c, T = await K({
|
|
5413
5522
|
projectId: l,
|
|
@@ -5415,18 +5524,18 @@ const Xa = s.object({
|
|
|
5415
5524
|
});
|
|
5416
5525
|
let g = {
|
|
5417
5526
|
...N,
|
|
5418
|
-
|
|
5527
|
+
...$ !== void 0 && { labels: $ }
|
|
5419
5528
|
};
|
|
5420
5529
|
I && (g.priority = yt(I));
|
|
5421
5530
|
const S = lt(
|
|
5422
5531
|
m,
|
|
5423
|
-
|
|
5424
|
-
|
|
5532
|
+
ii,
|
|
5533
|
+
di
|
|
5425
5534
|
);
|
|
5426
5535
|
S !== void 0 && (g = { ...g, dueString: S });
|
|
5427
5536
|
const _ = lt(
|
|
5428
|
-
|
|
5429
|
-
|
|
5537
|
+
D,
|
|
5538
|
+
ci,
|
|
5430
5539
|
null
|
|
5431
5540
|
);
|
|
5432
5541
|
if (_ !== void 0 && (g = { ...g, deadlineDate: _ }), h)
|
|
@@ -5457,15 +5566,15 @@ const Xa = s.object({
|
|
|
5457
5566
|
}
|
|
5458
5567
|
g = { ...g, assigneeId: v.resolvedUser?.userId };
|
|
5459
5568
|
}
|
|
5460
|
-
if (!T && !
|
|
5569
|
+
if (!T && !u && !p)
|
|
5461
5570
|
return await t.updateTask(d, g);
|
|
5462
|
-
const w = Ks(d, T,
|
|
5571
|
+
const w = Ks(d, T, u, p), j = await t.moveTask(d, w);
|
|
5463
5572
|
return Object.keys(g).length > 0 ? await t.updateTask(d, g) : j;
|
|
5464
5573
|
}), n = (await Promise.all(o)).filter(
|
|
5465
5574
|
(c) => c !== void 0
|
|
5466
|
-
), a = n.map(
|
|
5575
|
+
), a = n.map(P);
|
|
5467
5576
|
return {
|
|
5468
|
-
textContent:
|
|
5577
|
+
textContent: mi({
|
|
5469
5578
|
tasks: a,
|
|
5470
5579
|
args: e
|
|
5471
5580
|
}),
|
|
@@ -5481,7 +5590,7 @@ const Xa = s.object({
|
|
|
5481
5590
|
};
|
|
5482
5591
|
}
|
|
5483
5592
|
};
|
|
5484
|
-
function
|
|
5593
|
+
function mi({
|
|
5485
5594
|
tasks: e,
|
|
5486
5595
|
args: t
|
|
5487
5596
|
}) {
|
|
@@ -5492,7 +5601,7 @@ function oi({
|
|
|
5492
5601
|
showDetails: e.length <= 5
|
|
5493
5602
|
});
|
|
5494
5603
|
}
|
|
5495
|
-
function
|
|
5604
|
+
function hi({ id: e, ...t }) {
|
|
5496
5605
|
return Object.keys(t).length > 0;
|
|
5497
5606
|
}
|
|
5498
5607
|
function lt(e, t, r) {
|
|
@@ -5503,7 +5612,7 @@ function lt(e, t, r) {
|
|
|
5503
5612
|
const o = e.trim().toLowerCase();
|
|
5504
5613
|
return t.includes(o) ? r : e;
|
|
5505
5614
|
}
|
|
5506
|
-
const
|
|
5615
|
+
const fi = {}, bi = {
|
|
5507
5616
|
type: s.literal("user_info").describe("The type of the response."),
|
|
5508
5617
|
userId: s.string().describe("The user ID."),
|
|
5509
5618
|
fullName: s.string().describe("The full name of the user."),
|
|
@@ -5520,25 +5629,25 @@ const ai = {}, ii = {
|
|
|
5520
5629
|
email: s.string().describe("The email address of the user."),
|
|
5521
5630
|
plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
|
|
5522
5631
|
};
|
|
5523
|
-
function
|
|
5632
|
+
function gi(e) {
|
|
5524
5633
|
return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
|
|
5525
5634
|
}
|
|
5526
|
-
function
|
|
5635
|
+
function yi(e, t) {
|
|
5527
5636
|
const o = ((e.getDay() || 7) - t + 7) % 7, n = new Date(e);
|
|
5528
5637
|
return n.setDate(e.getDate() - o), n;
|
|
5529
5638
|
}
|
|
5530
|
-
function
|
|
5639
|
+
function ki(e) {
|
|
5531
5640
|
const t = new Date(e);
|
|
5532
5641
|
return t.setDate(e.getDate() + 6), t;
|
|
5533
5642
|
}
|
|
5534
|
-
function
|
|
5643
|
+
function Ti(e) {
|
|
5535
5644
|
const t = new Date(e.getFullYear(), 0, 1), r = (e.getTime() - t.getTime()) / 864e5;
|
|
5536
5645
|
return Math.ceil((r + t.getDay() + 1) / 7);
|
|
5537
5646
|
}
|
|
5538
|
-
function
|
|
5647
|
+
function wi(e) {
|
|
5539
5648
|
return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][e === 7 ? 0 : e] ?? "Unknown";
|
|
5540
5649
|
}
|
|
5541
|
-
function
|
|
5650
|
+
function Ii(e) {
|
|
5542
5651
|
try {
|
|
5543
5652
|
return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
|
|
5544
5653
|
} catch {
|
|
@@ -5546,9 +5655,9 @@ function mi(e) {
|
|
|
5546
5655
|
}
|
|
5547
5656
|
}
|
|
5548
5657
|
function Ft(e) {
|
|
5549
|
-
return
|
|
5658
|
+
return Ii(e) ? e : "UTC";
|
|
5550
5659
|
}
|
|
5551
|
-
function
|
|
5660
|
+
function vi(e, t) {
|
|
5552
5661
|
const r = Ft(t);
|
|
5553
5662
|
return e.toLocaleString("en-US", {
|
|
5554
5663
|
timeZone: r,
|
|
@@ -5561,8 +5670,8 @@ function hi(e, t) {
|
|
|
5561
5670
|
hour12: !1
|
|
5562
5671
|
});
|
|
5563
5672
|
}
|
|
5564
|
-
async function
|
|
5565
|
-
const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = Ft(r), n = /* @__PURE__ */ new Date(), a =
|
|
5673
|
+
async function ji(e) {
|
|
5674
|
+
const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = Ft(r), n = /* @__PURE__ */ new Date(), a = vi(n, o), i = t.startDay ?? 1, c = wi(i), d = gi(t), l = new Date(n.toLocaleString("en-US", { timeZone: o })), u = yi(l, i), p = ki(u), m = Ti(l), b = [
|
|
5566
5675
|
"# User Information",
|
|
5567
5676
|
"",
|
|
5568
5677
|
`**User ID:** ${t.id}`,
|
|
@@ -5574,8 +5683,8 @@ async function fi(e) {
|
|
|
5574
5683
|
"## Week Settings",
|
|
5575
5684
|
`**Week Start Day:** ${c} (${i})`,
|
|
5576
5685
|
`**Current Week:** Week ${m}`,
|
|
5577
|
-
`**Week Start Date:** ${re(
|
|
5578
|
-
`**Week End Date:** ${re(
|
|
5686
|
+
`**Week Start Date:** ${re(u)}`,
|
|
5687
|
+
`**Week End Date:** ${re(p)}`,
|
|
5579
5688
|
"",
|
|
5580
5689
|
"## Daily Progress",
|
|
5581
5690
|
`**Completed Today:** ${t.completedToday}`,
|
|
@@ -5593,8 +5702,8 @@ async function fi(e) {
|
|
|
5593
5702
|
currentLocalTime: a,
|
|
5594
5703
|
startDay: i,
|
|
5595
5704
|
startDayName: c,
|
|
5596
|
-
weekStartDate: re(
|
|
5597
|
-
weekEndDate: re(
|
|
5705
|
+
weekStartDate: re(u),
|
|
5706
|
+
weekEndDate: re(p),
|
|
5598
5707
|
currentWeekNumber: m,
|
|
5599
5708
|
completedToday: t.completedToday,
|
|
5600
5709
|
dailyGoal: t.dailyGoal,
|
|
@@ -5604,26 +5713,26 @@ async function fi(e) {
|
|
|
5604
5713
|
};
|
|
5605
5714
|
return { textContent: b, structuredContent: I };
|
|
5606
5715
|
}
|
|
5607
|
-
const
|
|
5716
|
+
const Si = {
|
|
5608
5717
|
name: f.USER_INFO,
|
|
5609
5718
|
description: "Get comprehensive user information including user ID, full name, email, timezone with current local time, week start day preferences, current week dates, daily/weekly goal progress, and user plan (Free/Pro/Business).",
|
|
5610
|
-
parameters:
|
|
5611
|
-
outputSchema:
|
|
5719
|
+
parameters: fi,
|
|
5720
|
+
outputSchema: bi,
|
|
5612
5721
|
annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
|
|
5613
5722
|
async execute(e, t) {
|
|
5614
|
-
const r = await
|
|
5723
|
+
const r = await ji(t);
|
|
5615
5724
|
return {
|
|
5616
5725
|
textContent: r.textContent,
|
|
5617
5726
|
structuredContent: r.structuredContent
|
|
5618
5727
|
};
|
|
5619
5728
|
}
|
|
5620
|
-
}, ut = 10 * 1024 * 1024,
|
|
5729
|
+
}, ut = 10 * 1024 * 1024, Ci = /* @__PURE__ */ new Set([
|
|
5621
5730
|
"image/png",
|
|
5622
5731
|
"image/jpeg",
|
|
5623
5732
|
"image/gif",
|
|
5624
5733
|
"image/webp",
|
|
5625
5734
|
"image/svg+xml"
|
|
5626
|
-
]),
|
|
5735
|
+
]), $i = /* @__PURE__ */ new Set([
|
|
5627
5736
|
"text/plain",
|
|
5628
5737
|
"text/csv",
|
|
5629
5738
|
"text/html",
|
|
@@ -5631,7 +5740,7 @@ const bi = {
|
|
|
5631
5740
|
"application/json",
|
|
5632
5741
|
"application/xml",
|
|
5633
5742
|
"text/xml"
|
|
5634
|
-
]),
|
|
5743
|
+
]), Di = {
|
|
5635
5744
|
".png": "image/png",
|
|
5636
5745
|
".jpg": "image/jpeg",
|
|
5637
5746
|
".jpeg": "image/jpeg",
|
|
@@ -5646,23 +5755,23 @@ const bi = {
|
|
|
5646
5755
|
".xml": "application/xml",
|
|
5647
5756
|
".pdf": "application/pdf"
|
|
5648
5757
|
};
|
|
5649
|
-
function
|
|
5650
|
-
return
|
|
5758
|
+
function xi(e) {
|
|
5759
|
+
return Ci.has(e) ? "image" : $i.has(e) || e.startsWith("text/") ? "text" : "binary";
|
|
5651
5760
|
}
|
|
5652
|
-
function
|
|
5761
|
+
function Ai(e) {
|
|
5653
5762
|
return (e.split(";")[0] ?? e).trim().toLowerCase();
|
|
5654
5763
|
}
|
|
5655
|
-
function
|
|
5764
|
+
function Ei(e) {
|
|
5656
5765
|
try {
|
|
5657
5766
|
const t = new URL(e).pathname, r = t.lastIndexOf(".");
|
|
5658
5767
|
if (r === -1) return;
|
|
5659
5768
|
const o = t.slice(r).toLowerCase();
|
|
5660
|
-
return
|
|
5769
|
+
return Di[o];
|
|
5661
5770
|
} catch {
|
|
5662
5771
|
return;
|
|
5663
5772
|
}
|
|
5664
5773
|
}
|
|
5665
|
-
function
|
|
5774
|
+
function Oi(e) {
|
|
5666
5775
|
try {
|
|
5667
5776
|
const t = new URL(e).pathname, r = t.lastIndexOf("/");
|
|
5668
5777
|
return r === -1 ? void 0 : t.slice(r + 1) || void 0;
|
|
@@ -5670,27 +5779,27 @@ function vi(e) {
|
|
|
5670
5779
|
return;
|
|
5671
5780
|
}
|
|
5672
5781
|
}
|
|
5673
|
-
const
|
|
5782
|
+
const Ui = {
|
|
5674
5783
|
fileUrl: s.string().url().describe(
|
|
5675
5784
|
"The URL of the attachment file to view. Get this from the fileUrl field in a comment's fileAttachment."
|
|
5676
5785
|
)
|
|
5677
|
-
},
|
|
5786
|
+
}, Pi = {
|
|
5678
5787
|
fileName: s.string().optional().describe("The name of the file."),
|
|
5679
5788
|
fileType: s.string().optional().describe("The MIME type of the file."),
|
|
5680
5789
|
fileSize: s.number().optional().describe("The size of the file in bytes."),
|
|
5681
5790
|
contentDelivery: s.enum(["image", "text", "embedded_resource", "metadata_only"]).describe("How the content was delivered.")
|
|
5682
|
-
},
|
|
5791
|
+
}, _i = {
|
|
5683
5792
|
name: f.VIEW_ATTACHMENT,
|
|
5684
5793
|
description: "View a file attachment from a Todoist comment. Pass the fileUrl from a comment's fileAttachment field. Supports images (returned inline), text files (returned as text), and binary files like PDFs (returned as embedded resources).",
|
|
5685
|
-
parameters:
|
|
5686
|
-
outputSchema:
|
|
5794
|
+
parameters: Ui,
|
|
5795
|
+
outputSchema: Pi,
|
|
5687
5796
|
annotations: {
|
|
5688
5797
|
readOnlyHint: !0,
|
|
5689
5798
|
destructiveHint: !1,
|
|
5690
5799
|
idempotentHint: !0
|
|
5691
5800
|
},
|
|
5692
5801
|
async execute({ fileUrl: e }, t) {
|
|
5693
|
-
const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, a =
|
|
5802
|
+
const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, a = Oi(e), i = r.headers["content-type"], c = i ? Ai(i) : void 0, d = c && c !== "application/octet-stream" ? c : Ei(e) ?? c ?? "application/octet-stream";
|
|
5694
5803
|
if (n && n > ut)
|
|
5695
5804
|
return {
|
|
5696
5805
|
textContent: `Attachment "${a ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
|
|
@@ -5701,24 +5810,24 @@ const ji = {
|
|
|
5701
5810
|
contentDelivery: "metadata_only"
|
|
5702
5811
|
}
|
|
5703
5812
|
};
|
|
5704
|
-
const l = Buffer.from(await r.arrayBuffer()),
|
|
5705
|
-
if (
|
|
5813
|
+
const l = Buffer.from(await r.arrayBuffer()), u = l.byteLength;
|
|
5814
|
+
if (u > ut)
|
|
5706
5815
|
return {
|
|
5707
|
-
textContent: `Attachment "${a ?? e}" is too large to display inline (${(
|
|
5816
|
+
textContent: `Attachment "${a ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
|
|
5708
5817
|
structuredContent: {
|
|
5709
5818
|
fileName: a,
|
|
5710
5819
|
fileType: d,
|
|
5711
|
-
fileSize:
|
|
5820
|
+
fileSize: u,
|
|
5712
5821
|
contentDelivery: "metadata_only"
|
|
5713
5822
|
}
|
|
5714
5823
|
};
|
|
5715
|
-
const
|
|
5824
|
+
const p = xi(d), m = [];
|
|
5716
5825
|
let h;
|
|
5717
|
-
return
|
|
5826
|
+
return p === "image" ? (m.push({
|
|
5718
5827
|
type: "image",
|
|
5719
5828
|
data: l.toString("base64"),
|
|
5720
5829
|
mimeType: d
|
|
5721
|
-
}), h = "image") :
|
|
5830
|
+
}), h = "image") : p === "text" ? (m.push({
|
|
5722
5831
|
type: "text",
|
|
5723
5832
|
text: l.toString("utf-8")
|
|
5724
5833
|
}), h = "text") : (m.push({
|
|
@@ -5729,17 +5838,17 @@ const ji = {
|
|
|
5729
5838
|
blob: l.toString("base64")
|
|
5730
5839
|
}
|
|
5731
5840
|
}), h = "embedded_resource"), {
|
|
5732
|
-
textContent: `Attachment: ${a ?? "unknown"} (${d}, ${(
|
|
5841
|
+
textContent: `Attachment: ${a ?? "unknown"} (${d}, ${(u / 1024).toFixed(1)}KB)`,
|
|
5733
5842
|
structuredContent: {
|
|
5734
5843
|
fileName: a,
|
|
5735
5844
|
fileType: d,
|
|
5736
|
-
fileSize:
|
|
5845
|
+
fileSize: u,
|
|
5737
5846
|
contentDelivery: h
|
|
5738
5847
|
},
|
|
5739
5848
|
contentItems: m
|
|
5740
5849
|
};
|
|
5741
5850
|
}
|
|
5742
|
-
},
|
|
5851
|
+
}, Ri = `
|
|
5743
5852
|
## Todoist Task and Project Management Tools
|
|
5744
5853
|
|
|
5745
5854
|
You have access to comprehensive Todoist management tools for personal productivity and team collaboration. Use these tools to help users manage tasks, projects, sections, comments, and assignments effectively.
|
|
@@ -5817,7 +5926,7 @@ You have access to comprehensive Todoist management tools for personal productiv
|
|
|
5817
5926
|
|
|
5818
5927
|
5. **Date Handling**: All dates respect user timezone settings. Use 'today' keyword for dynamic date filtering (includes overdue tasks). **When rescheduling/moving tasks to a different date, always use reschedule-tasks** — never update-tasks with dueString, as that destroys recurrence on recurring tasks.
|
|
5819
5928
|
|
|
5820
|
-
6. **Labels**: Use label filtering with AND/OR operators for advanced task organization. Most search tools support labels parameter. Use **find-labels** to discover personal and shared labels — use label **names** (not IDs) when filtering tasks, and use label **IDs** only with **delete-object
|
|
5929
|
+
6. **Labels**: Use label filtering with AND/OR operators for advanced task organization. Most search tools support labels parameter. Use **find-labels** to discover personal and shared labels — use label **names** (not IDs) when filtering tasks, and use label **IDs** only with **delete-object** and **update-labels** (for personal label updates). Use **add-labels** to create new personal labels. Use **update-labels** to rename or recolor personal labels (by ID), or to rename shared labels (by name) — note that shared labels support renaming only, not color/order/favorite changes.
|
|
5821
5930
|
|
|
5822
5931
|
7. **Pagination**: Large result sets use cursor-based pagination. Use limit parameter to control result size (default varies by tool).
|
|
5823
5932
|
|
|
@@ -5837,7 +5946,7 @@ You have access to comprehensive Todoist management tools for personal productiv
|
|
|
5837
5946
|
|
|
5838
5947
|
Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
|
|
5839
5948
|
`;
|
|
5840
|
-
function
|
|
5949
|
+
function Ki({
|
|
5841
5950
|
todoistApiKey: e,
|
|
5842
5951
|
baseUrl: t,
|
|
5843
5952
|
features: r = []
|
|
@@ -5849,7 +5958,7 @@ function Mi({
|
|
|
5849
5958
|
tools: { listChanged: !0 },
|
|
5850
5959
|
prompts: { listChanged: !0 }
|
|
5851
5960
|
},
|
|
5852
|
-
instructions:
|
|
5961
|
+
instructions: Ri
|
|
5853
5962
|
}
|
|
5854
5963
|
), n = new Yt(e, { baseUrl: t }), a = {
|
|
5855
5964
|
...an,
|
|
@@ -5861,39 +5970,40 @@ function Mi({
|
|
|
5861
5970
|
};
|
|
5862
5971
|
as(o);
|
|
5863
5972
|
const i = { server: o, client: n, features: r };
|
|
5864
|
-
return
|
|
5865
|
-
|
|
5973
|
+
return y({ tool: Kr, ...i }), y({ tool: ro, ...i }), y({ tool: Ta, ...i }), y({ tool: pi, ...i }), y({ tool: ma, ...i }), y({ tool: hn, ...i }), y({ tool: a, ...i }), y({ tool: Uo, ...i }), y({ tool: $r, ...i }), y({ tool: Ya, ...i }), y({ tool: qo, ...i }), y({ tool: ra, ...i }), y({ tool: aa, ...i }), y({ tool: Fr, ...i }), y({ tool: oi, ...i }), y({ tool: sn, ...i }), y({ tool: ar, ...i }), y({ tool: jo, ...i }), y({ tool: Sa, ...i }), y({ tool: _r, ...i }), y({ tool: Xo, ...i }), y({ tool: ei, ...i }), y({ tool: _i, ...i }), y({ tool: kr, ...i }), y({ tool: Ma, ...i }), y({ tool: No, ...i }), y({ tool: lr, ...i }), y({ tool: fr, ...i }), y({ tool: Aa, ...i }), y({ tool: go, ...i }), y({ tool: $n, ...i }), y({ tool: Mn, ...i }), y({ tool: On, ...i }), y({ tool: eo, ...i }), y({ tool: Bn, ...i }), y({ tool: jn, ...i }), y({ tool: io, ...i }), y({ tool: uo, ...i }), y({ tool: da, ...i }), y({ tool: Si, ...i }), y({ tool: Ho, ...i }), y({ tool: ea, ...i }), y({ tool: Kn, ...i }), y({ tool: ga, ...i }), y({ tool: ho, ...i }), o.registerPrompt(
|
|
5974
|
+
le.name,
|
|
5866
5975
|
{
|
|
5867
|
-
title:
|
|
5868
|
-
description:
|
|
5869
|
-
argsSchema:
|
|
5976
|
+
title: le.title,
|
|
5977
|
+
description: le.description,
|
|
5978
|
+
argsSchema: le.argsSchema
|
|
5870
5979
|
},
|
|
5871
|
-
|
|
5980
|
+
le.callback
|
|
5872
5981
|
), o;
|
|
5873
5982
|
}
|
|
5874
5983
|
export {
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5984
|
+
sn as A,
|
|
5985
|
+
oi as B,
|
|
5986
|
+
Fr as C,
|
|
5987
|
+
qo as D,
|
|
5988
|
+
Ya as E,
|
|
5989
|
+
$r as F,
|
|
5990
|
+
ma as G,
|
|
5991
|
+
Uo as H,
|
|
5992
|
+
an as I,
|
|
5993
|
+
hn as J,
|
|
5994
|
+
pi as K,
|
|
5995
|
+
Ta as L,
|
|
5996
|
+
ro as M,
|
|
5997
|
+
Kr as N,
|
|
5998
|
+
qi as O,
|
|
5999
|
+
Ts as P,
|
|
5890
6000
|
Ho as a,
|
|
5891
6001
|
jn as b,
|
|
5892
6002
|
Bn as c,
|
|
5893
6003
|
io as d,
|
|
5894
6004
|
eo as e,
|
|
5895
6005
|
ho as f,
|
|
5896
|
-
|
|
6006
|
+
Ki as g,
|
|
5897
6007
|
On as h,
|
|
5898
6008
|
Mn as i,
|
|
5899
6009
|
$n as j,
|
|
@@ -5906,11 +6016,11 @@ export {
|
|
|
5906
6016
|
No as q,
|
|
5907
6017
|
da as r,
|
|
5908
6018
|
ga as s,
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
6019
|
+
Ma as t,
|
|
6020
|
+
Si as u,
|
|
6021
|
+
kr as v,
|
|
6022
|
+
_i as w,
|
|
6023
|
+
jo as x,
|
|
6024
|
+
Sa as y,
|
|
6025
|
+
ar as z
|
|
5916
6026
|
};
|