@doist/todoist-mcp 10.1.0 → 10.1.2

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.
@@ -72,16 +72,16 @@ function q(e) {
72
72
  function We(...e) {
73
73
  return e.find(q);
74
74
  }
75
- function R(...e) {
75
+ function L(...e) {
76
76
  return e.find((t) => t !== void 0);
77
77
  }
78
- function E(e) {
78
+ function O(e) {
79
79
  if (typeof e == "number" && Number.isFinite(e))
80
80
  return e;
81
81
  if (typeof e == "string" && /^\d+$/.test(e.trim()))
82
82
  return Number(e.trim());
83
83
  }
84
- function k(e) {
84
+ function T(e) {
85
85
  if (typeof e == "string") {
86
86
  const t = e.trim();
87
87
  return t.length > 0 ? t : void 0;
@@ -90,8 +90,8 @@ function k(e) {
90
90
  return String(e);
91
91
  }
92
92
  function Q(e) {
93
- const t = E(e);
94
- return t !== void 0 ? t : k(e);
93
+ const t = O(e);
94
+ return t !== void 0 ? t : T(e);
95
95
  }
96
96
  function $s(e) {
97
97
  return e.replace(/\b(Bearer)\s+[A-Za-z0-9._~+/=-]+/gi, "$1 [REDACTED]").replace(
@@ -99,7 +99,7 @@ function $s(e) {
99
99
  "$1: [REDACTED]"
100
100
  ).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]");
101
101
  }
102
- function U(e, t = 220) {
102
+ function _(e, t = 220) {
103
103
  const o = $s(e).replace(/\s+/g, " ").trim();
104
104
  return o.length <= t ? o : `${o.slice(0, t - 3)}...`;
105
105
  }
@@ -112,45 +112,45 @@ function Ee(e) {
112
112
  return;
113
113
  const t = e.match(/\b(?:HTTP|status code)\s*[:#-]?\s*(\d{3})\b/i);
114
114
  if (t?.[1])
115
- return E(t[1]);
115
+ return O(t[1]);
116
116
  }
117
117
  function B(e) {
118
- const t = k(e);
118
+ const t = T(e);
119
119
  if (t)
120
- return U(t);
120
+ return _(t);
121
121
  if (Array.isArray(e)) {
122
- const n = e.map((a) => q(a) ? k(a.message) || k(a.error) : k(a)).filter((a) => !!a);
123
- return n.length > 0 ? U(n.slice(0, 2).join("; ")) : void 0;
122
+ const n = e.map((a) => q(a) ? T(a.message) || T(a.error) : T(a)).filter((a) => !!a);
123
+ return n.length > 0 ? _(n.slice(0, 2).join("; ")) : void 0;
124
124
  }
125
125
  if (!q(e))
126
126
  return;
127
- const o = R(
128
- k(e.detail),
129
- k(e.details),
130
- k(e.message),
131
- k(e.error),
132
- k(e.description)
127
+ const o = L(
128
+ T(e.detail),
129
+ T(e.details),
130
+ T(e.message),
131
+ T(e.error),
132
+ T(e.description)
133
133
  );
134
134
  if (o)
135
- return U(o);
135
+ return _(o);
136
136
  const r = [];
137
137
  for (const [n, a] of Object.entries(e)) {
138
- const i = k(a);
138
+ const i = T(a);
139
139
  if (i && (r.push(`${n}: ${i}`), r.length >= 2))
140
140
  break;
141
141
  }
142
- return r.length > 0 ? U(r.join("; ")) : void 0;
142
+ return r.length > 0 ? _(r.join("; ")) : void 0;
143
143
  }
144
144
  function Ds(e) {
145
145
  if (!e)
146
146
  return [];
147
147
  const t = /* @__PURE__ */ new Set(), o = (i) => {
148
- i && t.add(U(i, 120));
149
- }, r = R(
150
- k(e.field),
151
- k(e.parameter),
152
- k(e.param),
153
- k(e.path)
148
+ i && t.add(_(i, 120));
149
+ }, r = L(
150
+ T(e.field),
151
+ T(e.parameter),
152
+ T(e.param),
153
+ T(e.path)
154
154
  );
155
155
  o(r);
156
156
  const n = We(
@@ -160,12 +160,12 @@ function Ds(e) {
160
160
  e.error_extra
161
161
  );
162
162
  if (n) {
163
- const i = R(
164
- k(n.field),
165
- k(n.parameter),
166
- k(n.param),
167
- k(n.path),
168
- k(n.argument)
163
+ const i = L(
164
+ T(n.field),
165
+ T(n.parameter),
166
+ T(n.param),
167
+ T(n.path),
168
+ T(n.argument)
169
169
  );
170
170
  o(i);
171
171
  }
@@ -173,32 +173,32 @@ function Ds(e) {
173
173
  if (Array.isArray(a))
174
174
  for (const i of a) {
175
175
  if (!q(i)) {
176
- o(k(i));
176
+ o(T(i));
177
177
  continue;
178
178
  }
179
- const c = R(
180
- k(i.field),
181
- k(i.parameter),
182
- k(i.param),
183
- k(i.path),
184
- k(i.name)
185
- ), d = R(
186
- k(i.message),
187
- k(i.error),
188
- k(i.detail),
189
- k(i.description)
179
+ const c = L(
180
+ T(i.field),
181
+ T(i.parameter),
182
+ T(i.param),
183
+ T(i.path),
184
+ T(i.name)
185
+ ), d = L(
186
+ T(i.message),
187
+ T(i.error),
188
+ T(i.detail),
189
+ T(i.description)
190
190
  );
191
191
  o(c && d ? `${c}: ${d}` : c || d);
192
192
  }
193
193
  else if (q(a))
194
194
  for (const [i, c] of Object.entries(a)) {
195
- const d = k(c);
195
+ const d = T(c);
196
196
  if (d) {
197
197
  o(`${i}: ${d}`);
198
198
  continue;
199
199
  }
200
200
  if (Array.isArray(c)) {
201
- const l = c.map((u) => k(u)).filter((u) => !!u).join(", ");
201
+ const l = c.map((u) => T(u)).filter((u) => !!u).join(", ");
202
202
  o(l ? `${i}: ${l}` : i);
203
203
  }
204
204
  }
@@ -228,41 +228,41 @@ function Os(e) {
228
228
  t?.data,
229
229
  o?.responseData,
230
230
  o?.data
231
- ), a = R(
232
- E(t?.httpStatusCode),
233
- E(t?.statusCode),
234
- E(t?.status),
235
- E(r?.status),
236
- E(n?.httpStatusCode),
237
- E(n?.statusCode),
238
- E(n?.status),
239
- E(n?.httpCode),
240
- E(n?.http_code),
241
- Ee(k(t?.message)),
242
- Ee(k(o?.message)),
231
+ ), a = L(
232
+ O(t?.httpStatusCode),
233
+ O(t?.statusCode),
234
+ O(t?.status),
235
+ O(r?.status),
236
+ O(n?.httpStatusCode),
237
+ O(n?.statusCode),
238
+ O(n?.status),
239
+ O(n?.httpCode),
240
+ O(n?.http_code),
241
+ Ee(T(t?.message)),
242
+ Ee(T(o?.message)),
243
243
  Ee(typeof e == "string" ? e : void 0)
244
- ), i = R(
244
+ ), i = L(
245
245
  Q(n?.errorCode),
246
246
  Q(n?.error_code),
247
247
  Q(n?.code),
248
248
  Q(t?.errorCode),
249
249
  Q(t?.error_code),
250
250
  Q(t?.code)
251
- ), c = R(
252
- k(n?.errorTag),
253
- k(n?.error_tag),
254
- k(n?.tag),
255
- k(t?.errorTag),
256
- k(t?.error_tag),
257
- k(t?.tag)
251
+ ), c = L(
252
+ T(n?.errorTag),
253
+ T(n?.error_tag),
254
+ T(n?.tag),
255
+ T(t?.errorTag),
256
+ T(t?.error_tag),
257
+ T(t?.tag)
258
258
  ), d = [
259
- k(n?.error),
260
- k(n?.message),
259
+ T(n?.error),
260
+ T(n?.message),
261
261
  B(n?.message),
262
- k(t?.message),
263
- k(o?.message),
264
- e instanceof Error ? e.message : k(e)
265
- ].filter((h) => !!h), l = d.find((h) => !dt(h)) || d[0], u = R(
262
+ T(t?.message),
263
+ T(o?.message),
264
+ e instanceof Error ? e.message : T(e)
265
+ ].filter((h) => !!h), l = d.find((h) => !dt(h)) || d[0], u = L(
266
266
  B(n?.errorExtra),
267
267
  B(n?.error_extra),
268
268
  B(n?.details),
@@ -273,9 +273,9 @@ function Os(e) {
273
273
  return a !== void 0 || As(n) || c !== void 0 || i !== void 0 || (l ? dt(l) : !1) ? {
274
274
  statusCode: a,
275
275
  code: i,
276
- tag: c ? U(c, 80) : void 0,
277
- message: l ? U(l) : void 0,
278
- details: u ? U(u) : void 0,
276
+ tag: c ? _(c, 80) : void 0,
277
+ message: l ? _(l) : void 0,
278
+ details: u ? _(u) : void 0,
279
279
  fieldHints: p
280
280
  } : null;
281
281
  }
@@ -289,7 +289,7 @@ function Us(e) {
289
289
  `);
290
290
  }
291
291
  function _s(e) {
292
- return e instanceof Error ? U(e.message) : typeof e == "string" ? U(e) : "An unknown error occurred";
292
+ return e instanceof Error ? _(e.message) : typeof e == "string" ? _(e) : "An unknown error occurred";
293
293
  }
294
294
  function Ps(e) {
295
295
  if (e instanceof ps)
@@ -297,7 +297,7 @@ function Ps(e) {
297
297
  const t = Os(e);
298
298
  return t ? Us(t) : _s(e);
299
299
  }
300
- const Rs = "10.1.0", Ls = {
300
+ const Rs = "10.1.2", Ls = {
301
301
  version: Rs
302
302
  }, Ns = "todoist-mcp", Ke = Ls.version, Ut = new ms(), lt = hs(import.meta.url);
303
303
  let ye;
@@ -406,14 +406,14 @@ function Js(e = globalThis.fetch, t = {}) {
406
406
  return async (i, c = {}) => {
407
407
  const { timeout: d, headers: l, signal: u, ...p } = c, { signal: m, cleanup: h } = Ys(u, d);
408
408
  try {
409
- const b = {
409
+ const k = {
410
410
  ...p,
411
411
  signal: m,
412
412
  ...r ? { headers: Bs(l, { platform: n, sessionId: a }) } : l !== void 0 ? { headers: l } : {}
413
413
  };
414
- o && await Ks(b);
415
- const I = await e(i, b);
416
- return Vs(I);
414
+ o && await Ks(k);
415
+ const b = await e(i, k);
416
+ return Vs(b);
417
417
  } finally {
418
418
  h();
419
419
  }
@@ -794,7 +794,7 @@ const pe = {
794
794
  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.",
795
795
  argsSchema: bo,
796
796
  callback: To
797
- }, j = {
797
+ }, $ = {
798
798
  /** Default limit for task listings */
799
799
  TASKS_DEFAULT: 10,
800
800
  /** Maximum limit for task search and list operations */
@@ -831,43 +831,43 @@ const pe = {
831
831
  /** Maximum number of failures to show in detailed error messages */
832
832
  MAX_FAILURES_SHOWN: 3
833
833
  };
834
- class O extends Error {
834
+ class U extends Error {
835
835
  constructor(t, o) {
836
836
  super(`Invalid duration format "${t}": ${o}`), this.name = "DurationParseError";
837
837
  }
838
838
  }
839
839
  function Pt(e) {
840
840
  if (!e || typeof e != "string")
841
- throw new O(e, "Duration must be a non-empty string");
841
+ throw new U(e, "Duration must be a non-empty string");
842
842
  const t = e.trim().toLowerCase().replace(/\s+/g, "");
843
843
  if (!t)
844
- throw new O(e, "Duration must be a non-empty string");
844
+ throw new U(e, "Duration must be a non-empty string");
845
845
  const o = t.match(/^(?:(\d+(?:\.\d+)?)h)?(?:(\d+(?:\.\d+)?)m)?$/);
846
846
  if (!o || !o[1] && !o[2])
847
- throw new O(e, 'Use format like "2h", "30m", "2h30m", or "1.5h"');
847
+ throw new U(e, 'Use format like "2h", "30m", "2h30m", or "1.5h"');
848
848
  let r = 0;
849
849
  const [, n, a] = o;
850
850
  if (n) {
851
851
  const i = Number.parseFloat(n);
852
852
  if (Number.isNaN(i) || i < 0)
853
- throw new O(e, "Hours must be a positive number");
853
+ throw new U(e, "Hours must be a positive number");
854
854
  r += i * 60;
855
855
  }
856
856
  if (a) {
857
857
  const i = Number.parseFloat(a);
858
858
  if (Number.isNaN(i) || i < 0)
859
- throw new O(e, "Minutes must be a positive number");
859
+ throw new U(e, "Minutes must be a positive number");
860
860
  if (i % 1 !== 0)
861
- throw new O(
861
+ throw new U(
862
862
  e,
863
863
  "Minutes must be a whole number (use decimal hours instead)"
864
864
  );
865
865
  r += i;
866
866
  }
867
867
  if (r = Math.round(r), r === 0)
868
- throw new O(e, "Duration must be greater than 0 minutes");
868
+ throw new U(e, "Duration must be greater than 0 minutes");
869
869
  if (r > 1440)
870
- throw new O(e, "Duration cannot exceed 24 hours (1440 minutes)");
870
+ throw new U(e, "Duration cannot exceed 24 hours (1440 minutes)");
871
871
  return { minutes: r };
872
872
  }
873
873
  function wo(e) {
@@ -882,7 +882,7 @@ function Rt(e) {
882
882
  function vo(e) {
883
883
  return { 4: "p1", 3: "p2", 2: "p3", 1: "p4" }[e];
884
884
  }
885
- const A = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map(), Ue = 300 * 1e3, So = "me";
885
+ const E = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map(), Ue = 300 * 1e3, So = "me";
886
886
  class jo {
887
887
  /**
888
888
  * Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
@@ -891,7 +891,7 @@ class jo {
891
891
  async resolveUser(t, o) {
892
892
  if (!o || o.trim().length === 0)
893
893
  return null;
894
- const r = o.trim(), n = A.get(r);
894
+ const r = o.trim(), n = E.get(r);
895
895
  if (n && Date.now() - n.timestamp < Ue)
896
896
  return n.result;
897
897
  if (r.toLowerCase() === So)
@@ -907,7 +907,7 @@ class jo {
907
907
  }
908
908
  if (/^[0-9]+$/.test(r) || /^[a-f0-9-]{8,}$/i.test(r) && r.includes("-") || /^[a-z0-9_]{6,}$/i.test(r) && !/^[a-z]+[\s-]/.test(r) && /[0-9_]/.test(r)) {
909
909
  const a = { userId: r, displayName: r, email: r };
910
- return A.set(r, { result: a, timestamp: Date.now() }), a;
910
+ return E.set(r, { result: a, timestamp: Date.now() }), a;
911
911
  }
912
912
  try {
913
913
  let a = await this.getAllCollaborators(t);
@@ -924,33 +924,33 @@ class jo {
924
924
  } catch {
925
925
  }
926
926
  if (a.length === 0)
927
- return A.set(r, { result: null, timestamp: Date.now() }), null;
927
+ return E.set(r, { result: null, timestamp: Date.now() }), null;
928
928
  const i = o.toLowerCase().trim();
929
929
  let c = a.find((l) => l.id === r);
930
930
  if (c) {
931
931
  const l = { userId: c.id, displayName: c.name, email: c.email };
932
- return A.set(r, { result: l, timestamp: Date.now() }), l;
932
+ return E.set(r, { result: l, timestamp: Date.now() }), l;
933
933
  }
934
934
  if (c = a.find((l) => l.name.toLowerCase() === i), c) {
935
935
  const l = { userId: c.id, displayName: c.name, email: c.email };
936
- return A.set(r, { result: l, timestamp: Date.now() }), l;
936
+ return E.set(r, { result: l, timestamp: Date.now() }), l;
937
937
  }
938
938
  if (c = a.find((l) => l.email.toLowerCase() === i), c) {
939
939
  const l = { userId: c.id, displayName: c.name, email: c.email };
940
- return A.set(r, { result: l, timestamp: Date.now() }), l;
940
+ return E.set(r, { result: l, timestamp: Date.now() }), l;
941
941
  }
942
942
  if (c = a.find((l) => l.name.toLowerCase().includes(i)), c) {
943
943
  const l = { userId: c.id, displayName: c.name, email: c.email };
944
- return A.set(r, { result: l, timestamp: Date.now() }), l;
944
+ return E.set(r, { result: l, timestamp: Date.now() }), l;
945
945
  }
946
946
  if (c = a.find((l) => l.email.toLowerCase().includes(i)), c) {
947
947
  const l = { userId: c.id, displayName: c.name, email: c.email };
948
- return A.set(r, { result: l, timestamp: Date.now() }), l;
948
+ return E.set(r, { result: l, timestamp: Date.now() }), l;
949
949
  }
950
950
  const d = null;
951
- return A.set(r, { result: d, timestamp: Date.now() }), d;
951
+ return E.set(r, { result: d, timestamp: Date.now() }), d;
952
952
  } catch {
953
- return A.set(r, { result: null, timestamp: Date.now() }), null;
953
+ return E.set(r, { result: null, timestamp: Date.now() }), null;
954
954
  }
955
955
  }
956
956
  /**
@@ -1015,7 +1015,7 @@ class jo {
1015
1015
  * Clear all caches - useful for testing
1016
1016
  */
1017
1017
  clearCache() {
1018
- A.clear(), ee.clear();
1018
+ E.clear(), ee.clear();
1019
1019
  }
1020
1020
  }
1021
1021
  const W = new jo();
@@ -1083,21 +1083,21 @@ async function Mt(e, t) {
1083
1083
  return z({
1084
1084
  apiMethod: e.searchProjects.bind(e),
1085
1085
  args: { query: Ze(t) },
1086
- limit: j.PROJECTS_MAX
1086
+ limit: $.PROJECTS_MAX
1087
1087
  });
1088
1088
  }
1089
1089
  async function Do(e, t) {
1090
1090
  return z({
1091
1091
  apiMethod: e.searchLabels.bind(e),
1092
1092
  args: { query: Ze(t) },
1093
- limit: j.LABELS_MAX
1093
+ limit: $.LABELS_MAX
1094
1094
  });
1095
1095
  }
1096
1096
  async function xo(e) {
1097
1097
  return z({
1098
1098
  apiMethod: e.getSharedLabels.bind(e),
1099
1099
  args: {},
1100
- limit: j.LABELS_MAX
1100
+ limit: $.LABELS_MAX
1101
1101
  });
1102
1102
  }
1103
1103
  async function Ao(e, t, o) {
@@ -1105,7 +1105,7 @@ async function Ao(e, t, o) {
1105
1105
  return z({
1106
1106
  apiMethod: e.searchSections.bind(e),
1107
1107
  args: o ? { query: r, projectId: o } : { query: r },
1108
- limit: j.SECTIONS_MAX
1108
+ limit: $.SECTIONS_MAX
1109
1109
  });
1110
1110
  }
1111
1111
  function Eo(e, t, o, r) {
@@ -1123,7 +1123,7 @@ function Eo(e, t, o, r) {
1123
1123
  if (r) return { parentId: r };
1124
1124
  throw new Error("Unexpected error: No valid move parameter found");
1125
1125
  }
1126
- function _(e) {
1126
+ function P(e) {
1127
1127
  return {
1128
1128
  id: e.id,
1129
1129
  content: e.content,
@@ -1224,7 +1224,7 @@ async function Qe({
1224
1224
  }) {
1225
1225
  try {
1226
1226
  const { results: n, nextCursor: a } = await e.getTasksByFilter({ query: t, cursor: r, limit: o });
1227
- return { tasks: n.map(_), nextCursor: a };
1227
+ return { tasks: n.map(P), nextCursor: a };
1228
1228
  } catch (n) {
1229
1229
  const a = Uo.safeParse(n);
1230
1230
  if (!a.success)
@@ -1566,14 +1566,14 @@ const Vo = s.object({
1566
1566
  },
1567
1567
  r[m]
1568
1568
  )), i = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
1569
- const h = r[m], b = h !== void 0 ? i[h] : void 0;
1570
- if (!b) return null;
1571
- const I = p.color !== void 0 ? de.parse(p.color) : void 0;
1569
+ const h = r[m], k = h !== void 0 ? i[h] : void 0;
1570
+ if (!k) return null;
1571
+ const b = p.color !== void 0 ? de.parse(p.color) : void 0;
1572
1572
  return {
1573
- id: b,
1573
+ id: k,
1574
1574
  name: p.name,
1575
1575
  query: p.query,
1576
- color: I,
1576
+ color: b,
1577
1577
  isFavorite: p.isFavorite ?? !1,
1578
1578
  itemOrder: 0
1579
1579
  };
@@ -2098,7 +2098,7 @@ class xr {
2098
2098
  const u = await W.resolveUser(t, r);
2099
2099
  if (!u)
2100
2100
  return a.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: a };
2101
- const p = d.some((b) => b.id === u.userId), m = {
2101
+ const p = d.some((k) => k.id === u.userId), m = {
2102
2102
  resolvedName: u.displayName,
2103
2103
  isCollaborator: p
2104
2104
  };
@@ -2108,14 +2108,14 @@ class xr {
2108
2108
  ), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: a };
2109
2109
  let h;
2110
2110
  if (n && n.length > 0) {
2111
- let b = 0, I = 0;
2112
- for (const C of n)
2111
+ let k = 0, b = 0;
2112
+ for (const j of n)
2113
2113
  try {
2114
- await t.getTask(C), b++;
2114
+ await t.getTask(j), k++;
2115
2115
  } catch {
2116
- I++;
2116
+ b++;
2117
2117
  }
2118
- h = { accessibleTasks: b, inaccessibleTasks: I }, I > 0 && a.push(`${I} task(s) are not accessible`);
2118
+ h = { accessibleTasks: k, inaccessibleTasks: b }, b > 0 && a.push(`${b} task(s) are not accessible`);
2119
2119
  }
2120
2120
  return i = !0, a.push(`Ready to assign tasks to ${u.displayName}`), {
2121
2121
  canAssign: i,
@@ -2183,7 +2183,7 @@ function De(e, t = 5) {
2183
2183
  }
2184
2184
  return r;
2185
2185
  }
2186
- function L({
2186
+ function N({
2187
2187
  subject: e,
2188
2188
  count: t,
2189
2189
  limit: o,
@@ -2252,49 +2252,49 @@ const ht = 25, Ur = s.object({
2252
2252
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
2253
2253
  async execute(e, t) {
2254
2254
  const { tasks: o } = s.object(ft).parse(e), r = /* @__PURE__ */ new Map();
2255
- o.forEach((u, p) => {
2256
- const m = Rr(u), h = r.get(m);
2257
- h ? h.push({ task: u, index: p }) : r.set(m, [{ task: u, index: p }]);
2255
+ o.forEach((p, m) => {
2256
+ const h = Rr(p), k = r.get(h);
2257
+ k ? k.push({ task: p, index: m }) : r.set(h, [{ task: p, index: m }]);
2258
2258
  });
2259
- const a = (await Promise.all(
2260
- [...r.values()].map(async (u) => {
2261
- const p = [];
2262
- for (const { task: m, index: h } of u)
2259
+ const n = /* @__PURE__ */ new Map(), i = (await Promise.all(
2260
+ [...r.values()].map(async (p) => {
2261
+ const m = [];
2262
+ for (const { task: h, index: k } of p)
2263
2263
  try {
2264
- const b = await Lr(m, t);
2265
- p.push({ index: h, result: { status: "fulfilled", value: b } });
2264
+ const b = await Lr(h, t, n);
2265
+ m.push({ index: k, result: { status: "fulfilled", value: b } });
2266
2266
  } catch (b) {
2267
- p.push({
2268
- index: h,
2267
+ m.push({
2268
+ index: k,
2269
2269
  result: { status: "rejected", reason: b }
2270
2270
  });
2271
2271
  }
2272
- return p;
2272
+ return m;
2273
2273
  })
2274
- )).flat().sort((u, p) => u.index - p.index), i = [], c = [];
2275
- for (const { index: u, result: p } of a)
2276
- p.status === "fulfilled" ? i.push(p.value) : c.push({
2277
- item: o[u]?.content ?? `Task ${u + 1}`,
2278
- error: p.reason instanceof Error ? p.reason.message : String(p.reason)
2274
+ )).flat().sort((p, m) => p.index - m.index), c = [], d = [];
2275
+ for (const { index: p, result: m } of i)
2276
+ m.status === "fulfilled" ? c.push(m.value) : d.push({
2277
+ item: o[p]?.content ?? `Task ${p + 1}`,
2278
+ error: m.reason instanceof Error ? m.reason.message : String(m.reason)
2279
2279
  });
2280
- if (i.length === 0 && c.length > 0) {
2281
- const u = c.map((p) => `"${p.item}": ${p.error}`).join("; ");
2282
- throw new Error(`All ${c.length} task(s) failed to create: ${u}`);
2280
+ if (c.length === 0 && d.length > 0) {
2281
+ const p = d.map((m) => `"${m.item}": ${m.error}`).join("; ");
2282
+ throw new Error(`All ${d.length} task(s) failed to create: ${p}`);
2283
2283
  }
2284
- const d = i.map(_);
2284
+ const l = c.map(P);
2285
2285
  return {
2286
2286
  textContent: Nr({
2287
- tasks: d,
2288
- failures: c,
2287
+ tasks: l,
2288
+ failures: d,
2289
2289
  args: { tasks: o }
2290
2290
  }),
2291
2291
  structuredContent: {
2292
- tasks: d,
2293
- totalCount: d.length,
2294
- failures: c,
2292
+ tasks: l,
2293
+ totalCount: l.length,
2294
+ failures: d,
2295
2295
  totalRequested: o.length,
2296
- successCount: i.length,
2297
- failureCount: c.length
2296
+ successCount: c.length,
2297
+ failureCount: d.length
2298
2298
  }
2299
2299
  };
2300
2300
  }
@@ -2302,80 +2302,82 @@ const ht = 25, Ur = s.object({
2302
2302
  function Rr(e) {
2303
2303
  return `${e.projectId ?? ""}|${e.sectionId ?? ""}|${e.parentId ?? ""}`;
2304
2304
  }
2305
- async function Lr(e, t) {
2305
+ async function Lr(e, t, o) {
2306
2306
  const {
2307
- duration: o,
2308
- projectId: r,
2309
- sectionId: n,
2310
- parentId: a,
2311
- order: i,
2312
- responsibleUser: c,
2313
- priority: d,
2314
- labels: l,
2315
- deadlineDate: u,
2316
- ...p
2317
- } = e, m = he(r) ? void 0 : r;
2318
- if (m) {
2319
- const b = await t.getProject(m);
2307
+ duration: r,
2308
+ projectId: n,
2309
+ sectionId: a,
2310
+ parentId: i,
2311
+ order: c,
2312
+ responsibleUser: d,
2313
+ priority: l,
2314
+ labels: u,
2315
+ deadlineDate: p,
2316
+ ...m
2317
+ } = e, h = he(n) ? void 0 : n;
2318
+ if (h) {
2319
+ const b = await t.getProject(h);
2320
2320
  if (b.isArchived)
2321
2321
  throw new Error(
2322
2322
  `Task "${e.content}": Cannot create task in archived project "${b.name}"`
2323
2323
  );
2324
2324
  }
2325
- let h = {
2326
- ...p,
2327
- projectId: m,
2328
- sectionId: n,
2329
- parentId: a,
2330
- order: i,
2331
- labels: l,
2332
- deadlineDate: u
2325
+ let k = {
2326
+ ...m,
2327
+ projectId: h,
2328
+ sectionId: a,
2329
+ parentId: i,
2330
+ order: c,
2331
+ labels: u,
2332
+ deadlineDate: p
2333
2333
  };
2334
- if (d && (h.priority = Rt(d)), c && !m && !n && !a)
2334
+ if (l && (k.priority = Rt(l)), d && !h && !a && !i)
2335
2335
  throw new Error(
2336
2336
  `Task "${e.content}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
2337
2337
  );
2338
- if (o)
2338
+ if (r)
2339
2339
  try {
2340
- const { minutes: b } = Pt(o);
2341
- h = {
2342
- ...h,
2340
+ const { minutes: b } = Pt(r);
2341
+ k = {
2342
+ ...k,
2343
2343
  duration: b,
2344
2344
  durationUnit: "minute"
2345
2345
  };
2346
2346
  } catch (b) {
2347
- throw b instanceof O ? new Error(`Task "${e.content}": ${b.message}`) : b;
2347
+ throw b instanceof U ? new Error(`Task "${e.content}": ${b.message}`) : b;
2348
2348
  }
2349
- if (c) {
2350
- let b = m;
2351
- if (!b && a)
2349
+ if (d) {
2350
+ let b = h;
2351
+ if (!b && i)
2352
2352
  try {
2353
- b = (await t.getTask(a)).projectId;
2353
+ b = (await t.getTask(i)).projectId;
2354
2354
  } catch {
2355
- throw new Error(`Task "${e.content}": Parent task "${a}" not found`);
2355
+ throw new Error(`Task "${e.content}": Parent task "${i}" not found`);
2356
2356
  }
2357
- else if (!b && n)
2358
- throw new Error(
2359
- `Task "${e.content}": When assigning tasks to sections, please also specify projectId`
2360
- );
2357
+ else if (!b && a && (b = o.get(a), !b)) {
2358
+ const v = await t.getSection(a);
2359
+ if (!v)
2360
+ throw new Error(`Task "${e.content}": Section "${a}" not found`);
2361
+ b = v.projectId, o.set(a, v.projectId);
2362
+ }
2361
2363
  if (!b)
2362
2364
  throw new Error(
2363
2365
  `Task "${e.content}": Cannot determine target project for assignment validation`
2364
2366
  );
2365
- const I = await st.validateTaskCreationAssignment(
2367
+ const j = await st.validateTaskCreationAssignment(
2366
2368
  t,
2367
2369
  b,
2368
- c
2370
+ d
2369
2371
  );
2370
- if (!I.isValid) {
2371
- const C = I.error?.message || "Assignment validation failed", D = I.error?.suggestions?.join(". ") || "";
2372
+ if (!j.isValid) {
2373
+ const v = j.error?.message || "Assignment validation failed", A = j.error?.suggestions?.join(". ") || "";
2372
2374
  throw new Error(
2373
- `Task "${e.content}": ${C}${D ? `. ${D}` : ""}`
2375
+ `Task "${e.content}": ${v}${A ? `. ${A}` : ""}`
2374
2376
  );
2375
2377
  }
2376
- h.assigneeId = I.resolvedUser?.userId;
2378
+ k.assigneeId = j.resolvedUser?.userId;
2377
2379
  }
2378
- return await t.addTask(h);
2380
+ return await t.addTask(k);
2379
2381
  }
2380
2382
  function Nr({
2381
2383
  tasks: e,
@@ -2633,7 +2635,7 @@ const Yt = [
2633
2635
  try {
2634
2636
  switch (o) {
2635
2637
  case "task": {
2636
- const n = await t.getTask(r), a = _(n);
2638
+ const n = await t.getTask(r), a = P(n);
2637
2639
  return {
2638
2640
  textContent: `Found task: ${a.content} • id=${a.id} • priority=${a.priority} • project=${a.projectId}`,
2639
2641
  structuredContent: {
@@ -2724,7 +2726,7 @@ const Yt = [
2724
2726
  );
2725
2727
  let a;
2726
2728
  if (r === "task") {
2727
- const i = await t.getTask(n), c = _(i), d = [c.content];
2729
+ const i = await t.getTask(n), c = P(i), d = [c.content];
2728
2730
  c.description && d.push(`
2729
2731
 
2730
2732
  Description: ${c.description}`), c.dueDate && d.push(`
@@ -2789,7 +2791,7 @@ Favorite: Yes`), a = {
2789
2791
  projectId: s.string().optional().describe("Filter events by parent project ID."),
2790
2792
  taskId: s.string().optional().describe("Filter events by parent task ID (for subtask events)."),
2791
2793
  initiatorId: s.string().optional().describe("Filter by the user ID who initiated the event."),
2792
- limit: s.number().int().min(1).max(j.ACTIVITY_MAX).default(j.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
2794
+ limit: s.number().int().min(1).max($.ACTIVITY_MAX).default($.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
2793
2795
  cursor: s.string().optional().describe("Pagination cursor for retrieving the next page of results.")
2794
2796
  }, nn = {
2795
2797
  events: s.array(Lo).describe("The activity events."),
@@ -2837,7 +2839,7 @@ function cn({
2837
2839
  const a = [];
2838
2840
  t.objectId && a.push(`object ID: ${t.objectId}`), t.projectId && a.push(`project: ${t.projectId}`), t.taskId && a.push(`task: ${t.taskId}`), t.initiatorId && a.push(`initiator: ${t.initiatorId}`);
2839
2841
  const i = [];
2840
- return e.length === 0 && (i.push("No activity events match the specified filters"), i.push("Note: Activity logs only show recent events"), t.eventType && i.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && i.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && i.push("Verify the object ID is correct")), L({
2842
+ return e.length === 0 && (i.push("No activity events match the specified filters"), i.push("Note: Activity logs only show recent events"), t.eventType && i.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && i.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && i.push("Verify the object ID is correct")), N({
2841
2843
  subject: r,
2842
2844
  count: e.length,
2843
2845
  limit: t.limit,
@@ -2887,7 +2889,7 @@ const pn = {
2887
2889
  ),
2888
2890
  commentId: s.string().optional().describe("Get a specific comment by ID."),
2889
2891
  cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
2890
- limit: s.number().int().min(1).max(j.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
2892
+ limit: s.number().int().min(1).max($.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
2891
2893
  }, mn = {
2892
2894
  comments: s.array(Se).describe("The found comments."),
2893
2895
  searchType: s.string().describe(
@@ -2922,14 +2924,14 @@ const pn = {
2922
2924
  const l = await t.getComments({
2923
2925
  taskId: e.taskId,
2924
2926
  cursor: e.cursor || null,
2925
- limit: e.limit || j.COMMENTS_DEFAULT
2927
+ limit: e.limit || $.COMMENTS_DEFAULT
2926
2928
  });
2927
2929
  i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
2928
2930
  } else if (r) {
2929
2931
  const l = await t.getComments({
2930
2932
  projectId: r,
2931
2933
  cursor: e.cursor || null,
2932
- limit: e.limit || j.COMMENTS_DEFAULT
2934
+ limit: e.limit || $.COMMENTS_DEFAULT
2933
2935
  });
2934
2936
  i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
2935
2937
  } else
@@ -3045,7 +3047,7 @@ const wn = {
3045
3047
  responsibleUser: s.string().optional().describe(
3046
3048
  "Filter completed tasks assigned to this user. User ID, name, or email. For personal queries (summaries, plans, reports), set to current user from user-info to exclude collaborators. Defaults to all collaborators."
3047
3049
  ),
3048
- limit: s.number().int().min(1).max(j.COMPLETED_TASKS_MAX).default(j.COMPLETED_TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3050
+ limit: s.number().int().min(1).max($.COMPLETED_TASKS_MAX).default($.COMPLETED_TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3049
3051
  cursor: s.string().optional().describe(
3050
3052
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
3051
3053
  ),
@@ -3071,43 +3073,43 @@ const wn = {
3071
3073
  const u = await Xe(t, c), p = u?.email;
3072
3074
  let h = nt(r, n);
3073
3075
  u && p && (h = ne(h, `assigned to: ${p}`));
3074
- const b = await t.getUser(), I = b.tzInfo?.gmtString || "+00:00", C = await K({
3076
+ const k = await t.getUser(), b = k.tzInfo?.gmtString || "+00:00", j = await K({
3075
3077
  projectId: d,
3076
- user: b
3077
- }), D = Tn({
3078
+ user: k
3079
+ }), v = Tn({
3078
3080
  since: a,
3079
3081
  until: i,
3080
- userGmtOffset: I
3081
- }), N = `${D.since}T00:00:00${I}`, T = `${D.until}T23:59:59${I}`, y = new Date(N).toISOString(), $ = new Date(T).toISOString(), P = {
3082
+ userGmtOffset: b
3083
+ }), A = `${v.since}T00:00:00${b}`, w = `${v.until}T23:59:59${b}`, y = new Date(A).toISOString(), D = new Date(w).toISOString(), R = {
3082
3084
  ...e,
3083
- since: D.since,
3084
- until: D.until
3085
- }, { items: w, nextCursor: S } = o === "completion" ? await t.getCompletedTasksByCompletionDate({
3085
+ since: v.since,
3086
+ until: v.until
3087
+ }, { items: I, nextCursor: C } = o === "completion" ? await t.getCompletedTasksByCompletionDate({
3086
3088
  ...l,
3087
- projectId: C,
3089
+ projectId: j,
3088
3090
  since: y,
3089
- until: $,
3091
+ until: D,
3090
3092
  ...h ? { filterQuery: h, filterLang: "en" } : {}
3091
3093
  }) : await t.getCompletedTasksByDueDate({
3092
3094
  ...l,
3093
- projectId: C,
3095
+ projectId: j,
3094
3096
  since: y,
3095
- until: $,
3097
+ until: D,
3096
3098
  ...h ? { filterQuery: h, filterLang: "en" } : {}
3097
- }), v = w.map(_);
3099
+ }), S = I.map(P);
3098
3100
  return {
3099
3101
  textContent: Sn({
3100
- tasks: v,
3101
- args: P,
3102
- nextCursor: S,
3102
+ tasks: S,
3103
+ args: R,
3104
+ nextCursor: C,
3103
3105
  assigneeEmail: p
3104
3106
  }),
3105
3107
  structuredContent: {
3106
- tasks: v,
3107
- nextCursor: S ?? void 0,
3108
- totalCount: v.length,
3109
- hasMore: !!S,
3110
- appliedFilters: P
3108
+ tasks: S,
3109
+ nextCursor: C ?? void 0,
3110
+ totalCount: S.length,
3111
+ hasMore: !!C,
3112
+ appliedFilters: R
3111
3113
  }
3112
3114
  };
3113
3115
  }
@@ -3128,7 +3130,7 @@ function Sn({
3128
3130
  i.push(`assigned to: ${d}`);
3129
3131
  }
3130
3132
  const c = [];
3131
- return e.length === 0 && (c.push("No tasks completed in this date range"), c.push("Try expanding the date range"), (t.projectId || t.sectionId || t.parentId) && c.push("Try removing project/section/parent filters"), t.getBy === "due" && c.push('Try switching to "completion" date instead')), L({
3133
+ return e.length === 0 && (c.push("No tasks completed in this date range"), c.push("Try expanding the date range"), (t.projectId || t.sectionId || t.parentId) && c.push("Try removing project/section/parent filters"), t.getBy === "due" && c.push('Try switching to "completion" date instead')), N({
3132
3134
  subject: a,
3133
3135
  count: e.length,
3134
3136
  limit: t.limit,
@@ -3143,7 +3145,7 @@ const jn = {
3143
3145
  'Search for a goal by name (partial and case insensitive match). Supports wildcards (e.g. "ship*"). If omitted, all goals are returned.'
3144
3146
  ),
3145
3147
  ownerType: s.enum(ys).optional().describe("Filter by ownership type. Omit for all accessible goals."),
3146
- limit: s.number().int().min(1).max(j.GOALS_MAX).default(j.GOALS_DEFAULT).describe("The maximum number of goals to return per page."),
3148
+ limit: s.number().int().min(1).max($.GOALS_MAX).default($.GOALS_DEFAULT).describe("The maximum number of goals to return per page."),
3147
3149
  cursor: s.string().optional().describe(
3148
3150
  "The cursor to get the next page of goals (cursor is obtained from the previous call to this tool, with the same parameters)."
3149
3151
  )
@@ -3174,7 +3176,7 @@ const jn = {
3174
3176
  ).join(`
3175
3177
  `) : void 0;
3176
3178
  return {
3177
- textContent: L({
3179
+ textContent: N({
3178
3180
  subject: a,
3179
3181
  count: r.length,
3180
3182
  limit: e.limit,
@@ -3199,7 +3201,7 @@ const jn = {
3199
3201
  searchText: s.string().optional().describe(
3200
3202
  'Search for a label by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all labels are returned.'
3201
3203
  ),
3202
- limit: s.number().int().min(1).max(j.LABELS_MAX).default(j.LABELS_DEFAULT).describe("The maximum number of labels to return."),
3204
+ limit: s.number().int().min(1).max($.LABELS_MAX).default($.LABELS_DEFAULT).describe("The maximum number of labels to return."),
3203
3205
  cursor: s.string().optional().describe(
3204
3206
  "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."
3205
3207
  )
@@ -3254,7 +3256,7 @@ function En({
3254
3256
  const m = r.length > 0 ? `
3255
3257
  Shared labels (${r.length}): ${r.join(", ")}` : `
3256
3258
  No shared labels.`;
3257
- return L({
3259
+ return N({
3258
3260
  subject: n,
3259
3261
  count: e.length,
3260
3262
  limit: t.searchText ? void 0 : t.limit,
@@ -3434,7 +3436,7 @@ function Zt({
3434
3436
  const l = [];
3435
3437
  e.length === 0 && o && (l.push(`No users match "${o}"`), l.push("Try a broader search term or check spelling"), r > 0 && l.push(`${r} users available without filter`));
3436
3438
  const u = [];
3437
- return e.length > 0 ? (u.push(`Use ${Vt} with responsibleUser to assign new tasks`), u.push(`Use ${Jt} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${Kt} to find other projects`), o && r > 0 && u.push("Try searching without filters to see all users")), L({
3439
+ return e.length > 0 ? (u.push(`Use ${Vt} with responsibleUser to assign new tasks`), u.push(`Use ${Jt} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${Kt} to find other projects`), o && r > 0 && u.push("Try searching without filters to see all users")), N({
3438
3440
  subject: i,
3439
3441
  count: e.length,
3440
3442
  filterHints: c,
@@ -3448,7 +3450,7 @@ const { ADD_PROJECTS: Ln } = f, Nn = {
3448
3450
  searchText: s.string().optional().describe(
3449
3451
  'Search for a project by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all projects are returned.'
3450
3452
  ),
3451
- limit: s.number().int().min(1).max(j.PROJECTS_MAX).default(j.PROJECTS_DEFAULT).describe("The maximum number of projects to return."),
3453
+ limit: s.number().int().min(1).max($.PROJECTS_MAX).default($.PROJECTS_DEFAULT).describe("The maximum number of projects to return."),
3452
3454
  cursor: s.string().optional().describe(
3453
3455
  "The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."
3454
3456
  )
@@ -3498,7 +3500,7 @@ function Hn({
3498
3500
  const a = 10, c = e.slice(0, a).map(Or).join(`
3499
3501
  `), d = e.length - a, l = d > 0 ? `${c}
3500
3502
  …and ${d} more` : c, u = [];
3501
- 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 ${Ln} to create a project`))), L({
3503
+ 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 ${Ln} to create a project`))), N({
3502
3504
  subject: r,
3503
3505
  count: e.length,
3504
3506
  limit: t.searchText ? void 0 : t.limit,
@@ -3645,7 +3647,7 @@ function Jn({
3645
3647
  o ? (r.push("Try broader search terms"), r.push("Check spelling"), r.push("Remove searchText to see all sections")) : (r.push("Project has no sections yet"), r.push(`Use ${qn} to create sections`));
3646
3648
  const n = o ? `Sections in project ${t} matching "${o}"` : `Sections in project ${t}`, a = e.length > 0 ? e.map((i) => ` ${i.name} • id=${i.id}`).join(`
3647
3649
  `) : void 0;
3648
- return L({
3650
+ return N({
3649
3651
  subject: n,
3650
3652
  count: e.length,
3651
3653
  previewLines: a,
@@ -3663,7 +3665,7 @@ const Xn = {
3663
3665
  daysCount: s.number().int().min(1).max(30).default(1).describe(
3664
3666
  "The number of days to get the tasks for, starting from the start date. Default is 1 which means only tasks for the start date."
3665
3667
  ),
3666
- limit: s.number().int().min(1).max(j.TASKS_MAX).default(j.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3668
+ limit: s.number().int().min(1).max($.TASKS_MAX).default($.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3667
3669
  cursor: s.string().optional().describe(
3668
3670
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
3669
3671
  ),
@@ -3697,8 +3699,8 @@ const Xn = {
3697
3699
  a = "overdue";
3698
3700
  else if (e.startDate === "today")
3699
3701
  if (e.daysCount > 1) {
3700
- const p = /* @__PURE__ */ new Date(), m = oe(p), h = Fe(p, e.daysCount), b = at(h, { representation: "date" }), I = `(due after: ${m} | due: ${m}) & due before: ${b}`;
3701
- a = e.overdueOption === "exclude-overdue" ? I : `(${I} | overdue)`;
3702
+ const p = /* @__PURE__ */ new Date(), m = oe(p), h = Fe(p, e.daysCount), k = at(h, { representation: "date" }), b = `(due after: ${m} | due: ${m}) & due before: ${k}`;
3703
+ a = e.overdueOption === "exclude-overdue" ? b : `(${b} | overdue)`;
3702
3704
  } else
3703
3705
  a = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
3704
3706
  else if (e.startDate) {
@@ -3771,7 +3773,7 @@ function ea({
3771
3773
  i.push(`Great job! No tasks for today${c}`);
3772
3774
  } else
3773
3775
  i.push("Expand date range with larger 'daysCount'"), i.push("Check today's tasks with startDate='today'");
3774
- return L({
3776
+ return N({
3775
3777
  subject: a,
3776
3778
  count: e.length,
3777
3779
  limit: t.limit,
@@ -3855,7 +3857,7 @@ const oa = new sa(), { FIND_COMPLETED_TASKS: yt, ADD_TASKS: kt } = f, ra = {
3855
3857
  responsibleUserFiltering: s.enum(Lt).optional().describe(
3856
3858
  'How to filter by responsible user when responsibleUser is not provided. "assigned" = only tasks assigned to others; "unassignedOrMe" = only unassigned tasks or tasks assigned to me; "all" = all tasks regardless of assignment. Default value will be `unassignedOrMe`.'
3857
3859
  ),
3858
- limit: s.number().int().min(1).max(j.TASKS_MAX).default(j.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3860
+ limit: s.number().int().min(1).max($.TASKS_MAX).default($.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3859
3861
  cursor: s.string().optional().describe(
3860
3862
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
3861
3863
  ),
@@ -3892,8 +3894,8 @@ const oa = new sa(), { FIND_COMPLETED_TASKS: yt, ADD_TASKS: kt } = f, ra = {
3892
3894
  labelsOperator: p,
3893
3895
  filter: m,
3894
3896
  filterIdOrName: h
3895
- } = e, b = await t.getUser(), I = u && u.length > 0;
3896
- if (!o && !r && !n && !a && !i && !I && !m && !h)
3897
+ } = e, k = await t.getUser(), b = u && u.length > 0;
3898
+ if (!o && !r && !n && !a && !i && !b && !m && !h)
3897
3899
  throw new Error(
3898
3900
  "At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, labels, filter, or filterIdOrName"
3899
3901
  );
@@ -3905,23 +3907,23 @@ const oa = new sa(), { FIND_COMPLETED_TASKS: yt, ADD_TASKS: kt } = f, ra = {
3905
3907
  throw new Error(
3906
3908
  'The `filter`/`filterIdOrName` parameter cannot be combined with projectId, sectionId, or parentId. Use filter syntax instead (e.g. "##ProjectName").'
3907
3909
  );
3908
- let C = m;
3909
- h && (C = (await oa.resolveFilter(t, h)).filterQuery);
3910
- const D = await Xe(t, i), N = D?.userId, T = D?.email;
3910
+ let j = m;
3911
+ h && (j = (await oa.resolveFilter(t, h)).filterQuery);
3912
+ const v = await Xe(t, i), A = v?.userId, w = v?.email;
3911
3913
  if (r || n || a) {
3912
3914
  const x = {
3913
3915
  limit: d,
3914
3916
  cursor: l ?? null
3915
3917
  };
3916
- r && (x.projectId = await K({ projectId: r, user: b })), n && (x.sectionId = n), a && (x.parentId = a);
3917
- const { results: M, nextCursor: G } = await t.getTasks(x), xe = M.map(_);
3918
+ r && (x.projectId = await K({ projectId: r, user: k })), n && (x.sectionId = n), a && (x.parentId = a);
3919
+ const { results: M, nextCursor: G } = await t.getTasks(x), xe = M.map(P);
3918
3920
  let F = o ? xe.filter(
3919
3921
  (X) => X.content.toLowerCase().includes(o.toLowerCase()) || X.description?.toLowerCase().includes(o.toLowerCase())
3920
3922
  ) : xe;
3921
3923
  return F = $o({
3922
3924
  tasks: F,
3923
- resolvedAssigneeId: N,
3924
- currentUserId: b.id,
3925
+ resolvedAssigneeId: A,
3926
+ currentUserId: k.id,
3925
3927
  responsibleUserFiltering: c
3926
3928
  }), u && u.length > 0 && (F = p === "and" ? F.filter(
3927
3929
  (X) => u.every((Ae) => X.labels.includes(Ae))
@@ -3933,7 +3935,7 @@ const oa = new sa(), { FIND_COMPLETED_TASKS: yt, ADD_TASKS: kt } = f, ra = {
3933
3935
  args: e,
3934
3936
  nextCursor: G,
3935
3937
  isContainerSearch: !0,
3936
- assigneeEmail: T
3938
+ assigneeEmail: w
3937
3939
  }),
3938
3940
  structuredContent: {
3939
3941
  tasks: F,
@@ -3944,20 +3946,20 @@ const oa = new sa(), { FIND_COMPLETED_TASKS: yt, ADD_TASKS: kt } = f, ra = {
3944
3946
  }
3945
3947
  };
3946
3948
  }
3947
- if (N && !o && !I && !C) {
3949
+ if (A && !o && !b && !j) {
3948
3950
  const { results: x, nextCursor: M } = await t.getTasksByFilter({
3949
- query: `assigned to: ${T}`,
3951
+ query: `assigned to: ${w}`,
3950
3952
  lang: "en",
3951
3953
  limit: d,
3952
3954
  cursor: l ?? null
3953
- }), G = x.map(_);
3955
+ }), G = x.map(P);
3954
3956
  return {
3955
3957
  textContent: _e({
3956
3958
  tasks: G,
3957
3959
  args: e,
3958
3960
  nextCursor: M,
3959
3961
  isContainerSearch: !1,
3960
- assigneeEmail: T
3962
+ assigneeEmail: w
3961
3963
  }),
3962
3964
  structuredContent: {
3963
3965
  tasks: G,
@@ -3968,18 +3970,18 @@ const oa = new sa(), { FIND_COMPLETED_TASKS: yt, ADD_TASKS: kt } = f, ra = {
3968
3970
  }
3969
3971
  };
3970
3972
  }
3971
- let y = C ? `(${C})` : "";
3973
+ let y = j ? `(${j})` : "";
3972
3974
  o && (y = ne(y, `search: ${o}`));
3973
- const $ = nt(u, p);
3974
- if (y = ne(y, $), !(h && !i && !c)) {
3975
+ const D = nt(u, p);
3976
+ if (y = ne(y, D), !(h && !i && !c)) {
3975
3977
  const x = Nt({
3976
- resolvedAssigneeId: N,
3977
- assigneeEmail: T,
3978
+ resolvedAssigneeId: A,
3979
+ assigneeEmail: w,
3978
3980
  responsibleUserFiltering: c
3979
3981
  });
3980
3982
  y = ne(y, x);
3981
3983
  }
3982
- const { tasks: w, nextCursor: S } = await Qe({
3984
+ const { tasks: I, nextCursor: C } = await Qe({
3983
3985
  client: t,
3984
3986
  query: y,
3985
3987
  cursor: e.cursor,
@@ -3987,17 +3989,17 @@ const oa = new sa(), { FIND_COMPLETED_TASKS: yt, ADD_TASKS: kt } = f, ra = {
3987
3989
  });
3988
3990
  return {
3989
3991
  textContent: _e({
3990
- tasks: w,
3992
+ tasks: I,
3991
3993
  args: e,
3992
- nextCursor: S,
3994
+ nextCursor: C,
3993
3995
  isContainerSearch: !1,
3994
- assigneeEmail: T
3996
+ assigneeEmail: w
3995
3997
  }),
3996
3998
  structuredContent: {
3997
- tasks: w,
3998
- nextCursor: S ?? void 0,
3999
- totalCount: w.length,
4000
- hasMore: !!S,
3999
+ tasks: I,
4000
+ nextCursor: C ?? void 0,
4001
+ totalCount: I.length,
4002
+ hasMore: !!C,
4001
4003
  appliedFilters: e
4002
4004
  }
4003
4005
  };
@@ -4057,7 +4059,7 @@ function _e({
4057
4059
  t.searchText && (c.push("Try broader search terms"), c.push("Verify spelling and try partial words"), t.responsibleUser || c.push(`Check completed tasks with ${yt}`));
4058
4060
  }
4059
4061
  }
4060
- return L({
4062
+ return N({
4061
4063
  subject: a,
4062
4064
  count: e.length,
4063
4065
  limit: t.limit,
@@ -4207,10 +4209,10 @@ async function pa(e, t) {
4207
4209
  do {
4208
4210
  const { results: n, nextCursor: a } = await e.getTasks({
4209
4211
  projectId: t,
4210
- limit: j.TASKS_BATCH_SIZE,
4212
+ limit: $.TASKS_BATCH_SIZE,
4211
4213
  cursor: r ?? void 0
4212
4214
  });
4213
- o = o.concat(n.map(_)), r = a ?? void 0;
4215
+ o = o.concat(n.map(P)), r = a ?? void 0;
4214
4216
  } while (r);
4215
4217
  return o;
4216
4218
  }
@@ -4842,97 +4844,97 @@ const Ga = {
4842
4844
  if ((o === "assign" || o === "reassign") && !n)
4843
4845
  throw new Error(`${o} operation requires responsibleUser parameter`);
4844
4846
  const c = await Promise.allSettled(
4845
- r.map(async (T) => {
4847
+ r.map(async (w) => {
4846
4848
  try {
4847
- return await t.getTask(T);
4849
+ return await t.getTask(w);
4848
4850
  } catch {
4849
- throw new Error(`Task ${T} not found or not accessible`);
4851
+ throw new Error(`Task ${w} not found or not accessible`);
4850
4852
  }
4851
4853
  })
4852
4854
  ), d = [], l = [];
4853
- for (let T = 0; T < c.length; T++) {
4854
- const y = c[T];
4855
+ for (let w = 0; w < c.length; w++) {
4856
+ const y = c[w];
4855
4857
  y && y.status === "fulfilled" ? d.push(y.value) : y && y.status === "rejected" ? l.push({
4856
- taskId: r[T] || "invalid-task-id",
4858
+ taskId: r[w] || "invalid-task-id",
4857
4859
  success: !1,
4858
4860
  error: y.reason?.message || "Task not accessible"
4859
4861
  }) : l.push({
4860
- taskId: r[T] || "invalid-task-id",
4862
+ taskId: r[w] || "invalid-task-id",
4861
4863
  success: !1,
4862
4864
  error: "Task not accessible"
4863
4865
  });
4864
4866
  }
4865
4867
  if (d.length === 0) {
4866
- const T = l.map((y) => `"${y.taskId}": ${y.error}`).join("; ");
4867
- throw new Error(`All ${l.length} task(s) failed: ${T}`);
4868
+ const w = l.map((y) => `"${y.taskId}": ${y.error}`).join("; ");
4869
+ throw new Error(`All ${l.length} task(s) failed: ${w}`);
4868
4870
  }
4869
4871
  let u;
4870
4872
  o === "reassign" && a && (u = (await W.resolveUser(t, a))?.userId || a);
4871
4873
  const p = [];
4872
- for (const T of d)
4873
- o === "reassign" && u && T.responsibleUid !== u || p.push({
4874
- taskId: T.id,
4875
- projectId: T.projectId,
4874
+ for (const w of d)
4875
+ o === "reassign" && u && w.responsibleUid !== u || p.push({
4876
+ taskId: w.id,
4877
+ projectId: w.projectId,
4876
4878
  responsibleUid: n || ""
4877
4879
  // Will be validated appropriately
4878
4880
  });
4879
4881
  if (o === "unassign") {
4880
4882
  if (i) {
4881
- const w = d.map((v) => ({
4882
- taskId: v.id,
4883
+ const I = d.map((S) => ({
4884
+ taskId: S.id,
4883
4885
  success: !0,
4884
- originalAssigneeId: v.responsibleUid ?? void 0,
4886
+ originalAssigneeId: S.responsibleUid ?? void 0,
4885
4887
  newAssigneeId: void 0
4886
4888
  }));
4887
4889
  return {
4888
4890
  textContent: Pe({
4889
4891
  operation: o,
4890
- results: w,
4892
+ results: I,
4891
4893
  dryRun: !0
4892
4894
  }),
4893
4895
  structuredContent: {
4894
4896
  operation: o,
4895
- results: w,
4897
+ results: I,
4896
4898
  totalRequested: r.length,
4897
- successful: w.length,
4899
+ successful: I.length,
4898
4900
  failed: l.length,
4899
4901
  dryRun: !0
4900
4902
  }
4901
4903
  };
4902
4904
  }
4903
- const T = d.map(async (w) => {
4905
+ const w = d.map(async (I) => {
4904
4906
  try {
4905
- return await t.updateTask(w.id, { assigneeId: null }), {
4906
- taskId: w.id,
4907
+ return await t.updateTask(I.id, { assigneeId: null }), {
4908
+ taskId: I.id,
4907
4909
  success: !0,
4908
- originalAssigneeId: w.responsibleUid ?? void 0,
4910
+ originalAssigneeId: I.responsibleUid ?? void 0,
4909
4911
  newAssigneeId: void 0
4910
4912
  };
4911
- } catch (S) {
4913
+ } catch (C) {
4912
4914
  return {
4913
- taskId: w.id,
4915
+ taskId: I.id,
4914
4916
  success: !1,
4915
- error: S instanceof Error ? S.message : "Update failed",
4916
- originalAssigneeId: w.responsibleUid ?? void 0
4917
+ error: C instanceof Error ? C.message : "Update failed",
4918
+ originalAssigneeId: I.responsibleUid ?? void 0
4917
4919
  };
4918
4920
  }
4919
- }), y = await Promise.all(T), $ = [...y, ...l];
4920
- if ($.length > 0 && $.every((w) => !w.success)) {
4921
- const w = $.map((S) => `"${S.taskId}": ${S.error}`).join("; ");
4922
- throw new Error(`All ${$.length} unassign operation(s) failed: ${w}`);
4921
+ }), y = await Promise.all(w), D = [...y, ...l];
4922
+ if (D.length > 0 && D.every((I) => !I.success)) {
4923
+ const I = D.map((C) => `"${C.taskId}": ${C.error}`).join("; ");
4924
+ throw new Error(`All ${D.length} unassign operation(s) failed: ${I}`);
4923
4925
  }
4924
4926
  return {
4925
4927
  textContent: Pe({
4926
4928
  operation: o,
4927
- results: $,
4929
+ results: D,
4928
4930
  dryRun: !1
4929
4931
  }),
4930
4932
  structuredContent: {
4931
4933
  operation: o,
4932
- results: $,
4934
+ results: D,
4933
4935
  totalRequested: r.length,
4934
- successful: y.filter((w) => w.success).length,
4935
- failed: $.filter((w) => !w.success).length,
4936
+ successful: y.filter((I) => I.success).length,
4937
+ failed: D.filter((I) => !I.success).length,
4936
4938
  dryRun: !1
4937
4939
  }
4938
4940
  };
@@ -4940,81 +4942,81 @@ const Ga = {
4940
4942
  const m = await st.validateBulkAssignment(
4941
4943
  t,
4942
4944
  p
4943
- ), h = [], b = [];
4944
- for (let T = 0; T < p.length; T++) {
4945
- const y = p[T], $ = m[T];
4946
- y && $?.isValid ? h.push({ assignment: y, validation: $ }) : y?.taskId && b.push({
4945
+ ), h = [], k = [];
4946
+ for (let w = 0; w < p.length; w++) {
4947
+ const y = p[w], D = m[w];
4948
+ y && D?.isValid ? h.push({ assignment: y, validation: D }) : y?.taskId && k.push({
4947
4949
  taskId: y.taskId,
4948
4950
  success: !1,
4949
- error: $?.error?.message || "Validation failed"
4951
+ error: D?.error?.message || "Validation failed"
4950
4952
  });
4951
4953
  }
4952
- async function I(T, y) {
4953
- const $ = T.filter(
4954
- (w) => w.assignment != null && w.validation != null
4954
+ async function b(w, y) {
4955
+ const D = w.filter(
4956
+ (I) => I.assignment != null && I.validation != null
4955
4957
  );
4956
4958
  if (!y)
4957
- return $.map(({ assignment: w, validation: S }) => {
4958
- const v = d.find((x) => x.id === w.taskId);
4959
- if (!w.taskId || !S.resolvedUser?.userId)
4959
+ return D.map(({ assignment: I, validation: C }) => {
4960
+ const S = d.find((x) => x.id === I.taskId);
4961
+ if (!I.taskId || !C.resolvedUser?.userId)
4960
4962
  throw new Error(
4961
4963
  "Invalid assignment or validation data - this should not happen"
4962
4964
  );
4963
4965
  return {
4964
- taskId: w.taskId,
4966
+ taskId: I.taskId,
4965
4967
  success: !0,
4966
- originalAssigneeId: v?.responsibleUid ?? void 0,
4967
- newAssigneeId: S.resolvedUser.userId
4968
+ originalAssigneeId: S?.responsibleUid ?? void 0,
4969
+ newAssigneeId: C.resolvedUser.userId
4968
4970
  };
4969
4971
  });
4970
- const P = $.map(
4971
- async ({ assignment: w, validation: S }) => {
4972
- const v = d.find((x) => x.id === w.taskId);
4973
- if (!w.taskId || !S.resolvedUser?.userId)
4972
+ const R = D.map(
4973
+ async ({ assignment: I, validation: C }) => {
4974
+ const S = d.find((x) => x.id === I.taskId);
4975
+ if (!I.taskId || !C.resolvedUser?.userId)
4974
4976
  return {
4975
- taskId: w.taskId || "unknown-task",
4977
+ taskId: I.taskId || "unknown-task",
4976
4978
  success: !1,
4977
4979
  error: "Invalid assignment data - missing task ID or resolved user",
4978
- originalAssigneeId: v?.responsibleUid ?? void 0
4980
+ originalAssigneeId: S?.responsibleUid ?? void 0
4979
4981
  };
4980
4982
  try {
4981
- return await t.updateTask(w.taskId, {
4982
- assigneeId: S.resolvedUser.userId
4983
+ return await t.updateTask(I.taskId, {
4984
+ assigneeId: C.resolvedUser.userId
4983
4985
  }), {
4984
- taskId: w.taskId,
4986
+ taskId: I.taskId,
4985
4987
  success: !0,
4986
- originalAssigneeId: v?.responsibleUid ?? void 0,
4987
- newAssigneeId: S.resolvedUser.userId
4988
+ originalAssigneeId: S?.responsibleUid ?? void 0,
4989
+ newAssigneeId: C.resolvedUser.userId
4988
4990
  };
4989
4991
  } catch (x) {
4990
4992
  return {
4991
- taskId: w.taskId,
4993
+ taskId: I.taskId,
4992
4994
  success: !1,
4993
4995
  error: x instanceof Error ? x.message : "Update failed",
4994
- originalAssigneeId: v?.responsibleUid ?? void 0
4996
+ originalAssigneeId: S?.responsibleUid ?? void 0
4995
4997
  };
4996
4998
  }
4997
4999
  }
4998
5000
  );
4999
- return Promise.all(P);
5001
+ return Promise.all(R);
5000
5002
  }
5001
- const C = await I(h, !i), D = [...C, ...b, ...l];
5002
- if (D.length > 0 && D.every((T) => !T.success)) {
5003
- const T = D.map((y) => `"${y.taskId}": ${y.error}`).join("; ");
5004
- throw new Error(`All ${D.length} ${o} operation(s) failed: ${T}`);
5003
+ const j = await b(h, !i), v = [...j, ...k, ...l];
5004
+ if (v.length > 0 && v.every((w) => !w.success)) {
5005
+ const w = v.map((y) => `"${y.taskId}": ${y.error}`).join("; ");
5006
+ throw new Error(`All ${v.length} ${o} operation(s) failed: ${w}`);
5005
5007
  }
5006
5008
  return {
5007
5009
  textContent: Pe({
5008
5010
  operation: o,
5009
- results: D,
5011
+ results: v,
5010
5012
  dryRun: i
5011
5013
  }),
5012
5014
  structuredContent: {
5013
5015
  operation: o,
5014
- results: D,
5016
+ results: v,
5015
5017
  totalRequested: r.length,
5016
- successful: C.filter((T) => T.success).length,
5017
- failed: D.filter((T) => !T.success).length,
5018
+ successful: j.filter((w) => w.success).length,
5019
+ failed: v.filter((w) => !w.success).length,
5018
5020
  dryRun: i
5019
5021
  }
5020
5022
  };
@@ -5266,7 +5268,7 @@ const Ja = {
5266
5268
  const l = d instanceof Error ? d.message : String(d);
5267
5269
  throw new Error(`Reschedule failed: ${l}`);
5268
5270
  }
5269
- const a = await Promise.all(o.map((d) => t.getTask(d.id))), i = a.map(_);
5271
+ const a = await Promise.all(o.map((d) => t.getTask(d.id))), i = a.map(P);
5270
5272
  return {
5271
5273
  textContent: ot("Rescheduled", i, {
5272
5274
  showDetails: i.length <= 5
@@ -5308,7 +5310,7 @@ const li = {
5308
5310
  Qe({
5309
5311
  client: t,
5310
5312
  query: `search: ${o}`,
5311
- limit: j.TASKS_MAX,
5313
+ limit: $.TASKS_MAX,
5312
5314
  cursor: void 0
5313
5315
  }),
5314
5316
  Mt(t, o)
@@ -5473,11 +5475,11 @@ const Ii = s.object({
5473
5475
  }
5474
5476
  };
5475
5477
  const i = r.map((m) => {
5476
- const { id: h, color: b, ...I } = m;
5478
+ const { id: h, color: k, ...b } = m;
5477
5479
  return Y("filter_update", {
5478
5480
  id: h,
5479
- ...I,
5480
- ...b !== void 0 ? { color: b } : {}
5481
+ ...b,
5482
+ ...k !== void 0 ? { color: k } : {}
5481
5483
  });
5482
5484
  });
5483
5485
  await t.sync({ commands: i });
@@ -5571,13 +5573,13 @@ const _i = {
5571
5573
  const u = Ui(l);
5572
5574
  if (u !== null)
5573
5575
  return { kind: "skipped", id: l.id, reason: u };
5574
- const { id: p, description: m, deadline: h, responsibleUid: b, ...I } = l, C = await t.updateGoal(p, {
5575
- ...I,
5576
+ const { id: p, description: m, deadline: h, responsibleUid: k, ...b } = l, j = await t.updateGoal(p, {
5577
+ ...b,
5576
5578
  description: Re(m, re),
5577
5579
  deadline: Re(h, re),
5578
- responsibleUid: Re(b, qe)
5580
+ responsibleUid: Re(k, qe)
5579
5581
  });
5580
- return { kind: "updated", goal: Ie(C) };
5582
+ return { kind: "updated", goal: Ie(j) };
5581
5583
  })
5582
5584
  ), r = o.filter(
5583
5585
  (l) => l.kind === "updated"
@@ -5656,8 +5658,8 @@ const Ri = s.object({
5656
5658
  if (u.labelType === "personal") {
5657
5659
  const m = Bi(u);
5658
5660
  if (m !== null) return { kind: "skipped", reason: m };
5659
- const { id: h, labelType: b, ...I } = u;
5660
- return { kind: "updated", label: await t.updateLabel(h, I) };
5661
+ const { id: h, labelType: k, ...b } = u;
5662
+ return { kind: "updated", label: await t.updateLabel(h, b) };
5661
5663
  }
5662
5664
  return await t.renameSharedLabel({
5663
5665
  name: u.name,
@@ -5966,66 +5968,66 @@ const dc = s.object({
5966
5968
  parentId: p,
5967
5969
  dueString: m,
5968
5970
  duration: h,
5969
- responsibleUser: b,
5970
- priority: I,
5971
- labels: C,
5972
- deadlineDate: D,
5973
- ...N
5974
- } = c, T = await K({
5971
+ responsibleUser: k,
5972
+ priority: b,
5973
+ labels: j,
5974
+ deadlineDate: v,
5975
+ ...A
5976
+ } = c, w = await K({
5975
5977
  projectId: l,
5976
5978
  client: t
5977
5979
  });
5978
5980
  let y = {
5979
- ...N,
5980
- ...C !== void 0 && { labels: C }
5981
+ ...A,
5982
+ ...j !== void 0 && { labels: j }
5981
5983
  };
5982
- I && (y.priority = Rt(I));
5983
- const $ = jt(
5984
+ b && (y.priority = Rt(b));
5985
+ const D = jt(
5984
5986
  m,
5985
5987
  lc,
5986
5988
  pc
5987
5989
  );
5988
- $ !== void 0 && (y = { ...y, dueString: $ });
5989
- const P = jt(
5990
- D,
5990
+ D !== void 0 && (y = { ...y, dueString: D });
5991
+ const R = jt(
5992
+ v,
5991
5993
  uc,
5992
5994
  null
5993
5995
  );
5994
- if (P !== void 0 && (y = { ...y, deadlineDate: P }), h)
5996
+ if (R !== void 0 && (y = { ...y, deadlineDate: R }), h)
5995
5997
  try {
5996
- const { minutes: v } = Pt(h);
5998
+ const { minutes: S } = Pt(h);
5997
5999
  y = {
5998
6000
  ...y,
5999
- duration: v,
6001
+ duration: S,
6000
6002
  durationUnit: "minute"
6001
6003
  };
6002
- } catch (v) {
6003
- throw v instanceof O ? new Error(`Task ${d}: ${v.message}`) : v;
6004
+ } catch (S) {
6005
+ throw S instanceof U ? new Error(`Task ${d}: ${S.message}`) : S;
6004
6006
  }
6005
- if (b !== void 0)
6006
- if (b === null || b === "unassign")
6007
+ if (k !== void 0)
6008
+ if (k === null || k === "unassign")
6007
6009
  y = { ...y, assigneeId: null };
6008
6010
  else {
6009
- const v = await st.validateTaskUpdateAssignment(
6011
+ const S = await st.validateTaskUpdateAssignment(
6010
6012
  t,
6011
6013
  d,
6012
- b
6014
+ k
6013
6015
  );
6014
- if (!v.isValid) {
6015
- const x = v.error?.message || "Assignment validation failed", M = v.error?.suggestions?.join(". ") || "";
6016
+ if (!S.isValid) {
6017
+ const x = S.error?.message || "Assignment validation failed", M = S.error?.suggestions?.join(". ") || "";
6016
6018
  throw new Error(
6017
6019
  `Task ${d}: ${x}${M ? `. ${M}` : ""}`
6018
6020
  );
6019
6021
  }
6020
- y = { ...y, assigneeId: v.resolvedUser?.userId };
6022
+ y = { ...y, assigneeId: S.resolvedUser?.userId };
6021
6023
  }
6022
- if (!T && !u && !p)
6024
+ if (!w && !u && !p)
6023
6025
  return await t.updateTask(d, y);
6024
- const w = Eo(d, T, u, p), S = await t.moveTask(d, w);
6025
- return Object.keys(y).length > 0 ? await t.updateTask(d, y) : S;
6026
+ const I = Eo(d, w, u, p), C = await t.moveTask(d, I);
6027
+ return Object.keys(y).length > 0 ? await t.updateTask(d, y) : C;
6026
6028
  }), n = (await Promise.all(r)).filter(
6027
6029
  (c) => c !== void 0
6028
- ), a = n.map(_);
6030
+ ), a = n.map(P);
6029
6031
  return {
6030
6032
  textContent: bc({
6031
6033
  tasks: a,
@@ -6124,7 +6126,7 @@ function Cc(e, t) {
6124
6126
  });
6125
6127
  }
6126
6128
  async function $c(e) {
6127
- const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", r = rs(o), n = /* @__PURE__ */ new Date(), a = Cc(n, r), i = t.startDay ?? 1, c = Sc(i), d = Tc(t), l = new Date(n.toLocaleString("en-US", { timeZone: r })), u = wc(l, i), p = Ic(u), m = vc(l), b = [
6129
+ const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", r = rs(o), n = /* @__PURE__ */ new Date(), a = Cc(n, r), i = t.startDay ?? 1, c = Sc(i), d = Tc(t), l = new Date(n.toLocaleString("en-US", { timeZone: r })), u = wc(l, i), p = Ic(u), m = vc(l), k = [
6128
6130
  "# User Information",
6129
6131
  "",
6130
6132
  `**User ID:** ${t.id}`,
@@ -6147,7 +6149,7 @@ async function $c(e) {
6147
6149
  "## Account Info",
6148
6150
  `**Plan:** ${d}`
6149
6151
  ].join(`
6150
- `), I = {
6152
+ `), b = {
6151
6153
  type: "user_info",
6152
6154
  userId: t.id,
6153
6155
  fullName: t.fullName,
@@ -6164,7 +6166,7 @@ async function $c(e) {
6164
6166
  email: t.email,
6165
6167
  plan: d
6166
6168
  };
6167
- return { textContent: b, structuredContent: I };
6169
+ return { textContent: k, structuredContent: b };
6168
6170
  }
6169
6171
  const Dc = {
6170
6172
  name: f.USER_INFO,